Skip to content

Commit a581d43

Browse files
authored
Merge pull request #114 from lambda-curry/codegen-bot/fix-react-day-picker-v9-compatibility-1754197741
2 parents f96eec7 + 50eb086 commit a581d43

3 files changed

Lines changed: 33 additions & 73 deletions

File tree

packages/components/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@lambdacurry/forms",
3-
"version": "0.19.0",
3+
"version": "0.19.1",
44
"type": "module",
55
"main": "./dist/index.js",
66
"types": "./dist/index.d.ts",

packages/components/src/ui/calendar.tsx

Lines changed: 22 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon } from 'lucide-react';
22
import * as React from 'react';
3-
import { type DayButton, DayPicker, getDefaultClassNames } from 'react-day-picker';
3+
import { type DayButton, DayPicker } from 'react-day-picker';
44

55
import { Button, buttonVariants } from './button';
66
import { cn } from './utils';
@@ -17,7 +17,6 @@ function Calendar({
1717
}: React.ComponentProps<typeof DayPicker> & {
1818
buttonVariant?: React.ComponentProps<typeof Button>['variant'];
1919
}) {
20-
const defaultClassNames = getDefaultClassNames();
2120

2221
return (
2322
<DayPicker
@@ -34,63 +33,42 @@ function Calendar({
3433
...formatters,
3534
}}
3635
classNames={{
37-
root: cn('w-fit', defaultClassNames.root),
38-
months: cn('flex gap-4 flex-col md:flex-row relative', defaultClassNames.months),
39-
month: cn('flex flex-col w-full gap-4', defaultClassNames.month),
40-
nav: cn('flex items-center gap-1 w-full absolute top-0 inset-x-0 justify-between', defaultClassNames.nav),
36+
root: 'w-fit',
37+
months: 'flex gap-4 flex-col md:flex-row relative',
38+
month: 'flex flex-col w-full gap-4',
39+
nav: 'flex items-center gap-1 w-full absolute top-0 inset-x-0 justify-between',
4140
button_previous: cn(
4241
buttonVariants({ variant: buttonVariant }),
4342
'size-(--cell-size) aria-disabled:opacity-50 p-0 select-none',
44-
defaultClassNames.button_previous,
4543
),
4644
button_next: cn(
4745
buttonVariants({ variant: buttonVariant }),
4846
'size-(--cell-size) aria-disabled:opacity-50 p-0 select-none',
49-
defaultClassNames.button_next,
5047
),
51-
month_caption: cn(
52-
'flex items-center justify-center h-(--cell-size) w-full px-(--cell-size)',
53-
defaultClassNames.month_caption,
54-
),
55-
dropdowns: cn(
56-
'w-full flex items-center text-sm font-medium justify-center h-(--cell-size) gap-1.5',
57-
defaultClassNames.dropdowns,
58-
),
59-
dropdown_root: cn(
60-
'relative has-focus:border-ring border border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] rounded-md',
61-
defaultClassNames.dropdown_root,
62-
),
63-
dropdown: cn('absolute inset-0 opacity-0', defaultClassNames.dropdown),
48+
month_caption: 'flex items-center justify-center h-(--cell-size) w-full px-(--cell-size)',
49+
dropdowns: 'w-full flex items-center text-sm font-medium justify-center h-(--cell-size) gap-1.5',
50+
dropdown_root: 'relative has-focus:border-ring border border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] rounded-md',
51+
dropdown: 'absolute inset-0 opacity-0',
6452
caption_label: cn(
6553
'select-none font-medium',
6654
captionLayout === 'label'
6755
? 'text-sm'
6856
: 'rounded-md pl-2 pr-1 flex items-center gap-1 text-sm h-8 [&>svg]:text-muted-foreground [&>svg]:size-3.5',
69-
defaultClassNames.caption_label,
7057
),
7158
table: 'w-full border-collapse',
72-
weekdays: cn('flex', defaultClassNames.weekdays),
73-
weekday: cn(
74-
'text-muted-foreground rounded-md flex-1 font-normal text-[0.8rem] select-none',
75-
defaultClassNames.weekday,
76-
),
77-
week: cn('flex w-full mt-2', defaultClassNames.week),
78-
week_number_header: cn('select-none w-(--cell-size)', defaultClassNames.week_number_header),
79-
week_number: cn('text-[0.8rem] select-none text-muted-foreground', defaultClassNames.week_number),
80-
day: cn(
81-
'relative w-full h-full p-0 text-center [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md group/day aspect-square select-none',
82-
defaultClassNames.day,
83-
),
84-
range_start: cn('rounded-l-md bg-accent', defaultClassNames.range_start),
85-
range_middle: cn('rounded-none', defaultClassNames.range_middle),
86-
range_end: cn('rounded-r-md bg-accent', defaultClassNames.range_end),
87-
today: cn(
88-
'bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none',
89-
defaultClassNames.today,
90-
),
91-
outside: cn('text-muted-foreground aria-selected:text-muted-foreground', defaultClassNames.outside),
92-
disabled: cn('text-muted-foreground opacity-50', defaultClassNames.disabled),
93-
hidden: cn('invisible', defaultClassNames.hidden),
59+
weekdays: 'flex',
60+
weekday: 'text-muted-foreground rounded-md flex-1 font-normal text-[0.8rem] select-none',
61+
week: 'flex w-full mt-2',
62+
week_number_header: 'select-none w-(--cell-size)',
63+
week_number: 'text-[0.8rem] select-none text-muted-foreground',
64+
day: 'relative w-full h-full p-0 text-center [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md group/day aspect-square select-none',
65+
range_start: 'rounded-l-md bg-accent',
66+
range_middle: 'rounded-none',
67+
range_end: 'rounded-r-md bg-accent',
68+
today: 'bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none',
69+
outside: 'text-muted-foreground aria-selected:text-muted-foreground',
70+
disabled: 'text-muted-foreground opacity-50',
71+
hidden: 'invisible',
9472
...classNames,
9573
}}
9674
components={{
@@ -124,8 +102,6 @@ function Calendar({
124102
}
125103

126104
function CalendarDayButton({ className, day, modifiers, ...props }: React.ComponentProps<typeof DayButton>) {
127-
const defaultClassNames = getDefaultClassNames();
128-
129105
const ref = React.useRef<HTMLButtonElement>(null);
130106
React.useEffect(() => {
131107
if (modifiers.focused) ref.current?.focus();
@@ -145,7 +121,6 @@ function CalendarDayButton({ className, day, modifiers, ...props }: React.Compon
145121
data-range-middle={modifiers.range_middle}
146122
className={cn(
147123
'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',
148-
defaultClassNames.day,
149124
className,
150125
)}
151126
{...props}

yarn.lock

Lines changed: 10 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4602,7 +4602,7 @@ __metadata:
46024602
languageName: node
46034603
linkType: hard
46044604

4605-
"axios@npm:^1.11.0, axios@npm:^1.6.1, axios@npm:^1.8.2":
4605+
"axios@npm:^1.11.0, axios@npm:^1.6.1":
46064606
version: 1.11.0
46074607
resolution: "axios@npm:1.11.0"
46084608
dependencies:
@@ -10088,8 +10088,8 @@ __metadata:
1008810088
linkType: hard
1008910089

1009010090
"start-server-and-test@npm:^2.0.11":
10091-
version: 2.0.12
10092-
resolution: "start-server-and-test@npm:2.0.12"
10091+
version: 2.0.13
10092+
resolution: "start-server-and-test@npm:2.0.13"
1009310093
dependencies:
1009410094
arg: "npm:^5.0.2"
1009510095
bluebird: "npm:3.7.2"
@@ -10098,12 +10098,12 @@ __metadata:
1009810098
execa: "npm:5.1.1"
1009910099
lazy-ass: "npm:1.6.0"
1010010100
ps-tree: "npm:1.2.0"
10101-
wait-on: "npm:8.0.3"
10101+
wait-on: "npm:8.0.4"
1010210102
bin:
1010310103
server-test: src/bin/start.js
1010410104
start-server-and-test: src/bin/start.js
1010510105
start-test: src/bin/start.js
10106-
checksum: 10c0/152c8952c3dc66b2aaa6c4ee75ed9390351e6b39cc22896d50c19e1ee129e73fb4967802237aa2f849e6b59ddb0543831ec02e9b876d62bb139e85aecdb9c114
10106+
checksum: 10c0/5e8c8d2f5a806e0b5650605ab083a1a3890f1819cd3c4ea3e43d7cdbc228b5bb39e73b81ccd69d7baf1155e42c8e3d3ca421228abdefd83da530418c88c2d287
1010710107
languageName: node
1010810108
linkType: hard
1010910109

@@ -11022,18 +11022,18 @@ __metadata:
1102211022
languageName: node
1102311023
linkType: hard
1102411024

11025-
"wait-on@npm:8.0.3":
11026-
version: 8.0.3
11027-
resolution: "wait-on@npm:8.0.3"
11025+
"wait-on@npm:8.0.4, wait-on@npm:^8.0.3":
11026+
version: 8.0.4
11027+
resolution: "wait-on@npm:8.0.4"
1102811028
dependencies:
11029-
axios: "npm:^1.8.2"
11029+
axios: "npm:^1.11.0"
1103011030
joi: "npm:^17.13.3"
1103111031
lodash: "npm:^4.17.21"
1103211032
minimist: "npm:^1.2.8"
1103311033
rxjs: "npm:^7.8.2"
1103411034
bin:
1103511035
wait-on: bin/wait-on
11036-
checksum: 10c0/7f14086c3bb6fc055207ab591d2faefc045f718aa7c959353a54af05cf08c53c25d9af80d4d5f6934a169cc0d97ebd1dcf024b13583d09b9a935c36bd745bd7b
11036+
checksum: 10c0/e77d843a03efc12699c965c34338fe0b95c9e80d1e39d946dc172e11a2b9613688b48b61135b269390025a255204a4e3e2ff8e5774f99f0069d149b4b48fd02d
1103711037
languageName: node
1103811038
linkType: hard
1103911039

@@ -11052,21 +11052,6 @@ __metadata:
1105211052
languageName: node
1105311053
linkType: hard
1105411054

11055-
"wait-on@npm:^8.0.3":
11056-
version: 8.0.4
11057-
resolution: "wait-on@npm:8.0.4"
11058-
dependencies:
11059-
axios: "npm:^1.11.0"
11060-
joi: "npm:^17.13.3"
11061-
lodash: "npm:^4.17.21"
11062-
minimist: "npm:^1.2.8"
11063-
rxjs: "npm:^7.8.2"
11064-
bin:
11065-
wait-on: bin/wait-on
11066-
checksum: 10c0/e77d843a03efc12699c965c34338fe0b95c9e80d1e39d946dc172e11a2b9613688b48b61135b269390025a255204a4e3e2ff8e5774f99f0069d149b4b48fd02d
11067-
languageName: node
11068-
linkType: hard
11069-
1107011055
"wait-port@npm:^0.2.9":
1107111056
version: 0.2.14
1107211057
resolution: "wait-port@npm:0.2.14"

0 commit comments

Comments
 (0)