themelia-react-ui 2.0.2 → 2.0.3
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/CHANGELOG.md +17 -7
- package/README.md +9 -13
- package/THIRD_PARTY_NOTICES.md +6 -12
- package/dist/{auth-ax2BqjrI.js → auth-BGua8ouh.js} +2 -2
- package/dist/{auth-ax2BqjrI.js.map → auth-BGua8ouh.js.map} +1 -1
- package/dist/base/cascader.js +1 -1
- package/dist/base/combobox.js +2 -2
- package/dist/base/date-pickers.js +2 -2
- package/dist/base/popover-menu.js +1 -1
- package/dist/base/popover.js +1 -1
- package/dist/base/sheet.js +1 -1
- package/dist/base/sidebar.js +1 -1
- package/dist/base/value-inputs.js +1 -1
- package/dist/blocks/commerce.js +1 -1
- package/dist/{combobox-xCQ2RMNE.js → combobox-DaHESuiL.js} +154 -108
- package/dist/combobox-DaHESuiL.js.map +1 -0
- package/dist/{combobox-C0EQW6dr.js → combobox-Dxo2fAYQ.js} +342 -340
- package/dist/combobox-Dxo2fAYQ.js.map +1 -0
- package/dist/{comments-BYYlTA8E.js → comments-DD0DUPwJ.js} +4 -4
- package/dist/{comments-BYYlTA8E.js.map → comments-DD0DUPwJ.js.map} +1 -1
- package/dist/components/base/combobox/combobox-field.d.ts +16 -0
- package/dist/components/ui/combobox-dismiss.d.ts +16 -0
- package/dist/components/ui/combobox.d.ts +11 -6
- package/dist/components/ui/dialog.d.ts +1 -1
- package/dist/components/ui/popover.d.ts +1 -1
- package/dist/components/ui/sheet.d.ts +1 -1
- package/dist/{date-picker-ay0Pha_a.js → date-picker-B2K3ucWn.js} +2 -2
- package/dist/{date-picker-ay0Pha_a.js.map → date-picker-B2K3ucWn.js.map} +1 -1
- package/dist/{date-pickers-Ccw8DL2b.js → date-pickers-Ds8gLaoP.js} +3 -3
- package/dist/{date-pickers-Ccw8DL2b.js.map → date-pickers-Ds8gLaoP.js.map} +1 -1
- package/dist/features/activities.js +2 -2
- package/dist/features/async-preview.js +1 -1
- package/dist/features/combobox.js +1 -1
- package/dist/features/comments.js +1 -1
- package/dist/features/data-view.js +2 -2
- package/dist/features/email-composer.js +2 -2
- package/dist/features/event-calendar.js +1 -1
- package/dist/features/filters.js +1 -1
- package/dist/features/global-search.js +1 -1
- package/dist/features/map.js +1 -1
- package/dist/features/media-library.js +1 -1
- package/dist/features/mentions.js +1 -1
- package/dist/features/overlays.js +1 -1
- package/dist/features/products.js +1 -1
- package/dist/features/resource-assignment.js +1 -1
- package/dist/features/schema-form.js +1 -1
- package/dist/features/suggestions.js +1 -1
- package/dist/features/theme-tweaker.js +2 -2
- package/dist/{filters-BGfvjP4d.js → filters-DJVAveHA.js} +4 -4
- package/dist/{filters-BGfvjP4d.js.map → filters-DJVAveHA.js.map} +1 -1
- package/dist/{header-CGXuhcRm.js → header-BSfIEWbI.js} +4 -4
- package/dist/{header-CGXuhcRm.js.map → header-BSfIEWbI.js.map} +1 -1
- package/dist/{hooks-Dkz0K2WT.js → hooks-ClH9thn4.js} +2 -2
- package/dist/{hooks-Dkz0K2WT.js.map → hooks-ClH9thn4.js.map} +1 -1
- package/dist/layout/auth.js +1 -1
- package/dist/layout/header.js +1 -1
- package/dist/layout/hooks.js +1 -1
- package/dist/layout/page.js +1 -1
- package/dist/layout/sidebar.js +2 -2
- package/dist/layout/workspace.js +1 -1
- package/dist/layout.js +6 -6
- package/dist/lib/use-popup-focus-recovery.d.ts +8 -0
- package/dist/{mentions-utuUvH1K.js → mentions-CGlEJ15c.js} +2 -2
- package/dist/{mentions-utuUvH1K.js.map → mentions-CGlEJ15c.js.map} +1 -1
- package/dist/{overlays-DNWmZrJ4.js → overlays-tMkF-VAN.js} +270 -268
- package/dist/overlays-tMkF-VAN.js.map +1 -0
- package/dist/{page-Bgl1F560.js → page-CL9YeH_V.js} +2 -2
- package/dist/{page-Bgl1F560.js.map → page-CL9YeH_V.js.map} +1 -1
- package/dist/{popover-7_m66eYW.js → popover-gnTOhbFM.js} +62 -60
- package/dist/popover-gnTOhbFM.js.map +1 -0
- package/dist/{popover-menu-B9WWygpa.js → popover-menu-Cn9rUkdc.js} +2 -2
- package/dist/{popover-menu-B9WWygpa.js.map → popover-menu-Cn9rUkdc.js.map} +1 -1
- package/dist/services/actions.js +1 -1
- package/dist/{sheet-CGpB3omz.js → sheet-ijlsjq-n.js} +70 -68
- package/dist/sheet-ijlsjq-n.js.map +1 -0
- package/dist/{sidebar-CPx_7YBa.js → sidebar-Db6gkh3U.js} +2 -2
- package/dist/{sidebar-CPx_7YBa.js.map → sidebar-Db6gkh3U.js.map} +1 -1
- package/dist/{sidebar-A0ElHINE.js → sidebar-DkTO4VTO.js} +3 -3
- package/dist/{sidebar-A0ElHINE.js.map → sidebar-DkTO4VTO.js.map} +1 -1
- package/dist/use-popup-focus-recovery-C0QPvgOR.js +36 -0
- package/dist/use-popup-focus-recovery-C0QPvgOR.js.map +1 -0
- package/dist/{value-inputs-DXPDjvBU.js → value-inputs-TaX4OjNk.js} +3 -3
- package/dist/{value-inputs-DXPDjvBU.js.map → value-inputs-TaX4OjNk.js.map} +1 -1
- package/dist/{workspace-Cdrg7k9f.js → workspace-B-OEm3Kf.js} +2 -2
- package/dist/{workspace-Cdrg7k9f.js.map → workspace-B-OEm3Kf.js.map} +1 -1
- package/docs/consumer-skill/SKILL.md +1 -1
- package/docs/consumer-skill/references/agents-md.md +1 -1
- package/docs/consumer-skill/references/installation.md +6 -0
- package/docs/consumer-skill/references/public-api.json +2 -2
- package/docs/consumer-skill/references/tokens.json +1 -1
- package/docs/consumer-skill/references/workflows.md +5 -4
- package/package.json +3 -3
- package/dist/combobox-C0EQW6dr.js.map +0 -1
- package/dist/combobox-xCQ2RMNE.js.map +0 -1
- package/dist/overlays-DNWmZrJ4.js.map +0 -1
- package/dist/popover-7_m66eYW.js.map +0 -1
- package/dist/sheet-CGpB3omz.js.map +0 -1
|
@@ -9,16 +9,62 @@ import { n as c } from "./tone-recipes-BPsRAvhu.js";
|
|
|
9
9
|
import { t as l } from "./feedback-BYIhtitP.js";
|
|
10
10
|
import { t as u } from "./layer-recipes-CCpklYME.js";
|
|
11
11
|
import { n as d, r as f } from "./field-affordance-recipes-DZhnIL_Y.js";
|
|
12
|
-
import { C as p, S as m, _ as h, a as g, b as _, g as
|
|
13
|
-
import { l as
|
|
14
|
-
import { t as
|
|
15
|
-
import { t as
|
|
16
|
-
import { t as
|
|
17
|
-
import * as
|
|
18
|
-
import { useCallback as
|
|
19
|
-
import { Fragment as
|
|
20
|
-
import { ChevronDownIcon as B, Loader2 as
|
|
12
|
+
import { C as p, S as m, _ as h, a as g, b as _, g as v, h as y, m as b, o as x, p as S, t as C, u as w, v as T, w as E, x as D } from "./combobox-DaHESuiL.js";
|
|
13
|
+
import { l as O, u as k } from "./form-sizing-BdP_Mf5p.js";
|
|
14
|
+
import { t as A } from "./input-DQdEd0YD.js";
|
|
15
|
+
import { t as ee } from "./scroll-area-DcI-M1UT.js";
|
|
16
|
+
import { t as j } from "./use-debounced-callback-Cx1h-hdv.js";
|
|
17
|
+
import * as M from "react";
|
|
18
|
+
import { useCallback as N, useEffect as P, useMemo as F, useRef as I, useState as L } from "react";
|
|
19
|
+
import { Fragment as te, jsx as R, jsxs as z } from "react/jsx-runtime";
|
|
20
|
+
import { ChevronDownIcon as B, Loader2 as ne, PlusIcon as V, XIcon as H } from "lucide-react";
|
|
21
21
|
import { Combobox as U } from "@base-ui/react/combobox";
|
|
22
|
+
//#region src/components/base/combobox/combobox-field.tsx
|
|
23
|
+
function re({ placeholder: e, clearLabel: t, toggleLabel: n, size: a, error: o, required: s, disabled: c, clearable: l = !0, className: u, onBlur: p }) {
|
|
24
|
+
return /* @__PURE__ */ z("div", {
|
|
25
|
+
className: "relative",
|
|
26
|
+
children: [/* @__PURE__ */ R(D, {
|
|
27
|
+
render: /* @__PURE__ */ R(A, {
|
|
28
|
+
size: a,
|
|
29
|
+
invalid: o,
|
|
30
|
+
className: r(l ? f.clearPadding[a] : f.padding[a], u)
|
|
31
|
+
}),
|
|
32
|
+
placeholder: e,
|
|
33
|
+
"aria-invalid": o || void 0,
|
|
34
|
+
"aria-required": s,
|
|
35
|
+
disabled: c,
|
|
36
|
+
onBlur: p
|
|
37
|
+
}), /* @__PURE__ */ z("div", {
|
|
38
|
+
className: r("absolute inset-y-0 flex items-center gap-space-xs text-muted-foreground", f.track[a]),
|
|
39
|
+
children: [l ? /* @__PURE__ */ R(U.Clear, { render: /* @__PURE__ */ R(i, {
|
|
40
|
+
type: "button",
|
|
41
|
+
tone: "secondary",
|
|
42
|
+
buttonStyle: "ghost",
|
|
43
|
+
size: "sm",
|
|
44
|
+
iconOnly: !0,
|
|
45
|
+
className: r(d.target, d.focus, d.clear),
|
|
46
|
+
"aria-label": t,
|
|
47
|
+
children: /* @__PURE__ */ R(H, {
|
|
48
|
+
className: d.icon,
|
|
49
|
+
"aria-hidden": "true"
|
|
50
|
+
})
|
|
51
|
+
}) }) : null, /* @__PURE__ */ R(U.Trigger, { render: /* @__PURE__ */ R(i, {
|
|
52
|
+
type: "button",
|
|
53
|
+
tone: "secondary",
|
|
54
|
+
buttonStyle: "ghost",
|
|
55
|
+
size: "sm",
|
|
56
|
+
iconOnly: !0,
|
|
57
|
+
className: r(d.target, d.focus, d.toggle),
|
|
58
|
+
"aria-label": n,
|
|
59
|
+
children: /* @__PURE__ */ R(B, {
|
|
60
|
+
className: r("shrink-0", f.icon[a]),
|
|
61
|
+
"aria-hidden": "true"
|
|
62
|
+
})
|
|
63
|
+
}) })]
|
|
64
|
+
})]
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
//#endregion
|
|
22
68
|
//#region src/components/features/combobox/combobox.strings.ts
|
|
23
69
|
var W = {
|
|
24
70
|
placeholder: "Search...",
|
|
@@ -47,7 +93,7 @@ function J(e) {
|
|
|
47
93
|
}
|
|
48
94
|
//#endregion
|
|
49
95
|
//#region src/components/features/combobox/components/loading-more.tsx
|
|
50
|
-
function
|
|
96
|
+
function Y({ loading: e, text: t, className: n }) {
|
|
51
97
|
return e ? /* @__PURE__ */ z(s, {
|
|
52
98
|
direction: "horizontal",
|
|
53
99
|
gap: "sm",
|
|
@@ -56,7 +102,7 @@ function ne({ loading: e, text: t, className: n }) {
|
|
|
56
102
|
className: r("loading-more--component", "px-control py-space-xs text-xs text-muted-foreground", n),
|
|
57
103
|
role: "status",
|
|
58
104
|
"aria-live": "polite",
|
|
59
|
-
children: [/* @__PURE__ */ R(
|
|
105
|
+
children: [/* @__PURE__ */ R(ne, {
|
|
60
106
|
className: "size-icon-sm animate-spin",
|
|
61
107
|
"aria-hidden": "true"
|
|
62
108
|
}), /* @__PURE__ */ R(a, {
|
|
@@ -68,10 +114,10 @@ function ne({ loading: e, text: t, className: n }) {
|
|
|
68
114
|
})]
|
|
69
115
|
}) : null;
|
|
70
116
|
}
|
|
71
|
-
|
|
117
|
+
Y.displayName = "LoadingMore";
|
|
72
118
|
//#endregion
|
|
73
119
|
//#region src/components/features/combobox/components/status-content.tsx
|
|
74
|
-
function
|
|
120
|
+
function X({ children: e }) {
|
|
75
121
|
return /* @__PURE__ */ R(a, {
|
|
76
122
|
tag: "span",
|
|
77
123
|
size: "inherit",
|
|
@@ -80,90 +126,90 @@ function Y({ children: e }) {
|
|
|
80
126
|
children: e
|
|
81
127
|
});
|
|
82
128
|
}
|
|
83
|
-
function
|
|
129
|
+
function ie({ loading: e, searchValue: t, minSearchLength: n, itemCount: r, strings: i }) {
|
|
84
130
|
let a = t.trim();
|
|
85
|
-
if (e) return /* @__PURE__ */ z(
|
|
86
|
-
if (a === "") return i.typeToSearch.includes("{min}") ? /* @__PURE__ */ R(
|
|
131
|
+
if (e) return /* @__PURE__ */ z(te, { children: [/* @__PURE__ */ R(ne, { className: "size-icon-sm animate-spin" }), /* @__PURE__ */ R(X, { children: i.searching })] });
|
|
132
|
+
if (a === "") return i.typeToSearch.includes("{min}") ? /* @__PURE__ */ R(X, { children: i.typeToSearch.replace("{min}", String(n)) }) : /* @__PURE__ */ R(X, { children: i.typeToSearch });
|
|
87
133
|
if (a.length < n) {
|
|
88
134
|
let e = n - a.length;
|
|
89
|
-
return i.typeMore.includes("{remaining}") || i.typeMore.includes("{s}") ? /* @__PURE__ */ R(
|
|
135
|
+
return i.typeMore.includes("{remaining}") || i.typeMore.includes("{s}") ? /* @__PURE__ */ R(X, { children: i.typeMore.replace("{remaining}", String(e)).replace("{s}", e === 1 ? "" : "s") }) : /* @__PURE__ */ R(X, { children: i.typeMore });
|
|
90
136
|
}
|
|
91
137
|
return null;
|
|
92
138
|
}
|
|
93
|
-
|
|
139
|
+
ie.displayName = "StatusContent";
|
|
94
140
|
//#endregion
|
|
95
141
|
//#region src/components/features/combobox/components/combobox-dropdown.tsx
|
|
96
|
-
var
|
|
142
|
+
var ae = {
|
|
97
143
|
sm: "sm",
|
|
98
144
|
md: "md",
|
|
99
145
|
lg: "lg"
|
|
100
|
-
},
|
|
146
|
+
}, oe = {
|
|
101
147
|
sm: "flex min-h-control-sm items-center justify-center px-row-x py-row-y text-center text-pxs leading-tight text-muted-foreground",
|
|
102
148
|
md: "flex min-h-control items-center justify-center px-row-x py-row-y text-center text-sm leading-tight text-muted-foreground",
|
|
103
149
|
lg: "flex min-h-control-lg items-center justify-center px-row-x py-row-y-lg text-center text-sm leading-tight text-muted-foreground"
|
|
104
150
|
};
|
|
105
|
-
function
|
|
106
|
-
let F = j == null ? void 0 : u.nestedOverlay, I =
|
|
107
|
-
if (!(t || n || d.length > 0 ||
|
|
108
|
-
let
|
|
151
|
+
function se({ loading: e, showStatus: t, showEmpty: n, searchValue: c, minSearchLength: l, items: d, groupedItems: f, createOptionItem: b, renderItemContent: S, getItemReactKey: C, getItemDisabled: w, renderGroupLabel: D, loadingMore: O, strings: k, size: A = "md", portalContainer: j, listRef: M, anchor: N, applyFooter: P }) {
|
|
152
|
+
let F = j == null ? void 0 : u.nestedOverlay, I = ae[A];
|
|
153
|
+
if (!(t || n || d.length > 0 || O || P)) return null;
|
|
154
|
+
let L = /* @__PURE__ */ R(p, {
|
|
109
155
|
anchor: N,
|
|
110
156
|
className: F,
|
|
111
|
-
children: /* @__PURE__ */ z(
|
|
157
|
+
children: /* @__PURE__ */ z(x, {
|
|
112
158
|
"aria-busy": e || void 0,
|
|
113
159
|
className: r("combobox-dropdown--popup"),
|
|
114
160
|
children: [
|
|
115
|
-
!!t && /* @__PURE__ */ R(
|
|
161
|
+
!!t && /* @__PURE__ */ R(E, {
|
|
116
162
|
className: "gap-space-sm px-control py-space-xs text-xs text-muted-foreground",
|
|
117
|
-
children: /* @__PURE__ */ R(
|
|
163
|
+
children: /* @__PURE__ */ R(ie, {
|
|
118
164
|
loading: e,
|
|
119
165
|
searchValue: c,
|
|
120
166
|
minSearchLength: l,
|
|
121
167
|
itemCount: d.length,
|
|
122
|
-
strings:
|
|
168
|
+
strings: k
|
|
123
169
|
})
|
|
124
170
|
}),
|
|
125
|
-
!!n && /* @__PURE__ */ R(
|
|
126
|
-
className:
|
|
171
|
+
!!n && /* @__PURE__ */ R(v, {
|
|
172
|
+
className: oe[A],
|
|
127
173
|
children: /* @__PURE__ */ R(a, {
|
|
128
174
|
tag: "span",
|
|
129
175
|
size: "inherit",
|
|
130
176
|
type: "secondary",
|
|
131
177
|
className: "text-inherit",
|
|
132
|
-
children:
|
|
178
|
+
children: k.noResults
|
|
133
179
|
})
|
|
134
180
|
}),
|
|
135
|
-
/* @__PURE__ */ R(
|
|
181
|
+
/* @__PURE__ */ R(ee, {
|
|
136
182
|
viewportRef: M,
|
|
137
183
|
className: "max-h-[min(20rem,var(--available-height))]",
|
|
138
184
|
children: /* @__PURE__ */ R(_, {
|
|
139
185
|
className: "combobox-dropdown--list max-h-none overflow-visible",
|
|
140
|
-
children: f ? /* @__PURE__ */ z(
|
|
141
|
-
let n = typeof
|
|
186
|
+
children: f ? /* @__PURE__ */ z(te, { children: [Array.from(f.entries()).map(([e, t]) => {
|
|
187
|
+
let n = typeof D == "function" ? D(e) : e;
|
|
142
188
|
return /* @__PURE__ */ z(h, {
|
|
143
189
|
className: "combobox-dropdown--group p-0",
|
|
144
190
|
items: t,
|
|
145
|
-
children: [/* @__PURE__ */ R(
|
|
191
|
+
children: [/* @__PURE__ */ R(T, { children: typeof n == "string" || typeof n == "number" || typeof n == "bigint" ? /* @__PURE__ */ R(o, { children: n }) : n }), /* @__PURE__ */ R(y, { children: (e) => /* @__PURE__ */ R(g, {
|
|
146
192
|
value: e,
|
|
147
193
|
size: I,
|
|
148
|
-
disabled:
|
|
149
|
-
children:
|
|
150
|
-
},
|
|
194
|
+
disabled: w?.(e),
|
|
195
|
+
children: S(e)
|
|
196
|
+
}, C(e)) })]
|
|
151
197
|
}, e);
|
|
152
|
-
}),
|
|
153
|
-
value:
|
|
198
|
+
}), b != null && /* @__PURE__ */ R(g, {
|
|
199
|
+
value: b,
|
|
154
200
|
size: I,
|
|
155
|
-
children:
|
|
156
|
-
},
|
|
201
|
+
children: S(b)
|
|
202
|
+
}, C(b))] }) : /* @__PURE__ */ R(y, { children: (e) => /* @__PURE__ */ R(g, {
|
|
157
203
|
value: e,
|
|
158
204
|
size: I,
|
|
159
|
-
disabled:
|
|
160
|
-
children:
|
|
161
|
-
},
|
|
205
|
+
disabled: w?.(e),
|
|
206
|
+
children: S(e)
|
|
207
|
+
}, C(e)) })
|
|
162
208
|
})
|
|
163
209
|
}),
|
|
164
|
-
/* @__PURE__ */ R(
|
|
165
|
-
loading: !!
|
|
166
|
-
text:
|
|
210
|
+
/* @__PURE__ */ R(Y, {
|
|
211
|
+
loading: !!O,
|
|
212
|
+
text: k.loadingMore
|
|
167
213
|
}),
|
|
168
214
|
!!P && /* @__PURE__ */ z(s, {
|
|
169
215
|
direction: "horizontal",
|
|
@@ -191,15 +237,15 @@ function ie({ loading: e, showStatus: t, showEmpty: n, searchValue: c, minSearch
|
|
|
191
237
|
]
|
|
192
238
|
})
|
|
193
239
|
});
|
|
194
|
-
return j ? /* @__PURE__ */ R(
|
|
240
|
+
return j ? /* @__PURE__ */ R(m, {
|
|
195
241
|
container: j,
|
|
196
|
-
children:
|
|
197
|
-
}) : /* @__PURE__ */ R(
|
|
242
|
+
children: L
|
|
243
|
+
}) : /* @__PURE__ */ R(m, { children: L });
|
|
198
244
|
}
|
|
199
|
-
|
|
245
|
+
se.displayName = "ComboboxDropdown";
|
|
200
246
|
//#endregion
|
|
201
247
|
//#region src/components/features/combobox/components/error-message.tsx
|
|
202
|
-
function
|
|
248
|
+
function ce({ error: e, size: t, className: n }) {
|
|
203
249
|
return e ? /* @__PURE__ */ R(a, {
|
|
204
250
|
tag: "p",
|
|
205
251
|
size: "xs",
|
|
@@ -210,13 +256,13 @@ function ae({ error: e, size: t, className: n }) {
|
|
|
210
256
|
children: e
|
|
211
257
|
}) : null;
|
|
212
258
|
}
|
|
213
|
-
|
|
259
|
+
ce.displayName = "ErrorMessage";
|
|
214
260
|
//#endregion
|
|
215
261
|
//#region src/components/features/combobox/components/highlighted-text.tsx
|
|
216
|
-
function
|
|
262
|
+
function le(e) {
|
|
217
263
|
return e.replace(/[$()*+.?[\\\]^{|}]/g, "\\$&");
|
|
218
264
|
}
|
|
219
|
-
function
|
|
265
|
+
function ue({ text: e, highlight: t, highlightClassName: n = c.match }) {
|
|
220
266
|
if (!t.trim()) return /* @__PURE__ */ R(a, {
|
|
221
267
|
tag: "span",
|
|
222
268
|
size: "inherit",
|
|
@@ -224,7 +270,7 @@ function se({ text: e, highlight: t, highlightClassName: n = c.match }) {
|
|
|
224
270
|
className: "text-inherit",
|
|
225
271
|
children: e
|
|
226
272
|
});
|
|
227
|
-
let r = RegExp(`(${
|
|
273
|
+
let r = RegExp(`(${le(t)})`, "gi"), i = e.split(r), o = 0;
|
|
228
274
|
return /* @__PURE__ */ R(a, {
|
|
229
275
|
tag: "span",
|
|
230
276
|
size: "inherit",
|
|
@@ -235,18 +281,18 @@ function se({ text: e, highlight: t, highlightClassName: n = c.match }) {
|
|
|
235
281
|
return o += e.length, r ? /* @__PURE__ */ R("mark", {
|
|
236
282
|
className: n,
|
|
237
283
|
children: e
|
|
238
|
-
}, i) : /* @__PURE__ */ R(
|
|
284
|
+
}, i) : /* @__PURE__ */ R(M.Fragment, { children: e }, i);
|
|
239
285
|
})
|
|
240
286
|
});
|
|
241
287
|
}
|
|
242
|
-
|
|
288
|
+
ue.displayName = "HighlightedText";
|
|
243
289
|
//#endregion
|
|
244
290
|
//#region src/components/features/combobox/hooks/use-debounced-search.ts
|
|
245
|
-
function
|
|
246
|
-
let i =
|
|
291
|
+
function de({ searchValue: e, onSearch: t, debounceMs: n = 300, minSearchLength: r = 3 }) {
|
|
292
|
+
let i = j((e) => {
|
|
247
293
|
t?.(e);
|
|
248
294
|
}, n);
|
|
249
|
-
|
|
295
|
+
P(() => {
|
|
250
296
|
let t = e.trim();
|
|
251
297
|
if (!(t.length < r)) return i(t), i.cancel;
|
|
252
298
|
}, [
|
|
@@ -257,8 +303,8 @@ function ce({ searchValue: e, onSearch: t, debounceMs: n = 300, minSearchLength:
|
|
|
257
303
|
}
|
|
258
304
|
//#endregion
|
|
259
305
|
//#region src/components/features/combobox/hooks/use-grouped-items.ts
|
|
260
|
-
function
|
|
261
|
-
return
|
|
306
|
+
function fe({ items: e, getItemGroup: t }) {
|
|
307
|
+
return F(() => {
|
|
262
308
|
if (!t) return null;
|
|
263
309
|
let n = /* @__PURE__ */ new Map();
|
|
264
310
|
for (let r of e) {
|
|
@@ -270,15 +316,15 @@ function le({ items: e, getItemGroup: t }) {
|
|
|
270
316
|
}
|
|
271
317
|
//#endregion
|
|
272
318
|
//#region src/components/features/combobox/hooks/use-load-more.ts
|
|
273
|
-
function
|
|
274
|
-
let r =
|
|
319
|
+
function pe({ hasMore: e, onLoadMore: t, loadingMore: n }) {
|
|
320
|
+
let r = I(!1), i = I(null), a = j(() => {
|
|
275
321
|
r.current = !0, t?.(), i.current && clearTimeout(i.current), i.current = setTimeout(() => {
|
|
276
322
|
r.current = !1, i.current = null;
|
|
277
323
|
}, 500);
|
|
278
324
|
}, 100);
|
|
279
|
-
return
|
|
325
|
+
return P(() => () => {
|
|
280
326
|
i.current && clearTimeout(i.current);
|
|
281
|
-
}, []), { handleScroll:
|
|
327
|
+
}, []), { handleScroll: N((i) => {
|
|
282
328
|
if (!e || !t || n || r.current) return;
|
|
283
329
|
let { scrollHeight: o, scrollTop: s, clientHeight: c } = i.target;
|
|
284
330
|
(s + c) / o >= .8 && a();
|
|
@@ -291,87 +337,87 @@ function ue({ hasMore: e, onLoadMore: t, loadingMore: n }) {
|
|
|
291
337
|
}
|
|
292
338
|
//#endregion
|
|
293
339
|
//#region src/components/features/combobox/hooks/use-combobox-core.tsx
|
|
294
|
-
function
|
|
340
|
+
function me(e) {
|
|
295
341
|
return n(W, e);
|
|
296
342
|
}
|
|
297
|
-
function
|
|
343
|
+
function he(e, t, n) {
|
|
298
344
|
let r = t.toLowerCase();
|
|
299
345
|
return e.some((e) => n(e).toLowerCase() === r);
|
|
300
346
|
}
|
|
301
|
-
function
|
|
302
|
-
let
|
|
303
|
-
|
|
347
|
+
function ge({ items: e, searchValue: t, getItemLabel: n, getItemKey: i, loading: o = !1, showListContent: s = !0, minSearchLength: c = 3, strings: l, renderItem: u, onSearch: d, debounceMs: f = 300, creatable: p, onCreate: m, getItemGroup: h, hasMore: g, onLoadMore: _, loadingMore: v, highlightMatch: y, ensuredItems: b = [] }) {
|
|
348
|
+
let x = me(l), S = i ?? n, C = I(null), w = t.trim(), T = s && (o || w.length < c);
|
|
349
|
+
de({
|
|
304
350
|
searchValue: t,
|
|
305
351
|
onSearch: d,
|
|
306
352
|
debounceMs: f,
|
|
307
353
|
minSearchLength: c
|
|
308
354
|
});
|
|
309
|
-
let { handleScroll:
|
|
310
|
-
hasMore: s && !
|
|
355
|
+
let { handleScroll: E } = pe({
|
|
356
|
+
hasMore: s && !T ? g : !1,
|
|
311
357
|
onLoadMore: _,
|
|
312
|
-
loadingMore:
|
|
358
|
+
loadingMore: v
|
|
313
359
|
});
|
|
314
|
-
|
|
315
|
-
let e =
|
|
316
|
-
if (s && !
|
|
360
|
+
P(() => {
|
|
361
|
+
let e = C.current;
|
|
362
|
+
if (s && !T && e && g && _) return e.addEventListener("scroll", E), () => e.removeEventListener("scroll", E);
|
|
317
363
|
}, [
|
|
318
|
-
|
|
364
|
+
E,
|
|
319
365
|
g,
|
|
320
366
|
_,
|
|
321
367
|
s,
|
|
322
|
-
|
|
368
|
+
T
|
|
323
369
|
]);
|
|
324
|
-
let
|
|
325
|
-
if (!s ||
|
|
326
|
-
if (
|
|
327
|
-
let t = [...
|
|
370
|
+
let D = F(() => {
|
|
371
|
+
if (!s || T) return [];
|
|
372
|
+
if (b.length === 0) return e;
|
|
373
|
+
let t = [...b];
|
|
328
374
|
return e.forEach((e) => {
|
|
329
|
-
let n =
|
|
330
|
-
|
|
375
|
+
let n = S(e);
|
|
376
|
+
b.some((e) => S(e) === n) || t.push(e);
|
|
331
377
|
}), t;
|
|
332
378
|
}, [
|
|
333
379
|
e,
|
|
334
|
-
|
|
335
|
-
|
|
380
|
+
b,
|
|
381
|
+
S,
|
|
336
382
|
s,
|
|
337
|
-
|
|
338
|
-
]),
|
|
339
|
-
items:
|
|
383
|
+
T
|
|
384
|
+
]), O = fe({
|
|
385
|
+
items: D,
|
|
340
386
|
getItemGroup: h
|
|
341
|
-
}),
|
|
387
|
+
}), k = F(() => !s || T || !p || !m || w.length < c ? !1 : !he(D, w, n), [
|
|
342
388
|
p,
|
|
343
389
|
m,
|
|
344
|
-
|
|
390
|
+
w,
|
|
345
391
|
c,
|
|
346
|
-
|
|
392
|
+
D,
|
|
347
393
|
n,
|
|
348
394
|
s,
|
|
349
|
-
|
|
350
|
-
]),
|
|
395
|
+
T
|
|
396
|
+
]), A = F(() => k ? J(w) : null, [k, w]);
|
|
351
397
|
return {
|
|
352
|
-
strings:
|
|
353
|
-
getKey:
|
|
354
|
-
trimmedSearch:
|
|
355
|
-
listRef:
|
|
356
|
-
baseItems:
|
|
357
|
-
allItems:
|
|
358
|
-
groupedItems:
|
|
359
|
-
createOptionItem:
|
|
360
|
-
showStatus:
|
|
361
|
-
showEmpty: s && !o &&
|
|
362
|
-
showCreateOption:
|
|
363
|
-
renderItemContent:
|
|
398
|
+
strings: x,
|
|
399
|
+
getKey: S,
|
|
400
|
+
trimmedSearch: w,
|
|
401
|
+
listRef: C,
|
|
402
|
+
baseItems: D,
|
|
403
|
+
allItems: F(() => A ? [...D, A] : D, [D, A]),
|
|
404
|
+
groupedItems: O,
|
|
405
|
+
createOptionItem: A,
|
|
406
|
+
showStatus: T,
|
|
407
|
+
showEmpty: s && !o && w.length >= c && e.length === 0 && !k,
|
|
408
|
+
showCreateOption: k,
|
|
409
|
+
renderItemContent: N((e) => {
|
|
364
410
|
if (K(e)) {
|
|
365
411
|
let t = q(e);
|
|
366
412
|
return /* @__PURE__ */ z("span", {
|
|
367
413
|
className: r("combobox-core--component", "flex items-center gap-space-sm"),
|
|
368
|
-
children: [/* @__PURE__ */ R(
|
|
414
|
+
children: [/* @__PURE__ */ R(V, { className: "size-icon-sm" }), x.createNew.includes("{value}") ? /* @__PURE__ */ R(a, {
|
|
369
415
|
tag: "span",
|
|
370
416
|
size: "inherit",
|
|
371
417
|
weight: "medium",
|
|
372
418
|
lineHeight: "tight",
|
|
373
419
|
className: "text-inherit",
|
|
374
|
-
children:
|
|
420
|
+
children: x.createNew.replace("{value}", t)
|
|
375
421
|
}) : /* @__PURE__ */ z("span", {
|
|
376
422
|
className: "inline-flex items-center gap-space-sm",
|
|
377
423
|
children: [/* @__PURE__ */ R(a, {
|
|
@@ -380,7 +426,7 @@ function pe({ items: e, searchValue: t, getItemLabel: n, getItemKey: i, loading:
|
|
|
380
426
|
weight: "medium",
|
|
381
427
|
lineHeight: "tight",
|
|
382
428
|
className: "text-inherit",
|
|
383
|
-
children:
|
|
429
|
+
children: x.createNew
|
|
384
430
|
}), /* @__PURE__ */ R(a, {
|
|
385
431
|
tag: "span",
|
|
386
432
|
size: "inherit",
|
|
@@ -394,9 +440,9 @@ function pe({ items: e, searchValue: t, getItemLabel: n, getItemKey: i, loading:
|
|
|
394
440
|
}
|
|
395
441
|
if (u) return u(e);
|
|
396
442
|
let t = n(e);
|
|
397
|
-
return
|
|
443
|
+
return y && w ? /* @__PURE__ */ R(ue, {
|
|
398
444
|
text: t,
|
|
399
|
-
highlight:
|
|
445
|
+
highlight: w
|
|
400
446
|
}) : /* @__PURE__ */ R(a, {
|
|
401
447
|
tag: "span",
|
|
402
448
|
size: "inherit",
|
|
@@ -406,76 +452,32 @@ function pe({ items: e, searchValue: t, getItemLabel: n, getItemKey: i, loading:
|
|
|
406
452
|
children: t
|
|
407
453
|
});
|
|
408
454
|
}, [
|
|
409
|
-
|
|
455
|
+
x.createNew,
|
|
410
456
|
u,
|
|
411
457
|
n,
|
|
412
|
-
|
|
413
|
-
|
|
458
|
+
y,
|
|
459
|
+
w
|
|
414
460
|
]),
|
|
415
|
-
itemToStringLabel:
|
|
416
|
-
getItemReactKey:
|
|
417
|
-
handleScroll:
|
|
461
|
+
itemToStringLabel: N((e) => K(e) ? q(e) : n(e), [n]),
|
|
462
|
+
getItemReactKey: N((e) => K(e) ? `__create__:${q(e)}` : String(S(e)), [S]),
|
|
463
|
+
handleScroll: E
|
|
418
464
|
};
|
|
419
465
|
}
|
|
420
466
|
//#endregion
|
|
421
467
|
//#region src/components/features/combobox/combobox.tsx
|
|
422
|
-
function
|
|
468
|
+
function _e(e, n) {
|
|
423
469
|
return t(e, n, "md");
|
|
424
470
|
}
|
|
425
|
-
var
|
|
471
|
+
var ve = {
|
|
426
472
|
sm: "sm",
|
|
427
473
|
md: "md",
|
|
428
474
|
lg: "lg"
|
|
429
475
|
};
|
|
430
|
-
function
|
|
476
|
+
function ye(e) {
|
|
431
477
|
return e;
|
|
432
478
|
}
|
|
433
|
-
function
|
|
434
|
-
|
|
435
|
-
className: "relative",
|
|
436
|
-
children: [/* @__PURE__ */ R(U.Input, {
|
|
437
|
-
render: /* @__PURE__ */ R(O, {
|
|
438
|
-
size: a,
|
|
439
|
-
invalid: o,
|
|
440
|
-
className: r(l ? f.clearPadding[a] : f.padding[a], u)
|
|
441
|
-
}),
|
|
442
|
-
placeholder: e,
|
|
443
|
-
"aria-invalid": o || void 0,
|
|
444
|
-
"aria-required": s,
|
|
445
|
-
disabled: c,
|
|
446
|
-
onBlur: p
|
|
447
|
-
}), /* @__PURE__ */ z("div", {
|
|
448
|
-
className: r("absolute inset-y-0 flex items-center gap-space-xs text-muted-foreground", f.track[a]),
|
|
449
|
-
children: [l ? /* @__PURE__ */ R(U.Clear, { render: /* @__PURE__ */ R(i, {
|
|
450
|
-
type: "button",
|
|
451
|
-
tone: "secondary",
|
|
452
|
-
buttonStyle: "ghost",
|
|
453
|
-
size: "sm",
|
|
454
|
-
iconOnly: !0,
|
|
455
|
-
className: r(d.target, d.focus, d.clear),
|
|
456
|
-
"aria-label": t,
|
|
457
|
-
children: /* @__PURE__ */ R(H, {
|
|
458
|
-
className: d.icon,
|
|
459
|
-
"aria-hidden": "true"
|
|
460
|
-
})
|
|
461
|
-
}) }) : null, /* @__PURE__ */ R(U.Trigger, { render: /* @__PURE__ */ R(i, {
|
|
462
|
-
type: "button",
|
|
463
|
-
tone: "secondary",
|
|
464
|
-
buttonStyle: "ghost",
|
|
465
|
-
size: "sm",
|
|
466
|
-
iconOnly: !0,
|
|
467
|
-
className: r(d.target, d.focus, d.toggle),
|
|
468
|
-
"aria-label": n,
|
|
469
|
-
children: /* @__PURE__ */ R(B, {
|
|
470
|
-
className: r("shrink-0", f.icon[a]),
|
|
471
|
-
"aria-hidden": "true"
|
|
472
|
-
})
|
|
473
|
-
}) })]
|
|
474
|
-
})]
|
|
475
|
-
});
|
|
476
|
-
}
|
|
477
|
-
function ve({ items: t, selectedValue: n, onSelectedValueChange: r, clearSearchOnClose: i = !0, searchValue: a, onSearchValueChange: o, getItemLabel: c, getItemKey: l, loading: u = !1, showListContent: d = !0, minSearchLength: f = 3, strings: p, disabled: m = !1, className: h, clearable: g = !0, renderItem: _, portalContainer: ee, name: v, invalid: y, error: b, required: x, onBlur: S, onSearch: w, debounceMs: T, creatable: E, onCreate: D, getItemGroup: O, renderGroupLabel: k, hasMore: A, onLoadMore: j, loadingMore: N, getItemDisabled: P, highlightMatch: F, size: L, open: B, onOpenChange: V }) {
|
|
478
|
-
let { defaultScale: te } = e(), H = me(L, te), U = ge(H), W = y || !!b, G = pe({
|
|
479
|
+
function Z({ items: t, selectedValue: n, onSelectedValueChange: r, clearSearchOnClose: i = !0, searchValue: a, onSearchValueChange: o, getItemLabel: c, getItemKey: l, loading: u = !1, showListContent: d = !0, minSearchLength: f = 3, strings: p, disabled: m = !1, className: h, clearable: g = !0, renderItem: _, portalContainer: v, name: y, invalid: b, error: x, required: S, onBlur: C, onSearch: T, debounceMs: E, creatable: D, onCreate: O, getItemGroup: k, renderGroupLabel: A, hasMore: ee, onLoadMore: j, loadingMore: M, getItemDisabled: P, highlightMatch: F, size: I, open: te, onOpenChange: B }) {
|
|
480
|
+
let { defaultScale: ne } = e(), V = _e(I, ne), H = ye(V), U = b || !!x, W = ge({
|
|
479
481
|
items: t,
|
|
480
482
|
searchValue: a,
|
|
481
483
|
onSearchValueChange: o,
|
|
@@ -486,44 +488,44 @@ function ve({ items: t, selectedValue: n, onSelectedValueChange: r, clearSearchO
|
|
|
486
488
|
minSearchLength: f,
|
|
487
489
|
strings: p,
|
|
488
490
|
renderItem: _,
|
|
489
|
-
onSearch:
|
|
490
|
-
debounceMs:
|
|
491
|
-
creatable:
|
|
492
|
-
onCreate:
|
|
493
|
-
getItemGroup:
|
|
494
|
-
hasMore:
|
|
491
|
+
onSearch: T,
|
|
492
|
+
debounceMs: E,
|
|
493
|
+
creatable: D,
|
|
494
|
+
onCreate: O,
|
|
495
|
+
getItemGroup: k,
|
|
496
|
+
hasMore: ee,
|
|
495
497
|
onLoadMore: j,
|
|
496
|
-
loadingMore:
|
|
498
|
+
loadingMore: M,
|
|
497
499
|
highlightMatch: F,
|
|
498
|
-
size:
|
|
500
|
+
size: V,
|
|
499
501
|
ensuredItems: n ? [n] : []
|
|
500
|
-
}), [
|
|
501
|
-
|
|
502
|
+
}), [G, J] = L(!1), Y = N((e) => {
|
|
503
|
+
J(e), !e && i && o(""), B?.(e);
|
|
502
504
|
}, [
|
|
503
505
|
i,
|
|
504
|
-
|
|
506
|
+
B,
|
|
505
507
|
o
|
|
506
|
-
]), X =
|
|
508
|
+
]), X = G ? a : n ? W.itemToStringLabel(n) : "", ie = N((e) => {
|
|
507
509
|
if (e && K(e)) {
|
|
508
510
|
let t = q(e);
|
|
509
|
-
|
|
511
|
+
O?.(t);
|
|
510
512
|
return;
|
|
511
513
|
}
|
|
512
514
|
r(e);
|
|
513
|
-
}, [r,
|
|
515
|
+
}, [r, O]);
|
|
514
516
|
return /* @__PURE__ */ z(s, {
|
|
515
517
|
gap: "dense",
|
|
516
518
|
className: "combobox--component",
|
|
517
|
-
children: [/* @__PURE__ */ z(
|
|
518
|
-
dismissLabel:
|
|
519
|
-
items:
|
|
519
|
+
children: [/* @__PURE__ */ z(w, {
|
|
520
|
+
dismissLabel: W.strings.dismiss,
|
|
521
|
+
items: W.allItems,
|
|
520
522
|
value: n,
|
|
521
523
|
onValueChange: (e, t) => {
|
|
522
524
|
if (t.reason === "escape-key") {
|
|
523
525
|
t.allowPropagation();
|
|
524
526
|
return;
|
|
525
527
|
}
|
|
526
|
-
|
|
528
|
+
ie(e);
|
|
527
529
|
},
|
|
528
530
|
inputValue: X,
|
|
529
531
|
onInputValueChange: (e, t) => {
|
|
@@ -538,57 +540,57 @@ function ve({ items: t, selectedValue: n, onSelectedValueChange: r, clearSearchO
|
|
|
538
540
|
}
|
|
539
541
|
o(e);
|
|
540
542
|
},
|
|
541
|
-
itemToStringLabel:
|
|
543
|
+
itemToStringLabel: W.itemToStringLabel,
|
|
542
544
|
disabled: m,
|
|
543
545
|
filter: null,
|
|
544
|
-
name:
|
|
545
|
-
required:
|
|
546
|
-
open:
|
|
546
|
+
name: y,
|
|
547
|
+
required: S,
|
|
548
|
+
open: te,
|
|
547
549
|
onOpenChange: Y,
|
|
548
|
-
children: [/* @__PURE__ */ R(
|
|
549
|
-
placeholder:
|
|
550
|
-
clearLabel:
|
|
551
|
-
toggleLabel:
|
|
550
|
+
children: [/* @__PURE__ */ R(re, {
|
|
551
|
+
placeholder: W.strings.placeholder,
|
|
552
|
+
clearLabel: W.strings.clear,
|
|
553
|
+
toggleLabel: W.strings.toggle,
|
|
552
554
|
className: h,
|
|
553
|
-
size:
|
|
554
|
-
error:
|
|
555
|
-
required:
|
|
555
|
+
size: H,
|
|
556
|
+
error: U,
|
|
557
|
+
required: S,
|
|
556
558
|
disabled: m,
|
|
557
559
|
clearable: g,
|
|
558
|
-
onBlur:
|
|
559
|
-
}), /* @__PURE__ */ R(
|
|
560
|
+
onBlur: C
|
|
561
|
+
}), /* @__PURE__ */ R(se, {
|
|
560
562
|
loading: u,
|
|
561
|
-
showStatus:
|
|
562
|
-
showEmpty:
|
|
563
|
+
showStatus: W.showStatus,
|
|
564
|
+
showEmpty: W.showEmpty,
|
|
563
565
|
searchValue: a,
|
|
564
566
|
minSearchLength: f,
|
|
565
|
-
items:
|
|
566
|
-
groupedItems:
|
|
567
|
-
createOptionItem:
|
|
568
|
-
renderItemContent:
|
|
569
|
-
getItemReactKey:
|
|
567
|
+
items: W.allItems,
|
|
568
|
+
groupedItems: W.groupedItems,
|
|
569
|
+
createOptionItem: W.createOptionItem,
|
|
570
|
+
renderItemContent: W.renderItemContent,
|
|
571
|
+
getItemReactKey: W.getItemReactKey,
|
|
570
572
|
getItemDisabled: P,
|
|
571
|
-
renderGroupLabel:
|
|
572
|
-
loadingMore: d && !
|
|
573
|
-
strings:
|
|
574
|
-
size:
|
|
575
|
-
portalContainer:
|
|
576
|
-
listRef:
|
|
573
|
+
renderGroupLabel: A,
|
|
574
|
+
loadingMore: d && !W.showStatus ? M : !1,
|
|
575
|
+
strings: W.strings,
|
|
576
|
+
size: V,
|
|
577
|
+
portalContainer: v,
|
|
578
|
+
listRef: W.listRef
|
|
577
579
|
})]
|
|
578
|
-
}), /* @__PURE__ */ R(
|
|
579
|
-
error:
|
|
580
|
-
size:
|
|
580
|
+
}), /* @__PURE__ */ R(ce, {
|
|
581
|
+
error: x,
|
|
582
|
+
size: V
|
|
581
583
|
})]
|
|
582
584
|
});
|
|
583
585
|
}
|
|
584
|
-
function
|
|
585
|
-
let { defaultScale:
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
}, [
|
|
589
|
-
let Q =
|
|
590
|
-
Se || xe(e),
|
|
591
|
-
}, [Se,
|
|
586
|
+
function be({ items: t, selectedValues: n, onSelectedValuesChange: i, searchValue: o, onSearchValueChange: c, getItemLabel: l, getItemKey: u, loading: d = !1, showListContent: f = !0, minSearchLength: p = 3, strings: m, disabled: h = !1, className: g, renderItem: _, portalContainer: v, name: y, invalid: x, error: T, required: E, onBlur: D, onSearch: A, debounceMs: ee, creatable: j, onCreate: M, getItemGroup: F, renderGroupLabel: te, hasMore: B, onLoadMore: ne, loadingMore: V, getItemDisabled: H, highlightMatch: U, size: re, open: G, onOpenChange: J, closeOnSelect: Y = !1, applyButton: X = !1, onApply: ie, onCancel: ae }) {
|
|
587
|
+
let { defaultScale: oe } = e(), le = _e(re, oe), ue = ye(le), de = ve[le], fe = x || !!T, pe = I(null), me = u ?? l, [he, Z] = L(n), [be, xe] = L(!1), Se = G !== void 0, Ce = Se ? G : be;
|
|
588
|
+
P(() => {
|
|
589
|
+
X && Z(n);
|
|
590
|
+
}, [X, n]);
|
|
591
|
+
let Q = N((e) => {
|
|
592
|
+
Se || xe(e), J?.(e);
|
|
593
|
+
}, [Se, J]), $ = ge({
|
|
592
594
|
items: t,
|
|
593
595
|
searchValue: o,
|
|
594
596
|
onSearchValueChange: c,
|
|
@@ -599,49 +601,49 @@ function ye({ items: t, selectedValues: n, onSelectedValuesChange: i, searchValu
|
|
|
599
601
|
minSearchLength: p,
|
|
600
602
|
strings: m,
|
|
601
603
|
renderItem: _,
|
|
602
|
-
onSearch:
|
|
603
|
-
debounceMs:
|
|
604
|
+
onSearch: A,
|
|
605
|
+
debounceMs: ee,
|
|
604
606
|
creatable: j,
|
|
605
|
-
onCreate:
|
|
606
|
-
getItemGroup:
|
|
607
|
-
hasMore:
|
|
608
|
-
onLoadMore:
|
|
609
|
-
loadingMore:
|
|
610
|
-
highlightMatch:
|
|
611
|
-
size:
|
|
607
|
+
onCreate: M,
|
|
608
|
+
getItemGroup: F,
|
|
609
|
+
hasMore: B,
|
|
610
|
+
onLoadMore: ne,
|
|
611
|
+
loadingMore: V,
|
|
612
|
+
highlightMatch: U,
|
|
613
|
+
size: le,
|
|
612
614
|
ensuredItems: n
|
|
613
|
-
}), we =
|
|
615
|
+
}), we = N((e) => {
|
|
614
616
|
let t = [], n = null;
|
|
615
617
|
for (let r of e) K(r) ? n = q(r) : t.push(r);
|
|
616
|
-
n &&
|
|
618
|
+
n && M?.(n);
|
|
617
619
|
let r = t.length !== e.length || !n ? t : null;
|
|
618
|
-
r && (
|
|
620
|
+
r && (X ? Z(r) : i(r)), Y && Q(!1);
|
|
619
621
|
}, [
|
|
620
622
|
i,
|
|
621
|
-
|
|
622
|
-
Z,
|
|
623
|
+
M,
|
|
623
624
|
X,
|
|
625
|
+
Y,
|
|
624
626
|
Q
|
|
625
|
-
]), Te =
|
|
626
|
-
|
|
627
|
+
]), Te = N(() => {
|
|
628
|
+
X && i(he), ie?.(), Q(!1);
|
|
627
629
|
}, [
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
630
|
+
X,
|
|
631
|
+
he,
|
|
632
|
+
ie,
|
|
631
633
|
i,
|
|
632
634
|
Q
|
|
633
|
-
]), Ee =
|
|
634
|
-
|
|
635
|
+
]), Ee = N(() => {
|
|
636
|
+
X && Z(n), ae?.(), Q(!1);
|
|
635
637
|
}, [
|
|
636
|
-
|
|
638
|
+
X,
|
|
637
639
|
n,
|
|
638
|
-
|
|
640
|
+
ae,
|
|
639
641
|
Q
|
|
640
|
-
]), De =
|
|
642
|
+
]), De = X ? he : n, Oe = De.length > 0 ? void 0 : $.strings.placeholder;
|
|
641
643
|
return /* @__PURE__ */ z(s, {
|
|
642
644
|
gap: "dense",
|
|
643
645
|
className: "combobox--component",
|
|
644
|
-
children: [/* @__PURE__ */ z(
|
|
646
|
+
children: [/* @__PURE__ */ z(w, {
|
|
645
647
|
dismissLabel: $.strings.dismiss,
|
|
646
648
|
items: $.allItems,
|
|
647
649
|
multiple: !0,
|
|
@@ -669,18 +671,18 @@ function ye({ items: t, selectedValues: n, onSelectedValuesChange: i, searchValu
|
|
|
669
671
|
itemToStringLabel: $.itemToStringLabel,
|
|
670
672
|
disabled: h,
|
|
671
673
|
filter: null,
|
|
672
|
-
name:
|
|
673
|
-
required:
|
|
674
|
+
name: y,
|
|
675
|
+
required: E,
|
|
674
676
|
open: Ce,
|
|
675
677
|
onOpenChange: (e) => {
|
|
676
|
-
!e &&
|
|
678
|
+
!e && X && Z(n), Q(e);
|
|
677
679
|
},
|
|
678
|
-
children: [/* @__PURE__ */ z(
|
|
679
|
-
ref:
|
|
680
|
-
className: r(
|
|
681
|
-
size:
|
|
682
|
-
error:
|
|
683
|
-
children: [De.map((e) => /* @__PURE__ */ R(
|
|
680
|
+
children: [/* @__PURE__ */ z(S, {
|
|
681
|
+
ref: pe,
|
|
682
|
+
className: r(O[ue], k[ue], ue === "sm" ? "text-pxs" : "text-sm", "bg-transparent !shadow-none", g),
|
|
683
|
+
size: de,
|
|
684
|
+
error: fe,
|
|
685
|
+
children: [De.map((e) => /* @__PURE__ */ R(C, {
|
|
684
686
|
strings: { remove: ($.strings.removeSelection ?? W.removeSelection)(l(e)) },
|
|
685
687
|
children: /* @__PURE__ */ R(a, {
|
|
686
688
|
tag: "span",
|
|
@@ -690,13 +692,13 @@ function ye({ items: t, selectedValues: n, onSelectedValuesChange: i, searchValu
|
|
|
690
692
|
className: "combobox--chip-label text-inherit",
|
|
691
693
|
children: l(e)
|
|
692
694
|
})
|
|
693
|
-
},
|
|
695
|
+
}, me(e))), /* @__PURE__ */ R(b, {
|
|
694
696
|
placeholder: Oe,
|
|
695
|
-
"aria-invalid":
|
|
696
|
-
"aria-required":
|
|
697
|
-
onBlur:
|
|
697
|
+
"aria-invalid": fe || void 0,
|
|
698
|
+
"aria-required": E,
|
|
699
|
+
onBlur: D
|
|
698
700
|
})]
|
|
699
|
-
}), /* @__PURE__ */ R(
|
|
701
|
+
}), /* @__PURE__ */ R(se, {
|
|
700
702
|
loading: d,
|
|
701
703
|
showStatus: $.showStatus,
|
|
702
704
|
showEmpty: $.showEmpty,
|
|
@@ -707,84 +709,84 @@ function ye({ items: t, selectedValues: n, onSelectedValuesChange: i, searchValu
|
|
|
707
709
|
createOptionItem: $.createOptionItem,
|
|
708
710
|
renderItemContent: $.renderItemContent,
|
|
709
711
|
getItemReactKey: $.getItemReactKey,
|
|
710
|
-
getItemDisabled:
|
|
711
|
-
renderGroupLabel:
|
|
712
|
-
loadingMore: f && !$.showStatus ?
|
|
712
|
+
getItemDisabled: H,
|
|
713
|
+
renderGroupLabel: te,
|
|
714
|
+
loadingMore: f && !$.showStatus ? V : !1,
|
|
713
715
|
strings: $.strings,
|
|
714
|
-
size:
|
|
715
|
-
portalContainer:
|
|
716
|
+
size: le,
|
|
717
|
+
portalContainer: v,
|
|
716
718
|
listRef: $.listRef,
|
|
717
|
-
anchor:
|
|
718
|
-
applyFooter: f &&
|
|
719
|
+
anchor: pe,
|
|
720
|
+
applyFooter: f && X ? {
|
|
719
721
|
applyLabel: $.strings.apply,
|
|
720
722
|
cancelLabel: $.strings.cancel,
|
|
721
723
|
onApply: Te,
|
|
722
724
|
onCancel: Ee
|
|
723
725
|
} : void 0
|
|
724
726
|
})]
|
|
725
|
-
}), /* @__PURE__ */ R(
|
|
726
|
-
error:
|
|
727
|
-
size:
|
|
727
|
+
}), /* @__PURE__ */ R(ce, {
|
|
728
|
+
error: T,
|
|
729
|
+
size: le
|
|
728
730
|
})]
|
|
729
731
|
});
|
|
730
732
|
}
|
|
731
|
-
|
|
733
|
+
Z.displayName = "Combobox", be.displayName = "MultiCombobox";
|
|
732
734
|
//#endregion
|
|
733
735
|
//#region src/components/features/combobox/async-resource-combobox.tsx
|
|
734
|
-
var
|
|
736
|
+
var xe = {
|
|
735
737
|
...W,
|
|
736
738
|
error: "Unable to load options.",
|
|
737
739
|
retry: "Retry"
|
|
738
740
|
};
|
|
739
|
-
function
|
|
741
|
+
function Se(e) {
|
|
740
742
|
return typeof e == "string" || typeof e == "number" || typeof e == "bigint";
|
|
741
743
|
}
|
|
742
|
-
function
|
|
743
|
-
let
|
|
744
|
-
|
|
745
|
-
}, [
|
|
746
|
-
|
|
747
|
-
n.signal?.aborted ||
|
|
744
|
+
function Ce({ fetcher: e, value: t, defaultValue: i = null, onValueChange: o, onAfterFetch: c, onError: u, getKey: d, getLabel: f, getDescription: p, getMeta: m, renderOption: h, limit: g = 10, debounceMs: _ = 300, preload: v = !0, minSearchLength: y = 0, errorMessage: b, renderError: x, strings: S, disabled: C, size: w, ...T }) {
|
|
745
|
+
let E = n(xe, S), D = t !== void 0, [O, k] = L(i), A = D ? t : O, [ee, M] = L(""), [te, B] = L([]), [ne, V] = L(!1), [H, U] = L(null), [re, W] = L(0), G = I(0), K = ee.trim(), q = N((e) => {
|
|
746
|
+
D || k(e), o?.(e);
|
|
747
|
+
}, [D, o]), J = j((t, n) => {
|
|
748
|
+
V(!0), U(null), e(n).then((e) => {
|
|
749
|
+
n.signal?.aborted || G.current !== t || (B(e), c?.(e, n));
|
|
748
750
|
}).catch((e) => {
|
|
749
|
-
n.signal?.aborted ||
|
|
751
|
+
n.signal?.aborted || G.current !== t || (B([]), U({
|
|
750
752
|
error: e,
|
|
751
753
|
query: n.query
|
|
752
754
|
}), u?.(e, n));
|
|
753
755
|
}).finally(() => {
|
|
754
|
-
!n.signal?.aborted &&
|
|
756
|
+
!n.signal?.aborted && G.current === t && V(!1);
|
|
755
757
|
});
|
|
756
758
|
}, _);
|
|
757
|
-
|
|
758
|
-
if (
|
|
759
|
-
if (!(
|
|
760
|
-
|
|
759
|
+
P(() => {
|
|
760
|
+
if (C) return;
|
|
761
|
+
if (!(K.length > 0 ? K.length >= y : v)) {
|
|
762
|
+
B([]), V(!1), U(null);
|
|
761
763
|
return;
|
|
762
764
|
}
|
|
763
|
-
let e =
|
|
764
|
-
|
|
765
|
+
let e = G.current + 1;
|
|
766
|
+
G.current = e;
|
|
765
767
|
let t = new AbortController();
|
|
766
|
-
return
|
|
767
|
-
query:
|
|
768
|
+
return J(e, {
|
|
769
|
+
query: K,
|
|
768
770
|
limit: g,
|
|
769
771
|
signal: t.signal
|
|
770
772
|
}), () => {
|
|
771
|
-
|
|
773
|
+
J.cancel(), t.abort();
|
|
772
774
|
};
|
|
773
775
|
}, [
|
|
774
|
-
|
|
776
|
+
C,
|
|
775
777
|
g,
|
|
778
|
+
y,
|
|
776
779
|
v,
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
J
|
|
780
|
+
re,
|
|
781
|
+
J,
|
|
782
|
+
K
|
|
781
783
|
]);
|
|
782
|
-
let
|
|
783
|
-
|
|
784
|
-
}, [
|
|
784
|
+
let Y = N(() => {
|
|
785
|
+
H && (M(H.query), W((e) => e + 1));
|
|
786
|
+
}, [H]), X = N((e) => {
|
|
785
787
|
if (h) return h(e, {
|
|
786
|
-
query:
|
|
787
|
-
isSelected:
|
|
788
|
+
query: K,
|
|
789
|
+
isSelected: A ? d(A) === d(e) : !1
|
|
788
790
|
});
|
|
789
791
|
let t = p?.(e), n = m?.(e);
|
|
790
792
|
return /* @__PURE__ */ z(s, {
|
|
@@ -796,19 +798,19 @@ function Se({ fetcher: e, value: t, defaultValue: i = null, onValueChange: o, on
|
|
|
796
798
|
children: [/* @__PURE__ */ R(a, {
|
|
797
799
|
type: "inherit",
|
|
798
800
|
tag: "span",
|
|
799
|
-
size:
|
|
801
|
+
size: w === "sm" ? "pxs" : void 0,
|
|
800
802
|
weight: "medium",
|
|
801
803
|
className: "min-w-0 shrink truncate",
|
|
802
804
|
children: f(e)
|
|
803
805
|
}), (!!t || !!n) && /* @__PURE__ */ z("span", {
|
|
804
806
|
className: "inline-flex min-w-0 flex-1 items-center gap-space-sm overflow-hidden text-muted-foreground",
|
|
805
|
-
children: [!!t && (
|
|
807
|
+
children: [!!t && (Se(t) ? /* @__PURE__ */ R(a, {
|
|
806
808
|
tag: "span",
|
|
807
809
|
size: "xs",
|
|
808
810
|
type: "secondary",
|
|
809
811
|
className: "min-w-0 truncate",
|
|
810
812
|
children: t
|
|
811
|
-
}) : t), !!n && (
|
|
813
|
+
}) : t), !!n && (Se(n) ? /* @__PURE__ */ R(a, {
|
|
812
814
|
tag: "span",
|
|
813
815
|
size: "xs",
|
|
814
816
|
type: "secondary",
|
|
@@ -823,53 +825,53 @@ function Se({ fetcher: e, value: t, defaultValue: i = null, onValueChange: o, on
|
|
|
823
825
|
f,
|
|
824
826
|
m,
|
|
825
827
|
h,
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
]),
|
|
830
|
-
if (
|
|
828
|
+
A,
|
|
829
|
+
w,
|
|
830
|
+
K
|
|
831
|
+
]), ie = F(() => {
|
|
832
|
+
if (H) return b ?? E.error;
|
|
831
833
|
}, [
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
]),
|
|
836
|
-
error:
|
|
837
|
-
query:
|
|
838
|
-
retry:
|
|
834
|
+
b,
|
|
835
|
+
H,
|
|
836
|
+
E.error
|
|
837
|
+
]), ae = H !== null, oe = H ? x?.({
|
|
838
|
+
error: H.error,
|
|
839
|
+
query: H.query,
|
|
840
|
+
retry: Y
|
|
839
841
|
}) ?? /* @__PURE__ */ R(l, {
|
|
840
842
|
variant: "inline",
|
|
841
|
-
title:
|
|
842
|
-
onRetry:
|
|
843
|
-
retryLabel:
|
|
843
|
+
title: ie,
|
|
844
|
+
onRetry: Y,
|
|
845
|
+
retryLabel: E.retry,
|
|
844
846
|
className: "async-resource-combobox--error mt-space-sm"
|
|
845
847
|
}) : null;
|
|
846
848
|
return /* @__PURE__ */ z("div", {
|
|
847
849
|
"data-component": "async-resource-combobox",
|
|
848
850
|
"data-slot": "async-resource-combobox",
|
|
849
|
-
className: r("async-resource-combobox--component",
|
|
850
|
-
children: [/* @__PURE__ */ R(
|
|
851
|
-
...
|
|
851
|
+
className: r("async-resource-combobox--component", T.className),
|
|
852
|
+
children: [/* @__PURE__ */ R(Z, {
|
|
853
|
+
...T,
|
|
852
854
|
className: void 0,
|
|
853
|
-
disabled:
|
|
854
|
-
size:
|
|
855
|
-
items:
|
|
856
|
-
selectedValue:
|
|
857
|
-
onSelectedValueChange:
|
|
855
|
+
disabled: C,
|
|
856
|
+
size: w,
|
|
857
|
+
items: te,
|
|
858
|
+
selectedValue: A ?? null,
|
|
859
|
+
onSelectedValueChange: q,
|
|
858
860
|
clearSearchOnClose: !1,
|
|
859
|
-
searchValue:
|
|
860
|
-
onSearchValueChange:
|
|
861
|
+
searchValue: ee,
|
|
862
|
+
onSearchValueChange: M,
|
|
861
863
|
getItemLabel: f,
|
|
862
864
|
getItemKey: d,
|
|
863
|
-
loading: !
|
|
864
|
-
showListContent: !
|
|
865
|
-
minSearchLength:
|
|
866
|
-
strings:
|
|
867
|
-
renderItem:
|
|
868
|
-
}),
|
|
865
|
+
loading: !ae && ne,
|
|
866
|
+
showListContent: !ae,
|
|
867
|
+
minSearchLength: y,
|
|
868
|
+
strings: E,
|
|
869
|
+
renderItem: X
|
|
870
|
+
}), oe]
|
|
869
871
|
});
|
|
870
872
|
}
|
|
871
|
-
|
|
873
|
+
Ce.displayName = "AsyncResourceCombobox";
|
|
872
874
|
//#endregion
|
|
873
|
-
export {
|
|
875
|
+
export { ge as a, be as i, xe as n, W as o, Z as r, Ce as t };
|
|
874
876
|
|
|
875
|
-
//# sourceMappingURL=combobox-
|
|
877
|
+
//# sourceMappingURL=combobox-Dxo2fAYQ.js.map
|