@luanthnh/cntt-ui 0.1.8 → 0.1.9
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/package.json +5 -1
- package/.storybook/globals.d.ts +0 -1
- package/.storybook/main.ts +0 -29
- package/.storybook/preview.ts +0 -32
- package/assets/fonts/Montserrat-Black.eot +0 -0
- package/assets/fonts/Montserrat-Black.ttf +0 -0
- package/assets/fonts/Montserrat-Black.woff +0 -0
- package/assets/fonts/Montserrat-Black.woff2 +0 -0
- package/assets/fonts/Montserrat-BlackItalic.eot +0 -0
- package/assets/fonts/Montserrat-BlackItalic.ttf +0 -0
- package/assets/fonts/Montserrat-BlackItalic.woff +0 -0
- package/assets/fonts/Montserrat-BlackItalic.woff2 +0 -0
- package/assets/fonts/Montserrat-Bold.eot +0 -0
- package/assets/fonts/Montserrat-Bold.ttf +0 -0
- package/assets/fonts/Montserrat-Bold.woff +0 -0
- package/assets/fonts/Montserrat-Bold.woff2 +0 -0
- package/assets/fonts/Montserrat-BoldItalic.eot +0 -0
- package/assets/fonts/Montserrat-BoldItalic.ttf +0 -0
- package/assets/fonts/Montserrat-BoldItalic.woff +0 -0
- package/assets/fonts/Montserrat-BoldItalic.woff2 +0 -0
- package/assets/fonts/Montserrat-ExtraBold.eot +0 -0
- package/assets/fonts/Montserrat-ExtraBold.ttf +0 -0
- package/assets/fonts/Montserrat-ExtraBold.woff +0 -0
- package/assets/fonts/Montserrat-ExtraBold.woff2 +0 -0
- package/assets/fonts/Montserrat-ExtraBoldItalic.eot +0 -0
- package/assets/fonts/Montserrat-ExtraBoldItalic.ttf +0 -0
- package/assets/fonts/Montserrat-ExtraBoldItalic.woff +0 -0
- package/assets/fonts/Montserrat-ExtraBoldItalic.woff2 +0 -0
- package/assets/fonts/Montserrat-ExtraLight.eot +0 -0
- package/assets/fonts/Montserrat-ExtraLight.ttf +0 -0
- package/assets/fonts/Montserrat-ExtraLight.woff +0 -0
- package/assets/fonts/Montserrat-ExtraLight.woff2 +0 -0
- package/assets/fonts/Montserrat-ExtraLightItalic.eot +0 -0
- package/assets/fonts/Montserrat-ExtraLightItalic.ttf +0 -0
- package/assets/fonts/Montserrat-ExtraLightItalic.woff +0 -0
- package/assets/fonts/Montserrat-ExtraLightItalic.woff2 +0 -0
- package/assets/fonts/Montserrat-Italic.eot +0 -0
- package/assets/fonts/Montserrat-Italic.ttf +0 -0
- package/assets/fonts/Montserrat-Italic.woff +0 -0
- package/assets/fonts/Montserrat-Italic.woff2 +0 -0
- package/assets/fonts/Montserrat-Light.eot +0 -0
- package/assets/fonts/Montserrat-Light.ttf +0 -0
- package/assets/fonts/Montserrat-Light.woff +0 -0
- package/assets/fonts/Montserrat-Light.woff2 +0 -0
- package/assets/fonts/Montserrat-LightItalic.eot +0 -0
- package/assets/fonts/Montserrat-LightItalic.ttf +0 -0
- package/assets/fonts/Montserrat-LightItalic.woff +0 -0
- package/assets/fonts/Montserrat-LightItalic.woff2 +0 -0
- package/assets/fonts/Montserrat-Medium.eot +0 -0
- package/assets/fonts/Montserrat-Medium.ttf +0 -0
- package/assets/fonts/Montserrat-Medium.woff +0 -0
- package/assets/fonts/Montserrat-Medium.woff2 +0 -0
- package/assets/fonts/Montserrat-MediumItalic.eot +0 -0
- package/assets/fonts/Montserrat-MediumItalic.ttf +0 -0
- package/assets/fonts/Montserrat-MediumItalic.woff +0 -0
- package/assets/fonts/Montserrat-MediumItalic.woff2 +0 -0
- package/assets/fonts/Montserrat-Regular.eot +0 -0
- package/assets/fonts/Montserrat-Regular.ttf +0 -0
- package/assets/fonts/Montserrat-Regular.woff +0 -0
- package/assets/fonts/Montserrat-Regular.woff2 +0 -0
- package/assets/fonts/Montserrat-SemiBold.eot +0 -0
- package/assets/fonts/Montserrat-SemiBold.ttf +0 -0
- package/assets/fonts/Montserrat-SemiBold.woff +0 -0
- package/assets/fonts/Montserrat-SemiBold.woff2 +0 -0
- package/assets/fonts/Montserrat-SemiBoldItalic.eot +0 -0
- package/assets/fonts/Montserrat-SemiBoldItalic.ttf +0 -0
- package/assets/fonts/Montserrat-SemiBoldItalic.woff +0 -0
- package/assets/fonts/Montserrat-SemiBoldItalic.woff2 +0 -0
- package/assets/fonts/Montserrat-Thin.eot +0 -0
- package/assets/fonts/Montserrat-Thin.ttf +0 -0
- package/assets/fonts/Montserrat-Thin.woff +0 -0
- package/assets/fonts/Montserrat-Thin.woff2 +0 -0
- package/assets/fonts/Montserrat-ThinItalic.eot +0 -0
- package/assets/fonts/Montserrat-ThinItalic.ttf +0 -0
- package/assets/fonts/Montserrat-ThinItalic.woff +0 -0
- package/assets/fonts/Montserrat-ThinItalic.woff2 +0 -0
- package/assets/fonts/Montserrat-Variable.eot +0 -0
- package/assets/fonts/Montserrat-Variable.ttf +0 -0
- package/assets/fonts/Montserrat-Variable.woff +0 -0
- package/assets/fonts/Montserrat-Variable.woff2 +0 -0
- package/assets/fonts/Montserrat-VariableItalic.eot +0 -0
- package/assets/fonts/Montserrat-VariableItalic.ttf +0 -0
- package/assets/fonts/Montserrat-VariableItalic.woff +0 -0
- package/assets/fonts/Montserrat-VariableItalic.woff2 +0 -0
- package/assets/icons/arrow-left.svg +0 -1
- package/assets/icons/file.svg +0 -1
- package/assets/icons/globe.svg +0 -1
- package/assets/icons/logo-line.svg +0 -1
- package/assets/icons/next.svg +0 -1
- package/assets/icons/panel-left-expand.svg +0 -1
- package/assets/icons/placeholder.svg +0 -57
- package/assets/icons/vercel.svg +0 -1
- package/assets/icons/window.svg +0 -1
- package/assets/lotties/error-404.json +0 -19642
- package/assets/lotties/error.json +0 -2414
- package/assets/lotties/loader.json +0 -305
- package/components/Welcome.mdx +0 -74
- package/components/lenis/index.tsx +0 -48
- package/components/motion/auto-height.tsx +0 -56
- package/components/motion/cursor.tsx +0 -108
- package/components/motion/highlight.tsx +0 -605
- package/components/motion/number-ticker.tsx +0 -55
- package/components/motion/slot.tsx +0 -106
- package/components/motion/waves.tsx +0 -417
- package/components/primitives/tabs.tsx +0 -174
- package/components/ui/Accordion/index.stories.tsx +0 -39
- package/components/ui/Accordion/index.tsx +0 -170
- package/components/ui/Alert/index.stories.tsx +0 -39
- package/components/ui/Alert/index.tsx +0 -60
- package/components/ui/AlertDialog/index.stories.tsx +0 -47
- package/components/ui/AlertDialog/index.tsx +0 -172
- package/components/ui/AspectRatio/index.stories.tsx +0 -40
- package/components/ui/AspectRatio/index.tsx +0 -9
- package/components/ui/Avatar/index.stories.tsx +0 -39
- package/components/ui/Avatar/index.tsx +0 -44
- package/components/ui/Badge/index.stories.tsx +0 -64
- package/components/ui/Badge/index.tsx +0 -46
- package/components/ui/Breadcrumb/index.stories.tsx +0 -64
- package/components/ui/Breadcrumb/index.tsx +0 -102
- package/components/ui/Button/index.stories.tsx +0 -232
- package/components/ui/Button/index.tsx +0 -114
- package/components/ui/Calendar/index.stories.tsx +0 -20
- package/components/ui/Calendar/index.tsx +0 -149
- package/components/ui/Card/index.stories.tsx +0 -39
- package/components/ui/Card/index.tsx +0 -65
- package/components/ui/Carousel/index.stories.tsx +0 -37
- package/components/ui/Carousel/index.tsx +0 -242
- package/components/ui/Chart/index.stories.tsx +0 -53
- package/components/ui/Chart/index.tsx +0 -322
- package/components/ui/Checkbox/index.stories.tsx +0 -56
- package/components/ui/Checkbox/index.tsx +0 -167
- package/components/ui/CircleProcess/index.stories.tsx +0 -29
- package/components/ui/CircleProcess/index.tsx +0 -50
- package/components/ui/Collapsible/index.stories.tsx +0 -33
- package/components/ui/Collapsible/index.tsx +0 -124
- package/components/ui/Command/index.stories.tsx +0 -65
- package/components/ui/Command/index.tsx +0 -161
- package/components/ui/Container/index.stories.tsx +0 -22
- package/components/ui/Container/index.tsx +0 -30
- package/components/ui/ContextMenu/index.stories.tsx +0 -51
- package/components/ui/ContextMenu/index.tsx +0 -224
- package/components/ui/Dialog/index.stories.tsx +0 -44
- package/components/ui/Dialog/index.tsx +0 -156
- package/components/ui/Drawer/index.stories.tsx +0 -54
- package/components/ui/Drawer/index.tsx +0 -124
- package/components/ui/DropdownMenu/index.stories.tsx +0 -83
- package/components/ui/DropdownMenu/index.tsx +0 -231
- package/components/ui/Dropzone/index.stories.tsx +0 -18
- package/components/ui/Dropzone/index.tsx +0 -47
- package/components/ui/Form/date-field.tsx +0 -77
- package/components/ui/Form/index.stories.tsx +0 -67
- package/components/ui/Form/index.tsx +0 -193
- package/components/ui/Form/select-field.tsx +0 -55
- package/components/ui/Form/text-area-field.tsx +0 -37
- package/components/ui/Form/text-field.tsx +0 -72
- package/components/ui/HStack/index.stories.tsx +0 -48
- package/components/ui/HStack/index.tsx +0 -73
- package/components/ui/HoverCard/index.stories.tsx +0 -38
- package/components/ui/HoverCard/index.tsx +0 -38
- package/components/ui/Icons/index.stories.tsx +0 -27
- package/components/ui/Icons/index.tsx +0 -33
- package/components/ui/ImageWithFallback/index.stories.tsx +0 -32
- package/components/ui/ImageWithFallback/index.tsx +0 -34
- package/components/ui/Input/index.stories.tsx +0 -47
- package/components/ui/Input/index.tsx +0 -21
- package/components/ui/InputOtp/index.stories.tsx +0 -35
- package/components/ui/InputOtp/index.tsx +0 -70
- package/components/ui/Label/index.stories.tsx +0 -18
- package/components/ui/Label/index.tsx +0 -21
- package/components/ui/Marquee/index.stories.tsx +0 -71
- package/components/ui/Marquee/index.tsx +0 -65
- package/components/ui/Menubar/index.stories.tsx +0 -116
- package/components/ui/Menubar/index.tsx +0 -252
- package/components/ui/NavigationMenu/index.stories.tsx +0 -112
- package/components/ui/NavigationMenu/index.tsx +0 -185
- package/components/ui/NoData/index.stories.tsx +0 -24
- package/components/ui/NoData/index.tsx +0 -19
- package/components/ui/Pagination/index.stories.tsx +0 -53
- package/components/ui/Pagination/index.tsx +0 -114
- package/components/ui/Popover/index.stories.tsx +0 -31
- package/components/ui/Popover/index.tsx +0 -42
- package/components/ui/Progress/index.stories.tsx +0 -35
- package/components/ui/Progress/index.tsx +0 -28
- package/components/ui/RadioGroup/index.stories.tsx +0 -28
- package/components/ui/RadioGroup/index.tsx +0 -45
- package/components/ui/Resizable/index.stories.tsx +0 -44
- package/components/ui/Resizable/index.tsx +0 -54
- package/components/ui/ScrollArea/index.stories.tsx +0 -31
- package/components/ui/ScrollArea/index.tsx +0 -56
- package/components/ui/Select/index.stories.tsx +0 -64
- package/components/ui/Select/index.tsx +0 -170
- package/components/ui/Separator/index.stories.tsx +0 -31
- package/components/ui/Separator/index.tsx +0 -28
- package/components/ui/Sheet/index.stories.tsx +0 -45
- package/components/ui/Sheet/index.tsx +0 -130
- package/components/ui/Sidebar/index.stories.tsx +0 -82
- package/components/ui/Sidebar/index.tsx +0 -676
- package/components/ui/Skeleton/index.stories.tsx +0 -36
- package/components/ui/Skeleton/index.tsx +0 -13
- package/components/ui/Slider/index.stories.tsx +0 -48
- package/components/ui/Slider/index.tsx +0 -82
- package/components/ui/Slot/index.stories.tsx +0 -29
- package/components/ui/Slot/index.tsx +0 -106
- package/components/ui/Sonner/index.stories.tsx +0 -36
- package/components/ui/Sonner/index.tsx +0 -31
- package/components/ui/Switch/index.stories.tsx +0 -33
- package/components/ui/Switch/index.tsx +0 -28
- package/components/ui/Table/index.stories.tsx +0 -74
- package/components/ui/Table/index.tsx +0 -95
- package/components/ui/Tabs/index.stories.tsx +0 -38
- package/components/ui/Tabs/index.tsx +0 -78
- package/components/ui/Text/index.stories.tsx +0 -53
- package/components/ui/Text/index.tsx +0 -138
- package/components/ui/Textarea/index.stories.tsx +0 -25
- package/components/ui/Textarea/index.tsx +0 -18
- package/components/ui/Toggle/index.stories.tsx +0 -52
- package/components/ui/Toggle/index.tsx +0 -46
- package/components/ui/ToggleGroup/index.stories.tsx +0 -52
- package/components/ui/ToggleGroup/index.tsx +0 -69
- package/components/ui/Tooltip/index.stories.tsx +0 -29
- package/components/ui/Tooltip/index.tsx +0 -35
- package/components/ui/VStack/index.stories.tsx +0 -45
- package/components/ui/VStack/index.tsx +0 -69
- package/components/ui/colors.stories.tsx +0 -148
- package/eslint.config.js +0 -10
- package/hooks/index.ts +0 -3
- package/hooks/use-auto-height.tsx +0 -99
- package/hooks/use-controlled-state.tsx +0 -32
- package/hooks/use-mobile.ts +0 -19
- package/index.ts +0 -58
- package/lib/get-strict-context.ts +0 -15
- package/lib/utils.ts +0 -10
- package/scripts/generate-exports.ts +0 -32
- package/tsconfig.json +0 -12
- package/tsconfig.tsbuildinfo +0 -1
- package/tsup.config.ts +0 -11
- package/types/svg.d.ts +0 -10
- package/vercel.json +0 -5
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import { ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon } from 'lucide-react';
|
|
5
|
-
import { DayButton, DayPicker } from 'react-day-picker';
|
|
6
|
-
|
|
7
|
-
import { cn } from '@/lib/utils';
|
|
8
|
-
import { Button, buttonVariants } from '@/components/ui/Button';
|
|
9
|
-
|
|
10
|
-
type CalendarChevronProps = React.SVGProps<SVGSVGElement> & {
|
|
11
|
-
orientation?: 'left' | 'right' | 'up' | 'down';
|
|
12
|
-
};
|
|
13
|
-
function Calendar({
|
|
14
|
-
className,
|
|
15
|
-
classNames,
|
|
16
|
-
showOutsideDays = true,
|
|
17
|
-
captionLayout = 'label',
|
|
18
|
-
buttonVariant = 'ghost',
|
|
19
|
-
formatters,
|
|
20
|
-
components,
|
|
21
|
-
...props
|
|
22
|
-
}: React.ComponentProps<typeof DayPicker> & {
|
|
23
|
-
buttonVariant?: React.ComponentProps<typeof Button>['variant'];
|
|
24
|
-
}) {
|
|
25
|
-
return (
|
|
26
|
-
<DayPicker
|
|
27
|
-
showOutsideDays={showOutsideDays}
|
|
28
|
-
className={cn(
|
|
29
|
-
'bg-background group/calendar p-3 [--cell-size:--spacing(8)] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent',
|
|
30
|
-
String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,
|
|
31
|
-
String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,
|
|
32
|
-
className,
|
|
33
|
-
)}
|
|
34
|
-
captionLayout={captionLayout}
|
|
35
|
-
formatters={{
|
|
36
|
-
formatMonthDropdown: (date) => date.toLocaleString('default', { month: 'short' }),
|
|
37
|
-
...formatters,
|
|
38
|
-
}}
|
|
39
|
-
classNames={{
|
|
40
|
-
root: 'w-fit',
|
|
41
|
-
months: 'relative flex flex-col gap-4 md:flex-row',
|
|
42
|
-
month: 'flex w-full flex-col gap-4',
|
|
43
|
-
nav: 'absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1',
|
|
44
|
-
button_previous: cn(
|
|
45
|
-
buttonVariants({ variant: buttonVariant }),
|
|
46
|
-
'size-(--cell-size) p-0 select-none aria-disabled:opacity-50',
|
|
47
|
-
),
|
|
48
|
-
button_next: cn(
|
|
49
|
-
buttonVariants({ variant: buttonVariant }),
|
|
50
|
-
'size-(--cell-size) p-0 select-none aria-disabled:opacity-50',
|
|
51
|
-
),
|
|
52
|
-
month_caption: 'flex h-(--cell-size) w-full items-center justify-center px-(--cell-size)',
|
|
53
|
-
dropdowns:
|
|
54
|
-
'flex h-(--cell-size) w-full items-center justify-center gap-1.5 text-sm font-medium',
|
|
55
|
-
dropdown_root:
|
|
56
|
-
'has-focus:border-ring border-input has-focus:ring-ring/50 relative rounded-md border shadow-xs has-focus:ring-[3px]',
|
|
57
|
-
dropdown: 'bg-popover absolute inset-0 opacity-0',
|
|
58
|
-
caption_label: cn(
|
|
59
|
-
'font-medium select-none',
|
|
60
|
-
captionLayout === 'label'
|
|
61
|
-
? 'text-sm'
|
|
62
|
-
: '[&>svg]:text-muted-foreground flex h-8 items-center gap-1 rounded-md pr-1 pl-2 text-sm [&>svg]:size-3.5',
|
|
63
|
-
),
|
|
64
|
-
table: 'w-full border-collapse',
|
|
65
|
-
weekdays: 'flex',
|
|
66
|
-
weekday: 'text-muted-foreground flex-1 rounded-md text-[0.8rem] font-normal select-none',
|
|
67
|
-
week: 'mt-2 flex w-full',
|
|
68
|
-
week_number_header: 'w-(--cell-size) select-none',
|
|
69
|
-
week_number: 'text-muted-foreground text-[0.8rem] select-none',
|
|
70
|
-
day: cn(
|
|
71
|
-
'group/day relative aspect-square h-full w-full p-0 text-center select-none [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md',
|
|
72
|
-
),
|
|
73
|
-
range_start: 'bg-accent rounded-l-md',
|
|
74
|
-
range_middle: 'rounded-none',
|
|
75
|
-
range_end: 'bg-accent rounded-r-md',
|
|
76
|
-
today: cn('bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none'),
|
|
77
|
-
outside: 'text-muted-foreground aria-selected:text-muted-foreground',
|
|
78
|
-
disabled: 'text-muted-foreground opacity-50',
|
|
79
|
-
hidden: 'invisible',
|
|
80
|
-
...classNames,
|
|
81
|
-
}}
|
|
82
|
-
components={{
|
|
83
|
-
Root: ({ className, rootRef, ...props }) => {
|
|
84
|
-
return <div data-slot="calendar" ref={rootRef} className={cn(className)} {...props} />;
|
|
85
|
-
},
|
|
86
|
-
Chevron: ({ className, orientation, ...props }: CalendarChevronProps) => {
|
|
87
|
-
if (orientation === 'left') {
|
|
88
|
-
return <ChevronLeftIcon className={cn('size-4', className)} {...props} />;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
if (orientation === 'right') {
|
|
92
|
-
return <ChevronRightIcon className={cn('size-4', className)} {...props} />;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
return <ChevronDownIcon className={cn('size-4', className)} {...props} />;
|
|
96
|
-
},
|
|
97
|
-
DayButton: CalendarDayButton,
|
|
98
|
-
WeekNumber: ({ week, ...props }) => {
|
|
99
|
-
return (
|
|
100
|
-
<td {...props}>
|
|
101
|
-
<div className="flex size-(--cell-size) items-center justify-center text-center">
|
|
102
|
-
{week.weekNumber}
|
|
103
|
-
</div>
|
|
104
|
-
</td>
|
|
105
|
-
);
|
|
106
|
-
},
|
|
107
|
-
...components,
|
|
108
|
-
}}
|
|
109
|
-
{...props}
|
|
110
|
-
/>
|
|
111
|
-
);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
function CalendarDayButton({
|
|
115
|
-
className,
|
|
116
|
-
day,
|
|
117
|
-
modifiers,
|
|
118
|
-
...props
|
|
119
|
-
}: React.ComponentProps<typeof DayButton>) {
|
|
120
|
-
const ref = React.useRef<HTMLButtonElement>(null);
|
|
121
|
-
React.useEffect(() => {
|
|
122
|
-
if (modifiers.focused) ref.current?.focus();
|
|
123
|
-
}, [modifiers.focused]);
|
|
124
|
-
|
|
125
|
-
return (
|
|
126
|
-
<Button
|
|
127
|
-
ref={ref}
|
|
128
|
-
variant="ghost"
|
|
129
|
-
size="icon"
|
|
130
|
-
data-day={day.date.toLocaleDateString()}
|
|
131
|
-
data-selected-single={
|
|
132
|
-
modifiers.selected &&
|
|
133
|
-
!modifiers.range_start &&
|
|
134
|
-
!modifiers.range_end &&
|
|
135
|
-
!modifiers.range_middle
|
|
136
|
-
}
|
|
137
|
-
data-range-start={modifiers.range_start}
|
|
138
|
-
data-range-end={modifiers.range_end}
|
|
139
|
-
data-range-middle={modifiers.range_middle}
|
|
140
|
-
className={cn(
|
|
141
|
-
'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',
|
|
142
|
-
className,
|
|
143
|
-
)}
|
|
144
|
-
{...props}
|
|
145
|
-
/>
|
|
146
|
-
);
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
export { Calendar, CalendarDayButton };
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
|
|
3
|
-
import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from './index';
|
|
4
|
-
|
|
5
|
-
const meta: Meta<typeof Card> = {
|
|
6
|
-
title: 'UI/Card',
|
|
7
|
-
component: Card,
|
|
8
|
-
tags: ['autodocs'],
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export default meta;
|
|
12
|
-
type Story = StoryObj<typeof Card>;
|
|
13
|
-
|
|
14
|
-
export const Default: Story = {
|
|
15
|
-
render: (args) => (
|
|
16
|
-
<Card {...args} className="w-87.5">
|
|
17
|
-
<CardHeader>
|
|
18
|
-
<CardTitle>Card Title</CardTitle>
|
|
19
|
-
<CardDescription>Card Description provides additional context.</CardDescription>
|
|
20
|
-
</CardHeader>
|
|
21
|
-
<CardContent>
|
|
22
|
-
<p>This is the main content of the card. You can place anything here.</p>
|
|
23
|
-
</CardContent>
|
|
24
|
-
<CardFooter>
|
|
25
|
-
<p className="text-muted-foreground text-sm">Card Footer</p>
|
|
26
|
-
</CardFooter>
|
|
27
|
-
</Card>
|
|
28
|
-
),
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
export const Simple: Story = {
|
|
32
|
-
render: (args) => (
|
|
33
|
-
<Card {...args} className="w-75">
|
|
34
|
-
<CardContent className="pt-6">
|
|
35
|
-
<p>A simple card with only content.</p>
|
|
36
|
-
</CardContent>
|
|
37
|
-
</Card>
|
|
38
|
-
),
|
|
39
|
-
};
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
import { cn } from '@/lib/utils';
|
|
4
|
-
|
|
5
|
-
function Card({ className, ...props }: React.ComponentProps<'div'>) {
|
|
6
|
-
return (
|
|
7
|
-
<div
|
|
8
|
-
data-slot="card"
|
|
9
|
-
className={cn(
|
|
10
|
-
'bg-card text-card-foreground border-border flex flex-col gap-6 rounded-2xl border',
|
|
11
|
-
className,
|
|
12
|
-
)}
|
|
13
|
-
{...props}
|
|
14
|
-
/>
|
|
15
|
-
);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
function CardHeader({ className, ...props }: React.ComponentProps<'div'>) {
|
|
19
|
-
return (
|
|
20
|
-
<div
|
|
21
|
-
data-slot="card-header"
|
|
22
|
-
className={cn(
|
|
23
|
-
'@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 pt-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6',
|
|
24
|
-
className,
|
|
25
|
-
)}
|
|
26
|
-
{...props}
|
|
27
|
-
/>
|
|
28
|
-
);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
function CardTitle({ className, ...props }: React.ComponentProps<'div'>) {
|
|
32
|
-
return <h4 data-slot="card-title" className={cn(className)} {...props} />;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
function CardDescription({ className, ...props }: React.ComponentProps<'div'>) {
|
|
36
|
-
return (
|
|
37
|
-
<p data-slot="card-description" className={cn('text-muted-foreground', className)} {...props} />
|
|
38
|
-
);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
function CardAction({ className, ...props }: React.ComponentProps<'div'>) {
|
|
42
|
-
return (
|
|
43
|
-
<div
|
|
44
|
-
data-slot="card-action"
|
|
45
|
-
className={cn('col-start-2 row-span-2 row-start-1 self-start justify-self-end', className)}
|
|
46
|
-
{...props}
|
|
47
|
-
/>
|
|
48
|
-
);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
function CardContent({ className, ...props }: React.ComponentProps<'div'>) {
|
|
52
|
-
return <div data-slot="card-content" className={cn('px-6 last:pb-6', className)} {...props} />;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
function CardFooter({ className, ...props }: React.ComponentProps<'div'>) {
|
|
56
|
-
return (
|
|
57
|
-
<div
|
|
58
|
-
data-slot="card-footer"
|
|
59
|
-
className={cn('flex items-center px-6 pb-6 [.border-t]:pt-6', className)}
|
|
60
|
-
{...props}
|
|
61
|
-
/>
|
|
62
|
-
);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle };
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
|
|
3
|
-
import { Card, CardContent } from '../Card';
|
|
4
|
-
import { Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious } from './index';
|
|
5
|
-
|
|
6
|
-
const meta: Meta<typeof Carousel> = {
|
|
7
|
-
title: 'UI/Carousel',
|
|
8
|
-
component: Carousel,
|
|
9
|
-
tags: ['autodocs'],
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export default meta;
|
|
13
|
-
type Story = StoryObj<typeof Carousel>;
|
|
14
|
-
|
|
15
|
-
export const Default: Story = {
|
|
16
|
-
render: (args) => (
|
|
17
|
-
<div className="flex justify-center px-12">
|
|
18
|
-
<Carousel {...args} className="w-full max-w-xs">
|
|
19
|
-
<CarouselContent>
|
|
20
|
-
{Array.from({ length: 5 }).map((_, index) => (
|
|
21
|
-
<CarouselItem key={index}>
|
|
22
|
-
<div className="p-1">
|
|
23
|
-
<Card>
|
|
24
|
-
<CardContent className="flex aspect-square items-center justify-center p-6">
|
|
25
|
-
<span className="text-4xl font-semibold">{index + 1}</span>
|
|
26
|
-
</CardContent>
|
|
27
|
-
</Card>
|
|
28
|
-
</div>
|
|
29
|
-
</CarouselItem>
|
|
30
|
-
))}
|
|
31
|
-
</CarouselContent>
|
|
32
|
-
<CarouselPrevious />
|
|
33
|
-
<CarouselNext />
|
|
34
|
-
</Carousel>
|
|
35
|
-
</div>
|
|
36
|
-
),
|
|
37
|
-
};
|
|
@@ -1,242 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import useEmblaCarousel, { type UseEmblaCarouselType } from 'embla-carousel-react';
|
|
5
|
-
import { ArrowLeft, ArrowRight } from 'lucide-react';
|
|
6
|
-
|
|
7
|
-
import { cn } from '@/lib/utils';
|
|
8
|
-
import { Button } from '@/components/ui/Button';
|
|
9
|
-
|
|
10
|
-
type CarouselApi = UseEmblaCarouselType[1];
|
|
11
|
-
type UseCarouselParameters = Parameters<typeof useEmblaCarousel>;
|
|
12
|
-
type CarouselOptions = UseCarouselParameters[0];
|
|
13
|
-
type CarouselPlugin = UseCarouselParameters[1];
|
|
14
|
-
|
|
15
|
-
type CarouselProps = {
|
|
16
|
-
opts?: CarouselOptions;
|
|
17
|
-
plugins?: CarouselPlugin;
|
|
18
|
-
orientation?: 'horizontal' | 'vertical';
|
|
19
|
-
setApi?: (api: CarouselApi) => void;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
type CarouselContextProps = {
|
|
23
|
-
carouselRef: ReturnType<typeof useEmblaCarousel>[0];
|
|
24
|
-
api: ReturnType<typeof useEmblaCarousel>[1];
|
|
25
|
-
scrollPrev: () => void;
|
|
26
|
-
scrollNext: () => void;
|
|
27
|
-
canScrollPrev: boolean;
|
|
28
|
-
canScrollNext: boolean;
|
|
29
|
-
} & CarouselProps;
|
|
30
|
-
|
|
31
|
-
const CarouselContext = React.createContext<CarouselContextProps | null>(null);
|
|
32
|
-
|
|
33
|
-
function useCarousel() {
|
|
34
|
-
const context = React.useContext(CarouselContext);
|
|
35
|
-
|
|
36
|
-
if (!context) {
|
|
37
|
-
throw new Error('useCarousel must be used within a <Carousel />');
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
return context;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
function Carousel({
|
|
44
|
-
orientation = 'horizontal',
|
|
45
|
-
opts,
|
|
46
|
-
setApi,
|
|
47
|
-
plugins,
|
|
48
|
-
className,
|
|
49
|
-
children,
|
|
50
|
-
...props
|
|
51
|
-
}: React.ComponentProps<'div'> & CarouselProps) {
|
|
52
|
-
const [carouselRef, api] = useEmblaCarousel(
|
|
53
|
-
{
|
|
54
|
-
...opts,
|
|
55
|
-
axis: orientation === 'horizontal' ? 'x' : 'y',
|
|
56
|
-
},
|
|
57
|
-
plugins,
|
|
58
|
-
);
|
|
59
|
-
const [canScrollPrev, setCanScrollPrev] = React.useState(false);
|
|
60
|
-
const [canScrollNext, setCanScrollNext] = React.useState(false);
|
|
61
|
-
|
|
62
|
-
const onSelect = React.useCallback((api: CarouselApi) => {
|
|
63
|
-
if (!api) return;
|
|
64
|
-
setCanScrollPrev(api.canScrollPrev());
|
|
65
|
-
setCanScrollNext(api.canScrollNext());
|
|
66
|
-
}, []);
|
|
67
|
-
|
|
68
|
-
const scrollPrev = React.useCallback(() => {
|
|
69
|
-
api?.scrollPrev();
|
|
70
|
-
}, [api]);
|
|
71
|
-
|
|
72
|
-
const scrollNext = React.useCallback(() => {
|
|
73
|
-
api?.scrollNext();
|
|
74
|
-
}, [api]);
|
|
75
|
-
|
|
76
|
-
const handleKeyDown = React.useCallback(
|
|
77
|
-
(event: React.KeyboardEvent<HTMLDivElement>) => {
|
|
78
|
-
if (event.key === 'ArrowLeft') {
|
|
79
|
-
event.preventDefault();
|
|
80
|
-
scrollPrev();
|
|
81
|
-
} else if (event.key === 'ArrowRight') {
|
|
82
|
-
event.preventDefault();
|
|
83
|
-
scrollNext();
|
|
84
|
-
}
|
|
85
|
-
},
|
|
86
|
-
[scrollPrev, scrollNext],
|
|
87
|
-
);
|
|
88
|
-
|
|
89
|
-
React.useEffect(() => {
|
|
90
|
-
if (!api || !setApi) return;
|
|
91
|
-
setApi(api);
|
|
92
|
-
}, [api, setApi]);
|
|
93
|
-
|
|
94
|
-
React.useEffect(() => {
|
|
95
|
-
if (!api) return;
|
|
96
|
-
onSelect(api);
|
|
97
|
-
api.on('reInit', onSelect);
|
|
98
|
-
api.on('select', onSelect);
|
|
99
|
-
|
|
100
|
-
return () => {
|
|
101
|
-
api?.off('select', onSelect);
|
|
102
|
-
};
|
|
103
|
-
}, [api, onSelect]);
|
|
104
|
-
|
|
105
|
-
return (
|
|
106
|
-
<CarouselContext.Provider
|
|
107
|
-
value={{
|
|
108
|
-
carouselRef,
|
|
109
|
-
api: api,
|
|
110
|
-
opts,
|
|
111
|
-
orientation: orientation || (opts?.axis === 'y' ? 'vertical' : 'horizontal'),
|
|
112
|
-
scrollPrev,
|
|
113
|
-
scrollNext,
|
|
114
|
-
canScrollPrev,
|
|
115
|
-
canScrollNext,
|
|
116
|
-
}}
|
|
117
|
-
>
|
|
118
|
-
<div
|
|
119
|
-
onKeyDownCapture={handleKeyDown}
|
|
120
|
-
className={cn('relative', className)}
|
|
121
|
-
role="region"
|
|
122
|
-
aria-roledescription="carousel"
|
|
123
|
-
data-slot="carousel"
|
|
124
|
-
{...props}
|
|
125
|
-
>
|
|
126
|
-
{children}
|
|
127
|
-
</div>
|
|
128
|
-
</CarouselContext.Provider>
|
|
129
|
-
);
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
function CarouselContent({ className, ...props }: React.ComponentProps<'div'>) {
|
|
133
|
-
const { carouselRef, orientation } = useCarousel();
|
|
134
|
-
|
|
135
|
-
return (
|
|
136
|
-
<div ref={carouselRef} className="overflow-hidden" data-slot="carousel-content">
|
|
137
|
-
<div
|
|
138
|
-
className={cn('flex', orientation === 'horizontal' ? '-ml-0' : '-mt-4 flex-col', className)}
|
|
139
|
-
{...props}
|
|
140
|
-
/>
|
|
141
|
-
</div>
|
|
142
|
-
);
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
function CarouselItem({ className, ...props }: React.ComponentProps<'div'>) {
|
|
146
|
-
const { orientation } = useCarousel();
|
|
147
|
-
|
|
148
|
-
return (
|
|
149
|
-
<div
|
|
150
|
-
role="group"
|
|
151
|
-
aria-roledescription="slide"
|
|
152
|
-
data-slot="carousel-item"
|
|
153
|
-
className={cn(
|
|
154
|
-
'min-w-0 shrink-0 grow-0 basis-full',
|
|
155
|
-
orientation === 'horizontal' ? 'pl-4' : 'pt-4',
|
|
156
|
-
className,
|
|
157
|
-
)}
|
|
158
|
-
{...props}
|
|
159
|
-
/>
|
|
160
|
-
);
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
function CarouselPrevious({
|
|
164
|
-
className,
|
|
165
|
-
variant = 'outline',
|
|
166
|
-
size = 'icon',
|
|
167
|
-
...props
|
|
168
|
-
}: React.ComponentProps<typeof Button>) {
|
|
169
|
-
const { orientation, scrollPrev, canScrollPrev } = useCarousel();
|
|
170
|
-
|
|
171
|
-
return (
|
|
172
|
-
<Button
|
|
173
|
-
data-slot="carousel-previous"
|
|
174
|
-
variant={variant}
|
|
175
|
-
size={size}
|
|
176
|
-
className={cn(
|
|
177
|
-
'absolute size-8 rounded-full',
|
|
178
|
-
orientation === 'horizontal'
|
|
179
|
-
? 'top-1/2 -left-12 -translate-y-1/2'
|
|
180
|
-
: '-top-12 left-1/2 -translate-x-1/2 rotate-90',
|
|
181
|
-
className,
|
|
182
|
-
)}
|
|
183
|
-
disabled={!canScrollPrev}
|
|
184
|
-
onClick={scrollPrev}
|
|
185
|
-
{...props}
|
|
186
|
-
>
|
|
187
|
-
<ArrowLeft />
|
|
188
|
-
<span className="sr-only">Previous slide</span>
|
|
189
|
-
</Button>
|
|
190
|
-
);
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
function CarouselNext({
|
|
194
|
-
className,
|
|
195
|
-
variant = 'outline',
|
|
196
|
-
size = 'icon',
|
|
197
|
-
...props
|
|
198
|
-
}: React.ComponentProps<typeof Button>) {
|
|
199
|
-
const { orientation, scrollNext, canScrollNext } = useCarousel();
|
|
200
|
-
|
|
201
|
-
return (
|
|
202
|
-
<Button
|
|
203
|
-
data-slot="carousel-next"
|
|
204
|
-
variant={variant}
|
|
205
|
-
size={size}
|
|
206
|
-
className={cn(
|
|
207
|
-
'absolute size-8 rounded-full',
|
|
208
|
-
orientation === 'horizontal'
|
|
209
|
-
? 'top-1/2 -right-12 -translate-y-1/2'
|
|
210
|
-
: '-bottom-12 left-1/2 -translate-x-1/2 rotate-90',
|
|
211
|
-
className,
|
|
212
|
-
)}
|
|
213
|
-
disabled={!canScrollNext}
|
|
214
|
-
onClick={scrollNext}
|
|
215
|
-
{...props}
|
|
216
|
-
>
|
|
217
|
-
<ArrowRight />
|
|
218
|
-
<span className="sr-only">Next slide</span>
|
|
219
|
-
</Button>
|
|
220
|
-
);
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
const CarouseMoveTo = ({ activeIndex }: { activeIndex: number }) => {
|
|
224
|
-
const { api } = useCarousel();
|
|
225
|
-
|
|
226
|
-
React.useEffect(() => {
|
|
227
|
-
if (!api) return;
|
|
228
|
-
api.scrollTo(activeIndex);
|
|
229
|
-
}, [activeIndex, api]);
|
|
230
|
-
|
|
231
|
-
return <></>;
|
|
232
|
-
};
|
|
233
|
-
|
|
234
|
-
export {
|
|
235
|
-
type CarouselApi,
|
|
236
|
-
Carousel,
|
|
237
|
-
CarouselContent,
|
|
238
|
-
CarouselItem,
|
|
239
|
-
CarouselPrevious,
|
|
240
|
-
CarouselNext,
|
|
241
|
-
CarouseMoveTo,
|
|
242
|
-
};
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
import { Bar, BarChart, CartesianGrid, XAxis } from 'recharts';
|
|
3
|
-
|
|
4
|
-
import { ChartConfig, ChartContainer, ChartTooltip, ChartTooltipContent } from './index';
|
|
5
|
-
|
|
6
|
-
const meta: Meta<typeof ChartContainer> = {
|
|
7
|
-
title: 'UI/Chart',
|
|
8
|
-
component: ChartContainer,
|
|
9
|
-
tags: ['autodocs'],
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export default meta;
|
|
13
|
-
type Story = StoryObj<typeof ChartContainer>;
|
|
14
|
-
|
|
15
|
-
const chartData = [
|
|
16
|
-
{ month: 'January', desktop: 186, mobile: 80 },
|
|
17
|
-
{ month: 'February', desktop: 305, mobile: 200 },
|
|
18
|
-
{ month: 'March', desktop: 237, mobile: 120 },
|
|
19
|
-
{ month: 'April', desktop: 73, mobile: 190 },
|
|
20
|
-
{ month: 'May', desktop: 209, mobile: 130 },
|
|
21
|
-
{ month: 'June', desktop: 214, mobile: 140 },
|
|
22
|
-
];
|
|
23
|
-
|
|
24
|
-
const chartConfig = {
|
|
25
|
-
desktop: {
|
|
26
|
-
label: 'Desktop',
|
|
27
|
-
color: 'hsl(var(--chart-1))',
|
|
28
|
-
},
|
|
29
|
-
mobile: {
|
|
30
|
-
label: 'Mobile',
|
|
31
|
-
color: 'hsl(var(--chart-2))',
|
|
32
|
-
},
|
|
33
|
-
} satisfies ChartConfig;
|
|
34
|
-
|
|
35
|
-
export const Default: Story = {
|
|
36
|
-
render: () => (
|
|
37
|
-
<ChartContainer config={chartConfig} className="min-h-50 w-full">
|
|
38
|
-
<BarChart accessibilityLayer data={chartData}>
|
|
39
|
-
<CartesianGrid vertical={false} />
|
|
40
|
-
<XAxis
|
|
41
|
-
dataKey="month"
|
|
42
|
-
tickLine={false}
|
|
43
|
-
tickMargin={10}
|
|
44
|
-
axisLine={false}
|
|
45
|
-
tickFormatter={(value) => value.slice(0, 3)}
|
|
46
|
-
/>
|
|
47
|
-
<ChartTooltip content={<ChartTooltipContent />} />
|
|
48
|
-
<Bar dataKey="desktop" fill="var(--color-desktop)" radius={4} />
|
|
49
|
-
<Bar dataKey="mobile" fill="var(--color-mobile)" radius={4} />
|
|
50
|
-
</BarChart>
|
|
51
|
-
</ChartContainer>
|
|
52
|
-
),
|
|
53
|
-
};
|