@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,229 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* React Fabric
|
|
3
|
+
* @version: 1.0.0
|
|
4
|
+
*
|
|
5
|
+
*
|
|
6
|
+
* The MIT License (MIT)
|
|
7
|
+
* Copyright (c) 2024 Adarsh Pastakia
|
|
8
|
+
*
|
|
9
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software
|
|
10
|
+
* and associated documentation files (the "Software"), to deal in the Software without restriction,
|
|
11
|
+
* including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
12
|
+
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
|
|
13
|
+
* subject to the following conditions:
|
|
14
|
+
*
|
|
15
|
+
* The above copyright notice and this permission notice shall be included in all copies or substantial
|
|
16
|
+
* portions of the Software.
|
|
17
|
+
*
|
|
18
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
|
|
19
|
+
* TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
20
|
+
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
21
|
+
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
import {
|
|
25
|
+
FloatingFocusManager,
|
|
26
|
+
FloatingOverlay,
|
|
27
|
+
FloatingPortal,
|
|
28
|
+
useDismiss,
|
|
29
|
+
useFloating,
|
|
30
|
+
useInteractions,
|
|
31
|
+
useRole,
|
|
32
|
+
} from "@floating-ui/react";
|
|
33
|
+
import classNames from "classnames";
|
|
34
|
+
import { useCallback, useLayoutEffect, useMemo } from "react";
|
|
35
|
+
import { useTranslation } from "react-i18next";
|
|
36
|
+
import { AnimationIndicator } from "../../components/animations/Animations";
|
|
37
|
+
import { Button } from "../../components/button/Button";
|
|
38
|
+
import { Icon } from "../../components/icon/Icon";
|
|
39
|
+
import { type ColorType, type Elements, type IconProps } from "../../types";
|
|
40
|
+
import { CoreIcons } from "../../types/icons";
|
|
41
|
+
import { Title } from "../../typography/Title";
|
|
42
|
+
import { getBorderClass, getColorClass } from "../../utils";
|
|
43
|
+
import classes from "./Alert.module.css";
|
|
44
|
+
|
|
45
|
+
export interface AlertProps extends Omit<IconProps, "iconBg" | "iconColor"> {
|
|
46
|
+
/**
|
|
47
|
+
* toast type
|
|
48
|
+
*/
|
|
49
|
+
type?: "alert" | "confirm" | "prompt";
|
|
50
|
+
/**
|
|
51
|
+
* toast title
|
|
52
|
+
*/
|
|
53
|
+
title?: string;
|
|
54
|
+
/**
|
|
55
|
+
* toast text
|
|
56
|
+
*/
|
|
57
|
+
message: string | JSX.Element;
|
|
58
|
+
/**
|
|
59
|
+
* theme color
|
|
60
|
+
*/
|
|
61
|
+
color?: ColorType;
|
|
62
|
+
/**
|
|
63
|
+
* extra action button
|
|
64
|
+
*/
|
|
65
|
+
actions?: Elements<JSX.Element>;
|
|
66
|
+
/**
|
|
67
|
+
* ok label
|
|
68
|
+
*/
|
|
69
|
+
okLabel?: string;
|
|
70
|
+
/**
|
|
71
|
+
* cancel label
|
|
72
|
+
*/
|
|
73
|
+
cancelLabel?: string;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export const Alert = ({
|
|
77
|
+
title,
|
|
78
|
+
message,
|
|
79
|
+
color = "primary",
|
|
80
|
+
icon,
|
|
81
|
+
rtlFlip,
|
|
82
|
+
actions,
|
|
83
|
+
// @ts-expect-error internal prop
|
|
84
|
+
onClose,
|
|
85
|
+
type,
|
|
86
|
+
okLabel,
|
|
87
|
+
cancelLabel,
|
|
88
|
+
}: AlertProps) => {
|
|
89
|
+
const { t } = useTranslation("core");
|
|
90
|
+
const { refs, context } = useFloating({
|
|
91
|
+
open: true,
|
|
92
|
+
onOpenChange: () => {
|
|
93
|
+
handleClose(false);
|
|
94
|
+
},
|
|
95
|
+
});
|
|
96
|
+
const dismiss = useDismiss(context, {
|
|
97
|
+
outsidePressEvent: "mousedown",
|
|
98
|
+
escapeKey: true,
|
|
99
|
+
});
|
|
100
|
+
const role = useRole(context);
|
|
101
|
+
|
|
102
|
+
// Merge all the interactions into prop getters
|
|
103
|
+
const { getFloatingProps } = useInteractions([dismiss, role]);
|
|
104
|
+
|
|
105
|
+
const iconType = useMemo(() => {
|
|
106
|
+
if (icon)
|
|
107
|
+
return (
|
|
108
|
+
<Icon icon={icon} size="md" rtlFlip={rtlFlip} color={color + "-600"} />
|
|
109
|
+
);
|
|
110
|
+
switch (color) {
|
|
111
|
+
case "danger":
|
|
112
|
+
return (
|
|
113
|
+
<AnimationIndicator
|
|
114
|
+
type="cross"
|
|
115
|
+
className={getColorClass(color + "-600")}
|
|
116
|
+
/>
|
|
117
|
+
);
|
|
118
|
+
case "success":
|
|
119
|
+
return (
|
|
120
|
+
<AnimationIndicator
|
|
121
|
+
type="check"
|
|
122
|
+
className={getColorClass(color + "-600")}
|
|
123
|
+
/>
|
|
124
|
+
);
|
|
125
|
+
case "warning":
|
|
126
|
+
return (
|
|
127
|
+
<AnimationIndicator
|
|
128
|
+
type="exclaim"
|
|
129
|
+
className={getColorClass(color + "-600")}
|
|
130
|
+
/>
|
|
131
|
+
);
|
|
132
|
+
default:
|
|
133
|
+
return (
|
|
134
|
+
<AnimationIndicator
|
|
135
|
+
type={type === "confirm" ? "question" : "info"}
|
|
136
|
+
className={getColorClass(color + "-600")}
|
|
137
|
+
/>
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
}, [color, type, icon]);
|
|
141
|
+
|
|
142
|
+
const handleClose = useCallback(
|
|
143
|
+
(ret: AnyObject) => {
|
|
144
|
+
refs.floating.current && (refs.floating.current.dataset.show = "false");
|
|
145
|
+
setTimeout(() => {
|
|
146
|
+
onClose(ret);
|
|
147
|
+
}, 250);
|
|
148
|
+
},
|
|
149
|
+
[onClose],
|
|
150
|
+
);
|
|
151
|
+
useLayoutEffect(() => {
|
|
152
|
+
setTimeout(
|
|
153
|
+
() =>
|
|
154
|
+
refs.floating.current && (refs.floating.current.dataset.show = "true"),
|
|
155
|
+
100,
|
|
156
|
+
);
|
|
157
|
+
}, []);
|
|
158
|
+
|
|
159
|
+
return (
|
|
160
|
+
<FloatingPortal>
|
|
161
|
+
<FloatingOverlay
|
|
162
|
+
lockScroll
|
|
163
|
+
style={{ zIndex: "var(--z-overlay-mask)" }}
|
|
164
|
+
className="bg-base/50 backdrop-blur-sm grid place-items-center"
|
|
165
|
+
>
|
|
166
|
+
<FloatingFocusManager context={context}>
|
|
167
|
+
<dialog
|
|
168
|
+
role="alertdialog"
|
|
169
|
+
className={classNames(
|
|
170
|
+
classes.alert,
|
|
171
|
+
getBorderClass(color + "-300"),
|
|
172
|
+
"grid bg-base border-2 pointer-events-auto overflow-hidden rounded-capped select-none",
|
|
173
|
+
"min-w-72 max-w-sm p-6 relative outline-0 shadow-lg",
|
|
174
|
+
)}
|
|
175
|
+
ref={refs.setFloating}
|
|
176
|
+
{...getFloatingProps()}
|
|
177
|
+
>
|
|
178
|
+
<div className={classNames("area-[icon] text-lg py-2")}>
|
|
179
|
+
{iconType}
|
|
180
|
+
</div>
|
|
181
|
+
|
|
182
|
+
<Title className="font-medium area-[title]">{title}</Title>
|
|
183
|
+
<p className="area-[message] py-4">{message}</p>
|
|
184
|
+
<div className="area-[message]">{message}</div>
|
|
185
|
+
<div className="flex gap-1 justify-center flex-nowrap pt-2 area-[actions]">
|
|
186
|
+
<div
|
|
187
|
+
className="contents"
|
|
188
|
+
onClickCapture={(e) =>
|
|
189
|
+
handleClose((e.target as AnyObject).value)
|
|
190
|
+
}
|
|
191
|
+
>
|
|
192
|
+
{actions}
|
|
193
|
+
</div>
|
|
194
|
+
{type === "confirm" && (
|
|
195
|
+
<Button
|
|
196
|
+
size="sm"
|
|
197
|
+
variant="link"
|
|
198
|
+
color={color}
|
|
199
|
+
onClick={() => handleClose(false)}
|
|
200
|
+
>
|
|
201
|
+
{cancelLabel ?? t("action.cancel", "Cancel")}
|
|
202
|
+
</Button>
|
|
203
|
+
)}
|
|
204
|
+
<Button
|
|
205
|
+
size="sm"
|
|
206
|
+
variant="solid"
|
|
207
|
+
color={color}
|
|
208
|
+
onClick={() => handleClose(true)}
|
|
209
|
+
>
|
|
210
|
+
{okLabel ?? t("action.ok", "OK")}
|
|
211
|
+
</Button>
|
|
212
|
+
</div>
|
|
213
|
+
<div className="absolute top-2 end-2">
|
|
214
|
+
<Button
|
|
215
|
+
size="sm"
|
|
216
|
+
variant="link"
|
|
217
|
+
className="m-0"
|
|
218
|
+
color={color}
|
|
219
|
+
onClick={() => handleClose(false)}
|
|
220
|
+
icon={CoreIcons.close}
|
|
221
|
+
aria-label="close"
|
|
222
|
+
/>
|
|
223
|
+
</div>
|
|
224
|
+
</dialog>
|
|
225
|
+
</FloatingFocusManager>
|
|
226
|
+
</FloatingOverlay>
|
|
227
|
+
</FloatingPortal>
|
|
228
|
+
);
|
|
229
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* React Fabric
|
|
3
|
+
* @version: 1.0.0
|
|
4
|
+
*
|
|
5
|
+
*
|
|
6
|
+
* The MIT License (MIT)
|
|
7
|
+
* Copyright (c) 2024 Adarsh Pastakia
|
|
8
|
+
*
|
|
9
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software
|
|
10
|
+
* and associated documentation files (the "Software"), to deal in the Software without restriction,
|
|
11
|
+
* including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
12
|
+
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
|
|
13
|
+
* subject to the following conditions:
|
|
14
|
+
*
|
|
15
|
+
* The above copyright notice and this permission notice shall be included in all copies or substantial
|
|
16
|
+
* portions of the Software.
|
|
17
|
+
*
|
|
18
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
|
|
19
|
+
* TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
20
|
+
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
21
|
+
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
@layer comp {
|
|
25
|
+
.flyout {
|
|
26
|
+
z-index: var(--z-overlay);
|
|
27
|
+
width: 32rem;
|
|
28
|
+
max-width: 70vw;
|
|
29
|
+
transition: margin 0.5s;
|
|
30
|
+
|
|
31
|
+
& .flyoutHeader {
|
|
32
|
+
background-color: theme(backgroundColor.base);
|
|
33
|
+
border-bottom: 0.5px solid theme(borderColor.dimmed);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
& .flyoutBody {
|
|
37
|
+
grid-template: "head head head" auto ". loader ." auto "side-s content side-e" 1fr "foot foot foot" auto / auto 1fr auto;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&[data-align="start"] {
|
|
41
|
+
margin-inline-start: -100%;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
&[data-align="end"] {
|
|
45
|
+
margin-inline-end: -100%;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
&[data-show="true"] {
|
|
49
|
+
margin: 0;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* React Fabric
|
|
3
|
+
* @version: 1.0.0
|
|
4
|
+
*
|
|
5
|
+
*
|
|
6
|
+
* The MIT License (MIT)
|
|
7
|
+
* Copyright (c) 2024 Adarsh Pastakia
|
|
8
|
+
*
|
|
9
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software
|
|
10
|
+
* and associated documentation files (the "Software"), to deal in the Software without restriction,
|
|
11
|
+
* including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
12
|
+
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
|
|
13
|
+
* subject to the following conditions:
|
|
14
|
+
*
|
|
15
|
+
* The above copyright notice and this permission notice shall be included in all copies or substantial
|
|
16
|
+
* portions of the Software.
|
|
17
|
+
*
|
|
18
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
|
|
19
|
+
* TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
20
|
+
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
21
|
+
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
import {
|
|
25
|
+
FloatingFocusManager,
|
|
26
|
+
FloatingOverlay,
|
|
27
|
+
FloatingPortal,
|
|
28
|
+
useDismiss,
|
|
29
|
+
useFloating,
|
|
30
|
+
useInteractions,
|
|
31
|
+
useRole,
|
|
32
|
+
} from "@floating-ui/react";
|
|
33
|
+
import classNames from "classnames";
|
|
34
|
+
import {
|
|
35
|
+
Fragment,
|
|
36
|
+
useCallback,
|
|
37
|
+
useEffect,
|
|
38
|
+
type PropsWithChildren,
|
|
39
|
+
} from "react";
|
|
40
|
+
import { Loading } from "../../components/animations/Animations";
|
|
41
|
+
import { Icon } from "../../components/icon/Icon";
|
|
42
|
+
import { Header } from "../../core/headfoot/HeadFoot";
|
|
43
|
+
import { HotKeyWrapper } from "../../hotkeys/HotKeyWrapper";
|
|
44
|
+
import {
|
|
45
|
+
type AriaProps,
|
|
46
|
+
type CallbackReturn,
|
|
47
|
+
type ChildrenProp,
|
|
48
|
+
type Elements,
|
|
49
|
+
type IconProps,
|
|
50
|
+
type TestProps,
|
|
51
|
+
} from "../../types";
|
|
52
|
+
import { CoreIcons } from "../../types/icons";
|
|
53
|
+
import classes from "./Flyout.module.css";
|
|
54
|
+
|
|
55
|
+
export interface FlyoutProps
|
|
56
|
+
extends AriaProps,
|
|
57
|
+
TestProps,
|
|
58
|
+
IconProps,
|
|
59
|
+
ChildrenProp {
|
|
60
|
+
/**
|
|
61
|
+
* flyout alignment
|
|
62
|
+
*/
|
|
63
|
+
align?: "start" | "end";
|
|
64
|
+
/**
|
|
65
|
+
* header className
|
|
66
|
+
*/
|
|
67
|
+
headerClassName?: string;
|
|
68
|
+
/**
|
|
69
|
+
* icon className
|
|
70
|
+
*/
|
|
71
|
+
iconClassName?: string;
|
|
72
|
+
/**
|
|
73
|
+
* show loading indicator
|
|
74
|
+
*/
|
|
75
|
+
loading?: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* modal title
|
|
78
|
+
*/
|
|
79
|
+
title?: JSX.Element | string | false;
|
|
80
|
+
/**
|
|
81
|
+
* header actions
|
|
82
|
+
*/
|
|
83
|
+
actions?: Elements<JSX.Element>;
|
|
84
|
+
/**
|
|
85
|
+
* modal size
|
|
86
|
+
*/
|
|
87
|
+
size?: "sm" | "md" | "lg" | "xl" | "screen";
|
|
88
|
+
/**
|
|
89
|
+
* width
|
|
90
|
+
*/
|
|
91
|
+
width?: string | number;
|
|
92
|
+
/**
|
|
93
|
+
* minimum width
|
|
94
|
+
*/
|
|
95
|
+
minWidth?: string | number;
|
|
96
|
+
/**
|
|
97
|
+
* hide backdrop mask
|
|
98
|
+
*/
|
|
99
|
+
hideMask?: boolean;
|
|
100
|
+
/**
|
|
101
|
+
* close flyout on any click
|
|
102
|
+
*/
|
|
103
|
+
closeOnClick?: boolean;
|
|
104
|
+
/**
|
|
105
|
+
* close handler
|
|
106
|
+
*/
|
|
107
|
+
onClose: (...args: AnyObject) => void;
|
|
108
|
+
/**
|
|
109
|
+
* before close handler, return false to prevent close
|
|
110
|
+
*/
|
|
111
|
+
onBeforeClose?: (...args: AnyObject) => CallbackReturn;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export const Flyout = ({
|
|
115
|
+
icon,
|
|
116
|
+
iconBg,
|
|
117
|
+
iconColor,
|
|
118
|
+
iconClassName,
|
|
119
|
+
rtlFlip,
|
|
120
|
+
title,
|
|
121
|
+
actions,
|
|
122
|
+
closeOnClick,
|
|
123
|
+
headerClassName,
|
|
124
|
+
onClose,
|
|
125
|
+
onBeforeClose,
|
|
126
|
+
children,
|
|
127
|
+
loading,
|
|
128
|
+
size,
|
|
129
|
+
width,
|
|
130
|
+
minWidth,
|
|
131
|
+
hideMask,
|
|
132
|
+
align = "start",
|
|
133
|
+
...aria
|
|
134
|
+
}: FlyoutProps) => {
|
|
135
|
+
const { refs, context } = useFloating({
|
|
136
|
+
open: true,
|
|
137
|
+
onOpenChange: () => {
|
|
138
|
+
handleClose(false);
|
|
139
|
+
},
|
|
140
|
+
});
|
|
141
|
+
const dismiss = useDismiss(context, {
|
|
142
|
+
outsidePressEvent: "mousedown",
|
|
143
|
+
escapeKey: true,
|
|
144
|
+
});
|
|
145
|
+
const role = useRole(context);
|
|
146
|
+
|
|
147
|
+
// Merge all the interactions into prop getters
|
|
148
|
+
const { getFloatingProps } = useInteractions([dismiss, role]);
|
|
149
|
+
|
|
150
|
+
const handleClose = useCallback(
|
|
151
|
+
(...args: AnyObject) => {
|
|
152
|
+
void Promise.resolve(onBeforeClose?.(...args)).then((ret) => {
|
|
153
|
+
if (ret !== false) {
|
|
154
|
+
refs.floating.current &&
|
|
155
|
+
(refs.floating.current.dataset.show = "false");
|
|
156
|
+
setTimeout(() => {
|
|
157
|
+
onClose?.(...args);
|
|
158
|
+
}, 250);
|
|
159
|
+
}
|
|
160
|
+
ret === false &&
|
|
161
|
+
setTimeout(
|
|
162
|
+
() =>
|
|
163
|
+
refs.floating.current
|
|
164
|
+
?.querySelector<HTMLElement>('[role="dialog"]')
|
|
165
|
+
?.focus(),
|
|
166
|
+
50,
|
|
167
|
+
);
|
|
168
|
+
});
|
|
169
|
+
},
|
|
170
|
+
[onBeforeClose, onClose],
|
|
171
|
+
);
|
|
172
|
+
|
|
173
|
+
useEffect(() => {
|
|
174
|
+
setTimeout(() => {
|
|
175
|
+
refs.floating.current && (refs.floating.current.dataset.show = "true");
|
|
176
|
+
refs.floating.current
|
|
177
|
+
?.querySelector<HTMLElement>('[role="dialog"]')
|
|
178
|
+
?.focus();
|
|
179
|
+
}, 50);
|
|
180
|
+
}, []);
|
|
181
|
+
|
|
182
|
+
const tryClosing = useCallback(
|
|
183
|
+
(e: React.MouseEvent) => {
|
|
184
|
+
if (
|
|
185
|
+
!!closeOnClick ||
|
|
186
|
+
(e.target as HTMLElement).closest("[data-flyout-dismiss='true']")
|
|
187
|
+
) {
|
|
188
|
+
setTimeout(() => {
|
|
189
|
+
handleClose();
|
|
190
|
+
}, 100);
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
[closeOnClick, handleClose],
|
|
194
|
+
);
|
|
195
|
+
|
|
196
|
+
const Wrapper = useCallback(
|
|
197
|
+
({ children }: PropsWithChildren) => {
|
|
198
|
+
if (hideMask) return <Fragment>{children}</Fragment>;
|
|
199
|
+
|
|
200
|
+
return (
|
|
201
|
+
<FloatingOverlay
|
|
202
|
+
lockScroll
|
|
203
|
+
style={{ zIndex: "var(--z-overlay-mask)" }}
|
|
204
|
+
className="bg-base/10 backdrop-blur-sm transition-all"
|
|
205
|
+
>
|
|
206
|
+
{children}
|
|
207
|
+
</FloatingOverlay>
|
|
208
|
+
);
|
|
209
|
+
},
|
|
210
|
+
[hideMask, handleClose],
|
|
211
|
+
);
|
|
212
|
+
|
|
213
|
+
return (
|
|
214
|
+
<FloatingPortal>
|
|
215
|
+
<Wrapper>
|
|
216
|
+
<FloatingFocusManager context={context}>
|
|
217
|
+
<Wrapper>
|
|
218
|
+
<div
|
|
219
|
+
data-align={align}
|
|
220
|
+
className={classNames(
|
|
221
|
+
classes.flyout,
|
|
222
|
+
"fixed inset-y-0 overflow-hidden flex flex-col flex-nowrap pointer-events-auto shadow-xl",
|
|
223
|
+
align === "start" ? "start-0" : "end-0",
|
|
224
|
+
size === "sm" && "w-[20rem]",
|
|
225
|
+
size === "md" && "w-[40rem]",
|
|
226
|
+
size === "lg" && "w-[60vw]",
|
|
227
|
+
size === "xl" && "w-[80vw]",
|
|
228
|
+
)}
|
|
229
|
+
style={{
|
|
230
|
+
width,
|
|
231
|
+
minWidth,
|
|
232
|
+
}}
|
|
233
|
+
onMouseUpCapture={tryClosing}
|
|
234
|
+
ref={refs.setFloating}
|
|
235
|
+
{...getFloatingProps()}
|
|
236
|
+
{...aria}
|
|
237
|
+
{...aria}
|
|
238
|
+
>
|
|
239
|
+
<HotKeyWrapper>
|
|
240
|
+
<Header
|
|
241
|
+
flex
|
|
242
|
+
className={classNames(classes.flyoutHeader, headerClassName)}
|
|
243
|
+
>
|
|
244
|
+
{icon && (
|
|
245
|
+
<Icon
|
|
246
|
+
icon={icon}
|
|
247
|
+
bg={iconBg}
|
|
248
|
+
color={iconColor}
|
|
249
|
+
className={classNames(iconClassName, "p-1")}
|
|
250
|
+
rtlFlip={rtlFlip}
|
|
251
|
+
/>
|
|
252
|
+
)}
|
|
253
|
+
<label className="flex-1 truncate py-2 px-1">{title}</label>
|
|
254
|
+
{actions}
|
|
255
|
+
<Icon
|
|
256
|
+
data-ref="panelClose"
|
|
257
|
+
className={classNames(
|
|
258
|
+
classes.panelAction,
|
|
259
|
+
"cursor-pointer p-1 text-xl self-stretch",
|
|
260
|
+
)}
|
|
261
|
+
icon={CoreIcons.close}
|
|
262
|
+
onClick={() => handleClose(false)}
|
|
263
|
+
/>
|
|
264
|
+
</Header>
|
|
265
|
+
{loading && <Loading />}
|
|
266
|
+
<div
|
|
267
|
+
role="dialog"
|
|
268
|
+
className={classNames(
|
|
269
|
+
classes.flyoutBody,
|
|
270
|
+
"flex-1 grid overflow-hidden",
|
|
271
|
+
)}
|
|
272
|
+
{...({ tabIndex: 0 } as AnyObject)}
|
|
273
|
+
>
|
|
274
|
+
{children}
|
|
275
|
+
</div>
|
|
276
|
+
</HotKeyWrapper>
|
|
277
|
+
</div>
|
|
278
|
+
</Wrapper>
|
|
279
|
+
</FloatingFocusManager>
|
|
280
|
+
</Wrapper>
|
|
281
|
+
</FloatingPortal>
|
|
282
|
+
);
|
|
283
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* React Fabric
|
|
3
|
+
* @version: 1.0.0
|
|
4
|
+
*
|
|
5
|
+
*
|
|
6
|
+
* The MIT License (MIT)
|
|
7
|
+
* Copyright (c) 2024 Adarsh Pastakia
|
|
8
|
+
*
|
|
9
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software
|
|
10
|
+
* and associated documentation files (the "Software"), to deal in the Software without restriction,
|
|
11
|
+
* including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
12
|
+
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
|
|
13
|
+
* subject to the following conditions:
|
|
14
|
+
*
|
|
15
|
+
* The above copyright notice and this permission notice shall be included in all copies or substantial
|
|
16
|
+
* portions of the Software.
|
|
17
|
+
*
|
|
18
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
|
|
19
|
+
* TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
20
|
+
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
21
|
+
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
export { Alert } from "./alert/Alert";
|
|
25
|
+
export { Flyout } from "./flyout/Flyout";
|
|
26
|
+
export { Message } from "./message/Message";
|
|
27
|
+
export { Modal } from "./modal/Modal";
|
|
28
|
+
export { Toast } from "./toast/Toast";
|
|
29
|
+
export { Tooltip } from "./tooltip/Tooltip";
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* React Fabric
|
|
3
|
+
* @version: 1.0.0
|
|
4
|
+
*
|
|
5
|
+
*
|
|
6
|
+
* The MIT License (MIT)
|
|
7
|
+
* Copyright (c) 2024 Adarsh Pastakia
|
|
8
|
+
*
|
|
9
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software
|
|
10
|
+
* and associated documentation files (the "Software"), to deal in the Software without restriction,
|
|
11
|
+
* including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
12
|
+
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
|
|
13
|
+
* subject to the following conditions:
|
|
14
|
+
*
|
|
15
|
+
* The above copyright notice and this permission notice shall be included in all copies or substantial
|
|
16
|
+
* portions of the Software.
|
|
17
|
+
*
|
|
18
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
|
|
19
|
+
* TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
20
|
+
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
21
|
+
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
@layer comp {
|
|
25
|
+
.message {
|
|
26
|
+
margin-top: -100%;
|
|
27
|
+
opacity: 0;
|
|
28
|
+
transition:
|
|
29
|
+
margin 0.4s,
|
|
30
|
+
opacity 0.3s 0.2s;
|
|
31
|
+
|
|
32
|
+
&[data-show="true"] {
|
|
33
|
+
margin-top: 0;
|
|
34
|
+
opacity: 1;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|