@bupple/vss-ui 1.0.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/.turbo/turbo-lint.log +4 -0
- package/components.json +21 -0
- package/eslint.config.js +4 -0
- package/index.ts +2 -0
- package/package.json +67 -0
- package/postcss.config.mjs +6 -0
- package/src/components/accordion.tsx +84 -0
- package/src/components/alert-dialog.tsx +198 -0
- package/src/components/alert.tsx +77 -0
- package/src/components/aspect-ratio.tsx +11 -0
- package/src/components/avatar.tsx +109 -0
- package/src/components/badge.tsx +50 -0
- package/src/components/breadcrumb.tsx +118 -0
- package/src/components/button-group.tsx +84 -0
- package/src/components/button.tsx +68 -0
- package/src/components/calendar.tsx +223 -0
- package/src/components/card.tsx +102 -0
- package/src/components/carousel.tsx +241 -0
- package/src/components/chart.tsx +373 -0
- package/src/components/checkbox.tsx +32 -0
- package/src/components/collapsible.tsx +33 -0
- package/src/components/combobox.tsx +299 -0
- package/src/components/command.tsx +194 -0
- package/src/components/context-menu.tsx +272 -0
- package/src/components/dialog.tsx +171 -0
- package/src/components/direction.tsx +20 -0
- package/src/components/drawer.tsx +130 -0
- package/src/components/dropdown-menu.tsx +278 -0
- package/src/components/empty.tsx +102 -0
- package/src/components/field.tsx +237 -0
- package/src/components/hover-card.tsx +43 -0
- package/src/components/input-group.tsx +157 -0
- package/src/components/input.tsx +18 -0
- package/src/components/item.tsx +197 -0
- package/src/components/kbd.tsx +26 -0
- package/src/components/label.tsx +21 -0
- package/src/components/menubar.tsx +283 -0
- package/src/components/native-select.tsx +64 -0
- package/src/components/navigation-menu.tsx +166 -0
- package/src/components/pagination.tsx +131 -0
- package/src/components/popover.tsx +88 -0
- package/src/components/progress.tsx +30 -0
- package/src/components/radio-group.tsx +46 -0
- package/src/components/resizable.tsx +49 -0
- package/src/components/scroll-area.tsx +52 -0
- package/src/components/select.tsx +209 -0
- package/src/components/separator.tsx +25 -0
- package/src/components/sheet.tsx +152 -0
- package/src/components/sidebar.tsx +703 -0
- package/src/components/skeleton.tsx +13 -0
- package/src/components/slider.tsx +58 -0
- package/src/components/sonner.tsx +45 -0
- package/src/components/spinner.tsx +15 -0
- package/src/components/switch.tsx +32 -0
- package/src/components/table.tsx +115 -0
- package/src/components/tabs.tsx +89 -0
- package/src/components/textarea.tsx +17 -0
- package/src/components/toggle-group.tsx +86 -0
- package/src/components/toggle.tsx +48 -0
- package/src/components/tooltip.tsx +56 -0
- package/src/hooks/use-mobile.ts +19 -0
- package/src/lib/portal-container.ts +11 -0
- package/src/lib/utils.ts +8 -0
- package/src/theme.css +125 -0
- package/tsconfig.json +15 -0
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { cn } from '@bupple/vss-ui/lib/utils'
|
|
2
|
+
import { ChevronRightIcon, MoreHorizontalIcon } from 'lucide-react'
|
|
3
|
+
import { Slot } from 'radix-ui'
|
|
4
|
+
import * as React from 'react'
|
|
5
|
+
|
|
6
|
+
function Breadcrumb({ className, ...props }: React.ComponentProps<'nav'>) {
|
|
7
|
+
return (
|
|
8
|
+
<nav
|
|
9
|
+
aria-label='breadcrumb'
|
|
10
|
+
data-slot='breadcrumb'
|
|
11
|
+
className={cn(className)}
|
|
12
|
+
{...props}
|
|
13
|
+
/>
|
|
14
|
+
)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function BreadcrumbList({ className, ...props }: React.ComponentProps<'ol'>) {
|
|
18
|
+
return (
|
|
19
|
+
<ol
|
|
20
|
+
data-slot='breadcrumb-list'
|
|
21
|
+
className={cn(
|
|
22
|
+
'flex flex-wrap items-center gap-1.5 text-sm wrap-break-word text-muted-foreground',
|
|
23
|
+
className,
|
|
24
|
+
)}
|
|
25
|
+
{...props}
|
|
26
|
+
/>
|
|
27
|
+
)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function BreadcrumbItem({ className, ...props }: React.ComponentProps<'li'>) {
|
|
31
|
+
return (
|
|
32
|
+
<li
|
|
33
|
+
data-slot='breadcrumb-item'
|
|
34
|
+
className={cn('inline-flex items-center gap-1', className)}
|
|
35
|
+
{...props}
|
|
36
|
+
/>
|
|
37
|
+
)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function BreadcrumbLink({
|
|
41
|
+
asChild,
|
|
42
|
+
className,
|
|
43
|
+
...props
|
|
44
|
+
}: React.ComponentProps<'a'> & {
|
|
45
|
+
asChild?: boolean
|
|
46
|
+
}) {
|
|
47
|
+
const Comp = asChild ? Slot.Root : 'a'
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<Comp
|
|
51
|
+
data-slot='breadcrumb-link'
|
|
52
|
+
className={cn('transition-colors hover:text-foreground', className)}
|
|
53
|
+
{...props}
|
|
54
|
+
/>
|
|
55
|
+
)
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function BreadcrumbPage({ className, ...props }: React.ComponentProps<'span'>) {
|
|
59
|
+
return (
|
|
60
|
+
<span
|
|
61
|
+
data-slot='breadcrumb-page'
|
|
62
|
+
role='link'
|
|
63
|
+
aria-disabled='true'
|
|
64
|
+
aria-current='page'
|
|
65
|
+
className={cn('font-normal text-foreground', className)}
|
|
66
|
+
{...props}
|
|
67
|
+
/>
|
|
68
|
+
)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function BreadcrumbSeparator({
|
|
72
|
+
children,
|
|
73
|
+
className,
|
|
74
|
+
...props
|
|
75
|
+
}: React.ComponentProps<'li'>) {
|
|
76
|
+
return (
|
|
77
|
+
<li
|
|
78
|
+
data-slot='breadcrumb-separator'
|
|
79
|
+
role='presentation'
|
|
80
|
+
aria-hidden='true'
|
|
81
|
+
className={cn('[&>svg]:size-3.5', className)}
|
|
82
|
+
{...props}
|
|
83
|
+
>
|
|
84
|
+
{children ?? <ChevronRightIcon />}
|
|
85
|
+
</li>
|
|
86
|
+
)
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function BreadcrumbEllipsis({
|
|
90
|
+
className,
|
|
91
|
+
...props
|
|
92
|
+
}: React.ComponentProps<'span'>) {
|
|
93
|
+
return (
|
|
94
|
+
<span
|
|
95
|
+
data-slot='breadcrumb-ellipsis'
|
|
96
|
+
role='presentation'
|
|
97
|
+
aria-hidden='true'
|
|
98
|
+
className={cn(
|
|
99
|
+
'flex size-5 items-center justify-center [&>svg]:size-4',
|
|
100
|
+
className,
|
|
101
|
+
)}
|
|
102
|
+
{...props}
|
|
103
|
+
>
|
|
104
|
+
<MoreHorizontalIcon />
|
|
105
|
+
<span className='sr-only'>More</span>
|
|
106
|
+
</span>
|
|
107
|
+
)
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export {
|
|
111
|
+
Breadcrumb,
|
|
112
|
+
BreadcrumbList,
|
|
113
|
+
BreadcrumbItem,
|
|
114
|
+
BreadcrumbLink,
|
|
115
|
+
BreadcrumbPage,
|
|
116
|
+
BreadcrumbSeparator,
|
|
117
|
+
BreadcrumbEllipsis,
|
|
118
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type { VariantProps } from 'class-variance-authority'
|
|
2
|
+
|
|
3
|
+
import { Separator } from '@bupple/vss-ui/components/separator'
|
|
4
|
+
import { cn } from '@bupple/vss-ui/lib/utils'
|
|
5
|
+
import { cva } from 'class-variance-authority'
|
|
6
|
+
import { Slot } from 'radix-ui'
|
|
7
|
+
|
|
8
|
+
const buttonGroupVariants = cva(
|
|
9
|
+
"flex w-fit items-stretch *:focus-visible:relative *:focus-visible:z-10 has-[>[data-slot=button-group]]:gap-2 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-lg [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1",
|
|
10
|
+
{
|
|
11
|
+
variants: {
|
|
12
|
+
orientation: {
|
|
13
|
+
horizontal:
|
|
14
|
+
'[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-r-lg!',
|
|
15
|
+
vertical:
|
|
16
|
+
'flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-b-lg!',
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
defaultVariants: {
|
|
20
|
+
orientation: 'horizontal',
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
function ButtonGroup({
|
|
26
|
+
className,
|
|
27
|
+
orientation,
|
|
28
|
+
...props
|
|
29
|
+
}: React.ComponentProps<'div'> & VariantProps<typeof buttonGroupVariants>) {
|
|
30
|
+
return (
|
|
31
|
+
<div
|
|
32
|
+
role='group'
|
|
33
|
+
data-slot='button-group'
|
|
34
|
+
data-orientation={orientation}
|
|
35
|
+
className={cn(buttonGroupVariants({ orientation }), className)}
|
|
36
|
+
{...props}
|
|
37
|
+
/>
|
|
38
|
+
)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function ButtonGroupText({
|
|
42
|
+
className,
|
|
43
|
+
asChild = false,
|
|
44
|
+
...props
|
|
45
|
+
}: React.ComponentProps<'div'> & {
|
|
46
|
+
asChild?: boolean
|
|
47
|
+
}) {
|
|
48
|
+
const Comp = asChild ? Slot.Root : 'div'
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<Comp
|
|
52
|
+
className={cn(
|
|
53
|
+
"flex items-center gap-2 rounded-lg border bg-muted px-2.5 text-sm font-medium [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4",
|
|
54
|
+
className,
|
|
55
|
+
)}
|
|
56
|
+
{...props}
|
|
57
|
+
/>
|
|
58
|
+
)
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function ButtonGroupSeparator({
|
|
62
|
+
className,
|
|
63
|
+
orientation = 'vertical',
|
|
64
|
+
...props
|
|
65
|
+
}: React.ComponentProps<typeof Separator>) {
|
|
66
|
+
return (
|
|
67
|
+
<Separator
|
|
68
|
+
data-slot='button-group-separator'
|
|
69
|
+
orientation={orientation}
|
|
70
|
+
className={cn(
|
|
71
|
+
'relative self-stretch bg-input data-horizontal:mx-px data-horizontal:w-auto data-vertical:my-px data-vertical:h-auto',
|
|
72
|
+
className,
|
|
73
|
+
)}
|
|
74
|
+
{...props}
|
|
75
|
+
/>
|
|
76
|
+
)
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export {
|
|
80
|
+
ButtonGroup,
|
|
81
|
+
ButtonGroupSeparator,
|
|
82
|
+
ButtonGroupText,
|
|
83
|
+
buttonGroupVariants,
|
|
84
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { VariantProps } from 'class-variance-authority'
|
|
2
|
+
|
|
3
|
+
import { cn } from '@bupple/vss-ui/lib/utils'
|
|
4
|
+
import { cva } from 'class-variance-authority'
|
|
5
|
+
import { Slot } from 'radix-ui'
|
|
6
|
+
import * as React from 'react'
|
|
7
|
+
|
|
8
|
+
const buttonVariants = cva(
|
|
9
|
+
"group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
10
|
+
{
|
|
11
|
+
variants: {
|
|
12
|
+
variant: {
|
|
13
|
+
default: 'bg-primary text-primary-foreground [a]:hover:bg-primary/80',
|
|
14
|
+
outline:
|
|
15
|
+
'border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50',
|
|
16
|
+
secondary:
|
|
17
|
+
'bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground',
|
|
18
|
+
ghost:
|
|
19
|
+
'hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50',
|
|
20
|
+
destructive:
|
|
21
|
+
'bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40',
|
|
22
|
+
link: 'text-primary underline-offset-4 hover:underline',
|
|
23
|
+
},
|
|
24
|
+
size: {
|
|
25
|
+
default:
|
|
26
|
+
'h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2',
|
|
27
|
+
xs: "h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",
|
|
28
|
+
sm: "h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",
|
|
29
|
+
lg: 'h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2',
|
|
30
|
+
icon: 'size-8',
|
|
31
|
+
'icon-xs':
|
|
32
|
+
"size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3",
|
|
33
|
+
'icon-sm':
|
|
34
|
+
'size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg',
|
|
35
|
+
'icon-lg': 'size-9',
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
defaultVariants: {
|
|
39
|
+
variant: 'default',
|
|
40
|
+
size: 'default',
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
function Button({
|
|
46
|
+
className,
|
|
47
|
+
variant = 'default',
|
|
48
|
+
size = 'default',
|
|
49
|
+
asChild = false,
|
|
50
|
+
...props
|
|
51
|
+
}: React.ComponentProps<'button'> &
|
|
52
|
+
VariantProps<typeof buttonVariants> & {
|
|
53
|
+
asChild?: boolean
|
|
54
|
+
}) {
|
|
55
|
+
const Comp = asChild ? Slot.Root : 'button'
|
|
56
|
+
|
|
57
|
+
return (
|
|
58
|
+
<Comp
|
|
59
|
+
data-slot='button'
|
|
60
|
+
data-variant={variant}
|
|
61
|
+
data-size={size}
|
|
62
|
+
className={cn(buttonVariants({ variant, size, className }))}
|
|
63
|
+
{...props}
|
|
64
|
+
/>
|
|
65
|
+
)
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export { Button, buttonVariants }
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import type { DayButton, Locale } from 'react-day-picker'
|
|
2
|
+
|
|
3
|
+
import { Button, buttonVariants } from '@bupple/vss-ui/components/button'
|
|
4
|
+
import { cn } from '@bupple/vss-ui/lib/utils'
|
|
5
|
+
import {
|
|
6
|
+
ChevronDownIcon,
|
|
7
|
+
ChevronLeftIcon,
|
|
8
|
+
ChevronRightIcon,
|
|
9
|
+
} from 'lucide-react'
|
|
10
|
+
import * as React from 'react'
|
|
11
|
+
import { DayPicker, getDefaultClassNames } from 'react-day-picker'
|
|
12
|
+
|
|
13
|
+
function Calendar({
|
|
14
|
+
className,
|
|
15
|
+
classNames,
|
|
16
|
+
showOutsideDays = true,
|
|
17
|
+
captionLayout = 'label',
|
|
18
|
+
buttonVariant = 'ghost',
|
|
19
|
+
locale,
|
|
20
|
+
formatters,
|
|
21
|
+
components,
|
|
22
|
+
...props
|
|
23
|
+
}: React.ComponentProps<typeof DayPicker> & {
|
|
24
|
+
buttonVariant?: React.ComponentProps<typeof Button>['variant']
|
|
25
|
+
}) {
|
|
26
|
+
const defaultClassNames = getDefaultClassNames()
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<DayPicker
|
|
30
|
+
showOutsideDays={showOutsideDays}
|
|
31
|
+
className={cn(
|
|
32
|
+
'group/calendar bg-background p-2 [--cell-radius:var(--radius-md)] [--cell-size:--spacing(7)] in-data-[slot=card-content]:bg-transparent in-data-[slot=popover-content]:bg-transparent',
|
|
33
|
+
String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,
|
|
34
|
+
String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,
|
|
35
|
+
className,
|
|
36
|
+
)}
|
|
37
|
+
captionLayout={captionLayout}
|
|
38
|
+
locale={locale}
|
|
39
|
+
formatters={{
|
|
40
|
+
formatMonthDropdown: (date) =>
|
|
41
|
+
date.toLocaleString(locale?.code, { month: 'short' }),
|
|
42
|
+
...formatters,
|
|
43
|
+
}}
|
|
44
|
+
classNames={{
|
|
45
|
+
root: cn('w-fit', defaultClassNames.root),
|
|
46
|
+
months: cn(
|
|
47
|
+
'relative flex flex-col gap-4 md:flex-row',
|
|
48
|
+
defaultClassNames.months,
|
|
49
|
+
),
|
|
50
|
+
month: cn('flex w-full flex-col gap-4', defaultClassNames.month),
|
|
51
|
+
nav: cn(
|
|
52
|
+
'absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1',
|
|
53
|
+
defaultClassNames.nav,
|
|
54
|
+
),
|
|
55
|
+
button_previous: cn(
|
|
56
|
+
buttonVariants({ variant: buttonVariant }),
|
|
57
|
+
'size-(--cell-size) p-0 select-none aria-disabled:opacity-50',
|
|
58
|
+
defaultClassNames.button_previous,
|
|
59
|
+
),
|
|
60
|
+
button_next: cn(
|
|
61
|
+
buttonVariants({ variant: buttonVariant }),
|
|
62
|
+
'size-(--cell-size) p-0 select-none aria-disabled:opacity-50',
|
|
63
|
+
defaultClassNames.button_next,
|
|
64
|
+
),
|
|
65
|
+
month_caption: cn(
|
|
66
|
+
'flex h-(--cell-size) w-full items-center justify-center px-(--cell-size)',
|
|
67
|
+
defaultClassNames.month_caption,
|
|
68
|
+
),
|
|
69
|
+
dropdowns: cn(
|
|
70
|
+
'flex h-(--cell-size) w-full items-center justify-center gap-1.5 text-sm font-medium',
|
|
71
|
+
defaultClassNames.dropdowns,
|
|
72
|
+
),
|
|
73
|
+
dropdown_root: cn(
|
|
74
|
+
'relative rounded-(--cell-radius)',
|
|
75
|
+
defaultClassNames.dropdown_root,
|
|
76
|
+
),
|
|
77
|
+
dropdown: cn(
|
|
78
|
+
'absolute inset-0 bg-popover opacity-0',
|
|
79
|
+
defaultClassNames.dropdown,
|
|
80
|
+
),
|
|
81
|
+
caption_label: cn(
|
|
82
|
+
'font-medium select-none',
|
|
83
|
+
captionLayout === 'label'
|
|
84
|
+
? 'text-sm'
|
|
85
|
+
: 'flex items-center gap-1 rounded-(--cell-radius) text-sm [&>svg]:size-3.5 [&>svg]:text-muted-foreground',
|
|
86
|
+
defaultClassNames.caption_label,
|
|
87
|
+
),
|
|
88
|
+
table: 'w-full border-collapse',
|
|
89
|
+
weekdays: cn('flex', defaultClassNames.weekdays),
|
|
90
|
+
weekday: cn(
|
|
91
|
+
'flex-1 rounded-(--cell-radius) text-[0.8rem] font-normal text-muted-foreground select-none',
|
|
92
|
+
defaultClassNames.weekday,
|
|
93
|
+
),
|
|
94
|
+
week: cn('mt-2 flex w-full', defaultClassNames.week),
|
|
95
|
+
week_number_header: cn(
|
|
96
|
+
'w-(--cell-size) select-none',
|
|
97
|
+
defaultClassNames.week_number_header,
|
|
98
|
+
),
|
|
99
|
+
week_number: cn(
|
|
100
|
+
'text-[0.8rem] text-muted-foreground select-none',
|
|
101
|
+
defaultClassNames.week_number,
|
|
102
|
+
),
|
|
103
|
+
day: cn(
|
|
104
|
+
'group/day relative aspect-square h-full w-full rounded-(--cell-radius) p-0 text-center select-none [&:last-child[data-selected=true]_button]:rounded-r-(--cell-radius)',
|
|
105
|
+
props.showWeekNumber
|
|
106
|
+
? '[&:nth-child(2)[data-selected=true]_button]:rounded-l-(--cell-radius)'
|
|
107
|
+
: '[&:first-child[data-selected=true]_button]:rounded-l-(--cell-radius)',
|
|
108
|
+
defaultClassNames.day,
|
|
109
|
+
),
|
|
110
|
+
range_start: cn(
|
|
111
|
+
'relative isolate z-0 rounded-l-(--cell-radius) bg-muted after:absolute after:inset-y-0 after:right-0 after:w-4 after:bg-muted',
|
|
112
|
+
defaultClassNames.range_start,
|
|
113
|
+
),
|
|
114
|
+
range_middle: cn('rounded-none', defaultClassNames.range_middle),
|
|
115
|
+
range_end: cn(
|
|
116
|
+
'relative isolate z-0 rounded-r-(--cell-radius) bg-muted after:absolute after:inset-y-0 after:left-0 after:w-4 after:bg-muted',
|
|
117
|
+
defaultClassNames.range_end,
|
|
118
|
+
),
|
|
119
|
+
today: cn(
|
|
120
|
+
'rounded-(--cell-radius) bg-muted text-foreground data-[selected=true]:rounded-none',
|
|
121
|
+
defaultClassNames.today,
|
|
122
|
+
),
|
|
123
|
+
outside: cn(
|
|
124
|
+
'text-muted-foreground aria-selected:text-muted-foreground',
|
|
125
|
+
defaultClassNames.outside,
|
|
126
|
+
),
|
|
127
|
+
disabled: cn(
|
|
128
|
+
'text-muted-foreground opacity-50',
|
|
129
|
+
defaultClassNames.disabled,
|
|
130
|
+
),
|
|
131
|
+
hidden: cn('invisible', defaultClassNames.hidden),
|
|
132
|
+
...classNames,
|
|
133
|
+
}}
|
|
134
|
+
components={{
|
|
135
|
+
Root: ({ className, rootRef, ...props }) => {
|
|
136
|
+
return (
|
|
137
|
+
<div
|
|
138
|
+
data-slot='calendar'
|
|
139
|
+
ref={rootRef}
|
|
140
|
+
className={cn(className)}
|
|
141
|
+
{...props}
|
|
142
|
+
/>
|
|
143
|
+
)
|
|
144
|
+
},
|
|
145
|
+
Chevron: ({ className, orientation, ...props }) => {
|
|
146
|
+
if (orientation === 'left') {
|
|
147
|
+
return (
|
|
148
|
+
<ChevronLeftIcon className={cn('size-4', className)} {...props} />
|
|
149
|
+
)
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
if (orientation === 'right') {
|
|
153
|
+
return (
|
|
154
|
+
<ChevronRightIcon
|
|
155
|
+
className={cn('size-4', className)}
|
|
156
|
+
{...props}
|
|
157
|
+
/>
|
|
158
|
+
)
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
return (
|
|
162
|
+
<ChevronDownIcon className={cn('size-4', className)} {...props} />
|
|
163
|
+
)
|
|
164
|
+
},
|
|
165
|
+
DayButton: ({ ...props }) => (
|
|
166
|
+
<CalendarDayButton locale={locale} {...props} />
|
|
167
|
+
),
|
|
168
|
+
WeekNumber: ({ children, ...props }) => {
|
|
169
|
+
return (
|
|
170
|
+
<td {...props}>
|
|
171
|
+
<div className='flex size-(--cell-size) items-center justify-center text-center'>
|
|
172
|
+
{children}
|
|
173
|
+
</div>
|
|
174
|
+
</td>
|
|
175
|
+
)
|
|
176
|
+
},
|
|
177
|
+
...components,
|
|
178
|
+
}}
|
|
179
|
+
{...props}
|
|
180
|
+
/>
|
|
181
|
+
)
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
function CalendarDayButton({
|
|
185
|
+
className,
|
|
186
|
+
day,
|
|
187
|
+
modifiers,
|
|
188
|
+
locale,
|
|
189
|
+
...props
|
|
190
|
+
}: React.ComponentProps<typeof DayButton> & { locale?: Partial<Locale> }) {
|
|
191
|
+
const defaultClassNames = getDefaultClassNames()
|
|
192
|
+
|
|
193
|
+
const ref = React.useRef<HTMLButtonElement>(null)
|
|
194
|
+
React.useEffect(() => {
|
|
195
|
+
if (modifiers.focused) ref.current?.focus()
|
|
196
|
+
}, [modifiers.focused])
|
|
197
|
+
|
|
198
|
+
return (
|
|
199
|
+
<Button
|
|
200
|
+
ref={ref}
|
|
201
|
+
variant='ghost'
|
|
202
|
+
size='icon'
|
|
203
|
+
data-day={day.date.toLocaleDateString(locale?.code)}
|
|
204
|
+
data-selected-single={
|
|
205
|
+
modifiers.selected &&
|
|
206
|
+
!modifiers.range_start &&
|
|
207
|
+
!modifiers.range_end &&
|
|
208
|
+
!modifiers.range_middle
|
|
209
|
+
}
|
|
210
|
+
data-range-start={modifiers.range_start}
|
|
211
|
+
data-range-end={modifiers.range_end}
|
|
212
|
+
data-range-middle={modifiers.range_middle}
|
|
213
|
+
className={cn(
|
|
214
|
+
'relative isolate z-10 flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 border-0 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-[3px] group-data-[focused=true]/day:ring-ring/50 data-[range-end=true]:rounded-(--cell-radius) data-[range-end=true]:rounded-r-(--cell-radius) data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground data-[range-middle=true]:rounded-none data-[range-middle=true]:bg-muted data-[range-middle=true]:text-foreground data-[range-start=true]:rounded-(--cell-radius) data-[range-start=true]:rounded-l-(--cell-radius) data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground dark:hover:text-foreground [&>span]:text-xs [&>span]:opacity-70',
|
|
215
|
+
defaultClassNames.day,
|
|
216
|
+
className,
|
|
217
|
+
)}
|
|
218
|
+
{...props}
|
|
219
|
+
/>
|
|
220
|
+
)
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
export { Calendar, CalendarDayButton }
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { cn } from '@bupple/vss-ui/lib/utils'
|
|
2
|
+
import * as React from 'react'
|
|
3
|
+
|
|
4
|
+
function Card({
|
|
5
|
+
className,
|
|
6
|
+
size = 'default',
|
|
7
|
+
...props
|
|
8
|
+
}: React.ComponentProps<'div'> & { size?: 'default' | 'sm' }) {
|
|
9
|
+
return (
|
|
10
|
+
<div
|
|
11
|
+
data-slot='card'
|
|
12
|
+
data-size={size}
|
|
13
|
+
className={cn(
|
|
14
|
+
'group/card flex flex-col gap-4 overflow-hidden rounded-xl bg-card py-4 text-sm text-card-foreground ring-1 ring-foreground/10 has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:gap-3 data-[size=sm]:py-3 data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl',
|
|
15
|
+
className,
|
|
16
|
+
)}
|
|
17
|
+
{...props}
|
|
18
|
+
/>
|
|
19
|
+
)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function CardHeader({ className, ...props }: React.ComponentProps<'div'>) {
|
|
23
|
+
return (
|
|
24
|
+
<div
|
|
25
|
+
data-slot='card-header'
|
|
26
|
+
className={cn(
|
|
27
|
+
'group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-4 group-data-[size=sm]/card:px-3 has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-4 group-data-[size=sm]/card:[.border-b]:pb-3',
|
|
28
|
+
className,
|
|
29
|
+
)}
|
|
30
|
+
{...props}
|
|
31
|
+
/>
|
|
32
|
+
)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function CardTitle({ className, ...props }: React.ComponentProps<'div'>) {
|
|
36
|
+
return (
|
|
37
|
+
<div
|
|
38
|
+
data-slot='card-title'
|
|
39
|
+
className={cn(
|
|
40
|
+
'text-base leading-snug font-medium group-data-[size=sm]/card:text-sm',
|
|
41
|
+
className,
|
|
42
|
+
)}
|
|
43
|
+
{...props}
|
|
44
|
+
/>
|
|
45
|
+
)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function CardDescription({ className, ...props }: React.ComponentProps<'div'>) {
|
|
49
|
+
return (
|
|
50
|
+
<div
|
|
51
|
+
data-slot='card-description'
|
|
52
|
+
className={cn('text-sm text-muted-foreground', className)}
|
|
53
|
+
{...props}
|
|
54
|
+
/>
|
|
55
|
+
)
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function CardAction({ className, ...props }: React.ComponentProps<'div'>) {
|
|
59
|
+
return (
|
|
60
|
+
<div
|
|
61
|
+
data-slot='card-action'
|
|
62
|
+
className={cn(
|
|
63
|
+
'col-start-2 row-span-2 row-start-1 self-start justify-self-end',
|
|
64
|
+
className,
|
|
65
|
+
)}
|
|
66
|
+
{...props}
|
|
67
|
+
/>
|
|
68
|
+
)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function CardContent({ className, ...props }: React.ComponentProps<'div'>) {
|
|
72
|
+
return (
|
|
73
|
+
<div
|
|
74
|
+
data-slot='card-content'
|
|
75
|
+
className={cn('px-4 group-data-[size=sm]/card:px-3', className)}
|
|
76
|
+
{...props}
|
|
77
|
+
/>
|
|
78
|
+
)
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function CardFooter({ className, ...props }: React.ComponentProps<'div'>) {
|
|
82
|
+
return (
|
|
83
|
+
<div
|
|
84
|
+
data-slot='card-footer'
|
|
85
|
+
className={cn(
|
|
86
|
+
'flex items-center rounded-b-xl border-t bg-muted/50 p-4 group-data-[size=sm]/card:p-3',
|
|
87
|
+
className,
|
|
88
|
+
)}
|
|
89
|
+
{...props}
|
|
90
|
+
/>
|
|
91
|
+
)
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export {
|
|
95
|
+
Card,
|
|
96
|
+
CardHeader,
|
|
97
|
+
CardFooter,
|
|
98
|
+
CardTitle,
|
|
99
|
+
CardAction,
|
|
100
|
+
CardDescription,
|
|
101
|
+
CardContent,
|
|
102
|
+
}
|