add all frontend files

This commit is contained in:
2026-01-17 15:16:36 -05:00
parent ff16ae7858
commit e40287e4aa
25704 changed files with 1935289 additions and 0 deletions

16
node_modules/antd/es/badge/Ribbon.d.ts generated vendored Normal file
View File

@@ -0,0 +1,16 @@
import * as React from 'react';
import type { PresetColorType } from '../_util/colors';
import type { LiteralUnion } from '../_util/type';
type RibbonPlacement = 'start' | 'end';
export interface RibbonProps {
className?: string;
prefixCls?: string;
style?: React.CSSProperties;
text?: React.ReactNode;
color?: LiteralUnion<PresetColorType>;
children?: React.ReactNode;
placement?: RibbonPlacement;
rootClassName?: string;
}
declare const Ribbon: React.FC<RibbonProps>;
export default Ribbon;

52
node_modules/antd/es/badge/Ribbon.js generated vendored Normal file
View File

@@ -0,0 +1,52 @@
"use client";
import * as React from 'react';
import classNames from 'classnames';
import { isPresetColor } from '../_util/colors';
import { ConfigContext } from '../config-provider';
import useStyle from './style/ribbon';
const Ribbon = props => {
const {
className,
prefixCls: customizePrefixCls,
style,
color,
children,
text,
placement = 'end',
rootClassName
} = props;
const {
getPrefixCls,
direction
} = React.useContext(ConfigContext);
const prefixCls = getPrefixCls('ribbon', customizePrefixCls);
const wrapperCls = `${prefixCls}-wrapper`;
const [wrapCSSVar, hashId, cssVarCls] = useStyle(prefixCls, wrapperCls);
const colorInPreset = isPresetColor(color, false);
const ribbonCls = classNames(prefixCls, `${prefixCls}-placement-${placement}`, {
[`${prefixCls}-rtl`]: direction === 'rtl',
[`${prefixCls}-color-${color}`]: colorInPreset
}, className);
const colorStyle = {};
const cornerColorStyle = {};
if (color && !colorInPreset) {
colorStyle.background = color;
cornerColorStyle.color = color;
}
return wrapCSSVar(/*#__PURE__*/React.createElement("div", {
className: classNames(wrapperCls, rootClassName, hashId, cssVarCls)
}, children, /*#__PURE__*/React.createElement("div", {
className: classNames(ribbonCls, hashId),
style: Object.assign(Object.assign({}, colorStyle), style)
}, /*#__PURE__*/React.createElement("span", {
className: `${prefixCls}-text`
}, text), /*#__PURE__*/React.createElement("div", {
className: `${prefixCls}-corner`,
style: cornerColorStyle
}))));
};
if (process.env.NODE_ENV !== 'production') {
Ribbon.displayName = 'Ribbon';
}
export default Ribbon;

18
node_modules/antd/es/badge/ScrollNumber.d.ts generated vendored Normal file
View File

@@ -0,0 +1,18 @@
import * as React from 'react';
export interface ScrollNumberProps {
prefixCls?: string;
className?: string;
motionClassName?: string;
count?: string | number | null;
children?: React.ReactElement;
component?: React.ComponentType<any>;
style?: React.CSSProperties;
title?: string | number | null;
show: boolean;
}
export interface ScrollNumberState {
animateStarted?: boolean;
count?: string | number | null;
}
declare const ScrollNumber: React.ForwardRefExoticComponent<ScrollNumberProps & React.RefAttributes<HTMLElement>>;
export default ScrollNumber;

69
node_modules/antd/es/badge/ScrollNumber.js generated vendored Normal file
View File

