@bysages/react 0.2.2 → 0.3.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/README.md +16 -2
- 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 +23 -0
- package/dist/components/avatar/index.mjs +15 -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/bento/index.d.mts +26 -0
- package/dist/components/bento/index.mjs +41 -0
- package/dist/components/block-ui/index.d.mts +12 -0
- package/dist/components/block-ui/index.mjs +24 -0
- package/dist/components/breadcrumb/index.d.mts +32 -0
- package/dist/components/breadcrumb/index.mjs +35 -0
- package/dist/components/browser/index.d.mts +23 -0
- package/dist/components/browser/index.mjs +70 -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 +229 -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/data-view/index.d.mts +18 -0
- package/dist/components/data-view/index.mjs +64 -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/deferred-content/index.d.mts +16 -0
- package/dist/components/deferred-content/index.mjs +34 -0
- package/dist/components/descriptions/index.d.mts +33 -0
- package/dist/components/descriptions/index.mjs +50 -0
- package/dist/components/dialog/index.d.mts +9 -0
- package/dist/components/dialog/index.mjs +11 -0
- package/dist/components/dock/index.d.mts +25 -0
- package/dist/components/dock/index.mjs +51 -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 +24 -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 +19 -0
- package/dist/components/input/index.mjs +2 -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/order-list/index.d.mts +21 -0
- package/dist/components/order-list/index.mjs +162 -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/result/index.d.mts +31 -0
- package/dist/components/result/index.mjs +59 -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 +2 -0
- package/dist/components/select/index.mjs +2 -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/spotlight/index.d.mts +12 -0
- package/dist/components/spotlight/index.mjs +33 -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 +20 -0
- package/dist/components/tabs/index.mjs +24 -0
- package/dist/components/tags-input/index.d.mts +17 -0
- package/dist/components/tags-input/index.mjs +22 -0
- package/dist/components/terminal/index.d.mts +17 -0
- package/dist/components/terminal/index.mjs +65 -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 +26 -0
- package/dist/components/timeline/index.mjs +40 -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/toolbar/index.d.mts +17 -0
- package/dist/components/toolbar/index.mjs +29 -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/user/index.d.mts +20 -0
- package/dist/components/user/index.mjs +42 -0
- package/dist/components/virtual-list/index.d.mts +17 -0
- package/dist/components/virtual-list/index.mjs +52 -0
- package/dist/components/watermark/index.d.mts +16 -0
- package/dist/components/watermark/index.mjs +80 -0
- package/dist/index-CsfxYv6J.d.mts +10383 -0
- package/dist/index-DFN9F5Zt.d.mts +42 -0
- package/dist/index-Uefyw7Im.d.mts +108 -0
- package/dist/index-uPyYiWaL.d.mts +1813 -0
- package/dist/index.d.mts +141 -15446
- package/dist/index.mjs +141 -4871
- package/dist/input-2oezH-dY.mjs +58 -0
- package/dist/mentions-DMIBCBOd.mjs +181 -0
- package/dist/select-D1xiT1oJ.mjs +68 -0
- package/package.json +103 -9
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { Button } from "../button/index.mjs";
|
|
2
|
+
import { Field } from "../field/index.mjs";
|
|
3
|
+
import { n as MentionsVessel, r as useMentions } from "../../mentions-DMIBCBOd.mjs";
|
|
4
|
+
import { injectComponentStyle } from "@bysages/core";
|
|
5
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { useRef } from "react";
|
|
7
|
+
//#region src/components/ai-prompt-input/index.tsx
|
|
8
|
+
const arrowUpGlyph = /* @__PURE__ */ jsx("svg", {
|
|
9
|
+
viewBox: "0 0 16 16",
|
|
10
|
+
width: 14,
|
|
11
|
+
height: 14,
|
|
12
|
+
"aria-hidden": "true",
|
|
13
|
+
fill: "none",
|
|
14
|
+
stroke: "currentColor",
|
|
15
|
+
strokeWidth: 1.5,
|
|
16
|
+
strokeLinecap: "square",
|
|
17
|
+
children: /* @__PURE__ */ jsx("path", { d: "M8 13V3M3.5 7.5 8 3l4.5 4.5" })
|
|
18
|
+
});
|
|
19
|
+
const stopGlyph = /* @__PURE__ */ jsx("svg", {
|
|
20
|
+
viewBox: "0 0 16 16",
|
|
21
|
+
width: 14,
|
|
22
|
+
height: 14,
|
|
23
|
+
"aria-hidden": "true",
|
|
24
|
+
children: /* @__PURE__ */ jsx("rect", {
|
|
25
|
+
x: 4.5,
|
|
26
|
+
y: 4.5,
|
|
27
|
+
width: 7,
|
|
28
|
+
height: 7,
|
|
29
|
+
fill: "currentColor"
|
|
30
|
+
})
|
|
31
|
+
});
|
|
32
|
+
/** An empty slot leaves no part in the anatomy — the bare vessel keeps
|
|
33
|
+
* its single-line posture. */
|
|
34
|
+
function row(part, content) {
|
|
35
|
+
if (content == null || Array.isArray(content) && content.length === 0) return null;
|
|
36
|
+
return /* @__PURE__ */ jsx("div", {
|
|
37
|
+
"data-scope": "ai",
|
|
38
|
+
"data-part": part,
|
|
39
|
+
children: content
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
function PromptInput({ value, onValueChange, onSubmit, onStop, placeholder = "Send a message", disabled = false, busy = false, mentions, header, leading, trailing, footer, footerEnd, ...rest }) {
|
|
43
|
+
injectComponentStyle("ai");
|
|
44
|
+
const fieldRef = useRef(null);
|
|
45
|
+
const mentionState = useMentions(() => ({
|
|
46
|
+
items: mentions?.items ?? [],
|
|
47
|
+
trigger: mentions?.trigger
|
|
48
|
+
}), () => fieldRef.current, {
|
|
49
|
+
getText: () => fieldRef.current?.value ?? value,
|
|
50
|
+
setText: (next) => onValueChange?.(next)
|
|
51
|
+
});
|
|
52
|
+
const mentionsActive = mentions != null;
|
|
53
|
+
const submit = () => {
|
|
54
|
+
const text = value.trim();
|
|
55
|
+
if (!text || disabled || busy) return;
|
|
56
|
+
onSubmit?.(text);
|
|
57
|
+
onValueChange?.("");
|
|
58
|
+
};
|
|
59
|
+
const seal = busy ? /* @__PURE__ */ jsx(Button, {
|
|
60
|
+
variant: "solid",
|
|
61
|
+
size: "sm",
|
|
62
|
+
square: true,
|
|
63
|
+
type: "button",
|
|
64
|
+
"aria-label": "Stop",
|
|
65
|
+
disabled,
|
|
66
|
+
onClick: () => onStop?.(),
|
|
67
|
+
children: stopGlyph
|
|
68
|
+
}) : /* @__PURE__ */ jsx(Button, {
|
|
69
|
+
variant: "solid",
|
|
70
|
+
size: "sm",
|
|
71
|
+
square: true,
|
|
72
|
+
type: "submit",
|
|
73
|
+
"aria-label": "Send",
|
|
74
|
+
disabled: disabled || !value.trim(),
|
|
75
|
+
children: arrowUpGlyph
|
|
76
|
+
});
|
|
77
|
+
const hasFooter = footer != null && (!Array.isArray(footer) || footer.length > 0);
|
|
78
|
+
return /* @__PURE__ */ jsxs("form", {
|
|
79
|
+
...rest,
|
|
80
|
+
"data-scope": "ai",
|
|
81
|
+
"data-part": "prompt",
|
|
82
|
+
onSubmit: (event) => {
|
|
83
|
+
event.preventDefault();
|
|
84
|
+
submit();
|
|
85
|
+
},
|
|
86
|
+
children: [
|
|
87
|
+
row("prompt-header", header),
|
|
88
|
+
/* @__PURE__ */ jsxs("div", {
|
|
89
|
+
"data-scope": "ai",
|
|
90
|
+
"data-part": "prompt-main",
|
|
91
|
+
children: [
|
|
92
|
+
row("prompt-leading", leading),
|
|
93
|
+
/* @__PURE__ */ jsx(Field.Root, { children: /* @__PURE__ */ jsx(Field.Textarea, {
|
|
94
|
+
ref: fieldRef,
|
|
95
|
+
autoresize: true,
|
|
96
|
+
rows: 1,
|
|
97
|
+
value,
|
|
98
|
+
placeholder,
|
|
99
|
+
disabled,
|
|
100
|
+
onChange: (event) => {
|
|
101
|
+
onValueChange?.(event.target.value);
|
|
102
|
+
mentionState.onInput();
|
|
103
|
+
},
|
|
104
|
+
onKeyDown: (event) => {
|
|
105
|
+
if (mentionState.onKeydown(event)) return;
|
|
106
|
+
if (event.key === "Enter" && !event.shiftKey) {
|
|
107
|
+
event.preventDefault();
|
|
108
|
+
submit();
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}) }),
|
|
112
|
+
mentionsActive ? /* @__PURE__ */ jsx(MentionsVessel, {
|
|
113
|
+
open: mentionState.open,
|
|
114
|
+
matches: mentionState.matches,
|
|
115
|
+
active: mentionState.active,
|
|
116
|
+
anchor: fieldRef.current,
|
|
117
|
+
onInsert: mentionState.insert,
|
|
118
|
+
onActiveChange: mentionState.setActive,
|
|
119
|
+
onOpenChange: (open) => {
|
|
120
|
+
if (!open) mentionState.close();
|
|
121
|
+
}
|
|
122
|
+
}) : null,
|
|
123
|
+
row("prompt-trailing", hasFooter ? trailing : trailing ?? seal)
|
|
124
|
+
]
|
|
125
|
+
}),
|
|
126
|
+
hasFooter ? /* @__PURE__ */ jsxs("div", {
|
|
127
|
+
"data-scope": "ai",
|
|
128
|
+
"data-part": "prompt-footer",
|
|
129
|
+
children: [footer, row("prompt-end", footerEnd == null ? seal : /* @__PURE__ */ jsxs(Fragment, { children: [footerEnd, seal] }))]
|
|
130
|
+
}) : null
|
|
131
|
+
]
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
//#endregion
|
|
135
|
+
export { PromptInput as AiPromptInput, PromptInput };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { HTMLAttributes, ReactNode } from "react";
|
|
2
|
+
//#region src/components/ai-reasoning/index.d.ts
|
|
3
|
+
/** The model's thought, folded by the shared collapsible in its quiet
|
|
4
|
+
* register: bare ink for a trigger, the thought on one hairline. */
|
|
5
|
+
export interface ReasoningProps extends HTMLAttributes<HTMLDivElement> {
|
|
6
|
+
/** The trigger's words — the fold arrives open under them. */
|
|
7
|
+
label?: string;
|
|
8
|
+
defaultOpen?: boolean;
|
|
9
|
+
children?: ReactNode;
|
|
10
|
+
}
|
|
11
|
+
export declare function Reasoning({ label, children, ...rest }: ReasoningProps): import("react").JSX.Element;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { Reasoning as AiReasoning };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { t as chevron } from "../../chevron-BeHvt46K.mjs";
|
|
2
|
+
import { Collapsible } from "../collapsible/index.mjs";
|
|
3
|
+
import { injectComponentStyle } from "@bysages/core";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/ai-reasoning/index.tsx
|
|
6
|
+
function Reasoning({ label = "Thinking", children, ...rest }) {
|
|
7
|
+
injectComponentStyle("ai");
|
|
8
|
+
return /* @__PURE__ */ jsxs(Collapsible.Root, {
|
|
9
|
+
...rest,
|
|
10
|
+
"data-ai": "reasoning",
|
|
11
|
+
children: [/* @__PURE__ */ jsxs(Collapsible.Trigger, { children: [/* @__PURE__ */ jsx("span", { children: label }), /* @__PURE__ */ jsx(Collapsible.Indicator, { children: chevron })] }), /* @__PURE__ */ jsx(Collapsible.Content, { children: /* @__PURE__ */ jsx("div", {
|
|
12
|
+
"data-scope": "ai",
|
|
13
|
+
"data-part": "reasoning-content",
|
|
14
|
+
children
|
|
15
|
+
}) })]
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
export { Reasoning as AiReasoning, Reasoning };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { HTMLAttributes } from "react";
|
|
2
|
+
//#region src/components/ai-response/index.d.ts
|
|
3
|
+
/** Markdown set on the paper. Rendering goes through
|
|
4
|
+
* `@tanstack/markdown`, whose defaults leave raw HTML and executable
|
|
5
|
+
* links inert — streaming-safe by construction. An optional
|
|
6
|
+
* highlighter re-inks fenced code; the component stays agnostic about
|
|
7
|
+
* which engine provides it. */
|
|
8
|
+
export interface ResponseProps extends HTMLAttributes<HTMLDivElement> {
|
|
9
|
+
/** The markdown text to set on the paper — streamed in freely; raw
|
|
10
|
+
* HTML and executable links stay inert. */
|
|
11
|
+
content: string;
|
|
12
|
+
/** Optional code-highlighting function re-inking fenced blocks; the
|
|
13
|
+
* component stays agnostic about which engine provides it. */
|
|
14
|
+
highlighter?: (code: string, lang?: string) => string;
|
|
15
|
+
/** The copy stamp's accessible name before the copy lands. */
|
|
16
|
+
copyLabel?: string;
|
|
17
|
+
/** The copy stamp's accessible name once the text has landed. */
|
|
18
|
+
copiedLabel?: string;
|
|
19
|
+
}
|
|
20
|
+
export declare function Response({ content, highlighter, copyLabel, copiedLabel, ...rest }: ResponseProps): import("react").JSX.Element;
|
|
21
|
+
//#endregion
|
|
22
|
+
export { Response as AiResponse };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { HTMLAttributes, ReactNode } from "react";
|
|
2
|
+
//#region src/components/ai-source/index.d.ts
|
|
3
|
+
/** One place the ink came from; href and the rest ride the anchor. */
|
|
4
|
+
export interface SourceProps extends HTMLAttributes<HTMLAnchorElement> {
|
|
5
|
+
/** Where the ink came from — also the link text when no children are
|
|
6
|
+
* given; opens in a new tab, referrer-free. */
|
|
7
|
+
href: string;
|
|
8
|
+
children?: ReactNode;
|
|
9
|
+
}
|
|
10
|
+
export declare function Source({ href, children, ...rest }: SourceProps): import("react").JSX.Element;
|
|
11
|
+
/** The reading list under a response: where this ink came from. */
|
|
12
|
+
export interface SourcesProps extends HTMLAttributes<HTMLOListElement> {
|
|
13
|
+
children?: ReactNode;
|
|
14
|
+
}
|
|
15
|
+
export declare function Sources({ children, ...rest }: SourcesProps): import("react").JSX.Element;
|
|
16
|
+
//#endregion
|
|
17
|
+
export { Source as AiSource, Sources as AiSources };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { injectComponentStyle } from "@bysages/core";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
//#region src/components/ai-source/index.tsx
|
|
4
|
+
function Source({ href, children, ...rest }) {
|
|
5
|
+
injectComponentStyle("ai");
|
|
6
|
+
return /* @__PURE__ */ jsx("li", {
|
|
7
|
+
"data-scope": "ai",
|
|
8
|
+
"data-part": "source",
|
|
9
|
+
children: /* @__PURE__ */ jsx("a", {
|
|
10
|
+
...rest,
|
|
11
|
+
href,
|
|
12
|
+
target: "_blank",
|
|
13
|
+
rel: "noreferrer",
|
|
14
|
+
children: children ?? href
|
|
15
|
+
})
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
function Sources({ children, ...rest }) {
|
|
19
|
+
return /* @__PURE__ */ jsx("ol", {
|
|
20
|
+
...rest,
|
|
21
|
+
"data-scope": "ai",
|
|
22
|
+
"data-part": "sources",
|
|
23
|
+
children
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
//#endregion
|
|
27
|
+
export { Source as AiSource, Source, Sources as AiSources, Sources };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { HTMLAttributes } from "react";
|
|
2
|
+
//#region src/components/ai-suggestion/index.d.ts
|
|
3
|
+
/** A seal-cut button proposing the next stroke; selection hands back
|
|
4
|
+
* the prompt. The shared Button in its outline register. */
|
|
5
|
+
export interface SuggestionProps extends Omit<HTMLAttributes<HTMLButtonElement>, "onSelect"> {
|
|
6
|
+
/** The next stroke this seal proposes — also its label; handed back
|
|
7
|
+
* whole on `onSelect`. */
|
|
8
|
+
prompt: string;
|
|
9
|
+
onSelect?: (prompt: string) => void;
|
|
10
|
+
}
|
|
11
|
+
export declare function Suggestion({ prompt, onSelect, ...rest }: SuggestionProps): import("react").JSX.Element;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { Suggestion as AiSuggestion };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Button } from "../button/index.mjs";
|
|
2
|
+
import { injectComponentStyle } from "@bysages/core";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/ai-suggestion/index.tsx
|
|
5
|
+
function Suggestion({ prompt, onSelect, ...rest }) {
|
|
6
|
+
injectComponentStyle("ai");
|
|
7
|
+
return /* @__PURE__ */ jsx(Button, {
|
|
8
|
+
variant: "outline",
|
|
9
|
+
size: "sm",
|
|
10
|
+
...rest,
|
|
11
|
+
onClick: () => onSelect?.(prompt),
|
|
12
|
+
children: prompt
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
export { Suggestion as AiSuggestion, Suggestion };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { HTMLAttributes, ReactNode } from "react";
|
|
2
|
+
//#region src/components/ai-tool/index.d.ts
|
|
3
|
+
export type ToolStatus = "pending" | "running" | "completed" | "error";
|
|
4
|
+
/** A tool call: the shared collapsible as the vessel — the name it was
|
|
5
|
+
* reached by and the state it reached in on the trigger, its input and
|
|
6
|
+
* output folded inside. */
|
|
7
|
+
export interface ToolProps extends HTMLAttributes<HTMLDivElement> {
|
|
8
|
+
/** The name the tool was reached by — shown raw on the trigger
|
|
9
|
+
* unless a `label` speaks friendlier words ("Searching pages…"). */
|
|
10
|
+
name: string;
|
|
11
|
+
label?: ReactNode;
|
|
12
|
+
/** The state the call reached — pending, running, completed, or
|
|
13
|
+
* error; stamped on the fold and whispered in the status chip. */
|
|
14
|
+
status?: ToolStatus;
|
|
15
|
+
defaultOpen?: boolean;
|
|
16
|
+
input?: ReactNode;
|
|
17
|
+
output?: ReactNode;
|
|
18
|
+
}
|
|
19
|
+
export declare function Tool({ name, label, status, input, output, ...rest }: ToolProps): import("react").JSX.Element;
|
|
20
|
+
//#endregion
|
|
21
|
+
export { Tool as AiTool };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { t as chevron } from "../../chevron-BeHvt46K.mjs";
|
|
2
|
+
import { Collapsible } from "../collapsible/index.mjs";
|
|
3
|
+
import { injectComponentStyle } from "@bysages/core";
|
|
4
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/ai-tool/index.tsx
|
|
6
|
+
function Tool({ name, label, status, input, output, ...rest }) {
|
|
7
|
+
injectComponentStyle("ai");
|
|
8
|
+
return /* @__PURE__ */ jsxs(Collapsible.Root, {
|
|
9
|
+
...rest,
|
|
10
|
+
"data-ai": "tool",
|
|
11
|
+
"data-status": status,
|
|
12
|
+
children: [/* @__PURE__ */ jsxs(Collapsible.Trigger, { children: [
|
|
13
|
+
/* @__PURE__ */ jsx("span", { children: label ?? name }),
|
|
14
|
+
status ? /* @__PURE__ */ jsx("span", {
|
|
15
|
+
"data-scope": "ai",
|
|
16
|
+
"data-part": "tool-status",
|
|
17
|
+
children: status.charAt(0).toUpperCase() + status.slice(1)
|
|
18
|
+
}) : null,
|
|
19
|
+
/* @__PURE__ */ jsx(Collapsible.Indicator, { children: chevron })
|
|
20
|
+
] }), /* @__PURE__ */ jsx(Collapsible.Content, { children: /* @__PURE__ */ jsxs("div", {
|
|
21
|
+
"data-scope": "ai",
|
|
22
|
+
"data-part": "tool-body",
|
|
23
|
+
children: [input ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", {
|
|
24
|
+
"data-scope": "ai",
|
|
25
|
+
"data-part": "tool-label",
|
|
26
|
+
children: "Input"
|
|
27
|
+
}), /* @__PURE__ */ jsx("pre", { children: input })] }) : null, output ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", {
|
|
28
|
+
"data-scope": "ai",
|
|
29
|
+
"data-part": "tool-label",
|
|
30
|
+
children: "Output"
|
|
31
|
+
}), /* @__PURE__ */ jsx("pre", { children: output })] }) : null]
|
|
32
|
+
}) })]
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
//#endregion
|
|
36
|
+
export { Tool as AiTool, Tool };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { HTMLAttributes, ReactNode } from "react";
|
|
2
|
+
//#region src/components/alert/index.d.ts
|
|
3
|
+
export type AlertStatus = "ink" | "info" | "success" | "warning" | "danger";
|
|
4
|
+
/** A notice drawn on the page: a wash of the status pigment, one heavier
|
|
5
|
+
* hairline on the leading edge, the serif for its title. Root, Icon,
|
|
6
|
+
* Body, Title, Description — the icon reads the status from the Root. */
|
|
7
|
+
export interface AlertProps extends HTMLAttributes<HTMLDivElement> {
|
|
8
|
+
status?: AlertStatus;
|
|
9
|
+
children?: ReactNode;
|
|
10
|
+
}
|
|
11
|
+
declare function AlertRoot({ status, children, ...rest }: AlertProps): import("react").JSX.Element;
|
|
12
|
+
declare function Icon(): import("react").JSX.Element;
|
|
13
|
+
declare function Body({ children, ...rest }: HTMLAttributes<HTMLDivElement>): import("react").JSX.Element;
|
|
14
|
+
declare function Title({ children, ...rest }: HTMLAttributes<HTMLParagraphElement>): import("react").JSX.Element;
|
|
15
|
+
declare function Description({ children, ...rest }: HTMLAttributes<HTMLParagraphElement>): import("react").JSX.Element;
|
|
16
|
+
export declare const Alert: typeof AlertRoot & {
|
|
17
|
+
Root: typeof AlertRoot;
|
|
18
|
+
Icon: typeof Icon;
|
|
19
|
+
Body: typeof Body;
|
|
20
|
+
Title: typeof Title;
|
|
21
|
+
Description: typeof Description;
|
|
22
|
+
};
|
|
23
|
+
//#endregion
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { injectComponentStyle } from "@bysages/core";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { createContext, useContext } from "react";
|
|
4
|
+
//#region src/components/alert/index.tsx
|
|
5
|
+
const StatusContext = createContext("ink");
|
|
6
|
+
function glyph(status) {
|
|
7
|
+
return /* @__PURE__ */ jsx("svg", {
|
|
8
|
+
width: 16,
|
|
9
|
+
height: 16,
|
|
10
|
+
viewBox: "0 0 24 24",
|
|
11
|
+
fill: "none",
|
|
12
|
+
stroke: "currentColor",
|
|
13
|
+
strokeWidth: 1.75,
|
|
14
|
+
strokeLinecap: "round",
|
|
15
|
+
strokeLinejoin: "round",
|
|
16
|
+
"aria-hidden": "true",
|
|
17
|
+
children: /* @__PURE__ */ jsx("path", { d: {
|
|
18
|
+
info: "M12 8v5m0 3v.01M12 3a9 9 0 1 0 0 18 9 9 0 0 0 0-18Z",
|
|
19
|
+
success: "m4 12.5 5 5L20 6.5",
|
|
20
|
+
warning: "M12 4 2.5 20h19L12 4Zm0 6v4m0 3v.01",
|
|
21
|
+
danger: "M6 6l12 12M18 6 6 18",
|
|
22
|
+
ink: "M12 8v5m0 3v.01M12 3a9 9 0 1 0 0 18 9 9 0 0 0 0-18Z"
|
|
23
|
+
}[status] })
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
function AlertRoot({ status = "ink", children, ...rest }) {
|
|
27
|
+
return /* @__PURE__ */ jsx(StatusContext.Provider, {
|
|
28
|
+
value: status,
|
|
29
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
30
|
+
...rest,
|
|
31
|
+
role: status === "ink" || status === "info" ? "status" : "alert",
|
|
32
|
+
"data-scope": "alert",
|
|
33
|
+
"data-part": "root",
|
|
34
|
+
"data-status": status,
|
|
35
|
+
children
|
|
36
|
+
})
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
function Icon() {
|
|
40
|
+
const status = useContext(StatusContext);
|
|
41
|
+
return /* @__PURE__ */ jsx("span", {
|
|
42
|
+
"data-scope": "alert",
|
|
43
|
+
"data-part": "icon",
|
|
44
|
+
children: glyph(status)
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
function Body({ children, ...rest }) {
|
|
48
|
+
return /* @__PURE__ */ jsx("div", {
|
|
49
|
+
...rest,
|
|
50
|
+
"data-scope": "alert",
|
|
51
|
+
"data-part": "body",
|
|
52
|
+
children
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
function Title({ children, ...rest }) {
|
|
56
|
+
return /* @__PURE__ */ jsx("p", {
|
|
57
|
+
...rest,
|
|
58
|
+
"data-scope": "alert",
|
|
59
|
+
"data-part": "title",
|
|
60
|
+
children
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
function Description({ children, ...rest }) {
|
|
64
|
+
return /* @__PURE__ */ jsx("p", {
|
|
65
|
+
...rest,
|
|
66
|
+
"data-scope": "alert",
|
|
67
|
+
"data-part": "description",
|
|
68
|
+
children
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
const Alert = Object.assign(AlertRoot, {
|
|
72
|
+
Root: AlertRoot,
|
|
73
|
+
Icon,
|
|
74
|
+
Body,
|
|
75
|
+
Title,
|
|
76
|
+
Description
|
|
77
|
+
});
|
|
78
|
+
injectComponentStyle("alert");
|
|
79
|
+
//#endregion
|
|
80
|
+
export { Alert };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ComponentProps } from "react";
|
|
2
|
+
import { AngleSlider as AngleSlider$1 } from "@ark-ui/react/angle-slider";
|
|
3
|
+
//#region src/components/angle-slider/index.d.ts
|
|
4
|
+
type AngleSliderRootProps = ComponentProps<typeof AngleSlider$1.Root> & {
|
|
5
|
+
/** One rung of the dial ladder — the diameter the needle sweeps. */
|
|
6
|
+
size?: "sm" | "md" | "lg";
|
|
7
|
+
};
|
|
8
|
+
declare function AngleSliderRoot({ size, ...rest }: AngleSliderRootProps): import("react").JSX.Element;
|
|
9
|
+
/** Ark's AngleSlider, dressed in the paper-and-ink system: a flat paper dial
|
|
10
|
+
* the thumb sweeps as a pigment needle over hairline degree ticks. The API
|
|
11
|
+
* is Ark's own — Root, Label, ValueText, Control, Thumb, MarkerGroup,
|
|
12
|
+
* Marker, HiddenInput. */
|
|
13
|
+
export declare const AngleSlider: Omit<typeof AngleSlider$1, "Root"> & {
|
|
14
|
+
Root: typeof AngleSliderRoot;
|
|
15
|
+
};
|
|
16
|
+
//#endregion
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { injectComponentStyle } from "@bysages/core";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { AngleSlider as AngleSlider$1 } from "@ark-ui/react/angle-slider";
|
|
4
|
+
//#region src/components/angle-slider/index.tsx
|
|
5
|
+
function AngleSliderRoot({ size = "md", ...rest }) {
|
|
6
|
+
return /* @__PURE__ */ jsx(AngleSlider$1.Root, {
|
|
7
|
+
...rest,
|
|
8
|
+
"data-size": size
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
/** Ark's AngleSlider, dressed in the paper-and-ink system: a flat paper dial
|
|
12
|
+
* the thumb sweeps as a pigment needle over hairline degree ticks. The API
|
|
13
|
+
* is Ark's own — Root, Label, ValueText, Control, Thumb, MarkerGroup,
|
|
14
|
+
* Marker, HiddenInput. */
|
|
15
|
+
const AngleSlider = {
|
|
16
|
+
...AngleSlider$1,
|
|
17
|
+
Root: AngleSliderRoot
|
|
18
|
+
};
|
|
19
|
+
injectComponentStyle("angle-slider");
|
|
20
|
+
//#endregion
|
|
21
|
+
export { AngleSlider };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { HTMLAttributes } from "react";
|
|
2
|
+
//#region src/components/aspect-ratio/index.d.ts
|
|
3
|
+
/** A frame that keeps its shape: the box holds the given ratio whatever
|
|
4
|
+
* the width it is dealt, and the child fills the frame it is given. */
|
|
5
|
+
export interface AspectRatioProps extends HTMLAttributes<HTMLDivElement> {
|
|
6
|
+
/** A CSS `aspect-ratio` value — "16 / 9", "4 / 3", "1 / 1". */
|
|
7
|
+
ratio?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function AspectRatio({ ratio, ...rest }: AspectRatioProps): import("react").JSX.Element;
|
|
10
|
+
//#endregion
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { injectComponentStyle } from "@bysages/core";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
//#region src/components/aspect-ratio/index.tsx
|
|
4
|
+
function AspectRatio({ ratio = "1 / 1", ...rest }) {
|
|
5
|
+
injectComponentStyle("aspect-ratio");
|
|
6
|
+
return /* @__PURE__ */ jsx("div", {
|
|
7
|
+
...rest,
|
|
8
|
+
style: {
|
|
9
|
+
...rest.style,
|
|
10
|
+
"--bs-aspect-ratio": ratio
|
|
11
|
+
},
|
|
12
|
+
"data-scope": "aspect-ratio",
|
|
13
|
+
"data-part": "root"
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
17
|
+
export { AspectRatio };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { HTMLAttributes } from "react";
|
|
2
|
+
//#region src/components/autocomplete/index.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Free text with suggestions: the reader types anything, the list
|
|
5
|
+
* narrows to help, and both a pick and a custom value end up in the
|
|
6
|
+
* same `value`. A preset of the combobox machinery — same parts, same
|
|
7
|
+
* styling, one job. `items` seeds the suggestion list once; matching is
|
|
8
|
+
* a case-insensitive substring unless `filter` says otherwise.
|
|
9
|
+
*/
|
|
10
|
+
export interface AutoCompleteProps extends Omit<HTMLAttributes<HTMLDivElement>, "defaultValue" | "onSelect"> {
|
|
11
|
+
value?: string;
|
|
12
|
+
items?: string[];
|
|
13
|
+
placeholder?: string;
|
|
14
|
+
/** Field text to match against; defaults to the item itself. */
|
|
15
|
+
filter?: (item: string, input: string) => boolean;
|
|
16
|
+
/** One rung of the control-height ladder for the field row. */
|
|
17
|
+
size?: "sm" | "md" | "lg";
|
|
18
|
+
onValueChange?: (value: string) => void;
|
|
19
|
+
}
|
|
20
|
+
export declare function AutoComplete({ value, items, placeholder, filter, size, onValueChange, ...rest }: AutoCompleteProps): import("react").JSX.Element;
|
|
21
|
+
//#endregion
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { injectComponentStyle } from "@bysages/core";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Portal } from "@ark-ui/react/portal";
|
|
4
|
+
import { useListCollection } from "@ark-ui/react/collection";
|
|
5
|
+
import { Combobox } from "@ark-ui/react/combobox";
|
|
6
|
+
//#region src/components/autocomplete/index.tsx
|
|
7
|
+
function AutoComplete({ value = "", items = [], placeholder, filter, size = "md", onValueChange, ...rest }) {
|
|
8
|
+
injectComponentStyle("combobox");
|
|
9
|
+
const { collection, filter: filterItems } = useListCollection({
|
|
10
|
+
initialItems: items,
|
|
11
|
+
filter: (item, input) => filter ? filter(item, input) : item.toLowerCase().includes(input.toLowerCase())
|
|
12
|
+
});
|
|
13
|
+
return /* @__PURE__ */ jsxs(Combobox.Root, {
|
|
14
|
+
...rest,
|
|
15
|
+
collection,
|
|
16
|
+
inputValue: value,
|
|
17
|
+
allowCustomValue: true,
|
|
18
|
+
"data-size": size,
|
|
19
|
+
onValueChange: (details) => {
|
|
20
|
+
const [first] = details.value;
|
|
21
|
+
if (first != null) onValueChange?.(first);
|
|
22
|
+
},
|
|
23
|
+
onInputValueChange: (details) => {
|
|
24
|
+
filterItems(details.inputValue);
|
|
25
|
+
onValueChange?.(details.inputValue);
|
|
26
|
+
},
|
|
27
|
+
positioning: { sameWidth: true },
|
|
28
|
+
children: [/* @__PURE__ */ jsx(Combobox.Control, { children: /* @__PURE__ */ jsx(Combobox.Input, { placeholder }) }), /* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsx(Combobox.Positioner, { children: /* @__PURE__ */ jsxs(Combobox.Content, { children: [/* @__PURE__ */ jsx(Combobox.Empty, { children: "No matches" }), collection.items.map((item) => /* @__PURE__ */ jsx(Combobox.Item, {
|
|
29
|
+
item,
|
|
30
|
+
children: /* @__PURE__ */ jsx(Combobox.ItemText, { children: item })
|
|
31
|
+
}, item))] }) }) })]
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
//#endregion
|
|
35
|
+
export { AutoComplete };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ComponentProps } from "react";
|
|
2
|
+
import { Avatar as Avatar$1 } from "@ark-ui/react/avatar";
|
|
3
|
+
//#region src/components/avatar/index.d.ts
|
|
4
|
+
/** Avatar, dressed in the paper-and-ink system: a circular seal on
|
|
5
|
+
* inset paper that holds initials until the image loads over them.
|
|
6
|
+
* `size` picks a control-height rung for the seal — the core styles
|
|
7
|
+
* re-point `--bs-avatar-size` per rung, and scenes can still retune the
|
|
8
|
+
* variable directly. */
|
|
9
|
+
export type AvatarSize = "sm" | "md" | "lg";
|
|
10
|
+
export interface AvatarProps extends ComponentProps<typeof Avatar$1.Root> {
|
|
11
|
+
/** Seal diameter: the small, medium, or large control rung. The
|
|
12
|
+
* default (large) stands as tall as the biggest control so an avatar
|
|
13
|
+
* rides a row without stretching it. */
|
|
14
|
+
size?: AvatarSize;
|
|
15
|
+
/** The corner: round by default; square cuts it sharp, a stamp
|
|
16
|
+
* beside a round portrait. */
|
|
17
|
+
shape?: "circle" | "square";
|
|
18
|
+
}
|
|
19
|
+
declare function AvatarRoot({ size, shape, ...rest }: AvatarProps): import("react").JSX.Element;
|
|
20
|
+
export declare const Avatar: typeof Avatar$1 & {
|
|
21
|
+
Root: typeof AvatarRoot;
|
|
22
|
+
};
|
|
23
|
+
//#endregion
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { injectComponentStyle } from "@bysages/core";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { Avatar as Avatar$1 } from "@ark-ui/react/avatar";
|
|
4
|
+
//#region src/components/avatar/index.tsx
|
|
5
|
+
function AvatarRoot({ size, shape = "circle", ...rest }) {
|
|
6
|
+
return /* @__PURE__ */ jsx(Avatar$1.Root, {
|
|
7
|
+
...rest,
|
|
8
|
+
"data-size": size,
|
|
9
|
+
"data-shape": shape
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
const Avatar = Object.assign({}, Avatar$1, { Root: AvatarRoot });
|
|
13
|
+
injectComponentStyle("avatar");
|
|
14
|
+
//#endregion
|
|
15
|
+
export { Avatar };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { HTMLAttributes } from "react";
|
|
2
|
+
//#region src/components/avatar-group/index.d.ts
|
|
3
|
+
/** Avatars overlapping one row, each rimmed in the ground so the pile
|
|
4
|
+
* stays legible. */
|
|
5
|
+
export interface AvatarGroupProps extends HTMLAttributes<HTMLDivElement> {
|
|
6
|
+
/** One register for every seal: falls onto data-size for the
|
|
7
|
+
* stylesheet to re-point the avatars' measure. */
|
|
8
|
+
size?: "sm" | "md" | "lg";
|
|
9
|
+
}
|
|
10
|
+
export declare function AvatarGroup({ size, children, ...rest }: AvatarGroupProps): import("react").JSX.Element;
|
|
11
|
+
//#endregion
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { injectComponentStyle } from "@bysages/core";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
//#region src/components/avatar-group/index.tsx
|
|
4
|
+
function AvatarGroup({ size, children, ...rest }) {
|
|
5
|
+
injectComponentStyle("avatar-group");
|
|
6
|
+
return /* @__PURE__ */ jsx("div", {
|
|
7
|
+
...rest,
|
|
8
|
+
"data-scope": "avatar-group",
|
|
9
|
+
"data-part": "root",
|
|
10
|
+
"data-size": size,
|
|
11
|
+
children
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
//#endregion
|
|
15
|
+
export { AvatarGroup };
|