@nswds/ui 1.1.0 → 1.3.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 (38) hide show
  1. package/dist/components/badge.d.ts +26 -0
  2. package/dist/components/badge.js +410 -0
  3. package/dist/components/badge.js.map +1 -0
  4. package/dist/components/button.d.ts +35 -5
  5. package/dist/components/button.js +347 -39
  6. package/dist/components/button.js.map +1 -1
  7. package/dist/components/description-list.d.ts +8 -0
  8. package/dist/components/description-list.js +52 -0
  9. package/dist/components/description-list.js.map +1 -0
  10. package/dist/components/icons.js +38220 -3822
  11. package/dist/components/icons.js.map +1 -1
  12. package/dist/components/link.d.ts +18 -0
  13. package/dist/components/link.js +21 -0
  14. package/dist/components/link.js.map +1 -0
  15. package/dist/components/logo.js.map +1 -1
  16. package/dist/components/spinner.d.ts +19 -0
  17. package/dist/components/spinner.js +47 -0
  18. package/dist/components/spinner.js.map +1 -0
  19. package/dist/index.d.ts +11 -3
  20. package/dist/index.js +7 -0
  21. package/dist/lib/color-palette.d.ts +49 -0
  22. package/dist/lib/color-palette.js +5045 -0
  23. package/dist/lib/color-palette.js.map +1 -0
  24. package/dist/lib/colors.d.ts +38 -0
  25. package/dist/lib/colors.js +272 -0
  26. package/dist/lib/colors.js.map +1 -0
  27. package/dist/lib/theme-palette.d.ts +49 -0
  28. package/dist/lib/theme-palette.js +103 -0
  29. package/dist/lib/theme-palette.js.map +1 -0
  30. package/dist/lib/utils.d.ts +5 -1
  31. package/dist/lib/utils.js +16 -1
  32. package/dist/lib/utils.js.map +1 -1
  33. package/dist/styles.css +1 -1
  34. package/dist/types/types.d.ts +146 -0
  35. package/dist/types/types.js +3 -0
  36. package/dist/types/types.js.map +1 -0
  37. package/package.json +12 -4
  38. package/src/styles/globals.css.d.ts +2 -0
@@ -1,54 +1,362 @@
1
1
  "use client"
2
- import { jsx } from 'react/jsx-runtime';
3
- import { Button as Button$1 } from '@base-ui/react/button';
2
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
3
+ import * as Headless from '@headlessui/react';
4
4
  import { cva } from 'class-variance-authority';
5
- import { cn } from '@nswds/ui/lib/utils';
5
+ import clsx from 'clsx';
6
+ import { forwardRef } from 'react';
7
+ import { cn } from '../lib/utils.js';
8
+ import { Link } from '../components/link.js';
6
9
 
