@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,28 +0,0 @@
|
|
|
1
|
-
import { fontAliases, textVariants } from '@yahoo/uds/fixtures';
|
|
2
|
-
import { FONT_FAMILY_PREFIX } from '@yahoo/uds/tokens';
|
|
3
|
-
import type { ThemeConfig } from 'tailwindcss/types/config';
|
|
4
|
-
|
|
5
|
-
import { textVariantsSafe } from '../components/getResponsiveTextStyles';
|
|
6
|
-
|
|
7
|
-
export function getFontFamilyTheme(): ThemeConfig['fontFamily'] {
|
|
8
|
-
/** Global font family aliases i.e. font-sans, font-serif, etc */
|
|
9
|
-
const globalFonts = Object.fromEntries(
|
|
10
|
-
fontAliases.map((fontAlias) => {
|
|
11
|
-
const cssVar = `var(--${FONT_FAMILY_PREFIX}-${fontAlias})` as const;
|
|
12
|
-
return [fontAlias, cssVar] as const;
|
|
13
|
-
}),
|
|
14
|
-
);
|
|
15
|
-
|
|
16
|
-
/** Text variant font family assignments i.e. font-display1 */
|
|
17
|
-
const textVariantFonts = Object.fromEntries(
|
|
18
|
-
textVariants.map(textVariantsSafe).map((textVariant) => {
|
|
19
|
-
const cssVar = `var(--${FONT_FAMILY_PREFIX}-${textVariant})` as const;
|
|
20
|
-
return [textVariant, cssVar] as const;
|
|
21
|
-
}),
|
|
22
|
-
);
|
|
23
|
-
|
|
24
|
-
return {
|
|
25
|
-
...globalFonts,
|
|
26
|
-
...textVariantFonts,
|
|
27
|
-
};
|
|
28
|
-
}
|
package/src/tailwind/tsMorph.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from '../../scripts/utils/tsMorph';
|
package/src/tailwind/uds.css
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { FontID } from '@yahoo/uds/tokens';
|
|
2
|
-
// Tailwind 3.x poorly supports ESM modules so we must include the .js extension when importing.
|
|
3
|
-
import plugin from 'tailwindcss/plugin.js';
|
|
4
|
-
|
|
5
|
-
import { addFontFaceDeclarations } from '../base/addFontFaceDeclarations';
|
|
6
|
-
import type { TailwindPluginFns } from '../base/types';
|
|
7
|
-
|
|
8
|
-
export interface AddFontsPluginOptions {
|
|
9
|
-
fontIds: FontID[];
|
|
10
|
-
}
|
|
11
|
-
export const addFontsPlugin = plugin.withOptions(function addFontsPlugin({
|
|
12
|
-
fontIds,
|
|
13
|
-
}: AddFontsPluginOptions) {
|
|
14
|
-
return function ({ addBase }) {
|
|
15
|
-
addFontFaceDeclarations(fontIds, { addBase } as TailwindPluginFns);
|
|
16
|
-
};
|
|
17
|
-
});
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { WebTokens } from '@yahoo/uds/tokens/parseTokens';
|
|
2
|
-
|
|
3
|
-
export function getColorModeStyles(tokens: WebTokens) {
|
|
4
|
-
const lightStyles = {
|
|
5
|
-
colorScheme: 'light',
|
|
6
|
-
'--uds-light-mode-icon': 'inline',
|
|
7
|
-
'--uds-dark-mode-icon': 'none',
|
|
8
|
-
...tokens.colorMode.light._vars,
|
|
9
|
-
};
|
|
10
|
-
const darkStyles = {
|
|
11
|
-
colorScheme: 'dark',
|
|
12
|
-
'--uds-light-mode-icon': 'none',
|
|
13
|
-
'--uds-dark-mode-icon': 'inline',
|
|
14
|
-
...tokens.colorMode.dark._vars,
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
return {
|
|
18
|
-
light: lightStyles,
|
|
19
|
-
dark: darkStyles,
|
|
20
|
-
};
|
|
21
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { FontDeclarationItemConfig, FontID } from '@yahoo/uds/tokens';
|
|
2
|
-
import { FONT_DECLARATIONS_MAP } from '@yahoo/uds/tokens';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Get all font face declarations for a given set of font IDs.
|
|
6
|
-
*/
|
|
7
|
-
export function getFontFaceDeclarations(fontIds: FontID[]): FontDeclarationItemConfig[] {
|
|
8
|
-
return fontIds.flatMap((fontID) => {
|
|
9
|
-
const { declarations, fontFamily } = FONT_DECLARATIONS_MAP[fontID];
|
|
10
|
-
return declarations.map((declaration) => ({ fontFamily, fontDisplay: 'swap', ...declaration }));
|
|
11
|
-
});
|
|
12
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import type { FontConfig } from '@yahoo/uds/tokens';
|
|
2
|
-
import { entries, FONT_DECLARATIONS_MAP, FONT_FAMILY_PREFIX, fromEntries } from '@yahoo/uds/tokens';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Tailwind does not automatically escape font names for you.
|
|
6
|
-
* If you’re using a font that contains an invalid identifier, wrap it in quotes or escape the invalid characters.
|
|
7
|
-
* @link https://tailwindcss.com/docs/font-family#customizing-your-theme:~:text=Tailwind%20does%20not%20automatically
|
|
8
|
-
*/
|
|
9
|
-
function escapeFontFamilyName(fontFamily: string) {
|
|
10
|
-
return `"${fontFamily}"`;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Return CSS variables object based on font config.
|
|
15
|
-
* i.e. { --font-xyz: '"Font Family 1", "Font Family 2", sans-serif' }
|
|
16
|
-
*
|
|
17
|
-
* @example
|
|
18
|
-
* // 1. Use return value in style prop of an html element to assign font variables at runtime
|
|
19
|
-
*
|
|
20
|
-
* const fontVars = getFontStyles(fontConfig);
|
|
21
|
-
* <body style={fontVars}> {...} </body>
|
|
22
|
-
*
|
|
23
|
-
* // 2. Generate CSS at build time in tailwind plugin via addRootVariables.
|
|
24
|
-
*
|
|
25
|
-
* const fontVars = getFontStyles(fontConfig);
|
|
26
|
-
* addRootVariables(fontVars);
|
|
27
|
-
*
|
|
28
|
-
*/
|
|
29
|
-
export function getFontStyles(fontConfig: FontConfig) {
|
|
30
|
-
return fromEntries(
|
|
31
|
-
entries(fontConfig).map(([fontAlias, fontID]) => {
|
|
32
|
-
const cssVar = `--${FONT_FAMILY_PREFIX}-${fontAlias}` as const;
|
|
33
|
-
const font = FONT_DECLARATIONS_MAP[fontID];
|
|
34
|
-
const value = [font.fontFamily, ...font.fallback].map(escapeFontFamilyName).join(', ');
|
|
35
|
-
return [cssVar, value] as const;
|
|
36
|
-
}),
|
|
37
|
-
);
|
|
38
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { motionSpringConfigOptions } from '@yahoo/uds/fixtures';
|
|
2
|
-
import type { MotionConfig, MotionCssVar } from '@yahoo/uds/tokens';
|
|
3
|
-
import { entries, fromEntries } from '@yahoo/uds/tokens';
|
|
4
|
-
|
|
5
|
-
import { getMotionVar } from '../../utils/getMotionVar';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Return CSS variables object based on the motion config.
|
|
9
|
-
* i.e. { --uds-motion-damped-1--damping: '20.585796264350424' }
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* // 1. Use return value in style prop of an html element to assign motion variables at runtime
|
|
13
|
-
*
|
|
14
|
-
* const motionVars = getMotionStyles(motionConfig);
|
|
15
|
-
* <body style={motionVars}> {...} </body>
|
|
16
|
-
*
|
|
17
|
-
* // 2. Generate CSS at build time in tailwind plugin via addRootVariables.
|
|
18
|
-
*
|
|
19
|
-
* const motionVars = getMotionStyles(motionConfig);
|
|
20
|
-
* addRootVariables(motionVars);
|
|
21
|
-
*
|
|
22
|
-
*/
|
|
23
|
-
export function getMotionStyles(motionConfig: MotionConfig) {
|
|
24
|
-
const motionEntries = entries(motionConfig).flatMap(([variant, speeds]) =>
|
|
25
|
-
entries(speeds).flatMap(([speed, config]) => {
|
|
26
|
-
return motionSpringConfigOptions.map((control) => {
|
|
27
|
-
const cssVar = getMotionVar({ variant, speed, control });
|
|
28
|
-
// Keep the unit wrapped in quotes to avoid tailwind from adding units (px/rem)
|
|
29
|
-
return [cssVar, `${config[control]}`];
|
|
30
|
-
});
|
|
31
|
-
}),
|
|
32
|
-
) as [MotionCssVar, string][];
|
|
33
|
-
|
|
34
|
-
return fromEntries(motionEntries);
|
|
35
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { ScaleMode } from '@yahoo/uds/tokens';
|
|
2
|
-
import type { WebTokens } from '@yahoo/uds/tokens/parseTokens';
|
|
3
|
-
|
|
4
|
-
function getStylesForScaleMode(config: WebTokens['scaleMode'][ScaleMode]) {
|
|
5
|
-
return {
|
|
6
|
-
...config.borderRadius._vars,
|
|
7
|
-
...config.borderWidth._vars,
|
|
8
|
-
...config.avatarSizes._vars,
|
|
9
|
-
...config.iconSizes._vars,
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export function getScaleModeStyles(tokens: WebTokens) {
|
|
14
|
-
return {
|
|
15
|
-
xSmall: getStylesForScaleMode(tokens.scaleMode.xSmall),
|
|
16
|
-
small: getStylesForScaleMode(tokens.scaleMode.small),
|
|
17
|
-
medium: getStylesForScaleMode(tokens.scaleMode.medium),
|
|
18
|
-
large: getStylesForScaleMode(tokens.scaleMode.large),
|
|
19
|
-
xLarge: getStylesForScaleMode(tokens.scaleMode.xLarge),
|
|
20
|
-
xxLarge: getStylesForScaleMode(tokens.scaleMode.xxLarge),
|
|
21
|
-
xxxLarge: getStylesForScaleMode(tokens.scaleMode.xxxLarge),
|
|
22
|
-
};
|
|
23
|
-
}
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import { shadowOffsetMap, shadowSpreadRadiusMap, spacingMap } from '@yahoo/uds/fixtures';
|
|
2
|
-
import type {
|
|
3
|
-
AlwaysPaletteAlias,
|
|
4
|
-
ShadowPreset,
|
|
5
|
-
ShadowType,
|
|
6
|
-
UniversalTokensConfig,
|
|
7
|
-
} from '@yahoo/uds/tokens';
|
|
8
|
-
import { entries } from '@yahoo/uds/tokens';
|
|
9
|
-
|
|
10
|
-
const ALWAYS_AS_RGB = { black: '0 0 0', white: '255 255 255' } as Record<
|
|
11
|
-
AlwaysPaletteAlias,
|
|
12
|
-
string
|
|
13
|
-
>;
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Generate a single shadow value from a shadow preset configuration
|
|
17
|
-
*
|
|
18
|
-
* @param preset - The shadow preset configuration
|
|
19
|
-
* @param index - Optional index for numbered shadows (2-5)
|
|
20
|
-
* @param shadowType - The type of shadow (drop or inset)
|
|
21
|
-
* @returns A CSS box-shadow value string
|
|
22
|
-
*/
|
|
23
|
-
function getShadowLayerValue({
|
|
24
|
-
preset,
|
|
25
|
-
prefix,
|
|
26
|
-
shadowType,
|
|
27
|
-
}: {
|
|
28
|
-
preset: ShadowPreset;
|
|
29
|
-
prefix?: string;
|
|
30
|
-
shadowType: ShadowType;
|
|
31
|
-
}) {
|
|
32
|
-
// Generate a prefix for the shadow layer or use an empty string if it's the first shadow
|
|
33
|
-
// Use different variable prefixes for regular vs inset shadows
|
|
34
|
-
// Note: We still use the same color variables for both types
|
|
35
|
-
const varPrefix = `--uds-${shadowType}-shadow-`;
|
|
36
|
-
|
|
37
|
-
// For colors, we always use the shared color variables
|
|
38
|
-
const isPaletteColor = preset.color?.type === 'palette';
|
|
39
|
-
const isAlwaysColor = preset.color?.type === 'always';
|
|
40
|
-
|
|
41
|
-
let shadowColor = `var(--uds-${isPaletteColor ? 'shadow' : 'spectrum'}-color-${preset?.color?.value})`;
|
|
42
|
-
|
|
43
|
-
// We need white in rgb format for the shadow to be visible
|
|
44
|
-
if (isAlwaysColor) {
|
|
45
|
-
shadowColor = ALWAYS_AS_RGB[preset.color.value as AlwaysPaletteAlias];
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
const defaultColor = `var(${varPrefix}${prefix ? `${prefix}-` : ''}color, ${shadowColor})`;
|
|
49
|
-
|
|
50
|
-
// Define shadow properties in a structured way
|
|
51
|
-
const shadowProps = [
|
|
52
|
-
`${shadowOffsetMap[preset.offsetX]}px`,
|
|
53
|
-
`${shadowOffsetMap[preset.offsetY]}px`,
|
|
54
|
-
`${spacingMap[preset.blur]}px`,
|
|
55
|
-
`${shadowSpreadRadiusMap[preset.spread]}px`,
|
|
56
|
-
] as const;
|
|
57
|
-
|
|
58
|
-
// Generate CSS variables with fallbacks, using the appropriate prefix
|
|
59
|
-
const cssValues = shadowProps.map((value) => value).join(' ');
|
|
60
|
-
|
|
61
|
-
// Add the color/opacity component
|
|
62
|
-
// Note: We use the appropriate variable prefix for opacity, but keep the shared color variables
|
|
63
|
-
const colorValue = `rgb(${defaultColor} / var(${varPrefix}${prefix ? `${prefix}-` : ''}opacity, ${
|
|
64
|
-
Number(preset.opacity) / 100
|
|
65
|
-
}))`;
|
|
66
|
-
|
|
67
|
-
// Return the final value with inset keyword if needed
|
|
68
|
-
// The 'inset' keyword must be at the beginning of the shadow value for CSS to recognize it as an inset shadow
|
|
69
|
-
return `${shadowType === 'inset' ? 'inset ' : ''}${cssValues} ${colorValue}`;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Generate shadow values from the shadow config presets.
|
|
74
|
-
* Each size can have multiple shadow presets that are combined into a single box-shadow.
|
|
75
|
-
*
|
|
76
|
-
* For regular shadows:
|
|
77
|
-
* - Uses the outer shadow configuration from the shadow config
|
|
78
|
-
* - Uses CSS variables with the --uds-shadow-* prefix for shadow properties
|
|
79
|
-
* - The first shadow uses default variable names, subsequent shadows are numbered (e.g. --uds-shadow-2-*)
|
|
80
|
-
* - Shadow colors are scoped to the element, allowing for instance-specific colors
|
|
81
|
-
*
|
|
82
|
-
* For inset shadows:
|
|
83
|
-
* - Uses the inner shadow configuration from the shadow config
|
|
84
|
-
* - Uses CSS variables with the --uds-inset-shadow-* prefix for shadow properties
|
|
85
|
-
* - Adds the 'inset' keyword to each shadow value
|
|
86
|
-
* - Shadow colors are scoped to the element, allowing for instance-specific colors
|
|
87
|
-
*
|
|
88
|
-
* This approach ensures that both regular and inset shadows use the correct CSS variables
|
|
89
|
-
* set by the shadow utilities, while allowing for instance-specific color customization.
|
|
90
|
-
* The separation of variable namespaces allows both shadow types to be used together on the same element.
|
|
91
|
-
*
|
|
92
|
-
* When both shadow and inset-shadow utilities are used together on an element,
|
|
93
|
-
* they combine to create a box-shadow with both outer and inner shadows.
|
|
94
|
-
*
|
|
95
|
-
* @returns A record of shadow values by size (xs, sm, md, etc.)
|
|
96
|
-
*/
|
|
97
|
-
function getShadowPresetValues({
|
|
98
|
-
config,
|
|
99
|
-
shadowType,
|
|
100
|
-
}: {
|
|
101
|
-
config: UniversalTokensConfig;
|
|
102
|
-
shadowType: ShadowType;
|
|
103
|
-
}) {
|
|
104
|
-
const presets = config?.shadow?.[shadowType];
|
|
105
|
-
|
|
106
|
-
// Bail fast if no presets
|
|
107
|
-
if (!presets) {
|
|
108
|
-
return {};
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
const result: Record<string, string> = {};
|
|
112
|
-
|
|
113
|
-
// Process shadows
|
|
114
|
-
entries(presets).forEach(([key, presetArray]) => {
|
|
115
|
-
// Special case for none - always use transparent shadow to avoid breaking combined box-shadows
|
|
116
|
-
if (key === 'none') {
|
|
117
|
-
result[`--uds-${shadowType}-shadow-${key}`] = '0 0 transparent';
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
const shadowValues = presetArray.map((preset, index) =>
|
|
122
|
-
getShadowLayerValue({ preset, prefix: index > 0 ? `${index + 1}` : undefined, shadowType }),
|
|
123
|
-
);
|
|
124
|
-
|
|
125
|
-
// Join the shadow values with the appropriate separator
|
|
126
|
-
// For inset shadows, we ensure each shadow has the 'inset' keyword
|
|
127
|
-
result[`--uds-${shadowType}-shadow-${key}`] = `${shadowValues.join(', ')}`;
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
return result;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
export { getShadowLayerValue, getShadowPresetValues };
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { ShadowType, UniversalTokensConfig } from '@yahoo/uds/tokens';
|
|
2
|
-
import { entries, fromEntries, UDS_PREFIX } from '@yahoo/uds/tokens';
|
|
3
|
-
|
|
4
|
-
function getShadowStyles({
|
|
5
|
-
config,
|
|
6
|
-
shadowType,
|
|
7
|
-
}: {
|
|
8
|
-
config: UniversalTokensConfig;
|
|
9
|
-
shadowType: ShadowType;
|
|
10
|
-
}) {
|
|
11
|
-
const shadowTypeConfig = config.shadow[shadowType];
|
|
12
|
-
|
|
13
|
-
const tuple = entries(shadowTypeConfig).map(([shadowVariant]) => {
|
|
14
|
-
return [
|
|
15
|
-
`.uds-${shadowType}-shadow-${shadowVariant}`,
|
|
16
|
-
{
|
|
17
|
-
[`--uds-${shadowType}-shadow`]: `var(--${UDS_PREFIX}-${shadowType}-shadow-${shadowVariant})`,
|
|
18
|
-
boxShadow: `var(--${UDS_PREFIX}-drop-shadow, 0 0 transparent), var(--${UDS_PREFIX}-inset-shadow, 0 0 transparent), var(--tw-ring-offset-shadow, 0 0 transparent), var(--tw-ring-shadow, 0 0 transparent), var(--tw-shadow, 0 0 transparent)`,
|
|
19
|
-
},
|
|
20
|
-
] as const;
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
return fromEntries(tuple);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export { getShadowStyles };
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import type { ShadowType, ShadowVariant, UniversalTokensConfig } from '@yahoo/uds/tokens';
|
|
2
|
-
import { fromEntries, UDS_PREFIX } from '@yahoo/uds/tokens';
|
|
3
|
-
|
|
4
|
-
function getShadowVarsForType<T extends ShadowType>(
|
|
5
|
-
shadowType: T,
|
|
6
|
-
udsConfig: UniversalTokensConfig,
|
|
7
|
-
) {
|
|
8
|
-
const shadowTypeConfig = udsConfig.shadow?.[shadowType];
|
|
9
|
-
|
|
10
|
-
// Return empty object if no config for this shadow type
|
|
11
|
-
if (!shadowTypeConfig) {
|
|
12
|
-
return {};
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
const tuple = Object.entries(shadowTypeConfig).map(([shadowVariant, shadowPreset]) => {
|
|
16
|
-
const value = shadowPreset
|
|
17
|
-
.map((preset) => {
|
|
18
|
-
const colorVar =
|
|
19
|
-
preset.color.type === 'palette'
|
|
20
|
-
? `--${UDS_PREFIX}-shadow-color-${preset.color.value}`
|
|
21
|
-
: `--${UDS_PREFIX}-spectrum-color-${preset.color.value}`;
|
|
22
|
-
const value = `${preset.offsetX} ${preset.offsetY} ${preset.blur} ${preset.spread} var(${colorVar})`;
|
|
23
|
-
return shadowType === 'inset' ? `inset ${value}` : value;
|
|
24
|
-
})
|
|
25
|
-
.join(',');
|
|
26
|
-
return [
|
|
27
|
-
`--${UDS_PREFIX}-${shadowType}-shadow-${shadowVariant as ShadowVariant}`,
|
|
28
|
-
value,
|
|
29
|
-
] as const;
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
return fromEntries(tuple);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export function getShadowVars(udsConfig: UniversalTokensConfig) {
|
|
36
|
-
return {
|
|
37
|
-
...getShadowVarsForType('drop', udsConfig),
|
|
38
|
-
...getShadowVarsForType('inset', udsConfig),
|
|
39
|
-
};
|
|
40
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export { getBaseTextVars, getResponsiveTextStyles } from '../components/getResponsiveTextStyles';
|
|
2
|
-
export * from './addFontsPlugin';
|
|
3
|
-
export * from './getColorModeStyles';
|
|
4
|
-
export * from './getFontFaceDeclarations';
|
|
5
|
-
export * from './getFontStyles';
|
|
6
|
-
export * from './getMotionStyles';
|
|
7
|
-
export * from './getScaleModeStyles';
|
|
8
|
-
export * from './getShadowPresetValues';
|
|
9
|
-
export * from './getShadowStyles';
|