@bysages/react 0.2.2 → 0.2.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/dist/ai-response-jZy-0Tvv.mjs +127 -0
- package/dist/chevron-BeHvt46K.mjs +17 -0
- package/dist/components/accordion/index.d.mts +7 -0
- package/dist/components/accordion/index.mjs +10 -0
- package/dist/components/affix/index.d.mts +20 -0
- package/dist/components/affix/index.mjs +18 -0
- package/dist/components/ai/index.d.mts +2 -0
- package/dist/components/ai/index.mjs +65 -0
- package/dist/components/ai-action/index.d.mts +14 -0
- package/dist/components/ai-action/index.mjs +18 -0
- package/dist/components/ai-attachments/index.d.mts +19 -0
- package/dist/components/ai-attachments/index.mjs +106 -0
- package/dist/components/ai-message/index.d.mts +11 -0
- package/dist/components/ai-message/index.mjs +15 -0
- package/dist/components/ai-prompt-input/index.d.mts +47 -0
- package/dist/components/ai-prompt-input/index.mjs +135 -0
- package/dist/components/ai-reasoning/index.d.mts +13 -0
- package/dist/components/ai-reasoning/index.mjs +19 -0
- package/dist/components/ai-response/index.d.mts +22 -0
- package/dist/components/ai-response/index.mjs +2 -0
- package/dist/components/ai-source/index.d.mts +17 -0
- package/dist/components/ai-source/index.mjs +27 -0
- package/dist/components/ai-suggestion/index.d.mts +13 -0
- package/dist/components/ai-suggestion/index.mjs +16 -0
- package/dist/components/ai-tool/index.d.mts +21 -0
- package/dist/components/ai-tool/index.mjs +36 -0
- package/dist/components/alert/index.d.mts +23 -0
- package/dist/components/alert/index.mjs +80 -0
- package/dist/components/angle-slider/index.d.mts +16 -0
- package/dist/components/angle-slider/index.mjs +21 -0
- package/dist/components/aspect-ratio/index.d.mts +10 -0
- package/dist/components/aspect-ratio/index.mjs +17 -0
- package/dist/components/autocomplete/index.d.mts +21 -0
- package/dist/components/autocomplete/index.mjs +35 -0
- package/dist/components/avatar/index.d.mts +20 -0
- package/dist/components/avatar/index.mjs +14 -0
- package/dist/components/avatar-group/index.d.mts +11 -0
- package/dist/components/avatar-group/index.mjs +15 -0
- package/dist/components/back-top/index.d.mts +29 -0
- package/dist/components/back-top/index.mjs +82 -0
- package/dist/components/badge/index.d.mts +10 -0
- package/dist/components/badge/index.mjs +15 -0
- package/dist/components/banner/index.d.mts +31 -0
- package/dist/components/banner/index.mjs +63 -0
- package/dist/components/breadcrumb/index.d.mts +32 -0
- package/dist/components/breadcrumb/index.mjs +35 -0
- package/dist/components/button/index.d.mts +19 -0
- package/dist/components/button/index.mjs +29 -0
- package/dist/components/button-group/index.d.mts +24 -0
- package/dist/components/button-group/index.mjs +25 -0
- package/dist/components/calendar/index.d.mts +17 -0
- package/dist/components/calendar/index.mjs +96 -0
- package/dist/components/card/index.d.mts +46 -0
- package/dist/components/card/index.mjs +44 -0
- package/dist/components/carousel/index.d.mts +9 -0
- package/dist/components/carousel/index.mjs +12 -0
- package/dist/components/cascade-select/index.d.mts +31 -0
- package/dist/components/cascade-select/index.mjs +223 -0
- package/dist/components/checkbox/index.d.mts +16 -0
- package/dist/components/checkbox/index.mjs +21 -0
- package/dist/components/checkbox-group/index.d.mts +28 -0
- package/dist/components/checkbox-group/index.mjs +65 -0
- package/dist/components/chip/index.d.mts +12 -0
- package/dist/components/chip/index.mjs +17 -0
- package/dist/components/client-only/index.d.mts +2 -0
- package/dist/components/client-only/index.mjs +2 -0
- package/dist/components/clipboard/index.d.mts +17 -0
- package/dist/components/clipboard/index.mjs +17 -0
- package/dist/components/collapsible/index.d.mts +7 -0
- package/dist/components/collapsible/index.mjs +10 -0
- package/dist/components/collection/index.d.mts +2 -0
- package/dist/components/collection/index.mjs +2 -0
- package/dist/components/color-picker/index.d.mts +20 -0
- package/dist/components/color-picker/index.mjs +25 -0
- package/dist/components/combobox/index.d.mts +17 -0
- package/dist/components/combobox/index.mjs +18 -0
- package/dist/components/command/index.d.mts +43 -0
- package/dist/components/command/index.mjs +137 -0
- package/dist/components/comment/index.d.mts +17 -0
- package/dist/components/comment/index.mjs +47 -0
- package/dist/components/config-provider/index.d.mts +46 -0
- package/dist/components/config-provider/index.mjs +41 -0
- package/dist/components/container/index.d.mts +13 -0
- package/dist/components/container/index.mjs +15 -0
- package/dist/components/date-input/index.d.mts +17 -0
- package/dist/components/date-input/index.mjs +21 -0
- package/dist/components/date-picker/index.d.mts +19 -0
- package/dist/components/date-picker/index.mjs +23 -0
- package/dist/components/descriptions/index.d.mts +25 -0
- package/dist/components/descriptions/index.mjs +32 -0
- package/dist/components/dialog/index.d.mts +9 -0
- package/dist/components/dialog/index.mjs +11 -0
- package/dist/components/download-trigger/index.d.mts +2 -0
- package/dist/components/download-trigger/index.mjs +2 -0
- package/dist/components/drawer/index.d.mts +9 -0
- package/dist/components/drawer/index.mjs +12 -0
- package/dist/components/dynamic-input/index.d.mts +28 -0
- package/dist/components/dynamic-input/index.mjs +83 -0
- package/dist/components/editable/index.d.mts +16 -0
- package/dist/components/editable/index.mjs +17 -0
- package/dist/components/ellipsis/index.d.mts +10 -0
- package/dist/components/ellipsis/index.mjs +19 -0
- package/dist/components/empty/index.d.mts +28 -0
- package/dist/components/empty/index.mjs +32 -0
- package/dist/components/field/index.d.mts +8 -0
- package/dist/components/field/index.mjs +11 -0
- package/dist/components/fieldset/index.d.mts +7 -0
- package/dist/components/fieldset/index.mjs +10 -0
- package/dist/components/file-upload/index.d.mts +18 -0
- package/dist/components/file-upload/index.mjs +23 -0
- package/dist/components/float-button/index.d.mts +59 -0
- package/dist/components/float-button/index.mjs +90 -0
- package/dist/components/floating-panel/index.d.mts +9 -0
- package/dist/components/floating-panel/index.mjs +12 -0
- package/dist/components/focus-trap/index.d.mts +2 -0
- package/dist/components/focus-trap/index.mjs +2 -0
- package/dist/components/form/index.d.mts +2 -0
- package/dist/components/form/index.mjs +67 -0
- package/dist/components/format/index.d.mts +9 -0
- package/dist/components/format/index.mjs +10 -0
- package/dist/components/frame/index.d.mts +10 -0
- package/dist/components/frame/index.mjs +12 -0
- package/dist/components/grid/index.d.mts +13 -0
- package/dist/components/grid/index.mjs +31 -0
- package/dist/components/highlight/index.d.mts +7 -0
- package/dist/components/highlight/index.mjs +11 -0
- package/dist/components/hover-card/index.d.mts +7 -0
- package/dist/components/hover-card/index.mjs +10 -0
- package/dist/components/icon/index.d.mts +19 -0
- package/dist/components/icon/index.mjs +26 -0
- package/dist/components/image/index.d.mts +17 -0
- package/dist/components/image/index.mjs +57 -0
- package/dist/components/image-cropper/index.d.mts +8 -0
- package/dist/components/image-cropper/index.mjs +11 -0
- package/dist/components/image-viewer/index.d.mts +18 -0
- package/dist/components/image-viewer/index.mjs +110 -0
- package/dist/components/input/index.d.mts +16 -0
- package/dist/components/input/index.mjs +21 -0
- package/dist/components/input-group/index.d.mts +17 -0
- package/dist/components/input-group/index.mjs +31 -0
- package/dist/components/json-tree-view/index.d.mts +7 -0
- package/dist/components/json-tree-view/index.mjs +10 -0
- package/dist/components/kbd/index.d.mts +6 -0
- package/dist/components/kbd/index.mjs +14 -0
- package/dist/components/layout/index.d.mts +63 -0
- package/dist/components/layout/index.mjs +133 -0
- package/dist/components/link/index.d.mts +10 -0
- package/dist/components/link/index.mjs +18 -0
- package/dist/components/list/index.d.mts +39 -0
- package/dist/components/list/index.mjs +66 -0
- package/dist/components/listbox/index.d.mts +18 -0
- package/dist/components/listbox/index.mjs +18 -0
- package/dist/components/marquee/index.d.mts +7 -0
- package/dist/components/marquee/index.mjs +10 -0
- package/dist/components/masonry/index.d.mts +11 -0
- package/dist/components/masonry/index.mjs +29 -0
- package/dist/components/mentions/index.d.mts +2 -0
- package/dist/components/mentions/index.mjs +2 -0
- package/dist/components/menu/index.d.mts +20 -0
- package/dist/components/menu/index.mjs +37 -0
- package/dist/components/menubar/index.d.mts +32 -0
- package/dist/components/menubar/index.mjs +35 -0
- package/dist/components/meter/index.d.mts +26 -0
- package/dist/components/meter/index.mjs +59 -0
- package/dist/components/navigation-menu/index.d.mts +8 -0
- package/dist/components/navigation-menu/index.mjs +11 -0
- package/dist/components/number-input/index.d.mts +16 -0
- package/dist/components/number-input/index.mjs +21 -0
- package/dist/components/page-header/index.d.mts +32 -0
- package/dist/components/page-header/index.mjs +34 -0
- package/dist/components/pagination/index.d.mts +18 -0
- package/dist/components/pagination/index.mjs +23 -0
- package/dist/components/password-input/index.d.mts +16 -0
- package/dist/components/password-input/index.mjs +21 -0
- package/dist/components/pin-input/index.d.mts +15 -0
- package/dist/components/pin-input/index.mjs +20 -0
- package/dist/components/popconfirm/index.d.mts +20 -0
- package/dist/components/popconfirm/index.mjs +44 -0
- package/dist/components/popover/index.d.mts +8 -0
- package/dist/components/popover/index.mjs +11 -0
- package/dist/components/presence/index.d.mts +2 -0
- package/dist/components/presence/index.mjs +2 -0
- package/dist/components/progress/index.d.mts +16 -0
- package/dist/components/progress/index.mjs +21 -0
- package/dist/components/progress-group/index.d.mts +22 -0
- package/dist/components/progress-group/index.mjs +56 -0
- package/dist/components/qr-code/index.d.mts +8 -0
- package/dist/components/qr-code/index.mjs +11 -0
- package/dist/components/radio-group/index.d.mts +16 -0
- package/dist/components/radio-group/index.mjs +21 -0
- package/dist/components/rating-group/index.d.mts +16 -0
- package/dist/components/rating-group/index.mjs +21 -0
- package/dist/components/scroll-area/index.d.mts +7 -0
- package/dist/components/scroll-area/index.mjs +10 -0
- package/dist/components/segment-group/index.d.mts +18 -0
- package/dist/components/segment-group/index.mjs +20 -0
- package/dist/components/select/index.d.mts +17 -0
- package/dist/components/select/index.mjs +18 -0
- package/dist/components/separator/index.d.mts +11 -0
- package/dist/components/separator/index.mjs +16 -0
- package/dist/components/signature-pad/index.d.mts +8 -0
- package/dist/components/signature-pad/index.mjs +11 -0
- package/dist/components/skeleton/index.d.mts +7 -0
- package/dist/components/skeleton/index.mjs +13 -0
- package/dist/components/slider/index.d.mts +16 -0
- package/dist/components/slider/index.mjs +21 -0
- package/dist/components/spinner/index.d.mts +9 -0
- package/dist/components/spinner/index.mjs +36 -0
- package/dist/components/split-button/index.d.mts +36 -0
- package/dist/components/split-button/index.mjs +71 -0
- package/dist/components/splitter/index.d.mts +7 -0
- package/dist/components/splitter/index.mjs +10 -0
- package/dist/components/stack/index.d.mts +11 -0
- package/dist/components/stack/index.mjs +32 -0
- package/dist/components/stat/index.d.mts +29 -0
- package/dist/components/stat/index.mjs +37 -0
- package/dist/components/steps/index.d.mts +19 -0
- package/dist/components/steps/index.mjs +24 -0
- package/dist/components/swap/index.d.mts +8 -0
- package/dist/components/swap/index.mjs +11 -0
- package/dist/components/switch/index.d.mts +16 -0
- package/dist/components/switch/index.mjs +21 -0
- package/dist/components/table/index.d.mts +79 -0
- package/dist/components/table/index.mjs +688 -0
- package/dist/components/tabs/index.d.mts +18 -0
- package/dist/components/tabs/index.mjs +23 -0
- package/dist/components/tags-input/index.d.mts +17 -0
- package/dist/components/tags-input/index.mjs +22 -0
- package/dist/components/textarea/index.d.mts +14 -0
- package/dist/components/textarea/index.mjs +20 -0
- package/dist/components/timeline/index.d.mts +24 -0
- package/dist/components/timeline/index.mjs +30 -0
- package/dist/components/timer/index.d.mts +8 -0
- package/dist/components/timer/index.mjs +11 -0
- package/dist/components/toast/index.d.mts +11 -0
- package/dist/components/toast/index.mjs +13 -0
- package/dist/components/toc/index.d.mts +7 -0
- package/dist/components/toc/index.mjs +10 -0
- package/dist/components/toggle/index.d.mts +7 -0
- package/dist/components/toggle/index.mjs +10 -0
- package/dist/components/toggle-group/index.d.mts +15 -0
- package/dist/components/toggle-group/index.mjs +20 -0
- package/dist/components/tooltip/index.d.mts +7 -0
- package/dist/components/tooltip/index.mjs +10 -0
- package/dist/components/tour/index.d.mts +11 -0
- package/dist/components/tour/index.mjs +13 -0
- package/dist/components/transfer/index.d.mts +23 -0
- package/dist/components/transfer/index.mjs +154 -0
- package/dist/components/tree-select/index.d.mts +28 -0
- package/dist/components/tree-select/index.mjs +157 -0
- package/dist/components/tree-view/index.d.mts +19 -0
- package/dist/components/tree-view/index.mjs +18 -0
- package/dist/components/typography/index.d.mts +32 -0
- package/dist/components/typography/index.mjs +34 -0
- package/dist/components/watermark/index.d.mts +16 -0
- package/dist/components/watermark/index.mjs +80 -0
- package/dist/index-DaAbbSz9.d.mts +13416 -0
- package/dist/index-Uefyw7Im.d.mts +108 -0
- package/dist/index-uPyYiWaL.d.mts +1813 -0
- package/dist/index.d.mts +128 -15446
- package/dist/index.mjs +128 -4871
- package/dist/mentions-DMIBCBOd.mjs +181 -0
- package/package.json +77 -4
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import { Input } from "../input/index.mjs";
|
|
2
|
+
import { injectComponentStyle } from "@bysages/core";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { useId, useMemo, useState } from "react";
|
|
5
|
+
import { Portal } from "@ark-ui/react/portal";
|
|
6
|
+
import { useEnvironmentContext } from "@ark-ui/react/environment";
|
|
7
|
+
import { useFilter, useLocaleContext } from "@ark-ui/react/locale";
|
|
8
|
+
import * as cascade from "@zag-js/cascade-select";
|
|
9
|
+
import { normalizeProps, useMachine } from "@zag-js/react";
|
|
10
|
+
//#region src/components/cascade-select/index.tsx
|
|
11
|
+
const chevronDown = /* @__PURE__ */ jsx("svg", {
|
|
12
|
+
viewBox: "0 0 24 24",
|
|
13
|
+
fill: "none",
|
|
14
|
+
stroke: "currentColor",
|
|
15
|
+
strokeWidth: 2,
|
|
16
|
+
strokeLinecap: "round",
|
|
17
|
+
strokeLinejoin: "round",
|
|
18
|
+
"aria-hidden": "true",
|
|
19
|
+
children: /* @__PURE__ */ jsx("path", { d: "m6 9 6 6 6-6" })
|
|
20
|
+
});
|
|
21
|
+
const chevronRight = /* @__PURE__ */ jsx("svg", {
|
|
22
|
+
viewBox: "0 0 24 24",
|
|
23
|
+
fill: "none",
|
|
24
|
+
stroke: "currentColor",
|
|
25
|
+
strokeWidth: 2,
|
|
26
|
+
strokeLinecap: "round",
|
|
27
|
+
strokeLinejoin: "round",
|
|
28
|
+
"aria-hidden": "true",
|
|
29
|
+
children: /* @__PURE__ */ jsx("path", { d: "m9 18 6-6-6-6" })
|
|
30
|
+
});
|
|
31
|
+
const checkGlyph = /* @__PURE__ */ jsx("svg", {
|
|
32
|
+
viewBox: "0 0 24 24",
|
|
33
|
+
fill: "none",
|
|
34
|
+
stroke: "currentColor",
|
|
35
|
+
strokeWidth: 3,
|
|
36
|
+
strokeLinecap: "round",
|
|
37
|
+
strokeLinejoin: "round",
|
|
38
|
+
"aria-hidden": "true",
|
|
39
|
+
children: /* @__PURE__ */ jsx("path", { d: "m5 12.5 5 5L19 7" })
|
|
40
|
+
});
|
|
41
|
+
function CascadeSelect({ value, data, placeholder = "Select…", highlightTrigger, filterable = false, multiple = false, disabled = false, size = "md", onValueChange, ...rest }) {
|
|
42
|
+
injectComponentStyle("cascade-select");
|
|
43
|
+
const id = useId();
|
|
44
|
+
const locale = useLocaleContext();
|
|
45
|
+
const env = useEnvironmentContext();
|
|
46
|
+
const collection = cascade.collection({
|
|
47
|
+
nodeToValue: (node) => node.value,
|
|
48
|
+
nodeToString: (node) => node.label,
|
|
49
|
+
nodeToChildren: (node) => node.children ?? [],
|
|
50
|
+
rootNode: {
|
|
51
|
+
value: "ROOT",
|
|
52
|
+
label: "",
|
|
53
|
+
children: data
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
const service = useMachine(cascade.machine, {
|
|
57
|
+
id,
|
|
58
|
+
collection,
|
|
59
|
+
dir: locale.dir,
|
|
60
|
+
getRootNode: env.getRootNode.bind(env),
|
|
61
|
+
disabled: disabled || void 0,
|
|
62
|
+
multiple: multiple || void 0,
|
|
63
|
+
...value !== void 0 ? { value } : {},
|
|
64
|
+
...highlightTrigger != null ? { highlightTrigger } : {},
|
|
65
|
+
onValueChange(details) {
|
|
66
|
+
onValueChange?.(details.value);
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
const api = cascade.connect(service, normalizeProps);
|
|
70
|
+
const [query, setQuery] = useState("");
|
|
71
|
+
const filterFns = useFilter({ sensitivity: "base" });
|
|
72
|
+
const filtering = filterable && query.trim().length > 0;
|
|
73
|
+
/** The corridor's answer to a query: every leaf whose route matches —
|
|
74
|
+
* the query may land on any hop, and the whole route still shows. */
|
|
75
|
+
const matchPaths = useMemo(() => {
|
|
76
|
+
if (!filtering) return [];
|
|
77
|
+
const q = query.trim();
|
|
78
|
+
const hits = [];
|
|
79
|
+
const walk = (nodes, path, labels, matched) => {
|
|
80
|
+
for (const node of nodes ?? []) {
|
|
81
|
+
const hit = matched || filterFns.contains(node.label, q);
|
|
82
|
+
const nextPath = [...path, node.value];
|
|
83
|
+
const nextLabels = [...labels, node.label];
|
|
84
|
+
if (node.children?.length) walk(node.children, nextPath, nextLabels, hit);
|
|
85
|
+
else if (hit) hits.push({
|
|
86
|
+
path: nextPath,
|
|
87
|
+
labels: nextLabels
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
walk(data, [], [], false);
|
|
92
|
+
return hits;
|
|
93
|
+
}, [
|
|
94
|
+
filtering,
|
|
95
|
+
query,
|
|
96
|
+
filterFns,
|
|
97
|
+
data
|
|
98
|
+
]);
|
|
99
|
+
const isSelected = (path) => (value ?? []).some((p) => p.join("/") === path.join("/"));
|
|
100
|
+
function pickMatch(path) {
|
|
101
|
+
if (multiple) {
|
|
102
|
+
const current = value ?? [];
|
|
103
|
+
const key = path.join("/");
|
|
104
|
+
const next = current.some((p) => p.join("/") === key) ? current.filter((p) => p.join("/") !== key) : [...current, path];
|
|
105
|
+
api.setValue(next);
|
|
106
|
+
} else {
|
|
107
|
+
api.selectValue(path);
|
|
108
|
+
api.setOpen(false);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
/** The machine's `valueAsString` only updates through its select
|
|
112
|
+
* event, so an externally-set `value` would render the placeholder
|
|
113
|
+
* forever — resolve the labels from the data instead. */
|
|
114
|
+
function labelsFor(path) {
|
|
115
|
+
const out = [];
|
|
116
|
+
let nodes = data;
|
|
117
|
+
for (const entry of path) {
|
|
118
|
+
const node = nodes?.find((n) => n.value === entry);
|
|
119
|
+
if (!node) return null;
|
|
120
|
+
out.push(node.label);
|
|
121
|
+
nodes = node.children;
|
|
122
|
+
}
|
|
123
|
+
return out;
|
|
124
|
+
}
|
|
125
|
+
const display = (value ?? []).map((path) => labelsFor(path)?.join(" / ")).filter((label) => label != null).join(", ");
|
|
126
|
+
/** One column per walk of the highlighted path — the list binds to
|
|
127
|
+
* the node, the next column hangs off its highlighted child. */
|
|
128
|
+
function renderColumn(node, indexPath, valuePath) {
|
|
129
|
+
const nodeProps = {
|
|
130
|
+
item: node,
|
|
131
|
+
indexPath,
|
|
132
|
+
value: valuePath
|
|
133
|
+
};
|
|
134
|
+
const nodeState = api.getItemState(nodeProps);
|
|
135
|
+
const children = collection.getNodeChildren(node);
|
|
136
|
+
const list = /* @__PURE__ */ jsx("ul", {
|
|
137
|
+
...api.getListProps(nodeProps),
|
|
138
|
+
children: children.map((item, index) => {
|
|
139
|
+
const itemValue = collection.getNodeValue(item);
|
|
140
|
+
const itemProps = {
|
|
141
|
+
item,
|
|
142
|
+
indexPath: [...indexPath, index],
|
|
143
|
+
value: [...valuePath, itemValue]
|
|
144
|
+
};
|
|
145
|
+
const itemState = api.getItemState(itemProps);
|
|
146
|
+
return /* @__PURE__ */ jsxs("li", {
|
|
147
|
+
...api.getItemProps(itemProps),
|
|
148
|
+
children: [
|
|
149
|
+
/* @__PURE__ */ jsx("span", {
|
|
150
|
+
...api.getItemTextProps(itemProps),
|
|
151
|
+
children: item.label
|
|
152
|
+
}),
|
|
153
|
+
itemState.hasChildren ? /* @__PURE__ */ jsx("span", {
|
|
154
|
+
"data-part": "branch-indicator",
|
|
155
|
+
"aria-hidden": "true",
|
|
156
|
+
children: chevronRight
|
|
157
|
+
}) : null,
|
|
158
|
+
/* @__PURE__ */ jsx("span", {
|
|
159
|
+
...api.getItemIndicatorProps(itemProps),
|
|
160
|
+
children: checkGlyph
|
|
161
|
+
})
|
|
162
|
+
]
|
|
163
|
+
}, itemValue);
|
|
164
|
+
})
|
|
165
|
+
});
|
|
166
|
+
const next = nodeState.highlightedChild;
|
|
167
|
+
return [list, next != null && collection.isBranchNode(next) ? renderColumn(next, [...indexPath, nodeState.highlightedIndex], [...valuePath, collection.getNodeValue(next)]) : null];
|
|
168
|
+
}
|
|
169
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
170
|
+
...rest,
|
|
171
|
+
...api.getRootProps(),
|
|
172
|
+
"data-size": size,
|
|
173
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
174
|
+
...api.getControlProps(),
|
|
175
|
+
children: /* @__PURE__ */ jsxs("button", {
|
|
176
|
+
...api.getTriggerProps(),
|
|
177
|
+
onClick: (event) => {
|
|
178
|
+
api.getTriggerProps().onClick?.(event);
|
|
179
|
+
setQuery("");
|
|
180
|
+
},
|
|
181
|
+
disabled: disabled || void 0,
|
|
182
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
183
|
+
...api.getValueTextProps(),
|
|
184
|
+
children: display || placeholder
|
|
185
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
186
|
+
...api.getIndicatorProps(),
|
|
187
|
+
children: chevronDown
|
|
188
|
+
})]
|
|
189
|
+
})
|
|
190
|
+
}), /* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsx("div", {
|
|
191
|
+
...api.getPositionerProps(),
|
|
192
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
193
|
+
...api.getContentProps(),
|
|
194
|
+
"data-size": size,
|
|
195
|
+
children: [filterable ? /* @__PURE__ */ jsx("div", {
|
|
196
|
+
"data-part": "search",
|
|
197
|
+
children: /* @__PURE__ */ jsx(Input, {
|
|
198
|
+
size: "sm",
|
|
199
|
+
value: query,
|
|
200
|
+
onValueChange: setQuery,
|
|
201
|
+
placeholder: "Filter…",
|
|
202
|
+
"aria-label": "Filter options"
|
|
203
|
+
})
|
|
204
|
+
}) : null, /* @__PURE__ */ jsx("div", {
|
|
205
|
+
"data-part": "corridor",
|
|
206
|
+
"data-flow": filtering ? "flat" : "columns",
|
|
207
|
+
children: filtering ? matchPaths.length === 0 ? /* @__PURE__ */ jsx("p", {
|
|
208
|
+
"data-part": "empty",
|
|
209
|
+
children: "Nothing matches"
|
|
210
|
+
}) : matchPaths.map((hit) => /* @__PURE__ */ jsx("button", {
|
|
211
|
+
type: "button",
|
|
212
|
+
"data-part": "match",
|
|
213
|
+
"data-selected": isSelected(hit.path) || void 0,
|
|
214
|
+
onClick: () => pickMatch(hit.path),
|
|
215
|
+
children: hit.labels.join(" / ")
|
|
216
|
+
}, hit.path.join("/"))) : renderColumn(collection.rootNode, [], [])
|
|
217
|
+
})]
|
|
218
|
+
})
|
|
219
|
+
}) })]
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
//#endregion
|
|
223
|
+
export { CascadeSelect };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ComponentProps } from "react";
|
|
2
|
+
import { Checkbox as Checkbox$1 } from "@ark-ui/react/checkbox";
|
|
3
|
+
//#region src/components/checkbox/index.d.ts
|
|
4
|
+
type CheckboxRootProps = ComponentProps<typeof Checkbox$1.Root> & {
|
|
5
|
+
/** One rung for the control's box: the tick scales with it. */
|
|
6
|
+
size?: "sm" | "md" | "lg";
|
|
7
|
+
};
|
|
8
|
+
declare function CheckboxRoot({ size, ...rest }: CheckboxRootProps): import("react").JSX.Element;
|
|
9
|
+
/** Ark's Checkbox, dressed in the paper-and-ink system: a square-cut seal
|
|
10
|
+
* that fills flat with primary ink when ticked, the mark springing into
|
|
11
|
+
* place. The API is Ark's own — Root, Label, Control, Indicator,
|
|
12
|
+
* HiddenInput. */
|
|
13
|
+
export declare const Checkbox: Omit<typeof Checkbox$1, "Root"> & {
|
|
14
|
+
Root: typeof CheckboxRoot;
|
|
15
|
+
};
|
|
16
|
+
//#endregion
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { injectComponentStyle } from "@bysages/core";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { Checkbox as Checkbox$1 } from "@ark-ui/react/checkbox";
|
|
4
|
+
//#region src/components/checkbox/index.tsx
|
|
5
|
+
function CheckboxRoot({ size = "md", ...rest }) {
|
|
6
|
+
return /* @__PURE__ */ jsx(Checkbox$1.Root, {
|
|
7
|
+
...rest,
|
|
8
|
+
"data-size": size
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
/** Ark's Checkbox, dressed in the paper-and-ink system: a square-cut seal
|
|
12
|
+
* that fills flat with primary ink when ticked, the mark springing into
|
|
13
|
+
* place. The API is Ark's own — Root, Label, Control, Indicator,
|
|
14
|
+
* HiddenInput. */
|
|
15
|
+
const Checkbox = {
|
|
16
|
+
...Checkbox$1,
|
|
17
|
+
Root: CheckboxRoot
|
|
18
|
+
};
|
|
19
|
+
injectComponentStyle("checkbox");
|
|
20
|
+
//#endregion
|
|
21
|
+
export { Checkbox };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { HTMLAttributes } from "react";
|
|
2
|
+
//#region src/components/checkbox-group/index.d.ts
|
|
3
|
+
export interface CheckboxOption {
|
|
4
|
+
label: string;
|
|
5
|
+
value: string;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface CheckboxGroupProps extends HTMLAttributes<HTMLDivElement> {
|
|
9
|
+
value?: string[];
|
|
10
|
+
options: CheckboxOption[];
|
|
11
|
+
layout?: "vertical" | "horizontal";
|
|
12
|
+
/** One register for every box: falls onto each root's data-size for
|
|
13
|
+
* the stylesheet to retune. */
|
|
14
|
+
size?: "sm" | "md" | "lg";
|
|
15
|
+
invalid?: boolean;
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
onValueChange?: (value: string[]) => void;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* One question, many answers: a labelled stack (or row) of the seal-cut
|
|
21
|
+
* checkboxes bound to a single array. Toggling a box adds or removes its
|
|
22
|
+
* value; the group itself is semantics (`role="group"`), the boxes stay
|
|
23
|
+
* the machine-driven originals. Inside a `Field.Root` the group picks up
|
|
24
|
+
* the field context, so the invalid and disabled states a Form routes to
|
|
25
|
+
* its name dress every box at once.
|
|
26
|
+
*/
|
|
27
|
+
export declare function CheckboxGroup({ value, options, layout, size, invalid, disabled, onValueChange, ...rest }: CheckboxGroupProps): import("react").JSX.Element;
|
|
28
|
+
//#endregion
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { injectComponentStyle } from "@bysages/core";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useId } from "react";
|
|
4
|
+
import { useFieldContext } from "@ark-ui/react/field";
|
|
5
|
+
import { Checkbox } from "@ark-ui/react/checkbox";
|
|
6
|
+
//#region src/components/checkbox-group/index.tsx
|
|
7
|
+
const checkGlyph = /* @__PURE__ */ jsx("svg", {
|
|
8
|
+
viewBox: "0 0 24 24",
|
|
9
|
+
fill: "none",
|
|
10
|
+
stroke: "currentColor",
|
|
11
|
+
strokeWidth: 3,
|
|
12
|
+
strokeLinecap: "round",
|
|
13
|
+
strokeLinejoin: "round",
|
|
14
|
+
"aria-hidden": "true",
|
|
15
|
+
children: /* @__PURE__ */ jsx("path", { d: "m5 12.5 5 5L19 7" })
|
|
16
|
+
});
|
|
17
|
+
/**
|
|
18
|
+
* One question, many answers: a labelled stack (or row) of the seal-cut
|
|
19
|
+
* checkboxes bound to a single array. Toggling a box adds or removes its
|
|
20
|
+
* value; the group itself is semantics (`role="group"`), the boxes stay
|
|
21
|
+
* the machine-driven originals. Inside a `Field.Root` the group picks up
|
|
22
|
+
* the field context, so the invalid and disabled states a Form routes to
|
|
23
|
+
* its name dress every box at once.
|
|
24
|
+
*/
|
|
25
|
+
function CheckboxGroup({ value = [], options, layout = "vertical", size = "md", invalid = false, disabled = false, onValueChange, ...rest }) {
|
|
26
|
+
injectComponentStyle("checkbox-group");
|
|
27
|
+
injectComponentStyle("checkbox");
|
|
28
|
+
const field = useFieldContext();
|
|
29
|
+
const uid = useId();
|
|
30
|
+
const selected = new Set(value);
|
|
31
|
+
const isInvalid = invalid || field?.invalid === true;
|
|
32
|
+
const isDisabled = disabled || field?.disabled === true;
|
|
33
|
+
function toggle(option) {
|
|
34
|
+
const next = new Set(selected);
|
|
35
|
+
if (next.has(option)) next.delete(option);
|
|
36
|
+
else next.add(option);
|
|
37
|
+
onValueChange?.([...next]);
|
|
38
|
+
}
|
|
39
|
+
return /* @__PURE__ */ jsx("div", {
|
|
40
|
+
...rest,
|
|
41
|
+
role: "group",
|
|
42
|
+
"data-scope": "checkbox-group",
|
|
43
|
+
"data-part": "root",
|
|
44
|
+
"data-layout": layout,
|
|
45
|
+
"data-invalid": isInvalid ? "" : void 0,
|
|
46
|
+
children: options.map((option) => /* @__PURE__ */ jsxs(Checkbox.Root, {
|
|
47
|
+
ids: {
|
|
48
|
+
label: `${uid}:${option.value}:label`,
|
|
49
|
+
hiddenInput: `${uid}:${option.value}:input`
|
|
50
|
+
},
|
|
51
|
+
"data-size": size,
|
|
52
|
+
checked: selected.has(option.value),
|
|
53
|
+
invalid: isInvalid,
|
|
54
|
+
disabled: isDisabled || option.disabled === true,
|
|
55
|
+
onCheckedChange: () => toggle(option.value),
|
|
56
|
+
children: [
|
|
57
|
+
/* @__PURE__ */ jsx(Checkbox.Control, { children: /* @__PURE__ */ jsx(Checkbox.Indicator, { children: checkGlyph }) }),
|
|
58
|
+
/* @__PURE__ */ jsx(Checkbox.Label, { children: option.label }),
|
|
59
|
+
/* @__PURE__ */ jsx(Checkbox.HiddenInput, {})
|
|
60
|
+
]
|
|
61
|
+
}, option.value))
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
//#endregion
|
|
65
|
+
export { CheckboxGroup };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { HTMLAttributes } from "react";
|
|
2
|
+
//#region src/components/chip/index.d.ts
|
|
3
|
+
/** A counting coin: the numeric value, capped at `max` with an ellipsis
|
|
4
|
+
* of the remainder ("99+"). */
|
|
5
|
+
export interface ChipProps extends HTMLAttributes<HTMLSpanElement> {
|
|
6
|
+
value: number;
|
|
7
|
+
max?: number;
|
|
8
|
+
tone?: "ink" | "info" | "success" | "warning" | "danger";
|
|
9
|
+
variant?: "solid" | "subtle" | "outline";
|
|
10
|
+
}
|
|
11
|
+
export declare function Chip({ value, max, tone, variant, ...rest }: ChipProps): import("react").JSX.Element;
|
|
12
|
+
//#endregion
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { injectComponentStyle } from "@bysages/core";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
//#region src/components/chip/index.tsx
|
|
4
|
+
function Chip({ value, max, tone = "ink", variant = "solid", ...rest }) {
|
|
5
|
+
injectComponentStyle("chip");
|
|
6
|
+
const text = max != null && value > max ? `${max}+` : String(value);
|
|
7
|
+
return /* @__PURE__ */ jsx("span", {
|
|
8
|
+
...rest,
|
|
9
|
+
"data-scope": "chip",
|
|
10
|
+
"data-part": "root",
|
|
11
|
+
"data-tone": tone,
|
|
12
|
+
"data-variant": variant,
|
|
13
|
+
children: text
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
17
|
+
export { Chip };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ComponentProps } from "react";
|
|
2
|
+
import { Clipboard as Clipboard$1 } from "@ark-ui/react/clipboard";
|
|
3
|
+
//#region src/components/clipboard/index.d.ts
|
|
4
|
+
/** Ark's Clipboard, dressed in the paper-and-ink system: a hairline value
|
|
5
|
+
* field beside an icon-sized copy trigger whose ink turns bamboo while the
|
|
6
|
+
* copy is confirmed. The API is Ark's own — Root, Label, Control, Input,
|
|
7
|
+
* Trigger, Indicator, Context, HiddenInput. */
|
|
8
|
+
type ClipboardRootProps = ComponentProps<typeof Clipboard$1.Root> & {
|
|
9
|
+
/** One rung of the control-height ladder for the value field and
|
|
10
|
+
* its copy seal. */
|
|
11
|
+
size?: "sm" | "md" | "lg";
|
|
12
|
+
};
|
|
13
|
+
declare function ClipboardRoot({ size, ...rest }: ClipboardRootProps): import("react").JSX.Element;
|
|
14
|
+
export declare const Clipboard: Omit<typeof Clipboard$1, "Root"> & {
|
|
15
|
+
Root: typeof ClipboardRoot;
|
|
16
|
+
};
|
|
17
|
+
//#endregion
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { injectComponentStyle } from "@bysages/core";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { Clipboard as Clipboard$1 } from "@ark-ui/react/clipboard";
|
|
4
|
+
//#region src/components/clipboard/index.tsx
|
|
5
|
+
function ClipboardRoot({ size = "md", ...rest }) {
|
|
6
|
+
return /* @__PURE__ */ jsx(Clipboard$1.Root, {
|
|
7
|
+
...rest,
|
|
8
|
+
"data-size": size
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
const Clipboard = {
|
|
12
|
+
...Clipboard$1,
|
|
13
|
+
Root: ClipboardRoot
|
|
14
|
+
};
|
|
15
|
+
injectComponentStyle("clipboard");
|
|
16
|
+
//#endregion
|
|
17
|
+
export { Clipboard };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Collapsible as Collapsible$1 } from "@ark-ui/react/collapsible";
|
|
2
|
+
//#region src/components/collapsible/index.d.ts
|
|
3
|
+
/** Ark's Collapsible, dressed in the paper-and-ink system: one control on
|
|
4
|
+
* the paper, its panel dissolving open to the machine's measured height.
|
|
5
|
+
* The API is Ark's own — Root, Trigger, Content, Indicator. */
|
|
6
|
+
export declare const Collapsible: typeof Collapsible$1;
|
|
7
|
+
//#endregion
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { injectComponentStyle } from "@bysages/core";
|
|
2
|
+
import { Collapsible as Collapsible$1 } from "@ark-ui/react/collapsible";
|
|
3
|
+
//#region src/components/collapsible/index.tsx
|
|
4
|
+
/** Ark's Collapsible, dressed in the paper-and-ink system: one control on
|
|
5
|
+
* the paper, its panel dissolving open to the machine's measured height.
|
|
6
|
+
* The API is Ark's own — Root, Trigger, Content, Indicator. */
|
|
7
|
+
const Collapsible = Collapsible$1;
|
|
8
|
+
injectComponentStyle("collapsible");
|
|
9
|
+
//#endregion
|
|
10
|
+
export { Collapsible };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { CollectionItem, CollectionOptions, FilePathTreeNode, FlatTreeNode, GridCollection, GridCollectionOptions, ListCollection, TreeCollection, TreeCollectionOptions, TreeNode, UseAsyncListProps, UseAsyncListReturn, UseListCollectionProps, UseListCollectionReturn, UseListSelectionProps, UseListSelectionReturn, createFileTreeCollection, createGridCollection, createListCollection, createTreeCollection, useAsyncList, useListCollection, useListSelection } from "@ark-ui/react/collection";
|
|
2
|
+
export { type CollectionItem, type CollectionOptions, type FilePathTreeNode, type FlatTreeNode, type GridCollection, type GridCollectionOptions, type ListCollection, type TreeCollection, type TreeCollectionOptions, type TreeNode, type UseAsyncListProps, type UseAsyncListReturn, type UseListCollectionProps, type UseListCollectionReturn, type UseListSelectionProps, type UseListSelectionReturn, createFileTreeCollection, createGridCollection, createListCollection, createTreeCollection, useAsyncList, useListCollection, useListSelection };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createFileTreeCollection, createGridCollection, createListCollection, createTreeCollection, useAsyncList, useListCollection, useListSelection } from "@ark-ui/react/collection";
|
|
2
|
+
export { createFileTreeCollection, createGridCollection, createListCollection, createTreeCollection, useAsyncList, useListCollection, useListSelection };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ComponentProps } from "react";
|
|
2
|
+
import { ColorPicker as ColorPicker$1 } from "@ark-ui/react/color-picker";
|
|
3
|
+
//#region src/components/color-picker/index.d.ts
|
|
4
|
+
type ColorPickerRootProps = ComponentProps<typeof ColorPicker$1.Root> & {
|
|
5
|
+
/** One rung of the control-height ladder for the swatch seal. */
|
|
6
|
+
size?: "sm" | "md" | "lg";
|
|
7
|
+
};
|
|
8
|
+
declare function ColorPickerRoot({ size, ...rest }: ColorPickerRootProps): import("react").JSX.Element;
|
|
9
|
+
/** Ark's ColorPicker, dressed in the paper-and-ink system: a seal-sized swatch
|
|
10
|
+
* on the paper, opening into an area and channel sliders where pigment is
|
|
11
|
+
* picked. The API is Ark's own — Root, Label, Control, Trigger, Positioner,
|
|
12
|
+
* Content, Area, AreaThumb, AreaBackground, ValueText, ValueSwatch,
|
|
13
|
+
* ChannelSlider, ChannelSliderLabel, ChannelSliderTrack, ChannelSliderThumb,
|
|
14
|
+
* ChannelSliderValueText, ChannelInput, TransparencyGrid, SwatchGroup,
|
|
15
|
+
* SwatchTrigger, SwatchIndicator, Swatch, EyeDropperTrigger, FormatTrigger,
|
|
16
|
+
* FormatSelect, HiddenInput, Context. */
|
|
17
|
+
export declare const ColorPicker: Omit<typeof ColorPicker$1, "Root"> & {
|
|
18
|
+
Root: typeof ColorPickerRoot;
|
|
19
|
+
};
|
|
20
|
+
//#endregion
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { injectComponentStyle } from "@bysages/core";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { ColorPicker as ColorPicker$1 } from "@ark-ui/react/color-picker";
|
|
4
|
+
//#region src/components/color-picker/index.tsx
|
|
5
|
+
function ColorPickerRoot({ size = "md", ...rest }) {
|
|
6
|
+
return /* @__PURE__ */ jsx(ColorPicker$1.Root, {
|
|
7
|
+
...rest,
|
|
8
|
+
"data-size": size
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
/** Ark's ColorPicker, dressed in the paper-and-ink system: a seal-sized swatch
|
|
12
|
+
* on the paper, opening into an area and channel sliders where pigment is
|
|
13
|
+
* picked. The API is Ark's own — Root, Label, Control, Trigger, Positioner,
|
|
14
|
+
* Content, Area, AreaThumb, AreaBackground, ValueText, ValueSwatch,
|
|
15
|
+
* ChannelSlider, ChannelSliderLabel, ChannelSliderTrack, ChannelSliderThumb,
|
|
16
|
+
* ChannelSliderValueText, ChannelInput, TransparencyGrid, SwatchGroup,
|
|
17
|
+
* SwatchTrigger, SwatchIndicator, Swatch, EyeDropperTrigger, FormatTrigger,
|
|
18
|
+
* FormatSelect, HiddenInput, Context. */
|
|
19
|
+
const ColorPicker = {
|
|
20
|
+
...ColorPicker$1,
|
|
21
|
+
Root: ColorPickerRoot
|
|
22
|
+
};
|
|
23
|
+
injectComponentStyle("color-picker");
|
|
24
|
+
//#endregion
|
|
25
|
+
export { ColorPicker };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { CollectionItem } from "@ark-ui/react/collection";
|
|
2
|
+
import { Combobox as Combobox$1, ComboboxRootComponentProps } from "@ark-ui/react/combobox";
|
|
3
|
+
//#region src/components/combobox/index.d.ts
|
|
4
|
+
/** Ark's Combobox, dressed in the paper-and-ink system: the field carries
|
|
5
|
+
* the control recipe and its matches dissolve open as a paper vessel, the
|
|
6
|
+
* checked row taking the flat ink fill. The API is Ark's own — Root, Label,
|
|
7
|
+
* Control, Input, Trigger, ClearTrigger, Positioner, Content, List, Empty,
|
|
8
|
+
* Item, ItemText, ItemIndicator, ItemGroup, ItemGroupLabel. */
|
|
9
|
+
type ComboboxOwnProps = {
|
|
10
|
+
/** One rung of the control-height ladder for the field row. */
|
|
11
|
+
size?: "sm" | "md" | "lg";
|
|
12
|
+
};
|
|
13
|
+
declare function ComboboxRoot<T extends CollectionItem>(props: ComboboxRootComponentProps<T, ComboboxOwnProps>): import("react").JSX.Element;
|
|
14
|
+
export declare const Combobox: Omit<typeof Combobox$1, "Root"> & {
|
|
15
|
+
Root: typeof ComboboxRoot;
|
|
16
|
+
};
|
|
17
|
+
//#endregion
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { injectComponentStyle } from "@bysages/core";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { Combobox as Combobox$1 } from "@ark-ui/react/combobox";
|
|
4
|
+
//#region src/components/combobox/index.tsx
|
|
5
|
+
function ComboboxRoot(props) {
|
|
6
|
+
const { size = "md", ...rest } = props;
|
|
7
|
+
return /* @__PURE__ */ jsx(Combobox$1.Root, {
|
|
8
|
+
...rest,
|
|
9
|
+
"data-size": size
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
const Combobox = {
|
|
13
|
+
...Combobox$1,
|
|
14
|
+
Root: ComboboxRoot
|
|
15
|
+
};
|
|
16
|
+
injectComponentStyle("combobox");
|
|
17
|
+
//#endregion
|
|
18
|
+
export { Combobox };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
//#region src/components/command/index.d.ts
|
|
2
|
+
export interface CommandEntry {
|
|
3
|
+
label: string;
|
|
4
|
+
value: string;
|
|
5
|
+
/** Entries sharing a group are listed under one heading. */
|
|
6
|
+
group?: string;
|
|
7
|
+
/** A short affordance note, set as a keycap at the row's end. */
|
|
8
|
+
hint?: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* The command palette: a modal sheet at the top of the page carrying a
|
|
12
|
+
* search field over the caller's commands, grouped as a ledger with a
|
|
13
|
+
* keycap hint at each row. The shell is the dialog machinery — scrim,
|
|
14
|
+
* focus trap, Escape — and the searching is the combobox machinery
|
|
15
|
+
* driving our own list: the vessel and the list live inside the sheet,
|
|
16
|
+
* so the combobox renders no separate popup and the machine's content
|
|
17
|
+
* grafts onto the sheet's list.
|
|
18
|
+
*/
|
|
19
|
+
export interface CommandProps {
|
|
20
|
+
/** The commands on offer, grouped as they arrive. */
|
|
21
|
+
items?: CommandEntry[];
|
|
22
|
+
placeholder?: string;
|
|
23
|
+
/** Whether the palette is up. Supply it to control the palette;
|
|
24
|
+
* changes are reported via `onOpenChange`. */
|
|
25
|
+
open?: boolean;
|
|
26
|
+
/** Whether the shell narrows `items` as the reader types. Turn it off
|
|
27
|
+
* when the caller owns the searching — a ranked engine or a remote
|
|
28
|
+
* source — and hands down the already-narrowed list. */
|
|
29
|
+
autoFilter?: boolean;
|
|
30
|
+
/** The field's text under the caller's control; changes are reported
|
|
31
|
+
* via `onInputValueChange`. */
|
|
32
|
+
inputValue?: string;
|
|
33
|
+
/** What the list whispers when nothing matches. */
|
|
34
|
+
emptyText?: string;
|
|
35
|
+
/** Called with the chosen entry's `value`; the palette closes after. */
|
|
36
|
+
onSelect?: (value: string) => void;
|
|
37
|
+
/** Reports the palette's next state. */
|
|
38
|
+
onOpenChange?: (open: boolean) => void;
|
|
39
|
+
/** Reports the field's live text. */
|
|
40
|
+
onInputValueChange?: (value: string) => void;
|
|
41
|
+
}
|
|
42
|
+
export declare function Command({ items, placeholder, open, autoFilter, inputValue, emptyText, onSelect, onOpenChange, onInputValueChange }: CommandProps): import("react").JSX.Element;
|
|
43
|
+
//#endregion
|