7
- const buttonVariants = cva(
8
- "group/button inline-flex shrink-0 items-center justify-center rounded-md border border-transparent bg-clip-padding text-xs/relaxed font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/30 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
9
- {
10
- variants: {
11
- variant: {
12
- default: "bg-primary text-primary-foreground hover:bg-primary/80",
13
- outline: "border-border hover:bg-input/50 hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:bg-input/30",
14
- secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",
15
- ghost: "hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",
16
- destructive: "bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",
17
- link: "text-primary underline-offset-4 hover:underline"
18
- },
19
- size: {
20
- default: "h-7 gap-1 px-2 text-xs/relaxed has-data-[icon=inline-end]:pe-1.5 has-data-[icon=inline-start]:ps-1.5 [&_svg:not([class*='size-'])]:size-3.5",
21
- xs: "h-5 gap-1 rounded-sm px-2 text-[0.625rem] has-data-[icon=inline-end]:pe-1.5 has-data-[icon=inline-start]:ps-1.5 [&_svg:not([class*='size-'])]:size-2.5",
22
- sm: "h-6 gap-1 px-2 text-xs/relaxed has-data-[icon=inline-end]:pe-1.5 has-data-[icon=inline-start]:ps-1.5 [&_svg:not([class*='size-'])]:size-3",
23
- lg: "h-8 gap-1 px-2.5 text-xs/relaxed has-data-[icon=inline-end]:pe-2 has-data-[icon=inline-start]:ps-2 [&_svg:not([class*='size-'])]:size-4",
24
- icon: "size-7 [&_svg:not([class*='size-'])]:size-3.5",
25
- "icon-xs": "size-5 rounded-sm [&_svg:not([class*='size-'])]:size-2.5",
26
- "icon-sm": "size-6 [&_svg:not([class*='size-'])]:size-3",
27
- "icon-lg": "size-8 [&_svg:not([class*='size-'])]:size-4"
28
- }
10
+ const styles = {
11
+ base: [
12
+ // Base
13
+ "relative isolate inline-flex items-baseline justify-center gap-x-2 rounded-sm border text-base/7 font-bold transition-all",
14
+ // Focus
15
+ "focus:outline focus:outline-2 focus:outline-offset-2 focus:outline-(--btn-bg)",
16
+ // Disabled
17
+ "data-disabled:opacity-50 data-disabled:pointer-events-none",
18
+ // Icon
19
+ "*:data-[slot=icon]:-mx-0.25 *:data-[slot=icon]:my-0.25 sm:*:data-[slot=icon]:my-0.5 *:data-[slot=icon]:size-(--btn-icon-size) *:data-[slot=icon]:shrink-0 *:data-[slot=icon]:self-center *:data-[slot=icon]:text-(--btn-icon) forced-colors:[--btn-icon:ButtonText] forced-colors:data-hover:[--btn-icon:ButtonText]"
20
+ ],
21
+ solid: [
22
+ // Text color
23
+ "text-(--btn-text)",
24
+ // Optical border, implemented as the button background to avoid corner artifacts
25
+ "border-transparent bg-(--btn-border)",
26
+ // Dark mode: border is rendered on `after` so background is set to button background
27
+ "dark:bg-(--btn-bg)",
28
+ // Button background, implemented as foreground layer to stack on top of pseudo-border layer
29
+ "before:absolute before:inset-0 before:-z-10 before:rounded-[calc(var(--radius-sm)-1px)] before:bg-(--btn-bg)",
30
+ // Drop shadow, applied to the inset `before` layer so it blends with the border
31
+ "before:shadow-sm",
32
+ // Background color is moved to control and shadow is removed in dark mode so hide `before` pseudo
33
+ "dark:before:hidden",
34
+ // Dark mode: Subtle white outline is applied using a border
35
+ "dark:border-white/5",
36
+ // Shim/overlay, inset to match button foreground and used for hover state + highlight shadow
37
+ "after:absolute after:inset-0 after:-z-10 after:rounded-[calc(var(--radius-sm)-1px)]",
38
+ // State overlays
39
+ "data-hover:after:bg-(--btn-hover-overlay) data-active:after:bg-(--btn-active-overlay)",
40
+ // Dark mode: `after` layer expands to cover entire button
41
+ "dark:after:-inset-px dark:after:rounded-sm",
42
+ // Disabled
43
+ "data-disabled:before:shadow-none data-disabled:after:shadow-none"
44
+ ],
45
+ soft: [
46
+ // Text color
47
+ "text-(--btn-bg)",
48
+ // Optical border, implemented as the button background to avoid corner artifacts
49
+ "border-transparent bg-(--btn-bg)/10",
50
+ // Dark mode: border is rendered on `after` so background is set to button background
51
+ "dark:bg-(--btn-bg)/20",
52
+ // Button background, implemented as foreground layer to stack on top of pseudo-border layer
53
+ "before:absolute before:inset-0 before:-z-10 before:rounded-[calc(var(--radius-sm)-1px)] before:bg-(--btn-bg)/10",
54
+ // Drop shadow, applied to the inset `before` layer so it blends with the border
55
+ "before:shadow-sm",
56
+ // Background color is moved to control and shadow is removed in dark mode so hide `before` pseudo
57
+ "dark:before:bg-white/5",
58
+ // Dark mode: Subtle white outline is applied using a border
59
+ "dark:border-white/5",
60
+ // Shim/overlay, inset to match button foreground and used for hover state + highlight shadow
61
+ "after:absolute after:inset-0 after:-z-10 after:rounded-[calc(var(--radius-sm)-1px)]",
62
+ // State overlays
63
+ "data-hover:after:bg-(--btn-hover-overlay) data-active:after:bg-(--btn-active-overlay)",
64
+ // Dark mode: `after` layer expands to cover entire button
65
+ "dark:after:-inset-px dark:after:rounded-sm",
66
+ // Disabled
67
+ "data-disabled:before:shadow-none data-disabled:after:shadow-none"
68
+ ],
69
+ surface: [
70
+ // Text color
71
+ "text-(--btn-bg)",
72
+ // Optical border, implemented as the button background to avoid corner artifacts
73
+ "border-(--btn-bg)/50 border-2 bg-(--btn-bg)/5",
74
+ // Dark mode: border is rendered on `after` so background is set to button background
75
+ "dark:bg-(--btn-bg)/30",
76
+ // Button background, implemented as foreground layer to stack on top of pseudo-border layer
77
+ "before:absolute before:inset-0 before:-z-10 before:rounded-[calc(var(--radius-sm)-1px)] before:bg-(--btn-bg)/5",
78
+ // Drop shadow, applied to the inset `before` layer so it blends with the border
79
+ "before:shadow-sm",
80
+ // Background color is moved to control and shadow is removed in dark mode so hide `before` pseudo
81
+ "dark:before:hidden",
82
+ // Dark mode: Subtle white outline is applied using a border
83
+ "dark:border-(--btn-bg)/50",
84
+ // Shim/overlay, inset to match button foreground and used for hover state + highlight shadow
85
+ "after:absolute after:inset-0 after:-z-10 after:rounded-[calc(var(--radius-sm)-1px)]",
86
+ // Border color on hover
87
+ "data-active:border-(--btn-bg) data-hover:border-(--btn-bg)",
88
+ // State overlays
89
+ "data-hover:after:bg-(--btn-hover-overlay) data-active:after:bg-(--btn-active-overlay)",
90
+ // Dark mode: `after` layer expands to cover entire button
91
+ "dark:after:-inset-px dark:after:rounded-sm",
92
+ // Disabled
93
+ "data-disabled:before:shadow-none data-disabled:after:shadow-none"
94
+ ],
95
+ outline: [
96
+ // Text color
97
+ "border-(--btn-bg) text-(--btn-bg) border-2",
98
+ // Optical border, implemented as the button background to avoid corner artifacts
99
+ "bg-transparent",
100
+ // Button background, implemented as foreground layer to stack on top of pseudo-border layer
101
+ "before:absolute before:inset-0 before:-z-10 before:rounded-[calc(var(--radius-sm)-1px)] before:bg-transparent",
102
+ // Drop shadow, applied to the inset `before` layer so it blends with the border
103
+ "before:shadow-sm",
104
+ // Background color is moved to control and shadow is removed in dark mode so hide `before` pseudo
105
+ "dark:before:hidden",
106
+ // Dark mode: Subtle white outline is applied using a border
107
+ "dark:border-(--btn-bg)",
108
+ // Shim/overlay, inset to match button foreground and used for hover state + highlight shadow
109
+ "after:absolute after:inset-0 after:-z-10 after:rounded-[calc(var(--radius-sm)-1px)]",
110
+ // State overlays
111
+ "data-hover:after:bg-(--btn-hover-overlay) data-active:after:bg-(--btn-active-overlay)",
112
+ // Dark mode: `after` layer expands to cover entire button
113
+ "dark:after:-inset-px dark:after:rounded-sm",
114
+ // Disabled
115
+ "data-disabled:before:shadow-none data-disabled:after:shadow-none"
116
+ ],
117
+ ghost: [
118
+ // Text color
119
+ "text-(--btn-bg)",
120
+ // Optical border, implemented as the button background to avoid corner artifacts
121
+ "border-transparent bg-(--btn-transparent)",
122
+ // Button background, implemented as foreground layer to stack on top of pseudo-border layer
123
+ "before:absolute before:inset-0 before:-z-10 before:rounded-[calc(var(--radius-sm)-1px)] before:bg-(--btn-transparent)",
124
+ // Background color is moved to control and shadow is removed in dark mode so hide `before` pseudo
125
+ "dark:before:hidden",
126
+ // Dark mode: Subtle white outline is applied using a border
127
+ "dark:border-white/5",
128
+ // Shim/overlay, inset to match button foreground and used for hover state + highlight shadow
129
+ "after:absolute after:inset-0 after:-z-10 after:rounded-[calc(var(--radius-sm)-1px)]",
130
+ // State overlays
131
+ "data-hover:after:bg-(--btn-hover-overlay) data-active:after:bg-(--btn-active-overlay)",
132
+ // Dark mode: `after` layer expands to cover entire button
133
+ "dark:after:-inset-px dark:after:rounded-sm",
134
+ // Disabled
135
+ "data-disabled:before:shadow-none data-disabled:after:shadow-none"
136
+ ],
137
+ link: [
138
+ // Text color — inherits from color token, no background or border
139
+ "text-(--btn-bg) border-transparent bg-transparent",
140
+ // Underline on interaction
141
+ "underline-offset-4 data-hover:underline data-active:underline"
142
+ // No pseudo-layers needed
143
+ ],
144
+ colors: {
145
+ grey: [
146
+ // Base
147
+ "[--btn-bg:var(--color-grey-600)] [--btn-border:var(--color-grey-600)]/90 [--btn-text:white]",
148
+ // State: Hover
149
+ "[--btn-hover-overlay:var(--color-grey-600)]/10 [--btn-active-overlay:var(--color-grey-600)]/20",
150
+ "data-[variant=solid]:[--btn-hover-overlay:var(--color-white)]/10",
151
+ // State: Active
152
+ "data-[variant=solid]:[--btn-active-overlay:var(--color-black)]/15"
153
+ ],
154
+ white: [
155
+ // Base
156
+ "[--btn-bg:var(--color-white)] [--btn-border:var(--color-white)]/90 [--btn-text:var(--color-grey-800)]",
157
+ // State: Hover
158
+ "[--btn-hover-overlay:var(--color-white)]/10 [--btn-active-overlay:var(--color-white)]/20",
159
+ "data-[variant=solid]:[--btn-hover-overlay:var(--color-black)]/10",
160
+ // State: Active
161
+ "data-[variant=solid]:[--btn-active-overlay:var(--color-black)]/15"
162
+ ],
163
+ primary: [
164
+ // Base
165
+ "[--btn-bg:var(--color-primary-800)] [--btn-border:var(--color-primary-800)]/90 [--btn-text:white]",
166
+ // State: Hover
167
+ "[--btn-hover-overlay:var(--color-primary-800)]/10 [--btn-active-overlay:var(--color-primary-800)]/20",
168
+ "data-[variant=solid]:[--btn-hover-overlay:var(--color-white)]/10",
169
+ // State: Active
170
+ "data-[variant=solid]:[--btn-active-overlay:var(--color-black)]/15"
171
+ ],
172
+ secondary: [
173
+ // Base
174
+ "[--btn-bg:var(--color-primary-200)] [--btn-border:var(--color-primary-200)]/90 [--btn-text:var(--color-primary-800)]",
175
+ // State: Hover
176
+ "[--btn-hover-overlay:var(--color-primary-200)]/10 [--btn-active-overlay:var(--color-primary-200)]/20",
177
+ "data-[variant=solid]:[--btn-hover-overlay:var(--color-white)]/15",
178
+ // State: Active
179
+ "data-[variant=solid]:[--btn-active-overlay:var(--color-primary-800)]/10"
180
+ ],
181
+ tertiary: [
182
+ // Base
183
+ "[--btn-bg:var(--color-primary-600)] [--btn-border:var(--color-primary-600)]/90 [--btn-text:white]",
184
+ // State: Hover
185
+ "[--btn-hover-overlay:var(--color-primary-600)]/10 [--btn-active-overlay:var(--color-primary-600)]/20",
186
+ "data-[variant=solid]:[--btn-hover-overlay:var(--color-white)]/10",
187
+ // State: Active
188
+ "data-[variant=solid]:[--btn-active-overlay:var(--color-black)]/15"
189
+ ],
190
+ accent: [
191
+ // Base
192
+ "[--btn-bg:var(--color-accent-600)] [--btn-border:var(--color-accent-600)]/90 [--btn-text:white]",
193
+ // State: Hover
194
+ "[--btn-hover-overlay:var(--color-accent-600)]/10 [--btn-active-overlay:var(--color-accent-600)]/20",
195
+ "data-[variant=solid]:[--btn-hover-overlay:var(--color-white)]/10",
196
+ // State: Active
197
+ "data-[variant=solid]:[--btn-active-overlay:var(--color-black)]/15"
198
+ ],
199
+ danger: [
200
+ // Base
201
+ "[--btn-bg:var(--color-danger-600)] [--btn-border:var(--color-danger-600)]/90 [--btn-text:white]",
202
+ // State: Hover
203
+ "[--btn-hover-overlay:var(--color-danger-600)]/10 [--btn-active-overlay:var(--color-danger-600)]/20",
204
+ "data-[variant=solid]:[--btn-hover-overlay:var(--color-white)]/10",
205
+ // State: Active
206
+ "data-[variant=solid]:[--btn-active-overlay:var(--color-black)]/15"
207
+ ]
208
+ },
209
+ size: {
210
+ default: "px-[calc(--spacing(6)-1px)] py-[calc(--spacing(4)-1px)] sm:px-[calc(--spacing(5.5)-1px)] sm:py-[calc(--spacing(3)-1px)] [--btn-icon-size:--spacing(6)] sm:[--btn-icon-size:--spacing(5)]",
211
+ sm: "px-[calc(--spacing(5)-1px)] py-[calc(--spacing(3)-1px)] sm:px-[calc(--spacing(4.5)-1px)] sm:py-[calc(--spacing(2)-1px)] [--btn-icon-size:--spacing(5)] sm:[--btn-icon-size:--spacing(4)]",
212
+ lg: "px-[calc(--spacing(7)-1px)] py-[calc(--spacing(5)-1px)] sm:px-[calc(--spacing(6.5)-1px)] sm:py-[calc(--spacing(4)-1px)] [--btn-icon-size:--spacing(7)] sm:[--btn-icon-size:--spacing(6)]",
213
+ icon: "w-10 h-10 flex-none [--btn-icon-size:--spacing(6)] sm:[--btn-icon-size:--spacing(5)]"
214
+ }
215
+ };
216
+ const buttonVariants = cva(styles.base, {
217
+ variants: {
218
+ variant: {
219
+ solid: styles.solid,
220
+ soft: styles.soft,
221
+ surface: styles.surface,
222
+ outline: styles.outline,
223
+ ghost: styles.ghost,
224
+ link: styles.link
225
+ },
226
+ color: {
227
+ white: styles.colors.white,
228
+ grey: styles.colors.grey,
229
+ primary: styles.colors.primary,
230
+ secondary: styles.colors.secondary,
231
+ tertiary: styles.colors.tertiary,
232
+ accent: styles.colors.accent,
233
+ danger: styles.colors.danger
29
234
  },
30
- defaultVariants: {
31
- variant: "default",
32
- size: "default"
235
+ size: {
236
+ default: styles.size.default,
237
+ sm: styles.size.sm,
238
+ lg: styles.size.lg,
239
+ icon: styles.size.icon
33
240
  }
241
+ },
242
+ defaultVariants: {
243
+ variant: "solid",
244
+ color: "primary",
245
+ size: "default"
34
246
  }
35
- );
36
- function Button({
247
+ });
248
+ const Button = forwardRef(function Button2({
37
249
  className,
38
- variant = "default",
39
- size = "default",
250
+ variant,
251
+ color,
252
+ size,
253
+ children,
254
+ block,
255
+ loading,
256
+ alignContent = "center",
257
+ disabled,
258
+ leadingVisual: LeadingVisual,
259
+ trailingVisual: TrailingVisual,
260
+ trailingAction: TrailingAction,
261
+ labelWrap,
262
+ count,
40
263
  ...props
41
- }) {
42
- return /* @__PURE__ */ jsx(
43
- Button$1,
264
+ }, ref) {
265
+ const effectiveDisabled = disabled || loading;
266
+ const classes = cn(
267
+ buttonVariants({ variant, color, size }),
268
+ block && "w-full",
269
+ alignContent === "start" && "justify-start",
270
+ className
271
+ );
272
+ const content = /* @__PURE__ */ jsxs(TouchTarget, { children: [
273
+ loading && /* @__PURE__ */ jsx(ButtonSpinner, {}),
274
+ LeadingVisual && /* @__PURE__ */ jsx(LeadingVisual, { "data-slot": "icon" }),
275
+ labelWrap === false ? /* @__PURE__ */ jsx("span", { className: "whitespace-nowrap", children }) : children,
276
+ count !== void 0 && /* @__PURE__ */ jsx("span", { className: "rounded-full px-1.5 py-0.5 text-xs font-medium tabular-nums opacity-75", children: count }),
277
+ TrailingVisual && /* @__PURE__ */ jsx(TrailingVisual, { "data-slot": "icon" }),
278
+ TrailingAction && /* @__PURE__ */ jsx(TrailingAction, { "data-slot": "icon" })
279
+ ] });
280
+ return "href" in props ? /* @__PURE__ */ jsx(
281
+ Link,
282
+ {
283
+ "data-variant": variant,
284
+ ...props,
285
+ ...effectiveDisabled ? {
286
+ "aria-disabled": true,
287
+ "data-disabled": "",
288
+ tabIndex: -1,
289
+ onClick: (e) => e.preventDefault()
290
+ } : {},
291
+ className: clsx(
292
+ classes,
293
+ effectiveDisabled ? "cursor-not-allowed" : "cursor-pointer"
294
+ ),
295
+ ref,
296
+ children: content
297
+ }
298
+ ) : /* @__PURE__ */ jsx(
299
+ Headless.Button,
44
300
  {
45
- "data-slot": "button",
46
- className: cn(buttonVariants({ variant, size, className })),
47
- ...props
301
+ "data-variant": variant,
302
+ ...props,
303
+ disabled: effectiveDisabled,
304
+ className: clsx(
305
+ classes,
306
+ effectiveDisabled ? "cursor-not-allowed" : "cursor-pointer"
307
+ ),
308
+ ref,
309
+ children: content
48
310
  }
49
311
  );
312
+ });
313
+ function ButtonSpinner() {
314
+ return /* @__PURE__ */ jsxs(
315
+ "svg",
316
+ {
317
+ "data-slot": "icon",
318
+ className: "animate-spin motion-reduce:animate-none",
319
+ xmlns: "http://www.w3.org/2000/svg",
320
+ fill: "none",
321
+ viewBox: "0 0 24 24",
322
+ "aria-hidden": "true",
323
+ children: [
324
+ /* @__PURE__ */ jsx(
325
+ "circle",
326
+ {
327
+ className: "opacity-25",
328
+ cx: "12",
329
+ cy: "12",
330
+ r: "10",
331
+ stroke: "currentColor",
332
+ strokeWidth: "4"
333
+ }
334
+ ),
335
+ /* @__PURE__ */ jsx(
336
+ "path",
337
+ {
338
+ className: "opacity-75",
339
+ fill: "currentColor",
340
+ d: "M4 12a8 8 0 018-8V0C5.373 0 22 5.373 22 12h-4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
341
+ }
342
+ )
343
+ ]
344
+ }
345
+ );
346
+ }
347
+ function TouchTarget({ children }) {
348
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
349
+ /* @__PURE__ */ jsx(
350
+ "span",
351
+ {
352
+ className: "absolute top-1/2 left-1/2 size-[max(100%,2.75rem)] -translate-x-1/2 -translate-y-1/2 rounded-sm bg-transparent [@media(pointer:fine)]:hidden",
353
+ "aria-hidden": "true"
354
+ }
355
+ ),
356
+ children
357
+ ] });
50
358
  }
51
359
 
52
- export { Button, buttonVariants };
360
+ export { Button, TouchTarget, buttonVariants };
53
361
  //# sourceMappingURL=button.js.map
54
362
  //# sourceMappingURL=button.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/button.tsx"],"names":["ButtonPrimitive"],"mappings":";;;;;AAOA,MAAM,cAAA,GAAiB,GAAA;AAAA,EACrB,omBAAA;AAAA,EACA;AAAA,IACE,QAAA,EAAU;AAAA,MACR,OAAA,EAAS;AAAA,QACP,OAAA,EAAS,wDAAA;AAAA,QACT,OAAA,EACE,6HAAA;AAAA,QACF,SAAA,EACE,iIAAA;AAAA,QACF,KAAA,EACE,kHAAA;AAAA,QACF,WAAA,EACE,6NAAA;AAAA,QACF,IAAA,EAAM;AAAA,OACR;AAAA,MACA,IAAA,EAAM;AAAA,QACJ,OAAA,EACE,6IAAA;AAAA,QACF,EAAA,EAAI,wJAAA;AAAA,QACJ,EAAA,EAAI,2IAAA;AAAA,QACJ,EAAA,EAAI,yIAAA;AAAA,QACJ,IAAA,EAAM,+CAAA;AAAA,QACN,SAAA,EAAW,0DAAA;AAAA,QACX,SAAA,EAAW,6CAAA;AAAA,QACX,SAAA,EAAW;AAAA;AACb,KACF;AAAA,IACA,eAAA,EAAiB;AAAA,MACf,OAAA,EAAS,SAAA;AAAA,MACT,IAAA,EAAM;AAAA;AACR;AAEJ;AAEA,SAAS,MAAA,CAAO;AAAA,EACd,SAAA;AAAA,EACA,OAAA,GAAU,SAAA;AAAA,EACV,IAAA,GAAO,SAAA;AAAA,EACP,GAAG;AACL,CAAA,EAAgE;AAC9D,EAAA,uBACE,GAAA;AAAA,IAACA,QAAA;AAAA,IAAA;AAAA,MACC,WAAA,EAAU,QAAA;AAAA,MACV,SAAA,EAAW,GAAG,cAAA,CAAe,EAAE,SAAS,IAAA,EAAM,SAAA,EAAW,CAAC,CAAA;AAAA,MACzD,GAAG;AAAA;AAAA,GACN;AAEJ","file":"button.js","sourcesContent":["\"use client\"\n\nimport { Button as ButtonPrimitive } from \"@base-ui/react/button\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"@nswds/ui/lib/utils\"\n\nconst buttonVariants = cva(\n \"group/button inline-flex shrink-0 items-center justify-center rounded-md border border-transparent bg-clip-padding text-xs/relaxed font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/30 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n {\n variants: {\n variant: {\n default: \"bg-primary text-primary-foreground hover:bg-primary/80\",\n outline:\n \"border-border hover:bg-input/50 hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:bg-input/30\",\n secondary:\n \"bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground\",\n ghost:\n \"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50\",\n destructive:\n \"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40\",\n link: \"text-primary underline-offset-4 hover:underline\",\n },\n size: {\n default:\n \"h-7 gap-1 px-2 text-xs/relaxed has-data-[icon=inline-end]:pe-1.5 has-data-[icon=inline-start]:ps-1.5 [&_svg:not([class*='size-'])]:size-3.5\",\n xs: \"h-5 gap-1 rounded-sm px-2 text-[0.625rem] has-data-[icon=inline-end]:pe-1.5 has-data-[icon=inline-start]:ps-1.5 [&_svg:not([class*='size-'])]:size-2.5\",\n sm: \"h-6 gap-1 px-2 text-xs/relaxed has-data-[icon=inline-end]:pe-1.5 has-data-[icon=inline-start]:ps-1.5 [&_svg:not([class*='size-'])]:size-3\",\n lg: \"h-8 gap-1 px-2.5 text-xs/relaxed has-data-[icon=inline-end]:pe-2 has-data-[icon=inline-start]:ps-2 [&_svg:not([class*='size-'])]:size-4\",\n icon: \"size-7 [&_svg:not([class*='size-'])]:size-3.5\",\n \"icon-xs\": \"size-5 rounded-sm [&_svg:not([class*='size-'])]:size-2.5\",\n \"icon-sm\": \"size-6 [&_svg:not([class*='size-'])]:size-3\",\n \"icon-lg\": \"size-8 [&_svg:not([class*='size-'])]:size-4\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n },\n }\n)\n\nfunction Button({\n className,\n variant = \"default\",\n size = \"default\",\n ...props\n}: ButtonPrimitive.Props & VariantProps<typeof buttonVariants>) {\n return (\n <ButtonPrimitive\n data-slot=\"button\"\n className={cn(buttonVariants({ variant, size, className }))}\n {...props}\n />\n )\n}\n\nexport { Button, buttonVariants }\n"]}
1
+ {"version":3,"sources":["../../src/components/button.tsx"],"names":["Button"],"mappings":";;;;;;;;AAWA,MAAM,MAAA,GAAS;AAAA,EACb,IAAA,EAAM;AAAA;AAAA,IAEJ,2HAAA;AAAA;AAAA,IAEA,+EAAA;AAAA;AAAA,IAEA,4DAAA;AAAA;AAAA,IAEA;AAAA,GACF;AAAA,EACA,KAAA,EAAO;AAAA;AAAA,IAEL,mBAAA;AAAA;AAAA,IAEA,sCAAA;AAAA;AAAA,IAEA,oBAAA;AAAA;AAAA,IAEA,8GAAA;AAAA;AAAA,IAEA,kBAAA;AAAA;AAAA,IAEA,oBAAA;AAAA;AAAA,IAEA,qBAAA;AAAA;AAAA,IAEA,qFAAA;AAAA;AAAA,IAEA,uFAAA;AAA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AAAA,oBAAA,GAAA;AAAA,MAAC,MAAA;AAAA,MAAA;AAAA,QACC,SAAA,EAAU,8IAAA;AAAA,QACV,aAAA,EAAY;AAAA;AAAA,KACd;AAAA,IACC;AAAA,GAAA,EACH,CAAA;AAEJ","file":"button.js","sourcesContent":["'use client'\n\nimport * as Headless from '@headlessui/react'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport clsx from 'clsx'\nimport React, { forwardRef } from 'react'\n\nimport { cn } from '../lib/utils.js'\n\nimport { Link } from '../components/link.js'\n\nconst styles = {\n base: [\n // Base\n 'relative isolate inline-flex items-baseline justify-center gap-x-2 rounded-sm border text-base/7 font-bold transition-all',\n // Focus\n 'focus:outline focus:outline-2 focus:outline-offset-2 focus:outline-(--btn-bg)',\n // Disabled\n 'data-disabled:opacity-50 data-disabled:pointer-events-none',\n // Icon\n '*:data-[slot=icon]:-mx-0.25 *:data-[slot=icon]:my-0.25 sm:*:data-[slot=icon]:my-0.5 *:data-[slot=icon]:size-(--btn-icon-size) *:data-[slot=icon]:shrink-0 *:data-[slot=icon]:self-center *:data-[slot=icon]:text-(--btn-icon) forced-colors:[--btn-icon:ButtonText] forced-colors:data-hover:[--btn-icon:ButtonText]',\n ],\n solid: [\n // Text color\n 'text-(--btn-text)',\n // Optical border, implemented as the button background to avoid corner artifacts\n 'border-transparent bg-(--btn-border)',\n // Dark mode: border is rendered on `after` so background is set to button background\n 'dark:bg-(--btn-bg)',\n // Button background, implemented as foreground layer to stack on top of pseudo-border layer\n 'before:absolute before:inset-0 before:-z-10 before:rounded-[calc(var(--radius-sm)-1px)] before:bg-(--btn-bg)',\n // Drop shadow, applied to the inset `before` layer so it blends with the border\n 'before:shadow-sm',\n // Background color is moved to control and shadow is removed in dark mode so hide `before` pseudo\n 'dark:before:hidden',\n // Dark mode: Subtle white outline is applied using a border\n 'dark:border-white/5',\n // Shim/overlay, inset to match button foreground and used for hover state + highlight shadow\n 'after:absolute after:inset-0 after:-z-10 after:rounded-[calc(var(--radius-sm)-1px)]',\n // State overlays\n 'data-hover:after:bg-(--btn-hover-overlay) data-active:after:bg-(--btn-active-overlay)',\n // Dark mode: `after` layer expands to cover entire button\n 'dark:after:-inset-px dark:after:rounded-sm',\n // Disabled\n 'data-disabled:before:shadow-none data-disabled:after:shadow-none',\n ],\n soft: [\n // Text color\n 'text-(--btn-bg)',\n // Optical border, implemented as the button background to avoid corner artifacts\n 'border-transparent bg-(--btn-bg)/10',\n // Dark mode: border is rendered on `after` so background is set to button background\n 'dark:bg-(--btn-bg)/20',\n // Button background, implemented as foreground layer to stack on top of pseudo-border layer\n 'before:absolute before:inset-0 before:-z-10 before:rounded-[calc(var(--radius-sm)-1px)] before:bg-(--btn-bg)/10',\n // Drop shadow, applied to the inset `before` layer so it blends with the border\n 'before:shadow-sm',\n // Background color is moved to control and shadow is removed in dark mode so hide `before` pseudo\n 'dark:before:bg-white/5',\n // Dark mode: Subtle white outline is applied using a border\n 'dark:border-white/5',\n // Shim/overlay, inset to match button foreground and used for hover state + highlight shadow\n 'after:absolute after:inset-0 after:-z-10 after:rounded-[calc(var(--radius-sm)-1px)]',\n // State overlays\n 'data-hover:after:bg-(--btn-hover-overlay) data-active:after:bg-(--btn-active-overlay)',\n // Dark mode: `after` layer expands to cover entire button\n 'dark:after:-inset-px dark:after:rounded-sm',\n // Disabled\n 'data-disabled:before:shadow-none data-disabled:after:shadow-none',\n ],\n surface: [\n // Text color\n 'text-(--btn-bg)',\n // Optical border, implemented as the button background to avoid corner artifacts\n 'border-(--btn-bg)/50 border-2 bg-(--btn-bg)/5',\n // Dark mode: border is rendered on `after` so background is set to button background\n 'dark:bg-(--btn-bg)/30',\n // Button background, implemented as foreground layer to stack on top of pseudo-border layer\n 'before:absolute before:inset-0 before:-z-10 before:rounded-[calc(var(--radius-sm)-1px)] before:bg-(--btn-bg)/5',\n // Drop shadow, applied to the inset `before` layer so it blends with the border\n 'before:shadow-sm',\n // Background color is moved to control and shadow is removed in dark mode so hide `before` pseudo\n 'dark:before:hidden',\n // Dark mode: Subtle white outline is applied using a border\n 'dark:border-(--btn-bg)/50',\n // Shim/overlay, inset to match button foreground and used for hover state + highlight shadow\n 'after:absolute after:inset-0 after:-z-10 after:rounded-[calc(var(--radius-sm)-1px)]',\n // Border color on hover\n 'data-active:border-(--btn-bg) data-hover:border-(--btn-bg)',\n // State overlays\n 'data-hover:after:bg-(--btn-hover-overlay) data-active:after:bg-(--btn-active-overlay)',\n // Dark mode: `after` layer expands to cover entire button\n 'dark:after:-inset-px dark:after:rounded-sm',\n // Disabled\n 'data-disabled:before:shadow-none data-disabled:after:shadow-none',\n ],\n outline: [\n // Text color\n 'border-(--btn-bg) text-(--btn-bg) border-2',\n // Optical border, implemented as the button background to avoid corner artifacts\n 'bg-transparent',\n // Button background, implemented as foreground layer to stack on top of pseudo-border layer\n 'before:absolute before:inset-0 before:-z-10 before:rounded-[calc(var(--radius-sm)-1px)] before:bg-transparent',\n // Drop shadow, applied to the inset `before` layer so it blends with the border\n 'before:shadow-sm',\n // Background color is moved to control and shadow is removed in dark mode so hide `before` pseudo\n 'dark:before:hidden',\n // Dark mode: Subtle white outline is applied using a border\n 'dark:border-(--btn-bg)',\n // Shim/overlay, inset to match button foreground and used for hover state + highlight shadow\n 'after:absolute after:inset-0 after:-z-10 after:rounded-[calc(var(--radius-sm)-1px)]',\n // State overlays\n 'data-hover:after:bg-(--btn-hover-overlay) data-active:after:bg-(--btn-active-overlay)',\n // Dark mode: `after` layer expands to cover entire button\n 'dark:after:-inset-px dark:after:rounded-sm',\n // Disabled\n 'data-disabled:before:shadow-none data-disabled:after:shadow-none',\n ],\n ghost: [\n // Text color\n 'text-(--btn-bg)',\n // Optical border, implemented as the button background to avoid corner artifacts\n 'border-transparent bg-(--btn-transparent)',\n // Button background, implemented as foreground layer to stack on top of pseudo-border layer\n 'before:absolute before:inset-0 before:-z-10 before:rounded-[calc(var(--radius-sm)-1px)] before:bg-(--btn-transparent)',\n // Background color is moved to control and shadow is removed in dark mode so hide `before` pseudo\n 'dark:before:hidden',\n // Dark mode: Subtle white outline is applied using a border\n 'dark:border-white/5',\n // Shim/overlay, inset to match button foreground and used for hover state + highlight shadow\n 'after:absolute after:inset-0 after:-z-10 after:rounded-[calc(var(--radius-sm)-1px)]',\n // State overlays\n 'data-hover:after:bg-(--btn-hover-overlay) data-active:after:bg-(--btn-active-overlay)',\n // Dark mode: `after` layer expands to cover entire button\n 'dark:after:-inset-px dark:after:rounded-sm',\n // Disabled\n 'data-disabled:before:shadow-none data-disabled:after:shadow-none',\n ],\n link: [\n // Text color — inherits from color token, no background or border\n 'text-(--btn-bg) border-transparent bg-transparent',\n // Underline on interaction\n 'underline-offset-4 data-hover:underline data-active:underline',\n // No pseudo-layers needed\n ],\n colors: {\n grey: [\n // Base\n '[--btn-bg:var(--color-grey-600)] [--btn-border:var(--color-grey-600)]/90 [--btn-text:white]',\n // State: Hover\n '[--btn-hover-overlay:var(--color-grey-600)]/10 [--btn-active-overlay:var(--color-grey-600)]/20',\n 'data-[variant=solid]:[--btn-hover-overlay:var(--color-white)]/10',\n // State: Active\n 'data-[variant=solid]:[--btn-active-overlay:var(--color-black)]/15',\n ],\n white: [\n // Base\n '[--btn-bg:var(--color-white)] [--btn-border:var(--color-white)]/90 [--btn-text:var(--color-grey-800)]',\n // State: Hover\n '[--btn-hover-overlay:var(--color-white)]/10 [--btn-active-overlay:var(--color-white)]/20',\n 'data-[variant=solid]:[--btn-hover-overlay:var(--color-black)]/10',\n // State: Active\n 'data-[variant=solid]:[--btn-active-overlay:var(--color-black)]/15',\n ],\n primary: [\n // Base\n '[--btn-bg:var(--color-primary-800)] [--btn-border:var(--color-primary-800)]/90 [--btn-text:white]',\n // State: Hover\n '[--btn-hover-overlay:var(--color-primary-800)]/10 [--btn-active-overlay:var(--color-primary-800)]/20',\n 'data-[variant=solid]:[--btn-hover-overlay:var(--color-white)]/10',\n // State: Active\n 'data-[variant=solid]:[--btn-active-overlay:var(--color-black)]/15',\n ],\n secondary: [\n // Base\n '[--btn-bg:var(--color-primary-200)] [--btn-border:var(--color-primary-200)]/90 [--btn-text:var(--color-primary-800)]',\n // State: Hover\n '[--btn-hover-overlay:var(--color-primary-200)]/10 [--btn-active-overlay:var(--color-primary-200)]/20',\n 'data-[variant=solid]:[--btn-hover-overlay:var(--color-white)]/15',\n // State: Active\n 'data-[variant=solid]:[--btn-active-overlay:var(--color-primary-800)]/10',\n ],\n tertiary: [\n // Base\n '[--btn-bg:var(--color-primary-600)] [--btn-border:var(--color-primary-600)]/90 [--btn-text:white]',\n // State: Hover\n '[--btn-hover-overlay:var(--color-primary-600)]/10 [--btn-active-overlay:var(--color-primary-600)]/20',\n 'data-[variant=solid]:[--btn-hover-overlay:var(--color-white)]/10',\n // State: Active\n 'data-[variant=solid]:[--btn-active-overlay:var(--color-black)]/15',\n ],\n accent: [\n // Base\n '[--btn-bg:var(--color-accent-600)] [--btn-border:var(--color-accent-600)]/90 [--btn-text:white]',\n // State: Hover\n '[--btn-hover-overlay:var(--color-accent-600)]/10 [--btn-active-overlay:var(--color-accent-600)]/20',\n 'data-[variant=solid]:[--btn-hover-overlay:var(--color-white)]/10',\n // State: Active\n 'data-[variant=solid]:[--btn-active-overlay:var(--color-black)]/15',\n ],\n danger: [\n // Base\n '[--btn-bg:var(--color-danger-600)] [--btn-border:var(--color-danger-600)]/90 [--btn-text:white]',\n // State: Hover\n '[--btn-hover-overlay:var(--color-danger-600)]/10 [--btn-active-overlay:var(--color-danger-600)]/20',\n 'data-[variant=solid]:[--btn-hover-overlay:var(--color-white)]/10',\n // State: Active\n 'data-[variant=solid]:[--btn-active-overlay:var(--color-black)]/15',\n ],\n },\n size: {\n default:\n 'px-[calc(--spacing(6)-1px)] py-[calc(--spacing(4)-1px)] sm:px-[calc(--spacing(5.5)-1px)] sm:py-[calc(--spacing(3)-1px)] [--btn-icon-size:--spacing(6)] sm:[--btn-icon-size:--spacing(5)]',\n sm: 'px-[calc(--spacing(5)-1px)] py-[calc(--spacing(3)-1px)] sm:px-[calc(--spacing(4.5)-1px)] sm:py-[calc(--spacing(2)-1px)] [--btn-icon-size:--spacing(5)] sm:[--btn-icon-size:--spacing(4)]',\n lg: 'px-[calc(--spacing(7)-1px)] py-[calc(--spacing(5)-1px)] sm:px-[calc(--spacing(6.5)-1px)] sm:py-[calc(--spacing(4)-1px)] [--btn-icon-size:--spacing(7)] sm:[--btn-icon-size:--spacing(6)]',\n icon: 'w-10 h-10 flex-none [--btn-icon-size:--spacing(6)] sm:[--btn-icon-size:--spacing(5)]',\n },\n}\n\nconst buttonVariants = cva(styles.base, {\n variants: {\n variant: {\n solid: styles.solid,\n soft: styles.soft,\n surface: styles.surface,\n outline: styles.outline,\n ghost: styles.ghost,\n link: styles.link,\n },\n color: {\n white: styles.colors.white,\n grey: styles.colors.grey,\n primary: styles.colors.primary,\n secondary: styles.colors.secondary,\n tertiary: styles.colors.tertiary,\n accent: styles.colors.accent,\n danger: styles.colors.danger,\n },\n size: {\n default: styles.size.default,\n sm: styles.size.sm,\n lg: styles.size.lg,\n icon: styles.size.icon,\n },\n },\n defaultVariants: {\n variant: 'solid',\n color: 'primary',\n size: 'default',\n },\n})\n\ntype ButtonProps = VariantProps<typeof buttonVariants> & {\n className?: string\n children: React.ReactNode\n /** Stretch button to fill its container width. */\n block?: boolean\n /** Show a spinner and disable interaction. */\n loading?: boolean\n /** Horizontal alignment of button content. */\n alignContent?: 'center' | 'start'\n disabled?: boolean\n /** Icon component rendered before the label. */\n leadingVisual?: React.ElementType\n /** Icon component rendered after the label. */\n trailingVisual?: React.ElementType\n /** Icon component rendered as a trailing action (far end). */\n trailingAction?: React.ElementType\n /** Allow the button label to wrap onto multiple lines. Defaults to true. */\n labelWrap?: boolean\n /** Optional numeric badge rendered after the label. */\n count?: number\n} & (\n | Omit<Headless.ButtonProps, 'as' | 'className' | 'disabled'>\n | Omit<React.ComponentPropsWithoutRef<typeof Link>, 'className' | 'variant'>\n )\n\nconst Button = forwardRef(function Button(\n {\n className,\n variant,\n color,\n size,\n children,\n block,\n loading,\n alignContent = 'center',\n disabled,\n leadingVisual: LeadingVisual,\n trailingVisual: TrailingVisual,\n trailingAction: TrailingAction,\n labelWrap,\n count,\n ...props\n }: ButtonProps,\n ref: React.ForwardedRef<HTMLElement>\n) {\n const effectiveDisabled = disabled || loading\n\n const classes = cn(\n buttonVariants({ variant, color, size }),\n block && 'w-full',\n alignContent === 'start' && 'justify-start',\n className\n )\n\n const content = (\n <TouchTarget>\n {loading && <ButtonSpinner />}\n {LeadingVisual && <LeadingVisual data-slot=\"icon\" />}\n {labelWrap === false ? (\n <span className=\"whitespace-nowrap\">{children}</span>\n ) : (\n children\n )}\n {count !== undefined && (\n <span className=\"rounded-full px-1.5 py-0.5 text-xs font-medium tabular-nums opacity-75\">\n {count}\n </span>\n )}\n {TrailingVisual && <TrailingVisual data-slot=\"icon\" />}\n {TrailingAction && <TrailingAction data-slot=\"icon\" />}\n </TouchTarget>\n )\n\n return 'href' in props ? (\n <Link\n data-variant={variant}\n {...(props as Omit<\n React.ComponentPropsWithoutRef<typeof Link>,\n 'className' | 'variant'\n >)}\n {...(effectiveDisabled\n ? {\n 'aria-disabled': true,\n 'data-disabled': '',\n tabIndex: -1,\n onClick: (e: React.MouseEvent<HTMLAnchorElement>) =>\n e.preventDefault(),\n }\n : {})}\n className={clsx(\n classes,\n effectiveDisabled ? 'cursor-not-allowed' : 'cursor-pointer'\n )}\n ref={ref as React.ForwardedRef<HTMLAnchorElement>}\n >\n {content}\n </Link>\n ) : (\n <Headless.Button\n data-variant={variant}\n {...(props as Omit<\n Headless.ButtonProps,\n 'as' | 'className' | 'disabled'\n >)}\n disabled={effectiveDisabled}\n className={clsx(\n classes,\n effectiveDisabled ? 'cursor-not-allowed' : 'cursor-pointer'\n )}\n ref={ref}\n >\n {content}\n </Headless.Button>\n )\n})\n\n/** Inline spinner — avoids importing the full Icons module into the button bundle. */\nfunction ButtonSpinner() {\n return (\n <svg\n data-slot=\"icon\"\n className=\"animate-spin motion-reduce:animate-none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n aria-hidden=\"true\"\n >\n <circle\n className=\"opacity-25\"\n cx=\"12\"\n cy=\"12\"\n r=\"10\"\n stroke=\"currentColor\"\n strokeWidth=\"4\"\n />\n <path\n className=\"opacity-75\"\n fill=\"currentColor\"\n d=\"M4 12a8 8 0 018-8V0C5.373 0 22 5.373 22 12h-4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z\"\n />\n </svg>\n )\n}\n\n/**\n * Expand the hit area to at least 44×44px on touch devices\n */\nfunction TouchTarget({ children }: { children: React.ReactNode }) {\n return (\n <>\n <span\n className=\"absolute top-1/2 left-1/2 size-[max(100%,2.75rem)] -translate-x-1/2 -translate-y-1/2 rounded-sm bg-transparent [@media(pointer:fine)]:hidden\"\n aria-hidden=\"true\"\n />\n {children}\n </>\n )\n}\n\nexport { Button, buttonVariants, TouchTarget }\n"]}
@@ -0,0 +1,8 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as React from 'react';
3
+
4
+ declare function DescriptionList({ className, ...props }: React.ComponentPropsWithoutRef<'dl'>): react_jsx_runtime.JSX.Element;
5
+ declare function DescriptionTerm({ className, ...props }: React.ComponentPropsWithoutRef<'dt'>): react_jsx_runtime.JSX.Element;
6
+ declare function DescriptionDetails({ className, ...props }: React.ComponentPropsWithoutRef<'dd'>): react_jsx_runtime.JSX.Element;
7
+
8
+ export { DescriptionDetails, DescriptionList, DescriptionTerm };
@@ -0,0 +1,52 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { cn } from '../lib/utils.js';
3
+
4
+ function DescriptionList({
5
+ className,
6
+ ...props
7
+ }) {
8
+ return /* @__PURE__ */ jsx(
9
+ "dl",
10
+ {
11
+ ...props,
12
+ className: cn(
13
+ className,
14
+ "grid grid-cols-1 text-base/6 sm:grid-cols-[min(50%,--spacing(80))_auto] sm:text-sm/6"
15
+ )
16
+ }
17
+ );
18
+ }
19
+ function DescriptionTerm({
20
+ className,
21
+ ...props
22
+ }) {
23
+ return /* @__PURE__ */ jsx(
24
+ "dt",
25
+ {
26
+ ...props,
27
+ className: cn(
28
+ className,
29
+ "col-start-1 border-t border-border pt-3 text-muted-foreground first:border-none sm:border-t sm:py-3"
30
+ )
31
+ }
32
+ );
33
+ }
34
+ function DescriptionDetails({
35
+ className,
36
+ ...props
37
+ }) {
38
+ return /* @__PURE__ */ jsx(
39
+ "dd",
40
+ {
41
+ ...props,
42
+ className: cn(
43
+ className,
44
+ "pt-1 pb-3 text-foreground sm:border-t sm:border-border sm:py-3 sm:[&:nth-child(2)]:border-none"
45
+ )
46
+ }
47
+ );
48
+ }
49
+
50
+ export { DescriptionDetails, DescriptionList, DescriptionTerm };
51
+ //# sourceMappingURL=description-list.js.map
52
+ //# sourceMappingURL=description-list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/description-list.tsx"],"names":[],"mappings":";;;AAIO,SAAS,eAAA,CAAgB;AAAA,EAC9B,SAAA;AAAA,EACA,GAAG;AACL,CAAA,EAAyC;AACvC,EAAA,uBACE,GAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MACE,GAAG,KAAA;AAAA,MACJ,SAAA,EAAW,EAAA;AAAA,QACT,SAAA;AAAA,QACA;AAAA;AACF;AAAA,GACF;AAEJ;AAEO,SAAS,eAAA,CAAgB;AAAA,EAC9B,SAAA;AAAA,EACA,GAAG;AACL,CAAA,EAAyC;AACvC,EAAA,uBACE,GAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MACE,GAAG,KAAA;AAAA,MACJ,SAAA,EAAW,EAAA;AAAA,QACT,SAAA;AAAA,QACA;AAAA;AACF;AAAA,GACF;AAEJ;AAEO,SAAS,kBAAA,CAAmB;AAAA,EACjC,SAAA;AAAA,EACA,GAAG;AACL,CAAA,EAAyC;AACvC,EAAA,uBACE,GAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MACE,GAAG,KAAA;AAAA,MACJ,SAAA,EAAW,EAAA;AAAA,QACT,SAAA;AAAA,QACA;AAAA;AACF;AAAA,GACF;AAEJ","file":"description-list.js","sourcesContent":["import type * as React from 'react'\n\nimport { cn } from '../lib/utils.js'\n\nexport function DescriptionList({\n className,\n ...props\n}: React.ComponentPropsWithoutRef<'dl'>) {\n return (\n <dl\n {...props}\n className={cn(\n className,\n 'grid grid-cols-1 text-base/6 sm:grid-cols-[min(50%,--spacing(80))_auto] sm:text-sm/6'\n )}\n />\n )\n}\n\nexport function DescriptionTerm({\n className,\n ...props\n}: React.ComponentPropsWithoutRef<'dt'>) {\n return (\n <dt\n {...props}\n className={cn(\n className,\n 'col-start-1 border-t border-border pt-3 text-muted-foreground first:border-none sm:border-t sm:py-3'\n )}\n />\n )\n}\n\nexport function DescriptionDetails({\n className,\n ...props\n}: React.ComponentPropsWithoutRef<'dd'>) {\n return (\n <dd\n {...props}\n className={cn(\n className,\n 'pt-1 pb-3 text-foreground sm:border-t sm:border-border sm:py-3 sm:[&:nth-child(2)]:border-none'\n )}\n />\n )\n}\n"]}