mirror of
https://github.com/ant-design/ant-design.git
synced 2025-06-07 17:44:35 +08:00
refactor: genStyleHooks (#46038)
* refactor: genStyleHooks * chore: update sciprt * refactor: affix * refactor: select * chore: update * refactor: update * refactor: update * refactor: done * chore: code clean * chore: code clean * chore: fix lint * chore: decrease size limit * chore: code clean * chore: code clean * chore: remove export
This commit is contained in:
parent
f051c2f3df
commit
c4b8c9df93
@ -7,7 +7,6 @@ import throttleByAnimationFrame from '../_util/throttleByAnimationFrame';
|
|||||||
import type { ConfigConsumerProps } from '../config-provider';
|
import type { ConfigConsumerProps } from '../config-provider';
|
||||||
import { ConfigContext } from '../config-provider';
|
import { ConfigContext } from '../config-provider';
|
||||||
import useStyle from './style';
|
import useStyle from './style';
|
||||||
import useCSSVar from './style/cssVar';
|
|
||||||
import { getFixedBottom, getFixedTop, getTargetRect } from './utils';
|
import { getFixedBottom, getFixedTop, getTargetRect } from './utils';
|
||||||
|
|
||||||
const TRIGGER_EVENTS = [
|
const TRIGGER_EVENTS = [
|
||||||
@ -244,8 +243,7 @@ const Affix = React.forwardRef<AffixRef, AffixProps>((props, ref) => {
|
|||||||
updatePosition();
|
updatePosition();
|
||||||
}, [target, offsetTop, offsetBottom]);
|
}, [target, offsetTop, offsetBottom]);
|
||||||
|
|
||||||
const [, hashId] = useStyle(affixPrefixCls);
|
const [wrapCSSVar, hashId] = useStyle(affixPrefixCls);
|
||||||
const wrapCSSVar = useCSSVar(affixPrefixCls);
|
|
||||||
|
|
||||||
const rootCls = classNames(rootClassName, hashId, affixPrefixCls);
|
const rootCls = classNames(rootClassName, hashId, affixPrefixCls);
|
||||||
|
|
||||||
|
@ -1,4 +0,0 @@
|
|||||||
import { prepareComponentToken } from '.';
|
|
||||||
import { genCSSVarRegister } from '../../theme/internal';
|
|
||||||
|
|
||||||
export default genCSSVarRegister<'Affix'>('Affix', prepareComponentToken);
|
|
@ -1,7 +1,7 @@
|
|||||||
import type { CSSObject } from '@ant-design/cssinjs';
|
import type { CSSObject } from '@ant-design/cssinjs';
|
||||||
|
|
||||||
import type { FullToken, GenerateStyle, GetDefaultToken } from '../../theme/internal';
|
import type { FullToken, GenerateStyle, GetDefaultToken } from '../../theme/internal';
|
||||||
import { genComponentStyleHook } from '../../theme/internal';
|
import { genStyleHooks } from '../../theme/internal';
|
||||||
|
|
||||||
export interface ComponentToken {
|
export interface ComponentToken {
|
||||||
zIndexPopup: number;
|
zIndexPopup: number;
|
||||||
@ -27,4 +27,4 @@ export const prepareComponentToken: GetDefaultToken<'Affix'> = (token) => ({
|
|||||||
});
|
});
|
||||||
|
|
||||||
// ============================== Export ==============================
|
// ============================== Export ==============================
|
||||||
export default genComponentStyleHook('Affix', genSharedAffixStyle, prepareComponentToken);
|
export default genStyleHooks('Affix', genSharedAffixStyle, prepareComponentToken);
|
||||||
|
@ -13,7 +13,6 @@ import { replaceElement } from '../_util/reactNode';
|
|||||||
import { devUseWarning } from '../_util/warning';
|
import { devUseWarning } from '../_util/warning';
|
||||||
import { ConfigContext } from '../config-provider';
|
import { ConfigContext } from '../config-provider';
|
||||||
import useStyle from './style';
|
import useStyle from './style';
|
||||||
import useCSSVar from './style/cssVar';
|
|
||||||
|
|
||||||
export interface AlertProps {
|
export interface AlertProps {
|
||||||
/** Type of Alert styles, options:`success`, `info`, `warning`, `error` */
|
/** Type of Alert styles, options:`success`, `info`, `warning`, `error` */
|
||||||
@ -128,8 +127,7 @@ const Alert: React.FC<AlertProps> = (props) => {
|
|||||||
const { getPrefixCls, direction, alert } = React.useContext(ConfigContext);
|
const { getPrefixCls, direction, alert } = React.useContext(ConfigContext);
|
||||||
const prefixCls = getPrefixCls('alert', customizePrefixCls);
|
const prefixCls = getPrefixCls('alert', customizePrefixCls);
|
||||||
|
|
||||||
const [, hashId] = useStyle(prefixCls);
|
const [wrapCSSVar, hashId] = useStyle(prefixCls);
|
||||||
const wrapCSSVar = useCSSVar(prefixCls);
|
|
||||||
|
|
||||||
const handleClose = (e: React.MouseEvent<HTMLButtonElement>) => {
|
const handleClose = (e: React.MouseEvent<HTMLButtonElement>) => {
|
||||||
setClosed(true);
|
setClosed(true);
|
||||||
|
@ -1,4 +0,0 @@
|
|||||||
import { prepareComponentToken } from '.';
|
|
||||||
import { genCSSVarRegister } from '../../theme/internal';
|
|
||||||
|
|
||||||
export default genCSSVarRegister<'Alert'>('Alert', prepareComponentToken);
|
|
@ -1,10 +1,10 @@
|
|||||||
import type { CSSProperties } from 'react';
|
import type { CSSProperties } from 'react';
|
||||||
import { unit } from '@ant-design/cssinjs';
|
|
||||||
import type { CSSObject } from '@ant-design/cssinjs';
|
import type { CSSObject } from '@ant-design/cssinjs';
|
||||||
|
import { unit } from '@ant-design/cssinjs';
|
||||||
|
|
||||||
import { resetComponent } from '../../style';
|
import { resetComponent } from '../../style';
|
||||||
import type { FullToken, GenerateStyle, GetDefaultToken } from '../../theme/internal';
|
import type { FullToken, GenerateStyle, GetDefaultToken } from '../../theme/internal';
|
||||||
import { genComponentStyleHook } from '../../theme/internal';
|
import { genStyleHooks } from '../../theme/internal';
|
||||||
|
|
||||||
export interface ComponentToken {
|
export interface ComponentToken {
|
||||||
// Component token here
|
// Component token here
|
||||||
@ -248,7 +248,7 @@ export const prepareComponentToken: GetDefaultToken<'Alert'> = (token) => {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export default genComponentStyleHook(
|
export default genStyleHooks(
|
||||||
'Alert',
|
'Alert',
|
||||||
(token) => [genBaseStyle(token), genTypeStyle(token), genActionStyle(token)],
|
(token) => [genBaseStyle(token), genTypeStyle(token), genActionStyle(token)],
|
||||||
prepareComponentToken,
|
prepareComponentToken,
|
||||||
|
@ -14,7 +14,6 @@ import type { AnchorLinkBaseProps } from './AnchorLink';
|
|||||||
import AnchorLink from './AnchorLink';
|
import AnchorLink from './AnchorLink';
|
||||||
import AnchorContext from './context';
|
import AnchorContext from './context';
|
||||||
import useStyle from './style';
|
import useStyle from './style';
|
||||||
import useCSSVar from './style/cssVar';
|
|
||||||
|
|
||||||
export interface AnchorLinkItemProps extends AnchorLinkBaseProps {
|
export interface AnchorLinkItemProps extends AnchorLinkBaseProps {
|
||||||
key: React.Key;
|
key: React.Key;
|
||||||
@ -153,9 +152,8 @@ const Anchor: React.FC<AnchorProps> = (props) => {
|
|||||||
|
|
||||||
const prefixCls = getPrefixCls('anchor', customPrefixCls);
|
const prefixCls = getPrefixCls('anchor', customPrefixCls);
|
||||||
|
|
||||||
const [, hashId] = useStyle(prefixCls);
|
|
||||||
const rootCls = useCSSVarCls(prefixCls);
|
const rootCls = useCSSVarCls(prefixCls);
|
||||||
const wrapCSSVar = useCSSVar(rootCls);
|
const [wrapCSSVar, hashId] = useStyle(prefixCls, rootCls);
|
||||||
|
|
||||||
const getCurrentContainer = getContainer ?? getTargetContainer ?? getDefaultContainer;
|
const getCurrentContainer = getContainer ?? getTargetContainer ?? getDefaultContainer;
|
||||||
|
|
||||||
|
@ -1,4 +0,0 @@
|
|||||||
import { prepareComponentToken } from '.';
|
|
||||||
import { genCSSVarRegister } from '../../theme/internal';
|
|
||||||
|
|
||||||
export default genCSSVarRegister<'Anchor'>('Anchor', prepareComponentToken);
|
|
@ -2,7 +2,7 @@ import { unit } from '@ant-design/cssinjs';
|
|||||||
|
|
||||||
import { resetComponent, textEllipsis } from '../../style';
|
import { resetComponent, textEllipsis } from '../../style';
|
||||||
import type { FullToken, GenerateStyle, GetDefaultToken } from '../../theme/internal';
|
import type { FullToken, GenerateStyle, GetDefaultToken } from '../../theme/internal';
|
||||||
import { genComponentStyleHook, mergeToken } from '../../theme/internal';
|
import { genStyleHooks, mergeToken } from '../../theme/internal';
|
||||||
|
|
||||||
export interface ComponentToken {
|
export interface ComponentToken {
|
||||||
/**
|
/**
|
||||||
@ -165,7 +165,7 @@ export const prepareComponentToken: GetDefaultToken<'Anchor'> = (token) => ({
|
|||||||
});
|
});
|
||||||
|
|
||||||
// ============================== Export ==============================
|
// ============================== Export ==============================
|
||||||
export default genComponentStyleHook(
|
export default genStyleHooks(
|
||||||
'Anchor',
|
'Anchor',
|
||||||
(token) => {
|
(token) => {
|
||||||
const { fontSize, fontSizeLG, paddingXXS, calc } = token;
|
const { fontSize, fontSizeLG, paddingXXS, calc } = token;
|
||||||
|
@ -11,7 +11,6 @@ import useNotification from '../notification/useNotification';
|
|||||||
import type { AppConfig, useAppProps } from './context';
|
import type { AppConfig, useAppProps } from './context';
|
||||||
import AppContext, { AppConfigContext } from './context';
|
import AppContext, { AppConfigContext } from './context';
|
||||||
import useStyle from './style';
|
import useStyle from './style';
|
||||||
import useCSSVar from './style/cssVar';
|
|
||||||
|
|
||||||
export interface AppProps<P = AnyObject> extends AppConfig {
|
export interface AppProps<P = AnyObject> extends AppConfig {
|
||||||
style?: React.CSSProperties;
|
style?: React.CSSProperties;
|
||||||
@ -37,8 +36,7 @@ const App: React.FC<AppProps> & { useApp: () => useAppProps } = (props) => {
|
|||||||
} = props;
|
} = props;
|
||||||
const { getPrefixCls } = useContext<ConfigConsumerProps>(ConfigContext);
|
const { getPrefixCls } = useContext<ConfigConsumerProps>(ConfigContext);
|
||||||
const prefixCls = getPrefixCls('app', customizePrefixCls);
|
const prefixCls = getPrefixCls('app', customizePrefixCls);
|
||||||
const [, hashId] = useStyle(prefixCls);
|
const [wrapCSSVar, hashId] = useStyle(prefixCls);
|
||||||
const wrapCSSVar = useCSSVar(prefixCls);
|
|
||||||
const customClassName = classNames(hashId, prefixCls, className, rootClassName);
|
const customClassName = classNames(hashId, prefixCls, className, rootClassName);
|
||||||
|
|
||||||
const appConfig = useContext<AppConfig>(AppConfigContext);
|
const appConfig = useContext<AppConfig>(AppConfigContext);
|
||||||
|
@ -1,4 +0,0 @@
|
|||||||
import { prepareComponentToken } from '.';
|
|
||||||
import { genCSSVarRegister } from '../../theme/internal';
|
|
||||||
|
|
||||||
export default genCSSVarRegister<'App'>('App', prepareComponentToken);
|
|
@ -1,5 +1,5 @@
|
|||||||
import type { FullToken, GenerateStyle, GetDefaultToken } from '../../theme/internal';
|
import type { FullToken, GenerateStyle, GetDefaultToken } from '../../theme/internal';
|
||||||
import { genComponentStyleHook } from '../../theme/internal';
|
import { genStyleHooks } from '../../theme/internal';
|
||||||
|
|
||||||
export type ComponentToken = {};
|
export type ComponentToken = {};
|
||||||
|
|
||||||
@ -21,4 +21,4 @@ const genBaseStyle: GenerateStyle<AppToken> = (token) => {
|
|||||||
export const prepareComponentToken: GetDefaultToken<'App'> = () => ({});
|
export const prepareComponentToken: GetDefaultToken<'App'> = () => ({});
|
||||||
|
|
||||||
// ============================== Export ==============================
|
// ============================== Export ==============================
|
||||||
export default genComponentStyleHook<'App'>('App', genBaseStyle, prepareComponentToken);
|
export default genStyleHooks('App', genBaseStyle, prepareComponentToken);
|
||||||
|
@ -12,7 +12,6 @@ import useBreakpoint from '../grid/hooks/useBreakpoint';
|
|||||||
import type { AvatarContextType, AvatarSize } from './AvatarContext';
|
import type { AvatarContextType, AvatarSize } from './AvatarContext';
|
||||||
import AvatarContext from './AvatarContext';
|
import AvatarContext from './AvatarContext';
|
||||||
import useStyle from './style';
|
import useStyle from './style';
|
||||||
import useCSSVar from './style/cssVar';
|
|
||||||
import useCSSVarCls from '../config-provider/hooks/useCSSVarCls';
|
import useCSSVarCls from '../config-provider/hooks/useCSSVarCls';
|
||||||
|
|
||||||
export interface AvatarProps {
|
export interface AvatarProps {
|
||||||
@ -146,9 +145,8 @@ const InternalAvatar: React.ForwardRefRenderFunction<HTMLSpanElement, AvatarProp
|
|||||||
}
|
}
|
||||||
|
|
||||||
const prefixCls = getPrefixCls('avatar', customizePrefixCls);
|
const prefixCls = getPrefixCls('avatar', customizePrefixCls);
|
||||||
const [, hashId] = useStyle(prefixCls);
|
|
||||||
const cssVarCls = useCSSVarCls(prefixCls);
|
const cssVarCls = useCSSVarCls(prefixCls);
|
||||||
const wrapCSSVar = useCSSVar(cssVarCls);
|
const [wrapCSSVar, hashId] = useStyle(prefixCls, cssVarCls);
|
||||||
|
|
||||||
const sizeCls = classNames({
|
const sizeCls = classNames({
|
||||||
[`${prefixCls}-lg`]: size === 'large',
|
[`${prefixCls}-lg`]: size === 'large',
|
||||||
|
@ -9,7 +9,6 @@ import AvatarContext from './AvatarContext';
|
|||||||
import type { AvatarContextType, AvatarSize } from './AvatarContext';
|
import type { AvatarContextType, AvatarSize } from './AvatarContext';
|
||||||
import useStyle from './style';
|
import useStyle from './style';
|
||||||
import useCSSVarCls from '../config-provider/hooks/useCSSVarCls';
|
import useCSSVarCls from '../config-provider/hooks/useCSSVarCls';
|
||||||
import useCSSVar from './style/cssVar';
|
|
||||||
|
|
||||||
interface ContextProps {
|
interface ContextProps {
|
||||||
children?: React.ReactNode;
|
children?: React.ReactNode;
|
||||||
@ -62,9 +61,8 @@ const Group: React.FC<GroupProps> = (props) => {
|
|||||||
|
|
||||||
const prefixCls = getPrefixCls('avatar', customizePrefixCls);
|
const prefixCls = getPrefixCls('avatar', customizePrefixCls);
|
||||||
const groupPrefixCls = `${prefixCls}-group`;
|
const groupPrefixCls = `${prefixCls}-group`;
|
||||||
const [, hashId] = useStyle(prefixCls);
|
|
||||||
const cssVarCls = useCSSVarCls(prefixCls);
|
const cssVarCls = useCSSVarCls(prefixCls);
|
||||||
const wrapCSSVar = useCSSVar(cssVarCls);
|
const [wrapCSSVar, hashId] = useStyle(prefixCls, cssVarCls);
|
||||||
|
|
||||||
const cls = classNames(
|
const cls = classNames(
|
||||||
groupPrefixCls,
|
groupPrefixCls,
|
||||||
|
@ -1,4 +0,0 @@
|
|||||||
import { prepareComponentToken } from '.';
|
|
||||||
import { genCSSVarRegister } from '../../theme/internal';
|
|
||||||
|
|
||||||
export default genCSSVarRegister<'Avatar'>('Avatar', prepareComponentToken);
|
|
@ -1,8 +1,8 @@
|
|||||||
import { unit, type CSSObject } from '@ant-design/cssinjs';
|
import { type CSSObject, unit } from '@ant-design/cssinjs';
|
||||||
|
|
||||||
import { resetComponent } from '../../style';
|
import { resetComponent } from '../../style';
|
||||||
import type { FullToken, GenerateStyle, GetDefaultToken } from '../../theme/internal';
|
import type { FullToken, GenerateStyle, GetDefaultToken } from '../../theme/internal';
|
||||||
import { genComponentStyleHook, mergeToken } from '../../theme/internal';
|
import { genStyleHooks, mergeToken } from '../../theme/internal';
|
||||||
|
|
||||||
export interface ComponentToken {
|
export interface ComponentToken {
|
||||||
/**
|
/**
|
||||||
@ -197,7 +197,7 @@ export const prepareComponentToken: GetDefaultToken<'Avatar'> = (token) => {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export default genComponentStyleHook<'Avatar'>(
|
export default genStyleHooks(
|
||||||
'Avatar',
|
'Avatar',
|
||||||
(token) => {
|
(token) => {
|
||||||
const { colorTextLightSolid, colorTextPlaceholder } = token;
|
const { colorTextLightSolid, colorTextPlaceholder } = token;
|
||||||
|
@ -12,7 +12,6 @@ import { devUseWarning } from '../_util/warning';
|
|||||||
import type { ConfigConsumerProps } from '../config-provider';
|
import type { ConfigConsumerProps } from '../config-provider';
|
||||||
import { ConfigContext } from '../config-provider';
|
import { ConfigContext } from '../config-provider';
|
||||||
import useStyle from './style';
|
import useStyle from './style';
|
||||||
import useCSSVar from './style/cssVar';
|
|
||||||
|
|
||||||
export interface BackTopProps {
|
export interface BackTopProps {
|
||||||
visibilityHeight?: number;
|
visibilityHeight?: number;
|
||||||
@ -78,8 +77,7 @@ const BackTop: React.FC<BackTopProps> = (props) => {
|
|||||||
|
|
||||||
const rootPrefixCls = getPrefixCls();
|
const rootPrefixCls = getPrefixCls();
|
||||||
|
|
||||||
const [, hashId] = useStyle(prefixCls);
|
const [wrapCSSVar, hashId] = useStyle(prefixCls);
|
||||||
const wrapCSSVar = useCSSVar(prefixCls);
|
|
||||||
|
|
||||||
const classString = classNames(
|
const classString = classNames(
|
||||||
hashId,
|
hashId,
|
||||||
|
@ -1,4 +0,0 @@
|
|||||||
import { prepareComponentToken } from '.';
|
|
||||||
import { genCSSVarRegister } from '../../theme/internal';
|
|
||||||
|
|
||||||
export default genCSSVarRegister<'BackTop'>('BackTop', prepareComponentToken);
|
|
@ -1,8 +1,8 @@
|
|||||||
import { unit, type CSSObject } from '@ant-design/cssinjs';
|
import { type CSSObject, unit } from '@ant-design/cssinjs';
|
||||||
|
|
||||||
import { resetComponent } from '../../style';
|
import { resetComponent } from '../../style';
|
||||||
import type { FullToken, GenerateStyle, GetDefaultToken } from '../../theme/internal';
|
import type { FullToken, GenerateStyle, GetDefaultToken } from '../../theme/internal';
|
||||||
import { genComponentStyleHook, mergeToken } from '../../theme/internal';
|
import { genStyleHooks, mergeToken } from '../../theme/internal';
|
||||||
|
|
||||||
/** Component only token. Which will handle additional calculation of alias token */
|
/** Component only token. Which will handle additional calculation of alias token */
|
||||||
export interface ComponentToken {
|
export interface ComponentToken {
|
||||||
@ -89,7 +89,7 @@ export const prepareComponentToken: GetDefaultToken<'BackTop'> = (token) => ({
|
|||||||
});
|
});
|
||||||
|
|
||||||
// ============================== Export ==============================
|
// ============================== Export ==============================
|
||||||
export default genComponentStyleHook<'BackTop'>(
|
export default genStyleHooks(
|
||||||
'BackTop',
|
'BackTop',
|
||||||
(token) => {
|
(token) => {
|
||||||
const {
|
const {
|
||||||
|
@ -5,7 +5,6 @@ import type { PresetColorType } from '../_util/colors';
|
|||||||
import { isPresetColor } from '../_util/colors';
|
import { isPresetColor } from '../_util/colors';
|
||||||
import type { LiteralUnion } from '../_util/type';
|
import type { LiteralUnion } from '../_util/type';
|
||||||
import { ConfigContext } from '../config-provider';
|
import { ConfigContext } from '../config-provider';
|
||||||
import useCSSVar from './style/cssVar';
|
|
||||||
import useStyle from './style/ribbon';
|
import useStyle from './style/ribbon';
|
||||||
|
|
||||||
type RibbonPlacement = 'start' | 'end';
|
type RibbonPlacement = 'start' | 'end';
|
||||||
@ -35,8 +34,7 @@ const Ribbon: React.FC<RibbonProps> = (props) => {
|
|||||||
const { getPrefixCls, direction } = React.useContext(ConfigContext);
|
const { getPrefixCls, direction } = React.useContext(ConfigContext);
|
||||||
const prefixCls = getPrefixCls('ribbon', customizePrefixCls);
|
const prefixCls = getPrefixCls('ribbon', customizePrefixCls);
|
||||||
|
|
||||||
const [, hashId] = useStyle(prefixCls);
|
const [wrapCSSVar, hashId] = useStyle(prefixCls);
|
||||||
const wrapCSSVar = useCSSVar(prefixCls);
|
|
||||||
|
|
||||||
const colorInPreset = isPresetColor(color, false);
|
const colorInPreset = isPresetColor(color, false);
|
||||||
const ribbonCls = classNames(
|
const ribbonCls = classNames(
|
||||||
|
@ -12,7 +12,6 @@ import type { PresetColorKey } from '../theme/internal';
|
|||||||
import Ribbon from './Ribbon';
|
import Ribbon from './Ribbon';
|
||||||
import ScrollNumber from './ScrollNumber';
|
import ScrollNumber from './ScrollNumber';
|
||||||
import useStyle from './style';
|
import useStyle from './style';
|
||||||
import useCSSVar from './style/cssVar';
|
|
||||||
|
|
||||||
export type { ScrollNumberProps } from './ScrollNumber';
|
export type { ScrollNumberProps } from './ScrollNumber';
|
||||||
|
|
||||||
@ -77,8 +76,7 @@ const InternalBadge: React.ForwardRefRenderFunction<HTMLSpanElement, BadgeProps>
|
|||||||
const { getPrefixCls, direction, badge } = React.useContext(ConfigContext);
|
const { getPrefixCls, direction, badge } = React.useContext(ConfigContext);
|
||||||
const prefixCls = getPrefixCls('badge', customizePrefixCls);
|
const prefixCls = getPrefixCls('badge', customizePrefixCls);
|
||||||
|
|
||||||
const [, hashId] = useStyle(prefixCls);
|
const [wrapCSSVar, hashId] = useStyle(prefixCls);
|
||||||
const wrapCSSVar = useCSSVar(prefixCls);
|
|
||||||
|
|
||||||
// ================================ Misc ================================
|
// ================================ Misc ================================
|
||||||
const numberedDisplayCount = (
|
const numberedDisplayCount = (
|
||||||
|
@ -1,4 +0,0 @@
|
|||||||
import { prepareComponentToken } from '.';
|
|
||||||
import { genCSSVarRegister } from '../../theme/internal';
|
|
||||||
|
|
||||||
export default genCSSVarRegister<'Badge'>('Badge', prepareComponentToken);
|
|
@ -2,7 +2,7 @@ import { Keyframes, unit } from '@ant-design/cssinjs';
|
|||||||
|
|
||||||
import { resetComponent } from '../../style';
|
import { resetComponent } from '../../style';
|
||||||
import type { FullToken, GenerateStyle } from '../../theme/internal';
|
import type { FullToken, GenerateStyle } from '../../theme/internal';
|
||||||
import { genComponentStyleHook, genPresetColor, mergeToken } from '../../theme/internal';
|
import { genPresetColor, genStyleHooks, mergeToken } from '../../theme/internal';
|
||||||
import type { GenStyleFn, GetDefaultToken } from '../../theme/util/genComponentStyleHook';
|
import type { GenStyleFn, GetDefaultToken } from '../../theme/util/genComponentStyleHook';
|
||||||
|
|
||||||
/** Component only token. Which will handle additional calculation of alias token */
|
/** Component only token. Which will handle additional calculation of alias token */
|
||||||
@ -367,7 +367,7 @@ export const prepareComponentToken: GetDefaultToken<'Badge'> = (token) => {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export default genComponentStyleHook(
|
export default genStyleHooks(
|
||||||
'Badge',
|
'Badge',
|
||||||
(token) => {
|
(token) => {
|
||||||
const badgeToken = prepareToken(token);
|
const badgeToken = prepareToken(token);
|
||||||
|
@ -12,7 +12,6 @@ import type { BreadcrumbItemProps } from './BreadcrumbItem';
|
|||||||
import BreadcrumbItem, { InternalBreadcrumbItem } from './BreadcrumbItem';
|
import BreadcrumbItem, { InternalBreadcrumbItem } from './BreadcrumbItem';
|
||||||
import BreadcrumbSeparator from './BreadcrumbSeparator';
|
import BreadcrumbSeparator from './BreadcrumbSeparator';
|
||||||
import useStyle from './style';
|
import useStyle from './style';
|
||||||
import useCSSVar from './style/cssVar';
|
|
||||||
import useItemRender from './useItemRender';
|
import useItemRender from './useItemRender';
|
||||||
import useItems from './useItems';
|
import useItems from './useItems';
|
||||||
|
|
||||||
@ -96,8 +95,7 @@ const Breadcrumb = <T extends AnyObject = AnyObject>(props: BreadcrumbProps<T>)
|
|||||||
let crumbs: React.ReactNode;
|
let crumbs: React.ReactNode;
|
||||||
|
|
||||||
const prefixCls = getPrefixCls('breadcrumb', customizePrefixCls);
|
const prefixCls = getPrefixCls('breadcrumb', customizePrefixCls);
|
||||||
const [, hashId] = useStyle(prefixCls);
|
const [wrapCSSVar, hashId] = useStyle(prefixCls);
|
||||||
const wrapCSSVar = useCSSVar(prefixCls);
|
|
||||||
|
|
||||||
const mergedItems = useItems(items, legacyRoutes);
|
const mergedItems = useItems(items, legacyRoutes);
|
||||||
|
|
||||||
|
@ -1,4 +0,0 @@
|
|||||||
import { prepareComponentToken } from '.';
|
|
||||||
import { genCSSVarRegister } from '../../theme/internal';
|
|
||||||
|
|
||||||
export default genCSSVarRegister<'Breadcrumb'>('Breadcrumb', prepareComponentToken);
|
|
@ -1,8 +1,8 @@
|
|||||||
import { unit, type CSSObject } from '@ant-design/cssinjs';
|
import { type CSSObject, unit } from '@ant-design/cssinjs';
|
||||||
|
|
||||||
import { genFocusStyle, resetComponent } from '../../style';
|
import { genFocusStyle, resetComponent } from '../../style';
|
||||||
import type { FullToken, GenerateStyle, GetDefaultToken } from '../../theme/internal';
|
import type { FullToken, GenerateStyle, GetDefaultToken } from '../../theme/internal';
|
||||||
import { genComponentStyleHook, mergeToken } from '../../theme/internal';
|
import { genStyleHooks, mergeToken } from '../../theme/internal';
|
||||||
|
|
||||||
export interface ComponentToken {
|
export interface ComponentToken {
|
||||||
/**
|
/**
|
||||||
@ -147,7 +147,7 @@ export const prepareComponentToken: GetDefaultToken<'Breadcrumb'> = (token) => (
|
|||||||
});
|
});
|
||||||
|
|
||||||
// ============================== Export ==============================
|
// ============================== Export ==============================
|
||||||
export default genComponentStyleHook(
|
export default genStyleHooks(
|
||||||
'Breadcrumb',
|
'Breadcrumb',
|
||||||
(token) => {
|
(token) => {
|
||||||
const breadcrumbToken = mergeToken<BreadcrumbToken>(token, {});
|
const breadcrumbToken = mergeToken<BreadcrumbToken>(token, {});
|
||||||
|
@ -26,7 +26,6 @@ import IconWrapper from './IconWrapper';
|
|||||||
import LoadingIcon from './LoadingIcon';
|
import LoadingIcon from './LoadingIcon';
|
||||||
import useStyle from './style';
|
import useStyle from './style';
|
||||||
import CompactCmp from './style/compactCmp';
|
import CompactCmp from './style/compactCmp';
|
||||||
import useCSSVar from './style/cssVar';
|
|
||||||
|
|
||||||
export type LegacyButtonType = ButtonType | 'danger';
|
export type LegacyButtonType = ButtonType | 'danger';
|
||||||
|
|
||||||
@ -119,8 +118,7 @@ const InternalButton: React.ForwardRefRenderFunction<
|
|||||||
const { getPrefixCls, autoInsertSpaceInButton, direction, button } = useContext(ConfigContext);
|
const { getPrefixCls, autoInsertSpaceInButton, direction, button } = useContext(ConfigContext);
|
||||||
const prefixCls = getPrefixCls('btn', customizePrefixCls);
|
const prefixCls = getPrefixCls('btn', customizePrefixCls);
|
||||||
|
|
||||||
const [, hashId] = useStyle(prefixCls);
|
const [wrapCSSVar, hashId] = useStyle(prefixCls);
|
||||||
const wrapCSSVar = useCSSVar(prefixCls);
|
|
||||||
|
|
||||||
const disabled = useContext(DisabledContext);
|
const disabled = useContext(DisabledContext);
|
||||||
const mergedDisabled = customDisabled ?? disabled;
|
const mergedDisabled = customDisabled ?? disabled;
|
||||||
|
@ -1,8 +0,0 @@
|
|||||||
import { genCSSVarRegister } from '../../theme/internal';
|
|
||||||
import { prepareComponentToken } from '.';
|
|
||||||
|
|
||||||
export default genCSSVarRegister('Button', prepareComponentToken, {
|
|
||||||
unitless: {
|
|
||||||
fontWeight: true,
|
|
||||||
},
|
|
||||||
});
|
|
@ -1,10 +1,10 @@
|
|||||||
import type { CSSProperties } from 'react';
|
import type { CSSProperties } from 'react';
|
||||||
import { unit } from '@ant-design/cssinjs';
|
|
||||||
import type { CSSInterpolation, CSSObject } from '@ant-design/cssinjs';
|
import type { CSSInterpolation, CSSObject } from '@ant-design/cssinjs';
|
||||||
|
import { unit } from '@ant-design/cssinjs';
|
||||||
|
|
||||||
import { genFocusStyle } from '../../style';
|
import { genFocusStyle } from '../../style';
|
||||||
import type { FullToken, GenerateStyle, GetDefaultToken } from '../../theme/internal';
|
import type { FullToken, GenerateStyle, GetDefaultToken } from '../../theme/internal';
|
||||||
import { genComponentStyleHook, mergeToken } from '../../theme/internal';
|
import { genStyleHooks, mergeToken } from '../../theme/internal';
|
||||||
import type { GenStyleFn } from '../../theme/util/genComponentStyleHook';
|
import type { GenStyleFn } from '../../theme/util/genComponentStyleHook';
|
||||||
import genGroupStyle from './group';
|
import genGroupStyle from './group';
|
||||||
|
|
||||||
@ -705,7 +705,7 @@ export const prepareComponentToken: GetDefaultToken<'Button'> = (token) => {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export default genComponentStyleHook(
|
export default genStyleHooks(
|
||||||
'Button',
|
'Button',
|
||||||
(token) => {
|
(token) => {
|
||||||
const buttonToken = prepareToken(token);
|
const buttonToken = prepareToken(token);
|
||||||
@ -730,4 +730,9 @@ export default genComponentStyleHook(
|
|||||||
];
|
];
|
||||||
},
|
},
|
||||||
prepareComponentToken,
|
prepareComponentToken,
|
||||||
|
{
|
||||||
|
unitless: {
|
||||||
|
fontWeight: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
);
|
);
|
||||||
|
@ -16,7 +16,6 @@ import { useLocale } from '../locale';
|
|||||||
import CalendarHeader from './Header';
|
import CalendarHeader from './Header';
|
||||||
import enUS from './locale/en_US';
|
import enUS from './locale/en_US';
|
||||||
import useStyle from './style';
|
import useStyle from './style';
|
||||||
import useCSSVar from './style/cssVar';
|
|
||||||
|
|
||||||
type InjectDefaultProps<Props> = Omit<
|
type InjectDefaultProps<Props> = Omit<
|
||||||
Props,
|
Props,
|
||||||
@ -120,8 +119,7 @@ function generateCalendar<DateType>(generateConfig: GenerateConfig<DateType>) {
|
|||||||
const prefixCls = getPrefixCls('picker', customizePrefixCls);
|
const prefixCls = getPrefixCls('picker', customizePrefixCls);
|
||||||
const calendarPrefixCls = `${prefixCls}-calendar`;
|
const calendarPrefixCls = `${prefixCls}-calendar`;
|
||||||
|
|
||||||
const [, hashId] = useStyle(prefixCls);
|
const [wrapCSSVar, hashId] = useStyle(prefixCls, calendarPrefixCls);
|
||||||
const wrapCSSVar = useCSSVar(calendarPrefixCls);
|
|
||||||
|
|
||||||
const today = generateConfig.getNow();
|
const today = generateConfig.getNow();
|
||||||
|
|
||||||
|
@ -1,4 +0,0 @@
|
|||||||
import { prepareComponentToken } from '.';
|
|
||||||
import { genCSSVarRegister } from '../../theme/internal';
|
|
||||||
|
|
||||||
export default genCSSVarRegister('Calendar', prepareComponentToken);
|
|
@ -9,7 +9,7 @@ import {
|
|||||||
} from '../../date-picker/style';
|
} from '../../date-picker/style';
|
||||||
import { resetComponent } from '../../style';
|
import { resetComponent } from '../../style';
|
||||||
import type { FullToken, GetDefaultToken } from '../../theme/internal';
|
import type { FullToken, GetDefaultToken } from '../../theme/internal';
|
||||||
import { genComponentStyleHook, mergeToken } from '../../theme/internal';
|
import { genStyleHooks, mergeToken } from '../../theme/internal';
|
||||||
|
|
||||||
export interface ComponentToken {
|
export interface ComponentToken {
|
||||||
/**
|
/**
|
||||||
@ -225,7 +225,7 @@ export const prepareComponentToken: GetDefaultToken<'Calendar'> = (token) => ({
|
|||||||
...initPanelComponentToken(token),
|
...initPanelComponentToken(token),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default genComponentStyleHook(
|
export default genStyleHooks(
|
||||||
'Calendar',
|
'Calendar',
|
||||||
(token) => {
|
(token) => {
|
||||||
const calendarCls = `${token.componentCls}-calendar`;
|
const calendarCls = `${token.componentCls}-calendar`;
|
||||||
|
@ -10,7 +10,6 @@ import type { TabsProps } from '../tabs';
|
|||||||
import Tabs from '../tabs';
|
import Tabs from '../tabs';
|
||||||
import Grid from './Grid';
|
import Grid from './Grid';
|
||||||
import useStyle from './style';
|
import useStyle from './style';
|
||||||
import useCSSVar from './style/cssVar';
|
|
||||||
|
|
||||||
export type CardType = 'inner';
|
export type CardType = 'inner';
|
||||||
export type CardSize = 'default' | 'small';
|
export type CardSize = 'default' | 'small';
|
||||||
@ -110,8 +109,7 @@ const Card = React.forwardRef<HTMLDivElement, CardProps>((props, ref) => {
|
|||||||
}, [children]);
|
}, [children]);
|
||||||
|
|
||||||
const prefixCls = getPrefixCls('card', customizePrefixCls);
|
const prefixCls = getPrefixCls('card', customizePrefixCls);
|
||||||
const [, hashId] = useStyle(prefixCls);
|
const [wrapCSSVar, hashId] = useStyle(prefixCls);
|
||||||
const wrapCSSVar = useCSSVar(prefixCls);
|
|
||||||
|
|
||||||
const loadingBlock = (
|
const loadingBlock = (
|
||||||
<Skeleton loading active paragraph={{ rows: 4 }} title={false}>
|
<Skeleton loading active paragraph={{ rows: 4 }} title={false}>
|
||||||
|
@ -1,4 +0,0 @@
|
|||||||
import { prepareComponentToken } from '.';
|
|
||||||
import { genCSSVarRegister } from '../../theme/internal';
|
|
||||||
|
|
||||||
export default genCSSVarRegister('Card', prepareComponentToken);
|
|
@ -1,8 +1,8 @@
|
|||||||
import { unit, type CSSObject } from '@ant-design/cssinjs';
|
import { type CSSObject, unit } from '@ant-design/cssinjs';
|
||||||
|
|
||||||
import { clearFix, resetComponent, textEllipsis } from '../../style';
|
import { clearFix, resetComponent, textEllipsis } from '../../style';
|
||||||
import type { FullToken, GenerateStyle, GetDefaultToken } from '../../theme/internal';
|
import type { FullToken, GenerateStyle, GetDefaultToken } from '../../theme/internal';
|
||||||
import { genComponentStyleHook, mergeToken } from '../../theme/internal';
|
import { genStyleHooks, mergeToken } from '../../theme/internal';
|
||||||
|
|
||||||
export interface ComponentToken {
|
export interface ComponentToken {
|
||||||
/**
|
/**
|
||||||
@ -428,7 +428,7 @@ export const prepareComponentToken: GetDefaultToken<'Card'> = (token) => ({
|
|||||||
});
|
});
|
||||||
|
|
||||||
// ============================== Export ==============================
|
// ============================== Export ==============================
|
||||||
export default genComponentStyleHook(
|
export default genStyleHooks(
|
||||||
'Card',
|
'Card',
|
||||||
(token) => {
|
(token) => {
|
||||||
const cardToken = mergeToken<CardToken>(token, {
|
const cardToken = mergeToken<CardToken>(token, {
|
||||||
|
@ -5,7 +5,6 @@ import classNames from 'classnames';
|
|||||||
|
|
||||||
import { ConfigContext } from '../config-provider';
|
import { ConfigContext } from '../config-provider';
|
||||||
import useStyle from './style';
|
import useStyle from './style';
|
||||||
import useCSSVar from './style/cssVar';
|
|
||||||
|
|
||||||
export type CarouselEffect = 'scrollx' | 'fade';
|
export type CarouselEffect = 'scrollx' | 'fade';
|
||||||
export type DotPosition = 'top' | 'bottom' | 'left' | 'right';
|
export type DotPosition = 'top' | 'bottom' | 'left' | 'right';
|
||||||
@ -95,8 +94,7 @@ const Carousel = React.forwardRef<CarouselRef, CarouselProps>((props, ref) => {
|
|||||||
typeof dots === 'boolean' ? false : dots?.className,
|
typeof dots === 'boolean' ? false : dots?.className,
|
||||||
);
|
);
|
||||||
|
|
||||||
const [, hashId] = useStyle(prefixCls);
|
const [wrapCSSVar, hashId] = useStyle(prefixCls);
|
||||||
const wrapCSSVar = useCSSVar(prefixCls);
|
|
||||||
|
|
||||||
const className = classNames(
|
const className = classNames(
|
||||||
prefixCls,
|
prefixCls,
|
||||||
|
@ -1,4 +0,0 @@
|
|||||||
import { prepareComponentToken } from '.';
|
|
||||||
import { genCSSVarRegister } from '../../theme/internal';
|
|
||||||
|
|
||||||
export default genCSSVarRegister('Carousel', prepareComponentToken);
|
|
@ -2,7 +2,7 @@ import { unit } from '@ant-design/cssinjs';
|
|||||||
|
|
||||||
import { resetComponent } from '../../style';
|
import { resetComponent } from '../../style';
|
||||||
import type { FullToken, GenerateStyle, GetDefaultToken } from '../../theme/internal';
|
import type { FullToken, GenerateStyle, GetDefaultToken } from '../../theme/internal';
|
||||||
import { genComponentStyleHook, mergeToken } from '../../theme/internal';
|
import { genStyleHooks, mergeToken } from '../../theme/internal';
|
||||||
|
|
||||||
export interface ComponentToken {
|
export interface ComponentToken {
|
||||||
/**
|
/**
|
||||||
@ -355,7 +355,7 @@ export const prepareComponentToken: GetDefaultToken<'Carousel'> = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// ============================== Export ==============================
|
// ============================== Export ==============================
|
||||||
export default genComponentStyleHook(
|
export default genStyleHooks(
|
||||||
'Carousel',
|
'Carousel',
|
||||||
(token) => {
|
(token) => {
|
||||||
const { controlHeightLG, controlHeightSM } = token;
|
const { controlHeightLG, controlHeightSM } = token;
|
||||||
|
@ -11,7 +11,6 @@ import useCheckable from './hooks/useCheckable';
|
|||||||
import useColumnIcons from './hooks/useColumnIcons';
|
import useColumnIcons from './hooks/useColumnIcons';
|
||||||
import useStyle from './style';
|
import useStyle from './style';
|
||||||
import usePanelStyle from './style/panel';
|
import usePanelStyle from './style/panel';
|
||||||
import useCSSVar from './style/cssVar';
|
|
||||||
|
|
||||||
export type PanelPickType = Exclude<PickType, 'checkable'> | 'multiple' | 'rootClassName';
|
export type PanelPickType = Exclude<PickType, 'checkable'> | 'multiple' | 'rootClassName';
|
||||||
|
|
||||||
@ -33,10 +32,8 @@ export default function CascaderPanel(props: CascaderPanelProps) {
|
|||||||
direction,
|
direction,
|
||||||
);
|
);
|
||||||
|
|
||||||
const [, hashId] = useStyle(cascaderPrefixCls);
|
const rootCls = useCSSVarCls(cascaderPrefixCls);
|
||||||
const rootCls = useCSSVarCls(prefixCls);
|
const [wrapCSSVar, hashId] = useStyle(cascaderPrefixCls, rootCls);
|
||||||
const cascaderRootCls = useCSSVarCls(cascaderPrefixCls);
|
|
||||||
const wrapCSSVar = useCSSVar(cascaderRootCls);
|
|
||||||
usePanelStyle(cascaderPrefixCls);
|
usePanelStyle(cascaderPrefixCls);
|
||||||
|
|
||||||
const isRtl = mergedDirection === 'rtl';
|
const isRtl = mergedDirection === 'rtl';
|
||||||
@ -59,7 +56,7 @@ export default function CascaderPanel(props: CascaderPanelProps) {
|
|||||||
{...props}
|
{...props}
|
||||||
checkable={checkable}
|
checkable={checkable}
|
||||||
prefixCls={cascaderPrefixCls}
|
prefixCls={cascaderPrefixCls}
|
||||||
className={classNames(className, hashId, rootClassName, rootCls, cascaderRootCls)}
|
className={classNames(className, hashId, rootClassName, rootCls)}
|
||||||
notFoundContent={mergedNotFoundContent}
|
notFoundContent={mergedNotFoundContent}
|
||||||
direction={mergedDirection}
|
direction={mergedDirection}
|
||||||
expandIcon={mergedExpandIcon}
|
expandIcon={mergedExpandIcon}
|
||||||
|
@ -27,7 +27,6 @@ import useSize from '../config-provider/hooks/useSize';
|
|||||||
import type { SizeType } from '../config-provider/SizeContext';
|
import type { SizeType } from '../config-provider/SizeContext';
|
||||||
import { FormItemInputContext } from '../form/context';
|
import { FormItemInputContext } from '../form/context';
|
||||||
import useSelectStyle from '../select/style';
|
import useSelectStyle from '../select/style';
|
||||||
import useSelectCSSVar from '../select/style/cssVar';
|
|
||||||
import useBuiltinPlacements from '../select/useBuiltinPlacements';
|
import useBuiltinPlacements from '../select/useBuiltinPlacements';
|
||||||
import useIcons from '../select/useIcons';
|
import useIcons from '../select/useIcons';
|
||||||
import useShowArrow from '../select/useShowArrow';
|
import useShowArrow from '../select/useShowArrow';
|
||||||
@ -37,7 +36,6 @@ import useCheckable from './hooks/useCheckable';
|
|||||||
import useColumnIcons from './hooks/useColumnIcons';
|
import useColumnIcons from './hooks/useColumnIcons';
|
||||||
import CascaderPanel from './Panel';
|
import CascaderPanel from './Panel';
|
||||||
import useStyle from './style';
|
import useStyle from './style';
|
||||||
import useCSSVar from './style/cssVar';
|
|
||||||
|
|
||||||
// Align the design since we use `rc-select` in root. This help:
|
// Align the design since we use `rc-select` in root. This help:
|
||||||
// - List search content will show all content
|
// - List search content will show all content
|
||||||
@ -214,12 +212,10 @@ const Cascader = React.forwardRef<CascaderRef, CascaderProps<any>>((props, ref)
|
|||||||
|
|
||||||
const rootPrefixCls = getPrefixCls();
|
const rootPrefixCls = getPrefixCls();
|
||||||
|
|
||||||
const [, hashId] = useSelectStyle(prefixCls);
|
|
||||||
useStyle(cascaderPrefixCls);
|
|
||||||
const rootCls = useCSSVarCls(prefixCls);
|
const rootCls = useCSSVarCls(prefixCls);
|
||||||
|
const [wrapSelectCSSVar, hashId] = useSelectStyle(prefixCls, rootCls);
|
||||||
const cascaderRootCls = useCSSVarCls(cascaderPrefixCls);
|
const cascaderRootCls = useCSSVarCls(cascaderPrefixCls);
|
||||||
const wrapSelectCSSVar = useSelectCSSVar(rootCls);
|
const [wrapCascaderCSSVar] = useStyle(cascaderPrefixCls, cascaderRootCls);
|
||||||
const wrapCascaderCSSVar = useCSSVar(cascaderRootCls);
|
|
||||||
|
|
||||||
const { compactSize, compactItemClassnames } = useCompactItemContext(prefixCls, direction);
|
const { compactSize, compactItemClassnames } = useCompactItemContext(prefixCls, direction);
|
||||||
|
|
||||||
|
@ -1,4 +0,0 @@
|
|||||||
import { prepareComponentToken } from '.';
|
|
||||||
import { genCSSVarRegister } from '../../theme/internal';
|
|
||||||
|
|
||||||
export default genCSSVarRegister('Cascader', prepareComponentToken);
|
|
@ -3,7 +3,7 @@ import type { CSSProperties } from 'react';
|
|||||||
import { genCompactItemStyle } from '../../style/compact-item';
|
import { genCompactItemStyle } from '../../style/compact-item';
|
||||||
import type { GlobalToken } from '../../theme';
|
import type { GlobalToken } from '../../theme';
|
||||||
import type { FullToken, GenerateStyle } from '../../theme/internal';
|
import type { FullToken, GenerateStyle } from '../../theme/internal';
|
||||||
import { genComponentStyleHook } from '../../theme/internal';
|
import { genStyleHooks } from '../../theme/internal';
|
||||||
import getColumnsStyle from './columns';
|
import getColumnsStyle from './columns';
|
||||||
|
|
||||||
export interface ComponentToken {
|
export interface ComponentToken {
|
||||||
@ -104,8 +104,4 @@ export const prepareComponentToken = (token: GlobalToken) => {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export default genComponentStyleHook(
|
export default genStyleHooks('Cascader', (token) => [genBaseStyle(token)], prepareComponentToken);
|
||||||
'Cascader',
|
|
||||||
(token) => [genBaseStyle(token)],
|
|
||||||
prepareComponentToken,
|
|
||||||
);
|
|
||||||
|
@ -12,7 +12,6 @@ import useCSSVarCls from '../config-provider/hooks/useCSSVarCls';
|
|||||||
import { FormItemInputContext } from '../form/context';
|
import { FormItemInputContext } from '../form/context';
|
||||||
import GroupContext from './GroupContext';
|
import GroupContext from './GroupContext';
|
||||||
import useStyle from './style';
|
import useStyle from './style';
|
||||||
import useCSSVar from './style/cssVar';
|
|
||||||
|
|
||||||
export interface AbstractCheckboxProps<T> {
|
export interface AbstractCheckboxProps<T> {
|
||||||
prefixCls?: string;
|
prefixCls?: string;
|
||||||
@ -107,9 +106,8 @@ const InternalCheckbox: React.ForwardRefRenderFunction<CheckboxRef, CheckboxProp
|
|||||||
}, [restProps.value]);
|
}, [restProps.value]);
|
||||||
|
|
||||||
const prefixCls = getPrefixCls('checkbox', customizePrefixCls);
|
const prefixCls = getPrefixCls('checkbox', customizePrefixCls);
|
||||||
const [, hashId] = useStyle(prefixCls);
|
|
||||||
const rootCls = useCSSVarCls(prefixCls);
|
const rootCls = useCSSVarCls(prefixCls);
|
||||||
const wrapCSSVar = useCSSVar(rootCls);
|
const [wrapCSSVar, hashId] = useStyle(prefixCls, rootCls);
|
||||||
|
|
||||||
const checkboxProps: CheckboxProps = { ...restProps };
|
const checkboxProps: CheckboxProps = { ...restProps };
|
||||||
if (checkboxGroup && !skipGroup) {
|
if (checkboxGroup && !skipGroup) {
|
||||||
|
@ -8,7 +8,6 @@ import type { CheckboxChangeEvent } from './Checkbox';
|
|||||||
import Checkbox from './Checkbox';
|
import Checkbox from './Checkbox';
|
||||||
import GroupContext from './GroupContext';
|
import GroupContext from './GroupContext';
|
||||||
import useStyle from './style';
|
import useStyle from './style';
|
||||||
import useCSSVar from './style/cssVar';
|
|
||||||
|
|
||||||
export type CheckboxValueType = string | number | boolean;
|
export type CheckboxValueType = string | number | boolean;
|
||||||
|
|
||||||
@ -112,9 +111,8 @@ const InternalGroup: React.ForwardRefRenderFunction<HTMLDivElement, CheckboxGrou
|
|||||||
const prefixCls = getPrefixCls('checkbox', customizePrefixCls);
|
const prefixCls = getPrefixCls('checkbox', customizePrefixCls);
|
||||||
const groupPrefixCls = `${prefixCls}-group`;
|
const groupPrefixCls = `${prefixCls}-group`;
|
||||||
|
|
||||||
const [, hashId] = useStyle(prefixCls);
|
|
||||||
const rootCls = useCSSVarCls(prefixCls);
|
const rootCls = useCSSVarCls(prefixCls);
|
||||||
const wrapCSSVar = useCSSVar(rootCls);
|
const [wrapCSSVar, hashId] = useStyle(prefixCls, rootCls);
|
||||||
|
|
||||||
const domProps = omit(restProps, ['value', 'disabled']);
|
const domProps = omit(restProps, ['value', 'disabled']);
|
||||||
|
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
import { genCSSVarRegister } from '../../theme/internal';
|
|
||||||
|
|
||||||
export default genCSSVarRegister('Checkbox', {});
|
|
@ -2,7 +2,7 @@ import { unit } from '@ant-design/cssinjs';
|
|||||||
|
|
||||||
import { genFocusOutline, resetComponent } from '../../style';
|
import { genFocusOutline, resetComponent } from '../../style';
|
||||||
import type { FullToken, GenerateStyle } from '../../theme/internal';
|
import type { FullToken, GenerateStyle } from '../../theme/internal';
|
||||||
import { genComponentStyleHook, mergeToken } from '../../theme/internal';
|
import { genStyleHooks, mergeToken } from '../../theme/internal';
|
||||||
|
|
||||||
export interface ComponentToken {}
|
export interface ComponentToken {}
|
||||||
|
|
||||||
@ -263,6 +263,4 @@ export function getStyle(prefixCls: string, token: FullToken<'Checkbox'>) {
|
|||||||
return [genCheckboxStyle(checkboxToken)];
|
return [genCheckboxStyle(checkboxToken)];
|
||||||
}
|
}
|
||||||
|
|
||||||
export default genComponentStyleHook('Checkbox', (token, { prefixCls }) => [
|
export default genStyleHooks('Checkbox', (token, { prefixCls }) => [getStyle(prefixCls, token)]);
|
||||||
getStyle(prefixCls, token),
|
|
||||||
]);
|
|
||||||
|
@ -16,7 +16,6 @@ import type { SizeType } from '../config-provider/SizeContext';
|
|||||||
import type { CollapsibleType } from './CollapsePanel';
|
import type { CollapsibleType } from './CollapsePanel';
|
||||||
import CollapsePanel from './CollapsePanel';
|
import CollapsePanel from './CollapsePanel';
|
||||||
import useStyle from './style';
|
import useStyle from './style';
|
||||||
import useCSSVar from './style/cssVar';
|
|
||||||
|
|
||||||
/** @deprecated Please use `start` | `end` instead */
|
/** @deprecated Please use `start` | `end` instead */
|
||||||
type ExpandIconPositionLegacy = 'left' | 'right';
|
type ExpandIconPositionLegacy = 'left' | 'right';
|
||||||
@ -77,8 +76,7 @@ const Collapse = React.forwardRef<HTMLDivElement, CollapseProps>((props, ref) =>
|
|||||||
const mergedSize = useSize((ctx) => customizeSize ?? ctx ?? 'middle');
|
const mergedSize = useSize((ctx) => customizeSize ?? ctx ?? 'middle');
|
||||||
const prefixCls = getPrefixCls('collapse', customizePrefixCls);
|
const prefixCls = getPrefixCls('collapse', customizePrefixCls);
|
||||||
const rootPrefixCls = getPrefixCls();
|
const rootPrefixCls = getPrefixCls();
|
||||||
const [, hashId] = useStyle(prefixCls);
|
const [wrapCSSVar, hashId] = useStyle(prefixCls);
|
||||||
const wrapCSSVar = useCSSVar(prefixCls);
|
|
||||||
|
|
||||||
if (process.env.NODE_ENV !== 'production') {
|
if (process.env.NODE_ENV !== 'production') {
|
||||||
const warning = devUseWarning('Collapse');
|
const warning = devUseWarning('Collapse');
|
||||||
|
@ -1,4 +0,0 @@
|
|||||||
import { prepareComponentToken } from '.';
|
|
||||||
import { genCSSVarRegister } from '../../theme/internal';
|
|
||||||
|
|
||||||
export default genCSSVarRegister('Collapse', prepareComponentToken);
|
|
@ -4,7 +4,7 @@ import { unit } from '@ant-design/cssinjs';
|
|||||||
import { resetComponent, resetIcon } from '../../style';
|
import { resetComponent, resetIcon } from '../../style';
|
||||||
import { genCollapseMotion } from '../../style/motion';
|
import { genCollapseMotion } from '../../style/motion';
|
||||||
import type { FullToken, GenerateStyle, GetDefaultToken } from '../../theme/internal';
|
import type { FullToken, GenerateStyle, GetDefaultToken } from '../../theme/internal';
|
||||||
import { genComponentStyleHook, mergeToken } from '../../theme/internal';
|
import { genStyleHooks, mergeToken } from '../../theme/internal';
|
||||||
|
|
||||||
/** Component only token. Which will handle additional calculation of alias token */
|
/** Component only token. Which will handle additional calculation of alias token */
|
||||||
export interface ComponentToken {
|
export interface ComponentToken {
|
||||||
@ -311,7 +311,7 @@ export const prepareComponentToken: GetDefaultToken<'Collapse'> = (token) => ({
|
|||||||
contentBg: token.colorBgContainer,
|
contentBg: token.colorBgContainer,
|
||||||
});
|
});
|
||||||
|
|
||||||
export default genComponentStyleHook(
|
export default genStyleHooks(
|
||||||
'Collapse',
|
'Collapse',
|
||||||
(token) => {
|
(token) => {
|
||||||
const collapseToken = mergeToken<CollapseToken>(token, {
|
const collapseToken = mergeToken<CollapseToken>(token, {
|
||||||
|
@ -32,8 +32,7 @@ import type {
|
|||||||
TriggerPlacement,
|
TriggerPlacement,
|
||||||
TriggerType,
|
TriggerType,
|
||||||
} from './interface';
|
} from './interface';
|
||||||
import useCSSVar from './style/cssVar';
|
import useStyle from './style';
|
||||||
import useStyle from './style/index';
|
|
||||||
import { customizePrefixCls, genAlphaColor, generateColor, getAlphaColor } from './util';
|
import { customizePrefixCls, genAlphaColor, generateColor, getAlphaColor } from './util';
|
||||||
|
|
||||||
export type ColorPickerProps = Omit<
|
export type ColorPickerProps = Omit<
|
||||||
@ -137,9 +136,8 @@ const ColorPicker: CompoundedComponent = (props) => {
|
|||||||
|
|
||||||
// ===================== Style =====================
|
// ===================== Style =====================
|
||||||
const mergedSize = useSize(customizeSize);
|
const mergedSize = useSize(customizeSize);
|
||||||
const [, hashId] = useStyle(prefixCls);
|
|
||||||
const rootCls = useCSSVarCls(prefixCls);
|
const rootCls = useCSSVarCls(prefixCls);
|
||||||
const wrapCSSVar = useCSSVar(rootCls);
|
const [wrapCSSVar, hashId] = useStyle(prefixCls, rootCls);
|
||||||
const rtlCls = { [`${prefixCls}-rtl`]: direction };
|
const rtlCls = { [`${prefixCls}-rtl`]: direction };
|
||||||
const mergeRootCls = classNames(rootClassName, rootCls, rtlCls);
|
const mergeRootCls = classNames(rootClassName, rootCls, rtlCls);
|
||||||
const mergeCls = classNames(
|
const mergeCls = classNames(
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
import { genCSSVarRegister } from '../../theme/internal';
|
|
||||||
|
|
||||||
export default genCSSVarRegister('ColorPicker', {});
|
|
@ -1,7 +1,7 @@
|
|||||||
import { unit, type CSSObject } from '@ant-design/cssinjs';
|
import { type CSSObject, unit } from '@ant-design/cssinjs';
|
||||||
|
|
||||||
import type { FullToken, GenerateStyle } from '../../theme/internal';
|
import type { FullToken, GenerateStyle } from '../../theme/internal';
|
||||||
import { genComponentStyleHook, mergeToken } from '../../theme/internal';
|
import { genStyleHooks, mergeToken } from '../../theme/internal';
|
||||||
import genColorBlockStyle from './color-block';
|
import genColorBlockStyle from './color-block';
|
||||||
import genInputStyle from './input';
|
import genInputStyle from './input';
|
||||||
import genPickerStyle from './picker';
|
import genPickerStyle from './picker';
|
||||||
@ -252,7 +252,7 @@ const genColorPickerStyle: GenerateStyle<ColorPickerToken> = (token) => {
|
|||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
export default genComponentStyleHook('ColorPicker', (token) => {
|
export default genStyleHooks('ColorPicker', (token) => {
|
||||||
const { colorTextQuaternary, marginSM } = token;
|
const { colorTextQuaternary, marginSM } = token;
|
||||||
|
|
||||||
const colorPickerSliderHeight = 8;
|
const colorPickerSliderHeight = 8;
|
||||||
|
@ -19,7 +19,6 @@ import { useLocale } from '../../locale';
|
|||||||
import { useCompactItemContext } from '../../space/Compact';
|
import { useCompactItemContext } from '../../space/Compact';
|
||||||
import enUS from '../locale/en_US';
|
import enUS from '../locale/en_US';
|
||||||
import useStyle from '../style';
|
import useStyle from '../style';
|
||||||
import useCSSVar from '../style/cssVar';
|
|
||||||
import {
|
import {
|
||||||
getRangePlaceholder,
|
getRangePlaceholder,
|
||||||
getTimeProps,
|
getTimeProps,
|
||||||
@ -73,9 +72,8 @@ export default function generateRangePicker<DateType>(generateConfig: GenerateCo
|
|||||||
const { format, showTime, picker } = props as any;
|
const { format, showTime, picker } = props as any;
|
||||||
const rootPrefixCls = getPrefixCls();
|
const rootPrefixCls = getPrefixCls();
|
||||||
|
|
||||||
const [, hashId] = useStyle(prefixCls);
|
|
||||||
const cssVarCls = useCSSVarCls(prefixCls);
|
const cssVarCls = useCSSVarCls(prefixCls);
|
||||||
const wrapCSSVar = useCSSVar(cssVarCls);
|
const [wrapCSSVar, hashId] = useStyle(prefixCls, cssVarCls);
|
||||||
|
|
||||||
const additionalOverrideProps: any = {
|
const additionalOverrideProps: any = {
|
||||||
...(showTime ? getTimeProps({ format, picker, ...showTime }) : {}),
|
...(showTime ? getTimeProps({ format, picker, ...showTime }) : {}),
|
||||||
|
@ -20,7 +20,6 @@ import { useLocale } from '../../locale';
|
|||||||
import { useCompactItemContext } from '../../space/Compact';
|
import { useCompactItemContext } from '../../space/Compact';
|
||||||
import enUS from '../locale/en_US';
|
import enUS from '../locale/en_US';
|
||||||
import useStyle from '../style';
|
import useStyle from '../style';
|
||||||
import useCSSVar from '../style/cssVar';
|
|
||||||
import {
|
import {
|
||||||
getPlaceholder,
|
getPlaceholder,
|
||||||
getTimeProps,
|
getTimeProps,
|
||||||
@ -81,9 +80,8 @@ export default function generatePicker<DateType>(generateConfig: GenerateConfig<
|
|||||||
const innerRef = React.useRef<RCPicker<DateType>>(null);
|
const innerRef = React.useRef<RCPicker<DateType>>(null);
|
||||||
const { format, showTime } = props as any;
|
const { format, showTime } = props as any;
|
||||||
|
|
||||||
const [, hashId] = useStyle(prefixCls);
|
|
||||||
const cssVarCls = useCSSVarCls(prefixCls);
|
const cssVarCls = useCSSVarCls(prefixCls);
|
||||||
const wrapCSSVar = useCSSVar(cssVarCls);
|
const [wrapCSSVar, hashId] = useStyle(prefixCls, cssVarCls);
|
||||||
|
|
||||||
useImperativeHandle(ref, () => ({
|
useImperativeHandle(ref, () => ({
|
||||||
focus: () => innerRef.current?.focus(),
|
focus: () => innerRef.current?.focus(),
|
||||||
|
@ -1,4 +0,0 @@
|
|||||||
import { genCSSVarRegister } from '../../theme/internal';
|
|
||||||
import { prepareComponentToken } from '.';
|
|
||||||
|
|
||||||
export default genCSSVarRegister('DatePicker', prepareComponentToken);
|
|
@ -22,7 +22,7 @@ import {
|
|||||||
} from '../../style/motion';
|
} from '../../style/motion';
|
||||||
import type { GlobalToken } from '../../theme/interface';
|
import type { GlobalToken } from '../../theme/interface';
|
||||||
import type { FullToken, GenerateStyle, GetDefaultToken } from '../../theme/internal';
|
import type { FullToken, GenerateStyle, GetDefaultToken } from '../../theme/internal';
|
||||||
import { genComponentStyleHook, mergeToken } from '../../theme/internal';
|
import { genStyleHooks, mergeToken } from '../../theme/internal';
|
||||||
import type { TokenWithCommonCls } from '../../theme/util/genComponentStyleHook';
|
import type { TokenWithCommonCls } from '../../theme/util/genComponentStyleHook';
|
||||||
import type { ArrowToken } from '../../style/roundedArrow';
|
import type { ArrowToken } from '../../style/roundedArrow';
|
||||||
import { genRoundedArrow, getArrowToken } from '../../style/roundedArrow';
|
import { genRoundedArrow, getArrowToken } from '../../style/roundedArrow';
|
||||||
@ -1614,7 +1614,7 @@ export const prepareComponentToken: GetDefaultToken<'DatePicker'> = (token) => (
|
|||||||
});
|
});
|
||||||
|
|
||||||
// ============================== Export ==============================
|
// ============================== Export ==============================
|
||||||
export default genComponentStyleHook(
|
export default genStyleHooks(
|
||||||
'DatePicker',
|
'DatePicker',
|
||||||
(token) => {
|
(token) => {
|
||||||
const pickerToken = mergeToken<PickerToken>(initInputToken(token), initPickerPanelToken(token));
|
const pickerToken = mergeToken<PickerToken>(initInputToken(token), initPickerPanelToken(token));
|
||||||
|
@ -15,7 +15,6 @@ import type { DescriptionsItemProps } from './Item';
|
|||||||
import DescriptionsItem from './Item';
|
import DescriptionsItem from './Item';
|
||||||
import Row from './Row';
|
import Row from './Row';
|
||||||
import useStyle from './style';
|
import useStyle from './style';
|
||||||
import useCSSVar from './style/cssVar';
|
|
||||||
|
|
||||||
interface CompoundedComponent {
|
interface CompoundedComponent {
|
||||||
Item: typeof DescriptionsItem;
|
Item: typeof DescriptionsItem;
|
||||||
@ -93,8 +92,7 @@ const Descriptions: React.FC<DescriptionsProps> & CompoundedComponent = (props)
|
|||||||
const mergedSize = useSize(customizeSize);
|
const mergedSize = useSize(customizeSize);
|
||||||
const rows = useRow(mergedColumn, mergedItems);
|
const rows = useRow(mergedColumn, mergedItems);
|
||||||
|
|
||||||
const [, hashId] = useStyle(prefixCls);
|
const [wrapCSSVar, hashId] = useStyle(prefixCls);
|
||||||
const wrapCSSVar = useCSSVar(prefixCls);
|
|
||||||
|
|
||||||
// ======================== Render ========================
|
// ======================== Render ========================
|
||||||
const contextValue = React.useMemo(
|
const contextValue = React.useMemo(
|
||||||
|
@ -1,4 +0,0 @@
|
|||||||
import { prepareComponentToken } from '.';
|
|
||||||
import { genCSSVarRegister } from '../../theme/internal';
|
|
||||||
|
|
||||||
export default genCSSVarRegister<'Descriptions'>('Descriptions', prepareComponentToken);
|
|
@ -1,8 +1,8 @@
|
|||||||
import { unit, type CSSObject } from '@ant-design/cssinjs';
|
import { type CSSObject, unit } from '@ant-design/cssinjs';
|
||||||
|
|
||||||
import { resetComponent, textEllipsis } from '../../style';
|
import { resetComponent, textEllipsis } from '../../style';
|
||||||
import type { FullToken, GenerateStyle, GetDefaultToken } from '../../theme/internal';
|
import type { FullToken, GenerateStyle, GetDefaultToken } from '../../theme/internal';
|
||||||
import { genComponentStyleHook, mergeToken } from '../../theme/internal';
|
import { genStyleHooks, mergeToken } from '../../theme/internal';
|
||||||
|
|
||||||
/** Component only token. Which will handle additional calculation of alias token */
|
/** Component only token. Which will handle additional calculation of alias token */
|
||||||
export interface ComponentToken {
|
export interface ComponentToken {
|
||||||
@ -228,7 +228,7 @@ export const prepareComponentToken: GetDefaultToken<'Descriptions'> = (token) =>
|
|||||||
});
|
});
|
||||||
|
|
||||||
// ============================== Export ==============================
|
// ============================== Export ==============================
|
||||||
export default genComponentStyleHook(
|
export default genStyleHooks(
|
||||||
'Descriptions',
|
'Descriptions',
|
||||||
(token) => {
|
(token) => {
|
||||||
const descriptionToken = mergeToken<DescriptionsToken>(token, {});
|
const descriptionToken = mergeToken<DescriptionsToken>(token, {});
|
||||||
|
@ -4,7 +4,6 @@ import classNames from 'classnames';
|
|||||||
import { devUseWarning } from '../_util/warning';
|
import { devUseWarning } from '../_util/warning';
|
||||||
import { ConfigContext } from '../config-provider';
|
import { ConfigContext } from '../config-provider';
|
||||||
import useStyle from './style';
|
import useStyle from './style';
|
||||||
import useCSSVar from './style/cssVar';
|
|
||||||
|
|
||||||
export interface DividerProps {
|
export interface DividerProps {
|
||||||
prefixCls?: string;
|
prefixCls?: string;
|
||||||
@ -37,8 +36,7 @@ const Divider: React.FC<DividerProps> = (props) => {
|
|||||||
} = props;
|
} = props;
|
||||||
const prefixCls = getPrefixCls('divider', customizePrefixCls);
|
const prefixCls = getPrefixCls('divider', customizePrefixCls);
|
||||||
|
|
||||||
const [, hashId] = useStyle(prefixCls);
|
const [wrapCSSVar, hashId] = useStyle(prefixCls);
|
||||||
const wrapCSSVar = useCSSVar(prefixCls);
|
|
||||||
|
|
||||||
const orientationPrefix = orientation.length > 0 ? `-${orientation}` : orientation;
|
const orientationPrefix = orientation.length > 0 ? `-${orientation}` : orientation;
|
||||||
const hasChildren = !!children;
|
const hasChildren = !!children;
|
||||||
|
@ -1,8 +0,0 @@
|
|||||||
import { prepareComponentToken } from '.';
|
|
||||||
import { genCSSVarRegister } from '../../theme/internal';
|
|
||||||
|
|
||||||
export default genCSSVarRegister<'Divider'>('Divider', prepareComponentToken, {
|
|
||||||
unitless: {
|
|
||||||
orientationMargin: true,
|
|
||||||
},
|
|
||||||
});
|
|
@ -4,7 +4,7 @@ import { unit } from '@ant-design/cssinjs';
|
|||||||
|
|
||||||
import { resetComponent } from '../../style';
|
import { resetComponent } from '../../style';
|
||||||
import type { FullToken, GenerateStyle, GetDefaultToken } from '../../theme/internal';
|
import type { FullToken, GenerateStyle, GetDefaultToken } from '../../theme/internal';
|
||||||
import { genComponentStyleHook, mergeToken } from '../../theme/internal';
|
import { genStyleHooks, mergeToken } from '../../theme/internal';
|
||||||
|
|
||||||
/** Component only token. Which will handle additional calculation of alias token */
|
/** Component only token. Which will handle additional calculation of alias token */
|
||||||
export interface ComponentToken {
|
export interface ComponentToken {
|
||||||
@ -182,7 +182,7 @@ export const prepareComponentToken: GetDefaultToken<'Divider'> = (token) => ({
|
|||||||
});
|
});
|
||||||
|
|
||||||
// ============================== Export ==============================
|
// ============================== Export ==============================
|
||||||
export default genComponentStyleHook(
|
export default genStyleHooks(
|
||||||
'Divider',
|
'Divider',
|
||||||
(token) => {
|
(token) => {
|
||||||
const dividerToken = mergeToken<DividerToken>(token, {
|
const dividerToken = mergeToken<DividerToken>(token, {
|
||||||
@ -193,4 +193,9 @@ export default genComponentStyleHook(
|
|||||||
return [genSharedDividerStyle(dividerToken)];
|
return [genSharedDividerStyle(dividerToken)];
|
||||||
},
|
},
|
||||||
prepareComponentToken,
|
prepareComponentToken,
|
||||||
|
{
|
||||||
|
unitless: {
|
||||||
|
orientationMargin: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
);
|
);
|
||||||
|
@ -11,16 +11,14 @@ import { devUseWarning } from '../_util/warning';
|
|||||||
import zIndexContext from '../_util/zindexContext';
|
import zIndexContext from '../_util/zindexContext';
|
||||||
import { ConfigContext } from '../config-provider';
|
import { ConfigContext } from '../config-provider';
|
||||||
import { NoFormStyle } from '../form/context';
|
import { NoFormStyle } from '../form/context';
|
||||||
// CSSINJS
|
|
||||||
import { NoCompactStyle } from '../space/Compact';
|
import { NoCompactStyle } from '../space/Compact';
|
||||||
import { usePanelRef } from '../watermark/context';
|
import { usePanelRef } from '../watermark/context';
|
||||||
import type { DrawerClassNames, DrawerPanelProps, DrawerStyles } from './DrawerPanel';
|
import type { DrawerClassNames, DrawerPanelProps, DrawerStyles } from './DrawerPanel';
|
||||||
import DrawerPanel from './DrawerPanel';
|
import DrawerPanel from './DrawerPanel';
|
||||||
import useStyle from './style';
|
import useStyle from './style';
|
||||||
import useCSSVar from './style/cssVar';
|
|
||||||
|
|
||||||
const SizeTypes = ['default', 'large'] as const;
|
const SizeTypes = ['default', 'large'] as const;
|
||||||
type sizeType = typeof SizeTypes[number];
|
type sizeType = (typeof SizeTypes)[number];
|
||||||
|
|
||||||
export interface PushState {
|
export interface PushState {
|
||||||
distance: string | number;
|
distance: string | number;
|
||||||
@ -74,8 +72,7 @@ const Drawer: React.FC<DrawerProps> & {
|
|||||||
|
|
||||||
const prefixCls = getPrefixCls('drawer', customizePrefixCls);
|
const prefixCls = getPrefixCls('drawer', customizePrefixCls);
|
||||||
|
|
||||||
const [, hashId] = useStyle(prefixCls);
|
const [wrapCSSVar, hashId] = useStyle(prefixCls);
|
||||||
const wrapCSSVar = useCSSVar(prefixCls);
|
|
||||||
|
|
||||||
const getContainer =
|
const getContainer =
|
||||||
// 有可能为 false,所以不能直接判断
|
// 有可能为 false,所以不能直接判断
|
||||||
@ -216,8 +213,7 @@ const PurePanel: React.FC<Omit<DrawerPanelProps, 'prefixCls'> & PurePanelInterfa
|
|||||||
|
|
||||||
const prefixCls = getPrefixCls('drawer', customizePrefixCls);
|
const prefixCls = getPrefixCls('drawer', customizePrefixCls);
|
||||||
|
|
||||||
const [, hashId] = useStyle(prefixCls);
|
const [wrapCSSVar, hashId] = useStyle(prefixCls);
|
||||||
const wrapCSSVar = useCSSVar(prefixCls);
|
|
||||||
|
|
||||||
const cls = classNames(
|
const cls = classNames(
|
||||||
prefixCls,
|
prefixCls,
|
||||||
|
@ -1,4 +0,0 @@
|
|||||||
import { prepareComponentToken } from '.';
|
|
||||||
import { genCSSVarRegister } from '../../theme/internal';
|
|
||||||
|
|
||||||
export default genCSSVarRegister<'Drawer'>('Drawer', prepareComponentToken);
|
|
@ -1,7 +1,7 @@
|
|||||||
import { unit } from '@ant-design/cssinjs';
|
import { unit } from '@ant-design/cssinjs';
|
||||||
|
|
||||||
import type { FullToken, GenerateStyle, GetDefaultToken } from '../../theme/internal';
|
import type { FullToken, GenerateStyle, GetDefaultToken } from '../../theme/internal';
|
||||||
import { genComponentStyleHook, mergeToken } from '../../theme/internal';
|
import { genStyleHooks, mergeToken } from '../../theme/internal';
|
||||||
import genMotionStyle from './motion';
|
import genMotionStyle from './motion';
|
||||||
|
|
||||||
export interface ComponentToken {
|
export interface ComponentToken {
|
||||||
@ -234,7 +234,7 @@ export const prepareComponentToken: GetDefaultToken<'Drawer'> = (token) => ({
|
|||||||
});
|
});
|
||||||
|
|
||||||
// ============================== Export ==============================
|
// ============================== Export ==============================
|
||||||
export default genComponentStyleHook(
|
export default genStyleHooks(
|
||||||
'Drawer',
|
'Drawer',
|
||||||
(token) => {
|
(token) => {
|
||||||
const drawerToken = mergeToken<DrawerToken>(token, {});
|
const drawerToken = mergeToken<DrawerToken>(token, {});
|
||||||
|
@ -20,7 +20,6 @@ import Menu from '../menu';
|
|||||||
import { OverrideProvider } from '../menu/OverrideContext';
|
import { OverrideProvider } from '../menu/OverrideContext';
|
||||||
import { useToken } from '../theme/internal';
|
import { useToken } from '../theme/internal';
|
||||||
import useStyle from './style';
|
import useStyle from './style';
|
||||||
import useCSSVar from './style/cssVar';
|
|
||||||
import useCSSVarCls from '../config-provider/hooks/useCSSVarCls';
|
import useCSSVarCls from '../config-provider/hooks/useCSSVarCls';
|
||||||
|
|
||||||
const Placements = [
|
const Placements = [
|
||||||
@ -34,7 +33,7 @@ const Placements = [
|
|||||||
'bottom',
|
'bottom',
|
||||||
] as const;
|
] as const;
|
||||||
|
|
||||||
type Placement = typeof Placements[number];
|
type Placement = (typeof Placements)[number];
|
||||||
type DropdownPlacement = Exclude<Placement, 'topCenter' | 'bottomCenter'>;
|
type DropdownPlacement = Exclude<Placement, 'topCenter' | 'bottomCenter'>;
|
||||||
|
|
||||||
type OverlayFunc = () => React.ReactElement;
|
type OverlayFunc = () => React.ReactElement;
|
||||||
@ -172,8 +171,7 @@ const Dropdown: CompoundedComponent = (props) => {
|
|||||||
|
|
||||||
const prefixCls = getPrefixCls('dropdown', customizePrefixCls);
|
const prefixCls = getPrefixCls('dropdown', customizePrefixCls);
|
||||||
const rootCls = useCSSVarCls(prefixCls);
|
const rootCls = useCSSVarCls(prefixCls);
|
||||||
const [, hashId] = useStyle(prefixCls);
|
const [wrapCSSVar, hashId] = useStyle(prefixCls, rootCls);
|
||||||
const wrapCSSVar = useCSSVar(rootCls);
|
|
||||||
|
|
||||||
const [, token] = useToken();
|
const [, token] = useToken();
|
||||||
|
|
||||||
|
@ -1,4 +0,0 @@
|
|||||||
import { genCSSVarRegister } from '../../theme/internal';
|
|
||||||
import { prepareComponentToken } from '.';
|
|
||||||
|
|
||||||
export default genCSSVarRegister('Dropdown', prepareComponentToken);
|
|
@ -11,7 +11,7 @@ import {
|
|||||||
import type { ArrowOffsetToken } from '../../style/placementArrow';
|
import type { ArrowOffsetToken } from '../../style/placementArrow';
|
||||||
import getArrowStyle, { getArrowOffsetToken } from '../../style/placementArrow';
|
import getArrowStyle, { getArrowOffsetToken } from '../../style/placementArrow';
|
||||||
import type { FullToken, GenerateStyle, GetDefaultToken } from '../../theme/internal';
|
import type { FullToken, GenerateStyle, GetDefaultToken } from '../../theme/internal';
|
||||||
import { genComponentStyleHook, mergeToken } from '../../theme/internal';
|
import { genStyleHooks, mergeToken } from '../../theme/internal';
|
||||||
import genStatusStyle from './status';
|
import genStatusStyle from './status';
|
||||||
import type { ArrowToken } from '../../style/roundedArrow';
|
import type { ArrowToken } from '../../style/roundedArrow';
|
||||||
import { getArrowToken } from '../../style/roundedArrow';
|
import { getArrowToken } from '../../style/roundedArrow';
|
||||||
@ -347,7 +347,7 @@ export const prepareComponentToken: GetDefaultToken<'Dropdown'> = (token) => ({
|
|||||||
...getArrowToken(token),
|
...getArrowToken(token),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default genComponentStyleHook(
|
export default genStyleHooks(
|
||||||
'Dropdown',
|
'Dropdown',
|
||||||
(token) => {
|
(token) => {
|
||||||
const { marginXXS, sizePopupArrow, paddingXXS, componentCls } = token;
|
const { marginXXS, sizePopupArrow, paddingXXS, componentCls } = token;
|
||||||
|
@ -6,7 +6,6 @@ import DefaultEmptyImg from './empty';
|
|||||||
import SimpleEmptyImg from './simple';
|
import SimpleEmptyImg from './simple';
|
||||||
|
|
||||||
import useStyle from './style';
|
import useStyle from './style';
|
||||||
import useCSSVar from './style/cssVar';
|
|
||||||
|
|
||||||
const defaultEmptyImg = <DefaultEmptyImg />;
|
const defaultEmptyImg = <DefaultEmptyImg />;
|
||||||
const simpleEmptyImg = <SimpleEmptyImg />;
|
const simpleEmptyImg = <SimpleEmptyImg />;
|
||||||
@ -46,8 +45,7 @@ const Empty: CompoundedComponent = ({
|
|||||||
const { getPrefixCls, direction, empty } = React.useContext(ConfigContext);
|
const { getPrefixCls, direction, empty } = React.useContext(ConfigContext);
|
||||||
|
|
||||||
const prefixCls = getPrefixCls('empty', customizePrefixCls);
|
const prefixCls = getPrefixCls('empty', customizePrefixCls);
|
||||||
const [, hashId] = useStyle(prefixCls);
|
const [wrapCSSVar, hashId] = useStyle(prefixCls);
|
||||||
const wrapCSSVar = useCSSVar(prefixCls);
|
|
||||||
|
|
||||||
const [locale] = useLocale('Empty');
|
const [locale] = useLocale('Empty');
|
||||||
|
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
import { genCSSVarRegister } from '../../theme/internal';
|
|
||||||
|
|
||||||
export default genCSSVarRegister('Empty', null);
|
|
@ -1,6 +1,6 @@
|
|||||||
import type { CSSObject } from '@ant-design/cssinjs';
|
import type { CSSObject } from '@ant-design/cssinjs';
|
||||||
import type { FullToken, GenerateStyle } from '../../theme/internal';
|
import type { FullToken, GenerateStyle } from '../../theme/internal';
|
||||||
import { genComponentStyleHook, mergeToken } from '../../theme/internal';
|
import { genStyleHooks, mergeToken } from '../../theme/internal';
|
||||||
|
|
||||||
/** Component only token. Which will handle additional calculation of alias token */
|
/** Component only token. Which will handle additional calculation of alias token */
|
||||||
export interface ComponentToken {}
|
export interface ComponentToken {}
|
||||||
@ -75,7 +75,7 @@ const genSharedEmptyStyle: GenerateStyle<EmptyToken> = (token): CSSObject => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// ============================== Export ==============================
|
// ============================== Export ==============================
|
||||||
export default genComponentStyleHook('Empty', (token) => {
|
export default genStyleHooks('Empty', (token) => {
|
||||||
const { componentCls, controlHeightLG, calc } = token;
|
const { componentCls, controlHeightLG, calc } = token;
|
||||||
|
|
||||||
const emptyToken: EmptyToken = mergeToken<EmptyToken>(token, {
|
const emptyToken: EmptyToken = mergeToken<EmptyToken>(token, {
|
||||||
|
@ -7,7 +7,6 @@ import { ConfigContext } from '../config-provider';
|
|||||||
import type { ConfigConsumerProps } from '../config-provider';
|
import type { ConfigConsumerProps } from '../config-provider';
|
||||||
import type { FlexProps } from './interface';
|
import type { FlexProps } from './interface';
|
||||||
import useStyle from './style';
|
import useStyle from './style';
|
||||||
import useCSSVar from './style/cssVar';
|
|
||||||
import createFlexClassNames from './utils';
|
import createFlexClassNames from './utils';
|
||||||
|
|
||||||
const Flex = React.forwardRef<HTMLElement, FlexProps>((props, ref) => {
|
const Flex = React.forwardRef<HTMLElement, FlexProps>((props, ref) => {
|
||||||
@ -32,8 +31,7 @@ const Flex = React.forwardRef<HTMLElement, FlexProps>((props, ref) => {
|
|||||||
|
|
||||||
const prefixCls = getPrefixCls('flex', customizePrefixCls);
|
const prefixCls = getPrefixCls('flex', customizePrefixCls);
|
||||||
|
|
||||||
const [, hashId] = useStyle(prefixCls);
|
const [wrapCSSVar, hashId] = useStyle(prefixCls);
|
||||||
const wrapCSSVar = useCSSVar(prefixCls);
|
|
||||||
|
|
||||||
const mergedVertical = vertical ?? ctxFlex?.vertical;
|
const mergedVertical = vertical ?? ctxFlex?.vertical;
|
||||||
|
|
||||||
|
@ -1,4 +0,0 @@
|
|||||||
import { prepareComponentToken } from '.';
|
|
||||||
import { genCSSVarRegister } from '../../theme/internal';
|
|
||||||
|
|
||||||
export default genCSSVarRegister<'Flex'>('Flex', prepareComponentToken);
|
|
@ -1,7 +1,7 @@
|
|||||||
import type { CSSInterpolation } from '@ant-design/cssinjs';
|
import type { CSSInterpolation } from '@ant-design/cssinjs';
|
||||||
|
|
||||||
import type { FullToken, GenerateStyle, GetDefaultToken } from '../../theme/internal';
|
import type { FullToken, GenerateStyle, GetDefaultToken } from '../../theme/internal';
|
||||||
import { genComponentStyleHook, mergeToken } from '../../theme/internal';
|
import { genStyleHooks, mergeToken } from '../../theme/internal';
|
||||||
import { alignItemsValues, flexWrapValues, justifyContentValues } from '../utils';
|
import { alignItemsValues, flexWrapValues, justifyContentValues } from '../utils';
|
||||||
|
|
||||||
/** Component only token. Which will handle additional calculation of alias token */
|
/** Component only token. Which will handle additional calculation of alias token */
|
||||||
@ -97,7 +97,7 @@ const genJustifyContentStyle: GenerateStyle<FlexToken> = (token) => {
|
|||||||
|
|
||||||
export const prepareComponentToken: GetDefaultToken<'Flex'> = () => ({});
|
export const prepareComponentToken: GetDefaultToken<'Flex'> = () => ({});
|
||||||
|
|
||||||
export default genComponentStyleHook<'Flex'>(
|
export default genStyleHooks(
|
||||||
'Flex',
|
'Flex',
|
||||||
(token) => {
|
(token) => {
|
||||||
const { paddingXS, padding, paddingLG } = token;
|
const { paddingXS, padding, paddingLG } = token;
|
||||||
|
@ -11,7 +11,6 @@ import { ConfigContext } from '../config-provider';
|
|||||||
import FloatButtonGroupContext from './context';
|
import FloatButtonGroupContext from './context';
|
||||||
import FloatButton, { floatButtonPrefixCls } from './FloatButton';
|
import FloatButton, { floatButtonPrefixCls } from './FloatButton';
|
||||||
import type { BackTopProps, FloatButtonProps, FloatButtonRef, FloatButtonShape } from './interface';
|
import type { BackTopProps, FloatButtonProps, FloatButtonRef, FloatButtonShape } from './interface';
|
||||||
import useStyle from './style';
|
|
||||||
|
|
||||||
const BackTop = React.forwardRef<FloatButtonRef, BackTopProps>((props, ref) => {
|
const BackTop = React.forwardRef<FloatButtonRef, BackTopProps>((props, ref) => {
|
||||||
const {
|
const {
|
||||||
@ -67,7 +66,6 @@ const BackTop = React.forwardRef<FloatButtonRef, BackTopProps>((props, ref) => {
|
|||||||
|
|
||||||
const prefixCls = getPrefixCls(floatButtonPrefixCls, customizePrefixCls);
|
const prefixCls = getPrefixCls(floatButtonPrefixCls, customizePrefixCls);
|
||||||
const rootPrefixCls = getPrefixCls();
|
const rootPrefixCls = getPrefixCls();
|
||||||
const [wrapSSR] = useStyle(prefixCls);
|
|
||||||
|
|
||||||
const groupShape = useContext<FloatButtonShape | undefined>(FloatButtonGroupContext);
|
const groupShape = useContext<FloatButtonShape | undefined>(FloatButtonGroupContext);
|
||||||
|
|
||||||
@ -75,7 +73,7 @@ const BackTop = React.forwardRef<FloatButtonRef, BackTopProps>((props, ref) => {
|
|||||||
|
|
||||||
const contentProps: FloatButtonProps = { prefixCls, icon, type, shape: mergeShape, ...restProps };
|
const contentProps: FloatButtonProps = { prefixCls, icon, type, shape: mergeShape, ...restProps };
|
||||||
|
|
||||||
return wrapSSR(
|
return (
|
||||||
<CSSMotion visible={visible} motionName={`${rootPrefixCls}-fade`}>
|
<CSSMotion visible={visible} motionName={`${rootPrefixCls}-fade`}>
|
||||||
{({ className: motionClassName }) => (
|
{({ className: motionClassName }) => (
|
||||||
<FloatButton
|
<FloatButton
|
||||||
@ -85,7 +83,7 @@ const BackTop = React.forwardRef<FloatButtonRef, BackTopProps>((props, ref) => {
|
|||||||
className={classNames(className, motionClassName)}
|
className={classNames(className, motionClassName)}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</CSSMotion>,
|
</CSSMotion>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -18,7 +18,6 @@ import type {
|
|||||||
FloatButtonShape,
|
FloatButtonShape,
|
||||||
} from './interface';
|
} from './interface';
|
||||||
import useStyle from './style';
|
import useStyle from './style';
|
||||||
import useCSSVar from './style/cssVar';
|
|
||||||
import useCSSVarCls from '../config-provider/hooks/useCSSVarCls';
|
import useCSSVarCls from '../config-provider/hooks/useCSSVarCls';
|
||||||
|
|
||||||
export const floatButtonPrefixCls = 'float-btn';
|
export const floatButtonPrefixCls = 'float-btn';
|
||||||
@ -39,9 +38,8 @@ const FloatButton = forwardRef<FloatButtonRef['nativeElement'], FloatButtonProps
|
|||||||
const { getPrefixCls, direction } = useContext<ConfigConsumerProps>(ConfigContext);
|
const { getPrefixCls, direction } = useContext<ConfigConsumerProps>(ConfigContext);
|
||||||
const groupShape = useContext<FloatButtonShape | undefined>(FloatButtonGroupContext);
|
const groupShape = useContext<FloatButtonShape | undefined>(FloatButtonGroupContext);
|
||||||
const prefixCls = getPrefixCls(floatButtonPrefixCls, customizePrefixCls);
|
const prefixCls = getPrefixCls(floatButtonPrefixCls, customizePrefixCls);
|
||||||
const [, hashId] = useStyle(prefixCls);
|
|
||||||
const rootCls = useCSSVarCls(prefixCls);
|
const rootCls = useCSSVarCls(prefixCls);
|
||||||
const wrapCSSVar = useCSSVar(rootCls);
|
const [wrapCSSVar, hashId] = useStyle(prefixCls, rootCls);
|
||||||
|
|
||||||
const mergeShape = groupShape || shape;
|
const mergeShape = groupShape || shape;
|
||||||
|
|
||||||
|
@ -12,7 +12,6 @@ import { FloatButtonGroupProvider } from './context';
|
|||||||
import FloatButton, { floatButtonPrefixCls } from './FloatButton';
|
import FloatButton, { floatButtonPrefixCls } from './FloatButton';
|
||||||
import type { FloatButtonGroupProps, FloatButtonRef } from './interface';
|
import type { FloatButtonGroupProps, FloatButtonRef } from './interface';
|
||||||
import useStyle from './style';
|
import useStyle from './style';
|
||||||
import useCSSVar from './style/cssVar';
|
|
||||||
import useCSSVarCls from '../config-provider/hooks/useCSSVarCls';
|
import useCSSVarCls from '../config-provider/hooks/useCSSVarCls';
|
||||||
|
|
||||||
const FloatButtonGroup: React.FC<FloatButtonGroupProps> = (props) => {
|
const FloatButtonGroup: React.FC<FloatButtonGroupProps> = (props) => {
|
||||||
@ -34,9 +33,8 @@ const FloatButtonGroup: React.FC<FloatButtonGroupProps> = (props) => {
|
|||||||
|
|
||||||
const { direction, getPrefixCls } = useContext<ConfigConsumerProps>(ConfigContext);
|
const { direction, getPrefixCls } = useContext<ConfigConsumerProps>(ConfigContext);
|
||||||
const prefixCls = getPrefixCls(floatButtonPrefixCls, customizePrefixCls);
|
const prefixCls = getPrefixCls(floatButtonPrefixCls, customizePrefixCls);
|
||||||
const [, hashId] = useStyle(prefixCls);
|
|
||||||
const rootCls = useCSSVarCls(prefixCls);
|
const rootCls = useCSSVarCls(prefixCls);
|
||||||
const wrapCSSVar = useCSSVar(rootCls);
|
const [wrapCSSVar, hashId] = useStyle(prefixCls, rootCls);
|
||||||
const groupPrefixCls = `${prefixCls}-group`;
|
const groupPrefixCls = `${prefixCls}-group`;
|
||||||
|
|
||||||
const groupCls = classNames(groupPrefixCls, hashId, rootCls, className, {
|
const groupCls = classNames(groupPrefixCls, hashId, rootCls, className, {
|
||||||
|
@ -1,4 +0,0 @@
|
|||||||
import { genCSSVarRegister } from '../../theme/internal';
|
|
||||||
import { prepareComponentToken } from '.';
|
|
||||||
|
|
||||||
export default genCSSVarRegister('FloatButton', prepareComponentToken);
|
|
@ -4,7 +4,7 @@ import { resetComponent } from '../../style';
|
|||||||
import { initFadeMotion } from '../../style/motion/fade';
|
import { initFadeMotion } from '../../style/motion/fade';
|
||||||
import { initMotion } from '../../style/motion/motion';
|
import { initMotion } from '../../style/motion/motion';
|
||||||
import type { FullToken, GenerateStyle, GetDefaultToken } from '../../theme/internal';
|
import type { FullToken, GenerateStyle, GetDefaultToken } from '../../theme/internal';
|
||||||
import { genComponentStyleHook, mergeToken } from '../../theme/internal';
|
import { genStyleHooks, mergeToken } from '../../theme/internal';
|
||||||
import getOffset from '../util';
|
import getOffset from '../util';
|
||||||
|
|
||||||
/** Component only token. Which will handle additional calculation of alias token */
|
/** Component only token. Which will handle additional calculation of alias token */
|
||||||
@ -370,7 +370,7 @@ export const prepareComponentToken: GetDefaultToken<'FloatButton'> = (token) =>
|
|||||||
dotOffsetInSquare: getOffset(token.borderRadiusLG),
|
dotOffsetInSquare: getOffset(token.borderRadiusLG),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default genComponentStyleHook<'FloatButton'>(
|
export default genStyleHooks(
|
||||||
'FloatButton',
|
'FloatButton',
|
||||||
(token) => {
|
(token) => {
|
||||||
const {
|
const {
|
||||||
|
@ -9,7 +9,6 @@ import type { ValidateStatus } from './FormItem';
|
|||||||
import useDebounce from './hooks/useDebounce';
|
import useDebounce from './hooks/useDebounce';
|
||||||
|
|
||||||
import useStyle from './style';
|
import useStyle from './style';
|
||||||
import useCSSVar from './style/cssVar';
|
|
||||||
import useCSSVarCls from '../config-provider/hooks/useCSSVarCls';
|
import useCSSVarCls from '../config-provider/hooks/useCSSVarCls';
|
||||||
|
|
||||||
const EMPTY_LIST: React.ReactNode[] = [];
|
const EMPTY_LIST: React.ReactNode[] = [];
|
||||||
@ -56,9 +55,8 @@ const ErrorList: React.FC<ErrorListProps> = ({
|
|||||||
|
|
||||||
const baseClassName = `${prefixCls}-item-explain`;
|
const baseClassName = `${prefixCls}-item-explain`;
|
||||||
|
|
||||||
const [, hashId] = useStyle(prefixCls);
|
|
||||||
const cssVarCls = useCSSVarCls(prefixCls);
|
const cssVarCls = useCSSVarCls(prefixCls);
|
||||||
const wrapCSSVar = useCSSVar(cssVarCls);
|
const [wrapCSSVar, hashId] = useStyle(prefixCls, cssVarCls);
|
||||||
|
|
||||||
const collapseMotion: CSSMotionProps = useMemo(() => initCollapseMotion(prefixCls), [prefixCls]);
|
const collapseMotion: CSSMotionProps = useMemo(() => initCollapseMotion(prefixCls), [prefixCls]);
|
||||||
|
|
||||||
|
@ -17,7 +17,6 @@ import useForm, { type FormInstance } from './hooks/useForm';
|
|||||||
import useFormWarning from './hooks/useFormWarning';
|
import useFormWarning from './hooks/useFormWarning';
|
||||||
import type { FormLabelAlign } from './interface';
|
import type { FormLabelAlign } from './interface';
|
||||||
import useStyle from './style';
|
import useStyle from './style';
|
||||||
import useCSSVar from './style/cssVar';
|
|
||||||
import ValidateMessagesContext from './validateMessagesContext';
|
import ValidateMessagesContext from './validateMessagesContext';
|
||||||
import type { FeedbackIcons } from './FormItem';
|
import type { FeedbackIcons } from './FormItem';
|
||||||
import useCSSVarCls from '../config-provider/hooks/useCSSVarCls';
|
import useCSSVarCls from '../config-provider/hooks/useCSSVarCls';
|
||||||
@ -105,9 +104,8 @@ const InternalForm: React.ForwardRefRenderFunction<FormInstance, FormProps> = (p
|
|||||||
const prefixCls = getPrefixCls('form', customizePrefixCls);
|
const prefixCls = getPrefixCls('form', customizePrefixCls);
|
||||||
|
|
||||||
// Style
|
// Style
|
||||||
const [, hashId] = useStyle(prefixCls);
|
|
||||||
const cssVarCls = useCSSVarCls(prefixCls);
|
const cssVarCls = useCSSVarCls(prefixCls);
|
||||||
const wrapCSSVar = useCSSVar(cssVarCls);
|
const [wrapCSSVar, hashId] = useStyle(prefixCls, cssVarCls);
|
||||||
|
|
||||||
const formClassName = classNames(
|
const formClassName = classNames(
|
||||||
prefixCls,
|
prefixCls,
|
||||||
|
@ -18,7 +18,6 @@ import useFormItemStatus from '../hooks/useFormItemStatus';
|
|||||||
import useFrameState from '../hooks/useFrameState';
|
import useFrameState from '../hooks/useFrameState';
|
||||||
import useItemRef from '../hooks/useItemRef';
|
import useItemRef from '../hooks/useItemRef';
|
||||||
import useStyle from '../style';
|
import useStyle from '../style';
|
||||||
import useCSSVar from '../style/cssVar';
|
|
||||||
import { getFieldId, toArray } from '../util';
|
import { getFieldId, toArray } from '../util';
|
||||||
import ItemHolder from './ItemHolder';
|
import ItemHolder from './ItemHolder';
|
||||||
import StatusProvider from './StatusProvider';
|
import StatusProvider from './StatusProvider';
|
||||||
@ -32,7 +31,7 @@ interface FieldError {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const ValidateStatuses = ['success', 'warning', 'error', 'validating', ''] as const;
|
const ValidateStatuses = ['success', 'warning', 'error', 'validating', ''] as const;
|
||||||
export type ValidateStatus = typeof ValidateStatuses[number];
|
export type ValidateStatus = (typeof ValidateStatuses)[number];
|
||||||
|
|
||||||
type RenderChildren<Values = any> = (form: FormInstance<Values>) => React.ReactNode;
|
type RenderChildren<Values = any> = (form: FormInstance<Values>) => React.ReactNode;
|
||||||
type RcFieldProps<Values = any> = Omit<FieldProps<Values>, 'children'>;
|
type RcFieldProps<Values = any> = Omit<FieldProps<Values>, 'children'>;
|
||||||
@ -128,9 +127,8 @@ function InternalFormItem<Values = any>(props: FormItemProps<Values>): React.Rea
|
|||||||
const prefixCls = getPrefixCls('form', customizePrefixCls);
|
const prefixCls = getPrefixCls('form', customizePrefixCls);
|
||||||
|
|
||||||
// Style
|
// Style
|
||||||
const [, hashId] = useStyle(prefixCls);
|
|
||||||
const cssVarCls = useCSSVarCls(prefixCls);
|
const cssVarCls = useCSSVarCls(prefixCls);
|
||||||
const wrapCSSVar = useCSSVar(cssVarCls);
|
const [wrapCSSVar, hashId] = useStyle(prefixCls, cssVarCls);
|
||||||
|
|
||||||
// ========================= Warn =========================
|
// ========================= Warn =========================
|
||||||
const warning = devUseWarning('Form.Item');
|
const warning = devUseWarning('Form.Item');
|
||||||
|
@ -1,4 +0,0 @@
|
|||||||
import { genCSSVarRegister } from '../../theme/internal';
|
|
||||||
import { prepareComponentToken } from '.';
|
|
||||||
|
|
||||||
export default genCSSVarRegister('Form', prepareComponentToken);
|
|
@ -1,13 +1,13 @@
|
|||||||
import type { CSSProperties } from 'react';
|
import type { CSSProperties } from 'react';
|
||||||
import type { CSSObject } from '@ant-design/cssinjs';
|
import type { CSSObject } from '@ant-design/cssinjs';
|
||||||
|
import { unit } from '@ant-design/cssinjs';
|
||||||
|
|
||||||
import { resetComponent } from '../../style';
|
import { resetComponent } from '../../style';
|
||||||
import { genCollapseMotion, zoomIn } from '../../style/motion';
|
import { genCollapseMotion, zoomIn } from '../../style/motion';
|
||||||
import type { AliasToken, FullToken, GenerateStyle, GetDefaultToken } from '../../theme/internal';
|
import type { AliasToken, FullToken, GenerateStyle, GetDefaultToken } from '../../theme/internal';
|
||||||
import { genComponentStyleHook, mergeToken } from '../../theme/internal';
|
import { genStyleHooks, mergeToken } from '../../theme/internal';
|
||||||
import type { GenStyleFn } from '../../theme/util/genComponentStyleHook';
|
import type { GenStyleFn } from '../../theme/util/genComponentStyleHook';
|
||||||
import genFormValidateMotionStyle from './explain';
|
import genFormValidateMotionStyle from './explain';
|
||||||
import { unit } from '@ant-design/cssinjs';
|
|
||||||
|
|
||||||
export interface ComponentToken {
|
export interface ComponentToken {
|
||||||
/**
|
/**
|
||||||
@ -570,7 +570,7 @@ export const prepareToken: (
|
|||||||
return formToken;
|
return formToken;
|
||||||
};
|
};
|
||||||
|
|
||||||
export default genComponentStyleHook(
|
export default genStyleHooks(
|
||||||
'Form',
|
'Form',
|
||||||
(token, { rootPrefixCls }) => {
|
(token, { rootPrefixCls }) => {
|
||||||
const formToken = prepareToken(token, rootPrefixCls);
|
const formToken = prepareToken(token, rootPrefixCls);
|
||||||
|
@ -5,7 +5,6 @@ import type { LiteralUnion } from '../_util/type';
|
|||||||
import { ConfigContext } from '../config-provider';
|
import { ConfigContext } from '../config-provider';
|
||||||
import RowContext from './RowContext';
|
import RowContext from './RowContext';
|
||||||
import { useColStyle } from './style';
|
import { useColStyle } from './style';
|
||||||
import { useColCssVar } from './style/cssVar';
|
|
||||||
|
|
||||||
// https://github.com/ant-design/ant-design/issues/14324
|
// https://github.com/ant-design/ant-design/issues/14324
|
||||||
type ColSpanType = number | string;
|
type ColSpanType = number | string;
|
||||||
@ -69,8 +68,7 @@ const Col = React.forwardRef<HTMLDivElement, ColProps>((props, ref) => {
|
|||||||
|
|
||||||
const prefixCls = getPrefixCls('col', customizePrefixCls);
|
const prefixCls = getPrefixCls('col', customizePrefixCls);
|
||||||
|
|
||||||
const [, hashId] = useColStyle(prefixCls);
|
const [wrapCSSVar, hashId] = useColStyle(prefixCls);
|
||||||
const wrapCSSVar = useColCssVar(prefixCls);
|
|
||||||
|
|
||||||
let sizeClassObj = {};
|
let sizeClassObj = {};
|
||||||
sizes.forEach((size) => {
|
sizes.forEach((size) => {
|
||||||
|
@ -7,7 +7,6 @@ import { ConfigContext } from '../config-provider';
|
|||||||
import RowContext from './RowContext';
|
import RowContext from './RowContext';
|
||||||
import type { RowContextState } from './RowContext';
|
import type { RowContextState } from './RowContext';
|
||||||
import { useRowStyle } from './style';
|
import { useRowStyle } from './style';
|
||||||
import { useRowCssVar } from './style/cssVar';
|
|
||||||
|
|
||||||
const RowAligns = ['top', 'middle', 'bottom', 'stretch'] as const;
|
const RowAligns = ['top', 'middle', 'bottom', 'stretch'] as const;
|
||||||
const RowJustify = [
|
const RowJustify = [
|
||||||
@ -27,12 +26,12 @@ type ResponsiveLike<T> = {
|
|||||||
type Gap = number | undefined;
|
type Gap = number | undefined;
|
||||||
export type Gutter = number | undefined | Partial<Record<Breakpoint, number>>;
|
export type Gutter = number | undefined | Partial<Record<Breakpoint, number>>;
|
||||||
|
|
||||||
type ResponsiveAligns = ResponsiveLike<typeof RowAligns[number]>;
|
type ResponsiveAligns = ResponsiveLike<(typeof RowAligns)[number]>;
|
||||||
type ResponsiveJustify = ResponsiveLike<typeof RowJustify[number]>;
|
type ResponsiveJustify = ResponsiveLike<(typeof RowJustify)[number]>;
|
||||||
export interface RowProps extends React.HTMLAttributes<HTMLDivElement> {
|
export interface RowProps extends React.HTMLAttributes<HTMLDivElement> {
|
||||||
gutter?: Gutter | [Gutter, Gutter];
|
gutter?: Gutter | [Gutter, Gutter];
|
||||||
align?: typeof RowAligns[number] | ResponsiveAligns;
|
align?: (typeof RowAligns)[number] | ResponsiveAligns;
|
||||||
justify?: typeof RowJustify[number] | ResponsiveJustify;
|
justify?: (typeof RowJustify)[number] | ResponsiveJustify;
|
||||||
prefixCls?: string;
|
prefixCls?: string;
|
||||||
wrap?: boolean;
|
wrap?: boolean;
|
||||||
}
|
}
|
||||||
@ -148,8 +147,7 @@ const Row = React.forwardRef<HTMLDivElement, RowProps>((props, ref) => {
|
|||||||
|
|
||||||
const prefixCls = getPrefixCls('row', customizePrefixCls);
|
const prefixCls = getPrefixCls('row', customizePrefixCls);
|
||||||
|
|
||||||
const [, hashId] = useRowStyle(prefixCls);
|
const [wrapCSSVar, hashId] = useRowStyle(prefixCls);
|
||||||
const wrapCSSVar = useRowCssVar(prefixCls);
|
|
||||||
|
|
||||||
const gutters = getGutter();
|
const gutters = getGutter();
|
||||||
const classes = classNames(
|
const classes = classNames(
|
||||||
|
@ -1,6 +0,0 @@
|
|||||||
import { prepareColComponentToken, prepareRowComponentToken } from '.';
|
|
||||||
import { genCSSVarRegister } from '../../theme/internal';
|
|
||||||
|
|
||||||
export const useColCssVar = genCSSVarRegister<'Grid'>('Grid', prepareColComponentToken);
|
|
||||||
|
|
||||||
export const useRowCssVar = genCSSVarRegister<'Grid'>('Grid', prepareRowComponentToken);
|
|
@ -1,7 +1,7 @@
|
|||||||
import { unit, type CSSObject } from '@ant-design/cssinjs';
|
import { type CSSObject, unit } from '@ant-design/cssinjs';
|
||||||
|
|
||||||
import type { FullToken, GenerateStyle, GetDefaultToken } from '../../theme/internal';
|
import type { FullToken, GenerateStyle, GetDefaultToken } from '../../theme/internal';
|
||||||
import { genComponentStyleHook, mergeToken } from '../../theme/internal';
|
import { genStyleHooks, mergeToken } from '../../theme/internal';
|
||||||
|
|
||||||
export interface ComponentToken {
|
export interface ComponentToken {
|
||||||
//
|
//
|
||||||
@ -172,9 +172,9 @@ export const prepareRowComponentToken: GetDefaultToken<'Grid'> = () => ({});
|
|||||||
export const prepareColComponentToken: GetDefaultToken<'Grid'> = () => ({});
|
export const prepareColComponentToken: GetDefaultToken<'Grid'> = () => ({});
|
||||||
|
|
||||||
// ============================== Export ==============================
|
// ============================== Export ==============================
|
||||||
export const useRowStyle = genComponentStyleHook('Grid', genGridRowStyle, prepareRowComponentToken);
|
export const useRowStyle = genStyleHooks('Grid', genGridRowStyle, prepareRowComponentToken);
|
||||||
|
|
||||||
export const useColStyle = genComponentStyleHook(
|
export const useColStyle = genStyleHooks(
|
||||||
'Grid',
|
'Grid',
|
||||||
(token) => {
|
(token) => {
|
||||||
const gridToken: GridColToken = mergeToken<GridColToken>(token, {
|
const gridToken: GridColToken = mergeToken<GridColToken>(token, {
|
||||||
|
@ -15,9 +15,7 @@ import { useZIndex } from '../_util/hooks/useZIndex';
|
|||||||
import { getTransitionName } from '../_util/motion';
|
import { getTransitionName } from '../_util/motion';
|
||||||
import { ConfigContext } from '../config-provider';
|
import { ConfigContext } from '../config-provider';
|
||||||
import useCSSVarCls from '../config-provider/hooks/useCSSVarCls';
|
import useCSSVarCls from '../config-provider/hooks/useCSSVarCls';
|
||||||
// CSSINJS
|
|
||||||
import useStyle from './style';
|
import useStyle from './style';
|
||||||
import useCSSVar from './style/cssVar';
|
|
||||||
|
|
||||||
export const icons = {
|
export const icons = {
|
||||||
rotateLeft: <RotateLeftOutlined />,
|
rotateLeft: <RotateLeftOutlined />,
|
||||||
@ -41,9 +39,8 @@ const InternalPreviewGroup: React.FC<GroupConsumerProps> = ({
|
|||||||
const previewPrefixCls = `${prefixCls}-preview`;
|
const previewPrefixCls = `${prefixCls}-preview`;
|
||||||
const rootPrefixCls = getPrefixCls();
|
const rootPrefixCls = getPrefixCls();
|
||||||
|
|
||||||
const [, hashId] = useStyle(prefixCls);
|
|
||||||
const rootCls = useCSSVarCls(prefixCls);
|
const rootCls = useCSSVarCls(prefixCls);
|
||||||
const wrapCSSVar = useCSSVar(rootCls);
|
const [wrapCSSVar, hashId] = useStyle(prefixCls, rootCls);
|
||||||
|
|
||||||
const [zIndex] = useZIndex(
|
const [zIndex] = useZIndex(
|
||||||
'ImagePreview',
|
'ImagePreview',
|
||||||
|
@ -8,10 +8,8 @@ import { useZIndex } from '../_util/hooks/useZIndex';
|
|||||||
import { getTransitionName } from '../_util/motion';
|
import { getTransitionName } from '../_util/motion';
|
||||||
import { ConfigContext } from '../config-provider';
|
import { ConfigContext } from '../config-provider';
|
||||||
import defaultLocale from '../locale/en_US';
|
import defaultLocale from '../locale/en_US';
|
||||||
// CSSINJS
|
|
||||||
import PreviewGroup, { icons } from './PreviewGroup';
|
import PreviewGroup, { icons } from './PreviewGroup';
|
||||||
import useStyle from './style';
|
import useStyle from './style';
|
||||||
import useCSSVar from './style/cssVar';
|
|
||||||
import useCSSVarCls from '../config-provider/hooks/useCSSVarCls';
|
import useCSSVarCls from '../config-provider/hooks/useCSSVarCls';
|
||||||
|
|
||||||
export interface CompositionImage<P> extends React.FC<P> {
|
export interface CompositionImage<P> extends React.FC<P> {
|
||||||
@ -39,9 +37,8 @@ const Image: CompositionImage<ImageProps> = (props) => {
|
|||||||
|
|
||||||
const imageLocale = contextLocale.Image || defaultLocale.Image;
|
const imageLocale = contextLocale.Image || defaultLocale.Image;
|
||||||
// Style
|
// Style
|
||||||
const [, hashId] = useStyle(prefixCls);
|
|
||||||
const rootCls = useCSSVarCls(prefixCls);
|
const rootCls = useCSSVarCls(prefixCls);
|
||||||
const wrapCSSVar = useCSSVar(rootCls);
|
const [wrapCSSVar, hashId] = useStyle(prefixCls, rootCls);
|
||||||
|
|
||||||
const mergedRootClassName = classNames(rootClassName, hashId, rootCls);
|
const mergedRootClassName = classNames(rootClassName, hashId, rootCls);
|
||||||
|
|
||||||
|
@ -1,4 +0,0 @@
|
|||||||
import { genCSSVarRegister } from '../../theme/internal';
|
|
||||||
import { prepareComponentToken } from '.';
|
|
||||||
|
|
||||||
export default genCSSVarRegister('Image', prepareComponentToken);
|
|
@ -1,11 +1,11 @@
|
|||||||
import type { CSSObject } from '@ant-design/cssinjs';
|
import type { CSSObject } from '@ant-design/cssinjs';
|
||||||
|
import { unit } from '@ant-design/cssinjs';
|
||||||
import { TinyColor } from '@ctrl/tinycolor';
|
import { TinyColor } from '@ctrl/tinycolor';
|
||||||
import { genModalMaskStyle } from '../../modal/style';
|
import { genModalMaskStyle } from '../../modal/style';
|
||||||
import { textEllipsis } from '../../style';
|
import { textEllipsis } from '../../style';
|
||||||
import { initFadeMotion, initZoomMotion } from '../../style/motion';
|
import { initFadeMotion, initZoomMotion } from '../../style/motion';
|
||||||
import type { FullToken, GenerateStyle, GetDefaultToken } from '../../theme/internal';
|
import type { FullToken, GenerateStyle, GetDefaultToken } from '../../theme/internal';
|
||||||
import { genComponentStyleHook, mergeToken } from '../../theme/internal';
|
import { genStyleHooks, mergeToken } from '../../theme/internal';
|
||||||
import { unit } from '@ant-design/cssinjs';
|
|
||||||
|
|
||||||
export interface ComponentToken {
|
export interface ComponentToken {
|
||||||
/**
|
/**
|
||||||
@ -367,7 +367,7 @@ export const prepareComponentToken: GetDefaultToken<'Image'> = (token) => ({
|
|||||||
previewOperationSize: token.fontSizeIcon * 1.5, // FIXME: fontSizeIconLG
|
previewOperationSize: token.fontSizeIcon * 1.5, // FIXME: fontSizeIconLG
|
||||||
});
|
});
|
||||||
|
|
||||||
export default genComponentStyleHook(
|
export default genStyleHooks(
|
||||||
'Image',
|
'Image',
|
||||||
(token) => {
|
(token) => {
|
||||||
const previewCls = `${token.componentCls}-preview`;
|
const previewCls = `${token.componentCls}-preview`;
|
||||||
|
@ -13,7 +13,6 @@ import useSize from '../config-provider/hooks/useSize';
|
|||||||
import { FormItemInputContext, NoFormStyle } from '../form/context';
|
import { FormItemInputContext, NoFormStyle } from '../form/context';
|
||||||
import { NoCompactStyle, useCompactItemContext } from '../space/Compact';
|
import { NoCompactStyle, useCompactItemContext } from '../space/Compact';
|
||||||
import useStyle from './style';
|
import useStyle from './style';
|
||||||
import useCSSVar from './style/cssVar';
|
|
||||||
import useCSSVarCls from '../config-provider/hooks/useCSSVarCls';
|
import useCSSVarCls from '../config-provider/hooks/useCSSVarCls';
|
||||||
|
|
||||||
export interface InputNumberProps<T extends ValueType = ValueType>
|
export interface InputNumberProps<T extends ValueType = ValueType>
|
||||||
@ -56,9 +55,8 @@ const InputNumber = React.forwardRef<HTMLInputElement, InputNumberProps>((props,
|
|||||||
const prefixCls = getPrefixCls('input-number', customizePrefixCls);
|
const prefixCls = getPrefixCls('input-number', customizePrefixCls);
|
||||||
|
|
||||||
// Style
|
// Style
|
||||||
const [, hashId] = useStyle(prefixCls);
|
|
||||||
const cssVarCls = useCSSVarCls(prefixCls);
|
const cssVarCls = useCSSVarCls(prefixCls);
|
||||||
const wrapCSSVar = useCSSVar(cssVarCls);
|
const [wrapCSSVar, hashId] = useStyle(prefixCls, cssVarCls);
|
||||||
|
|
||||||
const { compactSize, compactItemClassnames } = useCompactItemContext(prefixCls, direction);
|
const { compactSize, compactItemClassnames } = useCompactItemContext(prefixCls, direction);
|
||||||
let upIcon = <UpOutlined className={`${prefixCls}-handler-up-inner`} />;
|
let upIcon = <UpOutlined className={`${prefixCls}-handler-up-inner`} />;
|
||||||
|
@ -1,9 +0,0 @@
|
|||||||
import { genCSSVarRegister } from '../../theme/internal';
|
|
||||||
import { formatComponentToken, prepareComponentToken } from '.';
|
|
||||||
|
|
||||||
export default genCSSVarRegister('InputNumber', prepareComponentToken, {
|
|
||||||
format: formatComponentToken,
|
|
||||||
unitless: {
|
|
||||||
handleOpacity: true,
|
|
||||||
},
|
|
||||||
});
|
|
@ -11,7 +11,7 @@ import {
|
|||||||
import { resetComponent, resetIcon } from '../../style';
|
import { resetComponent, resetIcon } from '../../style';
|
||||||
import { genCompactItemStyle } from '../../style/compact-item';
|
import { genCompactItemStyle } from '../../style/compact-item';
|
||||||
import type { FullToken, GenerateStyle, GetDefaultToken } from '../../theme/internal';
|
import type { FullToken, GenerateStyle, GetDefaultToken } from '../../theme/internal';
|
||||||
import { genComponentStyleHook, mergeToken } from '../../theme/internal';
|
import { genStyleHooks, mergeToken } from '../../theme/internal';
|
||||||
import { unit } from '@ant-design/cssinjs';
|
import { unit } from '@ant-design/cssinjs';
|
||||||
import type { FormatComponentToken } from '../../theme/util/genComponentStyleHook';
|
import type { FormatComponentToken } from '../../theme/util/genComponentStyleHook';
|
||||||
|
|
||||||
@ -496,7 +496,7 @@ export const formatComponentToken: FormatComponentToken<'InputNumber'> = (token)
|
|||||||
handleOpacity: token.handleVisible === true ? 1 : 0,
|
handleOpacity: token.handleVisible === true ? 1 : 0,
|
||||||
});
|
});
|
||||||
|
|
||||||
export default genComponentStyleHook(
|
export default genStyleHooks(
|
||||||
'InputNumber',
|
'InputNumber',
|
||||||
(token) => {
|
(token) => {
|
||||||
const inputNumberToken = mergeToken<InputNumberToken>(token, initInputToken(token));
|
const inputNumberToken = mergeToken<InputNumberToken>(token, initInputToken(token));
|
||||||
@ -512,5 +512,8 @@ export default genComponentStyleHook(
|
|||||||
prepareComponentToken,
|
prepareComponentToken,
|
||||||
{
|
{
|
||||||
format: formatComponentToken,
|
format: formatComponentToken,
|
||||||
|
unitless: {
|
||||||
|
handleOpacity: true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
@ -7,7 +7,6 @@ import { ConfigContext } from '../config-provider';
|
|||||||
import type { FormItemStatusContextProps } from '../form/context';
|
import type { FormItemStatusContextProps } from '../form/context';
|
||||||
import { FormItemInputContext } from '../form/context';
|
import { FormItemInputContext } from '../form/context';
|
||||||
import useStyle from './style';
|
import useStyle from './style';
|
||||||
import useCSSVar from './style/cssVar';
|
|
||||||
|
|
||||||
export interface GroupProps {
|
export interface GroupProps {
|
||||||
className?: string;
|
className?: string;
|
||||||
@ -27,8 +26,7 @@ const Group: React.FC<GroupProps> = (props) => {
|
|||||||
const { prefixCls: customizePrefixCls, className } = props;
|
const { prefixCls: customizePrefixCls, className } = props;
|
||||||
const prefixCls = getPrefixCls('input-group', customizePrefixCls);
|
const prefixCls = getPrefixCls('input-group', customizePrefixCls);
|
||||||
const inputPrefixCls = getPrefixCls('input');
|
const inputPrefixCls = getPrefixCls('input');
|
||||||
const [, hashId] = useStyle(inputPrefixCls);
|
const [wrapCSSVar, hashId] = useStyle(inputPrefixCls);
|
||||||
const wrapCSSVar = useCSSVar(prefixCls);
|
|
||||||
const cls = classNames(
|
const cls = classNames(
|
||||||
prefixCls,
|
prefixCls,
|
||||||
{
|
{
|
||||||
|
@ -17,7 +17,6 @@ import { FormItemInputContext, NoFormStyle } from '../form/context';
|
|||||||
import { NoCompactStyle, useCompactItemContext } from '../space/Compact';
|
import { NoCompactStyle, useCompactItemContext } from '../space/Compact';
|
||||||
import useRemovePasswordTimeout from './hooks/useRemovePasswordTimeout';
|
import useRemovePasswordTimeout from './hooks/useRemovePasswordTimeout';
|
||||||
import useStyle from './style';
|
import useStyle from './style';
|
||||||
import useCSSVar from './style/cssVar';
|
|
||||||
import { hasPrefixSuffix } from './utils';
|
import { hasPrefixSuffix } from './utils';
|
||||||
import useCSSVarCls from '../config-provider/hooks/useCSSVarCls';
|
import useCSSVarCls from '../config-provider/hooks/useCSSVarCls';
|
||||||
|
|
||||||
@ -96,9 +95,8 @@ const Input = forwardRef<InputRef, InputProps>((props, ref) => {
|
|||||||
const inputRef = useRef<InputRef>(null);
|
const inputRef = useRef<InputRef>(null);
|
||||||
|
|
||||||
// Style
|
// Style
|
||||||
const [, hashId] = useStyle(prefixCls);
|
|
||||||
const cssVarCls = useCSSVarCls(prefixCls);
|
const cssVarCls = useCSSVarCls(prefixCls);
|
||||||
const wrapCSSVar = useCSSVar(cssVarCls);
|
const [wrapCSSVar, hashId] = useStyle(prefixCls, cssVarCls);
|
||||||
|
|
||||||
// ===================== Compact Item =====================
|
// ===================== Compact Item =====================
|
||||||
const { compactSize, compactItemClassnames } = useCompactItemContext(prefixCls, direction);
|
const { compactSize, compactItemClassnames } = useCompactItemContext(prefixCls, direction);
|
||||||
|
@ -17,7 +17,6 @@ import { FormItemInputContext } from '../form/context';
|
|||||||
import type { InputFocusOptions } from './Input';
|
import type { InputFocusOptions } from './Input';
|
||||||
import { triggerFocus } from './Input';
|
import { triggerFocus } from './Input';
|
||||||
import useStyle from './style';
|
import useStyle from './style';
|
||||||
import useCSSVar from './style/cssVar';
|
|
||||||
import useCSSVarCls from '../config-provider/hooks/useCSSVarCls';
|
import useCSSVarCls from '../config-provider/hooks/useCSSVarCls';
|
||||||
|
|
||||||
export interface TextAreaProps extends Omit<RcTextAreaProps, 'suffix'> {
|
export interface TextAreaProps extends Omit<RcTextAreaProps, 'suffix'> {
|
||||||
@ -85,9 +84,8 @@ const TextArea = forwardRef<TextAreaRef, TextAreaProps>((props, ref) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ===================== Style =====================
|
// ===================== Style =====================
|
||||||
const [, hashId] = useStyle(prefixCls);
|
|
||||||
const cssVarCls = useCSSVarCls(prefixCls);
|
const cssVarCls = useCSSVarCls(prefixCls);
|
||||||
const wrapCSSVar = useCSSVar(cssVarCls);
|
const [wrapCSSVar, hashId] = useStyle(prefixCls, cssVarCls);
|
||||||
|
|
||||||
return wrapCSSVar(
|
return wrapCSSVar(
|
||||||
<RcTextArea
|
<RcTextArea
|
||||||
|
@ -1,4 +0,0 @@
|
|||||||
import { genCSSVarRegister } from '../../theme/internal';
|
|
||||||
import { initComponentToken } from '.';
|
|
||||||
|
|
||||||
export default genCSSVarRegister('Input', initComponentToken);
|
|
@ -1,11 +1,11 @@
|
|||||||
import type { CSSObject } from '@ant-design/cssinjs';
|
import type { CSSObject } from '@ant-design/cssinjs';
|
||||||
|
import { unit } from '@ant-design/cssinjs';
|
||||||
|
|
||||||
import { clearFix, resetComponent } from '../../style';
|
import { clearFix, resetComponent } from '../../style';
|
||||||
import { genCompactItemStyle } from '../../style/compact-item';
|
import { genCompactItemStyle } from '../../style/compact-item';
|
||||||
import type { GlobalToken } from '../../theme/interface';
|
import type { GlobalToken } from '../../theme/interface';
|
||||||
import type { FullToken, GenerateStyle } from '../../theme/internal';
|
import type { FullToken, GenerateStyle } from '../../theme/internal';
|
||||||
import { genComponentStyleHook, mergeToken } from '../../theme/internal';
|
import { genStyleHooks, mergeToken } from '../../theme/internal';
|
||||||
import { unit } from '@ant-design/cssinjs';
|
|
||||||
|
|
||||||
export interface SharedComponentToken {
|
export interface SharedComponentToken {
|
||||||
/**
|
/**
|
||||||
@ -1093,7 +1093,7 @@ export const initComponentToken = (token: GlobalToken): SharedComponentToken =>
|
|||||||
};
|
};
|
||||||
|
|
||||||
// ============================== Export ==============================
|
// ============================== Export ==============================
|
||||||
export default genComponentStyleHook(
|
export default genStyleHooks(
|
||||||
'Input',
|
'Input',
|
||||||
(token) => {
|
(token) => {
|
||||||
const inputToken = mergeToken<InputToken>(token, initInputToken(token));
|
const inputToken = mergeToken<InputToken>(token, initInputToken(token));
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user