@vjdesigns/vjdesigns-ui 3.8.0 → 3.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/LICENSE +1 -1
  3. package/README.md +854 -854
  4. package/dist/ai/llms-full.txt +576 -576
  5. package/dist/ai/registry.json +6 -6
  6. package/dist/components/data-display/Accordion/Accordion.cjs.js +1 -1
  7. package/dist/components/data-display/Accordion/Accordion.mjs +13 -9
  8. package/dist/components/data-display/List/List.cjs.js +1 -1
  9. package/dist/components/data-display/List/List.mjs +1 -0
  10. package/dist/components/data-display/Poll/Poll.cjs.js +1 -1
  11. package/dist/components/data-display/Poll/Poll.mjs +11 -7
  12. package/dist/components/data-display/Poll/Poll.module.css.cjs.js +1 -1
  13. package/dist/components/data-display/Poll/Poll.module.css.mjs +1 -1
  14. package/dist/components/feedback/Progress/Progress.cjs.js +1 -1
  15. package/dist/components/feedback/Progress/Progress.mjs +2 -0
  16. package/dist/components/forms/CheckBox/CheckBox.cjs.js +1 -1
  17. package/dist/components/forms/CheckBox/CheckBox.mjs +111 -99
  18. package/dist/components/forms/CheckBox/CheckBox.module.css.cjs.js +1 -1
  19. package/dist/components/forms/CheckBox/CheckBox.module.css.mjs +17 -16
  20. package/dist/components/forms/Combobox/ComboboxPopup.cjs.js +1 -1
  21. package/dist/components/forms/Combobox/ComboboxPopup.mjs +13 -9
  22. package/dist/components/forms/Radio/Radio.cjs.js +1 -1
  23. package/dist/components/forms/Radio/Radio.mjs +28 -20
  24. package/dist/components/forms/Rating/Rating.cjs.js +1 -1
  25. package/dist/components/forms/Rating/Rating.mjs +2 -2
  26. package/dist/components/forms/RatingScale/RatingScale.cjs.js +1 -1
  27. package/dist/components/forms/RatingScale/RatingScale.mjs +2 -2
  28. package/dist/components/forms/SegmentedControl/SegmentedControl.cjs.js +1 -1
  29. package/dist/components/forms/SegmentedControl/SegmentedControl.mjs +82 -80
  30. package/dist/components/forms/SegmentedControl/SegmentedControl.module.css.cjs.js +1 -1
  31. package/dist/components/forms/SegmentedControl/SegmentedControl.module.css.mjs +1 -1
  32. package/dist/components/forms/Switch/Switch.cjs.js +1 -1
  33. package/dist/components/forms/Switch/Switch.mjs +39 -35
  34. package/dist/components/navigation/MobileNav/MobileNav.module.css.cjs.js +1 -1
  35. package/dist/components/navigation/MobileNav/MobileNav.module.css.mjs +14 -14
  36. package/dist/components/navigation/Stepper/Stepper.cjs.js +1 -1
  37. package/dist/components/navigation/Stepper/Stepper.mjs +1 -0
  38. package/dist/components/navigation/Tabs/Tabs.cjs.js +1 -1
  39. package/dist/components/navigation/Tabs/Tabs.mjs +129 -127
  40. package/dist/components/navigation/Tabs/Tabs.module.css.cjs.js +1 -1
  41. package/dist/components/navigation/Tabs/Tabs.module.css.mjs +1 -1
  42. package/dist/components/primitives/Icon/IconSvg.cjs.js +1 -1
  43. package/dist/components/primitives/Icon/IconSvg.mjs +18 -11
  44. package/dist/utils/plainText.cjs.js +1 -0
  45. package/dist/utils/plainText.d.ts +7 -0
  46. package/dist/utils/plainText.mjs +14 -0
  47. package/dist/vjdesigns-ui.css +1 -1
  48. package/package.json +6 -1
@@ -27,175 +27,187 @@ var v = {
27
27
  vertical: c.vertical,
28
28
  horizontal: c.horizontal
29
29
  }, S = l(null);
