@sanity/ui 3.0.0-static.0 → 3.0.0-static.10

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 (1235) hide show
  1. package/LICENSE +1 -1
  2. package/bin/ui.js +0 -1
  3. package/dist/_chunks-cjs/_visual-editing.js +3138 -0
  4. package/dist/_chunks-cjs/_visual-editing.js.map +1 -0
  5. package/dist/_chunks-cjs/buildCommand.js +17 -2821
  6. package/dist/_chunks-cjs/buildCommand.js.map +1 -1
  7. package/dist/_chunks-cjs/refractor.js +27 -0
  8. package/dist/_chunks-cjs/refractor.js.map +1 -0
  9. package/dist/_chunks-es/_visual-editing.mjs +3145 -0
  10. package/dist/_chunks-es/_visual-editing.mjs.map +1 -0
  11. package/dist/_chunks-es/refractor.mjs +26 -0
  12. package/dist/_chunks-es/refractor.mjs.map +1 -0
  13. package/dist/_visual-editing.d.mts +811 -0
  14. package/dist/_visual-editing.d.ts +811 -0
  15. package/dist/_visual-editing.js +31 -0
  16. package/dist/_visual-editing.js.map +1 -0
  17. package/dist/_visual-editing.mjs +31 -0
  18. package/dist/_visual-editing.mjs.map +1 -0
  19. package/dist/cli.js +340 -6
  20. package/dist/cli.js.map +1 -1
  21. package/dist/css.d.mts +970 -440
  22. package/dist/css.d.ts +970 -440
  23. package/dist/css.js +4257 -2514
  24. package/dist/css.js.map +1 -1
  25. package/dist/css.mjs +4259 -2515
  26. package/dist/css.mjs.map +1 -1
  27. package/dist/index.d.mts +499 -561
  28. package/dist/index.d.ts +499 -561
  29. package/dist/index.js +1160 -5463
  30. package/dist/index.js.map +1 -1
  31. package/dist/index.mjs +1089 -5401
  32. package/dist/index.mjs.map +1 -1
  33. package/dist/sanity-palette.css +1 -0
  34. package/dist/sanity-theme.css +1 -25
  35. package/dist/system.css +23226 -2941
  36. package/dist/theme.d.mts +399 -112
  37. package/dist/theme.d.ts +399 -112
  38. package/dist/theme.js +2174 -2060
  39. package/dist/theme.js.map +1 -1
  40. package/dist/theme.mjs +2207 -2095
  41. package/dist/theme.mjs.map +1 -1
  42. package/exports/_visual-editing.ts +31 -0
  43. package/exports/index.ts +1 -1
  44. package/package.json +96 -85
  45. package/src/cli/buildCommand.ts +48 -0
  46. package/src/cli/index.ts +38 -0
  47. package/src/css/_comp.test.ts +7 -0
  48. package/src/css/_comp.ts +11 -0
  49. package/src/css/_mergeStyles.ts +31 -0
  50. package/src/css/_resp.ts +16 -6
  51. package/src/css/_responsiveRule.ts +38 -0
  52. package/src/css/aspects/border/border.style.ts +13 -0
  53. package/src/css/aspects/border/border.ts +14 -0
  54. package/src/css/aspects/display/display.style.ts +34 -0
  55. package/src/css/aspects/display/display.ts +7 -0
  56. package/src/css/aspects/display/index.ts +2 -0
  57. package/src/css/aspects/display/types.ts +17 -0
  58. package/src/css/aspects/flex/flex.style.ts +30 -0
  59. package/src/css/aspects/flex/flex.ts +13 -0
  60. package/src/css/aspects/flex/flexAlign.style.ts +12 -0
  61. package/src/css/aspects/flex/flexDirection.style.ts +11 -0
  62. package/src/css/aspects/flex/flexJustify.style.ts +13 -0
  63. package/src/css/aspects/flex/flexWrap.style.ts +10 -0
  64. package/src/css/aspects/flexItem/flex.style.ts +22 -0
  65. package/src/css/aspects/flexItem/flexItem.ts +8 -0
  66. package/src/css/aspects/flexItem/types.ts +27 -0
  67. package/src/css/aspects/font/font.style.ts +151 -0
  68. package/src/css/aspects/font/font.ts +12 -0
  69. package/src/css/aspects/font/types.ts +12 -0
  70. package/src/css/aspects/gap/gap.style.ts +21 -0
  71. package/src/css/aspects/gap/gap.ts +8 -0
  72. package/src/css/aspects/gap/types.ts +10 -0
  73. package/src/css/aspects/grid/grid.ts +13 -0
  74. package/src/css/aspects/grid/gridAutoColumns.style.ts +11 -0
  75. package/src/css/aspects/grid/gridAutoFlow.style.ts +11 -0
  76. package/src/css/aspects/grid/gridAutoRows.style.ts +11 -0
  77. package/src/css/aspects/grid/gridColumns.style.ts +18 -0
  78. package/src/css/aspects/grid/gridRows.style.ts +18 -0
  79. package/src/css/aspects/grid/index.ts +2 -0
  80. package/src/css/aspects/grid/types.ts +29 -0
  81. package/src/css/aspects/gridItem/gridColumn.style.ts +20 -0
  82. package/src/css/aspects/gridItem/gridColumnEnd.style.ts +20 -0
  83. package/src/css/aspects/gridItem/gridColumnStart.style.ts +20 -0
  84. package/src/css/aspects/gridItem/gridItem.ts +15 -0
  85. package/src/css/aspects/gridItem/gridRow.style.ts +20 -0
  86. package/src/css/aspects/gridItem/gridRowEnd.style.ts +20 -0
  87. package/src/css/aspects/gridItem/gridRowStart.style.ts +20 -0
  88. package/src/css/aspects/height/height.style.ts +9 -0
  89. package/src/css/aspects/height/height.ts +17 -0
  90. package/src/css/aspects/height/index.ts +1 -0
  91. package/src/css/aspects/index.ts +21 -0
  92. package/src/css/aspects/inset/index.ts +2 -0
  93. package/src/css/aspects/inset/inset.style.ts +12 -0
  94. package/src/css/aspects/inset/inset.ts +13 -0
  95. package/src/css/aspects/inset/types.ts +13 -0
  96. package/src/css/aspects/margin/margin.style.ts +46 -0
  97. package/src/css/aspects/margin/margin.ts +15 -0
  98. package/src/css/aspects/maxWidth/maxWidth.style.ts +16 -0
  99. package/src/css/aspects/maxWidth/types.ts +7 -0
  100. package/src/css/aspects/minWidth/index.ts +2 -0
  101. package/src/css/aspects/minWidth/minWidth.style.ts +13 -0
  102. package/src/css/aspects/minWidth/minWidth.ts +6 -0
  103. package/src/css/aspects/minWidth/types.ts +7 -0
  104. package/src/css/aspects/outline/outline.style.ts +9 -0
  105. package/src/css/aspects/overflow/index.ts +2 -0
  106. package/src/css/aspects/overflow/overflow.style.ts +11 -0
  107. package/src/css/aspects/overflow/overflow.ts +11 -0
  108. package/src/css/aspects/overflow/types.ts +11 -0
  109. package/src/css/aspects/padding/padding.style.ts +46 -0
  110. package/src/css/aspects/padding/padding.ts +15 -0
  111. package/src/css/aspects/padding/types.ts +14 -0
  112. package/src/css/aspects/pointerEvents/pointerEvents.style.ts +13 -0
  113. package/src/css/aspects/pointerEvents/pointerEvents.ts +6 -0
  114. package/src/css/aspects/position/position.style.ts +12 -0
  115. package/src/css/aspects/position/position.ts +7 -0
  116. package/src/css/aspects/position/types.ts +9 -0
  117. package/src/css/aspects/radius/radius.style.ts +16 -0
  118. package/src/css/aspects/radius/radius.ts +8 -0
  119. package/src/css/aspects/radius/types.ts +8 -0
  120. package/src/css/aspects/shadow/index.ts +2 -0
  121. package/src/css/aspects/shadow/shadow.style.ts +49 -0
  122. package/src/css/aspects/shadow/shadow.ts +7 -0
  123. package/src/css/aspects/shadow/types.ts +8 -0
  124. package/src/css/aspects/textOverflow/index.ts +2 -0
  125. package/src/css/aspects/textOverflow/textOverflow.style.ts +21 -0
  126. package/src/css/aspects/textOverflow/textOverflow.ts +6 -0
  127. package/src/css/aspects/textOverflow/types.ts +8 -0
  128. package/src/css/aspects/width/index.ts +2 -0
  129. package/src/css/aspects/width/rules.ts +8 -0
  130. package/src/css/aspects/width/types.ts +9 -0
  131. package/src/css/aspects/width/width.style.ts +11 -0
  132. package/src/css/compile/compilePalette.ts +27 -0
  133. package/src/css/compile/compileRule.ts +50 -11
  134. package/src/css/compile/compileRules.test.ts +36 -0
  135. package/src/css/compile/compileRules.ts +43 -0
  136. package/src/css/compile/compileStyle.ts +148 -0
  137. package/src/css/compile/compileSystem.ts +6 -3
  138. package/src/css/compile/compileTheme.ts +8 -502
  139. package/src/css/compile/compileTheme_v3.ts +401 -0
  140. package/src/css/compile/types.ts +6 -0
  141. package/src/css/components/breadcrumbs/breadcrumbs.style.ts +9 -0
  142. package/src/css/components/breadcrumbs/breadcrumbs.ts +3 -3
  143. package/src/css/components/breadcrumbs/rules.ts +18 -0
  144. package/src/css/components/dialog/dialog.style.ts +79 -0
  145. package/src/css/components/dialog/dialog.ts +30 -0
  146. package/src/css/components/dialog/index.ts +1 -1
  147. package/src/css/components/dialog/rules.ts +4 -1
  148. package/src/css/components/menu/index.ts +1 -0
  149. package/src/css/components/menu/menu.style.ts +17 -0
  150. package/src/css/components/menu/menu.ts +9 -0
  151. package/src/css/components/menu/rules.ts +15 -0
  152. package/src/css/components/skeleton/index.ts +2 -0
  153. package/src/css/components/skeleton/rules.ts +113 -0
  154. package/src/css/components/skeleton/skeleton.style.ts +96 -0
  155. package/src/css/components/skeleton/skeleton.ts +31 -0
  156. package/src/css/components/skeleton/types.ts +26 -0
  157. package/src/css/components/toast/index.ts +1 -0
  158. package/src/css/components/toast/rules.ts +18 -0
  159. package/src/css/components/toast/toast.style.ts +20 -0
  160. package/src/css/components/toast/toast.ts +21 -0
  161. package/src/css/components/tree/rules.ts +118 -2
  162. package/src/css/components/tree/tree.style.ts +55 -0
  163. package/src/css/components/tree/tree.ts +3 -3
  164. package/src/css/composeClassNames.ts +16 -2
  165. package/src/css/constants.ts +1 -0
  166. package/src/css/index.ts +15 -21
  167. package/src/css/primitives/_arrow/_arrow.style.ts +73 -0
  168. package/src/css/primitives/_arrow/_arrow.ts +14 -0
  169. package/src/css/primitives/_arrow/index.ts +1 -0
  170. package/src/css/primitives/_input/__workshop__/customInput.tsx +16 -0
  171. package/src/css/primitives/_input/__workshop__/index.ts +14 -0
  172. package/src/css/primitives/_input/_input.style.ts +162 -0
  173. package/src/css/primitives/_input/index.ts +2 -0
  174. package/src/css/primitives/_input/input.ts +25 -0
  175. package/src/css/primitives/_input/types.ts +12 -0
  176. package/src/css/primitives/_selectable/__style.ts +117 -0
  177. package/src/css/primitives/_selectable/_contants.ts +11 -0
  178. package/src/css/primitives/_selectable/_selectable.style.ts +132 -0
  179. package/src/css/primitives/_selectable/selectable.ts +9 -0
  180. package/src/css/primitives/_selectable/types.ts +8 -0
  181. package/src/css/primitives/avatar/avatar.style.ts +175 -0
  182. package/src/css/primitives/avatar/avatar.ts +13 -18
  183. package/src/css/primitives/avatar/rules.ts +85 -99
  184. package/src/css/primitives/avatar/types.ts +1 -2
  185. package/src/css/primitives/badge/badge.style.ts +22 -0
  186. package/src/css/primitives/badge/badge.ts +4 -4
  187. package/src/css/primitives/badge/types.ts +2 -2
  188. package/src/css/primitives/box/box.style.ts +31 -0
  189. package/src/css/primitives/box/box.ts +34 -16
  190. package/src/css/primitives/box/types.ts +31 -29
  191. package/src/css/primitives/button/_constants.ts +17 -0
  192. package/src/css/primitives/button/button.style.ts +201 -0
  193. package/src/css/primitives/button/button.ts +29 -14
  194. package/src/css/primitives/button/rules.ts +284 -40
  195. package/src/css/primitives/card/_constants.ts +13 -0
  196. package/src/css/primitives/card/card.style.ts +270 -0
  197. package/src/css/primitives/card/card.ts +9 -16
  198. package/src/css/primitives/card/index.ts +1 -0
  199. package/src/css/primitives/card/types.ts +10 -0
  200. package/src/css/primitives/checkbox/__styles.ts +115 -113
  201. package/src/css/primitives/checkbox/checkbox.style.ts +154 -0
  202. package/src/css/primitives/checkbox/checkbox.ts +5 -5
  203. package/src/css/primitives/checkbox/rules.ts +31 -15
  204. package/src/css/primitives/code/code.style.ts +62 -0
  205. package/src/css/primitives/code/code.ts +4 -4
  206. package/src/css/primitives/code/rules.ts +27 -2
  207. package/src/css/primitives/code/types.ts +1 -1
  208. package/src/css/primitives/container/container.style.ts +10 -0
  209. package/src/css/primitives/container/container.ts +4 -4
  210. package/src/css/primitives/container/types.ts +1 -0
  211. package/src/css/primitives/heading/heading.style.ts +47 -0
  212. package/src/css/primitives/heading/heading.ts +6 -5
  213. package/src/css/primitives/heading/rules.ts +77 -6
  214. package/src/css/primitives/heading/types.ts +2 -2
  215. package/src/css/primitives/kbd/kbd.style.ts +22 -0
  216. package/src/css/primitives/kbd/kbd.ts +4 -4
  217. package/src/css/primitives/kbd/rules.ts +5 -5
  218. package/src/css/primitives/kbd/types.ts +3 -1
  219. package/src/css/primitives/label/label.style.ts +48 -0
  220. package/src/css/primitives/label/label.ts +4 -4
  221. package/src/css/primitives/label/rules.ts +54 -2
  222. package/src/css/primitives/label/types.ts +1 -1
  223. package/src/css/primitives/popover/popover.style.ts +5 -0
  224. package/src/css/primitives/popover/popover.ts +7 -3
  225. package/src/css/primitives/radio/radio.style.ts +123 -0
  226. package/src/css/primitives/radio/radio.ts +3 -3
  227. package/src/css/primitives/radio/rules.ts +117 -1
  228. package/src/css/primitives/select/index.ts +1 -0
  229. package/src/css/primitives/select/rules.ts +18 -1
  230. package/src/css/primitives/select/select.style.ts +24 -0
  231. package/src/css/primitives/select/select.ts +9 -2
  232. package/src/css/primitives/select/types.ts +5 -0
  233. package/src/css/primitives/spinner/rules.ts +6 -7
  234. package/src/css/primitives/spinner/spinner.style.ts +22 -0
  235. package/src/css/primitives/spinner/spinner.ts +7 -3
  236. package/src/css/primitives/stack/stack.style.ts +9 -0
  237. package/src/css/primitives/stack/stack.ts +6 -0
  238. package/src/css/primitives/switch/rules.ts +264 -56
  239. package/src/css/primitives/switch/switch.style.ts +94 -0
  240. package/src/css/primitives/switch/switch.ts +19 -3
  241. package/src/css/primitives/text/rules.ts +93 -4
  242. package/src/css/primitives/text/text.style.ts +64 -0
  243. package/src/css/primitives/text/text.ts +5 -4
  244. package/src/css/primitives/text/types.ts +2 -2
  245. package/src/css/primitives/textArea/index.ts +1 -0
  246. package/src/css/primitives/textArea/rules.ts +3 -1
  247. package/src/css/primitives/textArea/textArea.style.ts +9 -0
  248. package/src/css/primitives/textArea/textArea.ts +5 -2
  249. package/src/css/primitives/textArea/types.ts +5 -0
  250. package/src/css/primitives/textInput/index.ts +1 -0
  251. package/src/css/primitives/textInput/rules.ts +94 -96
  252. package/src/css/primitives/textInput/textInput.style.ts +167 -0
  253. package/src/css/primitives/textInput/textInput.ts +5 -4
  254. package/src/css/primitives/textInput/types.ts +11 -0
  255. package/src/css/primitives/token/rules.ts +37 -37
  256. package/src/css/primitives/token/token.style.ts +49 -0
  257. package/src/css/primitives/tooltip/rules.ts +2 -0
  258. package/src/css/primitives/tooltip/tooltip.style.ts +21 -0
  259. package/src/css/primitives/tooltip/tooltip.ts +5 -5
  260. package/src/css/scopeClassName.ts +6 -0
  261. package/src/css/system.style.ts +158 -0
  262. package/src/css/types.ts +630 -369
  263. package/src/css/util.ts +27 -0
  264. package/src/css/utils/srOnly/srOnly.style.ts +14 -0
  265. package/src/css/utils/srOnly/srOnly.ts +5 -0
  266. package/src/css/varNames.ts +395 -256
  267. package/src/css/vars.ts +422 -246
  268. package/src/theme/_constants.ts +26 -0
  269. package/src/theme/_types.ts +41 -0
  270. package/src/theme/build/_deprecated/color/_selectable/createSelectableTones.ts +1 -1
  271. package/src/theme/build/_deprecated/color/_solid/createSolidTones.ts +1 -1
  272. package/src/theme/build/_deprecated/color/button/createButtonModes.ts +1 -6
  273. package/src/theme/build/_deprecated/color/button/createButtonTones.ts +2 -2
  274. package/src/theme/build/_deprecated/color/card/createCardStates.ts +2 -2
  275. package/src/theme/build/_deprecated/color/factory.ts +8 -9
  276. package/src/theme/build/_deprecated/color/input/createInputModes.ts +1 -1
  277. package/src/theme/build/_deprecated/color/muted/createMuted.ts +2 -2
  278. package/src/theme/build/_deprecated/color/spot/createSpot.ts +1 -1
  279. package/src/theme/build/buildColorTheme.ts +62 -52
  280. package/src/theme/build/buildTheme.ts +8 -32
  281. package/src/theme/build/colorToken/colorToken.ts +1 -1
  282. package/src/theme/build/lib/color-fns/rgba.ts +4 -0
  283. package/src/theme/build/merge.ts +0 -2
  284. package/src/theme/build/mixThemeColor.ts +1 -1
  285. package/src/theme/build/renderColorTheme.ts +34 -37
  286. package/src/theme/build/renderColorValue.ts +4 -3
  287. package/src/theme/build/resolveColorTokens.ts +57 -120
  288. package/src/theme/config/helpers.ts +2 -2
  289. package/src/theme/config/system.ts +3 -2
  290. package/src/theme/config/tokens/color/types.ts +5 -18
  291. package/src/theme/config/tokens/parseTokenKey.ts +1 -1
  292. package/src/theme/config/tokens/parseTokenValue.ts +1 -1
  293. package/src/theme/config/tokens/types.ts +3 -2
  294. package/src/theme/config/types.ts +4 -4
  295. package/src/theme/defaults/colorTokens.ts +8 -6
  296. package/src/theme/defaults/config.ts +2 -2
  297. package/src/theme/defaults/fonts.ts +17 -16
  298. package/src/theme/getScopedTheme.ts +10 -4
  299. package/src/theme/index.ts +7 -1
  300. package/src/theme/palette/constants.ts +13 -0
  301. package/src/theme/palette/index.ts +2 -0
  302. package/src/theme/palette/types.ts +4 -0
  303. package/src/theme/types.ts +32 -0
  304. package/src/theme/v0/color/_generic.ts +35 -0
  305. package/src/theme/v0/color/_system.ts +17 -0
  306. package/src/theme/v0/color/color.ts +40 -0
  307. package/src/theme/v0/color/index.ts +11 -0
  308. package/src/theme/v0/color/input.ts +34 -0
  309. package/src/theme/v0/color/spot.ts +13 -0
  310. package/src/theme/v0/css.ts +8 -0
  311. package/src/theme/v0/font.ts +53 -0
  312. package/src/theme/v0/index.ts +10 -0
  313. package/src/theme/v0/theme.ts +72 -0
  314. package/src/theme/v2/avatar.ts +14 -0
  315. package/src/theme/v2/color/_constants.ts +45 -0
  316. package/src/theme/v2/color/_helpers.ts +24 -0
  317. package/src/theme/v2/color/_system.ts +40 -0
  318. package/src/theme/v2/color/badge.ts +16 -0
  319. package/src/theme/v2/color/color.ts +34 -0
  320. package/src/theme/v2/index.ts +4 -0
  321. package/src/theme/v2/input.ts +33 -0
  322. package/src/theme/v2/theme.ts +49 -0
  323. package/src/theme/v3/buildTheme_v3.test.ts +40 -0
  324. package/src/theme/v3/buildTheme_v3.ts +29 -0
  325. package/src/theme/v3/color/buildColor_v3.ts +198 -0
  326. package/src/theme/v3/color/card.ts +121 -0
  327. package/src/theme/v3/color/color.ts +98 -0
  328. package/src/theme/v3/color/element.ts +19 -0
  329. package/src/theme/v3/color/index.ts +7 -0
  330. package/src/theme/v3/color/parseColor.test.ts +79 -0
  331. package/src/theme/v3/color/parseColor.ts +167 -0
  332. package/src/theme/v3/color/renderColor.test.ts +19 -0
  333. package/src/theme/v3/color/renderColor.ts +33 -0
  334. package/src/theme/v3/color/token.ts +17 -0
  335. package/src/theme/v3/color/tokens.ts +5 -0
  336. package/src/theme/v3/defaults.ts +202 -0
  337. package/src/theme/v3/index.ts +6 -0
  338. package/src/theme/v3/merge.ts +22 -0
  339. package/src/theme/v3/resolveTokens.ts +204 -0
  340. package/src/theme/v3/tokens.ts +16 -0
  341. package/src/theme/v3/types.ts +45 -0
  342. package/src/theme/versioning/getTheme_v2.ts +2 -1
  343. package/src/theme/versioning/index.ts +0 -4
  344. package/src/theme/versioning/is_v0.ts +2 -1
  345. package/src/theme/versioning/is_v2.ts +2 -1
  346. package/src/theme/versioning/themeColor_v0_v2.ts +33 -5
  347. package/src/theme/versioning/themeColor_v2_v2_9.ts +49 -0
  348. package/src/theme/versioning/themeColor_v3_v2.ts +206 -0
  349. package/src/theme/versioning/v0_v2.ts +6 -1
  350. package/src/theme/versioning/v2_v0.ts +6 -6
  351. package/src/theme/versioning/v3_v2.ts +108 -0
  352. package/src/ui/StyleTags.tsx +24 -0
  353. package/src/ui/_compat/index.ts +9 -0
  354. package/src/ui/_compat/styles/_responsive.ts +19 -0
  355. package/src/ui/_compat/styles/index.ts +1 -0
  356. package/src/ui/_compat/theme/index.ts +5 -0
  357. package/src/ui/_compat/theme/theme.test.tsx +73 -0
  358. package/src/ui/_compat/theme/themeColorProvider.tsx +30 -0
  359. package/src/ui/_compat/theme/themeContext.ts +10 -0
  360. package/src/ui/_compat/theme/themeProvider.tsx +74 -0
  361. package/src/ui/_compat/theme/useRootTheme.ts +17 -0
  362. package/src/ui/_compat/theme/useTheme.ts +16 -0
  363. package/src/ui/_compat/types.ts +274 -0
  364. package/src/ui/components/autocomplete/__mocks__/apiStore.ts +49 -0
  365. package/src/ui/components/autocomplete/__workshop__/async.tsx +156 -0
  366. package/src/ui/components/autocomplete/__workshop__/constrainedHeight.tsx +131 -0
  367. package/src/ui/components/autocomplete/__workshop__/custom.tsx +90 -0
  368. package/src/ui/components/autocomplete/__workshop__/example.tsx +80 -0
  369. package/src/ui/components/autocomplete/__workshop__/fullscreen.tsx +293 -0
  370. package/src/ui/components/autocomplete/autocomplete.tsx +722 -0
  371. package/src/ui/components/autocomplete/autocompleteOption.tsx +45 -0
  372. package/src/ui/components/autocomplete/types.ts +108 -0
  373. package/src/ui/components/breadcrumbs/__workshop__/example.tsx +62 -0
  374. package/src/ui/components/breadcrumbs/breadcrumbs.tsx +127 -0
  375. package/src/ui/components/dialog/__workshop__/activate.tsx +134 -0
  376. package/src/ui/components/dialog/__workshop__/nested.tsx +72 -0
  377. package/src/ui/components/dialog/__workshop__/onScroll.tsx +39 -0
  378. package/src/ui/components/dialog/__workshop__/panes.tsx +82 -0
  379. package/src/ui/components/dialog/__workshop__/position.tsx +30 -0
  380. package/src/ui/components/dialog/__workshop__/props.tsx +77 -0
  381. package/src/ui/components/dialog/__workshop__/wrapped.tsx +76 -0
  382. package/src/ui/components/dialog/dialog.tsx +432 -0
  383. package/src/ui/components/dialog/dialogProvider.tsx +35 -0
  384. package/src/ui/components/dialog/useDialog.ts +11 -0
  385. package/src/ui/components/hotkeys/hotkeys.tsx +54 -0
  386. package/src/ui/components/menu/__workshop__/asComponent.tsx +45 -0
  387. package/src/ui/components/menu/__workshop__/avatarMenu.tsx +51 -0
  388. package/src/ui/components/menu/__workshop__/constrainedInBoundary.tsx +134 -0
  389. package/src/ui/components/menu/__workshop__/customSelectedState.tsx +39 -0
  390. package/src/ui/components/menu/__workshop__/menuButton.tsx +80 -0
  391. package/src/ui/components/menu/__workshop__/shouldFocus.tsx +47 -0
  392. package/src/ui/components/menu/__workshop__/tones.tsx +25 -0
  393. package/src/ui/components/menu/menu.test.tsx +128 -0
  394. package/src/ui/components/menu/menu.tsx +200 -0
  395. package/src/ui/components/menu/menuButton.tsx +275 -0
  396. package/src/ui/components/menu/menuContext.ts +31 -0
  397. package/src/ui/components/menu/menuDivider.tsx +22 -0
  398. package/src/ui/components/menu/menuGroup.tsx +228 -0
  399. package/src/ui/components/menu/menuItem.tsx +180 -0
  400. package/src/ui/components/menu/useMenu.ts +21 -0
  401. package/src/ui/components/menu/useMenuController.ts +241 -0
  402. package/src/ui/components/skeleton/__workshop__/delay.tsx +70 -0
  403. package/src/ui/components/skeleton/__workshop__/skeleton.tsx +64 -0
  404. package/src/ui/components/skeleton/skeleton.tsx +53 -0
  405. package/src/ui/components/skeleton/textSkeleton.tsx +132 -0
  406. package/src/ui/components/tab/tab.tsx +105 -0
  407. package/src/ui/components/tab/tabList.tsx +74 -0
  408. package/src/ui/components/tab/tabPanel.tsx +40 -0
  409. package/src/ui/components/toast/__workshop__/hook.tsx +71 -0
  410. package/src/ui/components/toast/__workshop__/toast.tsx +26 -0
  411. package/src/ui/components/toast/toast.test.tsx +101 -0
  412. package/src/ui/components/toast/toast.tsx +211 -0
  413. package/src/ui/components/toast/toastLayer.tsx +38 -0
  414. package/src/ui/components/toast/toastProvider.tsx +113 -0
  415. package/src/ui/components/toast/toastState.ts +6 -0
  416. package/src/ui/components/toast/types.ts +28 -0
  417. package/src/ui/components/toast/useToast.ts +25 -0
  418. package/src/ui/components/tree/__workshop__/basic.tsx +105 -0
  419. package/src/ui/components/tree/__workshop__/tabFromElement.tsx +84 -0
  420. package/src/ui/components/tree/tree.tsx +244 -0
  421. package/src/ui/components/tree/treeGroup.tsx +30 -0
  422. package/src/ui/components/tree/treeItem.tsx +220 -0
  423. package/src/ui/components/tree/useTree.ts +17 -0
  424. package/src/ui/constants.ts +85 -0
  425. package/src/ui/helpers/focus.ts +100 -0
  426. package/src/ui/helpers/index.ts +5 -0
  427. package/src/ui/helpers/props.ts +10 -0
  428. package/src/ui/hooks/useArrayProp.ts +29 -0
  429. package/src/ui/hooks/useClickOutside.test.tsx +482 -0
  430. package/src/ui/hooks/useClickOutside.ts +117 -0
  431. package/src/ui/hooks/useClickOutsideEvent.test.tsx +115 -0
  432. package/src/ui/hooks/useClickOutsideEvent.ts +73 -0
  433. package/src/ui/hooks/useDelayed.test.ts +68 -0
  434. package/src/ui/hooks/useDelayedState.ts +28 -0
  435. package/src/ui/hooks/useElementRect/__workshop__/example.tsx +32 -0
  436. package/src/ui/hooks/useElementSize.ts +19 -0
  437. package/src/ui/hooks/useForwardedRef.ts +19 -0
  438. package/src/ui/hooks/useGlobalKeyDown.ts +17 -0
  439. package/src/ui/hooks/useMatchMedia.ts +28 -0
  440. package/src/ui/hooks/useMediaIndex/useMediaIndex.test.tsx +36 -0
  441. package/src/ui/hooks/useMediaIndex/useMediaIndex.ts +102 -0
  442. package/src/ui/hooks/usePrefersDark.hydration.test.tsx +56 -0
  443. package/src/ui/hooks/usePrefersDark.test.tsx +19 -0
  444. package/src/ui/hooks/usePrefersDark.ts +16 -0
  445. package/src/ui/hooks/usePrefersReducedMotion.hydration.test.tsx +56 -0
  446. package/src/ui/hooks/usePrefersReducedMotion.test.tsx +19 -0
  447. package/src/ui/hooks/usePrefersReducedMotion.ts +16 -0
  448. package/src/ui/index.ts +9 -0
  449. package/src/ui/lib/createGlobalScopedContext.ts +34 -0
  450. package/src/ui/lib/globalScope.ts +19 -0
  451. package/src/ui/primitives/_selectable/selectable.tsx +31 -0
  452. package/src/ui/primitives/avatar/__workshop__/asButton.tsx +14 -0
  453. package/src/ui/primitives/avatar/__workshop__/stack.tsx +25 -0
  454. package/src/ui/primitives/avatar/__workshop__/withinButton.tsx +63 -0
  455. package/src/ui/primitives/avatar/__workshop__/withinMenuItem.tsx +72 -0
  456. package/src/ui/primitives/avatar/avatar.tsx +158 -0
  457. package/src/ui/primitives/avatar/avatarCounter.tsx +62 -0
  458. package/src/ui/primitives/avatar/avatarStack.tsx +82 -0
  459. package/src/ui/primitives/avatar/types.ts +17 -0
  460. package/src/ui/primitives/badge/__workshop__/props.tsx +30 -0
  461. package/src/ui/primitives/badge/__workshop__/tones.tsx +21 -0
  462. package/src/ui/primitives/badge/badge.test.tsx +16 -0
  463. package/src/ui/primitives/badge/badge.tsx +64 -0
  464. package/src/ui/primitives/box/__workshop__/props.tsx +20 -0
  465. package/src/ui/primitives/box/box.tsx +162 -0
  466. package/src/ui/primitives/button/__workshop__/custom.tsx +50 -0
  467. package/src/ui/primitives/button/__workshop__/disabled.tsx +74 -0
  468. package/src/ui/primitives/button/__workshop__/props.tsx +58 -0
  469. package/src/ui/primitives/button/__workshop__/sanityUploadButton.tsx +36 -0
  470. package/src/ui/primitives/button/__workshop__/stacked.tsx +59 -0
  471. package/src/ui/primitives/button/__workshop__/styled1.tsx +17 -0
  472. package/src/ui/primitives/button/__workshop__/styled2.tsx +19 -0
  473. package/src/ui/primitives/button/button.test.tsx +44 -0
  474. package/src/ui/primitives/button/button.tsx +207 -0
  475. package/src/ui/primitives/card/__workshop__/allTones.tsx +27 -0
  476. package/src/ui/primitives/card/__workshop__/asButton.tsx +107 -0
  477. package/src/ui/primitives/card/__workshop__/asComponent.tsx +27 -0
  478. package/src/ui/primitives/card/__workshop__/checkered.tsx +26 -0
  479. package/src/ui/primitives/card/__workshop__/interactive.tsx +30 -0
  480. package/src/ui/primitives/card/__workshop__/listNavigation.tsx +80 -0
  481. package/src/ui/primitives/card/__workshop__/props.tsx +55 -0
  482. package/src/ui/primitives/card/__workshop__/selected.tsx +93 -0
  483. package/src/ui/primitives/card/__workshop__/styled.tsx +14 -0
  484. package/src/ui/primitives/card/card.tsx +118 -0
  485. package/src/ui/primitives/card/cardContext.ts +10 -0
  486. package/src/ui/primitives/card/cardProvider.tsx +19 -0
  487. package/src/ui/primitives/card/index.ts +4 -0
  488. package/src/ui/primitives/card/types.ts +27 -0
  489. package/src/ui/primitives/card/useCard.ts +7 -0
  490. package/src/ui/primitives/checkbox/__workshop__/tones.tsx +28 -0
  491. package/src/ui/primitives/checkbox/checkbox.tsx +74 -0
  492. package/src/ui/primitives/code/__workshop__/props.tsx +21 -0
  493. package/src/ui/primitives/code/code.tsx +49 -0
  494. package/src/ui/primitives/code/refractor.tsx +20 -0
  495. package/src/ui/primitives/container/__workshop__/example.tsx +20 -0
  496. package/src/ui/primitives/container/container.tsx +35 -0
  497. package/src/ui/primitives/flex/__workshop__/example.tsx +34 -0
  498. package/src/ui/primitives/flex/__workshop__/gap.tsx +25 -0
  499. package/src/ui/primitives/flex/flex.tsx +29 -0
  500. package/src/ui/primitives/grid/__workshop__/responsive.tsx +54 -0
  501. package/src/ui/primitives/grid/grid.tsx +30 -0
  502. package/src/ui/primitives/heading/__workshop__/opticalAlignment.tsx +54 -0
  503. package/src/ui/primitives/heading/__workshop__/plain.tsx +32 -0
  504. package/src/ui/primitives/heading/heading.tsx +62 -0
  505. package/src/ui/primitives/inline/__workshop__/plain.tsx +27 -0
  506. package/src/ui/primitives/inline/inline.tsx +50 -0
  507. package/src/ui/primitives/kbd/kbd.tsx +55 -0
  508. package/src/ui/primitives/label/__workshop__/opticalAlignment.tsx +54 -0
  509. package/src/ui/primitives/label/__workshop__/plain.tsx +37 -0
  510. package/src/ui/primitives/label/label.tsx +67 -0
  511. package/src/ui/primitives/popover/__workshop__/AlignedStory.tsx +77 -0
  512. package/src/ui/primitives/popover/__workshop__/MatchReferenceWidthStory.tsx +32 -0
  513. package/src/ui/primitives/popover/__workshop__/OpenOnMountStory.tsx +11 -0
  514. package/src/ui/primitives/popover/__workshop__/PlainStory.tsx +71 -0
  515. package/src/ui/primitives/popover/__workshop__/SidePanelStory.tsx +93 -0
  516. package/src/ui/primitives/popover/__workshop__/TestStory.tsx +98 -0
  517. package/src/ui/primitives/popover/floating-ui/size.ts +83 -0
  518. package/src/ui/primitives/popover/helpers.ts +32 -0
  519. package/src/ui/primitives/popover/popover.tsx +422 -0
  520. package/src/ui/primitives/popover/popoverCard.tsx +161 -0
  521. package/src/ui/primitives/radio/__workshop__/plain.tsx +28 -0
  522. package/src/ui/primitives/radio/radio.tsx +49 -0
  523. package/src/ui/primitives/select/__workshop__/plain.tsx +30 -0
  524. package/src/ui/primitives/select/__workshop__/readOnly.tsx +23 -0
  525. package/src/ui/primitives/select/select.tsx +85 -0
  526. package/src/ui/primitives/spinner/__workshop__/Props.tsx +16 -0
  527. package/src/ui/primitives/spinner/animatedSpinnerIcon.tsx +16 -0
  528. package/src/ui/primitives/spinner/spinner.tsx +33 -0
  529. package/src/ui/primitives/stack/__workshop__/plain.tsx +32 -0
  530. package/src/ui/primitives/stack/index.ts +1 -0
  531. package/src/ui/primitives/stack/stack.tsx +45 -0
  532. package/src/ui/primitives/switch/switch.tsx +75 -0
  533. package/src/ui/primitives/text/__workshop__/colored.tsx +23 -0
  534. package/src/ui/primitives/text/__workshop__/example.tsx +39 -0
  535. package/src/ui/primitives/text/__workshop__/opticalAlignment.tsx +48 -0
  536. package/src/ui/primitives/text/text.tsx +64 -0
  537. package/src/ui/primitives/textArea/__workshop__/plain.tsx +50 -0
  538. package/src/ui/primitives/textArea/textArea.tsx +71 -0
  539. package/src/ui/primitives/textInput/__workshop__/index.ts +44 -0
  540. package/src/ui/primitives/textInput/__workshop__/plain.tsx +104 -0
  541. package/src/ui/primitives/textInput/__workshop__/readOnly.tsx +9 -0
  542. package/src/ui/primitives/textInput/__workshop__/tones.tsx +277 -0
  543. package/src/ui/primitives/textInput/__workshop__/typed.tsx +23 -0
  544. package/src/ui/primitives/textInput/textInput.tsx +286 -0
  545. package/src/ui/primitives/tooltip/__workshop__/customPortal.tsx +102 -0
  546. package/src/ui/primitives/tooltip/__workshop__/overflowingBoundary.tsx +74 -0
  547. package/src/ui/primitives/tooltip/__workshop__/props.tsx +111 -0
  548. package/src/ui/primitives/tooltip/__workshop__/resizableBoundary.tsx +86 -0
  549. package/src/ui/primitives/tooltip/tooltip.test.tsx +453 -0
  550. package/src/ui/primitives/tooltip/tooltip.tsx +466 -0
  551. package/src/ui/primitives/tooltip/tooltipCard.tsx +115 -0
  552. package/src/ui/primitives/tooltip/tooltipDelayGroup/index.ts +4 -0
  553. package/src/ui/primitives/tooltip/tooltipDelayGroup/tooltipDelayGroupProvider.tsx +55 -0
  554. package/src/ui/primitives/tooltip/tooltipDelayGroup/types.ts +10 -0
  555. package/src/ui/primitives/tooltip/tooltipDelayGroup/useTooltipDelayGroup.ts +13 -0
  556. package/src/ui/primitives/types.ts +166 -0
  557. package/src/ui/types/box.ts +22 -0
  558. package/src/ui/types/button.ts +24 -0
  559. package/src/ui/types/flex.ts +27 -0
  560. package/src/ui/types/grid.ts +17 -0
  561. package/src/ui/types/gridItem.ts +32 -0
  562. package/src/ui/types/index.ts +15 -0
  563. package/src/ui/types/props.ts +18 -0
  564. package/src/ui/types/selectable.ts +7 -0
  565. package/src/ui/types/text.ts +7 -0
  566. package/src/ui/utils/arrow/arrow.tsx +59 -0
  567. package/src/ui/utils/boundaryElement/boundaryElement.test.tsx +100 -0
  568. package/src/ui/utils/boundaryElement/boundaryElementProvider.tsx +24 -0
  569. package/src/ui/utils/boundaryElement/index.ts +3 -0
  570. package/src/ui/utils/boundaryElement/useBoundaryElement.ts +26 -0
  571. package/src/ui/utils/conditionalWrapper/conditionalWrapper.tsx +23 -0
  572. package/src/ui/utils/elementQuery/__workshop__/customMedia.tsx +30 -0
  573. package/src/ui/utils/elementQuery/elementQuery.tsx +53 -0
  574. package/src/ui/utils/errorBoundary.tsx +48 -0
  575. package/src/ui/utils/getElementRef.ts +26 -0
  576. package/src/ui/utils/layer/__workshop__/multipleRoots.tsx +49 -0
  577. package/src/ui/utils/layer/__workshop__/nested.tsx +98 -0
  578. package/src/ui/utils/layer/__workshop__/responsiveZOffset.tsx +13 -0
  579. package/src/ui/utils/layer/index.ts +4 -0
  580. package/src/ui/utils/layer/layer.test.tsx +108 -0
  581. package/src/ui/utils/layer/layer.tsx +112 -0
  582. package/src/ui/utils/layer/layerProvider.tsx +110 -0
  583. package/src/ui/utils/layer/useLayer.ts +26 -0
  584. package/src/ui/utils/portal/portal.test.tsx +103 -0
  585. package/src/ui/utils/portal/portal.ts +46 -0
  586. package/src/ui/utils/portal/portalProvider.tsx +79 -0
  587. package/src/ui/utils/portal/usePortal.ts +25 -0
  588. package/src/ui/utils/spanWithTextOverflow.tsx +10 -0
  589. package/src/ui/utils/srOnly/index.ts +1 -0
  590. package/src/ui/utils/srOnly/srOnly.tsx +35 -0
  591. package/src/ui/utils/virtualList/virtualList.tsx +189 -0
  592. package/dist/_chunks-cjs/getTheme_v2.js +0 -316
  593. package/dist/_chunks-cjs/getTheme_v2.js.map +0 -1
  594. package/dist/_chunks-es/getTheme_v2.mjs +0 -317
  595. package/dist/_chunks-es/getTheme_v2.mjs.map +0 -1
  596. package/dist/_legacy/getTheme_v2.esm.js +0 -317
  597. package/dist/_legacy/getTheme_v2.esm.js.map +0 -1
  598. package/dist/css.esm.js +0 -3135
  599. package/dist/css.esm.js.map +0 -1
  600. package/dist/index.esm.js +0 -5843
  601. package/dist/index.esm.js.map +0 -1
  602. package/dist/theme.esm.js +0 -3088
  603. package/dist/theme.esm.js.map +0 -1
  604. package/src/core/__workshop__/constants.ts +0 -296
  605. package/src/core/__workshop__/fontsPlugin.tsx +0 -76
  606. package/src/core/_compat.ts +0 -264
  607. package/src/core/components/autocomplete/__mocks__/apiStore.ts +0 -49
  608. package/src/core/components/autocomplete/__workshop__/.eslintrc +0 -5
  609. package/src/core/components/autocomplete/__workshop__/async.tsx +0 -155
  610. package/src/core/components/autocomplete/__workshop__/constrainedHeight.tsx +0 -136
  611. package/src/core/components/autocomplete/__workshop__/custom.tsx +0 -88
  612. package/src/core/components/autocomplete/__workshop__/example.tsx +0 -78
  613. package/src/core/components/autocomplete/__workshop__/fullscreen.tsx +0 -293
  614. package/src/core/components/autocomplete/autocomplete.styles.tsx +0 -38
  615. package/src/core/components/autocomplete/autocomplete.tsx +0 -735
  616. package/src/core/components/autocomplete/autocompleteOption.tsx +0 -44
  617. package/src/core/components/autocomplete/types.ts +0 -108
  618. package/src/core/components/breadcrumbs/__workshop__/.eslintrc +0 -5
  619. package/src/core/components/breadcrumbs/__workshop__/example.tsx +0 -55
  620. package/src/core/components/breadcrumbs/breadcrumbs.styles.ts +0 -17
  621. package/src/core/components/breadcrumbs/breadcrumbs.tsx +0 -111
  622. package/src/core/components/dialog/__workshop__/.eslintrc +0 -5
  623. package/src/core/components/dialog/__workshop__/activate.tsx +0 -133
  624. package/src/core/components/dialog/__workshop__/nested.tsx +0 -72
  625. package/src/core/components/dialog/__workshop__/onScroll.tsx +0 -39
  626. package/src/core/components/dialog/__workshop__/panes.tsx +0 -81
  627. package/src/core/components/dialog/__workshop__/position.tsx +0 -29
  628. package/src/core/components/dialog/__workshop__/props.tsx +0 -74
  629. package/src/core/components/dialog/__workshop__/wrapped.tsx +0 -78
  630. package/src/core/components/dialog/dialog.tsx +0 -414
  631. package/src/core/components/dialog/dialogProvider.tsx +0 -34
  632. package/src/core/components/dialog/useDialog.ts +0 -10
  633. package/src/core/components/hotkeys/__workshop__/.eslintrc +0 -5
  634. package/src/core/components/hotkeys/hotkeys.tsx +0 -50
  635. package/src/core/components/menu/__workshop__/.eslintrc +0 -5
  636. package/src/core/components/menu/__workshop__/asComponent.tsx +0 -44
  637. package/src/core/components/menu/__workshop__/avatarMenu.tsx +0 -50
  638. package/src/core/components/menu/__workshop__/constrainedInBoundary.tsx +0 -133
  639. package/src/core/components/menu/__workshop__/customSelectedState.tsx +0 -38
  640. package/src/core/components/menu/__workshop__/menuButton.tsx +0 -79
  641. package/src/core/components/menu/__workshop__/shouldFocus.tsx +0 -46
  642. package/src/core/components/menu/__workshop__/tones.tsx +0 -25
  643. package/src/core/components/menu/menu.test.tsx +0 -129
  644. package/src/core/components/menu/menu.tsx +0 -175
  645. package/src/core/components/menu/menuButton.tsx +0 -289
  646. package/src/core/components/menu/menuContext.ts +0 -29
  647. package/src/core/components/menu/menuDivider.ts +0 -13
  648. package/src/core/components/menu/menuGroup.tsx +0 -210
  649. package/src/core/components/menu/menuItem.tsx +0 -187
  650. package/src/core/components/menu/useMenu.ts +0 -20
  651. package/src/core/components/menu/useMenuController.ts +0 -230
  652. package/src/core/components/skeleton/__workshop__/.eslintrc +0 -5
  653. package/src/core/components/skeleton/__workshop__/delay.tsx +0 -69
  654. package/src/core/components/skeleton/__workshop__/skeleton.tsx +0 -63
  655. package/src/core/components/skeleton/skeleton.tsx +0 -58
  656. package/src/core/components/skeleton/styles.ts +0 -50
  657. package/src/core/components/skeleton/textSkeleton.tsx +0 -122
  658. package/src/core/components/tab/__workshop__/.eslintrc +0 -5
  659. package/src/core/components/tab/tab.tsx +0 -99
  660. package/src/core/components/tab/tabList.tsx +0 -78
  661. package/src/core/components/tab/tabPanel.tsx +0 -38
  662. package/src/core/components/toast/__workshop__/.eslintrc +0 -5
  663. package/src/core/components/toast/__workshop__/hook.tsx +0 -71
  664. package/src/core/components/toast/__workshop__/toast.tsx +0 -25
  665. package/src/core/components/toast/styles.ts +0 -61
  666. package/src/core/components/toast/toast.test.tsx +0 -102
  667. package/src/core/components/toast/toast.tsx +0 -109
  668. package/src/core/components/toast/toastProvider.tsx +0 -202
  669. package/src/core/components/toast/types.ts +0 -20
  670. package/src/core/components/toast/useToast.ts +0 -24
  671. package/src/core/components/tree/__workshop__/.eslintrc +0 -5
  672. package/src/core/components/tree/__workshop__/basic.tsx +0 -104
  673. package/src/core/components/tree/__workshop__/tabFromElement.tsx +0 -83
  674. package/src/core/components/tree/style.ts +0 -104
  675. package/src/core/components/tree/tree.tsx +0 -242
  676. package/src/core/components/tree/treeGroup.tsx +0 -29
  677. package/src/core/components/tree/treeItem.tsx +0 -217
  678. package/src/core/components/tree/useTree.ts +0 -16
  679. package/src/core/constants.ts +0 -57
  680. package/src/core/helpers/focus.ts +0 -100
  681. package/src/core/helpers/index.ts +0 -4
  682. package/src/core/hooks/useArrayProp.ts +0 -25
  683. package/src/core/hooks/useClickOutside.test.tsx +0 -483
  684. package/src/core/hooks/useClickOutside.ts +0 -116
  685. package/src/core/hooks/useClickOutsideEvent.test.tsx +0 -116
  686. package/src/core/hooks/useClickOutsideEvent.ts +0 -72
  687. package/src/core/hooks/useDelayed.test.ts +0 -67
  688. package/src/core/hooks/useDelayedState.ts +0 -29
  689. package/src/core/hooks/useElementRect/__workshop__/.eslintrc +0 -5
  690. package/src/core/hooks/useElementRect/__workshop__/example.tsx +0 -31
  691. package/src/core/hooks/useElementSize.ts +0 -18
  692. package/src/core/hooks/useForwardedRef.ts +0 -19
  693. package/src/core/hooks/useGlobalKeyDown.ts +0 -12
  694. package/src/core/hooks/useMatchMedia.ts +0 -46
  695. package/src/core/hooks/useMediaIndex/__workshop__/.eslintrc +0 -5
  696. package/src/core/hooks/useMediaIndex/useMediaIndex.test.tsx +0 -35
  697. package/src/core/hooks/useMediaIndex/useMediaIndex.ts +0 -101
  698. package/src/core/hooks/usePrefersDark.hydration.test.tsx +0 -57
  699. package/src/core/hooks/usePrefersDark.test.tsx +0 -18
  700. package/src/core/hooks/usePrefersDark.ts +0 -16
  701. package/src/core/hooks/usePrefersReducedMotion.hydration.test.tsx +0 -57
  702. package/src/core/hooks/usePrefersReducedMotion.test.tsx +0 -18
  703. package/src/core/hooks/usePrefersReducedMotion.ts +0 -16
  704. package/src/core/index.ts +0 -11
  705. package/src/core/lib/createGlobalScopedContext.ts +0 -33
  706. package/src/core/lib/globalScope.ts +0 -20
  707. package/src/core/lib/styled/elements.ts +0 -135
  708. package/src/core/lib/styled/index.ts +0 -2
  709. package/src/core/lib/styled/members.ts +0 -15
  710. package/src/core/lib/styled/styled.ts +0 -79
  711. package/src/core/primitives/_selectable/selectable.tsx +0 -27
  712. package/src/core/primitives/avatar/__workshop__/.eslintrc +0 -5
  713. package/src/core/primitives/avatar/__workshop__/asButton.tsx +0 -13
  714. package/src/core/primitives/avatar/__workshop__/stack.tsx +0 -24
  715. package/src/core/primitives/avatar/__workshop__/withinButton.tsx +0 -62
  716. package/src/core/primitives/avatar/__workshop__/withinMenuItem.tsx +0 -69
  717. package/src/core/primitives/avatar/avatar.tsx +0 -217
  718. package/src/core/primitives/avatar/avatarCounter.tsx +0 -93
  719. package/src/core/primitives/avatar/avatarStack.tsx +0 -100
  720. package/src/core/primitives/avatar/styles.ts +0 -166
  721. package/src/core/primitives/avatar/types.ts +0 -16
  722. package/src/core/primitives/badge/__workshop__/.eslintrc +0 -5
  723. package/src/core/primitives/badge/__workshop__/props.tsx +0 -29
  724. package/src/core/primitives/badge/__workshop__/tones.tsx +0 -20
  725. package/src/core/primitives/badge/badge.test.tsx +0 -15
  726. package/src/core/primitives/badge/badge.tsx +0 -59
  727. package/src/core/primitives/badge/styles.ts +0 -19
  728. package/src/core/primitives/box/__workshop__/.eslintrc +0 -5
  729. package/src/core/primitives/box/__workshop__/props.tsx +0 -19
  730. package/src/core/primitives/box/box.tsx +0 -118
  731. package/src/core/primitives/button/__workshop__/.eslintrc +0 -5
  732. package/src/core/primitives/button/__workshop__/custom.tsx +0 -47
  733. package/src/core/primitives/button/__workshop__/disabled.tsx +0 -73
  734. package/src/core/primitives/button/__workshop__/props.tsx +0 -52
  735. package/src/core/primitives/button/__workshop__/sanityUploadButton.tsx +0 -36
  736. package/src/core/primitives/button/__workshop__/stacked.tsx +0 -57
  737. package/src/core/primitives/button/__workshop__/styled1.tsx +0 -17
  738. package/src/core/primitives/button/__workshop__/styled2.tsx +0 -19
  739. package/src/core/primitives/button/button.test.tsx +0 -43
  740. package/src/core/primitives/button/button.tsx +0 -181
  741. package/src/core/primitives/button/styles.ts +0 -116
  742. package/src/core/primitives/card/RootCardContext.ts +0 -3
  743. package/src/core/primitives/card/__workshop__/.eslintrc +0 -5
  744. package/src/core/primitives/card/__workshop__/allTones.tsx +0 -27
  745. package/src/core/primitives/card/__workshop__/asButton.tsx +0 -88
  746. package/src/core/primitives/card/__workshop__/asComponent.tsx +0 -27
  747. package/src/core/primitives/card/__workshop__/checkered.tsx +0 -16
  748. package/src/core/primitives/card/__workshop__/interactive.tsx +0 -23
  749. package/src/core/primitives/card/__workshop__/listNavigation.tsx +0 -77
  750. package/src/core/primitives/card/__workshop__/props.tsx +0 -49
  751. package/src/core/primitives/card/__workshop__/selected.tsx +0 -91
  752. package/src/core/primitives/card/__workshop__/styled.tsx +0 -14
  753. package/src/core/primitives/card/card.tsx +0 -113
  754. package/src/core/primitives/card/index.ts +0 -2
  755. package/src/core/primitives/card/styles.ts +0 -146
  756. package/src/core/primitives/card/types.ts +0 -11
  757. package/src/core/primitives/checkbox/__workshop__/.eslintrc +0 -5
  758. package/src/core/primitives/checkbox/__workshop__/tones.tsx +0 -22
  759. package/src/core/primitives/checkbox/checkbox.tsx +0 -70
  760. package/src/core/primitives/code/__workshop__/.eslintrc +0 -5
  761. package/src/core/primitives/code/__workshop__/props.tsx +0 -20
  762. package/src/core/primitives/code/code.tsx +0 -51
  763. package/src/core/primitives/code/styles.ts +0 -77
  764. package/src/core/primitives/container/__workshop__/.eslintrc +0 -5
  765. package/src/core/primitives/container/__workshop__/example.tsx +0 -19
  766. package/src/core/primitives/container/container.tsx +0 -32
  767. package/src/core/primitives/container/styles.ts +0 -22
  768. package/src/core/primitives/flex/__workshop__/.eslintrc +0 -5
  769. package/src/core/primitives/flex/__workshop__/example.tsx +0 -33
  770. package/src/core/primitives/flex/__workshop__/gap.tsx +0 -25
  771. package/src/core/primitives/flex/flex.tsx +0 -44
  772. package/src/core/primitives/grid/__workshop__/.eslintrc +0 -5
  773. package/src/core/primitives/grid/__workshop__/responsive.tsx +0 -54
  774. package/src/core/primitives/grid/grid.tsx +0 -48
  775. package/src/core/primitives/heading/__workshop__/.eslintrc +0 -5
  776. package/src/core/primitives/heading/__workshop__/opticalAlignment.tsx +0 -66
  777. package/src/core/primitives/heading/__workshop__/plain.tsx +0 -31
  778. package/src/core/primitives/heading/heading.tsx +0 -99
  779. package/src/core/primitives/heading/styles.ts +0 -63
  780. package/src/core/primitives/heading/types.ts +0 -7
  781. package/src/core/primitives/inline/__workshop__/.eslintrc +0 -5
  782. package/src/core/primitives/inline/__workshop__/plain.tsx +0 -26
  783. package/src/core/primitives/inline/inline.tsx +0 -56
  784. package/src/core/primitives/inline/styles.ts +0 -31
  785. package/src/core/primitives/kbd/__workshop__/.eslintrc +0 -5
  786. package/src/core/primitives/kbd/kbd.tsx +0 -53
  787. package/src/core/primitives/label/__workshop__/.eslintrc +0 -5
  788. package/src/core/primitives/label/__workshop__/opticalAlignment.tsx +0 -48
  789. package/src/core/primitives/label/__workshop__/plain.tsx +0 -23
  790. package/src/core/primitives/label/label.tsx +0 -96
  791. package/src/core/primitives/label/styles.ts +0 -44
  792. package/src/core/primitives/popover/__workshop__/.eslintrc +0 -5
  793. package/src/core/primitives/popover/__workshop__/AlignedStory.tsx +0 -76
  794. package/src/core/primitives/popover/__workshop__/MatchReferenceWidthStory.tsx +0 -31
  795. package/src/core/primitives/popover/__workshop__/OpenOnMountStory.tsx +0 -11
  796. package/src/core/primitives/popover/__workshop__/PlainStory.tsx +0 -70
  797. package/src/core/primitives/popover/__workshop__/SidePanelStory.tsx +0 -86
  798. package/src/core/primitives/popover/__workshop__/TestStory.tsx +0 -96
  799. package/src/core/primitives/popover/floating-ui/size.ts +0 -82
  800. package/src/core/primitives/popover/helpers.ts +0 -31
  801. package/src/core/primitives/popover/popover.tsx +0 -476
  802. package/src/core/primitives/popover/popoverCard.tsx +0 -153
  803. package/src/core/primitives/radio/__workshop__/.eslintrc +0 -5
  804. package/src/core/primitives/radio/__workshop__/plain.tsx +0 -28
  805. package/src/core/primitives/radio/radio.tsx +0 -50
  806. package/src/core/primitives/radio/styles.ts +0 -116
  807. package/src/core/primitives/select/__workshop__/.eslintrc +0 -5
  808. package/src/core/primitives/select/__workshop__/plain.tsx +0 -27
  809. package/src/core/primitives/select/__workshop__/readOnly.tsx +0 -23
  810. package/src/core/primitives/select/select.tsx +0 -86
  811. package/src/core/primitives/select/styles.ts +0 -166
  812. package/src/core/primitives/spinner/__workshop__/.eslintrc +0 -5
  813. package/src/core/primitives/spinner/__workshop__/Props.tsx +0 -14
  814. package/src/core/primitives/spinner/spinner.tsx +0 -31
  815. package/src/core/primitives/stack/__workshop__/.eslintrc +0 -5
  816. package/src/core/primitives/stack/__workshop__/plain.tsx +0 -31
  817. package/src/core/primitives/stack/stack.tsx +0 -41
  818. package/src/core/primitives/stack/styles.ts +0 -31
  819. package/src/core/primitives/switch/__workshop__/.eslintrc +0 -5
  820. package/src/core/primitives/switch/styles.ts +0 -172
  821. package/src/core/primitives/switch/switch.tsx +0 -66
  822. package/src/core/primitives/text/__workshop__/.eslintrc +0 -5
  823. package/src/core/primitives/text/__workshop__/colored.tsx +0 -29
  824. package/src/core/primitives/text/__workshop__/example.tsx +0 -38
  825. package/src/core/primitives/text/__workshop__/opticalAlignment.tsx +0 -58
  826. package/src/core/primitives/text/styles.ts +0 -73
  827. package/src/core/primitives/text/text.tsx +0 -85
  828. package/src/core/primitives/textArea/__workshop__/.eslintrc +0 -5
  829. package/src/core/primitives/textArea/__workshop__/plain.tsx +0 -49
  830. package/src/core/primitives/textArea/textArea.tsx +0 -118
  831. package/src/core/primitives/textInput/__workshop__/.eslintrc +0 -5
  832. package/src/core/primitives/textInput/__workshop__/index.ts +0 -49
  833. package/src/core/primitives/textInput/__workshop__/multipleTones.tsx +0 -20
  834. package/src/core/primitives/textInput/__workshop__/plain.tsx +0 -98
  835. package/src/core/primitives/textInput/__workshop__/readOnly.tsx +0 -5
  836. package/src/core/primitives/textInput/__workshop__/tones.tsx +0 -239
  837. package/src/core/primitives/textInput/__workshop__/typed.tsx +0 -22
  838. package/src/core/primitives/textInput/textInput.tsx +0 -440
  839. package/src/core/primitives/tooltip/__workshop__/.eslintrc +0 -5
  840. package/src/core/primitives/tooltip/__workshop__/customPortal.tsx +0 -101
  841. package/src/core/primitives/tooltip/__workshop__/overflowingBoundary.tsx +0 -73
  842. package/src/core/primitives/tooltip/__workshop__/props.tsx +0 -106
  843. package/src/core/primitives/tooltip/__workshop__/resizableBoundary.tsx +0 -85
  844. package/src/core/primitives/tooltip/tooltip.test.tsx +0 -451
  845. package/src/core/primitives/tooltip/tooltip.tsx +0 -464
  846. package/src/core/primitives/tooltip/tooltipCard.tsx +0 -110
  847. package/src/core/primitives/tooltip/tooltipDelayGroup/index.ts +0 -4
  848. package/src/core/primitives/tooltip/tooltipDelayGroup/tooltipDelayGroupProvider.tsx +0 -57
  849. package/src/core/primitives/tooltip/tooltipDelayGroup/types.ts +0 -11
  850. package/src/core/primitives/tooltip/tooltipDelayGroup/useTooltipDelayGroup.ts +0 -12
  851. package/src/core/primitives/types.ts +0 -165
  852. package/src/core/styles/border/borderStyle.ts +0 -61
  853. package/src/core/styles/border/index.ts +0 -2
  854. package/src/core/styles/border/types.ts +0 -11
  855. package/src/core/styles/box/boxStyle.ts +0 -74
  856. package/src/core/styles/box/index.ts +0 -2
  857. package/src/core/styles/box/types.ts +0 -11
  858. package/src/core/styles/card/_cardColorStyle.ts +0 -101
  859. package/src/core/styles/card/index.ts +0 -1
  860. package/src/core/styles/flex/flexItemStyle.ts +0 -26
  861. package/src/core/styles/flex/flexStyle.ts +0 -69
  862. package/src/core/styles/flex/index.ts +0 -3
  863. package/src/core/styles/flex/types.ts +0 -24
  864. package/src/core/styles/focusRing/index.ts +0 -25
  865. package/src/core/styles/font/codeFontStyle.ts +0 -12
  866. package/src/core/styles/font/headingFontStyle.ts +0 -12
  867. package/src/core/styles/font/index.ts +0 -6
  868. package/src/core/styles/font/labelFontStyle.ts +0 -12
  869. package/src/core/styles/font/responsiveFont.ts +0 -101
  870. package/src/core/styles/font/textAlignStyle.ts +0 -18
  871. package/src/core/styles/font/textFontStyle.ts +0 -12
  872. package/src/core/styles/font/types.ts +0 -34
  873. package/src/core/styles/grid/gridItemStyle.ts +0 -81
  874. package/src/core/styles/grid/gridStyle.ts +0 -97
  875. package/src/core/styles/grid/index.ts +0 -3
  876. package/src/core/styles/grid/types.ts +0 -37
  877. package/src/core/styles/helpers.ts +0 -81
  878. package/src/core/styles/index.ts +0 -5
  879. package/src/core/styles/input/index.ts +0 -2
  880. package/src/core/styles/input/responsiveInputPaddingStyle.ts +0 -77
  881. package/src/core/styles/input/textInputStyle.ts +0 -263
  882. package/src/core/styles/internal.ts +0 -12
  883. package/src/core/styles/margin/index.ts +0 -2
  884. package/src/core/styles/margin/marginStyle.ts +0 -20
  885. package/src/core/styles/margin/marginsStyle.test.ts +0 -32
  886. package/src/core/styles/margin/types.ts +0 -9
  887. package/src/core/styles/padding/index.ts +0 -2
  888. package/src/core/styles/padding/paddingStyle.test.ts +0 -32
  889. package/src/core/styles/padding/paddingStyle.ts +0 -20
  890. package/src/core/styles/padding/types.ts +0 -12
  891. package/src/core/styles/radius/index.ts +0 -2
  892. package/src/core/styles/radius/radiusStyle.ts +0 -22
  893. package/src/core/styles/radius/types.ts +0 -8
  894. package/src/core/styles/shadow/index.ts +0 -2
  895. package/src/core/styles/shadow/shadowStyle.ts +0 -29
  896. package/src/core/styles/shadow/types.ts +0 -6
  897. package/src/core/styles/types.ts +0 -8
  898. package/src/core/theme/__workshop__/.eslintrc +0 -5
  899. package/src/core/theme/__workshop__/build/Root.tsx +0 -367
  900. package/src/core/theme/__workshop__/build/helpers.ts +0 -46
  901. package/src/core/theme/__workshop__/build/story.tsx +0 -459
  902. package/src/core/theme/__workshop__/canvas.tsx +0 -350
  903. package/src/core/theme/__workshop__/color.tsx +0 -62
  904. package/src/core/theme/__workshop__/debug/story.tsx +0 -401
  905. package/src/core/theme/__workshop__/index.ts +0 -39
  906. package/src/core/theme/__workshop__/layer.tsx +0 -78
  907. package/src/core/theme/__workshop__/nestedProvider.tsx +0 -15
  908. package/src/core/theme/index.ts +0 -5
  909. package/src/core/theme/theme.test.tsx +0 -73
  910. package/src/core/theme/themeColorProvider.tsx +0 -28
  911. package/src/core/theme/themeContext.ts +0 -10
  912. package/src/core/theme/themeProvider.tsx +0 -63
  913. package/src/core/theme/useRootTheme.ts +0 -16
  914. package/src/core/theme/useTheme.ts +0 -16
  915. package/src/core/types/box.ts +0 -19
  916. package/src/core/types/button.ts +0 -22
  917. package/src/core/types/flex.ts +0 -31
  918. package/src/core/types/grid.ts +0 -14
  919. package/src/core/types/gridItem.ts +0 -37
  920. package/src/core/types/index.ts +0 -14
  921. package/src/core/types/selectable.ts +0 -6
  922. package/src/core/types/text.ts +0 -4
  923. package/src/core/utils/arrow/arrow.tsx +0 -122
  924. package/src/core/utils/boundaryElement/__workshop__/.eslintrc +0 -5
  925. package/src/core/utils/boundaryElement/boundaryElement.test.tsx +0 -101
  926. package/src/core/utils/boundaryElement/boundaryElementProvider.tsx +0 -23
  927. package/src/core/utils/boundaryElement/index.ts +0 -3
  928. package/src/core/utils/boundaryElement/useBoundaryElement.ts +0 -25
  929. package/src/core/utils/conditionalWrapper/conditionalWrapper.tsx +0 -21
  930. package/src/core/utils/elementQuery/__workshop__/.eslintrc +0 -5
  931. package/src/core/utils/elementQuery/__workshop__/customMedia.tsx +0 -30
  932. package/src/core/utils/elementQuery/elementQuery.tsx +0 -53
  933. package/src/core/utils/errorBoundary.tsx +0 -47
  934. package/src/core/utils/layer/__workshop__/.eslintrc +0 -5
  935. package/src/core/utils/layer/__workshop__/multipleRoots.tsx +0 -48
  936. package/src/core/utils/layer/__workshop__/nested.tsx +0 -97
  937. package/src/core/utils/layer/__workshop__/responsiveZOffset.tsx +0 -12
  938. package/src/core/utils/layer/index.ts +0 -4
  939. package/src/core/utils/layer/layer.test.tsx +0 -109
  940. package/src/core/utils/layer/layer.tsx +0 -108
  941. package/src/core/utils/layer/layerProvider.tsx +0 -109
  942. package/src/core/utils/layer/useLayer.ts +0 -25
  943. package/src/core/utils/portal/__workshop__/.eslintrc +0 -5
  944. package/src/core/utils/portal/portal.test.tsx +0 -104
  945. package/src/core/utils/portal/portal.ts +0 -31
  946. package/src/core/utils/portal/portalProvider.tsx +0 -78
  947. package/src/core/utils/portal/usePortal.ts +0 -24
  948. package/src/core/utils/srOnly/srOnly.tsx +0 -36
  949. package/src/core/utils/virtualList/__workshop__/.eslintrc +0 -5
  950. package/src/core/utils/virtualList/virtualList.tsx +0 -170
  951. package/src/css/cli/buildCommand.ts +0 -36
  952. package/src/css/cli/index.ts +0 -38
  953. package/src/css/compile/comileRules.ts +0 -59
  954. package/src/css/components/dialog/classes.ts +0 -29
  955. package/src/css/primitives/badge/rules.ts +0 -25
  956. package/src/css/primitives/box/rules.ts +0 -25
  957. package/src/css/primitives/card/rules.ts +0 -93
  958. package/src/css/primitives/selectable/__style.ts +0 -115
  959. package/src/css/primitives/selectable/rules.ts +0 -27
  960. package/src/css/primitives/selectable/selectable.ts +0 -9
  961. package/src/css/primitives/selectable/types.ts +0 -6
  962. package/src/css/rules.ts +0 -121
  963. package/src/css/styles/border/border.ts +0 -22
  964. package/src/css/styles/border/rules.ts +0 -24
  965. package/src/css/styles/display/rules.ts +0 -62
  966. package/src/css/styles/flex/flex.ts +0 -20
  967. package/src/css/styles/flex/rules.ts +0 -28
  968. package/src/css/styles/flexItem/flexItem.ts +0 -8
  969. package/src/css/styles/flexItem/rules.ts +0 -11
  970. package/src/css/styles/flexItem/types.ts +0 -11
  971. package/src/css/styles/font/font.ts +0 -12
  972. package/src/css/styles/font/rules.ts +0 -125
  973. package/src/css/styles/font/types.ts +0 -6
  974. package/src/css/styles/gap/gap.ts +0 -8
  975. package/src/css/styles/gap/rules.ts +0 -33
  976. package/src/css/styles/gap/types.ts +0 -9
  977. package/src/css/styles/grid/rules.ts +0 -35
  978. package/src/css/styles/gridItem/gridItem.ts +0 -15
  979. package/src/css/styles/gridItem/rules.ts +0 -96
  980. package/src/css/styles/margin/margin.ts +0 -15
  981. package/src/css/styles/margin/rules.ts +0 -59
  982. package/src/css/styles/maxWidth/rules.ts +0 -36
  983. package/src/css/styles/maxWidth/types.ts +0 -6
  984. package/src/css/styles/overflow/rules.ts +0 -9
  985. package/src/css/styles/padding/padding.ts +0 -15
  986. package/src/css/styles/padding/rules.ts +0 -59
  987. package/src/css/styles/padding/types.ts +0 -12
  988. package/src/css/styles/pointerEvents/pointerEvents.ts +0 -6
  989. package/src/css/styles/pointerEvents/rules.ts +0 -11
  990. package/src/css/styles/position/position.ts +0 -7
  991. package/src/css/styles/position/rules.ts +0 -31
  992. package/src/css/styles/position/types.ts +0 -13
  993. package/src/css/styles/radius/radius.ts +0 -8
  994. package/src/css/styles/radius/rules.ts +0 -13
  995. package/src/css/styles/radius/types.ts +0 -7
  996. package/src/css/styles/shadow/rules.ts +0 -53
  997. package/src/css/styles/width/index.ts +0 -2
  998. package/src/css/styles/width/rules.ts +0 -7
  999. package/src/css/styles/width/types.ts +0 -8
  1000. package/src/theme/system/_constants.ts +0 -25
  1001. package/src/theme/system/_types.ts +0 -41
  1002. package/src/theme/system/avatar.ts +0 -14
  1003. package/src/theme/system/color/_constants.ts +0 -41
  1004. package/src/theme/system/color/_helpers.ts +0 -23
  1005. package/src/theme/system/color/_system.ts +0 -40
  1006. package/src/theme/system/color/badge.ts +0 -20
  1007. package/src/theme/system/color/color.ts +0 -34
  1008. package/src/theme/system/css.ts +0 -9
  1009. package/src/theme/system/font.ts +0 -52
  1010. package/src/theme/system/index.ts +0 -14
  1011. package/src/theme/system/input.ts +0 -33
  1012. package/src/theme/system/theme.ts +0 -138
  1013. package/src/theme/system/v0/color/_generic.ts +0 -35
  1014. package/src/theme/system/v0/color/_system.ts +0 -13
  1015. package/src/theme/system/v0/color/color.ts +0 -39
  1016. package/src/theme/system/v0/color/index.ts +0 -11
  1017. package/src/theme/system/v0/color/input.ts +0 -34
  1018. package/src/theme/system/v0/color/spot.ts +0 -13
  1019. package/src/theme/system/v0/index.ts +0 -3
  1020. package/theme.js +0 -2
  1021. /package/src/css/{styles → aspects}/border/index.ts +0 -0
  1022. /package/src/css/{styles → aspects}/border/types.ts +0 -0
  1023. /package/src/css/{styles → aspects}/flex/index.ts +0 -0
  1024. /package/src/css/{styles → aspects}/flex/types.ts +0 -0
  1025. /package/src/css/{styles → aspects}/flexItem/index.ts +0 -0
  1026. /package/src/css/{styles → aspects}/font/index.ts +0 -0
  1027. /package/src/css/{styles → aspects}/gap/index.ts +0 -0
  1028. /package/src/css/{styles → aspects}/gridItem/index.ts +0 -0
  1029. /package/src/css/{styles → aspects}/gridItem/types.ts +0 -0
  1030. /package/src/css/{styles → aspects}/height/rules.ts +0 -0
  1031. /package/src/css/{styles → aspects}/margin/index.ts +0 -0
  1032. /package/src/css/{styles → aspects}/margin/types.ts +0 -0
  1033. /package/src/css/{styles → aspects}/maxWidth/index.ts +0 -0
  1034. /package/src/css/{styles → aspects}/maxWidth/maxWidth.ts +0 -0
  1035. /package/src/css/{styles → aspects}/padding/index.ts +0 -0
  1036. /package/src/css/{styles → aspects}/pointerEvents/index.ts +0 -0
  1037. /package/src/css/{styles → aspects}/pointerEvents/types.ts +0 -0
  1038. /package/src/css/{styles → aspects}/position/index.ts +0 -0
  1039. /package/src/css/{styles → aspects}/radius/index.ts +0 -0
  1040. /package/src/css/{styles → aspects}/width/width.ts +0 -0
  1041. /package/src/css/primitives/{selectable → _selectable}/index.ts +0 -0
  1042. /package/src/{core → css}/primitives/stack/index.ts +0 -0
  1043. /package/src/{core → css}/utils/srOnly/index.ts +0 -0
  1044. /package/src/theme/{system/v0 → v0}/avatar.ts +0 -0
  1045. /package/src/theme/{system/v0 → v0}/color/base.ts +0 -0
  1046. /package/src/theme/{system/v0 → v0}/color/button.ts +0 -0
  1047. /package/src/theme/{system/v0 → v0}/color/card.ts +0 -0
  1048. /package/src/theme/{system/v0 → v0}/color/muted.ts +0 -0
  1049. /package/src/theme/{system/v0 → v0}/color/selectable.ts +0 -0
  1050. /package/src/theme/{system/v0 → v0}/color/solid.ts +0 -0
  1051. /package/src/theme/{system → v0}/focusRing.ts +0 -0
  1052. /package/src/theme/{system/v0 → v0}/input.ts +0 -0
  1053. /package/src/theme/{system → v0}/layer.ts +0 -0
  1054. /package/src/theme/{system → v0}/shadow.ts +0 -0
  1055. /package/src/theme/{system → v0}/styles.ts +0 -0
  1056. /package/src/theme/{system → v2}/color/avatar.ts +0 -0
  1057. /package/src/theme/{system → v2}/color/button.ts +0 -0
  1058. /package/src/theme/{system → v2}/color/index.ts +0 -0
  1059. /package/src/theme/{system → v2}/color/input.ts +0 -0
  1060. /package/src/theme/{system → v2}/color/kbd.ts +0 -0
  1061. /package/src/theme/{system → v2}/color/selectable.ts +0 -0
  1062. /package/src/theme/{system → v2}/color/shadow.ts +0 -0
  1063. /package/src/theme/{system → v2}/color/state.ts +0 -0
  1064. /package/src/theme/{system → v2}/color/syntax.ts +0 -0
  1065. /package/src/{core → ui/_compat}/theme/types.ts +0 -0
  1066. /package/src/{core/components/autocomplete/__fixtures__ → ui/components/autocomplete/__mocks__}/countries.ts +0 -0
  1067. /package/src/{core → ui}/components/autocomplete/__workshop__/focusAndBlur.tsx +0 -0
  1068. /package/src/{core → ui}/components/autocomplete/__workshop__/index.ts +0 -0
  1069. /package/src/{core → ui}/components/autocomplete/__workshop__/types.ts +0 -0
  1070. /package/src/{core → ui}/components/autocomplete/autocompleteReducer.ts +0 -0
  1071. /package/src/{core → ui}/components/autocomplete/constants.ts +0 -0
  1072. /package/src/{core → ui}/components/autocomplete/index.ts +0 -0
  1073. /package/src/{core → ui}/components/breadcrumbs/__workshop__/index.ts +0 -0
  1074. /package/src/{core → ui}/components/breadcrumbs/index.ts +0 -0
  1075. /package/src/{core → ui}/components/dialog/__workshop__/autoFocus.tsx +0 -0
  1076. /package/src/{core → ui}/components/dialog/__workshop__/index.ts +0 -0
  1077. /package/src/{core → ui}/components/dialog/__workshop__/layering.tsx +0 -0
  1078. /package/src/{core → ui}/components/dialog/__workshop__/provider.tsx +0 -0
  1079. /package/src/{core → ui}/components/dialog/dialogContext.ts +0 -0
  1080. /package/src/{core → ui}/components/dialog/index.ts +0 -0
  1081. /package/src/{core → ui}/components/hotkeys/__workshop__/index.ts +0 -0
  1082. /package/src/{core → ui}/components/hotkeys/__workshop__/plain.tsx +0 -0
  1083. /package/src/{core → ui}/components/hotkeys/index.ts +0 -0
  1084. /package/src/{core → ui}/components/index.ts +0 -0
  1085. /package/src/{core → ui}/components/menu/__workshop__/closableMenuButton.tsx +0 -0
  1086. /package/src/{core → ui}/components/menu/__workshop__/customMenuItem.tsx +0 -0
  1087. /package/src/{core → ui}/components/menu/__workshop__/disableFocusOnClose.tsx +0 -0
  1088. /package/src/{core → ui}/components/menu/__workshop__/groups.tsx +0 -0
  1089. /package/src/{core → ui}/components/menu/__workshop__/index.ts +0 -0
  1090. /package/src/{core → ui}/components/menu/__workshop__/menuGroupRight.tsx +0 -0
  1091. /package/src/{core → ui}/components/menu/__workshop__/nestedMenu.tsx +0 -0
  1092. /package/src/{core → ui}/components/menu/__workshop__/onCloseMenuButton.tsx +0 -0
  1093. /package/src/{core → ui}/components/menu/__workshop__/selectedItem.tsx +0 -0
  1094. /package/src/{core → ui}/components/menu/__workshop__/withoutArrow.tsx +0 -0
  1095. /package/src/{core → ui}/components/menu/helpers.ts +0 -0
  1096. /package/src/{core → ui}/components/menu/index.ts +0 -0
  1097. /package/src/{core → ui}/components/skeleton/__workshop__/index.ts +0 -0
  1098. /package/src/{core → ui}/components/skeleton/index.ts +0 -0
  1099. /package/src/{core → ui}/components/tab/__workshop__/example.tsx +0 -0
  1100. /package/src/{core → ui}/components/tab/__workshop__/index.ts +0 -0
  1101. /package/src/{core → ui}/components/tab/index.ts +0 -0
  1102. /package/src/{core → ui}/components/toast/__workshop__/index.ts +0 -0
  1103. /package/src/{core → ui}/components/toast/index.ts +0 -0
  1104. /package/src/{core → ui}/components/toast/toastContext.ts +0 -0
  1105. /package/src/{core → ui}/components/tree/__workshop__/basic.perf.ts +0 -0
  1106. /package/src/{core → ui}/components/tree/__workshop__/index.ts +0 -0
  1107. /package/src/{core → ui}/components/tree/helpers.ts +0 -0
  1108. /package/src/{core → ui}/components/tree/index.ts +0 -0
  1109. /package/src/{core → ui}/components/tree/treeContext.ts +0 -0
  1110. /package/src/{core → ui}/components/tree/types.ts +0 -0
  1111. /package/src/{core → ui}/global.ts +0 -0
  1112. /package/src/{core → ui}/helpers/animation.ts +0 -0
  1113. /package/src/{core → ui}/helpers/element.ts +0 -0
  1114. /package/src/{core → ui}/helpers/scroll.ts +0 -0
  1115. /package/src/{core → ui}/hooks/index.ts +0 -0
  1116. /package/src/{core → ui}/hooks/useCustomValidity.ts +0 -0
  1117. /package/src/{core → ui}/hooks/useElementRect/__workshop__/index.ts +0 -0
  1118. /package/src/{core → ui}/hooks/useElementRect/index.ts +0 -0
  1119. /package/src/{core → ui}/hooks/useElementRect/useElementRect.ts +0 -0
  1120. /package/src/{core → ui}/hooks/useIsomorphicEffect.ts +0 -0
  1121. /package/src/{core → ui}/hooks/useMediaIndex/__workshop__/index.ts +0 -0
  1122. /package/src/{core → ui}/hooks/useMediaIndex/__workshop__/test.tsx +0 -0
  1123. /package/src/{core → ui}/hooks/useMediaIndex/index.ts +0 -0
  1124. /package/src/{core → ui}/hooks/useMounted.ts +0 -0
  1125. /package/src/{core → ui}/lib/isRecord.ts +0 -0
  1126. /package/src/{core → ui}/middleware/origin.ts +0 -0
  1127. /package/src/{core → ui}/observers/elementSizeObserver.ts +0 -0
  1128. /package/src/{core → ui}/observers/index.ts +0 -0
  1129. /package/src/{core → ui}/observers/resizeObserver.ts +0 -0
  1130. /package/src/{core → ui}/primitives/_selectable/index.ts +0 -0
  1131. /package/src/{core → ui}/primitives/avatar/__workshop__/index.ts +0 -0
  1132. /package/src/{core → ui}/primitives/avatar/index.ts +0 -0
  1133. /package/src/{core → ui}/primitives/badge/__workshop__/index.ts +0 -0
  1134. /package/src/{core → ui}/primitives/badge/index.ts +0 -0
  1135. /package/src/{core → ui}/primitives/badge/types.ts +0 -0
  1136. /package/src/{core → ui}/primitives/box/__workshop__/index.ts +0 -0
  1137. /package/src/{core → ui}/primitives/box/__workshop__/responsive.tsx +0 -0
  1138. /package/src/{core → ui}/primitives/box/index.ts +0 -0
  1139. /package/src/{core → ui}/primitives/button/__workshop__/customIcons.tsx +0 -0
  1140. /package/src/{core → ui}/primitives/button/__workshop__/index.ts +0 -0
  1141. /package/src/{core → ui}/primitives/button/__workshop__/mixedChildren.tsx +0 -0
  1142. /package/src/{core → ui}/primitives/button/__workshop__/uploadButton.tsx +0 -0
  1143. /package/src/{core → ui}/primitives/button/index.ts +0 -0
  1144. /package/src/{core → ui}/primitives/card/__workshop__/index.ts +0 -0
  1145. /package/src/{core → ui}/primitives/checkbox/__workshop__/example.tsx +0 -0
  1146. /package/src/{core → ui}/primitives/checkbox/__workshop__/index.ts +0 -0
  1147. /package/src/{core → ui}/primitives/checkbox/__workshop__/props.tsx +0 -0
  1148. /package/src/{core → ui}/primitives/checkbox/__workshop__/readOnly.tsx +0 -0
  1149. /package/src/{core → ui}/primitives/checkbox/index.ts +0 -0
  1150. /package/src/{core → ui}/primitives/code/__workshop__/index.ts +0 -0
  1151. /package/src/{core → ui}/primitives/code/__workshop__/opticalAlignment.tsx +0 -0
  1152. /package/src/{core → ui}/primitives/code/index.ts +0 -0
  1153. /package/src/{core → ui}/primitives/container/__workshop__/index.ts +0 -0
  1154. /package/src/{core → ui}/primitives/container/index.ts +0 -0
  1155. /package/src/{core → ui}/primitives/container/types.ts +0 -0
  1156. /package/src/{core → ui}/primitives/flex/__workshop__/index.ts +0 -0
  1157. /package/src/{core → ui}/primitives/flex/index.ts +0 -0
  1158. /package/src/{core → ui}/primitives/grid/__workshop__/index.ts +0 -0
  1159. /package/src/{core → ui}/primitives/grid/index.ts +0 -0
  1160. /package/src/{core → ui}/primitives/heading/__workshop__/index.ts +0 -0
  1161. /package/src/{core → ui}/primitives/heading/index.ts +0 -0
  1162. /package/src/{core → ui}/primitives/index.ts +0 -0
  1163. /package/src/{core → ui}/primitives/inline/__workshop__/index.ts +0 -0
  1164. /package/src/{core → ui}/primitives/inline/index.ts +0 -0
  1165. /package/src/{core → ui}/primitives/inline/types.ts +0 -0
  1166. /package/src/{core → ui}/primitives/kbd/__workshop__/index.ts +0 -0
  1167. /package/src/{core → ui}/primitives/kbd/__workshop__/plain.tsx +0 -0
  1168. /package/src/{core/primitives/kbd/index.tsx → ui/primitives/kbd/index.ts} +0 -0
  1169. /package/src/{core → ui}/primitives/label/__workshop__/index.ts +0 -0
  1170. /package/src/{core → ui}/primitives/label/index.ts +0 -0
  1171. /package/src/{core → ui}/primitives/popover/__workshop__/MarginsStory.tsx +0 -0
  1172. /package/src/{core → ui}/primitives/popover/__workshop__/RecursiveStory.tsx +0 -0
  1173. /package/src/{core → ui}/primitives/popover/__workshop__/index.ts +0 -0
  1174. /package/src/{core → ui}/primitives/popover/constants.ts +0 -0
  1175. /package/src/{core → ui}/primitives/popover/index.ts +0 -0
  1176. /package/src/{core → ui}/primitives/popover/types.ts +0 -0
  1177. /package/src/{core → ui}/primitives/radio/__workshop__/example.tsx +0 -0
  1178. /package/src/{core → ui}/primitives/radio/__workshop__/index.ts +0 -0
  1179. /package/src/{core → ui}/primitives/radio/index.ts +0 -0
  1180. /package/src/{core → ui}/primitives/select/__workshop__/index.ts +0 -0
  1181. /package/src/{core → ui}/primitives/select/index.ts +0 -0
  1182. /package/src/{core → ui}/primitives/spinner/__workshop__/index.ts +0 -0
  1183. /package/src/{core → ui}/primitives/spinner/index.ts +0 -0
  1184. /package/src/{core → ui}/primitives/stack/__workshop__/index.ts +0 -0
  1185. /package/src/{core → ui}/primitives/switch/__workshop__/example.tsx +0 -0
  1186. /package/src/{core → ui}/primitives/switch/__workshop__/index.ts +0 -0
  1187. /package/src/{core → ui}/primitives/switch/__workshop__/props.tsx +0 -0
  1188. /package/src/{core → ui}/primitives/switch/index.ts +0 -0
  1189. /package/src/{core → ui}/primitives/text/__workshop__/index.ts +0 -0
  1190. /package/src/{core → ui}/primitives/text/index.ts +0 -0
  1191. /package/src/{core → ui}/primitives/textArea/__workshop__/index.ts +0 -0
  1192. /package/src/{core → ui}/primitives/textArea/index.ts +0 -0
  1193. /package/src/{core → ui}/primitives/textInput/__workshop__/clearButton.tsx +0 -0
  1194. /package/src/{core → ui}/primitives/textInput/__workshop__/customValidity.tsx +0 -0
  1195. /package/src/{core → ui}/primitives/textInput/__workshop__/states.tsx +0 -0
  1196. /package/src/{core → ui}/primitives/textInput/index.ts +0 -0
  1197. /package/src/{core → ui}/primitives/tooltip/__workshop__/index.ts +0 -0
  1198. /package/src/{core → ui}/primitives/tooltip/constants.ts +0 -0
  1199. /package/src/{core → ui}/primitives/tooltip/index.ts +0 -0
  1200. /package/src/{core → ui}/primitives/tooltip/tooltipDelayGroup/tooltipDelayGroupContext.tsx +0 -0
  1201. /package/src/{core → ui}/types/avatar.ts +0 -0
  1202. /package/src/{core → ui}/types/badge.ts +0 -0
  1203. /package/src/{core → ui}/types/card.ts +0 -0
  1204. /package/src/{core → ui}/types/dialog.ts +0 -0
  1205. /package/src/{core → ui}/types/placement.ts +0 -0
  1206. /package/src/{core → ui}/types/popover.ts +0 -0
  1207. /package/src/{core → ui}/types/radius.ts +0 -0
  1208. /package/src/{core → ui}/utils/arrow/cmds.ts +0 -0
  1209. /package/src/{core → ui}/utils/arrow/index.ts +0 -0
  1210. /package/src/{core → ui}/utils/boundaryElement/__workshop__/index.ts +0 -0
  1211. /package/src/{core → ui}/utils/boundaryElement/__workshop__/plain.tsx +0 -0
  1212. /package/src/{core → ui}/utils/boundaryElement/boundaryElementContext.ts +0 -0
  1213. /package/src/{core → ui}/utils/boundaryElement/types.ts +0 -0
  1214. /package/src/{core → ui}/utils/conditionalWrapper/index.ts +0 -0
  1215. /package/src/{core → ui}/utils/elementQuery/__workshop__/index.ts +0 -0
  1216. /package/src/{core → ui}/utils/elementQuery/helpers.ts +0 -0
  1217. /package/src/{core → ui}/utils/elementQuery/index.ts +0 -0
  1218. /package/src/{core → ui}/utils/index.ts +0 -0
  1219. /package/src/{core → ui}/utils/layer/__workshop__/_debug.tsx +0 -0
  1220. /package/src/{core → ui}/utils/layer/__workshop__/index.ts +0 -0
  1221. /package/src/{core → ui}/utils/layer/getLayerContext.test.ts +0 -0
  1222. /package/src/{core → ui}/utils/layer/getLayerContext.ts +0 -0
  1223. /package/src/{core → ui}/utils/layer/layerContext.ts +0 -0
  1224. /package/src/{core → ui}/utils/layer/types.ts +0 -0
  1225. /package/src/{core → ui}/utils/portal/__workshop__/index.ts +0 -0
  1226. /package/src/{core → ui}/utils/portal/__workshop__/named.tsx +0 -0
  1227. /package/src/{core → ui}/utils/portal/index.ts +0 -0
  1228. /package/src/{core → ui}/utils/portal/portalContext.ts +0 -0
  1229. /package/src/{core → ui}/utils/portal/types.ts +0 -0
  1230. /package/src/{core → ui}/utils/virtualList/__workshop__/changingProps.tsx +0 -0
  1231. /package/src/{core → ui}/utils/virtualList/__workshop__/elementScroll.tsx +0 -0
  1232. /package/src/{core → ui}/utils/virtualList/__workshop__/index.ts +0 -0
  1233. /package/src/{core → ui}/utils/virtualList/__workshop__/infiniteList.tsx +0 -0
  1234. /package/src/{core → ui}/utils/virtualList/__workshop__/windowScrolll.tsx +0 -0
  1235. /package/src/{core → ui}/utils/virtualList/index.ts +0 -0
