@pibit.ai/cure-design-system 0.6.1 → 0.6.3

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.
@@ -54,6 +54,8 @@ export interface SearchableSelectProps extends Omit<AriaSelectProps<SelectItemTy
54
54
  endAdornment?: ReactNode;
55
55
  /** Rendered before the selected label in the trigger. */
56
56
  leadingAdornment?: ReactNode;
57
+ /** When true, the trigger shows the selected item's supporting text beside the label, as the options do. */
58
+ inlineSupportingText?: boolean;
57
59
  }
58
- export declare const SearchableSelect: ({ placeholder, placeholderIcon, size, items, label, hint, tooltip, className, footer, textStyles, popoverClassName, onSearchChange, onSelectionChange, isLoading, isClearable, openOnClear, isDeselectable, searchPlaceholder, selectedDisplayValue, renderItem, endAdornment, leadingAdornment, shouldFilterItems, filterItem, ...rest }: SearchableSelectProps) => import("react/jsx-runtime").JSX.Element;
60
+ export declare const SearchableSelect: ({ placeholder, placeholderIcon, size, items, label, hint, tooltip, className, footer, textStyles, popoverClassName, onSearchChange, onSelectionChange, isLoading, isClearable, openOnClear, isDeselectable, searchPlaceholder, selectedDisplayValue, renderItem, endAdornment, leadingAdornment, inlineSupportingText, shouldFilterItems, filterItem, ...rest }: SearchableSelectProps) => import("react/jsx-runtime").JSX.Element;
59
61
  //# sourceMappingURL=searchable-select.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"searchable-select.d.ts","sourceRoot":"","sources":["../../../src/primitives/select/searchable-select.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAiB,SAAS,EAAE,MAAM,OAAO,CAAC;AAG1D,OAAO,KAAK,EAEV,WAAW,IAAI,eAAe,EAC/B,MAAM,uBAAuB,CAAC;AAW/B,OAAO,EAIL,KAAK,cAAc,EACpB,MAAM,iBAAiB,CAAC;AAwBzB,MAAM,WAAW,qBAAsB,SAAQ,IAAI,CACjD,eAAe,CAAC,cAAc,CAAC,EAC/B,UAAU,GAAG,OAAO,GAAG,mBAAmB,CAC3C;IACC,mGAAmG;IACnG,KAAK,EAAE,cAAc,EAAE,CAAC;IACxB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,kEAAkE;IAClE,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC;IAC9D,mDAAmD;IACnD,cAAc,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/C,wCAAwC;IACxC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,iCAAiC;IACjC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,6BAA6B;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,4BAA4B;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,mBAAmB;IACnB,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAC1B,gDAAgD;IAChD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,wCAAwC;IACxC,eAAe,CAAC,EAAE,EAAE,GAAG,SAAS,CAAC;IACjC,gCAAgC;IAChC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,yBAAyB;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,2DAA2D;IAC3D,iBAAiB,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IACjD,2GAA2G;IAC3G,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,2GAA2G;IAC3G,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,mCAAmC;IACnC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,oEAAoE;IACpE,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,4DAA4D;IAC5D,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,8CAA8C;IAC9C,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,cAAc,KAAK,SAAS,CAAC;IACjD,6DAA6D;IAC7D,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,yDAAyD;IACzD,gBAAgB,CAAC,EAAE,SAAS,CAAC;CAC9B;AAyND,eAAO,MAAM,gBAAgB,GAAI,2UA0B9B,qBAAqB,4CAoQvB,CAAC"}
