@react-fabric/core 1.0.0-beta.5 → 1.0.0-beta.52
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} +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/{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 +26 -8
- package/dist/cjs/components/animations/Animations.js +118 -24
- package/dist/cjs/components/avatar/Avatar.js +43 -16
- package/dist/cjs/components/avatar/AvatarGroup.js +22 -4
- package/dist/cjs/components/badge/Badge.js +35 -6
- package/dist/cjs/components/breadcrumbs/Breadcrumbs.js +39 -8
- package/dist/cjs/components/button/Button.js +42 -15
- package/dist/cjs/components/button/ButtonGroup.js +30 -3
- package/dist/cjs/components/button/ConfirmButton.js +32 -4
- 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 +48 -10
- 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 +32 -7
- package/dist/cjs/components/collapsable/Collapsable.js +32 -6
- 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 +4 -3
- package/dist/cjs/components/empty/EmptyContent.js +35 -5
- package/dist/cjs/components/icon/Icon.js +44 -16
- package/dist/cjs/components/media/Media.js +172 -75
- package/dist/cjs/components/menu/ContextMenu.js +49 -10
- package/dist/cjs/components/menu/Menu.js +74 -21
- package/dist/cjs/components/menu/MenuItem.js +51 -16
- package/dist/cjs/components/meter/Meter.js +26 -3
- package/dist/cjs/components/navigator/Navigator.js +48 -13
- package/dist/cjs/components/panel/Panel.js +47 -9
- package/dist/cjs/components/panel/PanelGroup.js +25 -2
- package/dist/cjs/components/panel/PanelStack.js +31 -0
- 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 +89 -38
- package/dist/cjs/components/tabpanel/TabPanel.js +53 -16
- package/dist/cjs/context/Global.js +28 -1
- package/dist/cjs/context/NotificationCenter.js +3 -3
- package/dist/cjs/core/aside/Aside.js +49 -11
- package/dist/cjs/core/boundary/ErrorBoundary.js +23 -8
- package/dist/cjs/core/boundary/ErrorIcon.js +1 -2
- package/dist/cjs/core/content/Content.js +15 -8
- package/dist/cjs/core/headfoot/HeadFoot.js +44 -20
- package/dist/cjs/core/page/Page.js +40 -29
- package/dist/cjs/core/responsive/Responsive.js +59 -6
- package/dist/cjs/core/section/Section.js +1 -2
- 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/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 +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 +10 -1
- package/dist/cjs/typography/Abbr.js +32 -6
- package/dist/cjs/typography/{Link.js → Anchor.js} +23 -5
- package/dist/cjs/typography/Mark.js +22 -4
- 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 +119 -25
- package/dist/esm/components/avatar/Avatar.js +44 -17
- package/dist/esm/components/avatar/AvatarGroup.js +22 -4
- package/dist/esm/components/badge/Badge.js +36 -7
- package/dist/esm/components/breadcrumbs/Breadcrumbs.js +39 -8
- package/dist/esm/components/button/Button.js +42 -15
- package/dist/esm/components/button/ButtonGroup.js +31 -4
- package/dist/esm/components/button/ConfirmButton.js +32 -4
- 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 +49 -11
- 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 +33 -8
- package/dist/esm/components/collapsable/Collapsable.js +32 -6
- 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 +4 -3
- package/dist/esm/components/empty/EmptyContent.js +35 -5
- package/dist/esm/components/icon/Icon.js +44 -16
- package/dist/esm/components/media/Media.js +173 -76
- package/dist/esm/components/menu/ContextMenu.js +51 -12
- package/dist/esm/components/menu/Menu.js +76 -23
- package/dist/esm/components/menu/MenuItem.js +45 -10
- package/dist/esm/components/meter/Meter.js +26 -3
- package/dist/esm/components/navigator/Navigator.js +48 -13
- package/dist/esm/components/panel/Panel.js +47 -9
- package/dist/esm/components/panel/PanelGroup.js +25 -2
- package/dist/esm/components/panel/PanelStack.js +31 -0
- 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 +90 -39
- package/dist/esm/components/tabpanel/TabPanel.js +53 -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 -11
- package/dist/esm/core/boundary/ErrorBoundary.js +23 -8
- package/dist/esm/core/boundary/ErrorIcon.js +1 -2
- package/dist/esm/core/content/Content.js +15 -8
- package/dist/esm/core/headfoot/HeadFoot.js +44 -20
- package/dist/esm/core/page/Page.js +40 -29
- package/dist/esm/core/responsive/Responsive.js +59 -6
- package/dist/esm/core/section/Section.js +1 -2
- 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/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 +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 +10 -1
- package/dist/esm/typography/Abbr.js +32 -6
- package/dist/esm/typography/{Link.js → Anchor.js} +24 -6
- package/dist/esm/typography/Mark.js +22 -4
- 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 +23 -4
- package/dist/types/components/animations/Animations.d.ts +84 -5
- package/dist/types/components/avatar/Avatar.d.ts +29 -5
- package/dist/types/components/avatar/AvatarGroup.d.ts +19 -1
- package/dist/types/components/badge/Badge.d.ts +30 -1
- package/dist/types/components/breadcrumbs/Breadcrumbs.d.ts +31 -2
- package/dist/types/components/button/Button.d.ts +29 -6
- package/dist/types/components/button/ButtonGroup.d.ts +28 -3
- package/dist/types/components/button/ConfirmButton.d.ts +28 -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 +42 -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 +24 -4
- package/dist/types/components/collapsable/Collapsable.d.ts +33 -3
- 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 +27 -1
- package/dist/types/components/empty/EmptyContent.d.ts +32 -3
- package/dist/types/components/icon/Icon.d.ts +32 -6
- package/dist/types/components/index.d.ts +2 -1
- package/dist/types/components/media/Media.d.ts +56 -2
- package/dist/types/components/menu/ContextMenu.d.ts +21 -2
- 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 +3 -2
- 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 +37 -1
- 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 +36 -5
- package/dist/types/components/tabpanel/TabPanel.d.ts +43 -1
- package/dist/types/context/Global.d.ts +24 -1
- package/dist/types/core/aside/Aside.d.ts +38 -1
- package/dist/types/core/boundary/ErrorBoundary.d.ts +18 -2
- package/dist/types/core/content/Content.d.ts +9 -3
- package/dist/types/core/headfoot/HeadFoot.d.ts +41 -9
- package/dist/types/core/page/Page.d.ts +29 -4
- package/dist/types/core/responsive/Responsive.d.ts +58 -3
- package/dist/types/core/section/Section.d.ts +16 -1
- 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/useStorage.d.ts +38 -0
- 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 +10 -1
- package/dist/types/types/index.d.ts +26 -6
- 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 +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 +38 -11
- package/src/components/animations/Animations.tsx +118 -33
- package/src/components/avatar/Avatar.tsx +106 -91
- package/src/components/avatar/AvatarGroup.tsx +23 -5
- package/src/components/badge/Badge.tsx +41 -9
- package/src/components/breadcrumbs/Breadcrumbs.tsx +42 -9
- package/src/components/button/Button.tsx +50 -23
- package/src/components/button/ButtonGroup.tsx +33 -7
- package/src/components/button/ConfirmButton.tsx +41 -7
- package/src/components/button/ToggleButtonGroup.tsx +74 -47
- package/src/components/callout/Callout.tsx +55 -12
- package/src/components/card/Card.tsx +64 -15
- package/src/components/card/CardCover.tsx +36 -6
- package/src/components/card/FlipContent.tsx +90 -0
- package/src/components/chip/Chip.tsx +39 -13
- package/src/components/collapsable/Collapsable.tsx +38 -7
- package/src/components/divider/Divider.tsx +42 -16
- package/src/components/dropdown/Dropdown.tsx +46 -11
- package/src/components/dropdown/DropdownTool.tsx +30 -3
- package/src/components/empty/EmptyContent.tsx +47 -6
- package/src/components/icon/Icon.tsx +85 -68
- package/src/components/index.ts +2 -1
- package/src/components/media/Media.tsx +195 -106
- package/src/components/menu/ContextMenu.tsx +55 -11
- package/src/components/menu/Menu.tsx +85 -30
- package/src/components/menu/MenuItem.tsx +40 -9
- package/src/components/menu/types.ts +3 -2
- package/src/components/meter/Meter.tsx +26 -3
- package/src/components/navigator/Navigator.tsx +58 -7
- package/src/components/panel/Panel.tsx +47 -9
- package/src/components/panel/PanelGroup.tsx +25 -2
- package/src/components/panel/PanelStack.tsx +31 -0
- package/src/components/progress/ProgressBar.tsx +33 -14
- package/src/components/progress/ProgressCircle.tsx +29 -13
- package/src/components/tabpanel/Tab.tsx +112 -64
- package/src/components/tabpanel/TabPanel.tsx +67 -12
- package/src/context/Global.tsx +28 -1
- package/src/context/NotificationCenter.tsx +3 -3
- package/src/core/aside/Aside.tsx +50 -12
- package/src/core/boundary/ErrorBoundary.tsx +25 -8
- package/src/core/boundary/ErrorIcon.tsx +1 -2
- package/src/core/content/Content.tsx +23 -13
- package/src/core/headfoot/HeadFoot.tsx +42 -35
- package/src/core/page/Page.tsx +44 -6
- package/src/core/responsive/Responsive.tsx +66 -8
- package/src/core/section/Section.tsx +17 -3
- 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 +36 -6
- package/src/hooks/usePropToggle.ts +16 -5
- package/src/hooks/useResize.ts +19 -1
- package/src/hooks/useResizeObserver.ts +32 -9
- 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 +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 +18 -3
- package/src/types/index.ts +268 -27
- package/src/typography/Abbr.tsx +44 -11
- package/src/typography/{Link.tsx → Anchor.tsx} +26 -14
- package/src/typography/Copy.tsx +15 -0
- package/src/typography/Mark.tsx +24 -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
|
@@ -24,9 +24,10 @@
|
|
|
24
24
|
import classNames from "classnames";
|
|
25
25
|
import {
|
|
26
26
|
Children,
|
|
27
|
-
useMemo,
|
|
28
27
|
type DragEvent,
|
|
29
28
|
type MouseEventHandler,
|
|
29
|
+
useCallback,
|
|
30
|
+
useMemo,
|
|
30
31
|
} from "react";
|
|
31
32
|
import { ErrorBoundary } from "../../core/boundary/ErrorBoundary";
|
|
32
33
|
import { type ContentProps } from "../../core/content/Content";
|
|
@@ -39,15 +40,16 @@ import {
|
|
|
39
40
|
type AriaProps,
|
|
40
41
|
type ChildrenProp,
|
|
41
42
|
type CssProp,
|
|
43
|
+
type RefProp,
|
|
42
44
|
type TestProps,
|
|
43
45
|
} from "../../types";
|
|
44
46
|
import { nodeCheck } from "../../utils";
|
|
45
|
-
import classes from "./Card.module.css";
|
|
46
47
|
|
|
47
48
|
export interface CardProps
|
|
48
49
|
extends CssProp,
|
|
49
50
|
AriaProps,
|
|
50
51
|
TestProps,
|
|
52
|
+
RefProp<HTMLDivElement>,
|
|
51
53
|
ChildrenProp<React.ReactElement<HeadFootProps | ContentProps>> {
|
|
52
54
|
/**
|
|
53
55
|
* apply flex fill styling
|
|
@@ -57,6 +59,14 @@ export interface CardProps
|
|
|
57
59
|
* click handler
|
|
58
60
|
*/
|
|
59
61
|
onClick?: MouseEventHandler;
|
|
62
|
+
/**
|
|
63
|
+
* drag start handler
|
|
64
|
+
*/
|
|
65
|
+
onDragStart?: (
|
|
66
|
+
event: DragEvent,
|
|
67
|
+
dragKey: string,
|
|
68
|
+
dragData?: KeyValue,
|
|
69
|
+
) => void;
|
|
60
70
|
/**
|
|
61
71
|
* body css classname(s)
|
|
62
72
|
*/
|
|
@@ -83,6 +93,40 @@ export interface CardProps
|
|
|
83
93
|
dragData?: KeyValue;
|
|
84
94
|
}
|
|
85
95
|
|
|
96
|
+
/**
|
|
97
|
+
* A component that displays a card with a header, body, and footer. It can be used to display content in a structured format.
|
|
98
|
+
* It supports various features such as click handling, drag-and-drop functionality, and customizable styles.
|
|
99
|
+
* The Card component is designed to be flexible and can be used in various contexts, such as displaying user profiles, product information, or any other content that benefits from a card layout.
|
|
100
|
+
* The component accepts children that can include a Header, body content, and a Footer.
|
|
101
|
+
* It also supports additional properties for styling, accessibility, and interaction.
|
|
102
|
+
* It can be styled with custom CSS classes and supports features like selection indication and drag-and-drop functionality.
|
|
103
|
+
*
|
|
104
|
+
* @param {CardProps} props - The properties for the Card component.
|
|
105
|
+
* @returns {JSX.Element} The rendered Card component.
|
|
106
|
+
*
|
|
107
|
+
* @example
|
|
108
|
+
* ```jsx
|
|
109
|
+
* <Card
|
|
110
|
+
* className="my-custom-class"
|
|
111
|
+
* bodyClassName="my-body-class"
|
|
112
|
+
* selected={true}
|
|
113
|
+
* selectedRibbon={true}
|
|
114
|
+
* onClick={() => console.log("Card clicked")}
|
|
115
|
+
* onDragStart={(event, key, data) => console.log("Drag started", key, data)}
|
|
116
|
+
* flex={true}
|
|
117
|
+
* draggable={true}
|
|
118
|
+
* dragKey="my-drag-key"
|
|
119
|
+
* dragData={{ id: 1, name: "Card Data" }}
|
|
120
|
+
* aria-label="My Card"
|
|
121
|
+
* >
|
|
122
|
+
* <Header>Card Header</Header>
|
|
123
|
+
* <div>Card Body Content</div>
|
|
124
|
+
* <Footer>Card Footer</Footer>
|
|
125
|
+
* </Card>
|
|
126
|
+
* ```
|
|
127
|
+
*
|
|
128
|
+
* @see {@link https://adarshpastakia.github.io/react-fabric/?path=/docs/core-components-card--docs} for more details.
|
|
129
|
+
*/
|
|
86
130
|
export const Card = ({
|
|
87
131
|
children,
|
|
88
132
|
className,
|
|
@@ -90,10 +134,12 @@ export const Card = ({
|
|
|
90
134
|
selected,
|
|
91
135
|
selectedRibbon,
|
|
92
136
|
onClick,
|
|
137
|
+
onDragStart,
|
|
93
138
|
flex,
|
|
94
139
|
draggable,
|
|
95
140
|
dragKey,
|
|
96
141
|
dragData,
|
|
142
|
+
ref,
|
|
97
143
|
...aria
|
|
98
144
|
}: CardProps) => {
|
|
99
145
|
const [header, body, footer] = useMemo(() => {
|
|
@@ -110,38 +156,41 @@ export const Card = ({
|
|
|
110
156
|
);
|
|
111
157
|
}, [children]);
|
|
112
158
|
|
|
159
|
+
const handleDragStart = useCallback(
|
|
160
|
+
(event: DragEvent) => {
|
|
161
|
+
dragKey && event.dataTransfer?.setData(dragKey, JSON.stringify(dragData));
|
|
162
|
+
dragKey && onDragStart?.(event, dragKey, dragData);
|
|
163
|
+
},
|
|
164
|
+
[onDragStart, dragKey, dragData],
|
|
165
|
+
);
|
|
166
|
+
|
|
113
167
|
return (
|
|
114
168
|
<div
|
|
115
169
|
className={classNames(
|
|
116
|
-
|
|
170
|
+
"fabric-cardWrapper",
|
|
117
171
|
"rounded-capped relative grid",
|
|
118
172
|
flex && "flex-1",
|
|
119
|
-
selected && selectedRibbon &&
|
|
120
|
-
selected && "outline
|
|
173
|
+
selected && selectedRibbon && "selected",
|
|
174
|
+
selected && "outline-2 outline-accent-500 outline-offset-2",
|
|
121
175
|
)}
|
|
122
176
|
>
|
|
123
177
|
<ErrorBoundary>
|
|
124
178
|
<div
|
|
125
179
|
className={classNames(
|
|
126
|
-
|
|
180
|
+
"fabric-card",
|
|
127
181
|
className,
|
|
128
182
|
"rounded-capped flex flex-col flex-nowrap overflow-hidden",
|
|
129
|
-
onClick &&
|
|
183
|
+
onClick && "clickable",
|
|
130
184
|
)}
|
|
131
185
|
draggable={draggable}
|
|
132
|
-
onDragStart={
|
|
133
|
-
|
|
134
|
-
? undefined
|
|
135
|
-
: (e: DragEvent) =>
|
|
136
|
-
dragKey &&
|
|
137
|
-
e.dataTransfer?.setData(dragKey, JSON.stringify(dragData))
|
|
138
|
-
}
|
|
186
|
+
onDragStart={!draggable ? undefined : handleDragStart}
|
|
187
|
+
ref={ref}
|
|
139
188
|
{...aria}
|
|
140
189
|
>
|
|
141
190
|
{header}
|
|
142
191
|
<div
|
|
143
192
|
role="none"
|
|
144
|
-
className={classNames(
|
|
193
|
+
className={classNames("fabric-cardBody", bodyClassName, "flex-1")}
|
|
145
194
|
onClick={onClick}
|
|
146
195
|
>
|
|
147
196
|
{body}
|
|
@@ -26,7 +26,6 @@ import { Children, useMemo } from "react";
|
|
|
26
26
|
import { type AriaProps, type ChildrenProp, type CssProp } from "../../types";
|
|
27
27
|
import { nodeCheck } from "../../utils";
|
|
28
28
|
import { Image, Video } from "../media/Media";
|
|
29
|
-
import classes from "./Card.module.css";
|
|
30
29
|
|
|
31
30
|
export interface CardCoverProps extends CssProp, AriaProps, ChildrenProp {
|
|
32
31
|
/**
|
|
@@ -43,12 +42,44 @@ export interface CardCoverProps extends CssProp, AriaProps, ChildrenProp {
|
|
|
43
42
|
justify?: "start" | "center" | "end";
|
|
44
43
|
}
|
|
45
44
|
|
|
45
|
+
const scheme = {
|
|
46
|
+
inheritScheme: "inheritScheme",
|
|
47
|
+
light: "light",
|
|
48
|
+
dark: "dark",
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* A cover component for cards that can contain media and content.
|
|
53
|
+
* It allows for flexible layout options and supports different color schemes.
|
|
54
|
+
* It can be used to create visually appealing card layouts with media content.
|
|
55
|
+
*
|
|
56
|
+
* @param {CardCoverProps} props - The properties for the CardCover component.
|
|
57
|
+
* @returns {JSX.Element} The rendered CardCover component.
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```jsx
|
|
61
|
+
* <CardCover
|
|
62
|
+
* height={200}
|
|
63
|
+
* colorScheme="light"
|
|
64
|
+
* justify="center"
|
|
65
|
+
* className="my-custom-class"
|
|
66
|
+
* aria-label="Card Cover"
|
|
67
|
+
* >
|
|
68
|
+
* <Image src="image.jpg" alt="Card Image" />
|
|
69
|
+
* <div>Card Content</div>
|
|
70
|
+
* </CardCover>
|
|
71
|
+
* // Renders a card cover with a height of 200px, light color scheme, centered content, and a custom class name.
|
|
72
|
+
* ```
|
|
73
|
+
*
|
|
74
|
+
* @see {@link https://adarshpastakia.github.io/react-fabric/?path=/story/core-components-card--docs} for more details.
|
|
75
|
+
*/
|
|
46
76
|
export const CardCover = ({
|
|
47
77
|
className,
|
|
48
78
|
children,
|
|
49
79
|
height = 120,
|
|
50
80
|
justify = "end",
|
|
51
|
-
|
|
81
|
+
// @ts-expect-error ignore
|
|
82
|
+
colorScheme = "inheritScheme",
|
|
52
83
|
...aria
|
|
53
84
|
}: CardCoverProps) => {
|
|
54
85
|
const [media, body] = useMemo(() => {
|
|
@@ -64,8 +95,8 @@ export const CardCover = ({
|
|
|
64
95
|
<div
|
|
65
96
|
style={{ height }}
|
|
66
97
|
className={classNames(
|
|
67
|
-
|
|
68
|
-
|
|
98
|
+
"fabric-cardCover",
|
|
99
|
+
scheme[colorScheme],
|
|
69
100
|
"relative z-0",
|
|
70
101
|
)}
|
|
71
102
|
{...aria}
|
|
@@ -73,9 +104,8 @@ export const CardCover = ({
|
|
|
73
104
|
{media}
|
|
74
105
|
<div
|
|
75
106
|
className={classNames(
|
|
76
|
-
|
|
107
|
+
"fabric-cardCoverContent",
|
|
77
108
|
"relative pointer-events-none z-1 flex flex-col flex-nowrap p-4 h-full",
|
|
78
|
-
className,
|
|
79
109
|
`justify-${justify}`,
|
|
80
110
|
className,
|
|
81
111
|
)}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* React Fabric
|
|
3
|
+
* @version: 1.0.0
|
|
4
|
+
*
|
|
5
|
+
*
|
|
6
|
+
* The MIT License (MIT)
|
|
7
|
+
* Copyright (c) 2025 Adarsh Pastakia
|
|
8
|
+
*
|
|
9
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software
|
|
10
|
+
* and associated documentation files (the "Software"), to deal in the Software without restriction,
|
|
11
|
+
* including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
12
|
+
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
|
|
13
|
+
* subject to the following conditions:
|
|
14
|
+
*
|
|
15
|
+
* The above copyright notice and this permission notice shall be included in all copies or substantial
|
|
16
|
+
* portions of the Software.
|
|
17
|
+
*
|
|
18
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
|
|
19
|
+
* TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
20
|
+
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
21
|
+
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
import classNames from "classnames";
|
|
25
|
+
import {
|
|
26
|
+
Children,
|
|
27
|
+
cloneElement,
|
|
28
|
+
isValidElement,
|
|
29
|
+
useImperativeHandle,
|
|
30
|
+
useState,
|
|
31
|
+
} from "react";
|
|
32
|
+
import { type ChildrenProp, type CssProp, type RefProp } from "../../types";
|
|
33
|
+
|
|
34
|
+
export interface FlipContentRef {
|
|
35
|
+
flipCard: () => void;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface Props extends ChildrenProp, RefProp<FlipContentRef> {
|
|
39
|
+
//
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* A component that allows flipping between front and back content.
|
|
44
|
+
* It uses a ref to control the flipping action, which toggles the visibility of the front and back content.
|
|
45
|
+
* The component accepts children elements, which should be valid React elements representing the front and back content.
|
|
46
|
+
* The front content is expected to be the first child, and the back content is expected to be the second child.
|
|
47
|
+
* The component applies specific classes to the children based on their position (front or back) and manages the flipping state internally.
|
|
48
|
+
* The `flipCard` method can be called to toggle the visibility of the back content.
|
|
49
|
+
*
|
|
50
|
+
* @param {Props} props - The properties for the FlipContent component.
|
|
51
|
+
* @returns {JSX.Element} The rendered FlipContent component.
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```jsx
|
|
55
|
+
* <FlipContent ref={flipRef}>
|
|
56
|
+
* <div className="front">Front Content</div>
|
|
57
|
+
* <div className="back">Back Content</div>
|
|
58
|
+
* </FlipContent>
|
|
59
|
+
* ```
|
|
60
|
+
*
|
|
61
|
+
* @see {@link https://adarshpastakia.github.io/react-fabric/?path=/docs/core-components-flipcontent--docs}
|
|
62
|
+
*/
|
|
63
|
+
export const FlipContent = ({ ref, children }: Props) => {
|
|
64
|
+
const [showBack, setShowBack] = useState(false);
|
|
65
|
+
|
|
66
|
+
useImperativeHandle(
|
|
67
|
+
ref,
|
|
68
|
+
() => ({
|
|
69
|
+
flipCard: () => setShowBack(!showBack),
|
|
70
|
+
}),
|
|
71
|
+
[showBack],
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
return (
|
|
75
|
+
<div className="relative flex-1" data-card-flip={showBack}>
|
|
76
|
+
{Children.map(
|
|
77
|
+
children,
|
|
78
|
+
(child, idx) =>
|
|
79
|
+
isValidElement<CssProp>(child) &&
|
|
80
|
+
cloneElement(child, {
|
|
81
|
+
className: classNames(
|
|
82
|
+
child.props?.className ?? "",
|
|
83
|
+
idx === 0 ? "bg-base relative" : "bg-base absolute inset-0",
|
|
84
|
+
),
|
|
85
|
+
"data-card-flip-face": idx === 0 ? "front" : "back",
|
|
86
|
+
} as AnyObject),
|
|
87
|
+
)}
|
|
88
|
+
</div>
|
|
89
|
+
);
|
|
90
|
+
};
|
|
@@ -30,14 +30,14 @@ import {
|
|
|
30
30
|
type ColorType,
|
|
31
31
|
type CssProp,
|
|
32
32
|
type IconProps,
|
|
33
|
+
type PaletteType,
|
|
33
34
|
type PolymorphicProps,
|
|
34
35
|
type RefProp,
|
|
35
36
|
type SizeType,
|
|
36
37
|
type TestProps,
|
|
37
38
|
} from "../../types";
|
|
38
|
-
import { getColor
|
|
39
|
+
import { getColor } from "../../utils";
|
|
39
40
|
import { Icon } from "../icon/Icon";
|
|
40
|
-
import classes from "./Chip.module.css";
|
|
41
41
|
|
|
42
42
|
export interface ChipProps
|
|
43
43
|
extends CssProp,
|
|
@@ -49,11 +49,11 @@ export interface ChipProps
|
|
|
49
49
|
/**
|
|
50
50
|
* chip size
|
|
51
51
|
*/
|
|
52
|
-
size?: SizeType;
|
|
52
|
+
size?: SizeType | number | string;
|
|
53
53
|
/**
|
|
54
54
|
* chip color (CSS color / tailwind color)
|
|
55
55
|
*/
|
|
56
|
-
color?: ColorType | string;
|
|
56
|
+
color?: ColorType | PaletteType | string;
|
|
57
57
|
/**
|
|
58
58
|
* chip styling
|
|
59
59
|
*/
|
|
@@ -92,6 +92,26 @@ const SizeMap: KeyValue<string> = {
|
|
|
92
92
|
xl: "2rem",
|
|
93
93
|
};
|
|
94
94
|
|
|
95
|
+
/**
|
|
96
|
+
* A component that represents a small block of information, often used for tags, categories, or actions.
|
|
97
|
+
* It allows customization of size, color, variant, and includes optional icon and remove functionality.
|
|
98
|
+
* It supports various properties for styling and interaction, including click handlers and disabled state.
|
|
99
|
+
* It can be used in various contexts, such as filtering options, displaying tags, or representing user actions.
|
|
100
|
+
* It can be styled with custom CSS classes and supports features like rounded edges and click handling.
|
|
101
|
+
* It can also include an icon and a remove button, making it versatile for different use cases.
|
|
102
|
+
*
|
|
103
|
+
* @param {ChipProps} props - The properties for the Chip component.
|
|
104
|
+
* @returns {JSX.Element} The rendered Chip component.
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
* ```jsx
|
|
108
|
+
* <Chip color="primary" size="md" className="my-chip">
|
|
109
|
+
* Example Chip
|
|
110
|
+
* </Chip>
|
|
111
|
+
* ```
|
|
112
|
+
*
|
|
113
|
+
* @see {@link https://adarshpastakia.github.io/react-fabric/?path=/docs/core-components-chip--docs} for more details.
|
|
114
|
+
*/
|
|
95
115
|
export const Chip = <Tag extends React.ElementType = "div">({
|
|
96
116
|
ref,
|
|
97
117
|
children,
|
|
@@ -152,24 +172,25 @@ export const Chip = <Tag extends React.ElementType = "div">({
|
|
|
152
172
|
<E
|
|
153
173
|
ref={ref}
|
|
154
174
|
role="term"
|
|
175
|
+
data-ref="chip"
|
|
155
176
|
className={classNames(
|
|
156
|
-
|
|
177
|
+
"fabric-chip",
|
|
157
178
|
className,
|
|
158
|
-
|
|
159
|
-
"select-none inline-flex flex-nowrap items-center max-w-72 text-sm rounded",
|
|
179
|
+
"select-none inline-flex flex-nowrap items-center align-middle max-w-72 rounded",
|
|
160
180
|
rounded && "rounded-full",
|
|
161
|
-
!!onClick &&
|
|
162
|
-
disabled &&
|
|
181
|
+
!!onClick && "clickable",
|
|
182
|
+
disabled && "disabled",
|
|
163
183
|
)}
|
|
164
184
|
style={styles}
|
|
165
185
|
data-variant={variant}
|
|
166
186
|
data-inner-clickable={!!onClick}
|
|
167
|
-
{...{ onClick: clickHandler }}
|
|
187
|
+
{...{ onClick: disabled ? undefined : clickHandler }}
|
|
168
188
|
{...aria}
|
|
169
189
|
>
|
|
170
190
|
{icon && (
|
|
171
191
|
<Icon
|
|
172
|
-
|
|
192
|
+
data-ref="chipIcon"
|
|
193
|
+
className={classNames("fabric-chipIcon", "m-1 flex-auto")}
|
|
173
194
|
icon={icon}
|
|
174
195
|
bg={iconBg}
|
|
175
196
|
onClick={onIconClick}
|
|
@@ -178,15 +199,20 @@ export const Chip = <Tag extends React.ElementType = "div">({
|
|
|
178
199
|
/>
|
|
179
200
|
)}
|
|
180
201
|
{children && (
|
|
181
|
-
<label
|
|
202
|
+
<label
|
|
203
|
+
data-ref="chipLabel"
|
|
204
|
+
className={classNames("fabric-chipLabel", "truncate")}
|
|
205
|
+
>
|
|
182
206
|
{children}
|
|
183
207
|
</label>
|
|
184
208
|
)}
|
|
185
209
|
{onRemove && (
|
|
186
210
|
<span
|
|
187
211
|
role="none"
|
|
212
|
+
data-ref="chipRemove"
|
|
213
|
+
data-inner-cliackable
|
|
188
214
|
className={classNames(
|
|
189
|
-
|
|
215
|
+
"fabric-chipRemove",
|
|
190
216
|
"cursor-pointer pe-1 opacity-65 hover:opacity-90",
|
|
191
217
|
)}
|
|
192
218
|
onClick={removeHandler}
|
|
@@ -40,11 +40,10 @@ import {
|
|
|
40
40
|
} from "../../types";
|
|
41
41
|
import { CoreIcons } from "../../types/icons";
|
|
42
42
|
import { Icon } from "../icon/Icon";
|
|
43
|
-
import classes from "./Collapsable.module.css";
|
|
44
43
|
|
|
45
44
|
interface CollapsableRef {
|
|
46
|
-
button: RefObject<HTMLElement>;
|
|
47
|
-
body: RefObject<HTMLElement>;
|
|
45
|
+
button: RefObject<HTMLElement | null>;
|
|
46
|
+
body: RefObject<HTMLElement | null>;
|
|
48
47
|
open: boolean;
|
|
49
48
|
}
|
|
50
49
|
|
|
@@ -66,6 +65,10 @@ export interface CollapsableProps
|
|
|
66
65
|
* header button className
|
|
67
66
|
*/
|
|
68
67
|
headerClassName?: string;
|
|
68
|
+
/**
|
|
69
|
+
* Header position sticky
|
|
70
|
+
*/
|
|
71
|
+
stickyHeader?: boolean;
|
|
69
72
|
/**
|
|
70
73
|
* open state icon
|
|
71
74
|
*/
|
|
@@ -92,6 +95,32 @@ export interface CollapsableProps
|
|
|
92
95
|
onClose?: () => void;
|
|
93
96
|
}
|
|
94
97
|
|
|
98
|
+
/**
|
|
99
|
+
* A component that can be expanded or collapsed to show or hide content.
|
|
100
|
+
* It is useful for organizing content in a way that allows users to focus on the information they are interested in.
|
|
101
|
+
* It supports custom icons for open and closed states, alignment options, and can be made sticky.
|
|
102
|
+
* This component is ideal for creating accordions, expandable panels, or sections that can be toggled by the user.
|
|
103
|
+
*
|
|
104
|
+
* @param {CollapsableProps} props - The properties for the Collapsable component.
|
|
105
|
+
* @returns {JSX.Element} The rendered Collapsable component.
|
|
106
|
+
*
|
|
107
|
+
* @example
|
|
108
|
+
* ```jsx
|
|
109
|
+
* <Collapsable
|
|
110
|
+
* iconAlign="start"
|
|
111
|
+
* iconOpen={CoreIcons.chevronDown}
|
|
112
|
+
* iconClosed={CoreIcons.chevronRight}
|
|
113
|
+
* open={true}
|
|
114
|
+
* onOpen={() => console.log("Opened")}
|
|
115
|
+
* onClose={() => console.log("Closed")}
|
|
116
|
+
* >
|
|
117
|
+
* <div>Header Content</div>
|
|
118
|
+
* <div>Body Content</div>
|
|
119
|
+
* </Collapsable>
|
|
120
|
+
* ```
|
|
121
|
+
*
|
|
122
|
+
* @see {@link https://adarshpastakia.github.io/react-fabric/?path=/docs/core-components-collapsable--docs} for more details.
|
|
123
|
+
*/
|
|
95
124
|
export const Collapsable = ({
|
|
96
125
|
ref,
|
|
97
126
|
disabled,
|
|
@@ -100,6 +129,7 @@ export const Collapsable = ({
|
|
|
100
129
|
headerClassName,
|
|
101
130
|
children,
|
|
102
131
|
iconAlign,
|
|
132
|
+
stickyHeader,
|
|
103
133
|
iconClosed = CoreIcons.chevronRight,
|
|
104
134
|
iconOpen = CoreIcons.chevronDown,
|
|
105
135
|
open,
|
|
@@ -130,25 +160,26 @@ export const Collapsable = ({
|
|
|
130
160
|
return [h, b];
|
|
131
161
|
}, [children]);
|
|
132
162
|
return (
|
|
133
|
-
<div className={classNames(
|
|
163
|
+
<div className={classNames("fabric-collapsable", className)} {...aria}>
|
|
134
164
|
<div
|
|
135
165
|
role="none"
|
|
136
166
|
ref={headRef}
|
|
137
167
|
className={classNames(
|
|
138
|
-
|
|
168
|
+
"fabric-collapsableHead",
|
|
139
169
|
"flex gap-1 flex-nowrap py-2 font-medium cursor-pointer items-center select-none hover:opacity-70",
|
|
140
170
|
headerClassName,
|
|
171
|
+
stickyHeader && "bg-base sticky top-0 py-1 z-10",
|
|
141
172
|
iconAlign === "end" ? "flex-row-reverse" : "flex-row",
|
|
142
173
|
)}
|
|
143
174
|
onClick={() => !disabled && setOpenState(!openState)}
|
|
144
175
|
>
|
|
145
176
|
<Icon size="1.125em" icon={openState ? iconOpen : iconClosed} rtlFlip />
|
|
146
|
-
<div className="flex-1
|
|
177
|
+
<div className="flex-1">{head}</div>
|
|
147
178
|
</div>
|
|
148
179
|
{openState && (
|
|
149
180
|
<div
|
|
150
181
|
ref={bodyRef}
|
|
151
|
-
className={classNames(
|
|
182
|
+
className={classNames("fabric-collapsableBody", bodyClassName)}
|
|
152
183
|
>
|
|
153
184
|
{body}
|
|
154
185
|
</div>
|
|
@@ -24,37 +24,61 @@
|
|
|
24
24
|
import classNames from "classnames";
|
|
25
25
|
import { useCallback } from "react";
|
|
26
26
|
import {
|
|
27
|
-
type CssProp,
|
|
28
27
|
type ChildProp,
|
|
29
28
|
type ColorType,
|
|
29
|
+
type CssProp,
|
|
30
30
|
type PaletteType,
|
|
31
31
|
} from "../../types";
|
|
32
|
-
import {
|
|
32
|
+
import { getColor } from "../../utils";
|
|
33
33
|
|
|
34
34
|
export interface DividerProps extends CssProp, Partial<ChildProp> {
|
|
35
|
-
/**
|
|
36
|
-
* apply text bg
|
|
37
|
-
*/
|
|
38
|
-
fill?: boolean;
|
|
39
35
|
/**
|
|
40
36
|
* vertical rule
|
|
41
37
|
*/
|
|
42
38
|
vertical?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* divider label classname(s)
|
|
41
|
+
*/
|
|
42
|
+
labelClassName?: string;
|
|
43
43
|
/**
|
|
44
44
|
* rule color
|
|
45
45
|
*/
|
|
46
|
-
color?: ColorType | PaletteType |
|
|
46
|
+
color?: ColorType | PaletteType | string;
|
|
47
47
|
/**
|
|
48
48
|
* text alignment
|
|
49
49
|
*/
|
|
50
50
|
align?: "start" | "end" | "center";
|
|
51
|
+
/**
|
|
52
|
+
* divider style
|
|
53
|
+
*/
|
|
54
|
+
style?: "solid" | "dashed" | "dotted";
|
|
51
55
|
}
|
|
52
56
|
|
|
57
|
+
/**
|
|
58
|
+
* A component that represents a visual divider between content.
|
|
59
|
+
* It can be used to separate sections of content, with optional text labels.
|
|
60
|
+
* It supports both horizontal and vertical orientations, customizable colors,
|
|
61
|
+
* styles, and alignment options.
|
|
62
|
+
*
|
|
63
|
+
* @param {DividerProps} props - The properties for the Divider component.
|
|
64
|
+
* @returns {JSX.Element} The rendered Divider component.
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* ```jsx
|
|
68
|
+
* <Divider color="primary" align="center" style="dashed">
|
|
69
|
+
* Divider Text
|
|
70
|
+
* </Divider>
|
|
71
|
+
* // Renders a horizontal divider with primary color, centered text, and dashed style.
|
|
72
|
+
* ```
|
|
73
|
+
*
|
|
74
|
+
* @see {@link https://adarshpastakia.github.io/react-fabric/?path=/docs/core-components-divider--docs} for more details.
|
|
75
|
+
*/
|
|
53
76
|
export const Divider = ({
|
|
54
77
|
children,
|
|
55
|
-
color,
|
|
78
|
+
color = "tint-300",
|
|
56
79
|
vertical,
|
|
57
|
-
|
|
80
|
+
labelClassName,
|
|
81
|
+
style,
|
|
58
82
|
align = "start",
|
|
59
83
|
className,
|
|
60
84
|
}: DividerProps) => {
|
|
@@ -62,13 +86,14 @@ export const Divider = ({
|
|
|
62
86
|
({ flex, className }: KeyValue) => {
|
|
63
87
|
return (
|
|
64
88
|
<hr
|
|
65
|
-
style={{ flex }}
|
|
89
|
+
style={{ flex, borderColor: getColor(color), borderStyle: style }}
|
|
66
90
|
className={classNames(
|
|
67
91
|
className,
|
|
68
92
|
vertical && "vertical",
|
|
69
93
|
!flex && "self-stretch",
|
|
70
|
-
vertical
|
|
71
|
-
|
|
94
|
+
vertical
|
|
95
|
+
? "fabric-divider--vertical"
|
|
96
|
+
: "fabric-divider--horizontal",
|
|
72
97
|
)}
|
|
73
98
|
/>
|
|
74
99
|
);
|
|
@@ -79,7 +104,7 @@ export const Divider = ({
|
|
|
79
104
|
return children ? (
|
|
80
105
|
<div
|
|
81
106
|
className={classNames(
|
|
82
|
-
"flex flex-nowrap items-center",
|
|
107
|
+
"flex flex-nowrap items-center fabric-divider",
|
|
83
108
|
vertical && "flex-col",
|
|
84
109
|
className,
|
|
85
110
|
)}
|
|
@@ -88,9 +113,10 @@ export const Divider = ({
|
|
|
88
113
|
<div
|
|
89
114
|
className={classNames(
|
|
90
115
|
"px-2 whitespace-nowrap",
|
|
91
|
-
vertical
|
|
92
|
-
|
|
93
|
-
|
|
116
|
+
vertical
|
|
117
|
+
? "fabric-divider-label--vertical"
|
|
118
|
+
: "fabric-divider-label--horizontal",
|
|
119
|
+
labelClassName,
|
|
94
120
|
"rounded-full text-[0.75em]",
|
|
95
121
|
vertical && "origin-center -rotate-90 z-1",
|
|
96
122
|
)}
|