@blakesteve/roster 5.0.0 → 5.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 (110) hide show
  1. package/README.md +55 -8
  2. package/dist/components/atoms/Chip/Chip.cjs +1 -1
  3. package/dist/components/atoms/Chip/Chip.js +27 -27
  4. package/dist/components/atoms/Disclosure/Disclosure.cjs +1 -1
  5. package/dist/components/atoms/Disclosure/Disclosure.js +42 -44
  6. package/dist/components/atoms/Stat/Stat.cjs +1 -1
  7. package/dist/components/atoms/Stat/Stat.d.ts +27 -2
  8. package/dist/components/atoms/Stat/Stat.js +38 -13
  9. package/dist/components/atoms/Switch/Switch.cjs +1 -1
  10. package/dist/components/atoms/Switch/Switch.d.ts +11 -1
  11. package/dist/components/atoms/Switch/Switch.js +38 -36
  12. package/dist/components/atoms/Switch/switch-variants.cjs +1 -1
  13. package/dist/components/atoms/Switch/switch-variants.js +1 -1
  14. package/dist/components/molecules/LiquidTabs/LiquidNav.cjs +1 -0
  15. package/dist/components/molecules/LiquidTabs/LiquidNav.d.ts +62 -0
  16. package/dist/components/molecules/LiquidTabs/LiquidNav.js +78 -0
  17. package/dist/components/molecules/LiquidTabs/LiquidTabs.cjs +1 -0
  18. package/dist/components/molecules/LiquidTabs/LiquidTabs.d.ts +69 -0
  19. package/dist/components/molecules/LiquidTabs/LiquidTabs.js +92 -0
  20. package/dist/components/molecules/LiquidTabs/liquid-pill.cjs +1 -0
  21. package/dist/components/molecules/LiquidTabs/liquid-pill.d.ts +56 -0
  22. package/dist/components/molecules/LiquidTabs/liquid-pill.js +129 -0
  23. package/dist/components/molecules/LiquidTabs/liquid-tab-id.cjs +1 -0
  24. package/dist/components/molecules/LiquidTabs/liquid-tab-id.d.ts +12 -0
  25. package/dist/components/molecules/LiquidTabs/liquid-tab-id.js +6 -0
  26. package/dist/components/molecules/Toast/Toaster.cjs +1 -1
  27. package/dist/components/molecules/Toast/Toaster.d.ts +7 -0
  28. package/dist/components/molecules/Toast/Toaster.js +67 -45
  29. package/dist/components/organisms/Dialog/Dialog.cjs +1 -1
  30. package/dist/components/organisms/Dialog/Dialog.js +102 -79
  31. package/dist/components/organisms/Navbar/Navbar.cjs +1 -1
  32. package/dist/components/organisms/Navbar/Navbar.js +157 -157
  33. package/dist/components/organisms/Sheet/Sheet.cjs +1 -0
  34. package/dist/components/organisms/Sheet/Sheet.d.ts +82 -0
  35. package/dist/components/organisms/Sheet/Sheet.js +303 -0
  36. package/dist/components/organisms/Sheet/sheet-drag.cjs +1 -0
  37. package/dist/components/organisms/Sheet/sheet-drag.d.ts +40 -0
  38. package/dist/components/organisms/Sheet/sheet-drag.js +22 -0
  39. package/dist/hooks/useCountdown.cjs +1 -1
  40. package/dist/hooks/useCountdown.d.ts +9 -0
  41. package/dist/hooks/useCountdown.js +20 -23
  42. package/dist/index.d.ts +4 -1
  43. package/dist/internal/motion.cjs +1 -0
  44. package/dist/internal/motion.d.ts +12 -0
  45. package/dist/internal/motion.js +21 -0
  46. package/dist/internal/page-inert.cjs +1 -0
  47. package/dist/internal/page-inert.d.ts +51 -0
  48. package/dist/internal/page-inert.js +36 -0
  49. package/dist/meta.json +3 -3
  50. package/dist/roster.cjs +1 -1
  51. package/dist/roster.css +1 -1
  52. package/dist/roster.js +128 -122
  53. package/package.json +3 -4
  54. package/dist/components/atoms/LiquidTabs/LiquidTabs.cjs +0 -1
  55. package/dist/components/atoms/LiquidTabs/LiquidTabs.d.ts +0 -39
  56. package/dist/components/atoms/LiquidTabs/LiquidTabs.js +0 -120
  57. package/dist/node_modules/date-fns/_lib/getRoundingMethod.cjs +0 -1
  58. package/dist/node_modules/date-fns/_lib/getRoundingMethod.js +0 -9
  59. package/dist/node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.cjs +0 -1
  60. package/dist/node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js +0 -18
  61. package/dist/node_modules/date-fns/_lib/normalizeDates.cjs +0 -1
  62. package/dist/node_modules/date-fns/_lib/normalizeDates.js +0 -11
  63. package/dist/node_modules/date-fns/_lib/normalizeInterval.cjs +0 -1
  64. package/dist/node_modules/date-fns/_lib/normalizeInterval.js +0 -8
  65. package/dist/node_modules/date-fns/add.cjs +0 -1
  66. package/dist/node_modules/date-fns/add.js +0 -19
  67. package/dist/node_modules/date-fns/addDays.cjs +0 -1
  68. package/dist/node_modules/date-fns/addDays.js +0 -9
  69. package/dist/node_modules/date-fns/addMonths.cjs +0 -1
  70. package/dist/node_modules/date-fns/addMonths.js +0 -19
  71. package/dist/node_modules/date-fns/compareAsc.cjs +0 -1
  72. package/dist/node_modules/date-fns/compareAsc.js +0 -8
  73. package/dist/node_modules/date-fns/constants.cjs +0 -1
  74. package/dist/node_modules/date-fns/constants.js +0 -7
  75. package/dist/node_modules/date-fns/constructFrom.cjs +0 -1
  76. package/dist/node_modules/date-fns/constructFrom.js +0 -7
  77. package/dist/node_modules/date-fns/differenceInCalendarDays.cjs +0 -1
  78. package/dist/node_modules/date-fns/differenceInCalendarDays.js +0 -15
  79. package/dist/node_modules/date-fns/differenceInCalendarMonths.cjs +0 -1
  80. package/dist/node_modules/date-fns/differenceInCalendarMonths.js +0 -12
  81. package/dist/node_modules/date-fns/differenceInCalendarYears.cjs +0 -1
  82. package/dist/node_modules/date-fns/differenceInCalendarYears.js +0 -12
  83. package/dist/node_modules/date-fns/differenceInDays.cjs +0 -1
  84. package/dist/node_modules/date-fns/differenceInDays.js +0 -21
  85. package/dist/node_modules/date-fns/differenceInHours.cjs +0 -1
  86. package/dist/node_modules/date-fns/differenceInHours.js +0 -14
  87. package/dist/node_modules/date-fns/differenceInMilliseconds.cjs +0 -1
  88. package/dist/node_modules/date-fns/differenceInMilliseconds.js +0 -7
  89. package/dist/node_modules/date-fns/differenceInMinutes.cjs +0 -1
  90. package/dist/node_modules/date-fns/differenceInMinutes.js +0 -10
  91. package/dist/node_modules/date-fns/differenceInMonths.cjs +0 -1
  92. package/dist/node_modules/date-fns/differenceInMonths.js +0 -23
  93. package/dist/node_modules/date-fns/differenceInSeconds.cjs +0 -1
  94. package/dist/node_modules/date-fns/differenceInSeconds.js +0 -9
  95. package/dist/node_modules/date-fns/differenceInYears.cjs +0 -1
  96. package/dist/node_modules/date-fns/differenceInYears.js +0 -16
  97. package/dist/node_modules/date-fns/endOfDay.cjs +0 -1
  98. package/dist/node_modules/date-fns/endOfDay.js +0 -8
  99. package/dist/node_modules/date-fns/endOfMonth.cjs +0 -1
  100. package/dist/node_modules/date-fns/endOfMonth.js +0 -8
  101. package/dist/node_modules/date-fns/intervalToDuration.cjs +0 -1
  102. package/dist/node_modules/date-fns/intervalToDuration.js +0 -25
  103. package/dist/node_modules/date-fns/isAfter.cjs +0 -1
  104. package/dist/node_modules/date-fns/isAfter.js +0 -7
  105. package/dist/node_modules/date-fns/isLastDayOfMonth.cjs +0 -1
  106. package/dist/node_modules/date-fns/isLastDayOfMonth.js +0 -10
  107. package/dist/node_modules/date-fns/startOfDay.cjs +0 -1
  108. package/dist/node_modules/date-fns/startOfDay.js +0 -8
  109. package/dist/node_modules/date-fns/toDate.cjs +0 -1
  110. package/dist/node_modules/date-fns/toDate.js +0 -7