1
+ {"version":3,"file":"searchable-select.d.ts","sourceRoot":"","sources":["../../../src/primitives/select/searchable-select.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAiB,SAAS,EAAE,MAAM,OAAO,CAAC;AAG1D,OAAO,KAAK,EAEV,WAAW,IAAI,eAAe,EAC/B,MAAM,uBAAuB,CAAC;AAW/B,OAAO,EAIL,KAAK,cAAc,EACpB,MAAM,iBAAiB,CAAC;AAwBzB,MAAM,WAAW,qBAAsB,SAAQ,IAAI,CACjD,eAAe,CAAC,cAAc,CAAC,EAC/B,UAAU,GAAG,OAAO,GAAG,mBAAmB,CAC3C;IACC,mGAAmG;IACnG,KAAK,EAAE,cAAc,EAAE,CAAC;IACxB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,kEAAkE;IAClE,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC;IAC9D,mDAAmD;IACnD,cAAc,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/C,wCAAwC;IACxC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,iCAAiC;IACjC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,6BAA6B;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,4BAA4B;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,mBAAmB;IACnB,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAC1B,gDAAgD;IAChD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,wCAAwC;IACxC,eAAe,CAAC,EAAE,EAAE,GAAG,SAAS,CAAC;IACjC,gCAAgC;IAChC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,yBAAyB;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,2DAA2D;IAC3D,iBAAiB,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IACjD,2GAA2G;IAC3G,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,2GAA2G;IAC3G,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,mCAAmC;IACnC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,oEAAoE;IACpE,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,4DAA4D;IAC5D,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,8CAA8C;IAC9C,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,cAAc,KAAK,SAAS,CAAC;IACjD,6DAA6D;IAC7D,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,yDAAyD;IACzD,gBAAgB,CAAC,EAAE,SAAS,CAAC;IAC7B,4GAA4G;IAC5G,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC;AAiPD,eAAO,MAAM,gBAAgB,GAAI,iWA2B9B,qBAAqB,4CAsQvB,CAAC"}
@@ -1,162 +1,185 @@
1
- import { jsx as r, jsxs as w, Fragment as H } from "react/jsx-runtime";
2
- import { useState as J, useRef as Q, useCallback as B, useMemo as Y, isValidElement as fe } from "react";
3
- import { ChevronDown as Z, XClose as pe } from "@untitledui/icons";
4
- import { Select as me, ListBox as xe, Button as he, SelectValue as be, ButtonContext as ge } from "react-aria-components";
5
- import { Avatar as ve } from "../avatar/avatar.js";
6
- import { Popover as we } from "./popover.js";
7
- import { SelectItem as Ne } from "./select-item.js";
8
- import { SelectContext as ye, fontSizes as U, sizes as ke } from "./select-shared.js";
9
- import { HintText as Pe } from "../input/hint-text.js";
10
- import { Label as Te } from "../input/label.js";
11
- import { cx as a } from "../../utils/cn.js";
12
- import { isReactComponent as qe } from "../../utils/is-react-component.js";
13
- import { LoadingIndicator as Se } from "../../applications/loading-indicator/loading-indicator.js";
14
- import Be from "./SearchInput.js";
15
- const Ke = {
1
+ import { jsx as e, jsxs as h, Fragment as _ } from "react/jsx-runtime";
2
+ import { useState as Y, useRef as Z, useCallback as R, useMemo as $, isValidElement as pe } from "react";
3
+ import { ChevronDown as I, XClose as me } from "@untitledui/icons";
4
+ import { Select as xe, ListBox as he, Button as be, SelectValue as ge, ButtonContext as ve } from "react-aria-components";
5
+ import { Avatar as we } from "../avatar/avatar.js";
6
+ import { Popover as Ne } from "./popover.js";
7
+ import { SelectItem as ke } from "./select-item.js";
8
+ import { SelectContext as ye, fontSizes as k, sizes as Pe } from "./select-shared.js";
9
+ import { HintText as Te } from "../input/hint-text.js";
10
+ import { Label as qe } from "../input/label.js";
11
+ import { cx as o } from "../../utils/cn.js";
12
+ import { isReactComponent as Be } from "../../utils/is-react-component.js";
13
+ import { LoadingIndicator as Ke } from "../../applications/loading-indicator/loading-indicator.js";
14
+ import Re from "./SearchInput.js";
15
+ const De = {
16
16
  sm: "rounded-md",
17
17
  md: "rounded-md",
18
18
  lg: "rounded-lg"
19
- }, Re = {
19
+ }, Se = {
20
20
  sm: "text-xs",
21
21
  md: "text-sm",
22
22
  lg: "text-md"
23
- }, De = "relative flex w-full cursor-pointer items-center bg-primary ring-1 outline-hidden transition duration-100 ease-linear ring-inset", je = (p, N) => {
24
- const s = N.trim().toLowerCase();
25
- if (!s) return !0;
26
- const u = String(p.label ?? "").toLowerCase(), x = String(p.supportingText ?? "").toLowerCase(), o = String(p.id ?? "").toLowerCase();
27
- return u.includes(s) || x.includes(s) || o.includes(s);
28
- }, ze = {
23
+ }, je = "relative flex w-full cursor-pointer items-center bg-primary ring-1 outline-hidden transition duration-100 ease-linear ring-inset", Oe = (m, y) => {
24
+ const i = y.trim().toLowerCase();
25
+ if (!i) return !0;
26
+ const u = String(m.label ?? "").toLowerCase(), b = String(m.supportingText ?? "").toLowerCase(), l = String(m.id ?? "").toLowerCase();
27
+ return u.includes(i) || b.includes(i) || l.includes(i);
28
+ }, Ue = {
29
29
  sm: "size-4",
30
30
  md: "size-4",
31
31
  lg: "size-5"
32
- }, Oe = ({
33
- isOpen: p,
34
- isFocused: N,
35
- isDisabled: s,
32
+ }, Fe = ({
33
+ isOpen: m,
34
+ isFocused: y,
35
+ isDisabled: i,
36
36
  isInvalid: u,
37
- isLoading: x,
38
- size: o = "sm",
39
- placeholder: F,
40
- placeholderIcon: y,
41
- textStyles: k,
42
- selectedDisplayValue: P,
43
- isClearable: L = !1,
44
- onClear: i,
45
- hasSelection: l = !1,
37
+ isLoading: b,
38
+ size: l = "sm",
39
+ placeholder: V,
40
+ placeholderIcon: P,
41
+ textStyles: g,
42
+ selectedDisplayValue: T,
43
+ isClearable: z = !1,
44
+ onClear: a,
45
+ hasSelection: s = !1,
46
46
  endAdornment: d,
47
- triggerSelectedItem: K = null,
48
- hasSupportingText: T = !1,
49
- leadingAdornment: m
47
+ triggerSelectedItem: D = null,
48
+ hasSupportingText: q = !1,
49
+ leadingAdornment: x,
50
+ inlineSupportingText: M = !1
50
51
  }) => {
51
- const V = L && l && !s && i;
52
- return /* @__PURE__ */ r(
53
- he,
52
+ const S = z && s && !i && a;
53
+ return /* @__PURE__ */ e(
54
+ be,
54
55
  {
55
- className: a(
56
- De,
57
- Ke[o],
58
- u ? "ring-error" : N || p ? "ring-brand" : "ring-secondary",
59
- s && "cursor-not-allowed bg-disabled_subtle text-disabled"
56
+ className: o(
57
+ je,
58
+ De[l],
59
+ u ? "ring-error" : y || m ? "ring-brand" : "ring-secondary",
60
+ i && "cursor-not-allowed bg-disabled_subtle text-disabled"
60
61
  ),
61
- children: /* @__PURE__ */ r(
62
- be,
62
+ children: /* @__PURE__ */ e(
63
+ ge,
63
64
  {
64
- className: a(
65
+ className: o(
65
66
  "flex h-max w-full items-center justify-start gap-2 text-left align-middle",
66
- T ? "px-2 pt-3 pb-3" : a("truncate", ke[o].root),
67
+ q ? "px-2 pt-3 pb-3" : o("truncate", Pe[l].root),
67
68
  "*:data-icon:size-5 *:data-icon:shrink-0 *:data-icon:text-fg-quaternary in-disabled:*:data-icon:text-fg-disabled"
68
69
  ),
69
- children: (R) => {
70
- const n = K ?? R.selectedItem, h = (n == null ? void 0 : n.icon) || y, b = !!n, g = !b && !!P;
71
- return x && !b && !g ? /* @__PURE__ */ w(H, { children: [
72
- /* @__PURE__ */ r("div", { className: "h-3.5 min-w-0 flex-1 animate-pulse rounded bg-secondary" }),
73
- /* @__PURE__ */ r(
74
- Z,
70
+ children: (j) => {
71
+ const r = D ?? j.selectedItem, v = (r == null ? void 0 : r.icon) || P, f = !!r, w = !f && !!T;
72
+ return b && !f && !w ? /* @__PURE__ */ h(_, { children: [
73
+ /* @__PURE__ */ e("div", { className: "h-3.5 min-w-0 flex-1 animate-pulse rounded bg-secondary" }),
74
+ /* @__PURE__ */ e(
75
+ I,
75
76
  {
76
77
  "aria-hidden": "true",
77
- className: a(
78
+ className: o(
78
79
  "shrink-0 text-fg-quaternary",
79
- o === "sm" ? "size-4 stroke-[2.5px]" : "size-5"
80
+ l === "sm" ? "size-4 stroke-[2.5px]" : "size-5"
80
81
  )
81
82
  }
82
83
  )
83
- ] }) : /* @__PURE__ */ w(H, { children: [
84
- n != null && n.avatarUrl ? /* @__PURE__ */ r(
85
- ve,
84
+ ] }) : /* @__PURE__ */ h(_, { children: [
85
+ r != null && r.avatarUrl ? /* @__PURE__ */ e(
86
+ we,
86
87
  {
87
88
  size: "xs",
88
- src: n.avatarUrl,
89
- alt: n.label
89
+ src: r.avatarUrl,
90
+ alt: r.label
90
91
  }
91
- ) : qe(h) ? /* @__PURE__ */ r(h, { "data-icon": !0, "aria-hidden": "true" }) : fe(h) ? h : null,
92
- m && (b || g) ? /* @__PURE__ */ r("div", { className: "flex shrink-0 items-center self-center", children: m }) : null,
93
- b ? /* @__PURE__ */ w("section", { className: "flex min-w-0 flex-1 flex-col gap-0.5", children: [
94
- /* @__PURE__ */ r(
92
+ ) : Be(v) ? /* @__PURE__ */ e(v, { "data-icon": !0, "aria-hidden": "true" }) : pe(v) ? v : null,
93
+ x && (f || w) ? /* @__PURE__ */ e("div", { className: "flex shrink-0 items-center self-center", children: x }) : null,
94
+ f && M ? /* @__PURE__ */ h("section", { className: "flex min-w-0 flex-1 items-center gap-2", children: [
95
+ /* @__PURE__ */ e(
96
+ "p",
97
+ {
98
+ className: o(
99
+ "shrink-0 truncate font-medium text-primary",
100
+ k[l],
101
+ g
102
+ ),
103
+ children: r == null ? void 0 : r.label
104
+ }
105
+ ),
106
+ (r == null ? void 0 : r.supportingText) && /* @__PURE__ */ e(
95
107
  "p",
96
108
  {
97
- className: a(
109
+ className: o(
110
+ "min-w-0 truncate text-tertiary",
111
+ k[l]
112
+ ),
113
+ children: r == null ? void 0 : r.supportingText
114
+ }
115
+ )
116
+ ] }) : f ? /* @__PURE__ */ h("section", { className: "flex min-w-0 flex-1 flex-col gap-0.5", children: [
117
+ /* @__PURE__ */ e(
118
+ "p",
119
+ {
120
+ className: o(
98
121
  "truncate font-medium text-primary",
99
- U[o],
100
- k
122
+ k[l],
123
+ g
101
124
  ),
102
- children: n == null ? void 0 : n.label
125
+ children: r == null ? void 0 : r.label
103
126
  }
104
127
  ),
105
- (n == null ? void 0 : n.supportingText) && /* @__PURE__ */ r(
128
+ (r == null ? void 0 : r.supportingText) && /* @__PURE__ */ e(
106
129
  "p",
107
130
  {
108
- className: a(
131
+ className: o(
109
132
  "truncate text-xs",
110
- (n == null ? void 0 : n.supportingTextClassName) ?? "text-[#818792]"
133
+ (r == null ? void 0 : r.supportingTextClassName) ?? "text-[#818792]"
111
134
  ),
112
- children: n == null ? void 0 : n.supportingText
135
+ children: r == null ? void 0 : r.supportingText
113
136
  }
114
137
  )
115
- ] }) : g ? /* @__PURE__ */ r("section", { className: "flex min-w-0 flex-1 gap-2 truncate", children: /* @__PURE__ */ r(
138
+ ] }) : w ? /* @__PURE__ */ e("section", { className: "flex min-w-0 flex-1 gap-2 truncate", children: /* @__PURE__ */ e(
116
139
  "p",
117
140
  {
118
- className: a(
141
+ className: o(
119
142
  "truncate font-medium text-primary",
120
- U[o],
121
- k
143
+ k[l],
144
+ g
122
145
  ),
123
- children: P
146
+ children: T
124
147
  }
125
- ) }) : /* @__PURE__ */ r(
148
+ ) }) : /* @__PURE__ */ e(
126
149
  "p",
127
150
  {
128
- className: a(
151
+ className: o(
129
152
  "min-w-0 flex-1 text-placeholder_subtle",
130
- U[o],
131
- s && "text-disabled"
153
+ k[l],
154
+ i && "text-disabled"
132
155
  ),
133
- children: F
156
+ children: V
134
157
  }
135
158
  ),
136
- d ? /* @__PURE__ */ r(ge.Provider, { value: null, children: /* @__PURE__ */ r("div", { className: "flex shrink-0 items-center self-center", children: d }) }) : null,
137
- V ? /* @__PURE__ */ r(
159
+ d ? /* @__PURE__ */ e(ve.Provider, { value: null, children: /* @__PURE__ */ e("div", { className: "flex shrink-0 items-center self-center", children: d }) }) : null,
160
+ S ? /* @__PURE__ */ e(
138
161
  "button",
139
162
  {
140
163
  type: "button",
141
164
  tabIndex: -1,
142
165
  "aria-label": "Clear selection",
143
- onPointerDown: (v) => {
144
- v.stopPropagation();
166
+ onPointerDown: (N) => {
167
+ N.stopPropagation();
145
168
  },
146
- onClick: (v) => {
147
- v.preventDefault(), v.stopPropagation(), i == null || i();
169
+ onClick: (N) => {
170
+ N.preventDefault(), N.stopPropagation(), a == null || a();
148
171
  },
149
172
  className: "flex shrink-0 cursor-pointer items-center justify-center rounded-md p-1 text-fg-quaternary outline-hidden transition hover:bg-primary_hover focus-visible:outline-2 focus-visible:outline-offset-0 focus-visible:outline-focus-ring",
150
- children: /* @__PURE__ */ r(pe, { "aria-hidden": !0, className: ze[o] })
173
+ children: /* @__PURE__ */ e(me, { "aria-hidden": !0, className: Ue[l] })
151
174
  }
152
175
  ) : null,
153
- /* @__PURE__ */ r(
154
- Z,
176
+ /* @__PURE__ */ e(
177
+ I,
155
178
  {
156
179
  "aria-hidden": "true",
157
- className: a(
180
+ className: o(
158
181
  "shrink-0 text-fg-quaternary",
159
- o === "sm" ? "size-4 stroke-[2.5px]" : "size-5"
182
+ l === "sm" ? "size-4 stroke-[2.5px]" : "size-5"
160
183
  )
161
184
  }
162
185
  )
@@ -166,190 +189,192 @@ const Ke = {
166
189
  )
167
190
  }
168
191
  );
169
- }, Qe = ({
170
- placeholder: p = "Select",
171
- placeholderIcon: N,
172
- size: s = "sm",
192
+ }, Ze = ({
193
+ placeholder: m = "Select",
194
+ placeholderIcon: y,
195
+ size: i = "sm",
173
196
  items: u,
174
- label: x,
175
- hint: o,
176
- tooltip: F,
177
- className: y,
178
- footer: k,
179
- textStyles: P,
180
- popoverClassName: L,
181
- onSearchChange: i,
182
- onSelectionChange: l,
197
+ label: b,
198
+ hint: l,
199
+ tooltip: V,
200
+ className: P,
201
+ footer: g,
202
+ textStyles: T,
203
+ popoverClassName: z,
204
+ onSearchChange: a,
205
+ onSelectionChange: s,
183
206
  isLoading: d = !1,
184
- isClearable: K = !1,
185
- openOnClear: T = !1,
186
- isDeselectable: m = !1,
187
- searchPlaceholder: V = "Search...",
188
- selectedDisplayValue: R,
189
- renderItem: n,
190
- endAdornment: h,
191
- leadingAdornment: b,
192
- shouldFilterItems: g = !0,
193
- filterItem: v,
194
- ...$
207
+ isClearable: D = !1,
208
+ openOnClear: q = !1,
209
+ isDeselectable: x = !1,
210
+ searchPlaceholder: M = "Search...",
211
+ selectedDisplayValue: S,
212
+ renderItem: j,
213
+ endAdornment: r,
214
+ leadingAdornment: v,
215
+ inlineSupportingText: f = !1,
216
+ shouldFilterItems: w = !0,
217
+ filterItem: N,
218
+ ...C
195
219
  }) => {
196
- const [M, _] = J(""), [C, ee] = J(!1), A = Q(!1), I = Q(null), {
197
- selectedKey: E,
198
- isOpen: W,
199
- onOpenChange: D,
200
- ...re
201
- } = $, c = E == null || String(E) === "" ? null : E, j = W !== void 0, z = T || j, te = j ? W : z ? C : void 0, ne = B(
202
- (t) => {
203
- _(t), i == null || i(t);
220
+ const [A, W] = Y(""), [ee, re] = Y(!1), E = Z(!1), X = Z(null), {
221
+ selectedKey: H,
222
+ isOpen: G,
223
+ onOpenChange: O,
224
+ ...te
225
+ } = C, c = H == null || String(H) === "" ? null : H, U = G !== void 0, F = q || U, ne = U ? G : F ? ee : void 0, le = R(
226
+ (n) => {
227
+ W(n), a == null || a(n);
204
228
  },
205
- [i]
206
- ), X = v ?? je, q = Y(() => {
207
- if (!g) return u;
208
- const t = M.trim();
209
- return t ? u.filter((e) => X(e, t)) : u;
210
- }, [X, M, u, g]), le = (t) => {
211
- var G;
212
- if (t.key !== "ArrowDown" && t.key !== "ArrowUp" || t.nativeEvent.isComposing || !(t.target instanceof HTMLInputElement) || (t.preventDefault(), t.stopPropagation(), d || q.length === 0)) return;
213
- const e = (G = I.current) == null ? void 0 : G.querySelectorAll(
229
+ [a]
230
+ ), J = N ?? Oe, B = $(() => {
231
+ if (!w) return u;
232
+ const n = A.trim();
233
+ return n ? u.filter((t) => J(t, n)) : u;
234
+ }, [J, A, u, w]), se = (n) => {
235
+ var Q;
236
+ if (n.key !== "ArrowDown" && n.key !== "ArrowUp" || n.nativeEvent.isComposing || !(n.target instanceof HTMLInputElement) || (n.preventDefault(), n.stopPropagation(), d || B.length === 0)) return;
237
+ const t = (Q = X.current) == null ? void 0 : Q.querySelectorAll(
214
238
  '[role="option"]:not([aria-disabled="true"])'
215
- ), f = t.key === "ArrowDown" ? e == null ? void 0 : e[0] : e == null ? void 0 : e[e.length - 1];
216
- f == null || f.focus({ preventScroll: !0 }), f == null || f.scrollIntoView({ block: "nearest" });
217
- }, S = B(
218
- (t) => {
219
- !j && z && ee(t), t || (_(""), i == null || i("")), D == null || D(t);
239
+ ), p = n.key === "ArrowDown" ? t == null ? void 0 : t[0] : t == null ? void 0 : t[t.length - 1];
240
+ p == null || p.focus({ preventScroll: !0 }), p == null || p.scrollIntoView({ block: "nearest" });
241
+ }, K = R(
242
+ (n) => {
243
+ !U && F && re(n), n || (W(""), a == null || a("")), O == null || O(n);
220
244
  },
221
- [j, z, D, i]
222
- ), se = B(() => {
223
- l == null || l(null), T && S(!0);
224
- }, [T, l, S]), oe = B(() => {
225
- !m || c == null || (A.current = !0, l == null || l(null), S(!1), queueMicrotask(() => {
226
- A.current = !1;
245
+ [U, F, O, a]
246
+ ), oe = R(() => {
247
+ s == null || s(null), q && K(!0);
248
+ }, [q, s, K]), ie = R(() => {
249
+ !x || c == null || (E.current = !0, s == null || s(null), K(!1), queueMicrotask(() => {
250
+ E.current = !1;
227
251
  }));
228
- }, [S, m, l, c]), ie = B(
229
- (t) => {
230
- if (A.current) return;
231
- const e = t == null || String(t) === "" ? null : String(t), f = c == null || String(c) === "" ? null : String(c);
232
- e !== f && (l == null || l(e));
252
+ }, [K, x, s, c]), ae = R(
253
+ (n) => {
254
+ if (E.current) return;
255
+ const t = n == null || String(n) === "" ? null : String(n), p = c == null || String(c) === "" ? null : String(c);
256
+ t !== p && (s == null || s(t));
233
257
  },
234
- [l, c]
235
- ), ae = c != null || !!R, O = Y(
236
- () => c == null ? null : u.find((t) => String(t.id) === String(c)) ?? null,
258
+ [s, c]
259
+ ), ce = c != null || !!S, L = $(
260
+ () => c == null ? null : u.find((n) => String(n.id) === String(c)) ?? null,
237
261
  [u, c]
238
- ), ce = !!(O != null && O.supportingText), ue = [{ id: "none", label: "none" }], de = q.length > 0 ? q : ue;
239
- return /* @__PURE__ */ r(
262
+ ), ue = !f && !!(L != null && L.supportingText), de = [{ id: "none", label: "none" }], fe = B.length > 0 ? B : de;
263
+ return /* @__PURE__ */ e(
240
264
  ye.Provider,
241
265
  {
242
266
  value: {
243
- size: s,
244
- isDeselectable: m,
267
+ size: i,
268
+ isDeselectable: x,
245
269
  selectedKey: c,
246
- onReselectCurrent: m ? oe : void 0
270
+ onReselectCurrent: x ? ie : void 0
247
271
  },
248
- children: /* @__PURE__ */ r(
249
- me,
272
+ children: /* @__PURE__ */ e(
273
+ xe,
250
274
  {
251
- ...re,
275
+ ...te,
252
276
  selectedKey: c,
253
- ...z ? { isOpen: te } : {},
254
- onOpenChange: S,
255
- onSelectionChange: ie,
256
- className: (t) => a(
277
+ ...F ? { isOpen: ne } : {},
278
+ onOpenChange: K,
279
+ onSelectionChange: ae,
280
+ className: (n) => o(
257
281
  "flex flex-col gap-1.5",
258
- typeof y == "function" ? y(t) : y
282
+ typeof P == "function" ? P(n) : P
259
283
  ),
260
- children: (t) => /* @__PURE__ */ w(H, { children: [
261
- x && /* @__PURE__ */ r(
262
- Te,
284
+ children: (n) => /* @__PURE__ */ h(_, { children: [
285
+ b && /* @__PURE__ */ e(
286
+ qe,
263
287
  {
264
- isRequired: t.isRequired,
265
- tooltip: F,
266
- className: Re[s],
267
- children: x
288
+ isRequired: n.isRequired,
289
+ tooltip: V,
290
+ className: Se[i],
291
+ children: b
268
292
  }
269
293
  ),
270
- /* @__PURE__ */ r(
271
- Oe,
294
+ /* @__PURE__ */ e(
295
+ Fe,
272
296
  {
273
- ...t,
274
- size: s,
297
+ ...n,
298
+ size: i,
275
299
  isLoading: d,
276
- placeholder: p,
277
- placeholderIcon: N,
278
- textStyles: P,
279
- selectedDisplayValue: R,
280
- isClearable: K,
281
- hasSelection: ae,
282
- hasSupportingText: ce,
283
- triggerSelectedItem: O,
284
- leadingAdornment: b,
285
- onClear: K && l ? se : void 0,
286
- endAdornment: h
300
+ placeholder: m,
301
+ placeholderIcon: y,
302
+ textStyles: T,
303
+ selectedDisplayValue: S,
304
+ isClearable: D,
305
+ hasSelection: ce,
306
+ hasSupportingText: ue,
307
+ triggerSelectedItem: L,
308
+ leadingAdornment: v,
309
+ inlineSupportingText: f,
310
+ onClear: D && s ? oe : void 0,
311
+ endAdornment: r
287
312
  }
288
313
  ),
289
- /* @__PURE__ */ w(
290
- we,
314
+ /* @__PURE__ */ h(
315
+ Ne,
291
316
  {
292
- size: s,
293
- className: a("flex flex-col overflow-hidden", L),
317
+ size: i,
318
+ className: o("flex flex-col overflow-hidden", z),
294
319
  children: [
295
- /* @__PURE__ */ r(
320
+ /* @__PURE__ */ e(
296
321
  "div",
297
322
  {
298
323
  className: "z-10 shrink-0 border-b border-tertiary bg-primary p-1.5",
299
- onMouseDown: (e) => e.stopPropagation(),
300
- onPointerDown: (e) => e.stopPropagation(),
301
- onClick: (e) => e.stopPropagation(),
302
- onKeyDownCapture: le,
303
- children: /* @__PURE__ */ r(
304
- Be,
324
+ onMouseDown: (t) => t.stopPropagation(),
325
+ onPointerDown: (t) => t.stopPropagation(),
326
+ onClick: (t) => t.stopPropagation(),
327
+ onKeyDownCapture: se,
328
+ children: /* @__PURE__ */ e(
329
+ Re,
305
330
  {
306
331
  size: "sm",
307
- placeholder: V,
308
- value: M,
309
- onChange: (e) => ne(e),
310
- onKeyDown: (e) => e.stopPropagation(),
332
+ placeholder: M,
333
+ value: A,
334
+ onChange: (t) => le(t),
335
+ onKeyDown: (t) => t.stopPropagation(),
311
336
  className: "w-full ring-0 outline-hidden bg-secondary rounded-lg",
312
337
  autoFocus: !0
313
338
  }
314
339
  )
315
340
  }
316
341
  ),
317
- /* @__PURE__ */ w("div", { className: "flex min-h-0 flex-1 flex-col overflow-hidden", children: [
318
- d && /* @__PURE__ */ r("div", { className: "flex items-center justify-center py-6", children: /* @__PURE__ */ r(Se, { size: "xs", type: "line-simple" }) }),
319
- !d && q.length === 0 && /* @__PURE__ */ r("div", { className: "flex items-center justify-center py-6", children: /* @__PURE__ */ r("p", { className: a("text-tertiary", U[s]), children: "No results" }) }),
320
- /* @__PURE__ */ r(
321
- xe,
342
+ /* @__PURE__ */ h("div", { className: "flex min-h-0 flex-1 flex-col overflow-hidden", children: [
343
+ d && /* @__PURE__ */ e("div", { className: "flex items-center justify-center py-6", children: /* @__PURE__ */ e(Ke, { size: "xs", type: "line-simple" }) }),
344
+ !d && B.length === 0 && /* @__PURE__ */ e("div", { className: "flex items-center justify-center py-6", children: /* @__PURE__ */ e("p", { className: o("text-tertiary", k[i]), children: "No results" }) }),
345
+ /* @__PURE__ */ e(
346
+ he,
322
347
  {
323
- ref: I,
324
- items: de,
348
+ ref: X,
349
+ items: fe,
325
350
  shouldFocusOnHover: !1,
326
351
  shouldFocusWrap: !0,
327
- className: a(
352
+ className: o(
328
353
  "min-h-0 overflow-y-auto outline-hidden px-1",
329
- (d || q.length === 0) && "hidden"
354
+ (d || B.length === 0) && "hidden"
330
355
  ),
331
- children: (e) => n ? n(e) : /* @__PURE__ */ r(
332
- Ne,
356
+ children: (t) => j ? j(t) : /* @__PURE__ */ e(
357
+ ke,
333
358
  {
334
- id: e.id,
335
- label: e.label,
336
- avatarUrl: e.avatarUrl,
337
- supportingText: e.supportingText,
338
- supportingTextClassName: e.supportingTextClassName,
339
- isDisabled: e.isDisabled,
340
- icon: e.icon,
341
- textStyles: P
359
+ id: t.id,
360
+ label: t.label,
361
+ avatarUrl: t.avatarUrl,
362
+ supportingText: t.supportingText,
363
+ supportingTextClassName: t.supportingTextClassName,
364
+ isDisabled: t.isDisabled,
365
+ icon: t.icon,
366
+ textStyles: T
342
367
  },
343
- e.id
368
+ t.id
344
369
  )
345
370
  }
346
371
  )
347
372
  ] }),
348
- k && /* @__PURE__ */ r("div", { className: "shrink-0 border-t border-tertiary bg-primary p-1.5", children: k })
373
+ g && /* @__PURE__ */ e("div", { className: "shrink-0 border-t border-tertiary bg-primary p-1.5", children: g })
349
374
  ]
350
375
  }
351
376
  ),
352
- o && /* @__PURE__ */ r(Pe, { isInvalid: t.isInvalid, children: o })
377
+ l && /* @__PURE__ */ e(Te, { isInvalid: n.isInvalid, children: l })
353
378
  ] })
354
379
  }
355
380
  )
@@ -357,5 +382,5 @@ const Ke = {
357
382
  );
358
383
  };
359
384
  export {
360
- Qe as SearchableSelect
385
+ Ze as SearchableSelect
361
386
  };