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