@bysages/react 0.2.3 → 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/components/ai/index.d.mts +2 -2
- package/dist/components/ai/index.mjs +10 -10
- package/dist/components/avatar/index.d.mts +4 -1
- package/dist/components/avatar/index.mjs +3 -2
- 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/browser/index.d.mts +23 -0
- package/dist/components/browser/index.mjs +70 -0
- package/dist/components/cascade-select/index.mjs +9 -3
- package/dist/components/data-view/index.d.mts +18 -0
- package/dist/components/data-view/index.mjs +64 -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 +13 -5
- package/dist/components/descriptions/index.mjs +20 -2
- package/dist/components/dock/index.d.mts +25 -0
- package/dist/components/dock/index.mjs +51 -0
- package/dist/components/dynamic-input/index.mjs +1 -1
- package/dist/components/form/index.mjs +1 -1
- package/dist/components/icon/index.d.mts +10 -5
- package/dist/components/icon/index.mjs +7 -7
- package/dist/components/input/index.d.mts +4 -1
- package/dist/components/input/index.mjs +1 -20
- package/dist/components/order-list/index.d.mts +21 -0
- package/dist/components/order-list/index.mjs +162 -0
- package/dist/components/result/index.d.mts +31 -0
- package/dist/components/result/index.mjs +59 -0
- package/dist/components/select/index.d.mts +2 -17
- package/dist/components/select/index.mjs +2 -18
- package/dist/components/spotlight/index.d.mts +12 -0
- package/dist/components/spotlight/index.mjs +33 -0
- package/dist/components/table/index.mjs +1 -1
- package/dist/components/tabs/index.d.mts +3 -1
- package/dist/components/tabs/index.mjs +3 -2
- package/dist/components/terminal/index.d.mts +17 -0
- package/dist/components/terminal/index.mjs +65 -0
- package/dist/components/timeline/index.d.mts +13 -11
- package/dist/components/timeline/index.mjs +11 -1
- package/dist/components/toolbar/index.d.mts +17 -0
- package/dist/components/toolbar/index.mjs +29 -0
- package/dist/components/transfer/index.mjs +1 -1
- package/dist/components/tree-select/index.mjs +1 -1
- 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/{index-DaAbbSz9.d.mts → index-CsfxYv6J.d.mts} +741 -3774
- package/dist/index-DFN9F5Zt.d.mts +42 -0
- package/dist/index.d.mts +16 -3
- package/dist/index.mjs +26 -13
- package/dist/input-2oezH-dY.mjs +58 -0
- package/dist/select-D1xiT1oJ.mjs +68 -0
- package/package.json +30 -9
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Button } from "../button/index.mjs";
|
|
2
|
-
import { Input } from "
|
|
2
|
+
import { t as Input } from "../../input-2oezH-dY.mjs";
|
|
3
3
|
import { injectComponentStyle } from "@bysages/core";
|
|
4
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
//#region src/components/dynamic-input/index.tsx
|
|
@@ -40,7 +40,7 @@ function FormField({ form: formProp, name, label, hint, required = false, invali
|
|
|
40
40
|
const errors = (!meta ? [] : meta.isTouched ? meta.errors ?? [] : [meta.errorMap?.onSubmit].flat().filter(Boolean)).map(errorText).filter(Boolean);
|
|
41
41
|
const isInvalid = invalid || errors.length > 0;
|
|
42
42
|
return /* @__PURE__ */ jsx("div", {
|
|
43
|
-
|
|
43
|
+
className: klass,
|
|
44
44
|
style,
|
|
45
45
|
"data-form-field": name,
|
|
46
46
|
children: /* @__PURE__ */ jsxs(Field.Root, {
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { HTMLAttributes } from "react";
|
|
2
|
+
import { IconifyIcon } from "@bysages/core/icons";
|
|
2
3
|
//#region src/components/icon/index.d.ts
|
|
3
4
|
/** The inkwell: a standard box that keeps any inline svg at its optical
|
|
4
5
|
* measure and in the text's own ink — the icon carries no pigment and no
|
|
5
|
-
* size of its own. Bring a glyph through `
|
|
6
|
-
*
|
|
6
|
+
* size of its own. Bring a glyph through `glyph` (a direct registry
|
|
7
|
+
* import), through `name` from the whitelisted registry, or bring your
|
|
8
|
+
* own; the well renders either. */
|
|
7
9
|
export interface IconProps extends HTMLAttributes<HTMLSpanElement> {
|
|
8
10
|
/** Size steps follow the surrounding font size; `inherit` is the
|
|
9
11
|
* default — one em of the text the icon sits in. */
|
|
@@ -11,9 +13,12 @@ export interface IconProps extends HTMLAttributes<HTMLSpanElement> {
|
|
|
11
13
|
/** The accessible name. Without it the icon is presentation-only and
|
|
12
14
|
* hidden from the accessibility tree. */
|
|
13
15
|
label?: string;
|
|
14
|
-
/** A glyph from the registry. Ignored when children
|
|
15
|
-
* explicit glyph always wins
|
|
16
|
+
/** A glyph from the registry, imported directly. Ignored when children
|
|
17
|
+
* are given — an explicit glyph always wins. */
|
|
18
|
+
glyph?: IconifyIcon;
|
|
19
|
+
/** A registry name — only the whitelisted set the wrappers draw
|
|
20
|
+
* themselves. Ignored when `glyph` or children are given. */
|
|
16
21
|
name?: string;
|
|
17
22
|
}
|
|
18
|
-
export declare function Icon({ size, label, name, children, ...rest }: IconProps): import("react").JSX.Element;
|
|
23
|
+
export declare function Icon({ size, label, glyph, name, children, ...rest }: IconProps): import("react").JSX.Element;
|
|
19
24
|
//#endregion
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { injectComponentStyle } from "@bysages/core";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
import { getIcon } from "@bysages/icons";
|
|
3
|
+
import { getIcon } from "@bysages/core/icons";
|
|
4
4
|
//#region src/components/icon/index.tsx
|
|
5
|
-
function Icon({ size = "inherit", label, name, children, ...rest }) {
|
|
5
|
+
function Icon({ size = "inherit", label, glyph, name, children, ...rest }) {
|
|
6
6
|
injectComponentStyle("icon");
|
|
7
|
-
const
|
|
8
|
-
if (name && children == null && !
|
|
7
|
+
const resolved = glyph ?? (name && children == null ? getIcon(name) : void 0);
|
|
8
|
+
if (name && children == null && glyph == null && !resolved) console.error(`[icons] unknown icon name "${name}" — not in the wrappers' whitelist; import the glyph from @bysages/icons and pass it as glyph`);
|
|
9
9
|
return /* @__PURE__ */ jsx("span", {
|
|
10
10
|
...rest,
|
|
11
11
|
role: label != null ? "img" : void 0,
|
|
@@ -14,11 +14,11 @@ function Icon({ size = "inherit", label, name, children, ...rest }) {
|
|
|
14
14
|
"data-scope": "icon",
|
|
15
15
|
"data-part": "root",
|
|
16
16
|
"data-size": size,
|
|
17
|
-
children: children ?? (
|
|
18
|
-
viewBox: `0 0 ${
|
|
17
|
+
children: children ?? (resolved ? /* @__PURE__ */ jsx("svg", {
|
|
18
|
+
viewBox: `0 0 ${resolved.width ?? 24} ${resolved.height ?? 24}`,
|
|
19
19
|
fill: "currentColor",
|
|
20
20
|
"aria-hidden": "true",
|
|
21
|
-
dangerouslySetInnerHTML: { __html:
|
|
21
|
+
dangerouslySetInnerHTML: { __html: resolved.body }
|
|
22
22
|
}) : null)
|
|
23
23
|
});
|
|
24
24
|
}
|
|
@@ -10,7 +10,10 @@ export interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>,
|
|
|
10
10
|
value?: string | number;
|
|
11
11
|
size?: "sm" | "md" | "lg";
|
|
12
12
|
invalid?: boolean;
|
|
13
|
+
/** Entry mask - `9` digit, `a` letter, `*` either, anything else is
|
|
14
|
+
* literal. e.g. `"999-99-9999"`, `"(999) 999-9999"`. */
|
|
15
|
+
mask?: string;
|
|
13
16
|
onValueChange?: (value: string) => void;
|
|
14
17
|
}
|
|
15
|
-
export declare
|
|
18
|
+
export declare const Input: import("react").ForwardRefExoticComponent<InputProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
16
19
|
//#endregion
|
|
@@ -1,21 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
import { useFieldContext } from "@ark-ui/react/field";
|
|
4
|
-
//#region src/components/input/index.tsx
|
|
5
|
-
function Input({ value, size = "md", invalid = false, onValueChange, ...rest }) {
|
|
6
|
-
injectComponentStyle("input");
|
|
7
|
-
const field = useFieldContext();
|
|
8
|
-
const fieldProps = field?.getInputProps() ?? {};
|
|
9
|
-
return /* @__PURE__ */ jsx("input", {
|
|
10
|
-
...fieldProps,
|
|
11
|
-
...rest,
|
|
12
|
-
...value !== void 0 ? { value } : {},
|
|
13
|
-
"data-scope": "input",
|
|
14
|
-
"data-part": "root",
|
|
15
|
-
"data-size": size,
|
|
16
|
-
"data-invalid": invalid || field?.invalid ? "" : void 0,
|
|
17
|
-
onChange: (event) => onValueChange?.(event.target.value)
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
//#endregion
|
|
1
|
+
import { t as Input } from "../../input-2oezH-dY.mjs";
|
|
21
2
|
export { Input };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { HTMLAttributes } from "react";
|
|
2
|
+
//#region src/components/order-list/index.d.ts
|
|
3
|
+
export interface OrderOption {
|
|
4
|
+
label: string;
|
|
5
|
+
value: string;
|
|
6
|
+
}
|
|
7
|
+
export interface OrderListProps extends HTMLAttributes<HTMLDivElement> {
|
|
8
|
+
/** The rows in their current order — the value is the order. */
|
|
9
|
+
value: string[];
|
|
10
|
+
/** Every row the ledger knows, in no particular order. */
|
|
11
|
+
options: OrderOption[];
|
|
12
|
+
label?: string;
|
|
13
|
+
onValueChange?: (value: string[]) => void;
|
|
14
|
+
}
|
|
15
|
+
/** A ledger the reader may rewrite: rows move by grip or by the side
|
|
16
|
+
* arrows, and the group reports the new order as the value itself —
|
|
17
|
+
* the model is the order. Dragging rides the native drag events — a
|
|
18
|
+
* hairline of primary ink marks the seam the row will land on — so
|
|
19
|
+
* touch keeps the buttons as its route. */
|
|
20
|
+
export declare function OrderList({ value, options, label, onValueChange, ...rest }: OrderListProps): import("react").JSX.Element;
|
|
21
|
+
//#endregion
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { injectComponentStyle } from "@bysages/core";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useRef, useState } from "react";
|
|
4
|
+
//#region src/components/order-list/index.tsx
|
|
5
|
+
const ARROWS = {
|
|
6
|
+
up: ["m18 15-6-6-6 6"],
|
|
7
|
+
down: ["m6 9 6 6 6-6"],
|
|
8
|
+
top: ["m18 15-6-6-6 6", "M5 4h14"],
|
|
9
|
+
bottom: ["m6 9 6 6 6-6", "M5 20h14"]
|
|
10
|
+
};
|
|
11
|
+
function arrowGlyph(paths) {
|
|
12
|
+
return /* @__PURE__ */ jsx("svg", {
|
|
13
|
+
viewBox: "0 0 24 24",
|
|
14
|
+
width: 12,
|
|
15
|
+
height: 12,
|
|
16
|
+
fill: "none",
|
|
17
|
+
stroke: "currentColor",
|
|
18
|
+
strokeWidth: 2,
|
|
19
|
+
strokeLinecap: "round",
|
|
20
|
+
strokeLinejoin: "round",
|
|
21
|
+
"aria-hidden": "true",
|
|
22
|
+
children: paths.map((d) => /* @__PURE__ */ jsx("path", { d }, d))
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
/** A ledger the reader may rewrite: rows move by grip or by the side
|
|
26
|
+
* arrows, and the group reports the new order as the value itself —
|
|
27
|
+
* the model is the order. Dragging rides the native drag events — a
|
|
28
|
+
* hairline of primary ink marks the seam the row will land on — so
|
|
29
|
+
* touch keeps the buttons as its route. */
|
|
30
|
+
function OrderList({ value, options, label, onValueChange, ...rest }) {
|
|
31
|
+
injectComponentStyle("order-list");
|
|
32
|
+
const dragging = useRef(null);
|
|
33
|
+
const [dropLine, setDropLine] = useState(null);
|
|
34
|
+
const rows = value.map((entry) => options.find((option) => option.value === entry)).filter((option) => option != null);
|
|
35
|
+
function reset() {
|
|
36
|
+
dragging.current = null;
|
|
37
|
+
setDropLine(null);
|
|
38
|
+
}
|
|
39
|
+
function move(entry, offset) {
|
|
40
|
+
const next = [...value];
|
|
41
|
+
const from = next.indexOf(entry);
|
|
42
|
+
const to = Math.max(0, Math.min(next.length - 1, from + offset));
|
|
43
|
+
if (from === to) return;
|
|
44
|
+
next.splice(to, 0, ...next.splice(from, 1));
|
|
45
|
+
onValueChange?.(next);
|
|
46
|
+
}
|
|
47
|
+
function drop() {
|
|
48
|
+
const entry = dragging.current;
|
|
49
|
+
if (entry == null) return;
|
|
50
|
+
const seam = dropLine;
|
|
51
|
+
const from = value.indexOf(entry);
|
|
52
|
+
if (seam && seam.index === from) return reset();
|
|
53
|
+
const next = value.filter((candidate) => candidate !== entry);
|
|
54
|
+
let at = seam ? seam.before ? seam.index : seam.index + 1 : next.length;
|
|
55
|
+
if (from < at) at -= 1;
|
|
56
|
+
next.splice(Math.max(0, Math.min(next.length, at)), 0, entry);
|
|
57
|
+
onValueChange?.(next);
|
|
58
|
+
reset();
|
|
59
|
+
}
|
|
60
|
+
function over(event, index, entry) {
|
|
61
|
+
event.preventDefault();
|
|
62
|
+
if (event.dataTransfer) event.dataTransfer.dropEffect = "move";
|
|
63
|
+
const rect = event.currentTarget.getBoundingClientRect();
|
|
64
|
+
const before = event.clientY < rect.top + rect.height / 2;
|
|
65
|
+
setDropLine(dragging.current != null && !(entry.value === dragging.current && before) ? {
|
|
66
|
+
index,
|
|
67
|
+
before
|
|
68
|
+
} : null);
|
|
69
|
+
}
|
|
70
|
+
return /* @__PURE__ */ jsx("div", {
|
|
71
|
+
...rest,
|
|
72
|
+
role: "listbox",
|
|
73
|
+
"aria-label": label ?? void 0,
|
|
74
|
+
"aria-multiselectable": false,
|
|
75
|
+
"data-scope": "order-list",
|
|
76
|
+
"data-part": "root",
|
|
77
|
+
onDragLeave: (event) => {
|
|
78
|
+
const host = event.currentTarget;
|
|
79
|
+
if (!event.relatedTarget || !host.contains(event.relatedTarget)) setDropLine(null);
|
|
80
|
+
},
|
|
81
|
+
children: /* @__PURE__ */ jsx("ol", {
|
|
82
|
+
"data-scope": "order-list",
|
|
83
|
+
"data-part": "list",
|
|
84
|
+
children: rows.map((option, index) => {
|
|
85
|
+
const seam = dropLine && dropLine.index === index ? dropLine.before ? "top" : "bottom" : void 0;
|
|
86
|
+
return /* @__PURE__ */ jsxs("li", {
|
|
87
|
+
role: "option",
|
|
88
|
+
"aria-selected": true,
|
|
89
|
+
draggable: true,
|
|
90
|
+
"data-scope": "order-list",
|
|
91
|
+
"data-part": "item",
|
|
92
|
+
"data-dragging": dragging.current === option.value ? "" : void 0,
|
|
93
|
+
"data-drop-line": seam,
|
|
94
|
+
onDragStart: (event) => {
|
|
95
|
+
dragging.current = option.value;
|
|
96
|
+
event.dataTransfer?.setData("text/plain", option.value);
|
|
97
|
+
if (event.dataTransfer) event.dataTransfer.effectAllowed = "move";
|
|
98
|
+
},
|
|
99
|
+
onDragEnd: reset,
|
|
100
|
+
onDragOver: (event) => over(event, index, option),
|
|
101
|
+
onDrop: (event) => {
|
|
102
|
+
event.preventDefault();
|
|
103
|
+
drop();
|
|
104
|
+
},
|
|
105
|
+
children: [
|
|
106
|
+
/* @__PURE__ */ jsx("span", {
|
|
107
|
+
"data-scope": "order-list",
|
|
108
|
+
"data-part": "grip",
|
|
109
|
+
"aria-hidden": "true",
|
|
110
|
+
children: "⋮⋮"
|
|
111
|
+
}),
|
|
112
|
+
/* @__PURE__ */ jsx("span", {
|
|
113
|
+
"data-scope": "order-list",
|
|
114
|
+
"data-part": "label",
|
|
115
|
+
children: option.label
|
|
116
|
+
}),
|
|
117
|
+
/* @__PURE__ */ jsx("span", {
|
|
118
|
+
"data-scope": "order-list",
|
|
119
|
+
"data-part": "controls",
|
|
120
|
+
children: [
|
|
121
|
+
[
|
|
122
|
+
"Move to top",
|
|
123
|
+
ARROWS.top,
|
|
124
|
+
-index,
|
|
125
|
+
0
|
|
126
|
+
],
|
|
127
|
+
[
|
|
128
|
+
"Move up",
|
|
129
|
+
ARROWS.up,
|
|
130
|
+
-1,
|
|
131
|
+
0
|
|
132
|
+
],
|
|
133
|
+
[
|
|
134
|
+
"Move down",
|
|
135
|
+
ARROWS.down,
|
|
136
|
+
1,
|
|
137
|
+
rows.length - 1
|
|
138
|
+
],
|
|
139
|
+
[
|
|
140
|
+
"Move to bottom",
|
|
141
|
+
ARROWS.bottom,
|
|
142
|
+
rows.length - 1 - index,
|
|
143
|
+
rows.length - 1
|
|
144
|
+
]
|
|
145
|
+
].map(([aria, paths, offset, edge]) => /* @__PURE__ */ jsx("button", {
|
|
146
|
+
type: "button",
|
|
147
|
+
"aria-label": aria,
|
|
148
|
+
"data-scope": "order-list",
|
|
149
|
+
"data-part": "move",
|
|
150
|
+
disabled: index === edge,
|
|
151
|
+
onClick: () => move(option.value, offset),
|
|
152
|
+
children: arrowGlyph([...paths])
|
|
153
|
+
}, aria))
|
|
154
|
+
})
|
|
155
|
+
]
|
|
156
|
+
}, option.value);
|
|
157
|
+
})
|
|
158
|
+
})
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
//#endregion
|
|
162
|
+
export { OrderList };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { HTMLAttributes, ReactNode } from "react";
|
|
2
|
+
//#region src/components/result/index.d.ts
|
|
3
|
+
type Status = "success" | "warning" | "danger" | "info";
|
|
4
|
+
export interface ResultRootProps extends HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
/** The verdict the operation returned; the fixed pigments speak it. */
|
|
6
|
+
status?: Status;
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
}
|
|
9
|
+
export declare function ResultRoot({ status, children, ...rest }: ResultRootProps): import("react").JSX.Element;
|
|
10
|
+
/** The mark carries all four verdicts and lets the root choose, so the
|
|
11
|
+
* icon can never drift from the status the root declares. */
|
|
12
|
+
export declare function ResultIcon({ children, ...rest }: HTMLAttributes<HTMLDivElement> & {
|
|
13
|
+
children?: ReactNode;
|
|
14
|
+
}): import("react").JSX.Element;
|
|
15
|
+
/** A verdict drawn after the deed: the mark washes in the fixed
|
|
16
|
+
* pigment, the title rides the serif, and the extra carries the way
|
|
17
|
+
* onward. Any subset composes. */
|
|
18
|
+
export declare const Result: {
|
|
19
|
+
Root: typeof ResultRoot;
|
|
20
|
+
Icon: typeof ResultIcon;
|
|
21
|
+
Title: ({ children, ...rest }: HTMLAttributes<HTMLElement> & {
|
|
22
|
+
children?: ReactNode;
|
|
23
|
+
}) => import("react").JSX.Element;
|
|
24
|
+
Description: ({ children, ...rest }: HTMLAttributes<HTMLElement> & {
|
|
25
|
+
children?: ReactNode;
|
|
26
|
+
}) => import("react").JSX.Element;
|
|
27
|
+
Extra: ({ children, ...rest }: HTMLAttributes<HTMLElement> & {
|
|
28
|
+
children?: ReactNode;
|
|
29
|
+
}) => import("react").JSX.Element;
|
|
30
|
+
};
|
|
31
|
+
//#endregion
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { injectComponentStyle } from "@bysages/core";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
//#region src/components/result/index.tsx
|
|
4
|
+
const MARK = "<g data-for=\"success\"><path d=\"M20 6 9 17l-5-5\"/></g><g data-for=\"warning\"><path d=\"M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0Z\"/><path d=\"M12 9v4\"/><path d=\"M12 17h.01\"/></g><g data-for=\"danger\"><circle cx=\"12\" cy=\"12\" r=\"10\"/><path d=\"m15 9-6 6\"/><path d=\"m9 9 6 6\"/></g><g data-for=\"info\"><circle cx=\"12\" cy=\"12\" r=\"10\"/><path d=\"M12 16v-4\"/><path d=\"M12 8h.01\"/></g>";
|
|
5
|
+
function ResultRoot({ status = "info", children, ...rest }) {
|
|
6
|
+
injectComponentStyle("result");
|
|
7
|
+
return /* @__PURE__ */ jsx("div", {
|
|
8
|
+
...rest,
|
|
9
|
+
"data-scope": "result",
|
|
10
|
+
"data-part": "root",
|
|
11
|
+
"data-status": status,
|
|
12
|
+
children
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
/** The mark carries all four verdicts and lets the root choose, so the
|
|
16
|
+
* icon can never drift from the status the root declares. */
|
|
17
|
+
function ResultIcon({ children, ...rest }) {
|
|
18
|
+
injectComponentStyle("result");
|
|
19
|
+
return /* @__PURE__ */ jsx("div", {
|
|
20
|
+
...rest,
|
|
21
|
+
"data-scope": "result",
|
|
22
|
+
"data-part": "icon",
|
|
23
|
+
children: children ?? /* @__PURE__ */ jsx("svg", {
|
|
24
|
+
width: 24,
|
|
25
|
+
height: 24,
|
|
26
|
+
viewBox: "0 0 24 24",
|
|
27
|
+
fill: "none",
|
|
28
|
+
stroke: "currentColor",
|
|
29
|
+
strokeWidth: 1.5,
|
|
30
|
+
strokeLinecap: "round",
|
|
31
|
+
strokeLinejoin: "round",
|
|
32
|
+
"aria-hidden": "true",
|
|
33
|
+
dangerouslySetInnerHTML: { __html: MARK }
|
|
34
|
+
})
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
function part(name, tag) {
|
|
38
|
+
return function Part({ children, ...rest }) {
|
|
39
|
+
injectComponentStyle("result");
|
|
40
|
+
return /* @__PURE__ */ jsx(tag, {
|
|
41
|
+
...rest,
|
|
42
|
+
"data-scope": "result",
|
|
43
|
+
"data-part": name,
|
|
44
|
+
children
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
/** A verdict drawn after the deed: the mark washes in the fixed
|
|
49
|
+
* pigment, the title rides the serif, and the extra carries the way
|
|
50
|
+
* onward. Any subset composes. */
|
|
51
|
+
const Result = {
|
|
52
|
+
Root: ResultRoot,
|
|
53
|
+
Icon: ResultIcon,
|
|
54
|
+
Title: part("title", "h3"),
|
|
55
|
+
Description: part("description", "p"),
|
|
56
|
+
Extra: part("extra", "div")
|
|
57
|
+
};
|
|
58
|
+
//#endregion
|
|
59
|
+
export { Result, ResultIcon, ResultRoot };
|
|
@@ -1,17 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
//#region src/components/select/index.d.ts
|
|
4
|
-
/** Ark's Select, dressed in the paper-and-ink system: the trigger is the
|
|
5
|
-
* whole control and its list dissolves open as a paper vessel, the checked
|
|
6
|
-
* row taking the flat ink fill. The API is Ark's own — Root, Label, Control,
|
|
7
|
-
* Trigger, ValueText, Indicator, ClearTrigger, HiddenSelect, Positioner,
|
|
8
|
-
* Content, List, Item, ItemText, ItemIndicator, ItemGroup, ItemGroupLabel. */
|
|
9
|
-
type SelectOwnProps = {
|
|
10
|
-
/** One rung of the control-height ladder for the trigger. */
|
|
11
|
-
size?: "sm" | "md" | "lg";
|
|
12
|
-
};
|
|
13
|
-
declare function SelectRoot<T extends CollectionItem>(props: SelectRootComponentProps<T, SelectOwnProps>): import("react").JSX.Element;
|
|
14
|
-
export declare const Select: Omit<typeof Select$1, "Root"> & {
|
|
15
|
-
Root: typeof SelectRoot;
|
|
16
|
-
};
|
|
17
|
-
//#endregion
|
|
1
|
+
import { i as NativeSelectProps, n as NativeSelect, r as NativeSelectOption, t as Select } from "../../index-DFN9F5Zt.mjs";
|
|
2
|
+
export { NativeSelect, type NativeSelectOption, type NativeSelectProps, Select };
|
|
@@ -1,18 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { Select as Select$1 } from "@ark-ui/react/select";
|
|
4
|
-
//#region src/components/select/index.tsx
|
|
5
|
-
function SelectRoot(props) {
|
|
6
|
-
const { size = "md", ...rest } = props;
|
|
7
|
-
return /* @__PURE__ */ jsx(Select$1.Root, {
|
|
8
|
-
...rest,
|
|
9
|
-
"data-size": size
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
const Select = {
|
|
13
|
-
...Select$1,
|
|
14
|
-
Root: SelectRoot
|
|
15
|
-
};
|
|
16
|
-
injectComponentStyle("select");
|
|
17
|
-
//#endregion
|
|
18
|
-
export { Select };
|
|
1
|
+
import { n as NativeSelect, t as Select } from "../../select-D1xiT1oJ.mjs";
|
|
2
|
+
export { NativeSelect, Select };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { HTMLAttributes, ReactNode } from "react";
|
|
2
|
+
//#region src/components/spotlight/index.d.ts
|
|
3
|
+
export interface SpotlightProps extends HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
/** How far the lamp throws before the ink swallows it. */
|
|
5
|
+
radius?: string;
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
}
|
|
8
|
+
/** The ink-light card: a vessel whose rim and face take light from the
|
|
9
|
+
* reader's hand. The wrapper only measures and writes the geometry —
|
|
10
|
+
* the lamp itself is the two layers the stylesheet paints. */
|
|
11
|
+
export declare function Spotlight({ radius, children, ...rest }: SpotlightProps): import("react").JSX.Element;
|
|
12
|
+
//#endregion
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { injectComponentStyle } from "@bysages/core";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
//#region src/components/spotlight/index.tsx
|
|
4
|
+
/** The ink-light card: a vessel whose rim and face take light from the
|
|
5
|
+
* reader's hand. The wrapper only measures and writes the geometry —
|
|
6
|
+
* the lamp itself is the two layers the stylesheet paints. */
|
|
7
|
+
function Spotlight({ radius, children, ...rest }) {
|
|
8
|
+
injectComponentStyle("spotlight");
|
|
9
|
+
const track = (event) => {
|
|
10
|
+
const host = event.currentTarget;
|
|
11
|
+
const rect = host.getBoundingClientRect();
|
|
12
|
+
host.style.setProperty("--bs-spot-x", `${event.clientX - rect.left}px`);
|
|
13
|
+
host.style.setProperty("--bs-spot-y", `${event.clientY - rect.top}px`);
|
|
14
|
+
};
|
|
15
|
+
return /* @__PURE__ */ jsx("div", {
|
|
16
|
+
...rest,
|
|
17
|
+
"data-scope": "spotlight",
|
|
18
|
+
"data-part": "root",
|
|
19
|
+
style: {
|
|
20
|
+
...rest.style,
|
|
21
|
+
"--bs-spot-radius": radius
|
|
22
|
+
},
|
|
23
|
+
onPointerMove: track,
|
|
24
|
+
onPointerEnter: (event) => {
|
|
25
|
+
track(event);
|
|
26
|
+
event.currentTarget.setAttribute("data-hovered", "");
|
|
27
|
+
},
|
|
28
|
+
onPointerLeave: (event) => event.currentTarget.removeAttribute("data-hovered"),
|
|
29
|
+
children
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
export { Spotlight };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Pagination } from "../pagination/index.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { t as Select$1 } from "../../select-D1xiT1oJ.mjs";
|
|
3
3
|
import { injectComponentStyle } from "@bysages/core";
|
|
4
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
import { useEffect, useLayoutEffect, useMemo, useReducer, useRef } from "react";
|
|
@@ -4,8 +4,10 @@ import { Tabs as Tabs$1 } from "@ark-ui/react/tabs";
|
|
|
4
4
|
type TabsRootProps = ComponentProps<typeof Tabs$1.Root> & {
|
|
5
5
|
/** One rung of the control-height ladder for the tab rows. */
|
|
6
6
|
size?: "sm" | "md" | "lg";
|
|
7
|
+
/** The register: a ruled line (default), or each tab its own card. */
|
|
8
|
+
variant?: "line" | "card";
|
|
7
9
|
};
|
|
8
|
-
declare function TabsRoot({ size, ...rest }: TabsRootProps): import("react").JSX.Element;
|
|
10
|
+
declare function TabsRoot({ size, variant, ...rest }: TabsRootProps): import("react").JSX.Element;
|
|
9
11
|
/**
|
|
10
12
|
* Tabs — tabbed navigation.
|
|
11
13
|
*
|
|
@@ -2,10 +2,11 @@ import { injectComponentStyle } from "@bysages/core";
|
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
import { Tabs as Tabs$1 } from "@ark-ui/react/tabs";
|
|
4
4
|
//#region src/components/tabs/index.tsx
|
|
5
|
-
function TabsRoot({ size = "md", ...rest }) {
|
|
5
|
+
function TabsRoot({ size = "md", variant = "line", ...rest }) {
|
|
6
6
|
return /* @__PURE__ */ jsx(Tabs$1.Root, {
|
|
7
7
|
...rest,
|
|
8
|
-
"data-size": size
|
|
8
|
+
"data-size": size,
|
|
9
|
+
"data-variant": variant
|
|
9
10
|
});
|
|
10
11
|
}
|
|
11
12
|
/**
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { HTMLAttributes } from "react";
|
|
2
|
+
//#region src/components/terminal/index.d.ts
|
|
3
|
+
export interface TerminalProps extends HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
/** The transcript, oldest line first. */
|
|
5
|
+
lines?: string[];
|
|
6
|
+
/** The sigil at the head of the entry line. */
|
|
7
|
+
prompt?: string;
|
|
8
|
+
placeholder?: string;
|
|
9
|
+
label?: string;
|
|
10
|
+
onCommand?: (text: string) => void;
|
|
11
|
+
}
|
|
12
|
+
/** A quiet console: the transcript above, the prompt line below. The
|
|
13
|
+
* component owns only the reading and the caret — each entered line
|
|
14
|
+
* leaves as an event, and the caller answers through the lines prop,
|
|
15
|
+
* so history stays theirs to shape. */
|
|
16
|
+
export declare function Terminal({ lines, prompt, placeholder, label, onCommand, ...rest }: TerminalProps): import("react").JSX.Element;
|
|
17
|
+
//#endregion
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { injectComponentStyle } from "@bysages/core";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useRef, useState } from "react";
|
|
4
|
+
//#region src/components/terminal/index.tsx
|
|
5
|
+
/** A quiet console: the transcript above, the prompt line below. The
|
|
6
|
+
* component owns only the reading and the caret — each entered line
|
|
7
|
+
* leaves as an event, and the caller answers through the lines prop,
|
|
8
|
+
* so history stays theirs to shape. */
|
|
9
|
+
function Terminal({ lines = [], prompt = "$", placeholder, label, onCommand, ...rest }) {
|
|
10
|
+
injectComponentStyle("terminal");
|
|
11
|
+
const [draft, setDraft] = useState("");
|
|
12
|
+
const scroll = useRef(null);
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
scroll.current?.scrollTo({ top: scroll.current.scrollHeight });
|
|
15
|
+
}, [lines.length]);
|
|
16
|
+
function submit() {
|
|
17
|
+
const text = draft.trim();
|
|
18
|
+
if (!text) return;
|
|
19
|
+
setDraft("");
|
|
20
|
+
onCommand?.(text);
|
|
21
|
+
}
|
|
22
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
23
|
+
...rest,
|
|
24
|
+
role: "log",
|
|
25
|
+
"aria-label": label ?? void 0,
|
|
26
|
+
"data-scope": "terminal",
|
|
27
|
+
"data-part": "root",
|
|
28
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
29
|
+
ref: scroll,
|
|
30
|
+
"data-scope": "terminal",
|
|
31
|
+
"data-part": "scroll",
|
|
32
|
+
children: lines.map((line, index) => /* @__PURE__ */ jsx("div", {
|
|
33
|
+
"data-scope": "terminal",
|
|
34
|
+
"data-part": "line",
|
|
35
|
+
children: line
|
|
36
|
+
}, index))
|
|
37
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
38
|
+
"data-scope": "terminal",
|
|
39
|
+
"data-part": "entry",
|
|
40
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
41
|
+
"data-scope": "terminal",
|
|
42
|
+
"data-part": "sigil",
|
|
43
|
+
"aria-hidden": "true",
|
|
44
|
+
children: prompt
|
|
45
|
+
}), /* @__PURE__ */ jsx("input", {
|
|
46
|
+
"data-scope": "terminal",
|
|
47
|
+
"data-part": "input",
|
|
48
|
+
value: draft,
|
|
49
|
+
placeholder,
|
|
50
|
+
"aria-label": label ? `${label} command line` : "Command line",
|
|
51
|
+
spellCheck: false,
|
|
52
|
+
autoComplete: "off",
|
|
53
|
+
onInput: (event) => setDraft(event.target.value),
|
|
54
|
+
onKeyDown: (event) => {
|
|
55
|
+
if (event.key === "Enter") {
|
|
56
|
+
event.preventDefault();
|
|
57
|
+
submit();
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
})]
|
|
61
|
+
})]
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
//#endregion
|
|
65
|
+
export { Terminal };
|
|
@@ -1,23 +1,25 @@
|
|
|
1
|
+
import * as React from "react";
|
|
1
2
|
import { HTMLAttributes } from "react";
|
|
2
3
|
//#region src/components/timeline/index.d.ts
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
declare function Root({ orientation, children, ...rest }: HTMLAttributes<HTMLElement> & {
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
orientation?: "vertical" | "horizontal";
|
|
7
|
+
}): React.JSX.Element;
|
|
8
|
+
declare namespace Root {
|
|
9
|
+
var displayName: string;
|
|
10
|
+
}
|
|
11
|
+
export declare const Timeline: typeof Root & {
|
|
12
|
+
Root: typeof Root;
|
|
11
13
|
Item: {
|
|
12
|
-
({ children, ...rest }: HTMLAttributes<HTMLElement>):
|
|
14
|
+
({ children, ...rest }: HTMLAttributes<HTMLElement>): React.JSX.Element;
|
|
13
15
|
displayName: string;
|
|
14
16
|
};
|
|
15
17
|
Marker: {
|
|
16
|
-
({ children, ...rest }: HTMLAttributes<HTMLElement>):
|
|
18
|
+
({ children, ...rest }: HTMLAttributes<HTMLElement>): React.JSX.Element;
|
|
17
19
|
displayName: string;
|
|
18
20
|
};
|
|
19
21
|
Content: {
|
|
20
|
-
({ children, ...rest }: HTMLAttributes<HTMLElement>):
|
|
22
|
+
({ children, ...rest }: HTMLAttributes<HTMLElement>): React.JSX.Element;
|
|
21
23
|
displayName: string;
|
|
22
24
|
};
|
|
23
25
|
};
|