@zyncat/ui 0.15.0 → 0.18.0

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 (339) hide show
  1. package/README.md +32 -202
  2. package/dist/alert.css +1 -1
  3. package/dist/alert.js +18 -10
  4. package/dist/alert.js.map +1 -1
  5. package/dist/avatar.css +3 -2
  6. package/dist/badge.css +1 -1
  7. package/dist/bloom-HV23M4AW.js +81 -0
  8. package/dist/bloom-HV23M4AW.js.map +1 -0
  9. package/dist/button.css +38 -31
  10. package/dist/button.js +4 -1
  11. package/dist/checkbox.css +1 -1
  12. package/dist/{chunk-5W5TKANX.js → chunk-2DNKZ57E.js} +3 -3
  13. package/dist/{chunk-5W5TKANX.js.map → chunk-2DNKZ57E.js.map} +1 -1
  14. package/dist/chunk-2YGHPQ66.js +16 -0
  15. package/dist/chunk-2YGHPQ66.js.map +1 -0
  16. package/dist/{chunk-N2GJEO5Z.js → chunk-6H3IJ752.js} +24 -9
  17. package/dist/chunk-6H3IJ752.js.map +1 -0
  18. package/dist/chunk-7NHY2CRA.js +132 -0
  19. package/dist/chunk-7NHY2CRA.js.map +1 -0
  20. package/dist/{chunk-PWQVSVXR.js → chunk-AIAPXRCI.js} +20 -19
  21. package/dist/chunk-AIAPXRCI.js.map +1 -0
  22. package/dist/{chunk-K45CWVHS.js → chunk-BRKGYLEQ.js} +12 -9
  23. package/dist/chunk-BRKGYLEQ.js.map +1 -0
  24. package/dist/{chunk-MDSRZ4QR.js → chunk-C3D32LE3.js} +6 -5
  25. package/dist/chunk-C3D32LE3.js.map +1 -0
  26. package/dist/chunk-F2TB3TT6.js +103 -0
  27. package/dist/chunk-F2TB3TT6.js.map +1 -0
  28. package/dist/{chunk-FVPNICF4.js → chunk-F64Z42PJ.js} +6 -6
  29. package/dist/{chunk-FVPNICF4.js.map → chunk-F64Z42PJ.js.map} +1 -1
  30. package/dist/{chunk-QGVFFT2B.js → chunk-HBWRKEW4.js} +3 -3
  31. package/dist/{chunk-QGVFFT2B.js.map → chunk-HBWRKEW4.js.map} +1 -1
  32. package/dist/{chunk-CAXQJSIE.js → chunk-JINATP4N.js} +13 -13
  33. package/dist/chunk-JINATP4N.js.map +1 -0
  34. package/dist/chunk-KSAJ6DED.js +16 -0
  35. package/dist/chunk-KSAJ6DED.js.map +1 -0
  36. package/dist/{chunk-BH4JFWXQ.js → chunk-M2KGLH2G.js} +19 -16
  37. package/dist/chunk-M2KGLH2G.js.map +1 -0
  38. package/dist/{chunk-6X3G4GIM.js → chunk-N43NDSME.js} +3 -3
  39. package/dist/{chunk-6X3G4GIM.js.map → chunk-N43NDSME.js.map} +1 -1
  40. package/dist/chunk-NYQQH4R5.js +40 -0
  41. package/dist/chunk-NYQQH4R5.js.map +1 -0
  42. package/dist/{chunk-BTF6DAE3.js → chunk-ODRO3KS6.js} +4 -4
  43. package/dist/{chunk-BTF6DAE3.js.map → chunk-ODRO3KS6.js.map} +1 -1
  44. package/dist/chunk-PXQBJMPJ.js +50 -0
  45. package/dist/chunk-PXQBJMPJ.js.map +1 -0
  46. package/dist/{chunk-GJTHWB6O.js → chunk-QDAN43B6.js} +3 -3
  47. package/dist/{chunk-GJTHWB6O.js.map → chunk-QDAN43B6.js.map} +1 -1
  48. package/dist/{chunk-RBSHRRNO.js → chunk-RJENXXTI.js} +5 -5
  49. package/dist/{chunk-RBSHRRNO.js.map → chunk-RJENXXTI.js.map} +1 -1
  50. package/dist/chunk-RLNCRDAL.js +89 -0
  51. package/dist/chunk-RLNCRDAL.js.map +1 -0
  52. package/dist/{chunk-GOLSYGRA.js → chunk-TBLPZQSI.js} +84 -48
  53. package/dist/chunk-TBLPZQSI.js.map +1 -0
  54. package/dist/{chunk-WZUTBJC4.js → chunk-TDHLZY6I.js} +23 -5
  55. package/dist/chunk-TDHLZY6I.js.map +1 -0
  56. package/dist/chunk-TP2AC5MQ.js +13 -0
  57. package/dist/chunk-TP2AC5MQ.js.map +1 -0
  58. package/dist/chunk-TRPAKUIB.js +196 -0
  59. package/dist/chunk-TRPAKUIB.js.map +1 -0
  60. package/dist/{chunk-5X3MJRIM.js → chunk-UKPX3RIP.js} +3 -3
  61. package/dist/{chunk-5X3MJRIM.js.map → chunk-UKPX3RIP.js.map} +1 -1
  62. package/dist/{chunk-5GBV45YD.js → chunk-V6QAAOA5.js} +3 -3
  63. package/dist/{chunk-5GBV45YD.js.map → chunk-V6QAAOA5.js.map} +1 -1
  64. package/dist/{chunk-FLQVOSFC.js → chunk-VJXP256V.js} +10 -10
  65. package/dist/chunk-VJXP256V.js.map +1 -0
  66. package/dist/{chunk-IUQAUBVM.js → chunk-VQFILXQN.js} +5 -5
  67. package/dist/chunk-VQFILXQN.js.map +1 -0
  68. package/dist/{chunk-CFRGQJ23.js → chunk-VZXML7EH.js} +4 -4
  69. package/dist/{chunk-CFRGQJ23.js.map → chunk-VZXML7EH.js.map} +1 -1
  70. package/dist/{chunk-FEXUS4SV.js → chunk-XKDR22VE.js} +11 -5
  71. package/dist/chunk-XKDR22VE.js.map +1 -0
  72. package/dist/cli.js +262 -45
  73. package/dist/collapse.css +8 -5
  74. package/dist/confetti.css +3 -3
  75. package/dist/confetti.js +2 -2
  76. package/dist/date-field.js +20 -18
  77. package/dist/date-field.js.map +1 -1
  78. package/dist/date-picker.css +168 -43
  79. package/dist/date-range-field.js +42 -27
  80. package/dist/date-range-field.js.map +1 -1
  81. package/dist/datetime-field.js +21 -19
  82. package/dist/datetime-field.js.map +1 -1
  83. package/dist/dialog.css +4 -3
  84. package/dist/dialog.js +12 -12
  85. package/dist/dialog.js.map +1 -1
  86. package/dist/digit-strip.css +1 -1
  87. package/dist/dropdown.css +1 -1
  88. package/dist/dropdown.js +16 -16
  89. package/dist/dropdown.js.map +1 -1
  90. package/dist/emoji-picker.js +41 -26
  91. package/dist/emoji-picker.js.map +1 -1
  92. package/dist/facebook-feed.css +1 -1
  93. package/dist/flow-field.css +4 -4
  94. package/dist/flow-field.js +3 -3
  95. package/dist/flow-field.js.map +1 -1
  96. package/dist/glide.js +3 -3
  97. package/dist/icon.css +1 -1
  98. package/dist/input.css +7 -4
  99. package/dist/instagram-feed.css +1 -1
  100. package/dist/instagram-feed.js +2 -2
  101. package/dist/lens.css +1 -2
  102. package/dist/lens.js +2 -2
  103. package/dist/mcp.js +1 -1
  104. package/dist/menu-surface.css +1 -1
  105. package/dist/modal.css +1 -1
  106. package/dist/modal.js +10 -10
  107. package/dist/modal.js.map +1 -1
  108. package/dist/morphing-text.css +2 -2
  109. package/dist/morphing-text.js +2 -2
  110. package/dist/motion-devtools.css +77 -2
  111. package/dist/motion-devtools.js +194 -37
  112. package/dist/motion-devtools.js.map +1 -1
  113. package/dist/motion-tokens.js +1 -1
  114. package/dist/multi-select.js +12 -12
  115. package/dist/number-field.js +3 -3
  116. package/dist/odometer.css +1 -1
  117. package/dist/odometer.js +2 -2
  118. package/dist/overlay.css +1 -1
  119. package/dist/pagination.css +1 -1
  120. package/dist/pagination.js +6 -4
  121. package/dist/pagination.js.map +1 -1
  122. package/dist/paint-CJQCM6ZO.js +260 -0
  123. package/dist/paint-CJQCM6ZO.js.map +1 -0
  124. package/dist/popover.css +1 -1
  125. package/dist/popover.js +10 -10
  126. package/dist/radio-group.css +6 -4
  127. package/dist/radio-group.js +6 -6
  128. package/dist/select.css +1 -1
  129. package/dist/select.js +12 -12
  130. package/dist/sheet.css +1 -1
  131. package/dist/sheet.js +9 -9
  132. package/dist/spinner.css +115 -0
  133. package/dist/spinner.js +4 -0
  134. package/dist/spinner.js.map +1 -0
  135. package/dist/status-badge.js +2 -2
  136. package/dist/styles.css +1 -1
  137. package/dist/support-rail.css +76 -238
  138. package/dist/support-rail.js +99 -107
  139. package/dist/support-rail.js.map +1 -1
  140. package/dist/table.css +2 -2
  141. package/dist/table.js +8 -6
  142. package/dist/table.js.map +1 -1
  143. package/dist/tabs.css +10 -14
  144. package/dist/tabs.js +17 -11
  145. package/dist/tabs.js.map +1 -1
  146. package/dist/tag.css +1 -1
  147. package/dist/tag.js +6 -6
  148. package/dist/text-field.js +3 -3
  149. package/dist/textarea.css +1 -1
  150. package/dist/textarea.js +2 -2
  151. package/dist/theme-grid.js +11 -0
  152. package/dist/theme-grid.js.map +1 -0
  153. package/dist/theme-switcher.css +107 -0
  154. package/dist/theme-switcher.js +70 -0
  155. package/dist/theme-switcher.js.map +1 -0
  156. package/dist/theme-transition-VGLPZDJI.js +346 -0
  157. package/dist/theme-transition-VGLPZDJI.js.map +1 -0
  158. package/dist/theme-transition.css +48 -0
  159. package/dist/theme.js +57 -26
  160. package/dist/theme.js.map +1 -1
  161. package/dist/tide-DJZMDAFT.js +57 -0
  162. package/dist/tide-DJZMDAFT.js.map +1 -0
  163. package/dist/tiktok.css +2 -3
  164. package/dist/tiktok.js +2 -2
  165. package/dist/time-field.js +4 -4
  166. package/dist/toast.css +2 -14
  167. package/dist/toast.js +12 -10
  168. package/dist/toast.js.map +1 -1
  169. package/dist/toggle-tag.js +2 -2
  170. package/dist/toggle.css +1 -1
  171. package/dist/tooltip.css +1 -1
  172. package/dist/tooltip.js +25 -22
  173. package/dist/tooltip.js.map +1 -1
  174. package/dist/trigger.css +1 -1
  175. package/dist/types/components/composites/date-picker/month-jump.d.ts +11 -0
  176. package/dist/types/components/composites/theme-switcher/ThemeGrid.d.ts +20 -0
  177. package/dist/types/components/composites/theme-switcher/ThemeSwitcher.d.ts +24 -0
  178. package/dist/types/components/compound/support-rail/SupportRail.d.ts +10 -8
  179. package/dist/types/components/dev/MotionDevtools.d.ts +10 -5
  180. package/dist/types/components/expressive/theme-transition/bloom.d.ts +2 -0
  181. package/dist/types/components/expressive/theme-transition/paint.d.ts +2 -0
  182. package/dist/types/components/expressive/theme-transition/scene.d.ts +24 -0
  183. package/dist/types/components/expressive/theme-transition/theme-transition.d.ts +19 -0
  184. package/dist/types/components/expressive/theme-transition/tide.d.ts +2 -0
  185. package/dist/types/components/internal/hooks/use-press-feedback.d.ts +7 -0
  186. package/dist/types/components/internal/icon/Icon.d.ts +1 -0
  187. package/dist/types/components/internal/overlay/layer.d.ts +7 -1
  188. package/dist/types/components/internal/utils/token-px.d.ts +1 -1
  189. package/dist/types/components/primitives/button/Button.d.ts +9 -12
  190. package/dist/types/components/primitives/button/button-style.d.ts +15 -0
  191. package/dist/types/components/primitives/spinner/Spinner.d.ts +27 -0
  192. package/dist/types/engine/animate.d.ts +1 -0
  193. package/dist/types/motion/motion-timing.d.ts +1 -1
  194. package/dist/types/tokens/component-styles.generated.d.ts +35 -38
  195. package/dist/types/tokens/motion-tokens.d.ts +5 -3
  196. package/dist/types/tokens/theme-store.d.ts +47 -0
  197. package/dist/types/tokens/theme-sync.d.ts +7 -1
  198. package/dist/types/tokens/theme-tokens.generated.d.ts +125 -115
  199. package/dist/types/tokens/theme.d.ts +28 -5
  200. package/dist/typing-lines.css +1 -1
  201. package/dist/typing-lines.js +2 -2
  202. package/dist/typing-lines.js.map +1 -1
  203. package/dist/weight-field.css +2 -2
  204. package/dist/youtube.css +1 -1
  205. package/dist/youtube.js +2 -2
  206. package/package.json +20 -24
  207. package/skills/zyncat-ui/SKILL.md +1 -1
  208. package/skills/zyncat-ui/references/components.md +5 -2
  209. package/skills/zyncat-ui/references/theming.md +31 -23
  210. package/src/components/composites/alert/Alert.tsx +7 -3
  211. package/src/components/composites/alert/alert.css +1 -1
  212. package/src/components/composites/date-picker/calendar-panel.tsx +10 -4
  213. package/src/components/composites/date-picker/date-picker.css +168 -43
  214. package/src/components/composites/date-picker/month-jump.tsx +192 -0
  215. package/src/components/composites/date-picker/range-panel.tsx +20 -5
  216. package/src/components/composites/dialog/Dialog.tsx +2 -2
  217. package/src/components/composites/dialog/dialog.css +4 -3
  218. package/src/components/composites/dropdown/Dropdown.tsx +5 -5
  219. package/src/components/composites/dropdown/dropdown.css +1 -1
  220. package/src/components/composites/emoji-picker/react/category-bar.tsx +17 -5
  221. package/src/components/composites/emoji-picker/scaffold.ts +6 -5
  222. package/src/components/composites/emoji-picker/styles.css +1 -1
  223. package/src/components/composites/modal/Modal.tsx +2 -2
  224. package/src/components/composites/modal/modal.css +1 -1
  225. package/src/components/composites/pagination/pagination.css +1 -1
  226. package/src/components/composites/popover/Popover.tsx +5 -5
  227. package/src/components/composites/popover/popover.css +1 -1
  228. package/src/components/composites/select/core/menu.tsx +15 -10
  229. package/src/components/composites/select/select.css +1 -1
  230. package/src/components/composites/sheet/Sheet.tsx +2 -2
  231. package/src/components/composites/sheet/sheet.css +1 -1
  232. package/src/components/composites/table/table.css +2 -2
  233. package/src/components/composites/tabs/Tabs.tsx +13 -7
  234. package/src/components/composites/tabs/tabs.css +10 -14
  235. package/src/components/composites/theme-switcher/ThemeGrid.tsx +133 -0
  236. package/src/components/composites/theme-switcher/ThemeGrid.usage.md +20 -0
  237. package/src/components/composites/theme-switcher/ThemeSwitcher.tsx +75 -0
  238. package/src/components/composites/theme-switcher/ThemeSwitcher.usage.md +21 -0
  239. package/src/components/composites/theme-switcher/theme-switcher.css +107 -0
  240. package/src/components/composites/toast/Toast.tsx +2 -1
  241. package/src/components/composites/toast/toast.css +2 -14
  242. package/src/components/composites/tooltip/tooltip-host.tsx +19 -17
  243. package/src/components/composites/tooltip/tooltip.css +1 -1
  244. package/src/components/compound/support-rail/SupportRail.tsx +116 -128
  245. package/src/components/compound/support-rail/SupportRail.usage.md +7 -6
  246. package/src/components/compound/support-rail/support-rail.css +76 -238
  247. package/src/components/dev/MotionDevtools.tsx +252 -42
  248. package/src/components/dev/MotionDevtools.usage.md +12 -4
  249. package/src/components/dev/motion-devtools.css +77 -2
  250. package/src/components/dev/slowmo-engine.ts +1 -1
  251. package/src/components/expressive/confetti/confetti.css +3 -3
  252. package/src/components/expressive/facebook-feed/facebook-feed.css +1 -1
  253. package/src/components/expressive/flow-field/FlowField.tsx +1 -1
  254. package/src/components/expressive/flow-field/flow-field.css +4 -4
  255. package/src/components/expressive/instagram-feed/instagram-feed.css +1 -1
  256. package/src/components/expressive/lens/lens.css +1 -2
  257. package/src/components/expressive/morphing-text/morphing-text.css +2 -2
  258. package/src/components/expressive/odometer/odometer.css +1 -1
  259. package/src/components/expressive/theme-transition/bloom.ts +88 -0
  260. package/src/components/expressive/theme-transition/paint.ts +296 -0
  261. package/src/components/expressive/theme-transition/scene.ts +38 -0
  262. package/src/components/expressive/theme-transition/theme-transition.css +48 -0
  263. package/src/components/expressive/theme-transition/theme-transition.ts +423 -0
  264. package/src/components/expressive/theme-transition/tide.ts +65 -0
  265. package/src/components/expressive/tiktok/tiktok.css +2 -3
  266. package/src/components/expressive/typing-lines/TypingLines.tsx +0 -0
  267. package/src/components/expressive/typing-lines/typing-lines.css +1 -1
  268. package/src/components/expressive/weight-field/weight-field.css +2 -2
  269. package/src/components/expressive/youtube/youtube.css +1 -1
  270. package/src/components/internal/glass/glass.css +1 -1
  271. package/src/components/internal/hooks/use-press-feedback.ts +52 -0
  272. package/src/components/internal/icon/Icon.tsx +2 -0
  273. package/src/components/internal/icon/icon.css +1 -1
  274. package/src/components/internal/menu/menu-surface.css +1 -1
  275. package/src/components/internal/overlay/layer.tsx +35 -2
  276. package/src/components/internal/overlay/overlay.css +1 -1
  277. package/src/components/internal/overlay/position.ts +2 -2
  278. package/src/components/internal/overlay/trigger.css +1 -1
  279. package/src/components/internal/utils/token-px.ts +4 -4
  280. package/src/components/primitives/avatar/avatar.css +3 -2
  281. package/src/components/primitives/badge/badge.css +1 -1
  282. package/src/components/primitives/badge/digit-strip.css +1 -1
  283. package/src/components/primitives/button/Button.tsx +28 -27
  284. package/src/components/primitives/button/button-style.ts +28 -0
  285. package/src/components/primitives/button/button.css +38 -31
  286. package/src/components/primitives/checkbox/checkbox.css +1 -1
  287. package/src/components/primitives/collapse/collapse.css +8 -5
  288. package/src/components/primitives/input/input.css +7 -4
  289. package/src/components/primitives/radio-group/radio-group.css +6 -4
  290. package/src/components/primitives/spinner/Spinner.tsx +70 -0
  291. package/src/components/primitives/spinner/Spinner.usage.md +19 -0
  292. package/src/components/primitives/spinner/spinner.css +115 -0
  293. package/src/components/primitives/tag/tag.css +1 -1
  294. package/src/components/primitives/textarea/textarea.css +1 -1
  295. package/src/components/primitives/toggle/toggle.css +1 -1
  296. package/src/engine/animate.ts +10 -2
  297. package/src/mcp/server.ts +2 -1
  298. package/src/motion/glide.tsx +9 -6
  299. package/src/motion/motion-timing.ts +5 -2
  300. package/src/styles.css +3 -4
  301. package/src/tokens/base.css +5 -5
  302. package/src/tokens/color.css +8 -9
  303. package/src/tokens/component-styles.generated.ts +36 -38
  304. package/src/tokens/dark.css +8 -13
  305. package/src/tokens/decisions.css +9 -12
  306. package/src/tokens/elevation.css +18 -26
  307. package/src/tokens/glass.css +3 -2
  308. package/src/tokens/motion-defaults.generated.ts +1 -1
  309. package/src/tokens/motion-tokens.ts +27 -8
  310. package/src/tokens/motion.css +9 -9
  311. package/src/tokens/radius.css +3 -2
  312. package/src/tokens/reset.css +36 -0
  313. package/src/tokens/semantic.css +12 -22
  314. package/src/tokens/spacing.css +1 -1
  315. package/src/tokens/theme-store.ts +187 -0
  316. package/src/tokens/theme-sync.tsx +49 -2
  317. package/src/tokens/theme-tokens.generated.ts +128 -116
  318. package/src/tokens/theme.tsx +96 -24
  319. package/src/tokens/theme.usage.md +25 -24
  320. package/src/tokens/typography.css +4 -3
  321. package/tailwind.css +8 -14
  322. package/dist/chunk-6SUHSSOK.js +0 -25
  323. package/dist/chunk-6SUHSSOK.js.map +0 -1
  324. package/dist/chunk-BH4JFWXQ.js.map +0 -1
  325. package/dist/chunk-CAXQJSIE.js.map +0 -1
  326. package/dist/chunk-FEXUS4SV.js.map +0 -1
  327. package/dist/chunk-FLQVOSFC.js.map +0 -1
  328. package/dist/chunk-GOLSYGRA.js.map +0 -1
  329. package/dist/chunk-IUQAUBVM.js.map +0 -1
  330. package/dist/chunk-K45CWVHS.js.map +0 -1
  331. package/dist/chunk-MDSRZ4QR.js.map +0 -1
  332. package/dist/chunk-N2GJEO5Z.js.map +0 -1
  333. package/dist/chunk-PWQVSVXR.js.map +0 -1
  334. package/dist/chunk-UE63OOVG.js +0 -13
  335. package/dist/chunk-UE63OOVG.js.map +0 -1
  336. package/dist/chunk-UYSXJ7MH.js +0 -52
  337. package/dist/chunk-UYSXJ7MH.js.map +0 -1
  338. package/dist/chunk-WZUTBJC4.js.map +0 -1
  339. package/src/tokens/fonts.css +0 -1
