@react-fabric/core 1.0.0-beta.5 → 1.0.0-beta.51
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} +49 -44
- package/{src/components/button/Button.module.css → css/components/_button.css} +69 -79
- package/{src/components/card/Card.module.css → css/components/_card.css} +50 -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} +8 -5
- package/{src/components/media/Media.module.css → css/components/_media.css} +17 -17
- package/{src/components/menu/Menu.module.css → css/components/_menu.css} +19 -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} +6 -6
- 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/{src/components/tabpanel/TabPanel.module.css → css/components/_tabPanel.css} +73 -84
- 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} +25 -18
- package/{src/core/aside/Aside.module.css → css/core/_aside.css} +56 -42
- 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 +42 -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 +530 -0
- package/css/theme/index.css +45 -0
- package/dist/cjs/components/actionLabel/ActionLabel.js +3 -3
- package/dist/cjs/components/animations/Animations.js +29 -18
- package/dist/cjs/components/avatar/Avatar.js +10 -13
- package/dist/cjs/components/avatar/AvatarGroup.js +3 -3
- package/dist/cjs/components/badge/Badge.js +5 -5
- package/dist/cjs/components/breadcrumbs/Breadcrumbs.js +10 -8
- package/dist/cjs/components/button/Button.js +18 -14
- package/dist/cjs/components/button/ButtonGroup.js +4 -3
- package/dist/cjs/components/button/ConfirmButton.js +10 -3
- package/dist/cjs/components/button/ToggleButtonGroup.js +3 -3
- package/dist/cjs/components/callout/Callout.js +16 -4
- package/dist/cjs/components/card/Card.js +14 -10
- package/dist/cjs/components/card/CardCover.js +10 -5
- package/dist/cjs/components/card/FlipContent.js +35 -0
- package/dist/cjs/components/chip/Chip.js +11 -7
- package/dist/cjs/components/collapsable/Collapsable.js +6 -6
- package/dist/cjs/components/divider/Divider.js +11 -7
- package/dist/cjs/components/dropdown/Dropdown.js +6 -9
- package/dist/cjs/components/dropdown/DropdownTool.js +4 -3
- package/dist/cjs/components/empty/EmptyContent.js +8 -5
- package/dist/cjs/components/icon/Icon.js +17 -15
- package/dist/cjs/components/media/Media.js +116 -75
- package/dist/cjs/components/menu/ContextMenu.js +30 -10
- package/dist/cjs/components/menu/Menu.js +44 -21
- package/dist/cjs/components/menu/MenuItem.js +30 -16
- package/dist/cjs/components/meter/Meter.js +2 -3
- package/dist/cjs/components/navigator/Navigator.js +26 -13
- package/dist/cjs/components/panel/Panel.js +10 -9
- package/dist/cjs/components/panel/PanelGroup.js +1 -2
- package/dist/cjs/components/progress/ProgressBar.js +10 -9
- package/dist/cjs/components/progress/ProgressCircle.js +9 -7
- package/dist/cjs/components/tabpanel/Tab.js +58 -38
- package/dist/cjs/components/tabpanel/TabPanel.js +20 -16
- package/dist/cjs/context/Global.js +3 -0
- package/dist/cjs/context/NotificationCenter.js +3 -3
- package/dist/cjs/core/aside/Aside.js +11 -10
- package/dist/cjs/core/boundary/ErrorBoundary.js +6 -7
- package/dist/cjs/core/boundary/ErrorIcon.js +1 -2
- package/dist/cjs/core/content/Content.js +9 -7
- package/dist/cjs/core/headfoot/HeadFoot.js +2 -20
- package/dist/cjs/core/page/Page.js +16 -30
- package/dist/cjs/core/responsive/Responsive.js +5 -5
- package/dist/cjs/core/section/Section.js +1 -2
- package/dist/cjs/core/theme/ThemeProvider.js +11 -9
- package/dist/cjs/core/viewport/Viewport.js +4 -2
- package/dist/cjs/hooks/useDebounce.js +1 -1
- package/dist/cjs/hooks/useEffectDebugger.js +2 -2
- package/dist/cjs/hooks/useNavigator.js +6 -4
- package/dist/cjs/hooks/useResizeObserver.js +1 -1
- package/dist/cjs/hotkeys/HotKeyLabel.js +1 -1
- package/dist/cjs/hotkeys/HotKeyWrapper.js +3 -1
- package/dist/cjs/index.js +8 -2
- package/dist/cjs/overlays/alert/Alert.js +20 -14
- package/dist/cjs/overlays/flyout/Flyout.js +49 -60
- package/dist/cjs/overlays/message/Message.js +6 -3
- package/dist/cjs/overlays/modal/Modal.js +16 -12
- package/dist/cjs/overlays/toast/Toast.js +17 -9
- package/dist/cjs/overlays/tooltip/Tooltip.js +24 -11
- package/dist/cjs/types/icons.js +6 -1
- package/dist/cjs/typography/Abbr.js +4 -5
- package/dist/cjs/typography/{Link.js → Anchor.js} +5 -4
- package/dist/cjs/typography/Mark.js +2 -3
- package/dist/cjs/typography/Text.js +3 -4
- package/dist/cjs/typography/Title.js +3 -3
- package/dist/cjs/utils/cloneElement.js +47 -0
- package/dist/cjs/utils/getColor.js +1 -18
- package/dist/esm/components/actionLabel/ActionLabel.js +3 -3
- package/dist/esm/components/animations/Animations.js +30 -19
- package/dist/esm/components/avatar/Avatar.js +11 -14
- package/dist/esm/components/avatar/AvatarGroup.js +3 -3
- package/dist/esm/components/badge/Badge.js +5 -5
- package/dist/esm/components/breadcrumbs/Breadcrumbs.js +10 -8
- package/dist/esm/components/button/Button.js +18 -14
- package/dist/esm/components/button/ButtonGroup.js +5 -4
- package/dist/esm/components/button/ConfirmButton.js +10 -3
- package/dist/esm/components/button/ToggleButtonGroup.js +4 -4
- package/dist/esm/components/callout/Callout.js +16 -4
- package/dist/esm/components/card/Card.js +15 -11
- package/dist/esm/components/card/CardCover.js +10 -5
- package/dist/esm/components/card/FlipContent.js +35 -0
- package/dist/esm/components/chip/Chip.js +12 -8
- package/dist/esm/components/collapsable/Collapsable.js +6 -6
- package/dist/esm/components/divider/Divider.js +12 -8
- package/dist/esm/components/dropdown/Dropdown.js +6 -9
- package/dist/esm/components/dropdown/DropdownTool.js +4 -3
- package/dist/esm/components/empty/EmptyContent.js +8 -5
- package/dist/esm/components/icon/Icon.js +17 -15
- package/dist/esm/components/media/Media.js +117 -76
- package/dist/esm/components/menu/ContextMenu.js +32 -12
- package/dist/esm/components/menu/Menu.js +46 -23
- package/dist/esm/components/menu/MenuItem.js +24 -10
- package/dist/esm/components/meter/Meter.js +2 -3
- package/dist/esm/components/navigator/Navigator.js +26 -13
- package/dist/esm/components/panel/Panel.js +10 -9
- package/dist/esm/components/panel/PanelGroup.js +1 -2
- package/dist/esm/components/progress/ProgressBar.js +10 -9
- package/dist/esm/components/progress/ProgressCircle.js +9 -7
- package/dist/esm/components/tabpanel/Tab.js +59 -39
- package/dist/esm/components/tabpanel/TabPanel.js +20 -16
- package/dist/esm/context/Global.js +3 -0
- package/dist/esm/context/NotificationCenter.js +3 -3
- package/dist/esm/core/aside/Aside.js +11 -10
- package/dist/esm/core/boundary/ErrorBoundary.js +6 -7
- package/dist/esm/core/boundary/ErrorIcon.js +1 -2
- package/dist/esm/core/content/Content.js +9 -7
- package/dist/esm/core/headfoot/HeadFoot.js +2 -20
- package/dist/esm/core/page/Page.js +16 -30
- package/dist/esm/core/responsive/Responsive.js +5 -5
- package/dist/esm/core/section/Section.js +1 -2
- package/dist/esm/core/theme/ThemeProvider.js +11 -9
- package/dist/esm/core/viewport/Viewport.js +4 -2
- package/dist/esm/hooks/useDebounce.js +1 -1
- package/dist/esm/hooks/useEffectDebugger.js +2 -2
- package/dist/esm/hooks/useNavigator.js +7 -5
- package/dist/esm/hooks/useResizeObserver.js +1 -1
- package/dist/esm/hotkeys/HotKeyLabel.js +1 -1
- package/dist/esm/hotkeys/HotKeyWrapper.js +3 -1
- package/dist/esm/index.js +4 -1
- package/dist/esm/overlays/alert/Alert.js +21 -15
- package/dist/esm/overlays/flyout/Flyout.js +52 -63
- package/dist/esm/overlays/message/Message.js +7 -4
- package/dist/esm/overlays/modal/Modal.js +17 -13
- package/dist/esm/overlays/toast/Toast.js +18 -10
- package/dist/esm/overlays/tooltip/Tooltip.js +24 -11
- package/dist/esm/types/icons.js +6 -1
- package/dist/esm/typography/Abbr.js +4 -5
- package/dist/esm/typography/{Link.js → Anchor.js} +6 -5
- package/dist/esm/typography/Mark.js +2 -3
- package/dist/esm/typography/Text.js +4 -5
- package/dist/esm/typography/Title.js +4 -4
- package/dist/esm/utils/cloneElement.js +47 -0
- package/dist/esm/utils/getColor.js +2 -16
- package/dist/types/components/actionLabel/ActionLabel.d.ts +2 -2
- package/dist/types/components/animations/Animations.d.ts +5 -5
- package/dist/types/components/avatar/Avatar.d.ts +3 -3
- package/dist/types/components/badge/Badge.d.ts +5 -1
- package/dist/types/components/breadcrumbs/Breadcrumbs.d.ts +2 -2
- package/dist/types/components/button/Button.d.ts +7 -5
- package/dist/types/components/button/ButtonGroup.d.ts +2 -2
- package/dist/types/components/button/ConfirmButton.d.ts +6 -1
- package/dist/types/components/callout/Callout.d.ts +4 -3
- package/dist/types/components/card/Card.d.ts +8 -4
- package/dist/types/components/card/FlipContent.d.ts +7 -0
- package/dist/types/components/chip/Chip.d.ts +3 -3
- package/dist/types/components/collapsable/Collapsable.d.ts +7 -3
- package/dist/types/components/divider/Divider.d.ts +11 -7
- package/dist/types/components/dropdown/DropdownTool.d.ts +2 -1
- package/dist/types/components/empty/EmptyContent.d.ts +6 -2
- package/dist/types/components/icon/Icon.d.ts +5 -4
- package/dist/types/components/index.d.ts +2 -1
- package/dist/types/components/media/Media.d.ts +2 -2
- package/dist/types/components/menu/ContextMenu.d.ts +2 -1
- package/dist/types/components/menu/MenuItem.d.ts +1 -1
- package/dist/types/components/menu/types.d.ts +3 -2
- package/dist/types/components/navigator/Navigator.d.ts +7 -4
- package/dist/types/components/panel/Panel.d.ts +0 -1
- package/dist/types/components/progress/ProgressBar.d.ts +3 -3
- package/dist/types/components/progress/ProgressCircle.d.ts +3 -3
- package/dist/types/components/tabpanel/Tab.d.ts +5 -5
- package/dist/types/components/tabpanel/TabPanel.d.ts +10 -1
- package/dist/types/core/boundary/ErrorBoundary.d.ts +1 -1
- package/dist/types/core/content/Content.d.ts +3 -2
- package/dist/types/core/headfoot/HeadFoot.d.ts +1 -9
- package/dist/types/core/page/Page.d.ts +3 -3
- package/dist/types/core/responsive/Responsive.d.ts +6 -2
- package/dist/types/core/theme/ThemeProvider.d.ts +4 -4
- package/dist/types/hooks/useOverlayService.d.ts +3 -5
- package/dist/types/hooks/useResize.d.ts +1 -1
- package/dist/types/hooks/useResizeObserver.d.ts +1 -1
- package/dist/types/index.d.ts +3 -0
- package/dist/types/overlays/alert/Alert.d.ts +2 -3
- package/dist/types/overlays/flyout/Flyout.d.ts +3 -2
- package/dist/types/overlays/message/Message.d.ts +2 -3
- package/dist/types/overlays/modal/Modal.d.ts +12 -3
- package/dist/types/overlays/toast/Toast.d.ts +2 -3
- package/dist/types/overlays/tooltip/Tooltip.d.ts +2 -2
- package/dist/types/types/icons.d.ts +6 -1
- package/dist/types/types/index.d.ts +26 -6
- package/dist/types/typography/Abbr.d.ts +6 -3
- package/dist/types/typography/Anchor.d.ts +25 -0
- package/dist/types/typography/Mark.d.ts +2 -3
- package/dist/types/typography/index.d.ts +1 -1
- package/dist/types/utils/cloneElement.d.ts +2 -0
- package/dist/types/utils/getColor.d.ts +1 -4
- package/dist/types/utils/index.d.ts +1 -0
- package/package.json +11 -13
- package/src/components/actionLabel/ActionLabel.tsx +15 -6
- package/src/components/animations/Animations.tsx +29 -23
- package/src/components/avatar/Avatar.tsx +74 -88
- package/src/components/avatar/AvatarGroup.tsx +4 -4
- package/src/components/badge/Badge.tsx +11 -7
- package/src/components/breadcrumbs/Breadcrumbs.tsx +13 -9
- package/src/components/button/Button.tsx +27 -22
- package/src/components/button/ButtonGroup.tsx +7 -7
- package/src/components/button/ConfirmButton.tsx +19 -6
- package/src/components/button/ToggleButtonGroup.tsx +5 -5
- package/src/components/callout/Callout.tsx +28 -12
- package/src/components/card/Card.tsx +30 -15
- package/src/components/card/CardCover.tsx +11 -6
- package/src/components/card/FlipContent.tsx +69 -0
- package/src/components/chip/Chip.tsx +19 -13
- package/src/components/collapsable/Collapsable.tsx +12 -7
- package/src/components/divider/Divider.tsx +23 -16
- package/src/components/dropdown/Dropdown.tsx +6 -11
- package/src/components/dropdown/DropdownTool.tsx +5 -3
- package/src/components/empty/EmptyContent.tsx +21 -6
- package/src/components/icon/Icon.tsx +58 -67
- package/src/components/index.ts +2 -1
- package/src/components/media/Media.tsx +141 -106
- package/src/components/menu/ContextMenu.tsx +36 -11
- package/src/components/menu/Menu.tsx +56 -30
- package/src/components/menu/MenuItem.tsx +19 -9
- package/src/components/menu/types.ts +3 -2
- package/src/components/meter/Meter.tsx +2 -3
- package/src/components/navigator/Navigator.tsx +36 -7
- package/src/components/panel/Panel.tsx +10 -9
- package/src/components/panel/PanelGroup.tsx +1 -2
- package/src/components/progress/ProgressBar.tsx +13 -14
- package/src/components/progress/ProgressCircle.tsx +10 -13
- package/src/components/tabpanel/Tab.tsx +81 -64
- package/src/components/tabpanel/TabPanel.tsx +34 -12
- package/src/context/Global.tsx +4 -0
- package/src/context/NotificationCenter.tsx +3 -3
- package/src/core/aside/Aside.tsx +11 -10
- package/src/core/boundary/ErrorBoundary.tsx +8 -7
- package/src/core/boundary/ErrorIcon.tsx +1 -2
- package/src/core/content/Content.tsx +17 -12
- package/src/core/headfoot/HeadFoot.tsx +2 -35
- package/src/core/page/Page.tsx +18 -5
- package/src/core/responsive/Responsive.tsx +14 -7
- package/src/core/section/Section.tsx +1 -2
- package/src/core/theme/ThemeProvider.tsx +14 -13
- package/src/core/viewport/Viewport.tsx +1 -2
- package/src/hooks/useDebounce.ts +1 -1
- package/src/hooks/useEffectDebugger.ts +1 -2
- package/src/hooks/useNavigator.tsx +10 -5
- package/src/hooks/useOverlayService.tsx +12 -6
- package/src/hooks/useResize.ts +1 -1
- package/src/hooks/useResizeObserver.ts +13 -9
- package/src/hotkeys/HotKeyLabel.tsx +1 -1
- package/src/hotkeys/HotKeyWrapper.tsx +3 -1
- package/src/index.ts +4 -0
- package/src/overlays/alert/Alert.tsx +28 -32
- package/src/overlays/flyout/Flyout.tsx +71 -84
- package/src/overlays/message/Message.tsx +10 -7
- package/src/overlays/modal/Modal.tsx +37 -15
- package/src/overlays/toast/Toast.tsx +18 -27
- package/src/overlays/tooltip/Tooltip.tsx +43 -18
- package/src/types/icons.ts +13 -2
- package/src/types/index.ts +268 -27
- package/src/typography/Abbr.tsx +16 -10
- package/src/typography/{Link.tsx → Anchor.tsx} +8 -13
- package/src/typography/Mark.tsx +4 -9
- package/src/typography/Text.tsx +4 -12
- package/src/typography/Title.tsx +2 -6
- 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
|
@@ -48,7 +48,6 @@ import {
|
|
|
48
48
|
import { mergeRefs } from "@react-fabric/utilities";
|
|
49
49
|
import classNames from "classnames";
|
|
50
50
|
import {
|
|
51
|
-
Children,
|
|
52
51
|
cloneElement,
|
|
53
52
|
Fragment,
|
|
54
53
|
useCallback,
|
|
@@ -56,8 +55,9 @@ import {
|
|
|
56
55
|
useRef,
|
|
57
56
|
useState,
|
|
58
57
|
} from "react";
|
|
58
|
+
import { HotKeyWrapper } from "../../hotkeys/HotKeyWrapper";
|
|
59
59
|
import { CoreIcons } from "../../types/icons";
|
|
60
|
-
import { nodeCheck } from "../../utils";
|
|
60
|
+
import { cloneChildren, nodeCheck } from "../../utils";
|
|
61
61
|
import { MenuItem } from "./MenuItem";
|
|
62
62
|
import { type MenuProps } from "./types";
|
|
63
63
|
|
|
@@ -69,6 +69,8 @@ const MenuComponent = ({
|
|
|
69
69
|
menuClassName,
|
|
70
70
|
onClick,
|
|
71
71
|
// @ts-expect-error ignore
|
|
72
|
+
trigger = "hover",
|
|
73
|
+
// @ts-expect-error ignore
|
|
72
74
|
ref,
|
|
73
75
|
...rest
|
|
74
76
|
}: Partial<MenuProps>) => {
|
|
@@ -89,6 +91,8 @@ const MenuComponent = ({
|
|
|
89
91
|
open: !isNested || isOpen,
|
|
90
92
|
onOpenChange(open, event, reason) {
|
|
91
93
|
isNested && setIsOpen(open);
|
|
94
|
+
if (reason === "outside-press" && trigger === "click")
|
|
95
|
+
tree?.events.emit("close");
|
|
92
96
|
},
|
|
93
97
|
placement: isNested ? "right-start" : "bottom-start",
|
|
94
98
|
middleware: [
|
|
@@ -100,12 +104,14 @@ const MenuComponent = ({
|
|
|
100
104
|
});
|
|
101
105
|
|
|
102
106
|
const hover = useHover(context, {
|
|
107
|
+
enabled: trigger === "hover",
|
|
103
108
|
delay: { open: 75 },
|
|
104
109
|
handleClose: safePolygon({ blockPointerEvents: true }),
|
|
105
110
|
});
|
|
106
111
|
const click = useClick(context, {
|
|
107
|
-
|
|
108
|
-
|
|
112
|
+
event: "mousedown",
|
|
113
|
+
toggle: trigger === "click" || !isNested,
|
|
114
|
+
ignoreMouse: trigger === "hover" && !isNested,
|
|
109
115
|
});
|
|
110
116
|
const role = useRole(context, { role: "menu" });
|
|
111
117
|
const dismiss = useDismiss(context, { bubbles: true });
|
|
@@ -187,6 +193,16 @@ const MenuComponent = ({
|
|
|
187
193
|
);
|
|
188
194
|
}, [isOpen]);
|
|
189
195
|
|
|
196
|
+
useEffect(() => {
|
|
197
|
+
if ((!isNested || isOpen) && activeIndex) {
|
|
198
|
+
setTimeout(() => {
|
|
199
|
+
elementsRef.current[activeIndex]?.scrollIntoView({
|
|
200
|
+
block: "nearest",
|
|
201
|
+
});
|
|
202
|
+
}, 100);
|
|
203
|
+
}
|
|
204
|
+
}, [isOpen, activeIndex]);
|
|
205
|
+
|
|
190
206
|
return (
|
|
191
207
|
<FloatingNode id={nodeId}>
|
|
192
208
|
{isNested && (
|
|
@@ -210,29 +226,29 @@ const MenuComponent = ({
|
|
|
210
226
|
{(!isNested || isOpen) && (
|
|
211
227
|
<Wrapper {...wrapperProps}>
|
|
212
228
|
{isNested && <FloatingOverlay />}
|
|
213
|
-
<
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
<div
|
|
220
|
-
className={classNames(
|
|
221
|
-
menuClassName,
|
|
222
|
-
"flex flex-col bg-base p-1 menu-list",
|
|
223
|
-
isNested &&
|
|
224
|
-
"outline shadow-lg rounded-capped max-h-96 overflow-auto scroll-thin z-[var(--z-popover)]",
|
|
225
|
-
)}
|
|
226
|
-
autoFocus
|
|
227
|
-
ref={mergeRefs(refs.setFloating, isNested ? undefined : ref)}
|
|
228
|
-
{...getFloatingProps({
|
|
229
|
-
onClick: isNested ? undefined : handleClick,
|
|
230
|
-
})}
|
|
231
|
-
// @ts-expect-error ignore
|
|
232
|
-
{...{ style: !isNested ? rest.style : floatingStyles }}
|
|
229
|
+
<HotKeyWrapper>
|
|
230
|
+
<FloatingFocusManager
|
|
231
|
+
context={context}
|
|
232
|
+
modal={!isNested}
|
|
233
|
+
initialFocus={isNested ? -1 : 0}
|
|
234
|
+
returnFocus={!isNested}
|
|
233
235
|
>
|
|
234
|
-
|
|
235
|
-
|
|
236
|
+
<div
|
|
237
|
+
className={classNames(
|
|
238
|
+
menuClassName,
|
|
239
|
+
"flex flex-col bg-base p-1 menu-list",
|
|
240
|
+
isNested &&
|
|
241
|
+
"outline shadow-lg rounded-capped max-h-96 overflow-auto scroll-thin z-(--z-popover)",
|
|
242
|
+
)}
|
|
243
|
+
autoFocus
|
|
244
|
+
ref={mergeRefs(isNested ? refs.setFloating : ref)}
|
|
245
|
+
{...getFloatingProps({
|
|
246
|
+
onClick: isNested ? undefined : handleClick,
|
|
247
|
+
})}
|
|
248
|
+
// @ts-expect-error ignore
|
|
249
|
+
{...{ style: !isNested ? rest.style : floatingStyles }}
|
|
250
|
+
>
|
|
251
|
+
{cloneChildren(children, (child: AnyObject, index) => {
|
|
236
252
|
labelsRef.current[index] = child.props.label;
|
|
237
253
|
return cloneElement(
|
|
238
254
|
child,
|
|
@@ -249,10 +265,10 @@ const MenuComponent = ({
|
|
|
249
265
|
}
|
|
250
266
|
: {},
|
|
251
267
|
);
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
</
|
|
255
|
-
</
|
|
268
|
+
})}
|
|
269
|
+
</div>
|
|
270
|
+
</FloatingFocusManager>
|
|
271
|
+
</HotKeyWrapper>
|
|
256
272
|
</Wrapper>
|
|
257
273
|
)}
|
|
258
274
|
</FloatingList>
|
|
@@ -262,6 +278,16 @@ const MenuComponent = ({
|
|
|
262
278
|
|
|
263
279
|
export const Menu = (props: MenuProps) => {
|
|
264
280
|
const parentId = useFloatingParentNodeId();
|
|
281
|
+
const tree = useFloatingTree();
|
|
282
|
+
|
|
283
|
+
if (tree) {
|
|
284
|
+
return (
|
|
285
|
+
<MenuComponent
|
|
286
|
+
{...(props as AnyObject)}
|
|
287
|
+
menuClassName={props.className}
|
|
288
|
+
/>
|
|
289
|
+
);
|
|
290
|
+
}
|
|
265
291
|
|
|
266
292
|
if (parentId === null) {
|
|
267
293
|
return (
|
|
@@ -22,15 +22,15 @@
|
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
24
|
import { useFloatingTree } from "@floating-ui/react";
|
|
25
|
-
import { iconToken } from "@react-fabric/utilities";
|
|
25
|
+
import { iconToken, mergeRefs } from "@react-fabric/utilities";
|
|
26
26
|
import classNames from "classnames";
|
|
27
|
-
import { Fragment, useCallback, useMemo } from "react";
|
|
27
|
+
import { Fragment, useCallback, useEffect, useMemo, useRef } from "react";
|
|
28
|
+
import { HotKey } from "../../hotkeys/HotKey";
|
|
28
29
|
import { HotKeyLabel } from "../../hotkeys/HotKeyLabel";
|
|
29
30
|
import { Tooltip } from "../../overlays";
|
|
30
31
|
import { type PolymorphicProps } from "../../types";
|
|
31
32
|
import { Badge, getBadgeProps } from "../badge/Badge";
|
|
32
33
|
import { Icon } from "../icon/Icon";
|
|
33
|
-
import classes from "./Menu.module.css";
|
|
34
34
|
import { type MenuItemProps } from "./types";
|
|
35
35
|
|
|
36
36
|
export const MenuItem = <Tag extends React.ElementType = "button">({
|
|
@@ -50,6 +50,7 @@ export const MenuItem = <Tag extends React.ElementType = "button">({
|
|
|
50
50
|
onClick,
|
|
51
51
|
badge,
|
|
52
52
|
hotKey,
|
|
53
|
+
tabIndex = -1,
|
|
53
54
|
// @ts-expect-error ignore
|
|
54
55
|
minimal,
|
|
55
56
|
// @ts-expect-error ignore
|
|
@@ -58,11 +59,16 @@ export const MenuItem = <Tag extends React.ElementType = "button">({
|
|
|
58
59
|
ref,
|
|
59
60
|
...aria
|
|
60
61
|
}: MenuItemProps & PolymorphicProps<Tag>) => {
|
|
62
|
+
const elRef = useRef<HTMLElement>(null);
|
|
61
63
|
const tree = useFloatingTree();
|
|
62
64
|
const badgeProps = useMemo(() => {
|
|
63
65
|
return getBadgeProps(badge);
|
|
64
66
|
}, [badge]);
|
|
65
67
|
|
|
68
|
+
useEffect(() => {
|
|
69
|
+
tabIndex === 0 && elRef.current?.focus();
|
|
70
|
+
}, [tabIndex]);
|
|
71
|
+
|
|
66
72
|
const iconEl = useMemo(() => {
|
|
67
73
|
let path = icon;
|
|
68
74
|
if (minimal && !path) {
|
|
@@ -70,7 +76,7 @@ export const MenuItem = <Tag extends React.ElementType = "button">({
|
|
|
70
76
|
}
|
|
71
77
|
return (
|
|
72
78
|
<Icon
|
|
73
|
-
className={classNames(
|
|
79
|
+
className={classNames("fabric-menuIcon", minimal && "minimal")}
|
|
74
80
|
icon={path ?? ""}
|
|
75
81
|
bg={iconBg}
|
|
76
82
|
color={iconColor}
|
|
@@ -135,26 +141,30 @@ export const MenuItem = <Tag extends React.ElementType = "button">({
|
|
|
135
141
|
return (
|
|
136
142
|
<Wrapper {...aria}>
|
|
137
143
|
<E
|
|
138
|
-
ref={ref}
|
|
144
|
+
ref={mergeRefs(ref, elRef)}
|
|
139
145
|
data-dropdown-dismiss
|
|
140
146
|
data-color={color}
|
|
141
147
|
className={classNames(
|
|
142
|
-
|
|
148
|
+
"fabric-menuItem cursor-pointer",
|
|
143
149
|
className,
|
|
144
|
-
active &&
|
|
145
|
-
minimal &&
|
|
146
|
-
disabled &&
|
|
150
|
+
active && "active",
|
|
151
|
+
minimal && "minimal",
|
|
152
|
+
disabled && "disabled",
|
|
147
153
|
"rounded-capped relative max-w-[50vw] my-0.5",
|
|
148
154
|
)}
|
|
149
155
|
data-active={active}
|
|
150
156
|
data-open={childOpen}
|
|
151
157
|
disabled={disabled}
|
|
152
158
|
data-id={id}
|
|
159
|
+
tabIndex={tabIndex}
|
|
153
160
|
onClick={(e) => {
|
|
154
161
|
onClick?.(e) !== false && tree?.events.emit("click");
|
|
155
162
|
}}
|
|
156
163
|
{...(minimal ? {} : aria)}
|
|
157
164
|
>
|
|
165
|
+
{hotKey && (
|
|
166
|
+
<HotKey keyCombo={hotKey} handler={() => elRef.current?.click?.()} />
|
|
167
|
+
)}
|
|
158
168
|
{menuLabel}
|
|
159
169
|
</E>
|
|
160
170
|
</Wrapper>
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
type BadgeType,
|
|
28
28
|
type CallbackReturn,
|
|
29
29
|
type ChildrenProp,
|
|
30
|
-
type
|
|
30
|
+
type ColorState,
|
|
31
31
|
type CssProp,
|
|
32
32
|
type IconProps,
|
|
33
33
|
type TestProps,
|
|
@@ -53,7 +53,7 @@ export interface MenuItemProps
|
|
|
53
53
|
/**
|
|
54
54
|
* menu color
|
|
55
55
|
*/
|
|
56
|
-
color?:
|
|
56
|
+
color?: ColorState;
|
|
57
57
|
/**
|
|
58
58
|
* item active
|
|
59
59
|
*/
|
|
@@ -90,6 +90,7 @@ export interface MenuRootProps extends CssProp {
|
|
|
90
90
|
export interface MenuInnerProps extends MenuItemProps {
|
|
91
91
|
label: string;
|
|
92
92
|
minimal?: never;
|
|
93
|
+
trigger?: "hover" | "click";
|
|
93
94
|
/**
|
|
94
95
|
* floating menu className
|
|
95
96
|
*/
|
|
@@ -25,7 +25,6 @@ import { Format } from "@react-fabric/utilities";
|
|
|
25
25
|
import classNames from "classnames";
|
|
26
26
|
import { useMemoDebugger } from "../../hooks/useEffectDebugger";
|
|
27
27
|
import { type AriaProps, type CssProp, type TestProps } from "../../types";
|
|
28
|
-
import classes from "./Meter.module.css";
|
|
29
28
|
|
|
30
29
|
export interface MeterProps extends CssProp, AriaProps, TestProps {
|
|
31
30
|
/**
|
|
@@ -51,7 +50,7 @@ export const Meter = ({ value, hideLabel, className, ...aria }: MeterProps) => {
|
|
|
51
50
|
return (
|
|
52
51
|
<div
|
|
53
52
|
className={classNames(
|
|
54
|
-
|
|
53
|
+
"fabric-meter",
|
|
55
54
|
className,
|
|
56
55
|
"flex flex-nowrap items-center gap-[2px]",
|
|
57
56
|
)}
|
|
@@ -61,7 +60,7 @@ export const Meter = ({ value, hideLabel, className, ...aria }: MeterProps) => {
|
|
|
61
60
|
<div
|
|
62
61
|
key={step}
|
|
63
62
|
className={classNames(
|
|
64
|
-
|
|
63
|
+
"fabric-meterBar",
|
|
65
64
|
"first-of-type:rounded-s last-of-type:rounded-e bg-tint-100 relative outline -outline-offset-1 outline-muted overflow-hidden after:absolute after:inset-0",
|
|
66
65
|
)}
|
|
67
66
|
data-active={activeCount >= step}
|
|
@@ -22,21 +22,32 @@
|
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
24
|
import classNames from "classnames";
|
|
25
|
+
import { useCallback } from "react";
|
|
25
26
|
import { HotKey } from "../../hotkeys/HotKey";
|
|
26
27
|
import {
|
|
27
28
|
type AriaProps,
|
|
29
|
+
type ChildProp,
|
|
28
30
|
type ColorType,
|
|
29
31
|
type CssProp,
|
|
32
|
+
type PaletteType,
|
|
30
33
|
type TestProps,
|
|
31
34
|
} from "../../types";
|
|
32
35
|
import { CoreIcons } from "../../types/icons";
|
|
33
36
|
import { Icon } from "../icon/Icon";
|
|
37
|
+
import { isEmpty } from "@react-fabric/utilities";
|
|
34
38
|
|
|
35
|
-
export interface NavigatorProps
|
|
39
|
+
export interface NavigatorProps
|
|
40
|
+
extends CssProp,
|
|
41
|
+
AriaProps,
|
|
42
|
+
TestProps,
|
|
43
|
+
Partial<ChildProp> {
|
|
44
|
+
length?: number;
|
|
45
|
+
current?: number;
|
|
46
|
+
disableKeyHandlers?: boolean;
|
|
36
47
|
/**
|
|
37
48
|
* navigator button color
|
|
38
49
|
*/
|
|
39
|
-
color?: ColorType | string;
|
|
50
|
+
color?: ColorType | PaletteType | string;
|
|
40
51
|
/**
|
|
41
52
|
* navigation handler
|
|
42
53
|
*/
|
|
@@ -47,30 +58,48 @@ export const Navigator = ({
|
|
|
47
58
|
className,
|
|
48
59
|
onNavigate,
|
|
49
60
|
color,
|
|
61
|
+
children,
|
|
62
|
+
length,
|
|
63
|
+
current,
|
|
64
|
+
disableKeyHandlers,
|
|
50
65
|
...aria
|
|
51
66
|
}: NavigatorProps) => {
|
|
67
|
+
const navPrev = useCallback(
|
|
68
|
+
() => (isEmpty(current) || current !== 0) && onNavigate(-1),
|
|
69
|
+
[onNavigate, current],
|
|
70
|
+
);
|
|
71
|
+
const navNext = useCallback(
|
|
72
|
+
() => (isEmpty(current) || current + 1 < (length ?? 0)) && onNavigate(+1),
|
|
73
|
+
[onNavigate, current, length],
|
|
74
|
+
);
|
|
52
75
|
return (
|
|
53
76
|
<div
|
|
54
|
-
|
|
77
|
+
data-ref="navigator"
|
|
78
|
+
className={classNames(className, "inline-flex items-center leading-none")}
|
|
55
79
|
{...aria}
|
|
56
80
|
>
|
|
57
|
-
<HotKey keyCombo="left" handler={
|
|
58
|
-
<HotKey keyCombo="right" handler={
|
|
81
|
+
{!disableKeyHandlers && <HotKey keyCombo="left" handler={navPrev} />}
|
|
82
|
+
{!disableKeyHandlers && <HotKey keyCombo="right" handler={navNext} />}
|
|
59
83
|
<Icon
|
|
60
84
|
rtlFlip
|
|
61
85
|
color={color}
|
|
62
86
|
className="text-[1em] p-1"
|
|
63
87
|
aria-label="previous"
|
|
88
|
+
data-ref="previous"
|
|
64
89
|
icon={CoreIcons.chevronLeft}
|
|
65
|
-
|
|
90
|
+
disabled={!isEmpty(current) && current === 0}
|
|
91
|
+
onClick={(e) => [e.stopPropagation(), navPrev()]}
|
|
66
92
|
/>
|
|
93
|
+
{children}
|
|
67
94
|
<Icon
|
|
68
95
|
rtlFlip
|
|
69
96
|
className="text-[1em] p-1"
|
|
70
97
|
color={color}
|
|
71
98
|
aria-label="next"
|
|
99
|
+
data-ref="next"
|
|
72
100
|
icon={CoreIcons.chevronRight}
|
|
73
|
-
|
|
101
|
+
disabled={!isEmpty(current) && current + 1 === length}
|
|
102
|
+
onClick={(e) => [e.stopPropagation(), navNext()]}
|
|
74
103
|
/>
|
|
75
104
|
</div>
|
|
76
105
|
);
|
|
@@ -38,7 +38,6 @@ import {
|
|
|
38
38
|
import { CoreIcons } from "../../types/icons";
|
|
39
39
|
import { Loading } from "../animations/Animations";
|
|
40
40
|
import { Icon } from "../icon/Icon";
|
|
41
|
-
import classes from "./Panel.module.css";
|
|
42
41
|
|
|
43
42
|
export interface PanelProps
|
|
44
43
|
extends CssProp,
|
|
@@ -146,7 +145,7 @@ export const Panel = ({
|
|
|
146
145
|
return (
|
|
147
146
|
<div
|
|
148
147
|
className={classNames(
|
|
149
|
-
|
|
148
|
+
"fabric-panel",
|
|
150
149
|
className,
|
|
151
150
|
"rounded-capped overflow-hidden outline grid",
|
|
152
151
|
expanded ? "fixed inset-4 z-50" : "relative",
|
|
@@ -172,16 +171,17 @@ export const Panel = ({
|
|
|
172
171
|
<header
|
|
173
172
|
role="none"
|
|
174
173
|
className={classNames(
|
|
175
|
-
|
|
174
|
+
"fabric-panelHeader",
|
|
176
175
|
headerClassName,
|
|
177
176
|
"flex flex-nowrap items-center area-head",
|
|
178
177
|
)}
|
|
178
|
+
data-ref="panelHeader"
|
|
179
179
|
onClick={collapsable ? toggleCollapse : undefined}
|
|
180
180
|
>
|
|
181
181
|
{onBack && (
|
|
182
182
|
<Icon
|
|
183
183
|
data-ref="panelBack"
|
|
184
|
-
className={classNames(
|
|
184
|
+
className={classNames("fabric-panelAction", "cursor-pointer")}
|
|
185
185
|
icon={CoreIcons.chevronLeft}
|
|
186
186
|
onClick={onBack}
|
|
187
187
|
/>
|
|
@@ -204,7 +204,7 @@ export const Panel = ({
|
|
|
204
204
|
>
|
|
205
205
|
{title}
|
|
206
206
|
</div>
|
|
207
|
-
<div className="px-1">{actions}</div>
|
|
207
|
+
<div className="px-1 leading-none">{actions}</div>
|
|
208
208
|
{hasTools && (
|
|
209
209
|
<div
|
|
210
210
|
role="none"
|
|
@@ -214,7 +214,7 @@ export const Panel = ({
|
|
|
214
214
|
{expandable && (
|
|
215
215
|
<Icon
|
|
216
216
|
data-ref="panelExpand"
|
|
217
|
-
className={classNames(
|
|
217
|
+
className={classNames("fabric-panelAction", "cursor-pointer")}
|
|
218
218
|
icon={expanded ? CoreIcons.minimize : CoreIcons.maximize}
|
|
219
219
|
onClick={toggleExpand}
|
|
220
220
|
/>
|
|
@@ -222,7 +222,7 @@ export const Panel = ({
|
|
|
222
222
|
{!expanded && collapsable && (
|
|
223
223
|
<Icon
|
|
224
224
|
data-ref="panelCollapse"
|
|
225
|
-
className={classNames(
|
|
225
|
+
className={classNames("fabric-panelAction", "cursor-pointer")}
|
|
226
226
|
icon={collapsed ? CoreIcons.expand : CoreIcons.collapse}
|
|
227
227
|
onClick={toggleCollapse}
|
|
228
228
|
/>
|
|
@@ -230,7 +230,7 @@ export const Panel = ({
|
|
|
230
230
|
{!expanded && onClose && (
|
|
231
231
|
<Icon
|
|
232
232
|
data-ref="panelClose"
|
|
233
|
-
className={classNames(
|
|
233
|
+
className={classNames("fabric-panelAction", "cursor-pointer")}
|
|
234
234
|
icon={CoreIcons.close}
|
|
235
235
|
onClick={onClose}
|
|
236
236
|
/>
|
|
@@ -240,8 +240,9 @@ export const Panel = ({
|
|
|
240
240
|
</header>
|
|
241
241
|
{(!collapsed || expanded) && (
|
|
242
242
|
<div
|
|
243
|
+
data-ref="panelBody"
|
|
243
244
|
className={classNames(
|
|
244
|
-
|
|
245
|
+
"fabric-panelBody",
|
|
245
246
|
"area-content grid overflow-hidden",
|
|
246
247
|
)}
|
|
247
248
|
>
|
|
@@ -28,7 +28,6 @@ import {
|
|
|
28
28
|
useMemoDebugger,
|
|
29
29
|
} from "../../hooks/useEffectDebugger";
|
|
30
30
|
import { type ChildrenProp } from "../../types";
|
|
31
|
-
import classes from "./Panel.module.css";
|
|
32
31
|
|
|
33
32
|
export interface PanelGroupProps extends ChildrenProp {
|
|
34
33
|
/**
|
|
@@ -81,7 +80,7 @@ export const PanelGroup = ({
|
|
|
81
80
|
<div
|
|
82
81
|
data-ref="panelGroup"
|
|
83
82
|
className={classNames(
|
|
84
|
-
|
|
83
|
+
"fabric-panelGroup",
|
|
85
84
|
"flex flex-col overflow-auto area-content p-px",
|
|
86
85
|
)}
|
|
87
86
|
>
|
|
@@ -24,13 +24,12 @@
|
|
|
24
24
|
import { Format } from "@react-fabric/utilities";
|
|
25
25
|
import classNames from "classnames";
|
|
26
26
|
import { useMemoDebugger } from "../../hooks/useEffectDebugger";
|
|
27
|
-
import { type ColorType } from "../../types";
|
|
28
|
-
import {
|
|
29
|
-
import classes from "./Progress.module.css";
|
|
27
|
+
import { type PaletteType, type ColorType } from "../../types";
|
|
28
|
+
import { getColor } from "../../utils";
|
|
30
29
|
|
|
31
30
|
export interface ProgressProps {
|
|
32
31
|
/**
|
|
33
|
-
* progress value (0-
|
|
32
|
+
* progress value (0-1)
|
|
34
33
|
*/
|
|
35
34
|
value: number;
|
|
36
35
|
/**
|
|
@@ -40,7 +39,7 @@ export interface ProgressProps {
|
|
|
40
39
|
/**
|
|
41
40
|
* color
|
|
42
41
|
*/
|
|
43
|
-
color?: ColorType;
|
|
42
|
+
color?: ColorType | PaletteType;
|
|
44
43
|
/**
|
|
45
44
|
* animate
|
|
46
45
|
*/
|
|
@@ -64,20 +63,20 @@ const SizeMap: KeyValue = {
|
|
|
64
63
|
export const ProgressBar = ({
|
|
65
64
|
value = 0,
|
|
66
65
|
size,
|
|
67
|
-
color = "primary",
|
|
66
|
+
color = "primary-500",
|
|
68
67
|
label = "",
|
|
69
68
|
animate,
|
|
70
69
|
}: ProgressProps) => {
|
|
71
70
|
/** ***************** make sure value is between 0 and 100 *******************/
|
|
72
71
|
const actualValue = useMemoDebugger(
|
|
73
|
-
() => Math.min(Math.max(value, 0),
|
|
72
|
+
() => Math.min(Math.max(value, 0), 1),
|
|
74
73
|
[value],
|
|
75
74
|
"ProgressBar value",
|
|
76
75
|
);
|
|
77
76
|
|
|
78
77
|
const progressVar = useMemoDebugger<KeyValue>(
|
|
79
78
|
() => ({
|
|
80
|
-
"--progress": actualValue,
|
|
79
|
+
"--progress": actualValue * 100,
|
|
81
80
|
}),
|
|
82
81
|
[actualValue],
|
|
83
82
|
"ProgressBar cssVar",
|
|
@@ -87,12 +86,12 @@ export const ProgressBar = ({
|
|
|
87
86
|
return (
|
|
88
87
|
<div
|
|
89
88
|
className={classNames(
|
|
90
|
-
|
|
91
|
-
getColorClass(color),
|
|
89
|
+
"fabric-progressbar",
|
|
92
90
|
"block bg-dimmed relative rounded font-bold overflow-hidden whitespace-nowrap",
|
|
93
91
|
)}
|
|
94
92
|
style={{
|
|
95
93
|
...progressVar,
|
|
94
|
+
color: getColor(color),
|
|
96
95
|
minHeight: SizeMap[size ?? ""],
|
|
97
96
|
fontSize: SizeMap[size ?? ""],
|
|
98
97
|
}}
|
|
@@ -101,20 +100,20 @@ export const ProgressBar = ({
|
|
|
101
100
|
>
|
|
102
101
|
{!["xxs", "xs", "sm"].includes(size ?? "") && (
|
|
103
102
|
<div className="absolute inset-0 text-center z-0 align-top">
|
|
104
|
-
{label} {Format.percent(actualValue
|
|
103
|
+
{label} {Format.percent(actualValue)}
|
|
105
104
|
</div>
|
|
106
105
|
)}
|
|
107
106
|
<div
|
|
108
107
|
className={classNames(
|
|
109
|
-
|
|
110
|
-
animate &&
|
|
108
|
+
"fabric-progressTrack",
|
|
109
|
+
animate && "fabric-progressAnimate",
|
|
111
110
|
"h-full overflow-clip bg-current relative z-0",
|
|
112
111
|
)}
|
|
113
112
|
/>
|
|
114
113
|
{!["xxs", "xs", "sm"].includes(size ?? "") && (
|
|
115
114
|
<div
|
|
116
115
|
className={classNames("h-full absolute inset-0 overflow-hidden z-1")}
|
|
117
|
-
data-label={`${label} ${Format.percent(actualValue
|
|
116
|
+
data-label={`${label} ${Format.percent(actualValue)}`}
|
|
118
117
|
/>
|
|
119
118
|
)}
|
|
120
119
|
</div>
|
|
@@ -24,12 +24,12 @@
|
|
|
24
24
|
import { Format } from "@react-fabric/utilities";
|
|
25
25
|
import classNames from "classnames";
|
|
26
26
|
import { useMemoDebugger } from "../../hooks/useEffectDebugger";
|
|
27
|
-
import { type ColorType } from "../../types";
|
|
28
|
-
import {
|
|
27
|
+
import { type PaletteType, type ColorType } from "../../types";
|
|
28
|
+
import { getColor } from "../../utils";
|
|
29
29
|
|
|
30
30
|
export interface ProgressProps {
|
|
31
31
|
/**
|
|
32
|
-
* progress value (0-
|
|
32
|
+
* progress value (0-1)
|
|
33
33
|
*/
|
|
34
34
|
value: number;
|
|
35
35
|
/**
|
|
@@ -39,7 +39,7 @@ export interface ProgressProps {
|
|
|
39
39
|
/**
|
|
40
40
|
* color
|
|
41
41
|
*/
|
|
42
|
-
color?: ColorType;
|
|
42
|
+
color?: ColorType | PaletteType;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
const SizeMap: KeyValue = {
|
|
@@ -53,11 +53,11 @@ const SizeMap: KeyValue = {
|
|
|
53
53
|
export const ProgressCircle = ({
|
|
54
54
|
value = 0,
|
|
55
55
|
size = "sm",
|
|
56
|
-
color = "primary",
|
|
56
|
+
color = "primary-500",
|
|
57
57
|
}: ProgressProps) => {
|
|
58
58
|
/** ***************** make sure value is between 0 and 100 *******************/
|
|
59
59
|
const actualValue = useMemoDebugger(
|
|
60
|
-
() => Math.min(Math.max(value, 0),
|
|
60
|
+
() => Math.min(Math.max(value, 0), 1),
|
|
61
61
|
[value],
|
|
62
62
|
"ProgressCirle value",
|
|
63
63
|
);
|
|
@@ -66,7 +66,7 @@ export const ProgressCircle = ({
|
|
|
66
66
|
const strokeDashoffset = useMemoDebugger(
|
|
67
67
|
() => {
|
|
68
68
|
const circumfrence = Math.PI * 2 * 44;
|
|
69
|
-
return circumfrence * (1 - actualValue
|
|
69
|
+
return circumfrence * (1 - actualValue);
|
|
70
70
|
},
|
|
71
71
|
[actualValue],
|
|
72
72
|
"ProgressCirle dashOffset",
|
|
@@ -75,12 +75,9 @@ export const ProgressCircle = ({
|
|
|
75
75
|
/** ***************** component *******************/
|
|
76
76
|
return (
|
|
77
77
|
<div
|
|
78
|
-
className={classNames(
|
|
79
|
-
"inline-block w-[4em] h-[4em] text-lg relative",
|
|
80
|
-
getColorClass(color),
|
|
81
|
-
)}
|
|
78
|
+
className={classNames("inline-block w-[4em] h-[4em] text-lg relative")}
|
|
82
79
|
aria-hidden="true"
|
|
83
|
-
style={{ fontSize: SizeMap[size] }}
|
|
80
|
+
style={{ fontSize: SizeMap[size], color: getColor(color) }}
|
|
84
81
|
>
|
|
85
82
|
<svg
|
|
86
83
|
viewBox="0 0 100 100"
|
|
@@ -111,7 +108,7 @@ export const ProgressCircle = ({
|
|
|
111
108
|
/>
|
|
112
109
|
</svg>
|
|
113
110
|
<span className="flex w-full h-full items-center justify-center select-none font-bold text-[0.625em]">
|
|
114
|
-
{Format.percent(actualValue
|
|
111
|
+
{Format.percent(actualValue)}
|
|
115
112
|
</span>
|
|
116
113
|
</div>
|
|
117
114
|
);
|