@@ -0,0 +1,69 @@
"use client";
var __rest = this && this.__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;
};
import * as React from 'react';
import classNames from 'classnames';
import { cloneElement } from '../_util/reactNode';
import { ConfigContext } from '../config-provider';
import SingleNumber from './SingleNumber';
const ScrollNumber = /*#__PURE__*/React.forwardRef((props, ref) => {
const {
prefixCls: customizePrefixCls,
count,
className,
motionClassName,
style,
title,
show,
component: Component = 'sup',
children
} = props,
restProps = __rest(props, ["prefixCls", "count", "className", "motionClassName", "style", "title", "show", "component", "children"]);
const {
getPrefixCls
} = React.useContext(ConfigContext);
const prefixCls = getPrefixCls('scroll-number', customizePrefixCls);
// ============================ Render ============================
const newProps = Object.assign(Object.assign({}, restProps), {
'data-show': show,
style,
className: classNames(prefixCls, className, motionClassName),
title: title
});
// Only integer need motion
let numberNodes = count;
if (count && Number(count) % 1 === 0) {
const numberList = String(count).split('');
numberNodes = /*#__PURE__*/React.createElement("bdi", null, numberList.map((num, i) => (/*#__PURE__*/React.createElement(SingleNumber, {
prefixCls: prefixCls,
count: Number(count),
value: num,
// eslint-disable-next-line react/no-array-index-key
key: numberList.length - i
}))));
}
// allow specify the border
// mock border-color by box-shadow for compatible with old usage:
// <Badge count={4} style={{ backgroundColor: '#fff', color: '#999', borderColor: '#d9d9d9' }} />
if (style === null || style === void 0 ? void 0 : style.borderColor) {
newProps.style = Object.assign(Object.assign({}, style), {
boxShadow: `0 0 0 1px ${style.borderColor} inset`
});
}
if (children) {
return cloneElement(children, oriProps => ({
className: classNames(`${prefixCls}-custom-component`, oriProps === null || oriProps === void 0 ? void 0 : oriProps.className, motionClassName)
}));
}
return /*#__PURE__*/React.createElement(Component, Object.assign({}, newProps, {
ref: ref
}), numberNodes);
});
export default ScrollNumber;

14
node_modules/antd/es/badge/SingleNumber.d.ts generated vendored Normal file
View File

@@ -0,0 +1,14 @@
import * as React from 'react';
export interface UnitNumberProps {
prefixCls: string;
value: string | number;
offset?: number;
current?: boolean;
}
export interface SingleNumberProps {
prefixCls: string;
value: string;
count: number;
}
declare const SingleNumber: React.FC<Readonly<SingleNumberProps>>;
export default SingleNumber;

102
node_modules/antd/es/badge/SingleNumber.js generated vendored Normal file
View File

@@ -0,0 +1,102 @@
"use client";
import * as React from 'react';
import classNames from 'classnames';
const UnitNumber = props => {
const {
prefixCls,
value,
current,
offset = 0
} = props;
let style;
if (offset) {
style = {
position: 'absolute',
top: `${offset}00%`,
left: 0
};
}
return /*#__PURE__*/React.createElement("span", {
style: style,
className: classNames(`${prefixCls}-only-unit`, {
current
})
}, value);
};
function getOffset(start, end, unit) {
let index = start;
let offset = 0;
while ((index + 10) % 10 !== end) {
index += unit;
offset += unit;
}
return offset;
}
const SingleNumber = props => {
const {
prefixCls,
count: originCount,
value: originValue
} = props;
const value = Number(originValue);
const count = Math.abs(originCount);
const [prevValue, setPrevValue] = React.useState(value);
const [prevCount, setPrevCount] = React.useState(count);
// ============================= Events =============================
const onTransitionEnd = () => {
setPrevValue(value);
setPrevCount(count);
};
// Fallback if transition events are not supported
React.useEffect(() => {
const timer = setTimeout(onTransitionEnd, 1000);
return () => clearTimeout(timer);
}, [value]);
// ============================= Render =============================
// Render unit list
let unitNodes;
let offsetStyle;
if (prevValue === value || Number.isNaN(value) || Number.isNaN(prevValue)) {
// Nothing to change
unitNodes = [/*#__PURE__*/React.createElement(UnitNumber, Object.assign({}, props, {
key: value,
current: true
}))];
offsetStyle = {
transition: 'none'
};
} else {
unitNodes = [];
// Fill basic number units
const end = value + 10;
const unitNumberList = [];
for (let index = value; index <= end; index += 1) {
unitNumberList.push(index);
}
const unit = prevCount < count ? 1 : -1;
// Fill with number unit nodes
const prevIndex = unitNumberList.findIndex(n => n % 10 === prevValue);
// Cut list
const cutUnitNumberList = unit < 0 ? unitNumberList.slice(0, prevIndex + 1) : unitNumberList.slice(prevIndex);
unitNodes = cutUnitNumberList.map((n, index) => {
const singleUnit = n % 10;
return /*#__PURE__*/React.createElement(UnitNumber, Object.assign({}, props, {
key: n,
value: singleUnit,
offset: unit < 0 ? index - prevIndex : index,
current: index === prevIndex
}));
});
// Calculate container offset value
offsetStyle = {
transform: `translateY(${-getOffset(prevValue, value, unit)}00%)`
};
}
return /*#__PURE__*/React.createElement("span", {
className: `${prefixCls}-only`,
style: offsetStyle,
onTransitionEnd: onTransitionEnd
}, unitNodes);
};
export default SingleNumber;

