@zazz-ui/core 0.1.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 (260) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/LICENSE +21 -0
  3. package/README.md +61 -0
  4. package/dist/sri.json +75 -0
  5. package/dist/zazz.css +1 -0
  6. package/dist/zazz.js +1 -0
  7. package/examples/about.html +590 -0
  8. package/examples/components.html +1040 -0
  9. package/examples/forms.html +511 -0
  10. package/examples/index.html +268 -0
  11. package/examples/layout.html +320 -0
  12. package/examples/products.html +846 -0
  13. package/examples/responsive.html +339 -0
  14. package/package.json +85 -0
  15. package/src/base/_layers.css +12 -0
  16. package/src/base/_layout.css +568 -0
  17. package/src/base/_reset.css +515 -0
  18. package/src/base/_typography.css +495 -0
  19. package/src/base/_utilities.css +6628 -0
  20. package/src/base/_variables.css +682 -0
  21. package/src/base/_view-transitions.css +103 -0
  22. package/src/base/command-score.d.ts +12 -0
  23. package/src/base/command-score.d.ts.map +1 -0
  24. package/src/base/command-score.js +151 -0
  25. package/src/base/command-score.ts +192 -0
  26. package/src/base/dialog-lifecycle.d.ts +11 -0
  27. package/src/base/dialog-lifecycle.d.ts.map +1 -0
  28. package/src/base/dialog-lifecycle.js +65 -0
  29. package/src/base/dialog-lifecycle.ts +80 -0
  30. package/src/base/embla.d.ts +90 -0
  31. package/src/base/embla.d.ts.map +1 -0
  32. package/src/base/embla.js +643 -0
  33. package/src/base/embla.ts +791 -0
  34. package/src/base/hotkeys.d.ts +82 -0
  35. package/src/base/hotkeys.d.ts.map +1 -0
  36. package/src/base/hotkeys.js +141 -0
  37. package/src/base/hotkeys.ts +195 -0
  38. package/src/base/navigation.d.ts +2 -0
  39. package/src/base/navigation.d.ts.map +1 -0
  40. package/src/base/navigation.js +136 -0
  41. package/src/base/navigation.ts +151 -0
  42. package/src/base/reveal.d.ts +80 -0
  43. package/src/base/reveal.d.ts.map +1 -0
  44. package/src/base/reveal.js +305 -0
  45. package/src/base/reveal.ts +379 -0
  46. package/src/base/signals.d.ts +89 -0
  47. package/src/base/signals.d.ts.map +1 -0
  48. package/src/base/signals.js +134 -0
  49. package/src/base/signals.ts +164 -0
  50. package/src/base/typeahead.d.ts +105 -0
  51. package/src/base/typeahead.d.ts.map +1 -0
  52. package/src/base/typeahead.js +411 -0
  53. package/src/base/typeahead.ts +500 -0
  54. package/src/base/utils.d.ts +56 -0
  55. package/src/base/utils.d.ts.map +1 -0
  56. package/src/base/utils.js +88 -0
  57. package/src/base/utils.ts +98 -0
  58. package/src/base/zazz-element.d.ts +44 -0
  59. package/src/base/zazz-element.d.ts.map +1 -0
  60. package/src/base/zazz-element.js +59 -0
  61. package/src/base/zazz-element.ts +73 -0
  62. package/src/globals.d.ts +148 -0
  63. package/src/head.d.ts +95 -0
  64. package/src/head.d.ts.map +1 -0
  65. package/src/head.js +311 -0
  66. package/src/head.ts +433 -0
  67. package/src/index.css +71 -0
  68. package/src/index.d.ts +36 -0
  69. package/src/index.d.ts.map +1 -0
  70. package/src/index.js +35 -0
  71. package/src/index.ts +36 -0
  72. package/src/manifest.d.ts +90 -0
  73. package/src/manifest.d.ts.map +1 -0
  74. package/src/manifest.js +614 -0
  75. package/src/manifest.ts +667 -0
  76. package/src/primitives/accordion/accordion.css +104 -0
  77. package/src/primitives/accordion/accordion.html +69 -0
  78. package/src/primitives/alert-dialog/alert-dialog.css +38 -0
  79. package/src/primitives/alert-dialog/alert-dialog.html +53 -0
  80. package/src/primitives/autocomplete/autocomplete-groups.html +77 -0
  81. package/src/primitives/autocomplete/autocomplete.css +114 -0
  82. package/src/primitives/autocomplete/autocomplete.d.ts +30 -0
  83. package/src/primitives/autocomplete/autocomplete.d.ts.map +1 -0
  84. package/src/primitives/autocomplete/autocomplete.html +66 -0
  85. package/src/primitives/autocomplete/autocomplete.js +41 -0
  86. package/src/primitives/autocomplete/autocomplete.ts +46 -0
  87. package/src/primitives/avatar/avatar.html +44 -0
  88. package/src/primitives/badge/badge-icon.html +36 -0
  89. package/src/primitives/badge/badge.css +251 -0
  90. package/src/primitives/badge/badge.html +7 -0
  91. package/src/primitives/breadcrumbs/breadcrumbs.html +9 -0
  92. package/src/primitives/button/button-icon-only.html +84 -0
  93. package/src/primitives/button/button-icon.html +82 -0
  94. package/src/primitives/button/button.css +319 -0
  95. package/src/primitives/button/button.html +8 -0
  96. package/src/primitives/button-group/button-group-vertical.html +6 -0
  97. package/src/primitives/button-group/button-group.css +94 -0
  98. package/src/primitives/button-group/button-group.html +64 -0
  99. package/src/primitives/card/card-subgrid.html +118 -0
  100. package/src/primitives/card/card.html +53 -0
  101. package/src/primitives/carousel/carousel.css +61 -0
  102. package/src/primitives/carousel/carousel.d.ts +16 -0
  103. package/src/primitives/carousel/carousel.d.ts.map +1 -0
  104. package/src/primitives/carousel/carousel.html +315 -0
  105. package/src/primitives/carousel/carousel.js +73 -0
  106. package/src/primitives/carousel/carousel.ts +84 -0
  107. package/src/primitives/checkbox/checkbox-tasklist.html +71 -0
  108. package/src/primitives/checkbox/checkbox.css +82 -0
  109. package/src/primitives/checkbox/checkbox.d.ts +21 -0
  110. package/src/primitives/checkbox/checkbox.d.ts.map +1 -0
  111. package/src/primitives/checkbox/checkbox.html +17 -0
  112. package/src/primitives/checkbox/checkbox.js +190 -0
  113. package/src/primitives/checkbox/checkbox.ts +219 -0
  114. package/src/primitives/combobox/combobox-multiselect.html +91 -0
  115. package/src/primitives/combobox/combobox.css +307 -0
  116. package/src/primitives/combobox/combobox.d.ts +100 -0
  117. package/src/primitives/combobox/combobox.d.ts.map +1 -0
  118. package/src/primitives/combobox/combobox.html +73 -0
  119. package/src/primitives/combobox/combobox.js +503 -0
  120. package/src/primitives/combobox/combobox.ts +559 -0
  121. package/src/primitives/command/command-actions.d.ts +31 -0
  122. package/src/primitives/command/command-actions.d.ts.map +1 -0
  123. package/src/primitives/command/command-actions.html +89 -0
  124. package/src/primitives/command/command-actions.js +70 -0
  125. package/src/primitives/command/command-actions.ts +77 -0
  126. package/src/primitives/command/command-dialog.html +77 -0
  127. package/src/primitives/command/command.css +151 -0
  128. package/src/primitives/command/command.d.ts +52 -0
  129. package/src/primitives/command/command.d.ts.map +1 -0
  130. package/src/primitives/command/command.html +119 -0
  131. package/src/primitives/command/command.js +146 -0
  132. package/src/primitives/command/command.ts +157 -0
  133. package/src/primitives/dialog/dialog-with-form.html +200 -0
  134. package/src/primitives/dialog/dialog.css +229 -0
  135. package/src/primitives/dialog/dialog.html +90 -0
  136. package/src/primitives/fields/fields.css +278 -0
  137. package/src/primitives/input/input-icon-leading.html +19 -0
  138. package/src/primitives/input/input-icon-trailing.html +18 -0
  139. package/src/primitives/input/input.css +114 -0
  140. package/src/primitives/input/input.html +61 -0
  141. package/src/primitives/input-group/input-group-password-group.html +108 -0
  142. package/src/primitives/input-group/input-group.css +215 -0
  143. package/src/primitives/input-group/input-group.html +132 -0
  144. package/src/primitives/kbd/kbd-group.html +18 -0
  145. package/src/primitives/kbd/kbd.css +87 -0
  146. package/src/primitives/kbd/kbd.html +7 -0
  147. package/src/primitives/lightbox/lightbox.css +459 -0
  148. package/src/primitives/lightbox/lightbox.d.ts +7 -0
  149. package/src/primitives/lightbox/lightbox.d.ts.map +1 -0
  150. package/src/primitives/lightbox/lightbox.html +665 -0
  151. package/src/primitives/lightbox/lightbox.js +96 -0
  152. package/src/primitives/lightbox/lightbox.ts +113 -0
  153. package/src/primitives/menu/menu-interest.html +52 -0
  154. package/src/primitives/menu/menu.css +55 -0
  155. package/src/primitives/menu/menu.d.ts +38 -0
  156. package/src/primitives/menu/menu.d.ts.map +1 -0
  157. package/src/primitives/menu/menu.html +70 -0
  158. package/src/primitives/menu/menu.js +117 -0
  159. package/src/primitives/menu/menu.ts +131 -0
  160. package/src/primitives/menubar/menubar-help-search.html +103 -0
  161. package/src/primitives/menubar/menubar.html +166 -0
  162. package/src/primitives/meter/meter.css +178 -0
  163. package/src/primitives/meter/meter.html +38 -0
  164. package/src/primitives/mobile-menu/mobile-menu.css +145 -0
  165. package/src/primitives/mobile-menu/mobile-menu.html +614 -0
  166. package/src/primitives/navigation-menu/navigation-menu-featured.html +76 -0
  167. package/src/primitives/navigation-menu/navigation-menu-icon-grid.html +158 -0
  168. package/src/primitives/navigation-menu/navigation-menu-interest.html +103 -0
  169. package/src/primitives/navigation-menu/navigation-menu-megamenu.html +141 -0
  170. package/src/primitives/navigation-menu/navigation-menu-simple.html +96 -0
  171. package/src/primitives/navigation-menu/navigation-menu.css +295 -0
  172. package/src/primitives/navigation-menu/navigation-menu.html +576 -0
  173. package/src/primitives/otp/otp.css +126 -0
  174. package/src/primitives/otp/otp.d.ts +89 -0
  175. package/src/primitives/otp/otp.d.ts.map +1 -0
  176. package/src/primitives/otp/otp.html +22 -0
  177. package/src/primitives/otp/otp.js +226 -0
  178. package/src/primitives/otp/otp.ts +279 -0
  179. package/src/primitives/password-group/password-group.css +238 -0
  180. package/src/primitives/password-group/password-group.d.ts +25 -0
  181. package/src/primitives/password-group/password-group.d.ts.map +1 -0
  182. package/src/primitives/password-group/password-group.html +109 -0
  183. package/src/primitives/password-group/password-group.js +76 -0
  184. package/src/primitives/password-group/password-group.ts +95 -0
  185. package/src/primitives/popover/popover.css +233 -0
  186. package/src/primitives/progress/progress-indeterminate.html +1 -0
  187. package/src/primitives/progress/progress.css +105 -0
  188. package/src/primitives/progress/progress.html +7 -0
  189. package/src/primitives/prose/prose.html +65 -0
  190. package/src/primitives/radio/radio.css +84 -0
  191. package/src/primitives/radio/radio.html +17 -0
  192. package/src/primitives/reveal/reveal.css +167 -0
  193. package/src/primitives/select/multiselect.d.ts +43 -0
  194. package/src/primitives/select/multiselect.d.ts.map +1 -0
  195. package/src/primitives/select/multiselect.js +147 -0
  196. package/src/primitives/select/multiselect.ts +188 -0
  197. package/src/primitives/select/select-align.html +49 -0
  198. package/src/primitives/select/select-multiple.html +12 -0
  199. package/src/primitives/select/select-sides.html +65 -0
  200. package/src/primitives/select/select.css +481 -0
  201. package/src/primitives/select/select.html +16 -0
  202. package/src/primitives/separator/separator.css +49 -0
  203. package/src/primitives/separator/separator.html +16 -0
  204. package/src/primitives/slider/slider.css +122 -0
  205. package/src/primitives/slider/slider.html +1 -0
  206. package/src/primitives/switch/switch.css +126 -0
  207. package/src/primitives/switch/switch.html +13 -0
  208. package/src/primitives/table/table-alternating.html +36 -0
  209. package/src/primitives/table/table-grid.html +30 -0
  210. package/src/primitives/table/table-size-sm.html +26 -0
  211. package/src/primitives/table/table.css +158 -0
  212. package/src/primitives/table/table.html +45 -0
  213. package/src/primitives/tabs/tabs.css +328 -0
  214. package/src/primitives/tabs/tabs.d.ts +35 -0
  215. package/src/primitives/tabs/tabs.d.ts.map +1 -0
  216. package/src/primitives/tabs/tabs.html +75 -0
  217. package/src/primitives/tabs/tabs.js +84 -0
  218. package/src/primitives/tabs/tabs.ts +93 -0
  219. package/src/primitives/textarea/textarea.css +78 -0
  220. package/src/primitives/textarea/textarea.html +10 -0
  221. package/src/primitives/toaster/toaster.css +309 -0
  222. package/src/primitives/toaster/toaster.d.ts +138 -0
  223. package/src/primitives/toaster/toaster.d.ts.map +1 -0
  224. package/src/primitives/toaster/toaster.html +77 -0
  225. package/src/primitives/toaster/toaster.js +736 -0
  226. package/src/primitives/toaster/toaster.ts +823 -0
  227. package/src/primitives/toggle/toggle.css +295 -0
  228. package/src/primitives/toggle/toggle.html +68 -0
  229. package/src/primitives/toggle-group/toggle-group-multiple.html +14 -0
  230. package/src/primitives/toggle-group/toggle-group-vertical.html +14 -0
  231. package/src/primitives/toggle-group/toggle-group.css +73 -0
  232. package/src/primitives/toggle-group/toggle-group.html +53 -0
  233. package/src/primitives/toolbar/toolbar.html +45 -0
  234. package/src/primitives/tooltip/tooltip-disabled.html +19 -0
  235. package/src/primitives/tooltip/tooltip-sides.html +57 -0
  236. package/src/primitives/tooltip/tooltip-with-kbd.html +31 -0
  237. package/src/primitives/tooltip/tooltip.css +235 -0
  238. package/src/primitives/tooltip/tooltip.html +12 -0
  239. package/src/primitives/utilities/aspect-ratio.html +17 -0
  240. package/src/primitives/utilities/basis.html +27 -0
  241. package/src/primitives/utilities/col-span.html +23 -0
  242. package/src/primitives/utilities/compose.html +19 -0
  243. package/src/primitives/utilities/flex-align.html +26 -0
  244. package/src/primitives/utilities/flex-direction.html +36 -0
  245. package/src/primitives/utilities/flex-grow.html +17 -0
  246. package/src/primitives/utilities/gap.html +62 -0
  247. package/src/primitives/utilities/grid-cols.html +20 -0
  248. package/src/primitives/utilities/grid-pile.html +5 -0
  249. package/src/primitives/utilities/grid-responsive.html +31 -0
  250. package/src/primitives/utilities/margin-auto.html +13 -0
  251. package/src/primitives/utilities/object-fit.html +41 -0
  252. package/src/primitives/utilities/order.html +17 -0
  253. package/src/primitives/utilities/overflow.html +26 -0
  254. package/src/primitives/utilities/padding-compose.html +23 -0
  255. package/src/primitives/utilities/padding.html +30 -0
  256. package/src/primitives/utilities/position.html +13 -0
  257. package/src/primitives/utilities/responsive-flex.html +22 -0
  258. package/src/primitives/utilities/responsive-grid.html +31 -0
  259. package/src/primitives/utilities/size.html +22 -0
  260. package/src/primitives/utilities/width.html +22 -0
