@auth0/quantum-product 2.9.7 → 2.10.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/esm/floating-bar/floating-bar-actions.js +34 -0
- package/esm/floating-bar/floating-bar-context.js +13 -0
- package/esm/floating-bar/floating-bar-description.js +24 -0
- package/esm/floating-bar/floating-bar-icon.js +32 -0
- package/esm/floating-bar/floating-bar-scroll.js +68 -0
- package/esm/floating-bar/floating-bar.js +206 -0
- package/esm/floating-bar/index.js +6 -0
- package/esm/index.js +1 -0
- package/esm/panel/panel/panel.js +155 -8
- package/esm/panel/panel-context.js +1 -0
- package/floating-bar/floating-bar-actions.d.ts +12 -0
- package/floating-bar/floating-bar-actions.js +70 -0
- package/floating-bar/floating-bar-context.d.ts +11 -0
- package/floating-bar/floating-bar-context.js +52 -0
- package/floating-bar/floating-bar-description.d.ts +12 -0
- package/floating-bar/floating-bar-description.js +60 -0
- package/floating-bar/floating-bar-icon.d.ts +12 -0
- package/floating-bar/floating-bar-icon.js +68 -0
- package/floating-bar/floating-bar-scroll.d.ts +11 -0
- package/floating-bar/floating-bar-scroll.js +104 -0
- package/floating-bar/floating-bar.d.ts +17 -0
- package/floating-bar/floating-bar.js +242 -0
- package/floating-bar/index.d.ts +12 -0
- package/floating-bar/index.js +17 -0
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/package.json +1 -1
- package/panel/panel/panel.d.ts +21 -3
- package/panel/panel/panel.js +155 -8
- package/panel/panel-context.d.ts +2 -0
- package/panel/panel-context.js +1 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { FloatingBar } from './floating-bar';
|
|
2
|
+
export type { IFloatingBarOwnerState, IFloatingBarProps } from './floating-bar';
|
|
3
|
+
export { FloatingBarScroll } from './floating-bar-scroll';
|
|
4
|
+
export type { IFloatingBarScrollOwnerState, IFloatingBarScrollProps } from './floating-bar-scroll';
|
|
5
|
+
export { FloatingBarIcon } from './floating-bar-icon';
|
|
6
|
+
export type { IFloatingBarIconProps } from './floating-bar-icon';
|
|
7
|
+
export { FloatingBarDescription } from './floating-bar-description';
|
|
8
|
+
export type { IFloatingBarDescriptionProps } from './floating-bar-description';
|
|
9
|
+
export { FloatingBarActions } from './floating-bar-actions';
|
|
10
|
+
export type { IFloatingBarActionsProps } from './floating-bar-actions';
|
|
11
|
+
export { useFloatingBarContext, useFloatingBarOrientation, useFloatingBarScrollProgress } from './floating-bar-context';
|
|
12
|
+
export type { IFloatingBarContextValue } from './floating-bar-context';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useFloatingBarScrollProgress = exports.useFloatingBarOrientation = exports.useFloatingBarContext = exports.FloatingBarActions = exports.FloatingBarDescription = exports.FloatingBarIcon = exports.FloatingBarScroll = exports.FloatingBar = void 0;
|
|
4
|
+
var floating_bar_1 = require("./floating-bar");
|
|
5
|
+
Object.defineProperty(exports, "FloatingBar", { enumerable: true, get: function () { return floating_bar_1.FloatingBar; } });
|
|
6
|
+
var floating_bar_scroll_1 = require("./floating-bar-scroll");
|
|
7
|
+
Object.defineProperty(exports, "FloatingBarScroll", { enumerable: true, get: function () { return floating_bar_scroll_1.FloatingBarScroll; } });
|
|
8
|
+
var floating_bar_icon_1 = require("./floating-bar-icon");
|
|
9
|
+
Object.defineProperty(exports, "FloatingBarIcon", { enumerable: true, get: function () { return floating_bar_icon_1.FloatingBarIcon; } });
|
|
10
|
+
var floating_bar_description_1 = require("./floating-bar-description");
|
|
11
|
+
Object.defineProperty(exports, "FloatingBarDescription", { enumerable: true, get: function () { return floating_bar_description_1.FloatingBarDescription; } });
|
|
12
|
+
var floating_bar_actions_1 = require("./floating-bar-actions");
|
|
13
|
+
Object.defineProperty(exports, "FloatingBarActions", { enumerable: true, get: function () { return floating_bar_actions_1.FloatingBarActions; } });
|
|
14
|
+
var floating_bar_context_1 = require("./floating-bar-context");
|
|
15
|
+
Object.defineProperty(exports, "useFloatingBarContext", { enumerable: true, get: function () { return floating_bar_context_1.useFloatingBarContext; } });
|
|
16
|
+
Object.defineProperty(exports, "useFloatingBarOrientation", { enumerable: true, get: function () { return floating_bar_context_1.useFloatingBarOrientation; } });
|
|
17
|
+
Object.defineProperty(exports, "useFloatingBarScrollProgress", { enumerable: true, get: function () { return floating_bar_context_1.useFloatingBarScrollProgress; } });
|
package/index.d.ts
CHANGED
|
@@ -34,6 +34,7 @@ export * from './dropdown-menu';
|
|
|
34
34
|
export * from './empty-state';
|
|
35
35
|
export * from './expansion-panel';
|
|
36
36
|
export * from './field-set';
|
|
37
|
+
export * from './floating-bar';
|
|
37
38
|
export * from './form';
|
|
38
39
|
export * from './gallery-layout';
|
|
39
40
|
export * from './icon';
|
package/index.js
CHANGED
|
@@ -50,6 +50,7 @@ __exportStar(require("./dropdown-menu"), exports);
|
|
|
50
50
|
__exportStar(require("./empty-state"), exports);
|
|
51
51
|
__exportStar(require("./expansion-panel"), exports);
|
|
52
52
|
__exportStar(require("./field-set"), exports);
|
|
53
|
+
__exportStar(require("./floating-bar"), exports);
|
|
53
54
|
__exportStar(require("./form"), exports);
|
|
54
55
|
__exportStar(require("./gallery-layout"), exports);
|
|
55
56
|
__exportStar(require("./icon"), exports);
|
package/package.json
CHANGED
package/panel/panel/panel.d.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { IStyledComponentProps } from '../../styled';
|
|
3
|
-
import { PanelClasses } from './panel-classes';
|
|
4
2
|
import { IIconButtonProps } from '../../icon-button';
|
|
3
|
+
import { IStyledComponentProps } from '../../styled';
|
|
5
4
|
import { IPanelContextValue } from '../panel-context';
|
|
6
5
|
import { IPanelHeaderProps } from '../panel-header';
|
|
6
|
+
import { PanelClasses } from './panel-classes';
|
|
7
7
|
export type IPanelOwnerState = Pick<IPanelContextValue, 'size' | 'variant' | 'placement' | 'isOpen' | 'isFixed'> & {
|
|
8
8
|
/** Sets top offset for panel. Defaults to appbar for fixed panels. All others default to 0. */
|
|
9
9
|
offsetTop?: 'appbar' | number;
|
|
10
|
+
/** Active width of panel. Defaults to width from size. */
|
|
11
|
+
width?: number;
|
|
10
12
|
};
|
|
11
13
|
export type IPanelProps = IStyledComponentProps<{
|
|
12
14
|
props: Partial<IPanelOwnerState> & {
|
|
@@ -18,6 +20,14 @@ export type IPanelProps = IStyledComponentProps<{
|
|
|
18
20
|
onClose?(event: React.MouseEvent<HTMLButtonElement>, reason: 'closeButtonClick'): void;
|
|
19
21
|
/** convenience prop for rendering the label for close button with a Panel component */
|
|
20
22
|
closeButtonLabel?: string;
|
|
23
|
+
/** Allows resizing the panel width. */
|
|
24
|
+
resizable?: boolean;
|
|
25
|
+
/** Sets the maximum width of the panel when resizing. */
|
|
26
|
+
maxWidth?: number;
|
|
27
|
+
/** Sets the minimum width of the panel when resizing. */
|
|
28
|
+
minWidth?: number;
|
|
29
|
+
/** Show explicit drag handle */
|
|
30
|
+
showDragHandle?: boolean;
|
|
21
31
|
classes?: Partial<PanelClasses>;
|
|
22
32
|
closeIconButtonProps?: Partial<IIconButtonProps>;
|
|
23
33
|
PanelHeaderProps?: Partial<IPanelHeaderProps>;
|
|
@@ -33,7 +43,15 @@ export declare const Panel: React.ForwardRefExoticComponent<Partial<IPanelOwnerS
|
|
|
33
43
|
onClose?(event: React.MouseEvent<HTMLButtonElement>, reason: "closeButtonClick"): void;
|
|
34
44
|
/** convenience prop for rendering the label for close button with a Panel component */
|
|
35
45
|
closeButtonLabel?: string;
|
|
46
|
+
/** Allows resizing the panel width. */
|
|
47
|
+
resizable?: boolean;
|
|
48
|
+
/** Sets the maximum width of the panel when resizing. */
|
|
49
|
+
maxWidth?: number;
|
|
50
|
+
/** Sets the minimum width of the panel when resizing. */
|
|
51
|
+
minWidth?: number;
|
|
52
|
+
/** Show explicit drag handle */
|
|
53
|
+
showDragHandle?: boolean;
|
|
36
54
|
classes?: Partial<PanelClasses>;
|
|
37
55
|
closeIconButtonProps?: Partial<IIconButtonProps>;
|
|
38
56
|
PanelHeaderProps?: Partial<IPanelHeaderProps>;
|
|
39
|
-
} & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "title" | "ref" | "size" | "children" | "onClose" | "classes" | "variant" | "placement" | "closeButtonLabel" | "isOpen" | "isFixed" | "offsetTop" | "closeIconButtonProps" | "PanelHeaderProps"> & import("../../styled").IStyledCommonProps & React.RefAttributes<HTMLDivElement>>;
|
|
57
|
+
} & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "title" | "ref" | "size" | "maxWidth" | "minWidth" | "width" | "children" | "onClose" | "classes" | "variant" | "placement" | "closeButtonLabel" | "resizable" | "isOpen" | "isFixed" | "offsetTop" | "showDragHandle" | "closeIconButtonProps" | "PanelHeaderProps"> & import("../../styled").IStyledCommonProps & React.RefAttributes<HTMLDivElement>>;
|
package/panel/panel/panel.js
CHANGED
|
@@ -54,17 +54,33 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
54
54
|
}
|
|
55
55
|
return t;
|
|
56
56
|
};
|
|
57
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
58
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
59
|
+
if (!m) return o;
|
|
60
|
+
var i = m.call(o), r, ar = [], e;
|
|
61
|
+
try {
|
|
62
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
63
|
+
}
|
|
64
|
+
catch (error) { e = { error: error }; }
|
|
65
|
+
finally {
|
|
66
|
+
try {
|
|
67
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
68
|
+
}
|
|
69
|
+
finally { if (e) throw e.error; }
|
|
70
|
+
}
|
|
71
|
+
return ar;
|
|
72
|
+
};
|
|
57
73
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
58
74
|
exports.Panel = void 0;
|
|
59
75
|
var React = __importStar(require("react"));
|
|
76
|
+
var icon_1 = require("../../icon");
|
|
77
|
+
var icon_button_1 = require("../../icon-button");
|
|
60
78
|
var styled_1 = require("../../styled");
|
|
61
79
|
var classes_1 = require("../../styles/classes");
|
|
62
80
|
var utils_1 = require("../../utils");
|
|
63
|
-
var panel_classes_1 = require("./panel-classes");
|
|
64
|
-
var icon_button_1 = require("../../icon-button");
|
|
65
|
-
var icon_1 = require("../../icon");
|
|
66
81
|
var panel_context_1 = require("../panel-context");
|
|
67
82
|
var panel_header_1 = require("../panel-header");
|
|
83
|
+
var panel_classes_1 = require("./panel-classes");
|
|
68
84
|
var widthBySize = {
|
|
69
85
|
small: 320,
|
|
70
86
|
medium: 360,
|
|
@@ -76,8 +92,9 @@ var Root = (0, styled_1.styled)('div', {
|
|
|
76
92
|
slot: 'Root',
|
|
77
93
|
})(function (_a) {
|
|
78
94
|
var _b;
|
|
95
|
+
var _c;
|
|
79
96
|
var ownerState = _a.ownerState, theme = _a.theme;
|
|
80
|
-
var width = widthBySize[ownerState.size];
|
|
97
|
+
var width = (_c = ownerState.width) !== null && _c !== void 0 ? _c : widthBySize[ownerState.size];
|
|
81
98
|
var isOpen = ownerState.variant === 'permanent' || ownerState.isOpen;
|
|
82
99
|
var marginProp = ownerState.placement === 'start' ? 'marginRight' : 'marginLeft';
|
|
83
100
|
return __assign({ transition: theme.transitions.create(['margin'], {
|
|
@@ -91,8 +108,9 @@ var Content = (0, styled_1.styled)('div', {
|
|
|
91
108
|
name: panel_classes_1.panelComponentName,
|
|
92
109
|
slot: 'Content',
|
|
93
110
|
})(function (_a) {
|
|
111
|
+
var _b;
|
|
94
112
|
var ownerState = _a.ownerState, theme = _a.theme;
|
|
95
|
-
var width = widthBySize[ownerState.size];
|
|
113
|
+
var width = (_b = ownerState.width) !== null && _b !== void 0 ? _b : widthBySize[ownerState.size];
|
|
96
114
|
var isOpen = ownerState.variant === 'permanent' || ownerState.isOpen;
|
|
97
115
|
return __assign({ position: ownerState.isFixed ? 'fixed' : 'absolute', zIndex: theme.zIndex.drawer - 1, top: ownerState.offsetTop === 'appbar' ? theme.layout.appTop + theme.layout.appBarHeight : ownerState.offsetTop || 0, bottom: 0, width: width, backgroundColor: ownerState.variant === 'floating' ? theme.tokens.color_bg_layer_elevated : theme.tokens.color_bg_layer, transition: theme.transitions.create(['transform'], {
|
|
98
116
|
duration: isOpen ? theme.transitions.duration.enteringScreen : theme.transitions.duration.leavingScreen,
|
|
@@ -117,11 +135,135 @@ var CloseButton = (0, styled_1.styled)(icon_button_1.IconButton, {
|
|
|
117
135
|
slot: 'CloseButton',
|
|
118
136
|
})({
|
|
119
137
|
position: 'absolute',
|
|
120
|
-
top:
|
|
138
|
+
top: 24,
|
|
121
139
|
right: 24,
|
|
122
140
|
});
|
|
141
|
+
var ResizeHandle = (0, styled_1.styled)('div', {
|
|
142
|
+
name: panel_classes_1.panelComponentName,
|
|
143
|
+
slot: 'ResizeHandle',
|
|
144
|
+
})(function (_a) {
|
|
145
|
+
var ownerState = _a.ownerState, theme = _a.theme;
|
|
146
|
+
return (__assign({ width: '16px', cursor: 'ew-resize', position: 'absolute', top: 0, bottom: 0, zIndex: 1, outline: 'none', transition: theme.transitions.create(['all'], {
|
|
147
|
+
duration: theme.transitions.duration.shortest,
|
|
148
|
+
}) }, (ownerState.placement === 'start'
|
|
149
|
+
? {
|
|
150
|
+
right: -16,
|
|
151
|
+
'&:hover, &:focus, &:focus-visible': {
|
|
152
|
+
boxShadow: "inset 2px 0 0 0 ".concat(theme.tokens.color_border_brand_primary),
|
|
153
|
+
},
|
|
154
|
+
}
|
|
155
|
+
: {
|
|
156
|
+
left: -16,
|
|
157
|
+
'&:hover, &:focus, &:focus-visible': {
|
|
158
|
+
boxShadow: "inset -2px 0 0 0 ".concat(theme.tokens.color_border_brand_primary),
|
|
159
|
+
},
|
|
160
|
+
})));
|
|
161
|
+
});
|
|
162
|
+
var DragIcon = (0, styled_1.styled)('div', {
|
|
163
|
+
name: panel_classes_1.panelComponentName,
|
|
164
|
+
slot: 'ResizeIcon',
|
|
165
|
+
})(function (_a) {
|
|
166
|
+
var ownerState = _a.ownerState, theme = _a.theme;
|
|
167
|
+
return (__assign(__assign(__assign({ display: 'flex', width: 18, height: 48, cursor: 'col-resize', position: 'absolute', top: '50%', transform: 'translateY(-50%)', zIndex: 2 }, (ownerState.placement === 'start'
|
|
168
|
+
? {
|
|
169
|
+
right: 10,
|
|
170
|
+
}
|
|
171
|
+
: {
|
|
172
|
+
left: 10,
|
|
173
|
+
})), { '&:after': {
|
|
174
|
+
content: '""',
|
|
175
|
+
display: 'block',
|
|
176
|
+
background: theme.tokens.color_bg_layer_bold,
|
|
177
|
+
width: 4,
|
|
178
|
+
height: 40,
|
|
179
|
+
borderRadius: 4,
|
|
180
|
+
alignItems: 'center',
|
|
181
|
+
} }), (ownerState.placement === 'start'
|
|
182
|
+
? {
|
|
183
|
+
justifyContent: 'flex-start',
|
|
184
|
+
}
|
|
185
|
+
: {
|
|
186
|
+
justifyContent: 'flex-end',
|
|
187
|
+
})));
|
|
188
|
+
});
|
|
123
189
|
exports.Panel = React.forwardRef(function (props, ref) {
|
|
124
|
-
var title = props.title, isOpen = props.isOpen, _a = props.placement, placement = _a === void 0 ? 'end' : _a, _b = props.variant, variant = _b === void 0 ? 'permanent' : _b, _c = props.size, size = _c === void 0 ? 'medium' : _c, onClose = props.onClose, closeButtonLabel = props.closeButtonLabel, className = props.className, propClasses = props.classes, isFixed = props.isFixed, propOffsetTop = props.offsetTop, children = props.children, _d = props.closeIconButtonProps, closeIconButtonProps = _d === void 0 ? {} : _d, _e = props.PanelHeaderProps, PanelHeaderProps = _e === void 0 ? {} : _e, rootProps = __rest(props, ["title", "isOpen", "placement", "variant", "size", "onClose", "closeButtonLabel", "className", "classes", "isFixed", "offsetTop", "children", "closeIconButtonProps", "PanelHeaderProps"]);
|
|
190
|
+
var title = props.title, isOpen = props.isOpen, _a = props.placement, placement = _a === void 0 ? 'end' : _a, _b = props.variant, variant = _b === void 0 ? 'permanent' : _b, _c = props.size, size = _c === void 0 ? 'medium' : _c, onClose = props.onClose, closeButtonLabel = props.closeButtonLabel, className = props.className, propClasses = props.classes, isFixed = props.isFixed, propOffsetTop = props.offsetTop, children = props.children, _d = props.closeIconButtonProps, closeIconButtonProps = _d === void 0 ? {} : _d, _e = props.PanelHeaderProps, PanelHeaderProps = _e === void 0 ? {} : _e, _f = props.resizable, resizable = _f === void 0 ? false : _f, _g = props.maxWidth, maxWidth = _g === void 0 ? 960 : _g, _h = props.minWidth, minWidth = _h === void 0 ? 200 : _h, _j = props.showDragHandle, showDragHandle = _j === void 0 ? false : _j, rootProps = __rest(props, ["title", "isOpen", "placement", "variant", "size", "onClose", "closeButtonLabel", "className", "classes", "isFixed", "offsetTop", "children", "closeIconButtonProps", "PanelHeaderProps", "resizable", "maxWidth", "minWidth", "showDragHandle"]);
|
|
191
|
+
var _k = __read(React.useState(widthBySize[size]), 2), panelWidth = _k[0], setPanelWidth = _k[1];
|
|
192
|
+
var _l = __read(React.useState(false), 2), isDragging = _l[0], setIsDragging = _l[1];
|
|
193
|
+
var lastSyncedSizeRef = React.useRef(size);
|
|
194
|
+
var panelRef = React.useRef(null);
|
|
195
|
+
var dragStartRef = React.useRef(null);
|
|
196
|
+
var isDraggingRef = React.useRef(false);
|
|
197
|
+
React.useEffect(function () {
|
|
198
|
+
if (size === lastSyncedSizeRef.current || isDragging) {
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
setPanelWidth(widthBySize[size]);
|
|
202
|
+
lastSyncedSizeRef.current = size;
|
|
203
|
+
}, [size, isDragging]);
|
|
204
|
+
React.useEffect(function () {
|
|
205
|
+
var handleDocumentMouseMove = function (dragEvent) {
|
|
206
|
+
if (!isDraggingRef.current || !dragStartRef.current) {
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
var _a = dragStartRef.current, startX = _a.startX, startWidth = _a.startWidth;
|
|
210
|
+
var deltaX = dragEvent.clientX - startX;
|
|
211
|
+
var tentativeWidth = placement === 'start' ? startWidth + deltaX : startWidth - deltaX;
|
|
212
|
+
var nextWidth = Math.min(maxWidth, Math.max(minWidth, tentativeWidth));
|
|
213
|
+
setPanelWidth(nextWidth);
|
|
214
|
+
};
|
|
215
|
+
var handleDocumentMouseUp = function () {
|
|
216
|
+
isDraggingRef.current = false;
|
|
217
|
+
dragStartRef.current = null;
|
|
218
|
+
setIsDragging(false);
|
|
219
|
+
};
|
|
220
|
+
document.addEventListener('mousemove', handleDocumentMouseMove);
|
|
221
|
+
document.addEventListener('mouseup', handleDocumentMouseUp);
|
|
222
|
+
return function () {
|
|
223
|
+
document.removeEventListener('mousemove', handleDocumentMouseMove);
|
|
224
|
+
document.removeEventListener('mouseup', handleDocumentMouseUp);
|
|
225
|
+
};
|
|
226
|
+
}, [placement, maxWidth, minWidth]);
|
|
227
|
+
var handleMouseDown = function (e) {
|
|
228
|
+
if (!resizable)
|
|
229
|
+
return;
|
|
230
|
+
e.preventDefault();
|
|
231
|
+
e.stopPropagation();
|
|
232
|
+
var startX = e.clientX;
|
|
233
|
+
var startWidth = panelRef.current ? panelRef.current.offsetWidth : 0;
|
|
234
|
+
dragStartRef.current = { startX: startX, startWidth: startWidth };
|
|
235
|
+
isDraggingRef.current = true;
|
|
236
|
+
setIsDragging(true);
|
|
237
|
+
};
|
|
238
|
+
var handleClick = function (e) {
|
|
239
|
+
e.preventDefault();
|
|
240
|
+
e.stopPropagation();
|
|
241
|
+
};
|
|
242
|
+
var handleKeyDown = function (e) {
|
|
243
|
+
if (!resizable) {
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
var step = 16;
|
|
247
|
+
var delta = 0;
|
|
248
|
+
if (placement === 'start') {
|
|
249
|
+
if (e.key === 'ArrowRight')
|
|
250
|
+
delta = step;
|
|
251
|
+
if (e.key === 'ArrowLeft')
|
|
252
|
+
delta = -step;
|
|
253
|
+
}
|
|
254
|
+
else {
|
|
255
|
+
if (e.key === 'ArrowLeft')
|
|
256
|
+
delta = step;
|
|
257
|
+
if (e.key === 'ArrowRight')
|
|
258
|
+
delta = -step;
|
|
259
|
+
}
|
|
260
|
+
if (delta === 0) {
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
e.preventDefault();
|
|
264
|
+
e.stopPropagation();
|
|
265
|
+
setPanelWidth(function (currentWidth) { return Math.min(maxWidth, Math.max(minWidth, currentWidth + delta)); });
|
|
266
|
+
};
|
|
125
267
|
var classes = (0, classes_1.useMergedClasses)(panel_classes_1.panelClasses, panel_classes_1.getPanelUtilityClass, propClasses);
|
|
126
268
|
var offsetTop = propOffsetTop != null ? propOffsetTop : isFixed ? 'appbar' : 0;
|
|
127
269
|
var ownerState = {
|
|
@@ -131,13 +273,18 @@ exports.Panel = React.forwardRef(function (props, ref) {
|
|
|
131
273
|
size: size,
|
|
132
274
|
isFixed: isFixed,
|
|
133
275
|
offsetTop: offsetTop,
|
|
276
|
+
width: panelWidth,
|
|
134
277
|
};
|
|
135
278
|
var showCloseButton = variant !== 'permanent' && !!onClose;
|
|
136
279
|
return (React.createElement(Root, __assign({ ref: ref, ownerState: ownerState, className: (0, utils_1.clsx)(classes.root, classes["size".concat((0, utils_1.capitalize)(size))], classes["variant".concat((0, utils_1.capitalize)(variant))], classes["placement".concat((0, utils_1.capitalize)(placement))], isFixed && classes.fixed, isOpen && classes.open, className) }, rootProps),
|
|
137
280
|
React.createElement(panel_context_1.PanelContext.Provider, { value: __assign(__assign({}, ownerState), { isCloseButtonVisible: showCloseButton }) },
|
|
138
|
-
React.createElement(Content, { className: classes.content, ownerState: ownerState },
|
|
281
|
+
React.createElement(Content, { ref: panelRef, className: classes.content, ownerState: ownerState },
|
|
139
282
|
showCloseButton && (React.createElement(CloseButton, __assign({ label: closeButtonLabel || 'close', className: classes.closeButton, onClick: function (e) { return onClose(e, 'closeButtonClick'); }, variant: "outlined", size: "small", shape: "circular" }, closeIconButtonProps),
|
|
140
283
|
React.createElement(icon_1.XIcon, null))),
|
|
284
|
+
resizable && (React.createElement(ResizeHandle, { tabIndex: 0, role: "separator", "aria-orientation": placement === 'start' || placement === 'end' ? 'vertical' : 'horizontal', "aria-label": "Resize panel", "aria-valuemin": minWidth, "aria-valuemax": maxWidth, "aria-valuenow": panelWidth, onMouseDown: function (event) {
|
|
285
|
+
event.currentTarget.focus();
|
|
286
|
+
handleMouseDown(event);
|
|
287
|
+
}, onKeyDown: handleKeyDown, onClick: handleClick, ownerState: ownerState }, showDragHandle && React.createElement(DragIcon, { ownerState: ownerState }))),
|
|
141
288
|
!!title && React.createElement(panel_header_1.PanelHeader, __assign({ title: title }, PanelHeaderProps)),
|
|
142
289
|
children))));
|
|
143
290
|
});
|
package/panel/panel-context.d.ts
CHANGED
|
@@ -21,6 +21,8 @@ export interface IPanelContextValue {
|
|
|
21
21
|
* @default end
|
|
22
22
|
* */
|
|
23
23
|
placement: PanelPlacement;
|
|
24
|
+
/** Resizable panel */
|
|
25
|
+
resizable?: boolean;
|
|
24
26
|
/** Sets panel to open or closed if variant is floating or persistent. Permanent panels cannot be closed. */
|
|
25
27
|
isOpen?: boolean;
|
|
26
28
|
/** sets position to fixed.*/
|
package/panel/panel-context.js
CHANGED