30
- function C({ checked: a, defaultChecked: o = !1, onCheckedChange: l, indeterminate: h = !1, label: x, description: C, size: w, tone: T, invalid: E, disabled: D, required: ee, readOnly: te, labelPosition: O = "end", value: k, name: A, id: j, className: M, style: N, ref: P, onChange: F, onClick: I, "aria-describedby": L, ...R }) {
31
- let z = d(S), B = f(), V = f(), H = s({
32
- id: j ?? (z ? B : void 0),
33
- invalid: E ?? z?.invalid,
34
- required: ee,
35
- disabled: D ?? (z?.disabled || void 0),
36
- readOnly: te ?? (z?.readOnly || void 0),
37
- size: w ?? z?.size,
38
- "aria-describedby": [C ? V : void 0, L].filter(Boolean).join(" ") || void 0
39
- }), U = H.id ?? B, W = H.size ?? "md", G = T ?? z?.tone ?? "primary", { disabled: K, readOnly: q, invalid: J } = H, Y = z ? [
40
- C ? V : void 0,
41
- z.itemDescribedBy,
42
- L
43
- ].filter(Boolean).join(" ") || void 0 : H.ariaProps["aria-describedby"], [X, Z] = e({
30
+ function C({ checked: a, defaultChecked: o = !1, onCheckedChange: l, indeterminate: h = !1, label: x, description: C, size: w, tone: T, invalid: E, disabled: D, required: O, readOnly: ee, labelPosition: k = "end", value: A, name: j, id: M, className: N, style: P, ref: F, onChange: I, onClick: L, "aria-describedby": R, ...z }) {
31
+ let B = d(S), V = f(), H = f(), U = s({
32
+ id: M ?? (B ? V : void 0),
33
+ invalid: E ?? B?.invalid,
34
+ required: O,
35
+ disabled: D ?? (B?.disabled || void 0),
36
+ readOnly: ee ?? (B?.readOnly || void 0),
37
+ size: w ?? B?.size,
38
+ "aria-describedby": [C ? H : void 0, R].filter(Boolean).join(" ") || void 0
39
+ }), W = U.id ?? V, G = U.size ?? "md", K = T ?? B?.tone ?? "primary", { disabled: q, readOnly: J, invalid: Y } = U, X = B ? [
40
+ C ? H : void 0,
41
+ B.itemDescribedBy,
42
+ R
43
+ ].filter(Boolean).join(" ") || void 0 : U.ariaProps["aria-describedby"], [te, Z] = e({
44
44
  value: a,
45
45
  defaultValue: o,
46
46
  onChange: l
47
47
  });
48
- t(() => $.current, () => z ? z.reset() : Z(o ?? !1), z ? !0 : a === void 0);
49
- let Q = k ?? "on", ne = z ? z.value.includes(Q) : X, re = z?.register;
50
- p(() => re?.(Q, U, !!K), [
48
+ t(() => $.current, () => B ? B.reset() : Z(o ?? !1), B ? !0 : a === void 0);
49
+ let Q = A ?? "on", ne = B ? B.value.includes(Q) : te, re = B?.register;
50
+ p(() => re?.(Q, W, !!q), [
51
51
  re,
52
52
  Q,
53
- U,
54
- K
53
+ W,
54
+ q
55
55
  ]);
56
56
  let $ = m(null);
57
57
  p(() => {
58
58
  $.current && ($.current.indeterminate = h);
59
59
  });
60
60
  let ie = u((e) => {
61
- if ($.current = e, typeof P == "function") return P(e);
62
- P && (P.current = e);
63
- }, [P]), ae = (e) => {
64
- I?.(e), q && e.preventDefault();
61
+ if ($.current = e, typeof F == "function") return F(e);
62
+ F && (F.current = e);
63
+ }, [F]), ae = (e) => {
64
+ L?.(e), J && e.preventDefault();
65
65
  }, oe = (e) => {
66
- if (F?.(e), q) return;
66
+ if (I?.(e), J) return;
67
67
  let t = e.target.checked;
68
- z ? (z.toggle(Q, t), l?.(t)) : Z(t);
68
+ B ? (B.toggle(Q, t), l?.(t)) : Z(t);
69
69
  };
70
70
  return /* @__PURE__ */ _("div", {
71
- className: n(c.root, v[W], y[G], b[O], M),
72
- style: N,
73
- "data-disabled": K || void 0,
74
- "data-invalid": J || void 0,
75
- "data-readonly": q || void 0,
71
+ className: n(c.root, v[G], y[K], b[k], N),
72
+ style: P,
73
+ "data-disabled": q || void 0,
74
+ "data-invalid": Y || void 0,
75
+ "data-readonly": J || void 0,
76
76
  children: [/* @__PURE__ */ _("span", {
77
77
  className: c.controlWrap,
78
78
  children: [/* @__PURE__ */ g("input", {
79
- ...R,
79
+ ...z,
80
80
  ref: ie,
81
81
  type: "checkbox",
82
- id: U,
83
- name: A ?? z?.name,
82
+ id: W,
83
+ name: j ?? B?.name,
84
84
  value: Q,
85
85
  checked: ne,
86
- disabled: K,
87
- required: z ? void 0 : H.required,
88
- "aria-describedby": Y,
89
- "aria-invalid": H.ariaProps["aria-invalid"],
90
- "aria-errormessage": z ? void 0 : H.ariaProps["aria-errormessage"],
91
- "aria-readonly": q || void 0,
86
+ disabled: q,
87
+ required: B ? void 0 : U.required,
88
+ "aria-describedby": X,
89
+ "aria-invalid": U.ariaProps["aria-invalid"],
90
+ "aria-errormessage": B ? void 0 : U.ariaProps["aria-errormessage"],
91
+ "aria-readonly": J || void 0,
92
92
  className: c.input,
93
93
  onClick: ae,
94
94
  onChange: oe
95
95
  }), /* @__PURE__ */ _("span", {
96
96
  className: c.control,
97
97
  "aria-hidden": "true",
98
- children: [/* @__PURE__ */ g(r, {
99
- className: n(c.mark, c.check),
100
- strokeWidth: 3.5
101
- }), /* @__PURE__ */ g(i, {
102
- className: n(c.mark, c.minus),
103
- strokeWidth: 3.5
98
+ children: [/* @__PURE__ */ g("span", {
99
+ className: c.markWrap,
100
+ hidden: !ne || h,
101
+ children: /* @__PURE__ */ g(r, {
102
+ className: n(c.mark, c.check),
103
+ strokeWidth: 3.5
104
+ })
105
+ }), /* @__PURE__ */ g("span", {
106
+ className: c.markWrap,
107
+ hidden: !h,
108
+ children: /* @__PURE__ */ g(i, {
109
+ className: n(c.mark, c.minus),
110
+ strokeWidth: 3.5
111
+ })
104
112
  })]
105
113
  })]
106
114
  }), (x || C) && /* @__PURE__ */ _("span", {
107
115
  className: c.text,
108
- children: [x && /* @__PURE__ */ g("label", {
109
- id: `${U}-label`,
110
- htmlFor: U,
111
- className: c.label,
112
- children: x
113
- }), C && /* @__PURE__ */ g("span", {
114
- id: V,
115
- className: c.description,
116
- children: C
117
- })]
116
+ children: [
117
+ x && /* @__PURE__ */ g("label", {
118
+ id: `${W}-label`,
119
+ htmlFor: W,
120
+ className: c.label,
121
+ children: x
122
+ }),
123
+ x && C && " ",
124
+ C && /* @__PURE__ */ g("span", {
125
+ id: H,
126
+ className: c.description,
127
+ children: C
128
+ })
129
+ ]
118
130
  })]
119
131
  });
120
132
  }
121
- function w({ value: t, defaultValue: r = [], onValueChange: i, name: l, orientation: d = "vertical", size: p, tone: m, disabled: y, readOnly: b, invalid: w, label: T, description: E, selectAll: D, className: ee, children: te, "aria-labelledby": O, "aria-describedby": k, ...A }) {
122
- let j = o(), M = f(), N = f(), P = f(), F = s({
133
+ function w({ value: t, defaultValue: r = [], onValueChange: i, name: l, orientation: d = "vertical", size: p, tone: m, disabled: y, readOnly: b, invalid: w, label: T, description: E, selectAll: D, className: O, children: ee, "aria-labelledby": k, "aria-describedby": A, ...j }) {
134
+ let M = o(), N = f(), P = f(), F = f(), I = s({
123
135
  invalid: w,
124
136
  disabled: y,
125
137
  readOnly: b,
126
138
  size: p,
127
- "aria-describedby": [E ? N : void 0, k].filter(Boolean).join(" ") || void 0
128
- }), [I, L] = e({
139
+ "aria-describedby": [E ? P : void 0, A].filter(Boolean).join(" ") || void 0
140
+ }), [L, R] = e({
129
141
  value: t,
130
142
  defaultValue: r,
131
143
  onChange: i
132
- }), R = u((e, t) => {
133
- L((n) => t ? n.includes(e) ? n : [...n, e] : n.filter((t) => t !== e));
134
- }, [L]), [z, B] = h(() => /* @__PURE__ */ new Map()), V = D != null && D !== !1, H = u((e, t, n) => (B((r) => new Map(r).set(e, {
144
+ }), z = u((e, t) => {
145
+ R((n) => t ? n.includes(e) ? n : [...n, e] : n.filter((t) => t !== e));
146
+ }, [R]), [B, V] = h(() => /* @__PURE__ */ new Map()), H = D != null && D !== !1, U = u((e, t, n) => (V((r) => new Map(r).set(e, {
135
147
  id: t,
136
148
  disabled: n
137
- })), () => B((n) => {
149
+ })), () => V((n) => {
138
150
  if (n.get(e)?.id !== t) return n;
139
151
  let r = new Map(n);
140
152
  return r.delete(e), r;
141
- })), []), U = [...z].filter(([, e]) => !e.disabled).map(([e]) => e), W = U.length > 0 && U.every((e) => I.includes(e)), G = [...z.keys()].some((e) => I.includes(e)), K = (e) => L((t) => e ? [...t, ...U.filter((e) => !t.includes(e))] : t.filter((e) => !U.includes(e))), q = j?.isGroup === !0 && !O && !T, J = [O, T ? M : void 0].filter(Boolean).join(" ") || void 0, Y = [E ? N : void 0, k].filter(Boolean).join(" ") || void 0, X = {
153
+ })), []), W = [...B].filter(([, e]) => !e.disabled).map(([e]) => e), G = W.length > 0 && W.every((e) => L.includes(e)), K = [...B.keys()].some((e) => L.includes(e)), q = (e) => R((t) => e ? [...t, ...W.filter((e) => !t.includes(e))] : t.filter((e) => !W.includes(e))), J = M?.isGroup === !0 && !k && !T, Y = [k, T ? N : void 0].filter(Boolean).join(" ") || void 0, X = [E ? P : void 0, A].filter(Boolean).join(" ") || void 0, te = {
142
154
  name: l,
143
- value: I,
144
- toggle: R,
145
- size: F.size,
155
+ value: L,
156
+ toggle: z,
157
+ size: I.size,
146
158
  tone: m,
147
- disabled: F.disabled,
148
- readOnly: F.readOnly,
149
- invalid: F.invalid,
159
+ disabled: I.disabled,
160
+ readOnly: I.readOnly,
161
+ invalid: I.invalid,
150
162
  reset: () => {
151
- t === void 0 && L(r ?? []);
163
+ t === void 0 && R(r ?? []);
152
164
  },
153
- itemDescribedBy: q ? Y : void 0,
154
- register: V ? H : void 0
165
+ itemDescribedBy: J ? X : void 0,
166
+ register: H ? U : void 0
155
167
  }, Z = /* @__PURE__ */ g("div", {
156
- className: n(c.options, x[d], V && c.selectAllOptions),
157
- role: V ? "group" : void 0,
158
- "aria-labelledby": V ? `${P}-label` : void 0,
168
+ className: n(c.options, x[d], H && c.selectAllOptions),
169
+ role: H ? "group" : void 0,
170
+ "aria-labelledby": H ? `${F}-label` : void 0,
159
171
  children: /* @__PURE__ */ g(S.Provider, {
160
- value: X,
161
- children: te
172
+ value: te,
173
+ children: ee
162
174
  })
163
175
  });
164
176
  return /* @__PURE__ */ _("div", {
165
- ...A,
166
- role: q ? void 0 : "group",
167
- "aria-labelledby": q ? void 0 : J,
168
- "aria-describedby": q ? Y : F.ariaProps["aria-describedby"],
169
- className: n(c.group, v[F.size ?? "md"], ee),
170
- "data-disabled": F.disabled || void 0,
171
- "aria-disabled": F.disabled || void 0,
177
+ ...j,
178
+ role: J ? void 0 : "group",
179
+ "aria-labelledby": J ? void 0 : Y,
180
+ "aria-describedby": J ? X : I.ariaProps["aria-describedby"],
181
+ className: n(c.group, v[I.size ?? "md"], O),
182
+ "data-disabled": I.disabled || void 0,
183
+ "aria-disabled": I.disabled || void 0,
172
184
  children: [(T || E) && /* @__PURE__ */ _("div", {
173
185
  className: c.groupHeader,
174
- children: [T && /* @__PURE__ */ g("span", {
175
- id: M,
186
+ children: [T && /* @__PURE__ */ g("div", {
187
+ id: N,
176
188
  className: c.groupLabel,
177
189
  children: T
178
- }), E && /* @__PURE__ */ g("span", {
179
- id: N,
190
+ }), E && /* @__PURE__ */ g("div", {
191
+ id: P,
180
192
  className: c.description,
181
193
  children: E
182
194
  })]
183
- }), V ? /* @__PURE__ */ _("div", {
195
+ }), H ? /* @__PURE__ */ _("div", {
184
196
  className: c.selectAll,
185
197
  children: [/* @__PURE__ */ g(a.Provider, {
186
198
  value: null,
187
199
  children: /* @__PURE__ */ g(C, {
188
- id: P,
200
+ id: F,
189
201
  label: D,
190
- checked: W,
191
- indeterminate: G && !W,
192
- onCheckedChange: K,
193
- "aria-controls": [...z.values()].map((e) => e.id).join(" ") || void 0,
194
- size: F.size,
202
+ checked: G,
203
+ indeterminate: K && !G,
204
+ onCheckedChange: q,
205
+ "aria-controls": [...B.values()].map((e) => e.id).join(" ") || void 0,
206
+ size: I.size,
195
207
  tone: m,
196
- disabled: F.disabled || U.length === 0,
197
- readOnly: F.readOnly,
198
- invalid: F.invalid
208
+ disabled: I.disabled || W.length === 0,
209
+ readOnly: I.readOnly,
210
+ invalid: I.invalid
199
211
  })
200
212
  }), Z]
201
213
  }) : Z]
@@ -1 +1 @@
1
- var e=`_root_ovzx7_35`,t=`_sm_ovzx7_59`,n=`_md_ovzx7_73`,r=`_lg_ovzx7_87`,i=`_tonePrimary_ovzx7_105`,a=`_toneNeutral_ovzx7_117`,o=`_toneAccent_ovzx7_129`,s=`_toneSuccess_ovzx7_141`,c=`_toneWarning_ovzx7_153`,l=`_toneDanger_ovzx7_165`,u=`_toneInfo_ovzx7_177`,d=`_labelEnd_ovzx7_193`,f=`_labelStart_ovzx7_199`,p=`_controlWrap_ovzx7_211`,m=`_input_ovzx7_239`,h=`_control_ovzx7_211`,g=`_mark_ovzx7_299`,_=`_check_ovzx7_363`,v=`_minus_ovzx7_365`,y=`_label_ovzx7_193`,b=`_description_ovzx7_441`,x=`_text_ovzx7_451`,S=`_group_ovzx7_489`,C=`_groupHeader_ovzx7_505`,w=`_groupLabel_ovzx7_517`,T=`_options_ovzx7_539`,E=`_vertical_ovzx7_545`,D=`_horizontal_ovzx7_553`,O=`_selectAll_ovzx7_569`,k=`_selectAllOptions_ovzx7_579`,A={root:e,sm:t,md:n,lg:r,tonePrimary:i,toneNeutral:a,toneAccent:o,toneSuccess:s,toneWarning:c,toneDanger:l,toneInfo:u,labelEnd:d,labelStart:f,controlWrap:p,input:m,control:h,mark:g,check:_,minus:v,label:y,description:b,text:x,group:S,groupHeader:C,groupLabel:w,options:T,vertical:E,horizontal:D,selectAll:O,selectAllOptions:k};exports.check=_,exports.control=h,exports.controlWrap=p,exports.default=A,exports.description=b,exports.group=S,exports.groupHeader=C,exports.groupLabel=w,exports.horizontal=D,exports.input=m,exports.label=y,exports.labelEnd=d,exports.labelStart=f,exports.lg=r,exports.mark=g,exports.md=n,exports.minus=v,exports.options=T,exports.root=e,exports.selectAll=O,exports.selectAllOptions=k,exports.sm=t,exports.text=x,exports.toneAccent=o,exports.toneDanger=l,exports.toneInfo=u,exports.toneNeutral=a,exports.tonePrimary=i,exports.toneSuccess=s,exports.toneWarning=c,exports.vertical=E;
1
+ var e=`_root_1322p_35`,t=`_sm_1322p_59`,n=`_md_1322p_73`,r=`_lg_1322p_87`,i=`_tonePrimary_1322p_105`,a=`_toneNeutral_1322p_117`,o=`_toneAccent_1322p_129`,s=`_toneSuccess_1322p_141`,c=`_toneWarning_1322p_153`,l=`_toneDanger_1322p_165`,u=`_toneInfo_1322p_177`,d=`_labelEnd_1322p_193`,f=`_labelStart_1322p_199`,p=`_controlWrap_1322p_211`,m=`_input_1322p_239`,h=`_control_1322p_211`,g=`_markWrap_1322p_299`,_=`_mark_1322p_299`,v=`_check_1322p_373`,y=`_minus_1322p_375`,b=`_label_1322p_193`,x=`_description_1322p_451`,S=`_text_1322p_461`,C=`_group_1322p_499`,w=`_groupHeader_1322p_515`,T=`_groupLabel_1322p_527`,E=`_options_1322p_549`,D=`_vertical_1322p_555`,O=`_horizontal_1322p_563`,k=`_selectAll_1322p_579`,A=`_selectAllOptions_1322p_589`,j={root:e,sm:t,md:n,lg:r,tonePrimary:i,toneNeutral:a,toneAccent:o,toneSuccess:s,toneWarning:c,toneDanger:l,toneInfo:u,labelEnd:d,labelStart:f,controlWrap:p,input:m,control:h,markWrap:g,mark:_,check:v,minus:y,label:b,description:x,text:S,group:C,groupHeader:w,groupLabel:T,options:E,vertical:D,horizontal:O,selectAll:k,selectAllOptions:A};exports.check=v,exports.control=h,exports.controlWrap=p,exports.default=j,exports.description=x,exports.group=C,exports.groupHeader=w,exports.groupLabel=T,exports.horizontal=O,exports.input=m,exports.label=b,exports.labelEnd=d,exports.labelStart=f,exports.lg=r,exports.mark=_,exports.markWrap=g,exports.md=n,exports.minus=y,exports.options=E,exports.root=e,exports.selectAll=k,exports.selectAllOptions=A,exports.sm=t,exports.text=S,exports.toneAccent=o,exports.toneDanger=l,exports.toneInfo=u,exports.toneNeutral=a,exports.tonePrimary=i,exports.toneSuccess=s,exports.toneWarning=c,exports.vertical=D;
@@ -1,5 +1,5 @@
1
1
  // src/components/forms/CheckBox/CheckBox.module.css
2
- var e = "_root_ovzx7_35", t = "_sm_ovzx7_59", n = "_md_ovzx7_73", r = "_lg_ovzx7_87", i = "_tonePrimary_ovzx7_105", a = "_toneNeutral_ovzx7_117", o = "_toneAccent_ovzx7_129", s = "_toneSuccess_ovzx7_141", c = "_toneWarning_ovzx7_153", l = "_toneDanger_ovzx7_165", u = "_toneInfo_ovzx7_177", d = "_labelEnd_ovzx7_193", f = "_labelStart_ovzx7_199", p = "_controlWrap_ovzx7_211", m = "_input_ovzx7_239", h = "_control_ovzx7_211", g = "_mark_ovzx7_299", _ = "_check_ovzx7_363", v = "_minus_ovzx7_365", y = "_label_ovzx7_193", b = "_description_ovzx7_441", x = "_text_ovzx7_451", S = "_group_ovzx7_489", C = "_groupHeader_ovzx7_505", w = "_groupLabel_ovzx7_517", T = "_options_ovzx7_539", E = "_vertical_ovzx7_545", D = "_horizontal_ovzx7_553", O = "_selectAll_ovzx7_569", k = "_selectAllOptions_ovzx7_579", A = {
2
+ var e = "_root_1322p_35", t = "_sm_1322p_59", n = "_md_1322p_73", r = "_lg_1322p_87", i = "_tonePrimary_1322p_105", a = "_toneNeutral_1322p_117", o = "_toneAccent_1322p_129", s = "_toneSuccess_1322p_141", c = "_toneWarning_1322p_153", l = "_toneDanger_1322p_165", u = "_toneInfo_1322p_177", d = "_labelEnd_1322p_193", f = "_labelStart_1322p_199", p = "_controlWrap_1322p_211", m = "_input_1322p_239", h = "_control_1322p_211", g = "_markWrap_1322p_299", _ = "_mark_1322p_299", v = "_check_1322p_373", y = "_minus_1322p_375", b = "_label_1322p_193", x = "_description_1322p_451", S = "_text_1322p_461", C = "_group_1322p_499", w = "_groupHeader_1322p_515", T = "_groupLabel_1322p_527", E = "_options_1322p_549", D = "_vertical_1322p_555", O = "_horizontal_1322p_563", k = "_selectAll_1322p_579", A = "_selectAllOptions_1322p_589", j = {
3
3
  root: e,
4
4
  sm: t,
5
5
  md: n,
@@ -16,19 +16,20 @@ var e = "_root_ovzx7_35", t = "_sm_ovzx7_59", n = "_md_ovzx7_73", r = "_lg_ovzx7
16
16
  controlWrap: p,
17
17
  input: m,
18
18
  control: h,
19
- mark: g,
20
- check: _,
21
- minus: v,
22
- label: y,
23
- description: b,
24
- text: x,
25
- group: S,
26
- groupHeader: C,
27
- groupLabel: w,
28
- options: T,
29
- vertical: E,
30
- horizontal: D,
31
- selectAll: O,
32
- selectAllOptions: k
19
+ markWrap: g,
20
+ mark: _,
21
+ check: v,
22
+ minus: y,
23
+ label: b,
24
+ description: x,
25
+ text: S,
26
+ group: C,
27
+ groupHeader: w,
28
+ groupLabel: T,
29
+ options: E,
30
+ vertical: D,
31
+ horizontal: O,
32
+ selectAll: k,
33
+ selectAllOptions: A
33
34
  };
34
- export { _ as check, h as control, p as controlWrap, A as default, b as description, S as group, C as groupHeader, w as groupLabel, D as horizontal, m as input, y as label, d as labelEnd, f as labelStart, r as lg, g as mark, n as md, v as minus, T as options, e as root, O as selectAll, k as selectAllOptions, t as sm, x as text, o as toneAccent, l as toneDanger, u as toneInfo, a as toneNeutral, i as tonePrimary, s as toneSuccess, c as toneWarning, E as vertical };
35
+ export { v as check, h as control, p as controlWrap, j as default, x as description, C as group, w as groupHeader, T as groupLabel, O as horizontal, m as input, b as label, d as labelEnd, f as labelStart, r as lg, _ as mark, g as markWrap, n as md, y as minus, E as options, e as root, k as selectAll, A as selectAllOptions, t as sm, S as text, o as toneAccent, l as toneDanger, u as toneInfo, a as toneNeutral, i as tonePrimary, s as toneSuccess, c as toneWarning, D as vertical };
@@ -1 +1 @@
1
- "use client";const e=require("../../../hooks/useFloatingPosition.cjs.js"),t=require("../../../hooks/useVirtualizer.cjs.js"),n=require("../../../hooks/useOverlayLayer.cjs.js"),r=require("../../../utils/cx.cjs.js"),i=require("../../feedback/Spinner/Spinner.cjs.js"),a=require("../../primitives/Icon/icons.cjs.js"),o=require("../../utilities/Portal/Portal.cjs.js"),s=require("./comboboxUtils.cjs.js"),c=require("./Combobox.module.css.cjs.js");let l=require("react"),u=require("react/jsx-runtime");var d={sm:c.default.listSm,md:c.default.listMd,lg:c.default.listLg},f=100,p={sm:32,md:40,lg:48},m={x:NaN,y:NaN};function h(e){return(0,u.jsx)(o.Portal,{container:e.container,children:(0,u.jsx)(g,{...e})})}function g({anchorRef:o,positionerRef:h,layer:g,listboxId:_,labelledBy:v,label:y,multiple:b,size:x,placement:S,maxHeight:C,items:w,highlightedIndex:T,isSelected:E,onHighlight:D,onChoose:O,renderOption:k,createLabel:A,loading:j,loadingMessage:M,emptyMessage:N}){let P=(0,l.useRef)(null),[F,I]=(0,l.useState)(`ltr`),[L,R]=(0,l.useState)(void 0);(0,l.useLayoutEffect)(()=>{let e=o.current;if(!e)return;I(getComputedStyle(e).direction===`rtl`?`rtl`:`ltr`);let t=()=>R(e.getBoundingClientRect().width);if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[o]);let z=e.useFloatingPosition(o,h,{open:!0,placement:S,offset:6}),B=z.placement.split(`-`)[0],V=s.groupItems(w),H=w.length>f&&V.every(e=>e.group===void 0),[U,W]=(0,l.useState)(0);(0,l.useLayoutEffect)(()=>{let e=P.current;H&&e&&W(parseFloat(getComputedStyle(e).paddingTop)||0)},[H]);let G=t.useVirtualizer({count:H?w.length:0,scrollElement:P,estimateSize:p[x],paddingStart:U,overscan:8,initialCount:20}),K=T>=0?w[T]?.id:void 0;(0,l.useLayoutEffect)(()=>{if(H){T>=0&&G.scrollToIndex(T);return}let e=P.current;if(!e||!K)return;let t=document.getElementById(K);if(!t||!e.contains(t))return;let n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),i=parseFloat(getComputedStyle(e).paddingTop)||0;r.top<n.top+i?e.scrollTop-=n.top+i-r.top:r.bottom>n.bottom-i&&(e.scrollTop+=r.bottom-(n.bottom-i))},[K,z.isPositioned,H]);let q=(0,l.useMemo)(()=>new Map(w.map((e,t)=>[e.key,t])),[w]),J=!j&&w.length===0&&N!=null&&N!==!1,Y=(e,t,n)=>{if(e.pointerType===`touch`)return;let r=m.x!==e.clientX||m.y!==e.clientY;m.x=e.clientX,m.y=e.clientY,r&&n&&t!==T&&D(t)},X=e=>{let t=q.get(e.key)??-1,n=t===T,i=H?{ref:G.measureElement,"data-index":t,"aria-setsize":w.length,"aria-posinset":t+1}:null;if(e.kind===`create`)return(0,u.jsxs)(`div`,{...i,id:e.id,role:`option`,"aria-selected":!1,"data-highlighted":n||void 0,className:r.cx(c.default.option,c.default.createOption),onPointerMove:e=>Y(e,t,!0),onClick:()=>O(e),children:[(0,u.jsx)(`span`,{className:c.default.indicator,"aria-hidden":`true`,children:(0,u.jsx)(a.PlusIcon,{size:`sm`,strokeWidth:2.5})}),(0,u.jsx)(`span`,{className:c.default.optionText,children:(0,u.jsx)(`span`,{className:c.default.optionLabel,children:A(e.text)})})]},e.key);let{option:o}=e,s=E(o.value),l=!!o.disabled,d=`${e.id}-label`,f=`${e.id}-description`,p=k?.(o,{selected:s,highlighted:n,disabled:l});return(0,u.jsxs)(`div`,{...i,id:e.id,role:`option`,"aria-selected":s,"aria-disabled":l||void 0,"aria-labelledby":p===void 0?d:void 0,"aria-describedby":p===void 0&&o.description?f:void 0,"data-highlighted":n||void 0,"data-selected":s||void 0,"data-disabled":l||void 0,className:c.default.option,onPointerMove:e=>Y(e,t,!l),onClick:()=>{l||O(e)},children:[(0,u.jsx)(`span`,{className:c.default.indicator,"aria-hidden":`true`,children:s&&(0,u.jsx)(a.CheckIcon,{size:`sm`,strokeWidth:3})}),p===void 0?(0,u.jsxs)(u.Fragment,{children:[o.icon!=null&&(0,u.jsx)(`span`,{className:c.default.optionIcon,"aria-hidden":`true`,children:o.icon}),(0,u.jsxs)(`span`,{className:c.default.optionText,children:[(0,u.jsx)(`span`,{id:d,className:c.default.optionLabel,children:o.label}),o.description&&(0,u.jsx)(`span`,{id:f,className:c.default.optionDescription,children:o.description})]})]}):(0,u.jsx)(`span`,{className:c.default.optionText,children:p})]},e.key)},Z=C===void 0?void 0:{"--_max-h":typeof C==`number`?`${C}px`:C},Q=e=>e.preventDefault(),$=()=>{let e=t.withExtraItems(G,T>=0?[T]:[]),n=[],r=U;for(let t of e)t.start-r>.5&&n.push((0,u.jsx)(`div`,{"aria-hidden":`true`,style:{blockSize:t.start-r}},`gap-${t.index}`)),n.push(X(w[t.index])),r=t.end;let i=G.totalSize-r;return i>.5&&n.push((0,u.jsx)(`div`,{"aria-hidden":`true`,style:{blockSize:i}},`gap-end`)),n};return(0,u.jsx)(n.OverlayLayerProvider,{layer:g,children:(0,u.jsx)(`div`,{ref:h,className:c.default.positioner,style:{...z.style,minInlineSize:L},dir:F,children:(0,u.jsxs)(`div`,{ref:P,className:r.cx(c.default.popup,d[x]),style:Z,"data-side":B,"data-state":`open`,onMouseDown:Q,children:[(0,u.jsx)(`div`,{id:_,role:`listbox`,"aria-labelledby":v,"aria-label":v?void 0:y,"aria-multiselectable":b||void 0,"aria-busy":j||void 0,className:c.default.listbox,children:H?$():V.map((e,t)=>e.group===void 0?(0,u.jsx)(l.Fragment,{children:e.items.map(X)},`section-${t}`):(0,u.jsxs)(`div`,{role:`group`,"aria-labelledby":`${_}-group-${t}`,className:c.default.group,children:[(0,u.jsx)(`div`,{id:`${_}-group-${t}`,role:`presentation`,className:c.default.groupLabel,children:e.group}),e.items.map(X)]},`group-${e.group}`))}),j&&(0,u.jsxs)(`div`,{className:c.default.statusRow,children:[(0,u.jsx)(i.Spinner,{decorative:!0,size:x===`lg`?`md`:`sm`,tone:`primary`}),(0,u.jsx)(`span`,{children:M})]}),J&&(0,u.jsx)(`div`,{className:c.default.statusRow,children:N})]})})})}exports.ComboboxPopup=h;
1
+ "use client";const e=require("../../../hooks/useFloatingPosition.cjs.js"),t=require("../../../hooks/useVirtualizer.cjs.js"),n=require("../../../hooks/useOverlayLayer.cjs.js"),r=require("../../../utils/cx.cjs.js"),i=require("../../feedback/Spinner/Spinner.cjs.js"),a=require("../../primitives/Icon/icons.cjs.js"),o=require("../../utilities/Portal/Portal.cjs.js"),s=require("./comboboxUtils.cjs.js"),c=require("./Combobox.module.css.cjs.js");let l=require("react"),u=require("react/jsx-runtime");var d={sm:c.default.listSm,md:c.default.listMd,lg:c.default.listLg},f=100,p={sm:32,md:40,lg:48},m={x:NaN,y:NaN};function h(e){return(0,u.jsx)(o.Portal,{container:e.container,children:(0,u.jsx)(g,{...e})})}function g({anchorRef:o,positionerRef:h,layer:g,listboxId:_,labelledBy:v,label:y,multiple:b,size:x,placement:S,maxHeight:C,items:w,highlightedIndex:T,isSelected:E,onHighlight:D,onChoose:O,renderOption:k,createLabel:A,loading:j,loadingMessage:M,emptyMessage:N}){let P=(0,l.useRef)(null),[F,I]=(0,l.useState)(`ltr`),[L,R]=(0,l.useState)(void 0);(0,l.useLayoutEffect)(()=>{let e=o.current;if(!e)return;I(getComputedStyle(e).direction===`rtl`?`rtl`:`ltr`);let t=()=>R(e.getBoundingClientRect().width);if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[o]);let z=e.useFloatingPosition(o,h,{open:!0,placement:S,offset:6}),B=z.placement.split(`-`)[0],V=s.groupItems(w),H=w.length>f&&V.every(e=>e.group===void 0),[U,W]=(0,l.useState)(0);(0,l.useLayoutEffect)(()=>{let e=P.current;H&&e&&W(parseFloat(getComputedStyle(e).paddingTop)||0)},[H]);let G=t.useVirtualizer({count:H?w.length:0,scrollElement:P,estimateSize:p[x],paddingStart:U,overscan:8,initialCount:20}),K=T>=0?w[T]?.id:void 0;(0,l.useLayoutEffect)(()=>{if(H){T>=0&&G.scrollToIndex(T);return}let e=P.current;if(!e||!K)return;let t=document.getElementById(K);if(!t||!e.contains(t))return;let n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),i=parseFloat(getComputedStyle(e).paddingTop)||0;r.top<n.top+i?e.scrollTop-=n.top+i-r.top:r.bottom>n.bottom-i&&(e.scrollTop+=r.bottom-(n.bottom-i))},[K,z.isPositioned,H]);let q=(0,l.useMemo)(()=>new Map(w.map((e,t)=>[e.key,t])),[w]),J=!j&&w.length===0&&N!=null&&N!==!1,Y=(e,t,n)=>{if(e.pointerType===`touch`)return;let r=m.x!==e.clientX||m.y!==e.clientY;m.x=e.clientX,m.y=e.clientY,r&&n&&t!==T&&D(t)},X=e=>{let t=q.get(e.key)??-1,n=t===T,i=H?{ref:G.measureElement,"data-index":t,"aria-setsize":w.length,"aria-posinset":t+1}:null;if(e.kind===`create`)return(0,u.jsxs)(`div`,{...i,id:e.id,role:`option`,"aria-selected":!1,"data-highlighted":n||void 0,className:r.cx(c.default.option,c.default.createOption),onPointerMove:e=>Y(e,t,!0),onClick:()=>O(e),children:[(0,u.jsx)(`span`,{className:c.default.indicator,"aria-hidden":`true`,children:(0,u.jsx)(a.PlusIcon,{size:`sm`,strokeWidth:2.5})}),(0,u.jsx)(`span`,{className:c.default.optionText,children:(0,u.jsx)(`span`,{className:c.default.optionLabel,children:A(e.text)})})]},e.key);let{option:o}=e,s=E(o.value),l=!!o.disabled,d=`${e.id}-label`,f=`${e.id}-description`,p=k?.(o,{selected:s,highlighted:n,disabled:l});return(0,u.jsxs)(`div`,{...i,id:e.id,role:`option`,"aria-selected":s,"aria-disabled":l||void 0,"aria-labelledby":p===void 0?d:void 0,"aria-describedby":p===void 0&&o.description?f:void 0,"data-highlighted":n||void 0,"data-selected":s||void 0,"data-disabled":l||void 0,className:c.default.option,onPointerMove:e=>Y(e,t,!l),onClick:()=>{l||O(e)},children:[(0,u.jsx)(`span`,{className:c.default.indicator,"aria-hidden":`true`,children:s&&(0,u.jsx)(a.CheckIcon,{size:`sm`,strokeWidth:3})}),p===void 0?(0,u.jsxs)(u.Fragment,{children:[o.icon!=null&&(0,u.jsx)(`span`,{className:c.default.optionIcon,"aria-hidden":`true`,children:o.icon}),(0,u.jsxs)(`span`,{className:c.default.optionText,children:[(0,u.jsx)(`span`,{id:d,className:c.default.optionLabel,children:o.label}),o.description&&` `,o.description&&(0,u.jsx)(`span`,{id:f,className:c.default.optionDescription,children:o.description})]})]}):(0,u.jsx)(`span`,{className:c.default.optionText,children:p})]},e.key)},Z=C===void 0?void 0:{"--_max-h":typeof C==`number`?`${C}px`:C},Q=e=>e.preventDefault(),$=()=>{let e=t.withExtraItems(G,T>=0?[T]:[]),n=[],r=U;for(let t of e)t.start-r>.5&&n.push((0,u.jsx)(`div`,{"aria-hidden":`true`,style:{blockSize:t.start-r}},`gap-${t.index}`)),n.push(X(w[t.index])),r=t.end;let i=G.totalSize-r;return i>.5&&n.push((0,u.jsx)(`div`,{"aria-hidden":`true`,style:{blockSize:i}},`gap-end`)),n};return(0,u.jsx)(n.OverlayLayerProvider,{layer:g,children:(0,u.jsx)(`div`,{ref:h,className:c.default.positioner,style:{...z.style,minInlineSize:L},dir:F,children:(0,u.jsxs)(`div`,{ref:P,className:r.cx(c.default.popup,d[x]),style:Z,"data-side":B,"data-state":`open`,onMouseDown:Q,children:[(0,u.jsx)(`div`,{id:_,role:`listbox`,"aria-labelledby":v,"aria-label":v?void 0:y,"aria-multiselectable":b||void 0,"aria-busy":j||void 0,className:c.default.listbox,children:H?$():V.map((e,t)=>e.group===void 0?(0,u.jsx)(l.Fragment,{children:e.items.map(X)},`section-${t}`):(0,u.jsxs)(`div`,{role:`group`,"aria-labelledby":`${_}-group-${t}`,className:c.default.group,children:[(0,u.jsx)(`div`,{id:`${_}-group-${t}`,role:`presentation`,className:c.default.groupLabel,children:e.group}),e.items.map(X)]},`group-${e.group}`))}),j&&(0,u.jsxs)(`div`,{className:c.default.statusRow,children:[(0,u.jsx)(i.Spinner,{decorative:!0,size:x===`lg`?`md`:`sm`,tone:`primary`}),(0,u.jsx)(`span`,{children:M})]}),J&&(0,u.jsx)(`div`,{className:c.default.statusRow,children:N})]})})})}exports.ComboboxPopup=h;
@@ -142,15 +142,19 @@ function C({ anchorRef: c, positionerRef: S, layer: C, listboxId: w, labelledBy:
142
142
  children: a.icon
143
143
  }), /* @__PURE__ */ _("span", {
144
144
  className: u.optionText,
145
- children: [/* @__PURE__ */ g("span", {
146
- id: d,
147
- className: u.optionLabel,
148
- children: a.label
149
- }), a.description && /* @__PURE__ */ g("span", {
150
- id: f,
151
- className: u.optionDescription,
152
- children: a.description
153
- })]
145
+ children: [
146
+ /* @__PURE__ */ g("span", {
147
+ id: d,
148
+ className: u.optionLabel,
149
+ children: a.label
150
+ }),
151
+ a.description && " ",
152
+ a.description && /* @__PURE__ */ g("span", {
153
+ id: f,
154
+ className: u.optionDescription,
155
+ children: a.description
156
+ })
157
+ ]
154
158
  })] }) : /* @__PURE__ */ g("span", {
155
159
  className: u.optionText,
156
160
  children: p
@@ -1 +1 @@
1
- "use client";const e=require("../../../hooks/useControllableState.cjs.js"),t=require("../../../hooks/useFormReset.cjs.js"),n=require("../../../utils/cx.cjs.js"),r=require("../../primitives/Icon/Icon.cjs.js"),i=require("../Field/FieldContext.cjs.js"),a=require("./Radio.module.css.cjs.js");let o=require("react"),s=require("react/jsx-runtime");var c={sm:a.default.sm,md:a.default.md,lg:a.default.lg},l={neutral:a.default.toneNeutral,primary:a.default.tonePrimary,accent:a.default.toneAccent,success:a.default.toneSuccess,warning:a.default.toneWarning,danger:a.default.toneDanger,info:a.default.toneInfo},u={vertical:a.default.vertical,horizontal:a.default.horizontal},d=(0,o.createContext)(null);function f(){return(0,o.useContext)(d)}var p=(...e)=>e.filter(Boolean).join(` `)||void 0;function m({value:r,defaultValue:l,onValueChange:f,name:m,orientation:h=`vertical`,size:g,tone:_=`primary`,disabled:v,invalid:y,required:b,label:x,description:S,className:C,children:w,id:T,"aria-describedby":E,"aria-labelledby":D,...O}){let k=i.useFieldContext(),A=(0,o.useId)(),j=`${A}-label`,M=`${A}-description`,N=k!==null,P=!N&&x!=null,F=S!=null,I=i.useFieldControl({id:T,invalid:y,required:b,disabled:v,size:g,"aria-describedby":p(F&&M,E)}),[L,R]=e.useControllableState({value:r,defaultValue:l,onChange:f});t.useFormReset(()=>I.id?document.getElementById(I.id):null,()=>R(l),r===void 0);let z=I.size??`md`,B={name:m??`radio-${A}`,value:L,setValue:R,size:z,tone:_,disabled:I.disabled,invalid:I.invalid,required:I.required,inFieldset:!1},V=k?.isGroup===!0&&D===void 0;B.inFieldset=V,B.itemDescribedBy=V?p(F&&M,E):void 0;let H=D??(N?k.labelId:P?j:void 0),U=V?{"aria-describedby":p(F&&M,E)}:{role:`radiogroup`,"aria-labelledby":H,...I.ariaProps,"aria-disabled":I.disabled||void 0,"aria-required":I.required||void 0};return(0,s.jsx)(d.Provider,{value:B,children:(0,s.jsxs)(`div`,{id:I.id,...U,...O,"data-disabled":I.disabled||void 0,"data-invalid":I.invalid||void 0,className:n.cx(a.default.group,c[z],C),children:[(P||F)&&(0,s.jsxs)(`div`,{className:a.default.groupHeader,children:[P&&(0,s.jsxs)(`span`,{id:j,className:a.default.groupLabel,children:[x,I.required&&(0,s.jsxs)(`span`,{className:a.default.requiredMark,"aria-hidden":`true`,children:[` `,`*`]})]}),F&&(0,s.jsx)(`span`,{id:M,className:a.default.groupDescription,children:S})]}),(0,s.jsx)(`div`,{className:n.cx(a.default.items,u[h]),children:w})]})})}function h(e,t){let n=f(),{onChange:r,invalid:i,disabled:a,name:o,checked:s,required:c,...l}=t,u=!!(a||n?.disabled),d=i??n?.invalid??!1;return{inputProps:{...l,type:`radio`,value:e,name:o??n?.name,disabled:u,required:c??n?.required,"aria-invalid":l[`aria-invalid`]??(d&&(!n||n.inFieldset)?!0:void 0),"aria-describedby":p(l[`aria-describedby`],n?.itemDescribedBy),checked:n?n.value===e:s,onChange:t=>{r?.(t),!t.defaultPrevented&&t.target.checked&&n?.setValue(e)}},disabled:u,invalid:d,group:n}}function g({value:e,label:t,description:r,size:i,tone:u,className:d,style:f,id:m,"aria-describedby":g,..._}){let v=(0,o.useId)(),y=m??v,b=`${y}-label`,x=`${y}-description`,S=r!=null,C=t!==void 0&&S&&!_[`aria-label`]&&!_[`aria-labelledby`],{inputProps:w,disabled:T,invalid:E,group:D}=h(e,{..._,"aria-labelledby":C?b:_[`aria-labelledby`],"aria-describedby":p(S&&x,g)}),O=i??D?.size??`md`,k=u??D?.tone??`primary`;return(0,s.jsxs)(`label`,{htmlFor:y,style:f,"data-disabled":T||void 0,"data-invalid":E||void 0,className:n.cx(a.default.radio,c[O],l[k],d),children:[(0,s.jsxs)(`span`,{className:a.default.controlWrap,children:[(0,s.jsx)(`input`,{id:y,className:a.default.input,...w}),(0,s.jsx)(`span`,{className:a.default.control,"aria-hidden":`true`,children:(0,s.jsx)(`span`,{className:a.default.dot})})]}),(t!==void 0||S)&&(0,s.jsxs)(`span`,{className:a.default.text,children:[t!==void 0&&(0,s.jsx)(`span`,{id:b,className:a.default.label,children:t}),S&&(0,s.jsx)(`span`,{id:x,className:a.default.description,children:r})]})]})}function _({value:e,title:t,description:i,icon:c,media:u,meta:d,children:f,tone:m,className:g,style:_,id:v,"aria-describedby":y,"aria-labelledby":b,...x}){let S=(0,o.useId)(),C=v??S,w=`${C}-title`,T=`${C}-description`,E=`${C}-meta`,D=i!=null,O=d!=null,{inputProps:k,disabled:A,invalid:j,group:M}=h(e,{...x,"aria-labelledby":b??w,"aria-describedby":p(D&&T,O&&E,y)}),N=m??M?.tone??`primary`;return(0,s.jsxs)(`label`,{htmlFor:C,style:_,"data-disabled":A||void 0,"data-invalid":j||void 0,className:n.cx(a.default.card,l[N],g),children:[u!=null&&(0,s.jsx)(`span`,{className:a.default.cardMedia,children:u}),(0,s.jsxs)(`span`,{className:a.default.cardHeader,children:[c!=null&&(0,s.jsx)(`span`,{className:a.default.cardIcon,"aria-hidden":`true`,children:c}),(0,s.jsxs)(`span`,{className:a.default.cardHeading,children:[(0,s.jsx)(`span`,{id:w,className:a.default.cardTitle,children:t}),D&&(0,s.jsx)(`span`,{id:T,className:a.default.cardDescription,children:i})]}),(0,s.jsxs)(`span`,{className:a.default.cardIndicator,children:[(0,s.jsx)(`input`,{id:C,className:a.default.input,...k}),(0,s.jsx)(`span`,{className:a.default.cardControl,"aria-hidden":`true`,children:(0,s.jsx)(r.Icon,{name:`check`,size:`sm`,strokeWidth:3,className:a.default.cardCheck})})]})]}),O&&(0,s.jsx)(`span`,{id:E,className:a.default.cardMeta,children:d}),f!=null&&(0,s.jsx)(`span`,{className:a.default.cardBody,children:f})]})}exports.Radio=g,exports.RadioCard=_,exports.RadioGroup=m,exports.useRadioGroupContext=f;
1
+ "use client";const e=require("../../../hooks/useControllableState.cjs.js"),t=require("../../../hooks/useFormReset.cjs.js"),n=require("../../../utils/cx.cjs.js"),r=require("../../primitives/Icon/Icon.cjs.js"),i=require("../Field/FieldContext.cjs.js"),a=require("./Radio.module.css.cjs.js");let o=require("react"),s=require("react/jsx-runtime");var c={sm:a.default.sm,md:a.default.md,lg:a.default.lg},l={neutral:a.default.toneNeutral,primary:a.default.tonePrimary,accent:a.default.toneAccent,success:a.default.toneSuccess,warning:a.default.toneWarning,danger:a.default.toneDanger,info:a.default.toneInfo},u={vertical:a.default.vertical,horizontal:a.default.horizontal},d=(0,o.createContext)(null);function f(){return(0,o.useContext)(d)}var p=(...e)=>e.filter(Boolean).join(` `)||void 0;function m({value:r,defaultValue:l,onValueChange:f,name:m,orientation:h=`vertical`,size:g,tone:_=`primary`,disabled:v,invalid:y,required:b,label:x,description:S,className:C,children:w,id:T,"aria-describedby":E,"aria-labelledby":D,...O}){let k=i.useFieldContext(),A=(0,o.useId)(),j=`${A}-label`,M=`${A}-description`,N=k!==null,P=!N&&x!=null,F=S!=null,I=i.useFieldControl({id:T,invalid:y,required:b,disabled:v,size:g,"aria-describedby":p(F&&M,E)}),[L,R]=e.useControllableState({value:r,defaultValue:l,onChange:f});t.useFormReset(()=>I.id?document.getElementById(I.id):null,()=>R(l),r===void 0);let z=I.size??`md`,B={name:m??`radio-${A}`,value:L,setValue:R,size:z,tone:_,disabled:I.disabled,invalid:I.invalid,required:I.required,inFieldset:!1},V=k?.isGroup===!0&&D===void 0;B.inFieldset=V,B.itemDescribedBy=V?p(F&&M,E):void 0;let H=D??(N?k.labelId:P?j:void 0),U=V?{"aria-describedby":p(F&&M,E)}:{role:`radiogroup`,"aria-labelledby":H,...I.ariaProps,"aria-disabled":I.disabled||void 0,"aria-required":I.required||void 0};return(0,s.jsx)(d.Provider,{value:B,children:(0,s.jsxs)(`div`,{id:I.id,...U,...O,"data-disabled":I.disabled||void 0,"data-invalid":I.invalid||void 0,className:n.cx(a.default.group,c[z],C),children:[(P||F)&&(0,s.jsxs)(`div`,{className:a.default.groupHeader,children:[P&&(0,s.jsxs)(`div`,{id:j,className:a.default.groupLabel,children:[x,I.required&&(0,s.jsxs)(`span`,{className:a.default.requiredMark,"aria-hidden":`true`,children:[` `,`*`]})]}),F&&(0,s.jsx)(`div`,{id:M,className:a.default.groupDescription,children:S})]}),(0,s.jsx)(`div`,{className:n.cx(a.default.items,u[h]),children:w})]})})}function h(e,t){let n=f(),{onChange:r,invalid:i,disabled:a,name:o,checked:s,required:c,...l}=t,u=!!(a||n?.disabled),d=i??n?.invalid??!1;return{inputProps:{...l,type:`radio`,value:e,name:o??n?.name,disabled:u,required:c??n?.required,"aria-invalid":l[`aria-invalid`]??(d&&(!n||n.inFieldset)?!0:void 0),"aria-describedby":p(l[`aria-describedby`],n?.itemDescribedBy),checked:n?n.value===e:s,onChange:t=>{r?.(t),!t.defaultPrevented&&t.target.checked&&n?.setValue(e)}},disabled:u,invalid:d,group:n}}function g({value:e,label:t,description:r,size:i,tone:u,className:d,style:f,id:m,"aria-describedby":g,..._}){let v=(0,o.useId)(),y=m??v,b=`${y}-label`,x=`${y}-description`,S=r!=null,C=t!==void 0&&S&&!_[`aria-label`]&&!_[`aria-labelledby`],{inputProps:w,disabled:T,invalid:E,group:D}=h(e,{..._,"aria-labelledby":C?b:_[`aria-labelledby`],"aria-describedby":p(S&&x,g)}),O=i??D?.size??`md`,k=u??D?.tone??`primary`;return(0,s.jsxs)(`label`,{htmlFor:y,style:f,"data-disabled":T||void 0,"data-invalid":E||void 0,className:n.cx(a.default.radio,c[O],l[k],d),children:[(0,s.jsxs)(`span`,{className:a.default.controlWrap,children:[(0,s.jsx)(`input`,{id:y,className:a.default.input,...w}),(0,s.jsx)(`span`,{className:a.default.control,"aria-hidden":`true`,children:(0,s.jsx)(`span`,{className:a.default.dot})})]}),(t!==void 0||S)&&(0,s.jsxs)(`span`,{className:a.default.text,children:[t!==void 0&&(0,s.jsx)(`span`,{id:b,className:a.default.label,children:t}),S&&` `,S&&(0,s.jsx)(`span`,{id:x,className:a.default.description,children:r})]})]})}function _({value:e,title:t,description:i,icon:c,media:u,meta:d,children:f,tone:m,className:g,style:_,id:v,"aria-describedby":y,"aria-labelledby":b,...x}){let S=(0,o.useId)(),C=v??S,w=`${C}-title`,T=`${C}-description`,E=`${C}-meta`,D=i!=null,O=d!=null,{inputProps:k,disabled:A,invalid:j,group:M}=h(e,{...x,"aria-labelledby":b??w,"aria-describedby":p(D&&T,O&&E,y)}),N=m??M?.tone??`primary`;return(0,s.jsxs)(`label`,{htmlFor:C,style:_,"data-disabled":A||void 0,"data-invalid":j||void 0,className:n.cx(a.default.card,l[N],g),children:[u!=null&&(0,s.jsx)(`span`,{className:a.default.cardMedia,children:u}),(0,s.jsxs)(`span`,{className:a.default.cardHeader,children:[c!=null&&(0,s.jsx)(`span`,{className:a.default.cardIcon,"aria-hidden":`true`,children:c}),(0,s.jsxs)(`span`,{className:a.default.cardHeading,children:[(0,s.jsx)(`span`,{id:w,className:a.default.cardTitle,children:t}),D&&` `,D&&(0,s.jsx)(`span`,{id:T,className:a.default.cardDescription,children:i})]}),(0,s.jsxs)(`span`,{className:a.default.cardIndicator,children:[(0,s.jsx)(`input`,{id:C,className:a.default.input,...k}),(0,s.jsx)(`span`,{className:a.default.cardControl,"aria-hidden":`true`,children:(0,s.jsx)(r.Icon,{name:`check`,size:`sm`,strokeWidth:3,className:a.default.cardCheck})})]})]}),O&&(0,s.jsx)(`span`,{id:E,className:a.default.cardMeta,children:d}),f!=null&&(0,s.jsx)(`span`,{className:a.default.cardBody,children:f})]})}exports.Radio=g,exports.RadioCard=_,exports.RadioGroup=m,exports.useRadioGroupContext=f;
@@ -72,7 +72,7 @@ function v({ value: r, defaultValue: s, onValueChange: c, name: p, orientation:
72
72
  className: n(o.group, f[V], T),
73
73
  children: [(I || L) && /* @__PURE__ */ d("div", {
74
74
  className: o.groupHeader,
75
- children: [I && /* @__PURE__ */ d("span", {
75
+ children: [I && /* @__PURE__ */ d("div", {
76
76
  id: N,
77
77
  className: o.groupLabel,
78
78
  children: [C, R.required && /* @__PURE__ */ d("span", {
@@ -80,7 +80,7 @@ function v({ value: r, defaultValue: s, onValueChange: c, name: p, orientation:
80
80
  "aria-hidden": "true",
81
81
  children: [" ", "*"]
82
82
  })]
83
- }), L && /* @__PURE__ */ u("span", {
83
+ }), L && /* @__PURE__ */ u("div", {
84
84
  id: P,
85
85
  className: o.groupDescription,
86
86
  children: w
@@ -139,15 +139,19 @@ function b({ value: e, label: t, description: r, size: i, tone: a, className: s,
139
139
  })]
140
140
  }), (t !== void 0 || C) && /* @__PURE__ */ d("span", {
141
141
  className: o.text,
142
- children: [t !== void 0 && /* @__PURE__ */ u("span", {
143
- id: x,
144
- className: o.label,
145
- children: t
146
- }), C && /* @__PURE__ */ u("span", {
147
- id: S,
148
- className: o.description,
149
- children: r
150
- })]
142
+ children: [
143
+ t !== void 0 && /* @__PURE__ */ u("span", {
144
+ id: x,
145
+ className: o.label,
146
+ children: t
147
+ }),
148
+ C && " ",
149
+ C && /* @__PURE__ */ u("span", {
150
+ id: S,
151
+ className: o.description,
152
+ children: r
153
+ })
154
+ ]
151
155
  })]
152
156
  });
153
157
  }
@@ -178,15 +182,19 @@ function x({ value: e, title: t, description: i, icon: a, media: s, meta: c, chi
178
182
  }),
179
183
  /* @__PURE__ */ d("span", {
180
184
  className: o.cardHeading,
181
- children: [/* @__PURE__ */ u("span", {
182
- id: T,
183
- className: o.cardTitle,
184
- children: t
185
- }), O && /* @__PURE__ */ u("span", {
186
- id: E,
187
- className: o.cardDescription,
188
- children: i
189
- })]
185
+ children: [
186
+ /* @__PURE__ */ u("span", {
187
+ id: T,
188
+ className: o.cardTitle,
189
+ children: t
190
+ }),
191
+ O && " ",
192
+ O && /* @__PURE__ */ u("span", {
193
+ id: E,
194
+ className: o.cardDescription,
195
+ children: i
196
+ })
197
+ ]
190
198
  }),
191
199
  /* @__PURE__ */ d("span", {
192
200
  className: o.cardIndicator,
@@ -1 +1 @@
1
- "use client";const e=require("../../../hooks/useControllableState.cjs.js"),t=require("../../../hooks/useFormReset.cjs.js"),n=require("../../../utils/cx.cjs.js"),r=require("../../../utils/intl.cjs.js"),i=require("../../primitives/Icon/icons.cjs.js"),ee=require("../../utilities/VisuallyHidden/VisuallyHidden.cjs.js"),a=require("../Field/FieldContext.cjs.js"),o=require("./Rating.module.css.cjs.js"),s=require("../../utilities/LocaleProvider/LocaleProvider.cjs.js"),c=require("../../../i18n/en.cjs.js");let l=require("react"),u=require("react/jsx-runtime");var d={sm:o.default.sm,md:o.default.md,lg:o.default.lg},f={sm:o.default.displaySm,md:o.default.displayMd,lg:o.default.displayLg},te={neutral:o.default.toneNeutral,primary:o.default.tonePrimary,accent:o.default.toneAccent,success:o.default.toneSuccess,warning:o.default.toneWarning,danger:o.default.toneDanger,info:o.default.toneInfo},p=(...e)=>e.filter(Boolean).join(` `)||void 0,m=(e,t,n)=>Math.min(n,Math.max(t,e));function h(e,t){let n=Math.round(e*10)/10,i=+!Number.isInteger(n);return r.getNumberFormat(t,{minimumFractionDigits:i,maximumFractionDigits:i}).format(n)}var g=(e,t)=>c.en.rating.option(h(e,`en`),t),_=(e,t)=>c.en.rating.display(h(e,`en`),t),v=e=>c.en.rating.count(e);function y({fill:e,icon:t,emptyIcon:n}){let r=`${Math.round(m(e,0,1)*1e3)/10}%`;return(0,u.jsxs)(`span`,{className:o.default.icon,"aria-hidden":`true`,"data-fill":e>=1?`full`:e>0?`partial`:`empty`,style:{"--rating-fill":r},children:[(0,u.jsx)(`span`,{className:o.default.empty,children:n}),(0,u.jsx)(`span`,{className:o.default.filled,children:t})]})}var b=(0,u.jsx)(i.StarFilledIcon,{}),x=(0,u.jsx)(i.StarIcon,{});function S({value:e,max:t=5,size:r,tone:i=`warning`,icon:ee=b,emptyIcon:c=x,showValue:l=!1,count:d,formatCount:p,getLabel:g,className:_,"aria-label":v,...S}){let{messages:C,locale:w}=s.useLocale(),T=p??C.rating.count,E=g??((e,t)=>C.rating.display(h(e,w),t)),D=a.useFieldContext(),O=r??D?.size??`md`,k=Math.max(1,Math.round(t)),A=m(Number.isFinite(e)?e:0,0,k);return(0,u.jsxs)(`span`,{...S,className:n.cx(o.default.display,f[O],te[i],_),children:[(0,u.jsx)(`span`,{role:`img`,"aria-label":v??E(A,k),className:o.default.icons,children:Array.from({length:k},(e,t)=>(0,u.jsx)(`span`,{className:o.default.displayCell,children:(0,u.jsx)(y,{fill:A-t,icon:ee,emptyIcon:c})},t))}),l&&(0,u.jsxs)(`span`,{className:o.default.valueText,"aria-hidden":`true`,children:[h(A,w),` / `,k]}),d!==void 0&&(0,u.jsx)(`span`,{className:o.default.count,children:T(d)})]})}function C({value:r,defaultValue:i=null,onValueChange:c,max:f=5,precision:g=1,allowZero:_=!1,allowClear:v=!1,clearHint:C,hoverPreview:w=!0,size:T,tone:E=`warning`,icon:D=b,emptyIcon:O=x,showValue:k=!1,disabled:A,readOnly:ne,invalid:re,required:ie,name:j,getLabel:ae,getReadOnlyLabel:oe,unratedLabel:se,label:ce,description:le,className:ue,id:de,onKeyDown:fe,onPointerLeave:pe,"aria-describedby":M,"aria-labelledby":N,...me}){let{messages:P,locale:F}=s.useLocale(),he=C??P.rating.clearHint,ge=ae??((e,t)=>P.rating.option(h(e,F),t)),_e=oe??((e,t)=>P.rating.display(h(e,F),t)),ve=se??P.rating.unrated,I=a.useFieldContext(),L=(0,l.useId)(),R=`${L}-label`,z=`${L}-description`,B=`${L}-clear`,ye=I!==null,V=!ye&&ce!=null,H=le!=null,U=a.useFieldControl({id:de,invalid:re,required:ie,disabled:A,readOnly:ne,size:T,"aria-describedby":p(H&&z,M)}),[W,G]=e.useControllableState({value:r,defaultValue:i,onChange:c});t.useFormReset(()=>U.id?document.getElementById(U.id):null,()=>G(i??null),r===void 0);let[K,be]=(0,l.useState)(null),xe=U.size??`md`,q=Math.max(1,Math.round(f)),J=g===.5?.5:1,Se=j??`rating-${L}`,Ce=!U.disabled&&!U.readOnly,Y=v&&Ce,X=W===null||!Number.isFinite(W)?null:W<J/2?_?0:null:m(Math.round(W/J)*J,J,q),Z=w&&Ce&&K!==null,we=Z?K:X??0,Q=I?.isGroup===!0&&N===void 0,Te=N??(ye?I.labelId:V?R:void 0),Ee=U.readOnly?`group`:`radiogroup`,De=Q?{"aria-describedby":p(H&&z,M)}:{role:Ee,"aria-labelledby":Te,...U.ariaProps,"aria-disabled":U.disabled||void 0,"aria-required":U.required&&!U.readOnly||void 0},Oe=e=>{fe?.(e),!e.defaultPrevented&&Y&&(e.key===`Delete`||e.key===`Backspace`)&&e.target instanceof HTMLInputElement&&(e.preventDefault(),G(null))},ke=e=>{pe?.(e),be(null)},Ae=[];for(let e=J;e<=q+1e-9;e+=J)Ae.push(Math.round(e*10)/10);let $=(e,t)=>{let r=X===e;return(0,u.jsxs)(`span`,{className:n.cx(o.default.hit,o.default[t]),children:[(0,u.jsx)(`input`,{type:`radio`,className:o.default.input,name:Se,value:String(e),checked:r,disabled:U.disabled,required:U.required,"aria-label":ge(e,q),"aria-describedby":Y?B:void 0,"aria-invalid":Q&&U.invalid?!0:void 0,onChange:t=>{t.target.checked&&G(e)},onClick:e=>{Y&&r&&G(null)},onPointerEnter:t=>{w&&t.pointerType!==`touch`&&be(e)}}),(0,u.jsx)(`span`,{className:o.default.focusBox,"aria-hidden":`true`})]},e)},je=Z&&K!==null?Math.ceil(K)-1:-1;return(0,u.jsxs)(`div`,{id:U.id,...De,...me,"data-disabled":U.disabled||void 0,"data-invalid":U.invalid||void 0,"data-readonly":U.readOnly||void 0,"data-precision":J===.5?`half`:`whole`,"data-previewing":Z||void 0,className:n.cx(o.default.rating,d[xe],te[E],ue),onKeyDown:Oe,onPointerLeave:ke,children:[(V||H)&&(0,u.jsxs)(`div`,{className:o.default.header,children:[V&&(0,u.jsxs)(`span`,{id:R,className:o.default.label,children:[ce,U.required&&!U.readOnly&&(0,u.jsxs)(`span`,{className:o.default.requiredMark,"aria-hidden":`true`,children:[` `,`*`]})]}),H&&(0,u.jsx)(`span`,{id:z,className:o.default.description,children:le})]}),(0,u.jsxs)(`div`,{className:o.default.row,children:[U.readOnly?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(S,{value:X??0,max:q,size:xe,tone:E,icon:D,emptyIcon:O,getLabel:_e,"aria-label":X===null?ve:void 0}),j!==void 0&&X!==null&&(0,u.jsx)(`input`,{type:`hidden`,name:j,value:String(X)})]}):(0,u.jsxs)(`div`,{className:o.default.icons,children:[_&&(0,u.jsxs)(`span`,{className:n.cx(o.default.cell,o.default.zeroCell),"data-hovered":Z&&K===0?!0:void 0,children:[(0,u.jsx)(`span`,{className:o.default.zeroMark,"aria-hidden":`true`,children:`0`}),$(0,`whole`)]}),Array.from({length:q},(e,t)=>(0,u.jsxs)(`span`,{className:o.default.cell,"data-hovered":t===je||void 0,children:[(0,u.jsx)(y,{fill:we-t,icon:D,emptyIcon:O}),J===.5?[$(t+.5,`start`),$(t+1,`end`)]:$(t+1,`whole`)]},t))]}),k&&(0,u.jsxs)(`span`,{className:o.default.valueText,"aria-hidden":`true`,children:[X===null?`–`:h(X,F),` / `,q]})]}),Y&&(0,u.jsx)(ee.VisuallyHidden,{id:B,children:he})]})}exports.Rating=C,exports.RatingDisplay=S,exports.defaultRatingCountText=v,exports.defaultRatingDisplayLabel=_,exports.defaultRatingOptionLabel=g,exports.formatRatingValue=h;
1
+ "use client";const e=require("../../../hooks/useControllableState.cjs.js"),t=require("../../../hooks/useFormReset.cjs.js"),n=require("../../../utils/cx.cjs.js"),r=require("../../../utils/intl.cjs.js"),i=require("../../primitives/Icon/icons.cjs.js"),ee=require("../../utilities/VisuallyHidden/VisuallyHidden.cjs.js"),a=require("../Field/FieldContext.cjs.js"),o=require("./Rating.module.css.cjs.js"),s=require("../../utilities/LocaleProvider/LocaleProvider.cjs.js"),c=require("../../../i18n/en.cjs.js");let l=require("react"),u=require("react/jsx-runtime");var d={sm:o.default.sm,md:o.default.md,lg:o.default.lg},f={sm:o.default.displaySm,md:o.default.displayMd,lg:o.default.displayLg},te={neutral:o.default.toneNeutral,primary:o.default.tonePrimary,accent:o.default.toneAccent,success:o.default.toneSuccess,warning:o.default.toneWarning,danger:o.default.toneDanger,info:o.default.toneInfo},p=(...e)=>e.filter(Boolean).join(` `)||void 0,m=(e,t,n)=>Math.min(n,Math.max(t,e));function h(e,t){let n=Math.round(e*10)/10,i=+!Number.isInteger(n);return r.getNumberFormat(t,{minimumFractionDigits:i,maximumFractionDigits:i}).format(n)}var g=(e,t)=>c.en.rating.option(h(e,`en`),t),_=(e,t)=>c.en.rating.display(h(e,`en`),t),v=e=>c.en.rating.count(e);function y({fill:e,icon:t,emptyIcon:n}){let r=`${Math.round(m(e,0,1)*1e3)/10}%`;return(0,u.jsxs)(`span`,{className:o.default.icon,"aria-hidden":`true`,"data-fill":e>=1?`full`:e>0?`partial`:`empty`,style:{"--rating-fill":r},children:[(0,u.jsx)(`span`,{className:o.default.empty,children:n}),(0,u.jsx)(`span`,{className:o.default.filled,children:t})]})}var b=(0,u.jsx)(i.StarFilledIcon,{}),x=(0,u.jsx)(i.StarIcon,{});function S({value:e,max:t=5,size:r,tone:i=`warning`,icon:ee=b,emptyIcon:c=x,showValue:l=!1,count:d,formatCount:p,getLabel:g,className:_,"aria-label":v,...S}){let{messages:C,locale:w}=s.useLocale(),T=p??C.rating.count,E=g??((e,t)=>C.rating.display(h(e,w),t)),D=a.useFieldContext(),O=r??D?.size??`md`,k=Math.max(1,Math.round(t)),A=m(Number.isFinite(e)?e:0,0,k);return(0,u.jsxs)(`span`,{...S,className:n.cx(o.default.display,f[O],te[i],_),children:[(0,u.jsx)(`span`,{role:`img`,"aria-label":v??E(A,k),className:o.default.icons,children:Array.from({length:k},(e,t)=>(0,u.jsx)(`span`,{className:o.default.displayCell,children:(0,u.jsx)(y,{fill:A-t,icon:ee,emptyIcon:c})},t))}),l&&(0,u.jsxs)(`span`,{className:o.default.valueText,"aria-hidden":`true`,children:[h(A,w),` / `,k]}),d!==void 0&&(0,u.jsx)(`span`,{className:o.default.count,children:T(d)})]})}function C({value:r,defaultValue:i=null,onValueChange:c,max:f=5,precision:g=1,allowZero:_=!1,allowClear:v=!1,clearHint:C,hoverPreview:w=!0,size:T,tone:E=`warning`,icon:D=b,emptyIcon:O=x,showValue:k=!1,disabled:A,readOnly:ne,invalid:re,required:ie,name:j,getLabel:ae,getReadOnlyLabel:oe,unratedLabel:se,label:ce,description:le,className:ue,id:de,onKeyDown:fe,onPointerLeave:pe,"aria-describedby":M,"aria-labelledby":N,...me}){let{messages:P,locale:F}=s.useLocale(),he=C??P.rating.clearHint,ge=ae??((e,t)=>P.rating.option(h(e,F),t)),_e=oe??((e,t)=>P.rating.display(h(e,F),t)),ve=se??P.rating.unrated,I=a.useFieldContext(),L=(0,l.useId)(),R=`${L}-label`,z=`${L}-description`,B=`${L}-clear`,ye=I!==null,V=!ye&&ce!=null,H=le!=null,U=a.useFieldControl({id:de,invalid:re,required:ie,disabled:A,readOnly:ne,size:T,"aria-describedby":p(H&&z,M)}),[W,G]=e.useControllableState({value:r,defaultValue:i,onChange:c});t.useFormReset(()=>U.id?document.getElementById(U.id):null,()=>G(i??null),r===void 0);let[K,be]=(0,l.useState)(null),xe=U.size??`md`,q=Math.max(1,Math.round(f)),J=g===.5?.5:1,Se=j??`rating-${L}`,Ce=!U.disabled&&!U.readOnly,Y=v&&Ce,X=W===null||!Number.isFinite(W)?null:W<J/2?_?0:null:m(Math.round(W/J)*J,J,q),Z=w&&Ce&&K!==null,we=Z?K:X??0,Q=I?.isGroup===!0&&N===void 0,Te=N??(ye?I.labelId:V?R:void 0),Ee=U.readOnly?`group`:`radiogroup`,De=Q?{"aria-describedby":p(H&&z,M)}:{role:Ee,"aria-labelledby":Te,...U.ariaProps,"aria-disabled":U.disabled||void 0,"aria-required":U.required&&!U.readOnly||void 0},Oe=e=>{fe?.(e),!e.defaultPrevented&&Y&&(e.key===`Delete`||e.key===`Backspace`)&&e.target instanceof HTMLInputElement&&(e.preventDefault(),G(null))},ke=e=>{pe?.(e),be(null)},Ae=[];for(let e=J;e<=q+1e-9;e+=J)Ae.push(Math.round(e*10)/10);let $=(e,t)=>{let r=X===e;return(0,u.jsxs)(`span`,{className:n.cx(o.default.hit,o.default[t]),children:[(0,u.jsx)(`input`,{type:`radio`,className:o.default.input,name:Se,value:String(e),checked:r,disabled:U.disabled,required:U.required,"aria-label":ge(e,q),"aria-describedby":Y?B:void 0,"aria-invalid":Q&&U.invalid?!0:void 0,onChange:t=>{t.target.checked&&G(e)},onClick:e=>{Y&&r&&G(null)},onPointerEnter:t=>{w&&t.pointerType!==`touch`&&be(e)}}),(0,u.jsx)(`span`,{className:o.default.focusBox,"aria-hidden":`true`})]},e)},je=Z&&K!==null?Math.ceil(K)-1:-1;return(0,u.jsxs)(`div`,{id:U.id,...De,...me,"data-disabled":U.disabled||void 0,"data-invalid":U.invalid||void 0,"data-readonly":U.readOnly||void 0,"data-precision":J===.5?`half`:`whole`,"data-previewing":Z||void 0,className:n.cx(o.default.rating,d[xe],te[E],ue),onKeyDown:Oe,onPointerLeave:ke,children:[(V||H)&&(0,u.jsxs)(`div`,{className:o.default.header,children:[V&&(0,u.jsxs)(`div`,{id:R,className:o.default.label,children:[ce,U.required&&!U.readOnly&&(0,u.jsxs)(`span`,{className:o.default.requiredMark,"aria-hidden":`true`,children:[` `,`*`]})]}),H&&(0,u.jsx)(`div`,{id:z,className:o.default.description,children:le})]}),(0,u.jsxs)(`div`,{className:o.default.row,children:[U.readOnly?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(S,{value:X??0,max:q,size:xe,tone:E,icon:D,emptyIcon:O,getLabel:_e,"aria-label":X===null?ve:void 0}),j!==void 0&&X!==null&&(0,u.jsx)(`input`,{type:`hidden`,name:j,value:String(X)})]}):(0,u.jsxs)(`div`,{className:o.default.icons,children:[_&&(0,u.jsxs)(`span`,{className:n.cx(o.default.cell,o.default.zeroCell),"data-hovered":Z&&K===0?!0:void 0,children:[(0,u.jsx)(`span`,{className:o.default.zeroMark,"aria-hidden":`true`,children:`0`}),$(0,`whole`)]}),Array.from({length:q},(e,t)=>(0,u.jsxs)(`span`,{className:o.default.cell,"data-hovered":t===je||void 0,children:[(0,u.jsx)(y,{fill:we-t,icon:D,emptyIcon:O}),J===.5?[$(t+.5,`start`),$(t+1,`end`)]:$(t+1,`whole`)]},t))]}),k&&(0,u.jsxs)(`span`,{className:o.default.valueText,"aria-hidden":`true`,children:[X===null?`–`:h(X,F),` / `,q]})]}),Y&&(0,u.jsx)(ee.VisuallyHidden,{id:B,children:he})]})}exports.Rating=C,exports.RatingDisplay=S,exports.defaultRatingCountText=v,exports.defaultRatingDisplayLabel=_,exports.defaultRatingOptionLabel=g,exports.formatRatingValue=h;
@@ -161,7 +161,7 @@ function T({ value: r, defaultValue: i = null, onValueChange: a, max: u = 5, pre
161
161
  children: [
162
162
  (V || H) && /* @__PURE__ */ h("div", {
163
163
  className: c.header,
164
- children: [V && /* @__PURE__ */ h("span", {
164
+ children: [V && /* @__PURE__ */ h("div", {
165
165
  id: L,
166
166
  className: c.label,
167
167
  children: [k, U.required && !U.readOnly && /* @__PURE__ */ h("span", {
@@ -169,7 +169,7 @@ function T({ value: r, defaultValue: i = null, onValueChange: a, max: u = 5, pre
169
169
  "aria-hidden": "true",
170
170
  children: [" ", "*"]
171
171
  })]
172
- }), H && /* @__PURE__ */ m("span", {
172
+ }), H && /* @__PURE__ */ m("div", {
173
173
  id: R,
174
174
  className: c.description,
175
175
  children: A
@@ -1 +1 @@
1
- "use client";const e=require("../../../hooks/useControllableState.cjs.js"),t=require("../../../hooks/useFormReset.cjs.js"),n=require("../../../utils/cx.cjs.js"),r=require("../../primitives/Icon/icons.cjs.js"),i=require("../../utilities/LocaleProvider/LocaleProvider.cjs.js"),a=require("../../utilities/VisuallyHidden/VisuallyHidden.cjs.js"),o=require("../Field/FieldContext.cjs.js"),s=require("../Rating/Rating.cjs.js"),c=require("./RatingScale.module.css.cjs.js");let l=require("react"),u=require("react/jsx-runtime");var ee={sm:c.default.sm,md:c.default.md,lg:c.default.lg},te={faces:c.default.faces,numbers:c.default.numbers,thumbs:c.default.thumbs},d=[(0,u.jsx)(r.FaceVerySadIcon,{},`1`),(0,u.jsx)(r.FaceSadIcon,{},`2`),(0,u.jsx)(r.FaceNeutralIcon,{},`3`),(0,u.jsx)(r.FaceHappyIcon,{},`4`),(0,u.jsx)(r.FaceVeryHappyIcon,{},`5`)],ne=[`danger`,`warning`,`neutral`,`info`,`success`],f=(...e)=>e.filter(Boolean).join(` `)||void 0;function p(e,t,{min:n=1,max:i=5,locale:a}={}){if(e===`faces`)return t.ratingScale.faces.map((e,t)=>({value:t+1,label:e,icon:d[t]}));if(e===`thumbs`)return[{value:1,label:t.ratingScale.thumbsUp,icon:(0,u.jsx)(r.ThumbsUpIcon,{})},{value:0,label:t.ratingScale.thumbsDown,icon:(0,u.jsx)(r.ThumbsDownIcon,{})}];let o=Math.round(Math.min(n,i)),c=Math.round(Math.max(n,i)),l=[];for(let e=o;e<=c;e++)l.push({value:e,label:t.rating.option(s.formatRatingValue(e,a),c),icon:s.formatRatingValue(e,a)});return l}function m({variant:r=`numbers`,value:d,defaultValue:m=null,onValueChange:re,min:h=1,max:g=5,options:_,startLabel:v,endLabel:y,showLabels:ie=!1,sentiment:ae=!1,size:oe,allowClear:b=!1,clearHint:se,disabled:x,readOnly:ce,invalid:S,required:le,name:C,getReadOnlyLabel:w,unratedLabel:T,label:E,description:D,className:ue,id:de,onKeyDown:fe,"aria-describedby":O,"aria-labelledby":k,...pe}){let{messages:A,locale:j}=i.useLocale(),M=se??A.rating.clearHint,N=w??(e=>A.ratingScale.display(e.label)),P=T??A.rating.unrated,F=o.useFieldContext(),I=(0,l.useId)(),L=`${I}-label`,R=`${I}-description`,z=`${I}-anchors`,B=`${I}-clear`,V=F!==null,H=!V&&E!=null,U=D!=null,W=v!=null||y!=null,G=o.useFieldControl({id:de,invalid:S,required:le,disabled:x,readOnly:ce,size:oe,"aria-describedby":f(U&&R,W&&z,O)}),[K,q]=e.useControllableState({value:d,defaultValue:m,onChange:re});t.useFormReset(()=>G.id?document.getElementById(G.id):null,()=>q(m??null),d===void 0);let me=G.size??`md`,J=_??p(r,A,{min:h,max:g,locale:j}),he=C??`rating-scale-${I}`,ge=!G.disabled&&!G.readOnly,Y=b&&ge,X=K===null?void 0:J.find(e=>e.value===K),Z=F?.isGroup===!0&&k===void 0,_e=k??(V?F.labelId:H?L:void 0),ve=Z?{"aria-describedby":f(U&&R,W&&z,O)}:{role:G.readOnly?`group`:`radiogroup`,"aria-labelledby":_e,...G.ariaProps,"aria-disabled":G.disabled||void 0,"aria-required":G.required&&!G.readOnly||void 0},ye=e=>{fe?.(e),!e.defaultPrevented&&Y&&(e.key===`Delete`||e.key===`Backspace`)&&e.target instanceof HTMLInputElement&&(e.preventDefault(),q(null))},Q=e=>n.cx(c.default.option,ae&&r===`faces`&&c.default[ne[e]??`neutral`]),$=e=>(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(`span`,{className:c.default.visual,"aria-hidden":`true`,children:e.icon??s.formatRatingValue(e.value,j)}),ie&&r!==`numbers`&&(0,u.jsx)(`span`,{className:c.default.caption,"aria-hidden":`true`,children:e.label})]});return(0,u.jsxs)(`div`,{id:G.id,...ve,...pe,"data-disabled":G.disabled||void 0,"data-invalid":G.invalid||void 0,"data-readonly":G.readOnly||void 0,className:n.cx(c.default.scale,ee[me],te[r],ue),onKeyDown:ye,children:[(H||U)&&(0,u.jsxs)(`div`,{className:c.default.header,children:[H&&(0,u.jsxs)(`span`,{id:L,className:c.default.label,children:[E,G.required&&!G.readOnly&&(0,u.jsxs)(`span`,{className:c.default.requiredMark,"aria-hidden":`true`,children:[` `,`*`]})]}),U&&(0,u.jsx)(`span`,{id:R,className:c.default.description,children:D})]}),(0,u.jsxs)(`div`,{className:c.default.body,children:[G.readOnly?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(`div`,{role:`img`,"aria-label":X?N(X):P,className:c.default.options,children:J.map((e,t)=>(0,u.jsx)(`span`,{className:Q(t),"data-checked":e===X||void 0,children:$(e)},e.value))}),C!==void 0&&X&&(0,u.jsx)(`input`,{type:`hidden`,name:C,value:String(X.value)})]}):(0,u.jsx)(`div`,{className:c.default.options,children:J.map((e,t)=>{let n=e===X;return(0,u.jsxs)(`label`,{className:Q(t),"data-checked":n||void 0,children:[(0,u.jsx)(`input`,{type:`radio`,className:c.default.input,name:he,value:String(e.value),checked:n,disabled:G.disabled,required:G.required,"aria-label":e.label,"aria-describedby":Y?B:void 0,"aria-invalid":Z&&G.invalid?!0:void 0,onChange:t=>{t.target.checked&&q(e.value)},onClick:()=>{Y&&n&&q(null)}}),$(e)]},e.value)})}),W&&(0,u.jsxs)(`div`,{id:z,className:c.default.anchors,children:[(0,u.jsx)(`span`,{children:v}),(0,u.jsx)(`span`,{children:y})]})]}),Y&&(0,u.jsx)(a.VisuallyHidden,{id:B,children:M})]})}exports.RatingScale=m,exports.getRatingScaleOptions=p;
1
+ "use client";const e=require("../../../hooks/useControllableState.cjs.js"),t=require("../../../hooks/useFormReset.cjs.js"),n=require("../../../utils/cx.cjs.js"),r=require("../../primitives/Icon/icons.cjs.js"),i=require("../../utilities/LocaleProvider/LocaleProvider.cjs.js"),a=require("../../utilities/VisuallyHidden/VisuallyHidden.cjs.js"),o=require("../Field/FieldContext.cjs.js"),s=require("../Rating/Rating.cjs.js"),c=require("./RatingScale.module.css.cjs.js");let l=require("react"),u=require("react/jsx-runtime");var ee={sm:c.default.sm,md:c.default.md,lg:c.default.lg},te={faces:c.default.faces,numbers:c.default.numbers,thumbs:c.default.thumbs},d=[(0,u.jsx)(r.FaceVerySadIcon,{},`1`),(0,u.jsx)(r.FaceSadIcon,{},`2`),(0,u.jsx)(r.FaceNeutralIcon,{},`3`),(0,u.jsx)(r.FaceHappyIcon,{},`4`),(0,u.jsx)(r.FaceVeryHappyIcon,{},`5`)],ne=[`danger`,`warning`,`neutral`,`info`,`success`],f=(...e)=>e.filter(Boolean).join(` `)||void 0;function p(e,t,{min:n=1,max:i=5,locale:a}={}){if(e===`faces`)return t.ratingScale.faces.map((e,t)=>({value:t+1,label:e,icon:d[t]}));if(e===`thumbs`)return[{value:1,label:t.ratingScale.thumbsUp,icon:(0,u.jsx)(r.ThumbsUpIcon,{})},{value:0,label:t.ratingScale.thumbsDown,icon:(0,u.jsx)(r.ThumbsDownIcon,{})}];let o=Math.round(Math.min(n,i)),c=Math.round(Math.max(n,i)),l=[];for(let e=o;e<=c;e++)l.push({value:e,label:t.rating.option(s.formatRatingValue(e,a),c),icon:s.formatRatingValue(e,a)});return l}function m({variant:r=`numbers`,value:d,defaultValue:m=null,onValueChange:re,min:h=1,max:g=5,options:_,startLabel:v,endLabel:y,showLabels:ie=!1,sentiment:ae=!1,size:oe,allowClear:b=!1,clearHint:se,disabled:x,readOnly:ce,invalid:S,required:le,name:C,getReadOnlyLabel:w,unratedLabel:T,label:E,description:D,className:ue,id:de,onKeyDown:fe,"aria-describedby":O,"aria-labelledby":k,...pe}){let{messages:A,locale:j}=i.useLocale(),M=se??A.rating.clearHint,N=w??(e=>A.ratingScale.display(e.label)),P=T??A.rating.unrated,F=o.useFieldContext(),I=(0,l.useId)(),L=`${I}-label`,R=`${I}-description`,z=`${I}-anchors`,B=`${I}-clear`,V=F!==null,H=!V&&E!=null,U=D!=null,W=v!=null||y!=null,G=o.useFieldControl({id:de,invalid:S,required:le,disabled:x,readOnly:ce,size:oe,"aria-describedby":f(U&&R,W&&z,O)}),[K,q]=e.useControllableState({value:d,defaultValue:m,onChange:re});t.useFormReset(()=>G.id?document.getElementById(G.id):null,()=>q(m??null),d===void 0);let me=G.size??`md`,J=_??p(r,A,{min:h,max:g,locale:j}),he=C??`rating-scale-${I}`,ge=!G.disabled&&!G.readOnly,Y=b&&ge,X=K===null?void 0:J.find(e=>e.value===K),Z=F?.isGroup===!0&&k===void 0,_e=k??(V?F.labelId:H?L:void 0),ve=Z?{"aria-describedby":f(U&&R,W&&z,O)}:{role:G.readOnly?`group`:`radiogroup`,"aria-labelledby":_e,...G.ariaProps,"aria-disabled":G.disabled||void 0,"aria-required":G.required&&!G.readOnly||void 0},ye=e=>{fe?.(e),!e.defaultPrevented&&Y&&(e.key===`Delete`||e.key===`Backspace`)&&e.target instanceof HTMLInputElement&&(e.preventDefault(),q(null))},Q=e=>n.cx(c.default.option,ae&&r===`faces`&&c.default[ne[e]??`neutral`]),$=e=>(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(`span`,{className:c.default.visual,"aria-hidden":`true`,children:e.icon??s.formatRatingValue(e.value,j)}),ie&&r!==`numbers`&&(0,u.jsx)(`span`,{className:c.default.caption,"aria-hidden":`true`,children:e.label})]});return(0,u.jsxs)(`div`,{id:G.id,...ve,...pe,"data-disabled":G.disabled||void 0,"data-invalid":G.invalid||void 0,"data-readonly":G.readOnly||void 0,className:n.cx(c.default.scale,ee[me],te[r],ue),onKeyDown:ye,children:[(H||U)&&(0,u.jsxs)(`div`,{className:c.default.header,children:[H&&(0,u.jsxs)(`div`,{id:L,className:c.default.label,children:[E,G.required&&!G.readOnly&&(0,u.jsxs)(`span`,{className:c.default.requiredMark,"aria-hidden":`true`,children:[` `,`*`]})]}),U&&(0,u.jsx)(`div`,{id:R,className:c.default.description,children:D})]}),(0,u.jsxs)(`div`,{className:c.default.body,children:[G.readOnly?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(`div`,{role:`img`,"aria-label":X?N(X):P,className:c.default.options,children:J.map((e,t)=>(0,u.jsx)(`span`,{className:Q(t),"data-checked":e===X||void 0,children:$(e)},e.value))}),C!==void 0&&X&&(0,u.jsx)(`input`,{type:`hidden`,name:C,value:String(X.value)})]}):(0,u.jsx)(`div`,{className:c.default.options,children:J.map((e,t)=>{let n=e===X;return(0,u.jsxs)(`label`,{className:Q(t),"data-checked":n||void 0,children:[(0,u.jsx)(`input`,{type:`radio`,className:c.default.input,name:he,value:String(e.value),checked:n,disabled:G.disabled,required:G.required,"aria-label":e.label,"aria-describedby":Y?B:void 0,"aria-invalid":Z&&G.invalid?!0:void 0,onChange:t=>{t.target.checked&&q(e.value)},onClick:()=>{Y&&n&&q(null)}}),$(e)]},e.value)})}),W&&(0,u.jsxs)(`div`,{id:z,className:c.default.anchors,children:[(0,u.jsx)(`span`,{children:v}),(0,u.jsx)(`span`,{children:y})]})]}),Y&&(0,u.jsx)(a.VisuallyHidden,{id:B,children:M})]})}exports.RatingScale=m,exports.getRatingScaleOptions=p;
@@ -103,7 +103,7 @@ function y({ variant: r = "numbers", value: i, defaultValue: a = null, onValueCh
103
103
  children: [
104
104
  (H || U) && /* @__PURE__ */ h("div", {
105
105
  className: d.header,
106
- children: [H && /* @__PURE__ */ h("span", {
106
+ children: [H && /* @__PURE__ */ h("div", {
107
107
  id: L,
108
108
  className: d.label,
109
109
  children: [T, G.required && !G.readOnly && /* @__PURE__ */ h("span", {
@@ -111,7 +111,7 @@ function y({ variant: r = "numbers", value: i, defaultValue: a = null, onValueCh
111
111
  "aria-hidden": "true",
112
112
  children: [" ", "*"]
113
113
  })]
114
- }), U && /* @__PURE__ */ m("span", {
114
+ }), U && /* @__PURE__ */ m("div", {
115
115
  id: R,
116
116
  className: d.description,
117
117
  children: E