@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,44 @@
1
+ <div class="flex items-center gap-xs">
2
+ <figure
3
+ class="grid grid-area-pile size-lg bg-background border rounded-full overflow-clip"
4
+ role="img"
5
+ >
6
+ <img
7
+ class="size-full object-cover order-last bg-transparent"
8
+ width="64"
9
+ height="64"
10
+ loading="lazy"
11
+ src="https://images.unsplash.com/photo-1535713875002-d1d0cf377fde?auto=format&fit=facearea&facepad=2&w=64&h=64&q=90"
12
+ alt="John Doe"
13
+ aria-hidden="true"
14
+ />
15
+ <figcaption
16
+ class="order-first bg-muted size-full text-muted-foreground flex items-center justify-center text-center text-md font-strong"
17
+ >
18
+ <span class="sr-only">John Doe</span>
19
+ <span aria-hidden="true">JD</span>
20
+ </figcaption>
21
+ </figure>
22
+ <div class="flex flex-col">
23
+ <span class="text-sm font-strong leading-none">John Doe</span>
24
+ <span class="text-xs text-muted-foreground">Founder, ACME Inc.</span>
25
+ </div>
26
+ </div>
27
+
28
+ <div class="flex items-center gap-xs">
29
+ <figure
30
+ class="grid grid-area-pile size-lg bg-background border rounded-full overflow-clip"
31
+ role="img"
32
+ >
33
+ <figcaption
34
+ class="order-first bg-muted size-full text-muted-foreground flex items-center justify-center text-center text-md font-strong"
35
+ >
36
+ <span class="sr-only">John Doe</span>
37
+ <span aria-hidden="true">JD</span>
38
+ </figcaption>
39
+ </figure>
40
+ <div class="flex flex-col">
41
+ <span class="text-sm font-strong leading-none">John Doe</span>
42
+ <span class="text-xs text-muted-foreground">Founder, ACME Inc.</span>
43
+ </div>
44
+ </div>
@@ -0,0 +1,36 @@
1
+ <button type="button" class="ui-badge" data-size="icon">
2
+ <span class="sr-only">Icon badge default</span>
3
+ <svg fill="currentColor" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256">
4
+ <rect width="256" height="256" fill="none" />
5
+ <circle cx="128" cy="128" r="12" />
6
+ <circle cx="196" cy="128" r="12" />
7
+ <circle cx="60" cy="128" r="12" />
8
+ </svg>
9
+ </button>
10
+ <button type="button" class="ui-badge" data-size="icon" data-variant="primary">
11
+ <span class="sr-only">Icon badge primary</span>
12
+ <svg fill="currentColor" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256">
13
+ <rect width="256" height="256" fill="none" />
14
+ <circle cx="128" cy="128" r="12" />
15
+ <circle cx="196" cy="128" r="12" />
16
+ <circle cx="60" cy="128" r="12" />
17
+ </svg>
18
+ </button>
19
+ <button type="button" class="ui-badge" data-size="icon" data-variant="muted">
20
+ <span class="sr-only">Icon badge muted</span>
21
+ <svg fill="currentColor" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256">
22
+ <rect width="256" height="256" fill="none" />
23
+ <circle cx="128" cy="128" r="12" />
24
+ <circle cx="196" cy="128" r="12" />
25
+ <circle cx="60" cy="128" r="12" />
26
+ </svg>
27
+ </button>
28
+ <button type="button" class="ui-badge" data-size="icon" data-variant="ghost">
29
+ <span class="sr-only">Icon badge ghost</span>
30
+ <svg fill="currentColor" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256">
31
+ <rect width="256" height="256" fill="none" />
32
+ <circle cx="128" cy="128" r="12" />
33
+ <circle cx="196" cy="128" r="12" />
34
+ <circle cx="60" cy="128" r="12" />
35
+ </svg>
36
+ </button>
@@ -0,0 +1,251 @@
1
+ /**
2
+ * badge.css: Badge (.ui-badge)
3
+ *
4
+ * @layer variables, components
5
+ * @requires layers.css, _variables.css, _reset.css
6
+ * @uses color-mix(), oklch(from …): variant hover/active tints
7
+ * @uses text-box: vertical trim (patchy browser support)
8
+ * @tokens --ui-badge-* (@layer variables)
9
+ * @consumedby combobox.css (selection tags)
10
+ */
11
+
12
+ @layer variables {
13
+ :root {
14
+ --ui-badge-ring-color: var(--ring-color);
15
+
16
+ --ui-badge-font-family: var(--font-family-body);
17
+ --ui-badge-font-size: var(--font-size-xs);
18
+ --ui-badge-font-weight: var(--font-weight-strong);
19
+ --ui-badge-line-height: 1;
20
+
21
+ --ui-badge-background: var(--background);
22
+ --ui-badge-background--hover: var(--muted);
23
+ --ui-badge-background--active: oklch(from var(--muted) l c h / calc(alpha - 0.02));
24
+
25
+ --ui-badge-foreground: var(--foreground);
26
+ --ui-badge-foreground--hover: var(--foreground);
27
+ --ui-badge-foreground--active: var(--foreground);
28
+
29
+ --ui-badge-border: 1px solid var(--border);
30
+ --ui-badge-border--hover: 1px solid var(--border);
31
+ --ui-badge-border--active: 1px solid var(--border);
32
+
33
+ --ui-badge-gap: var(--step-1);
34
+ --ui-badge-padding: var(--step-1_5);
35
+ --ui-badge-height: var(--step-5_5);
36
+ --ui-badge-radius: var(--radius-sm);
37
+
38
+ --ui-badge-icon-size: var(--step-3);
39
+
40
+ /* composes into the badge's box-shadow list; use a transparent shadow,
41
+ never `none`, so the focus ring layers stay valid */
42
+ --ui-badge-shadow: 0 0 transparent;
43
+ }
44
+ }
45
+
46
+ @layer zazz.components {
47
+ /* ===========================================================================
48
+ BADGE
49
+ =========================================================================== */
50
+
51
+ .ui-badge {
52
+ font-family: var(--ui-badge-font-family);
53
+ font-size: var(--ui-badge-font-size);
54
+ font-weight: var(--ui-badge-font-weight);
55
+ line-height: var(--ui-badge-line-height);
56
+
57
+ display: flex;
58
+ align-items: center;
59
+ justify-content: center;
60
+ gap: var(--ui-badge-gap);
61
+ flex-shrink: 0;
62
+
63
+ block-size: var(--ui-badge-height);
64
+ min-width: max-content;
65
+ padding-inline: var(--ui-badge-padding);
66
+
67
+ border: var(--ui-badge-border);
68
+ border-radius: var(--ui-badge-radius);
69
+
70
+ color: var(--ui-badge-foreground);
71
+ background-color: var(--ui-badge-background);
72
+
73
+ /* ring renders as box-shadow so it composes with --ui-badge-shadow; the
74
+ ring widths animate from 0 so the ring grows in smoothly on focus */
75
+ --_ring-offset-width: 0px;
76
+ --_ring-width: 0px;
77
+ --_ring: color-mix(in oklch, var(--ui-badge-ring-color) var(--ring-opacity), transparent);
78
+ box-shadow:
79
+ 0 0 0 var(--_ring-offset-width) var(--ring-offset-color),
80
+ 0 0 0 calc(var(--_ring-offset-width) + var(--_ring-width)) var(--_ring, var(--ring)),
81
+ var(--ui-badge-shadow);
82
+
83
+ cursor: default;
84
+ text-decoration: none;
85
+
86
+ /* transparent twin of the ring for forced-colors / high-contrast modes */
87
+ outline: var(--outline-width) var(--outline-style) transparent;
88
+ outline-offset: var(--outline-offset);
89
+
90
+ transition: var(--default-transition);
91
+
92
+ user-select: none;
93
+ text-box: trim-both ex alphabetic;
94
+ }
95
+
96
+ a[href] .ui-badge:not(:disabled, [aria-disabled="true"]),
97
+ a[href].ui-badge:not(:disabled, [aria-disabled="true"]) {
98
+ cursor: pointer;
99
+ }
100
+
101
+ /* ===========================================================================
102
+ BADGE STATES
103
+ =========================================================================== */
104
+
105
+ button.ui-badge:hover:not(:disabled, [aria-disabled="true"]),
106
+ a[href].ui-badge:hover:not(:disabled, [aria-disabled="true"]) {
107
+ color: var(--ui-badge-foreground--hover);
108
+ background-color: var(--ui-badge-background--hover);
109
+ border: var(--ui-badge-border--hover);
110
+ }
111
+
112
+ button.ui-badge:active:not(:disabled, [aria-disabled="true"]),
113
+ a[href].ui-badge:active:not(:disabled, [aria-disabled="true"]) {
114
+ color: var(--ui-badge-foreground--active);
115
+ background-color: var(--ui-badge-background--active);
116
+ border: var(--ui-badge-border--active);
117
+ }
118
+
119
+ button.ui-badge:focus-visible:hover:not(:disabled, [aria-disabled="true"]),
120
+ a[href].ui-badge:focus-visible:hover:not(:disabled, [aria-disabled="true"]) {
121
+ --_ring-offset-width: var(--ring-offset-width);
122
+ --_ring-width: var(--ring-width);
123
+
124
+ outline-color: transparent;
125
+ }
126
+
127
+ :is(button.ui-badge:disabled, a[href].ui-badge:disabled),
128
+ :is(button.ui-badge[aria-disabled="true"], a[href].ui-badge[aria-disabled="true"]) {
129
+ --ui-badge-foreground: var(--muted-foreground);
130
+ --ui-badge-background: var(--muted);
131
+ --ui-badge-shadow: 0 0 transparent;
132
+
133
+ cursor: default;
134
+ opacity: 0.5;
135
+ outline: none;
136
+ }
137
+
138
+ button.ui-badge[aria-busy="true"],
139
+ a[href].ui-badge[aria-busy="true"] {
140
+ cursor: progress;
141
+ }
142
+
143
+ /* ===========================================================================
144
+ BADGE ICONS
145
+ =========================================================================== */
146
+
147
+ .ui-badge > svg {
148
+ inline-size: var(--ui-badge-icon-size);
149
+ block-size: var(--ui-badge-icon-size);
150
+ pointer-events: none;
151
+ justify-content: center;
152
+ align-items: center;
153
+ display: flex;
154
+ padding: 0;
155
+ }
156
+
157
+ /* ===========================================================================
158
+ BADGE VARIANTS
159
+ =========================================================================== */
160
+
161
+ .ui-badge[data-variant="primary"] {
162
+ --ui-badge-background: var(--primary);
163
+ --ui-badge-background--hover: oklch(from var(--primary) l c h / 0.9);
164
+ --ui-badge-background--active: oklch(from var(--primary) l c h / 0.8);
165
+
166
+ --ui-badge-foreground: var(--primary-foreground);
167
+ --ui-badge-foreground--hover: var(--primary-foreground);
168
+ --ui-badge-foreground--active: var(--primary-foreground);
169
+
170
+ --ui-badge-border: 1px solid transparent;
171
+ --ui-badge-border--hover: 1px solid transparent;
172
+ --ui-badge-border--active: 1px solid transparent;
173
+ }
174
+
175
+ .ui-badge[data-variant="muted"] {
176
+ --ui-badge-background: var(--muted);
177
+ --ui-badge-background--hover: oklch(from var(--muted) l c h / calc(alpha - 0.02));
178
+ --ui-badge-background--active: var(--muted);
179
+
180
+ --ui-badge-foreground: var(--foreground);
181
+ --ui-badge-foreground--hover: var(--foreground);
182
+ --ui-badge-foreground--active: var(--foreground);
183
+
184
+ --ui-badge-border: 1px solid transparent;
185
+ --ui-badge-border--hover: 1px solid transparent;
186
+ --ui-badge-border--active: 1px solid transparent;
187
+ }
188
+
189
+ .ui-badge[data-variant="ghost"] {
190
+ --ui-badge-background: transparent;
191
+ --ui-badge-background--hover: var(--muted);
192
+ --ui-badge-background--active: oklch(from var(--muted) l c h / calc(alpha - 0.02));
193
+
194
+ --ui-badge-foreground: var(--foreground);
195
+ --ui-badge-foreground--hover: var(--foreground);
196
+ --ui-badge-foreground--active: var(--foreground);
197
+
198
+ --ui-badge-border: 1px solid transparent;
199
+ --ui-badge-border--hover: 1px solid transparent;
200
+ --ui-badge-border--active: 1px solid transparent;
201
+ }
202
+
203
+ .ui-badge[data-variant="link"] {
204
+ --ui-badge-background: transparent;
205
+ --ui-badge-background--hover: transparent;
206
+ --ui-badge-background--active: transparent;
207
+
208
+ --ui-badge-foreground: var(--foreground);
209
+ --ui-badge-foreground--hover: var(--primary);
210
+ --ui-badge-foreground--active: oklch(from var(--primary) l c h / 0.8);
211
+
212
+ --ui-badge-border: none;
213
+ --ui-badge-border--hover: none;
214
+ --ui-badge-border--active: none;
215
+
216
+ --ui-badge-height: fit-content;
217
+ --ui-badge-padding: 0;
218
+ --ui-badge-radius: 0;
219
+
220
+ --ui-badge-shadow: 0 0 transparent;
221
+
222
+ text-decoration-line: var(--decoration-line);
223
+ text-decoration-style: var(--decoration-style);
224
+ text-decoration-color: var(--decoration-color);
225
+ text-underline-offset: var(--decoration-offset);
226
+ text-decoration-thickness: var(--decoration-thickness);
227
+ }
228
+
229
+ button.ui-badge[data-variant="link"]:hover:not(:disabled, [aria-disabled="true"]),
230
+ a[href].ui-badge[data-variant="link"]:hover:not(:disabled, [aria-disabled="true"]) {
231
+ text-decoration-color: var(--decoration-color--hover);
232
+ text-underline-offset: var(--decoration-offset--hover);
233
+ }
234
+
235
+ button.ui-badge[data-variant="link"]:active:not(:disabled, [aria-disabled="true"]),
236
+ a[href].ui-badge[data-variant="link"]:active:not(:disabled, [aria-disabled="true"]) {
237
+ text-decoration-color: var(--decoration-color--active);
238
+ text-underline-offset: var(--decoration-offset--active);
239
+ }
240
+
241
+ /* ===========================================================================
242
+ BADGE SIZES
243
+ =========================================================================== */
244
+
245
+ .ui-badge[data-size="icon"] {
246
+ block-size: var(--ui-badge-height);
247
+ inline-size: var(--ui-badge-height);
248
+ padding: 0;
249
+ aspect-ratio: 1 / 1;
250
+ }
251
+ }
@@ -0,0 +1,7 @@
1
+ <div class="flex items-center gap-sm">
2
+ <button type="button" class="ui-badge">Category</button>
3
+ <button type="button" class="ui-badge" data-variant="primary">New</button>
4
+ <button type="button" class="ui-badge" data-variant="muted">Draft</button>
5
+ <button type="button" class="ui-badge" data-variant="ghost">Inline</button>
6
+ <button type="button" class="ui-badge" data-variant="link">Posts</button>
7
+ </div>
@@ -0,0 +1,9 @@
1
+ <nav class="flex items-center gap-xs">
2
+ <menu class="flex items-center gap-xs">
3
+ <li><a class="ui-button" data-variant="link">Home</a></li>
4
+ <li><span class="text-muted-foreground opacity-50">/</span></li>
5
+ <li>
6
+ <div class="ui-button" data-variant="link" aria-disabled="true">Product name</div>
7
+ </li>
8
+ </menu>
9
+ </nav>
@@ -0,0 +1,84 @@
1
+ <div class="flex items-center gap-sm">
2
+ <button type="button" class="ui-button" data-size="icon" aria-label="Open menu">
3
+ <svg
4
+ xmlns="http://www.w3.org/2000/svg"
5
+ viewBox="0 0 24 24"
6
+ fill="none"
7
+ stroke="currentColor"
8
+ stroke-width="2"
9
+ stroke-linecap="round"
10
+ stroke-linejoin="round"
11
+ aria-hidden="true"
12
+ >
13
+ <line x1="4" y1="6" x2="20" y2="6" />
14
+ <line x1="4" y1="12" x2="20" y2="12" />
15
+ <line x1="4" y1="18" x2="20" y2="18" />
16
+ </svg>
17
+ </button>
18
+ <button
19
+ type="button"
20
+ class="ui-button"
21
+ data-variant="primary"
22
+ data-size="icon"
23
+ aria-label="Open menu"
24
+ >
25
+ <svg
26
+ xmlns="http://www.w3.org/2000/svg"
27
+ viewBox="0 0 24 24"
28
+ fill="none"
29
+ stroke="currentColor"
30
+ stroke-width="2"
31
+ stroke-linecap="round"
32
+ stroke-linejoin="round"
33
+ aria-hidden="true"
34
+ >
35
+ <line x1="4" y1="6" x2="20" y2="6" />
36
+ <line x1="4" y1="12" x2="20" y2="12" />
37
+ <line x1="4" y1="18" x2="20" y2="18" />
38
+ </svg>
39
+ </button>
40
+ <button
41
+ type="button"
42
+ class="ui-button"
43
+ data-variant="muted"
44
+ data-size="icon"
45
+ aria-label="Open menu"
46
+ >
47
+ <svg
48
+ xmlns="http://www.w3.org/2000/svg"
49
+ viewBox="0 0 24 24"
50
+ fill="none"
51
+ stroke="currentColor"
52
+ stroke-width="2"
53
+ stroke-linecap="round"
54
+ stroke-linejoin="round"
55
+ aria-hidden="true"
56
+ >
57
+ <line x1="4" y1="6" x2="20" y2="6" />
58
+ <line x1="4" y1="12" x2="20" y2="12" />
59
+ <line x1="4" y1="18" x2="20" y2="18" />
60
+ </svg>
61
+ </button>
62
+ <button
63
+ type="button"
64
+ class="ui-button"
65
+ data-variant="ghost"
66
+ data-size="icon"
67
+ aria-label="Open menu"
68
+ >
69
+ <svg
70
+ xmlns="http://www.w3.org/2000/svg"
71
+ viewBox="0 0 24 24"
72
+ fill="none"
73
+ stroke="currentColor"
74
+ stroke-width="2"
75
+ stroke-linecap="round"
76
+ stroke-linejoin="round"
77
+ aria-hidden="true"
78
+ >
79
+ <line x1="4" y1="6" x2="20" y2="6" />
80
+ <line x1="4" y1="12" x2="20" y2="12" />
81
+ <line x1="4" y1="18" x2="20" y2="18" />
82
+ </svg>
83
+ </button>
84
+ </div>
@@ -0,0 +1,82 @@
1
+ <div class="flex items-center gap-sm">
2
+ <button class="ui-button" data-variant="primary" type="button">
3
+ Start free trial
4
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256">
5
+ <rect width="256" height="256" fill="none" />
6
+ <line
7
+ x1="40"
8
+ y1="128"
9
+ x2="216"
10
+ y2="128"
11
+ fill="none"
12
+ stroke="currentColor"
13
+ stroke-linecap="round"
14
+ stroke-linejoin="round"
15
+ stroke-width="16"
16
+ />
17
+ <polyline
18
+ points="144 56 216 128 144 200"
19
+ fill="none"
20
+ stroke="currentColor"
21
+ stroke-linecap="round"
22
+ stroke-linejoin="round"
23
+ stroke-width="16"
24
+ />
25
+ </svg>
26
+ </button>
27
+ <button class="ui-button" type="button">
28
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256">
29
+ <rect width="256" height="256" fill="none" />
30
+ <path
31
+ d="M128,88a32,32,0,0,1,32-32h72V200H160a32,32,0,0,0-32,32"
32
+ fill="none"
33
+ stroke="currentColor"
34
+ stroke-linecap="round"
35
+ stroke-linejoin="round"
36
+ stroke-width="16"
37
+ />
38
+ <path
39
+ d="M24,200H96a32,32,0,0,1,32,32V88A32,32,0,0,0,96,56H24Z"
40
+ fill="none"
41
+ stroke="currentColor"
42
+ stroke-linecap="round"
43
+ stroke-linejoin="round"
44
+ stroke-width="16"
45
+ />
46
+ <line
47
+ x1="160"
48
+ y1="96"
49
+ x2="200"
50
+ y2="96"
51
+ fill="none"
52
+ stroke="currentColor"
53
+ stroke-linecap="round"
54
+ stroke-linejoin="round"
55
+ stroke-width="16"
56
+ />
57
+ <line
58
+ x1="160"
59
+ y1="128"
60
+ x2="200"
61
+ y2="128"
62
+ fill="none"
63
+ stroke="currentColor"
64
+ stroke-linecap="round"
65
+ stroke-linejoin="round"
66
+ stroke-width="16"
67
+ />
68
+ <line
69
+ x1="160"
70
+ y1="160"
71
+ x2="200"
72
+ y2="160"
73
+ fill="none"
74
+ stroke="currentColor"
75
+ stroke-linecap="round"
76
+ stroke-linejoin="round"
77
+ stroke-width="16"
78
+ />
79
+ </svg>
80
+ Read article
81
+ </button>
82
+ </div>