@blakesteve/roster 5.2.0 → 5.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.
- package/README.md +121 -20
- package/dist/components/atoms/Avatar/Avatar.cjs +1 -1
- package/dist/components/atoms/Avatar/Avatar.js +1 -1
- package/dist/components/atoms/Avatar/avatar-variants.cjs +1 -1
- package/dist/components/atoms/Avatar/avatar-variants.js +1 -1
- package/dist/components/atoms/Button/button-variants.cjs +1 -1
- package/dist/components/atoms/Button/button-variants.js +3 -3
- package/dist/components/atoms/Card/card-variants.cjs +1 -1
- package/dist/components/atoms/Card/card-variants.js +3 -2
- package/dist/components/atoms/Checkbox/Checkbox.cjs +1 -1
- package/dist/components/atoms/Checkbox/Checkbox.d.ts +5 -0
- package/dist/components/atoms/Checkbox/Checkbox.js +54 -40
- package/dist/components/atoms/Checkbox/checkbox-variants.cjs +1 -1
- package/dist/components/atoms/Checkbox/checkbox-variants.js +1 -1
- package/dist/components/atoms/Combobox/Combobox.cjs +1 -1
- package/dist/components/atoms/Combobox/Combobox.js +63 -62
- package/dist/components/atoms/InlineCode/inline-code-variants.cjs +1 -1
- package/dist/components/atoms/InlineCode/inline-code-variants.js +1 -1
- package/dist/components/atoms/Input/Input.cjs +1 -1
- package/dist/components/atoms/Input/Input.js +49 -52
- package/dist/components/atoms/Input/input-variants.cjs +1 -1
- package/dist/components/atoms/Input/input-variants.js +17 -7
- package/dist/components/atoms/LabeledDivider/LabeledDivider.cjs +1 -1
- package/dist/components/atoms/LabeledDivider/LabeledDivider.js +6 -6
- package/dist/components/atoms/MultiSelect/MultiSelect.cjs +1 -1
- package/dist/components/atoms/MultiSelect/MultiSelect.js +62 -60
- package/dist/components/atoms/PasswordInput/PasswordInput.cjs +1 -1
- package/dist/components/atoms/PasswordInput/PasswordInput.js +1 -1
- package/dist/components/atoms/Select/Select.cjs +1 -1
- package/dist/components/atoms/Select/Select.js +52 -51
- package/dist/components/atoms/Select/select-variants.cjs +1 -1
- package/dist/components/atoms/Select/select-variants.js +9 -2
- package/dist/components/atoms/Switch/switch-variants.cjs +1 -1
- package/dist/components/atoms/Switch/switch-variants.js +1 -1
- package/dist/components/atoms/Textarea/Textarea.cjs +1 -1
- package/dist/components/atoms/Textarea/Textarea.js +36 -34
- package/dist/components/atoms/Textarea/textarea-variants.cjs +1 -1
- package/dist/components/atoms/Textarea/textarea-variants.js +17 -11
- package/dist/components/atoms/Tooltip/Tooltip.cjs +1 -1
- package/dist/components/atoms/Tooltip/Tooltip.js +1 -1
- package/dist/components/molecules/Accordion/Accordion.cjs +1 -1
- package/dist/components/molecules/Accordion/Accordion.js +19 -19
- package/dist/components/molecules/Alert/Alert.cjs +1 -1
- package/dist/components/molecules/Alert/Alert.js +1 -1
- package/dist/components/molecules/CheckboxGroup/CheckboxGroup.cjs +1 -1
- package/dist/components/molecules/CheckboxGroup/CheckboxGroup.d.ts +5 -3
- package/dist/components/molecules/CheckboxGroup/CheckboxGroup.js +68 -65
- package/dist/components/molecules/RadioGroup/RadioGroup.cjs +1 -1
- package/dist/components/molecules/RadioGroup/RadioGroup.d.ts +4 -3
- package/dist/components/molecules/RadioGroup/RadioGroup.js +48 -47
- package/dist/components/molecules/Toast/Toast.cjs +1 -1
- package/dist/components/molecules/Toast/Toast.js +1 -1
- package/dist/components/organisms/Dialog/Dialog.cjs +1 -1
- package/dist/components/organisms/Dialog/Dialog.js +28 -24
- package/dist/components/organisms/Navbar/Navbar.cjs +1 -1
- package/dist/components/organisms/Navbar/Navbar.js +2 -2
- package/dist/components/organisms/Sheet/Sheet.cjs +1 -1
- package/dist/components/organisms/Sheet/Sheet.js +1 -1
- package/dist/internal/field-invalid.cjs +1 -0
- package/dist/internal/field-invalid.d.ts +37 -0
- package/dist/internal/field-invalid.js +13 -0
- package/dist/internal/popup.cjs +1 -1
- package/dist/internal/popup.js +1 -1
- package/dist/lib/utils.cjs +1 -1
- package/dist/lib/utils.js +16 -11
- package/dist/meta.json +3 -3
- package/dist/roster.css +1 -1
- package/package.json +1 -1
|
@@ -1,26 +1,27 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import
|
|
4
|
-
import { Description as
|
|
5
|
-
import { Field as
|
|
6
|
-
import { Label as
|
|
7
|
-
import { Textarea as
|
|
8
|
-
import { cn as
|
|
2
|
+
import { jsxs as N, jsx as e } from "react/jsx-runtime";
|
|
3
|
+
import b from "react";
|
|
4
|
+
import { Description as h } from "../../../node_modules/@headlessui/react/dist/components/description/description.js";
|
|
5
|
+
import { Field as v } from "../../../node_modules/@headlessui/react/dist/components/field/field.js";
|
|
6
|
+
import { Label as w } from "../../../node_modules/@headlessui/react/dist/components/label/label.js";
|
|
7
|
+
import { Textarea as y } from "../../../node_modules/@headlessui/react/dist/components/textarea/textarea.js";
|
|
8
|
+
import { cn as s } from "../../../lib/utils.js";
|
|
9
9
|
import { textareaVariants as k } from "./textarea-variants.js";
|
|
10
|
-
|
|
10
|
+
import { isFieldInvalid as j, withoutInvalidProps as F } from "../../../internal/field-invalid.js";
|
|
11
|
+
const I = b.forwardRef(
|
|
11
12
|
({
|
|
12
13
|
className: m,
|
|
13
|
-
label:
|
|
14
|
-
helperText:
|
|
14
|
+
label: a,
|
|
15
|
+
helperText: o,
|
|
15
16
|
errorMessage: t,
|
|
16
|
-
variant:
|
|
17
|
-
error:
|
|
18
|
-
resize:
|
|
19
|
-
disabled:
|
|
20
|
-
textareaClassName:
|
|
21
|
-
...
|
|
17
|
+
variant: l,
|
|
18
|
+
error: n,
|
|
19
|
+
resize: d,
|
|
20
|
+
disabled: c,
|
|
21
|
+
textareaClassName: x,
|
|
22
|
+
...i
|
|
22
23
|
}, f) => {
|
|
23
|
-
const
|
|
24
|
+
const r = !!t || n, p = j(r, i), u = F(i);
|
|
24
25
|
return (
|
|
25
26
|
/* No `space-y-*` here, for the reason documented on Input: Headless UI's
|
|
26
27
|
Field always renders a trailing hidden element, and Tailwind v4
|
|
@@ -30,37 +31,38 @@ const w = u.forwardRef(
|
|
|
30
31
|
the label and description instead. Select is immune to the same trap
|
|
31
32
|
only because it spaces with `gap`, and the hidden element is
|
|
32
33
|
`display: none` so it is not a flex item. */
|
|
33
|
-
/* @__PURE__ */
|
|
34
|
-
|
|
34
|
+
/* @__PURE__ */ N(v, { className: s("rst:w-full", m), children: [
|
|
35
|
+
a && /* `--roster-control-text`, matching Input's label — see the comment
|
|
35
36
|
there for why not `text-inherit`. */
|
|
36
|
-
/* @__PURE__ */
|
|
37
|
-
/* @__PURE__ */
|
|
38
|
-
|
|
37
|
+
/* @__PURE__ */ e(w, { className: "rst:block rst:text-sm rst:font-medium rst:leading-none rst:text-[var(--roster-control-text)] rst:peer-disabled:cursor-not-allowed rst:peer-disabled:opacity-70 rst:text-left rst:mb-1.5", children: a }),
|
|
38
|
+
/* @__PURE__ */ e(
|
|
39
|
+
y,
|
|
39
40
|
{
|
|
40
41
|
ref: f,
|
|
41
|
-
disabled:
|
|
42
|
-
className:
|
|
43
|
-
k({ variant:
|
|
44
|
-
|
|
42
|
+
disabled: c,
|
|
43
|
+
className: s(
|
|
44
|
+
k({ variant: l, resize: d, error: r }),
|
|
45
|
+
x
|
|
45
46
|
),
|
|
46
|
-
...
|
|
47
|
+
...u,
|
|
48
|
+
invalid: p
|
|
47
49
|
}
|
|
48
50
|
),
|
|
49
|
-
(
|
|
50
|
-
|
|
51
|
+
(o || t) && /* @__PURE__ */ e(
|
|
52
|
+
h,
|
|
51
53
|
{
|
|
52
|
-
className:
|
|
54
|
+
className: s(
|
|
53
55
|
"rst:text-xs rst:text-left rst:mt-1.5",
|
|
54
|
-
|
|
56
|
+
r ? "rst:text-error-600 rst:dark:text-error-400 rst:font-medium" : "rst:text-gray-500 rst:dark:text-gray-400"
|
|
55
57
|
),
|
|
56
|
-
children: t ||
|
|
58
|
+
children: t || o
|
|
57
59
|
}
|
|
58
60
|
)
|
|
59
61
|
] })
|
|
60
62
|
);
|
|
61
63
|
}
|
|
62
64
|
);
|
|
63
|
-
|
|
65
|
+
I.displayName = "Textarea";
|
|
64
66
|
export {
|
|
65
|
-
|
|
67
|
+
I as Textarea
|
|
66
68
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../../../node_modules/class-variance-authority/dist/index.cjs"),t=r.cva("rst:font-ui rst:flex rst:w-full rst:min-h-[80px] rst:rounded-md rst:border rst:py-2.5 rst:px-4 rst:text-sm rst:ring-offset-background rst:focus-visible:ring-offset-2 rst:
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../../../node_modules/class-variance-authority/dist/index.cjs"),t=r.cva("rst:font-ui rst:flex rst:w-full rst:min-h-[80px] rst:rounded-md rst:border rst:py-2.5 rst:px-4 rst:text-sm rst:ring-offset-background rst:focus-visible:ring-offset-2 rst:focus-visible:outline-hidden rst:focus-visible:ring-2 rst:focus-visible:ring-ring rst:disabled:cursor-not-allowed rst:disabled:opacity-50 rst:transition-colors rst:custom-scrollbar",{variants:{variant:{outline:"rst:border-[var(--roster-control-border)] rst:bg-[var(--roster-control-bg)] rst:text-[var(--roster-control-text)] rst:placeholder:text-[color-mix(in_srgb,var(--roster-control-text)_65%,transparent)] rst:focus-visible:border-[var(--roster-control-border-focus)]",soft:"rst:border-[var(--roster-control-border)] rst:bg-gray-100 rst:text-gray-900 rst:placeholder:text-gray-500 rst:dark:placeholder:text-gray-400 rst:focus-visible:bg-white rst:focus-visible:border-primary-500 rst:dark:bg-gray-800/50 rst:dark:text-gray-100 rst:dark:focus-visible:bg-gray-900 rst:dark:focus-visible:border-primary-400",ghost:"rst:border-transparent rst:bg-transparent rst:text-gray-900 rst:placeholder:text-gray-500 rst:dark:placeholder:text-gray-400 rst:hover:bg-gray-100 rst:focus-visible:bg-gray-100 rst:dark:text-gray-100 rst:dark:hover:bg-gray-800 rst:dark:focus-visible:bg-gray-800",white:"rst:border-gray-200 rst:bg-white rst:text-gray-900 rst:placeholder:text-gray-500 rst:dark:placeholder:text-gray-400 rst:focus-visible:border-primary-500 rst:dark:border-gray-800 rst:dark:bg-gray-900 rst:dark:text-gray-100 rst:dark:focus-visible:border-primary-400"},error:{true:"rst:border-error-500 rst:focus-visible:ring-error-500 rst:text-error-900 rst:dark:border-error-500 rst:dark:focus-visible:ring-error-500 rst:dark:text-error-100",false:""},resize:{none:"rst:resize-none",vertical:"rst:resize-y",horizontal:"rst:resize-x",both:"rst:resize"}},defaultVariants:{variant:"outline",error:!1,resize:"vertical"}});exports.textareaVariants=t;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { cva as r } from "../../../node_modules/class-variance-authority/dist/index.js";
|
|
2
2
|
const s = /* @__PURE__ */ r(
|
|
3
|
-
"rst:font-ui rst:flex rst:w-full rst:min-h-[80px] rst:rounded-md rst:border rst:py-2.5 rst:px-4 rst:text-sm rst:ring-offset-background rst:focus-visible:ring-offset-2 rst:
|
|
3
|
+
"rst:font-ui rst:flex rst:w-full rst:min-h-[80px] rst:rounded-md rst:border rst:py-2.5 rst:px-4 rst:text-sm rst:ring-offset-background rst:focus-visible:ring-offset-2 rst:focus-visible:outline-hidden rst:focus-visible:ring-2 rst:focus-visible:ring-ring rst:disabled:cursor-not-allowed rst:disabled:opacity-50 rst:transition-colors rst:custom-scrollbar",
|
|
4
4
|
{
|
|
5
5
|
variants: {
|
|
6
6
|
variant: {
|
|
@@ -12,11 +12,17 @@ const s = /* @__PURE__ */ r(
|
|
|
12
12
|
gray-950, a near-black box on a gray-800 dialog. Both were reported
|
|
13
13
|
by eye before anyone read the variants.
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
`outline`
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
The placeholder is the field's own text color at 65%, the same rule
|
|
16
|
+
Input's `outline` uses, so it reaches 4.5:1 on whatever surface the
|
|
17
|
+
text token was chosen for: 5.46:1 on a white page, 7.76 on the dark
|
|
18
|
+
one, 5.02 inside the `slate` Dialog, measured rendered. The base used to set gray-400
|
|
19
|
+
for every variant and scheme, which is 2.52:1 on white, and
|
|
20
|
+
Input's old dark gray-500 is 3.30:1 on the dark page; neither is a
|
|
21
|
+
step that passes in both. The other variants name their surface, so
|
|
22
|
+
they name a step for each scheme instead: gray-500 light, gray-400
|
|
23
|
+
dark. An error no longer recolors the placeholder: red at a
|
|
24
|
+
readable contrast is too close to the typed text's own red to tell
|
|
25
|
+
apart, and the border and message already say what's wrong.
|
|
20
26
|
|
|
21
27
|
The border and text defaults are the values this variant already
|
|
22
28
|
used. The fill does change,
|
|
@@ -25,7 +31,7 @@ const s = /* @__PURE__ */ r(
|
|
|
25
31
|
is the entire point everywhere else: a field drawn inside a Dialog
|
|
26
32
|
now takes the Dialog's surface instead of punching a white or
|
|
27
33
|
near-black hole in it. */
|
|
28
|
-
outline: "rst:border-[var(--roster-control-border)] rst:bg-[var(--roster-control-bg)] rst:text-[var(--roster-control-text)] rst:focus-visible:border-[var(--roster-control-border-focus)]",
|
|
34
|
+
outline: "rst:border-[var(--roster-control-border)] rst:bg-[var(--roster-control-bg)] rst:text-[var(--roster-control-text)] rst:placeholder:text-[color-mix(in_srgb,var(--roster-control-text)_65%,transparent)] rst:focus-visible:border-[var(--roster-control-border-focus)]",
|
|
29
35
|
/* A boundary that does not depend on what is behind it. `soft` used
|
|
30
36
|
`border-transparent` and leaned on its fill alone, which fails the
|
|
31
37
|
moment the fill matches the surface — exactly 1.00:1 inside a
|
|
@@ -33,12 +39,12 @@ const s = /* @__PURE__ */ r(
|
|
|
33
39
|
vanished until focus. Reported twice in one app before anyone read
|
|
34
40
|
the variant. The border is the same token `outline` reads, so a
|
|
35
41
|
consumer repaints both at once. */
|
|
36
|
-
soft: "rst:border-[var(--roster-control-border)] rst:bg-gray-100 rst:text-gray-900 rst:focus-visible:bg-white rst:focus-visible:border-primary-500 rst:dark:bg-gray-800/50 rst:dark:text-gray-100 rst:dark:focus-visible:bg-gray-900 rst:dark:focus-visible:border-primary-400",
|
|
37
|
-
ghost: "rst:border-transparent rst:bg-transparent rst:text-gray-900 rst:hover:bg-gray-100 rst:focus-visible:bg-gray-100 rst:dark:text-gray-100 rst:dark:hover:bg-gray-800 rst:dark:focus-visible:bg-gray-800",
|
|
38
|
-
white: "rst:border-gray-200 rst:bg-white rst:text-gray-900 rst:focus-visible:border-primary-500 rst:dark:border-gray-800 rst:dark:bg-gray-900 rst:dark:text-gray-100 rst:dark:focus-visible:border-primary-400"
|
|
42
|
+
soft: "rst:border-[var(--roster-control-border)] rst:bg-gray-100 rst:text-gray-900 rst:placeholder:text-gray-500 rst:dark:placeholder:text-gray-400 rst:focus-visible:bg-white rst:focus-visible:border-primary-500 rst:dark:bg-gray-800/50 rst:dark:text-gray-100 rst:dark:focus-visible:bg-gray-900 rst:dark:focus-visible:border-primary-400",
|
|
43
|
+
ghost: "rst:border-transparent rst:bg-transparent rst:text-gray-900 rst:placeholder:text-gray-500 rst:dark:placeholder:text-gray-400 rst:hover:bg-gray-100 rst:focus-visible:bg-gray-100 rst:dark:text-gray-100 rst:dark:hover:bg-gray-800 rst:dark:focus-visible:bg-gray-800",
|
|
44
|
+
white: "rst:border-gray-200 rst:bg-white rst:text-gray-900 rst:placeholder:text-gray-500 rst:dark:placeholder:text-gray-400 rst:focus-visible:border-primary-500 rst:dark:border-gray-800 rst:dark:bg-gray-900 rst:dark:text-gray-100 rst:dark:focus-visible:border-primary-400"
|
|
39
45
|
},
|
|
40
46
|
error: {
|
|
41
|
-
true: "rst:border-error-500 rst:focus-visible:ring-error-500 rst:text-error-900 rst:
|
|
47
|
+
true: "rst:border-error-500 rst:focus-visible:ring-error-500 rst:text-error-900 rst:dark:border-error-500 rst:dark:focus-visible:ring-error-500 rst:dark:text-error-100",
|
|
42
48
|
false: ""
|
|
43
49
|
},
|
|
44
50
|
resize: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),i=require("react"),r=require("../../../node_modules/@radix-ui/react-tooltip/dist/index.cjs"),h=require("../../../lib/utils.cjs");function x({content:o,children:n,placement:d="top",variant:e="dark",delayDuration:l=300,defaultOpen:a=!1,className:c}){const[g,s]=i.useState(a),p=i.useCallback(()=>s(u=>!u),[]);return t.jsx(r.Provider,{delayDuration:l,children:t.jsxs(r.Root,{open:g,onOpenChange:s,children:[t.jsx(r.Trigger,{asChild:!0,onClick:p,children:t.jsx("span",{className:"rst:inline-flex rst:items-center rst:cursor-default",tabIndex:0,"data-testid":"tooltip-trigger",children:n})}),t.jsx(r.Portal,{children:t.jsxs(r.Content,{side:d,sideOffset:8,collisionPadding:8,"data-testid":"tooltip-content",className:h.cn("rst:font-ui rst:z-50 rst:max-w-60 rst:rounded-lg rst:px-3 rst:py-2 rst:text-xs rst:leading-snug rst:elevation-anchored","rst:animate-in rst:fade-in-0 rst:zoom-in-95","rst:data-[side=bottom]:slide-in-from-top-2","rst:data-[side=top]:slide-in-from-bottom-2","rst:data-[side=left]:slide-in-from-right-2","rst:data-[side=right]:slide-in-from-left-2",e==="themed"?"rst:bg-[var(--roster-popover-bg)] rst:text-[var(--roster-popover-text)] rst:ring
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),i=require("react"),r=require("../../../node_modules/@radix-ui/react-tooltip/dist/index.cjs"),h=require("../../../lib/utils.cjs");function x({content:o,children:n,placement:d="top",variant:e="dark",delayDuration:l=300,defaultOpen:a=!1,className:c}){const[g,s]=i.useState(a),p=i.useCallback(()=>s(u=>!u),[]);return t.jsx(r.Provider,{delayDuration:l,children:t.jsxs(r.Root,{open:g,onOpenChange:s,children:[t.jsx(r.Trigger,{asChild:!0,onClick:p,children:t.jsx("span",{className:"rst:inline-flex rst:items-center rst:cursor-default",tabIndex:0,"data-testid":"tooltip-trigger",children:n})}),t.jsx(r.Portal,{children:t.jsxs(r.Content,{side:d,sideOffset:8,collisionPadding:8,"data-testid":"tooltip-content",className:h.cn("rst:font-ui rst:z-50 rst:max-w-60 rst:rounded-lg rst:px-3 rst:py-2 rst:text-xs rst:leading-snug rst:elevation-anchored","rst:animate-in rst:fade-in-0 rst:zoom-in-95","rst:data-[side=bottom]:slide-in-from-top-2","rst:data-[side=top]:slide-in-from-bottom-2","rst:data-[side=left]:slide-in-from-right-2","rst:data-[side=right]:slide-in-from-left-2",e==="themed"?"rst:bg-[var(--roster-popover-bg)] rst:text-[var(--roster-popover-text)] rst:ring rst:ring-[var(--roster-popover-border)]":e==="dark"?"rst:bg-zinc-900 rst:text-zinc-100 rst:ring rst:ring-white/10":"rst:bg-white rst:text-zinc-900 rst:ring rst:ring-zinc-200",c),children:[o,t.jsx(r.Arrow,{className:e==="themed"?"rst:fill-[var(--roster-popover-bg)]":e==="dark"?"rst:fill-zinc-900":"rst:fill-white",width:12,height:6})]})})]})})}exports.Tooltip=x;
|
|
@@ -37,7 +37,7 @@ function P({
|
|
|
37
37
|
"rst:data-[side=top]:slide-in-from-bottom-2",
|
|
38
38
|
"rst:data-[side=left]:slide-in-from-right-2",
|
|
39
39
|
"rst:data-[side=right]:slide-in-from-left-2",
|
|
40
|
-
r === "themed" ? "rst:bg-[var(--roster-popover-bg)] rst:text-[var(--roster-popover-text)] rst:ring
|
|
40
|
+
r === "themed" ? "rst:bg-[var(--roster-popover-bg)] rst:text-[var(--roster-popover-text)] rst:ring rst:ring-[var(--roster-popover-border)]" : r === "dark" ? "rst:bg-zinc-900 rst:text-zinc-100 rst:ring rst:ring-white/10" : "rst:bg-white rst:text-zinc-900 rst:ring rst:ring-zinc-200",
|
|
41
41
|
l
|
|
42
42
|
),
|
|
43
43
|
children: [
|
|
@@ -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"),h=require("react"),p=require("../../../lib/utils.cjs"),x=require("../../atoms/Disclosure/Disclosure.cjs"),b=({items:o,allowMultiple:c=!1,variant:l="soft",className:i,showDividers:a=!1,defaultOpenIds:d=[]})=>{const[u,g]=h.useState(new Set(d)),f=e=>{g(r=>{const s=new Set(r),n=s.has(e);return c?n?s.delete(e):s.add(e):(s.clear(),n||s.add(e)),s})};return t.jsx("div",{className:p.cn("rst:font-ui rst:w-full rst:space-y-1",i),children:o.map((e,r)=>t.jsxs("div",{className:"rst:relative",children:[a&&r>0&&t.jsx("div",{className:"rst:mx-4 rst:h-[var(--roster-border-width,1px)] rst:bg-gray-200/50 rst:dark:bg-gray-700/50 rst:transition-colors rst:mb-1"}),t.jsx(x.Disclosure,{title:e.title,variant:l,isOpen:u.has(e.id),onToggle:()=>f(e.id),children:e.content})]},e.id))})};exports.Accordion=b;
|
|
@@ -1,37 +1,37 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { useState as
|
|
4
|
-
import { cn as
|
|
2
|
+
import { jsx as t, jsxs as g } from "react/jsx-runtime";
|
|
3
|
+
import { useState as h } from "react";
|
|
4
|
+
import { cn as u } from "../../../lib/utils.js";
|
|
5
5
|
import { Disclosure as x } from "../../atoms/Disclosure/Disclosure.js";
|
|
6
6
|
const N = ({
|
|
7
|
-
items:
|
|
7
|
+
items: n,
|
|
8
8
|
allowMultiple: l = !1,
|
|
9
9
|
variant: a = "soft",
|
|
10
|
-
className:
|
|
11
|
-
showDividers:
|
|
10
|
+
className: i,
|
|
11
|
+
showDividers: c = !1,
|
|
12
12
|
defaultOpenIds: d = []
|
|
13
13
|
}) => {
|
|
14
|
-
const [f, m] =
|
|
14
|
+
const [f, m] = h(
|
|
15
15
|
new Set(d)
|
|
16
|
-
), p = (
|
|
17
|
-
m((
|
|
18
|
-
const
|
|
19
|
-
return l ?
|
|
16
|
+
), p = (e) => {
|
|
17
|
+
m((r) => {
|
|
18
|
+
const s = new Set(r), o = s.has(e);
|
|
19
|
+
return l ? o ? s.delete(e) : s.add(e) : (s.clear(), o || s.add(e)), s;
|
|
20
20
|
});
|
|
21
21
|
};
|
|
22
|
-
return /* @__PURE__ */
|
|
23
|
-
|
|
24
|
-
/* @__PURE__ */
|
|
22
|
+
return /* @__PURE__ */ t("div", { className: u("rst:font-ui rst:w-full rst:space-y-1", i), children: n.map((e, r) => /* @__PURE__ */ g("div", { className: "rst:relative", children: [
|
|
23
|
+
c && r > 0 && /* @__PURE__ */ t("div", { className: "rst:mx-4 rst:h-[var(--roster-border-width,1px)] rst:bg-gray-200/50 rst:dark:bg-gray-700/50 rst:transition-colors rst:mb-1" }),
|
|
24
|
+
/* @__PURE__ */ t(
|
|
25
25
|
x,
|
|
26
26
|
{
|
|
27
|
-
title:
|
|
27
|
+
title: e.title,
|
|
28
28
|
variant: a,
|
|
29
|
-
isOpen: f.has(
|
|
30
|
-
onToggle: () => p(
|
|
31
|
-
children:
|
|
29
|
+
isOpen: f.has(e.id),
|
|
30
|
+
onToggle: () => p(e.id),
|
|
31
|
+
children: e.content
|
|
32
32
|
}
|
|
33
33
|
)
|
|
34
|
-
] },
|
|
34
|
+
] }, e.id)) });
|
|
35
35
|
};
|
|
36
36
|
export {
|
|
37
37
|
N as Accordion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),p=require("react"),o=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"),v=require("./alert-variants.cjs"),b={error:r.faCircleExclamation,success:r.faCircleCheck,amber:r.faTriangleExclamation,info:r.faCircleInfo,primary:r.faCircleInfo,neutral:r.faCircleInfo,current:r.faCircleInfo},l=p.forwardRef(({colorScheme:e="error",surface:u,title:t,children:d,icon:i,onDismiss:a,dismissLabel:
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),p=require("react"),o=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"),v=require("./alert-variants.cjs"),b={error:r.faCircleExclamation,success:r.faCircleCheck,amber:r.faTriangleExclamation,info:r.faCircleInfo,primary:r.faCircleInfo,neutral:r.faCircleInfo,current:r.faCircleInfo},l=p.forwardRef(({colorScheme:e="error",surface:u,title:t,children:d,icon:i,onDismiss:a,dismissLabel:m="Dismiss",className:f,...x},h)=>{const n=e==="error";return s.jsxs("div",{ref:h,role:n?"alert":"status","aria-live":n?"assertive":"polite",className:c.cn(v.alertVariants({colorScheme:e,surface:u}),f),...x,children:[i===void 0?s.jsx(o.FontAwesomeIcon,{icon:b[e??"error"],className:"rst:mt-0.5 rst:h-4 rst:w-4 rst:shrink-0","aria-hidden":"true"}):i,s.jsxs("div",{className:"rst:min-w-0 rst:flex-1",children:[t&&s.jsx("p",{className:"rst:font-semibold",children:t}),s.jsx("div",{className:c.cn("rst:min-w-0",t&&"rst:mt-0.5 rst:opacity-90"),children:d})]}),a&&s.jsx("button",{type:"button",onClick:a,"aria-label":m,className:"rst:-m-1 rst:shrink-0 rst:rounded-sm rst:p-1 rst:opacity-60 rst:transition-opacity rst:hover:opacity-100 rst:focus:outline-hidden rst:focus-visible:ring-2 rst:focus-visible:ring-ring",children:s.jsx(o.FontAwesomeIcon,{icon:r.faXmark,className:"rst:h-3.5 rst:w-3.5","aria-hidden":"true"})})]})});l.displayName="Alert";exports.Alert=l;
|
|
@@ -53,7 +53,7 @@ const C = {
|
|
|
53
53
|
type: "button",
|
|
54
54
|
onClick: e,
|
|
55
55
|
"aria-label": d,
|
|
56
|
-
className: "rst:-m-1 rst:shrink-0 rst:rounded rst:p-1 rst:opacity-60 rst:transition-opacity rst:hover:opacity-100 rst:focus:outline-hidden rst:focus-visible:ring-2 rst:focus-visible:ring-ring",
|
|
56
|
+
className: "rst:-m-1 rst:shrink-0 rst:rounded-sm rst:p-1 rst:opacity-60 rst:transition-opacity rst:hover:opacity-100 rst:focus:outline-hidden rst:focus-visible:ring-2 rst:focus-visible:ring-ring",
|
|
57
57
|
children: /* @__PURE__ */ r(c, { icon: w, className: "rst:h-3.5 rst:w-3.5", "aria-hidden": "true" })
|
|
58
58
|
}
|
|
59
59
|
)
|
|
@@ -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"),B=require("react"),D=require("../../../node_modules/@headlessui/react/dist/components/description/description.cjs"),R=require("../../../node_modules/@headlessui/react/dist/components/field/field.cjs"),g=require("../../../node_modules/@headlessui/react/dist/components/fieldset/fieldset.cjs"),V=require("../../../node_modules/@headlessui/react/dist/components/label/label.cjs"),h=require("../../../node_modules/@headlessui/react/dist/components/legend/legend.cjs"),e=require("../../../lib/utils.cjs"),p=require("../../../internal/field-invalid.cjs"),Z=require("../../atoms/Checkbox/Checkbox.cjs"),_=require("../../atoms/Eyebrow/Eyebrow.cjs"),j=require("./checkbox-group-variants.cjs"),J=t=>t.length>0&&Array.isArray(t[0].options),K={sm:"rst:text-xs",md:"rst:text-sm",lg:"rst:text-base"},Q=({options:t,value:o,onChange:k,label:u,helperText:n,errorMessage:i,maxHeight:m,disabled:d=!1,variant:q,size:a="md",columns:N,colorScheme:w,className:I,optionsClassName:G,panelClassName:C,"aria-describedby":E,"aria-invalid":L,...f})=>{const c=!!i,v=p.isFieldInvalid(c,{...f,"aria-invalid":L}),F=p.withoutInvalidProps(f),l=m!==void 0,x=B.useId(),O=[E,n||i?x:void 0].filter(Boolean).join(" ")||void 0,P=(r,b)=>{k(b?[...o,r]:o.filter(A=>A!==r))},S=r=>s.jsxs(R.Field,{disabled:d||r.disabled,className:"rst:flex rst:items-start rst:gap-2",children:[s.jsx(Z.Checkbox,{size:a??"md",colorScheme:w,checked:o.includes(r.value),onChange:b=>P(r.value,b),"aria-invalid":v||void 0,"aria-describedby":c?x:void 0,className:"rst:mt-0.5 rst:shrink-0"}),s.jsxs("div",{className:"rst:flex rst:min-w-0 rst:flex-col",children:[s.jsx(V.Label,{className:e.cn("rst:cursor-pointer rst:select-none rst:px-1 rst:py-0.5","rst:text-[var(--roster-control-text)]","rst:data-disabled:cursor-not-allowed rst:data-disabled:opacity-50",K[a??"md"]),children:r.label}),r.description&&s.jsx(D.Description,{className:"rst:px-1 rst:text-xs rst:text-gray-500 rst:dark:text-gray-400 rst:data-disabled:opacity-50",children:r.description})]})]},r.value),y=r=>s.jsx("div",{className:e.cn(j.checkboxGroupOptionsVariants({columns:N,size:a})),children:r.map(S)});return s.jsxs(g.Fieldset,{disabled:d,className:e.cn("rst:font-ui rst:flex rst:flex-col rst:gap-1.5 rst:min-w-0",I),...F,"aria-invalid":v||void 0,"aria-describedby":O,children:[u&&s.jsx(h.Legend,{className:"rst:block rst:text-sm rst:font-medium rst:text-[var(--roster-control-text)] rst:text-left rst:data-disabled:opacity-50",children:u}),s.jsx("div",{className:e.cn(j.checkboxGroupPanelVariants({variant:q,size:a,error:c}),l&&"rst:overflow-y-auto rst:custom-scrollbar rst:focus-visible:outline-hidden rst:focus-visible:ring-2 rst:focus-visible:ring-ring rst:focus-visible:ring-offset-2 rst:ring-offset-background",C,G),style:l?{maxHeight:m}:void 0,tabIndex:l?0:void 0,children:J(t)?t.map(r=>s.jsxs(g.Fieldset,{className:"rst:flex rst:flex-col rst:gap-2",children:[s.jsx(h.Legend,{as:_.Eyebrow,weight:"semibold",tone:"default",className:"rst:border-b rst:border-gray-200 rst:pb-1 rst:dark:border-gray-800",children:r.category}),y(r.options)]},r.category)):y(t)}),(n||i)&&s.jsx("p",{id:x,className:e.cn("rst:text-xs rst:text-left",c?"rst:text-error-600 rst:dark:text-error-400 rst:font-medium":"rst:text-gray-500 rst:dark:text-gray-400",d&&"rst:opacity-50"),children:i||n})]})};exports.CheckboxGroup=Q;
|
|
@@ -30,13 +30,15 @@ export interface CheckboxGroupProps extends Omit<React.HTMLAttributes<HTMLFieldS
|
|
|
30
30
|
helperText?: string;
|
|
31
31
|
/**
|
|
32
32
|
* The message for an invalid selection. Implies the error state, so a caller
|
|
33
|
-
*
|
|
33
|
+
* can not color the text red and forget to say why.
|
|
34
34
|
*
|
|
35
35
|
* What it repaints depends on `variant`, and the difference is worth
|
|
36
36
|
* knowing: `panel` gets an error border, `plain` has no boundary to repaint
|
|
37
37
|
* and so the message *is* the whole error state. Narrower than `Input`'s or
|
|
38
|
-
* `Select`'s, which both ring the control itself
|
|
39
|
-
*
|
|
38
|
+
* `Select`'s, which both ring the control itself: what is invalid here is
|
|
39
|
+
* the selection. Each checkbox is still announced as invalid, though, since
|
|
40
|
+
* a checkbox is what a screen reader focuses
|
|
41
|
+
* (`src/internal/field-invalid.ts`).
|
|
40
42
|
*/
|
|
41
43
|
errorMessage?: string;
|
|
42
44
|
/**
|
|
@@ -1,68 +1,71 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import
|
|
2
|
+
import { jsxs as d, jsx as t } from "react/jsx-runtime";
|
|
3
|
+
import P from "react";
|
|
4
4
|
import { Description as _ } from "../../../node_modules/@headlessui/react/dist/components/description/description.js";
|
|
5
|
-
import { Field as
|
|
6
|
-
import { Fieldset as
|
|
7
|
-
import { Label as
|
|
8
|
-
import { Legend as
|
|
5
|
+
import { Field as S } from "../../../node_modules/@headlessui/react/dist/components/field/field.js";
|
|
6
|
+
import { Fieldset as h } from "../../../node_modules/@headlessui/react/dist/components/fieldset/fieldset.js";
|
|
7
|
+
import { Label as Z } from "../../../node_modules/@headlessui/react/dist/components/label/label.js";
|
|
8
|
+
import { Legend as g } from "../../../node_modules/@headlessui/react/dist/components/legend/legend.js";
|
|
9
9
|
import { cn as e } from "../../../lib/utils.js";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
|
|
10
|
+
import { isFieldInvalid as R, withoutInvalidProps as V } from "../../../internal/field-invalid.js";
|
|
11
|
+
import { Checkbox as W } from "../../atoms/Checkbox/Checkbox.js";
|
|
12
|
+
import { Eyebrow as q } from "../../atoms/Eyebrow/Eyebrow.js";
|
|
13
|
+
import { checkboxGroupPanelVariants as J, checkboxGroupOptionsVariants as K } from "./checkbox-group-variants.js";
|
|
14
|
+
const Q = (s) => s.length > 0 && Array.isArray(s[0].options), U = {
|
|
14
15
|
sm: "rst:text-xs",
|
|
15
16
|
md: "rst:text-sm",
|
|
16
17
|
lg: "rst:text-base"
|
|
17
|
-
},
|
|
18
|
+
}, or = ({
|
|
18
19
|
options: s,
|
|
19
20
|
value: c,
|
|
20
|
-
onChange:
|
|
21
|
-
label:
|
|
22
|
-
helperText:
|
|
23
|
-
errorMessage:
|
|
24
|
-
maxHeight:
|
|
25
|
-
disabled:
|
|
26
|
-
variant:
|
|
27
|
-
size:
|
|
28
|
-
columns:
|
|
29
|
-
colorScheme:
|
|
30
|
-
className:
|
|
31
|
-
optionsClassName:
|
|
32
|
-
panelClassName:
|
|
33
|
-
"aria-describedby":
|
|
34
|
-
"aria-invalid":
|
|
35
|
-
...
|
|
21
|
+
onChange: k,
|
|
22
|
+
label: b,
|
|
23
|
+
helperText: l,
|
|
24
|
+
errorMessage: i,
|
|
25
|
+
maxHeight: p,
|
|
26
|
+
disabled: n = !1,
|
|
27
|
+
variant: N,
|
|
28
|
+
size: a = "md",
|
|
29
|
+
columns: w,
|
|
30
|
+
colorScheme: I,
|
|
31
|
+
className: E,
|
|
32
|
+
optionsClassName: G,
|
|
33
|
+
panelClassName: L,
|
|
34
|
+
"aria-describedby": j,
|
|
35
|
+
"aria-invalid": A,
|
|
36
|
+
...v
|
|
36
37
|
}) => {
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
const o = !!i, u = R(o, { ...v, "aria-invalid": A }), B = V(v), m = p !== void 0, f = P.useId(), C = [j, l || i ? f : void 0].filter(Boolean).join(" ") || void 0, D = (r, x) => {
|
|
39
|
+
k(
|
|
40
|
+
x ? [...c, r] : c.filter((O) => O !== r)
|
|
40
41
|
);
|
|
41
|
-
},
|
|
42
|
-
|
|
42
|
+
}, F = (r) => /* @__PURE__ */ d(
|
|
43
|
+
S,
|
|
43
44
|
{
|
|
44
|
-
disabled:
|
|
45
|
+
disabled: n || r.disabled,
|
|
45
46
|
className: "rst:flex rst:items-start rst:gap-2",
|
|
46
47
|
children: [
|
|
47
48
|
/* @__PURE__ */ t(
|
|
48
|
-
|
|
49
|
+
W,
|
|
49
50
|
{
|
|
50
|
-
size:
|
|
51
|
-
colorScheme:
|
|
51
|
+
size: a ?? "md",
|
|
52
|
+
colorScheme: I,
|
|
52
53
|
checked: c.includes(r.value),
|
|
53
|
-
onChange: (
|
|
54
|
+
onChange: (x) => D(r.value, x),
|
|
55
|
+
"aria-invalid": u || void 0,
|
|
56
|
+
"aria-describedby": o ? f : void 0,
|
|
54
57
|
className: "rst:mt-0.5 rst:shrink-0"
|
|
55
58
|
}
|
|
56
59
|
),
|
|
57
|
-
/* @__PURE__ */
|
|
60
|
+
/* @__PURE__ */ d("div", { className: "rst:flex rst:min-w-0 rst:flex-col", children: [
|
|
58
61
|
/* @__PURE__ */ t(
|
|
59
|
-
|
|
62
|
+
Z,
|
|
60
63
|
{
|
|
61
64
|
className: e(
|
|
62
65
|
"rst:cursor-pointer rst:select-none rst:px-1 rst:py-0.5",
|
|
63
66
|
"rst:text-[var(--roster-control-text)]",
|
|
64
67
|
"rst:data-disabled:cursor-not-allowed rst:data-disabled:opacity-50",
|
|
65
|
-
|
|
68
|
+
U[a ?? "md"]
|
|
66
69
|
),
|
|
67
70
|
children: r.label
|
|
68
71
|
}
|
|
@@ -72,33 +75,33 @@ const W = (s) => s.length > 0 && Array.isArray(s[0].options), q = {
|
|
|
72
75
|
]
|
|
73
76
|
},
|
|
74
77
|
r.value
|
|
75
|
-
),
|
|
76
|
-
return /* @__PURE__ */
|
|
77
|
-
|
|
78
|
+
), y = (r) => /* @__PURE__ */ t("div", { className: e(K({ columns: w, size: a })), children: r.map(F) });
|
|
79
|
+
return /* @__PURE__ */ d(
|
|
80
|
+
h,
|
|
78
81
|
{
|
|
79
|
-
disabled:
|
|
82
|
+
disabled: n,
|
|
80
83
|
className: e(
|
|
81
84
|
"rst:font-ui rst:flex rst:flex-col rst:gap-1.5 rst:min-w-0",
|
|
82
|
-
|
|
85
|
+
E
|
|
83
86
|
),
|
|
84
|
-
...
|
|
85
|
-
"aria-invalid":
|
|
86
|
-
"aria-describedby":
|
|
87
|
+
...B,
|
|
88
|
+
"aria-invalid": u || void 0,
|
|
89
|
+
"aria-describedby": C,
|
|
87
90
|
children: [
|
|
88
|
-
|
|
91
|
+
b && /* @__PURE__ */ t(g, { className: "rst:block rst:text-sm rst:font-medium rst:text-[var(--roster-control-text)] rst:text-left rst:data-disabled:opacity-50", children: b }),
|
|
89
92
|
/* @__PURE__ */ t(
|
|
90
93
|
"div",
|
|
91
94
|
{
|
|
92
95
|
className: e(
|
|
93
|
-
|
|
96
|
+
J({ variant: N, size: a, error: o }),
|
|
94
97
|
m && "rst:overflow-y-auto rst:custom-scrollbar rst:focus-visible:outline-hidden rst:focus-visible:ring-2 rst:focus-visible:ring-ring rst:focus-visible:ring-offset-2 rst:ring-offset-background",
|
|
95
98
|
/* Deprecated name first, so the current one wins when both are set. */
|
|
96
|
-
|
|
97
|
-
|
|
99
|
+
L,
|
|
100
|
+
G
|
|
98
101
|
),
|
|
99
|
-
style: m ? { maxHeight:
|
|
102
|
+
style: m ? { maxHeight: p } : void 0,
|
|
100
103
|
tabIndex: m ? 0 : void 0,
|
|
101
|
-
children:
|
|
104
|
+
children: Q(s) ? s.map((r) => (
|
|
102
105
|
/* Nested fieldset per category, so the heading is the group's
|
|
103
106
|
accessible name rather than decoration a screen reader walks
|
|
104
107
|
straight past. Nesting is valid HTML, the inner
|
|
@@ -109,32 +112,32 @@ const W = (s) => s.length > 0 && Array.isArray(s[0].options), q = {
|
|
|
109
112
|
`as={Eyebrow}` overrides Legend's own `as="div"` — it is
|
|
110
113
|
spread after — so these render as <span>. The registration is
|
|
111
114
|
what matters and it is unchanged. */
|
|
112
|
-
/* @__PURE__ */
|
|
115
|
+
/* @__PURE__ */ d(h, { className: "rst:flex rst:flex-col rst:gap-2", children: [
|
|
113
116
|
/* @__PURE__ */ t(
|
|
114
|
-
|
|
117
|
+
g,
|
|
115
118
|
{
|
|
116
|
-
as:
|
|
119
|
+
as: q,
|
|
117
120
|
weight: "semibold",
|
|
118
121
|
tone: "default",
|
|
119
122
|
className: "rst:border-b rst:border-gray-200 rst:pb-1 rst:dark:border-gray-800",
|
|
120
123
|
children: r.category
|
|
121
124
|
}
|
|
122
125
|
),
|
|
123
|
-
|
|
126
|
+
y(r.options)
|
|
124
127
|
] }, r.category)
|
|
125
|
-
)) :
|
|
128
|
+
)) : y(s)
|
|
126
129
|
}
|
|
127
130
|
),
|
|
128
|
-
(
|
|
131
|
+
(l || i) && /* @__PURE__ */ t(
|
|
129
132
|
"p",
|
|
130
133
|
{
|
|
131
|
-
id:
|
|
134
|
+
id: f,
|
|
132
135
|
className: e(
|
|
133
136
|
"rst:text-xs rst:text-left",
|
|
134
|
-
|
|
135
|
-
|
|
137
|
+
o ? "rst:text-error-600 rst:dark:text-error-400 rst:font-medium" : "rst:text-gray-500 rst:dark:text-gray-400",
|
|
138
|
+
n && "rst:opacity-50"
|
|
136
139
|
),
|
|
137
|
-
children:
|
|
140
|
+
children: i || l
|
|
138
141
|
}
|
|
139
142
|
)
|
|
140
143
|
]
|
|
@@ -142,5 +145,5 @@ const W = (s) => s.length > 0 && Array.isArray(s[0].options), q = {
|
|
|
142
145
|
);
|
|
143
146
|
};
|
|
144
147
|
export {
|
|
145
|
-
|
|
148
|
+
or as CheckboxGroup
|
|
146
149
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime");require("react");const
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime");require("react");const m=require("../../../node_modules/@headlessui/react/dist/components/description/description.cjs"),D=require("../../../node_modules/@headlessui/react/dist/components/field/field.cjs"),p=require("../../../node_modules/@headlessui/react/dist/components/label/label.cjs"),v=require("../../../node_modules/@headlessui/react/dist/components/radio-group/radio-group.cjs"),r=require("../../../lib/utils.cjs"),f=require("../../../internal/field-invalid.cjs"),c=require("./radio-group-variants.cjs"),E={sm:"rst:text-xs",md:"rst:text-sm",lg:"rst:text-base"},O=({options:y,value:j,onChange:b,label:n,helperText:d,errorMessage:l,disabled:e=!1,size:h="md",orientation:i="vertical",colorScheme:N,className:q,optionsClassName:g,optionClassName:G,radioClassName:w,labelClassName:z,optionLabelClassName:R,descriptionClassName:S,messageClassName:V,"aria-invalid":k,...x})=>{const u=!!l,I=f.isFieldInvalid(u,{...x,"aria-invalid":k}),L=f.withoutInvalidProps(x),a=h??"md";return t.jsxs(v.RadioGroup,{value:j,onChange:b,disabled:e,className:r.cn("rst:font-ui rst:flex rst:flex-col rst:gap-1.5 rst:min-w-0",q),...L,"aria-invalid":I||void 0,"aria-orientation":i,children:[n&&t.jsx(p.Label,{className:r.cn("rst:block rst:text-sm rst:font-medium rst:text-[var(--roster-control-text)] rst:text-left",e&&"rst:opacity-50",z),children:n}),t.jsx("div",{className:r.cn(c.radioGroupOptionsVariants({size:a,orientation:i}),g),children:y.map(s=>t.jsxs(D.Field,{disabled:e||s.disabled,className:r.cn(c.radioOptionVariants({orientation:i,size:a}),G),children:[t.jsx(v.Radio,{value:s.value,className:({checked:o})=>r.cn(c.radioVariants({colorScheme:N,size:a,checked:o}),"rst:self-start",e||s.disabled?"rst:opacity-50 rst:cursor-not-allowed":"rst:cursor-pointer",w),children:({checked:o})=>t.jsx("span",{className:r.cn(c.radioDotVariants({size:a}),o?"rst:opacity-100":"rst:opacity-0")})}),t.jsxs("div",{className:r.cn("rst:flex rst:min-w-0 rst:flex-col",i==="vertical"&&"rst:flex-1"),children:[t.jsx(p.Label,{className:r.cn("rst:cursor-pointer rst:select-none","rst:text-[var(--roster-control-text)]","rst:data-disabled:cursor-not-allowed rst:data-disabled:opacity-50",E[a],R),children:s.label}),s.description&&t.jsx(m.Description,{className:r.cn("rst:text-xs rst:text-gray-500 rst:dark:text-gray-400 rst:data-disabled:opacity-50",S),children:s.description})]})]},s.value))}),(d||l)&&t.jsx(m.Description,{as:"p",className:r.cn("rst:text-xs rst:text-left",u?"rst:text-error-600 rst:dark:text-error-400 rst:font-medium":"rst:text-gray-500 rst:dark:text-gray-400",e&&"rst:opacity-50",V),children:l||d})]})};exports.RadioGroup=O;
|
|
@@ -45,9 +45,10 @@ export interface RadioGroupProps extends Omit<React.HTMLAttributes<HTMLDivElemen
|
|
|
45
45
|
* `aria-describedby` is one of the props Headless UI controls on a
|
|
46
46
|
* `RadioGroup`, and a controlled prop is spread last. Passing one is
|
|
47
47
|
* therefore a no-op rather than an addition. `aria-invalid` is not one of
|
|
48
|
-
* Headless UI's
|
|
49
|
-
*
|
|
50
|
-
*
|
|
48
|
+
* Headless UI's: a caller's is read by the rule every Roster field follows
|
|
49
|
+
* (`src/internal/field-invalid.ts`), so any value but "false" marks the
|
|
50
|
+
* group invalid, as `"true"`, and an error message marks it invalid whatever
|
|
51
|
+
* the caller passed.
|
|
51
52
|
*/
|
|
52
53
|
errorMessage?: string;
|
|
53
54
|
/** Disables every option, and dims the label and helper text with them. */
|