@@ -0,0 +1,722 @@
1
+ import {ChevronDownIcon} from '@sanity/icons'
2
+ import {ResponsiveProp} from '@sanity/ui/css'
3
+ import {FontTextSize, Space} from '@sanity/ui/theme'
4
+ import {
5
+ ChangeEvent,
6
+ cloneElement,
7
+ ElementType,
8
+ FocusEvent,
9
+ ForwardedRef,
10
+ forwardRef,
11
+ KeyboardEvent,
12
+ MouseEvent,
13
+ ReactElement,
14
+ ReactNode,
15
+ useCallback,
16
+ useEffect,
17
+ useImperativeHandle,
18
+ useMemo,
19
+ useReducer,
20
+ useRef,
21
+ } from 'react'
22
+
23
+ import {EMPTY_ARRAY, EMPTY_RECORD} from '../../constants'
24
+ import {_hasFocus, _raf, focusFirstDescendant} from '../../helpers'
25
+ import {useArrayProp} from '../../hooks'
26
+ import {
27
+ Box,
28
+ BoxProps,
29
+ Button,
30
+ Card,
31
+ Popover,
32
+ PopoverProps,
33
+ Stack,
34
+ Text,
35
+ TextInput,
36
+ } from '../../primitives'
37
+ // import {Selectable} from '../../primitives/_selectable'
38
+ import {AnimatedSpinnerIcon} from '../../primitives/spinner/animatedSpinnerIcon'
39
+ import {Props, Radius} from '../../types'
40
+ import {AutocompleteOption} from './autocompleteOption'
41
+ import {autocompleteReducer} from './autocompleteReducer'
42
+ import {
43
+ AUTOCOMPLETE_LISTBOX_IGNORE_KEYS,
44
+ AUTOCOMPLETE_POPOVER_FALLBACK_PLACEMENTS,
45
+ AUTOCOMPLETE_POPOVER_PLACEMENT,
46
+ } from './constants'
47
+ import {AutocompleteOpenButtonProps, BaseAutocompleteOption} from './types'
48
+
49
+ /**
50
+ * @public
51
+ */
52
+ export interface AutocompleteProps<Option extends BaseAutocompleteOption = BaseAutocompleteOption> {
53
+ border?: boolean
54
+ customValidity?: string
55
+ disabled?: boolean
56
+ filterOption?: (query: string, option: Option) => boolean
57
+ fontSize?: ResponsiveProp<FontTextSize>
58
+ icon?: ElementType | ReactNode
59
+ id: string
60
+ /** @beta */
61
+ listBox?: BoxProps
62
+ loading?: boolean
63
+ onChange?: (value: string) => void
64
+ onQueryChange?: (query: string | null) => void
65
+ onSelect?: (value: string) => void
66
+ /** @beta */
67
+ openButton?: boolean | AutocompleteOpenButtonProps
68
+ /** @beta */
69
+ openOnFocus?: boolean
70
+ /** The options to render. */
71
+ options?: Option[]
72
+ padding?: ResponsiveProp<Space>
73
+ // padding?: number | number[]
74
+ popover?: Omit<Props<PopoverProps, 'div'>, 'content' | 'onMouseEnter' | 'onMouseLeave' | 'open'>
75
+ prefix?: ReactNode
76
+ radius?: Radius | Radius[]
77
+ readOnly?: boolean
78
+ ref?: ForwardedRef<HTMLInputElement>
79
+ /** @beta */
80
+ relatedElements?: HTMLElement[]
81
+ /** The callback function for rendering each option. */
82
+ renderOption?: (option: Option) => React.JSX.Element
83
+ /** @beta */
84
+ renderPopover?: (
85
+ props: {
86
+ content: React.JSX.Element | null
87
+ hidden: boolean
88
+ inputElement: HTMLInputElement | null
89
+ onMouseEnter: () => void
90
+ onMouseLeave: () => void
91
+ },
92
+ ref: ForwardedRef<HTMLDivElement>,
93
+ ) => ReactNode
94
+ renderValue?: (value: string, option?: Option) => string
95
+ suffix?: ReactNode
96
+ /** The current value. */
97
+ value?: string
98
+ }
99
+
100
+ const DEFAULT_RENDER_VALUE = (value: string, option?: BaseAutocompleteOption) =>
101
+ option ? option.value : value
102
+
103
+ const DEFAULT_FILTER_OPTION = (query: string, option: BaseAutocompleteOption) =>
104
+ option.value.toLowerCase().indexOf(query.toLowerCase()) > -1
105
+
106
+ const InnerAutocomplete = forwardRef(function InnerAutocomplete<
107
+ Option extends BaseAutocompleteOption,
108
+ >(
109
+ props: Omit<
110
+ Props<AutocompleteProps<Option>, 'div'>,
111
+ | 'aria-activedescendant'
112
+ | 'aria-autocomplete'
113
+ | 'aria-expanded'
114
+ | 'aria-owns'
115
+ | 'as'
116
+ | 'autoCapitalize'
117
+ | 'autoComplete'
118
+ | 'autoCorrect'
119
+ | 'inputMode'
120
+ | 'role'
121
+ | 'spellCheck'
122
+ | 'type'
123
+ >,
124
+ forwardedRef: ForwardedRef<HTMLInputElement>,
125
+ ) {
126
+ const {
127
+ border = true,
128
+ customValidity,
129
+ disabled,
130
+ filterOption: filterOptionProp,
131
+ fontSize = 2,
132
+ icon,
133
+ id,
134
+ listBox = EMPTY_RECORD,
135
+ loading,
136
+ onBlur,
137
+ onChange,
138
+ onFocus,
139
+ onQueryChange,
140
+ onSelect,
141
+ openButton,
142
+ openOnFocus,
143
+ options: optionsProp,
144
+ padding: paddingProp = 3,
145
+ popover = EMPTY_RECORD,
146
+ prefix,
147
+ radius = 2,
148
+ readOnly,
149
+ relatedElements,
150
+ renderOption: renderOptionProp,
151
+ renderPopover,
152
+ renderValue = DEFAULT_RENDER_VALUE,
153
+ suffix,
154
+ value: valueProp,
155
+ ...restProps
156
+ } = props
157
+
158
+ const [state, dispatch] = useReducer(autocompleteReducer, {
159
+ activeValue: valueProp || null,
160
+ focused: false,
161
+ listFocused: false,
162
+ query: null,
163
+ value: valueProp || null,
164
+ })
165
+
166
+ const {activeValue, focused, listFocused, query, value} = state
167
+
168
+ const defaultRenderOption = useCallback(
169
+ ({value}: BaseAutocompleteOption) => (
170
+ <Card as="button" padding={paddingProp} radius={2} tone="inherit">
171
+ <Text size={fontSize} textOverflow="ellipsis">
172
+ {value}
173
+ </Text>
174
+ </Card>
175
+ ),
176
+ [fontSize, paddingProp],
177
+ )
178
+
179
+ const renderOption =
180
+ typeof renderOptionProp === 'function' ? renderOptionProp : defaultRenderOption
181
+
182
+ const filterOption =
183
+ typeof filterOptionProp === 'function' ? filterOptionProp : DEFAULT_FILTER_OPTION
184
+
185
+ // Element refs
186
+ const rootElementRef = useRef<HTMLDivElement | null>(null)
187
+ const resultsPopoverElementRef = useRef<HTMLDivElement | null>(null)
188
+ const inputElementRef = useRef<HTMLInputElement | null>(null)
189
+ const listBoxElementRef = useRef<HTMLDivElement | null>(null)
190
+
191
+ // Value refs
192
+ const listFocusedRef = useRef(false)
193
+ const valueRef = useRef(value)
194
+ const valuePropRef = useRef(valueProp)
195
+ const popoverMouseWithinRef = useRef(false)
196
+
197
+ // Forward ref to parent
198
+ useImperativeHandle<HTMLInputElement | null, HTMLInputElement | null>(
199
+ forwardedRef,
200
+ () => inputElementRef.current,
201
+ )
202
+
203
+ const listBoxId = `${id}-listbox`
204
+ const options = Array.isArray(optionsProp) ? optionsProp : EMPTY_ARRAY
205
+ const padding = useArrayProp(paddingProp)
206
+ const currentOption = useMemo(
207
+ () => (value !== null ? options.find((o) => o.value === value) : undefined),
208
+ [options, value],
209
+ )
210
+ const filteredOptions = useMemo(
211
+ () => options.filter((option) => (query ? filterOption(query, option) : true)),
212
+ [filterOption, options, query],
213
+ )
214
+ const filteredOptionsLen = filteredOptions.length
215
+ const activeItemId = activeValue ? `${id}-option-${activeValue}` : undefined
216
+ const expanded = (query !== null && loading) || (focused && query !== null)
217
+
218
+ const handleRootBlur = useCallback(
219
+ (event: FocusEvent<HTMLInputElement>) => {
220
+ setTimeout(() => {
221
+ // NOTE: This is a workaround for a bug that may happen in Chrome (clicking the scrollbar
222
+ // closes the results in certain situations):
223
+ // - Do not handle blur if the mouse is within the popover
224
+ if (popoverMouseWithinRef.current) {
225
+ return
226
+ }
227
+
228
+ const elements: HTMLElement[] = (relatedElements || []).concat(
229
+ rootElementRef.current ? [rootElementRef.current] : [],
230
+ resultsPopoverElementRef.current ? [resultsPopoverElementRef.current] : [],
231
+ )
232
+
233
+ let focusInside = false
234
+
235
+ if (document.activeElement) {
236
+ for (const e of elements) {
237
+ if (e === document.activeElement || e.contains(document.activeElement)) {
238
+ focusInside = true
239
+ break
240
+ }
241
+ }
242
+ }
243
+
244
+ if (focusInside === false) {
245
+ dispatch({type: 'root/blur'})
246
+ popoverMouseWithinRef.current = false
247
+ if (onQueryChange) onQueryChange(null)
248
+ if (onBlur) onBlur(event)
249
+ }
250
+ }, 0)
251
+ },
252
+ [onBlur, onQueryChange, relatedElements],
253
+ )
254
+
255
+ const handleRootFocus = useCallback((event: FocusEvent<HTMLDivElement>) => {
256
+ const listBoxElement = listBoxElementRef.current
257
+ const focusedElement = event.target instanceof HTMLElement ? event.target : null
258
+ const listFocused = listBoxElement?.contains(focusedElement) || false
259
+
260
+ if (listFocused !== listFocusedRef.current) {
261
+ listFocusedRef.current = listFocused
262
+
263
+ dispatch({type: 'root/setListFocused', listFocused})
264
+ }
265
+ }, [])
266
+
267
+ const handleOptionSelect = useCallback(
268
+ (v: string) => {
269
+ dispatch({type: 'value/change', value: v})
270
+
271
+ popoverMouseWithinRef.current = false
272
+
273
+ if (onSelect) onSelect(v)
274
+
275
+ valueRef.current = v
276
+
277
+ if (onChange) onChange(v)
278
+ if (onQueryChange) onQueryChange(null)
279
+
280
+ inputElementRef.current?.focus()
281
+ },
282
+ [onChange, onSelect, onQueryChange],
283
+ )
284
+
285
+ const handleRootKeyDown = useCallback(
286
+ (event: KeyboardEvent<HTMLElement>) => {
287
+ if (event.key === 'ArrowDown') {
288
+ event.preventDefault()
289
+
290
+ if (!filteredOptionsLen) return
291
+
292
+ const activeOption = filteredOptions.find((o) => o.value === activeValue)
293
+ const activeIndex = activeOption ? filteredOptions.indexOf(activeOption) : -1
294
+ const nextActiveOption = filteredOptions[(activeIndex + 1) % filteredOptionsLen]
295
+
296
+ if (nextActiveOption) {
297
+ dispatch({type: 'root/setActiveValue', value: nextActiveOption.value, listFocused: true})
298
+ }
299
+
300
+ return
301
+ }
302
+
303
+ if (event.key === 'ArrowUp') {
304
+ event.preventDefault()
305
+
306
+ if (!filteredOptionsLen) return
307
+
308
+ const activeOption = filteredOptions.find((o) => o.value === activeValue)
309
+ const activeIndex = activeOption ? filteredOptions.indexOf(activeOption) : -1
310
+ const nextActiveOption =
311
+ filteredOptions[
312
+ activeIndex === -1
313
+ ? filteredOptionsLen - 1
314
+ : (filteredOptionsLen + activeIndex - 1) % filteredOptionsLen
315
+ ]
316
+
317
+ if (nextActiveOption) {
318
+ dispatch({type: 'root/setActiveValue', value: nextActiveOption.value, listFocused: true})
319
+ }
320
+
321
+ return
322
+ }
323
+
324
+ if (event.key === 'Escape') {
325
+ dispatch({type: 'root/escape'})
326
+ popoverMouseWithinRef.current = false
327
+ if (onQueryChange) onQueryChange(null)
328
+ inputElementRef.current?.focus()
329
+
330
+ return
331
+ }
332
+
333
+ const target = event.target as Node
334
+ const listEl = listBoxElementRef.current
335
+
336
+ if (
337
+ (listEl === target || listEl?.contains(target)) &&
338
+ !AUTOCOMPLETE_LISTBOX_IGNORE_KEYS.includes(event.key)
339
+ ) {
340
+ inputElementRef.current?.focus()
341
+
342
+ return
343
+ }
344
+ },
345
+ [activeValue, filteredOptions, filteredOptionsLen, onQueryChange],
346
+ )
347
+
348
+ const handleInputChange = useCallback(
349
+ (event: ChangeEvent<HTMLInputElement>) => {
350
+ const nextQuery = event.currentTarget.value
351
+
352
+ dispatch({type: 'input/change', query: nextQuery})
353
+
354
+ if (onQueryChange) onQueryChange(nextQuery)
355
+ },
356
+ [onQueryChange],
357
+ )
358
+
359
+ const dispatchOpen = useCallback(() => {
360
+ dispatch({
361
+ type: 'root/open',
362
+ query: value ? renderValue(value, currentOption) : '',
363
+ })
364
+ }, [currentOption, renderValue, value])
365
+
366
+ const handleInputFocus = useCallback(
367
+ (event: FocusEvent<HTMLInputElement>) => {
368
+ if (!focused) {
369
+ dispatch({type: 'input/focus'})
370
+
371
+ if (onFocus) onFocus(event)
372
+ if (openOnFocus) dispatchOpen()
373
+ }
374
+ },
375
+ [focused, onFocus, openOnFocus, dispatchOpen],
376
+ )
377
+
378
+ const handlePopoverMouseEnter = useCallback(() => {
379
+ popoverMouseWithinRef.current = true
380
+ }, [])
381
+
382
+ const handlePopoverMouseLeave = useCallback(() => {
383
+ popoverMouseWithinRef.current = false
384
+ }, [])
385
+
386
+ const handleClearButtonClick = useCallback(() => {
387
+ dispatch({type: 'root/clear'})
388
+ valueRef.current = ''
389
+ if (onChange) onChange('')
390
+ if (onQueryChange) onQueryChange(null)
391
+ inputElementRef.current?.focus()
392
+ }, [onChange, onQueryChange])
393
+
394
+ const handleClearButtonFocus = useCallback(() => {
395
+ dispatch({type: 'input/focus'})
396
+ }, [])
397
+
398
+ // Change the value when `value` prop changes
399
+ useEffect(() => {
400
+ // If `valueProp` changed
401
+ if (valueProp !== valuePropRef.current) {
402
+ valuePropRef.current = valueProp
403
+
404
+ if (valueProp !== undefined) {
405
+ dispatch({type: 'value/change', value: valueProp})
406
+ valueRef.current = valueProp
407
+ }
408
+
409
+ return
410
+ }
411
+
412
+ // If `valueProp` is not equal to `value`
413
+ if (valueProp !== valueRef.current) {
414
+ valueRef.current = valueProp || null
415
+
416
+ dispatch({type: 'value/change', value: valueProp || null})
417
+ }
418
+ }, [valueProp])
419
+
420
+ // Reset active item when closing
421
+ useEffect(() => {
422
+ if (!focused && valueRef.current) {
423
+ dispatch({type: 'root/setActiveValue', value: valueRef.current})
424
+ }
425
+ }, [focused])
426
+
427
+ // Focus the selected item
428
+ useEffect(() => {
429
+ const listElement = listBoxElementRef.current
430
+
431
+ if (!listElement) return
432
+
433
+ const activeOption = filteredOptions.find((o) => o.value === activeValue)
434
+
435
+ if (activeOption) {
436
+ const activeIndex = filteredOptions.indexOf(activeOption)
437
+ const activeItemElement = listElement.childNodes[activeIndex] as HTMLLIElement | undefined
438
+
439
+ if (activeItemElement) {
440
+ if (_hasFocus(activeItemElement)) {
441
+ // already focused
442
+ return
443
+ }
444
+
445
+ focusFirstDescendant(activeItemElement)
446
+ }
447
+ }
448
+ }, [activeValue, filteredOptions])
449
+
450
+ const clearButton = useMemo(() => {
451
+ if (!loading && !disabled && value) {
452
+ return {
453
+ 'aria-label': 'Clear',
454
+ 'onFocus': handleClearButtonFocus,
455
+ }
456
+ }
457
+
458
+ return undefined
459
+ }, [disabled, handleClearButtonFocus, loading, value])
460
+
461
+ const openButtonBoxPadding = useMemo(
462
+ () =>
463
+ padding.map((v) => {
464
+ if (v === 0) return 0
465
+ if (v === 1) return 1
466
+ if (v === 2) return 1
467
+
468
+ return (v as Space) - 2
469
+ }) as Space[],
470
+ [padding],
471
+ )
472
+
473
+ const openButtonPadding = useMemo(
474
+ () => padding.map((v) => Math.max((v as Space) - 1, 0)) as Space[],
475
+ [padding],
476
+ )
477
+
478
+ const openButtonProps: AutocompleteOpenButtonProps = useMemo(
479
+ () => (typeof openButton === 'object' ? openButton : EMPTY_RECORD),
480
+ [openButton],
481
+ )
482
+
483
+ const handleOpenClick = useCallback(
484
+ (event: MouseEvent<HTMLButtonElement>) => {
485
+ dispatchOpen()
486
+
487
+ if (openButtonProps.onClick) openButtonProps.onClick(event)
488
+
489
+ _raf(() => inputElementRef.current?.focus())
490
+ },
491
+ [openButtonProps, dispatchOpen],
492
+ )
493
+
494
+ const openButtonNode = useMemo(
495
+ () =>
496
+ !disabled && !readOnly && openButton ? (
497
+ <Box aria-hidden={expanded} padding={openButtonBoxPadding}>
498
+ <Button
499
+ aria-label="Open"
500
+ disabled={expanded}
501
+ display="block"
502
+ fontSize={fontSize}
503
+ icon={ChevronDownIcon}
504
+ mode="bleed"
505
+ padding={openButtonPadding}
506
+ {...openButtonProps}
507
+ onClick={handleOpenClick}
508
+ />
509
+ </Box>
510
+ ) : undefined,
511
+ [
512
+ disabled,
513
+ expanded,
514
+ fontSize,
515
+ handleOpenClick,
516
+ openButton,
517
+ openButtonBoxPadding,
518
+ openButtonPadding,
519
+ openButtonProps,
520
+ readOnly,
521
+ ],
522
+ )
523
+
524
+ const inputValue = useMemo(() => {
525
+ if (query === null) {
526
+ if (value !== null) {
527
+ return renderValue(value, currentOption)
528
+ }
529
+
530
+ return ''
531
+ }
532
+
533
+ return query
534
+ }, [currentOption, query, renderValue, value])
535
+
536
+ const input = (
537
+ <TextInput
538
+ {...restProps}
539
+ aria-activedescendant={activeItemId}
540
+ aria-autocomplete="list"
541
+ aria-expanded={expanded}
542
+ aria-owns={listBoxId}
543
+ autoCapitalize="off"
544
+ autoComplete="off"
545
+ autoCorrect="off"
546
+ border={border}
547
+ clearButton={clearButton}
548
+ customValidity={customValidity}
549
+ disabled={disabled}
550
+ fontSize={fontSize}
551
+ icon={icon}
552
+ iconRight={loading && AnimatedSpinnerIcon}
553
+ id={id}
554
+ inputMode="search"
555
+ onChange={handleInputChange}
556
+ onClear={handleClearButtonClick}
557
+ onFocus={handleInputFocus}
558
+ padding={padding}
559
+ prefix={prefix}
560
+ radius={radius}
561
+ readOnly={readOnly}
562
+ ref={inputElementRef}
563
+ role="combobox"
564
+ spellCheck={false}
565
+ suffix={suffix || openButtonNode}
566
+ value={inputValue}
567
+ />
568
+ )
569
+
570
+ const handleListBoxKeyDown = useCallback(
571
+ (event: KeyboardEvent<HTMLDivElement>) => {
572
+ // If the focus is currently in the list, move focus to the input element
573
+ if (event.key === 'Tab') {
574
+ if (listFocused) inputElementRef.current?.focus()
575
+ }
576
+ },
577
+ [listFocused],
578
+ )
579
+
580
+ const content = useMemo(() => {
581
+ if (filteredOptions.length === 0) return null
582
+
583
+ return (
584
+ <Box
585
+ data-ui="AutoComplete__results"
586
+ onKeyDown={handleListBoxKeyDown}
587
+ padding={1}
588
+ {...listBox}
589
+ tabIndex={-1}
590
+ >
591
+ <Stack
592
+ as="ul"
593
+ aria-multiselectable={false}
594
+ data-ui="AutoComplete__resultsList"
595
+ id={listBoxId}
596
+ ref={listBoxElementRef}
597
+ role="listbox"
598
+ space={1}
599
+ >
600
+ {filteredOptions.map((option) => {
601
+ const active =
602
+ activeValue !== null ? option.value === activeValue : currentOption === option
603
+
604
+ return (
605
+ <AutocompleteOption
606
+ id={`${id}-option-${option.value}`}
607
+ key={option.value}
608
+ onSelect={handleOptionSelect}
609
+ selected={active}
610
+ value={option.value}
611
+ >
612
+ {cloneElement(renderOption(option), {
613
+ disabled: loading,
614
+ selected: active,
615
+ tabIndex: listFocused && active ? 0 : -1,
616
+ })}
617
+ </AutocompleteOption>
618
+ )
619
+ })}
620
+ </Stack>
621
+ </Box>
622
+ )
623
+ }, [
624
+ activeValue,
625
+ currentOption,
626
+ filteredOptions,
627
+ handleOptionSelect,
628
+ handleListBoxKeyDown,
629
+ id,
630
+ listBox,
631
+ listBoxId,
632
+ listFocused,
633
+ loading,
634
+ renderOption,
635
+ ])
636
+
637
+ const results = useMemo(() => {
638
+ if (renderPopover) {
639
+ return renderPopover(
640
+ {
641
+ content,
642
+ hidden: !expanded,
643
+ inputElement: inputElementRef.current,
644
+ onMouseEnter: handlePopoverMouseEnter,
645
+ onMouseLeave: handlePopoverMouseLeave,
646
+ },
647
+ resultsPopoverElementRef,
648
+ )
649
+ }
650
+
651
+ if (filteredOptionsLen === 0) {
652
+ return null
653
+ }
654
+
655
+ return (
656
+ <Popover
657
+ arrow={false}
658
+ constrainSize
659
+ content={content}
660
+ fallbackPlacements={AUTOCOMPLETE_POPOVER_FALLBACK_PLACEMENTS}
661
+ matchReferenceWidth
662
+ onMouseEnter={handlePopoverMouseEnter}
663
+ onMouseLeave={handlePopoverMouseLeave}
664
+ open={expanded}
665
+ overflow="auto"
666
+ placement={AUTOCOMPLETE_POPOVER_PLACEMENT}
667
+ portal
668
+ radius={3}
669
+ ref={resultsPopoverElementRef}
670
+ referenceElement={inputElementRef.current}
671
+ {...popover}
672
+ />
673
+ )
674
+ }, [
675
+ content,
676
+ expanded,
677
+ filteredOptionsLen,
678
+ handlePopoverMouseEnter,
679
+ handlePopoverMouseLeave,
680
+ popover,
681
+ renderPopover,
682
+ ])
683
+
684
+ return (
685
+ // eslint-disable-next-line jsx-a11y/no-static-element-interactions
686
+ <div
687
+ data-ui="Autocomplete"
688
+ onBlur={handleRootBlur}
689
+ onFocus={handleRootFocus}
690
+ onKeyDown={handleRootKeyDown}
691
+ ref={rootElementRef}
692
+ >
693
+ {input}
694
+ {results}
695
+ </div>
696
+ )
697
+ })
698
+
699
+ InnerAutocomplete.displayName = 'ForwardRef(Autocomplete)'
700
+
701
+ /**
702
+ * The Autocomplete component is typically used for search components.
703
+ * It consists of a text input for writing a query, and properties for rendering suggestions.
704
+ *
705
+ * @public
706
+ */
707
+ export const Autocomplete = InnerAutocomplete as <Option extends BaseAutocompleteOption>(
708
+ props: Omit<
709
+ Props<AutocompleteProps<Option>, 'input'>,
710
+ | 'aria-activedescendant'
711
+ | 'aria-autocomplete'
712
+ | 'aria-expanded'
713
+ | 'aria-owns'
714
+ | 'autoCapitalize'
715
+ | 'autoComplete'
716
+ | 'autoCorrect'
717
+ | 'inputMode'
718
+ | 'role'
719
+ | 'spellCheck'
720
+ | 'type'
721
+ >,
722
+ ) => ReactElement