@pibit.ai/cure-design-system 0.6.4 → 0.6.6
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.
- package/dist/applications/date-picker/calendar.d.ts +1 -1
- package/dist/applications/date-picker/calendar.d.ts.map +1 -1
- package/dist/applications/date-picker/calendar.js +162 -157
- package/dist/applications/date-picker/cell.d.ts.map +1 -1
- package/dist/applications/date-picker/cell.js +58 -51
- package/dist/applications/date-picker/date-input.d.ts +2 -2
- package/dist/applications/date-picker/date-input.d.ts.map +1 -1
- package/dist/applications/date-picker/date-input.js +21 -17
- package/dist/applications/date-picker/date-picker.d.ts +4 -1
- package/dist/applications/date-picker/date-picker.d.ts.map +1 -1
- package/dist/applications/date-picker/date-picker.js +136 -116
- package/dist/applications/date-picker/date-range-picker.d.ts +4 -0
- package/dist/applications/date-picker/date-range-picker.d.ts.map +1 -1
- package/dist/applications/date-picker/date-range-picker.js +245 -197
- package/dist/applications/date-picker/date-time-calendar.d.ts +1 -1
- package/dist/applications/date-picker/date-time-calendar.d.ts.map +1 -1
- package/dist/applications/date-picker/date-time-calendar.js +70 -60
- package/dist/applications/date-picker/range-calendar.d.ts +1 -1
- package/dist/applications/date-picker/range-calendar.d.ts.map +1 -1
- package/dist/applications/date-picker/range-calendar.js +99 -90
- package/dist/applications/date-picker/range-preset.d.ts +4 -1
- package/dist/applications/date-picker/range-preset.d.ts.map +1 -1
- package/dist/applications/date-picker/range-preset.js +23 -17
- package/dist/applications/date-picker/sizes.d.ts +12 -0
- package/dist/applications/date-picker/sizes.d.ts.map +1 -0
- package/dist/applications/date-picker/sizes.js +22 -0
- package/dist/applications/date-picker/styles.js +1 -1
- package/dist/applications/date-picker/time-field.js +21 -21
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +167 -166
- package/dist/patterns/table/TableWrapper.d.ts.map +1 -1
- package/dist/patterns/table/TableWrapper.js +122 -121
- package/dist/patterns/table/toolbar/ToolbarRadio.d.ts.map +1 -1
- package/dist/patterns/table/toolbar/ToolbarRadio.js +17 -16
- package/dist/patterns/table-component/TableComponent.d.ts.map +1 -1
- package/dist/patterns/table-component/TableComponent.js +100 -99
- package/dist/primitives/checkbox/checkbox.d.ts +53 -19
- package/dist/primitives/checkbox/checkbox.d.ts.map +1 -1
- package/dist/primitives/checkbox/checkbox.js +164 -45
- package/dist/primitives/checkbox/index.d.ts +1 -1
- package/dist/primitives/checkbox/index.d.ts.map +1 -1
- package/dist/primitives/dropdown/dropdown.d.ts.map +1 -1
- package/dist/primitives/dropdown/dropdown.js +18 -18
- package/dist/primitives/select/multi-select.d.ts.map +1 -1
- package/dist/primitives/select/multi-select.js +419 -422
- package/dist/primitives/toggle/toggle.d.ts.map +1 -1
- package/dist/primitives/toggle/toggle.js +4 -1
- package/dist/styles/components.css +1 -1
- package/package.json +1 -1
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useId as
|
|
1
|
+
import { jsx as s, jsxs as M, Fragment as me } from "react/jsx-runtime";
|
|
2
|
+
import { useId as ge, useCallback as L, useMemo as B, useRef as G, useState as ue, createContext as we, useContext as H, useLayoutEffect as ye } from "react";
|
|
3
3
|
import { useFilter as be, useInteractOutside as xe, FocusScope as ve, useFocusManager as De } from "react-aria";
|
|
4
|
-
import {
|
|
5
|
-
import { ComboBox as
|
|
4
|
+
import { ChevronDown as Ne, SearchMd as ke } from "@untitledui/icons";
|
|
5
|
+
import { ComboBox as Te, ListBox as Se, ComboBoxStateContext as Z, ButtonContext as ee, Group as Re, Input as Fe } from "react-aria-components";
|
|
6
6
|
import { useListData as Ae } from "../../node_modules/react-stately/dist/private/data/useListData.js";
|
|
7
|
-
import { Avatar as
|
|
8
|
-
import { HintText as
|
|
9
|
-
import { Label as
|
|
10
|
-
import { Popover as
|
|
11
|
-
import { sizes as
|
|
12
|
-
import { TagCloseX as
|
|
13
|
-
import { SelectItem as
|
|
7
|
+
import { Avatar as Me } from "../avatar/avatar.js";
|
|
8
|
+
import { HintText as Ee } from "../input/hint-text.js";
|
|
9
|
+
import { Label as Pe } from "../input/label.js";
|
|
10
|
+
import { Popover as Ke } from "./popover.js";
|
|
11
|
+
import { sizes as Le } from "./select-shared.js";
|
|
12
|
+
import { TagCloseX as ze } from "../tags/base-components/tag-close-x.js";
|
|
13
|
+
import { SelectItem as Oe } from "./select-item.js";
|
|
14
14
|
import { cx as k } from "../../utils/cn.js";
|
|
15
|
-
import { getPlatformShortcutLabel as
|
|
16
|
-
import { useResizeObserver as
|
|
17
|
-
import { SelectCheckbox as
|
|
18
|
-
import { multiSelectItemMatchesFilter as oe,
|
|
15
|
+
import { getPlatformShortcutLabel as qe } from "../../utils/keyboard-shortcut.js";
|
|
16
|
+
import { useResizeObserver as de } from "../../hooks/use-resize-observer.js";
|
|
17
|
+
import { SelectCheckbox as _e } from "./select-checkbox.js";
|
|
18
|
+
import { multiSelectItemMatchesFilter as oe, getMultiSelectSelectAllLabel as We, shouldClearMultiSelectFilterOnSelection as je } from "./multi-select-utils.js";
|
|
19
19
|
const Ve = {
|
|
20
20
|
sm: "py-1.5 px-2 min-h-8 h-auto",
|
|
21
21
|
md: "py-1.5 px-3 min-h-9 h-auto",
|
|
22
22
|
lg: "py-2.5 px-3.5 min-h-11 h-auto"
|
|
23
23
|
};
|
|
24
|
-
function
|
|
25
|
-
return (
|
|
26
|
-
for (const
|
|
27
|
-
|
|
24
|
+
function Ge(...c) {
|
|
25
|
+
return (y) => {
|
|
26
|
+
for (const d of c)
|
|
27
|
+
d != null && (typeof d == "function" ? d(y) : d.current = y);
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
|
-
const
|
|
30
|
+
const te = {
|
|
31
31
|
sm: "text-xs",
|
|
32
32
|
md: "text-sm",
|
|
33
33
|
lg: "text-md"
|
|
@@ -36,94 +36,94 @@ const I = {
|
|
|
36
36
|
md: "text-sm",
|
|
37
37
|
lg: "text-sm"
|
|
38
38
|
};
|
|
39
|
-
function
|
|
40
|
-
return document.getElementById(
|
|
39
|
+
function He(c) {
|
|
40
|
+
return document.getElementById(c);
|
|
41
41
|
}
|
|
42
|
-
function
|
|
43
|
-
triggerRef:
|
|
44
|
-
popoverRef:
|
|
42
|
+
function $e({
|
|
43
|
+
triggerRef: c,
|
|
44
|
+
popoverRef: y
|
|
45
45
|
}) {
|
|
46
|
-
const
|
|
46
|
+
const d = H(Z);
|
|
47
47
|
return xe({
|
|
48
|
-
ref:
|
|
49
|
-
isDisabled: !(
|
|
50
|
-
onInteractOutside: (
|
|
51
|
-
var
|
|
52
|
-
(
|
|
48
|
+
ref: y,
|
|
49
|
+
isDisabled: !(d != null && d.isOpen),
|
|
50
|
+
onInteractOutside: (m) => {
|
|
51
|
+
var l;
|
|
52
|
+
(l = c.current) != null && l.contains(m.target) || d == null || d.close();
|
|
53
53
|
}
|
|
54
54
|
}), null;
|
|
55
55
|
}
|
|
56
|
-
function
|
|
57
|
-
const
|
|
58
|
-
|
|
56
|
+
function re(c) {
|
|
57
|
+
const y = c.target;
|
|
58
|
+
y instanceof Element && y.closest("input, textarea, [contenteditable='true']") || c.preventDefault();
|
|
59
59
|
}
|
|
60
60
|
const Ue = ({
|
|
61
|
-
value:
|
|
62
|
-
placeholder:
|
|
63
|
-
listboxId:
|
|
64
|
-
onChange:
|
|
61
|
+
value: c,
|
|
62
|
+
placeholder: y,
|
|
63
|
+
listboxId: d,
|
|
64
|
+
onChange: m
|
|
65
65
|
}) => {
|
|
66
|
-
const
|
|
67
|
-
e.stopPropagation(),
|
|
68
|
-
},
|
|
69
|
-
e.stopPropagation(),
|
|
70
|
-
},
|
|
66
|
+
const l = H(Z), b = (e) => {
|
|
67
|
+
e.stopPropagation(), l == null || l.open();
|
|
68
|
+
}, T = (e) => {
|
|
69
|
+
e.stopPropagation(), re(e);
|
|
70
|
+
}, p = (e) => {
|
|
71
71
|
e.stopPropagation();
|
|
72
|
-
},
|
|
72
|
+
}, a = (e) => {
|
|
73
73
|
var r;
|
|
74
|
-
const
|
|
74
|
+
const o = He(d), g = o ? Array.from(o.querySelectorAll('[role="option"]')) : [];
|
|
75
75
|
switch (e.key) {
|
|
76
76
|
case "ArrowDown":
|
|
77
|
-
e.preventDefault(),
|
|
77
|
+
e.preventDefault(), g.length > 0 && ((o == null ? void 0 : o.querySelector(
|
|
78
78
|
'[role="option"][data-focused="true"]'
|
|
79
|
-
)) ??
|
|
79
|
+
)) ?? g[0]).focus();
|
|
80
80
|
return;
|
|
81
81
|
case "ArrowUp":
|
|
82
|
-
e.preventDefault(),
|
|
82
|
+
e.preventDefault(), g.length > 0 && g[g.length - 1].focus();
|
|
83
83
|
return;
|
|
84
84
|
case "Enter":
|
|
85
85
|
if (((r = document.activeElement) == null ? void 0 : r.getAttribute("role")) === "option")
|
|
86
86
|
return;
|
|
87
|
-
|
|
87
|
+
g.length > 0 && (e.preventDefault(), ((o == null ? void 0 : o.querySelector(
|
|
88
88
|
'[role="option"][data-focused="true"]'
|
|
89
|
-
)) ??
|
|
89
|
+
)) ?? g[0]).click());
|
|
90
90
|
return;
|
|
91
91
|
case "Escape":
|
|
92
|
-
e.preventDefault(),
|
|
92
|
+
e.preventDefault(), l == null || l.close();
|
|
93
93
|
return;
|
|
94
94
|
default:
|
|
95
95
|
(e.key.length === 1 || e.key === "Backspace" || e.key === "Delete" || e.key === "ArrowLeft" || e.key === "ArrowRight" || e.key === "Home" || e.key === "End" || e.key === "Tab") && e.stopPropagation();
|
|
96
96
|
}
|
|
97
97
|
};
|
|
98
|
-
return /* @__PURE__ */
|
|
98
|
+
return /* @__PURE__ */ s(
|
|
99
99
|
"div",
|
|
100
100
|
{
|
|
101
101
|
"data-nested-select-overlay": !0,
|
|
102
102
|
className: "sticky top-0 z-10 border-b border-tertiary bg-primary p-1.5",
|
|
103
|
-
onMouseDown:
|
|
104
|
-
onPointerDown:
|
|
103
|
+
onMouseDown: T,
|
|
104
|
+
onPointerDown: p,
|
|
105
105
|
onClick: (e) => e.stopPropagation(),
|
|
106
|
-
children: /* @__PURE__ */
|
|
106
|
+
children: /* @__PURE__ */ M(
|
|
107
107
|
"div",
|
|
108
108
|
{
|
|
109
109
|
className: "flex h-8 items-center gap-2 rounded-lg bg-secondary px-2",
|
|
110
|
-
onMouseDown:
|
|
110
|
+
onMouseDown: T,
|
|
111
111
|
children: [
|
|
112
|
-
/* @__PURE__ */
|
|
113
|
-
/* @__PURE__ */
|
|
112
|
+
/* @__PURE__ */ s(ke, { "aria-hidden": !0, className: "size-4 shrink-0 text-fg-quaternary" }),
|
|
113
|
+
/* @__PURE__ */ s(
|
|
114
114
|
"input",
|
|
115
115
|
{
|
|
116
116
|
type: "text",
|
|
117
117
|
role: "combobox",
|
|
118
118
|
"aria-autocomplete": "list",
|
|
119
|
-
"aria-expanded": (
|
|
120
|
-
"aria-controls":
|
|
121
|
-
value:
|
|
122
|
-
onChange:
|
|
123
|
-
onMouseDown:
|
|
124
|
-
onKeyDown:
|
|
125
|
-
onFocus: () =>
|
|
126
|
-
placeholder:
|
|
119
|
+
"aria-expanded": (l == null ? void 0 : l.isOpen) ?? !1,
|
|
120
|
+
"aria-controls": d,
|
|
121
|
+
value: c,
|
|
122
|
+
onChange: m,
|
|
123
|
+
onMouseDown: b,
|
|
124
|
+
onKeyDown: a,
|
|
125
|
+
onFocus: () => l == null ? void 0 : l.open(),
|
|
126
|
+
placeholder: y,
|
|
127
127
|
className: "w-full bg-transparent text-xs text-primary outline-none placeholder:text-placeholder_subtle",
|
|
128
128
|
autoFocus: !1
|
|
129
129
|
}
|
|
@@ -133,7 +133,7 @@ const Ue = ({
|
|
|
133
133
|
)
|
|
134
134
|
}
|
|
135
135
|
);
|
|
136
|
-
},
|
|
136
|
+
}, fe = we({
|
|
137
137
|
size: "sm",
|
|
138
138
|
selectedKeys: [],
|
|
139
139
|
selectedItems: {},
|
|
@@ -145,324 +145,321 @@ const Ue = ({
|
|
|
145
145
|
chipClassName: void 0,
|
|
146
146
|
searchable: !1
|
|
147
147
|
}), Xe = ({
|
|
148
|
-
items:
|
|
149
|
-
children:
|
|
150
|
-
size:
|
|
151
|
-
selectedItems:
|
|
152
|
-
onItemCleared:
|
|
153
|
-
onItemInserted:
|
|
154
|
-
onBulkSelectionChange:
|
|
155
|
-
shortcut:
|
|
156
|
-
placeholder:
|
|
148
|
+
items: c,
|
|
149
|
+
children: y,
|
|
150
|
+
size: d = "sm",
|
|
151
|
+
selectedItems: m,
|
|
152
|
+
onItemCleared: l,
|
|
153
|
+
onItemInserted: b,
|
|
154
|
+
onBulkSelectionChange: T,
|
|
155
|
+
shortcut: p,
|
|
156
|
+
placeholder: a = "Search",
|
|
157
157
|
showAvatar: e = !0,
|
|
158
|
-
readOnly:
|
|
159
|
-
chipClassName:
|
|
158
|
+
readOnly: o = !1,
|
|
159
|
+
chipClassName: g,
|
|
160
160
|
searchable: r = !1,
|
|
161
|
-
searchPlaceholder:
|
|
162
|
-
showSelectAll:
|
|
161
|
+
searchPlaceholder: S = "Search...",
|
|
162
|
+
showSelectAll: R = !1,
|
|
163
163
|
endAdornment: $,
|
|
164
|
-
description:
|
|
164
|
+
description: j,
|
|
165
165
|
onOpenChange: u,
|
|
166
166
|
// Omit these props to avoid conflicts with the `Select` component
|
|
167
167
|
name: h,
|
|
168
|
-
className:
|
|
169
|
-
...
|
|
168
|
+
className: F,
|
|
169
|
+
...f
|
|
170
170
|
}) => {
|
|
171
|
-
var
|
|
172
|
-
const
|
|
173
|
-
(
|
|
174
|
-
[
|
|
175
|
-
),
|
|
176
|
-
(
|
|
177
|
-
const
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
171
|
+
var ae;
|
|
172
|
+
const _ = ge(), { contains: V } = be({ sensitivity: "base" }), E = (ae = m == null ? void 0 : m.items) != null && ae.length ? m.items.map((n) => n.id) : [], v = L(
|
|
173
|
+
(n) => E.some((i) => String(i) === String(n)),
|
|
174
|
+
[E]
|
|
175
|
+
), X = L(
|
|
176
|
+
(n, i) => {
|
|
177
|
+
const A = oe(
|
|
178
|
+
n,
|
|
179
|
+
i,
|
|
180
|
+
V
|
|
181
181
|
);
|
|
182
|
-
return (
|
|
182
|
+
return (R || !v(n.id)) && A;
|
|
183
183
|
},
|
|
184
|
-
[
|
|
185
|
-
),
|
|
186
|
-
initialItems:
|
|
187
|
-
filter:
|
|
188
|
-
}),
|
|
189
|
-
(
|
|
190
|
-
) :
|
|
191
|
-
if (
|
|
192
|
-
const
|
|
193
|
-
(
|
|
184
|
+
[V, v, R]
|
|
185
|
+
), w = Ae({
|
|
186
|
+
initialItems: c,
|
|
187
|
+
filter: X
|
|
188
|
+
}), z = !!(r && w.filterText.trim()), D = B(() => c != null && c.length ? z ? c.filter(
|
|
189
|
+
(n) => oe(n, w.filterText, V)
|
|
190
|
+
) : c : [], [c, z, w.filterText, V]), P = B(() => {
|
|
191
|
+
if (D.length === 0) return "unselected";
|
|
192
|
+
const n = D.filter(
|
|
193
|
+
(i) => v(i.id)
|
|
194
194
|
).length;
|
|
195
|
-
return
|
|
196
|
-
}, [
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
195
|
+
return n === 0 ? "unselected" : n === D.length ? "selected" : "indeterminate";
|
|
196
|
+
}, [D, v]), t = G(!1), N = L(() => {
|
|
197
|
+
t.current = !0, setTimeout(() => {
|
|
198
|
+
t.current = !1;
|
|
199
|
+
}, 0);
|
|
200
|
+
}, []), J = L(() => {
|
|
201
|
+
N();
|
|
202
|
+
const n = P !== "selected", i = D.map((x) => x.id), A = new Set(i.map(String)), K = n ? [.../* @__PURE__ */ new Set([...E, ...i])] : E.filter((x) => !A.has(String(x))), W = D.filter((x) => !v(x.id)), U = D.filter((x) => v(x.id)).map((x) => x.id);
|
|
203
|
+
if (n && W.length > 0 ? m.append(...W) : !n && U.length > 0 && m.remove(...U), T) {
|
|
204
|
+
T(K);
|
|
200
205
|
return;
|
|
201
206
|
}
|
|
202
|
-
if (
|
|
203
|
-
for (const
|
|
204
|
-
x
|
|
207
|
+
if (n) {
|
|
208
|
+
for (const x of D)
|
|
209
|
+
v(x.id) || b == null || b(x.id);
|
|
205
210
|
return;
|
|
206
211
|
}
|
|
207
|
-
for (const
|
|
208
|
-
x
|
|
212
|
+
for (const x of D)
|
|
213
|
+
v(x.id) && (l == null || l(x.id));
|
|
209
214
|
}, [
|
|
210
|
-
|
|
215
|
+
N,
|
|
216
|
+
P,
|
|
217
|
+
D,
|
|
218
|
+
E,
|
|
219
|
+
m,
|
|
220
|
+
v,
|
|
211
221
|
T,
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
]), F = K(
|
|
219
|
-
(t) => {
|
|
220
|
-
const c = t.values().next().value;
|
|
221
|
-
c && (p.remove(c), i == null || i(c));
|
|
222
|
+
b,
|
|
223
|
+
l
|
|
224
|
+
]), Q = L(
|
|
225
|
+
(n) => {
|
|
226
|
+
const i = n.values().next().value;
|
|
227
|
+
i && (m.remove(i), l == null || l(i));
|
|
222
228
|
},
|
|
223
|
-
[
|
|
224
|
-
),
|
|
225
|
-
if (
|
|
229
|
+
[m, l]
|
|
230
|
+
), O = G(null), Y = (n) => {
|
|
231
|
+
if (n == null || t.current)
|
|
226
232
|
return;
|
|
227
|
-
const
|
|
228
|
-
if (
|
|
233
|
+
const i = String(n);
|
|
234
|
+
if (O.current === i)
|
|
229
235
|
return;
|
|
230
|
-
|
|
231
|
-
|
|
236
|
+
O.current = i, setTimeout(() => {
|
|
237
|
+
O.current === i && (O.current = null);
|
|
232
238
|
}, 0);
|
|
233
|
-
const
|
|
234
|
-
if (
|
|
235
|
-
if (
|
|
236
|
-
const
|
|
237
|
-
|
|
239
|
+
const A = w.getItem(n) ?? (c == null ? void 0 : c.find((K) => String(K.id) === String(n)));
|
|
240
|
+
if (A) {
|
|
241
|
+
if (v(n)) {
|
|
242
|
+
const K = E.find((W) => String(W) === i) ?? n;
|
|
243
|
+
m.remove(K), l == null || l(K);
|
|
238
244
|
} else
|
|
239
|
-
|
|
240
|
-
|
|
245
|
+
m.append(A), b == null || b(n);
|
|
246
|
+
je(r) && w.setFilterText("");
|
|
241
247
|
}
|
|
242
|
-
},
|
|
243
|
-
(
|
|
244
|
-
|
|
245
|
-
return;
|
|
246
|
-
const c = Array.from(t);
|
|
247
|
-
for (const v of R)
|
|
248
|
-
c.some((E) => String(E) === String(v)) || (p.remove(v), i == null || i(v));
|
|
249
|
-
for (const v of c)
|
|
250
|
-
if (!x(v)) {
|
|
251
|
-
const E = m.getItem(v) ?? (s == null ? void 0 : s.find((V) => String(V.id) === String(v)));
|
|
252
|
-
E && (p.append(E), w == null || w(v));
|
|
253
|
-
}
|
|
254
|
-
ae(r) && m.setFilterText("");
|
|
248
|
+
}, pe = L(
|
|
249
|
+
(n) => {
|
|
250
|
+
n || (O.current = null, t.current = !1, r && w.setFilterText("")), u == null || u(n);
|
|
255
251
|
},
|
|
256
|
-
[
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
(t) => {
|
|
269
|
-
!t && r && m.setFilterText(""), u == null || u(t);
|
|
270
|
-
},
|
|
271
|
-
[m, u, r]
|
|
272
|
-
), ee = (t) => {
|
|
273
|
-
a || m.setFilterText(t);
|
|
274
|
-
}, _ = G(null), te = G(null), [he, re] = ue(0), Z = K(() => {
|
|
275
|
-
var c;
|
|
276
|
-
if (!_.current) return;
|
|
277
|
-
let t = (c = _.current) == null ? void 0 : c.getBoundingClientRect();
|
|
278
|
-
re(t.width);
|
|
279
|
-
}, [_, re]);
|
|
280
|
-
fe({
|
|
281
|
-
ref: _,
|
|
282
|
-
onResize: Z,
|
|
252
|
+
[w, u, r]
|
|
253
|
+
), ne = (n) => {
|
|
254
|
+
o || w.setFilterText(n);
|
|
255
|
+
}, q = G(null), C = G(null), [he, ie] = ue(0), I = L(() => {
|
|
256
|
+
var i;
|
|
257
|
+
if (!q.current) return;
|
|
258
|
+
let n = (i = q.current) == null ? void 0 : i.getBoundingClientRect();
|
|
259
|
+
ie(n.width);
|
|
260
|
+
}, [q, ie]);
|
|
261
|
+
de({
|
|
262
|
+
ref: q,
|
|
263
|
+
onResize: I,
|
|
283
264
|
box: "border-box"
|
|
284
265
|
});
|
|
285
|
-
const
|
|
286
|
-
return /* @__PURE__ */
|
|
287
|
-
|
|
266
|
+
const se = R && !!(c != null && c.length) && (!z || D.length > 0), le = We(z);
|
|
267
|
+
return /* @__PURE__ */ s(
|
|
268
|
+
fe.Provider,
|
|
288
269
|
{
|
|
289
270
|
value: {
|
|
290
|
-
size:
|
|
291
|
-
selectedKeys:
|
|
292
|
-
selectedItems:
|
|
293
|
-
onInputChange:
|
|
294
|
-
onRemove:
|
|
271
|
+
size: d,
|
|
272
|
+
selectedKeys: E,
|
|
273
|
+
selectedItems: m,
|
|
274
|
+
onInputChange: ne,
|
|
275
|
+
onRemove: Q,
|
|
295
276
|
showAvatar: e,
|
|
296
|
-
chipClassName:
|
|
277
|
+
chipClassName: g,
|
|
297
278
|
searchable: r
|
|
298
279
|
},
|
|
299
|
-
children: /* @__PURE__ */
|
|
300
|
-
|
|
280
|
+
children: /* @__PURE__ */ s(
|
|
281
|
+
Te,
|
|
301
282
|
{
|
|
302
283
|
allowsEmptyCollection: !0,
|
|
303
284
|
allowsCustomValue: !1,
|
|
304
|
-
menuTrigger: r ||
|
|
305
|
-
items:
|
|
306
|
-
onInputChange: r ? void 0 :
|
|
307
|
-
inputValue: r ? "" :
|
|
285
|
+
menuTrigger: r || o ? "manual" : "focus",
|
|
286
|
+
items: w.items,
|
|
287
|
+
onInputChange: r ? void 0 : ne,
|
|
288
|
+
inputValue: r ? "" : w.filterText,
|
|
308
289
|
selectedKey: null,
|
|
309
|
-
onSelectionChange:
|
|
310
|
-
onOpenChange:
|
|
311
|
-
...
|
|
312
|
-
children: (
|
|
313
|
-
/* @__PURE__ */
|
|
314
|
-
|
|
290
|
+
onSelectionChange: Y,
|
|
291
|
+
onOpenChange: pe,
|
|
292
|
+
...f,
|
|
293
|
+
children: (n) => /* @__PURE__ */ M("div", { className: "flex flex-col gap-1.5", children: [
|
|
294
|
+
/* @__PURE__ */ s(
|
|
295
|
+
$e,
|
|
315
296
|
{
|
|
316
|
-
triggerRef:
|
|
317
|
-
popoverRef:
|
|
297
|
+
triggerRef: q,
|
|
298
|
+
popoverRef: C
|
|
318
299
|
}
|
|
319
300
|
),
|
|
320
|
-
|
|
321
|
-
|
|
301
|
+
f.label && /* @__PURE__ */ s(
|
|
302
|
+
Pe,
|
|
322
303
|
{
|
|
323
|
-
isRequired:
|
|
324
|
-
tooltip:
|
|
325
|
-
className: ce[
|
|
326
|
-
children:
|
|
304
|
+
isRequired: n.isRequired,
|
|
305
|
+
tooltip: f.tooltip,
|
|
306
|
+
className: ce[d],
|
|
307
|
+
children: f.label
|
|
327
308
|
}
|
|
328
309
|
),
|
|
329
|
-
|
|
310
|
+
j && /* @__PURE__ */ s(
|
|
330
311
|
"p",
|
|
331
312
|
{
|
|
332
313
|
className: k(
|
|
333
314
|
"text-tertiary",
|
|
334
|
-
ce[
|
|
315
|
+
ce[d],
|
|
335
316
|
"-mt-0.5 leading-[18px]"
|
|
336
317
|
),
|
|
337
|
-
children:
|
|
318
|
+
children: j
|
|
338
319
|
}
|
|
339
320
|
),
|
|
340
|
-
/* @__PURE__ */
|
|
321
|
+
/* @__PURE__ */ s(
|
|
341
322
|
Qe,
|
|
342
323
|
{
|
|
343
|
-
size:
|
|
344
|
-
shortcut:
|
|
345
|
-
ref:
|
|
346
|
-
placeholder:
|
|
347
|
-
readOnly:
|
|
348
|
-
isInvalid:
|
|
324
|
+
size: d,
|
|
325
|
+
shortcut: p,
|
|
326
|
+
ref: q,
|
|
327
|
+
placeholder: a,
|
|
328
|
+
readOnly: o,
|
|
329
|
+
isInvalid: n.isInvalid,
|
|
349
330
|
endAdornment: $,
|
|
350
|
-
onFocus:
|
|
351
|
-
onPointerEnter:
|
|
331
|
+
onFocus: I,
|
|
332
|
+
onPointerEnter: I
|
|
352
333
|
}
|
|
353
334
|
),
|
|
354
|
-
(r ||
|
|
355
|
-
|
|
335
|
+
(r || se || w.items.length > 0) && /* @__PURE__ */ s(
|
|
336
|
+
Ke,
|
|
356
337
|
{
|
|
357
338
|
size: "md",
|
|
358
|
-
ref:
|
|
359
|
-
triggerRef:
|
|
360
|
-
className: k("flex flex-col",
|
|
339
|
+
ref: C,
|
|
340
|
+
triggerRef: q,
|
|
341
|
+
className: k("flex flex-col", f == null ? void 0 : f.popoverClassName),
|
|
361
342
|
style: { width: Math.max(he, 40) },
|
|
362
|
-
onMouseDown: (
|
|
363
|
-
|
|
343
|
+
onMouseDown: (i) => {
|
|
344
|
+
i.stopPropagation(), re(i);
|
|
364
345
|
},
|
|
365
|
-
onPointerDown: (
|
|
366
|
-
children:
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
346
|
+
onPointerDown: (i) => i.stopPropagation(),
|
|
347
|
+
children: /* @__PURE__ */ M(
|
|
348
|
+
"div",
|
|
349
|
+
{
|
|
350
|
+
className: "flex min-h-0 w-full flex-1 flex-col",
|
|
351
|
+
onMouseDownCapture: (i) => {
|
|
352
|
+
var W, U;
|
|
353
|
+
if (re(i), !i.defaultPrevented)
|
|
354
|
+
return;
|
|
355
|
+
const A = (W = q.current) == null ? void 0 : W.querySelector("input"), K = document.activeElement;
|
|
356
|
+
A && K !== A && !((U = C.current) != null && U.contains(K)) && A.focus({ preventScroll: !0 });
|
|
357
|
+
},
|
|
358
|
+
children: [
|
|
359
|
+
r && /* @__PURE__ */ s(
|
|
360
|
+
Ue,
|
|
361
|
+
{
|
|
362
|
+
listboxId: _,
|
|
363
|
+
value: w.filterText,
|
|
364
|
+
placeholder: S,
|
|
365
|
+
onChange: (i) => w.setFilterText(i.target.value)
|
|
366
|
+
}
|
|
367
|
+
),
|
|
368
|
+
se && /* @__PURE__ */ M(
|
|
369
|
+
"div",
|
|
370
|
+
{
|
|
371
|
+
role: "checkbox",
|
|
372
|
+
tabIndex: f.isDisabled ? -1 : 0,
|
|
373
|
+
"aria-disabled": f.isDisabled || void 0,
|
|
374
|
+
"aria-checked": P === "indeterminate" ? "mixed" : P === "selected",
|
|
375
|
+
"aria-label": le,
|
|
376
|
+
className: k(
|
|
377
|
+
"flex shrink-0 items-center gap-2 border-b border-secondary px-3 py-2.5",
|
|
378
|
+
"cursor-pointer hover:bg-secondary_subtle transition-colors",
|
|
379
|
+
f.isDisabled && "cursor-not-allowed opacity-50"
|
|
380
|
+
),
|
|
381
|
+
onPointerDown: f.isDisabled ? void 0 : (i) => {
|
|
382
|
+
i.stopPropagation(), N();
|
|
383
|
+
},
|
|
384
|
+
onClick: f.isDisabled ? void 0 : J,
|
|
385
|
+
onKeyDown: f.isDisabled ? void 0 : (i) => {
|
|
386
|
+
(i.key === " " || i.key === "Enter") && (i.preventDefault(), J());
|
|
387
|
+
},
|
|
388
|
+
children: [
|
|
389
|
+
/* @__PURE__ */ s(
|
|
390
|
+
_e,
|
|
391
|
+
{
|
|
392
|
+
size: d === "lg" ? "md" : "sm",
|
|
393
|
+
checked: P === "indeterminate" ? "indeterminate" : P === "selected",
|
|
394
|
+
disabled: f.isDisabled,
|
|
395
|
+
tabIndex: -1,
|
|
396
|
+
"aria-hidden": !0,
|
|
397
|
+
className: "pointer-events-none"
|
|
398
|
+
}
|
|
399
|
+
),
|
|
400
|
+
/* @__PURE__ */ s(
|
|
401
|
+
"span",
|
|
402
|
+
{
|
|
403
|
+
className: k(
|
|
404
|
+
"font-medium text-primary",
|
|
405
|
+
te[d]
|
|
406
|
+
),
|
|
407
|
+
children: le
|
|
408
|
+
}
|
|
409
|
+
)
|
|
410
|
+
]
|
|
411
|
+
}
|
|
383
412
|
),
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
413
|
+
/* @__PURE__ */ M("div", { className: "flex-1 overflow-y-auto", children: [
|
|
414
|
+
w.items.length === 0 && r && z && /* @__PURE__ */ s("div", { className: "flex items-center justify-center py-6", children: /* @__PURE__ */ s("p", { className: k("text-tertiary", te[d]), children: "No results" }) }),
|
|
415
|
+
/* @__PURE__ */ s(
|
|
416
|
+
Se,
|
|
388
417
|
{
|
|
418
|
+
id: _,
|
|
419
|
+
selectionMode: "multiple",
|
|
420
|
+
selectedKeys: R ? new Set(E) : void 0,
|
|
389
421
|
className: k(
|
|
390
|
-
"
|
|
391
|
-
|
|
422
|
+
"size-full outline-hidden",
|
|
423
|
+
w.items.length === 0 && "hidden"
|
|
392
424
|
),
|
|
393
|
-
|
|
394
|
-
children: /* @__PURE__ */ l(ke, { className: "size-3 stroke-[2.5]" })
|
|
395
|
-
}
|
|
396
|
-
) : /* @__PURE__ */ l(
|
|
397
|
-
We,
|
|
398
|
-
{
|
|
399
|
-
size: f === "lg" ? "md" : "sm",
|
|
400
|
-
checked: O === "selected",
|
|
401
|
-
onCheckedChange: n,
|
|
402
|
-
onClick: (c) => c.stopPropagation(),
|
|
403
|
-
disabled: g.isDisabled,
|
|
404
|
-
"aria-label": ie
|
|
405
|
-
}
|
|
406
|
-
),
|
|
407
|
-
/* @__PURE__ */ l(
|
|
408
|
-
"span",
|
|
409
|
-
{
|
|
410
|
-
className: k("font-medium text-primary", I[f]),
|
|
411
|
-
children: ie
|
|
425
|
+
children: y
|
|
412
426
|
}
|
|
413
427
|
)
|
|
414
|
-
]
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
m.items.length === 0 && r && L && /* @__PURE__ */ l("div", { className: "flex items-center justify-center py-6", children: /* @__PURE__ */ l("p", { className: k("text-tertiary", I[f]), children: "No results" }) }),
|
|
419
|
-
/* @__PURE__ */ l(
|
|
420
|
-
Re,
|
|
421
|
-
{
|
|
422
|
-
id: z,
|
|
423
|
-
selectionMode: "multiple",
|
|
424
|
-
selectedKeys: N ? new Set(R) : void 0,
|
|
425
|
-
onSelectionChange: N ? J : void 0,
|
|
426
|
-
className: k(
|
|
427
|
-
"size-full outline-hidden",
|
|
428
|
-
m.items.length === 0 && "hidden"
|
|
429
|
-
),
|
|
430
|
-
children: b
|
|
431
|
-
}
|
|
432
|
-
)
|
|
433
|
-
] })
|
|
434
|
-
]
|
|
428
|
+
] })
|
|
429
|
+
]
|
|
430
|
+
}
|
|
431
|
+
)
|
|
435
432
|
}
|
|
436
433
|
),
|
|
437
|
-
|
|
434
|
+
f.hint && /* @__PURE__ */ s(Ee, { isInvalid: n.isInvalid, children: f.hint })
|
|
438
435
|
] })
|
|
439
436
|
}
|
|
440
437
|
)
|
|
441
438
|
}
|
|
442
439
|
);
|
|
443
440
|
}, Je = ({
|
|
444
|
-
isDisabled:
|
|
445
|
-
shortcut:
|
|
446
|
-
shortcutClassName:
|
|
447
|
-
placeholder:
|
|
448
|
-
readOnly:
|
|
449
|
-
isFocusWithin:
|
|
450
|
-
inputRef:
|
|
441
|
+
isDisabled: c,
|
|
442
|
+
shortcut: y,
|
|
443
|
+
shortcutClassName: d,
|
|
444
|
+
placeholder: m,
|
|
445
|
+
readOnly: l = !1,
|
|
446
|
+
isFocusWithin: b,
|
|
447
|
+
inputRef: T
|
|
451
448
|
}) => {
|
|
452
|
-
var
|
|
453
|
-
const
|
|
454
|
-
const
|
|
455
|
-
if (!
|
|
456
|
-
|
|
449
|
+
var X, w, z, D, P;
|
|
450
|
+
const p = De(), a = H(fe), e = H(Z), o = b || !!(e != null && e.isOpen), g = G(null), [r, S] = ue(!1), R = (X = a == null ? void 0 : a.selectedItems) == null ? void 0 : X.items, $ = (R == null ? void 0 : R.map((t) => t.id).join("\0")) ?? "", j = (e == null ? void 0 : e.inputValue) ?? "", u = L(() => {
|
|
451
|
+
const t = g.current;
|
|
452
|
+
if (!t || o) {
|
|
453
|
+
S(!1);
|
|
457
454
|
return;
|
|
458
455
|
}
|
|
459
|
-
const
|
|
460
|
-
|
|
461
|
-
|
|
456
|
+
const N = t.scrollWidth > t.clientWidth + 0.5;
|
|
457
|
+
S(
|
|
458
|
+
N && t.scrollLeft + t.clientWidth < t.scrollWidth - 1
|
|
462
459
|
);
|
|
463
|
-
}, [
|
|
464
|
-
|
|
465
|
-
ref:
|
|
460
|
+
}, [o]);
|
|
461
|
+
de({
|
|
462
|
+
ref: g,
|
|
466
463
|
onResize: u,
|
|
467
464
|
box: "border-box"
|
|
468
465
|
}), ye(() => {
|
|
@@ -470,150 +467,150 @@ const Ue = ({
|
|
|
470
467
|
}, [
|
|
471
468
|
u,
|
|
472
469
|
$,
|
|
473
|
-
|
|
474
|
-
|
|
470
|
+
o,
|
|
471
|
+
j
|
|
475
472
|
]);
|
|
476
|
-
const h = (
|
|
477
|
-
var
|
|
478
|
-
|
|
479
|
-
},
|
|
480
|
-
if (!(!(
|
|
481
|
-
switch (
|
|
473
|
+
const h = (t) => {
|
|
474
|
+
var N;
|
|
475
|
+
t.preventDefault(), (N = T.current) == null || N.focus({ preventScroll: !0 });
|
|
476
|
+
}, F = (t) => {
|
|
477
|
+
if (!(!(t.currentTarget.selectionStart === 0 && t.currentTarget.selectionEnd === 0) && t.currentTarget.value !== ""))
|
|
478
|
+
switch (t.key) {
|
|
482
479
|
case "Backspace":
|
|
483
480
|
case "ArrowLeft":
|
|
484
|
-
|
|
481
|
+
p == null || p.focusPrevious({ wrap: !1, tabbable: !1 });
|
|
485
482
|
break;
|
|
486
483
|
case "ArrowRight":
|
|
487
|
-
|
|
484
|
+
p == null || p.focusNext({ wrap: !1, tabbable: !1 });
|
|
488
485
|
break;
|
|
489
486
|
}
|
|
490
|
-
},
|
|
491
|
-
|
|
492
|
-
},
|
|
493
|
-
|
|
494
|
-
},
|
|
495
|
-
var
|
|
496
|
-
if (
|
|
487
|
+
}, f = a == null ? void 0 : a.searchable, _ = (t) => {
|
|
488
|
+
t.stopPropagation(), e && !e.isOpen && e.open();
|
|
489
|
+
}, V = () => {
|
|
490
|
+
f && e && !e.isOpen && e.open();
|
|
491
|
+
}, E = (t, N) => {
|
|
492
|
+
var Q, O, Y;
|
|
493
|
+
if (t.key === "Tab")
|
|
497
494
|
return;
|
|
498
|
-
|
|
499
|
-
const
|
|
500
|
-
switch (
|
|
495
|
+
t.preventDefault();
|
|
496
|
+
const J = ((Y = (O = (Q = a == null ? void 0 : a.selectedItems) == null ? void 0 : Q.items) == null ? void 0 : O[0]) == null ? void 0 : Y.id) === N;
|
|
497
|
+
switch (t.key) {
|
|
501
498
|
case " ":
|
|
502
499
|
case "Enter":
|
|
503
500
|
case "Backspace":
|
|
504
|
-
|
|
501
|
+
J ? p == null || p.focusNext({ wrap: !1, tabbable: !1 }) : p == null || p.focusPrevious({ wrap: !1, tabbable: !1 }), a.onRemove(/* @__PURE__ */ new Set([N]));
|
|
505
502
|
break;
|
|
506
503
|
case "ArrowLeft":
|
|
507
|
-
|
|
504
|
+
p == null || p.focusPrevious({ wrap: !1, tabbable: !1 });
|
|
508
505
|
break;
|
|
509
506
|
case "ArrowRight":
|
|
510
|
-
|
|
507
|
+
p == null || p.focusNext({ wrap: !1, tabbable: !1 });
|
|
511
508
|
break;
|
|
512
509
|
case "Escape":
|
|
513
510
|
e == null || e.close();
|
|
514
511
|
break;
|
|
515
512
|
}
|
|
516
|
-
},
|
|
517
|
-
return /* @__PURE__ */
|
|
518
|
-
/* @__PURE__ */
|
|
513
|
+
}, v = ((z = (w = a == null ? void 0 : a.selectedItems) == null ? void 0 : w.items) == null ? void 0 : z.length) === 0;
|
|
514
|
+
return /* @__PURE__ */ M("div", { className: "relative min-w-0 w-full flex-1", children: [
|
|
515
|
+
/* @__PURE__ */ M(
|
|
519
516
|
"div",
|
|
520
517
|
{
|
|
521
|
-
ref:
|
|
522
|
-
onScroll:
|
|
518
|
+
ref: g,
|
|
519
|
+
onScroll: o ? void 0 : u,
|
|
523
520
|
className: k(
|
|
524
521
|
"flex w-full min-w-0 gap-1.5",
|
|
525
|
-
|
|
522
|
+
o ? k(
|
|
526
523
|
"flex-wrap items-start overflow-y-auto scrollbar-hide"
|
|
527
524
|
// multiSelectExpandedMaxHeight[controlSize],
|
|
528
525
|
) : "flex-nowrap items-center overflow-x-auto overflow-y-hidden scrollbar-hide"
|
|
529
526
|
),
|
|
530
527
|
children: [
|
|
531
|
-
/* @__PURE__ */
|
|
528
|
+
/* @__PURE__ */ s(ee.Provider, { value: null, children: !v && ((P = (D = a == null ? void 0 : a.selectedItems) == null ? void 0 : D.items) == null ? void 0 : P.map((t) => /* @__PURE__ */ M(
|
|
532
529
|
"span",
|
|
533
530
|
{
|
|
534
531
|
"data-multiselect-chip": !0,
|
|
535
532
|
className: k(
|
|
536
533
|
"flex items-center rounded-md bg-primary py-0.5 pr-1 pl-1.25 ring-1 ring-[var(--color-gray-100)] ring-inset",
|
|
537
|
-
!
|
|
538
|
-
|
|
534
|
+
!o && "shrink-0",
|
|
535
|
+
a == null ? void 0 : a.chipClassName
|
|
539
536
|
),
|
|
540
537
|
children: [
|
|
541
|
-
/* @__PURE__ */
|
|
538
|
+
/* @__PURE__ */ M(
|
|
542
539
|
"span",
|
|
543
540
|
{
|
|
544
541
|
className: "flex min-w-0 items-center",
|
|
545
542
|
onMouseDown: h,
|
|
546
543
|
children: [
|
|
547
|
-
(
|
|
548
|
-
|
|
544
|
+
(a == null ? void 0 : a.showAvatar) && /* @__PURE__ */ s(
|
|
545
|
+
Me,
|
|
549
546
|
{
|
|
550
547
|
size: "xxs",
|
|
551
|
-
alt:
|
|
552
|
-
src:
|
|
553
|
-
initials:
|
|
548
|
+
alt: t == null ? void 0 : t.label,
|
|
549
|
+
src: t == null ? void 0 : t.avatarUrl,
|
|
550
|
+
initials: t == null ? void 0 : t.initials
|
|
554
551
|
}
|
|
555
552
|
),
|
|
556
|
-
/* @__PURE__ */
|
|
553
|
+
/* @__PURE__ */ s("p", { className: "ml-1.25 truncate text-xs font-medium whitespace-nowrap text-secondary select-none", children: t == null ? void 0 : t.label })
|
|
557
554
|
]
|
|
558
555
|
}
|
|
559
556
|
),
|
|
560
|
-
/* @__PURE__ */
|
|
561
|
-
|
|
557
|
+
/* @__PURE__ */ s(
|
|
558
|
+
ze,
|
|
562
559
|
{
|
|
563
560
|
size: "md",
|
|
564
|
-
isDisabled:
|
|
565
|
-
preventFocusOnPress: !
|
|
561
|
+
isDisabled: c,
|
|
562
|
+
preventFocusOnPress: !o,
|
|
566
563
|
className: "ml-0.75",
|
|
567
|
-
onKeyDown: (
|
|
568
|
-
onPress: () =>
|
|
564
|
+
onKeyDown: (N) => E(N, t.id),
|
|
565
|
+
onPress: () => a.onRemove(/* @__PURE__ */ new Set([t.id]))
|
|
569
566
|
}
|
|
570
567
|
)
|
|
571
568
|
]
|
|
572
569
|
},
|
|
573
|
-
|
|
570
|
+
t.id
|
|
574
571
|
))) }),
|
|
575
|
-
/* @__PURE__ */
|
|
572
|
+
/* @__PURE__ */ M(
|
|
576
573
|
"div",
|
|
577
574
|
{
|
|
578
575
|
className: k(
|
|
579
576
|
"relative flex flex-1 flex-row items-center",
|
|
580
|
-
|
|
581
|
-
!
|
|
582
|
-
|
|
577
|
+
o ? "min-w-[20%]" : "min-w-0",
|
|
578
|
+
!v && "ml-0.5",
|
|
579
|
+
y && "min-w-[30%]"
|
|
583
580
|
),
|
|
584
581
|
children: [
|
|
585
|
-
/* @__PURE__ */
|
|
586
|
-
|
|
582
|
+
/* @__PURE__ */ s(
|
|
583
|
+
Fe,
|
|
587
584
|
{
|
|
588
|
-
ref:
|
|
589
|
-
placeholder:
|
|
590
|
-
onKeyDown:
|
|
591
|
-
onMouseDown:
|
|
592
|
-
onFocus:
|
|
593
|
-
readOnly:
|
|
585
|
+
ref: T,
|
|
586
|
+
placeholder: v ? m : void 0,
|
|
587
|
+
onKeyDown: F,
|
|
588
|
+
onMouseDown: _,
|
|
589
|
+
onFocus: V,
|
|
590
|
+
readOnly: l || f,
|
|
594
591
|
className: k(
|
|
595
592
|
"w-full min-w-0 flex-[1_0_0] appearance-none bg-transparent text-ellipsis text-primary caret-alpha-black/90 outline-none placeholder:text-placeholder_subtle focus:outline-hidden disabled:cursor-not-allowed disabled:text-disabled disabled:placeholder:text-disabled",
|
|
596
|
-
|
|
597
|
-
|
|
593
|
+
l && "cursor-default",
|
|
594
|
+
te[(a == null ? void 0 : a.size) || "sm"]
|
|
598
595
|
)
|
|
599
596
|
}
|
|
600
597
|
),
|
|
601
|
-
|
|
598
|
+
y && /* @__PURE__ */ s(
|
|
602
599
|
"div",
|
|
603
600
|
{
|
|
604
601
|
"aria-hidden": "true",
|
|
605
602
|
className: k(
|
|
606
603
|
"absolute inset-y-0.5 right-0.5 z-10 flex items-center rounded-r-[inherit] bg-linear-to-r from-transparent to-bg-primary to-40% pl-8",
|
|
607
|
-
|
|
604
|
+
d
|
|
608
605
|
),
|
|
609
|
-
children: /* @__PURE__ */
|
|
606
|
+
children: /* @__PURE__ */ s(
|
|
610
607
|
"span",
|
|
611
608
|
{
|
|
612
609
|
className: k(
|
|
613
610
|
"pointer-events-none rounded px-1 py-px text-xs font-medium text-quaternary ring-1 ring-secondary select-none ring-inset",
|
|
614
|
-
|
|
611
|
+
c && "bg-transparent text-disabled"
|
|
615
612
|
),
|
|
616
|
-
children:
|
|
613
|
+
children: qe(["meta"], "K")
|
|
617
614
|
}
|
|
618
615
|
)
|
|
619
616
|
}
|
|
@@ -624,7 +621,7 @@ const Ue = ({
|
|
|
624
621
|
]
|
|
625
622
|
}
|
|
626
623
|
),
|
|
627
|
-
!
|
|
624
|
+
!o && r && /* @__PURE__ */ s(
|
|
628
625
|
"div",
|
|
629
626
|
{
|
|
630
627
|
"aria-hidden": !0,
|
|
@@ -633,82 +630,82 @@ const Ue = ({
|
|
|
633
630
|
)
|
|
634
631
|
] });
|
|
635
632
|
}, Qe = ({
|
|
636
|
-
size:
|
|
637
|
-
shortcut:
|
|
638
|
-
placeholder:
|
|
639
|
-
shortcutClassName:
|
|
640
|
-
placeholderIcon:
|
|
641
|
-
readOnly:
|
|
642
|
-
isDisabled:
|
|
643
|
-
isInvalid:
|
|
644
|
-
ref:
|
|
633
|
+
size: c,
|
|
634
|
+
shortcut: y,
|
|
635
|
+
placeholder: d,
|
|
636
|
+
shortcutClassName: m,
|
|
637
|
+
placeholderIcon: l = null,
|
|
638
|
+
readOnly: b = !1,
|
|
639
|
+
isDisabled: T,
|
|
640
|
+
isInvalid: p,
|
|
641
|
+
ref: a,
|
|
645
642
|
endAdornment: e,
|
|
646
|
-
...
|
|
643
|
+
...o
|
|
647
644
|
}) => {
|
|
648
|
-
const
|
|
649
|
-
() =>
|
|
650
|
-
[
|
|
651
|
-
),
|
|
645
|
+
const g = G(null), r = H(Z), S = H(ee), R = S && typeof S == "object" && "ref" in S ? S.ref : void 0, $ = B(
|
|
646
|
+
() => Ge(a ?? void 0, R ?? void 0),
|
|
647
|
+
[a, R]
|
|
648
|
+
), j = L(
|
|
652
649
|
(u) => {
|
|
653
|
-
var
|
|
654
|
-
if (
|
|
650
|
+
var F, f;
|
|
651
|
+
if (T)
|
|
655
652
|
return;
|
|
656
653
|
const h = u.target;
|
|
657
654
|
if (h instanceof Element && !h.closest("button")) {
|
|
658
|
-
if (
|
|
655
|
+
if (b) {
|
|
659
656
|
if (h.closest("input") || h.closest("[data-multiselect-chip]"))
|
|
660
657
|
return;
|
|
661
|
-
u.preventDefault(), r != null && r.isOpen ? (r.close(), (
|
|
658
|
+
u.preventDefault(), r != null && r.isOpen ? (r.close(), (F = g.current) == null || F.blur()) : r == null || r.open();
|
|
662
659
|
return;
|
|
663
660
|
}
|
|
664
|
-
h.closest("input") || (u.preventDefault(), (
|
|
661
|
+
h.closest("input") || (u.preventDefault(), (f = g.current) == null || f.focus({ preventScroll: !0 }));
|
|
665
662
|
}
|
|
666
663
|
},
|
|
667
|
-
[
|
|
664
|
+
[T, b, r]
|
|
668
665
|
);
|
|
669
|
-
return /* @__PURE__ */
|
|
670
|
-
|
|
666
|
+
return /* @__PURE__ */ s(
|
|
667
|
+
Re,
|
|
671
668
|
{
|
|
672
|
-
...
|
|
669
|
+
...o,
|
|
673
670
|
ref: $,
|
|
674
671
|
onMouseDown: (u) => {
|
|
675
672
|
var h;
|
|
676
|
-
u.stopPropagation(), (h =
|
|
673
|
+
u.stopPropagation(), (h = o.onMouseDown) == null || h.call(o, u);
|
|
677
674
|
},
|
|
678
675
|
onPointerDown: (u) => {
|
|
679
676
|
var h;
|
|
680
|
-
u.stopPropagation(), (h =
|
|
677
|
+
u.stopPropagation(), (h = o.onPointerDown) == null || h.call(o, u);
|
|
681
678
|
},
|
|
682
679
|
onMouseDownCapture: (u) => {
|
|
683
680
|
var h;
|
|
684
|
-
(h =
|
|
681
|
+
(h = o.onMouseDownCapture) == null || h.call(o, u), j(u);
|
|
685
682
|
},
|
|
686
683
|
className: ({ isFocusWithin: u, isDisabled: h }) => {
|
|
687
|
-
const
|
|
684
|
+
const F = u || !!(r != null && r.isOpen);
|
|
688
685
|
return k(
|
|
689
686
|
"relative flex w-full gap-2 rounded-md bg-primary ring-1 outline-hidden duration-100 ease-linear ring-inset",
|
|
690
|
-
|
|
687
|
+
p ? "ring-error" : u ? "ring-brand" : "ring-[var(--color-border-secondary)]",
|
|
691
688
|
h && "cursor-not-allowed bg-disabled_subtle",
|
|
692
|
-
|
|
693
|
-
|
|
689
|
+
F ? "items-start" : "items-center",
|
|
690
|
+
F ? Ve[c] : Le[c].root
|
|
694
691
|
);
|
|
695
692
|
},
|
|
696
|
-
children: ({ isDisabled: u, isFocusWithin: h }) => /* @__PURE__ */
|
|
697
|
-
|
|
698
|
-
/* @__PURE__ */
|
|
693
|
+
children: ({ isDisabled: u, isFocusWithin: h }) => /* @__PURE__ */ M(me, { children: [
|
|
694
|
+
l && /* @__PURE__ */ s(l, { className: "pointer-events-none size-5 shrink-0 text-fg-quaternary" }),
|
|
695
|
+
/* @__PURE__ */ s(ve, { contain: !1, autoFocus: !1, restoreFocus: !1, children: /* @__PURE__ */ s("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ s(
|
|
699
696
|
Je,
|
|
700
697
|
{
|
|
701
|
-
inputRef:
|
|
698
|
+
inputRef: g,
|
|
702
699
|
isDisabled: u,
|
|
703
700
|
isFocusWithin: h,
|
|
704
|
-
shortcut:
|
|
705
|
-
shortcutClassName:
|
|
706
|
-
placeholder:
|
|
707
|
-
readOnly:
|
|
701
|
+
shortcut: y,
|
|
702
|
+
shortcutClassName: m,
|
|
703
|
+
placeholder: d,
|
|
704
|
+
readOnly: b
|
|
708
705
|
}
|
|
709
706
|
) }) }),
|
|
710
|
-
e ? /* @__PURE__ */
|
|
711
|
-
/* @__PURE__ */
|
|
707
|
+
e ? /* @__PURE__ */ s(ee.Provider, { value: null, children: /* @__PURE__ */ s("div", { className: "flex shrink-0 items-center self-center", children: e }) }) : null,
|
|
708
|
+
/* @__PURE__ */ s(
|
|
712
709
|
"button",
|
|
713
710
|
{
|
|
714
711
|
type: "button",
|
|
@@ -716,15 +713,15 @@ const Ue = ({
|
|
|
716
713
|
disabled: u,
|
|
717
714
|
"aria-label": r != null && r.isOpen ? "Close options" : "Open options",
|
|
718
715
|
className: "shrink-0 self-center rounded p-0.5 text-fg-quaternary hover:text-fg-secondary disabled:cursor-not-allowed disabled:opacity-50",
|
|
719
|
-
onMouseDown: (
|
|
720
|
-
var
|
|
721
|
-
|
|
716
|
+
onMouseDown: (F) => {
|
|
717
|
+
var f, _;
|
|
718
|
+
F.preventDefault(), F.stopPropagation(), r != null && r.isOpen ? (r.close(), (f = g.current) == null || f.blur()) : (r == null || r.open(), (_ = g.current) == null || _.focus({ preventScroll: !0 }));
|
|
722
719
|
},
|
|
723
|
-
children: /* @__PURE__ */
|
|
720
|
+
children: /* @__PURE__ */ s(
|
|
724
721
|
Ne,
|
|
725
722
|
{
|
|
726
723
|
"aria-hidden": "true",
|
|
727
|
-
className:
|
|
724
|
+
className: c === "lg" ? "size-5" : "size-4"
|
|
728
725
|
}
|
|
729
726
|
)
|
|
730
727
|
}
|
|
@@ -733,7 +730,7 @@ const Ue = ({
|
|
|
733
730
|
}
|
|
734
731
|
);
|
|
735
732
|
}, Ye = Xe;
|
|
736
|
-
Ye.Item =
|
|
733
|
+
Ye.Item = Oe;
|
|
737
734
|
export {
|
|
738
735
|
Ye as MultiSelect,
|
|
739
736
|
Xe as MultiSelectBase,
|