@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,161 +0,0 @@
|
|
|
1
|
-
import { textVariants } from '@yahoo/uds/fixtures';
|
|
2
|
-
import type { BreakpointWithBase, TypographyStyle, UniversalTokensConfig } from '@yahoo/uds/tokens';
|
|
3
|
-
import { isString } from 'lodash';
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
FONT_FAMILY_PREFIX,
|
|
7
|
-
FONT_SIZE_PREFIX,
|
|
8
|
-
FONT_SLANT_PREFIX,
|
|
9
|
-
FONT_WEIGHT_PREFIX,
|
|
10
|
-
FONT_WIDTH_PREFIX,
|
|
11
|
-
LINE_HEIGHT_PREFIX,
|
|
12
|
-
TEXT_RESPONSIVE_BREAKPOINT_CLASSNAMES,
|
|
13
|
-
TEXT_RESPONSIVE_CLASSNAME,
|
|
14
|
-
TEXT_TRANSFORM_PREFIX,
|
|
15
|
-
} from '../../tokens/consts/cssTokens';
|
|
16
|
-
import { assertUnreachable } from '../../utils/assertUnreachable';
|
|
17
|
-
import { entries } from '../../utils/entries';
|
|
18
|
-
import type { CssStyleObject } from './types';
|
|
19
|
-
|
|
20
|
-
const textVariantsSafe = (variant: string) => variant.replace('/', '-');
|
|
21
|
-
const BASE_SIZE = 16; // Base size in pixels for rem calculations
|
|
22
|
-
|
|
23
|
-
const toRem = (size: number) => `${size / BASE_SIZE}rem`;
|
|
24
|
-
|
|
25
|
-
const mapClassNames = (name: keyof typeof TEXT_RESPONSIVE_BREAKPOINT_CLASSNAMES) =>
|
|
26
|
-
'.' + TEXT_RESPONSIVE_BREAKPOINT_CLASSNAMES[name];
|
|
27
|
-
|
|
28
|
-
const getValue = (
|
|
29
|
-
config: UniversalTokensConfig,
|
|
30
|
-
variant: keyof UniversalTokensConfig['typography'],
|
|
31
|
-
key: keyof TypographyStyle,
|
|
32
|
-
breakpoint: BreakpointWithBase,
|
|
33
|
-
): string => {
|
|
34
|
-
const data = config.typography[variant]?.[key];
|
|
35
|
-
|
|
36
|
-
if (!data) {
|
|
37
|
-
throw new Error(`Missing typography data for variant "${variant}" and key "${key}"`);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
const value = breakpoint === 'base' ? data.base : data.breakpoints?.[breakpoint];
|
|
41
|
-
|
|
42
|
-
if (!value) {
|
|
43
|
-
throw new Error(
|
|
44
|
-
`Missing value for variant "${variant}", key "${key}", and breakpoint "${breakpoint}"`,
|
|
45
|
-
);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
if (isString(value)) {
|
|
49
|
-
return value;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
switch (value.type) {
|
|
53
|
-
case 'px':
|
|
54
|
-
return toRem(value.value);
|
|
55
|
-
case 'unitless':
|
|
56
|
-
return String(value.value);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
return assertUnreachable(value);
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
const convertFontAlias = (config: UniversalTokensConfig, value: string) => {
|
|
63
|
-
if (value in config.font) {
|
|
64
|
-
return `var(--${FONT_FAMILY_PREFIX}-${value})`;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
return value;
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
const cssVariablesForBreakpoint = (config: UniversalTokensConfig, breakpoint: BreakpointWithBase) =>
|
|
71
|
-
Object.fromEntries(
|
|
72
|
-
textVariants.flatMap((variant) => {
|
|
73
|
-
const safeVariant = textVariantsSafe(variant);
|
|
74
|
-
|
|
75
|
-
return [
|
|
76
|
-
[
|
|
77
|
-
`--${FONT_FAMILY_PREFIX}-${safeVariant}`,
|
|
78
|
-
convertFontAlias(config, getValue(config, variant, 'fontFamily', breakpoint)),
|
|
79
|
-
],
|
|
80
|
-
[`--${FONT_SIZE_PREFIX}-${safeVariant}`, getValue(config, variant, 'fontSize', breakpoint)],
|
|
81
|
-
[
|
|
82
|
-
`--${FONT_WEIGHT_PREFIX}-${safeVariant}`,
|
|
83
|
-
getValue(config, variant, 'fontWeight', breakpoint),
|
|
84
|
-
],
|
|
85
|
-
[
|
|
86
|
-
`--${FONT_SLANT_PREFIX}-${safeVariant}`,
|
|
87
|
-
getValue(config, variant, 'fontSlant', breakpoint),
|
|
88
|
-
],
|
|
89
|
-
[
|
|
90
|
-
`--${FONT_WIDTH_PREFIX}-${safeVariant}`,
|
|
91
|
-
getValue(config, variant, 'fontWidth', breakpoint),
|
|
92
|
-
],
|
|
93
|
-
[
|
|
94
|
-
`--${LINE_HEIGHT_PREFIX}-${safeVariant}`,
|
|
95
|
-
getValue(config, variant, 'lineHeight', breakpoint),
|
|
96
|
-
],
|
|
97
|
-
[
|
|
98
|
-
`--${TEXT_TRANSFORM_PREFIX}-${safeVariant}`,
|
|
99
|
-
getValue(config, variant, 'textTransform', breakpoint),
|
|
100
|
-
],
|
|
101
|
-
];
|
|
102
|
-
}),
|
|
103
|
-
) as unknown as CssStyleObject;
|
|
104
|
-
|
|
105
|
-
const tailwindConfigPerVariant = (prefix: string) =>
|
|
106
|
-
Object.fromEntries(
|
|
107
|
-
textVariants.map(textVariantsSafe).map((variant) => [variant, `var(--${prefix}-${variant})`]),
|
|
108
|
-
);
|
|
109
|
-
|
|
110
|
-
const RESPONSIVE_TAILWIND_CONFIG_MAP = {
|
|
111
|
-
fontFamily: tailwindConfigPerVariant(FONT_FAMILY_PREFIX),
|
|
112
|
-
fontWeight: tailwindConfigPerVariant(FONT_WEIGHT_PREFIX),
|
|
113
|
-
fontSlant: tailwindConfigPerVariant(FONT_SLANT_PREFIX),
|
|
114
|
-
fontWidth: tailwindConfigPerVariant(FONT_WIDTH_PREFIX),
|
|
115
|
-
fontSize: tailwindConfigPerVariant(FONT_SIZE_PREFIX),
|
|
116
|
-
lineHeight: tailwindConfigPerVariant(LINE_HEIGHT_PREFIX),
|
|
117
|
-
textTransform: tailwindConfigPerVariant(TEXT_TRANSFORM_PREFIX),
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
const getBaseTextVars = (config: UniversalTokensConfig) => {
|
|
121
|
-
return cssVariablesForBreakpoint(config, 'base');
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
const getResponsiveTextStyles = (config: UniversalTokensConfig) => {
|
|
125
|
-
// Mobile first approach: find the smallest breakpoint
|
|
126
|
-
const breakpoints = entries(config.breakpoints).sort(
|
|
127
|
-
([, { value: minWidthA }], [, { value: minWidthB }]) => minWidthA - minWidthB,
|
|
128
|
-
);
|
|
129
|
-
|
|
130
|
-
return {
|
|
131
|
-
// Order necessary for CSS specificity.
|
|
132
|
-
// 1. Class to opt-in an element and its children to responsive text styles.
|
|
133
|
-
[`.${TEXT_RESPONSIVE_CLASSNAME}`]: Object.fromEntries(
|
|
134
|
-
breakpoints.map(([name, { value: minWidth }]) => [
|
|
135
|
-
// If its the smallest breakpoint, we set the base styles
|
|
136
|
-
`@media (min-width: ${minWidth}px)`,
|
|
137
|
-
cssVariablesForBreakpoint(config, name),
|
|
138
|
-
]),
|
|
139
|
-
),
|
|
140
|
-
|
|
141
|
-
// 2. Classes for locking to a specific breakpoint.
|
|
142
|
-
[mapClassNames('base')]: cssVariablesForBreakpoint(config, 'base'),
|
|
143
|
-
|
|
144
|
-
[mapClassNames('defaultBreakpoint')]: cssVariablesForBreakpoint(
|
|
145
|
-
config,
|
|
146
|
-
config.globalDefaults.breakpoint,
|
|
147
|
-
),
|
|
148
|
-
|
|
149
|
-
...Object.fromEntries(
|
|
150
|
-
breakpoints.map(([name]) => [mapClassNames(name), cssVariablesForBreakpoint(config, name)]),
|
|
151
|
-
),
|
|
152
|
-
} as CssStyleObject;
|
|
153
|
-
};
|
|
154
|
-
|
|
155
|
-
export {
|
|
156
|
-
cssVariablesForBreakpoint,
|
|
157
|
-
getBaseTextVars,
|
|
158
|
-
getResponsiveTextStyles,
|
|
159
|
-
RESPONSIVE_TAILWIND_CONFIG_MAP,
|
|
160
|
-
textVariantsSafe,
|
|
161
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/* -------------------------------------------------------------------------- */
|
|
2
|
-
/* CSS TYPES */
|
|
3
|
-
/* -------------------------------------------------------------------------- */
|
|
4
|
-
import type { CSSRuleObject } from 'tailwindcss/types/config';
|
|
5
|
-
|
|
6
|
-
/** TODO: create typed theme function to ensure valid paths are being used */
|
|
7
|
-
export type ThemeFn = (path: string) => string;
|
|
8
|
-
|
|
9
|
-
export type SimpleStyleObject = Record<string, string> | CSSRuleObject;
|
|
10
|
-
|
|
11
|
-
export type CssStyleObject = Record<
|
|
12
|
-
`.${string}`,
|
|
13
|
-
SimpleStyleObject | Record<string, SimpleStyleObject>
|
|
14
|
-
>;
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { alwaysPaletteAliases, scaleEffectMap } from '@yahoo/uds/fixtures';
|
|
2
|
-
import type {
|
|
3
|
-
AlwaysPaletteAlias,
|
|
4
|
-
ButtonColorProperty,
|
|
5
|
-
ButtonColorPropertyConfig,
|
|
6
|
-
ButtonMotionPropertyConfig,
|
|
7
|
-
ButtonShadowPropertyConfig,
|
|
8
|
-
Hue,
|
|
9
|
-
HueStep,
|
|
10
|
-
} from '@yahoo/uds/tokens';
|
|
11
|
-
import { isString } from 'lodash';
|
|
12
|
-
|
|
13
|
-
import { getShadowLayerValue } from '../utils';
|
|
14
|
-
import type { ThemeFn } from './types';
|
|
15
|
-
|
|
16
|
-
// TODO read from motion config one day
|
|
17
|
-
const DEFAULT_BUTTON_SCALE = 'sm' as const;
|
|
18
|
-
|
|
19
|
-
export function getVar<Key extends string, Value extends `--${string}`>(
|
|
20
|
-
variableMap: Record<Key, Value>,
|
|
21
|
-
lookup: Key,
|
|
22
|
-
fallback: { [key in Value]?: string } | string,
|
|
23
|
-
) {
|
|
24
|
-
const cssVariable = variableMap[lookup];
|
|
25
|
-
const fallbackValue = isString(fallback) ? fallback : fallback?.[cssVariable];
|
|
26
|
-
return fallbackValue
|
|
27
|
-
? (`var(${cssVariable}, ${fallbackValue})` as const)
|
|
28
|
-
: (`var(${cssVariable})` as const);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export function getButtonColorForProperty(
|
|
32
|
-
property: ButtonColorProperty,
|
|
33
|
-
{ type, value }: ButtonColorPropertyConfig[ButtonColorProperty],
|
|
34
|
-
theme: ThemeFn,
|
|
35
|
-
) {
|
|
36
|
-
const tailwindThemeLookup = property === 'color' ? 'textColor' : property;
|
|
37
|
-
if (type === 'palette') {
|
|
38
|
-
if (alwaysPaletteAliases.includes(value as AlwaysPaletteAlias)) {
|
|
39
|
-
return value;
|
|
40
|
-
}
|
|
41
|
-
return theme(`${tailwindThemeLookup}.${value}`);
|
|
42
|
-
} else {
|
|
43
|
-
const [hue, hueStep] = value.split('-') as [Hue, HueStep];
|
|
44
|
-
return theme(`colors.${hue}.${hueStep}`);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export function getButtonScale({ scale }: { scale: ButtonMotionPropertyConfig['scale'] }) {
|
|
49
|
-
// Return the correct scale based on the theme
|
|
50
|
-
return scaleEffectMap[scale][DEFAULT_BUTTON_SCALE];
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export function getButtonShadowVar(
|
|
54
|
-
buttonShadowType: keyof ButtonShadowPropertyConfig,
|
|
55
|
-
shadowConfig: ButtonShadowPropertyConfig,
|
|
56
|
-
) {
|
|
57
|
-
const shadowField = shadowConfig[buttonShadowType];
|
|
58
|
-
const shadowType = buttonShadowType === 'insetShadow' ? 'inset' : 'drop';
|
|
59
|
-
|
|
60
|
-
const noneValue = '0 0 0 transparent';
|
|
61
|
-
|
|
62
|
-
if (shadowField.value === 'none') {
|
|
63
|
-
return noneValue;
|
|
64
|
-
}
|
|
65
|
-
if (shadowField.value !== 'custom') {
|
|
66
|
-
return `var(--uds-${shadowType}-shadow-${shadowField.value})`;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
const customShadowPresetVals = shadowField.config?.map((preset, index) =>
|
|
70
|
-
getShadowLayerValue({ preset, shadowType, prefix: index > 0 ? `${index + 1}` : undefined }),
|
|
71
|
-
);
|
|
72
|
-
return customShadowPresetVals?.join(', ') || noneValue;
|
|
73
|
-
}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import type { BorderRadius, BorderWidth, TextVariant } from '@yahoo/uds/tokens';
|
|
2
|
-
import type defaultTailwindTheme from 'tailwindcss/defaultTheme';
|
|
3
|
-
|
|
4
|
-
type TwFontSizeToExclude = '7xl' | '8xl' | '9xl';
|
|
5
|
-
type TwdFontSize = Exclude<keyof typeof defaultTailwindTheme.fontSize, TwFontSizeToExclude>;
|
|
6
|
-
|
|
7
|
-
const fontSizeMap: Record<Exclude<TextVariant, 'legal1' | 'legal1/emphasized'>, TwdFontSize> = {
|
|
8
|
-
display1: '6xl',
|
|
9
|
-
display2: '5xl',
|
|
10
|
-
display3: '4xl',
|
|
11
|
-
title1: '3xl',
|
|
12
|
-
title2: '2xl',
|
|
13
|
-
title3: 'xl',
|
|
14
|
-
title4: 'lg',
|
|
15
|
-
headline1: 'base',
|
|
16
|
-
body1: 'base',
|
|
17
|
-
label1: 'sm',
|
|
18
|
-
label2: 'sm',
|
|
19
|
-
label3: 'sm',
|
|
20
|
-
label4: 'sm',
|
|
21
|
-
caption1: 'xs',
|
|
22
|
-
caption2: 'xs',
|
|
23
|
-
'display1/emphasized': '6xl',
|
|
24
|
-
'display2/emphasized': '5xl',
|
|
25
|
-
'display3/emphasized': '4xl',
|
|
26
|
-
'title1/emphasized': '3xl',
|
|
27
|
-
'title2/emphasized': '2xl',
|
|
28
|
-
'title3/emphasized': 'xl',
|
|
29
|
-
'title4/emphasized': 'lg',
|
|
30
|
-
'headline1/emphasized': 'base',
|
|
31
|
-
'body1/emphasized': 'base',
|
|
32
|
-
'label1/emphasized': 'sm',
|
|
33
|
-
'label2/emphasized': 'sm',
|
|
34
|
-
'label3/emphasized': 'sm',
|
|
35
|
-
'label4/emphasized': 'sm',
|
|
36
|
-
'caption1/emphasized': 'xs',
|
|
37
|
-
'caption2/emphasized': 'xs',
|
|
38
|
-
ui1: 'xs',
|
|
39
|
-
ui2: 'xs',
|
|
40
|
-
ui3: 'xs',
|
|
41
|
-
ui4: 'xs',
|
|
42
|
-
ui5: 'xs',
|
|
43
|
-
ui6: 'xs',
|
|
44
|
-
'ui1/emphasized': 'xs',
|
|
45
|
-
'ui2/emphasized': 'xs',
|
|
46
|
-
'ui3/emphasized': 'xs',
|
|
47
|
-
'ui4/emphasized': 'xs',
|
|
48
|
-
'ui5/emphasized': 'xs',
|
|
49
|
-
'ui6/emphasized': 'xs',
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
type TwBorderRadiusToExclude = 'none' | '2xl' | '3xl' | 'full';
|
|
53
|
-
type TwBorderRadius = Exclude<
|
|
54
|
-
keyof typeof defaultTailwindTheme.borderRadius,
|
|
55
|
-
TwBorderRadiusToExclude
|
|
56
|
-
>;
|
|
57
|
-
const borderRadiusMap: Record<Exclude<BorderRadius, 'none' | 'full'>, TwBorderRadius> = {
|
|
58
|
-
xs: 'sm',
|
|
59
|
-
sm: 'DEFAULT',
|
|
60
|
-
md: 'md',
|
|
61
|
-
lg: 'lg',
|
|
62
|
-
xl: 'xl',
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
type TwBorderWidthToExclude = '0' | '8';
|
|
66
|
-
type TwBorderWidth = Exclude<keyof typeof defaultTailwindTheme.borderWidth, TwBorderWidthToExclude>;
|
|
67
|
-
const borderWidthMap: Record<Exclude<BorderWidth, 'none'>, TwBorderWidth> = {
|
|
68
|
-
thin: 'DEFAULT',
|
|
69
|
-
medium: '2',
|
|
70
|
-
thick: '4',
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
export const udsToTailwindMap = {
|
|
74
|
-
fontSize: fontSizeMap,
|
|
75
|
-
lineHeight: fontSizeMap,
|
|
76
|
-
borderRadius: borderRadiusMap,
|
|
77
|
-
borderWidth: borderWidthMap,
|
|
78
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from '../../../generated/tailwindPurge';
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
DARK_COLOR_MODE_CLASSNAME,
|
|
3
|
-
INVERT_COLOR_MODE_CLASSNAME,
|
|
4
|
-
LARGE_SCALE_MODE_CLASSNAME,
|
|
5
|
-
LIGHT_COLOR_MODE_CLASSNAME,
|
|
6
|
-
MEDIUM_SCALE_MODE_CLASSNAME,
|
|
7
|
-
SMALL_SCALE_MODE_CLASSNAME,
|
|
8
|
-
SYSTEM_COLOR_MODE_CLASSNAME,
|
|
9
|
-
XLARGE_SCALE_MODE_CLASSNAME,
|
|
10
|
-
XSMALL_SCALE_MODE_CLASSNAME,
|
|
11
|
-
XXLARGE_SCALE_MODE_CLASSNAME,
|
|
12
|
-
XXXLARGE_SCALE_MODE_CLASSNAME,
|
|
13
|
-
} from '@yahoo/uds/tokens';
|
|
14
|
-
import type { Config } from 'tailwindcss';
|
|
15
|
-
|
|
16
|
-
import { defaultTokensConfig } from '../defaultTokensConfig';
|
|
17
|
-
import { tailwindPlugin } from './tailwindPlugin';
|
|
18
|
-
|
|
19
|
-
const classNames = [
|
|
20
|
-
INVERT_COLOR_MODE_CLASSNAME,
|
|
21
|
-
SYSTEM_COLOR_MODE_CLASSNAME,
|
|
22
|
-
DARK_COLOR_MODE_CLASSNAME,
|
|
23
|
-
LARGE_SCALE_MODE_CLASSNAME,
|
|
24
|
-
LIGHT_COLOR_MODE_CLASSNAME,
|
|
25
|
-
MEDIUM_SCALE_MODE_CLASSNAME,
|
|
26
|
-
SMALL_SCALE_MODE_CLASSNAME,
|
|
27
|
-
XLARGE_SCALE_MODE_CLASSNAME,
|
|
28
|
-
XSMALL_SCALE_MODE_CLASSNAME,
|
|
29
|
-
XXLARGE_SCALE_MODE_CLASSNAME,
|
|
30
|
-
XXXLARGE_SCALE_MODE_CLASSNAME,
|
|
31
|
-
].join(' ');
|
|
32
|
-
|
|
33
|
-
const config = {
|
|
34
|
-
content: [
|
|
35
|
-
{
|
|
36
|
-
raw: `<div class="${classNames}">`,
|
|
37
|
-
extension: 'html',
|
|
38
|
-
},
|
|
39
|
-
],
|
|
40
|
-
theme: {},
|
|
41
|
-
plugins: [tailwindPlugin({ config: defaultTokensConfig })],
|
|
42
|
-
safelist: [
|
|
43
|
-
{
|
|
44
|
-
pattern: /./,
|
|
45
|
-
},
|
|
46
|
-
],
|
|
47
|
-
} satisfies Config;
|
|
48
|
-
|
|
49
|
-
// eslint-disable-next-line import/no-default-export
|
|
50
|
-
export default config;
|