@arshad-shah/cynosure 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/components/Accordion/Accordion.d.ts +14 -0
- package/dist/components/Accordion/Accordion.js.map +1 -1
- package/dist/components/Announcer/Announcer.d.ts +1 -0
- package/dist/components/Announcer/Announcer.js.map +1 -1
- package/dist/components/AppShell/AppShell.d.ts +22 -1
- package/dist/components/AppShell/AppShell.js +95 -83
- package/dist/components/AppShell/AppShell.js.map +1 -1
- package/dist/components/AppShell/index.d.ts +1 -1
- package/dist/components/AspectRatio/AspectRatio.d.ts +29 -0
- package/dist/components/AspectRatio/AspectRatio.js +21 -0
- package/dist/components/AspectRatio/AspectRatio.js.map +1 -0
- package/dist/components/AspectRatio/index.d.ts +1 -0
- package/dist/components/Avatar/Avatar.d.ts +96 -0
- package/dist/components/Avatar/Avatar.js +90 -0
- package/dist/components/Avatar/Avatar.js.map +1 -0
- package/dist/components/Avatar/index.d.ts +1 -0
- package/dist/components/Badge/Badge.d.ts +6 -0
- package/dist/components/Badge/Badge.js.map +1 -1
- package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +55 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.js +85 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.js.map +1 -0
- package/dist/components/Breadcrumbs/index.d.ts +1 -0
- package/dist/components/Button/Button.d.ts +13 -2
- package/dist/components/Button/Button.js +28 -26
- package/dist/components/Button/Button.js.map +1 -1
- package/dist/components/Calendar/Calendar.d.ts +65 -7
- package/dist/components/Calendar/Calendar.js +207 -95
- package/dist/components/Calendar/Calendar.js.map +1 -1
- package/dist/components/Calendar/dates.d.ts +4 -0
- package/dist/components/Calendar/dates.js +41 -27
- package/dist/components/Calendar/dates.js.map +1 -1
- package/dist/components/Calendar/index.d.ts +1 -1
- package/dist/components/Card/Card.d.ts +27 -0
- package/dist/components/Card/Card.js +48 -36
- package/dist/components/Card/Card.js.map +1 -1
- package/dist/components/Card/index.d.ts +1 -1
- package/dist/components/Checkbox/Checkbox.d.ts +8 -1
- package/dist/components/Checkbox/Checkbox.js +7 -6
- package/dist/components/Checkbox/Checkbox.js.map +1 -1
- package/dist/components/Checkbox/ChoiceRow.d.ts +17 -1
- package/dist/components/Checkbox/ChoiceRow.js +19 -18
- package/dist/components/Checkbox/ChoiceRow.js.map +1 -1
- package/dist/components/Checklist/Checklist.d.ts +65 -0
- package/dist/components/Checklist/Checklist.js +163 -0
- package/dist/components/Checklist/Checklist.js.map +1 -0
- package/dist/components/Checklist/index.d.ts +1 -0
- package/dist/components/CodeBlock/CodeBlock.d.ts +5 -0
- package/dist/components/CodeBlock/CodeBlock.js.map +1 -1
- package/dist/components/ColorField/ColorField.d.ts +12 -0
- package/dist/components/ColorField/ColorField.js +19 -19
- package/dist/components/ColorField/ColorField.js.map +1 -1
- package/dist/components/ColorSwatches/ColorSwatches.d.ts +5 -0
- package/dist/components/ColorSwatches/ColorSwatches.js +6 -6
- package/dist/components/ColorSwatches/ColorSwatches.js.map +1 -1
- package/dist/components/Combobox/Combobox.d.ts +20 -1
- package/dist/components/Combobox/Combobox.js +38 -34
- package/dist/components/Combobox/Combobox.js.map +1 -1
- package/dist/components/CommandPalette/CommandPalette.d.ts +9 -0
- package/dist/components/CommandPalette/CommandPalette.js +10 -10
- package/dist/components/CommandPalette/CommandPalette.js.map +1 -1
- package/dist/components/CompareSlider/CompareSlider.d.ts +4 -0
- package/dist/components/CompareSlider/CompareSlider.js +4 -4
- package/dist/components/CompareSlider/CompareSlider.js.map +1 -1
- package/dist/components/Container/Container.d.ts +44 -0
- package/dist/components/Container/Container.js +24 -0
- package/dist/components/Container/Container.js.map +1 -0
- package/dist/components/Container/index.d.ts +1 -0
- package/dist/components/ContextMenu/ContextMenu.d.ts +11 -0
- package/dist/components/ContextMenu/ContextMenu.js.map +1 -1
- package/dist/components/CopyButton/CopyButton.d.ts +8 -0
- package/dist/components/CopyButton/CopyButton.js.map +1 -1
- package/dist/components/DateField/DateField.d.ts +17 -0
- package/dist/components/DateField/DateField.js +6 -6
- package/dist/components/DateField/DateField.js.map +1 -1
- package/dist/components/DescriptionList/DescriptionList.d.ts +3 -0
- package/dist/components/DescriptionList/DescriptionList.js.map +1 -1
- package/dist/components/Dialog/Dialog.d.ts +16 -2
- package/dist/components/Dialog/Dialog.js +82 -70
- package/dist/components/Dialog/Dialog.js.map +1 -1
- package/dist/components/Disclosure/Disclosure.d.ts +7 -0
- package/dist/components/Disclosure/Disclosure.js.map +1 -1
- package/dist/components/Divider/Divider.d.ts +59 -0
- package/dist/components/Divider/Divider.js +32 -0
- package/dist/components/Divider/Divider.js.map +1 -0
- package/dist/components/Divider/index.d.ts +1 -0
- package/dist/components/DocumentViewport/DocumentViewport.d.ts +8 -0
- package/dist/components/DocumentViewport/DocumentViewport.js.map +1 -1
- package/dist/components/EmptyState/EmptyState.d.ts +3 -0
- package/dist/components/EmptyState/EmptyState.js.map +1 -1
- package/dist/components/Field/Field.d.ts +6 -0
- package/dist/components/Field/Field.js.map +1 -1
- package/dist/components/FileDrop/FileDrop.d.ts +8 -0
- package/dist/components/FileDrop/FileDrop.js.map +1 -1
- package/dist/components/FloatingToolbar/FloatingToolbar.d.ts +4 -0
- package/dist/components/FloatingToolbar/FloatingToolbar.js +4 -4
- package/dist/components/FloatingToolbar/FloatingToolbar.js.map +1 -1
- package/dist/components/Grid/Grid.d.ts +33 -7
- package/dist/components/Grid/Grid.js +46 -25
- package/dist/components/Grid/Grid.js.map +1 -1
- package/dist/components/Grid/index.d.ts +1 -1
- package/dist/components/Heading/Heading.d.ts +57 -0
- package/dist/components/Heading/Heading.js +33 -0
- package/dist/components/Heading/Heading.js.map +1 -0
- package/dist/components/Heading/index.d.ts +1 -0
- package/dist/components/HoverCard/HoverCard.d.ts +1 -0
- package/dist/components/HoverCard/HoverCard.js.map +1 -1
- package/dist/components/IconButton/IconButton.d.ts +1 -0
- package/dist/components/IconButton/IconButton.js.map +1 -1
- package/dist/components/Image/Image.d.ts +62 -0
- package/dist/components/Image/Image.js +75 -0
- package/dist/components/Image/Image.js.map +1 -0
- package/dist/components/Image/index.d.ts +1 -0
- package/dist/components/Inline/Inline.d.ts +7 -3
- package/dist/components/Inline/Inline.js +19 -13
- package/dist/components/Inline/Inline.js.map +1 -1
- package/dist/components/Kbd/Kbd.d.ts +2 -0
- package/dist/components/Kbd/Kbd.js.map +1 -1
- package/dist/components/KeyValueEditor/KeyValueEditor.d.ts +7 -0
- package/dist/components/KeyValueEditor/KeyValueEditor.js +8 -8
- package/dist/components/KeyValueEditor/KeyValueEditor.js.map +1 -1
- package/dist/components/Link/Link.d.ts +7 -0
- package/dist/components/Link/Link.js.map +1 -1
- package/dist/components/LoadingDots/LoadingDots.d.ts +2 -0
- package/dist/components/LoadingDots/LoadingDots.js.map +1 -1
- package/dist/components/Menu/Menu.d.ts +13 -1
- package/dist/components/Menu/Menu.js +37 -35
- package/dist/components/Menu/Menu.js.map +1 -1
- package/dist/components/Notice/Notice.d.ts +5 -0
- package/dist/components/Notice/Notice.js.map +1 -1
- package/dist/components/NumberField/NumberField.d.ts +17 -0
- package/dist/components/NumberField/NumberField.js +8 -8
- package/dist/components/NumberField/NumberField.js.map +1 -1
- package/dist/components/PageHeader/PageHeader.d.ts +61 -0
- package/dist/components/PageHeader/PageHeader.js +63 -0
- package/dist/components/PageHeader/PageHeader.js.map +1 -0
- package/dist/components/PageHeader/index.d.ts +1 -0
- package/dist/components/Pagination/Pagination.d.ts +77 -0
- package/dist/components/Pagination/Pagination.js +120 -0
- package/dist/components/Pagination/Pagination.js.map +1 -0
- package/dist/components/Pagination/index.d.ts +1 -0
- package/dist/components/PanZoomCanvas/PanZoomCanvas.d.ts +4 -0
- package/dist/components/PanZoomCanvas/PanZoomCanvas.js.map +1 -1
- package/dist/components/Popover/Popover.d.ts +10 -0
- package/dist/components/Popover/Popover.js.map +1 -1
- package/dist/components/ProgressBar/ProgressBar.d.ts +5 -0
- package/dist/components/ProgressBar/ProgressBar.js.map +1 -1
- package/dist/components/ProgressOverlay/ProgressOverlay.d.ts +3 -0
- package/dist/components/ProgressOverlay/ProgressOverlay.js.map +1 -1
- package/dist/components/Prose/Prose.d.ts +1 -0
- package/dist/components/Prose/Prose.js.map +1 -1
- package/dist/components/RadioGroup/RadioGroup.d.ts +13 -0
- package/dist/components/RadioGroup/RadioGroup.js.map +1 -1
- package/dist/components/SegmentedControl/SegmentedControl.d.ts +9 -0
- package/dist/components/SegmentedControl/SegmentedControl.js.map +1 -1
- package/dist/components/Select/Select.d.ts +18 -1
- package/dist/components/Select/Select.js +97 -88
- package/dist/components/Select/Select.js.map +1 -1
- package/dist/components/Select/index.d.ts +1 -0
- package/dist/components/SelectionFrame/SelectionFrame.d.ts +6 -0
- package/dist/components/SelectionFrame/SelectionFrame.js.map +1 -1
- package/dist/components/SideNav/SideNav.d.ts +37 -1
- package/dist/components/SideNav/SideNav.js +100 -73
- package/dist/components/SideNav/SideNav.js.map +1 -1
- package/dist/components/SideNav/index.d.ts +1 -1
- package/dist/components/SignaturePad/SignaturePad.d.ts +3 -0
- package/dist/components/SignaturePad/SignaturePad.js.map +1 -1
- package/dist/components/Skeleton/Skeleton.d.ts +1 -0
- package/dist/components/Skeleton/Skeleton.js.map +1 -1
- package/dist/components/Slider/Slider.d.ts +11 -0
- package/dist/components/Slider/Slider.js +6 -6
- package/dist/components/Slider/Slider.js.map +1 -1
- package/dist/components/SortableList/SortableList.d.ts +6 -0
- package/dist/components/SortableList/SortableList.js.map +1 -1
- package/dist/components/SplitPane/SplitPane.d.ts +5 -0
- package/dist/components/SplitPane/SplitPane.js +4 -4
- package/dist/components/SplitPane/SplitPane.js.map +1 -1
- package/dist/components/Stack/Stack.d.ts +7 -3
- package/dist/components/Stack/Stack.js +18 -12
- package/dist/components/Stack/Stack.js.map +1 -1
- package/dist/components/Stack/index.d.ts +1 -0
- package/dist/components/Stack/space.d.ts +18 -0
- package/dist/components/Stack/space.js +12 -0
- package/dist/components/Stack/space.js.map +1 -0
- package/dist/components/Steps/Steps.d.ts +4 -0
- package/dist/components/Steps/Steps.js.map +1 -1
- package/dist/components/Table/Table.d.ts +12 -0
- package/dist/components/Table/Table.js.map +1 -1
- package/dist/components/Tabs/Tabs.d.ts +14 -0
- package/dist/components/Tabs/Tabs.js +4 -4
- package/dist/components/Tabs/Tabs.js.map +1 -1
- package/dist/components/TagInput/TagInput.d.ts +18 -0
- package/dist/components/TagInput/TagInput.js +5 -5
- package/dist/components/TagInput/TagInput.js.map +1 -1
- package/dist/components/Text/Text.d.ts +72 -0
- package/dist/components/Text/Text.js +30 -0
- package/dist/components/Text/Text.js.map +1 -0
- package/dist/components/Text/index.d.ts +1 -0
- package/dist/components/TextArea/TextArea.d.ts +10 -0
- package/dist/components/TextArea/TextArea.js +4 -4
- package/dist/components/TextArea/TextArea.js.map +1 -1
- package/dist/components/TextField/TextField.d.ts +13 -0
- package/dist/components/TextField/TextField.js +4 -4
- package/dist/components/TextField/TextField.js.map +1 -1
- package/dist/components/ThemeToggle/ThemeToggle.d.ts +4 -0
- package/dist/components/ThemeToggle/ThemeToggle.js.map +1 -1
- package/dist/components/TimeField/TimeField.d.ts +62 -8
- package/dist/components/TimeField/TimeField.js +308 -72
- package/dist/components/TimeField/TimeField.js.map +1 -1
- package/dist/components/Toast/Toast.d.ts +25 -1
- package/dist/components/Toast/Toast.js +134 -125
- package/dist/components/Toast/Toast.js.map +1 -1
- package/dist/components/Toast/index.d.ts +1 -1
- package/dist/components/Toolbar/Toolbar.d.ts +3 -0
- package/dist/components/Toolbar/Toolbar.js.map +1 -1
- package/dist/components/Tooltip/Tooltip.d.ts +1 -0
- package/dist/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/components/Tree/Tree.d.ts +8 -0
- package/dist/components/Tree/Tree.js.map +1 -1
- package/dist/components/VirtualList/VirtualList.d.ts +8 -0
- package/dist/components/VirtualList/VirtualList.js +4 -4
- package/dist/components/VirtualList/VirtualList.js.map +1 -1
- package/dist/components/ZoomControls/ZoomControls.d.ts +4 -0
- package/dist/components/ZoomControls/ZoomControls.js.map +1 -1
- package/dist/foundations/ChoiceBase/ChoiceBase.d.ts +1 -0
- package/dist/foundations/ChoiceBase/ChoiceBase.js.map +1 -1
- package/dist/foundations/HiddenValue/HiddenValue.d.ts +3 -0
- package/dist/foundations/HiddenValue/HiddenValue.js.map +1 -1
- package/dist/foundations/Icon/Icon.d.ts +3 -0
- package/dist/foundations/Icon/Icon.js.map +1 -1
- package/dist/foundations/image-outcome.d.ts +15 -0
- package/dist/foundations/image-outcome.js +39 -0
- package/dist/foundations/image-outcome.js.map +1 -0
- package/dist/foundations/option-icon.d.ts +26 -0
- package/dist/foundations/option-icon.js +16 -0
- package/dist/foundations/option-icon.js.map +1 -0
- package/dist/icons/index.d.ts +1 -0
- package/dist/icons/index.js +476 -474
- package/dist/icons/keywords.d.ts +249 -0
- package/dist/icons/keywords.js +1728 -0
- package/dist/icons/keywords.js.map +1 -0
- package/dist/index.d.ts +20 -9
- package/dist/index.js +240 -213
- package/dist/styles/aspect-ratio.css +1 -0
- package/dist/styles/avatar.css +1 -0
- package/dist/styles/breadcrumbs.css +1 -0
- package/dist/styles/calendar.css +1 -1
- package/dist/styles/card.css +1 -1
- package/dist/styles/checkbox.css +1 -1
- package/dist/styles/checklist.css +1 -0
- package/dist/styles/container.css +1 -0
- package/dist/styles/divider.css +1 -0
- package/dist/styles/generated-css.d.ts +1 -1
- package/dist/styles/generated-css.js +1 -1
- package/dist/styles/generated-css.js.map +1 -1
- package/dist/styles/grid.css +1 -1
- package/dist/styles/heading.css +1 -0
- package/dist/styles/image.css +1 -0
- package/dist/styles/menu.css +1 -1
- package/dist/styles/page-header.css +1 -0
- package/dist/styles/pagination.css +1 -0
- package/dist/styles/side-nav.css +1 -1
- package/dist/styles/stack.css +1 -1
- package/dist/styles/text.css +1 -0
- package/dist/styles/time-field.css +1 -1
- package/dist/styles/toast.css +1 -1
- package/dist/styles.css +1 -1
- package/dist/theme/CynosureTheme.d.ts +4 -0
- package/dist/theme/CynosureTheme.js.map +1 -1
- package/dist/tokens/to-css.js +12 -12
- package/dist/tokens/to-css.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,111 +1,123 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { useControllableState as
|
|
3
|
-
import { useClientLayoutEffect as
|
|
4
|
-
import { useDismiss as
|
|
5
|
-
import { IconButton as
|
|
6
|
-
import { DialogBase as
|
|
7
|
-
import { close as
|
|
8
|
-
import { ToastHostContext as
|
|
9
|
-
import { useContext as
|
|
10
|
-
import { jsx as
|
|
11
|
-
var
|
|
12
|
-
function
|
|
2
|
+
import { useControllableState as V } from "../../foundations/controllable.js";
|
|
3
|
+
import { useClientLayoutEffect as g } from "../../foundations/client-layout-effect.js";
|
|
4
|
+
import { useDismiss as M } from "../../overlay/dismiss.js";
|
|
5
|
+
import { IconButton as _ } from "../IconButton/IconButton.js";
|
|
6
|
+
import { DialogBase as G } from "../../foundations/DialogBase/DialogBase.js";
|
|
7
|
+
import { close as J } from "../../icons/close.js";
|
|
8
|
+
import { ToastHostContext as K } from "../../overlay/toast-host.js";
|
|
9
|
+
import { useContext as Q, useEffect as W, useId as X, useRef as s, useState as Y } from "react";
|
|
10
|
+
import { jsx as r, jsxs as h } from "react/jsx-runtime";
|
|
11
|
+
var Z = { close: "Close" }, B = 'button:not([disabled]), [href], input:not([disabled]):not([type="hidden"]):not([aria-hidden="true"]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
|
|
12
|
+
function ee() {
|
|
13
13
|
if (typeof document > "u") return null;
|
|
14
14
|
let e = document.activeElement;
|
|
15
15
|
for (; e?.shadowRoot?.activeElement; ) e = e.shadowRoot.activeElement;
|
|
16
16
|
return e;
|
|
17
17
|
}
|
|
18
|
-
function
|
|
18
|
+
function te(e) {
|
|
19
19
|
if (!e) return null;
|
|
20
|
-
const
|
|
21
|
-
if (!(
|
|
22
|
-
const
|
|
23
|
-
return (
|
|
20
|
+
const n = e.closest("[popover][id]");
|
|
21
|
+
if (!(n ? !n.matches(":popover-open") : e.checkVisibility?.() === !1)) return e;
|
|
22
|
+
const m = e.getRootNode();
|
|
23
|
+
return (n && m.querySelector(`[aria-controls="${CSS.escape(n.id)}"]`)) ?? e;
|
|
24
24
|
}
|
|
25
|
-
function
|
|
26
|
-
const
|
|
27
|
-
...
|
|
28
|
-
...
|
|
29
|
-
}, [t,
|
|
30
|
-
t && !
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
if (
|
|
36
|
-
|
|
37
|
-
|
|
25
|
+
function oe({ open: e, defaultOpen: n = !1, onOpenChange: m, title: I, description: f, actions: b, size: O = "md", dismissible: C = !0, keepMounted: R = !1, labels: k, side: q, className: x, style: P, children: j }) {
|
|
26
|
+
const a = X(), z = {
|
|
27
|
+
...Z,
|
|
28
|
+
...k
|
|
29
|
+
}, [t, p] = V(e, n, m), i = s(null), c = Q(K), y = s(null), S = s(null), E = s(null), l = s(null), N = s(!1);
|
|
30
|
+
t && !N.current && (l.current = ee()), N.current = t;
|
|
31
|
+
const D = () => {
|
|
32
|
+
C && p(!1);
|
|
33
|
+
}, [u, L] = Y(t);
|
|
34
|
+
t && !u && L(!0), W(() => {
|
|
35
|
+
if (t || !u) return;
|
|
36
|
+
const o = i.current, w = () => L(!1), F = getComputedStyle(o), $ = (v) => Math.max(...v.split(",").map((U) => Number.parseFloat(U))), T = ($(F.transitionDuration) + $(F.transitionDelay)) * 1e3, A = (v) => {
|
|
37
|
+
v.target === o && w();
|
|
38
|
+
};
|
|
39
|
+
o.addEventListener("transitionend", A);
|
|
40
|
+
const H = setTimeout(w, T && T + 100);
|
|
41
|
+
return () => {
|
|
42
|
+
o.removeEventListener("transitionend", A), clearTimeout(H);
|
|
43
|
+
};
|
|
44
|
+
}, [t, u]);
|
|
45
|
+
const d = t || u || R;
|
|
46
|
+
return g(() => {
|
|
47
|
+
if (!(!t || !c || !y.current))
|
|
48
|
+
return c.register(y.current);
|
|
49
|
+
}, [t, c]), g(() => {
|
|
38
50
|
if (t)
|
|
39
51
|
return () => {
|
|
40
|
-
|
|
52
|
+
l.current = te(l.current);
|
|
41
53
|
};
|
|
42
|
-
}, [t]),
|
|
43
|
-
t && (
|
|
44
|
-
}, [t]),
|
|
54
|
+
}, [t]), g(() => {
|
|
55
|
+
t && (S.current?.querySelector(B) ?? E.current?.querySelector(B) ?? i.current)?.focus({ preventScroll: !0 });
|
|
56
|
+
}, [t]), M({
|
|
45
57
|
open: t,
|
|
46
|
-
onClose:
|
|
58
|
+
onClose: D,
|
|
47
59
|
inside: [i],
|
|
48
|
-
returnFocus:
|
|
49
|
-
outside: (
|
|
50
|
-
}), /* @__PURE__ */
|
|
60
|
+
returnFocus: l,
|
|
61
|
+
outside: (o) => o.composedPath()[0] === i.current
|
|
62
|
+
}), /* @__PURE__ */ h(G, {
|
|
51
63
|
ref: i,
|
|
52
64
|
open: t,
|
|
53
|
-
onCancel:
|
|
54
|
-
onClose: () =>
|
|
65
|
+
onCancel: D,
|
|
66
|
+
onClose: () => p(!1),
|
|
55
67
|
className: "cy-dialog",
|
|
56
68
|
tabIndex: -1,
|
|
57
|
-
"data-size":
|
|
58
|
-
"data-side":
|
|
59
|
-
"aria-labelledby": `${
|
|
60
|
-
"aria-describedby": d ? `${
|
|
61
|
-
children: [/* @__PURE__ */
|
|
62
|
-
className:
|
|
63
|
-
style:
|
|
69
|
+
"data-size": O,
|
|
70
|
+
"data-side": q,
|
|
71
|
+
"aria-labelledby": d ? `${a}-title` : void 0,
|
|
72
|
+
"aria-describedby": d && f ? `${a}-description` : void 0,
|
|
73
|
+
children: [d && /* @__PURE__ */ h("div", {
|
|
74
|
+
className: x ? `cy-dialog-panel cy-reset ${x}` : "cy-dialog-panel cy-reset",
|
|
75
|
+
style: P,
|
|
64
76
|
children: [
|
|
65
|
-
/* @__PURE__ */
|
|
77
|
+
/* @__PURE__ */ h("div", {
|
|
66
78
|
className: "cy-dialog-header cy-reset",
|
|
67
|
-
children: [/* @__PURE__ */
|
|
68
|
-
id: `${
|
|
79
|
+
children: [/* @__PURE__ */ r("h2", {
|
|
80
|
+
id: `${a}-title`,
|
|
69
81
|
className: "cy-dialog-title cy-reset",
|
|
70
|
-
children:
|
|
71
|
-
}),
|
|
72
|
-
icon:
|
|
73
|
-
label:
|
|
82
|
+
children: I
|
|
83
|
+
}), C && /* @__PURE__ */ r(_, {
|
|
84
|
+
icon: J,
|
|
85
|
+
label: z.close,
|
|
74
86
|
variant: "ghost",
|
|
75
87
|
size: "sm",
|
|
76
88
|
tooltipPlacement: "bottom",
|
|
77
|
-
onClick: () =>
|
|
89
|
+
onClick: () => p(!1)
|
|
78
90
|
})]
|
|
79
91
|
}),
|
|
80
|
-
|
|
81
|
-
id: `${
|
|
92
|
+
f && /* @__PURE__ */ r("p", {
|
|
93
|
+
id: `${a}-description`,
|
|
82
94
|
className: "cy-dialog-description cy-reset",
|
|
83
|
-
children:
|
|
95
|
+
children: f
|
|
84
96
|
}),
|
|
85
|
-
/* @__PURE__ */
|
|
86
|
-
ref:
|
|
97
|
+
/* @__PURE__ */ r("div", {
|
|
98
|
+
ref: S,
|
|
87
99
|
className: "cy-dialog-body cy-reset",
|
|
88
|
-
onFocus: (
|
|
89
|
-
children:
|
|
100
|
+
onFocus: (o) => o.target.scrollIntoView({ block: "nearest" }),
|
|
101
|
+
children: j
|
|
90
102
|
}),
|
|
91
|
-
|
|
92
|
-
ref:
|
|
103
|
+
b && /* @__PURE__ */ r("div", {
|
|
104
|
+
ref: E,
|
|
93
105
|
className: "cy-dialog-actions cy-reset",
|
|
94
|
-
children:
|
|
106
|
+
children: b
|
|
95
107
|
})
|
|
96
108
|
]
|
|
97
|
-
}), c && /* @__PURE__ */
|
|
98
|
-
ref:
|
|
109
|
+
}), c && d && /* @__PURE__ */ r("div", {
|
|
110
|
+
ref: y,
|
|
99
111
|
className: "cy-dialog-toasts"
|
|
100
112
|
})]
|
|
101
113
|
});
|
|
102
114
|
}
|
|
103
|
-
function
|
|
104
|
-
return /* @__PURE__ */
|
|
115
|
+
function me(e) {
|
|
116
|
+
return /* @__PURE__ */ r(oe, { ...e });
|
|
105
117
|
}
|
|
106
118
|
export {
|
|
107
|
-
|
|
108
|
-
|
|
119
|
+
me as Dialog,
|
|
120
|
+
oe as DialogFrame
|
|
109
121
|
};
|
|
110
122
|
|
|
111
123
|
//# sourceMappingURL=Dialog.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dialog.js","names":["closeIcon","useControllableState","useClientLayoutEffect","useDismiss","IconButton","DialogBase","close","ToastHostContext","useContext","useId","useRef","jsx","jsxs","DEFAULT_LABELS","FOCUSABLE","deepActive","active","reachable","el","popover","root","DialogFrame","open","defaultOpen","onOpenChange","title","description","actions","size","dismissible","labels","side","className","style","children","id","text","isOpen","setOpen","dialog","toastHost","toasts","body","footer","returnTo","wasOpen","dismiss","event","Dialog","props"],"sources":["../../../src/components/Dialog/Dialog.tsx"],"sourcesContent":["import { type CSSProperties, type ReactNode, useContext, useId, useRef } from \"react\";\nimport { useClientLayoutEffect } from \"../../foundations/client-layout-effect.js\";\nimport { useControllableState } from \"../../foundations/controllable.js\";\nimport { DialogBase } from \"../../foundations/DialogBase/DialogBase.js\";\nimport { close as closeIcon } from \"../../icons/close.js\";\nimport { useDismiss } from \"../../overlay/dismiss.js\";\nimport { ToastHostContext } from \"../../overlay/toast-host.js\";\nimport type { Size } from \"../../tokens/schema.js\";\nimport { IconButton } from \"../IconButton/IconButton.js\";\n\nexport interface DialogTokens {\n radius: string;\n padding: string;\n widthSm: string;\n widthMd: string;\n widthLg: string;\n scrim: string;\n}\n\ndeclare module \"../../tokens/schema.js\" {\n interface ComponentTokens {\n dialog: DialogTokens;\n }\n}\n\nexport interface DialogLabels {\n /** Accessible name of the close button. */\n close: string;\n}\n\nexport interface DialogProps {\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?: (open: boolean) => void;\n /** Heading of the dialog; also its accessible name. */\n title: ReactNode;\n /** One or two sentences under the title; also its accessible description. */\n description?: ReactNode;\n /** Buttons along the bottom, outside the scrolling content (Cancel first, then the main action). */\n actions?: ReactNode;\n /** Width preset (the panel never grows wider than its container). */\n size?: Size;\n /** Escape, the backdrop and the close button close it (default). `false` leaves only your actions. */\n dismissible?: boolean;\n labels?: Partial<DialogLabels>;\n className?: string;\n /** Layout only, applied to the panel. Restyle through --cy-dialog-* tokens. */\n style?: CSSProperties;\n children?: ReactNode;\n}\n\n/** Internal: a Sheet is the same dialog docked to an edge. */\nexport interface DialogFrameProps extends DialogProps {\n side?: \"bottom\" | \"end\" | \"start\";\n}\n\nconst DEFAULT_LABELS: DialogLabels = { close: \"Close\" };\nconst FOCUSABLE =\n 'button:not([disabled]), [href], input:not([disabled]):not([type=\"hidden\"]):not([aria-hidden=\"true\"]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])';\n\n/** The focused element, looking inside shadow roots (document.activeElement stops at the host). */\nfunction deepActive(): HTMLElement | null {\n if (typeof document === \"undefined\") return null; // server render\n let active = document.activeElement;\n while (active?.shadowRoot?.activeElement) active = active.shadowRoot.activeElement;\n return active as HTMLElement | null;\n}\n\n/**\n * Where focus can actually go back to. A Dialog opened from a Menu item remembers that item, but the menu has closed\n * (hidden, still in the DOM): fall back to the button that controls the hidden popover.\n */\nfunction reachable(el: HTMLElement | null): HTMLElement | null {\n if (!el) return null;\n // A closed popover can still be fading out (displayed), so ask the popover, not only the layout.\n const popover = el.closest<HTMLElement>(\"[popover][id]\");\n const closed = popover ? !popover.matches(\":popover-open\") : el.checkVisibility?.() === false;\n if (!closed) return el;\n const root = el.getRootNode() as Document | ShadowRoot;\n return (popover && root.querySelector<HTMLElement>(`[aria-controls=\"${CSS.escape(popover.id)}\"]`)) ?? el;\n}\n\nexport function DialogFrame({\n open,\n defaultOpen = false,\n onOpenChange,\n title,\n description,\n actions,\n size = \"md\",\n dismissible = true,\n labels,\n side,\n className,\n style,\n children,\n}: DialogFrameProps) {\n const id = useId();\n const text = { ...DEFAULT_LABELS, ...labels };\n const [isOpen, setOpen] = useControllableState(open, defaultOpen, onOpenChange);\n const dialog = useRef<HTMLDialogElement>(null);\n const toastHost = useContext(ToastHostContext);\n const toasts = useRef<HTMLDivElement>(null);\n const body = useRef<HTMLDivElement>(null);\n const footer = useRef<HTMLDivElement>(null);\n const returnTo = useRef<HTMLElement | null>(null);\n const wasOpen = useRef(false);\n // Where focus was before opening: read while rendering, because DialogBase's showModal moves it first.\n if (isOpen && !wasOpen.current) returnTo.current = deepActive();\n wasOpen.current = isOpen;\n const dismiss = () => {\n if (dismissible) setOpen(false);\n };\n\n // On close, before useDismiss returns focus: make sure the remembered element can still take it.\n // Inside a Toaster, lend it a container while open: toasts raised now show above this dialog instead of under its\n // scrim, where the modal would make them inert. Runs after DialogBase has called showModal.\n useClientLayoutEffect(() => {\n if (!isOpen || !toastHost || !toasts.current) return;\n return toastHost.register(toasts.current);\n }, [isOpen, toastHost]);\n\n useClientLayoutEffect(() => {\n if (!isOpen) return;\n return () => {\n returnTo.current = reachable(returnTo.current);\n };\n }, [isOpen]);\n\n // DialogBase has opened it; move focus to the first control in the content, else the first action, else the\n // dialog itself (so the close button's tooltip does not pop up on open).\n useClientLayoutEffect(() => {\n if (!isOpen) return;\n const first =\n body.current?.querySelector<HTMLElement>(FOCUSABLE) ??\n footer.current?.querySelector<HTMLElement>(FOCUSABLE) ??\n dialog.current;\n first?.focus({ preventScroll: true });\n }, [isOpen]);\n\n useDismiss({\n open: isOpen,\n onClose: dismiss,\n inside: [dialog],\n returnFocus: returnTo,\n // The dialog fills its container; a pointer down on the dialog itself (not the panel) is on the backdrop.\n outside: (event) => event.composedPath()[0] === dialog.current,\n });\n\n return (\n <DialogBase\n ref={dialog}\n open={isOpen}\n onCancel={dismiss}\n onClose={() => setOpen(false)}\n className=\"cy-dialog\"\n tabIndex={-1}\n data-size={size}\n data-side={side}\n aria-labelledby={`${id}-title`}\n aria-describedby={description ? `${id}-description` : undefined}\n >\n <div\n className={className ? `cy-dialog-panel cy-reset ${className}` : \"cy-dialog-panel cy-reset\"}\n style={style}\n >\n <div className=\"cy-dialog-header cy-reset\">\n <h2 id={`${id}-title`} className=\"cy-dialog-title cy-reset\">\n {title}\n </h2>\n {dismissible && (\n <IconButton\n icon={closeIcon}\n label={text.close}\n variant=\"ghost\"\n size=\"sm\"\n tooltipPlacement=\"bottom\"\n onClick={() => setOpen(false)}\n />\n )}\n </div>\n {description && (\n <p id={`${id}-description`} className=\"cy-dialog-description cy-reset\">\n {description}\n </p>\n )}\n {/* biome-ignore lint/a11y/noStaticElementInteractions: delegated focus listener for the controls inside */}\n <div\n ref={body}\n className=\"cy-dialog-body cy-reset\"\n // A focused field low in the content (Tab, or the on-screen keyboard opening) is brought fully into view.\n onFocus={(event) => event.target.scrollIntoView({ block: \"nearest\" })}\n >\n {children}\n </div>\n {actions && (\n <div ref={footer} className=\"cy-dialog-actions cy-reset\">\n {actions}\n </div>\n )}\n </div>\n {toastHost && <div ref={toasts} className=\"cy-dialog-toasts\" />}\n </DialogBase>\n );\n}\n\n/**\n * Modal dialog in the top layer: focus moves in, stays in and comes back; Escape, the backdrop and the close button\n * dismiss it. In a container narrower than about 36rem it becomes a bottom sheet.\n */\nexport function Dialog(props: DialogProps) {\n return <DialogFrame {...props} />;\n}\n"],"mappings":";;;;;;;;;;AAwDA,IAAMa,IAA+B,EAAE,OAAO,QAAQ,GAChDC,IACJ;AAGF,SAASC,IAAiC;AACxC,MAAI,OAAO,WAAa,IAAa,QAAO;AAC5C,MAAIC,IAAS,SAAS;AACtB,SAAOA,GAAQ,YAAY,gBAAe,CAAAA,IAASA,EAAO,WAAW;AACrE,SAAOA;AACT;AAMA,SAASC,EAAUC,GAA4C;AAC7D,MAAI,CAACA,EAAI,QAAO;AAEhB,QAAMC,IAAUD,EAAG,QAAqB,eAAe;AAEvD,MAAI,EADWC,IAAU,CAACA,EAAQ,QAAQ,eAAe,I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AAkB,WAAU;AAAA,UACnC,UAAAT;AAAA,QACA,CAAA;AAAA,QAGL,gBAAAf,EAAC,OAAD;AAAA,UACE,KAAK+B;AAAA,UACL,WAAU;AAAA,UAEV,SAAA,CAAUK,MAAUA,EAAM,OAAO,eAAe,EAAE,OAAO,UAAU,CAAC;AAAA,UAEnE,UAAAb;AAAA,QACE,CAAA;AAAA,QACJP,KACC,gBAAAhB,EAAC,OAAD;AAAA,UAAK,KAAKgC;AAAA,UAAQ,WAAU;AAAA,UACzB,UAAAhB;AAAA,QACE,CAAA;AAAA,MAEJ;AAAA,IACJ,CAAA,GAAAa,KAAa,gBAAA7B,EAAC,OAAD;AAAA,MAAK,KAAK8B;AAAA,MAAQ,WAAU;AAAA,IAAoB,CAAA,CACpD;AAAA,E;AAEhB;AAMA,SAAgBO,EAAOC,GAAoB;AACzC,SAAO,gBAAAtC,EAACU,GAAD,EAAa,GAAI4B,EAAQ,CAAA;AAClC"}
|
|
1
|
+
{"version":3,"file":"Dialog.js","names":["closeIcon","useControllableState","useClientLayoutEffect","useDismiss","IconButton","DialogBase","close","ToastHostContext","useContext","useEffect","useId","useRef","useState","jsx","jsxs","DEFAULT_LABELS","FOCUSABLE","deepActive","active","reachable","el","popover","root","DialogFrame","open","defaultOpen","onOpenChange","title","description","actions","size","dismissible","keepMounted","labels","side","className","style","children","id","text","isOpen","setOpen","dialog","toastHost","toasts","body","footer","returnTo","wasOpen","dismiss","present","setPresent","unmount","longest","times","time","wait","ended","event","timer","mounted","Dialog","props"],"sources":["../../../src/components/Dialog/Dialog.tsx"],"sourcesContent":["import { type CSSProperties, type ReactNode, useContext, useEffect, useId, useRef, useState } from \"react\";\nimport { useClientLayoutEffect } from \"../../foundations/client-layout-effect.js\";\nimport { useControllableState } from \"../../foundations/controllable.js\";\nimport { DialogBase } from \"../../foundations/DialogBase/DialogBase.js\";\nimport { close as closeIcon } from \"../../icons/close.js\";\nimport { useDismiss } from \"../../overlay/dismiss.js\";\nimport { ToastHostContext } from \"../../overlay/toast-host.js\";\nimport type { Size } from \"../../tokens/schema.js\";\nimport { IconButton } from \"../IconButton/IconButton.js\";\n\nexport interface DialogTokens {\n radius: string;\n padding: string;\n widthSm: string;\n widthMd: string;\n widthLg: string;\n scrim: string;\n}\n\ndeclare module \"../../tokens/schema.js\" {\n interface ComponentTokens {\n dialog: DialogTokens;\n }\n}\n\nexport interface DialogLabels {\n /** Accessible name of the close button. */\n close: string;\n}\n\nexport interface DialogProps {\n /** Whether the dialog is open, when you control it. */\n open?: boolean;\n /** Open on first render when uncontrolled. */\n defaultOpen?: boolean;\n /** Called with `false` when the dialog closes itself: Escape, the backdrop or the close button. */\n onOpenChange?: (open: boolean) => void;\n /** Heading of the dialog; also its accessible name. */\n title: ReactNode;\n /** One or two sentences under the title; also its accessible description. */\n description?: ReactNode;\n /** Buttons along the bottom, outside the scrolling content (Cancel first, then the main action). */\n actions?: ReactNode;\n /** Width preset (the panel never grows wider than its container). */\n size?: Size;\n /** Escape, the backdrop and the close button close it (default). `false` leaves only your actions. */\n dismissible?: boolean;\n /**\n * Keep the content in the DOM while the dialog is closed. By default a closed dialog renders nothing inside it: the\n * content mounts when it opens and unmounts once the closing transition has ended, so every opening starts fresh.\n * Set it for content whose state must survive closing (a half-filled form) or that is expensive to rebuild.\n * Default false.\n */\n keepMounted?: boolean;\n /** Replace the built-in English text: the close button's name. */\n labels?: Partial<DialogLabels>;\n /** Added to the panel, for layout. */\n className?: string;\n /** Layout only, applied to the panel. Restyle through --cy-dialog-* tokens. */\n style?: CSSProperties;\n /** The content; it scrolls when it is taller than the dialog. */\n children?: ReactNode;\n}\n\n/** Internal: a Sheet is the same dialog docked to an edge. */\nexport interface DialogFrameProps extends DialogProps {\n side?: \"bottom\" | \"end\" | \"start\";\n}\n\nconst DEFAULT_LABELS: DialogLabels = { close: \"Close\" };\nconst FOCUSABLE =\n 'button:not([disabled]), [href], input:not([disabled]):not([type=\"hidden\"]):not([aria-hidden=\"true\"]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])';\n\n/** The focused element, looking inside shadow roots (document.activeElement stops at the host). */\nfunction deepActive(): HTMLElement | null {\n if (typeof document === \"undefined\") return null; // server render\n let active = document.activeElement;\n while (active?.shadowRoot?.activeElement) active = active.shadowRoot.activeElement;\n return active as HTMLElement | null;\n}\n\n/**\n * Where focus can actually go back to. A Dialog opened from a Menu item remembers that item, but the menu has closed\n * (hidden, still in the DOM): fall back to the button that controls the hidden popover.\n */\nfunction reachable(el: HTMLElement | null): HTMLElement | null {\n if (!el) return null;\n // A closed popover can still be fading out (displayed), so ask the popover, not only the layout.\n const popover = el.closest<HTMLElement>(\"[popover][id]\");\n const closed = popover ? !popover.matches(\":popover-open\") : el.checkVisibility?.() === false;\n if (!closed) return el;\n const root = el.getRootNode() as Document | ShadowRoot;\n return (popover && root.querySelector<HTMLElement>(`[aria-controls=\"${CSS.escape(popover.id)}\"]`)) ?? el;\n}\n\nexport function DialogFrame({\n open,\n defaultOpen = false,\n onOpenChange,\n title,\n description,\n actions,\n size = \"md\",\n dismissible = true,\n keepMounted = false,\n labels,\n side,\n className,\n style,\n children,\n}: DialogFrameProps) {\n const id = useId();\n const text = { ...DEFAULT_LABELS, ...labels };\n const [isOpen, setOpen] = useControllableState(open, defaultOpen, onOpenChange);\n const dialog = useRef<HTMLDialogElement>(null);\n const toastHost = useContext(ToastHostContext);\n const toasts = useRef<HTMLDivElement>(null);\n const body = useRef<HTMLDivElement>(null);\n const footer = useRef<HTMLDivElement>(null);\n const returnTo = useRef<HTMLElement | null>(null);\n const wasOpen = useRef(false);\n // Where focus was before opening: read while rendering, because DialogBase's showModal moves it first.\n if (isOpen && !wasOpen.current) returnTo.current = deepActive();\n wasOpen.current = isOpen;\n const dismiss = () => {\n if (dismissible) setOpen(false);\n };\n\n // The content is rendered while open, and after closing until the closing transition has ended. `present` goes true\n // in the render that opens the dialog, so the content is there before DialogBase shows it (no empty first frame).\n const [present, setPresent] = useState(isOpen);\n if (isOpen && !present) setPresent(true);\n useEffect(() => {\n if (isOpen || !present) return;\n const el = dialog.current as HTMLDialogElement;\n const unmount = () => setPresent(false);\n // Unmount when the dialog's own closing transition ends. The timer covers a transition that never reports back\n // (interrupted, or the dialog is not rendered) and is the whole wait when there is none: reduced motion, or no\n // stylesheet.\n const style = getComputedStyle(el);\n const longest = (times: string) => Math.max(...times.split(\",\").map((time) => Number.parseFloat(time)));\n const wait = (longest(style.transitionDuration) + longest(style.transitionDelay)) * 1000;\n const ended = (event: Event) => {\n if (event.target === el) unmount();\n };\n el.addEventListener(\"transitionend\", ended);\n const timer = setTimeout(unmount, wait && wait + 100);\n return () => {\n el.removeEventListener(\"transitionend\", ended);\n clearTimeout(timer);\n };\n }, [isOpen, present]);\n const mounted = isOpen || present || keepMounted;\n\n // On close, before useDismiss returns focus: make sure the remembered element can still take it.\n // Inside a Toaster, lend it a container while open: toasts raised now show above this dialog instead of under its\n // scrim, where the modal would make them inert. Runs after DialogBase has called showModal.\n useClientLayoutEffect(() => {\n if (!isOpen || !toastHost || !toasts.current) return;\n return toastHost.register(toasts.current);\n }, [isOpen, toastHost]);\n\n useClientLayoutEffect(() => {\n if (!isOpen) return;\n return () => {\n returnTo.current = reachable(returnTo.current);\n };\n }, [isOpen]);\n\n // DialogBase has opened it; move focus to the first control in the content, else the first action, else the\n // dialog itself (so the close button's tooltip does not pop up on open).\n useClientLayoutEffect(() => {\n if (!isOpen) return;\n const first =\n body.current?.querySelector<HTMLElement>(FOCUSABLE) ??\n footer.current?.querySelector<HTMLElement>(FOCUSABLE) ??\n dialog.current;\n first?.focus({ preventScroll: true });\n }, [isOpen]);\n\n useDismiss({\n open: isOpen,\n onClose: dismiss,\n inside: [dialog],\n returnFocus: returnTo,\n // The dialog fills its container; a pointer down on the dialog itself (not the panel) is on the backdrop.\n outside: (event) => event.composedPath()[0] === dialog.current,\n });\n\n return (\n <DialogBase\n ref={dialog}\n open={isOpen}\n onCancel={dismiss}\n onClose={() => setOpen(false)}\n className=\"cy-dialog\"\n tabIndex={-1}\n data-size={size}\n data-side={side}\n aria-labelledby={mounted ? `${id}-title` : undefined}\n aria-describedby={mounted && description ? `${id}-description` : undefined}\n >\n {mounted && (\n <div\n className={className ? `cy-dialog-panel cy-reset ${className}` : \"cy-dialog-panel cy-reset\"}\n style={style}\n >\n <div className=\"cy-dialog-header cy-reset\">\n <h2 id={`${id}-title`} className=\"cy-dialog-title cy-reset\">\n {title}\n </h2>\n {dismissible && (\n <IconButton\n icon={closeIcon}\n label={text.close}\n variant=\"ghost\"\n size=\"sm\"\n tooltipPlacement=\"bottom\"\n onClick={() => setOpen(false)}\n />\n )}\n </div>\n {description && (\n <p id={`${id}-description`} className=\"cy-dialog-description cy-reset\">\n {description}\n </p>\n )}\n {/* biome-ignore lint/a11y/noStaticElementInteractions: delegated focus listener for the controls inside */}\n <div\n ref={body}\n className=\"cy-dialog-body cy-reset\"\n // A focused field low in the content (Tab, or the on-screen keyboard opening) is brought fully into view.\n onFocus={(event) => event.target.scrollIntoView({ block: \"nearest\" })}\n >\n {children}\n </div>\n {actions && (\n <div ref={footer} className=\"cy-dialog-actions cy-reset\">\n {actions}\n </div>\n )}\n </div>\n )}\n {toastHost && mounted && <div ref={toasts} className=\"cy-dialog-toasts\" />}\n </DialogBase>\n );\n}\n\n/**\n * Modal dialog in the top layer: focus moves in, stays in and comes back; Escape, the backdrop and the close button\n * dismiss it. In a container narrower than about 36rem it becomes a bottom sheet. Its content is mounted only while\n * it is open (and while it closes), unless `keepMounted`.\n */\nexport function Dialog(props: DialogProps) {\n return <DialogFrame {...props} />;\n}\n"],"mappings":";;;;;;;;;;AAqEA,IAAMe,IAA+B,EAAE,OAAO,QAAQ,GAChDC,IACJ;AAGF,SAASC,KAAiC;AACxC,MAAI,OAAO,WAAa,IAAa,QAAO;AAC5C,MAAIC,IAAS,SAAS;AACtB,SAAOA,GAAQ,YAAY,gBAAe,CAAAA,IAASA,EAAO,WAAW;AACrE,SAAOA;AACT;AAMA,SAASC,GAAUC,GAA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AAC,OAAD;AAAA,UAAK,KAAKiC;AAAA,UAAQ,WAAU;AAAA,UACzB,UAAAjB;AAAA,QACE,CAAA;AAAA,MAEJ;AAAA,IAEN,CAAA,GAAAc,KAAaiB,KAAW,gBAAA/C,EAAC,OAAD;AAAA,MAAK,KAAK+B;AAAA,MAAQ,WAAU;AAAA,IAAoB,CAAA,CAC/D;AAAA,E;AAEhB;AAOA,SAAgBiB,GAAOC,GAAoB;AACzC,SAAO,gBAAAjD,EAACU,IAAD,EAAa,GAAIuC,EAAQ,CAAA;AAClC"}
|
|
@@ -13,11 +13,15 @@ declare module "../../tokens/schema.js" {
|
|
|
13
13
|
export interface DisclosureProps {
|
|
14
14
|
/** The always-visible trigger text. */
|
|
15
15
|
summary: ReactNode;
|
|
16
|
+
/** Whether the content is shown, when you control it. */
|
|
16
17
|
open?: boolean;
|
|
18
|
+
/** Shown on first render when uncontrolled. */
|
|
17
19
|
defaultOpen?: boolean;
|
|
20
|
+
/** Called with the new state when the trigger is pressed. */
|
|
18
21
|
onOpenChange?: (open: boolean) => void;
|
|
19
22
|
/** `plain` no chrome, `line` bottom divider, `card` bordered surface. */
|
|
20
23
|
variant?: "plain" | "line" | "card";
|
|
24
|
+
/** Height of the trigger and size of the text. Default "md". */
|
|
21
25
|
size?: Size;
|
|
22
26
|
/** Wrap the trigger in a heading of this level (accordion sections in a document outline). */
|
|
23
27
|
headingLevel?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
@@ -27,10 +31,13 @@ export interface DisclosureProps {
|
|
|
27
31
|
locked?: boolean;
|
|
28
32
|
/** Keyboard handler on the trigger (Accordion uses it for arrow navigation). */
|
|
29
33
|
onTriggerKeyDown?: (event: KeyboardEvent<HTMLButtonElement>) => void;
|
|
34
|
+
/** Added to the root element, for layout. */
|
|
30
35
|
className?: string;
|
|
31
36
|
/** Layout only. */
|
|
32
37
|
style?: CSSProperties;
|
|
38
|
+
/** The content that is shown and hidden. */
|
|
33
39
|
children?: ReactNode;
|
|
40
|
+
/** Set on the root element, for tests. */
|
|
34
41
|
"data-testid"?: string;
|
|
35
42
|
}
|
|
36
43
|
/** Show and hide a section behind a button. Replaces native <details> with an animated, themeable version. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Disclosure.js","names":["useControllableState","ButtonBase","Icon","chevronDown","useId","jsx","jsxs","Disclosure","summary","open","defaultOpen","onOpenChange","variant","size","headingLevel","region","locked","onTriggerKeyDown","className","style","children","rest","id","isOpen","setOpen","toggle","trigger","Heading"],"sources":["../../../src/components/Disclosure/Disclosure.tsx"],"sourcesContent":["import { type CSSProperties, type KeyboardEvent, type ReactNode, useId } from \"react\";\nimport { ButtonBase } from \"../../foundations/ButtonBase/ButtonBase.js\";\nimport { useControllableState } from \"../../foundations/controllable.js\";\nimport { Icon } from \"../../foundations/Icon/Icon.js\";\nimport { chevronDown } from \"../../icons/chevron-down.js\";\nimport type { Size } from \"../../tokens/schema.js\";\n\nexport interface DisclosureTokens {\n gap: string;\n radius: string;\n paddingInline: string;\n}\n\ndeclare module \"../../tokens/schema.js\" {\n interface ComponentTokens {\n disclosure: DisclosureTokens;\n }\n}\n\nexport interface DisclosureProps {\n /** The always-visible trigger text. */\n summary: ReactNode;\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?: (open: boolean) => void;\n /** `plain` no chrome, `line` bottom divider, `card` bordered surface. */\n variant?: \"plain\" | \"line\" | \"card\";\n size?: Size;\n /** Wrap the trigger in a heading of this level (accordion sections in a document outline). */\n headingLevel?: 1 | 2 | 3 | 4 | 5 | 6;\n /** Expose the content as a labelled region (for a few large sections). */\n region?: boolean;\n /** The trigger cannot close the content right now (non-collapsible accordion). Sets aria-disabled. */\n locked?: boolean;\n /** Keyboard handler on the trigger (Accordion uses it for arrow navigation). */\n onTriggerKeyDown?: (event: KeyboardEvent<HTMLButtonElement>) => void;\n className?: string;\n /** Layout only. */\n style?: CSSProperties;\n children?: ReactNode;\n \"data-testid\"?: string;\n}\n\n/** Show and hide a section behind a button. Replaces native <details> with an animated, themeable version. */\nexport function Disclosure({\n summary,\n open,\n defaultOpen = false,\n onOpenChange,\n variant = \"plain\",\n size = \"md\",\n headingLevel,\n region = false,\n locked = false,\n onTriggerKeyDown,\n className,\n style,\n children,\n ...rest\n}: DisclosureProps) {\n const id = useId();\n const [isOpen, setOpen] = useControllableState(open, defaultOpen, onOpenChange);\n const toggle = () => {\n if (locked) return;\n setOpen(!isOpen);\n };\n const trigger = (\n <ButtonBase\n id={`${id}-trigger`}\n className=\"cy-disclosure-trigger\"\n aria-expanded={isOpen}\n aria-controls={`${id}-content`}\n aria-disabled={locked || undefined}\n onClick={toggle}\n onKeyDown={onTriggerKeyDown}\n >\n <span className=\"cy-disclosure-summary\">{summary}</span>\n <Icon icon={chevronDown} className=\"cy-disclosure-chevron\" />\n </ButtonBase>\n );\n const Heading = headingLevel ? (`h${headingLevel}` as const) : null;\n return (\n <div\n {...rest}\n className={className ? `cy-disclosure ${className}` : \"cy-disclosure\"}\n data-variant={variant}\n data-size={size}\n data-open={isOpen ? \"\" : undefined}\n style={style}\n >\n {Heading ? <Heading className=\"cy-disclosure-heading\">{trigger}</Heading> : trigger}\n <div\n id={`${id}-content`}\n className=\"cy-disclosure-content\"\n {...(region ? { role: \"region\", \"aria-labelledby\": `${id}-trigger` } : {})}\n >\n <div className=\"cy-disclosure-clip\">\n <div className=\"cy-disclosure-body\">{children}</div>\n </div>\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"Disclosure.js","names":["useControllableState","ButtonBase","Icon","chevronDown","useId","jsx","jsxs","Disclosure","summary","open","defaultOpen","onOpenChange","variant","size","headingLevel","region","locked","onTriggerKeyDown","className","style","children","rest","id","isOpen","setOpen","toggle","trigger","Heading"],"sources":["../../../src/components/Disclosure/Disclosure.tsx"],"sourcesContent":["import { type CSSProperties, type KeyboardEvent, type ReactNode, useId } from \"react\";\nimport { ButtonBase } from \"../../foundations/ButtonBase/ButtonBase.js\";\nimport { useControllableState } from \"../../foundations/controllable.js\";\nimport { Icon } from \"../../foundations/Icon/Icon.js\";\nimport { chevronDown } from \"../../icons/chevron-down.js\";\nimport type { Size } from \"../../tokens/schema.js\";\n\nexport interface DisclosureTokens {\n gap: string;\n radius: string;\n paddingInline: string;\n}\n\ndeclare module \"../../tokens/schema.js\" {\n interface ComponentTokens {\n disclosure: DisclosureTokens;\n }\n}\n\nexport interface DisclosureProps {\n /** The always-visible trigger text. */\n summary: ReactNode;\n /** Whether the content is shown, when you control it. */\n open?: boolean;\n /** Shown on first render when uncontrolled. */\n defaultOpen?: boolean;\n /** Called with the new state when the trigger is pressed. */\n onOpenChange?: (open: boolean) => void;\n /** `plain` no chrome, `line` bottom divider, `card` bordered surface. */\n variant?: \"plain\" | \"line\" | \"card\";\n /** Height of the trigger and size of the text. Default \"md\". */\n size?: Size;\n /** Wrap the trigger in a heading of this level (accordion sections in a document outline). */\n headingLevel?: 1 | 2 | 3 | 4 | 5 | 6;\n /** Expose the content as a labelled region (for a few large sections). */\n region?: boolean;\n /** The trigger cannot close the content right now (non-collapsible accordion). Sets aria-disabled. */\n locked?: boolean;\n /** Keyboard handler on the trigger (Accordion uses it for arrow navigation). */\n onTriggerKeyDown?: (event: KeyboardEvent<HTMLButtonElement>) => void;\n /** Added to the root element, for layout. */\n className?: string;\n /** Layout only. */\n style?: CSSProperties;\n /** The content that is shown and hidden. */\n children?: ReactNode;\n /** Set on the root element, for tests. */\n \"data-testid\"?: string;\n}\n\n/** Show and hide a section behind a button. Replaces native <details> with an animated, themeable version. */\nexport function Disclosure({\n summary,\n open,\n defaultOpen = false,\n onOpenChange,\n variant = \"plain\",\n size = \"md\",\n headingLevel,\n region = false,\n locked = false,\n onTriggerKeyDown,\n className,\n style,\n children,\n ...rest\n}: DisclosureProps) {\n const id = useId();\n const [isOpen, setOpen] = useControllableState(open, defaultOpen, onOpenChange);\n const toggle = () => {\n if (locked) return;\n setOpen(!isOpen);\n };\n const trigger = (\n <ButtonBase\n id={`${id}-trigger`}\n className=\"cy-disclosure-trigger\"\n aria-expanded={isOpen}\n aria-controls={`${id}-content`}\n aria-disabled={locked || undefined}\n onClick={toggle}\n onKeyDown={onTriggerKeyDown}\n >\n <span className=\"cy-disclosure-summary\">{summary}</span>\n <Icon icon={chevronDown} className=\"cy-disclosure-chevron\" />\n </ButtonBase>\n );\n const Heading = headingLevel ? (`h${headingLevel}` as const) : null;\n return (\n <div\n {...rest}\n className={className ? `cy-disclosure ${className}` : \"cy-disclosure\"}\n data-variant={variant}\n data-size={size}\n data-open={isOpen ? \"\" : undefined}\n style={style}\n >\n {Heading ? <Heading className=\"cy-disclosure-heading\">{trigger}</Heading> : trigger}\n <div\n id={`${id}-content`}\n className=\"cy-disclosure-content\"\n {...(region ? { role: \"region\", \"aria-labelledby\": `${id}-trigger` } : {})}\n >\n <div className=\"cy-disclosure-clip\">\n <div className=\"cy-disclosure-body\">{children}</div>\n </div>\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;AAmDA,SAAgBO,EAAW,EACzB,SAAAC,GACA,MAAAC,GACA,aAAAC,IAAc,IACd,cAAAC,GACA,SAAAC,IAAU,SACV,MAAAC,IAAO,MACP,cAAAC,GACA,QAAAC,IAAS,IACT,QAAAC,IAAS,IACT,kBAAAC,GACA,WAAAC,GACA,OAAAC,GACA,UAAAC,GACA,GAAGC,EAAA,GACe;AAClB,QAAMC,IAAKlB,EAAM,GACX,CAACmB,GAAQC,CAAA,IAAWxB,EAAqBS,GAAMC,GAAaC,CAAY,GACxEc,IAAA,MAAe;AACnB,IAAIT,KACJQ,EAAQ,CAACD,CAAM;AAAA,EACjB,GACMG,IACJ,gBAAApB,EAACL,GAAD;AAAA,IACE,IAAI,GAAGqB,CAAA;AAAA,IACP,WAAU;AAAA,IACV,iBAAeC;AAAA,IACf,iBAAe,GAAGD,CAAA;AAAA,IAClB,iBAAeN,KAAU;AAAA,IACzB,SAASS;AAAA,IACT,WAAWR;AAAA,IAPb,UAAA,CASE,gBAAAZ,EAAC,QAAD;AAAA,MAAM,WAAU;AAAA,MAAyB,UAAAG;AAAA,IAAc,CAAA,GACvD,gBAAAH,EAACH,GAAD;AAAA,MAAM,MAAMC;AAAA,MAAa,WAAU;AAAA,IAAyB,CAAA,CAClD;AAAA,E,IAERwB,IAAUb,IAAgB,IAAIA,CAAA,KAA2B;AAC/D,SACE,gBAAAR,EAAC,OAAD;AAAA,IACE,GAAIe;AAAA,IACJ,WAAWH,IAAY,iBAAiBA,CAAA,KAAc;AAAA,IACtD,gBAAcN;AAAA,IACd,aAAWC;AAAA,IACX,aAAWU,IAAS,KAAK;AAAA,IAClB,OAAAJ;AAAA,IANT,UAAA,CAQGQ,IAAU,gBAAAtB,EAACsB,GAAD;AAAA,MAAS,WAAU;AAAA,MAAyB,UAAAD;AAAA,IAAiB,CAAA,IAAIA,GAC5E,gBAAArB,EAAC,OAAD;AAAA,MACE,IAAI,GAAGiB,CAAA;AAAA,MACP,WAAU;AAAA,MACV,GAAKP,IAAS;AAAA,QAAE,MAAM;AAAA,QAAU,mBAAmB,GAAGO,CAAA;AAAA,MAAa,IAAI,CAAC;AAAA,MAExE,UAAA,gBAAAjB,EAAC,OAAD;AAAA,QAAK,WAAU;AAAA,QACb,UAAA,gBAAAA,EAAC,OAAD;AAAA,UAAK,WAAU;AAAA,UAAsB,UAAAe;AAAA,QAAc,CAAA;AAAA,MAChD,CAAA;AAAA,IACF,CAAA,CACF;AAAA,E;AAET"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { type CSSProperties, type ReactNode } from "react";
|
|
2
|
+
export interface DividerTokens {
|
|
3
|
+
/** Thickness of the line. */
|
|
4
|
+
thickness: string;
|
|
5
|
+
/** Line colour of the neutral tone. */
|
|
6
|
+
color: string;
|
|
7
|
+
/** Line colour of the strong tone. */
|
|
8
|
+
colorStrong: string;
|
|
9
|
+
/** Space between the label and the line on each side of it. */
|
|
10
|
+
labelGap: string;
|
|
11
|
+
/** Text colour of the label. */
|
|
12
|
+
labelColor: string;
|
|
13
|
+
/** Text size of the label. */
|
|
14
|
+
labelSize: string;
|
|
15
|
+
/** Space around the line with `spacing="sm"`. */
|
|
16
|
+
spacingSm: string;
|
|
17
|
+
/** Space around the line with `spacing="md"`. */
|
|
18
|
+
spacingMd: string;
|
|
19
|
+
/** Space around the line with `spacing="lg"`. */
|
|
20
|
+
spacingLg: string;
|
|
21
|
+
}
|
|
22
|
+
declare module "../../tokens/schema.js" {
|
|
23
|
+
interface ComponentTokens {
|
|
24
|
+
divider: DividerTokens;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
export interface DividerProps {
|
|
28
|
+
/**
|
|
29
|
+
* Direction of the line. A horizontal divider fills the width of its container; a vertical one stretches to the
|
|
30
|
+
* height of its flex row (Inline, Toolbar). Default "horizontal".
|
|
31
|
+
*/
|
|
32
|
+
orientation?: "horizontal" | "vertical";
|
|
33
|
+
/** Line style. Default "solid". */
|
|
34
|
+
variant?: "solid" | "dashed";
|
|
35
|
+
/** Line colour: the quiet line colour, or a stronger one for emphasis. Default "neutral". */
|
|
36
|
+
tone?: "neutral" | "strong";
|
|
37
|
+
/**
|
|
38
|
+
* Space around the line along the flow: above and below a horizontal divider, before and after a vertical one.
|
|
39
|
+
* Stack and Inline gaps usually provide it. Default "none".
|
|
40
|
+
*/
|
|
41
|
+
spacing?: "none" | "sm" | "md" | "lg";
|
|
42
|
+
/** Where the label sits along a horizontal line (follows the text direction). Default "center". */
|
|
43
|
+
labelAlign?: "start" | "center" | "end";
|
|
44
|
+
/**
|
|
45
|
+
* Purely visual: not exposed as a separator. With `false` it has `role="separator"` and its label is its
|
|
46
|
+
* accessible name. Default true.
|
|
47
|
+
*/
|
|
48
|
+
decorative?: boolean;
|
|
49
|
+
/** Added to the root element, for layout. */
|
|
50
|
+
className?: string;
|
|
51
|
+
/** Layout only. Restyle through `--cy-divider-*` tokens. */
|
|
52
|
+
style?: CSSProperties;
|
|
53
|
+
/** A short label drawn in the line ("or"). Horizontal only: a vertical divider ignores it. */
|
|
54
|
+
children?: ReactNode;
|
|
55
|
+
/** Set on the root element, to find it in tests. */
|
|
56
|
+
"data-testid"?: string;
|
|
57
|
+
}
|
|
58
|
+
/** A line that separates content, horizontal or vertical, with an optional label in the middle. */
|
|
59
|
+
export declare const Divider: import("react").ForwardRefExoticComponent<DividerProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { forwardRef as f, useId as p } from "react";
|
|
3
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
4
|
+
var $ = f(function({ orientation: t = "horizontal", variant: n = "solid", tone: d = "neutral", spacing: s = "none", labelAlign: c = "center", decorative: v = !0, className: i, style: m, children: a, ...u }, b) {
|
|
5
|
+
const r = p(), o = t === "vertical", e = !o && a != null && a !== !1 && a !== "";
|
|
6
|
+
return /* @__PURE__ */ l("div", {
|
|
7
|
+
ref: b,
|
|
8
|
+
...u,
|
|
9
|
+
...v ? { role: "none" } : {
|
|
10
|
+
role: "separator",
|
|
11
|
+
"aria-orientation": o ? "vertical" : void 0,
|
|
12
|
+
"aria-labelledby": e ? r : void 0
|
|
13
|
+
},
|
|
14
|
+
className: `cy-divider${i ? ` ${i}` : ""}`,
|
|
15
|
+
"data-orientation": t,
|
|
16
|
+
"data-variant": n,
|
|
17
|
+
"data-tone": d,
|
|
18
|
+
"data-spacing": s,
|
|
19
|
+
"data-label": e ? c : void 0,
|
|
20
|
+
style: m,
|
|
21
|
+
children: e && /* @__PURE__ */ l("span", {
|
|
22
|
+
id: r,
|
|
23
|
+
className: "cy-reset cy-divider-label",
|
|
24
|
+
children: a
|
|
25
|
+
})
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
export {
|
|
29
|
+
$ as Divider
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
//# sourceMappingURL=Divider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Divider.js","names":["forwardRef","useId","jsx","Divider","orientation","variant","tone","spacing","labelAlign","decorative","className","style","children","rest","ref","labelId","vertical","labelled"],"sources":["../../../src/components/Divider/Divider.tsx"],"sourcesContent":["import { type CSSProperties, forwardRef, type ReactNode, useId } from \"react\";\n\nexport interface DividerTokens {\n /** Thickness of the line. */\n thickness: string;\n /** Line colour of the neutral tone. */\n color: string;\n /** Line colour of the strong tone. */\n colorStrong: string;\n /** Space between the label and the line on each side of it. */\n labelGap: string;\n /** Text colour of the label. */\n labelColor: string;\n /** Text size of the label. */\n labelSize: string;\n /** Space around the line with `spacing=\"sm\"`. */\n spacingSm: string;\n /** Space around the line with `spacing=\"md\"`. */\n spacingMd: string;\n /** Space around the line with `spacing=\"lg\"`. */\n spacingLg: string;\n}\n\ndeclare module \"../../tokens/schema.js\" {\n interface ComponentTokens {\n divider: DividerTokens;\n }\n}\n\nexport interface DividerProps {\n /**\n * Direction of the line. A horizontal divider fills the width of its container; a vertical one stretches to the\n * height of its flex row (Inline, Toolbar). Default \"horizontal\".\n */\n orientation?: \"horizontal\" | \"vertical\";\n /** Line style. Default \"solid\". */\n variant?: \"solid\" | \"dashed\";\n /** Line colour: the quiet line colour, or a stronger one for emphasis. Default \"neutral\". */\n tone?: \"neutral\" | \"strong\";\n /**\n * Space around the line along the flow: above and below a horizontal divider, before and after a vertical one.\n * Stack and Inline gaps usually provide it. Default \"none\".\n */\n spacing?: \"none\" | \"sm\" | \"md\" | \"lg\";\n /** Where the label sits along a horizontal line (follows the text direction). Default \"center\". */\n labelAlign?: \"start\" | \"center\" | \"end\";\n /**\n * Purely visual: not exposed as a separator. With `false` it has `role=\"separator\"` and its label is its\n * accessible name. Default true.\n */\n decorative?: boolean;\n /** Added to the root element, for layout. */\n className?: string;\n /** Layout only. Restyle through `--cy-divider-*` tokens. */\n style?: CSSProperties;\n /** A short label drawn in the line (\"or\"). Horizontal only: a vertical divider ignores it. */\n children?: ReactNode;\n /** Set on the root element, to find it in tests. */\n \"data-testid\"?: string;\n}\n\n/** A line that separates content, horizontal or vertical, with an optional label in the middle. */\nexport const Divider = forwardRef<HTMLDivElement, DividerProps>(function Divider(\n {\n orientation = \"horizontal\",\n variant = \"solid\",\n tone = \"neutral\",\n spacing = \"none\",\n labelAlign = \"center\",\n decorative = true,\n className,\n style,\n children,\n ...rest\n },\n ref,\n) {\n const labelId = useId();\n const vertical = orientation === \"vertical\";\n const labelled = !vertical && children != null && children !== false && children !== \"\";\n // A separator's content is presentational, so its label is given as its name. Horizontal is the role's default\n // orientation, so only vertical is stated.\n const semantics = decorative\n ? ({ role: \"none\" } as const)\n : ({\n role: \"separator\",\n \"aria-orientation\": vertical ? \"vertical\" : undefined,\n \"aria-labelledby\": labelled ? labelId : undefined,\n } as const);\n return (\n <div\n ref={ref}\n {...rest}\n {...semantics}\n className={`cy-divider${className ? ` ${className}` : \"\"}`}\n data-orientation={orientation}\n data-variant={variant}\n data-tone={tone}\n data-spacing={spacing}\n data-label={labelled ? labelAlign : undefined}\n style={style}\n >\n {labelled && (\n <span id={labelId} className=\"cy-reset cy-divider-label\">\n {children}\n </span>\n )}\n </div>\n );\n});\n"],"mappings":";;;AA8DA,IAAaG,IAAUH,EAAyC,SAC9D,EACE,aAAAI,IAAc,cACd,SAAAC,IAAU,SACV,MAAAC,IAAO,WACP,SAAAC,IAAU,QACV,YAAAC,IAAa,UACb,YAAAC,IAAa,IACb,WAAAC,GACA,OAAAC,GACA,UAAAC,GACA,GAAGC,EAAA,GAELC,GACA;AACA,QAAMC,IAAUd,EAAM,GAChBe,IAAWZ,MAAgB,YAC3Ba,IAAW,CAACD,KAAYJ,KAAY,QAAQA,MAAa,MAASA,MAAa;AAUrF,SACE,gBAAAV,EAAC,OAAD;AAAA,IACO,KAAAY;AAAA,IACL,GAAID;AAAA,IACJ,GAXcJ,IACb,EAAE,MAAM,OAAO,IACf;AAAA,MACC,MAAM;AAAA,MACN,oBAAoBO,IAAW,aAAa;AAAA,MAC5C,mBAAmBC,IAAWF,IAAU;AAAA,IAC1C;AAAA,IAMA,WAAW,aAAaL,IAAY,IAAIA,CAAA,KAAc,EAAA;AAAA,IACtD,oBAAkBN;AAAA,IAClB,gBAAcC;AAAA,IACd,aAAWC;AAAA,IACX,gBAAcC;AAAA,IACd,cAAYU,IAAWT,IAAa;AAAA,IAC7B,OAAAG;AAAA,IAEN,UAAAM,KACC,gBAAAf,EAAC,QAAD;AAAA,MAAM,IAAIa;AAAA,MAAS,WAAU;AAAA,MAC1B,UAAAH;AAAA,IACG,CAAA;AAAA,EAEL,CAAA;AAET,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Divider, type DividerProps, type DividerTokens } from "./Divider.js";
|
|
@@ -27,7 +27,9 @@ export interface PageRect {
|
|
|
27
27
|
height: number;
|
|
28
28
|
}
|
|
29
29
|
export interface RenderPageProps {
|
|
30
|
+
/** The page's `id` from `pages`. */
|
|
30
31
|
id: string;
|
|
32
|
+
/** Position of the page in `pages`, from 0. */
|
|
31
33
|
index: number;
|
|
32
34
|
/** 1 = 100%. Draw at `width` by `height` times `scale`. */
|
|
33
35
|
scale: number;
|
|
@@ -53,12 +55,15 @@ export interface DocumentViewportLabels {
|
|
|
53
55
|
export interface DocumentViewportProps {
|
|
54
56
|
/** Names the viewport ("Document", "Contract.pdf"). */
|
|
55
57
|
label: string;
|
|
58
|
+
/** The pages, top to bottom, each with its size at 100%. */
|
|
56
59
|
pages: readonly ViewportPage[];
|
|
60
|
+
/** The zoom setting, when you control it: fit width, fit page or a percent. */
|
|
57
61
|
zoom?: ZoomSetting | undefined;
|
|
58
62
|
/** Default fit-width. */
|
|
59
63
|
defaultZoom?: ZoomSetting;
|
|
60
64
|
/** Gestures and keys ask for a percent. */
|
|
61
65
|
onZoomChange?: ((zoom: ZoomSetting) => void) | undefined;
|
|
66
|
+
/** Draws one page. Called for each page in or near the view. */
|
|
62
67
|
renderPage: (page: RenderPageProps) => ReactNode;
|
|
63
68
|
/** The pages in view, top to bottom. */
|
|
64
69
|
onVisiblePagesChange?: ((ids: string[]) => void) | undefined;
|
|
@@ -66,8 +71,11 @@ export interface DocumentViewportProps {
|
|
|
66
71
|
onCurrentPageChange?: ((id: string | null) => void) | undefined;
|
|
67
72
|
/** The scale the zoom came to (fit modes depend on the viewport). */
|
|
68
73
|
onScaleChange?: ((scale: number) => void) | undefined;
|
|
74
|
+
/** Scrolls to a page, or to a rect on it. A new `nonce` scrolls again. */
|
|
69
75
|
scrollTo?: ScrollRequest | undefined;
|
|
76
|
+
/** Replace the built-in English text: page names and the zoom announcement. */
|
|
70
77
|
labels?: Partial<DocumentViewportLabels>;
|
|
78
|
+
/** Added to the scrolling root element, for layout. */
|
|
71
79
|
className?: string;
|
|
72
80
|
/** Layout only (give it a height). Restyle through --cy-document-viewport-* tokens. */
|
|
73
81
|
style?: CSSProperties;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DocumentViewport.js","names":["_Fragment","useControllableState","useClientLayoutEffect","useVirtualWindow","anchoredScroll","zoomScale","useZoomGestures","useEffect","useRef","useState","Fragment$1","jsx","jsxs","DEFAULT_LABELS","n","total","percent","useReport","value","key","callback","latest","last","DocumentViewport","label","pages","zoom","defaultZoom","onZoomChange","renderPage","onVisiblePagesChange","onCurrentPageChange","onScaleChange","scrollTo","labels","className","style","text","scroller","setting","setSetting","gap","setGap","g","sizesAt","scale","p","setScale","win","next","scrollLeft","setScrollLeft","widest","contentWidth","anchor","gestures","at","lastScale","el","a","to","top","height","view","placed","i","page","w","h","x","y","l","t","r","b","rect","inView","current","best","lastNonce","pendingFocus","id","slot","said","setSaid","e"],"sources":["../../../src/components/DocumentViewport/DocumentViewport.tsx"],"sourcesContent":["import { type CSSProperties, type ReactNode, useEffect, useRef, useState } from \"react\";\nimport { useClientLayoutEffect } from \"../../foundations/client-layout-effect.js\";\nimport { useControllableState } from \"../../foundations/controllable.js\";\nimport { useVirtualWindow } from \"../../foundations/virtual-window.js\";\nimport { anchoredScroll, type ZoomSetting, zoomScale } from \"../../foundations/zoom.js\";\nimport { useZoomGestures, type ZoomAnchor } from \"../../foundations/zoom-gestures.js\";\n\nexport type { ZoomSetting };\n\nexport interface DocumentViewportTokens {\n /** Behind the pages. */\n background: string;\n /** Space between and around pages. */\n gap: string;\n /** A page's shadow. */\n pageShadow: string;\n}\n\ndeclare module \"../../tokens/schema.js\" {\n interface ComponentTokens {\n documentViewport: DocumentViewportTokens;\n }\n}\n\nexport interface ViewportPage {\n id: string;\n /** Size at 100%, in CSS pixels (a PDF point is one). */\n width: number;\n height: number;\n}\n\nexport interface PageRect {\n left: number;\n top: number;\n width: number;\n height: number;\n}\n\nexport interface RenderPageProps {\n id: string;\n index: number;\n /** 1 = 100%. Draw at `width` by `height` times `scale`. */\n scale: number;\n /** In view now (pages just outside are rendered too, so scrolling is seamless). */\n visible: boolean;\n /** The part of the page in view, in its own scaled pixels; null when none is. Render only that, for huge pages. */\n visibleRect: PageRect | null;\n}\n\n/** Scroll to a page, or to a rect on it (centred), at 100% units. A new `nonce` scrolls again. */\nexport interface ScrollRequest {\n id: string;\n nonce: number;\n rect?: PageRect;\n /** Move focus to the page afterwards (go-to-page). */\n focus?: boolean;\n}\n\nexport interface DocumentViewportLabels {\n /** A page's name. Default \"Page 3 of 12\". */\n page: (number: number, total: number) => string;\n /** Announced when the zoom changes. Default \"Zoom 125%\". */\n zoom: (percent: number) => string;\n}\n\nexport interface DocumentViewportProps {\n /** Names the viewport (\"Document\", \"Contract.pdf\"). */\n label: string;\n pages: readonly ViewportPage[];\n zoom?: ZoomSetting | undefined;\n /** Default fit-width. */\n defaultZoom?: ZoomSetting;\n /** Gestures and keys ask for a percent. */\n onZoomChange?: ((zoom: ZoomSetting) => void) | undefined;\n renderPage: (page: RenderPageProps) => ReactNode;\n /** The pages in view, top to bottom. */\n onVisiblePagesChange?: ((ids: string[]) => void) | undefined;\n /** The page with the most of itself in view. */\n onCurrentPageChange?: ((id: string | null) => void) | undefined;\n /** The scale the zoom came to (fit modes depend on the viewport). */\n onScaleChange?: ((scale: number) => void) | undefined;\n scrollTo?: ScrollRequest | undefined;\n labels?: Partial<DocumentViewportLabels>;\n className?: string;\n /** Layout only (give it a height). Restyle through --cy-document-viewport-* tokens. */\n style?: CSSProperties;\n}\n\nconst DEFAULT_LABELS: DocumentViewportLabels = {\n page: (n, total) => `Page ${n} of ${total}`,\n zoom: (percent) => `Zoom ${percent}%`,\n};\n\n/** Calls the latest `callback` with `value` whenever `value` (compared by `key`) changes. */\nfunction useReport<T>(value: T, key: string, callback: ((v: T) => void) | undefined) {\n const latest = useRef(callback);\n latest.current = callback;\n const last = useRef<string | null>(null);\n useEffect(() => {\n if (last.current === key) return;\n last.current = key;\n latest.current?.(value);\n });\n}\n\n/**\n * A scrolling, zoomable document: pages one under another, only those near the view rendered, zoomed by setting\n * (fit width, fit page, a percent), Ctrl/Cmd+wheel or a pinch around the pointer, panned with Space+drag. It reports\n * the pages in view and the current page, scrolls to a page or a spot on it on request, and announces zoom changes.\n */\nexport function DocumentViewport({\n label,\n pages,\n zoom,\n defaultZoom = { kind: \"fit-width\" },\n onZoomChange,\n renderPage,\n onVisiblePagesChange,\n onCurrentPageChange,\n onScaleChange,\n scrollTo,\n labels,\n className,\n style,\n}: DocumentViewportProps) {\n const text = { ...DEFAULT_LABELS, ...labels };\n const scroller = useRef<HTMLElement>(null);\n const [setting, setSetting] = useControllableState(zoom, defaultZoom, onZoomChange);\n // The gap comes from the token, in pixels, for the layout maths.\n const [gap, setGap] = useState(16);\n useClientLayoutEffect(() => {\n const g = Number.parseFloat(getComputedStyle(scroller.current as HTMLElement).getPropertyValue(\"--_gap\"));\n if (g !== gap) setGap(g);\n });\n\n // The viewport's size feeds the fit modes; the windowing measures it.\n const sizesAt = (scale: number) => pages.map((p) => p.height * scale);\n const [scale, setScale] = useState(1);\n const win = useVirtualWindow(scroller, { count: pages.length, sizes: sizesAt(scale), gap, overscan: 1 });\n const next = zoomScale(setting, pages, win.view, gap);\n if (next !== scale) setScale(next);\n const percent = Math.round(scale * 100);\n\n const [scrollLeft, setScrollLeft] = useState(0);\n const widest = Math.max(0, ...pages.map((p) => p.width * scale));\n const contentWidth = Math.max(win.view.width, widest + 2 * gap);\n\n // Zooming keeps the point under the pointer (or the viewport's centre) where it is.\n const anchor = useRef<{ at: { x: number; y: number }; from: number } | null>(null);\n const gestures = useZoomGestures(scroller, {\n percent,\n onZoom: (value, at: ZoomAnchor) => {\n anchor.current = { at: at ?? { x: win.view.width / 2, y: win.view.height / 2 }, from: scale };\n setSetting({ kind: \"percent\", value });\n },\n });\n const lastScale = useRef(scale);\n useClientLayoutEffect(() => {\n const el = scroller.current as HTMLElement;\n if (lastScale.current === scale) return;\n const a = anchor.current ?? {\n at: { x: el.clientWidth / 2, y: el.clientHeight / 2 },\n from: lastScale.current,\n };\n anchor.current = null;\n lastScale.current = scale;\n const to = anchoredScroll({ left: el.scrollLeft, top: el.scrollTop }, a.at, scale / a.from);\n el.scrollLeft = to.left;\n el.scrollTop = to.top;\n win.onScroll(el.scrollTop);\n setScrollLeft(el.scrollLeft);\n });\n\n // In view: which pages, and how much of each.\n const { top, height } = win.view;\n const view = { left: scrollLeft, right: scrollLeft + win.view.width, top, bottom: top + height };\n const placed = win.indices.map((i) => {\n const page = pages[i] as ViewportPage;\n const w = page.width * scale;\n const h = page.height * scale;\n const x = (contentWidth - w) / 2;\n const y = win.offsetOf(i);\n const l = Math.max(0, view.left - x);\n const t = Math.max(0, view.top - y);\n const r = Math.min(w, view.right - x);\n const b = Math.min(h, view.bottom - y);\n const rect = height > 0 && r > l && b > t ? { left: l, top: t, width: r - l, height: b - t } : null;\n return { page, i, w, h, x, y, rect, area: rect ? rect.width * rect.height : 0 };\n });\n const inView = placed.filter((p) => p.rect).sort((a, b) => a.i - b.i);\n const current = inView.reduce<(typeof placed)[number] | null>(\n (best, p) => (!best || p.area > best.area ? p : best),\n null,\n );\n useReport(\n inView.map((p) => p.page.id),\n inView.map((p) => p.page.id).join(\" \"),\n onVisiblePagesChange,\n );\n useReport(current?.page.id ?? null, current?.page.id ?? \"\", onCurrentPageChange);\n useReport(scale, String(scale), onScaleChange);\n\n // Scroll requests: only a new nonce scrolls; focus waits for the page to be rendered there.\n const lastNonce = useRef<number | null>(null);\n const pendingFocus = useRef<string | null>(null);\n useClientLayoutEffect(() => {\n const el = scroller.current as HTMLElement;\n if (!scrollTo || scrollTo.nonce === lastNonce.current) return;\n const i = pages.findIndex((p) => p.id === scrollTo.id);\n if (i < 0) return;\n lastNonce.current = scrollTo.nonce;\n const page = pages[i] as ViewportPage;\n const { rect } = scrollTo;\n if (rect) {\n el.scrollTop = win.offsetOf(i) + rect.top * scale - (el.clientHeight - rect.height * scale) / 2;\n el.scrollLeft =\n (contentWidth - page.width * scale) / 2 +\n rect.left * scale -\n (el.clientWidth - rect.width * scale) / 2;\n } else el.scrollTop = win.offsetOf(i) - gap;\n win.onScroll(el.scrollTop);\n setScrollLeft(el.scrollLeft);\n pendingFocus.current = scrollTo.focus ? scrollTo.id : null;\n });\n useClientLayoutEffect(() => {\n const id = pendingFocus.current;\n const slot = id && scroller.current?.querySelector<HTMLElement>(`[data-page=\"${CSS.escape(id)}\"]`);\n if (!slot) return;\n pendingFocus.current = null;\n slot.focus({ preventScroll: true });\n });\n\n // Zoom changes are announced; the first value is not.\n const [said, setSaid] = useState({ percent, text: \"\" });\n if (said.percent !== percent) setSaid({ percent, text: text.zoom(percent) });\n\n return (\n <>\n <section\n ref={scroller}\n aria-label={label}\n // biome-ignore lint/a11y/noNoninteractiveTabindex: the document scrolls and zooms from the keyboard, so it is a tab stop\n tabIndex={0}\n className={className ? `cy-document-viewport ${className}` : \"cy-document-viewport\"}\n data-panning={gestures.panning ? \"\" : undefined}\n style={style}\n onKeyDown={gestures.onKeyDown}\n onKeyUp={gestures.onKeyUp}\n onBlur={gestures.onBlur}\n onScroll={(e) => {\n win.onScroll(e.currentTarget.scrollTop);\n setScrollLeft(e.currentTarget.scrollLeft);\n }}\n >\n <div\n className=\"cy-document-viewport-content cy-reset\"\n style={{ inlineSize: contentWidth, blockSize: win.total }}\n >\n {placed.map(({ page, i, w, h, x, y, rect }) => (\n // biome-ignore lint/a11y/useSemanticElements: a page is a named group of whatever it shows, not a form fieldset\n <div\n key={page.id}\n role=\"group\"\n aria-label={text.page(i + 1, pages.length)}\n data-page={page.id}\n // Reached by go-to-page (focus), not in the Tab order.\n tabIndex={-1}\n className=\"cy-document-viewport-page cy-reset\"\n style={{ insetInlineStart: x, insetBlockStart: y, inlineSize: w, blockSize: h }}\n >\n {renderPage({ id: page.id, index: i, scale, visible: rect !== null, visibleRect: rect })}\n </div>\n ))}\n </div>\n </section>\n <span className=\"cy-visually-hidden\" role=\"status\">\n {said.text}\n </span>\n </>\n );\n}\n"],"mappings":";;;;;;;;AAwFA,IAAMa,KAAyC;AAAA,EAC7C,MAAA,CAAOC,GAAGC,MAAU,QAAQD,CAAA,OAAQC,CAAA;AAAA,EACpC,MAAA,CAAOC,MAAY,QAAQA,CAAA;AAC7B;AAGA,SAASC,EAAaC,GAAUC,GAAaC,GAAwC;AACnF,QAAMC,IAASb,EAAOY,CAAQ;AAC9B,EAAAC,EAAO,UAAUD;AACjB,QAAME,IAAOd,EAAsB,IAAI;AACvC,EAAAD,GAAA,MAAgB;AACd,IAAIe,EAAK,YAAYH,MACrBG,EAAK,UAAUH,GACfE,EAAO,UAAUH,CAAK;AAAA,EACxB,CAAC;AACH;AAOA,SAAgBK,GAAiB,EAC/B,OAAAC,GACA,OAAAC,GACA,MAAAC,GACA,aAAAC,IAAc,EAAE,MAAM,YAAY,GAClC,cAAAC,GACA,YAAAC,GACA,sBAAAC,GACA,qBAAAC,GACA,eAAAC,GACA,UAAAC,GACA,QAAAC,GACA,WAAAC,GACA,OAAAC,EAAA,GACwB;AACxB,QAAMC,IAAO;AAAA,IAAE,GAAGxB;AAAA,IAAgB,GAAGqB;AAAA,EAAO,GACtCI,IAAW9B,EAAoB,IAAI,GACnC,CAAC+B,GAASC,CAAA,IAAcvC,GAAqByB,G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AACf,MAAArC,EAAI,SAASqC,EAAE,cAAc,SAAS,GACtClC,EAAckC,EAAE,cAAc,UAAU;AAAA,IAC1C;AAAA,IAEA,UAAA,gBAAA1E,EAAC,OAAD;AAAA,MACE,WAAU;AAAA,MACV,OAAO;AAAA,QAAE,YAAY0C;AAAA,QAAc,WAAWL,EAAI;AAAA,MAAM;AAAA,MAEvD,UAAAgB,EAAO,IAAA,CAAK,EAAE,MAAAE,GAAM,GAAAD,GAAG,GAAAE,GAAG,GAAAC,GAAG,GAAAC,GAAG,GAAAC,GAAG,MAAAK,EAAA,MAElC,gBAAAhE,EAAC,OAAD;AAAA,QAEE,MAAK;AAAA,QACL,cAAY0B,EAAK,KAAK4B,IAAI,GAAGxC,EAAM,MAAM;AAAA,QACzC,aAAWyC,EAAK;AAAA,QAEhB,UAAU;AAAA,QACV,WAAU;AAAA,QACV,OAAO;AAAA,UAAE,kBAAkBG;AAAA,UAAG,iBAAiBC;AAAA,UAAG,YAAYH;AAAA,UAAG,WAAWC;AAAA,QAAE;AAAA,QAE7E,UAAAvC,EAAW;AAAA,UAAE,IAAIqC,EAAK;AAAA,UAAI,OAAOD;AAAA,UAAG,OAAApB;AAAA,UAAO,SAAS8B,MAAS;AAAA,UAAM,aAAaA;AAAA,QAAK,CAAC;AAAA,MACpF,GAVET,EAAK,EAUP,CACN;AAAA,IACE,CAAA;AAAA,EACE,CAAA,GACT,gBAAAvD,EAAC,QAAD;AAAA,IAAM,WAAU;AAAA,IAAqB,MAAK;AAAA,IACvC,UAAAwE,EAAK;AAAA,EACF,CAAA,CACN,EAAA,CAAA;AAEN"}
|
|
1
|
+
{"version":3,"file":"DocumentViewport.js","names":["_Fragment","useControllableState","useClientLayoutEffect","useVirtualWindow","anchoredScroll","zoomScale","useZoomGestures","useEffect","useRef","useState","Fragment$1","jsx","jsxs","DEFAULT_LABELS","n","total","percent","useReport","value","key","callback","latest","last","DocumentViewport","label","pages","zoom","defaultZoom","onZoomChange","renderPage","onVisiblePagesChange","onCurrentPageChange","onScaleChange","scrollTo","labels","className","style","text","scroller","setting","setSetting","gap","setGap","g","sizesAt","scale","p","setScale","win","next","scrollLeft","setScrollLeft","widest","contentWidth","anchor","gestures","at","lastScale","el","a","to","top","height","view","placed","i","page","w","h","x","y","l","t","r","b","rect","inView","current","best","lastNonce","pendingFocus","id","slot","said","setSaid","e"],"sources":["../../../src/components/DocumentViewport/DocumentViewport.tsx"],"sourcesContent":["import { type CSSProperties, type ReactNode, useEffect, useRef, useState } from \"react\";\nimport { useClientLayoutEffect } from \"../../foundations/client-layout-effect.js\";\nimport { useControllableState } from \"../../foundations/controllable.js\";\nimport { useVirtualWindow } from \"../../foundations/virtual-window.js\";\nimport { anchoredScroll, type ZoomSetting, zoomScale } from \"../../foundations/zoom.js\";\nimport { useZoomGestures, type ZoomAnchor } from \"../../foundations/zoom-gestures.js\";\n\nexport type { ZoomSetting };\n\nexport interface DocumentViewportTokens {\n /** Behind the pages. */\n background: string;\n /** Space between and around pages. */\n gap: string;\n /** A page's shadow. */\n pageShadow: string;\n}\n\ndeclare module \"../../tokens/schema.js\" {\n interface ComponentTokens {\n documentViewport: DocumentViewportTokens;\n }\n}\n\nexport interface ViewportPage {\n id: string;\n /** Size at 100%, in CSS pixels (a PDF point is one). */\n width: number;\n height: number;\n}\n\nexport interface PageRect {\n left: number;\n top: number;\n width: number;\n height: number;\n}\n\nexport interface RenderPageProps {\n /** The page's `id` from `pages`. */\n id: string;\n /** Position of the page in `pages`, from 0. */\n index: number;\n /** 1 = 100%. Draw at `width` by `height` times `scale`. */\n scale: number;\n /** In view now (pages just outside are rendered too, so scrolling is seamless). */\n visible: boolean;\n /** The part of the page in view, in its own scaled pixels; null when none is. Render only that, for huge pages. */\n visibleRect: PageRect | null;\n}\n\n/** Scroll to a page, or to a rect on it (centred), at 100% units. A new `nonce` scrolls again. */\nexport interface ScrollRequest {\n id: string;\n nonce: number;\n rect?: PageRect;\n /** Move focus to the page afterwards (go-to-page). */\n focus?: boolean;\n}\n\nexport interface DocumentViewportLabels {\n /** A page's name. Default \"Page 3 of 12\". */\n page: (number: number, total: number) => string;\n /** Announced when the zoom changes. Default \"Zoom 125%\". */\n zoom: (percent: number) => string;\n}\n\nexport interface DocumentViewportProps {\n /** Names the viewport (\"Document\", \"Contract.pdf\"). */\n label: string;\n /** The pages, top to bottom, each with its size at 100%. */\n pages: readonly ViewportPage[];\n /** The zoom setting, when you control it: fit width, fit page or a percent. */\n zoom?: ZoomSetting | undefined;\n /** Default fit-width. */\n defaultZoom?: ZoomSetting;\n /** Gestures and keys ask for a percent. */\n onZoomChange?: ((zoom: ZoomSetting) => void) | undefined;\n /** Draws one page. Called for each page in or near the view. */\n renderPage: (page: RenderPageProps) => ReactNode;\n /** The pages in view, top to bottom. */\n onVisiblePagesChange?: ((ids: string[]) => void) | undefined;\n /** The page with the most of itself in view. */\n onCurrentPageChange?: ((id: string | null) => void) | undefined;\n /** The scale the zoom came to (fit modes depend on the viewport). */\n onScaleChange?: ((scale: number) => void) | undefined;\n /** Scrolls to a page, or to a rect on it. A new `nonce` scrolls again. */\n scrollTo?: ScrollRequest | undefined;\n /** Replace the built-in English text: page names and the zoom announcement. */\n labels?: Partial<DocumentViewportLabels>;\n /** Added to the scrolling root element, for layout. */\n className?: string;\n /** Layout only (give it a height). Restyle through --cy-document-viewport-* tokens. */\n style?: CSSProperties;\n}\n\nconst DEFAULT_LABELS: DocumentViewportLabels = {\n page: (n, total) => `Page ${n} of ${total}`,\n zoom: (percent) => `Zoom ${percent}%`,\n};\n\n/** Calls the latest `callback` with `value` whenever `value` (compared by `key`) changes. */\nfunction useReport<T>(value: T, key: string, callback: ((v: T) => void) | undefined) {\n const latest = useRef(callback);\n latest.current = callback;\n const last = useRef<string | null>(null);\n useEffect(() => {\n if (last.current === key) return;\n last.current = key;\n latest.current?.(value);\n });\n}\n\n/**\n * A scrolling, zoomable document: pages one under another, only those near the view rendered, zoomed by setting\n * (fit width, fit page, a percent), Ctrl/Cmd+wheel or a pinch around the pointer, panned with Space+drag. It reports\n * the pages in view and the current page, scrolls to a page or a spot on it on request, and announces zoom changes.\n */\nexport function DocumentViewport({\n label,\n pages,\n zoom,\n defaultZoom = { kind: \"fit-width\" },\n onZoomChange,\n renderPage,\n onVisiblePagesChange,\n onCurrentPageChange,\n onScaleChange,\n scrollTo,\n labels,\n className,\n style,\n}: DocumentViewportProps) {\n const text = { ...DEFAULT_LABELS, ...labels };\n const scroller = useRef<HTMLElement>(null);\n const [setting, setSetting] = useControllableState(zoom, defaultZoom, onZoomChange);\n // The gap comes from the token, in pixels, for the layout maths.\n const [gap, setGap] = useState(16);\n useClientLayoutEffect(() => {\n const g = Number.parseFloat(getComputedStyle(scroller.current as HTMLElement).getPropertyValue(\"--_gap\"));\n if (g !== gap) setGap(g);\n });\n\n // The viewport's size feeds the fit modes; the windowing measures it.\n const sizesAt = (scale: number) => pages.map((p) => p.height * scale);\n const [scale, setScale] = useState(1);\n const win = useVirtualWindow(scroller, { count: pages.length, sizes: sizesAt(scale), gap, overscan: 1 });\n const next = zoomScale(setting, pages, win.view, gap);\n if (next !== scale) setScale(next);\n const percent = Math.round(scale * 100);\n\n const [scrollLeft, setScrollLeft] = useState(0);\n const widest = Math.max(0, ...pages.map((p) => p.width * scale));\n const contentWidth = Math.max(win.view.width, widest + 2 * gap);\n\n // Zooming keeps the point under the pointer (or the viewport's centre) where it is.\n const anchor = useRef<{ at: { x: number; y: number }; from: number } | null>(null);\n const gestures = useZoomGestures(scroller, {\n percent,\n onZoom: (value, at: ZoomAnchor) => {\n anchor.current = { at: at ?? { x: win.view.width / 2, y: win.view.height / 2 }, from: scale };\n setSetting({ kind: \"percent\", value });\n },\n });\n const lastScale = useRef(scale);\n useClientLayoutEffect(() => {\n const el = scroller.current as HTMLElement;\n if (lastScale.current === scale) return;\n const a = anchor.current ?? {\n at: { x: el.clientWidth / 2, y: el.clientHeight / 2 },\n from: lastScale.current,\n };\n anchor.current = null;\n lastScale.current = scale;\n const to = anchoredScroll({ left: el.scrollLeft, top: el.scrollTop }, a.at, scale / a.from);\n el.scrollLeft = to.left;\n el.scrollTop = to.top;\n win.onScroll(el.scrollTop);\n setScrollLeft(el.scrollLeft);\n });\n\n // In view: which pages, and how much of each.\n const { top, height } = win.view;\n const view = { left: scrollLeft, right: scrollLeft + win.view.width, top, bottom: top + height };\n const placed = win.indices.map((i) => {\n const page = pages[i] as ViewportPage;\n const w = page.width * scale;\n const h = page.height * scale;\n const x = (contentWidth - w) / 2;\n const y = win.offsetOf(i);\n const l = Math.max(0, view.left - x);\n const t = Math.max(0, view.top - y);\n const r = Math.min(w, view.right - x);\n const b = Math.min(h, view.bottom - y);\n const rect = height > 0 && r > l && b > t ? { left: l, top: t, width: r - l, height: b - t } : null;\n return { page, i, w, h, x, y, rect, area: rect ? rect.width * rect.height : 0 };\n });\n const inView = placed.filter((p) => p.rect).sort((a, b) => a.i - b.i);\n const current = inView.reduce<(typeof placed)[number] | null>(\n (best, p) => (!best || p.area > best.area ? p : best),\n null,\n );\n useReport(\n inView.map((p) => p.page.id),\n inView.map((p) => p.page.id).join(\" \"),\n onVisiblePagesChange,\n );\n useReport(current?.page.id ?? null, current?.page.id ?? \"\", onCurrentPageChange);\n useReport(scale, String(scale), onScaleChange);\n\n // Scroll requests: only a new nonce scrolls; focus waits for the page to be rendered there.\n const lastNonce = useRef<number | null>(null);\n const pendingFocus = useRef<string | null>(null);\n useClientLayoutEffect(() => {\n const el = scroller.current as HTMLElement;\n if (!scrollTo || scrollTo.nonce === lastNonce.current) return;\n const i = pages.findIndex((p) => p.id === scrollTo.id);\n if (i < 0) return;\n lastNonce.current = scrollTo.nonce;\n const page = pages[i] as ViewportPage;\n const { rect } = scrollTo;\n if (rect) {\n el.scrollTop = win.offsetOf(i) + rect.top * scale - (el.clientHeight - rect.height * scale) / 2;\n el.scrollLeft =\n (contentWidth - page.width * scale) / 2 +\n rect.left * scale -\n (el.clientWidth - rect.width * scale) / 2;\n } else el.scrollTop = win.offsetOf(i) - gap;\n win.onScroll(el.scrollTop);\n setScrollLeft(el.scrollLeft);\n pendingFocus.current = scrollTo.focus ? scrollTo.id : null;\n });\n useClientLayoutEffect(() => {\n const id = pendingFocus.current;\n const slot = id && scroller.current?.querySelector<HTMLElement>(`[data-page=\"${CSS.escape(id)}\"]`);\n if (!slot) return;\n pendingFocus.current = null;\n slot.focus({ preventScroll: true });\n });\n\n // Zoom changes are announced; the first value is not.\n const [said, setSaid] = useState({ percent, text: \"\" });\n if (said.percent !== percent) setSaid({ percent, text: text.zoom(percent) });\n\n return (\n <>\n <section\n ref={scroller}\n aria-label={label}\n // biome-ignore lint/a11y/noNoninteractiveTabindex: the document scrolls and zooms from the keyboard, so it is a tab stop\n tabIndex={0}\n className={className ? `cy-document-viewport ${className}` : \"cy-document-viewport\"}\n data-panning={gestures.panning ? \"\" : undefined}\n style={style}\n onKeyDown={gestures.onKeyDown}\n onKeyUp={gestures.onKeyUp}\n onBlur={gestures.onBlur}\n onScroll={(e) => {\n win.onScroll(e.currentTarget.scrollTop);\n setScrollLeft(e.currentTarget.scrollLeft);\n }}\n >\n <div\n className=\"cy-document-viewport-content cy-reset\"\n style={{ inlineSize: contentWidth, blockSize: win.total }}\n >\n {placed.map(({ page, i, w, h, x, y, rect }) => (\n // biome-ignore lint/a11y/useSemanticElements: a page is a named group of whatever it shows, not a form fieldset\n <div\n key={page.id}\n role=\"group\"\n aria-label={text.page(i + 1, pages.length)}\n data-page={page.id}\n // Reached by go-to-page (focus), not in the Tab order.\n tabIndex={-1}\n className=\"cy-document-viewport-page cy-reset\"\n style={{ insetInlineStart: x, insetBlockStart: y, inlineSize: w, blockSize: h }}\n >\n {renderPage({ id: page.id, index: i, scale, visible: rect !== null, visibleRect: rect })}\n </div>\n ))}\n </div>\n </section>\n <span className=\"cy-visually-hidden\" role=\"status\">\n {said.text}\n </span>\n </>\n );\n}\n"],"mappings":";;;;;;;;AAgGA,IAAMa,KAAyC;AAAA,EAC7C,MAAA,CAAOC,GAAGC,MAAU,QA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ACV,OAAO;AAAA,UAAE,kBAAkBG;AAAA,UAAG,iBAAiBC;AAAA,UAAG,YAAYH;AAAA,UAAG,WAAWC;AAAA,QAAE;AAAA,QAE7E,UAAAvC,EAAW;AAAA,UAAE,IAAIqC,EAAK;AAAA,UAAI,OAAOD;AAAA,UAAG,OAAApB;AAAA,UAAO,SAAS8B,MAAS;AAAA,UAAM,aAAaA;AAAA,QAAK,CAAC;AAAA,MACpF,GAVET,EAAK,EAUP,CACN;AAAA,IACE,CAAA;AAAA,EACE,CAAA,GACT,gBAAAvD,EAAC,QAAD;AAAA,IAAM,WAAU;AAAA,IAAqB,MAAK;AAAA,IACvC,UAAAwE,EAAK;AAAA,EACF,CAAA,CACN,EAAA,CAAA;AAEN"}
|
|
@@ -14,7 +14,9 @@ declare module "../../tokens/schema.js" {
|
|
|
14
14
|
export interface EmptyStateProps {
|
|
15
15
|
/** A Facet icon shown above the title (decorative). */
|
|
16
16
|
icon?: IconData | undefined;
|
|
17
|
+
/** The heading: what is empty or missing. */
|
|
17
18
|
title: ReactNode;
|
|
19
|
+
/** A sentence under the title. */
|
|
18
20
|
description?: ReactNode | undefined;
|
|
19
21
|
/** Buttons for the next step ("Create a project", "Clear filters"). */
|
|
20
22
|
actions?: ReactNode | undefined;
|
|
@@ -22,6 +24,7 @@ export interface EmptyStateProps {
|
|
|
22
24
|
headingLevel?: 2 | 3 | 4 | 5 | 6;
|
|
23
25
|
/** `sm` for panels and popups, `md` for page areas. */
|
|
24
26
|
size?: Extract<Size, "sm" | "md">;
|
|
27
|
+
/** Added to the root element, for layout. */
|
|
25
28
|
className?: string;
|
|
26
29
|
/** Layout only. Restyle through --cy-empty-state-* tokens. */
|
|
27
30
|
style?: CSSProperties;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmptyState.js","names":["Icon","createElement","jsx","jsxs","EmptyState","icon","title","description","actions","headingLevel","size","className","style"],"sources":["../../../src/components/EmptyState/EmptyState.tsx"],"sourcesContent":["import { type CSSProperties, createElement, type ReactNode } from \"react\";\nimport { Icon } from \"../../foundations/Icon/Icon.js\";\nimport type { IconData } from \"../../icons/types.js\";\nimport type { Size } from \"../../tokens/schema.js\";\n\nexport interface EmptyStateTokens {\n gap: string;\n padding: string;\n maxWidth: string;\n}\n\ndeclare module \"../../tokens/schema.js\" {\n interface ComponentTokens {\n emptyState: EmptyStateTokens;\n }\n}\n\nexport interface EmptyStateProps {\n /** A Facet icon shown above the title (decorative). */\n icon?: IconData | undefined;\n title: ReactNode;\n description?: ReactNode | undefined;\n /** Buttons for the next step (\"Create a project\", \"Clear filters\"). */\n actions?: ReactNode | undefined;\n /** Heading level of the title, to fit the page outline (default 3). */\n headingLevel?: 2 | 3 | 4 | 5 | 6;\n /** `sm` for panels and popups, `md` for page areas. */\n size?: Extract<Size, \"sm\" | \"md\">;\n className?: string;\n /** Layout only. Restyle through --cy-empty-state-* tokens. */\n style?: CSSProperties;\n}\n\n/** What to show where content will be: no items yet, no search results, nothing selected. */\nexport function EmptyState({\n icon,\n title,\n description,\n actions,\n headingLevel = 3,\n size = \"md\",\n className,\n style,\n}: EmptyStateProps) {\n return (\n <div\n className={className ? `cy-empty-state ${className}` : \"cy-empty-state\"}\n data-size={size}\n style={style}\n >\n {icon && (\n <span className=\"cy-empty-state-icon cy-reset\">\n <Icon icon={icon} size=\"lg\" />\n </span>\n )}\n {createElement(`h${headingLevel}`, { className: \"cy-empty-state-title cy-reset\" }, title)}\n {description && <p className=\"cy-empty-state-description cy-reset\">{description}</p>}\n {actions && <div className=\"cy-empty-state-actions cy-reset\">{actions}</div>}\n </div>\n );\n}\n"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"EmptyState.js","names":["Icon","createElement","jsx","jsxs","EmptyState","icon","title","description","actions","headingLevel","size","className","style"],"sources":["../../../src/components/EmptyState/EmptyState.tsx"],"sourcesContent":["import { type CSSProperties, createElement, type ReactNode } from \"react\";\nimport { Icon } from \"../../foundations/Icon/Icon.js\";\nimport type { IconData } from \"../../icons/types.js\";\nimport type { Size } from \"../../tokens/schema.js\";\n\nexport interface EmptyStateTokens {\n gap: string;\n padding: string;\n maxWidth: string;\n}\n\ndeclare module \"../../tokens/schema.js\" {\n interface ComponentTokens {\n emptyState: EmptyStateTokens;\n }\n}\n\nexport interface EmptyStateProps {\n /** A Facet icon shown above the title (decorative). */\n icon?: IconData | undefined;\n /** The heading: what is empty or missing. */\n title: ReactNode;\n /** A sentence under the title. */\n description?: ReactNode | undefined;\n /** Buttons for the next step (\"Create a project\", \"Clear filters\"). */\n actions?: ReactNode | undefined;\n /** Heading level of the title, to fit the page outline (default 3). */\n headingLevel?: 2 | 3 | 4 | 5 | 6;\n /** `sm` for panels and popups, `md` for page areas. */\n size?: Extract<Size, \"sm\" | \"md\">;\n /** Added to the root element, for layout. */\n className?: string;\n /** Layout only. Restyle through --cy-empty-state-* tokens. */\n style?: CSSProperties;\n}\n\n/** What to show where content will be: no items yet, no search results, nothing selected. */\nexport function EmptyState({\n icon,\n title,\n description,\n actions,\n headingLevel = 3,\n size = \"md\",\n className,\n style,\n}: EmptyStateProps) {\n return (\n <div\n className={className ? `cy-empty-state ${className}` : \"cy-empty-state\"}\n data-size={size}\n style={style}\n >\n {icon && (\n <span className=\"cy-empty-state-icon cy-reset\">\n <Icon icon={icon} size=\"lg\" />\n </span>\n )}\n {createElement(`h${headingLevel}`, { className: \"cy-empty-state-title cy-reset\" }, title)}\n {description && <p className=\"cy-empty-state-description cy-reset\">{description}</p>}\n {actions && <div className=\"cy-empty-state-actions cy-reset\">{actions}</div>}\n </div>\n );\n}\n"],"mappings":";;;;AAqCA,SAAgBI,EAAW,EACzB,MAAAC,GACA,OAAAC,GACA,aAAAC,GACA,SAAAC,GACA,cAAAC,IAAe,GACf,MAAAC,IAAO,MACP,WAAAC,GACA,OAAAC,EAAA,GACkB;AAClB,SACE,gBAAAT,EAAC,OAAD;AAAA,IACE,WAAWQ,IAAY,kBAAkBA,CAAA,KAAc;AAAA,IACvD,aAAWD;AAAA,IACJ,OAAAE;AAAA,IAHT,UAAA;AAAA,MAKGP,KACC,gBAAAH,EAAC,QAAD;AAAA,QAAM,WAAU;AAAA,QACd,UAAA,gBAAAA,EAACF,GAAD;AAAA,UAAY,MAAAK;AAAA,UAAM,MAAK;AAAA,QAAM,CAAA;AAAA,MACzB,CAAA;AAAA,MAEPJ,EAAc,IAAIQ,CAAA,IAAgB,EAAE,WAAW,gCAAgC,GAAGH,CAAK;AAAA,MACvFC,KAAe,gBAAAL,EAAC,KAAD;AAAA,QAAG,WAAU;AAAA,QAAuC,UAAAK;AAAA,MAAe,CAAA;AAAA,MAClFC,KAAW,gBAAAN,EAAC,OAAD;AAAA,QAAK,WAAU;AAAA,QAAmC,UAAAM;AAAA,MAAa,CAAA;AAAA,IACxE;AAAA,E;AAET"}
|