@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
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { cva } from "../../libs";
|
|
2
|
+
import { createVariants } from "../../utilities";
|
|
3
|
+
|
|
4
|
+
export const getSheetClasses = cva(
|
|
5
|
+
"fixed z-50 bg-base-100 shadow-xl transition-transform duration-300 ease-in-out",
|
|
6
|
+
{
|
|
7
|
+
variants: createVariants({
|
|
8
|
+
side: {
|
|
9
|
+
top: "top-0 left-0 right-0 border-b border-base-200",
|
|
10
|
+
bottom: "bottom-0 left-0 right-0 border-t border-base-200",
|
|
11
|
+
left: "top-0 bottom-0 left-0 border-r border-base-200 h-full",
|
|
12
|
+
right: "top-0 bottom-0 right-0 border-l border-base-200 h-full",
|
|
13
|
+
},
|
|
14
|
+
open: {
|
|
15
|
+
true: "translate-x-0 translate-y-0",
|
|
16
|
+
false: "invisible", // Base invisible state, transforms handled by compound variants
|
|
17
|
+
},
|
|
18
|
+
}),
|
|
19
|
+
compoundVariants: [
|
|
20
|
+
{ side: "top", open: false, class: "-translate-y-full" },
|
|
21
|
+
{ side: "bottom", open: false, class: "translate-y-full" },
|
|
22
|
+
{ side: "left", open: false, class: "-translate-x-full" },
|
|
23
|
+
{ side: "right", open: false, class: "translate-x-full" },
|
|
24
|
+
],
|
|
25
|
+
defaultVariants: {
|
|
26
|
+
side: "right",
|
|
27
|
+
open: false,
|
|
28
|
+
},
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
export const getSheetOverlayClasses = cva(
|
|
33
|
+
"fixed inset-0 z-40 bg-black/50 transition-opacity duration-300",
|
|
34
|
+
{
|
|
35
|
+
variants: createVariants({
|
|
36
|
+
open: {
|
|
37
|
+
true: "opacity-100",
|
|
38
|
+
false: "opacity-0 pointer-events-none",
|
|
39
|
+
},
|
|
40
|
+
}),
|
|
41
|
+
defaultVariants: {
|
|
42
|
+
open: false,
|
|
43
|
+
},
|
|
44
|
+
}
|
|
45
|
+
);
|
|
@@ -41,7 +41,7 @@ import { SidebarContext } from "./SidebarContext";
|
|
|
41
41
|
|
|
42
42
|
const Sidebar = ({
|
|
43
43
|
side = "left",
|
|
44
|
-
|
|
44
|
+
type = "sidebar",
|
|
45
45
|
collapsible = "offcanvas",
|
|
46
46
|
className,
|
|
47
47
|
children,
|
|
@@ -62,7 +62,7 @@ const Sidebar = ({
|
|
|
62
62
|
<Dialog open={openMobile} onOpenChange={setOpenMobile} {...props}>
|
|
63
63
|
<Dialog.Content
|
|
64
64
|
side={side}
|
|
65
|
-
|
|
65
|
+
type="sheet"
|
|
66
66
|
data-mobile="true"
|
|
67
67
|
data-sidebar="sidebar"
|
|
68
68
|
className={cn(getSidebarMobileClasses({ isMobile }), className)}
|
|
@@ -83,12 +83,12 @@ const Sidebar = ({
|
|
|
83
83
|
data-side={side}
|
|
84
84
|
data-state={state}
|
|
85
85
|
data-collapsible={state === "collapsed" ? collapsible : ""}
|
|
86
|
-
data-variant={
|
|
86
|
+
data-variant={type}
|
|
87
87
|
className={getSidebarOuterClasses()}
|
|
88
88
|
>
|
|
89
89
|
{/* This is what handles the sidebar gap on desktop */}
|
|
90
|
-
<div className={getSidebarGapClasses({
|
|
91
|
-
<div className={getSidebarInnerClasses({ side,
|
|
90
|
+
<div className={getSidebarGapClasses({ type })} />
|
|
91
|
+
<div className={getSidebarInnerClasses({ side, type })} {...props}>
|
|
92
92
|
<div
|
|
93
93
|
data-sidebar="sidebar"
|
|
94
94
|
className={cn(getSidebarMobileClasses({ isMobile }), className)}
|
|
@@ -51,8 +51,8 @@ const SidebarMenuButton = forwardRef<HTMLButtonElement, SidebarMenuButtonProps>(
|
|
|
51
51
|
{
|
|
52
52
|
asChild = false,
|
|
53
53
|
isActive = false,
|
|
54
|
-
|
|
55
|
-
size = "
|
|
54
|
+
outline = false,
|
|
55
|
+
size = "md",
|
|
56
56
|
tooltip,
|
|
57
57
|
className,
|
|
58
58
|
...props
|
|
@@ -68,7 +68,7 @@ const SidebarMenuButton = forwardRef<HTMLButtonElement, SidebarMenuButtonProps>(
|
|
|
68
68
|
data-sidebar="menu-button"
|
|
69
69
|
data-size={size}
|
|
70
70
|
data-active={isActive}
|
|
71
|
-
className={cn(getSidebarMenuButtonClasses({
|
|
71
|
+
className={cn(getSidebarMenuButtonClasses({ outline, size }), className)}
|
|
72
72
|
{...props}
|
|
73
73
|
/>
|
|
74
74
|
);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { cva } from "../../libs";
|
|
2
|
+
import { createVariants } from "../../utilities";
|
|
2
3
|
|
|
3
4
|
export const SIDEBAR_COOKIE_NAME = "sidebar:state";
|
|
4
5
|
|
|
@@ -13,21 +14,21 @@ export const SIDEBAR_WIDTH_ICON = "3rem";
|
|
|
13
14
|
export const SIDEBAR_KEYBOARD_SHORTCUT = "b";
|
|
14
15
|
|
|
15
16
|
export const getSidebarClasses = cva([], {
|
|
16
|
-
variants: {
|
|
17
|
+
variants: createVariants({
|
|
17
18
|
collapsible: {
|
|
18
19
|
none: "flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground",
|
|
19
20
|
},
|
|
20
|
-
},
|
|
21
|
+
}),
|
|
21
22
|
});
|
|
22
23
|
|
|
23
24
|
export const getSidebarMobileClasses = cva([], {
|
|
24
|
-
variants: {
|
|
25
|
+
variants: createVariants({
|
|
25
26
|
isMobile: {
|
|
26
27
|
true: "w-(--sidebar-width) bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden",
|
|
27
28
|
false:
|
|
28
29
|
"flex h-full w-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:border-sidebar-border group-data-[variant=floating]:shadow-sm",
|
|
29
30
|
},
|
|
30
|
-
},
|
|
31
|
+
}),
|
|
31
32
|
});
|
|
32
33
|
|
|
33
34
|
export const getSidebarOuterClasses = cva("group peer hidden md:block text-sidebar-foreground");
|
|
@@ -35,12 +36,12 @@ export const getSidebarOuterClasses = cva("group peer hidden md:block text-sideb
|
|
|
35
36
|
export const getSidebarInnerClasses = cva(
|
|
36
37
|
"duration-200 fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] ease-linear md:flex",
|
|
37
38
|
{
|
|
38
|
-
variants: {
|
|
39
|
+
variants: createVariants({
|
|
39
40
|
side: {
|
|
40
41
|
left: "left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]",
|
|
41
42
|
right: "right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",
|
|
42
43
|
},
|
|
43
|
-
|
|
44
|
+
type: {
|
|
44
45
|
floating:
|
|
45
46
|
"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]",
|
|
46
47
|
inset:
|
|
@@ -48,7 +49,7 @@ export const getSidebarInnerClasses = cva(
|
|
|
48
49
|
sidebar:
|
|
49
50
|
"group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l",
|
|
50
51
|
},
|
|
51
|
-
},
|
|
52
|
+
}),
|
|
52
53
|
}
|
|
53
54
|
);
|
|
54
55
|
|
|
@@ -59,18 +60,17 @@ export const getSidebarGapClasses = cva(
|
|
|
59
60
|
"group-data-[side=right]:rotate-180",
|
|
60
61
|
],
|
|
61
62
|
{
|
|
62
|
-
variants: {
|
|
63
|
-
|
|
63
|
+
variants: createVariants({
|
|
64
|
+
type: {
|
|
64
65
|
floating:
|
|
65
66
|
"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]",
|
|
66
|
-
inset:
|
|
67
|
-
"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]",
|
|
67
|
+
inset: "group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]",
|
|
68
68
|
sidebar: "group-data-[collapsible=icon]:w-(--sidebar-width-icon)",
|
|
69
69
|
},
|
|
70
|
-
},
|
|
70
|
+
}),
|
|
71
71
|
compoundVariants: [
|
|
72
72
|
{
|
|
73
|
-
|
|
73
|
+
type: null,
|
|
74
74
|
className: "group-data-[collapsible=icon]:w-(--sidebar-width-icon)",
|
|
75
75
|
},
|
|
76
76
|
],
|
|
@@ -135,22 +135,29 @@ export const getSidebarMenuItemClasses = cva("group/menu-item relative");
|
|
|
135
135
|
export const getSidebarMenuButtonClasses = cva(
|
|
136
136
|
"peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-data-[sidebar=menu-action]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",
|
|
137
137
|
{
|
|
138
|
-
variants: {
|
|
138
|
+
variants: createVariants({
|
|
139
|
+
outline: {
|
|
140
|
+
true: "bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]",
|
|
141
|
+
},
|
|
139
142
|
variant: {
|
|
140
|
-
default: "
|
|
141
|
-
outline:
|
|
142
|
-
"bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]",
|
|
143
|
+
default: "",
|
|
143
144
|
},
|
|
144
145
|
size: {
|
|
145
|
-
default: "h-8 text-sm",
|
|
146
146
|
sm: "h-7 text-xs",
|
|
147
|
+
md: "h-8 text-sm",
|
|
147
148
|
lg: "h-12 text-sm group-data-[collapsible=icon]:p-0!",
|
|
148
149
|
},
|
|
149
|
-
},
|
|
150
|
+
}),
|
|
150
151
|
defaultVariants: {
|
|
151
|
-
|
|
152
|
-
size: "
|
|
152
|
+
outline: false,
|
|
153
|
+
size: "md",
|
|
153
154
|
},
|
|
155
|
+
compoundVariants: [
|
|
156
|
+
{
|
|
157
|
+
outline: false,
|
|
158
|
+
className: "hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",
|
|
159
|
+
},
|
|
160
|
+
],
|
|
154
161
|
}
|
|
155
162
|
);
|
|
156
163
|
|
|
@@ -165,11 +172,11 @@ export const getSidebarMenuActionClasses = cva(
|
|
|
165
172
|
"group-data-[collapsible=icon]:hidden",
|
|
166
173
|
],
|
|
167
174
|
{
|
|
168
|
-
variants: {
|
|
175
|
+
variants: createVariants({
|
|
169
176
|
showOnHover: {
|
|
170
177
|
true: "group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 peer-data-[active=true]/menu-button:text-sidebar-accent-foreground md:opacity-0",
|
|
171
178
|
},
|
|
172
|
-
},
|
|
179
|
+
}),
|
|
173
180
|
}
|
|
174
181
|
);
|
|
175
182
|
|
|
@@ -196,11 +203,11 @@ export const getSidebarMenuSubItemClasses = cva(
|
|
|
196
203
|
"group-data-[collapsible=icon]:hidden",
|
|
197
204
|
],
|
|
198
205
|
{
|
|
199
|
-
variants: {
|
|
206
|
+
variants: createVariants({
|
|
200
207
|
size: {
|
|
201
208
|
sm: "text-xs",
|
|
202
209
|
md: "text-sm",
|
|
203
210
|
},
|
|
204
|
-
},
|
|
211
|
+
}),
|
|
205
212
|
}
|
|
206
213
|
);
|
|
@@ -17,7 +17,7 @@ export type SidebarContextProps = {
|
|
|
17
17
|
export type SidebarProps = HTMLAttributes<HTMLDivElement> &
|
|
18
18
|
Partial<{
|
|
19
19
|
side: "left" | "right";
|
|
20
|
-
|
|
20
|
+
type: "sidebar" | "floating" | "inset";
|
|
21
21
|
collapsible: "offcanvas" | "icon" | "none";
|
|
22
22
|
}>;
|
|
23
23
|
|
|
@@ -2,10 +2,10 @@ import { cn } from "../../utilities";
|
|
|
2
2
|
import { getSkeletonClasses } from "./constants";
|
|
3
3
|
import { type SkeletonProps } from "./types";
|
|
4
4
|
|
|
5
|
-
export const Skeleton = ({ round, width, height,
|
|
5
|
+
export const Skeleton = ({ round, width, height, animate, className, ...props }: SkeletonProps) => {
|
|
6
6
|
return (
|
|
7
7
|
<div
|
|
8
|
-
className={cn(getSkeletonClasses({ width, height, round,
|
|
8
|
+
className={cn(getSkeletonClasses({ width, height, round, animate }), className)}
|
|
9
9
|
{...props}
|
|
10
10
|
/>
|
|
11
11
|
);
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { cva } from "../../libs";
|
|
2
|
+
import { createVariants } from "../../utilities";
|
|
2
3
|
|
|
3
4
|
export const getSkeletonClasses = cva("skeleton", {
|
|
4
|
-
variants: {
|
|
5
|
-
|
|
5
|
+
variants: createVariants({
|
|
6
|
+
animate: { pulse: "animate-pulse" },
|
|
6
7
|
width: {
|
|
7
8
|
2: "w-2",
|
|
8
9
|
4: "w-4",
|
|
@@ -31,7 +32,7 @@ export const getSkeletonClasses = cva("skeleton", {
|
|
|
31
32
|
true: "rounded-full",
|
|
32
33
|
false: "rounded-md",
|
|
33
34
|
},
|
|
34
|
-
},
|
|
35
|
+
}),
|
|
35
36
|
defaultVariants: {
|
|
36
37
|
width: "full",
|
|
37
38
|
height: 4,
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { cva } from "../../libs";
|
|
2
|
+
import { createVariants } from "../../utilities";
|
|
2
3
|
|
|
3
4
|
export const getToastClasses = cva("sonner group", {
|
|
4
|
-
variants: {
|
|
5
|
+
variants: createVariants({
|
|
5
6
|
variant: {
|
|
6
7
|
accent: "bg-accent text-accent-content border-accent",
|
|
7
8
|
default: "bg-default text-default-content border-default",
|
|
@@ -17,7 +18,7 @@ export const getToastClasses = cva("sonner group", {
|
|
|
17
18
|
outline: {
|
|
18
19
|
true: "border bg-default",
|
|
19
20
|
},
|
|
20
|
-
},
|
|
21
|
+
}),
|
|
21
22
|
compoundVariants: [
|
|
22
23
|
{ outline: true, variant: "accent", className: "text-accent" },
|
|
23
24
|
{ outline: true, variant: "default", className: "text-default" },
|
|
@@ -36,9 +37,9 @@ export const getToastClasses = cva("sonner group", {
|
|
|
36
37
|
});
|
|
37
38
|
|
|
38
39
|
export const getToastButtonClasses = cva("", {
|
|
39
|
-
variants: {
|
|
40
|
+
variants: createVariants({
|
|
40
41
|
variant: {
|
|
41
|
-
|
|
42
|
+
default: "group-[.sonner]:bg-base-300! group-[.sonner]:text-base-content!",
|
|
42
43
|
accent: "group-[.sonner]:bg-accent! group-[.sonner]:text-accent-content!",
|
|
43
44
|
error: "group-[.sonner]:bg-error! group-[.sonner]:text-error-content!",
|
|
44
45
|
info: "group-[.sonner]:bg-info! group-[.sonner]:text-info-content!",
|
|
@@ -51,7 +52,7 @@ export const getToastButtonClasses = cva("", {
|
|
|
51
52
|
outline: {
|
|
52
53
|
true: "group-[.sonner]:border! group-[.sonner]:border-solid! group-[.sonner]:bg-transparent!",
|
|
53
54
|
},
|
|
54
|
-
},
|
|
55
|
+
}),
|
|
55
56
|
compoundVariants: [
|
|
56
57
|
{
|
|
57
58
|
outline: true,
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { cn } from "../../utilities";
|
|
3
|
+
import { getSpacerClasses } from "./constants";
|
|
4
|
+
import { type SpacerProps } from "./types";
|
|
5
|
+
|
|
6
|
+
export const Spacer = React.forwardRef<HTMLDivElement, SpacerProps>(
|
|
7
|
+
({ className, axis, gap, ...props }, ref) => {
|
|
8
|
+
return (
|
|
9
|
+
<div
|
|
10
|
+
ref={ref}
|
|
11
|
+
aria-hidden="true"
|
|
12
|
+
className={cn(getSpacerClasses({ axis, gap }), className)}
|
|
13
|
+
{...props}
|
|
14
|
+
/>
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
Spacer.displayName = "Spacer";
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { cva } from "../../libs";
|
|
2
|
+
import { createVariants } from "../../utilities";
|
|
3
|
+
|
|
4
|
+
export const getSpacerClasses = cva("", {
|
|
5
|
+
variants: createVariants({
|
|
6
|
+
axis: {
|
|
7
|
+
horizontal: "flex-shrink-0",
|
|
8
|
+
vertical: "flex-shrink-0",
|
|
9
|
+
},
|
|
10
|
+
gap: {
|
|
11
|
+
1: "",
|
|
12
|
+
2: "",
|
|
13
|
+
3: "",
|
|
14
|
+
4: "",
|
|
15
|
+
5: "",
|
|
16
|
+
6: "",
|
|
17
|
+
8: "",
|
|
18
|
+
10: "",
|
|
19
|
+
12: "",
|
|
20
|
+
16: "",
|
|
21
|
+
20: "",
|
|
22
|
+
24: "",
|
|
23
|
+
},
|
|
24
|
+
}),
|
|
25
|
+
compoundVariants: [
|
|
26
|
+
{ axis: "horizontal", gap: 1, className: "w-1" },
|
|
27
|
+
{ axis: "horizontal", gap: 2, className: "w-2" },
|
|
28
|
+
{ axis: "horizontal", gap: 3, className: "w-3" },
|
|
29
|
+
{ axis: "horizontal", gap: 4, className: "w-4" },
|
|
30
|
+
{ axis: "horizontal", gap: 5, className: "w-5" },
|
|
31
|
+
{ axis: "horizontal", gap: 6, className: "w-6" },
|
|
32
|
+
{ axis: "horizontal", gap: 8, className: "w-8" },
|
|
33
|
+
{ axis: "horizontal", gap: 10, className: "w-10" },
|
|
34
|
+
{ axis: "horizontal", gap: 12, className: "w-12" },
|
|
35
|
+
{ axis: "horizontal", gap: 16, className: "w-16" },
|
|
36
|
+
{ axis: "horizontal", gap: 20, className: "w-20" },
|
|
37
|
+
{ axis: "horizontal", gap: 24, className: "w-24" },
|
|
38
|
+
{ axis: "vertical", gap: 1, className: "h-1" },
|
|
39
|
+
{ axis: "vertical", gap: 2, className: "h-2" },
|
|
40
|
+
{ axis: "vertical", gap: 3, className: "h-3" },
|
|
41
|
+
{ axis: "vertical", gap: 4, className: "h-4" },
|
|
42
|
+
{ axis: "vertical", gap: 5, className: "h-5" },
|
|
43
|
+
{ axis: "vertical", gap: 6, className: "h-6" },
|
|
44
|
+
{ axis: "vertical", gap: 8, className: "h-8" },
|
|
45
|
+
{ axis: "vertical", gap: 10, className: "h-10" },
|
|
46
|
+
{ axis: "vertical", gap: 12, className: "h-12" },
|
|
47
|
+
{ axis: "vertical", gap: 16, className: "h-16" },
|
|
48
|
+
{ axis: "vertical", gap: 20, className: "h-20" },
|
|
49
|
+
{ axis: "vertical", gap: 24, className: "h-24" },
|
|
50
|
+
],
|
|
51
|
+
defaultVariants: {
|
|
52
|
+
axis: "vertical",
|
|
53
|
+
gap: 4,
|
|
54
|
+
},
|
|
55
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Loader2Icon } from "lucide-react";
|
|
3
|
+
import { cn } from "../../utilities";
|
|
4
|
+
import { getSpinnerClasses } from "./constants";
|
|
5
|
+
import { type SpinnerProps } from "./types";
|
|
6
|
+
|
|
7
|
+
export const Spinner = React.forwardRef<HTMLDivElement, SpinnerProps>(
|
|
8
|
+
({ className, size, variant, ...props }, ref) => {
|
|
9
|
+
return (
|
|
10
|
+
<div
|
|
11
|
+
ref={ref}
|
|
12
|
+
role="status"
|
|
13
|
+
aria-label="Loading"
|
|
14
|
+
className={cn(getSpinnerClasses({ size, variant }), className)}
|
|
15
|
+
{...props}
|
|
16
|
+
>
|
|
17
|
+
<Loader2Icon className="h-full w-full" />
|
|
18
|
+
<span className="sr-only">Loading...</span>
|
|
19
|
+
</div>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
Spinner.displayName = "Spinner";
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { cva } from "../../libs";
|
|
2
|
+
import { createVariants } from "../../utilities";
|
|
3
|
+
|
|
4
|
+
export const getSpinnerClasses = cva("animate-spin", {
|
|
5
|
+
variants: createVariants({
|
|
6
|
+
size: {
|
|
7
|
+
xs: "h-3 w-3",
|
|
8
|
+
sm: "h-4 w-4",
|
|
9
|
+
md: "h-6 w-6",
|
|
10
|
+
lg: "h-8 w-8",
|
|
11
|
+
xl: "h-12 w-12",
|
|
12
|
+
},
|
|
13
|
+
variant: {
|
|
14
|
+
default: "text-base-content",
|
|
15
|
+
primary: "text-primary",
|
|
16
|
+
secondary: "text-secondary",
|
|
17
|
+
accent: "text-accent",
|
|
18
|
+
info: "text-info",
|
|
19
|
+
success: "text-success",
|
|
20
|
+
warning: "text-warning",
|
|
21
|
+
error: "text-error",
|
|
22
|
+
ghost: "text-base-content/50",
|
|
23
|
+
},
|
|
24
|
+
}),
|
|
25
|
+
defaultVariants: {
|
|
26
|
+
size: "md",
|
|
27
|
+
variant: "default",
|
|
28
|
+
},
|
|
29
|
+
});
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { cva } from "../../libs";
|
|
2
|
+
import { createVariants } from "../../utilities";
|
|
2
3
|
|
|
3
4
|
export const getStackClasses = cva("stack", {
|
|
4
|
-
variants: {
|
|
5
|
+
variants: createVariants({
|
|
5
6
|
direction: {
|
|
6
7
|
start: "stack-start",
|
|
7
8
|
end: "stack-end",
|
|
8
9
|
top: "stack-top",
|
|
9
10
|
bottom: "stack-bottom",
|
|
10
11
|
},
|
|
11
|
-
},
|
|
12
|
+
}),
|
|
12
13
|
});
|
|
@@ -1,25 +1,26 @@
|
|
|
1
1
|
import { cva } from "../../libs";
|
|
2
|
+
import { createVariants } from "../../utilities";
|
|
2
3
|
|
|
3
4
|
export const getStatsClasses = cva("stats", {
|
|
4
|
-
variants: {
|
|
5
|
+
variants: createVariants({
|
|
5
6
|
direction: {
|
|
6
7
|
horizontal: "stats-horizontal",
|
|
7
8
|
vertical: "stats-vertical",
|
|
8
9
|
},
|
|
9
|
-
},
|
|
10
|
+
}),
|
|
10
11
|
defaultVariants: {
|
|
11
12
|
direction: "horizontal",
|
|
12
13
|
},
|
|
13
14
|
});
|
|
14
15
|
|
|
15
16
|
export const getStatClasses = cva("stat", {
|
|
16
|
-
variants: {
|
|
17
|
+
variants: createVariants({
|
|
17
18
|
position: {
|
|
18
19
|
center: "place-items-center",
|
|
19
20
|
start: "place-items-start",
|
|
20
21
|
end: "place-items-end",
|
|
21
22
|
},
|
|
22
|
-
},
|
|
23
|
+
}),
|
|
23
24
|
});
|
|
24
25
|
|
|
25
26
|
export const getStatTitleClasses = cva("stat-title");
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { cva } from "../../libs";
|
|
2
|
+
import { createVariants } from "../../utilities";
|
|
2
3
|
|
|
3
4
|
export const getStatusClasses = cva("status", {
|
|
4
|
-
variants: {
|
|
5
|
+
variants: createVariants({
|
|
5
6
|
variant: {
|
|
6
7
|
accent: "status-accent",
|
|
7
8
|
default: "",
|
|
@@ -27,5 +28,5 @@ export const getStatusClasses = cva("status", {
|
|
|
27
28
|
pulse: "animate-pulse",
|
|
28
29
|
spin: "animate-spin",
|
|
29
30
|
},
|
|
30
|
-
},
|
|
31
|
+
}),
|
|
31
32
|
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { cn } from "../../utilities";
|
|
3
|
+
import { getStepClasses, getStepperClasses } from "./constants";
|
|
4
|
+
import { type StepperProps, type StepProps } from "./types";
|
|
5
|
+
|
|
6
|
+
export const Stepper = React.forwardRef<HTMLUListElement, StepperProps>(
|
|
7
|
+
({ className, orientation = "horizontal", children, ...props }, ref) => {
|
|
8
|
+
return (
|
|
9
|
+
<ul ref={ref} className={cn(getStepperClasses({ orientation }), className)} {...props}>
|
|
10
|
+
{children}
|
|
11
|
+
</ul>
|
|
12
|
+
);
|
|
13
|
+
}
|
|
14
|
+
);
|
|
15
|
+
Stepper.displayName = "Stepper";
|
|
16
|
+
|
|
17
|
+
export const Step = React.forwardRef<HTMLLIElement, StepProps>(
|
|
18
|
+
({ className, variant, active, children, ...props }, ref) => {
|
|
19
|
+
return (
|
|
20
|
+
<li
|
|
21
|
+
ref={ref}
|
|
22
|
+
className={cn(getStepClasses({ variant: active ? "primary" : variant }), className)}
|
|
23
|
+
{...props}
|
|
24
|
+
>
|
|
25
|
+
{children}
|
|
26
|
+
</li>
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
Step.displayName = "Step";
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { cva } from "../../libs";
|
|
2
|
+
import { createVariants } from "../../utilities";
|
|
3
|
+
|
|
4
|
+
export const getStepperClasses = cva("steps w-full", {
|
|
5
|
+
variants: createVariants({
|
|
6
|
+
orientation: {
|
|
7
|
+
horizontal: "steps-horizontal",
|
|
8
|
+
vertical: "steps-vertical",
|
|
9
|
+
},
|
|
10
|
+
}),
|
|
11
|
+
defaultVariants: {
|
|
12
|
+
orientation: "horizontal",
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export const getStepClasses = cva("step", {
|
|
17
|
+
variants: createVariants({
|
|
18
|
+
variant: {
|
|
19
|
+
primary: "step-primary",
|
|
20
|
+
secondary: "step-secondary",
|
|
21
|
+
accent: "step-accent",
|
|
22
|
+
info: "step-info",
|
|
23
|
+
success: "step-success",
|
|
24
|
+
warning: "step-warning",
|
|
25
|
+
error: "step-error",
|
|
26
|
+
neutral: "step-neutral",
|
|
27
|
+
},
|
|
28
|
+
}),
|
|
29
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type VariantProps } from "../../libs";
|
|
2
|
+
import { getStepClasses, getStepperClasses } from "./constants";
|
|
3
|
+
|
|
4
|
+
export type StepperProps = React.HTMLAttributes<HTMLUListElement> &
|
|
5
|
+
VariantProps<typeof getStepperClasses>;
|
|
6
|
+
|
|
7
|
+
export type StepProps = React.LiHTMLAttributes<HTMLLIElement> &
|
|
8
|
+
VariantProps<typeof getStepClasses> & {
|
|
9
|
+
active?: boolean; // Convenience prop to apply primary color
|
|
10
|
+
};
|