@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,509 +0,0 @@
|
|
|
1
|
-
import type { FontID, FontType } from '../types';
|
|
2
|
-
|
|
3
|
-
const UDS_FONTS_CDN_PREFIX = 'https://s.yimg.com/bw/fonts';
|
|
4
|
-
|
|
5
|
-
const sansFallbacks = ['Helvetica Neue', 'Helvetica', 'Arial', 'sans-serif'];
|
|
6
|
-
const serifFallbacks = ['Georgia', 'Times', 'Times New Roman', 'serif'];
|
|
7
|
-
const monoFallbacks = [
|
|
8
|
-
'ui-monospace',
|
|
9
|
-
'SFMono-Regular',
|
|
10
|
-
'Menlo',
|
|
11
|
-
'Monaco',
|
|
12
|
-
'Consolas',
|
|
13
|
-
'Liberation Mono',
|
|
14
|
-
'Courier New',
|
|
15
|
-
'monospace',
|
|
16
|
-
];
|
|
17
|
-
|
|
18
|
-
export const FONT_DECLARATIONS_MAP = {
|
|
19
|
-
'centra-no2': {
|
|
20
|
-
fallback: sansFallbacks,
|
|
21
|
-
type: 'sans',
|
|
22
|
-
fontFamily: 'Centra No2',
|
|
23
|
-
isVariableFont: false,
|
|
24
|
-
fontSlants: undefined,
|
|
25
|
-
fontWidths: undefined,
|
|
26
|
-
fontWeights: [
|
|
27
|
-
{ label: 'Hairline', value: 50 },
|
|
28
|
-
{ label: 'Thin', value: 100 },
|
|
29
|
-
{ label: 'Light', value: 300 },
|
|
30
|
-
{ label: 'Book', value: 400 },
|
|
31
|
-
{ label: 'Medium', value: 500 },
|
|
32
|
-
{ label: 'Bold', value: 700 },
|
|
33
|
-
{ label: 'ExtraBold', value: 800 },
|
|
34
|
-
{ label: 'Black', value: 900 },
|
|
35
|
-
],
|
|
36
|
-
defaults: {
|
|
37
|
-
fontSlant: undefined,
|
|
38
|
-
fontWidth: undefined,
|
|
39
|
-
fontWeight: 400,
|
|
40
|
-
},
|
|
41
|
-
declarations: [
|
|
42
|
-
{
|
|
43
|
-
fontStyle: 'normal',
|
|
44
|
-
fontWeight: '50',
|
|
45
|
-
src: `url('${UDS_FONTS_CDN_PREFIX}/centra-no2-hairline.woff2') format('woff2')`,
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
fontStyle: 'italic',
|
|
49
|
-
fontWeight: '50',
|
|
50
|
-
src: `url('${UDS_FONTS_CDN_PREFIX}/centra-no2-hairline-italic.woff2') format('woff2')`,
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
fontStyle: 'normal',
|
|
54
|
-
fontWeight: '100',
|
|
55
|
-
src: `url('${UDS_FONTS_CDN_PREFIX}/centra-no2-thin.woff2') format('woff2')`,
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
fontStyle: 'italic',
|
|
59
|
-
fontWeight: '100',
|
|
60
|
-
src: `url('${UDS_FONTS_CDN_PREFIX}/centra-no2-thin-italic.woff2') format('woff2')`,
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
fontStyle: 'normal',
|
|
64
|
-
fontWeight: '300',
|
|
65
|
-
src: `url('${UDS_FONTS_CDN_PREFIX}/centra-no2-light.woff2') format('woff2')`,
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
fontStyle: 'italic',
|
|
69
|
-
fontWeight: '300',
|
|
70
|
-
src: `url('${UDS_FONTS_CDN_PREFIX}/centra-no2-light-italic.woff2') format('woff2')`,
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
fontStyle: 'normal',
|
|
74
|
-
fontWeight: '400',
|
|
75
|
-
src: `url('${UDS_FONTS_CDN_PREFIX}/centra-no2-book.woff2') format('woff2')`,
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
fontStyle: 'italic',
|
|
79
|
-
fontWeight: '400',
|
|
80
|
-
src: `url('${UDS_FONTS_CDN_PREFIX}/centra-no2-book-italic.woff2') format('woff2')`,
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
fontStyle: 'normal',
|
|
84
|
-
fontWeight: '500',
|
|
85
|
-
src: `url('${UDS_FONTS_CDN_PREFIX}/centra-no2-medium.woff2') format('woff2')`,
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
fontStyle: 'italic',
|
|
89
|
-
fontWeight: '500',
|
|
90
|
-
src: `url('${UDS_FONTS_CDN_PREFIX}/centra-no2-medium-italic.woff2') format('woff2')`,
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
fontStyle: 'normal',
|
|
94
|
-
fontWeight: '700',
|
|
95
|
-
src: `url('${UDS_FONTS_CDN_PREFIX}/centra-no2-bold.woff2') format('woff2')`,
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
fontStyle: 'italic',
|
|
99
|
-
fontWeight: '700',
|
|
100
|
-
src: `url('${UDS_FONTS_CDN_PREFIX}/centra-no2-bold-italic.woff2') format('woff2')`,
|
|
101
|
-
},
|
|
102
|
-
{
|
|
103
|
-
fontStyle: 'normal',
|
|
104
|
-
fontWeight: '800',
|
|
105
|
-
src: `url('${UDS_FONTS_CDN_PREFIX}/centra-no2-extrabold.woff2') format('woff2')`,
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
fontStyle: 'italic',
|
|
109
|
-
fontWeight: '800',
|
|
110
|
-
src: `url('${UDS_FONTS_CDN_PREFIX}/centra-no2-extrabold-italic.woff2') format('woff2')`,
|
|
111
|
-
},
|
|
112
|
-
{
|
|
113
|
-
fontStyle: 'normal',
|
|
114
|
-
fontWeight: '900',
|
|
115
|
-
src: `url('${UDS_FONTS_CDN_PREFIX}/centra-no2-black.woff2') format('woff2')`,
|
|
116
|
-
},
|
|
117
|
-
{
|
|
118
|
-
fontStyle: 'italic',
|
|
119
|
-
fontWeight: '900',
|
|
120
|
-
src: `url('${UDS_FONTS_CDN_PREFIX}/centra-no2-black-italic.woff2') format('woff2')`,
|
|
121
|
-
},
|
|
122
|
-
],
|
|
123
|
-
},
|
|
124
|
-
inter: {
|
|
125
|
-
fallback: sansFallbacks,
|
|
126
|
-
type: 'sans',
|
|
127
|
-
fontFamily: 'Inter',
|
|
128
|
-
isVariableFont: true,
|
|
129
|
-
fontSlants: [
|
|
130
|
-
{ label: 'Italic', value: -10 },
|
|
131
|
-
{ label: 'None', value: 0 },
|
|
132
|
-
],
|
|
133
|
-
fontWidths: undefined,
|
|
134
|
-
fontWeights: [
|
|
135
|
-
{ label: 'Thin', value: 100 },
|
|
136
|
-
{ label: 'Extra Light', value: 200 },
|
|
137
|
-
{ label: 'Light', value: 300 },
|
|
138
|
-
{ label: 'Regular', value: 400 },
|
|
139
|
-
{ label: 'Medium', value: 500 },
|
|
140
|
-
{ label: 'Semi Bold', value: 600 },
|
|
141
|
-
{ label: 'Bold', value: 700 },
|
|
142
|
-
{ label: 'Extra Bold', value: 800 },
|
|
143
|
-
{ label: 'Black', value: 900 },
|
|
144
|
-
],
|
|
145
|
-
defaults: {
|
|
146
|
-
fontSlant: 0,
|
|
147
|
-
fontWidth: undefined,
|
|
148
|
-
fontWeight: 400,
|
|
149
|
-
},
|
|
150
|
-
declarations: [
|
|
151
|
-
{
|
|
152
|
-
/** TODO: We can make performant by only including font weights used for this font in config */
|
|
153
|
-
fontWeight: '1 1000',
|
|
154
|
-
src: `url('${UDS_FONTS_CDN_PREFIX}/inter-vf.woff2') format('woff2')`,
|
|
155
|
-
},
|
|
156
|
-
],
|
|
157
|
-
},
|
|
158
|
-
'roboto-mono': {
|
|
159
|
-
fallback: monoFallbacks,
|
|
160
|
-
type: 'mono',
|
|
161
|
-
fontFamily: 'Roboto Mono',
|
|
162
|
-
isVariableFont: false,
|
|
163
|
-
fontSlants: undefined,
|
|
164
|
-
fontWidths: undefined,
|
|
165
|
-
fontWeights: [
|
|
166
|
-
{ label: 'Thin', value: 100 },
|
|
167
|
-
{ label: 'Light', value: 300 },
|
|
168
|
-
{ label: 'Regular', value: 400 },
|
|
169
|
-
{ label: 'Medium', value: 500 },
|
|
170
|
-
{ label: 'Bold', value: 700 },
|
|
171
|
-
],
|
|
172
|
-
defaults: {
|
|
173
|
-
fontSlant: undefined,
|
|
174
|
-
fontWidth: undefined,
|
|
175
|
-
fontWeight: 400,
|
|
176
|
-
},
|
|
177
|
-
declarations: [
|
|
178
|
-
{
|
|
179
|
-
fontStyle: 'normal',
|
|
180
|
-
fontWeight: '100',
|
|
181
|
-
src: `url('${UDS_FONTS_CDN_PREFIX}/roboto-mono-100.woff2') format('woff2')`,
|
|
182
|
-
},
|
|
183
|
-
{
|
|
184
|
-
fontStyle: 'italic',
|
|
185
|
-
fontWeight: '100',
|
|
186
|
-
src: `url('${UDS_FONTS_CDN_PREFIX}/roboto-mono-100-italic.woff2') format('woff2')`,
|
|
187
|
-
},
|
|
188
|
-
{
|
|
189
|
-
fontStyle: 'normal',
|
|
190
|
-
fontWeight: '300',
|
|
191
|
-
src: `url('${UDS_FONTS_CDN_PREFIX}/roboto-mono-300.woff2') format('woff2')`,
|
|
192
|
-
},
|
|
193
|
-
{
|
|
194
|
-
fontStyle: 'italic',
|
|
195
|
-
fontWeight: '300',
|
|
196
|
-
src: `url('${UDS_FONTS_CDN_PREFIX}/roboto-mono-300-italic.woff2') format('woff2')`,
|
|
197
|
-
},
|
|
198
|
-
{
|
|
199
|
-
fontStyle: 'normal',
|
|
200
|
-
fontWeight: '400',
|
|
201
|
-
src: `url('${UDS_FONTS_CDN_PREFIX}/roboto-mono-400.woff2') format('woff2')`,
|
|
202
|
-
},
|
|
203
|
-
{
|
|
204
|
-
fontStyle: 'italic',
|
|
205
|
-
fontWeight: '400',
|
|
206
|
-
src: `url('${UDS_FONTS_CDN_PREFIX}/roboto-mono-400-italic.woff2') format('woff2')`,
|
|
207
|
-
},
|
|
208
|
-
{
|
|
209
|
-
fontStyle: 'normal',
|
|
210
|
-
fontWeight: '500',
|
|
211
|
-
src: `url('${UDS_FONTS_CDN_PREFIX}/roboto-mono-500.woff2') format('woff2')`,
|
|
212
|
-
},
|
|
213
|
-
{
|
|
214
|
-
fontStyle: 'italic',
|
|
215
|
-
fontWeight: '500',
|
|
216
|
-
src: `url('${UDS_FONTS_CDN_PREFIX}/roboto-mono-500-italic.woff2') format('woff2')`,
|
|
217
|
-
},
|
|
218
|
-
{
|
|
219
|
-
fontStyle: 'normal',
|
|
220
|
-
fontWeight: '700',
|
|
221
|
-
src: `url('${UDS_FONTS_CDN_PREFIX}/roboto-mono-700.woff2') format('woff2')`,
|
|
222
|
-
},
|
|
223
|
-
{
|
|
224
|
-
fontStyle: 'italic',
|
|
225
|
-
fontWeight: '700',
|
|
226
|
-
src: `url('${UDS_FONTS_CDN_PREFIX}/roboto-mono-700-italic.woff2') format('woff2')`,
|
|
227
|
-
},
|
|
228
|
-
],
|
|
229
|
-
},
|
|
230
|
-
'yahoo-sans': {
|
|
231
|
-
fallback: sansFallbacks,
|
|
232
|
-
type: 'sans',
|
|
233
|
-
fontFamily: 'Yahoo Sans',
|
|
234
|
-
isVariableFont: true,
|
|
235
|
-
fontSlants: undefined,
|
|
236
|
-
fontWidths: undefined,
|
|
237
|
-
fontWeights: [
|
|
238
|
-
{ label: 'ExtraLight', value: 200 },
|
|
239
|
-
{ label: 'Light', value: 300 },
|
|
240
|
-
{ label: 'Regular', value: 400 },
|
|
241
|
-
{ label: 'Medium', value: 500 },
|
|
242
|
-
{ label: 'Semibold', value: 585 },
|
|
243
|
-
{ label: 'Bold', value: 700 },
|
|
244
|
-
{ label: 'ExtraBold', value: 810 },
|
|
245
|
-
{ label: 'Black', value: 900 },
|
|
246
|
-
],
|
|
247
|
-
defaults: {
|
|
248
|
-
fontSlant: undefined,
|
|
249
|
-
fontWidth: undefined,
|
|
250
|
-
fontWeight: 400,
|
|
251
|
-
},
|
|
252
|
-
declarations: [
|
|
253
|
-
{
|
|
254
|
-
/** TODO: We can make performant by only including font weights used for this font in config */
|
|
255
|
-
fontWeight: '1 1000',
|
|
256
|
-
src: `url('${UDS_FONTS_CDN_PREFIX}/yahoo-sans-vf.woff2') format('woff2')`,
|
|
257
|
-
},
|
|
258
|
-
],
|
|
259
|
-
},
|
|
260
|
-
'yahoo-sans-cr4': {
|
|
261
|
-
fallback: sansFallbacks,
|
|
262
|
-
type: 'sans',
|
|
263
|
-
fontFamily: 'Yahoo CR4 BETA VF',
|
|
264
|
-
|
|
265
|
-
isVariableFont: true,
|
|
266
|
-
fontSlants: undefined,
|
|
267
|
-
fontWidths: undefined,
|
|
268
|
-
fontWeights: [
|
|
269
|
-
/**
|
|
270
|
-
* brand guide https://www.figma.com/design/3gDo09eKkxvq6qgHw9Epa2/Product-Visual-Guidance?node-id=41-6148&p=f&t=8NHi3cv3QtiieZNv-0
|
|
271
|
-
* says Regular should be 450, but variable font has regular at 400
|
|
272
|
-
*/
|
|
273
|
-
{ label: 'Regular', value: 400 },
|
|
274
|
-
{ label: 'Medium', value: 500 },
|
|
275
|
-
{ label: 'Bold', value: 700 },
|
|
276
|
-
],
|
|
277
|
-
defaults: {
|
|
278
|
-
fontSlant: undefined,
|
|
279
|
-
fontWidth: undefined,
|
|
280
|
-
fontWeight: 450,
|
|
281
|
-
},
|
|
282
|
-
declarations: [
|
|
283
|
-
{
|
|
284
|
-
/** TODO: We can make performant by only including font weights used for this font in config */
|
|
285
|
-
fontWeight: '1 1000',
|
|
286
|
-
src: `url('${UDS_FONTS_CDN_PREFIX}/yahoo-sans-cr4-vf.woff2') format('woff2')`,
|
|
287
|
-
},
|
|
288
|
-
],
|
|
289
|
-
},
|
|
290
|
-
'yahoo-product-sans': {
|
|
291
|
-
fallback: sansFallbacks,
|
|
292
|
-
type: 'sans',
|
|
293
|
-
fontFamily: 'Yahoo Product Sans VF',
|
|
294
|
-
isVariableFont: true,
|
|
295
|
-
fontSlants: undefined,
|
|
296
|
-
fontWidths: undefined,
|
|
297
|
-
fontWeights: [
|
|
298
|
-
/**
|
|
299
|
-
* brand guide https://www.figma.com/design/3gDo09eKkxvq6qgHw9Epa2/Product-Visual-Guidance?node-id=41-6148&p=f&t=8NHi3cv3QtiieZNv-0
|
|
300
|
-
* says Regular should be 450, but variable font has regular at 400
|
|
301
|
-
*/
|
|
302
|
-
{ label: 'Regular', value: 400 },
|
|
303
|
-
{ label: 'Medium', value: 500 },
|
|
304
|
-
{ label: 'Bold', value: 700 },
|
|
305
|
-
],
|
|
306
|
-
defaults: {
|
|
307
|
-
fontSlant: undefined,
|
|
308
|
-
fontWidth: undefined,
|
|
309
|
-
fontWeight: 450,
|
|
310
|
-
},
|
|
311
|
-
declarations: [
|
|
312
|
-
{
|
|
313
|
-
/** TODO: We can make performant by only including font weights used for this font in config */
|
|
314
|
-
fontWeight: '1 1000',
|
|
315
|
-
src: `url('${UDS_FONTS_CDN_PREFIX}/yahoo-product-sans-vf.woff2') format('woff2-variations')`,
|
|
316
|
-
},
|
|
317
|
-
],
|
|
318
|
-
},
|
|
319
|
-
'yahoo-product-sans-extended': {
|
|
320
|
-
fallback: sansFallbacks,
|
|
321
|
-
type: 'sans',
|
|
322
|
-
fontFamily: 'YahooPd_Eval202412',
|
|
323
|
-
isVariableFont: true,
|
|
324
|
-
fontSlants: [
|
|
325
|
-
{ label: 'Italic', value: 9 },
|
|
326
|
-
{ label: 'None', value: 0 },
|
|
327
|
-
],
|
|
328
|
-
fontWidths: [
|
|
329
|
-
{ label: 'Cond', value: 50 },
|
|
330
|
-
{ label: 'Normal', value: 75 },
|
|
331
|
-
{ label: 'Ext', value: 100 },
|
|
332
|
-
],
|
|
333
|
-
fontWeights: [
|
|
334
|
-
{ label: 'Light', value: 300 },
|
|
335
|
-
/**
|
|
336
|
-
* brand guide https://www.figma.com/design/3gDo09eKkxvq6qgHw9Epa2/Product-Visual-Guidance?node-id=41-6148&p=f&t=8NHi3cv3QtiieZNv-0
|
|
337
|
-
* says Regular should be 450, but variable font has regular at 400.
|
|
338
|
-
* Going to use value from brand guide of 450 vs font file value of 400.
|
|
339
|
-
*/
|
|
340
|
-
{ label: 'Regular', value: 450 },
|
|
341
|
-
{ label: 'Medium', value: 500 },
|
|
342
|
-
/**
|
|
343
|
-
* Brand guide https://www.figma.com/design/3gDo09eKkxvq6qgHw9Epa2/Product-Visual-Guidance?node-id=41-6148&p=f&t=8NHi3cv3QtiieZNv-0
|
|
344
|
-
* says 600 should be labeled as Emphasized, but variable font has 600 labeled as Semibold.
|
|
345
|
-
* Going to use naming from brand guide of Emphasized vs font file name of Semibold.
|
|
346
|
-
*/
|
|
347
|
-
{ label: 'Semibold', value: 600 },
|
|
348
|
-
{ label: 'Bold', value: 700 },
|
|
349
|
-
{ label: 'Black', value: 850 },
|
|
350
|
-
],
|
|
351
|
-
defaults: {
|
|
352
|
-
fontSlant: 0,
|
|
353
|
-
fontWidth: 75,
|
|
354
|
-
fontWeight: 450,
|
|
355
|
-
},
|
|
356
|
-
declarations: [
|
|
357
|
-
{
|
|
358
|
-
/** TODO: We can make performant by only including font weights used for this font in config */
|
|
359
|
-
fontWeight: '1 1000',
|
|
360
|
-
src: `url('${UDS_FONTS_CDN_PREFIX}/YahooPd_Eval202412-v1.1.0.woff2') format("woff2 supports variations"), url('${UDS_FONTS_CDN_PREFIX}/YahooPd_Eval202412-v1.1.0.woff2') format('woff2-variations')`,
|
|
361
|
-
},
|
|
362
|
-
],
|
|
363
|
-
},
|
|
364
|
-
'yahoo-sans-condensed': {
|
|
365
|
-
fallback: sansFallbacks,
|
|
366
|
-
type: 'sans',
|
|
367
|
-
fontFamily: 'Yahoo Sans Cond',
|
|
368
|
-
isVariableFont: true,
|
|
369
|
-
fontSlants: undefined,
|
|
370
|
-
fontWidths: undefined,
|
|
371
|
-
fontWeights: [
|
|
372
|
-
{ label: 'Light', value: 300 },
|
|
373
|
-
{ label: 'Regular', value: 400 },
|
|
374
|
-
{ label: 'Medium', value: 500 },
|
|
375
|
-
{ label: 'Bold', value: 718 },
|
|
376
|
-
{ label: 'XBold', value: 800 },
|
|
377
|
-
{ label: 'Black', value: 900 },
|
|
378
|
-
],
|
|
379
|
-
defaults: {
|
|
380
|
-
fontSlant: undefined,
|
|
381
|
-
fontWidth: undefined,
|
|
382
|
-
fontWeight: 400,
|
|
383
|
-
},
|
|
384
|
-
declarations: [
|
|
385
|
-
{
|
|
386
|
-
/** TODO: We can make performant by only including font weights used for this font in config */
|
|
387
|
-
fontWeight: '1 1000',
|
|
388
|
-
src: `url('${UDS_FONTS_CDN_PREFIX}/yahoo-sans-condensed-vf.woff2') format('woff2')`,
|
|
389
|
-
},
|
|
390
|
-
],
|
|
391
|
-
},
|
|
392
|
-
'yahoo-serif-display': {
|
|
393
|
-
fallback: serifFallbacks,
|
|
394
|
-
type: 'serif',
|
|
395
|
-
fontFamily: 'Yahoo Serif Display',
|
|
396
|
-
isVariableFont: false,
|
|
397
|
-
fontSlants: undefined,
|
|
398
|
-
fontWidths: undefined,
|
|
399
|
-
fontWeights: [
|
|
400
|
-
{ label: 'Light', value: 300 },
|
|
401
|
-
{ label: 'Regular', value: 400 },
|
|
402
|
-
{ label: 'Bold', value: 700 },
|
|
403
|
-
{ label: 'Extrabold', value: 800 },
|
|
404
|
-
{ label: 'Black', value: 900 },
|
|
405
|
-
],
|
|
406
|
-
defaults: {
|
|
407
|
-
fontSlant: undefined,
|
|
408
|
-
fontWidth: undefined,
|
|
409
|
-
fontWeight: 400,
|
|
410
|
-
},
|
|
411
|
-
declarations: [
|
|
412
|
-
{
|
|
413
|
-
fontStyle: 'normal',
|
|
414
|
-
fontWeight: '300',
|
|
415
|
-
src: `url('${UDS_FONTS_CDN_PREFIX}/yahoo-serif-display-light.woff2') format('woff2')`,
|
|
416
|
-
},
|
|
417
|
-
{
|
|
418
|
-
fontStyle: 'normal',
|
|
419
|
-
fontWeight: '400',
|
|
420
|
-
src: `url('${UDS_FONTS_CDN_PREFIX}/yahoo-serif-display-regular.woff2') format('woff2')`,
|
|
421
|
-
},
|
|
422
|
-
{
|
|
423
|
-
fontStyle: 'normal',
|
|
424
|
-
fontWeight: '700',
|
|
425
|
-
src: `url('${UDS_FONTS_CDN_PREFIX}/yahoo-serif-display-bold.woff2') format('woff2')`,
|
|
426
|
-
},
|
|
427
|
-
{
|
|
428
|
-
fontStyle: 'normal',
|
|
429
|
-
fontWeight: '800',
|
|
430
|
-
src: `url('${UDS_FONTS_CDN_PREFIX}/yahoo-serif-display-extrabold.woff2') format('woff2')`,
|
|
431
|
-
},
|
|
432
|
-
{
|
|
433
|
-
fontStyle: 'normal',
|
|
434
|
-
fontWeight: '900',
|
|
435
|
-
src: `url('${UDS_FONTS_CDN_PREFIX}/yahoo-serif-display-black.woff2') format('woff2')`,
|
|
436
|
-
},
|
|
437
|
-
],
|
|
438
|
-
},
|
|
439
|
-
'yahoo-serif-text': {
|
|
440
|
-
fallback: serifFallbacks,
|
|
441
|
-
type: 'serif',
|
|
442
|
-
fontFamily: 'Yahoo Serif Text',
|
|
443
|
-
isVariableFont: false,
|
|
444
|
-
fontSlants: undefined,
|
|
445
|
-
fontWidths: undefined,
|
|
446
|
-
fontWeights: [
|
|
447
|
-
{ label: 'Regular', value: 400 },
|
|
448
|
-
{ label: 'Bold', value: 700 },
|
|
449
|
-
],
|
|
450
|
-
defaults: {
|
|
451
|
-
fontSlant: undefined,
|
|
452
|
-
fontWidth: undefined,
|
|
453
|
-
fontWeight: 400,
|
|
454
|
-
},
|
|
455
|
-
declarations: [
|
|
456
|
-
{
|
|
457
|
-
fontStyle: 'normal',
|
|
458
|
-
fontWeight: '400',
|
|
459
|
-
src: `url('${UDS_FONTS_CDN_PREFIX}/yahoo-serif-text-regular.woff2') format('woff2')`,
|
|
460
|
-
},
|
|
461
|
-
{
|
|
462
|
-
fontStyle: 'italic',
|
|
463
|
-
fontWeight: '400',
|
|
464
|
-
src: `url('${UDS_FONTS_CDN_PREFIX}/yahoo-serif-text-italic.woff2') format('woff2')`,
|
|
465
|
-
},
|
|
466
|
-
{
|
|
467
|
-
fontStyle: 'normal',
|
|
468
|
-
fontWeight: '700',
|
|
469
|
-
src: `url('${UDS_FONTS_CDN_PREFIX}/yahoo-serif-text-bold.woff2') format('woff2')`,
|
|
470
|
-
},
|
|
471
|
-
{
|
|
472
|
-
fontStyle: 'italic',
|
|
473
|
-
fontWeight: '700',
|
|
474
|
-
src: `url('${UDS_FONTS_CDN_PREFIX}/yahoo-serif-text-bold-italic.woff2') format('woff2')`,
|
|
475
|
-
},
|
|
476
|
-
],
|
|
477
|
-
},
|
|
478
|
-
} as const satisfies Record<string, FontDeclarationConfig>;
|
|
479
|
-
|
|
480
|
-
export type FontAxisConfig = { label: string; value: number };
|
|
481
|
-
|
|
482
|
-
export type FontDeclarationItemConfig = {
|
|
483
|
-
/** @default to normal if not provided */
|
|
484
|
-
fontStyle?: 'normal' | 'italic';
|
|
485
|
-
fontWeight?: `${number}` | '1 1000';
|
|
486
|
-
/** @defaults to swap if not provided */
|
|
487
|
-
fontDisplay?: 'swap';
|
|
488
|
-
src: `url('${typeof UDS_FONTS_CDN_PREFIX}/${string}.woff2') ${string}`;
|
|
489
|
-
};
|
|
490
|
-
|
|
491
|
-
export type FontDeclarationConfig = {
|
|
492
|
-
fallback: string[];
|
|
493
|
-
type: FontType;
|
|
494
|
-
isVariableFont: boolean;
|
|
495
|
-
fontSlants: FontAxisConfig[] | undefined;
|
|
496
|
-
fontWidths: FontAxisConfig[] | undefined;
|
|
497
|
-
fontFamily: string;
|
|
498
|
-
fontWeights: FontAxisConfig[];
|
|
499
|
-
declarations: FontDeclarationItemConfig[];
|
|
500
|
-
defaults: {
|
|
501
|
-
fontSlant: number | undefined;
|
|
502
|
-
fontWidth: number | undefined;
|
|
503
|
-
fontWeight: number;
|
|
504
|
-
};
|
|
505
|
-
};
|
|
506
|
-
|
|
507
|
-
export type FontDeclarationMap = typeof FONT_DECLARATIONS_MAP;
|
|
508
|
-
|
|
509
|
-
export type FontWeightForFont<T extends FontID> = FontDeclarationMap[T]['fontWeights'][number];
|
package/src/tokens/index.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export * from '../styles/variants';
|
|
2
|
-
/* eslint-disable @typescript-eslint/consistent-type-exports */
|
|
3
|
-
export * from './automation';
|
|
4
|
-
export * from './configs/button';
|
|
5
|
-
export { alwaysPalette } from './configs/palette';
|
|
6
|
-
export * from './configs/shadow';
|
|
7
|
-
export { fontWeightMap } from './configs/typography';
|
|
8
|
-
export * from './consts/cssTokens';
|
|
9
|
-
export * from './consts/defaultModes';
|
|
10
|
-
export * from './consts/fontDeclarationsMap';
|
|
11
|
-
export * from './parseButtonVariants';
|
|
12
|
-
export type * from './types';
|
|
13
|
-
export * from './utils/entries';
|
|
14
|
-
export * from './utils/fromEntries';
|
|
15
|
-
export * from './utils/mapValues';
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import type { ButtonPalette, ButtonVariant, ButtonVariantFlat } from './types';
|
|
2
|
-
|
|
3
|
-
interface ParseButtonVariantFlatArgs {
|
|
4
|
-
palette?: ButtonPalette;
|
|
5
|
-
variant?: ButtonVariant;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
function parseButtonVariantFlat({
|
|
9
|
-
palette = 'accent',
|
|
10
|
-
variant = 'primary',
|
|
11
|
-
}: ParseButtonVariantFlatArgs): ButtonVariantFlat {
|
|
12
|
-
if (palette === 'accent') {
|
|
13
|
-
return variant; // primary, secondary, tertiary
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
if (variant === 'primary') {
|
|
17
|
-
return palette; // brand, alert, positive, warning
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
return `${palette}-${variant}`; // brand-secondary, alert-tertiary, etc.
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
interface parseDeprecatedButtonPaletteVariantArgs {
|
|
24
|
-
flatVariant?: ButtonVariantFlat;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
interface DeprecatedButtonVariant {
|
|
28
|
-
palette: ButtonPalette | undefined;
|
|
29
|
-
variant: ButtonVariant | undefined;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function parseDeprecatedButtonPaletteVariant({
|
|
33
|
-
flatVariant,
|
|
34
|
-
}: parseDeprecatedButtonPaletteVariantArgs): DeprecatedButtonVariant {
|
|
35
|
-
if (!flatVariant) {
|
|
36
|
-
return { palette: undefined, variant: undefined };
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
const [palette, variant] = flatVariant.split('-') as [
|
|
40
|
-
ButtonPalette | undefined,
|
|
41
|
-
ButtonVariant | undefined,
|
|
42
|
-
];
|
|
43
|
-
|
|
44
|
-
if (!variant) {
|
|
45
|
-
// If there's no "-", it must be a primary variant or standalone palette
|
|
46
|
-
if (['primary', 'secondary', 'tertiary'].includes(flatVariant)) {
|
|
47
|
-
return { palette: 'accent', variant: flatVariant as ButtonVariant };
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
return { palette: flatVariant as Exclude<ButtonPalette, 'accent'>, variant: 'primary' };
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
return {
|
|
54
|
-
palette: palette as Exclude<ButtonPalette, 'accent'>,
|
|
55
|
-
variant: variant as Exclude<ButtonVariant, 'primary'>,
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export { parseButtonVariantFlat, parseDeprecatedButtonPaletteVariant };
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
AVATAR_SIZE_PREFIX,
|
|
3
|
-
BORDER_RADIUS_PREFIX,
|
|
4
|
-
BORDER_WIDTH_PREFIX,
|
|
5
|
-
ICON_SIZE_PREFIX,
|
|
6
|
-
SPECTRUM_COLOR_PREFIX,
|
|
7
|
-
UDS_PREFIX,
|
|
8
|
-
} from './consts/cssTokens';
|
|
9
|
-
import type {
|
|
10
|
-
ColorMode,
|
|
11
|
-
ColorsConfig,
|
|
12
|
-
Hue,
|
|
13
|
-
HueStep,
|
|
14
|
-
PaletteConfig,
|
|
15
|
-
PaletteType,
|
|
16
|
-
ScaleMode,
|
|
17
|
-
UniversalTokensConfig,
|
|
18
|
-
} from './types';
|
|
19
|
-
import { entries } from './utils/entries';
|
|
20
|
-
import { mapValues } from './utils/mapValues';
|
|
21
|
-
|
|
22
|
-
function transformColors(colors: ColorsConfig) {
|
|
23
|
-
const { palette, spectrum } = colors;
|
|
24
|
-
const rootVars: Record<string, string> = {};
|
|
25
|
-
const tailwindConfig = {
|
|
26
|
-
spectrum: {} as Record<Hue, Record<HueStep, string>>,
|
|
27
|
-
palette: {} as {
|
|
28
|
-
[key in PaletteType]: Record<keyof PaletteConfig[key], string>;
|
|
29
|
-
},
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
for (const [hue, hueSteps] of entries(spectrum)) {
|
|
33
|
-
for (const [hueStep, value] of entries(hueSteps)) {
|
|
34
|
-
const name = `${hue}-${hueStep}`;
|
|
35
|
-
const varKey = `--${SPECTRUM_COLOR_PREFIX}-${name}`;
|
|
36
|
-
if (!tailwindConfig.spectrum[hue]) {
|
|
37
|
-
tailwindConfig.spectrum[hue] = {} as Record<HueStep, string>;
|
|
38
|
-
}
|
|
39
|
-
tailwindConfig.spectrum[hue][hueStep] = `rgb(var(${varKey}))`;
|
|
40
|
-
rootVars[varKey] = value;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
entries(palette).forEach(([paletteType, paletteConfig]) => {
|
|
45
|
-
for (const [paletteKey, { hue, step, opacity }] of Object.entries(paletteConfig)) {
|
|
46
|
-
if (!(paletteType in tailwindConfig.palette)) {
|
|
47
|
-
// @ts-expect-error we fill this object later
|
|
48
|
-
tailwindConfig.palette[paletteType] = {};
|
|
49
|
-
}
|
|
50
|
-
const name = `--${UDS_PREFIX}-${paletteType}-color-${paletteKey}`;
|
|
51
|
-
rootVars[name] = `var(--${SPECTRUM_COLOR_PREFIX}-${hue}-${step})`;
|
|
52
|
-
// @ts-expect-error this is fine
|
|
53
|
-
tailwindConfig.palette[paletteType][paletteKey] = opacity
|
|
54
|
-
? `rgb(var(${name}) / ${opacity})`
|
|
55
|
-
: `rgb(var(${name}))`;
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
return {
|
|
60
|
-
_vars: rootVars,
|
|
61
|
-
_raw: colors,
|
|
62
|
-
tailwindConfig,
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
function transformNumericToPx<T extends Record<string, number>>(prefix: string, config: T) {
|
|
67
|
-
if (!config) {
|
|
68
|
-
return {
|
|
69
|
-
_vars: {} as Record<string, string>,
|
|
70
|
-
_raw: {} as Record<string, number>,
|
|
71
|
-
tailwindConfig: {} as Record<string, string>,
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
const rootVars: Record<string, string> = {};
|
|
75
|
-
const tailwindConfig = {} as Record<string, string>;
|
|
76
|
-
for (const [variant, value] of entries(config)) {
|
|
77
|
-
const rootVarKey = `--${prefix}-${variant}`;
|
|
78
|
-
const rootVarValue = `${value}px`;
|
|
79
|
-
rootVars[rootVarKey] = rootVarValue;
|
|
80
|
-
tailwindConfig[variant] = `var(${rootVarKey})`;
|
|
81
|
-
}
|
|
82
|
-
return {
|
|
83
|
-
_vars: rootVars,
|
|
84
|
-
_raw: config,
|
|
85
|
-
tailwindConfig,
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
type WebTokens = Omit<UniversalTokensConfig, 'colorMode' | 'scaleMode' | 'fontFamily'> & {
|
|
90
|
-
colorMode: Record<ColorMode, ReturnType<typeof transformColors>>;
|
|
91
|
-
scaleMode: Record<
|
|
92
|
-
ScaleMode,
|
|
93
|
-
{
|
|
94
|
-
borderRadius: ReturnType<typeof transformNumericToPx>;
|
|
95
|
-
borderWidth: ReturnType<typeof transformNumericToPx>;
|
|
96
|
-
avatarSizes: ReturnType<typeof transformNumericToPx>;
|
|
97
|
-
iconSizes: ReturnType<typeof transformNumericToPx>;
|
|
98
|
-
}
|
|
99
|
-
>;
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
export function parseTokens(config: UniversalTokensConfig): WebTokens {
|
|
103
|
-
const { colorMode, scaleMode } = config;
|
|
104
|
-
|
|
105
|
-
return {
|
|
106
|
-
...config,
|
|
107
|
-
colorMode: {
|
|
108
|
-
light: transformColors(colorMode.light),
|
|
109
|
-
dark: transformColors(colorMode.dark),
|
|
110
|
-
},
|
|
111
|
-
scaleMode: mapValues(scaleMode, ({ borderRadius, borderWidth, avatarSizes, iconSizes }) => {
|
|
112
|
-
return {
|
|
113
|
-
borderRadius: transformNumericToPx(BORDER_RADIUS_PREFIX, borderRadius),
|
|
114
|
-
borderWidth: transformNumericToPx(BORDER_WIDTH_PREFIX, borderWidth),
|
|
115
|
-
avatarSizes: transformNumericToPx(AVATAR_SIZE_PREFIX, avatarSizes),
|
|
116
|
-
iconSizes: transformNumericToPx(ICON_SIZE_PREFIX, iconSizes),
|
|
117
|
-
};
|
|
118
|
-
}),
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
export { type WebTokens };
|