@mbao01/common 0.5.2 → 0.6.0
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/dist/types/components/Alert/constants.d.ts +1 -1
- package/dist/types/components/AlertDialog/AlertDialog.d.ts +7 -5
- package/dist/types/components/Anchor/{constant.d.ts → constants.d.ts} +1 -1
- package/dist/types/components/Anchor/types.d.ts +1 -1
- package/dist/types/components/AspectRatio/AspectRatio.d.ts +6 -0
- package/dist/types/components/AspectRatio/constants.d.ts +3 -0
- package/dist/types/components/AspectRatio/index.d.ts +2 -0
- package/dist/types/components/AspectRatio/types.d.ts +5 -0
- package/dist/types/components/Avatar/constants.d.ts +6 -6
- package/dist/types/components/Badge/constants.d.ts +1 -1
- package/dist/types/components/Banner/Banner.d.ts +11 -0
- package/dist/types/components/Banner/constants.d.ts +4 -0
- package/dist/types/components/Banner/index.d.ts +2 -0
- package/dist/types/components/Banner/types.d.ts +9 -0
- package/dist/types/components/Blockquote/Blockquote.d.ts +6 -0
- package/dist/types/components/Blockquote/constants.d.ts +3 -0
- package/dist/types/components/Blockquote/index.d.ts +2 -0
- package/dist/types/components/Blockquote/types.d.ts +5 -0
- package/dist/types/components/Box/Box.d.ts +6 -0
- package/dist/types/components/Box/constants.d.ts +5 -0
- package/dist/types/components/Box/index.d.ts +2 -0
- package/dist/types/components/Box/types.d.ts +3 -0
- package/dist/types/components/Breadcrumb/Breadcrumb.d.ts +1 -1
- package/dist/types/components/Breadcrumb/types.d.ts +1 -1
- package/dist/types/components/Button/Button.d.ts +3 -2
- package/dist/types/components/Button/constants.d.ts +2 -1
- package/dist/types/components/Carousel/Carousel.d.ts +6 -4
- package/dist/types/components/Center/Center.d.ts +5 -0
- package/dist/types/components/Center/constants.d.ts +4 -0
- package/dist/types/components/Center/index.d.ts +2 -0
- package/dist/types/components/Center/types.d.ts +3 -0
- package/dist/types/components/Chart/constants.d.ts +2 -2
- package/dist/types/components/Code/Code.d.ts +8 -0
- package/dist/types/components/Code/constants.d.ts +4 -0
- package/dist/types/components/Code/helper.d.ts +2 -0
- package/dist/types/components/Code/index.d.ts +2 -0
- package/dist/types/components/Code/types.d.ts +6 -0
- package/dist/types/components/Combobox/Combobox.d.ts +1 -1
- package/dist/types/components/Combobox/types.d.ts +1 -0
- package/dist/types/components/Container/Container.d.ts +6 -0
- package/dist/types/components/Container/constants.d.ts +5 -0
- package/dist/types/components/Container/index.d.ts +2 -0
- package/dist/types/components/Container/types.d.ts +3 -0
- package/dist/types/components/DatetimePicker/DatetimeGrid.d.ts +2 -2
- package/dist/types/components/DatetimePicker/DatetimePicker.d.ts +2 -2
- package/dist/types/components/DatetimePicker/constants.d.ts +1 -1
- package/dist/types/components/Dialog/Dialog.d.ts +1 -1
- package/dist/types/components/Dialog/constants.d.ts +1 -1
- package/dist/types/components/Dock/constants.d.ts +2 -2
- package/dist/types/components/Empty/Empty.d.ts +8 -0
- package/dist/types/components/Empty/constants.d.ts +6 -0
- package/dist/types/components/Empty/index.d.ts +2 -0
- package/dist/types/components/Empty/types.d.ts +3 -0
- package/dist/types/components/Flex/Flex.d.ts +8 -0
- package/dist/types/components/Flex/constants.d.ts +7 -0
- package/dist/types/components/Flex/index.d.ts +2 -0
- package/dist/types/components/Flex/types.d.ts +3 -0
- package/dist/types/components/Footer/Footer.d.ts +6 -0
- package/dist/types/components/Footer/constants.d.ts +4 -0
- package/dist/types/components/Footer/index.d.ts +2 -0
- package/dist/types/components/Footer/types.d.ts +4 -0
- package/dist/types/components/Form/DatetimeInput/DatetimeInput.d.ts +3 -3
- package/dist/types/components/Form/Input/Input.d.ts +4 -4
- package/dist/types/components/Form/Input/constants.d.ts +2 -2
- package/dist/types/components/Form/NativeSelect/NativeSelect.d.ts +8 -0
- package/dist/types/components/Form/NativeSelect/constants.d.ts +7 -0
- package/dist/types/components/Form/NativeSelect/index.d.ts +2 -0
- package/dist/types/components/Form/NativeSelect/types.d.ts +3 -0
- package/dist/types/components/Form/Radio/Radio.d.ts +1 -1
- package/dist/types/components/Form/Range/Range.d.ts +1 -1
- package/dist/types/components/Form/Select/Select.d.ts +4 -4
- package/dist/types/components/Form/Select/constants.d.ts +2 -2
- package/dist/types/components/Form/Switch/Switch.d.ts +1 -1
- package/dist/types/components/Form/TagsInput/TagsInput.d.ts +2 -2
- package/dist/types/components/Form/TextField/TextField.d.ts +4 -4
- package/dist/types/components/Form/Textarea/Textarea.d.ts +3 -3
- package/dist/types/components/Form/Textarea/constants.d.ts +1 -1
- package/dist/types/components/Form/components/Field/Field.d.ts +8 -0
- package/dist/types/components/Form/components/Field/FieldContext.d.ts +2 -0
- package/dist/types/components/Form/components/Field/constants.d.ts +6 -0
- package/dist/types/components/Form/components/Field/hooks/index.d.ts +1 -0
- package/dist/types/components/Form/components/Field/hooks/useField/index.d.ts +1 -0
- package/dist/types/components/Form/components/Field/hooks/useField/useField.d.ts +1 -0
- package/dist/types/components/Form/components/Field/index.d.ts +2 -0
- package/dist/types/components/Form/components/Field/types.d.ts +12 -0
- package/dist/types/components/Form/index.d.ts +2 -0
- package/dist/types/components/Grid/Grid.d.ts +11 -0
- package/dist/types/components/Grid/constants.d.ts +10 -0
- package/dist/types/components/Grid/index.d.ts +2 -0
- package/dist/types/components/Grid/types.d.ts +4 -0
- package/dist/types/components/Header/Header.d.ts +7 -0
- package/dist/types/components/Header/constants.d.ts +3 -0
- package/dist/types/components/Header/index.d.ts +2 -0
- package/dist/types/components/Header/types.d.ts +3 -0
- package/dist/types/components/Heading/Heading.d.ts +7 -0
- package/dist/types/components/Heading/constants.d.ts +4 -0
- package/dist/types/components/Heading/index.d.ts +2 -0
- package/dist/types/components/Heading/types.d.ts +7 -0
- package/dist/types/components/Image/Image.d.ts +7 -0
- package/dist/types/components/Image/constants.d.ts +4 -0
- package/dist/types/components/Image/index.d.ts +2 -0
- package/dist/types/components/Image/types.d.ts +5 -0
- package/dist/types/components/Kbd/constants.d.ts +1 -1
- package/dist/types/components/List/constants.d.ts +1 -1
- package/dist/types/components/Loading/Loading.d.ts +1 -1
- package/dist/types/components/Loading/constants.d.ts +2 -2
- package/dist/types/components/Menu/ContextMenu/ContextMenu.d.ts +4 -4
- package/dist/types/components/Menu/DropdownMenu/DropdownMenu.d.ts +4 -4
- package/dist/types/components/Menu/Menubar/Menubar.d.ts +5 -5
- package/dist/types/components/Menu/Menubar/constants.d.ts +5 -5
- package/dist/types/components/Menu/NavigationMenu/NavigationMenu.d.ts +1 -1
- package/dist/types/components/Menu/NavigationMenu/constants.d.ts +1 -1
- package/dist/types/components/Panel/Panel.d.ts +11 -0
- package/dist/types/components/Panel/constants.d.ts +7 -0
- package/dist/types/components/Panel/index.d.ts +2 -0
- package/dist/types/components/Panel/types.d.ts +8 -0
- package/dist/types/components/Paragraph/Paragraph.d.ts +3 -0
- package/dist/types/components/Paragraph/constants.d.ts +3 -0
- package/dist/types/components/Paragraph/index.d.ts +2 -0
- package/dist/types/components/Paragraph/types.d.ts +5 -0
- package/dist/types/components/Progress/Progress.d.ts +1 -1
- package/dist/types/components/Progress/constants.d.ts +2 -2
- package/dist/types/components/Resizable/Resizable.d.ts +1 -1
- package/dist/types/components/ScrollArea/ScrollArea.d.ts +1 -1
- package/dist/types/components/ScrollArea/constants.d.ts +1 -1
- package/dist/types/components/Sheet/Sheet.d.ts +12 -0
- package/dist/types/components/Sheet/constants.d.ts +7 -0
- package/dist/types/components/Sheet/index.d.ts +2 -0
- package/dist/types/components/Sheet/types.d.ts +5 -0
- package/dist/types/components/Sidebar/Sidebar.d.ts +8 -7
- package/dist/types/components/Sidebar/SidebarMenu.d.ts +3 -2
- package/dist/types/components/Sidebar/constants.d.ts +5 -4
- package/dist/types/components/Sidebar/types.d.ts +1 -1
- package/dist/types/components/Skeleton/Skeleton.d.ts +1 -1
- package/dist/types/components/Skeleton/constants.d.ts +3 -3
- package/dist/types/components/Sonner/constants.d.ts +2 -2
- package/dist/types/components/Spacer/Spacer.d.ts +5 -0
- package/dist/types/components/Spacer/constants.d.ts +4 -0
- package/dist/types/components/Spacer/index.d.ts +2 -0
- package/dist/types/components/Spacer/types.d.ts +3 -0
- package/dist/types/components/Spinner/Spinner.d.ts +5 -0
- package/dist/types/components/Spinner/constants.d.ts +4 -0
- package/dist/types/components/Spinner/index.d.ts +2 -0
- package/dist/types/components/Spinner/types.d.ts +3 -0
- package/dist/types/components/Status/constants.d.ts +1 -1
- package/dist/types/components/Stepper/Stepper.d.ts +9 -0
- package/dist/types/components/Stepper/constants.d.ts +6 -0
- package/dist/types/components/Stepper/index.d.ts +2 -0
- package/dist/types/components/Stepper/types.d.ts +6 -0
- package/dist/types/components/Text/constants.d.ts +1 -1
- package/dist/types/components/Timeline/Timeline.d.ts +5 -5
- package/dist/types/components/Timeline/constants.d.ts +5 -5
- package/dist/types/components/Toggle/Toggle.d.ts +5 -3
- package/dist/types/components/Toggle/constants.d.ts +2 -1
- package/dist/types/components/ToggleGroup/ToggleGroup.d.ts +5 -3
- package/dist/types/index.d.ts +24 -0
- package/dist/types/utilities/createVariants/createVariants.d.ts +2 -0
- package/dist/types/utilities/createVariants/index.d.ts +1 -0
- package/dist/types/utilities/createVariants/type.d.ts +10 -0
- package/dist/types/utilities/index.d.ts +1 -0
- package/package.json +41 -41
- package/src/components/Alert/constants.ts +3 -2
- package/src/components/Anchor/Anchor.tsx +1 -1
- package/src/components/Anchor/{constant.ts → constants.ts} +4 -4
- package/src/components/Anchor/types.ts +1 -1
- package/src/components/AspectRatio/AspectRatio.tsx +23 -0
- package/src/components/AspectRatio/constants.ts +17 -0
- package/src/components/AspectRatio/index.ts +2 -0
- package/src/components/AspectRatio/types.ts +7 -0
- package/src/components/Avatar/constants.ts +17 -22
- package/src/components/Badge/constants.ts +3 -2
- package/src/components/Banner/Banner.tsx +36 -0
- package/src/components/Banner/constants.ts +18 -0
- package/src/components/Banner/index.ts +2 -0
- package/src/components/Banner/types.ts +11 -0
- package/src/components/Blockquote/Blockquote.tsx +21 -0
- package/src/components/Blockquote/constants.ts +22 -0
- package/src/components/Blockquote/index.ts +2 -0
- package/src/components/Blockquote/types.ts +7 -0
- package/src/components/Box/Box.tsx +20 -0
- package/src/components/Box/constants.ts +34 -0
- package/src/components/Box/index.ts +2 -0
- package/src/components/Box/types.ts +4 -0
- package/src/components/Breadcrumb/types.ts +1 -1
- package/src/components/Button/Button.tsx +3 -4
- package/src/components/Button/constants.ts +6 -3
- package/src/components/Card/constants.ts +3 -2
- package/src/components/Carousel/constants.ts +9 -8
- package/src/components/Center/Center.tsx +16 -0
- package/src/components/Center/constants.ts +20 -0
- package/src/components/Center/index.ts +2 -0
- package/src/components/Center/types.ts +5 -0
- package/src/components/Chart/constants.ts +9 -8
- package/src/components/Code/Code.tsx +51 -0
- package/src/components/Code/constants.ts +28 -0
- package/src/components/Code/helper.ts +10 -0
- package/src/components/Code/index.ts +2 -0
- package/src/components/Code/types.ts +8 -0
- package/src/components/Combobox/Combobox.tsx +2 -3
- package/src/components/Combobox/types.ts +1 -0
- package/src/components/Container/Container.tsx +20 -0
- package/src/components/Container/constants.ts +31 -0
- package/src/components/Container/index.ts +2 -0
- package/src/components/Container/types.ts +5 -0
- package/src/components/DatetimePicker/constants.ts +5 -4
- package/src/components/Dialog/Dialog.tsx +3 -3
- package/src/components/Dialog/constants.ts +5 -4
- package/src/components/Dock/constants.ts +14 -13
- package/src/components/DragAndDrop/Draggable/constants.ts +5 -4
- package/src/components/DragAndDrop/Droppable/constants.ts +3 -2
- package/src/components/DragAndDrop/Sortable/constants.ts +3 -2
- package/src/components/Empty/Empty.tsx +66 -0
- package/src/components/Empty/constants.ts +30 -0
- package/src/components/Empty/index.ts +2 -0
- package/src/components/Empty/types.ts +5 -0
- package/src/components/Flex/Flex.tsx +20 -0
- package/src/components/Flex/constants.ts +51 -0
- package/src/components/Flex/index.ts +2 -0
- package/src/components/Flex/types.ts +4 -0
- package/src/components/Footer/Footer.tsx +26 -0
- package/src/components/Footer/constants.ts +12 -0
- package/src/components/Footer/index.ts +2 -0
- package/src/components/Footer/types.ts +6 -0
- package/src/components/Form/Checkbox/constants.ts +5 -4
- package/src/components/Form/DatetimeInput/constants.ts +9 -8
- package/src/components/Form/Input/constants.ts +7 -6
- package/src/components/Form/MultiSelect/constants.ts +10 -9
- package/src/components/Form/NativeSelect/NativeSelect.tsx +23 -0
- package/src/components/Form/NativeSelect/constants.ts +39 -0
- package/src/components/Form/NativeSelect/index.ts +2 -0
- package/src/components/Form/NativeSelect/types.ts +5 -0
- package/src/components/Form/Radio/constants.ts +3 -2
- package/src/components/Form/Range/constants.ts +3 -2
- package/src/components/Form/Select/constants.ts +14 -13
- package/src/components/Form/Slider/constants.ts +9 -8
- package/src/components/Form/Switch/constants.ts +3 -2
- package/src/components/Form/TagsInput/TagsInput.tsx +1 -1
- package/src/components/Form/TagsInput/constants.ts +7 -6
- package/src/components/Form/Textarea/constants.ts +3 -2
- package/src/components/Form/Validator/constants.ts +3 -2
- package/src/components/Form/components/Field/Field.tsx +81 -0
- package/src/components/Form/components/Field/FieldContext.tsx +4 -0
- package/src/components/Form/components/Field/constants.ts +20 -0
- package/src/components/Form/components/Field/hooks/index.ts +1 -0
- package/src/components/Form/components/Field/hooks/useField/index.ts +1 -0
- package/src/components/Form/components/Field/hooks/useField/useField.ts +10 -0
- package/src/components/Form/components/Field/index.ts +2 -0
- package/src/components/Form/components/Field/types.ts +19 -0
- package/src/components/Form/index.ts +2 -0
- package/src/components/Grid/Grid.tsx +32 -0
- package/src/components/Grid/constants.ts +84 -0
- package/src/components/Grid/index.ts +2 -0
- package/src/components/Grid/types.ts +7 -0
- package/src/components/Header/Header.tsx +49 -0
- package/src/components/Header/constants.ts +18 -0
- package/src/components/Header/index.ts +2 -0
- package/src/components/Header/types.ts +4 -0
- package/src/components/Heading/Heading.tsx +23 -0
- package/src/components/Heading/constants.ts +25 -0
- package/src/components/Heading/index.ts +2 -0
- package/src/components/Heading/types.ts +10 -0
- package/src/components/Image/Image.tsx +30 -0
- package/src/components/Image/constants.ts +25 -0
- package/src/components/Image/index.ts +2 -0
- package/src/components/Image/types.ts +7 -0
- package/src/components/Kbd/constants.ts +3 -2
- package/src/components/List/constants.ts +3 -2
- package/src/components/Loading/Loading.tsx +2 -4
- package/src/components/Loading/constants.ts +5 -4
- package/src/components/Menu/Menubar/constants.ts +16 -14
- package/src/components/Menu/NavigationMenu/constants.ts +5 -3
- package/src/components/Panel/Panel.tsx +58 -0
- package/src/components/Panel/constants.ts +31 -0
- package/src/components/Panel/index.ts +2 -0
- package/src/components/Panel/types.ts +11 -0
- package/src/components/Paragraph/Paragraph.tsx +17 -0
- package/src/components/Paragraph/constants.ts +18 -0
- package/src/components/Paragraph/index.ts +2 -0
- package/src/components/Paragraph/types.ts +8 -0
- package/src/components/Progress/constants.ts +9 -10
- package/src/components/Resizable/constants.ts +3 -2
- package/src/components/ScrollArea/constants.ts +6 -5
- package/src/components/Separator/constants.ts +3 -2
- package/src/components/Sheet/Sheet.tsx +126 -0
- package/src/components/Sheet/constants.ts +45 -0
- package/src/components/Sheet/index.ts +9 -0
- package/src/components/Sheet/types.ts +7 -0
- package/src/components/Sidebar/Sidebar.tsx +5 -5
- package/src/components/Sidebar/SidebarMenu.tsx +3 -3
- package/src/components/Sidebar/constants.ts +32 -25
- package/src/components/Sidebar/types.ts +1 -1
- package/src/components/Skeleton/Skeleton.tsx +2 -2
- package/src/components/Skeleton/constants.ts +4 -3
- package/src/components/Sonner/Toaster.tsx +1 -1
- package/src/components/Sonner/constants.ts +6 -5
- package/src/components/Sonner/helpers.ts +1 -1
- package/src/components/Spacer/Spacer.tsx +19 -0
- package/src/components/Spacer/constants.ts +55 -0
- package/src/components/Spacer/index.ts +2 -0
- package/src/components/Spacer/types.ts +5 -0
- package/src/components/Spinner/Spinner.tsx +24 -0
- package/src/components/Spinner/constants.ts +29 -0
- package/src/components/Spinner/index.ts +2 -0
- package/src/components/Spinner/types.ts +5 -0
- package/src/components/Stack/constants.ts +3 -2
- package/src/components/Stat/constants.ts +5 -4
- package/src/components/Status/constants.ts +3 -2
- package/src/components/Stepper/Stepper.tsx +30 -0
- package/src/components/Stepper/constants.ts +29 -0
- package/src/components/Stepper/index.ts +2 -0
- package/src/components/Stepper/types.ts +10 -0
- package/src/components/Table/constants.ts +3 -2
- package/src/components/Text/constants.ts +4 -7
- package/src/components/Timeline/Timeline.example.tsx +1 -1
- package/src/components/Timeline/constants.ts +19 -22
- package/src/components/Toggle/Toggle.tsx +3 -3
- package/src/components/Toggle/constants.ts +6 -3
- package/src/components/ToggleGroup/ToggleGroup.tsx +4 -2
- package/src/components/Tooltip/constants.ts +5 -4
- package/src/index.ts +27 -0
- package/src/utilities/createVariants/createVariants.ts +5 -0
- package/src/utilities/createVariants/index.ts +1 -0
- package/src/utilities/createVariants/type.ts +29 -0
- package/src/utilities/index.ts +1 -0
- package/vitest-setup.ts +4 -0
|
@@ -1,24 +1,25 @@
|
|
|
1
1
|
import { cva } from "../../libs";
|
|
2
|
+
import { createVariants } from "../../utilities";
|
|
2
3
|
|
|
3
4
|
export const getCarouselContentClasses = cva("flex", {
|
|
4
|
-
variants: {
|
|
5
|
+
variants: createVariants({
|
|
5
6
|
orientation: {
|
|
6
7
|
horizontal: "-ml-4",
|
|
7
8
|
vertical: "-mt-4 flex-col",
|
|
8
9
|
},
|
|
9
|
-
},
|
|
10
|
+
}),
|
|
10
11
|
defaultVariants: {
|
|
11
12
|
orientation: "horizontal",
|
|
12
13
|
},
|
|
13
14
|
});
|
|
14
15
|
|
|
15
16
|
export const getCarouselItemClasses = cva("min-w-0 shrink-0 grow-0 basis-full", {
|
|
16
|
-
variants: {
|
|
17
|
+
variants: createVariants({
|
|
17
18
|
orientation: {
|
|
18
19
|
horizontal: "pl-4",
|
|
19
20
|
vertical: "pt-4",
|
|
20
21
|
},
|
|
21
|
-
},
|
|
22
|
+
}),
|
|
22
23
|
defaultVariants: {
|
|
23
24
|
orientation: "horizontal",
|
|
24
25
|
},
|
|
@@ -27,12 +28,12 @@ export const getCarouselItemClasses = cva("min-w-0 shrink-0 grow-0 basis-full",
|
|
|
27
28
|
export const getCarouselNextClasses = cva(
|
|
28
29
|
"absolute h-8 w-8 rounded-full p-0 disabled:bg-transparent",
|
|
29
30
|
{
|
|
30
|
-
variants: {
|
|
31
|
+
variants: createVariants({
|
|
31
32
|
orientation: {
|
|
32
33
|
horizontal: "-right-12 top-1/2 -translate-y-1/2",
|
|
33
34
|
vertical: "-bottom-12 left-1/2 -translate-x-1/2 rotate-90",
|
|
34
35
|
},
|
|
35
|
-
},
|
|
36
|
+
}),
|
|
36
37
|
defaultVariants: {
|
|
37
38
|
orientation: "horizontal",
|
|
38
39
|
},
|
|
@@ -42,12 +43,12 @@ export const getCarouselNextClasses = cva(
|
|
|
42
43
|
export const getCarouselPreviousClasses = cva(
|
|
43
44
|
"absolute h-8 w-8 rounded-full p-0 disabled:bg-transparent",
|
|
44
45
|
{
|
|
45
|
-
variants: {
|
|
46
|
+
variants: createVariants({
|
|
46
47
|
orientation: {
|
|
47
48
|
horizontal: "-left-12 top-1/2 -translate-y-1/2",
|
|
48
49
|
vertical: "-top-12 left-1/2 -translate-x-1/2 rotate-90",
|
|
49
50
|
},
|
|
50
|
-
},
|
|
51
|
+
}),
|
|
51
52
|
defaultVariants: {
|
|
52
53
|
orientation: "horizontal",
|
|
53
54
|
},
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { cn } from "../../utilities";
|
|
3
|
+
import { getCenterClasses } from "./constants";
|
|
4
|
+
import { type CenterProps } from "./types";
|
|
5
|
+
|
|
6
|
+
export const Center = React.forwardRef<HTMLDivElement, CenterProps>(
|
|
7
|
+
({ className, inline, axis, children, ...props }, ref) => {
|
|
8
|
+
return (
|
|
9
|
+
<div ref={ref} className={cn(getCenterClasses({ inline, axis }), className)} {...props}>
|
|
10
|
+
{children}
|
|
11
|
+
</div>
|
|
12
|
+
);
|
|
13
|
+
}
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
Center.displayName = "Center";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { cva } from "../../libs";
|
|
2
|
+
import { createVariants } from "../../utilities";
|
|
3
|
+
|
|
4
|
+
export const getCenterClasses = cva("", {
|
|
5
|
+
variants: createVariants({
|
|
6
|
+
inline: {
|
|
7
|
+
true: "inline-flex",
|
|
8
|
+
false: "flex",
|
|
9
|
+
},
|
|
10
|
+
axis: {
|
|
11
|
+
horizontal: "justify-center",
|
|
12
|
+
vertical: "items-center",
|
|
13
|
+
both: "justify-center items-center",
|
|
14
|
+
},
|
|
15
|
+
}),
|
|
16
|
+
defaultVariants: {
|
|
17
|
+
inline: false,
|
|
18
|
+
axis: "both",
|
|
19
|
+
},
|
|
20
|
+
});
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Theme } from "../../utilities";
|
|
2
2
|
import { cva } from "../../libs";
|
|
3
|
+
import { createVariants } from "../../utilities";
|
|
3
4
|
|
|
4
5
|
export const THEMES = {
|
|
5
6
|
light: "",
|
|
@@ -11,13 +12,13 @@ export const getChartClasses = cva(
|
|
|
11
12
|
);
|
|
12
13
|
|
|
13
14
|
export const getChartLegendContainerClasses = cva("flex items-center justify-center gap-4", {
|
|
14
|
-
variants: {
|
|
15
|
+
variants: createVariants({
|
|
15
16
|
verticalAlign: {
|
|
16
17
|
top: "pb-3",
|
|
17
18
|
bottom: "pt-3",
|
|
18
19
|
middle: "",
|
|
19
20
|
},
|
|
20
|
-
},
|
|
21
|
+
}),
|
|
21
22
|
});
|
|
22
23
|
|
|
23
24
|
export const getChartLegendItemClasses = cva("flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3");
|
|
@@ -31,24 +32,24 @@ export const getChartTooltipContainerClasses = cva(
|
|
|
31
32
|
export const getChartTooltipItemClasses = cva(
|
|
32
33
|
"flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-base-content",
|
|
33
34
|
{
|
|
34
|
-
variants: {
|
|
35
|
+
variants: createVariants({
|
|
35
36
|
indicator: {
|
|
36
37
|
dot: "items-center",
|
|
37
38
|
line: "",
|
|
38
39
|
dashed: "",
|
|
39
40
|
},
|
|
40
|
-
},
|
|
41
|
+
}),
|
|
41
42
|
}
|
|
42
43
|
);
|
|
43
44
|
|
|
44
45
|
export const getChartTooltipItemLabelClasses = cva(
|
|
45
46
|
"flex flex-1 justify-between leading-none items-center",
|
|
46
47
|
{
|
|
47
|
-
variants: {
|
|
48
|
+
variants: createVariants({
|
|
48
49
|
nestLabel: {
|
|
49
50
|
true: "items-end",
|
|
50
51
|
},
|
|
51
|
-
},
|
|
52
|
+
}),
|
|
52
53
|
}
|
|
53
54
|
);
|
|
54
55
|
|
|
@@ -57,7 +58,7 @@ export const getChartTooltipItemValueClasses = cva("font-mono font-medium tabula
|
|
|
57
58
|
export const getChartTooltipItemIndicatorClasses = cva(
|
|
58
59
|
"shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)",
|
|
59
60
|
{
|
|
60
|
-
variants: {
|
|
61
|
+
variants: createVariants({
|
|
61
62
|
indicator: {
|
|
62
63
|
dot: "h-2.5 w-2.5",
|
|
63
64
|
line: "w-1",
|
|
@@ -66,7 +67,7 @@ export const getChartTooltipItemIndicatorClasses = cva(
|
|
|
66
67
|
nestLabel: {
|
|
67
68
|
true: "",
|
|
68
69
|
},
|
|
69
|
-
},
|
|
70
|
+
}),
|
|
70
71
|
compoundVariants: [
|
|
71
72
|
{
|
|
72
73
|
indicator: "dashed",
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { cn } from "../../utilities";
|
|
3
|
+
import { getCodeClasses } from "./constants";
|
|
4
|
+
import { getDataPrefix } from "./helper";
|
|
5
|
+
import { type CodeProps } from "./types";
|
|
6
|
+
|
|
7
|
+
const CodeBlock = ({ children, prefix, skip }: Pick<CodeProps, "children" | "prefix" | "skip">) => {
|
|
8
|
+
let customIndex = 0;
|
|
9
|
+
|
|
10
|
+
return React.Children.map(children, (child, index) => {
|
|
11
|
+
const props = (React.isValidElement(child) ? child.props : {}) as Partial<{
|
|
12
|
+
"data-prefix": string;
|
|
13
|
+
className: string;
|
|
14
|
+
}>;
|
|
15
|
+
const dataPrefix = getDataPrefix(prefix, skip ? customIndex : index);
|
|
16
|
+
|
|
17
|
+
if (skip) {
|
|
18
|
+
customIndex = props["data-prefix"] ? customIndex : customIndex + 1;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<pre key={index} data-prefix={props["data-prefix"] ?? dataPrefix} className={props.className}>
|
|
23
|
+
<code>{child}</code>
|
|
24
|
+
</pre>
|
|
25
|
+
);
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export const Code = React.forwardRef<HTMLDivElement, CodeProps>(
|
|
30
|
+
({ className, inline, prefix, skip, colorScheme, children, ...props }, ref) => {
|
|
31
|
+
const Component = inline ? "code" : "div";
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<Component
|
|
35
|
+
ref={ref}
|
|
36
|
+
className={cn(getCodeClasses({ inline, colorScheme }), className)}
|
|
37
|
+
{...props}
|
|
38
|
+
>
|
|
39
|
+
{inline ? (
|
|
40
|
+
children
|
|
41
|
+
) : (
|
|
42
|
+
<CodeBlock prefix={prefix} skip={skip}>
|
|
43
|
+
{children}
|
|
44
|
+
</CodeBlock>
|
|
45
|
+
)}
|
|
46
|
+
</Component>
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
Code.displayName = "Code";
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { cva } from "../../libs";
|
|
2
|
+
import { createVariants } from "../../utilities";
|
|
3
|
+
|
|
4
|
+
export const getCodeClasses = cva("font-mono", {
|
|
5
|
+
variants: createVariants({
|
|
6
|
+
inline: {
|
|
7
|
+
true: "px-1.5 py-0.5 rounded bg-base-300 text-sm",
|
|
8
|
+
false: "mockup-code overflow-x-auto",
|
|
9
|
+
},
|
|
10
|
+
colorScheme: {
|
|
11
|
+
default: "",
|
|
12
|
+
primary: "bg-primary/10 text-primary",
|
|
13
|
+
secondary: "bg-secondary/10 text-secondary",
|
|
14
|
+
accent: "bg-accent/10 text-accent",
|
|
15
|
+
},
|
|
16
|
+
}),
|
|
17
|
+
compoundVariants: [
|
|
18
|
+
{
|
|
19
|
+
inline: false,
|
|
20
|
+
colorScheme: undefined,
|
|
21
|
+
className: "bg-base-200",
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
defaultVariants: {
|
|
25
|
+
inline: true,
|
|
26
|
+
colorScheme: "default",
|
|
27
|
+
},
|
|
28
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { CodeProps } from "./types";
|
|
2
|
+
|
|
3
|
+
export const getDataPrefix = (prefix: CodeProps["prefix"], index: number) => {
|
|
4
|
+
if (prefix === "numeric") {
|
|
5
|
+
return index + 1;
|
|
6
|
+
} else if (prefix === "uppercase" || prefix === "lowercase") {
|
|
7
|
+
return String.fromCharCode(prefix === "uppercase" ? 65 : 97 + index);
|
|
8
|
+
}
|
|
9
|
+
return "";
|
|
10
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type VariantProps } from "../../libs";
|
|
2
|
+
import { getCodeClasses } from "./constants";
|
|
3
|
+
|
|
4
|
+
export type CodeProps = React.HTMLAttributes<HTMLElement> &
|
|
5
|
+
VariantProps<typeof getCodeClasses> & {
|
|
6
|
+
skip?: boolean;
|
|
7
|
+
prefix?: "numeric" | "uppercase" | "lowercase" | "none";
|
|
8
|
+
};
|
|
@@ -16,11 +16,10 @@ export const Combobox = <T extends Item>({
|
|
|
16
16
|
placeholder,
|
|
17
17
|
getItemValue = (item: T) => item.value as string,
|
|
18
18
|
getItemLabel = (item: T) => item.label as string,
|
|
19
|
+
onSelectItem,
|
|
19
20
|
}: ComboboxProps<T>) => {
|
|
20
21
|
const [open, setOpen] = React.useState(false);
|
|
21
22
|
const [value, setValue] = React.useState<string | number | null>(null);
|
|
22
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
23
|
-
const [_, setItem] = React.useState<T | null>(null);
|
|
24
23
|
|
|
25
24
|
const currentItem = items?.find((item) => getItemValue(item) === value);
|
|
26
25
|
|
|
@@ -49,8 +48,8 @@ export const Combobox = <T extends Item>({
|
|
|
49
48
|
value={getItemValue(item)}
|
|
50
49
|
onSelect={(currentValue) => {
|
|
51
50
|
setValue(currentValue === value ? null : currentValue);
|
|
52
|
-
setItem(item);
|
|
53
51
|
setOpen(false);
|
|
52
|
+
onSelectItem?.(item);
|
|
54
53
|
}}
|
|
55
54
|
className={cn(
|
|
56
55
|
{
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { cn } from "../../utilities";
|
|
3
|
+
import { getContainerClasses } from "./constants";
|
|
4
|
+
import { type ContainerProps } from "./types";
|
|
5
|
+
|
|
6
|
+
export const Container = React.forwardRef<HTMLDivElement, ContainerProps>(
|
|
7
|
+
({ className, size, center, padding, children, ...props }, ref) => {
|
|
8
|
+
return (
|
|
9
|
+
<div
|
|
10
|
+
ref={ref}
|
|
11
|
+
className={cn(getContainerClasses({ size, center, padding }), className)}
|
|
12
|
+
{...props}
|
|
13
|
+
>
|
|
14
|
+
{children}
|
|
15
|
+
</div>
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
Container.displayName = "Container";
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { cva } from "../../libs";
|
|
2
|
+
import { createVariants } from "../../utilities";
|
|
3
|
+
|
|
4
|
+
export const getContainerClasses = cva("", {
|
|
5
|
+
variants: createVariants({
|
|
6
|
+
size: {
|
|
7
|
+
xs: "max-w-xs",
|
|
8
|
+
sm: "max-w-sm",
|
|
9
|
+
md: "max-w-md",
|
|
10
|
+
lg: "max-w-lg",
|
|
11
|
+
xl: "max-w-xl",
|
|
12
|
+
},
|
|
13
|
+
center: {
|
|
14
|
+
true: "mx-auto",
|
|
15
|
+
},
|
|
16
|
+
padding: {
|
|
17
|
+
true: "px-4 sm:px-6 lg:px-8",
|
|
18
|
+
},
|
|
19
|
+
}),
|
|
20
|
+
defaultVariants: {
|
|
21
|
+
size: "xl",
|
|
22
|
+
center: true,
|
|
23
|
+
padding: true,
|
|
24
|
+
},
|
|
25
|
+
compoundVariants: [
|
|
26
|
+
{
|
|
27
|
+
size: undefined,
|
|
28
|
+
className: "max-w-full",
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
});
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { DateFormat, DatetimeFormatDefaults, InputPlaceholders, TimeFormat } from "./types";
|
|
2
2
|
import { cva } from "../../libs";
|
|
3
|
+
import { createVariants } from "../../utilities";
|
|
3
4
|
|
|
4
5
|
export const DEFAULTS = [
|
|
5
6
|
["days", "months", "years"],
|
|
@@ -22,7 +23,7 @@ export const getDatetimeGridClasses = cva(
|
|
|
22
23
|
[&:has(input:focus-within)]:duration-100 [&:has(input:focus-within)]:outline [&:has(input:focus-within)]:outline-2 [&:has(input:focus-within)]:outline-offset-2 [&:has(input:focus-within)]:outline-base-content/20
|
|
23
24
|
`,
|
|
24
25
|
{
|
|
25
|
-
variants: {
|
|
26
|
+
variants: createVariants({
|
|
26
27
|
variant: {
|
|
27
28
|
default: "border-0",
|
|
28
29
|
accent: "border border-accent",
|
|
@@ -49,7 +50,7 @@ export const getDatetimeGridClasses = cva(
|
|
|
49
50
|
md: "h-12 leading-loose px-4 text-sm",
|
|
50
51
|
lg: "h-16 leading-loose px-5 text-lg",
|
|
51
52
|
},
|
|
52
|
-
},
|
|
53
|
+
}),
|
|
53
54
|
compoundVariants: [
|
|
54
55
|
{
|
|
55
56
|
size: undefined,
|
|
@@ -74,7 +75,7 @@ export const getDatetimeSeparatorClasses = cva("text-xs text-gray-400");
|
|
|
74
75
|
export const getDatetimeInputClasses = cva(
|
|
75
76
|
"min-w-8 p-1 inline tabular-nums h-fit border-none outline-hidden shadow-none select-none content-box caret-transparent min-w-8 text-center focus:outline-hidden focus:bg-base-content/20 focus-visible:ring-0 focus-visible:outline-hidden",
|
|
76
77
|
{
|
|
77
|
-
variants: {
|
|
78
|
+
variants: createVariants({
|
|
78
79
|
size: {
|
|
79
80
|
xs: "max-h-4",
|
|
80
81
|
sm: "max-h-6",
|
|
@@ -85,7 +86,7 @@ export const getDatetimeInputClasses = cva(
|
|
|
85
86
|
years: "min-w-12",
|
|
86
87
|
"am/pm": "bg-base-content/5",
|
|
87
88
|
} as Record<DateFormat | TimeFormat, string>,
|
|
88
|
-
},
|
|
89
|
+
}),
|
|
89
90
|
compoundVariants: [
|
|
90
91
|
{
|
|
91
92
|
size: "lg",
|
|
@@ -46,7 +46,7 @@ const DialogContent = React.forwardRef<
|
|
|
46
46
|
className,
|
|
47
47
|
children,
|
|
48
48
|
closeProps,
|
|
49
|
-
|
|
49
|
+
type = "dialog",
|
|
50
50
|
showClose = true,
|
|
51
51
|
side = "right",
|
|
52
52
|
...props
|
|
@@ -59,8 +59,8 @@ const DialogContent = React.forwardRef<
|
|
|
59
59
|
ref={ref}
|
|
60
60
|
className={cn(
|
|
61
61
|
getDialogContentClasses({
|
|
62
|
-
|
|
63
|
-
side:
|
|
62
|
+
type,
|
|
63
|
+
side: type === "sheet" ? side : undefined,
|
|
64
64
|
}),
|
|
65
65
|
className
|
|
66
66
|
)}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { cva } from "../../libs";
|
|
2
|
+
import { createVariants } from "../../utilities";
|
|
2
3
|
|
|
3
4
|
export const getDialogOverlayClasses = cva(
|
|
4
5
|
"fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0"
|
|
@@ -7,8 +8,8 @@ export const getDialogOverlayClasses = cva(
|
|
|
7
8
|
export const getDialogContentClasses = cva(
|
|
8
9
|
"fixed z-50 gap-4 p-6 shadow-lg transition bg-base-100 w-full",
|
|
9
10
|
{
|
|
10
|
-
variants: {
|
|
11
|
-
|
|
11
|
+
variants: createVariants({
|
|
12
|
+
type: {
|
|
12
13
|
dialog:
|
|
13
14
|
"border duration-200 left-[50%] top-[50%] grid max-w-lg translate-x-[-50%] translate-y-[-50%] data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
|
|
14
15
|
sheet:
|
|
@@ -22,9 +23,9 @@ export const getDialogContentClasses = cva(
|
|
|
22
23
|
right:
|
|
23
24
|
"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm",
|
|
24
25
|
},
|
|
25
|
-
},
|
|
26
|
+
}),
|
|
26
27
|
defaultVariants: {
|
|
27
|
-
|
|
28
|
+
type: "dialog",
|
|
28
29
|
},
|
|
29
30
|
}
|
|
30
31
|
);
|
|
@@ -1,14 +1,8 @@
|
|
|
1
1
|
import { cva } from "../../libs";
|
|
2
|
+
import { createVariants } from "../../utilities";
|
|
2
3
|
|
|
3
4
|
export const getDockClasses = cva("dock", {
|
|
4
|
-
variants: {
|
|
5
|
-
size: {
|
|
6
|
-
xs: "dock-xs",
|
|
7
|
-
sm: "dock-sm",
|
|
8
|
-
md: "dock-md",
|
|
9
|
-
lg: "dock-lg",
|
|
10
|
-
xl: "dock-xl",
|
|
11
|
-
},
|
|
5
|
+
variants: createVariants({
|
|
12
6
|
variant: {
|
|
13
7
|
accent: "bg-accent text-accent-content border-accent",
|
|
14
8
|
default: "bg-default text-default-content border-default",
|
|
@@ -24,7 +18,14 @@ export const getDockClasses = cva("dock", {
|
|
|
24
18
|
outline: {
|
|
25
19
|
true: "border bg-default",
|
|
26
20
|
},
|
|
27
|
-
|
|
21
|
+
size: {
|
|
22
|
+
xs: "dock-xs",
|
|
23
|
+
sm: "dock-sm",
|
|
24
|
+
md: "dock-md",
|
|
25
|
+
lg: "dock-lg",
|
|
26
|
+
xl: "dock-xl",
|
|
27
|
+
},
|
|
28
|
+
}),
|
|
28
29
|
compoundVariants: [
|
|
29
30
|
{ outline: true, variant: "accent", className: "text-accent" },
|
|
30
31
|
{ outline: true, variant: "default", className: "text-default" },
|
|
@@ -40,15 +41,15 @@ export const getDockClasses = cva("dock", {
|
|
|
40
41
|
});
|
|
41
42
|
|
|
42
43
|
export const getDockButtonClasses = cva("", {
|
|
43
|
-
variants: {
|
|
44
|
+
variants: createVariants({
|
|
44
45
|
active: {
|
|
45
46
|
true: "dock-active",
|
|
46
47
|
},
|
|
47
|
-
},
|
|
48
|
+
}),
|
|
48
49
|
});
|
|
49
50
|
|
|
50
51
|
export const getDockIconClasses = cva("", {
|
|
51
|
-
variants: {
|
|
52
|
+
variants: createVariants({
|
|
52
53
|
size: {
|
|
53
54
|
xs: "size-3",
|
|
54
55
|
sm: "size-4",
|
|
@@ -56,7 +57,7 @@ export const getDockIconClasses = cva("", {
|
|
|
56
57
|
lg: "size-6",
|
|
57
58
|
xl: "size-6",
|
|
58
59
|
},
|
|
59
|
-
},
|
|
60
|
+
}),
|
|
60
61
|
});
|
|
61
62
|
|
|
62
63
|
export const getDockLabelClasses = cva("dock-label");
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { DropAnimation } from "@dnd-kit/core";
|
|
2
2
|
import { CSS } from "@dnd-kit/utilities";
|
|
3
3
|
import { cva } from "../../../libs";
|
|
4
|
+
import { createVariants } from "../../../utilities";
|
|
4
5
|
|
|
5
6
|
export const DROP_ANIMATION_CONFIG: DropAnimation = {
|
|
6
7
|
keyframes({ transform }) {
|
|
@@ -27,21 +28,21 @@ export const DROP_ANIMATION_CONFIG: DropAnimation = {
|
|
|
27
28
|
export const getDraggableClasses = cva(
|
|
28
29
|
"translate-x-(--translate-x) translate-y-(--translate-y) translate-z-0",
|
|
29
30
|
{
|
|
30
|
-
variants: {
|
|
31
|
+
variants: createVariants({
|
|
31
32
|
isDragging: {
|
|
32
33
|
true: "transition-none z-10 cursor-grabbing",
|
|
33
34
|
},
|
|
34
|
-
},
|
|
35
|
+
}),
|
|
35
36
|
}
|
|
36
37
|
);
|
|
37
38
|
|
|
38
39
|
export const getDraggableRootClasses = cva("relative", {
|
|
39
|
-
variants: {
|
|
40
|
+
variants: createVariants({
|
|
40
41
|
isDragging: {
|
|
41
42
|
true: "",
|
|
42
43
|
},
|
|
43
44
|
isDragOverlay: {
|
|
44
45
|
true: "",
|
|
45
46
|
},
|
|
46
|
-
},
|
|
47
|
+
}),
|
|
47
48
|
});
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { cva } from "../../../libs";
|
|
2
|
+
import { createVariants } from "../../../utilities";
|
|
2
3
|
|
|
3
4
|
export const getDroppableClasses = cva("relative", {
|
|
4
|
-
variants: {
|
|
5
|
+
variants: createVariants({
|
|
5
6
|
isDragging: {
|
|
6
7
|
true: "",
|
|
7
8
|
},
|
|
@@ -11,5 +12,5 @@ export const getDroppableClasses = cva("relative", {
|
|
|
11
12
|
isEmpty: {
|
|
12
13
|
true: "",
|
|
13
14
|
},
|
|
14
|
-
},
|
|
15
|
+
}),
|
|
15
16
|
});
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { cva } from "../../../libs";
|
|
2
|
+
import { createVariants } from "../../../utilities";
|
|
2
3
|
|
|
3
4
|
export const getSortableClasses = cva("", {
|
|
4
|
-
variants: {
|
|
5
|
+
variants: createVariants({
|
|
5
6
|
isDragging: {
|
|
6
7
|
true: "",
|
|
7
8
|
},
|
|
8
9
|
isSorting: {
|
|
9
10
|
true: "",
|
|
10
11
|
},
|
|
11
|
-
},
|
|
12
|
+
}),
|
|
12
13
|
});
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { cn } from "../../utilities";
|
|
3
|
+
import {
|
|
4
|
+
getEmptyClasses,
|
|
5
|
+
getEmptyDescriptionClasses,
|
|
6
|
+
getEmptyImageClasses,
|
|
7
|
+
getEmptyTitleClasses,
|
|
8
|
+
} from "./constants";
|
|
9
|
+
import { type EmptyProps } from "./types";
|
|
10
|
+
|
|
11
|
+
export const Empty = React.forwardRef<HTMLDivElement, EmptyProps>(
|
|
12
|
+
({ className, size, children, ...props }, ref) => {
|
|
13
|
+
return (
|
|
14
|
+
<div ref={ref} className={cn(getEmptyClasses({ size }), className)} {...props}>
|
|
15
|
+
{children}
|
|
16
|
+
</div>
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
);
|
|
20
|
+
Empty.displayName = "Empty";
|
|
21
|
+
|
|
22
|
+
export const EmptyImage = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
|
|
23
|
+
({ className, children, ...props }, ref) => {
|
|
24
|
+
return (
|
|
25
|
+
<div ref={ref} className={cn(getEmptyImageClasses(), className)} {...props}>
|
|
26
|
+
{children}
|
|
27
|
+
</div>
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
EmptyImage.displayName = "EmptyImage";
|
|
32
|
+
|
|
33
|
+
export const EmptyTitle = React.forwardRef<
|
|
34
|
+
HTMLHeadingElement,
|
|
35
|
+
React.HTMLAttributes<HTMLHeadingElement>
|
|
36
|
+
>(({ className, children, ...props }, ref) => {
|
|
37
|
+
return (
|
|
38
|
+
<h3 ref={ref} className={cn(getEmptyTitleClasses(), className)} {...props}>
|
|
39
|
+
{children}
|
|
40
|
+
</h3>
|
|
41
|
+
);
|
|
42
|
+
});
|
|
43
|
+
EmptyTitle.displayName = "EmptyTitle";
|
|
44
|
+
|
|
45
|
+
export const EmptyDescription = React.forwardRef<
|
|
46
|
+
HTMLParagraphElement,
|
|
47
|
+
React.HTMLAttributes<HTMLParagraphElement>
|
|
48
|
+
>(({ className, children, ...props }, ref) => {
|
|
49
|
+
return (
|
|
50
|
+
<p ref={ref} className={cn(getEmptyDescriptionClasses(), className)} {...props}>
|
|
51
|
+
{children}
|
|
52
|
+
</p>
|
|
53
|
+
);
|
|
54
|
+
});
|
|
55
|
+
EmptyDescription.displayName = "EmptyDescription";
|
|
56
|
+
|
|
57
|
+
export const EmptyActions = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
|
|
58
|
+
({ className, children, ...props }, ref) => {
|
|
59
|
+
return (
|
|
60
|
+
<div ref={ref} className={cn("flex items-center gap-2", className)} {...props}>
|
|
61
|
+
{children}
|
|
62
|
+
</div>
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
);
|
|
66
|
+
EmptyActions.displayName = "EmptyActions";
|