@react-fabric/core 1.0.0-beta.61 → 1.0.0-beta.63
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/_animations.css +7 -11
- package/css/components/_avatar.css +5 -5
- package/css/components/_badge.css +2 -1
- package/css/components/_breadcrumbs.css +7 -5
- package/css/components/_button.css +49 -9
- package/css/components/_card.css +9 -17
- package/css/components/_chip.css +0 -4
- package/css/components/_dropdown.css +1 -0
- package/css/components/_flyout.css +1 -1
- package/css/components/_media.css +2 -14
- package/css/components/_menu.css +1 -1
- package/css/components/_modal.css +3 -3
- package/css/components/_progress.css +1 -1
- package/css/components/_stepper.css +2 -1
- package/css/components/_tabPanel.css +4 -4
- package/css/core/_aside.css +3 -3
- package/css/core/_errorboundary.css +2 -10
- package/css/core/_page.css +1 -1
- package/css/core/_responsive.css +8 -0
- package/css/core/_theme.css +1 -1
- package/css/core/_viewport.css +1 -5
- package/css/reset/_reset.css +42 -43
- package/css/reset/_theme.css +214 -201
- package/css/styles.css +5 -0
- package/css/theme/_colors.css +14 -0
- package/css/theme/_utilities.css +103 -225
- package/css/theme/index.css +4 -6
- package/dist/cjs/components/actionLabel/ActionLabel.js +1 -1
- package/dist/cjs/components/animations/Animations.js +7 -7
- package/dist/cjs/components/avatar/Avatar.js +1 -1
- package/dist/cjs/components/avatar/AvatarGroup.js +1 -1
- package/dist/cjs/components/badge/Badge.js +5 -27
- package/dist/cjs/components/breadcrumbs/Breadcrumbs.js +1 -1
- package/dist/cjs/components/button/Button.js +8 -6
- package/dist/cjs/components/button/ButtonGroup.js +1 -1
- package/dist/cjs/components/button/ConfirmButton.js +7 -6
- package/dist/cjs/components/button/ToggleButtonGroup.js +1 -1
- package/dist/cjs/components/callout/Callout.js +8 -7
- package/dist/cjs/components/card/Card.js +3 -3
- package/dist/cjs/components/card/CardCover.js +1 -1
- package/dist/cjs/components/card/FlipContent.js +2 -2
- package/dist/cjs/components/chip/Chip.js +8 -7
- package/dist/cjs/components/collapsable/Collapsable.js +4 -3
- package/dist/cjs/components/divider/Divider.js +2 -2
- package/dist/cjs/components/dropdown/Dropdown.js +28 -14
- package/dist/cjs/components/empty/EmptyContent.js +1 -1
- package/dist/cjs/components/icon/Icon.js +26 -40
- package/dist/cjs/components/media/Media.js +13 -13
- package/dist/cjs/components/menu/ContextMenu.js +23 -13
- package/dist/cjs/components/menu/Menu.js +19 -14
- package/dist/cjs/components/menu/MenuItem.js +5 -4
- package/dist/cjs/components/meter/Meter.js +1 -1
- package/dist/cjs/components/navigator/Navigator.js +6 -6
- package/dist/cjs/components/panel/Panel.js +6 -4
- package/dist/cjs/components/panel/PanelGroup.js +3 -3
- package/dist/cjs/components/panel/PanelStack.js +5 -5
- package/dist/cjs/components/progress/ProgressBar.js +2 -2
- package/dist/cjs/components/progress/ProgressCircle.js +2 -2
- package/dist/cjs/components/tabpanel/Tab.js +6 -4
- package/dist/cjs/components/tabpanel/TabPanel.js +7 -6
- package/dist/cjs/context/Global.js +2 -55
- package/dist/cjs/context/NotificationCenter.js +38 -39
- package/dist/cjs/context/context.js +59 -0
- package/dist/cjs/core/aside/Aside.js +9 -7
- package/dist/cjs/core/boundary/ErrorBoundary.js +2 -4
- package/dist/cjs/core/page/Page.js +4 -1
- package/dist/cjs/core/responsive/Responsive.js +3 -2
- package/dist/cjs/core/theme/ThemeProvider.js +5 -4
- package/dist/cjs/core/viewport/Viewport.js +1 -1
- package/dist/cjs/hooks/useContextMenu.js +103 -0
- package/dist/cjs/hooks/useIsDark.js +6 -4
- package/dist/cjs/hooks/useNavigator.js +11 -10
- package/dist/cjs/hooks/useOverlayService.js +27 -38
- package/dist/cjs/hooks/usePropToggle.js +2 -2
- package/dist/cjs/hooks/useResize.js +8 -6
- package/dist/cjs/hooks/useResizeObserver.js +5 -5
- package/dist/cjs/hooks/useStepper.js +2 -6
- package/dist/cjs/hotkeys/HotKey.js +2 -2
- package/dist/cjs/hotkeys/HotKeyWrapper.js +8 -13
- package/dist/cjs/hotkeys/commons.js +1 -1
- package/dist/cjs/hotkeys/context.js +36 -0
- package/dist/cjs/i18n/index.js +4 -4
- package/dist/cjs/index.js +10 -5
- package/dist/cjs/overlays/alert/Alert.js +6 -5
- package/dist/cjs/overlays/flyout/Flyout.js +8 -6
- package/dist/cjs/overlays/message/Message.js +5 -5
- package/dist/cjs/overlays/modal/Modal.js +5 -3
- package/dist/cjs/overlays/toast/Toast.js +4 -4
- package/dist/cjs/overlays/tooltip/Tooltip.js +2 -16
- package/dist/cjs/typography/Abbr.js +4 -5
- package/dist/cjs/typography/Anchor.js +2 -2
- package/dist/cjs/typography/Copy.js +2 -2
- package/dist/cjs/typography/Mark.js +2 -4
- package/dist/cjs/typography/Text.js +4 -4
- package/dist/cjs/typography/Title.js +2 -2
- package/dist/cjs/utils/cloneElement.js +4 -4
- package/dist/cjs/utils/getBadgeProps.js +51 -0
- package/dist/cjs/utils/getIconProps.js +42 -0
- package/dist/cjs/utils/getTooltipProps.js +45 -0
- package/dist/esm/components/actionLabel/ActionLabel.js +1 -1
- package/dist/esm/components/animations/Animations.js +7 -7
- package/dist/esm/components/avatar/Avatar.js +1 -1
- package/dist/esm/components/avatar/AvatarGroup.js +1 -1
- package/dist/esm/components/badge/Badge.js +7 -28
- package/dist/esm/components/breadcrumbs/Breadcrumbs.js +1 -1
- package/dist/esm/components/button/Button.js +9 -7
- package/dist/esm/components/button/ButtonGroup.js +3 -3
- package/dist/esm/components/button/ConfirmButton.js +8 -7
- package/dist/esm/components/button/ToggleButtonGroup.js +3 -3
- package/dist/esm/components/callout/Callout.js +8 -7
- package/dist/esm/components/card/Card.js +4 -4
- package/dist/esm/components/card/CardCover.js +1 -1
- package/dist/esm/components/card/FlipContent.js +2 -2
- package/dist/esm/components/chip/Chip.js +9 -8
- package/dist/esm/components/collapsable/Collapsable.js +4 -3
- package/dist/esm/components/divider/Divider.js +2 -2
- package/dist/esm/components/dropdown/Dropdown.js +30 -16
- package/dist/esm/components/empty/EmptyContent.js +1 -1
- package/dist/esm/components/icon/Icon.js +28 -41
- package/dist/esm/components/media/Media.js +13 -13
- package/dist/esm/components/menu/ContextMenu.js +24 -14
- package/dist/esm/components/menu/Menu.js +22 -17
- package/dist/esm/components/menu/MenuItem.js +6 -5
- package/dist/esm/components/meter/Meter.js +1 -1
- package/dist/esm/components/navigator/Navigator.js +7 -7
- package/dist/esm/components/panel/Panel.js +6 -4
- package/dist/esm/components/panel/PanelGroup.js +4 -4
- package/dist/esm/components/panel/PanelStack.js +6 -6
- package/dist/esm/components/progress/ProgressBar.js +2 -2
- package/dist/esm/components/progress/ProgressCircle.js +2 -2
- package/dist/esm/components/tabpanel/Tab.js +6 -4
- package/dist/esm/components/tabpanel/TabPanel.js +8 -7
- package/dist/esm/context/Global.js +3 -52
- package/dist/esm/context/NotificationCenter.js +38 -39
- package/dist/esm/context/context.js +56 -0
- package/dist/esm/core/aside/Aside.js +10 -8
- package/dist/esm/core/boundary/ErrorBoundary.js +1 -3
- package/dist/esm/core/page/Page.js +4 -1
- package/dist/esm/core/responsive/Responsive.js +3 -2
- package/dist/esm/core/theme/ThemeProvider.js +4 -3
- package/dist/esm/core/viewport/Viewport.js +1 -1
- package/dist/esm/hooks/useContextMenu.js +103 -0
- package/dist/esm/hooks/useIsDark.js +7 -5
- package/dist/esm/hooks/useNavigator.js +12 -11
- package/dist/esm/hooks/useOverlayService.js +28 -39
- package/dist/esm/hooks/usePropToggle.js +3 -3
- package/dist/esm/hooks/useResize.js +9 -7
- package/dist/esm/hooks/useResizeObserver.js +6 -6
- package/dist/esm/hooks/useStepper.js +2 -6
- package/dist/esm/hotkeys/HotKey.js +1 -1
- package/dist/esm/hotkeys/HotKeyWrapper.js +9 -12
- package/dist/esm/hotkeys/commons.js +1 -1
- package/dist/esm/hotkeys/context.js +35 -0
- package/dist/esm/i18n/index.js +2 -2
- package/dist/esm/index.js +8 -4
- package/dist/esm/overlays/alert/Alert.js +7 -6
- package/dist/esm/overlays/flyout/Flyout.js +9 -7
- package/dist/esm/overlays/message/Message.js +6 -6
- package/dist/esm/overlays/modal/Modal.js +6 -4
- package/dist/esm/overlays/toast/Toast.js +5 -5
- package/dist/esm/overlays/tooltip/Tooltip.js +4 -17
- package/dist/esm/typography/Abbr.js +4 -5
- package/dist/esm/typography/Anchor.js +2 -2
- package/dist/esm/typography/Copy.js +3 -3
- package/dist/esm/typography/Mark.js +2 -4
- package/dist/esm/typography/Text.js +5 -5
- package/dist/esm/typography/Title.js +2 -2
- package/dist/esm/utils/cloneElement.js +4 -4
- package/dist/esm/utils/getBadgeProps.js +51 -0
- package/dist/esm/utils/getIconProps.js +42 -0
- package/dist/esm/utils/getTooltipProps.js +45 -0
- package/dist/types/components/actionLabel/ActionLabel.d.ts +1 -1
- package/dist/types/components/animations/Animations.d.ts +6 -6
- package/dist/types/components/avatar/Avatar.d.ts +1 -1
- package/dist/types/components/avatar/AvatarGroup.d.ts +1 -1
- package/dist/types/components/badge/Badge.d.ts +2 -10
- package/dist/types/components/breadcrumbs/Breadcrumbs.d.ts +1 -1
- package/dist/types/components/button/Button.d.ts +1 -1
- package/dist/types/components/button/ButtonGroup.d.ts +1 -1
- package/dist/types/components/button/ConfirmButton.d.ts +1 -1
- package/dist/types/components/button/ToggleButtonGroup.d.ts +1 -1
- package/dist/types/components/callout/Callout.d.ts +7 -3
- package/dist/types/components/card/Card.d.ts +2 -2
- package/dist/types/components/card/CardCover.d.ts +1 -1
- package/dist/types/components/card/FlipContent.d.ts +1 -1
- package/dist/types/components/chip/Chip.d.ts +1 -1
- package/dist/types/components/collapsable/Collapsable.d.ts +1 -1
- package/dist/types/components/divider/Divider.d.ts +1 -1
- package/dist/types/components/dropdown/Dropdown.d.ts +7 -3
- package/dist/types/components/dropdown/DropdownTool.d.ts +1 -1
- package/dist/types/components/empty/EmptyContent.d.ts +3 -3
- package/dist/types/components/icon/Icon.d.ts +3 -4
- package/dist/types/components/index.d.ts +3 -3
- package/dist/types/components/media/Media.d.ts +2 -2
- package/dist/types/components/menu/ContextMenu.d.ts +1 -1
- package/dist/types/components/menu/Menu.d.ts +1 -1
- package/dist/types/components/menu/types.d.ts +6 -1
- package/dist/types/components/meter/Meter.d.ts +1 -1
- package/dist/types/components/navigator/Navigator.d.ts +7 -1
- package/dist/types/components/panel/Panel.d.ts +2 -2
- package/dist/types/components/panel/PanelGroup.d.ts +1 -1
- package/dist/types/components/panel/PanelStack.d.ts +1 -1
- package/dist/types/components/progress/ProgressBar.d.ts +1 -1
- package/dist/types/components/progress/ProgressCircle.d.ts +1 -1
- package/dist/types/components/tabpanel/Tab.d.ts +1 -1
- package/dist/types/components/tabpanel/TabPanel.d.ts +1 -1
- package/dist/types/context/Global.d.ts +0 -82
- package/dist/types/context/context.d.ts +85 -0
- package/dist/types/core/aside/Aside.d.ts +2 -2
- package/dist/types/core/responsive/Responsive.d.ts +5 -1
- package/dist/types/core/theme/ThemeProvider.d.ts +2 -2
- package/dist/types/hooks/useContextMenu.d.ts +10 -0
- package/dist/types/hooks/useOverlayService.d.ts +3 -5
- package/dist/types/hotkeys/HotKeyWrapper.d.ts +0 -9
- package/dist/types/hotkeys/context.d.ts +9 -0
- package/dist/types/index.d.ts +4 -2
- package/dist/types/overlays/alert/Alert.d.ts +2 -2
- package/dist/types/overlays/flyout/Flyout.d.ts +2 -2
- package/dist/types/overlays/message/Message.d.ts +2 -2
- package/dist/types/overlays/modal/Modal.d.ts +2 -2
- package/dist/types/overlays/toast/Toast.d.ts +2 -2
- package/dist/types/overlays/tooltip/Tooltip.d.ts +0 -3
- package/dist/types/types/index.d.ts +2 -2
- package/dist/types/typography/Abbr.d.ts +4 -8
- package/dist/types/typography/Anchor.d.ts +1 -1
- package/dist/types/typography/Copy.d.ts +1 -1
- package/dist/types/typography/Mark.d.ts +2 -2
- package/dist/types/typography/Text.d.ts +1 -1
- package/dist/types/typography/Title.d.ts +1 -1
- package/dist/types/utils/getBadgeProps.d.ts +9 -0
- package/dist/types/utils/getIconProps.d.ts +2 -0
- package/dist/types/utils/getTooltipProps.d.ts +4 -0
- package/dist/types/utils/index.d.ts +3 -0
- package/package.json +14 -15
- package/src/components/actionLabel/ActionLabel.tsx +1 -1
- package/src/components/animations/Animations.tsx +6 -6
- package/src/components/avatar/Avatar.tsx +1 -1
- package/src/components/avatar/AvatarGroup.tsx +1 -1
- package/src/components/badge/Badge.tsx +8 -46
- package/src/components/breadcrumbs/Breadcrumbs.tsx +1 -1
- package/src/components/button/Button.tsx +24 -52
- package/src/components/button/ButtonGroup.tsx +1 -1
- package/src/components/button/ConfirmButton.tsx +23 -20
- package/src/components/button/ToggleButtonGroup.tsx +1 -1
- package/src/components/callout/Callout.tsx +14 -19
- package/src/components/card/Card.tsx +9 -11
- package/src/components/card/CardCover.tsx +1 -1
- package/src/components/card/FlipContent.tsx +2 -2
- package/src/components/chip/Chip.tsx +16 -33
- package/src/components/collapsable/Collapsable.tsx +2 -2
- package/src/components/divider/Divider.tsx +1 -1
- package/src/components/dropdown/Dropdown.tsx +60 -73
- package/src/components/dropdown/DropdownTool.tsx +1 -1
- package/src/components/empty/EmptyContent.tsx +3 -3
- package/src/components/icon/Icon.tsx +27 -54
- package/src/components/index.ts +5 -4
- package/src/components/media/Media.tsx +3 -3
- package/src/components/menu/ContextMenu.tsx +30 -30
- package/src/components/menu/Menu.tsx +35 -63
- package/src/components/menu/MenuItem.tsx +9 -28
- package/src/components/menu/types.ts +6 -1
- package/src/components/meter/Meter.tsx +1 -1
- package/src/components/navigator/Navigator.tsx +13 -11
- package/src/components/panel/Panel.tsx +13 -54
- package/src/components/panel/PanelGroup.tsx +3 -4
- package/src/components/panel/PanelStack.tsx +20 -25
- package/src/components/progress/ProgressBar.tsx +2 -2
- package/src/components/progress/ProgressCircle.tsx +2 -2
- package/src/components/tabpanel/Tab.tsx +9 -28
- package/src/components/tabpanel/TabPanel.tsx +13 -15
- package/src/context/Global.tsx +18 -125
- package/src/context/NotificationCenter.tsx +0 -1
- package/src/context/context.ts +100 -0
- package/src/core/aside/Aside.tsx +18 -55
- package/src/core/boundary/ErrorBoundary.tsx +8 -37
- package/src/core/page/Page.tsx +3 -5
- package/src/core/responsive/Responsive.tsx +10 -34
- package/src/core/theme/ThemeProvider.tsx +5 -8
- package/src/core/viewport/Viewport.tsx +1 -1
- package/src/hooks/useContextMenu.tsx +131 -0
- package/src/hooks/useIsDark.ts +7 -5
- package/src/hooks/useNavigator.tsx +8 -12
- package/src/hooks/useOverlayService.tsx +22 -17
- package/src/hooks/usePropToggle.ts +3 -3
- package/src/hooks/useResize.ts +14 -17
- package/src/hooks/useResizeObserver.ts +21 -21
- package/src/hooks/useStepper.tsx +1 -1
- package/src/hotkeys/HotKey.tsx +1 -1
- package/src/hotkeys/HotKeyWrapper.tsx +81 -105
- package/src/hotkeys/commons.ts +2 -0
- package/src/hotkeys/context.ts +32 -0
- package/src/i18n/index.ts +2 -2
- package/src/index.ts +4 -7
- package/src/overlays/alert/Alert.tsx +12 -16
- package/src/overlays/flyout/Flyout.tsx +32 -69
- package/src/overlays/message/Message.tsx +11 -15
- package/src/overlays/modal/Modal.tsx +23 -57
- package/src/overlays/toast/Toast.tsx +16 -15
- package/src/overlays/tooltip/Tooltip.tsx +6 -29
- package/src/types/global.d.ts +12 -0
- package/src/types/index.ts +2 -2
- package/src/typography/Abbr.tsx +11 -39
- package/src/typography/Anchor.tsx +1 -1
- package/src/typography/Copy.tsx +4 -4
- package/src/typography/Mark.tsx +2 -3
- package/src/typography/Text.tsx +8 -6
- package/src/typography/Title.tsx +1 -1
- package/src/utils/getBadgeProps.ts +45 -0
- package/src/utils/getIconProps.ts +35 -0
- package/src/utils/getTooltipProps.ts +38 -0
- package/src/utils/index.ts +3 -0
- /package/dist/cjs/i18n/{ar.json.js → ar/core.json.js} +0 -0
- /package/dist/cjs/i18n/{en.json.js → en/core.json.js} +0 -0
- /package/dist/esm/i18n/{ar.json.js → ar/core.json.js} +0 -0
- /package/dist/esm/i18n/{en.json.js → en/core.json.js} +0 -0
- /package/src/i18n/{ar.json → ar/core.json} +0 -0
- /package/src/i18n/{en.json → en/core.json} +0 -0
|
@@ -14,7 +14,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
14
14
|
* This component is useful for creating custom context menus that can be triggered by right-clicking on elements.
|
|
15
15
|
*
|
|
16
16
|
* @param {ContextMenuProps} props - The properties for the ContextMenu component.
|
|
17
|
-
* @returns {
|
|
17
|
+
* @returns {React.ReactElement} The rendered ContextMenu component.
|
|
18
18
|
*
|
|
19
19
|
* @example
|
|
20
20
|
* ```jsx
|
|
@@ -96,26 +96,36 @@ var ContextMenu = function ContextMenu(_ref) {
|
|
|
96
96
|
}, [disabled]);
|
|
97
97
|
var tryClosing = react.useRef(function (e) {
|
|
98
98
|
var _e$target;
|
|
99
|
-
if ((_e$target = e.target) !== null && _e$target !== void 0 && _e$target.closest("[data-dropdown-dismiss='
|
|
99
|
+
if (!((_e$target = e.target) !== null && _e$target !== void 0 && _e$target.closest("[data-dropdown-dismiss='false']"))) setTimeout(function () {
|
|
100
100
|
return setIsOpen(false);
|
|
101
101
|
}, 50);
|
|
102
102
|
});
|
|
103
103
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
104
104
|
className: "contents",
|
|
105
105
|
ref: wrapperRef,
|
|
106
|
-
onMouseUpCapture: tryClosing.current,
|
|
107
106
|
children: [children, isOpen && /*#__PURE__*/jsxRuntime.jsx(react$1.FloatingPortal, {
|
|
108
107
|
root: (_refs$domReference$cu = (_refs$domReference$cu2 = refs.domReference.current) === null || _refs$domReference$cu2 === void 0 ? void 0 : _refs$domReference$cu2.closest(".theme-base")) !== null && _refs$domReference$cu !== void 0 ? _refs$domReference$cu : undefined,
|
|
109
|
-
children: /*#__PURE__*/react.
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
zIndex: "var(--z-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
108
|
+
children: /*#__PURE__*/jsxRuntime.jsx(react$1.FloatingOverlay, {
|
|
109
|
+
lockScroll: true,
|
|
110
|
+
style: {
|
|
111
|
+
zIndex: "var(--z-overlay-mask)",
|
|
112
|
+
position: "absolute",
|
|
113
|
+
overflow: "hidden"
|
|
114
|
+
},
|
|
115
|
+
children: /*#__PURE__*/jsxRuntime.jsx(react$1.FloatingFocusManager, {
|
|
116
|
+
context: context,
|
|
117
|
+
children: /*#__PURE__*/react.cloneElement(menu, _objectSpread(_objectSpread({}, getFloatingProps()), {}, {
|
|
118
|
+
style: _objectSpread(_objectSpread({}, floatingStyles), {}, {
|
|
119
|
+
borderRadius: "var(--rounding)",
|
|
120
|
+
zIndex: "var(--z-popover)",
|
|
121
|
+
fontSize: "0.875rem"
|
|
122
|
+
}),
|
|
123
|
+
className: "bg-default outline rounded-capped shadow-lg",
|
|
124
|
+
ref: refs.setFloating,
|
|
125
|
+
onMouseUp: tryClosing.current
|
|
126
|
+
}))
|
|
127
|
+
})
|
|
128
|
+
})
|
|
119
129
|
})]
|
|
120
130
|
});
|
|
121
131
|
};
|
|
@@ -13,12 +13,12 @@ var nodeCheck = require('../../utils/nodeCheck.js');
|
|
|
13
13
|
var MenuItem = require('./MenuItem.js');
|
|
14
14
|
var jsxRuntime = require('react/jsx-runtime');
|
|
15
15
|
|
|
16
|
-
var _excluded = ["children", "minimal", "menuClassName", "onClick", "trigger", "ref"];
|
|
16
|
+
var _excluded = ["children", "minimal", "menuClassName", "onClick", "trigger", "ref", "onMouseUp", "onMouseDown", "forDropdown"];
|
|
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
|
// FIXME: refactor menu implementation to differentiate between static and floating menus, implement context wrapper for each menu level
|
|
20
20
|
|
|
21
|
-
var
|
|
21
|
+
var _MenuComponent = function MenuComponent(_ref) {
|
|
22
22
|
var _refs$domReference$cu, _refs$domReference$cu2;
|
|
23
23
|
var children = _ref.children,
|
|
24
24
|
minimal = _ref.minimal,
|
|
@@ -27,6 +27,9 @@ var MenuComponent = function MenuComponent(_ref) {
|
|
|
27
27
|
_ref$trigger = _ref.trigger,
|
|
28
28
|
trigger = _ref$trigger === void 0 ? "hover" : _ref$trigger,
|
|
29
29
|
ref = _ref.ref,
|
|
30
|
+
onMouseUp = _ref.onMouseUp,
|
|
31
|
+
onMouseDown = _ref.onMouseDown,
|
|
32
|
+
forDropdown = _ref.forDropdown,
|
|
30
33
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
31
34
|
var _useState = react$1.useState(false),
|
|
32
35
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -41,9 +44,9 @@ var MenuComponent = function MenuComponent(_ref) {
|
|
|
41
44
|
var tree = react.useFloatingTree();
|
|
42
45
|
var nodeId = react.useFloatingNodeId();
|
|
43
46
|
var parentId = react.useFloatingParentNodeId();
|
|
44
|
-
var isNested = parentId !== null;
|
|
47
|
+
var isNested = parentId !== null && !forDropdown;
|
|
45
48
|
var _useFloating = react.useFloating({
|
|
46
|
-
nodeId: nodeId,
|
|
49
|
+
nodeId: "menu-".concat(nodeId),
|
|
47
50
|
open: !isNested || isOpen,
|
|
48
51
|
onOpenChange: function onOpenChange(open, event, reason) {
|
|
49
52
|
isNested && setIsOpen(open);
|
|
@@ -125,12 +128,12 @@ var MenuComponent = function MenuComponent(_ref) {
|
|
|
125
128
|
});
|
|
126
129
|
}
|
|
127
130
|
}, [tree, isOpen, nodeId, parentId]);
|
|
128
|
-
var handleClick = react$1.
|
|
131
|
+
var handleClick = react$1.useEffectEvent(function (e) {
|
|
129
132
|
var el = e.target;
|
|
130
133
|
if (el.dataset.id) {
|
|
131
134
|
onClick === null || onClick === void 0 || onClick(el.dataset.id);
|
|
132
135
|
}
|
|
133
|
-
}
|
|
136
|
+
});
|
|
134
137
|
var Wrapper = isNested ? react.FloatingPortal : react$1.Fragment;
|
|
135
138
|
var wrapperProps = isNested ? {
|
|
136
139
|
root: (_refs$domReference$cu = (_refs$domReference$cu2 = refs.domReference.current) === null || _refs$domReference$cu2 === void 0 ? void 0 : _refs$domReference$cu2.closest(".theme-base")) !== null && _refs$domReference$cu !== void 0 ? _refs$domReference$cu : undefined
|
|
@@ -174,20 +177,22 @@ var MenuComponent = function MenuComponent(_ref) {
|
|
|
174
177
|
children: [isNested && /*#__PURE__*/jsxRuntime.jsx(react.FloatingOverlay, {}), /*#__PURE__*/jsxRuntime.jsx(HotKeyWrapper.HotKeyWrapper, {
|
|
175
178
|
children: /*#__PURE__*/jsxRuntime.jsx(react.FloatingFocusManager, {
|
|
176
179
|
context: context,
|
|
177
|
-
|
|
180
|
+
closeOnFocusOut: true,
|
|
178
181
|
initialFocus: isNested ? -1 : 0,
|
|
179
182
|
returnFocus: !isNested,
|
|
180
183
|
children: /*#__PURE__*/jsxRuntime.jsx("div", _objectSpread(_objectSpread({
|
|
181
|
-
className: classNames(menuClassName, "flex flex-col
|
|
184
|
+
className: classNames(menuClassName, "flex flex-col p-1 menu-list", isNested && "outline shadow-lg rounded-capped max-h-96 overflow-auto scroll-thin z-(--z-popover)"),
|
|
182
185
|
autoFocus: true,
|
|
183
186
|
ref: utilities.mergeRefs(isNested ? refs.setFloating : ref)
|
|
184
187
|
}, getFloatingProps({
|
|
185
|
-
onClick: isNested ? undefined : handleClick
|
|
188
|
+
onClick: isNested ? undefined : handleClick,
|
|
189
|
+
onMouseDown: onMouseDown,
|
|
190
|
+
onMouseUp: onMouseUp
|
|
186
191
|
})), {}, {
|
|
187
192
|
style: !isNested ? rest.style : floatingStyles,
|
|
188
193
|
children: cloneElement.cloneChildren(children, function (child, index) {
|
|
189
194
|
labelsRef.current[index] = child.props.label;
|
|
190
|
-
return /*#__PURE__*/react$1.cloneElement(child, nodeCheck.nodeCheck(child, MenuItem.MenuItem, Menu,
|
|
195
|
+
return /*#__PURE__*/react$1.cloneElement(child, nodeCheck.nodeCheck(child, MenuItem.MenuItem, Menu, _MenuComponent) ? _objectSpread({
|
|
191
196
|
minimal: !isNested && minimal,
|
|
192
197
|
"data-focus": activeIndex === index,
|
|
193
198
|
ref: function ref(el) {
|
|
@@ -213,7 +218,7 @@ var MenuComponent = function MenuComponent(_ref) {
|
|
|
213
218
|
* It can be nested within other menus to create complex menu structures.
|
|
214
219
|
*
|
|
215
220
|
* @param {MenuProps} props - The properties for the Menu component.
|
|
216
|
-
* @returns {
|
|
221
|
+
* @returns {React.ReactElement} The rendered Menu component.
|
|
217
222
|
*
|
|
218
223
|
* @example
|
|
219
224
|
* ```jsx
|
|
@@ -239,20 +244,20 @@ var Menu = function Menu(props) {
|
|
|
239
244
|
var parentId = react.useFloatingParentNodeId();
|
|
240
245
|
var tree = react.useFloatingTree();
|
|
241
246
|
if (tree) {
|
|
242
|
-
return /*#__PURE__*/jsxRuntime.jsx(
|
|
247
|
+
return /*#__PURE__*/jsxRuntime.jsx(_MenuComponent, _objectSpread(_objectSpread({}, props), {}, {
|
|
243
248
|
className: "",
|
|
244
249
|
menuClassName: props.className
|
|
245
250
|
}));
|
|
246
251
|
}
|
|
247
252
|
if (parentId === null) {
|
|
248
253
|
return /*#__PURE__*/jsxRuntime.jsx(react.FloatingTree, {
|
|
249
|
-
children: /*#__PURE__*/jsxRuntime.jsx(
|
|
254
|
+
children: /*#__PURE__*/jsxRuntime.jsx(_MenuComponent, _objectSpread(_objectSpread({}, props), {}, {
|
|
250
255
|
className: "",
|
|
251
256
|
menuClassName: props.className
|
|
252
257
|
}))
|
|
253
258
|
});
|
|
254
259
|
}
|
|
255
|
-
return /*#__PURE__*/jsxRuntime.jsx(
|
|
260
|
+
return /*#__PURE__*/jsxRuntime.jsx(_MenuComponent, _objectSpread({}, props));
|
|
256
261
|
};
|
|
257
262
|
|
|
258
263
|
exports.Menu = Menu;
|
|
@@ -12,6 +12,8 @@ require('@babel/runtime/helpers/slicedToArray');
|
|
|
12
12
|
require('react-i18next');
|
|
13
13
|
require('../../hooks/useEffectDebugger.js');
|
|
14
14
|
var jsxRuntime = require('react/jsx-runtime');
|
|
15
|
+
var getBadgeProps = require('../../utils/getBadgeProps.js');
|
|
16
|
+
var getIconProps = require('../../utils/getIconProps.js');
|
|
15
17
|
var Tooltip = require('../../overlays/tooltip/Tooltip.js');
|
|
16
18
|
var Badge = require('../badge/Badge.js');
|
|
17
19
|
var Icon = require('../icon/Icon.js');
|
|
@@ -66,21 +68,20 @@ var MenuItem = function MenuItem(_ref) {
|
|
|
66
68
|
var elRef = react.useRef(null);
|
|
67
69
|
var tree = react$1.useFloatingTree();
|
|
68
70
|
var badgeProps = react.useMemo(function () {
|
|
69
|
-
return
|
|
71
|
+
return getBadgeProps.getBadgeProps(badge);
|
|
70
72
|
}, [badge]);
|
|
71
73
|
react.useEffect(function () {
|
|
72
74
|
var _elRef$current;
|
|
73
75
|
tabIndex === 0 && ((_elRef$current = elRef.current) === null || _elRef$current === void 0 ? void 0 : _elRef$current.focus());
|
|
74
76
|
}, [tabIndex]);
|
|
75
77
|
var iconEl = react.useMemo(function () {
|
|
76
|
-
var _path;
|
|
77
78
|
var path = icon;
|
|
78
79
|
if (minimal && !path) {
|
|
79
80
|
path = utilities.iconToken(label);
|
|
80
81
|
}
|
|
81
82
|
return /*#__PURE__*/jsxRuntime.jsx(Icon.Icon, _objectSpread({
|
|
82
83
|
className: classNames("fabric-menuIcon", minimal && "minimal")
|
|
83
|
-
},
|
|
84
|
+
}, getIconProps.getIconProps(path !== null && path !== void 0 ? path : "")));
|
|
84
85
|
}, [icon, minimal, label]);
|
|
85
86
|
var Wrapper = react.useCallback(function (_ref2) {
|
|
86
87
|
var children = _ref2.children,
|
|
@@ -132,7 +133,7 @@ var MenuItem = function MenuItem(_ref) {
|
|
|
132
133
|
(_onClick === null || _onClick === void 0 ? void 0 : _onClick(e)) !== false && (tree === null || tree === void 0 ? void 0 : tree.events.emit("click"));
|
|
133
134
|
}
|
|
134
135
|
}, minimal ? {} : aria), {}, {
|
|
135
|
-
children: [hotKey && /*#__PURE__*/jsxRuntime.jsx(HotKey.HotKey, {
|
|
136
|
+
children: [!disabled && hotKey && /*#__PURE__*/jsxRuntime.jsx(HotKey.HotKey, {
|
|
136
137
|
keyCombo: hotKey,
|
|
137
138
|
handler: function handler() {
|
|
138
139
|
var _elRef$current2, _elRef$current2$click;
|
|
@@ -18,7 +18,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
18
18
|
* The component can also display a label showing the percentage value.
|
|
19
19
|
*
|
|
20
20
|
* @param {MeterProps} props - The properties for the Meter component.
|
|
21
|
-
* @returns {
|
|
21
|
+
* @returns {React.ReactElement} The rendered Meter component.
|
|
22
22
|
*
|
|
23
23
|
* @example
|
|
24
24
|
* ```jsx
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
4
4
|
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
5
|
+
var utilities = require('@react-fabric/utilities');
|
|
5
6
|
var classNames = require('classnames');
|
|
6
7
|
var react = require('react');
|
|
7
8
|
var HotKey = require('../../hotkeys/HotKey.js');
|
|
8
9
|
var Icon = require('../icon/Icon.js');
|
|
9
|
-
var utilities = require('@react-fabric/utilities');
|
|
10
10
|
var jsxRuntime = require('react/jsx-runtime');
|
|
11
11
|
|
|
12
12
|
var _excluded = ["className", "onNavigate", "color", "children", "length", "current", "disableKeyHandlers"];
|
|
@@ -17,7 +17,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
17
17
|
* It includes previous and next buttons, and supports keyboard navigation.
|
|
18
18
|
*
|
|
19
19
|
* @param {NavigatorProps} props - The properties for the Navigator component.
|
|
20
|
-
* @returns {
|
|
20
|
+
* @returns {React.ReactElement} The rendered Navigator component.
|
|
21
21
|
*
|
|
22
22
|
* @example
|
|
23
23
|
* ```jsx
|
|
@@ -43,12 +43,12 @@ var Navigator = function Navigator(_ref) {
|
|
|
43
43
|
current = _ref.current,
|
|
44
44
|
disableKeyHandlers = _ref.disableKeyHandlers,
|
|
45
45
|
aria = _objectWithoutProperties(_ref, _excluded);
|
|
46
|
-
var navPrev = react.
|
|
46
|
+
var navPrev = react.useEffectEvent(function () {
|
|
47
47
|
return (utilities.isEmpty(current) || current !== 0) && onNavigate(-1);
|
|
48
|
-
}
|
|
49
|
-
var navNext = react.
|
|
48
|
+
});
|
|
49
|
+
var navNext = react.useEffectEvent(function () {
|
|
50
50
|
return (utilities.isEmpty(current) || current + 1 < (length !== null && length !== void 0 ? length : 0)) && onNavigate(+1);
|
|
51
|
-
}
|
|
51
|
+
});
|
|
52
52
|
return /*#__PURE__*/jsxRuntime.jsxs("div", _objectSpread(_objectSpread({
|
|
53
53
|
"data-ref": "navigator",
|
|
54
54
|
className: classNames(className, "inline-flex items-center leading-none")
|
|
@@ -7,9 +7,11 @@ var classNames = require('classnames');
|
|
|
7
7
|
var react = require('react');
|
|
8
8
|
var usePropToggle = require('../../hooks/usePropToggle.js');
|
|
9
9
|
var HotKey = require('../../hotkeys/HotKey.js');
|
|
10
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
11
|
+
require('@react-fabric/utilities');
|
|
12
|
+
var getIconProps = require('../../utils/getIconProps.js');
|
|
10
13
|
var Animations = require('../animations/Animations.js');
|
|
11
14
|
var Icon = require('../icon/Icon.js');
|
|
12
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
13
15
|
|
|
14
16
|
var _excluded = ["children", "className", "titleClassName", "headerClassName", "title", "actions", "icon", "panelId", "height", "width", "minHeight", "minWidth", "maxHeight", "maxWidth", "loading", "expandable", "expanded", "onExpand", "collapsable", "collapsed", "onCollapse", "onClose", "onBack"];
|
|
15
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; }
|
|
@@ -23,7 +25,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
23
25
|
* It can be used in various applications where panels are needed, such as dashboards, settings pages, or content management systems.
|
|
24
26
|
*
|
|
25
27
|
* @param {PanelProps} props - The properties for the Panel component.
|
|
26
|
-
* @returns {
|
|
28
|
+
* @returns {React.ReactElement} The rendered Panel component.
|
|
27
29
|
*
|
|
28
30
|
* @example
|
|
29
31
|
* ```jsx
|
|
@@ -118,7 +120,7 @@ var Panel = function Panel(_ref) {
|
|
|
118
120
|
onClick: onBack
|
|
119
121
|
}), icon && /*#__PURE__*/jsxRuntime.jsx(Icon.Icon, _objectSpread({
|
|
120
122
|
className: "p-2 text-md select-none pointer-events-none"
|
|
121
|
-
},
|
|
123
|
+
}, getIconProps.getIconProps(icon))), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
122
124
|
className: classNames(titleClassName, "flex-1 select-none truncate", title && "py-1 first:px-2"),
|
|
123
125
|
children: title
|
|
124
126
|
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
@@ -138,7 +140,7 @@ var Panel = function Panel(_ref) {
|
|
|
138
140
|
}), !expanded && collapsable && /*#__PURE__*/jsxRuntime.jsx(Icon.Icon, {
|
|
139
141
|
"data-ref": "panelCollapse",
|
|
140
142
|
className: classNames("fabric-panelAction", "cursor-pointer"),
|
|
141
|
-
icon: collapsed ? "icon-[mdi--plus-box]" : "icon-[mdi--minus-box]",
|
|
143
|
+
icon: collapsed ? "icon-[mdi--plus-box-outline]" : "icon-[mdi--minus-box-outline]",
|
|
142
144
|
onClick: toggleCollapse
|
|
143
145
|
}), !expanded && onClose && /*#__PURE__*/jsxRuntime.jsx(Icon.Icon, {
|
|
144
146
|
"data-ref": "panelClose",
|
|
@@ -14,7 +14,7 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
14
14
|
* It uses the `Panel` component to render each individual panel within the group.
|
|
15
15
|
*
|
|
16
16
|
* @param {PanelGroupProps} props - The properties for the PanelGroup component.
|
|
17
|
-
* @returns {
|
|
17
|
+
* @returns {React.ReactElement} The rendered PanelGroup component.
|
|
18
18
|
*
|
|
19
19
|
* @example
|
|
20
20
|
* ```jsx
|
|
@@ -46,14 +46,14 @@ var PanelGroup = function PanelGroup(_ref) {
|
|
|
46
46
|
useEffectDebugger.useEffectDebugger(function () {
|
|
47
47
|
setExpandedPanel(activePanel !== null && activePanel !== void 0 ? activePanel : panels[0]);
|
|
48
48
|
}, [activePanel, panels], "PanelGroup setActive");
|
|
49
|
-
var changeExpanded = react.
|
|
49
|
+
var changeExpanded = react.useEffectEvent(function (collapsed, id, handler) {
|
|
50
50
|
if (!collapsed) {
|
|
51
51
|
setExpandedPanel(id);
|
|
52
52
|
onActiveChange === null || onActiveChange === void 0 || onActiveChange(id);
|
|
53
53
|
}
|
|
54
54
|
handler === null || handler === void 0 || handler(collapsed);
|
|
55
55
|
return id !== expandedPanel;
|
|
56
|
-
}
|
|
56
|
+
});
|
|
57
57
|
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
58
58
|
"data-ref": "panelGroup",
|
|
59
59
|
className: classNames("fabric-panelGroup", "flex flex-col overflow-auto area-content p-px"),
|
|
@@ -21,7 +21,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
21
21
|
* and it updates the active panel based on user interactions.
|
|
22
22
|
*
|
|
23
23
|
* @param {PanelStackProps} props - The properties for the PanelStack component.
|
|
24
|
-
* @returns {
|
|
24
|
+
* @returns {React.ReactElement} The rendered PanelStack component.
|
|
25
25
|
*
|
|
26
26
|
* @example
|
|
27
27
|
* ```jsx
|
|
@@ -71,17 +71,17 @@ var PanelStack = function PanelStack(_ref) {
|
|
|
71
71
|
}));
|
|
72
72
|
});
|
|
73
73
|
}, [onPanelChange, history]);
|
|
74
|
-
var goBack = react.
|
|
74
|
+
var goBack = react.useEffectEvent(function () {
|
|
75
75
|
var _history$2;
|
|
76
76
|
if ((onBack === null || onBack === void 0 ? void 0 : onBack(history[0], (_history$2 = history[1]) !== null && _history$2 !== void 0 ? _history$2 : "root")) !== false) {
|
|
77
77
|
setHistory(history.slice(1));
|
|
78
78
|
}
|
|
79
|
-
}
|
|
79
|
+
});
|
|
80
80
|
var currentPanel = react.useMemo(function () {
|
|
81
81
|
var _panels$get;
|
|
82
82
|
return (_panels$get = panels.get(history[0])) !== null && _panels$get !== void 0 ? _panels$get : panels.values().next().value;
|
|
83
83
|
}, [history, panels]);
|
|
84
|
-
var checkMenuClick = react.
|
|
84
|
+
var checkMenuClick = react.useEffectEvent(function (e) {
|
|
85
85
|
var _e$target;
|
|
86
86
|
var panelKey = (_e$target = e.target) === null || _e$target === void 0 || (_e$target = _e$target.dataset) === null || _e$target === void 0 ? void 0 : _e$target.panel;
|
|
87
87
|
if (panelKey) {
|
|
@@ -99,7 +99,7 @@ var PanelStack = function PanelStack(_ref) {
|
|
|
99
99
|
return false;
|
|
100
100
|
}
|
|
101
101
|
return true;
|
|
102
|
-
}
|
|
102
|
+
});
|
|
103
103
|
return /*#__PURE__*/jsxRuntime.jsx("div", _objectSpread(_objectSpread({}, rest), {}, {
|
|
104
104
|
role: "none",
|
|
105
105
|
ref: stackRef,
|
|
@@ -27,7 +27,7 @@ var SizeMap = {
|
|
|
27
27
|
* The label can be customized or hidden based on the props provided.
|
|
28
28
|
*
|
|
29
29
|
* @param {ProgressProps} props - The properties for the ProgressBar component.
|
|
30
|
-
* @returns {
|
|
30
|
+
* @returns {React.ReactElement} The rendered ProgressBar component.
|
|
31
31
|
*
|
|
32
32
|
* @example
|
|
33
33
|
* ```jsx
|
|
@@ -61,7 +61,7 @@ var ProgressBar = function ProgressBar(_ref) {
|
|
|
61
61
|
|
|
62
62
|
/** ***************** component *******************/
|
|
63
63
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
64
|
-
className: classNames("fabric-progressbar", "block bg-
|
|
64
|
+
className: classNames("fabric-progressbar", "block bg-tint-50 relative rounded font-bold overflow-hidden whitespace-nowrap"),
|
|
65
65
|
style: _objectSpread(_objectSpread({}, progressVar), {}, {
|
|
66
66
|
color: getColor.getColor(color),
|
|
67
67
|
minHeight: SizeMap[size !== null && size !== void 0 ? size : ""],
|
|
@@ -44,7 +44,7 @@ var SizeMap = {
|
|
|
44
44
|
* The component is customizable with size and color props.
|
|
45
45
|
*
|
|
46
46
|
* @param {ProgressProps} props - The properties for the ProgressCircle component.
|
|
47
|
-
* @returns {
|
|
47
|
+
* @returns {React.ReactElement} - A circular progress indicator.
|
|
48
48
|
*
|
|
49
49
|
* @example
|
|
50
50
|
* ```jsx
|
|
@@ -85,7 +85,7 @@ var ProgressCircle = function ProgressCircle(_ref) {
|
|
|
85
85
|
},
|
|
86
86
|
children: [/*#__PURE__*/jsxRuntime.jsxs("svg", {
|
|
87
87
|
viewBox: "0 0 100 100",
|
|
88
|
-
className: classNames("absolute inset-0 w-full h-full stroke-
|
|
88
|
+
className: classNames("absolute inset-0 w-full h-full stroke-tint-500"),
|
|
89
89
|
children: [/*#__PURE__*/jsxRuntime.jsx("circle", {
|
|
90
90
|
cx: "50",
|
|
91
91
|
cy: "50",
|
|
@@ -10,10 +10,12 @@ require('@floating-ui/react');
|
|
|
10
10
|
require('react-i18next');
|
|
11
11
|
require('../../hooks/useEffectDebugger.js');
|
|
12
12
|
var jsxRuntime = require('react/jsx-runtime');
|
|
13
|
-
require('../../
|
|
13
|
+
var getBadgeProps = require('../../utils/getBadgeProps.js');
|
|
14
|
+
var getIconProps = require('../../utils/getIconProps.js');
|
|
14
15
|
var Tooltip = require('../../overlays/tooltip/Tooltip.js');
|
|
15
16
|
var Badge = require('../badge/Badge.js');
|
|
16
17
|
var Icon = require('../icon/Icon.js');
|
|
18
|
+
require('../../hotkeys/HotKeyWrapper.js');
|
|
17
19
|
var DropdownTool = require('../dropdown/DropdownTool.js');
|
|
18
20
|
|
|
19
21
|
var _excluded = ["ref", "as", "id", "className", "label", "icon", "badge", "disabled", "onClose", "active", "onClick", "tabFlex", "color", "actions", "tooltip", "activeClassName"];
|
|
@@ -25,7 +27,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
25
27
|
* It also supports tooltips, active states, and click handling.
|
|
26
28
|
*
|
|
27
29
|
* @param {TabProps} props - The properties for the Tab component.
|
|
28
|
-
* @returns {
|
|
30
|
+
* @returns {React.ReactElement} The rendered Tab component.
|
|
29
31
|
*
|
|
30
32
|
* @example
|
|
31
33
|
* ```jsx
|
|
@@ -67,7 +69,7 @@ var Tab = function Tab(_ref) {
|
|
|
67
69
|
activeClassName = _ref.activeClassName,
|
|
68
70
|
aria = _objectWithoutProperties(_ref, _excluded);
|
|
69
71
|
var badgeProps = react.useMemo(function () {
|
|
70
|
-
return
|
|
72
|
+
return getBadgeProps.getBadgeProps(badge);
|
|
71
73
|
}, [badge]);
|
|
72
74
|
var minimal = react.useMemo(function () {
|
|
73
75
|
return !label;
|
|
@@ -94,7 +96,7 @@ var Tab = function Tab(_ref) {
|
|
|
94
96
|
}, aria), {}, {
|
|
95
97
|
children: [icon && /*#__PURE__*/jsxRuntime.jsx(Icon.Icon, _objectSpread({
|
|
96
98
|
className: "flex-content p-2"
|
|
97
|
-
},
|
|
99
|
+
}, getIconProps.getIconProps(icon))), !minimal && /*#__PURE__*/jsxRuntime.jsx("label", {
|
|
98
100
|
className: "flex-initial truncate text-center px-1 py-1",
|
|
99
101
|
children: label
|
|
100
102
|
}), badge && /*#__PURE__*/jsxRuntime.jsx(Badge.Badge, _objectSpread(_objectSpread({}, badgeProps), {}, {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
|
|
4
|
+
var utilities = require('@react-fabric/utilities');
|
|
4
5
|
var classNames = require('classnames');
|
|
5
6
|
var react = require('react');
|
|
6
7
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
-
require('@react-fabric/utilities');
|
|
8
8
|
var nodeCheck = require('../../utils/nodeCheck.js');
|
|
9
9
|
var Tab = require('./Tab.js');
|
|
10
10
|
|
|
@@ -19,7 +19,7 @@ var Tab = require('./Tab.js');
|
|
|
19
19
|
* It can be customized with different styles and behaviors to fit the needs of the application.
|
|
20
20
|
*
|
|
21
21
|
* @param {TabPanelProps} props - The properties for the TabPanel component.
|
|
22
|
-
* @returns {
|
|
22
|
+
* @returns {React.ReactElement} The rendered TabPanel component.
|
|
23
23
|
*
|
|
24
24
|
* @example
|
|
25
25
|
* ```jsx
|
|
@@ -73,7 +73,8 @@ var TabPanel = function TabPanel(_ref) {
|
|
|
73
73
|
tabs = _useMemo2[0],
|
|
74
74
|
rest = _useMemo2[1];
|
|
75
75
|
react.useEffect(function () {
|
|
76
|
-
|
|
76
|
+
var _tabs$;
|
|
77
|
+
setActive(utilities.getValue(activeTab !== null && activeTab !== void 0 ? activeTab : (_tabs$ = tabs[0]) === null || _tabs$ === void 0 ? void 0 : _tabs$.props.id));
|
|
77
78
|
}, [activeTab]);
|
|
78
79
|
var activeTabPanel = react.useMemo(function () {
|
|
79
80
|
var _tabs$find;
|
|
@@ -81,16 +82,16 @@ var TabPanel = function TabPanel(_ref) {
|
|
|
81
82
|
return tab.props.id === active;
|
|
82
83
|
})) === null || _tabs$find === void 0 ? void 0 : _tabs$find.props.children;
|
|
83
84
|
}, [tabs, active]);
|
|
84
|
-
var handleClick = react.
|
|
85
|
+
var handleClick = react.useEffectEvent(function (id) {
|
|
85
86
|
void Promise.resolve(onBeforeChange === null || onBeforeChange === void 0 ? void 0 : onBeforeChange(id, active)).then(function (ret) {
|
|
86
87
|
if (ret !== false) {
|
|
87
88
|
setActive(id);
|
|
88
89
|
onChange === null || onChange === void 0 || onChange(id);
|
|
89
90
|
}
|
|
90
91
|
});
|
|
91
|
-
}
|
|
92
|
+
});
|
|
92
93
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
93
|
-
className: classNames("fabric-tabPanel", "area-content grid bg-
|
|
94
|
+
className: classNames("fabric-tabPanel", "area-content grid bg-default overflow-hidden"),
|
|
94
95
|
"data-orientation": orientation,
|
|
95
96
|
"data-variant": variant !== null && variant !== void 0 ? variant : "default",
|
|
96
97
|
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
4
3
|
var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
|
|
5
4
|
var i18next = require('i18next');
|
|
6
5
|
var react = require('react');
|
|
7
6
|
var HotKeyWrapper = require('../hotkeys/HotKeyWrapper.js');
|
|
8
7
|
var NotificationCenter = require('./NotificationCenter.js');
|
|
8
|
+
var context = require('./context.js');
|
|
9
9
|
var jsxRuntime = require('react/jsx-runtime');
|
|
10
10
|
|
|
11
|
-
var _excluded = ["errorElement"];
|
|
12
11
|
var KEY_LOCALE = "ruf:locale";
|
|
13
12
|
var KEY_CALENDAR = "ruf:calendar";
|
|
14
13
|
var KEY_COLOR_SCHEME = "ruf:colorScheme";
|
|
@@ -25,7 +24,6 @@ var systemColorScheme = function systemColorScheme() {
|
|
|
25
24
|
var theme = typeof window !== "undefined" ? (_localStorage$getItem = localStorage.getItem(KEY_COLOR_SCHEME)) !== null && _localStorage$getItem !== void 0 ? _localStorage$getItem : window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light" : "light";
|
|
26
25
|
return theme;
|
|
27
26
|
};
|
|
28
|
-
var GlobalContext = /*#__PURE__*/react.createContext({});
|
|
29
27
|
|
|
30
28
|
/**
|
|
31
29
|
* global context provider
|
|
@@ -123,7 +121,7 @@ var ApplicationProvider = function ApplicationProvider(_ref3) {
|
|
|
123
121
|
}, []);
|
|
124
122
|
|
|
125
123
|
/** ***************** context provider *******************/
|
|
126
|
-
return /*#__PURE__*/jsxRuntime.jsxs(GlobalContext.Provider, {
|
|
124
|
+
return /*#__PURE__*/jsxRuntime.jsxs(context.GlobalContext.Provider, {
|
|
127
125
|
value: {
|
|
128
126
|
errorElement: errorElement,
|
|
129
127
|
changeLocale: changeLocale,
|
|
@@ -142,55 +140,4 @@ var ApplicationProvider = function ApplicationProvider(_ref3) {
|
|
|
142
140
|
});
|
|
143
141
|
};
|
|
144
142
|
|
|
145
|
-
/**
|
|
146
|
-
* internal usage only
|
|
147
|
-
* @internal
|
|
148
|
-
*/
|
|
149
|
-
var useGlobals = function useGlobals() {
|
|
150
|
-
return react.useContext(GlobalContext);
|
|
151
|
-
};
|
|
152
|
-
|
|
153
|
-
/**
|
|
154
|
-
* Hook to access the global application context.
|
|
155
|
-
* This hook provides access to the global context values, including the current locale, calendar, and color scheme.
|
|
156
|
-
*
|
|
157
|
-
* @returns {GlobalContextType} The global context values excluding the error element.
|
|
158
|
-
*
|
|
159
|
-
* @example
|
|
160
|
-
* ```jsx
|
|
161
|
-
* const { changeLocale, currentLocale, toggleColorScheme } = useApplicationContext();
|
|
162
|
-
* ```
|
|
163
|
-
*/
|
|
164
|
-
var useApplicationContext = function useApplicationContext() {
|
|
165
|
-
var _useContext = react.useContext(GlobalContext);
|
|
166
|
-
_useContext.errorElement;
|
|
167
|
-
var rest = _objectWithoutProperties(_useContext, _excluded);
|
|
168
|
-
return rest;
|
|
169
|
-
};
|
|
170
|
-
|
|
171
|
-
/**
|
|
172
|
-
* Hook to access the notification manager from the global context.
|
|
173
|
-
* This hook provides methods to show alerts, errors, messages, and toasts.
|
|
174
|
-
* It returns a reference to the notification manager, which can be used to display notifications in the application.
|
|
175
|
-
*
|
|
176
|
-
* @returns {NotificationManagerRef} The notification manager reference.
|
|
177
|
-
*
|
|
178
|
-
* @example
|
|
179
|
-
* ```jsx
|
|
180
|
-
* const notificationService = useNotificationService();
|
|
181
|
-
* notificationService.showMessage("Hello World");
|
|
182
|
-
* ```
|
|
183
|
-
*
|
|
184
|
-
* @see {@link https://adarshpastakia.github.io/react-fabric/?path=/docs/core-components-notifications--notifications} for more details on available methods.
|
|
185
|
-
*/
|
|
186
|
-
var useNotificationService = function useNotificationService() {
|
|
187
|
-
var _useContext2 = react.useContext(GlobalContext),
|
|
188
|
-
notificationManager = _useContext2.notificationManager;
|
|
189
|
-
return notificationManager !== null && notificationManager !== void 0 ? notificationManager : {};
|
|
190
|
-
};
|
|
191
|
-
|
|
192
143
|
exports.ApplicationProvider = ApplicationProvider;
|
|
193
|
-
exports.GlobalContext = GlobalContext;
|
|
194
|
-
exports.useApplicationContext = useApplicationContext;
|
|
195
|
-
exports.useGlobals = useGlobals;
|
|
196
|
-
exports.useNotificationService = useNotificationService;
|