@gentleduck/registry-ui 0.2.6 → 0.2.8
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-test.log +7 -7
- package/CHANGELOG.md +8 -0
- package/package.json +7 -7
- package/src/alert-dialog/alert-dialog.tsx +11 -4
- package/src/aspect-ratio/aspect-ratio.tsx +9 -11
- package/src/audio/audio-visualizer.tsx +2 -0
- package/src/calendar/calendar.tsx +161 -141
- package/src/chart/chart.tsx +11 -6
- package/src/combobox/combobox.tsx +96 -69
- package/src/command/command.tsx +34 -37
- package/src/context-menu/context-menu.tsx +11 -3
- package/src/dialog/dialog-responsive.tsx +9 -0
- package/src/dialog/dialog.tsx +12 -4
- package/src/dropdown-menu/dropdown-menu.tsx +11 -3
- package/src/empty/empty.tsx +30 -17
- package/src/field/field.tsx +136 -109
- package/src/json-editor/json-editor.tsx +1 -0
- package/src/json-editor/json-editor.view.tsx +1 -0
- package/src/menubar/menubar.tsx +10 -3
- package/src/popover/popover.tsx +4 -0
- package/src/preview-panel/preview-panel-dialog.tsx +86 -80
- package/src/preview-panel/preview-panel.tsx +280 -273
- package/src/resizable/resizable.tsx +17 -15
- package/src/select/select.tsx +3 -0
- package/src/sheet/sheet.tsx +16 -4
- package/src/sidebar/sidebar.tsx +434 -376
- package/src/slider/slider.tsx +7 -10
- package/src/sonner/sonner.chunks.tsx +2 -0
- package/src/sonner/sonner.tsx +23 -20
- package/src/toggle/toggle.constants.ts +2 -2
- package/src/tooltip/tooltip.tsx +3 -0
- package/tsconfig.json +0 -1
package/.turbo/turbo-test.log
CHANGED
|
@@ -2,17 +2,17 @@ $ bun test
|
|
|
2
2
|
bun test v1.3.5 (1e86cebd)
|
|
3
3
|
|
|
4
4
|
::group::src/chart/__test__/chart.test.tsx:
|
|
5
|
-
(pass) registry-ui chart > ChartContainer server render does not emit invalid size warnings [
|
|
5
|
+
(pass) registry-ui chart > ChartContainer server render does not emit invalid size warnings [53.00ms]
|
|
6
6
|
|
|
7
7
|
::endgroup::
|
|
8
8
|
|
|
9
9
|
::group::src/button/__test__/button.test.tsx:
|
|
10
|
-
(pass) registry-ui button > buttonVariants returns the shared base styles and defaults
|
|
11
|
-
(pass) registry-ui button > buttonVariants applies explicit variant and size overrides
|
|
10
|
+
(pass) registry-ui button > buttonVariants returns the shared base styles and defaults [1.00ms]
|
|
11
|
+
(pass) registry-ui button > buttonVariants applies explicit variant and size overrides
|
|
12
12
|
(pass) registry-ui button > button exports keep stable display names
|
|
13
|
-
(pass) registry-ui button > Button renders loading state as a busy disabled native button [
|
|
14
|
-
(pass) registry-ui button > Button preserves explicit disabled state even when loading is false
|
|
15
|
-
(pass) registry-ui button > Button collapses into icon-only mode and hides secondary content
|
|
13
|
+
(pass) registry-ui button > Button renders loading state as a busy disabled native button [3.00ms]
|
|
14
|
+
(pass) registry-ui button > Button preserves explicit disabled state even when loading is false [1.00ms]
|
|
15
|
+
(pass) registry-ui button > Button collapses into icon-only mode and hides secondary content
|
|
16
16
|
(pass) registry-ui button > AnimationIcon renders left and right placements around children [1.00ms]
|
|
17
17
|
|
|
18
18
|
::endgroup::
|
|
@@ -20,4 +20,4 @@ bun test v1.3.5 (1e86cebd)
|
|
|
20
20
|
8 pass
|
|
21
21
|
0 fail
|
|
22
22
|
25 expect() calls
|
|
23
|
-
Ran 8 tests across 2 files. [
|
|
23
|
+
Ran 8 tests across 2 files. [574.00ms]
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @gentleduck/registry-ui
|
|
2
2
|
|
|
3
|
+
## 0.2.8
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- e7ee580: fix(registry-ui): replace workspace:\* dependencies with published npm versions
|
|
8
|
+
|
|
9
|
+
The published package had `workspace:*` references that broke any consumer's install.
|
|
10
|
+
|
|
3
11
|
## 0.2.6
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
"node": ">=22.0.0"
|
|
5
5
|
},
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@gentleduck/hooks": "
|
|
8
|
-
"@gentleduck/libs": "
|
|
9
|
-
"@gentleduck/motion": "
|
|
10
|
-
"@gentleduck/primitives": "
|
|
11
|
-
"@gentleduck/variants": "
|
|
12
|
-
"@gentleduck/vim": "
|
|
7
|
+
"@gentleduck/hooks": "^0.1.12",
|
|
8
|
+
"@gentleduck/libs": "^0.1.15",
|
|
9
|
+
"@gentleduck/motion": "^0.1.17",
|
|
10
|
+
"@gentleduck/primitives": "^0.2.5",
|
|
11
|
+
"@gentleduck/variants": "^0.1.20",
|
|
12
|
+
"@gentleduck/vim": "^0.1.16",
|
|
13
13
|
"embla-carousel-react": "8.6.0",
|
|
14
14
|
"lucide-react": "0.576.0",
|
|
15
15
|
"next-themes": "^0.4.6",
|
|
@@ -56,5 +56,5 @@
|
|
|
56
56
|
"test": "bun test"
|
|
57
57
|
},
|
|
58
58
|
"type": "module",
|
|
59
|
-
"version": "0.2.
|
|
59
|
+
"version": "0.2.8"
|
|
60
60
|
}
|
|
@@ -6,10 +6,13 @@ import * as React from 'react'
|
|
|
6
6
|
import { buttonVariants } from '../button'
|
|
7
7
|
|
|
8
8
|
const AlertDialog = AlertDialogPrimitive.Root
|
|
9
|
+
AlertDialog.displayName = 'AlertDialog'
|
|
9
10
|
|
|
10
11
|
const AlertDialogTrigger = AlertDialogPrimitive.Trigger
|
|
12
|
+
AlertDialogTrigger.displayName = 'AlertDialogTrigger'
|
|
11
13
|
|
|
12
14
|
const AlertDialogPortal = AlertDialogPrimitive.Portal
|
|
15
|
+
AlertDialogPortal.displayName = 'AlertDialogPortal'
|
|
13
16
|
|
|
14
17
|
const AlertDialogOverlay = React.forwardRef<
|
|
15
18
|
React.ComponentRef<typeof AlertDialogPrimitive.Overlay>,
|
|
@@ -46,13 +49,17 @@ const AlertDialogContent = React.forwardRef<
|
|
|
46
49
|
))
|
|
47
50
|
AlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName
|
|
48
51
|
|
|
49
|
-
const AlertDialogHeader =
|
|
50
|
-
|
|
52
|
+
const AlertDialogHeader = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
|
|
53
|
+
({ className, ...props }, ref) => (
|
|
54
|
+
<div ref={ref} className={cn('flex flex-col space-y-2 text-center sm:text-start', className)} {...props} />
|
|
55
|
+
),
|
|
51
56
|
)
|
|
52
57
|
AlertDialogHeader.displayName = 'AlertDialogHeader'
|
|
53
58
|
|
|
54
|
-
const AlertDialogFooter =
|
|
55
|
-
|
|
59
|
+
const AlertDialogFooter = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
|
|
60
|
+
({ className, ...props }, ref) => (
|
|
61
|
+
<div ref={ref} className={cn('flex flex-col-reverse sm:flex-row sm:justify-end sm:gap-2', className)} {...props} />
|
|
62
|
+
),
|
|
56
63
|
)
|
|
57
64
|
AlertDialogFooter.displayName = 'AlertDialogFooter'
|
|
58
65
|
|
|
@@ -3,17 +3,14 @@
|
|
|
3
3
|
import { cn } from '@gentleduck/libs/cn'
|
|
4
4
|
import { type Direction, useDirection } from '@gentleduck/primitives/direction'
|
|
5
5
|
import { Slot } from '@gentleduck/primitives/slot'
|
|
6
|
+
import React from 'react'
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
...props
|
|
14
|
-
}: React.ComponentPropsWithRef<typeof Slot> & {
|
|
15
|
-
ratio: string
|
|
16
|
-
}) {
|
|
8
|
+
const AspectRatio = React.forwardRef<
|
|
9
|
+
React.ComponentRef<typeof Slot>,
|
|
10
|
+
React.ComponentPropsWithoutRef<typeof Slot> & {
|
|
11
|
+
ratio: string
|
|
12
|
+
}
|
|
13
|
+
>(({ style, className, ratio, dir, ...props }, ref) => {
|
|
17
14
|
const direction = useDirection(dir as Direction)
|
|
18
15
|
return (
|
|
19
16
|
<Slot
|
|
@@ -28,6 +25,7 @@ function AspectRatio({
|
|
|
28
25
|
data-slot="aspect-ratio"
|
|
29
26
|
/>
|
|
30
27
|
)
|
|
31
|
-
}
|
|
28
|
+
})
|
|
29
|
+
AspectRatio.displayName = 'AspectRatio'
|
|
32
30
|
|
|
33
31
|
export { AspectRatio }
|
|
@@ -7,154 +7,174 @@ import * as React from 'react'
|
|
|
7
7
|
import { type DayButton, DayPicker, getDefaultClassNames } from 'react-day-picker'
|
|
8
8
|
import { Button, buttonVariants } from '../button'
|
|
9
9
|
|
|
10
|
-
function
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
buttonVariant?: React.ComponentProps<typeof Button>['variant']
|
|
22
|
-
}) {
|
|
23
|
-
const direction = useDirection(dir as Direction)
|
|
24
|
-
const defaultClassNames = getDefaultClassNames()
|
|
25
|
-
const localeTag = React.useMemo(() => {
|
|
26
|
-
const code = props.locale?.code
|
|
27
|
-
if (!code) return undefined
|
|
28
|
-
return code.startsWith('ar') ? `${code}-u-nu-arab` : code
|
|
29
|
-
}, [props.locale])
|
|
10
|
+
function mergeRefs<T>(...refs: (React.Ref<T> | undefined)[]): React.RefCallback<T> {
|
|
11
|
+
return (node) => {
|
|
12
|
+
for (const ref of refs) {
|
|
13
|
+
if (typeof ref === 'function') {
|
|
14
|
+
ref(node)
|
|
15
|
+
} else if (ref != null) {
|
|
16
|
+
;(ref as React.MutableRefObject<T | null>).current = node
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
30
21
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
22
|
+
const Calendar = React.forwardRef<
|
|
23
|
+
HTMLDivElement,
|
|
24
|
+
React.ComponentProps<typeof DayPicker> & {
|
|
25
|
+
buttonVariant?: React.ComponentProps<typeof Button>['variant']
|
|
26
|
+
}
|
|
27
|
+
>(
|
|
28
|
+
(
|
|
29
|
+
{
|
|
30
|
+
className,
|
|
31
|
+
classNames,
|
|
32
|
+
showOutsideDays = true,
|
|
33
|
+
captionLayout = 'label',
|
|
34
|
+
buttonVariant = 'ghost',
|
|
35
|
+
formatters,
|
|
36
|
+
components,
|
|
37
|
+
dir,
|
|
38
|
+
...props
|
|
39
|
+
},
|
|
40
|
+
ref,
|
|
41
|
+
) => {
|
|
42
|
+
const direction = useDirection(dir as Direction)
|
|
43
|
+
const defaultClassNames = getDefaultClassNames()
|
|
44
|
+
const localeTag = React.useMemo(() => {
|
|
45
|
+
const code = props.locale?.code
|
|
46
|
+
if (!code) return undefined
|
|
47
|
+
return code.startsWith('ar') ? `${code}-u-nu-arab` : code
|
|
48
|
+
}, [props.locale])
|
|
34
49
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
50
|
+
const monthFormatter = React.useMemo(() => {
|
|
51
|
+
return new Intl.DateTimeFormat(localeTag, { month: 'short' })
|
|
52
|
+
}, [localeTag])
|
|
38
53
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
54
|
+
const captionFormatter = React.useMemo(() => {
|
|
55
|
+
return new Intl.DateTimeFormat(localeTag, { month: 'long', year: 'numeric' })
|
|
56
|
+
}, [localeTag])
|
|
42
57
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
},
|
|
47
|
-
[numberFormatter],
|
|
48
|
-
)
|
|
58
|
+
const numberFormatter = React.useMemo(() => {
|
|
59
|
+
return new Intl.NumberFormat(localeTag)
|
|
60
|
+
}, [localeTag])
|
|
49
61
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,
|
|
57
|
-
String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,
|
|
58
|
-
className,
|
|
59
|
-
)}
|
|
60
|
-
classNames={{
|
|
61
|
-
button_next: cn(
|
|
62
|
-
buttonVariants({ variant: buttonVariant }),
|
|
63
|
-
'size-(--cell-size) select-none p-0 aria-disabled:opacity-50',
|
|
64
|
-
defaultClassNames.button_next,
|
|
65
|
-
),
|
|
66
|
-
button_previous: cn(
|
|
67
|
-
buttonVariants({ variant: buttonVariant }),
|
|
68
|
-
'size-(--cell-size) select-none p-0 aria-disabled:opacity-50',
|
|
69
|
-
defaultClassNames.button_previous,
|
|
70
|
-
),
|
|
71
|
-
caption_label: cn(
|
|
72
|
-
'select-none font-medium',
|
|
73
|
-
captionLayout === 'label'
|
|
74
|
-
? 'text-sm'
|
|
75
|
-
: 'flex h-8 items-center gap-1 rounded-md ps-2 pe-1 text-sm [&>svg]:size-3.5 [&>svg]:text-muted-foreground',
|
|
76
|
-
defaultClassNames.caption_label,
|
|
77
|
-
),
|
|
78
|
-
day: cn(
|
|
79
|
-
'group/day relative aspect-square h-full w-full select-none p-0 text-center [&:first-child[data-selected=true]_button]:rounded-s-md [&:last-child[data-selected=true]_button]:rounded-e-md',
|
|
80
|
-
defaultClassNames.day,
|
|
81
|
-
),
|
|
82
|
-
disabled: cn('text-muted-foreground opacity-50', defaultClassNames.disabled),
|
|
83
|
-
dropdown: cn('absolute inset-0 bg-popover opacity-0', defaultClassNames.dropdown),
|
|
84
|
-
dropdown_root: cn(
|
|
85
|
-
'relative rounded-md border border-input shadow-xs has-focus:border-ring has-focus:ring-[3px] has-focus:ring-ring/50',
|
|
86
|
-
defaultClassNames.dropdown_root,
|
|
87
|
-
),
|
|
88
|
-
dropdowns: cn(
|
|
89
|
-
'flex h-(--cell-size) w-full items-center justify-center gap-1.5 font-medium text-sm',
|
|
90
|
-
defaultClassNames.dropdowns,
|
|
91
|
-
),
|
|
92
|
-
hidden: cn('invisible', defaultClassNames.hidden),
|
|
93
|
-
month: cn('flex w-full flex-col gap-4', defaultClassNames.month),
|
|
94
|
-
month_caption: cn(
|
|
95
|
-
'flex h-(--cell-size) w-full items-center justify-center px-(--cell-size)',
|
|
96
|
-
defaultClassNames.month_caption,
|
|
97
|
-
),
|
|
98
|
-
months: cn('relative flex flex-col gap-4 md:flex-row', defaultClassNames.months),
|
|
99
|
-
nav: cn('absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1', defaultClassNames.nav),
|
|
100
|
-
outside: cn('text-muted-foreground aria-selected:text-muted-foreground', defaultClassNames.outside),
|
|
101
|
-
range_end: cn('rounded-e-md bg-accent', defaultClassNames.range_end),
|
|
102
|
-
range_middle: cn('rounded-none', defaultClassNames.range_middle),
|
|
103
|
-
range_start: cn('rounded-s-md bg-accent', defaultClassNames.range_start),
|
|
104
|
-
root: cn('w-fit', defaultClassNames.root),
|
|
105
|
-
table: 'w-full border-collapse',
|
|
106
|
-
today: cn(
|
|
107
|
-
'rounded-md bg-accent text-accent-foreground data-[selected=true]:rounded-none',
|
|
108
|
-
defaultClassNames.today,
|
|
109
|
-
),
|
|
110
|
-
week: cn('mt-2 flex w-full', defaultClassNames.week),
|
|
111
|
-
week_number: cn('select-none text-[0.8rem] text-muted-foreground', defaultClassNames.week_number),
|
|
112
|
-
week_number_header: cn('w-(--cell-size) select-none', defaultClassNames.week_number_header),
|
|
113
|
-
weekday: cn(
|
|
114
|
-
'flex-1 select-none rounded-md font-normal text-[0.8rem] text-muted-foreground',
|
|
115
|
-
defaultClassNames.weekday,
|
|
116
|
-
),
|
|
117
|
-
weekdays: cn('flex', defaultClassNames.weekdays),
|
|
118
|
-
...classNames,
|
|
119
|
-
}}
|
|
120
|
-
components={{
|
|
121
|
-
Chevron: ({ className, orientation, ...props }) => {
|
|
122
|
-
if (orientation === 'left') {
|
|
123
|
-
return <ChevronLeftIcon className={cn('size-4', className)} {...props} />
|
|
124
|
-
}
|
|
62
|
+
const formatLocalizedNumber = React.useCallback(
|
|
63
|
+
(value: number) => {
|
|
64
|
+
return numberFormatter.format(value)
|
|
65
|
+
},
|
|
66
|
+
[numberFormatter],
|
|
67
|
+
)
|
|
125
68
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
69
|
+
return (
|
|
70
|
+
<DayPicker
|
|
71
|
+
dir={direction}
|
|
72
|
+
captionLayout={captionLayout}
|
|
73
|
+
className={cn(
|
|
74
|
+
'group/calendar bg-background in-data-[slot=card-content]:bg-transparent in-data-[slot=popover-content]:bg-transparent p-3 [--cell-size:--spacing(8)]',
|
|
75
|
+
String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,
|
|
76
|
+
String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,
|
|
77
|
+
className,
|
|
78
|
+
)}
|
|
79
|
+
classNames={{
|
|
80
|
+
button_next: cn(
|
|
81
|
+
buttonVariants({ variant: buttonVariant }),
|
|
82
|
+
'size-(--cell-size) select-none p-0 aria-disabled:opacity-50',
|
|
83
|
+
defaultClassNames.button_next,
|
|
84
|
+
),
|
|
85
|
+
button_previous: cn(
|
|
86
|
+
buttonVariants({ variant: buttonVariant }),
|
|
87
|
+
'size-(--cell-size) select-none p-0 aria-disabled:opacity-50',
|
|
88
|
+
defaultClassNames.button_previous,
|
|
89
|
+
),
|
|
90
|
+
caption_label: cn(
|
|
91
|
+
'select-none font-medium',
|
|
92
|
+
captionLayout === 'label'
|
|
93
|
+
? 'text-sm'
|
|
94
|
+
: 'flex h-8 items-center gap-1 rounded-md ps-2 pe-1 text-sm [&>svg]:size-3.5 [&>svg]:text-muted-foreground',
|
|
95
|
+
defaultClassNames.caption_label,
|
|
96
|
+
),
|
|
97
|
+
day: cn(
|
|
98
|
+
'group/day relative aspect-square h-full w-full select-none p-0 text-center [&:first-child[data-selected=true]_button]:rounded-s-md [&:last-child[data-selected=true]_button]:rounded-e-md',
|
|
99
|
+
defaultClassNames.day,
|
|
100
|
+
),
|
|
101
|
+
disabled: cn('text-muted-foreground opacity-50', defaultClassNames.disabled),
|
|
102
|
+
dropdown: cn('absolute inset-0 bg-popover opacity-0', defaultClassNames.dropdown),
|
|
103
|
+
dropdown_root: cn(
|
|
104
|
+
'relative rounded-md border border-input shadow-xs has-focus:border-ring has-focus:ring-[3px] has-focus:ring-ring/50',
|
|
105
|
+
defaultClassNames.dropdown_root,
|
|
106
|
+
),
|
|
107
|
+
dropdowns: cn(
|
|
108
|
+
'flex h-(--cell-size) w-full items-center justify-center gap-1.5 font-medium text-sm',
|
|
109
|
+
defaultClassNames.dropdowns,
|
|
110
|
+
),
|
|
111
|
+
hidden: cn('invisible', defaultClassNames.hidden),
|
|
112
|
+
month: cn('flex w-full flex-col gap-4', defaultClassNames.month),
|
|
113
|
+
month_caption: cn(
|
|
114
|
+
'flex h-(--cell-size) w-full items-center justify-center px-(--cell-size)',
|
|
115
|
+
defaultClassNames.month_caption,
|
|
116
|
+
),
|
|
117
|
+
months: cn('relative flex flex-col gap-4 md:flex-row', defaultClassNames.months),
|
|
118
|
+
nav: cn('absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1', defaultClassNames.nav),
|
|
119
|
+
outside: cn('text-muted-foreground aria-selected:text-muted-foreground', defaultClassNames.outside),
|
|
120
|
+
range_end: cn('rounded-e-md bg-accent', defaultClassNames.range_end),
|
|
121
|
+
range_middle: cn('rounded-none', defaultClassNames.range_middle),
|
|
122
|
+
range_start: cn('rounded-s-md bg-accent', defaultClassNames.range_start),
|
|
123
|
+
root: cn('w-fit', defaultClassNames.root),
|
|
124
|
+
table: 'w-full border-collapse',
|
|
125
|
+
today: cn(
|
|
126
|
+
'rounded-md bg-accent text-accent-foreground data-[selected=true]:rounded-none',
|
|
127
|
+
defaultClassNames.today,
|
|
128
|
+
),
|
|
129
|
+
week: cn('mt-2 flex w-full', defaultClassNames.week),
|
|
130
|
+
week_number: cn('select-none text-[0.8rem] text-muted-foreground', defaultClassNames.week_number),
|
|
131
|
+
week_number_header: cn('w-(--cell-size) select-none', defaultClassNames.week_number_header),
|
|
132
|
+
weekday: cn(
|
|
133
|
+
'flex-1 select-none rounded-md font-normal text-[0.8rem] text-muted-foreground',
|
|
134
|
+
defaultClassNames.weekday,
|
|
135
|
+
),
|
|
136
|
+
weekdays: cn('flex', defaultClassNames.weekdays),
|
|
137
|
+
...classNames,
|
|
138
|
+
}}
|
|
139
|
+
components={{
|
|
140
|
+
Chevron: ({ className, orientation, ...props }) => {
|
|
141
|
+
if (orientation === 'left') {
|
|
142
|
+
return <ChevronLeftIcon className={cn('size-4', className)} {...props} />
|
|
143
|
+
}
|
|
129
144
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
<
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
}
|
|
145
|
+
if (orientation === 'right') {
|
|
146
|
+
return <ChevronRightIcon className={cn('size-4', className)} {...props} />
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
return <ChevronDownIcon className={cn('size-4', className)} {...props} />
|
|
150
|
+
},
|
|
151
|
+
DayButton: CalendarDayButton,
|
|
152
|
+
Root: ({ className, rootRef, ...props }) => {
|
|
153
|
+
return <div className={cn(className)} data-slot="calendar" ref={mergeRefs(ref, rootRef)} {...props} />
|
|
154
|
+
},
|
|
155
|
+
WeekNumber: ({ children, ...props }) => {
|
|
156
|
+
return (
|
|
157
|
+
<td {...props}>
|
|
158
|
+
<div className="flex size-(--cell-size) items-center justify-center text-center">{children}</div>
|
|
159
|
+
</td>
|
|
160
|
+
)
|
|
161
|
+
},
|
|
162
|
+
...components,
|
|
163
|
+
}}
|
|
164
|
+
formatters={{
|
|
165
|
+
formatCaption: (date) => captionFormatter.format(date),
|
|
166
|
+
formatDay: (date) => formatLocalizedNumber(date.getDate()),
|
|
167
|
+
formatMonthDropdown: (date) => monthFormatter.format(date),
|
|
168
|
+
formatWeekNumber: (weekNumber) => formatLocalizedNumber(weekNumber),
|
|
169
|
+
formatYearDropdown: (date) => String(date.getFullYear()),
|
|
170
|
+
...formatters,
|
|
171
|
+
}}
|
|
172
|
+
showOutsideDays={showOutsideDays}
|
|
173
|
+
{...props}
|
|
174
|
+
/>
|
|
175
|
+
)
|
|
176
|
+
},
|
|
177
|
+
)
|
|
158
178
|
Calendar.displayName = 'Calendar'
|
|
159
179
|
|
|
160
180
|
function CalendarDayButton({ className, day, modifiers, ...props }: React.ComponentProps<typeof DayButton>) {
|
package/src/chart/chart.tsx
CHANGED
|
@@ -29,7 +29,7 @@ function useChart() {
|
|
|
29
29
|
return context
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
function ChartContainer({ id, className, children, config, ref, dir, ...props }: ChartContainerProps) {
|
|
33
33
|
const uniqueId = React.useId()
|
|
34
34
|
const chartId = `chart-${id || uniqueId.replace(/:/g, '')}`
|
|
35
35
|
const direction = useDirection(dir as Direction)
|
|
@@ -54,8 +54,9 @@ const ChartContainer = ({ id, className, children, config, ref, dir, ...props }:
|
|
|
54
54
|
</ChartContext.Provider>
|
|
55
55
|
)
|
|
56
56
|
}
|
|
57
|
+
ChartContainer.displayName = 'ChartContainer'
|
|
57
58
|
|
|
58
|
-
|
|
59
|
+
function ChartStyle({ id, config }: ChartStyleProps) {
|
|
59
60
|
const colorConfig = Object.entries(config).filter(([_, config]) => config.theme || config.color)
|
|
60
61
|
|
|
61
62
|
if (!colorConfig.length) {
|
|
@@ -84,10 +85,11 @@ ${colorConfig
|
|
|
84
85
|
/>
|
|
85
86
|
)
|
|
86
87
|
}
|
|
88
|
+
ChartStyle.displayName = 'ChartStyle'
|
|
87
89
|
|
|
88
90
|
const ChartTooltip = RechartsPrimitive.Tooltip
|
|
89
91
|
|
|
90
|
-
|
|
92
|
+
function ChartTooltipContent({
|
|
91
93
|
active,
|
|
92
94
|
payload,
|
|
93
95
|
className,
|
|
@@ -102,7 +104,7 @@ const ChartTooltipContent = ({
|
|
|
102
104
|
color,
|
|
103
105
|
nameKey,
|
|
104
106
|
labelKey,
|
|
105
|
-
}: ChartTooltipContentProps)
|
|
107
|
+
}: ChartTooltipContentProps) {
|
|
106
108
|
const { config } = useChart()
|
|
107
109
|
|
|
108
110
|
const tooltipLabel = React.useMemo(() => {
|
|
@@ -212,17 +214,19 @@ const ChartTooltipContent = ({
|
|
|
212
214
|
</div>
|
|
213
215
|
)
|
|
214
216
|
}
|
|
217
|
+
ChartTooltipContent.displayName = 'ChartTooltipContent'
|
|
215
218
|
|
|
216
219
|
const ChartLegend = RechartsPrimitive.Legend
|
|
220
|
+
ChartLegend.displayName = 'ChartLegend'
|
|
217
221
|
|
|
218
|
-
|
|
222
|
+
function ChartLegendContent({
|
|
219
223
|
className,
|
|
220
224
|
hideIcon = false,
|
|
221
225
|
payload,
|
|
222
226
|
verticalAlign = 'bottom',
|
|
223
227
|
ref,
|
|
224
228
|
nameKey,
|
|
225
|
-
}: ChartLegendContentProps)
|
|
229
|
+
}: ChartLegendContentProps) {
|
|
226
230
|
const { config } = useChart()
|
|
227
231
|
|
|
228
232
|
if (!payload?.length) {
|
|
@@ -260,5 +264,6 @@ const ChartLegendContent = ({
|
|
|
260
264
|
</div>
|
|
261
265
|
)
|
|
262
266
|
}
|
|
267
|
+
ChartLegendContent.displayName = 'ChartLegendContent'
|
|
263
268
|
|
|
264
269
|
export { ChartContainer, ChartTooltip, ChartTooltipContent, ChartLegend, ChartLegendContent, ChartStyle }
|