@mbao01/common 0.0.41 → 0.0.43
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/dist/types/components/Accordion/Accordion.d.ts +1 -1
- package/dist/types/components/Accordion/constants.d.ts +3 -3
- package/dist/types/components/Accordion/index.d.ts +1 -1
- package/dist/types/components/Accordion/types.d.ts +0 -1
- package/dist/types/components/Alert/Alert.d.ts +1 -1
- package/dist/types/components/Alert/constants.d.ts +1 -1
- package/dist/types/components/Alert/index.d.ts +1 -1
- package/dist/types/components/Alert/types.d.ts +2 -3
- package/dist/types/components/AlertDialog/AlertDialog.d.ts +3 -3
- package/dist/types/components/AlertDialog/constants.d.ts +1 -1
- package/dist/types/components/AlertDialog/index.d.ts +1 -1
- package/dist/types/components/AlertDialog/types.d.ts +3 -4
- package/dist/types/components/Anchor/Anchor.d.ts +1 -1
- package/dist/types/components/Anchor/constant.d.ts +1 -1
- package/dist/types/components/Anchor/index.d.ts +1 -1
- package/dist/types/components/Anchor/types.d.ts +2 -3
- package/dist/types/components/Avatar/Avatar.d.ts +1 -1
- package/dist/types/components/Avatar/constants.d.ts +3 -3
- package/dist/types/components/Avatar/index.d.ts +1 -1
- package/dist/types/components/Avatar/types.d.ts +2 -3
- package/dist/types/components/Badge/Badge.d.ts +1 -1
- package/dist/types/components/Badge/constants.d.ts +1 -1
- package/dist/types/components/Badge/types.d.ts +2 -3
- package/dist/types/components/Breadcrumbs/Breadcrumbs.d.ts +1 -1
- package/dist/types/components/Breadcrumbs/index.d.ts +1 -1
- package/dist/types/components/Breadcrumbs/types.d.ts +0 -1
- package/dist/types/components/Button/Button.d.ts +3 -3
- package/dist/types/components/Button/constants.d.ts +1 -1
- package/dist/types/components/Button/index.d.ts +1 -1
- package/dist/types/components/Button/types.d.ts +3 -3
- package/dist/types/components/Calendar/Calendar.d.ts +1 -1
- package/dist/types/components/Calendar/index.d.ts +1 -1
- package/dist/types/components/Calendar/types.d.ts +1 -2
- package/dist/types/components/Card/Card.d.ts +1 -1
- package/dist/types/components/Card/constants.d.ts +1 -1
- package/dist/types/components/Card/index.d.ts +1 -1
- package/dist/types/components/Card/types.d.ts +3 -3
- package/dist/types/components/Carousel/Carousel.d.ts +11 -12
- package/dist/types/components/Carousel/CarouselContext.d.ts +2 -3
- package/dist/types/components/Carousel/constants.d.ts +4 -4
- package/dist/types/components/Carousel/index.d.ts +1 -1
- package/dist/types/components/Carousel/types.d.ts +1 -2
- package/dist/types/components/Carousel/useCarousel.d.ts +1 -1
- package/dist/types/components/Collapsible/Collapsible.d.ts +3 -4
- package/dist/types/components/Collapsible/index.d.ts +1 -1
- package/dist/types/components/Collapsible/types.d.ts +0 -1
- package/dist/types/components/Combobox/Combobox.d.ts +1 -1
- package/dist/types/components/Combobox/index.d.ts +1 -1
- package/dist/types/components/Command/Command.d.ts +24 -24
- package/dist/types/components/Command/constants.d.ts +11 -11
- package/dist/types/components/Command/index.d.ts +1 -1
- package/dist/types/components/Command/types.d.ts +4 -5
- package/dist/types/components/DatePicker/DatePicker.d.ts +1 -1
- package/dist/types/components/DatePicker/DateRangePicker.d.ts +1 -1
- package/dist/types/components/DatePicker/MultipleDatesPicker.d.ts +1 -1
- package/dist/types/components/DatePicker/index.d.ts +3 -3
- package/dist/types/components/DatePicker/types.d.ts +6 -7
- package/dist/types/components/Description/Description.d.ts +1 -1
- package/dist/types/components/Description/index.d.ts +1 -1
- package/dist/types/components/Description/types.d.ts +0 -1
- package/dist/types/components/Dialog/Dialog.d.ts +3 -3
- package/dist/types/components/Dialog/constants.d.ts +7 -7
- package/dist/types/components/Dialog/index.d.ts +1 -1
- package/dist/types/components/Dialog/types.d.ts +2 -3
- package/dist/types/components/Drawer/Drawer.d.ts +15 -20
- package/dist/types/components/Drawer/constants.d.ts +6 -6
- package/dist/types/components/Drawer/index.d.ts +1 -1
- package/dist/types/components/Drawer/types.d.ts +1 -2
- package/dist/types/components/FileUploader/FileUploader.d.ts +4 -5
- package/dist/types/components/FileUploader/FileUploaderContext.d.ts +2 -3
- package/dist/types/components/FileUploader/index.d.ts +1 -1
- package/dist/types/components/FileUploader/types.d.ts +2 -2
- package/dist/types/components/FileUploader/useFileUpload.d.ts +1 -1
- package/dist/types/components/Form/Checkbox/constants.d.ts +1 -1
- package/dist/types/components/Form/Checkbox/index.d.ts +1 -1
- package/dist/types/components/Form/Checkbox/types.d.ts +2 -3
- package/dist/types/components/Form/Input/Input.d.ts +2 -2
- package/dist/types/components/Form/Input/constants.d.ts +1 -1
- package/dist/types/components/Form/Input/index.d.ts +1 -1
- package/dist/types/components/Form/Input/types.d.ts +2 -3
- package/dist/types/components/Form/OtpInput/OtpInput.d.ts +1 -1
- package/dist/types/components/Form/OtpInput/index.d.ts +1 -1
- package/dist/types/components/Form/OtpInput/types.d.ts +2 -2
- package/dist/types/components/Form/Phone/Phone.d.ts +2 -2
- package/dist/types/components/Form/Phone/constants.d.ts +2 -2
- package/dist/types/components/Form/Phone/index.d.ts +1 -1
- package/dist/types/components/Form/Phone/types.d.ts +1 -1
- package/dist/types/components/Form/Radio/constants.d.ts +1 -1
- package/dist/types/components/Form/Radio/index.d.ts +1 -1
- package/dist/types/components/Form/Radio/types.d.ts +2 -3
- package/dist/types/components/Form/Range/Range.d.ts +1 -1
- package/dist/types/components/Form/Range/constants.d.ts +1 -1
- package/dist/types/components/Form/Range/index.d.ts +1 -1
- package/dist/types/components/Form/Range/types.d.ts +2 -3
- package/dist/types/components/Form/Select/Select.d.ts +2 -2
- package/dist/types/components/Form/Select/constants.d.ts +6 -6
- package/dist/types/components/Form/Select/index.d.ts +1 -1
- package/dist/types/components/Form/Select/types.d.ts +2 -3
- package/dist/types/components/Form/Slider/constants.d.ts +4 -4
- package/dist/types/components/Form/Slider/index.d.ts +1 -1
- package/dist/types/components/Form/Slider/types.d.ts +2 -3
- package/dist/types/components/Form/Switch/constants.d.ts +1 -1
- package/dist/types/components/Form/Switch/index.d.ts +1 -1
- package/dist/types/components/Form/Switch/types.d.ts +2 -3
- package/dist/types/components/Form/TextField/TextField.d.ts +3 -3
- package/dist/types/components/Form/TextField/constants.d.ts +1 -1
- package/dist/types/components/Form/TextField/index.d.ts +1 -1
- package/dist/types/components/Form/TextField/types.d.ts +2 -2
- package/dist/types/components/Form/Textarea/Textarea.d.ts +1 -1
- package/dist/types/components/Form/Textarea/constants.d.ts +1 -1
- package/dist/types/components/Form/Textarea/index.d.ts +1 -1
- package/dist/types/components/Form/Textarea/types.d.ts +2 -3
- package/dist/types/components/Form/components/FormControl/FormControl.d.ts +1 -1
- package/dist/types/components/Form/components/FormControl/constants.d.ts +1 -1
- package/dist/types/components/Form/components/FormControl/index.d.ts +1 -1
- package/dist/types/components/Form/components/FormControl/types.d.ts +2 -3
- package/dist/types/components/Form/components/Label/Label.d.ts +1 -1
- package/dist/types/components/Form/components/Label/constants.d.ts +1 -1
- package/dist/types/components/Form/components/Label/index.d.ts +1 -1
- package/dist/types/components/Form/components/Label/types.d.ts +3 -4
- package/dist/types/components/Form/index.d.ts +13 -13
- package/dist/types/components/HoverCard/HoverCard.d.ts +3 -4
- package/dist/types/components/HoverCard/constants.d.ts +1 -1
- package/dist/types/components/HoverCard/index.d.ts +1 -1
- package/dist/types/components/HoverCard/types.d.ts +0 -1
- package/dist/types/components/Loading/Loading.d.ts +1 -1
- package/dist/types/components/Loading/constants.d.ts +1 -1
- package/dist/types/components/Loading/index.d.ts +1 -1
- package/dist/types/components/Loading/types.d.ts +2 -3
- package/dist/types/components/Menu/ContextMenu/ContextMenu.d.ts +19 -20
- package/dist/types/components/Menu/ContextMenu/index.d.ts +1 -1
- package/dist/types/components/Menu/ContextMenu/types.d.ts +2 -3
- package/dist/types/components/Menu/DropdownMenu/DropdownMenu.d.ts +19 -20
- package/dist/types/components/Menu/DropdownMenu/index.d.ts +1 -1
- package/dist/types/components/Menu/DropdownMenu/types.d.ts +2 -3
- package/dist/types/components/Menu/Menubar/constants.d.ts +11 -11
- package/dist/types/components/Menu/Menubar/index.d.ts +1 -1
- package/dist/types/components/Menu/Menubar/types.d.ts +2 -3
- package/dist/types/components/Menu/NavigationMenu/NavigationMenu.d.ts +9 -10
- package/dist/types/components/Menu/NavigationMenu/constants.d.ts +6 -6
- package/dist/types/components/Menu/NavigationMenu/index.d.ts +1 -1
- package/dist/types/components/Menu/NavigationMenu/types.d.ts +2 -3
- package/dist/types/components/Menu/index.d.ts +4 -4
- package/dist/types/components/Pagination/Pagination.d.ts +3 -4
- package/dist/types/components/Pagination/constants.d.ts +5 -5
- package/dist/types/components/Pagination/index.d.ts +1 -1
- package/dist/types/components/Pagination/types.d.ts +2 -3
- package/dist/types/components/Popover/Popover.d.ts +1 -1
- package/dist/types/components/Popover/constants.d.ts +1 -1
- package/dist/types/components/Popover/index.d.ts +1 -1
- package/dist/types/components/Popover/types.d.ts +2 -3
- package/dist/types/components/Progress/Progress.d.ts +1 -1
- package/dist/types/components/Progress/constants.d.ts +2 -2
- package/dist/types/components/Progress/index.d.ts +1 -1
- package/dist/types/components/Progress/types.d.ts +2 -3
- package/dist/types/components/ScrollArea/ScrollArea.d.ts +3 -4
- package/dist/types/components/ScrollArea/constants.d.ts +4 -4
- package/dist/types/components/ScrollArea/index.d.ts +1 -1
- package/dist/types/components/ScrollArea/types.d.ts +2 -3
- package/dist/types/components/Separator/Separator.d.ts +1 -1
- package/dist/types/components/Separator/constants.d.ts +1 -1
- package/dist/types/components/Separator/index.d.ts +1 -1
- package/dist/types/components/Separator/types.d.ts +0 -1
- package/dist/types/components/Skeleton/Skeleton.d.ts +1 -1
- package/dist/types/components/Skeleton/constants.d.ts +1 -1
- package/dist/types/components/Skeleton/index.d.ts +1 -1
- package/dist/types/components/Skeleton/types.d.ts +2 -3
- package/dist/types/components/Slot/Slot.d.ts +1 -1
- package/dist/types/components/Slot/index.d.ts +1 -1
- package/dist/types/components/Sonner/Toaster.d.ts +1 -1
- package/dist/types/components/Sonner/constants.d.ts +2 -2
- package/dist/types/components/Sonner/index.d.ts +2 -2
- package/dist/types/components/Sonner/types.d.ts +3 -4
- package/dist/types/components/Table/Table.d.ts +8 -9
- package/dist/types/components/Table/constants.d.ts +2 -2
- package/dist/types/components/Table/index.d.ts +1 -1
- package/dist/types/components/Table/types.d.ts +2 -3
- package/dist/types/components/Tabs/Tabs.d.ts +1 -1
- package/dist/types/components/Tabs/constants.d.ts +3 -3
- package/dist/types/components/Tabs/index.d.ts +1 -1
- package/dist/types/components/Tabs/types.d.ts +2 -3
- package/dist/types/components/Text/Text.d.ts +1 -1
- package/dist/types/components/Text/constants.d.ts +1 -1
- package/dist/types/components/Text/types.d.ts +2 -3
- package/dist/types/components/ThemeSwitch/ThemeSwitch.d.ts +1 -1
- package/dist/types/components/ThemeSwitch/constants.d.ts +1 -1
- package/dist/types/components/ThemeSwitch/index.d.ts +1 -1
- package/dist/types/components/ThemeSwitch/types.d.ts +1 -2
- package/dist/types/components/Toggle/Toggle.d.ts +1 -1
- package/dist/types/components/Toggle/constants.d.ts +1 -1
- package/dist/types/components/Toggle/index.d.ts +1 -1
- package/dist/types/components/Toggle/types.d.ts +3 -4
- package/dist/types/components/ToggleGroup/ToggleGroup.d.ts +4 -5
- package/dist/types/components/ToggleGroup/constants.d.ts +1 -1
- package/dist/types/components/ToggleGroup/index.d.ts +1 -1
- package/dist/types/components/ToggleGroup/types.d.ts +1 -2
- package/dist/types/components/Tooltip/Tooltip.d.ts +2 -2
- package/dist/types/components/Tooltip/constants.d.ts +2 -2
- package/dist/types/components/Tooltip/index.d.ts +1 -1
- package/dist/types/components/Tooltip/types.d.ts +2 -3
- package/dist/types/index.d.ts +36 -36
- package/dist/types/libs/cva.d.ts +2 -2
- package/dist/types/libs/index.d.ts +1 -1
- package/dist/types/utilities/cn.d.ts +1 -1
- package/dist/types/utilities/getSubpaths/getSubpaths.d.ts +1 -1
- package/dist/types/utilities/getSubpaths/index.d.ts +1 -1
- package/dist/types/utilities/index.d.ts +3 -3
- package/package.json +82 -73
- package/src/components/Accordion/Accordion.tsx +3 -9
- package/src/components/Accordion/types.ts +2 -6
- package/src/components/Alert/Alert.tsx +3 -14
- package/src/components/AlertDialog/AlertDialog.tsx +3 -6
- package/src/components/AlertDialog/types.ts +3 -5
- package/src/components/Anchor/Anchor.tsx +3 -5
- package/src/components/Avatar/Avatar.tsx +5 -25
- package/src/components/Avatar/constants.ts +15 -18
- package/src/components/Avatar/types.ts +1 -5
- package/src/components/Badge/Badge.tsx +2 -12
- package/src/components/Badge/index.ts +1 -1
- package/src/components/Button/Button.tsx +5 -21
- package/src/components/Button/constants.ts +1 -1
- package/src/components/Button/types.ts +1 -1
- package/src/components/Calendar/Calendar.tsx +40 -34
- package/src/components/Card/Card.tsx +4 -14
- package/src/components/Card/types.ts +1 -2
- package/src/components/Carousel/Carousel.tsx +68 -73
- package/src/components/Carousel/constants.ts +10 -13
- package/src/components/Carousel/types.ts +1 -1
- package/src/components/Collapsible/Collapsible.tsx +2 -4
- package/src/components/Collapsible/types.ts +1 -3
- package/src/components/Combobox/Combobox.tsx +3 -8
- package/src/components/Command/Command.tsx +11 -28
- package/src/components/Command/constants.ts +2 -6
- package/src/components/Command/types.ts +3 -7
- package/src/components/DatePicker/DatePicker.tsx +5 -9
- package/src/components/DatePicker/DateRangePicker.tsx +5 -9
- package/src/components/DatePicker/MultipleDatesPicker.tsx +6 -10
- package/src/components/DatePicker/types.ts +12 -23
- package/src/components/Description/Description.tsx +4 -19
- package/src/components/Dialog/Dialog.tsx +5 -9
- package/src/components/Dialog/constants.ts +2 -6
- package/src/components/Dialog/types.ts +5 -15
- package/src/components/Drawer/Drawer.tsx +6 -19
- package/src/components/Drawer/constants.ts +2 -6
- package/src/components/FileUploader/FileUploader.tsx +31 -53
- package/src/components/FileUploader/FileUploaderContext.tsx +1 -2
- package/src/components/FileUploader/types.ts +1 -1
- package/src/components/Form/Checkbox/Checkbox.tsx +2 -2
- package/src/components/Form/Checkbox/types.ts +1 -4
- package/src/components/Form/Input/Input.tsx +3 -9
- package/src/components/Form/Input/constants.ts +47 -50
- package/src/components/Form/Input/types.ts +1 -4
- package/src/components/Form/OtpInput/OtpInput.tsx +5 -12
- package/src/components/Form/Phone/Phone.tsx +6 -15
- package/src/components/Form/Radio/Radio.tsx +2 -2
- package/src/components/Form/Radio/types.ts +1 -4
- package/src/components/Form/Range/Range.tsx +3 -6
- package/src/components/Form/Range/types.ts +1 -4
- package/src/components/Form/Select/Select.tsx +26 -49
- package/src/components/Form/Select/types.ts +3 -9
- package/src/components/Form/Slider/Slider.tsx +39 -25
- package/src/components/Form/Slider/constants.ts +21 -24
- package/src/components/Form/Slider/types.ts +2 -4
- package/src/components/Form/Switch/Switch.tsx +2 -3
- package/src/components/Form/Switch/types.ts +1 -4
- package/src/components/Form/TextField/TextField.tsx +2 -2
- package/src/components/Form/Textarea/Textarea.tsx +2 -5
- package/src/components/Form/Textarea/constants.ts +42 -45
- package/src/components/Form/components/FormControl/FormControl.tsx +1 -1
- package/src/components/Form/components/Label/Label.tsx +2 -5
- package/src/components/Form/components/Label/types.ts +2 -4
- package/src/components/HoverCard/HoverCard.tsx +2 -4
- package/src/components/HoverCard/types.ts +1 -3
- package/src/components/Loading/Loading.tsx +3 -12
- package/src/components/Menu/ContextMenu/ContextMenu.tsx +5 -17
- package/src/components/Menu/ContextMenu/types.ts +1 -3
- package/src/components/Menu/DropdownMenu/DropdownMenu.tsx +7 -21
- package/src/components/Menu/DropdownMenu/types.ts +1 -3
- package/src/components/Menu/Menubar/Menubar.tsx +33 -49
- package/src/components/Menu/Menubar/types.ts +5 -15
- package/src/components/Menu/NavigationMenu/NavigationMenu.tsx +4 -13
- package/src/components/Pagination/Pagination.tsx +18 -42
- package/src/components/Pagination/constants.ts +2 -6
- package/src/components/Popover/Popover.tsx +1 -1
- package/src/components/Popover/types.ts +2 -6
- package/src/components/Progress/Progress.tsx +2 -4
- package/src/components/Progress/constants.ts +38 -44
- package/src/components/ScrollArea/ScrollArea.tsx +4 -16
- package/src/components/ScrollArea/constants.ts +8 -13
- package/src/components/ScrollArea/types.ts +1 -3
- package/src/components/Separator/Separator.tsx +2 -2
- package/src/components/Separator/types.ts +1 -3
- package/src/components/Skeleton/Skeleton.tsx +4 -14
- package/src/components/Sonner/Toaster.tsx +2 -4
- package/src/components/Sonner/constants.ts +10 -20
- package/src/components/Sonner/types.ts +4 -10
- package/src/components/Table/Table.tsx +23 -38
- package/src/components/Tabs/Tabs.tsx +9 -31
- package/src/components/Tabs/types.ts +5 -17
- package/src/components/Text/Text.tsx +3 -6
- package/src/components/Text/index.ts +1 -1
- package/src/components/Text/types.ts +1 -3
- package/src/components/ThemeSwitch/ThemeSwitch.tsx +3 -2
- package/src/components/Toggle/Toggle.tsx +15 -16
- package/src/components/Toggle/types.ts +2 -7
- package/src/components/ToggleGroup/ToggleGroup.tsx +5 -19
- package/src/components/ToggleGroup/constants.ts +1 -3
- package/src/components/ToggleGroup/types.ts +1 -3
- package/src/components/Tooltip/Tooltip.tsx +2 -4
- package/src/components/Tooltip/types.ts +1 -1
- package/src/libs/cva.ts +1 -3
- package/src/typography/TypographyDemo.tsx +119 -188
- package/src/typography/TypographyScale.tsx +7 -8
- package/src/utilities/cn.ts +2 -1
- package/src/utilities/getSubpaths/getSubpaths.ts +2 -4
- package/tsconfig.node.json +1 -1
- package/vitest-setup.ts +17 -1
- package/vitest.config.ts +2 -1
- package/dist/types/components/Menu/Menubar/Menubar.d.ts +0 -43
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { useState } from "react";
|
|
4
|
-
import { format } from "date-fns";
|
|
5
4
|
import { CalendarIcon } from "@radix-ui/react-icons";
|
|
6
|
-
import {
|
|
5
|
+
import { format } from "date-fns";
|
|
7
6
|
import { cn } from "../../utilities";
|
|
8
7
|
import { Button } from "../Button";
|
|
9
8
|
import { Calendar } from "../Calendar";
|
|
10
9
|
import { Popover } from "../Popover";
|
|
10
|
+
import { type MultipleDatesPickerProps } from "./types";
|
|
11
11
|
|
|
12
12
|
export const MultipleDatesPicker = ({
|
|
13
13
|
name,
|
|
@@ -21,8 +21,7 @@ export const MultipleDatesPicker = ({
|
|
|
21
21
|
getDatesValue = (dates) => dates?.map((date) => date.toUTCString()),
|
|
22
22
|
getDatesLabel = (dates) => {
|
|
23
23
|
if (!dates?.length) return undefined;
|
|
24
|
-
if (dates.length < 3)
|
|
25
|
-
return dates.map((date) => format(date, "LLL dd, y")).join(" and ");
|
|
24
|
+
if (dates.length < 3) return dates.map((date) => format(date, "LLL dd, y")).join(" and ");
|
|
26
25
|
|
|
27
26
|
return `${dates.length} dates selected`;
|
|
28
27
|
},
|
|
@@ -54,10 +53,7 @@ export const MultipleDatesPicker = ({
|
|
|
54
53
|
outline={outline}
|
|
55
54
|
variant={variant}
|
|
56
55
|
disabled={disabled}
|
|
57
|
-
className={cn(
|
|
58
|
-
"justify-start flex-nowrap",
|
|
59
|
-
!dates?.length && "font-normal"
|
|
60
|
-
)}
|
|
56
|
+
className={cn("justify-start flex-nowrap", !dates?.length && "font-normal")}
|
|
61
57
|
>
|
|
62
58
|
<span className="text-left text-ellipsis overflow-hidden text-nowrap">
|
|
63
59
|
{rangeLabel ?? label ?? "Pick one or more dates"}
|
|
@@ -67,11 +63,11 @@ export const MultipleDatesPicker = ({
|
|
|
67
63
|
</Popover.Trigger>
|
|
68
64
|
<Popover.Content className="w-auto p-0">
|
|
69
65
|
<Calendar
|
|
70
|
-
|
|
66
|
+
autoFocus
|
|
71
67
|
mode="multiple"
|
|
72
68
|
selected={dates}
|
|
73
69
|
onSelect={setDates}
|
|
74
|
-
captionLayout="
|
|
70
|
+
captionLayout="label"
|
|
75
71
|
{...props}
|
|
76
72
|
/>
|
|
77
73
|
</Popover.Content>
|
|
@@ -1,21 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
DayPickerMultipleProps,
|
|
4
|
-
DayPickerRangeProps,
|
|
5
|
-
DayPickerSingleProps,
|
|
6
|
-
} from "react-day-picker";
|
|
7
|
-
import { ButtonProps } from "../Button/types";
|
|
1
|
+
import type { DateRange, PropsBase, PropsMulti, PropsRange, PropsSingle } from "react-day-picker";
|
|
2
|
+
import { type ButtonProps } from "../Button/types";
|
|
8
3
|
|
|
9
|
-
type BaseDatePickerProps =
|
|
10
|
-
ButtonProps,
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
triggerClassName?: string;
|
|
15
|
-
};
|
|
4
|
+
type BaseDatePickerProps = Omit<PropsBase, "mode"> &
|
|
5
|
+
Pick<ButtonProps, "variant" | "outline" | "wide" | "size" | "name" | "disabled"> & {
|
|
6
|
+
label?: string;
|
|
7
|
+
triggerClassName?: string;
|
|
8
|
+
};
|
|
16
9
|
|
|
17
10
|
export type DatePickerProps = BaseDatePickerProps &
|
|
18
|
-
Omit<
|
|
11
|
+
Omit<PropsSingle, "mode"> & {
|
|
19
12
|
children?: ({
|
|
20
13
|
date,
|
|
21
14
|
setDate,
|
|
@@ -29,22 +22,18 @@ export type DatePickerProps = BaseDatePickerProps &
|
|
|
29
22
|
};
|
|
30
23
|
|
|
31
24
|
export type DateRangePickerProps = BaseDatePickerProps &
|
|
32
|
-
Omit<
|
|
25
|
+
Omit<PropsRange, "mode"> & {
|
|
33
26
|
defaultRange?: DateRange;
|
|
34
27
|
getRangeValue?: (range: DateRange | undefined) => {
|
|
35
28
|
from: string | undefined;
|
|
36
29
|
to: string | undefined;
|
|
37
30
|
};
|
|
38
|
-
getRangeLabel?: (
|
|
39
|
-
range: DateRange | undefined
|
|
40
|
-
) => string | JSX.Element | undefined;
|
|
31
|
+
getRangeLabel?: (range: DateRange | undefined) => string | JSX.Element | undefined;
|
|
41
32
|
};
|
|
42
33
|
|
|
43
34
|
export type MultipleDatesPickerProps = BaseDatePickerProps &
|
|
44
|
-
Omit<
|
|
35
|
+
Omit<PropsMulti, "mode"> & {
|
|
45
36
|
defaultDates?: Date[];
|
|
46
37
|
getDatesValue?: (dates: Date[] | undefined) => string[] | undefined;
|
|
47
|
-
getDatesLabel?: (
|
|
48
|
-
dates: Date[] | undefined
|
|
49
|
-
) => string | JSX.Element | undefined;
|
|
38
|
+
getDatesLabel?: (dates: Date[] | undefined) => string | JSX.Element | undefined;
|
|
50
39
|
};
|
|
@@ -1,31 +1,16 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
DescriptionProps,
|
|
3
|
-
DescriptionTermProps,
|
|
4
|
-
DescriptionDetailProps,
|
|
5
|
-
} from "./types";
|
|
1
|
+
import type { DescriptionDetailProps, DescriptionProps, DescriptionTermProps } from "./types";
|
|
6
2
|
import { cn } from "../../utilities";
|
|
7
3
|
|
|
8
4
|
const Description = (props: DescriptionProps) => {
|
|
9
|
-
return <dl
|
|
5
|
+
return <dl {...props} />;
|
|
10
6
|
};
|
|
11
7
|
|
|
12
8
|
const DescriptionTerm = ({ className, ...props }: DescriptionTermProps) => {
|
|
13
|
-
return (
|
|
14
|
-
<dt
|
|
15
|
-
role="listitem"
|
|
16
|
-
className={cn("py-2 text-sm font-semibold", className)}
|
|
17
|
-
{...props}
|
|
18
|
-
/>
|
|
19
|
-
);
|
|
9
|
+
return <dt className={cn("py-2 text-sm font-semibold", className)} {...props} />;
|
|
20
10
|
};
|
|
21
11
|
|
|
22
12
|
const DescriptionDetail = ({ className, ...props }: DescriptionDetailProps) => {
|
|
23
|
-
return (
|
|
24
|
-
<dd
|
|
25
|
-
className={cn("text-base [&:not(:last-child)]:mb-1", className)}
|
|
26
|
-
{...props}
|
|
27
|
-
/>
|
|
28
|
-
);
|
|
13
|
+
return <dd className={cn("text-base [&:not(:last-child)]:mb-1", className)} {...props} />;
|
|
29
14
|
};
|
|
30
15
|
|
|
31
16
|
Description.Term = DescriptionTerm;
|
|
@@ -4,13 +4,13 @@ import * as React from "react";
|
|
|
4
4
|
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
5
5
|
import { Cross2Icon } from "@radix-ui/react-icons";
|
|
6
6
|
import type {
|
|
7
|
-
|
|
7
|
+
DialogContentProps,
|
|
8
|
+
DialogDescriptionProps,
|
|
8
9
|
DialogFooterProps,
|
|
9
10
|
DialogHeaderProps,
|
|
10
|
-
DialogTitleProps,
|
|
11
|
-
DialogDescriptionProps,
|
|
12
11
|
DialogOverlayProps,
|
|
13
|
-
|
|
12
|
+
DialogProps,
|
|
13
|
+
DialogTitleProps,
|
|
14
14
|
} from "./types";
|
|
15
15
|
import { cn } from "../../utilities";
|
|
16
16
|
import {
|
|
@@ -96,11 +96,7 @@ const DialogTitle = React.forwardRef<
|
|
|
96
96
|
React.ElementRef<typeof DialogPrimitive.Title>,
|
|
97
97
|
DialogTitleProps
|
|
98
98
|
>(({ className, ...props }, ref) => (
|
|
99
|
-
<DialogPrimitive.Title
|
|
100
|
-
ref={ref}
|
|
101
|
-
className={cn(getDialogTitleClasses(), className)}
|
|
102
|
-
{...props}
|
|
103
|
-
/>
|
|
99
|
+
<DialogPrimitive.Title ref={ref} className={cn(getDialogTitleClasses(), className)} {...props} />
|
|
104
100
|
));
|
|
105
101
|
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
106
102
|
|
|
@@ -29,17 +29,13 @@ export const getDialogContentClasses = cva(
|
|
|
29
29
|
}
|
|
30
30
|
);
|
|
31
31
|
|
|
32
|
-
export const getDialogHeaderClasses = cva(
|
|
33
|
-
"flex flex-col space-y-1.5 text-center sm:text-left"
|
|
34
|
-
);
|
|
32
|
+
export const getDialogHeaderClasses = cva("flex flex-col space-y-1.5 text-center sm:text-left");
|
|
35
33
|
|
|
36
34
|
export const getDialogFooterClasses = cva(
|
|
37
35
|
"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2"
|
|
38
36
|
);
|
|
39
37
|
|
|
40
|
-
export const getDialogTitleClasses = cva(
|
|
41
|
-
"text-lg font-semibold leading-none tracking-tight"
|
|
42
|
-
);
|
|
38
|
+
export const getDialogTitleClasses = cva("text-lg font-semibold leading-none tracking-tight");
|
|
43
39
|
|
|
44
40
|
export const getDialogDescriptionClasses = cva("text-sm text-muted-foreground");
|
|
45
41
|
|
|
@@ -10,23 +10,15 @@ import {
|
|
|
10
10
|
getDialogTitleClasses,
|
|
11
11
|
} from "./constants";
|
|
12
12
|
|
|
13
|
-
export type DialogProps = React.ComponentPropsWithoutRef<
|
|
14
|
-
typeof DialogPrimitive.Root
|
|
15
|
-
>;
|
|
13
|
+
export type DialogProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Root>;
|
|
16
14
|
|
|
17
|
-
export type DialogOverlayProps = React.ComponentPropsWithoutRef<
|
|
18
|
-
typeof DialogPrimitive.Overlay
|
|
19
|
-
> &
|
|
15
|
+
export type DialogOverlayProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay> &
|
|
20
16
|
VariantProps<typeof getDialogOverlayClasses>;
|
|
21
17
|
|
|
22
|
-
export type DialogCloseProps = React.ComponentPropsWithoutRef<
|
|
23
|
-
typeof DialogPrimitive.Close
|
|
24
|
-
> &
|
|
18
|
+
export type DialogCloseProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Close> &
|
|
25
19
|
VariantProps<typeof getDialogCloseClasses>;
|
|
26
20
|
|
|
27
|
-
export type DialogContentProps = React.ComponentPropsWithoutRef<
|
|
28
|
-
typeof DialogPrimitive.Content
|
|
29
|
-
> &
|
|
21
|
+
export type DialogContentProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content> &
|
|
30
22
|
VariantProps<typeof getDialogContentClasses> & {
|
|
31
23
|
showClose?: boolean;
|
|
32
24
|
closeProps?: DialogCloseProps;
|
|
@@ -38,9 +30,7 @@ export type DialogHeaderProps = React.HTMLAttributes<HTMLDivElement> &
|
|
|
38
30
|
export type DialogFooterProps = React.HTMLAttributes<HTMLDivElement> &
|
|
39
31
|
VariantProps<typeof getDialogFooterClasses>;
|
|
40
32
|
|
|
41
|
-
export type DialogTitleProps = React.ComponentPropsWithoutRef<
|
|
42
|
-
typeof DialogPrimitive.Title
|
|
43
|
-
> &
|
|
33
|
+
export type DialogTitleProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title> &
|
|
44
34
|
VariantProps<typeof getDialogTitleClasses>;
|
|
45
35
|
|
|
46
36
|
export type DialogDescriptionProps = React.ComponentPropsWithoutRef<
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
+
import { forwardRef } from "react";
|
|
3
4
|
import { Drawer as DrawerPrimitive } from "vaul";
|
|
4
5
|
import { cn } from "../../utilities";
|
|
5
|
-
import { forwardRef } from "react";
|
|
6
|
-
import { DrawerProps } from "./types";
|
|
7
6
|
import {
|
|
8
7
|
getDrawerContentClasses,
|
|
9
8
|
getDrawerDescriptionClasses,
|
|
@@ -12,12 +11,10 @@ import {
|
|
|
12
11
|
getDrawerOverlayClasses,
|
|
13
12
|
getDrawerTitleClasses,
|
|
14
13
|
} from "./constants";
|
|
14
|
+
import { DrawerProps } from "./types";
|
|
15
15
|
|
|
16
16
|
const Drawer = ({ shouldScaleBackground = true, ...props }: DrawerProps) => (
|
|
17
|
-
<DrawerPrimitive.Root
|
|
18
|
-
shouldScaleBackground={shouldScaleBackground}
|
|
19
|
-
{...props}
|
|
20
|
-
/>
|
|
17
|
+
<DrawerPrimitive.Root shouldScaleBackground={shouldScaleBackground} {...props} />
|
|
21
18
|
);
|
|
22
19
|
Drawer.displayName = "Drawer";
|
|
23
20
|
|
|
@@ -57,18 +54,12 @@ const DrawerContent = forwardRef<
|
|
|
57
54
|
));
|
|
58
55
|
DrawerContent.displayName = "DrawerContent";
|
|
59
56
|
|
|
60
|
-
const DrawerHeader = ({
|
|
61
|
-
className,
|
|
62
|
-
...props
|
|
63
|
-
}: React.HTMLAttributes<HTMLDivElement>) => (
|
|
57
|
+
const DrawerHeader = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
|
|
64
58
|
<div className={cn(getDrawerHeaderClasses(), className)} {...props} />
|
|
65
59
|
);
|
|
66
60
|
DrawerHeader.displayName = "DrawerHeader";
|
|
67
61
|
|
|
68
|
-
const DrawerFooter = ({
|
|
69
|
-
className,
|
|
70
|
-
...props
|
|
71
|
-
}: React.HTMLAttributes<HTMLDivElement>) => (
|
|
62
|
+
const DrawerFooter = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
|
|
72
63
|
<div className={cn(getDrawerFooterClasses(), className)} {...props} />
|
|
73
64
|
);
|
|
74
65
|
DrawerFooter.displayName = "DrawerFooter";
|
|
@@ -77,11 +68,7 @@ const DrawerTitle = forwardRef<
|
|
|
77
68
|
React.ElementRef<typeof DrawerPrimitive.Title>,
|
|
78
69
|
React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Title>
|
|
79
70
|
>(({ className, ...props }, ref) => (
|
|
80
|
-
<DrawerPrimitive.Title
|
|
81
|
-
ref={ref}
|
|
82
|
-
className={cn(getDrawerTitleClasses(), className)}
|
|
83
|
-
{...props}
|
|
84
|
-
/>
|
|
71
|
+
<DrawerPrimitive.Title ref={ref} className={cn(getDrawerTitleClasses(), className)} {...props} />
|
|
85
72
|
));
|
|
86
73
|
DrawerTitle.displayName = DrawerPrimitive.Title.displayName;
|
|
87
74
|
|
|
@@ -6,14 +6,10 @@ export const getDrawerContentClasses = cva(
|
|
|
6
6
|
|
|
7
7
|
export const getDrawerDescriptionClasses = cva("text-sm");
|
|
8
8
|
|
|
9
|
-
export const getDrawerHeaderClasses = cva(
|
|
10
|
-
"grid gap-1.5 p-4 text-center sm:text-left"
|
|
11
|
-
);
|
|
9
|
+
export const getDrawerHeaderClasses = cva("grid gap-1.5 p-4 text-center sm:text-left");
|
|
12
10
|
|
|
13
11
|
export const getDrawerFooterClasses = cva("mt-auto flex flex-col gap-2 p-4");
|
|
14
12
|
|
|
15
13
|
export const getDrawerOverlayClasses = cva("fixed inset-0 z-50 bg-black/80");
|
|
16
14
|
|
|
17
|
-
export const getDrawerTitleClasses = cva(
|
|
18
|
-
"text-lg font-semibold leading-none tracking-tight"
|
|
19
|
-
);
|
|
15
|
+
export const getDrawerTitleClasses = cva("text-lg font-semibold leading-none tracking-tight");
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { forwardRef, useCallback, useEffect, useRef, useState } from "react";
|
|
4
|
-
import {
|
|
5
|
-
import { toast } from "sonner";
|
|
4
|
+
import { FileRejection, useDropzone } from "react-dropzone";
|
|
6
5
|
import { TrashIcon } from "@radix-ui/react-icons";
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
FileUploaderInputProps,
|
|
10
|
-
FileUploaderProps,
|
|
11
|
-
} from "./types";
|
|
6
|
+
import { toast } from "sonner";
|
|
7
|
+
import type { DirectionOptions, FileUploaderInputProps, FileUploaderProps } from "./types";
|
|
12
8
|
import { cn } from "../../utilities";
|
|
13
9
|
import { FileUploaderContext } from "./FileUploaderContext";
|
|
14
10
|
import { useFileUpload } from "./useFileUpload";
|
|
@@ -158,9 +154,7 @@ export const FileUploader = ({
|
|
|
158
154
|
if (rejectedFiles.length > 0) {
|
|
159
155
|
for (const rejectedFile of rejectedFiles) {
|
|
160
156
|
if (rejectedFile.errors[0]?.code === "file-too-large") {
|
|
161
|
-
toast.error(
|
|
162
|
-
`File is too large. Max size is ${maxSize / 1024 / 1024}MB`
|
|
163
|
-
);
|
|
157
|
+
toast.error(`File is too large. Max size is ${maxSize / 1024 / 1024}MB`);
|
|
164
158
|
break;
|
|
165
159
|
}
|
|
166
160
|
if (rejectedFile.errors[0]?.message) {
|
|
@@ -183,9 +177,7 @@ export const FileUploader = ({
|
|
|
183
177
|
setIsLOF(false);
|
|
184
178
|
}, [value, maxFiles]);
|
|
185
179
|
|
|
186
|
-
const opts = dropzoneOptions
|
|
187
|
-
? dropzoneOptions
|
|
188
|
-
: { accept, maxFiles, maxSize, multiple };
|
|
180
|
+
const opts = dropzoneOptions ? dropzoneOptions : { accept, maxFiles, maxSize, multiple };
|
|
189
181
|
|
|
190
182
|
const dropzoneState = useDropzone({
|
|
191
183
|
...opts,
|
|
@@ -226,33 +218,28 @@ export const FileUploader = ({
|
|
|
226
218
|
|
|
227
219
|
FileUploader.displayName = "FileUploader";
|
|
228
220
|
|
|
229
|
-
const FileUploaderContent = forwardRef<
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
const { orientation } = useFileUpload();
|
|
234
|
-
const containerRef = useRef<HTMLDivElement>(null);
|
|
221
|
+
const FileUploaderContent = forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
|
|
222
|
+
({ children, className, ...props }, ref) => {
|
|
223
|
+
const { orientation } = useFileUpload();
|
|
224
|
+
const containerRef = useRef<HTMLDivElement>(null);
|
|
235
225
|
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
)}
|
|
250
|
-
>
|
|
251
|
-
{children}
|
|
226
|
+
return (
|
|
227
|
+
<div className={cn("w-full px-1")} ref={containerRef} aria-description="content file holder">
|
|
228
|
+
<div
|
|
229
|
+
{...props}
|
|
230
|
+
ref={ref}
|
|
231
|
+
className={cn(
|
|
232
|
+
"flex rounded-xl gap-1",
|
|
233
|
+
orientation === "horizontal" ? "flex-raw flex-wrap" : "flex-col",
|
|
234
|
+
className
|
|
235
|
+
)}
|
|
236
|
+
>
|
|
237
|
+
{children}
|
|
238
|
+
</div>
|
|
252
239
|
</div>
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
240
|
+
);
|
|
241
|
+
}
|
|
242
|
+
);
|
|
256
243
|
|
|
257
244
|
FileUploaderContent.displayName = "FileUploaderContent";
|
|
258
245
|
|
|
@@ -277,18 +264,14 @@ const FileUploaderItem = forwardRef<
|
|
|
277
264
|
</div>
|
|
278
265
|
<button
|
|
279
266
|
type="button"
|
|
280
|
-
className={cn(
|
|
281
|
-
"absolute",
|
|
282
|
-
direction === "rtl" ? "top-1 left-1" : "top-1 right-1"
|
|
283
|
-
)}
|
|
267
|
+
className={cn("absolute", direction === "rtl" ? "top-1 left-1" : "top-1 right-1")}
|
|
284
268
|
onClick={() => removeFileFromSet(index)}
|
|
285
269
|
>
|
|
286
270
|
<span className="sr-only">remove item {index}</span>
|
|
287
271
|
<TrashIcon
|
|
288
|
-
className={cn(
|
|
289
|
-
"
|
|
290
|
-
|
|
291
|
-
)}
|
|
272
|
+
className={cn("w-4 h-4 shrink-0 hover:stroke-destructive duration-200 ease-in-out", {
|
|
273
|
+
"text-error": isSelected,
|
|
274
|
+
})}
|
|
292
275
|
/>
|
|
293
276
|
</button>
|
|
294
277
|
</div>
|
|
@@ -297,13 +280,8 @@ const FileUploaderItem = forwardRef<
|
|
|
297
280
|
|
|
298
281
|
FileUploaderItem.displayName = "FileUploaderItem";
|
|
299
282
|
|
|
300
|
-
const FileUploaderInput = ({
|
|
301
|
-
|
|
302
|
-
children,
|
|
303
|
-
...props
|
|
304
|
-
}: FileUploaderInputProps) => {
|
|
305
|
-
const { dropzoneState, isFileTooBig, isLOF, hiddenInputRef } =
|
|
306
|
-
useFileUpload();
|
|
283
|
+
const FileUploaderInput = ({ classes, children, ...props }: FileUploaderInputProps) => {
|
|
284
|
+
const { dropzoneState, isFileTooBig, isLOF, hiddenInputRef } = useFileUpload();
|
|
307
285
|
const rootProps = isLOF ? {} : dropzoneState.getRootProps();
|
|
308
286
|
return (
|
|
309
287
|
<div {...props} className="relative w-full">
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { createContext } from "react";
|
|
2
2
|
import { type FileUploaderContextType } from "./types";
|
|
3
3
|
|
|
4
|
-
export const FileUploaderContext =
|
|
5
|
-
createContext<FileUploaderContextType | null>(null);
|
|
4
|
+
export const FileUploaderContext = createContext<FileUploaderContextType | null>(null);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { type CheckboxProps } from "./types";
|
|
3
|
-
import { getCheckboxClasses } from "./constants";
|
|
4
2
|
import { cn } from "../../../utilities";
|
|
3
|
+
import { getCheckboxClasses } from "./constants";
|
|
4
|
+
import { type CheckboxProps } from "./types";
|
|
5
5
|
|
|
6
6
|
const Checkbox = React.forwardRef<HTMLInputElement, CheckboxProps>(
|
|
7
7
|
({ className, size, variant, ...props }, ref) => (
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import { type VariantProps } from "../../../libs";
|
|
2
2
|
import { getCheckboxClasses } from "./constants";
|
|
3
3
|
|
|
4
|
-
export type CheckboxProps = Omit<
|
|
5
|
-
React.HTMLProps<HTMLInputElement>,
|
|
6
|
-
"size" | "ref" | "type"
|
|
7
|
-
> &
|
|
4
|
+
export type CheckboxProps = Omit<React.HTMLProps<HTMLInputElement>, "size" | "ref" | "type"> &
|
|
8
5
|
VariantProps<typeof getCheckboxClasses>;
|
|
@@ -1,20 +1,14 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { type InputProps } from "./types";
|
|
3
2
|
import { cn } from "../../../utilities";
|
|
4
3
|
import { getInputClasses } from "./constants";
|
|
4
|
+
import { type InputProps } from "./types";
|
|
5
5
|
|
|
6
6
|
export const Input = React.forwardRef<HTMLInputElement, InputProps>(
|
|
7
|
-
(
|
|
8
|
-
{ size, variant, wide, outline, className, type, ...props }: InputProps,
|
|
9
|
-
ref
|
|
10
|
-
) => (
|
|
7
|
+
({ size, variant, wide, outline, className, type, ...props }: InputProps, ref) => (
|
|
11
8
|
<input
|
|
12
9
|
ref={ref}
|
|
13
10
|
type={type}
|
|
14
|
-
className={cn(
|
|
15
|
-
getInputClasses({ type, size, wide, variant, outline }),
|
|
16
|
-
className
|
|
17
|
-
)}
|
|
11
|
+
className={cn(getInputClasses({ type, size, wide, variant, outline }), className)}
|
|
18
12
|
{...props}
|
|
19
13
|
/>
|
|
20
14
|
)
|
|
@@ -1,52 +1,49 @@
|
|
|
1
1
|
import { cva } from "../../../libs";
|
|
2
2
|
|
|
3
|
-
export const getInputClasses = cva(
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
],
|
|
51
|
-
}
|
|
52
|
-
);
|
|
3
|
+
export const getInputClasses = cva("input rounded-md transition-all duration-100", {
|
|
4
|
+
variants: {
|
|
5
|
+
variant: {
|
|
6
|
+
default: "bg-transparent",
|
|
7
|
+
accent: "input-accent",
|
|
8
|
+
error: "input-error",
|
|
9
|
+
ghost: "input-ghost",
|
|
10
|
+
info: "input-info",
|
|
11
|
+
primary: "input-primary",
|
|
12
|
+
secondary: "input-secondary",
|
|
13
|
+
success: "input-success",
|
|
14
|
+
warning: "input-warning",
|
|
15
|
+
},
|
|
16
|
+
outline: {
|
|
17
|
+
true: "input-bordered",
|
|
18
|
+
},
|
|
19
|
+
wide: {
|
|
20
|
+
true: "w-full",
|
|
21
|
+
},
|
|
22
|
+
size: {
|
|
23
|
+
xs: "input-xs",
|
|
24
|
+
sm: "input-sm",
|
|
25
|
+
md: "input-md",
|
|
26
|
+
lg: "input-lg",
|
|
27
|
+
},
|
|
28
|
+
type: {
|
|
29
|
+
["file" as string]:
|
|
30
|
+
"file:border-0 file:bg-transparent file:text-sm file:font-medium file:h-full",
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
compoundVariants: [
|
|
34
|
+
{
|
|
35
|
+
size: undefined,
|
|
36
|
+
className: "min-h-fit h-10",
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
variant: undefined,
|
|
40
|
+
outline: true,
|
|
41
|
+
className: "border-neutral-content",
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
variant: "default",
|
|
45
|
+
outline: true,
|
|
46
|
+
className: "border-base-content",
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
});
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import { type VariantProps } from "../../../libs";
|
|
2
2
|
import { getInputClasses } from "./constants";
|
|
3
3
|
|
|
4
|
-
export type InputProps = Omit<
|
|
5
|
-
React.HTMLProps<HTMLInputElement>,
|
|
6
|
-
"size" | "ref"
|
|
7
|
-
> &
|
|
4
|
+
export type InputProps = Omit<React.HTMLProps<HTMLInputElement>, "size" | "ref"> &
|
|
8
5
|
Omit<VariantProps<typeof getInputClasses>, "type">;
|
|
@@ -1,14 +1,10 @@
|
|
|
1
|
+
import { useState } from "react";
|
|
1
2
|
import OTPInput from "react-otp-input";
|
|
2
|
-
import { type OtpInputProps } from "./types";
|
|
3
|
-
import { Input } from "../Input";
|
|
4
3
|
import { cn } from "../../../utilities";
|
|
5
|
-
import {
|
|
4
|
+
import { Input } from "../Input";
|
|
5
|
+
import { type OtpInputProps } from "./types";
|
|
6
6
|
|
|
7
|
-
export const OtpInput = ({
|
|
8
|
-
className,
|
|
9
|
-
inputProps,
|
|
10
|
-
...props
|
|
11
|
-
}: OtpInputProps) => {
|
|
7
|
+
export const OtpInput = ({ className, inputProps, ...props }: OtpInputProps) => {
|
|
12
8
|
const [otp, setOtp] = useState("");
|
|
13
9
|
|
|
14
10
|
return (
|
|
@@ -20,10 +16,7 @@ export const OtpInput = ({
|
|
|
20
16
|
<Input
|
|
21
17
|
{...inputProps}
|
|
22
18
|
{...renderProps}
|
|
23
|
-
className={cn(
|
|
24
|
-
"!w-12 !appearance-none selection:bg-base text-base-content",
|
|
25
|
-
className
|
|
26
|
-
)}
|
|
19
|
+
className={cn("!w-12 !appearance-none selection:bg-base text-base-content", className)}
|
|
27
20
|
/>
|
|
28
21
|
)}
|
|
29
22
|
containerStyle={`flex justify-center items-center flex-wrap text-2xl font-bold ${
|