@clicktap/ui 0.14.18 → 0.14.25
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/components/ContextMenu/ContextMenu.js +1 -1
- package/components/Dialog/Dialog.js +1 -1
- package/components/DialogTrigger/DialogTrigger.js +1 -1
- package/components/Drawer/Drawer.js +1 -1
- package/components/ModalOverlay/ModalOverlay.js +1 -1
- package/components/PinInput/PinInput.js +1 -1
- package/components/Select/Select.js +1 -1
- package/components/Tabs/Tabs.context.d.ts +3 -0
- package/package.json +1 -1
- package/components/Accordion/Accordion.tsx +0 -82
- package/components/Accordion/index.ts +0 -3
- package/components/Avatar/Avatar.stories.tsx +0 -99
- package/components/Avatar/Avatar.tsx +0 -120
- package/components/Avatar/Avatar.types.ts +0 -3
- package/components/Avatar/AvatarGroup/AvatarGroup.tsx +0 -32
- package/components/Avatar/AvatarGroup/AvatarGroup.types.ts +0 -8
- package/components/Avatar/index.ts +0 -4
- package/components/Badge/Badge.stories.tsx +0 -72
- package/components/Badge/Badge.tsx +0 -169
- package/components/Badge/Badge.types.ts +0 -3
- package/components/Badge/index.ts +0 -2
- package/components/Breadcrumbs/BreadcrumbEllipsis.tsx +0 -47
- package/components/Breadcrumbs/BreadcrumbEllipsis.types.ts +0 -5
- package/components/Breadcrumbs/BreadcrumbItem.tsx +0 -23
- package/components/Breadcrumbs/BreadcrumbItem.types.ts +0 -3
- package/components/Breadcrumbs/BreadcrumbLink.tsx +0 -30
- package/components/Breadcrumbs/BreadcrumbLink.types.ts +0 -3
- package/components/Breadcrumbs/BreadcrumbSeparator.tsx +0 -41
- package/components/Breadcrumbs/BreadcrumbSeparator.types.ts +0 -9
- package/components/Breadcrumbs/Breadcrumbs.tsx +0 -28
- package/components/Breadcrumbs/Breadcrumbs.types.ts +0 -6
- package/components/Breadcrumbs/index.ts +0 -10
- package/components/Button/Button.tsx +0 -72
- package/components/Button/Button.types.ts +0 -7
- package/components/Button/index.ts +0 -2
- package/components/Card/Card.tsx +0 -15
- package/components/Card/Card.types.ts +0 -3
- package/components/Card/index.ts +0 -2
- package/components/Checkbox/Checkbox.tsx +0 -122
- package/components/Checkbox/Checkbox.types.ts +0 -15
- package/components/Checkbox/index.ts +0 -2
- package/components/Collapsible/Collapsible.tsx +0 -34
- package/components/Collapsible/Collapsible.types.ts +0 -5
- package/components/Collapsible/CollapsibleTrigger.tsx +0 -57
- package/components/Collapsible/CollapsibleTrigger.types.ts +0 -14
- package/components/Collapsible/index.ts +0 -10
- package/components/Container/Container.tsx +0 -26
- package/components/Container/Container.types.ts +0 -3
- package/components/Container/index.ts +0 -2
- package/components/ContextMenu/ContextMenu.tsx +0 -74
- package/components/ContextMenu/ContextMenu.types.ts +0 -17
- package/components/ContextMenu/index.ts +0 -2
- package/components/CreditCardExpirationInput/CreditCardExpirationInput.tsx +0 -115
- package/components/CreditCardExpirationInput/CreditCardExpirationInput.types.ts +0 -10
- package/components/CreditCardExpirationInput/index.ts +0 -2
- package/components/CreditCardInput/CreditCardInput.tsx +0 -147
- package/components/CreditCardInput/CreditCardInput.types.ts +0 -12
- package/components/CreditCardInput/index.ts +0 -2
- package/components/DateInput/DateInput.tsx +0 -81
- package/components/DateInput/DateInput.types.ts +0 -15
- package/components/DateInput/index.ts +0 -2
- package/components/DateTimeFormat/DateTimeFormat.tsx +0 -16
- package/components/DateTimeFormat/DateTimeFormat.types.ts +0 -7
- package/components/DateTimeFormat/index.ts +0 -2
- package/components/Dialog/Dialog.tsx +0 -65
- package/components/Dialog/Dialog.types.ts +0 -9
- package/components/Dialog/index.ts +0 -2
- package/components/DialogTrigger/DialogTrigger.tsx +0 -45
- package/components/DialogTrigger/DialogTrigger.types.ts +0 -6
- package/components/DialogTrigger/index.ts +0 -5
- package/components/Divider/Divider.stories.tsx +0 -37
- package/components/Divider/Divider.tsx +0 -34
- package/components/Divider/Divider.types.ts +0 -5
- package/components/Divider/index.ts +0 -2
- package/components/DobInput/DobInput.tsx +0 -120
- package/components/DobInput/index.ts +0 -2
- package/components/Drawer/Drawer.tsx +0 -126
- package/components/Drawer/Drawer.types.ts +0 -11
- package/components/Drawer/index.ts +0 -2
- package/components/Icon/Account.tsx +0 -50
- package/components/Icon/Cart.tsx +0 -43
- package/components/Icon/Checkmark.tsx +0 -34
- package/components/Icon/Cross.tsx +0 -36
- package/components/Icon/DownArrow.tsx +0 -23
- package/components/Icon/Hamburger.tsx +0 -23
- package/components/Icon/Icon.types.ts +0 -8
- package/components/Icon/LinkArrow.tsx +0 -32
- package/components/Icon/Minus.tsx +0 -20
- package/components/Icon/Plus.tsx +0 -20
- package/components/Icon/Search.tsx +0 -36
- package/components/Icon/Trash.tsx +0 -27
- package/components/Icon/Verified.tsx +0 -20
- package/components/Icon/index.ts +0 -14
- package/components/Image/Image.tsx +0 -32
- package/components/Image/index.ts +0 -2
- package/components/Input/Input.tsx +0 -109
- package/components/Input/Input.types.ts +0 -17
- package/components/Input/index.ts +0 -2
- package/components/Link/Link.stories.tsx +0 -96
- package/components/Link/Link.tsx +0 -39
- package/components/Link/Link.types.ts +0 -3
- package/components/Link/index.ts +0 -2
- package/components/Loader/CircularEasing.tsx +0 -66
- package/components/Loader/CircularEasing.types.ts +0 -8
- package/components/Loader/Pulse.tsx +0 -45
- package/components/Loader/Pulse.types.ts +0 -5
- package/components/Loader/index.ts +0 -4
- package/components/Menu/ContextMenu.tsx +0 -83
- package/components/Menu/Menu.tsx +0 -143
- package/components/Menu/Menu.types.ts +0 -44
- package/components/Menu/index.ts +0 -4
- package/components/Meter/Meter.stories.tsx +0 -111
- package/components/Meter/Meter.tsx +0 -68
- package/components/Meter/Meter.types.ts +0 -10
- package/components/Meter/index.ts +0 -2
- package/components/Modal/Modal.tsx +0 -16
- package/components/Modal/Modal.types.ts +0 -6
- package/components/Modal/index.ts +0 -2
- package/components/ModalOverlay/ModalOverlay.tsx +0 -121
- package/components/ModalOverlay/ModalOverlay.types.ts +0 -18
- package/components/ModalOverlay/index.ts +0 -2
- package/components/NumberFormat/NumberFormat.tsx +0 -19
- package/components/NumberFormat/NumberFormat.types.ts +0 -8
- package/components/NumberFormat/index.ts +0 -2
- package/components/NumberInput/NumberInput.tsx +0 -164
- package/components/NumberInput/NumberInput.types.ts +0 -22
- package/components/NumberInput/index.ts +0 -2
- package/components/NumberTicker/DigitResolver.tsx +0 -119
- package/components/NumberTicker/DigitResolver.types.ts +0 -18
- package/components/NumberTicker/NumberTicker.tsx +0 -56
- package/components/NumberTicker/NumberTicker.types.ts +0 -96
- package/components/NumberTicker/hooks/useColumnTransition.ts +0 -36
- package/components/NumberTicker/hooks/useNumberDelta.ts +0 -19
- package/components/NumberTicker/hooks/useNumberTicker.ts +0 -36
- package/components/NumberTicker/index.ts +0 -10
- package/components/Pagination/Pagination.tsx +0 -44
- package/components/Pagination/index.ts +0 -2
- package/components/PasswordCheck/PasswordCheck.tsx +0 -59
- package/components/PasswordCheck/PasswordCheck.types.ts +0 -4
- package/components/PasswordCheck/PasswordCheck.utils.ts +0 -47
- package/components/PasswordCheck/index.ts +0 -2
- package/components/PhoneInput/PhoneInput.tsx +0 -191
- package/components/PhoneInput/index.ts +0 -2
- package/components/PinInput/PinInput.tsx +0 -314
- package/components/PinInput/PinInput.types.ts +0 -21
- package/components/PinInput/index.ts +0 -2
- package/components/Progressbar/CircularProgressbar.tsx +0 -71
- package/components/Progressbar/CircularProgressbar.types.ts +0 -10
- package/components/Progressbar/LinearProgressbar.tsx +0 -75
- package/components/Progressbar/LinearProgressbar.types.ts +0 -11
- package/components/Progressbar/index.ts +0 -4
- package/components/Radio/Radio.tsx +0 -88
- package/components/Radio/Radio.types.ts +0 -16
- package/components/Radio/index.ts +0 -2
- package/components/RadioGroup/RadioGroup.tsx +0 -49
- package/components/RadioGroup/RadioGroup.types.ts +0 -7
- package/components/RadioGroup/index.ts +0 -2
- package/components/Select/Option.tsx +0 -32
- package/components/Select/Option.types.ts +0 -3
- package/components/Select/Select.tsx +0 -272
- package/components/Select/Select.types.ts +0 -48
- package/components/Select/index.ts +0 -8
- package/components/Skeleton/Skeleton.tsx +0 -15
- package/components/Skeleton/Skeleton.types.ts +0 -3
- package/components/Skeleton/index.ts +0 -2
- package/components/Slider/Slider.tsx +0 -110
- package/components/Slider/Slider.types.ts +0 -11
- package/components/Slider/index.ts +0 -2
- package/components/Switch/Switch.tsx +0 -63
- package/components/Switch/Switch.types.ts +0 -8
- package/components/Switch/index.ts +0 -2
- package/components/Table/Table.tsx +0 -52
- package/components/Table/Table.types.ts +0 -22
- package/components/Table/index.ts +0 -2
- package/components/Tabs/Tab.tsx +0 -118
- package/components/Tabs/Tab.types.ts +0 -10
- package/components/Tabs/TabList.tsx +0 -51
- package/components/Tabs/TabList.types.ts +0 -12
- package/components/Tabs/TabPanel.tsx +0 -19
- package/components/Tabs/TabPanel.types.ts +0 -3
- package/components/Tabs/Tabs.context.tsx +0 -9
- package/components/Tabs/Tabs.tsx +0 -39
- package/components/Tabs/Tabs.types.ts +0 -3
- package/components/Tabs/index.ts +0 -9
- package/components/TimeInput/TimeInput.stories.tsx +0 -125
- package/components/TimeInput/TimeInput.tsx +0 -81
- package/components/TimeInput/TimeInput.types.ts +0 -15
- package/components/TimeInput/index.ts +0 -2
- package/components/ToggleButton/ToggleButton.stories.tsx +0 -89
- package/components/ToggleButton/ToggleButton.tsx +0 -69
- package/components/ToggleButton/ToggleButton.types.ts +0 -6
- package/components/ToggleButton/index.ts +0 -2
- package/components/Tooltip/Tooltip.tsx +0 -59
- package/components/Tooltip/Tooltip.types.ts +0 -3
- package/components/Tooltip/index.ts +0 -2
- package/components/UploadImage/UploadImage.tsx +0 -206
- package/components/UploadImage/UploadImage.types.ts +0 -15
- package/components/UploadImage/index.ts +0 -2
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { forwardRef } from 'react';
|
|
4
|
-
import type { Ref, ReactNode } from 'react';
|
|
5
|
-
import { Dialog as AriaDialog } from 'react-aria-components';
|
|
6
|
-
import { motion } from 'framer-motion';
|
|
7
|
-
import { cn } from '../../utils/cn';
|
|
8
|
-
import type { DialogProps } from './Dialog.types';
|
|
9
|
-
|
|
10
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
11
|
-
const ForwardedDialog = forwardRef<HTMLElement, any>(
|
|
12
|
-
({ style, animationVariants, ...props }, ref: Ref<HTMLElement>) => {
|
|
13
|
-
// Separate the dynamic style logic
|
|
14
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call
|
|
15
|
-
const ariaStyle = typeof style === 'function' ? style(props) : style;
|
|
16
|
-
|
|
17
|
-
return (
|
|
18
|
-
// Pass only static styles to framer-motion
|
|
19
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, react/jsx-props-no-spreading
|
|
20
|
-
<AriaDialog {...props} ref={ref} style={ariaStyle} />
|
|
21
|
-
);
|
|
22
|
-
}
|
|
23
|
-
);
|
|
24
|
-
|
|
25
|
-
const MotionDialog = motion.create(ForwardedDialog);
|
|
26
|
-
|
|
27
|
-
export function Dialog({
|
|
28
|
-
className,
|
|
29
|
-
children,
|
|
30
|
-
animationVariants,
|
|
31
|
-
...props
|
|
32
|
-
}: DialogProps) {
|
|
33
|
-
return (
|
|
34
|
-
<MotionDialog
|
|
35
|
-
className={cn(
|
|
36
|
-
'p-8 outline-0 max-w-max w-screen absolute top-2/4 left-2/4',
|
|
37
|
-
'shadow-[0_8px_24px_rgba(0,0,0,0.1)] rounded-lg bg-white border border-solid border-slate-400',
|
|
38
|
-
'transform -translate-x-1/2 -translate-y-1/2',
|
|
39
|
-
className
|
|
40
|
-
)}
|
|
41
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
42
|
-
{...props}
|
|
43
|
-
variants={
|
|
44
|
-
animationVariants || {
|
|
45
|
-
hidden: {
|
|
46
|
-
transform: 'translate(-50%, -50%) scale(0.8)',
|
|
47
|
-
transition: {
|
|
48
|
-
ease: 'backIn',
|
|
49
|
-
},
|
|
50
|
-
},
|
|
51
|
-
visible: {
|
|
52
|
-
transform: 'translate(-50%, -50%) scale(1)',
|
|
53
|
-
transition: {
|
|
54
|
-
ease: 'backOut',
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
>
|
|
60
|
-
{children as ReactNode}
|
|
61
|
-
</MotionDialog>
|
|
62
|
-
);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export default Dialog;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { Key } from 'react';
|
|
2
|
-
import type { DialogProps as UIDialogProps } from 'react-aria-components';
|
|
3
|
-
import { MotionStyle, Variants } from 'framer-motion';
|
|
4
|
-
|
|
5
|
-
export type DialogProps = Omit<UIDialogProps, 'onAnimationStart'> & {
|
|
6
|
-
key?: Key;
|
|
7
|
-
style?: MotionStyle;
|
|
8
|
-
animationVariants?: Variants;
|
|
9
|
-
};
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { createContext, useState, useMemo, useContext } from 'react';
|
|
4
|
-
import type { Dispatch, SetStateAction } from 'react';
|
|
5
|
-
import { DialogTrigger as UIDialogTrigger } from 'react-aria-components';
|
|
6
|
-
import type { DialogTriggerProps } from 'react-aria-components';
|
|
7
|
-
import type { DriverAnimationState } from './DialogTrigger.types';
|
|
8
|
-
|
|
9
|
-
const DialogTriggerContext = createContext<{
|
|
10
|
-
animation: DriverAnimationState;
|
|
11
|
-
setAnimation: Dispatch<SetStateAction<DriverAnimationState>>;
|
|
12
|
-
onOpenChange: (isOpen: boolean) => void;
|
|
13
|
-
}>({
|
|
14
|
-
animation: 'unmounted',
|
|
15
|
-
setAnimation: () => {},
|
|
16
|
-
onOpenChange: () => {},
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
export const useDialogTrigger = () => useContext(DialogTriggerContext);
|
|
20
|
-
|
|
21
|
-
export function DialogTrigger(props: DialogTriggerProps) {
|
|
22
|
-
const [animation, setAnimation] = useState<DriverAnimationState>('unmounted');
|
|
23
|
-
|
|
24
|
-
const onOpenChange = (isOpen: boolean) => {
|
|
25
|
-
setAnimation(isOpen ? 'visible' : 'hidden');
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
const value = useMemo(
|
|
29
|
-
() => ({
|
|
30
|
-
animation,
|
|
31
|
-
setAnimation,
|
|
32
|
-
onOpenChange,
|
|
33
|
-
}),
|
|
34
|
-
[animation]
|
|
35
|
-
);
|
|
36
|
-
|
|
37
|
-
return (
|
|
38
|
-
<DialogTriggerContext.Provider value={value}>
|
|
39
|
-
{/* eslint-disable-next-line react/jsx-props-no-spreading */}
|
|
40
|
-
<UIDialogTrigger {...props} onOpenChange={onOpenChange} />
|
|
41
|
-
</DialogTriggerContext.Provider>
|
|
42
|
-
);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export default DialogTrigger;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { DialogTriggerProps as UIDialogTriggerProps } from 'react-aria-components';
|
|
2
|
-
|
|
3
|
-
/** @todo this feels like it should be renamed, maybe moved to modal directly */
|
|
4
|
-
export type DriverAnimationState = 'unmounted' | 'visible' | 'hidden';
|
|
5
|
-
|
|
6
|
-
export type DialogTriggerProps = UIDialogTriggerProps;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
import { SeparatorProps } from 'react-aria';
|
|
3
|
-
import { Divider } from './Divider';
|
|
4
|
-
|
|
5
|
-
type Story = StoryObj<typeof Divider>;
|
|
6
|
-
|
|
7
|
-
function Component(props: SeparatorProps) {
|
|
8
|
-
const { orientation } = props;
|
|
9
|
-
const display = orientation === 'vertical' ? 'flex' : 'block';
|
|
10
|
-
|
|
11
|
-
return (
|
|
12
|
-
<div style={{ display }}>
|
|
13
|
-
<div>Lorem ipsum dolor sit amet consectetur, adipisicing elit.</div>
|
|
14
|
-
{/* eslint-disable-next-line react/jsx-props-no-spreading */}
|
|
15
|
-
<Divider {...props} />
|
|
16
|
-
<div>Lorem ipsum dolor sit amet consectetur, adipisicing elit.</div>
|
|
17
|
-
</div>
|
|
18
|
-
);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const meta: Meta<typeof Divider> = {
|
|
22
|
-
component: Component,
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export default meta;
|
|
26
|
-
|
|
27
|
-
export const Example: Story = {
|
|
28
|
-
argTypes: {
|
|
29
|
-
orientation: {
|
|
30
|
-
options: ['horizontal', 'vertical'],
|
|
31
|
-
control: 'select',
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
args: {
|
|
35
|
-
orientation: 'horizontal',
|
|
36
|
-
},
|
|
37
|
-
};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { useSeparator } from 'react-aria';
|
|
4
|
-
import { cn } from '../../utils/cn';
|
|
5
|
-
import type { DividerProps } from './Divider.types';
|
|
6
|
-
|
|
7
|
-
export function Divider({
|
|
8
|
-
orientation = 'horizontal',
|
|
9
|
-
className,
|
|
10
|
-
...props
|
|
11
|
-
}: DividerProps) {
|
|
12
|
-
const { separatorProps } = useSeparator({ ...props, orientation });
|
|
13
|
-
const combinedProps = { ...props, ...separatorProps };
|
|
14
|
-
|
|
15
|
-
return (
|
|
16
|
-
<div
|
|
17
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
18
|
-
{...combinedProps}
|
|
19
|
-
className={cn(
|
|
20
|
-
'bg-slate-200',
|
|
21
|
-
['w-full', 'h-px', 'my-4', 'mx-0'],
|
|
22
|
-
[
|
|
23
|
-
'aria-[orientation=vertical]:w-px',
|
|
24
|
-
'aria-[orientation=vertical]:h-auto',
|
|
25
|
-
'aria-[orientation=vertical]:my-0',
|
|
26
|
-
'aria-[orientation=vertical]:mx-4',
|
|
27
|
-
],
|
|
28
|
-
className
|
|
29
|
-
)}
|
|
30
|
-
/>
|
|
31
|
-
);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export default Divider;
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { useEffect, useId, useState } from 'react';
|
|
4
|
-
import { FieldError, Input, Label, TextField } from 'react-aria-components';
|
|
5
|
-
import {
|
|
6
|
-
type InputAttributes,
|
|
7
|
-
NumberFormatBase,
|
|
8
|
-
type NumberFormatValues,
|
|
9
|
-
} from 'react-number-format';
|
|
10
|
-
import { cn } from '../../utils/cn';
|
|
11
|
-
// import { ErrorMessage } from '../ErrorMessage';
|
|
12
|
-
// import { FieldLabel } from '../FieldLabel';
|
|
13
|
-
import type { InputProps } from '../Input/Input.types';
|
|
14
|
-
// import { inputBaseClasses } from '../Input/Input';
|
|
15
|
-
|
|
16
|
-
function AriaInput({ className, ...props }: InputAttributes) {
|
|
17
|
-
return (
|
|
18
|
-
<Input
|
|
19
|
-
className={cn('peer h-11', /** inputBaseClasses, */ className)}
|
|
20
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
21
|
-
{...props}
|
|
22
|
-
/>
|
|
23
|
-
);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export function DobInput({
|
|
27
|
-
label,
|
|
28
|
-
description,
|
|
29
|
-
errorMessage,
|
|
30
|
-
type,
|
|
31
|
-
className,
|
|
32
|
-
classNames,
|
|
33
|
-
// inputProps,
|
|
34
|
-
id,
|
|
35
|
-
value,
|
|
36
|
-
onChange,
|
|
37
|
-
...props
|
|
38
|
-
}: InputProps) {
|
|
39
|
-
const inputId = useId();
|
|
40
|
-
const [inputValue, setInputValue] = useState(value || '');
|
|
41
|
-
|
|
42
|
-
useEffect(() => {
|
|
43
|
-
setInputValue(value || '');
|
|
44
|
-
}, [value]);
|
|
45
|
-
|
|
46
|
-
const format = (val: string) => {
|
|
47
|
-
if (val === '') return '';
|
|
48
|
-
const cleanedVal = val.replace(/\s+/g, '');
|
|
49
|
-
const cardFormat = '##-##-####';
|
|
50
|
-
|
|
51
|
-
let formattedVal = '';
|
|
52
|
-
let position = 0;
|
|
53
|
-
|
|
54
|
-
for (let i = 0; i < cardFormat.length; i += 1) {
|
|
55
|
-
if (cardFormat[i] === '#') {
|
|
56
|
-
if (position < cleanedVal.length) {
|
|
57
|
-
formattedVal += cleanedVal[position];
|
|
58
|
-
position += 1;
|
|
59
|
-
} else {
|
|
60
|
-
break;
|
|
61
|
-
}
|
|
62
|
-
} else {
|
|
63
|
-
formattedVal += cardFormat[i];
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
return formattedVal;
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
const handleValueChange = (values: NumberFormatValues) => {
|
|
71
|
-
setInputValue(values.formattedValue);
|
|
72
|
-
if (onChange) {
|
|
73
|
-
onChange(values.formattedValue);
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
return (
|
|
78
|
-
<TextField
|
|
79
|
-
className={cn('flex flex-col w-full text-slate-900', className)}
|
|
80
|
-
type={type}
|
|
81
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
82
|
-
{...props}
|
|
83
|
-
>
|
|
84
|
-
<Label
|
|
85
|
-
className={cn('flex text-slate-500 text-xs', classNames?.label)}
|
|
86
|
-
htmlFor={id || inputId}
|
|
87
|
-
>
|
|
88
|
-
{label}
|
|
89
|
-
</Label>
|
|
90
|
-
<NumberFormatBase
|
|
91
|
-
id={id || inputId}
|
|
92
|
-
value={inputValue}
|
|
93
|
-
format={format}
|
|
94
|
-
customInput={AriaInput}
|
|
95
|
-
className={cn(
|
|
96
|
-
'border-solid border border-slate-300 rounded-md',
|
|
97
|
-
'text-sm text-slate-900 placeholder-slate-400',
|
|
98
|
-
'h-10 px-2 py-0 m-0 w-full',
|
|
99
|
-
'bg-white',
|
|
100
|
-
'transition-all duration-200 ease-in-out',
|
|
101
|
-
'hover:border-slate-400',
|
|
102
|
-
'focus:outline-2 focus:outline focus:outline-slate-200 focus:border-slate-400',
|
|
103
|
-
'disabled:border-slate-200 disabled:bg-slate-100',
|
|
104
|
-
'invalid:border-red-500 invalid:bg-red-100 invalid:text-red-600',
|
|
105
|
-
'invalid:hover:border-red-600 invalid:focus:border-red-600 invalid:focus:outline-red-200',
|
|
106
|
-
classNames?.input
|
|
107
|
-
)}
|
|
108
|
-
onValueChange={handleValueChange}
|
|
109
|
-
/>
|
|
110
|
-
|
|
111
|
-
{errorMessage && (
|
|
112
|
-
<FieldError className={cn(classNames?.error)}>
|
|
113
|
-
{errorMessage}
|
|
114
|
-
</FieldError>
|
|
115
|
-
)}
|
|
116
|
-
</TextField>
|
|
117
|
-
);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
export default DobInput;
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { forwardRef } from 'react';
|
|
4
|
-
import type { Ref, ReactNode, CSSProperties } from 'react';
|
|
5
|
-
import { Dialog } from 'react-aria-components';
|
|
6
|
-
import { motion } from 'framer-motion';
|
|
7
|
-
import { cn } from '../../utils/cn';
|
|
8
|
-
import type { DrawerProps } from './Drawer.types';
|
|
9
|
-
|
|
10
|
-
const directionAnimatation = {
|
|
11
|
-
top: {
|
|
12
|
-
hidden: {
|
|
13
|
-
y: '-100%',
|
|
14
|
-
transition: {
|
|
15
|
-
ease: 'easeIn',
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
visible: {
|
|
19
|
-
y: 0,
|
|
20
|
-
transition: {
|
|
21
|
-
ease: 'easeOut',
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
bottom: {
|
|
26
|
-
hidden: {
|
|
27
|
-
y: '100%',
|
|
28
|
-
transition: {
|
|
29
|
-
ease: 'easeIn',
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
visible: {
|
|
33
|
-
y: 0,
|
|
34
|
-
transition: {
|
|
35
|
-
ease: 'easeOut',
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
right: {
|
|
40
|
-
hidden: {
|
|
41
|
-
x: '100%',
|
|
42
|
-
transition: {
|
|
43
|
-
ease: 'easeIn',
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
visible: {
|
|
47
|
-
x: 0,
|
|
48
|
-
transition: {
|
|
49
|
-
ease: 'easeOut',
|
|
50
|
-
},
|
|
51
|
-
},
|
|
52
|
-
},
|
|
53
|
-
left: {
|
|
54
|
-
hidden: {
|
|
55
|
-
x: '-100%',
|
|
56
|
-
transition: {
|
|
57
|
-
ease: 'easeIn',
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
visible: {
|
|
61
|
-
x: 0,
|
|
62
|
-
transition: {
|
|
63
|
-
ease: 'easeOut',
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
|
-
},
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
70
|
-
const ForwardedDialog = forwardRef<HTMLElement, any>(
|
|
71
|
-
({ style, size = '20rem', ...props }, ref: Ref<HTMLElement>) => {
|
|
72
|
-
// Separate the dynamic style logic
|
|
73
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
74
|
-
const ariaStyle =
|
|
75
|
-
typeof style === 'function'
|
|
76
|
-
? // eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
|
77
|
-
style(props)
|
|
78
|
-
: ({
|
|
79
|
-
...style,
|
|
80
|
-
'--drawer-size': `${size as string}`,
|
|
81
|
-
} as CSSProperties);
|
|
82
|
-
|
|
83
|
-
return (
|
|
84
|
-
// Pass only static styles to framer-motion
|
|
85
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, react/jsx-props-no-spreading
|
|
86
|
-
<Dialog {...props} ref={ref} style={ariaStyle} />
|
|
87
|
-
);
|
|
88
|
-
}
|
|
89
|
-
);
|
|
90
|
-
|
|
91
|
-
const MotionDrawer = motion.create(ForwardedDialog);
|
|
92
|
-
|
|
93
|
-
export function Drawer({
|
|
94
|
-
direction = 'right',
|
|
95
|
-
children,
|
|
96
|
-
className,
|
|
97
|
-
animationVariants,
|
|
98
|
-
...props
|
|
99
|
-
}: DrawerProps) {
|
|
100
|
-
return (
|
|
101
|
-
<MotionDrawer
|
|
102
|
-
className={cn(
|
|
103
|
-
'fixed p-8 outline-0 bg-white',
|
|
104
|
-
'border-solid border-slate-200',
|
|
105
|
-
'max-w-full max-h-[var(--visual-viewport-height)]',
|
|
106
|
-
direction === 'top' &&
|
|
107
|
-
'top-0 left-0 right-0 bottom-auto border-b shadow-[0_8px_24px_rgba(0,0,0,0.1)] h-[var(--drawer-size)]',
|
|
108
|
-
direction === 'right' &&
|
|
109
|
-
'top-0 left-auto bottom-0 right-0 border-l shadow-[-8px_0_24px_rgba(0,0,0,0.1)] w-[var(--drawer-size)]',
|
|
110
|
-
direction === 'bottom' &&
|
|
111
|
-
'bottom-0 left-0 right-0 top-auto border-t shadow-[0_-8px_24px_rgba(0,0,0,0.1)] h-[var(--drawer-size)]',
|
|
112
|
-
direction === 'left' &&
|
|
113
|
-
'top-0 bottom-0 left-0 right-auto border-r shadow-[8px_0_24px_rgba(0,0,0,0.1)] w-[var(--drawer-size)]',
|
|
114
|
-
className
|
|
115
|
-
)}
|
|
116
|
-
data-direction={direction}
|
|
117
|
-
variants={animationVariants || directionAnimatation[direction]}
|
|
118
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
119
|
-
{...props}
|
|
120
|
-
>
|
|
121
|
-
{children as ReactNode}
|
|
122
|
-
</MotionDrawer>
|
|
123
|
-
);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
export default Drawer;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { Key } from 'react';
|
|
2
|
-
import type { DialogProps } from 'react-aria-components';
|
|
3
|
-
import type { MotionStyle, Variants } from 'framer-motion';
|
|
4
|
-
|
|
5
|
-
export type DrawerProps = Omit<DialogProps, 'onAnimationStart'> & {
|
|
6
|
-
direction?: 'top' | 'right' | 'bottom' | 'left';
|
|
7
|
-
key?: Key;
|
|
8
|
-
style?: MotionStyle;
|
|
9
|
-
animationVariants?: Variants;
|
|
10
|
-
size?: string;
|
|
11
|
-
};
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { cn } from '../../utils/cn';
|
|
4
|
-
import type { IconProps } from './Icon.types';
|
|
5
|
-
|
|
6
|
-
export function Account({ className, ...rest }: IconProps) {
|
|
7
|
-
return (
|
|
8
|
-
<svg
|
|
9
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
10
|
-
width="20"
|
|
11
|
-
height="20"
|
|
12
|
-
viewBox="0 0 20 20"
|
|
13
|
-
fill="none"
|
|
14
|
-
className={cn(className)}
|
|
15
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
16
|
-
{...rest}
|
|
17
|
-
>
|
|
18
|
-
<g clipPath="url(#clip0_283_14902)">
|
|
19
|
-
<path
|
|
20
|
-
d="M15 16.668C15 15.3419 14.4732 14.0701 13.5355 13.1324C12.5979 12.1948 11.3261 11.668 10 11.668C8.67392 11.668 7.40215 12.1948 6.46447 13.1324C5.52678 14.0701 5 15.3419 5 16.668"
|
|
21
|
-
stroke="#20293A"
|
|
22
|
-
strokeWidth="1.5"
|
|
23
|
-
strokeLinecap="round"
|
|
24
|
-
strokeLinejoin="round"
|
|
25
|
-
/>
|
|
26
|
-
<path
|
|
27
|
-
d="M9.99996 11.6667C11.8409 11.6667 13.3333 10.1743 13.3333 8.33333C13.3333 6.49238 11.8409 5 9.99996 5C8.15901 5 6.66663 6.49238 6.66663 8.33333C6.66663 10.1743 8.15901 11.6667 9.99996 11.6667Z"
|
|
28
|
-
stroke="#20293A"
|
|
29
|
-
strokeWidth="1.5"
|
|
30
|
-
strokeLinecap="round"
|
|
31
|
-
strokeLinejoin="round"
|
|
32
|
-
/>
|
|
33
|
-
<path
|
|
34
|
-
d="M10.0001 18.3346C14.6025 18.3346 18.3334 14.6037 18.3334 10.0013C18.3334 5.39893 14.6025 1.66797 10.0001 1.66797C5.39771 1.66797 1.66675 5.39893 1.66675 10.0013C1.66675 14.6037 5.39771 18.3346 10.0001 18.3346Z"
|
|
35
|
-
stroke="#20293A"
|
|
36
|
-
strokeWidth="1.5"
|
|
37
|
-
strokeLinecap="round"
|
|
38
|
-
strokeLinejoin="round"
|
|
39
|
-
/>
|
|
40
|
-
</g>
|
|
41
|
-
<defs>
|
|
42
|
-
<clipPath id="clip0_283_14902">
|
|
43
|
-
<rect width="20" height="20" fill="white" />
|
|
44
|
-
</clipPath>
|
|
45
|
-
</defs>
|
|
46
|
-
</svg>
|
|
47
|
-
);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export default Account;
|
package/components/Icon/Cart.tsx
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { cn } from '../../utils/cn';
|
|
4
|
-
import type { IconProps } from './Icon.types';
|
|
5
|
-
|
|
6
|
-
export function Cart({ className, ...rest }: IconProps) {
|
|
7
|
-
return (
|
|
8
|
-
<svg
|
|
9
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
10
|
-
width="20"
|
|
11
|
-
height="20"
|
|
12
|
-
viewBox="0 0 20 20"
|
|
13
|
-
fill="none"
|
|
14
|
-
className={cn(className)}
|
|
15
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
16
|
-
{...rest}
|
|
17
|
-
>
|
|
18
|
-
<path
|
|
19
|
-
d="M5 1.66797L2.5 5.0013V16.668C2.5 17.11 2.67559 17.5339 2.98816 17.8465C3.30072 18.159 3.72464 18.3346 4.16667 18.3346H15.8333C16.2754 18.3346 16.6993 18.159 17.0118 17.8465C17.3244 17.5339 17.5 17.11 17.5 16.668V5.0013L15 1.66797H5Z"
|
|
20
|
-
stroke="#20293A"
|
|
21
|
-
strokeWidth="1.5"
|
|
22
|
-
strokeLinecap="round"
|
|
23
|
-
strokeLinejoin="round"
|
|
24
|
-
/>
|
|
25
|
-
<path
|
|
26
|
-
d="M2.5 5H17.5"
|
|
27
|
-
stroke="#20293A"
|
|
28
|
-
strokeWidth="1.5"
|
|
29
|
-
strokeLinecap="round"
|
|
30
|
-
strokeLinejoin="round"
|
|
31
|
-
/>
|
|
32
|
-
<path
|
|
33
|
-
d="M13.3334 8.33203C13.3334 9.21609 12.9822 10.0639 12.3571 10.6891C11.732 11.3142 10.8841 11.6654 10.0001 11.6654C9.11603 11.6654 8.26818 11.3142 7.64306 10.6891C7.01794 10.0639 6.66675 9.21609 6.66675 8.33203"
|
|
34
|
-
stroke="#20293A"
|
|
35
|
-
strokeWidth="1.5"
|
|
36
|
-
strokeLinecap="round"
|
|
37
|
-
strokeLinejoin="round"
|
|
38
|
-
/>
|
|
39
|
-
</svg>
|
|
40
|
-
);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export default Cart;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
export function Checkmark() {
|
|
4
|
-
return (
|
|
5
|
-
<svg
|
|
6
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
7
|
-
viewBox="0 0 52 52"
|
|
8
|
-
strokeWidth="5"
|
|
9
|
-
strokeMiterlimit="10"
|
|
10
|
-
className="w-6 h-6 rounded-full block stroke-[#20293A] animate-[CheckMarkFill_0.4s_ease-in-out_0.4s_forwards,CheckMarkScale_0.3s_ease-in-out_0.9s_both]"
|
|
11
|
-
>
|
|
12
|
-
<circle
|
|
13
|
-
cx="26"
|
|
14
|
-
cy="26"
|
|
15
|
-
r="25"
|
|
16
|
-
fill="none"
|
|
17
|
-
strokeDasharray="166"
|
|
18
|
-
strokeDashoffset="166"
|
|
19
|
-
strokeWidth="5"
|
|
20
|
-
strokeMiterlimit="10"
|
|
21
|
-
className="animate-[CheckMarkStroke_0.6s_cubic-bezier(0.65,0,0.45,1)_forwards] stroke-[#20293A]"
|
|
22
|
-
/>
|
|
23
|
-
<path
|
|
24
|
-
fill="none"
|
|
25
|
-
d="M14.1 27.2l7.1 7.2 16.7-16.8"
|
|
26
|
-
strokeDasharray="48"
|
|
27
|
-
strokeDashoffset="48"
|
|
28
|
-
className="animate-[CheckMarkStroke_0.3s_cubic-bezier(0.65,0,0.45,1)_0.8s_forwards] origin-[50%_50%]"
|
|
29
|
-
/>
|
|
30
|
-
</svg>
|
|
31
|
-
);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export default Checkmark;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { cn } from '../../utils/cn';
|
|
4
|
-
import type { IconProps } from './Icon.types';
|
|
5
|
-
|
|
6
|
-
export function Cross({ className, ...rest }: IconProps) {
|
|
7
|
-
return (
|
|
8
|
-
<svg
|
|
9
|
-
width="20"
|
|
10
|
-
height="20"
|
|
11
|
-
viewBox="0 0 16 16"
|
|
12
|
-
fill="none"
|
|
13
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
14
|
-
className={cn(className)}
|
|
15
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
16
|
-
{...rest}
|
|
17
|
-
>
|
|
18
|
-
<path
|
|
19
|
-
d="M12 4L4 12"
|
|
20
|
-
stroke="#20293A"
|
|
21
|
-
strokeWidth="1.5"
|
|
22
|
-
strokeLinecap="round"
|
|
23
|
-
strokeLinejoin="round"
|
|
24
|
-
/>
|
|
25
|
-
<path
|
|
26
|
-
d="M4 4L12 12"
|
|
27
|
-
stroke="#20293A"
|
|
28
|
-
strokeWidth="1.5"
|
|
29
|
-
strokeLinecap="round"
|
|
30
|
-
strokeLinejoin="round"
|
|
31
|
-
/>
|
|
32
|
-
</svg>
|
|
33
|
-
);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export default Cross;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { cn } from '../../utils/cn';
|
|
4
|
-
import type { IconProps } from './Icon.types';
|
|
5
|
-
|
|
6
|
-
export function DownArrow({ className, ...rest }: IconProps) {
|
|
7
|
-
return (
|
|
8
|
-
<svg
|
|
9
|
-
width="14"
|
|
10
|
-
height="8"
|
|
11
|
-
viewBox="0 0 14 8"
|
|
12
|
-
fill="none"
|
|
13
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
14
|
-
className={cn(className)}
|
|
15
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
16
|
-
{...rest}
|
|
17
|
-
>
|
|
18
|
-
<path d="M13 0.5L7 6.5L1 0.499999" stroke="currentColor" />
|
|
19
|
-
</svg>
|
|
20
|
-
);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export default DownArrow;
|