@mastra/playground-ui 64.0.0-alpha.8 → 64.0.0-alpha.9
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/combobox-BNlVCFgY.cjs +718 -0
- package/dist/combobox-BNlVCFgY.cjs.map +1 -0
- package/dist/combobox-Bw13EcK0.js +676 -0
- package/dist/combobox-Bw13EcK0.js.map +1 -0
- package/dist/{combobox-styles-B3jftCXY.js → combobox-styles-Dr66ofEp.js} +2 -2
- package/dist/{combobox-styles-B3jftCXY.js.map → combobox-styles-Dr66ofEp.js.map} +1 -1
- package/dist/components/Combobox.cjs.js +22 -1
- package/dist/components/Combobox.cjs.js.map +1 -1
- package/dist/components/Combobox.es.js +2 -2
- package/dist/components/DataList.cjs.js +15 -17
- package/dist/components/DataList.cjs.js.map +1 -1
- package/dist/components/DataList.es.js +4 -5
- package/dist/components/DataList.es.js.map +1 -1
- package/dist/components/EnvironmentVariablesEditor.cjs.js +1 -1
- package/dist/components/EnvironmentVariablesEditor.es.js +1 -1
- package/dist/components/FilterBar.es.js +3 -3
- package/dist/components/LogsDataList.cjs.js +5 -2
- package/dist/components/LogsDataList.cjs.js.map +1 -1
- package/dist/components/LogsDataList.es.js +5 -2
- package/dist/components/LogsDataList.es.js.map +1 -1
- package/dist/components/PropertyFilter.cjs.js +1 -1
- package/dist/components/PropertyFilter.es.js +1 -1
- package/dist/components/SavedViews.es.js +1 -1
- package/dist/{data-list-top-DSr_ocKA.js → data-list-DdCZZctL.js} +332 -5
- package/dist/data-list-DdCZZctL.js.map +1 -0
- package/dist/{data-list-top-ByT2Mo77.cjs → data-list-ecHsw-zr.cjs} +339 -13
- package/dist/data-list-ecHsw-zr.cjs.map +1 -0
- package/dist/{data-list-skeleton-B_SXAeE0.js → data-list-skeleton-CGKlcoiI.js} +2 -2
- package/dist/{data-list-skeleton-B_SXAeE0.js.map → data-list-skeleton-CGKlcoiI.js.map} +1 -1
- package/dist/{data-list-skeleton-BqC9Gggi.cjs → data-list-skeleton-DGMTqeNP.cjs} +6 -6
- package/dist/{data-list-skeleton-BqC9Gggi.cjs.map → data-list-skeleton-DGMTqeNP.cjs.map} +1 -1
- package/dist/domains/chat/tools/badges/workflow-badge.cjs.js +2 -0
- package/dist/domains/chat/tools/badges/workflow-badge.cjs.js.map +1 -1
- package/dist/domains/chat/tools/badges/workflow-badge.es.js +2 -0
- package/dist/domains/chat/tools/badges/workflow-badge.es.js.map +1 -1
- package/dist/domains/logs/components/logs-list-view.cjs.js +3 -2
- package/dist/domains/logs/components/logs-list-view.cjs.js.map +1 -1
- package/dist/domains/logs/components/logs-list-view.es.js +3 -2
- package/dist/domains/logs/components/logs-list-view.es.js.map +1 -1
- package/dist/domains/scores/components/span-scoring.cjs.js +1 -1
- package/dist/domains/scores/components/span-scoring.es.js +1 -1
- package/dist/domains/scores/components/trace-scores-tab.cjs.js +2 -1
- package/dist/domains/scores/components/trace-scores-tab.cjs.js.map +1 -1
- package/dist/domains/scores/components/trace-scores-tab.es.js +2 -1
- package/dist/domains/scores/components/trace-scores-tab.es.js.map +1 -1
- package/dist/domains/traces/components/trace-columns-menu.cjs.js +1 -1
- package/dist/domains/traces/components/trace-columns-menu.es.js +1 -1
- package/dist/domains/traces/components/trace-data-panel.cjs.js +2 -0
- package/dist/domains/traces/components/trace-data-panel.cjs.js.map +1 -1
- package/dist/domains/traces/components/trace-data-panel.es.js +2 -0
- package/dist/domains/traces/components/trace-data-panel.es.js.map +1 -1
- package/dist/domains/traces/components/trace-time-range-chip.es.js +1 -1
- package/dist/domains/traces/components/traces-list-view.cjs.js +4 -5
- package/dist/domains/traces/components/traces-list-view.cjs.js.map +1 -1
- package/dist/domains/traces/components/traces-list-view.es.js +3 -4
- package/dist/domains/traces/components/traces-list-view.es.js.map +1 -1
- package/dist/domains/traces/components/traces-page-skeleton.cjs.js +4 -1
- package/dist/domains/traces/components/traces-page-skeleton.cjs.js.map +1 -1
- package/dist/domains/traces/components/traces-page-skeleton.es.js +4 -1
- package/dist/domains/traces/components/traces-page-skeleton.es.js.map +1 -1
- package/dist/domains/workflows/components/workflow-combobox.cjs.js +1 -1
- package/dist/domains/workflows/components/workflow-combobox.es.js +1 -1
- package/dist/domains/workflows/components/workflows-list/workflows-list.cjs.js +2 -2
- package/dist/domains/workflows/components/workflows-list/workflows-list.es.js +2 -2
- package/dist/ee/signals/components/entity-index-list.cjs.js +3 -1
- package/dist/ee/signals/components/entity-index-list.cjs.js.map +1 -1
- package/dist/ee/signals/components/entity-index-list.es.js +3 -1
- package/dist/ee/signals/components/entity-index-list.es.js.map +1 -1
- package/dist/ee/signals/components/trace-intelligence-entity-index.cjs.js +3 -1
- package/dist/ee/signals/components/trace-intelligence-entity-index.cjs.js.map +1 -1
- package/dist/ee/signals/components/trace-intelligence-entity-index.es.js +3 -1
- package/dist/ee/signals/components/trace-intelligence-entity-index.es.js.map +1 -1
- package/dist/ee/topics/components/topic-trace-summary-list.cjs.js +1 -1
- package/dist/ee/topics/components/topic-trace-summary-list.es.js +1 -1
- package/dist/{filter-bar-chip-BAqmNIeE.js → filter-bar-chip-BarAq1S2.js} +2 -2
- package/dist/{filter-bar-chip-BAqmNIeE.js.map → filter-bar-chip-BarAq1S2.js.map} +1 -1
- package/dist/layout/tabbed-container.cjs.js +2 -2
- package/dist/layout/tabbed-container.es.js +2 -2
- package/dist/{logs-data-list-CoER2Hst.js → logs-data-list-DBJINzIL.js} +2 -3
- package/dist/{logs-data-list-CoER2Hst.js.map → logs-data-list-DBJINzIL.js.map} +1 -1
- package/dist/{logs-data-list-DRR6cMgl.cjs → logs-data-list-IWZgMCKG.cjs} +21 -22
- package/dist/{logs-data-list-DRR6cMgl.cjs.map → logs-data-list-IWZgMCKG.cjs.map} +1 -1
- package/dist/src/ds/components/Combobox/combobox-parts.d.ts +102 -0
- package/dist/src/ds/components/Combobox/combobox.d.ts +17 -3
- package/dist/src/ds/components/Combobox/index.d.ts +1 -0
- package/dist/style.css +79 -1
- package/dist/{traces-data-list-0GcqZUbe.js → traces-data-list-BgloVIVi.js} +2 -4
- package/dist/{traces-data-list-0GcqZUbe.js.map → traces-data-list-BgloVIVi.js.map} +1 -1
- package/dist/{traces-data-list-B0-fbEpk.cjs → traces-data-list-CHREkLv0.cjs} +17 -19
- package/dist/{traces-data-list-B0-fbEpk.cjs.map → traces-data-list-CHREkLv0.cjs.map} +1 -1
- package/package.json +9 -9
- package/dist/combobox-DlKD-Q3M.js +0 -208
- package/dist/combobox-DlKD-Q3M.js.map +0 -1
- package/dist/combobox-VHtZQcl9.cjs +0 -229
- package/dist/combobox-VHtZQcl9.cjs.map +0 -1
- package/dist/data-list-DUfXIhyC.cjs +0 -142
- package/dist/data-list-DUfXIhyC.cjs.map +0 -1
- package/dist/data-list-DXQY_iQW.js +0 -138
- package/dist/data-list-DXQY_iQW.js.map +0 -1
- package/dist/data-list-spacer-ByA4ce2a.js +0 -209
- package/dist/data-list-spacer-ByA4ce2a.js.map +0 -1
- package/dist/data-list-spacer-tQaBaum4.cjs +0 -218
- package/dist/data-list-spacer-tQaBaum4.cjs.map +0 -1
- package/dist/data-list-top-ByT2Mo77.cjs.map +0 -1
- package/dist/data-list-top-DSr_ocKA.js.map +0 -1
|
@@ -0,0 +1,718 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
const combobox = require('@base-ui/react/combobox');
|
|
5
|
+
const lucideReact = require('lucide-react');
|
|
6
|
+
const React = require('react');
|
|
7
|
+
const comboboxStyles = require('./combobox-styles-BK2nGTNl.cjs');
|
|
8
|
+
const Button = require('./Button-DH1aTzbs.cjs');
|
|
9
|
+
const scrollArea = require('./scroll-area-CAY0DNQj.cjs');
|
|
10
|
+
const primitives_floating = require('./primitives/floating.cjs.js');
|
|
11
|
+
const primitives_fluidMenu = require('./primitives/fluid-menu.cjs.js');
|
|
12
|
+
const primitives_menuItem = require('./primitives/menu-item.cjs.js');
|
|
13
|
+
const primitives_passwordManagerAutofill = require('./primitives/password-manager-autofill.cjs.js');
|
|
14
|
+
const primitives_portalContainer = require('./primitives/portal-container.cjs.js');
|
|
15
|
+
const utils_cn = require('./cn-DlOJCxrS.cjs');
|
|
16
|
+
const fieldControlAria = require('./field-control-aria-WzMGs0A4.cjs');
|
|
17
|
+
const fieldErrorId = require('./field-error-id-Dbe6IInA.cjs');
|
|
18
|
+
const primitives_formElement = require('./primitives/form-element.cjs.js');
|
|
19
|
+
|
|
20
|
+
function _interopNamespaceDefault(e) {
|
|
21
|
+
const n = Object.create(null, { [Symbol.toStringTag]: { value: 'Module' } });
|
|
22
|
+
if (e) {
|
|
23
|
+
for (const k in e) {
|
|
24
|
+
if (k !== 'default') {
|
|
25
|
+
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
26
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
27
|
+
enumerable: true,
|
|
28
|
+
get: () => e[k]
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
n.default = e;
|
|
34
|
+
return Object.freeze(n);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
38
|
+
|
|
39
|
+
const FieldAnchorContext = React__namespace.createContext(void 0);
|
|
40
|
+
function ComboboxRoot(props) {
|
|
41
|
+
const [field, setField] = React__namespace.useState(null);
|
|
42
|
+
return /* @__PURE__ */ jsxRuntime.jsx(FieldAnchorContext.Provider, { value: { field: field ?? void 0, setField }, children: /* @__PURE__ */ jsxRuntime.jsx(combobox.Combobox.Root, { ...props }) });
|
|
43
|
+
}
|
|
44
|
+
const fieldClass = (size = "md") => utils_cn.cn(
|
|
45
|
+
comboboxStyles.comboboxTriggerClass({ variant: "default", size }),
|
|
46
|
+
// The Button recipe brightens icons on hover; a field's chevron stays muted.
|
|
47
|
+
"cursor-text gap-2 focus-within:[--surface-rim:var(--field-rim-focus)] not-disabled:hover:[&_svg]:text-muted-foreground",
|
|
48
|
+
// Disabled like other form elements (muted text, not-allowed cursor). Keyed off the input because
|
|
49
|
+
// Base UI marks the input group, not the chips field, with `data-disabled`.
|
|
50
|
+
"has-[input:disabled]:cursor-not-allowed has-[input:disabled]:bg-field-disabled has-[input:disabled]:[&_*]:cursor-not-allowed has-[input:disabled]:[&_*]:text-muted-foreground",
|
|
51
|
+
// The input inside carries `aria-invalid`; the field shows it like other invalid fields.
|
|
52
|
+
"has-[[aria-invalid=true]]:[--field-rim-focus:var(--destructive-indicator)] has-[[aria-invalid=true]]:[--field-rim:var(--destructive-indicator)]"
|
|
53
|
+
);
|
|
54
|
+
const fieldPx = "0.9em";
|
|
55
|
+
const fieldStyle = {
|
|
56
|
+
paddingInlineStart: fieldPx,
|
|
57
|
+
paddingInlineEnd: `calc(${fieldPx} - 6.33px)`
|
|
58
|
+
};
|
|
59
|
+
const chipsFieldStyle = {
|
|
60
|
+
// Longhands only: a `padding` shorthand here would also reset the chevron's end padding.
|
|
61
|
+
paddingBlock: "4px",
|
|
62
|
+
paddingInlineStart: "4px",
|
|
63
|
+
paddingInlineEnd: fieldStyle.paddingInlineEnd
|
|
64
|
+
};
|
|
65
|
+
const inputClass = "h-full w-0 min-w-0 flex-1 bg-transparent text-foreground outline-none placeholder:text-muted-foreground";
|
|
66
|
+
function moveCaretToEnd(event) {
|
|
67
|
+
const input = event.currentTarget;
|
|
68
|
+
requestAnimationFrame(() => input.setSelectionRange(input.value.length, input.value.length));
|
|
69
|
+
}
|
|
70
|
+
function ComboboxValue(props) {
|
|
71
|
+
return /* @__PURE__ */ jsxRuntime.jsx(combobox.Combobox.Value, { "data-slot": "combobox-value", ...props });
|
|
72
|
+
}
|
|
73
|
+
function ComboboxFieldTrigger() {
|
|
74
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
75
|
+
combobox.Combobox.Trigger,
|
|
76
|
+
{
|
|
77
|
+
"data-slot": "combobox-field-trigger",
|
|
78
|
+
"aria-label": "Show options",
|
|
79
|
+
className: "flex size-5.5 shrink-0 cursor-pointer items-center justify-center rounded-full text-muted-foreground not-data-disabled:hover:bg-fill",
|
|
80
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, { className: "size-4" })
|
|
81
|
+
}
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
function ComboboxTrigger({
|
|
85
|
+
className,
|
|
86
|
+
children,
|
|
87
|
+
variant = "default",
|
|
88
|
+
size = "md",
|
|
89
|
+
icon,
|
|
90
|
+
showChevron = !(icon && Button.isIconButtonSize(size)),
|
|
91
|
+
...props
|
|
92
|
+
}) {
|
|
93
|
+
const iconOnly = Button.isIconButtonSize(size);
|
|
94
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
95
|
+
combobox.Combobox.Trigger,
|
|
96
|
+
{
|
|
97
|
+
"data-slot": "combobox-trigger",
|
|
98
|
+
"data-shape": iconOnly ? "icon" : void 0,
|
|
99
|
+
className: comboboxStyles.comboboxTriggerClass({ variant, size, className }),
|
|
100
|
+
...props,
|
|
101
|
+
children: [
|
|
102
|
+
iconOnly ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
103
|
+
icon,
|
|
104
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children })
|
|
105
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex min-w-0 flex-1 items-center gap-2", children: [
|
|
106
|
+
icon,
|
|
107
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children })
|
|
108
|
+
] }),
|
|
109
|
+
showChevron ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex shrink-0 items-center", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronsUpDown, { className: utils_cn.cn(comboboxStyles.comboboxStyles.chevron, iconOnly && "ml-0") }) }) : null
|
|
110
|
+
]
|
|
111
|
+
}
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
function ComboboxClear({ className, ...props }) {
|
|
115
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
116
|
+
combobox.Combobox.Clear,
|
|
117
|
+
{
|
|
118
|
+
"data-slot": "combobox-clear",
|
|
119
|
+
"aria-label": "Clear",
|
|
120
|
+
className: utils_cn.cn(
|
|
121
|
+
"flex size-4 shrink-0 items-center justify-center rounded-full text-muted-foreground hover:text-foreground",
|
|
122
|
+
className
|
|
123
|
+
),
|
|
124
|
+
...props,
|
|
125
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "size-3.5" })
|
|
126
|
+
}
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
function ComboboxInput({
|
|
130
|
+
className,
|
|
131
|
+
children,
|
|
132
|
+
showTrigger = true,
|
|
133
|
+
showClear = false,
|
|
134
|
+
size,
|
|
135
|
+
start,
|
|
136
|
+
onFocus,
|
|
137
|
+
...props
|
|
138
|
+
}) {
|
|
139
|
+
const anchor = React__namespace.useContext(FieldAnchorContext);
|
|
140
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
141
|
+
combobox.Combobox.InputGroup,
|
|
142
|
+
{
|
|
143
|
+
ref: anchor?.setField,
|
|
144
|
+
"data-slot": "combobox-input",
|
|
145
|
+
className: utils_cn.cn(fieldClass(size), className),
|
|
146
|
+
style: fieldStyle,
|
|
147
|
+
children: [
|
|
148
|
+
start ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex shrink-0 items-center", children: start }) : null,
|
|
149
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
150
|
+
combobox.Combobox.Input,
|
|
151
|
+
{
|
|
152
|
+
onFocus: (event) => {
|
|
153
|
+
moveCaretToEnd(event);
|
|
154
|
+
onFocus?.(event);
|
|
155
|
+
},
|
|
156
|
+
className: inputClass,
|
|
157
|
+
...primitives_passwordManagerAutofill.passwordManagerOptOutProps,
|
|
158
|
+
...props
|
|
159
|
+
}
|
|
160
|
+
),
|
|
161
|
+
children ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex shrink-0 items-center gap-2 text-muted-foreground", children }) : null,
|
|
162
|
+
showClear ? /* @__PURE__ */ jsxRuntime.jsx(ComboboxClear, {}) : null,
|
|
163
|
+
showTrigger ? /* @__PURE__ */ jsxRuntime.jsx(ComboboxFieldTrigger, {}) : null
|
|
164
|
+
]
|
|
165
|
+
}
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
function ComboboxSearch({ className, ...props }) {
|
|
169
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-slot": "combobox-search", className: comboboxStyles.comboboxStyles.searchContainer, children: [
|
|
170
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Search, { className: comboboxStyles.comboboxStyles.searchIcon }),
|
|
171
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
172
|
+
combobox.Combobox.Input,
|
|
173
|
+
{
|
|
174
|
+
className: utils_cn.cn(comboboxStyles.comboboxStyles.searchInput, className),
|
|
175
|
+
...primitives_passwordManagerAutofill.passwordManagerOptOutProps,
|
|
176
|
+
...props
|
|
177
|
+
}
|
|
178
|
+
)
|
|
179
|
+
] });
|
|
180
|
+
}
|
|
181
|
+
function ComboboxContent({
|
|
182
|
+
className,
|
|
183
|
+
side = "bottom",
|
|
184
|
+
sideOffset = 4,
|
|
185
|
+
align = "start",
|
|
186
|
+
alignOffset = 0,
|
|
187
|
+
anchor,
|
|
188
|
+
container,
|
|
189
|
+
...props
|
|
190
|
+
}) {
|
|
191
|
+
const field = React__namespace.useContext(FieldAnchorContext)?.field;
|
|
192
|
+
const resolvedContainer = primitives_portalContainer.usePortalContainer(container);
|
|
193
|
+
return /* @__PURE__ */ jsxRuntime.jsx(combobox.Combobox.Portal, { container: resolvedContainer, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
194
|
+
combobox.Combobox.Positioner,
|
|
195
|
+
{
|
|
196
|
+
side,
|
|
197
|
+
sideOffset,
|
|
198
|
+
align,
|
|
199
|
+
alignOffset,
|
|
200
|
+
anchor: anchor ?? field,
|
|
201
|
+
positionMethod: primitives_floating.FLOATING_POSITION_METHOD,
|
|
202
|
+
className: comboboxStyles.comboboxStyles.positioner,
|
|
203
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
204
|
+
combobox.Combobox.Popup,
|
|
205
|
+
{
|
|
206
|
+
"data-slot": "combobox-content",
|
|
207
|
+
className: utils_cn.cn(
|
|
208
|
+
comboboxStyles.comboboxStyles.popup,
|
|
209
|
+
field ? "w-(--anchor-width)" : "w-[max(11rem,var(--anchor-width))]",
|
|
210
|
+
className
|
|
211
|
+
),
|
|
212
|
+
...props
|
|
213
|
+
}
|
|
214
|
+
)
|
|
215
|
+
}
|
|
216
|
+
) });
|
|
217
|
+
}
|
|
218
|
+
function ComboboxList({ className, ...props }) {
|
|
219
|
+
const menu = primitives_fluidMenu.useFluidMenu();
|
|
220
|
+
return /* @__PURE__ */ jsxRuntime.jsx(scrollArea.ScrollArea, { maxHeight: "var(--spacing-dropdown)", children: /* @__PURE__ */ jsxRuntime.jsx(scrollArea.ScrollAreaViewport, { className: "scroll-py-8", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: menu.containerClassName, ...menu.getContainerProps({}), children: /* @__PURE__ */ jsxRuntime.jsx(primitives_fluidMenu.FluidMenuItems, { menu, children: /* @__PURE__ */ jsxRuntime.jsx(combobox.Combobox.List, { "data-slot": "combobox-list", className: utils_cn.cn(comboboxStyles.comboboxStyles.list, className), ...props }) }) }) }) });
|
|
221
|
+
}
|
|
222
|
+
function ComboboxItem({ className, children, ref, ...props }) {
|
|
223
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
224
|
+
combobox.Combobox.Item,
|
|
225
|
+
{
|
|
226
|
+
ref: primitives_fluidMenu.useFluidMenuItemRef(ref),
|
|
227
|
+
"data-slot": "combobox-item",
|
|
228
|
+
className: utils_cn.cn(comboboxStyles.comboboxItemClass({}), className),
|
|
229
|
+
...props,
|
|
230
|
+
children: [
|
|
231
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex min-w-0 flex-1 items-center gap-2", children }),
|
|
232
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: comboboxStyles.comboboxStyles.checkContainer, children: /* @__PURE__ */ jsxRuntime.jsx(combobox.Combobox.ItemIndicator, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: comboboxStyles.comboboxStyles.checkIcon }) }) })
|
|
233
|
+
]
|
|
234
|
+
}
|
|
235
|
+
);
|
|
236
|
+
}
|
|
237
|
+
function ComboboxItemContent({ className, ...props }) {
|
|
238
|
+
return /* @__PURE__ */ jsxRuntime.jsx("span", { "data-slot": "combobox-item-content", className: utils_cn.cn("flex min-w-0 flex-col gap-0.5", className), ...props });
|
|
239
|
+
}
|
|
240
|
+
function ComboboxItemTitle({ className, ...props }) {
|
|
241
|
+
return /* @__PURE__ */ jsxRuntime.jsx("span", { "data-slot": "combobox-item-title", className: utils_cn.cn("truncate", className), ...props });
|
|
242
|
+
}
|
|
243
|
+
function ComboboxItemDescription({ className, ...props }) {
|
|
244
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
245
|
+
"span",
|
|
246
|
+
{
|
|
247
|
+
"data-slot": "combobox-item-description",
|
|
248
|
+
className: utils_cn.cn("line-clamp-2 text-caption whitespace-normal text-muted-foreground", className),
|
|
249
|
+
...props
|
|
250
|
+
}
|
|
251
|
+
);
|
|
252
|
+
}
|
|
253
|
+
function ComboboxItemEnd({ className, ...props }) {
|
|
254
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
255
|
+
"span",
|
|
256
|
+
{
|
|
257
|
+
"data-slot": "combobox-item-end",
|
|
258
|
+
className: utils_cn.cn("ml-auto shrink-0 text-caption text-muted-foreground", className),
|
|
259
|
+
...props
|
|
260
|
+
}
|
|
261
|
+
);
|
|
262
|
+
}
|
|
263
|
+
function ComboboxGroup(props) {
|
|
264
|
+
return /* @__PURE__ */ jsxRuntime.jsx(combobox.Combobox.Group, { "data-slot": "combobox-group", ...props });
|
|
265
|
+
}
|
|
266
|
+
function ComboboxLabel({ className, ...props }) {
|
|
267
|
+
return /* @__PURE__ */ jsxRuntime.jsx(combobox.Combobox.GroupLabel, { "data-slot": "combobox-label", className: utils_cn.cn(primitives_menuItem.menuLabelClass, className), ...props });
|
|
268
|
+
}
|
|
269
|
+
function ComboboxCollection(props) {
|
|
270
|
+
return /* @__PURE__ */ jsxRuntime.jsx(combobox.Combobox.Collection, { "data-slot": "combobox-collection", ...props });
|
|
271
|
+
}
|
|
272
|
+
function ComboboxEmpty({ className, ...props }) {
|
|
273
|
+
return /* @__PURE__ */ jsxRuntime.jsx(combobox.Combobox.Empty, { "data-slot": "combobox-empty", className: utils_cn.cn(comboboxStyles.comboboxStyles.empty, className), ...props });
|
|
274
|
+
}
|
|
275
|
+
function ComboboxSeparator({ className, ...props }) {
|
|
276
|
+
return /* @__PURE__ */ jsxRuntime.jsx(combobox.Combobox.Separator, { "data-slot": "combobox-separator", className: utils_cn.cn(primitives_menuItem.menuSeparatorClass, className), ...props });
|
|
277
|
+
}
|
|
278
|
+
function ComboboxChips({ className, children, ...props }) {
|
|
279
|
+
const anchor = React__namespace.useContext(FieldAnchorContext);
|
|
280
|
+
const field = anchor?.field;
|
|
281
|
+
const [multiline, setMultiline] = React__namespace.useState(false);
|
|
282
|
+
React__namespace.useLayoutEffect(() => {
|
|
283
|
+
if (!field || typeof ResizeObserver === "undefined") return;
|
|
284
|
+
const rowHeight = parseFloat(getComputedStyle(field).minHeight) || 0;
|
|
285
|
+
const observer = new ResizeObserver(() => setMultiline(field.offsetHeight > rowHeight + 1));
|
|
286
|
+
observer.observe(field);
|
|
287
|
+
return () => observer.disconnect();
|
|
288
|
+
}, [field]);
|
|
289
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
290
|
+
combobox.Combobox.Chips,
|
|
291
|
+
{
|
|
292
|
+
ref: anchor?.setField,
|
|
293
|
+
"data-slot": "combobox-chips",
|
|
294
|
+
"data-multiline": multiline ? "" : void 0,
|
|
295
|
+
style: chipsFieldStyle,
|
|
296
|
+
className: utils_cn.cn(fieldClass(), "h-auto min-h-control-md items-start data-multiline:rounded-xl", className),
|
|
297
|
+
...props,
|
|
298
|
+
children: [
|
|
299
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex min-w-0 flex-1 flex-wrap gap-[3px]", children }),
|
|
300
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex h-5.5 shrink-0 items-center", children: /* @__PURE__ */ jsxRuntime.jsx(ComboboxFieldTrigger, {}) })
|
|
301
|
+
]
|
|
302
|
+
}
|
|
303
|
+
);
|
|
304
|
+
}
|
|
305
|
+
function ComboboxChip({
|
|
306
|
+
className,
|
|
307
|
+
children,
|
|
308
|
+
showRemove = true,
|
|
309
|
+
...props
|
|
310
|
+
}) {
|
|
311
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
312
|
+
combobox.Combobox.Chip,
|
|
313
|
+
{
|
|
314
|
+
"data-slot": "combobox-chip",
|
|
315
|
+
className: utils_cn.cn(
|
|
316
|
+
// 8px from the left edge to the text, 6px from the text to the ×'s ink, 8px from the ink to
|
|
317
|
+
// the right edge. Text in the controls' role (`text-label`), like the field value.
|
|
318
|
+
"flex h-5.5 items-center rounded-full bg-fill pl-2 text-label text-foreground",
|
|
319
|
+
!showRemove && "pr-2",
|
|
320
|
+
className
|
|
321
|
+
),
|
|
322
|
+
...props,
|
|
323
|
+
children: [
|
|
324
|
+
children,
|
|
325
|
+
showRemove ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
326
|
+
combobox.Combobox.ChipRemove,
|
|
327
|
+
{
|
|
328
|
+
"data-slot": "combobox-chip-remove",
|
|
329
|
+
"aria-label": typeof children === "string" ? `Remove ${children}` : "Remove",
|
|
330
|
+
className: "flex h-full cursor-pointer items-center rounded-r-full pr-[5.5px] pl-[3.5px] text-muted-foreground not-data-disabled:hover:text-foreground",
|
|
331
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "size-3", style: { color: "inherit" } })
|
|
332
|
+
}
|
|
333
|
+
) : null
|
|
334
|
+
]
|
|
335
|
+
}
|
|
336
|
+
);
|
|
337
|
+
}
|
|
338
|
+
function ComboboxChipsInput({ className, onFocus, ...props }) {
|
|
339
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
340
|
+
combobox.Combobox.Input,
|
|
341
|
+
{
|
|
342
|
+
"data-slot": "combobox-chip-input",
|
|
343
|
+
onFocus: (event) => {
|
|
344
|
+
moveCaretToEnd(event);
|
|
345
|
+
onFocus?.(event);
|
|
346
|
+
},
|
|
347
|
+
className: utils_cn.cn(
|
|
348
|
+
inputClass,
|
|
349
|
+
// Text lines up with other fields' text when there are no chips; 4px after a chip otherwise.
|
|
350
|
+
// Not `first:`: Base UI inserts a hidden Dismiss element before the input while open.
|
|
351
|
+
"h-5.5 w-0 min-w-12 flex-1 pl-[calc(0.9em_-_4px)] [[data-slot=combobox-chip]~&]:pl-1",
|
|
352
|
+
className
|
|
353
|
+
),
|
|
354
|
+
...primitives_passwordManagerAutofill.passwordManagerOptOutProps,
|
|
355
|
+
...props
|
|
356
|
+
}
|
|
357
|
+
);
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
const EMPTY_VALUES = [];
|
|
361
|
+
function isMultipleCombobox(props) {
|
|
362
|
+
return props.multiple === true;
|
|
363
|
+
}
|
|
364
|
+
function optionText(option) {
|
|
365
|
+
return typeof option.displayLabel === "string" ? option.displayLabel : option.label;
|
|
366
|
+
}
|
|
367
|
+
function textPlaceholder(placeholder) {
|
|
368
|
+
return typeof placeholder === "string" ? placeholder : void 0;
|
|
369
|
+
}
|
|
370
|
+
function getComboboxShape({
|
|
371
|
+
inFieldContext,
|
|
372
|
+
multiple,
|
|
373
|
+
variant,
|
|
374
|
+
size,
|
|
375
|
+
iconOnlyValue,
|
|
376
|
+
showChevron,
|
|
377
|
+
placeholder
|
|
378
|
+
}) {
|
|
379
|
+
if (!inFieldContext) return "trigger";
|
|
380
|
+
if (variant !== "default") return "trigger";
|
|
381
|
+
if (Button.isIconButtonSize(size)) return "trigger";
|
|
382
|
+
if (iconOnlyValue || !showChevron) return "trigger";
|
|
383
|
+
if (placeholder !== void 0 && textPlaceholder(placeholder) === void 0) return "trigger";
|
|
384
|
+
if (!multiple) return "field";
|
|
385
|
+
if (size !== "md") return "trigger";
|
|
386
|
+
return "chips";
|
|
387
|
+
}
|
|
388
|
+
function getCustomOption(options, inputValue) {
|
|
389
|
+
const value = inputValue.trim();
|
|
390
|
+
if (!value) return void 0;
|
|
391
|
+
if (options.some((option) => option.value === value || optionText(option) === value)) return void 0;
|
|
392
|
+
return { label: `Use “${value}”`, value };
|
|
393
|
+
}
|
|
394
|
+
function useOptionFilter() {
|
|
395
|
+
const { contains } = combobox.Combobox.useFilter();
|
|
396
|
+
return (option, query) => [option.label, optionText(option), ...option.keywords ?? []].some((text) => contains(text, query));
|
|
397
|
+
}
|
|
398
|
+
function getFallbackAriaLabel({ hasLabel, multiple }) {
|
|
399
|
+
if (hasLabel) return void 0;
|
|
400
|
+
return multiple ? "Select options" : "Select option";
|
|
401
|
+
}
|
|
402
|
+
function getControlProps({
|
|
403
|
+
id,
|
|
404
|
+
ariaLabel,
|
|
405
|
+
ariaDescribedBy,
|
|
406
|
+
hasLabel,
|
|
407
|
+
multiple,
|
|
408
|
+
error,
|
|
409
|
+
errorName
|
|
410
|
+
}) {
|
|
411
|
+
const describedBy = [ariaDescribedBy, error ? fieldErrorId.fieldErrorId(errorName) : void 0].filter(Boolean).join(" ");
|
|
412
|
+
return {
|
|
413
|
+
id,
|
|
414
|
+
"aria-label": ariaLabel ?? getFallbackAriaLabel({ hasLabel, multiple }),
|
|
415
|
+
...fieldControlAria.keepOwnAccessibleName({ "aria-label": ariaLabel }),
|
|
416
|
+
...primitives_formElement.deprecatedErrorAria(Boolean(error)),
|
|
417
|
+
"aria-describedby": describedBy || void 0
|
|
418
|
+
};
|
|
419
|
+
}
|
|
420
|
+
function triggerClassName({ iconOnlyValue, className }) {
|
|
421
|
+
return utils_cn.cn(iconOnlyValue && "w-auto px-2.5", className);
|
|
422
|
+
}
|
|
423
|
+
function ComboboxOptionText({ option }) {
|
|
424
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: comboboxStyles.comboboxStyles.optionText, children: [
|
|
425
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: comboboxStyles.comboboxStyles.optionLabel, children: option.label }),
|
|
426
|
+
option.description && /* @__PURE__ */ jsxRuntime.jsx("span", { className: comboboxStyles.comboboxStyles.optionDescription, children: option.description })
|
|
427
|
+
] });
|
|
428
|
+
}
|
|
429
|
+
function ComboboxClearFooter({ label, onClear }) {
|
|
430
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-t border-border p-1", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
431
|
+
Button.Button,
|
|
432
|
+
{
|
|
433
|
+
type: "button",
|
|
434
|
+
variant: "destructive-ghost",
|
|
435
|
+
size: "sm",
|
|
436
|
+
className: "w-full justify-start",
|
|
437
|
+
onClick: onClear,
|
|
438
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, {}),
|
|
439
|
+
children: label
|
|
440
|
+
}
|
|
441
|
+
) });
|
|
442
|
+
}
|
|
443
|
+
function ComboboxOptionsContent({
|
|
444
|
+
showSearch,
|
|
445
|
+
searchPlaceholder,
|
|
446
|
+
emptyText,
|
|
447
|
+
align,
|
|
448
|
+
container,
|
|
449
|
+
footer
|
|
450
|
+
}) {
|
|
451
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(ComboboxContent, { align, container, children: [
|
|
452
|
+
showSearch ? /* @__PURE__ */ jsxRuntime.jsx(ComboboxSearch, { placeholder: searchPlaceholder }) : null,
|
|
453
|
+
/* @__PURE__ */ jsxRuntime.jsx(ComboboxEmpty, { children: emptyText }),
|
|
454
|
+
/* @__PURE__ */ jsxRuntime.jsx(ComboboxList, { children: (option) => /* @__PURE__ */ jsxRuntime.jsxs(ComboboxItem, { value: option, children: [
|
|
455
|
+
option.start,
|
|
456
|
+
/* @__PURE__ */ jsxRuntime.jsx(ComboboxOptionText, { option }),
|
|
457
|
+
option.end ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: comboboxStyles.comboboxStyles.optionEnd, children: option.end }) : null
|
|
458
|
+
] }, option.value) }),
|
|
459
|
+
footer
|
|
460
|
+
] });
|
|
461
|
+
}
|
|
462
|
+
function SingleComboboxControl({
|
|
463
|
+
shape,
|
|
464
|
+
controlProps,
|
|
465
|
+
placeholder,
|
|
466
|
+
selectedOption,
|
|
467
|
+
look
|
|
468
|
+
}) {
|
|
469
|
+
if (shape === "field") {
|
|
470
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
471
|
+
ComboboxInput,
|
|
472
|
+
{
|
|
473
|
+
...controlProps,
|
|
474
|
+
size: Button.isIconButtonSize(look.size) ? void 0 : look.size,
|
|
475
|
+
placeholder: textPlaceholder(placeholder),
|
|
476
|
+
start: selectedOption?.start,
|
|
477
|
+
className: look.className
|
|
478
|
+
}
|
|
479
|
+
);
|
|
480
|
+
}
|
|
481
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
482
|
+
ComboboxTrigger,
|
|
483
|
+
{
|
|
484
|
+
...controlProps,
|
|
485
|
+
variant: look.variant,
|
|
486
|
+
size: look.size,
|
|
487
|
+
showChevron: look.showChevron,
|
|
488
|
+
icon: Button.isIconButtonSize(look.size) ? void 0 : selectedOption?.start,
|
|
489
|
+
className: triggerClassName(look),
|
|
490
|
+
children: selectedOption?.displayLabel ?? /* @__PURE__ */ jsxRuntime.jsx(ComboboxValue, { placeholder })
|
|
491
|
+
}
|
|
492
|
+
);
|
|
493
|
+
}
|
|
494
|
+
function MultipleComboboxControl({
|
|
495
|
+
shape,
|
|
496
|
+
controlProps,
|
|
497
|
+
placeholder,
|
|
498
|
+
selectedCount,
|
|
499
|
+
look
|
|
500
|
+
}) {
|
|
501
|
+
if (shape === "chips") {
|
|
502
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ComboboxChips, { className: look.className, children: /* @__PURE__ */ jsxRuntime.jsx(ComboboxValue, { children: (items) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
503
|
+
items.map((item) => /* @__PURE__ */ jsxRuntime.jsx(ComboboxChip, { children: item.label }, item.value)),
|
|
504
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
505
|
+
ComboboxChipsInput,
|
|
506
|
+
{
|
|
507
|
+
...controlProps,
|
|
508
|
+
placeholder: items.length === 0 ? textPlaceholder(placeholder) : void 0
|
|
509
|
+
}
|
|
510
|
+
)
|
|
511
|
+
] }) }) });
|
|
512
|
+
}
|
|
513
|
+
const text = selectedCount === 0 ? placeholder : `${selectedCount} selected`;
|
|
514
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
515
|
+
ComboboxTrigger,
|
|
516
|
+
{
|
|
517
|
+
...controlProps,
|
|
518
|
+
variant: look.variant,
|
|
519
|
+
size: look.size,
|
|
520
|
+
showChevron: look.showChevron,
|
|
521
|
+
className: triggerClassName(look),
|
|
522
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: utils_cn.cn(selectedCount === 0 && comboboxStyles.comboboxStyles.placeholder), children: text })
|
|
523
|
+
}
|
|
524
|
+
);
|
|
525
|
+
}
|
|
526
|
+
function SingleCombobox({
|
|
527
|
+
shape,
|
|
528
|
+
controlProps,
|
|
529
|
+
options,
|
|
530
|
+
value,
|
|
531
|
+
onValueChange,
|
|
532
|
+
placeholder = "Select option...",
|
|
533
|
+
searchPlaceholder = "Search...",
|
|
534
|
+
emptyText = "No option found.",
|
|
535
|
+
className,
|
|
536
|
+
disabled = false,
|
|
537
|
+
variant = "default",
|
|
538
|
+
size = "md",
|
|
539
|
+
open,
|
|
540
|
+
onOpenChange,
|
|
541
|
+
container,
|
|
542
|
+
align = "start",
|
|
543
|
+
showChevron = true,
|
|
544
|
+
iconOnlyValue = false,
|
|
545
|
+
allowCustomValue = false,
|
|
546
|
+
onInputValueChange
|
|
547
|
+
}) {
|
|
548
|
+
const [inputValue, setInputValue] = React__namespace.useState("");
|
|
549
|
+
const filter = useOptionFilter();
|
|
550
|
+
const inField = shape === "field";
|
|
551
|
+
const selectedOption = options.find((option) => option.value === value);
|
|
552
|
+
const customOption = allowCustomValue ? getCustomOption(options, inputValue) : void 0;
|
|
553
|
+
const items = customOption ? [customOption, ...options] : options;
|
|
554
|
+
function handleInputValueChange(next) {
|
|
555
|
+
setInputValue(next);
|
|
556
|
+
onInputValueChange?.(next);
|
|
557
|
+
}
|
|
558
|
+
function handleValueChange(item) {
|
|
559
|
+
if (!item) return;
|
|
560
|
+
onValueChange?.(item.value);
|
|
561
|
+
if (!inField) handleInputValueChange("");
|
|
562
|
+
}
|
|
563
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
564
|
+
ComboboxRoot,
|
|
565
|
+
{
|
|
566
|
+
autoHighlight: true,
|
|
567
|
+
items,
|
|
568
|
+
filter,
|
|
569
|
+
itemToStringLabel: optionText,
|
|
570
|
+
value: selectedOption ?? null,
|
|
571
|
+
inputValue: inField ? void 0 : inputValue,
|
|
572
|
+
onInputValueChange: handleInputValueChange,
|
|
573
|
+
onValueChange: handleValueChange,
|
|
574
|
+
disabled,
|
|
575
|
+
open,
|
|
576
|
+
onOpenChange,
|
|
577
|
+
children: [
|
|
578
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
579
|
+
SingleComboboxControl,
|
|
580
|
+
{
|
|
581
|
+
shape,
|
|
582
|
+
controlProps,
|
|
583
|
+
placeholder,
|
|
584
|
+
selectedOption,
|
|
585
|
+
look: { variant, size, showChevron, iconOnlyValue, className }
|
|
586
|
+
}
|
|
587
|
+
),
|
|
588
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
589
|
+
ComboboxOptionsContent,
|
|
590
|
+
{
|
|
591
|
+
showSearch: !inField,
|
|
592
|
+
searchPlaceholder,
|
|
593
|
+
emptyText,
|
|
594
|
+
align,
|
|
595
|
+
container
|
|
596
|
+
}
|
|
597
|
+
)
|
|
598
|
+
]
|
|
599
|
+
}
|
|
600
|
+
);
|
|
601
|
+
}
|
|
602
|
+
function MultipleCombobox({
|
|
603
|
+
shape,
|
|
604
|
+
controlProps,
|
|
605
|
+
options,
|
|
606
|
+
value = EMPTY_VALUES,
|
|
607
|
+
onValueChange,
|
|
608
|
+
clearLabel,
|
|
609
|
+
placeholder = "Select options...",
|
|
610
|
+
searchPlaceholder = "Search...",
|
|
611
|
+
emptyText = "No option found.",
|
|
612
|
+
className,
|
|
613
|
+
disabled = false,
|
|
614
|
+
variant = "default",
|
|
615
|
+
size = "md",
|
|
616
|
+
open,
|
|
617
|
+
onOpenChange,
|
|
618
|
+
container,
|
|
619
|
+
align = "start",
|
|
620
|
+
showChevron = true,
|
|
621
|
+
iconOnlyValue = false
|
|
622
|
+
}) {
|
|
623
|
+
const filter = useOptionFilter();
|
|
624
|
+
const selectedValues = new Set(value);
|
|
625
|
+
const selectedOptions = options.filter((option) => selectedValues.has(option.value));
|
|
626
|
+
const footer = clearLabel && selectedOptions.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(ComboboxClearFooter, { label: clearLabel, onClear: () => onValueChange?.([]) }) : void 0;
|
|
627
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
628
|
+
ComboboxRoot,
|
|
629
|
+
{
|
|
630
|
+
multiple: true,
|
|
631
|
+
autoHighlight: true,
|
|
632
|
+
items: options,
|
|
633
|
+
filter,
|
|
634
|
+
value: selectedOptions,
|
|
635
|
+
onValueChange: (items) => onValueChange?.(items.map((item) => item.value)),
|
|
636
|
+
disabled,
|
|
637
|
+
open,
|
|
638
|
+
onOpenChange,
|
|
639
|
+
children: [
|
|
640
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
641
|
+
MultipleComboboxControl,
|
|
642
|
+
{
|
|
643
|
+
shape,
|
|
644
|
+
controlProps,
|
|
645
|
+
placeholder,
|
|
646
|
+
selectedCount: selectedOptions.length,
|
|
647
|
+
look: { variant, size, showChevron, iconOnlyValue, className }
|
|
648
|
+
}
|
|
649
|
+
),
|
|
650
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
651
|
+
ComboboxOptionsContent,
|
|
652
|
+
{
|
|
653
|
+
showSearch: shape !== "chips",
|
|
654
|
+
searchPlaceholder,
|
|
655
|
+
emptyText,
|
|
656
|
+
align,
|
|
657
|
+
container,
|
|
658
|
+
footer
|
|
659
|
+
}
|
|
660
|
+
)
|
|
661
|
+
]
|
|
662
|
+
}
|
|
663
|
+
);
|
|
664
|
+
}
|
|
665
|
+
function Combobox(props) {
|
|
666
|
+
const field = fieldControlAria.useFieldAriaIds();
|
|
667
|
+
const generatedName = React__namespace.useId();
|
|
668
|
+
const multiple = isMultipleCombobox(props);
|
|
669
|
+
const shape = getComboboxShape({
|
|
670
|
+
inFieldContext: Boolean(field),
|
|
671
|
+
multiple,
|
|
672
|
+
variant: props.variant ?? "default",
|
|
673
|
+
size: props.size ?? "md",
|
|
674
|
+
iconOnlyValue: props.iconOnlyValue ?? false,
|
|
675
|
+
showChevron: props.showChevron ?? true,
|
|
676
|
+
placeholder: props.placeholder
|
|
677
|
+
});
|
|
678
|
+
const errorName = props.name ?? generatedName;
|
|
679
|
+
const controlProps = getControlProps({
|
|
680
|
+
id: props.id,
|
|
681
|
+
ariaLabel: props["aria-label"],
|
|
682
|
+
ariaDescribedBy: props["aria-describedby"],
|
|
683
|
+
hasLabel: Boolean(props.id || field),
|
|
684
|
+
multiple,
|
|
685
|
+
error: props.error,
|
|
686
|
+
errorName
|
|
687
|
+
});
|
|
688
|
+
const root = isMultipleCombobox(props) ? /* @__PURE__ */ jsxRuntime.jsx(MultipleCombobox, { ...props, shape, controlProps }) : /* @__PURE__ */ jsxRuntime.jsx(SingleCombobox, { ...props, shape, controlProps });
|
|
689
|
+
if (!props.error) return root;
|
|
690
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: comboboxStyles.comboboxStyles.root, children: [
|
|
691
|
+
root,
|
|
692
|
+
/* @__PURE__ */ jsxRuntime.jsx(fieldErrorId.FieldBlock.ErrorMsg, { name: errorName, children: props.error })
|
|
693
|
+
] });
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
exports.Combobox = Combobox;
|
|
697
|
+
exports.ComboboxChip = ComboboxChip;
|
|
698
|
+
exports.ComboboxChips = ComboboxChips;
|
|
699
|
+
exports.ComboboxChipsInput = ComboboxChipsInput;
|
|
700
|
+
exports.ComboboxClear = ComboboxClear;
|
|
701
|
+
exports.ComboboxCollection = ComboboxCollection;
|
|
702
|
+
exports.ComboboxContent = ComboboxContent;
|
|
703
|
+
exports.ComboboxEmpty = ComboboxEmpty;
|
|
704
|
+
exports.ComboboxGroup = ComboboxGroup;
|
|
705
|
+
exports.ComboboxInput = ComboboxInput;
|
|
706
|
+
exports.ComboboxItem = ComboboxItem;
|
|
707
|
+
exports.ComboboxItemContent = ComboboxItemContent;
|
|
708
|
+
exports.ComboboxItemDescription = ComboboxItemDescription;
|
|
709
|
+
exports.ComboboxItemEnd = ComboboxItemEnd;
|
|
710
|
+
exports.ComboboxItemTitle = ComboboxItemTitle;
|
|
711
|
+
exports.ComboboxLabel = ComboboxLabel;
|
|
712
|
+
exports.ComboboxList = ComboboxList;
|
|
713
|
+
exports.ComboboxRoot = ComboboxRoot;
|
|
714
|
+
exports.ComboboxSearch = ComboboxSearch;
|
|
715
|
+
exports.ComboboxSeparator = ComboboxSeparator;
|
|
716
|
+
exports.ComboboxTrigger = ComboboxTrigger;
|
|
717
|
+
exports.ComboboxValue = ComboboxValue;
|
|
718
|
+
//# sourceMappingURL=combobox-BNlVCFgY.cjs.map
|