@pibit.ai/cure-design-system 0.3.20 → 0.3.23
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/README.md +1 -0
- package/dist/applications/schedule-calendar/schedule-calendar.d.ts.map +1 -1
- package/dist/applications/schedule-calendar/schedule-calendar.js +24 -22
- package/dist/applications/schedule-calendar/utils.d.ts +13 -3
- package/dist/applications/schedule-calendar/utils.d.ts.map +1 -1
- package/dist/applications/schedule-calendar/utils.js +136 -117
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +92 -88
- package/dist/patterns/table/TableWrapper.d.ts.map +1 -1
- package/dist/patterns/table/TableWrapper.js +784 -665
- package/dist/patterns/table/index.d.ts +1 -1
- package/dist/patterns/table/index.d.ts.map +1 -1
- package/dist/patterns/table/storyHelpers/useMockTableState.d.ts.map +1 -1
- package/dist/patterns/table/table.d.ts.map +1 -1
- package/dist/patterns/table/table.js +44 -43
- package/dist/patterns/table/toolbar/AlignDropdown.d.ts.map +1 -1
- package/dist/patterns/table/toolbar/AlignDropdown.js +19 -25
- package/dist/patterns/table/toolbar/ColumnHeaderMenu.d.ts +9 -0
- package/dist/patterns/table/toolbar/ColumnHeaderMenu.d.ts.map +1 -1
- package/dist/patterns/table/toolbar/ColumnHeaderMenu.js +115 -81
- package/dist/patterns/table/toolbar/GroupByDropdown.d.ts.map +1 -1
- package/dist/patterns/table/toolbar/GroupByDropdown.js +48 -43
- package/dist/patterns/table/toolbar/SummaryFooter.d.ts.map +1 -1
- package/dist/patterns/table/toolbar/SummaryFooter.js +34 -27
- package/dist/patterns/table/toolbar/TableToolbar.d.ts +2 -0
- package/dist/patterns/table/toolbar/TableToolbar.d.ts.map +1 -1
- package/dist/patterns/table/toolbar/TableToolbar.js +2 -1
- package/dist/patterns/table/toolbar/index.d.ts +2 -2
- package/dist/patterns/table/toolbar/index.d.ts.map +1 -1
- package/dist/patterns/table/toolbar/tableToolbarHelpers.d.ts +10 -1
- package/dist/patterns/table/toolbar/tableToolbarHelpers.d.ts.map +1 -1
- package/dist/patterns/table/toolbar/tableToolbarHelpers.js +117 -117
- package/dist/patterns/table/types.d.ts +1 -0
- package/dist/patterns/table/types.d.ts.map +1 -1
- package/dist/primitives/multi-chips-select/MultiChipsSelect.d.ts +20 -0
- package/dist/primitives/multi-chips-select/MultiChipsSelect.d.ts.map +1 -0
- package/dist/primitives/multi-chips-select/MultiChipsSelect.js +233 -0
- package/dist/primitives/multi-chips-select/index.d.ts +3 -0
- package/dist/primitives/multi-chips-select/index.d.ts.map +1 -0
- package/dist/primitives/multi-chips-select/tagKeyFromLabel.d.ts +3 -0
- package/dist/primitives/multi-chips-select/tagKeyFromLabel.d.ts.map +1 -0
- package/dist/primitives/multi-chips-select/tagKeyFromLabel.js +6 -0
- package/dist/primitives/select/ExpandableSearchInput.d.ts +3 -1
- package/dist/primitives/select/ExpandableSearchInput.d.ts.map +1 -1
- package/dist/primitives/select/ExpandableSearchInput.js +100 -78
- package/dist/primitives/select/SearchInput.d.ts +5 -1
- package/dist/primitives/select/SearchInput.d.ts.map +1 -1
- package/dist/primitives/select/SearchInput.js +94 -74
- package/dist/primitives/select/searchable-select.d.ts +5 -3
- package/dist/primitives/select/searchable-select.d.ts.map +1 -1
- package/dist/primitives/select/searchable-select.js +196 -177
- package/dist/primitives/select/select-item.d.ts.map +1 -1
- package/dist/primitives/select/select-item.js +70 -54
- package/dist/primitives/select/select.d.ts +7 -2
- package/dist/primitives/select/select.d.ts.map +1 -1
- package/dist/primitives/select/select.js +161 -137
- package/dist/primitives/tooltip/ellipsis-content.d.ts.map +1 -1
- package/dist/primitives/tooltip/ellipsis-content.js +46 -43
- package/dist/styles/components.css +1 -1
- package/package.json +1 -1
|
@@ -1,104 +1,104 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { ChevronDown as
|
|
4
|
-
import { Select as
|
|
5
|
-
import { Avatar as
|
|
6
|
-
import { HintText as
|
|
7
|
-
import { Label as
|
|
8
|
-
import { Popover as
|
|
9
|
-
import { SelectItem as
|
|
10
|
-
import { SelectContext as
|
|
11
|
-
import { cx as
|
|
12
|
-
import { isReactComponent as
|
|
13
|
-
import
|
|
14
|
-
import { LoadingIndicator as
|
|
15
|
-
const
|
|
1
|
+
import { jsx as t, jsxs as f, Fragment as q } from "react/jsx-runtime";
|
|
2
|
+
import { useState as M, useRef as _, useCallback as w, isValidElement as A } from "react";
|
|
3
|
+
import { ChevronDown as C } from "@untitledui/icons";
|
|
4
|
+
import { Select as E, ListBox as F, Button as H, SelectValue as L } from "react-aria-components";
|
|
5
|
+
import { Avatar as D } from "../avatar/avatar.js";
|
|
6
|
+
import { HintText as G } from "../input/hint-text.js";
|
|
7
|
+
import { Label as J } from "../input/label.js";
|
|
8
|
+
import { Popover as Q } from "./popover.js";
|
|
9
|
+
import { SelectItem as W } from "./select-item.js";
|
|
10
|
+
import { SelectContext as X, fontSizes as S, sizes as Y } from "./select.js";
|
|
11
|
+
import { cx as s } from "../../utils/cn.js";
|
|
12
|
+
import { isReactComponent as Z } from "../../utils/is-react-component.js";
|
|
13
|
+
import $ from "./SearchInput.js";
|
|
14
|
+
import { LoadingIndicator as ee } from "../../applications/loading-indicator/loading-indicator.js";
|
|
15
|
+
const te = {
|
|
16
16
|
sm: "rounded-md",
|
|
17
17
|
md: "rounded-md",
|
|
18
18
|
lg: "rounded-lg"
|
|
19
|
-
},
|
|
19
|
+
}, re = {
|
|
20
20
|
sm: "text-xs",
|
|
21
21
|
md: "text-xs",
|
|
22
22
|
lg: "text-sm"
|
|
23
|
-
},
|
|
24
|
-
isOpen:
|
|
25
|
-
isFocused:
|
|
26
|
-
isDisabled:
|
|
27
|
-
size:
|
|
28
|
-
placeholder:
|
|
23
|
+
}, le = "relative flex w-full cursor-pointer items-center bg-primary ring-1 ring-secondary outline-hidden transition duration-100 ease-linear ring-inset", ne = ({
|
|
24
|
+
isOpen: P,
|
|
25
|
+
isFocused: R,
|
|
26
|
+
isDisabled: i,
|
|
27
|
+
size: l,
|
|
28
|
+
placeholder: x,
|
|
29
29
|
placeholderIcon: h,
|
|
30
|
-
textStyles:
|
|
31
|
-
selectedDisplayValue:
|
|
32
|
-
}) => /* @__PURE__ */
|
|
33
|
-
|
|
30
|
+
textStyles: g,
|
|
31
|
+
selectedDisplayValue: d
|
|
32
|
+
}) => /* @__PURE__ */ t(
|
|
33
|
+
H,
|
|
34
34
|
{
|
|
35
|
-
className:
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
(
|
|
39
|
-
|
|
35
|
+
className: s(
|
|
36
|
+
le,
|
|
37
|
+
te[l],
|
|
38
|
+
(R || P) && "ring-1 ring-brand",
|
|
39
|
+
i && "cursor-not-allowed bg-disabled_subtle text-disabled"
|
|
40
40
|
),
|
|
41
|
-
children: /* @__PURE__ */
|
|
42
|
-
|
|
41
|
+
children: /* @__PURE__ */ t(
|
|
42
|
+
L,
|
|
43
43
|
{
|
|
44
|
-
className:
|
|
44
|
+
className: s(
|
|
45
45
|
"flex h-max w-full items-center justify-start gap-2 truncate text-left align-middle",
|
|
46
46
|
"*:data-icon:size-5 *:data-icon:shrink-0 *:data-icon:text-fg-quaternary in-disabled:*:data-icon:text-fg-disabled",
|
|
47
|
-
|
|
47
|
+
Y[l].root
|
|
48
48
|
),
|
|
49
49
|
children: (n) => {
|
|
50
|
-
var
|
|
51
|
-
const
|
|
52
|
-
return /* @__PURE__ */
|
|
53
|
-
(
|
|
54
|
-
|
|
50
|
+
var u, o, y, v, I;
|
|
51
|
+
const m = ((u = n.selectedItem) == null ? void 0 : u.icon) || h, c = !!n.selectedItem, a = !c && !!d;
|
|
52
|
+
return /* @__PURE__ */ f(q, { children: [
|
|
53
|
+
(o = n.selectedItem) != null && o.avatarUrl ? /* @__PURE__ */ t(
|
|
54
|
+
D,
|
|
55
55
|
{
|
|
56
56
|
size: "sm",
|
|
57
57
|
src: n.selectedItem.avatarUrl,
|
|
58
58
|
alt: n.selectedItem.label
|
|
59
59
|
}
|
|
60
|
-
) :
|
|
61
|
-
|
|
62
|
-
/* @__PURE__ */
|
|
60
|
+
) : Z(m) ? /* @__PURE__ */ t(m, { "data-icon": !0, "aria-hidden": "true" }) : A(m) ? m : null,
|
|
61
|
+
c ? /* @__PURE__ */ f("section", { className: "flex w-full gap-2 truncate", children: [
|
|
62
|
+
/* @__PURE__ */ t(
|
|
63
63
|
"p",
|
|
64
64
|
{
|
|
65
|
-
className:
|
|
65
|
+
className: s(
|
|
66
66
|
"truncate font-medium text-primary",
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
S[l],
|
|
68
|
+
g
|
|
69
69
|
),
|
|
70
|
-
children: (
|
|
70
|
+
children: (y = n.selectedItem) == null ? void 0 : y.label
|
|
71
71
|
}
|
|
72
72
|
),
|
|
73
|
-
((
|
|
74
|
-
] }) :
|
|
73
|
+
((v = n.selectedItem) == null ? void 0 : v.supportingText) && /* @__PURE__ */ t("p", { className: s("text-tertiary", S[l]), children: (I = n.selectedItem) == null ? void 0 : I.supportingText })
|
|
74
|
+
] }) : a ? /* @__PURE__ */ t("section", { className: "flex w-full gap-2 truncate", children: /* @__PURE__ */ t(
|
|
75
75
|
"p",
|
|
76
76
|
{
|
|
77
|
-
className:
|
|
77
|
+
className: s(
|
|
78
78
|
"truncate font-medium text-primary",
|
|
79
|
-
|
|
80
|
-
|
|
79
|
+
S[l],
|
|
80
|
+
g
|
|
81
81
|
),
|
|
82
|
-
children:
|
|
82
|
+
children: d
|
|
83
83
|
}
|
|
84
|
-
) }) : /* @__PURE__ */
|
|
84
|
+
) }) : /* @__PURE__ */ t(
|
|
85
85
|
"p",
|
|
86
86
|
{
|
|
87
|
-
className:
|
|
87
|
+
className: s(
|
|
88
88
|
"text-placeholder_subtle",
|
|
89
|
-
|
|
90
|
-
|
|
89
|
+
S[l],
|
|
90
|
+
i && "text-disabled"
|
|
91
91
|
),
|
|
92
|
-
children:
|
|
92
|
+
children: x
|
|
93
93
|
}
|
|
94
94
|
),
|
|
95
|
-
/* @__PURE__ */
|
|
96
|
-
|
|
95
|
+
/* @__PURE__ */ t(
|
|
96
|
+
C,
|
|
97
97
|
{
|
|
98
98
|
"aria-hidden": "true",
|
|
99
|
-
className:
|
|
99
|
+
className: s(
|
|
100
100
|
"ml-auto shrink-0 text-fg-quaternary",
|
|
101
|
-
|
|
101
|
+
l === "sm" ? "size-4 stroke-[2.5px]" : "size-5"
|
|
102
102
|
)
|
|
103
103
|
}
|
|
104
104
|
)
|
|
@@ -107,133 +107,152 @@ const Q = {
|
|
|
107
107
|
}
|
|
108
108
|
)
|
|
109
109
|
}
|
|
110
|
-
),
|
|
111
|
-
placeholder:
|
|
112
|
-
placeholderIcon:
|
|
113
|
-
size:
|
|
114
|
-
items:
|
|
115
|
-
label:
|
|
110
|
+
), ve = ({
|
|
111
|
+
placeholder: P = "Select",
|
|
112
|
+
placeholderIcon: R,
|
|
113
|
+
size: i = "sm",
|
|
114
|
+
items: l,
|
|
115
|
+
label: x,
|
|
116
116
|
hint: h,
|
|
117
|
-
tooltip:
|
|
118
|
-
className:
|
|
117
|
+
tooltip: g,
|
|
118
|
+
className: d,
|
|
119
119
|
textStyles: n,
|
|
120
|
-
popoverClassName:
|
|
121
|
-
onSearchChange:
|
|
122
|
-
onSelectionChange:
|
|
123
|
-
isLoading:
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
120
|
+
popoverClassName: m,
|
|
121
|
+
onSearchChange: c,
|
|
122
|
+
onSelectionChange: a,
|
|
123
|
+
isLoading: u = !1,
|
|
124
|
+
isDeselectable: o = !1,
|
|
125
|
+
searchPlaceholder: y = "Search...",
|
|
126
|
+
selectedDisplayValue: v,
|
|
127
|
+
...I
|
|
127
128
|
}) => {
|
|
128
|
-
const [
|
|
129
|
-
(
|
|
130
|
-
|
|
129
|
+
const [K, k] = M(""), T = _(!1), { selectedKey: N, ...p } = I, b = N === void 0 ? void 0 : N == null || String(N) === "" ? null : N, V = w(
|
|
130
|
+
(r) => {
|
|
131
|
+
k(r), c(r);
|
|
131
132
|
},
|
|
132
|
-
[
|
|
133
|
-
), j =
|
|
134
|
-
(
|
|
135
|
-
var
|
|
136
|
-
|
|
133
|
+
[c]
|
|
134
|
+
), j = w(
|
|
135
|
+
(r) => {
|
|
136
|
+
var e;
|
|
137
|
+
r || (k(""), c("")), (e = p.onOpenChange) == null || e.call(p, r);
|
|
137
138
|
},
|
|
138
|
-
[
|
|
139
|
-
),
|
|
140
|
-
(
|
|
141
|
-
|
|
139
|
+
[p.onOpenChange, c]
|
|
140
|
+
), U = w(() => {
|
|
141
|
+
!o || b == null || (T.current = !0, a == null || a(null), j(!1), queueMicrotask(() => {
|
|
142
|
+
T.current = !1;
|
|
143
|
+
}));
|
|
144
|
+
}, [j, o, a, b]), z = w(
|
|
145
|
+
(r) => {
|
|
146
|
+
if (T.current) return;
|
|
147
|
+
const e = r == null || String(r) === "" ? null : String(r);
|
|
148
|
+
e === null && !o || a == null || a(e);
|
|
142
149
|
},
|
|
143
|
-
[
|
|
144
|
-
),
|
|
145
|
-
return /* @__PURE__ */
|
|
146
|
-
|
|
150
|
+
[o, a]
|
|
151
|
+
), B = [{ id: "none", label: "none" }], O = l.length > 0 ? l : B;
|
|
152
|
+
return /* @__PURE__ */ t(
|
|
153
|
+
X.Provider,
|
|
147
154
|
{
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
155
|
+
value: {
|
|
156
|
+
size: i,
|
|
157
|
+
isDeselectable: o,
|
|
158
|
+
selectedKey: b,
|
|
159
|
+
onReselectCurrent: o ? U : void 0
|
|
160
|
+
},
|
|
161
|
+
children: /* @__PURE__ */ t(
|
|
162
|
+
E,
|
|
163
|
+
{
|
|
164
|
+
...p,
|
|
165
|
+
selectedKey: b,
|
|
166
|
+
onOpenChange: j,
|
|
167
|
+
onSelectionChange: z,
|
|
168
|
+
className: (r) => s(
|
|
169
|
+
"flex flex-col gap-1.5",
|
|
170
|
+
typeof d == "function" ? d(r) : d
|
|
171
|
+
),
|
|
172
|
+
children: (r) => /* @__PURE__ */ f(q, { children: [
|
|
173
|
+
x && /* @__PURE__ */ t(
|
|
174
|
+
J,
|
|
175
|
+
{
|
|
176
|
+
isRequired: r.isRequired,
|
|
177
|
+
tooltip: g,
|
|
178
|
+
className: re[i],
|
|
179
|
+
children: x
|
|
180
|
+
}
|
|
181
|
+
),
|
|
182
|
+
/* @__PURE__ */ t(
|
|
183
|
+
ne,
|
|
184
|
+
{
|
|
185
|
+
...r,
|
|
186
|
+
size: i,
|
|
187
|
+
placeholder: P,
|
|
188
|
+
placeholderIcon: R,
|
|
189
|
+
textStyles: n,
|
|
190
|
+
selectedDisplayValue: v
|
|
191
|
+
}
|
|
192
|
+
),
|
|
193
|
+
/* @__PURE__ */ f(
|
|
194
|
+
Q,
|
|
195
|
+
{
|
|
196
|
+
size: i,
|
|
197
|
+
className: s("flex flex-col", m),
|
|
198
|
+
children: [
|
|
199
|
+
/* @__PURE__ */ t(
|
|
200
|
+
"div",
|
|
191
201
|
{
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
202
|
+
className: "sticky top-0 z-10 bg-primary p-1.5",
|
|
203
|
+
onMouseDown: (e) => e.stopPropagation(),
|
|
204
|
+
onPointerDown: (e) => e.stopPropagation(),
|
|
205
|
+
onClick: (e) => e.stopPropagation(),
|
|
206
|
+
children: /* @__PURE__ */ t(
|
|
207
|
+
$,
|
|
208
|
+
{
|
|
209
|
+
size: "sm",
|
|
210
|
+
placeholder: y,
|
|
211
|
+
value: K,
|
|
212
|
+
onChange: (e) => V(e),
|
|
213
|
+
onKeyDown: (e) => e.stopPropagation(),
|
|
214
|
+
className: "w-full ring-0 outline-hidden bg-secondary rounded-lg"
|
|
215
|
+
}
|
|
216
|
+
)
|
|
198
217
|
}
|
|
199
|
-
)
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
/* @__PURE__ */ e(
|
|
206
|
-
B,
|
|
207
|
-
{
|
|
208
|
-
items: D,
|
|
209
|
-
className: a(
|
|
210
|
-
"size-full outline-hidden px-1",
|
|
211
|
-
(p || r.length === 0) && "hidden"
|
|
212
|
-
),
|
|
213
|
-
children: (t) => /* @__PURE__ */ e(
|
|
214
|
-
H,
|
|
218
|
+
),
|
|
219
|
+
/* @__PURE__ */ f("div", { className: "flex-1 overflow-y-auto", children: [
|
|
220
|
+
u && /* @__PURE__ */ t("div", { className: "flex items-center justify-center py-6", children: /* @__PURE__ */ t(ee, { size: "xs", type: "line-simple" }) }),
|
|
221
|
+
!u && l.length === 0 && /* @__PURE__ */ t("div", { className: "flex items-center justify-center py-6", children: /* @__PURE__ */ t("p", { className: "text-sm text-tertiary", children: "No results" }) }),
|
|
222
|
+
/* @__PURE__ */ t(
|
|
223
|
+
F,
|
|
215
224
|
{
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
+
items: O,
|
|
226
|
+
className: s(
|
|
227
|
+
"size-full outline-hidden px-1",
|
|
228
|
+
(u || l.length === 0) && "hidden"
|
|
229
|
+
),
|
|
230
|
+
children: (e) => /* @__PURE__ */ t(
|
|
231
|
+
W,
|
|
232
|
+
{
|
|
233
|
+
id: e.id,
|
|
234
|
+
label: e.label,
|
|
235
|
+
avatarUrl: e.avatarUrl,
|
|
236
|
+
supportingText: e.supportingText,
|
|
237
|
+
isDisabled: e.isDisabled,
|
|
238
|
+
icon: e.icon,
|
|
239
|
+
textStyles: n
|
|
240
|
+
},
|
|
241
|
+
e.id
|
|
242
|
+
)
|
|
243
|
+
}
|
|
225
244
|
)
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
245
|
+
] })
|
|
246
|
+
]
|
|
247
|
+
}
|
|
248
|
+
),
|
|
249
|
+
h && /* @__PURE__ */ t(G, { isInvalid: r.isInvalid, children: h })
|
|
250
|
+
] })
|
|
251
|
+
}
|
|
252
|
+
)
|
|
234
253
|
}
|
|
235
|
-
)
|
|
254
|
+
);
|
|
236
255
|
};
|
|
237
256
|
export {
|
|
238
|
-
|
|
257
|
+
ve as SearchableSelect
|
|
239
258
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select-item.d.ts","sourceRoot":"","sources":["../../../src/primitives/select/select-item.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"select-item.d.ts","sourceRoot":"","sources":["../../../src/primitives/select/select-item.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,gBAAgB,IAAI,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAMtF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAW/C,UAAU,eACR,SAAQ,IAAI,CAAC,oBAAoB,CAAC,cAAc,CAAC,EAAE,IAAI,CAAC,EAAE,cAAc;IACxE,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,eAAO,MAAM,UAAU,GAAI,oHAYxB,eAAe,4CAqIjB,CAAC"}
|
|
@@ -1,52 +1,68 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useContext as
|
|
3
|
-
import { Check as
|
|
4
|
-
import { ListBoxItem as
|
|
5
|
-
import { Avatar as
|
|
6
|
-
import { SelectContext as
|
|
7
|
-
import { cx as
|
|
8
|
-
import { isReactComponent as
|
|
9
|
-
const
|
|
1
|
+
import { jsx as n, jsxs as p } from "react/jsx-runtime";
|
|
2
|
+
import { useContext as k, isValidElement as N } from "react";
|
|
3
|
+
import { Check as R } from "@untitledui/icons";
|
|
4
|
+
import { ListBoxItem as V, Text as w } from "react-aria-components";
|
|
5
|
+
import { Avatar as j } from "../avatar/avatar.js";
|
|
6
|
+
import { SelectContext as q, fontSizes as C } from "./select.js";
|
|
7
|
+
import { cx as l } from "../../utils/cn.js";
|
|
8
|
+
import { isReactComponent as A } from "../../utils/is-react-component.js";
|
|
9
|
+
const B = {
|
|
10
10
|
sm: "p-2 pr-2.5",
|
|
11
11
|
md: "p-2.5 pl-2",
|
|
12
12
|
xs: "p-1.5"
|
|
13
|
-
},
|
|
14
|
-
label:
|
|
15
|
-
id:
|
|
16
|
-
value:
|
|
17
|
-
avatarUrl:
|
|
13
|
+
}, J = ({
|
|
14
|
+
label: d,
|
|
15
|
+
id: s,
|
|
16
|
+
value: v,
|
|
17
|
+
avatarUrl: m,
|
|
18
18
|
supportingText: r,
|
|
19
|
-
isDisabled:
|
|
20
|
-
icon:
|
|
21
|
-
className:
|
|
22
|
-
children:
|
|
23
|
-
textStyles:
|
|
24
|
-
...
|
|
19
|
+
isDisabled: c,
|
|
20
|
+
icon: o,
|
|
21
|
+
className: u,
|
|
22
|
+
children: a,
|
|
23
|
+
textStyles: D,
|
|
24
|
+
...t
|
|
25
25
|
}) => {
|
|
26
|
-
const { size:
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
const { size: f, isDeselectable: P, selectedKey: b, onReselectCurrent: h } = k(q), y = P && b != null && s != null && String(s) === String(b), S = (e) => {
|
|
27
|
+
!y || c || (e.preventDefault(), e.stopPropagation());
|
|
28
|
+
}, g = (e) => {
|
|
29
|
+
!y || c || !h || ("preventDefault" in e && (e.preventDefault(), e.stopPropagation()), h());
|
|
30
|
+
}, x = d || (typeof a == "string" ? a : ""), z = r ? x + " " + r : x;
|
|
31
|
+
return /* @__PURE__ */ n(
|
|
32
|
+
V,
|
|
29
33
|
{
|
|
30
|
-
id:
|
|
31
|
-
value:
|
|
32
|
-
id:
|
|
33
|
-
label:
|
|
34
|
-
avatarUrl:
|
|
34
|
+
id: s,
|
|
35
|
+
value: v ?? {
|
|
36
|
+
id: s,
|
|
37
|
+
label: x,
|
|
38
|
+
avatarUrl: m,
|
|
35
39
|
supportingText: r,
|
|
36
|
-
isDisabled:
|
|
37
|
-
icon:
|
|
40
|
+
isDisabled: c,
|
|
41
|
+
icon: o
|
|
38
42
|
},
|
|
39
|
-
textValue:
|
|
40
|
-
isDisabled:
|
|
41
|
-
...
|
|
42
|
-
|
|
43
|
+
textValue: z,
|
|
44
|
+
isDisabled: c,
|
|
45
|
+
...t,
|
|
46
|
+
onPointerDownCapture: (e) => {
|
|
47
|
+
var i;
|
|
48
|
+
(i = t.onPointerDownCapture) == null || i.call(t, e), S(e);
|
|
49
|
+
},
|
|
50
|
+
onPointerUpCapture: (e) => {
|
|
51
|
+
var i;
|
|
52
|
+
(i = t.onPointerUpCapture) == null || i.call(t, e), g(e);
|
|
53
|
+
},
|
|
54
|
+
onPress: (e) => {
|
|
55
|
+
var i;
|
|
56
|
+
(i = t.onPress) == null || i.call(t, e), e.pointerType === "keyboard" && g(e);
|
|
57
|
+
},
|
|
58
|
+
className: (e) => l(
|
|
43
59
|
"w-full px-1.5 py-px outline-hidden",
|
|
44
|
-
typeof
|
|
60
|
+
typeof u == "function" ? u(e) : u
|
|
45
61
|
),
|
|
46
|
-
children: (e) => /* @__PURE__ */
|
|
62
|
+
children: (e) => /* @__PURE__ */ p(
|
|
47
63
|
"div",
|
|
48
64
|
{
|
|
49
|
-
className:
|
|
65
|
+
className: l(
|
|
50
66
|
"flex cursor-pointer items-center gap-2 rounded-md outline-hidden select-none hover:bg-primary_hover",
|
|
51
67
|
e.isSelected && "bg-brand-primary text-brand-600 hover:bg-brand-primary hover:text-brand-600",
|
|
52
68
|
e.isDisabled && "cursor-not-allowed",
|
|
@@ -55,42 +71,42 @@ const V = {
|
|
|
55
71
|
"*:data-icon:size-5 *:data-icon:shrink-0 *:data-icon:text-fg-quaternary",
|
|
56
72
|
e.isDisabled && "*:data-icon:text-fg-disabled",
|
|
57
73
|
// @ts-ignore
|
|
58
|
-
|
|
74
|
+
B[f]
|
|
59
75
|
),
|
|
60
76
|
children: [
|
|
61
|
-
|
|
62
|
-
/* @__PURE__ */
|
|
63
|
-
/* @__PURE__ */
|
|
64
|
-
|
|
77
|
+
m ? /* @__PURE__ */ n(j, { "aria-hidden": "true", size: "sm", src: m, alt: d }) : A(o) ? /* @__PURE__ */ n(o, { "data-icon": !0, "aria-hidden": "true" }) : N(o) ? o : null,
|
|
78
|
+
/* @__PURE__ */ p("div", { className: "flex w-full min-w-0 flex-1 flex-wrap gap-x-2", children: [
|
|
79
|
+
/* @__PURE__ */ n(
|
|
80
|
+
w,
|
|
65
81
|
{
|
|
66
82
|
slot: "label",
|
|
67
|
-
className:
|
|
83
|
+
className: l(
|
|
68
84
|
"truncate font-medium whitespace-nowrap text-primary",
|
|
69
85
|
e.isDisabled && "text-disabled",
|
|
70
|
-
|
|
71
|
-
|
|
86
|
+
D,
|
|
87
|
+
C[f]
|
|
72
88
|
),
|
|
73
|
-
children:
|
|
89
|
+
children: d || (typeof a == "function" ? a(e) : a)
|
|
74
90
|
}
|
|
75
91
|
),
|
|
76
|
-
r && /* @__PURE__ */
|
|
77
|
-
|
|
92
|
+
r && /* @__PURE__ */ n(
|
|
93
|
+
w,
|
|
78
94
|
{
|
|
79
95
|
slot: "description",
|
|
80
|
-
className:
|
|
96
|
+
className: l(
|
|
81
97
|
"whitespace-nowrap text-tertiary",
|
|
82
|
-
|
|
98
|
+
C[f],
|
|
83
99
|
e.isDisabled && "text-disabled"
|
|
84
100
|
),
|
|
85
101
|
children: r
|
|
86
102
|
}
|
|
87
103
|
)
|
|
88
104
|
] }),
|
|
89
|
-
e.isSelected && /* @__PURE__ */
|
|
90
|
-
|
|
105
|
+
e.isSelected && /* @__PURE__ */ n(
|
|
106
|
+
R,
|
|
91
107
|
{
|
|
92
108
|
"aria-hidden": "true",
|
|
93
|
-
className:
|
|
109
|
+
className: l(
|
|
94
110
|
"ml-auto text-fg-brand-primary",
|
|
95
111
|
e.isDisabled && "text-fg-disabled"
|
|
96
112
|
),
|
|
@@ -104,5 +120,5 @@ const V = {
|
|
|
104
120
|
);
|
|
105
121
|
};
|
|
106
122
|
export {
|
|
107
|
-
|
|
123
|
+
J as SelectItem
|
|
108
124
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FC, ReactNode, RefAttributes } from 'react';
|
|
2
|
-
import { SelectProps as AriaSelectProps } from 'react-aria-components';
|
|
2
|
+
import { Key, SelectProps as AriaSelectProps } from 'react-aria-components';
|
|
3
3
|
import { ComboBox } from './combobox';
|
|
4
4
|
import { SelectItem } from './select-item';
|
|
5
5
|
import { SearchableSelect } from './searchable-select';
|
|
@@ -28,6 +28,8 @@ export interface SelectProps extends Omit<AriaSelectProps<SelectItemType>, "chil
|
|
|
28
28
|
showChevron?: boolean;
|
|
29
29
|
/** When true, shows a clear button when a value is selected. Clearing calls onSelectionChange(null). Default false. */
|
|
30
30
|
isClearable?: boolean;
|
|
31
|
+
/** When true, clicking the already-selected option in the dropdown clears the selection. Default false. */
|
|
32
|
+
isDeselectable?: boolean;
|
|
31
33
|
}
|
|
32
34
|
export declare const sizes: {
|
|
33
35
|
sm: {
|
|
@@ -50,8 +52,11 @@ export declare const fontSizes: {
|
|
|
50
52
|
};
|
|
51
53
|
export declare const SelectContext: import('react').Context<{
|
|
52
54
|
size: "sm" | "md" | "lg";
|
|
55
|
+
isDeselectable?: boolean;
|
|
56
|
+
selectedKey?: Key | null;
|
|
57
|
+
onReselectCurrent?: () => void;
|
|
53
58
|
}>;
|
|
54
|
-
declare const Select: ({ placeholder, placeholderIcon, size, children, items, label, hint, tooltip, className, textStyles, showChevron, isClearable, ...rest }: SelectProps) => import("react/jsx-runtime").JSX.Element;
|
|
59
|
+
declare const Select: ({ placeholder, placeholderIcon, size, children, items, label, hint, tooltip, className, textStyles, showChevron, isClearable, isDeselectable, ...rest }: SelectProps) => import("react/jsx-runtime").JSX.Element;
|
|
55
60
|
declare const _Select: typeof Select & {
|
|
56
61
|
ComboBox: typeof ComboBox;
|
|
57
62
|
Item: typeof SelectItem;
|