@neo4j-ndl/react 4.9.16 → 4.9.18
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/lib/cjs/_common/readme-docs-page.js +55 -0
- package/lib/cjs/_common/readme-docs-page.js.map +1 -0
- package/lib/cjs/drawer/Drawer.js +144 -31
- package/lib/cjs/drawer/Drawer.js.map +1 -1
- package/lib/cjs/drawer/stories/drawer-full.story.js +3 -1
- package/lib/cjs/drawer/stories/drawer-full.story.js.map +1 -1
- package/lib/cjs/drawer/stories/drawer-not-closeable.story.js +2 -4
- package/lib/cjs/drawer/stories/drawer-not-closeable.story.js.map +1 -1
- package/lib/cjs/drawer/stories/drawer-overlay.story.js +5 -3
- package/lib/cjs/drawer/stories/drawer-overlay.story.js.map +1 -1
- package/lib/cjs/drawer/stories/drawer-portaled.story.js +8 -7
- package/lib/cjs/drawer/stories/drawer-portaled.story.js.map +1 -1
- package/lib/cjs/drawer/stories/drawer-push.story.js +4 -2
- package/lib/cjs/drawer/stories/drawer-push.story.js.map +1 -1
- package/lib/cjs/drawer/stories/drawer-resizable.story.js +5 -3
- package/lib/cjs/drawer/stories/drawer-resizable.story.js.map +1 -1
- package/lib/cjs/drawer/stories/drawer-right-side.story.js +4 -2
- package/lib/cjs/drawer/stories/drawer-right-side.story.js.map +1 -1
- package/lib/cjs/drawer/stories/drawer-scrollable.story.js +4 -2
- package/lib/cjs/drawer/stories/drawer-scrollable.story.js.map +1 -1
- package/lib/esm/_common/readme-docs-page.js +52 -0
- package/lib/esm/_common/readme-docs-page.js.map +1 -0
- package/lib/esm/drawer/Drawer.js +146 -33
- package/lib/esm/drawer/Drawer.js.map +1 -1
- package/lib/esm/drawer/stories/drawer-full.story.js +3 -1
- package/lib/esm/drawer/stories/drawer-full.story.js.map +1 -1
- package/lib/esm/drawer/stories/drawer-not-closeable.story.js +3 -5
- package/lib/esm/drawer/stories/drawer-not-closeable.story.js.map +1 -1
- package/lib/esm/drawer/stories/drawer-overlay.story.js +5 -3
- package/lib/esm/drawer/stories/drawer-overlay.story.js.map +1 -1
- package/lib/esm/drawer/stories/drawer-portaled.story.js +10 -9
- package/lib/esm/drawer/stories/drawer-portaled.story.js.map +1 -1
- package/lib/esm/drawer/stories/drawer-push.story.js +4 -2
- package/lib/esm/drawer/stories/drawer-push.story.js.map +1 -1
- package/lib/esm/drawer/stories/drawer-resizable.story.js +5 -3
- package/lib/esm/drawer/stories/drawer-resizable.story.js.map +1 -1
- package/lib/esm/drawer/stories/drawer-right-side.story.js +4 -2
- package/lib/esm/drawer/stories/drawer-right-side.story.js.map +1 -1
- package/lib/esm/drawer/stories/drawer-scrollable.story.js +4 -2
- package/lib/esm/drawer/stories/drawer-scrollable.story.js.map +1 -1
- package/lib/types/_common/readme-docs-page.d.ts +23 -0
- package/lib/types/_common/readme-docs-page.d.ts.map +1 -0
- package/lib/types/drawer/Drawer.d.ts +32 -7
- package/lib/types/drawer/Drawer.d.ts.map +1 -1
- package/lib/types/drawer/stories/drawer-full.story.d.ts.map +1 -1
- package/lib/types/drawer/stories/drawer-not-closeable.story.d.ts.map +1 -1
- package/lib/types/drawer/stories/drawer-overlay.story.d.ts.map +1 -1
- package/lib/types/drawer/stories/drawer-portaled.story.d.ts.map +1 -1
- package/lib/types/drawer/stories/drawer-push.story.d.ts.map +1 -1
- package/lib/types/drawer/stories/drawer-resizable.story.d.ts.map +1 -1
- package/lib/types/drawer/stories/drawer-right-side.story.d.ts.map +1 -1
- package/lib/types/drawer/stories/drawer-scrollable.story.d.ts.map +1 -1
- package/package.json +3 -2
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createReadmeDocsPage = createReadmeDocsPage;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
* Copyright (c) "Neo4j"
|
|
8
|
+
* Neo4j Sweden AB [http://neo4j.com]
|
|
9
|
+
*
|
|
10
|
+
* This file is part of Neo4j.
|
|
11
|
+
*
|
|
12
|
+
* Neo4j is free software: you can redistribute it and/or modify
|
|
13
|
+
* it under the terms of the GNU General Public License as published by
|
|
14
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
15
|
+
* (at your option) any later version.
|
|
16
|
+
*
|
|
17
|
+
* This program is distributed in the hope that it will be useful,
|
|
18
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
19
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
20
|
+
* GNU General Public License for more details.
|
|
21
|
+
*
|
|
22
|
+
* You should have received a copy of the GNU General Public License
|
|
23
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
24
|
+
*/
|
|
25
|
+
const blocks_1 = require("@storybook/addon-docs/blocks");
|
|
26
|
+
/**
|
|
27
|
+
* Creates a Storybook docs page component that renders markdown content (e.g. a README.md).
|
|
28
|
+
*
|
|
29
|
+
* Requires the `autodocs` tag on the component meta to create a Docs entry in the sidebar
|
|
30
|
+
* (the global preview config disables autodocs with `!autodocs`).
|
|
31
|
+
*
|
|
32
|
+
* Usage in a *.stories.tsx file:
|
|
33
|
+
* ```ts
|
|
34
|
+
* import ReadmeContent from '../README.md?raw';
|
|
35
|
+
* import { createReadmeDocsPage } from '../../_common/readme-docs-page';
|
|
36
|
+
*
|
|
37
|
+
* const meta: Meta = {
|
|
38
|
+
* // ...
|
|
39
|
+
* tags: ['docsPage', 'autodocs'],
|
|
40
|
+
* parameters: {
|
|
41
|
+
* docs: { page: createReadmeDocsPage(ReadmeContent) },
|
|
42
|
+
* },
|
|
43
|
+
* };
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
function stripMarkdownComments(content) {
|
|
47
|
+
return content.replace(/^\[\/\/\]: #.*\n*/gm, '');
|
|
48
|
+
}
|
|
49
|
+
function createReadmeDocsPage(markdownContent) {
|
|
50
|
+
const cleaned = stripMarkdownComments(markdownContent);
|
|
51
|
+
return function ReadmeDocsPage() {
|
|
52
|
+
return (0, jsx_runtime_1.jsx)(blocks_1.Markdown, { children: cleaned });
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=readme-docs-page.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"readme-docs-page.js","sourceRoot":"","sources":["../../../src/_common/readme-docs-page.tsx"],"names":[],"mappings":";;AA8CA,oDAKC;;AAnDD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,yDAAwD;AAExD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,SAAS,qBAAqB,CAAC,OAAe;IAC5C,OAAO,OAAO,CAAC,OAAO,CAAC,qBAAqB,EAAE,EAAE,CAAC,CAAC;AACpD,CAAC;AAED,SAAgB,oBAAoB,CAAC,eAAuB;IAC1D,MAAM,OAAO,GAAG,qBAAqB,CAAC,eAAe,CAAC,CAAC;IACvD,OAAO,SAAS,cAAc;QAC5B,OAAO,uBAAC,iBAAQ,cAAE,OAAO,GAAY,CAAC;IACxC,CAAC,CAAC;AACJ,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport { Markdown } from '@storybook/addon-docs/blocks';\n\n/**\n * Creates a Storybook docs page component that renders markdown content (e.g. a README.md).\n *\n * Requires the `autodocs` tag on the component meta to create a Docs entry in the sidebar\n * (the global preview config disables autodocs with `!autodocs`).\n *\n * Usage in a *.stories.tsx file:\n * ```ts\n * import ReadmeContent from '../README.md?raw';\n * import { createReadmeDocsPage } from '../../_common/readme-docs-page';\n *\n * const meta: Meta = {\n * // ...\n * tags: ['docsPage', 'autodocs'],\n * parameters: {\n * docs: { page: createReadmeDocsPage(ReadmeContent) },\n * },\n * };\n * ```\n */\nfunction stripMarkdownComments(content: string): string {\n return content.replace(/^\\[\\/\\/\\]: #.*\\n*/gm, '');\n}\n\nexport function createReadmeDocsPage(markdownContent: string) {\n const cleaned = stripMarkdownComments(markdownContent);\n return function ReadmeDocsPage() {\n return <Markdown>{cleaned}</Markdown>;\n };\n}\n"]}
|
package/lib/cjs/drawer/Drawer.js
CHANGED
|
@@ -40,55 +40,168 @@ const react_1 = require("@floating-ui/react");
|
|
|
40
40
|
const classnames_1 = __importDefault(require("classnames"));
|
|
41
41
|
const re_resizable_1 = require("re-resizable");
|
|
42
42
|
const react_2 = require("react");
|
|
43
|
+
const utils_1 = require("../_common/utils");
|
|
43
44
|
const clean_icon_button_1 = require("../clean-icon-button");
|
|
44
45
|
const conditional_wrap_1 = require("../conditional-wrap");
|
|
45
46
|
const icons_1 = require("../icons");
|
|
46
47
|
const typography_1 = require("../typography");
|
|
48
|
+
const KEYBOARD_RESIZE_STEP_PX = 16;
|
|
49
|
+
function parsePixelSize(value) {
|
|
50
|
+
if (value === undefined) {
|
|
51
|
+
return undefined;
|
|
52
|
+
}
|
|
53
|
+
if (typeof value === 'number') {
|
|
54
|
+
return value;
|
|
55
|
+
}
|
|
56
|
+
const parsed = parseInt(value.replace(/px$/i, ''), 10);
|
|
57
|
+
return Number.isNaN(parsed) ? undefined : parsed;
|
|
58
|
+
}
|
|
59
|
+
function DrawerResizeHandle({ handleSide, onResizeBy, valueMax, valueMin, valueNow, }) {
|
|
60
|
+
const handleKeyDown = (0, react_2.useCallback)((e) => {
|
|
61
|
+
const isArrowKey = e.key === 'ArrowLeft' || e.key === 'ArrowRight';
|
|
62
|
+
if (isArrowKey) {
|
|
63
|
+
e.preventDefault();
|
|
64
|
+
const delta = handleSide === 'right'
|
|
65
|
+
? e.key === 'ArrowRight'
|
|
66
|
+
? KEYBOARD_RESIZE_STEP_PX
|
|
67
|
+
: -KEYBOARD_RESIZE_STEP_PX
|
|
68
|
+
: e.key === 'ArrowLeft'
|
|
69
|
+
? KEYBOARD_RESIZE_STEP_PX
|
|
70
|
+
: -KEYBOARD_RESIZE_STEP_PX;
|
|
71
|
+
onResizeBy(delta);
|
|
72
|
+
}
|
|
73
|
+
}, [handleSide, onResizeBy]);
|
|
74
|
+
return (
|
|
75
|
+
/* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions -- Resize handle is focusable for keyboard resize. */
|
|
76
|
+
(0, jsx_runtime_1.jsx)("div", { "aria-label": `Resize drawer with arrow keys. Handle on ${handleSide}.`, "aria-orientation": "vertical", "aria-valuemax": valueMax, "aria-valuemin": valueMin, "aria-valuenow": valueNow !== null && valueNow !== void 0 ? valueNow : 0, "aria-valuetext": `drawer width ${valueNow !== null && valueNow !== void 0 ? valueNow : 0}px`, className: "ndl-drawer-resize-handle", "data-drawer-handle": handleSide, onKeyDown: handleKeyDown, role: "separator", style: { height: '100%', width: '100%' },
|
|
77
|
+
// eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex -- Resize handle is focusable for keyboard resize.
|
|
78
|
+
tabIndex: 0 }));
|
|
79
|
+
}
|
|
47
80
|
const DrawerComponent = function DrawerComponent(_a) {
|
|
48
|
-
var { children, className = '', isExpanded, onExpandedChange, position = 'left', type = 'overlay', isResizeable = false, resizeableProps, isCloseable = true, isPortaled = false, portalProps = {}, htmlAttributes, style, ref, as } = _a, restProps = __rest(_a, ["children", "className", "isExpanded", "onExpandedChange", "position", "type", "isResizeable", "resizeableProps", "isCloseable", "isPortaled", "portalProps", "htmlAttributes", "style", "ref", "as"]);
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
|
|
81
|
+
var { children, className = '', isExpanded, onExpandedChange, position = 'left', type = 'overlay', isResizeable = false, resizeableProps, isCloseable = true, isPortaled = false, portalProps = {}, closeOnEscape = type === 'modal' ? true : false, closeOnClickOutside = false, closeOnFocusOut = false, ariaLabel, htmlAttributes, style, ref, as } = _a, restProps = __rest(_a, ["children", "className", "isExpanded", "onExpandedChange", "position", "type", "isResizeable", "resizeableProps", "isCloseable", "isPortaled", "portalProps", "closeOnEscape", "closeOnClickOutside", "closeOnFocusOut", "ariaLabel", "htmlAttributes", "style", "ref", "as"]);
|
|
82
|
+
const resizableRef = (0, react_2.useRef)(null);
|
|
83
|
+
const [resizeWidth, setResizeWidth] = (0, react_2.useState)(0);
|
|
84
|
+
if ((type === 'modal' || type === 'overlay') && !ariaLabel) {
|
|
85
|
+
(0, utils_1.needleWarningMessage)('A Drawer should have an aria-label when type is "modal" or "overlay" to be accessible.');
|
|
86
|
+
}
|
|
87
|
+
const { refs, context } = (0, react_1.useFloating)({
|
|
88
|
+
onOpenChange: onExpandedChange,
|
|
89
|
+
open: isExpanded,
|
|
90
|
+
});
|
|
91
|
+
/** Dismiss (escape + click outside) applies to portaled overlay and to non-portaled overlay. */
|
|
92
|
+
const shouldUseDismiss = type === 'modal' ||
|
|
93
|
+
(type === 'overlay' && !isPortaled && isExpanded) ||
|
|
94
|
+
(type === 'overlay' && isPortaled);
|
|
95
|
+
const dismiss = (0, react_1.useDismiss)(context, {
|
|
96
|
+
enabled: shouldUseDismiss,
|
|
97
|
+
escapeKey: closeOnEscape,
|
|
98
|
+
outsidePress: closeOnClickOutside,
|
|
99
|
+
});
|
|
100
|
+
const role = (0, react_1.useRole)(context, {
|
|
101
|
+
enabled: type === 'modal' || type === 'overlay',
|
|
102
|
+
role: 'dialog',
|
|
103
|
+
});
|
|
104
|
+
const { getFloatingProps } = (0, react_1.useInteractions)([dismiss, role]);
|
|
105
|
+
/** When overlay is open and not portaled, drawer gets the floating ref + props; when portaled, the portal layer gets them. */
|
|
106
|
+
const shouldApplyFloatingPropsOnDrawer = type === 'overlay' && isExpanded && !isPortaled;
|
|
107
|
+
const floatingPropsForDrawer = shouldApplyFloatingPropsOnDrawer
|
|
108
|
+
? getFloatingProps(htmlAttributes !== null && htmlAttributes !== void 0 ? htmlAttributes : {})
|
|
109
|
+
: {};
|
|
110
|
+
const resizableMergedRef = (0, react_1.useMergeRefs)([
|
|
111
|
+
resizableRef,
|
|
112
|
+
ref,
|
|
113
|
+
shouldApplyFloatingPropsOnDrawer
|
|
114
|
+
? refs.setFloating
|
|
115
|
+
: null,
|
|
116
|
+
shouldApplyFloatingPropsOnDrawer
|
|
117
|
+
? refs.setReference
|
|
118
|
+
: null,
|
|
119
|
+
]);
|
|
120
|
+
const componentMergedRef = (0, react_1.useMergeRefs)([
|
|
121
|
+
shouldApplyFloatingPropsOnDrawer ? refs.setFloating : null,
|
|
122
|
+
shouldApplyFloatingPropsOnDrawer ? refs.setReference : null,
|
|
123
|
+
ref,
|
|
124
|
+
]);
|
|
125
|
+
const handleResizeBy = (0, react_2.useCallback)((delta) => {
|
|
126
|
+
if (!resizableRef.current) {
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
const current = resizableRef.current.size;
|
|
130
|
+
const min = parsePixelSize(resizeableProps === null || resizeableProps === void 0 ? void 0 : resizeableProps.minWidth);
|
|
131
|
+
const max = parsePixelSize(resizeableProps === null || resizeableProps === void 0 ? void 0 : resizeableProps.maxWidth);
|
|
132
|
+
const newWidth = Math.max(min !== null && min !== void 0 ? min : 0, Math.min(max !== null && max !== void 0 ? max : Number.POSITIVE_INFINITY, current.width + delta));
|
|
133
|
+
resizableRef.current.updateSize({
|
|
134
|
+
height: '100%',
|
|
135
|
+
width: newWidth,
|
|
136
|
+
});
|
|
137
|
+
setResizeWidth(newWidth);
|
|
138
|
+
}, [resizeableProps === null || resizeableProps === void 0 ? void 0 : resizeableProps.minWidth, resizeableProps === null || resizeableProps === void 0 ? void 0 : resizeableProps.maxWidth]);
|
|
139
|
+
const handleResize = (0, react_2.useCallback)((event, direction, elementRef, delta) => {
|
|
140
|
+
var _a;
|
|
141
|
+
setResizeWidth(elementRef.offsetWidth);
|
|
142
|
+
(_a = resizeableProps === null || resizeableProps === void 0 ? void 0 : resizeableProps.onResize) === null || _a === void 0 ? void 0 : _a.call(resizeableProps, event, direction, elementRef, delta);
|
|
143
|
+
}, [resizeableProps]);
|
|
144
|
+
(0, react_2.useEffect)(() => {
|
|
145
|
+
if (!isResizeable || !resizableRef.current) {
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
const width = resizableRef.current.size.width;
|
|
149
|
+
if (width > 0) {
|
|
150
|
+
setResizeWidth(width);
|
|
52
151
|
}
|
|
152
|
+
}, [isResizeable]);
|
|
153
|
+
const setOnExpandedChange = (0, react_2.useCallback)(() => {
|
|
154
|
+
onExpandedChange === null || onExpandedChange === void 0 ? void 0 : onExpandedChange(!isExpanded);
|
|
53
155
|
}, [isExpanded, onExpandedChange]);
|
|
54
156
|
const classes = (0, classnames_1.default)('ndl-drawer', className, {
|
|
55
|
-
'ndl-drawer-expanded': isExpanded,
|
|
56
157
|
'ndl-drawer-left': position === 'left',
|
|
158
|
+
'ndl-drawer-modal': type === 'modal',
|
|
57
159
|
'ndl-drawer-overlay': type === 'overlay',
|
|
160
|
+
'ndl-drawer-portaled': isPortaled && type === 'overlay',
|
|
58
161
|
'ndl-drawer-push': type === 'push',
|
|
59
162
|
'ndl-drawer-right': position === 'right',
|
|
60
163
|
});
|
|
61
164
|
const resizableStylePosition = type === 'overlay' ? 'absolute' : 'relative';
|
|
62
|
-
const shouldRenderInPortal = isPortaled && type === 'overlay';
|
|
63
165
|
const Component = as !== null && as !== void 0 ? as : 'div';
|
|
64
|
-
const Close = () => ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: isCloseable && ((0, jsx_runtime_1.jsx)(clean_icon_button_1.CleanIconButton, { className: "ndl-drawer-close-button", onClick: setOnExpandedChange, description: null, size: "medium", htmlAttributes: {
|
|
166
|
+
const Close = () => ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (isCloseable || type === 'modal') && ((0, jsx_runtime_1.jsx)(clean_icon_button_1.CleanIconButton, { className: "ndl-drawer-close-button", onClick: setOnExpandedChange, description: null, size: "medium", htmlAttributes: {
|
|
65
167
|
'aria-label': 'Close',
|
|
66
168
|
}, children: (0, jsx_runtime_1.jsx)(icons_1.XMarkIconOutline, {}) })) }));
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
169
|
+
const resizableContent = ((0, jsx_runtime_1.jsxs)(re_resizable_1.Resizable, Object.assign({ as: Component, defaultSize: {
|
|
170
|
+
height: '100%',
|
|
171
|
+
width: 'auto',
|
|
172
|
+
} }, resizeableProps, { className: classes, style: Object.assign(Object.assign({ position: resizableStylePosition }, style), resizeableProps === null || resizeableProps === void 0 ? void 0 : resizeableProps.style), boundsByDirection: true, bounds: "parent", handleStyles: Object.assign(Object.assign({}, (position === 'left' && { right: { right: '-8px' } })), (position === 'right' && { left: { left: '-8px' } })), enable: {
|
|
173
|
+
bottom: false,
|
|
174
|
+
bottomLeft: false,
|
|
175
|
+
bottomRight: false,
|
|
176
|
+
left: position === 'right',
|
|
177
|
+
right: position === 'left',
|
|
178
|
+
top: false,
|
|
179
|
+
topLeft: false,
|
|
180
|
+
topRight: false,
|
|
181
|
+
}, handleComponent: position === 'left'
|
|
182
|
+
? {
|
|
183
|
+
right: ((0, jsx_runtime_1.jsx)(DrawerResizeHandle, { handleSide: "right", onResizeBy: handleResizeBy, valueMax: parsePixelSize(resizeableProps === null || resizeableProps === void 0 ? void 0 : resizeableProps.maxWidth), valueMin: parsePixelSize(resizeableProps === null || resizeableProps === void 0 ? void 0 : resizeableProps.minWidth), valueNow: resizeWidth })),
|
|
184
|
+
}
|
|
185
|
+
: {
|
|
186
|
+
left: ((0, jsx_runtime_1.jsx)(DrawerResizeHandle, { handleSide: "left", onResizeBy: handleResizeBy, valueMax: parsePixelSize(resizeableProps === null || resizeableProps === void 0 ? void 0 : resizeableProps.maxWidth), valueMin: parsePixelSize(resizeableProps === null || resizeableProps === void 0 ? void 0 : resizeableProps.minWidth), valueNow: resizeWidth })),
|
|
187
|
+
}, onResize: handleResize, ref: resizableMergedRef }, restProps, floatingPropsForDrawer, htmlAttributes, { children: [(0, jsx_runtime_1.jsx)(Close, {}), children] })));
|
|
188
|
+
const regularContent = ((0, jsx_runtime_1.jsxs)(Component, Object.assign({ className: (0, classnames_1.default)(classes), style: style, ref: componentMergedRef }, restProps, floatingPropsForDrawer, htmlAttributes, { children: [(0, jsx_runtime_1.jsx)(Close, {}), children] })));
|
|
189
|
+
/** what content to render*/
|
|
190
|
+
const content = isResizeable ? resizableContent : regularContent;
|
|
191
|
+
/** if the drawer is not expanded, don't render anything */
|
|
192
|
+
if (isExpanded === false) {
|
|
193
|
+
return null;
|
|
194
|
+
}
|
|
195
|
+
/** modal behavior */
|
|
196
|
+
if (type === 'modal') {
|
|
197
|
+
return ((0, jsx_runtime_1.jsxs)(react_1.FloatingPortal, Object.assign({}, portalProps, { children: [(0, jsx_runtime_1.jsx)(react_1.FloatingOverlay, { className: "ndl-drawer-overlay-root", lockScroll: true }), (0, jsx_runtime_1.jsx)(react_1.FloatingFocusManager, { context: context, modal: true, returnFocus: true, children: (0, jsx_runtime_1.jsx)("div", Object.assign({ ref: refs.setFloating }, getFloatingProps(), { "aria-label": ariaLabel, "aria-modal": "true", children: content })) })] })));
|
|
198
|
+
}
|
|
199
|
+
/** overlay focus behavior */
|
|
200
|
+
if (type === 'overlay') {
|
|
201
|
+
return ((0, jsx_runtime_1.jsx)(conditional_wrap_1.ConditionalWrap, { shouldWrap: isPortaled, wrap: (wrapChildren) => ((0, jsx_runtime_1.jsx)(react_1.FloatingPortal, Object.assign({ preserveTabOrder: true }, portalProps, { children: wrapChildren }))), children: (0, jsx_runtime_1.jsx)(react_1.FloatingFocusManager, { context: context, modal: false, returnFocus: true, closeOnFocusOut: closeOnFocusOut, children: content }) }));
|
|
90
202
|
}
|
|
91
|
-
|
|
203
|
+
/** regular push behavior */
|
|
204
|
+
return content;
|
|
92
205
|
};
|
|
93
206
|
DrawerComponent.displayName = 'Drawer';
|
|
94
207
|
const DrawerHeader = (_a) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Drawer.js","sourceRoot":"","sources":["../../../src/drawer/Drawer.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,8CAAoD;AACpD,4DAAoC;AACpC,+CAA8D;AAE9D,iCAAyD;AAMzD,4DAAuD;AACvD,0DAAsD;AACtD,oCAA4C;AAC5C,8CAA2C;AA4C3C,MAAM,eAAe,GAAG,SAAS,eAAe,CAE9C,EAiBuC;QAjBvC,EACA,QAAQ,EACR,SAAS,GAAG,EAAE,EACd,UAAU,EACV,gBAAgB,EAChB,QAAQ,GAAG,MAAM,EACjB,IAAI,GAAG,SAAS,EAChB,YAAY,GAAG,KAAK,EACpB,eAAe,EACf,WAAW,GAAG,IAAI,EAClB,UAAU,GAAG,KAAK,EAClB,WAAW,GAAG,EAAE,EAChB,cAAc,EACd,KAAK,EACL,GAAG,EACH,EAAE,OAEqC,EADpC,SAAS,cAhBZ,sMAiBD,CADa;IAEZ,MAAM,mBAAmB,GAAG,IAAA,mBAAW,EAAC,GAAG,EAAE;QAC3C,IAAI,gBAAgB,EAAE,CAAC;YACrB,gBAAgB,CAAC,CAAC,UAAU,CAAC,CAAC;QAChC,CAAC;IACH,CAAC,EAAE,CAAC,UAAU,EAAE,gBAAgB,CAAC,CAAC,CAAC;IAEnC,MAAM,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4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport { FloatingPortal } from '@floating-ui/react';\nimport classNames from 'classnames';\nimport { Resizable, type ResizableProps } from 're-resizable';\nimport type React from 'react';\nimport { type ComponentProps, useCallback } from 'react';\n\nimport {\n type HtmlAttributes,\n type PolymorphicCommonProps,\n} from '../_common/types';\nimport { CleanIconButton } from '../clean-icon-button';\nimport { ConditionalWrap } from '../conditional-wrap';\nimport { XMarkIconOutline } from '../icons';\nimport { Typography } from '../typography';\n\ntype DrawerPosition = 'left' | 'right';\n\ntype DrawerType = 'overlay' | 'push';\n\ntype DrawerProps = {\n /** Controls whether the drawer is open (expanded) or closed (collapsed). */\n isExpanded: boolean;\n\n /** Callback functions fired when the drawer's expanded state changes. */\n onExpandedChange?: (expanded: boolean) => void;\n\n /** Position where the drawer appears on screen. By default, it appears from the left. */\n position?: DrawerPosition;\n\n /** How the drawer affects the layout of sibling content. By default, it overlays content. */\n type?: DrawerType;\n\n /** Enables horizontal resizing of the drawer, by default it is not resizable. */\n isResizeable?: boolean;\n\n /** To use this prop the isResizeable prop must be set to true. For overriding the third party library props: https://github.com/bokuweb/re-resizable */\n resizeableProps?: ResizableProps;\n\n /** Whether a close button (X) is displayed in the drawer. */\n isCloseable?: boolean;\n\n /** Whether to portal the content */\n isPortaled?: boolean;\n\n /** The content to display within the drawer. */\n children: React.ReactNode;\n\n /** Additional CSS classes to apply to the drawer container. */\n className?: string;\n\n /**\n * Props to pass to the portal from @floating-ui/react FloatingPortal\n * @see https://floating-ui.com/docs/floatingportal\n */\n portalProps?: ComponentProps<typeof FloatingPortal>;\n};\n\nconst DrawerComponent = function DrawerComponent<\n T extends React.ElementType = 'div',\n>({\n children,\n className = '',\n isExpanded,\n onExpandedChange,\n position = 'left',\n type = 'overlay',\n isResizeable = false,\n resizeableProps,\n isCloseable = true,\n isPortaled = false,\n portalProps = {},\n htmlAttributes,\n style,\n ref,\n as,\n ...restProps\n}: PolymorphicCommonProps<T, DrawerProps>) {\n const setOnExpandedChange = useCallback(() => {\n if (onExpandedChange) {\n onExpandedChange(!isExpanded);\n }\n }, [isExpanded, onExpandedChange]);\n\n const classes = classNames('ndl-drawer', className, {\n 'ndl-drawer-expanded': isExpanded,\n 'ndl-drawer-left': position === 'left',\n 'ndl-drawer-overlay': type === 'overlay',\n 'ndl-drawer-push': type === 'push',\n 'ndl-drawer-right': position === 'right',\n });\n\n const resizableStylePosition = type === 'overlay' ? 'absolute' : 'relative';\n const shouldRenderInPortal = isPortaled && type === 'overlay';\n const Component = as ?? 'div';\n\n const Close = () => (\n <>\n {isCloseable && (\n <CleanIconButton\n className=\"ndl-drawer-close-button\"\n onClick={setOnExpandedChange}\n description={null}\n size=\"medium\"\n htmlAttributes={{\n 'aria-label': 'Close',\n }}\n >\n <XMarkIconOutline />\n </CleanIconButton>\n )}\n </>\n );\n\n if (isResizeable) {\n return (\n <ConditionalWrap\n shouldWrap={shouldRenderInPortal}\n wrap={(wrapChildren) => (\n <FloatingPortal preserveTabOrder={true} {...portalProps}>\n {wrapChildren}\n </FloatingPortal>\n )}\n >\n <Resizable\n as={Component}\n defaultSize={{\n height: '100%',\n width: 'auto',\n }}\n {...resizeableProps}\n className={classes}\n style={{\n position: resizableStylePosition,\n ...style,\n ...resizeableProps?.style,\n }}\n boundsByDirection={true}\n bounds=\"parent\"\n handleStyles={{\n /*\n * adding a small offset to the handle to make it easier to click\n * if the content of the drawer is scrollable, most noticeable if not using\n * a mouse on mac or chrome on windows with the fluent scrollbars\n */\n right: {\n right: '-8px',\n },\n }}\n enable={{\n bottom: false,\n bottomLeft: false,\n bottomRight: false,\n left: position === 'right',\n right: position === 'left',\n top: false,\n topLeft: false,\n topRight: false,\n }}\n ref={ref}\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n <Close />\n </Resizable>\n </ConditionalWrap>\n );\n }\n\n return (\n <ConditionalWrap\n shouldWrap={shouldRenderInPortal}\n wrap={(wrapChildren) => (\n <FloatingPortal preserveTabOrder={true} {...portalProps}>\n {wrapChildren}\n </FloatingPortal>\n )}\n >\n <Component\n className={classes}\n style={style}\n ref={ref}\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n <Close />\n </Component>\n </ConditionalWrap>\n );\n};\n\nDrawerComponent.displayName = 'Drawer';\n\ntype DrawerHeaderProps = {\n children: React.ReactNode;\n className?: string;\n htmlAttributes?: HtmlAttributes<'h5'>;\n};\n\nconst DrawerHeader = ({\n children,\n className = '',\n htmlAttributes,\n ...restProps\n}: DrawerHeaderProps) => {\n const classes = classNames('ndl-drawer-header', className);\n\n if (typeof children === 'string' || typeof children === 'number') {\n return (\n <Typography\n className={classes}\n variant=\"title-3\"\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n </Typography>\n );\n }\n\n return (\n <div className={classes} {...restProps} {...htmlAttributes}>\n {children}\n </div>\n );\n};\n\ntype DrawerActionsProps = {\n children: React.ReactNode;\n className?: string;\n htmlAttributes?: HtmlAttributes<'div'>;\n};\n\nconst DrawerActions = ({\n children,\n className = '',\n htmlAttributes,\n ...restProps\n}: DrawerActionsProps) => {\n const classes = classNames('ndl-drawer-actions', className);\n\n return (\n <div className={classes} {...restProps} {...htmlAttributes}>\n {children}\n </div>\n );\n};\n\ntype DrawerBodyProps = {\n children: React.ReactNode;\n className?: string;\n htmlAttributes?: HtmlAttributes<'div'>;\n};\n\nconst DrawerBody = ({\n children,\n className = '',\n htmlAttributes,\n ...restProps\n}: DrawerBodyProps) => {\n const classes = classNames('ndl-drawer-body', className);\n\n return (\n <div className=\"ndl-drawer-body-wrapper\">\n <div className={classes} {...restProps} {...htmlAttributes}>\n {children}\n </div>\n </div>\n );\n};\n\nconst Drawer = Object.assign(DrawerComponent, {\n Actions: DrawerActions,\n Body: DrawerBody,\n Header: DrawerHeader,\n});\n\nexport { Drawer };\n"]}
|
|
1
|
+
{"version":3,"file":"Drawer.js","sourceRoot":"","sources":["../../../src/drawer/Drawer.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,8CAS4B;AAC5B,4DAAoC;AACpC,+CAA8D;AAE9D,iCAMe;AAMf,4CAAwD;AACxD,4DAAuD;AACvD,0DAAsD;AACtD,oCAA4C;AAC5C,8CAA2C;AA8E3C,MAAM,uBAAuB,GAAG,EAAE,CAAC;AAEnC,SAAS,cAAc,CACrB,KAAkC;IAElC,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,KAAK,CAAC;IACf,CAAC;IACD,MAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;IACvD,OAAO,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC;AACnD,CAAC;AAgBD,SAAS,kBAAkB,CAAC,EAC1B,UAAU,EACV,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,QAAQ,GACgB;IACxB,MAAM,aAAa,GAAG,IAAA,mBAAW,EAC/B,CAAC,CAAsC,EAAE,EAAE;QACzC,MAAM,UAAU,GAAG,CAAC,CAAC,GAAG,KAAK,WAAW,IAAI,CAAC,CAAC,GAAG,KAAK,YAAY,CAAC;QACnE,IAAI,UAAU,EAAE,CAAC;YACf,CAAC,CAAC,cAAc,EAAE,CAAC;YACnB,MAAM,KAAK,GACT,UAAU,KAAK,OAAO;gBACpB,CA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IACtB,IAAI,EAAE,UAAU;IAChB,MAAM,EAAE,YAAY;CACrB,CAAC,CAAC;AAEM,wBAAM","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport {\n FloatingFocusManager,\n FloatingOverlay,\n FloatingPortal,\n useDismiss,\n useFloating,\n useInteractions,\n useMergeRefs,\n useRole,\n} from '@floating-ui/react';\nimport classNames from 'classnames';\nimport { Resizable, type ResizableProps } from 're-resizable';\nimport type React from 'react';\nimport {\n type ComponentProps,\n useCallback,\n useEffect,\n useRef,\n useState,\n} from 'react';\n\nimport {\n type HtmlAttributes,\n type PolymorphicCommonProps,\n} from '../_common/types';\nimport { needleWarningMessage } from '../_common/utils';\nimport { CleanIconButton } from '../clean-icon-button';\nimport { ConditionalWrap } from '../conditional-wrap';\nimport { XMarkIconOutline } from '../icons';\nimport { Typography } from '../typography';\n\ntype DrawerPosition = 'left' | 'right';\n\ntype DrawerType = 'overlay' | 'push' | 'modal';\n\ntype DrawerProps = {\n /** Controls whether the drawer is open (expanded) or closed (collapsed). */\n isExpanded: boolean;\n\n /** Callback fired when the drawer's expanded state changes (close button, Escape, click outside, or programmatic change). */\n onExpandedChange?: (expanded: boolean) => void;\n\n /** Position where the drawer appears on screen. By default, it appears from the left. */\n position?: DrawerPosition;\n\n /** How the drawer affects the layout of sibling content. By default, it overlays content. */\n type?: DrawerType;\n\n /** Enables horizontal resizing of the drawer, by default it is not resizable. */\n isResizeable?: boolean;\n\n /** To use this prop the isResizeable prop must be set to true. For overriding the third party library props: https://github.com/bokuweb/re-resizable */\n resizeableProps?: ResizableProps;\n\n /** Whether a close button (X) is displayed in the drawer. */\n isCloseable?: boolean;\n\n /** Whether to portal the content. Only applies when type is \"overlay\". Type \"modal\" is always portaled.*/\n isPortaled?: boolean;\n\n // TODO v5: this should maybe be default on portaled in the future\n /**\n * Whether pressing Escape closes the drawer.\n * - When type is \"modal\", this defaults to true.\n * - When type is \"overlay\", this defaults to false.\n * - When type is \"push\", no effect.\n */\n closeOnEscape?: boolean;\n\n // TODO v5: this should maybe be default on overlay in the future\n /**\n * When type is \"overlay\", whether clicking outside the drawer closes it.\n * - When type is \"overlay\" or \"modal\", this defaults to false.\n * - When type is \"push\", no effect.\n */\n closeOnClickOutside?: boolean;\n\n // TODO v5: this should maybe be default on overlay in the future\n /**\n * Whether tabbing focus outside the drawer closes it.\n * - When type is \"overlay\", this defaults to false.\n * - When type is \"push\" or \"modal\", no effect.\n */\n closeOnFocusOut?: boolean;\n\n /** The content to display within the drawer. */\n children: React.ReactNode;\n\n /**\n * Props to pass to the portal from @floating-ui/react FloatingPortal\n * Only applies when type is \"overlay\" and isPortaled is true, or if type is \"modal\".\n * @see https://floating-ui.com/docs/floatingportal\n */\n portalProps?: ComponentProps<typeof FloatingPortal>;\n} & (\n | {\n type: 'modal';\n /** The aria-label to apply to the drawer. Required for accessibility when type is \"modal\" or \"overlay\".*/\n ariaLabel: string;\n }\n | {\n type?: 'push' | 'overlay';\n // TODO v5: aria label should be required when type is \"overlay\" too.\n ariaLabel?: string;\n }\n);\n\nconst KEYBOARD_RESIZE_STEP_PX = 16;\n\nfunction parsePixelSize(\n value: string | number | undefined,\n): number | undefined {\n if (value === undefined) {\n return undefined;\n }\n if (typeof value === 'number') {\n return value;\n }\n const parsed = parseInt(value.replace(/px$/i, ''), 10);\n return Number.isNaN(parsed) ? undefined : parsed;\n}\n\ntype DrawerResizeHandleProps = {\n /** Which edge this handle resizes (right = drawer’s right edge, left = drawer’s left edge). */\n handleSide: 'left' | 'right';\n /** Called with a pixel delta to apply to the drawer width (positive = wider). */\n onResizeBy: (delta: number) => void;\n onKeyDown?: React.KeyboardEventHandler<HTMLDivElement>;\n /** Current width in pixels (for aria-valuenow). */\n valueNow?: number;\n /** Minimum width in pixels (for aria-valuemin). */\n valueMin?: number;\n /** Maximum width in pixels (for aria-valuemax). */\n valueMax?: number;\n};\n\nfunction DrawerResizeHandle({\n handleSide,\n onResizeBy,\n valueMax,\n valueMin,\n valueNow,\n}: DrawerResizeHandleProps) {\n const handleKeyDown = useCallback(\n (e: React.KeyboardEvent<HTMLDivElement>) => {\n const isArrowKey = e.key === 'ArrowLeft' || e.key === 'ArrowRight';\n if (isArrowKey) {\n e.preventDefault();\n const delta =\n handleSide === 'right'\n ? e.key === 'ArrowRight'\n ? KEYBOARD_RESIZE_STEP_PX\n : -KEYBOARD_RESIZE_STEP_PX\n : e.key === 'ArrowLeft'\n ? KEYBOARD_RESIZE_STEP_PX\n : -KEYBOARD_RESIZE_STEP_PX;\n onResizeBy(delta);\n }\n },\n [handleSide, onResizeBy],\n );\n\n return (\n /* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions -- Resize handle is focusable for keyboard resize. */\n <div\n aria-label={`Resize drawer with arrow keys. Handle on ${handleSide}.`}\n aria-orientation=\"vertical\"\n aria-valuemax={valueMax}\n aria-valuemin={valueMin}\n aria-valuenow={valueNow ?? 0}\n aria-valuetext={`drawer width ${valueNow ?? 0}px`}\n className=\"ndl-drawer-resize-handle\"\n data-drawer-handle={handleSide}\n onKeyDown={handleKeyDown}\n role=\"separator\"\n style={{ height: '100%', width: '100%' }}\n // eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex -- Resize handle is focusable for keyboard resize.\n tabIndex={0}\n />\n );\n}\n\nconst DrawerComponent = function DrawerComponent<\n T extends React.ElementType = 'div',\n>({\n children,\n className = '',\n isExpanded,\n onExpandedChange,\n position = 'left',\n type = 'overlay',\n isResizeable = false,\n resizeableProps,\n isCloseable = true,\n isPortaled = false,\n portalProps = {},\n closeOnEscape = type === 'modal' ? true : false,\n closeOnClickOutside = false,\n closeOnFocusOut = false,\n ariaLabel,\n htmlAttributes,\n style,\n ref,\n as,\n ...restProps\n}: PolymorphicCommonProps<T, DrawerProps>) {\n const resizableRef = useRef<Resizable | null>(null);\n const [resizeWidth, setResizeWidth] = useState<number>(0);\n\n if ((type === 'modal' || type === 'overlay') && !ariaLabel) {\n needleWarningMessage(\n 'A Drawer should have an aria-label when type is \"modal\" or \"overlay\" to be accessible.',\n );\n }\n\n const { refs, context } = useFloating({\n onOpenChange: onExpandedChange,\n open: isExpanded,\n });\n\n /** Dismiss (escape + click outside) applies to portaled overlay and to non-portaled overlay. */\n const shouldUseDismiss =\n type === 'modal' ||\n (type === 'overlay' && !isPortaled && isExpanded) ||\n (type === 'overlay' && isPortaled);\n\n const dismiss = useDismiss(context, {\n enabled: shouldUseDismiss,\n escapeKey: closeOnEscape,\n outsidePress: closeOnClickOutside,\n });\n const role = useRole(context, {\n enabled: type === 'modal' || type === 'overlay',\n role: 'dialog',\n });\n const { getFloatingProps } = useInteractions([dismiss, role]);\n\n /** When overlay is open and not portaled, drawer gets the floating ref + props; when portaled, the portal layer gets them. */\n const shouldApplyFloatingPropsOnDrawer =\n type === 'overlay' && isExpanded && !isPortaled;\n\n const floatingPropsForDrawer = shouldApplyFloatingPropsOnDrawer\n ? getFloatingProps(htmlAttributes ?? {})\n : {};\n\n const resizableMergedRef = useMergeRefs([\n resizableRef,\n ref,\n shouldApplyFloatingPropsOnDrawer\n ? (refs.setFloating as React.Ref<Resizable>)\n : null,\n shouldApplyFloatingPropsOnDrawer\n ? (refs.setReference as React.Ref<Resizable>)\n : null,\n ]);\n const componentMergedRef = useMergeRefs([\n shouldApplyFloatingPropsOnDrawer ? refs.setFloating : null,\n shouldApplyFloatingPropsOnDrawer ? refs.setReference : null,\n ref,\n ]);\n\n const handleResizeBy = useCallback(\n (delta: number) => {\n if (!resizableRef.current) {\n return;\n }\n const current = resizableRef.current.size;\n const min = parsePixelSize(resizeableProps?.minWidth);\n const max = parsePixelSize(resizeableProps?.maxWidth);\n const newWidth = Math.max(\n min ?? 0,\n Math.min(max ?? Number.POSITIVE_INFINITY, current.width + delta),\n );\n resizableRef.current.updateSize({\n height: '100%',\n width: newWidth,\n });\n setResizeWidth(newWidth);\n },\n [resizeableProps?.minWidth, resizeableProps?.maxWidth],\n );\n\n const handleResize = useCallback(\n (\n event: MouseEvent | TouchEvent,\n direction: Parameters<NonNullable<ResizableProps['onResize']>>[1],\n elementRef: HTMLElement,\n delta: { width: number; height: number },\n ) => {\n setResizeWidth(elementRef.offsetWidth);\n resizeableProps?.onResize?.(event, direction, elementRef, delta);\n },\n [resizeableProps],\n );\n\n useEffect(() => {\n if (!isResizeable || !resizableRef.current) {\n return;\n }\n const width = resizableRef.current.size.width;\n if (width > 0) {\n setResizeWidth(width);\n }\n }, [isResizeable]);\n\n const setOnExpandedChange = useCallback(() => {\n onExpandedChange?.(!isExpanded);\n }, [isExpanded, onExpandedChange]);\n\n const classes = classNames('ndl-drawer', className, {\n 'ndl-drawer-left': position === 'left',\n 'ndl-drawer-modal': type === 'modal',\n 'ndl-drawer-overlay': type === 'overlay',\n 'ndl-drawer-portaled': isPortaled && type === 'overlay',\n 'ndl-drawer-push': type === 'push',\n 'ndl-drawer-right': position === 'right',\n });\n\n const resizableStylePosition = type === 'overlay' ? 'absolute' : 'relative';\n const Component = as ?? 'div';\n\n const Close = () => (\n <>\n {(isCloseable || type === 'modal') && (\n <CleanIconButton\n className=\"ndl-drawer-close-button\"\n onClick={setOnExpandedChange}\n description={null}\n size=\"medium\"\n htmlAttributes={{\n 'aria-label': 'Close',\n }}\n >\n <XMarkIconOutline />\n </CleanIconButton>\n )}\n </>\n );\n\n const resizableContent = (\n <Resizable\n as={Component}\n defaultSize={{\n height: '100%',\n width: 'auto',\n }}\n {...resizeableProps}\n className={classes}\n style={{\n position: resizableStylePosition,\n ...style,\n ...resizeableProps?.style,\n }}\n boundsByDirection={true}\n bounds=\"parent\"\n handleStyles={{\n /*\n * Small offset so the handle is easier to hit when the drawer content is scrollable.\n */\n ...(position === 'left' && { right: { right: '-8px' } }),\n ...(position === 'right' && { left: { left: '-8px' } }),\n }}\n enable={{\n bottom: false,\n bottomLeft: false,\n bottomRight: false,\n left: position === 'right',\n right: position === 'left',\n top: false,\n topLeft: false,\n topRight: false,\n }}\n handleComponent={\n position === 'left'\n ? {\n right: (\n <DrawerResizeHandle\n handleSide=\"right\"\n onResizeBy={handleResizeBy}\n valueMax={parsePixelSize(resizeableProps?.maxWidth)}\n valueMin={parsePixelSize(resizeableProps?.minWidth)}\n valueNow={resizeWidth}\n />\n ),\n }\n : {\n left: (\n <DrawerResizeHandle\n handleSide=\"left\"\n onResizeBy={handleResizeBy}\n valueMax={parsePixelSize(resizeableProps?.maxWidth)}\n valueMin={parsePixelSize(resizeableProps?.minWidth)}\n valueNow={resizeWidth}\n />\n ),\n }\n }\n onResize={handleResize}\n ref={resizableMergedRef}\n {...restProps}\n {...floatingPropsForDrawer}\n {...htmlAttributes}\n >\n <Close />\n {children}\n </Resizable>\n );\n\n const regularContent = (\n <Component\n className={classNames(classes)}\n style={style}\n ref={componentMergedRef}\n {...restProps}\n {...floatingPropsForDrawer}\n {...htmlAttributes}\n >\n <Close />\n {children}\n </Component>\n );\n\n /** what content to render*/\n const content = isResizeable ? resizableContent : regularContent;\n\n /** if the drawer is not expanded, don't render anything */\n if (isExpanded === false) {\n return null;\n }\n\n /** modal behavior */\n if (type === 'modal') {\n return (\n <FloatingPortal {...portalProps}>\n <FloatingOverlay\n className=\"ndl-drawer-overlay-root\"\n lockScroll={true}\n />\n <FloatingFocusManager context={context} modal={true} returnFocus={true}>\n <div\n ref={refs.setFloating}\n {...getFloatingProps()}\n aria-label={ariaLabel}\n aria-modal=\"true\"\n >\n {content}\n </div>\n </FloatingFocusManager>\n </FloatingPortal>\n );\n }\n\n /** overlay focus behavior */\n if (type === 'overlay') {\n return (\n <ConditionalWrap\n shouldWrap={isPortaled}\n wrap={(wrapChildren) => (\n <FloatingPortal preserveTabOrder={true} {...portalProps}>\n {wrapChildren}\n </FloatingPortal>\n )}\n >\n <FloatingFocusManager\n context={context}\n modal={false}\n returnFocus={true}\n closeOnFocusOut={closeOnFocusOut}\n >\n {content}\n </FloatingFocusManager>\n </ConditionalWrap>\n );\n }\n\n /** regular push behavior */\n return content;\n};\n\nDrawerComponent.displayName = 'Drawer';\n\ntype DrawerHeaderProps = {\n children: React.ReactNode;\n className?: string;\n // TODO v5: fix the typing on the Drawer subcomponents to use the common props type. Also, this is not an h5 haha. Should be polymorphic I guess, maybe default to h2 as we've recommended.\n htmlAttributes?: HtmlAttributes<'h5'>;\n};\n\nconst DrawerHeader = ({\n children,\n className = '',\n htmlAttributes,\n ...restProps\n}: DrawerHeaderProps) => {\n const classes = classNames('ndl-drawer-header', className);\n\n if (typeof children === 'string' || typeof children === 'number') {\n return (\n <Typography\n className={classes}\n variant=\"title-3\"\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n </Typography>\n );\n }\n\n return (\n <div className={classes} {...restProps} {...htmlAttributes}>\n {children}\n </div>\n );\n};\n\ntype DrawerActionsProps = {\n children: React.ReactNode;\n className?: string;\n htmlAttributes?: HtmlAttributes<'div'>;\n};\n\nconst DrawerActions = ({\n children,\n className = '',\n htmlAttributes,\n ...restProps\n}: DrawerActionsProps) => {\n const classes = classNames('ndl-drawer-actions', className);\n\n return (\n <div className={classes} {...restProps} {...htmlAttributes}>\n {children}\n </div>\n );\n};\n\ntype DrawerBodyProps = {\n children: React.ReactNode;\n className?: string;\n htmlAttributes?: HtmlAttributes<'div'>;\n};\n\nconst DrawerBody = ({\n children,\n className = '',\n htmlAttributes,\n ...restProps\n}: DrawerBodyProps) => {\n const classes = classNames('ndl-drawer-body', className);\n\n return (\n <div className=\"ndl-drawer-body-wrapper\">\n <div className={classes} {...restProps} {...htmlAttributes}>\n {children}\n </div>\n </div>\n );\n};\n\nconst Drawer = Object.assign(DrawerComponent, {\n Actions: DrawerActions,\n Body: DrawerBody,\n Header: DrawerHeader,\n});\n\nexport { Drawer };\n"]}
|
|
@@ -26,7 +26,9 @@ const react_1 = require("@neo4j-ndl/react");
|
|
|
26
26
|
const react_2 = require("react");
|
|
27
27
|
const Component = () => {
|
|
28
28
|
const [isExpanded, setIsExpanded] = (0, react_2.useState)(true);
|
|
29
|
-
const Placeholder = () => ((0, jsx_runtime_1.jsx)("div", { className: "w-full n-size-full n-flex n-flex-col n-items-center n-justify-center n-rounded-md n-p-token-16", children: (0, jsx_runtime_1.jsx)("div", { className: "n-border-dashed n-border-2 n-border-light-primary-bg-strong n-size-full n-flex n-flex-col n-items-center n-justify-center n-rounded-md", children: (0, jsx_runtime_1.jsx)(react_1.FilledButton, { onClick: () => setIsExpanded(true),
|
|
29
|
+
const Placeholder = () => ((0, jsx_runtime_1.jsx)("div", { className: "w-full n-size-full n-flex n-flex-col n-items-center n-justify-center n-rounded-md n-p-token-16", children: (0, jsx_runtime_1.jsx)("div", { className: "n-border-dashed n-border-2 n-border-light-primary-bg-strong n-size-full n-flex n-flex-col n-items-center n-justify-center n-rounded-md", children: (0, jsx_runtime_1.jsx)(react_1.FilledButton, { onClick: () => setIsExpanded(true), htmlAttributes: {
|
|
30
|
+
'aria-expanded': isExpanded,
|
|
31
|
+
}, children: "Press to show the Drawer" }) }) }));
|
|
30
32
|
return ((0, jsx_runtime_1.jsxs)("div", { className: "n-h-[calc(40vh-32px)] n-min-h-[700px] n-flex n-relative n-overflow-hidden", children: [(0, jsx_runtime_1.jsxs)(react_1.Drawer, { type: "push", isExpanded: isExpanded, onExpandedChange: () => setIsExpanded(false), isResizeable: true, resizeableProps: {
|
|
31
33
|
maxWidth: '400px',
|
|
32
34
|
minWidth: '300px',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drawer-full.story.js","sourceRoot":"","sources":["../../../../src/drawer/stories/drawer-full.story.tsx"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,mDAAiD;AAEjD,4CAA6E;AAC7E,iCAAiC;AAEjC,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,IAAA,gBAAQ,EAAC,IAAI,CAAC,CAAC;IAEnD,MAAM,WAAW,GAAG,GAAG,EAAE,CAAC,CACxB,gCAAK,SAAS,EAAC,gGAAgG,YAC7G,gCAAK,SAAS,EAAC,wIAAwI,YACrJ,uBAAC,oBAAY,
|
|
1
|
+
{"version":3,"file":"drawer-full.story.js","sourceRoot":"","sources":["../../../../src/drawer/stories/drawer-full.story.tsx"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,mDAAiD;AAEjD,4CAA6E;AAC7E,iCAAiC;AAEjC,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,IAAA,gBAAQ,EAAC,IAAI,CAAC,CAAC;IAEnD,MAAM,WAAW,GAAG,GAAG,EAAE,CAAC,CACxB,gCAAK,SAAS,EAAC,gGAAgG,YAC7G,gCAAK,SAAS,EAAC,wIAAwI,YACrJ,uBAAC,oBAAY,IACX,OAAO,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,EAClC,cAAc,EAAE;oBACd,eAAe,EAAE,UAAU;iBAC5B,yCAGY,GACX,GACF,CACP,CAAC;IAEF,OAAO,CACL,iCAAK,SAAS,EAAC,2EAA2E,aACxF,wBAAC,cAAM,IACL,IAAI,EAAC,MAAM,EACX,UAAU,EAAE,UAAU,EACtB,gBAAgB,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,KAAK,CAAC,EAC5C,YAAY,EAAE,IAAI,EAClB,eAAe,EAAE;oBACf,QAAQ,EAAE,OAAO;oBACjB,QAAQ,EAAE,OAAO;iBAClB,EACD,WAAW,EAAE,IAA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CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,SAAS,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport '@neo4j-ndl/base/lib/neo4j-ds-styles.css';\n\nimport { Checkbox, Drawer, FilledButton, TextInput } from '@neo4j-ndl/react';\nimport { useState } from 'react';\n\nconst Component = () => {\n const [isExpanded, setIsExpanded] = useState(true);\n\n const Placeholder = () => (\n <div className=\"w-full n-size-full n-flex n-flex-col n-items-center n-justify-center n-rounded-md n-p-token-16\">\n <div className=\"n-border-dashed n-border-2 n-border-light-primary-bg-strong n-size-full n-flex n-flex-col n-items-center n-justify-center n-rounded-md\">\n <FilledButton\n onClick={() => setIsExpanded(true)}\n htmlAttributes={{\n 'aria-expanded': isExpanded,\n }}\n >\n Press to show the Drawer\n </FilledButton>\n </div>\n </div>\n );\n\n return (\n <div className=\"n-h-[calc(40vh-32px)] n-min-h-[700px] n-flex n-relative n-overflow-hidden\">\n <Drawer\n type=\"push\"\n isExpanded={isExpanded}\n onExpandedChange={() => setIsExpanded(false)}\n isResizeable={true}\n resizeableProps={{\n maxWidth: '400px',\n minWidth: '300px',\n }}\n isCloseable={true}\n isPortaled={false}\n >\n <Drawer.Header>Drawer Header</Drawer.Header>\n <Drawer.Body>\n <TextInput\n showRequiredOrOptionalLabel={true}\n moreInformationText=\"some information\"\n label=\"Label\"\n isDisabled={false}\n isReadOnly={false}\n helpText=\"Friendly text\"\n isFluid={true}\n />\n <br />\n <TextInput label=\"Some input\" value=\"something\" />\n <br />\n <Checkbox label=\"Checkbox label\" />\n <br />\n Some example of something.\n <br />\n <TextInput label=\"Some input\" isDisabled={true} value=\"something\" />\n <br />\n <TextInput\n showRequiredOrOptionalLabel={true}\n moreInformationText=\"some information\"\n label=\"Label\"\n isDisabled={false}\n isReadOnly={false}\n helpText=\"Friendly text\"\n isFluid={true}\n />\n <br />\n Some example of something.\n <br />\n <TextInput label=\"Some input\" value=\"something\" />\n <br />\n <Checkbox label=\"Checkbox label\" />\n <br />\n <TextInput label=\"Some input\" value=\"something\" />\n </Drawer.Body>\n <Drawer.Actions>\n <FilledButton onClick={() => setIsExpanded(false)} size=\"medium\">\n Close\n </FilledButton>\n </Drawer.Actions>\n </Drawer>\n <Placeholder />\n </div>\n );\n};\n\nexport default Component;\n"]}
|
|
@@ -23,11 +23,9 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
23
23
|
*/
|
|
24
24
|
require("@neo4j-ndl/base/lib/neo4j-ds-styles.css");
|
|
25
25
|
const react_1 = require("@neo4j-ndl/react");
|
|
26
|
-
const react_2 = require("react");
|
|
27
26
|
const Component = () => {
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: "n-h-[calc(40vh-32px)] n-min-h-[700px] n-flex n-relative n-overflow-hidden", children: [(0, jsx_runtime_1.jsxs)(react_1.Drawer, { type: "overlay", isExpanded: isExpanded, onExpandedChange: () => setIsExpanded(false), position: "left", isCloseable: false, children: [(0, jsx_runtime_1.jsx)(react_1.Drawer.Header, { children: "Drawer Header" }), (0, jsx_runtime_1.jsx)(react_1.Drawer.Body, { children: "Lorem ipsum dolor sit amet." })] }), (0, jsx_runtime_1.jsx)(Placeholder, {})] }));
|
|
27
|
+
const Placeholder = () => ((0, jsx_runtime_1.jsx)("div", { className: "n-size-full n-flex n-flex-col n-items-center n-justify-center n-rounded-md n-p-token-16 w-full", children: (0, jsx_runtime_1.jsx)("div", { className: "n-border-dashed n-border-2 n-border-light-primary-bg-strong n-size-full n-flex n-flex-col n-items-center n-justify-center n-rounded-md" }) }));
|
|
28
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "n-h-[calc(40vh-32px)] n-min-h-[700px] n-flex n-relative n-overflow-hidden", children: [(0, jsx_runtime_1.jsxs)(react_1.Drawer, { type: "push", isExpanded: true, position: "left", isCloseable: false, children: [(0, jsx_runtime_1.jsx)(react_1.Drawer.Header, { children: "Drawer" }), (0, jsx_runtime_1.jsx)(react_1.Drawer.Body, { children: "Lorem ipsum dolor sit amet." })] }), (0, jsx_runtime_1.jsx)(Placeholder, {})] }));
|
|
31
29
|
};
|
|
32
30
|
exports.default = Component;
|
|
33
31
|
//# sourceMappingURL=drawer-not-closeable.story.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drawer-not-closeable.story.js","sourceRoot":"","sources":["../../../../src/drawer/stories/drawer-not-closeable.story.tsx"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,mDAAiD;AAEjD,
|
|
1
|
+
{"version":3,"file":"drawer-not-closeable.story.js","sourceRoot":"","sources":["../../../../src/drawer/stories/drawer-not-closeable.story.tsx"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,mDAAiD;AAEjD,4CAA0C;AAE1C,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,WAAW,GAAG,GAAG,EAAE,CAAC,CACxB,gCAAK,SAAS,EAAC,gGAAgG,YAC7G,gCAAK,SAAS,EAAC,wIAAwI,GAAO,GAC1J,CACP,CAAC;IAEF,OAAO,CACL,iCAAK,SAAS,EAAC,2EAA2E,aACxF,wBAAC,cAAM,IAAC,IAAI,EAAC,MAAM,EAAC,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAC,MAAM,EAAC,WAAW,EAAE,KAAK,aACtE,uBAAC,cAAM,CAAC,MAAM,yBAAuB,EACrC,uBAAC,cAAM,CAAC,IAAI,8CAA0C,IAC/C,EACT,uBAAC,WAAW,KAAG,IACX,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,SAAS,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport '@neo4j-ndl/base/lib/neo4j-ds-styles.css';\n\nimport { Drawer } from '@neo4j-ndl/react';\n\nconst Component = () => {\n const Placeholder = () => (\n <div className=\"n-size-full n-flex n-flex-col n-items-center n-justify-center n-rounded-md n-p-token-16 w-full\">\n <div className=\"n-border-dashed n-border-2 n-border-light-primary-bg-strong n-size-full n-flex n-flex-col n-items-center n-justify-center n-rounded-md\"></div>\n </div>\n );\n\n return (\n <div className=\"n-h-[calc(40vh-32px)] n-min-h-[700px] n-flex n-relative n-overflow-hidden\">\n <Drawer type=\"push\" isExpanded={true} position=\"left\" isCloseable={false}>\n <Drawer.Header>Drawer</Drawer.Header>\n <Drawer.Body>Lorem ipsum dolor sit amet.</Drawer.Body>\n </Drawer>\n <Placeholder />\n </div>\n );\n};\n\nexport default Component;\n"]}
|
|
@@ -25,9 +25,11 @@ require("@neo4j-ndl/base/lib/neo4j-ds-styles.css");
|
|
|
25
25
|
const react_1 = require("@neo4j-ndl/react");
|
|
26
26
|
const react_2 = require("react");
|
|
27
27
|
const Component = () => {
|
|
28
|
-
const [isExpanded, setIsExpanded] = (0, react_2.useState)(
|
|
29
|
-
const Placeholder = () => ((0, jsx_runtime_1.jsx)("div", { className: "n-size-full n-flex n-flex-col n-items-center n-justify-center n-rounded-md n-p-token-16 w-full", children: (0, jsx_runtime_1.jsx)("div", { className: "n-border-dashed n-border-2 n-border-light-primary-bg-strong n-size-full n-flex n-flex-col n-items-center n-justify-center n-rounded-md", children: (0, jsx_runtime_1.jsx)(react_1.FilledButton, { onClick: () => setIsExpanded(true),
|
|
30
|
-
|
|
28
|
+
const [isExpanded, setIsExpanded] = (0, react_2.useState)(false);
|
|
29
|
+
const Placeholder = () => ((0, jsx_runtime_1.jsx)("div", { className: "n-size-full n-flex n-flex-col n-items-center n-justify-center n-rounded-md n-p-token-16 w-full", children: (0, jsx_runtime_1.jsx)("div", { className: "n-border-dashed n-border-2 n-border-light-primary-bg-strong n-size-full n-flex n-flex-col n-items-center n-justify-center n-rounded-md", children: (0, jsx_runtime_1.jsx)(react_1.FilledButton, { onClick: () => setIsExpanded(true), htmlAttributes: {
|
|
30
|
+
'aria-expanded': isExpanded,
|
|
31
|
+
}, children: "Press to show the Drawer" }) }) }));
|
|
32
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "n-h-[calc(40vh-32px)] n-min-h-[700px] n-flex n-relative n-overflow-hidden", children: [(0, jsx_runtime_1.jsxs)(react_1.Drawer, { isExpanded: isExpanded, onExpandedChange: () => setIsExpanded(false), type: "overlay", ariaLabel: "Drawer", closeOnClickOutside: true, closeOnFocusOut: true, style: { maxWidth: '400px' }, children: [(0, jsx_runtime_1.jsx)(react_1.Drawer.Header, { children: "Drawer" }), (0, jsx_runtime_1.jsxs)(react_1.Drawer.Body, { children: ["If you use an overlay drawer, and there is a risk that it covers interactive elements, you should set ", (0, jsx_runtime_1.jsx)("code", { children: "closeOnClickOutside" }), ' ', "and ", (0, jsx_runtime_1.jsx)("code", { children: "closeOnFocusOut" }), " to true. This prevents it from hiding focus, making it more accessible."] }), (0, jsx_runtime_1.jsx)(react_1.Drawer.Actions, { children: (0, jsx_runtime_1.jsx)(react_1.FilledButton, { onClick: () => setIsExpanded(false), size: "medium", children: "Close" }) })] }), (0, jsx_runtime_1.jsx)(Placeholder, {})] }));
|
|
31
33
|
};
|
|
32
34
|
exports.default = Component;
|
|
33
35
|
//# sourceMappingURL=drawer-overlay.story.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drawer-overlay.story.js","sourceRoot":"","sources":["../../../../src/drawer/stories/drawer-overlay.story.tsx"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,mDAAiD;AAEjD,4CAAwD;AACxD,iCAAiC;AAEjC,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,IAAA,gBAAQ,EAAC,
|
|
1
|
+
{"version":3,"file":"drawer-overlay.story.js","sourceRoot":"","sources":["../../../../src/drawer/stories/drawer-overlay.story.tsx"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,mDAAiD;AAEjD,4CAAwD;AACxD,iCAAiC;AAEjC,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC;IAEpD,MAAM,WAAW,GAAG,GAAG,EAAE,CAAC,CACxB,gCAAK,SAAS,EAAC,gGAAgG,YAC7G,gCAAK,SAAS,EAAC,wIAAwI,YACrJ,uBAAC,oBAAY,IACX,OAAO,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,EAClC,cAAc,EAAE;oBACd,eAAe,EAAE,UAAU;iBAC5B,yCAGY,GACX,GACF,CACP,CAAC;IAEF,OAAO,CACL,iCAAK,SAAS,EAAC,2EAA2E,aACxF,wBAAC,cAAM,IACL,UAAU,EAAE,UAAU,EACtB,gBAAgB,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,KAAK,CAAC,EAC5C,IAAI,EAAC,SAAS,EACd,SAAS,EAAC,QAAQ,EAClB,mBAAmB,EAAE,IAAI,EACzB,eAAe,EAAE,IAAI,EACrB,KAAK,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,aAE5B,uBAAC,cAAM,CAAC,MAAM,yBAAuB,EACrC,wBAAC,cAAM,CAAC,IAAI,yHAE2B,mEAAgC,EAAC,GAAG,UACrE,+DAA4B,gFAEpB,EACd,uBAAC,cAAM,CAAC,OAAO,cACb,uBAAC,oBAAY,IAAC,OAAO,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE,IAAI,EAAC,QAAQ,sBAEjD,GACA,IACV,EACT,uBAAC,WAAW,KAAG,IACX,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,SAAS,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport '@neo4j-ndl/base/lib/neo4j-ds-styles.css';\n\nimport { Drawer, FilledButton } from '@neo4j-ndl/react';\nimport { useState } from 'react';\n\nconst Component = () => {\n const [isExpanded, setIsExpanded] = useState(false);\n\n const Placeholder = () => (\n <div className=\"n-size-full n-flex n-flex-col n-items-center n-justify-center n-rounded-md n-p-token-16 w-full\">\n <div className=\"n-border-dashed n-border-2 n-border-light-primary-bg-strong n-size-full n-flex n-flex-col n-items-center n-justify-center n-rounded-md\">\n <FilledButton\n onClick={() => setIsExpanded(true)}\n htmlAttributes={{\n 'aria-expanded': isExpanded,\n }}\n >\n Press to show the Drawer\n </FilledButton>\n </div>\n </div>\n );\n\n return (\n <div className=\"n-h-[calc(40vh-32px)] n-min-h-[700px] n-flex n-relative n-overflow-hidden\">\n <Drawer\n isExpanded={isExpanded}\n onExpandedChange={() => setIsExpanded(false)}\n type=\"overlay\"\n ariaLabel=\"Drawer\"\n closeOnClickOutside={true}\n closeOnFocusOut={true}\n style={{ maxWidth: '400px' }}\n >\n <Drawer.Header>Drawer</Drawer.Header>\n <Drawer.Body>\n If you use an overlay drawer, and there is a risk that it covers\n interactive elements, you should set <code>closeOnClickOutside</code>{' '}\n and <code>closeOnFocusOut</code> to true. This prevents it from hiding\n focus, making it more accessible.\n </Drawer.Body>\n <Drawer.Actions>\n <FilledButton onClick={() => setIsExpanded(false)} size=\"medium\">\n Close\n </FilledButton>\n </Drawer.Actions>\n </Drawer>\n <Placeholder />\n </div>\n );\n};\n\nexport default Component;\n"]}
|
|
@@ -26,13 +26,14 @@ const react_1 = require("@neo4j-ndl/react");
|
|
|
26
26
|
const react_2 = require("react");
|
|
27
27
|
const Component = () => {
|
|
28
28
|
const [isExpanded, setIsExpanded] = (0, react_2.useState)(false);
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
},
|
|
34
|
-
|
|
35
|
-
|
|
29
|
+
const [isMenuOpen, setIsMenuOpen] = (0, react_2.useState)(false);
|
|
30
|
+
const anchorRef = (0, react_2.useRef)(null);
|
|
31
|
+
const Placeholder = () => ((0, jsx_runtime_1.jsx)("div", { className: "n-size-full n-flex n-flex-col n-items-center n-justify-center n-rounded-md n-p-token-16 w-full", children: (0, jsx_runtime_1.jsx)("div", { className: "n-border-dashed n-border-2 n-border-light-primary-bg-strong n-size-full n-flex n-flex-col n-items-center n-justify-center n-rounded-md", children: (0, jsx_runtime_1.jsx)(react_1.FilledButton, { onClick: () => setIsExpanded(true), htmlAttributes: {
|
|
32
|
+
'aria-expanded': isExpanded,
|
|
33
|
+
}, children: "Press to show the Drawer" }) }) }));
|
|
34
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "n-h-[calc(40vh-32px)] n-min-h-[700px] n-flex n-relative n-overflow-hidden", children: [(0, jsx_runtime_1.jsxs)(react_1.Drawer, { type: "modal", isExpanded: isExpanded, onExpandedChange: () => setIsExpanded(false), position: "left", closeOnEscape: true, ariaLabel: "Drawer", htmlAttributes: {
|
|
35
|
+
id: 'drawer',
|
|
36
|
+
}, children: [(0, jsx_runtime_1.jsx)(react_1.Drawer.Header, { children: "Drawer" }), (0, jsx_runtime_1.jsxs)(react_1.Drawer.Body, { children: ["Lorem ipsum dolor sit amet.", ' ', (0, jsx_runtime_1.jsx)(react_1.DropdownButton, { ref: anchorRef, onClick: () => setIsMenuOpen(true), children: "Dropdown Button" }), (0, jsx_runtime_1.jsxs)(react_1.Menu, { strategy: "fixed", portalTarget: document.getElementById('drawer'), anchorRef: anchorRef, isOpen: isMenuOpen, onClose: () => setIsMenuOpen(false), children: [(0, jsx_runtime_1.jsx)(react_1.Menu.Item, { title: "Menu Item 1" }), (0, jsx_runtime_1.jsx)(react_1.Menu.Item, { title: "Menu Item 2" }), (0, jsx_runtime_1.jsx)(react_1.Menu.Item, { title: "Menu Item 3" })] })] }), (0, jsx_runtime_1.jsx)(react_1.Drawer.Actions, { children: (0, jsx_runtime_1.jsx)(react_1.FilledButton, { onClick: () => setIsExpanded(false), size: "medium", children: "Close" }) })] }), (0, jsx_runtime_1.jsx)(Placeholder, {})] }));
|
|
36
37
|
};
|
|
37
38
|
exports.default = Component;
|
|
38
39
|
//# sourceMappingURL=drawer-portaled.story.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drawer-portaled.story.js","sourceRoot":"","sources":["../../../../src/drawer/stories/drawer-portaled.story.tsx"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,mDAAiD;AAEjD,
|
|
1
|
+
{"version":3,"file":"drawer-portaled.story.js","sourceRoot":"","sources":["../../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CAAC,cAAc,CAAC,QAAQ,CAAC,EAC/C,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,UAAU,EAClB,OAAO,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,KAAK,CAAC,aAEnC,uBAAC,YAAI,CAAC,IAAI,IAAC,KAAK,EAAC,aAAa,GAAG,EACjC,uBAAC,YAAI,CAAC,IAAI,IAAC,KAAK,EAAC,aAAa,GAAG,EACjC,uBAAC,YAAI,CAAC,IAAI,IAAC,KAAK,EAAC,aAAa,GAAG,IAC5B,IACK,EACd,uBAAC,cAAM,CAAC,OAAO,cACb,uBAAC,oBAAY,IAAC,OAAO,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE,IAAI,EAAC,QAAQ,sBAEjD,GACA,IACV,EACT,uBAAC,WAAW,KAAG,IACX,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,SAAS,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport '@neo4j-ndl/base/lib/neo4j-ds-styles.css';\n\nimport { Drawer, DropdownButton, FilledButton, Menu } from '@neo4j-ndl/react';\nimport { useRef, useState } from 'react';\n\nconst Component = () => {\n const [isExpanded, setIsExpanded] = useState(false);\n const [isMenuOpen, setIsMenuOpen] = useState(false);\n const anchorRef = useRef<HTMLButtonElement | null>(null);\n\n const Placeholder = () => (\n <div className=\"n-size-full n-flex n-flex-col n-items-center n-justify-center n-rounded-md n-p-token-16 w-full\">\n <div className=\"n-border-dashed n-border-2 n-border-light-primary-bg-strong n-size-full n-flex n-flex-col n-items-center n-justify-center n-rounded-md\">\n <FilledButton\n onClick={() => setIsExpanded(true)}\n htmlAttributes={{\n 'aria-expanded': isExpanded,\n }}\n >\n Press to show the Drawer\n </FilledButton>\n </div>\n </div>\n );\n\n return (\n <div className=\"n-h-[calc(40vh-32px)] n-min-h-[700px] n-flex n-relative n-overflow-hidden\">\n <Drawer\n type=\"modal\"\n isExpanded={isExpanded}\n onExpandedChange={() => setIsExpanded(false)}\n position=\"left\"\n closeOnEscape={true}\n ariaLabel=\"Drawer\"\n htmlAttributes={{\n id: 'drawer',\n }}\n >\n <Drawer.Header>Drawer</Drawer.Header>\n <Drawer.Body>\n Lorem ipsum dolor sit amet.{' '}\n <DropdownButton ref={anchorRef} onClick={() => setIsMenuOpen(true)}>\n Dropdown Button\n </DropdownButton>\n <Menu\n strategy=\"fixed\"\n portalTarget={document.getElementById('drawer')}\n anchorRef={anchorRef}\n isOpen={isMenuOpen}\n onClose={() => setIsMenuOpen(false)}\n >\n <Menu.Item title=\"Menu Item 1\" />\n <Menu.Item title=\"Menu Item 2\" />\n <Menu.Item title=\"Menu Item 3\" />\n </Menu>\n </Drawer.Body>\n <Drawer.Actions>\n <FilledButton onClick={() => setIsExpanded(false)} size=\"medium\">\n Close\n </FilledButton>\n </Drawer.Actions>\n </Drawer>\n <Placeholder />\n </div>\n );\n};\n\nexport default Component;\n"]}
|
|
@@ -25,8 +25,10 @@ const react_1 = require("@neo4j-ndl/react");
|
|
|
25
25
|
const react_2 = require("react");
|
|
26
26
|
const Component = () => {
|
|
27
27
|
const [isExpanded, setIsExpanded] = (0, react_2.useState)(true);
|
|
28
|
-
const Placeholder = () => ((0, jsx_runtime_1.jsx)("div", { className: "n-size-full n-flex n-flex-col n-items-center n-justify-center n-rounded-md n-p-token-16 w-full", children: (0, jsx_runtime_1.jsx)("div", { className: "n-border-dashed n-border-2 n-border-light-primary-bg-strong n-size-full n-flex n-flex-col n-items-center n-justify-center n-rounded-md", children: (0, jsx_runtime_1.jsx)(react_1.FilledButton, { onClick: () => setIsExpanded(true),
|
|
29
|
-
|
|
28
|
+
const Placeholder = () => ((0, jsx_runtime_1.jsx)("div", { className: "n-size-full n-flex n-flex-col n-items-center n-justify-center n-rounded-md n-p-token-16 w-full", children: (0, jsx_runtime_1.jsx)("div", { className: "n-border-dashed n-border-2 n-border-light-primary-bg-strong n-size-full n-flex n-flex-col n-items-center n-justify-center n-rounded-md", children: (0, jsx_runtime_1.jsx)(react_1.FilledButton, { onClick: () => setIsExpanded(true), htmlAttributes: {
|
|
29
|
+
'aria-expanded': isExpanded,
|
|
30
|
+
}, children: "Press to show the Drawer" }) }) }));
|
|
31
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "n-h-[calc(40vh-32px)] n-min-h-[700px] n-flex n-relative n-overflow-hidden", children: [(0, jsx_runtime_1.jsxs)(react_1.Drawer, { type: "push", isExpanded: isExpanded, onExpandedChange: () => setIsExpanded(false), children: [(0, jsx_runtime_1.jsx)(react_1.Drawer.Header, { children: "Drawer" }), (0, jsx_runtime_1.jsx)(react_1.Drawer.Body, { children: "Lorem ipsum dolor sit amet." }), (0, jsx_runtime_1.jsx)(react_1.Drawer.Actions, { children: (0, jsx_runtime_1.jsx)(react_1.FilledButton, { onClick: () => setIsExpanded(false), size: "medium", children: "Close" }) })] }), (0, jsx_runtime_1.jsx)(Placeholder, {})] }));
|
|
30
32
|
};
|
|
31
33
|
exports.default = Component;
|
|
32
34
|
//# sourceMappingURL=drawer-push.story.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drawer-push.story.js","sourceRoot":"","sources":["../../../../src/drawer/stories/drawer-push.story.tsx"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,4CAAwD;AACxD,iCAAiC;AAEjC,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM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AAEF,kBAAe,SAAS,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { Drawer, FilledButton } from '@neo4j-ndl/react';\nimport { useState } from 'react';\n\nconst Component = () => {\n const [isExpanded, setIsExpanded] = useState(true);\n\n const Placeholder = () => (\n <div className=\"n-size-full n-flex n-flex-col n-items-center n-justify-center n-rounded-md n-p-token-16 w-full\">\n <div className=\"n-border-dashed n-border-2 n-border-light-primary-bg-strong n-size-full n-flex n-flex-col n-items-center n-justify-center n-rounded-md\">\n <FilledButton\n onClick={() => setIsExpanded(true)}\n htmlAttributes={{\n 'aria-expanded': isExpanded,\n }}\n >\n Press to show the Drawer\n </FilledButton>\n </div>\n </div>\n );\n\n return (\n <div className=\"n-h-[calc(40vh-32px)] n-min-h-[700px] n-flex n-relative n-overflow-hidden\">\n <Drawer\n type=\"push\"\n isExpanded={isExpanded}\n onExpandedChange={() => setIsExpanded(false)}\n >\n <Drawer.Header>Drawer</Drawer.Header>\n <Drawer.Body>Lorem ipsum dolor sit amet.</Drawer.Body>\n <Drawer.Actions>\n <FilledButton onClick={() => setIsExpanded(false)} size=\"medium\">\n Close\n </FilledButton>\n </Drawer.Actions>\n </Drawer>\n <Placeholder />\n </div>\n );\n};\n\nexport default Component;\n"]}
|