@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.
Files changed (304) hide show
  1. package/cli/bin/uds-darwin-arm64-baseline +0 -0
  2. package/cli/bin/uds-darwin-x64 +0 -0
  3. package/cli/bin/uds-linux-arm64 +0 -0
  4. package/cli/bin/uds-linux-x64-baseline +0 -0
  5. package/dist/components/Box.d.ts +2 -2
  6. package/dist/components/Box.d.ts.map +1 -1
  7. package/dist/components/Divider/Divider.d.cts +2 -2
  8. package/dist/components/Divider/Divider.d.ts +2 -2
  9. package/dist/components/Divider/DividerCore.d.cts +2 -2
  10. package/dist/components/Divider/DividerCore.d.ts +2 -2
  11. package/dist/components/Divider/DividerInternal.d.cts +2 -2
  12. package/dist/components/Divider/DividerInternal.d.ts +2 -2
  13. package/dist/components/FormLabel.d.ts +2 -2
  14. package/dist/components/HStack.d.ts +2 -2
  15. package/dist/components/Icon.d.ts +2 -2
  16. package/dist/components/Link.d.ts +2 -2
  17. package/dist/components/Text.d.cts +5 -5
  18. package/dist/components/Text.d.cts.map +1 -1
  19. package/dist/components/Text.d.ts +8 -8
  20. package/dist/components/Text.d.ts.map +1 -1
  21. package/dist/components/VStack.d.ts +2 -2
  22. package/dist/components/VStack.d.ts.map +1 -1
  23. package/dist/components/client/AnimateHeightChange.d.cts +2 -2
  24. package/dist/components/client/AnimateHeightChange.d.ts +2 -2
  25. package/dist/components/client/Avatar/Avatar.d.cts +2 -2
  26. package/dist/components/client/Avatar/Avatar.d.cts.map +1 -1
  27. package/dist/components/client/Avatar/Avatar.d.ts +2 -2
  28. package/dist/components/client/Avatar/AvatarIcon.d.cts +2 -2
  29. package/dist/components/client/Avatar/AvatarIcon.d.cts.map +1 -1
  30. package/dist/components/client/Avatar/AvatarIcon.d.ts +2 -2
  31. package/dist/components/client/Avatar/AvatarImage.d.cts +2 -2
  32. package/dist/components/client/Avatar/AvatarImage.d.ts +2 -2
  33. package/dist/components/client/Avatar/AvatarText.d.cts +2 -2
  34. package/dist/components/client/Avatar/AvatarText.d.ts +2 -2
  35. package/dist/components/client/IconButton.d.cts +2 -2
  36. package/dist/components/client/IconButton.d.ts +2 -2
  37. package/dist/components/client/IconButton.d.ts.map +1 -1
  38. package/dist/components/client/Input/Input.d.cts +2 -2
  39. package/dist/components/client/Input/Input.d.ts +2 -2
  40. package/dist/components/client/Input/InputHelpText.d.cts +2 -2
  41. package/dist/components/client/Input/InputHelpText.d.cts.map +1 -1
  42. package/dist/components/client/Input/InputHelpText.d.ts +2 -2
  43. package/dist/components/client/Input/InputHelpTextInternal.d.cts +4 -4
  44. package/dist/components/client/Input/InputHelpTextInternal.d.cts.map +1 -1
  45. package/dist/components/client/Input/InputHelpTextInternal.d.ts +4 -4
  46. package/dist/components/client/Menu/Menu.Content.d.cts +2 -2
  47. package/dist/components/client/Menu/Menu.Content.d.ts +2 -2
  48. package/dist/components/client/Menu/Menu.Divider.d.cts +2 -2
  49. package/dist/components/client/Menu/Menu.Divider.d.ts +2 -2
  50. package/dist/components/client/Menu/Menu.Item.d.cts +2 -2
  51. package/dist/components/client/Menu/Menu.ItemBase.d.cts +2 -2
  52. package/dist/components/client/Menu/Menu.ItemBase.d.ts +2 -2
  53. package/dist/components/client/Menu/Menu.ItemCheckbox.d.cts +2 -2
  54. package/dist/components/client/Menu/Menu.ItemCheckbox.d.ts +2 -2
  55. package/dist/components/client/Menu/Menu.Provider.d.cts +2 -2
  56. package/dist/components/client/Menu/Menu.Provider.d.ts +2 -2
  57. package/dist/components/client/Menu/Menu.Trigger.d.cts +2 -2
  58. package/dist/components/client/Menu/Menu.Trigger.d.ts +2 -2
  59. package/dist/components/client/Pressable.d.cts +2 -2
  60. package/dist/components/client/Pressable.d.ts +2 -2
  61. package/dist/components/client/Pressable.d.ts.map +1 -1
  62. package/dist/components/client/Radio/RadioGroupStore.d.ts +2 -2
  63. package/dist/components/client/SpringMotionConfig.d.cts +3 -3
  64. package/dist/components/client/SpringMotionConfig.d.ts +3 -3
  65. package/dist/components/client/SpringMotionConfig.d.ts.map +1 -1
  66. package/dist/components/experimental/Spinner.d.cts +2 -2
  67. package/dist/components/experimental/Spinner.d.cts.map +1 -1
  68. package/dist/components/experimental/Spinner.d.ts +2 -2
  69. package/dist/components/experimental/Table.d.cts +2 -2
  70. package/dist/components/experimental/Table.d.ts +2 -2
  71. package/dist/components/experimental/client/Accordion.d.cts +2 -2
  72. package/dist/components/experimental/client/Accordion.d.cts.map +1 -1
  73. package/dist/components/experimental/client/Accordion.d.ts +2 -2
  74. package/dist/components/experimental/client/AvoidMotionLibraryProvider.d.cts +2 -2
  75. package/dist/components/experimental/client/AvoidMotionLibraryProvider.d.ts +2 -2
  76. package/dist/components/experimental/client/Modal.d.cts +3 -3
  77. package/dist/components/experimental/client/Modal.d.cts.map +1 -1
  78. package/dist/components/experimental/client/Modal.d.ts +3 -3
  79. package/dist/components/experimental/client/Popover.d.cts +3 -3
  80. package/dist/components/experimental/client/Popover.d.cts.map +1 -1
  81. package/dist/components/experimental/client/Popover.d.ts +3 -3
  82. package/dist/components/experimental/client/Tabs.d.cts +3 -3
  83. package/dist/components/experimental/client/Tabs.d.ts +6 -6
  84. package/dist/components/experimental/client/Toast.d.cts +2 -2
  85. package/dist/components/experimental/client/Toast.d.ts +2 -2
  86. package/dist/providers/ColorModeProvider.d.cts +4 -4
  87. package/dist/providers/ColorModeProvider.d.cts.map +1 -1
  88. package/dist/providers/ColorModeProvider.d.ts +4 -4
  89. package/dist/providers/ColorModeProvider.d.ts.map +1 -1
  90. package/dist/providers/ScaleModeProvider.d.cts +4 -4
  91. package/dist/providers/ScaleModeProvider.d.cts.map +1 -1
  92. package/dist/providers/ScaleModeProvider.d.ts +4 -4
  93. package/dist/providers/ScaleModeProvider.d.ts.map +1 -1
  94. package/dist/providers/ThemeProvider.d.cts +2 -2
  95. package/dist/providers/ThemeProvider.d.cts.map +1 -1
  96. package/dist/providers/ThemeProvider.d.ts +2 -2
  97. package/dist/styles/styler.d.cts +33 -33
  98. package/dist/styles/styler.d.ts +33 -33
  99. package/dist/styles/stylerTypes.d.ts.map +1 -1
  100. package/dist/tailwind/tailwind.config.d.ts +3 -3
  101. package/dist/tailwind/tailwindPlugin.d.ts +3 -3
  102. package/dist/tailwind/utils/getMotionStyles.d.cts +1 -1
  103. package/dist/tailwind/utils/getMotionStyles.d.ts +1 -1
  104. package/dist/tokens/automation/utils/getConfigVariantProperties.d.cts +2 -2
  105. package/dist/tokens/automation/utils/getConfigVariantProperties.d.cts.map +1 -1
  106. package/dist/tokens/automation/utils/getConfigVariantProperties.d.ts +2 -2
  107. package/dist/tokens/automation/utils/getConfigVariantProperties.d.ts.map +1 -1
  108. package/dist/tokens/types.d.cts.map +1 -1
  109. package/dist/tokens/types.d.ts.map +1 -1
  110. package/dist/utils/intersperse.d.cts +2 -2
  111. package/dist/utils/intersperse.d.ts +2 -2
  112. package/package.json +1 -3
  113. package/cli/FlattenButtonVariant.mock.tsx +0 -17
  114. package/src/components/Box.tsx +0 -181
  115. package/src/components/Divider/Divider.tsx +0 -44
  116. package/src/components/Divider/DividerCore.tsx +0 -101
  117. package/src/components/Divider/DividerInternal.tsx +0 -56
  118. package/src/components/Divider/index.ts +0 -1
  119. package/src/components/FormLabel.tsx +0 -66
  120. package/src/components/HStack.tsx +0 -53
  121. package/src/components/Icon.tsx +0 -82
  122. package/src/components/IconSlot.tsx +0 -82
  123. package/src/components/Image.tsx +0 -162
  124. package/src/components/Link.tsx +0 -134
  125. package/src/components/Text.tsx +0 -272
  126. package/src/components/VStack.tsx +0 -53
  127. package/src/components/client/AnimateHeightChange.tsx +0 -50
  128. package/src/components/client/Avatar/Avatar.tsx +0 -31
  129. package/src/components/client/Avatar/AvatarIcon.tsx +0 -103
  130. package/src/components/client/Avatar/AvatarImage.tsx +0 -147
  131. package/src/components/client/Avatar/AvatarText.tsx +0 -88
  132. package/src/components/client/Avatar/index.ts +0 -4
  133. package/src/components/client/Avatar/utils.ts +0 -105
  134. package/src/components/client/Badge.tsx +0 -133
  135. package/src/components/client/Button.tsx +0 -312
  136. package/src/components/client/Checkbox.tsx +0 -377
  137. package/src/components/client/Chip/Chip.tsx +0 -81
  138. package/src/components/client/Chip/ChipBase.tsx +0 -151
  139. package/src/components/client/Chip/ChipButton.tsx +0 -54
  140. package/src/components/client/Chip/ChipDismissible.tsx +0 -90
  141. package/src/components/client/Chip/ChipLink.tsx +0 -60
  142. package/src/components/client/Chip/ChipToggle.tsx +0 -79
  143. package/src/components/client/Chip/index.ts +0 -5
  144. package/src/components/client/IconButton.tsx +0 -198
  145. package/src/components/client/Input/Input.tsx +0 -323
  146. package/src/components/client/Input/InputHelpText.tsx +0 -52
  147. package/src/components/client/Input/InputHelpTextInternal.tsx +0 -81
  148. package/src/components/client/Input/index.ts +0 -2
  149. package/src/components/client/Menu/Menu.Content.tsx +0 -391
  150. package/src/components/client/Menu/Menu.Divider.tsx +0 -102
  151. package/src/components/client/Menu/Menu.Item.tsx +0 -114
  152. package/src/components/client/Menu/Menu.ItemBase.tsx +0 -265
  153. package/src/components/client/Menu/Menu.ItemCheckbox.tsx +0 -197
  154. package/src/components/client/Menu/Menu.Provider.tsx +0 -154
  155. package/src/components/client/Menu/Menu.Trigger.tsx +0 -119
  156. package/src/components/client/Menu/Menu.index.tsx +0 -9
  157. package/src/components/client/Menu/Menu.tsx +0 -2
  158. package/src/components/client/Menu/index.ts +0 -7
  159. package/src/components/client/Menu/utils/transformAriakitPlacement.ts +0 -66
  160. package/src/components/client/Pressable.tsx +0 -194
  161. package/src/components/client/Radio/Radio.tsx +0 -351
  162. package/src/components/client/Radio/RadioGroupProvider.tsx +0 -122
  163. package/src/components/client/Radio/RadioGroupStore.tsx +0 -56
  164. package/src/components/client/Radio/index.ts +0 -2
  165. package/src/components/client/Radio/useRadioGroup.ts +0 -149
  166. package/src/components/client/SpringMotionConfig.tsx +0 -151
  167. package/src/components/client/Switch.tsx +0 -377
  168. package/src/components/client/index.ts +0 -30
  169. package/src/components/client/motionFeatures/domAnimation.ts +0 -2
  170. package/src/components/client/motionFeatures/domMax.ts +0 -2
  171. package/src/components/experimental/Spinner.tsx +0 -30
  172. package/src/components/experimental/Table.mocks.tsx +0 -38
  173. package/src/components/experimental/Table.tsx +0 -239
  174. package/src/components/experimental/client/Accordion.tsx +0 -77
  175. package/src/components/experimental/client/AvoidMotionLibraryProvider.tsx +0 -10
  176. package/src/components/experimental/client/Modal.tsx +0 -68
  177. package/src/components/experimental/client/Popover.tsx +0 -63
  178. package/src/components/experimental/client/SwitchV2.tsx +0 -343
  179. package/src/components/experimental/client/Tabs.tsx +0 -106
  180. package/src/components/experimental/client/Toast.tsx +0 -186
  181. package/src/components/experimental/client/index.ts +0 -15
  182. package/src/components/experimental/index.ts +0 -48
  183. package/src/components/index.ts +0 -41
  184. package/src/defaultTokensConfig.ts +0 -31
  185. package/src/fixtures/index.ts +0 -638
  186. package/src/fixtures/macros/typesToConstants.ts +0 -42
  187. package/src/fixtures/utils/getScaleModeRamp.ts +0 -48
  188. package/src/fixtures/utils/getTailwindAsUdsColors.ts +0 -115
  189. package/src/flags.ts +0 -45
  190. package/src/hooks/useForkRef.ts +0 -34
  191. package/src/hooks/useNestedBorderRadius.ts +0 -138
  192. package/src/hooks/useRtl.ts +0 -64
  193. package/src/index.ts +0 -4
  194. package/src/providers/ColorModeProvider.tsx +0 -21
  195. package/src/providers/ScaleModeProvider.tsx +0 -29
  196. package/src/providers/ThemeProvider.tsx +0 -26
  197. package/src/styles/styler.ts +0 -194
  198. package/src/styles/stylerTypes.ts +0 -81
  199. package/src/styles/toast.css +0 -0
  200. package/src/styles/variants.ts +0 -1351
  201. package/src/tailwind/base/addColorModeVars.ts +0 -23
  202. package/src/tailwind/base/addColorModeVarsV2.ts +0 -57
  203. package/src/tailwind/base/addFontFaceDeclarations.ts +0 -13
  204. package/src/tailwind/base/addFontVars.ts +0 -9
  205. package/src/tailwind/base/addMotionVars.ts +0 -9
  206. package/src/tailwind/base/addScaleModeVars.ts +0 -33
  207. package/src/tailwind/base/types.ts +0 -8
  208. package/src/tailwind/components/getButtonStyles.ts +0 -240
  209. package/src/tailwind/components/getFocusRingStyles.ts +0 -32
  210. package/src/tailwind/components/getGroupedTextStyles.ts +0 -29
  211. package/src/tailwind/components/getHitTargetStyles.ts +0 -23
  212. package/src/tailwind/components/getIconButtonStyles.ts +0 -49
  213. package/src/tailwind/components/getIconStyles.ts +0 -13
  214. package/src/tailwind/components/getInputStyles.ts +0 -20
  215. package/src/tailwind/components/getResponsiveTextStyles.ts +0 -161
  216. package/src/tailwind/components/types.ts +0 -14
  217. package/src/tailwind/components/utils.ts +0 -73
  218. package/src/tailwind/defaultTailwindThemeAsUdsConfig.ts +0 -78
  219. package/src/tailwind/postcss.config.ts +0 -6
  220. package/src/tailwind/purger/index.ts +0 -1
  221. package/src/tailwind/tailwind.config.ts +0 -50
  222. package/src/tailwind/tailwind.d.ts +0 -5
  223. package/src/tailwind/tailwindPlugin.ts +0 -724
  224. package/src/tailwind/theme/getFontFamilyTheme.ts +0 -28
  225. package/src/tailwind/tsMorph.ts +0 -1
  226. package/src/tailwind/uds.css +0 -3
  227. package/src/tailwind/utils/addFontsPlugin.ts +0 -17
  228. package/src/tailwind/utils/getColorModeStyles.ts +0 -21
  229. package/src/tailwind/utils/getFontFaceDeclarations.ts +0 -12
  230. package/src/tailwind/utils/getFontStyles.ts +0 -38
  231. package/src/tailwind/utils/getMotionStyles.ts +0 -35
  232. package/src/tailwind/utils/getScaleModeStyles.ts +0 -23
  233. package/src/tailwind/utils/getShadowPresetValues.ts +0 -133
  234. package/src/tailwind/utils/getShadowStyles.ts +0 -26
  235. package/src/tailwind/utils/getShadowVars.ts +0 -40
  236. package/src/tailwind/utils/index.ts +0 -9
  237. package/src/tokens/automation/configs/avatar.ts +0 -297
  238. package/src/tokens/automation/configs/badge.ts +0 -306
  239. package/src/tokens/automation/configs/checkbox.ts +0 -226
  240. package/src/tokens/automation/configs/chip.ts +0 -521
  241. package/src/tokens/automation/configs/divider.ts +0 -112
  242. package/src/tokens/automation/configs/index.ts +0 -10
  243. package/src/tokens/automation/configs/input.ts +0 -496
  244. package/src/tokens/automation/configs/link.ts +0 -183
  245. package/src/tokens/automation/configs/menu.ts +0 -344
  246. package/src/tokens/automation/configs/radio.ts +0 -225
  247. package/src/tokens/automation/configs/switch.ts +0 -323
  248. package/src/tokens/automation/index.ts +0 -5
  249. package/src/tokens/automation/mapTextVariantFixtureToValue.ts +0 -8
  250. package/src/tokens/automation/properties.ts +0 -433
  251. package/src/tokens/automation/types/ComponentConfig.ts +0 -116
  252. package/src/tokens/automation/types/ComponentDB.ts +0 -1
  253. package/src/tokens/automation/types/ComponentStyles.ts +0 -47
  254. package/src/tokens/automation/types/index.ts +0 -2
  255. package/src/tokens/automation/utils/cartesianProduct.ts +0 -13
  256. package/src/tokens/automation/utils/coalesceConfigVariant.ts +0 -49
  257. package/src/tokens/automation/utils/defaults.ts +0 -29
  258. package/src/tokens/automation/utils/generateKeyFromFlatConfigPath.ts +0 -15
  259. package/src/tokens/automation/utils/generateSchemaKey.ts +0 -29
  260. package/src/tokens/automation/utils/getConfigComponentVariant.ts +0 -28
  261. package/src/tokens/automation/utils/getConfigVariantComponentStatesMatrix.ts +0 -40
  262. package/src/tokens/automation/utils/getConfigVariantProperties.ts +0 -32
  263. package/src/tokens/automation/utils/getConfigVariantPseudoStates.ts +0 -70
  264. package/src/tokens/automation/utils/getConfigVariants.ts +0 -73
  265. package/src/tokens/automation/utils/index.ts +0 -939
  266. package/src/tokens/automation/utils/mapColorFixtureToValue.ts +0 -34
  267. package/src/tokens/automation/utils/subcomponents.ts +0 -13
  268. package/src/tokens/automation/utils/variableData.ts +0 -79
  269. package/src/tokens/automation/utils/variantConfigGuards.ts +0 -17
  270. package/src/tokens/configs/borderRadius.ts +0 -23
  271. package/src/tokens/configs/borderWidth.ts +0 -17
  272. package/src/tokens/configs/button.ts +0 -888
  273. package/src/tokens/configs/colorMode.ts +0 -14
  274. package/src/tokens/configs/font.ts +0 -9
  275. package/src/tokens/configs/iconButton.ts +0 -28
  276. package/src/tokens/configs/motion.ts +0 -135
  277. package/src/tokens/configs/palette.ts +0 -124
  278. package/src/tokens/configs/scaleMode.ts +0 -28
  279. package/src/tokens/configs/shadow.ts +0 -286
  280. package/src/tokens/configs/sizes.ts +0 -23
  281. package/src/tokens/configs/spectrum.ts +0 -729
  282. package/src/tokens/configs/typography.ts +0 -417
  283. package/src/tokens/configs/yosConfig.ts +0 -7651
  284. package/src/tokens/consts/buttonMotionTokens.ts +0 -99
  285. package/src/tokens/consts/cssTokens.ts +0 -110
  286. package/src/tokens/consts/defaultModes.ts +0 -15
  287. package/src/tokens/consts/fontDeclarationsMap.ts +0 -509
  288. package/src/tokens/index.ts +0 -15
  289. package/src/tokens/parseButtonVariants.ts +0 -59
  290. package/src/tokens/parseTokens.ts +0 -122
  291. package/src/tokens/types.ts +0 -1882
  292. package/src/tokens/utils/entries.ts +0 -14
  293. package/src/tokens/utils/fromEntries.ts +0 -11
  294. package/src/tokens/utils/mapValues.ts +0 -15
  295. package/src/types.ts +0 -2
  296. package/src/utils/assertUnreachable.ts +0 -6
  297. package/src/utils/composeRefs.ts +0 -23
  298. package/src/utils/createSlot.tsx +0 -131
  299. package/src/utils/entries.ts +0 -6
  300. package/src/utils/falsyToString.ts +0 -3
  301. package/src/utils/getMotionVar.ts +0 -18
  302. package/src/utils/intersperse.ts +0 -45
  303. package/src/utils/mapValues.ts +0 -15
  304. package/src/utils/mergeSlotProps.ts +0 -70