package/README.md CHANGED
@@ -310,6 +310,7 @@ squeeze its own text until it overflowed. Three things follow:
310
310
  Give any `width: fit-content`, `inline-block` or table-cell ancestor a
311
311
  definite width, or the card measures zero.
312
312
  - **Container queries are required**: Chrome 105+, Safari 16+, Firefox 110+.
313
+ `Stat` lays out with CSS subgrid, which raises its own floor to Chrome 117.
313
314
  Without them a `CallToAction` renders in its narrow form at every width.
314
315
 
315
316
  #### Ink follows the fill
@@ -355,9 +356,9 @@ the supported way now.
355
356
  rule stops matching.** Solid Button, Badge, Pill and Checkbox no longer carry
356
357
  `rst:text-white` or `rst:text-gray-950`, so a selector naming either matches
357
358
  nothing. It fails silently, and it fails *partially*: those classes are still on
358
- `Card`, `Navbar`, `Dialog`, `ActionBar`, `Avatar`, `LiquidTabs` and
359
- `Breadcrumbs`, so a themed foreground keeps working there while reverting on
360
- every solid control. Replace the rule with the token:
359
+ `Card`, `Navbar`, `Dialog`, `ActionBar`, `Avatar` and `Breadcrumbs`, so a
360
+ themed foreground keeps working there while reverting on every solid control.
361
+ Replace the rule with the token:
361
362
 
362
363
  ```css
363
364
  /* before */
@@ -367,6 +368,12 @@ every solid control. Replace the rule with the token:
367
368
  :root { --roster-primary-600-ink: #10142e; }
368
369
  ```
369
370
 
371
+ `LiquidTabs` followed later: its active label reads `--roster-lt-text-active`,
372
+ which defaults to `--roster-primary-500-ink`, the ink of the pill's default
373
+ fill. A rule naming `rst:text-white` on a tab stops matching; a rule on
374
+ `[role="tab"][aria-selected="true"]` still does. If you repaint the pill with
375
+ `--roster-lt-pill`, set `--roster-lt-text-active` to match it.
376
+
370
377
  **If you pass a foreground through `className`, add the hover modifier.** Solid
371
378
  variants now carry `hover:text-*`, and `tailwind-merge` resolves conflicts per
372
379
  modifier, so a bare `rst:text-black` no longer holds through hover. Write
@@ -459,6 +466,12 @@ It is hand-rolled rather than a dependency: seven utilities does not justify a
459
466
  package in a library that ships compiled CSS, and it keeps the stylesheet
460
467
  self-contained — the same reasoning as not bundling a preflight.
461
468
 
469
+ `Sheet` has its own knobs, beside those: `--roster-sheet-enter-duration`
470
+ (280ms), `--roster-sheet-leave-duration` (200ms), the two matching easings, and
471
+ `--roster-sheet-fade-duration` (150ms), which is the whole of its motion under
472
+ reduced motion: a fade, with no slide. Set them at `:root`; they are the same in
473
+ both schemes, so they are not redeclared under `.dark`.
474
+
462
475
  `animate-shimmer` is a highlight travelling across a base, used by `Countdown`'s
463
476
  `gradient` variant. Retint it with two variables:
464
477
 
@@ -717,6 +730,32 @@ toast `status` / `polite`, and a polite live region is read when the reader
717
730
  next pauses — which for a message that disappears in four seconds can mean
718
731
  never.
719
732
 
733
+ **The queue renders into `<body>`, not where `Toaster` is placed.** While a
734
+ `Dialog` or `Sheet` is open, every child of `<body>` is `inert` and
735
+ `aria-hidden` except the dialog layer and anything carrying
736
+ `data-roster-toaster`, which `Toaster`'s host does. So a toast fired from an
737
+ open dialog is still announced, wherever in the app `Toaster` is mounted.
738
+
739
+ A toast host Roster does not render, such as `react-hot-toast`'s own
740
+ `Toaster`, goes silent while a dialog is open unless it opts in. Wrap it in an
741
+ element that is a direct child of `<body>` (render it through a portal if it is
742
+ mounted deeper) and carries the attribute:
743
+
744
+ ```tsx
745
+ <div data-roster-toaster="" style={{ display: "contents" }}>
746
+ <Toaster />
747
+ </div>
748
+ ```
749
+
750
+ Two consequences of rendering into `<body>`:
751
+
752
+ - `--roster-*` tokens set on a wrapper inside your app do not reach the toasts.
753
+ Set them on `:root`. A scoped `.dark` is carried across.
754
+ - Anything else another library mounts straight into `<body>` while a dialog
755
+ is open, such as a date picker's or an autocomplete's popup, is inert too,
756
+ so it can't be clicked. Roster's own popups render into Headless UI's portal
757
+ root and are unaffected.
758
+
720
759
  `variant` on `Toaster` sets the fill for the whole queue:
721
760
 
722
761
  - **`soft`** (default) — the tinted fill `Alert` uses. Quiet enough that a stack
@@ -1083,6 +1122,12 @@ passing it from a server component fails the render with _Functions cannot be
1083
1122
  passed directly to Client Components_. A small `"use client"` wrapper binds it
1084
1123
  once, and the pages that use the wrapper stay server-rendered.
1085
1124
 
1125
+ `LiquidNav` takes a `linkComponent` too, with a wider contract: each link
1126
+ receives `href` and `to` with the same value, so React Router's `Link` works as
1127
+ well as `next/link`, plus `className`, `children`, `aria-current`, `onClick` and
1128
+ `data-tab-id`, which it must forward to the DOM. The props type is exported as
1129
+ `LiquidNavLinkProps`. The same client-component rule applies.
1130
+
1086
1131
  `Eyebrow` takes the other approach: `as` accepts any element and the props
1087
1132
  follow it, so `<Eyebrow as="a" href="/work">` works, as does `as={NextLink}`.
1088
1133
 
@@ -1134,12 +1179,11 @@ function App() {
1134
1179
  | `Pill` | Inline phrase chrome: social proof, live state, applied filters |
1135
1180
  | `AvatarStrip` | Stacked avatar row with overflow chip, dismiss button, trailing slot, and label area |
1136
1181
  | `CollapsibleSection` | Clamps any content (prose, chips, image grids) to a fixed height with a fade and expand/collapse toggle |
1137
- | `LiquidTabs` | Controlled tab strip with a liquid sliding pill indicator: pill and filled variants |
1138
1182
  | `Select` | Dropdown selector, on the same size scale as `Button` and `Input` |
1139
1183
  | `SegmentBar` | Proportional horizontal bar divided into colored segments with optional legend |
1140
- | `Stat` | A single figure with its label and, optionally, where the figure came from |
1184
+ | `Stat` | A figure with its label and, optionally, its source; a valid `<dl>` group, or `semantics="standalone"` |
1141
1185
  | `Spinner` | Loading indicator |
1142
- | `Switch` | Toggle switch |
1186
+ | `Switch` | Toggle switch; its label toggles it, and every size is a 44px target |
1143
1187
  | `Textarea` | Multi-line text input |
1144
1188
  | `ThemeToggle` | Flips class-based dark mode on the document root and remembers the choice; labels and icons are configurable |
1145
1189
  | `Tooltip` | Radix-powered tooltip: hover/focus on desktop, tap-to-toggle on mobile |
@@ -1156,6 +1200,8 @@ function App() {
1156
1200
  | `DescriptionList` | Label and value pairs as a real `<dl>`: inline, stacked, or split |
1157
1201
  | `EmptyState` | Zero-data placeholder with icon and action slot |
1158
1202
  | `ErrorState` | Error display with retry action |
1203
+ | `LiquidNav` | `LiquidTabs`' strip as a `nav` of links; takes a router's link component |
1204
+ | `LiquidTabs` | Tab strip with a sliding pill; arrow keys, roving focus, 44px `lg` size |
1159
1205
  | `MatchupCard` | Head-to-head comparison card |
1160
1206
  | `Pullquote` | A line lifted out of prose, as `<figure>` + `<blockquote>` + `<figcaption>` |
1161
1207
  | `RadioGroup` | Radio set reporting one `string`; descriptions, error, 44px targets |
@@ -1171,6 +1217,7 @@ function App() {
1171
1217
  | `Dialog` | Modal dialog |
1172
1218
  | `Footer` | Site footer |
1173
1219
  | `Navbar` | Responsive navigation bar with mobile slide-out |
1220
+ | `Sheet` | Bottom sheet: drag, Escape or backdrop to dismiss; only its content scrolls; returns focus, even from a deep link |
1174
1221
  | `Table` | Static data table |
1175
1222
 
1176
1223
  ### DataTable columns
@@ -1208,7 +1255,7 @@ entry's value as `unknown` and recovers the real type per column through
1208
1255
  The `"use client"` directive sits on each module that needs it, not on the
1209
1256
  package entry. A component carries it; a variant table, a token map and `cn` do
1210
1257
  not. That is what lets a server component import `Button` from the root and get
1211
- a client reference for `Button` alone, rather than for all 102 exports.
1258
+ a client reference for `Button` alone, rather than for all 105 exports.
1212
1259
 
1213
1260
  It changed in 5.0.0, and the difference is worth knowing if you are upgrading.
1214
1261
  Before, the entry itself carried the directive, so importing anything from the
@@ -1228,7 +1275,7 @@ the one that can not be affected by a future change to the barrel.
1228
1275
 
1229
1276
  | Hook | Description |
1230
1277
  | ---------------- | ------------------------------------------------------------------------------- |
1231
- | `useCountdown` | Countdown timer logic without the UI |
1278
+ | `useCountdown` | Countdown timer logic without the UI; `days` counts the whole remaining total |
1232
1279
  | `useKeySequence` | Fires a callback when a sequence of keys is typed in order. Ships `KONAMI_CODE` |
1233
1280
 
1234
1281
  ## Authoring components: the `rst:` prefix
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),k=require("react"),q=require("../../../node_modules/@fortawesome/react-fontawesome/dist/index.cjs"),R=require("../../../node_modules/@fortawesome/free-solid-svg-icons/index.cjs"),c=require("../../../lib/utils.cjs"),w=require("./chip-variants.cjs");function C(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const s in e)if(s!=="default"){const n=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(r,s,n.get?n:{enumerable:!0,get:()=>e[s]})}}return r.default=e,Object.freeze(r)}const P=C(k),d="rst:cursor-pointer rst:disabled:cursor-not-allowed rst:rounded-full rst:focus-visible:outline-hidden rst:focus-visible:ring-2 rst:focus-visible:ring-ring rst:ring-offset-background rst:focus-visible:ring-offset-2",v=P.forwardRef(({className:e,colorScheme:r,variant:s,size:n,leadingIcon:h,onRemove:j,removeLabel:N,onSelectedChange:o,selected:i,disabled:a=!1,children:l,onClick:u,...f},p)=>{const y=!!o,x=!!j,m=c.cn(w.chipVariants({colorScheme:r,variant:s,size:n,disabled:a}),e),b=t.jsxs(t.Fragment,{children:[h&&t.jsx("span",{"aria-hidden":"true",className:"rst:flex rst:shrink-0 rst:items-center rst:justify-center",children:h}),l]}),g=x&&t.jsx("button",{type:"button",disabled:a,onClick:j,"aria-label":N??(typeof l=="string"?`Remove ${l}`:"Remove"),className:c.cn("rst:-mr-1 rst:relative rst:flex rst:shrink-0 rst:items-center rst:justify-center rst:opacity-70 rst:hover:opacity-100 rst:disabled:hover:opacity-70","rst:after:absolute rst:after:-inset-2 rst:after:content-['']",d),children:t.jsx(q.FontAwesomeIcon,{icon:R.faXmark,className:"rst:h-3 rst:w-3","aria-hidden":"true"})});return y&&x?t.jsxs("span",{...f,onClick:u,ref:p,className:m,children:[t.jsx("button",{type:"button",disabled:a,"aria-pressed":!!i,onClick:()=>o(!i),className:c.cn("rst:inline-flex rst:items-center rst:gap-1.5",d),children:b}),g]}):y?t.jsx("button",{...f,ref:p,type:"button",disabled:a,"aria-pressed":!!i,onClick:O=>{u?.(O),o(!i)},className:c.cn(m,d),children:b}):t.jsxs("span",{...f,onClick:u,ref:p,className:m,children:[b,g]})});v.displayName="Chip";exports.Chip=v;
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),R=require("react"),k=require("../../../node_modules/@fortawesome/react-fontawesome/dist/index.cjs"),q=require("../../../node_modules/@fortawesome/free-solid-svg-icons/index.cjs"),a=require("../../../lib/utils.cjs"),T=require("./chip-variants.cjs");function w(e){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(s,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return s.default=e,Object.freeze(s)}const C=w(R),d="rst:cursor-pointer rst:disabled:cursor-not-allowed rst:rounded-full rst:focus-visible:outline-hidden rst:focus-visible:ring-2 rst:focus-visible:ring-ring rst:ring-offset-background rst:focus-visible:ring-offset-2",E="rst:relative rst:before:absolute rst:before:inset-x-0 rst:before:top-1/2 rst:before:h-11 rst:before:-translate-y-1/2 rst:before:content-['']",v=C.forwardRef(({className:e,colorScheme:s,variant:r,size:n,leadingIcon:h,onRemove:j,removeLabel:N,onSelectedChange:c,selected:i,disabled:o=!1,children:l,onClick:u,...f},b)=>{const y=!!c,x=!!j,p=a.cn(T.chipVariants({colorScheme:s,variant:r,size:n,disabled:o}),e),m=t.jsxs(t.Fragment,{children:[h&&t.jsx("span",{"aria-hidden":"true",className:"rst:flex rst:shrink-0 rst:items-center rst:justify-center",children:h}),l]}),g=x&&t.jsx("button",{type:"button",disabled:o,onClick:j,"aria-label":N??(typeof l=="string"?`Remove ${l}`:"Remove"),className:a.cn("rst:-mr-1 rst:relative rst:flex rst:shrink-0 rst:items-center rst:justify-center rst:opacity-70 rst:hover:opacity-100 rst:disabled:hover:opacity-70","rst:after:absolute rst:after:-inset-2 rst:after:content-['']",d),children:t.jsx(k.FontAwesomeIcon,{icon:q.faXmark,className:"rst:h-3 rst:w-3","aria-hidden":"true"})});return y&&x?t.jsxs("span",{...f,onClick:u,ref:b,className:p,children:[t.jsx("button",{type:"button",disabled:o,"aria-pressed":!!i,onClick:()=>c(!i),className:a.cn("rst:inline-flex rst:items-center rst:gap-1.5",d),children:m}),g]}):y?t.jsx("button",{...f,ref:b,type:"button",disabled:o,"aria-pressed":!!i,onClick:O=>{u?.(O),c(!i)},className:a.cn(p,d,E),children:m}):t.jsxs("span",{...f,onClick:u,ref:b,className:p,children:[m,g]})});v.displayName="Chip";exports.Chip=v;
@@ -1,30 +1,30 @@
1
1
  "use client";
2
- import { jsx as r, jsxs as f, Fragment as w } from "react/jsx-runtime";
3
- import * as R from "react";
4
- import { FontAwesomeIcon as C } from "../../../node_modules/@fortawesome/react-fontawesome/dist/index.js";
5
- import { faXmark as F } from "../../../node_modules/@fortawesome/free-solid-svg-icons/index.js";
2
+ import { jsx as r, jsxs as m, Fragment as j } from "react/jsx-runtime";
3
+ import * as w from "react";
4
+ import { FontAwesomeIcon as E } from "../../../node_modules/@fortawesome/react-fontawesome/dist/index.js";
5
+ import { faXmark as T } from "../../../node_modules/@fortawesome/free-solid-svg-icons/index.js";
6
6
  import { cn as e } from "../../../lib/utils.js";
7
- import { chipVariants as O } from "./chip-variants.js";
8
- const p = "rst:cursor-pointer rst:disabled:cursor-not-allowed rst:rounded-full rst:focus-visible:outline-hidden rst:focus-visible:ring-2 rst:focus-visible:ring-ring rst:ring-offset-background rst:focus-visible:ring-offset-2", A = R.forwardRef(
7
+ import { chipVariants as A } from "./chip-variants.js";
8
+ const p = "rst:cursor-pointer rst:disabled:cursor-not-allowed rst:rounded-full rst:focus-visible:outline-hidden rst:focus-visible:ring-2 rst:focus-visible:ring-ring rst:ring-offset-background rst:focus-visible:ring-offset-2", C = "rst:relative rst:before:absolute rst:before:inset-x-0 rst:before:top-1/2 rst:before:h-11 rst:before:-translate-y-1/2 rst:before:content-['']", L = w.forwardRef(
9
9
  ({
10
10
  className: v,
11
11
  colorScheme: N,
12
- variant: g,
13
- size: x,
12
+ variant: x,
13
+ size: g,
14
14
  leadingIcon: u,
15
15
  onRemove: b,
16
16
  removeLabel: k,
17
- onSelectedChange: i,
17
+ onSelectedChange: o,
18
18
  selected: t,
19
19
  disabled: s = !1,
20
- children: o,
20
+ children: i,
21
21
  onClick: n,
22
22
  ...a
23
23
  }, c) => {
24
- const h = !!i, d = !!b, l = e(
25
- O({ colorScheme: N, variant: g, size: x, disabled: s }),
24
+ const h = !!o, d = !!b, l = e(
25
+ A({ colorScheme: N, variant: x, size: g, disabled: s }),
26
26
  v
27
- ), m = /* @__PURE__ */ f(w, { children: [
27
+ ), f = /* @__PURE__ */ m(j, { children: [
28
28
  u && /* `aria-hidden`, like Pill's leading slot. Without it a
29
29
  non-decorative icon — an Avatar, an `<img alt>` — joins the
30
30
  toggle's accessible name and not the dismiss button's, so the two
@@ -38,14 +38,14 @@ const p = "rst:cursor-pointer rst:disabled:cursor-not-allowed rst:rounded-full r
38
38
  children: u
39
39
  }
40
40
  ),
41
- o
41
+ i
42
42
  ] }), y = d && /* @__PURE__ */ r(
43
43
  "button",
44
44
  {
45
45
  type: "button",
46
46
  disabled: s,
47
47
  onClick: b,
48
- "aria-label": k ?? (typeof o == "string" ? `Remove ${o}` : "Remove"),
48
+ "aria-label": k ?? (typeof i == "string" ? `Remove ${i}` : "Remove"),
49
49
  className: e(
50
50
  "rst:-mr-1 rst:relative rst:flex rst:shrink-0 rst:items-center rst:justify-center rst:opacity-70 rst:hover:opacity-100 rst:disabled:hover:opacity-70",
51
51
  /* WCAG 2.5.8 asks 24x24 CSS px for a pointer target, and the glyph
@@ -59,10 +59,10 @@ const p = "rst:cursor-pointer rst:disabled:cursor-not-allowed rst:rounded-full r
59
59
  "rst:after:absolute rst:after:-inset-2 rst:after:content-['']",
60
60
  p
61
61
  ),
62
- children: /* @__PURE__ */ r(C, { icon: F, className: "rst:h-3 rst:w-3", "aria-hidden": "true" })
62
+ children: /* @__PURE__ */ r(E, { icon: T, className: "rst:h-3 rst:w-3", "aria-hidden": "true" })
63
63
  }
64
64
  );
65
- return h && d ? /* @__PURE__ */ f(
65
+ return h && d ? /* @__PURE__ */ m(
66
66
  "span",
67
67
  {
68
68
  ...a,
@@ -76,9 +76,9 @@ const p = "rst:cursor-pointer rst:disabled:cursor-not-allowed rst:rounded-full r
76
76
  type: "button",
77
77
  disabled: s,
78
78
  "aria-pressed": !!t,
79
- onClick: () => i(!t),
79
+ onClick: () => o(!t),
80
80
  className: e("rst:inline-flex rst:items-center rst:gap-1.5", p),
81
- children: m
81
+ children: f
82
82
  }
83
83
  ),
84
84
  y
@@ -92,13 +92,13 @@ const p = "rst:cursor-pointer rst:disabled:cursor-not-allowed rst:rounded-full r
92
92
  type: "button",
93
93
  disabled: s,
94
94
  "aria-pressed": !!t,
95
- onClick: (j) => {
96
- n?.(j), i(!t);
95
+ onClick: (R) => {
96
+ n?.(R), o(!t);
97
97
  },
98
- className: e(l, p),
99
- children: m
98
+ className: e(l, p, C),
99
+ children: f
100
100
  }
101
- ) : /* @__PURE__ */ f(
101
+ ) : /* @__PURE__ */ m(
102
102
  "span",
103
103
  {
104
104
  ...a,
@@ -106,14 +106,14 @@ const p = "rst:cursor-pointer rst:disabled:cursor-not-allowed rst:rounded-full r
106
106
  ref: c,
107
107
  className: l,
108
108
  children: [
109
- m,
109
+ f,
110
110
  y
111
111
  ]
112
112
  }
113
113
  );
114
114
  }
115
115
  );
116
- A.displayName = "Chip";
116
+ L.displayName = "Chip";
117
117
  export {
118
- A as Chip
118
+ L as Chip
119
119
  };
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),b=require("react"),j=require("../../../node_modules/@fortawesome/react-fontawesome/dist/index.cjs"),y=require("../../../node_modules/@fortawesome/free-solid-svg-icons/index.cjs"),r=require("../../../lib/utils.cjs"),i=require("./disclosure-variants.cjs"),q=require("../../../node_modules/@headlessui/react/dist/components/transition/transition.cjs"),v=({title:a,children:c,variant:e,className:l,defaultOpen:d=!1,isOpen:n,onToggle:u,icon:m,...x})=>{const[f,p]=b.useState(d),s=n!==void 0?n:f,h=()=>{const o=!s;n===void 0&&p(o),u?.(o)};return t.jsxs("div",{className:r.cn("rst:w-full rst:flex rst:flex-col",l),...x,children:[t.jsxs("button",{type:"button",onClick:h,"aria-expanded":s,className:r.cn(i.disclosureTriggerVariants({variant:e}),s?"rst:rounded-t-md rst:rounded-b-none":"rst:rounded-md",s&&e==="outline"&&"rst:border-b-transparent rst:dark:border-b-transparent"),children:[t.jsx("span",{className:"rst:flex-1 rst:text-left rst:text-inherit",children:a}),t.jsx("span",{className:r.cn("rst:ml-2 rst:flex rst:items-center rst:transition-transform rst:duration-200 rst:text-inherit",s?"rst:rotate-180":""),children:m||t.jsx(j.FontAwesomeIcon,{icon:y.faChevronDown,className:"rst:h-3.5 rst:w-3.5 rst:opacity-60"})})]}),t.jsx(q.Transition,{show:s,enter:"rst:transition rst:duration-100 rst:ease-out",enterFrom:"rst:transform rst:scale-95 rst:opacity-0",enterTo:"rst:transform rst:scale-100 rst:opacity-100",leave:"rst:transition rst:duration-75 rst:ease-out",leaveFrom:"rst:transform rst:scale-100 rst:opacity-100",leaveTo:"rst:transform rst:scale-95 rst:opacity-0",children:t.jsx("div",{className:r.cn(i.disclosureContentVariants({variant:e}),"rst:rounded-b-md"),children:c})})]})};exports.Disclosure=v;
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),a=require("react"),N=require("../../../node_modules/@fortawesome/react-fontawesome/dist/index.cjs"),w=require("../../../node_modules/@fortawesome/free-solid-svg-icons/index.cjs"),s=require("../../../lib/utils.cjs"),l=require("./disclosure-variants.cjs"),y=require("../../../node_modules/@headlessui/react/dist/components/transition/transition.cjs"),S=({title:u,children:x,variant:r,className:m,defaultOpen:f=!1,isOpen:n,onToggle:p,icon:h,...b})=>{const[j,q]=a.useState(f),t=n!==void 0?n:j,i=a.useId(),[o,c]=a.useState(t);t&&!o&&c(!0);const v=()=>{const d=!t;n===void 0&&q(d),p?.(d)};return e.jsxs("div",{className:s.cn("rst:w-full rst:flex rst:flex-col",m),...b,children:[e.jsxs("button",{type:"button",onClick:v,"aria-expanded":t,"aria-controls":o?i:void 0,className:s.cn(l.disclosureTriggerVariants({variant:r}),t?"rst:rounded-t-md rst:rounded-b-none":"rst:rounded-md",t&&r==="outline"&&"rst:border-b-transparent rst:dark:border-b-transparent"),children:[e.jsx("span",{className:"rst:flex-1 rst:text-left rst:text-inherit",children:u}),e.jsx("span",{className:s.cn("rst:ml-2 rst:flex rst:items-center rst:transition-transform rst:duration-200 rst:motion-reduce:transition-none rst:text-inherit",t?"rst:rotate-180":""),children:h||e.jsx(N.FontAwesomeIcon,{icon:w.faChevronDown,className:"rst:h-3.5 rst:w-3.5 rst:opacity-60"})})]}),e.jsx(y.Transition,{show:t,afterLeave:()=>c(!1),children:e.jsx("div",{id:i,"data-testid":"disclosure-panel",className:s.cn(l.disclosureContentVariants({variant:r}),"rst:rounded-b-md","rst:transition rst:duration-100 rst:ease-out rst:data-leave:duration-75","rst:data-closed:opacity-0 rst:motion-safe:data-closed:scale-95"),children:x})})]})};exports.Disclosure=S;
@@ -1,53 +1,56 @@
1
1
  "use client";
2
- import { jsxs as a, jsx as r } from "react/jsx-runtime";
3
- import { useState as b } from "react";
4
- import { FontAwesomeIcon as v } from "../../../node_modules/@fortawesome/react-fontawesome/dist/index.js";
5
- import { faChevronDown as y } from "../../../node_modules/@fortawesome/free-solid-svg-icons/index.js";
2
+ import { jsxs as l, jsx as r } from "react/jsx-runtime";
3
+ import { useState as c, useId as C } from "react";
4
+ import { FontAwesomeIcon as I } from "../../../node_modules/@fortawesome/react-fontawesome/dist/index.js";
5
+ import { faChevronDown as k } from "../../../node_modules/@fortawesome/free-solid-svg-icons/index.js";
6
6
  import { cn as s } from "../../../lib/utils.js";
7
- import { disclosureTriggerVariants as N, disclosureContentVariants as w } from "./disclosure-variants.js";
8
- import { Transition as C } from "../../../node_modules/@headlessui/react/dist/components/transition/transition.js";
9
- const O = ({
10
- title: i,
11
- children: c,
7
+ import { disclosureTriggerVariants as y, disclosureContentVariants as g } from "./disclosure-variants.js";
8
+ import { Transition as j } from "../../../node_modules/@headlessui/react/dist/components/transition/transition.js";
9
+ const F = ({
10
+ title: m,
11
+ children: u,
12
12
  variant: e,
13
- className: l,
14
- defaultOpen: m = !1,
13
+ className: f,
14
+ defaultOpen: p = !1,
15
15
  isOpen: n,
16
- onToggle: d,
17
- icon: f,
18
- ...p
16
+ onToggle: x,
17
+ icon: h,
18
+ ...b
19
19
  }) => {
20
- const [u, x] = b(m), t = n !== void 0 ? n : u, h = () => {
21
- const o = !t;
22
- n === void 0 && x(o), d?.(o);
20
+ const [v, N] = c(p), t = n !== void 0 ? n : v, o = C(), [a, i] = c(t);
21
+ t && !a && i(!0);
22
+ const w = () => {
23
+ const d = !t;
24
+ n === void 0 && N(d), x?.(d);
23
25
  };
24
- return /* @__PURE__ */ a("div", { className: s("rst:w-full rst:flex rst:flex-col", l), ...p, children: [
25
- /* @__PURE__ */ a(
26
+ return /* @__PURE__ */ l("div", { className: s("rst:w-full rst:flex rst:flex-col", f), ...b, children: [
27
+ /* @__PURE__ */ l(
26
28
  "button",
27
29
  {
28
30
  type: "button",
29
- onClick: h,
31
+ onClick: w,
30
32
  "aria-expanded": t,
33
+ "aria-controls": a ? o : void 0,
31
34
  className: s(
32
- N({ variant: e }),
35
+ y({ variant: e }),
33
36
  // Dynamic rounding and border fix
34
37
  t ? "rst:rounded-t-md rst:rounded-b-none" : "rst:rounded-md",
35
38
  // If it's the outline variant and it's open, remove the bottom border so it merges seamlessly with the content box
36
39
  t && e === "outline" && "rst:border-b-transparent rst:dark:border-b-transparent"
37
40
  ),
38
41
  children: [
39
- /* @__PURE__ */ r("span", { className: "rst:flex-1 rst:text-left rst:text-inherit", children: i }),
42
+ /* @__PURE__ */ r("span", { className: "rst:flex-1 rst:text-left rst:text-inherit", children: m }),
40
43
  /* @__PURE__ */ r(
41
44
  "span",
42
45
  {
43
46
  className: s(
44
- "rst:ml-2 rst:flex rst:items-center rst:transition-transform rst:duration-200 rst:text-inherit",
47
+ "rst:ml-2 rst:flex rst:items-center rst:transition-transform rst:duration-200 rst:motion-reduce:transition-none rst:text-inherit",
45
48
  t ? "rst:rotate-180" : ""
46
49
  ),
47
- children: f || /* @__PURE__ */ r(
48
- v,
50
+ children: h || /* @__PURE__ */ r(
51
+ I,
49
52
  {
50
- icon: y,
53
+ icon: k,
51
54
  className: "rst:h-3.5 rst:w-3.5 rst:opacity-60"
52
55
  }
53
56
  )
@@ -56,27 +59,22 @@ const O = ({
56
59
  ]
57
60
  }
58
61
  ),
59
- /* @__PURE__ */ r(
60
- C,
62
+ /* @__PURE__ */ r(j, { show: t, afterLeave: () => i(!1), children: /* @__PURE__ */ r(
63
+ "div",
61
64
  {
62
- show: t,
63
- enter: "rst:transition rst:duration-100 rst:ease-out",
64
- enterFrom: "rst:transform rst:scale-95 rst:opacity-0",
65
- enterTo: "rst:transform rst:scale-100 rst:opacity-100",
66
- leave: "rst:transition rst:duration-75 rst:ease-out",
67
- leaveFrom: "rst:transform rst:scale-100 rst:opacity-100",
68
- leaveTo: "rst:transform rst:scale-95 rst:opacity-0",
69
- children: /* @__PURE__ */ r(
70
- "div",
71
- {
72
- className: s(w({ variant: e }), "rst:rounded-b-md"),
73
- children: c
74
- }
75
- )
65
+ id: o,
66
+ "data-testid": "disclosure-panel",
67
+ className: s(
68
+ g({ variant: e }),
69
+ "rst:rounded-b-md",
70
+ "rst:transition rst:duration-100 rst:ease-out rst:data-leave:duration-75",
71
+ "rst:data-closed:opacity-0 rst:motion-safe:data-closed:scale-95"
72
+ ),
73
+ children: u
76
74
  }
77
- )
75
+ ) })
78
76
  ] });
79
77
  };
80
78
  export {
81
- O as Disclosure
79
+ F as Disclosure
82
80
  };
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),x=require("react"),s=require("../../../lib/utils.cjs"),u=require("./stat-variants.cjs"),m=require("../Eyebrow/Eyebrow.cjs"),r=x.forwardRef(({value:a,label:n,source:e,size:i,colorScheme:c,className:l,...o},d)=>t.jsxs("div",{ref:d,className:s.cn("rst:flex rst:flex-col rst:gap-[3px]",l),...o,children:[t.jsx("dd",{className:s.cn("rst:m-0",u.statValueVariants({size:i,colorScheme:c})),children:a}),t.jsx("dt",{children:t.jsx(m.Eyebrow,{size:"xs",children:n})}),e&&t.jsx("span",{className:"rst:font-mono rst:text-[0.53125rem] rst:leading-none rst:tracking-[0.06em] rst:text-gray-500 rst:opacity-75 rst:dark:text-gray-400",children:e})]}));r.displayName="Stat";exports.Stat=r;
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),u=require("react"),t=require("../../../lib/utils.cjs"),h=require("./stat-variants.cjs"),o=require("../Eyebrow/Eyebrow.cjs"),d="rst:block rst:font-mono rst:text-[0.53125rem] rst:font-normal rst:normal-nums rst:leading-none rst:tracking-[0.06em] rst:text-gray-500 rst:opacity-75 rst:dark:text-gray-400",x=u.forwardRef(({value:a,label:n,source:r,size:m,colorScheme:j,semantics:g="definition",className:c,...i},l)=>{const e=h.statValueVariants({size:m,colorScheme:j});return g==="standalone"?s.jsxs("div",{ref:l,className:t.cn("rst:flex rst:flex-col rst:gap-[3px]",c),...i,children:[s.jsx("span",{className:e,children:a}),s.jsx(o.Eyebrow,{size:"xs",children:n}),r&&s.jsx("span",{className:d,children:r})]}):s.jsxs("div",{ref:l,className:t.cn("rst:grid rst:content-start rst:gap-[3px]",c),...i,children:[s.jsx("dt",{className:"rst:relative rst:col-start-1 rst:row-start-2",children:s.jsx(o.Eyebrow,{size:"xs",children:n})}),r?s.jsxs("dd",{className:t.cn("rst:m-0",e,"rst:col-start-1 rst:row-span-3 rst:row-start-1 rst:grid rst:grid-rows-subgrid"),children:[s.jsx("span",{className:"rst:row-start-1",children:a}),s.jsx("span",{className:t.cn(d,"rst:row-start-3"),children:r})]}):s.jsx("dd",{className:t.cn("rst:m-0 rst:col-start-1 rst:row-start-1",e),children:a})]})});x.displayName="Stat";exports.Stat=x;
@@ -12,10 +12,35 @@ export interface StatProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "c
12
12
  * stated reads very differently from one that is merely asserted.
13
13
  */
14
14
  source?: React.ReactNode;
15
+ /**
16
+ * `"definition"` (default): a `dt` and `dd` pair in a `div`, for a row of
17
+ * Stats inside a `<dl>`. Only valid there.
18
+ *
19
+ * `"standalone"`: plain spans, for a Stat that is not in a list.
20
+ */
21
+ semantics?: "definition" | "standalone";
15
22
  }
16
23
  /**
17
- * Renders as a `<div>` wrapping a definition pair, so a row of Stats can sit
18
- * inside a `<dl>` and stay semantically honest.
24
+ * A figure with its label, and optionally where it came from.
25
+ *
26
+ * By default a `div` holding a `dt` (the label) then a `dd` (the value, with
27
+ * the source inside it), which is what a group inside a `<dl>` must be: a
28
+ * group is its terms and then its details. The value still shows first,
29
+ * because the grid places it there, not the DOM order.
30
+ *
31
+ * With a source, the `dd` spans three rows as a subgrid, so the source can
32
+ * sit below the label while staying inside the `dd` it describes. Both are
33
+ * pinned to column 1: placed by row alone, the `dd` would find the `dt` in
34
+ * its way at row 2 and move to a new column, beside the label. The `dt` is
35
+ * `relative` because the `dd`'s box covers its row, and without it the label
36
+ * would lose clicks and text selection to that box.
37
+ *
38
+ * A `[&>dd]` selector on the Stat reaches the value and the source. The
39
+ * source sets its own family, size, weight, figures, tracking, leading and
40
+ * color; anything else on the `dd` (`uppercase`, `italic`, `opacity`) reaches
41
+ * it too.
42
+ *
43
+ * A Stat outside a list takes `semantics="standalone"`, which renders spans.
19
44
  */
20
45
  declare const Stat: React.ForwardRefExoticComponent<StatProps & React.RefAttributes<HTMLDivElement>>;
21
46
  export { Stat };
@@ -1,17 +1,42 @@
1
1
  "use client";
2
- import { jsxs as c, jsx as t } from "react/jsx-runtime";
3
- import d from "react";
4
- import { cn as s } from "../../../lib/utils.js";
5
- import { statValueVariants as f } from "./stat-variants.js";
6
- import { Eyebrow as p } from "../Eyebrow/Eyebrow.js";
7
- const x = d.forwardRef(
8
- ({ value: e, label: a, source: r, size: o, colorScheme: i, className: m, ...l }, n) => /* @__PURE__ */ c("div", { ref: n, className: s("rst:flex rst:flex-col rst:gap-[3px]", m), ...l, children: [
9
- /* @__PURE__ */ t("dd", { className: s("rst:m-0", f({ size: o, colorScheme: i })), children: e }),
10
- /* @__PURE__ */ t("dt", { children: /* @__PURE__ */ t(p, { size: "xs", children: a }) }),
11
- r && /* @__PURE__ */ t("span", { className: "rst:font-mono rst:text-[0.53125rem] rst:leading-none rst:tracking-[0.06em] rst:text-gray-500 rst:opacity-75 rst:dark:text-gray-400", children: r })
12
- ] })
2
+ import { jsxs as n, jsx as t } from "react/jsx-runtime";
3
+ import h from "react";
4
+ import { cn as r } from "../../../lib/utils.js";
5
+ import { statValueVariants as g } from "./stat-variants.js";
6
+ import { Eyebrow as d } from "../Eyebrow/Eyebrow.js";
7
+ const m = "rst:block rst:font-mono rst:text-[0.53125rem] rst:font-normal rst:normal-nums rst:leading-none rst:tracking-[0.06em] rst:text-gray-500 rst:opacity-75 rst:dark:text-gray-400", w = h.forwardRef(
8
+ ({ value: a, label: i, source: s, size: p, colorScheme: f, semantics: x = "definition", className: o, ...l }, c) => {
9
+ const e = g({ size: p, colorScheme: f });
10
+ return x === "standalone" ? /* @__PURE__ */ n("div", { ref: c, className: r("rst:flex rst:flex-col rst:gap-[3px]", o), ...l, children: [
11
+ /* @__PURE__ */ t("span", { className: e, children: a }),
12
+ /* @__PURE__ */ t(d, { size: "xs", children: i }),
13
+ s && /* @__PURE__ */ t("span", { className: m, children: s })
14
+ ] }) : (
15
+ /* `content-start`: a Stat in a row of taller siblings is stretched to
16
+ their height, and a grid shares that height out among its auto rows,
17
+ which pushed the label of a Stat without a source down to meet
18
+ nothing. The flex column this replaced never did. */
19
+ /* @__PURE__ */ n("div", { ref: c, className: r("rst:grid rst:content-start rst:gap-[3px]", o), ...l, children: [
20
+ /* @__PURE__ */ t("dt", { className: "rst:relative rst:col-start-1 rst:row-start-2", children: /* @__PURE__ */ t(d, { size: "xs", children: i }) }),
21
+ s ? /* @__PURE__ */ n(
22
+ "dd",
23
+ {
24
+ className: r(
25
+ "rst:m-0",
26
+ e,
27
+ "rst:col-start-1 rst:row-span-3 rst:row-start-1 rst:grid rst:grid-rows-subgrid"
28
+ ),
29
+ children: [
30
+ /* @__PURE__ */ t("span", { className: "rst:row-start-1", children: a }),
31
+ /* @__PURE__ */ t("span", { className: r(m, "rst:row-start-3"), children: s })
32
+ ]
33
+ }
34
+ ) : /* @__PURE__ */ t("dd", { className: r("rst:m-0 rst:col-start-1 rst:row-start-1", e), children: a })
35
+ ] })
36
+ );
37
+ }
13
38
  );
14
- x.displayName = "Stat";
39
+ w.displayName = "Stat";
15
40
  export {
16
- x as Stat
41
+ w as Stat
17
42
  };
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),m=require("../../../node_modules/@headlessui/react/dist/components/description/description.cjs"),d=require("../../../node_modules/@headlessui/react/dist/components/field/field.cjs"),g=require("../../../node_modules/@headlessui/react/dist/components/label/label.cjs"),j=require("../../../node_modules/@headlessui/react/dist/components/switch/switch.cjs"),s=require("../../../lib/utils.cjs"),a=require("./switch-variants.cjs"),p=({checked:n,onChange:l,label:e,description:r,disabled:c=!1,size:i,variant:o,className:u,ariaLabel:x})=>{const h=e?void 0:x||"Toggle setting";return t.jsxs(d.Field,{as:"div",className:s.cn("rst:flex rst:items-center rst:justify-between rst:gap-4",u),children:[(e||r)&&t.jsxs("span",{className:"rst:flex rst:flex-col",children:[e&&t.jsx(g.Label,{passive:!0,className:s.cn("rst:text-sm rst:font-medium rst:text-gray-900 rst:dark:text-gray-100",c&&"rst:opacity-50"),children:e}),r&&t.jsx(m.Description,{className:s.cn("rst:text-xs rst:text-gray-500 rst:dark:text-gray-400",c&&"rst:opacity-50"),children:r})]}),t.jsx(j.Switch,{checked:n,onChange:l,disabled:c,"aria-label":h,className:s.cn(a.switchTrackVariants({variant:o,size:i})),children:t.jsx("span",{"aria-hidden":"true",className:s.cn(a.switchThumbVariants({size:i}))})})]})};exports.Switch=p;
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),d=require("../../../node_modules/@headlessui/react/dist/components/description/description.cjs"),g=require("../../../node_modules/@headlessui/react/dist/components/field/field.cjs"),p=require("../../../node_modules/@headlessui/react/dist/components/label/label.cjs"),j=require("../../../node_modules/@headlessui/react/dist/components/switch/switch.cjs"),s=require("../../../lib/utils.cjs"),n=require("./switch-variants.cjs"),y=({checked:o,onChange:u,label:r,description:c,disabled:e=!1,labelClickable:i=!0,size:a,variant:l,className:x,ariaLabel:h})=>{const m=r?void 0:h||"Toggle setting";return t.jsxs(g.Field,{as:"div",className:s.cn("rst:flex rst:items-center rst:justify-between rst:gap-4",x),children:[(r||c)&&t.jsxs("span",{className:"rst:flex rst:flex-col",children:[r&&t.jsx(p.Label,{passive:!i,className:s.cn("rst:text-sm rst:font-medium rst:text-gray-900 rst:dark:text-gray-100",i&&!e&&"rst:cursor-pointer",e&&"rst:opacity-50"),children:r}),c&&t.jsx(d.Description,{className:s.cn("rst:text-xs rst:text-gray-500 rst:dark:text-gray-400",e&&"rst:opacity-50"),children:c})]}),t.jsx(j.Switch,{checked:o,onChange:u,disabled:e,"aria-label":m,className:s.cn(n.switchTrackVariants({variant:l,size:a})),children:t.jsx("span",{"aria-hidden":"true",className:s.cn(n.switchThumbVariants({size:a}))})})]})};exports.Switch=y;
@@ -6,8 +6,18 @@ export interface SwitchProps extends VariantProps<typeof switchTrackVariants> {
6
6
  label?: string;
7
7
  description?: string;
8
8
  disabled?: boolean;
9
+ /**
10
+ * Whether clicking the label toggles the switch, as clicking any other
11
+ * control's label does. On by default.
12
+ *
13
+ * Turn it off when an ancestor already has a click handler of its own that
14
+ * toggles. With both, one click on the label reaches that handler twice
15
+ * (the label's click, then the one forwarded to the switch, both bubbling)
16
+ * and `onChange` once.
17
+ */
18
+ labelClickable?: boolean;
9
19
  className?: string;
10
20
  ariaLabel?: string;
11
21
  }
12
- declare const Switch: ({ checked, onChange, label, description, disabled, size, variant, className, ariaLabel, }: SwitchProps) => import("react/jsx-runtime").JSX.Element;
22
+ declare const Switch: ({ checked, onChange, label, description, disabled, labelClickable, size, variant, className, ariaLabel, }: SwitchProps) => import("react/jsx-runtime").JSX.Element;
13
23
  export { Switch };