36
node_modules/antd/es/badge/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,36 @@
import * as React from 'react';
import type { PresetStatusColorType } from '../_util/colors';
import type { LiteralUnion } from '../_util/type';
import type { PresetColorKey } from '../theme/internal';
import Ribbon from './Ribbon';
export type { ScrollNumberProps } from './ScrollNumber';
type SemanticName = 'root' | 'indicator';
export interface BadgeProps extends React.HTMLAttributes<HTMLSpanElement> {
/** Number to show in badge */
count?: React.ReactNode;
showZero?: boolean;
/** Max count to show */
overflowCount?: number;
/** Whether to show red dot without number */
dot?: boolean;
style?: React.CSSProperties;
prefixCls?: string;
scrollNumberPrefixCls?: string;
className?: string;
rootClassName?: string;
status?: PresetStatusColorType;
color?: LiteralUnion<PresetColorKey>;
text?: React.ReactNode;
size?: 'default' | 'small';
offset?: [number | string, number | string];
title?: string;
children?: React.ReactNode;
classNames?: Partial<Record<SemanticName, string>>;
styles?: Partial<Record<SemanticName, React.CSSProperties>>;
}
declare const InternalBadge: React.ForwardRefExoticComponent<BadgeProps & React.RefAttributes<HTMLSpanElement>>;
type CompoundedComponent = typeof InternalBadge & {
Ribbon: typeof Ribbon;
};
declare const Badge: CompoundedComponent;
export default Badge;

187
node_modules/antd/es/badge/index.js generated vendored Normal file
View File

