Skip to content

Commit

Permalink
chore: downgrade react-day-picker to v8
Browse files Browse the repository at this point in the history
  • Loading branch information
zaaakher committed Jul 29, 2024
1 parent ef44511 commit 71d696d
Show file tree
Hide file tree
Showing 10 changed files with 192 additions and 54 deletions.
7 changes: 7 additions & 0 deletions apps/docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# hawa-docs

## 0.0.98

### Patch Changes

- Updated dependencies
- @sikka/hawa@0.43.0

## 0.0.97

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hawa-docs",
"version": "0.0.97",
"version": "0.0.98",
"private": true,
"scripts": {
"dev": "next dev -p 3001",
Expand Down
3 changes: 3 additions & 0 deletions packages/components/.ncurc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
reject: ["react-day-picker"],
};
6 changes: 6 additions & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @sikka/hawa

## 0.43.0

### Minor Changes

- `Calendar`: downgrade `react-day-picker` to v8.10.1

## 0.42.12

### Patch Changes
Expand Down
98 changes: 50 additions & 48 deletions packages/components/elements/calendar/Calendar.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import * as React from "react";
import { DateRange, DayPicker, type DayPickerProps } from "react-day-picker";
import { DateRange, DayPicker } from "react-day-picker";

import { cn } from "@util/index";

import { Button, buttonVariants } from "../button";
import { buttonVariants } from "../button";

