@sanity/ui 3.0.0-static.17 → 3.0.0-static.19

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 (542) hide show
  1. package/dist/_chunks-cjs/_visual-editing.cjs +138 -137
  2. package/dist/_chunks-cjs/_visual-editing.cjs.map +1 -1
  3. package/dist/_chunks-cjs/buildCommand.cjs +21 -22
  4. package/dist/_chunks-cjs/buildCommand.cjs.map +1 -1
  5. package/dist/_chunks-es/_visual-editing.js +139 -138
  6. package/dist/_chunks-es/_visual-editing.js.map +1 -1
  7. package/dist/_visual-editing.d.cts +12 -22
  8. package/dist/_visual-editing.d.ts +12 -22
  9. package/dist/cli.cjs +1 -1
  10. package/dist/css.cjs +1589 -2016
  11. package/dist/css.cjs.map +1 -1
  12. package/dist/css.d.cts +9427 -874
  13. package/dist/css.d.ts +9427 -874
  14. package/dist/css.js +1591 -2018
  15. package/dist/css.js.map +1 -1
  16. package/dist/index.cjs +28 -40
  17. package/dist/index.cjs.map +1 -1
  18. package/dist/index.d.cts +26 -23
  19. package/dist/index.d.ts +26 -23
  20. package/dist/index.js +30 -42
  21. package/dist/index.js.map +1 -1
  22. package/dist/theme.cjs +2749 -2756
  23. package/dist/theme.cjs.map +1 -1
  24. package/dist/theme.d.cts +242 -161
  25. package/dist/theme.d.ts +242 -161
  26. package/dist/theme.js +2750 -2757
  27. package/dist/theme.js.map +1 -1
  28. package/dist/ui-system.css +15719 -16097
  29. package/dist/ui-system.min.css +1 -1
  30. package/dist/ui-theme.css +850 -4568
  31. package/dist/ui-theme.min.css +1 -1
  32. package/dist/ui.css +16569 -20772
  33. package/dist/ui.min.css +1 -1
  34. package/package.json +10 -15
  35. package/src/cli/buildCommand.ts +13 -30
  36. package/src/core/StyleTags.tsx +4 -12
  37. package/src/core/_compat/styles/_responsive.ts +1 -1
  38. package/src/core/_compat/theme/theme.test.tsx +4 -5
  39. package/src/core/_compat/theme/themeColorProvider.tsx +2 -2
  40. package/src/core/_compat/theme/themeContext.ts +2 -2
  41. package/src/core/_compat/theme/themeProvider.tsx +2 -2
  42. package/src/core/_compat/theme/types.ts +1 -1
  43. package/src/core/_compat/theme/useRootTheme.ts +1 -1
  44. package/src/core/_compat/theme/useTheme.ts +1 -1
  45. package/src/core/components/autocomplete/__workshop__/async.tsx +2 -2
  46. package/src/core/components/autocomplete/__workshop__/constrainedHeight.tsx +2 -2
  47. package/src/core/components/autocomplete/__workshop__/custom.tsx +11 -11
  48. package/src/core/components/autocomplete/__workshop__/example.tsx +6 -7
  49. package/src/core/components/autocomplete/__workshop__/focusAndBlur.tsx +2 -2
  50. package/src/core/components/autocomplete/__workshop__/fullscreen.tsx +1 -1
  51. package/src/core/components/autocomplete/autocomplete.tsx +5 -5
  52. package/src/core/components/autocomplete/autocompleteOption.tsx +1 -1
  53. package/src/core/components/autocomplete/autocompleteReducer.ts +1 -1
  54. package/src/core/components/autocomplete/constants.ts +1 -1
  55. package/src/core/components/autocomplete/types.ts +1 -1
  56. package/src/core/components/breadcrumbs/__workshop__/example.tsx +1 -1
  57. package/src/core/components/breadcrumbs/breadcrumbs.tsx +7 -7
  58. package/src/core/components/dialog/__workshop__/activate.tsx +4 -4
  59. package/src/core/components/dialog/__workshop__/position.tsx +1 -1
  60. package/src/core/components/dialog/__workshop__/props.tsx +1 -1
  61. package/src/core/components/dialog/__workshop__/wrapped.tsx +2 -2
  62. package/src/core/components/dialog/dialog.tsx +15 -8
  63. package/src/core/components/dialog/dialogCard.tsx +18 -3
  64. package/src/core/components/dialog/dialogContext.ts +1 -1
  65. package/src/core/components/dialog/dialogProvider.tsx +3 -3
  66. package/src/core/components/dialog/useDialog.ts +1 -1
  67. package/src/core/components/hotkeys/hotkeys.tsx +4 -4
  68. package/src/core/components/menu/__workshop__/closableMenuButton.tsx +5 -4
  69. package/src/core/components/menu/__workshop__/constrainedInBoundary.tsx +2 -2
  70. package/src/core/components/menu/__workshop__/customMenuItem.tsx +3 -3
  71. package/src/core/components/menu/__workshop__/disableFocusOnClose.tsx +1 -1
  72. package/src/core/components/menu/__workshop__/groups.tsx +2 -2
  73. package/src/core/components/menu/__workshop__/menuButton.tsx +1 -1
  74. package/src/core/components/menu/__workshop__/menuGroupRight.tsx +1 -1
  75. package/src/core/components/menu/__workshop__/nestedMenu.tsx +1 -1
  76. package/src/core/components/menu/__workshop__/onCloseMenuButton.tsx +13 -4
  77. package/src/core/components/menu/__workshop__/selectedItem.tsx +2 -2
  78. package/src/core/components/menu/__workshop__/withoutArrow.tsx +1 -1
  79. package/src/core/components/menu/menu.test.tsx +6 -7
  80. package/src/core/components/menu/menu.tsx +2 -2
  81. package/src/core/components/menu/menuButton.tsx +9 -9
  82. package/src/core/components/menu/menuContext.ts +1 -1
  83. package/src/core/components/menu/menuDivider.tsx +3 -3
  84. package/src/core/components/menu/menuGroup.tsx +9 -9
  85. package/src/core/components/menu/menuItem.tsx +9 -6
  86. package/src/core/components/menu/useMenu.ts +1 -1
  87. package/src/core/components/menu/useMenuController.ts +4 -4
  88. package/src/core/components/skeleton/__workshop__/delay.tsx +1 -1
  89. package/src/core/components/skeleton/__workshop__/skeleton.tsx +2 -2
  90. package/src/core/components/skeleton/codeSkeleton.tsx +5 -5
  91. package/src/core/components/skeleton/headingSkeleton.tsx +5 -5
  92. package/src/core/components/skeleton/labelSkeleton.tsx +5 -5
  93. package/src/core/components/skeleton/skeleton.tsx +4 -4
  94. package/src/core/components/skeleton/textSkeleton.tsx +5 -5
  95. package/src/core/components/tab/__workshop__/example.tsx +1 -1
  96. package/src/core/components/tab/tab.tsx +7 -7
  97. package/src/core/components/tab/tabList.tsx +14 -7
  98. package/src/core/components/tab/tabPanel.tsx +10 -7
  99. package/src/core/components/toast/__workshop__/hook.tsx +1 -1
  100. package/src/core/components/toast/toast.test.tsx +5 -5
  101. package/src/core/components/toast/toast.tsx +6 -7
  102. package/src/core/components/toast/toastContext.ts +1 -1
  103. package/src/core/components/toast/toastLayer.tsx +2 -2
  104. package/src/core/components/toast/toastProvider.tsx +1 -1
  105. package/src/core/components/toast/types.ts +1 -1
  106. package/src/core/components/toast/useToast.ts +1 -1
  107. package/src/core/components/tree/__workshop__/basic.perf.ts +1 -1
  108. package/src/core/components/tree/__workshop__/basic.tsx +1 -1
  109. package/src/core/components/tree/__workshop__/tabFromElement.tsx +1 -1
  110. package/src/core/components/tree/helpers.ts +1 -1
  111. package/src/core/components/tree/tree.tsx +6 -6
  112. package/src/core/components/tree/treeContext.ts +1 -1
  113. package/src/core/components/tree/treeGroup.tsx +2 -2
  114. package/src/core/components/tree/treeItem.tsx +15 -15
  115. package/src/core/components/tree/types.ts +2 -2
  116. package/src/core/components/tree/useTree.ts +1 -1
  117. package/src/core/hooks/useClickOutside.test.tsx +15 -16
  118. package/src/core/hooks/useClickOutsideEvent.test.tsx +4 -5
  119. package/src/core/hooks/useDelayed.test.ts +6 -7
  120. package/src/core/hooks/useDelayedState.ts +1 -1
  121. package/src/core/hooks/useElementRect/__workshop__/example.tsx +1 -1
  122. package/src/core/hooks/useElementSize.ts +1 -1
  123. package/src/core/hooks/useForwardedRef.ts +1 -1
  124. package/src/core/hooks/useMediaIndex/__workshop__/test.tsx +1 -1
  125. package/src/core/hooks/useMediaIndex/useMediaIndex.test.tsx +3 -18
  126. package/src/core/hooks/useMediaIndex/useMediaIndex.ts +10 -10
  127. package/src/core/hooks/usePrefersDark.hydration.test.tsx +4 -4
  128. package/src/core/hooks/usePrefersDark.test.tsx +1 -0
  129. package/src/core/hooks/usePrefersReducedMotion.hydration.test.tsx +4 -4
  130. package/src/core/hooks/usePrefersReducedMotion.test.tsx +1 -0
  131. package/src/core/middleware/origin.ts +1 -1
  132. package/src/core/primitives/_selectable/selectable.tsx +3 -3
  133. package/src/core/primitives/avatar/__workshop__/withinButton.tsx +1 -1
  134. package/src/core/primitives/avatar/avatar.tsx +6 -6
  135. package/src/core/primitives/avatar/avatarCounter.tsx +3 -3
  136. package/src/core/primitives/avatar/avatarStack.tsx +7 -7
  137. package/src/core/primitives/avatar/types.ts +1 -3
  138. package/src/core/primitives/badge/badge.test.tsx +2 -3
  139. package/src/core/primitives/badge/badge.tsx +3 -3
  140. package/src/core/primitives/box/__workshop__/responsive.tsx +2 -1
  141. package/src/core/primitives/box/box.tsx +4 -2
  142. package/src/core/primitives/button/__workshop__/custom.tsx +2 -2
  143. package/src/core/primitives/button/__workshop__/customIcons.tsx +3 -3
  144. package/src/core/primitives/button/__workshop__/disabled.tsx +9 -9
  145. package/src/core/primitives/button/__workshop__/props.tsx +3 -4
  146. package/src/core/primitives/button/__workshop__/stacked.tsx +4 -5
  147. package/src/core/primitives/button/button.test.tsx +2 -3
  148. package/src/core/primitives/button/button.tsx +11 -6
  149. package/src/core/primitives/card/__workshop__/asButton.tsx +16 -7
  150. package/src/core/primitives/card/__workshop__/checkered.tsx +1 -1
  151. package/src/core/primitives/card/__workshop__/index.ts +1 -1
  152. package/src/core/primitives/card/__workshop__/interactive.tsx +1 -1
  153. package/src/core/primitives/card/__workshop__/listNavigation.tsx +3 -3
  154. package/src/core/primitives/card/__workshop__/props.tsx +3 -3
  155. package/src/core/primitives/card/__workshop__/selected.tsx +2 -2
  156. package/src/core/primitives/card/__workshop__/{allTones.tsx → tones.tsx} +3 -3
  157. package/src/core/primitives/card/card.tsx +4 -4
  158. package/src/core/primitives/card/cardContext.ts +2 -2
  159. package/src/core/primitives/card/cardProvider.tsx +3 -3
  160. package/src/core/primitives/card/types.ts +2 -2
  161. package/src/core/primitives/card/useCard.ts +2 -1
  162. package/src/core/primitives/checkbox/__workshop__/props.tsx +2 -0
  163. package/src/core/primitives/checkbox/__workshop__/tones.tsx +11 -20
  164. package/src/core/primitives/checkbox/checkbox.tsx +5 -7
  165. package/src/core/primitives/code/__workshop__/opticalAlignment.tsx +1 -1
  166. package/src/core/primitives/code/code.tsx +3 -3
  167. package/src/core/primitives/container/container.tsx +4 -4
  168. package/src/core/primitives/flex/flex.tsx +2 -2
  169. package/src/core/primitives/heading/__workshop__/opticalAlignment.tsx +1 -1
  170. package/src/core/primitives/heading/heading.tsx +2 -2
  171. package/src/core/primitives/inline/__workshop__/plain.tsx +1 -1
  172. package/src/core/primitives/inline/inline.tsx +2 -2
  173. package/src/core/primitives/inline/types.ts +1 -0
  174. package/src/core/primitives/kbd/kbd.tsx +5 -5
  175. package/src/core/primitives/label/label.tsx +5 -5
  176. package/src/core/primitives/popover/__workshop__/PlainStory.tsx +2 -2
  177. package/src/core/primitives/popover/__workshop__/RecursiveStory.tsx +3 -4
  178. package/src/core/primitives/popover/__workshop__/SidePanelStory.tsx +4 -4
  179. package/src/core/primitives/popover/__workshop__/TestStory.tsx +2 -3
  180. package/src/core/primitives/popover/constants.ts +1 -1
  181. package/src/core/primitives/popover/floating-ui/size.ts +2 -2
  182. package/src/core/primitives/popover/helpers.ts +1 -1
  183. package/src/core/primitives/popover/popover.tsx +1 -1
  184. package/src/core/primitives/popover/popoverLayer.tsx +4 -4
  185. package/src/core/primitives/popover/types.ts +3 -2
  186. package/src/core/primitives/radio/__workshop__/example.tsx +1 -1
  187. package/src/core/primitives/radio/radio.tsx +5 -5
  188. package/src/core/primitives/select/__workshop__/plain.tsx +15 -3
  189. package/src/core/primitives/select/__workshop__/readOnly.tsx +1 -1
  190. package/src/core/primitives/select/select.tsx +4 -10
  191. package/src/core/primitives/spinner/__workshop__/Props.tsx +1 -2
  192. package/src/core/primitives/spinner/animatedSpinnerIcon.tsx +3 -3
  193. package/src/core/primitives/spinner/spinner.tsx +3 -3
  194. package/src/core/primitives/stack/__workshop__/plain.tsx +1 -1
  195. package/src/core/primitives/stack/stack.tsx +5 -5
  196. package/src/core/primitives/switch/switch.tsx +3 -3
  197. package/src/core/primitives/text/__workshop__/colored.tsx +5 -5
  198. package/src/core/primitives/text/__workshop__/opticalAlignment.tsx +1 -1
  199. package/src/core/primitives/text/text.tsx +6 -6
  200. package/src/core/primitives/textArea/__workshop__/plain.tsx +35 -23
  201. package/src/core/primitives/textArea/textArea.tsx +14 -5
  202. package/src/core/primitives/textInput/__workshop__/customValidity.tsx +1 -1
  203. package/src/core/primitives/textInput/__workshop__/plain.tsx +9 -15
  204. package/src/core/primitives/textInput/__workshop__/states.tsx +4 -4
  205. package/src/core/primitives/textInput/__workshop__/tones.tsx +2 -2
  206. package/src/core/primitives/textInput/textInput.tsx +13 -11
  207. package/src/core/primitives/tooltip/__workshop__/customPortal.tsx +2 -2
  208. package/src/core/primitives/tooltip/__workshop__/overflowingBoundary.tsx +1 -1
  209. package/src/core/primitives/tooltip/__workshop__/props.tsx +5 -4
  210. package/src/core/primitives/tooltip/constants.ts +1 -1
  211. package/src/core/primitives/tooltip/tooltip.test.tsx +61 -60
  212. package/src/core/primitives/tooltip/tooltip.tsx +11 -6
  213. package/src/core/primitives/tooltip/tooltipDelayGroup/tooltipDelayGroupContext.tsx +1 -1
  214. package/src/core/primitives/tooltip/tooltipDelayGroup/tooltipDelayGroupProvider.tsx +3 -3
  215. package/src/core/primitives/tooltip/tooltipDelayGroup/useTooltipDelayGroup.ts +1 -1
  216. package/src/core/primitives/tooltip/tooltipLayer.tsx +4 -4
  217. package/src/core/primitives/types.ts +15 -24
  218. package/src/core/types/badge.ts +1 -1
  219. package/src/core/types/button.ts +1 -1
  220. package/src/core/types/card.ts +1 -1
  221. package/src/core/types/selectable.ts +1 -1
  222. package/src/core/utils/arrow/arrow.tsx +5 -14
  223. package/src/core/utils/boundaryElement/boundaryElement.test.tsx +5 -5
  224. package/src/core/utils/boundaryElement/boundaryElementContext.ts +1 -1
  225. package/src/core/utils/boundaryElement/boundaryElementProvider.tsx +2 -2
  226. package/src/core/utils/boundaryElement/useBoundaryElement.ts +1 -1
  227. package/src/core/utils/elementQuery/__workshop__/customMedia.tsx +15 -8
  228. package/src/core/utils/elementQuery/elementQuery.tsx +1 -1
  229. package/src/core/utils/errorBoundary.tsx +4 -4
  230. package/src/core/utils/layer/__workshop__/multipleRoots.tsx +5 -5
  231. package/src/core/utils/layer/__workshop__/nested.tsx +3 -3
  232. package/src/core/utils/layer/__workshop__/responsiveZOffset.tsx +9 -5
  233. package/src/core/utils/layer/getLayerContext.test.ts +3 -1
  234. package/src/core/utils/layer/getLayerContext.ts +1 -1
  235. package/src/core/utils/layer/layer.test.tsx +5 -5
  236. package/src/core/utils/layer/layer.tsx +2 -2
  237. package/src/core/utils/layer/layerCard.tsx +3 -3
  238. package/src/core/utils/layer/layerContext.ts +1 -1
  239. package/src/core/utils/layer/layerProvider.tsx +10 -2
  240. package/src/core/utils/layer/useLayer.ts +1 -1
  241. package/src/core/utils/portal/__workshop__/named.tsx +3 -3
  242. package/src/core/utils/portal/portal.test.tsx +5 -5
  243. package/src/core/utils/portal/portal.tsx +3 -2
  244. package/src/core/utils/portal/portalContext.ts +1 -1
  245. package/src/core/utils/portal/portalProvider.tsx +2 -2
  246. package/src/core/utils/portal/usePortal.ts +1 -1
  247. package/src/core/utils/srOnly/srOnly.tsx +3 -3
  248. package/src/core/utils/virtualList/__workshop__/infiniteList.tsx +1 -1
  249. package/src/core/utils/virtualList/virtualList.tsx +3 -3
  250. package/src/css/_assign.ts +3 -0
  251. package/src/css/_compileStyle.ts +12 -4
  252. package/src/css/_compileTheme.ts +10 -13
  253. package/src/css/_composeClassNames.ts +12 -0
  254. package/src/css/_fromEntries.ts +3 -0
  255. package/src/css/_getClassNames.ts +9 -0
  256. package/src/css/_hash.ts +9 -0
  257. package/src/css/_mergeStyles.ts +1 -1
  258. package/src/css/_resp.ts +6 -12
  259. package/src/css/_scopeClassName.ts +9 -0
  260. package/src/css/_scopeClassNames.ts +12 -0
  261. package/src/css/_system.style.ts +2 -0
  262. package/src/css/aspects/border/border.style.ts +2 -2
  263. package/src/css/aspects/border/border.ts +3 -3
  264. package/src/css/aspects/border/types.ts +1 -1
  265. package/src/css/aspects/boxSizing/boxSizing.style.ts +10 -0
  266. package/src/css/aspects/boxSizing/boxSizing.ts +8 -0
  267. package/src/css/aspects/boxSizing/index.ts +2 -0
  268. package/src/css/aspects/boxSizing/types.ts +9 -0
  269. package/src/css/aspects/display/display.style.ts +8 -8
  270. package/src/css/aspects/display/display.ts +3 -3
  271. package/src/css/aspects/display/types.ts +1 -1
  272. package/src/css/aspects/flex/flex.ts +3 -3
  273. package/src/css/aspects/flex/types.ts +1 -1
  274. package/src/css/aspects/flexItem/flex.style.ts +1 -1
  275. package/src/css/aspects/flexItem/flexItem.ts +3 -3
  276. package/src/css/aspects/flexItem/types.ts +1 -1
  277. package/src/css/aspects/font/font.style.ts +33 -22
  278. package/src/css/aspects/font/font.ts +3 -3
  279. package/src/css/aspects/font/types.ts +1 -1
  280. package/src/css/aspects/gap/gap.style.ts +2 -2
  281. package/src/css/aspects/gap/gap.ts +3 -3
  282. package/src/css/aspects/gap/types.ts +2 -2
  283. package/src/css/aspects/grid/grid.ts +3 -3
  284. package/src/css/aspects/grid/types.ts +1 -1
  285. package/src/css/aspects/gridItem/gridItem.ts +3 -3
  286. package/src/css/aspects/gridItem/types.ts +1 -1
  287. package/src/css/aspects/height/height.ts +3 -3
  288. package/src/css/aspects/index.ts +1 -0
  289. package/src/css/aspects/inset/inset.ts +3 -3
  290. package/src/css/aspects/inset/types.ts +1 -1
  291. package/src/css/aspects/margin/margin.style.ts +10 -10
  292. package/src/css/aspects/margin/margin.ts +3 -3
  293. package/src/css/aspects/margin/types.ts +1 -1
  294. package/src/css/aspects/maxWidth/maxWidth.style.ts +1 -1
  295. package/src/css/aspects/maxWidth/maxWidth.ts +4 -3
  296. package/src/css/aspects/maxWidth/types.ts +2 -2
  297. package/src/css/aspects/minWidth/minWidth.ts +4 -3
  298. package/src/css/aspects/minWidth/types.ts +1 -1
  299. package/src/css/aspects/overflow/overflow.ts +3 -3
  300. package/src/css/aspects/overflow/types.ts +1 -1
  301. package/src/css/aspects/padding/padding.style.ts +2 -5
  302. package/src/css/aspects/padding/padding.ts +3 -3
  303. package/src/css/aspects/padding/types.ts +2 -2
  304. package/src/css/aspects/pointerEvents/pointerEvents.ts +3 -3
  305. package/src/css/aspects/position/position.ts +3 -3
  306. package/src/css/aspects/position/types.ts +1 -1
  307. package/src/css/aspects/radius/radius.style.ts +1 -1
  308. package/src/css/aspects/radius/radius.ts +3 -3
  309. package/src/css/aspects/radius/types.ts +2 -2
  310. package/src/css/aspects/shadow/shadow.style.ts +7 -7
  311. package/src/css/aspects/shadow/shadow.ts +3 -3
  312. package/src/css/aspects/shadow/types.ts +2 -2
  313. package/src/css/aspects/textAlign/textAlign.style.ts +1 -1
  314. package/src/css/aspects/textAlign/textAlign.ts +3 -3
  315. package/src/css/aspects/textOverflow/textOverflow.ts +3 -3
  316. package/src/css/aspects/width/types.ts +2 -2
  317. package/src/css/aspects/width/width.style.ts +1 -1
  318. package/src/css/aspects/width/width.ts +4 -3
  319. package/src/css/components/breadcrumbs/breadcrumbs.style.ts +1 -1
  320. package/src/css/components/breadcrumbs/breadcrumbs.ts +2 -2
  321. package/src/css/components/dialog/dialog.style.ts +14 -16
  322. package/src/css/components/dialog/dialog.ts +9 -8
  323. package/src/css/components/menu/menu.style.ts +2 -2
  324. package/src/css/components/menu/menu.ts +3 -3
  325. package/src/css/components/skeleton/skeleton.style.ts +24 -17
  326. package/src/css/components/skeleton/skeleton.ts +8 -7
  327. package/src/css/components/skeleton/types.ts +4 -6
  328. package/src/css/components/toast/toast.style.ts +1 -1
  329. package/src/css/components/toast/toast.ts +6 -6
  330. package/src/css/components/tree/tree.style.ts +7 -23
  331. package/src/css/components/tree/tree.ts +2 -2
  332. package/src/css/constants.ts +1 -3
  333. package/src/css/index.ts +3 -5
  334. package/src/css/prefix/constants.ts +6 -0
  335. package/src/css/prefix/types.ts +1 -0
  336. package/src/css/primitives/_arrow/_arrow.style.ts +11 -13
  337. package/src/css/primitives/_arrow/_arrow.ts +5 -5
  338. package/src/css/primitives/_input/_input.style.ts +171 -75
  339. package/src/css/primitives/_input/input.ts +13 -10
  340. package/src/css/primitives/_input/types.ts +3 -3
  341. package/src/css/primitives/_selectable/_selectable.style.ts +5 -6
  342. package/src/css/primitives/_selectable/selectable.ts +4 -3
  343. package/src/css/primitives/_selectable/types.ts +2 -2
  344. package/src/css/primitives/avatar/avatar.style.ts +38 -39
  345. package/src/css/primitives/avatar/avatar.ts +8 -8
  346. package/src/css/primitives/avatar/types.ts +3 -3
  347. package/src/css/primitives/badge/badge.style.ts +2 -3
  348. package/src/css/primitives/badge/badge.ts +7 -3
  349. package/src/css/primitives/badge/types.ts +2 -2
  350. package/src/css/primitives/box/box.style.ts +5 -15
  351. package/src/css/primitives/box/box.ts +7 -9
  352. package/src/css/primitives/box/types.ts +3 -6
  353. package/src/css/primitives/button/button.style.ts +189 -162
  354. package/src/css/primitives/button/button.ts +11 -4
  355. package/src/css/primitives/button/types.ts +1 -1
  356. package/src/css/primitives/card/card.style.ts +102 -68
  357. package/src/css/primitives/card/card.ts +5 -7
  358. package/src/css/primitives/card/types.ts +2 -2
  359. package/src/css/primitives/checkbox/checkbox.style.ts +125 -101
  360. package/src/css/primitives/checkbox/checkbox.ts +3 -3
  361. package/src/css/primitives/code/code.style.ts +24 -26
  362. package/src/css/primitives/code/code.ts +7 -3
  363. package/src/css/primitives/code/types.ts +2 -2
  364. package/src/css/primitives/container/container.style.ts +1 -1
  365. package/src/css/primitives/container/container.ts +4 -3
  366. package/src/css/primitives/container/types.ts +2 -2
  367. package/src/css/primitives/heading/heading.style.ts +31 -23
  368. package/src/css/primitives/heading/heading.ts +10 -8
  369. package/src/css/primitives/heading/types.ts +3 -2
  370. package/src/css/primitives/kbd/kbd.style.ts +7 -7
  371. package/src/css/primitives/kbd/kbd.ts +4 -3
  372. package/src/css/primitives/kbd/types.ts +1 -1
  373. package/src/css/primitives/label/label.style.ts +27 -24
  374. package/src/css/primitives/label/label.ts +5 -8
  375. package/src/css/primitives/label/types.ts +4 -3
  376. package/src/css/primitives/popover/popover.style.ts +6 -2
  377. package/src/css/primitives/popover/popover.ts +3 -3
  378. package/src/css/primitives/radio/radio.style.ts +37 -76
  379. package/src/css/primitives/radio/radio.ts +2 -2
  380. package/src/css/primitives/select/select.style.ts +3 -3
  381. package/src/css/primitives/select/select.ts +5 -5
  382. package/src/css/primitives/select/types.ts +1 -1
  383. package/src/css/primitives/spinner/spinner.style.ts +1 -1
  384. package/src/css/primitives/spinner/spinner.ts +3 -3
  385. package/src/css/primitives/stack/stack.style.ts +6 -2
  386. package/src/css/primitives/stack/stack.ts +2 -2
  387. package/src/css/primitives/switch/switch.style.ts +47 -39
  388. package/src/css/primitives/switch/switch.ts +6 -6
  389. package/src/css/primitives/text/text.style.ts +28 -23
  390. package/src/css/primitives/text/text.ts +5 -8
  391. package/src/css/primitives/text/types.ts +2 -2
  392. package/src/css/primitives/textArea/textArea.style.ts +6 -2
  393. package/src/css/primitives/textArea/textArea.ts +4 -4
  394. package/src/css/primitives/textArea/types.ts +1 -1
  395. package/src/css/primitives/textInput/textInput.style.ts +23 -17
  396. package/src/css/primitives/textInput/textInput.ts +4 -4
  397. package/src/css/primitives/textInput/types.ts +2 -8
  398. package/src/css/primitives/token/token.style.ts +4 -4
  399. package/src/css/primitives/tooltip/tooltip.style.ts +5 -4
  400. package/src/css/primitives/tooltip/tooltip.ts +3 -3
  401. package/src/css/renderColor.ts +31 -0
  402. package/src/css/theme/index.ts +14 -0
  403. package/src/css/theme/lib/contract/buildVarContract.ts +76 -0
  404. package/src/css/theme/lib/contract/index.ts +2 -0
  405. package/src/css/theme/lib/contract/types.ts +15 -0
  406. package/src/css/theme/resolveTheme.ts +852 -0
  407. package/src/css/types.ts +26 -910
  408. package/src/css/utils/srOnly/srOnly.style.ts +1 -1
  409. package/src/css/utils/srOnly/srOnly.ts +3 -3
  410. package/src/theme/getScopedTheme.ts +4 -4
  411. package/src/theme/index.ts +0 -5
  412. package/src/theme/types.ts +4 -4
  413. package/src/theme/v0/color/_generic.ts +1 -1
  414. package/src/theme/v0/color/button.ts +1 -1
  415. package/src/theme/v0/color/card.ts +1 -1
  416. package/src/theme/v0/color/color.ts +11 -11
  417. package/src/theme/v0/color/input.ts +1 -1
  418. package/src/theme/v0/color/muted.ts +1 -1
  419. package/src/theme/v0/color/selectable.ts +1 -1
  420. package/src/theme/v0/color/solid.ts +1 -1
  421. package/src/theme/v0/color/spot.ts +1 -1
  422. package/src/theme/v0/styles.ts +1 -1
  423. package/src/theme/v0/theme.ts +7 -7
  424. package/src/theme/v2/avatar.ts +1 -1
  425. package/src/theme/{build → v2/build}/_deprecated/color/_selectable/createSelectableTones.ts +3 -3
  426. package/src/theme/{build → v2/build}/_deprecated/color/_solid/createSolidTones.ts +2 -2
  427. package/src/theme/{build → v2/build}/_deprecated/color/button/createButtonModes.ts +7 -2
  428. package/src/theme/{build → v2/build}/_deprecated/color/button/createButtonTones.ts +4 -4
  429. package/src/theme/{build → v2/build}/_deprecated/color/card/createCardStates.ts +3 -3
  430. package/src/theme/{build → v2/build}/_deprecated/color/color.test.ts +1 -1
  431. package/src/theme/{build → v2/build}/_deprecated/color/defaults.ts +1 -1
  432. package/src/theme/{build → v2/build}/_deprecated/color/factory.ts +3 -3
  433. package/src/theme/{build → v2/build}/_deprecated/color/input/createInputModes.ts +7 -2
  434. package/src/theme/{build → v2/build}/_deprecated/color/muted/createMuted.ts +2 -2
  435. package/src/theme/{build → v2/build}/_deprecated/color/spot/createSpot.ts +2 -2
  436. package/src/theme/{build → v2/build}/buildColorTheme.test.ts +3 -1
  437. package/src/theme/{build → v2/build}/buildColorTheme.ts +24 -24
  438. package/src/theme/{build → v2/build}/buildTheme.test.ts +10 -8
  439. package/src/theme/{build → v2/build}/buildTheme.ts +4 -4
  440. package/src/theme/{build → v2/build}/colorToken/colorToken.ts +2 -2
  441. package/src/theme/{build → v2/build}/colorToken/compileColorToken.ts +1 -1
  442. package/src/theme/{build → v2/build}/colorToken/types.ts +2 -2
  443. package/src/theme/{build → v2/build}/lib/color-fns/blend/mix.ts +1 -1
  444. package/src/theme/{build → v2/build}/lib/color-fns/blend/multiply.ts +1 -1
  445. package/src/theme/{build → v2/build}/lib/color-fns/blend/screen.ts +1 -1
  446. package/src/theme/{build → v2/build}/lib/color-fns/color-fns.test.ts +1 -1
  447. package/src/theme/{build → v2/build}/lib/color-fns/contrastRatio.ts +5 -2
  448. package/src/theme/{build → v2/build}/lib/color-fns/convert.ts +1 -1
  449. package/src/theme/{build → v2/build}/lib/color-fns/parse.ts +1 -1
  450. package/src/theme/{build → v2/build}/mixThemeColor.test.ts +2 -0
  451. package/src/theme/{build → v2/build}/mixThemeColor.ts +1 -1
  452. package/src/theme/{build → v2/build}/renderColorTheme.ts +27 -27
  453. package/src/theme/{build → v2/build}/renderColorValue.ts +3 -3
  454. package/src/theme/{build → v2/build}/resolveColorTokens.ts +13 -13
  455. package/src/theme/v2/color/_helpers.ts +2 -2
  456. package/src/theme/v2/color/_system.ts +1 -1
  457. package/src/theme/v2/color/avatar.ts +1 -1
  458. package/src/theme/v2/color/badge.ts +1 -1
  459. package/src/theme/v2/color/button.ts +2 -2
  460. package/src/theme/v2/color/color.ts +7 -7
  461. package/src/theme/v2/color/input.ts +5 -1
  462. package/src/theme/v2/color/selectable.ts +2 -2
  463. package/src/theme/v2/color/state.ts +4 -4
  464. package/src/theme/{config → v2/config}/helpers.ts +6 -13
  465. package/src/theme/{config → v2/config}/system.ts +11 -12
  466. package/src/theme/{config → v2/config}/tokens/color/types.ts +14 -10
  467. package/src/theme/{config → v2/config}/tokens/index.ts +0 -1
  468. package/src/theme/{config → v2/config}/tokens/parseTokenValue.test.ts +2 -0
  469. package/src/theme/{config → v2/config}/tokens/parseTokenValue.ts +2 -2
  470. package/src/theme/{config → v2/config}/tokens/types.ts +3 -3
  471. package/src/theme/{config → v2/config}/types.ts +8 -6
  472. package/src/theme/{defaults → v2/defaults}/colorPalette.ts +1 -1
  473. package/src/theme/{defaults → v2/defaults}/colorTokens.ts +1 -1
  474. package/src/theme/{defaults → v2/defaults}/config.ts +1 -1
  475. package/src/theme/{defaults → v2/defaults}/fonts.ts +1 -1
  476. package/src/theme/v2/index.ts +2 -0
  477. package/src/theme/v2/input.ts +1 -1
  478. package/src/theme/v2/theme.ts +8 -8
  479. package/src/theme/{_constants.ts → v3/_constants.ts} +6 -3
  480. package/src/theme/v3/_parseColorToken.ts +185 -0
  481. package/src/theme/v3/buildTheme_v3.ts +11 -7
  482. package/src/theme/v3/color/_constants.ts +15 -0
  483. package/src/theme/v3/color/avatar.ts +14 -0
  484. package/src/theme/v3/color/card.ts +53 -53
  485. package/src/theme/v3/color/color.ts +66 -68
  486. package/src/theme/v3/color/element.ts +8 -8
  487. package/src/theme/v3/color/index.ts +2 -2
  488. package/src/theme/v3/color/token.ts +18 -4
  489. package/src/theme/v3/color/tokens.ts +2 -2
  490. package/src/theme/v3/defaultTokens.ts +73 -85
  491. package/src/theme/v3/index.ts +3 -0
  492. package/src/theme/v3/palette/index.ts +2 -0
  493. package/src/theme/v3/resolveTokens.ts +65 -65
  494. package/src/theme/v3/tokens.ts +2 -2
  495. package/src/theme/v3/types.ts +61 -7
  496. package/src/theme/versioning/getTheme_v2.ts +3 -3
  497. package/src/theme/versioning/is_v0.ts +2 -2
  498. package/src/theme/versioning/is_v2.ts +2 -2
  499. package/src/theme/versioning/themeColor_v0_v2.ts +2 -2
  500. package/src/theme/versioning/themeColor_v2_v2_9.ts +1 -1
  501. package/src/theme/versioning/themeColor_v3_v2.ts +229 -52
  502. package/src/theme/versioning/v0_v2.ts +3 -3
  503. package/src/theme/versioning/v2_v0.ts +4 -4
  504. package/src/theme/versioning/v3_v2.ts +38 -38
  505. package/dist/ui-palette.css +0 -105
  506. package/dist/ui-palette.min.css +0 -1
  507. package/src/css/_comp.test.ts +0 -7
  508. package/src/css/_comp.ts +0 -11
  509. package/src/css/_compilePalette.ts +0 -32
  510. package/src/css/_compileTheme_v3.ts +0 -440
  511. package/src/css/aspects/flex/flex.style.ts +0 -30
  512. package/src/css/composeClassNames.ts +0 -19
  513. package/src/css/primitives/_selectable/__style.ts +0 -117
  514. package/src/css/primitives/checkbox/__styles.ts +0 -129
  515. package/src/css/scopeClassName.ts +0 -7
  516. package/src/css/varNames.ts +0 -607
  517. package/src/css/vars.ts +0 -520
  518. package/src/theme/_types.ts +0 -41
  519. package/src/theme/build/theme.test.ts +0 -27
  520. package/src/theme/config/tokens/parseTokenKey.test.ts +0 -64
  521. package/src/theme/config/tokens/parseTokenKey.ts +0 -67
  522. package/src/theme/v3/buildTheme_v3.test.ts +0 -40
  523. package/src/theme/v3/color/buildColor_v3.ts +0 -226
  524. package/src/theme/v3/color/parseColor.test.ts +0 -79
  525. package/src/theme/v3/color/parseColor.ts +0 -167
  526. package/src/theme/v3/color/renderColor.test.ts +0 -20
  527. package/src/theme/v3/color/renderColor.ts +0 -43
  528. /package/src/{theme/palette → css/prefix}/index.ts +0 -0
  529. /package/src/theme/{build → v2/build}/_deprecated/color/index.ts +0 -0
  530. /package/src/theme/{build → v2/build}/colorToken/index.ts +0 -0
  531. /package/src/theme/{build → v2/build}/index.ts +0 -0
  532. /package/src/theme/{build → v2/build}/lib/color-fns/blend/index.ts +0 -0
  533. /package/src/theme/{build → v2/build}/lib/color-fns/index.ts +0 -0
  534. /package/src/theme/{build → v2/build}/lib/color-fns/rgba.ts +0 -0
  535. /package/src/theme/{build → v2/build}/lib/color-fns/types.ts +0 -0
  536. /package/src/theme/{build → v2/build}/lib/isRecord.ts +0 -0
  537. /package/src/theme/{build → v2/build}/lib/utils.ts +0 -0
  538. /package/src/theme/{build → v2/build}/merge.ts +0 -0
  539. /package/src/theme/{config → v2/config}/index.ts +0 -0
  540. /package/src/theme/{config → v2/config}/tokens/color/index.ts +0 -0
  541. /package/src/theme/{palette → v3/palette}/constants.ts +0 -0
  542. /package/src/theme/{palette → v3/palette}/types.ts +0 -0
