@blakesteve/roster 5.2.0 → 5.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),j=require("react"),a=require("../../../node_modules/@headlessui/react/dist/components/combobox/combobox.cjs"),_=require("../../../node_modules/@headlessui/react/dist/components/description/description.cjs"),w=require("../../../node_modules/@headlessui/react/dist/components/field/field.cjs"),F=require("../../../node_modules/@headlessui/react/dist/components/label/label.cjs"),I=require("../../../node_modules/@headlessui/react/dist/components/transition/transition.cjs"),L=require("../../../node_modules/@fortawesome/react-fontawesome/dist/index.cjs"),R=require("../../../node_modules/@fortawesome/free-solid-svg-icons/index.cjs"),c=require("../../../lib/utils.cjs"),T=require("../Input/input-variants.cjs"),U=require("../../../internal/PopupOption.cjs"),i=require("../../../internal/popup.cjs");function A(t){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(s,r,n.get?n:{enumerable:!0,get:()=>t[r]})}}return s.default=t,Object.freeze(s)}const V=A(j),E=(t,s)=>{const r=s.trim().toLowerCase();return r?t.filter(n=>n.label.toLowerCase().includes(r)):t},H=({options:t,value:s,onChange:r,placeholder:n="Search...",disabled:x=!1,variant:m,size:l,error:y,label:p,helperText:b,errorMessage:u,className:v,inputClassName:P,optionsClassName:O,emptyMessage:g="No matches",filter:q=E,...N})=>{const[C,f]=V.useState(""),{ref:k,inDarkScope:D}=i.useDarkScope(),d=!!u||y,h=q(t,C),S=t.find(o=>o.value===s)??null;return e.jsxs(w.Field,{disabled:x,className:c.cn("rst:flex rst:flex-col rst:gap-1.5",v),...N,children:[p&&e.jsx(F.Label,{className:"rst:block rst:text-sm rst:font-medium rst:text-[var(--roster-control-text)] rst:text-left",children:p}),e.jsx(a.Combobox,{value:s??null,onChange:r,disabled:x,children:e.jsxs("div",{ref:k,className:"rst:relative",children:[e.jsx(a.ComboboxInput,{"aria-invalid":d||void 0,className:c.cn(T.inputVariants({variant:m,size:l,error:d}),P,"rst:pr-9"),placeholder:n,displayValue:()=>S?.label??"",onChange:o=>f(o.target.value)}),e.jsx(a.ComboboxButton,{className:c.cn("rst:absolute rst:inset-y-0 rst:right-0 rst:flex rst:w-11 rst:cursor-pointer rst:items-center rst:justify-end",l==="sm"?"rst:pr-2.5":"rst:pr-3"),children:e.jsx(L.FontAwesomeIcon,{icon:R.faChevronDown,className:"rst:h-3.5 rst:w-3.5 rst:text-gray-400 rst:dark:text-gray-500","aria-hidden":"true"})}),e.jsx(I.Transition,{as:j.Fragment,leave:"rst:transition rst:ease-in rst:duration-100",leaveFrom:"rst:opacity-100",leaveTo:"rst:opacity-0",afterLeave:()=>f(""),children:e.jsx(a.ComboboxOptions,{anchor:i.POPUP_ANCHOR,className:c.cn(i.popupInDarkPalette(D,m)&&"dark",i.POPUP_PANEL,i.POPUP_WIDTH_OF_INPUT,O),children:h.length===0?e.jsx(a.ComboboxOption,{value:"",disabled:!0,className:c.cn("rst:px-4 rst:py-2.5 rst:text-sm rst:opacity-70",l==="sm"&&"rst:px-3 rst:py-2"),children:g}):h.map(o=>e.jsx(U.PopupOption,{as:a.ComboboxOption,value:o.value,disabled:o.disabled,size:l,children:o.label},o.value))})})]})}),(b||u)&&e.jsx(_.Description,{className:c.cn("rst:text-xs rst:text-left",d?"rst:text-error-600 rst:dark:text-error-400 rst:font-medium":"rst:text-gray-500 rst:dark:text-gray-400"),children:u||b})]})};exports.Combobox=H;
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),y=require("react"),a=require("../../../node_modules/@headlessui/react/dist/components/combobox/combobox.cjs"),F=require("../../../node_modules/@headlessui/react/dist/components/description/description.cjs"),L=require("../../../node_modules/@headlessui/react/dist/components/field/field.cjs"),R=require("../../../node_modules/@headlessui/react/dist/components/label/label.cjs"),T=require("../../../node_modules/@headlessui/react/dist/components/transition/transition.cjs"),U=require("../../../node_modules/@fortawesome/react-fontawesome/dist/index.cjs"),A=require("../../../node_modules/@fortawesome/free-solid-svg-icons/index.cjs"),i=require("../../../lib/utils.cjs"),j=require("../../../internal/field-invalid.cjs"),V=require("../Input/input-variants.cjs"),E=require("../../../internal/PopupOption.cjs"),l=require("../../../internal/popup.cjs");function H(t){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const o=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(s,r,o.get?o:{enumerable:!0,get:()=>t[r]})}}return s.default=t,Object.freeze(s)}const B=H(y),Q=(t,s)=>{const r=s.trim().toLowerCase();return r?t.filter(o=>o.label.toLowerCase().includes(r)):t},W=({options:t,value:s,onChange:r,placeholder:o="Search...",disabled:x=!1,variant:m,size:c,error:P,label:p,helperText:b,errorMessage:u,className:q,inputClassName:O,optionsClassName:g,emptyMessage:N="No matches",filter:C=Q,...f})=>{const[k,v]=B.useState(""),{ref:w,inDarkScope:D}=l.useDarkScope(),d=!!u||P,I=j.isFieldInvalid(d,f),S=j.withoutInvalidProps(f),h=C(t,k),_=t.find(n=>n.value===s)??null;return e.jsxs(L.Field,{disabled:x,className:i.cn("rst:flex rst:flex-col rst:gap-1.5",q),...S,children:[p&&e.jsx(R.Label,{className:"rst:block rst:text-sm rst:font-medium rst:text-[var(--roster-control-text)] rst:text-left",children:p}),e.jsx(a.Combobox,{value:s??null,onChange:r,disabled:x,children:e.jsxs("div",{ref:w,className:"rst:relative",children:[e.jsx(a.ComboboxInput,{"aria-invalid":I||void 0,className:i.cn(V.inputVariants({variant:m,size:c,error:d}),O,"rst:pr-9"),placeholder:o,displayValue:()=>_?.label??"",onChange:n=>v(n.target.value)}),e.jsx(a.ComboboxButton,{className:i.cn("rst:absolute rst:inset-y-0 rst:right-0 rst:flex rst:w-11 rst:cursor-pointer rst:items-center rst:justify-end",c==="sm"?"rst:pr-2.5":"rst:pr-3"),children:e.jsx(U.FontAwesomeIcon,{icon:A.faChevronDown,className:"rst:h-3.5 rst:w-3.5 rst:text-gray-400 rst:dark:text-gray-500","aria-hidden":"true"})}),e.jsx(T.Transition,{as:y.Fragment,leave:"rst:transition rst:ease-in rst:duration-100",leaveFrom:"rst:opacity-100",leaveTo:"rst:opacity-0",afterLeave:()=>v(""),children:e.jsx(a.ComboboxOptions,{anchor:l.POPUP_ANCHOR,className:i.cn(l.popupInDarkPalette(D,m)&&"dark",l.POPUP_PANEL,l.POPUP_WIDTH_OF_INPUT,g),children:h.length===0?e.jsx(a.ComboboxOption,{value:"",disabled:!0,className:i.cn("rst:px-4 rst:py-2.5 rst:text-sm rst:opacity-70",c==="sm"&&"rst:px-3 rst:py-2"),children:N}):h.map(n=>e.jsx(E.PopupOption,{as:a.ComboboxOption,value:n.value,disabled:n.disabled,size:c,children:n.label},n.value))})})]})}),(b||u)&&e.jsx(F.Description,{className:i.cn("rst:text-xs rst:text-left",d?"rst:text-error-600 rst:dark:text-error-400 rst:font-medium":"rst:text-gray-500 rst:dark:text-gray-400"),children:u||b})]})};exports.Combobox=W;
@@ -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 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 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:f="Select options",disabled:a=!1,variant:v,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:k="neutral",chipVariant:w="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:v,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-2 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(", "):f})}),!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:f}),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:w,colorScheme:k,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: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:["+",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,v)&&"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;