export type CalendarProps = DayPickerProps;
export type CalendarProps = React.ComponentProps<typeof DayPicker>;
export type CalendarValueType = {
single: Date;
multiple: Date[];
Expand All @@ -21,57 +21,63 @@ function Calendar({
return (
<DayPicker
showOutsideDays={showOutsideDays}
className={cn("hawa-p-0", className)}
className={cn("hawa-p-3", className)}
classNames={{
root: "hawa-w-fit hawa-relative hawa-p-3 ",
months: "hawa-flex hawa-flex-col sm:hawa-flex-row sm:hawa-space-y-0",
months:
"hawa-flex hawa-flex-col sm:hawa-flex-row hawa-space-y-4 sm:hawa-space-x-4 sm:hawa-space-y-0",
month: "hawa-space-y-4",
month_caption:
"hawa-flex hawa-justify-center hawa-py-1 hawa-relative hawa-items-center",
caption:
"hawa-flex hawa-justify-center hawa-pt-1 hawa-relative hawa-items-center",
caption_label: "hawa-text-sm hawa-font-medium",
nav: "hawa-z-50 hawa-flex hawa-items-start",

button_previous: buttonVariants({
variant: "outline",
className:
"hawa-absolute hawa-start-3 hawa-flex hawa-items-center !hawa-size-7 !hawa-p-0 hawa-justify-center",
}),

button_next: buttonVariants({
variant: "outline",
className:
"hawa-absolute hawa-end-3 !hawa-size-7 !hawa-p-0 hawa-justify-center hawa-flex hawa-items-center",
}),

month_grid: "hawa-w-full hawa-border-collapse hawa-space-y-1 ",
weekdays: "hawa-flex",
weekday:
nav: "hawa-space-x-1 hawa-flex hawa-items-center",
nav_button: cn(
buttonVariants({ variant: "outline" }),
"hawa-h-7 hawa-w-7 hawa-bg-transparent hawa-p-0 hawa-opacity-50 hover:hawa-opacity-100",
),
nav_button_previous:
"hawa-absolute hawa-start-1 !hawa-h-8 !hawa-w-8 !hawa-p-0 hawa-justify-center",
nav_button_next:
"hawa-absolute hawa-end-1 !hawa-h-8 !hawa-w-8 !hawa-p-0 hawa-justify-center",
table: "hawa-w-full hawa-border-collapse hawa-space-y-1 ",
head_row: "hawa-flex",
head_cell:
"hawa-text-muted-foreground hawa-rounded-md hawa-w-9 hawa-font-normal hawa-text-[0.8rem]",
week: "hawa-flex hawa-w-full hawa-mt-2",

range_end: "day-range-end",

today: "hawa-bg-accent hawa-text-accent-foreground hawa-rounded",
outside:
row: "hawa-flex hawa-w-full hawa-mt-2",
cell: "hawa-h-9 hawa-w-9 hawa-text-center hawa-text-sm hawa-p-0 hawa-relative [&:has([aria-selected].day-range-end)]:hawa-rounded-r-md [&:has([aria-selected].day-outside)]:hawa-bg-accent/50 [&:has([aria-selected])]:hawa-bg-accent first:[&:has([aria-selected])]:hawa-rounded-l-md last:[&:has([aria-selected])]:hawa-rounded-r-md focus-within:hawa-relative focus-within:hawa-z-20",
day: cn(
buttonVariants({ variant: "ghost" }),
"hawa-h-9 hawa-w-9 hawa-justify-center !hawa-p-0 hawa-font-normal aria-selected:hawa-opacity-100",
),
day_range_end: "day-range-end",
day_selected:
"hawa-bg-primary hawa-text-primary-foreground hover:hawa-bg-primary hover:hawa-text-primary-foreground focus:hawa-bg-primary focus:hawa-text-primary-foreground",
day_today: "hawa-bg-accent hawa-text-accent-foreground",
day_outside:
"day-outside hawa-text-muted-foreground hawa-opacity-50 aria-selected:hawa-bg-accent/50 aria-selected:hawa-text-muted-foreground aria-selected:hawa-opacity-30",
disabled: "hawa-text-muted-foreground hawa-opacity-50",
range_middle:
day_disabled: "hawa-text-muted-foreground hawa-opacity-50",
day_range_middle:
"aria-selected:hawa-bg-accent aria-selected:hawa-text-accent-foreground",
hidden: "hawa-invisible",
day_hidden: "hawa-invisible",
...classNames,
}}
components={{
DayButton: (props) => (
<Button
{...props}
variant={props.modifiers.selected ? "default" : "ghost"}
className="hawa-h-9 hawa-w-9 hawa-text-center hawa-text-sm hawa-p-0 hawa-relative [&:has([aria-selected].range-end)]:hawa-rounded-r-md [&:has([aria-selected].outside)]:hawa-bg-accent/50 [&:has([aria-selected])]:hawa-bg-accent first:[&:has([aria-selected])]:hawa-rounded-l-md last:[&:has([aria-selected])]:hawa-rounded-r-md focus-within:hawa-relative focus-within:hawa-z-20"
IconLeft: ({ ...props }) => (
<svg
xmlns="http://www.w3.org/2000/svg"
width="20"
height="20"
aria-label="Next Month"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
>
{props.children}
</Button>
<path d="m15 18-6-6 6-6" />
</svg>
),

Chevron: (props) => (
IconRight: ({ ...props }) => (
<svg
xmlns="http://www.w3.org/2000/svg"
width="20"
Expand All @@ -83,11 +89,7 @@ function Calendar({
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
className={
props.orientation === "right"
? "hawa-rotate-180 hawa-opacity-80"
: "hawa-opacity-80"
}
className="hawa-rotate-180"
>
<path d="m15 18-6-6 6-6" />
</svg>
Expand Down
102 changes: 102 additions & 0 deletions packages/components/elements/calendar/CalendarV9.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
// import * as React from "react";
// import { DateRange, DayPicker, type DayPickerProps } from "react-day-picker";

// import { cn } from "@util/index";

// import { Button, buttonVariants } from "../button";

// export type CalendarProps = DayPickerProps;
// export type CalendarValueType = {
// single: Date;
// multiple: Date[];
// range: DateRange;
// };

// function Calendar({
// className,
// classNames,
// showOutsideDays = true,
// ...props
// }: CalendarProps) {
// return (
// <DayPicker
// showOutsideDays={showOutsideDays}
// className={cn("hawa-p-0", className)}
// classNames={{
// root: "hawa-w-fit hawa-relative hawa-p-3 ",
// months: "hawa-flex hawa-flex-col sm:hawa-flex-row sm:hawa-space-y-0",
// month: "hawa-space-y-4",
// month_caption:
// "hawa-flex hawa-justify-center hawa-py-1 hawa-relative hawa-items-center",
// caption_label: "hawa-text-sm hawa-font-medium",
// nav: "hawa-z-50 hawa-flex hawa-items-start",

// button_previous: buttonVariants({
// variant: "outline",
// className:
// "hawa-absolute hawa-start-3 hawa-flex hawa-items-center !hawa-size-7 !hawa-p-0 hawa-justify-center",
// }),

// button_next: buttonVariants({
// variant: "outline",
// className:
// "hawa-absolute hawa-end-3 !hawa-size-7 !hawa-p-0 hawa-justify-center hawa-flex hawa-items-center",
// }),

// month_grid: "hawa-w-full hawa-border-collapse hawa-space-y-1 ",
// weekdays: "hawa-flex",
// weekday:
// "hawa-text-muted-foreground hawa-rounded-md hawa-w-9 hawa-font-normal hawa-text-[0.8rem]",
// week: "hawa-flex hawa-w-full hawa-mt-2",

// range_end: "day-range-end",

// today: "hawa-bg-accent hawa-text-accent-foreground hawa-rounded",
// outside:
// "day-outside hawa-text-muted-foreground hawa-opacity-50 aria-selected:hawa-bg-accent/50 aria-selected:hawa-text-muted-foreground aria-selected:hawa-opacity-30",
// disabled: "hawa-text-muted-foreground hawa-opacity-50",
// range_middle:
// "aria-selected:hawa-bg-accent aria-selected:hawa-text-accent-foreground",
// hidden: "hawa-invisible",
// ...classNames,
// }}
// components={{
// DayButton: (props) => (
// <Button
// {...props}
// variant={props.modifiers.selected ? "default" : "ghost"}
// className="hawa-h-9 hawa-w-9 hawa-text-center hawa-text-sm hawa-p-0 hawa-relative [&:has([aria-selected].range-end)]:hawa-rounded-r-md [&:has([aria-selected].outside)]:hawa-bg-accent/50 [&:has([aria-selected])]:hawa-bg-accent first:[&:has([aria-selected])]:hawa-rounded-l-md last:[&:has([aria-selected])]:hawa-rounded-r-md focus-within:hawa-relative focus-within:hawa-z-20"
// >
// {props.children}
// </Button>
// ),

// Chevron: (props) => (
// <svg
// xmlns="http://www.w3.org/2000/svg"
// width="20"
// height="20"
// aria-label="Next Month"
// viewBox="0 0 24 24"
// fill="none"
// stroke="currentColor"
// strokeWidth="2"
// strokeLinecap="round"
// strokeLinejoin="round"
// className={
// props.orientation === "right"
// ? "hawa-rotate-180 hawa-opacity-80"
// : "hawa-opacity-80"
// }
// >
// <path d="m15 18-6-6 6-6" />
// </svg>
// ),
// }}
// {...props}
// />
// );
// }
// Calendar.displayName = "Calendar";

// export { Calendar };
4 changes: 2 additions & 2 deletions packages/components/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sikka/hawa",
"version": "0.42.16",
"version": "0.43.0",
"description": "Modern UI Kit made with Tailwind",
"author": {
"name": "Sikka Software",
Expand Down Expand Up @@ -87,7 +87,7 @@
"libphonenumber-js": "^1.11.5",
"prism-react-renderer": "^2.3.1",
"prismjs": "^1.29.0",
"react-day-picker": "^9.0.4",
"react-day-picker": "^8.10.1",
"react-dropzone": "^14.2.3",
"react-headless-pagination": "^1.1.6",
"react-hook-form": "^7.52.1",
Expand Down
7 changes: 7 additions & 0 deletions packages/storybook/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# hawa-storybook

## 0.26.120

### Patch Changes

- Updated dependencies
- @sikka/hawa@0.43.0

## 0.26.119

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/storybook/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hawa-storybook",
"version": "0.26.119",
"version": "0.26.120",
"description": "Modern UI Kit made with Tailwind",
"author": {
"name": "Sikka Software",
Expand Down
15 changes: 13 additions & 2 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 71d696d

Please sign in to comment.