@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
|
@@ -5,65 +5,54 @@ import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProper
|
|
|
5
5
|
import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
|
|
6
6
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
7
7
|
import _regeneratorRuntime from '@babel/runtime/regenerator';
|
|
8
|
-
import { useState } from 'react';
|
|
8
|
+
import { useState, useRef } from 'react';
|
|
9
|
+
import { EMPTY_FC } from '@react-fabric/utilities';
|
|
9
10
|
import { jsx } from 'react/jsx-runtime';
|
|
10
11
|
|
|
11
12
|
var _excluded = ["onClose"];
|
|
12
13
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
13
14
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
14
|
-
/**
|
|
15
|
-
* Hook to manage overlay components like modals or flyouts.
|
|
16
|
-
* It provides a way to open an overlay with specified properties and handle its closure.
|
|
17
|
-
* This hook returns the current overlay component and a function to open it with props.
|
|
18
|
-
* It is useful for scenarios where you need to display overlays dynamically,
|
|
19
|
-
* such as modals, flyouts, or any other overlay components in a React application.
|
|
20
|
-
* The `openOverlay` function returns a promise that resolves with the result
|
|
21
|
-
* of the overlay when it is closed, allowing you to handle the result in a controlled manner.
|
|
22
|
-
*
|
|
23
|
-
* @param ModalOrFlyout - The component to be used as an overlay.
|
|
24
|
-
* @returns An array containing the current overlay and a function to open it.
|
|
25
|
-
*
|
|
26
|
-
* @example
|
|
27
|
-
* ```jsx
|
|
28
|
-
* const [Overlay, openOverlay] = useOverlayService(MyModalComponent);
|
|
29
|
-
* // To open the overlay:
|
|
30
|
-
* const handleOpen = async () => {
|
|
31
|
-
* const result = await openOverlay({ title: "My Modal", content: "Hello World" });
|
|
32
|
-
* console.log(result); // Handle the result from the overlay
|
|
33
|
-
* };
|
|
34
|
-
* <button onClick={handleOpen}>Open Modal</button>
|
|
35
|
-
* <Overlay />
|
|
36
|
-
* ```
|
|
37
|
-
*/
|
|
38
15
|
var useOverlayService = function useOverlayService(ModalOrFlyout) {
|
|
39
|
-
var _useState = useState(
|
|
16
|
+
var _useState = useState(EMPTY_FC),
|
|
40
17
|
_useState2 = _slicedToArray(_useState, 2),
|
|
41
18
|
Overlay = _useState2[0],
|
|
42
19
|
setOverlay = _useState2[1];
|
|
20
|
+
var existingOpenPromise = useRef(null);
|
|
43
21
|
var openOverlay = /*#__PURE__*/function () {
|
|
44
|
-
var _ref = _asyncToGenerator(
|
|
22
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
45
23
|
var _ref2,
|
|
46
24
|
onClose,
|
|
47
|
-
|
|
25
|
+
outerProps,
|
|
48
26
|
_args = arguments;
|
|
49
|
-
return _regeneratorRuntime.wrap(function
|
|
27
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
50
28
|
while (1) switch (_context.prev = _context.next) {
|
|
51
29
|
case 0:
|
|
52
|
-
_ref2 = _args.length > 0 && _args[0] !== undefined ? _args[0] : {}, onClose = _ref2.onClose,
|
|
53
|
-
|
|
30
|
+
_ref2 = _args.length > 0 && _args[0] !== undefined ? _args[0] : {}, onClose = _ref2.onClose, outerProps = _objectWithoutProperties(_ref2, _excluded);
|
|
31
|
+
if (!existingOpenPromise.current) {
|
|
32
|
+
_context.next = 1;
|
|
33
|
+
break;
|
|
34
|
+
}
|
|
35
|
+
return _context.abrupt("return");
|
|
36
|
+
case 1:
|
|
37
|
+
_context.next = 2;
|
|
54
38
|
return new Promise(function (resolve) {
|
|
55
|
-
|
|
56
|
-
setOverlay(
|
|
39
|
+
existingOpenPromise.current = function (args) {
|
|
40
|
+
setOverlay(EMPTY_FC);
|
|
57
41
|
resolve(args);
|
|
58
42
|
onClose === null || onClose === void 0 || onClose(args);
|
|
43
|
+
existingOpenPromise.current = null;
|
|
59
44
|
};
|
|
60
|
-
setOverlay(
|
|
61
|
-
|
|
62
|
-
|
|
45
|
+
setOverlay(function () {
|
|
46
|
+
return function (overrideProps) {
|
|
47
|
+
return /*#__PURE__*/jsx(ModalOrFlyout, _objectSpread(_objectSpread(_objectSpread({}, outerProps), overrideProps), {}, {
|
|
48
|
+
onClose: existingOpenPromise.current
|
|
49
|
+
}));
|
|
50
|
+
};
|
|
51
|
+
});
|
|
63
52
|
});
|
|
64
|
-
case
|
|
53
|
+
case 2:
|
|
65
54
|
return _context.abrupt("return", _context.sent);
|
|
66
|
-
case
|
|
55
|
+
case 3:
|
|
67
56
|
case "end":
|
|
68
57
|
return _context.stop();
|
|
69
58
|
}
|
|
@@ -73,7 +62,7 @@ var useOverlayService = function useOverlayService(ModalOrFlyout) {
|
|
|
73
62
|
return _ref.apply(this, arguments);
|
|
74
63
|
};
|
|
75
64
|
}();
|
|
76
|
-
return [Overlay, openOverlay];
|
|
65
|
+
return [Overlay, openOverlay, existingOpenPromise.current];
|
|
77
66
|
};
|
|
78
67
|
|
|
79
68
|
export { useOverlayService };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
4
|
-
import { useRef, useState,
|
|
4
|
+
import { useRef, useState, useEffectEvent } from 'react';
|
|
5
5
|
import { useLayoutEffectDebugger } from './useEffectDebugger.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -39,12 +39,12 @@ var usePropToggle = function usePropToggle() {
|
|
|
39
39
|
}, [isOn], "usePropToggle");
|
|
40
40
|
|
|
41
41
|
/** ***************** toggle handler *******************/
|
|
42
|
-
var doToggle =
|
|
42
|
+
var doToggle = useEffectEvent(function () {
|
|
43
43
|
if ((onToggle === null || onToggle === void 0 ? void 0 : onToggle(!toggleOn, key)) !== false) {
|
|
44
44
|
toggleRef.current = !toggleOn;
|
|
45
45
|
setToggleOn(!toggleOn);
|
|
46
46
|
}
|
|
47
|
-
}
|
|
47
|
+
});
|
|
48
48
|
return [toggleOn, doToggle, toggleRef];
|
|
49
49
|
};
|
|
50
50
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { useRef, useCallback } from 'react';
|
|
3
|
+
import { useRef, useCallback, useEffectEvent } from 'react';
|
|
4
4
|
import { useIsRtl } from './useIsRtl.js';
|
|
5
5
|
|
|
6
6
|
/*
|
|
@@ -59,14 +59,16 @@ var useResize = function useResize(onResize, _ref) {
|
|
|
59
59
|
/** ***************** check if reverse enabled of RTL *******************/
|
|
60
60
|
var reversed = ((isRtl ? 1 : 0) ^ (isReverse ? 1 : 0)) === 1;
|
|
61
61
|
var box = (_refEl$current = refEl.current) === null || _refEl$current === void 0 ? void 0 : _refEl$current.getBoundingClientRect();
|
|
62
|
-
var
|
|
63
|
-
var
|
|
62
|
+
var diffX = (box.left + box.right) / 2 * (reversed ? -1 : 1);
|
|
63
|
+
var diffY = (box.top + box.bottom) / 2;
|
|
64
|
+
var x = evt.clientX - diffX;
|
|
65
|
+
var y = evt.clientY - diffY;
|
|
64
66
|
onResize({
|
|
65
67
|
x: x,
|
|
66
68
|
y: y
|
|
67
69
|
});
|
|
68
70
|
}
|
|
69
|
-
}, [
|
|
71
|
+
}, [isRtl, isReverse, onResize]);
|
|
70
72
|
|
|
71
73
|
/** ***************** dettach handlers on mouseup *******************/
|
|
72
74
|
var onResizeEnd = useCallback(function () {
|
|
@@ -74,16 +76,16 @@ var useResize = function useResize(onResize, _ref) {
|
|
|
74
76
|
document.removeEventListener("mousemove", onResizing);
|
|
75
77
|
document.removeEventListener("mouseup", onResizeEnd);
|
|
76
78
|
onEnd === null || onEnd === void 0 || onEnd();
|
|
77
|
-
}, [
|
|
79
|
+
}, [onResizing, onEnd]);
|
|
78
80
|
|
|
79
81
|
/** ***************** attach handlers on mousedown *******************/
|
|
80
|
-
var onResizeStart =
|
|
82
|
+
var onResizeStart = useEffectEvent(function (e) {
|
|
81
83
|
e.preventDefault();
|
|
82
84
|
document.body.style.cursor = isVertical ? "row-resize" : "col-resize";
|
|
83
85
|
document.addEventListener("mousemove", onResizing);
|
|
84
86
|
document.addEventListener("mouseup", onResizeEnd);
|
|
85
87
|
onStart === null || onStart === void 0 || onStart();
|
|
86
|
-
}
|
|
88
|
+
});
|
|
87
89
|
return {
|
|
88
90
|
ref: refEl,
|
|
89
91
|
onMouseDown: onResizeStart
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
4
|
-
import { useRef, useTransition,
|
|
4
|
+
import { useRef, useTransition, useEffectEvent } from 'react';
|
|
5
5
|
import ResizeObserver from 'resize-observer-polyfill';
|
|
6
|
-
import {
|
|
6
|
+
import { useEffectDebugger } from './useEffectDebugger.js';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Custom hook to observe size changes of an element using ResizeObserver.
|
|
@@ -29,7 +29,7 @@ var useResizeObserver = function useResizeObserver(onResize) {
|
|
|
29
29
|
var _useTransition = useTransition(),
|
|
30
30
|
_useTransition2 = _slicedToArray(_useTransition, 2),
|
|
31
31
|
startTransition = _useTransition2[1];
|
|
32
|
-
var callbackResize =
|
|
32
|
+
var callbackResize = useEffectEvent(function () {
|
|
33
33
|
startTransition(function () {
|
|
34
34
|
if (onResize && ref.current != null) {
|
|
35
35
|
var _ref$current = ref.current,
|
|
@@ -41,8 +41,8 @@ var useResizeObserver = function useResizeObserver(onResize) {
|
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
43
|
});
|
|
44
|
-
}
|
|
45
|
-
|
|
44
|
+
});
|
|
45
|
+
useEffectDebugger(function () {
|
|
46
46
|
if (ref.current != null) {
|
|
47
47
|
var ob = new ResizeObserver(callbackResize);
|
|
48
48
|
ob.observe(ref.current);
|
|
@@ -50,7 +50,7 @@ var useResizeObserver = function useResizeObserver(onResize) {
|
|
|
50
50
|
ob.disconnect();
|
|
51
51
|
};
|
|
52
52
|
}
|
|
53
|
-
}, [
|
|
53
|
+
}, [], "useResizeObserver");
|
|
54
54
|
return ref;
|
|
55
55
|
};
|
|
56
56
|
|
|
@@ -11,7 +11,6 @@ import './useEffectDebugger.js';
|
|
|
11
11
|
import 'boring-avatars';
|
|
12
12
|
import { Icon } from '../components/icon/Icon.js';
|
|
13
13
|
import '@floating-ui/react';
|
|
14
|
-
import '../hotkeys/HotKeyWrapper.js';
|
|
15
14
|
import 'react-i18next';
|
|
16
15
|
import '@babel/runtime/helpers/toConsumableArray';
|
|
17
16
|
import '@babel/runtime/helpers/classCallCheck';
|
|
@@ -19,12 +18,9 @@ import '@babel/runtime/helpers/createClass';
|
|
|
19
18
|
import '@babel/runtime/helpers/possibleConstructorReturn';
|
|
20
19
|
import '@babel/runtime/helpers/getPrototypeOf';
|
|
21
20
|
import '@babel/runtime/helpers/inherits';
|
|
22
|
-
import 'i18next';
|
|
23
|
-
import '@babel/runtime/helpers/asyncToGenerator';
|
|
24
|
-
import '@babel/runtime/regenerator';
|
|
25
|
-
import 'react-dom';
|
|
26
21
|
import '../components/media/Media.js';
|
|
27
22
|
import '@babel/runtime/helpers/toArray';
|
|
23
|
+
import '../hotkeys/HotKeyWrapper.js';
|
|
28
24
|
|
|
29
25
|
var useStepper = function useStepper(_ref) {
|
|
30
26
|
var steps = _ref.steps,
|
|
@@ -39,7 +35,7 @@ var useStepper = function useStepper(_ref) {
|
|
|
39
35
|
}, [steps]);
|
|
40
36
|
var stepper = useMemo(function () {
|
|
41
37
|
return /*#__PURE__*/jsx("div", {
|
|
42
|
-
className: "fabric-stepper bg-
|
|
38
|
+
className: "fabric-stepper bg-default flex-1 flex justify-center py-1 px-2 overflow-x-auto",
|
|
43
39
|
children: steps.map(function (child, index) {
|
|
44
40
|
return /*#__PURE__*/jsxs("div", {
|
|
45
41
|
className: "fabric-stepper--pill",
|
|
@@ -1,20 +1,17 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
4
|
-
import { memo, useRef,
|
|
4
|
+
import { memo, useRef, useEffectEvent, useCallback } from 'react';
|
|
5
5
|
import { useEffectDebugger } from '../hooks/useEffectDebugger.js';
|
|
6
6
|
import { reduceHotKey } from './commons.js';
|
|
7
|
+
import { HotKeysContext } from './context.js';
|
|
7
8
|
import { jsx } from 'react/jsx-runtime';
|
|
8
9
|
|
|
9
|
-
var HotKeysContext = /*#__PURE__*/createContext({});
|
|
10
|
-
var useHotKeys = function useHotKeys() {
|
|
11
|
-
return useContext(HotKeysContext);
|
|
12
|
-
};
|
|
13
10
|
var HotKeyWrapper = /*#__PURE__*/memo(function (_ref) {
|
|
14
11
|
var children = _ref.children;
|
|
15
12
|
var refEl = useRef(null);
|
|
16
13
|
var keyList = useRef([]);
|
|
17
|
-
var addHotKey =
|
|
14
|
+
var addHotKey = useEffectEvent(function (keyCombo, handler) {
|
|
18
15
|
var global = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
19
16
|
return keyList.current = [].concat(_toConsumableArray(keyList.current.filter(function (_ref2) {
|
|
20
17
|
var _key = _ref2._key;
|
|
@@ -24,14 +21,14 @@ var HotKeyWrapper = /*#__PURE__*/memo(function (_ref) {
|
|
|
24
21
|
handler: handler,
|
|
25
22
|
global: global
|
|
26
23
|
})]);
|
|
27
|
-
}
|
|
28
|
-
var removeHotKey =
|
|
24
|
+
});
|
|
25
|
+
var removeHotKey = useEffectEvent(function (key) {
|
|
29
26
|
return keyList.current = _toConsumableArray(keyList.current.filter(function (_ref3) {
|
|
30
27
|
var _key = _ref3._key;
|
|
31
28
|
return _key !== key;
|
|
32
29
|
}));
|
|
33
|
-
}
|
|
34
|
-
var handler =
|
|
30
|
+
});
|
|
31
|
+
var handler = useEffectEvent(function (items, event) {
|
|
35
32
|
if (items.length === 0) return;
|
|
36
33
|
var keyCode = event.key,
|
|
37
34
|
code = event.code,
|
|
@@ -55,7 +52,7 @@ var HotKeyWrapper = /*#__PURE__*/memo(function (_ref) {
|
|
|
55
52
|
event.preventDefault();
|
|
56
53
|
event.stopImmediatePropagation();
|
|
57
54
|
}
|
|
58
|
-
}
|
|
55
|
+
});
|
|
59
56
|
var handleGlobal = useCallback(function (event) {
|
|
60
57
|
handler(keyList.current.filter(function (i) {
|
|
61
58
|
return i.global;
|
|
@@ -95,4 +92,4 @@ var HotKeyWrapper = /*#__PURE__*/memo(function (_ref) {
|
|
|
95
92
|
});
|
|
96
93
|
HotKeyWrapper.displayName = "HotKeyProvider";
|
|
97
94
|
|
|
98
|
-
export { HotKeyWrapper
|
|
95
|
+
export { HotKeyWrapper };
|
|
@@ -47,7 +47,7 @@ var reduceHotKey = function reduceHotKey(_ref) {
|
|
|
47
47
|
} else if (e.trim().toLowerCase() === "shift") {
|
|
48
48
|
item.shift = true;
|
|
49
49
|
} else {
|
|
50
|
-
if (e.trim().toLowerCase() === "left") item.key = "arrowleft";else if (e.trim().toLowerCase() === "right") item.key = "arrowright";else if (e.trim().toLowerCase() === "up") item.key = "arrowup";else if (e.trim().toLowerCase() === "down") item.key = "arrowdown";else if (e.trim().toLowerCase().startsWith("del")) item.key = "delete";else if (e.trim().toLowerCase().startsWith("esc")) item.key = "escape";else item.key = e.trim().toLowerCase();
|
|
50
|
+
if (e.trim().toLowerCase() === "left") item.key = "arrowleft";else if (e.trim().toLowerCase() === "right") item.key = "arrowright";else if (e.trim().toLowerCase() === "up") item.key = "arrowup";else if (e.trim().toLowerCase() === "down") item.key = "arrowdown";else if (e.trim().toLowerCase().startsWith("del")) item.key = "delete";else if (e.trim().toLowerCase().startsWith("esc")) item.key = "escape";else if (e.trim().toLowerCase().startsWith("plus")) item.key = "+";else if (e.trim().toLowerCase().startsWith("minus")) item.key = "-";else item.key = e.trim().toLowerCase();
|
|
51
51
|
}
|
|
52
52
|
});
|
|
53
53
|
return item;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { createContext, useContext } from 'react';
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
* React Fabric
|
|
7
|
+
* @version: 1.0.0
|
|
8
|
+
*
|
|
9
|
+
*
|
|
10
|
+
* The MIT License (MIT)
|
|
11
|
+
* Copyright (c) 2026 Adarsh Pastakia
|
|
12
|
+
*
|
|
13
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software
|
|
14
|
+
* and associated documentation files (the "Software"), to deal in the Software without restriction,
|
|
15
|
+
* including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
16
|
+
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
|
|
17
|
+
* subject to the following conditions:
|
|
18
|
+
*
|
|
19
|
+
* The above copyright notice and this permission notice shall be included in all copies or substantial
|
|
20
|
+
* portions of the Software.
|
|
21
|
+
*
|
|
22
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
|
|
23
|
+
* TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
24
|
+
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
25
|
+
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
/** @internal */
|
|
30
|
+
var HotKeysContext = /*#__PURE__*/createContext({});
|
|
31
|
+
var useHotKeys = function useHotKeys() {
|
|
32
|
+
return useContext(HotKeysContext);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export { HotKeysContext, useHotKeys };
|
package/dist/esm/i18n/index.js
CHANGED
package/dist/esm/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
export { ActionLabel } from './components/actionLabel/ActionLabel.js';
|
|
4
|
-
export { AnimationIndicator, LoadingBars, LoadingLine, LoadingSpinner, Skeleton } from './components/animations/Animations.js';
|
|
4
|
+
export { AnimationIndicator, AnimationLoader, LoadingBars, LoadingLine, LoadingSpinner, 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
|
-
export { Badge
|
|
7
|
+
export { Badge } from './components/badge/Badge.js';
|
|
8
8
|
export { Breadcrumbs } from './components/breadcrumbs/Breadcrumbs.js';
|
|
9
9
|
export { Button } from './components/button/Button.js';
|
|
10
10
|
export { ButtonGroup } from './components/button/ButtonGroup.js';
|
|
@@ -20,7 +20,7 @@ export { Divider } from './components/divider/Divider.js';
|
|
|
20
20
|
export { Dropdown, DropdownDismiss } from './components/dropdown/Dropdown.js';
|
|
21
21
|
export { DropdownTool } from './components/dropdown/DropdownTool.js';
|
|
22
22
|
export { EmptyContent } from './components/empty/EmptyContent.js';
|
|
23
|
-
export { Icon
|
|
23
|
+
export { Icon } from './components/icon/Icon.js';
|
|
24
24
|
export { Image, Video } from './components/media/Media.js';
|
|
25
25
|
export { ContextMenu } from './components/menu/ContextMenu.js';
|
|
26
26
|
export { Menu } from './components/menu/Menu.js';
|
|
@@ -52,7 +52,9 @@ import 'react';
|
|
|
52
52
|
import 'react-i18next';
|
|
53
53
|
export { Title } from './typography/Title.js';
|
|
54
54
|
export { cloneChildren } from './utils/cloneElement.js';
|
|
55
|
+
export { getBadgeProps } from './utils/getBadgeProps.js';
|
|
55
56
|
import '@react-fabric/utilities';
|
|
57
|
+
export { getIconProps } from './utils/getIconProps.js';
|
|
56
58
|
import 'react/jsx-runtime';
|
|
57
59
|
export { Flyout } from './overlays/flyout/Flyout.js';
|
|
58
60
|
export { Modal } from './overlays/modal/Modal.js';
|
|
@@ -63,6 +65,7 @@ export { Copy } from './typography/Copy.js';
|
|
|
63
65
|
export { Mark } from './typography/Mark.js';
|
|
64
66
|
export { Text } from './typography/Text.js';
|
|
65
67
|
export { useClientService } from './hooks/useClientService.js';
|
|
68
|
+
export { useContextMenu } from './hooks/useContextMenu.js';
|
|
66
69
|
export { useDebounce } from './hooks/useDebounce.js';
|
|
67
70
|
export { useEffectDebugger, useLayoutEffectDebugger, useMemoDebugger } from './hooks/useEffectDebugger.js';
|
|
68
71
|
export { useIsDark } from './hooks/useIsDark.js';
|
|
@@ -76,4 +79,5 @@ export { useLocalStorage, useSessionStorage } from './hooks/useStorage.js';
|
|
|
76
79
|
export { HotKey } from './hotkeys/HotKey.js';
|
|
77
80
|
export { HotKeyLabel } from './hotkeys/HotKeyLabel.js';
|
|
78
81
|
export { HotKeyWrapper } from './hotkeys/HotKeyWrapper.js';
|
|
79
|
-
export {
|
|
82
|
+
export { useApplicationContext, useNotificationService } from './context/context.js';
|
|
83
|
+
export { ApplicationProvider } from './context/Global.js';
|
|
@@ -4,15 +4,15 @@ import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
|
4
4
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
5
5
|
import { useFloating, useDismiss, useRole, useInteractions, FloatingPortal, FloatingOverlay, FloatingFocusManager } from '@floating-ui/react';
|
|
6
6
|
import classNames from 'classnames';
|
|
7
|
-
import { useState, useMemo,
|
|
7
|
+
import { useState, useMemo, useEffectEvent, useLayoutEffect } from 'react';
|
|
8
8
|
import { useTranslation } from 'react-i18next';
|
|
9
9
|
import { AnimationIndicator } from '../../components/animations/Animations.js';
|
|
10
10
|
import { Button } from '../../components/button/Button.js';
|
|
11
11
|
import { Icon } from '../../components/icon/Icon.js';
|
|
12
12
|
import { Title } from '../../typography/Title.js';
|
|
13
13
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
14
|
-
import { getColor } from '../../utils/getColor.js';
|
|
15
14
|
import '@react-fabric/utilities';
|
|
15
|
+
import { getColor } from '../../utils/getColor.js';
|
|
16
16
|
|
|
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; }
|
|
@@ -85,12 +85,12 @@ var Alert = function Alert(_ref) {
|
|
|
85
85
|
});
|
|
86
86
|
}
|
|
87
87
|
}, [color, type, icon, iconSrc, rtlFlip]);
|
|
88
|
-
var handleClose =
|
|
88
|
+
var handleClose = useEffectEvent(function (ret) {
|
|
89
89
|
refs.floating.current && (refs.floating.current.dataset.show = "false");
|
|
90
90
|
setTimeout(function () {
|
|
91
91
|
onClose(ret);
|
|
92
92
|
}, 250);
|
|
93
|
-
}
|
|
93
|
+
});
|
|
94
94
|
useLayoutEffect(function () {
|
|
95
95
|
setTimeout(function () {
|
|
96
96
|
return refs.floating.current && (refs.floating.current.dataset.show = "true");
|
|
@@ -105,9 +105,10 @@ var Alert = function Alert(_ref) {
|
|
|
105
105
|
className: "bg-tint-100/50 backdrop-blur-sm grid place-items-center",
|
|
106
106
|
children: /*#__PURE__*/jsx(FloatingFocusManager, {
|
|
107
107
|
context: context,
|
|
108
|
+
modal: true,
|
|
108
109
|
children: /*#__PURE__*/jsxs("dialog", _objectSpread(_objectSpread({
|
|
109
110
|
role: "alertdialog",
|
|
110
|
-
className: classNames("fabric-alert", "grid bg-
|
|
111
|
+
className: classNames("fabric-alert", "grid bg-default border-2 pointer-events-auto overflow-hidden rounded-capped select-none", "min-w-72 max-w-sm p-6 relative outline-0 shadow-lg"),
|
|
111
112
|
style: {
|
|
112
113
|
borderColor: getColor("".concat(color, "-300"))
|
|
113
114
|
},
|
|
@@ -170,7 +171,7 @@ var Alert = function Alert(_ref) {
|
|
|
170
171
|
children: okLabel !== null && okLabel !== void 0 ? okLabel : t("action.ok", "OK")
|
|
171
172
|
})]
|
|
172
173
|
}), /*#__PURE__*/jsx("div", {
|
|
173
|
-
className: "absolute top-2
|
|
174
|
+
className: "absolute top-2 inset-e-2",
|
|
174
175
|
children: /*#__PURE__*/jsx(Button, {
|
|
175
176
|
size: "sm",
|
|
176
177
|
variant: "link",
|
|
@@ -5,12 +5,13 @@ import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProper
|
|
|
5
5
|
import { useFloating, useDismiss, useRole, useInteractions, FloatingPortal, FloatingOverlay, FloatingFocusManager } from '@floating-ui/react';
|
|
6
6
|
import { isString } from '@react-fabric/utilities';
|
|
7
7
|
import classNames from 'classnames';
|
|
8
|
-
import {
|
|
8
|
+
import { useEffectEvent, useEffect, isValidElement } from 'react';
|
|
9
9
|
import { LoadingLine } from '../../components/animations/Animations.js';
|
|
10
|
-
import { Icon
|
|
10
|
+
import { Icon } from '../../components/icon/Icon.js';
|
|
11
11
|
import { Header } from '../../core/headfoot/HeadFoot.js';
|
|
12
12
|
import { HotKeyWrapper } from '../../hotkeys/HotKeyWrapper.js';
|
|
13
13
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
14
|
+
import { getIconProps } from '../../utils/getIconProps.js';
|
|
14
15
|
|
|
15
16
|
var _excluded = ["icon", "iconClassName", "title", "actions", "closeOnClick", "headerClassName", "onClose", "onBeforeClose", "children", "loading", "size", "width", "minWidth", "root", "hideMask", "align"];
|
|
16
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; }
|
|
@@ -52,7 +53,7 @@ var Flyout = function Flyout(_ref) {
|
|
|
52
53
|
// Merge all the interactions into prop getters
|
|
53
54
|
var _useInteractions = useInteractions([dismiss, role]),
|
|
54
55
|
getFloatingProps = _useInteractions.getFloatingProps;
|
|
55
|
-
var handleClose =
|
|
56
|
+
var handleClose = useEffectEvent(function () {
|
|
56
57
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
57
58
|
args[_key] = arguments[_key];
|
|
58
59
|
}
|
|
@@ -68,19 +69,19 @@ var Flyout = function Flyout(_ref) {
|
|
|
68
69
|
return (_refs$floating$curren = refs.floating.current) === null || _refs$floating$curren === void 0 || (_refs$floating$curren = _refs$floating$curren.querySelector('[role="dialog"]')) === null || _refs$floating$curren === void 0 ? void 0 : _refs$floating$curren.focus();
|
|
69
70
|
}, 50);
|
|
70
71
|
});
|
|
71
|
-
}
|
|
72
|
+
});
|
|
72
73
|
useEffect(function () {
|
|
73
74
|
setTimeout(function () {
|
|
74
75
|
refs.floating.current && (refs.floating.current.dataset.show = "true");
|
|
75
76
|
}, 50);
|
|
76
77
|
}, []);
|
|
77
|
-
var tryClosing =
|
|
78
|
+
var tryClosing = useEffectEvent(function (e) {
|
|
78
79
|
if (!!closeOnClick || e.target.closest("[data-flyout-dismiss='true']")) {
|
|
79
80
|
setTimeout(function () {
|
|
80
81
|
handleClose();
|
|
81
82
|
}, 100);
|
|
82
83
|
}
|
|
83
|
-
}
|
|
84
|
+
});
|
|
84
85
|
return /*#__PURE__*/jsxs(FloatingPortal, {
|
|
85
86
|
root: root,
|
|
86
87
|
children: [!hideMask && /*#__PURE__*/jsx(FloatingOverlay, {
|
|
@@ -92,9 +93,10 @@ var Flyout = function Flyout(_ref) {
|
|
|
92
93
|
className: "bg-tint-100/10 backdrop-blur-sm transition-all"
|
|
93
94
|
}), /*#__PURE__*/jsx(FloatingFocusManager, {
|
|
94
95
|
context: context,
|
|
96
|
+
modal: true,
|
|
95
97
|
children: /*#__PURE__*/jsx("div", _objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
96
98
|
"data-align": align,
|
|
97
|
-
className: classNames("fabric-flyout", "fixed inset-y-0 overflow-hidden flex flex-col flex-nowrap pointer-events-auto shadow-xl", align === "start" ? "
|
|
99
|
+
className: classNames("fabric-flyout", "fixed inset-y-0 overflow-hidden flex flex-col flex-nowrap pointer-events-auto shadow-xl", align === "start" ? "inset-s-0" : "inset-e-0", size === "sm" && "w-80", size === "md" && "w-160", size === "lg" && "w-[60vw]", size === "xl" && "w-[80vw]"),
|
|
98
100
|
style: {
|
|
99
101
|
width: width,
|
|
100
102
|
minWidth: minWidth
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import classNames from 'classnames';
|
|
4
|
-
import { useRef,
|
|
4
|
+
import { useRef, useEffectEvent, useLayoutEffect } from 'react';
|
|
5
5
|
import { Icon } from '../../components/icon/Icon.js';
|
|
6
6
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
7
|
-
import { getColor } from '../../utils/getColor.js';
|
|
8
7
|
import '@react-fabric/utilities';
|
|
8
|
+
import { getColor } from '../../utils/getColor.js';
|
|
9
9
|
|
|
10
10
|
/*
|
|
11
11
|
* React Fabric
|
|
@@ -40,19 +40,19 @@ var Message = function Message(_ref) {
|
|
|
40
40
|
actions = _ref.actions,
|
|
41
41
|
onClose = _ref.onClose;
|
|
42
42
|
var elRef = useRef(null);
|
|
43
|
-
var handleClose =
|
|
43
|
+
var handleClose = useEffectEvent(function (ret) {
|
|
44
44
|
elRef.current && (elRef.current.dataset.show = "false");
|
|
45
45
|
setTimeout(function () {
|
|
46
46
|
onClose(ret);
|
|
47
47
|
}, 250);
|
|
48
|
-
}
|
|
48
|
+
});
|
|
49
49
|
useLayoutEffect(function () {
|
|
50
50
|
setTimeout(function () {
|
|
51
51
|
return elRef.current && (elRef.current.dataset.show = "true");
|
|
52
52
|
}, 100);
|
|
53
53
|
}, []);
|
|
54
54
|
return /*#__PURE__*/jsxs("div", {
|
|
55
|
-
className: classNames("fabric-message", "flex flex-nowrap gap-1 px-8 relative justify-center max-w-md pointer-events-auto rounded mb-2 select-none"),
|
|
55
|
+
className: classNames("fabric-message", "flex flex-nowrap gap-1 px-8 relative justify-center items-center max-w-md pointer-events-auto rounded mb-2 select-none"),
|
|
56
56
|
style: {
|
|
57
57
|
backgroundColor: color ? getColor(color + "-300") : "var(--bg-color-invert)",
|
|
58
58
|
color: color ? getColor(color + "-900") : "var(--text-color-invert)"
|
|
@@ -77,7 +77,7 @@ var Message = function Message(_ref) {
|
|
|
77
77
|
children: actions
|
|
78
78
|
}), /*#__PURE__*/jsx("div", {
|
|
79
79
|
role: "none",
|
|
80
|
-
className: "cursor-pointer opacity-65 absolute
|
|
80
|
+
className: "cursor-pointer opacity-65 absolute inset-e-1 hover:opacity-90",
|
|
81
81
|
onClick: function onClick() {
|
|
82
82
|
return handleClose();
|
|
83
83
|
},
|
|
@@ -5,12 +5,13 @@ import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProper
|
|
|
5
5
|
import { useFloating, useDismiss, useRole, useInteractions, FloatingPortal, FloatingOverlay, FloatingFocusManager } from '@floating-ui/react';
|
|
6
6
|
import { isString } from '@react-fabric/utilities';
|
|
7
7
|
import classNames from 'classnames';
|
|
8
|
-
import {
|
|
8
|
+
import { useEffectEvent, useEffect, isValidElement } from 'react';
|
|
9
9
|
import { LoadingLine } from '../../components/animations/Animations.js';
|
|
10
|
-
import { Icon
|
|
10
|
+
import { Icon } from '../../components/icon/Icon.js';
|
|
11
11
|
import { Header } from '../../core/headfoot/HeadFoot.js';
|
|
12
12
|
import { HotKeyWrapper } from '../../hotkeys/HotKeyWrapper.js';
|
|
13
13
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
14
|
+
import { getIconProps } from '../../utils/getIconProps.js';
|
|
14
15
|
|
|
15
16
|
var _excluded = ["icon", "iconClassName", "title", "actions", "headerClassName", "onClose", "onBeforeClose", "children", "loading", "root", "size", "hideMask", "width", "height", "minHeight", "minWidth"];
|
|
16
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; }
|
|
@@ -50,7 +51,7 @@ var Modal = function Modal(_ref) {
|
|
|
50
51
|
// Merge all the interactions into prop getters
|
|
51
52
|
var _useInteractions = useInteractions([dismiss, role]),
|
|
52
53
|
getFloatingProps = _useInteractions.getFloatingProps;
|
|
53
|
-
var handleClose =
|
|
54
|
+
var handleClose = useEffectEvent(function () {
|
|
54
55
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
55
56
|
args[_key] = arguments[_key];
|
|
56
57
|
}
|
|
@@ -66,7 +67,7 @@ var Modal = function Modal(_ref) {
|
|
|
66
67
|
return (_refs$floating$curren = refs.floating.current) === null || _refs$floating$curren === void 0 || (_refs$floating$curren = _refs$floating$curren.querySelector("[role='dialog']")) === null || _refs$floating$curren === void 0 ? void 0 : _refs$floating$curren.focus();
|
|
67
68
|
}, 50);
|
|
68
69
|
});
|
|
69
|
-
}
|
|
70
|
+
});
|
|
70
71
|
useEffect(function () {
|
|
71
72
|
setTimeout(function () {
|
|
72
73
|
refs.floating.current && (refs.floating.current.dataset.show = "true");
|
|
@@ -84,6 +85,7 @@ var Modal = function Modal(_ref) {
|
|
|
84
85
|
className: classNames("grid place-items-center p-16", !hideMask && "bg-tint-100/20 backdrop-blur-sm"),
|
|
85
86
|
children: /*#__PURE__*/jsx(FloatingFocusManager, {
|
|
86
87
|
context: context,
|
|
88
|
+
modal: true,
|
|
87
89
|
children: /*#__PURE__*/jsx("dialog", _objectSpread(_objectSpread(_objectSpread({
|
|
88
90
|
className: classNames("fabric-modal", "rounded-capped relative overflow-hidden flex flex-col flex-nowrap", "ring-2 ring-offset-2 ring-tint-100 focus-within:ring-primary-300 shadow-xl", size === "sm" && "w-[20rem]", size === "md" && "w-160", size === "lg" && "w-[60vw]", size === "xl" && "w-[80vw]", size === "screen" && "w-screen h-screen"),
|
|
89
91
|
style: {
|