@react-fabric/core 1.0.0-beta.4 → 1.0.0-beta.40
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} +68 -78
- package/{src/components/card/Card.module.css → css/components/_card.css} +32 -28
- package/{src/components/chip/Chip.module.css → css/components/_chip.css} +15 -11
- package/{src/components/collapsable/Collapsable.module.css → css/components/_collapsable.css} +3 -3
- package/css/components/_divider.css +32 -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} +15 -16
- 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} +42 -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 +41 -223
- package/css/reset/_text.css +14 -29
- package/css/reset/_theme.css +315 -32
- 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 +44 -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 +7 -2
- package/dist/cjs/components/button/ToggleButtonGroup.js +3 -3
- package/dist/cjs/components/callout/Callout.js +15 -4
- package/dist/cjs/components/card/Card.js +8 -7
- package/dist/cjs/components/card/CardCover.js +10 -5
- package/dist/cjs/components/chip/Chip.js +11 -7
- package/dist/cjs/components/collapsable/Collapsable.js +5 -5
- package/dist/cjs/components/divider/Divider.js +10 -7
- package/dist/cjs/components/dropdown/Dropdown.js +5 -4
- package/dist/cjs/components/dropdown/DropdownTool.js +4 -3
- package/dist/cjs/components/icon/Icon.js +15 -14
- 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 +39 -20
- 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 +16 -9
- 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 +6 -5
- package/dist/cjs/components/progress/ProgressCircle.js +6 -4
- package/dist/cjs/components/tabpanel/Tab.js +58 -38
- package/dist/cjs/components/tabpanel/TabPanel.js +20 -16
- 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 +3 -3
- package/dist/cjs/core/responsive/Responsive.js +3 -4
- package/dist/cjs/core/section/Section.js +1 -2
- package/dist/cjs/core/theme/ThemeProvider.js +7 -8
- package/dist/cjs/core/viewport/Viewport.js +4 -2
- package/dist/cjs/hooks/useNavigator.js +6 -4
- package/dist/cjs/hotkeys/HotKeyLabel.js +1 -1
- package/dist/cjs/hotkeys/HotKeyWrapper.js +3 -1
- package/dist/cjs/index.js +6 -2
- package/dist/cjs/overlays/alert/Alert.js +19 -13
- package/dist/cjs/overlays/flyout/Flyout.js +42 -44
- package/dist/cjs/overlays/message/Message.js +6 -3
- package/dist/cjs/overlays/modal/Modal.js +9 -10
- package/dist/cjs/overlays/toast/Toast.js +17 -9
- package/dist/cjs/overlays/tooltip/Tooltip.js +20 -8
- package/dist/cjs/types/icons.js +4 -0
- package/dist/cjs/typography/Abbr.js +2 -3
- 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 +44 -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 +7 -2
- package/dist/esm/components/button/ToggleButtonGroup.js +4 -4
- package/dist/esm/components/callout/Callout.js +15 -4
- package/dist/esm/components/card/Card.js +8 -7
- package/dist/esm/components/card/CardCover.js +10 -5
- package/dist/esm/components/chip/Chip.js +12 -8
- package/dist/esm/components/collapsable/Collapsable.js +5 -5
- package/dist/esm/components/divider/Divider.js +11 -8
- package/dist/esm/components/dropdown/Dropdown.js +5 -4
- package/dist/esm/components/dropdown/DropdownTool.js +4 -3
- package/dist/esm/components/icon/Icon.js +15 -14
- 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 +41 -22
- 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 +16 -9
- 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 +6 -5
- package/dist/esm/components/progress/ProgressCircle.js +6 -4
- package/dist/esm/components/tabpanel/Tab.js +59 -39
- package/dist/esm/components/tabpanel/TabPanel.js +20 -16
- 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 +3 -3
- package/dist/esm/core/responsive/Responsive.js +3 -4
- package/dist/esm/core/section/Section.js +1 -2
- package/dist/esm/core/theme/ThemeProvider.js +7 -8
- package/dist/esm/core/viewport/Viewport.js +4 -2
- package/dist/esm/hooks/useNavigator.js +7 -5
- package/dist/esm/hotkeys/HotKeyLabel.js +1 -1
- package/dist/esm/hotkeys/HotKeyWrapper.js +3 -1
- package/dist/esm/index.js +3 -1
- package/dist/esm/overlays/alert/Alert.js +20 -14
- package/dist/esm/overlays/flyout/Flyout.js +43 -45
- package/dist/esm/overlays/message/Message.js +7 -4
- package/dist/esm/overlays/modal/Modal.js +10 -11
- package/dist/esm/overlays/toast/Toast.js +18 -10
- package/dist/esm/overlays/tooltip/Tooltip.js +20 -8
- package/dist/esm/types/icons.js +4 -0
- package/dist/esm/typography/Abbr.js +2 -3
- 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 +44 -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 +2 -2
- package/dist/types/components/card/Card.d.ts +3 -3
- package/dist/types/components/chip/Chip.d.ts +3 -3
- package/dist/types/components/collapsable/Collapsable.d.ts +5 -1
- package/dist/types/components/divider/Divider.d.ts +7 -3
- package/dist/types/components/dropdown/DropdownTool.d.ts +2 -1
- package/dist/types/components/icon/Icon.d.ts +3 -3
- 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 +2 -2
- package/dist/types/components/navigator/Navigator.d.ts +4 -4
- package/dist/types/components/progress/ProgressBar.d.ts +2 -2
- package/dist/types/components/progress/ProgressCircle.d.ts +2 -2
- package/dist/types/components/tabpanel/Tab.d.ts +5 -5
- package/dist/types/components/tabpanel/TabPanel.d.ts +10 -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/responsive/Responsive.d.ts +1 -1
- package/dist/types/core/theme/ThemeProvider.d.ts +4 -4
- package/dist/types/hooks/useOverlayService.d.ts +3 -5
- package/dist/types/index.d.ts +3 -0
- package/dist/types/overlays/alert/Alert.d.ts +2 -2
- package/dist/types/overlays/flyout/Flyout.d.ts +3 -2
- package/dist/types/overlays/message/Message.d.ts +2 -2
- package/dist/types/overlays/modal/Modal.d.ts +4 -3
- package/dist/types/overlays/toast/Toast.d.ts +2 -2
- package/dist/types/overlays/tooltip/Tooltip.d.ts +1 -1
- package/dist/types/types/icons.d.ts +4 -0
- package/dist/types/types/index.d.ts +18 -6
- package/dist/types/typography/Abbr.d.ts +6 -2
- package/dist/types/typography/Anchor.d.ts +25 -0
- package/dist/types/typography/Mark.d.ts +2 -2
- 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 +7 -9
- 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 +15 -5
- package/src/components/button/ToggleButtonGroup.tsx +5 -5
- package/src/components/callout/Callout.tsx +26 -11
- package/src/components/card/Card.tsx +10 -7
- package/src/components/card/CardCover.tsx +11 -6
- package/src/components/chip/Chip.tsx +17 -13
- package/src/components/collapsable/Collapsable.tsx +9 -4
- package/src/components/divider/Divider.tsx +15 -10
- package/src/components/dropdown/Dropdown.tsx +5 -5
- package/src/components/dropdown/DropdownTool.tsx +5 -3
- package/src/components/icon/Icon.tsx +55 -67
- package/src/components/media/Media.tsx +141 -106
- package/src/components/menu/ContextMenu.tsx +36 -11
- package/src/components/menu/Menu.tsx +51 -30
- package/src/components/menu/MenuItem.tsx +19 -9
- package/src/components/menu/types.ts +2 -2
- package/src/components/meter/Meter.tsx +2 -3
- package/src/components/navigator/Navigator.tsx +19 -5
- package/src/components/panel/Panel.tsx +10 -9
- package/src/components/panel/PanelGroup.tsx +1 -2
- package/src/components/progress/ProgressBar.tsx +8 -9
- package/src/components/progress/ProgressCircle.tsx +6 -9
- package/src/components/tabpanel/Tab.tsx +81 -64
- package/src/components/tabpanel/TabPanel.tsx +34 -12
- 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 +3 -3
- package/src/core/responsive/Responsive.tsx +8 -7
- package/src/core/section/Section.tsx +1 -2
- package/src/core/theme/ThemeProvider.tsx +11 -12
- package/src/core/viewport/Viewport.tsx +1 -2
- package/src/hooks/useNavigator.tsx +10 -5
- package/src/hooks/useOverlayService.tsx +12 -6
- 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 +25 -31
- package/src/overlays/flyout/Flyout.tsx +65 -64
- package/src/overlays/message/Message.tsx +10 -7
- package/src/overlays/modal/Modal.tsx +18 -13
- package/src/overlays/toast/Toast.tsx +18 -27
- package/src/overlays/tooltip/Tooltip.tsx +30 -9
- package/src/types/icons.ts +9 -0
- package/src/types/index.ts +240 -27
- package/src/typography/Abbr.tsx +15 -9
- 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/utils/cloneElement.ts +44 -0
- 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
- package/src/overlays/tooltip/Tooltip.module.css +0 -53
package/src/types/index.ts
CHANGED
|
@@ -25,11 +25,15 @@
|
|
|
25
25
|
import { type Placement } from "@floating-ui/react";
|
|
26
26
|
import { type JSXElementConstructor, type Ref } from "react";
|
|
27
27
|
|
|
28
|
+
export type ModalProps<P = unknown> = P & {
|
|
29
|
+
onClose: (...args: AnyObject) => void;
|
|
30
|
+
};
|
|
31
|
+
|
|
28
32
|
export type SizeType = "xs" | "sm" | "md" | "lg" | "xl";
|
|
29
33
|
|
|
30
34
|
export type SizeTypeWithZero = "xs" | "sm" | "md" | "lg" | "xl" | 0;
|
|
31
35
|
|
|
32
|
-
export type
|
|
36
|
+
export type ColorState =
|
|
33
37
|
| "primary"
|
|
34
38
|
| "accent"
|
|
35
39
|
| "info"
|
|
@@ -37,21 +41,229 @@ export type ColorType =
|
|
|
37
41
|
| "success"
|
|
38
42
|
| "warning";
|
|
39
43
|
|
|
44
|
+
export type ColorType =
|
|
45
|
+
| "primary-50"
|
|
46
|
+
| "accent-50"
|
|
47
|
+
| "info-50"
|
|
48
|
+
| "danger-50"
|
|
49
|
+
| "success-50"
|
|
50
|
+
| "warning-50"
|
|
51
|
+
| "primary-100"
|
|
52
|
+
| "accent-100"
|
|
53
|
+
| "info-100"
|
|
54
|
+
| "danger-100"
|
|
55
|
+
| "success-100"
|
|
56
|
+
| "warning-100"
|
|
57
|
+
| "primary-200"
|
|
58
|
+
| "accent-200"
|
|
59
|
+
| "info-200"
|
|
60
|
+
| "danger-200"
|
|
61
|
+
| "success-200"
|
|
62
|
+
| "warning-200"
|
|
63
|
+
| "primary-300"
|
|
64
|
+
| "accent-300"
|
|
65
|
+
| "info-300"
|
|
66
|
+
| "danger-300"
|
|
67
|
+
| "success-300"
|
|
68
|
+
| "warning-300"
|
|
69
|
+
| "primary-400"
|
|
70
|
+
| "accent-400"
|
|
71
|
+
| "info-400"
|
|
72
|
+
| "danger-400"
|
|
73
|
+
| "success-400"
|
|
74
|
+
| "warning-400"
|
|
75
|
+
| "primary-500"
|
|
76
|
+
| "accent-500"
|
|
77
|
+
| "info-500"
|
|
78
|
+
| "danger-500"
|
|
79
|
+
| "success-500"
|
|
80
|
+
| "warning-500"
|
|
81
|
+
| "primary-600"
|
|
82
|
+
| "accent-600"
|
|
83
|
+
| "info-600"
|
|
84
|
+
| "danger-600"
|
|
85
|
+
| "success-600"
|
|
86
|
+
| "warning-600"
|
|
87
|
+
| "primary-700"
|
|
88
|
+
| "accent-700"
|
|
89
|
+
| "info-700"
|
|
90
|
+
| "danger-700"
|
|
91
|
+
| "success-700"
|
|
92
|
+
| "warning-700"
|
|
93
|
+
| "primary-800"
|
|
94
|
+
| "accent-800"
|
|
95
|
+
| "info-800"
|
|
96
|
+
| "danger-800"
|
|
97
|
+
| "success-800"
|
|
98
|
+
| "warning-800"
|
|
99
|
+
| "primary-900"
|
|
100
|
+
| "accent-900"
|
|
101
|
+
| "info-900"
|
|
102
|
+
| "danger-900"
|
|
103
|
+
| "success-900"
|
|
104
|
+
| "warning-900"
|
|
105
|
+
| "primary-950"
|
|
106
|
+
| "accent-950"
|
|
107
|
+
| "info-950"
|
|
108
|
+
| "danger-950"
|
|
109
|
+
| "success-950"
|
|
110
|
+
| "warning-950";
|
|
111
|
+
|
|
40
112
|
export type PaletteType =
|
|
41
|
-
| "scarlet"
|
|
42
|
-
| "pumpkin"
|
|
43
|
-
| "marigold"
|
|
44
|
-
| "avacado"
|
|
45
|
-
| "jade"
|
|
46
|
-
| "denim"
|
|
47
|
-
| "iris"
|
|
48
|
-
| "lilac"
|
|
49
|
-
| "coral"
|
|
50
|
-
| "wood"
|
|
51
|
-
| "silver"
|
|
52
|
-
| "steel"
|
|
53
|
-
| "olive"
|
|
54
|
-
| "sand"
|
|
113
|
+
| "scarlet-50"
|
|
114
|
+
| "pumpkin-50"
|
|
115
|
+
| "marigold-50"
|
|
116
|
+
| "avacado-50"
|
|
117
|
+
| "jade-50"
|
|
118
|
+
| "denim-50"
|
|
119
|
+
| "iris-50"
|
|
120
|
+
| "lilac-50"
|
|
121
|
+
| "coral-50"
|
|
122
|
+
| "wood-50"
|
|
123
|
+
| "silver-50"
|
|
124
|
+
| "steel-50"
|
|
125
|
+
| "olive-50"
|
|
126
|
+
| "sand-50"
|
|
127
|
+
| "scarlet-100"
|
|
128
|
+
| "pumpkin-100"
|
|
129
|
+
| "marigold-100"
|
|
130
|
+
| "avacado-100"
|
|
131
|
+
| "jade-100"
|
|
132
|
+
| "denim-100"
|
|
133
|
+
| "iris-100"
|
|
134
|
+
| "lilac-100"
|
|
135
|
+
| "coral-100"
|
|
136
|
+
| "wood-100"
|
|
137
|
+
| "silver-100"
|
|
138
|
+
| "steel-100"
|
|
139
|
+
| "olive-100"
|
|
140
|
+
| "sand-100"
|
|
141
|
+
| "scarlet-200"
|
|
142
|
+
| "pumpkin-200"
|
|
143
|
+
| "marigold-200"
|
|
144
|
+
| "avacado-200"
|
|
145
|
+
| "jade-200"
|
|
146
|
+
| "denim-200"
|
|
147
|
+
| "iris-200"
|
|
148
|
+
| "lilac-200"
|
|
149
|
+
| "coral-200"
|
|
150
|
+
| "wood-200"
|
|
151
|
+
| "silver-200"
|
|
152
|
+
| "steel-200"
|
|
153
|
+
| "olive-200"
|
|
154
|
+
| "sand-200"
|
|
155
|
+
| "scarlet-300"
|
|
156
|
+
| "pumpkin-300"
|
|
157
|
+
| "marigold-300"
|
|
158
|
+
| "avacado-300"
|
|
159
|
+
| "jade-300"
|
|
160
|
+
| "denim-300"
|
|
161
|
+
| "iris-300"
|
|
162
|
+
| "lilac-300"
|
|
163
|
+
| "coral-300"
|
|
164
|
+
| "wood-300"
|
|
165
|
+
| "silver-300"
|
|
166
|
+
| "steel-300"
|
|
167
|
+
| "olive-300"
|
|
168
|
+
| "sand-300"
|
|
169
|
+
| "scarlet-400"
|
|
170
|
+
| "pumpkin-400"
|
|
171
|
+
| "marigold-400"
|
|
172
|
+
| "avacado-400"
|
|
173
|
+
| "jade-400"
|
|
174
|
+
| "denim-400"
|
|
175
|
+
| "iris-400"
|
|
176
|
+
| "lilac-400"
|
|
177
|
+
| "coral-400"
|
|
178
|
+
| "wood-400"
|
|
179
|
+
| "silver-400"
|
|
180
|
+
| "steel-400"
|
|
181
|
+
| "olive-400"
|
|
182
|
+
| "sand-400"
|
|
183
|
+
| "scarlet-500"
|
|
184
|
+
| "pumpkin-500"
|
|
185
|
+
| "marigold-500"
|
|
186
|
+
| "avacado-500"
|
|
187
|
+
| "jade-500"
|
|
188
|
+
| "denim-500"
|
|
189
|
+
| "iris-500"
|
|
190
|
+
| "lilac-500"
|
|
191
|
+
| "coral-500"
|
|
192
|
+
| "wood-500"
|
|
193
|
+
| "silver-500"
|
|
194
|
+
| "steel-500"
|
|
195
|
+
| "olive-500"
|
|
196
|
+
| "sand-500"
|
|
197
|
+
| "scarlet-600"
|
|
198
|
+
| "pumpkin-600"
|
|
199
|
+
| "marigold-600"
|
|
200
|
+
| "avacado-600"
|
|
201
|
+
| "jade-600"
|
|
202
|
+
| "denim-600"
|
|
203
|
+
| "iris-600"
|
|
204
|
+
| "lilac-600"
|
|
205
|
+
| "coral-600"
|
|
206
|
+
| "wood-600"
|
|
207
|
+
| "silver-600"
|
|
208
|
+
| "steel-600"
|
|
209
|
+
| "olive-600"
|
|
210
|
+
| "sand-600"
|
|
211
|
+
| "scarlet-700"
|
|
212
|
+
| "pumpkin-700"
|
|
213
|
+
| "marigold-700"
|
|
214
|
+
| "avacado-700"
|
|
215
|
+
| "jade-700"
|
|
216
|
+
| "denim-700"
|
|
217
|
+
| "iris-700"
|
|
218
|
+
| "lilac-700"
|
|
219
|
+
| "coral-700"
|
|
220
|
+
| "wood-700"
|
|
221
|
+
| "silver-700"
|
|
222
|
+
| "steel-700"
|
|
223
|
+
| "olive-700"
|
|
224
|
+
| "sand-700"
|
|
225
|
+
| "scarlet-800"
|
|
226
|
+
| "pumpkin-800"
|
|
227
|
+
| "marigold-800"
|
|
228
|
+
| "avacado-800"
|
|
229
|
+
| "jade-800"
|
|
230
|
+
| "denim-800"
|
|
231
|
+
| "iris-800"
|
|
232
|
+
| "lilac-800"
|
|
233
|
+
| "coral-800"
|
|
234
|
+
| "wood-800"
|
|
235
|
+
| "silver-800"
|
|
236
|
+
| "steel-800"
|
|
237
|
+
| "olive-800"
|
|
238
|
+
| "sand-800"
|
|
239
|
+
| "scarlet-900"
|
|
240
|
+
| "pumpkin-900"
|
|
241
|
+
| "marigold-900"
|
|
242
|
+
| "avacado-900"
|
|
243
|
+
| "jade-900"
|
|
244
|
+
| "denim-900"
|
|
245
|
+
| "iris-900"
|
|
246
|
+
| "lilac-900"
|
|
247
|
+
| "coral-900"
|
|
248
|
+
| "wood-900"
|
|
249
|
+
| "silver-900"
|
|
250
|
+
| "steel-900"
|
|
251
|
+
| "olive-900"
|
|
252
|
+
| "sand-900"
|
|
253
|
+
| "scarlet-950"
|
|
254
|
+
| "pumpkin-950"
|
|
255
|
+
| "marigold-950"
|
|
256
|
+
| "avacado-950"
|
|
257
|
+
| "jade-950"
|
|
258
|
+
| "denim-950"
|
|
259
|
+
| "iris-950"
|
|
260
|
+
| "lilac-950"
|
|
261
|
+
| "coral-950"
|
|
262
|
+
| "wood-950"
|
|
263
|
+
| "silver-950"
|
|
264
|
+
| "steel-950"
|
|
265
|
+
| "olive-950"
|
|
266
|
+
| "sand-950";
|
|
55
267
|
|
|
56
268
|
export type ColorWithGrays = ColorType | "invert" | "dimmed" | "muted";
|
|
57
269
|
|
|
@@ -78,7 +290,11 @@ export interface TooltipType {
|
|
|
78
290
|
/**
|
|
79
291
|
* tooltip color
|
|
80
292
|
*/
|
|
81
|
-
color?: ColorType;
|
|
293
|
+
color?: ColorType | PaletteType | string;
|
|
294
|
+
/**
|
|
295
|
+
* text color
|
|
296
|
+
*/
|
|
297
|
+
textColor?: ColorType | PaletteType | string;
|
|
82
298
|
/**
|
|
83
299
|
* tooltip placement
|
|
84
300
|
*/
|
|
@@ -122,15 +338,7 @@ export interface TestProps {
|
|
|
122
338
|
"data-test-value"?: AnyObject;
|
|
123
339
|
}
|
|
124
340
|
|
|
125
|
-
export type Elements<T> =
|
|
126
|
-
| React.ReactElement<T>
|
|
127
|
-
| React.ReactPortal
|
|
128
|
-
| React.ReactNode
|
|
129
|
-
| string
|
|
130
|
-
| number
|
|
131
|
-
| boolean
|
|
132
|
-
| null
|
|
133
|
-
| undefined;
|
|
341
|
+
export type Elements<T> = React.ReactElement<T> | React.ReactNode;
|
|
134
342
|
|
|
135
343
|
export type AriaProps = React.AriaAttributes;
|
|
136
344
|
|
|
@@ -179,11 +387,11 @@ export interface IconProps {
|
|
|
179
387
|
/**
|
|
180
388
|
* icon background color
|
|
181
389
|
*/
|
|
182
|
-
iconBg?: ColorType | string;
|
|
390
|
+
iconBg?: ColorType | PaletteType | string;
|
|
183
391
|
/**
|
|
184
392
|
* icon color
|
|
185
393
|
*/
|
|
186
|
-
iconColor?: ColorType | string;
|
|
394
|
+
iconColor?: ColorType | PaletteType | string;
|
|
187
395
|
}
|
|
188
396
|
|
|
189
397
|
export interface CollapseProps {
|
|
@@ -239,3 +447,8 @@ export interface SizeObject {
|
|
|
239
447
|
width: number;
|
|
240
448
|
height: number;
|
|
241
449
|
}
|
|
450
|
+
|
|
451
|
+
export interface ScrollObject extends PositionObject, SizeObject {
|
|
452
|
+
scrollWidth?: number;
|
|
453
|
+
scrollHeight: number;
|
|
454
|
+
}
|
package/src/typography/Abbr.tsx
CHANGED
|
@@ -26,9 +26,13 @@ import classNames from "classnames";
|
|
|
26
26
|
import { Fragment, useCallback, useMemo } from "react";
|
|
27
27
|
import { useMemoDebugger } from "../hooks/useEffectDebugger";
|
|
28
28
|
import { Tooltip, getTooltipProps } from "../overlays/tooltip/Tooltip";
|
|
29
|
-
import {
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
import {
|
|
30
|
+
type ChildProp,
|
|
31
|
+
type ColorType,
|
|
32
|
+
type CssProp,
|
|
33
|
+
type PaletteType,
|
|
34
|
+
} from "../types";
|
|
35
|
+
import { getColor } from "../utils";
|
|
32
36
|
|
|
33
37
|
interface AbbrTextProps {
|
|
34
38
|
children: string;
|
|
@@ -49,11 +53,7 @@ const AbbrText = ({ color, children, tooltip, content }: AbbrTextProps) => {
|
|
|
49
53
|
return (
|
|
50
54
|
<TooltipWrapper {...tooltipProps}>
|
|
51
55
|
<abbr
|
|
52
|
-
className={classNames(
|
|
53
|
-
classes.abbr,
|
|
54
|
-
"whitespace-nowrap",
|
|
55
|
-
color && getColorClass(color),
|
|
56
|
-
)}
|
|
56
|
+
className={classNames("fabric-abbr", "whitespace-nowrap")}
|
|
57
57
|
style={
|
|
58
58
|
color ? ({ "--abbr-color": getColor(color) } as AnyObject) : undefined
|
|
59
59
|
}
|
|
@@ -74,7 +74,13 @@ export interface AbbrProps extends ChildProp<string>, CssProp {
|
|
|
74
74
|
*
|
|
75
75
|
* [textPart, tooltip, color (class name or color string)]
|
|
76
76
|
*/
|
|
77
|
-
abbr: Array<
|
|
77
|
+
abbr: Array<
|
|
78
|
+
[
|
|
79
|
+
textPart: string,
|
|
80
|
+
tooltip: string,
|
|
81
|
+
color?: ColorType | PaletteType | string,
|
|
82
|
+
]
|
|
83
|
+
>;
|
|
78
84
|
/**
|
|
79
85
|
* renderer callback
|
|
80
86
|
*/
|
|
@@ -29,22 +29,23 @@ import {
|
|
|
29
29
|
type ChildrenProp,
|
|
30
30
|
type ColorType,
|
|
31
31
|
type CssProp,
|
|
32
|
+
type PaletteType,
|
|
32
33
|
type PolymorphicProps,
|
|
33
34
|
type RefProp,
|
|
34
35
|
type SizeType,
|
|
35
36
|
} from "../types";
|
|
36
|
-
import {
|
|
37
|
+
import { getColor } from "../utils";
|
|
37
38
|
import { TextSizeMap } from "./types";
|
|
38
39
|
|
|
39
|
-
export interface
|
|
40
|
+
export interface AnchorProps extends ChildrenProp, CssProp, RefProp, AriaProps {
|
|
40
41
|
/**
|
|
41
42
|
* link background (CSS color / tailwind color)
|
|
42
43
|
*/
|
|
43
|
-
bg?: ColorType | string;
|
|
44
|
+
bg?: ColorType | PaletteType | string;
|
|
44
45
|
/**
|
|
45
46
|
* link color (CSS color / tailwind color)
|
|
46
47
|
*/
|
|
47
|
-
color?: ColorType | string;
|
|
48
|
+
color?: ColorType | PaletteType | string;
|
|
48
49
|
/**
|
|
49
50
|
* link size
|
|
50
51
|
*/
|
|
@@ -60,7 +61,7 @@ export interface LinkProps extends ChildrenProp, CssProp, RefProp, AriaProps {
|
|
|
60
61
|
/**
|
|
61
62
|
* Typography link component
|
|
62
63
|
*/
|
|
63
|
-
export const
|
|
64
|
+
export const Anchor = <Tag extends React.ElementType = "a">({
|
|
64
65
|
ref,
|
|
65
66
|
as,
|
|
66
67
|
children,
|
|
@@ -70,7 +71,7 @@ export const Link = <Tag extends React.ElementType = "a">({
|
|
|
70
71
|
family,
|
|
71
72
|
size,
|
|
72
73
|
...aria
|
|
73
|
-
}:
|
|
74
|
+
}: AnchorProps & PolymorphicProps<Tag>) => {
|
|
74
75
|
/** ***************** style map *******************/
|
|
75
76
|
const styles = useMemoDebugger(
|
|
76
77
|
() => {
|
|
@@ -96,13 +97,7 @@ export const Link = <Tag extends React.ElementType = "a">({
|
|
|
96
97
|
const E = as ?? "a";
|
|
97
98
|
return (
|
|
98
99
|
<E
|
|
99
|
-
className={classNames(
|
|
100
|
-
"link",
|
|
101
|
-
className,
|
|
102
|
-
family && `font-${family}`,
|
|
103
|
-
bg && getBgClass(bg),
|
|
104
|
-
color && getColorClass(color),
|
|
105
|
-
)}
|
|
100
|
+
className={classNames("link", className, family && `font-${family}`)}
|
|
106
101
|
style={styles}
|
|
107
102
|
ref={ref as AnyObject}
|
|
108
103
|
{...aria}
|
package/src/typography/Mark.tsx
CHANGED
|
@@ -25,9 +25,8 @@ import { isEmpty, isString, tokenize } from "@react-fabric/utilities";
|
|
|
25
25
|
import classNames from "classnames";
|
|
26
26
|
import { Fragment, useCallback } from "react";
|
|
27
27
|
import { useMemoDebugger } from "../hooks/useEffectDebugger";
|
|
28
|
-
import { type ChildProp, type ColorType } from "../types";
|
|
29
|
-
import {
|
|
30
|
-
import classes from "./Typography.module.css";
|
|
28
|
+
import { type ChildProp, type ColorType, type PaletteType } from "../types";
|
|
29
|
+
import { getColor } from "../utils";
|
|
31
30
|
|
|
32
31
|
interface MarkTextProps {
|
|
33
32
|
children: string;
|
|
@@ -37,11 +36,7 @@ interface MarkTextProps {
|
|
|
37
36
|
const MarkText = ({ color, children }: MarkTextProps) => {
|
|
38
37
|
return (
|
|
39
38
|
<mark
|
|
40
|
-
className={classNames(
|
|
41
|
-
classes.mark,
|
|
42
|
-
"whitespace-nowrap",
|
|
43
|
-
color && getBgClass(color),
|
|
44
|
-
)}
|
|
39
|
+
className={classNames("fabric-mark", "whitespace-nowrap")}
|
|
45
40
|
style={
|
|
46
41
|
color ? ({ "--mark-color": getColor(color) } as AnyObject) : undefined
|
|
47
42
|
}
|
|
@@ -57,7 +52,7 @@ export interface MarkProps extends ChildProp<string> {
|
|
|
57
52
|
*
|
|
58
53
|
* [textPart, color (class name or color string)]
|
|
59
54
|
*/
|
|
60
|
-
mark: Array<[textPart: string, color?: ColorType | string]>;
|
|
55
|
+
mark: Array<[textPart: string, color?: ColorType | PaletteType | string]>;
|
|
61
56
|
/**
|
|
62
57
|
* renderer callback
|
|
63
58
|
*/
|
package/src/typography/Text.tsx
CHANGED
|
@@ -38,13 +38,7 @@ import {
|
|
|
38
38
|
type SizeType,
|
|
39
39
|
type TestProps,
|
|
40
40
|
} from "../types";
|
|
41
|
-
import {
|
|
42
|
-
calculateTextHeight,
|
|
43
|
-
getBgClass,
|
|
44
|
-
getColor,
|
|
45
|
-
getColorClass,
|
|
46
|
-
} from "../utils";
|
|
47
|
-
import classes from "./Typography.module.css";
|
|
41
|
+
import { calculateTextHeight, getColor } from "../utils";
|
|
48
42
|
import { TextSizeMap } from "./types";
|
|
49
43
|
|
|
50
44
|
export interface TextProps extends ChildrenProp, CssProp, AriaProps, TestProps {
|
|
@@ -164,11 +158,9 @@ export const Text = ({
|
|
|
164
158
|
>
|
|
165
159
|
<div
|
|
166
160
|
className={classNames(
|
|
167
|
-
|
|
168
|
-
"
|
|
161
|
+
"fabric-text",
|
|
162
|
+
"mixed-lang px-[2px] whitespace-pre-wrap",
|
|
169
163
|
family && `font-${family}`,
|
|
170
|
-
bg && getBgClass(bg),
|
|
171
|
-
color && getColorClass(color),
|
|
172
164
|
clamp && "line-clamp-1",
|
|
173
165
|
)}
|
|
174
166
|
style={styles}
|
|
@@ -178,7 +170,7 @@ export const Text = ({
|
|
|
178
170
|
</div>
|
|
179
171
|
</div>
|
|
180
172
|
{clipped && (
|
|
181
|
-
<div className={
|
|
173
|
+
<div className={"fabric-moreLink"}>
|
|
182
174
|
<span
|
|
183
175
|
role="link"
|
|
184
176
|
tabIndex={0}
|
package/src/typography/Title.tsx
CHANGED
|
@@ -35,9 +35,8 @@ import {
|
|
|
35
35
|
type CssProp,
|
|
36
36
|
type SizeType,
|
|
37
37
|
} from "../types";
|
|
38
|
-
import {
|
|
38
|
+
import { getColor } from "../utils";
|
|
39
39
|
import { TitleSizeMap } from "./types";
|
|
40
|
-
import classes from "./Typography.module.css";
|
|
41
40
|
|
|
42
41
|
export interface TitleProps extends ChildrenProp, CssProp, AriaProps {
|
|
43
42
|
as?: ElementType<
|
|
@@ -109,13 +108,10 @@ export const Title = ({
|
|
|
109
108
|
return (
|
|
110
109
|
<E
|
|
111
110
|
className={classNames(
|
|
112
|
-
|
|
113
|
-
"px-[2px] py-1 truncate whitespace-pre-wrap",
|
|
111
|
+
"fabric-title",
|
|
114
112
|
className,
|
|
115
113
|
family && `font-${family}`,
|
|
116
114
|
!as && "text-lg",
|
|
117
|
-
bg && getBgClass(bg),
|
|
118
|
-
color && getColorClass(color),
|
|
119
115
|
)}
|
|
120
116
|
style={styles}
|
|
121
117
|
{...aria}
|
package/src/typography/index.ts
CHANGED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* React Fabric
|
|
3
|
+
* @version: 1.0.0
|
|
4
|
+
*
|
|
5
|
+
*
|
|
6
|
+
* The MIT License (MIT)
|
|
7
|
+
* Copyright (c) 2024 Adarsh Pastakia
|
|
8
|
+
*
|
|
9
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software
|
|
10
|
+
* and associated documentation files (the "Software"), to deal in the Software without restriction,
|
|
11
|
+
* including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
12
|
+
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
|
|
13
|
+
* subject to the following conditions:
|
|
14
|
+
*
|
|
15
|
+
* The above copyright notice and this permission notice shall be included in all copies or substantial
|
|
16
|
+
* portions of the Software.
|
|
17
|
+
*
|
|
18
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
|
|
19
|
+
* TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
20
|
+
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
21
|
+
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
import { type ReactNode, Children, isValidElement } from "react";
|
|
25
|
+
import { Fragment } from "react/jsx-runtime";
|
|
26
|
+
|
|
27
|
+
export const cloneChildren = (
|
|
28
|
+
children: ReactNode,
|
|
29
|
+
callback: (child: ReactNode, index: number) => ReactNode,
|
|
30
|
+
): ReactNode => {
|
|
31
|
+
return Children.map(children, (c: ReactNode) => {
|
|
32
|
+
if (isValidElement(c)) {
|
|
33
|
+
if (c.type === Fragment) {
|
|
34
|
+
// just compare to `Fragment`
|
|
35
|
+
return cloneChildren(c.props?.children, callback);
|
|
36
|
+
}
|
|
37
|
+
return c;
|
|
38
|
+
}
|
|
39
|
+
return c;
|
|
40
|
+
})
|
|
41
|
+
?.flat()
|
|
42
|
+
.filter(Boolean)
|
|
43
|
+
.map(callback);
|
|
44
|
+
};
|
package/src/utils/getColor.ts
CHANGED
|
@@ -29,21 +29,5 @@ export const getColor = (color: string) => {
|
|
|
29
29
|
if (color && isColor(color)) {
|
|
30
30
|
return color;
|
|
31
31
|
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export const getBgClass = (bg: string) => {
|
|
35
|
-
if (bg && !isColor(bg)) {
|
|
36
|
-
return `bg-${bg}`;
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
export const getColorClass = (color: string) => {
|
|
41
|
-
if (color && !isColor(color)) {
|
|
42
|
-
return `text-${color}`;
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
export const getBorderClass = (color: string) => {
|
|
46
|
-
if (color && !isColor(color)) {
|
|
47
|
-
return `border-${color}`;
|
|
48
|
-
}
|
|
32
|
+
return `var(--color-${color})`;
|
|
49
33
|
};
|