@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,110 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
Label,
|
|
5
|
-
Slider as AriaSlider,
|
|
6
|
-
SliderOutput,
|
|
7
|
-
SliderTrack,
|
|
8
|
-
SliderThumb,
|
|
9
|
-
} from 'react-aria-components';
|
|
10
|
-
import { cn } from '../../utils/cn';
|
|
11
|
-
import type { SliderProps } from './Slider.types';
|
|
12
|
-
|
|
13
|
-
export function Slider({
|
|
14
|
-
label,
|
|
15
|
-
showOutput = true,
|
|
16
|
-
thumbLabels,
|
|
17
|
-
classNames,
|
|
18
|
-
orientation,
|
|
19
|
-
isDisabled,
|
|
20
|
-
children,
|
|
21
|
-
...props
|
|
22
|
-
}: SliderProps) {
|
|
23
|
-
return (
|
|
24
|
-
<AriaSlider
|
|
25
|
-
orientation={orientation}
|
|
26
|
-
isDisabled={isDisabled}
|
|
27
|
-
className={cn(
|
|
28
|
-
'data-[orientation="horizontal"]:w-full data-[orientation="horizontal"]:flex data-[orientation="horizontal"]:flex-wrap',
|
|
29
|
-
'data-[orientation="vertical"]:w-8 data-[orientation="vertical"]:block data-[orientation="vertical"]:h-full',
|
|
30
|
-
classNames?.base
|
|
31
|
-
)}
|
|
32
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
33
|
-
{...props}
|
|
34
|
-
>
|
|
35
|
-
{children || (
|
|
36
|
-
<>
|
|
37
|
-
{(label || showOutput) && (
|
|
38
|
-
<div
|
|
39
|
-
className={cn(
|
|
40
|
-
'w-full flex justify-between items-center',
|
|
41
|
-
orientation === 'vertical' && 'gap-2 w-max mb-2',
|
|
42
|
-
classNames?.outputWrapper
|
|
43
|
-
)}
|
|
44
|
-
>
|
|
45
|
-
<Label
|
|
46
|
-
className={cn(
|
|
47
|
-
'flex-1 text-sm',
|
|
48
|
-
isDisabled && 'opacity-50',
|
|
49
|
-
classNames?.label
|
|
50
|
-
)}
|
|
51
|
-
>
|
|
52
|
-
{label}
|
|
53
|
-
</Label>
|
|
54
|
-
|
|
55
|
-
{showOutput && (
|
|
56
|
-
<SliderOutput
|
|
57
|
-
className={cn(
|
|
58
|
-
'flex flex-initial ml-auto justify-end text-sm',
|
|
59
|
-
isDisabled && 'opacity-50',
|
|
60
|
-
classNames?.output
|
|
61
|
-
)}
|
|
62
|
-
>
|
|
63
|
-
{({ state }) =>
|
|
64
|
-
state.values
|
|
65
|
-
.map((_, i) => state.getThumbValueLabel(i))
|
|
66
|
-
.join(' – ')
|
|
67
|
-
}
|
|
68
|
-
</SliderOutput>
|
|
69
|
-
)}
|
|
70
|
-
</div>
|
|
71
|
-
)}
|
|
72
|
-
|
|
73
|
-
<SliderTrack
|
|
74
|
-
className={cn(
|
|
75
|
-
'data-[orientation="horizontal"]:w-full data-[orientation="horizontal"]:h-8',
|
|
76
|
-
'data-[orientation="vertical"]:w-8 data-[orientation="vertical"]:h-full',
|
|
77
|
-
'transition-all duration-200 ease',
|
|
78
|
-
'before:bg-slate-300 before:block before:absolute cursor-pointer',
|
|
79
|
-
'data-[orientation="horizontal"]:before:w-full data-[orientation="horizontal"]:before:h-0.5',
|
|
80
|
-
'data-[orientation="horizontal"]:before:top-1/2 data-[orientation="horizontal"]:before:-translate-y-1/2',
|
|
81
|
-
'data-[orientation="vertical"]:before:w-0.5 data-[orientation="vertical"]:before:h-full data-[orientation="vertical"]:before:left-1/2 data-[orientation="vertical"]:before:-translate-y-1/2 data-[orientation="vertical"]:before:-translate-x-1/2',
|
|
82
|
-
isDisabled && 'opacity-50 before:cursor-default',
|
|
83
|
-
classNames?.track
|
|
84
|
-
)}
|
|
85
|
-
>
|
|
86
|
-
{({ state }) =>
|
|
87
|
-
state.values.map((_, i) => (
|
|
88
|
-
<SliderThumb
|
|
89
|
-
// eslint-disable-next-line react/no-array-index-key
|
|
90
|
-
key={i}
|
|
91
|
-
index={i}
|
|
92
|
-
aria-label={thumbLabels?.[i]}
|
|
93
|
-
className={cn(
|
|
94
|
-
'w-6 h-6 bg-slate-300 forced-color-adjust-none cursor-pointer top-1/2',
|
|
95
|
-
'border-2 border-slate-400 rounded-full',
|
|
96
|
-
isDisabled && 'cursor-default',
|
|
97
|
-
orientation === 'vertical' && 'left-1/2',
|
|
98
|
-
classNames?.thumb
|
|
99
|
-
)}
|
|
100
|
-
/>
|
|
101
|
-
))
|
|
102
|
-
}
|
|
103
|
-
</SliderTrack>
|
|
104
|
-
</>
|
|
105
|
-
)}
|
|
106
|
-
</AriaSlider>
|
|
107
|
-
);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
export default Slider;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { SliderProps as AriaSliderProps } from 'react-aria-components';
|
|
2
|
-
import type { SlotsToClasses } from '../../types/SlotsToClasses';
|
|
3
|
-
|
|
4
|
-
export type SliderProps = AriaSliderProps & {
|
|
5
|
-
label?: string;
|
|
6
|
-
showOutput?: boolean;
|
|
7
|
-
thumbLabels?: string[];
|
|
8
|
-
classNames?: SlotsToClasses<
|
|
9
|
-
'base' | 'label' | 'output' | 'outputWrapper' | 'track' | 'thumb'
|
|
10
|
-
>;
|
|
11
|
-
};
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { Switch as AriaSwitch } from 'react-aria-components';
|
|
4
|
-
import { cn } from '../../utils/cn';
|
|
5
|
-
import type { SlotsToClasses } from '../../types/SlotsToClasses';
|
|
6
|
-
import type { SwitchProps, SwitchRenderProps } from './Switch.types';
|
|
7
|
-
|
|
8
|
-
export function Switch({
|
|
9
|
-
children,
|
|
10
|
-
className,
|
|
11
|
-
classNames,
|
|
12
|
-
...props
|
|
13
|
-
}: SwitchProps & {
|
|
14
|
-
classNames?: SlotsToClasses<'indicator'>;
|
|
15
|
-
}) {
|
|
16
|
-
return (
|
|
17
|
-
<AriaSwitch
|
|
18
|
-
className={cn(
|
|
19
|
-
'flex items-center gap-2 text-sm text-slate-500 forced-color-adjust-none group',
|
|
20
|
-
'',
|
|
21
|
-
className
|
|
22
|
-
)}
|
|
23
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
24
|
-
{...props}
|
|
25
|
-
>
|
|
26
|
-
{(renderProps: SwitchRenderProps) => {
|
|
27
|
-
const { isSelected, isHovered, isFocused, isPressed, isDisabled } =
|
|
28
|
-
renderProps;
|
|
29
|
-
return (
|
|
30
|
-
<>
|
|
31
|
-
<div
|
|
32
|
-
className={cn(
|
|
33
|
-
'w-12 h-7 bg-transparent border-solid border border-slate-300 rounded-3xl transition-all duration-200 ease-in-out',
|
|
34
|
-
'before:block before:w-5 before:h-5 before:m-[3px] before:bg-slate-300 before:rounded-full',
|
|
35
|
-
'before:transition-all before:duration-200 before:ease-in-out',
|
|
36
|
-
[
|
|
37
|
-
isHovered && 'border-slate-400',
|
|
38
|
-
isSelected && [
|
|
39
|
-
' bg-slate-300 before:translate-x-full before:bg-white',
|
|
40
|
-
(isHovered || isFocused) && 'border-slate-400',
|
|
41
|
-
],
|
|
42
|
-
isFocused && ['outline outline-2 outline-slate-200'],
|
|
43
|
-
isPressed && 'before:bg-slate-400',
|
|
44
|
-
isDisabled && 'bg-slate-100',
|
|
45
|
-
classNames?.indicator,
|
|
46
|
-
]
|
|
47
|
-
)}
|
|
48
|
-
/>
|
|
49
|
-
|
|
50
|
-
{typeof children === 'function'
|
|
51
|
-
? children({
|
|
52
|
-
defaultChildren: undefined,
|
|
53
|
-
...renderProps,
|
|
54
|
-
})
|
|
55
|
-
: children}
|
|
56
|
-
</>
|
|
57
|
-
);
|
|
58
|
-
}}
|
|
59
|
-
</AriaSwitch>
|
|
60
|
-
);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export default Switch;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { cn } from '../../utils/cn';
|
|
4
|
-
import type { TableProps } from './Table.types';
|
|
5
|
-
|
|
6
|
-
export function Table<T>({
|
|
7
|
-
columns,
|
|
8
|
-
rows,
|
|
9
|
-
onRowClick = () => {},
|
|
10
|
-
classNames,
|
|
11
|
-
}: TableProps<T>) {
|
|
12
|
-
return (
|
|
13
|
-
<table className={cn(classNames?.table)}>
|
|
14
|
-
<thead className={cn(classNames?.thead)}>
|
|
15
|
-
<tr className={cn(classNames?.theadTr)}>
|
|
16
|
-
{columns.map((column) => (
|
|
17
|
-
<th
|
|
18
|
-
key={String(column.id)}
|
|
19
|
-
className={cn(classNames?.th)}
|
|
20
|
-
data-th-header={column.label.toLowerCase()}
|
|
21
|
-
>
|
|
22
|
-
{column.label}
|
|
23
|
-
</th>
|
|
24
|
-
))}
|
|
25
|
-
</tr>
|
|
26
|
-
</thead>
|
|
27
|
-
<tbody className={cn(classNames?.tbody)}>
|
|
28
|
-
{Object.entries(rows).map(([key, row]) => (
|
|
29
|
-
<tr
|
|
30
|
-
key={key}
|
|
31
|
-
onClick={() => onRowClick(row)}
|
|
32
|
-
className={cn(classNames?.tbodyTr)}
|
|
33
|
-
>
|
|
34
|
-
{columns.map((column) => (
|
|
35
|
-
<td
|
|
36
|
-
key={`${String(column.id)}_${key}`}
|
|
37
|
-
data-th={column.label.toLowerCase()}
|
|
38
|
-
className={cn(classNames?.td)}
|
|
39
|
-
>
|
|
40
|
-
{column.renderer
|
|
41
|
-
? column.renderer(row)
|
|
42
|
-
: String(row[column.id as keyof T])}
|
|
43
|
-
</td>
|
|
44
|
-
))}
|
|
45
|
-
</tr>
|
|
46
|
-
))}
|
|
47
|
-
</tbody>
|
|
48
|
-
</table>
|
|
49
|
-
);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export default Table;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
2
|
-
import type { SlotsToClasses } from '../../types/SlotsToClasses';
|
|
3
|
-
|
|
4
|
-
export type TableProps<T> = {
|
|
5
|
-
columns: (
|
|
6
|
-
| {
|
|
7
|
-
id: keyof T;
|
|
8
|
-
label: string;
|
|
9
|
-
renderer?: (props: T) => ReactNode;
|
|
10
|
-
}
|
|
11
|
-
| {
|
|
12
|
-
id: string;
|
|
13
|
-
label: string;
|
|
14
|
-
renderer: (props: T) => ReactNode;
|
|
15
|
-
}
|
|
16
|
-
)[];
|
|
17
|
-
rows: T[];
|
|
18
|
-
onRowClick?: (row: T) => void;
|
|
19
|
-
classNames?: SlotsToClasses<
|
|
20
|
-
'table' | 'thead' | 'tbody' | 'theadTr' | 'tbodyTr' | 'th' | 'td'
|
|
21
|
-
>;
|
|
22
|
-
};
|
package/components/Tabs/Tab.tsx
DELETED
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { useContext } from 'react';
|
|
4
|
-
import { Tab as AriaTab } from 'react-aria-components';
|
|
5
|
-
import { motion } from 'framer-motion';
|
|
6
|
-
import { cn } from '../../utils/cn';
|
|
7
|
-
import type { SlotsToClasses } from '../../types/SlotsToClasses';
|
|
8
|
-
import type { TabProps, TabRenderProps } from './Tab.types';
|
|
9
|
-
import type { TabsProps } from './Tabs.types';
|
|
10
|
-
import { TabsOrientationContext } from './Tabs.context';
|
|
11
|
-
|
|
12
|
-
export function BaseTab({
|
|
13
|
-
orientation,
|
|
14
|
-
variant = 'base',
|
|
15
|
-
className,
|
|
16
|
-
children,
|
|
17
|
-
...props
|
|
18
|
-
}: TabProps & { orientation: TabsProps['orientation'] }) {
|
|
19
|
-
return (
|
|
20
|
-
<AriaTab
|
|
21
|
-
className={cn(
|
|
22
|
-
'flex items-center relative z-10',
|
|
23
|
-
'text-sm cursor-pointer forced-color-adjust-none',
|
|
24
|
-
'transition-all duration-300 ease-in-out',
|
|
25
|
-
'justify-center',
|
|
26
|
-
'disabled:opacity-50',
|
|
27
|
-
'selected:outline-0 hover:outline-0 hover:text-slate-500',
|
|
28
|
-
variant === 'underline' &&
|
|
29
|
-
orientation === 'vertical' &&
|
|
30
|
-
'justify-start',
|
|
31
|
-
'py-2 px-3',
|
|
32
|
-
variant === 'underline' && orientation === 'horizontal' && 'p-3',
|
|
33
|
-
variant === 'underline' &&
|
|
34
|
-
orientation === 'vertical' &&
|
|
35
|
-
'py-3 pr-3 pl-0',
|
|
36
|
-
(variant === 'underline' ||
|
|
37
|
-
variant === 'outline' ||
|
|
38
|
-
variant === 'enclosed') &&
|
|
39
|
-
'text-slate-800',
|
|
40
|
-
variant === 'solid' && 'text-slate-400',
|
|
41
|
-
(variant === 'underline' || variant === 'outline') &&
|
|
42
|
-
'selected:text-slate-800',
|
|
43
|
-
(variant === 'solid' || variant === 'enclosed') &&
|
|
44
|
-
'selected:text-slate-100',
|
|
45
|
-
className
|
|
46
|
-
)}
|
|
47
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
48
|
-
{...props}
|
|
49
|
-
>
|
|
50
|
-
{children}
|
|
51
|
-
</AriaTab>
|
|
52
|
-
);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export function Tab({
|
|
56
|
-
variant = 'base',
|
|
57
|
-
children,
|
|
58
|
-
className,
|
|
59
|
-
classNames,
|
|
60
|
-
...props
|
|
61
|
-
}: TabProps & {
|
|
62
|
-
classNames?: SlotsToClasses<'overflow'>;
|
|
63
|
-
}) {
|
|
64
|
-
const orientation = useContext(TabsOrientationContext);
|
|
65
|
-
|
|
66
|
-
return (
|
|
67
|
-
<BaseTab
|
|
68
|
-
orientation={orientation}
|
|
69
|
-
variant={variant}
|
|
70
|
-
className={className}
|
|
71
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
72
|
-
{...props}
|
|
73
|
-
>
|
|
74
|
-
{(renderProps: TabRenderProps) => (
|
|
75
|
-
<>
|
|
76
|
-
{typeof children === 'function'
|
|
77
|
-
? children({
|
|
78
|
-
defaultChildren: undefined,
|
|
79
|
-
...renderProps,
|
|
80
|
-
})
|
|
81
|
-
: children}
|
|
82
|
-
|
|
83
|
-
{(renderProps.isFocusVisible || renderProps.isSelected) && (
|
|
84
|
-
<motion.span
|
|
85
|
-
className={cn(
|
|
86
|
-
'absolute z-0',
|
|
87
|
-
variant === 'solid' &&
|
|
88
|
-
'inset-0 rounded-lg bg-slate-600 mix-blend-color',
|
|
89
|
-
variant === 'outline' &&
|
|
90
|
-
'inset-0 rounded-lg border-solid border-2 border-slate-800',
|
|
91
|
-
variant === 'underline' &&
|
|
92
|
-
'rounded-lg bg-slate-800 mix-blend-color bottom-0',
|
|
93
|
-
variant === 'underline' &&
|
|
94
|
-
orientation === 'horizontal' &&
|
|
95
|
-
'left-0 w-full h-px',
|
|
96
|
-
variant === 'underline' &&
|
|
97
|
-
orientation === 'vertical' &&
|
|
98
|
-
'right-0 w-px h-full',
|
|
99
|
-
variant === 'enclosed' &&
|
|
100
|
-
'inset-0 border-solid border-1 border-slate-800 -mb-px border-b-0 rounded-t-lg rounded-b-none bg-white mix-blend-difference',
|
|
101
|
-
variant === 'base' && 'hidden',
|
|
102
|
-
classNames?.overflow
|
|
103
|
-
)}
|
|
104
|
-
layoutId={variant}
|
|
105
|
-
transition={{
|
|
106
|
-
type: 'spring',
|
|
107
|
-
bounce: 0.2,
|
|
108
|
-
duration: 0.75,
|
|
109
|
-
}}
|
|
110
|
-
/>
|
|
111
|
-
)}
|
|
112
|
-
</>
|
|
113
|
-
)}
|
|
114
|
-
</BaseTab>
|
|
115
|
-
);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
export default Tab;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
TabProps as AriaTabProps,
|
|
3
|
-
TabRenderProps as AriaTabRenderProps,
|
|
4
|
-
} from 'react-aria-components';
|
|
5
|
-
|
|
6
|
-
export interface TabProps extends AriaTabProps {
|
|
7
|
-
variant?: 'solid' | 'outline' | 'underline' | 'enclosed' | 'base';
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export type TabRenderProps = AriaTabRenderProps;
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { useContext } from 'react';
|
|
4
|
-
import { TabList as AriaTabList } from 'react-aria-components';
|
|
5
|
-
import { cn } from '../../utils/cn';
|
|
6
|
-
import { BaseTab } from './Tab';
|
|
7
|
-
import type { TabListProps } from './TabList.types';
|
|
8
|
-
import { TabsOrientationContext } from './Tabs.context';
|
|
9
|
-
|
|
10
|
-
export function TabList({
|
|
11
|
-
items,
|
|
12
|
-
children,
|
|
13
|
-
variant = 'base',
|
|
14
|
-
className,
|
|
15
|
-
...props
|
|
16
|
-
}: TabListProps) {
|
|
17
|
-
const orientation = useContext(TabsOrientationContext);
|
|
18
|
-
|
|
19
|
-
return (
|
|
20
|
-
<AriaTabList
|
|
21
|
-
className={cn(
|
|
22
|
-
'flex flex-row w-full flex-wrap gap-2 relative',
|
|
23
|
-
orientation === 'vertical' &&
|
|
24
|
-
'orientation-vertical:max-w-max orientation-vertical:flex-col orientation-vertical:justify-start',
|
|
25
|
-
[
|
|
26
|
-
variant === 'solid' && ['bg-slate-200 rounded-xl p-1'],
|
|
27
|
-
variant === 'outline' && [
|
|
28
|
-
'border-solid border-2 border-slate-200 rounded-xl p-1',
|
|
29
|
-
],
|
|
30
|
-
variant === 'underline' &&
|
|
31
|
-
orientation === 'vertical' && [
|
|
32
|
-
'before:block before:absolute before:inset-y-0 before:right-0 before:w-px before:bg-slate-200',
|
|
33
|
-
],
|
|
34
|
-
variant === 'underline' &&
|
|
35
|
-
orientation === 'horizontal' && [
|
|
36
|
-
'before:block before:absolute before:inset-x-0 before:bottom-0 before:h-px before:bg-slate-200',
|
|
37
|
-
],
|
|
38
|
-
],
|
|
39
|
-
className
|
|
40
|
-
)}
|
|
41
|
-
items={items}
|
|
42
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
43
|
-
{...props}
|
|
44
|
-
>
|
|
45
|
-
{children ||
|
|
46
|
-
((item) => <BaseTab orientation={orientation}>{item.title}</BaseTab>)}
|
|
47
|
-
</AriaTabList>
|
|
48
|
-
);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export default TabList;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { TabListProps as AriaTabListProps } from 'react-aria-components';
|
|
2
|
-
import type { ReactNode } from 'react';
|
|
3
|
-
|
|
4
|
-
export type TabItemType = {
|
|
5
|
-
id: number | string;
|
|
6
|
-
title: ReactNode;
|
|
7
|
-
content: ReactNode;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export interface TabListProps extends AriaTabListProps<TabItemType> {
|
|
11
|
-
variant?: 'solid' | 'outline' | 'underline' | 'base';
|
|
12
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { TabPanel as AriaTabPanel } from 'react-aria-components';
|
|
4
|
-
import { cn } from '../../utils/cn';
|
|
5
|
-
import type { TabPanelProps } from './TabPanel.types';
|
|
6
|
-
|
|
7
|
-
export function TabPanel({ children, className, ...props }: TabPanelProps) {
|
|
8
|
-
return (
|
|
9
|
-
<AriaTabPanel
|
|
10
|
-
className={cn('flex grow py-4 px-0', className)}
|
|
11
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
12
|
-
{...props}
|
|
13
|
-
>
|
|
14
|
-
{children}
|
|
15
|
-
</AriaTabPanel>
|
|
16
|
-
);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export default TabPanel;
|
package/components/Tabs/Tabs.tsx
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { Tabs as AriaTabs } from 'react-aria-components';
|
|
4
|
-
import { LayoutGroup } from 'framer-motion';
|
|
5
|
-
import { useId } from 'react';
|
|
6
|
-
import { cn } from '../../utils/cn';
|
|
7
|
-
import type { TabsProps } from './Tabs.types';
|
|
8
|
-
import { TabList } from './TabList';
|
|
9
|
-
import { Tab } from './Tab';
|
|
10
|
-
import { TabPanel } from './TabPanel';
|
|
11
|
-
import { TabsOrientationContext } from './Tabs.context';
|
|
12
|
-
|
|
13
|
-
export function Tabs({ children, className, ...props }: TabsProps) {
|
|
14
|
-
const id = useId();
|
|
15
|
-
|
|
16
|
-
return (
|
|
17
|
-
<TabsOrientationContext.Provider value={props.orientation ?? 'horizontal'}>
|
|
18
|
-
<LayoutGroup id={id}>
|
|
19
|
-
<AriaTabs
|
|
20
|
-
className={cn(
|
|
21
|
-
'flex flex-col w-full px-0 py-2',
|
|
22
|
-
props.orientation === 'vertical' && 'orientation-vertical:flex-row',
|
|
23
|
-
className
|
|
24
|
-
)}
|
|
25
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
26
|
-
{...props}
|
|
27
|
-
>
|
|
28
|
-
{children}
|
|
29
|
-
</AriaTabs>
|
|
30
|
-
</LayoutGroup>
|
|
31
|
-
</TabsOrientationContext.Provider>
|
|
32
|
-
);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
Tabs.List = TabList;
|
|
36
|
-
Tabs.Tab = Tab;
|
|
37
|
-
Tabs.Panel = TabPanel;
|
|
38
|
-
|
|
39
|
-
export default Tabs;
|
package/components/Tabs/index.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export { BaseTab, Tab } from './Tab';
|
|
2
|
-
export { TabList } from './TabList';
|
|
3
|
-
export { TabPanel } from './TabPanel';
|
|
4
|
-
export { Tabs } from './Tabs';
|
|
5
|
-
export { TabsOrientationContext } from './Tabs.context';
|
|
6
|
-
export type { TabProps, TabRenderProps } from './Tab.types';
|
|
7
|
-
export type { TabItemType, TabListProps } from './TabList.types';
|
|
8
|
-
export type { TabPanelProps } from './TabPanel.types';
|
|
9
|
-
export type { TabsProps } from './Tabs.types';
|