@react-fabric/core 1.0.0-beta.48 → 1.0.0-beta.49
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/_divider.css +11 -5
- package/dist/cjs/components/callout/Callout.js +1 -0
- package/dist/cjs/components/collapsable/Collapsable.js +2 -2
- package/dist/cjs/components/divider/Divider.js +7 -6
- package/dist/cjs/components/icon/Icon.js +3 -2
- package/dist/cjs/components/navigator/Navigator.js +15 -9
- package/dist/esm/components/callout/Callout.js +1 -0
- package/dist/esm/components/collapsable/Collapsable.js +2 -2
- package/dist/esm/components/divider/Divider.js +7 -6
- package/dist/esm/components/icon/Icon.js +3 -2
- package/dist/esm/components/navigator/Navigator.js +15 -9
- package/dist/types/components/callout/Callout.d.ts +1 -1
- package/dist/types/components/divider/Divider.d.ts +5 -5
- package/dist/types/components/icon/Icon.d.ts +2 -1
- package/dist/types/components/navigator/Navigator.d.ts +4 -1
- package/package.json +3 -3
- package/src/components/callout/Callout.tsx +2 -1
- package/src/components/collapsable/Collapsable.tsx +2 -2
- package/src/components/divider/Divider.tsx +10 -8
- package/src/components/icon/Icon.tsx +3 -0
- package/src/components/navigator/Navigator.tsx +21 -6
|
@@ -22,11 +22,17 @@
|
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
24
|
@layer components {
|
|
25
|
-
.fabric-divider
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
.fabric-divider {
|
|
26
|
+
hr {
|
|
27
|
+
margin: 0;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.fabric-divider-label--vertical {
|
|
31
|
+
padding-inline: 0.25rem;
|
|
32
|
+
}
|
|
28
33
|
|
|
29
|
-
|
|
30
|
-
|
|
34
|
+
.fabric-divider-label--horizontal {
|
|
35
|
+
padding-block: 0.25rem;
|
|
36
|
+
}
|
|
31
37
|
}
|
|
32
38
|
}
|
|
@@ -11,6 +11,7 @@ var _excluded = ["children", "color", "legend", "title", "icon", "border", "onCl
|
|
|
11
11
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
12
12
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
13
13
|
var colors = {
|
|
14
|
+
none: "bg-base text-tint-900 border-tint-100",
|
|
14
15
|
tint: "bg-tint-50/50 text-tint-800 border-tint-300",
|
|
15
16
|
primary: "bg-primary-50/50 text-primary-800 border-primary-300",
|
|
16
17
|
accent: "bg-accent-50/50 text-accent-800 border-accent-300",
|
|
@@ -62,7 +62,7 @@ var Collapsable = function Collapsable(_ref) {
|
|
|
62
62
|
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
63
63
|
role: "none",
|
|
64
64
|
ref: headRef,
|
|
65
|
-
className: classNames("fabric-collapsableHead", "flex gap-1 flex-nowrap py-2 font-medium cursor-pointer items-center select-none hover:opacity-70", headerClassName, stickyHeader && "bg-base sticky top-0
|
|
65
|
+
className: classNames("fabric-collapsableHead", "flex gap-1 flex-nowrap py-2 font-medium cursor-pointer items-center select-none hover:opacity-70", headerClassName, stickyHeader && "bg-base sticky top-0 py-1 z-10", iconAlign === "end" ? "flex-row-reverse" : "flex-row"),
|
|
66
66
|
onClick: function onClick() {
|
|
67
67
|
return !disabled && setOpenState(!openState);
|
|
68
68
|
},
|
|
@@ -71,7 +71,7 @@ var Collapsable = function Collapsable(_ref) {
|
|
|
71
71
|
icon: openState ? iconOpen : iconClosed,
|
|
72
72
|
rtlFlip: true
|
|
73
73
|
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
74
|
-
className: "flex-1
|
|
74
|
+
className: "flex-1",
|
|
75
75
|
children: head
|
|
76
76
|
})]
|
|
77
77
|
}), openState && /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
@@ -34,9 +34,9 @@ var Divider = function Divider(_ref) {
|
|
|
34
34
|
_ref$color = _ref.color,
|
|
35
35
|
color = _ref$color === void 0 ? "tint-300" : _ref$color,
|
|
36
36
|
vertical = _ref.vertical,
|
|
37
|
-
labelClassName = _ref.labelClassName
|
|
38
|
-
_ref.
|
|
39
|
-
|
|
37
|
+
labelClassName = _ref.labelClassName,
|
|
38
|
+
style = _ref.style,
|
|
39
|
+
_ref$align = _ref.align,
|
|
40
40
|
align = _ref$align === void 0 ? "start" : _ref$align,
|
|
41
41
|
className = _ref.className;
|
|
42
42
|
var Rule = react.useCallback(function (_ref2) {
|
|
@@ -45,17 +45,18 @@ var Divider = function Divider(_ref) {
|
|
|
45
45
|
return /*#__PURE__*/jsxRuntime.jsx("hr", {
|
|
46
46
|
style: {
|
|
47
47
|
flex: flex,
|
|
48
|
-
borderColor: getColor.getColor(color)
|
|
48
|
+
borderColor: getColor.getColor(color),
|
|
49
|
+
borderStyle: style
|
|
49
50
|
},
|
|
50
51
|
className: classNames(className, vertical && "vertical", !flex && "self-stretch", vertical ? "fabric-divider--vertical" : "fabric-divider--horizontal")
|
|
51
52
|
});
|
|
52
53
|
}, [color, vertical]);
|
|
53
54
|
return children ? /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
54
|
-
className: classNames("flex flex-nowrap items-center", vertical && "flex-col", className),
|
|
55
|
+
className: classNames("flex flex-nowrap items-center fabric-divider", vertical && "flex-col", className),
|
|
55
56
|
children: [/*#__PURE__*/jsxRuntime.jsx(Rule, {
|
|
56
57
|
flex: align === "start" ? "0 0 1rem" : "1 1 1em"
|
|
57
58
|
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
58
|
-
className: classNames("px-2 whitespace-nowrap", vertical ? "fabric-divider--vertical" : "fabric-divider--horizontal", labelClassName, "rounded-full text-[0.75em]", vertical && "origin-center -rotate-90 z-1"),
|
|
59
|
+
className: classNames("px-2 whitespace-nowrap", vertical ? "fabric-divider-label--vertical" : "fabric-divider-label--horizontal", labelClassName, "rounded-full text-[0.75em]", vertical && "origin-center -rotate-90 z-1"),
|
|
59
60
|
children: children
|
|
60
61
|
}), /*#__PURE__*/jsxRuntime.jsx(Rule, {
|
|
61
62
|
flex: align === "end" ? "0 0 1rem" : "1 1 1em"
|
|
@@ -8,7 +8,7 @@ var react = require('react');
|
|
|
8
8
|
var jsxRuntime = require('react/jsx-runtime');
|
|
9
9
|
var getColor = require('../../utils/getColor.js');
|
|
10
10
|
|
|
11
|
-
var _excluded = ["ref", "icon", "bg", "color", "size", "rtlFlip", "animate", "rounded", "viewBox", "className", "onClick"];
|
|
11
|
+
var _excluded = ["ref", "icon", "bg", "color", "size", "rtlFlip", "animate", "rounded", "disabled", "viewBox", "className", "onClick"];
|
|
12
12
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
13
13
|
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; }
|
|
14
14
|
var SvgTextSize = ["", ".875em", ".525em", ".35em", ".25em"];
|
|
@@ -33,6 +33,7 @@ var Icon = function Icon(_ref) {
|
|
|
33
33
|
rtlFlip = _ref.rtlFlip,
|
|
34
34
|
animate = _ref.animate,
|
|
35
35
|
rounded = _ref.rounded,
|
|
36
|
+
disabled = _ref.disabled,
|
|
36
37
|
_ref$viewBox = _ref.viewBox,
|
|
37
38
|
viewBox = _ref$viewBox === void 0 ? "0 0 24 24" : _ref$viewBox,
|
|
38
39
|
className = _ref.className,
|
|
@@ -94,7 +95,7 @@ var Icon = function Icon(_ref) {
|
|
|
94
95
|
ref: ref
|
|
95
96
|
}, rest), {}, {
|
|
96
97
|
role: "presentation",
|
|
97
|
-
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), className),
|
|
98
|
+
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),
|
|
98
99
|
onClick: onClick,
|
|
99
100
|
"data-flip": rtlFlip,
|
|
100
101
|
style: styles,
|
|
@@ -7,9 +7,10 @@ var react = require('react');
|
|
|
7
7
|
var HotKey = require('../../hotkeys/HotKey.js');
|
|
8
8
|
var icons = require('../../types/icons.js');
|
|
9
9
|
var Icon = require('../icon/Icon.js');
|
|
10
|
+
var utilities = require('@react-fabric/utilities');
|
|
10
11
|
var jsxRuntime = require('react/jsx-runtime');
|
|
11
12
|
|
|
12
|
-
var _excluded = ["className", "onNavigate", "color", "children"];
|
|
13
|
+
var _excluded = ["className", "onNavigate", "color", "children", "length", "current", "disableKeyHandlers"];
|
|
13
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; }
|
|
14
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; }
|
|
15
16
|
var Navigator = function Navigator(_ref) {
|
|
@@ -17,21 +18,24 @@ var Navigator = function Navigator(_ref) {
|
|
|
17
18
|
onNavigate = _ref.onNavigate,
|
|
18
19
|
color = _ref.color,
|
|
19
20
|
children = _ref.children,
|
|
21
|
+
length = _ref.length,
|
|
22
|
+
current = _ref.current,
|
|
23
|
+
disableKeyHandlers = _ref.disableKeyHandlers,
|
|
20
24
|
aria = _objectWithoutProperties(_ref, _excluded);
|
|
21
25
|
var navPrev = react.useCallback(function () {
|
|
22
|
-
return onNavigate(-1);
|
|
23
|
-
}, [onNavigate]);
|
|
26
|
+
return (utilities.isEmpty(current) || current !== 0) && onNavigate(-1);
|
|
27
|
+
}, [onNavigate, current]);
|
|
24
28
|
var navNext = react.useCallback(function () {
|
|
25
|
-
return onNavigate(+1);
|
|
26
|
-
}, [onNavigate]);
|
|
29
|
+
return (utilities.isEmpty(current) || current + 1 < (length !== null && length !== void 0 ? length : 0)) && onNavigate(+1);
|
|
30
|
+
}, [onNavigate, current, length]);
|
|
27
31
|
return /*#__PURE__*/jsxRuntime.jsxs("div", _objectSpread(_objectSpread({
|
|
28
32
|
"data-ref": "navigator",
|
|
29
33
|
className: classNames(className, "inline-flex items-center leading-none")
|
|
30
34
|
}, aria), {}, {
|
|
31
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(HotKey.HotKey, {
|
|
35
|
+
children: [!disableKeyHandlers && /*#__PURE__*/jsxRuntime.jsx(HotKey.HotKey, {
|
|
32
36
|
keyCombo: "left",
|
|
33
37
|
handler: navPrev
|
|
34
|
-
}), /*#__PURE__*/jsxRuntime.jsx(HotKey.HotKey, {
|
|
38
|
+
}), !disableKeyHandlers && /*#__PURE__*/jsxRuntime.jsx(HotKey.HotKey, {
|
|
35
39
|
keyCombo: "right",
|
|
36
40
|
handler: navNext
|
|
37
41
|
}), /*#__PURE__*/jsxRuntime.jsx(Icon.Icon, {
|
|
@@ -41,8 +45,9 @@ var Navigator = function Navigator(_ref) {
|
|
|
41
45
|
"aria-label": "previous",
|
|
42
46
|
"data-ref": "previous",
|
|
43
47
|
icon: icons.CoreIcons.chevronLeft,
|
|
48
|
+
disabled: !utilities.isEmpty(current) && current === 0,
|
|
44
49
|
onClick: function onClick(e) {
|
|
45
|
-
return [e.stopPropagation(),
|
|
50
|
+
return [e.stopPropagation(), navPrev()];
|
|
46
51
|
}
|
|
47
52
|
}), children, /*#__PURE__*/jsxRuntime.jsx(Icon.Icon, {
|
|
48
53
|
rtlFlip: true,
|
|
@@ -51,8 +56,9 @@ var Navigator = function Navigator(_ref) {
|
|
|
51
56
|
"aria-label": "next",
|
|
52
57
|
"data-ref": "next",
|
|
53
58
|
icon: icons.CoreIcons.chevronRight,
|
|
59
|
+
disabled: !utilities.isEmpty(current) && current + 1 === length,
|
|
54
60
|
onClick: function onClick(e) {
|
|
55
|
-
return [e.stopPropagation(),
|
|
61
|
+
return [e.stopPropagation(), navNext()];
|
|
56
62
|
}
|
|
57
63
|
})]
|
|
58
64
|
}));
|
|
@@ -11,6 +11,7 @@ var _excluded = ["children", "color", "legend", "title", "icon", "border", "onCl
|
|
|
11
11
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
12
12
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
13
13
|
var colors = {
|
|
14
|
+
none: "bg-base text-tint-900 border-tint-100",
|
|
14
15
|
tint: "bg-tint-50/50 text-tint-800 border-tint-300",
|
|
15
16
|
primary: "bg-primary-50/50 text-primary-800 border-primary-300",
|
|
16
17
|
accent: "bg-accent-50/50 text-accent-800 border-accent-300",
|
|
@@ -62,7 +62,7 @@ var Collapsable = function Collapsable(_ref) {
|
|
|
62
62
|
children: [/*#__PURE__*/jsxs("div", {
|
|
63
63
|
role: "none",
|
|
64
64
|
ref: headRef,
|
|
65
|
-
className: classNames("fabric-collapsableHead", "flex gap-1 flex-nowrap py-2 font-medium cursor-pointer items-center select-none hover:opacity-70", headerClassName, stickyHeader && "bg-base sticky top-0
|
|
65
|
+
className: classNames("fabric-collapsableHead", "flex gap-1 flex-nowrap py-2 font-medium cursor-pointer items-center select-none hover:opacity-70", headerClassName, stickyHeader && "bg-base sticky top-0 py-1 z-10", iconAlign === "end" ? "flex-row-reverse" : "flex-row"),
|
|
66
66
|
onClick: function onClick() {
|
|
67
67
|
return !disabled && setOpenState(!openState);
|
|
68
68
|
},
|
|
@@ -71,7 +71,7 @@ var Collapsable = function Collapsable(_ref) {
|
|
|
71
71
|
icon: openState ? iconOpen : iconClosed,
|
|
72
72
|
rtlFlip: true
|
|
73
73
|
}), /*#__PURE__*/jsx("div", {
|
|
74
|
-
className: "flex-1
|
|
74
|
+
className: "flex-1",
|
|
75
75
|
children: head
|
|
76
76
|
})]
|
|
77
77
|
}), openState && /*#__PURE__*/jsx("div", {
|
|
@@ -34,9 +34,9 @@ var Divider = function Divider(_ref) {
|
|
|
34
34
|
_ref$color = _ref.color,
|
|
35
35
|
color = _ref$color === void 0 ? "tint-300" : _ref$color,
|
|
36
36
|
vertical = _ref.vertical,
|
|
37
|
-
labelClassName = _ref.labelClassName
|
|
38
|
-
_ref.
|
|
39
|
-
|
|
37
|
+
labelClassName = _ref.labelClassName,
|
|
38
|
+
style = _ref.style,
|
|
39
|
+
_ref$align = _ref.align,
|
|
40
40
|
align = _ref$align === void 0 ? "start" : _ref$align,
|
|
41
41
|
className = _ref.className;
|
|
42
42
|
var Rule = useCallback(function (_ref2) {
|
|
@@ -45,17 +45,18 @@ var Divider = function Divider(_ref) {
|
|
|
45
45
|
return /*#__PURE__*/jsx("hr", {
|
|
46
46
|
style: {
|
|
47
47
|
flex: flex,
|
|
48
|
-
borderColor: getColor(color)
|
|
48
|
+
borderColor: getColor(color),
|
|
49
|
+
borderStyle: style
|
|
49
50
|
},
|
|
50
51
|
className: classNames(className, vertical && "vertical", !flex && "self-stretch", vertical ? "fabric-divider--vertical" : "fabric-divider--horizontal")
|
|
51
52
|
});
|
|
52
53
|
}, [color, vertical]);
|
|
53
54
|
return children ? /*#__PURE__*/jsxs("div", {
|
|
54
|
-
className: classNames("flex flex-nowrap items-center", vertical && "flex-col", className),
|
|
55
|
+
className: classNames("flex flex-nowrap items-center fabric-divider", vertical && "flex-col", className),
|
|
55
56
|
children: [/*#__PURE__*/jsx(Rule, {
|
|
56
57
|
flex: align === "start" ? "0 0 1rem" : "1 1 1em"
|
|
57
58
|
}), /*#__PURE__*/jsx("div", {
|
|
58
|
-
className: classNames("px-2 whitespace-nowrap", vertical ? "fabric-divider--vertical" : "fabric-divider--horizontal", labelClassName, "rounded-full text-[0.75em]", vertical && "origin-center -rotate-90 z-1"),
|
|
59
|
+
className: classNames("px-2 whitespace-nowrap", vertical ? "fabric-divider-label--vertical" : "fabric-divider-label--horizontal", labelClassName, "rounded-full text-[0.75em]", vertical && "origin-center -rotate-90 z-1"),
|
|
59
60
|
children: children
|
|
60
61
|
}), /*#__PURE__*/jsx(Rule, {
|
|
61
62
|
flex: align === "end" ? "0 0 1rem" : "1 1 1em"
|
|
@@ -8,7 +8,7 @@ import { useMemo } from 'react';
|
|
|
8
8
|
import { jsx } from 'react/jsx-runtime';
|
|
9
9
|
import { getColor } from '../../utils/getColor.js';
|
|
10
10
|
|
|
11
|
-
var _excluded = ["ref", "icon", "bg", "color", "size", "rtlFlip", "animate", "rounded", "viewBox", "className", "onClick"];
|
|
11
|
+
var _excluded = ["ref", "icon", "bg", "color", "size", "rtlFlip", "animate", "rounded", "disabled", "viewBox", "className", "onClick"];
|
|
12
12
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
13
13
|
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; }
|
|
14
14
|
var SvgTextSize = ["", ".875em", ".525em", ".35em", ".25em"];
|
|
@@ -33,6 +33,7 @@ var Icon = function Icon(_ref) {
|
|
|
33
33
|
rtlFlip = _ref.rtlFlip,
|
|
34
34
|
animate = _ref.animate,
|
|
35
35
|
rounded = _ref.rounded,
|
|
36
|
+
disabled = _ref.disabled,
|
|
36
37
|
_ref$viewBox = _ref.viewBox,
|
|
37
38
|
viewBox = _ref$viewBox === void 0 ? "0 0 24 24" : _ref$viewBox,
|
|
38
39
|
className = _ref.className,
|
|
@@ -94,7 +95,7 @@ var Icon = function Icon(_ref) {
|
|
|
94
95
|
ref: ref
|
|
95
96
|
}, rest), {}, {
|
|
96
97
|
role: "presentation",
|
|
97
|
-
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), className),
|
|
98
|
+
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),
|
|
98
99
|
onClick: onClick,
|
|
99
100
|
"data-flip": rtlFlip,
|
|
100
101
|
style: styles,
|
|
@@ -7,9 +7,10 @@ import { useCallback } from 'react';
|
|
|
7
7
|
import { HotKey } from '../../hotkeys/HotKey.js';
|
|
8
8
|
import { CoreIcons } from '../../types/icons.js';
|
|
9
9
|
import { Icon } from '../icon/Icon.js';
|
|
10
|
+
import { isEmpty } from '@react-fabric/utilities';
|
|
10
11
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
11
12
|
|
|
12
|
-
var _excluded = ["className", "onNavigate", "color", "children"];
|
|
13
|
+
var _excluded = ["className", "onNavigate", "color", "children", "length", "current", "disableKeyHandlers"];
|
|
13
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; }
|
|
14
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; }
|
|
15
16
|
var Navigator = function Navigator(_ref) {
|
|
@@ -17,21 +18,24 @@ var Navigator = function Navigator(_ref) {
|
|
|
17
18
|
onNavigate = _ref.onNavigate,
|
|
18
19
|
color = _ref.color,
|
|
19
20
|
children = _ref.children,
|
|
21
|
+
length = _ref.length,
|
|
22
|
+
current = _ref.current,
|
|
23
|
+
disableKeyHandlers = _ref.disableKeyHandlers,
|
|
20
24
|
aria = _objectWithoutProperties(_ref, _excluded);
|
|
21
25
|
var navPrev = useCallback(function () {
|
|
22
|
-
return onNavigate(-1);
|
|
23
|
-
}, [onNavigate]);
|
|
26
|
+
return (isEmpty(current) || current !== 0) && onNavigate(-1);
|
|
27
|
+
}, [onNavigate, current]);
|
|
24
28
|
var navNext = useCallback(function () {
|
|
25
|
-
return onNavigate(+1);
|
|
26
|
-
}, [onNavigate]);
|
|
29
|
+
return (isEmpty(current) || current + 1 < (length !== null && length !== void 0 ? length : 0)) && onNavigate(+1);
|
|
30
|
+
}, [onNavigate, current, length]);
|
|
27
31
|
return /*#__PURE__*/jsxs("div", _objectSpread(_objectSpread({
|
|
28
32
|
"data-ref": "navigator",
|
|
29
33
|
className: classNames(className, "inline-flex items-center leading-none")
|
|
30
34
|
}, aria), {}, {
|
|
31
|
-
children: [/*#__PURE__*/jsx(HotKey, {
|
|
35
|
+
children: [!disableKeyHandlers && /*#__PURE__*/jsx(HotKey, {
|
|
32
36
|
keyCombo: "left",
|
|
33
37
|
handler: navPrev
|
|
34
|
-
}), /*#__PURE__*/jsx(HotKey, {
|
|
38
|
+
}), !disableKeyHandlers && /*#__PURE__*/jsx(HotKey, {
|
|
35
39
|
keyCombo: "right",
|
|
36
40
|
handler: navNext
|
|
37
41
|
}), /*#__PURE__*/jsx(Icon, {
|
|
@@ -41,8 +45,9 @@ var Navigator = function Navigator(_ref) {
|
|
|
41
45
|
"aria-label": "previous",
|
|
42
46
|
"data-ref": "previous",
|
|
43
47
|
icon: CoreIcons.chevronLeft,
|
|
48
|
+
disabled: !isEmpty(current) && current === 0,
|
|
44
49
|
onClick: function onClick(e) {
|
|
45
|
-
return [e.stopPropagation(),
|
|
50
|
+
return [e.stopPropagation(), navPrev()];
|
|
46
51
|
}
|
|
47
52
|
}), children, /*#__PURE__*/jsx(Icon, {
|
|
48
53
|
rtlFlip: true,
|
|
@@ -51,8 +56,9 @@ var Navigator = function Navigator(_ref) {
|
|
|
51
56
|
"aria-label": "next",
|
|
52
57
|
"data-ref": "next",
|
|
53
58
|
icon: CoreIcons.chevronRight,
|
|
59
|
+
disabled: !isEmpty(current) && current + 1 === length,
|
|
54
60
|
onClick: function onClick(e) {
|
|
55
|
-
return [e.stopPropagation(),
|
|
61
|
+
return [e.stopPropagation(), navNext()];
|
|
56
62
|
}
|
|
57
63
|
})]
|
|
58
64
|
}));
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import { type ChildProp, type ColorType, type CssProp, type PaletteType } from "../../types";
|
|
2
2
|
export interface DividerProps extends CssProp, Partial<ChildProp> {
|
|
3
|
-
/**
|
|
4
|
-
* apply text bg
|
|
5
|
-
*/
|
|
6
|
-
fill?: boolean;
|
|
7
3
|
/**
|
|
8
4
|
* vertical rule
|
|
9
5
|
*/
|
|
@@ -20,5 +16,9 @@ export interface DividerProps extends CssProp, Partial<ChildProp> {
|
|
|
20
16
|
* text alignment
|
|
21
17
|
*/
|
|
22
18
|
align?: "start" | "end" | "center";
|
|
19
|
+
/**
|
|
20
|
+
* divider style
|
|
21
|
+
*/
|
|
22
|
+
style?: "solid" | "dashed" | "dotted";
|
|
23
23
|
}
|
|
24
|
-
export declare const Divider: ({ children, color, vertical, labelClassName,
|
|
24
|
+
export declare const Divider: ({ children, color, vertical, labelClassName, style, align, className, }: DividerProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -33,6 +33,7 @@ export interface IconProps extends CssProp, AriaProps, RefProp, TestProps {
|
|
|
33
33
|
* apply animation
|
|
34
34
|
*/
|
|
35
35
|
animate?: "spin" | "pulse" | "bounce";
|
|
36
|
+
disabled?: boolean;
|
|
36
37
|
/**
|
|
37
38
|
* click handler
|
|
38
39
|
*/
|
|
@@ -41,4 +42,4 @@ export interface IconProps extends CssProp, AriaProps, RefProp, TestProps {
|
|
|
41
42
|
/**
|
|
42
43
|
* An icon is a display component for svg icon path / image
|
|
43
44
|
*/
|
|
44
|
-
export declare const Icon: ({ ref, icon, bg, color, size, rtlFlip, animate, rounded, viewBox, className, onClick, ...rest }: IconProps) => import("react/jsx-runtime").JSX.Element;
|
|
45
|
+
export declare const Icon: ({ ref, icon, bg, color, size, rtlFlip, animate, rounded, disabled, viewBox, className, onClick, ...rest }: IconProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { type AriaProps, type ChildProp, type ColorType, type CssProp, type PaletteType, type TestProps } from "../../types";
|
|
2
2
|
export interface NavigatorProps extends CssProp, AriaProps, TestProps, Partial<ChildProp> {
|
|
3
|
+
length?: number;
|
|
4
|
+
current?: number;
|
|
5
|
+
disableKeyHandlers?: boolean;
|
|
3
6
|
/**
|
|
4
7
|
* navigator button color
|
|
5
8
|
*/
|
|
@@ -9,4 +12,4 @@ export interface NavigatorProps extends CssProp, AriaProps, TestProps, Partial<C
|
|
|
9
12
|
*/
|
|
10
13
|
onNavigate: (dir: -1 | 1) => void;
|
|
11
14
|
}
|
|
12
|
-
export declare const Navigator: ({ className, onNavigate, color, children, ...aria }: NavigatorProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export declare const Navigator: ({ className, onNavigate, color, children, length, current, disableKeyHandlers, ...aria }: NavigatorProps) => 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.49",
|
|
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.27.9",
|
|
39
|
-
"@react-fabric/utilities": "^1.0.0-beta.
|
|
39
|
+
"@react-fabric/utilities": "^1.0.0-beta.49",
|
|
40
40
|
"@tailwindcss/postcss": "~4.0.14",
|
|
41
41
|
"boring-avatars": "^1.11.2",
|
|
42
42
|
"classnames": "^2.5.1",
|
|
@@ -54,5 +54,5 @@
|
|
|
54
54
|
"node": ">=18.12.0",
|
|
55
55
|
"npm": ">=8.19.0"
|
|
56
56
|
},
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "29b3ed65e9f9687d738dd7c6facdb9fedafb4219"
|
|
58
58
|
}
|
|
@@ -40,7 +40,7 @@ export interface CalloutProps
|
|
|
40
40
|
/**
|
|
41
41
|
* callout color
|
|
42
42
|
*/
|
|
43
|
-
color?: ColorState;
|
|
43
|
+
color?: ColorState | "none";
|
|
44
44
|
/**
|
|
45
45
|
* legend title
|
|
46
46
|
*/
|
|
@@ -64,6 +64,7 @@ export interface CalloutProps
|
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
const colors = {
|
|
67
|
+
none: "bg-base text-tint-900 border-tint-100",
|
|
67
68
|
tint: "bg-tint-50/50 text-tint-800 border-tint-300",
|
|
68
69
|
primary: "bg-primary-50/50 text-primary-800 border-primary-300",
|
|
69
70
|
accent: "bg-accent-50/50 text-accent-800 border-accent-300",
|
|
@@ -142,13 +142,13 @@ export const Collapsable = ({
|
|
|
142
142
|
"fabric-collapsableHead",
|
|
143
143
|
"flex gap-1 flex-nowrap py-2 font-medium cursor-pointer items-center select-none hover:opacity-70",
|
|
144
144
|
headerClassName,
|
|
145
|
-
stickyHeader && "bg-base sticky top-0
|
|
145
|
+
stickyHeader && "bg-base sticky top-0 py-1 z-10",
|
|
146
146
|
iconAlign === "end" ? "flex-row-reverse" : "flex-row",
|
|
147
147
|
)}
|
|
148
148
|
onClick={() => !disabled && setOpenState(!openState)}
|
|
149
149
|
>
|
|
150
150
|
<Icon size="1.125em" icon={openState ? iconOpen : iconClosed} rtlFlip />
|
|
151
|
-
<div className="flex-1
|
|
151
|
+
<div className="flex-1">{head}</div>
|
|
152
152
|
</div>
|
|
153
153
|
{openState && (
|
|
154
154
|
<div
|
|
@@ -32,10 +32,6 @@ import {
|
|
|
32
32
|
import { getColor } from "../../utils";
|
|
33
33
|
|
|
34
34
|
export interface DividerProps extends CssProp, Partial<ChildProp> {
|
|
35
|
-
/**
|
|
36
|
-
* apply text bg
|
|
37
|
-
*/
|
|
38
|
-
fill?: boolean;
|
|
39
35
|
/**
|
|
40
36
|
* vertical rule
|
|
41
37
|
*/
|
|
@@ -52,6 +48,10 @@ export interface DividerProps extends CssProp, Partial<ChildProp> {
|
|
|
52
48
|
* text alignment
|
|
53
49
|
*/
|
|
54
50
|
align?: "start" | "end" | "center";
|
|
51
|
+
/**
|
|
52
|
+
* divider style
|
|
53
|
+
*/
|
|
54
|
+
style?: "solid" | "dashed" | "dotted";
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
export const Divider = ({
|
|
@@ -59,7 +59,7 @@ export const Divider = ({
|
|
|
59
59
|
color = "tint-300",
|
|
60
60
|
vertical,
|
|
61
61
|
labelClassName,
|
|
62
|
-
|
|
62
|
+
style,
|
|
63
63
|
align = "start",
|
|
64
64
|
className,
|
|
65
65
|
}: DividerProps) => {
|
|
@@ -67,7 +67,7 @@ export const Divider = ({
|
|
|
67
67
|
({ flex, className }: KeyValue) => {
|
|
68
68
|
return (
|
|
69
69
|
<hr
|
|
70
|
-
style={{ flex, borderColor: getColor(color) }}
|
|
70
|
+
style={{ flex, borderColor: getColor(color), borderStyle: style }}
|
|
71
71
|
className={classNames(
|
|
72
72
|
className,
|
|
73
73
|
vertical && "vertical",
|
|
@@ -85,7 +85,7 @@ export const Divider = ({
|
|
|
85
85
|
return children ? (
|
|
86
86
|
<div
|
|
87
87
|
className={classNames(
|
|
88
|
-
"flex flex-nowrap items-center",
|
|
88
|
+
"flex flex-nowrap items-center fabric-divider",
|
|
89
89
|
vertical && "flex-col",
|
|
90
90
|
className,
|
|
91
91
|
)}
|
|
@@ -94,7 +94,9 @@ export const Divider = ({
|
|
|
94
94
|
<div
|
|
95
95
|
className={classNames(
|
|
96
96
|
"px-2 whitespace-nowrap",
|
|
97
|
-
vertical
|
|
97
|
+
vertical
|
|
98
|
+
? "fabric-divider-label--vertical"
|
|
99
|
+
: "fabric-divider-label--horizontal",
|
|
98
100
|
labelClassName,
|
|
99
101
|
"rounded-full text-[0.75em]",
|
|
100
102
|
vertical && "origin-center -rotate-90 z-1",
|
|
@@ -68,6 +68,7 @@ export interface IconProps extends CssProp, AriaProps, RefProp, TestProps {
|
|
|
68
68
|
* apply animation
|
|
69
69
|
*/
|
|
70
70
|
animate?: "spin" | "pulse" | "bounce";
|
|
71
|
+
disabled?: boolean;
|
|
71
72
|
/**
|
|
72
73
|
* click handler
|
|
73
74
|
*/
|
|
@@ -95,6 +96,7 @@ export const Icon = ({
|
|
|
95
96
|
rtlFlip,
|
|
96
97
|
animate,
|
|
97
98
|
rounded,
|
|
99
|
+
disabled,
|
|
98
100
|
viewBox = "0 0 24 24",
|
|
99
101
|
className,
|
|
100
102
|
onClick,
|
|
@@ -162,6 +164,7 @@ export const Icon = ({
|
|
|
162
164
|
!rounded && "rounded",
|
|
163
165
|
rounded && "rounded-full",
|
|
164
166
|
animate && `animate-${animate}`,
|
|
167
|
+
!!onClick && disabled && "opacity-30 pointer-events-none",
|
|
165
168
|
className,
|
|
166
169
|
)}
|
|
167
170
|
onClick={onClick}
|
|
@@ -34,12 +34,16 @@ import {
|
|
|
34
34
|
} from "../../types";
|
|
35
35
|
import { CoreIcons } from "../../types/icons";
|
|
36
36
|
import { Icon } from "../icon/Icon";
|
|
37
|
+
import { isEmpty } from "@react-fabric/utilities";
|
|
37
38
|
|
|
38
39
|
export interface NavigatorProps
|
|
39
40
|
extends CssProp,
|
|
40
41
|
AriaProps,
|
|
41
42
|
TestProps,
|
|
42
43
|
Partial<ChildProp> {
|
|
44
|
+
length?: number;
|
|
45
|
+
current?: number;
|
|
46
|
+
disableKeyHandlers?: boolean;
|
|
43
47
|
/**
|
|
44
48
|
* navigator button color
|
|
45
49
|
*/
|
|
@@ -55,18 +59,27 @@ export const Navigator = ({
|
|
|
55
59
|
onNavigate,
|
|
56
60
|
color,
|
|
57
61
|
children,
|
|
62
|
+
length,
|
|
63
|
+
current,
|
|
64
|
+
disableKeyHandlers,
|
|
58
65
|
...aria
|
|
59
66
|
}: NavigatorProps) => {
|
|
60
|
-
const navPrev = useCallback(
|
|
61
|
-
|
|
67
|
+
const navPrev = useCallback(
|
|
68
|
+
() => (isEmpty(current) || current !== 0) && onNavigate(-1),
|
|
69
|
+
[onNavigate, current],
|
|
70
|
+
);
|
|
71
|
+
const navNext = useCallback(
|
|
72
|
+
() => (isEmpty(current) || current + 1 < (length ?? 0)) && onNavigate(+1),
|
|
73
|
+
[onNavigate, current, length],
|
|
74
|
+
);
|
|
62
75
|
return (
|
|
63
76
|
<div
|
|
64
77
|
data-ref="navigator"
|
|
65
78
|
className={classNames(className, "inline-flex items-center leading-none")}
|
|
66
79
|
{...aria}
|
|
67
80
|
>
|
|
68
|
-
<HotKey keyCombo="left" handler={navPrev} />
|
|
69
|
-
<HotKey keyCombo="right" handler={navNext} />
|
|
81
|
+
{!disableKeyHandlers && <HotKey keyCombo="left" handler={navPrev} />}
|
|
82
|
+
{!disableKeyHandlers && <HotKey keyCombo="right" handler={navNext} />}
|
|
70
83
|
<Icon
|
|
71
84
|
rtlFlip
|
|
72
85
|
color={color}
|
|
@@ -74,7 +87,8 @@ export const Navigator = ({
|
|
|
74
87
|
aria-label="previous"
|
|
75
88
|
data-ref="previous"
|
|
76
89
|
icon={CoreIcons.chevronLeft}
|
|
77
|
-
|
|
90
|
+
disabled={!isEmpty(current) && current === 0}
|
|
91
|
+
onClick={(e) => [e.stopPropagation(), navPrev()]}
|
|
78
92
|
/>
|
|
79
93
|
{children}
|
|
80
94
|
<Icon
|
|
@@ -84,7 +98,8 @@ export const Navigator = ({
|
|
|
84
98
|
aria-label="next"
|
|
85
99
|
data-ref="next"
|
|
86
100
|
icon={CoreIcons.chevronRight}
|
|
87
|
-
|
|
101
|
+
disabled={!isEmpty(current) && current + 1 === length}
|
|
102
|
+
onClick={(e) => [e.stopPropagation(), navNext()]}
|
|
88
103
|
/>
|
|
89
104
|
</div>
|
|
90
105
|
);
|