@blakesteve/roster 5.2.0 → 5.2.1

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.
@@ -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
- * cannot color the text red and forget to say why.
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 — a checkbox is not the
39
- * thing that is invalid here, the selection is.
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,70 @@
1
1
  "use client";
2
- import { jsxs as i, jsx as t } from "react/jsx-runtime";
3
- import O from "react";
2
+ import { jsxs as o, 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 F } from "../../../node_modules/@headlessui/react/dist/components/field/field.js";
6
- import { Fieldset as y } from "../../../node_modules/@headlessui/react/dist/components/fieldset/fieldset.js";
7
- import { Label as S } from "../../../node_modules/@headlessui/react/dist/components/label/label.js";
8
- import { Legend as h } from "../../../node_modules/@headlessui/react/dist/components/legend/legend.js";
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 { Checkbox as Z } from "../../atoms/Checkbox/Checkbox.js";
11
- import { Eyebrow as P } from "../../atoms/Eyebrow/Eyebrow.js";
12
- import { checkboxGroupPanelVariants as R, checkboxGroupOptionsVariants as V } from "./checkbox-group-variants.js";
13
- const W = (s) => s.length > 0 && Array.isArray(s[0].options), q = {
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
- }, tr = ({
18
+ }, or = ({
18
19
  options: s,
19
- value: c,
20
- onChange: v,
20
+ value: d,
21
+ onChange: k,
21
22
  label: x,
22
- helperText: d,
23
- errorMessage: a,
23
+ helperText: c,
24
+ errorMessage: i,
24
25
  maxHeight: b,
25
26
  disabled: l = !1,
26
- variant: g,
27
- size: o = "md",
28
- columns: k,
29
- colorScheme: N,
30
- className: w,
31
- optionsClassName: I,
32
- panelClassName: E,
33
- "aria-describedby": G,
34
- "aria-invalid": L,
35
- ...j
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
+ ...p
36
37
  }) => {
37
- const n = !!a, m = b !== void 0, p = O.useId(), A = [G, d || a ? p : void 0].filter(Boolean).join(" ") || void 0, B = (r, f) => {
38
- v(
39
- f ? [...c, r] : c.filter((D) => D !== r)
38
+ const n = !!i, v = R(n, { ...p, "aria-invalid": A }), B = V(p), m = b !== void 0, u = P.useId(), C = [j, c || i ? u : void 0].filter(Boolean).join(" ") || void 0, D = (r, f) => {
39
+ k(
40
+ f ? [...d, r] : d.filter((O) => O !== r)
40
41
  );
41
- }, C = (r) => /* @__PURE__ */ i(
42
- F,
42
+ }, F = (r) => /* @__PURE__ */ o(
43
+ S,
43
44
  {
44
45
  disabled: l || r.disabled,
45
46
  className: "rst:flex rst:items-start rst:gap-2",
46
47
  children: [
47
48
  /* @__PURE__ */ t(
48
- Z,
49
+ W,
49
50
  {
50
- size: o ?? "md",
51
- colorScheme: N,
52
- checked: c.includes(r.value),
53
- onChange: (f) => B(r.value, f),
51
+ size: a ?? "md",
52
+ colorScheme: I,
53
+ checked: d.includes(r.value),
54
+ onChange: (f) => D(r.value, f),
55
+ "aria-invalid": v || void 0,
54
56
  className: "rst:mt-0.5 rst:shrink-0"
55
57
  }
56
58
  ),
57
- /* @__PURE__ */ i("div", { className: "rst:flex rst:min-w-0 rst:flex-col", children: [
59
+ /* @__PURE__ */ o("div", { className: "rst:flex rst:min-w-0 rst:flex-col", children: [
58
60
  /* @__PURE__ */ t(
59
- S,
61
+ Z,
60
62
  {
61
63
  className: e(
62
64
  "rst:cursor-pointer rst:select-none rst:px-1 rst:py-0.5",
63
65
  "rst:text-[var(--roster-control-text)]",
64
66
  "rst:data-disabled:cursor-not-allowed rst:data-disabled:opacity-50",
65
- q[o ?? "md"]
67
+ U[a ?? "md"]
66
68
  ),
67
69
  children: r.label
68
70
  }
@@ -72,33 +74,33 @@ const W = (s) => s.length > 0 && Array.isArray(s[0].options), q = {
72
74
  ]
73
75
  },
74
76
  r.value
75
- ), u = (r) => /* @__PURE__ */ t("div", { className: e(V({ columns: k, size: o })), children: r.map(C) });
76
- return /* @__PURE__ */ i(
77
- y,
77
+ ), y = (r) => /* @__PURE__ */ t("div", { className: e(K({ columns: w, size: a })), children: r.map(F) });
78
+ return /* @__PURE__ */ o(
79
+ h,
78
80
  {
79
81
  disabled: l,
80
82
  className: e(
81
83
  "rst:font-ui rst:flex rst:flex-col rst:gap-1.5 rst:min-w-0",
82
- w
84
+ E
83
85
  ),
84
- ...j,
85
- "aria-invalid": n || L || void 0,
86
- "aria-describedby": A,
86
+ ...B,
87
+ "aria-invalid": v || void 0,
88
+ "aria-describedby": C,
87
89
  children: [
88
- x && /* @__PURE__ */ t(h, { className: "rst:block rst:text-sm rst:font-medium rst:text-[var(--roster-control-text)] rst:text-left rst:data-disabled:opacity-50", children: x }),
90
+ x && /* @__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: x }),
89
91
  /* @__PURE__ */ t(
90
92
  "div",
91
93
  {
92
94
  className: e(
93
- R({ variant: g, size: o, error: n }),
95
+ J({ variant: N, size: a, error: n }),
94
96
  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
97
  /* Deprecated name first, so the current one wins when both are set. */
96
- E,
97
- I
98
+ L,
99
+ G
98
100
  ),
99
101
  style: m ? { maxHeight: b } : void 0,
100
102
  tabIndex: m ? 0 : void 0,
101
- children: W(s) ? s.map((r) => (
103
+ children: Q(s) ? s.map((r) => (
102
104
  /* Nested fieldset per category, so the heading is the group's
103
105
  accessible name rather than decoration a screen reader walks
104
106
  straight past. Nesting is valid HTML, the inner
@@ -109,32 +111,32 @@ const W = (s) => s.length > 0 && Array.isArray(s[0].options), q = {
109
111
  `as={Eyebrow}` overrides Legend's own `as="div"` — it is
110
112
  spread after — so these render as <span>. The registration is
111
113
  what matters and it is unchanged. */
112
- /* @__PURE__ */ i(y, { className: "rst:flex rst:flex-col rst:gap-2", children: [
114
+ /* @__PURE__ */ o(h, { className: "rst:flex rst:flex-col rst:gap-2", children: [
113
115
  /* @__PURE__ */ t(
114
- h,
116
+ g,
115
117
  {
116
- as: P,
118
+ as: q,
117
119
  weight: "semibold",
118
120
  tone: "default",
119
121
  className: "rst:border-b rst:border-gray-200 rst:pb-1 rst:dark:border-gray-800",
120
122
  children: r.category
121
123
  }
122
124
  ),
123
- u(r.options)
125
+ y(r.options)
124
126
  ] }, r.category)
125
- )) : u(s)
127
+ )) : y(s)
126
128
  }
127
129
  ),
128
- (d || a) && /* @__PURE__ */ t(
130
+ (c || i) && /* @__PURE__ */ t(
129
131
  "p",
130
132
  {
131
- id: p,
133
+ id: u,
132
134
  className: e(
133
135
  "rst:text-xs rst:text-left",
134
136
  n ? "rst:text-error-600 rst:dark:text-error-400 rst:font-medium" : "rst:text-gray-500 rst:dark:text-gray-400",
135
137
  l && "rst:opacity-50"
136
138
  ),
137
- children: a || d
139
+ children: i || c
138
140
  }
139
141
  )
140
142
  ]
@@ -142,5 +144,5 @@ const W = (s) => s.length > 0 && Array.isArray(s[0].options), q = {
142
144
  );
143
145
  };
144
146
  export {
145
- tr as CheckboxGroup
147
+ or as CheckboxGroup
146
148
  };
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime");require("react");const u=require("../../../node_modules/@headlessui/react/dist/components/description/description.cjs"),w=require("../../../node_modules/@headlessui/react/dist/components/field/field.cjs"),m=require("../../../node_modules/@headlessui/react/dist/components/label/label.cjs"),p=require("../../../node_modules/@headlessui/react/dist/components/radio-group/radio-group.cjs"),r=require("../../../lib/utils.cjs"),c=require("./radio-group-variants.cjs"),L={sm:"rst:text-xs",md:"rst:text-sm",lg:"rst:text-base"},D=({options:f,value:v,onChange:y,label:n,helperText:d,errorMessage:l,disabled:e=!1,size:j="md",orientation:i="vertical",colorScheme:b,className:N,optionsClassName:h,optionClassName:q,radioClassName:g,labelClassName:G,optionLabelClassName:z,descriptionClassName:R,messageClassName:S,"aria-invalid":V,...k})=>{const x=!!l,a=j??"md";return t.jsxs(p.RadioGroup,{value:v,onChange:y,disabled:e,className:r.cn("rst:font-ui rst:flex rst:flex-col rst:gap-1.5 rst:min-w-0",N),...k,"aria-invalid":x||V||void 0,"aria-orientation":i,children:[n&&t.jsx(m.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",G),children:n}),t.jsx("div",{className:r.cn(c.radioGroupOptionsVariants({size:a,orientation:i}),h),children:f.map(s=>t.jsxs(w.Field,{disabled:e||s.disabled,className:r.cn(c.radioOptionVariants({orientation:i,size:a}),q),children:[t.jsx(p.Radio,{value:s.value,className:({checked:o})=>r.cn(c.radioVariants({colorScheme:b,size:a,checked:o}),"rst:self-start",e||s.disabled?"rst:opacity-50 rst:cursor-not-allowed":"rst:cursor-pointer",g),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(m.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",L[a],z),children:s.label}),s.description&&t.jsx(u.Description,{className:r.cn("rst:text-xs rst:text-gray-500 rst:dark:text-gray-400 rst:data-disabled:opacity-50",R),children:s.description})]})]},s.value))}),(d||l)&&t.jsx(u.Description,{as:"p",className:r.cn("rst:text-xs rst:text-left",x?"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",S),children:l||d})]})};exports.RadioGroup=D;
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, so a caller's survives its spread — and is then outranked
49
- * by this component's own error state, which is a different thing from the
50
- * token-list merge `CheckboxGroup` does for `aria-describedby`.
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. */
@@ -1,55 +1,56 @@
1
1
  "use client";
2
2
  import { jsxs as c, jsx as s } from "react/jsx-runtime";
3
3
  import "react";
4
- import { Description as x } from "../../../node_modules/@headlessui/react/dist/components/description/description.js";
5
- import { Field as R } from "../../../node_modules/@headlessui/react/dist/components/field/field.js";
6
- import { Label as p } from "../../../node_modules/@headlessui/react/dist/components/label/label.js";
7
- import { RadioGroup as S, Radio as j } from "../../../node_modules/@headlessui/react/dist/components/radio-group/radio-group.js";
4
+ import { Description as p } from "../../../node_modules/@headlessui/react/dist/components/description/description.js";
5
+ import { Field as S } from "../../../node_modules/@headlessui/react/dist/components/field/field.js";
6
+ import { Label as f } from "../../../node_modules/@headlessui/react/dist/components/label/label.js";
7
+ import { RadioGroup as j, Radio as D } from "../../../node_modules/@headlessui/react/dist/components/radio-group/radio-group.js";
8
8
  import { cn as t } from "../../../lib/utils.js";
9
- import { radioDotVariants as D, radioVariants as O, radioOptionVariants as Z, radioGroupOptionsVariants as A } from "./radio-group-variants.js";
10
- const B = {
9
+ import { isFieldInvalid as F, withoutInvalidProps as O } from "../../../internal/field-invalid.js";
10
+ import { radioDotVariants as P, radioVariants as Z, radioOptionVariants as A, radioGroupOptionsVariants as B } from "./radio-group-variants.js";
11
+ const K = {
11
12
  sm: "rst:text-xs",
12
13
  md: "rst:text-sm",
13
14
  lg: "rst:text-base"
14
- }, J = ({
15
- options: f,
16
- value: u,
17
- onChange: v,
15
+ }, Y = ({
16
+ options: u,
17
+ value: v,
18
+ onChange: y,
18
19
  label: d,
19
20
  helperText: m,
20
21
  errorMessage: o,
21
22
  disabled: a = !1,
22
- size: y = "md",
23
+ size: h = "md",
23
24
  orientation: i = "vertical",
24
25
  colorScheme: N,
25
- className: h,
26
- optionsClassName: b,
27
- optionClassName: z,
28
- radioClassName: g,
26
+ className: b,
27
+ optionsClassName: g,
28
+ optionClassName: w,
29
+ radioClassName: z,
29
30
  labelClassName: k,
30
- optionLabelClassName: w,
31
- descriptionClassName: V,
32
- messageClassName: E,
33
- "aria-invalid": G,
34
- ...L
31
+ optionLabelClassName: V,
32
+ descriptionClassName: E,
33
+ messageClassName: G,
34
+ "aria-invalid": I,
35
+ ...n
35
36
  }) => {
36
- const n = !!o, e = y ?? "md";
37
+ const x = !!o, L = F(x, { ...n, "aria-invalid": I }), R = O(n), e = h ?? "md";
37
38
  return /* @__PURE__ */ c(
38
- S,
39
+ j,
39
40
  {
40
- value: u,
41
- onChange: v,
41
+ value: v,
42
+ onChange: y,
42
43
  disabled: a,
43
44
  className: t(
44
45
  "rst:font-ui rst:flex rst:flex-col rst:gap-1.5 rst:min-w-0",
45
- h
46
+ b
46
47
  ),
47
- ...L,
48
- "aria-invalid": n || G || void 0,
48
+ ...R,
49
+ "aria-invalid": L || void 0,
49
50
  "aria-orientation": i,
50
51
  children: [
51
52
  d && /* @__PURE__ */ s(
52
- p,
53
+ f,
53
54
  {
54
55
  className: t(
55
56
  "rst:block rst:text-sm rst:font-medium rst:text-[var(--roster-control-text)] rst:text-left",
@@ -63,37 +64,37 @@ const B = {
63
64
  "div",
64
65
  {
65
66
  className: t(
66
- A({ size: e, orientation: i }),
67
- b
67
+ B({ size: e, orientation: i }),
68
+ g
68
69
  ),
69
- children: f.map((r) => /* @__PURE__ */ c(
70
- R,
70
+ children: u.map((r) => /* @__PURE__ */ c(
71
+ S,
71
72
  {
72
73
  disabled: a || r.disabled,
73
74
  className: t(
74
- Z({ orientation: i, size: e }),
75
- z
75
+ A({ orientation: i, size: e }),
76
+ w
76
77
  ),
77
78
  children: [
78
79
  /* @__PURE__ */ s(
79
- j,
80
+ D,
80
81
  {
81
82
  value: r.value,
82
83
  className: ({ checked: l }) => t(
83
- O({ colorScheme: N, size: e, checked: l }),
84
+ Z({ colorScheme: N, size: e, checked: l }),
84
85
  /* `self-start`, and no nudge. The circle's height equals the
85
86
  label's line-height at every size, so aligning their top
86
87
  edges puts the radio on the first line whether the label
87
88
  is one line or four. */
88
89
  "rst:self-start",
89
90
  a || r.disabled ? "rst:opacity-50 rst:cursor-not-allowed" : "rst:cursor-pointer",
90
- g
91
+ z
91
92
  ),
92
93
  children: ({ checked: l }) => /* @__PURE__ */ s(
93
94
  "span",
94
95
  {
95
96
  className: t(
96
- D({ size: e }),
97
+ P({ size: e }),
97
98
  l ? "rst:opacity-100" : "rst:opacity-0"
98
99
  )
99
100
  }
@@ -113,24 +114,24 @@ const B = {
113
114
  ),
114
115
  children: [
115
116
  /* @__PURE__ */ s(
116
- p,
117
+ f,
117
118
  {
118
119
  className: t(
119
120
  "rst:cursor-pointer rst:select-none",
120
121
  "rst:text-[var(--roster-control-text)]",
121
122
  "rst:data-disabled:cursor-not-allowed rst:data-disabled:opacity-50",
122
- B[e],
123
- w
123
+ K[e],
124
+ V
124
125
  ),
125
126
  children: r.label
126
127
  }
127
128
  ),
128
129
  r.description && /* @__PURE__ */ s(
129
- x,
130
+ p,
130
131
  {
131
132
  className: t(
132
133
  "rst:text-xs rst:text-gray-500 rst:dark:text-gray-400 rst:data-disabled:opacity-50",
133
- V
134
+ E
134
135
  ),
135
136
  children: r.description
136
137
  }
@@ -145,14 +146,14 @@ const B = {
145
146
  }
146
147
  ),
147
148
  (m || o) && /* @__PURE__ */ s(
148
- x,
149
+ p,
149
150
  {
150
151
  as: "p",
151
152
  className: t(
152
153
  "rst:text-xs rst:text-left",
153
- n ? "rst:text-error-600 rst:dark:text-error-400 rst:font-medium" : "rst:text-gray-500 rst:dark:text-gray-400",
154
+ x ? "rst:text-error-600 rst:dark:text-error-400 rst:font-medium" : "rst:text-gray-500 rst:dark:text-gray-400",
154
155
  a && "rst:opacity-50",
155
- E
156
+ G
156
157
  ),
157
158
  children: o || m
158
159
  }
@@ -162,5 +163,5 @@ const B = {
162
163
  );
163
164
  };
164
165
  export {
165
- J as RadioGroup
166
+ Y as RadioGroup
166
167
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function n(t,i){if(t||i.invalid)return!0;const e=i["aria-invalid"];return e!=null&&e!==!1&&e!=="false"&&e!==""}function l(t){const i={...t};return delete i["aria-invalid"],delete i.invalid,i}exports.isFieldInvalid=n;exports.withoutInvalidProps=l;
@@ -0,0 +1,37 @@
1
+ /**
2
+ * When a Roster field is invalid, and where it says so. Every field component
3
+ * follows this one rule; a new field should too.
4
+ *
5
+ * A field is invalid when any of these hold:
6
+ *
7
+ * - it shows an error: an `errorMessage`, or the `error` flag;
8
+ * - the consumer passes `aria-invalid` with any value but `false`, `"false"`
9
+ * or `""` (ARIA reads an empty value as false). `"grammar"` and
10
+ * `"spelling"` count, and come out as `"true"`: a field is invalid or it
11
+ * isn't;
12
+ * - the consumer passes Headless UI's own `invalid`.
13
+ *
14
+ * An error wins: a field with one is invalid even when the consumer passes
15
+ * `aria-invalid="false"`.
16
+ *
17
+ * An invalid field renders `aria-invalid="true"` on the control a screen
18
+ * reader focuses, so it is announced as invalid along with its error text,
19
+ * not only drawn in red. A valid one renders no `aria-invalid` at all. The
20
+ * only exception is a role that can't carry the state: a radio can't, so a
21
+ * radio group says it on the group.
22
+ *
23
+ * Read the consumer's props here, not by spreading them: the props of most
24
+ * fields land on a wrapper with no role, where `aria-invalid` does nothing,
25
+ * and Headless UI's text controls overwrite a passed `aria-invalid` with
26
+ * their own.
27
+ */
28
+ export interface InvalidProps {
29
+ "aria-invalid"?: unknown;
30
+ invalid?: unknown;
31
+ }
32
+ export declare function isFieldInvalid(hasError: boolean | null | undefined, props: InvalidProps): boolean;
33
+ /**
34
+ * Splits the two invalid props off the rest, so the rest can be spread on a
35
+ * wrapper without them landing where they mean nothing.
36
+ */
37
+ export declare function withoutInvalidProps<T extends object>(props: T): Omit<T, "aria-invalid" | "invalid">;
@@ -0,0 +1,13 @@
1
+ function t(n, i) {
2
+ if (n || i.invalid) return !0;
3
+ const e = i["aria-invalid"];
4
+ return e != null && e !== !1 && e !== "false" && e !== "";
5
+ }
6
+ function r(n) {
7
+ const i = { ...n };
8
+ return delete i["aria-invalid"], delete i.invalid, i;
9
+ }
10
+ export {
11
+ t as isFieldInvalid,
12
+ r as withoutInvalidProps
13
+ };
package/dist/meta.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "5.2.0",
3
- "tests": 1759,
4
- "testFiles": 236
2
+ "version": "5.2.1",
3
+ "tests": 1767,
4
+ "testFiles": 297
5
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blakesteve/roster",
3
- "version": "5.2.0",
3
+ "version": "5.2.1",
4
4
  "description": "A production-grade atomic component library: accessible, theme-aware, and documented in Storybook. React 19, TypeScript, Tailwind CSS v4.",
5
5
  "keywords": [
6
6
  "react",