@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
@@ -0,0 +1,75 @@
1
+ 'use client';
2
+
3
+ import './theme-switcher.css';
4
+
5
+ import { useState, type CSSProperties } from 'react';
6
+
7
+ import type { DisableableAnimation } from '../../../motion/timing';
8
+ import { useTheme, useThemeTarget } from '../../../tokens/theme-sync';
9
+ import { cx } from '../../internal/utils/cx';
10
+ import { Button, type ButtonProps } from '../../primitives/button/Button';
11
+ import { Popover } from '../popover/Popover';
12
+ import { ThemeGrid, type ThemeGridProps } from './ThemeGrid';
13
+
14
+ const CAPTIONS: Record<string, string> = { system: 'System', light: 'Light', dark: 'Dark' };
15
+
16
+ export interface ThemeSwitcherProps {
17
+ /** Overrides the palette's own `name`, keyed like `themes`. For names that come from a translation. */
18
+ labels?: ThemeGridProps['labels'];
19
+ /** Accessible name of the control and its grid. @default 'Theme' */
20
+ label?: string;
21
+ /** Preferred side of the panel; flips to the opposite side when cramped. @default 'bottom' */
22
+ side?: 'top' | 'bottom' | 'left' | 'right';
23
+ /** Cross-axis alignment of the panel against the chip. @default 'end' */
24
+ align?: 'start' | 'center' | 'end';
25
+ /** Open/close timing - motion tokens only, or `null` to disable. @default open 'base'/'entrance', close 'fast'/'exit' */
26
+ animation?: DisableableAnimation;
27
+ /** Extra class(es) merged onto the chip. */
28
+ className?: string;
29
+ /** Inline styles merged onto the chip. */
30
+ style?: CSSProperties;
31
+ /** Standard <button> attributes (aria-*, data-*, ...) forwarded to the chip. */
32
+ htmlProps?: ButtonProps['htmlProps'];
33
+ }
34
+
35
+ export function ThemeSwitcher({
36
+ labels,
37
+ label = 'Theme',
38
+ side = 'bottom',
39
+ align = 'end',
40
+ animation,
41
+ className,
42
+ style,
43
+ htmlProps,
44
+ }: ThemeSwitcherProps) {
45
+ const [open, setOpen] = useState(false);
46
+ const { themeNames } = useTheme();
47
+ const { theme, polarity } = useThemeTarget();
48
+
49
+ return (
50
+ <Popover
51
+ open={open}
52
+ onOpenChange={setOpen}
53
+ side={side}
54
+ align={align}
55
+ animation={animation}
56
+ htmlProps={{ className: 'zc-theme-switcher__panel', 'data-theme-lead': '' }}
57
+ trigger={
58
+ <Button
59
+ variant="ghost"
60
+ size="sm"
61
+ className={cx('zc-theme-switcher', className)}
62
+ style={style}
63
+ aria-label={`${label}: ${labels?.[theme] ?? themeNames[theme] ?? theme}, ${CAPTIONS[polarity]}`}
64
+ htmlProps={{ 'data-theme-lead': '', ...htmlProps }}
65
+ >
66
+ <span className="zc-theme-switcher__preview zc-theme-switcher__preview--chip" aria-hidden="true">
67
+ <span className="zc-theme-switcher__mini" />
68
+ </span>
69
+ </Button>
70
+ }
71
+ >
72
+ <ThemeGrid labels={labels} label={label} autoFocus onDismiss={() => setOpen(false)} />
73
+ </Popover>
74
+ );
75
+ }
@@ -0,0 +1,21 @@
1
+ # ThemeSwitcher - @zyncat/ui/theme-switcher
2
+
3
+ Group: overlays
4
+ Docs: https://ui.zyncat.app/theme-switcher
5
+
6
+ The theme control: a chip painted in the live palette opens a grid of miniatures, one card per palette and side plus a split System card, each drawn from that theme's real tokens.
7
+
8
+ Needs no props: mount `ZyncatTheme` once for the palettes and the flash-free boot, and the grid lists
9
+ every palette it declared, `default` first. A click applies the theme live and leaves the panel open to
10
+ compare; Escape, Enter, Tab or an outside press closes it and focus returns to the chip. Arrow keys
11
+ move through the grid as a radio group and select as they go - left and right change the side, up and
12
+ down the palette. Each palette shows its own `name`; `labels` overrides that per key, for names that
13
+ come from a translation. `label` is the accessible name, `side` and `align` place the panel,
14
+ `animation` retimes it. The chip is the miniature under the
15
+ page's current tokens, so it is right before hydration and after a change made elsewhere. For the grid
16
+ on its own surface - a settings page, a `Sheet` - reach for `@zyncat/ui/theme-grid`, which is the panel
17
+ body without the popover.
18
+
19
+ ```tsx
20
+ <ThemeSwitcher align="end" />
21
+ ```
@@ -0,0 +1,107 @@
1
+ @layer zyncat.reset, zyncat.tokens, zyncat.components;
2
+
3
+ @layer zyncat.components {
4
+ .zc-theme-switcher.zc-btn {
5
+ padding-inline: var(--space-1);
6
+ }
7
+
8
+ .zc-theme-switcher__preview {
9
+ --_theme-switcher-unit: 4px;
10
+ --_theme-switcher-stroke: 2px;
11
+ position: relative;
12
+ display: grid;
13
+ width: calc(19 * var(--_theme-switcher-unit));
14
+ height: calc(12 * var(--_theme-switcher-unit));
15
+ border: var(--border-hairline) solid var(--border-default);
16
+ border-radius: var(--radius-sm);
17
+ background: var(--bg-app);
18
+ box-shadow: var(--shadow-xs);
19
+ transition:
20
+ transform var(--duration-fast) var(--ease-entrance),
21
+ box-shadow var(--duration-base) var(--ease-entrance),
22
+ border-color var(--duration-fast) var(--ease-standard);
23
+ }
24
+ .zc-theme-switcher__preview--chip {
25
+ --_theme-switcher-unit: 1.8px;
26
+ border-color: var(--border-strong);
27
+ }
28
+
29
+ .zc-theme-switcher__mini {
30
+ grid-area: 1 / 1;
31
+ border-radius: calc(var(--radius-sm) - var(--border-hairline));
32
+ background:
33
+ radial-gradient(circle closest-side, var(--accent) 92%, transparent) 8% 8% / 6.5% 10.5%,
34
+ linear-gradient(var(--text-strong), var(--text-strong)) 24% 11% / 24% var(--_theme-switcher-stroke),
35
+ linear-gradient(var(--text-secondary), var(--text-secondary)) 24% 41% / 57% var(--_theme-switcher-stroke),
36
+ linear-gradient(var(--accent-fill), var(--accent-fill)) 86% 83% / 26% 14.5%,
37
+ linear-gradient(var(--border-subtle), var(--border-subtle)) 0 25% / 100% var(--border-hairline),
38
+ linear-gradient(var(--bg-surface), var(--bg-surface)) 0 0 / 100% 25%,
39
+ var(--bg-app);
40
+ background-repeat: no-repeat;
41
+ }
42
+ .zc-theme-switcher__mini--half {
43
+ clip-path: polygon(58% 0, 100% 0, 100% 100%, 42% 100%);
44
+ }
45
+ .zc-theme-switcher__ring {
46
+ position: absolute;
47
+ inset: calc(-0.75 * var(--_theme-switcher-unit));
48
+ border: var(--border-emphasis) solid var(--accent);
49
+ border-radius: calc(var(--radius-sm) + 0.75 * var(--_theme-switcher-unit));
50
+ pointer-events: none;
51
+ }
52
+
53
+ .zc-theme-switcher__panel {
54
+ padding: var(--space-2);
55
+ background: var(--bg-surface-raised);
56
+ border: var(--border-hairline) solid var(--border-default);
57
+ border-radius: var(--radius-lg);
58
+ box-shadow: var(--shadow-lg);
59
+ color: var(--text-body);
60
+ }
61
+ .zc-theme-switcher__grid {
62
+ display: grid;
63
+ gap: var(--space-2);
64
+ }
65
+ .zc-theme-switcher__row {
66
+ display: grid;
67
+ grid-template-columns: repeat(3, auto);
68
+ gap: var(--space-px) var(--space-1);
69
+ }
70
+ .zc-theme-switcher__row-label {
71
+ grid-column: 1 / -1;
72
+ padding: var(--space-1) var(--space-1) 0;
73
+ font: var(--type-micro);
74
+ color: var(--text-subtle);
75
+ }
76
+ .zc-theme-switcher__card {
77
+ appearance: none;
78
+ display: grid;
79
+ justify-items: center;
80
+ gap: var(--space-1);
81
+ padding: var(--space-1);
82
+ border: 0;
83
+ border-radius: var(--radius-md);
84
+ background: transparent;
85
+ font: var(--type-micro);
86
+ color: var(--text-muted);
87
+ cursor: pointer;
88
+ transition: var(--transition-colors);
89
+ outline: var(--ring-rest);
90
+ }
91
+ .zc-theme-switcher__card:hover,
92
+ .zc-theme-switcher__card.zc-is-selected {
93
+ color: var(--text-strong);
94
+ }
95
+ .zc-theme-switcher__card:focus-visible {
96
+ outline: var(--ring-accent);
97
+ }
98
+ .zc-theme-switcher__card:hover .zc-theme-switcher__preview {
99
+ transform: translateY(calc(-2 * var(--space-px))) scale(1.06);
100
+ border-color: var(--border-strong);
101
+ box-shadow: var(--shadow-md);
102
+ }
103
+ .zc-theme-switcher__card:active .zc-theme-switcher__preview {
104
+ transform: none;
105
+ box-shadow: var(--shadow-xs);
106
+ }
107
+ }
@@ -31,6 +31,7 @@ import { Icon, type IconName } from '../../internal/icon/Icon';
31
31
  import { cx } from '../../internal/utils/cx';
