@oaiz/app-kit 0.0.0-stage → 0.1.4128
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/LICENSE +21 -0
- package/README.md +143 -2
- package/THIRD_PARTY_NOTICES.md +76 -0
- package/package.json +139 -4
- package/registry.json +1847 -0
- package/src/components/activity-timeline.tsx +227 -0
- package/src/components/app-shell.tsx +622 -0
- package/src/components/bar-list.tsx +47 -0
- package/src/components/board.tsx +700 -0
- package/src/components/calendar-view.tsx +1388 -0
- package/src/components/card-grid.tsx +462 -0
- package/src/components/charts.tsx +701 -0
- package/src/components/chat-markdown.tsx +230 -0
- package/src/components/chat-panel.tsx +760 -0
- package/src/components/code-editor.tsx +276 -0
- package/src/components/collection-controls.tsx +226 -0
- package/src/components/command-palette.tsx +403 -0
- package/src/components/confirm-action.tsx +123 -0
- package/src/components/data-table.tsx +821 -0
- package/src/components/date-input.tsx +429 -0
- package/src/components/empty-state.tsx +31 -0
- package/src/components/error-state.tsx +37 -0
- package/src/components/file-upload.tsx +595 -0
- package/src/components/filter-bar.tsx +415 -0
- package/src/components/grouped-picker.tsx +250 -0
- package/src/components/line-items.tsx +601 -0
- package/src/components/list-view.tsx +491 -0
- package/src/components/metrics.tsx +53 -0
- package/src/components/page-header.tsx +33 -0
- package/src/components/property-picker.tsx +546 -0
- package/src/components/record-detail.tsx +416 -0
- package/src/components/record-form.tsx +295 -0
- package/src/components/record-name.tsx +85 -0
- package/src/components/save-bar.tsx +142 -0
- package/src/components/sign-in.tsx +179 -0
- package/src/components/split-view.tsx +128 -0
- package/src/components/status-dot.tsx +56 -0
- package/src/components/stepper.tsx +153 -0
- package/src/components/text-diff-model.ts +111 -0
- package/src/components/text-diff.tsx +98 -0
- package/src/components/time-zone-picker.tsx +69 -0
- package/src/components/ui/accordion.tsx +138 -0
- package/src/components/ui/alert-dialog.tsx +67 -0
- package/src/components/ui/alert.tsx +65 -0
- package/src/components/ui/avatar-group.tsx +119 -0
- package/src/components/ui/avatar.tsx +55 -0
- package/src/components/ui/badge.tsx +59 -0
- package/src/components/ui/bottom-navigation.tsx +102 -0
- package/src/components/ui/breadcrumb.tsx +117 -0
- package/src/components/ui/button.tsx +71 -0
- package/src/components/ui/card.tsx +95 -0
- package/src/components/ui/checkbox.tsx +31 -0
- package/src/components/ui/collapsible.tsx +27 -0
- package/src/components/ui/context-menu.tsx +270 -0
- package/src/components/ui/count-up.tsx +136 -0
- package/src/components/ui/detail-disclosure-section.tsx +109 -0
- package/src/components/ui/dialog.tsx +157 -0
- package/src/components/ui/dropdown-menu.tsx +273 -0
- package/src/components/ui/form-field.tsx +155 -0
- package/src/components/ui/heading.tsx +126 -0
- package/src/components/ui/hover-card.tsx +45 -0
- package/src/components/ui/input.tsx +50 -0
- package/src/components/ui/label.tsx +30 -0
- package/src/components/ui/orb-spinner.tsx +238 -0
- package/src/components/ui/popover.tsx +59 -0
- package/src/components/ui/progress-ring.tsx +125 -0
- package/src/components/ui/progress.tsx +38 -0
- package/src/components/ui/radio-group.tsx +124 -0
- package/src/components/ui/resizable.tsx +48 -0
- package/src/components/ui/scroll-fade.tsx +98 -0
- package/src/components/ui/segmented-control.tsx +70 -0
- package/src/components/ui/select.tsx +230 -0
- package/src/components/ui/separator.tsx +29 -0
- package/src/components/ui/sheet.tsx +170 -0
- package/src/components/ui/shimmer-text.tsx +87 -0
- package/src/components/ui/shortcut.tsx +39 -0
- package/src/components/ui/skeleton.tsx +15 -0
- package/src/components/ui/slider.tsx +48 -0
- package/src/components/ui/switch.tsx +44 -0
- package/src/components/ui/table.tsx +119 -0
- package/src/components/ui/tabs.tsx +80 -0
- package/src/components/ui/text.tsx +93 -0
- package/src/components/ui/textarea.tsx +51 -0
- package/src/components/ui/toast.tsx +141 -0
- package/src/components/ui/toaster.tsx +40 -0
- package/src/components/ui/tooltip.tsx +38 -0
- package/src/components/ui/top-banner.tsx +108 -0
- package/src/components/ui/tree-view.tsx +215 -0
- package/src/components/ui/use-toast.tsx +184 -0
- package/src/components/ui/voice-orb.tsx +252 -0
- package/src/hooks/oaiz-chat.tsx +530 -0
- package/src/hooks/oaiz-data.tsx +617 -0
- package/src/hooks/oaiz-session.tsx +63 -0
- package/src/hooks/use-arrivals.ts +19 -0
- package/src/hooks/use-breakpoint.ts +100 -0
- package/src/hooks/use-media-query.ts +36 -0
- package/src/hooks/use-theme.ts +67 -0
- package/src/hooks/use-url-state.ts +77 -0
- package/src/lib/breakpoints.ts +81 -0
- package/src/lib/csp-nonce.ts +15 -0
- package/src/lib/format.ts +291 -0
- package/src/lib/speech-level.ts +118 -0
- package/src/lib/utils.ts +109 -0
- package/src/styles/oaiz/app.css +21 -0
- package/src/styles/oaiz/scrollbars.css +20 -0
- package/src/styles/oaiz/tokens.css +952 -0
- package/src/styles/oaiz/voice-orb.css +39 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { cn } from '../../lib/utils';
|
|
2
|
+
import { Text } from './text';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* A single key in a keyboard shortcut. Renders a `<kbd>` element, so the
|
|
6
|
+
* markup stays semantic even though the component is named for its purpose.
|
|
7
|
+
*/
|
|
8
|
+
function ShortcutKey({ className, ...props }: React.ComponentProps<'kbd'>) {
|
|
9
|
+
return (
|
|
10
|
+
<Text
|
|
11
|
+
asChild
|
|
12
|
+
size="xs"
|
|
13
|
+
weight="medium"
|
|
14
|
+
variant="muted"
|
|
15
|
+
leading="none"
|
|
16
|
+
className={cn(
|
|
17
|
+
'pointer-events-none inline-flex h-5 w-fit min-w-5 select-none items-center justify-center gap-1 rounded-sm bg-muted px-1',
|
|
18
|
+
"[&_svg:not([class*='size-'])]:size-3",
|
|
19
|
+
'[[data-slot=tooltip-content]_&]:bg-background/20 [[data-slot=tooltip-content]_&]:text-background dark:[[data-slot=tooltip-content]_&]:bg-background/10',
|
|
20
|
+
className,
|
|
21
|
+
)}
|
|
22
|
+
>
|
|
23
|
+
<kbd data-slot="shortcut-key" {...props} />
|
|
24
|
+
</Text>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** Groups the keys of one shortcut, e.g. ⌘ + K. */
|
|
29
|
+
function Shortcut({ className, ...props }: React.ComponentProps<'div'>) {
|
|
30
|
+
return (
|
|
31
|
+
<kbd
|
|
32
|
+
data-slot="shortcut"
|
|
33
|
+
className={cn('inline-flex items-center gap-1', className)}
|
|
34
|
+
{...props}
|
|
35
|
+
/>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export { ShortcutKey, Shortcut };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { cn } from '../../lib/utils';
|
|
2
|
+
|
|
3
|
+
function Skeleton({
|
|
4
|
+
className,
|
|
5
|
+
...props
|
|
6
|
+
}: React.HTMLAttributes<HTMLDivElement>) {
|
|
7
|
+
return (
|
|
8
|
+
<div
|
|
9
|
+
className={cn('animate-pulse rounded-md bg-muted', className)}
|
|
10
|
+
{...props}
|
|
11
|
+
/>
|
|
12
|
+
);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export { Skeleton };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as SliderPrimitive from '@radix-ui/react-slider';
|
|
3
|
+
|
|
4
|
+
import { cn } from '../../lib/utils';
|
|
5
|
+
|
|
6
|
+
const Slider = React.forwardRef<
|
|
7
|
+
React.ElementRef<typeof SliderPrimitive.Root>,
|
|
8
|
+
React.ComponentPropsWithoutRef<typeof SliderPrimitive.Root> & {
|
|
9
|
+
/** Accessible names for individual handles in a range slider. */
|
|
10
|
+
thumbLabels?: string[];
|
|
11
|
+
}
|
|
12
|
+
>(
|
|
13
|
+
(
|
|
14
|
+
{
|
|
15
|
+
className,
|
|
16
|
+
thumbLabels,
|
|
17
|
+
'aria-label': ariaLabel,
|
|
18
|
+
'aria-labelledby': ariaLabelledBy,
|
|
19
|
+
...props
|
|
20
|
+
},
|
|
21
|
+
ref,
|
|
22
|
+
) => (
|
|
23
|
+
<SliderPrimitive.Root
|
|
24
|
+
ref={ref}
|
|
25
|
+
className={cn(
|
|
26
|
+
'relative flex w-full touch-none select-none items-center',
|
|
27
|
+
className,
|
|
28
|
+
thumbLabels,
|
|
29
|
+
)}
|
|
30
|
+
{...props}
|
|
31
|
+
>
|
|
32
|
+
<SliderPrimitive.Track className="relative h-2 w-full grow overflow-hidden rounded-full bg-secondary">
|
|
33
|
+
<SliderPrimitive.Range className="absolute h-full bg-primary" />
|
|
34
|
+
</SliderPrimitive.Track>
|
|
35
|
+
{(props.value ?? props.defaultValue ?? [0]).map((_, index) => (
|
|
36
|
+
<SliderPrimitive.Thumb
|
|
37
|
+
key={index}
|
|
38
|
+
aria-label={thumbLabels?.[index] ?? ariaLabel}
|
|
39
|
+
aria-labelledby={ariaLabelledBy}
|
|
40
|
+
className="block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-[color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,transform,translate,scale,rotate] duration-fast ease-move hover:scale-110 active:scale-95 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"
|
|
41
|
+
/>
|
|
42
|
+
))}
|
|
43
|
+
</SliderPrimitive.Root>
|
|
44
|
+
),
|
|
45
|
+
);
|
|
46
|
+
Slider.displayName = SliderPrimitive.Root.displayName;
|
|
47
|
+
|
|
48
|
+
export { Slider };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as SwitchPrimitives from '@radix-ui/react-switch';
|
|
3
|
+
import { cva, type VariantProps } from 'class-variance-authority';
|
|
4
|
+
|
|
5
|
+
import { cn } from '../../lib/utils';
|
|
6
|
+
|
|
7
|
+
const switchVariants = cva(
|
|
8
|
+
'peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors duration-fast ease-move 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 disabled:opacity-50',
|
|
9
|
+
{
|
|
10
|
+
variants: {
|
|
11
|
+
variant: {
|
|
12
|
+
default:
|
|
13
|
+
'data-[state=checked]:bg-primary data-[state=unchecked]:bg-input',
|
|
14
|
+
info: 'data-[state=checked]:bg-info-text data-[state=unchecked]:bg-muted-foreground',
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
defaultVariants: { variant: 'default' },
|
|
18
|
+
},
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
interface SwitchProps
|
|
22
|
+
extends
|
|
23
|
+
React.ComponentPropsWithoutRef<typeof SwitchPrimitives.Root>,
|
|
24
|
+
VariantProps<typeof switchVariants> {}
|
|
25
|
+
|
|
26
|
+
const Switch = React.forwardRef<
|
|
27
|
+
React.ElementRef<typeof SwitchPrimitives.Root>,
|
|
28
|
+
SwitchProps
|
|
29
|
+
>(({ className, variant, ...props }, ref) => (
|
|
30
|
+
<SwitchPrimitives.Root
|
|
31
|
+
className={cn(switchVariants({ variant, className }))}
|
|
32
|
+
{...props}
|
|
33
|
+
ref={ref}
|
|
34
|
+
>
|
|
35
|
+
<SwitchPrimitives.Thumb
|
|
36
|
+
className={cn(
|
|
37
|
+
'pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform duration-fast ease-move data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0',
|
|
38
|
+
)}
|
|
39
|
+
/>
|
|
40
|
+
</SwitchPrimitives.Root>
|
|
41
|
+
));
|
|
42
|
+
Switch.displayName = SwitchPrimitives.Root.displayName;
|
|
43
|
+
|
|
44
|
+
export { Switch };
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
import { cn } from '../../lib/utils';
|
|
4
|
+
import { Text } from './text';
|
|
5
|
+
|
|
6
|
+
const Table = React.forwardRef<
|
|
7
|
+
HTMLTableElement,
|
|
8
|
+
React.HTMLAttributes<HTMLTableElement> & { containerClassName?: string }
|
|
9
|
+
>(({ className, containerClassName, ...props }, ref) => (
|
|
10
|
+
<div className={cn('relative w-full overflow-auto', containerClassName)}>
|
|
11
|
+
<table
|
|
12
|
+
ref={ref}
|
|
13
|
+
className={cn('w-full caption-bottom text-sm', className)}
|
|
14
|
+
{...props}
|
|
15
|
+
/>
|
|
16
|
+
</div>
|
|
17
|
+
));
|
|
18
|
+
Table.displayName = 'Table';
|
|
19
|
+
|
|
20
|
+
const TableHeader = React.forwardRef<
|
|
21
|
+
HTMLTableSectionElement,
|
|
22
|
+
React.HTMLAttributes<HTMLTableSectionElement>
|
|
23
|
+
>(({ className, ...props }, ref) => (
|
|
24
|
+
<thead ref={ref} className={cn('[&_tr]:border-b', className)} {...props} />
|
|
25
|
+
));
|
|
26
|
+
TableHeader.displayName = 'TableHeader';
|
|
27
|
+
|
|
28
|
+
const TableBody = React.forwardRef<
|
|
29
|
+
HTMLTableSectionElement,
|
|
30
|
+
React.HTMLAttributes<HTMLTableSectionElement>
|
|
31
|
+
>(({ className, ...props }, ref) => (
|
|
32
|
+
<tbody
|
|
33
|
+
ref={ref}
|
|
34
|
+
className={cn('[&_tr:last-child]:border-0', className)}
|
|
35
|
+
{...props}
|
|
36
|
+
/>
|
|
37
|
+
));
|
|
38
|
+
TableBody.displayName = 'TableBody';
|
|
39
|
+
|
|
40
|
+
const TableFooter = React.forwardRef<
|
|
41
|
+
HTMLTableSectionElement,
|
|
42
|
+
React.HTMLAttributes<HTMLTableSectionElement>
|
|
43
|
+
>(({ className, ...props }, ref) => (
|
|
44
|
+
<tfoot
|
|
45
|
+
ref={ref}
|
|
46
|
+
className={cn(
|
|
47
|
+
'border-t bg-muted/50 font-medium [&>tr]:last:border-b-0',
|
|
48
|
+
className,
|
|
49
|
+
)}
|
|
50
|
+
{...props}
|
|
51
|
+
/>
|
|
52
|
+
));
|
|
53
|
+
TableFooter.displayName = 'TableFooter';
|
|
54
|
+
|
|
55
|
+
const TableRow = React.forwardRef<
|
|
56
|
+
HTMLTableRowElement,
|
|
57
|
+
React.HTMLAttributes<HTMLTableRowElement>
|
|
58
|
+
>(({ className, ...props }, ref) => (
|
|
59
|
+
<tr
|
|
60
|
+
ref={ref}
|
|
61
|
+
className={cn(
|
|
62
|
+
'border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted',
|
|
63
|
+
className,
|
|
64
|
+
)}
|
|
65
|
+
{...props}
|
|
66
|
+
/>
|
|
67
|
+
));
|
|
68
|
+
TableRow.displayName = 'TableRow';
|
|
69
|
+
|
|
70
|
+
const TableHead = React.forwardRef<
|
|
71
|
+
HTMLTableCellElement,
|
|
72
|
+
React.ThHTMLAttributes<HTMLTableCellElement>
|
|
73
|
+
>(({ className, ...props }, ref) => (
|
|
74
|
+
<th
|
|
75
|
+
ref={ref}
|
|
76
|
+
className={cn(
|
|
77
|
+
'h-12 px-inset text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0',
|
|
78
|
+
className,
|
|
79
|
+
)}
|
|
80
|
+
{...props}
|
|
81
|
+
/>
|
|
82
|
+
));
|
|
83
|
+
TableHead.displayName = 'TableHead';
|
|
84
|
+
|
|
85
|
+
const TableCell = React.forwardRef<
|
|
86
|
+
HTMLTableCellElement,
|
|
87
|
+
React.TdHTMLAttributes<HTMLTableCellElement>
|
|
88
|
+
>(({ className, ...props }, ref) => (
|
|
89
|
+
<td
|
|
90
|
+
ref={ref}
|
|
91
|
+
className={cn(
|
|
92
|
+
'align-middle [&:has([role=checkbox])]:pr-0 [&:has([role=checkbox])]:cursor-default',
|
|
93
|
+
className,
|
|
94
|
+
)}
|
|
95
|
+
{...props}
|
|
96
|
+
/>
|
|
97
|
+
));
|
|
98
|
+
TableCell.displayName = 'TableCell';
|
|
99
|
+
|
|
100
|
+
const TableCaption = React.forwardRef<
|
|
101
|
+
HTMLTableCaptionElement,
|
|
102
|
+
React.HTMLAttributes<HTMLTableCaptionElement>
|
|
103
|
+
>(({ className, ...props }, ref) => (
|
|
104
|
+
<Text asChild size="sm" variant="muted" className={cn('mt-stack', className)}>
|
|
105
|
+
<caption ref={ref} {...props} />
|
|
106
|
+
</Text>
|
|
107
|
+
));
|
|
108
|
+
TableCaption.displayName = 'TableCaption';
|
|
109
|
+
|
|
110
|
+
export {
|
|
111
|
+
Table,
|
|
112
|
+
TableHeader,
|
|
113
|
+
TableBody,
|
|
114
|
+
TableFooter,
|
|
115
|
+
TableHead,
|
|
116
|
+
TableRow,
|
|
117
|
+
TableCell,
|
|
118
|
+
TableCaption,
|
|
119
|
+
};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as TabsPrimitive from '@radix-ui/react-tabs';
|
|
3
|
+
|
|
4
|
+
import { cn } from '../../lib/utils';
|
|
5
|
+
|
|
6
|
+
const Tabs = TabsPrimitive.Root;
|
|
7
|
+
type TabsVariant = 'default' | 'underline';
|
|
8
|
+
type TabsSize = 'default' | 'compact';
|
|
9
|
+
|
|
10
|
+
interface TabsListProps extends React.ComponentPropsWithoutRef<
|
|
11
|
+
typeof TabsPrimitive.List
|
|
12
|
+
> {
|
|
13
|
+
variant?: TabsVariant;
|
|
14
|
+
size?: TabsSize;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const TabsList = React.forwardRef<
|
|
18
|
+
React.ElementRef<typeof TabsPrimitive.List>,
|
|
19
|
+
TabsListProps
|
|
20
|
+
>(({ className, variant = 'default', size = 'default', ...props }, ref) => (
|
|
21
|
+
<TabsPrimitive.List
|
|
22
|
+
ref={ref}
|
|
23
|
+
className={cn(
|
|
24
|
+
'inline-flex items-center text-muted-foreground',
|
|
25
|
+
variant === 'underline'
|
|
26
|
+
? cn(
|
|
27
|
+
'justify-start gap-inline border-b border-border bg-background p-0',
|
|
28
|
+
size === 'compact' ? 'h-6' : 'h-11',
|
|
29
|
+
)
|
|
30
|
+
: cn(
|
|
31
|
+
'justify-center rounded-md bg-muted',
|
|
32
|
+
size === 'compact' ? 'h-7 p-0.5' : 'h-10 p-1',
|
|
33
|
+
),
|
|
34
|
+
className,
|
|
35
|
+
)}
|
|
36
|
+
{...props}
|
|
37
|
+
/>
|
|
38
|
+
));
|
|
39
|
+
TabsList.displayName = TabsPrimitive.List.displayName;
|
|
40
|
+
|
|
41
|
+
const TabsTrigger = React.forwardRef<
|
|
42
|
+
React.ElementRef<typeof TabsPrimitive.Trigger>,
|
|
43
|
+
React.ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger> & {
|
|
44
|
+
variant?: TabsVariant;
|
|
45
|
+
size?: TabsSize;
|
|
46
|
+
}
|
|
47
|
+
>(({ className, variant = 'default', size = 'default', ...props }, ref) => (
|
|
48
|
+
<TabsPrimitive.Trigger
|
|
49
|
+
ref={ref}
|
|
50
|
+
className={cn(
|
|
51
|
+
'inline-flex items-center justify-center whitespace-nowrap font-medium outline-none ring-offset-background transition-all duration-fast ease-move focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50',
|
|
52
|
+
size === 'compact'
|
|
53
|
+
? 'h-6 min-h-6 min-w-6 px-2 text-2xs'
|
|
54
|
+
: 'px-3 py-1.5 text-sm',
|
|
55
|
+
variant === 'underline'
|
|
56
|
+
? 'h-full rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:text-primary'
|
|
57
|
+
: 'rounded-sm data-[state=active]:bg-card data-[state=active]:text-foreground data-[state=active]:shadow-sm',
|
|
58
|
+
className,
|
|
59
|
+
)}
|
|
60
|
+
{...props}
|
|
61
|
+
/>
|
|
62
|
+
));
|
|
63
|
+
TabsTrigger.displayName = TabsPrimitive.Trigger.displayName;
|
|
64
|
+
|
|
65
|
+
const TabsContent = React.forwardRef<
|
|
66
|
+
React.ElementRef<typeof TabsPrimitive.Content>,
|
|
67
|
+
React.ComponentPropsWithoutRef<typeof TabsPrimitive.Content>
|
|
68
|
+
>(({ className, ...props }, ref) => (
|
|
69
|
+
<TabsPrimitive.Content
|
|
70
|
+
ref={ref}
|
|
71
|
+
className={cn(
|
|
72
|
+
'mt-2 outline-none ring-offset-background duration-fast ease-enter data-[state=active]:animate-in data-[state=active]:fade-in-0 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2',
|
|
73
|
+
className,
|
|
74
|
+
)}
|
|
75
|
+
{...props}
|
|
76
|
+
/>
|
|
77
|
+
));
|
|
78
|
+
TabsContent.displayName = TabsPrimitive.Content.displayName;
|
|
79
|
+
|
|
80
|
+
export { Tabs, TabsList, TabsTrigger, TabsContent };
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/* eslint-disable react-refresh/only-export-components */
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { Slot } from '@radix-ui/react-slot';
|
|
4
|
+
import { cva, type VariantProps } from 'class-variance-authority';
|
|
5
|
+
|
|
6
|
+
import { cn } from '../../lib/utils';
|
|
7
|
+
|
|
8
|
+
export type TextTag = 'p' | 'span' | 'div' | 'label' | 'small';
|
|
9
|
+
|
|
10
|
+
const textVariants = cva('font-sans text-foreground font-normal', {
|
|
11
|
+
variants: {
|
|
12
|
+
size: {
|
|
13
|
+
'2xl': 'text-2xl leading-8',
|
|
14
|
+
lg: 'text-lg leading-7',
|
|
15
|
+
md: 'text-base leading-6',
|
|
16
|
+
sm: 'text-sm leading-5',
|
|
17
|
+
xs: 'text-xs leading-4',
|
|
18
|
+
'2xs': 'text-2xs',
|
|
19
|
+
caption: 'text-xs leading-4',
|
|
20
|
+
},
|
|
21
|
+
variant: {
|
|
22
|
+
default: 'text-foreground',
|
|
23
|
+
inherit: 'text-inherit',
|
|
24
|
+
muted: 'text-muted-foreground',
|
|
25
|
+
destructive: 'text-destructive-text',
|
|
26
|
+
primary: 'text-primary',
|
|
27
|
+
success: 'text-success-text',
|
|
28
|
+
warning: 'text-warning-text',
|
|
29
|
+
info: 'text-info-text',
|
|
30
|
+
inverse: 'text-primary-foreground',
|
|
31
|
+
},
|
|
32
|
+
weight: {
|
|
33
|
+
normal: 'font-normal',
|
|
34
|
+
medium: 'font-medium',
|
|
35
|
+
semibold: 'font-semibold',
|
|
36
|
+
bold: 'font-bold',
|
|
37
|
+
},
|
|
38
|
+
leading: {
|
|
39
|
+
none: 'leading-none',
|
|
40
|
+
tight: 'leading-tight',
|
|
41
|
+
normal: 'leading-normal',
|
|
42
|
+
relaxed: 'leading-relaxed',
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
defaultVariants: {
|
|
46
|
+
size: 'sm',
|
|
47
|
+
variant: 'default',
|
|
48
|
+
weight: 'normal',
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
export interface TextProps
|
|
53
|
+
extends React.HTMLAttributes<HTMLElement>, VariantProps<typeof textVariants> {
|
|
54
|
+
asChild?: boolean;
|
|
55
|
+
as?: TextTag;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const Text = React.forwardRef<HTMLElement, TextProps>(
|
|
59
|
+
(
|
|
60
|
+
{
|
|
61
|
+
className,
|
|
62
|
+
size,
|
|
63
|
+
variant,
|
|
64
|
+
weight,
|
|
65
|
+
leading,
|
|
66
|
+
asChild = false,
|
|
67
|
+
as = 'p',
|
|
68
|
+
...props
|
|
69
|
+
},
|
|
70
|
+
ref,
|
|
71
|
+
) => {
|
|
72
|
+
const Comp = (asChild ? Slot : as) as React.ElementType;
|
|
73
|
+
|
|
74
|
+
return (
|
|
75
|
+
<Comp
|
|
76
|
+
ref={ref}
|
|
77
|
+
className={cn(
|
|
78
|
+
textVariants({
|
|
79
|
+
size,
|
|
80
|
+
variant,
|
|
81
|
+
weight,
|
|
82
|
+
leading,
|
|
83
|
+
}),
|
|
84
|
+
className,
|
|
85
|
+
)}
|
|
86
|
+
{...props}
|
|
87
|
+
/>
|
|
88
|
+
);
|
|
89
|
+
},
|
|
90
|
+
);
|
|
91
|
+
Text.displayName = 'Text';
|
|
92
|
+
|
|
93
|
+
export { Text, textVariants };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/* eslint-disable react-refresh/only-export-components */
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { cva, type VariantProps } from 'class-variance-authority';
|
|
4
|
+
|
|
5
|
+
import { cn } from '../../lib/utils';
|
|
6
|
+
|
|
7
|
+
const textareaVariants = cva(
|
|
8
|
+
'flex min-h-[5rem] w-full rounded-md px-3 py-2 text-base ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 half:text-sm transition-colors duration-fast ease-move aria-invalid:border-destructive-text aria-invalid:focus-visible:ring-destructive-text',
|
|
9
|
+
{
|
|
10
|
+
variants: {
|
|
11
|
+
variant: {
|
|
12
|
+
default:
|
|
13
|
+
'border border-input bg-background focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1',
|
|
14
|
+
filled:
|
|
15
|
+
'border border-transparent bg-input-fill text-foreground hover:bg-input-fill-hover focus-visible:border-input focus-visible:bg-background focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 disabled:hover:bg-input-fill aria-invalid:border-destructive-text aria-invalid:focus-visible:border-destructive-text',
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
defaultVariants: {
|
|
19
|
+
variant: 'default',
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
export interface TextareaProps
|
|
25
|
+
extends
|
|
26
|
+
React.ComponentProps<'textarea'>,
|
|
27
|
+
VariantProps<typeof textareaVariants> {
|
|
28
|
+
error?: boolean;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(
|
|
32
|
+
(
|
|
33
|
+
{ className, variant, error, 'aria-invalid': ariaInvalid, ...props },
|
|
34
|
+
ref,
|
|
35
|
+
) => {
|
|
36
|
+
const isInvalid =
|
|
37
|
+
error === true || ariaInvalid === true || ariaInvalid === 'true';
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<textarea
|
|
41
|
+
aria-invalid={isInvalid ? true : ariaInvalid}
|
|
42
|
+
className={cn(textareaVariants({ variant, className }))}
|
|
43
|
+
ref={ref}
|
|
44
|
+
{...props}
|
|
45
|
+
/>
|
|
46
|
+
);
|
|
47
|
+
},
|
|
48
|
+
);
|
|
49
|
+
Textarea.displayName = 'Textarea';
|
|
50
|
+
|
|
51
|
+
export { Textarea, textareaVariants };
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as ToastPrimitives from '@radix-ui/react-toast';
|
|
3
|
+
import { cva, type VariantProps } from 'class-variance-authority';
|
|
4
|
+
import { X } from 'lucide-react';
|
|
5
|
+
|
|
6
|
+
import { cn } from '../../lib/utils';
|
|
7
|
+
import { Text } from './text';
|
|
8
|
+
|
|
9
|
+
const ToastProvider = ToastPrimitives.Provider;
|
|
10
|
+
|
|
11
|
+
const ToastViewport = React.forwardRef<
|
|
12
|
+
React.ElementRef<typeof ToastPrimitives.Viewport>,
|
|
13
|
+
React.ComponentPropsWithoutRef<typeof ToastPrimitives.Viewport>
|
|
14
|
+
>(({ className, ...props }, ref) => (
|
|
15
|
+
<ToastPrimitives.Viewport
|
|
16
|
+
ref={ref}
|
|
17
|
+
className={cn(
|
|
18
|
+
'fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-inset mobile:bottom-0 mobile:right-0 mobile:top-auto mobile:flex-col half:max-w-[26.25rem]',
|
|
19
|
+
className,
|
|
20
|
+
)}
|
|
21
|
+
{...props}
|
|
22
|
+
/>
|
|
23
|
+
));
|
|
24
|
+
ToastViewport.displayName = ToastPrimitives.Viewport.displayName;
|
|
25
|
+
|
|
26
|
+
const toastVariants = cva(
|
|
27
|
+
'group pointer-events-auto relative flex w-full items-center justify-between gap-stack overflow-hidden rounded-md border p-inset pr-section shadow-lg transition-all duration-normal ease-enter data-[state=closed]:ease-exit data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:mobile:slide-in-from-bottom-full',
|
|
28
|
+
{
|
|
29
|
+
variants: {
|
|
30
|
+
variant: {
|
|
31
|
+
default: 'border bg-background text-foreground',
|
|
32
|
+
destructive:
|
|
33
|
+
'destructive group border-destructive-text bg-destructive text-destructive-foreground',
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
defaultVariants: {
|
|
37
|
+
variant: 'default',
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
const Toast = React.forwardRef<
|
|
43
|
+
React.ElementRef<typeof ToastPrimitives.Root>,
|
|
44
|
+
React.ComponentPropsWithoutRef<typeof ToastPrimitives.Root> &
|
|
45
|
+
VariantProps<typeof toastVariants>
|
|
46
|
+
>(({ className, variant, ...props }, ref) => {
|
|
47
|
+
return (
|
|
48
|
+
<ToastPrimitives.Root
|
|
49
|
+
ref={ref}
|
|
50
|
+
className={cn(toastVariants({ variant }), className)}
|
|
51
|
+
{...props}
|
|
52
|
+
/>
|
|
53
|
+
);
|
|
54
|
+
});
|
|
55
|
+
Toast.displayName = ToastPrimitives.Root.displayName;
|
|
56
|
+
|
|
57
|
+
const ToastAction = React.forwardRef<
|
|
58
|
+
React.ElementRef<typeof ToastPrimitives.Action>,
|
|
59
|
+
React.ComponentPropsWithoutRef<typeof ToastPrimitives.Action>
|
|
60
|
+
>(({ className, ...props }, ref) => (
|
|
61
|
+
<ToastPrimitives.Action
|
|
62
|
+
ref={ref}
|
|
63
|
+
className={cn(
|
|
64
|
+
'inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-inset text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-destructive-foreground/40 group-[.destructive]:hover:border-destructive-foreground group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive-foreground group-[.destructive]:focus:ring-offset-destructive',
|
|
65
|
+
className,
|
|
66
|
+
)}
|
|
67
|
+
{...props}
|
|
68
|
+
/>
|
|
69
|
+
));
|
|
70
|
+
ToastAction.displayName = ToastPrimitives.Action.displayName;
|
|
71
|
+
|
|
72
|
+
const ToastClose = React.forwardRef<
|
|
73
|
+
React.ElementRef<typeof ToastPrimitives.Close>,
|
|
74
|
+
React.ComponentPropsWithoutRef<typeof ToastPrimitives.Close>
|
|
75
|
+
>(({ className, ...props }, ref) => (
|
|
76
|
+
<ToastPrimitives.Close
|
|
77
|
+
ref={ref}
|
|
78
|
+
className={cn(
|
|
79
|
+
'absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring group-hover:opacity-100 group-[.destructive]:text-destructive-foreground group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive-foreground group-[.destructive]:focus:ring-offset-destructive',
|
|
80
|
+
className,
|
|
81
|
+
)}
|
|
82
|
+
toast-close=""
|
|
83
|
+
// The icon is decorative, so the button needs its own name.
|
|
84
|
+
aria-label="Dismiss"
|
|
85
|
+
{...props}
|
|
86
|
+
>
|
|
87
|
+
<X className="h-4 w-4" />
|
|
88
|
+
</ToastPrimitives.Close>
|
|
89
|
+
));
|
|
90
|
+
ToastClose.displayName = ToastPrimitives.Close.displayName;
|
|
91
|
+
|
|
92
|
+
const ToastTitle = React.forwardRef<
|
|
93
|
+
React.ElementRef<typeof ToastPrimitives.Title>,
|
|
94
|
+
React.ComponentPropsWithoutRef<typeof ToastPrimitives.Title>
|
|
95
|
+
>(({ className, ...props }, ref) => (
|
|
96
|
+
<Text
|
|
97
|
+
asChild
|
|
98
|
+
size="sm"
|
|
99
|
+
weight="semibold"
|
|
100
|
+
className={cn(
|
|
101
|
+
'group-[.destructive]:text-destructive-foreground',
|
|
102
|
+
className,
|
|
103
|
+
)}
|
|
104
|
+
>
|
|
105
|
+
<ToastPrimitives.Title ref={ref} {...props} />
|
|
106
|
+
</Text>
|
|
107
|
+
));
|
|
108
|
+
ToastTitle.displayName = ToastPrimitives.Title.displayName;
|
|
109
|
+
|
|
110
|
+
const ToastDescription = React.forwardRef<
|
|
111
|
+
React.ElementRef<typeof ToastPrimitives.Description>,
|
|
112
|
+
React.ComponentPropsWithoutRef<typeof ToastPrimitives.Description>
|
|
113
|
+
>(({ className, ...props }, ref) => (
|
|
114
|
+
<Text
|
|
115
|
+
asChild
|
|
116
|
+
size="sm"
|
|
117
|
+
className={cn(
|
|
118
|
+
'opacity-90 group-[.destructive]:text-destructive-foreground group-[.destructive]:opacity-100',
|
|
119
|
+
className,
|
|
120
|
+
)}
|
|
121
|
+
>
|
|
122
|
+
<ToastPrimitives.Description ref={ref} {...props} />
|
|
123
|
+
</Text>
|
|
124
|
+
));
|
|
125
|
+
ToastDescription.displayName = ToastPrimitives.Description.displayName;
|
|
126
|
+
|
|
127
|
+
type ToastProps = React.ComponentPropsWithoutRef<typeof Toast>;
|
|
128
|
+
|
|
129
|
+
type ToastActionElement = React.ReactElement<typeof ToastAction>;
|
|
130
|
+
|
|
131
|
+
export {
|
|
132
|
+
type ToastProps,
|
|
133
|
+
type ToastActionElement,
|
|
134
|
+
ToastProvider,
|
|
135
|
+
ToastViewport,
|
|
136
|
+
Toast,
|
|
137
|
+
ToastTitle,
|
|
138
|
+
ToastDescription,
|
|
139
|
+
ToastClose,
|
|
140
|
+
ToastAction,
|
|
141
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { useToast } from './use-toast';
|
|
2
|
+
import {
|
|
3
|
+
Toast,
|
|
4
|
+
ToastClose,
|
|
5
|
+
ToastDescription,
|
|
6
|
+
ToastProvider,
|
|
7
|
+
ToastTitle,
|
|
8
|
+
ToastViewport,
|
|
9
|
+
} from './toast';
|
|
10
|
+
|
|
11
|
+
export function Toaster() {
|
|
12
|
+
const { toasts } = useToast();
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<ToastProvider>
|
|
16
|
+
{toasts.map(function ({
|
|
17
|
+
id,
|
|
18
|
+
title,
|
|
19
|
+
description,
|
|
20
|
+
action,
|
|
21
|
+
testId,
|
|
22
|
+
...props
|
|
23
|
+
}) {
|
|
24
|
+
return (
|
|
25
|
+
<Toast key={id} data-testid={testId} {...props}>
|
|
26
|
+
<div className="grid gap-1">
|
|
27
|
+
{title && <ToastTitle>{title}</ToastTitle>}
|
|
28
|
+
{description && (
|
|
29
|
+
<ToastDescription>{description}</ToastDescription>
|
|
30
|
+
)}
|
|
31
|
+
</div>
|
|
32
|
+
{action}
|
|
33
|
+
<ToastClose />
|
|
34
|
+
</Toast>
|
|
35
|
+
);
|
|
36
|
+
})}
|
|
37
|
+
<ToastViewport />
|
|
38
|
+
</ToastProvider>
|
|
39
|
+
);
|
|
40
|
+
}
|