@@ -0,0 +1,187 @@
"use client";
var __rest = this && this.__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;
};
import * as React from 'react';
import { useMemo, useRef } from 'react';
import classnames from 'classnames';
import CSSMotion from 'rc-motion';
import { isPresetColor } from '../_util/colors';
import { cloneElement } from '../_util/reactNode';
import { ConfigContext } from '../config-provider';
import Ribbon from './Ribbon';
import ScrollNumber from './ScrollNumber';
import useStyle from './style';
const InternalBadge = /*#__PURE__*/React.forwardRef((props, ref) => {
var _a, _b, _c, _d, _e;
const {
prefixCls: customizePrefixCls,
scrollNumberPrefixCls: customizeScrollNumberPrefixCls,
children,
status,
text,
color,
count = null,
overflowCount = 99,
dot = false,
size = 'default',
title,
offset,
style,
className,
rootClassName,
classNames,
styles,
showZero = false
} = props,
restProps = __rest(props, ["prefixCls", "scrollNumberPrefixCls", "children", "status", "text", "color", "count", "overflowCount", "dot", "size", "title", "offset", "style", "className", "rootClassName", "classNames", "styles", "showZero"]);
const {
getPrefixCls,
direction,
badge
} = React.useContext(ConfigContext);
const prefixCls = getPrefixCls('badge', customizePrefixCls);
const [wrapCSSVar, hashId, cssVarCls] = useStyle(prefixCls);
// ================================ Misc ================================
const numberedDisplayCount = count > overflowCount ? `${overflowCount}+` : count;
const isZero = numberedDisplayCount === '0' || numberedDisplayCount === 0 || text === '0' || text === 0;
const ignoreCount = count === null || isZero && !showZero;
const hasStatus = (status !== null && status !== undefined || color !== null && color !== undefined) && ignoreCount;
const hasStatusValue = status !== null && status !== undefined || !isZero;
const showAsDot = dot && !isZero;
const mergedCount = showAsDot ? '' : numberedDisplayCount;
const isHidden = useMemo(() => {
const isEmpty = (mergedCount === null || mergedCount === undefined || mergedCount === '') && (text === undefined || text === null || text === '');
return (isEmpty || isZero && !showZero) && !showAsDot;
}, [mergedCount, isZero, showZero, showAsDot, text]);
// Count should be cache in case hidden change it
const countRef = useRef(count);
if (!isHidden) {
countRef.current = count;
}
const livingCount = countRef.current;
// We need cache count since remove motion should not change count display
const displayCountRef = useRef(mergedCount);
if (!isHidden) {
displayCountRef.current = mergedCount;
}
const displayCount = displayCountRef.current;
// We will cache the dot status to avoid shaking on leaved motion
const isDotRef = useRef(showAsDot);
if (!isHidden) {
isDotRef.current = showAsDot;
}
// =============================== Styles ===============================
const mergedStyle = useMemo(() => {
if (!offset) {
return Object.assign(Object.assign({}, badge === null || badge === void 0 ? void 0 : badge.style), style);
}
const offsetStyle = {
marginTop: offset[1]
};
if (direction === 'rtl') {
offsetStyle.left = Number.parseInt(offset[0], 10);
} else {
offsetStyle.right = -Number.parseInt(offset[0], 10);
}
return Object.assign(Object.assign(Object.assign({}, offsetStyle), badge === null || badge === void 0 ? void 0 : badge.style), style);
}, [direction, offset, style, badge === null || badge === void 0 ? void 0 : badge.style]);
// =============================== Render ===============================
// >>> Title
const titleNode = title !== null && title !== void 0 ? title : typeof livingCount === 'string' || typeof livingCount === 'number' ? livingCount : undefined;
// >>> Status Text
const showStatusTextNode = !isHidden && (text === 0 ? showZero : !!text && text !== true);
const statusTextNode = !showStatusTextNode ? null : (/*#__PURE__*/React.createElement("span", {
className: `${prefixCls}-status-text`
}, text));
// >>> Display Component
const displayNode = !livingCount || typeof livingCount !== 'object' ? undefined : cloneElement(livingCount, oriProps => ({
style: Object.assign(Object.assign({}, mergedStyle), oriProps.style)
}));
// InternalColor
const isInternalColor = isPresetColor(color, false);
// Shared styles
const statusCls = classnames(classNames === null || classNames === void 0 ? void 0 : classNames.indicator, (_a = badge === null || badge === void 0 ? void 0 : badge.classNames) === null || _a === void 0 ? void 0 : _a.indicator, {
[`${prefixCls}-status-dot`]: hasStatus,
[`${prefixCls}-status-${status}`]: !!status,
[`${prefixCls}-color-${color}`]: isInternalColor
});
const statusStyle = {};
if (color && !isInternalColor) {
statusStyle.color = color;
statusStyle.background = color;
}
const badgeClassName = classnames(prefixCls, {
[`${prefixCls}-status`]: hasStatus,
[`${prefixCls}-not-a-wrapper`]: !children,
[`${prefixCls}-rtl`]: direction === 'rtl'
}, className, rootClassName, badge === null || badge === void 0 ? void 0 : badge.className, (_b = badge === null || badge === void 0 ? void 0 : badge.classNames) === null || _b === void 0 ? void 0 : _b.root, classNames === null || classNames === void 0 ? void 0 : classNames.root, hashId, cssVarCls);
// <Badge status="success" />
if (!children && hasStatus && (text || hasStatusValue || !ignoreCount)) {
const statusTextColor = mergedStyle.color;
return wrapCSSVar(/*#__PURE__*/React.createElement("span", Object.assign({}, restProps, {
className: badgeClassName,
style: Object.assign(Object.assign(Object.assign({}, styles === null || styles === void 0 ? void 0 : styles.root), (_c = badge === null || badge === void 0 ? void 0 : badge.styles) === null || _c === void 0 ? void 0 : _c.root), mergedStyle)
}), /*#__PURE__*/React.createElement("span", {
className: statusCls,
style: Object.assign(Object.assign(Object.assign({}, styles === null || styles === void 0 ? void 0 : styles.indicator), (_d = badge === null || badge === void 0 ? void 0 : badge.styles) === null || _d === void 0 ? void 0 : _d.indicator), statusStyle)
}), showStatusTextNode && (/*#__PURE__*/React.createElement("span", {
style: {
color: statusTextColor
},
className: `${prefixCls}-status-text`
}, text))));
}
return wrapCSSVar(/*#__PURE__*/React.createElement("span", Object.assign({
ref: ref
}, restProps, {
className: badgeClassName,
style: Object.assign(Object.assign({}, (_e = badge === null || badge === void 0 ? void 0 : badge.styles) === null || _e === void 0 ? void 0 : _e.root), styles === null || styles === void 0 ? void 0 : styles.root)
}), children, /*#__PURE__*/React.createElement(CSSMotion, {
visible: !isHidden,
motionName: `${prefixCls}-zoom`,
motionAppear: false,
motionDeadline: 1000
}, ({
className: motionClassName
}) => {
var _a, _b;
const scrollNumberPrefixCls = getPrefixCls('scroll-number', customizeScrollNumberPrefixCls);
const isDot = isDotRef.current;
const scrollNumberCls = classnames(classNames === null || classNames === void 0 ? void 0 : classNames.indicator, (_a = badge === null || badge === void 0 ? void 0 : badge.classNames) === null || _a === void 0 ? void 0 : _a.indicator, {
[`${prefixCls}-dot`]: isDot,
[`${prefixCls}-count`]: !isDot,
[`${prefixCls}-count-sm`]: size === 'small',
[`${prefixCls}-multiple-words`]: !isDot && displayCount && displayCount.toString().length > 1,
[`${prefixCls}-status-${status}`]: !!status,
[`${prefixCls}-color-${color}`]: isInternalColor
});
let scrollNumberStyle = Object.assign(Object.assign(Object.assign({}, styles === null || styles === void 0 ? void 0 : styles.indicator), (_b = badge === null || badge === void 0 ? void 0 : badge.styles) === null || _b === void 0 ? void 0 : _b.indicator), mergedStyle);
if (color && !isInternalColor) {
scrollNumberStyle = scrollNumberStyle || {};
scrollNumberStyle.background = color;
}
return /*#__PURE__*/React.createElement(ScrollNumber, {
prefixCls: scrollNumberPrefixCls,
show: !isHidden,
motionClassName: motionClassName,
className: scrollNumberCls,
count: displayCount,
title: titleNode,
style: scrollNumberStyle,
key: "scrollNumber"
}, displayNode);
}), statusTextNode));
});
const Badge = InternalBadge;
Badge.Ribbon = Ribbon;
if (process.env.NODE_ENV !== 'production') {
Badge.displayName = 'Badge';
}
export default Badge;

