@bysages/react 0.3.0 → 0.4.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/dist/{ai-response-jZy-0Tvv.mjs → ai-response-B4DX7nmJ.mjs} +10 -4
- package/dist/chevron-a2nIZKN4.mjs +6 -0
- package/dist/components/accordion/index.d.mts +22 -4
- package/dist/components/accordion/index.mjs +31 -1
- package/dist/components/affix/index.d.mts +4 -1
- package/dist/components/affix/index.mjs +5 -3
- package/dist/components/ai/index.d.mts +2 -2
- package/dist/components/ai/index.mjs +29 -12
- package/dist/components/ai-action/index.d.mts +4 -1
- package/dist/components/ai-action/index.mjs +3 -1
- package/dist/components/ai-attachments/index.d.mts +10 -4
- package/dist/components/ai-attachments/index.mjs +19 -45
- package/dist/components/ai-message/index.d.mts +4 -1
- package/dist/components/ai-message/index.mjs +3 -1
- package/dist/components/ai-prompt-input/index.d.mts +5 -2
- package/dist/components/ai-prompt-input/index.mjs +17 -17
- package/dist/components/ai-reasoning/index.d.mts +4 -1
- package/dist/components/ai-reasoning/index.mjs +4 -2
- package/dist/components/ai-response/index.d.mts +8 -3
- package/dist/components/ai-response/index.mjs +1 -1
- package/dist/components/ai-source/index.d.mts +8 -2
- package/dist/components/ai-source/index.mjs +5 -2
- package/dist/components/ai-suggestion/index.d.mts +4 -1
- package/dist/components/ai-suggestion/index.mjs +3 -1
- package/dist/components/ai-tool/index.d.mts +4 -1
- package/dist/components/ai-tool/index.mjs +4 -2
- package/dist/components/alert/index.d.mts +2 -0
- package/dist/components/alert/index.mjs +11 -18
- package/dist/components/angle-slider/index.d.mts +19 -2
- package/dist/components/angle-slider/index.mjs +31 -8
- package/dist/components/aspect-ratio/index.d.mts +4 -1
- package/dist/components/aspect-ratio/index.mjs +3 -1
- package/dist/components/autocomplete/index.d.mts +3 -1
- package/dist/components/autocomplete/index.mjs +9 -2
- package/dist/components/avatar/index.d.mts +2 -2
- package/dist/components/avatar/index.mjs +9 -2
- package/dist/components/avatar-group/index.d.mts +4 -1
- package/dist/components/avatar-group/index.mjs +3 -1
- package/dist/components/back-top/index.d.mts +7 -1
- package/dist/components/back-top/index.mjs +12 -17
- package/dist/components/badge/index.d.mts +4 -1
- package/dist/components/badge/index.mjs +3 -1
- package/dist/components/banner/index.mjs +13 -18
- package/dist/components/block-ui/index.d.mts +4 -1
- package/dist/components/block-ui/index.mjs +3 -1
- package/dist/components/breadcrumb/index.d.mts +3 -8
- package/dist/components/breadcrumb/index.mjs +11 -1
- package/dist/components/button/index.d.mts +4 -1
- package/dist/components/button/index.mjs +3 -1
- package/dist/components/calendar/index.d.mts +3 -1
- package/dist/components/calendar/index.mjs +9 -10
- package/dist/components/carousel/index.d.mts +21 -1
- package/dist/components/carousel/index.mjs +43 -2
- package/dist/components/cascade-select/index.d.mts +6 -1
- package/dist/components/cascade-select/index.mjs +18 -37
- package/dist/components/checkbox/index.d.mts +20 -2
- package/dist/components/checkbox/index.mjs +28 -8
- package/dist/components/checkbox-group/index.d.mts +8 -6
- package/dist/components/checkbox-group/index.mjs +44 -48
- package/dist/components/chip/index.d.mts +4 -1
- package/dist/components/chip/index.mjs +3 -1
- package/dist/components/client-only/index.d.mts +7 -2
- package/dist/components/client-only/index.mjs +5 -1
- package/dist/components/clipboard/index.d.mts +17 -4
- package/dist/components/clipboard/index.mjs +33 -5
- package/dist/components/collapsible/index.d.mts +16 -4
- package/dist/components/collapsible/index.mjs +25 -1
- package/dist/components/color-picker/index.d.mts +20 -4
- package/dist/components/color-picker/index.mjs +56 -14
- package/dist/components/combobox/index.d.mts +27 -1
- package/dist/components/combobox/index.mjs +62 -5
- package/dist/components/command/index.d.mts +4 -1
- package/dist/components/command/index.mjs +15 -3
- package/dist/components/comment/index.d.mts +4 -1
- package/dist/components/comment/index.mjs +3 -1
- package/dist/components/config-provider/index.d.mts +8 -2
- package/dist/components/config-provider/index.mjs +5 -2
- package/dist/components/container/index.d.mts +4 -1
- package/dist/components/container/index.mjs +3 -1
- package/dist/components/data-view/index.d.mts +4 -1
- package/dist/components/data-view/index.mjs +7 -3
- package/dist/components/date-input/index.d.mts +19 -4
- package/dist/components/date-input/index.mjs +33 -9
- package/dist/components/date-picker/index.d.mts +21 -4
- package/dist/components/date-picker/index.mjs +58 -11
- package/dist/components/deferred-content/index.d.mts +4 -1
- package/dist/components/deferred-content/index.mjs +3 -1
- package/dist/components/descriptions/index.d.mts +10 -2
- package/dist/components/descriptions/index.mjs +13 -8
- package/dist/components/dialog/index.d.mts +18 -5
- package/dist/components/dialog/index.mjs +43 -1
- package/dist/components/download-trigger/index.d.mts +7 -2
- package/dist/components/download-trigger/index.mjs +5 -1
- package/dist/components/drawer/index.d.mts +18 -6
- package/dist/components/drawer/index.mjs +40 -1
- package/dist/components/dynamic-input/index.d.mts +4 -1
- package/dist/components/dynamic-input/index.mjs +13 -19
- package/dist/components/editable/index.d.mts +28 -7
- package/dist/components/editable/index.mjs +43 -4
- package/dist/components/ellipsis/index.d.mts +4 -1
- package/dist/components/ellipsis/index.mjs +3 -1
- package/dist/components/field/index.d.mts +30 -5
- package/dist/components/field/index.mjs +36 -3
- package/dist/components/fieldset/index.d.mts +19 -4
- package/dist/components/fieldset/index.mjs +28 -3
- package/dist/components/file-upload/index.d.mts +36 -9
- package/dist/components/file-upload/index.mjs +66 -11
- package/dist/components/float-button/index.mjs +3 -1
- package/dist/components/floating-panel/index.d.mts +18 -6
- package/dist/components/floating-panel/index.mjs +55 -1
- package/dist/components/focus-trap/index.d.mts +7 -2
- package/dist/components/focus-trap/index.mjs +5 -1
- package/dist/components/form/index.d.mts +1 -1
- package/dist/components/form/index.mjs +5 -2
- package/dist/components/frame/index.d.mts +4 -8
- package/dist/components/frame/index.mjs +13 -1
- package/dist/components/grid/index.d.mts +4 -1
- package/dist/components/grid/index.mjs +3 -1
- package/dist/components/highlight/index.d.mts +3 -5
- package/dist/components/highlight/index.mjs +6 -1
- package/dist/components/hover-card/index.d.mts +20 -4
- package/dist/components/hover-card/index.mjs +32 -1
- package/dist/components/icon/index.d.mts +10 -8
- package/dist/components/icon/index.mjs +5 -3
- package/dist/components/image/index.d.mts +11 -2
- package/dist/components/image/index.mjs +16 -29
- package/dist/components/image-cropper/index.d.mts +13 -2
- package/dist/components/image-cropper/index.mjs +34 -2
- package/dist/components/image-viewer/index.d.mts +2 -18
- package/dist/components/image-viewer/index.mjs +3 -109
- package/dist/components/input/index.d.mts +3 -1
- package/dist/components/input/index.mjs +1 -1
- package/dist/components/json-tree-view/index.d.mts +20 -4
- package/dist/components/json-tree-view/index.mjs +38 -4
- package/dist/components/kbd/index.d.mts +4 -1
- package/dist/components/kbd/index.mjs +3 -1
- package/dist/components/layout/index.d.mts +25 -7
- package/dist/components/layout/index.mjs +159 -63
- package/dist/components/link/index.d.mts +4 -1
- package/dist/components/link/index.mjs +3 -1
- package/dist/components/list/index.d.mts +5 -4
- package/dist/components/list/index.mjs +10 -1
- package/dist/components/listbox/index.d.mts +22 -1
- package/dist/components/listbox/index.mjs +36 -4
- package/dist/components/marquee/index.d.mts +18 -1
- package/dist/components/marquee/index.mjs +34 -2
- package/dist/components/masonry/index.d.mts +4 -1
- package/dist/components/masonry/index.mjs +3 -1
- package/dist/components/media-player/index.d.mts +2 -0
- package/dist/components/media-player/index.mjs +2 -0
- package/dist/components/mentions/index.d.mts +1 -1
- package/dist/components/mentions/index.mjs +1 -1
- package/dist/components/menu/index.d.mts +29 -11
- package/dist/components/menu/index.mjs +34 -12
- package/dist/components/menubar/index.d.mts +3 -1
- package/dist/components/menubar/index.mjs +7 -1
- package/dist/components/navigation-menu/index.d.mts +25 -1
- package/dist/components/navigation-menu/index.mjs +36 -1
- package/dist/components/number-input/index.d.mts +28 -6
- package/dist/components/number-input/index.mjs +33 -8
- package/dist/components/order-list/index.d.mts +4 -1
- package/dist/components/order-list/index.mjs +34 -33
- package/dist/components/pagination/index.d.mts +23 -3
- package/dist/components/pagination/index.mjs +57 -12
- package/dist/components/password-input/index.d.mts +24 -6
- package/dist/components/password-input/index.mjs +31 -8
- package/dist/components/pin-input/index.d.mts +23 -5
- package/dist/components/pin-input/index.mjs +29 -7
- package/dist/components/popconfirm/index.d.mts +9 -5
- package/dist/components/popconfirm/index.mjs +23 -18
- package/dist/components/popover/index.d.mts +2 -8
- package/dist/components/popover/index.mjs +44 -4
- package/dist/components/presence/index.d.mts +10 -2
- package/dist/components/presence/index.mjs +6 -1
- package/dist/components/progress/index.d.mts +18 -3
- package/dist/components/progress/index.mjs +34 -9
- package/dist/components/progress-group/index.d.mts +4 -1
- package/dist/components/progress-group/index.mjs +4 -2
- package/dist/components/qr-code/index.d.mts +14 -1
- package/dist/components/qr-code/index.mjs +26 -2
- package/dist/components/radio-group/index.d.mts +27 -2
- package/dist/components/radio-group/index.mjs +32 -8
- package/dist/components/rating-group/index.d.mts +20 -3
- package/dist/components/rating-group/index.mjs +26 -8
- package/dist/components/result/index.d.mts +1 -1
- package/dist/components/result/index.mjs +2 -2
- package/dist/components/scroll-area/index.d.mts +14 -1
- package/dist/components/scroll-area/index.mjs +32 -2
- package/dist/components/segment-group/index.d.mts +28 -2
- package/dist/components/segment-group/index.mjs +34 -7
- package/dist/components/select/index.d.mts +2 -2
- package/dist/components/select/index.mjs +1 -1
- package/dist/components/separator/index.d.mts +4 -1
- package/dist/components/separator/index.mjs +3 -1
- package/dist/components/signature-pad/index.d.mts +25 -5
- package/dist/components/signature-pad/index.mjs +37 -3
- package/dist/components/skeleton/index.d.mts +4 -1
- package/dist/components/skeleton/index.mjs +3 -1
- package/dist/components/slider/index.d.mts +21 -2
- package/dist/components/slider/index.mjs +31 -8
- package/dist/components/spinner/index.d.mts +4 -1
- package/dist/components/spinner/index.mjs +6 -2
- package/dist/components/split-button/index.d.mts +3 -1
- package/dist/components/split-button/index.mjs +15 -18
- package/dist/components/splitter/index.d.mts +17 -4
- package/dist/components/splitter/index.mjs +35 -1
- package/dist/components/spotlight/index.d.mts +4 -1
- package/dist/components/spotlight/index.mjs +3 -1
- package/dist/components/stack/index.d.mts +4 -1
- package/dist/components/stack/index.mjs +6 -4
- package/dist/components/steps/index.d.mts +27 -3
- package/dist/components/steps/index.mjs +36 -12
- package/dist/components/swap/index.d.mts +11 -5
- package/dist/components/swap/index.mjs +30 -3
- package/dist/components/switch/index.d.mts +20 -2
- package/dist/components/switch/index.mjs +27 -8
- package/dist/components/table/index.d.mts +4 -1
- package/dist/components/table/index.mjs +44 -70
- package/dist/components/tabs/index.d.mts +24 -2
- package/dist/components/tabs/index.mjs +25 -9
- package/dist/components/tags-input/index.d.mts +33 -8
- package/dist/components/tags-input/index.mjs +41 -9
- package/dist/components/terminal/index.d.mts +4 -1
- package/dist/components/terminal/index.mjs +8 -3
- package/dist/components/textarea/index.d.mts +4 -1
- package/dist/components/textarea/index.mjs +3 -1
- package/dist/components/timer/index.d.mts +18 -1
- package/dist/components/timer/index.mjs +51 -2
- package/dist/components/toast/index.d.mts +3 -6
- package/dist/components/toast/index.mjs +22 -2
- package/dist/components/toc/index.d.mts +24 -4
- package/dist/components/toc/index.mjs +41 -3
- package/dist/components/toggle/index.d.mts +11 -4
- package/dist/components/toggle/index.mjs +21 -1
- package/dist/components/toggle-group/index.d.mts +26 -2
- package/dist/components/toggle-group/index.mjs +31 -6
- package/dist/components/toolbar/index.d.mts +4 -1
- package/dist/components/toolbar/index.mjs +3 -1
- package/dist/components/tooltip/index.d.mts +17 -4
- package/dist/components/tooltip/index.mjs +28 -1
- package/dist/components/tour/index.d.mts +18 -9
- package/dist/components/tour/index.mjs +44 -2
- package/dist/components/transfer/index.d.mts +3 -1
- package/dist/components/transfer/index.mjs +20 -30
- package/dist/components/tree-select/index.d.mts +3 -1
- package/dist/components/tree-select/index.mjs +15 -24
- package/dist/components/tree-view/index.d.mts +30 -1
- package/dist/components/tree-view/index.mjs +69 -6
- package/dist/components/typography/index.d.mts +4 -0
- package/dist/components/typography/index.mjs +1 -0
- package/dist/components/user/index.d.mts +4 -1
- package/dist/components/user/index.mjs +3 -1
- package/dist/components/virtual-list/index.d.mts +4 -1
- package/dist/components/virtual-list/index.mjs +11 -12
- package/dist/components/watermark/index.d.mts +4 -1
- package/dist/components/watermark/index.mjs +4 -2
- package/dist/family-DE_GQeeM.mjs +9 -0
- package/dist/icon-BALgGtNK.mjs +18 -0
- package/dist/id-C37UYLwJ.mjs +13 -0
- package/dist/image-viewer-Cf6thHax.mjs +141 -0
- package/dist/{index-Uefyw7Im.d.mts → index-Bbg4heDO.d.mts} +12 -7
- package/dist/index-BcRdWGY-.d.mts +115 -0
- package/dist/{index-DFN9F5Zt.d.mts → index-D_iKc2Uw.d.mts} +32 -3
- package/dist/{index-CsfxYv6J.d.mts → index-DdNKngUQ.d.mts} +63 -39
- package/dist/index-Dj8S4eyJ.d.mts +41 -0
- package/dist/index-Eu-Bttta.d.mts +24 -0
- package/dist/{index-uPyYiWaL.d.mts → index-PsgGWW3m.d.mts} +8 -2
- package/dist/index.d.mts +36 -35
- package/dist/index.mjs +13 -12
- package/dist/{input-2oezH-dY.mjs → input-C21Zzuy6.mjs} +3 -1
- package/dist/media-player-gQrnxU52.mjs +554 -0
- package/dist/{mentions-DMIBCBOd.mjs → mentions-BuWibdci.mjs} +74 -42
- package/dist/messages-1jJWtaYU.mjs +16 -0
- package/dist/select-ozUFq0zd.mjs +121 -0
- package/package.json +3 -3
- package/dist/chevron-BeHvt46K.mjs +0 -17
- package/dist/select-D1xiT1oJ.mjs +0 -68
|
@@ -1,20 +1,45 @@
|
|
|
1
|
+
import { t as iconNode } from "../../icon-BALgGtNK.mjs";
|
|
2
|
+
import { t as useElementId } from "../../id-C37UYLwJ.mjs";
|
|
1
3
|
import { injectComponentStyle } from "@bysages/core";
|
|
2
4
|
import { jsx } from "react/jsx-runtime";
|
|
3
5
|
import { ToggleGroup as ToggleGroup$1 } from "@ark-ui/react/toggle-group";
|
|
4
6
|
//#region src/components/toggle-group/index.tsx
|
|
5
|
-
function ToggleGroupRoot(
|
|
7
|
+
function ToggleGroupRoot(props) {
|
|
8
|
+
const id = useElementId("toggle-group", props);
|
|
9
|
+
const { size = "md", ...rest } = props;
|
|
6
10
|
return /* @__PURE__ */ jsx(ToggleGroup$1.Root, {
|
|
7
11
|
...rest,
|
|
12
|
+
id,
|
|
8
13
|
"data-size": size
|
|
9
14
|
});
|
|
10
15
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
16
|
+
function toArkValue(value) {
|
|
17
|
+
return value === void 0 ? [] : Array.isArray(value) ? value : [value];
|
|
18
|
+
}
|
|
19
|
+
function ToggleGroupFacade({ value, defaultValue, items, label, multiple = false, disabled = false, size = "md", className, onValueChange }) {
|
|
20
|
+
return /* @__PURE__ */ jsx(ToggleGroupRoot, {
|
|
21
|
+
className,
|
|
22
|
+
size,
|
|
23
|
+
"aria-label": label,
|
|
24
|
+
disabled,
|
|
25
|
+
multiple,
|
|
26
|
+
defaultValue: toArkValue(defaultValue),
|
|
27
|
+
...value === void 0 ? {} : { value: toArkValue(value) },
|
|
28
|
+
onValueChange: (details) => onValueChange?.(multiple ? details.value : details.value.at(0) ?? ""),
|
|
29
|
+
children: items.map((item) => /* @__PURE__ */ jsx(ToggleGroup$1.Item, {
|
|
30
|
+
value: item.value,
|
|
31
|
+
disabled: item.disabled,
|
|
32
|
+
"aria-label": item.label,
|
|
33
|
+
"data-variant": item.icon ? "icon" : "text",
|
|
34
|
+
children: item.icon ? iconNode(item.icon) : item.label
|
|
35
|
+
}, item.value))
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
ToggleGroupFacade.displayName = "SToggleGroup";
|
|
39
|
+
const ToggleGroup = Object.assign(ToggleGroupFacade, {
|
|
15
40
|
...ToggleGroup$1,
|
|
16
41
|
Root: ToggleGroupRoot
|
|
17
|
-
};
|
|
42
|
+
});
|
|
18
43
|
injectComponentStyle("toggle-group");
|
|
19
44
|
//#endregion
|
|
20
45
|
export { ToggleGroup };
|
|
@@ -13,5 +13,8 @@ export interface ToolbarProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
13
13
|
/** A workbench rail: the start tools at the leading edge, the end tools
|
|
14
14
|
* at the trailing, the rail itself carrying the toolbar role so
|
|
15
15
|
* assistive tech reads it as one group of commands. */
|
|
16
|
-
|
|
16
|
+
declare function ToolbarImpl({ label, start, end, children, ...rest }: ToolbarProps): import("react").JSX.Element;
|
|
17
|
+
export declare const Toolbar: typeof ToolbarImpl & {
|
|
18
|
+
Root: typeof ToolbarImpl;
|
|
19
|
+
};
|
|
17
20
|
//#endregion
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { t as withSelfRoot } from "../../family-DE_GQeeM.mjs";
|
|
1
2
|
import { injectComponentStyle } from "@bysages/core";
|
|
2
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
4
|
//#region src/components/toolbar/index.tsx
|
|
4
5
|
/** A workbench rail: the start tools at the leading edge, the end tools
|
|
5
6
|
* at the trailing, the rail itself carrying the toolbar role so
|
|
6
7
|
* assistive tech reads it as one group of commands. */
|
|
7
|
-
function
|
|
8
|
+
function ToolbarImpl({ label, start, end, children, ...rest }) {
|
|
8
9
|
injectComponentStyle("toolbar");
|
|
9
10
|
return /* @__PURE__ */ jsxs("div", {
|
|
10
11
|
...rest,
|
|
@@ -25,5 +26,6 @@ function Toolbar({ label, start, end, children, ...rest }) {
|
|
|
25
26
|
}) : null]
|
|
26
27
|
});
|
|
27
28
|
}
|
|
29
|
+
const Toolbar = withSelfRoot(ToolbarImpl);
|
|
28
30
|
//#endregion
|
|
29
31
|
export { Toolbar };
|
|
@@ -1,7 +1,20 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
1
2
|
import { Tooltip as Tooltip$1 } from "@ark-ui/react/tooltip";
|
|
2
3
|
//#region src/components/tooltip/index.d.ts
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
type TooltipPlacement = "top" | "top-start" | "top-end" | "bottom" | "bottom-start" | "bottom-end" | "left" | "left-start" | "left-end" | "right" | "right-start" | "right-end";
|
|
5
|
+
export interface TooltipFacadeProps {
|
|
6
|
+
open?: boolean;
|
|
7
|
+
defaultOpen?: boolean;
|
|
8
|
+
trigger: ReactNode;
|
|
9
|
+
content: string;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
placement?: TooltipPlacement;
|
|
12
|
+
onOpenChange?: (open: boolean) => void;
|
|
13
|
+
}
|
|
14
|
+
declare function TooltipFacade({ open, defaultOpen, trigger, content, disabled, placement, onOpenChange }: TooltipFacadeProps): import("react").JSX.Element;
|
|
15
|
+
declare namespace TooltipFacade {
|
|
16
|
+
var displayName: string;
|
|
17
|
+
}
|
|
18
|
+
type TooltipParts = typeof Tooltip$1;
|
|
19
|
+
export declare const Tooltip: typeof TooltipFacade & TooltipParts;
|
|
7
20
|
//#endregion
|
|
@@ -1,10 +1,37 @@
|
|
|
1
|
+
import { t as useElementId } from "../../id-C37UYLwJ.mjs";
|
|
1
2
|
import { injectComponentStyle } from "@bysages/core";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { isValidElement } from "react";
|
|
2
5
|
import { Tooltip as Tooltip$1 } from "@ark-ui/react/tooltip";
|
|
3
6
|
//#region src/components/tooltip/index.tsx
|
|
4
7
|
/** Ark's Tooltip, dressed in the paper-and-ink system: the smallest
|
|
5
8
|
* vessel — a tight chip of ink that dissolves in over its anchor. The
|
|
6
9
|
* API is Ark's own — Root, Trigger, Positioner, Content, Arrow, ArrowTip. */
|
|
7
|
-
|
|
10
|
+
function TooltipRoot(props) {
|
|
11
|
+
const id = useElementId("tooltip", props);
|
|
12
|
+
return /* @__PURE__ */ jsx(Tooltip$1.Root, {
|
|
13
|
+
...props,
|
|
14
|
+
id
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
function TooltipFacade({ open, defaultOpen, trigger, content, disabled = false, placement, onOpenChange }) {
|
|
18
|
+
return /* @__PURE__ */ jsxs(TooltipRoot, {
|
|
19
|
+
...placement === void 0 ? {} : { positioning: { placement } },
|
|
20
|
+
...open === void 0 ? {} : { open },
|
|
21
|
+
...defaultOpen === void 0 ? {} : { defaultOpen },
|
|
22
|
+
onOpenChange: (details) => onOpenChange?.(details.open),
|
|
23
|
+
children: [/* @__PURE__ */ jsx(Tooltip$1.Trigger, {
|
|
24
|
+
asChild: isValidElement(trigger),
|
|
25
|
+
disabled,
|
|
26
|
+
children: trigger
|
|
27
|
+
}), /* @__PURE__ */ jsx(Tooltip$1.Positioner, { children: /* @__PURE__ */ jsxs(Tooltip$1.Content, { children: [/* @__PURE__ */ jsx(Tooltip$1.Arrow, { children: /* @__PURE__ */ jsx(Tooltip$1.ArrowTip, {}) }), content] }) })]
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
TooltipFacade.displayName = "STooltip";
|
|
31
|
+
const Tooltip = Object.assign(TooltipFacade, {
|
|
32
|
+
...Tooltip$1,
|
|
33
|
+
Root: TooltipRoot
|
|
34
|
+
});
|
|
8
35
|
injectComponentStyle("tooltip");
|
|
9
36
|
//#endregion
|
|
10
37
|
export { Tooltip };
|
|
@@ -1,11 +1,20 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import { Tour as Tour$1, TourInteractOutsideEvent, TourPointerDownOutsideEvent, TourStepDetails, UseTourProps, UseTourReturn } from "@ark-ui/react/tour";
|
|
2
3
|
//#region src/components/tour/index.d.ts
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
export interface TourFacadeProps {
|
|
5
|
+
tour: UseTourReturn;
|
|
6
|
+
trigger?: string;
|
|
7
|
+
/** Replaces the standard card body when supplied. */
|
|
8
|
+
content?: ReactNode;
|
|
9
|
+
children?: ReactNode;
|
|
10
|
+
}
|
|
11
|
+
declare function TourFacade({ tour, trigger, content, children }: TourFacadeProps): import("react").JSX.Element;
|
|
12
|
+
declare namespace TourFacade {
|
|
13
|
+
var displayName: string;
|
|
14
|
+
}
|
|
15
|
+
type TourParts = typeof Tour$1;
|
|
16
|
+
export declare const Tour: typeof TourFacade & TourParts;
|
|
17
|
+
/** Tour machines are created by useTour, so the stable id belongs there. */
|
|
18
|
+
export declare function useTour(props?: UseTourProps): UseTourReturn;
|
|
10
19
|
//#endregion
|
|
11
|
-
export {
|
|
20
|
+
export type { TourInteractOutsideEvent, TourPointerDownOutsideEvent, TourStepDetails };
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import { t as useElementId } from "../../id-C37UYLwJ.mjs";
|
|
2
|
+
import { Button } from "../button/index.mjs";
|
|
1
3
|
import { injectComponentStyle } from "@bysages/core";
|
|
2
|
-
import {
|
|
4
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { Tour as Tour$1, useTour as useTour$1 } from "@ark-ui/react/tour";
|
|
3
6
|
//#region src/components/tour/index.tsx
|
|
4
7
|
/** Ark's Tour, dressed in the paper-and-ink system: a dimmed page where
|
|
5
8
|
* the spotlight alone keeps the focus halo, and the anchored card rides
|
|
@@ -7,7 +10,46 @@ import { Tour as Tour$1, useTour } from "@ark-ui/react/tour";
|
|
|
7
10
|
* Spotlight, Positioner, Content, Arrow, ArrowTip, Title, Description,
|
|
8
11
|
* ProgressText, Control, Actions, ActionTrigger, CloseTrigger, plus
|
|
9
12
|
* useTour. */
|
|
10
|
-
|
|
13
|
+
function TourRoot(props) {
|
|
14
|
+
return /* @__PURE__ */ jsx(Tour$1.Root, { ...props });
|
|
15
|
+
}
|
|
16
|
+
function TourFacade({ tour, trigger = "Start tour", content, children }) {
|
|
17
|
+
return /* @__PURE__ */ jsxs(TourRoot, {
|
|
18
|
+
tour,
|
|
19
|
+
children: [
|
|
20
|
+
/* @__PURE__ */ jsx(Button, {
|
|
21
|
+
size: "sm",
|
|
22
|
+
onClick: () => tour.start(),
|
|
23
|
+
children: trigger
|
|
24
|
+
}),
|
|
25
|
+
children,
|
|
26
|
+
/* @__PURE__ */ jsx(Tour$1.Backdrop, {}),
|
|
27
|
+
/* @__PURE__ */ jsx(Tour$1.Spotlight, {}),
|
|
28
|
+
/* @__PURE__ */ jsx(Tour$1.Positioner, { children: /* @__PURE__ */ jsx(Tour$1.Content, { children: content ?? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
29
|
+
/* @__PURE__ */ jsx(Tour$1.ProgressText, {}),
|
|
30
|
+
/* @__PURE__ */ jsx(Tour$1.Title, {}),
|
|
31
|
+
/* @__PURE__ */ jsx(Tour$1.Description, {}),
|
|
32
|
+
/* @__PURE__ */ jsx(Tour$1.Control, { children: /* @__PURE__ */ jsx(Tour$1.Actions, { children: (actions) => actions.map((action) => /* @__PURE__ */ jsx(Tour$1.ActionTrigger, {
|
|
33
|
+
action,
|
|
34
|
+
children: action.label
|
|
35
|
+
}, action.label)) }) })
|
|
36
|
+
] }) }) })
|
|
37
|
+
]
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
TourFacade.displayName = "STour";
|
|
41
|
+
const Tour = Object.assign(TourFacade, {
|
|
42
|
+
...Tour$1,
|
|
43
|
+
Root: TourRoot
|
|
44
|
+
});
|
|
45
|
+
/** Tour machines are created by useTour, so the stable id belongs there. */
|
|
46
|
+
function useTour(props = {}) {
|
|
47
|
+
const id = useElementId("tour", props);
|
|
48
|
+
return useTour$1({
|
|
49
|
+
id,
|
|
50
|
+
...props
|
|
51
|
+
});
|
|
52
|
+
}
|
|
11
53
|
injectComponentStyle("tour");
|
|
12
54
|
//#endregion
|
|
13
55
|
export { Tour, useTour };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Checkbox } from "../checkbox/index.mjs";
|
|
1
2
|
import { HTMLAttributes } from "react";
|
|
2
3
|
//#region src/components/transfer/index.d.ts
|
|
3
4
|
export interface TransferItem {
|
|
@@ -19,5 +20,6 @@ export interface TransferProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
19
20
|
* `value` is the target column's value list; everything else in `data`
|
|
20
21
|
* stays on the left. `searchable` adds a filter line to each panel.
|
|
21
22
|
*/
|
|
22
|
-
|
|
23
|
+
declare function TransferImpl({ value, data, titles, searchable, disabled, onValueChange, ...rest }: TransferProps): import("react").JSX.Element;
|
|
24
|
+
export declare const Transfer: typeof TransferImpl & typeof Checkbox;
|
|
23
25
|
//#endregion
|
|
@@ -1,31 +1,17 @@
|
|
|
1
|
+
import { t as iconNode } from "../../icon-BALgGtNK.mjs";
|
|
2
|
+
import { t as useElementId } from "../../id-C37UYLwJ.mjs";
|
|
3
|
+
import { n as useComponentMessages, t as formatMessage } from "../../messages-1jJWtaYU.mjs";
|
|
1
4
|
import { Button } from "../button/index.mjs";
|
|
2
|
-
import { t as Input } from "../../input-
|
|
5
|
+
import { t as Input } from "../../input-C21Zzuy6.mjs";
|
|
6
|
+
import { Checkbox as Checkbox$1 } from "../checkbox/index.mjs";
|
|
3
7
|
import { injectComponentStyle } from "@bysages/core";
|
|
4
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
9
|
import { useState } from "react";
|
|
6
10
|
import { Checkbox } from "@ark-ui/react/checkbox";
|
|
7
11
|
//#region src/components/transfer/index.tsx
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
stroke: "currentColor",
|
|
12
|
-
strokeWidth: 3,
|
|
13
|
-
strokeLinecap: "round",
|
|
14
|
-
strokeLinejoin: "round",
|
|
15
|
-
"aria-hidden": "true",
|
|
16
|
-
children: /* @__PURE__ */ jsx("path", { d: "m5 12.5 5 5L19 7" })
|
|
17
|
-
});
|
|
18
|
-
function arrowGlyph(direction) {
|
|
19
|
-
return /* @__PURE__ */ jsx("svg", {
|
|
20
|
-
viewBox: "0 0 24 24",
|
|
21
|
-
fill: "none",
|
|
22
|
-
stroke: "currentColor",
|
|
23
|
-
strokeWidth: 1.75,
|
|
24
|
-
strokeLinecap: "round",
|
|
25
|
-
strokeLinejoin: "round",
|
|
26
|
-
"aria-hidden": "true",
|
|
27
|
-
children: /* @__PURE__ */ jsx("path", { d: direction === "right" ? "M5 12h14m-6-6 6 6-6 6" : "M19 12H5m6-6-6 6 6 6" })
|
|
28
|
-
});
|
|
12
|
+
const checkIcon = iconNode("check");
|
|
13
|
+
function arrowIcon(direction) {
|
|
14
|
+
return iconNode(direction === "right" ? "arrow-right" : "arrow-left");
|
|
29
15
|
}
|
|
30
16
|
/**
|
|
31
17
|
* Two ledgers and a crossing: items sit in the source column until the
|
|
@@ -33,9 +19,11 @@ function arrowGlyph(direction) {
|
|
|
33
19
|
* `value` is the target column's value list; everything else in `data`
|
|
34
20
|
* stays on the left. `searchable` adds a filter line to each panel.
|
|
35
21
|
*/
|
|
36
|
-
function
|
|
22
|
+
function TransferImpl({ value = [], data, titles = ["Source", "Target"], searchable = false, disabled = false, onValueChange, ...rest }) {
|
|
37
23
|
injectComponentStyle("transfer");
|
|
38
24
|
injectComponentStyle("checkbox");
|
|
25
|
+
const id = useElementId("transfer", rest);
|
|
26
|
+
const messages = useComponentMessages();
|
|
39
27
|
const [checkedSource, setCheckedSource] = useState(() => /* @__PURE__ */ new Set());
|
|
40
28
|
const [checkedTarget, setCheckedTarget] = useState(() => /* @__PURE__ */ new Set());
|
|
41
29
|
const [sourceQuery, setSourceQuery] = useState("");
|
|
@@ -86,8 +74,8 @@ function Transfer({ value = [], data, titles = ["Source", "Target"], searchable
|
|
|
86
74
|
size: "sm",
|
|
87
75
|
value: query,
|
|
88
76
|
onValueChange: onQuery,
|
|
89
|
-
placeholder:
|
|
90
|
-
"aria-label":
|
|
77
|
+
placeholder: messages.transfer.filter,
|
|
78
|
+
"aria-label": formatMessage(messages.transfer.filter, { name: title })
|
|
91
79
|
})
|
|
92
80
|
}) : null,
|
|
93
81
|
/* @__PURE__ */ jsx("div", {
|
|
@@ -100,11 +88,12 @@ function Transfer({ value = [], data, titles = ["Source", "Target"], searchable
|
|
|
100
88
|
}) : items.map((item) => {
|
|
101
89
|
const locked = disabled || item.disabled === true;
|
|
102
90
|
return /* @__PURE__ */ jsxs(Checkbox.Root, {
|
|
91
|
+
id: `${id}-${side}-${item.value}`,
|
|
103
92
|
checked: checked.has(item.value),
|
|
104
93
|
disabled: locked,
|
|
105
94
|
onCheckedChange: () => toggle(side, item.value),
|
|
106
95
|
children: [
|
|
107
|
-
/* @__PURE__ */ jsx(Checkbox.Control, { children: /* @__PURE__ */ jsx(Checkbox.Indicator, { children:
|
|
96
|
+
/* @__PURE__ */ jsx(Checkbox.Control, { children: /* @__PURE__ */ jsx(Checkbox.Indicator, { children: checkIcon }) }),
|
|
108
97
|
/* @__PURE__ */ jsx(Checkbox.Label, {
|
|
109
98
|
"data-part": "label",
|
|
110
99
|
children: item.label
|
|
@@ -133,22 +122,23 @@ function Transfer({ value = [], data, titles = ["Source", "Target"], searchable
|
|
|
133
122
|
size: "sm",
|
|
134
123
|
square: true,
|
|
135
124
|
disabled: checkedSource.size === 0 || disabled,
|
|
136
|
-
"aria-label":
|
|
125
|
+
"aria-label": messages.transfer.moveRight,
|
|
137
126
|
onClick: () => move(true),
|
|
138
|
-
children:
|
|
127
|
+
children: arrowIcon("right")
|
|
139
128
|
}), /* @__PURE__ */ jsx(Button, {
|
|
140
129
|
variant: "outline",
|
|
141
130
|
size: "sm",
|
|
142
131
|
square: true,
|
|
143
132
|
disabled: checkedTarget.size === 0 || disabled,
|
|
144
|
-
"aria-label":
|
|
133
|
+
"aria-label": messages.transfer.moveLeft,
|
|
145
134
|
onClick: () => move(false),
|
|
146
|
-
children:
|
|
135
|
+
children: arrowIcon("left")
|
|
147
136
|
})]
|
|
148
137
|
}),
|
|
149
138
|
panel("target", titles[1], targetQuery, setTargetQuery, checkedTarget, targetItems)
|
|
150
139
|
]
|
|
151
140
|
});
|
|
152
141
|
}
|
|
142
|
+
const Transfer = Object.assign(TransferImpl, Checkbox$1);
|
|
153
143
|
//#endregion
|
|
154
144
|
export { Transfer };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { t as Popover } from "../../index-Eu-Bttta.mjs";
|
|
1
2
|
import { HTMLAttributes } from "react";
|
|
2
3
|
//#region src/components/tree-select/index.d.ts
|
|
3
4
|
export interface TreeSelectNode {
|
|
@@ -24,5 +25,6 @@ export interface TreeSelectProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
24
25
|
size?: "sm" | "md" | "lg";
|
|
25
26
|
onValueChange?: (value: string) => void;
|
|
26
27
|
}
|
|
27
|
-
|
|
28
|
+
declare function TreeSelectImpl({ value, data, placeholder, filterable, disabled, size, onValueChange, ...rest }: TreeSelectProps): import("react").JSX.Element;
|
|
29
|
+
export declare const TreeSelect: typeof TreeSelectImpl & typeof Popover;
|
|
28
30
|
//#endregion
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import { t as
|
|
1
|
+
import { t as iconNode } from "../../icon-BALgGtNK.mjs";
|
|
2
|
+
import { t as useElementId } from "../../id-C37UYLwJ.mjs";
|
|
3
|
+
import { n as useComponentMessages } from "../../messages-1jJWtaYU.mjs";
|
|
4
|
+
import { Popover as Popover$1 } from "../popover/index.mjs";
|
|
5
|
+
import { t as Input } from "../../input-C21Zzuy6.mjs";
|
|
2
6
|
import { injectComponentStyle } from "@bysages/core";
|
|
3
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
8
|
import { useMemo, useState } from "react";
|
|
@@ -7,16 +11,7 @@ import { Portal } from "@ark-ui/react/portal";
|
|
|
7
11
|
import { useFilter } from "@ark-ui/react/locale";
|
|
8
12
|
import { TreeView, createTreeCollection } from "@ark-ui/react/tree-view";
|
|
9
13
|
//#region src/components/tree-select/index.tsx
|
|
10
|
-
const chevron =
|
|
11
|
-
viewBox: "0 0 24 24",
|
|
12
|
-
fill: "none",
|
|
13
|
-
stroke: "currentColor",
|
|
14
|
-
strokeWidth: 2,
|
|
15
|
-
strokeLinecap: "round",
|
|
16
|
-
strokeLinejoin: "round",
|
|
17
|
-
"aria-hidden": "true",
|
|
18
|
-
children: /* @__PURE__ */ jsx("path", { d: "m9 18 6-6-6-6" })
|
|
19
|
-
});
|
|
14
|
+
const chevron = iconNode("chevron-right");
|
|
20
15
|
const chevronDown = /* @__PURE__ */ jsx("span", {
|
|
21
16
|
"data-part": "chevron",
|
|
22
17
|
"aria-hidden": "true",
|
|
@@ -29,21 +24,14 @@ function TreeSelectRow({ node, indexPath }) {
|
|
|
29
24
|
children: node.children ? /* @__PURE__ */ jsxs(TreeView.Branch, { children: [/* @__PURE__ */ jsxs(TreeView.BranchControl, { children: [/* @__PURE__ */ jsx(TreeView.BranchIndicator, { children: chevron }), /* @__PURE__ */ jsx(TreeView.BranchText, { children: node.label })] }), /* @__PURE__ */ jsxs(TreeView.BranchContent, { children: [/* @__PURE__ */ jsx(TreeView.BranchIndentGuide, {}), node.children.map((child, index) => /* @__PURE__ */ jsx(TreeSelectRow, {
|
|
30
25
|
node: child,
|
|
31
26
|
indexPath: [...indexPath, index]
|
|
32
|
-
}, child.value))] })] }) : /* @__PURE__ */ jsx(TreeView.Item, {
|
|
33
|
-
asChild: true,
|
|
34
|
-
children: /* @__PURE__ */ jsx("span", {
|
|
35
|
-
style: {
|
|
36
|
-
display: "flex",
|
|
37
|
-
inlineSize: "100%"
|
|
38
|
-
},
|
|
39
|
-
children: /* @__PURE__ */ jsx(TreeView.ItemText, { children: node.label })
|
|
40
|
-
})
|
|
41
|
-
})
|
|
27
|
+
}, child.value))] })] }) : /* @__PURE__ */ jsx(TreeView.Item, { children: /* @__PURE__ */ jsx(TreeView.ItemText, { children: node.label }) })
|
|
42
28
|
});
|
|
43
29
|
}
|
|
44
|
-
function
|
|
30
|
+
function TreeSelectImpl({ value, data, placeholder = "Select…", filterable = false, disabled = false, size = "md", onValueChange, ...rest }) {
|
|
45
31
|
injectComponentStyle("tree-select");
|
|
46
32
|
injectComponentStyle("tree-view");
|
|
33
|
+
const hostId = useElementId("tree-select", rest);
|
|
34
|
+
const messages = useComponentMessages();
|
|
47
35
|
const [open, setOpen] = useState(false);
|
|
48
36
|
const [query, setQuery] = useState("");
|
|
49
37
|
const filterFns = useFilter({ sensitivity: "base" });
|
|
@@ -95,6 +83,7 @@ function TreeSelect({ value, data, placeholder = "Select…", filterable = false
|
|
|
95
83
|
}
|
|
96
84
|
return /* @__PURE__ */ jsxs(Popover.Root, {
|
|
97
85
|
...rest,
|
|
86
|
+
id: `${hostId}:popover`,
|
|
98
87
|
open,
|
|
99
88
|
onOpenChange: (details) => {
|
|
100
89
|
setOpen(details.open);
|
|
@@ -128,8 +117,8 @@ function TreeSelect({ value, data, placeholder = "Select…", filterable = false
|
|
|
128
117
|
size: "sm",
|
|
129
118
|
value: query,
|
|
130
119
|
onValueChange: setQuery,
|
|
131
|
-
placeholder:
|
|
132
|
-
"aria-label":
|
|
120
|
+
placeholder: messages.select.filter,
|
|
121
|
+
"aria-label": messages.select.filter
|
|
133
122
|
})
|
|
134
123
|
}) : null, /* @__PURE__ */ jsx("div", {
|
|
135
124
|
"data-scope": "tree-select",
|
|
@@ -139,6 +128,7 @@ function TreeSelect({ value, data, placeholder = "Select…", filterable = false
|
|
|
139
128
|
"data-part": "empty",
|
|
140
129
|
children: "Nothing matches"
|
|
141
130
|
}) : /* @__PURE__ */ jsx(TreeView.Root, {
|
|
131
|
+
id: `${hostId}:tree`,
|
|
142
132
|
collection: visibleCollection,
|
|
143
133
|
selectionMode: "single",
|
|
144
134
|
selectedValue: value ? [value] : [],
|
|
@@ -153,5 +143,6 @@ function TreeSelect({ value, data, placeholder = "Select…", filterable = false
|
|
|
153
143
|
}) }) })]
|
|
154
144
|
});
|
|
155
145
|
}
|
|
146
|
+
const TreeSelect = Object.assign(TreeSelectImpl, Popover$1);
|
|
156
147
|
//#endregion
|
|
157
148
|
export { TreeSelect };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CSSProperties, ComponentProps } from "react";
|
|
1
2
|
import { CollectionItem } from "@ark-ui/react/collection";
|
|
2
3
|
import { TreeView as TreeView$1, TreeViewRootComponentProps } from "@ark-ui/react/tree-view";
|
|
3
4
|
//#region src/components/tree-view/index.d.ts
|
|
@@ -13,7 +14,35 @@ type TreeViewOwnProps = {
|
|
|
13
14
|
size?: "sm" | "md" | "lg";
|
|
14
15
|
};
|
|
15
16
|
declare function TreeViewRoot<T extends CollectionItem>(props: TreeViewRootComponentProps<T, TreeViewOwnProps>): import("react").JSX.Element;
|
|
16
|
-
|
|
17
|
+
/** The node checkbox rides inside the branch control; the branch
|
|
18
|
+
* itself answers the keyboard, so the checkbox stays visual only. */
|
|
19
|
+
declare function TreeViewNodeCheckbox(props: ComponentProps<typeof TreeView$1.NodeCheckbox>): import("react").JSX.Element;
|
|
20
|
+
/** A branch is born with its chevron — the indicator stays a consumer's
|
|
21
|
+
* children to override, never a chore to remember. */
|
|
22
|
+
declare function TreeViewBranchIndicator(props: ComponentProps<typeof TreeView$1.BranchIndicator>): import("react").JSX.Element;
|
|
23
|
+
type TreeOption = {
|
|
24
|
+
label: string;
|
|
25
|
+
value: string;
|
|
26
|
+
disabled?: boolean;
|
|
27
|
+
children?: TreeOption[];
|
|
28
|
+
};
|
|
29
|
+
type TreeViewFacadeProps = {
|
|
30
|
+
value?: string[];
|
|
31
|
+
defaultValue?: string[];
|
|
32
|
+
options: TreeOption[];
|
|
33
|
+
multiple?: boolean;
|
|
34
|
+
label?: string;
|
|
35
|
+
size?: "sm" | "md" | "lg";
|
|
36
|
+
className?: string;
|
|
37
|
+
style?: CSSProperties;
|
|
38
|
+
onValueChange?: (value: string[]) => void;
|
|
39
|
+
};
|
|
40
|
+
/** The complete tree behind selected values: nested options render their own
|
|
41
|
+
* branches and leaves, while async and checkbox trees remain anatomy work. */
|
|
42
|
+
declare function TreeViewFacade(props: TreeViewFacadeProps): import("react").JSX.Element;
|
|
43
|
+
export declare const TreeView: typeof TreeViewFacade & Omit<typeof TreeView$1, "Root" | "NodeCheckbox" | "BranchIndicator"> & {
|
|
17
44
|
Root: typeof TreeViewRoot;
|
|
45
|
+
NodeCheckbox: typeof TreeViewNodeCheckbox;
|
|
46
|
+
BranchIndicator: typeof TreeViewBranchIndicator;
|
|
18
47
|
};
|
|
19
48
|
//#endregion
|
|
@@ -1,18 +1,81 @@
|
|
|
1
|
+
import { t as iconNode } from "../../icon-BALgGtNK.mjs";
|
|
2
|
+
import { t as useElementId } from "../../id-C37UYLwJ.mjs";
|
|
1
3
|
import { injectComponentStyle } from "@bysages/core";
|
|
2
|
-
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
import { TreeView as TreeView$1 } from "@ark-ui/react/tree-view";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { TreeView as TreeView$1, createTreeCollection } from "@ark-ui/react/tree-view";
|
|
4
6
|
//#region src/components/tree-view/index.tsx
|
|
5
7
|
function TreeViewRoot(props) {
|
|
8
|
+
injectComponentStyle("tree-view");
|
|
9
|
+
const id = useElementId("tree-view", props);
|
|
6
10
|
const { size = "md", ...rest } = props;
|
|
7
11
|
return /* @__PURE__ */ jsx(TreeView$1.Root, {
|
|
8
12
|
...rest,
|
|
13
|
+
id,
|
|
9
14
|
"data-size": size
|
|
10
15
|
});
|
|
11
16
|
}
|
|
12
|
-
|
|
17
|
+
/** The node checkbox rides inside the branch control; the branch
|
|
18
|
+
* itself answers the keyboard, so the checkbox stays visual only. */
|
|
19
|
+
function TreeViewNodeCheckbox(props) {
|
|
20
|
+
return /* @__PURE__ */ jsx(TreeView$1.NodeCheckbox, {
|
|
21
|
+
...props,
|
|
22
|
+
"aria-hidden": "true"
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
/** A branch is born with its chevron — the indicator stays a consumer's
|
|
26
|
+
* children to override, never a chore to remember. */
|
|
27
|
+
function TreeViewBranchIndicator(props) {
|
|
28
|
+
const { children = iconNode("chevron-right"), ...rest } = props;
|
|
29
|
+
return /* @__PURE__ */ jsx(TreeView$1.BranchIndicator, {
|
|
30
|
+
...rest,
|
|
31
|
+
children
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
function treeNodes(items, path = []) {
|
|
35
|
+
return items.map((node, index) => {
|
|
36
|
+
const indexPath = [...path, index];
|
|
37
|
+
const row = node.children?.length ? /* @__PURE__ */ jsxs(TreeView$1.Branch, { children: [/* @__PURE__ */ jsxs(TreeView$1.BranchControl, { children: [/* @__PURE__ */ jsx(TreeView$1.BranchIndicator, { children: iconNode("chevron-right") }), /* @__PURE__ */ jsx(TreeView$1.BranchText, { children: node.label })] }), /* @__PURE__ */ jsx(TreeView$1.BranchContent, { children: treeNodes(node.children, indexPath) })] }) : /* @__PURE__ */ jsx(TreeView$1.Item, { children: /* @__PURE__ */ jsx(TreeView$1.ItemText, { children: node.label }) });
|
|
38
|
+
return /* @__PURE__ */ jsx(TreeView$1.NodeProvider, {
|
|
39
|
+
node,
|
|
40
|
+
indexPath,
|
|
41
|
+
children: row
|
|
42
|
+
}, node.value);
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
/** The complete tree behind selected values: nested options render their own
|
|
46
|
+
* branches and leaves, while async and checkbox trees remain anatomy work. */
|
|
47
|
+
function TreeViewFacade(props) {
|
|
48
|
+
const { value, defaultValue, options, multiple, label, size = "md", className, style, onValueChange } = props;
|
|
49
|
+
const branchValues = options.filter((option) => option.children?.length).map((option) => option.value);
|
|
50
|
+
const collection = createTreeCollection({
|
|
51
|
+
nodeToValue: (node) => node.value,
|
|
52
|
+
nodeToString: (node) => node.label,
|
|
53
|
+
isNodeDisabled: (node) => !!node.disabled,
|
|
54
|
+
rootNode: {
|
|
55
|
+
value: "root",
|
|
56
|
+
label: "",
|
|
57
|
+
children: options
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
return /* @__PURE__ */ jsx(TreeViewRoot, {
|
|
61
|
+
size,
|
|
62
|
+
collection,
|
|
63
|
+
defaultExpandedValue: branchValues,
|
|
64
|
+
defaultSelectedValue: defaultValue,
|
|
65
|
+
selectedValue: value,
|
|
66
|
+
selectionMode: multiple ? "multiple" : "single",
|
|
67
|
+
"aria-label": label,
|
|
68
|
+
className,
|
|
69
|
+
style,
|
|
70
|
+
onSelectionChange: (event) => onValueChange?.(event.selectedValue),
|
|
71
|
+
children: /* @__PURE__ */ jsx(TreeView$1.Tree, { children: treeNodes(options) })
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
const TreeView = Object.assign(TreeViewFacade, {
|
|
13
75
|
...TreeView$1,
|
|
14
|
-
Root: TreeViewRoot
|
|
15
|
-
|
|
16
|
-
|
|
76
|
+
Root: TreeViewRoot,
|
|
77
|
+
NodeCheckbox: TreeViewNodeCheckbox,
|
|
78
|
+
BranchIndicator: TreeViewBranchIndicator
|
|
79
|
+
});
|
|
17
80
|
//#endregion
|
|
18
81
|
export { TreeView };
|
|
@@ -4,6 +4,10 @@ export declare const Typography: {
|
|
|
4
4
|
({ children, ...rest }: HTMLAttributes<HTMLElement>): import("react").JSX.Element;
|
|
5
5
|
displayName: string;
|
|
6
6
|
} & {
|
|
7
|
+
Root: {
|
|
8
|
+
({ children, ...rest }: HTMLAttributes<HTMLElement>): import("react").JSX.Element;
|
|
9
|
+
displayName: string;
|
|
10
|
+
};
|
|
7
11
|
Display: {
|
|
8
12
|
({ children, ...rest }: HTMLAttributes<HTMLElement>): import("react").JSX.Element;
|
|
9
13
|
displayName: string;
|
|
@@ -16,5 +16,8 @@ export interface UserProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
16
16
|
* quiet echo beneath. The mark is the Avatar itself — one component
|
|
17
17
|
* renders it here, so every size and shape the Avatar knows the user
|
|
18
18
|
* inherits; this row only lays the words out beside it. */
|
|
19
|
-
|
|
19
|
+
declare function UserImpl({ name, description, size, src, shape, children, ...rest }: UserProps): import("react").JSX.Element;
|
|
20
|
+
export declare const User: typeof UserImpl & {
|
|
21
|
+
Root: typeof UserImpl;
|
|
22
|
+
};
|
|
20
23
|
//#endregion
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { t as withSelfRoot } from "../../family-DE_GQeeM.mjs";
|
|
1
2
|
import { Avatar } from "../avatar/index.mjs";
|
|
2
3
|
import { injectComponentStyle } from "@bysages/core";
|
|
3
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -9,7 +10,7 @@ function initialsOf(name) {
|
|
|
9
10
|
* quiet echo beneath. The mark is the Avatar itself — one component
|
|
10
11
|
* renders it here, so every size and shape the Avatar knows the user
|
|
11
12
|
* inherits; this row only lays the words out beside it. */
|
|
12
|
-
function
|
|
13
|
+
function UserImpl({ name, description, size, src, shape = "circle", children, ...rest }) {
|
|
13
14
|
injectComponentStyle("user");
|
|
14
15
|
return /* @__PURE__ */ jsxs("div", {
|
|
15
16
|
...rest,
|
|
@@ -38,5 +39,6 @@ function User({ name, description, size, src, shape = "circle", children, ...res
|
|
|
38
39
|
})]
|
|
39
40
|
});
|
|
40
41
|
}
|
|
42
|
+
const User = withSelfRoot(UserImpl);
|
|
41
43
|
//#endregion
|
|
42
44
|
export { User };
|
|
@@ -13,5 +13,8 @@ export interface VirtualListProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
13
13
|
* scroll length by a spacer sized from the row height, the rows
|
|
14
14
|
* themselves are positioned against it — a ten-thousand-row list
|
|
15
15
|
* costs the DOM a window, not the ledger. */
|
|
16
|
-
|
|
16
|
+
declare function VirtualListImpl({ items, itemHeight, height, renderItem, ...rest }: VirtualListProps): import("react").JSX.Element;
|
|
17
|
+
export declare const VirtualList: typeof VirtualListImpl & {
|
|
18
|
+
Root: typeof VirtualListImpl;
|
|
19
|
+
};
|
|
17
20
|
//#endregion
|