@auto-engineer/generate-react-client 1.64.0 → 1.65.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/CHANGELOG.md +21 -0
- package/dist/starter/.storybook/main.ts +17 -22
- package/dist/starter/.storybook/manager-head.html +31 -31
- package/dist/starter/.storybook/manager.ts +133 -133
- package/dist/starter/.storybook/preview-head.html +12 -12
- package/dist/starter/.storybook/preview.tsx +79 -79
- package/dist/starter/biome.json +126 -0
- package/dist/starter/codegen.ts +11 -11
- package/dist/starter/components.json +27 -27
- package/dist/starter/package.json +86 -80
- package/dist/starter/public/mockServiceWorker.js +261 -261
- package/dist/starter/scripts/build-component-db.ts +17 -20
- package/dist/starter/src/App.tsx +15 -17
- package/dist/starter/src/components/ui/Accordion.stories.tsx +35 -35
- package/dist/starter/src/components/ui/Accordion.tsx +33 -33
- package/dist/starter/src/components/ui/Alert.stories.tsx +15 -15
- package/dist/starter/src/components/ui/Alert.tsx +32 -32
- package/dist/starter/src/components/ui/AlertDialog.stories.tsx +50 -50
- package/dist/starter/src/components/ui/AlertDialog.tsx +114 -115
- package/dist/starter/src/components/ui/AspectRatio.stories.tsx +20 -20
- package/dist/starter/src/components/ui/AspectRatio.tsx +1 -1
- package/dist/starter/src/components/ui/Avatar.stories.tsx +27 -27
- package/dist/starter/src/components/ui/Avatar.tsx +63 -63
- package/dist/starter/src/components/ui/Badge.stories.tsx +14 -14
- package/dist/starter/src/components/ui/Badge.tsx +27 -27
- package/dist/starter/src/components/ui/Breadcrumb.stories.tsx +38 -38
- package/dist/starter/src/components/ui/Breadcrumb.tsx +63 -62
- package/dist/starter/src/components/ui/Button.stories.tsx +55 -55
- package/dist/starter/src/components/ui/Button.tsx +49 -49
- package/dist/starter/src/components/ui/ButtonGroup.stories.tsx +17 -17
- package/dist/starter/src/components/ui/ButtonGroup.tsx +52 -53
- package/dist/starter/src/components/ui/Calendar.stories.tsx +20 -19
- package/dist/starter/src/components/ui/Calendar.tsx +142 -143
- package/dist/starter/src/components/ui/Card.stories.tsx +29 -29
- package/dist/starter/src/components/ui/Card.tsx +31 -31
- package/dist/starter/src/components/ui/Carousel.stories.tsx +41 -41
- package/dist/starter/src/components/ui/Carousel.tsx +171 -172
- package/dist/starter/src/components/ui/Chart.stories.tsx +21 -21
- package/dist/starter/src/components/ui/Chart.tsx +244 -247
- package/dist/starter/src/components/ui/Checkbox.stories.tsx +11 -11
- package/dist/starter/src/components/ui/Checkbox.tsx +18 -18
- package/dist/starter/src/components/ui/Collapsible.stories.tsx +40 -40
- package/dist/starter/src/components/ui/Collapsible.tsx +3 -3
- package/dist/starter/src/components/ui/Combobox.stories.tsx +48 -48
- package/dist/starter/src/components/ui/Combobox.tsx +204 -205
- package/dist/starter/src/components/ui/Command.stories.tsx +55 -55
- package/dist/starter/src/components/ui/Command.tsx +102 -103
- package/dist/starter/src/components/ui/ContextMenu.stories.tsx +52 -52
- package/dist/starter/src/components/ui/ContextMenu.tsx +151 -151
- package/dist/starter/src/components/ui/DesignSystem-Colors.stories.tsx +92 -92
- package/dist/starter/src/components/ui/DesignSystem-Layout.stories.tsx +139 -139
- package/dist/starter/src/components/ui/DesignSystem-Overview.stories.tsx +676 -657
- package/dist/starter/src/components/ui/DesignSystem-Typography.stories.tsx +59 -59
- package/dist/starter/src/components/ui/Dialog.stories.tsx +56 -56
- package/dist/starter/src/components/ui/Dialog.tsx +97 -98
- package/dist/starter/src/components/ui/Direction.stories.tsx +20 -20
- package/dist/starter/src/components/ui/Direction.tsx +7 -7
- package/dist/starter/src/components/ui/Drawer.stories.tsx +54 -54
- package/dist/starter/src/components/ui/Drawer.tsx +70 -70
- package/dist/starter/src/components/ui/DropdownMenu.stories.tsx +58 -58
- package/dist/starter/src/components/ui/DropdownMenu.tsx +157 -157
- package/dist/starter/src/components/ui/Empty.stories.tsx +22 -22
- package/dist/starter/src/components/ui/Empty.tsx +58 -58
- package/dist/starter/src/components/ui/Field.stories.tsx +31 -31
- package/dist/starter/src/components/ui/Field.tsx +180 -181
- package/dist/starter/src/components/ui/Form.stories.tsx +29 -29
- package/dist/starter/src/components/ui/Form.tsx +93 -96
- package/dist/starter/src/components/ui/HoverCard.stories.tsx +34 -34
- package/dist/starter/src/components/ui/HoverCard.tsx +21 -21
- package/dist/starter/src/components/ui/Input.stories.tsx +18 -18
- package/dist/starter/src/components/ui/Input.tsx +14 -14
- package/dist/starter/src/components/ui/InputGroup.stories.tsx +34 -34
- package/dist/starter/src/components/ui/InputGroup.tsx +110 -111
- package/dist/starter/src/components/ui/InputOTP.stories.tsx +28 -28
- package/dist/starter/src/components/ui/InputOTP.tsx +43 -43
- package/dist/starter/src/components/ui/Item.stories.tsx +45 -45
- package/dist/starter/src/components/ui/Item.tsx +113 -114
- package/dist/starter/src/components/ui/Kbd.stories.tsx +31 -31
- package/dist/starter/src/components/ui/Kbd.tsx +11 -11
- package/dist/starter/src/components/ui/Label.stories.tsx +62 -62
- package/dist/starter/src/components/ui/Label.tsx +26 -25
- package/dist/starter/src/components/ui/Menubar.stories.tsx +62 -62
- package/dist/starter/src/components/ui/Menubar.tsx +173 -173
- package/dist/starter/src/components/ui/NativeSelect.stories.tsx +26 -26
- package/dist/starter/src/components/ui/NativeSelect.tsx +29 -29
- package/dist/starter/src/components/ui/NavigationMenu.stories.tsx +64 -64
- package/dist/starter/src/components/ui/NavigationMenu.tsx +103 -103
- package/dist/starter/src/components/ui/Pagination.stories.tsx +61 -61
- package/dist/starter/src/components/ui/Pagination.tsx +69 -71
- package/dist/starter/src/components/ui/Popover.stories.tsx +38 -38
- package/dist/starter/src/components/ui/Popover.tsx +25 -25
- package/dist/starter/src/components/ui/Progress.stories.tsx +9 -9
- package/dist/starter/src/components/ui/Progress.tsx +14 -14
- package/dist/starter/src/components/ui/RadioGroup.stories.tsx +35 -35
- package/dist/starter/src/components/ui/RadioGroup.tsx +19 -19
- package/dist/starter/src/components/ui/Resizable.stories.tsx +54 -54
- package/dist/starter/src/components/ui/Resizable.tsx +29 -29
- package/dist/starter/src/components/ui/ScrollArea.stories.tsx +27 -27
- package/dist/starter/src/components/ui/ScrollArea.tsx +34 -34
- package/dist/starter/src/components/ui/Select.stories.tsx +43 -43
- package/dist/starter/src/components/ui/Select.tsx +120 -120
- package/dist/starter/src/components/ui/Separator.stories.tsx +27 -27
- package/dist/starter/src/components/ui/Separator.tsx +17 -17
- package/dist/starter/src/components/ui/Sheet.stories.tsx +53 -53
- package/dist/starter/src/components/ui/Sheet.tsx +69 -69
- package/dist/starter/src/components/ui/Sidebar.stories.tsx +77 -77
- package/dist/starter/src/components/ui/Sidebar.tsx +563 -564
- package/dist/starter/src/components/ui/Skeleton.stories.tsx +25 -25
- package/dist/starter/src/components/ui/Skeleton.tsx +1 -1
- package/dist/starter/src/components/ui/Slider.stories.tsx +5 -5
- package/dist/starter/src/components/ui/Slider.tsx +45 -44
- package/dist/starter/src/components/ui/Sonner.stories.tsx +32 -32
- package/dist/starter/src/components/ui/Sonner.tsx +23 -23
- package/dist/starter/src/components/ui/Spinner.stories.tsx +8 -8
- package/dist/starter/src/components/ui/Spinner.tsx +1 -1
- package/dist/starter/src/components/ui/Switch.stories.tsx +16 -17
- package/dist/starter/src/components/ui/Switch.tsx +24 -24
- package/dist/starter/src/components/ui/Table.stories.tsx +50 -50
- package/dist/starter/src/components/ui/Table.tsx +45 -45
- package/dist/starter/src/components/ui/Tabs.stories.tsx +39 -39
- package/dist/starter/src/components/ui/Tabs.tsx +47 -47
- package/dist/starter/src/components/ui/Textarea.stories.tsx +9 -9
- package/dist/starter/src/components/ui/Textarea.tsx +11 -11
- package/dist/starter/src/components/ui/Toast.stories.tsx +77 -77
- package/dist/starter/src/components/ui/Toast.tsx +75 -75
- package/dist/starter/src/components/ui/Toaster.tsx +17 -19
- package/dist/starter/src/components/ui/Toggle.stories.tsx +20 -20
- package/dist/starter/src/components/ui/Toggle.tsx +26 -26
- package/dist/starter/src/components/ui/ToggleGroup.stories.tsx +41 -41
- package/dist/starter/src/components/ui/ToggleGroup.tsx +61 -62
- package/dist/starter/src/components/ui/Tooltip.stories.tsx +26 -26
- package/dist/starter/src/components/ui/Tooltip.tsx +24 -24
- package/dist/starter/src/gql/execute.ts +1 -1
- package/dist/starter/src/gql/fragment-masking.ts +1 -1
- package/dist/starter/src/gql/graphql.ts +3 -0
- package/dist/starter/src/hooks/use-mobile.ts +11 -11
- package/dist/starter/src/hooks/use-toast.ts +135 -135
- package/dist/starter/src/index.css +105 -105
- package/dist/starter/src/lib/utils.ts +1 -1
- package/dist/starter/src/main.tsx +4 -1
- package/dist/starter/tsconfig.app.json +24 -24
- package/dist/starter/tsconfig.json +8 -8
- package/dist/starter/vite.config.ts +38 -37
- package/package.json +3 -3
|
@@ -1,24 +1,23 @@
|
|
|
1
1
|
import { cva, type VariantProps } from 'class-variance-authority';
|
|
2
2
|
import { Slot } from 'radix-ui';
|
|
3
|
-
|
|
4
|
-
import { cn } from '@/lib/utils';
|
|
5
3
|
import { Separator } from '@/components/ui/Separator';
|
|
4
|
+
import { cn } from '@/lib/utils';
|
|
6
5
|
|
|
7
6
|
const buttonGroupVariants = cva(
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
7
|
+
"flex w-fit items-stretch [&>*]:focus-visible:z-10 [&>*]:focus-visible:relative [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-md has-[>[data-slot=button-group]]:gap-2",
|
|
8
|
+
{
|
|
9
|
+
variants: {
|
|
10
|
+
orientation: {
|
|
11
|
+
horizontal:
|
|
12
|
+
'[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none',
|
|
13
|
+
vertical:
|
|
14
|
+
'flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none',
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
defaultVariants: {
|
|
18
|
+
orientation: 'horizontal',
|
|
19
|
+
},
|
|
20
|
+
},
|
|
22
21
|
);
|
|
23
22
|
|
|
24
23
|
/**
|
|
@@ -26,56 +25,56 @@ const buttonGroupVariants = cva(
|
|
|
26
25
|
* Supports horizontal (default) and vertical orientation.
|
|
27
26
|
*/
|
|
28
27
|
function ButtonGroup({
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
className,
|
|
29
|
+
orientation,
|
|
30
|
+
...props
|
|
32
31
|
}: React.ComponentProps<'div'> & VariantProps<typeof buttonGroupVariants>) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
32
|
+
return (
|
|
33
|
+
<div
|
|
34
|
+
role="group"
|
|
35
|
+
data-slot="button-group"
|
|
36
|
+
data-orientation={orientation}
|
|
37
|
+
className={cn(buttonGroupVariants({ orientation }), className)}
|
|
38
|
+
{...props}
|
|
39
|
+
/>
|
|
40
|
+
);
|
|
42
41
|
}
|
|
43
42
|
|
|
44
43
|
/** A non-interactive text label or addon segment within a ButtonGroup, styled to match adjacent buttons. */
|
|
45
44
|
function ButtonGroupText({
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
className,
|
|
46
|
+
asChild = false,
|
|
47
|
+
...props
|
|
49
48
|
}: React.ComponentProps<'div'> & {
|
|
50
|
-
|
|
49
|
+
asChild?: boolean;
|
|
51
50
|
}) {
|
|
52
|
-
|
|
51
|
+
const Comp = asChild ? Slot.Root : 'div';
|
|
53
52
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
53
|
+
return (
|
|
54
|
+
<Comp
|
|
55
|
+
className={cn(
|
|
56
|
+
"bg-muted flex items-center gap-2 rounded-md border px-4 text-sm font-medium shadow-xs [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4",
|
|
57
|
+
className,
|
|
58
|
+
)}
|
|
59
|
+
{...props}
|
|
60
|
+
/>
|
|
61
|
+
);
|
|
63
62
|
}
|
|
64
63
|
|
|
65
64
|
/** A visual divider between buttons in a ButtonGroup, rendered as a Separator. */
|
|
66
65
|
function ButtonGroupSeparator({
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
66
|
+
className,
|
|
67
|
+
orientation = 'vertical',
|
|
68
|
+
...props
|
|
70
69
|
}: React.ComponentProps<typeof Separator>) {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
70
|
+
return (
|
|
71
|
+
<Separator
|
|
72
|
+
data-slot="button-group-separator"
|
|
73
|
+
orientation={orientation}
|
|
74
|
+
className={cn('bg-input relative !m-0 self-stretch data-[orientation=vertical]:h-auto', className)}
|
|
75
|
+
{...props}
|
|
76
|
+
/>
|
|
77
|
+
);
|
|
79
78
|
}
|
|
80
79
|
|
|
81
80
|
export { ButtonGroup, ButtonGroupSeparator, ButtonGroupText, buttonGroupVariants };
|
|
@@ -1,40 +1,41 @@
|
|
|
1
|
-
import { useState } from 'react';
|
|
2
1
|
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import type { DateRange } from 'react-day-picker';
|
|
3
4
|
import { Calendar } from '@/components/ui/Calendar';
|
|
4
5
|
|
|
5
6
|
const meta: Meta<typeof Calendar> = {
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
title: 'UI Components/Calendar',
|
|
8
|
+
component: Calendar,
|
|
8
9
|
};
|
|
9
10
|
export default meta;
|
|
10
11
|
type Story = StoryObj<typeof Calendar>;
|
|
11
12
|
|
|
12
13
|
function CalendarDemo() {
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
const [date, setDate] = useState<Date | undefined>(new Date());
|
|
15
|
+
return <Calendar mode="single" selected={date} onSelect={setDate} className="rounded-md border" />;
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
/** Shows a single-date selection calendar with controlled state. */
|
|
18
19
|
export const Default: Story = {
|
|
19
|
-
|
|
20
|
+
render: () => <CalendarDemo />,
|
|
20
21
|
};
|
|
21
22
|
|
|
22
23
|
function CalendarRangeDemo() {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
24
|
+
const [range, setRange] = useState<DateRange | undefined>({
|
|
25
|
+
from: new Date(),
|
|
26
|
+
});
|
|
27
|
+
return (
|
|
28
|
+
<Calendar
|
|
29
|
+
mode="range"
|
|
30
|
+
selected={range}
|
|
31
|
+
onSelect={setRange}
|
|
32
|
+
numberOfMonths={2}
|
|
33
|
+
className="rounded-md border"
|
|
34
|
+
/>
|
|
35
|
+
);
|
|
35
36
|
}
|
|
36
37
|
|
|
37
38
|
/** Demonstrates date range selection across two side-by-side months. */
|
|
38
39
|
export const RangeSelection: Story = {
|
|
39
|
-
|
|
40
|
+
render: () => <CalendarRangeDemo />,
|
|
40
41
|
};
|
|
@@ -1,165 +1,164 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
1
|
import { ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon } from 'lucide-react';
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
import { cn } from '@/lib/utils';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { type DayButton, DayPicker, getDefaultClassNames } from 'react-day-picker';
|
|
6
4
|
import { Button, buttonVariants } from '@/components/ui/Button';
|
|
5
|
+
import { cn } from '@/lib/utils';
|
|
7
6
|
|
|
8
7
|
/**
|
|
9
8
|
* A date picker component built on react-day-picker supporting single date, multiple date, and date range selection.
|
|
10
9
|
* Supports month/year dropdowns, outside days visibility, keyboard navigation, and multi-month layouts.
|
|
11
10
|
*/
|
|
12
11
|
function Calendar({
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
12
|
+
className,
|
|
13
|
+
classNames,
|
|
14
|
+
showOutsideDays = true,
|
|
15
|
+
captionLayout = 'label',
|
|
16
|
+
/** The Button variant used for navigation arrows. Defaults to `"ghost"`. */
|
|
17
|
+
buttonVariant = 'ghost',
|
|
18
|
+
formatters,
|
|
19
|
+
components,
|
|
20
|
+
...props
|
|
22
21
|
}: React.ComponentProps<typeof DayPicker> & {
|
|
23
|
-
|
|
22
|
+
buttonVariant?: React.ComponentProps<typeof Button>['variant'];
|
|
24
23
|
}) {
|
|
25
|
-
|
|
24
|
+
const defaultClassNames = getDefaultClassNames();
|
|
26
25
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
26
|
+
return (
|
|
27
|
+
<DayPicker
|
|
28
|
+
showOutsideDays={showOutsideDays}
|
|
29
|
+
className={cn(
|
|
30
|
+
'bg-background group/calendar p-3 [--cell-size:--spacing(8)] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent',
|
|
31
|
+
String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,
|
|
32
|
+
String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,
|
|
33
|
+
className,
|
|
34
|
+
)}
|
|
35
|
+
captionLayout={captionLayout}
|
|
36
|
+
formatters={{
|
|
37
|
+
formatMonthDropdown: (date) => date.toLocaleString('default', { month: 'short' }),
|
|
38
|
+
...formatters,
|
|
39
|
+
}}
|
|
40
|
+
classNames={{
|
|
41
|
+
root: cn('w-fit', defaultClassNames.root),
|
|
42
|
+
months: cn('flex gap-4 flex-col md:flex-row relative', defaultClassNames.months),
|
|
43
|
+
month: cn('flex flex-col w-full gap-4', defaultClassNames.month),
|
|
44
|
+
nav: cn('flex items-center gap-1 w-full absolute top-0 inset-x-0 justify-between', defaultClassNames.nav),
|
|
45
|
+
button_previous: cn(
|
|
46
|
+
buttonVariants({ variant: buttonVariant }),
|
|
47
|
+
'size-(--cell-size) aria-disabled:opacity-50 p-0 select-none',
|
|
48
|
+
defaultClassNames.button_previous,
|
|
49
|
+
),
|
|
50
|
+
button_next: cn(
|
|
51
|
+
buttonVariants({ variant: buttonVariant }),
|
|
52
|
+
'size-(--cell-size) aria-disabled:opacity-50 p-0 select-none',
|
|
53
|
+
defaultClassNames.button_next,
|
|
54
|
+
),
|
|
55
|
+
month_caption: cn(
|
|
56
|
+
'flex items-center justify-center h-(--cell-size) w-full px-(--cell-size)',
|
|
57
|
+
defaultClassNames.month_caption,
|
|
58
|
+
),
|
|
59
|
+
dropdowns: cn(
|
|
60
|
+
'w-full flex items-center text-sm font-medium justify-center h-(--cell-size) gap-1.5',
|
|
61
|
+
defaultClassNames.dropdowns,
|
|
62
|
+
),
|
|
63
|
+
dropdown_root: cn(
|
|
64
|
+
'relative has-focus:border-ring border border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] rounded-md',
|
|
65
|
+
defaultClassNames.dropdown_root,
|
|
66
|
+
),
|
|
67
|
+
dropdown: cn('absolute bg-popover inset-0 opacity-0', defaultClassNames.dropdown),
|
|
68
|
+
caption_label: cn(
|
|
69
|
+
'select-none font-medium',
|
|
70
|
+
captionLayout === 'label'
|
|
71
|
+
? 'text-sm'
|
|
72
|
+
: 'rounded-md pl-2 pr-1 flex items-center gap-1 text-sm h-8 [&>svg]:text-muted-foreground [&>svg]:size-3.5',
|
|
73
|
+
defaultClassNames.caption_label,
|
|
74
|
+
),
|
|
75
|
+
table: 'w-full border-collapse',
|
|
76
|
+
weekdays: cn('flex', defaultClassNames.weekdays),
|
|
77
|
+
weekday: cn(
|
|
78
|
+
'text-muted-foreground rounded-md flex-1 font-normal text-[0.8rem] select-none',
|
|
79
|
+
defaultClassNames.weekday,
|
|
80
|
+
),
|
|
81
|
+
week: cn('flex w-full mt-2', defaultClassNames.week),
|
|
82
|
+
week_number_header: cn('select-none w-(--cell-size)', defaultClassNames.week_number_header),
|
|
83
|
+
week_number: cn('text-[0.8rem] select-none text-muted-foreground', defaultClassNames.week_number),
|
|
84
|
+
day: cn(
|
|
85
|
+
'relative w-full h-full p-0 text-center [&:last-child[data-selected=true]_button]:rounded-r-md group/day aspect-square select-none',
|
|
86
|
+
props.showWeekNumber
|
|
87
|
+
? '[&:nth-child(2)[data-selected=true]_button]:rounded-l-md'
|
|
88
|
+
: '[&:first-child[data-selected=true]_button]:rounded-l-md',
|
|
89
|
+
defaultClassNames.day,
|
|
90
|
+
),
|
|
91
|
+
range_start: cn('rounded-l-md bg-accent', defaultClassNames.range_start),
|
|
92
|
+
range_middle: cn('rounded-none', defaultClassNames.range_middle),
|
|
93
|
+
range_end: cn('rounded-r-md bg-accent', defaultClassNames.range_end),
|
|
94
|
+
today: cn(
|
|
95
|
+
'bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none',
|
|
96
|
+
defaultClassNames.today,
|
|
97
|
+
),
|
|
98
|
+
outside: cn('text-muted-foreground aria-selected:text-muted-foreground', defaultClassNames.outside),
|
|
99
|
+
disabled: cn('text-muted-foreground opacity-50', defaultClassNames.disabled),
|
|
100
|
+
hidden: cn('invisible', defaultClassNames.hidden),
|
|
101
|
+
...classNames,
|
|
102
|
+
}}
|
|
103
|
+
components={{
|
|
104
|
+
Root: ({ className, rootRef, ...props }) => {
|
|
105
|
+
return <div data-slot="calendar" ref={rootRef} className={cn(className)} {...props} />;
|
|
106
|
+
},
|
|
107
|
+
Chevron: ({ className, orientation, ...props }) => {
|
|
108
|
+
if (orientation === 'left') {
|
|
109
|
+
return <ChevronLeftIcon className={cn('size-4', className)} {...props} />;
|
|
110
|
+
}
|
|
112
111
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
112
|
+
if (orientation === 'right') {
|
|
113
|
+
return <ChevronRightIcon className={cn('size-4', className)} {...props} />;
|
|
114
|
+
}
|
|
116
115
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
116
|
+
return <ChevronDownIcon className={cn('size-4', className)} {...props} />;
|
|
117
|
+
},
|
|
118
|
+
DayButton: CalendarDayButton,
|
|
119
|
+
WeekNumber: ({ children, ...props }) => {
|
|
120
|
+
return (
|
|
121
|
+
<td {...props}>
|
|
122
|
+
<div className="flex size-(--cell-size) items-center justify-center text-center">{children}</div>
|
|
123
|
+
</td>
|
|
124
|
+
);
|
|
125
|
+
},
|
|
126
|
+
...components,
|
|
127
|
+
}}
|
|
128
|
+
{...props}
|
|
129
|
+
/>
|
|
130
|
+
);
|
|
132
131
|
}
|
|
133
132
|
|
|
134
133
|
/** Internal button rendered for each day cell, handling selection states, range highlighting, and focus management. */
|
|
135
134
|
function CalendarDayButton({ className, day, modifiers, ...props }: React.ComponentProps<typeof DayButton>) {
|
|
136
|
-
|
|
135
|
+
const defaultClassNames = getDefaultClassNames();
|
|
137
136
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
137
|
+
const ref = React.useRef<HTMLButtonElement>(null);
|
|
138
|
+
React.useEffect(() => {
|
|
139
|
+
if (modifiers.focused) ref.current?.focus();
|
|
140
|
+
}, [modifiers.focused]);
|
|
142
141
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
142
|
+
return (
|
|
143
|
+
<Button
|
|
144
|
+
ref={ref}
|
|
145
|
+
variant="ghost"
|
|
146
|
+
size="icon"
|
|
147
|
+
data-day={day.date.toLocaleDateString()}
|
|
148
|
+
data-selected-single={
|
|
149
|
+
modifiers.selected && !modifiers.range_start && !modifiers.range_end && !modifiers.range_middle
|
|
150
|
+
}
|
|
151
|
+
data-range-start={modifiers.range_start}
|
|
152
|
+
data-range-end={modifiers.range_end}
|
|
153
|
+
data-range-middle={modifiers.range_middle}
|
|
154
|
+
className={cn(
|
|
155
|
+
'data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 dark:hover:text-accent-foreground flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] data-[range-end=true]:rounded-md data-[range-end=true]:rounded-r-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md data-[range-start=true]:rounded-l-md [&>span]:text-xs [&>span]:opacity-70',
|
|
156
|
+
defaultClassNames.day,
|
|
157
|
+
className,
|
|
158
|
+
)}
|
|
159
|
+
{...props}
|
|
160
|
+
/>
|
|
161
|
+
);
|
|
163
162
|
}
|
|
164
163
|
|
|
165
164
|
export { Calendar, CalendarDayButton };
|
|
@@ -1,44 +1,44 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
-
import { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent } from '@/components/ui/Card';
|
|
3
2
|
import { Button } from '@/components/ui/Button';
|
|
3
|
+
import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from '@/components/ui/Card';
|
|
4
4
|
|
|
5
5
|
const meta: Meta<typeof Card> = {
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
title: 'UI Components/Card',
|
|
7
|
+
component: Card,
|
|
8
8
|
};
|
|
9
9
|
export default meta;
|
|
10
10
|
type Story = StoryObj<typeof Card>;
|
|
11
11
|
|
|
12
12
|
/** Shows a full card with header, content, and footer containing action buttons. */
|
|
13
13
|
export const Default: Story = {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
14
|
+
render: () => (
|
|
15
|
+
<Card className="w-[350px]">
|
|
16
|
+
<CardHeader>
|
|
17
|
+
<CardTitle>Card Title</CardTitle>
|
|
18
|
+
<CardDescription>Card description goes here.</CardDescription>
|
|
19
|
+
</CardHeader>
|
|
20
|
+
<CardContent>
|
|
21
|
+
<p>Card content with some example text to demonstrate the layout.</p>
|
|
22
|
+
</CardContent>
|
|
23
|
+
<CardFooter className="flex justify-between">
|
|
24
|
+
<Button variant="outline">Cancel</Button>
|
|
25
|
+
<Button>Deploy</Button>
|
|
26
|
+
</CardFooter>
|
|
27
|
+
</Card>
|
|
28
|
+
),
|
|
29
29
|
};
|
|
30
30
|
|
|
31
31
|
/** Shows a minimal card with only a header and content, without a footer. */
|
|
32
32
|
export const Simple: Story = {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
33
|
+
render: () => (
|
|
34
|
+
<Card className="w-[350px]">
|
|
35
|
+
<CardHeader>
|
|
36
|
+
<CardTitle>Notifications</CardTitle>
|
|
37
|
+
<CardDescription>You have 3 unread messages.</CardDescription>
|
|
38
|
+
</CardHeader>
|
|
39
|
+
<CardContent>
|
|
40
|
+
<p className="text-sm text-muted-foreground">Check your inbox for the latest updates.</p>
|
|
41
|
+
</CardContent>
|
|
42
|
+
</Card>
|
|
43
|
+
),
|
|
44
44
|
};
|