@@ -1,32 +0,0 @@
1
- import {color} from '@sanity/color'
2
- import {HUES, TINTS} from '@sanity/ui/theme'
3
-
4
- import {_compileStyle} from './_compileStyle'
5
- import {Properties} from './types'
6
- import {varNames} from './varNames'
7
-
8
- /** @internal */
9
- export function _compilePalette(): string {
10
- return _compileStyle({
11
- layers: {
12
- palette: {
13
- ':root': compilePaletteProperties(),
14
- },
15
- },
16
- })
17
- }
18
-
19
- function compilePaletteProperties() {
20
- const rules: Properties = {
21
- [varNames.black]: color.black.hex,
22
- [varNames.white]: color.white.hex,
23
- }
24
-
25
- for (const hue of HUES) {
26
- for (const tint of TINTS) {
27
- rules[varNames[hue][tint]] = color[hue][tint].hex
28
- }
29
- }
30
-
31
- return rules
32
- }
@@ -1,440 +0,0 @@
1
- import {
2
- FONT_CODE_SIZE,
3
- FONT_HEADING_SIZE,
4
- FONT_LABEL_SIZE,
5
- FONT_TEXT_SIZE,
6
- HUES,
7
- renderColor,
8
- RenderColorContext,
9
- THEME_COLOR_CARD_TONES,
10
- THEME_COLOR_STATE_TONES,
11
- type Theme_v3,
12
- ThemeColorCardToneKey,
13
- ThemeColorSchemeKey,
14
- } from '@sanity/ui/theme'
15
-
16
- import {_compileStyle} from './_compileStyle'
17
- import {Properties} from './types'
18
- import {px, rem, toBoxShadow} from './util'
19
- import {varNames} from './varNames'
20
-
21
- const THEME_COLOR_SCHEMES = ['dark', 'light'] as const
22
- const THEME_COLOR_VARIANTS = ['tinted', 'solid'] as const
23
-
24
- /** @internal */
25
- export function _compileTheme_v3(theme: Theme_v3): string {
26
- return _compileStyle({
27
- layers: {
28
- theme: {
29
- ':root': compileThemeProperties(theme),
30
- },
31
- },
32
- })
33
- }
34
-
35
- function compileThemeProperties(theme: Theme_v3): Properties {
36
- return {
37
- ...buildAvatarThemeProperties(theme),
38
- ...buildButtonThemeProperties(theme),
39
-
40
- // card
41
- [varNames.card.shadow.outline]: px(theme.card.shadow.outline),
42
-
43
- ...buildColorThemeProperties(theme),
44
- ...buildContainerThemeProperties(theme),
45
- ...buildFontCodeThemeProperties(theme),
46
- ...buildFontHeadingThemeProperties(theme),
47
- ...buildFontLabelThemeProperties(theme),
48
- ...buildFontTextThemeProperties(theme),
49
- ...buildInputThemeProperties(theme),
50
- ...buildRadiusThemeProperties(theme),
51
- ...buildShadowThemeProperties(theme),
52
- ...buildSpaceThemeProperties(theme),
53
- }
54
- }
55
-
56
- function buildAvatarThemeProperties(theme: Theme_v3): Properties {
57
- return {
58
- [varNames.avatar.focusRing.offset]: px(theme.avatar.focusRing.offset),
59
- [varNames.avatar.focusRing.width]: px(theme.avatar.focusRing.width),
60
-
61
- [varNames.avatar.sizes[0].distance]: rem(theme.avatar.sizes[0].distance),
62
- [varNames.avatar.sizes[0].size]: rem(theme.avatar.sizes[0].size),
63
-
64
- [varNames.avatar.sizes[1].distance]: rem(theme.avatar.sizes[1].distance),
65
- [varNames.avatar.sizes[1].size]: rem(theme.avatar.sizes[1].size),
66
-
67
- [varNames.avatar.sizes[2].distance]: rem(theme.avatar.sizes[2].distance),
68
- [varNames.avatar.sizes[2].size]: rem(theme.avatar.sizes[2].size),
69
-
70
- [varNames.avatar.sizes[3].distance]: rem(theme.avatar.sizes[3].distance),
71
- [varNames.avatar.sizes[3].size]: rem(theme.avatar.sizes[3].size),
72
- }
73
- }
74
-
75
- function buildButtonThemeProperties(theme: Theme_v3): Properties {
76
- return {
77
- [varNames.button.border.width]: px(theme.button.border.width),
78
- [varNames.button.focusRing.offset]: px(theme.button.focusRing.offset),
79
- [varNames.button.focusRing.width]: px(theme.button.focusRing.width),
80
- }
81
- }
82
-
83
- function buildContainerThemeProperties(theme: Theme_v3): Properties {
84
- return {
85
- [varNames.container[0]]: rem(theme.container[0]),
86
- [varNames.container[1]]: rem(theme.container[1]),
87
- [varNames.container[2]]: rem(theme.container[2]),
88
- [varNames.container[3]]: rem(theme.container[3]),
89
- [varNames.container[4]]: rem(theme.container[4]),
90
- [varNames.container[5]]: rem(theme.container[5]),
91
- }
92
- }
93
-
94
- function buildFontCodeThemeProperties(theme: Theme_v3): Properties {
95
- const v = varNames.font.code
96
- const t = theme.font.code
97
-
98
- const props: Properties = {
99
- [v.family]: t.family,
100
- [v.featureSettings]: t.featureSettings || 'normal',
101
- [v.weights.regular]: t.weights.regular,
102
- [v.weights.medium]: t.weights.medium,
103
- [v.weights.semibold]: t.weights.semibold,
104
- [v.weights.bold]: t.weights.bold,
105
- }
106
-
107
- for (const size of FONT_CODE_SIZE) {
108
- const _v = varNames.font.code.sizes[size]
109
- const _t = theme.font.code.sizes[size]
110
-
111
- props[_v.fontSize] = rem(_t.fontSize)
112
- props[_v.lineHeight] = rem(_t.lineHeight)
113
- props[_v.ascenderHeight] = rem(_t.ascenderHeight)
114
- props[_v.descenderHeight] = rem(_t.descenderHeight)
115
- props[_v.letterSpacing] = rem(_t.letterSpacing)
116
- props[_v.iconSize] = rem(_t.iconSize)
117
- }
118
-
119
- return props
120
- }
121
-
122
- function buildFontHeadingThemeProperties(theme: Theme_v3): Properties {
123
- const v = varNames.font.heading
124
- const t = theme.font.heading
125
-
126
- const props: Properties = {
127
- [v.family]: t.family,
128
- [v.featureSettings]: t.featureSettings,
129
- [v.weights.regular]: t.weights.regular,
130
- [v.weights.medium]: t.weights.medium,
131
- [v.weights.semibold]: t.weights.semibold,
132
- [v.weights.bold]: t.weights.bold,
133
- }
134
-
135
- for (const size of FONT_HEADING_SIZE) {
136
- const _v = v.sizes[size]
137
- const _t = t.sizes[size]
138
-
139
- props[_v.fontSize] = rem(_t.fontSize)
140
- props[_v.lineHeight] = rem(_t.lineHeight)
141
- props[_v.ascenderHeight] = rem(_t.ascenderHeight)
142
- props[_v.descenderHeight] = rem(_t.descenderHeight)
143
- props[_v.letterSpacing] = rem(_t.letterSpacing)
144
- props[_v.iconSize] = rem(_t.iconSize)
145
- }
146
-
147
- return props
148
- }
149
-
150
- function buildFontLabelThemeProperties(theme: Theme_v3): Properties {
151
- const v = varNames.font.label
152
- const t = theme.font.label
153
-
154
- const props: Properties = {
155
- [v.family]: t.family,
156
- [v.featureSettings]: t.featureSettings,
157
- [v.weights.regular]: t.weights.regular,
158
- [v.weights.medium]: t.weights.medium,
159
- [v.weights.semibold]: t.weights.semibold,
160
- [v.weights.bold]: t.weights.bold,
161
- }
162
-
163
- for (const size of FONT_LABEL_SIZE) {
164
- const _v = v.sizes[size]
165
- const _t = t.sizes[size]
166
-
167
- props[_v.fontSize] = rem(_t.fontSize)
168
- props[_v.lineHeight] = rem(_t.lineHeight)
169
- props[_v.ascenderHeight] = rem(_t.ascenderHeight)
170
- props[_v.descenderHeight] = rem(_t.descenderHeight)
171
- props[_v.letterSpacing] = rem(_t.letterSpacing)
172
- props[_v.iconSize] = rem(_t.iconSize)
173
- }
174
-
175
- return props
176
- }
177
-
178
- function buildFontTextThemeProperties(theme: Theme_v3): Properties {
179
- const v = varNames.font.text
180
- const t = theme.font.text
181
-
182
- const props: Properties = {
183
- [v.family]: t.family,
184
- [v.featureSettings]: t.featureSettings,
185
- [v.weights.regular]: t.weights.regular,
186
- [v.weights.medium]: t.weights.medium,
187
- [v.weights.semibold]: t.weights.semibold,
188
- [v.weights.bold]: t.weights.bold,
189
- }
190
-
191
- for (const size of FONT_TEXT_SIZE) {
192
- const _v = v.sizes[size]
193
- const _t = t.sizes[size]
194
-
195
- props[_v.fontSize] = rem(_t.fontSize)
196
- props[_v.lineHeight] = rem(_t.lineHeight)
197
- props[_v.ascenderHeight] = rem(_t.ascenderHeight)
198
- props[_v.descenderHeight] = rem(_t.descenderHeight)
199
- props[_v.letterSpacing] = rem(_t.letterSpacing)
200
- props[_v.iconSize] = rem(_t.iconSize)
201
- }
202
-
203
- return props
204
- }
205
-
206
- function buildInputThemeProperties(theme: Theme_v3): Properties {
207
- return {
208
- [varNames.input.border.width]: px(theme.input.border.width),
209
- [varNames.input.checkbox.focusRing.offset]: px(theme.input.checkbox.focusRing.offset),
210
- [varNames.input.checkbox.focusRing.width]: px(theme.input.checkbox.focusRing.width),
211
- [varNames.input.checkbox.size]: rem(theme.input.checkbox.size),
212
- [varNames.input.radio.focusRing.offset]: px(theme.input.radio.focusRing.offset),
213
- [varNames.input.radio.focusRing.width]: px(theme.input.radio.focusRing.width),
214
- [varNames.input.radio.markSize]: rem(theme.input.radio.markSize),
215
- [varNames.input.radio.size]: rem(theme.input.radio.size),
216
- [varNames.input.select.focusRing.offset]: px(theme.input.select.focusRing.offset),
217
- [varNames.input.select.focusRing.width]: px(theme.input.select.focusRing.width),
218
- [varNames.input.switch.focusRing.offset]: px(theme.input.switch.focusRing.offset),
219
- [varNames.input.switch.focusRing.width]: px(theme.input.switch.focusRing.width),
220
- [varNames.input.switch.height]: rem(theme.input.switch.height),
221
- [varNames.input.switch.padding]: rem(theme.input.switch.padding),
222
- [varNames.input.switch.transitionDurationMs]: `${theme.input.switch.transitionDurationMs}ms`,
223
- [varNames.input.switch.transitionTimingFunction]: theme.input.switch.transitionTimingFunction,
224
- [varNames.input.switch.width]: rem(theme.input.switch.width),
225
- [varNames.input.text.focusRing.offset]: px(theme.input.text.focusRing.offset),
226
- [varNames.input.text.focusRing.width]: px(theme.input.text.focusRing.width),
227
- }
228
- }
229
-
230
- function buildRadiusThemeProperties(theme: Theme_v3): Properties {
231
- return {
232
- [varNames.radius[0]]: px(theme.radius[0]),
233
- [varNames.radius[1]]: px(theme.radius[1]),
234
- [varNames.radius[2]]: px(theme.radius[2]),
235
- [varNames.radius[3]]: px(theme.radius[3]),
236
- [varNames.radius[4]]: px(theme.radius[4]),
237
- [varNames.radius[5]]: px(theme.radius[5]),
238
- [varNames.radius[6]]: px(theme.radius[6]),
239
- }
240
- }
241
-
242
- function buildShadowThemeProperties(theme: Theme_v3): Properties {
243
- return {
244
- [varNames.shadow[0].umbra]: toBoxShadow(theme.shadow[0]?.umbra),
245
- [varNames.shadow[0].penumbra]: toBoxShadow(theme.shadow[0]?.penumbra),
246
- [varNames.shadow[0].ambient]: toBoxShadow(theme.shadow[0]?.ambient),
247
-
248
- [varNames.shadow[1].umbra]: toBoxShadow(theme.shadow[1]?.umbra),
249
- [varNames.shadow[1].penumbra]: toBoxShadow(theme.shadow[1]?.penumbra),
250
- [varNames.shadow[1].ambient]: toBoxShadow(theme.shadow[1]?.ambient),
251
-
252
- [varNames.shadow[2].umbra]: toBoxShadow(theme.shadow[2]?.umbra),
253
- [varNames.shadow[2].penumbra]: toBoxShadow(theme.shadow[2]?.penumbra),
254
- [varNames.shadow[2].ambient]: toBoxShadow(theme.shadow[2]?.ambient),
255
-
256
- [varNames.shadow[3].umbra]: toBoxShadow(theme.shadow[3]?.umbra),
257
- [varNames.shadow[3].penumbra]: toBoxShadow(theme.shadow[3]?.penumbra),
258
- [varNames.shadow[3].ambient]: toBoxShadow(theme.shadow[3]?.ambient),
259
-
260
- [varNames.shadow[4].umbra]: toBoxShadow(theme.shadow[4]?.umbra),
261
- [varNames.shadow[4].penumbra]: toBoxShadow(theme.shadow[4]?.penumbra),
262
- [varNames.shadow[4].ambient]: toBoxShadow(theme.shadow[4]?.ambient),
263
-
264
- [varNames.shadow[5].umbra]: toBoxShadow(theme.shadow[5]?.umbra),
265
- [varNames.shadow[5].penumbra]: toBoxShadow(theme.shadow[5]?.penumbra),
266
- [varNames.shadow[5].ambient]: toBoxShadow(theme.shadow[5]?.ambient),
267
- }
268
- }
269
-
270
- function buildSpaceThemeProperties(theme: Theme_v3): Properties {
271
- return {
272
- [varNames.space[0]]: px(theme.space[0]),
273
- [varNames.space[0.5]]: px(theme.space[1] / 2),
274
- [varNames.space[1]]: px(theme.space[1]),
275
- [varNames.space[2]]: px(theme.space[2]),
276
- [varNames.space[3]]: px(theme.space[3]),
277
- [varNames.space[4]]: px(theme.space[4]),
278
- [varNames.space[5]]: px(theme.space[5]),
279
- [varNames.space[6]]: px(theme.space[6]),
280
- [varNames.space[7]]: px(theme.space[7]),
281
- [varNames.space[8]]: px(theme.space[8]),
282
- [varNames.space[9]]: px(theme.space[9]),
283
- }
284
- }
285
-
286
- function buildColorThemeProperties(theme: Theme_v3): Properties {
287
- const props: Properties = {}
288
-
289
- for (const scheme of THEME_COLOR_SCHEMES) {
290
- for (const cardTone of THEME_COLOR_CARD_TONES) {
291
- Object.assign(props, buildColorAvatarThemeProperties(theme, {scheme, cardTone}))
292
- Object.assign(props, buildColorCardThemeProperties(theme, {scheme, cardTone}))
293
-
294
- for (const colorVariant of THEME_COLOR_VARIANTS) {
295
- for (const elementTone of THEME_COLOR_STATE_TONES) {
296
- // shorthand to variable names
297
- const v = varNames.color[scheme][cardTone][colorVariant][elementTone]
298
-
299
- // shorthand to values
300
- const t = theme._tokens.color[cardTone].variant[colorVariant][elementTone]
301
-
302
- const context: RenderColorContext = {
303
- bgValue: 'transparent',
304
- bgVar: v.bg[0],
305
- hue: t._hue,
306
- scheme,
307
- }
308
-
309
- Object.assign(props, {
310
- [v.bg[0]]: renderColor(t.bg[0], context),
311
- [v.bg[1]]: `color-mix(in srgb, var(${v.bg[0]}), var(${v.bg[4]}) 25%)`,
312
- [v.bg[2]]: `color-mix(in srgb, var(${v.bg[0]}), var(${v.bg[4]}) 50%)`,
313
- [v.bg[3]]: `color-mix(in srgb, var(${v.bg[0]}), var(${v.bg[4]}) 75%)`,
314
- [v.bg[4]]: renderColor(t.bg[4], context),
315
-
316
- [v.border[0]]: renderColor(t.border[0], context),
317
- [v.border[1]]: `color-mix(in srgb, var(${v.border[0]}), var(${v.border[4]}) 25%)`,
318
- [v.border[2]]: `color-mix(in srgb, var(${v.border[0]}), var(${v.border[4]}) 50%)`,
319
- [v.border[3]]: `color-mix(in srgb, var(${v.border[0]}), var(${v.border[4]}) 75%)`,
320
- [v.border[4]]: renderColor(t.border[4], context),
321
-
322
- [v.fg[0]]: renderColor(t.fg[0], context),
323
- [v.fg[1]]: `color-mix(in srgb, var(${v.fg[0]}), var(${v.fg[4]}) 25%)`,
324
- [v.fg[2]]: `color-mix(in srgb, var(${v.fg[0]}), var(${v.fg[4]}) 50%)`,
325
- [v.fg[3]]: `color-mix(in srgb, var(${v.fg[0]}), var(${v.fg[4]}) 75%)`,
326
- [v.fg[4]]: renderColor(t.fg[4], context),
327
- } satisfies Properties)
328
- }
329
- }
330
- }
331
- }
332
-
333
- return props as Properties
334
- }
335
-
336
- function buildColorAvatarThemeProperties(
337
- theme: Theme_v3,
338
- options: {scheme: ThemeColorSchemeKey; cardTone: ThemeColorCardToneKey},
339
- ): Properties {
340
- const {scheme, cardTone} = options
341
-
342
- const v = varNames.color[scheme][cardTone]
343
- const t = theme._tokens.color[cardTone]
344
-
345
- const props: Properties = {}
346
-
347
- for (const hue of HUES) {
348
- const context: RenderColorContext = {
349
- bgValue: 'transparent',
350
- bgVar: varNames.color.bg,
351
- hue: t.avatar[hue]._hue ?? hue,
352
- scheme,
353
- }
354
-
355
- Object.assign(props, {
356
- [v.avatar[hue].bg]: renderColor(t.avatar[hue].bg, context),
357
- [v.avatar[hue].fg]: renderColor(t.avatar[hue].fg, context),
358
- } satisfies Properties)
359
- }
360
-
361
- return props
362
- }
363
-
364
- function buildColorCardThemeProperties(
365
- theme: Theme_v3,
366
- options: {scheme: ThemeColorSchemeKey; cardTone: ThemeColorCardToneKey},
367
- ): Properties {
368
- const {scheme, cardTone} = options
369
-
370
- const v = varNames.color[scheme][cardTone]
371
- const t = theme._tokens.color[cardTone]
372
-
373
- const context: RenderColorContext = {
374
- bgValue: 'transparent',
375
- bgVar: varNames.color.bg,
376
- hue: t._hue,
377
- scheme,
378
- }
379
-
380
- const props: Properties = {
381
- // backdrop
382
- [v.backdrop]: renderColor(t.backdrop, context),
383
-
384
- // code
385
- [v.code.bg]: renderColor(t.code.bg, context),
386
- [v.code.fg]: renderColor(t.code.fg, context),
387
-
388
- // code / token
389
- [v.code.token.atrule]: renderColor(t.code.token.atrule, context),
390
- [v.code.token.attrName]: renderColor(t.code.token.attrName, context),
391
- [v.code.token.attrValue]: renderColor(t.code.token.attrValue, context),
392
- [v.code.token.attribute]: renderColor(t.code.token.attribute, context),
393
- [v.code.token.boolean]: renderColor(t.code.token.boolean, context),
394
- [v.code.token.builtin]: renderColor(t.code.token.builtin, context),
395
- [v.code.token.cdata]: renderColor(t.code.token.cdata, context),
396
- [v.code.token.char]: renderColor(t.code.token.char, context),
397
- [v.code.token.className]: renderColor(t.code.token.className, context),
398
- [v.code.token.class]: renderColor(t.code.token.class, context),
399
- [v.code.token.comment]: renderColor(t.code.token.comment, context),
400
- [v.code.token.constant]: renderColor(t.code.token.constant, context),
401
- [v.code.token.deleted]: renderColor(t.code.token.deleted, context),
402
- [v.code.token.doctype]: renderColor(t.code.token.doctype, context),
403
- [v.code.token.entity]: renderColor(t.code.token.entity, context),
404
- [v.code.token.function]: renderColor(t.code.token.function, context),
405
- [v.code.token.hexcode]: renderColor(t.code.token.hexcode, context),
406
- [v.code.token.id]: renderColor(t.code.token.id, context),
407
- [v.code.token.important]: renderColor(t.code.token.important, context),
408
- [v.code.token.inserted]: renderColor(t.code.token.inserted, context),
409
- [v.code.token.keyword]: renderColor(t.code.token.keyword, context),
410
- [v.code.token.number]: renderColor(t.code.token.number, context),
411
- [v.code.token.operator]: renderColor(t.code.token.operator, context),
412
- [v.code.token.prolog]: renderColor(t.code.token.prolog, context),
413
- [v.code.token.property]: renderColor(t.code.token.property, context),
414
- [v.code.token.pseudoClass]: renderColor(t.code.token.pseudoClass, context),
415
- [v.code.token.pseudoElement]: renderColor(t.code.token.pseudoElement, context),
416
- [v.code.token.punctuation]: renderColor(t.code.token.punctuation, context),
417
- [v.code.token.regex]: renderColor(t.code.token.regex, context),
418
- [v.code.token.selector]: renderColor(t.code.token.selector, context),
419
- [v.code.token.string]: renderColor(t.code.token.string, context),
420
- [v.code.token.symbol]: renderColor(t.code.token.symbol, context),
421
- [v.code.token.tag]: renderColor(t.code.token.tag, context),
422
- [v.code.token.unit]: renderColor(t.code.token.unit, context),
423
- [v.code.token.url]: renderColor(t.code.token.url, context),
424
- [v.code.token.variable]: renderColor(t.code.token.variable, context),
425
-
426
- // focus ring
427
- [v.focusRing]: renderColor(t.focusRing, context),
428
-
429
- // link
430
- [v.link.fg]: renderColor(t.link.fg, context),
431
-
432
- // shadow
433
- [v.shadow.outline]: renderColor(t.shadow.outline, context),
434
- [v.shadow.umbra]: renderColor(t.shadow.umbra, context),
435
- [v.shadow.penumbra]: renderColor(t.shadow.penumbra, context),
436
- [v.shadow.ambient]: renderColor(t.shadow.ambient, context),
437
- }
438
-
439
- return props
440
- }
@@ -1,30 +0,0 @@
1
- // import {responsiveRules} from '../../responsiveRules'
2
- // import {type Rules} from '../../types'
3
-
4
- // export const flexRules: Rules = {
5
- // // direction
6
- // // ...responsiveRules('row', {flexDirection: 'row'}),
7
- // // ...responsiveRules('column', {flexDirection: 'column'}),
8
-
9
- // // align
10
- // ...responsiveRules('align-flex-start', {alignItems: 'flex-start'}),
11
- // ...responsiveRules('align-flex-end', {alignItems: 'end'}),
12
- // ...responsiveRules('align-center', {alignItems: 'center'}),
13
- // ...responsiveRules('align-stretch', {alignItems: 'stretch'}),
14
- // ...responsiveRules('align-baseline', {alignItems: 'baseline'}),
15
-
16
- // // justify
17
- // ...responsiveRules('justify-flex-start', {justifyContent: 'flex-start'}),
18
- // ...responsiveRules('justify-flex-end', {justifyContent: 'flex-end'}),
19
- // ...responsiveRules('justify-center', {justifyContent: 'center'}),
20
- // ...responsiveRules('justify-between', {justifyContent: 'space-between'}),
21
- // ...responsiveRules('justify-around', {justifyContent: 'space-around'}),
22
- // ...responsiveRules('justify-evenly', {justifyContent: 'space-evenly'}),
23
-
24
- // // wrap
25
- // ...responsiveRules('wrap-nowrap', {flexWrap: 'nowrap'}),
26
- // ...responsiveRules('wrap-wrap', {flexWrap: 'wrap'}),
27
- // ...responsiveRules('wrap-reverse', {flexWrap: 'wrap-reverse'}),
28
- // }
29
-
30
- export {}
@@ -1,19 +0,0 @@
1
- /** @internal */
2
- export function _getClassNames(...classNames: Array<string | false | undefined>): string[] {
3
- return classNames
4
- .map((n) => typeof n === 'string' && n.trim())
5
- .filter(Boolean)
6
- .join(' ')
7
- .split(' ')
8
- }
9
-
10
- /** @public */
11
- export function composeClassNames(
12
- ...classNames: Array<string | false | undefined>
13
- ): string | undefined {
14
- return unique(_getClassNames(...classNames)).join(' ') || undefined
15
- }
16
-
17
- function unique<T>(array: T[]): T[] {
18
- return Array.from(new Set(array))
19
- }
@@ -1,117 +0,0 @@
1
- // import {getTheme_v2} from '@sanity/ui/theme'
2
- // import {ThemeProps} from '../../../core'
3
- // import {css} from '../../../core/lib/styled'
4
- // import {_cardColorStyle} from '../../../core/styles/card'
5
- // import {SelectableTone} from '../../../core/types'
6
-
7
- // /**
8
- // * @internal
9
- // * @deprecated
10
- // */
11
- // export interface SelectableStyleProps {
12
- // $tone: SelectableTone
13
- // }
14
-
15
- // export function selectableBaseStyle(): ReturnType<typeof css> {
16
- // return css`
17
- // background-color: inherit;
18
- // color: inherit;
19
-
20
- // &[data-as='button'] {
21
- // -webkit-font-smoothing: inherit;
22
- // appearance: none;
23
- // outline: none;
24
- // font: inherit;
25
- // text-align: inherit;
26
- // border: 0;
27
- // width: -moz-available;
28
- // width: -webkit-fill-available;
29
- // width: stretch;
30
- // }
31
-
32
- // /* &:is(a) */
33
- // &[data-as='a'] {
34
- // text-decoration: none;
35
- // }
36
- // `
37
- // }
38
-
39
- // export function selectableColorStyle(
40
- // props: SelectableStyleProps & ThemeProps,
41
- // ): ReturnType<typeof css> {
42
- // const {$tone} = props
43
- // const {color, style} = getTheme_v2(props.theme)
44
- // const tone = color.selectable[$tone]
45
-
46
- // return css`
47
- // ${_cardColorStyle(color, tone.enabled)}
48
-
49
- // background-color: var(--card-bg-color);
50
- // color: var(--card-fg-color);
51
- // outline: none;
52
-
53
- // /* &:is(button) */
54
- // &[data-as='button'] {
55
- // &:disabled {
56
- // ${_cardColorStyle(color, tone.disabled)}
57
- // }
58
-
59
- // &:not(:disabled) {
60
- // &[aria-pressed='true'] {
61
- // ${_cardColorStyle(color, tone.pressed)}
62
- // }
63
-
64
- // &[data-selected],
65
- // &[aria-selected='true'] > & {
66
- // ${_cardColorStyle(color, tone.selected)}
67
- // }
68
-
69
- // @media (hover: hover) {
70
- // &:not([data-selected]) {
71
- // &[data-hovered],
72
- // &:hover {
73
- // ${_cardColorStyle(color, tone.hovered)}
74
- // }
75
-
76
- // &:active {
77
- // ${_cardColorStyle(color, tone.pressed)}
78
- // }
79
- // }
80
- // }
81
- // }
82
- // }
83
-
84
- // /* &:is(a) */
85
- // &[data-as='a'] {
86
- // &[data-disabled] {
87
- // ${_cardColorStyle(color, tone.disabled)}
88
- // }
89
-
90
- // &:not([data-disabled]) {
91
- // &[data-pressed] {
92
- // ${_cardColorStyle(color, tone.pressed)}
93
- // }
94
-
95
- // &[data-selected] {
96
- // ${_cardColorStyle(color, tone.selected)}
97
- // }
98
-
99
- // @media (hover: hover) {
100
- // &:not([data-selected]) {
101
- // &[data-hovered],
102
- // &:hover {
103
- // ${_cardColorStyle(color, tone.hovered)}
104
- // }
105
- // &:active {
106
- // ${_cardColorStyle(color, tone.pressed)}
107
- // }
108
- // }
109
- // }
110
- // }
111
- // }
112
-
113
- // ${style?.card?.root}
114
- // `
115
- // }
116
-
117
- export {}