@canonical/react-ds-app 0.40.0 → 0.43.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 +9 -3
- package/dist/esm/lib/ContentLayout/styles.css +1 -1
- package/dist/esm/lib/SideNavigation/SideNavigation.js +1 -7
- package/dist/esm/lib/SideNavigation/SideNavigation.js.map +1 -1
- package/dist/esm/lib/SideNavigation/common/Item/Item.js +1 -1
- package/dist/esm/lib/SideNavigation/helpItem.js.map +1 -1
- package/dist/esm/lib/SidePanel/Context.js +12 -0
- package/dist/esm/lib/SidePanel/Context.js.map +1 -0
- package/dist/esm/lib/SidePanel/Provider.js +90 -0
- package/dist/esm/lib/SidePanel/Provider.js.map +1 -0
- package/dist/esm/lib/SidePanel/common/Content/Content.js +26 -0
- package/dist/esm/lib/SidePanel/common/Content/Content.js.map +1 -0
- package/dist/esm/lib/SidePanel/common/Content/index.js +2 -0
- package/dist/esm/lib/SidePanel/common/Content/index.js.map +1 -0
- package/dist/esm/lib/SidePanel/common/Content/styles.css +49 -0
- package/dist/esm/lib/SidePanel/common/Content/types.js +2 -0
- package/dist/esm/lib/SidePanel/common/Content/types.js.map +1 -0
- package/dist/esm/lib/SidePanel/common/Footer/Footer.js +19 -0
- package/dist/esm/lib/SidePanel/common/Footer/Footer.js.map +1 -0
- package/dist/esm/lib/SidePanel/common/Footer/index.js +2 -0
- package/dist/esm/lib/SidePanel/common/Footer/index.js.map +1 -0
- package/dist/esm/lib/SidePanel/common/Footer/styles.css +36 -0
- package/dist/esm/lib/SidePanel/common/Footer/types.js +2 -0
- package/dist/esm/lib/SidePanel/common/Footer/types.js.map +1 -0
- package/dist/esm/lib/SidePanel/common/Header/Header.js +39 -0
- package/dist/esm/lib/SidePanel/common/Header/Header.js.map +1 -0
- package/dist/esm/lib/SidePanel/common/Header/index.js +2 -0
- package/dist/esm/lib/SidePanel/common/Header/index.js.map +1 -0
- package/dist/esm/lib/SidePanel/common/Header/styles.css +94 -0
- package/dist/esm/lib/SidePanel/common/Header/types.js +2 -0
- package/dist/esm/lib/SidePanel/common/Header/types.js.map +1 -0
- package/dist/esm/lib/SidePanel/common/index.js +4 -0
- package/dist/esm/lib/SidePanel/common/index.js.map +1 -0
- package/dist/esm/lib/SidePanel/hooks/index.js +4 -0
- package/dist/esm/lib/SidePanel/hooks/index.js.map +1 -0
- package/dist/esm/lib/SidePanel/hooks/types.js +2 -0
- package/dist/esm/lib/SidePanel/hooks/types.js.map +1 -0
- package/dist/esm/lib/SidePanel/hooks/useSidePanelContext.js +9 -0
- package/dist/esm/lib/SidePanel/hooks/useSidePanelContext.js.map +1 -0
- package/dist/esm/lib/SidePanel/hooks/useSidePanelDialog.js +134 -0
- package/dist/esm/lib/SidePanel/hooks/useSidePanelDialog.js.map +1 -0
- package/dist/esm/lib/SidePanel/index.js +4 -0
- package/dist/esm/lib/SidePanel/index.js.map +1 -0
- package/dist/esm/lib/SidePanel/styles.css +192 -0
- package/dist/esm/lib/SidePanel/types.js +2 -0
- package/dist/esm/lib/SidePanel/types.js.map +1 -0
- package/dist/esm/lib/SidePanel/withSidePanel.js +98 -0
- package/dist/esm/lib/SidePanel/withSidePanel.js.map +1 -0
- package/dist/esm/lib/index.js +1 -0
- package/dist/esm/lib/index.js.map +1 -1
- package/dist/types/lib/ApplicationLayout/ApplicationLayout.d.ts.map +1 -1
- package/dist/types/lib/ContentLayout/ContentLayout.d.ts.map +1 -1
- package/dist/types/lib/ContentLayout/types.d.ts +1 -1
- package/dist/types/lib/SideNavigation/SideNavigation.d.ts.map +1 -1
- package/dist/types/lib/SideNavigation/common/CollapseToggle/CollapseToggle.d.ts.map +1 -1
- package/dist/types/lib/SideNavigation/common/Content/Content.d.ts.map +1 -1
- package/dist/types/lib/SideNavigation/common/ContextSwitcher/ContextSwitcher.d.ts.map +1 -1
- package/dist/types/lib/SideNavigation/common/Footer/Footer.d.ts.map +1 -1
- package/dist/types/lib/SideNavigation/common/Group/Group.d.ts.map +1 -1
- package/dist/types/lib/SideNavigation/common/GroupHeader/GroupHeader.d.ts.map +1 -1
- package/dist/types/lib/SideNavigation/common/Header/Header.d.ts.map +1 -1
- package/dist/types/lib/SideNavigation/common/Item/Item.d.ts.map +1 -1
- package/dist/types/lib/SideNavigation/common/ItemButton/ItemButton.d.ts.map +1 -1
- package/dist/types/lib/SideNavigation/common/ItemExpandable/ItemExpandable.d.ts.map +1 -1
- package/dist/types/lib/SideNavigation/common/NavTree/NavTree.d.ts.map +1 -1
- package/dist/types/lib/SideNavigation/helpItem.d.ts.map +1 -1
- package/dist/types/lib/SideNavigation/hooks/useCollapseShortcut/useCollapseShortcut.d.ts.map +1 -1
- package/dist/types/lib/SidePanel/Context.d.ts +12 -0
- package/dist/types/lib/SidePanel/Context.d.ts.map +1 -0
- package/dist/types/lib/SidePanel/Provider.d.ts +13 -0
- package/dist/types/lib/SidePanel/Provider.d.ts.map +1 -0
- package/dist/types/lib/SidePanel/common/Content/Content.d.ts +9 -0
- package/dist/types/lib/SidePanel/common/Content/Content.d.ts.map +1 -0
- package/dist/types/lib/SidePanel/common/Content/index.d.ts +3 -0
- package/dist/types/lib/SidePanel/common/Content/index.d.ts.map +1 -0
- package/dist/types/lib/SidePanel/common/Content/types.d.ts +21 -0
- package/dist/types/lib/SidePanel/common/Content/types.d.ts.map +1 -0
- package/dist/types/lib/SidePanel/common/Footer/Footer.d.ts +9 -0
- package/dist/types/lib/SidePanel/common/Footer/Footer.d.ts.map +1 -0
- package/dist/types/lib/SidePanel/common/Footer/index.d.ts +3 -0
- package/dist/types/lib/SidePanel/common/Footer/index.d.ts.map +1 -0
- package/dist/types/lib/SidePanel/common/Footer/types.d.ts +14 -0
- package/dist/types/lib/SidePanel/common/Footer/types.d.ts.map +1 -0
- package/dist/types/lib/SidePanel/common/Header/Header.d.ts +9 -0
- package/dist/types/lib/SidePanel/common/Header/Header.d.ts.map +1 -0
- package/dist/types/lib/SidePanel/common/Header/index.d.ts +3 -0
- package/dist/types/lib/SidePanel/common/Header/index.d.ts.map +1 -0
- package/dist/types/lib/SidePanel/common/Header/types.d.ts +35 -0
- package/dist/types/lib/SidePanel/common/Header/types.d.ts.map +1 -0
- package/dist/types/lib/SidePanel/common/index.d.ts +4 -0
- package/dist/types/lib/SidePanel/common/index.d.ts.map +1 -0
- package/dist/types/lib/SidePanel/hooks/index.d.ts +4 -0
- package/dist/types/lib/SidePanel/hooks/index.d.ts.map +1 -0
- package/dist/types/lib/SidePanel/hooks/types.d.ts +28 -0
- package/dist/types/lib/SidePanel/hooks/types.d.ts.map +1 -0
- package/dist/types/lib/SidePanel/hooks/useSidePanelContext.d.ts +8 -0
- package/dist/types/lib/SidePanel/hooks/useSidePanelContext.d.ts.map +1 -0
- package/dist/types/lib/SidePanel/hooks/useSidePanelDialog.d.ts +12 -0
- package/dist/types/lib/SidePanel/hooks/useSidePanelDialog.d.ts.map +1 -0
- package/dist/types/lib/SidePanel/index.d.ts +4 -0
- package/dist/types/lib/SidePanel/index.d.ts.map +1 -0
- package/dist/types/lib/SidePanel/types.d.ts +97 -0
- package/dist/types/lib/SidePanel/types.d.ts.map +1 -0
- package/dist/types/lib/SidePanel/withSidePanel.d.ts +76 -0
- package/dist/types/lib/SidePanel/withSidePanel.d.ts.map +1 -0
- package/dist/types/lib/ViewLayout/ViewLayout.d.ts.map +1 -1
- package/dist/types/lib/index.d.ts +1 -0
- package/dist/types/lib/index.d.ts.map +1 -1
- package/package.json +28 -27
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { useCallback, useEffect, useImperativeHandle, useRef } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* The dialog behaviour of the SidePanel provider: open/close bookkeeping,
|
|
4
|
+
* focus handoff, Escape, and the imperative handle. It holds no open state —
|
|
5
|
+
* the dialog's native state is the only source of truth — and returns only
|
|
6
|
+
* the plumbing the provider needs: the element ref, the `close` action, the
|
|
7
|
+
* consumer's class name, the remaining native attributes, and the event
|
|
8
|
+
* wiring.
|
|
9
|
+
*/
|
|
10
|
+
const useSidePanelDialog = ({ onKeyDown, onClose, ref, className, ...dialogProps }) => {
|
|
11
|
+
const dialogRef = useRef(null);
|
|
12
|
+
/** Where focus was before the panel opened, so it can be handed back. */
|
|
13
|
+
const previouslyFocusedRef = useRef(null);
|
|
14
|
+
/**
|
|
15
|
+
* A live mirror of the dialog's open state. Cleanups cannot read the ref —
|
|
16
|
+
* by the time an unmount cleanup runs, React has already detached it — so
|
|
17
|
+
* the unmount cleanup reads this instead to answer "was the panel still open
|
|
18
|
+
* when it died?".
|
|
19
|
+
*/
|
|
20
|
+
const openRef = useRef(false);
|
|
21
|
+
const close = useCallback(() => {
|
|
22
|
+
dialogRef.current?.close();
|
|
23
|
+
}, []);
|
|
24
|
+
const openPanel = useCallback(() => {
|
|
25
|
+
const dialog = dialogRef.current;
|
|
26
|
+
if (!dialog || dialog.open)
|
|
27
|
+
return;
|
|
28
|
+
previouslyFocusedRef.current =
|
|
29
|
+
document.activeElement instanceof HTMLElement
|
|
30
|
+
? document.activeElement
|
|
31
|
+
: null;
|
|
32
|
+
// `show()` — not `showModal()` — is what keeps the rest of the page
|
|
33
|
+
// interactive, and it is the reason this component is a non-modal dialog
|
|
34
|
+
// at all. Focus is moved into the panel but never trapped.
|
|
35
|
+
dialog.show();
|
|
36
|
+
openRef.current = true;
|
|
37
|
+
dialog.focus();
|
|
38
|
+
}, []);
|
|
39
|
+
const toggle = useCallback(() => {
|
|
40
|
+
if (dialogRef.current?.open)
|
|
41
|
+
close();
|
|
42
|
+
else
|
|
43
|
+
openPanel();
|
|
44
|
+
}, [close, openPanel]);
|
|
45
|
+
// The provider keeps its own dialog ref (show()/close() run through it)
|
|
46
|
+
// and exposes the imperative handle — not the raw element — to a consumer
|
|
47
|
+
// ref.
|
|
48
|
+
useImperativeHandle(ref, () => ({
|
|
49
|
+
open: openPanel,
|
|
50
|
+
close,
|
|
51
|
+
toggle,
|
|
52
|
+
element: dialogRef.current,
|
|
53
|
+
}), [openPanel, close, toggle]);
|
|
54
|
+
// Hand focus back if the panel disappears while still open.
|
|
55
|
+
//
|
|
56
|
+
// There are two ways a panel closes:
|
|
57
|
+
//
|
|
58
|
+
// 1. `panelRef.current.close()` — the handle closes it, and its close
|
|
59
|
+
// handler already handed focus back. This effect then has nothing to do
|
|
60
|
+
// (openRef is already false, so it bails out below).
|
|
61
|
+
//
|
|
62
|
+
// 2. The panel is unmounted while open — nobody called close(), React just
|
|
63
|
+
// removed it. The typical case is navigation: the user moves to another
|
|
64
|
+
// route and the whole subtree, panel included, goes away. (A consumer
|
|
65
|
+
// conditionally rendering the panel — `{isOpen && <SidePanel …/>}` —
|
|
66
|
+
// also lands here, though the mounted-always pattern is the intended
|
|
67
|
+
// one.) Focus is sitting on an element that no longer exists, so the
|
|
68
|
+
// browser dumps it on <body>, and a keyboard user lands in the middle of
|
|
69
|
+
// nowhere. This cleanup catches that case and puts focus back where it
|
|
70
|
+
// was before the panel opened — usually the button that opened it.
|
|
71
|
+
useEffect(() => {
|
|
72
|
+
return () => {
|
|
73
|
+
const previouslyFocused = previouslyFocusedRef.current;
|
|
74
|
+
// Bail out when the panel was already closed (its close already handled
|
|
75
|
+
// focus), or when we never recorded where focus came from.
|
|
76
|
+
if (!openRef.current || !previouslyFocused)
|
|
77
|
+
return;
|
|
78
|
+
// Where is focus right now?
|
|
79
|
+
// - On <body> (or nothing): focus died with the panel — the browser
|
|
80
|
+
// always moves focus to <body> when the focused element is removed.
|
|
81
|
+
// Rescue it and send it back.
|
|
82
|
+
// - Anywhere else: the user clicked something in the application behind
|
|
83
|
+
// the panel before it went away. They chose where to be — moving
|
|
84
|
+
// focus back would override that choice.
|
|
85
|
+
const active = document.activeElement;
|
|
86
|
+
if (active === null || active === document.body) {
|
|
87
|
+
previouslyFocused.focus();
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
}, []);
|
|
91
|
+
/**
|
|
92
|
+
* A non-modal dialog gets no `cancel` event, so Escape is handled here.
|
|
93
|
+
* Bound to the dialog rather than the document on purpose: Escape while
|
|
94
|
+
* focus is out in the application belongs to the application.
|
|
95
|
+
*/
|
|
96
|
+
const handleKeyDown = useCallback((event) => {
|
|
97
|
+
onKeyDown?.(event);
|
|
98
|
+
if (event.key === "Escape" && !event.defaultPrevented) {
|
|
99
|
+
close();
|
|
100
|
+
}
|
|
101
|
+
}, [onKeyDown, close]);
|
|
102
|
+
/**
|
|
103
|
+
* Every close funnels through the platform's `close` event — the handle's
|
|
104
|
+
* `close()`, a dismissal gesture, or a path the component did not drive at
|
|
105
|
+
* all (a `<form method="dialog">` submits one). Tidy up the open state and
|
|
106
|
+
* hand focus back in that one place.
|
|
107
|
+
*/
|
|
108
|
+
const handleClose = useCallback((event) => {
|
|
109
|
+
onClose?.(event);
|
|
110
|
+
// A consumer may synchronously reopen from onClose: openPanel has then already re-recorded the
|
|
111
|
+
// open state and focus origin, so leave its bookkeeping untouched.
|
|
112
|
+
if (dialogRef.current?.open)
|
|
113
|
+
return;
|
|
114
|
+
openRef.current = false;
|
|
115
|
+
const dialog = dialogRef.current;
|
|
116
|
+
// Hand focus back only if it is still inside the panel; the user may
|
|
117
|
+
// have moved on to the application, and stealing focus back would be
|
|
118
|
+
// rude.
|
|
119
|
+
if (dialog?.contains(document.activeElement)) {
|
|
120
|
+
previouslyFocusedRef.current?.focus();
|
|
121
|
+
}
|
|
122
|
+
previouslyFocusedRef.current = null;
|
|
123
|
+
}, [onClose]);
|
|
124
|
+
return {
|
|
125
|
+
className,
|
|
126
|
+
close,
|
|
127
|
+
dialogProps,
|
|
128
|
+
dialogRef,
|
|
129
|
+
handleKeyDown,
|
|
130
|
+
handleClose,
|
|
131
|
+
};
|
|
132
|
+
};
|
|
133
|
+
export default useSidePanelDialog;
|
|
134
|
+
//# sourceMappingURL=useSidePanelDialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSidePanelDialog.js","sourceRoot":"","sources":["../../../../../src/lib/SidePanel/hooks/useSidePanelDialog.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/lib/SidePanel/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,eAAe,CAAC;AACrD,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
/* Layer: ds.components.apps (@canonical/styles README, "Cascade layers"). */
|
|
2
|
+
|
|
3
|
+
@layer ds.components.apps {
|
|
4
|
+
/**
|
|
5
|
+
* SidePanel styles
|
|
6
|
+
*
|
|
7
|
+
* A NON-MODAL <dialog>: the application behind stays interactive. None of the
|
|
8
|
+
* top-layer conveniences apply, which is why this file does work a modal
|
|
9
|
+
* wouldn't — it positions and stacks the panel itself, and never styles
|
|
10
|
+
* `::backdrop` (a backdrop is only painted for a modal dialog, and faking one
|
|
11
|
+
* would cover the application and swallow its clicks).
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/* Component properties — the documented override points. */
|
|
15
|
+
:root {
|
|
16
|
+
/*
|
|
17
|
+
design-tokens 0.8.1 ships no `size/*` token, so this is a literal.
|
|
18
|
+
TODO: replace with a token when one exists.
|
|
19
|
+
*/
|
|
20
|
+
--side-panel-inline-size: 33.5rem;
|
|
21
|
+
/*
|
|
22
|
+
...and no `shadow/*` token either. The shadow is what separates the panel
|
|
23
|
+
from the live page, so unlike a modal we cannot drop it.
|
|
24
|
+
TODO: replace with a token when one exists.
|
|
25
|
+
*/
|
|
26
|
+
--side-panel-box-shadow: 0 0 32px 0 rgba(0, 0, 0, 0.2);
|
|
27
|
+
/*
|
|
28
|
+
A non-modal dialog is not in the top layer, so stacking is ours to manage.
|
|
29
|
+
Matches the demo's Drawer so the two never fight.
|
|
30
|
+
*/
|
|
31
|
+
--side-panel-z-index: 1000;
|
|
32
|
+
|
|
33
|
+
--side-panel-border-radius: var(--dimension-radius-medium);
|
|
34
|
+
/*
|
|
35
|
+
The hairline closing the scroll region is a divider, not a boundary, so it
|
|
36
|
+
takes the muted border rather than the default one — gray-100 in light mode
|
|
37
|
+
against gray-520, and gray-820 in dark so it stays pale either way.
|
|
38
|
+
*/
|
|
39
|
+
--side-panel-color-border: var(--color-border-muted);
|
|
40
|
+
/* One inline padding, read by the header, content and footer alike. */
|
|
41
|
+
--side-panel-padding-inline: var(--dimension-300);
|
|
42
|
+
/* Block padding of the two pinned regions, so the rhythm is tunable. */
|
|
43
|
+
--side-panel-header-padding-block: var(--dimension-200);
|
|
44
|
+
--side-panel-footer-padding-block: var(--dimension-200);
|
|
45
|
+
--side-panel-content-padding-block: var(--dimension-200);
|
|
46
|
+
/* Space between the header's title and close button. */
|
|
47
|
+
--side-panel-header-gap: var(--dimension-200);
|
|
48
|
+
/* Space between the footer's actions. */
|
|
49
|
+
--side-panel-footer-gap: var(--dimension-200);
|
|
50
|
+
/* Keyboard focus ring of the scrollable content pane, drawn inside it. */
|
|
51
|
+
--side-panel-focus-ring-width: var(--dimension-stroke-thickness-large);
|
|
52
|
+
--side-panel-color-focus-ring: var(--color-focus-ring);
|
|
53
|
+
--side-panel-transition-duration: var(--motion-duration-medium);
|
|
54
|
+
--side-panel-transition-easing-enter: var(--motion-easing-decelerate);
|
|
55
|
+
--side-panel-transition-easing-exit: var(--motion-easing-accelerate);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.ds.side-panel {
|
|
59
|
+
/*
|
|
60
|
+
Undo the user-agent dialog box. Each of these is set by the UA stylesheet,
|
|
61
|
+
so leaving one undeclared is not the same as it being absent: `position`
|
|
62
|
+
is `absolute`, `margin` is `auto` (which would centre the panel), both
|
|
63
|
+
max sizes are capped, and there is a ~3px border and 1em of padding.
|
|
64
|
+
*/
|
|
65
|
+
position: fixed;
|
|
66
|
+
inset-block: 0;
|
|
67
|
+
inset-inline-end: 0;
|
|
68
|
+
inset-inline-start: auto;
|
|
69
|
+
margin: 0;
|
|
70
|
+
/*
|
|
71
|
+
No padding of its own. The inline padding lives on the header, content and
|
|
72
|
+
footer instead, so the content pane spans the full panel width and its
|
|
73
|
+
scrollbar hugs the panel edge rather than sitting inside the padding.
|
|
74
|
+
*/
|
|
75
|
+
padding: 0;
|
|
76
|
+
border: none;
|
|
77
|
+
max-inline-size: none;
|
|
78
|
+
max-block-size: none;
|
|
79
|
+
|
|
80
|
+
/*
|
|
81
|
+
The UA also sets `height: fit-content`, which beats `inset-block: 0` and
|
|
82
|
+
leaves the panel only as tall as its content. `auto` hands the height back
|
|
83
|
+
to the insets, so the panel spans the full viewport.
|
|
84
|
+
*/
|
|
85
|
+
block-size: auto;
|
|
86
|
+
|
|
87
|
+
/* Full height comes from `inset-block`, avoiding mobile viewport-unit games. */
|
|
88
|
+
inline-size: min(var(--side-panel-inline-size), 100vw);
|
|
89
|
+
z-index: var(--side-panel-z-index);
|
|
90
|
+
border-radius: var(--side-panel-border-radius);
|
|
91
|
+
box-shadow: var(--side-panel-box-shadow);
|
|
92
|
+
|
|
93
|
+
/*
|
|
94
|
+
The panel is focused when it opens so that reading starts inside it, but
|
|
95
|
+
it is a container rather than a control: a ring drawn for a pointer
|
|
96
|
+
click would read as a border, so pointer focus gets none. A keyboard
|
|
97
|
+
user must still see where focus landed, so `:focus-visible` draws the
|
|
98
|
+
panel's own ring — the same tokens as the content pane, and inset for
|
|
99
|
+
the same reason: the panel spans the viewport edges, so an outset ring
|
|
100
|
+
would be clipped. Its focusable children keep their own either way.
|
|
101
|
+
*/
|
|
102
|
+
&:focus:not(:focus-visible) {
|
|
103
|
+
outline: none;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
&:focus-visible {
|
|
107
|
+
outline: var(--side-panel-focus-ring-width) solid
|
|
108
|
+
var(--side-panel-color-focus-ring);
|
|
109
|
+
outline-offset: calc(-1 * var(--side-panel-focus-ring-width));
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/*
|
|
113
|
+
The panel does not scroll; the content pane does. The panel is a
|
|
114
|
+
full-height flex column (`display: flex` itself is scoped to `[open]`
|
|
115
|
+
below — declaring it unconditionally would beat the user-agent's
|
|
116
|
+
`display: none` on a closed dialog). `flex-direction` sits here rather
|
|
117
|
+
than under `[open]`: it is inert while closed, and the base rule stays
|
|
118
|
+
the single place the stack direction is declared.
|
|
119
|
+
*/
|
|
120
|
+
flex-direction: column;
|
|
121
|
+
overflow: hidden;
|
|
122
|
+
|
|
123
|
+
/*
|
|
124
|
+
Two consequences worth knowing: the content pane is a scroll container,
|
|
125
|
+
so it clips its descendants, and the `transform` below makes the panel the
|
|
126
|
+
containing block for any `position: fixed` descendant. So an overlay that
|
|
127
|
+
escapes its box — ds-global's Popover and ContextualMenu position their
|
|
128
|
+
content with `position: fixed` — is both clipped and anchored to the
|
|
129
|
+
panel instead of the viewport. Documented in Provider.tsx; the fix belongs
|
|
130
|
+
upstream, in overlays that use the top layer rather than fixed
|
|
131
|
+
positioning.
|
|
132
|
+
*/
|
|
133
|
+
|
|
134
|
+
/*
|
|
135
|
+
Read the surface channels HERE rather than in :root. A custom property
|
|
136
|
+
substitutes where it is declared, and at :root the surface channels are
|
|
137
|
+
unset — so a :root intermediate would collapse to the fallback forever.
|
|
138
|
+
Popover/styles.css in ds-global documents the same trap.
|
|
139
|
+
*/
|
|
140
|
+
background-color: var(--surface-color-background, var(--color-background));
|
|
141
|
+
color: var(--surface-color-text, var(--color-text));
|
|
142
|
+
|
|
143
|
+
/* Closed state. `translate` is physical, so flip it when the panel docks left. */
|
|
144
|
+
--side-panel-translate-closed: 100%;
|
|
145
|
+
transform: translateX(var(--side-panel-translate-closed));
|
|
146
|
+
|
|
147
|
+
&:dir(rtl) {
|
|
148
|
+
--side-panel-translate-closed: -100%;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/*
|
|
152
|
+
`display` is transitioned discretely so the slide-out is seen before the
|
|
153
|
+
dialog is hidden. No `overlay` in the list: that property only applies to
|
|
154
|
+
top-layer elements, which a non-modal dialog is not.
|
|
155
|
+
*/
|
|
156
|
+
transition-property: transform, display;
|
|
157
|
+
transition-duration: var(--side-panel-transition-duration);
|
|
158
|
+
transition-timing-function: var(--side-panel-transition-easing-exit);
|
|
159
|
+
transition-behavior: allow-discrete;
|
|
160
|
+
|
|
161
|
+
/*
|
|
162
|
+
A closed <dialog> is `display: none` by user-agent rule. Declaring display
|
|
163
|
+
unconditionally would beat that and leave the panel permanently visible, so
|
|
164
|
+
the stack layout is scoped to the open state.
|
|
165
|
+
|
|
166
|
+
Header, content, footer, top to bottom. The header and footer are
|
|
167
|
+
`flex: none`; the content pane shrinks to fit and scrolls, so the two
|
|
168
|
+
pinned regions stay visible without sticky positioning.
|
|
169
|
+
*/
|
|
170
|
+
&[open] {
|
|
171
|
+
display: flex;
|
|
172
|
+
transform: translateX(0);
|
|
173
|
+
transition-timing-function: var(--side-panel-transition-easing-enter);
|
|
174
|
+
|
|
175
|
+
/* The frame the entry transition starts from. */
|
|
176
|
+
@starting-style {
|
|
177
|
+
transform: translateX(var(--side-panel-translate-closed));
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/* Respect a reduced-motion preference: appear, don't slide. */
|
|
182
|
+
@media (prefers-reduced-motion: reduce) {
|
|
183
|
+
transition-property: display;
|
|
184
|
+
|
|
185
|
+
&[open] {
|
|
186
|
+
@starting-style {
|
|
187
|
+
transform: translateX(0);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/lib/SidePanel/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useRef } from "react";
|
|
3
|
+
/**
|
|
4
|
+
* Wraps a trigger with a panel it toggles. Click the trigger → the panel
|
|
5
|
+
* opens; click it again → the panel closes.
|
|
6
|
+
*
|
|
7
|
+
* **The wrapped component must accept `onClick`** and forward it to the
|
|
8
|
+
* clickable element at its root — the HOC composes its toggle handler onto
|
|
9
|
+
* the trigger itself, with no wrapper element in between. An `onClick` the
|
|
10
|
+
* consumer passes keeps working: it runs first, then the panel toggles, unless
|
|
11
|
+
* the handler calls `event.preventDefault()`, which cancels the toggle.
|
|
12
|
+
*
|
|
13
|
+
* The second argument is a function: the HOC calls it with a props object
|
|
14
|
+
* carrying `close` and `ref`, and it returns a complete `<SidePanel>`
|
|
15
|
+
* element — sections, props and all:
|
|
16
|
+
*
|
|
17
|
+
* ```tsx
|
|
18
|
+
* const ToggleButton = withSidePanel(
|
|
19
|
+
* Button,
|
|
20
|
+
* ({ ref }) => (
|
|
21
|
+
* <SidePanel ref={ref}>
|
|
22
|
+
* <SidePanel.Header>Filters</SidePanel.Header>
|
|
23
|
+
* <SidePanel.Content>…</SidePanel.Content>
|
|
24
|
+
* </SidePanel>
|
|
25
|
+
* ),
|
|
26
|
+
* );
|
|
27
|
+
* <ToggleButton>Filters</ToggleButton>;
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* Everything `SidePanel` accepts lives on the element the function returns —
|
|
31
|
+
* `aria-label`, `onClose`, `className` — so the
|
|
32
|
+
* consumer sees the real panel, not an options bag. **One duty comes with
|
|
33
|
+
* that freedom: the factory must attach the `ref` it receives to the
|
|
34
|
+
* `<SidePanel>`** (`<SidePanel ref={ref}>`). The trigger toggles the panel
|
|
35
|
+
* through that ref — and `SidePanel` requires its `ref`, so a factory that
|
|
36
|
+
* forgets it fails to compile.
|
|
37
|
+
*
|
|
38
|
+
* **How it closes:** the trigger toggles it; the header's X button and
|
|
39
|
+
* Escape dismiss it too — the HOC has no state to be told about, the
|
|
40
|
+
* dialog's native open state is the only one. A footer button can close it
|
|
41
|
+
* as well — wire one to the `close` the function receives:
|
|
42
|
+
*
|
|
43
|
+
* ```tsx
|
|
44
|
+
* const machinePanel: WithSidePanelRender = ({ close, ref }) => (
|
|
45
|
+
* <SidePanel ref={ref}>
|
|
46
|
+
* <SidePanel.Header>Add machine</SidePanel.Header>
|
|
47
|
+
* <SidePanel.Footer>
|
|
48
|
+
* <Button onClick={close}>Cancel</Button>
|
|
49
|
+
* </SidePanel.Footer>
|
|
50
|
+
* </SidePanel>
|
|
51
|
+
* );
|
|
52
|
+
*
|
|
53
|
+
* const AddMachine = withSidePanel(Button, machinePanel);
|
|
54
|
+
* ```
|
|
55
|
+
*
|
|
56
|
+
* `withSidePanel` is meant for static content and belongs at module scope,
|
|
57
|
+
* called once. The function it is handed is invoked on every render of the
|
|
58
|
+
* trigger, but at module scope it can only see module-level values, so what
|
|
59
|
+
* it returns is the same on every render. If the panel must show data from
|
|
60
|
+
* the parent — for example a different machine depending on which is
|
|
61
|
+
* selected — don't call this HOC inside the component; compose `SidePanel`
|
|
62
|
+
* directly and drive it through its `ref`.
|
|
63
|
+
*
|
|
64
|
+
* A pure composition wrapper: it renders the wrapped component and the panel
|
|
65
|
+
* as siblings, so it carries no root element of its own. The panel is
|
|
66
|
+
* `position: fixed`, so where in the tree they sit does not move it — but
|
|
67
|
+
* providers above that spot must still cover the panel's content.
|
|
68
|
+
*
|
|
69
|
+
* `import { withSidePanel } from "@canonical/react-ds-app";`
|
|
70
|
+
*
|
|
71
|
+
* @param Trigger The component that toggles the panel (e.g. `Button`). It must accept `onClick` and forward it to its root element; clicking it toggles the panel.
|
|
72
|
+
* @param panel A {@link WithSidePanelRender} function: it receives `{ close, ref }`, must attach `ref` to the `<SidePanel>` it returns, and the trigger toggles it.
|
|
73
|
+
*/
|
|
74
|
+
const withSidePanel = (Trigger, panel) => {
|
|
75
|
+
const WrappedComponent = (props) => {
|
|
76
|
+
const panelRef = useRef(null);
|
|
77
|
+
// The contract: the HOC hands the factory its own ref, and the factory
|
|
78
|
+
// sets it on the `<SidePanel>` it returns. `SidePanel` requires its
|
|
79
|
+
// `ref`, so a factory that forgets `ref={ref}` fails to compile.
|
|
80
|
+
const panelElement = panel({
|
|
81
|
+
close: () => panelRef.current?.close(),
|
|
82
|
+
ref: panelRef,
|
|
83
|
+
});
|
|
84
|
+
return (_jsxs(_Fragment, { children: [_jsx(Trigger, { ...props, onClick: (event) => {
|
|
85
|
+
// The consumer's handler runs first; preventDefault() there
|
|
86
|
+
// cancels the toggle, as it cancels a native default action.
|
|
87
|
+
props.onClick?.(event);
|
|
88
|
+
if (event.defaultPrevented)
|
|
89
|
+
return;
|
|
90
|
+
panelRef.current?.toggle();
|
|
91
|
+
} }), panelElement] }));
|
|
92
|
+
};
|
|
93
|
+
// Set the displayName for easier debugging
|
|
94
|
+
WrappedComponent.displayName = `withSidePanel(${Trigger.displayName || Trigger.name || "Component"})`;
|
|
95
|
+
return WrappedComponent;
|
|
96
|
+
};
|
|
97
|
+
export default withSidePanel;
|
|
98
|
+
//# sourceMappingURL=withSidePanel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withSidePanel.js","sourceRoot":"","sources":["../../../../src/lib/SidePanel/withSidePanel.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAO/B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsEG;AACH,MAAM,aAAa,GAAG,CACpB,OAA8B,EAC9B,KAA0B,EACH,EAAE;IACzB,MAAM,gBAAgB,GAAG,CAAC,KAAa,EAAgB,EAAE;QACvD,MAAM,QAAQ,GAAG,MAAM,CAAkB,IAAI,CAAC,CAAC;QAE/C,uEAAuE;QACvE,oEAAoE;QACpE,iEAAiE;QACjE,MAAM,YAAY,GAAG,KAAK,CAAC;YACzB,KAAK,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,OAAO,EAAE,KAAK,EAAE;YACtC,GAAG,EAAE,QAAQ;SACd,CAAC,CAAC;QAEH,OAAO,CACL,8BACE,KAAC,OAAO,OACF,KAAK,EACT,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE;wBACjB,4DAA4D;wBAC5D,6DAA6D;wBAC7D,KAAK,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,CAAC;wBACvB,IAAI,KAAK,CAAC,gBAAgB;4BAAE,OAAO;wBACnC,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC;oBAC7B,CAAC,GACD,EACD,YAAY,IACZ,CACJ,CAAC;IACJ,CAAC,CAAC;IAEF,2CAA2C;IAC3C,gBAAgB,CAAC,WAAW,GAAG,iBAC7B,OAAO,CAAC,WAAW,IAAI,OAAO,CAAC,IAAI,IAAI,WACzC,GAAG,CAAC;IAEJ,OAAO,gBAAgB,CAAC;AAC1B,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
package/dist/esm/lib/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC;AAC7C,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC;AAC7C,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApplicationLayout.d.ts","sourceRoot":"","sources":["../../../../src/lib/ApplicationLayout/ApplicationLayout.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AACzD,OAAO,cAAc,CAAC;AAItB;;;;;;GAMG;AACH,QAAA,MAAM,iBAAiB,
|
|
1
|
+
{"version":3,"file":"ApplicationLayout.d.ts","sourceRoot":"","sources":["../../../../src/lib/ApplicationLayout/ApplicationLayout.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AACzD,OAAO,cAAc,CAAC;AAItB;;;;;;GAMG;AACH,QAAA,MAAM,iBAAiB,kDAKpB,sBAAsB,KAAG,KAAK,CAAC,YAUjC,CAAC;eAEa,iBAAiB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContentLayout.d.ts","sourceRoot":"","sources":["../../../../src/lib/ContentLayout/ContentLayout.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,cAAc,CAAC;AAItB;;;;;;;;GAQG;AACH,QAAA,MAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"ContentLayout.d.ts","sourceRoot":"","sources":["../../../../src/lib/ContentLayout/ContentLayout.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,cAAc,CAAC;AAItB;;;;;;;;GAQG;AACH,QAAA,MAAM,aAAa,4CAKhB,kBAAkB,KAAG,KAAK,CAAC,YAW7B,CAAC;eAEa,aAAa"}
|
|
@@ -4,7 +4,7 @@ import type { ComponentProps, ReactNode } from "react";
|
|
|
4
4
|
* The grid preset laying out the content items — `GridPreset` from
|
|
5
5
|
* \@canonical/ds-types, rendered by the `.grid` presets in
|
|
6
6
|
* \@canonical/styles: `responsive` (fixed-responsive, breakpoint-driven
|
|
7
|
-
* 4/8/
|
|
7
|
+
* 4/8/16 columns) or `intrinsic` (fluid auto-fill groups of four
|
|
8
8
|
* `minmax(--grid-col-min, 1fr)` columns).
|
|
9
9
|
*/
|
|
10
10
|
export type ContentLayoutGrid = GridPreset;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SideNavigation.d.ts","sourceRoot":"","sources":["../../../../src/lib/SideNavigation/SideNavigation.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,cAAc,CAAC;AAItB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,QAAA,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"SideNavigation.d.ts","sourceRoot":"","sources":["../../../../src/lib/SideNavigation/SideNavigation.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,cAAc,CAAC;AAItB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,QAAA,MAAM,cAAc,2MAiBjB,mBAAmB,KAAG,KAAK,CAAC,YAkF9B,CAAC;eAEa,cAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CollapseToggle.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/SideNavigation/common/CollapseToggle/CollapseToggle.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,cAAc,CAAC;AA8BtB;;;;;;;;;;;;;;GAcG;AACH,QAAA,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"CollapseToggle.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/SideNavigation/common/CollapseToggle/CollapseToggle.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,cAAc,CAAC;AA8BtB;;;;;;;;;;;;;;GAcG;AACH,QAAA,MAAM,cAAc,2BAGjB,mBAAmB,KAAG,KAAK,CAAC,YAO9B,CAAC;eAEa,cAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Content.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/SideNavigation/common/Content/Content.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,cAAc,CAAC;AAItB;;;;;;;;;;GAUG;AACH,QAAA,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"Content.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/SideNavigation/common/Content/Content.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,cAAc,CAAC;AAItB;;;;;;;;;;GAUG;AACH,QAAA,MAAM,OAAO,6DAMV,YAAY,KAAG,KAAK,CAAC,YAevB,CAAC;eAEa,OAAO"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContextSwitcher.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/SideNavigation/common/ContextSwitcher/ContextSwitcher.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAuB,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAC5E,OAAO,cAAc,CAAC;AAmDtB;;;;;;;;;;;;;GAaG;AACH,QAAA,MAAM,eAAe,
|
|
1
|
+
{"version":3,"file":"ContextSwitcher.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/SideNavigation/common/ContextSwitcher/ContextSwitcher.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAuB,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAC5E,OAAO,cAAc,CAAC;AAmDtB;;;;;;;;;;;;;GAaG;AACH,QAAA,MAAM,eAAe,iMAgBlB,oBAAoB,KAAG,KAAK,CAAC,YAkE/B,CAAC;eAEa,eAAe"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Footer.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/SideNavigation/common/Footer/Footer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,cAAc,CAAC;AA6DtB;;;;;;;;;;GAUG;AACH,QAAA,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"Footer.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/SideNavigation/common/Footer/Footer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,cAAc,CAAC;AA6DtB;;;;;;;;;;GAUG;AACH,QAAA,MAAM,MAAM,6DAMT,WAAW,KAAG,KAAK,CAAC,YAwCtB,CAAC;eAEa,MAAM"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Group.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/SideNavigation/common/Group/Group.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,cAAc,CAAC;AAItB;;;;;;GAMG;AACH,QAAA,MAAM,KAAK,
|
|
1
|
+
{"version":3,"file":"Group.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/SideNavigation/common/Group/Group.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,cAAc,CAAC;AAItB;;;;;;GAMG;AACH,QAAA,MAAM,KAAK,6CAKR,UAAU,KAAG,KAAK,CAAC,YAQrB,CAAC;eAEa,KAAK"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GroupHeader.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/SideNavigation/common/GroupHeader/GroupHeader.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,cAAc,CAAC;AAItB;;;;;;GAMG;AACH,QAAA,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"GroupHeader.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/SideNavigation/common/GroupHeader/GroupHeader.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,cAAc,CAAC;AAItB;;;;;;GAMG;AACH,QAAA,MAAM,WAAW,sCAId,gBAAgB,KAAG,KAAK,CAAC,YAW3B,CAAC;eAEa,WAAW"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Header.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/SideNavigation/common/Header/Header.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,cAAc,CAAC;AAItB;;;;;;;;GAQG;AACH,QAAA,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"Header.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/SideNavigation/common/Header/Header.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,cAAc,CAAC;AAItB;;;;;;;;GAQG;AACH,QAAA,MAAM,MAAM,0FAQT,WAAW,KAAG,KAAK,CAAC,YAyBtB,CAAC;eAEa,MAAM"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Item.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/SideNavigation/common/Item/Item.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,cAAc,CAAC;AAItB;;;;;;;;;;;;;GAaG;AACH,QAAA,MAAM,IAAI,
|
|
1
|
+
{"version":3,"file":"Item.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/SideNavigation/common/Item/Item.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,cAAc,CAAC;AAItB;;;;;;;;;;;;;GAaG;AACH,QAAA,MAAM,IAAI,wFAUP,SAAS,KAAG,KAAK,CAAC,YA6CpB,CAAC;eAEa,IAAI"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ItemButton.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/SideNavigation/common/ItemButton/ItemButton.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,cAAc,CAAC;AAItB;;;;;;;;;;GAUG;AACH,QAAA,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"ItemButton.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/SideNavigation/common/ItemButton/ItemButton.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,cAAc,CAAC;AAItB;;;;;;;;;;GAUG;AACH,QAAA,MAAM,UAAU,kDAMb,eAAe,KAAG,KAAK,CAAC,YAkB1B,CAAC;eAEa,UAAU"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ItemExpandable.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/SideNavigation/common/ItemExpandable/ItemExpandable.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,cAAc,CAAC;AAItB;;;;;;;;;;;;;;;;;;;GAmBG;AACH,QAAA,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"ItemExpandable.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/SideNavigation/common/ItemExpandable/ItemExpandable.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,cAAc,CAAC;AAItB;;;;;;;;;;;;;;;;;;;GAmBG;AACH,QAAA,MAAM,cAAc,sGASjB,mBAAmB,KAAG,KAAK,CAAC,YAqG9B,CAAC;eAEa,cAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NavTree.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/SideNavigation/common/NavTree/NavTree.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,cAAc,CAAC;AAoDtB;;;;;;;;;;;;GAYG;AACH,QAAA,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"NavTree.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/SideNavigation/common/NavTree/NavTree.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,cAAc,CAAC;AAoDtB;;;;;;;;;;;;GAYG;AACH,QAAA,MAAM,OAAO,6DAMV,YAAY,KAAG,KAAK,CAAC,YAuFvB,CAAC;eAEa,OAAO"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpItem.d.ts","sourceRoot":"","sources":["../../../../src/lib/SideNavigation/helpItem.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEpD;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"helpItem.d.ts","sourceRoot":"","sources":["../../../../src/lib/SideNavigation/helpItem.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEpD;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,cAAc,aACf,MAAM,YACP;IACP,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,iBAAiB,CAAC,OAAO,CAAC,CAAC;CAC9C,KACA,iBAaD,CAAC"}
|
package/dist/types/lib/SideNavigation/hooks/useCollapseShortcut/useCollapseShortcut.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCollapseShortcut.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/SideNavigation/hooks/useCollapseShortcut/useCollapseShortcut.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,wBAAwB,EACxB,yBAAyB,EAC1B,MAAM,YAAY,CAAC;AASpB;;;;;;;;;GASG;AACH,QAAA,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"useCollapseShortcut.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/SideNavigation/hooks/useCollapseShortcut/useCollapseShortcut.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,wBAAwB,EACxB,yBAAyB,EAC1B,MAAM,YAAY,CAAC;AASpB;;;;;;;;;GASG;AACH,QAAA,MAAM,mBAAmB,8BAGtB,wBAAwB,KAAG,yBAgC7B,CAAC;eAEa,mBAAmB"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { SidePanelContextValue } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* The shared side panel API threaded to the composed subcomponents. There is
|
|
4
|
+
* ONE panel instance per dialog — the subcomponents are render-only and read
|
|
5
|
+
* this context rather than being handed props, so a composed `SidePanel.Header`
|
|
6
|
+
* names the panel and closes it without the consumer wiring either by hand.
|
|
7
|
+
* Defaults to `null` so a part rendered outside a panel degrades rather than
|
|
8
|
+
* throws.
|
|
9
|
+
*/
|
|
10
|
+
declare const Context: import("react").Context<SidePanelContextValue | null>;
|
|
11
|
+
export default Context;
|
|
12
|
+
//# sourceMappingURL=Context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Context.d.ts","sourceRoot":"","sources":["../../../../src/lib/SidePanel/Context.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAExD;;;;;;;GAOG;AACH,QAAA,MAAM,OAAO,uDAAoD,CAAC;eAEnD,OAAO"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
import { Content, Footer, Header } from "./common/index.js";
|
|
3
|
+
import type { SidePanelProviderProps } from "./types.js";
|
|
4
|
+
import "./styles.css";
|
|
5
|
+
declare function Provider({ children, ...props }: SidePanelProviderProps): React.ReactElement;
|
|
6
|
+
declare namespace Provider {
|
|
7
|
+
export { Content };
|
|
8
|
+
export { Footer };
|
|
9
|
+
export { Header };
|
|
10
|
+
export var displayName: string;
|
|
11
|
+
}
|
|
12
|
+
export default Provider;
|
|
13
|
+
//# sourceMappingURL=Provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Provider.d.ts","sourceRoot":"","sources":["../../../../src/lib/SidePanel/Provider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE5D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AACzD,OAAO,cAAc,CAAC;0BA8DJ,EAChB,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,sBAAsB,GAAG,KAAK,CAAC,YAAY;;;;;;;eA4D/B,QAAQ"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
import type { ContentProps } from "./types.js";
|
|
3
|
+
import "./styles.css";
|
|
4
|
+
declare function Content({ children, className, fill, ...props }: ContentProps): React.ReactElement;
|
|
5
|
+
declare namespace Content {
|
|
6
|
+
var displayName: string;
|
|
7
|
+
}
|
|
8
|
+
export default Content;
|
|
9
|
+
//# sourceMappingURL=Content.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Content.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/SidePanel/common/Content/Content.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,cAAc,CAAC;yBAcL,EACf,QAAQ,EACR,SAAS,EACT,IAAY,EACZ,GAAG,KAAK,EACT,EAAE,YAAY,GAAG,KAAK,CAAC,YAAY;;;;eAoBrB,OAAO"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/SidePanel/common/Content/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,cAAc,CAAC;AAClD,YAAY,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC"}
|