@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
|
@@ -15,7 +15,17 @@ function part(name, tag) {
|
|
|
15
15
|
Component.displayName = "Timeline" + name;
|
|
16
16
|
return Component;
|
|
17
17
|
}
|
|
18
|
-
|
|
18
|
+
function Root({ orientation = "vertical", children, ...rest }) {
|
|
19
|
+
injectComponentStyle("timeline");
|
|
20
|
+
return /* @__PURE__ */ jsx("ol", {
|
|
21
|
+
...rest,
|
|
22
|
+
"data-scope": "timeline",
|
|
23
|
+
"data-part": "root",
|
|
24
|
+
"data-orientation": orientation,
|
|
25
|
+
children
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
Root.displayName = "TimelineRoot";
|
|
19
29
|
const Item = part("Item", "li");
|
|
20
30
|
const Marker = part("Marker", "span");
|
|
21
31
|
const Content = part("Content", "div");
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { HTMLAttributes, ReactNode } from "react";
|
|
2
|
+
//#region src/components/toolbar/index.d.ts
|
|
3
|
+
export interface ToolbarProps extends HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
/** Accessible name when more than one toolbar shares a page. */
|
|
5
|
+
label?: string;
|
|
6
|
+
/** Tools at the leading edge; `children` land here when no start is
|
|
7
|
+
* given. */
|
|
8
|
+
start?: ReactNode;
|
|
9
|
+
/** Tools at the trailing edge. */
|
|
10
|
+
end?: ReactNode;
|
|
11
|
+
children?: ReactNode;
|
|
12
|
+
}
|
|
13
|
+
/** A workbench rail: the start tools at the leading edge, the end tools
|
|
14
|
+
* at the trailing, the rail itself carrying the toolbar role so
|
|
15
|
+
* assistive tech reads it as one group of commands. */
|
|
16
|
+
export declare function Toolbar({ label, start, end, children, ...rest }: ToolbarProps): import("react").JSX.Element;
|
|
17
|
+
//#endregion
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { injectComponentStyle } from "@bysages/core";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
//#region src/components/toolbar/index.tsx
|
|
4
|
+
/** A workbench rail: the start tools at the leading edge, the end tools
|
|
5
|
+
* at the trailing, the rail itself carrying the toolbar role so
|
|
6
|
+
* assistive tech reads it as one group of commands. */
|
|
7
|
+
function Toolbar({ label, start, end, children, ...rest }) {
|
|
8
|
+
injectComponentStyle("toolbar");
|
|
9
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
10
|
+
...rest,
|
|
11
|
+
role: "toolbar",
|
|
12
|
+
"aria-label": label ?? void 0,
|
|
13
|
+
"data-scope": "toolbar",
|
|
14
|
+
"data-part": "root",
|
|
15
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
16
|
+
"data-scope": "toolbar",
|
|
17
|
+
"data-part": "group",
|
|
18
|
+
"data-edge": "start",
|
|
19
|
+
children: start ?? children
|
|
20
|
+
}), end ? /* @__PURE__ */ jsx("div", {
|
|
21
|
+
"data-scope": "toolbar",
|
|
22
|
+
"data-part": "group",
|
|
23
|
+
"data-edge": "end",
|
|
24
|
+
children: end
|
|
25
|
+
}) : null]
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
//#endregion
|
|
29
|
+
export { Toolbar };
|
|
@@ -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
|
import { useState } from "react";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { AvatarSize } from "../avatar/index.mjs";
|
|
2
|
+
import { HTMLAttributes, ReactNode } from "react";
|
|
3
|
+
//#region src/components/user/index.d.ts
|
|
4
|
+
export interface UserProps extends HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
/** The person's name — the loud line. */
|
|
6
|
+
name: string;
|
|
7
|
+
/** The quiet echo beneath the name: a role, a title, an address. */
|
|
8
|
+
description?: string;
|
|
9
|
+
/** Seal diameter: one rung of the Avatar's own ladder. */
|
|
10
|
+
size?: AvatarSize;
|
|
11
|
+
src?: string;
|
|
12
|
+
shape?: "circle" | "square";
|
|
13
|
+
children?: ReactNode;
|
|
14
|
+
}
|
|
15
|
+
/** A person on one line: the seal before the words, the name and its
|
|
16
|
+
* quiet echo beneath. The mark is the Avatar itself — one component
|
|
17
|
+
* renders it here, so every size and shape the Avatar knows the user
|
|
18
|
+
* inherits; this row only lays the words out beside it. */
|
|
19
|
+
export declare function User({ name, description, size, src, shape, children, ...rest }: UserProps): import("react").JSX.Element;
|
|
20
|
+
//#endregion
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Avatar } from "../avatar/index.mjs";
|
|
2
|
+
import { injectComponentStyle } from "@bysages/core";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/user/index.tsx
|
|
5
|
+
function initialsOf(name) {
|
|
6
|
+
return name.split(/\s+/).filter(Boolean).slice(0, 2).map((word) => word[0]?.toUpperCase() ?? "").join("");
|
|
7
|
+
}
|
|
8
|
+
/** A person on one line: the seal before the words, the name and its
|
|
9
|
+
* quiet echo beneath. The mark is the Avatar itself — one component
|
|
10
|
+
* renders it here, so every size and shape the Avatar knows the user
|
|
11
|
+
* inherits; this row only lays the words out beside it. */
|
|
12
|
+
function User({ name, description, size, src, shape = "circle", children, ...rest }) {
|
|
13
|
+
injectComponentStyle("user");
|
|
14
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
15
|
+
...rest,
|
|
16
|
+
"data-scope": "user",
|
|
17
|
+
"data-part": "root",
|
|
18
|
+
children: [/* @__PURE__ */ jsxs(Avatar.Root, {
|
|
19
|
+
size,
|
|
20
|
+
shape,
|
|
21
|
+
children: [src ? /* @__PURE__ */ jsx(Avatar.Image, { src }) : null, /* @__PURE__ */ jsx(Avatar.Fallback, { children: initialsOf(name) })]
|
|
22
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
23
|
+
"data-scope": "user",
|
|
24
|
+
"data-part": "meta",
|
|
25
|
+
children: [
|
|
26
|
+
/* @__PURE__ */ jsx("span", {
|
|
27
|
+
"data-scope": "user",
|
|
28
|
+
"data-part": "name",
|
|
29
|
+
children: name
|
|
30
|
+
}),
|
|
31
|
+
description ? /* @__PURE__ */ jsx("span", {
|
|
32
|
+
"data-scope": "user",
|
|
33
|
+
"data-part": "description",
|
|
34
|
+
children: description
|
|
35
|
+
}) : null,
|
|
36
|
+
children
|
|
37
|
+
]
|
|
38
|
+
})]
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
//#endregion
|
|
42
|
+
export { User };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { HTMLAttributes, ReactNode } from "react";
|
|
2
|
+
//#region src/components/virtual-list/index.d.ts
|
|
3
|
+
export interface VirtualListProps extends HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
items: unknown[];
|
|
5
|
+
/** The height every row occupies — fixed rows keep it simple. */
|
|
6
|
+
itemHeight?: number;
|
|
7
|
+
/** The viewport height the ledger scrolls within. */
|
|
8
|
+
height?: number | string;
|
|
9
|
+
/** Renders one record into its positioned row. */
|
|
10
|
+
renderItem?: (item: unknown, index: number) => ReactNode;
|
|
11
|
+
}
|
|
12
|
+
/** A ledger that only mounts the rows on stage: the viewport keeps its
|
|
13
|
+
* scroll length by a spacer sized from the row height, the rows
|
|
14
|
+
* themselves are positioned against it — a ten-thousand-row list
|
|
15
|
+
* costs the DOM a window, not the ledger. */
|
|
16
|
+
export declare function VirtualList({ items, itemHeight, height, renderItem, ...rest }: VirtualListProps): import("react").JSX.Element;
|
|
17
|
+
//#endregion
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { injectComponentStyle } from "@bysages/core";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useRef } from "react";
|
|
4
|
+
import { useVirtualizer } from "@tanstack/react-virtual";
|
|
5
|
+
//#region src/components/virtual-list/index.tsx
|
|
6
|
+
/** A ledger that only mounts the rows on stage: the viewport keeps its
|
|
7
|
+
* scroll length by a spacer sized from the row height, the rows
|
|
8
|
+
* themselves are positioned against it — a ten-thousand-row list
|
|
9
|
+
* costs the DOM a window, not the ledger. */
|
|
10
|
+
function VirtualList({ items, itemHeight = 40, height = 320, renderItem, ...rest }) {
|
|
11
|
+
injectComponentStyle("virtual-list");
|
|
12
|
+
const viewport = useRef(null);
|
|
13
|
+
const virtualizer = useVirtualizer({
|
|
14
|
+
count: items.length,
|
|
15
|
+
getScrollElement: () => viewport.current,
|
|
16
|
+
estimateSize: () => itemHeight,
|
|
17
|
+
overscan: 6
|
|
18
|
+
});
|
|
19
|
+
return /* @__PURE__ */ jsx("div", {
|
|
20
|
+
...rest,
|
|
21
|
+
ref: viewport,
|
|
22
|
+
"data-scope": "virtual-list",
|
|
23
|
+
"data-part": "root",
|
|
24
|
+
style: {
|
|
25
|
+
...rest.style,
|
|
26
|
+
blockSize: typeof height === "number" ? `${height}px` : height
|
|
27
|
+
},
|
|
28
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
29
|
+
"data-scope": "virtual-list",
|
|
30
|
+
"data-part": "inner",
|
|
31
|
+
style: {
|
|
32
|
+
blockSize: virtualizer.getTotalSize(),
|
|
33
|
+
position: "relative"
|
|
34
|
+
},
|
|
35
|
+
children: virtualizer.getVirtualItems().map((row) => /* @__PURE__ */ jsx("div", {
|
|
36
|
+
"data-scope": "virtual-list",
|
|
37
|
+
"data-part": "row",
|
|
38
|
+
style: {
|
|
39
|
+
position: "absolute",
|
|
40
|
+
top: 0,
|
|
41
|
+
insetInlineStart: 0,
|
|
42
|
+
inlineSize: "100%",
|
|
43
|
+
transform: `translateY(${row.start}px)`,
|
|
44
|
+
blockSize: row.size
|
|
45
|
+
},
|
|
46
|
+
children: renderItem?.(items[row.index], row.index)
|
|
47
|
+
}, String(row.key)))
|
|
48
|
+
})
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
//#endregion
|
|
52
|
+
export { VirtualList };
|