@@ -1,433 +0,0 @@
1
- import type {
2
- AllPossibleProperties,
3
- PossibleStates,
4
- SchemaStateValue,
5
- ShadowType,
6
- ShadowVariantConfig,
7
- } from '@yahoo/uds/tokens';
8
-
9
- import { textVariantsSafe } from '../../tailwind/components/getResponsiveTextStyles';
10
- import { getShadowLayerValue } from '../../tailwind/utils/getShadowPresetValues';
11
- import { mapTextVariantFixtureToValue } from './mapTextVariantFixtureToValue';
12
- import { mapColorFixtureToValue } from './utils/mapColorFixtureToValue';
13
-
14
- type DispatchContext = {
15
- componentName: string;
16
- subComponentName?: string;
17
- propertyKey: string;
18
- layer: string;
19
- };
20
-
21
- // TODO: Find a better home or way to dispatch this.
22
- const shouldUseOutlineInsteadOfBorder = ({
23
- componentName,
24
- layer,
25
- propertyKey,
26
- }: DispatchContext): boolean => {
27
- if (
28
- componentName === 'chip' &&
29
- layer === 'root' &&
30
- ['borderColor', 'borderWidth'].includes(propertyKey)
31
- ) {
32
- return true;
33
- }
34
-
35
- if (
36
- componentName === 'input' &&
37
- layer === 'inputWrapper' &&
38
- ['borderColor', 'borderWidth'].includes(propertyKey)
39
- ) {
40
- return true;
41
- }
42
-
43
- return false;
44
- };
45
-
46
- interface ConfigurableProperty<T extends AllPossibleProperties, CVR = unknown> {
47
- name: string;
48
- // The css properties that this configurable property affects
49
- // they will all have the same value
50
- cssProperties: string | string[];
51
- // Accepts only one of the allowed fixture values
52
- // TODO: once you have more info, make value more type safe
53
- twThemePath: (selected: T, value: string) => string;
54
- // possibleFixtures here represents the union of allowed fixture values.
55
- possibleFixtures: T[];
56
- // some properties are composed of other properties (example: text variant)
57
- extendedProperties?:
58
- | ExtendablePropertiesName[]
59
- | ((context: DispatchContext) => ExtendablePropertiesName[] | undefined | false);
60
- // custom value renderer - if present, this will be used instead of twThemePath
61
- customValueRenderer?: (
62
- schemaStateValue: SchemaStateValue<CVR>,
63
- schema: unknown,
64
- themeGetter: (path: string) => string,
65
- ) => string;
66
- // Flag to indicate this property's values should be concatenated
67
- concatenate?: boolean;
68
- // How to join multiple values (default: ", ")
69
- concatenationDelimiter?: string;
70
- }
71
-
72
- /// CONFIGURABLE PROPERTIES
73
- const backgroundColor: ConfigurableProperty<
74
- 'backgroundPaletteColors' | 'spectrumColors' | 'alwaysPaletteAliases'
75
- > = {
76
- name: 'backgroundColor',
77
- cssProperties: 'background-color',
78
- twThemePath: mapColorFixtureToValue,
79
- possibleFixtures: ['backgroundPaletteColors', 'spectrumColors', 'alwaysPaletteAliases'] as const,
80
- };
81
-
82
- const fontSize: ConfigurableProperty<'textVariants'> = {
83
- name: 'fontSize',
84
- cssProperties: 'font-size',
85
- twThemePath: mapTextVariantFixtureToValue('fontSize'),
86
- possibleFixtures: ['textVariants'] as const,
87
- };
88
-
89
- const fontVariationSettings: ConfigurableProperty<'textVariants'> = {
90
- name: 'fontVariationSettings',
91
- cssProperties: 'font-variation-settings',
92
- twThemePath: () => {
93
- return ``;
94
- },
95
- possibleFixtures: ['textVariants'] as const,
96
- customValueRenderer: (schemaValue) => {
97
- const { value: rawValue } = schemaValue;
98
- const value = textVariantsSafe(rawValue as string);
99
- return `"wght" var(--uds-font-weight-${value}), "slnt" var(--uds-font-slant-${value}), "wdth" var(--uds-font-width-${value});`;
100
- },
101
- };
102
-
103
- const fontWeight: ConfigurableProperty<'textVariants'> = {
104
- name: 'fontWeight',
105
- cssProperties: 'font-weight',
106
- twThemePath: mapTextVariantFixtureToValue('fontWeight'),
107
- possibleFixtures: ['textVariants'] as const,
108
- };
109
-
110
- const fontFamily: ConfigurableProperty<'textVariants'> = {
111
- name: 'fontFamily',
112
- cssProperties: 'font-family',
113
- twThemePath: mapTextVariantFixtureToValue('fontFamily'),
114
- possibleFixtures: ['textVariants'] as const,
115
- };
116
-
117
- const gap: ConfigurableProperty<'spacingAliases'> = {
118
- name: 'gap',
119
- cssProperties: 'gap',
120
- twThemePath: (selected, value) => `spacing[${value}]`,
121
- possibleFixtures: ['spacingAliases'] as const,
122
- };
123
-
124
- const color: ConfigurableProperty<
125
- 'alwaysPaletteAliases' | 'spectrumColors' | 'foregroundPaletteColors'
126
- > = {
127
- name: 'color',
128
- cssProperties: 'color',
129
- twThemePath: mapColorFixtureToValue,
130
- possibleFixtures: ['alwaysPaletteAliases', 'spectrumColors', 'foregroundPaletteColors'] as const,
131
- };
132
-
133
- const borderWidth: ConfigurableProperty<'borderWidths' | 'spacingAliases'> = {
134
- name: 'borderWidth',
135
- cssProperties: 'border-width',
136
- twThemePath: (selected, value) => {
137
- if (selected === 'borderWidths') {
138
- return `borderWidth[${value}]`;
139
- } else {
140
- return `spacing[${value}]`;
141
- }
142
- },
143
- possibleFixtures: ['borderWidths', 'spacingAliases'] as const,
144
- extendedProperties: (context) =>
145
- shouldUseOutlineInsteadOfBorder(context) && [
146
- 'outlineWidth',
147
- 'insetOutlineOffset',
148
- 'solidOutline',
149
- ],
150
- };
151
-
152
- const borderColor: ConfigurableProperty<
153
- 'alwaysPaletteAliases' | 'spectrumColors' | 'linePaletteColors'
154
- > = {
155
- name: 'borderColor',
156
- cssProperties: 'border-color',
157
- twThemePath: mapColorFixtureToValue,
158
- possibleFixtures: ['alwaysPaletteAliases', 'spectrumColors', 'linePaletteColors'] as const,
159
- extendedProperties: (context) => shouldUseOutlineInsteadOfBorder(context) && ['outlineColor'],
160
- };
161
-
162
- const outlineWidth: ConfigurableProperty<'borderWidths' | 'spacingAliases'> = {
163
- name: 'outlineWidth',
164
- cssProperties: 'outline-width',
165
- twThemePath: (type, value) =>
166
- type === 'borderWidths' ? `borderWidth[${value}]` : `spacing[${value}]`,
167
- possibleFixtures: ['borderWidths', 'spacingAliases'] as const,
168
- };
169
-
170
- const solidOutline: ConfigurableProperty<never> = {
171
- name: 'solidOutline',
172
- cssProperties: 'outline-style',
173
- twThemePath: () => '',
174
- customValueRenderer: () => 'solid',
175
- possibleFixtures: [] as const,
176
- };
177
-
178
- const insetOutlineOffset: ConfigurableProperty<'borderWidths' | 'spacingAliases'> = {
179
- name: 'insetOutlineOffset',
180
- cssProperties: 'outline-offset',
181
- twThemePath: () => '',
182
- customValueRenderer: ({ value, type }, schema, theme) => {
183
- const width =
184
- type === 'borderWidths' ? theme(`borderWidth[${value}]`) : theme(`spacing[${value}]`);
185
-
186
- return `calc(-1 * ${width})`;
187
- },
188
- possibleFixtures: ['borderWidths', 'spacingAliases'] as const,
189
- };
190
-
191
- const outlineColor: ConfigurableProperty<
192
- 'alwaysPaletteAliases' | 'spectrumColors' | 'linePaletteColors'
193
- > = {
194
- name: 'outlineColor',
195
- cssProperties: 'outline-color',
196
- twThemePath: mapColorFixtureToValue,
197
- possibleFixtures: ['alwaysPaletteAliases', 'spectrumColors', 'linePaletteColors'] as const,
198
- };
199
-
200
- const borderRadius: ConfigurableProperty<'borderRadii'> = {
201
- name: 'borderRadius',
202
- cssProperties: 'border-radius',
203
- twThemePath: (selected, value) => `borderRadius.${value}`,
204
- possibleFixtures: ['borderRadii'] as const,
205
- };
206
-
207
- const padding: ConfigurableProperty<'spacingAliases'> = {
208
- name: 'padding',
209
- cssProperties: 'padding',
210
- twThemePath: (selected, value) => `spacing[${value}]`,
211
- possibleFixtures: ['spacingAliases'] as const,
212
- };
213
-
214
- const iconSize: ConfigurableProperty<'iconSizes'> = {
215
- name: 'iconSize',
216
- cssProperties: ['width', 'height'],
217
- twThemePath: (selected, value) => `sizing.icon.${value}`,
218
- possibleFixtures: ['iconSizes'] as const,
219
- };
220
-
221
- const spacingHorizontal: ConfigurableProperty<'spacingAliases'> = {
222
- name: 'spacingHorizontal',
223
- cssProperties: ['padding-right', 'padding-left'],
224
- twThemePath: (selected, value) => `spacing[${value}]`,
225
- possibleFixtures: ['spacingAliases'] as const,
226
- };
227
-
228
- const spacingVertical: ConfigurableProperty<'spacingAliases'> = {
229
- name: 'spacingVertical',
230
- cssProperties: ['padding-top', 'padding-bottom'],
231
- twThemePath: (selected, value) => `spacing[${value}]`,
232
- possibleFixtures: ['spacingAliases'] as const,
233
- };
234
-
235
- const textTransform: ConfigurableProperty<'textVariants'> = {
236
- name: 'textTransform',
237
- cssProperties: 'text-transform',
238
- twThemePath: mapTextVariantFixtureToValue('textTransform'),
239
- possibleFixtures: ['textVariants'] as const,
240
- };
241
-
242
- const lineHeight: ConfigurableProperty<'textVariants'> = {
243
- name: 'lineHeight',
244
- cssProperties: 'line-height',
245
- twThemePath: mapTextVariantFixtureToValue('lineHeight'),
246
- possibleFixtures: ['textVariants'] as const,
247
- };
248
-
249
- const textVariant: ConfigurableProperty<'textVariants'> = {
250
- name: 'textVariant',
251
- cssProperties: [],
252
- twThemePath: () => {
253
- return ``;
254
- },
255
- possibleFixtures: ['textVariants'] as const,
256
- extendedProperties: [
257
- 'fontSize',
258
- 'fontWeight',
259
- 'fontFamily',
260
- 'lineHeight',
261
- 'textTransform',
262
- 'fontVariationSettings',
263
- ],
264
- };
265
-
266
- const shadow: ConfigurableProperty<'shadowVariants', ShadowVariantConfig | string> = {
267
- name: 'drop shadow',
268
- cssProperties: 'box-shadow',
269
- twThemePath: () => {
270
- return ``;
271
- },
272
- concatenate: true,
273
- customValueRenderer: (schemaValue) => {
274
- const shadowType: ShadowType = 'drop';
275
- const noneValue = '0 0 0 transparent';
276
-
277
- if (schemaValue.valueType === 'alias') {
278
- const noneValue = '0 0 0 transparent';
279
-
280
- if (schemaValue.value === 'none') {
281
- return noneValue;
282
- }
283
- if (schemaValue.value !== 'custom') {
284
- return `var(--uds-${shadowType}-shadow-${schemaValue.value})`;
285
- }
286
- } else if (schemaValue.valueType === 'custom') {
287
- const customShadowPresetVals = (schemaValue.value as ShadowVariantConfig).map(
288
- (preset, index) =>
289
- getShadowLayerValue({
290
- preset,
291
- shadowType,
292
- prefix: index > 0 ? `${index + 1}` : undefined,
293
- }),
294
- );
295
-
296
- return customShadowPresetVals?.join(', ') || noneValue;
297
- }
298
-
299
- throw new Error('Invalid valueType');
300
- },
301
- possibleFixtures: ['shadowVariants'] as const,
302
- };
303
-
304
- const insetShadow: ConfigurableProperty<'shadowVariantsWithInvert', ShadowVariantConfig | string> =
305
- {
306
- name: 'inset shadow',
307
- cssProperties: 'box-shadow',
308
- twThemePath: () => {
309
- return ``;
310
- },
311
- concatenate: true,
312
- customValueRenderer: (schemaValue) => {
313
- const shadowType: ShadowType = 'inset';
314
- const noneValue = '0 0 0 transparent';
315
-
316
- if (schemaValue.valueType === 'alias') {
317
- const noneValue = '0 0 0 transparent';
318
-
319
- if (schemaValue.value === 'none') {
320
- return noneValue;
321
- }
322
- if (schemaValue.value !== 'custom') {
323
- return `var(--uds-${shadowType}-shadow-${schemaValue.value})`;
324
- }
325
- } else if (schemaValue.valueType === 'custom') {
326
- const customShadowPresetVals = (schemaValue.value as ShadowVariantConfig).map(
327
- (preset, index) =>
328
- getShadowLayerValue({
329
- preset,
330
- shadowType,
331
- prefix: index > 0 ? `${index + 1}` : undefined,
332
- }),
333
- );
334
-
335
- return customShadowPresetVals?.join(', ') || noneValue;
336
- }
337
-
338
- throw new Error('Invalid valueType');
339
- },
340
- possibleFixtures: ['shadowVariantsWithInvert'] as const,
341
- };
342
-
343
- const height: ConfigurableProperty<'spacingAliases'> = {
344
- name: 'height',
345
- cssProperties: 'height',
346
- twThemePath: (selected, value) => {
347
- return `height[${value}]`;
348
- },
349
- possibleFixtures: ['spacingAliases'] as const,
350
- };
351
-
352
- const width: ConfigurableProperty<'spacingAliases'> = {
353
- name: 'width',
354
- cssProperties: 'width',
355
- twThemePath: (selected, value) => {
356
- return `width[${value}]`;
357
- },
358
- possibleFixtures: ['spacingAliases'] as const,
359
- };
360
-
361
- const textDecorationLine: ConfigurableProperty<'textDecorationLines'> = {
362
- name: 'textDecorationLine',
363
- cssProperties: 'text-decoration-line',
364
- possibleFixtures: ['textDecorationLines'] as const,
365
- twThemePath: () => {
366
- return ``;
367
- },
368
- customValueRenderer: (schemaValue) => {
369
- return String(schemaValue.value);
370
- },
371
- };
372
-
373
- const publicProperties = {
374
- backgroundColor,
375
- borderWidth,
376
- borderRadius,
377
- borderColor,
378
- fontFamily,
379
- fontSize,
380
- fontVariationSettings,
381
- lineHeight,
382
- textTransform,
383
- padding,
384
- gap,
385
- color,
386
- fontWeight,
387
- iconSize,
388
- spacingHorizontal,
389
- spacingVertical,
390
- textVariant,
391
- textDecorationLine,
392
- shadow,
393
- insetShadow,
394
- height,
395
- width,
396
- } as const;
397
-
398
- const internalProperties = {
399
- outlineWidth,
400
- outlineColor,
401
- insetOutlineOffset,
402
- solidOutline,
403
- };
404
-
405
- export const configurableProperties = {
406
- ...publicProperties,
407
- ...internalProperties,
408
- };
409
-
410
- export type ExtendablePropertiesName = keyof typeof configurableProperties;
411
- export type ConfigurablePropertiesName = keyof typeof publicProperties;
412
-
413
- export interface SelectedConfigurableProperty<
414
- C extends ConfigurablePropertiesName,
415
- O extends string,
416
- // T remains the tuple type for the fixture array:
417
- T extends
418
- (typeof publicProperties)[C]['possibleFixtures'] = (typeof publicProperties)[C]['possibleFixtures'],
419
- // V is now a tuple of arrays of strings (e.g. [['value1', 'value2'], ['meow', 'wof']])
420
- V extends readonly (readonly string[])[] = readonly (readonly string[])[],
421
- > {
422
- label: string;
423
- name: C;
424
- typeOfFixture: T;
425
- values: V;
426
- pseudoStates?: PossibleStates[];
427
- // if this property support non alias values - values not present in Fixtures
428
- supportsCustom?: boolean;
429
- // defaults is not an array; each key maps to one string
430
- // and the allowed string is drawn from the union of all elements in the arrays of `values`
431
- defaults: { [K in O]: V[number][number] };
432
- // used to display the label of the property in the UI
433
- }
@@ -1,116 +0,0 @@
1
- // tokens
2
- import type * as properties from '@yahoo/uds/fixtures';
3
- import type { UniversalTokensConfig } from '@yahoo/uds/tokens';
4
- import type {
5
- ConfigurablePropertiesName,
6
- SelectedConfigurableProperty,
7
- } from '@yahoo/uds/tokens/automation/properties';
8
-
9
- // TODO: use macro to convert this to runtime
10
- export type AllPossibleProperties =
11
- | Exclude<
12
- keyof typeof properties,
13
- // remove Button and IconButton specific properties
14
- | 'iconButtonClassNames'
15
- | 'iconButtonSize'
16
- | 'iconButtonStates'
17
- | 'buttonClassNames'
18
- | 'buttonColorProperties'
19
- | 'buttonIconSvgSize'
20
- | 'buttonKinds'
21
- | 'buttonMotionEffects'
22
- | 'buttonMotionProperties'
23
- | 'buttonPalettes'
24
- | 'buttonSizeProperties'
25
- | 'buttonSizes'
26
- | 'buttonStates'
27
- | 'buttonVariants'
28
- >
29
- | 'shadowVariantConfig';
30
-
31
- export type PossibleStates =
32
- | 'hover'
33
- | 'pressed'
34
- | 'focused'
35
- | 'invalid'
36
- | 'focus-within'
37
- | 'focused-keyboard'
38
- | 'visited'
39
- | 'readonly'
40
- | 'disabled'
41
- | 'invalid&hover'
42
- | 'invalid&pressed';
43
- export type PossibleStatesWithRest = 'rest' | PossibleStates;
44
-
45
- export interface LayerConfig {
46
- label: string;
47
- properties: Readonly<
48
- Record<string, SelectedConfigurableProperty<ConfigurablePropertiesName, string>>
49
- >;
50
- pseudoSelector?: string;
51
- }
52
-
53
- export interface ComponentStateConfig {
54
- label: string;
55
- options: string[];
56
- layers: {
57
- root: LayerConfig;
58
- } & Record<string, LayerConfig>;
59
- }
60
-
61
- export interface SubComponentConfig {
62
- label: string;
63
- description: string;
64
- overrideComponentName?: string;
65
- variants: Record<string, VariantConfigWithProperties | VariantConfigWithComponentStates>;
66
- }
67
-
68
- export interface VariantConfig<O extends string = string> {
69
- label: string;
70
- description: string;
71
- isConfigurable: boolean;
72
- default: O;
73
- options: readonly O[];
74
- }
75
-
76
- export interface VariantConfigWithProperties<O extends string = string> extends VariantConfig<O> {
77
- layers: {
78
- root: LayerConfig;
79
- } & Record<string, LayerConfig>;
80
- }
81
-
82
- export interface VariantConfigWithComponentStates<O extends string = string>
83
- extends VariantConfig<O> {
84
- componentStates?: Readonly<Record<string, ComponentStateConfig>>;
85
- }
86
-
87
- export interface ComponentConfig {
88
- label: string;
89
- description: string;
90
- overrideComponentName?: string;
91
- subComponents?: Record<string, SubComponentConfig>;
92
- variants?: Record<string, VariantConfigWithProperties | VariantConfigWithComponentStates>;
93
- }
94
-
95
- export type AutoComponents = Omit<
96
- UniversalTokensConfig,
97
- | 'colorMode'
98
- | 'font'
99
- | 'scaleMode'
100
- | 'version'
101
- | 'motion'
102
- | 'button'
103
- | 'iconButton'
104
- | 'shadow'
105
- | 'breakpoints'
106
- | 'typography'
107
- | 'globalDefaults'
108
- >;
109
-
110
- export type AutoComponentName = keyof AutoComponents;
111
-
112
- export type AllVariantKeys = {
113
- [K in keyof AutoComponents]: {
114
- [V in keyof AutoComponents[K]['defaults']]: V;
115
- }[keyof AutoComponents[K]['defaults']];
116
- }[keyof AutoComponents];
@@ -1 +0,0 @@
1
- // TODO: add a type for the schema
@@ -1,47 +0,0 @@
1
- import type { ComponentConfig } from './index';
2
-
3
- /**
4
- * For each variant in `config.variants`, for each option in `variant.options`,
5
- * produce a string `.uds-{lowercase(label)}-{variantKey}-{optionValue}`.
6
- */
7
- // type VariantOptionSelector<C extends ComponentConfig> = {
8
- // [VariantKey in keyof C['variants']]: C['variants'][VariantKey]['options'] extends ReadonlyArray<
9
- // infer O
10
- // >
11
- // ? `.uds-${Lowercase<C['label']>}-${string & VariantKey}-${string & O}`
12
- // : never;
13
- // }[keyof C['variants']];
14
-
15
- /**
16
- * The union of all possible selectors for a given config,
17
- * e.g. ".uds-avatar" | ".uds-avatar-size-xs" | ".uds-avatar-size-sm" ...
18
- */
19
- export type AllSelectors<C extends ComponentConfig> = BaseSelector<C>;
20
-
21
- /**
22
- * A generic "Tailwind style object":
23
- * - Keys are CSS selectors (like ".uds-avatar-size-sm")
24
- * - Values are style declarations (like { [varName]: "1rem", display: "inline-block", ... })
25
- *
26
- * You can refine these Declarations to be more typed if you want
27
- * (e.g. only allow certain var names, only allow CSS property keys, etc.).
28
- */
29
- export type CssStyleObject<C extends ComponentConfig> = {
30
- [Selector in AllSelectors<C>]?: Record<string, string>;
31
- };
32
-
33
- /**
34
- * Base class is just `.uds-{label}`
35
- */
36
- export type BaseSelector<C extends ComponentConfig> = C['overrideComponentName'] extends string
37
- ? `uds-${Lowercase<C['overrideComponentName']>}`
38
- : `uds-${Lowercase<C['label']>}`;
39
-
40
- /**
41
- * Represents a selector for a parent variant in the component configuration.
42
- * For each variant in `config.variants`, it produces a string in the format:
43
- * `.uds-{lowercase(label)}-{variantKey}`.
44
- */
45
- export type ParentVariantSelector<C extends ComponentConfig> = {
46
- [K in keyof C['variants']]: `uds-${Lowercase<C['label']>}-${string & K}`;
47
- }[keyof C['variants']];
@@ -1,2 +0,0 @@
1
- export type * from './ComponentConfig';
2
- export type * from './ComponentStyles';
@@ -1,13 +0,0 @@
1
- type ElementType<A> = A extends Array<infer T> ? T : never;
2
- type ElementsOfAll<Inputs, R extends Array<unknown> = []> = Inputs extends readonly [
3
- infer F,
4
- ...infer M,
5
- ]
6
- ? ElementsOfAll<M, [...R, ElementType<F>]>
7
- : R;
8
- type CartesianProduct<Inputs> = ElementsOfAll<Inputs>[];
9
-
10
- export const cartesianProduct = <Sets extends Array<Array<unknown>>>(
11
- sets: Sets,
12
- ): CartesianProduct<Sets> =>
13
- sets.reduce((a, b) => a.flatMap((d) => b.map((e) => [d, e].flat()))) as CartesianProduct<Sets>;
@@ -1,49 +0,0 @@
1
- import { getConfigSubcomponents, mapValues } from '@yahoo/uds/tokens';
2
-
3
- import type { ComponentConfig, VariantConfig } from '../types';
4
-
5
- type ConfigVariants =
6
- | {
7
- type: 'has-sub-components';
8
- variants: Record<string, VariantConfig>;
9
- }
10
- | {
11
- type: 'no-sub-components';
12
- variant: VariantConfig;
13
- }
14
- | {
15
- type: 'no-variants';
16
- };
17
-
18
- export function coalesceConfigVariant<C extends ComponentConfig>(
19
- config: C,
20
- variantKey: string,
21
- ): ConfigVariants {
22
- const rootVariantDef = config.variants?.[variantKey];
23
-
24
- // Prefer root definition. In the future, maybe we merge with subComponent definitions.
25
- if (rootVariantDef) {
26
- return {
27
- type: 'no-sub-components',
28
- variant: rootVariantDef,
29
- };
30
- }
31
-
32
- const subComponents = getConfigSubcomponents(config);
33
-
34
- if (!subComponents) {
35
- return {
36
- type: 'no-variants',
37
- };
38
- }
39
-
40
- const subcomponentToVariant = mapValues(
41
- subComponents,
42
- (subComponent) => subComponent.variants[variantKey],
43
- );
44
-
45
- return {
46
- type: 'has-sub-components',
47
- variants: subcomponentToVariant,
48
- };
49
- }
@@ -1,29 +0,0 @@
1
- import type { UniversalTokensConfigAuto } from '../../../../generated/universalTokensConfigAuto';
2
-
3
- type KeysOfUnion<T> = T extends T ? keyof T : never;
4
-
5
- export function getConfigDefaultValue(
6
- config: UniversalTokensConfigAuto,
7
- componentName: keyof UniversalTokensConfigAuto,
8
- variant: KeysOfUnion<UniversalTokensConfigAuto[keyof UniversalTokensConfigAuto]['defaults']>,
9
- ): string {
10
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
11
- const result = (config[componentName]?.defaults as any)?.[variant];
12
-
13
- if (result === undefined) {
14
- throw new Error(
15
- `The variant default for "${variant}" is not defined for the component "${componentName}"`,
16
- );
17
- }
18
-
19
- return result;
20
- }
21
-
22
- export function isConfigDefaultValue(
23
- config: UniversalTokensConfigAuto,
24
- componentName: keyof UniversalTokensConfigAuto,
25
- variant: KeysOfUnion<UniversalTokensConfigAuto[keyof UniversalTokensConfigAuto]['defaults']>,
26
- value: unknown,
27
- ): boolean {
28
- return getConfigDefaultValue(config, componentName, variant) === value;
29
- }