@react-fabric/core 1.0.0-beta.55 → 1.0.0-beta.57
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/_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 +8 -4
- package/dist/cjs/components/button/Button.js +4 -2
- package/dist/cjs/components/card/Card.js +18 -12
- package/dist/cjs/components/chip/Chip.js +5 -3
- package/dist/cjs/components/dropdown/Dropdown.js +1 -0
- package/dist/cjs/components/icon/Icon.js +9 -5
- package/dist/cjs/components/tabpanel/Tab.js +1 -1
- package/dist/cjs/components/tabpanel/TabPanel.js +2 -1
- package/dist/cjs/overlays/flyout/Flyout.js +3 -1
- package/dist/cjs/overlays/modal/Modal.js +3 -3
- package/dist/esm/components/avatar/Avatar.js +8 -4
- package/dist/esm/components/button/Button.js +4 -2
- package/dist/esm/components/card/Card.js +18 -12
- package/dist/esm/components/chip/Chip.js +5 -3
- package/dist/esm/components/dropdown/Dropdown.js +1 -0
- package/dist/esm/components/icon/Icon.js +9 -5
- package/dist/esm/components/tabpanel/Tab.js +1 -1
- package/dist/esm/components/tabpanel/TabPanel.js +2 -1
- package/dist/esm/overlays/flyout/Flyout.js +3 -1
- package/dist/esm/overlays/modal/Modal.js +3 -3
- package/dist/types/components/avatar/Avatar.d.ts +5 -1
- package/dist/types/components/button/Button.d.ts +5 -1
- package/dist/types/components/card/Card.d.ts +5 -3
- package/dist/types/components/chip/Chip.d.ts +5 -1
- package/dist/types/components/tabpanel/TabPanel.d.ts +5 -1
- package/dist/types/overlays/flyout/Flyout.d.ts +5 -1
- package/dist/types/overlays/modal/Modal.d.ts +2 -2
- package/package.json +2 -2
- package/src/components/avatar/Avatar.tsx +9 -1
- package/src/components/button/Button.tsx +14 -1
- package/src/components/card/Card.tsx +29 -15
- package/src/components/chip/Chip.tsx +8 -2
- package/src/components/dropdown/Dropdown.tsx +1 -0
- package/src/components/icon/Icon.tsx +5 -1
- package/src/components/tabpanel/Tab.tsx +2 -2
- package/src/components/tabpanel/TabPanel.tsx +6 -0
- package/src/overlays/flyout/Flyout.tsx +6 -1
- package/src/overlays/modal/Modal.tsx +3 -3
package/css/components/_card.css
CHANGED
|
@@ -54,8 +54,10 @@
|
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
.fabric-card {
|
|
57
|
+
--tw-shadow-color: var(--border-color-muted);
|
|
58
|
+
|
|
57
59
|
background-color: var(--fabric-bg);
|
|
58
|
-
box-shadow: 0 0 0 1px var(--
|
|
60
|
+
box-shadow: 0 0 0 1px var(--tw-shadow-color);
|
|
59
61
|
|
|
60
62
|
& > * {
|
|
61
63
|
background-color: transparent;
|
|
@@ -82,8 +84,10 @@
|
|
|
82
84
|
}
|
|
83
85
|
|
|
84
86
|
&.clickable {
|
|
87
|
+
--tw-shadow-color: var(--border-color-dimmed);
|
|
88
|
+
|
|
85
89
|
box-shadow:
|
|
86
|
-
0 0 0 1px var(--
|
|
90
|
+
0 0 0 1px var(--tw-shadow-color),
|
|
87
91
|
0 1px 2px 0 var(--fabric-shadow);
|
|
88
92
|
transition: box-shadow 0ms;
|
|
89
93
|
|
|
@@ -91,7 +95,7 @@
|
|
|
91
95
|
:has([data-inner-clickable="true"]:hover)
|
|
92
96
|
) {
|
|
93
97
|
box-shadow:
|
|
94
|
-
0 0 0 1px var(--
|
|
98
|
+
0 0 0 1px var(--tw-shadow-color),
|
|
95
99
|
0 1px 4px 0 var(--fabric-shadow),
|
|
96
100
|
0 8px 16px 0 color-mix(in lab, var(--fabric-shadow) 35%, #0000);
|
|
97
101
|
transition-delay: 150ms;
|
|
@@ -101,7 +105,7 @@
|
|
|
101
105
|
:has([data-inner-clickable="true"]:hover)
|
|
102
106
|
) {
|
|
103
107
|
transform: translateY(1px);
|
|
104
|
-
box-shadow: 0 0 0 1px var(--
|
|
108
|
+
box-shadow: 0 0 0 1px var(--tw-shadow-color);
|
|
105
109
|
transition-delay: 0ms;
|
|
106
110
|
}
|
|
107
111
|
|
|
@@ -30,6 +30,10 @@
|
|
|
30
30
|
|
|
31
31
|
.fabric-tabHeader {
|
|
32
32
|
box-shadow: 0 -1px 0 var(--border-color-dimmed) inset;
|
|
33
|
+
|
|
34
|
+
.fabric-tabButton {
|
|
35
|
+
padding: 0.25rem 0.5rem;
|
|
36
|
+
}
|
|
33
37
|
}
|
|
34
38
|
}
|
|
35
39
|
|
|
@@ -39,6 +43,10 @@
|
|
|
39
43
|
.fabric-tabHeader {
|
|
40
44
|
margin-top: 1px;
|
|
41
45
|
box-shadow: 0 1px 0 var(--border-color-dimmed) inset;
|
|
46
|
+
|
|
47
|
+
.fabric-tabButton {
|
|
48
|
+
padding: 0.25rem 0.5rem;
|
|
49
|
+
}
|
|
42
50
|
}
|
|
43
51
|
}
|
|
44
52
|
|
|
@@ -47,6 +55,22 @@
|
|
|
47
55
|
|
|
48
56
|
.fabric-tabHeader {
|
|
49
57
|
box-shadow: -1px 0 0 var(--border-color-dimmed) inset;
|
|
58
|
+
|
|
59
|
+
.fabric-tabButton {
|
|
60
|
+
min-width: 5rem;
|
|
61
|
+
padding: 0.5rem 0.25rem;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
&.tab-rotate .fabric-tabButton {
|
|
65
|
+
flex-flow: column;
|
|
66
|
+
width: unset !important;
|
|
67
|
+
min-width: unset !important;
|
|
68
|
+
min-height: 5rem;
|
|
69
|
+
|
|
70
|
+
& > label {
|
|
71
|
+
writing-mode: sideways-lr;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
50
74
|
}
|
|
51
75
|
}
|
|
52
76
|
|
|
@@ -55,6 +79,22 @@
|
|
|
55
79
|
|
|
56
80
|
.fabric-tabHeader {
|
|
57
81
|
box-shadow: 1px 0 0 var(--border-color-dimmed) inset;
|
|
82
|
+
|
|
83
|
+
.fabric-tabButton {
|
|
84
|
+
min-width: 5rem;
|
|
85
|
+
padding: 0.5rem 0.25rem;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
&.tab-rotate .fabric-tabButton {
|
|
89
|
+
flex-flow: column;
|
|
90
|
+
width: unset !important;
|
|
91
|
+
min-width: unset !important;
|
|
92
|
+
min-height: 5rem;
|
|
93
|
+
|
|
94
|
+
& > label {
|
|
95
|
+
writing-mode: sideways-rl;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
58
98
|
}
|
|
59
99
|
}
|
|
60
100
|
}
|
package/css/core/_aside.css
CHANGED
|
@@ -202,9 +202,8 @@
|
|
|
202
202
|
}
|
|
203
203
|
|
|
204
204
|
& .fabric-asideTitle {
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
transform: rotate(-90deg) translateY(2rem);
|
|
205
|
+
transform: translateY(2rem);
|
|
206
|
+
writing-mode: sideways-lr;
|
|
208
207
|
}
|
|
209
208
|
|
|
210
209
|
& .fabric-asideCollapse {
|
|
@@ -227,9 +226,8 @@
|
|
|
227
226
|
}
|
|
228
227
|
|
|
229
228
|
& .fabric-asideTitle {
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
transform: rotate(90deg) translateY(2rem);
|
|
229
|
+
transform: translateY(2rem);
|
|
230
|
+
writing-mode: sideways-rl;
|
|
233
231
|
}
|
|
234
232
|
|
|
235
233
|
& .fabric-asideCollapse {
|
package/css/reset/_reset.css
CHANGED
|
@@ -10,7 +10,7 @@ var react = require('react');
|
|
|
10
10
|
var jsxRuntime = require('react/jsx-runtime');
|
|
11
11
|
var getColor = require('../../utils/getColor.js');
|
|
12
12
|
|
|
13
|
-
var _excluded = ["ref", "name", "avatar", "fallbackIcon", "bg", "color", "size", "rounded", "variant", "className", "viewBox", "onClick"];
|
|
13
|
+
var _excluded = ["ref", "name", "avatar", "fallbackIcon", "bg", "color", "size", "rounded", "variant", "className", "viewBox", "preventDefault", "onClick"];
|
|
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 = {
|
|
@@ -64,7 +64,8 @@ var Avatar = function Avatar(_ref) {
|
|
|
64
64
|
className = _ref.className,
|
|
65
65
|
_ref$viewBox = _ref.viewBox,
|
|
66
66
|
viewBox = _ref$viewBox === void 0 ? "0 0 24 24" : _ref$viewBox,
|
|
67
|
-
|
|
67
|
+
preventDefault = _ref.preventDefault,
|
|
68
|
+
_onClick = _ref.onClick,
|
|
68
69
|
aria = _objectWithoutProperties(_ref, _excluded);
|
|
69
70
|
var _useState = react.useState(true),
|
|
70
71
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -159,9 +160,12 @@ var Avatar = function Avatar(_ref) {
|
|
|
159
160
|
return /*#__PURE__*/jsxRuntime.jsxs("dfn", _objectSpread(_objectSpread({
|
|
160
161
|
role: "presentation",
|
|
161
162
|
className: classNames("fabric-avatar", className, "select-none relative overflow-hidden inline-block box-content leading-none not-italic text-center", !rounded && "rounded", rounded && "rounded-full"),
|
|
162
|
-
onClick: onClick
|
|
163
|
+
onClick: function onClick(e) {
|
|
164
|
+
preventDefault && e.preventDefault();
|
|
165
|
+
_onClick === null || _onClick === void 0 || _onClick(e);
|
|
166
|
+
},
|
|
163
167
|
style: styles,
|
|
164
|
-
"data-clickable": !!
|
|
168
|
+
"data-clickable": !!_onClick,
|
|
165
169
|
ref: ref
|
|
166
170
|
}, aria), {}, {
|
|
167
171
|
children: [!fallback && avatarImage, fallback && fallbackAvatar]
|
|
@@ -16,7 +16,7 @@ var Animations = require('../animations/Animations.js');
|
|
|
16
16
|
var Badge = require('../badge/Badge.js');
|
|
17
17
|
var Icon = require('../icon/Icon.js');
|
|
18
18
|
|
|
19
|
-
var _excluded = ["as", "ref", "children", "className", "active", "color", "icon", "iconBg", "iconColor", "iconAlign", "altIcon", "rtlFlip", "rounded", "size", "disabled", "loading", "variant", "badge", "fullWidth", "spinOnHover", "onClick", "actionMessage", "stopPropagation", "type", "hotKey", "showActionDone", "showActionDoneEvent", "tabIndex", "data-ref"];
|
|
19
|
+
var _excluded = ["as", "ref", "children", "className", "active", "color", "icon", "iconBg", "iconColor", "iconAlign", "altIcon", "rtlFlip", "rounded", "size", "disabled", "loading", "variant", "badge", "fullWidth", "spinOnHover", "onClick", "actionMessage", "preventDefault", "stopPropagation", "type", "hotKey", "showActionDone", "showActionDoneEvent", "tabIndex", "data-ref"];
|
|
20
20
|
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; }
|
|
21
21
|
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; }
|
|
22
22
|
/**
|
|
@@ -68,6 +68,7 @@ var Button = function Button(_ref) {
|
|
|
68
68
|
spinOnHover = _ref.spinOnHover,
|
|
69
69
|
onClick = _ref.onClick,
|
|
70
70
|
actionMessage = _ref.actionMessage,
|
|
71
|
+
preventDefault = _ref.preventDefault,
|
|
71
72
|
stopPropagation = _ref.stopPropagation,
|
|
72
73
|
_ref$type = _ref.type,
|
|
73
74
|
type = _ref$type === void 0 ? "button" : _ref$type,
|
|
@@ -92,6 +93,7 @@ var Button = function Button(_ref) {
|
|
|
92
93
|
// Handle click events
|
|
93
94
|
var clickHandler = react.useCallback(function (e) {
|
|
94
95
|
setBusy(true);
|
|
96
|
+
preventDefault && e.preventDefault();
|
|
95
97
|
stopPropagation && e.stopPropagation();
|
|
96
98
|
var ret = onClick === null || onClick === void 0 ? void 0 : onClick(e);
|
|
97
99
|
void Promise.resolve(ret).then(function (b) {
|
|
@@ -100,7 +102,7 @@ var Button = function Button(_ref) {
|
|
|
100
102
|
setActionDone(true);
|
|
101
103
|
}
|
|
102
104
|
});
|
|
103
|
-
}, [onClick, disabled, actionMessage, showActionDoneEvent, stopPropagation]);
|
|
105
|
+
}, [onClick, disabled, preventDefault, actionMessage, showActionDoneEvent, stopPropagation]);
|
|
104
106
|
|
|
105
107
|
/** ***************** reset done state on timeout *******************/
|
|
106
108
|
react.useEffect(function () {
|
|
@@ -11,7 +11,7 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
11
11
|
require('@react-fabric/utilities');
|
|
12
12
|
var nodeCheck = require('../../utils/nodeCheck.js');
|
|
13
13
|
|
|
14
|
-
var _excluded = ["children", "className", "bodyClassName", "selected", "selectedRibbon", "onClick", "onDragStart", "flex", "draggable", "dragKey", "dragData", "ref"];
|
|
14
|
+
var _excluded = ["children", "className", "bodyClassName", "selected", "selectedRibbon", "onClick", "onDragStart", "flex", "draggable", "dragKey", "dragData", "ref", "as"];
|
|
15
15
|
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; }
|
|
16
16
|
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; }
|
|
17
17
|
/**
|
|
@@ -61,6 +61,7 @@ var Card = function Card(_ref) {
|
|
|
61
61
|
dragKey = _ref.dragKey,
|
|
62
62
|
dragData = _ref.dragData,
|
|
63
63
|
ref = _ref.ref,
|
|
64
|
+
as = _ref.as,
|
|
64
65
|
aria = _objectWithoutProperties(_ref, _excluded);
|
|
65
66
|
var _useMemo = react.useMemo(function () {
|
|
66
67
|
return react.Children.toArray(children).reduce(function (ret, node) {
|
|
@@ -77,22 +78,27 @@ var Card = function Card(_ref) {
|
|
|
77
78
|
dragKey && ((_event$dataTransfer = event.dataTransfer) === null || _event$dataTransfer === void 0 ? void 0 : _event$dataTransfer.setData(dragKey, JSON.stringify(dragData)));
|
|
78
79
|
dragKey && (onDragStart === null || onDragStart === void 0 ? void 0 : onDragStart(event, dragKey, dragData));
|
|
79
80
|
}, [onDragStart, dragKey, dragData]);
|
|
81
|
+
var E = as !== null && as !== void 0 ? as : "div";
|
|
80
82
|
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
81
|
-
className: classNames("fabric-cardWrapper", "rounded-capped relative grid", flex && "flex-1", selected && selectedRibbon && "selected", selected && "outline-
|
|
83
|
+
className: classNames("fabric-cardWrapper", "rounded-capped relative grid", flex && "flex-1", selected && selectedRibbon && "selected", selected && "outline-1 outline-accent-500 outline-offset-2"),
|
|
82
84
|
children: /*#__PURE__*/jsxRuntime.jsx(ErrorBoundary.ErrorBoundary, {
|
|
83
|
-
children: /*#__PURE__*/jsxRuntime.jsxs("div",
|
|
84
|
-
className: classNames("fabric-card", className, "rounded-capped flex flex-col flex-nowrap overflow-hidden", onClick && "clickable"),
|
|
85
|
+
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
86
|
+
className: classNames("fabric-card", className, "rounded-capped relative flex flex-col flex-nowrap overflow-hidden", "href" in aria && "clickable", "to" in aria && "clickable", onClick && "clickable"),
|
|
85
87
|
draggable: draggable,
|
|
86
88
|
onDragStart: !draggable ? undefined : handleDragStart,
|
|
87
|
-
ref: ref
|
|
88
|
-
|
|
89
|
-
children: [header, /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
89
|
+
ref: ref,
|
|
90
|
+
children: [header, /*#__PURE__*/jsxRuntime.jsx(E, _objectSpread(_objectSpread({
|
|
90
91
|
role: "none",
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
92
|
+
onClick: onClick
|
|
93
|
+
}, aria), {}, {
|
|
94
|
+
className: "contents",
|
|
95
|
+
children: body && /*#__PURE__*/jsxRuntime.jsx("object", {
|
|
96
|
+
type: "none",
|
|
97
|
+
className: classNames("fabric-cardBody", bodyClassName, "flex-1"),
|
|
98
|
+
children: body
|
|
99
|
+
})
|
|
100
|
+
})), footer]
|
|
101
|
+
})
|
|
96
102
|
})
|
|
97
103
|
});
|
|
98
104
|
};
|
|
@@ -10,7 +10,7 @@ var getColor = require('../../utils/getColor.js');
|
|
|
10
10
|
require('@react-fabric/utilities');
|
|
11
11
|
var Icon = require('../icon/Icon.js');
|
|
12
12
|
|
|
13
|
-
var _excluded = ["ref", "children", "className", "size", "color", "variant", "icon", "iconBg", "iconColor", "rtlFlip", "disabled", "onClick", "onIconClick", "onRemove", "rounded", "stopPropagation", "as"];
|
|
13
|
+
var _excluded = ["ref", "children", "className", "size", "color", "variant", "icon", "iconBg", "iconColor", "rtlFlip", "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 = {
|
|
@@ -57,6 +57,7 @@ var Chip = function Chip(_ref) {
|
|
|
57
57
|
onIconClick = _ref.onIconClick,
|
|
58
58
|
onRemove = _ref.onRemove,
|
|
59
59
|
rounded = _ref.rounded,
|
|
60
|
+
preventDefault = _ref.preventDefault,
|
|
60
61
|
stopPropagation = _ref.stopPropagation,
|
|
61
62
|
as = _ref.as,
|
|
62
63
|
aria = _objectWithoutProperties(_ref, _excluded);
|
|
@@ -75,9 +76,10 @@ var Chip = function Chip(_ref) {
|
|
|
75
76
|
return s;
|
|
76
77
|
}, [color, size], "Chip styles");
|
|
77
78
|
var clickHandler = react.useCallback(function (e) {
|
|
78
|
-
|
|
79
|
+
preventDefault && e.preventDefault();
|
|
80
|
+
stopPropagation && e.stopPropagation();
|
|
79
81
|
onClick === null || onClick === void 0 || onClick(e);
|
|
80
|
-
}, [onClick, stopPropagation]);
|
|
82
|
+
}, [onClick, preventDefault, stopPropagation]);
|
|
81
83
|
var removeHandler = react.useCallback(function (e) {
|
|
82
84
|
if (stopPropagation) e.stopPropagation();
|
|
83
85
|
onRemove === null || onRemove === void 0 || onRemove(e);
|
|
@@ -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",
|
|
@@ -63,7 +63,7 @@ var Icon = function Icon(_ref) {
|
|
|
63
63
|
_ref$viewBox = _ref.viewBox,
|
|
64
64
|
viewBox = _ref$viewBox === void 0 ? "0 0 24 24" : _ref$viewBox,
|
|
65
65
|
className = _ref.className,
|
|
66
|
-
|
|
66
|
+
_onClick = _ref.onClick,
|
|
67
67
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
68
68
|
/** ***************** style map *******************/
|
|
69
69
|
var styles = react.useMemo(function () {
|
|
@@ -121,12 +121,16 @@ var Icon = function Icon(_ref) {
|
|
|
121
121
|
ref: ref
|
|
122
122
|
}, rest), {}, {
|
|
123
123
|
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
|
|
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), !!_onClick && disabled && "opacity-30 pointer-events-none", className),
|
|
125
|
+
onClick: function onClick(e) {
|
|
126
|
+
_onClick && e.stopPropagation();
|
|
127
|
+
_onClick && e.preventDefault();
|
|
128
|
+
_onClick === null || _onClick === void 0 || _onClick(e);
|
|
129
|
+
},
|
|
126
130
|
"data-flip": rtlFlip,
|
|
127
131
|
style: styles,
|
|
128
|
-
"data-clickable": !!
|
|
129
|
-
"data-inner-clickable": !!
|
|
132
|
+
"data-clickable": !!_onClick,
|
|
133
|
+
"data-inner-clickable": !!_onClick,
|
|
130
134
|
children: iconEl
|
|
131
135
|
}));
|
|
132
136
|
};
|
|
@@ -92,7 +92,7 @@ var Tab = function Tab(_ref) {
|
|
|
92
92
|
disabled: disabled,
|
|
93
93
|
"data-color": color,
|
|
94
94
|
"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" : "
|
|
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" : "rounded-capped", "flex items-center justify-center overflow-hidden cursor-pointer"),
|
|
96
96
|
onClick: function onClick() {
|
|
97
97
|
return !active && (_onClick === null || _onClick === void 0 ? void 0 : _onClick(id));
|
|
98
98
|
},
|
|
@@ -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__*/jsxRuntime.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__*/jsxRuntime.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: {
|
|
@@ -13,7 +13,7 @@ var HotKeyWrapper = require('../../hotkeys/HotKeyWrapper.js');
|
|
|
13
13
|
var icons = require('../../types/icons.js');
|
|
14
14
|
var jsxRuntime = require('react/jsx-runtime');
|
|
15
15
|
|
|
16
|
-
var _excluded = ["icon", "iconBg", "iconColor", "iconClassName", "rtlFlip", "title", "actions", "closeOnClick", "headerClassName", "onClose", "onBeforeClose", "children", "loading", "size", "width", "minWidth", "hideMask", "align"];
|
|
16
|
+
var _excluded = ["icon", "iconBg", "iconColor", "iconClassName", "rtlFlip", "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) {
|
|
@@ -33,6 +33,7 @@ var Flyout = function Flyout(_ref) {
|
|
|
33
33
|
size = _ref.size,
|
|
34
34
|
width = _ref.width,
|
|
35
35
|
minWidth = _ref.minWidth,
|
|
36
|
+
root = _ref.root,
|
|
36
37
|
hideMask = _ref.hideMask,
|
|
37
38
|
_ref$align = _ref.align,
|
|
38
39
|
align = _ref$align === void 0 ? "start" : _ref$align,
|
|
@@ -85,6 +86,7 @@ var Flyout = function Flyout(_ref) {
|
|
|
85
86
|
}
|
|
86
87
|
}, [closeOnClick, handleClose]);
|
|
87
88
|
return /*#__PURE__*/jsxRuntime.jsxs(react.FloatingPortal, {
|
|
89
|
+
root: root,
|
|
88
90
|
children: [!hideMask && /*#__PURE__*/jsxRuntime.jsx(react.FloatingOverlay, {
|
|
89
91
|
lockScroll: true,
|
|
90
92
|
style: {
|
|
@@ -13,7 +13,7 @@ var HotKeyWrapper = require('../../hotkeys/HotKeyWrapper.js');
|
|
|
13
13
|
var icons = require('../../types/icons.js');
|
|
14
14
|
var jsxRuntime = require('react/jsx-runtime');
|
|
15
15
|
|
|
16
|
-
var _excluded = ["icon", "iconBg", "iconColor", "iconClassName", "rtlFlip", "title", "actions", "headerClassName", "onClose", "onBeforeClose", "children", "loading", "root", "size", "
|
|
16
|
+
var _excluded = ["icon", "iconBg", "iconColor", "iconClassName", "rtlFlip", "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) {
|
|
@@ -31,7 +31,7 @@ var Modal = function Modal(_ref) {
|
|
|
31
31
|
loading = _ref.loading,
|
|
32
32
|
root = _ref.root,
|
|
33
33
|
size = _ref.size,
|
|
34
|
-
|
|
34
|
+
hideMask = _ref.hideMask,
|
|
35
35
|
width = _ref.width,
|
|
36
36
|
height = _ref.height,
|
|
37
37
|
minHeight = _ref.minHeight,
|
|
@@ -85,7 +85,7 @@ var Modal = function Modal(_ref) {
|
|
|
85
85
|
position: "absolute",
|
|
86
86
|
overflow: "hidden"
|
|
87
87
|
},
|
|
88
|
-
className: classNames("grid place-items-center p-16", !
|
|
88
|
+
className: classNames("grid place-items-center p-16", !hideMask && "bg-tint-100/20 backdrop-blur-sm"),
|
|
89
89
|
children: /*#__PURE__*/jsxRuntime.jsx(react.FloatingFocusManager, {
|
|
90
90
|
context: context,
|
|
91
91
|
children: /*#__PURE__*/jsxRuntime.jsx("dialog", _objectSpread(_objectSpread(_objectSpread({
|
|
@@ -10,7 +10,7 @@ import { useState, useMemo } from 'react';
|
|
|
10
10
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
11
11
|
import { getColor } from '../../utils/getColor.js';
|
|
12
12
|
|
|
13
|
-
var _excluded = ["ref", "name", "avatar", "fallbackIcon", "bg", "color", "size", "rounded", "variant", "className", "viewBox", "onClick"];
|
|
13
|
+
var _excluded = ["ref", "name", "avatar", "fallbackIcon", "bg", "color", "size", "rounded", "variant", "className", "viewBox", "preventDefault", "onClick"];
|
|
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 = {
|
|
@@ -64,7 +64,8 @@ var Avatar = function Avatar(_ref) {
|
|
|
64
64
|
className = _ref.className,
|
|
65
65
|
_ref$viewBox = _ref.viewBox,
|
|
66
66
|
viewBox = _ref$viewBox === void 0 ? "0 0 24 24" : _ref$viewBox,
|
|
67
|
-
|
|
67
|
+
preventDefault = _ref.preventDefault,
|
|
68
|
+
_onClick = _ref.onClick,
|
|
68
69
|
aria = _objectWithoutProperties(_ref, _excluded);
|
|
69
70
|
var _useState = useState(true),
|
|
70
71
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -159,9 +160,12 @@ var Avatar = function Avatar(_ref) {
|
|
|
159
160
|
return /*#__PURE__*/jsxs("dfn", _objectSpread(_objectSpread({
|
|
160
161
|
role: "presentation",
|
|
161
162
|
className: classNames("fabric-avatar", className, "select-none relative overflow-hidden inline-block box-content leading-none not-italic text-center", !rounded && "rounded", rounded && "rounded-full"),
|
|
162
|
-
onClick: onClick
|
|
163
|
+
onClick: function onClick(e) {
|
|
164
|
+
preventDefault && e.preventDefault();
|
|
165
|
+
_onClick === null || _onClick === void 0 || _onClick(e);
|
|
166
|
+
},
|
|
163
167
|
style: styles,
|
|
164
|
-
"data-clickable": !!
|
|
168
|
+
"data-clickable": !!_onClick,
|
|
165
169
|
ref: ref
|
|
166
170
|
}, aria), {}, {
|
|
167
171
|
children: [!fallback && avatarImage, fallback && fallbackAvatar]
|
|
@@ -16,7 +16,7 @@ import { AnimationIndicator } from '../animations/Animations.js';
|
|
|
16
16
|
import { getBadgeProps, Badge } from '../badge/Badge.js';
|
|
17
17
|
import { Icon } from '../icon/Icon.js';
|
|
18
18
|
|
|
19
|
-
var _excluded = ["as", "ref", "children", "className", "active", "color", "icon", "iconBg", "iconColor", "iconAlign", "altIcon", "rtlFlip", "rounded", "size", "disabled", "loading", "variant", "badge", "fullWidth", "spinOnHover", "onClick", "actionMessage", "stopPropagation", "type", "hotKey", "showActionDone", "showActionDoneEvent", "tabIndex", "data-ref"];
|
|
19
|
+
var _excluded = ["as", "ref", "children", "className", "active", "color", "icon", "iconBg", "iconColor", "iconAlign", "altIcon", "rtlFlip", "rounded", "size", "disabled", "loading", "variant", "badge", "fullWidth", "spinOnHover", "onClick", "actionMessage", "preventDefault", "stopPropagation", "type", "hotKey", "showActionDone", "showActionDoneEvent", "tabIndex", "data-ref"];
|
|
20
20
|
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; }
|
|
21
21
|
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; }
|
|
22
22
|
/**
|
|
@@ -68,6 +68,7 @@ var Button = function Button(_ref) {
|
|
|
68
68
|
spinOnHover = _ref.spinOnHover,
|
|
69
69
|
onClick = _ref.onClick,
|
|
70
70
|
actionMessage = _ref.actionMessage,
|
|
71
|
+
preventDefault = _ref.preventDefault,
|
|
71
72
|
stopPropagation = _ref.stopPropagation,
|
|
72
73
|
_ref$type = _ref.type,
|
|
73
74
|
type = _ref$type === void 0 ? "button" : _ref$type,
|
|
@@ -92,6 +93,7 @@ var Button = function Button(_ref) {
|
|
|
92
93
|
// Handle click events
|
|
93
94
|
var clickHandler = useCallback(function (e) {
|
|
94
95
|
setBusy(true);
|
|
96
|
+
preventDefault && e.preventDefault();
|
|
95
97
|
stopPropagation && e.stopPropagation();
|
|
96
98
|
var ret = onClick === null || onClick === void 0 ? void 0 : onClick(e);
|
|
97
99
|
void Promise.resolve(ret).then(function (b) {
|
|
@@ -100,7 +102,7 @@ var Button = function Button(_ref) {
|
|
|
100
102
|
setActionDone(true);
|
|
101
103
|
}
|
|
102
104
|
});
|
|
103
|
-
}, [onClick, disabled, actionMessage, showActionDoneEvent, stopPropagation]);
|
|
105
|
+
}, [onClick, disabled, preventDefault, actionMessage, showActionDoneEvent, stopPropagation]);
|
|
104
106
|
|
|
105
107
|
/** ***************** reset done state on timeout *******************/
|
|
106
108
|
useEffect(function () {
|
|
@@ -11,7 +11,7 @@ import { jsx, jsxs } from 'react/jsx-runtime';
|
|
|
11
11
|
import '@react-fabric/utilities';
|
|
12
12
|
import { nodeCheck } from '../../utils/nodeCheck.js';
|
|
13
13
|
|
|
14
|
-
var _excluded = ["children", "className", "bodyClassName", "selected", "selectedRibbon", "onClick", "onDragStart", "flex", "draggable", "dragKey", "dragData", "ref"];
|
|
14
|
+
var _excluded = ["children", "className", "bodyClassName", "selected", "selectedRibbon", "onClick", "onDragStart", "flex", "draggable", "dragKey", "dragData", "ref", "as"];
|
|
15
15
|
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; }
|
|
16
16
|
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; }
|
|
17
17
|
/**
|
|
@@ -61,6 +61,7 @@ var Card = function Card(_ref) {
|
|
|
61
61
|
dragKey = _ref.dragKey,
|
|
62
62
|
dragData = _ref.dragData,
|
|
63
63
|
ref = _ref.ref,
|
|
64
|
+
as = _ref.as,
|
|
64
65
|
aria = _objectWithoutProperties(_ref, _excluded);
|
|
65
66
|
var _useMemo = useMemo(function () {
|
|
66
67
|
return Children.toArray(children).reduce(function (ret, node) {
|
|
@@ -77,22 +78,27 @@ var Card = function Card(_ref) {
|
|
|
77
78
|
dragKey && ((_event$dataTransfer = event.dataTransfer) === null || _event$dataTransfer === void 0 ? void 0 : _event$dataTransfer.setData(dragKey, JSON.stringify(dragData)));
|
|
78
79
|
dragKey && (onDragStart === null || onDragStart === void 0 ? void 0 : onDragStart(event, dragKey, dragData));
|
|
79
80
|
}, [onDragStart, dragKey, dragData]);
|
|
81
|
+
var E = as !== null && as !== void 0 ? as : "div";
|
|
80
82
|
return /*#__PURE__*/jsx("div", {
|
|
81
|
-
className: classNames("fabric-cardWrapper", "rounded-capped relative grid", flex && "flex-1", selected && selectedRibbon && "selected", selected && "outline-
|
|
83
|
+
className: classNames("fabric-cardWrapper", "rounded-capped relative grid", flex && "flex-1", selected && selectedRibbon && "selected", selected && "outline-1 outline-accent-500 outline-offset-2"),
|
|
82
84
|
children: /*#__PURE__*/jsx(ErrorBoundary, {
|
|
83
|
-
children: /*#__PURE__*/jsxs("div",
|
|
84
|
-
className: classNames("fabric-card", className, "rounded-capped flex flex-col flex-nowrap overflow-hidden", onClick && "clickable"),
|
|
85
|
+
children: /*#__PURE__*/jsxs("div", {
|
|
86
|
+
className: classNames("fabric-card", className, "rounded-capped relative flex flex-col flex-nowrap overflow-hidden", "href" in aria && "clickable", "to" in aria && "clickable", onClick && "clickable"),
|
|
85
87
|
draggable: draggable,
|
|
86
88
|
onDragStart: !draggable ? undefined : handleDragStart,
|
|
87
|
-
ref: ref
|
|
88
|
-
|
|
89
|
-
children: [header, /*#__PURE__*/jsx("div", {
|
|
89
|
+
ref: ref,
|
|
90
|
+
children: [header, /*#__PURE__*/jsx(E, _objectSpread(_objectSpread({
|
|
90
91
|
role: "none",
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
92
|
+
onClick: onClick
|
|
93
|
+
}, aria), {}, {
|
|
94
|
+
className: "contents",
|
|
95
|
+
children: body && /*#__PURE__*/jsx("object", {
|
|
96
|
+
type: "none",
|
|
97
|
+
className: classNames("fabric-cardBody", bodyClassName, "flex-1"),
|
|
98
|
+
children: body
|
|
99
|
+
})
|
|
100
|
+
})), footer]
|
|
101
|
+
})
|
|
96
102
|
})
|
|
97
103
|
});
|
|
98
104
|
};
|
|
@@ -10,7 +10,7 @@ import { getColor } from '../../utils/getColor.js';
|
|
|
10
10
|
import '@react-fabric/utilities';
|
|
11
11
|
import { Icon } from '../icon/Icon.js';
|
|
12
12
|
|
|
13
|
-
var _excluded = ["ref", "children", "className", "size", "color", "variant", "icon", "iconBg", "iconColor", "rtlFlip", "disabled", "onClick", "onIconClick", "onRemove", "rounded", "stopPropagation", "as"];
|
|
13
|
+
var _excluded = ["ref", "children", "className", "size", "color", "variant", "icon", "iconBg", "iconColor", "rtlFlip", "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 = {
|
|
@@ -57,6 +57,7 @@ var Chip = function Chip(_ref) {
|
|
|
57
57
|
onIconClick = _ref.onIconClick,
|
|
58
58
|
onRemove = _ref.onRemove,
|
|
59
59
|
rounded = _ref.rounded,
|
|
60
|
+
preventDefault = _ref.preventDefault,
|
|
60
61
|
stopPropagation = _ref.stopPropagation,
|
|
61
62
|
as = _ref.as,
|
|
62
63
|
aria = _objectWithoutProperties(_ref, _excluded);
|
|
@@ -75,9 +76,10 @@ var Chip = function Chip(_ref) {
|
|
|
75
76
|
return s;
|
|
76
77
|
}, [color, size], "Chip styles");
|
|
77
78
|
var clickHandler = useCallback(function (e) {
|
|
78
|
-
|
|
79
|
+
preventDefault && e.preventDefault();
|
|
80
|
+
stopPropagation && e.stopPropagation();
|
|
79
81
|
onClick === null || onClick === void 0 || onClick(e);
|
|
80
|
-
}, [onClick, stopPropagation]);
|
|
82
|
+
}, [onClick, preventDefault, stopPropagation]);
|
|
81
83
|
var removeHandler = useCallback(function (e) {
|
|
82
84
|
if (stopPropagation) e.stopPropagation();
|
|
83
85
|
onRemove === null || onRemove === void 0 || onRemove(e);
|
|
@@ -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",
|
|
@@ -63,7 +63,7 @@ var Icon = function Icon(_ref) {
|
|
|
63
63
|
_ref$viewBox = _ref.viewBox,
|
|
64
64
|
viewBox = _ref$viewBox === void 0 ? "0 0 24 24" : _ref$viewBox,
|
|
65
65
|
className = _ref.className,
|
|
66
|
-
|
|
66
|
+
_onClick = _ref.onClick,
|
|
67
67
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
68
68
|
/** ***************** style map *******************/
|
|
69
69
|
var styles = useMemo(function () {
|
|
@@ -121,12 +121,16 @@ var Icon = function Icon(_ref) {
|
|
|
121
121
|
ref: ref
|
|
122
122
|
}, rest), {}, {
|
|
123
123
|
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
|
|
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), !!_onClick && disabled && "opacity-30 pointer-events-none", className),
|
|
125
|
+
onClick: function onClick(e) {
|
|
126
|
+
_onClick && e.stopPropagation();
|
|
127
|
+
_onClick && e.preventDefault();
|
|
128
|
+
_onClick === null || _onClick === void 0 || _onClick(e);
|
|
129
|
+
},
|
|
126
130
|
"data-flip": rtlFlip,
|
|
127
131
|
style: styles,
|
|
128
|
-
"data-clickable": !!
|
|
129
|
-
"data-inner-clickable": !!
|
|
132
|
+
"data-clickable": !!_onClick,
|
|
133
|
+
"data-inner-clickable": !!_onClick,
|
|
130
134
|
children: iconEl
|
|
131
135
|
}));
|
|
132
136
|
};
|
|
@@ -92,7 +92,7 @@ var Tab = function Tab(_ref) {
|
|
|
92
92
|
disabled: disabled,
|
|
93
93
|
"data-color": color,
|
|
94
94
|
"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" : "
|
|
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" : "rounded-capped", "flex items-center justify-center overflow-hidden cursor-pointer"),
|
|
96
96
|
onClick: function onClick() {
|
|
97
97
|
return !active && (_onClick === null || _onClick === void 0 ? void 0 : _onClick(id));
|
|
98
98
|
},
|
|
@@ -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: {
|
|
@@ -13,7 +13,7 @@ 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", "iconBg", "iconColor", "iconClassName", "rtlFlip", "title", "actions", "closeOnClick", "headerClassName", "onClose", "onBeforeClose", "children", "loading", "size", "width", "minWidth", "hideMask", "align"];
|
|
16
|
+
var _excluded = ["icon", "iconBg", "iconColor", "iconClassName", "rtlFlip", "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) {
|
|
@@ -33,6 +33,7 @@ var Flyout = function Flyout(_ref) {
|
|
|
33
33
|
size = _ref.size,
|
|
34
34
|
width = _ref.width,
|
|
35
35
|
minWidth = _ref.minWidth,
|
|
36
|
+
root = _ref.root,
|
|
36
37
|
hideMask = _ref.hideMask,
|
|
37
38
|
_ref$align = _ref.align,
|
|
38
39
|
align = _ref$align === void 0 ? "start" : _ref$align,
|
|
@@ -85,6 +86,7 @@ var Flyout = function Flyout(_ref) {
|
|
|
85
86
|
}
|
|
86
87
|
}, [closeOnClick, handleClose]);
|
|
87
88
|
return /*#__PURE__*/jsxs(FloatingPortal, {
|
|
89
|
+
root: root,
|
|
88
90
|
children: [!hideMask && /*#__PURE__*/jsx(FloatingOverlay, {
|
|
89
91
|
lockScroll: true,
|
|
90
92
|
style: {
|
|
@@ -13,7 +13,7 @@ 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", "iconBg", "iconColor", "iconClassName", "rtlFlip", "title", "actions", "headerClassName", "onClose", "onBeforeClose", "children", "loading", "root", "size", "
|
|
16
|
+
var _excluded = ["icon", "iconBg", "iconColor", "iconClassName", "rtlFlip", "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) {
|
|
@@ -31,7 +31,7 @@ var Modal = function Modal(_ref) {
|
|
|
31
31
|
loading = _ref.loading,
|
|
32
32
|
root = _ref.root,
|
|
33
33
|
size = _ref.size,
|
|
34
|
-
|
|
34
|
+
hideMask = _ref.hideMask,
|
|
35
35
|
width = _ref.width,
|
|
36
36
|
height = _ref.height,
|
|
37
37
|
minHeight = _ref.minHeight,
|
|
@@ -85,7 +85,7 @@ var Modal = function Modal(_ref) {
|
|
|
85
85
|
position: "absolute",
|
|
86
86
|
overflow: "hidden"
|
|
87
87
|
},
|
|
88
|
-
className: classNames("grid place-items-center p-16", !
|
|
88
|
+
className: classNames("grid place-items-center p-16", !hideMask && "bg-tint-100/20 backdrop-blur-sm"),
|
|
89
89
|
children: /*#__PURE__*/jsx(FloatingFocusManager, {
|
|
90
90
|
context: context,
|
|
91
91
|
children: /*#__PURE__*/jsx("dialog", _objectSpread(_objectSpread(_objectSpread({
|
|
@@ -36,6 +36,10 @@ export interface AvatarProps extends CssProp, AriaProps, TestProps, RefProp {
|
|
|
36
36
|
* rounded icon
|
|
37
37
|
*/
|
|
38
38
|
rounded?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* prevent click default, useful when component is within a `a` link
|
|
41
|
+
*/
|
|
42
|
+
preventDefault?: boolean;
|
|
39
43
|
/**
|
|
40
44
|
* click handler
|
|
41
45
|
*/
|
|
@@ -69,4 +73,4 @@ export interface AvatarProps extends CssProp, AriaProps, TestProps, RefProp {
|
|
|
69
73
|
* @see {@link https://adarshpastakia.github.io/react-fabric/?path=/story/core-components-avatar--docs} for more details.
|
|
70
74
|
* @see {@link https://boringavatars.com/} for more information on Boring Avatars.
|
|
71
75
|
*/
|
|
72
|
-
export declare const Avatar: ({ ref, name, avatar, fallbackIcon, bg, color, size, rounded, variant, className, viewBox, onClick, ...aria }: AvatarProps) => import("react/jsx-runtime").JSX.Element;
|
|
76
|
+
export declare const Avatar: ({ ref, name, avatar, fallbackIcon, bg, color, size, rounded, variant, className, viewBox, preventDefault, onClick, ...aria }: AvatarProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -74,6 +74,10 @@ export interface BaseProps extends CssProp, AriaProps, IconProps, RefProp, TestP
|
|
|
74
74
|
* keyboard shortcut
|
|
75
75
|
*/
|
|
76
76
|
hotKey?: string;
|
|
77
|
+
/**
|
|
78
|
+
* prevent click default, useful when button is within a `a` link
|
|
79
|
+
*/
|
|
80
|
+
preventDefault?: boolean;
|
|
77
81
|
stopPropagation?: boolean;
|
|
78
82
|
onMouseOut?: MouseEventHandler;
|
|
79
83
|
onMouseOver?: MouseEventHandler;
|
|
@@ -114,5 +118,5 @@ export type ButtonProps<Tag extends React.ElementType = "button"> = BaseProps &
|
|
|
114
118
|
*
|
|
115
119
|
* @see {@link https://adarshpastakia.github.io/react-fabric/?path=/docs/core-components-button--docs} for more details.
|
|
116
120
|
*/
|
|
117
|
-
export declare const Button: <Tag extends React.ElementType = "button">({ as, ref, children, className, active, color, icon, iconBg, iconColor, iconAlign, altIcon, rtlFlip, rounded, size, disabled, loading, variant, badge, fullWidth, spinOnHover, onClick, actionMessage, stopPropagation, type, hotKey, showActionDone, showActionDoneEvent, tabIndex, "data-ref": dataRef, ...aria }: ButtonProps<Tag>) => import("react/jsx-runtime").JSX.Element;
|
|
121
|
+
export declare const Button: <Tag extends React.ElementType = "button">({ as, ref, children, className, active, color, icon, iconBg, iconColor, iconAlign, altIcon, rtlFlip, rounded, size, disabled, loading, variant, badge, fullWidth, spinOnHover, onClick, actionMessage, preventDefault, stopPropagation, type, hotKey, showActionDone, showActionDoneEvent, tabIndex, "data-ref": dataRef, ...aria }: ButtonProps<Tag>) => import("react/jsx-runtime").JSX.Element;
|
|
118
122
|
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type DragEvent, type MouseEventHandler } from "react";
|
|
2
2
|
import { type ContentProps } from "../../core/content/Content";
|
|
3
3
|
import { type HeadFootProps } from "../../core/headfoot/HeadFoot";
|
|
4
|
-
import { type AriaProps, type ChildrenProp, type CssProp, type RefProp, type TestProps } from "../../types";
|
|
5
|
-
|
|
4
|
+
import { PolymorphicProps, type AriaProps, type ChildrenProp, type CssProp, type RefProp, type TestProps } from "../../types";
|
|
5
|
+
interface BaseProps extends CssProp, AriaProps, TestProps, RefProp<HTMLDivElement>, ChildrenProp<React.ReactElement<HeadFootProps | ContentProps>> {
|
|
6
6
|
/**
|
|
7
7
|
* apply flex fill styling
|
|
8
8
|
*/
|
|
@@ -40,6 +40,7 @@ export interface CardProps extends CssProp, AriaProps, TestProps, RefProp<HTMLDi
|
|
|
40
40
|
*/
|
|
41
41
|
dragData?: KeyValue;
|
|
42
42
|
}
|
|
43
|
+
export type CardProps<Tag extends React.ElementType = "div"> = BaseProps & PolymorphicProps<Tag>;
|
|
43
44
|
/**
|
|
44
45
|
* A component that displays a card with a header, body, and footer. It can be used to display content in a structured format.
|
|
45
46
|
* It supports various features such as click handling, drag-and-drop functionality, and customizable styles.
|
|
@@ -74,4 +75,5 @@ export interface CardProps extends CssProp, AriaProps, TestProps, RefProp<HTMLDi
|
|
|
74
75
|
*
|
|
75
76
|
* @see {@link https://adarshpastakia.github.io/react-fabric/?path=/docs/core-components-card--docs} for more details.
|
|
76
77
|
*/
|
|
77
|
-
export declare const Card: ({ children, className, bodyClassName, selected, selectedRibbon, onClick, onDragStart, flex, draggable, dragKey, dragData, ref, ...aria }: CardProps) => import("react/jsx-runtime").JSX.Element;
|
|
78
|
+
export declare const Card: <Tag extends React.ElementType = "div">({ children, className, bodyClassName, selected, selectedRibbon, onClick, onDragStart, flex, draggable, dragKey, dragData, ref, as, ...aria }: CardProps<Tag>) => import("react/jsx-runtime").JSX.Element;
|
|
79
|
+
export {};
|
|
@@ -21,6 +21,10 @@ export interface ChipProps extends CssProp, AriaProps, IconProps, TestProps, Chi
|
|
|
21
21
|
* disabled state
|
|
22
22
|
*/
|
|
23
23
|
disabled?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* prevent click default, useful when component is within a `a` link
|
|
26
|
+
*/
|
|
27
|
+
preventDefault?: boolean;
|
|
24
28
|
/**
|
|
25
29
|
* prevent click propagation
|
|
26
30
|
*/
|
|
@@ -58,4 +62,4 @@ export interface ChipProps extends CssProp, AriaProps, IconProps, TestProps, Chi
|
|
|
58
62
|
*
|
|
59
63
|
* @see {@link https://adarshpastakia.github.io/react-fabric/?path=/docs/core-components-chip--docs} for more details.
|
|
60
64
|
*/
|
|
61
|
-
export declare const Chip: <Tag extends React.ElementType = "div">({ ref, children, className, size, color, variant, icon, iconBg, iconColor, rtlFlip, disabled, onClick, onIconClick, onRemove, rounded, stopPropagation, as, ...aria }: ChipProps & PolymorphicProps<Tag>) => import("react/jsx-runtime").JSX.Element;
|
|
65
|
+
export declare const Chip: <Tag extends React.ElementType = "div">({ ref, children, className, size, color, variant, icon, iconBg, iconColor, rtlFlip, disabled, onClick, onIconClick, onRemove, rounded, preventDefault, stopPropagation, as, ...aria }: ChipProps & PolymorphicProps<Tag>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -18,6 +18,10 @@ export interface TabPanelProps extends ChildrenProp<typeof Tab> {
|
|
|
18
18
|
* tab button flex to fill tabs
|
|
19
19
|
*/
|
|
20
20
|
tabFlex?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* rotate tab sideways for start/end orientation
|
|
23
|
+
*/
|
|
24
|
+
tabRotate?: boolean;
|
|
21
25
|
/**
|
|
22
26
|
* tab button gap
|
|
23
27
|
*/
|
|
@@ -84,4 +88,4 @@ export interface TabPanelProps extends ChildrenProp<typeof Tab> {
|
|
|
84
88
|
*
|
|
85
89
|
* @see {@link https://adarshpastakia.github.io/react-fabric/?path=/docs/core-components-tabpanel--docs} for more details.
|
|
86
90
|
*/
|
|
87
|
-
export declare const TabPanel: ({ children, headerClassName, orientation, activeTab, activeClassName, justify, variant, tabFlex, append, prepend, gap, onBeforeChange, onChange, }: TabPanelProps) => import("react/jsx-runtime").JSX.Element;
|
|
91
|
+
export declare const TabPanel: ({ children, headerClassName, orientation, activeTab, activeClassName, justify, variant, tabFlex, append, prepend, tabRotate, gap, onBeforeChange, onChange, }: TabPanelProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -38,6 +38,10 @@ export interface FlyoutProps extends AriaProps, TestProps, Omit<IconProps, "icon
|
|
|
38
38
|
* minimum width
|
|
39
39
|
*/
|
|
40
40
|
minWidth?: string | number;
|
|
41
|
+
/**
|
|
42
|
+
* portal root element
|
|
43
|
+
*/
|
|
44
|
+
root?: HTMLElement;
|
|
41
45
|
/**
|
|
42
46
|
* hide backdrop mask
|
|
43
47
|
*/
|
|
@@ -55,4 +59,4 @@ export interface FlyoutProps extends AriaProps, TestProps, Omit<IconProps, "icon
|
|
|
55
59
|
*/
|
|
56
60
|
onBeforeClose?: (...args: AnyObject) => CallbackReturn;
|
|
57
61
|
}
|
|
58
|
-
export declare const Flyout: ({ icon, iconBg, iconColor, iconClassName, rtlFlip, title, actions, closeOnClick, headerClassName, onClose, onBeforeClose, children, loading, size, width, minWidth, hideMask, align, ...aria }: FlyoutProps) => import("react/jsx-runtime").JSX.Element;
|
|
62
|
+
export declare const Flyout: ({ icon, iconBg, iconColor, iconClassName, rtlFlip, title, actions, closeOnClick, headerClassName, onClose, onBeforeClose, children, loading, size, width, minWidth, root, hideMask, align, ...aria }: FlyoutProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -49,7 +49,7 @@ export interface ModalProps extends AriaProps, TestProps, Omit<IconProps, "icon"
|
|
|
49
49
|
/**
|
|
50
50
|
* hide mask background
|
|
51
51
|
*/
|
|
52
|
-
|
|
52
|
+
hideMask?: boolean;
|
|
53
53
|
/**
|
|
54
54
|
* close handler
|
|
55
55
|
*/
|
|
@@ -59,4 +59,4 @@ export interface ModalProps extends AriaProps, TestProps, Omit<IconProps, "icon"
|
|
|
59
59
|
*/
|
|
60
60
|
onBeforeClose?: (...args: AnyObject) => CallbackReturn;
|
|
61
61
|
}
|
|
62
|
-
export declare const Modal: ({ icon, iconBg, iconColor, iconClassName, rtlFlip, title, actions, headerClassName, onClose, onBeforeClose, children, loading, root, size,
|
|
62
|
+
export declare const Modal: ({ icon, iconBg, iconColor, iconClassName, rtlFlip, title, actions, headerClassName, onClose, onBeforeClose, children, loading, root, size, hideMask, width, height, minHeight, minWidth, ...aria }: ModalProps) => import("react/jsx-runtime").JSX.Element;
|
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.57",
|
|
4
4
|
"description": "RUF: Core package",
|
|
5
5
|
"author": "Adarsh Pastakia <adarshpastakia@outlook.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -54,5 +54,5 @@
|
|
|
54
54
|
"node": ">=18.12.0",
|
|
55
55
|
"npm": ">=8.19.0"
|
|
56
56
|
},
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "9b596a0a8d6cecaa8479f80c495b64fb42ce739f"
|
|
58
58
|
}
|
|
@@ -73,6 +73,10 @@ export interface AvatarProps extends CssProp, AriaProps, TestProps, RefProp {
|
|
|
73
73
|
* rounded icon
|
|
74
74
|
*/
|
|
75
75
|
rounded?: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* prevent click default, useful when component is within a `a` link
|
|
78
|
+
*/
|
|
79
|
+
preventDefault?: boolean;
|
|
76
80
|
/**
|
|
77
81
|
* click handler
|
|
78
82
|
*/
|
|
@@ -127,6 +131,7 @@ export const Avatar = ({
|
|
|
127
131
|
variant = "beam",
|
|
128
132
|
className,
|
|
129
133
|
viewBox = "0 0 24 24",
|
|
134
|
+
preventDefault,
|
|
130
135
|
onClick,
|
|
131
136
|
...aria
|
|
132
137
|
}: AvatarProps) => {
|
|
@@ -220,7 +225,10 @@ export const Avatar = ({
|
|
|
220
225
|
!rounded && "rounded",
|
|
221
226
|
rounded && "rounded-full",
|
|
222
227
|
)}
|
|
223
|
-
onClick={
|
|
228
|
+
onClick={(e) => {
|
|
229
|
+
preventDefault && e.preventDefault();
|
|
230
|
+
onClick?.(e);
|
|
231
|
+
}}
|
|
224
232
|
style={styles}
|
|
225
233
|
data-clickable={!!onClick}
|
|
226
234
|
ref={ref}
|
|
@@ -136,6 +136,10 @@ export interface BaseProps
|
|
|
136
136
|
*/
|
|
137
137
|
hotKey?: string;
|
|
138
138
|
|
|
139
|
+
/**
|
|
140
|
+
* prevent click default, useful when button is within a `a` link
|
|
141
|
+
*/
|
|
142
|
+
preventDefault?: boolean;
|
|
139
143
|
stopPropagation?: boolean;
|
|
140
144
|
|
|
141
145
|
onMouseOut?: MouseEventHandler;
|
|
@@ -202,6 +206,7 @@ export const Button = <Tag extends React.ElementType = "button">({
|
|
|
202
206
|
spinOnHover,
|
|
203
207
|
onClick,
|
|
204
208
|
actionMessage,
|
|
209
|
+
preventDefault,
|
|
205
210
|
stopPropagation,
|
|
206
211
|
type = "button",
|
|
207
212
|
hotKey,
|
|
@@ -220,6 +225,7 @@ export const Button = <Tag extends React.ElementType = "button">({
|
|
|
220
225
|
const clickHandler = useCallback(
|
|
221
226
|
(e: React.MouseEvent) => {
|
|
222
227
|
setBusy(true);
|
|
228
|
+
preventDefault && e.preventDefault();
|
|
223
229
|
stopPropagation && e.stopPropagation();
|
|
224
230
|
const ret = onClick?.(e);
|
|
225
231
|
void Promise.resolve(ret).then((b) => {
|
|
@@ -229,7 +235,14 @@ export const Button = <Tag extends React.ElementType = "button">({
|
|
|
229
235
|
}
|
|
230
236
|
});
|
|
231
237
|
},
|
|
232
|
-
[
|
|
238
|
+
[
|
|
239
|
+
onClick,
|
|
240
|
+
disabled,
|
|
241
|
+
preventDefault,
|
|
242
|
+
actionMessage,
|
|
243
|
+
showActionDoneEvent,
|
|
244
|
+
stopPropagation,
|
|
245
|
+
],
|
|
233
246
|
);
|
|
234
247
|
|
|
235
248
|
/** ***************** reset done state on timeout *******************/
|
|
@@ -24,10 +24,10 @@
|
|
|
24
24
|
import classNames from "classnames";
|
|
25
25
|
import {
|
|
26
26
|
Children,
|
|
27
|
-
type DragEvent,
|
|
28
|
-
type MouseEventHandler,
|
|
29
27
|
useCallback,
|
|
30
28
|
useMemo,
|
|
29
|
+
type DragEvent,
|
|
30
|
+
type MouseEventHandler,
|
|
31
31
|
} from "react";
|
|
32
32
|
import { ErrorBoundary } from "../../core/boundary/ErrorBoundary";
|
|
33
33
|
import { type ContentProps } from "../../core/content/Content";
|
|
@@ -37,6 +37,7 @@ import {
|
|
|
37
37
|
type HeadFootProps,
|
|
38
38
|
} from "../../core/headfoot/HeadFoot";
|
|
39
39
|
import {
|
|
40
|
+
PolymorphicProps,
|
|
40
41
|
type AriaProps,
|
|
41
42
|
type ChildrenProp,
|
|
42
43
|
type CssProp,
|
|
@@ -45,7 +46,7 @@ import {
|
|
|
45
46
|
} from "../../types";
|
|
46
47
|
import { nodeCheck } from "../../utils";
|
|
47
48
|
|
|
48
|
-
|
|
49
|
+
interface BaseProps
|
|
49
50
|
extends CssProp,
|
|
50
51
|
AriaProps,
|
|
51
52
|
TestProps,
|
|
@@ -93,6 +94,9 @@ export interface CardProps
|
|
|
93
94
|
dragData?: KeyValue;
|
|
94
95
|
}
|
|
95
96
|
|
|
97
|
+
export type CardProps<Tag extends React.ElementType = "div"> = BaseProps &
|
|
98
|
+
PolymorphicProps<Tag>;
|
|
99
|
+
|
|
96
100
|
/**
|
|
97
101
|
* A component that displays a card with a header, body, and footer. It can be used to display content in a structured format.
|
|
98
102
|
* It supports various features such as click handling, drag-and-drop functionality, and customizable styles.
|
|
@@ -127,7 +131,7 @@ export interface CardProps
|
|
|
127
131
|
*
|
|
128
132
|
* @see {@link https://adarshpastakia.github.io/react-fabric/?path=/docs/core-components-card--docs} for more details.
|
|
129
133
|
*/
|
|
130
|
-
export const Card = ({
|
|
134
|
+
export const Card = <Tag extends React.ElementType = "div">({
|
|
131
135
|
children,
|
|
132
136
|
className,
|
|
133
137
|
bodyClassName,
|
|
@@ -140,8 +144,9 @@ export const Card = ({
|
|
|
140
144
|
dragKey,
|
|
141
145
|
dragData,
|
|
142
146
|
ref,
|
|
147
|
+
as,
|
|
143
148
|
...aria
|
|
144
|
-
}: CardProps) => {
|
|
149
|
+
}: CardProps<Tag>) => {
|
|
145
150
|
const [header, body, footer] = useMemo(() => {
|
|
146
151
|
return Children.toArray(children as AnyObject).reduce<AnyObject[]>(
|
|
147
152
|
(ret, node) => {
|
|
@@ -164,6 +169,7 @@ export const Card = ({
|
|
|
164
169
|
[onDragStart, dragKey, dragData],
|
|
165
170
|
);
|
|
166
171
|
|
|
172
|
+
const E = as ?? "div";
|
|
167
173
|
return (
|
|
168
174
|
<div
|
|
169
175
|
className={classNames(
|
|
@@ -171,7 +177,7 @@ export const Card = ({
|
|
|
171
177
|
"rounded-capped relative grid",
|
|
172
178
|
flex && "flex-1",
|
|
173
179
|
selected && selectedRibbon && "selected",
|
|
174
|
-
selected && "outline-
|
|
180
|
+
selected && "outline-1 outline-accent-500 outline-offset-2",
|
|
175
181
|
)}
|
|
176
182
|
>
|
|
177
183
|
<ErrorBoundary>
|
|
@@ -179,22 +185,30 @@ export const Card = ({
|
|
|
179
185
|
className={classNames(
|
|
180
186
|
"fabric-card",
|
|
181
187
|
className,
|
|
182
|
-
"rounded-capped flex flex-col flex-nowrap overflow-hidden",
|
|
188
|
+
"rounded-capped relative flex flex-col flex-nowrap overflow-hidden",
|
|
189
|
+
"href" in aria && "clickable",
|
|
190
|
+
"to" in aria && "clickable",
|
|
183
191
|
onClick && "clickable",
|
|
184
192
|
)}
|
|
185
193
|
draggable={draggable}
|
|
186
194
|
onDragStart={!draggable ? undefined : handleDragStart}
|
|
187
195
|
ref={ref}
|
|
188
|
-
{...aria}
|
|
189
196
|
>
|
|
190
197
|
{header}
|
|
191
|
-
<
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
+
<E role="none" onClick={onClick} {...aria} className="contents">
|
|
199
|
+
{body && (
|
|
200
|
+
<object
|
|
201
|
+
type="none"
|
|
202
|
+
className={classNames(
|
|
203
|
+
"fabric-cardBody",
|
|
204
|
+
bodyClassName,
|
|
205
|
+
"flex-1",
|
|
206
|
+
)}
|
|
207
|
+
>
|
|
208
|
+
{body}
|
|
209
|
+
</object>
|
|
210
|
+
)}
|
|
211
|
+
</E>
|
|
198
212
|
{footer}
|
|
199
213
|
</div>
|
|
200
214
|
</ErrorBoundary>
|
|
@@ -66,6 +66,10 @@ export interface ChipProps
|
|
|
66
66
|
* disabled state
|
|
67
67
|
*/
|
|
68
68
|
disabled?: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* prevent click default, useful when component is within a `a` link
|
|
71
|
+
*/
|
|
72
|
+
preventDefault?: boolean;
|
|
69
73
|
/**
|
|
70
74
|
* prevent click propagation
|
|
71
75
|
*/
|
|
@@ -128,6 +132,7 @@ export const Chip = <Tag extends React.ElementType = "div">({
|
|
|
128
132
|
onIconClick,
|
|
129
133
|
onRemove,
|
|
130
134
|
rounded,
|
|
135
|
+
preventDefault,
|
|
131
136
|
stopPropagation,
|
|
132
137
|
as,
|
|
133
138
|
...aria
|
|
@@ -153,10 +158,11 @@ export const Chip = <Tag extends React.ElementType = "div">({
|
|
|
153
158
|
|
|
154
159
|
const clickHandler = useCallback(
|
|
155
160
|
(e: React.MouseEvent) => {
|
|
156
|
-
|
|
161
|
+
preventDefault && e.preventDefault();
|
|
162
|
+
stopPropagation && e.stopPropagation();
|
|
157
163
|
onClick?.(e);
|
|
158
164
|
},
|
|
159
|
-
[onClick, stopPropagation],
|
|
165
|
+
[onClick, preventDefault, stopPropagation],
|
|
160
166
|
);
|
|
161
167
|
|
|
162
168
|
const removeHandler = useCallback(
|
|
@@ -193,7 +193,11 @@ export const Icon = ({
|
|
|
193
193
|
!!onClick && disabled && "opacity-30 pointer-events-none",
|
|
194
194
|
className,
|
|
195
195
|
)}
|
|
196
|
-
onClick={
|
|
196
|
+
onClick={(e) => {
|
|
197
|
+
onClick && e.stopPropagation();
|
|
198
|
+
onClick && e.preventDefault();
|
|
199
|
+
onClick?.(e);
|
|
200
|
+
}}
|
|
197
201
|
data-flip={rtlFlip}
|
|
198
202
|
style={styles}
|
|
199
203
|
data-clickable={!!onClick}
|
|
@@ -174,8 +174,8 @@ export const Tab = <Tag extends React.ElementType = "button">({
|
|
|
174
174
|
active && activeClassName,
|
|
175
175
|
disabled && "text-tint-500 pointer-events-none",
|
|
176
176
|
tabFlex ? "flex-1" : "flex-initial max-w-36",
|
|
177
|
-
minimal ? "min-w-6 rounded" : "
|
|
178
|
-
"flex items-center justify-center
|
|
177
|
+
minimal ? "min-w-6 rounded" : "rounded-capped",
|
|
178
|
+
"flex items-center justify-center overflow-hidden cursor-pointer",
|
|
179
179
|
)}
|
|
180
180
|
onClick={() => !active && onClick?.(id)}
|
|
181
181
|
ref={ref as AnyObject}
|
|
@@ -52,6 +52,10 @@ export interface TabPanelProps extends ChildrenProp<typeof Tab> {
|
|
|
52
52
|
* tab button flex to fill tabs
|
|
53
53
|
*/
|
|
54
54
|
tabFlex?: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* rotate tab sideways for start/end orientation
|
|
57
|
+
*/
|
|
58
|
+
tabRotate?: boolean;
|
|
55
59
|
/**
|
|
56
60
|
* tab button gap
|
|
57
61
|
*/
|
|
@@ -132,6 +136,7 @@ export const TabPanel = ({
|
|
|
132
136
|
tabFlex,
|
|
133
137
|
append,
|
|
134
138
|
prepend,
|
|
139
|
+
tabRotate,
|
|
135
140
|
gap,
|
|
136
141
|
onBeforeChange,
|
|
137
142
|
onChange,
|
|
@@ -182,6 +187,7 @@ export const TabPanel = ({
|
|
|
182
187
|
className={classNames(
|
|
183
188
|
"fabric-tabHeader",
|
|
184
189
|
headerClassName,
|
|
190
|
+
tabRotate && "tab-rotate",
|
|
185
191
|
justify && `justify-${justify}`,
|
|
186
192
|
["start", "end"].includes(orientation) && "flex-col",
|
|
187
193
|
"flex flex-nowrap overflow-hidden items-center",
|
|
@@ -94,6 +94,10 @@ export interface FlyoutProps
|
|
|
94
94
|
* minimum width
|
|
95
95
|
*/
|
|
96
96
|
minWidth?: string | number;
|
|
97
|
+
/**
|
|
98
|
+
* portal root element
|
|
99
|
+
*/
|
|
100
|
+
root?: HTMLElement;
|
|
97
101
|
/**
|
|
98
102
|
* hide backdrop mask
|
|
99
103
|
*/
|
|
@@ -129,6 +133,7 @@ export const Flyout = ({
|
|
|
129
133
|
size,
|
|
130
134
|
width,
|
|
131
135
|
minWidth,
|
|
136
|
+
root,
|
|
132
137
|
hideMask,
|
|
133
138
|
align = "start",
|
|
134
139
|
...aria
|
|
@@ -193,7 +198,7 @@ export const Flyout = ({
|
|
|
193
198
|
);
|
|
194
199
|
|
|
195
200
|
return (
|
|
196
|
-
<FloatingPortal>
|
|
201
|
+
<FloatingPortal root={root}>
|
|
197
202
|
{!hideMask && (
|
|
198
203
|
<FloatingOverlay
|
|
199
204
|
lockScroll
|
|
@@ -105,7 +105,7 @@ export interface ModalProps
|
|
|
105
105
|
/**
|
|
106
106
|
* hide mask background
|
|
107
107
|
*/
|
|
108
|
-
|
|
108
|
+
hideMask?: boolean;
|
|
109
109
|
/**
|
|
110
110
|
* close handler
|
|
111
111
|
*/
|
|
@@ -131,7 +131,7 @@ export const Modal = ({
|
|
|
131
131
|
loading,
|
|
132
132
|
root,
|
|
133
133
|
size,
|
|
134
|
-
|
|
134
|
+
hideMask,
|
|
135
135
|
width,
|
|
136
136
|
height,
|
|
137
137
|
minHeight,
|
|
@@ -193,7 +193,7 @@ export const Modal = ({
|
|
|
193
193
|
}}
|
|
194
194
|
className={classNames(
|
|
195
195
|
"grid place-items-center p-16",
|
|
196
|
-
!
|
|
196
|
+
!hideMask && "bg-tint-100/20 backdrop-blur-sm",
|
|
197
197
|
)}
|
|
198
198
|
>
|
|
199
199
|
<FloatingFocusManager context={context}>
|