themelia-ui 3.1.0 → 3.2.0
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/.agents/skills/themelia-ui/SKILL.md +38 -9
- package/.agents/skills/themelia-ui/manifest.json +23 -0
- package/.agents/skills/themelia-ui/references/api-compatibility.md +3 -2
- package/.agents/skills/themelia-ui/references/blocks.md +123 -0
- package/.agents/skills/themelia-ui/references/composition-ladder.md +8 -8
- package/.agents/skills/themelia-ui/references/composition.md +98 -1
- package/.agents/skills/themelia-ui/references/forms.md +23 -3
- package/.agents/skills/themelia-ui/references/framework-wiring.md +34 -6
- package/.agents/skills/themelia-ui/references/i18n.md +4 -2
- package/.agents/skills/themelia-ui/references/imports.md +1 -1
- package/.agents/skills/themelia-ui/references/installation.md +5 -4
- package/.agents/skills/themelia-ui/references/migration.md +22 -2
- package/.agents/skills/themelia-ui/references/provider-and-scoping.md +27 -9
- package/.agents/skills/themelia-ui/references/reference-workflows.md +43 -0
- package/.agents/skills/themelia-ui/references/structure-and-spacing.md +147 -0
- package/.agents/skills/themelia-ui/references/theming.md +6 -2
- package/.agents/skills/themelia-ui/references/troubleshooting.md +28 -5
- package/.agents/skills/themelia-ui/references/verification.md +58 -2
- package/CHANGELOG.md +25 -0
- package/README.md +3 -0
- package/dist/{alert-dialog-Bmo1YrTm.js → alert-dialog-Cg2HhuBe.js} +1 -1
- package/dist/base/alert-dialog.js +1 -1
- package/dist/base/cards.js +1 -1
- package/dist/base/choice-inputs.js +1 -1
- package/dist/base/combobox.js +1 -1
- package/dist/base/command.js +1 -1
- package/dist/base/date-pickers.js +1 -1
- package/dist/base/dialog.js +1 -1
- package/dist/base/display.js +1 -1
- package/dist/base/forms-numeric.js +1 -1
- package/dist/base/forms.js +1 -1
- package/dist/base/item.js +1 -1
- package/dist/base/navigation.js +1 -1
- package/dist/base/otp-input.js +1 -1
- package/dist/base/overlay.js +1 -1
- package/dist/base/popover-menu.js +1 -1
- package/dist/base/repeaters.js +1 -1
- package/dist/base/sheet.js +1 -1
- package/dist/base/sidebar.js +1 -1
- package/dist/base/skeleton.js +1 -1
- package/dist/base/structure.js +1 -1
- package/dist/base/timeline.js +1 -1
- package/dist/base/upload.js +1 -1
- package/dist/base/value-inputs.js +1 -1
- package/dist/blocks/admin/access.js +2 -2
- package/dist/blocks/admin/commerce.js +9 -9
- package/dist/blocks/analytics.js +3 -3
- package/dist/blocks/onboarding.js +1 -1
- package/dist/blocks/timelines.js +1 -1
- package/dist/{cards-DdiICdMM.js → cards-Ddhz43Bz.js} +2 -2
- package/dist/{choice-inputs-CCw-0gD6.js → choice-inputs-NwRxvmZN.js} +2 -2
- package/dist/combobox-519ubijc.js +292 -0
- package/dist/{command-CnB_IZSo.js → command-JjApYFds.js} +2 -2
- package/dist/{comments-C6Y_ddMt.js → comments-CCQ2QRaU.js} +4 -4
- package/dist/components/base/display/icon-badge.d.ts +2 -2
- package/dist/components/base/forms/form-field.d.ts +2 -2
- package/dist/components/base/structure/bleed.d.ts +1 -0
- package/dist/components/base/structure/grid.d.ts +8 -2
- package/dist/components/base/structure/split.d.ts +1 -0
- package/dist/components/features/combobox/fetching-combobox.d.ts +2 -1
- package/dist/components/features/combobox/resource-combobox.d.ts +3 -0
- package/dist/components/features/combobox/use-suggestions.d.ts +7 -0
- package/dist/css/structure.css +1 -1
- package/dist/{date-pickers-C2HgjpFU.js → date-pickers-BwCwKIVM.js} +1 -1
- package/dist/{dialog-0nRFg5Zs.js → dialog-CAnwRNrm.js} +1 -1
- package/dist/{display-BGN834xV.js → display-a7AoX_u7.js} +1 -1
- package/dist/features/actions.js +1 -1
- package/dist/features/activities.js +3 -3
- package/dist/features/ai-chat.js +2 -2
- package/dist/features/combobox.js +285 -273
- package/dist/features/comments.js +1 -1
- package/dist/features/data-view.js +5 -5
- package/dist/features/event-calendar.js +3 -3
- package/dist/features/filters.js +1 -1
- package/dist/features/global-search.js +4 -4
- package/dist/features/map.js +2 -2
- package/dist/features/media-library.js +8 -8
- package/dist/features/mentions.js +1 -1
- package/dist/features/overlays.js +1 -1
- package/dist/features/products.js +9 -9
- package/dist/features/resource-assignment.js +3 -3
- package/dist/features/resource.js +3 -3
- package/dist/features/schema-form.js +6 -6
- package/dist/features/sync.js +2 -2
- package/dist/features/table.js +1 -1
- package/dist/features/theme-tweaker.js +10 -10
- package/dist/{filters-geLuSlFL.js → filters-BhsTkWpZ.js} +9 -9
- package/dist/{forms-NxbJK4Mh.js → forms-C0WeNPFF.js} +1 -1
- package/dist/{forms-numeric-C6NMdj6G.js → forms-numeric-IwQ1ltNf.js} +1 -1
- package/dist/hooks/use-native-dialog.d.ts +1 -1
- package/dist/{item-CuUJyETl.js → item-M2pmpWXh.js} +1 -1
- package/dist/layout/app-shell.js +1 -1
- package/dist/layout/auth.js +1 -1
- package/dist/layout/header.js +3 -3
- package/dist/layout/navigation.js +1 -1
- package/dist/layout/page.js +2 -2
- package/dist/layout/settings.js +2 -2
- package/dist/layout/sidebar.js +10 -6
- package/dist/layout/workspace.js +3 -3
- package/dist/lib/ui-provider/ui-scope.d.ts +1 -1
- package/dist/{mentions-oeYNv_j1.js → mentions-BOxbigwp.js} +2 -2
- package/dist/{navigation-BTX5Ti0Z.js → navigation-Bgu7Vc0M.js} +2 -2
- package/dist/{navigation-WYKjDhZq.js → navigation-DiYACqpE.js} +2 -2
- package/dist/{overlay-C8RAgi2_.js → overlay-BuQOl8aP.js} +5 -5
- package/dist/{overlays-9BxwFTou.js → overlays-1sULyytH.js} +5 -5
- package/dist/{popover-menu-DcLeiw9r.js → popover-menu-QXgQeWeG.js} +1 -1
- package/dist/{repeaters-DfptvbGA.js → repeaters-CeH20dvr.js} +4 -4
- package/dist/{sheet-D-DVZH_b.js → sheet-CJ1-OAla.js} +1 -1
- package/dist/{sidebar-DXQOy_Cb.js → sidebar-D8uGqxio.js} +4 -4
- package/dist/{skeleton-CubvHel9.js → skeleton-BTKNKTdj.js} +1 -1
- package/dist/{structure-B9Y5NkP_.js → structure-CynEZ-OY.js} +1 -2
- package/dist/style.css +1 -1
- package/dist/styles/TOKENS.md +4 -3
- package/dist/{table-DT_20ity.js → table-B7dtIFUx.js} +4 -4
- package/dist/{timeline-BRZbSdhf.js → timeline-BR_jNgvz.js} +1 -1
- package/dist/{timelines-DczZKW5p.js → timelines-DXG1BfIN.js} +1 -1
- package/dist/{upload-C_6mlbfl.js → upload-CYuoJykZ.js} +1 -1
- package/dist/{value-inputs-CnO6RZeT.js → value-inputs-ng8aVJJZ.js} +4 -4
- package/docs/README.md +11 -1
- package/docs/build/browser-composition-fixture.ts +28 -0
- package/docs/build/recipes.md +398 -1
- package/docs/generated/component-index.json +1993 -862
- package/docs/generated/components/base--display.md +2 -2
- package/docs/generated/components/base--forms.md +72 -1
- package/docs/generated/components/base--structure.md +56 -5
- package/docs/generated/components/base--typography.md +38 -0
- package/docs/generated/components/blocks--admin--access.md +10 -0
- package/docs/generated/components/blocks--analytics.md +44 -0
- package/docs/generated/components/features--combobox.md +67 -0
- package/docs/generated/components/features--data-view.md +59 -3
- package/docs/generated/components/features--filters.md +10 -0
- package/docs/generated/components/features--media-library.md +68 -0
- package/docs/generated/components/features--overlays.md +54 -0
- package/docs/generated/components/features--rich-text-editor.md +38 -0
- package/docs/generated/components/layout--app-shell.md +31 -0
- package/docs/generated/components/layout--containers.md +40 -0
- package/docs/generated/components/layout--page.md +30 -1
- package/docs/generated/components/layout--sidebar.md +41 -0
- package/docs/generated/components/ui-provider.md +1 -1
- package/docs/generated/composition-ladder.md +8 -8
- package/docs/generated/consumer-contract.json +5736 -0
- package/docs/generated/imports.md +1 -1
- package/docs/generated/recipes.json +171 -1
- package/docs/generated/workflows/communications-overview/analytics/communications-reference.tsx +19 -0
- package/docs/generated/workflows/index.json +691 -0
- package/docs/generated/workflows/media-picking/media-library/media-picking-reference.tsx +63 -0
- package/docs/generated/workflows/media-picking/media-library/reference-data.ts +3 -0
- package/docs/generated/workflows/multi-section-form/form-workflow/multi-section-reference.tsx +46 -0
- package/docs/generated/workflows/nested-action-flow/action-overlays/nested-action-reference.tsx +39 -0
- package/docs/generated/workflows/record-detail/page-layout/record-detail-reference.tsx +24 -0
- package/docs/generated/workflows/resource-index/data-view/resource-index-reference.tsx +51 -0
- package/docs/generated/workflows/scoped-resource-selection/combobox/scoped-resource-reference.tsx +50 -0
- package/docs/generated/workflows/website-content-editor/media-library/reference-data.ts +3 -0
- package/docs/generated/workflows/website-content-editor/rich-text-editor/website-content-reference.tsx +33 -0
- package/docs/generated/workflows/workspace-navigation/app-shell/workspace-navigation-reference.tsx +26 -0
- package/docs/learn/api-compatibility.md +3 -2
- package/docs/learn/blocks.md +123 -0
- package/docs/learn/composition.md +98 -1
- package/docs/learn/forms.md +23 -3
- package/docs/learn/framework-wiring.md +34 -6
- package/docs/learn/i18n.md +4 -2
- package/docs/learn/installation.md +5 -4
- package/docs/learn/migration.md +22 -2
- package/docs/learn/provider-and-scoping.md +27 -9
- package/docs/learn/reference-workflows.md +43 -0
- package/docs/learn/structure-and-spacing.md +147 -0
- package/docs/learn/theming.md +6 -2
- package/docs/learn/troubleshooting.md +28 -5
- package/docs/learn/verification.md +58 -2
- package/package.json +4 -1
- package/scripts/consumer/codemod.mjs +3 -24
- package/scripts/consumer/contract-reader.mjs +42 -0
- package/scripts/consumer/css-scan.mjs +51 -0
- package/scripts/consumer/diagnose.mjs +136 -0
- package/scripts/consumer/find-component.mjs +28 -13
- package/scripts/consumer/install-skill.mjs +93 -11
- package/src/styles/TOKENS.md +4 -3
- package/dist/combobox-Byu8N-Oe.js +0 -274
|
@@ -4,15 +4,15 @@ import { s as e } from "../typography-DmeR05Er.js";
|
|
|
4
4
|
import { t } from "../cx--CBrhWH0.js";
|
|
5
5
|
import { c as n } from "../buttons-BX2JfL5X.js";
|
|
6
6
|
import { t as r } from "../feedback-D4qVsKlD.js";
|
|
7
|
-
import { m as i } from "../display-
|
|
8
|
-
import { C as a, E as o, _ as s, a as c, b as l, c as u, d, g as f, i as p, m, o as h, p as g, u as _, x as v, y } from "../combobox-
|
|
7
|
+
import { m as i } from "../display-a7AoX_u7.js";
|
|
8
|
+
import { C as a, E as o, _ as s, a as c, b as l, c as u, d, g as f, i as p, m, o as h, p as g, u as _, x as v, y } from "../combobox-519ubijc.js";
|
|
9
9
|
import { t as b } from "../use-debounced-callback-BcKYwxqp.js";
|
|
10
10
|
import { t as x } from "../spinner-Tc1QCnxM.js";
|
|
11
11
|
import { PlusIcon as S } from "lucide-react";
|
|
12
|
-
import { useCallback as C, useEffect as w, useId as T,
|
|
13
|
-
import { Fragment as
|
|
12
|
+
import { useCallback as C, useEffect as w, useId as T, useLayoutEffect as E, useMemo as D, useRef as O, useState as k } from "react";
|
|
13
|
+
import { Fragment as A, jsx as j, jsxs as M } from "react/jsx-runtime";
|
|
14
14
|
import "#css/combobox.css";
|
|
15
|
-
var
|
|
15
|
+
var N = {
|
|
16
16
|
root: "combobox__root___FdCB-",
|
|
17
17
|
error: "combobox__error___2R4DY",
|
|
18
18
|
errorState: "combobox__errorState___0HPSR",
|
|
@@ -30,66 +30,66 @@ var M = {
|
|
|
30
30
|
};
|
|
31
31
|
//#endregion
|
|
32
32
|
//#region src/components/features/combobox/combobox-dropdown.tsx
|
|
33
|
-
function
|
|
34
|
-
return t ? /* @__PURE__ */
|
|
33
|
+
function P({ loading: t, trimmedSearch: n, minSearchLength: r, strings: i }) {
|
|
34
|
+
return t ? /* @__PURE__ */ j(x, { label: i.searching }) : n === "" ? /* @__PURE__ */ j(e, {
|
|
35
35
|
size: "xs",
|
|
36
36
|
type: "secondary",
|
|
37
37
|
children: i.formatTypeToSearch(r)
|
|
38
|
-
}) : n.length < r ? /* @__PURE__ */
|
|
38
|
+
}) : n.length < r ? /* @__PURE__ */ j(e, {
|
|
39
39
|
size: "xs",
|
|
40
40
|
type: "secondary",
|
|
41
41
|
children: i.formatTypeMore(r - n.length)
|
|
42
42
|
}) : null;
|
|
43
43
|
}
|
|
44
|
-
function
|
|
45
|
-
let L = !!I || r || o || h.length > 0 || !!T || !!F, R = (e) => /* @__PURE__ */
|
|
44
|
+
function F({ loading: t, showStatus: r, showEmpty: o, trimmedSearch: c, minSearchLength: p, items: h, groupedItems: g, createOptionItem: v, renderItemContent: b, getItemReactKey: S, getItemDisabled: C, renderGroupLabel: w, loadingMore: T, strings: E, portalContainer: D, listRef: O, anchor: k, applyFooter: F, errorSlot: I }) {
|
|
45
|
+
let L = !!I || r || o || h.length > 0 || !!T || !!F, R = (e) => /* @__PURE__ */ j(m, {
|
|
46
46
|
value: e,
|
|
47
47
|
disabled: C?.(e),
|
|
48
48
|
children: b(e)
|
|
49
|
-
}, S(e)), z = /* @__PURE__ */
|
|
50
|
-
anchor:
|
|
51
|
-
className: D ?
|
|
52
|
-
children: /* @__PURE__ */
|
|
49
|
+
}, S(e)), z = /* @__PURE__ */ j(l, {
|
|
50
|
+
anchor: k,
|
|
51
|
+
className: D ? N.positioner : void 0,
|
|
52
|
+
children: /* @__PURE__ */ j(s, {
|
|
53
53
|
"aria-busy": t || void 0,
|
|
54
54
|
"data-empty": !L || void 0,
|
|
55
|
-
className:
|
|
56
|
-
children: I ?? /* @__PURE__ */
|
|
57
|
-
r && /* @__PURE__ */
|
|
58
|
-
className:
|
|
59
|
-
children: /* @__PURE__ */
|
|
55
|
+
className: N.popup,
|
|
56
|
+
children: I ?? /* @__PURE__ */ M(A, { children: [
|
|
57
|
+
r && /* @__PURE__ */ j(a, {
|
|
58
|
+
className: N.status,
|
|
59
|
+
children: /* @__PURE__ */ j(P, {
|
|
60
60
|
loading: t,
|
|
61
61
|
trimmedSearch: c,
|
|
62
62
|
minSearchLength: p,
|
|
63
63
|
strings: E
|
|
64
64
|
})
|
|
65
65
|
}),
|
|
66
|
-
o && /* @__PURE__ */
|
|
67
|
-
className:
|
|
68
|
-
children: /* @__PURE__ */
|
|
66
|
+
o && /* @__PURE__ */ j(a, {
|
|
67
|
+
className: N.empty,
|
|
68
|
+
children: /* @__PURE__ */ j(e, {
|
|
69
69
|
type: "secondary",
|
|
70
70
|
children: E.noResults
|
|
71
71
|
})
|
|
72
72
|
}),
|
|
73
|
-
/* @__PURE__ */
|
|
73
|
+
/* @__PURE__ */ j(i, {
|
|
74
74
|
ref: O,
|
|
75
|
-
className:
|
|
76
|
-
children: /* @__PURE__ */
|
|
77
|
-
className:
|
|
78
|
-
children: g ? /* @__PURE__ */
|
|
75
|
+
className: N.scroller,
|
|
76
|
+
children: /* @__PURE__ */ j(f, {
|
|
77
|
+
className: N.list,
|
|
78
|
+
children: g ? /* @__PURE__ */ M(A, { children: [Array.from(g.entries()).map(([e, t]) => /* @__PURE__ */ M(_, {
|
|
79
79
|
items: t,
|
|
80
|
-
children: [/* @__PURE__ */
|
|
81
|
-
}, e)), v !== null && R(v)] }) : /* @__PURE__ */
|
|
80
|
+
children: [/* @__PURE__ */ j(d, { children: w ? w(e) : e }), /* @__PURE__ */ j(u, { children: R })]
|
|
81
|
+
}, e)), v !== null && R(v)] }) : /* @__PURE__ */ j(u, { children: R })
|
|
82
82
|
})
|
|
83
83
|
}),
|
|
84
|
-
!!T && /* @__PURE__ */
|
|
84
|
+
!!T && /* @__PURE__ */ j("div", {
|
|
85
85
|
role: "status",
|
|
86
86
|
"aria-live": "polite",
|
|
87
|
-
className:
|
|
88
|
-
children: /* @__PURE__ */
|
|
87
|
+
className: N.loadingMore,
|
|
88
|
+
children: /* @__PURE__ */ j(x, { label: E.loadingMore })
|
|
89
89
|
}),
|
|
90
|
-
!!F && /* @__PURE__ */
|
|
91
|
-
className:
|
|
92
|
-
children: [/* @__PURE__ */
|
|
90
|
+
!!F && /* @__PURE__ */ M("div", {
|
|
91
|
+
className: N.footer,
|
|
92
|
+
children: [/* @__PURE__ */ j(n, {
|
|
93
93
|
type: "button",
|
|
94
94
|
tone: "neutral",
|
|
95
95
|
appearance: "ghost",
|
|
@@ -97,7 +97,7 @@ function P({ loading: t, showStatus: r, showEmpty: o, trimmedSearch: c, minSearc
|
|
|
97
97
|
e.preventDefault(), e.stopPropagation(), F.onCancel();
|
|
98
98
|
},
|
|
99
99
|
children: F.cancelLabel
|
|
100
|
-
}), /* @__PURE__ */
|
|
100
|
+
}), /* @__PURE__ */ j(n, {
|
|
101
101
|
type: "button",
|
|
102
102
|
onClick: (e) => {
|
|
103
103
|
e.preventDefault(), e.stopPropagation(), F.onApply();
|
|
@@ -108,14 +108,14 @@ function P({ loading: t, showStatus: r, showEmpty: o, trimmedSearch: c, minSearc
|
|
|
108
108
|
] })
|
|
109
109
|
})
|
|
110
110
|
});
|
|
111
|
-
return /* @__PURE__ */
|
|
111
|
+
return /* @__PURE__ */ j(y, {
|
|
112
112
|
container: D,
|
|
113
113
|
children: z
|
|
114
114
|
});
|
|
115
115
|
}
|
|
116
116
|
//#endregion
|
|
117
117
|
//#region src/components/features/combobox/combobox.strings.ts
|
|
118
|
-
var
|
|
118
|
+
var I = {
|
|
119
119
|
placeholder: "Search…",
|
|
120
120
|
clear: "Clear selection",
|
|
121
121
|
toggle: "Show options",
|
|
@@ -130,22 +130,22 @@ var F = {
|
|
|
130
130
|
errorTitle: "Could not load results",
|
|
131
131
|
retry: "Retry",
|
|
132
132
|
removeChip: (e) => `Remove ${e}`
|
|
133
|
-
},
|
|
133
|
+
}, L = {
|
|
134
134
|
placeholder: "Search…",
|
|
135
135
|
emptyMessage: "No results found.",
|
|
136
136
|
loadingMessage: "Searching…",
|
|
137
137
|
startTypingMessage: "Type to search.",
|
|
138
|
-
formatTypeMore:
|
|
138
|
+
formatTypeMore: I.formatTypeMore,
|
|
139
139
|
errorMessage: "Could not load suggestions.",
|
|
140
140
|
retry: "Retry"
|
|
141
141
|
};
|
|
142
142
|
//#endregion
|
|
143
143
|
//#region src/components/features/combobox/highlighted-text.tsx
|
|
144
|
-
function
|
|
144
|
+
function R(e) {
|
|
145
145
|
return e.replace(/[$()*+.?[\\\]^{|}]/g, "\\$&");
|
|
146
146
|
}
|
|
147
|
-
function
|
|
148
|
-
if (!n.trim()) return /* @__PURE__ */
|
|
147
|
+
function z({ text: t, highlight: n }) {
|
|
148
|
+
if (!n.trim()) return /* @__PURE__ */ j(e, {
|
|
149
149
|
tag: "span",
|
|
150
150
|
size: "inherit",
|
|
151
151
|
type: "inherit",
|
|
@@ -153,8 +153,8 @@ function R({ text: t, highlight: n }) {
|
|
|
153
153
|
className: "highlighted-text--component",
|
|
154
154
|
children: t
|
|
155
155
|
});
|
|
156
|
-
let r = t.split(RegExp(`(${
|
|
157
|
-
return /* @__PURE__ */
|
|
156
|
+
let r = t.split(RegExp(`(${R(n)})`, "gi")), i = r.reduce((e, t, n) => [...e, (e[n] ?? 0) + t.length], [0]);
|
|
157
|
+
return /* @__PURE__ */ j(e, {
|
|
158
158
|
tag: "span",
|
|
159
159
|
size: "inherit",
|
|
160
160
|
type: "inherit",
|
|
@@ -164,24 +164,24 @@ function R({ text: t, highlight: n }) {
|
|
|
164
164
|
let n = t % 2 == 1;
|
|
165
165
|
if (!n && e === "") return null;
|
|
166
166
|
let r = `${i[t]}:${n ? "match" : "text"}`;
|
|
167
|
-
return
|
|
167
|
+
return j(n ? "mark" : "span", { children: e }, r);
|
|
168
168
|
})
|
|
169
169
|
});
|
|
170
170
|
}
|
|
171
171
|
//#endregion
|
|
172
172
|
//#region src/components/features/combobox/use-combobox-core.tsx
|
|
173
|
-
var
|
|
174
|
-
function W(e) {
|
|
175
|
-
return typeof e == "object" && !!e && U in e;
|
|
176
|
-
}
|
|
173
|
+
var B = 3, V = .8, H = 100, U = 500, W = Symbol("combobox-create-option");
|
|
177
174
|
function G(e) {
|
|
178
|
-
|
|
179
|
-
return e[U];
|
|
175
|
+
return typeof e == "object" && !!e && W in e;
|
|
180
176
|
}
|
|
181
177
|
function K(e) {
|
|
182
|
-
|
|
178
|
+
if (!G(e)) throw Error("That item is not a create option.");
|
|
179
|
+
return e[W];
|
|
180
|
+
}
|
|
181
|
+
function q(e) {
|
|
182
|
+
return { [W]: e };
|
|
183
183
|
}
|
|
184
|
-
function
|
|
184
|
+
function J({ searchValue: e, onSearch: t, debounceMs: n = 300, minSearchLength: r = 3 }) {
|
|
185
185
|
let i = b((e) => t?.(e), n);
|
|
186
186
|
w(() => {
|
|
187
187
|
let t = e.trim();
|
|
@@ -192,18 +192,18 @@ function q({ searchValue: e, onSearch: t, debounceMs: n = 300, minSearchLength:
|
|
|
192
192
|
e
|
|
193
193
|
]);
|
|
194
194
|
}
|
|
195
|
-
function
|
|
196
|
-
let r =
|
|
195
|
+
function ee({ hasMore: e, onLoadMore: t, loadingMore: n }) {
|
|
196
|
+
let r = O(!1), i = O(null), a = b(() => {
|
|
197
197
|
r.current = !0, t?.(), i.current && clearTimeout(i.current), i.current = setTimeout(() => {
|
|
198
198
|
r.current = !1, i.current = null;
|
|
199
|
-
},
|
|
200
|
-
},
|
|
199
|
+
}, U);
|
|
200
|
+
}, H);
|
|
201
201
|
return w(() => () => {
|
|
202
202
|
i.current && clearTimeout(i.current);
|
|
203
203
|
}, []), { handleScroll: C((i) => {
|
|
204
204
|
if (!e || !t || n || r.current) return;
|
|
205
205
|
let { scrollHeight: o, scrollTop: s, clientHeight: c } = i.target;
|
|
206
|
-
(s + c) / o >=
|
|
206
|
+
(s + c) / o >= V && a();
|
|
207
207
|
}, [
|
|
208
208
|
e,
|
|
209
209
|
n,
|
|
@@ -213,32 +213,32 @@ function J({ hasMore: e, onLoadMore: t, loadingMore: n }) {
|
|
|
213
213
|
}
|
|
214
214
|
function Y({ items: t, searchValue: n, getItemLabel: r, getItemKey: i, loading: a = !1, showListContent: o = !0, minSearchLength: s = 3, strings: c, renderItem: l, onSearch: u, debounceMs: d = 300, creatable: f, onCreate: p, getItemGroup: m, hasMore: h, onLoadMore: g, loadingMore: _, highlightMatch: v, ensuredItems: y = [] }) {
|
|
215
215
|
let b = {
|
|
216
|
-
...
|
|
216
|
+
...I,
|
|
217
217
|
...c
|
|
218
|
-
}, { formatCreate: x } = b, T = i ?? r,
|
|
219
|
-
|
|
218
|
+
}, { formatCreate: x } = b, T = i ?? r, E = O(null), k = n.trim(), A = o && (a || k.length < s);
|
|
219
|
+
J({
|
|
220
220
|
searchValue: n,
|
|
221
221
|
onSearch: u,
|
|
222
222
|
debounceMs: d,
|
|
223
223
|
minSearchLength: s
|
|
224
224
|
});
|
|
225
|
-
let { handleScroll: P } =
|
|
226
|
-
hasMore: o && !
|
|
225
|
+
let { handleScroll: P } = ee({
|
|
226
|
+
hasMore: o && !A ? h : !1,
|
|
227
227
|
onLoadMore: g,
|
|
228
228
|
loadingMore: _
|
|
229
229
|
});
|
|
230
230
|
w(() => {
|
|
231
|
-
let e =
|
|
232
|
-
if (!(!o ||
|
|
231
|
+
let e = E.current;
|
|
232
|
+
if (!(!o || A || !e || !h || !g)) return e.addEventListener("scroll", P), () => e.removeEventListener("scroll", P);
|
|
233
233
|
}, [
|
|
234
234
|
P,
|
|
235
235
|
h,
|
|
236
236
|
g,
|
|
237
237
|
o,
|
|
238
|
-
|
|
238
|
+
A
|
|
239
239
|
]);
|
|
240
|
-
let
|
|
241
|
-
if (!o ||
|
|
240
|
+
let F = D(() => {
|
|
241
|
+
if (!o || A) return [];
|
|
242
242
|
if (y.length === 0) return t;
|
|
243
243
|
let e = [...y];
|
|
244
244
|
for (let n of t) y.some((e) => T(e) === T(n)) || e.push(n);
|
|
@@ -248,59 +248,59 @@ function Y({ items: t, searchValue: n, getItemLabel: r, getItemKey: i, loading:
|
|
|
248
248
|
T,
|
|
249
249
|
t,
|
|
250
250
|
o,
|
|
251
|
-
|
|
252
|
-
]), L =
|
|
251
|
+
A
|
|
252
|
+
]), L = D(() => {
|
|
253
253
|
if (!m) return null;
|
|
254
254
|
let e = /* @__PURE__ */ new Map();
|
|
255
|
-
for (let t of
|
|
255
|
+
for (let t of F) {
|
|
256
256
|
let n = m(t), r = e.get(n);
|
|
257
257
|
r ? r.push(t) : e.set(n, [t]);
|
|
258
258
|
}
|
|
259
259
|
return e;
|
|
260
|
-
}, [
|
|
261
|
-
if (!o ||
|
|
260
|
+
}, [F, m]), R = D(() => {
|
|
261
|
+
if (!o || A || !f || !p || k === "" || k.length < s) return !1;
|
|
262
262
|
let e = k.toLowerCase();
|
|
263
|
-
return !
|
|
263
|
+
return !F.some((t) => r(t).toLowerCase() === e);
|
|
264
264
|
}, [
|
|
265
|
-
|
|
265
|
+
F,
|
|
266
266
|
f,
|
|
267
267
|
r,
|
|
268
268
|
s,
|
|
269
269
|
p,
|
|
270
270
|
o,
|
|
271
|
-
|
|
271
|
+
A,
|
|
272
272
|
k
|
|
273
|
-
]), B =
|
|
273
|
+
]), B = D(() => R ? q(k) : null, [R, k]);
|
|
274
274
|
return {
|
|
275
275
|
strings: b,
|
|
276
276
|
getKey: T,
|
|
277
277
|
trimmedSearch: k,
|
|
278
|
-
listRef:
|
|
279
|
-
baseItems:
|
|
280
|
-
allItems:
|
|
278
|
+
listRef: E,
|
|
279
|
+
baseItems: F,
|
|
280
|
+
allItems: D(() => B ? [...F, B] : F, [F, B]),
|
|
281
281
|
groupedItems: L,
|
|
282
282
|
createOptionItem: B,
|
|
283
|
-
showStatus:
|
|
284
|
-
showEmpty: o && !a && k.length >= s && t.length === 0 && !
|
|
285
|
-
showCreateOption:
|
|
283
|
+
showStatus: A,
|
|
284
|
+
showEmpty: o && !a && k.length >= s && t.length === 0 && !R,
|
|
285
|
+
showCreateOption: R,
|
|
286
286
|
renderItemContent: C((t) => {
|
|
287
|
-
if (
|
|
288
|
-
className:
|
|
289
|
-
children: [/* @__PURE__ */
|
|
287
|
+
if (G(t)) return /* @__PURE__ */ M("span", {
|
|
288
|
+
className: N.createRow,
|
|
289
|
+
children: [/* @__PURE__ */ j(S, { "aria-hidden": !0 }), /* @__PURE__ */ j(e, {
|
|
290
290
|
tag: "span",
|
|
291
291
|
size: "inherit",
|
|
292
292
|
type: "inherit",
|
|
293
293
|
weight: "medium",
|
|
294
294
|
lineHeight: "tight",
|
|
295
|
-
children: x(
|
|
295
|
+
children: x(K(t))
|
|
296
296
|
})]
|
|
297
297
|
});
|
|
298
298
|
if (l) return l(t);
|
|
299
299
|
let n = r(t);
|
|
300
|
-
return v && k ? /* @__PURE__ */
|
|
300
|
+
return v && k ? /* @__PURE__ */ j(z, {
|
|
301
301
|
text: n,
|
|
302
302
|
highlight: k
|
|
303
|
-
}) : /* @__PURE__ */
|
|
303
|
+
}) : /* @__PURE__ */ j(e, {
|
|
304
304
|
tag: "span",
|
|
305
305
|
size: "inherit",
|
|
306
306
|
type: "inherit",
|
|
@@ -314,22 +314,22 @@ function Y({ items: t, searchValue: n, getItemLabel: r, getItemKey: i, loading:
|
|
|
314
314
|
l,
|
|
315
315
|
k
|
|
316
316
|
]),
|
|
317
|
-
itemToStringLabel: C((e) =>
|
|
318
|
-
getItemReactKey: C((e) =>
|
|
317
|
+
itemToStringLabel: C((e) => G(e) ? K(e) : r(e), [r]),
|
|
318
|
+
getItemReactKey: C((e) => G(e) ? `__create__:${K(e)}` : String(T(e)), [T]),
|
|
319
319
|
handleScroll: P
|
|
320
320
|
};
|
|
321
321
|
}
|
|
322
322
|
//#endregion
|
|
323
323
|
//#region src/components/features/combobox/async-combobox.tsx
|
|
324
324
|
function X({ error: t, id: n }) {
|
|
325
|
-
return t ? /* @__PURE__ */
|
|
325
|
+
return t ? /* @__PURE__ */ j(e, {
|
|
326
326
|
id: n,
|
|
327
327
|
tag: "p",
|
|
328
328
|
size: "xs",
|
|
329
329
|
type: "error",
|
|
330
330
|
role: "alert",
|
|
331
331
|
"aria-live": "polite",
|
|
332
|
-
className:
|
|
332
|
+
className: N.error,
|
|
333
333
|
children: t
|
|
334
334
|
}) : null;
|
|
335
335
|
}
|
|
@@ -375,41 +375,41 @@ function Z(e, t) {
|
|
|
375
375
|
describedBy: d ? g : void 0
|
|
376
376
|
};
|
|
377
377
|
}
|
|
378
|
-
function
|
|
379
|
-
let { id: u, searchValue: d, onSearchValueChange: f, className: p, error: m, required: h, onBlur: _, onCreate: y, open: b, onOpenChange: x } = l, S =
|
|
378
|
+
function te({ selectedValue: e, onSelectedValueChange: n, clearSearchOnClose: r = !0, minSearchLength: i = 3, loading: a = !1, showListContent: o = !0, disabled: s = !1, clearable: c = !0, ...l }) {
|
|
379
|
+
let { id: u, searchValue: d, onSearchValueChange: f, className: p, error: m, required: h, onBlur: _, onCreate: y, open: b, onOpenChange: x } = l, S = D(() => e ? [e] : [], [e]), { core: w, dropdown: T, root: E, invalid: O, errorId: A, describedBy: P } = Z({
|
|
380
380
|
...l,
|
|
381
381
|
minSearchLength: i,
|
|
382
382
|
loading: a,
|
|
383
383
|
showListContent: o,
|
|
384
384
|
disabled: s
|
|
385
|
-
}, S), [I, L] =
|
|
385
|
+
}, S), [I, L] = k(!1), R = C((e) => {
|
|
386
386
|
L(e), !e && r && f(""), x?.(e);
|
|
387
387
|
}, [
|
|
388
388
|
r,
|
|
389
389
|
x,
|
|
390
390
|
f
|
|
391
391
|
]), z = b ?? I ? d : e ? w.itemToStringLabel(e) : "", B = C((e) => {
|
|
392
|
-
if (e &&
|
|
393
|
-
y?.(
|
|
392
|
+
if (e && G(e)) {
|
|
393
|
+
y?.(K(e));
|
|
394
394
|
return;
|
|
395
395
|
}
|
|
396
396
|
n(e);
|
|
397
397
|
}, [y, n]);
|
|
398
|
-
return /* @__PURE__ */
|
|
399
|
-
className: t("async-combobox--component",
|
|
400
|
-
children: [/* @__PURE__ */
|
|
401
|
-
...
|
|
398
|
+
return /* @__PURE__ */ M("div", {
|
|
399
|
+
className: t("async-combobox--component", N.root),
|
|
400
|
+
children: [/* @__PURE__ */ M(v, {
|
|
401
|
+
...E,
|
|
402
402
|
value: e,
|
|
403
403
|
onValueChange: B,
|
|
404
404
|
inputValue: z,
|
|
405
405
|
open: b,
|
|
406
406
|
onOpenChange: R,
|
|
407
|
-
children: [/* @__PURE__ */
|
|
407
|
+
children: [/* @__PURE__ */ j(g, {
|
|
408
408
|
id: u,
|
|
409
409
|
placeholder: w.strings.placeholder,
|
|
410
410
|
showClear: c,
|
|
411
|
-
invalid:
|
|
412
|
-
"aria-describedby":
|
|
411
|
+
invalid: O,
|
|
412
|
+
"aria-describedby": P,
|
|
413
413
|
"aria-required": h,
|
|
414
414
|
disabled: s,
|
|
415
415
|
onBlur: _,
|
|
@@ -418,19 +418,19 @@ function Q({ selectedValue: e, onSelectedValueChange: n, clearSearchOnClose: r =
|
|
|
418
418
|
clear: w.strings.clear,
|
|
419
419
|
toggle: w.strings.toggle
|
|
420
420
|
}
|
|
421
|
-
}), /* @__PURE__ */
|
|
422
|
-
}), /* @__PURE__ */
|
|
421
|
+
}), /* @__PURE__ */ j(F, { ...T })]
|
|
422
|
+
}), /* @__PURE__ */ j(X, {
|
|
423
423
|
error: m,
|
|
424
|
-
id:
|
|
424
|
+
id: A
|
|
425
425
|
})]
|
|
426
426
|
});
|
|
427
427
|
}
|
|
428
|
-
function
|
|
429
|
-
let { id: y, searchValue: b, className: x, error: S, required: w, onBlur: T, onCreate: E } = _,
|
|
430
|
-
u && e !== B && (V(e),
|
|
431
|
-
let [H, U] =
|
|
432
|
-
H !== z && (U(z), !z && u &&
|
|
433
|
-
let
|
|
428
|
+
function ne({ selectedValues: e, onSelectedValuesChange: n, minSearchLength: r = 3, loading: i = !1, showListContent: a = !0, disabled: s = !1, closeOnSelect: l = !1, applyButton: u = !1, onApply: d, onCancel: f, open: m, onOpenChange: g, ..._ }) {
|
|
429
|
+
let { id: y, searchValue: b, className: x, error: S, required: w, onBlur: T, onCreate: E } = _, D = O(null), [A, P] = k(e), [I, L] = k(!1), R = m !== void 0, z = R ? m : I, [B, V] = k(e);
|
|
430
|
+
u && e !== B && (V(e), P(e));
|
|
431
|
+
let [H, U] = k(z);
|
|
432
|
+
H !== z && (U(z), !z && u && P(e));
|
|
433
|
+
let W = u ? A : e, { core: q, dropdown: J, root: ee, invalid: Y, errorId: te, describedBy: ne } = Z({
|
|
434
434
|
..._,
|
|
435
435
|
open: m,
|
|
436
436
|
onOpenChange: g,
|
|
@@ -438,83 +438,83 @@ function ee({ selectedValues: e, onSelectedValuesChange: n, minSearchLength: r =
|
|
|
438
438
|
loading: i,
|
|
439
439
|
showListContent: a,
|
|
440
440
|
disabled: s
|
|
441
|
-
},
|
|
441
|
+
}, W), re = q.strings.removeChip ?? o.removeChip, Q = C((e) => {
|
|
442
442
|
R || L(e), g?.(e);
|
|
443
|
-
}, [R, g]),
|
|
443
|
+
}, [R, g]), ie = C((e) => {
|
|
444
444
|
let t = [], r = null;
|
|
445
|
-
for (let n of e)
|
|
446
|
-
r === null ? u ?
|
|
445
|
+
for (let n of e) G(n) ? r = K(n) : t.push(n);
|
|
446
|
+
r === null ? u ? P(t) : n(t) : E?.(r), l && !u && Q(!1);
|
|
447
447
|
}, [
|
|
448
448
|
u,
|
|
449
449
|
l,
|
|
450
450
|
E,
|
|
451
451
|
n,
|
|
452
|
-
|
|
453
|
-
]),
|
|
454
|
-
u && n(
|
|
452
|
+
Q
|
|
453
|
+
]), ae = C(() => {
|
|
454
|
+
u && n(A), d?.(), Q(!1);
|
|
455
455
|
}, [
|
|
456
456
|
u,
|
|
457
|
-
|
|
457
|
+
A,
|
|
458
458
|
d,
|
|
459
459
|
n,
|
|
460
|
-
|
|
461
|
-
]),
|
|
462
|
-
u &&
|
|
460
|
+
Q
|
|
461
|
+
]), oe = C(() => {
|
|
462
|
+
u && P(e), f?.(), Q(!1);
|
|
463
463
|
}, [
|
|
464
464
|
u,
|
|
465
465
|
f,
|
|
466
466
|
e,
|
|
467
|
-
|
|
467
|
+
Q
|
|
468
468
|
]);
|
|
469
|
-
return /* @__PURE__ */
|
|
470
|
-
className: t("async-multi-combobox--component",
|
|
471
|
-
children: [/* @__PURE__ */
|
|
472
|
-
...
|
|
469
|
+
return /* @__PURE__ */ M("div", {
|
|
470
|
+
className: t("async-multi-combobox--component", N.root),
|
|
471
|
+
children: [/* @__PURE__ */ M(v, {
|
|
472
|
+
...ee,
|
|
473
473
|
multiple: !0,
|
|
474
|
-
value:
|
|
475
|
-
onValueChange:
|
|
474
|
+
value: W,
|
|
475
|
+
onValueChange: ie,
|
|
476
476
|
inputValue: b,
|
|
477
477
|
open: z,
|
|
478
478
|
onOpenChange: (t) => {
|
|
479
|
-
!t && u &&
|
|
479
|
+
!t && u && P(e), Q(t);
|
|
480
480
|
},
|
|
481
|
-
children: [/* @__PURE__ */
|
|
482
|
-
ref:
|
|
483
|
-
invalid:
|
|
481
|
+
children: [/* @__PURE__ */ M(c, {
|
|
482
|
+
ref: D,
|
|
483
|
+
invalid: Y,
|
|
484
484
|
className: x,
|
|
485
|
-
children: [
|
|
486
|
-
strings: { removeChip:
|
|
485
|
+
children: [W.map((e) => /* @__PURE__ */ j(p, {
|
|
486
|
+
strings: { removeChip: re },
|
|
487
487
|
children: q.itemToStringLabel(e)
|
|
488
|
-
}, q.getKey(e))), /* @__PURE__ */
|
|
488
|
+
}, q.getKey(e))), /* @__PURE__ */ j(h, {
|
|
489
489
|
id: y,
|
|
490
|
-
placeholder:
|
|
491
|
-
"aria-invalid":
|
|
492
|
-
"aria-describedby":
|
|
490
|
+
placeholder: W.length > 0 ? void 0 : q.strings.placeholder,
|
|
491
|
+
"aria-invalid": Y || void 0,
|
|
492
|
+
"aria-describedby": ne,
|
|
493
493
|
"aria-required": w,
|
|
494
494
|
onBlur: T
|
|
495
495
|
})]
|
|
496
|
-
}), /* @__PURE__ */
|
|
496
|
+
}), /* @__PURE__ */ j(F, {
|
|
497
497
|
...J,
|
|
498
|
-
anchor:
|
|
498
|
+
anchor: D,
|
|
499
499
|
applyFooter: a && u ? {
|
|
500
500
|
applyLabel: q.strings.apply,
|
|
501
501
|
cancelLabel: q.strings.cancel,
|
|
502
|
-
onApply:
|
|
503
|
-
onCancel:
|
|
502
|
+
onApply: ae,
|
|
503
|
+
onCancel: oe
|
|
504
504
|
} : void 0
|
|
505
505
|
})]
|
|
506
|
-
}), /* @__PURE__ */
|
|
506
|
+
}), /* @__PURE__ */ j(X, {
|
|
507
507
|
error: S,
|
|
508
|
-
id:
|
|
508
|
+
id: te
|
|
509
509
|
})]
|
|
510
510
|
});
|
|
511
511
|
}
|
|
512
512
|
//#endregion
|
|
513
513
|
//#region src/components/features/combobox/use-suggestions.ts
|
|
514
|
-
function
|
|
514
|
+
function re(e) {
|
|
515
515
|
return !!(e && e.name === "AbortError");
|
|
516
516
|
}
|
|
517
|
-
function
|
|
517
|
+
function Q(e, t) {
|
|
518
518
|
return new Promise((n, r) => {
|
|
519
519
|
if (t.aborted) {
|
|
520
520
|
r(new DOMException("Aborted", "AbortError"));
|
|
@@ -526,77 +526,88 @@ function ne(e, t) {
|
|
|
526
526
|
});
|
|
527
527
|
});
|
|
528
528
|
}
|
|
529
|
-
var
|
|
530
|
-
function
|
|
531
|
-
let { fetchData: t,
|
|
529
|
+
var ie = [];
|
|
530
|
+
function ae(e) {
|
|
531
|
+
let { fetchData: t, scopeKey: n, minQueryLength: r = 1, debounceMs: i = 300, requestDelay: a = 0, preload: o = !1, query: s, defaultQuery: c = "", onQueryChange: l, value: u, defaultValue: d = null, onValueChange: f, open: p, defaultOpen: m = !1, onOpenChange: h, onError: g } = e, [_, v] = k({ key: n });
|
|
532
|
+
Object.is(_.key, n) || v({ key: n });
|
|
533
|
+
let [y, x] = k(null), [S, T] = k(null), [D, A] = k(null), j = O(_), M = O(null);
|
|
534
|
+
E(() => () => {
|
|
535
|
+
M.current?.abort();
|
|
536
|
+
}, [_]);
|
|
537
|
+
let [N, P] = k(c), [F, I] = k(d), [L, R] = k(m), [z, B] = k(0), V = O(!1), H = O(t), U = O(g);
|
|
532
538
|
w(() => {
|
|
533
|
-
|
|
539
|
+
H.current = t, U.current = g;
|
|
534
540
|
});
|
|
535
|
-
let
|
|
536
|
-
|
|
537
|
-
}, [
|
|
538
|
-
|
|
539
|
-
}, [
|
|
540
|
-
|
|
541
|
-
}, [
|
|
542
|
-
|
|
543
|
-
}, []),
|
|
541
|
+
let W = s ?? N, G = u === void 0 ? F : u, K = p ?? L, q = C((e) => {
|
|
542
|
+
s === void 0 && P(e), l?.(e);
|
|
543
|
+
}, [s, l]), J = C((e) => {
|
|
544
|
+
u === void 0 && I(e), f?.(e);
|
|
545
|
+
}, [u, f]), ee = C((e) => {
|
|
546
|
+
p === void 0 && R(e), h?.(e);
|
|
547
|
+
}, [p, h]), Y = C(() => {
|
|
548
|
+
V.current = !0, B((e) => e + 1);
|
|
549
|
+
}, []), X = W.trim().length, Z = X >= r || o && X === 0, te = y?.scope === _ && y.query === W || S?.scope === _ && S.query === W, ne = Z && y?.scope === _ ? y.items : ie, ae = Z && (D === _ || !te), oe = Z && S?.scope === _ && S.query === W ? S.error : null, $ = b((e, t, n, r) => {
|
|
544
550
|
(async () => {
|
|
545
|
-
|
|
551
|
+
A(r), T(null);
|
|
546
552
|
try {
|
|
547
|
-
if (t > 0 && await
|
|
548
|
-
let
|
|
549
|
-
n.aborted ||
|
|
553
|
+
if (t > 0 && await Q(t, n), n.aborted) return;
|
|
554
|
+
let i = await H.current(e, { signal: n });
|
|
555
|
+
n.aborted || x({
|
|
556
|
+
scope: r,
|
|
550
557
|
query: e,
|
|
551
|
-
items: Array.isArray(
|
|
558
|
+
items: Array.isArray(i) ? i : []
|
|
552
559
|
});
|
|
553
560
|
} catch (t) {
|
|
554
|
-
if (n.aborted ||
|
|
555
|
-
|
|
561
|
+
if (n.aborted || re(t)) return;
|
|
562
|
+
x({
|
|
563
|
+
scope: r,
|
|
556
564
|
query: e,
|
|
557
565
|
items: []
|
|
558
|
-
}),
|
|
566
|
+
}), T({
|
|
567
|
+
scope: r,
|
|
559
568
|
query: e,
|
|
560
569
|
error: t
|
|
561
|
-
}),
|
|
570
|
+
}), U.current?.(t, e);
|
|
562
571
|
} finally {
|
|
563
|
-
n.aborted ||
|
|
572
|
+
n.aborted || A(null);
|
|
564
573
|
}
|
|
565
574
|
})();
|
|
566
|
-
},
|
|
575
|
+
}, i);
|
|
567
576
|
return w(() => {
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
577
|
+
let e = j.current !== _;
|
|
578
|
+
if (j.current = _, !Z) return;
|
|
579
|
+
let t = new AbortController();
|
|
580
|
+
return M.current = t, $(W, a, t.signal, _), (e || V.current || W.trim() === "") && $.flush(), V.current = !1, () => {
|
|
581
|
+
$.cancel(), t.abort();
|
|
572
582
|
};
|
|
573
583
|
}, [
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
584
|
+
W,
|
|
585
|
+
a,
|
|
586
|
+
z,
|
|
587
|
+
$,
|
|
577
588
|
Z,
|
|
578
|
-
|
|
589
|
+
_
|
|
579
590
|
]), {
|
|
580
|
-
items:
|
|
581
|
-
isLoading:
|
|
582
|
-
error:
|
|
583
|
-
isError:
|
|
584
|
-
retry:
|
|
585
|
-
query:
|
|
586
|
-
setQuery:
|
|
587
|
-
value:
|
|
588
|
-
setValue:
|
|
589
|
-
open:
|
|
590
|
-
setOpen:
|
|
591
|
+
items: ne,
|
|
592
|
+
isLoading: ae,
|
|
593
|
+
error: oe,
|
|
594
|
+
isError: oe !== null,
|
|
595
|
+
retry: Y,
|
|
596
|
+
query: W,
|
|
597
|
+
setQuery: q,
|
|
598
|
+
value: G,
|
|
599
|
+
setValue: J,
|
|
600
|
+
open: K,
|
|
601
|
+
setOpen: ee
|
|
591
602
|
};
|
|
592
603
|
}
|
|
593
604
|
//#endregion
|
|
594
605
|
//#region src/components/features/combobox/fetching-combobox.tsx
|
|
595
|
-
function
|
|
606
|
+
function oe(e) {
|
|
596
607
|
return typeof e == "string" || typeof e == "number";
|
|
597
608
|
}
|
|
598
|
-
function
|
|
599
|
-
return
|
|
609
|
+
function $({ children: t }) {
|
|
610
|
+
return oe(t) ? /* @__PURE__ */ j(e, {
|
|
600
611
|
tag: "span",
|
|
601
612
|
size: "xs",
|
|
602
613
|
type: "secondary",
|
|
@@ -604,110 +615,111 @@ function ae({ children: t }) {
|
|
|
604
615
|
children: t
|
|
605
616
|
}) : t;
|
|
606
617
|
}
|
|
607
|
-
function
|
|
608
|
-
let
|
|
609
|
-
...
|
|
610
|
-
...
|
|
611
|
-
},
|
|
618
|
+
function se({ hook: n, slot: i, fetchData: a, onError: o, preload: s, scopeKey: c, requestDelay: l, minSearchLength: u = 0, debounceMs: d, searchValue: f, defaultSearchValue: p, onSearchValueChange: m, value: h, defaultValue: g, onValueChange: _, open: v, defaultOpen: y, onOpenChange: b, clearSearchOnClose: x = !1, getItemLabel: S, getItemKey: w, getDescription: T, getMeta: E, renderOption: D, highlightMatch: O, errorTitle: k, renderError: A, strings: P, disabled: F = !1, className: L, ...R }) {
|
|
619
|
+
let B = {
|
|
620
|
+
...I,
|
|
621
|
+
...P
|
|
622
|
+
}, V = w ?? S, H = ae({
|
|
623
|
+
scopeKey: c,
|
|
612
624
|
fetchData: (e, t) => a(e.trim(), t ?? {}),
|
|
613
625
|
onError: (e, t) => o?.(e, t.trim()),
|
|
614
|
-
minQueryLength:
|
|
615
|
-
preload: s && !
|
|
616
|
-
debounceMs:
|
|
617
|
-
requestDelay:
|
|
618
|
-
query:
|
|
619
|
-
defaultQuery:
|
|
620
|
-
onQueryChange:
|
|
621
|
-
value:
|
|
622
|
-
defaultValue:
|
|
623
|
-
onValueChange:
|
|
624
|
-
open:
|
|
625
|
-
defaultOpen:
|
|
626
|
-
onOpenChange:
|
|
627
|
-
}),
|
|
628
|
-
|
|
626
|
+
minQueryLength: F ? Infinity : Math.max(1, u),
|
|
627
|
+
preload: s && !F,
|
|
628
|
+
debounceMs: d,
|
|
629
|
+
requestDelay: l,
|
|
630
|
+
query: f,
|
|
631
|
+
defaultQuery: p,
|
|
632
|
+
onQueryChange: m,
|
|
633
|
+
value: h,
|
|
634
|
+
defaultValue: g,
|
|
635
|
+
onValueChange: _,
|
|
636
|
+
open: v,
|
|
637
|
+
defaultOpen: y,
|
|
638
|
+
onOpenChange: b
|
|
639
|
+
}), U = H.query.trim(), W = H.isError, { setOpen: G, setQuery: K, retry: q } = H, J = U === "" ? s && !F ? 0 : Math.max(1, u) : u, ee = C((e) => {
|
|
640
|
+
G(e), !e && x && !W && K("");
|
|
629
641
|
}, [
|
|
630
|
-
|
|
631
|
-
U,
|
|
642
|
+
x,
|
|
632
643
|
W,
|
|
633
|
-
G
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
644
|
+
G,
|
|
645
|
+
K
|
|
646
|
+
]), Y = H.value ? V(H.value) : null, X = C((t) => {
|
|
647
|
+
if (D) return D(t, {
|
|
648
|
+
query: U,
|
|
649
|
+
isSelected: Y !== null && V(t) === Y
|
|
638
650
|
});
|
|
639
|
-
let n =
|
|
640
|
-
return /* @__PURE__ */
|
|
641
|
-
className:
|
|
642
|
-
children: [/* @__PURE__ */
|
|
651
|
+
let n = S(t), r = T?.(t), i = E?.(t), a = !!r || !!i;
|
|
652
|
+
return /* @__PURE__ */ M("span", {
|
|
653
|
+
className: N.option,
|
|
654
|
+
children: [/* @__PURE__ */ j(e, {
|
|
643
655
|
tag: "span",
|
|
644
656
|
size: "inherit",
|
|
645
657
|
type: "inherit",
|
|
646
658
|
weight: a ? "medium" : void 0,
|
|
647
659
|
lineHeight: "tight",
|
|
648
660
|
truncate: !0,
|
|
649
|
-
children:
|
|
661
|
+
children: O && U ? /* @__PURE__ */ j(z, {
|
|
650
662
|
text: n,
|
|
651
|
-
highlight:
|
|
663
|
+
highlight: U
|
|
652
664
|
}) : n
|
|
653
|
-
}), a && /* @__PURE__ */
|
|
654
|
-
className:
|
|
655
|
-
children: [!!r && /* @__PURE__ */
|
|
665
|
+
}), a && /* @__PURE__ */ M("span", {
|
|
666
|
+
className: N.optionMeta,
|
|
667
|
+
children: [!!r && /* @__PURE__ */ j($, { children: r }), !!i && /* @__PURE__ */ j($, { children: i })]
|
|
656
668
|
})]
|
|
657
669
|
});
|
|
658
670
|
}, [
|
|
659
|
-
w,
|
|
660
|
-
x,
|
|
661
|
-
B,
|
|
662
671
|
T,
|
|
663
|
-
|
|
664
|
-
|
|
672
|
+
S,
|
|
673
|
+
V,
|
|
665
674
|
E,
|
|
675
|
+
O,
|
|
676
|
+
U,
|
|
677
|
+
D,
|
|
666
678
|
Y
|
|
667
|
-
]), Z =
|
|
668
|
-
error:
|
|
669
|
-
query:
|
|
670
|
-
retry:
|
|
671
|
-
}) ?? /* @__PURE__ */
|
|
672
|
-
title:
|
|
673
|
-
onRetry:
|
|
674
|
-
strings: { retry:
|
|
675
|
-
className:
|
|
679
|
+
]), Z = W ? A?.({
|
|
680
|
+
error: H.error,
|
|
681
|
+
query: U,
|
|
682
|
+
retry: q
|
|
683
|
+
}) ?? /* @__PURE__ */ j(r, {
|
|
684
|
+
title: k ?? B.errorTitle,
|
|
685
|
+
onRetry: q,
|
|
686
|
+
strings: { retry: B.retry },
|
|
687
|
+
className: N.errorState
|
|
676
688
|
}) : null;
|
|
677
|
-
return /* @__PURE__ */
|
|
689
|
+
return /* @__PURE__ */ M("div", {
|
|
678
690
|
"data-slot": i,
|
|
679
|
-
className: t(n,
|
|
680
|
-
children: [/* @__PURE__ */
|
|
681
|
-
...
|
|
682
|
-
disabled:
|
|
683
|
-
items:
|
|
684
|
-
selectedValue:
|
|
685
|
-
onSelectedValueChange:
|
|
691
|
+
className: t(n, L),
|
|
692
|
+
children: [/* @__PURE__ */ j(te, {
|
|
693
|
+
...R,
|
|
694
|
+
disabled: F,
|
|
695
|
+
items: H.items,
|
|
696
|
+
selectedValue: H.value,
|
|
697
|
+
onSelectedValueChange: H.setValue,
|
|
686
698
|
clearSearchOnClose: !1,
|
|
687
|
-
searchValue:
|
|
688
|
-
onSearchValueChange:
|
|
689
|
-
getItemLabel:
|
|
690
|
-
getItemKey:
|
|
691
|
-
loading: !
|
|
692
|
-
showListContent: !
|
|
693
|
-
minSearchLength:
|
|
694
|
-
debounceMs:
|
|
695
|
-
strings:
|
|
699
|
+
searchValue: H.query,
|
|
700
|
+
onSearchValueChange: K,
|
|
701
|
+
getItemLabel: S,
|
|
702
|
+
getItemKey: w,
|
|
703
|
+
loading: !W && H.isLoading,
|
|
704
|
+
showListContent: !W,
|
|
705
|
+
minSearchLength: J,
|
|
706
|
+
debounceMs: d,
|
|
707
|
+
strings: P,
|
|
696
708
|
renderItem: X,
|
|
697
|
-
open:
|
|
698
|
-
onOpenChange:
|
|
709
|
+
open: H.open,
|
|
710
|
+
onOpenChange: ee
|
|
699
711
|
}), Z]
|
|
700
712
|
});
|
|
701
713
|
}
|
|
702
714
|
//#endregion
|
|
703
715
|
//#region src/components/features/combobox/resource-combobox.tsx
|
|
704
|
-
function
|
|
716
|
+
function ce({ fetcher: e, onAfterFetch: t, onError: n, getKey: r, getLabel: i, limit: a = 10, debounceMs: o = 300, preload: s = !0, minSearchLength: c = 0, defaultValue: l = null, errorMessage: u, ...d }) {
|
|
705
717
|
let f = (e, t) => ({
|
|
706
718
|
query: e,
|
|
707
719
|
limit: a,
|
|
708
720
|
signal: t
|
|
709
721
|
});
|
|
710
|
-
return /* @__PURE__ */
|
|
722
|
+
return /* @__PURE__ */ j(se, {
|
|
711
723
|
...d,
|
|
712
724
|
hook: "resource-combobox--component",
|
|
713
725
|
slot: "resource-combobox",
|
|
@@ -727,12 +739,12 @@ function se({ fetcher: e, onAfterFetch: t, onError: n, getKey: r, getLabel: i, l
|
|
|
727
739
|
}
|
|
728
740
|
//#endregion
|
|
729
741
|
//#region src/components/features/combobox/suggestions-combobox.tsx
|
|
730
|
-
function
|
|
742
|
+
function le({ fetchData: e, itemKey: t, itemText: n, renderItem: r, minQueryLength: i = 1, preload: a = !1, query: o, defaultQuery: s, onQueryChange: c, allowClear: l = !0, clearInputOnClose: u = !1, disabled: d = !1, strings: f, ...p }) {
|
|
731
743
|
let m = {
|
|
732
|
-
...
|
|
744
|
+
...L,
|
|
733
745
|
...f
|
|
734
|
-
}, h = f?.formatTypeMore ?? (f?.startTypingMessage === void 0 ?
|
|
735
|
-
return /* @__PURE__ */
|
|
746
|
+
}, h = f?.formatTypeMore ?? (f?.startTypingMessage === void 0 ? I.formatTypeMore : () => m.startTypingMessage);
|
|
747
|
+
return /* @__PURE__ */ j(se, {
|
|
736
748
|
...p,
|
|
737
749
|
hook: "suggestions-combobox--component",
|
|
738
750
|
slot: "suggestions",
|
|
@@ -760,4 +772,4 @@ function ce({ fetchData: e, itemKey: t, itemText: n, renderItem: r, minQueryLeng
|
|
|
760
772
|
});
|
|
761
773
|
}
|
|
762
774
|
//#endregion
|
|
763
|
-
export {
|
|
775
|
+
export { te as AsyncCombobox, ne as AsyncMultiCombobox, F as ComboboxDropdown, B as DEFAULT_MIN_SEARCH_LENGTH, z as HighlightedText, ce as ResourceCombobox, le as SuggestionsCombobox, I as defaultAsyncComboboxStrings, L as defaultSuggestionsStrings, Y as useComboboxCore, ae as useSuggestions };
|