@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,4 @@
|
|
|
1
|
+
export declare const getColor: (color: string) => string | undefined;
|
|
2
|
+
export declare const getBgClass: (bg: string) => string | undefined;
|
|
3
|
+
export declare const getColorClass: (color: string) => string | undefined;
|
|
4
|
+
export declare const getBorderClass: (color: string) => string | undefined;
|
package/package.json
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@react-fabric/core",
|
|
3
|
+
"version": "1.0.0-beta.0",
|
|
4
|
+
"description": "RUF: Core package",
|
|
5
|
+
"author": "Adarsh Pastakia <adarshpastakia@outlook.com>",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": "https://github.com/adarshpastakia/react-ui-framework/tree/main/packages/core",
|
|
8
|
+
"source": "src/index.ts",
|
|
9
|
+
"main": "dist/cjs/index.js",
|
|
10
|
+
"module": "dist/esm/index.js",
|
|
11
|
+
"types": "dist/types/index.d.ts",
|
|
12
|
+
"directories": {
|
|
13
|
+
"src": "src",
|
|
14
|
+
"styles": "css",
|
|
15
|
+
"test": "tests"
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"css",
|
|
19
|
+
"src",
|
|
20
|
+
"dist"
|
|
21
|
+
],
|
|
22
|
+
"publishConfig": {
|
|
23
|
+
"access": "public",
|
|
24
|
+
"registry": "https://registry.npmjs.org/"
|
|
25
|
+
},
|
|
26
|
+
"scripts": {
|
|
27
|
+
"makelink": "yarn link",
|
|
28
|
+
"removelink": "yarn unlink",
|
|
29
|
+
"prebuild": "rm -rf ./dist",
|
|
30
|
+
"build:dts": "tsc -p ./tsconfig.build.json",
|
|
31
|
+
"build:rollup": "rollup -c ../../rollup.config.mjs",
|
|
32
|
+
"build": "npm-run-all -p build:rollup build:dts",
|
|
33
|
+
"watch:dts": "tsc -w -p ./tsconfig.build.json",
|
|
34
|
+
"watch:rollup": "rollup -w -c ../../rollup.config.mjs",
|
|
35
|
+
"watch": "npm-run-all -p watch:rollup watch:dts"
|
|
36
|
+
},
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"@floating-ui/react": "^0.26.24",
|
|
39
|
+
"@react-fabric/utilities": "^1.0.0-beta.0",
|
|
40
|
+
"@tailwindcss/container-queries": "^0.1.1",
|
|
41
|
+
"@tailwindcss/forms": "^0.5.7",
|
|
42
|
+
"@tailwindcss/typography": "^0.5.13",
|
|
43
|
+
"boring-avatars": "^1.10.2",
|
|
44
|
+
"classnames": "^2.5.1",
|
|
45
|
+
"color": "^4.2.3",
|
|
46
|
+
"resize-observer-polyfill": "^1.5.1",
|
|
47
|
+
"tailwindcss": "^3.4.4"
|
|
48
|
+
},
|
|
49
|
+
"peerDependencies": {
|
|
50
|
+
"i18next": "^23.15.1",
|
|
51
|
+
"react": ">=18.0.0 <20.0.0",
|
|
52
|
+
"react-dom": ">=18.0.0 <20.0.0",
|
|
53
|
+
"react-i18next": "^15.0.2"
|
|
54
|
+
},
|
|
55
|
+
"engines": {
|
|
56
|
+
"node": ">=18.12.0",
|
|
57
|
+
"npm": ">=8.19.0"
|
|
58
|
+
},
|
|
59
|
+
"gitHead": "83fa79064b1d57e71149005432192d506810bbda"
|
|
60
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
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
|
+
.actionLabel {
|
|
26
|
+
& > .actions {
|
|
27
|
+
--width: 4rem;
|
|
28
|
+
|
|
29
|
+
width: 0;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&:not([data-disabled="true"]):hover > .actions {
|
|
33
|
+
width: var(--width);
|
|
34
|
+
transition: all cubic-bezier(0.215, 0.61, 0.355, 1) 100ms;
|
|
35
|
+
transition-delay: 500ms;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
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 classNames from "classnames";
|
|
25
|
+
import { type ReactElement, useCallback } from "react";
|
|
26
|
+
import { type AriaProps, type ChildProp, type CssProp } from "../../types";
|
|
27
|
+
import { ButtonGroup } from "../button/ButtonGroup";
|
|
28
|
+
import classes from "./ActionLabel.module.css";
|
|
29
|
+
|
|
30
|
+
export interface ActionLabelProps extends AriaProps, CssProp, ChildProp {
|
|
31
|
+
/**
|
|
32
|
+
* action buttons aligment
|
|
33
|
+
*/
|
|
34
|
+
align?: "start" | "end";
|
|
35
|
+
/**
|
|
36
|
+
* disable actions
|
|
37
|
+
*/
|
|
38
|
+
disabled?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* buttons
|
|
41
|
+
*/
|
|
42
|
+
actions: ReactElement[];
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* A simple label component with additional actions (like a button or icon) that becomes visible only when the user hovers over the label,
|
|
47
|
+
* useful in interfaces where space is limited or where it's important to keep the UI clean and focused
|
|
48
|
+
*/
|
|
49
|
+
export const ActionLabel = ({
|
|
50
|
+
children,
|
|
51
|
+
className,
|
|
52
|
+
align,
|
|
53
|
+
actions,
|
|
54
|
+
disabled,
|
|
55
|
+
...rest
|
|
56
|
+
}: ActionLabelProps) => {
|
|
57
|
+
/**
|
|
58
|
+
* calculate the width of the action box, width will be used for a delayed transition on hover
|
|
59
|
+
*/
|
|
60
|
+
const calculateBasis = useCallback((el: HTMLElement | null) => {
|
|
61
|
+
if (el) {
|
|
62
|
+
const clone = el.cloneNode(true) as HTMLElement;
|
|
63
|
+
clone.className = "";
|
|
64
|
+
clone.style.left = "-200%";
|
|
65
|
+
clone.style.overflow = "hidden";
|
|
66
|
+
clone.style.position = "absolute";
|
|
67
|
+
clone.style.whiteSpace = "nowrap";
|
|
68
|
+
document.body.appendChild(clone);
|
|
69
|
+
el.style.setProperty("--width", `${clone.offsetWidth}px`);
|
|
70
|
+
clone.remove();
|
|
71
|
+
}
|
|
72
|
+
}, []);
|
|
73
|
+
|
|
74
|
+
return (
|
|
75
|
+
<div
|
|
76
|
+
className={classNames(
|
|
77
|
+
className,
|
|
78
|
+
classes.actionLabel,
|
|
79
|
+
"flex overflow-hidden gap-1 items-center cursor-default select-none",
|
|
80
|
+
)}
|
|
81
|
+
data-disabled={disabled}
|
|
82
|
+
{...rest}
|
|
83
|
+
>
|
|
84
|
+
<ButtonGroup
|
|
85
|
+
ref={calculateBasis}
|
|
86
|
+
className={classNames(
|
|
87
|
+
classes.actions,
|
|
88
|
+
"overflow-hidden flex-content",
|
|
89
|
+
align === "end" && "order-2",
|
|
90
|
+
)}
|
|
91
|
+
>
|
|
92
|
+
{actions}
|
|
93
|
+
</ButtonGroup>
|
|
94
|
+
<div className="flex-initial truncate">{children}</div>
|
|
95
|
+
</div>
|
|
96
|
+
);
|
|
97
|
+
};
|
|
@@ -0,0 +1,253 @@
|
|
|
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
|
+
@keyframes l2 {
|
|
26
|
+
0%,
|
|
27
|
+
25% {
|
|
28
|
+
background-position:
|
|
29
|
+
0 50%,
|
|
30
|
+
0 calc(50% - 2px),
|
|
31
|
+
0 calc(50% + 2px),
|
|
32
|
+
50% 50%,
|
|
33
|
+
50% calc(50% - 2px),
|
|
34
|
+
50% calc(50% + 2px),
|
|
35
|
+
100% 50%,
|
|
36
|
+
100% calc(50% - 2px),
|
|
37
|
+
100% calc(50% + 2px);
|
|
38
|
+
background-size:
|
|
39
|
+
8px 0,
|
|
40
|
+
8px 4px,
|
|
41
|
+
8px 4px,
|
|
42
|
+
8px 0,
|
|
43
|
+
8px 4px,
|
|
44
|
+
8px 4px,
|
|
45
|
+
8px 0,
|
|
46
|
+
8px 4px,
|
|
47
|
+
8px 4px;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
50% {
|
|
51
|
+
background-position:
|
|
52
|
+
0 50%,
|
|
53
|
+
0 calc(0% - 2px),
|
|
54
|
+
0 calc(100% + 2px),
|
|
55
|
+
50% 50%,
|
|
56
|
+
50% calc(50% - 2px),
|
|
57
|
+
50% calc(50% + 2px),
|
|
58
|
+
100% 50%,
|
|
59
|
+
100% calc(50% - 2px),
|
|
60
|
+
100% calc(50% + 2px);
|
|
61
|
+
background-size:
|
|
62
|
+
8px 100%,
|
|
63
|
+
8px 4px,
|
|
64
|
+
8px 4px,
|
|
65
|
+
8px 0,
|
|
66
|
+
8px 4px,
|
|
67
|
+
8px 4px,
|
|
68
|
+
8px 0,
|
|
69
|
+
8px 4px,
|
|
70
|
+
8px 4px;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
75% {
|
|
74
|
+
background-position:
|
|
75
|
+
0 50%,
|
|
76
|
+
0 calc(0% - 2px),
|
|
77
|
+
0 calc(100% + 2px),
|
|
78
|
+
50% 50%,
|
|
79
|
+
50% calc(0% - 2px),
|
|
80
|
+
50% calc(100% + 2px),
|
|
81
|
+
100% 50%,
|
|
82
|
+
100% calc(50% - 2px),
|
|
83
|
+
100% calc(50% + 2px);
|
|
84
|
+
background-size:
|
|
85
|
+
8px 100%,
|
|
86
|
+
8px 4px,
|
|
87
|
+
8px 4px,
|
|
88
|
+
8px 100%,
|
|
89
|
+
8px 4px,
|
|
90
|
+
8px 4px,
|
|
91
|
+
8px 0,
|
|
92
|
+
8px 4px,
|
|
93
|
+
8px 4px;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
95%,
|
|
97
|
+
100% {
|
|
98
|
+
background-position:
|
|
99
|
+
0 50%,
|
|
100
|
+
0 calc(0% - 2px),
|
|
101
|
+
0 calc(100% + 2px),
|
|
102
|
+
50% 50%,
|
|
103
|
+
50% calc(0% - 2px),
|
|
104
|
+
50% calc(100% + 2px),
|
|
105
|
+
100% 50%,
|
|
106
|
+
100% calc(0% - 2px),
|
|
107
|
+
100% calc(100% + 2px);
|
|
108
|
+
background-size:
|
|
109
|
+
8px 100%,
|
|
110
|
+
8px 4px,
|
|
111
|
+
8px 4px,
|
|
112
|
+
8px 100%,
|
|
113
|
+
8px 4px,
|
|
114
|
+
8px 4px,
|
|
115
|
+
8px 100%,
|
|
116
|
+
8px 4px,
|
|
117
|
+
8px 4px;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.bars {
|
|
122
|
+
--c: linear-gradient(currentcolor 0 0);
|
|
123
|
+
--r1: radial-gradient(farthest-side at bottom, currentcolor 93%, #0000);
|
|
124
|
+
--r2: radial-gradient(farthest-side at top, currentcolor 93%, #0000);
|
|
125
|
+
|
|
126
|
+
aspect-ratio: 1;
|
|
127
|
+
background: var(--c), var(--r1), var(--r2), var(--c), var(--r1), var(--r2),
|
|
128
|
+
var(--c), var(--r1), var(--r2);
|
|
129
|
+
background-repeat: no-repeat;
|
|
130
|
+
animation: l2 1s infinite alternate;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
@keyframes l4 {
|
|
134
|
+
to {
|
|
135
|
+
transform: rotate(1turn);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.spinner {
|
|
140
|
+
--b: 8px;
|
|
141
|
+
|
|
142
|
+
aspect-ratio: 1;
|
|
143
|
+
|
|
144
|
+
background: conic-gradient(#0000 10%, currentcolor) content-box;
|
|
145
|
+
border-radius: 50%;
|
|
146
|
+
|
|
147
|
+
mask: repeating-conic-gradient(
|
|
148
|
+
#0000 0deg,
|
|
149
|
+
#000 1deg 20deg,
|
|
150
|
+
#0000 21deg 36deg
|
|
151
|
+
),
|
|
152
|
+
radial-gradient(
|
|
153
|
+
farthest-side,
|
|
154
|
+
#0000 calc(100% - var(--b) - 1px),
|
|
155
|
+
#000 calc(100% - var(--b))
|
|
156
|
+
);
|
|
157
|
+
|
|
158
|
+
animation: l4 2s infinite steps(10);
|
|
159
|
+
|
|
160
|
+
mask-composite: destination-in;
|
|
161
|
+
mask-composite: intersect;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
@keyframes loader {
|
|
165
|
+
from {
|
|
166
|
+
transform: translateX(calc(-100% * var(--multiplier)));
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
to {
|
|
170
|
+
transform: translateX(calc(100% * var(--multiplier)));
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.loader {
|
|
175
|
+
--multiplier: 1;
|
|
176
|
+
|
|
177
|
+
& > div {
|
|
178
|
+
height: calc(0.125rem + 2px);
|
|
179
|
+
|
|
180
|
+
&::after {
|
|
181
|
+
animation: loader 1s cubic-bezier(0.65, 0, 0.45, 1) infinite;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
:global([dir="rtl"]) & {
|
|
186
|
+
--multiplier: -1;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
@keyframes check-stroke {
|
|
191
|
+
100% {
|
|
192
|
+
stroke-dashoffset: 0;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
@keyframes check-scale {
|
|
197
|
+
0%,
|
|
198
|
+
100% {
|
|
199
|
+
transform: none;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
50% {
|
|
203
|
+
transform: scale3d(1.1, 1.1, 1);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
@keyframes check-fill {
|
|
208
|
+
100% {
|
|
209
|
+
box-shadow: inset 0 0 0 1em currentcolor;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
.checkAnimation {
|
|
214
|
+
width: 1.5em;
|
|
215
|
+
height: 1.5em;
|
|
216
|
+
|
|
217
|
+
color: theme(colors.primary.DEFAULT);
|
|
218
|
+
|
|
219
|
+
box-shadow: inset 0 0 0 currentcolor;
|
|
220
|
+
|
|
221
|
+
fill: transparent;
|
|
222
|
+
stroke-miterlimit: 10;
|
|
223
|
+
stroke-width: 4px;
|
|
224
|
+
|
|
225
|
+
animation:
|
|
226
|
+
check-fill 0.4s ease-in-out 0.4s forwards,
|
|
227
|
+
check-scale 0.3s ease-in-out 0.9s both;
|
|
228
|
+
animation-delay: 0.75s;
|
|
229
|
+
|
|
230
|
+
& .circlePart {
|
|
231
|
+
fill: transparent;
|
|
232
|
+
stroke: currentcolor;
|
|
233
|
+
stroke-dasharray: 166;
|
|
234
|
+
stroke-dashoffset: 166;
|
|
235
|
+
stroke-miterlimit: 10;
|
|
236
|
+
stroke-width: 8px;
|
|
237
|
+
|
|
238
|
+
animation: check-stroke 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
|
|
239
|
+
animation-delay: 0.25s;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
& .iconPart {
|
|
243
|
+
transform-origin: 50% 50%;
|
|
244
|
+
|
|
245
|
+
stroke: currentcolor;
|
|
246
|
+
stroke-dasharray: 48;
|
|
247
|
+
stroke-dashoffset: 48;
|
|
248
|
+
|
|
249
|
+
animation: check-stroke 0.3s cubic-bezier(0.65, 0, 0.45, 1) 0.8s forwards;
|
|
250
|
+
animation-delay: 0.75s;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
}
|
|
@@ -0,0 +1,190 @@
|
|
|
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 classNames from "classnames";
|
|
25
|
+
import { useMemo } from "react";
|
|
26
|
+
import { useMemoDebugger } from "../../hooks/useEffectDebugger";
|
|
27
|
+
import {
|
|
28
|
+
type AriaProps,
|
|
29
|
+
type ColorType,
|
|
30
|
+
type CssProp,
|
|
31
|
+
type PaletteType,
|
|
32
|
+
} from "../../types";
|
|
33
|
+
import { getColor, getColorClass } from "../../utils";
|
|
34
|
+
import classes from "./Animations.module.css";
|
|
35
|
+
|
|
36
|
+
export interface AnimationProps extends CssProp, AriaProps {
|
|
37
|
+
type?: "info" | "check" | "cross" | "question" | "exclaim";
|
|
38
|
+
/**
|
|
39
|
+
* icon color
|
|
40
|
+
*/
|
|
41
|
+
color?: ColorType | PaletteType;
|
|
42
|
+
/**
|
|
43
|
+
* icon mark color
|
|
44
|
+
*/
|
|
45
|
+
strokeColor?: ColorType | PaletteType;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export const AnimationIndicator = ({
|
|
49
|
+
className,
|
|
50
|
+
color,
|
|
51
|
+
strokeColor,
|
|
52
|
+
type,
|
|
53
|
+
...aria
|
|
54
|
+
}: AnimationProps) => {
|
|
55
|
+
const styles = useMemoDebugger(
|
|
56
|
+
() => {
|
|
57
|
+
const s: KeyValue = {};
|
|
58
|
+
if (color) {
|
|
59
|
+
s.color = getColor(color);
|
|
60
|
+
}
|
|
61
|
+
if (strokeColor) {
|
|
62
|
+
s.stroke = getColor(strokeColor);
|
|
63
|
+
}
|
|
64
|
+
return s;
|
|
65
|
+
},
|
|
66
|
+
[color, strokeColor],
|
|
67
|
+
"Animation styles",
|
|
68
|
+
);
|
|
69
|
+
const path = useMemo(() => {
|
|
70
|
+
if (type === "check") return "M14.1 27.2l7.1 7.2 16.7-16.8";
|
|
71
|
+
if (type === "cross") return "M14.1 14.1l23.8 23.8 m0,-23.8 l-23.8,23.8";
|
|
72
|
+
if (type === "question")
|
|
73
|
+
return "M18.949 17.621c0.426-0.787 1.354-1.6 2.108-2.223 1.279-0.984 3.87-1.778 5.805-1.778 3.837 0 6.189 2.689 6.189 6.034 0 2.23-1.193 4.214-3.751 6.346-2.886 2.361-3.497 3.362-3.497 5.788v0c0-2.263 0.689-3.509 3.476-5.772 2.689-2.23 3.772-3.968 3.772-6.362 0-3.772-2.492-6.034-6.789-6.034-2.132 0-3.903 0.722-5.28 1.804-0.82 0.623-1.476 1.377-2.033 2.197zM26 41.329v0-2.948z";
|
|
74
|
+
if (type === "exclaim")
|
|
75
|
+
return "M26.611 10.873c-0.002 1.015-0.002 2.071-0.002 3.086v11.777c0 3.086 0.002 2.232 0 3.288h-0.018c-0.001-1.056 0-0.202 0-3.288v-11.777c0-1.015 0-2.071-0.002-3.086zM26.59 37.472h0.018v3.655h-0.018z";
|
|
76
|
+
return "M26 22L26 41M27 22L27 41M25 22L25 41M26 11L26 16M27 11L27 16M25 11L25 16Z";
|
|
77
|
+
}, [type]);
|
|
78
|
+
/** ***************** component *******************/
|
|
79
|
+
return (
|
|
80
|
+
<svg
|
|
81
|
+
data-ref="animated-indicator"
|
|
82
|
+
className={classNames(
|
|
83
|
+
classes.checkAnimation,
|
|
84
|
+
className,
|
|
85
|
+
"inline-block rounded-full",
|
|
86
|
+
color && getColorClass(color),
|
|
87
|
+
)}
|
|
88
|
+
style={styles}
|
|
89
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
90
|
+
viewBox="0 0 52 52"
|
|
91
|
+
aria-hidden="true"
|
|
92
|
+
{...aria}
|
|
93
|
+
>
|
|
94
|
+
<circle className={classes.circlePart} cx="26" cy="26" r="25" />
|
|
95
|
+
<path
|
|
96
|
+
className={classNames(
|
|
97
|
+
classes.iconPart,
|
|
98
|
+
getColorClass(strokeColor ?? "invert"),
|
|
99
|
+
)}
|
|
100
|
+
d={path}
|
|
101
|
+
/>
|
|
102
|
+
</svg>
|
|
103
|
+
);
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
export const AnimationBars = ({
|
|
107
|
+
color = "tint-700",
|
|
108
|
+
size = "2rem",
|
|
109
|
+
}: {
|
|
110
|
+
color?: ColorType | string;
|
|
111
|
+
size?: number | string;
|
|
112
|
+
}) => {
|
|
113
|
+
return (
|
|
114
|
+
<div
|
|
115
|
+
className={classNames(
|
|
116
|
+
"absolute inset-0 z-10 flex justify-center items-center cursor-wait",
|
|
117
|
+
)}
|
|
118
|
+
>
|
|
119
|
+
<div
|
|
120
|
+
className={classNames(
|
|
121
|
+
"outline outline-tint-500/20 p-4 bg-base/50 backdrop-blur-sm rounded",
|
|
122
|
+
)}
|
|
123
|
+
>
|
|
124
|
+
<div
|
|
125
|
+
className={classNames(classes.bars, getColorClass(color + "-500/50"))}
|
|
126
|
+
style={{ width: size }}
|
|
127
|
+
/>
|
|
128
|
+
</div>
|
|
129
|
+
</div>
|
|
130
|
+
);
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
export const AnimationSpinner = ({
|
|
134
|
+
color = "tint-700",
|
|
135
|
+
size = "2rem",
|
|
136
|
+
}: {
|
|
137
|
+
color?: ColorType | string;
|
|
138
|
+
size?: number | string;
|
|
139
|
+
}) => {
|
|
140
|
+
return (
|
|
141
|
+
<div
|
|
142
|
+
className={classNames(
|
|
143
|
+
"absolute inset-0 z-10 flex justify-center items-center cursor-wait",
|
|
144
|
+
)}
|
|
145
|
+
>
|
|
146
|
+
<div
|
|
147
|
+
className={classNames(
|
|
148
|
+
"outline outline-tint-500/20 p-4 bg-base/50 backdrop-blur-sm rounded",
|
|
149
|
+
)}
|
|
150
|
+
>
|
|
151
|
+
<div
|
|
152
|
+
className={classNames(classes.spinner, getColorClass(color))}
|
|
153
|
+
style={{ width: size }}
|
|
154
|
+
/>
|
|
155
|
+
</div>
|
|
156
|
+
</div>
|
|
157
|
+
);
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
export const Loading = () => {
|
|
161
|
+
return (
|
|
162
|
+
<div
|
|
163
|
+
className={classNames(
|
|
164
|
+
classes.loader,
|
|
165
|
+
"area-[loader] relative overflow-x-clip",
|
|
166
|
+
)}
|
|
167
|
+
>
|
|
168
|
+
<div className="absolute z-10 py-px inset-x-0 top-0 after:h-0.5 after:block after:bg-primary-500" />
|
|
169
|
+
</div>
|
|
170
|
+
);
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
export const Skeleton = () => {
|
|
174
|
+
return (
|
|
175
|
+
<div className={classNames("p-2 animate-pulse flex gap-2 max-w-lg")}>
|
|
176
|
+
<div className="bg-tint-100 rounded aspect-square h-12" />
|
|
177
|
+
<div className="flex-1 flex flex-col gap-2">
|
|
178
|
+
<div className="bg-tint-100 h-3 rounded-full" />
|
|
179
|
+
<div className="flex gap-2">
|
|
180
|
+
<div className="bg-tint-100 h-2 rounded-full basis-[30%]" />
|
|
181
|
+
<div className="bg-tint-100 h-2 rounded-full basis-[60%]" />
|
|
182
|
+
</div>
|
|
183
|
+
<div className="flex gap-2">
|
|
184
|
+
<div className="bg-tint-100 h-2 rounded-full basis-[30%]" />
|
|
185
|
+
<div className="bg-tint-100 h-2 rounded-full basis-[60%]" />
|
|
186
|
+
</div>
|
|
187
|
+
</div>
|
|
188
|
+
</div>
|
|
189
|
+
);
|
|
190
|
+
};
|