@react-fabric/core 1.0.0-beta.6 → 1.0.0-beta.61
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/{src/components/actionLabel/ActionLabel.module.css → css/components/_actionLabel.css} +4 -4
- package/{src/overlays/alert/Alert.module.css → css/components/_alert.css} +3 -3
- package/{src/components/animations/Animations.module.css → css/components/_animations.css} +9 -9
- package/{src/components/avatar/Avatar.module.css → css/components/_avatar.css} +11 -11
- package/{src/components/badge/Badge.module.css → css/components/_badge.css} +19 -17
- package/{src/components/breadcrumbs/Breadcrumbs.module.css → css/components/_breadcrumbs.css} +52 -47
- package/{src/components/button/Button.module.css → css/components/_button.css} +86 -84
- package/{src/components/card/Card.module.css → css/components/_card.css} +54 -28
- package/{src/components/chip/Chip.module.css → css/components/_chip.css} +14 -10
- package/{src/components/collapsable/Collapsable.module.css → css/components/_collapsable.css} +3 -3
- package/css/components/_divider.css +38 -0
- package/{src/components/dropdown/Dropdown.module.css → css/components/_dropdown.css} +2 -2
- package/{src/overlays/flyout/Flyout.module.css → css/components/_flyout.css} +6 -6
- package/{src/components/icon/Icon.module.css → css/components/_icon.css} +12 -9
- package/{src/components/media/Media.module.css → css/components/_media.css} +17 -17
- package/{src/components/menu/Menu.module.css → css/components/_menu.css} +21 -20
- package/{src/overlays/message/Message.module.css → css/components/_message.css} +2 -2
- package/{src/components/meter/Meter.module.css → css/components/_meter.css} +10 -10
- package/{src/overlays/modal/Modal.module.css → css/components/_modal.css} +8 -8
- package/{src/components/panel/Panel.module.css → css/components/_panel.css} +17 -17
- package/{src/components/progress/Progress.module.css → css/components/_progress.css} +7 -10
- package/css/components/_stepper.css +86 -0
- package/{src/components/tabpanel/TabPanel.module.css → css/components/_tabPanel.css} +130 -85
- package/{src/overlays/toast/Toast.module.css → css/components/_toast.css} +2 -2
- package/css/components/_tooltip.css +29 -0
- package/{src/core/content/Content.module.css → css/components/index.css} +26 -18
- package/{src/core/aside/Aside.module.css → css/core/_aside.css} +60 -48
- package/{src/core/section/Section.module.css → css/core/_content.css} +5 -3
- package/{src/core/boundary/ErrorBoundary.module.css → css/core/_errorboundary.css} +9 -9
- package/{src/core/headfoot/HeadFoot.module.css → css/core/_headfoot.css} +4 -10
- package/{src/core/page/Page.module.css → css/core/_page.css} +10 -14
- package/{src/core/responsive/Responsive.module.css → css/core/_responsive.css} +10 -10
- package/css/core/_section.css +28 -0
- package/{src/core/theme/Theme.module.css → css/core/_theme.css} +3 -3
- package/{src/typography/Typography.module.css → css/core/_typography.css} +14 -12
- package/{src/core/viewport/Viewport.module.css → css/core/_viewport.css} +7 -3
- package/css/core/index.css +33 -0
- package/css/reset/_gradients.css +8 -8
- package/css/reset/_reset.css +56 -224
- package/css/reset/_text.css +14 -29
- package/css/reset/_theme.css +331 -52
- package/css/reset/index.css +4 -4
- package/css/styles.css +9 -6
- package/css/theme/_colors.css +320 -0
- package/css/theme/_utilities.css +541 -0
- package/css/theme/index.css +45 -0
- package/dist/cjs/components/actionLabel/ActionLabel.js +26 -8
- package/dist/cjs/components/animations/Animations.js +137 -45
- package/dist/cjs/components/avatar/Avatar.js +46 -13
- package/dist/cjs/components/avatar/AvatarGroup.js +22 -4
- package/dist/cjs/components/badge/Badge.js +36 -15
- package/dist/cjs/components/breadcrumbs/Breadcrumbs.js +40 -9
- package/dist/cjs/components/button/Button.js +51 -29
- package/dist/cjs/components/button/ButtonGroup.js +30 -3
- package/dist/cjs/components/button/ConfirmButton.js +28 -2
- package/dist/cjs/components/button/ToggleButtonGroup.js +41 -15
- package/dist/cjs/components/callout/Callout.js +47 -7
- package/dist/cjs/components/card/Card.js +60 -18
- package/dist/cjs/components/card/CardCover.js +36 -5
- package/dist/cjs/components/card/FlipContent.js +56 -0
- package/dist/cjs/components/chip/Chip.js +40 -20
- package/dist/cjs/components/collapsable/Collapsable.js +32 -8
- package/dist/cjs/components/divider/Divider.js +30 -7
- package/dist/cjs/components/dropdown/Dropdown.js +48 -9
- package/dist/cjs/components/dropdown/DropdownTool.js +2 -3
- package/dist/cjs/components/empty/EmptyContent.js +37 -7
- package/dist/cjs/components/icon/Icon.js +76 -13
- package/dist/cjs/components/media/Media.js +174 -76
- package/dist/cjs/components/menu/ContextMenu.js +19 -0
- package/dist/cjs/components/menu/Menu.js +77 -23
- package/dist/cjs/components/menu/MenuItem.js +54 -27
- package/dist/cjs/components/meter/Meter.js +26 -3
- package/dist/cjs/components/navigator/Navigator.js +50 -18
- package/dist/cjs/components/panel/Panel.js +59 -28
- package/dist/cjs/components/panel/PanelGroup.js +25 -2
- package/dist/cjs/components/panel/PanelStack.js +31 -2
- package/dist/cjs/components/progress/ProgressBar.js +31 -9
- package/dist/cjs/components/progress/ProgressCircle.js +29 -7
- package/dist/cjs/components/tabpanel/Tab.js +39 -16
- package/dist/cjs/components/tabpanel/TabPanel.js +56 -16
- package/dist/cjs/context/Global.js +28 -1
- package/dist/cjs/context/NotificationCenter.js +3 -3
- package/dist/cjs/core/aside/Aside.js +50 -25
- package/dist/cjs/core/boundary/ErrorBoundary.js +25 -8
- package/dist/cjs/core/boundary/ErrorIcon.js +1 -2
- package/dist/cjs/core/content/Content.js +7 -3
- package/dist/cjs/core/headfoot/HeadFoot.js +48 -22
- package/dist/cjs/core/page/Page.js +41 -40
- package/dist/cjs/core/responsive/Responsive.js +59 -6
- package/dist/cjs/core/section/Section.js +12 -29
- package/dist/cjs/core/theme/ThemeProvider.js +32 -10
- package/dist/cjs/core/viewport/Viewport.js +18 -2
- package/dist/cjs/hooks/useControlledValue.js +12 -0
- package/dist/cjs/hooks/useDebounce.js +14 -1
- package/dist/cjs/hooks/useEffectDebugger.js +54 -2
- package/dist/cjs/hooks/useIsDark.js +8 -0
- package/dist/cjs/hooks/useIsRtl.js +12 -0
- package/dist/cjs/hooks/useNavigator.js +6 -4
- package/dist/cjs/hooks/useOverlayService.js +24 -0
- package/dist/cjs/hooks/usePropToggle.js +16 -5
- package/dist/cjs/hooks/useResize.js +18 -0
- package/dist/cjs/hooks/useResizeObserver.js +20 -1
- package/dist/cjs/hooks/useStepper.js +74 -0
- package/dist/cjs/hooks/useStorage.js +39 -0
- package/dist/cjs/hotkeys/HotKeyLabel.js +1 -1
- package/dist/cjs/hotkeys/HotKeyWrapper.js +3 -1
- package/dist/cjs/index.js +14 -10
- package/dist/cjs/overlays/alert/Alert.js +24 -17
- package/dist/cjs/overlays/flyout/Flyout.js +48 -65
- package/dist/cjs/overlays/message/Message.js +8 -3
- package/dist/cjs/overlays/modal/Modal.js +19 -23
- package/dist/cjs/overlays/toast/Toast.js +22 -13
- package/dist/cjs/overlays/tooltip/Tooltip.js +25 -13
- package/dist/cjs/typography/Abbr.js +35 -7
- package/dist/cjs/typography/{Link.js → Anchor.js} +23 -5
- package/dist/cjs/typography/Copy.js +1 -2
- package/dist/cjs/typography/Mark.js +25 -5
- package/dist/cjs/typography/Text.js +30 -5
- package/dist/cjs/typography/Title.js +19 -4
- package/dist/cjs/utils/cloneElement.js +47 -0
- package/dist/cjs/utils/getColor.js +1 -18
- package/dist/esm/components/actionLabel/ActionLabel.js +26 -8
- package/dist/esm/components/animations/Animations.js +135 -44
- package/dist/esm/components/avatar/Avatar.js +46 -13
- package/dist/esm/components/avatar/AvatarGroup.js +22 -4
- package/dist/esm/components/badge/Badge.js +38 -17
- package/dist/esm/components/breadcrumbs/Breadcrumbs.js +40 -9
- package/dist/esm/components/button/Button.js +53 -31
- package/dist/esm/components/button/ButtonGroup.js +31 -4
- package/dist/esm/components/button/ConfirmButton.js +28 -2
- package/dist/esm/components/button/ToggleButtonGroup.js +42 -16
- package/dist/esm/components/callout/Callout.js +47 -7
- package/dist/esm/components/card/Card.js +61 -19
- package/dist/esm/components/card/CardCover.js +36 -5
- package/dist/esm/components/card/FlipContent.js +56 -0
- package/dist/esm/components/chip/Chip.js +42 -22
- package/dist/esm/components/collapsable/Collapsable.js +32 -8
- package/dist/esm/components/divider/Divider.js +31 -8
- package/dist/esm/components/dropdown/Dropdown.js +48 -9
- package/dist/esm/components/dropdown/DropdownTool.js +2 -3
- package/dist/esm/components/empty/EmptyContent.js +37 -7
- package/dist/esm/components/icon/Icon.js +78 -16
- package/dist/esm/components/media/Media.js +175 -77
- package/dist/esm/components/menu/ContextMenu.js +19 -0
- package/dist/esm/components/menu/Menu.js +79 -25
- package/dist/esm/components/menu/MenuItem.js +49 -22
- package/dist/esm/components/meter/Meter.js +26 -3
- package/dist/esm/components/navigator/Navigator.js +50 -18
- package/dist/esm/components/panel/Panel.js +61 -30
- package/dist/esm/components/panel/PanelGroup.js +25 -2
- package/dist/esm/components/panel/PanelStack.js +31 -2
- package/dist/esm/components/progress/ProgressBar.js +31 -9
- package/dist/esm/components/progress/ProgressCircle.js +29 -7
- package/dist/esm/components/tabpanel/Tab.js +40 -17
- package/dist/esm/components/tabpanel/TabPanel.js +56 -16
- package/dist/esm/context/Global.js +28 -1
- package/dist/esm/context/NotificationCenter.js +3 -3
- package/dist/esm/core/aside/Aside.js +52 -27
- package/dist/esm/core/boundary/ErrorBoundary.js +25 -8
- package/dist/esm/core/boundary/ErrorIcon.js +1 -2
- package/dist/esm/core/content/Content.js +7 -3
- package/dist/esm/core/headfoot/HeadFoot.js +48 -22
- package/dist/esm/core/page/Page.js +43 -42
- package/dist/esm/core/responsive/Responsive.js +59 -6
- package/dist/esm/core/section/Section.js +12 -29
- package/dist/esm/core/theme/ThemeProvider.js +32 -10
- package/dist/esm/core/viewport/Viewport.js +18 -2
- package/dist/esm/hooks/useControlledValue.js +12 -0
- package/dist/esm/hooks/useDebounce.js +14 -1
- package/dist/esm/hooks/useEffectDebugger.js +54 -2
- package/dist/esm/hooks/useIsDark.js +8 -0
- package/dist/esm/hooks/useIsRtl.js +12 -0
- package/dist/esm/hooks/useNavigator.js +7 -5
- package/dist/esm/hooks/useOverlayService.js +24 -0
- package/dist/esm/hooks/usePropToggle.js +16 -5
- package/dist/esm/hooks/useResize.js +18 -0
- package/dist/esm/hooks/useResizeObserver.js +20 -1
- package/dist/esm/hooks/useStepper.js +74 -0
- package/dist/esm/hooks/useStorage.js +39 -0
- package/dist/esm/hotkeys/HotKeyLabel.js +1 -1
- package/dist/esm/hotkeys/HotKeyWrapper.js +3 -1
- package/dist/esm/index.js +7 -4
- package/dist/esm/overlays/alert/Alert.js +25 -18
- package/dist/esm/overlays/flyout/Flyout.js +53 -70
- package/dist/esm/overlays/message/Message.js +9 -4
- package/dist/esm/overlays/modal/Modal.js +22 -26
- package/dist/esm/overlays/toast/Toast.js +23 -14
- package/dist/esm/overlays/tooltip/Tooltip.js +25 -13
- package/dist/esm/typography/Abbr.js +35 -7
- package/dist/esm/typography/{Link.js → Anchor.js} +24 -6
- package/dist/esm/typography/Copy.js +1 -2
- package/dist/esm/typography/Mark.js +25 -5
- package/dist/esm/typography/Text.js +31 -6
- package/dist/esm/typography/Title.js +20 -5
- package/dist/esm/utils/cloneElement.js +47 -0
- package/dist/esm/utils/getColor.js +2 -16
- package/dist/types/components/actionLabel/ActionLabel.d.ts +21 -2
- package/dist/types/components/animations/Animations.d.ts +105 -7
- package/dist/types/components/avatar/Avatar.d.ts +34 -6
- package/dist/types/components/avatar/AvatarGroup.d.ts +19 -1
- package/dist/types/components/badge/Badge.d.ts +37 -3
- package/dist/types/components/breadcrumbs/Breadcrumbs.d.ts +31 -2
- package/dist/types/components/button/Button.d.ts +39 -7
- package/dist/types/components/button/ButtonGroup.d.ts +28 -3
- package/dist/types/components/button/ConfirmButton.d.ts +23 -3
- package/dist/types/components/button/ToggleButtonGroup.d.ts +39 -11
- package/dist/types/components/callout/Callout.d.ts +29 -3
- package/dist/types/components/card/Card.d.ts +44 -4
- package/dist/types/components/card/CardCover.d.ts +25 -0
- package/dist/types/components/card/FlipContent.d.ts +28 -0
- package/dist/types/components/chip/Chip.d.ts +34 -5
- package/dist/types/components/collapsable/Collapsable.d.ts +28 -2
- package/dist/types/components/divider/Divider.d.ts +30 -7
- package/dist/types/components/dropdown/Dropdown.d.ts +40 -1
- package/dist/types/components/dropdown/DropdownTool.d.ts +25 -0
- package/dist/types/components/empty/EmptyContent.d.ts +32 -3
- package/dist/types/components/icon/Icon.d.ts +40 -8
- package/dist/types/components/index.d.ts +3 -2
- package/dist/types/components/media/Media.d.ts +54 -0
- package/dist/types/components/menu/ContextMenu.d.ts +19 -1
- package/dist/types/components/menu/Menu.d.ts +29 -0
- package/dist/types/components/menu/MenuItem.d.ts +22 -2
- package/dist/types/components/menu/types.d.ts +9 -3
- package/dist/types/components/meter/Meter.d.ts +24 -0
- package/dist/types/components/navigator/Navigator.d.ts +29 -4
- package/dist/types/components/panel/Panel.d.ts +43 -4
- package/dist/types/components/panel/PanelGroup.d.ts +24 -0
- package/dist/types/components/panel/PanelStack.d.ts +31 -0
- package/dist/types/components/progress/ProgressBar.d.ts +23 -3
- package/dist/types/components/progress/ProgressCircle.d.ts +22 -3
- package/dist/types/components/tabpanel/Tab.d.ts +38 -4
- package/dist/types/components/tabpanel/TabPanel.d.ts +51 -2
- package/dist/types/context/Global.d.ts +24 -1
- package/dist/types/core/aside/Aside.d.ts +45 -6
- package/dist/types/core/boundary/ErrorBoundary.d.ts +18 -2
- package/dist/types/core/content/Content.d.ts +6 -1
- package/dist/types/core/headfoot/HeadFoot.d.ts +41 -9
- package/dist/types/core/page/Page.d.ts +32 -4
- package/dist/types/core/responsive/Responsive.d.ts +58 -3
- package/dist/types/core/section/Section.d.ts +18 -3
- package/dist/types/core/theme/ThemeProvider.d.ts +25 -5
- package/dist/types/core/viewport/Viewport.d.ts +15 -1
- package/dist/types/hooks/useControlledValue.d.ts +13 -2
- package/dist/types/hooks/useDebounce.d.ts +12 -0
- package/dist/types/hooks/useEffectDebugger.d.ts +49 -0
- package/dist/types/hooks/useIsDark.d.ts +8 -0
- package/dist/types/hooks/useIsRtl.d.ts +12 -0
- package/dist/types/hooks/useNavigator.d.ts +18 -1
- package/dist/types/hooks/useOverlayService.d.ts +28 -9
- package/dist/types/hooks/usePropToggle.d.ts +16 -5
- package/dist/types/hooks/useResize.d.ts +19 -1
- package/dist/types/hooks/useResizeObserver.d.ts +20 -1
- package/dist/types/hooks/useStepper.d.ts +14 -0
- package/dist/types/hooks/useStorage.d.ts +38 -0
- package/dist/types/index.d.ts +4 -1
- package/dist/types/overlays/alert/Alert.d.ts +16 -5
- package/dist/types/overlays/flyout/Flyout.d.ts +9 -4
- package/dist/types/overlays/message/Message.d.ts +16 -5
- package/dist/types/overlays/modal/Modal.d.ts +13 -4
- package/dist/types/overlays/toast/Toast.d.ts +16 -5
- package/dist/types/overlays/tooltip/Tooltip.d.ts +2 -2
- package/dist/types/types/index.d.ts +28 -24
- package/dist/types/typography/Abbr.d.ts +34 -4
- package/dist/types/typography/Anchor.d.ts +42 -0
- package/dist/types/typography/Copy.d.ts +15 -0
- package/dist/types/typography/Mark.d.ts +22 -4
- package/dist/types/typography/Text.d.ts +27 -1
- package/dist/types/typography/Title.d.ts +16 -1
- package/dist/types/typography/index.d.ts +1 -1
- package/dist/types/utils/cloneElement.d.ts +1 -0
- package/dist/types/utils/getColor.d.ts +1 -4
- package/dist/types/utils/index.d.ts +1 -0
- package/package.json +17 -16
- package/src/components/actionLabel/ActionLabel.tsx +26 -8
- package/src/components/animations/Animations.tsx +139 -52
- package/src/components/avatar/Avatar.tsx +51 -15
- package/src/components/avatar/AvatarGroup.tsx +23 -5
- package/src/components/badge/Badge.tsx +50 -22
- package/src/components/breadcrumbs/Breadcrumbs.tsx +43 -10
- package/src/components/button/Button.tsx +75 -43
- package/src/components/button/ButtonGroup.tsx +33 -7
- package/src/components/button/ConfirmButton.tsx +31 -3
- package/src/components/button/ToggleButtonGroup.tsx +74 -47
- package/src/components/callout/Callout.tsx +58 -16
- package/src/components/card/Card.tsx +84 -25
- package/src/components/card/CardCover.tsx +36 -6
- package/src/components/card/FlipContent.tsx +90 -0
- package/src/components/chip/Chip.tsx +53 -25
- package/src/components/collapsable/Collapsable.tsx +35 -11
- package/src/components/divider/Divider.tsx +42 -16
- package/src/components/dropdown/Dropdown.tsx +47 -12
- package/src/components/dropdown/DropdownTool.tsx +28 -4
- package/src/components/empty/EmptyContent.tsx +49 -8
- package/src/components/icon/Icon.tsx +96 -18
- package/src/components/index.ts +5 -4
- package/src/components/media/Media.tsx +193 -105
- package/src/components/menu/ContextMenu.tsx +19 -0
- package/src/components/menu/Menu.tsx +88 -32
- package/src/components/menu/MenuItem.tsx +44 -19
- package/src/components/menu/types.ts +9 -8
- package/src/components/meter/Meter.tsx +27 -4
- package/src/components/navigator/Navigator.tsx +60 -12
- package/src/components/panel/Panel.tsx +66 -28
- package/src/components/panel/PanelGroup.tsx +25 -2
- package/src/components/panel/PanelStack.tsx +33 -2
- package/src/components/progress/ProgressBar.tsx +33 -14
- package/src/components/progress/ProgressCircle.tsx +29 -13
- package/src/components/tabpanel/Tab.tsx +47 -24
- package/src/components/tabpanel/TabPanel.tsx +79 -13
- package/src/context/Global.tsx +28 -1
- package/src/context/NotificationCenter.tsx +3 -3
- package/src/core/aside/Aside.tsx +59 -38
- package/src/core/boundary/ErrorBoundary.tsx +26 -8
- package/src/core/boundary/ErrorIcon.tsx +1 -2
- package/src/core/content/Content.tsx +7 -3
- package/src/core/headfoot/HeadFoot.tsx +44 -37
- package/src/core/page/Page.tsx +44 -22
- package/src/core/responsive/Responsive.tsx +66 -8
- package/src/core/section/Section.tsx +26 -4
- package/src/core/theme/ThemeProvider.tsx +35 -14
- package/src/core/viewport/Viewport.tsx +16 -3
- package/src/hooks/useControlledValue.tsx +12 -0
- package/src/hooks/useDebounce.ts +13 -1
- package/src/hooks/useEffectDebugger.ts +50 -2
- package/src/hooks/useIsDark.ts +8 -0
- package/src/hooks/useIsRtl.ts +12 -0
- package/src/hooks/useNavigator.tsx +28 -5
- package/src/hooks/useOverlayService.tsx +33 -8
- package/src/hooks/usePropToggle.ts +16 -5
- package/src/hooks/useResize.ts +19 -1
- package/src/hooks/useResizeObserver.ts +32 -9
- package/src/hooks/useStepper.tsx +68 -0
- package/src/hooks/useStorage.ts +38 -0
- package/src/hotkeys/HotKeyLabel.tsx +1 -1
- package/src/hotkeys/HotKeyWrapper.tsx +3 -1
- package/src/index.ts +5 -1
- package/src/overlays/alert/Alert.tsx +51 -36
- package/src/overlays/flyout/Flyout.tsx +74 -99
- package/src/overlays/message/Message.tsx +28 -9
- package/src/overlays/modal/Modal.tsx +39 -34
- package/src/overlays/toast/Toast.tsx +44 -33
- package/src/overlays/tooltip/Tooltip.tsx +44 -20
- package/src/types/global.d.ts +8 -0
- package/src/types/index.ts +293 -47
- package/src/typography/Abbr.tsx +45 -11
- package/src/typography/{Link.tsx → Anchor.tsx} +26 -14
- package/src/typography/Copy.tsx +16 -2
- package/src/typography/Mark.tsx +25 -10
- package/src/typography/Text.tsx +31 -13
- package/src/typography/Title.tsx +18 -7
- package/src/typography/index.ts +1 -1
- package/src/{overlays/tooltip/Tooltip.module.css → utils/cloneElement.ts} +21 -27
- package/src/utils/getColor.ts +1 -17
- package/src/utils/index.ts +1 -0
- package/css/flags.rect.css +0 -1607
- package/css/flags.wavy.css +0 -1606
- package/css/index.js +0 -250
- package/css/tailwind/colors.ts +0 -158
- package/dist/cjs/components/actionLabel/ActionLabel.module.css +0 -1
- package/dist/cjs/components/animations/Animations.module.css +0 -1
- package/dist/cjs/components/avatar/Avatar.module.css +0 -1
- package/dist/cjs/components/badge/Badge.module.css +0 -1
- package/dist/cjs/components/breadcrumbs/Breadcrumbs.module.css +0 -1
- package/dist/cjs/components/button/Button.module.css +0 -1
- package/dist/cjs/components/card/Card.module.css +0 -1
- package/dist/cjs/components/chip/Chip.module.css +0 -1
- package/dist/cjs/components/collapsable/Collapsable.module.css +0 -1
- package/dist/cjs/components/dropdown/Dropdown.module.css +0 -1
- package/dist/cjs/components/icon/Icon.module.css +0 -1
- package/dist/cjs/components/media/Media.module.css +0 -1
- package/dist/cjs/components/menu/Menu.module.css +0 -1
- package/dist/cjs/components/meter/Meter.module.css +0 -1
- package/dist/cjs/components/panel/Panel.module.css +0 -1
- package/dist/cjs/components/progress/Progress.module.css +0 -1
- package/dist/cjs/components/tabpanel/TabPanel.module.css +0 -1
- package/dist/cjs/core/aside/Aside.module.css +0 -1
- package/dist/cjs/core/boundary/ErrorBoundary.module.css +0 -1
- package/dist/cjs/core/content/Content.module.css +0 -1
- package/dist/cjs/core/headfoot/HeadFoot.module.css +0 -1
- package/dist/cjs/core/page/Page.module.css +0 -1
- package/dist/cjs/core/responsive/Responsive.module.css +0 -1
- package/dist/cjs/core/section/Section.module.css +0 -1
- package/dist/cjs/core/theme/Theme.module.css +0 -1
- package/dist/cjs/core/viewport/Viewport.module.css +0 -1
- package/dist/cjs/overlays/alert/Alert.module.css +0 -1
- package/dist/cjs/overlays/flyout/Flyout.module.css +0 -1
- package/dist/cjs/overlays/message/Message.module.css +0 -1
- package/dist/cjs/overlays/modal/Modal.module.css +0 -1
- package/dist/cjs/overlays/toast/Toast.module.css +0 -1
- package/dist/cjs/overlays/tooltip/Tooltip.module.css +0 -1
- package/dist/cjs/types/icons.js +0 -199
- package/dist/cjs/typography/Typography.module.css +0 -1
- package/dist/esm/components/actionLabel/ActionLabel.module.css +0 -1
- package/dist/esm/components/animations/Animations.module.css +0 -1
- package/dist/esm/components/avatar/Avatar.module.css +0 -1
- package/dist/esm/components/badge/Badge.module.css +0 -1
- package/dist/esm/components/breadcrumbs/Breadcrumbs.module.css +0 -1
- package/dist/esm/components/button/Button.module.css +0 -1
- package/dist/esm/components/card/Card.module.css +0 -1
- package/dist/esm/components/chip/Chip.module.css +0 -1
- package/dist/esm/components/collapsable/Collapsable.module.css +0 -1
- package/dist/esm/components/dropdown/Dropdown.module.css +0 -1
- package/dist/esm/components/icon/Icon.module.css +0 -1
- package/dist/esm/components/media/Media.module.css +0 -1
- package/dist/esm/components/menu/Menu.module.css +0 -1
- package/dist/esm/components/meter/Meter.module.css +0 -1
- package/dist/esm/components/panel/Panel.module.css +0 -1
- package/dist/esm/components/progress/Progress.module.css +0 -1
- package/dist/esm/components/tabpanel/TabPanel.module.css +0 -1
- package/dist/esm/core/aside/Aside.module.css +0 -1
- package/dist/esm/core/boundary/ErrorBoundary.module.css +0 -1
- package/dist/esm/core/content/Content.module.css +0 -1
- package/dist/esm/core/headfoot/HeadFoot.module.css +0 -1
- package/dist/esm/core/page/Page.module.css +0 -1
- package/dist/esm/core/responsive/Responsive.module.css +0 -1
- package/dist/esm/core/section/Section.module.css +0 -1
- package/dist/esm/core/theme/Theme.module.css +0 -1
- package/dist/esm/core/viewport/Viewport.module.css +0 -1
- package/dist/esm/overlays/alert/Alert.module.css +0 -1
- package/dist/esm/overlays/flyout/Flyout.module.css +0 -1
- package/dist/esm/overlays/message/Message.module.css +0 -1
- package/dist/esm/overlays/modal/Modal.module.css +0 -1
- package/dist/esm/overlays/toast/Toast.module.css +0 -1
- package/dist/esm/overlays/tooltip/Tooltip.module.css +0 -1
- package/dist/esm/types/icons.js +0 -201
- package/dist/esm/typography/Typography.module.css +0 -1
- package/dist/types/types/icons.d.ts +0 -196
- package/dist/types/typography/Link.d.ts +0 -25
- package/src/types/icons.ts +0 -425
|
@@ -5,16 +5,51 @@ import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
|
5
5
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
6
6
|
import { getImageColorset } from '@react-fabric/utilities';
|
|
7
7
|
import classNames from 'classnames';
|
|
8
|
-
import { useState,
|
|
9
|
-
import { CoreIcons } from '../../types/icons.js';
|
|
8
|
+
import { useState, useEffect, useRef, Fragment } from 'react';
|
|
10
9
|
import { Button } from '../button/Button.js';
|
|
11
|
-
import
|
|
10
|
+
import { Icon } from '../icon/Icon.js';
|
|
12
11
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
13
12
|
|
|
14
13
|
var _excluded = ["src", "alt", "reel", "fit", "className"],
|
|
15
14
|
_excluded2 = ["src", "poster", "reel", "autoPlay", "playOnHover", "fit", "className"];
|
|
16
15
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
17
16
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
17
|
+
var cover = {
|
|
18
|
+
fill: "object-fill",
|
|
19
|
+
cover: "object-cover",
|
|
20
|
+
contain: "object-contain"
|
|
21
|
+
};
|
|
22
|
+
var loadIndicator = /*#__PURE__*/jsx("div", {
|
|
23
|
+
className: classNames("fabric-mediaPlaceholder", "absolute z-1 top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 text-sm text-gray"),
|
|
24
|
+
children: /*#__PURE__*/jsx("i", {
|
|
25
|
+
className: "icon-[svg-spinners--pulse-rings-2]"
|
|
26
|
+
})
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Component for displaying images with optional reel decoration.
|
|
31
|
+
* A versatile media component that supports images and videos with various display options.
|
|
32
|
+
* It can display images with a reel decoration, handle loading states, and show error icons if the media fails to load.
|
|
33
|
+
* This component is useful for displaying images in a visually appealing way, with support for lazy loading and error handling.
|
|
34
|
+
* It automatically adjusts the display based on the provided fit property, allowing for different styles such as cover, contain, or fill.
|
|
35
|
+
*
|
|
36
|
+
* @param {ImageProps | VideoProps} props - The properties for the Media component.
|
|
37
|
+
* @returns {JSX.Element} The rendered Media component.
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```jsx
|
|
41
|
+
* <Image
|
|
42
|
+
* src="image.jpg"
|
|
43
|
+
* alt="Example Image"
|
|
44
|
+
* reel={true}
|
|
45
|
+
* fit="cover"
|
|
46
|
+
* className="custom-class"
|
|
47
|
+
* />
|
|
48
|
+
* // Renders an image with reel decoration, cover fit, and a custom class name.
|
|
49
|
+
* ```
|
|
50
|
+
*
|
|
51
|
+
* @see {@link https://adarshpastakia.github.io/react-fabric/?path=/docs/core-components-media--docs} for more details.
|
|
52
|
+
*/
|
|
18
53
|
var Image = function Image(_ref) {
|
|
19
54
|
var src = _ref.src,
|
|
20
55
|
alt = _ref.alt,
|
|
@@ -27,31 +62,74 @@ var Image = function Image(_ref) {
|
|
|
27
62
|
_useState2 = _slicedToArray(_useState, 2),
|
|
28
63
|
colorSet = _useState2[0],
|
|
29
64
|
setColorSet = _useState2[1];
|
|
30
|
-
var
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
65
|
+
var _useState3 = useState(false),
|
|
66
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
67
|
+
loaded = _useState4[0],
|
|
68
|
+
setLoaded = _useState4[1];
|
|
69
|
+
var _useState5 = useState(false),
|
|
70
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
71
|
+
errored = _useState6[0],
|
|
72
|
+
setErrored = _useState6[1];
|
|
73
|
+
useEffect(function () {
|
|
74
|
+
setLoaded(false);
|
|
75
|
+
setErrored(false);
|
|
35
76
|
}, [src]);
|
|
36
77
|
return /*#__PURE__*/jsxs("div", _objectSpread(_objectSpread({
|
|
37
78
|
"data-ref": "image",
|
|
38
|
-
className: classNames(
|
|
79
|
+
className: classNames("fabric-mediaContainer", "relative overflow-hidden inline-block", reel && "fabric-mediaReel", className),
|
|
39
80
|
"data-colorset": colorSet
|
|
40
81
|
}, aria), {}, {
|
|
41
|
-
children: [loadIndicator, /*#__PURE__*/jsx("img", {
|
|
82
|
+
children: [!loaded && !errored && loadIndicator, !errored && /*#__PURE__*/jsx("img", {
|
|
42
83
|
alt: alt !== null && alt !== void 0 ? alt : src,
|
|
43
84
|
src: src,
|
|
44
85
|
loading: "lazy",
|
|
45
86
|
crossOrigin: "anonymous",
|
|
46
|
-
className: classNames(
|
|
87
|
+
className: classNames("fabric-media", "pointer-events-none w-full h-full", cover[fit]),
|
|
47
88
|
onLoad: function onLoad(e) {
|
|
48
|
-
|
|
49
|
-
(_e$currentTarget$prev = e.currentTarget.previousElementSibling) === null || _e$currentTarget$prev === void 0 || _e$currentTarget$prev.remove();
|
|
89
|
+
setLoaded(true);
|
|
50
90
|
setColorSet(getImageColorset(e.currentTarget));
|
|
91
|
+
},
|
|
92
|
+
onError: function onError() {
|
|
93
|
+
return setErrored(true);
|
|
51
94
|
}
|
|
95
|
+
}), errored && /*#__PURE__*/jsx(Icon, {
|
|
96
|
+
size: "2rem",
|
|
97
|
+
className: "absolute text-tint-300 top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2",
|
|
98
|
+
icon: "icon-[mdi--image-off-outline]"
|
|
52
99
|
})]
|
|
53
100
|
}));
|
|
54
101
|
};
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Component for displaying videos with optional controls and reel decoration.
|
|
105
|
+
* A versatile video component that supports autoplay, hover play, and various display options.
|
|
106
|
+
* It can display videos with a reel decoration, handle loading states, and show error icons if the video fails to load.
|
|
107
|
+
* This component is useful for displaying videos in a visually appealing way, with support for controls, autoplay, and error handling.
|
|
108
|
+
* It automatically adjusts the display based on the provided fit property, allowing for different styles such as cover, contain, or fill.
|
|
109
|
+
* It also includes controls for play/pause and volume, enhancing user interaction with the video content.
|
|
110
|
+
* This component is ideal for media-rich applications where video content needs to be displayed with user-friendly controls and visual effects.
|
|
111
|
+
* It supports features like autoplay, play on hover, and custom fit options for the video display.
|
|
112
|
+
* It also includes a reel decoration for a more engaging visual presentation.
|
|
113
|
+
*
|
|
114
|
+
* @param {VideoProps} props - The properties for the Video component.
|
|
115
|
+
* @returns {JSX.Element} The rendered Video component.
|
|
116
|
+
*
|
|
117
|
+
* @example
|
|
118
|
+
* ```jsx
|
|
119
|
+
* <Video
|
|
120
|
+
* src="video.mp4"
|
|
121
|
+
* poster="poster.jpg"
|
|
122
|
+
* reel={true}
|
|
123
|
+
* autoPlay={true}
|
|
124
|
+
* playOnHover={true}
|
|
125
|
+
* fit="cover"
|
|
126
|
+
* className="custom-class"
|
|
127
|
+
* />
|
|
128
|
+
* // Renders a video with reel decoration, autoplay, play on hover, cover fit, and a custom class name.
|
|
129
|
+
* ```
|
|
130
|
+
*
|
|
131
|
+
* @see {@link https://adarshpastakia.github.io/react-fabric/?path=/docs/core-components-video--docs} for more details.
|
|
132
|
+
*/
|
|
55
133
|
var Video = function Video(_ref2) {
|
|
56
134
|
var src = _ref2.src,
|
|
57
135
|
poster = _ref2.poster,
|
|
@@ -63,17 +141,32 @@ var Video = function Video(_ref2) {
|
|
|
63
141
|
className = _ref2.className,
|
|
64
142
|
aria = _objectWithoutProperties(_ref2, _excluded2);
|
|
65
143
|
var videoRef = useRef(null);
|
|
66
|
-
var
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
var
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
144
|
+
var _useState7 = useState(false),
|
|
145
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
146
|
+
loaded = _useState8[0],
|
|
147
|
+
setLoaded = _useState8[1];
|
|
148
|
+
var _useState9 = useState(false),
|
|
149
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
150
|
+
errored = _useState10[0],
|
|
151
|
+
setErrored = _useState10[1];
|
|
152
|
+
useEffect(function () {
|
|
153
|
+
setLoaded(false);
|
|
154
|
+
setErrored(false);
|
|
155
|
+
}, [src]);
|
|
156
|
+
var _useState11 = useState(true),
|
|
157
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
158
|
+
state = _useState12[0],
|
|
159
|
+
setState = _useState12[1];
|
|
160
|
+
var _useState13 = useState(false),
|
|
161
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
|
162
|
+
volume = _useState14[0],
|
|
163
|
+
setVolume = _useState14[1];
|
|
164
|
+
useEffect(function () {
|
|
165
|
+
setErrored(false);
|
|
166
|
+
}, [src]);
|
|
74
167
|
return /*#__PURE__*/jsxs("div", _objectSpread(_objectSpread({
|
|
75
168
|
"data-ref": "video",
|
|
76
|
-
className: classNames(
|
|
169
|
+
className: classNames("fabric-mediaContainer", "relative overflow-hidden inline-block", reel && "fabric-mediaReel", className),
|
|
77
170
|
onMouseEnter: function onMouseEnter() {
|
|
78
171
|
var _videoRef$current;
|
|
79
172
|
playOnHover && ((_videoRef$current = videoRef.current) === null || _videoRef$current === void 0 ? void 0 : _videoRef$current.play());
|
|
@@ -83,64 +176,69 @@ var Video = function Video(_ref2) {
|
|
|
83
176
|
playOnHover && ((_videoRef$current2 = videoRef.current) === null || _videoRef$current2 === void 0 ? void 0 : _videoRef$current2.pause());
|
|
84
177
|
}
|
|
85
178
|
}, aria), {}, {
|
|
86
|
-
children: [/*#__PURE__*/
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
var _e$currentTarget$prev2;
|
|
107
|
-
e.currentTarget.volume = 0;
|
|
108
|
-
(_e$currentTarget$prev2 = e.currentTarget.previousElementSibling) === null || _e$currentTarget$prev2 === void 0 || _e$currentTarget$prev2.remove();
|
|
109
|
-
},
|
|
110
|
-
children: [/*#__PURE__*/jsx("source", {
|
|
111
|
-
src: src
|
|
112
|
-
}), /*#__PURE__*/jsx("track", {
|
|
113
|
-
kind: "captions"
|
|
114
|
-
})]
|
|
115
|
-
}), /*#__PURE__*/jsxs("div", {
|
|
116
|
-
"data-inner-clickable": true,
|
|
117
|
-
className: classNames(classes.mediaControls, "absolute bottom-6 end-6 rounded-full flex flex-col"),
|
|
118
|
-
children: [/*#__PURE__*/jsx(Button, {
|
|
119
|
-
rounded: true,
|
|
120
|
-
variant: "link",
|
|
121
|
-
className: classes.mediaControlPlaceholder,
|
|
122
|
-
icon: CoreIcons.ellipsis,
|
|
123
|
-
"aria-label": "controls"
|
|
124
|
-
}), /*#__PURE__*/jsx(Button, {
|
|
125
|
-
rounded: true,
|
|
126
|
-
variant: "link",
|
|
127
|
-
"aria-label": "controls",
|
|
128
|
-
className: classes.mediaControlAction,
|
|
129
|
-
onClick: function onClick() {
|
|
130
|
-
videoRef.current && (videoRef.current.volume = videoRef.current.volume ? 0 : 1);
|
|
179
|
+
children: [!loaded && !errored && loadIndicator, !errored && /*#__PURE__*/jsxs(Fragment, {
|
|
180
|
+
children: [/*#__PURE__*/jsxs("video", {
|
|
181
|
+
loop: true,
|
|
182
|
+
ref: videoRef,
|
|
183
|
+
controls: false,
|
|
184
|
+
poster: poster,
|
|
185
|
+
autoPlay: autoPlay,
|
|
186
|
+
className: classNames("fabric-media", "pointer-events-none w-full h-full", fit && "object-".concat(fit)),
|
|
187
|
+
onPlay: function onPlay() {
|
|
188
|
+
return setState(true);
|
|
189
|
+
},
|
|
190
|
+
onPause: function onPause() {
|
|
191
|
+
return setState(false);
|
|
192
|
+
},
|
|
193
|
+
onVolumeChange: function onVolumeChange(e) {
|
|
194
|
+
return setVolume(!!e.currentTarget.volume);
|
|
195
|
+
},
|
|
196
|
+
onLoadedData: function onLoadedData(e) {
|
|
197
|
+
e.currentTarget.volume = 0;
|
|
198
|
+
setLoaded(true);
|
|
131
199
|
},
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
rounded: true,
|
|
135
|
-
variant: "link",
|
|
136
|
-
"aria-label": "controls",
|
|
137
|
-
className: classes.mediaControlAction,
|
|
138
|
-
onClick: function onClick() {
|
|
139
|
-
var _videoRef$current3, _videoRef$current4, _videoRef$current5;
|
|
140
|
-
(_videoRef$current3 = videoRef.current) !== null && _videoRef$current3 !== void 0 && _videoRef$current3.paused ? (_videoRef$current4 = videoRef.current) === null || _videoRef$current4 === void 0 ? void 0 : _videoRef$current4.play() : (_videoRef$current5 = videoRef.current) === null || _videoRef$current5 === void 0 ? void 0 : _videoRef$current5.pause();
|
|
200
|
+
onError: function onError() {
|
|
201
|
+
return setErrored(true);
|
|
141
202
|
},
|
|
142
|
-
|
|
203
|
+
children: [/*#__PURE__*/jsx("source", {
|
|
204
|
+
src: src
|
|
205
|
+
}), /*#__PURE__*/jsx("track", {
|
|
206
|
+
kind: "captions"
|
|
207
|
+
})]
|
|
208
|
+
}), /*#__PURE__*/jsxs("div", {
|
|
209
|
+
"data-inner-clickable": true,
|
|
210
|
+
className: classNames("fabric-mediaControls", "absolute bottom-6 end-6 rounded-full flex flex-col"),
|
|
211
|
+
children: [/*#__PURE__*/jsx(Button, {
|
|
212
|
+
rounded: true,
|
|
213
|
+
variant: "link",
|
|
214
|
+
className: "fabric-mediaControlPlaceholder",
|
|
215
|
+
icon: "icon-[mdi--dots-vertical]",
|
|
216
|
+
"aria-label": "controls"
|
|
217
|
+
}), /*#__PURE__*/jsx(Button, {
|
|
218
|
+
rounded: true,
|
|
219
|
+
variant: "link",
|
|
220
|
+
"aria-label": "controls",
|
|
221
|
+
className: "fabric-mediaControlAction",
|
|
222
|
+
onClick: function onClick() {
|
|
223
|
+
videoRef.current && (videoRef.current.volume = videoRef.current.volume ? 0 : 1);
|
|
224
|
+
},
|
|
225
|
+
icon: volume ? "icon-[mdi--volume]" : "icon-[mdi--volume-mute]"
|
|
226
|
+
}), /*#__PURE__*/jsx(Button, {
|
|
227
|
+
rounded: true,
|
|
228
|
+
variant: "link",
|
|
229
|
+
"aria-label": "controls",
|
|
230
|
+
className: "fabric-mediaControlAction",
|
|
231
|
+
onClick: function onClick() {
|
|
232
|
+
var _videoRef$current3, _videoRef$current4, _videoRef$current5;
|
|
233
|
+
(_videoRef$current3 = videoRef.current) !== null && _videoRef$current3 !== void 0 && _videoRef$current3.paused ? (_videoRef$current4 = videoRef.current) === null || _videoRef$current4 === void 0 ? void 0 : _videoRef$current4.play() : (_videoRef$current5 = videoRef.current) === null || _videoRef$current5 === void 0 ? void 0 : _videoRef$current5.pause();
|
|
234
|
+
},
|
|
235
|
+
icon: state ? "icon-[mdi--pause]" : "icon-[mdi--play]"
|
|
236
|
+
})]
|
|
143
237
|
})]
|
|
238
|
+
}), errored && /*#__PURE__*/jsx(Icon, {
|
|
239
|
+
size: "2rem",
|
|
240
|
+
className: "absolute text-tint-300 top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2",
|
|
241
|
+
icon: "icon-[mdi--video-off-outline]"
|
|
144
242
|
})]
|
|
145
243
|
}));
|
|
146
244
|
};
|
|
@@ -8,6 +8,25 @@ import { jsxs, jsx } from 'react/jsx-runtime';
|
|
|
8
8
|
|
|
9
9
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
10
10
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
11
|
+
/**
|
|
12
|
+
* A component that provides a context menu that appears on right-click.
|
|
13
|
+
* It uses the Floating UI library to manage the positioning and interactions of the menu.
|
|
14
|
+
* This component is useful for creating custom context menus that can be triggered by right-clicking on elements.
|
|
15
|
+
*
|
|
16
|
+
* @param {ContextMenuProps} props - The properties for the ContextMenu component.
|
|
17
|
+
* @returns {JSX.Element} The rendered ContextMenu component.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```jsx
|
|
21
|
+
* <ContextMenu
|
|
22
|
+
* menu={<Menu items={[{ label: "Option 1" }, { label: "Option 2" }]} />}
|
|
23
|
+
* >
|
|
24
|
+
* <div className="context-menu-target">Right-click me!</div>
|
|
25
|
+
* </ContextMenu>
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* @see {@link https://adarshpastakia.github.io/react-fabric/?path=/docs/core-components-menu--docs}
|
|
29
|
+
*/
|
|
11
30
|
var ContextMenu = function ContextMenu(_ref) {
|
|
12
31
|
var _refs$domReference$cu, _refs$domReference$cu2;
|
|
13
32
|
var children = _ref.children,
|
|
@@ -3,16 +3,17 @@
|
|
|
3
3
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
4
4
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
5
5
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
6
|
-
import { useFloatingParentNodeId,
|
|
6
|
+
import { useFloatingParentNodeId, useFloatingTree, FloatingTree, useFloatingNodeId, useFloating, offset, flip, shift, autoUpdate, useHover, safePolygon, useClick, useRole, useDismiss, useListNavigation, useTypeahead, useInteractions, FloatingNode, FloatingList, FloatingOverlay, FloatingFocusManager, FloatingPortal } from '@floating-ui/react';
|
|
7
7
|
import { mergeRefs } from '@react-fabric/utilities';
|
|
8
8
|
import classNames from 'classnames';
|
|
9
|
-
import { useState, useRef, useEffect, useCallback,
|
|
10
|
-
import {
|
|
9
|
+
import { useState, useRef, useEffect, useCallback, cloneElement, Fragment } from 'react';
|
|
10
|
+
import { HotKeyWrapper } from '../../hotkeys/HotKeyWrapper.js';
|
|
11
|
+
import { cloneChildren } from '../../utils/cloneElement.js';
|
|
11
12
|
import { nodeCheck } from '../../utils/nodeCheck.js';
|
|
12
13
|
import { MenuItem } from './MenuItem.js';
|
|
13
14
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
14
15
|
|
|
15
|
-
var _excluded = ["children", "minimal", "menuClassName", "onClick", "ref"];
|
|
16
|
+
var _excluded = ["children", "minimal", "menuClassName", "onClick", "trigger", "ref"];
|
|
16
17
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
17
18
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
18
19
|
// FIXME: refactor menu implementation to differentiate between static and floating menus, implement context wrapper for each menu level
|
|
@@ -23,6 +24,8 @@ var MenuComponent = function MenuComponent(_ref) {
|
|
|
23
24
|
minimal = _ref.minimal,
|
|
24
25
|
menuClassName = _ref.menuClassName,
|
|
25
26
|
onClick = _ref.onClick,
|
|
27
|
+
_ref$trigger = _ref.trigger,
|
|
28
|
+
trigger = _ref$trigger === void 0 ? "hover" : _ref$trigger,
|
|
26
29
|
ref = _ref.ref,
|
|
27
30
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
28
31
|
var _useState = useState(false),
|
|
@@ -44,6 +47,7 @@ var MenuComponent = function MenuComponent(_ref) {
|
|
|
44
47
|
open: !isNested || isOpen,
|
|
45
48
|
onOpenChange: function onOpenChange(open, event, reason) {
|
|
46
49
|
isNested && setIsOpen(open);
|
|
50
|
+
if (reason === "outside-press" && trigger === "click") tree === null || tree === void 0 || tree.events.emit("close");
|
|
47
51
|
},
|
|
48
52
|
placement: isNested ? "right-start" : "bottom-start",
|
|
49
53
|
middleware: [offset({
|
|
@@ -56,6 +60,7 @@ var MenuComponent = function MenuComponent(_ref) {
|
|
|
56
60
|
refs = _useFloating.refs,
|
|
57
61
|
context = _useFloating.context;
|
|
58
62
|
var hover = useHover(context, {
|
|
63
|
+
enabled: trigger === "hover",
|
|
59
64
|
delay: {
|
|
60
65
|
open: 75
|
|
61
66
|
},
|
|
@@ -64,8 +69,9 @@ var MenuComponent = function MenuComponent(_ref) {
|
|
|
64
69
|
})
|
|
65
70
|
});
|
|
66
71
|
var click = useClick(context, {
|
|
67
|
-
|
|
68
|
-
|
|
72
|
+
event: "mousedown",
|
|
73
|
+
toggle: trigger === "click" || !isNested,
|
|
74
|
+
ignoreMouse: trigger === "hover" && !isNested
|
|
69
75
|
});
|
|
70
76
|
var role = useRole(context, {
|
|
71
77
|
role: "menu"
|
|
@@ -137,6 +143,16 @@ var MenuComponent = function MenuComponent(_ref) {
|
|
|
137
143
|
});
|
|
138
144
|
}, 100);
|
|
139
145
|
}, [isOpen]);
|
|
146
|
+
useEffect(function () {
|
|
147
|
+
if ((!isNested || isOpen) && activeIndex) {
|
|
148
|
+
setTimeout(function () {
|
|
149
|
+
var _elementsRef$current$;
|
|
150
|
+
(_elementsRef$current$ = elementsRef.current[activeIndex]) === null || _elementsRef$current$ === void 0 || _elementsRef$current$.scrollIntoView({
|
|
151
|
+
block: "nearest"
|
|
152
|
+
});
|
|
153
|
+
}, 100);
|
|
154
|
+
}
|
|
155
|
+
}, [isOpen, activeIndex]);
|
|
140
156
|
return /*#__PURE__*/jsxs(FloatingNode, {
|
|
141
157
|
id: nodeId,
|
|
142
158
|
children: [isNested && /*#__PURE__*/jsx(MenuItem, _objectSpread(_objectSpread({}, getReferenceProps(_objectSpread(_objectSpread({}, rest), {}, {
|
|
@@ -149,27 +165,27 @@ var MenuComponent = function MenuComponent(_ref) {
|
|
|
149
165
|
}))), {}, {
|
|
150
166
|
"data-open": isOpen,
|
|
151
167
|
minimal: minimal,
|
|
152
|
-
altIcon:
|
|
168
|
+
altIcon: "icon-[mdi--menu-right]",
|
|
153
169
|
ref: mergeRefs(refs.setReference, ref)
|
|
154
170
|
})), /*#__PURE__*/jsx(FloatingList, {
|
|
155
171
|
elementsRef: elementsRef,
|
|
156
172
|
labelsRef: labelsRef,
|
|
157
173
|
children: (!isNested || isOpen) && /*#__PURE__*/jsxs(Wrapper, _objectSpread(_objectSpread({}, wrapperProps), {}, {
|
|
158
|
-
children: [isNested && /*#__PURE__*/jsx(FloatingOverlay, {}), /*#__PURE__*/jsx(
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
174
|
+
children: [isNested && /*#__PURE__*/jsx(FloatingOverlay, {}), /*#__PURE__*/jsx(HotKeyWrapper, {
|
|
175
|
+
children: /*#__PURE__*/jsx(FloatingFocusManager, {
|
|
176
|
+
context: context,
|
|
177
|
+
modal: !isNested,
|
|
178
|
+
initialFocus: isNested ? -1 : 0,
|
|
179
|
+
returnFocus: !isNested,
|
|
180
|
+
children: /*#__PURE__*/jsx("div", _objectSpread(_objectSpread({
|
|
181
|
+
className: classNames(menuClassName, "flex flex-col bg-base p-1 menu-list", isNested && "outline shadow-lg rounded-capped max-h-96 overflow-auto scroll-thin z-(--z-popover)"),
|
|
182
|
+
autoFocus: true,
|
|
183
|
+
ref: mergeRefs(isNested ? refs.setFloating : ref)
|
|
184
|
+
}, getFloatingProps({
|
|
185
|
+
onClick: isNested ? undefined : handleClick
|
|
186
|
+
})), {}, {
|
|
187
|
+
style: !isNested ? rest.style : floatingStyles,
|
|
188
|
+
children: cloneChildren(children, function (child, index) {
|
|
173
189
|
labelsRef.current[index] = child.props.label;
|
|
174
190
|
return /*#__PURE__*/cloneElement(child, nodeCheck(child, MenuItem, Menu, MenuComponent) ? _objectSpread({
|
|
175
191
|
minimal: !isNested && minimal,
|
|
@@ -181,19 +197,57 @@ var MenuComponent = function MenuComponent(_ref) {
|
|
|
181
197
|
onClick: child.props.onClick,
|
|
182
198
|
tabIndex: activeIndex === index ? 0 : -1
|
|
183
199
|
})) : {});
|
|
184
|
-
}
|
|
185
|
-
})
|
|
186
|
-
})
|
|
200
|
+
})
|
|
201
|
+
}))
|
|
202
|
+
})
|
|
187
203
|
})]
|
|
188
204
|
}))
|
|
189
205
|
})]
|
|
190
206
|
});
|
|
191
207
|
};
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* A component that displays a menu with items, supports nested menus and various interactions.
|
|
211
|
+
* It can be triggered by hover or click events, and allows for custom styling and behavior.
|
|
212
|
+
* This component is designed to be used within a Floating UI context, allowing for dynamic positioning and interaction handling.
|
|
213
|
+
* It can be nested within other menus to create complex menu structures.
|
|
214
|
+
*
|
|
215
|
+
* @param {MenuProps} props - The properties for the Menu component.
|
|
216
|
+
* @returns {JSX.Element} The rendered Menu component.
|
|
217
|
+
*
|
|
218
|
+
* @example
|
|
219
|
+
* ```jsx
|
|
220
|
+
* <Menu
|
|
221
|
+
* className="my-menu"
|
|
222
|
+
* trigger="click"
|
|
223
|
+
* onClick={(id) => console.log(`Clicked item with id: ${id}`)}
|
|
224
|
+
* >
|
|
225
|
+
* <MenuItem id="item1" label="Item 1" />
|
|
226
|
+
* <MenuItem id="item2" label="Item 2" />
|
|
227
|
+
* <MenuItem id="item3" label="Item 3">
|
|
228
|
+
* <Menu>
|
|
229
|
+
* <MenuItem id="subitem1" label="Sub Item 1" />
|
|
230
|
+
* <MenuItem id="subitem2" label="Sub Item 2" />
|
|
231
|
+
* </Menu>
|
|
232
|
+
* </MenuItem>
|
|
233
|
+
* </Menu>
|
|
234
|
+
* ```
|
|
235
|
+
*
|
|
236
|
+
* @see {@link https://adarshpastakia.github.io/react-fabric/?path=/docs/core-components-menu--docs} for more details.
|
|
237
|
+
*/
|
|
192
238
|
var Menu = function Menu(props) {
|
|
193
239
|
var parentId = useFloatingParentNodeId();
|
|
240
|
+
var tree = useFloatingTree();
|
|
241
|
+
if (tree) {
|
|
242
|
+
return /*#__PURE__*/jsx(MenuComponent, _objectSpread(_objectSpread({}, props), {}, {
|
|
243
|
+
className: "",
|
|
244
|
+
menuClassName: props.className
|
|
245
|
+
}));
|
|
246
|
+
}
|
|
194
247
|
if (parentId === null) {
|
|
195
248
|
return /*#__PURE__*/jsx(FloatingTree, {
|
|
196
249
|
children: /*#__PURE__*/jsx(MenuComponent, _objectSpread(_objectSpread({}, props), {}, {
|
|
250
|
+
className: "",
|
|
197
251
|
menuClassName: props.className
|
|
198
252
|
}))
|
|
199
253
|
});
|
|
@@ -3,25 +3,45 @@
|
|
|
3
3
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
4
4
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
5
5
|
import { useFloatingTree } from '@floating-ui/react';
|
|
6
|
-
import { iconToken } from '@react-fabric/utilities';
|
|
6
|
+
import { iconToken, mergeRefs } from '@react-fabric/utilities';
|
|
7
7
|
import classNames from 'classnames';
|
|
8
|
-
import { useMemo, useCallback, Fragment } from 'react';
|
|
8
|
+
import { useRef, useMemo, useEffect, useCallback, Fragment } from 'react';
|
|
9
|
+
import { HotKey } from '../../hotkeys/HotKey.js';
|
|
9
10
|
import { HotKeyLabel } from '../../hotkeys/HotKeyLabel.js';
|
|
10
11
|
import '@babel/runtime/helpers/slicedToArray';
|
|
11
12
|
import 'react-i18next';
|
|
12
13
|
import '../../hooks/useEffectDebugger.js';
|
|
13
14
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
14
|
-
import '../../hotkeys/HotKeyWrapper.js';
|
|
15
15
|
import { Tooltip } from '../../overlays/tooltip/Tooltip.js';
|
|
16
16
|
import { getBadgeProps, Badge } from '../badge/Badge.js';
|
|
17
|
-
import { Icon } from '../icon/Icon.js';
|
|
18
|
-
import '../../
|
|
19
|
-
import classes from './Menu.module.css';
|
|
17
|
+
import { Icon, getIconProps } from '../icon/Icon.js';
|
|
18
|
+
import '../../hotkeys/HotKeyWrapper.js';
|
|
20
19
|
|
|
21
|
-
var _excluded = ["as", "label", "color", "className", "icon", "
|
|
20
|
+
var _excluded = ["as", "label", "color", "className", "icon", "appendLabel", "altIcon", "id", "active", "disabled", "onClick", "badge", "hotKey", "tabIndex", "minimal", "data-open", "ref"],
|
|
22
21
|
_excluded2 = ["children"];
|
|
23
22
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
24
23
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
24
|
+
/**
|
|
25
|
+
* A menu item component that can be used in a dropdown or menu.
|
|
26
|
+
* It supports various features such as icons, badges, hotkeys, and more.
|
|
27
|
+
* It can be customized with different colors, icons, and behaviors.
|
|
28
|
+
*
|
|
29
|
+
* @param {MenuItemProps} props
|
|
30
|
+
* @returns A JSX element representing the menu item.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```jsx
|
|
34
|
+
* <MenuItem
|
|
35
|
+
* label="Settings"
|
|
36
|
+
* icon="settings"
|
|
37
|
+
* onClick={() => console.log("Settings clicked")}
|
|
38
|
+
* hotKey="Ctrl+S"
|
|
39
|
+
* badge={{ count: 3, color: "red" }}
|
|
40
|
+
* />
|
|
41
|
+
* ```
|
|
42
|
+
*
|
|
43
|
+
* @see {@link https://adarshpastakia.github.io/react-fabric/?path=/docs/core-components-menu--docs} for documentation.
|
|
44
|
+
*/
|
|
25
45
|
var MenuItem = function MenuItem(_ref) {
|
|
26
46
|
var as = _ref.as,
|
|
27
47
|
label = _ref.label,
|
|
@@ -29,10 +49,7 @@ var MenuItem = function MenuItem(_ref) {
|
|
|
29
49
|
color = _ref$color === void 0 ? "primary" : _ref$color,
|
|
30
50
|
className = _ref.className,
|
|
31
51
|
icon = _ref.icon,
|
|
32
|
-
iconBg = _ref.iconBg,
|
|
33
|
-
iconColor = _ref.iconColor,
|
|
34
52
|
appendLabel = _ref.appendLabel,
|
|
35
|
-
rtlFlip = _ref.rtlFlip,
|
|
36
53
|
altIcon = _ref.altIcon,
|
|
37
54
|
id = _ref.id,
|
|
38
55
|
active = _ref.active,
|
|
@@ -40,28 +57,31 @@ var MenuItem = function MenuItem(_ref) {
|
|
|
40
57
|
_onClick = _ref.onClick,
|
|
41
58
|
badge = _ref.badge,
|
|
42
59
|
hotKey = _ref.hotKey,
|
|
60
|
+
_ref$tabIndex = _ref.tabIndex,
|
|
61
|
+
tabIndex = _ref$tabIndex === void 0 ? -1 : _ref$tabIndex,
|
|
43
62
|
minimal = _ref.minimal,
|
|
44
63
|
childOpen = _ref["data-open"],
|
|
45
64
|
ref = _ref.ref,
|
|
46
65
|
aria = _objectWithoutProperties(_ref, _excluded);
|
|
66
|
+
var elRef = useRef(null);
|
|
47
67
|
var tree = useFloatingTree();
|
|
48
68
|
var badgeProps = useMemo(function () {
|
|
49
69
|
return getBadgeProps(badge);
|
|
50
70
|
}, [badge]);
|
|
71
|
+
useEffect(function () {
|
|
72
|
+
var _elRef$current;
|
|
73
|
+
tabIndex === 0 && ((_elRef$current = elRef.current) === null || _elRef$current === void 0 ? void 0 : _elRef$current.focus());
|
|
74
|
+
}, [tabIndex]);
|
|
51
75
|
var iconEl = useMemo(function () {
|
|
52
76
|
var _path;
|
|
53
77
|
var path = icon;
|
|
54
78
|
if (minimal && !path) {
|
|
55
79
|
path = iconToken(label);
|
|
56
80
|
}
|
|
57
|
-
return /*#__PURE__*/jsx(Icon, {
|
|
58
|
-
className: classNames(
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
color: iconColor,
|
|
62
|
-
rtlFlip: rtlFlip
|
|
63
|
-
});
|
|
64
|
-
}, [icon, iconBg, iconColor, rtlFlip, minimal, label]);
|
|
81
|
+
return /*#__PURE__*/jsx(Icon, _objectSpread({
|
|
82
|
+
className: classNames("fabric-menuIcon", minimal && "minimal")
|
|
83
|
+
}, getIconProps((_path = path) !== null && _path !== void 0 ? _path : "")));
|
|
84
|
+
}, [icon, minimal, label]);
|
|
65
85
|
var Wrapper = useCallback(function (_ref2) {
|
|
66
86
|
var children = _ref2.children,
|
|
67
87
|
rest = _objectWithoutProperties(_ref2, _excluded2);
|
|
@@ -98,20 +118,27 @@ var MenuItem = function MenuItem(_ref) {
|
|
|
98
118
|
}, [iconEl, minimal, appendLabel, label, badge, badgeProps, hotKey, active]);
|
|
99
119
|
var E = as !== null && as !== void 0 ? as : "button";
|
|
100
120
|
return /*#__PURE__*/jsx(Wrapper, _objectSpread(_objectSpread({}, aria), {}, {
|
|
101
|
-
children: /*#__PURE__*/
|
|
102
|
-
ref: ref,
|
|
121
|
+
children: /*#__PURE__*/jsxs(E, _objectSpread(_objectSpread({
|
|
122
|
+
ref: mergeRefs(ref, elRef),
|
|
103
123
|
"data-dropdown-dismiss": true,
|
|
104
124
|
"data-color": color,
|
|
105
|
-
className: classNames(
|
|
125
|
+
className: classNames("fabric-menuItem cursor-pointer", className, active && "active", minimal && "minimal", disabled && "disabled", "rounded relative max-w-[50vw] my-0.5"),
|
|
106
126
|
"data-active": active,
|
|
107
127
|
"data-open": childOpen,
|
|
108
128
|
disabled: disabled,
|
|
109
129
|
"data-id": id,
|
|
130
|
+
tabIndex: tabIndex,
|
|
110
131
|
onClick: function onClick(e) {
|
|
111
132
|
(_onClick === null || _onClick === void 0 ? void 0 : _onClick(e)) !== false && (tree === null || tree === void 0 ? void 0 : tree.events.emit("click"));
|
|
112
133
|
}
|
|
113
134
|
}, minimal ? {} : aria), {}, {
|
|
114
|
-
children:
|
|
135
|
+
children: [hotKey && /*#__PURE__*/jsx(HotKey, {
|
|
136
|
+
keyCombo: hotKey,
|
|
137
|
+
handler: function handler() {
|
|
138
|
+
var _elRef$current2, _elRef$current2$click;
|
|
139
|
+
return (_elRef$current2 = elRef.current) === null || _elRef$current2 === void 0 || (_elRef$current2$click = _elRef$current2.click) === null || _elRef$current2$click === void 0 ? void 0 : _elRef$current2$click.call(_elRef$current2);
|
|
140
|
+
}
|
|
141
|
+
}), menuLabel]
|
|
115
142
|
}))
|
|
116
143
|
}));
|
|
117
144
|
};
|