104
node_modules/antd/es/badge/style/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,104 @@
import type { FullToken, GenStyleFn, GetDefaultToken } from '../../theme/internal';
/** Component only token. Which will handle additional calculation of alias token */
export interface ComponentToken {
/**
* @desc 徽标 z-index
* @descEN z-index of badge
*/
indicatorZIndex: number | string;
/**
* @desc 徽标高度
* @descEN Height of badge
*/
indicatorHeight: number | string;
/**
* @desc 小号徽标高度
* @descEN Height of small badge
*/
indicatorHeightSM: number | string;
/**
* @desc 点状徽标尺寸
* @descEN Size of dot badge
*/
dotSize: number;
/**
* @desc 徽标文本尺寸
* @descEN Font size of badge text
*/
textFontSize: number;
/**
* @desc 小号徽标文本尺寸
* @descEN Font size of small badge text
*/
textFontSizeSM: number;
/**
* @desc 徽标文本粗细
* @descEN Font weight of badge text
*/
textFontWeight: number | string;
/**
* @desc 状态徽标尺寸
* @descEN Size of status badge
*/
statusSize: number;
}
/**
* @desc Badge 组件的 Token
* @descEN Token for Badge component
*/
export interface BadgeToken extends FullToken<'Badge'> {
/**
* @desc 徽标字体高度
* @descEN Font height of badge
*/
badgeFontHeight: number;
/**
* @desc 徽标文本颜色
* @descEN Text color of badge
*/
badgeTextColor: string;
/**
* @desc 徽标颜色
* @descEN Color of badge
*/
badgeColor: string;
/**
* @desc 徽标悬停颜色
* @descEN Hover color of badge
*/
badgeColorHover: string;
/**
* @desc 徽标阴影尺寸
* @descEN Shadow size of badge
*/
badgeShadowSize: number;
/**
* @desc 徽标阴影颜色
* @descEN Shadow color of badge
*/
badgeShadowColor: string;
/**
* @desc 徽标处理持续时间
* @descEN Processing duration of badge
*/
badgeProcessingDuration: string;
/**
* @desc 徽标丝带偏移量
* @descEN Ribbon offset of badge
*/
badgeRibbonOffset: number;
/**
* @desc 徽标丝带角变换
* @descEN Ribbon corner transform of badge
*/
badgeRibbonCornerTransform: string;
/**
* @desc 徽标丝带角滤镜
* @descEN Ribbon corner filter of badge
*/
badgeRibbonCornerFilter: string;
}
export declare const prepareToken: (token: Parameters<GenStyleFn<'Badge'>>[0]) => BadgeToken;
export declare const prepareComponentToken: GetDefaultToken<'Badge'>;
declare const _default: (prefixCls: string, rootCls?: string) => readonly [(node: React.ReactElement) => React.ReactElement, string, string];
export default _default;

