@blakesteve/roster 5.2.0 → 5.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/README.md +121 -20
  2. package/dist/components/atoms/Avatar/Avatar.cjs +1 -1
  3. package/dist/components/atoms/Avatar/Avatar.js +1 -1
  4. package/dist/components/atoms/Avatar/avatar-variants.cjs +1 -1
  5. package/dist/components/atoms/Avatar/avatar-variants.js +1 -1
  6. package/dist/components/atoms/Button/button-variants.cjs +1 -1
  7. package/dist/components/atoms/Button/button-variants.js +3 -3
  8. package/dist/components/atoms/Card/card-variants.cjs +1 -1
  9. package/dist/components/atoms/Card/card-variants.js +3 -2
  10. package/dist/components/atoms/Checkbox/Checkbox.cjs +1 -1
  11. package/dist/components/atoms/Checkbox/Checkbox.d.ts +5 -0
  12. package/dist/components/atoms/Checkbox/Checkbox.js +54 -40
  13. package/dist/components/atoms/Checkbox/checkbox-variants.cjs +1 -1
  14. package/dist/components/atoms/Checkbox/checkbox-variants.js +1 -1
  15. package/dist/components/atoms/Combobox/Combobox.cjs +1 -1
  16. package/dist/components/atoms/Combobox/Combobox.js +63 -62
  17. package/dist/components/atoms/InlineCode/inline-code-variants.cjs +1 -1
  18. package/dist/components/atoms/InlineCode/inline-code-variants.js +1 -1
  19. package/dist/components/atoms/Input/Input.cjs +1 -1
  20. package/dist/components/atoms/Input/Input.js +49 -52
  21. package/dist/components/atoms/Input/input-variants.cjs +1 -1
  22. package/dist/components/atoms/Input/input-variants.js +17 -7
  23. package/dist/components/atoms/LabeledDivider/LabeledDivider.cjs +1 -1
  24. package/dist/components/atoms/LabeledDivider/LabeledDivider.js +6 -6
  25. package/dist/components/atoms/MultiSelect/MultiSelect.cjs +1 -1
  26. package/dist/components/atoms/MultiSelect/MultiSelect.js +62 -60
  27. package/dist/components/atoms/PasswordInput/PasswordInput.cjs +1 -1
  28. package/dist/components/atoms/PasswordInput/PasswordInput.js +1 -1
  29. package/dist/components/atoms/Select/Select.cjs +1 -1
  30. package/dist/components/atoms/Select/Select.js +52 -51
  31. package/dist/components/atoms/Select/select-variants.cjs +1 -1
  32. package/dist/components/atoms/Select/select-variants.js +9 -2
  33. package/dist/components/atoms/Switch/switch-variants.cjs +1 -1
  34. package/dist/components/atoms/Switch/switch-variants.js +1 -1
  35. package/dist/components/atoms/Textarea/Textarea.cjs +1 -1
  36. package/dist/components/atoms/Textarea/Textarea.js +36 -34
  37. package/dist/components/atoms/Textarea/textarea-variants.cjs +1 -1
  38. package/dist/components/atoms/Textarea/textarea-variants.js +17 -11
  39. package/dist/components/atoms/Tooltip/Tooltip.cjs +1 -1
  40. package/dist/components/atoms/Tooltip/Tooltip.js +1 -1
  41. package/dist/components/molecules/Accordion/Accordion.cjs +1 -1
  42. package/dist/components/molecules/Accordion/Accordion.js +19 -19
  43. package/dist/components/molecules/Alert/Alert.cjs +1 -1
  44. package/dist/components/molecules/Alert/Alert.js +1 -1
  45. package/dist/components/molecules/CheckboxGroup/CheckboxGroup.cjs +1 -1
  46. package/dist/components/molecules/CheckboxGroup/CheckboxGroup.d.ts +5 -3
  47. package/dist/components/molecules/CheckboxGroup/CheckboxGroup.js +68 -65
  48. package/dist/components/molecules/RadioGroup/RadioGroup.cjs +1 -1
  49. package/dist/components/molecules/RadioGroup/RadioGroup.d.ts +4 -3
  50. package/dist/components/molecules/RadioGroup/RadioGroup.js +48 -47
  51. package/dist/components/molecules/Toast/Toast.cjs +1 -1
  52. package/dist/components/molecules/Toast/Toast.js +1 -1
  53. package/dist/components/organisms/Dialog/Dialog.cjs +1 -1
  54. package/dist/components/organisms/Dialog/Dialog.js +28 -24
  55. package/dist/components/organisms/Navbar/Navbar.cjs +1 -1
  56. package/dist/components/organisms/Navbar/Navbar.js +2 -2
  57. package/dist/components/organisms/Sheet/Sheet.cjs +1 -1
  58. package/dist/components/organisms/Sheet/Sheet.js +1 -1
  59. package/dist/internal/field-invalid.cjs +1 -0
  60. package/dist/internal/field-invalid.d.ts +37 -0
  61. package/dist/internal/field-invalid.js +13 -0
  62. package/dist/internal/popup.cjs +1 -1
  63. package/dist/internal/popup.js +1 -1
  64. package/dist/lib/utils.cjs +1 -1
  65. package/dist/lib/utils.js +16 -11
  66. package/dist/meta.json +3 -3
  67. package/dist/roster.css +1 -1
  68. package/package.json +1 -1
@@ -1,81 +1,82 @@
1
1
  "use client";
2
2
  import { jsxs as b, jsx as t } from "react/jsx-runtime";
3
- import * as I from "react";
4
- import { Fragment as L } from "react";
5
- import { Combobox as U, ComboboxInput as _, ComboboxButton as H, ComboboxOptions as S, ComboboxOption as h } from "../../../node_modules/@headlessui/react/dist/components/combobox/combobox.js";
6
- import { Description as j } from "../../../node_modules/@headlessui/react/dist/components/description/description.js";
7
- import { Field as A } from "../../../node_modules/@headlessui/react/dist/components/field/field.js";
8
- import { Label as R } from "../../../node_modules/@headlessui/react/dist/components/label/label.js";
9
- import { Transition as T } from "../../../node_modules/@headlessui/react/dist/components/transition/transition.js";
10
- import { FontAwesomeIcon as q } from "../../../node_modules/@fortawesome/react-fontawesome/dist/index.js";
11
- import { faChevronDown as B } from "../../../node_modules/@fortawesome/free-solid-svg-icons/index.js";
3
+ import * as U from "react";
4
+ import { Fragment as _ } from "react";
5
+ import { Combobox as H, ComboboxInput as S, ComboboxButton as j, ComboboxOptions as A, ComboboxOption as v } from "../../../node_modules/@headlessui/react/dist/components/combobox/combobox.js";
6
+ import { Description as R } from "../../../node_modules/@headlessui/react/dist/components/description/description.js";
7
+ import { Field as T } from "../../../node_modules/@headlessui/react/dist/components/field/field.js";
8
+ import { Label as q } from "../../../node_modules/@headlessui/react/dist/components/label/label.js";
9
+ import { Transition as B } from "../../../node_modules/@headlessui/react/dist/components/transition/transition.js";
10
+ import { FontAwesomeIcon as E } from "../../../node_modules/@fortawesome/react-fontawesome/dist/index.js";
11
+ import { faChevronDown as V } from "../../../node_modules/@fortawesome/free-solid-svg-icons/index.js";
12
12
  import { cn as e } from "../../../lib/utils.js";
