@react-fabric/core 1.0.0-beta.0 → 1.0.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/badge/Badge.js +6 -4
- package/dist/cjs/components/button/Button.js +4 -3
- package/dist/cjs/components/callout/Callout.js +3 -2
- package/dist/cjs/components/collapsable/Collapsable.js +3 -2
- package/dist/cjs/components/dropdown/Dropdown.js +1 -1
- package/dist/cjs/components/dropdown/DropdownTool.js +2 -1
- package/dist/cjs/core/section/Section.js +5 -2
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/overlays/alert/Alert.js +0 -3
- package/dist/cjs/typography/Abbr.js +2 -0
- package/dist/esm/components/badge/Badge.js +7 -5
- package/dist/esm/components/button/Button.js +4 -3
- package/dist/esm/components/callout/Callout.js +3 -2
- package/dist/esm/components/collapsable/Collapsable.js +3 -2
- package/dist/esm/components/dropdown/Dropdown.js +1 -1
- package/dist/esm/components/dropdown/DropdownTool.js +2 -1
- package/dist/esm/core/section/Section.js +5 -2
- package/dist/esm/index.js +1 -1
- package/dist/esm/overlays/alert/Alert.js +0 -3
- package/dist/esm/typography/Abbr.js +2 -0
- package/dist/types/components/button/Button.d.ts +2 -1
- package/dist/types/components/callout/Callout.d.ts +3 -3
- package/dist/types/components/collapsable/Collapsable.d.ts +5 -1
- package/dist/types/components/index.d.ts +1 -1
- package/dist/types/components/menu/types.d.ts +2 -2
- package/dist/types/components/tabpanel/Tab.d.ts +4 -0
- package/dist/types/core/aside/Aside.d.ts +2 -2
- package/dist/types/core/section/Section.d.ts +2 -2
- package/dist/types/types/index.d.ts +2 -2
- package/dist/types/typography/Abbr.d.ts +3 -3
- package/dist/types/typography/Link.d.ts +2 -1
- package/package.json +3 -3
- package/src/components/badge/Badge.tsx +24 -20
- package/src/components/button/Button.tsx +5 -2
- package/src/components/callout/Callout.tsx +8 -1
- package/src/components/collapsable/Collapsable.tsx +6 -1
- package/src/components/dropdown/Dropdown.tsx +2 -1
- package/src/components/dropdown/DropdownTool.tsx +2 -1
- package/src/components/index.ts +1 -0
- package/src/components/menu/Menu.tsx +1 -1
- package/src/components/menu/types.ts +2 -2
- package/src/components/tabpanel/Tab.tsx +4 -0
- package/src/core/aside/Aside.tsx +9 -2
- package/src/core/section/Section.tsx +8 -2
- package/src/overlays/alert/Alert.tsx +0 -1
- package/src/types/index.ts +5 -2
- package/src/typography/Abbr.tsx +4 -3
- package/src/typography/Link.tsx +3 -0
|
@@ -44,10 +44,12 @@ var Badge = function Badge(_ref) {
|
|
|
44
44
|
rtlFlip = _ref.rtlFlip,
|
|
45
45
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
46
46
|
var label = react.useMemo(function () {
|
|
47
|
-
if (utilities.
|
|
48
|
-
|
|
47
|
+
if (!utilities.isNil(value)) {
|
|
48
|
+
if (utilities.isNumber(value) && max && value > max) {
|
|
49
|
+
return "".concat(max, "+");
|
|
50
|
+
}
|
|
51
|
+
return "".concat(value);
|
|
49
52
|
}
|
|
50
|
-
return "".concat(value);
|
|
51
53
|
}, [value, max]);
|
|
52
54
|
var innerRef = react.useMemo(function () {
|
|
53
55
|
return utilities.mergeRefs(ref, children === null || children === void 0 ? void 0 : children.props.ref);
|
|
@@ -60,7 +62,7 @@ var Badge = function Badge(_ref) {
|
|
|
60
62
|
className: classNames(forButton ? "contents" : "relative", block ? "block" : "inline-block"),
|
|
61
63
|
children: [children && /*#__PURE__*/react.cloneElement(children, _objectSpread(_objectSpread({}, rest), {}, {
|
|
62
64
|
ref: innerRef
|
|
63
|
-
})), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
65
|
+
})), (!!ping || label) && /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
64
66
|
"data-ref": "badge",
|
|
65
67
|
"data-ping": ping,
|
|
66
68
|
"data-placement": placement,
|
|
@@ -16,7 +16,7 @@ var Icon = require('../icon/Icon.js');
|
|
|
16
16
|
var Button_module = require('./Button.module.css');
|
|
17
17
|
var jsxRuntime = require('react/jsx-runtime');
|
|
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", "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", "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
|
/**
|
|
@@ -47,6 +47,7 @@ var Button = function Button(_ref) {
|
|
|
47
47
|
spinOnHover = _ref.spinOnHover,
|
|
48
48
|
onClick = _ref.onClick,
|
|
49
49
|
actionMessage = _ref.actionMessage,
|
|
50
|
+
stopPropagation = _ref.stopPropagation,
|
|
50
51
|
_ref$type = _ref.type,
|
|
51
52
|
type = _ref$type === void 0 ? "button" : _ref$type,
|
|
52
53
|
hotKey = _ref.hotKey,
|
|
@@ -68,7 +69,7 @@ var Button = function Button(_ref) {
|
|
|
68
69
|
setActionDone = _useState4[1];
|
|
69
70
|
var clickHandler = react.useCallback(function (e) {
|
|
70
71
|
setBusy(true);
|
|
71
|
-
|
|
72
|
+
stopPropagation && e.stopPropagation();
|
|
72
73
|
var ret = onClick === null || onClick === void 0 ? void 0 : onClick(e);
|
|
73
74
|
void Promise.resolve(ret).then(function (b) {
|
|
74
75
|
setBusy(false);
|
|
@@ -76,7 +77,7 @@ var Button = function Button(_ref) {
|
|
|
76
77
|
setActionDone(true);
|
|
77
78
|
}
|
|
78
79
|
});
|
|
79
|
-
}, [onClick, disabled, actionMessage, showActionDoneEvent]);
|
|
80
|
+
}, [onClick, disabled, actionMessage, showActionDoneEvent, stopPropagation]);
|
|
80
81
|
|
|
81
82
|
/** ***************** reset done state on timeout *******************/
|
|
82
83
|
react.useEffect(function () {
|
|
@@ -9,7 +9,7 @@ require('@react-fabric/utilities');
|
|
|
9
9
|
var Icon = require('../icon/Icon.js');
|
|
10
10
|
var jsxRuntime = require('react/jsx-runtime');
|
|
11
11
|
|
|
12
|
-
var _excluded = ["children", "color", "legend", "title", "icon", "border", "onClose"];
|
|
12
|
+
var _excluded = ["children", "color", "legend", "title", "icon", "border", "onClose", "className"];
|
|
13
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; }
|
|
14
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
15
|
var Callout = function Callout(_ref) {
|
|
@@ -21,9 +21,10 @@ var Callout = function Callout(_ref) {
|
|
|
21
21
|
icon = _ref.icon,
|
|
22
22
|
border = _ref.border,
|
|
23
23
|
onClose = _ref.onClose,
|
|
24
|
+
className = _ref.className,
|
|
24
25
|
aria = _objectWithoutProperties(_ref, _excluded);
|
|
25
26
|
return /*#__PURE__*/jsxRuntime.jsxs("fieldset", _objectSpread(_objectSpread({
|
|
26
|
-
className: classNames("block rounded-capped border max-w-full relative overflow-hidden mb-4", getColor.getBgClass(color + "-50"), getColor.getColorClass(color + "-700"), getColor.getBorderClass(color + "-300"), border === "dashed" && "border-dashed", border === "dotted" && "border-dotted")
|
|
27
|
+
className: classNames(className, "block rounded-capped border max-w-full relative overflow-hidden mb-4", getColor.getBgClass(color + "-50"), getColor.getColorClass(color + "-700"), getColor.getBorderClass(color + "-300"), border === "dashed" && "border-dashed", border === "dotted" && "border-dotted")
|
|
27
28
|
}, aria), {}, {
|
|
28
29
|
children: [legend && /*#__PURE__*/jsxRuntime.jsx("legend", {
|
|
29
30
|
className: "px-2 mx-4 font-medium",
|
|
@@ -11,11 +11,12 @@ var Icon = require('../icon/Icon.js');
|
|
|
11
11
|
var Collapsable_module = require('./Collapsable.module.css');
|
|
12
12
|
var jsxRuntime = require('react/jsx-runtime');
|
|
13
13
|
|
|
14
|
-
var _excluded = ["ref", "className", "bodyClassName", "headerClassName", "children", "iconAlign", "iconClosed", "iconOpen", "open", "onClose", "onOpen"];
|
|
14
|
+
var _excluded = ["ref", "disabled", "className", "bodyClassName", "headerClassName", "children", "iconAlign", "iconClosed", "iconOpen", "open", "onClose", "onOpen"];
|
|
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
|
var Collapsable = function Collapsable(_ref) {
|
|
18
18
|
var ref = _ref.ref,
|
|
19
|
+
disabled = _ref.disabled,
|
|
19
20
|
className = _ref.className,
|
|
20
21
|
bodyClassName = _ref.bodyClassName,
|
|
21
22
|
headerClassName = _ref.headerClassName,
|
|
@@ -63,7 +64,7 @@ var Collapsable = function Collapsable(_ref) {
|
|
|
63
64
|
ref: headRef,
|
|
64
65
|
className: classNames(Collapsable_module.collapsableHead, "flex gap-1 flex-nowrap py-2 font-medium cursor-pointer items-center select-none hover:opacity-70", headerClassName, iconAlign === "end" ? "flex-row-reverse" : "flex-row"),
|
|
65
66
|
onClick: function onClick() {
|
|
66
|
-
return setOpenState(!openState);
|
|
67
|
+
return !disabled && setOpenState(!openState);
|
|
67
68
|
},
|
|
68
69
|
children: [/*#__PURE__*/jsxRuntime.jsx(Icon.Icon, {
|
|
69
70
|
size: "1.125em",
|
|
@@ -139,7 +139,7 @@ var DropdownElement = function DropdownElement(_ref) {
|
|
|
139
139
|
})), {}, {
|
|
140
140
|
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
141
141
|
role: "none",
|
|
142
|
-
className: classNames(Dropdown_module.dropdownBody, dropdownClassName, !plainDropdown && "shadow-lg bg-base ring-1 ring-tint-100", "rounded-capped overflow-auto scroll-thin grid max-h-[70vh]"),
|
|
142
|
+
className: classNames(Dropdown_module.dropdownBody, dropdownClassName, !plainDropdown && "shadow-lg shadow-base bg-base ring-1 ring-tint-100", "rounded-capped overflow-auto scroll-thin grid max-h-[70vh]"),
|
|
143
143
|
onMouseUpCapture: tryClosing,
|
|
144
144
|
children: panel
|
|
145
145
|
}), showArrow && /*#__PURE__*/jsxRuntime.jsx(react.FloatingArrow, {
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
4
4
|
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
5
5
|
var classNames = require('classnames');
|
|
6
|
+
var icons = require('../../types/icons.js');
|
|
6
7
|
var Icon = require('../icon/Icon.js');
|
|
7
8
|
var Dropdown = require('./Dropdown.js');
|
|
8
9
|
var jsxRuntime = require('react/jsx-runtime');
|
|
@@ -17,7 +18,7 @@ var DropdownTool = function DropdownTool(_ref) {
|
|
|
17
18
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
18
19
|
return /*#__PURE__*/jsxRuntime.jsxs(Dropdown.Dropdown, _objectSpread(_objectSpread({}, props), {}, {
|
|
19
20
|
children: [/*#__PURE__*/jsxRuntime.jsx(Icon.Icon, {
|
|
20
|
-
icon:
|
|
21
|
+
icon: icons.CoreIcons.caretDown,
|
|
21
22
|
className: classNames(className, "outline bg-base flex-content pointer-events-auto cursor-pointer", groupHover && "hidden group-hover:inline-block data-[dropdown-open]:inline-block")
|
|
22
23
|
}), children]
|
|
23
24
|
}));
|
|
@@ -30,11 +30,14 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
30
30
|
|
|
31
31
|
var Section = function Section(_ref) {
|
|
32
32
|
var children = _ref.children,
|
|
33
|
-
|
|
33
|
+
className = _ref.className,
|
|
34
|
+
dir = _ref.dir,
|
|
35
|
+
ref = _ref.ref;
|
|
34
36
|
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
35
37
|
"data-ref": "section",
|
|
36
38
|
dir: dir,
|
|
37
|
-
|
|
39
|
+
ref: ref,
|
|
40
|
+
className: classNames(Section_module.section, className, "grid area-content overflow-hidden"),
|
|
38
41
|
children: /*#__PURE__*/jsxRuntime.jsx(ErrorBoundary.ErrorBoundary, {
|
|
39
42
|
children: children
|
|
40
43
|
})
|
package/dist/cjs/index.js
CHANGED
|
@@ -80,6 +80,7 @@ exports.ActionLabel = ActionLabel.ActionLabel;
|
|
|
80
80
|
exports.AnimationBars = Animations.AnimationBars;
|
|
81
81
|
exports.AnimationIndicator = Animations.AnimationIndicator;
|
|
82
82
|
exports.AnimationSpinner = Animations.AnimationSpinner;
|
|
83
|
+
exports.Loading = Animations.Loading;
|
|
83
84
|
exports.Skeleton = Animations.Skeleton;
|
|
84
85
|
exports.Avatar = Avatar.Avatar;
|
|
85
86
|
exports.AvatarGroup = AvatarGroup.AvatarGroup;
|
|
@@ -112,9 +112,6 @@ var Alert = function Alert(_ref) {
|
|
|
112
112
|
}), /*#__PURE__*/jsxRuntime.jsx("p", {
|
|
113
113
|
className: "area-[message] py-4",
|
|
114
114
|
children: message
|
|
115
|
-
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
116
|
-
className: "area-[message]",
|
|
117
|
-
children: message
|
|
118
115
|
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
119
116
|
className: "flex gap-1 justify-center flex-nowrap pt-2 area-[actions]",
|
|
120
117
|
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
@@ -42,6 +42,7 @@ var AbbrText = function AbbrText(_ref) {
|
|
|
42
42
|
var Abbr = function Abbr(_ref2) {
|
|
43
43
|
var children = _ref2.children,
|
|
44
44
|
abbr = _ref2.abbr,
|
|
45
|
+
className = _ref2.className,
|
|
45
46
|
renderer = _ref2.renderer,
|
|
46
47
|
_ref2$copyContent = _ref2.copyContent,
|
|
47
48
|
copyContent = _ref2$copyContent === void 0 ? "text" : _ref2$copyContent;
|
|
@@ -101,6 +102,7 @@ var Abbr = function Abbr(_ref2) {
|
|
|
101
102
|
|
|
102
103
|
/** ***************** component *******************/
|
|
103
104
|
return /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
105
|
+
className: className,
|
|
104
106
|
children: inner
|
|
105
107
|
});
|
|
106
108
|
};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
4
4
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
5
|
-
import { isObject, isNumber, mergeRefs } from '@react-fabric/utilities';
|
|
5
|
+
import { isObject, isNil, isNumber, mergeRefs } from '@react-fabric/utilities';
|
|
6
6
|
import classNames from 'classnames';
|
|
7
7
|
import { useMemo, cloneElement } from 'react';
|
|
8
8
|
import { Icon } from '../icon/Icon.js';
|
|
@@ -44,10 +44,12 @@ var Badge = function Badge(_ref) {
|
|
|
44
44
|
rtlFlip = _ref.rtlFlip,
|
|
45
45
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
46
46
|
var label = useMemo(function () {
|
|
47
|
-
if (
|
|
48
|
-
|
|
47
|
+
if (!isNil(value)) {
|
|
48
|
+
if (isNumber(value) && max && value > max) {
|
|
49
|
+
return "".concat(max, "+");
|
|
50
|
+
}
|
|
51
|
+
return "".concat(value);
|
|
49
52
|
}
|
|
50
|
-
return "".concat(value);
|
|
51
53
|
}, [value, max]);
|
|
52
54
|
var innerRef = useMemo(function () {
|
|
53
55
|
return mergeRefs(ref, children === null || children === void 0 ? void 0 : children.props.ref);
|
|
@@ -60,7 +62,7 @@ var Badge = function Badge(_ref) {
|
|
|
60
62
|
className: classNames(forButton ? "contents" : "relative", block ? "block" : "inline-block"),
|
|
61
63
|
children: [children && /*#__PURE__*/cloneElement(children, _objectSpread(_objectSpread({}, rest), {}, {
|
|
62
64
|
ref: innerRef
|
|
63
|
-
})), /*#__PURE__*/jsxs("div", {
|
|
65
|
+
})), (!!ping || label) && /*#__PURE__*/jsxs("div", {
|
|
64
66
|
"data-ref": "badge",
|
|
65
67
|
"data-ping": ping,
|
|
66
68
|
"data-placement": placement,
|
|
@@ -16,7 +16,7 @@ import { Icon } from '../icon/Icon.js';
|
|
|
16
16
|
import classes from './Button.module.css';
|
|
17
17
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
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", "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", "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
|
/**
|
|
@@ -47,6 +47,7 @@ var Button = function Button(_ref) {
|
|
|
47
47
|
spinOnHover = _ref.spinOnHover,
|
|
48
48
|
onClick = _ref.onClick,
|
|
49
49
|
actionMessage = _ref.actionMessage,
|
|
50
|
+
stopPropagation = _ref.stopPropagation,
|
|
50
51
|
_ref$type = _ref.type,
|
|
51
52
|
type = _ref$type === void 0 ? "button" : _ref$type,
|
|
52
53
|
hotKey = _ref.hotKey,
|
|
@@ -68,7 +69,7 @@ var Button = function Button(_ref) {
|
|
|
68
69
|
setActionDone = _useState4[1];
|
|
69
70
|
var clickHandler = useCallback(function (e) {
|
|
70
71
|
setBusy(true);
|
|
71
|
-
|
|
72
|
+
stopPropagation && e.stopPropagation();
|
|
72
73
|
var ret = onClick === null || onClick === void 0 ? void 0 : onClick(e);
|
|
73
74
|
void Promise.resolve(ret).then(function (b) {
|
|
74
75
|
setBusy(false);
|
|
@@ -76,7 +77,7 @@ var Button = function Button(_ref) {
|
|
|
76
77
|
setActionDone(true);
|
|
77
78
|
}
|
|
78
79
|
});
|
|
79
|
-
}, [onClick, disabled, actionMessage, showActionDoneEvent]);
|
|
80
|
+
}, [onClick, disabled, actionMessage, showActionDoneEvent, stopPropagation]);
|
|
80
81
|
|
|
81
82
|
/** ***************** reset done state on timeout *******************/
|
|
82
83
|
useEffect(function () {
|
|
@@ -9,7 +9,7 @@ import '@react-fabric/utilities';
|
|
|
9
9
|
import { Icon } from '../icon/Icon.js';
|
|
10
10
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
11
11
|
|
|
12
|
-
var _excluded = ["children", "color", "legend", "title", "icon", "border", "onClose"];
|
|
12
|
+
var _excluded = ["children", "color", "legend", "title", "icon", "border", "onClose", "className"];
|
|
13
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; }
|
|
14
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
15
|
var Callout = function Callout(_ref) {
|
|
@@ -21,9 +21,10 @@ var Callout = function Callout(_ref) {
|
|
|
21
21
|
icon = _ref.icon,
|
|
22
22
|
border = _ref.border,
|
|
23
23
|
onClose = _ref.onClose,
|
|
24
|
+
className = _ref.className,
|
|
24
25
|
aria = _objectWithoutProperties(_ref, _excluded);
|
|
25
26
|
return /*#__PURE__*/jsxs("fieldset", _objectSpread(_objectSpread({
|
|
26
|
-
className: classNames("block rounded-capped border max-w-full relative overflow-hidden mb-4", getBgClass(color + "-50"), getColorClass(color + "-700"), getBorderClass(color + "-300"), border === "dashed" && "border-dashed", border === "dotted" && "border-dotted")
|
|
27
|
+
className: classNames(className, "block rounded-capped border max-w-full relative overflow-hidden mb-4", getBgClass(color + "-50"), getColorClass(color + "-700"), getBorderClass(color + "-300"), border === "dashed" && "border-dashed", border === "dotted" && "border-dotted")
|
|
27
28
|
}, aria), {}, {
|
|
28
29
|
children: [legend && /*#__PURE__*/jsx("legend", {
|
|
29
30
|
className: "px-2 mx-4 font-medium",
|
|
@@ -11,11 +11,12 @@ import { Icon } from '../icon/Icon.js';
|
|
|
11
11
|
import classes from './Collapsable.module.css';
|
|
12
12
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
13
13
|
|
|
14
|
-
var _excluded = ["ref", "className", "bodyClassName", "headerClassName", "children", "iconAlign", "iconClosed", "iconOpen", "open", "onClose", "onOpen"];
|
|
14
|
+
var _excluded = ["ref", "disabled", "className", "bodyClassName", "headerClassName", "children", "iconAlign", "iconClosed", "iconOpen", "open", "onClose", "onOpen"];
|
|
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
|
var Collapsable = function Collapsable(_ref) {
|
|
18
18
|
var ref = _ref.ref,
|
|
19
|
+
disabled = _ref.disabled,
|
|
19
20
|
className = _ref.className,
|
|
20
21
|
bodyClassName = _ref.bodyClassName,
|
|
21
22
|
headerClassName = _ref.headerClassName,
|
|
@@ -63,7 +64,7 @@ var Collapsable = function Collapsable(_ref) {
|
|
|
63
64
|
ref: headRef,
|
|
64
65
|
className: classNames(classes.collapsableHead, "flex gap-1 flex-nowrap py-2 font-medium cursor-pointer items-center select-none hover:opacity-70", headerClassName, iconAlign === "end" ? "flex-row-reverse" : "flex-row"),
|
|
65
66
|
onClick: function onClick() {
|
|
66
|
-
return setOpenState(!openState);
|
|
67
|
+
return !disabled && setOpenState(!openState);
|
|
67
68
|
},
|
|
68
69
|
children: [/*#__PURE__*/jsx(Icon, {
|
|
69
70
|
size: "1.125em",
|
|
@@ -139,7 +139,7 @@ var DropdownElement = function DropdownElement(_ref) {
|
|
|
139
139
|
})), {}, {
|
|
140
140
|
children: [/*#__PURE__*/jsx("div", {
|
|
141
141
|
role: "none",
|
|
142
|
-
className: classNames(classes.dropdownBody, dropdownClassName, !plainDropdown && "shadow-lg bg-base ring-1 ring-tint-100", "rounded-capped overflow-auto scroll-thin grid max-h-[70vh]"),
|
|
142
|
+
className: classNames(classes.dropdownBody, dropdownClassName, !plainDropdown && "shadow-lg shadow-base bg-base ring-1 ring-tint-100", "rounded-capped overflow-auto scroll-thin grid max-h-[70vh]"),
|
|
143
143
|
onMouseUpCapture: tryClosing,
|
|
144
144
|
children: panel
|
|
145
145
|
}), showArrow && /*#__PURE__*/jsx(FloatingArrow, {
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
4
4
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
5
5
|
import classNames from 'classnames';
|
|
6
|
+
import { CoreIcons } from '../../types/icons.js';
|
|
6
7
|
import { Icon } from '../icon/Icon.js';
|
|
7
8
|
import { Dropdown } from './Dropdown.js';
|
|
8
9
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
@@ -17,7 +18,7 @@ var DropdownTool = function DropdownTool(_ref) {
|
|
|
17
18
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
18
19
|
return /*#__PURE__*/jsxs(Dropdown, _objectSpread(_objectSpread({}, props), {}, {
|
|
19
20
|
children: [/*#__PURE__*/jsx(Icon, {
|
|
20
|
-
icon:
|
|
21
|
+
icon: CoreIcons.caretDown,
|
|
21
22
|
className: classNames(className, "outline bg-base flex-content pointer-events-auto cursor-pointer", groupHover && "hidden group-hover:inline-block data-[dropdown-open]:inline-block")
|
|
22
23
|
}), children]
|
|
23
24
|
}));
|
|
@@ -30,11 +30,14 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
30
30
|
|
|
31
31
|
var Section = function Section(_ref) {
|
|
32
32
|
var children = _ref.children,
|
|
33
|
-
|
|
33
|
+
className = _ref.className,
|
|
34
|
+
dir = _ref.dir,
|
|
35
|
+
ref = _ref.ref;
|
|
34
36
|
return /*#__PURE__*/jsx("div", {
|
|
35
37
|
"data-ref": "section",
|
|
36
38
|
dir: dir,
|
|
37
|
-
|
|
39
|
+
ref: ref,
|
|
40
|
+
className: classNames(classes.section, className, "grid area-content overflow-hidden"),
|
|
38
41
|
children: /*#__PURE__*/jsx(ErrorBoundary, {
|
|
39
42
|
children: children
|
|
40
43
|
})
|
package/dist/esm/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
export { ActionLabel } from './components/actionLabel/ActionLabel.js';
|
|
4
|
-
export { AnimationBars, AnimationIndicator, AnimationSpinner, Skeleton } from './components/animations/Animations.js';
|
|
4
|
+
export { AnimationBars, AnimationIndicator, AnimationSpinner, Loading, Skeleton } from './components/animations/Animations.js';
|
|
5
5
|
export { Avatar } from './components/avatar/Avatar.js';
|
|
6
6
|
export { AvatarGroup } from './components/avatar/AvatarGroup.js';
|
|
7
7
|
export { Badge, getBadgeProps } from './components/badge/Badge.js';
|
|
@@ -112,9 +112,6 @@ var Alert = function Alert(_ref) {
|
|
|
112
112
|
}), /*#__PURE__*/jsx("p", {
|
|
113
113
|
className: "area-[message] py-4",
|
|
114
114
|
children: message
|
|
115
|
-
}), /*#__PURE__*/jsx("div", {
|
|
116
|
-
className: "area-[message]",
|
|
117
|
-
children: message
|
|
118
115
|
}), /*#__PURE__*/jsxs("div", {
|
|
119
116
|
className: "flex gap-1 justify-center flex-nowrap pt-2 area-[actions]",
|
|
120
117
|
children: [/*#__PURE__*/jsx("div", {
|
|
@@ -42,6 +42,7 @@ var AbbrText = function AbbrText(_ref) {
|
|
|
42
42
|
var Abbr = function Abbr(_ref2) {
|
|
43
43
|
var children = _ref2.children,
|
|
44
44
|
abbr = _ref2.abbr,
|
|
45
|
+
className = _ref2.className,
|
|
45
46
|
renderer = _ref2.renderer,
|
|
46
47
|
_ref2$copyContent = _ref2.copyContent,
|
|
47
48
|
copyContent = _ref2$copyContent === void 0 ? "text" : _ref2$copyContent;
|
|
@@ -101,6 +102,7 @@ var Abbr = function Abbr(_ref2) {
|
|
|
101
102
|
|
|
102
103
|
/** ***************** component *******************/
|
|
103
104
|
return /*#__PURE__*/jsx("span", {
|
|
105
|
+
className: className,
|
|
104
106
|
children: inner
|
|
105
107
|
});
|
|
106
108
|
};
|
|
@@ -74,6 +74,7 @@ export interface BaseProps extends CssProp, AriaProps, IconProps, RefProp, TestP
|
|
|
74
74
|
* keyboard shortcut
|
|
75
75
|
*/
|
|
76
76
|
hotKey?: string;
|
|
77
|
+
stopPropagation?: boolean;
|
|
77
78
|
onMouseOut?: MouseEventHandler;
|
|
78
79
|
onMouseOver?: MouseEventHandler;
|
|
79
80
|
onMouseMove?: MouseEventHandler;
|
|
@@ -91,4 +92,4 @@ export type ButtonProps = {
|
|
|
91
92
|
/**
|
|
92
93
|
* Clickable action button
|
|
93
94
|
*/
|
|
94
|
-
export declare const Button: <Tag extends import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> = "button">({ as, ref, children, className, active, color, icon, iconBg, iconColor, iconAlign, altIcon, rtlFlip, rounded, size, disabled, loading, variant, badge, fullWidth, spinOnHover, onClick, actionMessage, type, hotKey, showActionDone, showActionDoneEvent, tabIndex, "data-ref": dataRef, ...aria }: BaseProps & ButtonProps & PolymorphicProps<Tag>) => import("react/jsx-runtime").JSX.Element;
|
|
95
|
+
export declare const Button: <Tag extends import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> = "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 }: BaseProps & ButtonProps & PolymorphicProps<Tag>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type AriaProps, type ChildrenProp, type ColorType, type PaletteType, type TestProps } from "../../types";
|
|
2
|
-
export interface CalloutProps extends AriaProps, ChildrenProp, TestProps {
|
|
1
|
+
import { type AriaProps, type ChildrenProp, type ColorType, type CssProp, type PaletteType, type TestProps } from "../../types";
|
|
2
|
+
export interface CalloutProps extends AriaProps, ChildrenProp, CssProp, TestProps {
|
|
3
3
|
/**
|
|
4
4
|
* callout color
|
|
5
5
|
*/
|
|
@@ -25,4 +25,4 @@ export interface CalloutProps extends AriaProps, ChildrenProp, TestProps {
|
|
|
25
25
|
*/
|
|
26
26
|
onClose?: () => void;
|
|
27
27
|
}
|
|
28
|
-
export declare const Callout: ({ children, color, legend, title, icon, border, onClose, ...aria }: CalloutProps) => import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
export declare const Callout: ({ children, color, legend, title, icon, border, onClose, className, ...aria }: CalloutProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -30,6 +30,10 @@ export interface CollapsableProps extends CssProp, AriaProps, TestProps, RefProp
|
|
|
30
30
|
* open state
|
|
31
31
|
*/
|
|
32
32
|
open?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* disable collapsable
|
|
35
|
+
*/
|
|
36
|
+
disabled?: boolean;
|
|
33
37
|
/**
|
|
34
38
|
* open handler
|
|
35
39
|
*/
|
|
@@ -39,5 +43,5 @@ export interface CollapsableProps extends CssProp, AriaProps, TestProps, RefProp
|
|
|
39
43
|
*/
|
|
40
44
|
onClose?: () => void;
|
|
41
45
|
}
|
|
42
|
-
export declare const Collapsable: ({ ref, className, bodyClassName, headerClassName, children, iconAlign, iconClosed, iconOpen, open, onClose, onOpen, ...aria }: CollapsableProps) => import("react/jsx-runtime").JSX.Element;
|
|
46
|
+
export declare const Collapsable: ({ ref, disabled, className, bodyClassName, headerClassName, children, iconAlign, iconClosed, iconOpen, open, onClose, onOpen, ...aria }: CollapsableProps) => import("react/jsx-runtime").JSX.Element;
|
|
43
47
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { ActionLabel } from "./actionLabel/ActionLabel";
|
|
2
|
-
export { AnimationBars, AnimationIndicator, AnimationSpinner, Skeleton, } from "./animations/Animations";
|
|
2
|
+
export { AnimationBars, AnimationIndicator, AnimationSpinner, Skeleton, Loading, } from "./animations/Animations";
|
|
3
3
|
export { Avatar } from "./avatar/Avatar";
|
|
4
4
|
export { AvatarGroup } from "./avatar/AvatarGroup";
|
|
5
5
|
export { Badge, getBadgeProps } from "./badge/Badge";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ElementType } from "react";
|
|
1
|
+
import { type ElementType, type MouseEvent } from "react";
|
|
2
2
|
import { type AriaProps, type BadgeType, type CallbackReturn, type ChildrenProp, type ColorType, type CssProp, type IconProps, type TestProps } from "../../types";
|
|
3
3
|
export interface MenuItemProps extends CssProp, AriaProps, TestProps, IconProps {
|
|
4
4
|
/**
|
|
@@ -40,7 +40,7 @@ export interface MenuItemProps extends CssProp, AriaProps, TestProps, IconProps
|
|
|
40
40
|
/**
|
|
41
41
|
* click handler
|
|
42
42
|
*/
|
|
43
|
-
onClick?: () => CallbackReturn;
|
|
43
|
+
onClick?: (e: MouseEvent) => CallbackReturn;
|
|
44
44
|
}
|
|
45
45
|
export interface MenuRootProps extends CssProp {
|
|
46
46
|
label?: never;
|
|
@@ -37,5 +37,9 @@ export interface TabProps extends Partial<ChildrenProp>, CssProp, RefProp, AriaP
|
|
|
37
37
|
* close handler
|
|
38
38
|
*/
|
|
39
39
|
onClose?: () => CallbackReturn;
|
|
40
|
+
/**
|
|
41
|
+
* click handler
|
|
42
|
+
*/
|
|
43
|
+
onClick?: (id: string) => CallbackReturn;
|
|
40
44
|
}
|
|
41
45
|
export declare const Tab: <Tag extends import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> = "button">({ ref, as, id, className, label, icon, iconBg, iconColor, rtlFlip, badge, disabled, onClose, active, minimal, onClick, tabFlex, color, actions, activeClassName, ...aria }: TabProps & PolymorphicProps<Tag>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
2
|
import { type ChildrenProp, type CollapseProps, type Elements, type IconProps, type TestProps } from "../../types";
|
|
3
3
|
export interface AsideProps extends IconProps, ChildrenProp, CollapseProps, TestProps {
|
|
4
4
|
/**
|
|
5
5
|
* page title
|
|
6
6
|
*/
|
|
7
|
-
title?:
|
|
7
|
+
title?: ReactNode;
|
|
8
8
|
/**
|
|
9
9
|
* align inline-end
|
|
10
10
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { type ChildrenProp } from "../../types";
|
|
1
|
+
import { type ChildrenProp, type CssProp, type RefProp } from "../../types";
|
|
2
2
|
/**
|
|
3
3
|
* The section component provides a structured layout used within a page to organize and display content in a sectioned format, ensuring a consistent and intuitive user experience.
|
|
4
4
|
*/
|
|
5
|
-
export declare const Section: ({ children, dir, }: ChildrenProp & {
|
|
5
|
+
export declare const Section: ({ children, className, dir, ref, }: ChildrenProp & CssProp & RefProp<HTMLDivElement> & {
|
|
6
6
|
dir?: "ltr" | "rtl";
|
|
7
7
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -62,10 +62,10 @@ export type AriaProps = React.AriaAttributes;
|
|
|
62
62
|
export interface RefProp<T = HTMLElement> {
|
|
63
63
|
ref?: Ref<T>;
|
|
64
64
|
}
|
|
65
|
-
export type CallbackReturn<T = unknown> =
|
|
65
|
+
export type CallbackReturn<T = unknown> = undefined | T | Promise<T | undefined>;
|
|
66
66
|
export type ReactTag = keyof JSX.IntrinsicElements | JSXElementConstructor<any>;
|
|
67
67
|
export type PropsOf<AsTag extends ReactTag> = AsTag extends React.ElementType ? Omit<React.ComponentProps<AsTag>, "ref"> : never;
|
|
68
|
-
export type PolymorphicProps<AsTag extends ReactTag> = Omit<PropsOf<AsTag>, "children" | "as" | "className"> & {
|
|
68
|
+
export type PolymorphicProps<AsTag extends ReactTag> = Omit<PropsOf<AsTag>, "children" | "as" | "className" | "onClick"> & {
|
|
69
69
|
/**
|
|
70
70
|
* The component used for the root node.
|
|
71
71
|
* Either a string to use a HTML element or a component.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { type ChildProp, type ColorType } from "../types";
|
|
3
|
-
export interface AbbrProps extends ChildProp<string
|
|
2
|
+
import { type ChildProp, type ColorType, type CssProp } from "../types";
|
|
3
|
+
export interface AbbrProps extends ChildProp<string>, CssProp {
|
|
4
4
|
/**
|
|
5
5
|
* content to copy using the tooltip copy action
|
|
6
6
|
*/
|
|
@@ -19,4 +19,4 @@ export interface AbbrProps extends ChildProp<string> {
|
|
|
19
19
|
/**
|
|
20
20
|
* Typography abbr component to wrap text parts in `abbr` with tooltip
|
|
21
21
|
*/
|
|
22
|
-
export declare const Abbr: ({ children, abbr, renderer, copyContent, }: AbbrProps) => import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
export declare const Abbr: ({ children, abbr, className, renderer, copyContent, }: AbbrProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import { type MouseEventHandler } from "react";
|
|
2
2
|
import { type AriaProps, type ChildrenProp, type ColorType, type CssProp, type PolymorphicProps, type RefProp, type SizeType } from "../types";
|
|
3
3
|
export interface LinkProps extends ChildrenProp, CssProp, RefProp, AriaProps {
|
|
4
4
|
/**
|
|
@@ -17,6 +17,7 @@ export interface LinkProps extends ChildrenProp, CssProp, RefProp, AriaProps {
|
|
|
17
17
|
* font family
|
|
18
18
|
*/
|
|
19
19
|
family?: "sans" | "serif" | "mono";
|
|
20
|
+
onClick?: MouseEventHandler;
|
|
20
21
|
}
|
|
21
22
|
/**
|
|
22
23
|
* Typography link component
|
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.3",
|
|
4
4
|
"description": "RUF: Core package",
|
|
5
5
|
"author": "Adarsh Pastakia <adarshpastakia@outlook.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@floating-ui/react": "^0.26.24",
|
|
39
|
-
"@react-fabric/utilities": "^1.0.0-beta.
|
|
39
|
+
"@react-fabric/utilities": "^1.0.0-beta.1",
|
|
40
40
|
"@tailwindcss/container-queries": "^0.1.1",
|
|
41
41
|
"@tailwindcss/forms": "^0.5.7",
|
|
42
42
|
"@tailwindcss/typography": "^0.5.13",
|
|
@@ -56,5 +56,5 @@
|
|
|
56
56
|
"node": ">=18.12.0",
|
|
57
57
|
"npm": ">=8.19.0"
|
|
58
58
|
},
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "2ce2a968f48d6ffc338f5da3a0cf67232d0c6864"
|
|
60
60
|
}
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
|
-
import { isNumber, isObject, mergeRefs } from "@react-fabric/utilities";
|
|
24
|
+
import { isNil, isNumber, isObject, mergeRefs } from "@react-fabric/utilities";
|
|
25
25
|
import classNames from "classnames";
|
|
26
26
|
import { cloneElement, useMemo } from "react";
|
|
27
27
|
import {
|
|
@@ -101,10 +101,12 @@ export const Badge = ({
|
|
|
101
101
|
...rest
|
|
102
102
|
}: BadgeProps) => {
|
|
103
103
|
const label = useMemo(() => {
|
|
104
|
-
if (
|
|
105
|
-
|
|
104
|
+
if (!isNil(value)) {
|
|
105
|
+
if (isNumber(value) && max && value > max) {
|
|
106
|
+
return `${max}+`;
|
|
107
|
+
}
|
|
108
|
+
return `${value}`;
|
|
106
109
|
}
|
|
107
|
-
return `${value}`;
|
|
108
110
|
}, [value, max]);
|
|
109
111
|
|
|
110
112
|
const innerRef = useMemo(
|
|
@@ -127,22 +129,24 @@ export const Badge = ({
|
|
|
127
129
|
...rest,
|
|
128
130
|
ref: innerRef,
|
|
129
131
|
})}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
132
|
+
{(!!ping || label) && (
|
|
133
|
+
<div
|
|
134
|
+
data-ref="badge"
|
|
135
|
+
data-ping={ping}
|
|
136
|
+
data-placement={placement}
|
|
137
|
+
className={classNames(
|
|
138
|
+
classes.badge,
|
|
139
|
+
className,
|
|
140
|
+
"inline-block p-px min-w-2 min-h-2 text-center select-none rounded-full leading-none z-5 pointer-events-none",
|
|
141
|
+
forButton && !placement ? "relative" : "absolute",
|
|
142
|
+
)}
|
|
143
|
+
>
|
|
144
|
+
{label && <span className="p-1">{label}</span>}
|
|
145
|
+
{icon && (
|
|
146
|
+
<Icon icon={icon} bg={iconBg} color={iconColor} rtlFlip={rtlFlip} />
|
|
147
|
+
)}
|
|
148
|
+
</div>
|
|
149
|
+
)}
|
|
146
150
|
</div>
|
|
147
151
|
);
|
|
148
152
|
};
|
|
@@ -136,6 +136,8 @@ export interface BaseProps
|
|
|
136
136
|
*/
|
|
137
137
|
hotKey?: string;
|
|
138
138
|
|
|
139
|
+
stopPropagation?: boolean;
|
|
140
|
+
|
|
139
141
|
onMouseOut?: MouseEventHandler;
|
|
140
142
|
onMouseOver?: MouseEventHandler;
|
|
141
143
|
onMouseMove?: MouseEventHandler;
|
|
@@ -175,6 +177,7 @@ export const Button = <Tag extends React.ElementType = "button">({
|
|
|
175
177
|
spinOnHover,
|
|
176
178
|
onClick,
|
|
177
179
|
actionMessage,
|
|
180
|
+
stopPropagation,
|
|
178
181
|
type = "button",
|
|
179
182
|
hotKey,
|
|
180
183
|
showActionDone,
|
|
@@ -191,7 +194,7 @@ export const Button = <Tag extends React.ElementType = "button">({
|
|
|
191
194
|
const clickHandler = useCallback(
|
|
192
195
|
(e: React.MouseEvent) => {
|
|
193
196
|
setBusy(true);
|
|
194
|
-
|
|
197
|
+
stopPropagation && e.stopPropagation();
|
|
195
198
|
const ret = onClick?.(e);
|
|
196
199
|
void Promise.resolve(ret).then((b) => {
|
|
197
200
|
setBusy(false);
|
|
@@ -200,7 +203,7 @@ export const Button = <Tag extends React.ElementType = "button">({
|
|
|
200
203
|
}
|
|
201
204
|
});
|
|
202
205
|
},
|
|
203
|
-
[onClick, disabled, actionMessage, showActionDoneEvent],
|
|
206
|
+
[onClick, disabled, actionMessage, showActionDoneEvent, stopPropagation],
|
|
204
207
|
);
|
|
205
208
|
|
|
206
209
|
/** ***************** reset done state on timeout *******************/
|
|
@@ -26,6 +26,7 @@ import {
|
|
|
26
26
|
type AriaProps,
|
|
27
27
|
type ChildrenProp,
|
|
28
28
|
type ColorType,
|
|
29
|
+
type CssProp,
|
|
29
30
|
type PaletteType,
|
|
30
31
|
type TestProps,
|
|
31
32
|
} from "../../types";
|
|
@@ -33,7 +34,11 @@ import { CoreIcons } from "../../types/icons";
|
|
|
33
34
|
import { getBgClass, getBorderClass, getColorClass } from "../../utils";
|
|
34
35
|
import { Icon } from "../icon/Icon";
|
|
35
36
|
|
|
36
|
-
export interface CalloutProps
|
|
37
|
+
export interface CalloutProps
|
|
38
|
+
extends AriaProps,
|
|
39
|
+
ChildrenProp,
|
|
40
|
+
CssProp,
|
|
41
|
+
TestProps {
|
|
37
42
|
/**
|
|
38
43
|
* callout color
|
|
39
44
|
*/
|
|
@@ -69,11 +74,13 @@ export const Callout = ({
|
|
|
69
74
|
icon,
|
|
70
75
|
border,
|
|
71
76
|
onClose,
|
|
77
|
+
className,
|
|
72
78
|
...aria
|
|
73
79
|
}: CalloutProps) => {
|
|
74
80
|
return (
|
|
75
81
|
<fieldset
|
|
76
82
|
className={classNames(
|
|
83
|
+
className,
|
|
77
84
|
"block rounded-capped border max-w-full relative overflow-hidden mb-4",
|
|
78
85
|
getBgClass(color + "-50"),
|
|
79
86
|
getColorClass(color + "-700"),
|
|
@@ -78,6 +78,10 @@ export interface CollapsableProps
|
|
|
78
78
|
* open state
|
|
79
79
|
*/
|
|
80
80
|
open?: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* disable collapsable
|
|
83
|
+
*/
|
|
84
|
+
disabled?: boolean;
|
|
81
85
|
/**
|
|
82
86
|
* open handler
|
|
83
87
|
*/
|
|
@@ -90,6 +94,7 @@ export interface CollapsableProps
|
|
|
90
94
|
|
|
91
95
|
export const Collapsable = ({
|
|
92
96
|
ref,
|
|
97
|
+
disabled,
|
|
93
98
|
className,
|
|
94
99
|
bodyClassName,
|
|
95
100
|
headerClassName,
|
|
@@ -135,7 +140,7 @@ export const Collapsable = ({
|
|
|
135
140
|
headerClassName,
|
|
136
141
|
iconAlign === "end" ? "flex-row-reverse" : "flex-row",
|
|
137
142
|
)}
|
|
138
|
-
onClick={() => setOpenState(!openState)}
|
|
143
|
+
onClick={() => !disabled && setOpenState(!openState)}
|
|
139
144
|
>
|
|
140
145
|
<Icon size="1.125em" icon={openState ? iconOpen : iconClosed} rtlFlip />
|
|
141
146
|
<div className="flex-1 px-2">{head}</div>
|
|
@@ -257,7 +257,8 @@ const DropdownElement = ({
|
|
|
257
257
|
className={classNames(
|
|
258
258
|
classes.dropdownBody,
|
|
259
259
|
dropdownClassName,
|
|
260
|
-
!plainDropdown &&
|
|
260
|
+
!plainDropdown &&
|
|
261
|
+
"shadow-lg shadow-base bg-base ring-1 ring-tint-100",
|
|
261
262
|
"rounded-capped overflow-auto scroll-thin grid max-h-[70vh]",
|
|
262
263
|
)}
|
|
263
264
|
onMouseUpCapture={tryClosing}
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
|
|
24
24
|
import classNames from "classnames";
|
|
25
25
|
import { type ChildProp, type CssProp } from "../../types";
|
|
26
|
+
import { CoreIcons } from "../../types/icons";
|
|
26
27
|
import { Icon } from "../icon/Icon";
|
|
27
28
|
import { Dropdown, type DropdownProps } from "./Dropdown";
|
|
28
29
|
|
|
@@ -42,7 +43,7 @@ export const DropdownTool = ({
|
|
|
42
43
|
return (
|
|
43
44
|
<Dropdown {...props}>
|
|
44
45
|
<Icon
|
|
45
|
-
icon=
|
|
46
|
+
icon={CoreIcons.caretDown}
|
|
46
47
|
className={classNames(
|
|
47
48
|
className,
|
|
48
49
|
"outline bg-base flex-content pointer-events-auto cursor-pointer",
|
package/src/components/index.ts
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
|
-
import { type ElementType } from "react";
|
|
24
|
+
import { type ElementType, type MouseEvent } from "react";
|
|
25
25
|
import {
|
|
26
26
|
type AriaProps,
|
|
27
27
|
type BadgeType,
|
|
@@ -77,7 +77,7 @@ export interface MenuItemProps
|
|
|
77
77
|
/**
|
|
78
78
|
* click handler
|
|
79
79
|
*/
|
|
80
|
-
onClick?: () => CallbackReturn;
|
|
80
|
+
onClick?: (e: MouseEvent) => CallbackReturn;
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
export interface MenuRootProps extends CssProp {
|
package/src/core/aside/Aside.tsx
CHANGED
|
@@ -22,7 +22,14 @@
|
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
24
|
import classNames from "classnames";
|
|
25
|
-
import {
|
|
25
|
+
import {
|
|
26
|
+
type ReactNode,
|
|
27
|
+
useCallback,
|
|
28
|
+
useEffect,
|
|
29
|
+
useMemo,
|
|
30
|
+
useRef,
|
|
31
|
+
useState,
|
|
32
|
+
} from "react";
|
|
26
33
|
import { Loading } from "../../components/animations/Animations";
|
|
27
34
|
import { Icon } from "../../components/icon/Icon";
|
|
28
35
|
import { useLayoutEffectDebugger } from "../../hooks/useEffectDebugger";
|
|
@@ -47,7 +54,7 @@ export interface AsideProps
|
|
|
47
54
|
/**
|
|
48
55
|
* page title
|
|
49
56
|
*/
|
|
50
|
-
title?:
|
|
57
|
+
title?: ReactNode;
|
|
51
58
|
/**
|
|
52
59
|
* align inline-end
|
|
53
60
|
*/
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
24
|
import classNames from "classnames";
|
|
25
|
-
import { type ChildrenProp } from "../../types";
|
|
25
|
+
import { type ChildrenProp, type CssProp, type RefProp } from "../../types";
|
|
26
26
|
import { ErrorBoundary } from "../boundary/ErrorBoundary";
|
|
27
27
|
import classes from "./Section.module.css";
|
|
28
28
|
|
|
@@ -31,14 +31,20 @@ import classes from "./Section.module.css";
|
|
|
31
31
|
*/
|
|
32
32
|
export const Section = ({
|
|
33
33
|
children,
|
|
34
|
+
className,
|
|
34
35
|
dir,
|
|
35
|
-
|
|
36
|
+
ref,
|
|
37
|
+
}: ChildrenProp &
|
|
38
|
+
CssProp &
|
|
39
|
+
RefProp<HTMLDivElement> & { dir?: "ltr" | "rtl" }) => {
|
|
36
40
|
return (
|
|
37
41
|
<div
|
|
38
42
|
data-ref="section"
|
|
39
43
|
dir={dir}
|
|
44
|
+
ref={ref}
|
|
40
45
|
className={classNames(
|
|
41
46
|
classes.section,
|
|
47
|
+
className,
|
|
42
48
|
"grid area-content overflow-hidden",
|
|
43
49
|
)}
|
|
44
50
|
>
|
|
@@ -181,7 +181,6 @@ export const Alert = ({
|
|
|
181
181
|
|
|
182
182
|
<Title className="font-medium area-[title]">{title}</Title>
|
|
183
183
|
<p className="area-[message] py-4">{message}</p>
|
|
184
|
-
<div className="area-[message]">{message}</div>
|
|
185
184
|
<div className="flex gap-1 justify-center flex-nowrap pt-2 area-[actions]">
|
|
186
185
|
<div
|
|
187
186
|
className="contents"
|
package/src/types/index.ts
CHANGED
|
@@ -145,7 +145,10 @@ export interface RefProp<T = HTMLElement> {
|
|
|
145
145
|
/* *********** */
|
|
146
146
|
|
|
147
147
|
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type
|
|
148
|
-
export type CallbackReturn<T = unknown> =
|
|
148
|
+
export type CallbackReturn<T = unknown> =
|
|
149
|
+
| undefined
|
|
150
|
+
| T
|
|
151
|
+
| Promise<T | undefined>;
|
|
149
152
|
|
|
150
153
|
export type ReactTag = keyof JSX.IntrinsicElements | JSXElementConstructor<any>;
|
|
151
154
|
|
|
@@ -155,7 +158,7 @@ export type PropsOf<AsTag extends ReactTag> = AsTag extends React.ElementType
|
|
|
155
158
|
|
|
156
159
|
export type PolymorphicProps<AsTag extends ReactTag> = Omit<
|
|
157
160
|
PropsOf<AsTag>,
|
|
158
|
-
"children" | "as" | "className"
|
|
161
|
+
"children" | "as" | "className" | "onClick"
|
|
159
162
|
> & {
|
|
160
163
|
/**
|
|
161
164
|
* The component used for the root node.
|
package/src/typography/Abbr.tsx
CHANGED
|
@@ -26,7 +26,7 @@ import classNames from "classnames";
|
|
|
26
26
|
import { Fragment, useCallback, useMemo } from "react";
|
|
27
27
|
import { useMemoDebugger } from "../hooks/useEffectDebugger";
|
|
28
28
|
import { Tooltip, getTooltipProps } from "../overlays/tooltip/Tooltip";
|
|
29
|
-
import { type ChildProp, type ColorType } from "../types";
|
|
29
|
+
import { type ChildProp, type ColorType, type CssProp } from "../types";
|
|
30
30
|
import { getColor, getColorClass } from "../utils";
|
|
31
31
|
import classes from "./Typography.module.css";
|
|
32
32
|
|
|
@@ -64,7 +64,7 @@ const AbbrText = ({ color, children, tooltip, content }: AbbrTextProps) => {
|
|
|
64
64
|
);
|
|
65
65
|
};
|
|
66
66
|
|
|
67
|
-
export interface AbbrProps extends ChildProp<string
|
|
67
|
+
export interface AbbrProps extends ChildProp<string>, CssProp {
|
|
68
68
|
/**
|
|
69
69
|
* content to copy using the tooltip copy action
|
|
70
70
|
*/
|
|
@@ -87,6 +87,7 @@ export interface AbbrProps extends ChildProp<string> {
|
|
|
87
87
|
export const Abbr = ({
|
|
88
88
|
children,
|
|
89
89
|
abbr,
|
|
90
|
+
className,
|
|
90
91
|
renderer,
|
|
91
92
|
copyContent = "text",
|
|
92
93
|
}: AbbrProps) => {
|
|
@@ -148,5 +149,5 @@ export const Abbr = ({
|
|
|
148
149
|
);
|
|
149
150
|
|
|
150
151
|
/** ***************** component *******************/
|
|
151
|
-
return <span>{inner}</span>;
|
|
152
|
+
return <span className={className}>{inner}</span>;
|
|
152
153
|
};
|
package/src/typography/Link.tsx
CHANGED
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
24
|
import classNames from "classnames";
|
|
25
|
+
import { type MouseEventHandler } from "react";
|
|
25
26
|
import { useMemoDebugger } from "../hooks/useEffectDebugger";
|
|
26
27
|
import {
|
|
27
28
|
type AriaProps,
|
|
@@ -52,6 +53,8 @@ export interface LinkProps extends ChildrenProp, CssProp, RefProp, AriaProps {
|
|
|
52
53
|
* font family
|
|
53
54
|
*/
|
|
54
55
|
family?: "sans" | "serif" | "mono";
|
|
56
|
+
|
|
57
|
+
onClick?: MouseEventHandler;
|
|
55
58
|
}
|
|
56
59
|
|
|
57
60
|
/**
|