first commit
This commit is contained in:
11
frontend/node_modules/antd/lib/button/DefaultLoadingIcon.d.ts
generated
vendored
Normal file
11
frontend/node_modules/antd/lib/button/DefaultLoadingIcon.d.ts
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
import React from 'react';
|
||||
export type DefaultLoadingIconProps = {
|
||||
prefixCls: string;
|
||||
existIcon: boolean;
|
||||
loading?: boolean | object;
|
||||
className?: string;
|
||||
style?: React.CSSProperties;
|
||||
mount: boolean;
|
||||
};
|
||||
declare const DefaultLoadingIcon: React.FC<DefaultLoadingIconProps>;
|
||||
export default DefaultLoadingIcon;
|
||||
86
frontend/node_modules/antd/lib/button/DefaultLoadingIcon.js
generated
vendored
Normal file
86
frontend/node_modules/antd/lib/button/DefaultLoadingIcon.js
generated
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
"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 _LoadingOutlined = _interopRequireDefault(require("@ant-design/icons/LoadingOutlined"));
|
||||
var _classnames = _interopRequireDefault(require("classnames"));
|
||||
var _rcMotion = _interopRequireDefault(require("rc-motion"));
|
||||
var _IconWrapper = _interopRequireDefault(require("./IconWrapper"));
|
||||
const InnerLoadingIcon = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
|
||||
const {
|
||||
prefixCls,
|
||||
className,
|
||||
style,
|
||||
iconClassName
|
||||
} = props;
|
||||
const mergedIconCls = (0, _classnames.default)(`${prefixCls}-loading-icon`, className);
|
||||
return /*#__PURE__*/_react.default.createElement(_IconWrapper.default, {
|
||||
prefixCls: prefixCls,
|
||||
className: mergedIconCls,
|
||||
style: style,
|
||||
ref: ref
|
||||
}, /*#__PURE__*/_react.default.createElement(_LoadingOutlined.default, {
|
||||
className: iconClassName
|
||||
}));
|
||||
});
|
||||
const getCollapsedWidth = () => ({
|
||||
width: 0,
|
||||
opacity: 0,
|
||||
transform: 'scale(0)'
|
||||
});
|
||||
const getRealWidth = node => ({
|
||||
width: node.scrollWidth,
|
||||
opacity: 1,
|
||||
transform: 'scale(1)'
|
||||
});
|
||||
const DefaultLoadingIcon = props => {
|
||||
const {
|
||||
prefixCls,
|
||||
loading,
|
||||
existIcon,
|
||||
className,
|
||||
style,
|
||||
mount
|
||||
} = props;
|
||||
const visible = !!loading;
|
||||
if (existIcon) {
|
||||
return /*#__PURE__*/_react.default.createElement(InnerLoadingIcon, {
|
||||
prefixCls: prefixCls,
|
||||
className: className,
|
||||
style: style
|
||||
});
|
||||
}
|
||||
return /*#__PURE__*/_react.default.createElement(_rcMotion.default, {
|
||||
visible: visible,
|
||||
// Used for minus flex gap style only
|
||||
motionName: `${prefixCls}-loading-icon-motion`,
|
||||
motionAppear: !mount,
|
||||
motionEnter: !mount,
|
||||
motionLeave: !mount,
|
||||
removeOnLeave: true,
|
||||
onAppearStart: getCollapsedWidth,
|
||||
onAppearActive: getRealWidth,
|
||||
onEnterStart: getCollapsedWidth,
|
||||
onEnterActive: getRealWidth,
|
||||
onLeaveStart: getRealWidth,
|
||||
onLeaveActive: getCollapsedWidth
|
||||
}, ({
|
||||
className: motionCls,
|
||||
style: motionStyle
|
||||
}, ref) => {
|
||||
const mergedStyle = Object.assign(Object.assign({}, style), motionStyle);
|
||||
return /*#__PURE__*/_react.default.createElement(InnerLoadingIcon, {
|
||||
prefixCls: prefixCls,
|
||||
className: (0, _classnames.default)(className, motionCls),
|
||||
style: mergedStyle,
|
||||
ref: ref
|
||||
});
|
||||
});
|
||||
};
|
||||
var _default = exports.default = DefaultLoadingIcon;
|
||||
9
frontend/node_modules/antd/lib/button/IconWrapper.d.ts
generated
vendored
Normal file
9
frontend/node_modules/antd/lib/button/IconWrapper.d.ts
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
import React from 'react';
|
||||
export type IconWrapperProps = {
|
||||
prefixCls: string;
|
||||
className?: string;
|
||||
style?: React.CSSProperties;
|
||||
children?: React.ReactNode;
|
||||
};
|
||||
declare const IconWrapper: React.ForwardRefExoticComponent<IconWrapperProps & React.RefAttributes<HTMLSpanElement>>;
|
||||
export default IconWrapper;
|
||||
26
frontend/node_modules/antd/lib/button/IconWrapper.js
generated
vendored
Normal file
26
frontend/node_modules/antd/lib/button/IconWrapper.js
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
"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"));
|
||||
const IconWrapper = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
|
||||
const {
|
||||
className,
|
||||
style,
|
||||
children,
|
||||
prefixCls
|
||||
} = props;
|
||||
const iconWrapperCls = (0, _classnames.default)(`${prefixCls}-icon`, className);
|
||||
return /*#__PURE__*/_react.default.createElement("span", {
|
||||
ref: ref,
|
||||
className: iconWrapperCls,
|
||||
style: style
|
||||
}, children);
|
||||
});
|
||||
var _default = exports.default = IconWrapper;
|
||||
12
frontend/node_modules/antd/lib/button/button-group.d.ts
generated
vendored
Normal file
12
frontend/node_modules/antd/lib/button/button-group.d.ts
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
import * as React from 'react';
|
||||
import type { SizeType } from '../config-provider/SizeContext';
|
||||
export interface ButtonGroupProps {
|
||||
size?: SizeType;
|
||||
style?: React.CSSProperties;
|
||||
className?: string;
|
||||
prefixCls?: string;
|
||||
children?: React.ReactNode;
|
||||
}
|
||||
export declare const GroupSizeContext: React.Context<SizeType>;
|
||||
declare const ButtonGroup: React.FC<ButtonGroupProps>;
|
||||
export default ButtonGroup;
|
||||
62
frontend/node_modules/antd/lib/button/button-group.js
generated
vendored
Normal file
62
frontend/node_modules/antd/lib/button/button-group.js
generated
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
"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 = exports.GroupSizeContext = void 0;
|
||||
var React = _interopRequireWildcard(require("react"));
|
||||
var _classnames = _interopRequireDefault(require("classnames"));
|
||||
var _warning = require("../_util/warning");
|
||||
var _configProvider = require("../config-provider");
|
||||
var _internal = require("../theme/internal");
|
||||
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 GroupSizeContext = exports.GroupSizeContext = /*#__PURE__*/React.createContext(undefined);
|
||||
const ButtonGroup = props => {
|
||||
const {
|
||||
getPrefixCls,
|
||||
direction
|
||||
} = React.useContext(_configProvider.ConfigContext);
|
||||
const {
|
||||
prefixCls: customizePrefixCls,
|
||||
size,
|
||||
className
|
||||
} = props,
|
||||
others = __rest(props, ["prefixCls", "size", "className"]);
|
||||
const prefixCls = getPrefixCls('btn-group', customizePrefixCls);
|
||||
const [,, hashId] = (0, _internal.useToken)();
|
||||
const sizeCls = React.useMemo(() => {
|
||||
switch (size) {
|
||||
case 'large':
|
||||
return 'lg';
|
||||
case 'small':
|
||||
return 'sm';
|
||||
default:
|
||||
return '';
|
||||
}
|
||||
}, [size]);
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
const warning = (0, _warning.devUseWarning)('Button.Group');
|
||||
warning.deprecated(false, 'Button.Group', 'Space.Compact');
|
||||
process.env.NODE_ENV !== "production" ? warning(!size || ['large', 'small', 'middle'].includes(size), 'usage', 'Invalid prop `size`.') : void 0;
|
||||
}
|
||||
const classes = (0, _classnames.default)(prefixCls, {
|
||||
[`${prefixCls}-${sizeCls}`]: sizeCls,
|
||||
[`${prefixCls}-rtl`]: direction === 'rtl'
|
||||
}, className, hashId);
|
||||
return /*#__PURE__*/React.createElement(GroupSizeContext.Provider, {
|
||||
value: size
|
||||
}, /*#__PURE__*/React.createElement("div", Object.assign({}, others, {
|
||||
className: classes
|
||||
})));
|
||||
};
|
||||
var _default = exports.default = ButtonGroup;
|
||||
46
frontend/node_modules/antd/lib/button/button.d.ts
generated
vendored
Normal file
46
frontend/node_modules/antd/lib/button/button.d.ts
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
import React from 'react';
|
||||
import type { SizeType } from '../config-provider/SizeContext';
|
||||
import Group from './button-group';
|
||||
import type { ButtonColorType, ButtonHTMLType, ButtonShape, ButtonType, ButtonVariantType } from './buttonHelpers';
|
||||
export type LegacyButtonType = ButtonType | 'danger';
|
||||
export interface BaseButtonProps {
|
||||
type?: ButtonType;
|
||||
color?: ButtonColorType;
|
||||
variant?: ButtonVariantType;
|
||||
icon?: React.ReactNode;
|
||||
iconPosition?: 'start' | 'end';
|
||||
shape?: ButtonShape;
|
||||
size?: SizeType;
|
||||
disabled?: boolean;
|
||||
loading?: boolean | {
|
||||
delay?: number;
|
||||
icon?: React.ReactNode;
|
||||
};
|
||||
prefixCls?: string;
|
||||
className?: string;
|
||||
rootClassName?: string;
|
||||
ghost?: boolean;
|
||||
danger?: boolean;
|
||||
block?: boolean;
|
||||
children?: React.ReactNode;
|
||||
[key: `data-${string}`]: string;
|
||||
classNames?: {
|
||||
icon: string;
|
||||
};
|
||||
styles?: {
|
||||
icon: React.CSSProperties;
|
||||
};
|
||||
}
|
||||
type MergedHTMLAttributes = Omit<React.HTMLAttributes<HTMLElement> & React.ButtonHTMLAttributes<HTMLElement> & React.AnchorHTMLAttributes<HTMLElement>, 'type' | 'color'>;
|
||||
export interface ButtonProps extends BaseButtonProps, MergedHTMLAttributes {
|
||||
href?: string;
|
||||
htmlType?: ButtonHTMLType;
|
||||
autoInsertSpace?: boolean;
|
||||
}
|
||||
declare const InternalCompoundedButton: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLAnchorElement | HTMLButtonElement>>;
|
||||
type CompoundedComponent = typeof InternalCompoundedButton & {
|
||||
/** @deprecated Please use `Space.Compact` */
|
||||
Group: typeof Group;
|
||||
};
|
||||
declare const Button: CompoundedComponent;
|
||||
export default Button;
|
||||
304
frontend/node_modules/antd/lib/button/button.js
generated
vendored
Normal file
304
frontend/node_modules/antd/lib/button/button.js
generated
vendored
Normal file
@@ -0,0 +1,304 @@
|
||||
"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 _useLayoutEffect = _interopRequireDefault(require("rc-util/lib/hooks/useLayoutEffect"));
|
||||
var _omit = _interopRequireDefault(require("rc-util/lib/omit"));
|
||||
var _ref = require("rc-util/lib/ref");
|
||||
var _warning = require("../_util/warning");
|
||||
var _wave = _interopRequireDefault(require("../_util/wave"));
|
||||
var _context = require("../config-provider/context");
|
||||
var _DisabledContext = _interopRequireDefault(require("../config-provider/DisabledContext"));
|
||||
var _useSize = _interopRequireDefault(require("../config-provider/hooks/useSize"));
|
||||
var _Compact = require("../space/Compact");
|
||||
var _buttonGroup = _interopRequireWildcard(require("./button-group"));
|
||||
var _buttonHelpers = require("./buttonHelpers");
|
||||
var _DefaultLoadingIcon = _interopRequireDefault(require("./DefaultLoadingIcon"));
|
||||
var _IconWrapper = _interopRequireDefault(require("./IconWrapper"));
|
||||
var _style = _interopRequireDefault(require("./style"));
|
||||
var _compact = _interopRequireDefault(require("./style/compact"));
|
||||
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;
|
||||
};
|
||||
function getLoadingConfig(loading) {
|
||||
if (typeof loading === 'object' && loading) {
|
||||
let delay = loading === null || loading === void 0 ? void 0 : loading.delay;
|
||||
delay = !Number.isNaN(delay) && typeof delay === 'number' ? delay : 0;
|
||||
return {
|
||||
loading: delay <= 0,
|
||||
delay
|
||||
};
|
||||
}
|
||||
return {
|
||||
loading: !!loading,
|
||||
delay: 0
|
||||
};
|
||||
}
|
||||
const ButtonTypeMap = {
|
||||
default: ['default', 'outlined'],
|
||||
primary: ['primary', 'solid'],
|
||||
dashed: ['default', 'dashed'],
|
||||
// `link` is not a real color but we should compatible with it
|
||||
link: ['link', 'link'],
|
||||
text: ['default', 'text']
|
||||
};
|
||||
const InternalCompoundedButton = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
||||
var _a, _b;
|
||||
const {
|
||||
loading = false,
|
||||
prefixCls: customizePrefixCls,
|
||||
color,
|
||||
variant,
|
||||
type,
|
||||
danger = false,
|
||||
shape: customizeShape,
|
||||
size: customizeSize,
|
||||
styles,
|
||||
disabled: customDisabled,
|
||||
className,
|
||||
rootClassName,
|
||||
children,
|
||||
icon,
|
||||
iconPosition = 'start',
|
||||
ghost = false,
|
||||
block = false,
|
||||
// React does not recognize the `htmlType` prop on a DOM element. Here we pick it out of `rest`.
|
||||
htmlType = 'button',
|
||||
classNames: customClassNames,
|
||||
style: customStyle = {},
|
||||
autoInsertSpace,
|
||||
autoFocus
|
||||
} = props,
|
||||
rest = __rest(props, ["loading", "prefixCls", "color", "variant", "type", "danger", "shape", "size", "styles", "disabled", "className", "rootClassName", "children", "icon", "iconPosition", "ghost", "block", "htmlType", "classNames", "style", "autoInsertSpace", "autoFocus"]);
|
||||
// https://github.com/ant-design/ant-design/issues/47605
|
||||
// Compatible with original `type` behavior
|
||||
const mergedType = type || 'default';
|
||||
const {
|
||||
button
|
||||
} = _react.default.useContext(_context.ConfigContext);
|
||||
const shape = customizeShape || (button === null || button === void 0 ? void 0 : button.shape) || 'default';
|
||||
const [mergedColor, mergedVariant] = (0, _react.useMemo)(() => {
|
||||
// >>>>> Local
|
||||
// Color & Variant
|
||||
if (color && variant) {
|
||||
return [color, variant];
|
||||
}
|
||||
// Sugar syntax
|
||||
if (type || danger) {
|
||||
const colorVariantPair = ButtonTypeMap[mergedType] || [];
|
||||
if (danger) {
|
||||
return ['danger', colorVariantPair[1]];
|
||||
}
|
||||
return colorVariantPair;
|
||||
}
|
||||
// >>> Context fallback
|
||||
if ((button === null || button === void 0 ? void 0 : button.color) && (button === null || button === void 0 ? void 0 : button.variant)) {
|
||||
return [button.color, button.variant];
|
||||
}
|
||||
return ['default', 'outlined'];
|
||||
}, [color, variant, type, danger, button === null || button === void 0 ? void 0 : button.color, button === null || button === void 0 ? void 0 : button.variant, mergedType]);
|
||||
const isDanger = mergedColor === 'danger';
|
||||
const mergedColorText = isDanger ? 'dangerous' : mergedColor;
|
||||
const {
|
||||
getPrefixCls,
|
||||
direction,
|
||||
autoInsertSpace: contextAutoInsertSpace,
|
||||
className: contextClassName,
|
||||
style: contextStyle,
|
||||
classNames: contextClassNames,
|
||||
styles: contextStyles
|
||||
} = (0, _context.useComponentConfig)('button');
|
||||
const mergedInsertSpace = (_a = autoInsertSpace !== null && autoInsertSpace !== void 0 ? autoInsertSpace : contextAutoInsertSpace) !== null && _a !== void 0 ? _a : true;
|
||||
const prefixCls = getPrefixCls('btn', customizePrefixCls);
|
||||
const [wrapCSSVar, hashId, cssVarCls] = (0, _style.default)(prefixCls);
|
||||
const disabled = (0, _react.useContext)(_DisabledContext.default);
|
||||
const mergedDisabled = customDisabled !== null && customDisabled !== void 0 ? customDisabled : disabled;
|
||||
const groupSize = (0, _react.useContext)(_buttonGroup.GroupSizeContext);
|
||||
const loadingOrDelay = (0, _react.useMemo)(() => getLoadingConfig(loading), [loading]);
|
||||
const [innerLoading, setLoading] = (0, _react.useState)(loadingOrDelay.loading);
|
||||
const [hasTwoCNChar, setHasTwoCNChar] = (0, _react.useState)(false);
|
||||
const buttonRef = (0, _react.useRef)(null);
|
||||
const mergedRef = (0, _ref.useComposeRef)(ref, buttonRef);
|
||||
const needInserted = _react.Children.count(children) === 1 && !icon && !(0, _buttonHelpers.isUnBorderedButtonVariant)(mergedVariant);
|
||||
// ========================= Mount ==========================
|
||||
// Record for mount status.
|
||||
// This will help to no to show the animation of loading on the first mount.
|
||||
const isMountRef = (0, _react.useRef)(true);
|
||||
_react.default.useEffect(() => {
|
||||
isMountRef.current = false;
|
||||
return () => {
|
||||
isMountRef.current = true;
|
||||
};
|
||||
}, []);
|
||||
// ========================= Effect =========================
|
||||
// Loading. Should use `useLayoutEffect` to avoid low perf multiple click issue.
|
||||
// https://github.com/ant-design/ant-design/issues/51325
|
||||
(0, _useLayoutEffect.default)(() => {
|
||||
let delayTimer = null;
|
||||
if (loadingOrDelay.delay > 0) {
|
||||
delayTimer = setTimeout(() => {
|
||||
delayTimer = null;
|
||||
setLoading(true);
|
||||
}, loadingOrDelay.delay);
|
||||
} else {
|
||||
setLoading(loadingOrDelay.loading);
|
||||
}
|
||||
function cleanupTimer() {
|
||||
if (delayTimer) {
|
||||
clearTimeout(delayTimer);
|
||||
delayTimer = null;
|
||||
}
|
||||
}
|
||||
return cleanupTimer;
|
||||
}, [loadingOrDelay.delay, loadingOrDelay.loading]);
|
||||
// Two chinese characters check
|
||||
(0, _react.useEffect)(() => {
|
||||
// FIXME: for HOC usage like <FormatMessage />
|
||||
if (!buttonRef.current || !mergedInsertSpace) {
|
||||
return;
|
||||
}
|
||||
const buttonText = buttonRef.current.textContent || '';
|
||||
if (needInserted && (0, _buttonHelpers.isTwoCNChar)(buttonText)) {
|
||||
if (!hasTwoCNChar) {
|
||||
setHasTwoCNChar(true);
|
||||
}
|
||||
} else if (hasTwoCNChar) {
|
||||
setHasTwoCNChar(false);
|
||||
}
|
||||
});
|
||||
// Auto focus
|
||||
(0, _react.useEffect)(() => {
|
||||
if (autoFocus && buttonRef.current) {
|
||||
buttonRef.current.focus();
|
||||
}
|
||||
}, []);
|
||||
// ========================= Events =========================
|
||||
const handleClick = _react.default.useCallback(e => {
|
||||
var _a;
|
||||
// FIXME: https://github.com/ant-design/ant-design/issues/30207
|
||||
if (innerLoading || mergedDisabled) {
|
||||
e.preventDefault();
|
||||
return;
|
||||
}
|
||||
(_a = props.onClick) === null || _a === void 0 ? void 0 : _a.call(props, 'href' in props ? e : e);
|
||||
}, [props.onClick, innerLoading, mergedDisabled]);
|
||||
// ========================== Warn ==========================
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
const warning = (0, _warning.devUseWarning)('Button');
|
||||
process.env.NODE_ENV !== "production" ? warning(!(typeof icon === 'string' && icon.length > 2), 'breaking', `\`icon\` is using ReactNode instead of string naming in v4. Please check \`${icon}\` at https://ant.design/components/icon`) : void 0;
|
||||
process.env.NODE_ENV !== "production" ? warning(!(ghost && (0, _buttonHelpers.isUnBorderedButtonVariant)(mergedVariant)), 'usage', "`link` or `text` button can't be a `ghost` button.") : void 0;
|
||||
}
|
||||
// ========================== Size ==========================
|
||||
const {
|
||||
compactSize,
|
||||
compactItemClassnames
|
||||
} = (0, _Compact.useCompactItemContext)(prefixCls, direction);
|
||||
const sizeClassNameMap = {
|
||||
large: 'lg',
|
||||
small: 'sm',
|
||||
middle: undefined
|
||||
};
|
||||
const sizeFullName = (0, _useSize.default)(ctxSize => {
|
||||
var _a, _b;
|
||||
return (_b = (_a = customizeSize !== null && customizeSize !== void 0 ? customizeSize : compactSize) !== null && _a !== void 0 ? _a : groupSize) !== null && _b !== void 0 ? _b : ctxSize;
|
||||
});
|
||||
const sizeCls = sizeFullName ? (_b = sizeClassNameMap[sizeFullName]) !== null && _b !== void 0 ? _b : '' : '';
|
||||
const iconType = innerLoading ? 'loading' : icon;
|
||||
const linkButtonRestProps = (0, _omit.default)(rest, ['navigate']);
|
||||
// ========================= Render =========================
|
||||
const classes = (0, _classnames.default)(prefixCls, hashId, cssVarCls, {
|
||||
[`${prefixCls}-${shape}`]: shape !== 'default' && shape,
|
||||
// Compatible with versions earlier than 5.21.0
|
||||
[`${prefixCls}-${mergedType}`]: mergedType,
|
||||
[`${prefixCls}-dangerous`]: danger,
|
||||
[`${prefixCls}-color-${mergedColorText}`]: mergedColorText,
|
||||
[`${prefixCls}-variant-${mergedVariant}`]: mergedVariant,
|
||||
[`${prefixCls}-${sizeCls}`]: sizeCls,
|
||||
[`${prefixCls}-icon-only`]: !children && children !== 0 && !!iconType,
|
||||
[`${prefixCls}-background-ghost`]: ghost && !(0, _buttonHelpers.isUnBorderedButtonVariant)(mergedVariant),
|
||||
[`${prefixCls}-loading`]: innerLoading,
|
||||
[`${prefixCls}-two-chinese-chars`]: hasTwoCNChar && mergedInsertSpace && !innerLoading,
|
||||
[`${prefixCls}-block`]: block,
|
||||
[`${prefixCls}-rtl`]: direction === 'rtl',
|
||||
[`${prefixCls}-icon-end`]: iconPosition === 'end'
|
||||
}, compactItemClassnames, className, rootClassName, contextClassName);
|
||||
const fullStyle = Object.assign(Object.assign({}, contextStyle), customStyle);
|
||||
const iconClasses = (0, _classnames.default)(customClassNames === null || customClassNames === void 0 ? void 0 : customClassNames.icon, contextClassNames.icon);
|
||||
const iconStyle = Object.assign(Object.assign({}, (styles === null || styles === void 0 ? void 0 : styles.icon) || {}), contextStyles.icon || {});
|
||||
/**
|
||||
* Extract icon node
|
||||
* If there is a custom icon and not in loading state: show custom icon
|
||||
*/
|
||||
const iconWrapperElement = child => (/*#__PURE__*/_react.default.createElement(_IconWrapper.default, {
|
||||
prefixCls: prefixCls,
|
||||
className: iconClasses,
|
||||
style: iconStyle
|
||||
}, child));
|
||||
const defaultLoadingIconElement = () => (/*#__PURE__*/_react.default.createElement(_DefaultLoadingIcon.default, {
|
||||
existIcon: !!icon,
|
||||
prefixCls: prefixCls,
|
||||
loading: innerLoading,
|
||||
mount: isMountRef.current
|
||||
}));
|
||||
/**
|
||||
* Using if-else statements can improve code readability without affecting future expansion.
|
||||
*/
|
||||
let iconNode;
|
||||
if (icon && !innerLoading) {
|
||||
iconNode = iconWrapperElement(icon);
|
||||
} else if (loading && typeof loading === 'object' && loading.icon) {
|
||||
iconNode = iconWrapperElement(loading.icon);
|
||||
} else {
|
||||
iconNode = defaultLoadingIconElement();
|
||||
}
|
||||
const kids = children || children === 0 ? (0, _buttonHelpers.spaceChildren)(children, needInserted && mergedInsertSpace) : null;
|
||||
if (linkButtonRestProps.href !== undefined) {
|
||||
return wrapCSSVar(/*#__PURE__*/_react.default.createElement("a", Object.assign({}, linkButtonRestProps, {
|
||||
className: (0, _classnames.default)(classes, {
|
||||
[`${prefixCls}-disabled`]: mergedDisabled
|
||||
}),
|
||||
href: mergedDisabled ? undefined : linkButtonRestProps.href,
|
||||
style: fullStyle,
|
||||
onClick: handleClick,
|
||||
ref: mergedRef,
|
||||
tabIndex: mergedDisabled ? -1 : 0,
|
||||
"aria-disabled": mergedDisabled
|
||||
}), iconNode, kids));
|
||||
}
|
||||
let buttonNode = /*#__PURE__*/_react.default.createElement("button", Object.assign({}, rest, {
|
||||
type: htmlType,
|
||||
className: classes,
|
||||
style: fullStyle,
|
||||
onClick: handleClick,
|
||||
disabled: mergedDisabled,
|
||||
ref: mergedRef
|
||||
}), iconNode, kids, compactItemClassnames && /*#__PURE__*/_react.default.createElement(_compact.default, {
|
||||
prefixCls: prefixCls
|
||||
}));
|
||||
if (!(0, _buttonHelpers.isUnBorderedButtonVariant)(mergedVariant)) {
|
||||
buttonNode = /*#__PURE__*/_react.default.createElement(_wave.default, {
|
||||
component: "Button",
|
||||
disabled: innerLoading
|
||||
}, buttonNode);
|
||||
}
|
||||
return wrapCSSVar(buttonNode);
|
||||
});
|
||||
const Button = InternalCompoundedButton;
|
||||
Button.Group = _buttonGroup.default;
|
||||
Button.__ANT_BUTTON = true;
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
Button.displayName = 'Button';
|
||||
}
|
||||
var _default = exports.default = Button;
|
||||
18
frontend/node_modules/antd/lib/button/buttonHelpers.d.ts
generated
vendored
Normal file
18
frontend/node_modules/antd/lib/button/buttonHelpers.d.ts
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import React from 'react';
|
||||
import type { BaseButtonProps, LegacyButtonType } from './button';
|
||||
export declare const isTwoCNChar: (string: string) => boolean;
|
||||
export declare function convertLegacyProps(type?: LegacyButtonType): Pick<BaseButtonProps, 'danger' | 'type'>;
|
||||
export declare function isString(str: unknown): str is string;
|
||||
export declare function isUnBorderedButtonVariant(type?: ButtonVariantType): type is "text" | "link";
|
||||
export declare function spaceChildren(children: React.ReactNode, needInserted: boolean): (number | React.JSX.Element)[] | null | undefined;
|
||||
declare const _ButtonTypes: readonly ["default", "primary", "dashed", "link", "text"];
|
||||
export type ButtonType = (typeof _ButtonTypes)[number];
|
||||
declare const _ButtonShapes: readonly ["default", "circle", "round"];
|
||||
export type ButtonShape = (typeof _ButtonShapes)[number];
|
||||
declare const _ButtonHTMLTypes: readonly ["submit", "button", "reset"];
|
||||
export type ButtonHTMLType = (typeof _ButtonHTMLTypes)[number];
|
||||
export declare const _ButtonVariantTypes: readonly ["outlined", "dashed", "solid", "filled", "text", "link"];
|
||||
export type ButtonVariantType = (typeof _ButtonVariantTypes)[number];
|
||||
export declare const _ButtonColorTypes: readonly ["default", "primary", "danger", "blue", "purple", "cyan", "green", "magenta", "pink", "red", "orange", "yellow", "volcano", "geekblue", "lime", "gold"];
|
||||
export type ButtonColorType = (typeof _ButtonColorTypes)[number];
|
||||
export {};
|
||||
75
frontend/node_modules/antd/lib/button/buttonHelpers.js
generated
vendored
Normal file
75
frontend/node_modules/antd/lib/button/buttonHelpers.js
generated
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
"use strict";
|
||||
"use client";
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports._ButtonVariantTypes = exports._ButtonColorTypes = void 0;
|
||||
exports.convertLegacyProps = convertLegacyProps;
|
||||
exports.isString = isString;
|
||||
exports.isTwoCNChar = void 0;
|
||||
exports.isUnBorderedButtonVariant = isUnBorderedButtonVariant;
|
||||
exports.spaceChildren = spaceChildren;
|
||||
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
||||
var _react = _interopRequireDefault(require("react"));
|
||||
var _reactNode = require("../_util/reactNode");
|
||||
var _interface = require("../theme/interface");
|
||||
const rxTwoCNChar = /^[\u4E00-\u9FA5]{2}$/;
|
||||
const isTwoCNChar = exports.isTwoCNChar = rxTwoCNChar.test.bind(rxTwoCNChar);
|
||||
function convertLegacyProps(type) {
|
||||
if (type === 'danger') {
|
||||
return {
|
||||
danger: true
|
||||
};
|
||||
}
|
||||
return {
|
||||
type
|
||||
};
|
||||
}
|
||||
function isString(str) {
|
||||
return typeof str === 'string';
|
||||
}
|
||||
function isUnBorderedButtonVariant(type) {
|
||||
return type === 'text' || type === 'link';
|
||||
}
|
||||
function splitCNCharsBySpace(child, needInserted) {
|
||||
if (child === null || child === undefined) {
|
||||
return;
|
||||
}
|
||||
const SPACE = needInserted ? ' ' : '';
|
||||
if (typeof child !== 'string' && typeof child !== 'number' && isString(child.type) && isTwoCNChar(child.props.children)) {
|
||||
return (0, _reactNode.cloneElement)(child, {
|
||||
children: child.props.children.split('').join(SPACE)
|
||||
});
|
||||
}
|
||||
if (isString(child)) {
|
||||
return isTwoCNChar(child) ? /*#__PURE__*/_react.default.createElement("span", null, child.split('').join(SPACE)) : /*#__PURE__*/_react.default.createElement("span", null, child);
|
||||
}
|
||||
if ((0, _reactNode.isFragment)(child)) {
|
||||
return /*#__PURE__*/_react.default.createElement("span", null, child);
|
||||
}
|
||||
return child;
|
||||
}
|
||||
function spaceChildren(children, needInserted) {
|
||||
let isPrevChildPure = false;
|
||||
const childList = [];
|
||||
_react.default.Children.forEach(children, child => {
|
||||
const type = typeof child;
|
||||
const isCurrentChildPure = type === 'string' || type === 'number';
|
||||
if (isPrevChildPure && isCurrentChildPure) {
|
||||
const lastIndex = childList.length - 1;
|
||||
const lastChild = childList[lastIndex];
|
||||
childList[lastIndex] = `${lastChild}${child}`;
|
||||
} else {
|
||||
childList.push(child);
|
||||
}
|
||||
isPrevChildPure = isCurrentChildPure;
|
||||
});
|
||||
return _react.default.Children.map(childList, child => splitCNCharsBySpace(child, needInserted));
|
||||
}
|
||||
const _ButtonTypes = ['default', 'primary', 'dashed', 'link', 'text'];
|
||||
const _ButtonShapes = ['default', 'circle', 'round'];
|
||||
const _ButtonHTMLTypes = ['submit', 'button', 'reset'];
|
||||
const _ButtonVariantTypes = exports._ButtonVariantTypes = ['outlined', 'dashed', 'solid', 'filled', 'text', 'link'];
|
||||
const _ButtonColorTypes = exports._ButtonColorTypes = ['default', 'primary', 'danger'].concat((0, _toConsumableArray2.default)(_interface.PresetColors));
|
||||
6
frontend/node_modules/antd/lib/button/index.d.ts
generated
vendored
Normal file
6
frontend/node_modules/antd/lib/button/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import Button from './button';
|
||||
export type { SizeType as ButtonSize } from '../config-provider/SizeContext';
|
||||
export type { ButtonProps } from './button';
|
||||
export type { ButtonGroupProps } from './button-group';
|
||||
export * from './buttonHelpers';
|
||||
export default Button;
|
||||
23
frontend/node_modules/antd/lib/button/index.js
generated
vendored
Normal file
23
frontend/node_modules/antd/lib/button/index.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
"use strict";
|
||||
"use client";
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
var _exportNames = {};
|
||||
exports.default = void 0;
|
||||
var _button = _interopRequireDefault(require("./button"));
|
||||
var _buttonHelpers = require("./buttonHelpers");
|
||||
Object.keys(_buttonHelpers).forEach(function (key) {
|
||||
if (key === "default" || key === "__esModule") return;
|
||||
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
||||
if (key in exports && exports[key] === _buttonHelpers[key]) return;
|
||||
Object.defineProperty(exports, key, {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _buttonHelpers[key];
|
||||
}
|
||||
});
|
||||
});
|
||||
var _default = exports.default = _button.default;
|
||||
2
frontend/node_modules/antd/lib/button/style/compact.d.ts
generated
vendored
Normal file
2
frontend/node_modules/antd/lib/button/style/compact.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
declare const _default: import("react").FunctionComponent<import("@ant-design/cssinjs-utils/lib/util/genStyleUtils").SubStyleComponentProps>;
|
||||
export default _default;
|
||||
42
frontend/node_modules/antd/lib/button/style/compact.js
generated
vendored
Normal file
42
frontend/node_modules/antd/lib/button/style/compact.js
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
var _compactItem = require("../../style/compact-item");
|
||||
var _compactItemVertical = require("../../style/compact-item-vertical");
|
||||
var _internal = require("../../theme/internal");
|
||||
var _token = require("./token");
|
||||
const genButtonCompactStyle = token => {
|
||||
const {
|
||||
componentCls,
|
||||
colorPrimaryHover,
|
||||
lineWidth,
|
||||
calc
|
||||
} = token;
|
||||
const insetOffset = calc(lineWidth).mul(-1).equal();
|
||||
const getCompactBorderStyle = vertical => {
|
||||
const selector = `${componentCls}-compact${vertical ? '-vertical' : ''}-item${componentCls}-primary:not([disabled])`;
|
||||
return {
|
||||
[`${selector} + ${selector}::before`]: {
|
||||
position: 'absolute',
|
||||
top: vertical ? insetOffset : 0,
|
||||
insetInlineStart: vertical ? 0 : insetOffset,
|
||||
backgroundColor: colorPrimaryHover,
|
||||
content: '""',
|
||||
width: vertical ? '100%' : lineWidth,
|
||||
height: vertical ? lineWidth : '100%'
|
||||
}
|
||||
};
|
||||
};
|
||||
// Special styles for Primary Button
|
||||
return Object.assign(Object.assign({}, getCompactBorderStyle()), getCompactBorderStyle(true));
|
||||
};
|
||||
// ============================== Export ==============================
|
||||
var _default = exports.default = (0, _internal.genSubStyleComponent)(['Button', 'compact'], token => {
|
||||
const buttonToken = (0, _token.prepareToken)(token);
|
||||
return [
|
||||
// Space Compact
|
||||
(0, _compactItem.genCompactItemStyle)(buttonToken), (0, _compactItemVertical.genCompactItemVerticalStyle)(buttonToken), genButtonCompactStyle(buttonToken)];
|
||||
}, _token.prepareComponentToken);
|
||||
4
frontend/node_modules/antd/lib/button/style/group.d.ts
generated
vendored
Normal file
4
frontend/node_modules/antd/lib/button/style/group.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
import type { GenerateStyle } from '../../theme/internal';
|
||||
import type { ButtonToken } from './token';
|
||||
declare const genGroupStyle: GenerateStyle<ButtonToken>;
|
||||
export default genGroupStyle;
|
||||
72
frontend/node_modules/antd/lib/button/style/group.js
generated
vendored
Normal file
72
frontend/node_modules/antd/lib/button/style/group.js
generated
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
const genButtonBorderStyle = (buttonTypeCls, borderColor) => ({
|
||||
// Border
|
||||
[`> span, > ${buttonTypeCls}`]: {
|
||||
'&:not(:last-child)': {
|
||||
[`&, & > ${buttonTypeCls}`]: {
|
||||
'&:not(:disabled)': {
|
||||
borderInlineEndColor: borderColor
|
||||
}
|
||||
}
|
||||
},
|
||||
'&:not(:first-child)': {
|
||||
[`&, & > ${buttonTypeCls}`]: {
|
||||
'&:not(:disabled)': {
|
||||
borderInlineStartColor: borderColor
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
const genGroupStyle = token => {
|
||||
const {
|
||||
componentCls,
|
||||
fontSize,
|
||||
lineWidth,
|
||||
groupBorderColor,
|
||||
colorErrorHover
|
||||
} = token;
|
||||
return {
|
||||
[`${componentCls}-group`]: [{
|
||||
position: 'relative',
|
||||
display: 'inline-flex',
|
||||
// Border
|
||||
[`> span, > ${componentCls}`]: {
|
||||
'&:not(:last-child)': {
|
||||
[`&, & > ${componentCls}`]: {
|
||||
borderStartEndRadius: 0,
|
||||
borderEndEndRadius: 0
|
||||
}
|
||||
},
|
||||
'&:not(:first-child)': {
|
||||
marginInlineStart: token.calc(lineWidth).mul(-1).equal(),
|
||||
[`&, & > ${componentCls}`]: {
|
||||
borderStartStartRadius: 0,
|
||||
borderEndStartRadius: 0
|
||||
}
|
||||
}
|
||||
},
|
||||
[componentCls]: {
|
||||
position: 'relative',
|
||||
zIndex: 1,
|
||||
'&:hover, &:focus, &:active': {
|
||||
zIndex: 2
|
||||
},
|
||||
'&[disabled]': {
|
||||
zIndex: 0
|
||||
}
|
||||
},
|
||||
[`${componentCls}-icon-only`]: {
|
||||
fontSize
|
||||
}
|
||||
},
|
||||
// Border Color
|
||||
genButtonBorderStyle(`${componentCls}-primary`, groupBorderColor), genButtonBorderStyle(`${componentCls}-danger`, colorErrorHover)]
|
||||
};
|
||||
};
|
||||
var _default = exports.default = genGroupStyle;
|
||||
4
frontend/node_modules/antd/lib/button/style/index.d.ts
generated
vendored
Normal file
4
frontend/node_modules/antd/lib/button/style/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
import type { ComponentToken } from './token';
|
||||
export type { ComponentToken };
|
||||
declare const _default: (prefixCls: string, rootCls?: string) => readonly [(node: React.ReactElement) => React.ReactElement, string, string];
|
||||
export default _default;
|
||||
485
frontend/node_modules/antd/lib/button/style/index.js
generated
vendored
Normal file
485
frontend/node_modules/antd/lib/button/style/index.js
generated
vendored
Normal file
@@ -0,0 +1,485 @@
|
||||
"use strict";
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
var _cssinjs = require("@ant-design/cssinjs");
|
||||
var _style = require("../../style");
|
||||
var _interface = require("../../theme/interface");
|
||||
var _internal = require("../../theme/internal");
|
||||
var _group = _interopRequireDefault(require("./group"));
|
||||
var _token = require("./token");
|
||||
// ============================== Shared ==============================
|
||||
const genSharedButtonStyle = token => {
|
||||
const {
|
||||
componentCls,
|
||||
iconCls,
|
||||
fontWeight,
|
||||
opacityLoading,
|
||||
motionDurationSlow,
|
||||
motionEaseInOut,
|
||||
iconGap,
|
||||
calc
|
||||
} = token;
|
||||
return {
|
||||
[componentCls]: {
|
||||
outline: 'none',
|
||||
position: 'relative',
|
||||
display: 'inline-flex',
|
||||
gap: iconGap,
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
fontWeight,
|
||||
whiteSpace: 'nowrap',
|
||||
textAlign: 'center',
|
||||
backgroundImage: 'none',
|
||||
background: 'transparent',
|
||||
border: `${(0, _cssinjs.unit)(token.lineWidth)} ${token.lineType} transparent`,
|
||||
cursor: 'pointer',
|
||||
transition: `all ${token.motionDurationMid} ${token.motionEaseInOut}`,
|
||||
userSelect: 'none',
|
||||
touchAction: 'manipulation',
|
||||
color: token.colorText,
|
||||
'&:disabled > *': {
|
||||
pointerEvents: 'none'
|
||||
},
|
||||
// https://github.com/ant-design/ant-design/issues/51380
|
||||
[`${componentCls}-icon > svg`]: (0, _style.resetIcon)(),
|
||||
'> a': {
|
||||
color: 'currentColor'
|
||||
},
|
||||
'&:not(:disabled)': (0, _style.genFocusStyle)(token),
|
||||
[`&${componentCls}-two-chinese-chars::first-letter`]: {
|
||||
letterSpacing: '0.34em'
|
||||
},
|
||||
[`&${componentCls}-two-chinese-chars > *:not(${iconCls})`]: {
|
||||
marginInlineEnd: '-0.34em',
|
||||
letterSpacing: '0.34em'
|
||||
},
|
||||
[`&${componentCls}-icon-only`]: {
|
||||
paddingInline: 0,
|
||||
// make `btn-icon-only` not too narrow
|
||||
[`&${componentCls}-compact-item`]: {
|
||||
flex: 'none'
|
||||
}
|
||||
},
|
||||
// Loading
|
||||
[`&${componentCls}-loading`]: {
|
||||
opacity: opacityLoading,
|
||||
cursor: 'default'
|
||||
},
|
||||
[`${componentCls}-loading-icon`]: {
|
||||
transition: ['width', 'opacity', 'margin'].map(transition => `${transition} ${motionDurationSlow} ${motionEaseInOut}`).join(',')
|
||||
},
|
||||
// iconPosition
|
||||
[`&:not(${componentCls}-icon-end)`]: {
|
||||
[`${componentCls}-loading-icon-motion`]: {
|
||||
'&-appear-start, &-enter-start': {
|
||||
marginInlineEnd: calc(iconGap).mul(-1).equal()
|
||||
},
|
||||
'&-appear-active, &-enter-active': {
|
||||
marginInlineEnd: 0
|
||||
},
|
||||
'&-leave-start': {
|
||||
marginInlineEnd: 0
|
||||
},
|
||||
'&-leave-active': {
|
||||
marginInlineEnd: calc(iconGap).mul(-1).equal()
|
||||
}
|
||||
}
|
||||
},
|
||||
'&-icon-end': {
|
||||
flexDirection: 'row-reverse',
|
||||
[`${componentCls}-loading-icon-motion`]: {
|
||||
'&-appear-start, &-enter-start': {
|
||||
marginInlineStart: calc(iconGap).mul(-1).equal()
|
||||
},
|
||||
'&-appear-active, &-enter-active': {
|
||||
marginInlineStart: 0
|
||||
},
|
||||
'&-leave-start': {
|
||||
marginInlineStart: 0
|
||||
},
|
||||
'&-leave-active': {
|
||||
marginInlineStart: calc(iconGap).mul(-1).equal()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
const genHoverActiveButtonStyle = (btnCls, hoverStyle, activeStyle) => ({
|
||||
[`&:not(:disabled):not(${btnCls}-disabled)`]: {
|
||||
'&:hover': hoverStyle,
|
||||
'&:active': activeStyle
|
||||
}
|
||||
});
|
||||
// ============================== Shape ===============================
|
||||
const genCircleButtonStyle = token => ({
|
||||
minWidth: token.controlHeight,
|
||||
paddingInline: 0,
|
||||
borderRadius: '50%'
|
||||
});
|
||||
const genDisabledStyle = token => ({
|
||||
cursor: 'not-allowed',
|
||||
borderColor: token.borderColorDisabled,
|
||||
color: token.colorTextDisabled,
|
||||
background: token.colorBgContainerDisabled,
|
||||
boxShadow: 'none'
|
||||
});
|
||||
const genGhostButtonStyle = (btnCls, background, textColor, borderColor, textColorDisabled, borderColorDisabled, hoverStyle, activeStyle) => ({
|
||||
[`&${btnCls}-background-ghost`]: Object.assign(Object.assign({
|
||||
color: textColor || undefined,
|
||||
background,
|
||||
borderColor: borderColor || undefined,
|
||||
boxShadow: 'none'
|
||||
}, genHoverActiveButtonStyle(btnCls, Object.assign({
|
||||
background
|
||||
}, hoverStyle), Object.assign({
|
||||
background
|
||||
}, activeStyle))), {
|
||||
'&:disabled': {
|
||||
cursor: 'not-allowed',
|
||||
color: textColorDisabled || undefined,
|
||||
borderColor: borderColorDisabled || undefined
|
||||
}
|
||||
})
|
||||
});
|
||||
const genSolidDisabledButtonStyle = token => ({
|
||||
[`&:disabled, &${token.componentCls}-disabled`]: Object.assign({}, genDisabledStyle(token))
|
||||
});
|
||||
const genPureDisabledButtonStyle = token => ({
|
||||
[`&:disabled, &${token.componentCls}-disabled`]: {
|
||||
cursor: 'not-allowed',
|
||||
color: token.colorTextDisabled
|
||||
}
|
||||
});
|
||||
// ============================== Variant =============================
|
||||
const genVariantButtonStyle = (token, hoverStyle, activeStyle, variant) => {
|
||||
const isPureDisabled = variant && ['link', 'text'].includes(variant);
|
||||
const genDisabledButtonStyle = isPureDisabled ? genPureDisabledButtonStyle : genSolidDisabledButtonStyle;
|
||||
return Object.assign(Object.assign({}, genDisabledButtonStyle(token)), genHoverActiveButtonStyle(token.componentCls, hoverStyle, activeStyle));
|
||||
};
|
||||
const genSolidButtonStyle = (token, textColor, background, hoverStyle, activeStyle) => ({
|
||||
[`&${token.componentCls}-variant-solid`]: Object.assign({
|
||||
color: textColor,
|
||||
background
|
||||
}, genVariantButtonStyle(token, hoverStyle, activeStyle))
|
||||
});
|
||||
const genOutlinedDashedButtonStyle = (token, borderColor, background, hoverStyle, activeStyle) => ({
|
||||
[`&${token.componentCls}-variant-outlined, &${token.componentCls}-variant-dashed`]: Object.assign({
|
||||
borderColor,
|
||||
background
|
||||
}, genVariantButtonStyle(token, hoverStyle, activeStyle))
|
||||
});
|
||||
const genDashedButtonStyle = token => ({
|
||||
[`&${token.componentCls}-variant-dashed`]: {
|
||||
borderStyle: 'dashed'
|
||||
}
|
||||
});
|
||||
const genFilledButtonStyle = (token, background, hoverStyle, activeStyle) => ({
|
||||
[`&${token.componentCls}-variant-filled`]: Object.assign({
|
||||
boxShadow: 'none',
|
||||
background
|
||||
}, genVariantButtonStyle(token, hoverStyle, activeStyle))
|
||||
});
|
||||
const genTextLinkButtonStyle = (token, textColor, variant, hoverStyle, activeStyle) => ({
|
||||
[`&${token.componentCls}-variant-${variant}`]: Object.assign({
|
||||
color: textColor,
|
||||
boxShadow: 'none'
|
||||
}, genVariantButtonStyle(token, hoverStyle, activeStyle, variant))
|
||||
});
|
||||
// =============================== Color ==============================
|
||||
const genPresetColorStyle = token => {
|
||||
const {
|
||||
componentCls
|
||||
} = token;
|
||||
return _interface.PresetColors.reduce((prev, colorKey) => {
|
||||
const darkColor = token[`${colorKey}6`];
|
||||
const lightColor = token[`${colorKey}1`];
|
||||
const hoverColor = token[`${colorKey}5`];
|
||||
const lightHoverColor = token[`${colorKey}2`];
|
||||
const lightBorderColor = token[`${colorKey}3`];
|
||||
const activeColor = token[`${colorKey}7`];
|
||||
return Object.assign(Object.assign({}, prev), {
|
||||
[`&${componentCls}-color-${colorKey}`]: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({
|
||||
color: darkColor,
|
||||
boxShadow: token[`${colorKey}ShadowColor`]
|
||||
}, genSolidButtonStyle(token, token.colorTextLightSolid, darkColor, {
|
||||
background: hoverColor
|
||||
}, {
|
||||
background: activeColor
|
||||
})), genOutlinedDashedButtonStyle(token, darkColor, token.colorBgContainer, {
|
||||
color: hoverColor,
|
||||
borderColor: hoverColor,
|
||||
background: token.colorBgContainer
|
||||
}, {
|
||||
color: activeColor,
|
||||
borderColor: activeColor,
|
||||
background: token.colorBgContainer
|
||||
})), genDashedButtonStyle(token)), genFilledButtonStyle(token, lightColor, {
|
||||
color: darkColor,
|
||||
background: lightHoverColor
|
||||
}, {
|
||||
color: darkColor,
|
||||
background: lightBorderColor
|
||||
})), genTextLinkButtonStyle(token, darkColor, 'link', {
|
||||
color: hoverColor
|
||||
}, {
|
||||
color: activeColor
|
||||
})), genTextLinkButtonStyle(token, darkColor, 'text', {
|
||||
color: hoverColor,
|
||||
background: lightColor
|
||||
}, {
|
||||
color: activeColor,
|
||||
background: lightBorderColor
|
||||
}))
|
||||
});
|
||||
}, {});
|
||||
};
|
||||
const genDefaultButtonStyle = token => Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({
|
||||
color: token.defaultColor,
|
||||
boxShadow: token.defaultShadow
|
||||
}, genSolidButtonStyle(token, token.solidTextColor, token.colorBgSolid, {
|
||||
color: token.solidTextColor,
|
||||
background: token.colorBgSolidHover
|
||||
}, {
|
||||
color: token.solidTextColor,
|
||||
background: token.colorBgSolidActive
|
||||
})), genDashedButtonStyle(token)), genFilledButtonStyle(token, token.colorFillTertiary, {
|
||||
color: token.defaultColor,
|
||||
background: token.colorFillSecondary
|
||||
}, {
|
||||
color: token.defaultColor,
|
||||
background: token.colorFill
|
||||
})), genGhostButtonStyle(token.componentCls, token.ghostBg, token.defaultGhostColor, token.defaultGhostBorderColor, token.colorTextDisabled, token.colorBorder)), genTextLinkButtonStyle(token, token.textTextColor, 'link', {
|
||||
color: token.colorLinkHover,
|
||||
background: token.linkHoverBg
|
||||
}, {
|
||||
color: token.colorLinkActive
|
||||
}));
|
||||
const genPrimaryButtonStyle = token => Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({
|
||||
color: token.colorPrimary,
|
||||
boxShadow: token.primaryShadow
|
||||
}, genOutlinedDashedButtonStyle(token, token.colorPrimary, token.colorBgContainer, {
|
||||
color: token.colorPrimaryTextHover,
|
||||
borderColor: token.colorPrimaryHover,
|
||||
background: token.colorBgContainer
|
||||
}, {
|
||||
color: token.colorPrimaryTextActive,
|
||||
borderColor: token.colorPrimaryActive,
|
||||
background: token.colorBgContainer
|
||||
})), genDashedButtonStyle(token)), genFilledButtonStyle(token, token.colorPrimaryBg, {
|
||||
color: token.colorPrimary,
|
||||
background: token.colorPrimaryBgHover
|
||||
}, {
|
||||
color: token.colorPrimary,
|
||||
background: token.colorPrimaryBorder
|
||||
})), genTextLinkButtonStyle(token, token.colorPrimaryText, 'text', {
|
||||
color: token.colorPrimaryTextHover,
|
||||
background: token.colorPrimaryBg
|
||||
}, {
|
||||
color: token.colorPrimaryTextActive,
|
||||
background: token.colorPrimaryBorder
|
||||
})), genTextLinkButtonStyle(token, token.colorPrimaryText, 'link', {
|
||||
color: token.colorPrimaryTextHover,
|
||||
background: token.linkHoverBg
|
||||
}, {
|
||||
color: token.colorPrimaryTextActive
|
||||
})), genGhostButtonStyle(token.componentCls, token.ghostBg, token.colorPrimary, token.colorPrimary, token.colorTextDisabled, token.colorBorder, {
|
||||
color: token.colorPrimaryHover,
|
||||
borderColor: token.colorPrimaryHover
|
||||
}, {
|
||||
color: token.colorPrimaryActive,
|
||||
borderColor: token.colorPrimaryActive
|
||||
}));
|
||||
const genDangerousStyle = token => Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({
|
||||
color: token.colorError,
|
||||
boxShadow: token.dangerShadow
|
||||
}, genSolidButtonStyle(token, token.dangerColor, token.colorError, {
|
||||
background: token.colorErrorHover
|
||||
}, {
|
||||
background: token.colorErrorActive
|
||||
})), genOutlinedDashedButtonStyle(token, token.colorError, token.colorBgContainer, {
|
||||
color: token.colorErrorHover,
|
||||
borderColor: token.colorErrorBorderHover
|
||||
}, {
|
||||
color: token.colorErrorActive,
|
||||
borderColor: token.colorErrorActive
|
||||
})), genDashedButtonStyle(token)), genFilledButtonStyle(token, token.colorErrorBg, {
|
||||
color: token.colorError,
|
||||
background: token.colorErrorBgFilledHover
|
||||
}, {
|
||||
color: token.colorError,
|
||||
background: token.colorErrorBgActive
|
||||
})), genTextLinkButtonStyle(token, token.colorError, 'text', {
|
||||
color: token.colorErrorHover,
|
||||
background: token.colorErrorBg
|
||||
}, {
|
||||
color: token.colorErrorHover,
|
||||
background: token.colorErrorBgActive
|
||||
})), genTextLinkButtonStyle(token, token.colorError, 'link', {
|
||||
color: token.colorErrorHover
|
||||
}, {
|
||||
color: token.colorErrorActive
|
||||
})), genGhostButtonStyle(token.componentCls, token.ghostBg, token.colorError, token.colorError, token.colorTextDisabled, token.colorBorder, {
|
||||
color: token.colorErrorHover,
|
||||
borderColor: token.colorErrorHover
|
||||
}, {
|
||||
color: token.colorErrorActive,
|
||||
borderColor: token.colorErrorActive
|
||||
}));
|
||||
const genLinkStyle = token => Object.assign(Object.assign({}, genTextLinkButtonStyle(token, token.colorLink, 'link', {
|
||||
color: token.colorLinkHover
|
||||
}, {
|
||||
color: token.colorLinkActive
|
||||
})), genGhostButtonStyle(token.componentCls, token.ghostBg, token.colorInfo, token.colorInfo, token.colorTextDisabled, token.colorBorder, {
|
||||
color: token.colorInfoHover,
|
||||
borderColor: token.colorInfoHover
|
||||
}, {
|
||||
color: token.colorInfoActive,
|
||||
borderColor: token.colorInfoActive
|
||||
}));
|
||||
const genColorButtonStyle = token => {
|
||||
const {
|
||||
componentCls
|
||||
} = token;
|
||||
return Object.assign({
|
||||
[`${componentCls}-color-default`]: genDefaultButtonStyle(token),
|
||||
[`${componentCls}-color-primary`]: genPrimaryButtonStyle(token),
|
||||
[`${componentCls}-color-dangerous`]: genDangerousStyle(token),
|
||||
[`${componentCls}-color-link`]: genLinkStyle(token)
|
||||
}, genPresetColorStyle(token));
|
||||
};
|
||||
// =========== Compatible with versions earlier than 5.21.0 ===========
|
||||
const genCompatibleButtonStyle = token => Object.assign(Object.assign(Object.assign(Object.assign({}, genOutlinedDashedButtonStyle(token, token.defaultBorderColor, token.defaultBg, {
|
||||
color: token.defaultHoverColor,
|
||||
borderColor: token.defaultHoverBorderColor,
|
||||
background: token.defaultHoverBg
|
||||
}, {
|
||||
color: token.defaultActiveColor,
|
||||
borderColor: token.defaultActiveBorderColor,
|
||||
background: token.defaultActiveBg
|
||||
})), genTextLinkButtonStyle(token, token.textTextColor, 'text', {
|
||||
color: token.textTextHoverColor,
|
||||
background: token.textHoverBg
|
||||
}, {
|
||||
color: token.textTextActiveColor,
|
||||
background: token.colorBgTextActive
|
||||
})), genSolidButtonStyle(token, token.primaryColor, token.colorPrimary, {
|
||||
background: token.colorPrimaryHover,
|
||||
color: token.primaryColor
|
||||
}, {
|
||||
background: token.colorPrimaryActive,
|
||||
color: token.primaryColor
|
||||
})), genTextLinkButtonStyle(token, token.colorLink, 'link', {
|
||||
color: token.colorLinkHover,
|
||||
background: token.linkHoverBg
|
||||
}, {
|
||||
color: token.colorLinkActive
|
||||
}));
|
||||
// =============================== Size ===============================
|
||||
const genButtonStyle = (token, prefixCls = '') => {
|
||||
const {
|
||||
componentCls,
|
||||
controlHeight,
|
||||
fontSize,
|
||||
borderRadius,
|
||||
buttonPaddingHorizontal,
|
||||
iconCls,
|
||||
buttonPaddingVertical,
|
||||
buttonIconOnlyFontSize
|
||||
} = token;
|
||||
return [{
|
||||
[prefixCls]: {
|
||||
fontSize,
|
||||
height: controlHeight,
|
||||
padding: `${(0, _cssinjs.unit)(buttonPaddingVertical)} ${(0, _cssinjs.unit)(buttonPaddingHorizontal)}`,
|
||||
borderRadius,
|
||||
[`&${componentCls}-icon-only`]: {
|
||||
width: controlHeight,
|
||||
[iconCls]: {
|
||||
fontSize: buttonIconOnlyFontSize
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
// Shape - patch prefixCls again to override solid border radius style
|
||||
{
|
||||
[`${componentCls}${componentCls}-circle${prefixCls}`]: genCircleButtonStyle(token)
|
||||
}, {
|
||||
[`${componentCls}${componentCls}-round${prefixCls}`]: {
|
||||
borderRadius: token.controlHeight,
|
||||
[`&:not(${componentCls}-icon-only)`]: {
|
||||
paddingInline: token.buttonPaddingHorizontal
|
||||
}
|
||||
}
|
||||
}];
|
||||
};
|
||||
const genSizeBaseButtonStyle = token => {
|
||||
const baseToken = (0, _internal.mergeToken)(token, {
|
||||
fontSize: token.contentFontSize
|
||||
});
|
||||
return genButtonStyle(baseToken, token.componentCls);
|
||||
};
|
||||
const genSizeSmallButtonStyle = token => {
|
||||
const smallToken = (0, _internal.mergeToken)(token, {
|
||||
controlHeight: token.controlHeightSM,
|
||||
fontSize: token.contentFontSizeSM,
|
||||
padding: token.paddingXS,
|
||||
buttonPaddingHorizontal: token.paddingInlineSM,
|
||||
buttonPaddingVertical: 0,
|
||||
borderRadius: token.borderRadiusSM,
|
||||
buttonIconOnlyFontSize: token.onlyIconSizeSM
|
||||
});
|
||||
return genButtonStyle(smallToken, `${token.componentCls}-sm`);
|
||||
};
|
||||
const genSizeLargeButtonStyle = token => {
|
||||
const largeToken = (0, _internal.mergeToken)(token, {
|
||||
controlHeight: token.controlHeightLG,
|
||||
fontSize: token.contentFontSizeLG,
|
||||
buttonPaddingHorizontal: token.paddingInlineLG,
|
||||
buttonPaddingVertical: 0,
|
||||
borderRadius: token.borderRadiusLG,
|
||||
buttonIconOnlyFontSize: token.onlyIconSizeLG
|
||||
});
|
||||
return genButtonStyle(largeToken, `${token.componentCls}-lg`);
|
||||
};
|
||||
const genBlockButtonStyle = token => {
|
||||
const {
|
||||
componentCls
|
||||
} = token;
|
||||
return {
|
||||
[componentCls]: {
|
||||
[`&${componentCls}-block`]: {
|
||||
width: '100%'
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
// ============================== Export ==============================
|
||||
var _default = exports.default = (0, _internal.genStyleHooks)('Button', token => {
|
||||
const buttonToken = (0, _token.prepareToken)(token);
|
||||
return [
|
||||
// Shared
|
||||
genSharedButtonStyle(buttonToken),
|
||||
// Size
|
||||
genSizeBaseButtonStyle(buttonToken), genSizeSmallButtonStyle(buttonToken), genSizeLargeButtonStyle(buttonToken),
|
||||
// Block
|
||||
genBlockButtonStyle(buttonToken),
|
||||
// Color
|
||||
genColorButtonStyle(buttonToken),
|
||||
// https://github.com/ant-design/ant-design/issues/50969
|
||||
genCompatibleButtonStyle(buttonToken),
|
||||
// Button Group
|
||||
(0, _group.default)(buttonToken)];
|
||||
}, _token.prepareComponentToken, {
|
||||
unitless: {
|
||||
fontWeight: true,
|
||||
contentLineHeight: true,
|
||||
contentLineHeightSM: true,
|
||||
contentLineHeightLG: true
|
||||
}
|
||||
});
|
||||
242
frontend/node_modules/antd/lib/button/style/token.d.ts
generated
vendored
Normal file
242
frontend/node_modules/antd/lib/button/style/token.d.ts
generated
vendored
Normal file
@@ -0,0 +1,242 @@
|
||||
import type { CSSProperties } from 'react';
|
||||
import type { FullToken, GenStyleFn, GetDefaultToken, PresetColorKey } from '../../theme/internal';
|
||||
/** Component only token. Which will handle additional calculation of alias token */
|
||||
export interface ComponentToken {
|
||||
/**
|
||||
* @desc 文字字重
|
||||
* @descEN Font weight of text
|
||||
*/
|
||||
fontWeight: CSSProperties['fontWeight'];
|
||||
/**
|
||||
* @desc 图标文字间距
|
||||
* @descEN Gap between icon and text
|
||||
*/
|
||||
iconGap: CSSProperties['gap'];
|
||||
/**
|
||||
* @desc 默认按钮阴影
|
||||
* @descEN Shadow of default button
|
||||
*/
|
||||
defaultShadow: string;
|
||||
/**
|
||||
* @desc 主要按钮阴影
|
||||
* @descEN Shadow of primary button
|
||||
*/
|
||||
primaryShadow: string;
|
||||
/**
|
||||
* @desc 危险按钮阴影
|
||||
* @descEN Shadow of danger button
|
||||
*/
|
||||
dangerShadow: string;
|
||||
/**
|
||||
* @desc 主要按钮文本颜色
|
||||
* @descEN Text color of primary button
|
||||
*/
|
||||
primaryColor: string;
|
||||
/**
|
||||
* @desc 默认按钮文本颜色
|
||||
* @descEN Text color of default button
|
||||
*/
|
||||
defaultColor: string;
|
||||
/**
|
||||
* @desc 默认按钮背景色
|
||||
* @descEN Background color of default button
|
||||
*/
|
||||
defaultBg: string;
|
||||
/**
|
||||
* @desc 默认按钮边框颜色
|
||||
* @descEN Border color of default button
|
||||
*/
|
||||
defaultBorderColor: string;
|
||||
/**
|
||||
* @desc 危险按钮文本颜色
|
||||
* @descEN Text color of danger button
|
||||
*/
|
||||
dangerColor: string;
|
||||
/**
|
||||
* @desc 默认按钮悬浮态背景色
|
||||
* @descEN Background color of default button when hover
|
||||
*/
|
||||
defaultHoverBg: string;
|
||||
/**
|
||||
* @desc 默认按钮悬浮态文本颜色
|
||||
* @descEN Text color of default button when hover
|
||||
*/
|
||||
defaultHoverColor: string;
|
||||
/**
|
||||
* @desc 默认按钮悬浮态边框颜色
|
||||
* @descEN Border color of default button
|
||||
*/
|
||||
defaultHoverBorderColor: string;
|
||||
/**
|
||||
* @desc 默认按钮激活态背景色
|
||||
* @descEN Background color of default button when active
|
||||
*/
|
||||
defaultActiveBg: string;
|
||||
/**
|
||||
* @desc 默认按钮激活态文字颜色
|
||||
* @descEN Text color of default button when active
|
||||
*/
|
||||
defaultActiveColor: string;
|
||||
/**
|
||||
* @desc 默认按钮激活态边框颜色
|
||||
* @descEN Border color of default button when active
|
||||
*/
|
||||
defaultActiveBorderColor: string;
|
||||
/**
|
||||
* @desc 禁用状态边框颜色
|
||||
* @descEN Border color of disabled button
|
||||
*/
|
||||
borderColorDisabled: string;
|
||||
/**
|
||||
* @desc 默认幽灵按钮文本颜色
|
||||
* @descEN Text color of default ghost button
|
||||
*/
|
||||
defaultGhostColor: string;
|
||||
/**
|
||||
* @desc 幽灵按钮背景色
|
||||
* @descEN Background color of ghost button
|
||||
*/
|
||||
ghostBg: string;
|
||||
/**
|
||||
* @desc 默认幽灵按钮边框颜色
|
||||
* @descEN Border color of default ghost button
|
||||
*/
|
||||
defaultGhostBorderColor: string;
|
||||
/**
|
||||
* @desc 主要填充按钮的浅色背景颜色
|
||||
* @descEN Background color of primary filled button
|
||||
*/
|
||||
/**
|
||||
* @desc 默认实心按钮的文本色
|
||||
* @descEN Default text color for solid buttons.
|
||||
*/
|
||||
solidTextColor: string;
|
||||
/**
|
||||
* @desc 默认文本按钮的文本色
|
||||
* @descEN Default text color for text buttons
|
||||
*/
|
||||
textTextColor: string;
|
||||
/**
|
||||
* @desc 默认文本按钮悬浮态文本颜色
|
||||
* @descEN Default text color for text buttons on hover
|
||||
*/
|
||||
textTextHoverColor: string;
|
||||
/**
|
||||
* @desc 默认文本按钮激活态文字颜色
|
||||
* @descEN Default text color for text buttons on active
|
||||
*/
|
||||
textTextActiveColor: string;
|
||||
/**
|
||||
* @desc 按钮横向内间距
|
||||
* @descEN Horizontal padding of button
|
||||
*/
|
||||
paddingInline: CSSProperties['paddingInline'];
|
||||
/**
|
||||
* @desc 大号按钮横向内间距
|
||||
* @descEN Horizontal padding of large button
|
||||
*/
|
||||
paddingInlineLG: CSSProperties['paddingInline'];
|
||||
/**
|
||||
* @desc 小号按钮横向内间距
|
||||
* @descEN Horizontal padding of small button
|
||||
*/
|
||||
paddingInlineSM: CSSProperties['paddingInline'];
|
||||
/**
|
||||
* @desc 按钮纵向内间距
|
||||
* @descEN Vertical padding of button
|
||||
*/
|
||||
paddingBlock: CSSProperties['paddingBlock'];
|
||||
/**
|
||||
* @desc 大号按钮纵向内间距
|
||||
* @descEN Vertical padding of large button
|
||||
*/
|
||||
paddingBlockLG: CSSProperties['paddingBlock'];
|
||||
/**
|
||||
* @desc 小号按钮纵向内间距
|
||||
* @descEN Vertical padding of small button
|
||||
*/
|
||||
paddingBlockSM: CSSProperties['paddingBlock'];
|
||||
/**
|
||||
* @desc 只有图标的按钮图标尺寸
|
||||
* @descEN Icon size of button which only contains icon
|
||||
*/
|
||||
onlyIconSize: number | string;
|
||||
/**
|
||||
* @desc 大号只有图标的按钮图标尺寸
|
||||
* @descEN Icon size of large button which only contains icon
|
||||
*/
|
||||
onlyIconSizeLG: number | string;
|
||||
/**
|
||||
* @desc 小号只有图标的按钮图标尺寸
|
||||
* @descEN Icon size of small button which only contains icon
|
||||
*/
|
||||
onlyIconSizeSM: number | string;
|
||||
/**
|
||||
* @desc 按钮组边框颜色
|
||||
* @descEN Border color of button group
|
||||
*/
|
||||
groupBorderColor: string;
|
||||
/**
|
||||
* @desc 链接按钮悬浮态背景色
|
||||
* @descEN Background color of link button when hover
|
||||
*/
|
||||
linkHoverBg: string;
|
||||
/**
|
||||
* @desc 文本按钮悬浮态背景色
|
||||
* @descEN Background color of text button when hover
|
||||
*/
|
||||
textHoverBg: string;
|
||||
/**
|
||||
* @desc 按钮内容字体大小
|
||||
* @descEN Font size of button content
|
||||
*/
|
||||
contentFontSize: number;
|
||||
/**
|
||||
* @desc 大号按钮内容字体大小
|
||||
* @descEN Font size of large button content
|
||||
*/
|
||||
contentFontSizeLG: number;
|
||||
/**
|
||||
* @desc 小号按钮内容字体大小
|
||||
* @descEN Font size of small button content
|
||||
*/
|
||||
contentFontSizeSM: number;
|
||||
/**
|
||||
* @desc 按钮内容字体行高
|
||||
* @descEN Line height of button content
|
||||
*/
|
||||
contentLineHeight: number;
|
||||
/**
|
||||
* @desc 大号按钮内容字体行高
|
||||
* @descEN Line height of large button content
|
||||
*/
|
||||
contentLineHeightLG: number;
|
||||
/**
|
||||
* @desc 小号按钮内容字体行高
|
||||
* @descEN Line height of small button content
|
||||
*/
|
||||
contentLineHeightSM: number;
|
||||
}
|
||||
type ShadowColorMap = {
|
||||
[Key in `${PresetColorKey}ShadowColor`]: string;
|
||||
};
|
||||
export interface ButtonToken extends FullToken<'Button'>, ShadowColorMap {
|
||||
/**
|
||||
* @desc 按钮横向内边距
|
||||
* @descEN Horizontal padding of button
|
||||
*/
|
||||
buttonPaddingHorizontal: CSSProperties['paddingInline'];
|
||||
/**
|
||||
* @desc 按钮纵向内边距
|
||||
* @descEN Vertical padding of button
|
||||
*/
|
||||
buttonPaddingVertical: CSSProperties['paddingBlock'];
|
||||
/**
|
||||
* @desc 只有图标的按钮图标尺寸
|
||||
* @descEN Icon size of button which only contains icon
|
||||
*/
|
||||
buttonIconOnlyFontSize: number | string;
|
||||
}
|
||||
export declare const prepareToken: (token: Parameters<GenStyleFn<'Button'>>[0]) => ButtonToken;
|
||||
export declare const prepareComponentToken: GetDefaultToken<'Button'>;
|
||||
export {};
|
||||
85
frontend/node_modules/antd/lib/button/style/token.js
generated
vendored
Normal file
85
frontend/node_modules/antd/lib/button/style/token.js
generated
vendored
Normal file
@@ -0,0 +1,85 @@
|
||||
"use strict";
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.prepareToken = exports.prepareComponentToken = void 0;
|
||||
var _cssinjs = require("@ant-design/cssinjs");
|
||||
var _color = require("../../color-picker/color");
|
||||
var _ColorPresets = require("../../color-picker/components/ColorPresets");
|
||||
var _internal = require("../../theme/internal");
|
||||
var _interface = require("../../theme/interface");
|
||||
var _getAlphaColor = _interopRequireDefault(require("../../theme/util/getAlphaColor"));
|
||||
const prepareToken = token => {
|
||||
const {
|
||||
paddingInline,
|
||||
onlyIconSize
|
||||
} = token;
|
||||
const buttonToken = (0, _internal.mergeToken)(token, {
|
||||
buttonPaddingHorizontal: paddingInline,
|
||||
buttonPaddingVertical: 0,
|
||||
buttonIconOnlyFontSize: onlyIconSize
|
||||
});
|
||||
return buttonToken;
|
||||
};
|
||||
exports.prepareToken = prepareToken;
|
||||
const prepareComponentToken = token => {
|
||||
var _a, _b, _c, _d, _e, _f;
|
||||
const contentFontSize = (_a = token.contentFontSize) !== null && _a !== void 0 ? _a : token.fontSize;
|
||||
const contentFontSizeSM = (_b = token.contentFontSizeSM) !== null && _b !== void 0 ? _b : token.fontSize;
|
||||
const contentFontSizeLG = (_c = token.contentFontSizeLG) !== null && _c !== void 0 ? _c : token.fontSizeLG;
|
||||
const contentLineHeight = (_d = token.contentLineHeight) !== null && _d !== void 0 ? _d : (0, _internal.getLineHeight)(contentFontSize);
|
||||
const contentLineHeightSM = (_e = token.contentLineHeightSM) !== null && _e !== void 0 ? _e : (0, _internal.getLineHeight)(contentFontSizeSM);
|
||||
const contentLineHeightLG = (_f = token.contentLineHeightLG) !== null && _f !== void 0 ? _f : (0, _internal.getLineHeight)(contentFontSizeLG);
|
||||
const solidTextColor = (0, _ColorPresets.isBright)(new _color.AggregationColor(token.colorBgSolid), '#fff') ? '#000' : '#fff';
|
||||
const shadowColorTokens = _interface.PresetColors.reduce((prev, colorKey) => Object.assign(Object.assign({}, prev), {
|
||||
[`${colorKey}ShadowColor`]: `0 ${(0, _cssinjs.unit)(token.controlOutlineWidth)} 0 ${(0, _getAlphaColor.default)(token[`${colorKey}1`], token.colorBgContainer)}`
|
||||
}), {});
|
||||
return Object.assign(Object.assign({}, shadowColorTokens), {
|
||||
fontWeight: 400,
|
||||
iconGap: token.marginXS,
|
||||
defaultShadow: `0 ${token.controlOutlineWidth}px 0 ${token.controlTmpOutline}`,
|
||||
primaryShadow: `0 ${token.controlOutlineWidth}px 0 ${token.controlOutline}`,
|
||||
dangerShadow: `0 ${token.controlOutlineWidth}px 0 ${token.colorErrorOutline}`,
|
||||
primaryColor: token.colorTextLightSolid,
|
||||
dangerColor: token.colorTextLightSolid,
|
||||
borderColorDisabled: token.colorBorder,
|
||||
defaultGhostColor: token.colorBgContainer,
|
||||
ghostBg: 'transparent',
|
||||
defaultGhostBorderColor: token.colorBgContainer,
|
||||
paddingInline: token.paddingContentHorizontal - token.lineWidth,
|
||||
paddingInlineLG: token.paddingContentHorizontal - token.lineWidth,
|
||||
paddingInlineSM: 8 - token.lineWidth,
|
||||
onlyIconSize: 'inherit',
|
||||
onlyIconSizeSM: 'inherit',
|
||||
onlyIconSizeLG: 'inherit',
|
||||
groupBorderColor: token.colorPrimaryHover,
|
||||
linkHoverBg: 'transparent',
|
||||
textTextColor: token.colorText,
|
||||
textTextHoverColor: token.colorText,
|
||||
textTextActiveColor: token.colorText,
|
||||
textHoverBg: token.colorFillTertiary,
|
||||
defaultColor: token.colorText,
|
||||
defaultBg: token.colorBgContainer,
|
||||
defaultBorderColor: token.colorBorder,
|
||||
defaultBorderColorDisabled: token.colorBorder,
|
||||
defaultHoverBg: token.colorBgContainer,
|
||||
defaultHoverColor: token.colorPrimaryHover,
|
||||
defaultHoverBorderColor: token.colorPrimaryHover,
|
||||
defaultActiveBg: token.colorBgContainer,
|
||||
defaultActiveColor: token.colorPrimaryActive,
|
||||
defaultActiveBorderColor: token.colorPrimaryActive,
|
||||
solidTextColor,
|
||||
contentFontSize,
|
||||
contentFontSizeSM,
|
||||
contentFontSizeLG,
|
||||
contentLineHeight,
|
||||
contentLineHeightSM,
|
||||
contentLineHeightLG,
|
||||
paddingBlock: Math.max((token.controlHeight - contentFontSize * contentLineHeight) / 2 - token.lineWidth, 0),
|
||||
paddingBlockSM: Math.max((token.controlHeightSM - contentFontSizeSM * contentLineHeightSM) / 2 - token.lineWidth, 0),
|
||||
paddingBlockLG: Math.max((token.controlHeightLG - contentFontSizeLG * contentLineHeightLG) / 2 - token.lineWidth, 0)
|
||||
});
|
||||
};
|
||||
exports.prepareComponentToken = prepareComponentToken;
|
||||
Reference in New Issue
Block a user