@react-fabric/core 1.0.0-beta.19 → 1.0.0-beta.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/panel/Panel.js +1 -1
- package/dist/cjs/overlays/flyout/Flyout.js +39 -42
- package/dist/cjs/overlays/modal/Modal.js +0 -2
- package/dist/esm/components/panel/Panel.js +1 -1
- package/dist/esm/overlays/flyout/Flyout.js +39 -42
- package/dist/esm/overlays/modal/Modal.js +0 -2
- package/dist/types/components/tabpanel/TabPanel.d.ts +3 -3
- package/dist/types/index.d.ts +1 -0
- package/dist/types/types/index.d.ts +4 -1
- package/package.json +3 -3
- package/src/components/panel/Panel.tsx +1 -1
- package/src/components/tabpanel/TabPanel.tsx +3 -3
- package/src/index.ts +1 -0
- package/src/overlays/flyout/Flyout.tsx +57 -61
- package/src/overlays/modal/Modal.tsx +0 -3
- package/src/types/index.ts +5 -9
|
@@ -91,7 +91,7 @@ var Panel = function Panel(_ref) {
|
|
|
91
91
|
className: classNames(titleClassName, "flex-1 select-none truncate", title && "py-1 first:px-2"),
|
|
92
92
|
children: title
|
|
93
93
|
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
94
|
-
className: "px-1",
|
|
94
|
+
className: "px-1 leading-none",
|
|
95
95
|
children: actions
|
|
96
96
|
}), hasTools && /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
97
97
|
role: "none",
|
|
@@ -47,6 +47,7 @@ var Flyout = function Flyout(_ref) {
|
|
|
47
47
|
context = _useFloating.context;
|
|
48
48
|
var dismiss = react.useDismiss(context, {
|
|
49
49
|
outsidePressEvent: "mousedown",
|
|
50
|
+
outsidePress: !hideMask,
|
|
50
51
|
escapeKey: true
|
|
51
52
|
});
|
|
52
53
|
var role = react.useRole(context);
|
|
@@ -73,9 +74,7 @@ var Flyout = function Flyout(_ref) {
|
|
|
73
74
|
}, [onBeforeClose, onClose]);
|
|
74
75
|
react$1.useEffect(function () {
|
|
75
76
|
setTimeout(function () {
|
|
76
|
-
var _refs$floating$curren2;
|
|
77
77
|
refs.floating.current && (refs.floating.current.dataset.show = "true");
|
|
78
|
-
(_refs$floating$curren2 = refs.floating.current) === null || _refs$floating$curren2 === void 0 || (_refs$floating$curren2 = _refs$floating$curren2.querySelector('[role="dialog"]')) === null || _refs$floating$curren2 === void 0 || _refs$floating$curren2.focus();
|
|
79
78
|
}, 50);
|
|
80
79
|
}, []);
|
|
81
80
|
var tryClosing = react$1.useCallback(function (e) {
|
|
@@ -103,47 +102,45 @@ var Flyout = function Flyout(_ref) {
|
|
|
103
102
|
children: /*#__PURE__*/jsxRuntime.jsx(Wrapper, {
|
|
104
103
|
children: /*#__PURE__*/jsxRuntime.jsx(react.FloatingFocusManager, {
|
|
105
104
|
context: context,
|
|
106
|
-
children: /*#__PURE__*/jsxRuntime.jsx(
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
children: /*#__PURE__*/jsxRuntime.jsxs(
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
}
|
|
137
|
-
})]
|
|
138
|
-
}), loading && /*#__PURE__*/jsxRuntime.jsx(Animations.Loading, {}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
139
|
-
role: "dialog",
|
|
140
|
-
className: classNames(Flyout_module.flyoutBody, "flex-1 grid overflow-hidden"),
|
|
141
|
-
tabIndex: 0,
|
|
142
|
-
children: children
|
|
105
|
+
children: /*#__PURE__*/jsxRuntime.jsx("div", _objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
106
|
+
"data-align": align,
|
|
107
|
+
className: classNames(Flyout_module.flyout, "fixed inset-y-0 overflow-hidden flex flex-col flex-nowrap pointer-events-auto shadow-xl", align === "start" ? "start-0" : "end-0", size === "sm" && "w-[20rem]", size === "md" && "w-[40rem]", size === "lg" && "w-[60vw]", size === "xl" && "w-[80vw]"),
|
|
108
|
+
style: {
|
|
109
|
+
width: width,
|
|
110
|
+
minWidth: minWidth
|
|
111
|
+
},
|
|
112
|
+
onMouseUpCapture: tryClosing,
|
|
113
|
+
ref: refs.setFloating
|
|
114
|
+
}, getFloatingProps()), aria), aria), {}, {
|
|
115
|
+
children: /*#__PURE__*/jsxRuntime.jsxs(HotKeyWrapper.HotKeyWrapper, {
|
|
116
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs(HeadFoot.Header, {
|
|
117
|
+
flex: true,
|
|
118
|
+
className: classNames(Flyout_module.flyoutHeader, headerClassName),
|
|
119
|
+
children: [icon && /*#__PURE__*/jsxRuntime.jsx(Icon.Icon, {
|
|
120
|
+
icon: icon,
|
|
121
|
+
bg: iconBg,
|
|
122
|
+
color: iconColor,
|
|
123
|
+
className: classNames(iconClassName, "p-1"),
|
|
124
|
+
rtlFlip: rtlFlip
|
|
125
|
+
}), /*#__PURE__*/jsxRuntime.jsx("label", {
|
|
126
|
+
className: "flex-1 truncate py-2 px-1",
|
|
127
|
+
children: title
|
|
128
|
+
}), actions, /*#__PURE__*/jsxRuntime.jsx(Icon.Icon, {
|
|
129
|
+
"data-ref": "panelClose",
|
|
130
|
+
className: classNames(Flyout_module.panelAction, "cursor-pointer p-1 text-xl self-stretch"),
|
|
131
|
+
icon: icons.CoreIcons.close,
|
|
132
|
+
onClick: function onClick() {
|
|
133
|
+
return handleClose(false);
|
|
134
|
+
}
|
|
143
135
|
})]
|
|
144
|
-
})
|
|
145
|
-
|
|
146
|
-
|
|
136
|
+
}), loading && /*#__PURE__*/jsxRuntime.jsx(Animations.Loading, {}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
137
|
+
role: "dialog",
|
|
138
|
+
className: classNames(Flyout_module.flyoutBody, "flex-1 grid overflow-hidden"),
|
|
139
|
+
tabIndex: 0,
|
|
140
|
+
children: children
|
|
141
|
+
})]
|
|
142
|
+
})
|
|
143
|
+
}))
|
|
147
144
|
})
|
|
148
145
|
})
|
|
149
146
|
});
|
|
@@ -71,9 +71,7 @@ var Modal = function Modal(_ref) {
|
|
|
71
71
|
}, [onBeforeClose, onClose]);
|
|
72
72
|
react$1.useEffect(function () {
|
|
73
73
|
setTimeout(function () {
|
|
74
|
-
var _refs$floating$curren2;
|
|
75
74
|
refs.floating.current && (refs.floating.current.dataset.show = "true");
|
|
76
|
-
(_refs$floating$curren2 = refs.floating.current) === null || _refs$floating$curren2 === void 0 || (_refs$floating$curren2 = _refs$floating$curren2.querySelector("[role='dialog']")) === null || _refs$floating$curren2 === void 0 || _refs$floating$curren2.focus();
|
|
77
75
|
}, 50);
|
|
78
76
|
}, []);
|
|
79
77
|
return /*#__PURE__*/jsxRuntime.jsx(react.FloatingPortal, {
|
|
@@ -91,7 +91,7 @@ var Panel = function Panel(_ref) {
|
|
|
91
91
|
className: classNames(titleClassName, "flex-1 select-none truncate", title && "py-1 first:px-2"),
|
|
92
92
|
children: title
|
|
93
93
|
}), /*#__PURE__*/jsx("div", {
|
|
94
|
-
className: "px-1",
|
|
94
|
+
className: "px-1 leading-none",
|
|
95
95
|
children: actions
|
|
96
96
|
}), hasTools && /*#__PURE__*/jsxs("div", {
|
|
97
97
|
role: "none",
|
|
@@ -47,6 +47,7 @@ var Flyout = function Flyout(_ref) {
|
|
|
47
47
|
context = _useFloating.context;
|
|
48
48
|
var dismiss = useDismiss(context, {
|
|
49
49
|
outsidePressEvent: "mousedown",
|
|
50
|
+
outsidePress: !hideMask,
|
|
50
51
|
escapeKey: true
|
|
51
52
|
});
|
|
52
53
|
var role = useRole(context);
|
|
@@ -73,9 +74,7 @@ var Flyout = function Flyout(_ref) {
|
|
|
73
74
|
}, [onBeforeClose, onClose]);
|
|
74
75
|
useEffect(function () {
|
|
75
76
|
setTimeout(function () {
|
|
76
|
-
var _refs$floating$curren2;
|
|
77
77
|
refs.floating.current && (refs.floating.current.dataset.show = "true");
|
|
78
|
-
(_refs$floating$curren2 = refs.floating.current) === null || _refs$floating$curren2 === void 0 || (_refs$floating$curren2 = _refs$floating$curren2.querySelector('[role="dialog"]')) === null || _refs$floating$curren2 === void 0 || _refs$floating$curren2.focus();
|
|
79
78
|
}, 50);
|
|
80
79
|
}, []);
|
|
81
80
|
var tryClosing = useCallback(function (e) {
|
|
@@ -103,47 +102,45 @@ var Flyout = function Flyout(_ref) {
|
|
|
103
102
|
children: /*#__PURE__*/jsx(Wrapper, {
|
|
104
103
|
children: /*#__PURE__*/jsx(FloatingFocusManager, {
|
|
105
104
|
context: context,
|
|
106
|
-
children: /*#__PURE__*/jsx(
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
children: /*#__PURE__*/jsxs(
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
}
|
|
137
|
-
})]
|
|
138
|
-
}), loading && /*#__PURE__*/jsx(Loading, {}), /*#__PURE__*/jsx("div", {
|
|
139
|
-
role: "dialog",
|
|
140
|
-
className: classNames(classes.flyoutBody, "flex-1 grid overflow-hidden"),
|
|
141
|
-
tabIndex: 0,
|
|
142
|
-
children: children
|
|
105
|
+
children: /*#__PURE__*/jsx("div", _objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
106
|
+
"data-align": align,
|
|
107
|
+
className: classNames(classes.flyout, "fixed inset-y-0 overflow-hidden flex flex-col flex-nowrap pointer-events-auto shadow-xl", align === "start" ? "start-0" : "end-0", size === "sm" && "w-[20rem]", size === "md" && "w-[40rem]", size === "lg" && "w-[60vw]", size === "xl" && "w-[80vw]"),
|
|
108
|
+
style: {
|
|
109
|
+
width: width,
|
|
110
|
+
minWidth: minWidth
|
|
111
|
+
},
|
|
112
|
+
onMouseUpCapture: tryClosing,
|
|
113
|
+
ref: refs.setFloating
|
|
114
|
+
}, getFloatingProps()), aria), aria), {}, {
|
|
115
|
+
children: /*#__PURE__*/jsxs(HotKeyWrapper, {
|
|
116
|
+
children: [/*#__PURE__*/jsxs(Header, {
|
|
117
|
+
flex: true,
|
|
118
|
+
className: classNames(classes.flyoutHeader, headerClassName),
|
|
119
|
+
children: [icon && /*#__PURE__*/jsx(Icon, {
|
|
120
|
+
icon: icon,
|
|
121
|
+
bg: iconBg,
|
|
122
|
+
color: iconColor,
|
|
123
|
+
className: classNames(iconClassName, "p-1"),
|
|
124
|
+
rtlFlip: rtlFlip
|
|
125
|
+
}), /*#__PURE__*/jsx("label", {
|
|
126
|
+
className: "flex-1 truncate py-2 px-1",
|
|
127
|
+
children: title
|
|
128
|
+
}), actions, /*#__PURE__*/jsx(Icon, {
|
|
129
|
+
"data-ref": "panelClose",
|
|
130
|
+
className: classNames(classes.panelAction, "cursor-pointer p-1 text-xl self-stretch"),
|
|
131
|
+
icon: CoreIcons.close,
|
|
132
|
+
onClick: function onClick() {
|
|
133
|
+
return handleClose(false);
|
|
134
|
+
}
|
|
143
135
|
})]
|
|
144
|
-
})
|
|
145
|
-
|
|
146
|
-
|
|
136
|
+
}), loading && /*#__PURE__*/jsx(Loading, {}), /*#__PURE__*/jsx("div", {
|
|
137
|
+
role: "dialog",
|
|
138
|
+
className: classNames(classes.flyoutBody, "flex-1 grid overflow-hidden"),
|
|
139
|
+
tabIndex: 0,
|
|
140
|
+
children: children
|
|
141
|
+
})]
|
|
142
|
+
})
|
|
143
|
+
}))
|
|
147
144
|
})
|
|
148
145
|
})
|
|
149
146
|
});
|
|
@@ -71,9 +71,7 @@ var Modal = function Modal(_ref) {
|
|
|
71
71
|
}, [onBeforeClose, onClose]);
|
|
72
72
|
useEffect(function () {
|
|
73
73
|
setTimeout(function () {
|
|
74
|
-
var _refs$floating$curren2;
|
|
75
74
|
refs.floating.current && (refs.floating.current.dataset.show = "true");
|
|
76
|
-
(_refs$floating$curren2 = refs.floating.current) === null || _refs$floating$curren2 === void 0 || (_refs$floating$curren2 = _refs$floating$curren2.querySelector("[role='dialog']")) === null || _refs$floating$curren2 === void 0 || _refs$floating$curren2.focus();
|
|
77
75
|
}, 50);
|
|
78
76
|
}, []);
|
|
79
77
|
return /*#__PURE__*/jsx(FloatingPortal, {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
2
|
import { type CallbackReturn, type ChildrenProp } from "../../types";
|
|
3
3
|
import { Tab } from "./Tab";
|
|
4
4
|
export interface TabPanelProps extends ChildrenProp<typeof Tab> {
|
|
@@ -33,11 +33,11 @@ export interface TabPanelProps extends ChildrenProp<typeof Tab> {
|
|
|
33
33
|
/**
|
|
34
34
|
* append element
|
|
35
35
|
*/
|
|
36
|
-
append?:
|
|
36
|
+
append?: ReactNode;
|
|
37
37
|
/**
|
|
38
38
|
* prepend element
|
|
39
39
|
*/
|
|
40
|
-
prepend?:
|
|
40
|
+
prepend?: ReactNode;
|
|
41
41
|
/**
|
|
42
42
|
* change handler
|
|
43
43
|
*/
|
package/dist/types/index.d.ts
CHANGED
|
@@ -15,5 +15,6 @@ export * from "./hooks/useResizeObserver";
|
|
|
15
15
|
export * from "./hooks/useStorage";
|
|
16
16
|
export { HotKey } from "./hotkeys/HotKey";
|
|
17
17
|
export { HotKeyLabel } from "./hotkeys/HotKeyLabel";
|
|
18
|
+
export { type ModalProps } from "./types";
|
|
18
19
|
export { CoreIcons } from "./types/icons";
|
|
19
20
|
export { ApplicationProvider, useApplicationContext, useGlobals, useNotificationService, } from "./context/Global";
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { type Placement } from "@floating-ui/react";
|
|
2
2
|
import { type JSXElementConstructor, type Ref } from "react";
|
|
3
|
+
export type ModalProps<P = unknown> = P & {
|
|
4
|
+
onClose?: (...args: AnyObject) => void;
|
|
5
|
+
};
|
|
3
6
|
export type SizeType = "xs" | "sm" | "md" | "lg" | "xl";
|
|
4
7
|
export type SizeTypeWithZero = "xs" | "sm" | "md" | "lg" | "xl" | 0;
|
|
5
8
|
export type ColorType = "primary" | "accent" | "info" | "danger" | "success" | "warning";
|
|
@@ -54,7 +57,7 @@ export interface TestProps {
|
|
|
54
57
|
*/
|
|
55
58
|
"data-test-value"?: AnyObject;
|
|
56
59
|
}
|
|
57
|
-
export type Elements<T> = React.ReactElement<T> | React.
|
|
60
|
+
export type Elements<T> = React.ReactElement<T> | React.ReactNode;
|
|
58
61
|
export type AriaProps = React.AriaAttributes;
|
|
59
62
|
/**
|
|
60
63
|
* For wrapping components
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-fabric/core",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.20",
|
|
4
4
|
"description": "RUF: Core package",
|
|
5
5
|
"author": "Adarsh Pastakia <adarshpastakia@outlook.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@floating-ui/react": "^0.26.24",
|
|
39
|
-
"@react-fabric/utilities": "^1.0.0-beta.
|
|
39
|
+
"@react-fabric/utilities": "^1.0.0-beta.20",
|
|
40
40
|
"@tailwindcss/container-queries": "^0.1.1",
|
|
41
41
|
"@tailwindcss/forms": "^0.5.7",
|
|
42
42
|
"@tailwindcss/typography": "^0.5.13",
|
|
@@ -56,5 +56,5 @@
|
|
|
56
56
|
"node": ">=18.12.0",
|
|
57
57
|
"npm": ">=8.19.0"
|
|
58
58
|
},
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "b265afe1779c1654fc9cf8d9de6e7396b64515d3"
|
|
60
60
|
}
|
|
@@ -25,7 +25,7 @@ import classNames from "classnames";
|
|
|
25
25
|
import {
|
|
26
26
|
Children,
|
|
27
27
|
cloneElement,
|
|
28
|
-
type
|
|
28
|
+
type ReactNode,
|
|
29
29
|
useCallback,
|
|
30
30
|
useEffect,
|
|
31
31
|
useMemo,
|
|
@@ -68,11 +68,11 @@ export interface TabPanelProps extends ChildrenProp<typeof Tab> {
|
|
|
68
68
|
/**
|
|
69
69
|
* append element
|
|
70
70
|
*/
|
|
71
|
-
append?:
|
|
71
|
+
append?: ReactNode;
|
|
72
72
|
/**
|
|
73
73
|
* prepend element
|
|
74
74
|
*/
|
|
75
|
-
prepend?:
|
|
75
|
+
prepend?: ReactNode;
|
|
76
76
|
/**
|
|
77
77
|
* change handler
|
|
78
78
|
*/
|
package/src/index.ts
CHANGED
|
@@ -140,6 +140,7 @@ export const Flyout = ({
|
|
|
140
140
|
});
|
|
141
141
|
const dismiss = useDismiss(context, {
|
|
142
142
|
outsidePressEvent: "mousedown",
|
|
143
|
+
outsidePress: !hideMask,
|
|
143
144
|
escapeKey: true,
|
|
144
145
|
});
|
|
145
146
|
const role = useRole(context);
|
|
@@ -173,9 +174,6 @@ export const Flyout = ({
|
|
|
173
174
|
useEffect(() => {
|
|
174
175
|
setTimeout(() => {
|
|
175
176
|
refs.floating.current && (refs.floating.current.dataset.show = "true");
|
|
176
|
-
refs.floating.current
|
|
177
|
-
?.querySelector<HTMLElement>('[role="dialog"]')
|
|
178
|
-
?.focus();
|
|
179
177
|
}, 50);
|
|
180
178
|
}, []);
|
|
181
179
|
|
|
@@ -214,68 +212,66 @@ export const Flyout = ({
|
|
|
214
212
|
<FloatingPortal>
|
|
215
213
|
<Wrapper>
|
|
216
214
|
<FloatingFocusManager context={context}>
|
|
217
|
-
<
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
>
|
|
239
|
-
<
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
{icon && (
|
|
245
|
-
<Icon
|
|
246
|
-
icon={icon}
|
|
247
|
-
bg={iconBg}
|
|
248
|
-
color={iconColor}
|
|
249
|
-
className={classNames(iconClassName, "p-1")}
|
|
250
|
-
rtlFlip={rtlFlip}
|
|
251
|
-
/>
|
|
252
|
-
)}
|
|
253
|
-
<label className="flex-1 truncate py-2 px-1">{title}</label>
|
|
254
|
-
{actions}
|
|
215
|
+
<div
|
|
216
|
+
data-align={align}
|
|
217
|
+
className={classNames(
|
|
218
|
+
classes.flyout,
|
|
219
|
+
"fixed inset-y-0 overflow-hidden flex flex-col flex-nowrap pointer-events-auto shadow-xl",
|
|
220
|
+
align === "start" ? "start-0" : "end-0",
|
|
221
|
+
size === "sm" && "w-[20rem]",
|
|
222
|
+
size === "md" && "w-[40rem]",
|
|
223
|
+
size === "lg" && "w-[60vw]",
|
|
224
|
+
size === "xl" && "w-[80vw]",
|
|
225
|
+
)}
|
|
226
|
+
style={{
|
|
227
|
+
width,
|
|
228
|
+
minWidth,
|
|
229
|
+
}}
|
|
230
|
+
onMouseUpCapture={tryClosing}
|
|
231
|
+
ref={refs.setFloating}
|
|
232
|
+
{...getFloatingProps()}
|
|
233
|
+
{...aria}
|
|
234
|
+
{...aria}
|
|
235
|
+
>
|
|
236
|
+
<HotKeyWrapper>
|
|
237
|
+
<Header
|
|
238
|
+
flex
|
|
239
|
+
className={classNames(classes.flyoutHeader, headerClassName)}
|
|
240
|
+
>
|
|
241
|
+
{icon && (
|
|
255
242
|
<Icon
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
icon={CoreIcons.close}
|
|
262
|
-
onClick={() => handleClose(false)}
|
|
243
|
+
icon={icon}
|
|
244
|
+
bg={iconBg}
|
|
245
|
+
color={iconColor}
|
|
246
|
+
className={classNames(iconClassName, "p-1")}
|
|
247
|
+
rtlFlip={rtlFlip}
|
|
263
248
|
/>
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
249
|
+
)}
|
|
250
|
+
<label className="flex-1 truncate py-2 px-1">{title}</label>
|
|
251
|
+
{actions}
|
|
252
|
+
<Icon
|
|
253
|
+
data-ref="panelClose"
|
|
268
254
|
className={classNames(
|
|
269
|
-
classes.
|
|
270
|
-
"
|
|
255
|
+
classes.panelAction,
|
|
256
|
+
"cursor-pointer p-1 text-xl self-stretch",
|
|
271
257
|
)}
|
|
272
|
-
{
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
258
|
+
icon={CoreIcons.close}
|
|
259
|
+
onClick={() => handleClose(false)}
|
|
260
|
+
/>
|
|
261
|
+
</Header>
|
|
262
|
+
{loading && <Loading />}
|
|
263
|
+
<div
|
|
264
|
+
role="dialog"
|
|
265
|
+
className={classNames(
|
|
266
|
+
classes.flyoutBody,
|
|
267
|
+
"flex-1 grid overflow-hidden",
|
|
268
|
+
)}
|
|
269
|
+
{...({ tabIndex: 0 } as AnyObject)}
|
|
270
|
+
>
|
|
271
|
+
{children}
|
|
272
|
+
</div>
|
|
273
|
+
</HotKeyWrapper>
|
|
274
|
+
</div>
|
|
279
275
|
</FloatingFocusManager>
|
|
280
276
|
</Wrapper>
|
|
281
277
|
</FloatingPortal>
|
|
@@ -163,9 +163,6 @@ export const Modal = ({
|
|
|
163
163
|
useEffect(() => {
|
|
164
164
|
setTimeout(() => {
|
|
165
165
|
refs.floating.current && (refs.floating.current.dataset.show = "true");
|
|
166
|
-
refs.floating.current
|
|
167
|
-
?.querySelector<HTMLElement>("[role='dialog']")
|
|
168
|
-
?.focus();
|
|
169
166
|
}, 50);
|
|
170
167
|
}, []);
|
|
171
168
|
|
package/src/types/index.ts
CHANGED
|
@@ -25,6 +25,10 @@
|
|
|
25
25
|
import { type Placement } from "@floating-ui/react";
|
|
26
26
|
import { type JSXElementConstructor, type Ref } from "react";
|
|
27
27
|
|
|
28
|
+
export type ModalProps<P = unknown> = P & {
|
|
29
|
+
onClose?: (...args: AnyObject) => void;
|
|
30
|
+
};
|
|
31
|
+
|
|
28
32
|
export type SizeType = "xs" | "sm" | "md" | "lg" | "xl";
|
|
29
33
|
|
|
30
34
|
export type SizeTypeWithZero = "xs" | "sm" | "md" | "lg" | "xl" | 0;
|
|
@@ -122,15 +126,7 @@ export interface TestProps {
|
|
|
122
126
|
"data-test-value"?: AnyObject;
|
|
123
127
|
}
|
|
124
128
|
|
|
125
|
-
export type Elements<T> =
|
|
126
|
-
| React.ReactElement<T>
|
|
127
|
-
| React.ReactPortal
|
|
128
|
-
| React.ReactNode
|
|
129
|
-
| string
|
|
130
|
-
| number
|
|
131
|
-
| boolean
|
|
132
|
-
| null
|
|
133
|
-
| undefined;
|
|
129
|
+
export type Elements<T> = React.ReactElement<T> | React.ReactNode;
|
|
134
130
|
|
|
135
131
|
export type AriaProps = React.AriaAttributes;
|
|
136
132
|
|