first commit
This commit is contained in:
7
frontend/node_modules/antd/lib/radio/context.d.ts
generated
vendored
Normal file
7
frontend/node_modules/antd/lib/radio/context.d.ts
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
import * as React from 'react';
|
||||
import type { RadioGroupContextProps } from './interface';
|
||||
declare const RadioGroupContext: React.Context<RadioGroupContextProps | null>;
|
||||
export declare const RadioGroupContextProvider: React.Provider<RadioGroupContextProps | null>;
|
||||
export default RadioGroupContext;
|
||||
export declare const RadioOptionTypeContext: React.Context<import("./interface").RadioGroupOptionType | null>;
|
||||
export declare const RadioOptionTypeContextProvider: React.Provider<import("./interface").RadioGroupOptionType | null>;
|
||||
13
frontend/node_modules/antd/lib/radio/context.js
generated
vendored
Normal file
13
frontend/node_modules/antd/lib/radio/context.js
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
"use strict";
|
||||
|
||||
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = exports.RadioOptionTypeContextProvider = exports.RadioOptionTypeContext = exports.RadioGroupContextProvider = void 0;
|
||||
var React = _interopRequireWildcard(require("react"));
|
||||
const RadioGroupContext = /*#__PURE__*/React.createContext(null);
|
||||
const RadioGroupContextProvider = exports.RadioGroupContextProvider = RadioGroupContext.Provider;
|
||||
var _default = exports.default = RadioGroupContext;
|
||||
const RadioOptionTypeContext = exports.RadioOptionTypeContext = /*#__PURE__*/React.createContext(null);
|
||||
const RadioOptionTypeContextProvider = exports.RadioOptionTypeContextProvider = RadioOptionTypeContext.Provider;
|
||||
4
frontend/node_modules/antd/lib/radio/group.d.ts
generated
vendored
Normal file
4
frontend/node_modules/antd/lib/radio/group.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
import * as React from 'react';
|
||||
import type { RadioGroupProps } from './interface';
|
||||
declare const _default: React.NamedExoticComponent<RadioGroupProps & React.RefAttributes<HTMLDivElement>>;
|
||||
export default _default;
|
||||
131
frontend/node_modules/antd/lib/radio/group.js
generated
vendored
Normal file
131
frontend/node_modules/antd/lib/radio/group.js
generated
vendored
Normal file
@@ -0,0 +1,131 @@
|
||||
"use strict";
|
||||
"use client";
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
||||
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
var React = _interopRequireWildcard(require("react"));
|
||||
var _classnames = _interopRequireDefault(require("classnames"));
|
||||
var _useId = _interopRequireDefault(require("rc-util/lib/hooks/useId"));
|
||||
var _useMergedState = _interopRequireDefault(require("rc-util/lib/hooks/useMergedState"));
|
||||
var _pickAttrs = _interopRequireDefault(require("rc-util/lib/pickAttrs"));
|
||||
var _configProvider = require("../config-provider");
|
||||
var _useCSSVarCls = _interopRequireDefault(require("../config-provider/hooks/useCSSVarCls"));
|
||||
var _useSize = _interopRequireDefault(require("../config-provider/hooks/useSize"));
|
||||
var _context = require("./context");
|
||||
var _radio = _interopRequireDefault(require("./radio"));
|
||||
var _style = _interopRequireDefault(require("./style"));
|
||||
var _context2 = require("../form/context");
|
||||
var _useForm = require("../form/hooks/useForm");
|
||||
const RadioGroup = /*#__PURE__*/React.forwardRef((props, ref) => {
|
||||
const {
|
||||
getPrefixCls,
|
||||
direction
|
||||
} = React.useContext(_configProvider.ConfigContext);
|
||||
const {
|
||||
name: formItemName
|
||||
} = React.useContext(_context2.FormItemInputContext);
|
||||
const defaultName = (0, _useId.default)((0, _useForm.toNamePathStr)(formItemName));
|
||||
const {
|
||||
prefixCls: customizePrefixCls,
|
||||
className,
|
||||
rootClassName,
|
||||
options,
|
||||
buttonStyle = 'outline',
|
||||
disabled,
|
||||
children,
|
||||
size: customizeSize,
|
||||
style,
|
||||
id,
|
||||
optionType,
|
||||
name = defaultName,
|
||||
defaultValue,
|
||||
value: customizedValue,
|
||||
block = false,
|
||||
onChange,
|
||||
onMouseEnter,
|
||||
onMouseLeave,
|
||||
onFocus,
|
||||
onBlur
|
||||
} = props;
|
||||
const [value, setValue] = (0, _useMergedState.default)(defaultValue, {
|
||||
value: customizedValue
|
||||
});
|
||||
const onRadioChange = React.useCallback(event => {
|
||||
const lastValue = value;
|
||||
const val = event.target.value;
|
||||
if (!('value' in props)) {
|
||||
setValue(val);
|
||||
}
|
||||
if (val !== lastValue) {
|
||||
onChange === null || onChange === void 0 ? void 0 : onChange(event);
|
||||
}
|
||||
}, [value, setValue, onChange]);
|
||||
const prefixCls = getPrefixCls('radio', customizePrefixCls);
|
||||
const groupPrefixCls = `${prefixCls}-group`;
|
||||
// Style
|
||||
const rootCls = (0, _useCSSVarCls.default)(prefixCls);
|
||||
const [wrapCSSVar, hashId, cssVarCls] = (0, _style.default)(prefixCls, rootCls);
|
||||
let childrenToRender = children;
|
||||
// 如果存在 options, 优先使用
|
||||
if (options && options.length > 0) {
|
||||
childrenToRender = options.map(option => {
|
||||
if (typeof option === 'string' || typeof option === 'number') {
|
||||
// 此处类型自动推导为 string
|
||||
return /*#__PURE__*/React.createElement(_radio.default, {
|
||||
key: option.toString(),
|
||||
prefixCls: prefixCls,
|
||||
disabled: disabled,
|
||||
value: option,
|
||||
checked: value === option
|
||||
}, option);
|
||||
}
|
||||
// 此处类型自动推导为 { label: string value: string }
|
||||
return /*#__PURE__*/React.createElement(_radio.default, {
|
||||
key: `radio-group-value-options-${option.value}`,
|
||||
prefixCls: prefixCls,
|
||||
disabled: option.disabled || disabled,
|
||||
value: option.value,
|
||||
checked: value === option.value,
|
||||
title: option.title,
|
||||
style: option.style,
|
||||
className: option.className,
|
||||
id: option.id,
|
||||
required: option.required
|
||||
}, option.label);
|
||||
});
|
||||
}
|
||||
const mergedSize = (0, _useSize.default)(customizeSize);
|
||||
const classString = (0, _classnames.default)(groupPrefixCls, `${groupPrefixCls}-${buttonStyle}`, {
|
||||
[`${groupPrefixCls}-${mergedSize}`]: mergedSize,
|
||||
[`${groupPrefixCls}-rtl`]: direction === 'rtl',
|
||||
[`${groupPrefixCls}-block`]: block
|
||||
}, className, rootClassName, hashId, cssVarCls, rootCls);
|
||||
const memoizedValue = React.useMemo(() => ({
|
||||
onChange: onRadioChange,
|
||||
value,
|
||||
disabled,
|
||||
name,
|
||||
optionType,
|
||||
block
|
||||
}), [onRadioChange, value, disabled, name, optionType, block]);
|
||||
return wrapCSSVar(/*#__PURE__*/React.createElement("div", Object.assign({}, (0, _pickAttrs.default)(props, {
|
||||
aria: true,
|
||||
data: true
|
||||
}), {
|
||||
className: classString,
|
||||
style: style,
|
||||
onMouseEnter: onMouseEnter,
|
||||
onMouseLeave: onMouseLeave,
|
||||
onFocus: onFocus,
|
||||
onBlur: onBlur,
|
||||
id: id,
|
||||
ref: ref
|
||||
}), /*#__PURE__*/React.createElement(_context.RadioGroupContextProvider, {
|
||||
value: memoizedValue
|
||||
}, childrenToRender)));
|
||||
});
|
||||
var _default = exports.default = /*#__PURE__*/React.memo(RadioGroup);
|
||||
11
frontend/node_modules/antd/lib/radio/index.d.ts
generated
vendored
Normal file
11
frontend/node_modules/antd/lib/radio/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
import Group from './group';
|
||||
import InternalRadio from './radio';
|
||||
import Button from './radioButton';
|
||||
export type { RadioChangeEvent, RadioChangeEventTarget, RadioGroupButtonStyle, RadioGroupContextProps, RadioGroupOptionType, RadioGroupProps, RadioProps, RadioRef, } from './interface';
|
||||
export { Button, Group };
|
||||
type CompoundedComponent = typeof InternalRadio & {
|
||||
Group: typeof Group;
|
||||
Button: typeof Button;
|
||||
};
|
||||
declare const Radio: CompoundedComponent;
|
||||
export default Radio;
|
||||
28
frontend/node_modules/antd/lib/radio/index.js
generated
vendored
Normal file
28
frontend/node_modules/antd/lib/radio/index.js
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
"use strict";
|
||||
"use client";
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "Button", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _radioButton.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "Group", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _group.default;
|
||||
}
|
||||
});
|
||||
exports.default = void 0;
|
||||
var _group = _interopRequireDefault(require("./group"));
|
||||
var _radio = _interopRequireDefault(require("./radio"));
|
||||
var _radioButton = _interopRequireDefault(require("./radioButton"));
|
||||
const Radio = _radio.default;
|
||||
Radio.Button = _radioButton.default;
|
||||
Radio.Group = _group.default;
|
||||
Radio.__ANT_RADIO = true;
|
||||
var _default = exports.default = Radio;
|
||||
43
frontend/node_modules/antd/lib/radio/interface.d.ts
generated
vendored
Normal file
43
frontend/node_modules/antd/lib/radio/interface.d.ts
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
import type * as React from 'react';
|
||||
import type { AbstractCheckboxProps } from '../checkbox/Checkbox';
|
||||
import type { AbstractCheckboxGroupProps } from '../checkbox/Group';
|
||||
import type { SizeType } from '../config-provider/SizeContext';
|
||||
export type { CheckboxRef as RadioRef } from 'rc-checkbox';
|
||||
export type RadioGroupButtonStyle = 'outline' | 'solid';
|
||||
export type RadioGroupOptionType = 'default' | 'button';
|
||||
export interface RadioGroupProps extends AbstractCheckboxGroupProps {
|
||||
defaultValue?: any;
|
||||
value?: any;
|
||||
onChange?: (e: RadioChangeEvent) => void;
|
||||
size?: SizeType;
|
||||
disabled?: boolean;
|
||||
onMouseEnter?: React.MouseEventHandler<HTMLDivElement>;
|
||||
onMouseLeave?: React.MouseEventHandler<HTMLDivElement>;
|
||||
name?: string;
|
||||
children?: React.ReactNode;
|
||||
id?: string;
|
||||
optionType?: RadioGroupOptionType;
|
||||
buttonStyle?: RadioGroupButtonStyle;
|
||||
onFocus?: React.FocusEventHandler<HTMLDivElement>;
|
||||
onBlur?: React.FocusEventHandler<HTMLDivElement>;
|
||||
block?: boolean;
|
||||
}
|
||||
export interface RadioGroupContextProps {
|
||||
onChange: (e: RadioChangeEvent) => void;
|
||||
value: any;
|
||||
disabled?: boolean;
|
||||
name?: string;
|
||||
block?: boolean;
|
||||
}
|
||||
export interface RadioProps extends AbstractCheckboxProps<RadioChangeEvent> {
|
||||
}
|
||||
export interface RadioChangeEventTarget extends RadioProps {
|
||||
checked: boolean;
|
||||
}
|
||||
export interface RadioChangeEvent {
|
||||
target: RadioChangeEventTarget;
|
||||
stopPropagation: () => void;
|
||||
preventDefault: () => void;
|
||||
nativeEvent: MouseEvent;
|
||||
}
|
||||
export type RadioOptionTypeContextProps = RadioGroupOptionType;
|
||||
5
frontend/node_modules/antd/lib/radio/interface.js
generated
vendored
Normal file
5
frontend/node_modules/antd/lib/radio/interface.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
4
frontend/node_modules/antd/lib/radio/radio.d.ts
generated
vendored
Normal file
4
frontend/node_modules/antd/lib/radio/radio.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
import * as React from 'react';
|
||||
import type { RadioProps, RadioRef } from './interface';
|
||||
declare const Radio: React.ForwardRefExoticComponent<RadioProps & React.RefAttributes<RadioRef>>;
|
||||
export default Radio;
|
||||
116
frontend/node_modules/antd/lib/radio/radio.js
generated
vendored
Normal file
116
frontend/node_modules/antd/lib/radio/radio.js
generated
vendored
Normal file
@@ -0,0 +1,116 @@
|
||||
"use strict";
|
||||
"use client";
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
||||
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
var React = _interopRequireWildcard(require("react"));
|
||||
var _classnames = _interopRequireDefault(require("classnames"));
|
||||
var _rcCheckbox = _interopRequireDefault(require("rc-checkbox"));
|
||||
var _ref = require("rc-util/lib/ref");
|
||||
var _warning = require("../_util/warning");
|
||||
var _wave = _interopRequireDefault(require("../_util/wave"));
|
||||
var _interface = require("../_util/wave/interface");
|
||||
var _useBubbleLock = _interopRequireDefault(require("../checkbox/useBubbleLock"));
|
||||
var _configProvider = require("../config-provider");
|
||||
var _DisabledContext = _interopRequireDefault(require("../config-provider/DisabledContext"));
|
||||
var _useCSSVarCls = _interopRequireDefault(require("../config-provider/hooks/useCSSVarCls"));
|
||||
var _context = require("../form/context");
|
||||
var _context2 = _interopRequireWildcard(require("./context"));
|
||||
var _style = _interopRequireDefault(require("./style"));
|
||||
var __rest = void 0 && (void 0).__rest || function (s, e) {
|
||||
var t = {};
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
||||
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
||||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
const InternalRadio = (props, ref) => {
|
||||
var _a, _b;
|
||||
const groupContext = React.useContext(_context2.default);
|
||||
const radioOptionTypeContext = React.useContext(_context2.RadioOptionTypeContext);
|
||||
const {
|
||||
getPrefixCls,
|
||||
direction,
|
||||
radio
|
||||
} = React.useContext(_configProvider.ConfigContext);
|
||||
const innerRef = React.useRef(null);
|
||||
const mergedRef = (0, _ref.composeRef)(ref, innerRef);
|
||||
const {
|
||||
isFormItemInput
|
||||
} = React.useContext(_context.FormItemInputContext);
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
const warning = (0, _warning.devUseWarning)('Radio');
|
||||
process.env.NODE_ENV !== "production" ? warning(!('optionType' in props), 'usage', '`optionType` is only support in Radio.Group.') : void 0;
|
||||
}
|
||||
const onChange = e => {
|
||||
var _a, _b;
|
||||
(_a = props.onChange) === null || _a === void 0 ? void 0 : _a.call(props, e);
|
||||
(_b = groupContext === null || groupContext === void 0 ? void 0 : groupContext.onChange) === null || _b === void 0 ? void 0 : _b.call(groupContext, e);
|
||||
};
|
||||
const {
|
||||
prefixCls: customizePrefixCls,
|
||||
className,
|
||||
rootClassName,
|
||||
children,
|
||||
style,
|
||||
title
|
||||
} = props,
|
||||
restProps = __rest(props, ["prefixCls", "className", "rootClassName", "children", "style", "title"]);
|
||||
const radioPrefixCls = getPrefixCls('radio', customizePrefixCls);
|
||||
const isButtonType = ((groupContext === null || groupContext === void 0 ? void 0 : groupContext.optionType) || radioOptionTypeContext) === 'button';
|
||||
const prefixCls = isButtonType ? `${radioPrefixCls}-button` : radioPrefixCls;
|
||||
// Style
|
||||
const rootCls = (0, _useCSSVarCls.default)(radioPrefixCls);
|
||||
const [wrapCSSVar, hashId, cssVarCls] = (0, _style.default)(radioPrefixCls, rootCls);
|
||||
const radioProps = Object.assign({}, restProps);
|
||||
// ===================== Disabled =====================
|
||||
const disabled = React.useContext(_DisabledContext.default);
|
||||
if (groupContext) {
|
||||
radioProps.name = groupContext.name;
|
||||
radioProps.onChange = onChange;
|
||||
radioProps.checked = props.value === groupContext.value;
|
||||
radioProps.disabled = (_a = radioProps.disabled) !== null && _a !== void 0 ? _a : groupContext.disabled;
|
||||
}
|
||||
radioProps.disabled = (_b = radioProps.disabled) !== null && _b !== void 0 ? _b : disabled;
|
||||
const wrapperClassString = (0, _classnames.default)(`${prefixCls}-wrapper`, {
|
||||
[`${prefixCls}-wrapper-checked`]: radioProps.checked,
|
||||
[`${prefixCls}-wrapper-disabled`]: radioProps.disabled,
|
||||
[`${prefixCls}-wrapper-rtl`]: direction === 'rtl',
|
||||
[`${prefixCls}-wrapper-in-form-item`]: isFormItemInput,
|
||||
[`${prefixCls}-wrapper-block`]: !!(groupContext === null || groupContext === void 0 ? void 0 : groupContext.block)
|
||||
}, radio === null || radio === void 0 ? void 0 : radio.className, className, rootClassName, hashId, cssVarCls, rootCls);
|
||||
// ============================ Event Lock ============================
|
||||
const [onLabelClick, onInputClick] = (0, _useBubbleLock.default)(radioProps.onClick);
|
||||
// ============================== Render ==============================
|
||||
return wrapCSSVar(/*#__PURE__*/React.createElement(_wave.default, {
|
||||
component: "Radio",
|
||||
disabled: radioProps.disabled
|
||||
}, /*#__PURE__*/React.createElement("label", {
|
||||
className: wrapperClassString,
|
||||
style: Object.assign(Object.assign({}, radio === null || radio === void 0 ? void 0 : radio.style), style),
|
||||
onMouseEnter: props.onMouseEnter,
|
||||
onMouseLeave: props.onMouseLeave,
|
||||
title: title,
|
||||
onClick: onLabelClick
|
||||
}, /*#__PURE__*/React.createElement(_rcCheckbox.default, Object.assign({}, radioProps, {
|
||||
className: (0, _classnames.default)(radioProps.className, {
|
||||
[_interface.TARGET_CLS]: !isButtonType
|
||||
}),
|
||||
type: "radio",
|
||||
prefixCls: prefixCls,
|
||||
ref: mergedRef,
|
||||
onClick: onInputClick
|
||||
})), children !== undefined ? /*#__PURE__*/React.createElement("span", {
|
||||
className: `${prefixCls}-label`
|
||||
}, children) : null)));
|
||||
};
|
||||
const Radio = /*#__PURE__*/React.forwardRef(InternalRadio);
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
Radio.displayName = 'Radio';
|
||||
}
|
||||
var _default = exports.default = Radio;
|
||||
6
frontend/node_modules/antd/lib/radio/radioButton.d.ts
generated
vendored
Normal file
6
frontend/node_modules/antd/lib/radio/radioButton.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import * as React from 'react';
|
||||
import type { AbstractCheckboxProps } from '../checkbox/Checkbox';
|
||||
import type { RadioChangeEvent, RadioRef } from './interface';
|
||||
export type RadioButtonProps = AbstractCheckboxProps<RadioChangeEvent>;
|
||||
declare const _default: React.ForwardRefExoticComponent<RadioButtonProps & React.RefAttributes<RadioRef>>;
|
||||
export default _default;
|
||||
40
frontend/node_modules/antd/lib/radio/radioButton.js
generated
vendored
Normal file
40
frontend/node_modules/antd/lib/radio/radioButton.js
generated
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
"use strict";
|
||||
"use client";
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
||||
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
var React = _interopRequireWildcard(require("react"));
|
||||
var _configProvider = require("../config-provider");
|
||||
var _context = require("./context");
|
||||
var _radio = _interopRequireDefault(require("./radio"));
|
||||
var __rest = void 0 && (void 0).__rest || function (s, e) {
|
||||
var t = {};
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
||||
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
||||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
const RadioButton = (props, ref) => {
|
||||
const {
|
||||
getPrefixCls
|
||||
} = React.useContext(_configProvider.ConfigContext);
|
||||
const {
|
||||
prefixCls: customizePrefixCls
|
||||
} = props,
|
||||
radioProps = __rest(props, ["prefixCls"]);
|
||||
const prefixCls = getPrefixCls('radio', customizePrefixCls);
|
||||
return /*#__PURE__*/React.createElement(_context.RadioOptionTypeContextProvider, {
|
||||
value: "button"
|
||||
}, /*#__PURE__*/React.createElement(_radio.default, Object.assign({
|
||||
prefixCls: prefixCls
|
||||
}, radioProps, {
|
||||
type: "radio",
|
||||
ref: ref
|
||||
})));
|
||||
};
|
||||
var _default = exports.default = /*#__PURE__*/React.forwardRef(RadioButton);
|
||||
76
frontend/node_modules/antd/lib/radio/style/index.d.ts
generated
vendored
Normal file
76
frontend/node_modules/antd/lib/radio/style/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,76 @@
|
||||
import type { GetDefaultToken } from '../../theme/internal';
|
||||
export interface ComponentToken {
|
||||
/**
|
||||
* @desc 单选框大小
|
||||
* @descEN Radio size
|
||||
*/
|
||||
radioSize: number;
|
||||
/**
|
||||
* @desc 单选框圆点大小
|
||||
* @descEN Size of Radio dot
|
||||
*/
|
||||
dotSize: number;
|
||||
/**
|
||||
* @desc 单选框圆点禁用颜色
|
||||
* @descEN Color of disabled Radio dot
|
||||
*/
|
||||
dotColorDisabled: string;
|
||||
/**
|
||||
* @desc 单选框按钮背景色
|
||||
* @descEN Background color of Radio button
|
||||
*/
|
||||
buttonBg: string;
|
||||
/**
|
||||
* @desc 单选框按钮选中背景色
|
||||
* @descEN Background color of checked Radio button
|
||||
*/
|
||||
buttonCheckedBg: string;
|
||||
/**
|
||||
* @desc 单选框按钮文本颜色
|
||||
* @descEN Color of Radio button text
|
||||
*/
|
||||
buttonColor: string;
|
||||
/**
|
||||
* @desc 单选框按钮横向内间距
|
||||
* @descEN Horizontal padding of Radio button
|
||||
*/
|
||||
buttonPaddingInline: number;
|
||||
/**
|
||||
* @desc 单选框按钮选中并禁用时的背景色
|
||||
* @descEN Background color of checked and disabled Radio button
|
||||
*/
|
||||
buttonCheckedBgDisabled: string;
|
||||
/**
|
||||
* @desc 单选框按钮选中并禁用时的文本颜色
|
||||
* @descEN Color of checked and disabled Radio button text
|
||||
*/
|
||||
buttonCheckedColorDisabled: string;
|
||||
/**
|
||||
* @desc 单选框实色按钮选中时的文本颜色
|
||||
* @descEN Color of checked solid Radio button text
|
||||
*/
|
||||
buttonSolidCheckedColor: string;
|
||||
/**
|
||||
* @desc 单选框实色按钮选中时的背景色
|
||||
* @descEN Background color of checked solid Radio button text
|
||||
*/
|
||||
buttonSolidCheckedBg: string;
|
||||
/**
|
||||
* @desc 单选框实色按钮选中时的悬浮态背景色
|
||||
* @descEN Background color of checked solid Radio button text when hover
|
||||
*/
|
||||
buttonSolidCheckedHoverBg: string;
|
||||
/**
|
||||
* @desc 单选框实色按钮选中时的激活态背景色
|
||||
* @descEN Background color of checked solid Radio button text when active
|
||||
*/
|
||||
buttonSolidCheckedActiveBg: string;
|
||||
/**
|
||||
* @desc 单选框右间距
|
||||
* @descEN Margin right of Radio button
|
||||
*/
|
||||
wrapperMarginInlineEnd: number;
|
||||
}
|
||||
export declare const prepareComponentToken: GetDefaultToken<'Radio'>;
|
||||
declare const _default: (prefixCls: string, rootCls?: string) => readonly [(node: React.ReactElement) => React.ReactElement, string, string];
|
||||
export default _default;
|
||||
455
frontend/node_modules/antd/lib/radio/style/index.js
generated
vendored
Normal file
455
frontend/node_modules/antd/lib/radio/style/index.js
generated
vendored
Normal file
@@ -0,0 +1,455 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.prepareComponentToken = exports.default = void 0;
|
||||
var _cssinjs = require("@ant-design/cssinjs");
|
||||
var _style = require("../../style");
|
||||
var _internal = require("../../theme/internal");
|
||||
// ============================== Styles ==============================
|
||||
// styles from RadioGroup only
|
||||
const getGroupRadioStyle = token => {
|
||||
const {
|
||||
componentCls,
|
||||
antCls
|
||||
} = token;
|
||||
const groupPrefixCls = `${componentCls}-group`;
|
||||
return {
|
||||
[groupPrefixCls]: Object.assign(Object.assign({}, (0, _style.resetComponent)(token)), {
|
||||
display: 'inline-block',
|
||||
fontSize: 0,
|
||||
// RTL
|
||||
[`&${groupPrefixCls}-rtl`]: {
|
||||
direction: 'rtl'
|
||||
},
|
||||
[`&${groupPrefixCls}-block`]: {
|
||||
display: 'flex'
|
||||
},
|
||||
[`${antCls}-badge ${antCls}-badge-count`]: {
|
||||
zIndex: 1
|
||||
},
|
||||
[`> ${antCls}-badge:not(:first-child) > ${antCls}-button-wrapper`]: {
|
||||
borderInlineStart: 'none'
|
||||
}
|
||||
})
|
||||
};
|
||||
};
|
||||
// Styles from radio-wrapper
|
||||
const getRadioBasicStyle = token => {
|
||||
const {
|
||||
componentCls,
|
||||
wrapperMarginInlineEnd,
|
||||
colorPrimary,
|
||||
radioSize,
|
||||
motionDurationSlow,
|
||||
motionDurationMid,
|
||||
motionEaseInOutCirc,
|
||||
colorBgContainer,
|
||||
colorBorder,
|
||||
lineWidth,
|
||||
colorBgContainerDisabled,
|
||||
colorTextDisabled,
|
||||
paddingXS,
|
||||
dotColorDisabled,
|
||||
lineType,
|
||||
radioColor,
|
||||
radioBgColor,
|
||||
calc
|
||||
} = token;
|
||||
const radioInnerPrefixCls = `${componentCls}-inner`;
|
||||
const dotPadding = 4;
|
||||
const radioDotDisabledSize = calc(radioSize).sub(calc(dotPadding).mul(2));
|
||||
const radioSizeCalc = calc(1).mul(radioSize).equal({
|
||||
unit: true
|
||||
});
|
||||
return {
|
||||
[`${componentCls}-wrapper`]: Object.assign(Object.assign({}, (0, _style.resetComponent)(token)), {
|
||||
display: 'inline-flex',
|
||||
alignItems: 'baseline',
|
||||
marginInlineStart: 0,
|
||||
marginInlineEnd: wrapperMarginInlineEnd,
|
||||
cursor: 'pointer',
|
||||
'&:last-child': {
|
||||
marginInlineEnd: 0
|
||||
},
|
||||
// RTL
|
||||
[`&${componentCls}-wrapper-rtl`]: {
|
||||
direction: 'rtl'
|
||||
},
|
||||
'&-disabled': {
|
||||
cursor: 'not-allowed',
|
||||
color: token.colorTextDisabled
|
||||
},
|
||||
'&::after': {
|
||||
display: 'inline-block',
|
||||
width: 0,
|
||||
overflow: 'hidden',
|
||||
content: '"\\a0"'
|
||||
},
|
||||
'&-block': {
|
||||
flex: 1,
|
||||
justifyContent: 'center'
|
||||
},
|
||||
// hashId 在 wrapper 上,只能铺平
|
||||
[`${componentCls}-checked::after`]: {
|
||||
position: 'absolute',
|
||||
insetBlockStart: 0,
|
||||
insetInlineStart: 0,
|
||||
width: '100%',
|
||||
height: '100%',
|
||||
border: `${(0, _cssinjs.unit)(lineWidth)} ${lineType} ${colorPrimary}`,
|
||||
borderRadius: '50%',
|
||||
visibility: 'hidden',
|
||||
opacity: 0,
|
||||
content: '""'
|
||||
},
|
||||
[componentCls]: Object.assign(Object.assign({}, (0, _style.resetComponent)(token)), {
|
||||
position: 'relative',
|
||||
display: 'inline-block',
|
||||
outline: 'none',
|
||||
cursor: 'pointer',
|
||||
alignSelf: 'center',
|
||||
borderRadius: '50%'
|
||||
}),
|
||||
[`${componentCls}-wrapper:hover &,
|
||||
&:hover ${radioInnerPrefixCls}`]: {
|
||||
borderColor: colorPrimary
|
||||
},
|
||||
[`${componentCls}-input:focus-visible + ${radioInnerPrefixCls}`]: (0, _style.genFocusOutline)(token),
|
||||
[`${componentCls}:hover::after, ${componentCls}-wrapper:hover &::after`]: {
|
||||
visibility: 'visible'
|
||||
},
|
||||
[`${componentCls}-inner`]: {
|
||||
'&::after': {
|
||||
boxSizing: 'border-box',
|
||||
position: 'absolute',
|
||||
insetBlockStart: '50%',
|
||||
insetInlineStart: '50%',
|
||||
display: 'block',
|
||||
width: radioSizeCalc,
|
||||
height: radioSizeCalc,
|
||||
marginBlockStart: calc(1).mul(radioSize).div(-2).equal({
|
||||
unit: true
|
||||
}),
|
||||
marginInlineStart: calc(1).mul(radioSize).div(-2).equal({
|
||||
unit: true
|
||||
}),
|
||||
backgroundColor: radioColor,
|
||||
borderBlockStart: 0,
|
||||
borderInlineStart: 0,
|
||||
borderRadius: radioSizeCalc,
|
||||
transform: 'scale(0)',
|
||||
opacity: 0,
|
||||
transition: `all ${motionDurationSlow} ${motionEaseInOutCirc}`,
|
||||
content: '""'
|
||||
},
|
||||
boxSizing: 'border-box',
|
||||
position: 'relative',
|
||||
insetBlockStart: 0,
|
||||
insetInlineStart: 0,
|
||||
display: 'block',
|
||||
width: radioSizeCalc,
|
||||
height: radioSizeCalc,
|
||||
backgroundColor: colorBgContainer,
|
||||
borderColor: colorBorder,
|
||||
borderStyle: 'solid',
|
||||
borderWidth: lineWidth,
|
||||
borderRadius: '50%',
|
||||
transition: `all ${motionDurationMid}`
|
||||
},
|
||||
[`${componentCls}-input`]: {
|
||||
position: 'absolute',
|
||||
inset: 0,
|
||||
zIndex: 1,
|
||||
cursor: 'pointer',
|
||||
opacity: 0
|
||||
},
|
||||
// 选中状态
|
||||
[`${componentCls}-checked`]: {
|
||||
[radioInnerPrefixCls]: {
|
||||
borderColor: colorPrimary,
|
||||
backgroundColor: radioBgColor,
|
||||
'&::after': {
|
||||
transform: `scale(${token.calc(token.dotSize).div(radioSize).equal()})`,
|
||||
opacity: 1,
|
||||
transition: `all ${motionDurationSlow} ${motionEaseInOutCirc}`
|
||||
}
|
||||
}
|
||||
},
|
||||
[`${componentCls}-disabled`]: {
|
||||
cursor: 'not-allowed',
|
||||
[radioInnerPrefixCls]: {
|
||||
backgroundColor: colorBgContainerDisabled,
|
||||
borderColor: colorBorder,
|
||||
cursor: 'not-allowed',
|
||||
'&::after': {
|
||||
backgroundColor: dotColorDisabled
|
||||
}
|
||||
},
|
||||
[`${componentCls}-input`]: {
|
||||
cursor: 'not-allowed'
|
||||
},
|
||||
[`${componentCls}-disabled + span`]: {
|
||||
color: colorTextDisabled,
|
||||
cursor: 'not-allowed'
|
||||
},
|
||||
[`&${componentCls}-checked`]: {
|
||||
[radioInnerPrefixCls]: {
|
||||
'&::after': {
|
||||
transform: `scale(${calc(radioDotDisabledSize).div(radioSize).equal()})`
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
[`span${componentCls} + *`]: {
|
||||
paddingInlineStart: paddingXS,
|
||||
paddingInlineEnd: paddingXS
|
||||
}
|
||||
})
|
||||
};
|
||||
};
|
||||
// Styles from radio-button
|
||||
const getRadioButtonStyle = token => {
|
||||
const {
|
||||
buttonColor,
|
||||
controlHeight,
|
||||
componentCls,
|
||||
lineWidth,
|
||||
lineType,
|
||||
colorBorder,
|
||||
motionDurationMid,
|
||||
buttonPaddingInline,
|
||||
fontSize,
|
||||
buttonBg,
|
||||
fontSizeLG,
|
||||
controlHeightLG,
|
||||
controlHeightSM,
|
||||
paddingXS,
|
||||
borderRadius,
|
||||
borderRadiusSM,
|
||||
borderRadiusLG,
|
||||
buttonCheckedBg,
|
||||
buttonSolidCheckedColor,
|
||||
colorTextDisabled,
|
||||
colorBgContainerDisabled,
|
||||
buttonCheckedBgDisabled,
|
||||
buttonCheckedColorDisabled,
|
||||
colorPrimary,
|
||||
colorPrimaryHover,
|
||||
colorPrimaryActive,
|
||||
buttonSolidCheckedBg,
|
||||
buttonSolidCheckedHoverBg,
|
||||
buttonSolidCheckedActiveBg,
|
||||
calc
|
||||
} = token;
|
||||
return {
|
||||
[`${componentCls}-button-wrapper`]: {
|
||||
position: 'relative',
|
||||
display: 'inline-block',
|
||||
height: controlHeight,
|
||||
margin: 0,
|
||||
paddingInline: buttonPaddingInline,
|
||||
paddingBlock: 0,
|
||||
color: buttonColor,
|
||||
fontSize,
|
||||
lineHeight: (0, _cssinjs.unit)(calc(controlHeight).sub(calc(lineWidth).mul(2)).equal()),
|
||||
background: buttonBg,
|
||||
border: `${(0, _cssinjs.unit)(lineWidth)} ${lineType} ${colorBorder}`,
|
||||
// strange align fix for chrome but works
|
||||
// https://gw.alipayobjects.com/zos/rmsportal/VFTfKXJuogBAXcvfAUWJ.gif
|
||||
borderBlockStartWidth: calc(lineWidth).add(0.02).equal(),
|
||||
borderInlineEndWidth: lineWidth,
|
||||
cursor: 'pointer',
|
||||
transition: [`color ${motionDurationMid}`, `background ${motionDurationMid}`, `box-shadow ${motionDurationMid}`].join(','),
|
||||
a: {
|
||||
color: buttonColor
|
||||
},
|
||||
[`> ${componentCls}-button`]: {
|
||||
position: 'absolute',
|
||||
insetBlockStart: 0,
|
||||
insetInlineStart: 0,
|
||||
zIndex: -1,
|
||||
width: '100%',
|
||||
height: '100%'
|
||||
},
|
||||
'&:not(:last-child)': {
|
||||
marginInlineEnd: calc(lineWidth).mul(-1).equal()
|
||||
},
|
||||
'&:first-child': {
|
||||
borderInlineStart: `${(0, _cssinjs.unit)(lineWidth)} ${lineType} ${colorBorder}`,
|
||||
borderStartStartRadius: borderRadius,
|
||||
borderEndStartRadius: borderRadius
|
||||
},
|
||||
'&:last-child': {
|
||||
borderStartEndRadius: borderRadius,
|
||||
borderEndEndRadius: borderRadius
|
||||
},
|
||||
'&:first-child:last-child': {
|
||||
borderRadius
|
||||
},
|
||||
[`${componentCls}-group-large &`]: {
|
||||
height: controlHeightLG,
|
||||
fontSize: fontSizeLG,
|
||||
lineHeight: (0, _cssinjs.unit)(calc(controlHeightLG).sub(calc(lineWidth).mul(2)).equal()),
|
||||
'&:first-child': {
|
||||
borderStartStartRadius: borderRadiusLG,
|
||||
borderEndStartRadius: borderRadiusLG
|
||||
},
|
||||
'&:last-child': {
|
||||
borderStartEndRadius: borderRadiusLG,
|
||||
borderEndEndRadius: borderRadiusLG
|
||||
}
|
||||
},
|
||||
[`${componentCls}-group-small &`]: {
|
||||
height: controlHeightSM,
|
||||
paddingInline: calc(paddingXS).sub(lineWidth).equal(),
|
||||
paddingBlock: 0,
|
||||
lineHeight: (0, _cssinjs.unit)(calc(controlHeightSM).sub(calc(lineWidth).mul(2)).equal()),
|
||||
'&:first-child': {
|
||||
borderStartStartRadius: borderRadiusSM,
|
||||
borderEndStartRadius: borderRadiusSM
|
||||
},
|
||||
'&:last-child': {
|
||||
borderStartEndRadius: borderRadiusSM,
|
||||
borderEndEndRadius: borderRadiusSM
|
||||
}
|
||||
},
|
||||
'&:hover': {
|
||||
position: 'relative',
|
||||
color: colorPrimary
|
||||
},
|
||||
'&:has(:focus-visible)': (0, _style.genFocusOutline)(token),
|
||||
[`${componentCls}-inner, input[type='checkbox'], input[type='radio']`]: {
|
||||
width: 0,
|
||||
height: 0,
|
||||
opacity: 0,
|
||||
pointerEvents: 'none'
|
||||
},
|
||||
[`&-checked:not(${componentCls}-button-wrapper-disabled)`]: {
|
||||
zIndex: 1,
|
||||
color: colorPrimary,
|
||||
background: buttonCheckedBg,
|
||||
borderColor: colorPrimary,
|
||||
'&::before': {
|
||||
backgroundColor: colorPrimary
|
||||
},
|
||||
'&:first-child': {
|
||||
borderColor: colorPrimary
|
||||
},
|
||||
'&:hover': {
|
||||
color: colorPrimaryHover,
|
||||
borderColor: colorPrimaryHover,
|
||||
'&::before': {
|
||||
backgroundColor: colorPrimaryHover
|
||||
}
|
||||
},
|
||||
'&:active': {
|
||||
color: colorPrimaryActive,
|
||||
borderColor: colorPrimaryActive,
|
||||
'&::before': {
|
||||
backgroundColor: colorPrimaryActive
|
||||
}
|
||||
}
|
||||
},
|
||||
[`${componentCls}-group-solid &-checked:not(${componentCls}-button-wrapper-disabled)`]: {
|
||||
color: buttonSolidCheckedColor,
|
||||
background: buttonSolidCheckedBg,
|
||||
borderColor: buttonSolidCheckedBg,
|
||||
'&:hover': {
|
||||
color: buttonSolidCheckedColor,
|
||||
background: buttonSolidCheckedHoverBg,
|
||||
borderColor: buttonSolidCheckedHoverBg
|
||||
},
|
||||
'&:active': {
|
||||
color: buttonSolidCheckedColor,
|
||||
background: buttonSolidCheckedActiveBg,
|
||||
borderColor: buttonSolidCheckedActiveBg
|
||||
}
|
||||
},
|
||||
'&-disabled': {
|
||||
color: colorTextDisabled,
|
||||
backgroundColor: colorBgContainerDisabled,
|
||||
borderColor: colorBorder,
|
||||
cursor: 'not-allowed',
|
||||
'&:first-child, &:hover': {
|
||||
color: colorTextDisabled,
|
||||
backgroundColor: colorBgContainerDisabled,
|
||||
borderColor: colorBorder
|
||||
}
|
||||
},
|
||||
[`&-disabled${componentCls}-button-wrapper-checked`]: {
|
||||
color: buttonCheckedColorDisabled,
|
||||
backgroundColor: buttonCheckedBgDisabled,
|
||||
borderColor: colorBorder,
|
||||
boxShadow: 'none'
|
||||
},
|
||||
'&-block': {
|
||||
flex: 1,
|
||||
textAlign: 'center'
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
// ============================== Export ==============================
|
||||
const prepareComponentToken = token => {
|
||||
const {
|
||||
wireframe,
|
||||
padding,
|
||||
marginXS,
|
||||
lineWidth,
|
||||
fontSizeLG,
|
||||
colorText,
|
||||
colorBgContainer,
|
||||
colorTextDisabled,
|
||||
controlItemBgActiveDisabled,
|
||||
colorTextLightSolid,
|
||||
colorPrimary,
|
||||
colorPrimaryHover,
|
||||
colorPrimaryActive,
|
||||
colorWhite
|
||||
} = token;
|
||||
const dotPadding = 4; // Fixed value
|
||||
const radioSize = fontSizeLG;
|
||||
const radioDotSize = wireframe ? radioSize - dotPadding * 2 : radioSize - (dotPadding + lineWidth) * 2;
|
||||
return {
|
||||
// Radio
|
||||
radioSize,
|
||||
dotSize: radioDotSize,
|
||||
dotColorDisabled: colorTextDisabled,
|
||||
// Radio buttons
|
||||
buttonSolidCheckedColor: colorTextLightSolid,
|
||||
buttonSolidCheckedBg: colorPrimary,
|
||||
buttonSolidCheckedHoverBg: colorPrimaryHover,
|
||||
buttonSolidCheckedActiveBg: colorPrimaryActive,
|
||||
buttonBg: colorBgContainer,
|
||||
buttonCheckedBg: colorBgContainer,
|
||||
buttonColor: colorText,
|
||||
buttonCheckedBgDisabled: controlItemBgActiveDisabled,
|
||||
buttonCheckedColorDisabled: colorTextDisabled,
|
||||
buttonPaddingInline: padding - lineWidth,
|
||||
wrapperMarginInlineEnd: marginXS,
|
||||
// internal
|
||||
radioColor: wireframe ? colorPrimary : colorWhite,
|
||||
radioBgColor: wireframe ? colorBgContainer : colorPrimary
|
||||
};
|
||||
};
|
||||
exports.prepareComponentToken = prepareComponentToken;
|
||||
var _default = exports.default = (0, _internal.genStyleHooks)('Radio', token => {
|
||||
const {
|
||||
controlOutline,
|
||||
controlOutlineWidth
|
||||
} = token;
|
||||
const radioFocusShadow = `0 0 0 ${(0, _cssinjs.unit)(controlOutlineWidth)} ${controlOutline}`;
|
||||
const radioButtonFocusShadow = radioFocusShadow;
|
||||
const radioToken = (0, _internal.mergeToken)(token, {
|
||||
radioFocusShadow,
|
||||
radioButtonFocusShadow
|
||||
});
|
||||
return [getGroupRadioStyle(radioToken), getRadioBasicStyle(radioToken), getRadioButtonStyle(radioToken)];
|
||||
}, prepareComponentToken, {
|
||||
unitless: {
|
||||
radioSize: true,
|
||||
dotSize: true
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user