@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
|
@@ -35,16 +35,12 @@ import {
|
|
|
35
35
|
type ExpandProps,
|
|
36
36
|
type TestProps,
|
|
37
37
|
} from "../../types";
|
|
38
|
+
import { getIconProps } from "../../utils";
|
|
38
39
|
import { LoadingLine } from "../animations/Animations";
|
|
39
|
-
import {
|
|
40
|
+
import { Icon, type IconProps } from "../icon/Icon";
|
|
40
41
|
|
|
41
42
|
export interface PanelProps
|
|
42
|
-
extends CssProp,
|
|
43
|
-
AriaProps,
|
|
44
|
-
TestProps,
|
|
45
|
-
ExpandProps,
|
|
46
|
-
CollapseProps,
|
|
47
|
-
ChildrenProp<HeadFootProps | ContentProps> {
|
|
43
|
+
extends CssProp, AriaProps, TestProps, ExpandProps, CollapseProps, ChildrenProp<HeadFootProps | ContentProps> {
|
|
48
44
|
/**
|
|
49
45
|
* panel id used by panel stack
|
|
50
46
|
*/
|
|
@@ -56,7 +52,7 @@ export interface PanelProps
|
|
|
56
52
|
/**
|
|
57
53
|
* header actions
|
|
58
54
|
*/
|
|
59
|
-
actions?:
|
|
55
|
+
actions?: React.ReactElement;
|
|
60
56
|
/**
|
|
61
57
|
* header css classname(s)
|
|
62
58
|
*/
|
|
@@ -112,7 +108,7 @@ export interface PanelProps
|
|
|
112
108
|
* It can be used in various applications where panels are needed, such as dashboards, settings pages, or content management systems.
|
|
113
109
|
*
|
|
114
110
|
* @param {PanelProps} props - The properties for the Panel component.
|
|
115
|
-
* @returns {
|
|
111
|
+
* @returns {React.ReactElement} The rendered Panel component.
|
|
116
112
|
*
|
|
117
113
|
* @example
|
|
118
114
|
* ```jsx
|
|
@@ -165,11 +161,7 @@ export const Panel = ({
|
|
|
165
161
|
onBack,
|
|
166
162
|
...aria
|
|
167
163
|
}: PanelProps) => {
|
|
168
|
-
const [collapsed, toggleCollapse] = usePropToggle(
|
|
169
|
-
_collapsed,
|
|
170
|
-
onCollapse,
|
|
171
|
-
panelId,
|
|
172
|
-
);
|
|
164
|
+
const [collapsed, toggleCollapse] = usePropToggle(_collapsed, onCollapse, panelId);
|
|
173
165
|
const [expanded, toggleExpand] = usePropToggle(_expanded, onExpand, panelId);
|
|
174
166
|
|
|
175
167
|
const hasTools = useMemo(() => {
|
|
@@ -205,11 +197,7 @@ export const Panel = ({
|
|
|
205
197
|
{expanded && <HotKey keyCombo="esc" handler={toggleExpand} />}
|
|
206
198
|
<header
|
|
207
199
|
role="none"
|
|
208
|
-
className={classNames(
|
|
209
|
-
"fabric-panelHeader",
|
|
210
|
-
headerClassName,
|
|
211
|
-
"flex flex-nowrap items-center area-head",
|
|
212
|
-
)}
|
|
200
|
+
className={classNames("fabric-panelHeader", headerClassName, "flex flex-nowrap items-center area-head")}
|
|
213
201
|
data-ref="panelHeader"
|
|
214
202
|
onClick={collapsable ? toggleCollapse : undefined}
|
|
215
203
|
>
|
|
@@ -222,37 +210,16 @@ export const Panel = ({
|
|
|
222
210
|
onClick={onBack}
|
|
223
211
|
/>
|
|
224
212
|
)}
|
|
225
|
-
{icon && (
|
|
226
|
-
|
|
227
|
-
className="p-2 text-md select-none pointer-events-none"
|
|
228
|
-
{...getIconProps(icon)}
|
|
229
|
-
/>
|
|
230
|
-
)}
|
|
231
|
-
<div
|
|
232
|
-
className={classNames(
|
|
233
|
-
titleClassName,
|
|
234
|
-
"flex-1 select-none truncate",
|
|
235
|
-
title && "py-1 first:px-2",
|
|
236
|
-
)}
|
|
237
|
-
>
|
|
238
|
-
{title}
|
|
239
|
-
</div>
|
|
213
|
+
{icon && <Icon className="p-2 text-md select-none pointer-events-none" {...getIconProps(icon)} />}
|
|
214
|
+
<div className={classNames(titleClassName, "flex-1 select-none truncate", title && "py-1 first:px-2")}>{title}</div>
|
|
240
215
|
<div className="px-1 leading-none">{actions}</div>
|
|
241
216
|
{hasTools && (
|
|
242
|
-
<div
|
|
243
|
-
role="none"
|
|
244
|
-
className="px-1 gap-px flex"
|
|
245
|
-
onClick={(e) => e.stopPropagation()}
|
|
246
|
-
>
|
|
217
|
+
<div role="none" className="px-1 gap-px flex" onClick={(e) => e.stopPropagation()}>
|
|
247
218
|
{expandable && (
|
|
248
219
|
<Icon
|
|
249
220
|
data-ref="panelExpand"
|
|
250
221
|
className={classNames("fabric-panelAction", "cursor-pointer")}
|
|
251
|
-
icon={
|
|
252
|
-
expanded
|
|
253
|
-
? "icon-[mdi--fullscreen-exit]"
|
|
254
|
-
: "icon-[mdi--fullscreen]"
|
|
255
|
-
}
|
|
222
|
+
icon={expanded ? "icon-[mdi--fullscreen-exit]" : "icon-[mdi--fullscreen]"}
|
|
256
223
|
onClick={toggleExpand}
|
|
257
224
|
/>
|
|
258
225
|
)}
|
|
@@ -260,9 +227,7 @@ export const Panel = ({
|
|
|
260
227
|
<Icon
|
|
261
228
|
data-ref="panelCollapse"
|
|
262
229
|
className={classNames("fabric-panelAction", "cursor-pointer")}
|
|
263
|
-
icon={
|
|
264
|
-
collapsed ? "icon-[mdi--plus-box]" : "icon-[mdi--minus-box]"
|
|
265
|
-
}
|
|
230
|
+
icon={collapsed ? "icon-[mdi--plus-box-outline]" : "icon-[mdi--minus-box-outline]"}
|
|
266
231
|
onClick={toggleCollapse}
|
|
267
232
|
/>
|
|
268
233
|
)}
|
|
@@ -278,13 +243,7 @@ export const Panel = ({
|
|
|
278
243
|
)}
|
|
279
244
|
</header>
|
|
280
245
|
{(!collapsed || expanded) && (
|
|
281
|
-
<div
|
|
282
|
-
data-ref="panelBody"
|
|
283
|
-
className={classNames(
|
|
284
|
-
"fabric-panelBody",
|
|
285
|
-
"area-content grid overflow-hidden",
|
|
286
|
-
)}
|
|
287
|
-
>
|
|
246
|
+
<div data-ref="panelBody" className={classNames("fabric-panelBody", "area-content grid overflow-hidden")}>
|
|
288
247
|
{loading && <LoadingLine />}
|
|
289
248
|
{children}
|
|
290
249
|
</div>
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
24
|
import classNames from "classnames";
|
|
25
|
-
import { Children, cloneElement,
|
|
25
|
+
import { Children, cloneElement, useEffectEvent, useState } from "react";
|
|
26
26
|
import {
|
|
27
27
|
useEffectDebugger,
|
|
28
28
|
useMemoDebugger,
|
|
@@ -48,7 +48,7 @@ export interface PanelGroupProps extends ChildrenProp {
|
|
|
48
48
|
* It uses the `Panel` component to render each individual panel within the group.
|
|
49
49
|
*
|
|
50
50
|
* @param {PanelGroupProps} props - The properties for the PanelGroup component.
|
|
51
|
-
* @returns {
|
|
51
|
+
* @returns {React.ReactElement} The rendered PanelGroup component.
|
|
52
52
|
*
|
|
53
53
|
* @example
|
|
54
54
|
* ```jsx
|
|
@@ -88,7 +88,7 @@ export const PanelGroup = ({
|
|
|
88
88
|
"PanelGroup setActive",
|
|
89
89
|
);
|
|
90
90
|
|
|
91
|
-
const changeExpanded =
|
|
91
|
+
const changeExpanded = useEffectEvent(
|
|
92
92
|
(collapsed: boolean, id: string, handler?: AnyObject) => {
|
|
93
93
|
if (!collapsed) {
|
|
94
94
|
setExpandedPanel(id);
|
|
@@ -97,7 +97,6 @@ export const PanelGroup = ({
|
|
|
97
97
|
handler?.(collapsed);
|
|
98
98
|
return id !== expandedPanel;
|
|
99
99
|
},
|
|
100
|
-
[onActiveChange, expandedPanel],
|
|
101
100
|
);
|
|
102
101
|
|
|
103
102
|
return (
|
|
@@ -25,8 +25,8 @@ import {
|
|
|
25
25
|
Children,
|
|
26
26
|
cloneElement,
|
|
27
27
|
type MouseEvent,
|
|
28
|
-
useCallback,
|
|
29
28
|
useEffect,
|
|
29
|
+
useEffectEvent,
|
|
30
30
|
useMemo,
|
|
31
31
|
useRef,
|
|
32
32
|
useState,
|
|
@@ -60,7 +60,7 @@ export interface PanelStackProps extends CssProp, ChildrenProp {
|
|
|
60
60
|
* and it updates the active panel based on user interactions.
|
|
61
61
|
*
|
|
62
62
|
* @param {PanelStackProps} props - The properties for the PanelStack component.
|
|
63
|
-
* @returns {
|
|
63
|
+
* @returns {React.ReactElement} The rendered PanelStack component.
|
|
64
64
|
*
|
|
65
65
|
* @example
|
|
66
66
|
* ```jsx
|
|
@@ -112,40 +112,35 @@ export const PanelStack = ({
|
|
|
112
112
|
});
|
|
113
113
|
}, [onPanelChange, history]);
|
|
114
114
|
|
|
115
|
-
const goBack =
|
|
116
|
-
|
|
115
|
+
const goBack = useEffectEvent(() => {
|
|
117
116
|
if (onBack?.(history[0], history[1] ?? "root") !== false) {
|
|
118
117
|
setHistory(history.slice(1));
|
|
119
118
|
}
|
|
120
|
-
}
|
|
119
|
+
});
|
|
121
120
|
|
|
122
121
|
const currentPanel = useMemo<AnyObject>(
|
|
123
122
|
() => panels.get(history[0]) ?? panels.values().next().value,
|
|
124
123
|
[history, panels],
|
|
125
124
|
);
|
|
126
125
|
|
|
127
|
-
const checkMenuClick =
|
|
128
|
-
(e
|
|
129
|
-
|
|
130
|
-
if (panelKey) {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
if (onBack?.(history[0], "root") !== false) {
|
|
136
|
-
setHistory([]);
|
|
137
|
-
}
|
|
138
|
-
} else if (panels.has(panelKey)) {
|
|
139
|
-
setHistory([panelKey, ...history]);
|
|
126
|
+
const checkMenuClick = useEffectEvent((e: MouseEvent) => {
|
|
127
|
+
const panelKey = (e.target as HTMLElement)?.dataset?.panel;
|
|
128
|
+
if (panelKey) {
|
|
129
|
+
if (panelKey === "back") {
|
|
130
|
+
goBack();
|
|
131
|
+
} else if (panelKey === "root") {
|
|
132
|
+
if (onBack?.(history[0], "root") !== false) {
|
|
133
|
+
setHistory([]);
|
|
140
134
|
}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
return false;
|
|
135
|
+
} else if (panels.has(panelKey)) {
|
|
136
|
+
setHistory([panelKey, ...history]);
|
|
144
137
|
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
138
|
+
e.stopPropagation();
|
|
139
|
+
e.preventDefault();
|
|
140
|
+
return false;
|
|
141
|
+
}
|
|
142
|
+
return true;
|
|
143
|
+
});
|
|
149
144
|
|
|
150
145
|
return (
|
|
151
146
|
<div
|
|
@@ -67,7 +67,7 @@ const SizeMap: KeyValue = {
|
|
|
67
67
|
* The label can be customized or hidden based on the props provided.
|
|
68
68
|
*
|
|
69
69
|
* @param {ProgressProps} props - The properties for the ProgressBar component.
|
|
70
|
-
* @returns {
|
|
70
|
+
* @returns {React.ReactElement} The rendered ProgressBar component.
|
|
71
71
|
*
|
|
72
72
|
* @example
|
|
73
73
|
* ```jsx
|
|
@@ -107,7 +107,7 @@ export const ProgressBar = ({
|
|
|
107
107
|
<div
|
|
108
108
|
className={classNames(
|
|
109
109
|
"fabric-progressbar",
|
|
110
|
-
"block bg-
|
|
110
|
+
"block bg-tint-50 relative rounded font-bold overflow-hidden whitespace-nowrap",
|
|
111
111
|
)}
|
|
112
112
|
style={{
|
|
113
113
|
...progressVar,
|
|
@@ -56,7 +56,7 @@ const SizeMap: KeyValue = {
|
|
|
56
56
|
* The component is customizable with size and color props.
|
|
57
57
|
*
|
|
58
58
|
* @param {ProgressProps} props - The properties for the ProgressCircle component.
|
|
59
|
-
* @returns {
|
|
59
|
+
* @returns {React.ReactElement} - A circular progress indicator.
|
|
60
60
|
*
|
|
61
61
|
* @example
|
|
62
62
|
* ```jsx
|
|
@@ -100,7 +100,7 @@ export const ProgressCircle = ({
|
|
|
100
100
|
>
|
|
101
101
|
<svg
|
|
102
102
|
viewBox="0 0 100 100"
|
|
103
|
-
className={classNames("absolute inset-0 w-full h-full stroke-
|
|
103
|
+
className={classNames("absolute inset-0 w-full h-full stroke-tint-500")}
|
|
104
104
|
>
|
|
105
105
|
<circle
|
|
106
106
|
cx="50"
|
|
@@ -37,17 +37,12 @@ import {
|
|
|
37
37
|
type TestProps,
|
|
38
38
|
type TooltipProp,
|
|
39
39
|
} from "../../types";
|
|
40
|
-
import {
|
|
40
|
+
import { getBadgeProps, getIconProps } from "../../utils";
|
|
41
|
+
import { Badge } from "../badge/Badge";
|
|
41
42
|
import { DropdownTool } from "../dropdown/DropdownTool";
|
|
42
|
-
import {
|
|
43
|
+
import { Icon, type IconProps } from "../icon/Icon";
|
|
43
44
|
|
|
44
|
-
export interface TabProps
|
|
45
|
-
extends Partial<ChildrenProp>,
|
|
46
|
-
CssProp,
|
|
47
|
-
RefProp,
|
|
48
|
-
AriaProps,
|
|
49
|
-
TestProps,
|
|
50
|
-
TooltipProp {
|
|
45
|
+
export interface TabProps extends Partial<ChildrenProp>, CssProp, RefProp, AriaProps, TestProps, TooltipProp {
|
|
51
46
|
/**
|
|
52
47
|
* tab id
|
|
53
48
|
*/
|
|
@@ -100,7 +95,7 @@ export interface TabProps
|
|
|
100
95
|
* It also supports tooltips, active states, and click handling.
|
|
101
96
|
*
|
|
102
97
|
* @param {TabProps} props - The properties for the Tab component.
|
|
103
|
-
* @returns {
|
|
98
|
+
* @returns {React.ReactElement} The rendered Tab component.
|
|
104
99
|
*
|
|
105
100
|
* @example
|
|
106
101
|
* ```jsx
|
|
@@ -179,29 +174,15 @@ export const Tab = <Tag extends React.ElementType = "button">({
|
|
|
179
174
|
{...aria}
|
|
180
175
|
>
|
|
181
176
|
{icon && <Icon className="flex-content p-2" {...getIconProps(icon)} />}
|
|
182
|
-
{!minimal &&
|
|
183
|
-
<label className="flex-initial truncate text-center px-1 py-1">
|
|
184
|
-
{label}
|
|
185
|
-
</label>
|
|
186
|
-
)}
|
|
177
|
+
{!minimal && <label className="flex-initial truncate text-center px-1 py-1">{label}</label>}
|
|
187
178
|
{badge && (
|
|
188
|
-
<Badge
|
|
189
|
-
{...badgeProps}
|
|
190
|
-
placement={minimal ? "end" : ""}
|
|
191
|
-
className={classNames("me-1", badgeProps.className)}
|
|
192
|
-
/>
|
|
193
|
-
)}
|
|
194
|
-
{actions && active && (
|
|
195
|
-
<DropdownTool className="bg-tint-50/20 me-1 z-5">
|
|
196
|
-
{actions}
|
|
197
|
-
</DropdownTool>
|
|
179
|
+
<Badge {...badgeProps} placement={minimal ? "end" : ""} className={classNames("me-1", badgeProps.className)} />
|
|
198
180
|
)}
|
|
181
|
+
{actions && active && <DropdownTool className="bg-tint-50/20 me-1 z-5">{actions}</DropdownTool>}
|
|
199
182
|
{onClose && (
|
|
200
183
|
<span
|
|
201
184
|
role="none"
|
|
202
|
-
className={classNames(
|
|
203
|
-
"cursor-pointer me-1 opacity-65 hover:opacity-90 pointer-events-auto",
|
|
204
|
-
)}
|
|
185
|
+
className={classNames("cursor-pointer me-1 opacity-65 hover:opacity-90 pointer-events-auto")}
|
|
205
186
|
onClick={(e) => {
|
|
206
187
|
onClose?.();
|
|
207
188
|
e.stopPropagation();
|
|
@@ -21,12 +21,13 @@
|
|
|
21
21
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
|
+
import { getValue } from "@react-fabric/utilities";
|
|
24
25
|
import classNames from "classnames";
|
|
25
26
|
import {
|
|
26
27
|
Children,
|
|
27
28
|
cloneElement,
|
|
28
|
-
useCallback,
|
|
29
29
|
useEffect,
|
|
30
|
+
useEffectEvent,
|
|
30
31
|
useMemo,
|
|
31
32
|
useState,
|
|
32
33
|
} from "react";
|
|
@@ -100,7 +101,7 @@ export interface TabPanelProps extends ChildrenProp<typeof Tab> {
|
|
|
100
101
|
* It can be customized with different styles and behaviors to fit the needs of the application.
|
|
101
102
|
*
|
|
102
103
|
* @param {TabPanelProps} props - The properties for the TabPanel component.
|
|
103
|
-
* @returns {
|
|
104
|
+
* @returns {React.ReactElement} The rendered TabPanel component.
|
|
104
105
|
*
|
|
105
106
|
* @example
|
|
106
107
|
* ```jsx
|
|
@@ -153,7 +154,7 @@ export const TabPanel = ({
|
|
|
153
154
|
}, [children]);
|
|
154
155
|
|
|
155
156
|
useEffect(() => {
|
|
156
|
-
setActive(activeTab);
|
|
157
|
+
setActive(getValue(activeTab ?? tabs[0]?.props.id));
|
|
157
158
|
}, [activeTab]);
|
|
158
159
|
|
|
159
160
|
const activeTabPanel = useMemo(() => {
|
|
@@ -161,23 +162,20 @@ export const TabPanel = ({
|
|
|
161
162
|
.children;
|
|
162
163
|
}, [tabs, active]);
|
|
163
164
|
|
|
164
|
-
const handleClick =
|
|
165
|
-
(id
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
},
|
|
173
|
-
[onBeforeChange, onChange, active],
|
|
174
|
-
);
|
|
165
|
+
const handleClick = useEffectEvent((id: string) => {
|
|
166
|
+
void Promise.resolve(onBeforeChange?.(id, active)).then((ret) => {
|
|
167
|
+
if (ret !== false) {
|
|
168
|
+
setActive(id);
|
|
169
|
+
onChange?.(id);
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
});
|
|
175
173
|
|
|
176
174
|
return (
|
|
177
175
|
<div
|
|
178
176
|
className={classNames(
|
|
179
177
|
"fabric-tabPanel",
|
|
180
|
-
"area-content grid bg-
|
|
178
|
+
"area-content grid bg-default overflow-hidden",
|
|
181
179
|
)}
|
|
182
180
|
data-orientation={orientation}
|
|
183
181
|
data-variant={variant ?? "default"}
|
package/src/context/Global.tsx
CHANGED
|
@@ -22,21 +22,10 @@
|
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
24
|
import i18next from "i18next";
|
|
25
|
-
import {
|
|
26
|
-
createContext,
|
|
27
|
-
useCallback,
|
|
28
|
-
useContext,
|
|
29
|
-
useEffect,
|
|
30
|
-
useState,
|
|
31
|
-
type ComponentType,
|
|
32
|
-
type FC,
|
|
33
|
-
type PropsWithChildren,
|
|
34
|
-
} from "react";
|
|
25
|
+
import { useCallback, useEffect, useState, type ComponentType, type FC, type PropsWithChildren } from "react";
|
|
35
26
|
import { HotKeyWrapper } from "../hotkeys/HotKeyWrapper";
|
|
36
|
-
import {
|
|
37
|
-
|
|
38
|
-
type NotificationManagerRef,
|
|
39
|
-
} from "./NotificationCenter";
|
|
27
|
+
import { NotificationManager, type NotificationManagerRef } from "./NotificationCenter";
|
|
28
|
+
import { GlobalContext } from "./context";
|
|
40
29
|
|
|
41
30
|
interface State {
|
|
42
31
|
locale: string;
|
|
@@ -55,69 +44,24 @@ export interface GlobalProps extends PropsWithChildren {
|
|
|
55
44
|
defaultColorScheme?: State["colorScheme"];
|
|
56
45
|
}
|
|
57
46
|
|
|
58
|
-
interface GlobalContextType {
|
|
59
|
-
/**
|
|
60
|
-
* change language locale
|
|
61
|
-
* @param locale
|
|
62
|
-
*/
|
|
63
|
-
changeLocale: (locale: string) => string;
|
|
64
|
-
/**
|
|
65
|
-
* change date calendat
|
|
66
|
-
* @param locale
|
|
67
|
-
*/
|
|
68
|
-
changeCalendar: (calendar: State["calendar"]) => State["calendar"];
|
|
69
|
-
/**
|
|
70
|
-
* toggle theme between light and dark
|
|
71
|
-
* or force to theme provided
|
|
72
|
-
* @param theme
|
|
73
|
-
*/
|
|
74
|
-
toggleColorScheme: (
|
|
75
|
-
colorScheme?: State["colorScheme"],
|
|
76
|
-
) => State["colorScheme"];
|
|
77
|
-
/**
|
|
78
|
-
* application default error display
|
|
79
|
-
*/
|
|
80
|
-
errorElement: GlobalProps["errorElement"];
|
|
81
|
-
|
|
82
|
-
currentLocale: string;
|
|
83
|
-
currentCalendar: State["calendar"];
|
|
84
|
-
currentColorScheme: State["colorScheme"];
|
|
85
|
-
|
|
86
|
-
notificationManager: NotificationManagerRef;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
47
|
const KEY_LOCALE = "ruf:locale";
|
|
90
48
|
const KEY_CALENDAR = "ruf:calendar";
|
|
91
49
|
const KEY_COLOR_SCHEME = "ruf:colorScheme";
|
|
92
50
|
const systemLocale = () => {
|
|
93
|
-
return (
|
|
94
|
-
(typeof window !== "undefined"
|
|
95
|
-
? localStorage.getItem(KEY_LOCALE)
|
|
96
|
-
: undefined) ?? "en"
|
|
97
|
-
);
|
|
51
|
+
return (typeof window !== "undefined" ? localStorage.getItem(KEY_LOCALE) : undefined) ?? "en";
|
|
98
52
|
};
|
|
99
53
|
const systemCalendar = () => {
|
|
100
|
-
return (
|
|
101
|
-
(typeof window !== "undefined"
|
|
102
|
-
? (localStorage.getItem(KEY_CALENDAR) as AnyObject)
|
|
103
|
-
: undefined) ?? "gregorian"
|
|
104
|
-
);
|
|
54
|
+
return (typeof window !== "undefined" ? (localStorage.getItem(KEY_CALENDAR) as AnyObject) : undefined) ?? "gregorian";
|
|
105
55
|
};
|
|
106
56
|
const systemColorScheme = () => {
|
|
107
57
|
const theme: AnyObject =
|
|
108
58
|
typeof window !== "undefined"
|
|
109
|
-
? localStorage.getItem(KEY_COLOR_SCHEME) ??
|
|
110
|
-
(window.matchMedia("(prefers-color-scheme: dark)").matches
|
|
111
|
-
? "dark"
|
|
112
|
-
: "light")
|
|
59
|
+
? (localStorage.getItem(KEY_COLOR_SCHEME) ??
|
|
60
|
+
(window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light"))
|
|
113
61
|
: "light";
|
|
114
62
|
return theme;
|
|
115
63
|
};
|
|
116
64
|
|
|
117
|
-
export const GlobalContext = createContext<GlobalContextType>(
|
|
118
|
-
{} as GlobalContextType,
|
|
119
|
-
);
|
|
120
|
-
|
|
121
65
|
/**
|
|
122
66
|
* global context provider
|
|
123
67
|
*/
|
|
@@ -128,23 +72,16 @@ export const ApplicationProvider: FC<GlobalProps> = ({
|
|
|
128
72
|
defaultCalendar,
|
|
129
73
|
defaultColorScheme,
|
|
130
74
|
}) => {
|
|
131
|
-
const [refNotifications, setNotificationRef] =
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
const [
|
|
140
|
-
|
|
141
|
-
);
|
|
142
|
-
const [calendar, setCalendar] = useState<State["calendar"]>(
|
|
143
|
-
defaultCalendar ?? systemCalendar(),
|
|
144
|
-
);
|
|
145
|
-
const [locale, setLocale] = useState<State["locale"]>(
|
|
146
|
-
defaultLocale ?? systemLocale(),
|
|
147
|
-
);
|
|
75
|
+
const [refNotifications, setNotificationRef] = useState<NotificationManagerRef>({
|
|
76
|
+
closeAll: () => undefined,
|
|
77
|
+
showAlert: () => undefined as AnyObject,
|
|
78
|
+
showError: () => undefined as AnyObject,
|
|
79
|
+
showMessage: () => undefined as AnyObject,
|
|
80
|
+
showToast: () => undefined as AnyObject,
|
|
81
|
+
});
|
|
82
|
+
const [colorScheme, setColorScheme] = useState<State["colorScheme"]>(defaultColorScheme ?? systemColorScheme());
|
|
83
|
+
const [calendar, setCalendar] = useState<State["calendar"]>(defaultCalendar ?? systemCalendar());
|
|
84
|
+
const [locale, setLocale] = useState<State["locale"]>(defaultLocale ?? systemLocale());
|
|
148
85
|
|
|
149
86
|
useEffect(() => {
|
|
150
87
|
defaultColorScheme && setColorScheme(defaultColorScheme);
|
|
@@ -172,14 +109,12 @@ export const ApplicationProvider: FC<GlobalProps> = ({
|
|
|
172
109
|
/** ***************** theme toggle *******************/
|
|
173
110
|
const toggleColorScheme = useCallback(
|
|
174
111
|
(forceTheme?: State["colorScheme"]) => {
|
|
175
|
-
const newTheme =
|
|
176
|
-
forceTheme ?? (colorScheme === "dark" ? "light" : "dark");
|
|
112
|
+
const newTheme = forceTheme ?? (colorScheme === "dark" ? "light" : "dark");
|
|
177
113
|
setColorScheme(newTheme);
|
|
178
114
|
localStorage.setItem(KEY_COLOR_SCHEME, newTheme);
|
|
179
115
|
document.documentElement.dataset.colorScheme = newTheme;
|
|
180
116
|
return newTheme;
|
|
181
117
|
},
|
|
182
|
-
|
|
183
118
|
[colorScheme],
|
|
184
119
|
);
|
|
185
120
|
|
|
@@ -224,45 +159,3 @@ export const ApplicationProvider: FC<GlobalProps> = ({
|
|
|
224
159
|
</GlobalContext.Provider>
|
|
225
160
|
);
|
|
226
161
|
};
|
|
227
|
-
|
|
228
|
-
/**
|
|
229
|
-
* internal usage only
|
|
230
|
-
* @internal
|
|
231
|
-
*/
|
|
232
|
-
export const useGlobals = () => useContext(GlobalContext);
|
|
233
|
-
|
|
234
|
-
/**
|
|
235
|
-
* Hook to access the global application context.
|
|
236
|
-
* This hook provides access to the global context values, including the current locale, calendar, and color scheme.
|
|
237
|
-
*
|
|
238
|
-
* @returns {GlobalContextType} The global context values excluding the error element.
|
|
239
|
-
*
|
|
240
|
-
* @example
|
|
241
|
-
* ```jsx
|
|
242
|
-
* const { changeLocale, currentLocale, toggleColorScheme } = useApplicationContext();
|
|
243
|
-
* ```
|
|
244
|
-
*/
|
|
245
|
-
export const useApplicationContext = () => {
|
|
246
|
-
const { errorElement, ...rest } = useContext(GlobalContext);
|
|
247
|
-
return rest;
|
|
248
|
-
};
|
|
249
|
-
|
|
250
|
-
/**
|
|
251
|
-
* Hook to access the notification manager from the global context.
|
|
252
|
-
* This hook provides methods to show alerts, errors, messages, and toasts.
|
|
253
|
-
* It returns a reference to the notification manager, which can be used to display notifications in the application.
|
|
254
|
-
*
|
|
255
|
-
* @returns {NotificationManagerRef} The notification manager reference.
|
|
256
|
-
*
|
|
257
|
-
* @example
|
|
258
|
-
* ```jsx
|
|
259
|
-
* const notificationService = useNotificationService();
|
|
260
|
-
* notificationService.showMessage("Hello World");
|
|
261
|
-
* ```
|
|
262
|
-
*
|
|
263
|
-
* @see {@link https://adarshpastakia.github.io/react-fabric/?path=/docs/core-components-notifications--notifications} for more details on available methods.
|
|
264
|
-
*/
|
|
265
|
-
export const useNotificationService = () => {
|
|
266
|
-
const { notificationManager } = useContext(GlobalContext);
|
|
267
|
-
return notificationManager ?? {};
|
|
268
|
-
};
|
|
@@ -110,7 +110,6 @@ export const NotificationManager = ({ onLoad }: KeyValue) => {
|
|
|
110
110
|
const handleClose = (b: boolean | string = false) => {
|
|
111
111
|
clearTimeout(timerRef);
|
|
112
112
|
setTimeout(() => {
|
|
113
|
-
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
|
|
114
113
|
delete map[key];
|
|
115
114
|
update();
|
|
116
115
|
resolve(b);
|