32
32
  import { tokenPx } from '../../internal/utils/token-px';
33
33
  import { Button } from '../../primitives/button/Button';
34
+ import { Spinner } from '../../primitives/spinner/Spinner';
34
35
  import { DEFAULT_TOASTER_CONFIG, UIToast, type ToasterConfig, type ToastRecord, type ToastTone } from './toast-store';
35
36
 
36
37
  const SM = UIMotion;
@@ -187,7 +188,7 @@ function ToastBody({ t }: { t: ToastRecord }) {
187
188
  {t.tone !== 'default' && (
188
189
  <Motion as="span" className="zc-toast__icon-glyph" animate={GLYPH_POP} deps={[t.tone]}>
189
190
  {t.tone === 'loading' ? (
190
- <span className="zc-toast__spinner" aria-hidden="true"></span>
191
+ <Spinner label={null} className="zc-toast__spinner" />
191
192
  ) : (
192
193
  <Icon name={TONE_ICON[t.tone] || 'info'} weight="fill" />
193
194
  )}
@@ -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-toast-viewport {
@@ -212,20 +212,8 @@
212
212
  }
213
213
 
214
214
  .zc-toast__spinner {
215
- display: block;
216
- box-sizing: border-box;
217
- width: var(--icon-sm);
218
- height: var(--icon-sm);
219
- border-radius: var(--radius-full);
220
- border: var(--border-emphasis) solid currentColor;
221
- border-right-color: transparent;
215
+ font-size: var(--icon-sm);
222
216
  color: var(--text-muted);
223
- animation: toast-spin var(--duration-spin) linear infinite;
224
- }
225
- @keyframes toast-spin {
226
- to {
227
- transform: rotate(1turn);
228
- }
229
217
  }
230
218
 
231
219
  .zc-toast__custom {
@@ -6,12 +6,12 @@ import { createPortal } from 'react-dom';
6
6
  import { Motion } from '../../../motion/element';
7
7
  import { Presence } from '../../../motion/presence';
8
8
  import { popIn, popOut } from '../../../motion/presets';
9
- import { UIMotion } from '../../../tokens/motion-tokens';
9
+ import { motionFor } from '../../../tokens/motion-tokens';
10
+ import { inheritedThemeAttrs } from '../../internal/overlay/layer';
10
11
  import { tokenPx } from '../../internal/utils/token-px';
11
12
  import { store, TOOLTIP_DOM_ID, type ActivePayload, type Placement } from './tooltip-store';
12
13
 
13
- const SM = UIMotion;
14
- const TIP_LAYOUT = { size: 'morph' as const, timing: UIMotion.t.layout };
14
+ const tipLayout = (scope?: Element | null) => ({ size: 'morph' as const, timing: motionFor(scope).t.layout });
15
15
 
16
16
  interface Size {
17
17
  w: number;
@@ -26,10 +26,10 @@ interface RenderedBox extends TargetBox {
26
26
  bodyW: number;
27
27
  }
28
28
 
29
- function targetBox(size: Size, t: DOMRect, want: Placement): TargetBox {
29
+ function targetBox(size: Size, t: DOMRect, want: Placement, scope?: Element | null): TargetBox {
30
30
  const vw = window.innerWidth,
31
31
  vh = window.innerHeight,
32
- TIP_GAP = tokenPx('--space-2', 8) || 8,
32
+ TIP_GAP = tokenPx('--space-2', 8, scope) || 8,
33
33
  M = TIP_GAP;
34
34
  let p = want;
35
35
  if (p === 'top' && t.top - size.h - TIP_GAP < M) p = 'bottom';
@@ -61,10 +61,10 @@ function targetBox(size: Size, t: DOMRect, want: Placement): TargetBox {
61
61
 
62
62
  const surface = () => document.getElementById(TOOLTIP_DOM_ID);
63
63
 
64
- const fromEdge = (p: Placement) => ({
65
- x: p === 'left' ? SM.dist.sm : p === 'right' ? -SM.dist.sm : 0,
66
- y: p === 'top' ? SM.dist.sm : p === 'bottom' ? -SM.dist.sm : 0,
67
- });
64
+ const fromEdge = (p: Placement, scope?: Element | null) => {
65
+ const { sm } = motionFor(scope).dist;
66
+ return { x: p === 'left' ? sm : p === 'right' ? -sm : 0, y: p === 'top' ? sm : p === 'bottom' ? -sm : 0 };
67
+ };
68
68
 
69
69
  function Body({ a, width }: { a: ActivePayload; width?: number }) {
70
70
  return (
@@ -82,26 +82,28 @@ function Body({ a, width }: { a: ActivePayload; width?: number }) {
82
82
  }
83
83
 
84
84
  function TipSurface({ a, box }: { a: ActivePayload; box: RenderedBox }) {
85
- const edge = fromEdge(box.placement);
85
+ const motion = motionFor(a.anchor());
86
+ const edge = fromEdge(box.placement, a.anchor());
86
87
  return (
87
88
  <Motion
88
89
  layout
89
- layoutTransition={TIP_LAYOUT}
90
+ layoutTransition={tipLayout(a.anchor())}
90
91
  className="zc-tooltip"
92
+ {...inheritedThemeAttrs(a.anchor())}
91
93
  id={TOOLTIP_DOM_ID}
92
94
  role="tooltip"
93
95
  data-placement={box.placement}
94
96
  style={{ translate: `${box.x}px ${box.y}px`, width: box.w, height: box.h }}
95
97
  animate={[
96
- { x: [edge.x, 0], y: [edge.y, 0], timing: { ...SM.t.layout, fill: 'none' }, composite: 'add' },
97
- popIn(SM.scale.floating, SM.t.enter),
98
+ { x: [edge.x, 0], y: [edge.y, 0], timing: { ...motion.t.layout, fill: 'none' }, composite: 'add' },
99
+ popIn(motion.scale.floating, motion.t.enter),
98
100
  ]}
99
101
  exit={[
100
- { x: [0, edge.x], y: [0, edge.y], timing: SM.t.exit, composite: 'add' },
101
- popOut(SM.scale.floating, SM.t.exit),
102
+ { x: [0, edge.x], y: [0, edge.y], timing: motion.t.exit, composite: 'add' },
103
+ popOut(motion.scale.floating, motion.t.exit),
102
104
  ]}
103
105
  >
104
- <Motion as="span" key={a.id} animate={{ opacity: [0, 1], timing: SM.t.enter }}>
106
+ <Motion as="span" key={a.id} animate={{ opacity: [0, 1], timing: motion.t.enter }}>
105
107
  <Body a={a} width={box.bodyW} />
106
108
  </Motion>
107
109
  </Motion>
@@ -131,7 +133,7 @@ export function TooltipHost() {
131
133
  if (!from.width && !from.height) return;
132
134
  if (!surface()) drift.current = { x: 0, y: 0 };
133
135
  anchored.current = { x: from.left, y: from.top };
134
- const to = targetBox({ w: Math.ceil(bubble.width), h: Math.ceil(bubble.height) }, from, active.placement);
136
+ const to = targetBox({ w: Math.ceil(bubble.width), h: Math.ceil(bubble.height) }, from, active.placement, anchor);
135
137
  setShown({
136
138
  a: active,
137
139
  box: { ...to, x: to.x - drift.current.x, y: to.y - drift.current.y, bodyW: Math.ceil(body.width) },
@@ -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-tooltip {