@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,7 +1,8 @@
|
|
|
1
1
|
import { cva } from "../../libs";
|
|
2
|
+
import { createVariants } from "../../utilities";
|
|
2
3
|
|
|
3
4
|
export const getTableClasses = cva("table", {
|
|
4
|
-
variants: {
|
|
5
|
+
variants: createVariants({
|
|
5
6
|
caption: {
|
|
6
7
|
top: "caption-top",
|
|
7
8
|
bottom: "caption-bottom",
|
|
@@ -21,7 +22,7 @@ export const getTableClasses = cva("table", {
|
|
|
21
22
|
md: "table-md",
|
|
22
23
|
lg: "table-lg",
|
|
23
24
|
},
|
|
24
|
-
},
|
|
25
|
+
}),
|
|
25
26
|
});
|
|
26
27
|
|
|
27
28
|
export const getTableHeaderClasses = cva("[&_tr]:border-b");
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { cva } from "../../libs";
|
|
2
|
+
import { createVariants } from "../../utilities";
|
|
2
3
|
|
|
3
4
|
export const getTextClasses = cva("", {
|
|
4
|
-
variants: {
|
|
5
|
+
variants: createVariants({
|
|
5
6
|
variant: {
|
|
6
7
|
info: "text-info",
|
|
7
8
|
error: "text-error",
|
|
@@ -15,13 +16,9 @@ export const getTextClasses = cva("", {
|
|
|
15
16
|
size: {
|
|
16
17
|
xs: "text-xs",
|
|
17
18
|
sm: "text-sm",
|
|
18
|
-
|
|
19
|
+
md: "text-base",
|
|
19
20
|
lg: "text-lg",
|
|
20
21
|
xl: "text-xl",
|
|
21
|
-
"2xl": "text-2xl",
|
|
22
|
-
"3xl": "text-3xl",
|
|
23
|
-
"4xl": "text-4xl",
|
|
24
|
-
"5xl": "text-5xl",
|
|
25
22
|
},
|
|
26
|
-
},
|
|
23
|
+
}),
|
|
27
24
|
});
|
|
@@ -29,7 +29,7 @@ export const TimelineExample = ({
|
|
|
29
29
|
return (
|
|
30
30
|
<Timeline {...timeline}>
|
|
31
31
|
<Timeline.Item variant="success" {...item}>
|
|
32
|
-
<Timeline.Heading variant="
|
|
32
|
+
<Timeline.Heading variant="default" {...heading}>
|
|
33
33
|
Plan!
|
|
34
34
|
</Timeline.Heading>
|
|
35
35
|
<Timeline.Dot border="primary" status="success" variant="success" {...dot} />
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
import { cva } from "../../libs";
|
|
2
|
+
import { createVariants } from "../../utilities";
|
|
2
3
|
|
|
3
4
|
export const getTimelineClasses = cva("grid", {
|
|
4
|
-
variants: {
|
|
5
|
+
variants: createVariants({
|
|
5
6
|
positions: {
|
|
6
7
|
left: "[&>li]:grid-cols-[0_min-content_1fr]",
|
|
7
8
|
right: "[&>li]:grid-cols-[1fr_min-content]",
|
|
8
9
|
center: "[&>li]:grid-cols-[1fr_min-content_1fr]",
|
|
9
10
|
},
|
|
10
|
-
},
|
|
11
|
+
}),
|
|
11
12
|
defaultVariants: {
|
|
12
13
|
positions: "left",
|
|
13
14
|
},
|
|
14
15
|
});
|
|
15
16
|
|
|
16
17
|
export const getTimelineItemClasses = cva("grid items-center gap-x-2", {
|
|
17
|
-
variants: {
|
|
18
|
+
variants: createVariants({
|
|
18
19
|
variant: {
|
|
19
20
|
info: "text-info",
|
|
20
21
|
error: "text-error",
|
|
@@ -24,15 +25,15 @@ export const getTimelineItemClasses = cva("grid items-center gap-x-2", {
|
|
|
24
25
|
secondary: "text-secondary",
|
|
25
26
|
accent: "text-accent",
|
|
26
27
|
neutral: "text-neutral",
|
|
27
|
-
|
|
28
|
+
default: "text-base-content",
|
|
28
29
|
},
|
|
29
|
-
},
|
|
30
|
+
}),
|
|
30
31
|
});
|
|
31
32
|
|
|
32
33
|
export const getTimelineDotClasses = cva(
|
|
33
34
|
"timeline-dot col-start-2 col-end-3 row-start-1 row-end-1 flex size-4 items-center justify-center rounded-full border",
|
|
34
35
|
{
|
|
35
|
-
variants: {
|
|
36
|
+
variants: createVariants({
|
|
36
37
|
status: {
|
|
37
38
|
default: "*:hidden",
|
|
38
39
|
active: "[&>*:not(.lucide-circle)]:hidden",
|
|
@@ -70,10 +71,10 @@ export const getTimelineDotClasses = cva(
|
|
|
70
71
|
"[&>.lucide-check]:text-accent [&>.lucide-circle]:text-accent [&>.lucide-circle]:fill-accent [&>.lucide-x]:text-accent",
|
|
71
72
|
neutral:
|
|
72
73
|
"[&>.lucide-check]:text-neutral [&>.lucide-circle]:text-neutral [&>.lucide-circle]:fill-neutral [&>.lucide-x]:text-neutral",
|
|
73
|
-
|
|
74
|
+
default:
|
|
74
75
|
"[&>.lucide-check]:text-base-content [&>.lucide-circle]:text-base-content [&>.lucide-circle]:fill-base-content [&>.lucide-x]:text-base-content",
|
|
75
76
|
},
|
|
76
|
-
},
|
|
77
|
+
}),
|
|
77
78
|
defaultVariants: {
|
|
78
79
|
status: "default",
|
|
79
80
|
},
|
|
@@ -137,7 +138,7 @@ export const getTimelineDotClasses = cva(
|
|
|
137
138
|
},
|
|
138
139
|
{
|
|
139
140
|
fill: true,
|
|
140
|
-
variant: "
|
|
141
|
+
variant: "default",
|
|
141
142
|
className:
|
|
142
143
|
"border-base-100 bg-base-100 [&>.lucide-check]:text-base-content [&>.lucide-circle]:fill-base-content [&>.lucide-x]:text-base-content",
|
|
143
144
|
},
|
|
@@ -146,12 +147,12 @@ export const getTimelineDotClasses = cva(
|
|
|
146
147
|
);
|
|
147
148
|
|
|
148
149
|
export const getTimelineContentClasses = cva("row-start-2 row-end-2 pb-8 text-muted-foreground", {
|
|
149
|
-
variants: {
|
|
150
|
+
variants: createVariants({
|
|
150
151
|
side: {
|
|
151
152
|
right: "col-start-3 col-end-4 mr-auto text-left",
|
|
152
153
|
left: "col-start-1 col-end-2 ml-auto text-right",
|
|
153
154
|
},
|
|
154
|
-
},
|
|
155
|
+
}),
|
|
155
156
|
defaultVariants: {
|
|
156
157
|
side: "right",
|
|
157
158
|
},
|
|
@@ -160,7 +161,7 @@ export const getTimelineContentClasses = cva("row-start-2 row-end-2 pb-8 text-mu
|
|
|
160
161
|
export const getTimelineHeadingClasses = cva(
|
|
161
162
|
"row-start-1 row-end-1 line-clamp-1 max-w-full truncate",
|
|
162
163
|
{
|
|
163
|
-
variants: {
|
|
164
|
+
variants: createVariants({
|
|
164
165
|
side: {
|
|
165
166
|
right: "col-start-3 col-end-4 mr-auto text-left",
|
|
166
167
|
left: "col-start-1 col-end-2 ml-auto text-right",
|
|
@@ -174,20 +175,16 @@ export const getTimelineHeadingClasses = cva(
|
|
|
174
175
|
secondary: "text-secondary",
|
|
175
176
|
accent: "text-accent",
|
|
176
177
|
neutral: "text-neutral",
|
|
177
|
-
|
|
178
|
+
default: "text-base-content",
|
|
178
179
|
},
|
|
179
180
|
size: {
|
|
180
181
|
xs: "text-xs",
|
|
181
182
|
sm: "text-sm",
|
|
182
|
-
|
|
183
|
+
md: "text-base",
|
|
183
184
|
lg: "text-lg",
|
|
184
185
|
xl: "text-xl",
|
|
185
|
-
"2xl": "text-2xl",
|
|
186
|
-
"3xl": "text-3xl",
|
|
187
|
-
"4xl": "text-4xl",
|
|
188
|
-
"5xl": "text-5xl",
|
|
189
186
|
},
|
|
190
|
-
},
|
|
187
|
+
}),
|
|
191
188
|
defaultVariants: {
|
|
192
189
|
side: "right",
|
|
193
190
|
},
|
|
@@ -197,7 +194,7 @@ export const getTimelineHeadingClasses = cva(
|
|
|
197
194
|
export const getTimelineLineClasses = cva(
|
|
198
195
|
"bg-base-300 border-none col-start-2 col-end-3 row-start-2 row-end-2 mx-auto flex h-full min-h-16 w-0.5 justify-center rounded-full",
|
|
199
196
|
{
|
|
200
|
-
variants: {
|
|
197
|
+
variants: createVariants({
|
|
201
198
|
variant: {
|
|
202
199
|
info: "bg-info",
|
|
203
200
|
error: "bg-error",
|
|
@@ -207,8 +204,8 @@ export const getTimelineLineClasses = cva(
|
|
|
207
204
|
secondary: "bg-secondary",
|
|
208
205
|
accent: "bg-accent",
|
|
209
206
|
neutral: "bg-neutral",
|
|
210
|
-
|
|
207
|
+
default: "bg-base-content",
|
|
211
208
|
},
|
|
212
|
-
},
|
|
209
|
+
}),
|
|
213
210
|
}
|
|
214
211
|
);
|
|
@@ -8,12 +8,12 @@ import { getToggleClasses } from "./constants";
|
|
|
8
8
|
import { type ToggleProps } from "./types";
|
|
9
9
|
|
|
10
10
|
const Toggle = React.forwardRef<React.ElementRef<typeof TogglePrimitive.Root>, ToggleProps>(
|
|
11
|
-
({ className, variant = "default", size, wide, outline, ...props }, ref) => (
|
|
11
|
+
({ className, variant = "default", link, size, wide, outline, ...props }, ref) => (
|
|
12
12
|
<TogglePrimitive.Root
|
|
13
13
|
ref={ref}
|
|
14
14
|
className={cn(
|
|
15
|
-
getButtonClasses({ size, wide, outline }),
|
|
16
|
-
getToggleClasses({ variant, outline }),
|
|
15
|
+
getButtonClasses({ link, size, wide, outline }),
|
|
16
|
+
getToggleClasses({ link, variant, outline }),
|
|
17
17
|
className
|
|
18
18
|
)}
|
|
19
19
|
{...props}
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import { cva } from "../../libs";
|
|
2
|
+
import { createVariants } from "../../utilities";
|
|
2
3
|
|
|
3
4
|
export const getToggleClasses = cva(
|
|
4
5
|
"transition-colors disabled:pointer-events-none disabled:opacity-50 data-[state=off]:btn-ghost",
|
|
5
6
|
{
|
|
6
|
-
variants: {
|
|
7
|
+
variants: createVariants({
|
|
8
|
+
link: {
|
|
9
|
+
true: "data-[state=on]:btn-link",
|
|
10
|
+
},
|
|
7
11
|
variant: {
|
|
8
12
|
accent: "data-[state=on]:btn-accent",
|
|
9
13
|
default: "data-[state=on]:btn-default",
|
|
10
14
|
error: "data-[state=on]:btn-error",
|
|
11
15
|
info: "data-[state=on]:btn-info",
|
|
12
|
-
link: "data-[state=on]:btn-link",
|
|
13
16
|
neutral: "data-[state=on]:btn-neutral",
|
|
14
17
|
primary: "data-[state=on]:btn-primary",
|
|
15
18
|
secondary: "data-[state=on]:btn-secondary",
|
|
@@ -19,7 +22,7 @@ export const getToggleClasses = cva(
|
|
|
19
22
|
outline: {
|
|
20
23
|
true: "data-[state=on]:btn-outline",
|
|
21
24
|
},
|
|
22
|
-
},
|
|
25
|
+
}),
|
|
23
26
|
compoundVariants: [
|
|
24
27
|
{
|
|
25
28
|
outline: true,
|
|
@@ -21,15 +21,17 @@ const ToggleGroup = ({ className, variant, children, ...props }: ToggleGroupProp
|
|
|
21
21
|
const ToggleGroupItem = forwardRef<
|
|
22
22
|
React.ElementRef<typeof ToggleGroupPrimitive.Item>,
|
|
23
23
|
ToggleGroupItemProps
|
|
24
|
-
>(({ className, children, variant, size, wide, outline, ...props }, ref) => {
|
|
24
|
+
>(({ className, children, variant, size, link, wide, outline, ...props }, ref) => {
|
|
25
25
|
const context = useContext(ToggleGroupContext);
|
|
26
26
|
|
|
27
27
|
return (
|
|
28
28
|
<ToggleGroupPrimitive.Item
|
|
29
29
|
ref={ref}
|
|
30
30
|
className={cn(
|
|
31
|
-
getButtonClasses({ size, wide, outline }),
|
|
31
|
+
getButtonClasses({ link, size, wide, outline }),
|
|
32
32
|
getToggleClasses({
|
|
33
|
+
link,
|
|
34
|
+
outline,
|
|
33
35
|
variant: context.variant ?? variant,
|
|
34
36
|
}),
|
|
35
37
|
className
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { cva } from "../../libs";
|
|
2
|
+
import { createVariants } from "../../utilities";
|
|
2
3
|
|
|
3
4
|
export const getTooltipContentClasses = cva(
|
|
4
5
|
"bg-base-200 text-base-content z-50 overflow-hidden rounded-md px-3 py-1.5 text-xs animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
|
5
6
|
{
|
|
6
|
-
variants: {
|
|
7
|
+
variants: createVariants({
|
|
7
8
|
variant: {
|
|
8
9
|
primary: "bg-primary text-primary-content",
|
|
9
10
|
secondary: "bg-secondary text-secondary-content",
|
|
@@ -14,12 +15,12 @@ export const getTooltipContentClasses = cva(
|
|
|
14
15
|
warning: "bg-warning text-warning-content",
|
|
15
16
|
error: "bg-error text-error-content",
|
|
16
17
|
},
|
|
17
|
-
},
|
|
18
|
+
}),
|
|
18
19
|
}
|
|
19
20
|
);
|
|
20
21
|
|
|
21
22
|
export const getTooltipArrowClasses = cva("fill-base-200", {
|
|
22
|
-
variants: {
|
|
23
|
+
variants: createVariants({
|
|
23
24
|
variant: {
|
|
24
25
|
primary: "fill-primary",
|
|
25
26
|
secondary: "fill-secondary",
|
|
@@ -30,5 +31,5 @@ export const getTooltipArrowClasses = cva("fill-base-200", {
|
|
|
30
31
|
warning: "fill-warning",
|
|
31
32
|
error: "fill-error",
|
|
32
33
|
},
|
|
33
|
-
},
|
|
34
|
+
}),
|
|
34
35
|
});
|
package/src/index.ts
CHANGED
|
@@ -8,6 +8,25 @@ export * from "./components/ThemeSwitch";
|
|
|
8
8
|
export * from "./components/Toggle";
|
|
9
9
|
export * from "./components/ToggleGroup";
|
|
10
10
|
|
|
11
|
+
/** layout */
|
|
12
|
+
export * from "./components/Box";
|
|
13
|
+
export * from "./components/Center";
|
|
14
|
+
export * from "./components/Container";
|
|
15
|
+
export * from "./components/Flex";
|
|
16
|
+
export * from "./components/Grid";
|
|
17
|
+
export * from "./components/Spacer";
|
|
18
|
+
|
|
19
|
+
/** typography */
|
|
20
|
+
export * from "./components/Blockquote";
|
|
21
|
+
export * from "./components/Code";
|
|
22
|
+
export * from "./components/Heading";
|
|
23
|
+
export * from "./components/Paragraph";
|
|
24
|
+
|
|
25
|
+
/** utility & atoms */
|
|
26
|
+
export * from "./components/AspectRatio";
|
|
27
|
+
export * from "./components/Image";
|
|
28
|
+
export * from "./components/Spinner";
|
|
29
|
+
|
|
11
30
|
/** data display */
|
|
12
31
|
export * from "./components/Accordion";
|
|
13
32
|
export * from "./components/Alert";
|
|
@@ -58,4 +77,12 @@ export * from "./components/Slot";
|
|
|
58
77
|
export * from "./components/Widget";
|
|
59
78
|
|
|
60
79
|
/** molecules */
|
|
80
|
+
export * from "./components/Banner";
|
|
81
|
+
export * from "./components/Empty";
|
|
61
82
|
export * from "./components/Sidebar";
|
|
83
|
+
export * from "./components/Stepper";
|
|
84
|
+
/** organisms */
|
|
85
|
+
export * from "./components/Footer";
|
|
86
|
+
export * from "./components/Header";
|
|
87
|
+
export * from "./components/Panel";
|
|
88
|
+
export * from "./components/Sheet";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { createVariants } from "./createVariants";
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
type ValidateKeys<V, Allowed extends string> = keyof V extends Allowed
|
|
2
|
+
? V
|
|
3
|
+
: { [K in keyof V]: K extends Allowed ? V[K] : never };
|
|
4
|
+
|
|
5
|
+
type VariantConstraint<T, K extends keyof T, Allowed extends string> =
|
|
6
|
+
T extends Record<K, infer V>
|
|
7
|
+
? V extends Partial<Record<Allowed, unknown>>
|
|
8
|
+
? ValidateKeys<V, Allowed>
|
|
9
|
+
: Partial<Record<Allowed, unknown>>
|
|
10
|
+
: Partial<Record<Allowed, unknown>>;
|
|
11
|
+
|
|
12
|
+
export type CreateVariantsArgs<T extends Record<string, unknown>> = {
|
|
13
|
+
variant?: VariantConstraint<
|
|
14
|
+
T,
|
|
15
|
+
"variant",
|
|
16
|
+
| "accent"
|
|
17
|
+
| "default"
|
|
18
|
+
| "error"
|
|
19
|
+
| "ghost"
|
|
20
|
+
| "info"
|
|
21
|
+
| "neutral"
|
|
22
|
+
| "primary"
|
|
23
|
+
| "secondary"
|
|
24
|
+
| "success"
|
|
25
|
+
| "warning"
|
|
26
|
+
>;
|
|
27
|
+
outline?: VariantConstraint<T, "outline", "true" | "false">;
|
|
28
|
+
size?: VariantConstraint<T, "size", "xs" | "sm" | "md" | "lg" | "xl">;
|
|
29
|
+
} & Omit<T, "variant" | "outline" | "size">;
|
package/src/utilities/index.ts
CHANGED