@mbao01/common 0.1.4 → 0.2.1
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/README.md +1 -9
- package/dist/types/components/AlertDialog/AlertDialog.d.ts +4 -0
- package/dist/types/components/Button/Button.d.ts +2 -0
- package/dist/types/components/Button/constants.d.ts +2 -0
- package/dist/types/components/Card/Card.d.ts +1 -1
- package/dist/types/components/Card/constants.d.ts +2 -2
- package/dist/types/components/Carousel/Carousel.d.ts +4 -0
- package/dist/types/components/Form/DatetimeInput/DatetimeInput.d.ts +1 -0
- package/dist/types/components/Form/Select/Select.d.ts +0 -2
- package/dist/types/components/Form/Select/constants.d.ts +0 -1
- package/dist/types/components/Form/components/Fieldset/Fieldset.d.ts +7 -0
- package/dist/types/components/Form/components/Fieldset/constants.d.ts +3 -0
- package/dist/types/components/Form/components/Fieldset/index.d.ts +1 -0
- package/dist/types/components/Form/components/Fieldset/types.d.ts +10 -0
- package/dist/types/components/Form/components/Label/Label.d.ts +2 -4
- package/dist/types/components/Form/index.d.ts +1 -1
- package/dist/types/components/Loading/constants.d.ts +1 -1
- package/dist/types/components/Sidebar/Sidebar.d.ts +2 -0
- package/dist/types/components/Toggle/Toggle.d.ts +3 -0
- package/dist/types/components/Toggle/constants.d.ts +1 -0
- package/dist/types/components/ToggleGroup/ToggleGroup.d.ts +3 -0
- package/package.json +75 -79
- package/src/components/AlertDialog/constants.ts +1 -1
- package/src/components/Avatar/constants.ts +4 -4
- package/src/components/Button/Button.tsx +24 -3
- package/src/components/Button/constants.ts +19 -1
- package/src/components/Calendar/Calendar.tsx +9 -9
- package/src/components/Card/Card.tsx +2 -2
- package/src/components/Card/constants.ts +9 -8
- package/src/components/Chart/constants.ts +2 -2
- package/src/components/Chart/stories/examples/PieChart.tsx +1 -1
- package/src/components/Chart/stories/examples/RadarChart.tsx +2 -2
- package/src/components/Command/constants.ts +2 -2
- package/src/components/DatetimePicker/constants.ts +2 -2
- package/src/components/Description/Description.tsx +1 -1
- package/src/components/Dialog/constants.ts +1 -1
- package/src/components/DragAndDrop/Draggable/Draggable.example.tsx +1 -1
- package/src/components/DragAndDrop/Draggable/constants.ts +1 -1
- package/src/components/DragAndDrop/Droppable/Droppable.example.tsx +2 -2
- package/src/components/DragAndDrop/Sortable/Sortable.example.tsx +2 -2
- package/src/components/FileUploader/FileUploader.tsx +1 -1
- package/src/components/Form/Checkbox/constants.ts +1 -1
- package/src/components/Form/DatetimeInput/constants.ts +5 -5
- package/src/components/Form/MultiSelect/constants.ts +4 -4
- package/src/components/Form/OtpInput/OtpInput.tsx +1 -1
- package/src/components/Form/Phone/constants.ts +2 -2
- package/src/components/Form/Select/Select.tsx +2 -2
- package/src/components/Form/Select/constants.ts +7 -5
- package/src/components/Form/Slider/constants.ts +1 -1
- package/src/components/Form/TagsInput/constants.ts +3 -3
- package/src/components/Form/TextField/TextField.tsx +15 -12
- package/src/components/Form/Textarea/constants.ts +6 -1
- package/src/components/Form/components/Fieldset/Fieldset.tsx +42 -0
- package/src/components/Form/components/Fieldset/constants.ts +7 -0
- package/src/components/Form/components/Fieldset/index.ts +1 -0
- package/src/components/Form/components/Fieldset/types.ts +19 -0
- package/src/components/Form/components/Label/Label.tsx +2 -13
- package/src/components/Form/index.ts +1 -1
- package/src/components/HoverCard/constants.ts +1 -1
- package/src/components/Loading/constants.ts +1 -0
- package/src/components/Menu/Menubar/constants.ts +6 -6
- package/src/components/Menu/NavigationMenu/constants.ts +12 -12
- package/src/components/Popover/constants.ts +1 -1
- package/src/components/Sidebar/SidebarMenu.tsx +1 -1
- package/src/components/Sidebar/constants.ts +24 -24
- package/src/components/Sidebar/stories/examples/components/AppMain.tsx +1 -1
- package/src/components/Sidebar/stories/examples/components/VersionSwitcher.tsx +1 -1
- package/src/components/Sonner/constants.ts +18 -18
- package/src/components/Tabs/constants.ts +2 -2
- package/src/components/Timeline/constants.ts +1 -1
- package/src/components/Toggle/Toggle.tsx +1 -1
- package/src/components/Toggle/constants.ts +50 -0
- package/src/components/Widget/Widgets.example.tsx +2 -2
- package/src/stylesheets/index.css +2 -2
- package/dist/types/components/Form/components/FormControl/FormControl.d.ts +0 -2
- package/dist/types/components/Form/components/FormControl/constants.d.ts +0 -1
- package/dist/types/components/Form/components/FormControl/index.d.ts +0 -1
- package/dist/types/components/Form/components/FormControl/types.d.ts +0 -8
- package/plugin.d.ts +0 -4
- package/plugin.js +0 -5
- package/src/components/Form/components/FormControl/FormControl.tsx +0 -21
- package/src/components/Form/components/FormControl/constants.ts +0 -3
- package/src/components/Form/components/FormControl/index.ts +0 -1
- package/src/components/Form/components/FormControl/types.ts +0 -13
|
@@ -12,9 +12,9 @@ import type {
|
|
|
12
12
|
import { cn } from "../../utilities";
|
|
13
13
|
import { getCardClasses } from "./constants";
|
|
14
14
|
|
|
15
|
-
const Card = ({
|
|
15
|
+
const Card = ({ size, border, horizontal, overlay, className, ...props }: CardProps) => (
|
|
16
16
|
<div
|
|
17
|
-
className={cn(getCardClasses({
|
|
17
|
+
className={cn(getCardClasses({ border, size, horizontal, overlay }), className)}
|
|
18
18
|
{...props}
|
|
19
19
|
/>
|
|
20
20
|
);
|
|
@@ -2,12 +2,16 @@ import { cva } from "../../libs";
|
|
|
2
2
|
|
|
3
3
|
export const getCardClasses = cva("card", {
|
|
4
4
|
variants: {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
border: {
|
|
6
|
+
solid: "card-border",
|
|
7
|
+
dash: "card-dash",
|
|
7
8
|
},
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
size: {
|
|
10
|
+
xs: "card-xs",
|
|
11
|
+
sm: "card-sm",
|
|
12
|
+
md: "card-md",
|
|
13
|
+
lg: "card-lg",
|
|
14
|
+
xl: "card-xl",
|
|
11
15
|
},
|
|
12
16
|
horizontal: {
|
|
13
17
|
true: "card-side",
|
|
@@ -16,7 +20,4 @@ export const getCardClasses = cva("card", {
|
|
|
16
20
|
true: "image-full",
|
|
17
21
|
},
|
|
18
22
|
},
|
|
19
|
-
defaultVariants: {
|
|
20
|
-
compact: false,
|
|
21
|
-
},
|
|
22
23
|
});
|
|
@@ -7,7 +7,7 @@ export const THEMES = {
|
|
|
7
7
|
} satisfies Record<Theme, string>;
|
|
8
8
|
|
|
9
9
|
export const getChartClasses = cva(
|
|
10
|
-
"flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-base-content [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-base-content/20 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-base-content/20 [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-
|
|
10
|
+
"flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-base-content [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-base-content/20 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-base-content/20 [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-hidden [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-base-content/20 [&_.recharts-radial-bar-background-sector]:fill-base-200 [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-base-200 [&_.recharts-reference-line_[stroke='#ccc']]:stroke-base-content/20 [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-sector]:outline-hidden [&_.recharts-surface]:outline-hidden"
|
|
11
11
|
);
|
|
12
12
|
|
|
13
13
|
export const getChartLegendContainerClasses = cva("flex items-center justify-center gap-4", {
|
|
@@ -55,7 +55,7 @@ export const getChartTooltipItemLabelClasses = cva(
|
|
|
55
55
|
export const getChartTooltipItemValueClasses = cva("font-mono font-medium tabular-nums");
|
|
56
56
|
|
|
57
57
|
export const getChartTooltipItemIndicatorClasses = cva(
|
|
58
|
-
"shrink-0 rounded-[2px] border-
|
|
58
|
+
"shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)",
|
|
59
59
|
{
|
|
60
60
|
variants: {
|
|
61
61
|
indicator: {
|
|
@@ -133,7 +133,7 @@ export const WithLegendPieChartExample = (props: Partial<PieChartProps>) => {
|
|
|
133
133
|
<Pie dataKey="visitors" {...props.pie} />
|
|
134
134
|
<ChartLegend
|
|
135
135
|
content={<ChartLegendContent nameKey="browser" />}
|
|
136
|
-
className="-translate-y-2 flex-wrap gap-2
|
|
136
|
+
className="-translate-y-2 flex-wrap gap-2 *:basis-1/4 *:justify-center"
|
|
137
137
|
/>
|
|
138
138
|
</PieChart>
|
|
139
139
|
</Chart>
|
|
@@ -186,7 +186,7 @@ export const GridFilledRadarChartExample = (props: Partial<RadarChartProps>) =>
|
|
|
186
186
|
<Chart config={chartConfig} className="mx-auto aspect-square h-[250px]">
|
|
187
187
|
<RadarChart {...props.radarChart}>
|
|
188
188
|
<ChartTooltip cursor={false} content={<ChartTooltipContent hideLabel />} />
|
|
189
|
-
<PolarGrid className="fill-
|
|
189
|
+
<PolarGrid className="fill-(--color-desktop) opacity-20" />
|
|
190
190
|
<PolarAngleAxis dataKey="month" />
|
|
191
191
|
<Radar dataKey="desktop" {...props.radar} />
|
|
192
192
|
</RadarChart>
|
|
@@ -237,7 +237,7 @@ export const GridCircleFilledRadarChartExample = (props: Partial<RadarChartProps
|
|
|
237
237
|
<Chart config={chartConfig} className="mx-auto aspect-square h-[250px]">
|
|
238
238
|
<RadarChart {...props.radarChart}>
|
|
239
239
|
<ChartTooltip cursor={false} content={<ChartTooltipContent />} />
|
|
240
|
-
<PolarGrid className="fill-
|
|
240
|
+
<PolarGrid className="fill-(--color-desktop) opacity-20" gridType="circle" />
|
|
241
241
|
<PolarAngleAxis dataKey="month" />
|
|
242
242
|
<Radar dataKey="desktop" {...props.radar} />
|
|
243
243
|
</RadarChart>
|
|
@@ -13,7 +13,7 @@ export const getCommandDialogClasses = cva(
|
|
|
13
13
|
export const getCommandInputWrapperClasses = cva("flex items-center border-b px-3");
|
|
14
14
|
|
|
15
15
|
export const getCommandInputClasses = cva(
|
|
16
|
-
"flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-
|
|
16
|
+
"flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-hidden placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50"
|
|
17
17
|
);
|
|
18
18
|
|
|
19
19
|
export const getCommandListClasses = cva("max-h-[300px] overflow-y-auto overflow-x-hidden");
|
|
@@ -27,7 +27,7 @@ export const getCommandGroupClasses = cva(
|
|
|
27
27
|
export const getCommandSeparatorClasses = cva("-mx-1 h-px bg-border");
|
|
28
28
|
|
|
29
29
|
export const getCommandItemClasses = cva(
|
|
30
|
-
"relative flex cursor-pointer select-none items-center rounded-
|
|
30
|
+
"relative flex cursor-pointer select-none items-center rounded-xs px-2 py-1.5 text-sm outline-hidden transition-colors aria-selected:bg-base-300 aria-selected:text-base-content aria-disabled:underline aria-disabled:pointer-events-none aria-disabled:opacity-50 aria-disabled:cursor-default"
|
|
31
31
|
);
|
|
32
32
|
|
|
33
33
|
export const getCommandShortcutClasses = cva(
|
|
@@ -72,7 +72,7 @@ export const getDatetimeGridClasses = cva(
|
|
|
72
72
|
export const getDatetimeSeparatorClasses = cva("text-xs text-gray-400");
|
|
73
73
|
|
|
74
74
|
export const getDatetimeInputClasses = cva(
|
|
75
|
-
"min-w-8 p-1 inline tabular-nums h-fit border-none outline-none select-none content-box caret-transparent
|
|
75
|
+
"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
76
|
{
|
|
77
77
|
variants: {
|
|
78
78
|
size: {
|
|
@@ -83,7 +83,7 @@ export const getDatetimeInputClasses = cva(
|
|
|
83
83
|
},
|
|
84
84
|
unit: {
|
|
85
85
|
years: "min-w-12",
|
|
86
|
-
"am/pm": "bg-base-content/
|
|
86
|
+
"am/pm": "bg-base-content/5",
|
|
87
87
|
} as Record<DateFormat | TimeFormat, string>,
|
|
88
88
|
},
|
|
89
89
|
compoundVariants: [
|
|
@@ -10,7 +10,7 @@ const DescriptionTerm = ({ className, ...props }: DescriptionTermProps) => {
|
|
|
10
10
|
};
|
|
11
11
|
|
|
12
12
|
const DescriptionDetail = ({ className, ...props }: DescriptionDetailProps) => {
|
|
13
|
-
return <dd className={cn("text-base
|
|
13
|
+
return <dd className={cn("text-base not-last:mb-1", className)} {...props} />;
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
Description.Term = DescriptionTerm;
|
|
@@ -40,5 +40,5 @@ export const getDialogTitleClasses = cva("text-lg font-semibold leading-none tra
|
|
|
40
40
|
export const getDialogDescriptionClasses = cva("text-sm text-muted-foreground");
|
|
41
41
|
|
|
42
42
|
export const getDialogCloseClasses = cva(
|
|
43
|
-
"absolute right-4 top-4 rounded-
|
|
43
|
+
"absolute right-4 top-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground"
|
|
44
44
|
);
|
|
@@ -136,7 +136,7 @@ export const DraggableOverlayExample = ({
|
|
|
136
136
|
id="my-draggable"
|
|
137
137
|
axis={axis}
|
|
138
138
|
handle={handle}
|
|
139
|
-
className="w-fit border border-base-content rounded-md p-2 flex items-center gap-2 data-
|
|
139
|
+
className="w-fit border border-base-content rounded-md p-2 flex items-center gap-2 data-draggable-active:opacity-0"
|
|
140
140
|
>
|
|
141
141
|
{label}
|
|
142
142
|
</Draggable>
|
|
@@ -25,7 +25,7 @@ export const DROP_ANIMATION_CONFIG: DropAnimation = {
|
|
|
25
25
|
};
|
|
26
26
|
|
|
27
27
|
export const getDraggableClasses = cva(
|
|
28
|
-
"translate-x-
|
|
28
|
+
"translate-x-(--translate-x) translate-y-(--translate-y) translate-z-0",
|
|
29
29
|
{
|
|
30
30
|
variants: {
|
|
31
31
|
isDragging: {
|
|
@@ -40,7 +40,7 @@ export const DroppableExample = ({
|
|
|
40
40
|
const item = (
|
|
41
41
|
<Draggable
|
|
42
42
|
id="my-draggable"
|
|
43
|
-
className="w-fit border border-base-content rounded-md p-2 flex items-center gap-2 data-
|
|
43
|
+
className="w-fit border border-base-content rounded-md p-2 flex items-center gap-2 data-draggable-active:opacity-0"
|
|
44
44
|
>
|
|
45
45
|
Go ahead, drag me.
|
|
46
46
|
</Draggable>
|
|
@@ -65,7 +65,7 @@ export const DroppableExample = ({
|
|
|
65
65
|
key={id}
|
|
66
66
|
id={id}
|
|
67
67
|
isDragging={isDragging}
|
|
68
|
-
className="relative p-6 border border-base-300 rounded-md w-72 h-72 bg-base-200 box-border data-
|
|
68
|
+
className="relative p-6 border border-base-300 rounded-md w-72 h-72 bg-base-200 box-border data-draggable-active:opacity-80 data-draggable-over:opacity-100 transition-opacity"
|
|
69
69
|
>
|
|
70
70
|
<div className="absolute bottom-6">Container {id}</div>
|
|
71
71
|
{parentContainerId === id ? item : null}
|
|
@@ -44,9 +44,9 @@ export const SortableExample = ({ hasDraggableOverlay, ...props }: SortableExamp
|
|
|
44
44
|
key={item}
|
|
45
45
|
id={item}
|
|
46
46
|
className={cn(
|
|
47
|
-
"flex items-center justify-center w-32 h-32 bg-base-100 border border-primary-content/30 rounded-md text-sm p-2 data-
|
|
47
|
+
"flex items-center justify-center w-32 h-32 bg-base-100 border border-primary-content/30 rounded-md text-sm p-2 data-draggable:shadow-sm data-draggable-active:z-20",
|
|
48
48
|
{
|
|
49
|
-
"data-
|
|
49
|
+
"data-draggable-active:opacity-30": hasDraggableOverlay,
|
|
50
50
|
}
|
|
51
51
|
)}
|
|
52
52
|
>
|
|
@@ -253,7 +253,7 @@ const FileUploaderItem = forwardRef<
|
|
|
253
253
|
<div
|
|
254
254
|
ref={ref}
|
|
255
255
|
className={cn(
|
|
256
|
-
"h-6 p-1 justify-between cursor-pointer relative rounded",
|
|
256
|
+
"h-6 p-1 justify-between cursor-pointer relative rounded-sm",
|
|
257
257
|
{ "bg-base-300": isSelected },
|
|
258
258
|
className
|
|
259
259
|
)}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { cva } from "../../../libs";
|
|
2
2
|
|
|
3
3
|
export const getCheckboxClasses = cva(
|
|
4
|
-
"peer flex items-center justify-center h-4 w-4 shrink-0 rounded-
|
|
4
|
+
"peer flex items-center justify-center h-4 w-4 shrink-0 rounded-xs border focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-base-content disabled:cursor-not-allowed disabled:opacity-50",
|
|
5
5
|
{
|
|
6
6
|
variants: {
|
|
7
7
|
variant: {
|
|
@@ -57,12 +57,12 @@ export const getDatetimeInputContainerClasses = cva(
|
|
|
57
57
|
|
|
58
58
|
export const getDatetimeCalendarTriggerClasses = cva(
|
|
59
59
|
`size-8 rounded-md p-1 flex items-center justify-center font-normal
|
|
60
|
-
outline-
|
|
60
|
+
outline-hidden focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-base-content focus-visible:ring-inset
|
|
61
61
|
`,
|
|
62
62
|
{
|
|
63
63
|
variants: {
|
|
64
64
|
size: {
|
|
65
|
-
xs: "size-4 p-0 rounded-
|
|
65
|
+
xs: "size-4 p-0 rounded-xs",
|
|
66
66
|
sm: "size-6",
|
|
67
67
|
md: "size-9",
|
|
68
68
|
lg: "size-10",
|
|
@@ -89,7 +89,7 @@ export const getDatetimeCalendarIconClasses = cva("", {
|
|
|
89
89
|
});
|
|
90
90
|
|
|
91
91
|
export const getTimePickerClasses = cva(
|
|
92
|
-
"border border-neutral-content bg-base-100 shadow-
|
|
92
|
+
"border border-neutral-content bg-base-100 shadow-xs cursor-pointer ring-0 py-2 h-8 px-3 w-full text-sm outline-0 inline-flex items-center justify-center whitespace-nowrap rounded-md font-medium transition-colors focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-base-content disabled:pointer-events-none disabled:opacity-50 hover:bg-base-200",
|
|
93
93
|
{
|
|
94
94
|
variants: {
|
|
95
95
|
selected: {
|
|
@@ -111,7 +111,7 @@ export const getTimePickerScrollAreaClasses = cva(
|
|
|
111
111
|
);
|
|
112
112
|
|
|
113
113
|
export const getNaturalLanguageInputClasses = cva(
|
|
114
|
-
"flex-1 border-none
|
|
114
|
+
"flex-1 border-none bg-transparent outline-hidden ring-0 focus:outline-hidden focus:ring-0 focus-within:outline-hidden focus-within:ring-0 disabled:cursor-not-allowed disabled:opacity-50",
|
|
115
115
|
{
|
|
116
116
|
variants: {
|
|
117
117
|
size: {
|
|
@@ -131,5 +131,5 @@ export const getNaturalLanguageInputClasses = cva(
|
|
|
131
131
|
);
|
|
132
132
|
|
|
133
133
|
export const getDatetimeCalendarClasses = cva(
|
|
134
|
-
"peer flex justify-end bg-transparent focus:outline-
|
|
134
|
+
"peer flex justify-end bg-transparent focus:outline-hidden focus:ring-0 focus-within:outline-hidden focus-within:ring-0 sm:text-sm disabled:cursor-not-allowed disabled:opacity-50"
|
|
135
135
|
);
|
|
@@ -52,7 +52,7 @@ export const getMultiSelectTriggerClasses = cva(
|
|
|
52
52
|
);
|
|
53
53
|
|
|
54
54
|
export const getMultiSelectItemClasses = cva(
|
|
55
|
-
"cursor-pointer transition-colors flex justify-between aria-selected:bg-base-300 aria-selected:text-base-content rounded-
|
|
55
|
+
"cursor-pointer transition-colors flex justify-between aria-selected:bg-base-300 aria-selected:text-base-content rounded-xs py-1.5 px-2 text-sm outline-hidden",
|
|
56
56
|
{
|
|
57
57
|
variants: {
|
|
58
58
|
included: {
|
|
@@ -96,11 +96,11 @@ export const getMultiSelectListClasses = cva(
|
|
|
96
96
|
);
|
|
97
97
|
|
|
98
98
|
export const getMultiSelectTagClasses = cva(
|
|
99
|
-
"relative flex items-center gap-1 [&>span]:truncate [&>span]:max-w-24 aria-disabled:opacity-50 aria-disabled:cursor-not-allowed focus-visible:outline-
|
|
99
|
+
"relative flex items-center gap-1 [&>span]:truncate [&>span]:max-w-24 aria-disabled:opacity-50 aria-disabled:cursor-not-allowed focus-visible:outline-hidden",
|
|
100
100
|
{
|
|
101
101
|
variants: {
|
|
102
102
|
size: {
|
|
103
|
-
xs: "px-0.5 [&>span]:max-w-20 rounded",
|
|
103
|
+
xs: "px-0.5 [&>span]:max-w-20 rounded-sm",
|
|
104
104
|
sm: "px-1",
|
|
105
105
|
md: "px-1.5 [&>span]:max-w-28",
|
|
106
106
|
lg: "px-2 [&>span]:max-w-32",
|
|
@@ -109,7 +109,7 @@ export const getMultiSelectTagClasses = cva(
|
|
|
109
109
|
}
|
|
110
110
|
);
|
|
111
111
|
|
|
112
|
-
export const getMultiSelectInputClasses = cva("bg-transparent outline-
|
|
112
|
+
export const getMultiSelectInputClasses = cva("bg-transparent outline-hidden flex-1", {
|
|
113
113
|
variants: {
|
|
114
114
|
size: {
|
|
115
115
|
xs: "text-xs",
|
|
@@ -16,7 +16,7 @@ export const OtpInput = ({ className, inputProps, ...props }: OtpInputProps) =>
|
|
|
16
16
|
<Input
|
|
17
17
|
{...inputProps}
|
|
18
18
|
{...renderProps}
|
|
19
|
-
className={cn("
|
|
19
|
+
className={cn("w-12! appearance-none! selection:bg-base text-base-content", className)}
|
|
20
20
|
/>
|
|
21
21
|
)}
|
|
22
22
|
containerStyle={`flex justify-center items-center flex-wrap text-2xl font-bold ${
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { cva } from "../../../libs";
|
|
2
2
|
|
|
3
|
-
export const getPhoneButtonClasses = cva("join-item justify-between px-2");
|
|
3
|
+
export const getPhoneButtonClasses = cva("join-item justify-between rounded-r-none! px-2");
|
|
4
4
|
|
|
5
5
|
export const getPhoneInputClasses = cva(
|
|
6
|
-
"input join-item input-bordered w-full
|
|
6
|
+
"input join-item input-bordered w-full rounded-l-none! pl-2! transition-all duration-100"
|
|
7
7
|
);
|
|
@@ -21,10 +21,10 @@ const Select = (props: React.ComponentPropsWithoutRef<typeof SelectPrimitive.Roo
|
|
|
21
21
|
const SelectTrigger = React.forwardRef<
|
|
22
22
|
React.ElementRef<typeof SelectPrimitive.Trigger>,
|
|
23
23
|
SelectTriggerProps
|
|
24
|
-
>(({ className, children, size,
|
|
24
|
+
>(({ className, children, size, variant, outline, ...props }, ref) => (
|
|
25
25
|
<SelectPrimitive.Trigger
|
|
26
26
|
ref={ref}
|
|
27
|
-
className={cn(getSelectTriggerClasses({ size,
|
|
27
|
+
className={cn(getSelectTriggerClasses({ size, variant, outline }), className)}
|
|
28
28
|
{...props}
|
|
29
29
|
>
|
|
30
30
|
{children}
|
|
@@ -15,10 +15,8 @@ export const getSelectTriggerClasses = cva(
|
|
|
15
15
|
error: "select-error",
|
|
16
16
|
},
|
|
17
17
|
outline: {
|
|
18
|
-
true: "
|
|
19
|
-
|
|
20
|
-
wide: {
|
|
21
|
-
true: "w-full",
|
|
18
|
+
true: "border border-input",
|
|
19
|
+
false: "select-ghost",
|
|
22
20
|
},
|
|
23
21
|
size: {
|
|
24
22
|
xs: "select-xs",
|
|
@@ -32,6 +30,10 @@ export const getSelectTriggerClasses = cva(
|
|
|
32
30
|
size: undefined,
|
|
33
31
|
className: "min-h-fit h-10",
|
|
34
32
|
},
|
|
33
|
+
{
|
|
34
|
+
outline: undefined,
|
|
35
|
+
className: "select-ghost",
|
|
36
|
+
},
|
|
35
37
|
{
|
|
36
38
|
variant: undefined,
|
|
37
39
|
outline: true,
|
|
@@ -47,7 +49,7 @@ export const getSelectTriggerClasses = cva(
|
|
|
47
49
|
);
|
|
48
50
|
|
|
49
51
|
export const getSelectItemClasses = cva(
|
|
50
|
-
"relative flex w-full cursor-pointer select-none items-center focus:bg-base-300 focus:text-base-content rounded-
|
|
52
|
+
"relative flex w-full cursor-pointer select-none items-center focus:bg-base-300 focus:text-base-content rounded-xs py-1.5 pl-2 pr-8 text-sm outline-hidden data-disabled:pointer-events-none data-disabled:opacity-50",
|
|
51
53
|
{
|
|
52
54
|
variants: {
|
|
53
55
|
variant: {
|
|
@@ -57,7 +57,7 @@ export const getSliderClasses = cva("absolute h-full", {
|
|
|
57
57
|
});
|
|
58
58
|
|
|
59
59
|
export const getSliderThumbClasses = cva(
|
|
60
|
-
"block h-5 w-5 rounded-full border-2 ring-offset-neutral transition-colors focus-visible:outline-
|
|
60
|
+
"block h-5 w-5 rounded-full border-2 ring-offset-neutral transition-colors focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
|
|
61
61
|
{
|
|
62
62
|
variants: {
|
|
63
63
|
variant: {
|
|
@@ -55,11 +55,11 @@ export const getTagsClasses = cva(
|
|
|
55
55
|
);
|
|
56
56
|
|
|
57
57
|
export const getTagClasses = cva(
|
|
58
|
-
"relative flex items-center gap-1 [&>span]:truncate [&>span]:max-w-24 aria-disabled:opacity-50 aria-disabled:cursor-not-allowed focus-visible:outline-
|
|
58
|
+
"relative flex items-center gap-1 [&>span]:truncate [&>span]:max-w-24 aria-disabled:opacity-50 aria-disabled:cursor-not-allowed focus-visible:outline-hidden",
|
|
59
59
|
{
|
|
60
60
|
variants: {
|
|
61
61
|
size: {
|
|
62
|
-
xs: "px-0.5 [&>span]:max-w-20 rounded",
|
|
62
|
+
xs: "px-0.5 [&>span]:max-w-20 rounded-sm",
|
|
63
63
|
sm: "px-1",
|
|
64
64
|
md: "px-1.5 [&>span]:max-w-28",
|
|
65
65
|
lg: "px-2 [&>span]:max-w-32",
|
|
@@ -69,7 +69,7 @@ export const getTagClasses = cva(
|
|
|
69
69
|
);
|
|
70
70
|
|
|
71
71
|
export const getTagsInputClasses = cva(
|
|
72
|
-
"outline-0 border-none h-5 min-w-fit flex-1 focus-visible:outline-0 focus-visible:ring-0 focus-visible:ring-offset-0 focus-visible:border-0 placeholder:text-muted-foreground px-1",
|
|
72
|
+
"outline-0 border-none h-5 min-w-fit shadow-none flex-1 focus-visible:outline-0 focus-visible:ring-0 focus-visible:ring-offset-0 focus-visible:border-0 placeholder:text-muted-foreground px-1",
|
|
73
73
|
{
|
|
74
74
|
variants: {
|
|
75
75
|
size: {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { Fieldset } from "../components/Fieldset";
|
|
3
|
+
import { Label } from "../components/Label";
|
|
3
4
|
import { Input } from "../Input";
|
|
4
5
|
import { type TextFieldProps } from "./types";
|
|
5
6
|
|
|
@@ -8,12 +9,12 @@ export const TextField = React.forwardRef<HTMLInputElement, TextFieldProps>(
|
|
|
8
9
|
const feedbackId = name ? `${name}-information` : undefined;
|
|
9
10
|
|
|
10
11
|
return (
|
|
11
|
-
<
|
|
12
|
+
<Fieldset>
|
|
12
13
|
{Boolean(label ?? info) && (
|
|
13
|
-
<
|
|
14
|
-
<span
|
|
15
|
-
{info && <span
|
|
16
|
-
</
|
|
14
|
+
<Label className="flex justify-between" htmlFor={id}>
|
|
15
|
+
<span>{label}</span>
|
|
16
|
+
{info && <span>{info}</span>}
|
|
17
|
+
</Label>
|
|
17
18
|
)}
|
|
18
19
|
<Input
|
|
19
20
|
id={id}
|
|
@@ -24,13 +25,15 @@ export const TextField = React.forwardRef<HTMLInputElement, TextFieldProps>(
|
|
|
24
25
|
{...props}
|
|
25
26
|
/>
|
|
26
27
|
{Boolean(error) && (
|
|
27
|
-
<
|
|
28
|
-
|
|
29
|
-
{
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
<Label className="flex flex-col items-start" htmlFor={id} id={feedbackId}>
|
|
29
|
+
{(Array.isArray(error) ? error : [error]).map((e, index) => (
|
|
30
|
+
<span key={index} className="text-red-500">
|
|
31
|
+
{e}
|
|
32
|
+
</span>
|
|
33
|
+
))}
|
|
34
|
+
</Label>
|
|
32
35
|
)}
|
|
33
|
-
</
|
|
36
|
+
</Fieldset>
|
|
34
37
|
);
|
|
35
38
|
}
|
|
36
39
|
);
|
|
@@ -14,7 +14,7 @@ export const getTextareaClasses = cva("textarea rounded-md transition-all durati
|
|
|
14
14
|
warning: "textarea-warning",
|
|
15
15
|
},
|
|
16
16
|
outline: {
|
|
17
|
-
|
|
17
|
+
false: "textarea-ghost",
|
|
18
18
|
},
|
|
19
19
|
wide: {
|
|
20
20
|
true: "w-full",
|
|
@@ -31,6 +31,11 @@ export const getTextareaClasses = cva("textarea rounded-md transition-all durati
|
|
|
31
31
|
size: undefined,
|
|
32
32
|
className: "min-h-fit h-10",
|
|
33
33
|
},
|
|
34
|
+
{
|
|
35
|
+
variant: undefined,
|
|
36
|
+
outline: undefined,
|
|
37
|
+
className: "textarea-ghost",
|
|
38
|
+
},
|
|
34
39
|
{
|
|
35
40
|
variant: undefined,
|
|
36
41
|
outline: true,
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
2
|
+
import type { As, FieldsetLabelProps, FieldsetLegendProps, FieldsetProps } from "./types";
|
|
3
|
+
import { cn } from "../../../../utilities";
|
|
4
|
+
import { Label } from "../Label";
|
|
5
|
+
import { getFieldsetClasses, getFieldsetLabelClasses, getFieldsetLegendClasses } from "./constants";
|
|
6
|
+
|
|
7
|
+
const Fieldset = ({ children, className, ...props }: FieldsetProps) => {
|
|
8
|
+
return (
|
|
9
|
+
<fieldset className={cn(getFieldsetClasses(), className)} {...props}>
|
|
10
|
+
{children}
|
|
11
|
+
</fieldset>
|
|
12
|
+
);
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const FieldsetLabel = <T extends As>({
|
|
16
|
+
as,
|
|
17
|
+
children,
|
|
18
|
+
className,
|
|
19
|
+
...props
|
|
20
|
+
}: FieldsetLabelProps<T>) => {
|
|
21
|
+
const SlotChild = !as || as === "label" ? Label : as;
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<Slot className={cn(getFieldsetLabelClasses(), className)} {...props}>
|
|
25
|
+
{/* slot merges it's prop into it's immediate child */}
|
|
26
|
+
<SlotChild>{children}</SlotChild>
|
|
27
|
+
</Slot>
|
|
28
|
+
);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const FieldsetLegend = ({ children, className, ...props }: FieldsetLegendProps) => {
|
|
32
|
+
return (
|
|
33
|
+
<legend className={cn(getFieldsetLegendClasses(), className)} {...props}>
|
|
34
|
+
{children}
|
|
35
|
+
</legend>
|
|
36
|
+
);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
Fieldset.Label = FieldsetLabel;
|
|
40
|
+
Fieldset.Legend = FieldsetLegend;
|
|
41
|
+
|
|
42
|
+
export { Fieldset };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Fieldset } from "./Fieldset";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type VariantProps } from "../../../../libs";
|
|
2
|
+
import { getFieldsetClasses, getFieldsetLabelClasses, getFieldsetLegendClasses } from "./constants";
|
|
3
|
+
|
|
4
|
+
export type FieldsetProps = React.FieldsetHTMLAttributes<HTMLFieldSetElement> &
|
|
5
|
+
VariantProps<typeof getFieldsetClasses>;
|
|
6
|
+
|
|
7
|
+
export type As = "div" | "span" | "label" | "p";
|
|
8
|
+
|
|
9
|
+
type AllowedElements = Pick<React.JSX.IntrinsicElements, As>;
|
|
10
|
+
|
|
11
|
+
export type FieldsetLabelProps<T extends As> = (T extends "label"
|
|
12
|
+
? React.LabelHTMLAttributes<HTMLLabelElement>
|
|
13
|
+
: React.HTMLAttributes<HTMLElement & AllowedElements[T]>) &
|
|
14
|
+
VariantProps<typeof getFieldsetLabelClasses> & {
|
|
15
|
+
as?: T;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export type FieldsetLegendProps = React.HTMLAttributes<HTMLLegendElement> &
|
|
19
|
+
VariantProps<typeof getFieldsetLegendClasses>;
|
|
@@ -1,20 +1,9 @@
|
|
|
1
1
|
import * as LabelPrimitive from "@radix-ui/react-label";
|
|
2
|
-
import type { LabelProps
|
|
2
|
+
import type { LabelProps } from "./types";
|
|
3
3
|
import { cn } from "../../../../utilities";
|
|
4
|
-
import { Text } from "../../../Text";
|
|
5
4
|
import { getLabelClasses } from "./constants";
|
|
6
5
|
|
|
7
|
-
const Label = ({ className, ...props }: LabelProps) => (
|
|
6
|
+
export const Label = ({ className, ...props }: LabelProps) => (
|
|
8
7
|
<LabelPrimitive.Root className={cn(getLabelClasses(), className)} {...props} />
|
|
9
8
|
);
|
|
10
9
|
Label.displayName = LabelPrimitive.Root.displayName;
|
|
11
|
-
|
|
12
|
-
const LabelText = ({ className, children, ...props }: LabelTextProps) => (
|
|
13
|
-
<Text as="span" className={cn("label-text", className)} {...props}>
|
|
14
|
-
{children}
|
|
15
|
-
</Text>
|
|
16
|
-
);
|
|
17
|
-
|
|
18
|
-
Label.Text = LabelText;
|
|
19
|
-
|
|
20
|
-
export { Label };
|
|
@@ -13,4 +13,4 @@ export { TagsInput } from "./TagsInput";
|
|
|
13
13
|
export { Textarea } from "./Textarea";
|
|
14
14
|
export { TextField } from "./TextField";
|
|
15
15
|
export { Label } from "./components/Label";
|
|
16
|
-
export {
|
|
16
|
+
export { Fieldset } from "./components/Fieldset";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { cva } from "../../libs";
|
|
2
2
|
|
|
3
3
|
export const getHoverCardContentClasses = cva(
|
|
4
|
-
"z-50 w-64 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-
|
|
4
|
+
"z-50 w-64 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-hidden 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-[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
5
|
);
|