@@ -18,7 +18,7 @@ import { resolveMotionTiming } from '../../../motion/motion-timing';
18
18
  import { Presence } from '../../../motion/presence';
19
19
  import { popIn, popOut } from '../../../motion/presets';
20
20
  import type { DisableableAnimation } from '../../../motion/timing';
21
- import { UIMotion } from '../../../tokens/motion-tokens';
21
+ import { motionFor } from '../../../tokens/motion-tokens';
22
22
  import { useControllable } from '../../internal/hooks/use-controllable';
23
23
  import { ovCloneTrigger, OverlayPortal } from '../../internal/overlay/layer';
24
24
  import type { ActivateOn } from '../../internal/utils/activation';
@@ -107,7 +107,6 @@ export function Dropdown({
107
107
  const hoverDepth = useRef(-1);
108
108
  const autoId = useId();
109
109
  const menuId = id || 'dropdown-' + autoId;
110
- const timings = resolveMotionTiming(animation, DROPDOWN_TIMING);
111
110
  const levels = useMemo(() => resolveLevels(items, path), [items, path]);
112
111
 
113
112
  const refFor = (key: string): RefObject<HTMLElement> => {
@@ -115,6 +114,7 @@ export function Dropdown({
115
114
  return refs.current.get(key)!;
116
115
  };
117
116
  const triggerRef = refFor('trigger');
117
+ const timings = resolveMotionTiming(animation, DROPDOWN_TIMING, triggerRef.current);
118
118
 
119
119
  const dismiss = (refocus: boolean) => {
120
120
  setPath([]);
@@ -178,7 +178,7 @@ export function Dropdown({
178
178
  triggerRef,
179
179
  activateOn,
180
180
  })}
181
- <OverlayPortal>
181
+ <OverlayPortal scope={triggerRef.current}>
182
182
  <Presence>
183
183
  {open &&
184
184
  levels.map((level, depth) => (
@@ -186,8 +186,8 @@ export function Dropdown({
186
186
  key={level.key}
187
187
  chain={chain}
188
188
  depth={depth}
189
- animate={popIn(UIMotion.scale.floating, timings.open)}
190
- exit={popOut(UIMotion.scale.floating, timings.close)}
189
+ animate={popIn(motionFor(triggerRef.current).scale.floating, timings.open)}
190
+ exit={popOut(motionFor(triggerRef.current).scale.floating, timings.close)}
191
191
  />
192
192
  ))}
193
193
  </Presence>
@@ -1,4 +1,4 @@
1
- @layer zyncat.tokens, zyncat.components;
1
+ @layer zyncat.reset, zyncat.tokens, zyncat.components;
2
2
 
3
3
  @layer zyncat.components {
4
4
  .zc-dropdown__menu {
@@ -4,12 +4,15 @@ import { useId, useRef } from 'react';
4
4
 
5
5
  import { Motion } from '../../../../motion/element';
6
6
  import { GlidePill, useGlide, type GlideApi } from '../../../../motion/glide';
7
- import { UIMotion as SM } from '../../../../tokens/motion-tokens';
7
+ import { motionFor } from '../../../../tokens/motion-tokens';
8
8
  import { activationProps, type ActivateOn } from '../../../internal/utils/activation';
9
9
  import { CATEGORY_ICON_ATTRS, CATEGORY_ICONS } from '../category-icons';
10
10
  import { useCategories, useIsActiveCategory, type EmojiPickerStore } from './useEmojiPicker';
11
11
 
12
- const railGlide = () => ({ timing: { duration: SM.dur.base, ease: SM.ease.standard } });
12
+ const railGlide = (scope?: Element | null) => {
13
+ const motion = motionFor(scope);
14
+ return { timing: { duration: motion.dur.base, ease: motion.ease.standard } };
15
+ };
13
16
 
14
17
  interface CategoryProps {
15
18
  store: EmojiPickerStore;
@@ -17,9 +20,10 @@ interface CategoryProps {
17
20
  railId: string;
18
21
  glide: GlideApi;
19
22
  activateOn?: ActivateOn;
23
+ scope: Element | null;
20
24
  }
21
25
 
22
- function Category({ store, categoryKey, railId, glide, activateOn }: CategoryProps) {
26
+ function Category({ store, categoryKey, railId, glide, activateOn, scope }: CategoryProps) {
23
27
  const isActive = useIsActiveCategory(store, categoryKey);
24
28
 
25
29
  return (
@@ -42,7 +46,7 @@ function Category({ store, categoryKey, railId, glide, activateOn }: CategoryPro
42
46
  <Motion
43
47
  as="span"
44
48
  layoutId={railId}
45
- layoutTransition={railGlide()}
49
+ layoutTransition={railGlide(scope)}
46
50
  className="zc-on-emoji-cat-rail"
47
51
  aria-hidden="true"
48
52
  />
@@ -70,7 +74,15 @@ export function CategoryBar({ store, activateOn }: { store: EmojiPickerStore; ac
70
74
  >
71
75
  <GlidePill className="zc-on-emoji-bar-marker" glide={glide} />
72
76
  {categories.map((key) => (
73
- <Category key={key} store={store} categoryKey={key} railId={railId} glide={glide} activateOn={activateOn} />
77
+ <Category
78
+ key={key}
79
+ store={store}
80
+ categoryKey={key}
81
+ railId={railId}
82
+ glide={glide}
83
+ activateOn={activateOn}
84
+ scope={barRef.current}
85
+ />
74
86
  ))}
75
87
  </div>
76
88
  );
@@ -1,5 +1,5 @@
1
1
  import { animate, flip, measure, set } from '../../../engine';
2
- import { UIMotion as SM } from '../../../tokens/motion-tokens';
2
+ import { motionFor } from '../../../tokens/motion-tokens';
3
3
  import type { EmojiData } from './data';
4
4
  import { el } from './dom';
5
5
  import type { GetEmojiUrl } from './types';
@@ -50,18 +50,19 @@ export function createScaffold(root: HTMLElement, emojiData: EmojiData, getEmoji
50
50
 
51
51
  let hadFocus = false;
52
52
  const positionMarker = (btn: HTMLButtonElement | null) => {
53
+ const motion = motionFor(scroll);
53
54
  if (!btn?.offsetHeight) {
54
- animate(marker, { opacity: [0], timing: SM.t.exit });
55
+ animate(marker, { opacity: [0], timing: motion.t.exit });
55
56
  hadFocus = false;
56
57
  return;
57
58
  }
58
59
  const from = hadFocus ? measure(marker) : null;
59
60
  const tile = offsetWithinScroll(btn);
60
61
  set(marker, { x: [tile.left], y: [tile.top], width: [btn.offsetWidth], height: [btn.offsetHeight] });
61
- animate(marker, { opacity: [MARKER_OPACITY], timing: { duration: SM.dur.fast, ease: SM.ease.standard } });
62
+ animate(marker, { opacity: [MARKER_OPACITY], timing: { duration: motion.dur.fast, ease: motion.ease.standard } });
62
63
  hadFocus = true;
63
- if (from && !SM.reduced)
64
- flip(marker, from, { size: 'none', timing: { duration: SM.dur.base, ease: SM.ease.standard } });
64
+ if (from && !motion.reduced)
65
+ flip(marker, from, { size: 'none', timing: { duration: motion.dur.base, ease: motion.ease.standard } });
65
66
  };
66
67
 
67
68
  const mountMarker = () => {
@@ -1,4 +1,4 @@
1
- @layer zyncat.tokens, zyncat.components;
1
+ @layer zyncat.reset, zyncat.tokens, zyncat.components;
2
2
 
3
3
  @layer zyncat.components {
4
4
  .zc-on-emoji,
@@ -67,7 +67,7 @@ export function Modal({
67
67
  const autoId = useId();
68
68
  const panelId = id || 'modal-' + autoId;
69
69
  const close = () => setOpen(false);
70
- const timings = resolveMotionTiming(animation, OV_TAKEOVER_TIMING);
70
+ const timings = resolveMotionTiming(animation, OV_TAKEOVER_TIMING, container ?? triggerRef.current);
71
71
 
72
72
  return (
73
73
  <Fragment>
@@ -79,7 +79,7 @@ export function Modal({
79
79
  triggerRef,
80
80
  activateOn,
81
81
  })}
82
- <OverlayPortal container={container}>
82
+ <OverlayPortal container={container} scope={triggerRef.current}>
83
83
  <Presence>
84
84
  {open && (
85
85
  <ModalShell
@@ -1,4 +1,4 @@
1
- @layer zyncat.tokens, zyncat.components;
1
+ @layer zyncat.reset, zyncat.tokens, zyncat.components;
2
2
 
3
3
  @layer zyncat.components {
4
4
  .zc-overlay-layer--modal {
@@ -1,4 +1,4 @@
1
- @layer zyncat.tokens, zyncat.components;
1
+ @layer zyncat.reset, zyncat.tokens, zyncat.components;
2
2
 
3
3
  @layer zyncat.components {
4
4
  .zc-pgn {
@@ -10,7 +10,7 @@ import { Presence } from '../../../motion/presence';
10
10
  import { popIn, popOut } from '../../../motion/presets';
11
11
  import type { DisableableAnimation } from '../../../motion/timing';
12
12
  import { useMotion, type MotionSpecs } from '../../../motion/use-motion';
13
- import { UIMotion } from '../../../tokens/motion-tokens';
13
+ import { motionFor } from '../../../tokens/motion-tokens';
14
14
  import { useControllable } from '../../internal/hooks/use-controllable';
15
15
  import { useReturnFocus } from '../../internal/overlay/focus';
16
16
  import { ovCloneTrigger, OverlayPortal, useOutsidePress, useOverlayEntry } from '../../internal/overlay/layer';
@@ -126,7 +126,7 @@ export function Popover({
126
126
  const autoId = useId();
127
127
  const panelId = id || 'popover-' + autoId;
128
128
  const close = () => setOpen(false);
129
- const timings = resolveMotionTiming(animation, POPOVER_TIMING);
129
+ const timings = resolveMotionTiming(animation, POPOVER_TIMING, triggerRef.current);
130
130
 
131
131
  return (
132
132
  <Fragment>
@@ -138,13 +138,13 @@ export function Popover({
138
138
  triggerRef,
139
139
  activateOn,
140
140
  })}
141
- <OverlayPortal>
141
+ <OverlayPortal scope={triggerRef.current}>
142
142
  <Presence>
143
143
  {open && (
144
144
  <PopoverPanel
145
145
  key="panel"
146
- animate={popIn(UIMotion.scale.floating, timings.open)}
147
- exit={popOut(UIMotion.scale.floating, timings.close)}
146
+ animate={popIn(motionFor(triggerRef.current).scale.floating, timings.open)}
147
+ exit={popOut(motionFor(triggerRef.current).scale.floating, timings.close)}
148
148
  panelId={panelId}
149
149
  side={side}
150
150
  align={align}
@@ -1,4 +1,4 @@
1
- @layer zyncat.tokens, zyncat.components;
1
+ @layer zyncat.reset, zyncat.tokens, zyncat.components;
2
2
 
3
3
  @layer zyncat.components {
4
4
  .zc-overlay-popover {
@@ -7,7 +7,7 @@ import { resolveMotionTiming } from '../../../../motion/motion-timing';
7
7
  import { Presence } from '../../../../motion/presence';
8
8
  import type { DisableableAnimation } from '../../../../motion/timing';
9
9
  import { useMotion, type MotionSpecs } from '../../../../motion/use-motion';
10
- import { UIMotion, type MotionTransition } from '../../../../tokens/motion-tokens';
10
+ import { motionFor, type MotionTransition } from '../../../../tokens/motion-tokens';
11
11
  import { menuHighlightAttrs, type MenuHighlightProps } from '../../../internal/menu/highlight';
12
12
  import { OverlayPortal, useOutsidePress, useOverlayEntry } from '../../../internal/overlay/layer';
13
13
  import { useAnchorPosition } from '../../../internal/overlay/position';
@@ -17,17 +17,22 @@ const SELECT_MENU_TIMING = {
17
17
  close: { duration: 'base', ease: 'exit' },
18
18
  } as const;
19
19
 
20
- function selectMenuLayers(animation: DisableableAnimation | undefined, dir: 'open' | 'close'): Layer[] {
21
- const t = resolveMotionTiming(animation, SELECT_MENU_TIMING)[dir];
22
- const fade = (d: MotionTransition) => ({ duration: d.duration === 0 ? 0 : UIMotion.dur.fast, ease: d.ease });
23
- const drop = -UIMotion.dist.sm;
20
+ function selectMenuLayers(
21
+ animation: DisableableAnimation | undefined,
22
+ dir: 'open' | 'close',
23
+ scope?: Element | null,
24
+ ): Layer[] {
25
+ const motion = motionFor(scope);
26
+ const t = resolveMotionTiming(animation, SELECT_MENU_TIMING, scope)[dir];
27
+ const fade = (d: MotionTransition) => ({ duration: d.duration === 0 ? 0 : motion.dur.fast, ease: d.ease });
28
+ const drop = -motion.dist.sm;
24
29
  return dir === 'open'
25
30
  ? [
26
- { y: [drop, 0], scale: [UIMotion.scale.floating, 1], timing: t },
31
+ { y: [drop, 0], scale: [motion.scale.floating, 1], timing: t },
27
32
  { opacity: [0, 1], timing: fade(t) },
28
33
  ]
29
34
  : [
30
- { y: [drop], scale: [UIMotion.scale.floating], timing: t },
35
+ { y: [drop], scale: [motion.scale.floating], timing: t },
31
36
  { opacity: [0], timing: fade(t) },
32
37
  ];
33
38
  }
@@ -94,13 +99,13 @@ export function SelectMenu({
94
99
  children,
95
100
  }: SelectMenuProps) {
96
101
  return (
97
- <OverlayPortal>
102
+ <OverlayPortal scope={triggerRef.current}>
98
103
  <Presence>
99
104
  {open && (
100
105
  <MenuSurface
101
106
  key="menu"
102
- animate={selectMenuLayers(animation, 'open')}
103
- exit={selectMenuLayers(animation, 'close')}
107
+ animate={selectMenuLayers(animation, 'open', triggerRef.current)}
108
+ exit={selectMenuLayers(animation, 'close', triggerRef.current)}
104
109
  menuId={menuId}
105
110
  requestClose={requestClose}
106
111
  triggerRef={triggerRef}
@@ -1,4 +1,4 @@
1
- @layer zyncat.tokens, zyncat.components;
1
+ @layer zyncat.reset, zyncat.tokens, zyncat.components;
2
2
 
3
3
  @layer zyncat.components {
4
4
  .zc-select {
@@ -116,7 +116,7 @@ export function Sheet({
116
116
  const autoId = useId();
117
117
  const panelId = id || 'sheet-' + autoId;
118
118
  const close = () => setOpen(false);
119
- const timings = resolveMotionTiming(animation, SHEET_TIMING);
119
+ const timings = resolveMotionTiming(animation, SHEET_TIMING, container ?? triggerRef.current);
120
120
  const axis = side === 'bottom' ? 'y' : 'x';
121
121
 
122
122
  return (
@@ -129,7 +129,7 @@ export function Sheet({
129
129
  triggerRef,
130
130
  activateOn,
131
131
  })}
132
- <OverlayPortal container={container}>
132
+ <OverlayPortal container={container} scope={triggerRef.current}>
133
133
  <Presence>
134
134
  {open && (
135
135
  <SheetShell
@@ -1,4 +1,4 @@
1
- @layer zyncat.tokens, zyncat.components;
1
+ @layer zyncat.reset, zyncat.tokens, zyncat.components;
2
2
 
3
3
  @layer zyncat.components {
4
4
  .zc-overlay-layer--sheet-right {
@@ -1,4 +1,4 @@
1
- @layer zyncat.tokens, zyncat.components;
1
+ @layer zyncat.reset, zyncat.tokens, zyncat.components;
2
2
 
3
3
  @layer zyncat.components {
4
4
  .zc-tbl,
@@ -41,7 +41,7 @@
41
41
  min-height: 0;
42
42
  overflow: auto;
43
43
  overscroll-behavior-x: contain;
44
- scroll-padding: var(--ring-width);
44
+ scroll-padding: var(--ring-gutter);
45
45
  }
46
46
  .zc-tbl[data-y-scroll] .zc-tbl__scroll {
47
47
  overscroll-behavior-y: contain;
@@ -18,14 +18,12 @@ import { Motion } from '../../../motion/element';
18
18
  import { GlidePill, useGlide } from '../../../motion/glide';
19
19
  import { resolveMotionTiming } from '../../../motion/motion-timing';
20
20
  import { type DisableableAnimation } from '../../../motion/timing';
21
- import { UIMotion } from '../../../tokens/motion-tokens';
21
+ import { motionFor } from '../../../tokens/motion-tokens';
22
22
  import { useScrollEdges } from '../../internal/hooks/use-scroll-edges';
23
23
  import { IconSlot } from '../../internal/icon/IconSlot';
24
24
  import { activationProps, type ActivateOn } from '../../internal/utils/activation';
25
25
  import { cx } from '../../internal/utils/cx';
26
26
 
27
- const SM = UIMotion;
28
-
29
27
  /** One tab in the row. */
30
28
  export interface TabItem {
31
29
  /** Stable identity - also used in the tab/panel id pair. */
@@ -109,7 +107,9 @@ export function Tabs({
109
107
  const next = { x: el.offsetLeft, w: el.offsetWidth };
110
108
  ink.style.opacity = '1';
111
109
 
112
- if (!animated || !placedRef.current || SM.reduced) {
110
+ const motion = motionFor(list);
111
+
112
+ if (!animated || !placedRef.current || motion.reduced) {
113
113
  set(ink, { x: [next.x], width: [next.w] });
114
114
  } else {
115
115
  const lr = list.getBoundingClientRect();
@@ -122,7 +122,11 @@ export function Tabs({
122
122
  animate(ink, {
123
123
  x: [cur.x, lead, next.x],
124
124
  width: [cur.w, span, next.w],
125
- timing: { duration: SM.dur.slow, times: [0, 0.55, 1], ease: [SM.ease.standard, SM.ease.entrance] },
125
+ timing: {
126
+ duration: motion.dur.slow,
127
+ times: [0, 0.55, 1],
128
+ ease: [motion.ease.standard, motion.ease.entrance],
129
+ },
126
130
  });
127
131
  }
128
132
  }
@@ -138,7 +142,7 @@ export function Tabs({
138
142
  const l = listRef.current,
139
143
  el = value != null ? tabRefs.current[value] : null;
140
144
  if (l && el && l.scrollWidth > l.clientWidth) {
141
- const behavior: ScrollBehavior = SM.reduced ? 'auto' : 'smooth';
145
+ const behavior: ScrollBehavior = motionFor(l).reduced ? 'auto' : 'smooth';
142
146
  if (el.offsetLeft < l.scrollLeft + TABS_EDGE_PAD) {
143
147
  l.scrollTo({ left: el.offsetLeft - TABS_EDGE_PAD, behavior });
144
148
  } else if (el.offsetLeft + el.offsetWidth > l.scrollLeft + l.clientWidth - TABS_EDGE_PAD) {
@@ -263,10 +267,12 @@ const TABPANEL_TIMING = {
263
267
  } as const;
264
268
 
265
269
  export function TabPanel({ tab, name, dir = 0, className = '', style, children, animation, htmlProps }: TabPanelProps) {
266
- const enter = resolveMotionTiming(animation, TABPANEL_TIMING).open;
270
+ const panelRef = useRef<HTMLElement>(null);
271
+ const enter = resolveMotionTiming(animation, TABPANEL_TIMING, panelRef.current).open;
267
272
 
268
273
  return (
269
274
  <Motion
275
+ ref={panelRef}
270
276
  layout
271
277
  layoutTransition={{ size: 'morph', timing: enter }}
272
278
  role="tabpanel"
@@ -1,10 +1,9 @@
1
- @layer zyncat.tokens, zyncat.components;
1
+ @layer zyncat.reset, zyncat.tokens, zyncat.components;
2
2
 
3
3
  @layer zyncat.components {
4
4
  .zc-tabs {
5
5
  /* 2px, not --border-emphasis: 1.5px renders as sub-pixel fuzz on 1x screens. */
6
6
  --tabs-ink-h: 2px;
7
- /* The pill variant's segment radius. The track rounds one pad wider, staying concentric. */
8
7
  --tabs-pill-radius: var(--radius-md);
9
8
  position: relative;
10
9
  }
@@ -26,9 +25,8 @@
26
25
  scrollbar-width: none;
27
26
  margin-inline: calc(var(--space-2) * -1);
28
27
  padding-inline: var(--space-2);
29
- margin-block: calc(var(--ring-width) * -1);
30
- padding-block: var(--ring-width);
31
- scroll-padding: var(--ring-width);
28
+ padding-block: max(var(--ring-gutter), calc(var(--tabs-ink-h) + var(--space-px)));
29
+ scroll-padding-inline: var(--space-2);
32
30
 
33
31
  --tabs-fade-start: 0px;
34
32
  --tabs-fade-end: 0px;
@@ -55,15 +53,18 @@
55
53
  border: 0;
56
54
  background: none;
57
55
  margin: 0;
58
- padding: 0 0 calc(var(--tabs-ink-h) + var(--space-px));
56
+ padding: 0;
59
57
  flex: none;
60
58
  display: block;
61
59
  font-family: var(--font-body);
62
60
  cursor: pointer;
63
61
  -webkit-tap-highlight-color: transparent;
62
+ border-radius: var(--radius-md);
63
+ outline: var(--ring-rest);
64
+ transition: var(--transition-control);
64
65
  }
65
66
  .zc-tab:focus-visible {
66
- outline: none;
67
+ outline: var(--ring-accent);
67
68
  }
68
69
 
69
70
  .zc-tab__pad {
@@ -81,7 +82,6 @@
81
82
  transition:
82
83
  var(--transition-control),
83
84
  transform var(--duration-fast) var(--ease-standard);
84
- outline: var(--ring-rest);
85
85
  }
86
86
  .zc-tab__pad .zc-icon {
87
87
  display: inline-flex;
@@ -97,9 +97,6 @@
97
97
  .zc-tab.zc-is-selected:hover:not(:disabled) .zc-tab__pad {
98
98
  color: var(--text-strong);
99
99
  }
100
- .zc-tab:focus-visible .zc-tab__pad {
101
- outline: var(--ring-accent);
102
- }
103
100
  .zc-tab:disabled {
104
101
  cursor: not-allowed;
105
102
  }
@@ -142,7 +139,7 @@
142
139
  .zc-tabs__ink {
143
140
  position: absolute;
144
141
  left: 0;
145
- bottom: var(--ring-width);
142
+ bottom: 0;
146
143
  height: var(--tabs-ink-h);
147
144
  border-radius: var(--radius-full);
148
145
  background: var(--accent);
@@ -170,7 +167,7 @@
170
167
  }
171
168
 
172
169
  .zc-tabs--pill .zc-tab {
173
- padding: 0;
170
+ border-radius: var(--tabs-pill-radius);
174
171
  }
175
172
  .zc-tabs--pill .zc-tab__pad {
176
173
  z-index: 1;
@@ -198,7 +195,6 @@
198
195
  }
199
196
  .zc-tab-panel:focus-visible {
200
197
  outline: var(--ring-accent);
201
- outline-offset: var(--ring-inset);
202
198
  border-radius: var(--radius-md);
203
199
  }
204
200
  .zc-tab-panel__inner {
@@ -0,0 +1,133 @@
1
+ 'use client';
2
+
3
+ import './theme-switcher.css';
4
+
5
+ import { useId, type CSSProperties, type HTMLAttributes, type KeyboardEvent, type MouseEvent } from 'react';
6
+
7
+ import type { DataAttributes } from '../../../dom-props';
8
+ import { Motion } from '../../../motion/element';
9
+ import { setThemePreference, type Polarity, type PolarityPreference } from '../../../tokens/theme-store';
10
+ import { useTheme, useThemeTarget } from '../../../tokens/theme-sync';
11
+ import { cx } from '../../internal/utils/cx';
12
+
13
+ const POLARITIES: readonly PolarityPreference[] = ['system', 'light', 'dark'];
14
+ const CAPTIONS: Record<PolarityPreference, string> = { system: 'System', light: 'Light', dark: 'Dark' };
15
+ const STEPS: Record<string, number[]> = { ArrowUp: [-1, 0], ArrowDown: [1, 0], ArrowLeft: [0, -1], ArrowRight: [0, 1] };
16
+
17
+ const focusOnMount = (node: HTMLElement | null) => node?.focus({ preventScroll: true });
18
+
19
+ const centreOf = (element: Element): [number, number] => {
20
+ const box = element.getBoundingClientRect();
21
+ return [box.left + box.width / 2, box.top + box.height / 2];
22
+ };
23
+
24
+ export interface ThemeGridProps {
25
+ /** Overrides the palette's own `name`, keyed like `themes`. For names that come from a translation. */
26
+ labels?: Record<string, string>;
27
+ /** Accessible name of the radio group. @default 'Theme' */
28
+ label?: string;
29
+ /** Focus the selected card on mount - for a grid that opens inside an overlay. @default false */
30
+ autoFocus?: boolean;
31
+ /** Enter or Tab on a card. `ThemeSwitcher` closes its panel with it; inline, leave it unset. */
32
+ onDismiss?: () => void;
33
+ /** Extra class(es) merged onto the grid. */
34
+ className?: string;
35
+ /** Inline styles merged onto the grid. */
36
+ style?: CSSProperties;
37
+ /** Standard <div> attributes (aria-*, data-*, ...) forwarded to the grid. */
38
+ htmlProps?: HTMLAttributes<HTMLDivElement> & DataAttributes;
39
+ }
40
+
41
+ function Mini({ palette, polarity, half }: { palette: string; polarity: Polarity; half?: boolean }) {
42
+ return (
43
+ <span
44
+ className={cx('zc-theme-switcher__mini', half && 'zc-theme-switcher__mini--half')}
45
+ data-theme={palette}
46
+ data-polarity={polarity}
47
+ />
48
+ );
49
+ }
50
+
51
+ export function ThemeGrid({
52
+ labels,
53
+ label = 'Theme',
54
+ autoFocus = false,
55
+ onDismiss,
56
+ className,
57
+ style,
58
+ htmlProps,
59
+ }: ThemeGridProps) {
60
+ const { themes, themeNames } = useTheme();
61
+ const { theme, polarity } = useThemeTarget();
62
+ const ringId = useId();
63
+ const nameOf = (palette: string) => labels?.[palette] ?? themeNames[palette] ?? palette;
64
+
65
+ const onKeyDown = (event: KeyboardEvent, row: number, col: number) => {
66
+ if (event.key === 'Enter' || event.key === 'Tab') {
67
+ if (!onDismiss) return;
68
+ event.preventDefault();
69
+ onDismiss();
70
+ return;
71
+ }
72
+ const step = STEPS[event.key];
73
+ if (!step) return;
74
+ event.preventDefault();
75
+ setThemePreference(
76
+ {
77
+ theme: themes[(row + step[0] + themes.length) % themes.length],
78
+ polarity: POLARITIES[(col + step[1] + POLARITIES.length) % POLARITIES.length],
79
+ },
80
+ { origin: centreOf(event.currentTarget) },
81
+ );
82
+ };
83
+
84
+ const onPick = (event: MouseEvent<HTMLButtonElement>, palette: string, choice: PolarityPreference) =>
85
+ setThemePreference({ theme: palette, polarity: choice }, { origin: centreOf(event.currentTarget) });
86
+
87
+ return (
88
+ <div
89
+ {...htmlProps}
90
+ data-theme-lead=""
91
+ role="radiogroup"
92
+ aria-label={label}
93
+ style={style}
94
+ className={cx('zc-theme-switcher__grid', className)}
95
+ >
96
+ {themes.map((palette, row) => (
97
+ <div key={palette} className="zc-theme-switcher__row">
98
+ {themes.length > 1 && (
99
+ <span className="zc-theme-switcher__row-label" aria-hidden="true">
100
+ {nameOf(palette)}
101
+ </span>
102
+ )}
103
+ {POLARITIES.map((choice, col) => {
104
+ const checked = palette === theme && choice === polarity;
105
+ return (
106
+ <button
107
+ key={choice}
108
+ ref={checked && autoFocus ? focusOnMount : undefined}
109
+ type="button"
110
+ role="radio"
111
+ aria-checked={checked}
112
+ aria-label={`${nameOf(palette)}, ${CAPTIONS[choice]}`}
113
+ tabIndex={checked ? 0 : -1}
114
+ className={cx('zc-theme-switcher__card', checked && 'zc-is-selected')}
115
+ onClick={(event) => onPick(event, palette, choice)}
116
+ onKeyDown={(event) => onKeyDown(event, row, col)}
117
+ >
118
+ <span className="zc-theme-switcher__preview">
119
+ <Mini palette={palette} polarity={choice === 'dark' ? 'dark' : 'light'} />
120
+ {choice === 'system' && <Mini palette={palette} polarity="dark" half />}
121
+ {checked && (
122
+ <Motion as="span" layoutId={ringId} className="zc-theme-switcher__ring" aria-hidden="true" />
123
+ )}
124
+ </span>
125
+ {CAPTIONS[choice]}
126
+ </button>
127
+ );
128
+ })}
129
+ </div>
130
+ ))}
131
+ </div>
132
+ );
133
+ }
@@ -0,0 +1,20 @@
1
+ # ThemeGrid - @zyncat/ui/theme-grid
2
+
3
+ Group: overlays
4
+ Docs: https://ui.zyncat.app/theme-switcher
5
+
6
+ The theme picker without a surface: a radio grid of miniatures, one card per palette and side plus a split System card, each drawn from that theme's real tokens.
7
+
8
+ This is what `ThemeSwitcher` puts in its popover, exported on its own so it can sit in a settings page,
9
+ a `Sheet`, a `Dialog` or a preferences panel. It imports no overlay, paints no background, and needs no
10
+ props: mount `ZyncatTheme` once and the grid lists every palette it declared, `default` first. A click
11
+ applies the theme live. Arrow keys move as a radio group and select as they go - left and right change
12
+ the side, up and down the palette. Each palette shows its own `name`; `labels` overrides that per key,
13
+ for names that come from a translation. `label` is the accessible name of the group, and `autoFocus`
14
+ puts focus on the selected card at mount, for a grid
15
+ that opens inside an overlay; leave it off inline. `onDismiss` fires on Enter or Tab, for the surface
16
+ around it to close - without it both keys stay inert.
17
+
18
+ ```tsx
19
+ <ThemeGrid />
20
+ ```