@react-fabric/core 1.0.0-beta.0
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/LICENSE +21 -0
- package/README.md +10 -0
- package/css/flags.rect.css +1607 -0
- package/css/flags.wavy.css +1606 -0
- package/css/index.js +250 -0
- package/css/reset/_gradients.css +51 -0
- package/css/reset/_reset.css +407 -0
- package/css/reset/_text.css +179 -0
- package/css/reset/_theme.css +110 -0
- package/css/reset/index.css +27 -0
- package/css/styles.css +31 -0
- package/css/tailwind/colors.ts +158 -0
- package/dist/cjs/components/actionLabel/ActionLabel.js +56 -0
- package/dist/cjs/components/actionLabel/ActionLabel.module.css +1 -0
- package/dist/cjs/components/animations/Animations.js +135 -0
- package/dist/cjs/components/animations/Animations.module.css +1 -0
- package/dist/cjs/components/avatar/Avatar.js +144 -0
- package/dist/cjs/components/avatar/Avatar.module.css +1 -0
- package/dist/cjs/components/avatar/AvatarGroup.js +74 -0
- package/dist/cjs/components/badge/Badge.js +82 -0
- package/dist/cjs/components/badge/Badge.module.css +1 -0
- package/dist/cjs/components/breadcrumbs/Breadcrumbs.js +71 -0
- package/dist/cjs/components/breadcrumbs/Breadcrumbs.module.css +1 -0
- package/dist/cjs/components/button/Button.js +170 -0
- package/dist/cjs/components/button/Button.module.css +1 -0
- package/dist/cjs/components/button/ButtonGroup.js +41 -0
- package/dist/cjs/components/button/ConfirmButton.js +166 -0
- package/dist/cjs/components/button/ToggleButtonGroup.js +68 -0
- package/dist/cjs/components/callout/Callout.js +54 -0
- package/dist/cjs/components/card/Card.js +62 -0
- package/dist/cjs/components/card/Card.module.css +1 -0
- package/dist/cjs/components/card/CardCover.js +48 -0
- package/dist/cjs/components/chip/Chip.js +94 -0
- package/dist/cjs/components/chip/Chip.module.css +1 -0
- package/dist/cjs/components/collapsable/Collapsable.js +84 -0
- package/dist/cjs/components/collapsable/Collapsable.module.css +1 -0
- package/dist/cjs/components/divider/Divider.js +65 -0
- package/dist/cjs/components/dropdown/Dropdown.js +180 -0
- package/dist/cjs/components/dropdown/Dropdown.module.css +1 -0
- package/dist/cjs/components/dropdown/DropdownTool.js +26 -0
- package/dist/cjs/components/empty/EmptyContent.js +92 -0
- package/dist/cjs/components/icon/Icon.js +106 -0
- package/dist/cjs/components/icon/Icon.module.css +1 -0
- package/dist/cjs/components/media/Media.js +149 -0
- package/dist/cjs/components/media/Media.module.css +1 -0
- package/dist/cjs/components/menu/ContextMenu.js +84 -0
- package/dist/cjs/components/menu/Menu.js +204 -0
- package/dist/cjs/components/menu/Menu.module.css +1 -0
- package/dist/cjs/components/menu/MenuItem.js +119 -0
- package/dist/cjs/components/meter/Meter.js +41 -0
- package/dist/cjs/components/meter/Meter.module.css +1 -0
- package/dist/cjs/components/navigator/Navigator.js +54 -0
- package/dist/cjs/components/panel/Panel.js +125 -0
- package/dist/cjs/components/panel/Panel.module.css +1 -0
- package/dist/cjs/components/panel/PanelGroup.js +50 -0
- package/dist/cjs/components/panel/PanelStack.js +85 -0
- package/dist/cjs/components/progress/Progress.module.css +1 -0
- package/dist/cjs/components/progress/ProgressBar.js +62 -0
- package/dist/cjs/components/progress/ProgressCircle.js +96 -0
- package/dist/cjs/components/tabpanel/Tab.js +78 -0
- package/dist/cjs/components/tabpanel/TabPanel.js +77 -0
- package/dist/cjs/components/tabpanel/TabPanel.module.css +1 -0
- package/dist/cjs/context/Global.js +169 -0
- package/dist/cjs/context/NotificationCenter.js +254 -0
- package/dist/cjs/core/aside/Aside.js +152 -0
- package/dist/cjs/core/aside/Aside.module.css +1 -0
- package/dist/cjs/core/boundary/ErrorBoundary.js +140 -0
- package/dist/cjs/core/boundary/ErrorBoundary.module.css +1 -0
- package/dist/cjs/core/boundary/ErrorIcon.js +51 -0
- package/dist/cjs/core/content/Content.js +70 -0
- package/dist/cjs/core/content/Content.module.css +1 -0
- package/dist/cjs/core/headfoot/HeadFoot.js +62 -0
- package/dist/cjs/core/headfoot/HeadFoot.module.css +1 -0
- package/dist/cjs/core/page/Page.js +65 -0
- package/dist/cjs/core/page/Page.module.css +1 -0
- package/dist/cjs/core/responsive/Responsive.js +64 -0
- package/dist/cjs/core/responsive/Responsive.module.css +1 -0
- package/dist/cjs/core/section/Section.js +44 -0
- package/dist/cjs/core/section/Section.module.css +1 -0
- package/dist/cjs/core/theme/Theme.module.css +1 -0
- package/dist/cjs/core/theme/ThemeProvider.js +74 -0
- package/dist/cjs/core/viewport/Viewport.js +39 -0
- package/dist/cjs/core/viewport/Viewport.module.css +1 -0
- package/dist/cjs/hooks/useClientService.js +30 -0
- package/dist/cjs/hooks/useControlledValue.js +22 -0
- package/dist/cjs/hooks/useDebounce.js +56 -0
- package/dist/cjs/hooks/useEffectDebugger.js +113 -0
- package/dist/cjs/hooks/useIsDark.js +33 -0
- package/dist/cjs/hooks/useIsRtl.js +27 -0
- package/dist/cjs/hooks/useNavigator.js +36 -0
- package/dist/cjs/hooks/useOverlayService.js +55 -0
- package/dist/cjs/hooks/usePropToggle.js +40 -0
- package/dist/cjs/hooks/useResize.js +75 -0
- package/dist/cjs/hooks/useResizeObserver.js +38 -0
- package/dist/cjs/hooks/useStorage.js +44 -0
- package/dist/cjs/hotkeys/HotKey.js +47 -0
- package/dist/cjs/hotkeys/HotKeyLabel.js +52 -0
- package/dist/cjs/hotkeys/HotKeyWrapper.js +98 -0
- package/dist/cjs/hotkeys/commons.js +56 -0
- package/dist/cjs/i18n/ar.json.js +31 -0
- package/dist/cjs/i18n/en.json.js +46 -0
- package/dist/cjs/i18n/index.js +55 -0
- package/dist/cjs/index.js +162 -0
- package/dist/cjs/overlays/alert/Alert.js +163 -0
- package/dist/cjs/overlays/alert/Alert.module.css +1 -0
- package/dist/cjs/overlays/flyout/Flyout.js +152 -0
- package/dist/cjs/overlays/flyout/Flyout.module.css +1 -0
- package/dist/cjs/overlays/message/Message.js +84 -0
- package/dist/cjs/overlays/message/Message.module.css +1 -0
- package/dist/cjs/overlays/modal/Modal.js +132 -0
- package/dist/cjs/overlays/modal/Modal.module.css +1 -0
- package/dist/cjs/overlays/toast/Toast.js +166 -0
- package/dist/cjs/overlays/toast/Toast.module.css +1 -0
- package/dist/cjs/overlays/tooltip/Tooltip.js +133 -0
- package/dist/cjs/overlays/tooltip/Tooltip.module.css +1 -0
- package/dist/cjs/types/icons.js +197 -0
- package/dist/cjs/typography/Abbr.js +108 -0
- package/dist/cjs/typography/Copy.js +59 -0
- package/dist/cjs/typography/Link.js +55 -0
- package/dist/cjs/typography/Mark.js +86 -0
- package/dist/cjs/typography/Text.js +121 -0
- package/dist/cjs/typography/Title.js +58 -0
- package/dist/cjs/typography/Typography.module.css +1 -0
- package/dist/cjs/typography/types.js +42 -0
- package/dist/cjs/utils/calculateDimensions.js +51 -0
- package/dist/cjs/utils/getColor.js +52 -0
- package/dist/cjs/utils/nodeCheck.js +35 -0
- package/dist/esm/components/actionLabel/ActionLabel.js +56 -0
- package/dist/esm/components/actionLabel/ActionLabel.module.css +1 -0
- package/dist/esm/components/animations/Animations.js +131 -0
- package/dist/esm/components/animations/Animations.module.css +1 -0
- package/dist/esm/components/avatar/Avatar.js +144 -0
- package/dist/esm/components/avatar/Avatar.module.css +1 -0
- package/dist/esm/components/avatar/AvatarGroup.js +74 -0
- package/dist/esm/components/badge/Badge.js +81 -0
- package/dist/esm/components/badge/Badge.module.css +1 -0
- package/dist/esm/components/breadcrumbs/Breadcrumbs.js +71 -0
- package/dist/esm/components/breadcrumbs/Breadcrumbs.module.css +1 -0
- package/dist/esm/components/button/Button.js +170 -0
- package/dist/esm/components/button/Button.module.css +1 -0
- package/dist/esm/components/button/ButtonGroup.js +41 -0
- package/dist/esm/components/button/ConfirmButton.js +166 -0
- package/dist/esm/components/button/ToggleButtonGroup.js +68 -0
- package/dist/esm/components/callout/Callout.js +54 -0
- package/dist/esm/components/card/Card.js +62 -0
- package/dist/esm/components/card/Card.module.css +1 -0
- package/dist/esm/components/card/CardCover.js +48 -0
- package/dist/esm/components/chip/Chip.js +94 -0
- package/dist/esm/components/chip/Chip.module.css +1 -0
- package/dist/esm/components/collapsable/Collapsable.js +84 -0
- package/dist/esm/components/collapsable/Collapsable.module.css +1 -0
- package/dist/esm/components/divider/Divider.js +65 -0
- package/dist/esm/components/dropdown/Dropdown.js +179 -0
- package/dist/esm/components/dropdown/Dropdown.module.css +1 -0
- package/dist/esm/components/dropdown/DropdownTool.js +26 -0
- package/dist/esm/components/empty/EmptyContent.js +92 -0
- package/dist/esm/components/icon/Icon.js +106 -0
- package/dist/esm/components/icon/Icon.module.css +1 -0
- package/dist/esm/components/media/Media.js +148 -0
- package/dist/esm/components/media/Media.module.css +1 -0
- package/dist/esm/components/menu/ContextMenu.js +84 -0
- package/dist/esm/components/menu/Menu.js +204 -0
- package/dist/esm/components/menu/Menu.module.css +1 -0
- package/dist/esm/components/menu/MenuItem.js +119 -0
- package/dist/esm/components/meter/Meter.js +41 -0
- package/dist/esm/components/meter/Meter.module.css +1 -0
- package/dist/esm/components/navigator/Navigator.js +54 -0
- package/dist/esm/components/panel/Panel.js +125 -0
- package/dist/esm/components/panel/Panel.module.css +1 -0
- package/dist/esm/components/panel/PanelGroup.js +50 -0
- package/dist/esm/components/panel/PanelStack.js +85 -0
- package/dist/esm/components/progress/Progress.module.css +1 -0
- package/dist/esm/components/progress/ProgressBar.js +62 -0
- package/dist/esm/components/progress/ProgressCircle.js +96 -0
- package/dist/esm/components/tabpanel/Tab.js +78 -0
- package/dist/esm/components/tabpanel/TabPanel.js +77 -0
- package/dist/esm/components/tabpanel/TabPanel.module.css +1 -0
- package/dist/esm/context/Global.js +165 -0
- package/dist/esm/context/NotificationCenter.js +254 -0
- package/dist/esm/core/aside/Aside.js +152 -0
- package/dist/esm/core/aside/Aside.module.css +1 -0
- package/dist/esm/core/boundary/ErrorBoundary.js +140 -0
- package/dist/esm/core/boundary/ErrorBoundary.module.css +1 -0
- package/dist/esm/core/boundary/ErrorIcon.js +51 -0
- package/dist/esm/core/content/Content.js +70 -0
- package/dist/esm/core/content/Content.module.css +1 -0
- package/dist/esm/core/headfoot/HeadFoot.js +61 -0
- package/dist/esm/core/headfoot/HeadFoot.module.css +1 -0
- package/dist/esm/core/page/Page.js +65 -0
- package/dist/esm/core/page/Page.module.css +1 -0
- package/dist/esm/core/responsive/Responsive.js +62 -0
- package/dist/esm/core/responsive/Responsive.module.css +1 -0
- package/dist/esm/core/section/Section.js +44 -0
- package/dist/esm/core/section/Section.module.css +1 -0
- package/dist/esm/core/theme/Theme.module.css +1 -0
- package/dist/esm/core/theme/ThemeProvider.js +74 -0
- package/dist/esm/core/viewport/Viewport.js +39 -0
- package/dist/esm/core/viewport/Viewport.module.css +1 -0
- package/dist/esm/hooks/useClientService.js +30 -0
- package/dist/esm/hooks/useControlledValue.js +22 -0
- package/dist/esm/hooks/useDebounce.js +56 -0
- package/dist/esm/hooks/useEffectDebugger.js +111 -0
- package/dist/esm/hooks/useIsDark.js +33 -0
- package/dist/esm/hooks/useIsRtl.js +27 -0
- package/dist/esm/hooks/useNavigator.js +36 -0
- package/dist/esm/hooks/useOverlayService.js +55 -0
- package/dist/esm/hooks/usePropToggle.js +40 -0
- package/dist/esm/hooks/useResize.js +75 -0
- package/dist/esm/hooks/useResizeObserver.js +38 -0
- package/dist/esm/hooks/useStorage.js +43 -0
- package/dist/esm/hotkeys/HotKey.js +47 -0
- package/dist/esm/hotkeys/HotKeyLabel.js +52 -0
- package/dist/esm/hotkeys/HotKeyWrapper.js +96 -0
- package/dist/esm/hotkeys/commons.js +56 -0
- package/dist/esm/i18n/ar.json.js +27 -0
- package/dist/esm/i18n/en.json.js +41 -0
- package/dist/esm/i18n/index.js +55 -0
- package/dist/esm/index.js +75 -0
- package/dist/esm/overlays/alert/Alert.js +163 -0
- package/dist/esm/overlays/alert/Alert.module.css +1 -0
- package/dist/esm/overlays/flyout/Flyout.js +152 -0
- package/dist/esm/overlays/flyout/Flyout.module.css +1 -0
- package/dist/esm/overlays/message/Message.js +84 -0
- package/dist/esm/overlays/message/Message.module.css +1 -0
- package/dist/esm/overlays/modal/Modal.js +132 -0
- package/dist/esm/overlays/modal/Modal.module.css +1 -0
- package/dist/esm/overlays/toast/Toast.js +166 -0
- package/dist/esm/overlays/toast/Toast.module.css +1 -0
- package/dist/esm/overlays/tooltip/Tooltip.js +132 -0
- package/dist/esm/overlays/tooltip/Tooltip.module.css +1 -0
- package/dist/esm/types/icons.js +199 -0
- package/dist/esm/typography/Abbr.js +108 -0
- package/dist/esm/typography/Copy.js +59 -0
- package/dist/esm/typography/Link.js +55 -0
- package/dist/esm/typography/Mark.js +86 -0
- package/dist/esm/typography/Text.js +121 -0
- package/dist/esm/typography/Title.js +58 -0
- package/dist/esm/typography/Typography.module.css +1 -0
- package/dist/esm/typography/types.js +41 -0
- package/dist/esm/utils/calculateDimensions.js +50 -0
- package/dist/esm/utils/getColor.js +49 -0
- package/dist/esm/utils/nodeCheck.js +35 -0
- package/dist/types/components/actionLabel/ActionLabel.d.ts +21 -0
- package/dist/types/components/animations/Animations.d.ts +23 -0
- package/dist/types/components/avatar/Avatar.d.ts +48 -0
- package/dist/types/components/avatar/AvatarGroup.d.ts +24 -0
- package/dist/types/components/badge/Badge.d.ts +25 -0
- package/dist/types/components/breadcrumbs/Breadcrumbs.d.ts +17 -0
- package/dist/types/components/button/Button.d.ts +94 -0
- package/dist/types/components/button/ButtonGroup.d.ts +34 -0
- package/dist/types/components/button/ConfirmButton.d.ts +27 -0
- package/dist/types/components/button/ToggleButtonGroup.d.ts +56 -0
- package/dist/types/components/callout/Callout.d.ts +28 -0
- package/dist/types/components/card/Card.d.ts +39 -0
- package/dist/types/components/card/CardCover.d.ts +16 -0
- package/dist/types/components/chip/Chip.d.ts +41 -0
- package/dist/types/components/collapsable/Collapsable.d.ts +43 -0
- package/dist/types/components/divider/Divider.d.ts +20 -0
- package/dist/types/components/dropdown/Dropdown.d.ts +50 -0
- package/dist/types/components/dropdown/DropdownTool.d.ts +8 -0
- package/dist/types/components/empty/EmptyContent.d.ts +21 -0
- package/dist/types/components/icon/Icon.d.ts +44 -0
- package/dist/types/components/index.d.ts +33 -0
- package/dist/types/components/media/Media.d.ts +37 -0
- package/dist/types/components/menu/ContextMenu.d.ts +7 -0
- package/dist/types/components/menu/Menu.d.ts +2 -0
- package/dist/types/components/menu/MenuItem.d.ts +4 -0
- package/dist/types/components/menu/types.d.ts +59 -0
- package/dist/types/components/meter/Meter.d.ts +12 -0
- package/dist/types/components/navigator/Navigator.d.ts +12 -0
- package/dist/types/components/panel/Panel.d.ts +59 -0
- package/dist/types/components/panel/PanelGroup.d.ts +12 -0
- package/dist/types/components/panel/PanelStack.d.ts +16 -0
- package/dist/types/components/progress/ProgressBar.d.ts +24 -0
- package/dist/types/components/progress/ProgressCircle.d.ts +16 -0
- package/dist/types/components/tabpanel/Tab.d.ts +41 -0
- package/dist/types/components/tabpanel/TabPanel.d.ts +41 -0
- package/dist/types/context/Global.d.ts +81 -0
- package/dist/types/context/NotificationCenter.d.ts +11 -0
- package/dist/types/core/aside/Aside.d.ts +52 -0
- package/dist/types/core/boundary/ErrorBoundary.d.ts +26 -0
- package/dist/types/core/boundary/ErrorIcon.d.ts +1 -0
- package/dist/types/core/content/Content.d.ts +15 -0
- package/dist/types/core/headfoot/HeadFoot.d.ts +24 -0
- package/dist/types/core/index.d.ts +9 -0
- package/dist/types/core/page/Page.d.ts +23 -0
- package/dist/types/core/responsive/Responsive.d.ts +53 -0
- package/dist/types/core/section/Section.d.ts +7 -0
- package/dist/types/core/theme/ThemeProvider.d.ts +37 -0
- package/dist/types/core/viewport/Viewport.d.ts +5 -0
- package/dist/types/hooks/useClientService.d.ts +1 -0
- package/dist/types/hooks/useControlledValue.d.ts +5 -0
- package/dist/types/hooks/useDebounce.d.ts +4 -0
- package/dist/types/hooks/useEffectDebugger.d.ts +4 -0
- package/dist/types/hooks/useIsDark.d.ts +1 -0
- package/dist/types/hooks/useIsRtl.d.ts +1 -0
- package/dist/types/hooks/useNavigator.d.ts +7 -0
- package/dist/types/hooks/useOverlayService.d.ts +10 -0
- package/dist/types/hooks/usePropToggle.d.ts +9 -0
- package/dist/types/hooks/useResize.d.ts +27 -0
- package/dist/types/hooks/useResizeObserver.d.ts +3 -0
- package/dist/types/hooks/useStorage.d.ts +2 -0
- package/dist/types/hotkeys/HotKey.d.ts +2 -0
- package/dist/types/hotkeys/HotKeyLabel.d.ts +2 -0
- package/dist/types/hotkeys/HotKeyWrapper.d.ts +11 -0
- package/dist/types/hotkeys/commons.d.ts +28 -0
- package/dist/types/i18n/index.d.ts +6 -0
- package/dist/types/index.d.ts +19 -0
- package/dist/types/overlays/alert/Alert.d.ts +33 -0
- package/dist/types/overlays/flyout/Flyout.d.ts +57 -0
- package/dist/types/overlays/index.d.ts +6 -0
- package/dist/types/overlays/message/Message.d.ts +21 -0
- package/dist/types/overlays/modal/Modal.d.ts +53 -0
- package/dist/types/overlays/toast/Toast.d.ts +33 -0
- package/dist/types/overlays/tooltip/Tooltip.d.ts +18 -0
- package/dist/types/types/icons.d.ts +194 -0
- package/dist/types/types/index.d.ts +140 -0
- package/dist/types/typography/Abbr.d.ts +22 -0
- package/dist/types/typography/Copy.d.ts +9 -0
- package/dist/types/typography/Link.d.ts +24 -0
- package/dist/types/typography/Mark.d.ts +18 -0
- package/dist/types/typography/Text.d.ts +35 -0
- package/dist/types/typography/Title.d.ts +29 -0
- package/dist/types/typography/index.d.ts +6 -0
- package/dist/types/typography/types.d.ts +2 -0
- package/dist/types/utils/calculateDimensions.d.ts +6 -0
- package/dist/types/utils/getColor.d.ts +4 -0
- package/dist/types/utils/index.d.ts +3 -0
- package/dist/types/utils/nodeCheck.d.ts +2 -0
- package/package.json +60 -0
- package/src/components/actionLabel/ActionLabel.module.css +38 -0
- package/src/components/actionLabel/ActionLabel.tsx +97 -0
- package/src/components/animations/Animations.module.css +253 -0
- package/src/components/animations/Animations.tsx +190 -0
- package/src/components/avatar/Avatar.module.css +90 -0
- package/src/components/avatar/Avatar.tsx +218 -0
- package/src/components/avatar/AvatarGroup.tsx +140 -0
- package/src/components/badge/Badge.module.css +165 -0
- package/src/components/badge/Badge.tsx +148 -0
- package/src/components/breadcrumbs/Breadcrumbs.module.css +189 -0
- package/src/components/breadcrumbs/Breadcrumbs.tsx +109 -0
- package/src/components/button/Button.module.css +375 -0
- package/src/components/button/Button.tsx +323 -0
- package/src/components/button/ButtonGroup.tsx +112 -0
- package/src/components/button/ConfirmButton.tsx +221 -0
- package/src/components/button/ToggleButtonGroup.tsx +161 -0
- package/src/components/callout/Callout.tsx +104 -0
- package/src/components/card/Card.module.css +152 -0
- package/src/components/card/Card.tsx +154 -0
- package/src/components/card/CardCover.tsx +87 -0
- package/src/components/chip/Chip.module.css +118 -0
- package/src/components/chip/Chip.tsx +201 -0
- package/src/components/collapsable/Collapsable.module.css +30 -0
- package/src/components/collapsable/Collapsable.tsx +153 -0
- package/src/components/divider/Divider.tsx +105 -0
- package/src/components/dropdown/Dropdown.module.css +39 -0
- package/src/components/dropdown/Dropdown.tsx +307 -0
- package/src/components/dropdown/DropdownTool.tsx +56 -0
- package/src/components/empty/EmptyContent.tsx +141 -0
- package/src/components/icon/Icon.module.css +71 -0
- package/src/components/icon/Icon.tsx +188 -0
- package/src/components/index.ts +61 -0
- package/src/components/media/Media.module.css +112 -0
- package/src/components/media/Media.tsx +224 -0
- package/src/components/menu/ContextMenu.tsx +116 -0
- package/src/components/menu/Menu.module.css +109 -0
- package/src/components/menu/Menu.tsx +278 -0
- package/src/components/menu/MenuItem.tsx +162 -0
- package/src/components/menu/types.ts +100 -0
- package/src/components/meter/Meter.module.css +116 -0
- package/src/components/meter/Meter.tsx +80 -0
- package/src/components/navigator/Navigator.tsx +77 -0
- package/src/components/panel/Panel.module.css +86 -0
- package/src/components/panel/Panel.tsx +254 -0
- package/src/components/panel/PanelGroup.tsx +99 -0
- package/src/components/panel/PanelStack.tsx +133 -0
- package/src/components/progress/Progress.module.css +70 -0
- package/src/components/progress/ProgressBar.tsx +122 -0
- package/src/components/progress/ProgressCircle.tsx +118 -0
- package/src/components/tabpanel/Tab.tsx +175 -0
- package/src/components/tabpanel/TabPanel.module.css +200 -0
- package/src/components/tabpanel/TabPanel.tsx +155 -0
- package/src/context/Global.tsx +241 -0
- package/src/context/NotificationCenter.tsx +223 -0
- package/src/core/aside/Aside.module.css +231 -0
- package/src/core/aside/Aside.tsx +262 -0
- package/src/core/boundary/ErrorBoundary.module.css +65 -0
- package/src/core/boundary/ErrorBoundary.tsx +146 -0
- package/src/core/boundary/ErrorIcon.tsx +50 -0
- package/src/core/content/Content.module.css +40 -0
- package/src/core/content/Content.tsx +91 -0
- package/src/core/headfoot/HeadFoot.module.css +38 -0
- package/src/core/headfoot/HeadFoot.tsx +114 -0
- package/src/core/index.ts +32 -0
- package/src/core/page/Page.module.css +46 -0
- package/src/core/page/Page.tsx +100 -0
- package/src/core/responsive/Responsive.module.css +85 -0
- package/src/core/responsive/Responsive.tsx +172 -0
- package/src/core/section/Section.module.css +28 -0
- package/src/core/section/Section.tsx +48 -0
- package/src/core/theme/Theme.module.css +30 -0
- package/src/core/theme/ThemeProvider.tsx +112 -0
- package/src/core/viewport/Viewport.module.css +32 -0
- package/src/core/viewport/Viewport.tsx +43 -0
- package/src/hooks/useClientService.tsx +29 -0
- package/src/hooks/useControlledValue.tsx +43 -0
- package/src/hooks/useDebounce.ts +52 -0
- package/src/hooks/useEffectDebugger.ts +154 -0
- package/src/hooks/useIsDark.ts +50 -0
- package/src/hooks/useIsRtl.ts +46 -0
- package/src/hooks/useNavigator.tsx +54 -0
- package/src/hooks/useOverlayService.tsx +51 -0
- package/src/hooks/usePropToggle.ts +61 -0
- package/src/hooks/useResize.ts +90 -0
- package/src/hooks/useResizeObserver.ts +55 -0
- package/src/hooks/useStorage.ts +76 -0
- package/src/hotkeys/HotKey.tsx +39 -0
- package/src/hotkeys/HotKeyLabel.tsx +61 -0
- package/src/hotkeys/HotKeyWrapper.tsx +137 -0
- package/src/hotkeys/commons.ts +74 -0
- package/src/i18n/ar.json +21 -0
- package/src/i18n/en.json +34 -0
- package/src/i18n/index.ts +50 -0
- package/src/index.ts +51 -0
- package/src/overlays/alert/Alert.module.css +44 -0
- package/src/overlays/alert/Alert.tsx +229 -0
- package/src/overlays/flyout/Flyout.module.css +52 -0
- package/src/overlays/flyout/Flyout.tsx +283 -0
- package/src/overlays/index.ts +29 -0
- package/src/overlays/message/Message.module.css +37 -0
- package/src/overlays/message/Message.tsx +107 -0
- package/src/overlays/modal/Modal.module.css +53 -0
- package/src/overlays/modal/Modal.tsx +244 -0
- package/src/overlays/toast/Toast.module.css +37 -0
- package/src/overlays/toast/Toast.tsx +216 -0
- package/src/overlays/tooltip/Tooltip.module.css +53 -0
- package/src/overlays/tooltip/Tooltip.tsx +200 -0
- package/src/types/global.d.ts +83 -0
- package/src/types/icons.ts +420 -0
- package/src/types/index.ts +238 -0
- package/src/typography/Abbr.tsx +152 -0
- package/src/typography/Copy.tsx +61 -0
- package/src/typography/Link.tsx +110 -0
- package/src/typography/Mark.tsx +122 -0
- package/src/typography/Text.tsx +194 -0
- package/src/typography/Title.tsx +126 -0
- package/src/typography/Typography.module.css +68 -0
- package/src/typography/index.ts +29 -0
- package/src/typography/types.ts +38 -0
- package/src/utils/calculateDimensions.ts +72 -0
- package/src/utils/getColor.ts +49 -0
- package/src/utils/index.ts +28 -0
- package/src/utils/nodeCheck.ts +34 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
4
|
+
import { useState, useCallback, useMemo } from 'react';
|
|
5
|
+
import { jsxs } from 'react/jsx-runtime';
|
|
6
|
+
|
|
7
|
+
var useNavigator = function useNavigator() {
|
|
8
|
+
var totalCount = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
9
|
+
var defaultIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
10
|
+
var _useState = useState(defaultIndex),
|
|
11
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
12
|
+
currentIndex = _useState2[0],
|
|
13
|
+
setCurrentIndex = _useState2[1];
|
|
14
|
+
var onNavigate = useCallback(function (dir) {
|
|
15
|
+
if (dir === -1) {
|
|
16
|
+
setCurrentIndex(currentIndex > 0 ? currentIndex - 1 : totalCount - 1);
|
|
17
|
+
}
|
|
18
|
+
if (dir === 1) {
|
|
19
|
+
setCurrentIndex(currentIndex + 1 < totalCount ? currentIndex + 1 : 0);
|
|
20
|
+
}
|
|
21
|
+
}, [currentIndex, totalCount]);
|
|
22
|
+
var headLabel = useMemo(function () {
|
|
23
|
+
return /*#__PURE__*/jsxs("span", {
|
|
24
|
+
className: "text-muted leading-none",
|
|
25
|
+
children: [currentIndex + 1, "/", totalCount]
|
|
26
|
+
});
|
|
27
|
+
}, [currentIndex, totalCount]);
|
|
28
|
+
return {
|
|
29
|
+
headLabel: headLabel,
|
|
30
|
+
onNavigate: onNavigate,
|
|
31
|
+
currentIndex: currentIndex,
|
|
32
|
+
setCurrentIndex: setCurrentIndex
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export { useNavigator };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
4
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
5
|
+
import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
|
|
6
|
+
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
7
|
+
import _regeneratorRuntime from '@babel/runtime/regenerator';
|
|
8
|
+
import { useState } from 'react';
|
|
9
|
+
import { jsx } from 'react/jsx-runtime';
|
|
10
|
+
|
|
11
|
+
var _excluded = ["onClose"];
|
|
12
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
13
|
+
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
|
+
var useOverlayService = function useOverlayService(ModalOrFlyout) {
|
|
15
|
+
var _useState = useState(null),
|
|
16
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
17
|
+
Overlay = _useState2[0],
|
|
18
|
+
setOverlay = _useState2[1];
|
|
19
|
+
var openOverlay = /*#__PURE__*/function () {
|
|
20
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
21
|
+
var _ref2,
|
|
22
|
+
onClose,
|
|
23
|
+
props,
|
|
24
|
+
_args = arguments;
|
|
25
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
26
|
+
while (1) switch (_context.prev = _context.next) {
|
|
27
|
+
case 0:
|
|
28
|
+
_ref2 = _args.length > 0 && _args[0] !== undefined ? _args[0] : {}, onClose = _ref2.onClose, props = _objectWithoutProperties(_ref2, _excluded);
|
|
29
|
+
_context.next = 3;
|
|
30
|
+
return new Promise(function (resolve) {
|
|
31
|
+
var handleClose = function handleClose(args) {
|
|
32
|
+
setOverlay(null);
|
|
33
|
+
resolve(args);
|
|
34
|
+
onClose === null || onClose === void 0 || onClose(args);
|
|
35
|
+
};
|
|
36
|
+
setOverlay( /*#__PURE__*/jsx(ModalOrFlyout, _objectSpread(_objectSpread({}, props), {}, {
|
|
37
|
+
onClose: handleClose
|
|
38
|
+
})));
|
|
39
|
+
});
|
|
40
|
+
case 3:
|
|
41
|
+
return _context.abrupt("return", _context.sent);
|
|
42
|
+
case 4:
|
|
43
|
+
case "end":
|
|
44
|
+
return _context.stop();
|
|
45
|
+
}
|
|
46
|
+
}, _callee);
|
|
47
|
+
}));
|
|
48
|
+
return function openOverlay() {
|
|
49
|
+
return _ref.apply(this, arguments);
|
|
50
|
+
};
|
|
51
|
+
}();
|
|
52
|
+
return [Overlay, openOverlay];
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export { useOverlayService };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
4
|
+
import { useRef, useState, useCallback } from 'react';
|
|
5
|
+
import { useLayoutEffectDebugger } from './useEffectDebugger.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* hook to control boolean props
|
|
9
|
+
* @param isOn (is prop true)
|
|
10
|
+
* @param callback (optional callback)
|
|
11
|
+
* @param key (optional key to pass to callback)
|
|
12
|
+
* @returns
|
|
13
|
+
*/
|
|
14
|
+
var usePropToggle = function usePropToggle() {
|
|
15
|
+
var isOn = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
16
|
+
var onToggle = arguments.length > 1 ? arguments[1] : undefined;
|
|
17
|
+
var key = arguments.length > 2 ? arguments[2] : undefined;
|
|
18
|
+
var toggleRef = useRef(isOn);
|
|
19
|
+
var _useState = useState(isOn),
|
|
20
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
21
|
+
toggleOn = _useState2[0],
|
|
22
|
+
setToggleOn = _useState2[1];
|
|
23
|
+
|
|
24
|
+
/** ***************** update toggle state on change *******************/
|
|
25
|
+
useLayoutEffectDebugger(function () {
|
|
26
|
+
toggleRef.current = isOn;
|
|
27
|
+
setToggleOn(isOn);
|
|
28
|
+
}, [isOn], "usePropToggle");
|
|
29
|
+
|
|
30
|
+
/** ***************** toggle handler *******************/
|
|
31
|
+
var doToggle = useCallback(function () {
|
|
32
|
+
if ((onToggle === null || onToggle === void 0 ? void 0 : onToggle(!toggleOn, key)) !== false) {
|
|
33
|
+
toggleRef.current = !toggleOn;
|
|
34
|
+
setToggleOn(!toggleOn);
|
|
35
|
+
}
|
|
36
|
+
}, [toggleOn, onToggle, key]);
|
|
37
|
+
return [toggleOn, doToggle, toggleRef];
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export { usePropToggle };
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useRef, useCallback } from 'react';
|
|
4
|
+
import { useIsRtl } from './useIsRtl.js';
|
|
5
|
+
|
|
6
|
+
/*
|
|
7
|
+
* React Fabric
|
|
8
|
+
* @version: 1.0.0
|
|
9
|
+
*
|
|
10
|
+
*
|
|
11
|
+
* The MIT License (MIT)
|
|
12
|
+
* Copyright (c) 2024 Adarsh Pastakia
|
|
13
|
+
*
|
|
14
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software
|
|
15
|
+
* and associated documentation files (the "Software"), to deal in the Software without restriction,
|
|
16
|
+
* including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
17
|
+
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
|
|
18
|
+
* subject to the following conditions:
|
|
19
|
+
*
|
|
20
|
+
* The above copyright notice and this permission notice shall be included in all copies or substantial
|
|
21
|
+
* portions of the Software.
|
|
22
|
+
*
|
|
23
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
|
|
24
|
+
* TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
25
|
+
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
26
|
+
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
var useResize = function useResize(onResize, _ref) {
|
|
30
|
+
var _ref$isReverse = _ref.isReverse,
|
|
31
|
+
isReverse = _ref$isReverse === void 0 ? false : _ref$isReverse,
|
|
32
|
+
_ref$isVertical = _ref.isVertical,
|
|
33
|
+
isVertical = _ref$isVertical === void 0 ? false : _ref$isVertical,
|
|
34
|
+
onStart = _ref.onStart,
|
|
35
|
+
onEnd = _ref.onEnd;
|
|
36
|
+
var refEl = useRef(null);
|
|
37
|
+
var isRtl = useIsRtl();
|
|
38
|
+
var onResizing = useCallback(function (evt) {
|
|
39
|
+
if (refEl.current != null) {
|
|
40
|
+
var _refEl$current;
|
|
41
|
+
/** ***************** check if reverse enabled of RTL *******************/
|
|
42
|
+
var reversed = ((isRtl ? 1 : 0) ^ (isReverse ? 1 : 0)) === 1;
|
|
43
|
+
var box = (_refEl$current = refEl.current) === null || _refEl$current === void 0 ? void 0 : _refEl$current.getBoundingClientRect();
|
|
44
|
+
var x = (evt.clientX - (reversed ? box.left : box.right)) * (reversed ? -1 : 1);
|
|
45
|
+
var y = evt.clientY - box.bottom;
|
|
46
|
+
onResize({
|
|
47
|
+
x: x,
|
|
48
|
+
y: y
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}, [onResize, isRtl, isReverse]);
|
|
52
|
+
|
|
53
|
+
/** ***************** dettach handlers on mouseup *******************/
|
|
54
|
+
var onResizeEnd = useCallback(function () {
|
|
55
|
+
document.body.style.cursor = "unset";
|
|
56
|
+
document.removeEventListener("mousemove", onResizing);
|
|
57
|
+
document.removeEventListener("mouseup", onResizeEnd);
|
|
58
|
+
onEnd === null || onEnd === void 0 || onEnd();
|
|
59
|
+
}, [onEnd, onResizing]);
|
|
60
|
+
|
|
61
|
+
/** ***************** attach handlers on mousedown *******************/
|
|
62
|
+
var onResizeStart = useCallback(function (e) {
|
|
63
|
+
e.preventDefault();
|
|
64
|
+
document.body.style.cursor = isVertical ? "row-resize" : "col-resize";
|
|
65
|
+
document.addEventListener("mousemove", onResizing);
|
|
66
|
+
document.addEventListener("mouseup", onResizeEnd);
|
|
67
|
+
onStart === null || onStart === void 0 || onStart();
|
|
68
|
+
}, [onResizing, onResizeEnd, onStart]);
|
|
69
|
+
return {
|
|
70
|
+
ref: refEl,
|
|
71
|
+
onMouseDown: onResizeStart
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
export { useResize };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
4
|
+
import { useRef, useTransition, useEffect } from 'react';
|
|
5
|
+
import ResizeObserver from 'resize-observer-polyfill';
|
|
6
|
+
import { useDebounce } from './useDebounce.js';
|
|
7
|
+
|
|
8
|
+
var useResizeObserver = function useResizeObserver(onResize) {
|
|
9
|
+
var ref = useRef(null);
|
|
10
|
+
var _useTransition = useTransition(),
|
|
11
|
+
_useTransition2 = _slicedToArray(_useTransition, 2),
|
|
12
|
+
startTransition = _useTransition2[1];
|
|
13
|
+
var callbackResize = useDebounce(function () {
|
|
14
|
+
startTransition(function () {
|
|
15
|
+
if (onResize && ref.current != null) {
|
|
16
|
+
var _ref$current = ref.current,
|
|
17
|
+
width = _ref$current.offsetWidth,
|
|
18
|
+
height = _ref$current.offsetHeight;
|
|
19
|
+
onResize === null || onResize === void 0 || onResize({
|
|
20
|
+
width: width,
|
|
21
|
+
height: height
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
}, [onResize]);
|
|
26
|
+
useEffect(function () {
|
|
27
|
+
if (ref.current != null) {
|
|
28
|
+
var ob = new ResizeObserver(callbackResize);
|
|
29
|
+
ob.observe(ref.current);
|
|
30
|
+
return function () {
|
|
31
|
+
ob.disconnect();
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
}, [callbackResize, ref]);
|
|
35
|
+
return ref;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export { useResizeObserver };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
4
|
+
import { useState } from 'react';
|
|
5
|
+
import { useClientService } from './useClientService.js';
|
|
6
|
+
import { useEffectDebugger } from './useEffectDebugger.js';
|
|
7
|
+
|
|
8
|
+
var useLocalStorage = function useLocalStorage(key, defaultValue) {
|
|
9
|
+
var _JSON$parse, _service$getItem;
|
|
10
|
+
var service = useClientService(localStorage);
|
|
11
|
+
var _useState = useState((_JSON$parse = JSON.parse((_service$getItem = service === null || service === void 0 ? void 0 : service.getItem(key)) !== null && _service$getItem !== void 0 ? _service$getItem : "null")) !== null && _JSON$parse !== void 0 ? _JSON$parse : defaultValue),
|
|
12
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
13
|
+
value = _useState2[0],
|
|
14
|
+
setValue = _useState2[1];
|
|
15
|
+
useEffectDebugger(function () {
|
|
16
|
+
var _JSON$parse2, _service$getItem2;
|
|
17
|
+
setValue((_JSON$parse2 = JSON.parse((_service$getItem2 = service === null || service === void 0 ? void 0 : service.getItem(key)) !== null && _service$getItem2 !== void 0 ? _service$getItem2 : "null")) !== null && _JSON$parse2 !== void 0 ? _JSON$parse2 : defaultValue);
|
|
18
|
+
}, [], "useStorage initial value");
|
|
19
|
+
var changeValue = function changeValue(value) {
|
|
20
|
+
service === null || service === void 0 || service.setItem(key, JSON.stringify(value));
|
|
21
|
+
setValue(value);
|
|
22
|
+
};
|
|
23
|
+
return [value, changeValue];
|
|
24
|
+
};
|
|
25
|
+
var useSessionStorage = function useSessionStorage(key, defaultValue) {
|
|
26
|
+
var _JSON$parse3, _service$getItem3;
|
|
27
|
+
var service = useClientService(sessionStorage);
|
|
28
|
+
var _useState3 = useState((_JSON$parse3 = JSON.parse((_service$getItem3 = service === null || service === void 0 ? void 0 : service.getItem(key)) !== null && _service$getItem3 !== void 0 ? _service$getItem3 : "null")) !== null && _JSON$parse3 !== void 0 ? _JSON$parse3 : defaultValue),
|
|
29
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
30
|
+
value = _useState4[0],
|
|
31
|
+
setValue = _useState4[1];
|
|
32
|
+
useEffectDebugger(function () {
|
|
33
|
+
var _JSON$parse4, _service$getItem4;
|
|
34
|
+
setValue((_JSON$parse4 = JSON.parse((_service$getItem4 = service === null || service === void 0 ? void 0 : service.getItem(key)) !== null && _service$getItem4 !== void 0 ? _service$getItem4 : "null")) !== null && _JSON$parse4 !== void 0 ? _JSON$parse4 : defaultValue);
|
|
35
|
+
}, [], "useStorage initial value");
|
|
36
|
+
var changeValue = function changeValue(value) {
|
|
37
|
+
service === null || service === void 0 || service.setItem(key, JSON.stringify(value));
|
|
38
|
+
setValue(value);
|
|
39
|
+
};
|
|
40
|
+
return [value, changeValue];
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export { useLocalStorage, useSessionStorage };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useEffectDebugger } from '../hooks/useEffectDebugger.js';
|
|
4
|
+
import { useHotKeys } from './HotKeyWrapper.js';
|
|
5
|
+
|
|
6
|
+
/*
|
|
7
|
+
* React Fabric
|
|
8
|
+
* @version: 1.0.0
|
|
9
|
+
*
|
|
10
|
+
*
|
|
11
|
+
* The MIT License (MIT)
|
|
12
|
+
* Copyright (c) 2024 Adarsh Pastakia
|
|
13
|
+
*
|
|
14
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software
|
|
15
|
+
* and associated documentation files (the "Software"), to deal in the Software without restriction,
|
|
16
|
+
* including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
17
|
+
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
|
|
18
|
+
* subject to the following conditions:
|
|
19
|
+
*
|
|
20
|
+
* The above copyright notice and this permission notice shall be included in all copies or substantial
|
|
21
|
+
* portions of the Software.
|
|
22
|
+
*
|
|
23
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
|
|
24
|
+
* TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
25
|
+
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
26
|
+
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
var HotKey = function HotKey(_ref) {
|
|
30
|
+
var keyCombo = _ref.keyCombo,
|
|
31
|
+
global = _ref.global,
|
|
32
|
+
handler = _ref.handler;
|
|
33
|
+
var _useHotKeys = useHotKeys(),
|
|
34
|
+
addHotKey = _useHotKeys.addHotKey,
|
|
35
|
+
removeHotKey = _useHotKeys.removeHotKey;
|
|
36
|
+
useEffectDebugger(function () {
|
|
37
|
+
addHotKey === null || addHotKey === void 0 || addHotKey(keyCombo, handler !== null && handler !== void 0 ? handler : function () {
|
|
38
|
+
return undefined;
|
|
39
|
+
}, global);
|
|
40
|
+
return function () {
|
|
41
|
+
return removeHotKey === null || removeHotKey === void 0 ? void 0 : removeHotKey(keyCombo);
|
|
42
|
+
};
|
|
43
|
+
}, [addHotKey, global, handler, keyCombo, removeHotKey], "HotKey add");
|
|
44
|
+
return null;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export { HotKey };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useMemoDebugger } from '../hooks/useEffectDebugger.js';
|
|
4
|
+
import { reduceHotKey } from './commons.js';
|
|
5
|
+
import { jsx } from 'react/jsx-runtime';
|
|
6
|
+
|
|
7
|
+
/*
|
|
8
|
+
* React Fabric
|
|
9
|
+
* @version: 1.0.0
|
|
10
|
+
*
|
|
11
|
+
*
|
|
12
|
+
* The MIT License (MIT)
|
|
13
|
+
* Copyright (c) 2024 Adarsh Pastakia
|
|
14
|
+
*
|
|
15
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software
|
|
16
|
+
* and associated documentation files (the "Software"), to deal in the Software without restriction,
|
|
17
|
+
* including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
18
|
+
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
|
|
19
|
+
* subject to the following conditions:
|
|
20
|
+
*
|
|
21
|
+
* The above copyright notice and this permission notice shall be included in all copies or substantial
|
|
22
|
+
* portions of the Software.
|
|
23
|
+
*
|
|
24
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
|
|
25
|
+
* TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
26
|
+
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
27
|
+
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
var HotKeyLabel = function HotKeyLabel(_ref) {
|
|
31
|
+
var keyCombo = _ref.keyCombo;
|
|
32
|
+
var label = useMemoDebugger(function () {
|
|
33
|
+
var item = reduceHotKey({
|
|
34
|
+
keyCombo: keyCombo
|
|
35
|
+
});
|
|
36
|
+
var label = [];
|
|
37
|
+
if (item.alt) label.push("ALT");
|
|
38
|
+
if (item.ctrl) label.push("CTRL");
|
|
39
|
+
if (item.meta) label.push("META");
|
|
40
|
+
if (item.shift) label.push("SHIFT");
|
|
41
|
+
if (item.key.toLowerCase() === "tab") label.push("TAB");else if (item.key.toLowerCase() === "space") label.push("SPC");else if (item.key.toLowerCase() === "arrowleft") label.push("LEFT");else if (item.key.toLowerCase() === "arrowright") label.push("RIGHT");else if (item.key.toLowerCase() === "arrowup") label.push("UP");else if (item.key.toLowerCase() === "arrowdown") label.push("DOWN");else if (item.key.toLowerCase() === "enter") label.push("ENTER");else if (item.key.toLowerCase() === "delete") label.push("DEL");else if (item.key.toLowerCase() === "escape") label.push("ESC");else if (item.key.toLowerCase() === "backspace") label.push("BKSPC");else label.push(item.key.toUpperCase());
|
|
42
|
+
return [/*#__PURE__*/jsx("span", {
|
|
43
|
+
children: label.join(" ")
|
|
44
|
+
}, "label")];
|
|
45
|
+
}, [keyCombo], "HotKey label");
|
|
46
|
+
return /*#__PURE__*/jsx("kbd", {
|
|
47
|
+
className: "hotkey-label inline-flex gap-1 select-none self-center font-mono items-center text-[0.625rem] leading-4 bg-tint-500/10 text-base/50 whitespace-nowrap rounded px-2 mx-1",
|
|
48
|
+
children: label
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export { HotKeyLabel };
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
4
|
+
import { memo, useRef, useCallback, createContext, useContext } from 'react';
|
|
5
|
+
import { useEffectDebugger } from '../hooks/useEffectDebugger.js';
|
|
6
|
+
import { reduceHotKey } from './commons.js';
|
|
7
|
+
import { jsx } from 'react/jsx-runtime';
|
|
8
|
+
|
|
9
|
+
var HotKeysContext = /*#__PURE__*/createContext({});
|
|
10
|
+
var useHotKeys = function useHotKeys() {
|
|
11
|
+
return useContext(HotKeysContext);
|
|
12
|
+
};
|
|
13
|
+
var HotKeyWrapper = /*#__PURE__*/memo(function (_ref) {
|
|
14
|
+
var children = _ref.children;
|
|
15
|
+
var refEl = useRef(null);
|
|
16
|
+
var keyList = useRef([]);
|
|
17
|
+
var addHotKey = useCallback(function (keyCombo, handler) {
|
|
18
|
+
var global = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
19
|
+
return keyList.current = [].concat(_toConsumableArray(keyList.current.filter(function (_ref2) {
|
|
20
|
+
var _key = _ref2._key;
|
|
21
|
+
return _key !== keyCombo;
|
|
22
|
+
})), [reduceHotKey({
|
|
23
|
+
keyCombo: keyCombo,
|
|
24
|
+
handler: handler,
|
|
25
|
+
global: global
|
|
26
|
+
})]);
|
|
27
|
+
}, []);
|
|
28
|
+
var removeHotKey = useCallback(function (key) {
|
|
29
|
+
return keyList.current = _toConsumableArray(keyList.current.filter(function (_ref3) {
|
|
30
|
+
var _key = _ref3._key;
|
|
31
|
+
return _key !== key;
|
|
32
|
+
}));
|
|
33
|
+
}, []);
|
|
34
|
+
var handler = useCallback(function (items, event) {
|
|
35
|
+
if (items.length === 0) return;
|
|
36
|
+
var keyCode = event.key,
|
|
37
|
+
code = event.code,
|
|
38
|
+
altKey = event.altKey,
|
|
39
|
+
ctrlKey = event.ctrlKey,
|
|
40
|
+
metaKey = event.metaKey,
|
|
41
|
+
shiftKey = event.shiftKey;
|
|
42
|
+
if (keyCode !== "Enter" && keyCode !== "Esc" && ["INPUT", "TEXTAREA", "SELECT"].includes(event.target.tagName)) return;
|
|
43
|
+
var find = items.find(function (_ref4) {
|
|
44
|
+
var key = _ref4.key,
|
|
45
|
+
alt = _ref4.alt,
|
|
46
|
+
ctrl = _ref4.ctrl,
|
|
47
|
+
meta = _ref4.meta,
|
|
48
|
+
shift = _ref4.shift;
|
|
49
|
+
return (key.toLowerCase() === keyCode.toLowerCase() || key.toLowerCase() === code.toLowerCase()) && alt === altKey && ctrl === ctrlKey && meta === metaKey && shift === shiftKey;
|
|
50
|
+
});
|
|
51
|
+
if (find !== null && find !== void 0 && find.handler) {
|
|
52
|
+
find.handler();
|
|
53
|
+
event.preventDefault();
|
|
54
|
+
event.stopImmediatePropagation();
|
|
55
|
+
}
|
|
56
|
+
}, []);
|
|
57
|
+
var handleGlobal = useCallback(function (event) {
|
|
58
|
+
handler(keyList.current.filter(function (i) {
|
|
59
|
+
return i.global;
|
|
60
|
+
}), event);
|
|
61
|
+
}, [handler]);
|
|
62
|
+
var handleHotKey = useCallback(function (event) {
|
|
63
|
+
handler(keyList.current.filter(function (i) {
|
|
64
|
+
return !i.global;
|
|
65
|
+
}), event);
|
|
66
|
+
}, [handler]);
|
|
67
|
+
useEffectDebugger(function () {
|
|
68
|
+
var _refEl$current;
|
|
69
|
+
var el = (_refEl$current = refEl.current) === null || _refEl$current === void 0 ? void 0 : _refEl$current.parentElement;
|
|
70
|
+
if (el) {
|
|
71
|
+
el.tabIndex = 0;
|
|
72
|
+
el.addEventListener("keydown", handleHotKey);
|
|
73
|
+
document.addEventListener("keydown", handleGlobal);
|
|
74
|
+
return function () {
|
|
75
|
+
el.removeEventListener("keydown", handleHotKey);
|
|
76
|
+
document.removeEventListener("keydown", handleGlobal);
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
}, [handleGlobal, handleHotKey], "HotKeyWrapper attach handlers");
|
|
80
|
+
return /*#__PURE__*/jsx(HotKeysContext.Provider, {
|
|
81
|
+
value: {
|
|
82
|
+
addHotKey: addHotKey,
|
|
83
|
+
removeHotKey: removeHotKey
|
|
84
|
+
},
|
|
85
|
+
children: /*#__PURE__*/jsx("div", {
|
|
86
|
+
ref: refEl,
|
|
87
|
+
style: {
|
|
88
|
+
display: "contents"
|
|
89
|
+
},
|
|
90
|
+
children: children
|
|
91
|
+
})
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
HotKeyWrapper.displayName = "HotKeyProvider";
|
|
95
|
+
|
|
96
|
+
export { HotKeyWrapper, HotKeysContext, useHotKeys };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* React Fabric
|
|
5
|
+
* @version: 1.0.0
|
|
6
|
+
*
|
|
7
|
+
*
|
|
8
|
+
* The MIT License (MIT)
|
|
9
|
+
* Copyright (c) 2024 Adarsh Pastakia
|
|
10
|
+
*
|
|
11
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software
|
|
12
|
+
* and associated documentation files (the "Software"), to deal in the Software without restriction,
|
|
13
|
+
* including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
14
|
+
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
|
|
15
|
+
* subject to the following conditions:
|
|
16
|
+
*
|
|
17
|
+
* The above copyright notice and this permission notice shall be included in all copies or substantial
|
|
18
|
+
* portions of the Software.
|
|
19
|
+
*
|
|
20
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
|
|
21
|
+
* TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
22
|
+
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
23
|
+
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
var reduceHotKey = function reduceHotKey(_ref) {
|
|
27
|
+
var keyCombo = _ref.keyCombo,
|
|
28
|
+
global = _ref.global,
|
|
29
|
+
handler = _ref.handler;
|
|
30
|
+
var item = {
|
|
31
|
+
key: "",
|
|
32
|
+
meta: false,
|
|
33
|
+
shift: false,
|
|
34
|
+
ctrl: false,
|
|
35
|
+
alt: false,
|
|
36
|
+
_key: keyCombo,
|
|
37
|
+
handler: handler,
|
|
38
|
+
global: global
|
|
39
|
+
};
|
|
40
|
+
keyCombo.split("+").forEach(function (e) {
|
|
41
|
+
if (e.trim().toLowerCase() === "ctrl") {
|
|
42
|
+
item.ctrl = true;
|
|
43
|
+
} else if (e.trim().toLowerCase() === "alt") {
|
|
44
|
+
item.alt = true;
|
|
45
|
+
} else if (e.trim().toLowerCase() === "meta") {
|
|
46
|
+
item.meta = true;
|
|
47
|
+
} else if (e.trim().toLowerCase() === "shift") {
|
|
48
|
+
item.shift = true;
|
|
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();
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
return item;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export { reduceHotKey };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
var error = {
|
|
4
|
+
title: "أُووبس! لقد كسرنا شيئا"
|
|
5
|
+
};
|
|
6
|
+
var action = {
|
|
7
|
+
ok: "حسنا",
|
|
8
|
+
add: "اضف جديد",
|
|
9
|
+
save: "حفظ",
|
|
10
|
+
more: "أظهر المزيد",
|
|
11
|
+
less: "عرض أقل",
|
|
12
|
+
back: "عودة",
|
|
13
|
+
copy: "ينسخ",
|
|
14
|
+
copied: "نسخ",
|
|
15
|
+
close: "قريب",
|
|
16
|
+
apply: "تطبيق",
|
|
17
|
+
"delete": "حذف",
|
|
18
|
+
submit: "تقديم",
|
|
19
|
+
cancel: "إلغاء",
|
|
20
|
+
preview: "معاينة"
|
|
21
|
+
};
|
|
22
|
+
var ar = {
|
|
23
|
+
error: error,
|
|
24
|
+
action: action
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export { action, ar as default, error };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
var locale = {
|
|
4
|
+
en: "English",
|
|
5
|
+
ar: "عربى",
|
|
6
|
+
de: "Deutsche",
|
|
7
|
+
es: "Español",
|
|
8
|
+
fr: "Français",
|
|
9
|
+
it: "Italiano",
|
|
10
|
+
jp: "日本語",
|
|
11
|
+
ko: "한국어",
|
|
12
|
+
pt: "Português",
|
|
13
|
+
ru: "Pусский",
|
|
14
|
+
zh: "中国人"
|
|
15
|
+
};
|
|
16
|
+
var error = {
|
|
17
|
+
title: "OOPS! We broke something"
|
|
18
|
+
};
|
|
19
|
+
var action = {
|
|
20
|
+
ok: "OK",
|
|
21
|
+
add: "Add New",
|
|
22
|
+
save: "Save",
|
|
23
|
+
more: "Show more",
|
|
24
|
+
less: "Show less",
|
|
25
|
+
back: "Back",
|
|
26
|
+
copy: "Copy",
|
|
27
|
+
copied: "Copied",
|
|
28
|
+
close: "Close",
|
|
29
|
+
apply: "Apply",
|
|
30
|
+
"delete": "Delete",
|
|
31
|
+
submit: "Submit",
|
|
32
|
+
cancel: "Cancel",
|
|
33
|
+
preview: "Preview"
|
|
34
|
+
};
|
|
35
|
+
var en = {
|
|
36
|
+
locale: locale,
|
|
37
|
+
error: error,
|
|
38
|
+
action: action
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export { action, en as default, error, locale };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import i18next from 'i18next';
|
|
4
|
+
import ar from './ar.json.js';
|
|
5
|
+
import en from './en.json.js';
|
|
6
|
+
|
|
7
|
+
/*
|
|
8
|
+
* React Fabric
|
|
9
|
+
* @version: 1.0.0
|
|
10
|
+
*
|
|
11
|
+
*
|
|
12
|
+
* The MIT License (MIT)
|
|
13
|
+
* Copyright (c) 2024 Adarsh Pastakia
|
|
14
|
+
*
|
|
15
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software
|
|
16
|
+
* and associated documentation files (the "Software"), to deal in the Software without restriction,
|
|
17
|
+
* including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
18
|
+
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
|
|
19
|
+
* subject to the following conditions:
|
|
20
|
+
*
|
|
21
|
+
* The above copyright notice and this permission notice shall be included in all copies or substantial
|
|
22
|
+
* portions of the Software.
|
|
23
|
+
*
|
|
24
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
|
|
25
|
+
* TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
26
|
+
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
27
|
+
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
28
|
+
*/
|
|
29
|
+
/* istanbul ignore file */
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* add language bundles using bundle keys as namespaces
|
|
34
|
+
* @param key
|
|
35
|
+
* @param languageBundles: {en: {}, ar: {}}
|
|
36
|
+
*/
|
|
37
|
+
var addTranslationBundle = function addTranslationBundle(key, languageBundles) {
|
|
38
|
+
var callback = function callback() {
|
|
39
|
+
Object.keys(languageBundles).forEach(function (lang) {
|
|
40
|
+
var bundle = languageBundles[lang];
|
|
41
|
+
i18next.addResourceBundle(lang, key, bundle, true, false);
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
if (i18next.isInitialized) {
|
|
45
|
+
callback();
|
|
46
|
+
} else {
|
|
47
|
+
i18next.on("initialized", callback);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
addTranslationBundle("core", {
|
|
51
|
+
en: en,
|
|
52
|
+
ar: ar
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
export { addTranslationBundle };
|