@ourtrip/ui 1.0.5 → 1.0.7
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/package.json +6 -5
- package/src/components/accordion.tsx +0 -52
- package/src/components/alert.tsx +0 -56
- package/src/components/badge.tsx +0 -84
- package/src/components/breadcrumbs.tsx +0 -48
- package/src/components/button.tsx +0 -187
- package/src/components/card.tsx +0 -23
- package/src/components/checkbox.tsx +0 -70
- package/src/components/collapse.tsx +0 -56
- package/src/components/divider.tsx +0 -28
- package/src/components/input.tsx +0 -105
- package/src/components/modal.tsx +0 -40
- package/src/components/phone.tsx +0 -104
- package/src/components/popover.tsx +0 -31
- package/src/components/radio.tsx +0 -44
- package/src/components/range.tsx +0 -54
- package/src/components/select.tsx +0 -160
- package/src/components/sheet.tsx +0 -140
- package/src/components/stars.tsx +0 -30
- package/src/components/step-marker.tsx +0 -49
- package/src/components/switch.tsx +0 -42
- package/src/components/tag.tsx +0 -52
- package/src/components/tooltip.tsx +0 -30
- package/src/index.tsx +0 -22
- package/src/utils/classes.ts +0 -2
- package/src/utils/validation.ts +0 -164
- package/tsconfig.json +0 -18
- package/webpack.config.js +0 -31
package/src/components/input.tsx
DELETED
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
/* eslint-disable no-param-reassign */
|
|
4
|
-
/* eslint-disable react-hooks/rules-of-hooks */
|
|
5
|
-
import React, {
|
|
6
|
-
DetailedHTMLProps,
|
|
7
|
-
InputHTMLAttributes,
|
|
8
|
-
forwardRef,
|
|
9
|
-
useRef
|
|
10
|
-
} from 'react';
|
|
11
|
-
|
|
12
|
-
interface IInput
|
|
13
|
-
extends DetailedHTMLProps<
|
|
14
|
-
InputHTMLAttributes<HTMLInputElement>,
|
|
15
|
-
HTMLInputElement
|
|
16
|
-
> {
|
|
17
|
-
label?: string;
|
|
18
|
-
dense?: boolean;
|
|
19
|
-
floating?: boolean;
|
|
20
|
-
border?: boolean;
|
|
21
|
-
color?: 'white' | 'gray';
|
|
22
|
-
error?: string;
|
|
23
|
-
focus?: Function;
|
|
24
|
-
mask?: Function;
|
|
25
|
-
hasInitialValue?: boolean;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const Input = forwardRef(
|
|
29
|
-
(
|
|
30
|
-
{
|
|
31
|
-
id,
|
|
32
|
-
label,
|
|
33
|
-
placeholder,
|
|
34
|
-
color = 'white',
|
|
35
|
-
dense,
|
|
36
|
-
floating,
|
|
37
|
-
border,
|
|
38
|
-
onChange,
|
|
39
|
-
onFocus,
|
|
40
|
-
onBlur,
|
|
41
|
-
focus,
|
|
42
|
-
error,
|
|
43
|
-
disabled,
|
|
44
|
-
...props
|
|
45
|
-
}: IInput,
|
|
46
|
-
ref: any
|
|
47
|
-
) => {
|
|
48
|
-
const inputRef = useRef<HTMLInputElement | null>(null);
|
|
49
|
-
|
|
50
|
-
return (
|
|
51
|
-
<div
|
|
52
|
-
aria-labelledby={id}
|
|
53
|
-
onClick={() => inputRef.current?.focus()}
|
|
54
|
-
className={`flex flex-col w-full ${props.className}`}
|
|
55
|
-
>
|
|
56
|
-
<div
|
|
57
|
-
onClick={() => {
|
|
58
|
-
if (ref?.current) {
|
|
59
|
-
ref.current?.focus();
|
|
60
|
-
} else {
|
|
61
|
-
focus?.();
|
|
62
|
-
}
|
|
63
|
-
}}
|
|
64
|
-
>
|
|
65
|
-
{label && (
|
|
66
|
-
<label htmlFor={id} className='mb-2 text-sm text-gray-500'>
|
|
67
|
-
{label}
|
|
68
|
-
</label>
|
|
69
|
-
)}
|
|
70
|
-
<input
|
|
71
|
-
id={id}
|
|
72
|
-
ref={e => {
|
|
73
|
-
if (typeof ref === 'function') ref(e);
|
|
74
|
-
else if (ref && typeof ref === 'object') ref.current = e;
|
|
75
|
-
inputRef.current = e;
|
|
76
|
-
}}
|
|
77
|
-
placeholder={placeholder}
|
|
78
|
-
autoComplete='off'
|
|
79
|
-
{...props}
|
|
80
|
-
disabled={disabled}
|
|
81
|
-
onChange={event => {
|
|
82
|
-
onChange?.(event);
|
|
83
|
-
}}
|
|
84
|
-
onFocus={event => {
|
|
85
|
-
onFocus?.(event);
|
|
86
|
-
}}
|
|
87
|
-
onBlur={e => {
|
|
88
|
-
onBlur?.(e);
|
|
89
|
-
}}
|
|
90
|
-
className={`${
|
|
91
|
-
color === 'white'
|
|
92
|
-
? 'bg-white disabled:bg-white'
|
|
93
|
-
: 'bg-gray-100 disabled:bg-gray-100'
|
|
94
|
-
} w-full rounded-button h-[50px] px-4 disabled:cursor-not-allowed placeholder-gray-500 text-primary-900 ${
|
|
95
|
-
props.className
|
|
96
|
-
}`}
|
|
97
|
-
/>
|
|
98
|
-
</div>
|
|
99
|
-
{error && <span className='text-sm text-red-600'>{error}</span>}
|
|
100
|
-
</div>
|
|
101
|
-
);
|
|
102
|
-
}
|
|
103
|
-
);
|
|
104
|
-
|
|
105
|
-
export default Input;
|
package/src/components/modal.tsx
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import React, { FC, ReactNode } from 'react';
|
|
4
|
-
|
|
5
|
-
interface IModalProps {
|
|
6
|
-
isOpen: boolean;
|
|
7
|
-
children: ReactNode;
|
|
8
|
-
showCloseButton?: boolean;
|
|
9
|
-
onClose?: Function;
|
|
10
|
-
closeOnClickOutside?: boolean;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const Modal: FC<IModalProps> = ({
|
|
14
|
-
isOpen,
|
|
15
|
-
children,
|
|
16
|
-
onClose,
|
|
17
|
-
showCloseButton = false
|
|
18
|
-
}) => {
|
|
19
|
-
|
|
20
|
-
return isOpen ? (
|
|
21
|
-
<div className='fixed top-0 left-0 w-full h-full bg-black/50 flex justify-center items-center'>
|
|
22
|
-
<div
|
|
23
|
-
className='bg-white rounded-default shadow-lg min-w-[350px] relative'
|
|
24
|
-
>
|
|
25
|
-
{showCloseButton ? (
|
|
26
|
-
<button
|
|
27
|
-
type='button'
|
|
28
|
-
className='absolute top-[10px] right-[10px] cursor-pointer'
|
|
29
|
-
onClick={() => onClose?.()}
|
|
30
|
-
>
|
|
31
|
-
Fechar
|
|
32
|
-
</button>
|
|
33
|
-
) : null}
|
|
34
|
-
<div className='modal-content'>{children}</div>
|
|
35
|
-
</div>
|
|
36
|
-
</div>
|
|
37
|
-
) : null;
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
export default Modal;
|
package/src/components/phone.tsx
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import Input from './input';
|
|
5
|
-
import { isValidDDD, isValidPhoneNumber } from '../utils/validation';
|
|
6
|
-
import {
|
|
7
|
-
FieldErrors,
|
|
8
|
-
FieldValues,
|
|
9
|
-
Path,
|
|
10
|
-
UseFormSetFocus
|
|
11
|
-
} from 'react-hook-form';
|
|
12
|
-
|
|
13
|
-
interface IPhoneInputProps<T extends FieldValues> {
|
|
14
|
-
t: any;
|
|
15
|
-
DDI?: string;
|
|
16
|
-
phoneDDIKey: Path<T>;
|
|
17
|
-
phoneAreaCodeKey: Path<T>;
|
|
18
|
-
phoneNumberKey: Path<T>;
|
|
19
|
-
registerWithMask: any;
|
|
20
|
-
setFocus: UseFormSetFocus<T>;
|
|
21
|
-
errors: FieldErrors<T>;
|
|
22
|
-
ddiClassName?: string;
|
|
23
|
-
areaCodeClassName?: string;
|
|
24
|
-
phoneClassName?: string;
|
|
25
|
-
requiredMessage?: string;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const PhoneInput = <T extends FieldValues>({
|
|
29
|
-
t,
|
|
30
|
-
DDI,
|
|
31
|
-
phoneDDIKey,
|
|
32
|
-
phoneAreaCodeKey,
|
|
33
|
-
phoneNumberKey,
|
|
34
|
-
registerWithMask,
|
|
35
|
-
setFocus,
|
|
36
|
-
errors,
|
|
37
|
-
ddiClassName,
|
|
38
|
-
areaCodeClassName,
|
|
39
|
-
phoneClassName,
|
|
40
|
-
requiredMessage
|
|
41
|
-
}: IPhoneInputProps<T>) => {
|
|
42
|
-
const host = typeof window !== 'undefined' ? window.location.host : '';
|
|
43
|
-
|
|
44
|
-
return (
|
|
45
|
-
<div className='w-full flex flex-col gap-1'>
|
|
46
|
-
<div className='flex flex-col md:flex-row gap-0.5'>
|
|
47
|
-
<Input
|
|
48
|
-
className={`flex-2 rounded-b-none md:rounded-r-none md:rounded-l-button ${ddiClassName}`}
|
|
49
|
-
placeholder={t('fieldsLabels.ddi')}
|
|
50
|
-
{...registerWithMask(phoneDDIKey, ['+9', '+99', '+999'], {
|
|
51
|
-
value: DDI,
|
|
52
|
-
required: requiredMessage
|
|
53
|
-
})}
|
|
54
|
-
defaultValue={host?.includes('.br') ? '+55' : ''}
|
|
55
|
-
color='gray'
|
|
56
|
-
/>
|
|
57
|
-
<Input
|
|
58
|
-
className={`flex-2 rounded-none ${areaCodeClassName}`}
|
|
59
|
-
placeholder={t('fieldsLabels.areaCode')}
|
|
60
|
-
{...registerWithMask(phoneAreaCodeKey, DDI === '+55' ? '(99)' : '', {
|
|
61
|
-
required: requiredMessage,
|
|
62
|
-
validate: (value: any) =>
|
|
63
|
-
DDI === '+55'
|
|
64
|
-
? isValidDDD(value)
|
|
65
|
-
: true || t('validations.invalidPhoneAreaCode'),
|
|
66
|
-
oncomplete: () => {
|
|
67
|
-
if (DDI === '+55') {
|
|
68
|
-
setFocus(phoneNumberKey);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
})}
|
|
72
|
-
color='gray'
|
|
73
|
-
/>
|
|
74
|
-
<Input
|
|
75
|
-
className={`flex-5 rounded-t-none md:rounded-l-none md:rounded-r-button ${phoneClassName}`}
|
|
76
|
-
placeholder={t('fieldsLabels.number')}
|
|
77
|
-
{...registerWithMask(
|
|
78
|
-
phoneNumberKey,
|
|
79
|
-
DDI === '+55' ? '99999-9999' : '',
|
|
80
|
-
{
|
|
81
|
-
required: requiredMessage,
|
|
82
|
-
validate: (value: any) =>
|
|
83
|
-
DDI === '+55'
|
|
84
|
-
? isValidPhoneNumber(value)
|
|
85
|
-
: true || t('validations.invalidPhoneNumber')
|
|
86
|
-
}
|
|
87
|
-
)}
|
|
88
|
-
color='gray'
|
|
89
|
-
/>
|
|
90
|
-
</div>
|
|
91
|
-
{((errors?.phone as any)?.ddi?.message ||
|
|
92
|
-
(errors?.phone as any)?.areaCode?.message ||
|
|
93
|
-
(errors?.phone as any)?.number?.message) && (
|
|
94
|
-
<span className='text-red-600 text-sm'>
|
|
95
|
-
{(errors?.phone as any)?.ddi?.message ||
|
|
96
|
-
(errors?.phone as any)?.areaCode?.message ||
|
|
97
|
-
(errors?.phone as any)?.number?.message}
|
|
98
|
-
</span>
|
|
99
|
-
)}
|
|
100
|
-
</div>
|
|
101
|
-
);
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
export default PhoneInput;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import * as PopoverPrimitive from '@radix-ui/react-popover';
|
|
5
|
-
|
|
6
|
-
import { cn } from '../utils/classes';
|
|
7
|
-
|
|
8
|
-
const Popover = PopoverPrimitive.Root;
|
|
9
|
-
|
|
10
|
-
const PopoverTrigger = PopoverPrimitive.Trigger;
|
|
11
|
-
|
|
12
|
-
const PopoverContent = React.forwardRef<
|
|
13
|
-
React.ElementRef<typeof PopoverPrimitive.Content>,
|
|
14
|
-
React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>
|
|
15
|
-
>(({ className, align = 'center', sideOffset = 4, ...props }, ref) => (
|
|
16
|
-
<PopoverPrimitive.Portal>
|
|
17
|
-
<PopoverPrimitive.Content
|
|
18
|
-
ref={ref}
|
|
19
|
-
align={align}
|
|
20
|
-
sideOffset={sideOffset}
|
|
21
|
-
className={cn(
|
|
22
|
-
'z-50 w-72 rounded-default bg-white p-4 text-popover-foreground shadow-xl outline-hidden data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2',
|
|
23
|
-
className
|
|
24
|
-
)}
|
|
25
|
-
{...props}
|
|
26
|
-
/>
|
|
27
|
-
</PopoverPrimitive.Portal>
|
|
28
|
-
));
|
|
29
|
-
PopoverContent.displayName = PopoverPrimitive.Content.displayName;
|
|
30
|
-
|
|
31
|
-
export { Popover, PopoverTrigger, PopoverContent };
|
package/src/components/radio.tsx
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import React, { InputHTMLAttributes, forwardRef } from 'react';
|
|
4
|
-
|
|
5
|
-
type RadioSize = 'small' | 'normal' | 'large';
|
|
6
|
-
|
|
7
|
-
interface IRadioProps
|
|
8
|
-
extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size'> {
|
|
9
|
-
label: string;
|
|
10
|
-
size?: RadioSize;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const Radio = forwardRef(
|
|
14
|
-
(
|
|
15
|
-
{ id, label, onChange, size = 'normal', ...props }: IRadioProps,
|
|
16
|
-
ref: any
|
|
17
|
-
) => {
|
|
18
|
-
const sizeClasses = {
|
|
19
|
-
small: 'w-3 h-3 text-xs',
|
|
20
|
-
normal: 'w-4 h-4 text-base',
|
|
21
|
-
large: 'w-6 h-6 text-lg'
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
const inputSizeClass = sizeClasses[size];
|
|
25
|
-
|
|
26
|
-
return (
|
|
27
|
-
<div className={`flex items-center gap-4 ${sizeClasses[size]}`}>
|
|
28
|
-
<input
|
|
29
|
-
{...props}
|
|
30
|
-
id={id}
|
|
31
|
-
ref={ref}
|
|
32
|
-
type='radio'
|
|
33
|
-
className={`${inputSizeClass} border-green-500`}
|
|
34
|
-
/>
|
|
35
|
-
<label htmlFor={id} className='cursor-pointer'>
|
|
36
|
-
{label}
|
|
37
|
-
</label>
|
|
38
|
-
</div>
|
|
39
|
-
);
|
|
40
|
-
}
|
|
41
|
-
);
|
|
42
|
-
Radio.displayName = 'Radio';
|
|
43
|
-
|
|
44
|
-
export default Radio;
|
package/src/components/range.tsx
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import React, { memo, useState } from 'react';
|
|
4
|
-
import ReactSlider from 'react-slider';
|
|
5
|
-
|
|
6
|
-
interface IRange {
|
|
7
|
-
initialValues?: number[];
|
|
8
|
-
min?: number;
|
|
9
|
-
max?: number;
|
|
10
|
-
onChange?: (value: number[]) => void;
|
|
11
|
-
disabled?: boolean;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
const Range = ({
|
|
15
|
-
min,
|
|
16
|
-
max,
|
|
17
|
-
onChange,
|
|
18
|
-
disabled = false,
|
|
19
|
-
initialValues
|
|
20
|
-
}: IRange) => {
|
|
21
|
-
const [rangeValue, setRangeValue] = useState<number[]>(
|
|
22
|
-
initialValues ?? [min || 0, max || 1000]
|
|
23
|
-
);
|
|
24
|
-
|
|
25
|
-
return (
|
|
26
|
-
<div className='w-full flex flex-col gap-[5px]'>
|
|
27
|
-
<p className='text-primary-900 text-sm select-none'>
|
|
28
|
-
{`${rangeValue[0]} - ${rangeValue[1]}`}
|
|
29
|
-
</p>
|
|
30
|
-
<ReactSlider
|
|
31
|
-
className='slider'
|
|
32
|
-
disabled={disabled}
|
|
33
|
-
min={min || 1}
|
|
34
|
-
max={max || 1000}
|
|
35
|
-
value={initialValues}
|
|
36
|
-
onChange={value => setRangeValue(value)}
|
|
37
|
-
ariaLabel={['Lower thumb', 'Upper thumb']}
|
|
38
|
-
onAfterChange={value => {
|
|
39
|
-
onChange?.(value);
|
|
40
|
-
}}
|
|
41
|
-
minDistance={10}
|
|
42
|
-
pearling
|
|
43
|
-
/>
|
|
44
|
-
</div>
|
|
45
|
-
);
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
const propsAreEqual = (prevProps: IRange, nextProps: IRange) =>
|
|
49
|
-
prevProps.min === nextProps.min &&
|
|
50
|
-
prevProps.max === nextProps.max &&
|
|
51
|
-
prevProps.disabled === nextProps.disabled &&
|
|
52
|
-
prevProps.initialValues === nextProps.initialValues;
|
|
53
|
-
|
|
54
|
-
export default memo(Range, propsAreEqual);
|
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import * as SelectPrimitive from '@radix-ui/react-select';
|
|
5
|
-
import { Check, CaretDown, CaretUp } from '@phosphor-icons/react';
|
|
6
|
-
|
|
7
|
-
import { cn } from '../utils/classes';
|
|
8
|
-
|
|
9
|
-
const Select = SelectPrimitive.Root;
|
|
10
|
-
const SelectGroup = SelectPrimitive.Group;
|
|
11
|
-
const SelectValue = SelectPrimitive.Value;
|
|
12
|
-
|
|
13
|
-
const SelectTrigger = React.forwardRef<
|
|
14
|
-
React.ElementRef<typeof SelectPrimitive.Trigger>,
|
|
15
|
-
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger>
|
|
16
|
-
>(({ className, children, ...props }, ref) => (
|
|
17
|
-
<SelectPrimitive.Trigger
|
|
18
|
-
ref={ref}
|
|
19
|
-
className={cn(
|
|
20
|
-
'flex h-[50px] w-full items-center justify-between rounded-button bg-gray-100 px-3 py-2 text-sm placeholder:text-muted-foreground focus:outline-hidden disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1',
|
|
21
|
-
className
|
|
22
|
-
)}
|
|
23
|
-
{...props}
|
|
24
|
-
>
|
|
25
|
-
{children}
|
|
26
|
-
<SelectPrimitive.Icon asChild>
|
|
27
|
-
<CaretDown className='h-4 w-4 opacity-50' />
|
|
28
|
-
</SelectPrimitive.Icon>
|
|
29
|
-
</SelectPrimitive.Trigger>
|
|
30
|
-
));
|
|
31
|
-
SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
|
|
32
|
-
|
|
33
|
-
const SelectScrollUpButton = React.forwardRef<
|
|
34
|
-
React.ElementRef<typeof SelectPrimitive.ScrollUpButton>,
|
|
35
|
-
React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollUpButton>
|
|
36
|
-
>(({ className, ...props }, ref) => (
|
|
37
|
-
<SelectPrimitive.ScrollUpButton
|
|
38
|
-
ref={ref}
|
|
39
|
-
className={cn(
|
|
40
|
-
'flex cursor-default items-center justify-center py-1',
|
|
41
|
-
className
|
|
42
|
-
)}
|
|
43
|
-
{...props}
|
|
44
|
-
>
|
|
45
|
-
<CaretUp className='h-4 w-4' />
|
|
46
|
-
</SelectPrimitive.ScrollUpButton>
|
|
47
|
-
));
|
|
48
|
-
SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;
|
|
49
|
-
|
|
50
|
-
const SelectScrollDownButton = React.forwardRef<
|
|
51
|
-
React.ElementRef<typeof SelectPrimitive.ScrollDownButton>,
|
|
52
|
-
React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollDownButton>
|
|
53
|
-
>(({ className, ...props }, ref) => (
|
|
54
|
-
<SelectPrimitive.ScrollDownButton
|
|
55
|
-
ref={ref}
|
|
56
|
-
className={cn(
|
|
57
|
-
'flex cursor-default items-center justify-center py-1',
|
|
58
|
-
className
|
|
59
|
-
)}
|
|
60
|
-
{...props}
|
|
61
|
-
>
|
|
62
|
-
<CaretDown className='h-4 w-4' />
|
|
63
|
-
</SelectPrimitive.ScrollDownButton>
|
|
64
|
-
));
|
|
65
|
-
SelectScrollDownButton.displayName =
|
|
66
|
-
SelectPrimitive.ScrollDownButton.displayName;
|
|
67
|
-
|
|
68
|
-
const SelectContent = React.forwardRef<
|
|
69
|
-
React.ElementRef<typeof SelectPrimitive.Content>,
|
|
70
|
-
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content>
|
|
71
|
-
>(({ className, children, position = 'popper', ...props }, ref) => (
|
|
72
|
-
<SelectPrimitive.Portal>
|
|
73
|
-
<SelectPrimitive.Content
|
|
74
|
-
ref={ref}
|
|
75
|
-
className={cn(
|
|
76
|
-
'relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-button bg-white text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2',
|
|
77
|
-
position === 'popper'
|
|
78
|
-
? 'data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1'
|
|
79
|
-
: '',
|
|
80
|
-
className
|
|
81
|
-
)}
|
|
82
|
-
position={position}
|
|
83
|
-
{...props}
|
|
84
|
-
>
|
|
85
|
-
<SelectScrollUpButton />
|
|
86
|
-
<SelectPrimitive.Viewport
|
|
87
|
-
className={cn(
|
|
88
|
-
'p-1',
|
|
89
|
-
position === 'popper'
|
|
90
|
-
? 'h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]'
|
|
91
|
-
: ''
|
|
92
|
-
)}
|
|
93
|
-
>
|
|
94
|
-
{children}
|
|
95
|
-
</SelectPrimitive.Viewport>
|
|
96
|
-
<SelectScrollDownButton />
|
|
97
|
-
</SelectPrimitive.Content>
|
|
98
|
-
</SelectPrimitive.Portal>
|
|
99
|
-
));
|
|
100
|
-
SelectContent.displayName = SelectPrimitive.Content.displayName;
|
|
101
|
-
|
|
102
|
-
const SelectLabel = React.forwardRef<
|
|
103
|
-
React.ElementRef<typeof SelectPrimitive.Label>,
|
|
104
|
-
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Label>
|
|
105
|
-
>(({ className, ...props }, ref) => (
|
|
106
|
-
<SelectPrimitive.Label
|
|
107
|
-
ref={ref}
|
|
108
|
-
className={cn('py-1.5 pl-8 pr-2 text-sm font-semibold', className)}
|
|
109
|
-
{...props}
|
|
110
|
-
/>
|
|
111
|
-
));
|
|
112
|
-
SelectLabel.displayName = SelectPrimitive.Label.displayName;
|
|
113
|
-
|
|
114
|
-
const SelectItem = React.forwardRef<
|
|
115
|
-
React.ElementRef<typeof SelectPrimitive.Item>,
|
|
116
|
-
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item>
|
|
117
|
-
>(({ className, children, ...props }, ref) => (
|
|
118
|
-
<SelectPrimitive.Item
|
|
119
|
-
ref={ref}
|
|
120
|
-
className={cn(
|
|
121
|
-
'relative flex w-full cursor-default select-none items-center rounded-xs py-1.5 pl-8 pr-2 text-sm outline-hidden focus:bg-accent focus:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50',
|
|
122
|
-
className
|
|
123
|
-
)}
|
|
124
|
-
{...props}
|
|
125
|
-
>
|
|
126
|
-
<span className='absolute left-2 flex h-3.5 w-3.5 items-center justify-center'>
|
|
127
|
-
<SelectPrimitive.ItemIndicator>
|
|
128
|
-
<Check className='h-4 w-4' />
|
|
129
|
-
</SelectPrimitive.ItemIndicator>
|
|
130
|
-
</span>
|
|
131
|
-
|
|
132
|
-
<SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
|
|
133
|
-
</SelectPrimitive.Item>
|
|
134
|
-
));
|
|
135
|
-
SelectItem.displayName = SelectPrimitive.Item.displayName;
|
|
136
|
-
|
|
137
|
-
const SelectSeparator = React.forwardRef<
|
|
138
|
-
React.ElementRef<typeof SelectPrimitive.Separator>,
|
|
139
|
-
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Separator>
|
|
140
|
-
>(({ className, ...props }, ref) => (
|
|
141
|
-
<SelectPrimitive.Separator
|
|
142
|
-
ref={ref}
|
|
143
|
-
className={cn('-mx-1 my-1 h-px bg-muted', className)}
|
|
144
|
-
{...props}
|
|
145
|
-
/>
|
|
146
|
-
));
|
|
147
|
-
SelectSeparator.displayName = SelectPrimitive.Separator.displayName;
|
|
148
|
-
|
|
149
|
-
export {
|
|
150
|
-
Select,
|
|
151
|
-
SelectGroup,
|
|
152
|
-
SelectValue,
|
|
153
|
-
SelectTrigger,
|
|
154
|
-
SelectContent,
|
|
155
|
-
SelectLabel,
|
|
156
|
-
SelectItem,
|
|
157
|
-
SelectSeparator,
|
|
158
|
-
SelectScrollUpButton,
|
|
159
|
-
SelectScrollDownButton
|
|
160
|
-
};
|
package/src/components/sheet.tsx
DELETED
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import * as SheetPrimitive from '@radix-ui/react-dialog';
|
|
5
|
-
import { cva, type VariantProps } from 'class-variance-authority';
|
|
6
|
-
import { X } from '@phosphor-icons/react';
|
|
7
|
-
|
|
8
|
-
import cn from 'classnames';
|
|
9
|
-
|
|
10
|
-
const Sheet = SheetPrimitive.Root;
|
|
11
|
-
|
|
12
|
-
const SheetTrigger = SheetPrimitive.Trigger;
|
|
13
|
-
|
|
14
|
-
const SheetClose = SheetPrimitive.Close;
|
|
15
|
-
|
|
16
|
-
const SheetPortal = SheetPrimitive.Portal;
|
|
17
|
-
|
|
18
|
-
const SheetOverlay = React.forwardRef<
|
|
19
|
-
React.ElementRef<typeof SheetPrimitive.Overlay>,
|
|
20
|
-
React.ComponentPropsWithoutRef<typeof SheetPrimitive.Overlay>
|
|
21
|
-
>(({ className, ...props }, ref) => (
|
|
22
|
-
<SheetPrimitive.Overlay
|
|
23
|
-
className={cn(
|
|
24
|
-
'fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=open]:fade-in-0',
|
|
25
|
-
className
|
|
26
|
-
)}
|
|
27
|
-
{...props}
|
|
28
|
-
ref={ref}
|
|
29
|
-
/>
|
|
30
|
-
));
|
|
31
|
-
SheetOverlay.displayName = SheetPrimitive.Overlay.displayName;
|
|
32
|
-
|
|
33
|
-
const sheetVariants = cva(
|
|
34
|
-
'fixed z-50 gap-4 bg-white p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=open]:duration-500',
|
|
35
|
-
{
|
|
36
|
-
variants: {
|
|
37
|
-
side: {
|
|
38
|
-
top: 'inset-x-0 top-0 border-b data-[state=open]:slide-in-from-top',
|
|
39
|
-
bottom:
|
|
40
|
-
'inset-x-0 bottom-0 border-t data-[state=open]:slide-in-from-bottom',
|
|
41
|
-
left: 'inset-y-0 left-0 h-full w-3/4 border-r data-[state=open]:slide-in-from-left sm:max-w-sm',
|
|
42
|
-
right:
|
|
43
|
-
'inset-y-0 right-0 h-full w-3/4 border-l data-[state=open]:slide-in-from-right sm:max-w-sm'
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
defaultVariants: {
|
|
47
|
-
side: 'right'
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
);
|
|
51
|
-
|
|
52
|
-
interface SheetContentProps
|
|
53
|
-
extends React.ComponentPropsWithoutRef<typeof SheetPrimitive.Content>,
|
|
54
|
-
VariantProps<typeof sheetVariants> {}
|
|
55
|
-
|
|
56
|
-
const SheetContent = React.forwardRef<
|
|
57
|
-
React.ElementRef<typeof SheetPrimitive.Content>,
|
|
58
|
-
SheetContentProps
|
|
59
|
-
>(({ side = 'right', className, children, ...props }, ref) => (
|
|
60
|
-
<SheetPortal>
|
|
61
|
-
<SheetOverlay />
|
|
62
|
-
<SheetPrimitive.Content
|
|
63
|
-
ref={ref}
|
|
64
|
-
className={cn(sheetVariants({ side }), className)}
|
|
65
|
-
{...props}
|
|
66
|
-
>
|
|
67
|
-
{children}
|
|
68
|
-
<SheetPrimitive.Close className='absolute right-4 top-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary'>
|
|
69
|
-
<X className='h-4 w-4' />
|
|
70
|
-
<span className='sr-only'>Close</span>
|
|
71
|
-
</SheetPrimitive.Close>
|
|
72
|
-
</SheetPrimitive.Content>
|
|
73
|
-
</SheetPortal>
|
|
74
|
-
));
|
|
75
|
-
SheetContent.displayName = SheetPrimitive.Content.displayName;
|
|
76
|
-
|
|
77
|
-
const SheetHeader = ({
|
|
78
|
-
className,
|
|
79
|
-
...props
|
|
80
|
-
}: React.HTMLAttributes<HTMLDivElement>) => (
|
|
81
|
-
<div
|
|
82
|
-
className={cn(
|
|
83
|
-
'flex flex-col space-y-2 text-center sm:text-left',
|
|
84
|
-
className
|
|
85
|
-
)}
|
|
86
|
-
{...props}
|
|
87
|
-
/>
|
|
88
|
-
);
|
|
89
|
-
SheetHeader.displayName = 'SheetHeader';
|
|
90
|
-
|
|
91
|
-
const SheetFooter = ({
|
|
92
|
-
className,
|
|
93
|
-
...props
|
|
94
|
-
}: React.HTMLAttributes<HTMLDivElement>) => (
|
|
95
|
-
<div
|
|
96
|
-
className={cn(
|
|
97
|
-
'flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2',
|
|
98
|
-
className
|
|
99
|
-
)}
|
|
100
|
-
{...props}
|
|
101
|
-
/>
|
|
102
|
-
);
|
|
103
|
-
SheetFooter.displayName = 'SheetFooter';
|
|
104
|
-
|
|
105
|
-
const SheetTitle = React.forwardRef<
|
|
106
|
-
React.ElementRef<typeof SheetPrimitive.Title>,
|
|
107
|
-
React.ComponentPropsWithoutRef<typeof SheetPrimitive.Title>
|
|
108
|
-
>(({ className, ...props }, ref) => (
|
|
109
|
-
<SheetPrimitive.Title
|
|
110
|
-
ref={ref}
|
|
111
|
-
className={cn('text-lg font-semibold text-foreground', className)}
|
|
112
|
-
{...props}
|
|
113
|
-
/>
|
|
114
|
-
));
|
|
115
|
-
SheetTitle.displayName = SheetPrimitive.Title.displayName;
|
|
116
|
-
|
|
117
|
-
const SheetDescription = React.forwardRef<
|
|
118
|
-
React.ElementRef<typeof SheetPrimitive.Description>,
|
|
119
|
-
React.ComponentPropsWithoutRef<typeof SheetPrimitive.Description>
|
|
120
|
-
>(({ className, ...props }, ref) => (
|
|
121
|
-
<SheetPrimitive.Description
|
|
122
|
-
ref={ref}
|
|
123
|
-
className={cn('text-sm text-muted-foreground', className)}
|
|
124
|
-
{...props}
|
|
125
|
-
/>
|
|
126
|
-
));
|
|
127
|
-
SheetDescription.displayName = SheetPrimitive.Description.displayName;
|
|
128
|
-
|
|
129
|
-
export {
|
|
130
|
-
Sheet,
|
|
131
|
-
SheetPortal,
|
|
132
|
-
SheetOverlay,
|
|
133
|
-
SheetTrigger,
|
|
134
|
-
SheetClose,
|
|
135
|
-
SheetContent,
|
|
136
|
-
SheetHeader,
|
|
137
|
-
SheetFooter,
|
|
138
|
-
SheetTitle,
|
|
139
|
-
SheetDescription
|
|
140
|
-
};
|