326
node_modules/antd/es/badge/style/index.js generated vendored Normal file
View File

@@ -0,0 +1,326 @@
import { Keyframes, unit } from '@ant-design/cssinjs';
import { resetComponent } from '../../style';
import { genPresetColor, genStyleHooks, mergeToken } from '../../theme/internal';
const antStatusProcessing = new Keyframes('antStatusProcessing', {
'0%': {
transform: 'scale(0.8)',
opacity: 0.5
},
'100%': {
transform: 'scale(2.4)',
opacity: 0
}
});
const antZoomBadgeIn = new Keyframes('antZoomBadgeIn', {
'0%': {
transform: 'scale(0) translate(50%, -50%)',
opacity: 0
},
'100%': {
transform: 'scale(1) translate(50%, -50%)'
}
});
const antZoomBadgeOut = new Keyframes('antZoomBadgeOut', {
'0%': {
transform: 'scale(1) translate(50%, -50%)'
},
'100%': {
transform: 'scale(0) translate(50%, -50%)',
opacity: 0
}
});
const antNoWrapperZoomBadgeIn = new Keyframes('antNoWrapperZoomBadgeIn', {
'0%': {
transform: 'scale(0)',
opacity: 0
},
'100%': {
transform: 'scale(1)'
}
});
const antNoWrapperZoomBadgeOut = new Keyframes('antNoWrapperZoomBadgeOut', {
'0%': {
transform: 'scale(1)'
},
'100%': {
transform: 'scale(0)',
opacity: 0
}
});
const antBadgeLoadingCircle = new Keyframes('antBadgeLoadingCircle', {
'0%': {
transformOrigin: '50%'
},
'100%': {
transform: 'translate(50%, -50%) rotate(360deg)',
transformOrigin: '50%'
}
});
const genSharedBadgeStyle = token => {
const {
componentCls,
iconCls,
antCls,
badgeShadowSize,
textFontSize,
textFontSizeSM,
statusSize,
dotSize,
textFontWeight,
indicatorHeight,
indicatorHeightSM,
marginXS,
calc
} = token;
const numberPrefixCls = `${antCls}-scroll-number`;
const colorPreset = genPresetColor(token, (colorKey, {
darkColor
}) => ({
[`&${componentCls} ${componentCls}-color-${colorKey}`]: {
background: darkColor,
[`&:not(${componentCls}-count)`]: {
color: darkColor
},
'a:hover &': {
background: darkColor
}
}
}));
return {
[componentCls]: Object.assign(Object.assign(Object.assign(Object.assign({}, resetComponent(token)), {
position: 'relative',
display: 'inline-block',
width: 'fit-content',
lineHeight: 1,
[`${componentCls}-count`]: {
display: 'inline-flex',
justifyContent: 'center',
zIndex: token.indicatorZIndex,
minWidth: indicatorHeight,
height: indicatorHeight,
color: token.badgeTextColor,
fontWeight: textFontWeight,
fontSize: textFontSize,
lineHeight: unit(indicatorHeight),
whiteSpace: 'nowrap',
textAlign: 'center',
background: token.badgeColor,
borderRadius: calc(indicatorHeight).div(2).equal(),
boxShadow: `0 0 0 ${unit(badgeShadowSize)} ${token.badgeShadowColor}`,
transition: `background ${token.motionDurationMid}`,
a: {
color: token.badgeTextColor
},
'a:hover': {
color: token.badgeTextColor
},
'a:hover &': {
background: token.badgeColorHover
}
},
[`${componentCls}-count-sm`]: {
minWidth: indicatorHeightSM,
height: indicatorHeightSM,
fontSize: textFontSizeSM,
lineHeight: unit(indicatorHeightSM),
borderRadius: calc(indicatorHeightSM).div(2).equal()
},
[`${componentCls}-multiple-words`]: {
padding: `0 ${unit(token.paddingXS)}`,
bdi: {
unicodeBidi: 'plaintext'
}
},
[`${componentCls}-dot`]: {
zIndex: token.indicatorZIndex,
width: dotSize,
minWidth: dotSize,
height: dotSize,
background: token.badgeColor,
borderRadius: '100%',
boxShadow: `0 0 0 ${unit(badgeShadowSize)} ${token.badgeShadowColor}`
},
[`${componentCls}-count, ${componentCls}-dot, ${numberPrefixCls}-custom-component`]: {
position: 'absolute',
top: 0,
insetInlineEnd: 0,
transform: 'translate(50%, -50%)',
transformOrigin: '100% 0%',
[`&${iconCls}-spin`]: {
animationName: antBadgeLoadingCircle,
animationDuration: '1s',
animationIterationCount: 'infinite',
animationTimingFunction: 'linear'
}
},
[`&${componentCls}-status`]: {
lineHeight: 'inherit',
verticalAlign: 'baseline',
[`${componentCls}-status-dot`]: {
position: 'relative',
top: -1,
// Magic number, but seems better experience
display: 'inline-block',
width: statusSize,
height: statusSize,
verticalAlign: 'middle',
borderRadius: '50%'
},
[`${componentCls}-status-success`]: {
backgroundColor: token.colorSuccess
},
[`${componentCls}-status-processing`]: {
overflow: 'visible',
color: token.colorInfo,
backgroundColor: token.colorInfo,
borderColor: 'currentcolor',
'&::after': {
position: 'absolute',
top: 0,
insetInlineStart: 0,
width: '100%',
height: '100%',
borderWidth: badgeShadowSize,
borderStyle: 'solid',
borderColor: 'inherit',
borderRadius: '50%',
animationName: antStatusProcessing,
animationDuration: token.badgeProcessingDuration,
animationIterationCount: 'infinite',
animationTimingFunction: 'ease-in-out',
content: '""'
}
},
[`${componentCls}-status-default`]: {
backgroundColor: token.colorTextPlaceholder
},
[`${componentCls}-status-error`]: {
backgroundColor: token.colorError
},
[`${componentCls}-status-warning`]: {
backgroundColor: token.colorWarning
},
[`${componentCls}-status-text`]: {
marginInlineStart: marginXS,
color: token.colorText,
fontSize: token.fontSize
}
}
}), colorPreset), {
[`${componentCls}-zoom-appear, ${componentCls}-zoom-enter`]: {
animationName: antZoomBadgeIn,
animationDuration: token.motionDurationSlow,
animationTimingFunction: token.motionEaseOutBack,
animationFillMode: 'both'
},
[`${componentCls}-zoom-leave`]: {
animationName: antZoomBadgeOut,
animationDuration: token.motionDurationSlow,
animationTimingFunction: token.motionEaseOutBack,
animationFillMode: 'both'
},
[`&${componentCls}-not-a-wrapper`]: {
[`${componentCls}-zoom-appear, ${componentCls}-zoom-enter`]: {
animationName: antNoWrapperZoomBadgeIn,
animationDuration: token.motionDurationSlow,
animationTimingFunction: token.motionEaseOutBack
},
[`${componentCls}-zoom-leave`]: {
animationName: antNoWrapperZoomBadgeOut,
animationDuration: token.motionDurationSlow,
animationTimingFunction: token.motionEaseOutBack
},
[`&:not(${componentCls}-status)`]: {
verticalAlign: 'middle'
},
[`${numberPrefixCls}-custom-component, ${componentCls}-count`]: {
transform: 'none'
},
[`${numberPrefixCls}-custom-component, ${numberPrefixCls}`]: {
position: 'relative',
top: 'auto',
display: 'block',
transformOrigin: '50% 50%'
}
},
[numberPrefixCls]: {
overflow: 'hidden',
transition: `all ${token.motionDurationMid} ${token.motionEaseOutBack}`,
[`${numberPrefixCls}-only`]: {
position: 'relative',
display: 'inline-block',
height: indicatorHeight,
transition: `all ${token.motionDurationSlow} ${token.motionEaseOutBack}`,
WebkitTransformStyle: 'preserve-3d',
WebkitBackfaceVisibility: 'hidden',
[`> p${numberPrefixCls}-only-unit`]: {
height: indicatorHeight,
margin: 0,
WebkitTransformStyle: 'preserve-3d',
WebkitBackfaceVisibility: 'hidden'
}
},
[`${numberPrefixCls}-symbol`]: {
verticalAlign: 'top'
}
},
// ====================== RTL =======================
'&-rtl': {
direction: 'rtl',
[`${componentCls}-count, ${componentCls}-dot, ${numberPrefixCls}-custom-component`]: {
transform: 'translate(-50%, -50%)'
}
}
})
};
};
// ============================== Export ==============================
export const prepareToken = token => {
const {
fontHeight,
lineWidth,
marginXS,
colorBorderBg
} = token;
const badgeFontHeight = fontHeight;
const badgeShadowSize = lineWidth;
const badgeTextColor = token.colorTextLightSolid;
const badgeColor = token.colorError;
const badgeColorHover = token.colorErrorHover;
const badgeToken = mergeToken(token, {
badgeFontHeight,
badgeShadowSize,
badgeTextColor,
badgeColor,
badgeColorHover,
badgeShadowColor: colorBorderBg,
badgeProcessingDuration: '1.2s',
badgeRibbonOffset: marginXS,
// Follow token just by Design. Not related with token
badgeRibbonCornerTransform: 'scaleY(0.75)',
badgeRibbonCornerFilter: `brightness(75%)`
});
return badgeToken;
};
export const prepareComponentToken = token => {
const {
fontSize,
lineHeight,
fontSizeSM,
lineWidth
} = token;
return {
indicatorZIndex: 'auto',
indicatorHeight: Math.round(fontSize * lineHeight) - 2 * lineWidth,
indicatorHeightSM: fontSize,
dotSize: fontSizeSM / 2,
textFontSize: fontSizeSM,
textFontSizeSM: fontSizeSM,
textFontWeight: 'normal',
statusSize: fontSizeSM / 2
};
};
export default genStyleHooks('Badge', token => {
const badgeToken = prepareToken(token);
return genSharedBadgeStyle(badgeToken);
}, prepareComponentToken);

