@blakesteve/roster 5.0.1 → 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.
- package/README.md +54 -7
- package/dist/components/atoms/Chip/Chip.cjs +1 -1
- package/dist/components/atoms/Chip/Chip.js +27 -27
- package/dist/components/atoms/Disclosure/Disclosure.cjs +1 -1
- package/dist/components/atoms/Disclosure/Disclosure.js +42 -44
- package/dist/components/atoms/Stat/Stat.cjs +1 -1
- package/dist/components/atoms/Stat/Stat.d.ts +27 -2
- package/dist/components/atoms/Stat/Stat.js +38 -13
- package/dist/components/atoms/Switch/Switch.cjs +1 -1
- package/dist/components/atoms/Switch/Switch.d.ts +11 -1
- package/dist/components/atoms/Switch/Switch.js +38 -36
- package/dist/components/atoms/Switch/switch-variants.cjs +1 -1
- package/dist/components/atoms/Switch/switch-variants.js +1 -1
- package/dist/components/molecules/LiquidTabs/LiquidNav.cjs +1 -0
- package/dist/components/molecules/LiquidTabs/LiquidNav.d.ts +62 -0
- package/dist/components/molecules/LiquidTabs/LiquidNav.js +78 -0
- package/dist/components/molecules/LiquidTabs/LiquidTabs.cjs +1 -0
- package/dist/components/molecules/LiquidTabs/LiquidTabs.d.ts +69 -0
- package/dist/components/molecules/LiquidTabs/LiquidTabs.js +92 -0
- package/dist/components/molecules/LiquidTabs/liquid-pill.cjs +1 -0
- package/dist/components/molecules/LiquidTabs/liquid-pill.d.ts +56 -0
- package/dist/components/molecules/LiquidTabs/liquid-pill.js +129 -0
- package/dist/components/molecules/LiquidTabs/liquid-tab-id.cjs +1 -0
- package/dist/components/molecules/LiquidTabs/liquid-tab-id.d.ts +12 -0
- package/dist/components/molecules/LiquidTabs/liquid-tab-id.js +6 -0
- package/dist/components/molecules/Toast/Toaster.cjs +1 -1
- package/dist/components/molecules/Toast/Toaster.d.ts +7 -0
- package/dist/components/molecules/Toast/Toaster.js +67 -45
- package/dist/components/organisms/Dialog/Dialog.cjs +1 -1
- package/dist/components/organisms/Dialog/Dialog.js +102 -79
- package/dist/components/organisms/Navbar/Navbar.cjs +1 -1
- package/dist/components/organisms/Navbar/Navbar.js +157 -157
- package/dist/components/organisms/Sheet/Sheet.cjs +1 -0
- package/dist/components/organisms/Sheet/Sheet.d.ts +82 -0
- package/dist/components/organisms/Sheet/Sheet.js +303 -0
- package/dist/components/organisms/Sheet/sheet-drag.cjs +1 -0
- package/dist/components/organisms/Sheet/sheet-drag.d.ts +40 -0
- package/dist/components/organisms/Sheet/sheet-drag.js +22 -0
- package/dist/index.d.ts +4 -1
- package/dist/internal/motion.cjs +1 -0
- package/dist/internal/motion.d.ts +12 -0
- package/dist/internal/motion.js +21 -0
- package/dist/internal/page-inert.cjs +1 -0
- package/dist/internal/page-inert.d.ts +51 -0
- package/dist/internal/page-inert.js +36 -0
- package/dist/meta.json +3 -3
- package/dist/roster.cjs +1 -1
- package/dist/roster.css +1 -1
- package/dist/roster.js +128 -122
- package/package.json +1 -1
- package/dist/components/atoms/LiquidTabs/LiquidTabs.cjs +0 -1
- package/dist/components/atoms/LiquidTabs/LiquidTabs.d.ts +0 -39
- package/dist/components/atoms/LiquidTabs/LiquidTabs.js +0 -120
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
|
|
359
|
-
|
|
360
|
-
|
|
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
|
|
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
|
|
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
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),
|
|
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
|
|
3
|
-
import * as
|
|
4
|
-
import { FontAwesomeIcon as
|
|
5
|
-
import { faXmark as
|
|
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
|
|
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",
|
|
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:
|
|
13
|
-
size:
|
|
12
|
+
variant: x,
|
|
13
|
+
size: g,
|
|
14
14
|
leadingIcon: u,
|
|
15
15
|
onRemove: b,
|
|
16
16
|
removeLabel: k,
|
|
17
|
-
onSelectedChange:
|
|
17
|
+
onSelectedChange: o,
|
|
18
18
|
selected: t,
|
|
19
19
|
disabled: s = !1,
|
|
20
|
-
children:
|
|
20
|
+
children: i,
|
|
21
21
|
onClick: n,
|
|
22
22
|
...a
|
|
23
23
|
}, c) => {
|
|
24
|
-
const h = !!
|
|
25
|
-
|
|
24
|
+
const h = !!o, d = !!b, l = e(
|
|
25
|
+
A({ colorScheme: N, variant: x, size: g, disabled: s }),
|
|
26
26
|
v
|
|
27
|
-
),
|
|
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
|
-
|
|
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
|
|
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(
|
|
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__ */
|
|
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: () =>
|
|
79
|
+
onClick: () => o(!t),
|
|
80
80
|
className: e("rst:inline-flex rst:items-center rst:gap-1.5", p),
|
|
81
|
-
children:
|
|
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: (
|
|
96
|
-
n?.(
|
|
95
|
+
onClick: (R) => {
|
|
96
|
+
n?.(R), o(!t);
|
|
97
97
|
},
|
|
98
|
-
className: e(l, p),
|
|
99
|
-
children:
|
|
98
|
+
className: e(l, p, C),
|
|
99
|
+
children: f
|
|
100
100
|
}
|
|
101
|
-
) : /* @__PURE__ */
|
|
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
|
-
|
|
109
|
+
f,
|
|
110
110
|
y
|
|
111
111
|
]
|
|
112
112
|
}
|
|
113
113
|
);
|
|
114
114
|
}
|
|
115
115
|
);
|
|
116
|
-
|
|
116
|
+
L.displayName = "Chip";
|
|
117
117
|
export {
|
|
118
|
-
|
|
118
|
+
L as Chip
|
|
119
119
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
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
|
|
3
|
-
import { useState as
|
|
4
|
-
import { FontAwesomeIcon as
|
|
5
|
-
import { faChevronDown as
|
|
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
|
|
8
|
-
import { Transition as
|
|
9
|
-
const
|
|
10
|
-
title:
|
|
11
|
-
children:
|
|
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:
|
|
14
|
-
defaultOpen:
|
|
13
|
+
className: f,
|
|
14
|
+
defaultOpen: p = !1,
|
|
15
15
|
isOpen: n,
|
|
16
|
-
onToggle:
|
|
17
|
-
icon:
|
|
18
|
-
...
|
|
16
|
+
onToggle: x,
|
|
17
|
+
icon: h,
|
|
18
|
+
...b
|
|
19
19
|
}) => {
|
|
20
|
-
const [
|
|
21
|
-
|
|
22
|
-
|
|
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__ */
|
|
25
|
-
/* @__PURE__ */
|
|
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:
|
|
31
|
+
onClick: w,
|
|
30
32
|
"aria-expanded": t,
|
|
33
|
+
"aria-controls": a ? o : void 0,
|
|
31
34
|
className: s(
|
|
32
|
-
|
|
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:
|
|
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:
|
|
48
|
-
|
|
50
|
+
children: h || /* @__PURE__ */ r(
|
|
51
|
+
I,
|
|
49
52
|
{
|
|
50
|
-
icon:
|
|
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
|
-
|
|
62
|
+
/* @__PURE__ */ r(j, { show: t, afterLeave: () => i(!1), children: /* @__PURE__ */ r(
|
|
63
|
+
"div",
|
|
61
64
|
{
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
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
|
-
|
|
79
|
+
F as Disclosure
|
|
82
80
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
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
|
-
*
|
|
18
|
-
*
|
|
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
|
|
3
|
-
import
|
|
4
|
-
import { cn as
|
|
5
|
-
import { statValueVariants as
|
|
6
|
-
import { Eyebrow as
|
|
7
|
-
const
|
|
8
|
-
({ value:
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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
|
-
|
|
39
|
+
w.displayName = "Stat";
|
|
15
40
|
export {
|
|
16
|
-
|
|
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"),
|
|
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 };
|