@bysages/react 0.3.1 → 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-BfKTmtCt.mjs → ai-response-B4DX7nmJ.mjs} +3 -1
- 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 +1 -1
- package/dist/components/ai/index.mjs +5 -3
- 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 +16 -44
- 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 +10 -14
- 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 +4 -1
- 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 +6 -1
- 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 +2 -11
- package/dist/components/block-ui/index.d.mts +4 -1
- package/dist/components/block-ui/index.mjs +3 -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 +12 -35
- 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 +7 -1
- 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 +4 -1
- package/dist/components/config-provider/index.mjs +3 -1
- 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 +3 -1
- 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 +10 -18
- 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 +29 -9
- package/dist/components/file-upload/index.mjs +46 -10
- 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 +5 -2
- package/dist/components/image/index.mjs +14 -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 -24
- package/dist/components/image-viewer/index.mjs +3 -113
- 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 +17 -1
- package/dist/components/json-tree-view/index.mjs +26 -5
- 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 +157 -63
- package/dist/components/link/index.d.mts +4 -1
- package/dist/components/link/index.mjs +3 -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 +6 -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 +26 -24
- 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 +3 -1
- package/dist/components/split-button/index.d.mts +3 -1
- package/dist/components/split-button/index.mjs +12 -17
- 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 +26 -6
- package/dist/components/steps/index.mjs +26 -11
- 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 +26 -56
- 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 +3 -1
- 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 +19 -5
- package/dist/components/toc/index.mjs +31 -5
- 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 +14 -26
- package/dist/components/tree-select/index.d.mts +3 -1
- package/dist/components/tree-select/index.mjs +11 -22
- package/dist/components/tree-view/index.d.mts +22 -2
- package/dist/components/tree-view/index.mjs +50 -8
- 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 +10 -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-Iy8m0Qev.d.mts → index-D_iKc2Uw.d.mts} +31 -2
- package/dist/{index-Dn5mHf1g.d.mts → index-DdNKngUQ.d.mts} +56 -17
- 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 +11 -10
- 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/select-ozUFq0zd.mjs +121 -0
- package/package.json +3 -3
- package/dist/chevron-BeHvt46K.mjs +0 -17
- package/dist/glyph-VI989p8H.mjs +0 -14
- package/dist/select-eAHutw56.mjs +0 -70
|
@@ -1,24 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* A lightbox: the picture over a dimmed page, with a small toolbar
|
|
4
|
-
* beneath it. Zoom is the reader's hand (half to three times, clamped),
|
|
5
|
-
* a quarter turn at a time rotates, Escape and the scrim close — the
|
|
6
|
-
* dialog machine carries the modal part. `open` may stay with the
|
|
7
|
-
* caller; left undefined the viewer keeps it to itself.
|
|
8
|
-
*/
|
|
9
|
-
export interface ImageViewerProps {
|
|
10
|
-
src: string;
|
|
11
|
-
alt?: string;
|
|
12
|
-
open?: boolean;
|
|
13
|
-
zoomable?: boolean;
|
|
14
|
-
/** Intrinsic rendered width, reserved on the image to avoid layout
|
|
15
|
-
* shift while the source loads. */
|
|
16
|
-
width?: number | string;
|
|
17
|
-
/** Intrinsic rendered height, reserved on the image to avoid layout
|
|
18
|
-
* shift while the source loads. */
|
|
19
|
-
height?: number | string;
|
|
20
|
-
/** Reports the viewer's next state. */
|
|
21
|
-
onOpenChange?: (open: boolean) => void;
|
|
22
|
-
}
|
|
23
|
-
export declare function ImageViewer({ src, alt, open, zoomable, width, height, onOpenChange }: ImageViewerProps): import("react").JSX.Element;
|
|
24
|
-
//#endregion
|
|
1
|
+
import { n as ImageViewerProps, t as ImageViewer } from "../../index-Dj8S4eyJ.mjs";
|
|
2
|
+
export { ImageViewer, ImageViewerProps };
|
|
@@ -1,114 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import { injectComponentStyle } from "@bysages/core";
|
|
5
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
-
import { useEffect, useState } from "react";
|
|
7
|
-
import { Portal } from "@ark-ui/react/portal";
|
|
8
|
-
import { Dialog } from "@ark-ui/react/dialog";
|
|
9
|
-
//#region src/components/image-viewer/index.tsx
|
|
10
|
-
const MIN_SCALE = .5;
|
|
11
|
-
const MAX_SCALE = 3;
|
|
12
|
-
const SCALE_STEP = .25;
|
|
13
|
-
/** The toolbar's line-drawn glyphs, fresh per render. */
|
|
14
|
-
const TOOL_GLYPHS = {
|
|
15
|
-
zoomIn: () => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
16
|
-
/* @__PURE__ */ jsx("circle", {
|
|
17
|
-
cx: 11,
|
|
18
|
-
cy: 11,
|
|
19
|
-
r: 7
|
|
20
|
-
}),
|
|
21
|
-
/* @__PURE__ */ jsx("path", { d: "m16.2 16.2 4.8 4.8" }),
|
|
22
|
-
/* @__PURE__ */ jsx("path", { d: "M8 11h6" }),
|
|
23
|
-
/* @__PURE__ */ jsx("path", { d: "M11 8v6" })
|
|
24
|
-
] }),
|
|
25
|
-
zoomOut: () => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
26
|
-
/* @__PURE__ */ jsx("circle", {
|
|
27
|
-
cx: 11,
|
|
28
|
-
cy: 11,
|
|
29
|
-
r: 7
|
|
30
|
-
}),
|
|
31
|
-
/* @__PURE__ */ jsx("path", { d: "m16.2 16.2 4.8 4.8" }),
|
|
32
|
-
/* @__PURE__ */ jsx("path", { d: "M8 11h6" })
|
|
33
|
-
] }),
|
|
34
|
-
rotate: () => /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("path", { d: "M20.49 12A8.5 8.5 0 1 1 18 6.06" }), /* @__PURE__ */ jsx("path", { d: "M20.5 3.5v4h-4" })] }),
|
|
35
|
-
close: () => /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("path", { d: "m6 6 12 12" }), /* @__PURE__ */ jsx("path", { d: "M18 6 6 18" })] })
|
|
36
|
-
};
|
|
37
|
-
function ImageViewer({ src, alt = "", open, zoomable = true, width, height, onOpenChange }) {
|
|
38
|
-
injectComponentStyle("image-viewer");
|
|
39
|
-
const messages = useComponentMessages();
|
|
40
|
-
const [localOpen, setLocalOpen] = useState(false);
|
|
41
|
-
const [scale, setScale] = useState(1);
|
|
42
|
-
const [rotation, setRotation] = useState(0);
|
|
43
|
-
const isOpen = open ?? localOpen;
|
|
44
|
-
const setOpen = (value) => {
|
|
45
|
-
if (open === void 0) setLocalOpen(value);
|
|
46
|
-
onOpenChange?.(value);
|
|
47
|
-
};
|
|
48
|
-
useEffect(() => {
|
|
49
|
-
if (isOpen) {
|
|
50
|
-
setScale(1);
|
|
51
|
-
setRotation(0);
|
|
52
|
-
}
|
|
53
|
-
}, [isOpen]);
|
|
54
|
-
function zoom(step) {
|
|
55
|
-
setScale((current) => Math.min(MAX_SCALE, Math.max(MIN_SCALE, current + step)));
|
|
56
|
-
}
|
|
57
|
-
function rotate() {
|
|
58
|
-
setRotation((current) => (current + 90) % 360);
|
|
59
|
-
}
|
|
60
|
-
function toolButton(label, glyph, onClick) {
|
|
61
|
-
return /* @__PURE__ */ jsx(Button, {
|
|
62
|
-
variant: "ghost",
|
|
63
|
-
square: true,
|
|
64
|
-
size: "lg",
|
|
65
|
-
"aria-label": label,
|
|
66
|
-
onClick,
|
|
67
|
-
children: /* @__PURE__ */ jsx("svg", {
|
|
68
|
-
viewBox: "0 0 24 24",
|
|
69
|
-
fill: "none",
|
|
70
|
-
stroke: "currentColor",
|
|
71
|
-
strokeWidth: 1.5,
|
|
72
|
-
strokeLinecap: "round",
|
|
73
|
-
strokeLinejoin: "round",
|
|
74
|
-
"aria-hidden": "true",
|
|
75
|
-
children: glyph()
|
|
76
|
-
})
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
return /* @__PURE__ */ jsx(Dialog.Root, {
|
|
80
|
-
open: isOpen,
|
|
81
|
-
onOpenChange: (details) => setOpen(details.open),
|
|
82
|
-
lazyMount: true,
|
|
83
|
-
unmountOnExit: true,
|
|
84
|
-
children: /* @__PURE__ */ jsxs(Portal, { children: [/* @__PURE__ */ jsx(Dialog.Backdrop, { className: "bs-image-viewer-backdrop" }), /* @__PURE__ */ jsx(Dialog.Positioner, {
|
|
85
|
-
className: "bs-image-viewer-positioner",
|
|
86
|
-
children: /* @__PURE__ */ jsxs(Dialog.Content, {
|
|
87
|
-
className: "bs-image-viewer-content",
|
|
88
|
-
"aria-label": alt || "Image preview",
|
|
89
|
-
onClick: (event) => {
|
|
90
|
-
if (event.target === event.currentTarget) setOpen(false);
|
|
91
|
-
},
|
|
92
|
-
children: [/* @__PURE__ */ jsx("img", {
|
|
93
|
-
"data-scope": "image-viewer",
|
|
94
|
-
"data-part": "viewport",
|
|
95
|
-
src,
|
|
96
|
-
alt,
|
|
97
|
-
width,
|
|
98
|
-
height,
|
|
99
|
-
style: { transform: `scale(${scale}) rotate(${rotation}deg)` }
|
|
100
|
-
}), /* @__PURE__ */ jsx("div", {
|
|
101
|
-
"data-scope": "image-viewer",
|
|
102
|
-
"data-part": "toolbar",
|
|
103
|
-
children: /* @__PURE__ */ jsxs(ButtonGroup, { children: [
|
|
104
|
-
zoomable ? [toolButton(messages.imageViewer.zoomIn, TOOL_GLYPHS.zoomIn, () => zoom(SCALE_STEP)), toolButton(messages.imageViewer.zoomOut, TOOL_GLYPHS.zoomOut, () => zoom(-.25))] : null,
|
|
105
|
-
toolButton(messages.imageViewer.rotate, TOOL_GLYPHS.rotate, rotate),
|
|
106
|
-
toolButton(messages.imageViewer.close, TOOL_GLYPHS.close, () => setOpen(false))
|
|
107
|
-
] })
|
|
108
|
-
})]
|
|
109
|
-
})
|
|
110
|
-
})] })
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
//#endregion
|
|
1
|
+
import "../button-group/index.mjs";
|
|
2
|
+
import "../dialog/index.mjs";
|
|
3
|
+
import { t as ImageViewer } from "../../image-viewer-Cf6thHax.mjs";
|
|
114
4
|
export { ImageViewer };
|
|
@@ -15,5 +15,7 @@ export interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>,
|
|
|
15
15
|
mask?: string;
|
|
16
16
|
onValueChange?: (value: string) => void;
|
|
17
17
|
}
|
|
18
|
-
export declare const Input: import("react").ForwardRefExoticComponent<InputProps & import("react").RefAttributes<HTMLInputElement
|
|
18
|
+
export declare const Input: import("react").ForwardRefExoticComponent<InputProps & import("react").RefAttributes<HTMLInputElement>> & {
|
|
19
|
+
Root: import("react").ForwardRefExoticComponent<InputProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
20
|
+
};
|
|
19
21
|
//#endregion
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as Input } from "../../input-
|
|
1
|
+
import { t as Input } from "../../input-C21Zzuy6.mjs";
|
|
2
2
|
export { Input };
|
|
@@ -1,7 +1,23 @@
|
|
|
1
|
+
import { ComponentProps } from "react";
|
|
1
2
|
import { JsonTreeView as JsonTreeView$1 } from "@ark-ui/react/json-tree-view";
|
|
2
3
|
//#region src/components/json-tree-view/index.d.ts
|
|
4
|
+
/** The auto-rendered tree hands every branch its chevron from the
|
|
5
|
+
* `arrow` element — filled with the house icon unless the consumer
|
|
6
|
+
* draws their own, so a JSON tree never opens as a bare indent. */
|
|
7
|
+
declare function JsonTreeViewTree(props: ComponentProps<typeof JsonTreeView$1.Tree>): import("react").JSX.Element;
|
|
3
8
|
/** JsonTreeView, dressed in the paper-and-ink system: the tree-view
|
|
4
9
|
* recipes re-scoped, with value nodes reading as tabular data. The parts —
|
|
5
10
|
* Root, Tree, plus createJsonTreeCollection. */
|
|
6
|
-
|
|
11
|
+
declare function JsonTreeViewRoot(props: ComponentProps<typeof JsonTreeView$1.Root>): import("react").JSX.Element;
|
|
12
|
+
/** The one-tag path for a read-only tree; custom node rendering stays on
|
|
13
|
+
* the anatomy. */
|
|
14
|
+
declare function JsonTreeViewFacade({ data, defaultExpandedDepth, ...rest }: {
|
|
15
|
+
data: unknown;
|
|
16
|
+
defaultExpandedDepth?: number;
|
|
17
|
+
} & ComponentProps<typeof JsonTreeViewRoot>): import("react").JSX.Element;
|
|
18
|
+
export declare const JsonTreeView: typeof JsonTreeViewFacade & {
|
|
19
|
+
Root: typeof JsonTreeViewRoot;
|
|
20
|
+
Tree: typeof JsonTreeViewTree;
|
|
21
|
+
RootProvider: import("react").ForwardRefExoticComponent<JsonTreeView$1.RootProviderProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
22
|
+
};
|
|
7
23
|
//#endregion
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { t as
|
|
1
|
+
import { t as iconNode } from "../../icon-BALgGtNK.mjs";
|
|
2
|
+
import { t as useElementId } from "../../id-C37UYLwJ.mjs";
|
|
2
3
|
import { injectComponentStyle } from "@bysages/core";
|
|
3
4
|
import { jsx } from "react/jsx-runtime";
|
|
4
5
|
import { JsonTreeView as JsonTreeView$1 } from "@ark-ui/react/json-tree-view";
|
|
5
|
-
import { chevron_right } from "@bysages/icons";
|
|
6
6
|
//#region src/components/json-tree-view/index.tsx
|
|
7
7
|
/** The auto-rendered tree hands every branch its chevron from the
|
|
8
|
-
* `arrow` element — filled with the house
|
|
8
|
+
* `arrow` element — filled with the house icon unless the consumer
|
|
9
9
|
* draws their own, so a JSON tree never opens as a bare indent. */
|
|
10
10
|
function JsonTreeViewTree(props) {
|
|
11
|
-
const { arrow =
|
|
11
|
+
const { arrow = iconNode("chevron-right"), ...rest } = props;
|
|
12
12
|
return /* @__PURE__ */ jsx(JsonTreeView$1.Tree, {
|
|
13
13
|
...rest,
|
|
14
14
|
arrow
|
|
@@ -17,7 +17,28 @@ function JsonTreeViewTree(props) {
|
|
|
17
17
|
/** JsonTreeView, dressed in the paper-and-ink system: the tree-view
|
|
18
18
|
* recipes re-scoped, with value nodes reading as tabular data. The parts —
|
|
19
19
|
* Root, Tree, plus createJsonTreeCollection. */
|
|
20
|
-
|
|
20
|
+
function JsonTreeViewRoot(props) {
|
|
21
|
+
const id = useElementId("json-tree-view", props);
|
|
22
|
+
return /* @__PURE__ */ jsx(JsonTreeView$1.Root, {
|
|
23
|
+
...props,
|
|
24
|
+
id
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
/** The one-tag path for a read-only tree; custom node rendering stays on
|
|
28
|
+
* the anatomy. */
|
|
29
|
+
function JsonTreeViewFacade({ data, defaultExpandedDepth = 1, ...rest }) {
|
|
30
|
+
return /* @__PURE__ */ jsx(JsonTreeViewRoot, {
|
|
31
|
+
...rest,
|
|
32
|
+
data,
|
|
33
|
+
defaultExpandedDepth,
|
|
34
|
+
children: /* @__PURE__ */ jsx(JsonTreeViewTree, {})
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
const JsonTreeView = Object.assign(JsonTreeViewFacade, {
|
|
38
|
+
...JsonTreeView$1,
|
|
39
|
+
Root: JsonTreeViewRoot,
|
|
40
|
+
Tree: JsonTreeViewTree
|
|
41
|
+
});
|
|
21
42
|
injectComponentStyle("json-tree-view");
|
|
22
43
|
//#endregion
|
|
23
44
|
export { JsonTreeView };
|
|
@@ -2,5 +2,8 @@ import { HTMLAttributes } from "react";
|
|
|
2
2
|
//#region src/components/kbd/index.d.ts
|
|
3
3
|
/** A keycap in miniature, riding the type it annotates. */
|
|
4
4
|
export type KbdProps = HTMLAttributes<HTMLElement>;
|
|
5
|
-
|
|
5
|
+
declare function KbdImpl({ children, ...rest }: KbdProps): import("react").JSX.Element;
|
|
6
|
+
export declare const Kbd: typeof KbdImpl & {
|
|
7
|
+
Root: typeof KbdImpl;
|
|
8
|
+
};
|
|
6
9
|
//#endregion
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { t as withSelfRoot } from "../../family-DE_GQeeM.mjs";
|
|
1
2
|
import { injectComponentStyle } from "@bysages/core";
|
|
2
3
|
import { jsx } from "react/jsx-runtime";
|
|
3
4
|
//#region src/components/kbd/index.tsx
|
|
4
|
-
function
|
|
5
|
+
function KbdImpl({ children, ...rest }) {
|
|
5
6
|
injectComponentStyle("kbd");
|
|
6
7
|
return /* @__PURE__ */ jsx("kbd", {
|
|
7
8
|
...rest,
|
|
@@ -10,5 +11,6 @@ function Kbd({ children, ...rest }) {
|
|
|
10
11
|
children
|
|
11
12
|
});
|
|
12
13
|
}
|
|
14
|
+
const Kbd = withSelfRoot(KbdImpl);
|
|
13
15
|
//#endregion
|
|
14
16
|
export { Kbd };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { HTMLAttributes, ReactNode } from "react";
|
|
1
|
+
import { Dispatch, HTMLAttributes, ReactNode, SetStateAction } from "react";
|
|
2
2
|
//#region src/components/layout/index.d.ts
|
|
3
3
|
/** Declare which edge the skeleton reserves for its sider — without
|
|
4
4
|
* it the root is a single column. */
|
|
@@ -6,10 +6,28 @@ export interface LayoutRootProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
6
6
|
sider?: "start" | "end";
|
|
7
7
|
children?: ReactNode;
|
|
8
8
|
}
|
|
9
|
-
/**
|
|
10
|
-
*
|
|
9
|
+
/** Runtime settings the sider shares with its root so the split can be
|
|
10
|
+
* driven by Ark while the public sizing props stay on `Layout.Sider`. */
|
|
11
|
+
export interface LayoutSiderState {
|
|
12
|
+
resizable: boolean;
|
|
13
|
+
collapsed: boolean;
|
|
14
|
+
width: string;
|
|
15
|
+
minWidth: string;
|
|
16
|
+
maxWidth: string;
|
|
17
|
+
}
|
|
18
|
+
export interface LayoutResizeHandlers {
|
|
19
|
+
start: () => void;
|
|
20
|
+
resize: (width: number) => void;
|
|
21
|
+
end: () => void;
|
|
22
|
+
}
|
|
11
23
|
export interface LayoutContextValue {
|
|
12
24
|
siderPlacement: () => "start" | "end" | undefined;
|
|
25
|
+
getSiderState: () => LayoutSiderState | null;
|
|
26
|
+
setSiderState: Dispatch<SetStateAction<LayoutSiderState | null>>;
|
|
27
|
+
setResizeHandlers: (handlers: LayoutResizeHandlers) => void;
|
|
28
|
+
resizeStart: () => void;
|
|
29
|
+
resize: (width: number) => void;
|
|
30
|
+
resizeEnd: () => void;
|
|
13
31
|
}
|
|
14
32
|
/**
|
|
15
33
|
* The application skeleton: Root, Header, Sider, Content, Footer —
|
|
@@ -17,7 +35,7 @@ export interface LayoutContextValue {
|
|
|
17
35
|
* root is a full-height grid; a declared `sider` turns the columns
|
|
18
36
|
* around to meet whichever edge the rail stands on.
|
|
19
37
|
*/
|
|
20
|
-
declare function Root({ sider, children, ...rest }: LayoutRootProps): import("react").JSX.Element;
|
|
38
|
+
declare function Root({ sider, children, style, ...rest }: LayoutRootProps): import("react").JSX.Element;
|
|
21
39
|
export interface LayoutSiderProps extends Omit<HTMLAttributes<HTMLElement>, "children"> {
|
|
22
40
|
/** The caller drives the fold; the sider mirrors it and echoes every
|
|
23
41
|
* change back through `onCollapsedChange`. */
|
|
@@ -27,9 +45,9 @@ export interface LayoutSiderProps extends Omit<HTMLAttributes<HTMLElement>, "chi
|
|
|
27
45
|
width?: string;
|
|
28
46
|
/** The inline size when folded. */
|
|
29
47
|
collapsedWidth?: string;
|
|
30
|
-
/** Offer the hairline at the flow edge: the rail's width
|
|
31
|
-
* hand
|
|
32
|
-
* every change rides `onWidthChange`. */
|
|
48
|
+
/** Offer the Ark-powered hairline at the flow edge: the rail's width
|
|
49
|
+
* follows the hand and keyboard, clamped by `minWidth`/`maxWidth`,
|
|
50
|
+
* and every change rides `onWidthChange`. */
|
|
33
51
|
resizable?: boolean;
|
|
34
52
|
/** The rail's narrowest inline size while resizing. */
|
|
35
53
|
minWidth?: string;
|
|
@@ -1,20 +1,105 @@
|
|
|
1
1
|
import { n as useComponentMessages } from "../../messages-1jJWtaYU.mjs";
|
|
2
2
|
import { injectComponentStyle } from "@bysages/core";
|
|
3
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
-
import { createContext, useContext, useEffect, useRef, useState } from "react";
|
|
4
|
+
import { createContext, useContext, useEffect, useMemo, useRef, useState } from "react";
|
|
5
|
+
import { Splitter } from "@ark-ui/react/splitter";
|
|
5
6
|
//#region src/components/layout/index.tsx
|
|
6
7
|
const LAYOUT_CONTEXT = createContext(null);
|
|
8
|
+
/** One step of Ark's keyboard resize, converted to a splitter percentage
|
|
9
|
+
* at render time so the public behavior remains a 16px move. */
|
|
10
|
+
const RESIZE_STEP = 16;
|
|
7
11
|
/**
|
|
8
12
|
* The application skeleton: Root, Header, Sider, Content, Footer —
|
|
9
13
|
* the admin arrangement dressed in the paper-and-ink surfaces. The
|
|
10
14
|
* root is a full-height grid; a declared `sider` turns the columns
|
|
11
15
|
* around to meet whichever edge the rail stands on.
|
|
12
16
|
*/
|
|
13
|
-
function Root({ sider, children, ...rest }) {
|
|
17
|
+
function Root({ sider, children, style, ...rest }) {
|
|
18
|
+
const [siderState, setSiderState] = useState(null);
|
|
19
|
+
const [rootWidth, setRootWidth] = useState(0);
|
|
20
|
+
const siderStateRef = useRef(siderState);
|
|
21
|
+
const resizeHandlers = useRef({
|
|
22
|
+
start: () => {},
|
|
23
|
+
resize: () => {},
|
|
24
|
+
end: () => {}
|
|
25
|
+
});
|
|
26
|
+
siderStateRef.current = siderState;
|
|
27
|
+
const splitterRoot = useRef(null);
|
|
28
|
+
const splitterActive = !!sider;
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
const element = splitterActive ? splitterRoot.current : null;
|
|
31
|
+
if (!element || typeof ResizeObserver === "undefined") {
|
|
32
|
+
if (!element) setRootWidth(0);
|
|
33
|
+
else setRootWidth(element.getBoundingClientRect().width);
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
const observer = new ResizeObserver(() => {
|
|
37
|
+
setRootWidth(element.getBoundingClientRect().width);
|
|
38
|
+
});
|
|
39
|
+
observer.observe(element);
|
|
40
|
+
setRootWidth(element.getBoundingClientRect().width);
|
|
41
|
+
return () => observer.disconnect();
|
|
42
|
+
}, [splitterActive]);
|
|
43
|
+
const context = useMemo(() => ({
|
|
44
|
+
siderPlacement: () => sider,
|
|
45
|
+
getSiderState: () => siderStateRef.current,
|
|
46
|
+
setSiderState,
|
|
47
|
+
setResizeHandlers: (handlers) => {
|
|
48
|
+
resizeHandlers.current = handlers;
|
|
49
|
+
},
|
|
50
|
+
resizeStart: () => resizeHandlers.current.start(),
|
|
51
|
+
resize: (width) => resizeHandlers.current.resize(width),
|
|
52
|
+
resizeEnd: () => resizeHandlers.current.end()
|
|
53
|
+
}), [sider]);
|
|
54
|
+
const keyboardResizeBy = rootWidth > 0 ? RESIZE_STEP / rootWidth * 100 : RESIZE_STEP;
|
|
55
|
+
const panels = useMemo(() => {
|
|
56
|
+
if (!siderState) return [];
|
|
57
|
+
const rail = {
|
|
58
|
+
id: "sider",
|
|
59
|
+
minSize: siderState.minWidth,
|
|
60
|
+
maxSize: siderState.maxWidth
|
|
61
|
+
};
|
|
62
|
+
const flow = {
|
|
63
|
+
id: "flow",
|
|
64
|
+
minSize: "0px"
|
|
65
|
+
};
|
|
66
|
+
return sider === "end" ? [flow, rail] : [rail, flow];
|
|
67
|
+
}, [sider, siderState]);
|
|
68
|
+
const size = useMemo(() => sider === "end" ? [void 0, siderState?.width] : [siderState?.width, void 0], [sider, siderState?.width]);
|
|
69
|
+
const siderIndex = sider === "end" ? 1 : 0;
|
|
70
|
+
const callerStyle = style ?? {};
|
|
71
|
+
const gridStyle = {
|
|
72
|
+
...callerStyle,
|
|
73
|
+
display: callerStyle.display ?? "grid",
|
|
74
|
+
width: callerStyle.width ?? "auto",
|
|
75
|
+
height: callerStyle.height ?? "auto",
|
|
76
|
+
overflow: callerStyle.overflow ?? "visible"
|
|
77
|
+
};
|
|
14
78
|
return /* @__PURE__ */ jsx(LAYOUT_CONTEXT.Provider, {
|
|
15
|
-
value:
|
|
16
|
-
children: /* @__PURE__ */ jsx(
|
|
79
|
+
value: context,
|
|
80
|
+
children: splitterActive ? /* @__PURE__ */ jsx(Splitter.Root, {
|
|
81
|
+
ref: splitterRoot,
|
|
82
|
+
asChild: true,
|
|
83
|
+
panels,
|
|
84
|
+
size,
|
|
85
|
+
keyboardResizeBy,
|
|
86
|
+
onResize: (details) => {
|
|
87
|
+
const width = rootWidth * (details.size[siderIndex] ?? 0) / 100;
|
|
88
|
+
if (width > 0) context.resize(width);
|
|
89
|
+
},
|
|
90
|
+
onResizeStart: context.resizeStart,
|
|
91
|
+
onResizeEnd: context.resizeEnd,
|
|
92
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
93
|
+
...rest,
|
|
94
|
+
style: gridStyle,
|
|
95
|
+
"data-scope": "layout",
|
|
96
|
+
"data-part": "root",
|
|
97
|
+
"data-sider": sider,
|
|
98
|
+
children
|
|
99
|
+
})
|
|
100
|
+
}) : /* @__PURE__ */ jsx("div", {
|
|
17
101
|
...rest,
|
|
102
|
+
style: gridStyle,
|
|
18
103
|
"data-scope": "layout",
|
|
19
104
|
"data-part": "root",
|
|
20
105
|
"data-sider": sider,
|
|
@@ -26,27 +111,59 @@ function Root({ sider, children, ...rest }) {
|
|
|
26
111
|
* main content each land on their native element and their grid area. */
|
|
27
112
|
function region(name, tag) {
|
|
28
113
|
const Tag = tag;
|
|
29
|
-
const Component = ({ children, ...rest }) =>
|
|
30
|
-
|
|
31
|
-
"
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
114
|
+
const Component = ({ children, ...rest }) => {
|
|
115
|
+
const layout = useContext(LAYOUT_CONTEXT);
|
|
116
|
+
const splitPanel = name === "Content" && !!layout?.siderPlacement() && !!layout.getSiderState()?.resizable && !layout.getSiderState().collapsed;
|
|
117
|
+
return /* @__PURE__ */ jsx(Tag, {
|
|
118
|
+
...rest,
|
|
119
|
+
"data-scope": "layout",
|
|
120
|
+
"data-part": name.toLowerCase(),
|
|
121
|
+
children: splitPanel ? /* @__PURE__ */ jsx(Splitter.Panel, {
|
|
122
|
+
id: "flow",
|
|
123
|
+
children
|
|
124
|
+
}) : children
|
|
125
|
+
});
|
|
126
|
+
};
|
|
35
127
|
Component.displayName = "Layout" + name;
|
|
36
128
|
return Component;
|
|
37
129
|
}
|
|
38
130
|
const Header = region("Header", "header");
|
|
39
131
|
const Content = region("Content", "main");
|
|
40
132
|
const Footer = region("Footer", "footer");
|
|
41
|
-
/** One step of the arrow-key resize, in px. */
|
|
42
|
-
const RESIZE_STEP = 16;
|
|
43
133
|
function Sider({ collapsed = false, width: widthProp, collapsedWidth = "3.5rem", resizable = false, minWidth = "12rem", maxWidth = "24rem", style, onCollapsedChange, onWidthChange, children, ...rest }) {
|
|
44
134
|
const layout = useContext(LAYOUT_CONTEXT);
|
|
45
135
|
const messages = useComponentMessages();
|
|
46
|
-
const rail = useRef(null);
|
|
47
136
|
const [dragging, setDragging] = useState(false);
|
|
137
|
+
const active = resizable && !collapsed;
|
|
138
|
+
useEffect(() => {
|
|
139
|
+
if (!active) setDragging(false);
|
|
140
|
+
}, [active]);
|
|
48
141
|
const [innerWidth, setInnerWidth] = useState(widthProp ?? "16rem");
|
|
49
142
|
const width = widthProp !== void 0 ? widthProp : innerWidth;
|
|
143
|
+
useEffect(() => {
|
|
144
|
+
layout?.setSiderState((previous) => previous ? {
|
|
145
|
+
...previous,
|
|
146
|
+
resizable,
|
|
147
|
+
collapsed,
|
|
148
|
+
width,
|
|
149
|
+
minWidth,
|
|
150
|
+
maxWidth
|
|
151
|
+
} : {
|
|
152
|
+
resizable,
|
|
153
|
+
collapsed,
|
|
154
|
+
width,
|
|
155
|
+
minWidth,
|
|
156
|
+
maxWidth
|
|
157
|
+
});
|
|
158
|
+
}, [
|
|
159
|
+
layout,
|
|
160
|
+
resizable,
|
|
161
|
+
collapsed,
|
|
162
|
+
width,
|
|
163
|
+
minWidth,
|
|
164
|
+
maxWidth
|
|
165
|
+
]);
|
|
166
|
+
useEffect(() => () => layout?.setSiderState(null), [layout]);
|
|
50
167
|
const prevCollapsed = useRef(collapsed);
|
|
51
168
|
useEffect(() => {
|
|
52
169
|
if (prevCollapsed.current === collapsed) return;
|
|
@@ -60,55 +177,32 @@ function Sider({ collapsed = false, width: widthProp, collapsedWidth = "3.5rem",
|
|
|
60
177
|
setInnerWidth(widthProp);
|
|
61
178
|
onWidthChange?.(widthProp);
|
|
62
179
|
}, [widthProp, onWidthChange]);
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
};
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
const onKeyDown = (event) => {
|
|
89
|
-
if (event.key !== "ArrowLeft" && event.key !== "ArrowRight") return;
|
|
90
|
-
event.preventDefault();
|
|
91
|
-
const widen = (layout?.siderPlacement() ?? "start") === "end" ? event.key === "ArrowLeft" : event.key === "ArrowRight";
|
|
92
|
-
const current = rail.current ? rail.current.getBoundingClientRect().width : 0;
|
|
93
|
-
applyWidth(`${Math.round(current + (widen ? RESIZE_STEP : -16))}px`);
|
|
94
|
-
};
|
|
95
|
-
const handle = resizable && !collapsed ? /* @__PURE__ */ jsx("div", {
|
|
96
|
-
"data-scope": "layout",
|
|
97
|
-
"data-part": "sider-resize",
|
|
98
|
-
"data-dragging": dragging ? "" : void 0,
|
|
99
|
-
role: "separator",
|
|
100
|
-
"aria-orientation": "vertical",
|
|
101
|
-
tabIndex: 0,
|
|
102
|
-
"aria-label": messages.sidebar.resize,
|
|
103
|
-
"aria-valuenow": Math.round(rail.current ? rail.current.getBoundingClientRect().width : 0),
|
|
104
|
-
onPointerDown,
|
|
105
|
-
onPointerMove,
|
|
106
|
-
onPointerUp,
|
|
107
|
-
onKeyDown
|
|
108
|
-
}) : null;
|
|
109
|
-
return /* @__PURE__ */ jsxs("aside", {
|
|
180
|
+
useEffect(() => {
|
|
181
|
+
layout?.setResizeHandlers({
|
|
182
|
+
start: () => setDragging(true),
|
|
183
|
+
resize: (nextWidth) => {
|
|
184
|
+
const next = `${Math.round(nextWidth)}px`;
|
|
185
|
+
setInnerWidth(next);
|
|
186
|
+
onWidthChange?.(next);
|
|
187
|
+
},
|
|
188
|
+
end: () => setDragging(false)
|
|
189
|
+
});
|
|
190
|
+
return () => layout?.setResizeHandlers({
|
|
191
|
+
start: () => {},
|
|
192
|
+
resize: () => {},
|
|
193
|
+
end: () => {}
|
|
194
|
+
});
|
|
195
|
+
}, [layout, onWidthChange]);
|
|
196
|
+
const contents = typeof children === "function" ? children({ collapsed }) : children;
|
|
197
|
+
const body = active ? /* @__PURE__ */ jsxs(Splitter.Panel, {
|
|
198
|
+
id: "sider",
|
|
199
|
+
children: [contents, /* @__PURE__ */ jsx(Splitter.ResizeTrigger, {
|
|
200
|
+
id: layout?.siderPlacement() === "end" ? "flow:sider" : "sider:flow",
|
|
201
|
+
"aria-label": messages.sidebar.resize
|
|
202
|
+
})]
|
|
203
|
+
}) : contents;
|
|
204
|
+
return /* @__PURE__ */ jsx("aside", {
|
|
110
205
|
...rest,
|
|
111
|
-
ref: rail,
|
|
112
206
|
style: {
|
|
113
207
|
...style,
|
|
114
208
|
"--bs-layout-sider-width": collapsed ? collapsedWidth : width,
|
|
@@ -119,8 +213,8 @@ function Sider({ collapsed = false, width: widthProp, collapsedWidth = "3.5rem",
|
|
|
119
213
|
"data-part": "sider",
|
|
120
214
|
"data-collapsed": collapsed ? "" : void 0,
|
|
121
215
|
"data-dragging": dragging ? "" : void 0,
|
|
122
|
-
"data-resizable":
|
|
123
|
-
children:
|
|
216
|
+
"data-resizable": active ? "" : void 0,
|
|
217
|
+
children: body
|
|
124
218
|
});
|
|
125
219
|
}
|
|
126
220
|
const Layout = Object.assign(Root, {
|
|
@@ -6,5 +6,8 @@ export interface LinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
|
6
6
|
/** A link is ink in the accent's voice: quiet at rest, deepening under
|
|
7
7
|
* the hand, the halo at focus. The underline follows the prose —
|
|
8
8
|
* always, on hover, or never. */
|
|
9
|
-
|
|
9
|
+
declare function LinkImpl({ underline, children, ...rest }: LinkProps): import("react").JSX.Element;
|
|
10
|
+
export declare const Link: typeof LinkImpl & {
|
|
11
|
+
Root: typeof LinkImpl;
|
|
12
|
+
};
|
|
10
13
|
//#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 } from "react/jsx-runtime";
|
|
3
4
|
//#region src/components/link/index.tsx
|
|
4
5
|
/** A link is ink in the accent's voice: quiet at rest, deepening under
|
|
5
6
|
* the hand, the halo at focus. The underline follows the prose —
|
|
6
7
|
* always, on hover, or never. */
|
|
7
|
-
function
|
|
8
|
+
function LinkImpl({ underline = "hover", children, ...rest }) {
|
|
8
9
|
injectComponentStyle("link");
|
|
9
10
|
return /* @__PURE__ */ jsx("a", {
|
|
10
11
|
...rest,
|
|
@@ -14,5 +15,6 @@ function Link({ underline = "hover", children, ...rest }) {
|
|
|
14
15
|
children
|
|
15
16
|
});
|
|
16
17
|
}
|
|
18
|
+
const Link = withSelfRoot(LinkImpl);
|
|
17
19
|
//#endregion
|
|
18
20
|
export { Link };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CSSProperties } from "react";
|
|
1
2
|
import { CollectionItem } from "@ark-ui/react/collection";
|
|
2
3
|
import { Listbox as Listbox$1, ListboxRootComponentProps, createListCollection } from "@ark-ui/react/listbox";
|
|
3
4
|
//#region src/components/listbox/index.d.ts
|
|
@@ -11,7 +12,27 @@ type ListboxOwnProps = {
|
|
|
11
12
|
size?: "sm" | "md" | "lg";
|
|
12
13
|
};
|
|
13
14
|
declare function ListboxRoot<T extends CollectionItem>(props: ListboxRootComponentProps<T, ListboxOwnProps>): import("react").JSX.Element;
|
|
14
|
-
|
|
15
|
+
type ListboxOption = {
|
|
16
|
+
label: string;
|
|
17
|
+
value: string;
|
|
18
|
+
};
|
|
19
|
+
type ListboxFacadeValue = string | string[];
|
|
20
|
+
type ListboxFacadeProps = {
|
|
21
|
+
value?: ListboxFacadeValue;
|
|
22
|
+
defaultValue?: ListboxFacadeValue;
|
|
23
|
+
options: ListboxOption[];
|
|
24
|
+
multiple?: boolean;
|
|
25
|
+
disabled?: boolean;
|
|
26
|
+
label?: string;
|
|
27
|
+
size?: "sm" | "md" | "lg";
|
|
28
|
+
className?: string;
|
|
29
|
+
style?: CSSProperties;
|
|
30
|
+
onValueChange?: (value?: ListboxFacadeValue) => void;
|
|
31
|
+
};
|
|
32
|
+
/** The complete listbox behind one model value: options become rows and the
|
|
33
|
+
* label names the quiet register. */
|
|
34
|
+
declare function ListboxFacade(props: ListboxFacadeProps): import("react").JSX.Element;
|
|
35
|
+
export declare const Listbox: typeof ListboxFacade & Omit<typeof Listbox$1, "Root"> & {
|
|
15
36
|
Root: typeof ListboxRoot;
|
|
16
37
|
};
|
|
17
38
|
//#endregion
|