@bysages/react 0.2.3 → 0.3.1
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 → ai-response-BfKTmtCt.mjs} +8 -4
- package/dist/components/ai/index.d.mts +2 -2
- package/dist/components/ai/index.mjs +32 -17
- package/dist/components/ai-attachments/index.mjs +3 -1
- package/dist/components/ai-prompt-input/index.d.mts +1 -1
- package/dist/components/ai-prompt-input/index.mjs +8 -4
- package/dist/components/ai-response/index.d.mts +4 -2
- package/dist/components/ai-response/index.mjs +1 -1
- package/dist/components/autocomplete/index.mjs +3 -1
- package/dist/components/avatar/index.d.mts +4 -1
- package/dist/components/avatar/index.mjs +3 -2
- package/dist/components/banner/index.mjs +21 -17
- 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 +3 -8
- package/dist/components/breadcrumb/index.mjs +11 -1
- package/dist/components/browser/index.d.mts +23 -0
- package/dist/components/browser/index.mjs +70 -0
- package/dist/components/cascade-select/index.mjs +15 -5
- package/dist/components/command/index.mjs +9 -3
- package/dist/components/config-provider/index.d.mts +5 -2
- package/dist/components/config-provider/index.mjs +3 -2
- package/dist/components/data-view/index.d.mts +18 -0
- package/dist/components/data-view/index.mjs +66 -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 +4 -2
- package/dist/components/file-upload/index.d.mts +8 -1
- package/dist/components/file-upload/index.mjs +20 -1
- package/dist/components/float-button/index.mjs +3 -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/image/index.d.mts +7 -1
- package/dist/components/image/index.mjs +3 -1
- package/dist/components/image-viewer/index.d.mts +7 -1
- package/dist/components/image-viewer/index.mjs +8 -4
- package/dist/components/input/index.d.mts +4 -1
- package/dist/components/input/index.mjs +1 -20
- package/dist/components/json-tree-view/index.d.mts +3 -3
- package/dist/components/json-tree-view/index.mjs +17 -4
- package/dist/components/layout/index.mjs +3 -1
- package/dist/components/list/index.d.mts +5 -4
- package/dist/components/list/index.mjs +10 -1
- package/dist/components/menubar/index.mjs +1 -0
- package/dist/components/order-list/index.d.mts +21 -0
- package/dist/components/order-list/index.mjs +161 -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/spinner/index.mjs +3 -1
- package/dist/components/split-button/index.mjs +3 -1
- package/dist/components/spotlight/index.d.mts +12 -0
- package/dist/components/spotlight/index.mjs +33 -0
- package/dist/components/steps/index.d.mts +5 -1
- package/dist/components/steps/index.mjs +10 -1
- package/dist/components/table/index.mjs +19 -15
- 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 +68 -0
- package/dist/components/timeline/index.d.mts +13 -11
- package/dist/components/timeline/index.mjs +11 -1
- package/dist/components/toc/index.d.mts +7 -1
- package/dist/components/toc/index.mjs +13 -1
- package/dist/components/toolbar/index.d.mts +17 -0
- package/dist/components/toolbar/index.mjs +29 -0
- package/dist/components/transfer/index.mjs +7 -5
- package/dist/components/tree-select/index.mjs +5 -3
- package/dist/components/tree-view/index.d.mts +10 -1
- package/dist/components/tree-view/index.mjs +22 -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 +53 -0
- package/dist/glyph-VI989p8H.mjs +14 -0
- package/dist/{index-DaAbbSz9.d.mts → index-Dn5mHf1g.d.mts} +738 -3786
- package/dist/index-Iy8m0Qev.d.mts +42 -0
- package/dist/index.d.mts +16 -3
- package/dist/index.mjs +28 -15
- package/dist/input-2oezH-dY.mjs +58 -0
- package/dist/messages-1jJWtaYU.mjs +16 -0
- package/dist/select-eAHutw56.mjs +70 -0
- package/package.json +30 -9
|
@@ -10,8 +10,14 @@ export interface ImageProps extends Omit<HTMLAttributes<HTMLElement>, "onError"
|
|
|
10
10
|
alt?: string;
|
|
11
11
|
fit?: "cover" | "contain" | "fill" | "none";
|
|
12
12
|
loading?: "lazy" | "eager";
|
|
13
|
+
/** Intrinsic rendered width, reserved on the image to avoid layout
|
|
14
|
+
* shift while the source loads. */
|
|
15
|
+
width?: number | string;
|
|
16
|
+
/** Intrinsic rendered height, reserved on the image to avoid layout
|
|
17
|
+
* shift while the source loads. */
|
|
18
|
+
height?: number | string;
|
|
13
19
|
/** Shown in place of the picture when the source breaks. */
|
|
14
20
|
fallback?: ReactNode;
|
|
15
21
|
}
|
|
16
|
-
export declare function Image({ src, alt, fit, loading, fallback, ...rest }: ImageProps): import("react").JSX.Element;
|
|
22
|
+
export declare function Image({ src, alt, fit, loading, width, height, fallback, ...rest }: ImageProps): import("react").JSX.Element;
|
|
17
23
|
//#endregion
|
|
@@ -27,7 +27,7 @@ function placeholderGlyph() {
|
|
|
27
27
|
]
|
|
28
28
|
});
|
|
29
29
|
}
|
|
30
|
-
function Image({ src, alt = "", fit = "cover", loading = "lazy", fallback, ...rest }) {
|
|
30
|
+
function Image({ src, alt = "", fit = "cover", loading = "lazy", width, height, fallback, ...rest }) {
|
|
31
31
|
injectComponentStyle("image");
|
|
32
32
|
const [state, setState] = useState("loading");
|
|
33
33
|
useEffect(() => setState("loading"), [src]);
|
|
@@ -44,6 +44,8 @@ function Image({ src, alt = "", fit = "cover", loading = "lazy", fallback, ...re
|
|
|
44
44
|
alt,
|
|
45
45
|
loading,
|
|
46
46
|
decoding: "async",
|
|
47
|
+
width,
|
|
48
|
+
height,
|
|
47
49
|
onLoad: () => setState("loaded"),
|
|
48
50
|
onError: () => setState("error")
|
|
49
51
|
}), state === "error" ? /* @__PURE__ */ jsx("div", {
|
|
@@ -11,8 +11,14 @@ export interface ImageViewerProps {
|
|
|
11
11
|
alt?: string;
|
|
12
12
|
open?: boolean;
|
|
13
13
|
zoomable?: boolean;
|
|
14
|
+
/** Intrinsic rendered width, reserved on the image to avoid layout
|
|
15
|
+
* shift while the source loads. */
|
|
16
|
+
width?: number | string;
|
|
17
|
+
/** Intrinsic rendered height, reserved on the image to avoid layout
|
|
18
|
+
* shift while the source loads. */
|
|
19
|
+
height?: number | string;
|
|
14
20
|
/** Reports the viewer's next state. */
|
|
15
21
|
onOpenChange?: (open: boolean) => void;
|
|
16
22
|
}
|
|
17
|
-
export declare function ImageViewer({ src, alt, open, zoomable, onOpenChange }: ImageViewerProps): import("react").JSX.Element;
|
|
23
|
+
export declare function ImageViewer({ src, alt, open, zoomable, width, height, onOpenChange }: ImageViewerProps): import("react").JSX.Element;
|
|
18
24
|
//#endregion
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { n as useComponentMessages } from "../../messages-1jJWtaYU.mjs";
|
|
1
2
|
import { Button } from "../button/index.mjs";
|
|
2
3
|
import { ButtonGroup } from "../button-group/index.mjs";
|
|
3
4
|
import { injectComponentStyle } from "@bysages/core";
|
|
@@ -33,8 +34,9 @@ const TOOL_GLYPHS = {
|
|
|
33
34
|
rotate: () => /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("path", { d: "M20.49 12A8.5 8.5 0 1 1 18 6.06" }), /* @__PURE__ */ jsx("path", { d: "M20.5 3.5v4h-4" })] }),
|
|
34
35
|
close: () => /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("path", { d: "m6 6 12 12" }), /* @__PURE__ */ jsx("path", { d: "M18 6 6 18" })] })
|
|
35
36
|
};
|
|
36
|
-
function ImageViewer({ src, alt = "", open, zoomable = true, onOpenChange }) {
|
|
37
|
+
function ImageViewer({ src, alt = "", open, zoomable = true, width, height, onOpenChange }) {
|
|
37
38
|
injectComponentStyle("image-viewer");
|
|
39
|
+
const messages = useComponentMessages();
|
|
38
40
|
const [localOpen, setLocalOpen] = useState(false);
|
|
39
41
|
const [scale, setScale] = useState(1);
|
|
40
42
|
const [rotation, setRotation] = useState(0);
|
|
@@ -92,14 +94,16 @@ function ImageViewer({ src, alt = "", open, zoomable = true, onOpenChange }) {
|
|
|
92
94
|
"data-part": "viewport",
|
|
93
95
|
src,
|
|
94
96
|
alt,
|
|
97
|
+
width,
|
|
98
|
+
height,
|
|
95
99
|
style: { transform: `scale(${scale}) rotate(${rotation}deg)` }
|
|
96
100
|
}), /* @__PURE__ */ jsx("div", {
|
|
97
101
|
"data-scope": "image-viewer",
|
|
98
102
|
"data-part": "toolbar",
|
|
99
103
|
children: /* @__PURE__ */ jsxs(ButtonGroup, { children: [
|
|
100
|
-
zoomable ? [toolButton(
|
|
101
|
-
toolButton(
|
|
102
|
-
toolButton(
|
|
104
|
+
zoomable ? [toolButton(messages.imageViewer.zoomIn, TOOL_GLYPHS.zoomIn, () => zoom(SCALE_STEP)), toolButton(messages.imageViewer.zoomOut, TOOL_GLYPHS.zoomOut, () => zoom(-.25))] : null,
|
|
105
|
+
toolButton(messages.imageViewer.rotate, TOOL_GLYPHS.rotate, rotate),
|
|
106
|
+
toolButton(messages.imageViewer.close, TOOL_GLYPHS.close, () => setOpen(false))
|
|
103
107
|
] })
|
|
104
108
|
})]
|
|
105
109
|
})
|
|
@@ -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 };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { JsonTreeView as JsonTreeView$1 } from "@ark-ui/react/json-tree-view";
|
|
2
2
|
//#region src/components/json-tree-view/index.d.ts
|
|
3
|
-
/**
|
|
4
|
-
* recipes re-scoped, with value nodes reading as tabular data. The
|
|
5
|
-
*
|
|
3
|
+
/** JsonTreeView, dressed in the paper-and-ink system: the tree-view
|
|
4
|
+
* recipes re-scoped, with value nodes reading as tabular data. The parts —
|
|
5
|
+
* Root, Tree, plus createJsonTreeCollection. */
|
|
6
6
|
export declare const JsonTreeView: typeof JsonTreeView$1;
|
|
7
7
|
//#endregion
|
|
@@ -1,10 +1,23 @@
|
|
|
1
|
+
import { t as glyphNode } from "../../glyph-VI989p8H.mjs";
|
|
1
2
|
import { injectComponentStyle } from "@bysages/core";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
4
|
import { JsonTreeView as JsonTreeView$1 } from "@ark-ui/react/json-tree-view";
|
|
5
|
+
import { chevron_right } from "@bysages/icons";
|
|
3
6
|
//#region src/components/json-tree-view/index.tsx
|
|
4
|
-
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
|
|
7
|
+
/** The auto-rendered tree hands every branch its chevron from the
|
|
8
|
+
* `arrow` element — filled with the house glyph unless the consumer
|
|
9
|
+
* draws their own, so a JSON tree never opens as a bare indent. */
|
|
10
|
+
function JsonTreeViewTree(props) {
|
|
11
|
+
const { arrow = glyphNode(chevron_right), ...rest } = props;
|
|
12
|
+
return /* @__PURE__ */ jsx(JsonTreeView$1.Tree, {
|
|
13
|
+
...rest,
|
|
14
|
+
arrow
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
/** JsonTreeView, dressed in the paper-and-ink system: the tree-view
|
|
18
|
+
* recipes re-scoped, with value nodes reading as tabular data. The parts —
|
|
19
|
+
* Root, Tree, plus createJsonTreeCollection. */
|
|
20
|
+
const JsonTreeView = Object.assign({}, JsonTreeView$1, { Tree: JsonTreeViewTree });
|
|
8
21
|
injectComponentStyle("json-tree-view");
|
|
9
22
|
//#endregion
|
|
10
23
|
export { JsonTreeView };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { n as useComponentMessages } from "../../messages-1jJWtaYU.mjs";
|
|
1
2
|
import { injectComponentStyle } from "@bysages/core";
|
|
2
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
4
|
import { createContext, useContext, useEffect, useRef, useState } from "react";
|
|
@@ -41,6 +42,7 @@ const Footer = region("Footer", "footer");
|
|
|
41
42
|
const RESIZE_STEP = 16;
|
|
42
43
|
function Sider({ collapsed = false, width: widthProp, collapsedWidth = "3.5rem", resizable = false, minWidth = "12rem", maxWidth = "24rem", style, onCollapsedChange, onWidthChange, children, ...rest }) {
|
|
43
44
|
const layout = useContext(LAYOUT_CONTEXT);
|
|
45
|
+
const messages = useComponentMessages();
|
|
44
46
|
const rail = useRef(null);
|
|
45
47
|
const [dragging, setDragging] = useState(false);
|
|
46
48
|
const [innerWidth, setInnerWidth] = useState(widthProp ?? "16rem");
|
|
@@ -97,7 +99,7 @@ function Sider({ collapsed = false, width: widthProp, collapsedWidth = "3.5rem",
|
|
|
97
99
|
role: "separator",
|
|
98
100
|
"aria-orientation": "vertical",
|
|
99
101
|
tabIndex: 0,
|
|
100
|
-
"aria-label":
|
|
102
|
+
"aria-label": messages.sidebar.resize,
|
|
101
103
|
"aria-valuenow": Math.round(rail.current ? rail.current.getBoundingClientRect().width : 0),
|
|
102
104
|
onPointerDown,
|
|
103
105
|
onPointerMove,
|
|
@@ -10,6 +10,10 @@ declare function Root({ bordered, hoverable, children, ...rest }: ListRootProps)
|
|
|
10
10
|
declare namespace Root {
|
|
11
11
|
var displayName: string;
|
|
12
12
|
}
|
|
13
|
+
declare function Item({ children, ...attrs }: HTMLAttributes<HTMLElement>): import("react").JSX.Element;
|
|
14
|
+
declare namespace Item {
|
|
15
|
+
var displayName: string;
|
|
16
|
+
}
|
|
13
17
|
/** The row's words: `title` and `description` ride their own slots, the
|
|
14
18
|
* children follow them for anything else. */
|
|
15
19
|
export interface ListContentProps extends Omit<HTMLAttributes<HTMLDivElement>, "title"> {
|
|
@@ -22,10 +26,7 @@ declare namespace Content {
|
|
|
22
26
|
}
|
|
23
27
|
export declare const List: typeof Root & {
|
|
24
28
|
Root: typeof Root;
|
|
25
|
-
Item:
|
|
26
|
-
({ children, ...rest }: HTMLAttributes<HTMLElement>): import("react").JSX.Element;
|
|
27
|
-
displayName: string;
|
|
28
|
-
};
|
|
29
|
+
Item: typeof Item;
|
|
29
30
|
Leading: {
|
|
30
31
|
({ children, ...rest }: HTMLAttributes<HTMLElement>): import("react").JSX.Element;
|
|
31
32
|
displayName: string;
|
|
@@ -30,7 +30,16 @@ function Root({ bordered = false, hoverable = false, children, ...rest }) {
|
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
32
|
Root.displayName = "ListRoot";
|
|
33
|
-
|
|
33
|
+
function Item({ children, ...attrs }) {
|
|
34
|
+
delete attrs.role;
|
|
35
|
+
return /* @__PURE__ */ jsx("li", {
|
|
36
|
+
...attrs,
|
|
37
|
+
"data-scope": "list",
|
|
38
|
+
"data-part": "item",
|
|
39
|
+
children
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
Item.displayName = "ListItem";
|
|
34
43
|
const Leading = part("Leading", "div");
|
|
35
44
|
const Actions = part("Actions", "div");
|
|
36
45
|
function Content({ title, description, children, ...rest }) {
|
|
@@ -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,161 @@
|
|
|
1
|
+
import { n as useComponentMessages } from "../../messages-1jJWtaYU.mjs";
|
|
2
|
+
import { injectComponentStyle } from "@bysages/core";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { useRef, useState } from "react";
|
|
5
|
+
//#region src/components/order-list/index.tsx
|
|
6
|
+
const ARROWS = {
|
|
7
|
+
up: ["m18 15-6-6-6 6"],
|
|
8
|
+
down: ["m6 9 6 6 6-6"],
|
|
9
|
+
top: ["m18 15-6-6-6 6", "M5 4h14"],
|
|
10
|
+
bottom: ["m6 9 6 6 6-6", "M5 20h14"]
|
|
11
|
+
};
|
|
12
|
+
function arrowGlyph(paths) {
|
|
13
|
+
return /* @__PURE__ */ jsx("svg", {
|
|
14
|
+
viewBox: "0 0 24 24",
|
|
15
|
+
width: 12,
|
|
16
|
+
height: 12,
|
|
17
|
+
fill: "none",
|
|
18
|
+
stroke: "currentColor",
|
|
19
|
+
strokeWidth: 2,
|
|
20
|
+
strokeLinecap: "round",
|
|
21
|
+
strokeLinejoin: "round",
|
|
22
|
+
"aria-hidden": "true",
|
|
23
|
+
children: paths.map((d) => /* @__PURE__ */ jsx("path", { d }, d))
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
/** A ledger the reader may rewrite: rows move by grip or by the side
|
|
27
|
+
* arrows, and the group reports the new order as the value itself —
|
|
28
|
+
* the model is the order. Dragging rides the native drag events — a
|
|
29
|
+
* hairline of primary ink marks the seam the row will land on — so
|
|
30
|
+
* touch keeps the buttons as its route. */
|
|
31
|
+
function OrderList({ value, options, label, onValueChange, ...rest }) {
|
|
32
|
+
injectComponentStyle("order-list");
|
|
33
|
+
const messages = useComponentMessages();
|
|
34
|
+
const dragging = useRef(null);
|
|
35
|
+
const [dropLine, setDropLine] = useState(null);
|
|
36
|
+
const rows = value.map((entry) => options.find((option) => option.value === entry)).filter((option) => option != null);
|
|
37
|
+
function reset() {
|
|
38
|
+
dragging.current = null;
|
|
39
|
+
setDropLine(null);
|
|
40
|
+
}
|
|
41
|
+
function move(entry, offset) {
|
|
42
|
+
const next = [...value];
|
|
43
|
+
const from = next.indexOf(entry);
|
|
44
|
+
const to = Math.max(0, Math.min(next.length - 1, from + offset));
|
|
45
|
+
if (from === to) return;
|
|
46
|
+
next.splice(to, 0, ...next.splice(from, 1));
|
|
47
|
+
onValueChange?.(next);
|
|
48
|
+
}
|
|
49
|
+
function drop() {
|
|
50
|
+
const entry = dragging.current;
|
|
51
|
+
if (entry == null) return;
|
|
52
|
+
const seam = dropLine;
|
|
53
|
+
const from = value.indexOf(entry);
|
|
54
|
+
if (seam && seam.index === from) return reset();
|
|
55
|
+
const next = value.filter((candidate) => candidate !== entry);
|
|
56
|
+
let at = seam ? seam.before ? seam.index : seam.index + 1 : next.length;
|
|
57
|
+
if (from < at) at -= 1;
|
|
58
|
+
next.splice(Math.max(0, Math.min(next.length, at)), 0, entry);
|
|
59
|
+
onValueChange?.(next);
|
|
60
|
+
reset();
|
|
61
|
+
}
|
|
62
|
+
function over(event, index, entry) {
|
|
63
|
+
event.preventDefault();
|
|
64
|
+
if (event.dataTransfer) event.dataTransfer.dropEffect = "move";
|
|
65
|
+
const rect = event.currentTarget.getBoundingClientRect();
|
|
66
|
+
const before = event.clientY < rect.top + rect.height / 2;
|
|
67
|
+
setDropLine(dragging.current != null && !(entry.value === dragging.current && before) ? {
|
|
68
|
+
index,
|
|
69
|
+
before
|
|
70
|
+
} : null);
|
|
71
|
+
}
|
|
72
|
+
return /* @__PURE__ */ jsx("div", {
|
|
73
|
+
...rest,
|
|
74
|
+
"data-scope": "order-list",
|
|
75
|
+
"data-part": "root",
|
|
76
|
+
onDragLeave: (event) => {
|
|
77
|
+
const host = event.currentTarget;
|
|
78
|
+
if (!event.relatedTarget || !host.contains(event.relatedTarget)) setDropLine(null);
|
|
79
|
+
},
|
|
80
|
+
children: /* @__PURE__ */ jsx("ol", {
|
|
81
|
+
"data-scope": "order-list",
|
|
82
|
+
"data-part": "list",
|
|
83
|
+
"aria-label": label ?? void 0,
|
|
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
|
+
draggable: true,
|
|
88
|
+
"aria-roledescription": "Sortable item",
|
|
89
|
+
"data-scope": "order-list",
|
|
90
|
+
"data-part": "item",
|
|
91
|
+
"data-dragging": dragging.current === option.value ? "" : void 0,
|
|
92
|
+
"data-drop-line": seam,
|
|
93
|
+
onDragStart: (event) => {
|
|
94
|
+
dragging.current = option.value;
|
|
95
|
+
event.dataTransfer?.setData("text/plain", option.value);
|
|
96
|
+
if (event.dataTransfer) event.dataTransfer.effectAllowed = "move";
|
|
97
|
+
},
|
|
98
|
+
onDragEnd: reset,
|
|
99
|
+
onDragOver: (event) => over(event, index, option),
|
|
100
|
+
onDrop: (event) => {
|
|
101
|
+
event.preventDefault();
|
|
102
|
+
drop();
|
|
103
|
+
},
|
|
104
|
+
children: [
|
|
105
|
+
/* @__PURE__ */ jsx("span", {
|
|
106
|
+
"data-scope": "order-list",
|
|
107
|
+
"data-part": "grip",
|
|
108
|
+
"aria-hidden": "true",
|
|
109
|
+
children: "⋮⋮"
|
|
110
|
+
}),
|
|
111
|
+
/* @__PURE__ */ jsx("span", {
|
|
112
|
+
"data-scope": "order-list",
|
|
113
|
+
"data-part": "label",
|
|
114
|
+
children: option.label
|
|
115
|
+
}),
|
|
116
|
+
/* @__PURE__ */ jsx("span", {
|
|
117
|
+
"data-scope": "order-list",
|
|
118
|
+
"data-part": "controls",
|
|
119
|
+
children: [
|
|
120
|
+
[
|
|
121
|
+
messages.orderList.toTop,
|
|
122
|
+
ARROWS.top,
|
|
123
|
+
-index,
|
|
124
|
+
0
|
|
125
|
+
],
|
|
126
|
+
[
|
|
127
|
+
messages.orderList.moveUp,
|
|
128
|
+
ARROWS.up,
|
|
129
|
+
-1,
|
|
130
|
+
0
|
|
131
|
+
],
|
|
132
|
+
[
|
|
133
|
+
messages.orderList.moveDown,
|
|
134
|
+
ARROWS.down,
|
|
135
|
+
1,
|
|
136
|
+
rows.length - 1
|
|
137
|
+
],
|
|
138
|
+
[
|
|
139
|
+
messages.orderList.toBottom,
|
|
140
|
+
ARROWS.bottom,
|
|
141
|
+
rows.length - 1 - index,
|
|
142
|
+
rows.length - 1
|
|
143
|
+
]
|
|
144
|
+
].map(([aria, paths, offset, edge]) => /* @__PURE__ */ jsx("button", {
|
|
145
|
+
type: "button",
|
|
146
|
+
"aria-label": aria,
|
|
147
|
+
"data-scope": "order-list",
|
|
148
|
+
"data-part": "move",
|
|
149
|
+
disabled: index === edge,
|
|
150
|
+
onClick: () => move(option.value, offset),
|
|
151
|
+
children: arrowGlyph([...paths])
|
|
152
|
+
}, aria))
|
|
153
|
+
})
|
|
154
|
+
]
|
|
155
|
+
}, option.value);
|
|
156
|
+
})
|
|
157
|
+
})
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
//#endregion
|
|
161
|
+
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-Iy8m0Qev.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-eAHutw56.mjs";
|
|
2
|
+
export { NativeSelect, Select };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { n as useComponentMessages } from "../../messages-1jJWtaYU.mjs";
|
|
1
2
|
import { injectComponentStyle } from "@bysages/core";
|
|
2
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
4
|
//#region src/components/spinner/index.tsx
|
|
@@ -5,10 +6,11 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
5
6
|
* default — it reports progress without claiming attention. */
|
|
6
7
|
function Spinner({ size = "md", children, ...rest }) {
|
|
7
8
|
injectComponentStyle("spinner");
|
|
9
|
+
const messages = useComponentMessages();
|
|
8
10
|
return /* @__PURE__ */ jsxs("span", {
|
|
9
11
|
...rest,
|
|
10
12
|
role: "status",
|
|
11
|
-
"aria-label": rest["aria-label"] ??
|
|
13
|
+
"aria-label": rest["aria-label"] ?? messages.spinner.loading,
|
|
12
14
|
"data-scope": "spinner",
|
|
13
15
|
"data-part": "root",
|
|
14
16
|
"data-size": size,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { n as useComponentMessages } from "../../messages-1jJWtaYU.mjs";
|
|
1
2
|
import { Button } from "../button/index.mjs";
|
|
2
3
|
import { injectComponentStyle } from "@bysages/core";
|
|
3
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -16,6 +17,7 @@ import { Menu } from "@ark-ui/react/menu";
|
|
|
16
17
|
function SplitButton({ label, items = [], variant = "solid", tone = "ink", size = "md", disabled = false, onClick, onSelect, ...rest }) {
|
|
17
18
|
injectComponentStyle("split-button");
|
|
18
19
|
injectComponentStyle("menu");
|
|
20
|
+
const messages = useComponentMessages();
|
|
19
21
|
return /* @__PURE__ */ jsxs("div", {
|
|
20
22
|
...rest,
|
|
21
23
|
"data-scope": "split-button",
|
|
@@ -39,7 +41,7 @@ function SplitButton({ label, items = [], variant = "solid", tone = "ink", size
|
|
|
39
41
|
"data-size": size,
|
|
40
42
|
"data-square": "true",
|
|
41
43
|
"data-motion": "ink-ripple lit",
|
|
42
|
-
"aria-label":
|
|
44
|
+
"aria-label": messages.more.actions,
|
|
43
45
|
children: chevronDown()
|
|
44
46
|
})
|
|
45
47
|
}), /* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsx(Menu.Positioner, { children: /* @__PURE__ */ jsx(Menu.Content, { children: items.map((entry) => /* @__PURE__ */ jsx(Menu.Item, {
|
|
@@ -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 };
|