@react-native-reusables/cli 0.1.0 → 0.1.2
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/__generated/components/ui/accordion.tsx +29 -31
- package/__generated/components/ui/alert-dialog.tsx +18 -24
- package/__generated/components/ui/avatar.tsx +34 -41
- package/__generated/components/ui/badge.tsx +2 -2
- package/__generated/components/ui/button.tsx +2 -5
- package/__generated/components/ui/card.tsx +39 -51
- package/__generated/components/ui/checkbox.tsx +23 -24
- package/__generated/components/ui/context-menu.tsx +27 -22
- package/__generated/components/ui/dialog.tsx +39 -41
- package/__generated/components/ui/dropdown-menu.tsx +26 -21
- package/__generated/components/ui/hover-card.tsx +2 -2
- package/__generated/components/ui/input.tsx +17 -18
- package/__generated/components/ui/label.tsx +20 -21
- package/__generated/components/ui/menubar.tsx +44 -46
- package/__generated/components/ui/navigation-menu.tsx +13 -13
- package/__generated/components/ui/popover.tsx +4 -4
- package/__generated/components/ui/progress.tsx +3 -3
- package/__generated/components/ui/radio-group.tsx +27 -29
- package/__generated/components/ui/select.tsx +63 -74
- package/__generated/components/ui/separator.tsx +16 -17
- package/__generated/components/ui/switch.tsx +58 -59
- package/__generated/components/ui/table.tsx +69 -76
- package/__generated/components/ui/tabs.tsx +49 -52
- package/__generated/components/ui/textarea.tsx +20 -21
- package/__generated/components/ui/toggle-group.tsx +4 -6
- package/__generated/components/ui/toggle.tsx +4 -4
- package/__generated/components/ui/tooltip.tsx +4 -4
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,38 +1,36 @@
|
|
|
1
|
+
import * as RadioGroupPrimitive from '@rn-primitives/radio-group';
|
|
1
2
|
import * as React from 'react';
|
|
2
3
|
import { View } from 'react-native';
|
|
3
|
-
import * as RadioGroupPrimitive from '@rn-primitives/radio-group';
|
|
4
4
|
import { cn } from '../../lib/utils';
|
|
5
5
|
|
|
6
|
-
const RadioGroup = React.forwardRef<
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
});
|
|
6
|
+
const RadioGroup = React.forwardRef<RadioGroupPrimitive.RootRef, RadioGroupPrimitive.RootProps>(
|
|
7
|
+
({ className, ...props }, ref) => {
|
|
8
|
+
return (
|
|
9
|
+
<RadioGroupPrimitive.Root className={cn('web:grid gap-2', className)} {...props} ref={ref} />
|
|
10
|
+
);
|
|
11
|
+
}
|
|
12
|
+
);
|
|
14
13
|
RadioGroup.displayName = RadioGroupPrimitive.Root.displayName;
|
|
15
14
|
|
|
16
|
-
const RadioGroupItem = React.forwardRef<
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
});
|
|
15
|
+
const RadioGroupItem = React.forwardRef<RadioGroupPrimitive.ItemRef, RadioGroupPrimitive.ItemProps>(
|
|
16
|
+
({ className, ...props }, ref) => {
|
|
17
|
+
return (
|
|
18
|
+
<RadioGroupPrimitive.Item
|
|
19
|
+
ref={ref}
|
|
20
|
+
className={cn(
|
|
21
|
+
'aspect-square h-4 w-4 native:h-5 native:w-5 rounded-full justify-center items-center border border-primary text-primary web:ring-offset-background web:focus:outline-none web:focus-visible:ring-2 web:focus-visible:ring-ring web:focus-visible:ring-offset-2',
|
|
22
|
+
props.disabled && 'web:cursor-not-allowed opacity-50',
|
|
23
|
+
className
|
|
24
|
+
)}
|
|
25
|
+
{...props}
|
|
26
|
+
>
|
|
27
|
+
<RadioGroupPrimitive.Indicator className='flex items-center justify-center'>
|
|
28
|
+
<View className='aspect-square h-[9px] w-[9px] native:h-[10] native:w-[10] bg-primary rounded-full' />
|
|
29
|
+
</RadioGroupPrimitive.Indicator>
|
|
30
|
+
</RadioGroupPrimitive.Item>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
);
|
|
36
34
|
RadioGroupItem.displayName = RadioGroupPrimitive.Item.displayName;
|
|
37
35
|
|
|
38
36
|
export { RadioGroup, RadioGroupItem };
|
|
@@ -15,32 +15,28 @@ const SelectGroup = SelectPrimitive.Group;
|
|
|
15
15
|
|
|
16
16
|
const SelectValue = SelectPrimitive.Value;
|
|
17
17
|
|
|
18
|
-
const SelectTrigger = React.forwardRef<
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
));
|
|
18
|
+
const SelectTrigger = React.forwardRef<SelectPrimitive.TriggerRef, SelectPrimitive.TriggerProps>(
|
|
19
|
+
({ className, children, ...props }, ref) => (
|
|
20
|
+
<SelectPrimitive.Trigger
|
|
21
|
+
ref={ref}
|
|
22
|
+
className={cn(
|
|
23
|
+
'flex flex-row h-10 native:h-12 items-center text-sm justify-between rounded-md border border-input bg-background px-3 py-2 web:ring-offset-background text-muted-foreground web:focus:outline-none web:focus:ring-2 web:focus:ring-ring web:focus:ring-offset-2 [&>span]:line-clamp-1',
|
|
24
|
+
props.disabled && 'web:cursor-not-allowed opacity-50',
|
|
25
|
+
className
|
|
26
|
+
)}
|
|
27
|
+
{...props}
|
|
28
|
+
>
|
|
29
|
+
<>{children}</>
|
|
30
|
+
<ChevronDown size={16} aria-hidden={true} className='text-foreground opacity-50' />
|
|
31
|
+
</SelectPrimitive.Trigger>
|
|
32
|
+
)
|
|
33
|
+
);
|
|
35
34
|
SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
|
|
36
35
|
|
|
37
36
|
/**
|
|
38
37
|
* Platform: WEB ONLY
|
|
39
38
|
*/
|
|
40
|
-
const SelectScrollUpButton = ({
|
|
41
|
-
className,
|
|
42
|
-
...props
|
|
43
|
-
}: React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollUpButton>) => {
|
|
39
|
+
const SelectScrollUpButton = ({ className, ...props }: SelectPrimitive.ScrollUpButtonProps) => {
|
|
44
40
|
if (Platform.OS !== 'web') {
|
|
45
41
|
return null;
|
|
46
42
|
}
|
|
@@ -57,10 +53,7 @@ const SelectScrollUpButton = ({
|
|
|
57
53
|
/**
|
|
58
54
|
* Platform: WEB ONLY
|
|
59
55
|
*/
|
|
60
|
-
const SelectScrollDownButton = ({
|
|
61
|
-
className,
|
|
62
|
-
...props
|
|
63
|
-
}: React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollDownButton>) => {
|
|
56
|
+
const SelectScrollDownButton = ({ className, ...props }: SelectPrimitive.ScrollDownButtonProps) => {
|
|
64
57
|
if (Platform.OS !== 'web') {
|
|
65
58
|
return null;
|
|
66
59
|
}
|
|
@@ -75,8 +68,8 @@ const SelectScrollDownButton = ({
|
|
|
75
68
|
};
|
|
76
69
|
|
|
77
70
|
const SelectContent = React.forwardRef<
|
|
78
|
-
|
|
79
|
-
|
|
71
|
+
SelectPrimitive.ContentRef,
|
|
72
|
+
SelectPrimitive.ContentProps & { portalHost?: string }
|
|
80
73
|
>(({ className, children, position = 'popper', portalHost, ...props }, ref) => {
|
|
81
74
|
const { open } = SelectPrimitive.useRootContext();
|
|
82
75
|
|
|
@@ -99,17 +92,15 @@ const SelectContent = React.forwardRef<
|
|
|
99
92
|
{...props}
|
|
100
93
|
>
|
|
101
94
|
<SelectScrollUpButton />
|
|
102
|
-
<
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
</SelectPrimitive.Viewport>
|
|
112
|
-
</View>
|
|
95
|
+
<SelectPrimitive.Viewport
|
|
96
|
+
className={cn(
|
|
97
|
+
'p-1',
|
|
98
|
+
position === 'popper' &&
|
|
99
|
+
'h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]'
|
|
100
|
+
)}
|
|
101
|
+
>
|
|
102
|
+
{children}
|
|
103
|
+
</SelectPrimitive.Viewport>
|
|
113
104
|
<SelectScrollDownButton />
|
|
114
105
|
</SelectPrimitive.Content>
|
|
115
106
|
</Animated.View>
|
|
@@ -119,47 +110,45 @@ const SelectContent = React.forwardRef<
|
|
|
119
110
|
});
|
|
120
111
|
SelectContent.displayName = SelectPrimitive.Content.displayName;
|
|
121
112
|
|
|
122
|
-
const SelectLabel = React.forwardRef<
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
));
|
|
113
|
+
const SelectLabel = React.forwardRef<SelectPrimitive.LabelRef, SelectPrimitive.LabelProps>(
|
|
114
|
+
({ className, ...props }, ref) => (
|
|
115
|
+
<SelectPrimitive.Label
|
|
116
|
+
ref={ref}
|
|
117
|
+
className={cn(
|
|
118
|
+
'py-1.5 native:pb-2 pl-8 native:pl-10 pr-2 text-popover-foreground text-sm native:text-base font-semibold',
|
|
119
|
+
className
|
|
120
|
+
)}
|
|
121
|
+
{...props}
|
|
122
|
+
/>
|
|
123
|
+
)
|
|
124
|
+
);
|
|
135
125
|
SelectLabel.displayName = SelectPrimitive.Label.displayName;
|
|
136
126
|
|
|
137
|
-
const SelectItem = React.forwardRef<
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
</
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
));
|
|
127
|
+
const SelectItem = React.forwardRef<SelectPrimitive.ItemRef, SelectPrimitive.ItemProps>(
|
|
128
|
+
({ className, children, ...props }, ref) => (
|
|
129
|
+
<SelectPrimitive.Item
|
|
130
|
+
ref={ref}
|
|
131
|
+
className={cn(
|
|
132
|
+
'relative web:group flex flex-row w-full web:cursor-default web:select-none items-center rounded-sm py-1.5 native:py-2 pl-8 native:pl-10 pr-2 web:hover:bg-accent/50 active:bg-accent web:outline-none web:focus:bg-accent',
|
|
133
|
+
props.disabled && 'web:pointer-events-none opacity-50',
|
|
134
|
+
className
|
|
135
|
+
)}
|
|
136
|
+
{...props}
|
|
137
|
+
>
|
|
138
|
+
<View className='absolute left-2 native:left-3.5 flex h-3.5 native:pt-px w-3.5 items-center justify-center'>
|
|
139
|
+
<SelectPrimitive.ItemIndicator>
|
|
140
|
+
<Check size={16} strokeWidth={3} className='text-popover-foreground' />
|
|
141
|
+
</SelectPrimitive.ItemIndicator>
|
|
142
|
+
</View>
|
|
143
|
+
<SelectPrimitive.ItemText className='text-sm native:text-lg text-popover-foreground native:text-base web:group-focus:text-accent-foreground' />
|
|
144
|
+
</SelectPrimitive.Item>
|
|
145
|
+
)
|
|
146
|
+
);
|
|
158
147
|
SelectItem.displayName = SelectPrimitive.Item.displayName;
|
|
159
148
|
|
|
160
149
|
const SelectSeparator = React.forwardRef<
|
|
161
|
-
|
|
162
|
-
|
|
150
|
+
SelectPrimitive.SeparatorRef,
|
|
151
|
+
SelectPrimitive.SeparatorProps
|
|
163
152
|
>(({ className, ...props }, ref) => (
|
|
164
153
|
<SelectPrimitive.Separator
|
|
165
154
|
ref={ref}
|
|
@@ -1,23 +1,22 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
1
|
import * as SeparatorPrimitive from '@rn-primitives/separator';
|
|
2
|
+
import * as React from 'react';
|
|
3
3
|
import { cn } from '../../lib/utils';
|
|
4
4
|
|
|
5
|
-
const Separator = React.forwardRef<
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
));
|
|
5
|
+
const Separator = React.forwardRef<SeparatorPrimitive.RootRef, SeparatorPrimitive.RootProps>(
|
|
6
|
+
({ className, orientation = 'horizontal', decorative = true, ...props }, ref) => (
|
|
7
|
+
<SeparatorPrimitive.Root
|
|
8
|
+
ref={ref}
|
|
9
|
+
decorative={decorative}
|
|
10
|
+
orientation={orientation}
|
|
11
|
+
className={cn(
|
|
12
|
+
'shrink-0 bg-border',
|
|
13
|
+
orientation === 'horizontal' ? 'h-[1px] w-full' : 'h-full w-[1px]',
|
|
14
|
+
className
|
|
15
|
+
)}
|
|
16
|
+
{...props}
|
|
17
|
+
/>
|
|
18
|
+
)
|
|
19
|
+
);
|
|
21
20
|
Separator.displayName = SeparatorPrimitive.Root.displayName;
|
|
22
21
|
|
|
23
22
|
export { Separator };
|
|
@@ -10,28 +10,27 @@ import Animated, {
|
|
|
10
10
|
import { useColorScheme } from '../../lib/useColorScheme';
|
|
11
11
|
import { cn } from '../../lib/utils';
|
|
12
12
|
|
|
13
|
-
const SwitchWeb = React.forwardRef<
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
>(({ className, ...props }, ref) => (
|
|
17
|
-
<SwitchPrimitives.Root
|
|
18
|
-
className={cn(
|
|
19
|
-
'peer flex-row h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed',
|
|
20
|
-
props.checked ? 'bg-primary' : 'bg-input',
|
|
21
|
-
props.disabled && 'opacity-50',
|
|
22
|
-
className
|
|
23
|
-
)}
|
|
24
|
-
{...props}
|
|
25
|
-
ref={ref}
|
|
26
|
-
>
|
|
27
|
-
<SwitchPrimitives.Thumb
|
|
13
|
+
const SwitchWeb = React.forwardRef<SwitchPrimitives.RootRef, SwitchPrimitives.RootProps>(
|
|
14
|
+
({ className, ...props }, ref) => (
|
|
15
|
+
<SwitchPrimitives.Root
|
|
28
16
|
className={cn(
|
|
29
|
-
'
|
|
30
|
-
props.checked ? '
|
|
17
|
+
'peer flex-row h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed',
|
|
18
|
+
props.checked ? 'bg-primary' : 'bg-input',
|
|
19
|
+
props.disabled && 'opacity-50',
|
|
20
|
+
className
|
|
31
21
|
)}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
22
|
+
{...props}
|
|
23
|
+
ref={ref}
|
|
24
|
+
>
|
|
25
|
+
<SwitchPrimitives.Thumb
|
|
26
|
+
className={cn(
|
|
27
|
+
'pointer-events-none block h-5 w-5 rounded-full bg-background shadow-md shadow-foreground/5 ring-0 transition-transform',
|
|
28
|
+
props.checked ? 'translate-x-5' : 'translate-x-0'
|
|
29
|
+
)}
|
|
30
|
+
/>
|
|
31
|
+
</SwitchPrimitives.Root>
|
|
32
|
+
)
|
|
33
|
+
);
|
|
35
34
|
|
|
36
35
|
SwitchWeb.displayName = 'SwitchWeb';
|
|
37
36
|
|
|
@@ -46,46 +45,46 @@ const RGB_COLORS = {
|
|
|
46
45
|
},
|
|
47
46
|
} as const;
|
|
48
47
|
|
|
49
|
-
const SwitchNative = React.forwardRef<
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
style={animatedRootStyle}
|
|
70
|
-
className={cn('h-8 w-[46px] rounded-full', props.disabled && 'opacity-50')}
|
|
71
|
-
>
|
|
72
|
-
<SwitchPrimitives.Root
|
|
73
|
-
className={cn(
|
|
74
|
-
'flex-row h-8 w-[46px] shrink-0 items-center rounded-full border-2 border-transparent',
|
|
75
|
-
className
|
|
76
|
-
)}
|
|
77
|
-
{...props}
|
|
78
|
-
ref={ref}
|
|
48
|
+
const SwitchNative = React.forwardRef<SwitchPrimitives.RootRef, SwitchPrimitives.RootProps>(
|
|
49
|
+
({ className, ...props }, ref) => {
|
|
50
|
+
const { colorScheme } = useColorScheme();
|
|
51
|
+
const translateX = useDerivedValue(() => (props.checked ? 18 : 0));
|
|
52
|
+
const animatedRootStyle = useAnimatedStyle(() => {
|
|
53
|
+
return {
|
|
54
|
+
backgroundColor: interpolateColor(
|
|
55
|
+
translateX.value,
|
|
56
|
+
[0, 18],
|
|
57
|
+
[RGB_COLORS[colorScheme].input, RGB_COLORS[colorScheme].primary]
|
|
58
|
+
),
|
|
59
|
+
};
|
|
60
|
+
});
|
|
61
|
+
const animatedThumbStyle = useAnimatedStyle(() => ({
|
|
62
|
+
transform: [{ translateX: withTiming(translateX.value, { duration: 200 }) }],
|
|
63
|
+
}));
|
|
64
|
+
return (
|
|
65
|
+
<Animated.View
|
|
66
|
+
style={animatedRootStyle}
|
|
67
|
+
className={cn('h-8 w-[46px] rounded-full', props.disabled && 'opacity-50')}
|
|
79
68
|
>
|
|
80
|
-
<
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
69
|
+
<SwitchPrimitives.Root
|
|
70
|
+
className={cn(
|
|
71
|
+
'flex-row h-8 w-[46px] shrink-0 items-center rounded-full border-2 border-transparent',
|
|
72
|
+
props.checked ? 'bg-primary' : 'bg-input',
|
|
73
|
+
className
|
|
74
|
+
)}
|
|
75
|
+
{...props}
|
|
76
|
+
ref={ref}
|
|
77
|
+
>
|
|
78
|
+
<Animated.View style={animatedThumbStyle}>
|
|
79
|
+
<SwitchPrimitives.Thumb
|
|
80
|
+
className={'h-7 w-7 rounded-full bg-background shadow-md shadow-foreground/25 ring-0'}
|
|
81
|
+
/>
|
|
82
|
+
</Animated.View>
|
|
83
|
+
</SwitchPrimitives.Root>
|
|
84
|
+
</Animated.View>
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
);
|
|
89
88
|
SwitchNative.displayName = 'SwitchNative';
|
|
90
89
|
|
|
91
90
|
const Switch = Platform.select({
|
|
@@ -1,99 +1,92 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
1
|
import * as TablePrimitive from '@rn-primitives/table';
|
|
2
|
+
import * as React from 'react';
|
|
3
3
|
import { cn } from '../../lib/utils';
|
|
4
4
|
import { TextClassContext } from './text';
|
|
5
5
|
|
|
6
|
-
const Table = React.forwardRef<
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
));
|
|
6
|
+
const Table = React.forwardRef<TablePrimitive.RootRef, TablePrimitive.RootProps>(
|
|
7
|
+
({ className, ...props }, ref) => (
|
|
8
|
+
<TablePrimitive.Root
|
|
9
|
+
ref={ref}
|
|
10
|
+
className={cn('w-full caption-bottom text-sm', className)}
|
|
11
|
+
{...props}
|
|
12
|
+
/>
|
|
13
|
+
)
|
|
14
|
+
);
|
|
16
15
|
Table.displayName = 'Table';
|
|
17
16
|
|
|
18
|
-
const TableHeader = React.forwardRef<
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
));
|
|
17
|
+
const TableHeader = React.forwardRef<TablePrimitive.HeaderRef, TablePrimitive.HeaderProps>(
|
|
18
|
+
({ className, ...props }, ref) => (
|
|
19
|
+
<TablePrimitive.Header
|
|
20
|
+
ref={ref}
|
|
21
|
+
className={cn('border-border [&_tr]:border-b', className)}
|
|
22
|
+
{...props}
|
|
23
|
+
/>
|
|
24
|
+
)
|
|
25
|
+
);
|
|
28
26
|
TableHeader.displayName = 'TableHeader';
|
|
29
27
|
|
|
30
|
-
const TableBody = React.forwardRef<
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
));
|
|
28
|
+
const TableBody = React.forwardRef<TablePrimitive.BodyRef, TablePrimitive.BodyProps>(
|
|
29
|
+
({ className, style, ...props }, ref) => (
|
|
30
|
+
<TablePrimitive.Body
|
|
31
|
+
ref={ref}
|
|
32
|
+
className={cn('flex-1 border-border [&_tr:last-child]:border-0', className)}
|
|
33
|
+
style={[{ minHeight: 2 }, style]}
|
|
34
|
+
{...props}
|
|
35
|
+
/>
|
|
36
|
+
)
|
|
37
|
+
);
|
|
41
38
|
TableBody.displayName = 'TableBody';
|
|
42
39
|
|
|
43
|
-
const TableFooter = React.forwardRef<
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
));
|
|
40
|
+
const TableFooter = React.forwardRef<TablePrimitive.FooterRef, TablePrimitive.FooterProps>(
|
|
41
|
+
({ className, ...props }, ref) => (
|
|
42
|
+
<TablePrimitive.Footer
|
|
43
|
+
ref={ref}
|
|
44
|
+
className={cn('bg-muted/50 font-medium [&>tr]:last:border-b-0', className)}
|
|
45
|
+
{...props}
|
|
46
|
+
/>
|
|
47
|
+
)
|
|
48
|
+
);
|
|
53
49
|
TableFooter.displayName = 'TableFooter';
|
|
54
50
|
|
|
55
|
-
const TableRow = React.forwardRef<
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
>(({ className, ...props }, ref) => (
|
|
59
|
-
<TablePrimitive.Row
|
|
60
|
-
ref={ref}
|
|
61
|
-
className={cn(
|
|
62
|
-
'flex-row border-border border-b web:transition-colors web:hover:bg-muted/50 web:data-[state=selected]:bg-muted',
|
|
63
|
-
className
|
|
64
|
-
)}
|
|
65
|
-
{...props}
|
|
66
|
-
/>
|
|
67
|
-
));
|
|
68
|
-
TableRow.displayName = 'TableRow';
|
|
69
|
-
|
|
70
|
-
const TableHead = React.forwardRef<
|
|
71
|
-
React.ElementRef<typeof TablePrimitive.Head>,
|
|
72
|
-
React.ComponentPropsWithoutRef<typeof TablePrimitive.Head>
|
|
73
|
-
>(({ className, ...props }, ref) => (
|
|
74
|
-
<TextClassContext.Provider value='text-muted-foreground'>
|
|
75
|
-
<TablePrimitive.Head
|
|
51
|
+
const TableRow = React.forwardRef<TablePrimitive.RowRef, TablePrimitive.RowProps>(
|
|
52
|
+
({ className, ...props }, ref) => (
|
|
53
|
+
<TablePrimitive.Row
|
|
76
54
|
ref={ref}
|
|
77
55
|
className={cn(
|
|
78
|
-
'
|
|
56
|
+
'flex-row border-border border-b web:transition-colors web:hover:bg-muted/50 web:data-[state=selected]:bg-muted',
|
|
79
57
|
className
|
|
80
58
|
)}
|
|
81
59
|
{...props}
|
|
82
60
|
/>
|
|
83
|
-
|
|
84
|
-
)
|
|
61
|
+
)
|
|
62
|
+
);
|
|
63
|
+
TableRow.displayName = 'TableRow';
|
|
64
|
+
|
|
65
|
+
const TableHead = React.forwardRef<TablePrimitive.HeadRef, TablePrimitive.HeadProps>(
|
|
66
|
+
({ className, ...props }, ref) => (
|
|
67
|
+
<TextClassContext.Provider value='text-muted-foreground'>
|
|
68
|
+
<TablePrimitive.Head
|
|
69
|
+
ref={ref}
|
|
70
|
+
className={cn(
|
|
71
|
+
'h-12 px-4 text-left justify-center font-medium [&:has([role=checkbox])]:pr-0',
|
|
72
|
+
className
|
|
73
|
+
)}
|
|
74
|
+
{...props}
|
|
75
|
+
/>
|
|
76
|
+
</TextClassContext.Provider>
|
|
77
|
+
)
|
|
78
|
+
);
|
|
85
79
|
TableHead.displayName = 'TableHead';
|
|
86
80
|
|
|
87
|
-
const TableCell = React.forwardRef<
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
));
|
|
81
|
+
const TableCell = React.forwardRef<TablePrimitive.CellRef, TablePrimitive.CellProps>(
|
|
82
|
+
({ className, ...props }, ref) => (
|
|
83
|
+
<TablePrimitive.Cell
|
|
84
|
+
ref={ref}
|
|
85
|
+
className={cn('p-4 align-middle [&:has([role=checkbox])]:pr-0', className)}
|
|
86
|
+
{...props}
|
|
87
|
+
/>
|
|
88
|
+
)
|
|
89
|
+
);
|
|
97
90
|
TableCell.displayName = 'TableCell';
|
|
98
91
|
|
|
99
92
|
export { Table, TableBody, TableCell, TableFooter, TableHead, TableHeader, TableRow };
|