@react-fabric/core 1.0.0-beta.55 → 1.0.0-beta.58
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/css/components/_card.css +8 -4
- package/css/components/_icon.css +3 -3
- package/css/components/_tabPanel.css +40 -0
- package/css/core/_aside.css +4 -6
- package/css/reset/_reset.css +14 -0
- package/dist/cjs/components/avatar/Avatar.js +9 -4
- package/dist/cjs/components/badge/Badge.js +2 -10
- package/dist/cjs/components/button/Button.js +7 -12
- package/dist/cjs/components/card/Card.js +18 -12
- package/dist/cjs/components/chip/Chip.js +9 -14
- package/dist/cjs/components/dropdown/Dropdown.js +1 -0
- package/dist/cjs/components/icon/Icon.js +37 -8
- package/dist/cjs/components/menu/MenuItem.js +5 -12
- package/dist/cjs/components/panel/Panel.js +4 -13
- package/dist/cjs/components/tabpanel/Tab.js +4 -13
- package/dist/cjs/components/tabpanel/TabPanel.js +2 -1
- package/dist/cjs/core/aside/Aside.js +2 -11
- package/dist/cjs/core/headfoot/HeadFoot.js +4 -2
- package/dist/cjs/core/page/Page.js +4 -13
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/overlays/alert/Alert.js +3 -1
- package/dist/cjs/overlays/flyout/Flyout.js +6 -11
- package/dist/cjs/overlays/message/Message.js +2 -0
- package/dist/cjs/overlays/modal/Modal.js +6 -13
- package/dist/cjs/overlays/toast/Toast.js +3 -1
- package/dist/cjs/types/icons.js +2 -1
- package/dist/esm/components/avatar/Avatar.js +9 -4
- package/dist/esm/components/badge/Badge.js +3 -11
- package/dist/esm/components/button/Button.js +9 -14
- package/dist/esm/components/card/Card.js +18 -12
- package/dist/esm/components/chip/Chip.js +10 -15
- package/dist/esm/components/dropdown/Dropdown.js +1 -0
- package/dist/esm/components/icon/Icon.js +39 -11
- package/dist/esm/components/menu/MenuItem.js +6 -13
- package/dist/esm/components/panel/Panel.js +5 -14
- package/dist/esm/components/tabpanel/Tab.js +5 -14
- package/dist/esm/components/tabpanel/TabPanel.js +2 -1
- package/dist/esm/core/aside/Aside.js +3 -12
- package/dist/esm/core/headfoot/HeadFoot.js +4 -2
- package/dist/esm/core/page/Page.js +5 -14
- package/dist/esm/index.js +1 -1
- package/dist/esm/overlays/alert/Alert.js +3 -1
- package/dist/esm/overlays/flyout/Flyout.js +7 -12
- package/dist/esm/overlays/message/Message.js +2 -0
- package/dist/esm/overlays/modal/Modal.js +7 -14
- package/dist/esm/overlays/toast/Toast.js +3 -1
- package/dist/esm/types/icons.js +2 -1
- package/dist/types/components/avatar/Avatar.d.ts +5 -1
- package/dist/types/components/badge/Badge.d.ts +8 -3
- package/dist/types/components/button/Button.d.ts +12 -3
- package/dist/types/components/card/Card.d.ts +5 -3
- package/dist/types/components/chip/Chip.d.ts +12 -3
- package/dist/types/components/icon/Icon.d.ts +10 -4
- package/dist/types/components/index.d.ts +1 -1
- package/dist/types/components/menu/MenuItem.d.ts +1 -1
- package/dist/types/components/menu/types.d.ts +7 -2
- package/dist/types/components/panel/Panel.d.ts +8 -5
- package/dist/types/components/tabpanel/Tab.d.ts +8 -5
- package/dist/types/components/tabpanel/TabPanel.d.ts +5 -1
- package/dist/types/core/aside/Aside.d.ts +8 -5
- package/dist/types/core/page/Page.d.ts +8 -5
- package/dist/types/overlays/alert/Alert.d.ts +15 -3
- package/dist/types/overlays/flyout/Flyout.d.ts +9 -5
- package/dist/types/overlays/message/Message.d.ts +15 -3
- package/dist/types/overlays/modal/Modal.d.ts +6 -6
- package/dist/types/overlays/toast/Toast.d.ts +15 -3
- package/dist/types/types/icons.d.ts +2 -1
- package/dist/types/types/index.d.ts +0 -18
- package/package.json +14 -14
- package/src/components/avatar/Avatar.tsx +10 -2
- package/src/components/badge/Badge.tsx +7 -13
- package/src/components/button/Button.tsx +24 -19
- package/src/components/card/Card.tsx +29 -15
- package/src/components/chip/Chip.tsx +15 -13
- package/src/components/dropdown/Dropdown.tsx +1 -0
- package/src/components/icon/Icon.tsx +48 -7
- package/src/components/index.ts +1 -1
- package/src/components/menu/MenuItem.tsx +4 -9
- package/src/components/menu/types.ts +6 -6
- package/src/components/panel/Panel.tsx +7 -13
- package/src/components/tabpanel/Tab.tsx +8 -19
- package/src/components/tabpanel/TabPanel.tsx +6 -0
- package/src/core/aside/Aside.tsx +7 -13
- package/src/core/headfoot/HeadFoot.tsx +2 -2
- package/src/core/page/Page.tsx +8 -23
- package/src/overlays/alert/Alert.tsx +24 -5
- package/src/overlays/flyout/Flyout.tsx +11 -22
- package/src/overlays/message/Message.tsx +18 -3
- package/src/overlays/modal/Modal.tsx +8 -24
- package/src/overlays/toast/Toast.tsx +23 -4
- package/src/types/global.d.ts +8 -0
- package/src/types/icons.ts +3 -1
- package/src/types/index.ts +0 -19
|
@@ -8,9 +8,9 @@ import { useMemoDebugger } from '../../hooks/useEffectDebugger.js';
|
|
|
8
8
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
9
9
|
import { getColor } from '../../utils/getColor.js';
|
|
10
10
|
import '@react-fabric/utilities';
|
|
11
|
-
import { Icon } from '../icon/Icon.js';
|
|
11
|
+
import { Icon, getIconProps } from '../icon/Icon.js';
|
|
12
12
|
|
|
13
|
-
var _excluded = ["ref", "children", "className", "size", "color", "variant", "icon", "
|
|
13
|
+
var _excluded = ["ref", "children", "className", "size", "color", "variant", "icon", "disabled", "onClick", "onIconClick", "onRemove", "rounded", "preventDefault", "stopPropagation", "as"];
|
|
14
14
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
15
15
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
16
16
|
var SizeMap = {
|
|
@@ -49,14 +49,12 @@ var Chip = function Chip(_ref) {
|
|
|
49
49
|
color = _ref.color,
|
|
50
50
|
variant = _ref.variant,
|
|
51
51
|
icon = _ref.icon,
|
|
52
|
-
iconBg = _ref.iconBg,
|
|
53
|
-
iconColor = _ref.iconColor,
|
|
54
|
-
rtlFlip = _ref.rtlFlip,
|
|
55
52
|
disabled = _ref.disabled,
|
|
56
53
|
onClick = _ref.onClick,
|
|
57
54
|
onIconClick = _ref.onIconClick,
|
|
58
55
|
onRemove = _ref.onRemove,
|
|
59
56
|
rounded = _ref.rounded,
|
|
57
|
+
preventDefault = _ref.preventDefault,
|
|
60
58
|
stopPropagation = _ref.stopPropagation,
|
|
61
59
|
as = _ref.as,
|
|
62
60
|
aria = _objectWithoutProperties(_ref, _excluded);
|
|
@@ -75,9 +73,10 @@ var Chip = function Chip(_ref) {
|
|
|
75
73
|
return s;
|
|
76
74
|
}, [color, size], "Chip styles");
|
|
77
75
|
var clickHandler = useCallback(function (e) {
|
|
78
|
-
|
|
76
|
+
preventDefault && e.preventDefault();
|
|
77
|
+
stopPropagation && e.stopPropagation();
|
|
79
78
|
onClick === null || onClick === void 0 || onClick(e);
|
|
80
|
-
}, [onClick, stopPropagation]);
|
|
79
|
+
}, [onClick, preventDefault, stopPropagation]);
|
|
81
80
|
var removeHandler = useCallback(function (e) {
|
|
82
81
|
if (stopPropagation) e.stopPropagation();
|
|
83
82
|
onRemove === null || onRemove === void 0 || onRemove(e);
|
|
@@ -93,17 +92,13 @@ var Chip = function Chip(_ref) {
|
|
|
93
92
|
"data-inner-clickable": !!onClick,
|
|
94
93
|
onClick: disabled ? undefined : clickHandler
|
|
95
94
|
}, aria), {}, {
|
|
96
|
-
children: [icon && /*#__PURE__*/jsx(Icon, {
|
|
95
|
+
children: [icon && /*#__PURE__*/jsx(Icon, _objectSpread({
|
|
97
96
|
"data-ref": "chipIcon",
|
|
98
97
|
className: classNames("fabric-chipIcon", "m-1 flex-content"),
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
onClick: onIconClick,
|
|
102
|
-
color: iconColor,
|
|
103
|
-
rtlFlip: rtlFlip
|
|
104
|
-
}), children && /*#__PURE__*/jsx("label", {
|
|
98
|
+
onClick: onIconClick
|
|
99
|
+
}, getIconProps(icon))), children && /*#__PURE__*/jsx("label", {
|
|
105
100
|
"data-ref": "chipLabel",
|
|
106
|
-
className: classNames("fabric-chipLabel", "truncate"),
|
|
101
|
+
className: classNames("fabric-chipLabel", "truncate flex-1"),
|
|
107
102
|
children: children
|
|
108
103
|
}), onRemove && /*#__PURE__*/jsx("span", {
|
|
109
104
|
role: "none",
|
|
@@ -112,6 +112,7 @@ var DropdownElement = function DropdownElement(_ref) {
|
|
|
112
112
|
var _anchor$props$onClick, _anchor$props;
|
|
113
113
|
(_anchor$props$onClick = (_anchor$props = anchor.props).onClick) === null || _anchor$props$onClick === void 0 || _anchor$props$onClick.call(_anchor$props, e);
|
|
114
114
|
e.stopPropagation();
|
|
115
|
+
e.preventDefault();
|
|
115
116
|
}
|
|
116
117
|
})), {}, {
|
|
117
118
|
"data-inner-clickable": "true",
|
|
@@ -1,16 +1,25 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
4
|
+
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
4
5
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
5
6
|
import { isSvgPath, isString } from '@react-fabric/utilities';
|
|
6
7
|
import classNames from 'classnames';
|
|
7
|
-
import { useMemo } from 'react';
|
|
8
|
-
import { jsx } from 'react/jsx-runtime';
|
|
8
|
+
import { useState, useEffect, useMemo, isValidElement } from 'react';
|
|
9
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
9
10
|
import { getColor } from '../../utils/getColor.js';
|
|
10
11
|
|
|
11
|
-
var _excluded = ["ref", "icon", "bg", "color", "size", "rtlFlip", "animate", "rounded", "disabled", "viewBox", "className", "onClick"];
|
|
12
|
+
var _excluded = ["ref", "icon", "iconSrc", "bg", "color", "size", "rtlFlip", "animate", "rounded", "disabled", "viewBox", "className", "onClick"];
|
|
12
13
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
13
14
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
15
|
+
var getIconProps = function getIconProps(props) {
|
|
16
|
+
if (typeof props === "string") {
|
|
17
|
+
return {
|
|
18
|
+
icon: props
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
return props;
|
|
22
|
+
};
|
|
14
23
|
var SvgTextSize = ["", ".875em", ".525em", ".35em", ".25em"];
|
|
15
24
|
var SizeMap = {
|
|
16
25
|
xs: "0.625rem",
|
|
@@ -52,6 +61,7 @@ var SizeMap = {
|
|
|
52
61
|
var Icon = function Icon(_ref) {
|
|
53
62
|
var ref = _ref.ref,
|
|
54
63
|
icon = _ref.icon,
|
|
64
|
+
iconSrc = _ref.iconSrc,
|
|
55
65
|
bg = _ref.bg,
|
|
56
66
|
color = _ref.color,
|
|
57
67
|
_ref$size = _ref.size,
|
|
@@ -63,8 +73,16 @@ var Icon = function Icon(_ref) {
|
|
|
63
73
|
_ref$viewBox = _ref.viewBox,
|
|
64
74
|
viewBox = _ref$viewBox === void 0 ? "0 0 24 24" : _ref$viewBox,
|
|
65
75
|
className = _ref.className,
|
|
66
|
-
|
|
76
|
+
_onClick = _ref.onClick,
|
|
67
77
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
78
|
+
var _useState = useState(false),
|
|
79
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
80
|
+
imageFailed = _useState2[0],
|
|
81
|
+
setImageFailed = _useState2[1];
|
|
82
|
+
useEffect(function () {
|
|
83
|
+
setImageFailed(false);
|
|
84
|
+
}, [iconSrc]);
|
|
85
|
+
|
|
68
86
|
/** ***************** style map *******************/
|
|
69
87
|
var styles = useMemo(function () {
|
|
70
88
|
var s = {};
|
|
@@ -90,6 +108,7 @@ var Icon = function Icon(_ref) {
|
|
|
90
108
|
|
|
91
109
|
/** ***************** render icon *******************/
|
|
92
110
|
var iconEl = useMemo(function () {
|
|
111
|
+
if ( /*#__PURE__*/isValidElement(icon)) return icon;
|
|
93
112
|
if (!isString(icon)) {
|
|
94
113
|
throw Error("Invalid icon expected string");
|
|
95
114
|
}
|
|
@@ -116,19 +135,28 @@ var Icon = function Icon(_ref) {
|
|
|
116
135
|
className: "".concat(icon)
|
|
117
136
|
});
|
|
118
137
|
}, [icon, isSvg, viewBox]);
|
|
119
|
-
return /*#__PURE__*/
|
|
138
|
+
return /*#__PURE__*/jsxs("dfn", _objectSpread(_objectSpread({
|
|
120
139
|
"data-ref": "icon",
|
|
121
140
|
ref: ref
|
|
122
141
|
}, rest), {}, {
|
|
123
142
|
role: "presentation",
|
|
124
|
-
className: classNames("fabric-icon", "select-none overflow-hidden box-content leading-none not-italic text-center", !rounded && "rounded", rounded && "rounded-full", animate && "animate-".concat(animate), !!
|
|
125
|
-
onClick: onClick
|
|
143
|
+
className: classNames("fabric-icon", "select-none overflow-hidden box-content leading-none not-italic text-center", !rounded && "rounded", rounded && "rounded-full", animate && "animate-".concat(animate), !!_onClick && disabled && "opacity-30 pointer-events-none", className),
|
|
144
|
+
onClick: function onClick(e) {
|
|
145
|
+
_onClick && e.stopPropagation();
|
|
146
|
+
_onClick && e.preventDefault();
|
|
147
|
+
_onClick === null || _onClick === void 0 || _onClick(e);
|
|
148
|
+
},
|
|
126
149
|
"data-flip": rtlFlip,
|
|
127
150
|
style: styles,
|
|
128
|
-
"data-clickable": !!
|
|
129
|
-
"data-inner-clickable": !!
|
|
130
|
-
children:
|
|
151
|
+
"data-clickable": !!_onClick,
|
|
152
|
+
"data-inner-clickable": !!_onClick,
|
|
153
|
+
children: [iconSrc && !imageFailed && /*#__PURE__*/jsx("img", {
|
|
154
|
+
src: iconSrc,
|
|
155
|
+
onError: function onError() {
|
|
156
|
+
return setImageFailed(true);
|
|
157
|
+
}
|
|
158
|
+
}), (!iconSrc || imageFailed) && iconEl]
|
|
131
159
|
}));
|
|
132
160
|
};
|
|
133
161
|
|
|
134
|
-
export { Icon };
|
|
162
|
+
export { Icon, getIconProps };
|
|
@@ -14,11 +14,11 @@ import '../../hooks/useEffectDebugger.js';
|
|
|
14
14
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
15
15
|
import { Tooltip } from '../../overlays/tooltip/Tooltip.js';
|
|
16
16
|
import { getBadgeProps, Badge } from '../badge/Badge.js';
|
|
17
|
-
import { Icon } from '../icon/Icon.js';
|
|
17
|
+
import { Icon, getIconProps } from '../icon/Icon.js';
|
|
18
18
|
import '../../types/icons.js';
|
|
19
19
|
import '../../hotkeys/HotKeyWrapper.js';
|
|
20
20
|
|
|
21
|
-
var _excluded = ["as", "label", "color", "className", "icon", "
|
|
21
|
+
var _excluded = ["as", "label", "color", "className", "icon", "appendLabel", "altIcon", "id", "active", "disabled", "onClick", "badge", "hotKey", "tabIndex", "minimal", "data-open", "ref"],
|
|
22
22
|
_excluded2 = ["children"];
|
|
23
23
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
24
24
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -50,10 +50,7 @@ var MenuItem = function MenuItem(_ref) {
|
|
|
50
50
|
color = _ref$color === void 0 ? "primary" : _ref$color,
|
|
51
51
|
className = _ref.className,
|
|
52
52
|
icon = _ref.icon,
|
|
53
|
-
iconBg = _ref.iconBg,
|
|
54
|
-
iconColor = _ref.iconColor,
|
|
55
53
|
appendLabel = _ref.appendLabel,
|
|
56
|
-
rtlFlip = _ref.rtlFlip,
|
|
57
54
|
altIcon = _ref.altIcon,
|
|
58
55
|
id = _ref.id,
|
|
59
56
|
active = _ref.active,
|
|
@@ -82,14 +79,10 @@ var MenuItem = function MenuItem(_ref) {
|
|
|
82
79
|
if (minimal && !path) {
|
|
83
80
|
path = iconToken(label);
|
|
84
81
|
}
|
|
85
|
-
return /*#__PURE__*/jsx(Icon, {
|
|
86
|
-
className: classNames("fabric-menuIcon", minimal && "minimal")
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
color: iconColor,
|
|
90
|
-
rtlFlip: rtlFlip
|
|
91
|
-
});
|
|
92
|
-
}, [icon, iconBg, iconColor, rtlFlip, minimal, label]);
|
|
82
|
+
return /*#__PURE__*/jsx(Icon, _objectSpread({
|
|
83
|
+
className: classNames("fabric-menuIcon", minimal && "minimal")
|
|
84
|
+
}, getIconProps((_path = path) !== null && _path !== void 0 ? _path : "")));
|
|
85
|
+
}, [icon, minimal, label]);
|
|
93
86
|
var Wrapper = useCallback(function (_ref2) {
|
|
94
87
|
var children = _ref2.children,
|
|
95
88
|
rest = _objectWithoutProperties(_ref2, _excluded2);
|
|
@@ -6,13 +6,13 @@ import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProper
|
|
|
6
6
|
import classNames from 'classnames';
|
|
7
7
|
import { useMemo } from 'react';
|
|
8
8
|
import { usePropToggle } from '../../hooks/usePropToggle.js';
|
|
9
|
+
import { HotKey } from '../../hotkeys/HotKey.js';
|
|
9
10
|
import { CoreIcons } from '../../types/icons.js';
|
|
10
11
|
import { Loading } from '../animations/Animations.js';
|
|
11
|
-
import { Icon } from '../icon/Icon.js';
|
|
12
|
-
import { HotKey } from '../../hotkeys/HotKey.js';
|
|
12
|
+
import { Icon, getIconProps } from '../icon/Icon.js';
|
|
13
13
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
14
14
|
|
|
15
|
-
var _excluded = ["children", "className", "titleClassName", "headerClassName", "title", "actions", "icon", "
|
|
15
|
+
var _excluded = ["children", "className", "titleClassName", "headerClassName", "title", "actions", "icon", "panelId", "height", "width", "minHeight", "minWidth", "maxHeight", "maxWidth", "loading", "expandable", "expanded", "onExpand", "collapsable", "collapsed", "onCollapse", "onClose", "onBack"];
|
|
16
16
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
17
17
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
18
18
|
/**
|
|
@@ -31,8 +31,6 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
31
31
|
* <Panel
|
|
32
32
|
* title="Panel Title"
|
|
33
33
|
* icon={CoreIcons.info}
|
|
34
|
-
* iconBg="bg-blue-500"
|
|
35
|
-
* iconColor="text-white"
|
|
36
34
|
* actions={<button>Action</button>}
|
|
37
35
|
* expandable
|
|
38
36
|
* collapsable
|
|
@@ -60,9 +58,6 @@ var Panel = function Panel(_ref) {
|
|
|
60
58
|
title = _ref.title,
|
|
61
59
|
actions = _ref.actions,
|
|
62
60
|
icon = _ref.icon,
|
|
63
|
-
iconBg = _ref.iconBg,
|
|
64
|
-
iconColor = _ref.iconColor,
|
|
65
|
-
rtlFlip = _ref.rtlFlip,
|
|
66
61
|
panelId = _ref.panelId,
|
|
67
62
|
height = _ref.height,
|
|
68
63
|
width = _ref.width,
|
|
@@ -121,13 +116,9 @@ var Panel = function Panel(_ref) {
|
|
|
121
116
|
className: classNames("fabric-panelAction", "cursor-pointer"),
|
|
122
117
|
icon: CoreIcons.chevronLeft,
|
|
123
118
|
onClick: onBack
|
|
124
|
-
}), icon && /*#__PURE__*/jsx(Icon, {
|
|
125
|
-
icon: icon,
|
|
126
|
-
bg: iconBg,
|
|
127
|
-
color: iconColor,
|
|
128
|
-
rtlFlip: rtlFlip,
|
|
119
|
+
}), icon && /*#__PURE__*/jsx(Icon, _objectSpread({
|
|
129
120
|
className: "p-2 text-md select-none pointer-events-none"
|
|
130
|
-
}), /*#__PURE__*/jsx("div", {
|
|
121
|
+
}, getIconProps(icon))), /*#__PURE__*/jsx("div", {
|
|
131
122
|
className: classNames(titleClassName, "flex-1 select-none truncate", title && "py-1 first:px-2"),
|
|
132
123
|
children: title
|
|
133
124
|
}), /*#__PURE__*/jsx("div", {
|
|
@@ -13,11 +13,11 @@ import { jsx, jsxs } from 'react/jsx-runtime';
|
|
|
13
13
|
import '../../hotkeys/HotKeyWrapper.js';
|
|
14
14
|
import { Tooltip } from '../../overlays/tooltip/Tooltip.js';
|
|
15
15
|
import { getBadgeProps, Badge } from '../badge/Badge.js';
|
|
16
|
-
import { Icon } from '../icon/Icon.js';
|
|
16
|
+
import { Icon, getIconProps } from '../icon/Icon.js';
|
|
17
17
|
import '../../types/icons.js';
|
|
18
18
|
import { DropdownTool } from '../dropdown/DropdownTool.js';
|
|
19
19
|
|
|
20
|
-
var _excluded = ["ref", "as", "id", "className", "label", "icon", "
|
|
20
|
+
var _excluded = ["ref", "as", "id", "className", "label", "icon", "badge", "disabled", "onClose", "active", "onClick", "tabFlex", "color", "actions", "tooltip", "activeClassName"];
|
|
21
21
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
22
22
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
23
23
|
/**
|
|
@@ -34,8 +34,6 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
34
34
|
* id="tab1"
|
|
35
35
|
* label="Tab 1"
|
|
36
36
|
* icon="home"
|
|
37
|
-
* iconBg="bg-blue-500"
|
|
38
|
-
* iconColor="text-white"
|
|
39
37
|
* badge="New"
|
|
40
38
|
* onClick={(id) => console.log(`Tab clicked: ${id}`)}
|
|
41
39
|
* onClose={() => console.log("Tab closed")}
|
|
@@ -58,9 +56,6 @@ var Tab = function Tab(_ref) {
|
|
|
58
56
|
className = _ref.className,
|
|
59
57
|
label = _ref.label,
|
|
60
58
|
icon = _ref.icon,
|
|
61
|
-
iconBg = _ref.iconBg,
|
|
62
|
-
iconColor = _ref.iconColor,
|
|
63
|
-
rtlFlip = _ref.rtlFlip,
|
|
64
59
|
badge = _ref.badge,
|
|
65
60
|
disabled = _ref.disabled,
|
|
66
61
|
onClose = _ref.onClose,
|
|
@@ -92,19 +87,15 @@ var Tab = function Tab(_ref) {
|
|
|
92
87
|
disabled: disabled,
|
|
93
88
|
"data-color": color,
|
|
94
89
|
"data-inner-clickable": true,
|
|
95
|
-
className: classNames("fabric-tabButton", className, active && "active pointer-events-none", active && activeClassName, disabled && "text-tint-500 pointer-events-none", tabFlex ? "flex-1" : "flex-initial max-w-36", minimal ? "min-w-6 rounded" : "
|
|
90
|
+
className: classNames("fabric-tabButton", className, active && "active pointer-events-none", active && activeClassName, disabled && "text-tint-500 pointer-events-none", tabFlex ? "flex-1" : "flex-initial max-w-36", minimal ? "min-w-6 rounded" : "rounded-capped", "flex items-center justify-center overflow-hidden cursor-pointer"),
|
|
96
91
|
onClick: function onClick() {
|
|
97
92
|
return !active && (_onClick === null || _onClick === void 0 ? void 0 : _onClick(id));
|
|
98
93
|
},
|
|
99
94
|
ref: ref
|
|
100
95
|
}, aria), {}, {
|
|
101
|
-
children: [icon && /*#__PURE__*/jsx(Icon, {
|
|
102
|
-
icon: icon,
|
|
103
|
-
bg: iconBg,
|
|
104
|
-
color: iconColor,
|
|
105
|
-
rtlFlip: rtlFlip,
|
|
96
|
+
children: [icon && /*#__PURE__*/jsx(Icon, _objectSpread({
|
|
106
97
|
className: "flex-content p-2"
|
|
107
|
-
}), !minimal && /*#__PURE__*/jsx("label", {
|
|
98
|
+
}, getIconProps(icon))), !minimal && /*#__PURE__*/jsx("label", {
|
|
108
99
|
className: "flex-initial truncate text-center px-1 py-1",
|
|
109
100
|
children: label
|
|
110
101
|
}), badge && /*#__PURE__*/jsx(Badge, _objectSpread(_objectSpread({}, badgeProps), {}, {
|
|
@@ -55,6 +55,7 @@ var TabPanel = function TabPanel(_ref) {
|
|
|
55
55
|
tabFlex = _ref.tabFlex,
|
|
56
56
|
append = _ref.append,
|
|
57
57
|
prepend = _ref.prepend,
|
|
58
|
+
tabRotate = _ref.tabRotate,
|
|
58
59
|
gap = _ref.gap,
|
|
59
60
|
onBeforeChange = _ref.onBeforeChange,
|
|
60
61
|
onChange = _ref.onChange;
|
|
@@ -93,7 +94,7 @@ var TabPanel = function TabPanel(_ref) {
|
|
|
93
94
|
"data-orientation": orientation,
|
|
94
95
|
"data-variant": variant !== null && variant !== void 0 ? variant : "default",
|
|
95
96
|
children: [/*#__PURE__*/jsxs("div", {
|
|
96
|
-
className: classNames("fabric-tabHeader", headerClassName, justify && "justify-".concat(justify), ["start", "end"].includes(orientation) && "flex-col", "flex flex-nowrap overflow-hidden items-center"),
|
|
97
|
+
className: classNames("fabric-tabHeader", headerClassName, tabRotate && "tab-rotate", justify && "justify-".concat(justify), ["start", "end"].includes(orientation) && "flex-col", "flex flex-nowrap overflow-hidden items-center"),
|
|
97
98
|
children: [prepend, /*#__PURE__*/jsx("div", {
|
|
98
99
|
className: classNames("fabric-tabList", justify && "justify-".concat(justify), ["start", "end"].includes(orientation) && "flex-col", ["bottom", "end"].includes(orientation) ? "self-start" : "self-end", "flex flex-1 flex-nowrap overflow-auto scroll-thin"),
|
|
99
100
|
style: {
|
|
@@ -5,7 +5,7 @@ import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
|
5
5
|
import classNames from 'classnames';
|
|
6
6
|
import { useRef, useState, useEffect, useCallback, useMemo } from 'react';
|
|
7
7
|
import { Loading } from '../../components/animations/Animations.js';
|
|
8
|
-
import { Icon } from '../../components/icon/Icon.js';
|
|
8
|
+
import { Icon, getIconProps } from '../../components/icon/Icon.js';
|
|
9
9
|
import { useLayoutEffectDebugger } from '../../hooks/useEffectDebugger.js';
|
|
10
10
|
import { usePropToggle } from '../../hooks/usePropToggle.js';
|
|
11
11
|
import { useResize } from '../../hooks/useResize.js';
|
|
@@ -28,8 +28,6 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
28
28
|
* <Aside
|
|
29
29
|
* title="Sidebar Title"
|
|
30
30
|
* icon={CoreIcons.menu}
|
|
31
|
-
* iconBg="bg-gray-200"
|
|
32
|
-
* iconColor="text-gray-800"
|
|
33
31
|
* rtlFlip={true}
|
|
34
32
|
* className="custom-aside"
|
|
35
33
|
* bodyClassName="custom-aside-body"
|
|
@@ -59,9 +57,6 @@ var Aside = function Aside(_ref) {
|
|
|
59
57
|
var children = _ref.children,
|
|
60
58
|
title = _ref.title,
|
|
61
59
|
icon = _ref.icon,
|
|
62
|
-
iconBg = _ref.iconBg,
|
|
63
|
-
iconColor = _ref.iconColor,
|
|
64
|
-
rtlFlip = _ref.rtlFlip,
|
|
65
60
|
className = _ref.className,
|
|
66
61
|
bodyClassName = _ref.bodyClassName,
|
|
67
62
|
headerClassName = _ref.headerClassName,
|
|
@@ -160,13 +155,9 @@ var Aside = function Aside(_ref) {
|
|
|
160
155
|
rtlFlip: true,
|
|
161
156
|
onClick: toggleCollapse,
|
|
162
157
|
"data-ref": "asideToggle"
|
|
163
|
-
}), icon && /*#__PURE__*/jsx(Icon, {
|
|
164
|
-
icon: icon,
|
|
165
|
-
bg: iconBg,
|
|
166
|
-
color: iconColor,
|
|
167
|
-
rtlFlip: rtlFlip,
|
|
158
|
+
}), icon && /*#__PURE__*/jsx(Icon, _objectSpread({
|
|
168
159
|
className: classNames("fabric-asideIcon", "p-1 text-lg select-none pointer-events-none")
|
|
169
|
-
}), actions && /*#__PURE__*/jsx("div", {
|
|
160
|
+
}, getIconProps(icon))), actions && /*#__PURE__*/jsx("div", {
|
|
170
161
|
className: "fabric-asideActions",
|
|
171
162
|
children: actions
|
|
172
163
|
})]
|
|
@@ -50,7 +50,8 @@ var HeadFoot = function HeadFoot(_ref) {
|
|
|
50
50
|
var Header = function Header(props) {
|
|
51
51
|
return /*#__PURE__*/jsx(HeadFoot, _objectSpread({
|
|
52
52
|
as: "header",
|
|
53
|
-
area: "head"
|
|
53
|
+
area: "head",
|
|
54
|
+
"data-ref": "header"
|
|
54
55
|
}, props));
|
|
55
56
|
};
|
|
56
57
|
|
|
@@ -78,7 +79,8 @@ var Header = function Header(props) {
|
|
|
78
79
|
var Footer = function Footer(props) {
|
|
79
80
|
return /*#__PURE__*/jsx(HeadFoot, _objectSpread({
|
|
80
81
|
as: "footer",
|
|
81
|
-
area: "foot"
|
|
82
|
+
area: "foot",
|
|
83
|
+
"data-ref": "footer"
|
|
82
84
|
}, props));
|
|
83
85
|
};
|
|
84
86
|
|
|
@@ -4,10 +4,10 @@ import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
|
4
4
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
5
5
|
import classNames from 'classnames';
|
|
6
6
|
import { Loading } from '../../components/animations/Animations.js';
|
|
7
|
-
import { Icon } from '../../components/icon/Icon.js';
|
|
7
|
+
import { Icon, getIconProps } from '../../components/icon/Icon.js';
|
|
8
8
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
9
9
|
|
|
10
|
-
var _excluded = ["ref", "children", "paper", "title", "titleClassName", "icon", "
|
|
10
|
+
var _excluded = ["ref", "children", "paper", "title", "titleClassName", "icon", "loading", "data-testid", "data-test-value"];
|
|
11
11
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
12
12
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
13
13
|
/**
|
|
@@ -24,8 +24,6 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
24
24
|
* <Page
|
|
25
25
|
* title="My Page"
|
|
26
26
|
* icon="home"
|
|
27
|
-
* iconBg="bg-blue-500"
|
|
28
|
-
* iconColor="text-white"
|
|
29
27
|
* loading={false}
|
|
30
28
|
* paper={true}
|
|
31
29
|
* data-testid="my-page"
|
|
@@ -45,9 +43,6 @@ var Page = function Page(_ref) {
|
|
|
45
43
|
title = _ref.title,
|
|
46
44
|
titleClassName = _ref.titleClassName,
|
|
47
45
|
icon = _ref.icon,
|
|
48
|
-
rtlFlip = _ref.rtlFlip,
|
|
49
|
-
iconBg = _ref.iconBg,
|
|
50
|
-
iconColor = _ref.iconColor,
|
|
51
46
|
loading = _ref.loading,
|
|
52
47
|
testId = _ref["data-testid"],
|
|
53
48
|
testValue = _ref["data-test-value"],
|
|
@@ -62,13 +57,9 @@ var Page = function Page(_ref) {
|
|
|
62
57
|
children: [title && /*#__PURE__*/jsxs("div", {
|
|
63
58
|
"data-ref": "pageTitle",
|
|
64
59
|
className: classNames("fabric-pageTitle", "select-none flex gap-1 items-center justify-center px-1 py-0.5 font-medium text-center", titleClassName),
|
|
65
|
-
children: [icon && /*#__PURE__*/jsx(Icon, {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
rtlFlip: rtlFlip,
|
|
69
|
-
bg: iconBg,
|
|
70
|
-
color: iconColor
|
|
71
|
-
}), title]
|
|
60
|
+
children: [icon && /*#__PURE__*/jsx(Icon, _objectSpread({
|
|
61
|
+
size: "1.25em"
|
|
62
|
+
}, getIconProps(icon))), title]
|
|
72
63
|
}), loading && /*#__PURE__*/jsx(Loading, {}), children]
|
|
73
64
|
}));
|
|
74
65
|
};
|
package/dist/esm/index.js
CHANGED
|
@@ -20,7 +20,7 @@ export { Divider } from './components/divider/Divider.js';
|
|
|
20
20
|
export { Dropdown, DropdownDismiss } from './components/dropdown/Dropdown.js';
|
|
21
21
|
export { DropdownTool } from './components/dropdown/DropdownTool.js';
|
|
22
22
|
export { EmptyContent } from './components/empty/EmptyContent.js';
|
|
23
|
-
export { Icon } from './components/icon/Icon.js';
|
|
23
|
+
export { Icon, getIconProps } from './components/icon/Icon.js';
|
|
24
24
|
export { Image, Video } from './components/media/Media.js';
|
|
25
25
|
export { ContextMenu } from './components/menu/ContextMenu.js';
|
|
26
26
|
export { Menu } from './components/menu/Menu.js';
|
|
@@ -23,6 +23,7 @@ var Alert = function Alert(_ref) {
|
|
|
23
23
|
_ref$color = _ref.color,
|
|
24
24
|
color = _ref$color === void 0 ? "primary" : _ref$color,
|
|
25
25
|
icon = _ref.icon,
|
|
26
|
+
iconSrc = _ref.iconSrc,
|
|
26
27
|
rtlFlip = _ref.rtlFlip,
|
|
27
28
|
actions = _ref.actions,
|
|
28
29
|
onClose = _ref.onClose,
|
|
@@ -57,6 +58,7 @@ var Alert = function Alert(_ref) {
|
|
|
57
58
|
var iconType = useMemo(function () {
|
|
58
59
|
if (icon) return /*#__PURE__*/jsx(Icon, {
|
|
59
60
|
icon: icon,
|
|
61
|
+
iconSrc: iconSrc,
|
|
60
62
|
size: "md",
|
|
61
63
|
rtlFlip: rtlFlip,
|
|
62
64
|
color: "".concat(color, "-600")
|
|
@@ -83,7 +85,7 @@ var Alert = function Alert(_ref) {
|
|
|
83
85
|
color: "".concat(color, "-600")
|
|
84
86
|
});
|
|
85
87
|
}
|
|
86
|
-
}, [color, type, icon]);
|
|
88
|
+
}, [color, type, icon, iconSrc, rtlFlip]);
|
|
87
89
|
var handleClose = useCallback(function (ret) {
|
|
88
90
|
refs.floating.current && (refs.floating.current.dataset.show = "false");
|
|
89
91
|
setTimeout(function () {
|
|
@@ -7,21 +7,18 @@ import { isString } from '@react-fabric/utilities';
|
|
|
7
7
|
import classNames from 'classnames';
|
|
8
8
|
import { useCallback, useEffect, isValidElement } from 'react';
|
|
9
9
|
import { Loading } from '../../components/animations/Animations.js';
|
|
10
|
-
import { Icon } from '../../components/icon/Icon.js';
|
|
10
|
+
import { Icon, getIconProps } from '../../components/icon/Icon.js';
|
|
11
11
|
import { Header } from '../../core/headfoot/HeadFoot.js';
|
|
12
12
|
import { HotKeyWrapper } from '../../hotkeys/HotKeyWrapper.js';
|
|
13
13
|
import { CoreIcons } from '../../types/icons.js';
|
|
14
14
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
15
15
|
|
|
16
|
-
var _excluded = ["icon", "
|
|
16
|
+
var _excluded = ["icon", "iconClassName", "title", "actions", "closeOnClick", "headerClassName", "onClose", "onBeforeClose", "children", "loading", "size", "width", "minWidth", "root", "hideMask", "align"];
|
|
17
17
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
18
18
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
19
19
|
var Flyout = function Flyout(_ref) {
|
|
20
20
|
var icon = _ref.icon,
|
|
21
|
-
iconBg = _ref.iconBg,
|
|
22
|
-
iconColor = _ref.iconColor,
|
|
23
21
|
iconClassName = _ref.iconClassName,
|
|
24
|
-
rtlFlip = _ref.rtlFlip,
|
|
25
22
|
title = _ref.title,
|
|
26
23
|
actions = _ref.actions,
|
|
27
24
|
closeOnClick = _ref.closeOnClick,
|
|
@@ -33,6 +30,7 @@ var Flyout = function Flyout(_ref) {
|
|
|
33
30
|
size = _ref.size,
|
|
34
31
|
width = _ref.width,
|
|
35
32
|
minWidth = _ref.minWidth,
|
|
33
|
+
root = _ref.root,
|
|
36
34
|
hideMask = _ref.hideMask,
|
|
37
35
|
_ref$align = _ref.align,
|
|
38
36
|
align = _ref$align === void 0 ? "start" : _ref$align,
|
|
@@ -85,6 +83,7 @@ var Flyout = function Flyout(_ref) {
|
|
|
85
83
|
}
|
|
86
84
|
}, [closeOnClick, handleClose]);
|
|
87
85
|
return /*#__PURE__*/jsxs(FloatingPortal, {
|
|
86
|
+
root: root,
|
|
88
87
|
children: [!hideMask && /*#__PURE__*/jsx(FloatingOverlay, {
|
|
89
88
|
lockScroll: true,
|
|
90
89
|
style: {
|
|
@@ -109,13 +108,9 @@ var Flyout = function Flyout(_ref) {
|
|
|
109
108
|
flex: true,
|
|
110
109
|
align: "center",
|
|
111
110
|
className: classNames("fabric-flyoutHeader", headerClassName),
|
|
112
|
-
children: [isString(icon) && /*#__PURE__*/jsx(Icon, {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
color: iconColor,
|
|
116
|
-
className: classNames(iconClassName, "p-1"),
|
|
117
|
-
rtlFlip: rtlFlip
|
|
118
|
-
}), /*#__PURE__*/isValidElement(icon) && icon, /*#__PURE__*/jsx("label", {
|
|
111
|
+
children: [isString(icon) && /*#__PURE__*/jsx(Icon, _objectSpread({
|
|
112
|
+
className: classNames(iconClassName, "p-1")
|
|
113
|
+
}, getIconProps(icon))), /*#__PURE__*/isValidElement(icon) && icon, /*#__PURE__*/jsx("label", {
|
|
119
114
|
className: "flex-1 truncate py-2 px-1",
|
|
120
115
|
children: title
|
|
121
116
|
}), actions, /*#__PURE__*/jsx(Icon, {
|
|
@@ -35,6 +35,7 @@ var Message = function Message(_ref) {
|
|
|
35
35
|
message = _ref.message,
|
|
36
36
|
color = _ref.color,
|
|
37
37
|
icon = _ref.icon,
|
|
38
|
+
iconSrc = _ref.iconSrc,
|
|
38
39
|
rtlFlip = _ref.rtlFlip,
|
|
39
40
|
actions = _ref.actions,
|
|
40
41
|
onClose = _ref.onClose;
|
|
@@ -59,6 +60,7 @@ var Message = function Message(_ref) {
|
|
|
59
60
|
ref: elRef,
|
|
60
61
|
children: [icon && /*#__PURE__*/jsx(Icon, {
|
|
61
62
|
icon: icon,
|
|
63
|
+
iconSrc: iconSrc,
|
|
62
64
|
size: "md",
|
|
63
65
|
rtlFlip: rtlFlip
|
|
64
66
|
}), title && /*#__PURE__*/jsx("div", {
|
|
@@ -7,21 +7,18 @@ import { isString } from '@react-fabric/utilities';
|
|
|
7
7
|
import classNames from 'classnames';
|
|
8
8
|
import { useCallback, useEffect, isValidElement } from 'react';
|
|
9
9
|
import { Loading } from '../../components/animations/Animations.js';
|
|
10
|
-
import { Icon } from '../../components/icon/Icon.js';
|
|
10
|
+
import { Icon, getIconProps } from '../../components/icon/Icon.js';
|
|
11
11
|
import { Header } from '../../core/headfoot/HeadFoot.js';
|
|
12
12
|
import { HotKeyWrapper } from '../../hotkeys/HotKeyWrapper.js';
|
|
13
13
|
import { CoreIcons } from '../../types/icons.js';
|
|
14
14
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
15
15
|
|
|
16
|
-
var _excluded = ["icon", "
|
|
16
|
+
var _excluded = ["icon", "iconClassName", "title", "actions", "headerClassName", "onClose", "onBeforeClose", "children", "loading", "root", "size", "hideMask", "width", "height", "minHeight", "minWidth"];
|
|
17
17
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
18
18
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
19
19
|
var Modal = function Modal(_ref) {
|
|
20
20
|
var icon = _ref.icon,
|
|
21
|
-
iconBg = _ref.iconBg,
|
|
22
|
-
iconColor = _ref.iconColor,
|
|
23
21
|
iconClassName = _ref.iconClassName,
|
|
24
|
-
rtlFlip = _ref.rtlFlip,
|
|
25
22
|
title = _ref.title,
|
|
26
23
|
actions = _ref.actions,
|
|
27
24
|
headerClassName = _ref.headerClassName,
|
|
@@ -31,7 +28,7 @@ var Modal = function Modal(_ref) {
|
|
|
31
28
|
loading = _ref.loading,
|
|
32
29
|
root = _ref.root,
|
|
33
30
|
size = _ref.size,
|
|
34
|
-
|
|
31
|
+
hideMask = _ref.hideMask,
|
|
35
32
|
width = _ref.width,
|
|
36
33
|
height = _ref.height,
|
|
37
34
|
minHeight = _ref.minHeight,
|
|
@@ -85,7 +82,7 @@ var Modal = function Modal(_ref) {
|
|
|
85
82
|
position: "absolute",
|
|
86
83
|
overflow: "hidden"
|
|
87
84
|
},
|
|
88
|
-
className: classNames("grid place-items-center p-16", !
|
|
85
|
+
className: classNames("grid place-items-center p-16", !hideMask && "bg-tint-100/20 backdrop-blur-sm"),
|
|
89
86
|
children: /*#__PURE__*/jsx(FloatingFocusManager, {
|
|
90
87
|
context: context,
|
|
91
88
|
children: /*#__PURE__*/jsx("dialog", _objectSpread(_objectSpread(_objectSpread({
|
|
@@ -103,13 +100,9 @@ var Modal = function Modal(_ref) {
|
|
|
103
100
|
flex: true,
|
|
104
101
|
align: "center",
|
|
105
102
|
className: classNames("fabric-modalHeader", headerClassName),
|
|
106
|
-
children: [isString(icon) && /*#__PURE__*/jsx(Icon, {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
color: iconColor,
|
|
110
|
-
className: classNames(iconClassName, "p-1"),
|
|
111
|
-
rtlFlip: rtlFlip
|
|
112
|
-
}), /*#__PURE__*/isValidElement(icon) && icon, /*#__PURE__*/jsx("label", {
|
|
103
|
+
children: [isString(icon) && /*#__PURE__*/jsx(Icon, _objectSpread({
|
|
104
|
+
className: classNames(iconClassName, "p-1")
|
|
105
|
+
}, getIconProps(icon))), /*#__PURE__*/isValidElement(icon) && icon, /*#__PURE__*/jsx("label", {
|
|
113
106
|
className: "flex-1 truncate py-2 px-1",
|
|
114
107
|
children: title
|
|
115
108
|
}), actions, /*#__PURE__*/jsx(Icon, {
|