13
- import { inputVariants as E } from "../Input/input-variants.js";
14
- import { PopupOption as V } from "../../../internal/PopupOption.js";
15
- import { useDarkScope as W, POPUP_ANCHOR as K, POPUP_WIDTH_OF_INPUT as Q, POPUP_PANEL as Z, popupInDarkPalette as G } from "../../../internal/popup.js";
16
- const J = (s, o) => {
13
+ import { isFieldInvalid as W, withoutInvalidProps as K } from "../../../internal/field-invalid.js";
14
+ import { inputVariants as Q } from "../Input/input-variants.js";
15
+ import { PopupOption as Z } from "../../../internal/PopupOption.js";
16
+ import { useDarkScope as G, POPUP_ANCHOR as J, POPUP_WIDTH_OF_INPUT as X, POPUP_PANEL as Y, popupInDarkPalette as $ } from "../../../internal/popup.js";
17
+ const M = (s, o) => {
17
18
  const a = o.trim().toLowerCase();
18
- return a ? s.filter((i) => i.label.toLowerCase().includes(a)) : s;
19
- }, mt = ({
19
+ return a ? s.filter((l) => l.label.toLowerCase().includes(a)) : s;
20
+ }, ft = ({
20
21
  options: s,
21
22
  value: o,
22
23
  onChange: a,
23
- placeholder: i = "Search...",
24
+ placeholder: l = "Search...",
24
25
  disabled: c = !1,
25
- variant: p,
26
- size: l,
27
- error: v,
28
- label: d,
26
+ variant: d,
27
+ size: i,
28
+ error: P,
29
+ label: p,
29
30
  helperText: f,
30
- errorMessage: m,
31
+ errorMessage: n,
31
32
  className: y,
32
33
  inputClassName: N,
33
- optionsClassName: P,
34
- emptyMessage: C = "No matches",
35
- filter: k = J,
36
- ...g
34
+ optionsClassName: C,
35
+ emptyMessage: k = "No matches",
36
+ filter: g = M,
37
+ ...u
37
38
  }) => {
38
- const [O, u] = I.useState(""), { ref: w, inDarkScope: D } = W(), n = !!m || v, x = k(s, O), F = s.find((r) => r.value === o) ?? null;
39
+ const [O, x] = U.useState(""), { ref: w, inDarkScope: F } = G(), m = !!n || P, I = W(m, u), D = K(u), h = g(s, O), L = s.find((r) => r.value === o) ?? null;
39
40
  return /* @__PURE__ */ b(
40
- A,
41
+ T,
41
42
  {
42
43
  disabled: c,
43
44
  className: e("rst:flex rst:flex-col rst:gap-1.5", y),
44
- ...g,
45
+ ...D,
45
46
  children: [
46
- d && /* @__PURE__ */ t(R, { className: "rst:block rst:text-sm rst:font-medium rst:text-[var(--roster-control-text)] rst:text-left", children: d }),
47
+ p && /* @__PURE__ */ t(q, { className: "rst:block rst:text-sm rst:font-medium rst:text-[var(--roster-control-text)] rst:text-left", children: p }),
47
48
  /* @__PURE__ */ t(
48
- U,
49
+ H,
49
50
  {
50
51
  value: o ?? null,
51
52
  onChange: a,
52
53
  disabled: c,
53
54
  children: /* @__PURE__ */ b("div", { ref: w, className: "rst:relative", children: [
54
55
  /* @__PURE__ */ t(
55
- _,
56
+ S,
56
57
  {
57
- "aria-invalid": n || void 0,
58
+ "aria-invalid": I || void 0,
58
59
  className: e(
59
- E({ variant: p, size: l, error: n }),
60
+ Q({ variant: d, size: i, error: m }),
60
61
  N,
61
62
  "rst:pr-9"
62
63
  ),
63
- placeholder: i,
64
- displayValue: () => F?.label ?? "",
65
- onChange: (r) => u(r.target.value)
64
+ placeholder: l,
65
+ displayValue: () => L?.label ?? "",
66
+ onChange: (r) => x(r.target.value)
66
67
  }
67
68
  ),
68
69
  /* @__PURE__ */ t(
69
- H,
70
+ j,
70
71
  {
71
72
  className: e(
72
73
  "rst:absolute rst:inset-y-0 rst:right-0 rst:flex rst:w-11 rst:cursor-pointer rst:items-center rst:justify-end",
73
- l === "sm" ? "rst:pr-2.5" : "rst:pr-3"
74
+ i === "sm" ? "rst:pr-2.5" : "rst:pr-3"
74
75
  ),
75
76
  children: /* @__PURE__ */ t(
76
- q,
77
+ E,
77
78
  {
78
- icon: B,
79
+ icon: V,
79
80
  className: "rst:h-3.5 rst:w-3.5 rst:text-gray-400 rst:dark:text-gray-500",
80
81
  "aria-hidden": "true"
81
82
  }
@@ -83,43 +84,43 @@ const J = (s, o) => {
83
84
  }
84
85
  ),
85
86
  /* @__PURE__ */ t(
86
- T,
87
+ B,
87
88
  {
88
- as: L,
89
+ as: _,
89
90
  leave: "rst:transition rst:ease-in rst:duration-100",
90
91
  leaveFrom: "rst:opacity-100",
91
92
  leaveTo: "rst:opacity-0",
92
- afterLeave: () => u(""),
93
+ afterLeave: () => x(""),
93
94
  children: /* @__PURE__ */ t(
94
- S,
95
+ A,
95
96
  {
96
- anchor: K,
97
+ anchor: J,
97
98
  className: e(
98
- G(D, p) && "dark",
99
- Z,
99
+ $(F, d) && "dark",
100
+ Y,
100
101
  /* `--input-width`, not `--button-width`: the button here is
101
102
  the chevron, so matching it renders a 20px sliver. */
102
- Q,
103
- P
103
+ X,
104
+ C
104
105
  ),
105
- children: x.length === 0 ? /* @__PURE__ */ t(
106
- h,
106
+ children: h.length === 0 ? /* @__PURE__ */ t(
107
+ v,
107
108
  {
108
109
  value: "",
109
110
  disabled: !0,
110
111
  className: e(
111
112
  "rst:px-4 rst:py-2.5 rst:text-sm rst:opacity-70",
112
- l === "sm" && "rst:px-3 rst:py-2"
113
+ i === "sm" && "rst:px-3 rst:py-2"
113
114
  ),
114
- children: C
115
+ children: k
115
116
  }
116
- ) : x.map((r) => /* @__PURE__ */ t(
117
- V,
117
+ ) : h.map((r) => /* @__PURE__ */ t(
118
+ Z,
118
119
  {
119
- as: h,
120
+ as: v,
120
121
  value: r.value,
121
122
  disabled: r.disabled,
122
- size: l,
123
+ size: i,
123
124
  children: r.label
124
125
  },
125
126
  r.value
@@ -131,14 +132,14 @@ const J = (s, o) => {
131
132
  ] })
132
133
  }
133
134
  ),
134
- (f || m) && /* @__PURE__ */ t(
135
- j,
135
+ (f || n) && /* @__PURE__ */ t(
136
+ R,
136
137
  {
137
138
  className: e(
138
139
  "rst:text-xs rst:text-left",
139
- n ? "rst:text-error-600 rst:dark:text-error-400 rst:font-medium" : "rst:text-gray-500 rst:dark:text-gray-400"
140
+ m ? "rst:text-error-600 rst:dark:text-error-400 rst:font-medium" : "rst:text-gray-500 rst:dark:text-gray-400"
140
141
  ),
141
- children: m || f
142
+ children: n || f
142
143
  }
143
144
  )
144
145
  ]
@@ -146,5 +147,5 @@ const J = (s, o) => {
146
147
  );
147
148
  };
148
149
  export {
149
- mt as Combobox
150
+ ft as Combobox
150
151
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../../../node_modules/class-variance-authority/dist/index.cjs"),t=r.cva("rst:font-mono rst:text-[0.8125rem]",{variants:{colorScheme:{primary:"rst:text-primary-600 rst:dark:text-primary-400",neutral:"rst:text-gray-800 rst:dark:text-gray-200",current:"rst:text-current"},surface:{none:"",soft:"rst:rounded rst:bg-gray-100 rst:px-1 rst:py-0.5 rst:dark:bg-gray-800"}},defaultVariants:{colorScheme:"primary",surface:"none"}});exports.inlineCodeVariants=t;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../../../node_modules/class-variance-authority/dist/index.cjs"),t=r.cva("rst:font-mono rst:text-[0.8125rem]",{variants:{colorScheme:{primary:"rst:text-primary-600 rst:dark:text-primary-400",neutral:"rst:text-gray-800 rst:dark:text-gray-200",current:"rst:text-current"},surface:{none:"",soft:"rst:rounded-sm rst:bg-gray-100 rst:px-1 rst:py-0.5 rst:dark:bg-gray-800"}},defaultVariants:{colorScheme:"primary",surface:"none"}});exports.inlineCodeVariants=t;
@@ -8,7 +8,7 @@ const e = /* @__PURE__ */ r("rst:font-mono rst:text-[0.8125rem]", {
8
8
  },
9
9
  surface: {
10
10
  none: "",
11
- soft: "rst:rounded rst:bg-gray-100 rst:px-1 rst:py-0.5 rst:dark:bg-gray-800"
11
+ soft: "rst:rounded-sm rst:bg-gray-100 rst:px-1 rst:py-0.5 rst:dark:bg-gray-800"
12
12
  }
13
13
  },
14
14
  defaultVariants: { colorScheme: "primary", surface: "none" }
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),g=require("react"),V=require("../../../node_modules/@headlessui/react/dist/components/description/description.cjs"),k=require("../../../node_modules/@headlessui/react/dist/components/field/field.cjs"),w=require("../../../node_modules/@headlessui/react/dist/components/input/input.cjs"),P=require("../../../node_modules/@headlessui/react/dist/components/label/label.cjs"),t=require("../../../lib/utils.cjs"),o=require("./input-variants.cjs"),m=g.forwardRef(({className:x,type:f,label:d,helperText:u,errorMessage:e,variant:i,size:n,error:v,startIcon:a,endIcon:l,disabled:p,inputClassName:j,...q},N)=>{const s=!!e||v,{"aria-invalid":c,invalid:b,...h}=q,y=!!b||c!==void 0&&c!==!1&&c!=="false";return r.jsxs(k.Field,{disabled:p,className:t.cn("rst:w-full",x),children:[d&&r.jsx(P.Label,{className:t.cn("rst:block rst:text-sm rst:font-medium rst:leading-none rst:text-left rst:mb-1.5 rst:transition-colors","rst:text-[var(--roster-control-text)]","rst:peer-disabled:cursor-not-allowed rst:peer-disabled:opacity-70"),children:d}),r.jsxs("div",{className:"rst:relative",children:[a&&r.jsx("div",{className:t.cn(o.iconVariants({variant:i,error:s}),"rst:left-3"),children:a}),r.jsx(w.Input,{ref:N,type:f,disabled:p,className:t.cn(o.inputVariants({variant:i,size:n,error:s}),a&&(n==="sm"?"rst:pl-9":"rst:pl-10"),l&&(n==="sm"?"rst:pr-9":"rst:pr-10"),j),...h,invalid:y}),l&&r.jsx("div",{className:t.cn(o.iconVariants({variant:i,error:s}),"rst:right-3"),children:l})]}),(u||e)&&r.jsx(V.Description,{className:t.cn("rst:text-xs rst:text-left rst:mt-1.5",s?"rst:text-error-600 rst:dark:text-error-400 rst:font-medium":"rst:text-gray-500 rst:dark:text-gray-400"),children:e||u})]})});m.displayName="Input";exports.Input=m;
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),y=require("react"),g=require("../../../node_modules/@headlessui/react/dist/components/description/description.cjs"),w=require("../../../node_modules/@headlessui/react/dist/components/field/field.cjs"),V=require("../../../node_modules/@headlessui/react/dist/components/input/input.cjs"),k=require("../../../node_modules/@headlessui/react/dist/components/label/label.cjs"),r=require("../../../lib/utils.cjs"),a=require("./input-variants.cjs"),p=require("../../../internal/field-invalid.cjs"),x=y.forwardRef(({className:f,type:j,label:o,helperText:u,errorMessage:e,variant:i,size:n,error:q,startIcon:l,endIcon:c,disabled:d,inputClassName:h,...m},v)=>{const s=!!e||q,N=p.isFieldInvalid(s,m),b=p.withoutInvalidProps(m);return t.jsxs(w.Field,{disabled:d,className:r.cn("rst:w-full",f),children:[o&&t.jsx(k.Label,{className:r.cn("rst:block rst:text-sm rst:font-medium rst:leading-none rst:text-left rst:mb-1.5 rst:transition-colors","rst:text-[var(--roster-control-text)]","rst:peer-disabled:cursor-not-allowed rst:peer-disabled:opacity-70"),children:o}),t.jsxs("div",{className:"rst:relative",children:[l&&t.jsx("div",{className:r.cn(a.iconVariants({variant:i,error:s}),"rst:left-3"),children:l}),t.jsx(V.Input,{ref:v,type:j,disabled:d,className:r.cn(a.inputVariants({variant:i,size:n,error:s}),l&&(n==="sm"?"rst:pl-9":"rst:pl-10"),c&&(n==="sm"?"rst:pr-9":"rst:pr-10"),h),...b,invalid:N}),c&&t.jsx("div",{className:r.cn(a.iconVariants({variant:i,error:s}),"rst:right-3"),children:c})]}),(u||e)&&t.jsx(g.Description,{className:r.cn("rst:text-xs rst:text-left rst:mt-1.5",s?"rst:text-error-600 rst:dark:text-error-400 rst:font-medium":"rst:text-gray-500 rst:dark:text-gray-400"),children:e||u})]})});x.displayName="Input";exports.Input=x;
@@ -1,33 +1,30 @@
1
1
  "use client";
2
- import { jsxs as c, jsx as t } from "react/jsx-runtime";
3
- import g from "react";
4
- import { Description as j } from "../../../node_modules/@headlessui/react/dist/components/description/description.js";
5
- import { Field as P } from "../../../node_modules/@headlessui/react/dist/components/field/field.js";
6
- import { Input as R } from "../../../node_modules/@headlessui/react/dist/components/input/input.js";
7
- import { Label as V } from "../../../node_modules/@headlessui/react/dist/components/label/label.js";
2
+ import { jsxs as p, jsx as s } from "react/jsx-runtime";
3
+ import b from "react";
4
+ import { Description as k } from "../../../node_modules/@headlessui/react/dist/components/description/description.js";
5
+ import { Field as g } from "../../../node_modules/@headlessui/react/dist/components/field/field.js";
6
+ import { Input as j } from "../../../node_modules/@headlessui/react/dist/components/input/input.js";
7
+ import { Label as F } from "../../../node_modules/@headlessui/react/dist/components/label/label.js";
8
8
  import { cn as r } from "../../../lib/utils.js";
9
- import { iconVariants as f, inputVariants as _ } from "./input-variants.js";
10
- const D = g.forwardRef(
9
+ import { iconVariants as f, inputVariants as P } from "./input-variants.js";
10
+ import { isFieldInvalid as R, withoutInvalidProps as V } from "../../../internal/field-invalid.js";
11
+ const _ = b.forwardRef(
11
12
  ({
12
- className: x,
13
- type: u,
14
- label: n,
15
- helperText: d,
16
- errorMessage: i,
17
- variant: e,
18
- size: a,
19
- error: v,
20
- startIcon: o,
21
- endIcon: l,
22
- disabled: p,
13
+ className: u,
14
+ type: x,
15
+ label: l,
16
+ helperText: n,
17
+ errorMessage: e,
18
+ variant: o,
19
+ size: i,
20
+ error: h,
21
+ startIcon: m,
22
+ endIcon: a,
23
+ disabled: c,
23
24
  inputClassName: N,
24
- ...h
25
- }, y) => {
26
- const s = !!i || v, {
27
- "aria-invalid": m,
28
- invalid: b,
29
- ...k
30
- } = h, w = !!b || m !== void 0 && m !== !1 && m !== "false";
25
+ ...d
26
+ }, v) => {
27
+ const t = !!e || h, w = R(t, d), y = V(d);
31
28
  return (
32
29
  /* No `space-y-*` here, deliberately. Headless UI's Field appends a
33
30
  hidden zero-height <span> after the control, and Tailwind v4 applies
@@ -42,73 +39,73 @@ const D = g.forwardRef(
42
39
  DisabledProvider stays false and the Label and Description never dim.
43
40
  Fixed in both rather than one, because a form with a disabled Input
44
41
  and a disabled Select that grey differently is worse than neither. */
45
- /* @__PURE__ */ c(P, { disabled: p, className: r("rst:w-full", x), children: [
46
- n && /* @__PURE__ */ t(
47
- V,
42
+ /* @__PURE__ */ p(g, { disabled: c, className: r("rst:w-full", u), children: [
43
+ l && /* @__PURE__ */ s(
44
+ F,
48
45
  {
49
46
  className: r(
50
47
  "rst:block rst:text-sm rst:font-medium rst:leading-none rst:text-left rst:mb-1.5 rst:transition-colors",
51
48
  "rst:text-[var(--roster-control-text)]",
52
49
  "rst:peer-disabled:cursor-not-allowed rst:peer-disabled:opacity-70"
53
50
  ),
54
- children: n
51
+ children: l
55
52
  }
56
53
  ),
57
- /* @__PURE__ */ c("div", { className: "rst:relative", children: [
58
- o && /* @__PURE__ */ t(
54
+ /* @__PURE__ */ p("div", { className: "rst:relative", children: [
55
+ m && /* @__PURE__ */ s(
59
56
  "div",
60
57
  {
61
58
  className: r(
62
- f({ variant: e, error: s }),
59
+ f({ variant: o, error: t }),
63
60
  "rst:left-3"
64
61
  ),
65
- children: o
62
+ children: m
66
63
  }
67
64
  ),
68
- /* @__PURE__ */ t(
69
- R,
65
+ /* @__PURE__ */ s(
66
+ j,
70
67
  {
71
- ref: y,
72
- type: u,
73
- disabled: p,
68
+ ref: v,
69
+ type: x,
70
+ disabled: c,
74
71
  className: r(
75
- _({ variant: e, size: a, error: s }),
72
+ P({ variant: o, size: i, error: t }),
76
73
  /* Icon inset tracks the size's own padding: sm is px-3, so it
77
74
  needs one step less clearance than the 16px sizes. */
78
- o && (a === "sm" ? "rst:pl-9" : "rst:pl-10"),
79
- l && (a === "sm" ? "rst:pr-9" : "rst:pr-10"),
75
+ m && (i === "sm" ? "rst:pl-9" : "rst:pl-10"),
76
+ a && (i === "sm" ? "rst:pr-9" : "rst:pr-10"),
80
77
  N
81
78
  ),
82
- ...k,
79
+ ...y,
83
80
  invalid: w
84
81
  }
85
82
  ),
86
- l && /* @__PURE__ */ t(
83
+ a && /* @__PURE__ */ s(
87
84
  "div",
88
85
  {
89
86
  className: r(
90
- f({ variant: e, error: s }),
87
+ f({ variant: o, error: t }),
91
88
  "rst:right-3"
92
89
  ),
93
- children: l
90
+ children: a
94
91
  }
95
92
  )
96
93
  ] }),
97
- (d || i) && /* @__PURE__ */ t(
98
- j,
94
+ (n || e) && /* @__PURE__ */ s(
95
+ k,
99
96
  {
100
97
  className: r(
101
98
  "rst:text-xs rst:text-left rst:mt-1.5",
102
- s ? "rst:text-error-600 rst:dark:text-error-400 rst:font-medium" : "rst:text-gray-500 rst:dark:text-gray-400"
99
+ t ? "rst:text-error-600 rst:dark:text-error-400 rst:font-medium" : "rst:text-gray-500 rst:dark:text-gray-400"
103
100
  ),
104
- children: i || d
101
+ children: e || n
105
102
  }
106
103
  )
107
104
  ] })
108
105
  );
109
106
  }
110
107
  );
111
- D.displayName = "Input";
108
+ _.displayName = "Input";
112
109
  export {
113
- D as Input
110
+ _ as Input
114
111
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../../../node_modules/class-variance-authority/dist/index.cjs"),t=r.cva("rst:font-ui rst:flex rst:w-full rst:rounded-md rst:border rst:h-10 rst:px-4 rst:text-sm rst:ring-offset-background rst:focus-visible:ring-offset-2 rst:file:border-0 rst:file:bg-transparent rst:file:text-sm rst:file:font-medium rst:focus-visible:outline-hidden rst:focus-visible:ring-2 rst:focus-visible:ring-ring rst:disabled:cursor-not-allowed rst:disabled:opacity-50 rst:transition-all",{variants:{variant:{white:"rst:border-gray-300 rst:bg-white rst:text-gray-900 rst:placeholder:text-gray-400 rst:focus-visible:border-primary-500 rst:dark:border-gray-700 rst:dark:bg-gray-800 rst:dark:text-gray-100 rst:dark:placeholder:text-gray-500",soft:"rst:border-[var(--roster-control-border)] rst:bg-gray-100 rst:text-gray-900 rst:placeholder:text-gray-400 rst:focus-visible:bg-white rst:focus-visible:border-primary-500 rst:dark:focus-visible:border-primary-400 rst:dark:bg-gray-800 rst:dark:text-gray-100 rst:dark:placeholder:text-gray-500 rst:dark:focus-visible:bg-gray-900",slate:"rst:border-transparent rst:bg-gray-700 rst:text-gray-100 rst:placeholder:text-gray-400 rst:focus-visible:bg-gray-600 rst:dark:bg-gray-900 rst:dark:placeholder:text-gray-500 rst:dark:focus-visible:bg-gray-800",outline:"rst:border-[var(--roster-control-border)] rst:bg-[var(--roster-control-bg)] rst:text-[var(--roster-control-text)] rst:placeholder:text-gray-400 rst:focus-visible:border-[var(--roster-control-border-focus)] rst:dark:placeholder:text-gray-500",ghost:"rst:border-transparent rst:bg-transparent rst:text-gray-900 rst:placeholder:text-gray-400 rst:hover:bg-gray-100 rst:focus-visible:bg-gray-100 rst:dark:text-gray-100 rst:dark:placeholder:text-gray-500 rst:dark:hover:bg-gray-800 rst:dark:focus-visible:bg-gray-800"},size:{sm:"rst:h-9 rst:px-3",default:"rst:h-10 rst:px-4",lg:"rst:h-11 rst:px-4"},error:{true:"rst:border-error-500 rst:focus-visible:ring-error-500 rst:text-error-600 rst:placeholder:text-error-300 rst:dark:border-error-500 rst:dark:text-error-400 rst:dark:placeholder:text-error-800 rst:dark:focus-visible:ring-error-400",false:""}},defaultVariants:{variant:"outline",size:"default",error:!1}}),s=r.cva("rst:absolute rst:top-1/2 rst:-translate-y-1/2 rst:transition-colors",{variants:{variant:{white:"rst:text-gray-400 rst:dark:text-gray-500",soft:"rst:text-gray-500 rst:dark:text-gray-400",slate:"rst:text-gray-300 rst:dark:text-gray-500",outline:"rst:text-gray-400 rst:dark:text-gray-500",ghost:"rst:text-gray-500 rst:dark:text-gray-400"},error:{true:"rst:text-error-500 rst:dark:text-error-400",false:""}},defaultVariants:{variant:"outline",error:!1}});exports.iconVariants=s;exports.inputVariants=t;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../../../node_modules/class-variance-authority/dist/index.cjs"),t=r.cva("rst:font-ui rst:flex rst:w-full rst:rounded-md rst:border rst:h-10 rst:px-4 rst:text-sm rst:ring-offset-background rst:focus-visible:ring-offset-2 rst:file:border-0 rst:file:bg-transparent rst:file:text-sm rst:file:font-medium rst:focus-visible:outline-hidden rst:focus-visible:ring-2 rst:focus-visible:ring-ring rst:disabled:cursor-not-allowed rst:disabled:opacity-50 rst:transition-all",{variants:{variant:{white:"rst:border-gray-300 rst:bg-white rst:text-gray-900 rst:placeholder:text-gray-500 rst:focus-visible:border-primary-500 rst:dark:border-gray-700 rst:dark:bg-gray-800 rst:dark:text-gray-100 rst:dark:placeholder:text-gray-400",soft:"rst:border-[var(--roster-control-border)] rst:bg-gray-100 rst:text-gray-900 rst:placeholder:text-gray-500 rst:focus-visible:bg-white rst:focus-visible:border-primary-500 rst:dark:focus-visible:border-primary-400 rst:dark:bg-gray-800 rst:dark:text-gray-100 rst:dark:placeholder:text-gray-400 rst:dark:focus-visible:bg-gray-900",slate:"rst:border-transparent rst:bg-gray-700 rst:text-gray-100 rst:placeholder:text-gray-300 rst:focus-visible:bg-gray-600 rst:dark:bg-gray-900 rst:dark:placeholder:text-gray-400 rst:dark:focus-visible:bg-gray-800",outline:"rst:border-[var(--roster-control-border)] rst:bg-[var(--roster-control-bg)] rst:text-[var(--roster-control-text)] rst:placeholder:text-[color-mix(in_srgb,var(--roster-control-text)_65%,transparent)] rst:focus-visible:border-[var(--roster-control-border-focus)]",ghost:"rst:border-transparent rst:bg-transparent rst:text-gray-900 rst:placeholder:text-gray-500 rst:hover:bg-gray-100 rst:focus-visible:bg-gray-100 rst:dark:text-gray-100 rst:dark:placeholder:text-gray-400 rst:dark:hover:bg-gray-800 rst:dark:focus-visible:bg-gray-800"},size:{sm:"rst:h-9 rst:px-3",default:"rst:h-10 rst:px-4",lg:"rst:h-11 rst:px-4"},error:{true:"rst:border-error-500 rst:focus-visible:ring-error-500 rst:text-error-600 rst:dark:border-error-500 rst:dark:text-error-400 rst:dark:focus-visible:ring-error-400",false:""}},defaultVariants:{variant:"outline",size:"default",error:!1}}),s=r.cva("rst:absolute rst:top-1/2 rst:-translate-y-1/2 rst:transition-colors",{variants:{variant:{white:"rst:text-gray-400 rst:dark:text-gray-500",soft:"rst:text-gray-500 rst:dark:text-gray-400",slate:"rst:text-gray-300 rst:dark:text-gray-500",outline:"rst:text-gray-400 rst:dark:text-gray-500",ghost:"rst:text-gray-500 rst:dark:text-gray-400"},error:{true:"rst:text-error-500 rst:dark:text-error-400",false:""}},defaultVariants:{variant:"outline",error:!1}});exports.iconVariants=s;exports.inputVariants=t;
@@ -9,7 +9,7 @@ const s = /* @__PURE__ */ r(
9
9
  {
10
10
  variants: {
11
11
  variant: {
12
- white: "rst:border-gray-300 rst:bg-white rst:text-gray-900 rst:placeholder:text-gray-400 rst:focus-visible:border-primary-500 rst:dark:border-gray-700 rst:dark:bg-gray-800 rst:dark:text-gray-100 rst:dark:placeholder:text-gray-500",
12
+ white: "rst:border-gray-300 rst:bg-white rst:text-gray-900 rst:placeholder:text-gray-500 rst:focus-visible:border-primary-500 rst:dark:border-gray-700 rst:dark:bg-gray-800 rst:dark:text-gray-100 rst:dark:placeholder:text-gray-400",
13
13
  /* A boundary that does not depend on what is behind it. `soft` used
14
14
  `border-transparent` and leaned on its fill alone, which fails the
15
15
  moment the fill matches the surface — exactly 1.00:1 inside a
@@ -17,8 +17,8 @@ const s = /* @__PURE__ */ r(
17
17
  vanished until focus. Reported twice in one app before anyone read
18
18
  the variant. The border is the same token `outline` reads, so a
19
19
  consumer repaints both at once. */
20
- soft: "rst:border-[var(--roster-control-border)] rst:bg-gray-100 rst:text-gray-900 rst:placeholder:text-gray-400 rst:focus-visible:bg-white rst:focus-visible:border-primary-500 rst:dark:focus-visible:border-primary-400 rst:dark:bg-gray-800 rst:dark:text-gray-100 rst:dark:placeholder:text-gray-500 rst:dark:focus-visible:bg-gray-900",
21
- slate: "rst:border-transparent rst:bg-gray-700 rst:text-gray-100 rst:placeholder:text-gray-400 rst:focus-visible:bg-gray-600 rst:dark:bg-gray-900 rst:dark:placeholder:text-gray-500 rst:dark:focus-visible:bg-gray-800",
20
+ soft: "rst:border-[var(--roster-control-border)] rst:bg-gray-100 rst:text-gray-900 rst:placeholder:text-gray-500 rst:focus-visible:bg-white rst:focus-visible:border-primary-500 rst:dark:focus-visible:border-primary-400 rst:dark:bg-gray-800 rst:dark:text-gray-100 rst:dark:placeholder:text-gray-400 rst:dark:focus-visible:bg-gray-900",
21
+ slate: "rst:border-transparent rst:bg-gray-700 rst:text-gray-100 rst:placeholder:text-gray-300 rst:focus-visible:bg-gray-600 rst:dark:bg-gray-900 rst:dark:placeholder:text-gray-400 rst:dark:focus-visible:bg-gray-800",
22
22
  /* The default variant, and the only one that reads tokens.
23
23
  `Button`'s colors resolve through `--roster-*`, so remapping a palette
24
24
  carries; these were hardcoded, so a consumer wanting a field border in
@@ -33,9 +33,19 @@ const s = /* @__PURE__ */ r(
33
33
  know, and `soft` leaning on fill alone made it invisible at 1.00:1
34
34
  inside a `white` Dialog in dark mode. `white`, `slate` and `ghost`
35
35
  stay fully opinionated — each names a specific surface, and a token
36
- that meant something different in each would not be a token. */
37
- outline: "rst:border-[var(--roster-control-border)] rst:bg-[var(--roster-control-bg)] rst:text-[var(--roster-control-text)] rst:placeholder:text-gray-400 rst:focus-visible:border-[var(--roster-control-border-focus)] rst:dark:placeholder:text-gray-500",
38
- ghost: "rst:border-transparent rst:bg-transparent rst:text-gray-900 rst:placeholder:text-gray-400 rst:hover:bg-gray-100 rst:focus-visible:bg-gray-100 rst:dark:text-gray-100 rst:dark:placeholder:text-gray-500 rst:dark:hover:bg-gray-800 rst:dark:focus-visible:bg-gray-800"
36
+ that meant something different in each would not be a token.
37
+
38
+ Placeholders have to reach 4.5:1; gray-400, which every variant
39
+ used, is 2.52:1 on white. Here the placeholder is the text token at
40
+ 65%, so it follows whatever surface the text was chosen for (5.46:1
41
+ on a white page, 7.76 on the dark one, 5.02 inside the `slate`
42
+ Dialog, where a fixed gray-500 would fall to 1.71; measured
43
+ rendered, src/fills-and-fields.checks.stories.tsx). The opinionated
44
+ variants name a step per scheme instead, measured on their own
45
+ fill. An error leaves the placeholder alone: a red that passes is
46
+ too close to the typed text's red to tell them apart. */
47
+ outline: "rst:border-[var(--roster-control-border)] rst:bg-[var(--roster-control-bg)] rst:text-[var(--roster-control-text)] rst:placeholder:text-[color-mix(in_srgb,var(--roster-control-text)_65%,transparent)] rst:focus-visible:border-[var(--roster-control-border-focus)]",
48
+ ghost: "rst:border-transparent rst:bg-transparent rst:text-gray-900 rst:placeholder:text-gray-500 rst:hover:bg-gray-100 rst:focus-visible:bg-gray-100 rst:dark:text-gray-100 rst:dark:placeholder:text-gray-400 rst:dark:hover:bg-gray-800 rst:dark:focus-visible:bg-gray-800"
39
49
  },
40
50
  /* Deliberately the same three heights as Button: h-9 / h-10 / h-11.
41
51
  Input was a fixed 42px, which agreed with Button at no size at all, so
@@ -51,7 +61,7 @@ const s = /* @__PURE__ */ r(
51
61
  lg: "rst:h-11 rst:px-4"
52
62
  },
53
63
  error: {
54
- true: "rst:border-error-500 rst:focus-visible:ring-error-500 rst:text-error-600 rst:placeholder:text-error-300 rst:dark:border-error-500 rst:dark:text-error-400 rst:dark:placeholder:text-error-800 rst:dark:focus-visible:ring-error-400",
64
+ true: "rst:border-error-500 rst:focus-visible:ring-error-500 rst:text-error-600 rst:dark:border-error-500 rst:dark:text-error-400 rst:dark:focus-visible:ring-error-400",
55
65
  false: ""
56
66
  }
57
67
  },
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),c=require("react"),d=require("../../../lib/utils.cjs"),t=require("../Eyebrow/Eyebrow.cjs"),a=c.forwardRef(({label:i,trailing:r,align:s="start",className:n,...l},o)=>e.jsxs("div",{ref:o,className:d.cn("rst:font-ui rst:flex rst:items-center rst:gap-3",n),...l,children:[s==="end"&&e.jsx("span",{role:"presentation",className:"rst:h-px rst:flex-1 rst:bg-gray-200 rst:dark:bg-gray-800"}),e.jsx(t.Eyebrow,{children:i}),s==="start"&&e.jsx("span",{role:"presentation",className:"rst:h-px rst:flex-1 rst:bg-gray-200 rst:dark:bg-gray-800"}),r&&e.jsx(t.Eyebrow,{children:r})]}));a.displayName="LabeledDivider";exports.LabeledDivider=a;
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),l=require("react"),c=require("../../../lib/utils.cjs"),t=require("../Eyebrow/Eyebrow.cjs"),a=l.forwardRef(({label:i,trailing:e,align:s="start",className:o,...d},n)=>r.jsxs("div",{ref:n,className:c.cn("rst:font-ui rst:flex rst:items-center rst:gap-3",o),...d,children:[s==="end"&&r.jsx("span",{role:"presentation",className:"rst:h-[var(--roster-border-width,1px)] rst:flex-1 rst:bg-gray-200 rst:dark:bg-gray-800"}),r.jsx(t.Eyebrow,{children:i}),s==="start"&&r.jsx("span",{role:"presentation",className:"rst:h-[var(--roster-border-width,1px)] rst:flex-1 rst:bg-gray-200 rst:dark:bg-gray-800"}),e&&r.jsx(t.Eyebrow,{children:e})]}));a.displayName="LabeledDivider";exports.LabeledDivider=a;
@@ -2,13 +2,13 @@
2
2
  import { jsxs as l, jsx as r } from "react/jsx-runtime";
3
3
  import m from "react";
4
4
  import { cn as n } from "../../../lib/utils.js";
5
- import { Eyebrow as t } from "../Eyebrow/Eyebrow.js";
5
+ import { Eyebrow as s } from "../Eyebrow/Eyebrow.js";
6
6
  const p = m.forwardRef(
7
- ({ label: a, trailing: e, align: s = "start", className: o, ...i }, d) => /* @__PURE__ */ l("div", { ref: d, className: n("rst:font-ui rst:flex rst:items-center rst:gap-3", o), ...i, children: [
8
- s === "end" && /* @__PURE__ */ r("span", { role: "presentation", className: "rst:h-px rst:flex-1 rst:bg-gray-200 rst:dark:bg-gray-800" }),
9
- /* @__PURE__ */ r(t, { children: a }),
10
- s === "start" && /* @__PURE__ */ r("span", { role: "presentation", className: "rst:h-px rst:flex-1 rst:bg-gray-200 rst:dark:bg-gray-800" }),
11
- e && /* @__PURE__ */ r(t, { children: e })
7
+ ({ label: a, trailing: e, align: t = "start", className: o, ...d }, i) => /* @__PURE__ */ l("div", { ref: i, className: n("rst:font-ui rst:flex rst:items-center rst:gap-3", o), ...d, children: [
8
+ t === "end" && /* @__PURE__ */ r("span", { role: "presentation", className: "rst:h-[var(--roster-border-width,1px)] rst:flex-1 rst:bg-gray-200 rst:dark:bg-gray-800" }),
9
+ /* @__PURE__ */ r(s, { children: a }),
10
+ t === "start" && /* @__PURE__ */ r("span", { role: "presentation", className: "rst:h-[var(--roster-border-width,1px)] rst:flex-1 rst:bg-gray-200 rst:dark:bg-gray-800" }),
11
+ e && /* @__PURE__ */ r(s, { children: e })
12
12
  ] })
13
13
  );
14
14
  p.displayName = "LabeledDivider";
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),O=require("react"),B=require("../../../node_modules/@headlessui/react/dist/components/description/description.cjs"),H=require("../../../node_modules/@headlessui/react/dist/components/field/field.cjs"),M=require("../../../node_modules/@headlessui/react/dist/components/label/label.cjs"),x=require("../../../node_modules/@headlessui/react/dist/components/listbox/listbox.cjs"),Y=require("../../../node_modules/@headlessui/react/dist/components/transition/transition.cjs"),S=require("../../../node_modules/@fortawesome/react-fontawesome/dist/index.cjs"),T=require("../../../node_modules/@fortawesome/free-solid-svg-icons/index.cjs"),s=require("../../../lib/utils.cjs"),W=require("../Select/select-variants.cjs"),F=require("../Chip/Chip.cjs"),X=require("../../../internal/PopupOption.cjs"),c=require("../../../internal/popup.cjs"),G=({options:h,value:n,onChange:m,placeholder:b="Select options",disabled:o=!1,variant:f,size:i,error:R,className:_,triggerClassName:L,optionsClassName:D,helperText:v,errorMessage:p,label:g,display:u="chips",maxChips:N,clearable:j=!1,chipColorScheme:k="neutral",chipVariant:w="outline",clearLabel:A="Clear selection",removeLabel:E=l=>`Remove ${l}`,...U})=>{const l=!!p||R,a=n.length>0,y=new Map(h.map((r,e)=>[r.value,e])),d=n.map(r=>({value:r,label:h.find(e=>e.value===r)?.label??String(r)})).sort((r,e)=>(y.get(r.value)??Number.POSITIVE_INFINITY)-(y.get(e.value)??Number.POSITIVE_INFINITY)),P=N===void 0?d:d.slice(0,N),I=d.length-P.length,{ref:$,inDarkScope:C}=c.useDarkScope(),q=O.useRef(null);return t.jsxs(H.Field,{disabled:o,className:s.cn("rst:flex rst:flex-col rst:gap-1.5",_),...U,children:[g&&t.jsx(M.Label,{className:"rst:block rst:text-sm rst:font-medium rst:text-[var(--roster-control-text)] rst:text-left",children:g}),t.jsx(x.Listbox,{value:n,onChange:m,disabled:o,multiple:!0,children:t.jsxs("div",{ref:$,className:"rst:relative",children:[t.jsxs("div",{className:s.cn(W.selectTriggerVariants({variant:f,size:i,error:l}),"rst:h-auto rst:flex-wrap rst:items-center rst:gap-1.5 rst:py-1.5",i==="sm"?"rst:min-h-9":i==="lg"?"rst:min-h-11":"rst:min-h-10",j&&a&&"rst:pr-16","rst:focus-within:ring-2 rst:focus-within:ring-ring",o&&"rst:opacity-50 rst:cursor-not-allowed",L),children:[t.jsx(x.ListboxButton,{ref:q,"aria-invalid":l||void 0,className:"rst:absolute rst:inset-0 rst:h-full rst:w-full rst:cursor-pointer rst:rounded-md rst:focus:outline-hidden rst:disabled:cursor-not-allowed",children:t.jsx("span",{className:"rst:sr-only",children:a?u==="count"?`${n.length} selected`:d.map(r=>r.label).join(", "):b})}),!a&&t.jsx("span",{"aria-hidden":"true",className:"rst:pointer-events-none rst:relative rst:block rst:truncate rst:text-gray-500 rst:dark:text-gray-400",children:b}),a&&u==="count"&&t.jsxs("span",{"aria-hidden":"true",className:"rst:pointer-events-none rst:relative rst:block rst:truncate",children:[n.length," selected"]}),a&&u==="chips"&&P.map((r,e)=>t.jsx(F.Chip,{size:"sm",variant:w,colorScheme:k,disabled:o,onRemove:()=>m(n.filter(V=>V!==r.value)),removeLabel:E(r.label),className:s.cn("rst:relative rst:max-w-[12rem] rst:pointer-events-none","rst:[&_button]:pointer-events-auto","rst:text-inherit rst:border-current/70 rst:dark:text-inherit rst:dark:border-current/70"),children:t.jsx("span",{className:"rst:block rst:truncate",children:r.label})},`${e}-${String(r.value)}`)),I>0&&u==="chips"&&t.jsxs(F.Chip,{size:"sm",variant:w,colorScheme:k,"aria-hidden":"true",className:"rst:pointer-events-none rst:relative rst:text-inherit rst:border-current/70 rst:dark:text-inherit rst:dark:border-current/70",children:["+",I]}),t.jsx("span",{className:s.cn("rst:pointer-events-none rst:absolute rst:inset-y-0 rst:right-0 rst:flex rst:items-center",i==="sm"?"rst:pr-2.5":"rst:pr-3"),children:t.jsx(S.FontAwesomeIcon,{icon:T.faChevronDown,className:"rst:h-3.5 rst:w-3.5 rst:text-gray-400 rst:dark:text-gray-500","aria-hidden":"true"})}),j&&a&&t.jsx("button",{type:"button",disabled:o,onClick:()=>{m([]),q.current?.focus()},"aria-label":A,className:s.cn("rst:absolute rst:inset-y-0 rst:flex rst:w-6 rst:items-center rst:justify-center","rst:cursor-pointer rst:disabled:cursor-not-allowed","rst:text-current rst:opacity-70 rst:hover:opacity-100 rst:disabled:opacity-40","rst:focus:outline-hidden rst:focus-visible:ring-2 rst:focus-visible:ring-ring rst:rounded-sm",i==="sm"?"rst:right-7":"rst:right-8"),children:t.jsx(S.FontAwesomeIcon,{icon:T.faXmark,className:"rst:h-3.5 rst:w-3.5","aria-hidden":"true"})})]}),t.jsx(Y.Transition,{as:O.Fragment,leave:"rst:transition rst:ease-in rst:duration-100",leaveFrom:"rst:opacity-100",leaveTo:"rst:opacity-0",children:t.jsx(x.ListboxOptions,{anchor:c.POPUP_ANCHOR,className:s.cn(c.popupInDarkPalette(C,f)&&"dark",c.POPUP_PANEL,c.POPUP_WIDTH_OF_BUTTON,D),children:h.map(r=>t.jsx(X.PopupOption,{as:x.ListboxOption,value:r.value,disabled:r.disabled,size:i,children:r.label},r.value))})})]})}),(v||p)&&t.jsx(B.Description,{className:s.cn("rst:text-xs rst:text-left",l?"rst:text-error-600 rst:dark:text-error-400 rst:font-medium":"rst:text-gray-500 rst:dark:text-gray-400"),children:p||v})]})};exports.MultiSelect=G;
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),S=require("react"),Y=require("../../../node_modules/@headlessui/react/dist/components/description/description.cjs"),W=require("../../../node_modules/@headlessui/react/dist/components/field/field.cjs"),X=require("../../../node_modules/@headlessui/react/dist/components/label/label.cjs"),h=require("../../../node_modules/@headlessui/react/dist/components/listbox/listbox.cjs"),G=require("../../../node_modules/@headlessui/react/dist/components/transition/transition.cjs"),T=require("../../../node_modules/@fortawesome/react-fontawesome/dist/index.cjs"),F=require("../../../node_modules/@fortawesome/free-solid-svg-icons/index.cjs"),s=require("../../../lib/utils.cjs"),R=require("../../../internal/field-invalid.cjs"),J=require("../Select/select-variants.cjs"),_=require("../Chip/Chip.cjs"),K=require("../../../internal/PopupOption.cjs"),c=require("../../../internal/popup.cjs"),Q=({options:x,value:n,onChange:m,placeholder:v="Select options",disabled:a=!1,variant:f,size:i,error:L,className:D,triggerClassName:A,optionsClassName:E,helperText:b,errorMessage:p,label:g,display:u="chips",maxChips:N,clearable:j=!1,chipColorScheme:w="neutral",chipVariant:k="outline",clearLabel:U="Clear selection",removeLabel:$=l=>`Remove ${l}`,...I})=>{const l=!!p||L,C=R.isFieldInvalid(l,I),V=R.withoutInvalidProps(I),o=n.length>0,P=new Map(x.map((r,e)=>[r.value,e])),d=n.map(r=>({value:r,label:x.find(e=>e.value===r)?.label??String(r)})).sort((r,e)=>(P.get(r.value)??Number.POSITIVE_INFINITY)-(P.get(e.value)??Number.POSITIVE_INFINITY)),y=N===void 0?d:d.slice(0,N),q=d.length-y.length,{ref:B,inDarkScope:H}=c.useDarkScope(),O=S.useRef(null);return t.jsxs(W.Field,{disabled:a,className:s.cn("rst:flex rst:flex-col rst:gap-1.5",D),...V,children:[g&&t.jsx(X.Label,{className:"rst:block rst:text-sm rst:font-medium rst:text-[var(--roster-control-text)] rst:text-left",children:g}),t.jsx(h.Listbox,{value:n,onChange:m,disabled:a,multiple:!0,children:t.jsxs("div",{ref:B,className:"rst:relative",children:[t.jsxs("div",{className:s.cn(J.selectTriggerVariants({variant:f,size:i,error:l}),"rst:h-auto rst:flex-wrap rst:items-center rst:gap-1.5 rst:py-1.5",i==="sm"?"rst:min-h-9":i==="lg"?"rst:min-h-11":"rst:min-h-10",j&&o&&"rst:pr-16","rst:focus-within:ring-[length:calc(var(--roster-border-width,1px)+1px)] rst:focus-within:ring-ring",a&&"rst:opacity-50 rst:cursor-not-allowed",A),children:[t.jsx(h.ListboxButton,{ref:O,"aria-invalid":C||void 0,className:"rst:absolute rst:inset-0 rst:h-full rst:w-full rst:cursor-pointer rst:rounded-md rst:focus:outline-hidden rst:disabled:cursor-not-allowed",children:t.jsx("span",{className:"rst:sr-only",children:o?u==="count"?`${n.length} selected`:d.map(r=>r.label).join(", "):v})}),!o&&t.jsx("span",{"aria-hidden":"true",className:"rst:pointer-events-none rst:relative rst:block rst:truncate rst:text-gray-500 rst:dark:text-gray-400",children:v}),o&&u==="count"&&t.jsxs("span",{"aria-hidden":"true",className:"rst:pointer-events-none rst:relative rst:block rst:truncate",children:[n.length," selected"]}),o&&u==="chips"&&y.map((r,e)=>t.jsx(_.Chip,{size:"sm",variant:k,colorScheme:w,disabled:a,onRemove:()=>m(n.filter(M=>M!==r.value)),removeLabel:$(r.label),className:s.cn("rst:relative rst:max-w-[12rem] rst:pointer-events-none","rst:[&_button]:pointer-events-auto","rst:text-inherit rst:border-current/70 rst:dark:text-inherit rst:dark:border-current/70"),children:t.jsx("span",{className:"rst:block rst:truncate",children:r.label})},`${e}-${String(r.value)}`)),q>0&&u==="chips"&&t.jsxs(_.Chip,{size:"sm",variant:k,colorScheme:w,"aria-hidden":"true",className:"rst:pointer-events-none rst:relative rst:text-inherit rst:border-current/70 rst:dark:text-inherit rst:dark:border-current/70",children:["+",q]}),t.jsx("span",{className:s.cn("rst:pointer-events-none rst:absolute rst:inset-y-0 rst:right-0 rst:flex rst:items-center",i==="sm"?"rst:pr-2.5":"rst:pr-3"),children:t.jsx(T.FontAwesomeIcon,{icon:F.faChevronDown,className:"rst:h-3.5 rst:w-3.5 rst:text-gray-400 rst:dark:text-gray-500","aria-hidden":"true"})}),j&&o&&t.jsx("button",{type:"button",disabled:a,onClick:()=>{m([]),O.current?.focus()},"aria-label":U,className:s.cn("rst:absolute rst:inset-y-0 rst:flex rst:w-6 rst:items-center rst:justify-center","rst:cursor-pointer rst:disabled:cursor-not-allowed","rst:text-current rst:opacity-70 rst:hover:opacity-100 rst:disabled:opacity-40","rst:focus:outline-hidden rst:focus-visible:ring-2 rst:focus-visible:ring-ring rst:rounded-sm",i==="sm"?"rst:right-7":"rst:right-8"),children:t.jsx(T.FontAwesomeIcon,{icon:F.faXmark,className:"rst:h-3.5 rst:w-3.5","aria-hidden":"true"})})]}),t.jsx(G.Transition,{as:S.Fragment,leave:"rst:transition rst:ease-in rst:duration-100",leaveFrom:"rst:opacity-100",leaveTo:"rst:opacity-0",children:t.jsx(h.ListboxOptions,{anchor:c.POPUP_ANCHOR,className:s.cn(c.popupInDarkPalette(H,f)&&"dark",c.POPUP_PANEL,c.POPUP_WIDTH_OF_BUTTON,E),children:x.map(r=>t.jsx(K.PopupOption,{as:h.ListboxOption,value:r.value,disabled:r.disabled,size:i,children:r.label},r.value))})})]})}),(b||p)&&t.jsx(Y.Description,{className:s.cn("rst:text-xs rst:text-left",l?"rst:text-error-600 rst:dark:text-error-400 rst:font-medium":"rst:text-gray-500 rst:dark:text-gray-400"),children:p||b})]})};exports.MultiSelect=Q;