@@ -0,0 +1,122 @@
1
+ /**
2
+ * slider.css — Range input (input[type="range"])
3
+ *
4
+ * @layer reset
5
+ * @requires layers.css, _variables.css
6
+ * @uses appearance: none — redraws track + thumb from theme tokens
7
+ * @tokens --ui-slider-* (track height, background, border, radius; thumb size, bg, border, radius)
8
+ *
9
+ * Note: The active region is NOT filled (parity across engines); add a paint
10
+ * via JS if a filled track is needed. The thumb is centered on the track with a
11
+ * calc'd negative margin so retuning either size keeps it aligned.
12
+ */
13
+
14
+ @layer reset {
15
+ :where(input[type="range"]) {
16
+ --ui-slider-ring-color: var(--ring-color);
17
+
18
+ --ui-slider-track-height: var(--step-1_5);
19
+ --ui-slider-track-background: var(--muted);
20
+ --ui-slider-track-border: 1px solid var(--muted);
21
+ --ui-slider-track-radius: var(--radius-full);
22
+ --ui-slider-thumb-size: var(--step-4);
23
+ --ui-slider-thumb-background: var(--background);
24
+
25
+ --ui-slider-thumb-shadow: var(--shadow-xs);
26
+ --ui-slider-thumb-border: 1px solid var(--border);
27
+ --ui-slider-thumb-radius: var(--radius-full);
28
+ --ui-slider-thumb-offset: calc(var(--ui-slider-track-height) * -1);
29
+
30
+ -webkit-appearance: none;
31
+ appearance: none;
32
+ inline-size: 100%;
33
+ background: transparent;
34
+ cursor: grab;
35
+ border-radius: var(--ui-slider-track-radius);
36
+
37
+ /* transparent outline keeps focus visible in forced-colors / high-contrast
38
+ modes; the visible focus ring lives on the thumb via --shadow-ring */
39
+ outline: var(--outline-width) var(--outline-style) transparent;
40
+ outline-offset: var(--outline-offset);
41
+ }
42
+
43
+ :where(input[type="range"])::-webkit-slider-runnable-track {
44
+ block-size: var(--ui-slider-track-height);
45
+ inline-size: 100%;
46
+ background: var(--ui-slider-track-background);
47
+ border: var(--ui-slider-track-border);
48
+ border-radius: var(--ui-slider-track-radius);
49
+ }
50
+
51
+ :where(input[type="range"])::-moz-range-track {
52
+ block-size: var(--ui-slider-track-height);
53
+ inline-size: 100%;
54
+ background: var(--ui-slider-track-background);
55
+ border: var(--ui-slider-track-border);
56
+ border-radius: var(--ui-slider-track-radius);
57
+ }
58
+
59
+ :where(input[type="range"])::-webkit-slider-thumb {
60
+ /* ring renders as box-shadow so it composes with --ui-slider-thumb-shadow; the
61
+ ring widths animate from 0 so the ring grows in smoothly on focus */
62
+ --_ring-offset-width: 0px;
63
+ --_ring-width: 0px;
64
+ --_ring: color-mix(in oklch, var(--ui-slider-ring-color) var(--ring-opacity), transparent);
65
+ box-shadow:
66
+ 0 0 0 var(--_ring-offset-width) var(--ring-offset-color),
67
+ 0 0 0 calc(var(--_ring-offset-width) + var(--_ring-width)) var(--_ring, var(--ring)),
68
+ var(--ui-slider-thumb-shadow);
69
+
70
+ -webkit-appearance: none;
71
+ appearance: none;
72
+ margin-block-start: var(--ui-slider-thumb-offset);
73
+ inline-size: var(--ui-slider-thumb-size);
74
+ block-size: var(--ui-slider-thumb-size);
75
+ background-color: var(--ui-slider-thumb-background);
76
+ border: var(--ui-slider-thumb-border);
77
+ border-radius: var(--ui-slider-thumb-radius);
78
+
79
+ transition: var(--default-transition);
80
+ }
81
+
82
+ :where(input[type="range"])::-moz-range-thumb {
83
+ /* ring renders as box-shadow so it composes with --ui-slider-thumb-shadow; the
84
+ ring widths animate from 0 so the ring grows in smoothly on focus */
85
+ --_ring-offset-width: 0px;
86
+ --_ring-width: 0px;
87
+ --_ring: color-mix(in oklch, var(--ui-slider-ring-color) var(--ring-opacity), transparent);
88
+
89
+ appearance: none;
90
+ inline-size: var(--ui-slider-thumb-size);
91
+ block-size: var(--ui-slider-thumb-size);
92
+ background-color: var(--ui-slider-thumb-background);
93
+ border: var(--ui-slider-thumb-border);
94
+ border-radius: var(--ui-slider-thumb-radius);
95
+
96
+ box-shadow:
97
+ 0 0 0 var(--_ring-offset-width) var(--ring-offset-color),
98
+ 0 0 0 calc(var(--_ring-offset-width) + var(--_ring-width)) var(--_ring, var(--ring)),
99
+ var(--ui-slider-thumb-shadow);
100
+
101
+ transition: var(--default-transition);
102
+ }
103
+
104
+ :where(input[type="range"]:hover) {
105
+ --ui-slider-thumb-border: 1px solid var(--primary);
106
+ }
107
+
108
+ :where(input[type="range"]:active) {
109
+ --ui-slider-thumb-shadow: var(--shadow-xs), var(--shadow-ring);
110
+
111
+ cursor: grabbing;
112
+ }
113
+
114
+ :where(input[type="range"]:focus-visible) {
115
+ --ui-slider-thumb-shadow: var(--shadow-xs), var(--shadow-ring);
116
+ }
117
+
118
+ :where(input[type="range"]:disabled) {
119
+ opacity: 0.5;
120
+ cursor: not-allowed;
121
+ }
122
+ }
@@ -0,0 +1 @@
1
+ <input class="max-w-xl" type="range" min="0" max="100" step="10" value="50" aria-label="Volume" />
@@ -0,0 +1,126 @@
1
+ /**
2
+ * switch.css — Switch (input[type="checkbox"][role="switch"])
3
+ *
4
+ * @layer variables, reset
5
+ * @requires layers.css, _variables.css
6
+ * @uses appearance: none on input[role="switch"]
7
+ * @uses label:has(> input[role="switch"])::after — thumb drawn on label (no JS)
8
+ * @uses oklch(from …) — checked/hover track tints
9
+ * @tokens --ui-switch-* (@layer variables; consumed in @layer reset)
10
+ */
11
+
12
+ @layer variables {
13
+ :root {
14
+ --ui-switch-track-width: var(--step-7);
15
+ --ui-switch-track-padding: var(--step-0_5);
16
+ --ui-switch-track-height: calc(
17
+ var(--ui-switch-track-width) / 2 + var(--ui-switch-track-padding)
18
+ );
19
+ --ui-switch-thumb: var(--white);
20
+ --ui-switch-thumb-size: calc(
21
+ (var(--ui-switch-track-width) / 2) - var(--ui-switch-track-padding)
22
+ );
23
+ --ui-switch-thumb-shadow: var(--shadow-xs);
24
+ --ui-switch-thumb-translate: var(--ui-switch-track-padding), -50%;
25
+ --ui-switch-thumb-scale: 1;
26
+ --ui-switch-track-background: var(--muted);
27
+ --ui-switch-track-background--hover: oklch(from var(--muted) l c h / calc(alpha + 0.04));
28
+ --ui-switch-track-background--checked: var(--primary);
29
+ --ui-switch-track-background--checked-hover: oklch(from var(--primary) l c h / 0.9);
30
+ --ui-switch-radius: var(--radius-full);
31
+ }
32
+ }
33
+
34
+ @layer reset {
35
+ /* ===========================================================================
36
+ SWITCH — native <input type="checkbox" role="switch"> internals
37
+ - In the reset layer so component overrides win.
38
+ =========================================================================== */
39
+
40
+ :where(label:has(> input[role="switch"])) {
41
+ position: relative;
42
+
43
+ &::after {
44
+ content: "";
45
+ position: absolute;
46
+ inset-block-start: 50%;
47
+ inset-inline-start: 0;
48
+ inline-size: var(--ui-switch-thumb-size);
49
+ block-size: var(--ui-switch-thumb-size);
50
+ border-radius: var(--radius-full);
51
+ background-color: var(--ui-switch-thumb);
52
+ box-shadow: var(--ui-switch-thumb-shadow);
53
+ pointer-events: none;
54
+ transform: translate(var(--ui-switch-thumb-translate)) scale(var(--ui-switch-thumb-scale));
55
+ transition:
56
+ box-shadow var(--default-transition-duration) var(--default-transition-timing-function),
57
+ transform var(--default-transition-duration) var(--default-transition-timing-function);
58
+ z-index: 1;
59
+ }
60
+
61
+ &:has(> input[role="switch"]:checked)::after {
62
+ --ui-switch-thumb-translate:
63
+ calc(var(--ui-switch-track-padding) + var(--ui-switch-thumb-size)), -50%;
64
+ }
65
+
66
+ &:has(> input[role="switch"]:hover):after {
67
+ --ui-switch-thumb-scale: 1.1;
68
+ }
69
+
70
+ &:has(> input[role="switch"]:active):after {
71
+ --ui-switch-thumb-shadow: none;
72
+ --ui-switch-thumb-scale: 0.98;
73
+ }
74
+ }
75
+
76
+ :where(label:has(> input[role="switch"]:disabled)) {
77
+ opacity: 0.5;
78
+ cursor: not-allowed;
79
+ }
80
+
81
+ :where(label:has(> input[role="switch"]:disabled) > input[role="switch"]) {
82
+ opacity: 1;
83
+ }
84
+
85
+ :where(input[role="switch"]) {
86
+ appearance: none;
87
+ flex-shrink: 0;
88
+ inline-size: var(--ui-switch-track-width);
89
+ block-size: var(--ui-switch-track-height);
90
+
91
+ background-color: var(--ui-switch-track-background);
92
+
93
+ border-radius: var(--ui-switch-radius);
94
+ cursor: pointer;
95
+
96
+ /* ring renders as box-shadow; transparent outline twin keeps focus visible
97
+ in forced-colors / high-contrast modes */
98
+ --_ring-offset-width: 0px;
99
+ --_ring-width: 0px;
100
+ box-shadow:
101
+ 0 0 0 var(--_ring-offset-width) var(--ring-offset-color),
102
+ 0 0 0 calc(var(--_ring-offset-width) + var(--_ring-width)) var(--_ring, var(--ring));
103
+ outline: var(--outline-width) var(--outline-style) transparent;
104
+ outline-offset: var(--outline-offset);
105
+
106
+ transition: var(--default-transition);
107
+ }
108
+
109
+ :where(input[role="switch"]:hover) {
110
+ background-color: var(--ui-switch-track-background--hover);
111
+ }
112
+
113
+ :where(input[role="switch"]:checked) {
114
+ background-color: var(--ui-switch-track-background--checked);
115
+ }
116
+
117
+ :where(input[role="switch"]:hover:checked) {
118
+ background-color: var(--ui-switch-track-background--checked-hover);
119
+ }
120
+
121
+ :where(input[role="switch"]:focus-visible) {
122
+ --_ring-offset-width: var(--ring-offset-width);
123
+ --_ring-width: var(--ring-width);
124
+ outline-color: transparent;
125
+ }
126
+ }
@@ -0,0 +1,13 @@
1
+ <fieldset class="ui-field-group">
2
+ <legend>Notifications</legend>
3
+ <div class="flex flex-col gap-xs">
4
+ <label class="ui-field" data-orientation="horizontal">
5
+ <input type="checkbox" role="switch" name="notifications-email" />
6
+ <span data-slot="field-label">Email notifications</span>
7
+ </label>
8
+ <label class="ui-field" data-orientation="horizontal">
9
+ <input type="checkbox" role="switch" name="notifications-2fa" checked />
10
+ <span data-slot="field-label">Two-factor authentication</span>
11
+ </label>
12
+ </div>
13
+ </fieldset>
@@ -0,0 +1,36 @@
1
+ <table class="ui-table" data-variant="alternating">
2
+ <thead>
3
+ <tr>
4
+ <th>Name</th>
5
+ <th>Role</th>
6
+ <th>Location</th>
7
+ </tr>
8
+ </thead>
9
+ <tbody>
10
+ <tr>
11
+ <td>Ada Lovelace</td>
12
+ <td>Engineering</td>
13
+ <td>London</td>
14
+ </tr>
15
+ <tr>
16
+ <td>Grace Hopper</td>
17
+ <td>Engineering</td>
18
+ <td>New York</td>
19
+ </tr>
20
+ <tr>
21
+ <td>Katherine Johnson</td>
22
+ <td>Research</td>
23
+ <td>Hampton</td>
24
+ </tr>
25
+ <tr>
26
+ <td>Margaret Hamilton</td>
27
+ <td>Engineering</td>
28
+ <td>Boston</td>
29
+ </tr>
30
+ <tr>
31
+ <td>Annie Easley</td>
32
+ <td>Research</td>
33
+ <td>Cleveland</td>
34
+ </tr>
35
+ </tbody>
36
+ </table>
@@ -0,0 +1,30 @@
1
+ <table class="ui-table" data-variant="grid">
2
+ <thead>
3
+ <tr>
4
+ <th>Plan</th>
5
+ <th>Seats</th>
6
+ <th>Storage</th>
7
+ <th class="text-right">Price</th>
8
+ </tr>
9
+ </thead>
10
+ <tbody>
11
+ <tr>
12
+ <td>Starter</td>
13
+ <td>3</td>
14
+ <td>10 GB</td>
15
+ <td class="text-right">$9/mo</td>
16
+ </tr>
17
+ <tr>
18
+ <td>Team</td>
19
+ <td>10</td>
20
+ <td>100 GB</td>
21
+ <td class="text-right">$29/mo</td>
22
+ </tr>
23
+ <tr>
24
+ <td>Business</td>
25
+ <td>Unlimited</td>
26
+ <td>1 TB</td>
27
+ <td class="text-right">$79/mo</td>
28
+ </tr>
29
+ </tbody>
30
+ </table>
@@ -0,0 +1,26 @@
1
+ <table class="ui-table" data-size="sm">
2
+ <thead>
3
+ <tr>
4
+ <th>Property</th>
5
+ <th>Type</th>
6
+ <th>Default</th>
7
+ </tr>
8
+ </thead>
9
+ <tbody>
10
+ <tr>
11
+ <td>data-variant</td>
12
+ <td>string</td>
13
+ <td>—</td>
14
+ </tr>
15
+ <tr>
16
+ <td>data-size</td>
17
+ <td>string</td>
18
+ <td>—</td>
19
+ </tr>
20
+ <tr>
21
+ <td>data-state</td>
22
+ <td>string</td>
23
+ <td>—</td>
24
+ </tr>
25
+ </tbody>
26
+ </table>
@@ -0,0 +1,158 @@
1
+ /**
2
+ * table.css — Table (.ui-table)
3
+ *
4
+ * @layer variables, components
5
+ * @requires layers.css, _variables.css, _reset.css
6
+ * @uses oklch(from …) — translucent hover/footer tints
7
+ * @tokens --ui-table-* (@layer variables)
8
+ */
9
+
10
+ @layer variables {
11
+ :root {
12
+ --ui-table-font-family: var(--font-family-body);
13
+ --ui-table-font-size: var(--font-size-sm);
14
+
15
+ --ui-table-foreground: var(--foreground);
16
+ --ui-table-background: transparent;
17
+
18
+ /* structural borders — the outer/footer rule, the header separator,
19
+ the tbody row dividers, and the column dividers (grid variant) */
20
+ --ui-table-border: 1px solid var(--border);
21
+ --ui-table-head-border: var(--ui-table-border);
22
+ --ui-table-row-border: var(--ui-table-border);
23
+ --ui-table-column-border: none;
24
+
25
+ --ui-table-cell-padding-block: var(--step-2);
26
+ --ui-table-cell-padding-inline: var(--step-2);
27
+
28
+ --ui-table-head-height: var(--step-10);
29
+ --ui-table-head-foreground: var(--foreground);
30
+ --ui-table-head-font-weight: var(--font-weight-strong);
31
+
32
+ --ui-table-foot-background: oklch(from var(--muted) l c h / calc(alpha / 2));
33
+ --ui-table-foot-font-weight: var(--font-weight-strong);
34
+
35
+ --ui-table-row-background--hover: oklch(from var(--muted) l c h / calc(alpha / 2));
36
+ --ui-table-row-background--selected: var(--muted);
37
+
38
+ --ui-table-alternating-background: var(--muted);
39
+
40
+ --ui-table-caption-foreground: var(--muted-foreground);
41
+ --ui-table-caption-padding-block: var(--gap-xs);
42
+ --ui-table-caption-padding-inline: var(--gap-xs);
43
+ }
44
+ }
45
+
46
+ @layer zazz.components {
47
+ /* ===========================================================================
48
+ TABLE
49
+ =========================================================================== */
50
+
51
+ .ui-table {
52
+ font-family: var(--ui-table-font-family);
53
+ font-size: var(--ui-table-font-size);
54
+ font-variant-numeric: tabular-nums;
55
+
56
+ inline-size: 100%;
57
+
58
+ color: var(--ui-table-foreground);
59
+ background-color: var(--ui-table-background);
60
+
61
+ caption-side: bottom;
62
+ text-align: start;
63
+ }
64
+
65
+ .ui-table :is(th, td) {
66
+ padding-block: var(--ui-table-cell-padding-block);
67
+ padding-inline: var(--ui-table-cell-padding-inline);
68
+ vertical-align: middle;
69
+ text-align: start;
70
+ border-inline: var(--ui-table-column-border);
71
+ }
72
+
73
+ .ui-table th {
74
+ color: var(--ui-table-head-foreground);
75
+ font-weight: var(--ui-table-head-font-weight);
76
+ }
77
+
78
+ .ui-table thead th {
79
+ block-size: var(--ui-table-head-height);
80
+ padding-block: 0;
81
+ }
82
+
83
+ .ui-table thead tr {
84
+ border-block-end: var(--ui-table-head-border);
85
+ }
86
+
87
+ .ui-table tbody tr:not(:last-child) {
88
+ border-block-end: var(--ui-table-row-border);
89
+ }
90
+
91
+ .ui-table tfoot {
92
+ background-color: var(--ui-table-foot-background);
93
+ font-weight: var(--ui-table-foot-font-weight);
94
+ border-block-start: var(--ui-table-border);
95
+ }
96
+
97
+ .ui-table caption {
98
+ color: var(--ui-table-caption-foreground);
99
+ padding-block: var(--ui-table-caption-padding-block);
100
+ padding-inline: var(--ui-table-caption-padding-inline);
101
+ }
102
+
103
+ /* ===========================================================================
104
+ TABLE LAYOUT & CAPTION SIDE
105
+ =========================================================================== */
106
+
107
+ /* omit = table-layout: auto */
108
+ .ui-table[data-layout="fixed"] {
109
+ table-layout: fixed;
110
+ }
111
+
112
+ /* omit = caption-side: bottom (set on .ui-table) */
113
+ .ui-table caption[data-side="top"] {
114
+ caption-side: top;
115
+ }
116
+
117
+ /* ===========================================================================
118
+ TABLE STATES
119
+ =========================================================================== */
120
+
121
+ /* hover/selected paint on the cells so they layer above any row stripe;
122
+ disable hover with --ui-table-row-background--hover: transparent */
123
+ .ui-table tbody tr:hover > :is(th, td) {
124
+ background-color: var(--ui-table-row-background--hover);
125
+ }
126
+
127
+ .ui-table tbody tr[data-state="selected"] > :is(th, td) {
128
+ background-color: var(--ui-table-row-background--selected);
129
+ }
130
+
131
+ /* ===========================================================================
132
+ TABLE VARIANTS
133
+ =========================================================================== */
134
+
135
+ .ui-table[data-variant="alternating"] {
136
+ --ui-table-row-border: none;
137
+ }
138
+
139
+ .ui-table[data-variant="alternating"] tbody tr:nth-child(even) {
140
+ background-color: var(--ui-table-alternating-background);
141
+ }
142
+
143
+ .ui-table[data-variant="grid"] {
144
+ --ui-table-column-border: var(--ui-table-border);
145
+
146
+ border: var(--ui-table-border);
147
+ }
148
+
149
+ /* ===========================================================================
150
+ TABLE SIZES
151
+ =========================================================================== */
152
+
153
+ .ui-table[data-size="sm"] {
154
+ --ui-table-cell-padding-block: var(--step-1);
155
+ --ui-table-cell-padding-inline: var(--step-1_5);
156
+ --ui-table-head-height: var(--step-8);
157
+ }
158
+ }
@@ -0,0 +1,45 @@
1
+ <table class="ui-table">
2
+ <caption>
3
+ A list of your recent invoices.
4
+ </caption>
5
+ <thead>
6
+ <tr>
7
+ <th>Invoice</th>
8
+ <th>Status</th>
9
+ <th>Method</th>
10
+ <th class="text-right">Amount</th>
11
+ </tr>
12
+ </thead>
13
+ <tbody>
14
+ <tr>
15
+ <td>INV-001</td>
16
+ <td>Paid</td>
17
+ <td>Credit card</td>
18
+ <td class="text-right">$250.00</td>
19
+ </tr>
20
+ <tr>
21
+ <td>INV-002</td>
22
+ <td>Pending</td>
23
+ <td>PayPal</td>
24
+ <td class="text-right">$150.00</td>
25
+ </tr>
26
+ <tr>
27
+ <td>INV-003</td>
28
+ <td>Unpaid</td>
29
+ <td>Bank transfer</td>
30
+ <td class="text-right">$350.00</td>
31
+ </tr>
32
+ <tr>
33
+ <td>INV-004</td>
34
+ <td>Paid</td>
35
+ <td>Credit card</td>
36
+ <td class="text-right">$450.00</td>
37
+ </tr>
38
+ </tbody>
39
+ <tfoot>
40
+ <tr>
41
+ <td colspan="3">Total</td>
42
+ <td class="text-right">$1,200.00</td>
43
+ </tr>
44
+ </tfoot>
45
+ </table>