@yahoo/uds 3.59.0-beta.1 → 3.59.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli/bin/uds-darwin-arm64-baseline +0 -0
- package/cli/bin/uds-darwin-x64 +0 -0
- package/cli/bin/uds-linux-arm64 +0 -0
- package/cli/bin/uds-linux-x64-baseline +0 -0
- package/dist/components/Box.d.ts +2 -2
- package/dist/components/Box.d.ts.map +1 -1
- package/dist/components/Divider/Divider.d.cts +2 -2
- package/dist/components/Divider/Divider.d.ts +2 -2
- package/dist/components/Divider/DividerCore.d.cts +2 -2
- package/dist/components/Divider/DividerCore.d.ts +2 -2
- package/dist/components/Divider/DividerInternal.d.cts +2 -2
- package/dist/components/Divider/DividerInternal.d.ts +2 -2
- package/dist/components/FormLabel.d.ts +2 -2
- package/dist/components/HStack.d.ts +2 -2
- package/dist/components/Icon.d.ts +2 -2
- package/dist/components/Link.d.ts +2 -2
- package/dist/components/Text.d.cts +5 -5
- package/dist/components/Text.d.cts.map +1 -1
- package/dist/components/Text.d.ts +8 -8
- package/dist/components/Text.d.ts.map +1 -1
- package/dist/components/VStack.d.ts +2 -2
- package/dist/components/VStack.d.ts.map +1 -1
- package/dist/components/client/AnimateHeightChange.d.cts +2 -2
- package/dist/components/client/AnimateHeightChange.d.ts +2 -2
- package/dist/components/client/Avatar/Avatar.d.cts +2 -2
- package/dist/components/client/Avatar/Avatar.d.cts.map +1 -1
- package/dist/components/client/Avatar/Avatar.d.ts +2 -2
- package/dist/components/client/Avatar/AvatarIcon.d.cts +2 -2
- package/dist/components/client/Avatar/AvatarIcon.d.cts.map +1 -1
- package/dist/components/client/Avatar/AvatarIcon.d.ts +2 -2
- package/dist/components/client/Avatar/AvatarImage.d.cts +2 -2
- package/dist/components/client/Avatar/AvatarImage.d.ts +2 -2
- package/dist/components/client/Avatar/AvatarText.d.cts +2 -2
- package/dist/components/client/Avatar/AvatarText.d.ts +2 -2
- package/dist/components/client/IconButton.d.cts +2 -2
- package/dist/components/client/IconButton.d.ts +2 -2
- package/dist/components/client/IconButton.d.ts.map +1 -1
- package/dist/components/client/Input/Input.d.cts +2 -2
- package/dist/components/client/Input/Input.d.ts +2 -2
- package/dist/components/client/Input/InputHelpText.d.cts +2 -2
- package/dist/components/client/Input/InputHelpText.d.cts.map +1 -1
- package/dist/components/client/Input/InputHelpText.d.ts +2 -2
- package/dist/components/client/Input/InputHelpTextInternal.d.cts +4 -4
- package/dist/components/client/Input/InputHelpTextInternal.d.cts.map +1 -1
- package/dist/components/client/Input/InputHelpTextInternal.d.ts +4 -4
- package/dist/components/client/Menu/Menu.Content.d.cts +2 -2
- package/dist/components/client/Menu/Menu.Content.d.ts +2 -2
- package/dist/components/client/Menu/Menu.Divider.d.cts +2 -2
- package/dist/components/client/Menu/Menu.Divider.d.ts +2 -2
- package/dist/components/client/Menu/Menu.Item.d.cts +2 -2
- package/dist/components/client/Menu/Menu.ItemBase.d.cts +2 -2
- package/dist/components/client/Menu/Menu.ItemBase.d.ts +2 -2
- package/dist/components/client/Menu/Menu.ItemCheckbox.d.cts +2 -2
- package/dist/components/client/Menu/Menu.ItemCheckbox.d.ts +2 -2
- package/dist/components/client/Menu/Menu.Provider.d.cts +2 -2
- package/dist/components/client/Menu/Menu.Provider.d.ts +2 -2
- package/dist/components/client/Menu/Menu.Trigger.d.cts +2 -2
- package/dist/components/client/Menu/Menu.Trigger.d.ts +2 -2
- package/dist/components/client/Pressable.d.cts +2 -2
- package/dist/components/client/Pressable.d.ts +2 -2
- package/dist/components/client/Pressable.d.ts.map +1 -1
- package/dist/components/client/Radio/RadioGroupStore.d.ts +2 -2
- package/dist/components/client/SpringMotionConfig.d.cts +3 -3
- package/dist/components/client/SpringMotionConfig.d.ts +3 -3
- package/dist/components/client/SpringMotionConfig.d.ts.map +1 -1
- package/dist/components/experimental/Spinner.d.cts +2 -2
- package/dist/components/experimental/Spinner.d.cts.map +1 -1
- package/dist/components/experimental/Spinner.d.ts +2 -2
- package/dist/components/experimental/Table.d.cts +2 -2
- package/dist/components/experimental/Table.d.ts +2 -2
- package/dist/components/experimental/client/Accordion.d.cts +2 -2
- package/dist/components/experimental/client/Accordion.d.cts.map +1 -1
- package/dist/components/experimental/client/Accordion.d.ts +2 -2
- package/dist/components/experimental/client/AvoidMotionLibraryProvider.d.cts +2 -2
- package/dist/components/experimental/client/AvoidMotionLibraryProvider.d.ts +2 -2
- package/dist/components/experimental/client/Modal.d.cts +3 -3
- package/dist/components/experimental/client/Modal.d.cts.map +1 -1
- package/dist/components/experimental/client/Modal.d.ts +3 -3
- package/dist/components/experimental/client/Popover.d.cts +3 -3
- package/dist/components/experimental/client/Popover.d.cts.map +1 -1
- package/dist/components/experimental/client/Popover.d.ts +3 -3
- package/dist/components/experimental/client/Tabs.d.cts +3 -3
- package/dist/components/experimental/client/Tabs.d.ts +6 -6
- package/dist/components/experimental/client/Toast.d.cts +2 -2
- package/dist/components/experimental/client/Toast.d.ts +2 -2
- package/dist/providers/ColorModeProvider.d.cts +4 -4
- package/dist/providers/ColorModeProvider.d.cts.map +1 -1
- package/dist/providers/ColorModeProvider.d.ts +4 -4
- package/dist/providers/ColorModeProvider.d.ts.map +1 -1
- package/dist/providers/ScaleModeProvider.d.cts +4 -4
- package/dist/providers/ScaleModeProvider.d.cts.map +1 -1
- package/dist/providers/ScaleModeProvider.d.ts +4 -4
- package/dist/providers/ScaleModeProvider.d.ts.map +1 -1
- package/dist/providers/ThemeProvider.d.cts +2 -2
- package/dist/providers/ThemeProvider.d.cts.map +1 -1
- package/dist/providers/ThemeProvider.d.ts +2 -2
- package/dist/styles/styler.d.cts +33 -33
- package/dist/styles/styler.d.ts +33 -33
- package/dist/styles/stylerTypes.d.ts.map +1 -1
- package/dist/tailwind/tailwind.config.d.ts +3 -3
- package/dist/tailwind/tailwindPlugin.d.ts +3 -3
- package/dist/tailwind/utils/getMotionStyles.d.cts +1 -1
- package/dist/tailwind/utils/getMotionStyles.d.ts +1 -1
- package/dist/tokens/automation/utils/getConfigVariantProperties.d.cts +2 -2
- package/dist/tokens/automation/utils/getConfigVariantProperties.d.cts.map +1 -1
- package/dist/tokens/automation/utils/getConfigVariantProperties.d.ts +2 -2
- package/dist/tokens/automation/utils/getConfigVariantProperties.d.ts.map +1 -1
- package/dist/tokens/types.d.cts.map +1 -1
- package/dist/tokens/types.d.ts.map +1 -1
- package/dist/utils/intersperse.d.cts +2 -2
- package/dist/utils/intersperse.d.ts +2 -2
- package/package.json +1 -3
- package/cli/FlattenButtonVariant.mock.tsx +0 -17
- package/src/components/Box.tsx +0 -181
- package/src/components/Divider/Divider.tsx +0 -44
- package/src/components/Divider/DividerCore.tsx +0 -101
- package/src/components/Divider/DividerInternal.tsx +0 -56
- package/src/components/Divider/index.ts +0 -1
- package/src/components/FormLabel.tsx +0 -66
- package/src/components/HStack.tsx +0 -53
- package/src/components/Icon.tsx +0 -82
- package/src/components/IconSlot.tsx +0 -82
- package/src/components/Image.tsx +0 -162
- package/src/components/Link.tsx +0 -134
- package/src/components/Text.tsx +0 -272
- package/src/components/VStack.tsx +0 -53
- package/src/components/client/AnimateHeightChange.tsx +0 -50
- package/src/components/client/Avatar/Avatar.tsx +0 -31
- package/src/components/client/Avatar/AvatarIcon.tsx +0 -103
- package/src/components/client/Avatar/AvatarImage.tsx +0 -147
- package/src/components/client/Avatar/AvatarText.tsx +0 -88
- package/src/components/client/Avatar/index.ts +0 -4
- package/src/components/client/Avatar/utils.ts +0 -105
- package/src/components/client/Badge.tsx +0 -133
- package/src/components/client/Button.tsx +0 -312
- package/src/components/client/Checkbox.tsx +0 -377
- package/src/components/client/Chip/Chip.tsx +0 -81
- package/src/components/client/Chip/ChipBase.tsx +0 -151
- package/src/components/client/Chip/ChipButton.tsx +0 -54
- package/src/components/client/Chip/ChipDismissible.tsx +0 -90
- package/src/components/client/Chip/ChipLink.tsx +0 -60
- package/src/components/client/Chip/ChipToggle.tsx +0 -79
- package/src/components/client/Chip/index.ts +0 -5
- package/src/components/client/IconButton.tsx +0 -198
- package/src/components/client/Input/Input.tsx +0 -323
- package/src/components/client/Input/InputHelpText.tsx +0 -52
- package/src/components/client/Input/InputHelpTextInternal.tsx +0 -81
- package/src/components/client/Input/index.ts +0 -2
- package/src/components/client/Menu/Menu.Content.tsx +0 -391
- package/src/components/client/Menu/Menu.Divider.tsx +0 -102
- package/src/components/client/Menu/Menu.Item.tsx +0 -114
- package/src/components/client/Menu/Menu.ItemBase.tsx +0 -265
- package/src/components/client/Menu/Menu.ItemCheckbox.tsx +0 -197
- package/src/components/client/Menu/Menu.Provider.tsx +0 -154
- package/src/components/client/Menu/Menu.Trigger.tsx +0 -119
- package/src/components/client/Menu/Menu.index.tsx +0 -9
- package/src/components/client/Menu/Menu.tsx +0 -2
- package/src/components/client/Menu/index.ts +0 -7
- package/src/components/client/Menu/utils/transformAriakitPlacement.ts +0 -66
- package/src/components/client/Pressable.tsx +0 -194
- package/src/components/client/Radio/Radio.tsx +0 -351
- package/src/components/client/Radio/RadioGroupProvider.tsx +0 -122
- package/src/components/client/Radio/RadioGroupStore.tsx +0 -56
- package/src/components/client/Radio/index.ts +0 -2
- package/src/components/client/Radio/useRadioGroup.ts +0 -149
- package/src/components/client/SpringMotionConfig.tsx +0 -151
- package/src/components/client/Switch.tsx +0 -377
- package/src/components/client/index.ts +0 -30
- package/src/components/client/motionFeatures/domAnimation.ts +0 -2
- package/src/components/client/motionFeatures/domMax.ts +0 -2
- package/src/components/experimental/Spinner.tsx +0 -30
- package/src/components/experimental/Table.mocks.tsx +0 -38
- package/src/components/experimental/Table.tsx +0 -239
- package/src/components/experimental/client/Accordion.tsx +0 -77
- package/src/components/experimental/client/AvoidMotionLibraryProvider.tsx +0 -10
- package/src/components/experimental/client/Modal.tsx +0 -68
- package/src/components/experimental/client/Popover.tsx +0 -63
- package/src/components/experimental/client/SwitchV2.tsx +0 -343
- package/src/components/experimental/client/Tabs.tsx +0 -106
- package/src/components/experimental/client/Toast.tsx +0 -186
- package/src/components/experimental/client/index.ts +0 -15
- package/src/components/experimental/index.ts +0 -48
- package/src/components/index.ts +0 -41
- package/src/defaultTokensConfig.ts +0 -31
- package/src/fixtures/index.ts +0 -638
- package/src/fixtures/macros/typesToConstants.ts +0 -42
- package/src/fixtures/utils/getScaleModeRamp.ts +0 -48
- package/src/fixtures/utils/getTailwindAsUdsColors.ts +0 -115
- package/src/flags.ts +0 -45
- package/src/hooks/useForkRef.ts +0 -34
- package/src/hooks/useNestedBorderRadius.ts +0 -138
- package/src/hooks/useRtl.ts +0 -64
- package/src/index.ts +0 -4
- package/src/providers/ColorModeProvider.tsx +0 -21
- package/src/providers/ScaleModeProvider.tsx +0 -29
- package/src/providers/ThemeProvider.tsx +0 -26
- package/src/styles/styler.ts +0 -194
- package/src/styles/stylerTypes.ts +0 -81
- package/src/styles/toast.css +0 -0
- package/src/styles/variants.ts +0 -1351
- package/src/tailwind/base/addColorModeVars.ts +0 -23
- package/src/tailwind/base/addColorModeVarsV2.ts +0 -57
- package/src/tailwind/base/addFontFaceDeclarations.ts +0 -13
- package/src/tailwind/base/addFontVars.ts +0 -9
- package/src/tailwind/base/addMotionVars.ts +0 -9
- package/src/tailwind/base/addScaleModeVars.ts +0 -33
- package/src/tailwind/base/types.ts +0 -8
- package/src/tailwind/components/getButtonStyles.ts +0 -240
- package/src/tailwind/components/getFocusRingStyles.ts +0 -32
- package/src/tailwind/components/getGroupedTextStyles.ts +0 -29
- package/src/tailwind/components/getHitTargetStyles.ts +0 -23
- package/src/tailwind/components/getIconButtonStyles.ts +0 -49
- package/src/tailwind/components/getIconStyles.ts +0 -13
- package/src/tailwind/components/getInputStyles.ts +0 -20
- package/src/tailwind/components/getResponsiveTextStyles.ts +0 -161
- package/src/tailwind/components/types.ts +0 -14
- package/src/tailwind/components/utils.ts +0 -73
- package/src/tailwind/defaultTailwindThemeAsUdsConfig.ts +0 -78
- package/src/tailwind/postcss.config.ts +0 -6
- package/src/tailwind/purger/index.ts +0 -1
- package/src/tailwind/tailwind.config.ts +0 -50
- package/src/tailwind/tailwind.d.ts +0 -5
- package/src/tailwind/tailwindPlugin.ts +0 -724
- package/src/tailwind/theme/getFontFamilyTheme.ts +0 -28
- package/src/tailwind/tsMorph.ts +0 -1
- package/src/tailwind/uds.css +0 -3
- package/src/tailwind/utils/addFontsPlugin.ts +0 -17
- package/src/tailwind/utils/getColorModeStyles.ts +0 -21
- package/src/tailwind/utils/getFontFaceDeclarations.ts +0 -12
- package/src/tailwind/utils/getFontStyles.ts +0 -38
- package/src/tailwind/utils/getMotionStyles.ts +0 -35
- package/src/tailwind/utils/getScaleModeStyles.ts +0 -23
- package/src/tailwind/utils/getShadowPresetValues.ts +0 -133
- package/src/tailwind/utils/getShadowStyles.ts +0 -26
- package/src/tailwind/utils/getShadowVars.ts +0 -40
- package/src/tailwind/utils/index.ts +0 -9
- package/src/tokens/automation/configs/avatar.ts +0 -297
- package/src/tokens/automation/configs/badge.ts +0 -306
- package/src/tokens/automation/configs/checkbox.ts +0 -226
- package/src/tokens/automation/configs/chip.ts +0 -521
- package/src/tokens/automation/configs/divider.ts +0 -112
- package/src/tokens/automation/configs/index.ts +0 -10
- package/src/tokens/automation/configs/input.ts +0 -496
- package/src/tokens/automation/configs/link.ts +0 -183
- package/src/tokens/automation/configs/menu.ts +0 -344
- package/src/tokens/automation/configs/radio.ts +0 -225
- package/src/tokens/automation/configs/switch.ts +0 -323
- package/src/tokens/automation/index.ts +0 -5
- package/src/tokens/automation/mapTextVariantFixtureToValue.ts +0 -8
- package/src/tokens/automation/properties.ts +0 -433
- package/src/tokens/automation/types/ComponentConfig.ts +0 -116
- package/src/tokens/automation/types/ComponentDB.ts +0 -1
- package/src/tokens/automation/types/ComponentStyles.ts +0 -47
- package/src/tokens/automation/types/index.ts +0 -2
- package/src/tokens/automation/utils/cartesianProduct.ts +0 -13
- package/src/tokens/automation/utils/coalesceConfigVariant.ts +0 -49
- package/src/tokens/automation/utils/defaults.ts +0 -29
- package/src/tokens/automation/utils/generateKeyFromFlatConfigPath.ts +0 -15
- package/src/tokens/automation/utils/generateSchemaKey.ts +0 -29
- package/src/tokens/automation/utils/getConfigComponentVariant.ts +0 -28
- package/src/tokens/automation/utils/getConfigVariantComponentStatesMatrix.ts +0 -40
- package/src/tokens/automation/utils/getConfigVariantProperties.ts +0 -32
- package/src/tokens/automation/utils/getConfigVariantPseudoStates.ts +0 -70
- package/src/tokens/automation/utils/getConfigVariants.ts +0 -73
- package/src/tokens/automation/utils/index.ts +0 -939
- package/src/tokens/automation/utils/mapColorFixtureToValue.ts +0 -34
- package/src/tokens/automation/utils/subcomponents.ts +0 -13
- package/src/tokens/automation/utils/variableData.ts +0 -79
- package/src/tokens/automation/utils/variantConfigGuards.ts +0 -17
- package/src/tokens/configs/borderRadius.ts +0 -23
- package/src/tokens/configs/borderWidth.ts +0 -17
- package/src/tokens/configs/button.ts +0 -888
- package/src/tokens/configs/colorMode.ts +0 -14
- package/src/tokens/configs/font.ts +0 -9
- package/src/tokens/configs/iconButton.ts +0 -28
- package/src/tokens/configs/motion.ts +0 -135
- package/src/tokens/configs/palette.ts +0 -124
- package/src/tokens/configs/scaleMode.ts +0 -28
- package/src/tokens/configs/shadow.ts +0 -286
- package/src/tokens/configs/sizes.ts +0 -23
- package/src/tokens/configs/spectrum.ts +0 -729
- package/src/tokens/configs/typography.ts +0 -417
- package/src/tokens/configs/yosConfig.ts +0 -7651
- package/src/tokens/consts/buttonMotionTokens.ts +0 -99
- package/src/tokens/consts/cssTokens.ts +0 -110
- package/src/tokens/consts/defaultModes.ts +0 -15
- package/src/tokens/consts/fontDeclarationsMap.ts +0 -509
- package/src/tokens/index.ts +0 -15
- package/src/tokens/parseButtonVariants.ts +0 -59
- package/src/tokens/parseTokens.ts +0 -122
- package/src/tokens/types.ts +0 -1882
- package/src/tokens/utils/entries.ts +0 -14
- package/src/tokens/utils/fromEntries.ts +0 -11
- package/src/tokens/utils/mapValues.ts +0 -15
- package/src/types.ts +0 -2
- package/src/utils/assertUnreachable.ts +0 -6
- package/src/utils/composeRefs.ts +0 -23
- package/src/utils/createSlot.tsx +0 -131
- package/src/utils/entries.ts +0 -6
- package/src/utils/falsyToString.ts +0 -3
- package/src/utils/getMotionVar.ts +0 -18
- package/src/utils/intersperse.ts +0 -45
- package/src/utils/mapValues.ts +0 -15
- package/src/utils/mergeSlotProps.ts +0 -70
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { getColorModeStyles } from '@yahoo/uds/tailwind/utils';
|
|
2
|
-
import {
|
|
3
|
-
DARK_COLOR_MODE_CLASSNAME,
|
|
4
|
-
DEFAULT_COLOR_MODE,
|
|
5
|
-
LIGHT_COLOR_MODE_CLASSNAME,
|
|
6
|
-
} from '@yahoo/uds/tokens';
|
|
7
|
-
import type { WebTokens } from '@yahoo/uds/tokens/parseTokens';
|
|
8
|
-
|
|
9
|
-
import type { TailwindPluginFns } from './types';
|
|
10
|
-
|
|
11
|
-
export function addColorModeVars(
|
|
12
|
-
tokens: WebTokens,
|
|
13
|
-
{ addBase, addRootVariables }: TailwindPluginFns,
|
|
14
|
-
) {
|
|
15
|
-
const styles = getColorModeStyles(tokens);
|
|
16
|
-
|
|
17
|
-
addRootVariables(styles[DEFAULT_COLOR_MODE]);
|
|
18
|
-
|
|
19
|
-
addBase({
|
|
20
|
-
[`.${LIGHT_COLOR_MODE_CLASSNAME}`]: styles.light,
|
|
21
|
-
[`.${DARK_COLOR_MODE_CLASSNAME}`]: styles.dark,
|
|
22
|
-
});
|
|
23
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { getColorModeStyles } from '@yahoo/uds/tailwind/utils';
|
|
2
|
-
import {
|
|
3
|
-
DARK_COLOR_MODE_CLASSNAME,
|
|
4
|
-
DEFAULT_COLOR_MODE,
|
|
5
|
-
INVERT_COLOR_MODE_CLASSNAME,
|
|
6
|
-
LIGHT_COLOR_MODE_CLASSNAME,
|
|
7
|
-
SYSTEM_COLOR_MODE_CLASSNAME,
|
|
8
|
-
} from '@yahoo/uds/tokens';
|
|
9
|
-
import type { WebTokens } from '@yahoo/uds/tokens/parseTokens';
|
|
10
|
-
|
|
11
|
-
import type { TailwindPluginFns } from './types';
|
|
12
|
-
|
|
13
|
-
export function addColorModeVarsV2(
|
|
14
|
-
tokens: WebTokens,
|
|
15
|
-
{ addBase, addRootVariables }: TailwindPluginFns,
|
|
16
|
-
) {
|
|
17
|
-
const styles = getColorModeStyles(tokens);
|
|
18
|
-
|
|
19
|
-
const stylesWithInvert = (key: keyof typeof styles) => {
|
|
20
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
21
|
-
const { colorScheme: _, ...stylesDefault } = styles[key];
|
|
22
|
-
|
|
23
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
24
|
-
const { colorScheme: __, ...stylesInvert } = styles[key === 'light' ? 'dark' : 'light'];
|
|
25
|
-
|
|
26
|
-
return {
|
|
27
|
-
...stylesDefault,
|
|
28
|
-
[`.${INVERT_COLOR_MODE_CLASSNAME}`]: stylesInvert,
|
|
29
|
-
};
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
const lightWithInvert = stylesWithInvert('light');
|
|
33
|
-
const darkWithInvert = stylesWithInvert('dark');
|
|
34
|
-
|
|
35
|
-
addRootVariables({
|
|
36
|
-
colorScheme: DEFAULT_COLOR_MODE,
|
|
37
|
-
...stylesWithInvert(DEFAULT_COLOR_MODE),
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
addBase({
|
|
41
|
-
[`.${SYSTEM_COLOR_MODE_CLASSNAME}`]: {
|
|
42
|
-
colorScheme: 'light dark',
|
|
43
|
-
'@media (prefers-color-scheme: dark)': darkWithInvert,
|
|
44
|
-
},
|
|
45
|
-
|
|
46
|
-
[`.${LIGHT_COLOR_MODE_CLASSNAME}`]: {
|
|
47
|
-
colorScheme: 'light',
|
|
48
|
-
...lightWithInvert,
|
|
49
|
-
// '@media (prefers-color-scheme: dark)': lightWithInvert,
|
|
50
|
-
},
|
|
51
|
-
|
|
52
|
-
[`.${DARK_COLOR_MODE_CLASSNAME}`]: {
|
|
53
|
-
colorScheme: 'dark',
|
|
54
|
-
...darkWithInvert,
|
|
55
|
-
},
|
|
56
|
-
});
|
|
57
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { FontID } from '@yahoo/uds/tokens';
|
|
2
|
-
|
|
3
|
-
import { getFontFaceDeclarations } from '../utils';
|
|
4
|
-
import type { TailwindPluginFns } from './types';
|
|
5
|
-
|
|
6
|
-
export function addFontFaceDeclarations(fontIds: FontID[], { addBase }: TailwindPluginFns) {
|
|
7
|
-
const declarations = getFontFaceDeclarations(fontIds);
|
|
8
|
-
for (const declaration of declarations) {
|
|
9
|
-
addBase({
|
|
10
|
-
'@font-face': declaration,
|
|
11
|
-
});
|
|
12
|
-
}
|
|
13
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { getFontStyles } from '@yahoo/uds/tailwind/utils';
|
|
2
|
-
import type { FontConfig } from '@yahoo/uds/tokens';
|
|
3
|
-
|
|
4
|
-
import type { TailwindPluginFns } from './types';
|
|
5
|
-
|
|
6
|
-
export function addFontVars(config: FontConfig, { addRootVariables }: TailwindPluginFns) {
|
|
7
|
-
const styles = getFontStyles(config);
|
|
8
|
-
addRootVariables(styles);
|
|
9
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { getMotionStyles } from '@yahoo/uds/tailwind/utils';
|
|
2
|
-
import type { MotionConfig } from '@yahoo/uds/tokens';
|
|
3
|
-
|
|
4
|
-
import type { TailwindPluginFns } from './types';
|
|
5
|
-
|
|
6
|
-
export function addMotionVars(config: MotionConfig, { addRootVariables }: TailwindPluginFns) {
|
|
7
|
-
const styles = getMotionStyles(config);
|
|
8
|
-
addRootVariables(styles);
|
|
9
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { getScaleModeStyles } from '@yahoo/uds/tailwind/utils';
|
|
2
|
-
import {
|
|
3
|
-
DEFAULT_SCALE_MODE,
|
|
4
|
-
LARGE_SCALE_MODE_CLASSNAME,
|
|
5
|
-
MEDIUM_SCALE_MODE_CLASSNAME,
|
|
6
|
-
SMALL_SCALE_MODE_CLASSNAME,
|
|
7
|
-
XLARGE_SCALE_MODE_CLASSNAME,
|
|
8
|
-
XSMALL_SCALE_MODE_CLASSNAME,
|
|
9
|
-
XXLARGE_SCALE_MODE_CLASSNAME,
|
|
10
|
-
XXXLARGE_SCALE_MODE_CLASSNAME,
|
|
11
|
-
} from '@yahoo/uds/tokens';
|
|
12
|
-
import type { WebTokens } from '@yahoo/uds/tokens/parseTokens';
|
|
13
|
-
|
|
14
|
-
import type { TailwindPluginFns } from './types';
|
|
15
|
-
|
|
16
|
-
export function addScaleModeVars(
|
|
17
|
-
tokens: WebTokens,
|
|
18
|
-
{ addBase, addRootVariables }: TailwindPluginFns,
|
|
19
|
-
) {
|
|
20
|
-
const styles = getScaleModeStyles(tokens);
|
|
21
|
-
|
|
22
|
-
addRootVariables(styles[DEFAULT_SCALE_MODE]);
|
|
23
|
-
|
|
24
|
-
addBase({
|
|
25
|
-
[`.${XSMALL_SCALE_MODE_CLASSNAME}`]: styles.xSmall,
|
|
26
|
-
[`.${SMALL_SCALE_MODE_CLASSNAME}`]: styles.small,
|
|
27
|
-
[`.${MEDIUM_SCALE_MODE_CLASSNAME}`]: styles.medium,
|
|
28
|
-
[`.${LARGE_SCALE_MODE_CLASSNAME}`]: styles.large,
|
|
29
|
-
[`.${XLARGE_SCALE_MODE_CLASSNAME}`]: styles.xLarge,
|
|
30
|
-
[`.${XXLARGE_SCALE_MODE_CLASSNAME}`]: styles.xxLarge,
|
|
31
|
-
[`.${XXXLARGE_SCALE_MODE_CLASSNAME}`]: styles.xxxLarge,
|
|
32
|
-
});
|
|
33
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { CSSRuleObject } from 'tailwindcss/types/config';
|
|
2
|
-
|
|
3
|
-
export interface TailwindPluginFns {
|
|
4
|
-
addRootVariables: (base: CSSRuleObject) => void;
|
|
5
|
-
addBase: (base: CSSRuleObject | CSSRuleObject[]) => void;
|
|
6
|
-
addComponents: (base: CSSRuleObject | CSSRuleObject[]) => void;
|
|
7
|
-
addUtilities: (base: CSSRuleObject | CSSRuleObject[]) => void;
|
|
8
|
-
}
|
|
@@ -1,240 +0,0 @@
|
|
|
1
|
-
/* -------------------------------------------------------------------------- */
|
|
2
|
-
/* BUTTON STYLES */
|
|
3
|
-
/* -------------------------------------------------------------------------- */
|
|
4
|
-
|
|
5
|
-
import { buttonPalettes, buttonVariants } from '@yahoo/uds/fixtures';
|
|
6
|
-
import type {
|
|
7
|
-
ButtonBaseConfig,
|
|
8
|
-
ButtonClassMap,
|
|
9
|
-
ButtonColorPropertyConfig,
|
|
10
|
-
ButtonConfig,
|
|
11
|
-
ButtonMotionPropertyConfig,
|
|
12
|
-
ButtonPalette,
|
|
13
|
-
ButtonShadowPropertyConfig,
|
|
14
|
-
ButtonSize,
|
|
15
|
-
ButtonVariant,
|
|
16
|
-
} from '@yahoo/uds/tokens';
|
|
17
|
-
import { BUTTON_CSS_VAR_MAP, entries, PSEUDO_STYLE_SELECTOR_MAP } from '@yahoo/uds/tokens';
|
|
18
|
-
|
|
19
|
-
import type { CssStyleObject, ThemeFn } from './types';
|
|
20
|
-
import { getButtonColorForProperty, getButtonScale, getButtonShadowVar, getVar } from './utils';
|
|
21
|
-
|
|
22
|
-
function getStateStyles(
|
|
23
|
-
{
|
|
24
|
-
backgroundColor,
|
|
25
|
-
borderColor,
|
|
26
|
-
color,
|
|
27
|
-
borderRadius,
|
|
28
|
-
borderWidth,
|
|
29
|
-
dropShadow,
|
|
30
|
-
insetShadow,
|
|
31
|
-
}: ButtonMotionPropertyConfig &
|
|
32
|
-
ButtonColorPropertyConfig &
|
|
33
|
-
ButtonShadowPropertyConfig &
|
|
34
|
-
Partial<ButtonBaseConfig>,
|
|
35
|
-
theme: ThemeFn,
|
|
36
|
-
) {
|
|
37
|
-
return {
|
|
38
|
-
[BUTTON_CSS_VAR_MAP.backgroundColor]: getButtonColorForProperty(
|
|
39
|
-
'backgroundColor',
|
|
40
|
-
backgroundColor,
|
|
41
|
-
theme,
|
|
42
|
-
),
|
|
43
|
-
[BUTTON_CSS_VAR_MAP.borderColor]: getButtonColorForProperty('borderColor', borderColor, theme),
|
|
44
|
-
[BUTTON_CSS_VAR_MAP.color]: getButtonColorForProperty('color', color, theme),
|
|
45
|
-
...(dropShadow
|
|
46
|
-
? {
|
|
47
|
-
[BUTTON_CSS_VAR_MAP.dropShadow]: getButtonShadowVar('dropShadow', {
|
|
48
|
-
dropShadow,
|
|
49
|
-
insetShadow,
|
|
50
|
-
}),
|
|
51
|
-
}
|
|
52
|
-
: {}),
|
|
53
|
-
...(insetShadow
|
|
54
|
-
? {
|
|
55
|
-
[BUTTON_CSS_VAR_MAP.insetShadow]: getButtonShadowVar('insetShadow', {
|
|
56
|
-
dropShadow,
|
|
57
|
-
insetShadow,
|
|
58
|
-
}),
|
|
59
|
-
}
|
|
60
|
-
: {}),
|
|
61
|
-
...(borderRadius
|
|
62
|
-
? {
|
|
63
|
-
[BUTTON_CSS_VAR_MAP.borderRadius]: theme(`borderRadius.${borderRadius}`),
|
|
64
|
-
}
|
|
65
|
-
: {}),
|
|
66
|
-
...(borderWidth
|
|
67
|
-
? {
|
|
68
|
-
[BUTTON_CSS_VAR_MAP.borderWidth]: theme(`borderWidth.${borderWidth}`),
|
|
69
|
-
}
|
|
70
|
-
: {}),
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
function getSizeStyles(sizeConfig: ButtonConfig['size'][ButtonSize], theme: ThemeFn) {
|
|
75
|
-
const { spacingHorizontal, spacingVertical, gap, textVariant, iconSize } = sizeConfig;
|
|
76
|
-
const lineHeightVarValue = theme(`typography.lineHeight.${textVariant}`);
|
|
77
|
-
const iconSizeVarValue = theme(`sizing.icon.${iconSize}`);
|
|
78
|
-
return {
|
|
79
|
-
[BUTTON_CSS_VAR_MAP.padding]: `${theme(`spacing[${spacingVertical}]`)} ${theme(`spacing[${spacingHorizontal}]`)}`,
|
|
80
|
-
[BUTTON_CSS_VAR_MAP.columnGap]: theme(`spacing[${gap}]`),
|
|
81
|
-
[BUTTON_CSS_VAR_MAP.fontFamily]: theme(`typography.fontFamily.${textVariant}`),
|
|
82
|
-
[BUTTON_CSS_VAR_MAP.fontWeight]: theme(`typography.fontWeight.${textVariant}`),
|
|
83
|
-
[BUTTON_CSS_VAR_MAP.fontWidth]: theme(`typography.fontWidth.${textVariant}`),
|
|
84
|
-
[BUTTON_CSS_VAR_MAP.fontSlant]: theme(`typography.fontSlant.${textVariant}`),
|
|
85
|
-
[BUTTON_CSS_VAR_MAP.fontSize]: theme(`typography.fontSize.${textVariant}`),
|
|
86
|
-
[BUTTON_CSS_VAR_MAP.lineHeight]: `max(${lineHeightVarValue}, ${iconSizeVarValue})`,
|
|
87
|
-
[BUTTON_CSS_VAR_MAP.textTransform]: theme(`typography.textTransform.${textVariant}`),
|
|
88
|
-
[BUTTON_CSS_VAR_MAP.iconSize]: theme(`sizing.icon.${iconSize}`),
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
function getButtonStyles(button: ButtonConfig, theme: ThemeFn) {
|
|
93
|
-
const defaultVariantConfig = button.palette[button.defaults.palette][button.defaults.variant];
|
|
94
|
-
const defaultSize = button.size[button.defaults.size];
|
|
95
|
-
const defaultRestScale = defaultVariantConfig.base.scale;
|
|
96
|
-
const defaultHoverScale = defaultVariantConfig.effect.hover.scale.value;
|
|
97
|
-
const defaultPressedScale = defaultVariantConfig.effect.pressed.scale.value;
|
|
98
|
-
|
|
99
|
-
const variables = {
|
|
100
|
-
...getStateStyles(defaultVariantConfig.base, theme),
|
|
101
|
-
...getSizeStyles(defaultSize, theme),
|
|
102
|
-
// Set the default scale states
|
|
103
|
-
[BUTTON_CSS_VAR_MAP.effects.scale.rest]: getButtonScale({ scale: defaultRestScale }),
|
|
104
|
-
[BUTTON_CSS_VAR_MAP.effects.scale.hover]: getButtonScale({ scale: defaultHoverScale }),
|
|
105
|
-
[BUTTON_CSS_VAR_MAP.effects.scale.pressed]: getButtonScale({ scale: defaultPressedScale }),
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
// TODO remove these when UD-736 is resolved
|
|
109
|
-
const TMP_transitionStyles = {
|
|
110
|
-
transitionProperty:
|
|
111
|
-
'color, background-color, border-color, box-shadow, text-decoration-color, fill, stroke',
|
|
112
|
-
transitionTimingFunction: 'cubic-bezier(0.4, 0, 0.2, 1)',
|
|
113
|
-
transitionDuration: '220ms',
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
/**
|
|
117
|
-
* Box shadow rule houses three concerns:
|
|
118
|
-
* 1. Border
|
|
119
|
-
* 2. Shadow
|
|
120
|
-
* 3. Inset shadow
|
|
121
|
-
*
|
|
122
|
-
* IMPORTANT: DO NOT SPLIT INTO MULTIPLE LINES, IT CAN BREAK POSTCSS.
|
|
123
|
-
*/
|
|
124
|
-
const boxShadow = `inset 0 0 0 ${getVar(BUTTON_CSS_VAR_MAP, 'borderWidth', variables)} ${getVar(BUTTON_CSS_VAR_MAP, 'borderColor', variables)}, ${getVar(BUTTON_CSS_VAR_MAP, 'dropShadow', variables)}, ${getVar(BUTTON_CSS_VAR_MAP, 'insetShadow', variables)}`;
|
|
125
|
-
|
|
126
|
-
/** Assign variables to configurable properties and fallback with default value */
|
|
127
|
-
const defaultStyles = {
|
|
128
|
-
borderRadius: getVar(BUTTON_CSS_VAR_MAP, 'borderRadius', variables),
|
|
129
|
-
boxShadow,
|
|
130
|
-
color: getVar(BUTTON_CSS_VAR_MAP, 'color', variables),
|
|
131
|
-
backgroundColor: getVar(BUTTON_CSS_VAR_MAP, 'backgroundColor', variables),
|
|
132
|
-
padding: getVar(BUTTON_CSS_VAR_MAP, 'padding', variables),
|
|
133
|
-
fontFamily: getVar(BUTTON_CSS_VAR_MAP, 'fontFamily', variables),
|
|
134
|
-
fontWeight: getVar(BUTTON_CSS_VAR_MAP, 'fontWeight', variables),
|
|
135
|
-
fontSize: getVar(BUTTON_CSS_VAR_MAP, 'fontSize', variables),
|
|
136
|
-
lineHeight: getVar(BUTTON_CSS_VAR_MAP, 'lineHeight', variables),
|
|
137
|
-
textTransform: getVar(BUTTON_CSS_VAR_MAP, 'textTransform', variables),
|
|
138
|
-
display: 'inline-flex',
|
|
139
|
-
justifyContent: 'center',
|
|
140
|
-
overflow: 'hidden', // Ensure truncation works
|
|
141
|
-
alignItems: 'center',
|
|
142
|
-
whiteSpace: 'nowrap',
|
|
143
|
-
userSelect: 'none',
|
|
144
|
-
'font-variation-settings': `"wght" ${getVar(BUTTON_CSS_VAR_MAP, 'fontWeight', variables)}, "slnt" ${getVar(BUTTON_CSS_VAR_MAP, 'fontSlant', variables)}, "wdth" ${getVar(BUTTON_CSS_VAR_MAP, 'fontWidth', variables)}`,
|
|
145
|
-
// Ensure our default vars are _always_ set on the button
|
|
146
|
-
...variables,
|
|
147
|
-
...TMP_transitionStyles,
|
|
148
|
-
};
|
|
149
|
-
|
|
150
|
-
const hoverStyles = getStateStyles(defaultVariantConfig.state.hover, theme);
|
|
151
|
-
const pressedStyles = getStateStyles(defaultVariantConfig.state.pressed, theme);
|
|
152
|
-
|
|
153
|
-
const disabledStyles = {
|
|
154
|
-
cursor: 'not-allowed',
|
|
155
|
-
opacity: '0.2',
|
|
156
|
-
[BUTTON_CSS_VAR_MAP.effects.scale.hover]: getButtonScale({ scale: 'none' }),
|
|
157
|
-
[BUTTON_CSS_VAR_MAP.effects.scale.pressed]: getButtonScale({ scale: 'none' }),
|
|
158
|
-
};
|
|
159
|
-
|
|
160
|
-
const css: CssStyleObject = {
|
|
161
|
-
['.uds-button']: defaultStyles,
|
|
162
|
-
['.uds-button .uds-button-icon']: {
|
|
163
|
-
width: getVar(BUTTON_CSS_VAR_MAP, 'iconSize', variables),
|
|
164
|
-
height: getVar(BUTTON_CSS_VAR_MAP, 'iconSize', variables),
|
|
165
|
-
},
|
|
166
|
-
[`.uds-button${PSEUDO_STYLE_SELECTOR_MAP.hover}`]: hoverStyles,
|
|
167
|
-
[`.uds-button${PSEUDO_STYLE_SELECTOR_MAP.pressed}`]: pressedStyles,
|
|
168
|
-
[`.uds-button${PSEUDO_STYLE_SELECTOR_MAP.disabled}`]: disabledStyles,
|
|
169
|
-
['.disabled .uds-button']: disabledStyles,
|
|
170
|
-
};
|
|
171
|
-
|
|
172
|
-
const pseudoCss = {
|
|
173
|
-
['.hover']: { ['.uds-button']: hoverStyles } as CssStyleObject,
|
|
174
|
-
['.pressed']: { ['.uds-button']: pressedStyles } as CssStyleObject,
|
|
175
|
-
};
|
|
176
|
-
|
|
177
|
-
// Generate styles for each size
|
|
178
|
-
for (const [size, sizeConfig] of entries(button.size)) {
|
|
179
|
-
css[`.uds-button-${size}`] = getSizeStyles(sizeConfig, theme);
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
// Iterate over user config and update variant styles
|
|
183
|
-
function setVariantStyles(
|
|
184
|
-
className: `.${string}`,
|
|
185
|
-
{ palette, variant }: { palette: ButtonPalette; variant: ButtonVariant },
|
|
186
|
-
) {
|
|
187
|
-
const variantConfig = button.palette[palette][variant];
|
|
188
|
-
const base = variantConfig.base;
|
|
189
|
-
const states = variantConfig.state;
|
|
190
|
-
const effects = variantConfig.effect;
|
|
191
|
-
const stateStyles = {
|
|
192
|
-
rest: {
|
|
193
|
-
...getStateStyles(base, theme),
|
|
194
|
-
},
|
|
195
|
-
restScale: {
|
|
196
|
-
[BUTTON_CSS_VAR_MAP.effects.scale.rest]: getButtonScale({ scale: base.scale }),
|
|
197
|
-
[BUTTON_CSS_VAR_MAP.effects.scale.hover]: getButtonScale({
|
|
198
|
-
scale: effects.hover.scale.value,
|
|
199
|
-
}),
|
|
200
|
-
[BUTTON_CSS_VAR_MAP.effects.scale.pressed]: getButtonScale({
|
|
201
|
-
scale: effects.pressed.scale.value,
|
|
202
|
-
}),
|
|
203
|
-
},
|
|
204
|
-
hover: getStateStyles(states.hover, theme),
|
|
205
|
-
pressed: getStateStyles(states.pressed, theme),
|
|
206
|
-
};
|
|
207
|
-
|
|
208
|
-
css[className] = stateStyles.rest;
|
|
209
|
-
css[`${className}${PSEUDO_STYLE_SELECTOR_MAP.notDisabled}`] = stateStyles.restScale;
|
|
210
|
-
css[`${className}${PSEUDO_STYLE_SELECTOR_MAP.hover}`] = stateStyles.hover;
|
|
211
|
-
css[`${className}${PSEUDO_STYLE_SELECTOR_MAP.pressed}`] = stateStyles.pressed;
|
|
212
|
-
pseudoCss['.hover'][className] = stateStyles.hover;
|
|
213
|
-
pseudoCss['.pressed'][className] = stateStyles.pressed;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
// Generate styles for each palette and variant
|
|
217
|
-
for (const palette of buttonPalettes) {
|
|
218
|
-
// Generate styles for each palette and with default variant
|
|
219
|
-
setVariantStyles(`.uds-button-${palette}`, { palette, variant: button.defaults.variant });
|
|
220
|
-
|
|
221
|
-
// Generate styles for each palette and variant combo
|
|
222
|
-
for (const variant of buttonVariants) {
|
|
223
|
-
setVariantStyles(`.uds-button-${palette}.uds-button-${variant}`, { palette, variant });
|
|
224
|
-
|
|
225
|
-
// Generate styles for each variant for default palette
|
|
226
|
-
if (palette === button.defaults.palette) {
|
|
227
|
-
setVariantStyles(`.uds-button-${variant}`, { palette, variant });
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
/** TODO: figure out way to ensure this classMap and what's really being set here is in sync */
|
|
233
|
-
return { ...css, ...pseudoCss } as ButtonClassMap;
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
function getTailwindButtonStyles(button: ButtonConfig, theme: ThemeFn) {
|
|
237
|
-
return getButtonStyles(button, theme) as CssStyleObject;
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
export { getButtonStyles, getTailwindButtonStyles };
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { PSEUDO_STYLE_SELECTOR_MAP } from '@yahoo/uds/tokens';
|
|
2
|
-
|
|
3
|
-
import type { CssStyleObject, ThemeFn } from './types';
|
|
4
|
-
|
|
5
|
-
// Using css vars so consumers have a css only path to customize
|
|
6
|
-
const ringStyles = {
|
|
7
|
-
outlineOffset: 'var(--uds-outline-offset)',
|
|
8
|
-
outlineWidth: 'var(--uds-outline-width)',
|
|
9
|
-
outlineColor: 'var(--uds-outline-color)',
|
|
10
|
-
outlineStyle: 'var(--uds-outline-style)',
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Generates focus ring styles using Tailwind theme values and CSS variables.
|
|
15
|
-
*/
|
|
16
|
-
function getFocusRingStyles({ theme }: { theme: ThemeFn }) {
|
|
17
|
-
return {
|
|
18
|
-
/** Setup vars */
|
|
19
|
-
'.uds-ring': {
|
|
20
|
-
'--uds-outline-offset': theme('outlineOffset.DEFAULT'),
|
|
21
|
-
'--uds-outline-width': theme('outlineWidth.DEFAULT'),
|
|
22
|
-
'--uds-outline-color': theme('outlineColor.DEFAULT'),
|
|
23
|
-
'--uds-outline-style': 'solid', // outlineStyle isn't in the tailwind theme
|
|
24
|
-
},
|
|
25
|
-
/** Apply styles */
|
|
26
|
-
[`.uds-ring${PSEUDO_STYLE_SELECTOR_MAP.focused}`]: ringStyles,
|
|
27
|
-
['.focused .uds-ring']: ringStyles,
|
|
28
|
-
[`.uds-ring.uds-ring-within${PSEUDO_STYLE_SELECTOR_MAP.focusedWithin}`]: ringStyles,
|
|
29
|
-
} as CssStyleObject;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export { getFocusRingStyles };
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { textVariants } from '@yahoo/uds/fixtures';
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
FONT_FAMILY_PREFIX,
|
|
5
|
-
FONT_SIZE_PREFIX,
|
|
6
|
-
FONT_SLANT_PREFIX,
|
|
7
|
-
FONT_WEIGHT_PREFIX,
|
|
8
|
-
FONT_WIDTH_PREFIX,
|
|
9
|
-
LINE_HEIGHT_PREFIX,
|
|
10
|
-
TEXT_TRANSFORM_PREFIX,
|
|
11
|
-
} from '../../tokens/consts/cssTokens';
|
|
12
|
-
import { textVariantsSafe } from './getResponsiveTextStyles';
|
|
13
|
-
|
|
14
|
-
const getGroupedTextStyles = () =>
|
|
15
|
-
Object.fromEntries(
|
|
16
|
-
textVariants.map(textVariantsSafe).map((variant) => [
|
|
17
|
-
`.uds-text-${variant}`,
|
|
18
|
-
{
|
|
19
|
-
fontFamily: `var(--${FONT_FAMILY_PREFIX}-${variant})`,
|
|
20
|
-
fontSize: `var(--${FONT_SIZE_PREFIX}-${variant})`,
|
|
21
|
-
fontWeight: `var(--${FONT_WEIGHT_PREFIX}-${variant})`,
|
|
22
|
-
fontVariationSettings: `"wght" var(--${FONT_WEIGHT_PREFIX}-${variant}), "slnt" var(--${FONT_SLANT_PREFIX}-${variant}), "wdth" var(--${FONT_WIDTH_PREFIX}-${variant})`,
|
|
23
|
-
lineHeight: `var(--${LINE_HEIGHT_PREFIX}-${variant})`,
|
|
24
|
-
textTransform: `var(--${TEXT_TRANSFORM_PREFIX}-${variant})`,
|
|
25
|
-
},
|
|
26
|
-
]),
|
|
27
|
-
);
|
|
28
|
-
|
|
29
|
-
export { getGroupedTextStyles };
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { CssStyleObject } from './types';
|
|
2
|
-
|
|
3
|
-
const MINIMUM_TAP_TARGET = '44px';
|
|
4
|
-
function getHitTargetStyles() {
|
|
5
|
-
return {
|
|
6
|
-
['.uds-hit-target']: {
|
|
7
|
-
position: 'relative',
|
|
8
|
-
},
|
|
9
|
-
['.uds-hit-target::before']: {
|
|
10
|
-
'@media (hover: none)': {
|
|
11
|
-
content: `''`,
|
|
12
|
-
position: 'absolute',
|
|
13
|
-
top: '50%',
|
|
14
|
-
left: '50%',
|
|
15
|
-
width: `max(${MINIMUM_TAP_TARGET}, 100%)`,
|
|
16
|
-
height: `max(${MINIMUM_TAP_TARGET}, 100%)`,
|
|
17
|
-
transform: 'translate(-50%, -50%)',
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
} as CssStyleObject;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export { getHitTargetStyles, MINIMUM_TAP_TARGET };
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import type { IconButtonClassMap, IconButtonSize, UniversalTokensConfig } from '@yahoo/uds/tokens';
|
|
2
|
-
import { entries, ICON_BUTTON_CSS_VAR_MAP } from '@yahoo/uds/tokens';
|
|
3
|
-
|
|
4
|
-
import type { CssStyleObject, ThemeFn } from './types';
|
|
5
|
-
import { getVar } from './utils';
|
|
6
|
-
type IconButtonConfig = Exclude<UniversalTokensConfig['iconButton'], undefined>;
|
|
7
|
-
|
|
8
|
-
function getSizeStyles(sizeConfig: IconButtonConfig['size'][IconButtonSize], theme: ThemeFn) {
|
|
9
|
-
const { spacing, iconSize } = sizeConfig;
|
|
10
|
-
return {
|
|
11
|
-
[ICON_BUTTON_CSS_VAR_MAP.padding]: theme(`spacing[${spacing}]`),
|
|
12
|
-
[ICON_BUTTON_CSS_VAR_MAP.iconSize]: theme(`sizing.icon.${iconSize}`),
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
function getIconButtonStyles(iconButton: IconButtonConfig, theme: ThemeFn) {
|
|
17
|
-
const defaultSize = iconButton.size[iconButton.defaults.size];
|
|
18
|
-
const variables = getSizeStyles(defaultSize, theme);
|
|
19
|
-
|
|
20
|
-
/** Assign variables to configurable properties and fallback with default value */
|
|
21
|
-
const defaultStyles = {
|
|
22
|
-
padding: getVar(ICON_BUTTON_CSS_VAR_MAP, 'padding', variables),
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
const css: CssStyleObject = {
|
|
26
|
-
[`.uds-icon-button`]: {
|
|
27
|
-
display: 'inline-flex',
|
|
28
|
-
alignItems: 'center',
|
|
29
|
-
...defaultStyles,
|
|
30
|
-
},
|
|
31
|
-
['.uds-icon-button .uds-button-icon']: {
|
|
32
|
-
width: getVar(ICON_BUTTON_CSS_VAR_MAP, 'iconSize', variables),
|
|
33
|
-
height: getVar(ICON_BUTTON_CSS_VAR_MAP, 'iconSize', variables),
|
|
34
|
-
},
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
// Generate styles for each size
|
|
38
|
-
for (const [size, sizeConfig] of entries(iconButton.size)) {
|
|
39
|
-
css[`.uds-icon-button-${size}`] = getSizeStyles(sizeConfig, theme);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
return css as IconButtonClassMap;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
function getTailwindIconButtonStyles(iconButton: IconButtonConfig, theme: ThemeFn) {
|
|
46
|
-
return getIconButtonStyles(iconButton, theme) as CssStyleObject;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export { getIconButtonStyles, getTailwindIconButtonStyles };
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { CssStyleObject } from './types';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Generates icon styles for light/dark mode using CSS variables
|
|
5
|
-
*/
|
|
6
|
-
function getIconStyles() {
|
|
7
|
-
return {
|
|
8
|
-
'.uds-light-mode-icon': { display: 'var(--uds-light-mode-icon, inline)' },
|
|
9
|
-
'.uds-dark-mode-icon': { display: 'var(--uds-dark-mode-icon, none)' },
|
|
10
|
-
} as CssStyleObject;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export { getIconStyles };
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { CssStyleObject } from './types';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Generates input styles
|
|
5
|
-
*/
|
|
6
|
-
function getInputStyles() {
|
|
7
|
-
return {
|
|
8
|
-
['.uds-input[list]::-webkit-calendar-picker-indicator']: {
|
|
9
|
-
blockSize: '100% !important', // Fix datalist dropdown arrow positioning.
|
|
10
|
-
},
|
|
11
|
-
['.uds-input::-webkit-datetime-edit']: {
|
|
12
|
-
color: `rgb(var(--uds-foreground-color-muted))`,
|
|
13
|
-
},
|
|
14
|
-
['.uds-input::-webkit-calendar-picker-indicator']: {
|
|
15
|
-
display: 'none',
|
|
16
|
-
},
|
|
17
|
-
} as CssStyleObject;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export { getInputStyles };
|