@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
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as useComponentMessages } from "../../messages-1jJWtaYU.mjs";
|
|
2
|
+
import { t as Input } from "../../input-2oezH-dY.mjs";
|
|
2
3
|
import { injectComponentStyle } from "@bysages/core";
|
|
3
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
4
5
|
import { useId, useMemo, useState } from "react";
|
|
5
6
|
import { Portal } from "@ark-ui/react/portal";
|
|
6
7
|
import { useEnvironmentContext } from "@ark-ui/react/environment";
|
|
@@ -40,6 +41,7 @@ const checkGlyph = /* @__PURE__ */ jsx("svg", {
|
|
|
40
41
|
});
|
|
41
42
|
function CascadeSelect({ value, data, placeholder = "Select…", highlightTrigger, filterable = false, multiple = false, disabled = false, size = "md", onValueChange, ...rest }) {
|
|
42
43
|
injectComponentStyle("cascade-select");
|
|
44
|
+
const messages = useComponentMessages();
|
|
43
45
|
const id = useId();
|
|
44
46
|
const locale = useLocaleContext();
|
|
45
47
|
const env = useEnvironmentContext();
|
|
@@ -151,6 +153,7 @@ function CascadeSelect({ value, data, placeholder = "Select…", highlightTrigge
|
|
|
151
153
|
children: item.label
|
|
152
154
|
}),
|
|
153
155
|
itemState.hasChildren ? /* @__PURE__ */ jsx("span", {
|
|
156
|
+
"data-scope": "cascade-select",
|
|
154
157
|
"data-part": "branch-indicator",
|
|
155
158
|
"aria-hidden": "true",
|
|
156
159
|
children: chevronRight
|
|
@@ -164,7 +167,8 @@ function CascadeSelect({ value, data, placeholder = "Select…", highlightTrigge
|
|
|
164
167
|
})
|
|
165
168
|
});
|
|
166
169
|
const next = nodeState.highlightedChild;
|
|
167
|
-
|
|
170
|
+
const child = next != null && collection.isBranchNode(next) ? renderColumn(next, [...indexPath, nodeState.highlightedIndex], [...valuePath, collection.getNodeValue(next)]) : null;
|
|
171
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [list, child] });
|
|
168
172
|
}
|
|
169
173
|
return /* @__PURE__ */ jsxs("div", {
|
|
170
174
|
...rest,
|
|
@@ -174,6 +178,7 @@ function CascadeSelect({ value, data, placeholder = "Select…", highlightTrigge
|
|
|
174
178
|
...api.getControlProps(),
|
|
175
179
|
children: /* @__PURE__ */ jsxs("button", {
|
|
176
180
|
...api.getTriggerProps(),
|
|
181
|
+
"aria-labelledby": id + ":value-text",
|
|
177
182
|
onClick: (event) => {
|
|
178
183
|
api.getTriggerProps().onClick?.(event);
|
|
179
184
|
setQuery("");
|
|
@@ -181,6 +186,7 @@ function CascadeSelect({ value, data, placeholder = "Select…", highlightTrigge
|
|
|
181
186
|
disabled: disabled || void 0,
|
|
182
187
|
children: [/* @__PURE__ */ jsx("span", {
|
|
183
188
|
...api.getValueTextProps(),
|
|
189
|
+
id: id + ":value-text",
|
|
184
190
|
children: display || placeholder
|
|
185
191
|
}), /* @__PURE__ */ jsx("span", {
|
|
186
192
|
...api.getIndicatorProps(),
|
|
@@ -193,22 +199,26 @@ function CascadeSelect({ value, data, placeholder = "Select…", highlightTrigge
|
|
|
193
199
|
...api.getContentProps(),
|
|
194
200
|
"data-size": size,
|
|
195
201
|
children: [filterable ? /* @__PURE__ */ jsx("div", {
|
|
202
|
+
"data-scope": "cascade-select",
|
|
196
203
|
"data-part": "search",
|
|
197
204
|
children: /* @__PURE__ */ jsx(Input, {
|
|
198
205
|
size: "sm",
|
|
199
206
|
value: query,
|
|
200
207
|
onValueChange: setQuery,
|
|
201
|
-
placeholder:
|
|
202
|
-
"aria-label":
|
|
208
|
+
placeholder: messages.select.filter,
|
|
209
|
+
"aria-label": messages.select.filter
|
|
203
210
|
})
|
|
204
211
|
}) : null, /* @__PURE__ */ jsx("div", {
|
|
212
|
+
"data-scope": "cascade-select",
|
|
205
213
|
"data-part": "corridor",
|
|
206
214
|
"data-flow": filtering ? "flat" : "columns",
|
|
207
215
|
children: filtering ? matchPaths.length === 0 ? /* @__PURE__ */ jsx("p", {
|
|
216
|
+
"data-scope": "cascade-select",
|
|
208
217
|
"data-part": "empty",
|
|
209
218
|
children: "Nothing matches"
|
|
210
219
|
}) : matchPaths.map((hit) => /* @__PURE__ */ jsx("button", {
|
|
211
220
|
type: "button",
|
|
221
|
+
"data-scope": "cascade-select",
|
|
212
222
|
"data-part": "match",
|
|
213
223
|
"data-selected": isSelected(hit.path) || void 0,
|
|
214
224
|
onClick: () => pickMatch(hit.path),
|
|
@@ -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 { useEffect, useState } from "react";
|
|
@@ -6,9 +7,12 @@ import { useListCollection } from "@ark-ui/react/collection";
|
|
|
6
7
|
import { Combobox } from "@ark-ui/react/combobox";
|
|
7
8
|
import { Dialog } from "@ark-ui/react/dialog";
|
|
8
9
|
//#region src/components/command/index.tsx
|
|
9
|
-
function Command({ items = [], placeholder, open, autoFilter = true, inputValue, emptyText
|
|
10
|
+
function Command({ items = [], placeholder, open, autoFilter = true, inputValue, emptyText, onSelect, onOpenChange, onInputValueChange }) {
|
|
10
11
|
injectComponentStyle("command");
|
|
11
12
|
injectComponentStyle("dialog");
|
|
13
|
+
const messages = useComponentMessages();
|
|
14
|
+
const resolvedPlaceholder = placeholder ?? messages.command.search;
|
|
15
|
+
const resolvedEmptyText = emptyText ?? messages.command.noMatches;
|
|
12
16
|
const [internalOpen, setInternalOpen] = useState(false);
|
|
13
17
|
const [listOpen, setListOpen] = useState(true);
|
|
14
18
|
const [fieldText, setFieldText] = useState("");
|
|
@@ -74,6 +78,7 @@ function Command({ items = [], placeholder, open, autoFilter = true, inputValue,
|
|
|
74
78
|
children: /* @__PURE__ */ jsx("div", {
|
|
75
79
|
"data-scope": "command",
|
|
76
80
|
"data-part": "content",
|
|
81
|
+
"aria-label": messages.command.palette,
|
|
77
82
|
children: /* @__PURE__ */ jsxs(Combobox.Root, {
|
|
78
83
|
collection,
|
|
79
84
|
inputValue,
|
|
@@ -96,7 +101,8 @@ function Command({ items = [], placeholder, open, autoFilter = true, inputValue,
|
|
|
96
101
|
asChild: true,
|
|
97
102
|
children: /* @__PURE__ */ jsx("input", {
|
|
98
103
|
type: "text",
|
|
99
|
-
placeholder,
|
|
104
|
+
placeholder: resolvedPlaceholder,
|
|
105
|
+
"aria-label": resolvedPlaceholder,
|
|
100
106
|
"data-scope": "command",
|
|
101
107
|
"data-part": "input"
|
|
102
108
|
})
|
|
@@ -122,7 +128,7 @@ function Command({ items = [], placeholder, open, autoFilter = true, inputValue,
|
|
|
122
128
|
}, group)), groups.size === 0 ? /* @__PURE__ */ jsx("div", {
|
|
123
129
|
"data-scope": "command",
|
|
124
130
|
"data-part": "empty",
|
|
125
|
-
children:
|
|
131
|
+
children: resolvedEmptyText
|
|
126
132
|
}) : null]
|
|
127
133
|
})
|
|
128
134
|
})]
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ThemeScene } from "@bysages/core";
|
|
1
|
+
import { ComponentMessagesOverride, ThemeScene } from "@bysages/core";
|
|
2
2
|
import { HTMLAttributes, ReactNode } from "react";
|
|
3
3
|
//#region src/components/config-provider/index.d.ts
|
|
4
4
|
/** The four density tiers the token layer's `[data-density]` selectors
|
|
@@ -22,6 +22,8 @@ export interface ConfigContext {
|
|
|
22
22
|
dir?: "ltr" | "rtl";
|
|
23
23
|
/** BCP-47 locale, landing as the native `lang` attribute. */
|
|
24
24
|
locale?: string;
|
|
25
|
+
/** Partial leaf overrides for wrapper-owned runtime copy. */
|
|
26
|
+
messages?: ComponentMessagesOverride;
|
|
25
27
|
}
|
|
26
28
|
/** The nearest provider's snapshot, or an empty one when no provider
|
|
27
29
|
* wraps the caller — the hook the date and format families will consume
|
|
@@ -33,6 +35,7 @@ export interface ConfigProviderProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
33
35
|
accent?: string;
|
|
34
36
|
dir?: "ltr" | "rtl";
|
|
35
37
|
locale?: string;
|
|
38
|
+
messages?: ComponentMessagesOverride;
|
|
36
39
|
children?: ReactNode;
|
|
37
40
|
}
|
|
38
41
|
/**
|
|
@@ -42,5 +45,5 @@ export interface ConfigProviderProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
42
45
|
* descendants through `useConfig`, so interactive behavior (formatting,
|
|
43
46
|
* messages) and visual theming stay one decision.
|
|
44
47
|
*/
|
|
45
|
-
export declare function ConfigProvider({ density, scene, accent, dir, locale, children, ...rest }: ConfigProviderProps): import("react").JSX.Element;
|
|
48
|
+
export declare function ConfigProvider({ density, scene, accent, dir, locale, messages, children, ...rest }: ConfigProviderProps): import("react").JSX.Element;
|
|
46
49
|
//#endregion
|
|
@@ -15,14 +15,15 @@ function useConfig() {
|
|
|
15
15
|
* descendants through `useConfig`, so interactive behavior (formatting,
|
|
16
16
|
* messages) and visual theming stay one decision.
|
|
17
17
|
*/
|
|
18
|
-
function ConfigProvider({ density, scene, accent, dir, locale, children, ...rest }) {
|
|
18
|
+
function ConfigProvider({ density, scene, accent, dir, locale, messages, children, ...rest }) {
|
|
19
19
|
return /* @__PURE__ */ jsx(ConfigContextImpl.Provider, {
|
|
20
20
|
value: {
|
|
21
21
|
density,
|
|
22
22
|
scene,
|
|
23
23
|
accent,
|
|
24
24
|
dir,
|
|
25
|
-
locale
|
|
25
|
+
locale,
|
|
26
|
+
messages
|
|
26
27
|
},
|
|
27
28
|
children: /* @__PURE__ */ jsx("div", {
|
|
28
29
|
...rest,
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { HTMLAttributes, ReactNode } from "react";
|
|
2
|
+
//#region src/components/data-view/index.d.ts
|
|
3
|
+
export interface DataViewProps extends HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
items: unknown[];
|
|
5
|
+
/** Ledger rows or a lattice of cards. */
|
|
6
|
+
layout?: "list" | "grid";
|
|
7
|
+
/** Records per page; leave unset to show everything at once. */
|
|
8
|
+
pageSize?: number;
|
|
9
|
+
/** Renders one record; the view lays the returned nodes out. */
|
|
10
|
+
renderItem?: (item: unknown, index: number) => ReactNode;
|
|
11
|
+
header?: ReactNode;
|
|
12
|
+
}
|
|
13
|
+
/** One vessel, two layouts: the caller renders each record through
|
|
14
|
+
* renderItem, the view lays the records out as a ledger or a lattice
|
|
15
|
+
* and — when a page size is given — pages them with the pagination
|
|
16
|
+
* family's own parts rather than a second implementation. */
|
|
17
|
+
export declare function DataView({ items, layout, pageSize, renderItem, header, ...rest }: DataViewProps): import("react").JSX.Element;
|
|
18
|
+
//#endregion
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { n as useComponentMessages } from "../../messages-1jJWtaYU.mjs";
|
|
2
|
+
import { Pagination } from "../pagination/index.mjs";
|
|
3
|
+
import { injectComponentStyle } from "@bysages/core";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { useState } from "react";
|
|
6
|
+
//#region src/components/data-view/index.tsx
|
|
7
|
+
/** One vessel, two layouts: the caller renders each record through
|
|
8
|
+
* renderItem, the view lays the records out as a ledger or a lattice
|
|
9
|
+
* and — when a page size is given — pages them with the pagination
|
|
10
|
+
* family's own parts rather than a second implementation. */
|
|
11
|
+
function DataView({ items, layout = "list", pageSize, renderItem, header, ...rest }) {
|
|
12
|
+
injectComponentStyle("data-view");
|
|
13
|
+
const [page, setPage] = useState(1);
|
|
14
|
+
const messages = useComponentMessages();
|
|
15
|
+
const pageCount = pageSize ? Math.max(1, Math.ceil(items.length / pageSize)) : 1;
|
|
16
|
+
const visible = pageSize ? items.slice((page - 1) * pageSize, page * pageSize) : items;
|
|
17
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
18
|
+
...rest,
|
|
19
|
+
"data-scope": "data-view",
|
|
20
|
+
"data-part": "root",
|
|
21
|
+
children: [
|
|
22
|
+
header,
|
|
23
|
+
/* @__PURE__ */ jsx("div", {
|
|
24
|
+
"data-scope": "data-view",
|
|
25
|
+
"data-part": "content",
|
|
26
|
+
"data-layout": layout,
|
|
27
|
+
children: visible.map((item, index) => /* @__PURE__ */ jsx("div", {
|
|
28
|
+
"data-scope": "data-view",
|
|
29
|
+
"data-part": "cell",
|
|
30
|
+
children: renderItem?.(item, index)
|
|
31
|
+
}, index))
|
|
32
|
+
}),
|
|
33
|
+
pageSize && pageCount > 1 ? /* @__PURE__ */ jsx("div", {
|
|
34
|
+
"data-scope": "data-view",
|
|
35
|
+
"data-part": "pager",
|
|
36
|
+
children: /* @__PURE__ */ jsxs(Pagination.Root, {
|
|
37
|
+
count: items.length,
|
|
38
|
+
pageSize,
|
|
39
|
+
page,
|
|
40
|
+
siblingCount: 1,
|
|
41
|
+
onPageChange: (details) => setPage(details.page),
|
|
42
|
+
children: [
|
|
43
|
+
/* @__PURE__ */ jsx(Pagination.PrevTrigger, {
|
|
44
|
+
"aria-label": messages.pagination.previous,
|
|
45
|
+
children: "‹"
|
|
46
|
+
}),
|
|
47
|
+
/* @__PURE__ */ jsx(Pagination.Context, { children: (pagination) => pagination.pages.map((entry, index) => entry.type === "ellipsis" ? /* @__PURE__ */ jsx(Pagination.Ellipsis, {
|
|
48
|
+
index,
|
|
49
|
+
children: "…"
|
|
50
|
+
}, `e${index}`) : /* @__PURE__ */ jsx(Pagination.Item, {
|
|
51
|
+
type: "page",
|
|
52
|
+
value: entry.value,
|
|
53
|
+
children: entry.value
|
|
54
|
+
}, entry.value)) }),
|
|
55
|
+
/* @__PURE__ */ jsx(Pagination.NextTrigger, {
|
|
56
|
+
"aria-label": messages.pagination.next,
|
|
57
|
+
children: "›"
|
|
58
|
+
})
|
|
59
|
+
]
|
|
60
|
+
})
|
|
61
|
+
}) : null
|
|
62
|
+
]
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
//#endregion
|
|
66
|
+
export { DataView };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { HTMLAttributes, ReactNode } from "react";
|
|
2
|
+
//#region src/components/deferred-content/index.d.ts
|
|
3
|
+
export interface DeferredContentProps extends HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
/** How much of the placeholder must be visible before the content
|
|
5
|
+
* mounts, from 0 (any pixel) to 1 (the whole box). */
|
|
6
|
+
threshold?: number;
|
|
7
|
+
/** Drawn until the box approaches the viewport. */
|
|
8
|
+
placeholder?: ReactNode;
|
|
9
|
+
children?: ReactNode;
|
|
10
|
+
}
|
|
11
|
+
/** Content that waits to be worth rendering: the slot stays off the
|
|
12
|
+
* tree until the placeholder scrolls near the viewport, then mounts
|
|
13
|
+
* once and stays. The placeholder is drawn by the caller, so the late
|
|
14
|
+
* arrival costs no layout shift it cannot predict. */
|
|
15
|
+
export declare function DeferredContent({ threshold, placeholder, children, ...rest }: DeferredContentProps): import("react").JSX.Element;
|
|
16
|
+
//#endregion
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { injectComponentStyle } from "@bysages/core";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useRef, useState } from "react";
|
|
4
|
+
//#region src/components/deferred-content/index.tsx
|
|
5
|
+
/** Content that waits to be worth rendering: the slot stays off the
|
|
6
|
+
* tree until the placeholder scrolls near the viewport, then mounts
|
|
7
|
+
* once and stays. The placeholder is drawn by the caller, so the late
|
|
8
|
+
* arrival costs no layout shift it cannot predict. */
|
|
9
|
+
function DeferredContent({ threshold = .2, placeholder, children, ...rest }) {
|
|
10
|
+
injectComponentStyle("deferred-content");
|
|
11
|
+
const host = useRef(null);
|
|
12
|
+
const [active, setActive] = useState(false);
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
const node = host.current;
|
|
15
|
+
if (!node) return;
|
|
16
|
+
const observer = new IntersectionObserver((entries) => {
|
|
17
|
+
if (entries.some((entry) => entry.isIntersecting)) {
|
|
18
|
+
setActive(true);
|
|
19
|
+
observer.disconnect();
|
|
20
|
+
}
|
|
21
|
+
}, { threshold });
|
|
22
|
+
observer.observe(node);
|
|
23
|
+
return () => observer.disconnect();
|
|
24
|
+
}, [threshold]);
|
|
25
|
+
return /* @__PURE__ */ jsx("div", {
|
|
26
|
+
ref: host,
|
|
27
|
+
...rest,
|
|
28
|
+
"data-scope": "deferred-content",
|
|
29
|
+
"data-part": "root",
|
|
30
|
+
children: active ? children : placeholder
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
//#endregion
|
|
34
|
+
export { DeferredContent };
|
|
@@ -5,14 +5,22 @@ import { HTMLAttributes } from "react";
|
|
|
5
5
|
* stacks each pair for narrow measures. */
|
|
6
6
|
export interface DescriptionsRootProps extends HTMLAttributes<HTMLDListElement> {
|
|
7
7
|
layout?: "horizontal" | "vertical";
|
|
8
|
+
/** The framed register: one hairline round the whole, terms on
|
|
9
|
+
* inset paper. */
|
|
10
|
+
bordered?: boolean;
|
|
11
|
+
/** Pairs across the grid: one ledger per column. */
|
|
12
|
+
column?: number;
|
|
13
|
+
}
|
|
14
|
+
export declare function DescriptionsRoot({ layout, bordered, column, children, ...rest }: DescriptionsRootProps): import("react").JSX.Element;
|
|
15
|
+
declare function DescriptionsItem({ span, children, ...rest }: HTMLAttributes<HTMLDivElement> & {
|
|
16
|
+
span?: number;
|
|
17
|
+
}): import("react").JSX.Element;
|
|
18
|
+
declare namespace DescriptionsItem {
|
|
19
|
+
var displayName: string;
|
|
8
20
|
}
|
|
9
|
-
export declare function DescriptionsRoot({ layout, children, ...rest }: DescriptionsRootProps): import("react").JSX.Element;
|
|
10
21
|
export declare const Descriptions: {
|
|
11
22
|
Root: typeof DescriptionsRoot;
|
|
12
|
-
Item:
|
|
13
|
-
({ children, ...rest }: HTMLAttributes<HTMLElement>): import("react").JSX.Element;
|
|
14
|
-
displayName: string;
|
|
15
|
-
};
|
|
23
|
+
Item: typeof DescriptionsItem;
|
|
16
24
|
Term: {
|
|
17
25
|
({ children, ...rest }: HTMLAttributes<HTMLElement>): import("react").JSX.Element;
|
|
18
26
|
displayName: string;
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import { injectComponentStyle } from "@bysages/core";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
//#region src/components/descriptions/index.tsx
|
|
4
|
-
function DescriptionsRoot({ layout = "horizontal", children, ...rest }) {
|
|
4
|
+
function DescriptionsRoot({ layout = "horizontal", bordered = false, column = 1, children, ...rest }) {
|
|
5
5
|
injectComponentStyle("descriptions");
|
|
6
6
|
return /* @__PURE__ */ jsx("dl", {
|
|
7
7
|
...rest,
|
|
8
8
|
"data-scope": "descriptions",
|
|
9
9
|
"data-part": "root",
|
|
10
10
|
"data-layout": layout,
|
|
11
|
+
"data-bordered": bordered || void 0,
|
|
12
|
+
style: {
|
|
13
|
+
...rest.style,
|
|
14
|
+
"--bs-desc-columns": String(column)
|
|
15
|
+
},
|
|
11
16
|
children
|
|
12
17
|
});
|
|
13
18
|
}
|
|
@@ -22,9 +27,22 @@ function part(name, tag) {
|
|
|
22
27
|
Component.displayName = "Descriptions" + name;
|
|
23
28
|
return Component;
|
|
24
29
|
}
|
|
30
|
+
function DescriptionsItem({ span = 1, children, ...rest }) {
|
|
31
|
+
return /* @__PURE__ */ jsx("div", {
|
|
32
|
+
...rest,
|
|
33
|
+
style: {
|
|
34
|
+
...rest.style,
|
|
35
|
+
"--bs-desc-span": String(span * 2)
|
|
36
|
+
},
|
|
37
|
+
"data-scope": "descriptions",
|
|
38
|
+
"data-part": "item",
|
|
39
|
+
children
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
DescriptionsItem.displayName = "DescriptionsItem";
|
|
25
43
|
const Descriptions = {
|
|
26
44
|
Root: DescriptionsRoot,
|
|
27
|
-
Item:
|
|
45
|
+
Item: DescriptionsItem,
|
|
28
46
|
Term: part("Term", "dt"),
|
|
29
47
|
Detail: part("Detail", "dd")
|
|
30
48
|
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { HTMLAttributes, ReactNode } from "react";
|
|
2
|
+
//#region src/components/dock/index.d.ts
|
|
3
|
+
export interface DockProps extends HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
/** The tallest an item swells under the hand — 1 stands still. */
|
|
5
|
+
maxScale?: number;
|
|
6
|
+
/** How far the hand reaches, in px, before an item stops answering. */
|
|
7
|
+
radius?: number;
|
|
8
|
+
children?: ReactNode;
|
|
9
|
+
}
|
|
10
|
+
export interface DockItemProps extends HTMLAttributes<HTMLDivElement> {
|
|
11
|
+
children?: ReactNode;
|
|
12
|
+
}
|
|
13
|
+
/** The magnifying dock: a floating rail whose icons swell toward the
|
|
14
|
+
* hand. The wrapper measures per item and writes --bs-dock-scale; CSS
|
|
15
|
+
* eases the chase, so no spring engine rides along. */
|
|
16
|
+
export declare function DockRoot({ maxScale, radius, children, ...rest }: DockProps): import("react").JSX.Element;
|
|
17
|
+
/** One moored place in the rail: whatever slots in grows from the
|
|
18
|
+
* floor, never from its center. */
|
|
19
|
+
export declare function DockItem({ children, ...rest }: DockItemProps): import("react").JSX.Element;
|
|
20
|
+
/** The whole family under one handle — Dock.Root, Dock.Item. */
|
|
21
|
+
export declare const Dock: typeof DockRoot & {
|
|
22
|
+
Root: typeof DockRoot;
|
|
23
|
+
Item: typeof DockItem;
|
|
24
|
+
};
|
|
25
|
+
//#endregion
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { injectComponentStyle } from "@bysages/core";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
//#region src/components/dock/index.tsx
|
|
4
|
+
const ITEM = "[data-scope=\"dock\"][data-part=\"item\"]";
|
|
5
|
+
/** The magnifying dock: a floating rail whose icons swell toward the
|
|
6
|
+
* hand. The wrapper measures per item and writes --bs-dock-scale; CSS
|
|
7
|
+
* eases the chase, so no spring engine rides along. */
|
|
8
|
+
function DockRoot({ maxScale = 1.5, radius = 96, children, ...rest }) {
|
|
9
|
+
injectComponentStyle("dock");
|
|
10
|
+
const magnify = (event) => {
|
|
11
|
+
for (const item of event.currentTarget.querySelectorAll(ITEM)) {
|
|
12
|
+
const rect = item.getBoundingClientRect();
|
|
13
|
+
const dist = Math.abs(event.clientX - (rect.left + rect.width / 2));
|
|
14
|
+
const t = Math.max(0, 1 - dist / radius);
|
|
15
|
+
item.style.setProperty("--bs-dock-scale", (1 + (maxScale - 1) * t * t).toFixed(4));
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
const reset = (event) => {
|
|
19
|
+
for (const item of event.currentTarget.querySelectorAll(ITEM)) item.style.removeProperty("--bs-dock-scale");
|
|
20
|
+
};
|
|
21
|
+
return /* @__PURE__ */ jsx("div", {
|
|
22
|
+
...rest,
|
|
23
|
+
"data-scope": "dock",
|
|
24
|
+
"data-part": "root",
|
|
25
|
+
style: {
|
|
26
|
+
...rest.style,
|
|
27
|
+
"--bs-dock-max-scale": maxScale
|
|
28
|
+
},
|
|
29
|
+
onPointerMove: magnify,
|
|
30
|
+
onPointerLeave: reset,
|
|
31
|
+
children
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
/** One moored place in the rail: whatever slots in grows from the
|
|
35
|
+
* floor, never from its center. */
|
|
36
|
+
function DockItem({ children, ...rest }) {
|
|
37
|
+
injectComponentStyle("dock");
|
|
38
|
+
return /* @__PURE__ */ jsx("div", {
|
|
39
|
+
...rest,
|
|
40
|
+
"data-scope": "dock",
|
|
41
|
+
"data-part": "item",
|
|
42
|
+
children
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
/** The whole family under one handle — Dock.Root, Dock.Item. */
|
|
46
|
+
const Dock = Object.assign(DockRoot, {
|
|
47
|
+
Root: DockRoot,
|
|
48
|
+
Item: DockItem
|
|
49
|
+
});
|
|
50
|
+
//#endregion
|
|
51
|
+
export { Dock, DockItem, DockRoot };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { n as useComponentMessages } from "../../messages-1jJWtaYU.mjs";
|
|
1
2
|
import { Button } from "../button/index.mjs";
|
|
2
|
-
import { Input } from "
|
|
3
|
+
import { t as Input } from "../../input-2oezH-dY.mjs";
|
|
3
4
|
import { injectComponentStyle } from "@bysages/core";
|
|
4
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
6
|
//#region src/components/dynamic-input/index.tsx
|
|
@@ -13,6 +14,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
13
14
|
*/
|
|
14
15
|
function DynamicInput({ value, min = 0, max, placeholder, addLabel = "Add entry", disabled = false, invalid = false, size = "md", onValueChange, children: _children, ...rest }) {
|
|
15
16
|
injectComponentStyle("dynamic-input");
|
|
17
|
+
const messages = useComponentMessages();
|
|
16
18
|
const values = value ?? [""];
|
|
17
19
|
const update = (index, next) => {
|
|
18
20
|
const rows = values.slice();
|
|
@@ -47,7 +49,7 @@ function DynamicInput({ value, min = 0, max, placeholder, addLabel = "Add entry"
|
|
|
47
49
|
square: true,
|
|
48
50
|
size,
|
|
49
51
|
disabled: disabled || !canRemove,
|
|
50
|
-
"aria-label":
|
|
52
|
+
"aria-label": messages.dynamicEntry.remove,
|
|
51
53
|
onClick: () => remove(index),
|
|
52
54
|
children: crossIcon()
|
|
53
55
|
})]
|
|
@@ -6,13 +6,20 @@ type FileUploadRootProps = ComponentProps<typeof FileUpload$1.Root> & {
|
|
|
6
6
|
size?: "sm" | "md" | "lg";
|
|
7
7
|
};
|
|
8
8
|
declare function FileUploadRoot({ size, ...rest }: FileUploadRootProps): import("react").JSX.Element;
|
|
9
|
+
/** The inner trigger repeats the click binding the dropzone already
|
|
10
|
+
* owns, and no flavor of taming a nested button survives the audit —
|
|
11
|
+
* assistive tech can still land on it. So the visual cue is a plain
|
|
12
|
+
* span wearing the trigger props; the dropzone stays the one real
|
|
13
|
+
* control, keyboard included. */
|
|
14
|
+
declare function FileUploadTrigger(props: ComponentProps<typeof FileUpload$1.Trigger>): import("react").JSX.Element;
|
|
9
15
|
/** Ark's FileUpload, dressed in the paper-and-ink system: a dashed
|
|
10
16
|
* dropzone that floods with subtle light on drag-over, and accepted files
|
|
11
17
|
* as loose hairline slips. The API is Ark's own — Root, Label, Trigger,
|
|
12
18
|
* Dropzone, HiddenInput, ItemGroup, Item, ItemName, ItemSizeText,
|
|
13
19
|
* ItemPreview, ItemPreviewImage, ItemDeleteTrigger, ClearTrigger,
|
|
14
20
|
* Context. */
|
|
15
|
-
export declare const FileUpload: Omit<typeof FileUpload$1, "Root"> & {
|
|
21
|
+
export declare const FileUpload: Omit<typeof FileUpload$1, "Root" | "Trigger"> & {
|
|
16
22
|
Root: typeof FileUploadRoot;
|
|
23
|
+
Trigger: typeof FileUploadTrigger;
|
|
17
24
|
};
|
|
18
25
|
//#endregion
|
|
@@ -8,6 +8,24 @@ function FileUploadRoot({ size = "md", ...rest }) {
|
|
|
8
8
|
"data-size": size
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
|
+
/** The inner trigger repeats the click binding the dropzone already
|
|
12
|
+
* owns, and no flavor of taming a nested button survives the audit —
|
|
13
|
+
* assistive tech can still land on it. So the visual cue is a plain
|
|
14
|
+
* span wearing the trigger props; the dropzone stays the one real
|
|
15
|
+
* control, keyboard included. */
|
|
16
|
+
function FileUploadTrigger(props) {
|
|
17
|
+
const { children, ...rest } = props;
|
|
18
|
+
return /* @__PURE__ */ jsx(FileUpload$1.Trigger, {
|
|
19
|
+
asChild: true,
|
|
20
|
+
...rest,
|
|
21
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
22
|
+
"data-scope": "file-upload",
|
|
23
|
+
"data-part": "trigger",
|
|
24
|
+
"aria-hidden": "true",
|
|
25
|
+
children
|
|
26
|
+
})
|
|
27
|
+
});
|
|
28
|
+
}
|
|
11
29
|
/** Ark's FileUpload, dressed in the paper-and-ink system: a dashed
|
|
12
30
|
* dropzone that floods with subtle light on drag-over, and accepted files
|
|
13
31
|
* as loose hairline slips. The API is Ark's own — Root, Label, Trigger,
|
|
@@ -16,7 +34,8 @@ function FileUploadRoot({ size = "md", ...rest }) {
|
|
|
16
34
|
* Context. */
|
|
17
35
|
const FileUpload = {
|
|
18
36
|
...FileUpload$1,
|
|
19
|
-
Root: FileUploadRoot
|
|
37
|
+
Root: FileUploadRoot,
|
|
38
|
+
Trigger: FileUploadTrigger
|
|
20
39
|
};
|
|
21
40
|
injectComponentStyle("file-upload");
|
|
22
41
|
//#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 { injectComponentStyle } from "@bysages/core";
|
|
3
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -46,12 +47,13 @@ const STEP_DOWN = {
|
|
|
46
47
|
};
|
|
47
48
|
function Trigger({ label, children }) {
|
|
48
49
|
const context = useContext(FLOAT_BUTTON_CONTEXT);
|
|
50
|
+
const messages = useComponentMessages();
|
|
49
51
|
return /* @__PURE__ */ jsx(Button, {
|
|
50
52
|
variant: "solid",
|
|
51
53
|
square: true,
|
|
52
54
|
size: context?.size ?? "lg",
|
|
53
55
|
onClick: () => context?.toggle(),
|
|
54
|
-
"aria-label": label ||
|
|
56
|
+
"aria-label": label || messages.floatButton.actions,
|
|
55
57
|
"aria-expanded": context ? context.open : false,
|
|
56
58
|
children
|
|
57
59
|
});
|
|
@@ -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
|
}
|