2
node_modules/antd/es/badge/style/ribbon.d.ts generated vendored Normal file
View File

@@ -0,0 +1,2 @@
declare const _default: (prefixCls: string, rootCls?: string) => readonly [(node: React.ReactElement) => React.ReactElement, string, string];
export default _default;

81
node_modules/antd/es/badge/style/ribbon.js generated vendored Normal file
View File

@@ -0,0 +1,81 @@
import { unit } from '@ant-design/cssinjs';
import { prepareComponentToken, prepareToken } from '.';
import { resetComponent } from '../../style';
import { genPresetColor, genStyleHooks } from '../../theme/internal';
// ============================== Ribbon ==============================
const genRibbonStyle = token => {
const {
antCls,
badgeFontHeight,
marginXS,
badgeRibbonOffset,
calc
} = token;
const ribbonPrefixCls = `${antCls}-ribbon`;
const ribbonWrapperPrefixCls = `${antCls}-ribbon-wrapper`;
const statusRibbonPreset = genPresetColor(token, (colorKey, {
darkColor
}) => ({
[`&${ribbonPrefixCls}-color-${colorKey}`]: {
background: darkColor,
color: darkColor
}
}));
return {
[ribbonWrapperPrefixCls]: {
position: 'relative'
},
[ribbonPrefixCls]: Object.assign(Object.assign(Object.assign(Object.assign({}, resetComponent(token)), {
position: 'absolute',
top: marginXS,
padding: `0 ${unit(token.paddingXS)}`,
color: token.colorPrimary,
lineHeight: unit(badgeFontHeight),
whiteSpace: 'nowrap',
backgroundColor: token.colorPrimary,
borderRadius: token.borderRadiusSM,
[`${ribbonPrefixCls}-text`]: {
color: token.badgeTextColor
},
[`${ribbonPrefixCls}-corner`]: {
position: 'absolute',
top: '100%',
width: badgeRibbonOffset,
height: badgeRibbonOffset,
color: 'currentcolor',
border: `${unit(calc(badgeRibbonOffset).div(2).equal())} solid`,
transform: token.badgeRibbonCornerTransform,
transformOrigin: 'top',
filter: token.badgeRibbonCornerFilter
}
}), statusRibbonPreset), {
[`&${ribbonPrefixCls}-placement-end`]: {
insetInlineEnd: calc(badgeRibbonOffset).mul(-1).equal(),
borderEndEndRadius: 0,
[`${ribbonPrefixCls}-corner`]: {
insetInlineEnd: 0,
borderInlineEndColor: 'transparent',
borderBlockEndColor: 'transparent'
}
},
[`&${ribbonPrefixCls}-placement-start`]: {
insetInlineStart: calc(badgeRibbonOffset).mul(-1).equal(),
borderEndStartRadius: 0,
[`${ribbonPrefixCls}-corner`]: {
insetInlineStart: 0,
borderBlockEndColor: 'transparent',
borderInlineStartColor: 'transparent'
}
},
// ====================== RTL =======================
'&-rtl': {
direction: 'rtl'
}
})
};
};
// ============================== Export ==============================
export default genStyleHooks(['Badge', 'Ribbon'], token => {
const badgeToken = prepareToken(token);
return genRibbonStyle(badgeToken);
}, prepareComponentToken);