@salesforce/webapp-template-app-react-template-b2x-experimental 1.43.1 → 1.45.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/CHANGELOG.md +16 -0
- package/dist/force-app/main/default/webapplications/appreacttemplateb2x/package-lock.json +1306 -534
- package/dist/force-app/main/default/webapplications/appreacttemplateb2x/package.json +1 -3
- package/dist/force-app/main/default/webapplications/appreacttemplateb2x/src/app.tsx +2 -5
- package/dist/force-app/main/default/webapplications/appreacttemplateb2x/src/components/auth/authHelpers.ts +73 -0
- package/dist/force-app/main/default/webapplications/appreacttemplateb2x/src/{utils → components/auth}/authenticationConfig.ts +9 -0
- package/dist/force-app/main/default/webapplications/appreacttemplateb2x/src/components/auth/{authentication-route.tsx → authenticationRouteLayout.tsx} +1 -1
- package/dist/force-app/main/default/webapplications/appreacttemplateb2x/src/components/auth/{private-route.tsx → privateRouteLayout.tsx} +1 -1
- package/dist/force-app/main/default/webapplications/appreacttemplateb2x/src/components/auth/sessionTimeout/SessionTimeoutValidator.tsx +616 -0
- package/dist/force-app/main/default/webapplications/appreacttemplateb2x/src/components/auth/sessionTimeout/sessionTimeService.ts +161 -0
- package/dist/force-app/main/default/webapplications/appreacttemplateb2x/src/components/auth/sessionTimeout/sessionTimeoutConfig.ts +77 -0
- package/dist/force-app/main/default/webapplications/appreacttemplateb2x/src/components/ui/alert.tsx +17 -13
- package/dist/force-app/main/default/webapplications/appreacttemplateb2x/src/components/ui/button.tsx +35 -22
- package/dist/force-app/main/default/webapplications/appreacttemplateb2x/src/components/ui/card.tsx +27 -12
- package/dist/force-app/main/default/webapplications/appreacttemplateb2x/src/components/ui/dialog.tsx +143 -0
- package/dist/force-app/main/default/webapplications/appreacttemplateb2x/src/components/ui/field.tsx +157 -46
- package/dist/force-app/main/default/webapplications/appreacttemplateb2x/src/components/ui/index.ts +1 -0
- package/dist/force-app/main/default/webapplications/appreacttemplateb2x/src/components/ui/input.tsx +3 -3
- package/dist/force-app/main/default/webapplications/appreacttemplateb2x/src/components/ui/label.tsx +2 -2
- package/dist/force-app/main/default/webapplications/appreacttemplateb2x/src/components/ui/pagination.tsx +87 -74
- package/dist/force-app/main/default/webapplications/appreacttemplateb2x/src/components/ui/select.tsx +156 -124
- package/dist/force-app/main/default/webapplications/appreacttemplateb2x/src/components/ui/separator.tsx +26 -0
- package/dist/force-app/main/default/webapplications/appreacttemplateb2x/src/components/ui/skeleton.tsx +1 -0
- package/dist/force-app/main/default/webapplications/appreacttemplateb2x/src/components/ui/spinner.tsx +5 -16
- package/dist/force-app/main/default/webapplications/appreacttemplateb2x/src/components/ui/table.tsx +68 -95
- package/dist/force-app/main/default/webapplications/appreacttemplateb2x/src/components/ui/tabs.tsx +47 -84
- package/dist/force-app/main/default/webapplications/appreacttemplateb2x/src/context/AuthContext.tsx +12 -0
- package/dist/force-app/main/default/webapplications/appreacttemplateb2x/src/hooks/form.tsx +1 -1
- package/dist/force-app/main/default/webapplications/appreacttemplateb2x/src/hooks/useCountdownTimer.ts +266 -0
- package/dist/force-app/main/default/webapplications/appreacttemplateb2x/src/hooks/useRetryWithBackoff.ts +109 -0
- package/dist/force-app/main/default/webapplications/appreacttemplateb2x/src/layouts/AuthAppLayout.tsx +12 -0
- package/dist/force-app/main/default/webapplications/appreacttemplateb2x/src/pages/ChangePassword.tsx +3 -2
- package/dist/force-app/main/default/webapplications/appreacttemplateb2x/src/pages/ForgotPassword.tsx +1 -1
- package/dist/force-app/main/default/webapplications/appreacttemplateb2x/src/pages/Login.tsx +3 -3
- package/dist/force-app/main/default/webapplications/appreacttemplateb2x/src/pages/Profile.tsx +3 -2
- package/dist/force-app/main/default/webapplications/appreacttemplateb2x/src/pages/Register.tsx +4 -5
- package/dist/force-app/main/default/webapplications/appreacttemplateb2x/src/pages/ResetPassword.tsx +3 -2
- package/dist/force-app/main/default/webapplications/appreacttemplateb2x/src/routes.tsx +4 -4
- package/dist/force-app/main/default/webapplications/appreacttemplateb2x/src/utils/helpers.ts +0 -74
- package/dist/package.json +1 -1
- package/package.json +2 -2
package/dist/force-app/main/default/webapplications/appreacttemplateb2x/src/components/ui/select.tsx
CHANGED
|
@@ -1,151 +1,183 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import
|
|
3
|
-
import { Check, ChevronDown, ChevronUp } from "lucide-react";
|
|
2
|
+
import { Select as SelectPrimitive } from "radix-ui";
|
|
4
3
|
|
|
5
4
|
import { cn } from "../../lib/utils";
|
|
5
|
+
import { ChevronDownIcon, CheckIcon, ChevronUpIcon } from "lucide-react";
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
function Select({ ...props }: React.ComponentProps<typeof SelectPrimitive.Root>) {
|
|
8
|
+
return <SelectPrimitive.Root data-slot="select" {...props} />;
|
|
9
|
+
}
|
|
8
10
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
ref={ref}
|
|
19
|
-
className={cn(
|
|
20
|
-
"flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-xs ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
|
|
21
|
-
className,
|
|
22
|
-
)}
|
|
23
|
-
{...props}
|
|
24
|
-
>
|
|
25
|
-
{children}
|
|
26
|
-
<SelectPrimitive.Icon asChild>
|
|
27
|
-
<ChevronDown 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("flex cursor-default items-center justify-center py-1 bg-white", className)}
|
|
40
|
-
{...props}
|
|
41
|
-
>
|
|
42
|
-
<ChevronUp className="h-4 w-4" />
|
|
43
|
-
</SelectPrimitive.ScrollUpButton>
|
|
44
|
-
));
|
|
45
|
-
SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;
|
|
11
|
+
function SelectGroup({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.Group>) {
|
|
12
|
+
return (
|
|
13
|
+
<SelectPrimitive.Group
|
|
14
|
+
data-slot="select-group"
|
|
15
|
+
className={cn("scroll-my-1 p-1", className)}
|
|
16
|
+
{...props}
|
|
17
|
+
/>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
46
20
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
>(({ className, ...props }, ref) => (
|
|
51
|
-
<SelectPrimitive.ScrollDownButton
|
|
52
|
-
ref={ref}
|
|
53
|
-
className={cn("flex cursor-default items-center justify-center py-1 bg-white", className)}
|
|
54
|
-
{...props}
|
|
55
|
-
>
|
|
56
|
-
<ChevronDown className="h-4 w-4" />
|
|
57
|
-
</SelectPrimitive.ScrollDownButton>
|
|
58
|
-
));
|
|
59
|
-
SelectScrollDownButton.displayName = SelectPrimitive.ScrollDownButton.displayName;
|
|
21
|
+
function SelectValue({ ...props }: React.ComponentProps<typeof SelectPrimitive.Value>) {
|
|
22
|
+
return <SelectPrimitive.Value data-slot="select-value" {...props} />;
|
|
23
|
+
}
|
|
60
24
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
25
|
+
function SelectTrigger({
|
|
26
|
+
className,
|
|
27
|
+
size = "default",
|
|
28
|
+
children,
|
|
29
|
+
...props
|
|
30
|
+
}: React.ComponentProps<typeof SelectPrimitive.Trigger> & {
|
|
31
|
+
size?: "sm" | "default";
|
|
32
|
+
}) {
|
|
33
|
+
return (
|
|
34
|
+
<SelectPrimitive.Trigger
|
|
35
|
+
data-slot="select-trigger"
|
|
36
|
+
data-size={size}
|
|
68
37
|
className={cn(
|
|
69
|
-
"
|
|
70
|
-
position === "popper" &&
|
|
71
|
-
"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
|
|
38
|
+
"border-input data-placeholder:text-muted-foreground dark:bg-input/30 dark:hover:bg-input/50 focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 gap-1.5 rounded-lg border bg-transparent py-2 pr-2 pl-2.5 text-sm transition-colors select-none focus-visible:ring-3 aria-invalid:ring-3 data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] *:data-[slot=select-value]:gap-1.5 [&_svg:not([class*='size-'])]:size-4 flex w-fit items-center justify-between whitespace-nowrap outline-none disabled:cursor-not-allowed disabled:opacity-50 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center [&_svg]:pointer-events-none [&_svg]:shrink-0",
|
|
72
39
|
className,
|
|
73
40
|
)}
|
|
74
|
-
position={position}
|
|
75
41
|
{...props}
|
|
76
42
|
>
|
|
77
|
-
|
|
78
|
-
<SelectPrimitive.
|
|
43
|
+
{children}
|
|
44
|
+
<SelectPrimitive.Icon asChild>
|
|
45
|
+
<ChevronDownIcon className="text-muted-foreground size-4 pointer-events-none" />
|
|
46
|
+
</SelectPrimitive.Icon>
|
|
47
|
+
</SelectPrimitive.Trigger>
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function SelectContent({
|
|
52
|
+
className,
|
|
53
|
+
children,
|
|
54
|
+
position = "item-aligned",
|
|
55
|
+
align = "center",
|
|
56
|
+
...props
|
|
57
|
+
}: React.ComponentProps<typeof SelectPrimitive.Content>) {
|
|
58
|
+
return (
|
|
59
|
+
<SelectPrimitive.Portal>
|
|
60
|
+
<SelectPrimitive.Content
|
|
61
|
+
data-slot="select-content"
|
|
62
|
+
data-align-trigger={position === "item-aligned"}
|
|
79
63
|
className={cn(
|
|
80
|
-
"
|
|
64
|
+
"bg-popover text-popover-foreground data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-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 ring-foreground/10 min-w-36 rounded-lg shadow-md ring-1 duration-100 relative z-50 max-h-(--radix-select-content-available-height) origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto data-[align-trigger=true]:animate-none",
|
|
81
65
|
position === "popper" &&
|
|
82
|
-
"
|
|
66
|
+
"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
|
|
67
|
+
className,
|
|
83
68
|
)}
|
|
69
|
+
position={position}
|
|
70
|
+
align={align}
|
|
71
|
+
{...props}
|
|
84
72
|
>
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
73
|
+
<SelectScrollUpButton />
|
|
74
|
+
<SelectPrimitive.Viewport
|
|
75
|
+
data-position={position}
|
|
76
|
+
className={cn(
|
|
77
|
+
"data-[position=popper]:h-(--radix-select-trigger-height) data-[position=popper]:w-full data-[position=popper]:min-w-(--radix-select-trigger-width)",
|
|
78
|
+
position === "popper" && "",
|
|
79
|
+
)}
|
|
80
|
+
>
|
|
81
|
+
{children}
|
|
82
|
+
</SelectPrimitive.Viewport>
|
|
83
|
+
<SelectScrollDownButton />
|
|
84
|
+
</SelectPrimitive.Content>
|
|
85
|
+
</SelectPrimitive.Portal>
|
|
86
|
+
);
|
|
87
|
+
}
|
|
92
88
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
));
|
|
103
|
-
SelectLabel.displayName = SelectPrimitive.Label.displayName;
|
|
89
|
+
function SelectLabel({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.Label>) {
|
|
90
|
+
return (
|
|
91
|
+
<SelectPrimitive.Label
|
|
92
|
+
data-slot="select-label"
|
|
93
|
+
className={cn("text-muted-foreground px-1.5 py-1 text-xs", className)}
|
|
94
|
+
{...props}
|
|
95
|
+
/>
|
|
96
|
+
);
|
|
97
|
+
}
|
|
104
98
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
"
|
|
113
|
-
className
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
99
|
+
function SelectItem({
|
|
100
|
+
className,
|
|
101
|
+
children,
|
|
102
|
+
...props
|
|
103
|
+
}: React.ComponentProps<typeof SelectPrimitive.Item>) {
|
|
104
|
+
return (
|
|
105
|
+
<SelectPrimitive.Item
|
|
106
|
+
data-slot="select-item"
|
|
107
|
+
className={cn(
|
|
108
|
+
"focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2 relative flex w-full cursor-default items-center outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",
|
|
109
|
+
className,
|
|
110
|
+
)}
|
|
111
|
+
{...props}
|
|
112
|
+
>
|
|
113
|
+
<span className="pointer-events-none absolute right-2 flex size-4 items-center justify-center">
|
|
114
|
+
<SelectPrimitive.ItemIndicator>
|
|
115
|
+
<CheckIcon className="pointer-events-none" />
|
|
116
|
+
</SelectPrimitive.ItemIndicator>
|
|
117
|
+
</span>
|
|
118
|
+
<SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
|
|
119
|
+
</SelectPrimitive.Item>
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
122
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
123
|
+
function SelectSeparator({
|
|
124
|
+
className,
|
|
125
|
+
...props
|
|
126
|
+
}: React.ComponentProps<typeof SelectPrimitive.Separator>) {
|
|
127
|
+
return (
|
|
128
|
+
<SelectPrimitive.Separator
|
|
129
|
+
data-slot="select-separator"
|
|
130
|
+
className={cn("bg-border -mx-1 my-1 h-px pointer-events-none", className)}
|
|
131
|
+
{...props}
|
|
132
|
+
/>
|
|
133
|
+
);
|
|
134
|
+
}
|
|
127
135
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
136
|
+
function SelectScrollUpButton({
|
|
137
|
+
className,
|
|
138
|
+
...props
|
|
139
|
+
}: React.ComponentProps<typeof SelectPrimitive.ScrollUpButton>) {
|
|
140
|
+
return (
|
|
141
|
+
<SelectPrimitive.ScrollUpButton
|
|
142
|
+
data-slot="select-scroll-up-button"
|
|
143
|
+
className={cn(
|
|
144
|
+
"bg-popover z-10 flex cursor-default items-center justify-center py-1 [&_svg:not([class*='size-'])]:size-4",
|
|
145
|
+
className,
|
|
146
|
+
)}
|
|
147
|
+
{...props}
|
|
148
|
+
>
|
|
149
|
+
<ChevronUpIcon />
|
|
150
|
+
</SelectPrimitive.ScrollUpButton>
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
function SelectScrollDownButton({
|
|
155
|
+
className,
|
|
156
|
+
...props
|
|
157
|
+
}: React.ComponentProps<typeof SelectPrimitive.ScrollDownButton>) {
|
|
158
|
+
return (
|
|
159
|
+
<SelectPrimitive.ScrollDownButton
|
|
160
|
+
data-slot="select-scroll-down-button"
|
|
161
|
+
className={cn(
|
|
162
|
+
"bg-popover z-10 flex cursor-default items-center justify-center py-1 [&_svg:not([class*='size-'])]:size-4",
|
|
163
|
+
className,
|
|
164
|
+
)}
|
|
165
|
+
{...props}
|
|
166
|
+
>
|
|
167
|
+
<ChevronDownIcon />
|
|
168
|
+
</SelectPrimitive.ScrollDownButton>
|
|
169
|
+
);
|
|
170
|
+
}
|
|
139
171
|
|
|
140
172
|
export {
|
|
141
173
|
Select,
|
|
142
|
-
SelectGroup,
|
|
143
|
-
SelectValue,
|
|
144
|
-
SelectTrigger,
|
|
145
174
|
SelectContent,
|
|
146
|
-
|
|
175
|
+
SelectGroup,
|
|
147
176
|
SelectItem,
|
|
148
|
-
|
|
149
|
-
SelectScrollUpButton,
|
|
177
|
+
SelectLabel,
|
|
150
178
|
SelectScrollDownButton,
|
|
179
|
+
SelectScrollUpButton,
|
|
180
|
+
SelectSeparator,
|
|
181
|
+
SelectTrigger,
|
|
182
|
+
SelectValue,
|
|
151
183
|
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Separator as SeparatorPrimitive } from "radix-ui";
|
|
3
|
+
|
|
4
|
+
import { cn } from "../../lib/utils";
|
|
5
|
+
|
|
6
|
+
function Separator({
|
|
7
|
+
className,
|
|
8
|
+
orientation = "horizontal",
|
|
9
|
+
decorative = true,
|
|
10
|
+
...props
|
|
11
|
+
}: React.ComponentProps<typeof SeparatorPrimitive.Root>) {
|
|
12
|
+
return (
|
|
13
|
+
<SeparatorPrimitive.Root
|
|
14
|
+
data-slot="separator"
|
|
15
|
+
decorative={decorative}
|
|
16
|
+
orientation={orientation}
|
|
17
|
+
className={cn(
|
|
18
|
+
"bg-border shrink-0 data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch",
|
|
19
|
+
className,
|
|
20
|
+
)}
|
|
21
|
+
{...props}
|
|
22
|
+
/>
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export { Separator };
|
|
@@ -1,26 +1,15 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { LoaderIcon } from "lucide-react";
|
|
3
|
-
|
|
4
1
|
import { cn } from "../../lib/utils";
|
|
2
|
+
import { Loader2Icon } from "lucide-react";
|
|
5
3
|
|
|
6
|
-
|
|
7
|
-
{ className, ...props },
|
|
8
|
-
ref,
|
|
9
|
-
) {
|
|
4
|
+
function Spinner({ className, ...props }: React.ComponentProps<"svg">) {
|
|
10
5
|
return (
|
|
11
|
-
<
|
|
12
|
-
ref={ref}
|
|
6
|
+
<Loader2Icon
|
|
13
7
|
role="status"
|
|
14
8
|
aria-label="Loading"
|
|
15
|
-
className={cn(
|
|
16
|
-
"size-4 animate-spin",
|
|
17
|
-
// A11y: Respect user's motion preferences
|
|
18
|
-
"motion-reduce:animate-none",
|
|
19
|
-
className,
|
|
20
|
-
)}
|
|
9
|
+
className={cn("size-4 animate-spin", className)}
|
|
21
10
|
{...props}
|
|
22
11
|
/>
|
|
23
12
|
);
|
|
24
|
-
}
|
|
13
|
+
}
|
|
25
14
|
|
|
26
15
|
export { Spinner };
|
package/dist/force-app/main/default/webapplications/appreacttemplateb2x/src/components/ui/table.tsx
CHANGED
|
@@ -1,114 +1,87 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { cn } from "../../lib/utils";
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
* Shadcn-style Table components
|
|
6
|
-
* These components follow shadcn/ui patterns for consistent styling
|
|
7
|
-
*/
|
|
3
|
+
import { cn } from "../../lib/utils";
|
|
8
4
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
<div className="relative w-full overflow-auto">
|
|
12
|
-
<table
|
|
5
|
+
function Table({ className, ...props }: React.ComponentProps<"table">) {
|
|
6
|
+
return (
|
|
7
|
+
<div data-slot="table-container" className="relative w-full overflow-x-auto">
|
|
8
|
+
<table
|
|
9
|
+
data-slot="table"
|
|
10
|
+
className={cn("w-full caption-bottom text-sm", className)}
|
|
11
|
+
{...props}
|
|
12
|
+
/>
|
|
13
13
|
</div>
|
|
14
|
-
)
|
|
15
|
-
|
|
16
|
-
Table.displayName = "Table";
|
|
17
|
-
|
|
18
|
-
const TableHeader = React.forwardRef<
|
|
19
|
-
HTMLTableSectionElement,
|
|
20
|
-
React.HTMLAttributes<HTMLTableSectionElement>
|
|
21
|
-
>(({ className, ...props }, ref) => (
|
|
22
|
-
<thead
|
|
23
|
-
ref={ref}
|
|
24
|
-
className={cn(
|
|
25
|
-
// 1. Existing border style
|
|
26
|
-
"[&_tr]:border-b",
|
|
14
|
+
);
|
|
15
|
+
}
|
|
27
16
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
"[&_th]:sticky [&_th]:top-0 [&_th]:z-10",
|
|
32
|
-
// 3. CRITICAL: Add background color
|
|
33
|
-
// Without this, content scrolls "under" the transparent text
|
|
34
|
-
"[&_th]:bg-background",
|
|
17
|
+
function TableHeader({ className, ...props }: React.ComponentProps<"thead">) {
|
|
18
|
+
return <thead data-slot="table-header" className={cn("[&_tr]:border-b", className)} {...props} />;
|
|
19
|
+
}
|
|
35
20
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
const TableBody = React.forwardRef<
|
|
46
|
-
HTMLTableSectionElement,
|
|
47
|
-
React.HTMLAttributes<HTMLTableSectionElement>
|
|
48
|
-
>(({ className, ...props }, ref) => (
|
|
49
|
-
<tbody ref={ref} className={cn("[&_tr:last-child]:border-0", className)} {...props} />
|
|
50
|
-
));
|
|
51
|
-
TableBody.displayName = "TableBody";
|
|
21
|
+
function TableBody({ className, ...props }: React.ComponentProps<"tbody">) {
|
|
22
|
+
return (
|
|
23
|
+
<tbody
|
|
24
|
+
data-slot="table-body"
|
|
25
|
+
className={cn("[&_tr:last-child]:border-0", className)}
|
|
26
|
+
{...props}
|
|
27
|
+
/>
|
|
28
|
+
);
|
|
29
|
+
}
|
|
52
30
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
));
|
|
63
|
-
TableFooter.displayName = "TableFooter";
|
|
31
|
+
function TableFooter({ className, ...props }: React.ComponentProps<"tfoot">) {
|
|
32
|
+
return (
|
|
33
|
+
<tfoot
|
|
34
|
+
data-slot="table-footer"
|
|
35
|
+
className={cn("bg-muted/50 border-t font-medium [&>tr]:last:border-b-0", className)}
|
|
36
|
+
{...props}
|
|
37
|
+
/>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
64
40
|
|
|
65
|
-
|
|
66
|
-
|
|
41
|
+
function TableRow({ className, ...props }: React.ComponentProps<"tr">) {
|
|
42
|
+
return (
|
|
67
43
|
<tr
|
|
68
|
-
|
|
44
|
+
data-slot="table-row"
|
|
69
45
|
className={cn(
|
|
70
|
-
"
|
|
46
|
+
"hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",
|
|
71
47
|
className,
|
|
72
48
|
)}
|
|
73
49
|
{...props}
|
|
74
50
|
/>
|
|
75
|
-
)
|
|
76
|
-
|
|
77
|
-
TableRow.displayName = "TableRow";
|
|
51
|
+
);
|
|
52
|
+
}
|
|
78
53
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
));
|
|
92
|
-
TableHead.displayName = "TableHead";
|
|
54
|
+
function TableHead({ className, ...props }: React.ComponentProps<"th">) {
|
|
55
|
+
return (
|
|
56
|
+
<th
|
|
57
|
+
data-slot="table-head"
|
|
58
|
+
className={cn(
|
|
59
|
+
"text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0",
|
|
60
|
+
className,
|
|
61
|
+
)}
|
|
62
|
+
{...props}
|
|
63
|
+
/>
|
|
64
|
+
);
|
|
65
|
+
}
|
|
93
66
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
));
|
|
104
|
-
TableCell.displayName = "TableCell";
|
|
67
|
+
function TableCell({ className, ...props }: React.ComponentProps<"td">) {
|
|
68
|
+
return (
|
|
69
|
+
<td
|
|
70
|
+
data-slot="table-cell"
|
|
71
|
+
className={cn("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0", className)}
|
|
72
|
+
{...props}
|
|
73
|
+
/>
|
|
74
|
+
);
|
|
75
|
+
}
|
|
105
76
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
77
|
+
function TableCaption({ className, ...props }: React.ComponentProps<"caption">) {
|
|
78
|
+
return (
|
|
79
|
+
<caption
|
|
80
|
+
data-slot="table-caption"
|
|
81
|
+
className={cn("text-muted-foreground mt-4 text-sm", className)}
|
|
82
|
+
{...props}
|
|
83
|
+
/>
|
|
84
|
+
);
|
|
85
|
+
}
|
|
113
86
|
|
|
114
87
|
export { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption };
|