@bioturing/components 0.28.1 → 0.29.2
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/components/breadcrumb/style.css +1 -1
- package/dist/components/checkbox/style.css +1 -1
- package/dist/components/choice-list/component.js +137 -50
- package/dist/components/choice-list/component.js.map +1 -1
- package/dist/components/choice-list/style.css +1 -1
- package/dist/components/code-block/component.js +8 -8
- package/dist/components/color-select/style.css +1 -1
- package/dist/components/combobox/component.js +171 -141
- package/dist/components/combobox/component.js.map +1 -1
- package/dist/components/combobox/style.css +1 -1
- package/dist/components/drag-drop/style.css +1 -1
- package/dist/components/dropdown-menu/component.js +110 -100
- package/dist/components/dropdown-menu/component.js.map +1 -1
- package/dist/components/dropdown-menu/item.css +1 -1
- package/dist/components/dropdown-menu/item.js +52 -49
- package/dist/components/dropdown-menu/item.js.map +1 -1
- package/dist/components/dropdown-menu/style.css +1 -1
- package/dist/components/ds-root/component.js +22 -17
- package/dist/components/ds-root/component.js.map +1 -1
- package/dist/components/ds-root/style.css +1 -1
- package/dist/components/form/style.css +1 -1
- package/dist/components/modal/style.css +1 -1
- package/dist/components/nav/style.css +1 -1
- package/dist/components/resizable/component.js +27 -26
- package/dist/components/resizable/component.js.map +1 -1
- package/dist/components/scroll-area/component.js +70 -24
- package/dist/components/scroll-area/component.js.map +1 -1
- package/dist/components/scroll-area/style.css +1 -1
- package/dist/components/select-trigger/component.js +150 -0
- package/dist/components/select-trigger/component.js.map +1 -0
- package/dist/components/select-trigger/style.css +1 -0
- package/dist/components/switch/style.css +1 -1
- package/dist/components/table/style.css +1 -1
- package/dist/components/theme-provider/component.js.map +1 -1
- package/dist/components/theme-provider/style.css +1 -1
- package/dist/components/toast/component.js +13 -13
- package/dist/components/toast/component.js.map +1 -1
- package/dist/components/tour/style.css +1 -1
- package/dist/components/utils/WithRenderProp.js.map +1 -1
- package/dist/index.d.ts +101 -42
- package/dist/index.js +125 -125
- package/dist/tokens/and-theme/tokens.js +12 -12
- package/dist/tokens/and-theme/tokens.js.map +1 -1
- package/package.json +6 -6
- package/dist/components/combobox/trigger.js +0 -89
- package/dist/components/combobox/trigger.js.map +0 -1
|
@@ -1,202 +1,232 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import { useControlled as
|
|
5
|
-
import {
|
|
2
|
+
import { jsxs as ce, Fragment as ue, jsx as p } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef as fe, useState as _, useContext as K, useCallback as i, useMemo as x } from "react";
|
|
4
|
+
import { useControlled as be } from "@base-ui-components/utils/useControlled";
|
|
5
|
+
import { FormItemInputContext as me } from "antd/es/form/context";
|
|
6
|
+
import pe from "antd/es/config-provider/DisabledContext";
|
|
6
7
|
import './style.css';/* empty css */
|
|
7
|
-
import { DropdownMenuDivider as
|
|
8
|
-
import { DropdownMenuItem as
|
|
9
|
-
import { DropdownMenu as
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
|
|
8
|
+
import { DropdownMenuDivider as xe } from "../dropdown-menu/divider.js";
|
|
9
|
+
import { DropdownMenuItem as ye } from "../dropdown-menu/item.js";
|
|
10
|
+
import { DropdownMenu as ge } from "../dropdown-menu/component.js";
|
|
11
|
+
import { SelectTrigger as ve } from "../select-trigger/component.js";
|
|
12
|
+
import { useControlledState as he } from "../hooks/useControlledState.js";
|
|
13
|
+
import { useCls as Ce } from "../utils/antdUtils.js";
|
|
14
|
+
import { clsx as y } from "../utils/cn.js";
|
|
15
|
+
const Ae = ({
|
|
14
16
|
options: g = [],
|
|
15
|
-
value:
|
|
17
|
+
value: R,
|
|
16
18
|
defaultValue: w,
|
|
17
|
-
onChange:
|
|
18
|
-
placeholder:
|
|
19
|
-
disabled:
|
|
20
|
-
|
|
19
|
+
onChange: v,
|
|
20
|
+
placeholder: $ = "Select...",
|
|
21
|
+
disabled: B = !1,
|
|
22
|
+
status: E,
|
|
23
|
+
allowClear: S = !1,
|
|
21
24
|
multiple: t = !1,
|
|
22
|
-
maxTagCount:
|
|
23
|
-
showSearch:
|
|
24
|
-
open:
|
|
25
|
-
onOpenChange:
|
|
26
|
-
placement:
|
|
27
|
-
className:
|
|
25
|
+
maxTagCount: ke,
|
|
26
|
+
showSearch: d = !0,
|
|
27
|
+
open: W,
|
|
28
|
+
onOpenChange: q,
|
|
29
|
+
placement: z = "bottomLeft",
|
|
30
|
+
className: G,
|
|
28
31
|
classNames: a,
|
|
29
|
-
size:
|
|
30
|
-
loading:
|
|
31
|
-
optionRender:
|
|
32
|
-
filterOption:
|
|
33
|
-
onSearch:
|
|
34
|
-
dropdownRender:
|
|
35
|
-
clearIcon:
|
|
36
|
-
suffixIcon:
|
|
37
|
-
dropdownMenuProps:
|
|
38
|
-
triggerProps:
|
|
39
|
-
searchProps:
|
|
40
|
-
showSelectionSummary:
|
|
41
|
-
selectionSummaryRender:
|
|
42
|
-
showSelectAll:
|
|
43
|
-
selectAllRender:
|
|
44
|
-
...
|
|
45
|
-
},
|
|
46
|
-
const [
|
|
32
|
+
size: H = "middle",
|
|
33
|
+
loading: Ie = !1,
|
|
34
|
+
optionRender: De,
|
|
35
|
+
filterOption: h = !0,
|
|
36
|
+
onSearch: C,
|
|
37
|
+
dropdownRender: Me,
|
|
38
|
+
clearIcon: J,
|
|
39
|
+
suffixIcon: Q,
|
|
40
|
+
dropdownMenuProps: U,
|
|
41
|
+
triggerProps: A,
|
|
42
|
+
searchProps: X,
|
|
43
|
+
showSelectionSummary: F = !1,
|
|
44
|
+
selectionSummaryRender: V,
|
|
45
|
+
showSelectAll: L = !1,
|
|
46
|
+
selectAllRender: we,
|
|
47
|
+
...Y
|
|
48
|
+
}, Z) => {
|
|
49
|
+
const [N] = _(
|
|
47
50
|
w !== void 0 ? w : t ? [] : void 0
|
|
48
|
-
), [
|
|
49
|
-
controlled:
|
|
50
|
-
default:
|
|
51
|
+
), [l, O] = be({
|
|
52
|
+
controlled: R,
|
|
53
|
+
default: N,
|
|
51
54
|
name: "value"
|
|
52
|
-
}), [
|
|
53
|
-
|
|
54
|
-
|
|
55
|
+
}), [T, j] = he(
|
|
56
|
+
W,
|
|
57
|
+
q,
|
|
55
58
|
!1
|
|
56
|
-
), [
|
|
59
|
+
), [c, ee] = _(""), u = Ce(), {
|
|
60
|
+
status: te
|
|
61
|
+
// hasFeedback,
|
|
62
|
+
// feedbackIcon,
|
|
63
|
+
} = K(me), le = K(pe), re = E || te, oe = B || le, n = i(
|
|
57
64
|
(e) => {
|
|
58
|
-
O(e),
|
|
65
|
+
O(e), v == null || v(e);
|
|
59
66
|
},
|
|
60
|
-
[O,
|
|
61
|
-
),
|
|
67
|
+
[O, v]
|
|
68
|
+
), P = i(
|
|
62
69
|
(e) => {
|
|
63
70
|
if (t) {
|
|
64
|
-
const
|
|
65
|
-
n(
|
|
71
|
+
const r = Array.isArray(l) ? l : [], b = r.includes(e) ? r.filter((m) => m !== e) : [...r, e];
|
|
72
|
+
n(b);
|
|
66
73
|
} else
|
|
67
74
|
n(e);
|
|
68
75
|
},
|
|
69
|
-
[t,
|
|
70
|
-
),
|
|
76
|
+
[t, l, n]
|
|
77
|
+
), ne = i(
|
|
71
78
|
(e) => {
|
|
72
|
-
|
|
79
|
+
ee(e), C == null || C(e);
|
|
73
80
|
},
|
|
74
|
-
[
|
|
81
|
+
[C]
|
|
75
82
|
);
|
|
76
|
-
|
|
77
|
-
(e) => t ? Array.isArray(
|
|
78
|
-
[t,
|
|
83
|
+
i(
|
|
84
|
+
(e) => t ? Array.isArray(l) && l.includes(e) : l === e,
|
|
85
|
+
[t, l]
|
|
79
86
|
);
|
|
80
|
-
const o =
|
|
87
|
+
const o = x(() => !d || !c ? g : g.filter((e) => typeof h == "function" ? h(c, e) : h === !1 ? !0 : (typeof e.label == "string" ? e.label : String(e.value)).toLowerCase().includes(c.toLowerCase())), [g, d, c, h]), k = i(() => {
|
|
81
88
|
if (t) {
|
|
82
|
-
const e = o.map((
|
|
89
|
+
const e = o.map((r) => r.value);
|
|
83
90
|
n(e);
|
|
84
91
|
}
|
|
85
|
-
}, [t, o, n]),
|
|
92
|
+
}, [t, o, n]), I = i(() => {
|
|
86
93
|
t && n([]);
|
|
87
|
-
}, [t, n]),
|
|
94
|
+
}, [t, n]), se = x(() => o.map((e) => ({
|
|
88
95
|
type: "item",
|
|
89
96
|
key: e.value,
|
|
90
97
|
icon: e.icon,
|
|
91
98
|
label: e.label,
|
|
92
99
|
disabled: e.disabled,
|
|
93
|
-
onClick: () => !e.disabled &&
|
|
94
|
-
})), [o,
|
|
95
|
-
if (!
|
|
100
|
+
onClick: () => !e.disabled && P(e.value)
|
|
101
|
+
})), [o, P]), ae = x(() => {
|
|
102
|
+
if (!L || !t || o.length === 0)
|
|
96
103
|
return null;
|
|
97
|
-
const e = Array.isArray(
|
|
98
|
-
(
|
|
99
|
-
),
|
|
100
|
-
return /* @__PURE__ */
|
|
101
|
-
/* @__PURE__ */
|
|
102
|
-
|
|
104
|
+
const e = Array.isArray(l) ? l : [], r = o.map((M) => M.value), b = e.filter(
|
|
105
|
+
(M) => r.includes(M)
|
|
106
|
+
), m = b.length === o.length && o.length > 0, D = b.length > 0 && b.length < o.length;
|
|
107
|
+
return /* @__PURE__ */ ce(ue, { children: [
|
|
108
|
+
/* @__PURE__ */ p(
|
|
109
|
+
ye,
|
|
103
110
|
{
|
|
104
111
|
item: {
|
|
105
112
|
type: "item",
|
|
106
113
|
key: "select_all",
|
|
107
114
|
label: "Select All",
|
|
108
115
|
onClick: () => {
|
|
109
|
-
|
|
116
|
+
D || m ? I() : k();
|
|
110
117
|
}
|
|
111
118
|
},
|
|
112
|
-
inCombobox:
|
|
113
|
-
selected:
|
|
119
|
+
inCombobox: d,
|
|
120
|
+
selected: m,
|
|
114
121
|
showCheckbox: !0,
|
|
115
|
-
indeterminate:
|
|
122
|
+
indeterminate: D,
|
|
116
123
|
renderAsNativeElement: !0,
|
|
117
124
|
onSelect: () => {
|
|
118
|
-
|
|
125
|
+
D || m ? I() : k();
|
|
119
126
|
}
|
|
120
127
|
},
|
|
121
128
|
"select_all"
|
|
122
129
|
),
|
|
123
|
-
/* @__PURE__ */
|
|
130
|
+
/* @__PURE__ */ p(xe, {})
|
|
124
131
|
] });
|
|
125
132
|
}, [
|
|
126
|
-
|
|
133
|
+
L,
|
|
127
134
|
t,
|
|
128
135
|
o,
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
]),
|
|
134
|
-
|
|
135
|
-
|
|
136
|
+
l,
|
|
137
|
+
d,
|
|
138
|
+
I,
|
|
139
|
+
k
|
|
140
|
+
]), f = x(() => Array.isArray(l) ? l : l ? [l] : [], [l]), s = f.map((e) => g.find((r) => r.value === e)).filter(Boolean), { displayValue: ie, displayPrefix: de } = x(() => {
|
|
141
|
+
if (s.length === 0)
|
|
142
|
+
return { displayValue: void 0, displayPrefix: void 0 };
|
|
143
|
+
if (t) {
|
|
144
|
+
const r = `${s.length} ${s.length === 1 ? "item" : "items"} selected`;
|
|
145
|
+
return F ? V ? {
|
|
146
|
+
displayValue: V(f),
|
|
147
|
+
displayPrefix: void 0
|
|
148
|
+
} : {
|
|
149
|
+
displayValue: r,
|
|
150
|
+
// TODO: Create icon component for multiple selection summary
|
|
151
|
+
displayPrefix: void 0
|
|
152
|
+
} : s.length === 1 ? {
|
|
153
|
+
displayValue: s[0].label,
|
|
154
|
+
displayPrefix: s[0].icon
|
|
155
|
+
} : {
|
|
156
|
+
displayValue: r,
|
|
157
|
+
displayPrefix: void 0
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
const e = s[0];
|
|
161
|
+
return {
|
|
162
|
+
displayValue: e == null ? void 0 : e.label,
|
|
163
|
+
displayPrefix: e == null ? void 0 : e.icon
|
|
164
|
+
};
|
|
165
|
+
}, [
|
|
166
|
+
s,
|
|
167
|
+
t,
|
|
168
|
+
F,
|
|
169
|
+
V,
|
|
170
|
+
f
|
|
171
|
+
]);
|
|
172
|
+
return /* @__PURE__ */ p("div", { ref: Z, className: y(u("combobox"), G), ...Y, children: /* @__PURE__ */ p(
|
|
173
|
+
ge,
|
|
136
174
|
{
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
175
|
+
items: se,
|
|
176
|
+
open: T,
|
|
177
|
+
onOpenChange: j,
|
|
178
|
+
placement: z,
|
|
179
|
+
showSearch: d,
|
|
180
|
+
searchProps: {
|
|
181
|
+
placeholder: "Search options...",
|
|
182
|
+
onValueChange: ne,
|
|
183
|
+
value: c,
|
|
184
|
+
...X
|
|
185
|
+
},
|
|
186
|
+
className: y(u("combobox-dropdown")),
|
|
187
|
+
classNames: {
|
|
188
|
+
trigger: y(u("combobox-trigger-wrapper")),
|
|
189
|
+
popup: y(u("combobox-popup")),
|
|
190
|
+
item: y(u("combobox-option"), a == null ? void 0 : a.option),
|
|
191
|
+
...a
|
|
192
|
+
},
|
|
193
|
+
popupMatchTriggerWidth: !0,
|
|
194
|
+
keepOpenOnSelect: t,
|
|
195
|
+
highlightedItemKey: t ? void 0 : f[0],
|
|
196
|
+
showCheckbox: t,
|
|
197
|
+
beforeList: ae,
|
|
198
|
+
selectedItemKeys: f,
|
|
199
|
+
...U,
|
|
200
|
+
children: /* @__PURE__ */ p(
|
|
201
|
+
ve,
|
|
146
202
|
{
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
},
|
|
158
|
-
className: b(i("combobox-dropdown")),
|
|
203
|
+
value: ie,
|
|
204
|
+
prefix: de,
|
|
205
|
+
placeholder: $,
|
|
206
|
+
disabled: oe,
|
|
207
|
+
status: re,
|
|
208
|
+
open: T,
|
|
209
|
+
size: H,
|
|
210
|
+
allowClear: S,
|
|
211
|
+
suffixIcon: Q,
|
|
212
|
+
clearIcon: J,
|
|
159
213
|
classNames: {
|
|
160
|
-
trigger:
|
|
161
|
-
|
|
162
|
-
item: b(i("combobox-option"), a == null ? void 0 : a.option),
|
|
163
|
-
...a
|
|
214
|
+
trigger: a == null ? void 0 : a.trigger,
|
|
215
|
+
...A == null ? void 0 : A.classNames
|
|
164
216
|
},
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
beforeList: ee,
|
|
170
|
-
selectedItemKeys: h,
|
|
171
|
-
...q,
|
|
172
|
-
children: /* @__PURE__ */ m(
|
|
173
|
-
se,
|
|
174
|
-
{
|
|
175
|
-
selectedOptions: te,
|
|
176
|
-
placeholder: F,
|
|
177
|
-
multiple: t,
|
|
178
|
-
disabled: D,
|
|
179
|
-
open: V,
|
|
180
|
-
size: E,
|
|
181
|
-
allowClear: T,
|
|
182
|
-
suffixIcon: W,
|
|
183
|
-
clearIcon: P,
|
|
184
|
-
classNames: a,
|
|
185
|
-
onClear: () => n(t ? [] : void 0),
|
|
186
|
-
showSelectionSummary: H,
|
|
187
|
-
selectionSummaryRender: J,
|
|
188
|
-
...z
|
|
189
|
-
}
|
|
190
|
-
)
|
|
217
|
+
onClear: () => n(t ? [] : void 0),
|
|
218
|
+
onOpenChange: j,
|
|
219
|
+
role: "combobox",
|
|
220
|
+
...A
|
|
191
221
|
}
|
|
192
222
|
)
|
|
193
223
|
}
|
|
194
|
-
);
|
|
195
|
-
},
|
|
224
|
+
) });
|
|
225
|
+
}, Ve = fe(Ae), qe = Object.assign(Ve, {
|
|
196
226
|
// Add any sub components here if needed
|
|
197
227
|
});
|
|
198
228
|
export {
|
|
199
|
-
|
|
200
|
-
|
|
229
|
+
qe as Combobox,
|
|
230
|
+
qe as default
|
|
201
231
|
};
|
|
202
232
|
//# sourceMappingURL=component.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.js","sources":["../../../src/components/combobox/component.tsx"],"sourcesContent":["\"use client\";\nimport React, { forwardRef, useCallback, useMemo, useState } from \"react\";\nimport { useControlled } from \"@base-ui-components/utils/useControlled\";\nimport { clsx, useCls } from \"../utils\";\nimport {\n DropdownMenu,\n DropdownMenuProps,\n DropdownMenuItem,\n type DropdownMenuItemType,\n} from \"../dropdown-menu\";\nimport type { PopoverProps } from \"antd/es/popover\";\nimport { ComboboxTrigger, ComboboxTriggerProps } from \"./trigger\";\n\n// Import component-specific styles\nimport \"./style.css\";\nimport { useControlledState } from \"../hooks\";\nimport { DropdownMenuDivider } from \"../dropdown-menu/divider\";\n\nexport interface ComboboxOption {\n value: string | number;\n label: React.ReactNode;\n disabled?: boolean;\n icon?: React.ReactNode;\n}\n\nexport interface ComboboxProps {\n /** Array of options to be displayed in the combobox */\n options?: ComboboxOption[];\n /** Current value of the combobox */\n value?: string | number | Array<string | number>;\n /** Default value when uncontrolled */\n defaultValue?: string | number | Array<string | number>;\n /** Callback when value changes */\n onChange?: (value: string | number | Array<string | number>) => void;\n /** Placeholder text for the input */\n placeholder?: string;\n /** Whether the combobox is disabled */\n disabled?: boolean;\n /** Whether to allow clearing the selection */\n allowClear?: boolean;\n /** Whether to allow multiple selections */\n multiple?: boolean;\n /** Maximum number of tags to show */\n maxTagCount?: number;\n /** Whether to show search functionality */\n showSearch?: boolean;\n /** Controlled open state */\n open?: boolean;\n /** Callback when open state changes */\n onOpenChange?: (open: boolean) => void;\n /** Placement of the dropdown */\n placement?: PopoverProps[\"placement\"];\n /** Custom className for the component */\n className?: string;\n /** Custom class names for different parts */\n classNames?: {\n trigger?: string;\n input?: string;\n option?: string;\n optionIcon?: string;\n optionText?: string;\n };\n /** Size of the combobox */\n size?: \"small\" | \"middle\" | \"large\";\n /** Loading state */\n loading?: boolean;\n /** Custom render for options */\n optionRender?: (\n option: ComboboxOption,\n props: React.HTMLAttributes<HTMLElement>\n ) => React.ReactElement;\n /** Filter function for search */\n filterOption?: boolean | ((input: string, option: ComboboxOption) => boolean);\n /** Callback when search input changes */\n onSearch?: (value: string) => void;\n /** Custom dropdown render */\n dropdownRender?: (menu: React.ReactElement) => React.ReactElement;\n /** Custom clear icon */\n clearIcon?: React.ReactNode;\n /** Custom suffix icon */\n suffixIcon?: React.ReactNode;\n /**\n * Props to pass to the dropdown menu\n */\n dropdownMenuProps?: DropdownMenuProps;\n /**\n * Props to pass to the combobox trigger\n */\n triggerProps?: ComboboxTriggerProps;\n searchProps?: {\n placeholder?: string;\n onValueChange?: (value: string) => void;\n value?: string;\n };\n /**\n * Show selection summary instead of individual tags when multiple\n * @default false\n */\n showSelectionSummary?: boolean;\n /**\n * Render function for the selection summary in multiple case\n * @default (selectedValues) => `${selectedValues.length} items selected`\n */\n selectionSummaryRender?: (\n selectedValues: Array<string | number>\n ) => React.ReactNode;\n /**\n * Show select all option when in multiple mode\n * @default false\n */\n showSelectAll?: boolean;\n /**\n * Render function for the select all option\n */\n selectAllRender?: (props: {\n onSelectAll: () => void;\n onDeselectAll: () => void;\n checked: boolean;\n indeterminate: boolean;\n }) => React.ReactNode;\n}\n\nconst ComboboxInner = (\n {\n options = [],\n value: controlledValue,\n defaultValue,\n onChange,\n placeholder = \"Select...\",\n disabled = false,\n allowClear = false,\n multiple = false,\n maxTagCount,\n showSearch = true,\n open: controlledOpen,\n onOpenChange,\n placement = \"bottomLeft\",\n className,\n classNames,\n size = \"middle\",\n loading: _loading = false,\n optionRender,\n filterOption = true,\n onSearch,\n dropdownRender,\n clearIcon,\n suffixIcon,\n dropdownMenuProps,\n triggerProps,\n searchProps,\n showSelectionSummary = false,\n selectionSummaryRender,\n showSelectAll = false,\n selectAllRender,\n ...rest\n }: ComboboxProps,\n ref: React.ForwardedRef<HTMLDivElement>\n) => {\n const [initialDefaultValue] = useState(\n defaultValue !== undefined ? defaultValue : multiple ? [] : undefined\n );\n const [value, setValue] = useControlled({\n controlled: controlledValue,\n default: initialDefaultValue,\n name: \"value\",\n });\n\n const [open, setOpen] = useControlledState(\n controlledOpen,\n onOpenChange,\n false\n );\n const [searchValue, setSearchValue] = useState(\"\");\n const cls = useCls();\n\n const handleValueChange = useCallback(\n (newValue: string | number | Array<string | number>) => {\n setValue(newValue);\n onChange?.(newValue);\n },\n [setValue, onChange]\n );\n\n const handleOptionSelect = useCallback(\n (optionValue: string | number) => {\n if (multiple) {\n const currentValues = Array.isArray(value) ? value : [];\n const newValues = currentValues.includes(optionValue)\n ? currentValues.filter((v) => v !== optionValue)\n : [...currentValues, optionValue];\n handleValueChange(newValues);\n } else {\n handleValueChange(optionValue);\n // onOpenChange?.(false);\n }\n },\n [multiple, value, handleValueChange]\n );\n\n const handleSearchChange = useCallback(\n (newValue: string) => {\n setSearchValue(newValue);\n onSearch?.(newValue);\n },\n [onSearch]\n );\n\n // Check if option is selected\n const isSelected = useCallback(\n (optionValue: string | number) => {\n if (multiple) {\n return Array.isArray(value) && value.includes(optionValue);\n }\n return value === optionValue;\n },\n [multiple, value]\n );\n\n // Filter options based on search\n const filteredOptions = useMemo(() => {\n if (!showSearch || !searchValue) return options;\n\n return options.filter((option) => {\n if (typeof filterOption === \"function\") {\n return filterOption(searchValue, option);\n }\n if (filterOption === false) return true;\n\n const label =\n typeof option.label === \"string\" ? option.label : String(option.value);\n return label.toLowerCase().includes(searchValue.toLowerCase());\n });\n }, [options, showSearch, searchValue, filterOption]);\n\n const handleSelectAll = useCallback(() => {\n if (multiple) {\n const allValues = filteredOptions.map((option) => option.value);\n handleValueChange(allValues);\n }\n }, [multiple, filteredOptions, handleValueChange]);\n\n const handleDeselectAll = useCallback(() => {\n if (multiple) {\n handleValueChange([]);\n }\n }, [multiple, handleValueChange]);\n\n // Convert options to DropdownMenu items\n const dropdownItems: DropdownMenuItemType[] = useMemo(() => {\n return filteredOptions.map((option) => {\n return {\n type: \"item\",\n key: option.value,\n icon: option.icon,\n label: option.label,\n disabled: option.disabled,\n onClick: () => !option.disabled && handleOptionSelect(option.value),\n };\n });\n }, [filteredOptions, handleOptionSelect]);\n\n // Select all component for beforeList\n const selectAllComponent = useMemo(() => {\n if (!showSelectAll || !multiple || filteredOptions.length === 0) {\n return null;\n }\n\n const selectedValues = Array.isArray(value) ? value : [];\n const filteredOptionValues = filteredOptions.map((opt) => opt.value);\n const selectedFromFiltered = selectedValues.filter((val) =>\n filteredOptionValues.includes(val)\n );\n const checked =\n selectedFromFiltered.length === filteredOptions.length &&\n filteredOptions.length > 0;\n const indeterminate =\n selectedFromFiltered.length > 0 &&\n selectedFromFiltered.length < filteredOptions.length;\n\n const selectAllItem: DropdownMenuItemType & { type: \"item\" } = {\n type: \"item\",\n key: \"select_all\",\n label: \"Select All\",\n onClick: () => {\n if (indeterminate || checked) {\n handleDeselectAll();\n } else {\n handleSelectAll();\n }\n },\n };\n\n return (\n <>\n <DropdownMenuItem\n key=\"select_all\"\n item={selectAllItem}\n inCombobox={showSearch}\n selected={checked}\n showCheckbox\n indeterminate={indeterminate}\n renderAsNativeElement\n onSelect={() => {\n if (indeterminate || checked) {\n handleDeselectAll();\n } else {\n handleSelectAll();\n }\n }}\n />\n <DropdownMenuDivider />\n </>\n );\n }, [\n showSelectAll,\n multiple,\n filteredOptions,\n value,\n showSearch,\n handleDeselectAll,\n handleSelectAll,\n ]);\n\n // Prepare trigger data\n const selectedValues = Array.isArray(value) ? value : value ? [value] : [];\n const selectedOptions = selectedValues\n .map((val) => options.find((opt) => opt.value === val))\n .filter(Boolean);\n\n return (\n <div\n ref={ref}\n className={clsx(\n cls(\"combobox\"),\n className,\n disabled && \"pointer-events-none opacity-50\"\n )}\n {...rest}\n >\n <DropdownMenu\n items={dropdownItems}\n open={open}\n onOpenChange={setOpen}\n placement={placement}\n showSearch={showSearch}\n searchProps={{\n placeholder: \"Search options...\",\n onValueChange: handleSearchChange,\n value: searchValue,\n ...searchProps,\n }}\n className={clsx(cls(\"combobox-dropdown\"))}\n classNames={{\n trigger: clsx(cls(\"combobox-trigger-wrapper\")),\n popup: clsx(cls(\"combobox-popup\")),\n item: clsx(cls(\"combobox-option\"), classNames?.option),\n ...classNames,\n }}\n popupMatchTriggerWidth\n keepOpenOnSelect={multiple}\n highlightedItemKey={multiple ? undefined : selectedValues[0]}\n showCheckbox={multiple}\n beforeList={selectAllComponent}\n selectedItemKeys={selectedValues}\n {...dropdownMenuProps}\n >\n <ComboboxTrigger\n selectedOptions={selectedOptions}\n placeholder={placeholder}\n multiple={multiple}\n disabled={disabled}\n open={open}\n size={size}\n allowClear={allowClear}\n suffixIcon={suffixIcon}\n clearIcon={clearIcon}\n classNames={classNames}\n onClear={() => handleValueChange(multiple ? [] : undefined)}\n showSelectionSummary={showSelectionSummary}\n selectionSummaryRender={selectionSummaryRender}\n {...triggerProps}\n />\n </DropdownMenu>\n </div>\n );\n};\n\nconst MainCombobox = forwardRef(ComboboxInner);\n\nexport const Combobox = Object.assign(MainCombobox, {\n // Add any sub components here if needed\n});\n\nexport default Combobox;\n"],"names":["ComboboxInner","options","controlledValue","defaultValue","onChange","placeholder","disabled","allowClear","multiple","maxTagCount","showSearch","controlledOpen","onOpenChange","placement","className","classNames","size","_loading","optionRender","filterOption","onSearch","dropdownRender","clearIcon","suffixIcon","dropdownMenuProps","triggerProps","searchProps","showSelectionSummary","selectionSummaryRender","showSelectAll","selectAllRender","rest","ref","initialDefaultValue","useState","value","setValue","useControlled","open","setOpen","useControlledState","searchValue","setSearchValue","cls","useCls","handleValueChange","useCallback","newValue","handleOptionSelect","optionValue","currentValues","newValues","v","handleSearchChange","filteredOptions","useMemo","option","handleSelectAll","allValues","handleDeselectAll","dropdownItems","selectAllComponent","selectedValues","filteredOptionValues","opt","selectedFromFiltered","val","checked","indeterminate","jsxs","Fragment","jsx","DropdownMenuItem","DropdownMenuDivider","selectedOptions","clsx","DropdownMenu","ComboboxTrigger","MainCombobox","forwardRef","Combobox"],"mappings":";;;;;;;;;;;;AA0HA,MAAMA,KAAgB,CACpB;AAAA,EACE,SAAAC,IAAU,CAAC;AAAA,EACX,OAAOC;AAAA,EACP,cAAAC;AAAA,EACA,UAAAC;AAAA,EACA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A,UAAAF;AAAA,cACA,MAAAgC;AAAA,cACA,MAAAtB;AAAA,cACA,YAAAT;AAAA,cACA,YAAAgB;AAAA,cACA,WAAAD;AAAA,cACA,YAAAP;AAAA,cACA,SAAS,MAAM8B,EAAkBrC,IAAW,CAAA,IAAK,MAAS;AAAA,cAC1D,sBAAAmB;AAAA,cACA,wBAAAC;AAAA,cACC,GAAGH;AAAA,YAAA;AAAA,UAAA;AAAA,QACN;AAAA,MAAA;AAAA,IACF;AAAA,EACF;AAEJ,GAEMqD,KAAeC,GAAW/E,EAAa,GAEhCgF,KAAW,OAAO,OAAOF,IAAc;AAAA;AAEpD,CAAC;"}
|
|
1
|
+
{"version":3,"file":"component.js","sources":["../../../src/components/combobox/component.tsx"],"sourcesContent":["\"use client\";\nimport React, {\n forwardRef,\n useCallback,\n useMemo,\n useState,\n useContext,\n} from \"react\";\nimport { useControlled } from \"@base-ui-components/utils/useControlled\";\nimport { FormItemInputContext } from \"antd/es/form/context\";\nimport { ValidateStatus } from \"antd/es/form/FormItem\";\nimport DisabledContext from \"antd/es/config-provider/DisabledContext\";\nimport { clsx, useCls } from \"../utils\";\nimport { SelectTrigger } from \"../select-trigger\";\nimport {\n DropdownMenu,\n DropdownMenuProps,\n DropdownMenuItem,\n type DropdownMenuItemType,\n} from \"../dropdown-menu\";\nimport type { PopoverProps } from \"antd/es/popover\";\n\n// Import component-specific styles\nimport \"./style.css\";\nimport { useControlledState } from \"../hooks\";\nimport { DropdownMenuDivider } from \"../dropdown-menu/divider\";\n\nexport interface ComboboxOption {\n value: string | number;\n label: React.ReactNode;\n disabled?: boolean;\n icon?: React.ReactNode;\n}\n\nexport interface ComboboxProps {\n /** Array of options to be displayed in the combobox */\n options?: ComboboxOption[];\n /** Current value of the combobox */\n value?: string | number | Array<string | number>;\n /** Default value when uncontrolled */\n defaultValue?: string | number | Array<string | number>;\n /** Callback when value changes */\n onChange?: (value: string | number | Array<string | number>) => void;\n /** Placeholder text for the input */\n placeholder?: string;\n /** Whether the combobox is disabled */\n disabled?: boolean;\n /** Validation status */\n status?: ValidateStatus;\n /** Whether to allow clearing the selection */\n allowClear?: boolean;\n /** Whether to allow multiple selections */\n multiple?: boolean;\n /** Maximum number of tags to show */\n maxTagCount?: number;\n /** Whether to show search functionality */\n showSearch?: boolean;\n /** Controlled open state */\n open?: boolean;\n /** Callback when open state changes */\n onOpenChange?: (open: boolean) => void;\n /** Placement of the dropdown */\n placement?: PopoverProps[\"placement\"];\n /** Custom className for the component */\n className?: string;\n /** Custom class names for different parts */\n classNames?: {\n trigger?: string;\n input?: string;\n option?: string;\n optionIcon?: string;\n optionText?: string;\n };\n /** Size of the combobox */\n size?: \"small\" | \"middle\" | \"large\";\n /** Loading state */\n loading?: boolean;\n /** Custom render for options */\n optionRender?: (\n option: ComboboxOption,\n props: React.HTMLAttributes<HTMLElement>\n ) => React.ReactElement;\n /** Filter function for search */\n filterOption?: boolean | ((input: string, option: ComboboxOption) => boolean);\n /** Callback when search input changes */\n onSearch?: (value: string) => void;\n /** Custom dropdown render */\n dropdownRender?: (menu: React.ReactElement) => React.ReactElement;\n /** Custom clear icon */\n clearIcon?: React.ReactNode;\n /** Custom suffix icon */\n suffixIcon?: React.ReactNode;\n /**\n * Props to pass to the dropdown menu\n */\n dropdownMenuProps?: DropdownMenuProps;\n /**\n * Props to pass to the combobox trigger\n */\n triggerProps?: React.ComponentPropsWithoutRef<typeof SelectTrigger>;\n searchProps?: {\n placeholder?: string;\n onValueChange?: (value: string) => void;\n value?: string;\n };\n /**\n * Show selection summary instead of individual tags when multiple\n * @default false\n */\n showSelectionSummary?: boolean;\n /**\n * Render function for the selection summary in multiple case\n * @default (selectedValues) => `${selectedValues.length} items selected`\n */\n selectionSummaryRender?: (\n selectedValues: Array<string | number>\n ) => React.ReactNode;\n /**\n * Show select all option when in multiple mode\n * @default false\n */\n showSelectAll?: boolean;\n /**\n * Render function for the select all option\n */\n selectAllRender?: (props: {\n onSelectAll: () => void;\n onDeselectAll: () => void;\n checked: boolean;\n indeterminate: boolean;\n }) => React.ReactNode;\n}\n\nconst ComboboxInner = (\n {\n options = [],\n value: controlledValue,\n defaultValue,\n onChange,\n placeholder = \"Select...\",\n disabled: disabledProp = false,\n status: statusProp,\n allowClear = false,\n multiple = false,\n maxTagCount,\n showSearch = true,\n open: controlledOpen,\n onOpenChange,\n placement = \"bottomLeft\",\n className,\n classNames,\n size = \"middle\",\n loading: _loading = false,\n optionRender,\n filterOption = true,\n onSearch,\n dropdownRender,\n clearIcon,\n suffixIcon,\n dropdownMenuProps,\n triggerProps,\n searchProps,\n showSelectionSummary = false,\n selectionSummaryRender,\n showSelectAll = false,\n selectAllRender,\n ...rest\n }: ComboboxProps,\n ref: React.ForwardedRef<HTMLDivElement>\n) => {\n const [initialDefaultValue] = useState(\n defaultValue !== undefined ? defaultValue : multiple ? [] : undefined\n );\n const [value, setValue] = useControlled({\n controlled: controlledValue,\n default: initialDefaultValue,\n name: \"value\",\n });\n\n const [open, setOpen] = useControlledState(\n controlledOpen,\n onOpenChange,\n false\n );\n const [searchValue, setSearchValue] = useState(\"\");\n const cls = useCls();\n\n // Get form context values\n const {\n status: contextStatus,\n // hasFeedback,\n // feedbackIcon,\n } = useContext(FormItemInputContext);\n const contextDisabled = useContext(DisabledContext);\n\n // Merge context values with props\n const mergedStatus = statusProp || contextStatus;\n const disabled = disabledProp || contextDisabled;\n\n const handleValueChange = useCallback(\n (newValue: string | number | Array<string | number>) => {\n setValue(newValue);\n onChange?.(newValue);\n },\n [setValue, onChange]\n );\n\n const handleOptionSelect = useCallback(\n (optionValue: string | number) => {\n if (multiple) {\n const currentValues = Array.isArray(value) ? value : [];\n const newValues = currentValues.includes(optionValue)\n ? currentValues.filter((v) => v !== optionValue)\n : [...currentValues, optionValue];\n handleValueChange(newValues);\n } else {\n handleValueChange(optionValue);\n // onOpenChange?.(false);\n }\n },\n [multiple, value, handleValueChange]\n );\n\n const handleSearchChange = useCallback(\n (newValue: string) => {\n setSearchValue(newValue);\n onSearch?.(newValue);\n },\n [onSearch]\n );\n\n // Check if option is selected\n const isSelected = useCallback(\n (optionValue: string | number) => {\n if (multiple) {\n return Array.isArray(value) && value.includes(optionValue);\n }\n return value === optionValue;\n },\n [multiple, value]\n );\n\n // Filter options based on search\n const filteredOptions = useMemo(() => {\n if (!showSearch || !searchValue) return options;\n\n return options.filter((option) => {\n if (typeof filterOption === \"function\") {\n return filterOption(searchValue, option);\n }\n if (filterOption === false) return true;\n\n const label =\n typeof option.label === \"string\" ? option.label : String(option.value);\n return label.toLowerCase().includes(searchValue.toLowerCase());\n });\n }, [options, showSearch, searchValue, filterOption]);\n\n const handleSelectAll = useCallback(() => {\n if (multiple) {\n const allValues = filteredOptions.map((option) => option.value);\n handleValueChange(allValues);\n }\n }, [multiple, filteredOptions, handleValueChange]);\n\n const handleDeselectAll = useCallback(() => {\n if (multiple) {\n handleValueChange([]);\n }\n }, [multiple, handleValueChange]);\n\n // Convert options to DropdownMenu items\n const dropdownItems: DropdownMenuItemType[] = useMemo(() => {\n return filteredOptions.map((option) => {\n return {\n type: \"item\",\n key: option.value,\n icon: option.icon,\n label: option.label,\n disabled: option.disabled,\n onClick: () => !option.disabled && handleOptionSelect(option.value),\n };\n });\n }, [filteredOptions, handleOptionSelect]);\n\n // Select all component for beforeList\n const selectAllComponent = useMemo(() => {\n if (!showSelectAll || !multiple || filteredOptions.length === 0) {\n return null;\n }\n\n const selectedValues = Array.isArray(value) ? value : [];\n const filteredOptionValues = filteredOptions.map((opt) => opt.value);\n const selectedFromFiltered = selectedValues.filter((val) =>\n filteredOptionValues.includes(val)\n );\n const checked =\n selectedFromFiltered.length === filteredOptions.length &&\n filteredOptions.length > 0;\n const indeterminate =\n selectedFromFiltered.length > 0 &&\n selectedFromFiltered.length < filteredOptions.length;\n\n const selectAllItem: DropdownMenuItemType & { type: \"item\" } = {\n type: \"item\",\n key: \"select_all\",\n label: \"Select All\",\n onClick: () => {\n if (indeterminate || checked) {\n handleDeselectAll();\n } else {\n handleSelectAll();\n }\n },\n };\n\n return (\n <>\n <DropdownMenuItem\n key=\"select_all\"\n item={selectAllItem}\n inCombobox={showSearch}\n selected={checked}\n showCheckbox\n indeterminate={indeterminate}\n renderAsNativeElement\n onSelect={() => {\n if (indeterminate || checked) {\n handleDeselectAll();\n } else {\n handleSelectAll();\n }\n }}\n />\n <DropdownMenuDivider />\n </>\n );\n }, [\n showSelectAll,\n multiple,\n filteredOptions,\n value,\n showSearch,\n handleDeselectAll,\n handleSelectAll,\n ]);\n\n // Prepare trigger data\n const selectedValues = useMemo(() => {\n return Array.isArray(value) ? value : value ? [value] : [];\n }, [value]);\n const selectedOptions = selectedValues\n .map((val) => options.find((opt) => opt.value === val))\n .filter(Boolean);\n\n // Generate display value and prefix for SelectTrigger\n const { displayValue, displayPrefix } = useMemo(() => {\n if (selectedOptions.length === 0) {\n return { displayValue: undefined, displayPrefix: undefined };\n }\n\n if (multiple) {\n const summaryText = `${selectedOptions.length} ${\n selectedOptions.length === 1 ? \"item\" : \"items\"\n } selected`;\n if (showSelectionSummary) {\n if (selectionSummaryRender) {\n return {\n displayValue: selectionSummaryRender(selectedValues),\n displayPrefix: undefined,\n };\n }\n // Default summary with icons\n return {\n displayValue: summaryText,\n // TODO: Create icon component for multiple selection summary\n displayPrefix: undefined,\n };\n }\n // For non-summary multiple selection\n return selectedOptions.length === 1\n ? {\n displayValue: selectedOptions[0].label,\n displayPrefix: selectedOptions[0].icon,\n }\n : {\n displayValue: summaryText,\n displayPrefix: undefined,\n };\n }\n\n // Single selection\n const selectedOption = selectedOptions[0];\n return {\n displayValue: selectedOption?.label,\n displayPrefix: selectedOption?.icon,\n };\n }, [\n selectedOptions,\n multiple,\n showSelectionSummary,\n selectionSummaryRender,\n selectedValues,\n ]);\n\n return (\n <div ref={ref} className={clsx(cls(\"combobox\"), className)} {...rest}>\n <DropdownMenu\n items={dropdownItems}\n open={open}\n onOpenChange={setOpen}\n placement={placement}\n showSearch={showSearch}\n searchProps={{\n placeholder: \"Search options...\",\n onValueChange: handleSearchChange,\n value: searchValue,\n ...searchProps,\n }}\n className={clsx(cls(\"combobox-dropdown\"))}\n classNames={{\n trigger: clsx(cls(\"combobox-trigger-wrapper\")),\n popup: clsx(cls(\"combobox-popup\")),\n item: clsx(cls(\"combobox-option\"), classNames?.option),\n ...classNames,\n }}\n popupMatchTriggerWidth\n keepOpenOnSelect={multiple}\n highlightedItemKey={multiple ? undefined : selectedValues[0]}\n showCheckbox={multiple}\n beforeList={selectAllComponent}\n selectedItemKeys={selectedValues}\n {...dropdownMenuProps}\n >\n <SelectTrigger\n value={displayValue}\n prefix={displayPrefix}\n placeholder={placeholder}\n disabled={disabled}\n status={mergedStatus}\n open={open}\n size={size}\n allowClear={allowClear}\n suffixIcon={suffixIcon}\n clearIcon={clearIcon}\n classNames={{\n trigger: classNames?.trigger,\n ...triggerProps?.classNames,\n }}\n onClear={() => handleValueChange(multiple ? [] : undefined)}\n onOpenChange={setOpen}\n role=\"combobox\"\n {...triggerProps}\n />\n </DropdownMenu>\n </div>\n );\n};\n\nconst MainCombobox = forwardRef(ComboboxInner);\n\nexport const Combobox = Object.assign(MainCombobox, {\n // Add any sub components here if needed\n});\n\nexport default Combobox;\n"],"names":["ComboboxInner","options","controlledValue","defaultValue","onChange","placeholder","disabledProp","statusProp","allowClear","multiple","maxTagCount","showSearch","controlledOpen","onOpenChange","placement","className","classNames","size","_loading","optionRender","filterOption","onSearch","dropdownRender","clearIcon","suffixIcon","dropdownMenuProps","triggerProps","searchProps","showSelectionSummary","selectionSummaryRender","showSelectAll","selectAllRender","rest","ref","initialDefaultValue","useState","value","setValue","useControlled","open","setOpen","useControlledState","searchValue","setSearchValue","cls","useCls","contextStatus","useContext","FormItemInputContext","contextDisabled","DisabledContext","mergedStatus","disabled","handleValueChange","useCallback","newValue","handleOptionSelect","optionValue","currentValues","newValues","v","handleSearchChange","filteredOptions","useMemo","option","handleSelectAll","allValues","handleDeselectAll","dropdownItems","selectAllComponent","selectedValues","filteredOptionValues","opt","selectedFromFiltered","val","checked","indeterminate","jsxs","Fragment","jsx","DropdownMenuItem","DropdownMenuDivider","selectedOptions","displayValue","displayPrefix","summaryText","selectedOption","clsx","DropdownMenu","SelectTrigger","MainCombobox","forwardRef","Combobox"],"mappings":";;;;;;;;;;;;;;AAqIA,MAAMA,KAAgB,CACpB;AAAA,EACE,SAAAC,IAAU,CAAC;AAAA,EACX,OAAOC;AAAA,EACP,cAAAC;AAAA,EACA,UAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,EACd,UAAUC,IAAe;AAAA,EACzB,QAAQC;AAAA,EACR,YAAAC,IAAa;AAAA,EACb,UAAAC,IAAW;AAAA,EACX,aAAAC;AAAA,EACA,YAAAC,IAAa;AAAA,EACb,MAAMC;AAAA,EACN,cAAAC;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,WAAAC;AAAA,EACA,YAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,SAASC,KAAW;AAAA,EACpB,cAAAC;AAAA,EACA,cAAAC,IAAe;AAAA,EACf,UAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,WAAAC;AAAA,EACA,YAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,cAAAC;AAAA,EACA,aAAAC;AAAA,EACA,sBAAAC,IAAuB;AAAA,EACvB,wBAAAC;AAAA,EACA,eAAAC,IAAgB;AAAA,EAChB,iBAAAC;AAAA,EACA,GAAGC;AACL,GACAC,MACG;AACG,QAAA,CAACC,CAAmB,IAAIC;AAAA,IAC5BhC,MAAiB,SAAYA,IAAeM,IAAW,CAAA,IAAK;AAAA,EAC9D,GACM,CAAC2B,GAAOC,CAAQ,IAAIC,GAAc;AAAA,IACtC,YAAYpC;AAAA,IACZ,SAASgC;AAAA,IACT,MAAM;AAAA,EAAA,CACP,GAEK,CAACK,GAAMC,CAAO,IAAIC;AAAA,IACtB7B;AAAA,IACAC;AAAA,IACA;AAAA,EACF,GACM,CAAC6B,GAAaC,EAAc,IAAIR,EAAS,EAAE,GA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AAA,UACR,aAAA/E;AAAA,UACA,UAAA+C;AAAA,UACA,QAAQD;AAAA,UACR,MAAAZ;AAAA,UACA,MAAAtB;AAAA,UACA,YAAAT;AAAA,UACA,YAAAgB;AAAA,UACA,WAAAD;AAAA,UACA,YAAY;AAAA,YACV,SAASP,KAAA,gBAAAA,EAAY;AAAA,YACrB,GAAGU,KAAA,gBAAAA,EAAc;AAAA,UACnB;AAAA,UACA,SAAS,MAAM2B,EAAkB5C,IAAW,CAAA,IAAK,MAAS;AAAA,UAC1D,cAAc+B;AAAA,UACd,MAAK;AAAA,UACJ,GAAGd;AAAA,QAAA;AAAA,MAAA;AAAA,IACN;AAAA,EAAA,GAEJ;AAEJ,GAEMgE,KAAeC,GAAW3F,EAAa,GAEhC4F,KAAW,OAAO,OAAOF,IAAc;AAAA;AAEpD,CAAC;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer components{.ds-combobox{position:relative;display:inline-block;
|
|
1
|
+
@layer components{.ds-combobox{position:relative;display:inline-block;width:100%}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.ds-drag-container{position:relative}.ds-draggable{position:relative;cursor:grab;-webkit-user-select:none;user-select:none;background-color:var(--ds-color-bg-container);border:1px solid var(--ds-color-border);border-radius:var(--ds-border-radius);padding:.5rem;margin-bottom:.5rem;display:flex;max-width:100%;gap:.5rem;transition:background-color .2s,border-color .2s,box-shadow .2s}.ds-draggable[data-dragging]{opacity:.5;box-shadow:0 2px 8px #00000026;z-index:1}.ds-draggable[data-disabled]{cursor:not-allowed;opacity:.5;background-color:var(--ds-color-bg-disabled)}.ds-draggable:hover{border-color:var(--ds-color-primary)}.ds-draggable .ds-draggable-indicator{font-size:1.25rem;color:var(--ds-color-icon)}.ds-drop-zone{position:relative;width:100%;background-color:var(--ds-color-fill-alter);border:1px dashed var(--ds-color-border);border-radius:var(--ds-border-radius);padding:.75rem;display:flex;align-items:center;justify-content:center;transition:border-color .1s,background-color .1s}.ds-drop-zone[data-disabled=true]{cursor:not-allowed;background-color:var(--ds-color-bg-disabled);border-color:var(--ds-color-border)}.ds-drop-zone[data-dropping][data-valid],.ds-drop-zone[data-over][data-valid]{border-color:var(--ds-color-primary);background-color:var(--ds-color-primary-bg)}.ds-drop-zone[data-dragging][data-valid]{border-color:var(--ds-color-primary)}.ds-drop-zone .ds-drop-zone-content{display:flex;align-items:center;justify-content:center;text-align:center;gap:.5rem}.ds-drop-zone .ds-drop-zone-icon{font-size:1.25rem;color:var(--ds-color-icon)}.ds-drop-zone .ds-drop-zone-text{color:var(--ds-color-text-description);font-size:var(--ds-font-size)}.ds-dropzone-value{padding:.75rem;border-radius:var(--ds-border-radius);border-width:1px;border-style:solid;border-color:var(--ds-color-border)}.ds-dropzone-value[data-dragging][data-valid]{border-color:var(--ds-color-primary);border-style:dashed}.ds-dropzone-value[data-dropping][data-valid],.ds-dropzone-value[data-over][data-valid]{border-color:var(--ds-color-primary);background-color:var(--ds-color-primary-bg)}.ds-dropzone-value.ds-dropzone-value-multiple{padding:.625rem}.ds-dropzone-value.ds-dropzone-value-multiple .ds-tag{max-width:100%;flex-shrink:0;margin:0}
|
|
1
|
+
.ds-drag-container{position:relative}.ds-draggable{position:relative;cursor:grab;-webkit-user-select:none;user-select:none;background-color:var(--ds-color-bg-container);border:1px solid var(--ds-color-border);border-radius:var(--ds-border-radius);padding:.5rem;margin-bottom:.5rem;display:flex;max-width:100%;gap:.5rem;transition:background-color .2s,border-color .2s,box-shadow .2s}.ds-draggable[data-dragging]{opacity:.5;box-shadow:0 2px 8px #00000026;z-index:1}.ds-draggable[data-disabled]{cursor:not-allowed;opacity:.5;background-color:var(--ds-color-bg-disabled)}.ds-draggable:hover{border-color:var(--ds-color-primary)}.ds-draggable .ds-draggable-indicator{font-size:1.25rem;color:var(--ds-color-icon)}.ds-drop-zone{position:relative;width:100%;background-color:var(--ds-color-fill-alter);border:1px dashed var(--ds-color-border);border-radius:var(--ds-border-radius);padding:.75rem;display:flex;align-items:center;justify-content:center;transition:border-color .1s,background-color .1s}.ds-drop-zone[data-disabled=true]{cursor:not-allowed;background-color:var(--ds-color-bg-disabled);border-color:var(--ds-color-border)}.ds-drop-zone[data-dropping][data-valid],.ds-drop-zone[data-over][data-valid]{border-color:var(--ds-color-primary);background-color:var(--ds-color-primary-bg)}.ds-drop-zone[data-dragging][data-valid]{border-color:var(--ds-color-primary)}.ds-drop-zone .ds-drop-zone-content{display:flex;align-items:center;justify-content:center;text-align:center;gap:.5rem}.ds-drop-zone .ds-drop-zone-icon{font-size:1.25rem;color:var(--ds-color-icon)}.ds-drop-zone .ds-drop-zone-text{color:var(--ds-color-text-description);font-size:var(--ds-font-size)}.ds-dropzone-value{padding:.75rem;border-radius:var(--ds-border-radius);border-width:1px;border-style:solid;border-color:var(--ds-color-border)}.ds-dropzone-value[data-dragging][data-valid]{border-color:var(--ds-color-primary);border-style:dashed}.ds-dropzone-value[data-dropping][data-valid],.ds-dropzone-value[data-over][data-valid]{border-color:var(--ds-color-primary);background-color:var(--ds-color-primary-bg)}.ds-dropzone-value.ds-dropzone-value-multiple{padding:.625rem}.ds-dropzone-value.ds-dropzone-value-multiple .ds-tag{max-width:100%;flex-shrink:0;margin:0}.ds-dropzone-value.ds-dropzone-value-multiple .ds-tag .ds-tag-close-icon{flex-shrink:0}.ds-dropzone-value-icon{color:var(--ds-color-icon);font-size:1.25rem;flex-shrink:0}.ds-dropzone-value-icon.ds-tag-icon{font-size:1rem}.ds-dropzone-value-text{color:var(--ds-color-text-secondary)}
|