@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,724 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
shadowOffsetMap,
|
|
3
|
-
shadowOpacityMap,
|
|
4
|
-
shadowSpreadRadiusMap,
|
|
5
|
-
tailwindColorsAsUds,
|
|
6
|
-
textVariants,
|
|
7
|
-
} from '@yahoo/uds/fixtures';
|
|
8
|
-
import type {
|
|
9
|
-
BorderRadius,
|
|
10
|
-
BorderWidth,
|
|
11
|
-
BreakpointWithBase,
|
|
12
|
-
FontWeightDescriptive,
|
|
13
|
-
TextVariant,
|
|
14
|
-
UniversalTokensConfig,
|
|
15
|
-
} from '@yahoo/uds/tokens';
|
|
16
|
-
import {
|
|
17
|
-
alwaysPalette,
|
|
18
|
-
BORDER_RADIUS_PREFIX,
|
|
19
|
-
BORDER_WIDTH_PREFIX,
|
|
20
|
-
DARK_COLOR_MODE_CLASSNAME,
|
|
21
|
-
DEFAULT_COLOR_MODE,
|
|
22
|
-
DEFAULT_SCALE_MODE,
|
|
23
|
-
entries,
|
|
24
|
-
FONT_SIZE_PREFIX,
|
|
25
|
-
fromEntries,
|
|
26
|
-
generateStyles,
|
|
27
|
-
INVERT_COLOR_MODE_CLASSNAME,
|
|
28
|
-
LIGHT_COLOR_MODE_CLASSNAME,
|
|
29
|
-
LINE_HEIGHT_PREFIX,
|
|
30
|
-
mapValues,
|
|
31
|
-
SYSTEM_COLOR_MODE_CLASSNAME,
|
|
32
|
-
TEXT_RESPONSIVE_BREAKPOINT_CLASSNAMES,
|
|
33
|
-
TEXT_RESPONSIVE_CLASSNAME,
|
|
34
|
-
} from '@yahoo/uds/tokens';
|
|
35
|
-
import { parseTokens } from '@yahoo/uds/tokens/parseTokens';
|
|
36
|
-
import { isString } from 'lodash';
|
|
37
|
-
import type { Config } from 'tailwindcss';
|
|
38
|
-
// Tailwind 3.x poorly supports ESM modules so we must include the .js extension when importing.
|
|
39
|
-
import plugin from 'tailwindcss/plugin.js';
|
|
40
|
-
import type { DefaultTheme } from 'tailwindcss/types/generated/default-theme';
|
|
41
|
-
|
|
42
|
-
import {
|
|
43
|
-
AvatarConfig,
|
|
44
|
-
BadgeConfig,
|
|
45
|
-
CheckboxConfig,
|
|
46
|
-
ChipConfig,
|
|
47
|
-
DividerConfig,
|
|
48
|
-
InputConfig,
|
|
49
|
-
LinkConfig,
|
|
50
|
-
MenuConfig,
|
|
51
|
-
RadioConfig,
|
|
52
|
-
SwitchConfig,
|
|
53
|
-
} from '../../generated/generatedConfigs';
|
|
54
|
-
import { fontWeightMap } from '../tokens/configs/typography';
|
|
55
|
-
import { assertUnreachable } from '../utils/assertUnreachable';
|
|
56
|
-
import { addColorModeVars } from './base/addColorModeVars';
|
|
57
|
-
import { addColorModeVarsV2 } from './base/addColorModeVarsV2';
|
|
58
|
-
import { addFontFaceDeclarations } from './base/addFontFaceDeclarations';
|
|
59
|
-
import { addFontVars } from './base/addFontVars';
|
|
60
|
-
import { addMotionVars } from './base/addMotionVars';
|
|
61
|
-
import { addScaleModeVars } from './base/addScaleModeVars';
|
|
62
|
-
import type { TailwindPluginFns } from './base/types';
|
|
63
|
-
import { getButtonStyles, getTailwindButtonStyles } from './components/getButtonStyles';
|
|
64
|
-
import { getFocusRingStyles } from './components/getFocusRingStyles';
|
|
65
|
-
import { getGroupedTextStyles } from './components/getGroupedTextStyles';
|
|
66
|
-
import { getHitTargetStyles } from './components/getHitTargetStyles';
|
|
67
|
-
import { getIconButtonStyles, getTailwindIconButtonStyles } from './components/getIconButtonStyles';
|
|
68
|
-
import { getIconStyles } from './components/getIconStyles';
|
|
69
|
-
import { getInputStyles } from './components/getInputStyles';
|
|
70
|
-
import {
|
|
71
|
-
getBaseTextVars,
|
|
72
|
-
getResponsiveTextStyles,
|
|
73
|
-
RESPONSIVE_TAILWIND_CONFIG_MAP,
|
|
74
|
-
textVariantsSafe,
|
|
75
|
-
} from './components/getResponsiveTextStyles';
|
|
76
|
-
import { udsToTailwindMap } from './defaultTailwindThemeAsUdsConfig';
|
|
77
|
-
import { getFontFamilyTheme } from './theme/getFontFamilyTheme';
|
|
78
|
-
import { getShadowPresetValues } from './utils/getShadowPresetValues';
|
|
79
|
-
import { getShadowStyles } from './utils/getShadowStyles';
|
|
80
|
-
|
|
81
|
-
interface TailwindPluginOptions {
|
|
82
|
-
config?: UniversalTokensConfig;
|
|
83
|
-
/**
|
|
84
|
-
* Safelisting is a last-resort, and should only be used in situations where
|
|
85
|
-
* it’s impossible to scan certain content for class names. These situations
|
|
86
|
-
* are rare, and you should almost never need this feature.
|
|
87
|
-
*
|
|
88
|
-
* {@link https://v3.tailwindcss.com/docs/content-configuration#safelisting-classes}
|
|
89
|
-
*/
|
|
90
|
-
safelist?: Config['safelist'];
|
|
91
|
-
/**
|
|
92
|
-
* Disable generating font face declarations through Tailwind
|
|
93
|
-
* @default false
|
|
94
|
-
*/
|
|
95
|
-
disableFontFaceDeclarations?: boolean;
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* Enable responsive type ramp styles.
|
|
99
|
-
* @default false
|
|
100
|
-
* @deprecated This is now set in the uds.config
|
|
101
|
-
*/
|
|
102
|
-
enableResponsiveTypeRamp?: boolean;
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* Enable opt-in automatice color mode based on media query.
|
|
106
|
-
* @default false
|
|
107
|
-
*/
|
|
108
|
-
enableSystemColorMode?: boolean;
|
|
109
|
-
|
|
110
|
-
previewOptions?: {
|
|
111
|
-
/**
|
|
112
|
-
* Generates CSS classes for visually forcing components into a pseudo state (hover, focus, etc)
|
|
113
|
-
* @default false
|
|
114
|
-
*/
|
|
115
|
-
generatePseudoStateClassModifier: boolean;
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
const tailwindPlugin = plugin.withOptions(
|
|
120
|
-
function ({
|
|
121
|
-
config,
|
|
122
|
-
disableFontFaceDeclarations = false,
|
|
123
|
-
enableSystemColorMode = false,
|
|
124
|
-
previewOptions = {
|
|
125
|
-
generatePseudoStateClassModifier: false,
|
|
126
|
-
},
|
|
127
|
-
}: TailwindPluginOptions) {
|
|
128
|
-
if (!config) {
|
|
129
|
-
throw new Error(
|
|
130
|
-
"`tailwindPlugin` requires a config object. If your project has not yet sync'd a config, you can import `defaultTokensConfig` from `@yahoo/uds/defaultTokensConfig` and pass it to `tailwindPlugin`.",
|
|
131
|
-
);
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
return function ({
|
|
135
|
-
addBase: addBase_,
|
|
136
|
-
addUtilities: addUtilities_,
|
|
137
|
-
addComponents: addComponents_,
|
|
138
|
-
matchUtilities,
|
|
139
|
-
theme,
|
|
140
|
-
config: getRootConfig,
|
|
141
|
-
}) {
|
|
142
|
-
const parentConfigImportant = getRootConfig().important;
|
|
143
|
-
const useImportNamespace = isString(parentConfigImportant);
|
|
144
|
-
const rootSelector = useImportNamespace ? parentConfigImportant : ':root';
|
|
145
|
-
|
|
146
|
-
const fns: TailwindPluginFns = {
|
|
147
|
-
addRootVariables(css) {
|
|
148
|
-
addBase_({
|
|
149
|
-
[rootSelector]: css,
|
|
150
|
-
});
|
|
151
|
-
},
|
|
152
|
-
|
|
153
|
-
addBase: addBase_,
|
|
154
|
-
|
|
155
|
-
addComponents(css) {
|
|
156
|
-
addComponents_(css, {
|
|
157
|
-
respectImportant: useImportNamespace,
|
|
158
|
-
});
|
|
159
|
-
},
|
|
160
|
-
|
|
161
|
-
addUtilities(css) {
|
|
162
|
-
addUtilities_(css, {
|
|
163
|
-
respectPrefix: true,
|
|
164
|
-
respectImportant: useImportNamespace,
|
|
165
|
-
});
|
|
166
|
-
},
|
|
167
|
-
};
|
|
168
|
-
|
|
169
|
-
const { addRootVariables, addBase, addComponents, addUtilities } = fns;
|
|
170
|
-
|
|
171
|
-
const tokens = parseTokens(config);
|
|
172
|
-
const fontIds = Object.values(config.font);
|
|
173
|
-
|
|
174
|
-
// TODO: Skip when `useImportNamespace`?
|
|
175
|
-
if (disableFontFaceDeclarations === false) {
|
|
176
|
-
addFontFaceDeclarations(fontIds, fns);
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
addFontVars(config.font, fns);
|
|
180
|
-
addScaleModeVars(tokens, fns);
|
|
181
|
-
|
|
182
|
-
if (enableSystemColorMode) {
|
|
183
|
-
addColorModeVarsV2(tokens, fns);
|
|
184
|
-
} else {
|
|
185
|
-
addColorModeVars(tokens, fns);
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
// Use the base typography to setup text styles (no longer using scaleMode.large)
|
|
189
|
-
addRootVariables(getBaseTextVars(config));
|
|
190
|
-
|
|
191
|
-
// TODO: Skip when `useImportNamespace`?
|
|
192
|
-
// Utility short-hand for grouped text styles
|
|
193
|
-
addBase(getGroupedTextStyles());
|
|
194
|
-
|
|
195
|
-
// Add responsive text styles
|
|
196
|
-
const enableResponsiveTypeRamp = config.globalDefaults.enableResponsiveType ?? false;
|
|
197
|
-
if (enableResponsiveTypeRamp && config.typography && config.breakpoints) {
|
|
198
|
-
addComponents(getResponsiveTextStyles(config));
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
/** Add shadow utilities to make shadow props available in Tailwind */
|
|
202
|
-
if (config.shadow) {
|
|
203
|
-
// Add _all_ shadow variables (drop & inset) variants to the root
|
|
204
|
-
const dropShadowVariables = getShadowPresetValues({ config, shadowType: 'drop' });
|
|
205
|
-
const insetShadowVariables = getShadowPresetValues({ config, shadowType: 'inset' });
|
|
206
|
-
addRootVariables({ ...dropShadowVariables, ...insetShadowVariables });
|
|
207
|
-
|
|
208
|
-
// Setup variants for drop & inset shadows
|
|
209
|
-
const dropShadowStyles = getShadowStyles({ config, shadowType: 'drop' });
|
|
210
|
-
const insetShadowStyles = getShadowStyles({ config, shadowType: 'inset' });
|
|
211
|
-
addUtilities({ ...dropShadowStyles, ...insetShadowStyles });
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
if (config.button) {
|
|
215
|
-
const buttonStyles = getTailwindButtonStyles(config.button, theme);
|
|
216
|
-
addComponents(buttonStyles);
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
if (config.iconButton) {
|
|
220
|
-
const iconButtonStyles = getTailwindIconButtonStyles(config.iconButton, theme);
|
|
221
|
-
addComponents(iconButtonStyles);
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
// TODO: figure out if this can be automated
|
|
225
|
-
if (config?.divider) {
|
|
226
|
-
const dividerStyles = generateStyles(DividerConfig, config.divider, theme, previewOptions);
|
|
227
|
-
addComponents(dividerStyles);
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
if (config?.link) {
|
|
231
|
-
const linkStyles = generateStyles(LinkConfig, config.link, theme, previewOptions);
|
|
232
|
-
addComponents(linkStyles);
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
if (config?.badge) {
|
|
236
|
-
const badgeStyles = generateStyles(BadgeConfig, config.badge, theme, previewOptions);
|
|
237
|
-
addComponents(badgeStyles);
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
if (config?.radio) {
|
|
241
|
-
const radioStyles = generateStyles(RadioConfig, config.radio, theme, previewOptions);
|
|
242
|
-
addComponents(radioStyles);
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
if (config?.avatar) {
|
|
246
|
-
const avatarStyles = generateStyles(AvatarConfig, config.avatar, theme, previewOptions);
|
|
247
|
-
addComponents(avatarStyles);
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
if (config?.chip) {
|
|
251
|
-
const chipStyles = generateStyles(ChipConfig, config.chip, theme, previewOptions);
|
|
252
|
-
addComponents(chipStyles);
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
if (config?.switch) {
|
|
256
|
-
const chipStyles = generateStyles(SwitchConfig, config.switch, theme, previewOptions);
|
|
257
|
-
addComponents(chipStyles);
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
if (config?.checkbox) {
|
|
261
|
-
const checkboxStyles = generateStyles(
|
|
262
|
-
CheckboxConfig,
|
|
263
|
-
config.checkbox,
|
|
264
|
-
theme,
|
|
265
|
-
previewOptions,
|
|
266
|
-
);
|
|
267
|
-
addComponents(checkboxStyles);
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
// TODO: May need to ensure portal is inside a importNamespace class
|
|
271
|
-
if (config?.menu) {
|
|
272
|
-
const menuStyles = generateStyles(MenuConfig, config.menu, theme, previewOptions);
|
|
273
|
-
addComponents(menuStyles);
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
if (config?.input) {
|
|
277
|
-
const inputStyles = generateStyles(InputConfig, config.input, theme, previewOptions);
|
|
278
|
-
addComponents(inputStyles);
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
if (config.motion) {
|
|
282
|
-
addMotionVars(config.motion, fns);
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
// TODO: Skip when `useImportNamespace`?
|
|
286
|
-
const hitTargetStyles = getHitTargetStyles();
|
|
287
|
-
addComponents(hitTargetStyles);
|
|
288
|
-
|
|
289
|
-
// TODO: Skip when `useImportNamespace`?
|
|
290
|
-
const focusRingStyles = getFocusRingStyles({ theme });
|
|
291
|
-
addComponents(focusRingStyles);
|
|
292
|
-
|
|
293
|
-
// TODO: Skip when `useImportNamespace`?
|
|
294
|
-
const inputStyles = getInputStyles();
|
|
295
|
-
addComponents(inputStyles);
|
|
296
|
-
|
|
297
|
-
const iconStyles = getIconStyles();
|
|
298
|
-
addBase(iconStyles);
|
|
299
|
-
|
|
300
|
-
matchUtilities(
|
|
301
|
-
{
|
|
302
|
-
iconSize: (value) => ({
|
|
303
|
-
width: value,
|
|
304
|
-
height: value,
|
|
305
|
-
fontSize: value,
|
|
306
|
-
lineHeight: value,
|
|
307
|
-
}),
|
|
308
|
-
},
|
|
309
|
-
{
|
|
310
|
-
values: theme('sizing.icon'),
|
|
311
|
-
},
|
|
312
|
-
);
|
|
313
|
-
|
|
314
|
-
matchUtilities(
|
|
315
|
-
{
|
|
316
|
-
avatarSize: (value) => ({
|
|
317
|
-
width: value,
|
|
318
|
-
height: value,
|
|
319
|
-
}),
|
|
320
|
-
},
|
|
321
|
-
{
|
|
322
|
-
values: theme('sizing.avatar'),
|
|
323
|
-
},
|
|
324
|
-
);
|
|
325
|
-
|
|
326
|
-
matchUtilities(
|
|
327
|
-
{
|
|
328
|
-
case: (value) => ({
|
|
329
|
-
'text-transform': value,
|
|
330
|
-
}),
|
|
331
|
-
},
|
|
332
|
-
{
|
|
333
|
-
values: theme('typography.textTransform'),
|
|
334
|
-
},
|
|
335
|
-
);
|
|
336
|
-
|
|
337
|
-
// Retrieve the font weight map from the tailwind config
|
|
338
|
-
const namedFontWeightsFromPlugin =
|
|
339
|
-
(theme('typography.fontWeight') as Record<
|
|
340
|
-
FontWeightDescriptive | TextVariant | string,
|
|
341
|
-
string
|
|
342
|
-
>) || {};
|
|
343
|
-
|
|
344
|
-
// Combine any of the named font weights passed into the plugin (label1, myCrazyFontWeight)
|
|
345
|
-
// with the default font weight map (thin, extralight, light, regular, medium, semibold, bold, extrabold, black)
|
|
346
|
-
const fontWeightsWithDescriptives = {
|
|
347
|
-
...fontWeightMap, // Remove when fontWeightMap is deprecated
|
|
348
|
-
...namedFontWeightsFromPlugin,
|
|
349
|
-
};
|
|
350
|
-
|
|
351
|
-
Object.entries(fontWeightsWithDescriptives).forEach(([fontWeight, value]) => {
|
|
352
|
-
const styles: Record<string, string> = {};
|
|
353
|
-
|
|
354
|
-
// If this font weight is one of the text variants, we need to use font-variation-settings
|
|
355
|
-
if (textVariants.map(textVariantsSafe).includes(fontWeight as TextVariant)) {
|
|
356
|
-
const textVariant = fontWeight as TextVariant;
|
|
357
|
-
styles['font-weight'] = value;
|
|
358
|
-
styles['font-variation-settings'] =
|
|
359
|
-
`"wght" ${value}, "slnt" ${theme(`typography.fontSlant.${textVariant}`)}, "wdth" ${theme(`typography.fontWidth.${textVariant}`)}`;
|
|
360
|
-
} else {
|
|
361
|
-
// Otherwise, we can just use the font-weight property
|
|
362
|
-
styles['font-weight'] = value;
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
// add .font-weight-bold, .font-weight-label1, .font-weight-myCrazyFontWeight, etc.
|
|
366
|
-
addUtilities({ [`.font-weight-${fontWeight}`]: styles });
|
|
367
|
-
});
|
|
368
|
-
|
|
369
|
-
matchUtilities(
|
|
370
|
-
{
|
|
371
|
-
'font-size': (value) => ({
|
|
372
|
-
'font-size': value,
|
|
373
|
-
}),
|
|
374
|
-
},
|
|
375
|
-
{
|
|
376
|
-
values: theme('typography.fontSize'),
|
|
377
|
-
},
|
|
378
|
-
);
|
|
379
|
-
};
|
|
380
|
-
},
|
|
381
|
-
function ({ config, safelist = [] }: TailwindPluginOptions) {
|
|
382
|
-
if (!config) {
|
|
383
|
-
throw new Error('No config provided');
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
const enableResponsiveTypeRamp = config.globalDefaults.enableResponsiveType ?? false;
|
|
387
|
-
|
|
388
|
-
const tokens = parseTokens(config);
|
|
389
|
-
const colorModeToken = tokens.colorMode[DEFAULT_COLOR_MODE].tailwindConfig;
|
|
390
|
-
const scaleModeToken = tokens.scaleMode[DEFAULT_SCALE_MODE];
|
|
391
|
-
const spectrumWithTailwind = mapValues(colorModeToken.spectrum, (hueConfig, hue) => {
|
|
392
|
-
return {
|
|
393
|
-
...hueConfig,
|
|
394
|
-
...tailwindColorsAsUds[hue as keyof typeof tailwindColorsAsUds]!,
|
|
395
|
-
};
|
|
396
|
-
});
|
|
397
|
-
|
|
398
|
-
/* --------------------------------- COLORS --------------------------------- */
|
|
399
|
-
// Shared across all color groups (i.e. text color, border, background, etc)
|
|
400
|
-
const colors = {
|
|
401
|
-
...tailwindColorsAsUds,
|
|
402
|
-
...spectrumWithTailwind,
|
|
403
|
-
...alwaysPalette,
|
|
404
|
-
};
|
|
405
|
-
const textColors = colorModeToken.palette.foreground;
|
|
406
|
-
const backgroundColors = colorModeToken.palette.background;
|
|
407
|
-
const borderColors = colorModeToken.palette.line;
|
|
408
|
-
|
|
409
|
-
/* -------------------------------- FONT SIZE ------------------------------- */
|
|
410
|
-
/**
|
|
411
|
-
* UDS does not offer enough text variants to cover all of Tailwind's font sizes
|
|
412
|
-
* so we are going to exclude the following from the UDS config:
|
|
413
|
-
*/
|
|
414
|
-
type ExcludedTwFontSizes = '7xl' | '8xl' | '9xl';
|
|
415
|
-
type TwFontSizeAlias = Exclude<keyof DefaultTheme['fontSize'], ExcludedTwFontSizes>;
|
|
416
|
-
type TwFontSizeConfig = Record<TwFontSizeAlias, [string, { lineHeight: string }]>;
|
|
417
|
-
|
|
418
|
-
/**
|
|
419
|
-
* Reassign Tailwind's font size aliases to UDS's font size aliases
|
|
420
|
-
* This makes it so UDS configs can power both Tailwind and UDS components
|
|
421
|
-
*/
|
|
422
|
-
const tailwindFontSize: TwFontSizeConfig = fromEntries(
|
|
423
|
-
entries(udsToTailwindMap.fontSize).map(([udsAlias, twAlias]) => {
|
|
424
|
-
return [
|
|
425
|
-
twAlias,
|
|
426
|
-
[
|
|
427
|
-
`var(--${FONT_SIZE_PREFIX}-${textVariantsSafe(udsAlias)})`,
|
|
428
|
-
{ lineHeight: `var(--${LINE_HEIGHT_PREFIX}-${textVariantsSafe(udsAlias)})` },
|
|
429
|
-
],
|
|
430
|
-
] as const;
|
|
431
|
-
}),
|
|
432
|
-
);
|
|
433
|
-
|
|
434
|
-
/**
|
|
435
|
-
* TODO: use tuple format like tailwind does to reduce having to use
|
|
436
|
-
* separate className utils for font size & line height
|
|
437
|
-
*/
|
|
438
|
-
const fontSize = tailwindFontSize;
|
|
439
|
-
|
|
440
|
-
/* ------------------------------ BORDER RADIUS ----------------------------- */
|
|
441
|
-
type ExcludedTwBorderRadii = '2xl' | '3xl';
|
|
442
|
-
type TwBorderRadiusAlias = Exclude<keyof DefaultTheme['borderRadius'], ExcludedTwBorderRadii>;
|
|
443
|
-
type TwBorderRadiusCollisions = Extract<BorderRadius, TwBorderRadiusAlias>;
|
|
444
|
-
type TwOnlyBorderRadiusAlias = Exclude<TwBorderRadiusAlias, TwBorderRadiusCollisions>;
|
|
445
|
-
type TwBorderRadiusOverride = `var(--${typeof BORDER_RADIUS_PREFIX}-${BorderRadius})`;
|
|
446
|
-
type TwBorderRadiusOverrideConfig = Record<TwOnlyBorderRadiusAlias, TwBorderRadiusOverride>;
|
|
447
|
-
/**
|
|
448
|
-
* The following tokens do not collide with UDS's border radius
|
|
449
|
-
* so we are not going to try and map them:
|
|
450
|
-
* - '2xl': 16,
|
|
451
|
-
* - '3xl': 24,
|
|
452
|
-
*/
|
|
453
|
-
const tailwindBorderRadius: TwBorderRadiusOverrideConfig = fromEntries(
|
|
454
|
-
entries(udsToTailwindMap.borderRadius).map(([udsAlias, twAlias]) => {
|
|
455
|
-
return [twAlias, `var(--${BORDER_RADIUS_PREFIX}-${udsAlias})`] as const;
|
|
456
|
-
}),
|
|
457
|
-
);
|
|
458
|
-
|
|
459
|
-
const borderRadius = {
|
|
460
|
-
...scaleModeToken.borderRadius.tailwindConfig,
|
|
461
|
-
...tailwindBorderRadius,
|
|
462
|
-
};
|
|
463
|
-
|
|
464
|
-
/* ------------------------------ BORDER WIDTH ------------------------------ */
|
|
465
|
-
type ExcludedTwBorderWidth = '0' | '8';
|
|
466
|
-
type TwBorderWidthAlias = Exclude<keyof DefaultTheme['borderWidth'], ExcludedTwBorderWidth>;
|
|
467
|
-
type TwBorderWidthCollisions = Extract<BorderWidth, TwBorderWidthAlias>;
|
|
468
|
-
type TwOnlyBorderWidthAlias = Exclude<TwBorderWidthAlias, TwBorderWidthCollisions>;
|
|
469
|
-
type TwBorderWidthOverride = `var(--${typeof BORDER_WIDTH_PREFIX}-${BorderWidth})`;
|
|
470
|
-
type TwBorderWidthOverrideConfig = Record<TwOnlyBorderWidthAlias, TwBorderWidthOverride>;
|
|
471
|
-
/**
|
|
472
|
-
* Reassign Tailwind's border width aliases to UDS's border width aliases
|
|
473
|
-
* This makes it so UDS configs can power both Tailwind and UDS components
|
|
474
|
-
*/
|
|
475
|
-
const tailwindBorderWidth: TwBorderWidthOverrideConfig = fromEntries(
|
|
476
|
-
entries(udsToTailwindMap.borderWidth).map(([udsAlias, twAlias]) => {
|
|
477
|
-
return [twAlias, `var(--${BORDER_WIDTH_PREFIX}-${udsAlias})`] as const;
|
|
478
|
-
}),
|
|
479
|
-
);
|
|
480
|
-
|
|
481
|
-
const borderWidth = {
|
|
482
|
-
...scaleModeToken.borderWidth.tailwindConfig,
|
|
483
|
-
...tailwindBorderWidth,
|
|
484
|
-
};
|
|
485
|
-
|
|
486
|
-
const textClasses = textVariants.map((variant) => `uds-text-${textVariantsSafe(variant)}`);
|
|
487
|
-
const responsiveTextClasses = [
|
|
488
|
-
TEXT_RESPONSIVE_CLASSNAME,
|
|
489
|
-
...Object.keys(TEXT_RESPONSIVE_BREAKPOINT_CLASSNAMES).map(
|
|
490
|
-
(variant) => TEXT_RESPONSIVE_BREAKPOINT_CLASSNAMES[variant as BreakpointWithBase],
|
|
491
|
-
),
|
|
492
|
-
];
|
|
493
|
-
|
|
494
|
-
return {
|
|
495
|
-
darkMode: ['class', DARK_COLOR_MODE_CLASSNAME],
|
|
496
|
-
// Guarantee that the dark mode class is not purged
|
|
497
|
-
safelist: [
|
|
498
|
-
'uds-hit-target',
|
|
499
|
-
'uds-ring',
|
|
500
|
-
'uds-switch-handle-icon',
|
|
501
|
-
'uds-input[list]::-webkit-calendar-picker-indicator',
|
|
502
|
-
'uds-input::-webkit-datetime-edit',
|
|
503
|
-
'uds-input::-webkit-calendar-picker-indicator',
|
|
504
|
-
// Guarantee that the light and dark mode class is not purged
|
|
505
|
-
LIGHT_COLOR_MODE_CLASSNAME,
|
|
506
|
-
DARK_COLOR_MODE_CLASSNAME,
|
|
507
|
-
INVERT_COLOR_MODE_CLASSNAME,
|
|
508
|
-
SYSTEM_COLOR_MODE_CLASSNAME,
|
|
509
|
-
// NOTE: THESE ICON CLASSES ARE USED IN THE ICON CODEGEN - DO NOT CHANGE THEM
|
|
510
|
-
'uds-light-mode-icon',
|
|
511
|
-
'uds-dark-mode-icon',
|
|
512
|
-
...textClasses,
|
|
513
|
-
...responsiveTextClasses,
|
|
514
|
-
...safelist,
|
|
515
|
-
],
|
|
516
|
-
theme: {
|
|
517
|
-
/**
|
|
518
|
-
* Preserve the default values from Tailwind, but also add new values
|
|
519
|
-
* https://tailwindcss.com/docs/theme#extending-the-default-theme
|
|
520
|
-
*/
|
|
521
|
-
extend: {
|
|
522
|
-
spacing: {
|
|
523
|
-
'4.5': '1.125rem',
|
|
524
|
-
'5.5': '1.375rem',
|
|
525
|
-
},
|
|
526
|
-
|
|
527
|
-
/**
|
|
528
|
-
* Use breakpoints from configurator.
|
|
529
|
-
*/
|
|
530
|
-
...(enableResponsiveTypeRamp
|
|
531
|
-
? {
|
|
532
|
-
screens: mapValues(config.breakpoints, (breakpoint) => {
|
|
533
|
-
switch (breakpoint.type) {
|
|
534
|
-
case 'px':
|
|
535
|
-
return `${breakpoint.value}px`;
|
|
536
|
-
}
|
|
537
|
-
|
|
538
|
-
return assertUnreachable(breakpoint.type);
|
|
539
|
-
}),
|
|
540
|
-
}
|
|
541
|
-
: {}),
|
|
542
|
-
|
|
543
|
-
/**
|
|
544
|
-
* Used in @ariakit/react https://ariakit.org/guide/styling#aria
|
|
545
|
-
* By default, Tailwind offers all of these. Including in this config
|
|
546
|
-
* to provide links to ariakit docs for ones that are shared between the two.
|
|
547
|
-
* This is not exhaustive, and only includes the shared ones at the moment.
|
|
548
|
-
* https://github.com/tailwindlabs/tailwindcss/blob/main/stubs/config.full.js#L17
|
|
549
|
-
*/
|
|
550
|
-
aria: {
|
|
551
|
-
/** https://ariakit.org/guide/styling#aria-checked */
|
|
552
|
-
checked: 'checked="true"',
|
|
553
|
-
/** https://ariakit.org/guide/styling#aria-disabled */
|
|
554
|
-
disabled: 'disabled="true"',
|
|
555
|
-
/** https://ariakit.org/guide/styling#aria-expanded */
|
|
556
|
-
expanded: 'expanded="true"',
|
|
557
|
-
/** https://ariakit.org/guide/styling#aria-invalid */
|
|
558
|
-
invalid: 'aria-invalid="true"',
|
|
559
|
-
},
|
|
560
|
-
/**
|
|
561
|
-
* Used in @ariakit/react https://ariakit.org/guide/styling#css-selectors
|
|
562
|
-
* By default, Tailwind does not include any values for this option
|
|
563
|
-
* https://github.com/tailwindlabs/tailwindcss/blob/main/stubs/config.full.js#L888
|
|
564
|
-
*/
|
|
565
|
-
data: {
|
|
566
|
-
active: 'active="true"',
|
|
567
|
-
'active-item': 'active-item="true"',
|
|
568
|
-
autofill: 'autofill="true"',
|
|
569
|
-
backdrop: 'backdrop="true"',
|
|
570
|
-
enter: 'enter="true"',
|
|
571
|
-
leave: 'leave="true"',
|
|
572
|
-
'focus-visible': 'focus-visible="true"',
|
|
573
|
-
},
|
|
574
|
-
/**
|
|
575
|
-
* https://github.com/tailwindlabs/tailwindcss/blob/main/stubs/config.full.js#L87
|
|
576
|
-
*/
|
|
577
|
-
borderRadius,
|
|
578
|
-
/**
|
|
579
|
-
* https://github.com/tailwindlabs/tailwindcss/blob/main/stubs/config.full.js#L101
|
|
580
|
-
*/
|
|
581
|
-
borderWidth,
|
|
582
|
-
/**
|
|
583
|
-
* https://github.com/tailwindlabs/tailwindcss/blob/main/stubs/config.full.js#L751
|
|
584
|
-
*/
|
|
585
|
-
outlineWidth: {
|
|
586
|
-
...borderWidth,
|
|
587
|
-
// Set the default to 2px regardless of size config
|
|
588
|
-
DEFAULT: '2px',
|
|
589
|
-
},
|
|
590
|
-
/**
|
|
591
|
-
* https://github.com/tailwindlabs/tailwindcss/blob/main/stubs/config.full.js#L744
|
|
592
|
-
*/
|
|
593
|
-
outlineOffset: {
|
|
594
|
-
...borderWidth,
|
|
595
|
-
// Set the default to 2px regardless of size config
|
|
596
|
-
DEFAULT: '2px',
|
|
597
|
-
},
|
|
598
|
-
/**
|
|
599
|
-
* Colors object is included by default, but that does not include UDS semantic border colors
|
|
600
|
-
* https://github.com/tailwindlabs/tailwindcss/blob/main/stubs/config.full.js#L743
|
|
601
|
-
*/
|
|
602
|
-
outlineColor: ({ theme }) => ({
|
|
603
|
-
...borderColors,
|
|
604
|
-
DEFAULT: theme('colors.gray.15'),
|
|
605
|
-
}),
|
|
606
|
-
/**
|
|
607
|
-
* https://github.com/tailwindlabs/tailwindcss/blob/main/stubs/config.full.js#L302
|
|
608
|
-
*/
|
|
609
|
-
fontFamily: getFontFamilyTheme(),
|
|
610
|
-
/**
|
|
611
|
-
* https://github.com/tailwindlabs/tailwindcss/blob/main/stubs/config.full.js#L324
|
|
612
|
-
*/
|
|
613
|
-
fontSize,
|
|
614
|
-
/**
|
|
615
|
-
* https://github.com/tailwindlabs/tailwindcss/blob/main/stubs/config.full.js#L605
|
|
616
|
-
*/
|
|
617
|
-
lineHeight: RESPONSIVE_TAILWIND_CONFIG_MAP.lineHeight,
|
|
618
|
-
/**
|
|
619
|
-
* https://github.com/tailwindlabs/tailwindcss/blob/main/stubs/config.full.js#L133
|
|
620
|
-
*/
|
|
621
|
-
colors,
|
|
622
|
-
/**
|
|
623
|
-
* Colors object is included by default, but that does not include UDS semantic background colors
|
|
624
|
-
* https://github.com/tailwindlabs/tailwindcss/blob/main/stubs/config.full.js#L42
|
|
625
|
-
*/
|
|
626
|
-
backgroundColor: backgroundColors,
|
|
627
|
-
/**
|
|
628
|
-
* Colors object is included by default, but that does not include UDS semantic text colors
|
|
629
|
-
* https://github.com/tailwindlabs/tailwindcss/blob/main/stubs/config.full.js#L889
|
|
630
|
-
*/
|
|
631
|
-
textColor: textColors,
|
|
632
|
-
/**
|
|
633
|
-
* Colors object is included by default, but that does not include UDS semantic border colors
|
|
634
|
-
* https://github.com/tailwindlabs/tailwindcss/blob/main/stubs/config.full.js#L82
|
|
635
|
-
*/
|
|
636
|
-
borderColor: borderColors,
|
|
637
|
-
/**
|
|
638
|
-
* Colors object is included by default, but that does not include UDS semantic background colors
|
|
639
|
-
* https://github.com/tailwindlabs/tailwindcss/blob/main/stubs/config.full.js#L253
|
|
640
|
-
*/
|
|
641
|
-
fill: backgroundColors,
|
|
642
|
-
/**
|
|
643
|
-
* Colors object is included by default, but that does not include UDS semantic text colors
|
|
644
|
-
* https://github.com/tailwindlabs/tailwindcss/blob/main/stubs/config.full.js#L132
|
|
645
|
-
*/
|
|
646
|
-
caretColor: textColors,
|
|
647
|
-
/**
|
|
648
|
-
* Colors object is included by default, but that does not include UDS semantic text colors
|
|
649
|
-
* https://github.com/tailwindlabs/tailwindcss/blob/main/stubs/config.full.js#L759
|
|
650
|
-
*/
|
|
651
|
-
placeholderColor: textColors,
|
|
652
|
-
/**
|
|
653
|
-
* Colors object is included by default, but that does not include UDS semantic text colors
|
|
654
|
-
* https://github.com/tailwindlabs/tailwindcss/blob/main/stubs/config.full.js#L890
|
|
655
|
-
*/
|
|
656
|
-
textDecorationColor: textColors,
|
|
657
|
-
/**
|
|
658
|
-
* Colors object is included by default, but that does not include UDS semantic border colors
|
|
659
|
-
* https://github.com/tailwindlabs/tailwindcss/blob/main/stubs/config.full.js#L241
|
|
660
|
-
*/
|
|
661
|
-
divideColor: borderColors,
|
|
662
|
-
/**
|
|
663
|
-
* Colors object is included by default, but that does not include UDS semantic border colors
|
|
664
|
-
* https://github.com/tailwindlabs/tailwindcss/blob/main/stubs/config.full.js#L761
|
|
665
|
-
*/
|
|
666
|
-
ringColor: borderColors,
|
|
667
|
-
/**
|
|
668
|
-
* Colors object is included by default, but that does not include UDS semantic border colors
|
|
669
|
-
* https://github.com/tailwindlabs/tailwindcss/blob/main/stubs/config.full.js#L765
|
|
670
|
-
*/
|
|
671
|
-
ringOffsetColor: borderColors,
|
|
672
|
-
/**
|
|
673
|
-
* Colors object is included by default, but that does not include UDS semantic border colors
|
|
674
|
-
* https://github.com/tailwindlabs/tailwindcss/blob/main/stubs/config.full.js#L878
|
|
675
|
-
*/
|
|
676
|
-
stroke: borderColors,
|
|
677
|
-
/**
|
|
678
|
-
* Gradient color stops object is included by default, but that does not include UDS palette background colors
|
|
679
|
-
* https://github.com/tailwindlabs/tailwindcss/blob/main/stubs/config.full.js#L42
|
|
680
|
-
*/
|
|
681
|
-
gradientColorStops: ({ theme }) => ({
|
|
682
|
-
...backgroundColors,
|
|
683
|
-
...theme('colors'),
|
|
684
|
-
}),
|
|
685
|
-
/**
|
|
686
|
-
* Custom typography object added to theme so we can access these values using Tailwind's theme function.
|
|
687
|
-
*
|
|
688
|
-
* Tailwind's className conventions would cause collisions (i.e .font-body1 for fontWeight and .font-body1 for fontSize)
|
|
689
|
-
* if we were to use our naming conventions with Tailwind's theme shape.
|
|
690
|
-
*/
|
|
691
|
-
typography: RESPONSIVE_TAILWIND_CONFIG_MAP,
|
|
692
|
-
sizing: {
|
|
693
|
-
icon: scaleModeToken.iconSizes.tailwindConfig,
|
|
694
|
-
avatar: scaleModeToken.avatarSizes.tailwindConfig,
|
|
695
|
-
},
|
|
696
|
-
shadowOpacity: shadowOpacityMap,
|
|
697
|
-
shadowSpread: shadowSpreadRadiusMap,
|
|
698
|
-
shadowOffset: shadowOffsetMap,
|
|
699
|
-
shadowBlur: shadowOffsetMap,
|
|
700
|
-
},
|
|
701
|
-
},
|
|
702
|
-
};
|
|
703
|
-
},
|
|
704
|
-
);
|
|
705
|
-
|
|
706
|
-
/**
|
|
707
|
-
* Use in `tailwindConfig.content` to ensure UDS package(s) styles are
|
|
708
|
-
* included in the app.
|
|
709
|
-
* Note: wrapped in a function so client side usage of the tailwind plugin package
|
|
710
|
-
* (e.g. configurator) doesn't error out on require() being undefined.
|
|
711
|
-
* */
|
|
712
|
-
const getUDSContent = () => {
|
|
713
|
-
return [require.resolve('@yahoo/uds').replace('/dist/index.cjs', '/dist/**/*.{js,cjs}')];
|
|
714
|
-
};
|
|
715
|
-
|
|
716
|
-
export {
|
|
717
|
-
getButtonStyles,
|
|
718
|
-
getIconButtonStyles,
|
|
719
|
-
getInputStyles,
|
|
720
|
-
getUDSContent,
|
|
721
|
-
tailwindPlugin,
|
|
722
|
-
udsToTailwindMap,
|
|
723
|
-
};
|
|
724
|
-
export { getButtonColorForProperty } from './components/utils';
|