@pibit.ai/cure-design-system 0.5.6 → 0.5.8
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 +42 -0
- package/dist/applications/date-picker/calendar.d.ts.map +1 -0
- package/dist/applications/date-picker/calendar.js +310 -0
- package/dist/applications/date-picker/cell.d.ts +15 -0
- package/dist/applications/date-picker/cell.d.ts.map +1 -0
- package/dist/applications/date-picker/cell.js +90 -0
- package/dist/applications/date-picker/date-input.d.ts +7 -0
- package/dist/applications/date-picker/date-input.d.ts.map +1 -0
- package/dist/applications/date-picker/date-input.js +39 -0
- package/dist/applications/date-picker/date-picker.d.ts +47 -0
- package/dist/applications/date-picker/date-picker.d.ts.map +1 -0
- package/dist/applications/date-picker/date-picker.js +237 -0
- package/dist/applications/date-picker/date-range-picker.d.ts +44 -0
- package/dist/applications/date-picker/date-range-picker.d.ts.map +1 -0
- package/dist/applications/date-picker/date-range-picker.js +335 -0
- package/dist/applications/date-picker/date-range-presets.d.ts +50 -0
- package/dist/applications/date-picker/date-range-presets.d.ts.map +1 -0
- package/dist/applications/date-picker/date-range-presets.js +86 -0
- package/dist/applications/date-picker/date-time-calendar.d.ts +34 -0
- package/dist/applications/date-picker/date-time-calendar.d.ts.map +1 -0
- package/dist/applications/date-picker/date-time-calendar.js +140 -0
- package/dist/applications/date-picker/index.d.ts +12 -0
- package/dist/applications/date-picker/index.d.ts.map +1 -0
- package/dist/applications/date-picker/index.js +36 -0
- package/dist/applications/date-picker/range-calendar.d.ts +23 -0
- package/dist/applications/date-picker/range-calendar.d.ts.map +1 -0
- package/dist/applications/date-picker/range-calendar.js +210 -0
- package/dist/applications/date-picker/range-preset.d.ts +10 -0
- package/dist/applications/date-picker/range-preset.d.ts.map +1 -0
- package/dist/applications/date-picker/range-preset.js +27 -0
- package/dist/applications/date-picker/styles.d.ts +8 -0
- package/dist/applications/date-picker/styles.d.ts.map +1 -0
- package/dist/applications/date-picker/styles.js +14 -0
- package/dist/applications/date-picker/time-field.d.ts +7 -0
- package/dist/applications/date-picker/time-field.d.ts.map +1 -0
- package/dist/applications/date-picker/time-field.js +116 -0
- package/dist/applications/date-picker/time-list.d.ts +23 -0
- package/dist/applications/date-picker/time-list.d.ts.map +1 -0
- package/dist/applications/date-picker/time-list.js +89 -0
- package/dist/hooks/use-breakpoint.d.ts +10 -0
- package/dist/hooks/use-breakpoint.d.ts.map +1 -0
- package/dist/hooks/use-breakpoint.js +21 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +331 -304
- package/dist/node_modules/framer-motion/dist/es/components/AnimatePresence/PopChild.js +6 -6
- package/dist/node_modules/framer-motion/dist/es/components/AnimatePresence/PresenceChild.js +6 -6
- package/dist/primitives/select/ExpandableSearchInput.d.ts +1 -1
- package/dist/primitives/select/ExpandableSearchInput.d.ts.map +1 -1
- package/dist/primitives/select/ExpandableSearchInput.js +23 -23
- package/dist/primitives/select/SearchInput.d.ts +15 -2
- package/dist/primitives/select/SearchInput.d.ts.map +1 -1
- package/dist/primitives/select/SearchInput.js +128 -114
- package/dist/primitives/select/index.d.ts +1 -0
- package/dist/primitives/select/index.d.ts.map +1 -1
- package/dist/primitives/select/multi-select.js +81 -82
- package/dist/primitives/select/select.d.ts +4 -0
- package/dist/primitives/select/select.d.ts.map +1 -1
- package/dist/primitives/select/select.js +40 -21
- package/dist/styles/components.css +1 -1
- package/package.json +8 -1
- package/dist/node_modules/@react-aria/focus/dist/FocusScope.js +0 -442
- package/dist/node_modules/@react-aria/i18n/dist/context.js +0 -10
- package/dist/node_modules/@react-aria/i18n/dist/useCollator.js +0 -11
- package/dist/node_modules/@react-aria/i18n/dist/useDefaultLocale.js +0 -36
- package/dist/node_modules/@react-aria/i18n/dist/useFilter.js +0 -35
- package/dist/node_modules/@react-aria/i18n/dist/utils.js +0 -44
- package/dist/node_modules/@react-aria/interactions/dist/focusSafely.js +0 -18
- package/dist/node_modules/@react-aria/interactions/dist/useFocusVisible.js +0 -62
- package/dist/node_modules/@react-aria/interactions/dist/utils.js +0 -5
- package/dist/node_modules/@react-aria/ssr/dist/SSRProvider.js +0 -49
- package/dist/node_modules/@react-aria/utils/dist/DOMFunctions.js +0 -27
- package/dist/node_modules/@react-aria/utils/dist/ShadowTreeWalker.js +0 -130
- package/dist/node_modules/@react-aria/utils/dist/domHelpers.js +0 -15
- package/dist/node_modules/@react-aria/utils/dist/focusWithoutScrolling.js +0 -45
- package/dist/node_modules/@react-aria/utils/dist/isElementVisible.js +0 -25
- package/dist/node_modules/@react-aria/utils/dist/isFocusable.js +0 -37
- package/dist/node_modules/@react-aria/utils/dist/isVirtualEvent.js +0 -7
- package/dist/node_modules/@react-aria/utils/dist/openLink.js +0 -28
- package/dist/node_modules/@react-aria/utils/dist/platform.js +0 -47
- package/dist/node_modules/@react-aria/utils/dist/runAfterTransition.js +0 -35
- package/dist/node_modules/@react-aria/utils/dist/useLayoutEffect.js +0 -6
- package/dist/node_modules/@react-stately/flags/dist/import.js +0 -7
|
@@ -1,24 +1,23 @@
|
|
|
1
|
-
import { jsx as i, jsxs as N, Fragment as
|
|
2
|
-
import { useCallback as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
1
|
+
import { jsx as i, jsxs as N, Fragment as L } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback as F, useRef as E, useState as q, createContext as j, useContext as P } from "react";
|
|
3
|
+
import { useFilter as C, FocusScope as V, useFocusManager as $ } from "react-aria";
|
|
4
|
+
import { ComboBox as W, ListBox as G, Group as H, ComboBoxStateContext as U, Input as X } from "react-aria-components";
|
|
5
|
+
import { Avatar as J } from "../avatar/avatar.js";
|
|
6
|
+
import { HintText as O } from "../input/hint-text.js";
|
|
7
|
+
import { Label as Q } from "../input/label.js";
|
|
8
|
+
import { Popover as Y } from "./popover.js";
|
|
9
|
+
import { sizes as Z } from "./select.js";
|
|
10
|
+
import { TagCloseX as M } from "../tags/base-components/tag-close-x.js";
|
|
11
|
+
import { SelectItem as B } from "./select-item.js";
|
|
11
12
|
import { cx as w } from "../../utils/cn.js";
|
|
12
|
-
import { getPlatformShortcutLabel as
|
|
13
|
-
import { useResizeObserver as
|
|
14
|
-
import {
|
|
15
|
-
|
|
16
|
-
import { FocusScope as ee, useFocusManager as te } from "../../node_modules/@react-aria/focus/dist/FocusScope.js";
|
|
17
|
-
const re = {
|
|
13
|
+
import { getPlatformShortcutLabel as I } from "../../utils/keyboard-shortcut.js";
|
|
14
|
+
import { useResizeObserver as ee } from "../../hooks/use-resize-observer.js";
|
|
15
|
+
import { useListData as te } from "../../node_modules/@react-stately/data/dist/useListData.js";
|
|
16
|
+
const se = {
|
|
18
17
|
sm: "text-xs",
|
|
19
18
|
md: "text-sm",
|
|
20
19
|
lg: "text-md"
|
|
21
|
-
},
|
|
20
|
+
}, K = j({
|
|
22
21
|
size: "sm",
|
|
23
22
|
selectedKeys: [],
|
|
24
23
|
selectedItems: {},
|
|
@@ -28,14 +27,14 @@ const re = {
|
|
|
28
27
|
},
|
|
29
28
|
showAvatar: !0,
|
|
30
29
|
chipClassName: void 0
|
|
31
|
-
}),
|
|
32
|
-
items:
|
|
30
|
+
}), re = ({
|
|
31
|
+
items: f,
|
|
33
32
|
children: b,
|
|
34
33
|
size: h = "sm",
|
|
35
34
|
selectedItems: l,
|
|
36
35
|
onItemCleared: c,
|
|
37
36
|
onItemInserted: t,
|
|
38
|
-
shortcut:
|
|
37
|
+
shortcut: s,
|
|
39
38
|
placeholder: d = "Search",
|
|
40
39
|
showAvatar: p = !0,
|
|
41
40
|
readOnly: g = !1,
|
|
@@ -45,38 +44,38 @@ const re = {
|
|
|
45
44
|
className: T,
|
|
46
45
|
...n
|
|
47
46
|
}) => {
|
|
48
|
-
var
|
|
49
|
-
const { contains: x } =
|
|
50
|
-
(
|
|
47
|
+
var D;
|
|
48
|
+
const { contains: x } = C({ sensitivity: "base" }), u = (D = l == null ? void 0 : l.items) != null && D.length ? l.items.map((r) => r.id) : [], e = F(
|
|
49
|
+
(r, a) => !u.includes(r.id) && x(r.label || r.supportingText || "", a),
|
|
51
50
|
[x, u]
|
|
52
|
-
), o =
|
|
53
|
-
initialItems:
|
|
51
|
+
), o = te({
|
|
52
|
+
initialItems: f,
|
|
54
53
|
filter: e
|
|
55
|
-
}), v =
|
|
56
|
-
(
|
|
57
|
-
const a =
|
|
54
|
+
}), v = F(
|
|
55
|
+
(r) => {
|
|
56
|
+
const a = r.values().next().value;
|
|
58
57
|
a && (l.remove(a), c == null || c(a));
|
|
59
58
|
},
|
|
60
59
|
[l, c]
|
|
61
|
-
), S = (
|
|
62
|
-
if (!
|
|
60
|
+
), S = (r) => {
|
|
61
|
+
if (!r)
|
|
63
62
|
return;
|
|
64
|
-
const a = o.getItem(
|
|
65
|
-
a && (u.includes(
|
|
66
|
-
}, y = (
|
|
67
|
-
g || o.setFilterText(
|
|
68
|
-
},
|
|
63
|
+
const a = o.getItem(r);
|
|
64
|
+
a && (u.includes(r) || (l.append(a), t == null || t(r)), o.setFilterText(""));
|
|
65
|
+
}, y = (r) => {
|
|
66
|
+
g || o.setFilterText(r);
|
|
67
|
+
}, m = E(null), [_, A] = q(""), z = F(() => {
|
|
69
68
|
var a;
|
|
70
|
-
if (!
|
|
71
|
-
let
|
|
72
|
-
|
|
73
|
-
}, [
|
|
74
|
-
return
|
|
75
|
-
ref:
|
|
76
|
-
onResize:
|
|
69
|
+
if (!m.current) return;
|
|
70
|
+
let r = (a = m.current) == null ? void 0 : a.getBoundingClientRect();
|
|
71
|
+
A(r.width + "px");
|
|
72
|
+
}, [m, A]);
|
|
73
|
+
return ee({
|
|
74
|
+
ref: m,
|
|
75
|
+
onResize: z,
|
|
77
76
|
box: "border-box"
|
|
78
77
|
}), /* @__PURE__ */ i(
|
|
79
|
-
|
|
78
|
+
K.Provider,
|
|
80
79
|
{
|
|
81
80
|
value: {
|
|
82
81
|
size: h,
|
|
@@ -88,7 +87,7 @@ const re = {
|
|
|
88
87
|
chipClassName: k
|
|
89
88
|
},
|
|
90
89
|
children: /* @__PURE__ */ i(
|
|
91
|
-
|
|
90
|
+
W,
|
|
92
91
|
{
|
|
93
92
|
allowsEmptyCollection: !0,
|
|
94
93
|
allowsCustomValue: !1,
|
|
@@ -99,31 +98,31 @@ const re = {
|
|
|
99
98
|
selectedKey: null,
|
|
100
99
|
onSelectionChange: S,
|
|
101
100
|
...n,
|
|
102
|
-
children: (
|
|
101
|
+
children: (r) => {
|
|
103
102
|
var a;
|
|
104
103
|
return /* @__PURE__ */ N("div", { className: "flex flex-col gap-1.5", children: [
|
|
105
|
-
n.label && /* @__PURE__ */ i(
|
|
104
|
+
n.label && /* @__PURE__ */ i(Q, { isRequired: r.isRequired, tooltip: n.tooltip, children: n.label }),
|
|
106
105
|
/* @__PURE__ */ i(
|
|
107
106
|
ae,
|
|
108
107
|
{
|
|
109
108
|
size: h,
|
|
110
|
-
shortcut:
|
|
111
|
-
ref:
|
|
109
|
+
shortcut: s,
|
|
110
|
+
ref: m,
|
|
112
111
|
placeholder: d,
|
|
113
112
|
readOnly: g,
|
|
114
|
-
onFocus:
|
|
115
|
-
onPointerEnter:
|
|
113
|
+
onFocus: z,
|
|
114
|
+
onPointerEnter: z
|
|
116
115
|
}
|
|
117
116
|
),
|
|
118
117
|
((a = o.items) == null ? void 0 : a.length) > 0 && /* @__PURE__ */ i(
|
|
119
|
-
|
|
118
|
+
Y,
|
|
120
119
|
{
|
|
121
120
|
size: "md",
|
|
122
|
-
triggerRef:
|
|
123
|
-
style: { width:
|
|
121
|
+
triggerRef: m,
|
|
122
|
+
style: { width: _ },
|
|
124
123
|
className: n == null ? void 0 : n.popoverClassName,
|
|
125
124
|
children: /* @__PURE__ */ i(
|
|
126
|
-
|
|
125
|
+
G,
|
|
127
126
|
{
|
|
128
127
|
selectionMode: "multiple",
|
|
129
128
|
className: "size-full outline-hidden",
|
|
@@ -132,7 +131,7 @@ const re = {
|
|
|
132
131
|
)
|
|
133
132
|
}
|
|
134
133
|
),
|
|
135
|
-
n.hint && /* @__PURE__ */ i(
|
|
134
|
+
n.hint && /* @__PURE__ */ i(O, { isInvalid: r.isInvalid, children: n.hint })
|
|
136
135
|
] });
|
|
137
136
|
}
|
|
138
137
|
}
|
|
@@ -140,14 +139,14 @@ const re = {
|
|
|
140
139
|
}
|
|
141
140
|
);
|
|
142
141
|
}, ie = ({
|
|
143
|
-
isDisabled:
|
|
142
|
+
isDisabled: f,
|
|
144
143
|
shortcut: b,
|
|
145
144
|
shortcutClassName: h,
|
|
146
145
|
placeholder: l,
|
|
147
146
|
readOnly: c = !1
|
|
148
147
|
}) => {
|
|
149
148
|
var T, n, x, u;
|
|
150
|
-
const t =
|
|
149
|
+
const t = $(), s = P(K), d = P(U), p = (e) => {
|
|
151
150
|
if (!(!(e.currentTarget.selectionStart === 0 && e.currentTarget.selectionEnd === 0) && e.currentTarget.value !== ""))
|
|
152
151
|
switch (e.key) {
|
|
153
152
|
case "Backspace":
|
|
@@ -161,16 +160,16 @@ const re = {
|
|
|
161
160
|
}, g = (e) => {
|
|
162
161
|
d && !d.isOpen && d.open();
|
|
163
162
|
}, k = (e, o) => {
|
|
164
|
-
var S, y,
|
|
163
|
+
var S, y, m;
|
|
165
164
|
if (e.key === "Tab")
|
|
166
165
|
return;
|
|
167
166
|
e.preventDefault();
|
|
168
|
-
const v = ((
|
|
167
|
+
const v = ((m = (y = (S = s == null ? void 0 : s.selectedItems) == null ? void 0 : S.items) == null ? void 0 : y[0]) == null ? void 0 : m.id) === o;
|
|
169
168
|
switch (e.key) {
|
|
170
169
|
case " ":
|
|
171
170
|
case "Enter":
|
|
172
171
|
case "Backspace":
|
|
173
|
-
v ? t == null || t.focusNext({ wrap: !1, tabbable: !1 }) : t == null || t.focusPrevious({ wrap: !1, tabbable: !1 }),
|
|
172
|
+
v ? t == null || t.focusNext({ wrap: !1, tabbable: !1 }) : t == null || t.focusPrevious({ wrap: !1, tabbable: !1 }), s.onRemove(/* @__PURE__ */ new Set([o]));
|
|
174
173
|
break;
|
|
175
174
|
case "ArrowLeft":
|
|
176
175
|
t == null || t.focusPrevious({ wrap: !1, tabbable: !1 });
|
|
@@ -182,18 +181,18 @@ const re = {
|
|
|
182
181
|
d == null || d.close();
|
|
183
182
|
break;
|
|
184
183
|
}
|
|
185
|
-
}, R = ((n = (T =
|
|
184
|
+
}, R = ((n = (T = s == null ? void 0 : s.selectedItems) == null ? void 0 : T.items) == null ? void 0 : n.length) === 0;
|
|
186
185
|
return /* @__PURE__ */ N("div", { className: "relative flex w-full flex-1 flex-row flex-wrap items-center justify-start gap-1.5", children: [
|
|
187
|
-
!R && ((u = (x =
|
|
186
|
+
!R && ((u = (x = s == null ? void 0 : s.selectedItems) == null ? void 0 : x.items) == null ? void 0 : u.map((e) => /* @__PURE__ */ N(
|
|
188
187
|
"span",
|
|
189
188
|
{
|
|
190
189
|
className: w(
|
|
191
190
|
"flex items-center rounded-md bg-primary py-0.5 pr-1 pl-1.25 ring-1 ring-[var(--color-gray-100)] ring-inset",
|
|
192
|
-
|
|
191
|
+
s == null ? void 0 : s.chipClassName
|
|
193
192
|
),
|
|
194
193
|
children: [
|
|
195
|
-
(
|
|
196
|
-
|
|
194
|
+
(s == null ? void 0 : s.showAvatar) && /* @__PURE__ */ i(
|
|
195
|
+
J,
|
|
197
196
|
{
|
|
198
197
|
size: "sm",
|
|
199
198
|
alt: e == null ? void 0 : e.label,
|
|
@@ -203,13 +202,13 @@ const re = {
|
|
|
203
202
|
),
|
|
204
203
|
/* @__PURE__ */ i("p", { className: "ml-1.25 truncate text-sm font-medium whitespace-nowrap text-secondary select-none", children: e == null ? void 0 : e.label }),
|
|
205
204
|
/* @__PURE__ */ i(
|
|
206
|
-
|
|
205
|
+
M,
|
|
207
206
|
{
|
|
208
207
|
size: "md",
|
|
209
|
-
isDisabled:
|
|
208
|
+
isDisabled: f,
|
|
210
209
|
className: "ml-0.75",
|
|
211
210
|
onKeyDown: (o) => k(o, e.id),
|
|
212
|
-
onPress: () =>
|
|
211
|
+
onPress: () => s.onRemove(/* @__PURE__ */ new Set([e.id]))
|
|
213
212
|
}
|
|
214
213
|
)
|
|
215
214
|
]
|
|
@@ -226,7 +225,7 @@ const re = {
|
|
|
226
225
|
),
|
|
227
226
|
children: [
|
|
228
227
|
/* @__PURE__ */ i(
|
|
229
|
-
|
|
228
|
+
X,
|
|
230
229
|
{
|
|
231
230
|
placeholder: l,
|
|
232
231
|
onKeyDown: p,
|
|
@@ -235,7 +234,7 @@ const re = {
|
|
|
235
234
|
className: w(
|
|
236
235
|
"w-full 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",
|
|
237
236
|
c && "cursor-default",
|
|
238
|
-
|
|
237
|
+
se[(s == null ? void 0 : s.size) || "sm"]
|
|
239
238
|
)
|
|
240
239
|
}
|
|
241
240
|
),
|
|
@@ -252,9 +251,9 @@ const re = {
|
|
|
252
251
|
{
|
|
253
252
|
className: w(
|
|
254
253
|
"pointer-events-none rounded px-1 py-px text-xs font-medium text-quaternary ring-1 ring-secondary select-none ring-inset",
|
|
255
|
-
|
|
254
|
+
f && "bg-transparent text-disabled"
|
|
256
255
|
),
|
|
257
|
-
children:
|
|
256
|
+
children: I(["meta"], "K")
|
|
258
257
|
}
|
|
259
258
|
)
|
|
260
259
|
}
|
|
@@ -264,32 +263,32 @@ const re = {
|
|
|
264
263
|
)
|
|
265
264
|
] });
|
|
266
265
|
}, ae = ({
|
|
267
|
-
size:
|
|
266
|
+
size: f,
|
|
268
267
|
shortcut: b,
|
|
269
268
|
placeholder: h,
|
|
270
269
|
shortcutClassName: l,
|
|
271
270
|
placeholderIcon: c = null,
|
|
272
271
|
readOnly: t = !1,
|
|
273
272
|
// Omit this prop to avoid invalid HTML attribute warning
|
|
274
|
-
isDisabled:
|
|
273
|
+
isDisabled: s,
|
|
275
274
|
...d
|
|
276
275
|
}) => /* @__PURE__ */ i(
|
|
277
|
-
|
|
276
|
+
H,
|
|
278
277
|
{
|
|
279
278
|
...d,
|
|
280
279
|
className: ({ isFocusWithin: p, isDisabled: g }) => w(
|
|
281
280
|
"relative flex w-full items-center gap-2 rounded-lg bg-primary shadow-xs ring-1 ring-[var(--color-border-secondary)] outline-hidden transition duration-100 ease-linear ring-inset",
|
|
282
281
|
g && "cursor-not-allowed bg-disabled_subtle",
|
|
283
282
|
p && "ring-2 ring-brand",
|
|
284
|
-
|
|
283
|
+
Z[f].root
|
|
285
284
|
),
|
|
286
|
-
children: ({ isDisabled: p }) => /* @__PURE__ */ N(
|
|
285
|
+
children: ({ isDisabled: p }) => /* @__PURE__ */ N(L, { children: [
|
|
287
286
|
c && /* @__PURE__ */ i(c, { className: "pointer-events-none size-5 text-fg-quaternary" }),
|
|
288
|
-
/* @__PURE__ */ i(
|
|
287
|
+
/* @__PURE__ */ i(V, { contain: !1, autoFocus: !1, restoreFocus: !1, children: /* @__PURE__ */ i(
|
|
289
288
|
ie,
|
|
290
289
|
{
|
|
291
290
|
isDisabled: p,
|
|
292
|
-
size:
|
|
291
|
+
size: f,
|
|
293
292
|
shortcut: b,
|
|
294
293
|
shortcutClassName: l,
|
|
295
294
|
placeholder: h,
|
|
@@ -298,10 +297,10 @@ const re = {
|
|
|
298
297
|
) })
|
|
299
298
|
] })
|
|
300
299
|
}
|
|
301
|
-
), le =
|
|
302
|
-
le.Item =
|
|
300
|
+
), le = re;
|
|
301
|
+
le.Item = B;
|
|
303
302
|
export {
|
|
304
303
|
le as MultiSelect,
|
|
305
|
-
|
|
304
|
+
re as MultiSelectBase,
|
|
306
305
|
ae as MultiSelectTagsValue
|
|
307
306
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../../src/primitives/select/select.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,SAAS,EAAO,aAAa,EAAE,MAAM,OAAO,CAAC;AAG/D,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../../src/primitives/select/select.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,SAAS,EAAO,aAAa,EAAE,MAAM,OAAO,CAAC;AAG/D,OAAO,KAAK,EACV,GAAG,EACH,WAAW,IAAI,eAAe,EAC/B,MAAM,uBAAuB,CAAC;AAU/B,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAIvD,MAAM,MAAM,cAAc,GAAG;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,IAAI,CAAC,EAAE,EAAE,GAAG,SAAS,CAAC;CACvB,CAAC;AAEF,MAAM,WAAW,WAAW;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,WACf,SACE,IAAI,CAAC,eAAe,CAAC,cAAc,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,EAC3D,aAAa,CAAC,cAAc,CAAC,EAC7B,WAAW;IACb,KAAK,CAAC,EAAE,cAAc,EAAE,CAAC;IACzB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,eAAe,CAAC,EAAE,EAAE,GAAG,SAAS,CAAC;IACjC,QAAQ,EAAE,SAAS,GAAG,CAAC,CAAC,IAAI,EAAE,cAAc,KAAK,SAAS,CAAC,CAAC;IAC5D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,uHAAuH;IACvH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,2GAA2G;IAC3G,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAiBD,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;CAOjB,CAAC;AAQF,eAAO,MAAM,SAAS;;;;CAIrB,CAAC;AA4IF,eAAO,MAAM,aAAa;UAClB,IAAI,GAAG,IAAI,GAAG,IAAI;qBACP,OAAO;kBACV,GAAG,GAAG,IAAI;wBACJ,MAAM,IAAI;EACd,CAAC;AAEnB,QAAA,MAAM,MAAM,GAAI,yJAeb,WAAW,4CA0Gb,CAAC;AAEF,QAAA,MAAM,OAAO,EAAa,OAAO,MAAM,GAAG;IACxC,QAAQ,EAAE,OAAO,QAAQ,CAAC;IAC1B,IAAI,EAAE,OAAO,UAAU,CAAC;IACxB,UAAU,EAAE,OAAO,gBAAgB,CAAC;CACrC,CAAC;AAKF,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,CAAC"}
|
|
@@ -12,6 +12,9 @@ import { SearchableSelect as X } from "./searchable-select.js";
|
|
|
12
12
|
import { cx as i } from "../../utils/cn.js";
|
|
13
13
|
import { isReactComponent as G } from "../../utils/is-react-component.js";
|
|
14
14
|
const J = {
|
|
15
|
+
// xs exists because platform-ui's search fields use it. Select itself does not
|
|
16
|
+
// offer it yet; the map is shared with SearchInput, which does.
|
|
17
|
+
xs: { root: "py-1 px-2 h-7", shortcut: "pr-1.5" },
|
|
15
18
|
sm: { root: "py-1.5 px-2 h-8", shortcut: "pr-2" },
|
|
16
19
|
md: { root: "py-1.5 px-3 h-9", shortcut: "pr-2.5" },
|
|
17
20
|
lg: { root: "py-2.5 px-3.5 h-11", shortcut: "pr-3" }
|
|
@@ -36,11 +39,11 @@ const J = {
|
|
|
36
39
|
isFocused: B,
|
|
37
40
|
isDisabled: c,
|
|
38
41
|
size: n,
|
|
39
|
-
placeholder:
|
|
40
|
-
placeholderIcon:
|
|
42
|
+
placeholder: m,
|
|
43
|
+
placeholderIcon: f,
|
|
41
44
|
ref: x,
|
|
42
45
|
textStyles: I,
|
|
43
|
-
showChevron:
|
|
46
|
+
showChevron: p = !0,
|
|
44
47
|
isClearable: N = !1,
|
|
45
48
|
onClear: a,
|
|
46
49
|
selectedItem: h
|
|
@@ -65,10 +68,10 @@ const J = {
|
|
|
65
68
|
J[n].root
|
|
66
69
|
),
|
|
67
70
|
children: (r) => {
|
|
68
|
-
var o,
|
|
69
|
-
const t = ((o = r.selectedItem) == null ? void 0 : o.icon) ||
|
|
71
|
+
var o, u, s, v, S;
|
|
72
|
+
const t = ((o = r.selectedItem) == null ? void 0 : o.icon) || f;
|
|
70
73
|
return /* @__PURE__ */ b(K, { children: [
|
|
71
|
-
(
|
|
74
|
+
(u = r.selectedItem) != null && u.avatarUrl ? /* @__PURE__ */ e(
|
|
72
75
|
$,
|
|
73
76
|
{
|
|
74
77
|
size: "sm",
|
|
@@ -104,10 +107,10 @@ const J = {
|
|
|
104
107
|
w[n],
|
|
105
108
|
c && "text-disabled"
|
|
106
109
|
),
|
|
107
|
-
children:
|
|
110
|
+
children: m
|
|
108
111
|
}
|
|
109
112
|
),
|
|
110
|
-
|
|
113
|
+
p && /* @__PURE__ */ e(
|
|
111
114
|
k,
|
|
112
115
|
{
|
|
113
116
|
"aria-hidden": "true",
|
|
@@ -144,25 +147,34 @@ const J = {
|
|
|
144
147
|
placeholderIcon: B,
|
|
145
148
|
size: c = "sm",
|
|
146
149
|
children: n,
|
|
147
|
-
items:
|
|
148
|
-
label:
|
|
150
|
+
items: m,
|
|
151
|
+
label: f,
|
|
149
152
|
hint: x,
|
|
150
153
|
tooltip: I,
|
|
151
|
-
className:
|
|
154
|
+
className: p,
|
|
152
155
|
textStyles: N,
|
|
153
156
|
showChevron: a = !0,
|
|
154
157
|
isClearable: h = !1,
|
|
155
158
|
isDeselectable: d = !1,
|
|
156
159
|
...g
|
|
157
160
|
}) => {
|
|
158
|
-
const {
|
|
161
|
+
const {
|
|
162
|
+
selectedKey: r,
|
|
163
|
+
onSelectionChange: t,
|
|
164
|
+
...o
|
|
165
|
+
} = g, u = T(!1), s = r === void 0 ? void 0 : r == null || String(r) === "" ? null : r, v = j(() => {
|
|
159
166
|
var l;
|
|
160
|
-
!d || s == null || (
|
|
161
|
-
|
|
167
|
+
!d || s == null || (u.current = !0, t == null || t(null), (l = o.onOpenChange) == null || l.call(o, !1), queueMicrotask(() => {
|
|
168
|
+
u.current = !1;
|
|
162
169
|
}));
|
|
163
|
-
}, [
|
|
170
|
+
}, [
|
|
171
|
+
o.onOpenChange,
|
|
172
|
+
d,
|
|
173
|
+
t,
|
|
174
|
+
s
|
|
175
|
+
]), S = j(
|
|
164
176
|
(l) => {
|
|
165
|
-
if (
|
|
177
|
+
if (u.current) return;
|
|
166
178
|
const C = l == null || String(l) === "" ? null : l;
|
|
167
179
|
t == null || t(C);
|
|
168
180
|
},
|
|
@@ -185,16 +197,16 @@ const J = {
|
|
|
185
197
|
onSelectionChange: S,
|
|
186
198
|
className: (l) => i(
|
|
187
199
|
"flex flex-col gap-1.5",
|
|
188
|
-
typeof
|
|
200
|
+
typeof p == "function" ? p(l) : p
|
|
189
201
|
),
|
|
190
202
|
children: (l) => /* @__PURE__ */ b(K, { children: [
|
|
191
|
-
|
|
203
|
+
f && /* @__PURE__ */ e(
|
|
192
204
|
E,
|
|
193
205
|
{
|
|
194
206
|
isRequired: l.isRequired,
|
|
195
207
|
tooltip: I,
|
|
196
208
|
className: W[c],
|
|
197
|
-
children:
|
|
209
|
+
children: f
|
|
198
210
|
}
|
|
199
211
|
),
|
|
200
212
|
/* @__PURE__ */ e(
|
|
@@ -208,12 +220,19 @@ const J = {
|
|
|
208
220
|
showChevron: a,
|
|
209
221
|
isClearable: h,
|
|
210
222
|
onClear: h && t ? () => t(null) : void 0,
|
|
211
|
-
selectedItem: s != null &&
|
|
223
|
+
selectedItem: s != null && m ? m.find(
|
|
212
224
|
(C) => String(C.id) === String(s)
|
|
213
225
|
) ?? null : null
|
|
214
226
|
}
|
|
215
227
|
),
|
|
216
|
-
/* @__PURE__ */ e(
|
|
228
|
+
/* @__PURE__ */ e(
|
|
229
|
+
H,
|
|
230
|
+
{
|
|
231
|
+
size: c,
|
|
232
|
+
className: i(o.popoverClassName),
|
|
233
|
+
children: /* @__PURE__ */ e(O, { items: m, className: "size-full outline-hidden ", children: n })
|
|
234
|
+
}
|
|
235
|
+
),
|
|
217
236
|
x && /* @__PURE__ */ e(A, { isInvalid: l.isInvalid, children: x })
|
|
218
237
|
] })
|
|
219
238
|
}
|