@react-fabric/core 1.0.0-beta.6 → 1.0.0-beta.60
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} +77 -83
- 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} +11 -8
- 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 +7 -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 +110 -23
- 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 +50 -28
- 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 +44 -4
- 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 +30 -5
- 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 +1 -1
- 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 +172 -75
- package/dist/cjs/components/menu/ContextMenu.js +19 -0
- package/dist/cjs/components/menu/Menu.js +76 -21
- package/dist/cjs/components/menu/MenuItem.js +54 -26
- package/dist/cjs/components/meter/Meter.js +26 -3
- package/dist/cjs/components/navigator/Navigator.js +48 -15
- package/dist/cjs/components/panel/Panel.js +53 -22
- 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 -15
- 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 +48 -22
- 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 +40 -39
- 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 +75 -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 +11 -2
- package/dist/cjs/overlays/alert/Alert.js +23 -15
- package/dist/cjs/overlays/flyout/Flyout.js +48 -64
- package/dist/cjs/overlays/message/Message.js +8 -3
- package/dist/cjs/overlays/modal/Modal.js +17 -20
- package/dist/cjs/overlays/toast/Toast.js +20 -10
- package/dist/cjs/overlays/tooltip/Tooltip.js +24 -11
- package/dist/cjs/types/icons.js +17 -4
- package/dist/cjs/typography/Abbr.js +35 -7
- package/dist/cjs/typography/{Link.js → Anchor.js} +23 -5
- 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 +111 -24
- 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 +52 -30
- 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 +44 -4
- 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 +30 -5
- 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 +1 -1
- 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 +173 -76
- package/dist/esm/components/menu/ContextMenu.js +19 -0
- package/dist/esm/components/menu/Menu.js +78 -23
- package/dist/esm/components/menu/MenuItem.js +49 -21
- package/dist/esm/components/meter/Meter.js +26 -3
- package/dist/esm/components/navigator/Navigator.js +48 -15
- package/dist/esm/components/panel/Panel.js +54 -23
- 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 -16
- 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 +49 -23
- 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 +41 -40
- 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 +75 -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 +6 -2
- package/dist/esm/overlays/alert/Alert.js +24 -16
- package/dist/esm/overlays/flyout/Flyout.js +52 -68
- package/dist/esm/overlays/message/Message.js +9 -4
- package/dist/esm/overlays/modal/Modal.js +19 -22
- package/dist/esm/overlays/toast/Toast.js +21 -11
- package/dist/esm/overlays/tooltip/Tooltip.js +24 -11
- package/dist/esm/types/icons.js +17 -4
- package/dist/esm/typography/Abbr.js +35 -7
- package/dist/esm/typography/{Link.js → Anchor.js} +24 -6
- 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 +84 -5
- 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 -0
- 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/icons.d.ts +17 -3
- package/dist/types/types/index.d.ts +20 -22
- 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 +14 -16
- package/src/components/actionLabel/ActionLabel.tsx +26 -8
- package/src/components/animations/Animations.tsx +115 -36
- 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 +74 -42
- 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 +55 -12
- 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 +33 -8
- package/src/components/divider/Divider.tsx +42 -16
- package/src/components/dropdown/Dropdown.tsx +47 -12
- package/src/components/dropdown/DropdownTool.tsx +27 -2
- package/src/components/empty/EmptyContent.tsx +49 -8
- package/src/components/icon/Icon.tsx +96 -18
- package/src/components/index.ts +3 -2
- package/src/components/media/Media.tsx +193 -104
- package/src/components/menu/ContextMenu.tsx +19 -0
- package/src/components/menu/Menu.tsx +87 -30
- 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 +58 -9
- package/src/components/panel/Panel.tsx +53 -21
- 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 +56 -34
- 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 +42 -20
- 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 -0
- package/src/overlays/alert/Alert.tsx +50 -34
- package/src/overlays/flyout/Flyout.tsx +73 -97
- package/src/overlays/message/Message.tsx +28 -9
- package/src/overlays/modal/Modal.tsx +36 -30
- package/src/overlays/toast/Toast.tsx +42 -30
- package/src/overlays/tooltip/Tooltip.tsx +43 -18
- package/src/types/global.d.ts +8 -0
- package/src/types/icons.ts +32 -6
- package/src/types/index.ts +261 -45
- package/src/typography/Abbr.tsx +45 -11
- package/src/typography/{Link.tsx → Anchor.tsx} +26 -14
- package/src/typography/Copy.tsx +15 -0
- 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/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/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/typography/Typography.module.css +0 -1
- package/dist/types/typography/Link.d.ts +0 -25
|
@@ -5,16 +5,50 @@ 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,
|
|
8
|
+
import { useState, useEffect, useRef, Fragment } from 'react';
|
|
9
9
|
import { CoreIcons } from '../../types/icons.js';
|
|
10
10
|
import { Button } from '../button/Button.js';
|
|
11
|
-
import
|
|
11
|
+
import { Icon } from '../icon/Icon.js';
|
|
12
12
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
13
13
|
|
|
14
14
|
var _excluded = ["src", "alt", "reel", "fit", "className"],
|
|
15
15
|
_excluded2 = ["src", "poster", "reel", "autoPlay", "playOnHover", "fit", "className"];
|
|
16
16
|
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
17
|
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
|
+
var cover = {
|
|
19
|
+
fill: "object-fill",
|
|
20
|
+
cover: "object-cover",
|
|
21
|
+
contain: "object-contain"
|
|
22
|
+
};
|
|
23
|
+
var loadIndicator = /*#__PURE__*/jsx("div", {
|
|
24
|
+
className: classNames("fabric-mediaPlaceholder", "absolute z-1 top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 text-4xl text-gray animate-pulse"),
|
|
25
|
+
children: "\u25CF\u25CF\u25CF"
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Component for displaying images with optional reel decoration.
|
|
30
|
+
* A versatile media component that supports images and videos with various display options.
|
|
31
|
+
* It can display images with a reel decoration, handle loading states, and show error icons if the media fails to load.
|
|
32
|
+
* This component is useful for displaying images in a visually appealing way, with support for lazy loading and error handling.
|
|
33
|
+
* It automatically adjusts the display based on the provided fit property, allowing for different styles such as cover, contain, or fill.
|
|
34
|
+
*
|
|
35
|
+
* @param {ImageProps | VideoProps} props - The properties for the Media component.
|
|
36
|
+
* @returns {JSX.Element} The rendered Media component.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```jsx
|
|
40
|
+
* <Image
|
|
41
|
+
* src="image.jpg"
|
|
42
|
+
* alt="Example Image"
|
|
43
|
+
* reel={true}
|
|
44
|
+
* fit="cover"
|
|
45
|
+
* className="custom-class"
|
|
46
|
+
* />
|
|
47
|
+
* // Renders an image with reel decoration, cover fit, and a custom class name.
|
|
48
|
+
* ```
|
|
49
|
+
*
|
|
50
|
+
* @see {@link https://adarshpastakia.github.io/react-fabric/?path=/docs/core-components-media--docs} for more details.
|
|
51
|
+
*/
|
|
18
52
|
var Image = function Image(_ref) {
|
|
19
53
|
var src = _ref.src,
|
|
20
54
|
alt = _ref.alt,
|
|
@@ -27,31 +61,74 @@ var Image = function Image(_ref) {
|
|
|
27
61
|
_useState2 = _slicedToArray(_useState, 2),
|
|
28
62
|
colorSet = _useState2[0],
|
|
29
63
|
setColorSet = _useState2[1];
|
|
30
|
-
var
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
64
|
+
var _useState3 = useState(false),
|
|
65
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
66
|
+
loaded = _useState4[0],
|
|
67
|
+
setLoaded = _useState4[1];
|
|
68
|
+
var _useState5 = useState(false),
|
|
69
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
70
|
+
errored = _useState6[0],
|
|
71
|
+
setErrored = _useState6[1];
|
|
72
|
+
useEffect(function () {
|
|
73
|
+
setLoaded(false);
|
|
74
|
+
setErrored(false);
|
|
35
75
|
}, [src]);
|
|
36
76
|
return /*#__PURE__*/jsxs("div", _objectSpread(_objectSpread({
|
|
37
77
|
"data-ref": "image",
|
|
38
|
-
className: classNames(
|
|
78
|
+
className: classNames("fabric-mediaContainer", "relative overflow-hidden inline-block", reel && "fabric-mediaReel", className),
|
|
39
79
|
"data-colorset": colorSet
|
|
40
80
|
}, aria), {}, {
|
|
41
|
-
children: [loadIndicator, /*#__PURE__*/jsx("img", {
|
|
81
|
+
children: [!loaded && !errored && loadIndicator, !errored && /*#__PURE__*/jsx("img", {
|
|
42
82
|
alt: alt !== null && alt !== void 0 ? alt : src,
|
|
43
83
|
src: src,
|
|
44
84
|
loading: "lazy",
|
|
45
85
|
crossOrigin: "anonymous",
|
|
46
|
-
className: classNames(
|
|
86
|
+
className: classNames("fabric-media", "pointer-events-none w-full h-full", cover[fit]),
|
|
47
87
|
onLoad: function onLoad(e) {
|
|
48
|
-
|
|
49
|
-
(_e$currentTarget$prev = e.currentTarget.previousElementSibling) === null || _e$currentTarget$prev === void 0 || _e$currentTarget$prev.remove();
|
|
88
|
+
setLoaded(true);
|
|
50
89
|
setColorSet(getImageColorset(e.currentTarget));
|
|
90
|
+
},
|
|
91
|
+
onError: function onError() {
|
|
92
|
+
return setErrored(true);
|
|
51
93
|
}
|
|
94
|
+
}), errored && /*#__PURE__*/jsx(Icon, {
|
|
95
|
+
size: "2rem",
|
|
96
|
+
className: "absolute text-tint-300 top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2",
|
|
97
|
+
icon: CoreIcons.mediaImageBroken
|
|
52
98
|
})]
|
|
53
99
|
}));
|
|
54
100
|
};
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Component for displaying videos with optional controls and reel decoration.
|
|
104
|
+
* A versatile video component that supports autoplay, hover play, and various display options.
|
|
105
|
+
* It can display videos with a reel decoration, handle loading states, and show error icons if the video fails to load.
|
|
106
|
+
* This component is useful for displaying videos in a visually appealing way, with support for controls, autoplay, and error handling.
|
|
107
|
+
* It automatically adjusts the display based on the provided fit property, allowing for different styles such as cover, contain, or fill.
|
|
108
|
+
* It also includes controls for play/pause and volume, enhancing user interaction with the video content.
|
|
109
|
+
* This component is ideal for media-rich applications where video content needs to be displayed with user-friendly controls and visual effects.
|
|
110
|
+
* It supports features like autoplay, play on hover, and custom fit options for the video display.
|
|
111
|
+
* It also includes a reel decoration for a more engaging visual presentation.
|
|
112
|
+
*
|
|
113
|
+
* @param {VideoProps} props - The properties for the Video component.
|
|
114
|
+
* @returns {JSX.Element} The rendered Video component.
|
|
115
|
+
*
|
|
116
|
+
* @example
|
|
117
|
+
* ```jsx
|
|
118
|
+
* <Video
|
|
119
|
+
* src="video.mp4"
|
|
120
|
+
* poster="poster.jpg"
|
|
121
|
+
* reel={true}
|
|
122
|
+
* autoPlay={true}
|
|
123
|
+
* playOnHover={true}
|
|
124
|
+
* fit="cover"
|
|
125
|
+
* className="custom-class"
|
|
126
|
+
* />
|
|
127
|
+
* // Renders a video with reel decoration, autoplay, play on hover, cover fit, and a custom class name.
|
|
128
|
+
* ```
|
|
129
|
+
*
|
|
130
|
+
* @see {@link https://adarshpastakia.github.io/react-fabric/?path=/docs/core-components-video--docs} for more details.
|
|
131
|
+
*/
|
|
55
132
|
var Video = function Video(_ref2) {
|
|
56
133
|
var src = _ref2.src,
|
|
57
134
|
poster = _ref2.poster,
|
|
@@ -63,17 +140,32 @@ var Video = function Video(_ref2) {
|
|
|
63
140
|
className = _ref2.className,
|
|
64
141
|
aria = _objectWithoutProperties(_ref2, _excluded2);
|
|
65
142
|
var videoRef = useRef(null);
|
|
66
|
-
var
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
var
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
143
|
+
var _useState7 = useState(false),
|
|
144
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
145
|
+
loaded = _useState8[0],
|
|
146
|
+
setLoaded = _useState8[1];
|
|
147
|
+
var _useState9 = useState(false),
|
|
148
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
149
|
+
errored = _useState10[0],
|
|
150
|
+
setErrored = _useState10[1];
|
|
151
|
+
useEffect(function () {
|
|
152
|
+
setLoaded(false);
|
|
153
|
+
setErrored(false);
|
|
154
|
+
}, [src]);
|
|
155
|
+
var _useState11 = useState(true),
|
|
156
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
157
|
+
state = _useState12[0],
|
|
158
|
+
setState = _useState12[1];
|
|
159
|
+
var _useState13 = useState(false),
|
|
160
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
|
161
|
+
volume = _useState14[0],
|
|
162
|
+
setVolume = _useState14[1];
|
|
163
|
+
useEffect(function () {
|
|
164
|
+
setErrored(false);
|
|
165
|
+
}, [src]);
|
|
74
166
|
return /*#__PURE__*/jsxs("div", _objectSpread(_objectSpread({
|
|
75
167
|
"data-ref": "video",
|
|
76
|
-
className: classNames(
|
|
168
|
+
className: classNames("fabric-mediaContainer", "relative overflow-hidden inline-block", reel && "fabric-mediaReel", className),
|
|
77
169
|
onMouseEnter: function onMouseEnter() {
|
|
78
170
|
var _videoRef$current;
|
|
79
171
|
playOnHover && ((_videoRef$current = videoRef.current) === null || _videoRef$current === void 0 ? void 0 : _videoRef$current.play());
|
|
@@ -83,64 +175,69 @@ var Video = function Video(_ref2) {
|
|
|
83
175
|
playOnHover && ((_videoRef$current2 = videoRef.current) === null || _videoRef$current2 === void 0 ? void 0 : _videoRef$current2.pause());
|
|
84
176
|
}
|
|
85
177
|
}, 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);
|
|
178
|
+
children: [!loaded && !errored && loadIndicator, !errored && /*#__PURE__*/jsxs(Fragment, {
|
|
179
|
+
children: [/*#__PURE__*/jsxs("video", {
|
|
180
|
+
loop: true,
|
|
181
|
+
ref: videoRef,
|
|
182
|
+
controls: false,
|
|
183
|
+
poster: poster,
|
|
184
|
+
autoPlay: autoPlay,
|
|
185
|
+
className: classNames("fabric-media", "pointer-events-none w-full h-full", fit && "object-".concat(fit)),
|
|
186
|
+
onPlay: function onPlay() {
|
|
187
|
+
return setState(true);
|
|
188
|
+
},
|
|
189
|
+
onPause: function onPause() {
|
|
190
|
+
return setState(false);
|
|
191
|
+
},
|
|
192
|
+
onVolumeChange: function onVolumeChange(e) {
|
|
193
|
+
return setVolume(!!e.currentTarget.volume);
|
|
194
|
+
},
|
|
195
|
+
onLoadedData: function onLoadedData(e) {
|
|
196
|
+
e.currentTarget.volume = 0;
|
|
197
|
+
setLoaded(true);
|
|
131
198
|
},
|
|
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();
|
|
199
|
+
onError: function onError() {
|
|
200
|
+
return setErrored(true);
|
|
141
201
|
},
|
|
142
|
-
|
|
202
|
+
children: [/*#__PURE__*/jsx("source", {
|
|
203
|
+
src: src
|
|
204
|
+
}), /*#__PURE__*/jsx("track", {
|
|
205
|
+
kind: "captions"
|
|
206
|
+
})]
|
|
207
|
+
}), /*#__PURE__*/jsxs("div", {
|
|
208
|
+
"data-inner-clickable": true,
|
|
209
|
+
className: classNames("fabric-mediaControls", "absolute bottom-6 end-6 rounded-full flex flex-col"),
|
|
210
|
+
children: [/*#__PURE__*/jsx(Button, {
|
|
211
|
+
rounded: true,
|
|
212
|
+
variant: "link",
|
|
213
|
+
className: "fabric-mediaControlPlaceholder",
|
|
214
|
+
icon: CoreIcons.ellipsis,
|
|
215
|
+
"aria-label": "controls"
|
|
216
|
+
}), /*#__PURE__*/jsx(Button, {
|
|
217
|
+
rounded: true,
|
|
218
|
+
variant: "link",
|
|
219
|
+
"aria-label": "controls",
|
|
220
|
+
className: "fabric-mediaControlAction",
|
|
221
|
+
onClick: function onClick() {
|
|
222
|
+
videoRef.current && (videoRef.current.volume = videoRef.current.volume ? 0 : 1);
|
|
223
|
+
},
|
|
224
|
+
icon: volume ? CoreIcons.volumeOn : CoreIcons.volumeOff
|
|
225
|
+
}), /*#__PURE__*/jsx(Button, {
|
|
226
|
+
rounded: true,
|
|
227
|
+
variant: "link",
|
|
228
|
+
"aria-label": "controls",
|
|
229
|
+
className: "fabric-mediaControlAction",
|
|
230
|
+
onClick: function onClick() {
|
|
231
|
+
var _videoRef$current3, _videoRef$current4, _videoRef$current5;
|
|
232
|
+
(_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();
|
|
233
|
+
},
|
|
234
|
+
icon: state ? CoreIcons.pause : CoreIcons.play
|
|
235
|
+
})]
|
|
143
236
|
})]
|
|
237
|
+
}), errored && /*#__PURE__*/jsx(Icon, {
|
|
238
|
+
size: "2rem",
|
|
239
|
+
className: "absolute text-tint-300 top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2",
|
|
240
|
+
icon: CoreIcons.mediaVideoBroken
|
|
144
241
|
})]
|
|
145
242
|
}));
|
|
146
243
|
};
|
|
@@ -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,18 @@
|
|
|
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,
|
|
9
|
+
import { useState, useRef, useEffect, useCallback, cloneElement, Fragment } from 'react';
|
|
10
|
+
import { HotKeyWrapper } from '../../hotkeys/HotKeyWrapper.js';
|
|
10
11
|
import { CoreIcons } from '../../types/icons.js';
|
|
12
|
+
import { cloneChildren } from '../../utils/cloneElement.js';
|
|
11
13
|
import { nodeCheck } from '../../utils/nodeCheck.js';
|
|
12
14
|
import { MenuItem } from './MenuItem.js';
|
|
13
15
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
14
16
|
|
|
15
|
-
var _excluded = ["children", "minimal", "menuClassName", "onClick", "ref"];
|
|
17
|
+
var _excluded = ["children", "minimal", "menuClassName", "onClick", "trigger", "ref"];
|
|
16
18
|
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
19
|
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
20
|
// FIXME: refactor menu implementation to differentiate between static and floating menus, implement context wrapper for each menu level
|
|
@@ -23,6 +25,8 @@ var MenuComponent = function MenuComponent(_ref) {
|
|
|
23
25
|
minimal = _ref.minimal,
|
|
24
26
|
menuClassName = _ref.menuClassName,
|
|
25
27
|
onClick = _ref.onClick,
|
|
28
|
+
_ref$trigger = _ref.trigger,
|
|
29
|
+
trigger = _ref$trigger === void 0 ? "hover" : _ref$trigger,
|
|
26
30
|
ref = _ref.ref,
|
|
27
31
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
28
32
|
var _useState = useState(false),
|
|
@@ -44,6 +48,7 @@ var MenuComponent = function MenuComponent(_ref) {
|
|
|
44
48
|
open: !isNested || isOpen,
|
|
45
49
|
onOpenChange: function onOpenChange(open, event, reason) {
|
|
46
50
|
isNested && setIsOpen(open);
|
|
51
|
+
if (reason === "outside-press" && trigger === "click") tree === null || tree === void 0 || tree.events.emit("close");
|
|
47
52
|
},
|
|
48
53
|
placement: isNested ? "right-start" : "bottom-start",
|
|
49
54
|
middleware: [offset({
|
|
@@ -56,6 +61,7 @@ var MenuComponent = function MenuComponent(_ref) {
|
|
|
56
61
|
refs = _useFloating.refs,
|
|
57
62
|
context = _useFloating.context;
|
|
58
63
|
var hover = useHover(context, {
|
|
64
|
+
enabled: trigger === "hover",
|
|
59
65
|
delay: {
|
|
60
66
|
open: 75
|
|
61
67
|
},
|
|
@@ -64,8 +70,9 @@ var MenuComponent = function MenuComponent(_ref) {
|
|
|
64
70
|
})
|
|
65
71
|
});
|
|
66
72
|
var click = useClick(context, {
|
|
67
|
-
|
|
68
|
-
|
|
73
|
+
event: "mousedown",
|
|
74
|
+
toggle: trigger === "click" || !isNested,
|
|
75
|
+
ignoreMouse: trigger === "hover" && !isNested
|
|
69
76
|
});
|
|
70
77
|
var role = useRole(context, {
|
|
71
78
|
role: "menu"
|
|
@@ -137,6 +144,16 @@ var MenuComponent = function MenuComponent(_ref) {
|
|
|
137
144
|
});
|
|
138
145
|
}, 100);
|
|
139
146
|
}, [isOpen]);
|
|
147
|
+
useEffect(function () {
|
|
148
|
+
if ((!isNested || isOpen) && activeIndex) {
|
|
149
|
+
setTimeout(function () {
|
|
150
|
+
var _elementsRef$current$;
|
|
151
|
+
(_elementsRef$current$ = elementsRef.current[activeIndex]) === null || _elementsRef$current$ === void 0 || _elementsRef$current$.scrollIntoView({
|
|
152
|
+
block: "nearest"
|
|
153
|
+
});
|
|
154
|
+
}, 100);
|
|
155
|
+
}
|
|
156
|
+
}, [isOpen, activeIndex]);
|
|
140
157
|
return /*#__PURE__*/jsxs(FloatingNode, {
|
|
141
158
|
id: nodeId,
|
|
142
159
|
children: [isNested && /*#__PURE__*/jsx(MenuItem, _objectSpread(_objectSpread({}, getReferenceProps(_objectSpread(_objectSpread({}, rest), {}, {
|
|
@@ -155,21 +172,21 @@ var MenuComponent = function MenuComponent(_ref) {
|
|
|
155
172
|
elementsRef: elementsRef,
|
|
156
173
|
labelsRef: labelsRef,
|
|
157
174
|
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
|
-
|
|
175
|
+
children: [isNested && /*#__PURE__*/jsx(FloatingOverlay, {}), /*#__PURE__*/jsx(HotKeyWrapper, {
|
|
176
|
+
children: /*#__PURE__*/jsx(FloatingFocusManager, {
|
|
177
|
+
context: context,
|
|
178
|
+
modal: !isNested,
|
|
179
|
+
initialFocus: isNested ? -1 : 0,
|
|
180
|
+
returnFocus: !isNested,
|
|
181
|
+
children: /*#__PURE__*/jsx("div", _objectSpread(_objectSpread({
|
|
182
|
+
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)"),
|
|
183
|
+
autoFocus: true,
|
|
184
|
+
ref: mergeRefs(isNested ? refs.setFloating : ref)
|
|
185
|
+
}, getFloatingProps({
|
|
186
|
+
onClick: isNested ? undefined : handleClick
|
|
187
|
+
})), {}, {
|
|
188
|
+
style: !isNested ? rest.style : floatingStyles,
|
|
189
|
+
children: cloneChildren(children, function (child, index) {
|
|
173
190
|
labelsRef.current[index] = child.props.label;
|
|
174
191
|
return /*#__PURE__*/cloneElement(child, nodeCheck(child, MenuItem, Menu, MenuComponent) ? _objectSpread({
|
|
175
192
|
minimal: !isNested && minimal,
|
|
@@ -181,19 +198,57 @@ var MenuComponent = function MenuComponent(_ref) {
|
|
|
181
198
|
onClick: child.props.onClick,
|
|
182
199
|
tabIndex: activeIndex === index ? 0 : -1
|
|
183
200
|
})) : {});
|
|
184
|
-
}
|
|
185
|
-
})
|
|
186
|
-
})
|
|
201
|
+
})
|
|
202
|
+
}))
|
|
203
|
+
})
|
|
187
204
|
})]
|
|
188
205
|
}))
|
|
189
206
|
})]
|
|
190
207
|
});
|
|
191
208
|
};
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* A component that displays a menu with items, supports nested menus and various interactions.
|
|
212
|
+
* It can be triggered by hover or click events, and allows for custom styling and behavior.
|
|
213
|
+
* This component is designed to be used within a Floating UI context, allowing for dynamic positioning and interaction handling.
|
|
214
|
+
* It can be nested within other menus to create complex menu structures.
|
|
215
|
+
*
|
|
216
|
+
* @param {MenuProps} props - The properties for the Menu component.
|
|
217
|
+
* @returns {JSX.Element} The rendered Menu component.
|
|
218
|
+
*
|
|
219
|
+
* @example
|
|
220
|
+
* ```jsx
|
|
221
|
+
* <Menu
|
|
222
|
+
* className="my-menu"
|
|
223
|
+
* trigger="click"
|
|
224
|
+
* onClick={(id) => console.log(`Clicked item with id: ${id}`)}
|
|
225
|
+
* >
|
|
226
|
+
* <MenuItem id="item1" label="Item 1" />
|
|
227
|
+
* <MenuItem id="item2" label="Item 2" />
|
|
228
|
+
* <MenuItem id="item3" label="Item 3">
|
|
229
|
+
* <Menu>
|
|
230
|
+
* <MenuItem id="subitem1" label="Sub Item 1" />
|
|
231
|
+
* <MenuItem id="subitem2" label="Sub Item 2" />
|
|
232
|
+
* </Menu>
|
|
233
|
+
* </MenuItem>
|
|
234
|
+
* </Menu>
|
|
235
|
+
* ```
|
|
236
|
+
*
|
|
237
|
+
* @see {@link https://adarshpastakia.github.io/react-fabric/?path=/docs/core-components-menu--docs} for more details.
|
|
238
|
+
*/
|
|
192
239
|
var Menu = function Menu(props) {
|
|
193
240
|
var parentId = useFloatingParentNodeId();
|
|
241
|
+
var tree = useFloatingTree();
|
|
242
|
+
if (tree) {
|
|
243
|
+
return /*#__PURE__*/jsx(MenuComponent, _objectSpread(_objectSpread({}, props), {}, {
|
|
244
|
+
className: "",
|
|
245
|
+
menuClassName: props.className
|
|
246
|
+
}));
|
|
247
|
+
}
|
|
194
248
|
if (parentId === null) {
|
|
195
249
|
return /*#__PURE__*/jsx(FloatingTree, {
|
|
196
250
|
children: /*#__PURE__*/jsx(MenuComponent, _objectSpread(_objectSpread({}, props), {}, {
|
|
251
|
+
className: "",
|
|
197
252
|
menuClassName: props.className
|
|
198
253
|
}))
|
|
199
254
|
});
|
|
@@ -3,25 +3,46 @@
|
|
|
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';
|
|
17
|
+
import { Icon, getIconProps } from '../icon/Icon.js';
|
|
18
18
|
import '../../types/icons.js';
|
|
19
|
-
import
|
|
19
|
+
import '../../hotkeys/HotKeyWrapper.js';
|
|
20
20
|
|
|
21
|
-
var _excluded = ["as", "label", "color", "className", "icon", "
|
|
21
|
+
var _excluded = ["as", "label", "color", "className", "icon", "appendLabel", "altIcon", "id", "active", "disabled", "onClick", "badge", "hotKey", "tabIndex", "minimal", "data-open", "ref"],
|
|
22
22
|
_excluded2 = ["children"];
|
|
23
23
|
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
24
|
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; }
|
|
25
|
+
/**
|
|
26
|
+
* A menu item component that can be used in a dropdown or menu.
|
|
27
|
+
* It supports various features such as icons, badges, hotkeys, and more.
|
|
28
|
+
* It can be customized with different colors, icons, and behaviors.
|
|
29
|
+
*
|
|
30
|
+
* @param {MenuItemProps} props
|
|
31
|
+
* @returns A JSX element representing the menu item.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```jsx
|
|
35
|
+
* <MenuItem
|
|
36
|
+
* label="Settings"
|
|
37
|
+
* icon="settings"
|
|
38
|
+
* onClick={() => console.log("Settings clicked")}
|
|
39
|
+
* hotKey="Ctrl+S"
|
|
40
|
+
* badge={{ count: 3, color: "red" }}
|
|
41
|
+
* />
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
44
|
+
* @see {@link https://adarshpastakia.github.io/react-fabric/?path=/docs/core-components-menu--docs} for documentation.
|
|
45
|
+
*/
|
|
25
46
|
var MenuItem = function MenuItem(_ref) {
|
|
26
47
|
var as = _ref.as,
|
|
27
48
|
label = _ref.label,
|
|
@@ -29,10 +50,7 @@ var MenuItem = function MenuItem(_ref) {
|
|
|
29
50
|
color = _ref$color === void 0 ? "primary" : _ref$color,
|
|
30
51
|
className = _ref.className,
|
|
31
52
|
icon = _ref.icon,
|
|
32
|
-
iconBg = _ref.iconBg,
|
|
33
|
-
iconColor = _ref.iconColor,
|
|
34
53
|
appendLabel = _ref.appendLabel,
|
|
35
|
-
rtlFlip = _ref.rtlFlip,
|
|
36
54
|
altIcon = _ref.altIcon,
|
|
37
55
|
id = _ref.id,
|
|
38
56
|
active = _ref.active,
|
|
@@ -40,28 +58,31 @@ var MenuItem = function MenuItem(_ref) {
|
|
|
40
58
|
_onClick = _ref.onClick,
|
|
41
59
|
badge = _ref.badge,
|
|
42
60
|
hotKey = _ref.hotKey,
|
|
61
|
+
_ref$tabIndex = _ref.tabIndex,
|
|
62
|
+
tabIndex = _ref$tabIndex === void 0 ? -1 : _ref$tabIndex,
|
|
43
63
|
minimal = _ref.minimal,
|
|
44
64
|
childOpen = _ref["data-open"],
|
|
45
65
|
ref = _ref.ref,
|
|
46
66
|
aria = _objectWithoutProperties(_ref, _excluded);
|
|
67
|
+
var elRef = useRef(null);
|
|
47
68
|
var tree = useFloatingTree();
|
|
48
69
|
var badgeProps = useMemo(function () {
|
|
49
70
|
return getBadgeProps(badge);
|
|
50
71
|
}, [badge]);
|
|
72
|
+
useEffect(function () {
|
|
73
|
+
var _elRef$current;
|
|
74
|
+
tabIndex === 0 && ((_elRef$current = elRef.current) === null || _elRef$current === void 0 ? void 0 : _elRef$current.focus());
|
|
75
|
+
}, [tabIndex]);
|
|
51
76
|
var iconEl = useMemo(function () {
|
|
52
77
|
var _path;
|
|
53
78
|
var path = icon;
|
|
54
79
|
if (minimal && !path) {
|
|
55
80
|
path = iconToken(label);
|
|
56
81
|
}
|
|
57
|
-
return /*#__PURE__*/jsx(Icon, {
|
|
58
|
-
className: classNames(
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
color: iconColor,
|
|
62
|
-
rtlFlip: rtlFlip
|
|
63
|
-
});
|
|
64
|
-
}, [icon, iconBg, iconColor, rtlFlip, minimal, label]);
|
|
82
|
+
return /*#__PURE__*/jsx(Icon, _objectSpread({
|
|
83
|
+
className: classNames("fabric-menuIcon", minimal && "minimal")
|
|
84
|
+
}, getIconProps((_path = path) !== null && _path !== void 0 ? _path : "")));
|
|
85
|
+
}, [icon, minimal, label]);
|
|
65
86
|
var Wrapper = useCallback(function (_ref2) {
|
|
66
87
|
var children = _ref2.children,
|
|
67
88
|
rest = _objectWithoutProperties(_ref2, _excluded2);
|
|
@@ -98,20 +119,27 @@ var MenuItem = function MenuItem(_ref) {
|
|
|
98
119
|
}, [iconEl, minimal, appendLabel, label, badge, badgeProps, hotKey, active]);
|
|
99
120
|
var E = as !== null && as !== void 0 ? as : "button";
|
|
100
121
|
return /*#__PURE__*/jsx(Wrapper, _objectSpread(_objectSpread({}, aria), {}, {
|
|
101
|
-
children: /*#__PURE__*/
|
|
102
|
-
ref: ref,
|
|
122
|
+
children: /*#__PURE__*/jsxs(E, _objectSpread(_objectSpread({
|
|
123
|
+
ref: mergeRefs(ref, elRef),
|
|
103
124
|
"data-dropdown-dismiss": true,
|
|
104
125
|
"data-color": color,
|
|
105
|
-
className: classNames(
|
|
126
|
+
className: classNames("fabric-menuItem cursor-pointer", className, active && "active", minimal && "minimal", disabled && "disabled", "rounded relative max-w-[50vw] my-0.5"),
|
|
106
127
|
"data-active": active,
|
|
107
128
|
"data-open": childOpen,
|
|
108
129
|
disabled: disabled,
|
|
109
130
|
"data-id": id,
|
|
131
|
+
tabIndex: tabIndex,
|
|
110
132
|
onClick: function onClick(e) {
|
|
111
133
|
(_onClick === null || _onClick === void 0 ? void 0 : _onClick(e)) !== false && (tree === null || tree === void 0 ? void 0 : tree.events.emit("click"));
|
|
112
134
|
}
|
|
113
135
|
}, minimal ? {} : aria), {}, {
|
|
114
|
-
children:
|
|
136
|
+
children: [hotKey && /*#__PURE__*/jsx(HotKey, {
|
|
137
|
+
keyCombo: hotKey,
|
|
138
|
+
handler: function handler() {
|
|
139
|
+
var _elRef$current2, _elRef$current2$click;
|
|
140
|
+
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);
|
|
141
|
+
}
|
|
142
|
+
}), menuLabel]
|
|
115
143
|
}))
|
|
116
144
|
}));
|
|
117
145
|
};
|