@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,98 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
import { cn } from '../../lib/utils';
|
|
4
|
+
|
|
5
|
+
export interface ScrollFadeProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
6
|
+
/** The direction the content scrolls. */
|
|
7
|
+
orientation?: 'horizontal' | 'vertical';
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
interface Edges {
|
|
11
|
+
start: boolean;
|
|
12
|
+
end: boolean;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const FADE = 'var(--spacing-section)';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* A scrolling area whose edges fade where more content waits, so a row of board columns, a wide
|
|
19
|
+
* table or a long tab row shows that it scrolls. An edge with nothing beyond it stays sharp.
|
|
20
|
+
*/
|
|
21
|
+
const ScrollFade = React.forwardRef<HTMLDivElement, ScrollFadeProps>(
|
|
22
|
+
(
|
|
23
|
+
{
|
|
24
|
+
orientation = 'horizontal',
|
|
25
|
+
className,
|
|
26
|
+
style,
|
|
27
|
+
children,
|
|
28
|
+
onScroll,
|
|
29
|
+
...props
|
|
30
|
+
},
|
|
31
|
+
ref,
|
|
32
|
+
) => {
|
|
33
|
+
const inner = React.useRef<HTMLDivElement | null>(null);
|
|
34
|
+
const [edges, setEdges] = React.useState<Edges>({
|
|
35
|
+
start: false,
|
|
36
|
+
end: false,
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
const measure = React.useCallback(() => {
|
|
40
|
+
const element = inner.current;
|
|
41
|
+
if (!element) return;
|
|
42
|
+
const horizontal = orientation === 'horizontal';
|
|
43
|
+
const position = horizontal
|
|
44
|
+
? Math.abs(element.scrollLeft)
|
|
45
|
+
: element.scrollTop;
|
|
46
|
+
const room = horizontal
|
|
47
|
+
? element.scrollWidth - element.clientWidth
|
|
48
|
+
: element.scrollHeight - element.clientHeight;
|
|
49
|
+
setEdges((now) => {
|
|
50
|
+
const next = { start: position > 1, end: room - position > 1 };
|
|
51
|
+
return now.start === next.start && now.end === next.end ? now : next;
|
|
52
|
+
});
|
|
53
|
+
}, [orientation]);
|
|
54
|
+
|
|
55
|
+
React.useLayoutEffect(() => {
|
|
56
|
+
const element = inner.current;
|
|
57
|
+
if (!element) return;
|
|
58
|
+
measure();
|
|
59
|
+
const observer = new ResizeObserver(measure);
|
|
60
|
+
observer.observe(element);
|
|
61
|
+
for (const child of element.children) observer.observe(child);
|
|
62
|
+
return () => observer.disconnect();
|
|
63
|
+
}, [measure]);
|
|
64
|
+
|
|
65
|
+
const direction = orientation === 'horizontal' ? 'to right' : 'to bottom';
|
|
66
|
+
const mask = `linear-gradient(${direction}, ${edges.start ? 'transparent' : 'black'}, black ${FADE}, black calc(100% - ${FADE}), ${edges.end ? 'transparent' : 'black'})`;
|
|
67
|
+
|
|
68
|
+
return (
|
|
69
|
+
<div
|
|
70
|
+
ref={(element) => {
|
|
71
|
+
inner.current = element;
|
|
72
|
+
if (typeof ref === 'function') ref(element);
|
|
73
|
+
else if (ref) ref.current = element;
|
|
74
|
+
}}
|
|
75
|
+
// A keyboard reaches an area that scrolls, so it can scroll it with the arrow keys.
|
|
76
|
+
tabIndex={edges.start || edges.end ? 0 : undefined}
|
|
77
|
+
data-fade-start={edges.start || undefined}
|
|
78
|
+
data-fade-end={edges.end || undefined}
|
|
79
|
+
className={cn(
|
|
80
|
+
orientation === 'horizontal' ? 'overflow-x-auto' : 'overflow-y-auto',
|
|
81
|
+
'rounded-sm outline-none focus-visible:ring-2 focus-visible:ring-ring',
|
|
82
|
+
className,
|
|
83
|
+
)}
|
|
84
|
+
style={{ maskImage: mask, WebkitMaskImage: mask, ...style }}
|
|
85
|
+
onScroll={(event) => {
|
|
86
|
+
measure();
|
|
87
|
+
onScroll?.(event);
|
|
88
|
+
}}
|
|
89
|
+
{...props}
|
|
90
|
+
>
|
|
91
|
+
{children}
|
|
92
|
+
</div>
|
|
93
|
+
);
|
|
94
|
+
},
|
|
95
|
+
);
|
|
96
|
+
ScrollFade.displayName = 'ScrollFade';
|
|
97
|
+
|
|
98
|
+
export { ScrollFade };
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { useId, type ReactNode } from 'react';
|
|
2
|
+
import { cn } from '../../lib/utils';
|
|
3
|
+
import { Text } from './text';
|
|
4
|
+
|
|
5
|
+
interface SegmentedControlProps {
|
|
6
|
+
label: string;
|
|
7
|
+
value: string;
|
|
8
|
+
onValueChange: (value: string) => void;
|
|
9
|
+
options: readonly {
|
|
10
|
+
value: string;
|
|
11
|
+
label: string;
|
|
12
|
+
icon?: ReactNode;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
}[];
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
className?: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function SegmentedControl({
|
|
20
|
+
label,
|
|
21
|
+
value,
|
|
22
|
+
onValueChange,
|
|
23
|
+
options,
|
|
24
|
+
disabled = false,
|
|
25
|
+
className,
|
|
26
|
+
}: SegmentedControlProps) {
|
|
27
|
+
const name = useId();
|
|
28
|
+
return (
|
|
29
|
+
<div
|
|
30
|
+
role="radiogroup"
|
|
31
|
+
aria-label={label}
|
|
32
|
+
className={cn(
|
|
33
|
+
'inline-flex h-9 shrink-0 overflow-hidden rounded-md border border-input bg-background',
|
|
34
|
+
className,
|
|
35
|
+
)}
|
|
36
|
+
>
|
|
37
|
+
{options.map((option) => (
|
|
38
|
+
<label
|
|
39
|
+
key={option.value}
|
|
40
|
+
title={option.label}
|
|
41
|
+
className="relative flex border-l border-input first:border-l-0"
|
|
42
|
+
>
|
|
43
|
+
<input
|
|
44
|
+
type="radio"
|
|
45
|
+
name={name}
|
|
46
|
+
value={option.value}
|
|
47
|
+
aria-label={option.label}
|
|
48
|
+
checked={value === option.value}
|
|
49
|
+
disabled={disabled || (option.disabled ?? false)}
|
|
50
|
+
onChange={() => onValueChange(option.value)}
|
|
51
|
+
className="peer absolute inset-0 z-10 m-0 h-full w-full cursor-pointer opacity-0 disabled:cursor-not-allowed"
|
|
52
|
+
/>
|
|
53
|
+
{/* The selected option takes the app's selection surface and full
|
|
54
|
+
ink; the others stay muted, so the choice reads without colour. */}
|
|
55
|
+
<span className="inline-flex h-full min-w-16 cursor-pointer items-center justify-center gap-inline px-inset text-muted-foreground transition-colors duration-fast ease-move hover:bg-accent hover:text-foreground peer-checked:bg-surface-hover peer-checked:text-foreground peer-focus-visible:ring-2 peer-focus-visible:ring-inset peer-focus-visible:ring-ring peer-disabled:pointer-events-none peer-disabled:opacity-50">
|
|
56
|
+
{option.icon ? (
|
|
57
|
+
<span aria-hidden className="flex [&_svg]:size-4">
|
|
58
|
+
{option.icon}
|
|
59
|
+
</span>
|
|
60
|
+
) : (
|
|
61
|
+
<Text as="span" size="sm" weight="medium">
|
|
62
|
+
{option.label}
|
|
63
|
+
</Text>
|
|
64
|
+
)}
|
|
65
|
+
</span>
|
|
66
|
+
</label>
|
|
67
|
+
))}
|
|
68
|
+
</div>
|
|
69
|
+
);
|
|
70
|
+
}
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
/* eslint-disable react-refresh/only-export-components */
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import * as SelectPrimitive from '@radix-ui/react-select';
|
|
4
|
+
import { cva, type VariantProps } from 'class-variance-authority';
|
|
5
|
+
import { Check, ChevronDown, ChevronUp } from 'lucide-react';
|
|
6
|
+
|
|
7
|
+
import { cspNonce } from '../../lib/csp-nonce';
|
|
8
|
+
import { cn, usePointerCloseFocus } from '../../lib/utils';
|
|
9
|
+
import { Text } from './text';
|
|
10
|
+
|
|
11
|
+
const Select = SelectPrimitive.Root;
|
|
12
|
+
|
|
13
|
+
const SelectGroup = SelectPrimitive.Group;
|
|
14
|
+
|
|
15
|
+
const SelectValue = SelectPrimitive.Value;
|
|
16
|
+
|
|
17
|
+
const selectTriggerVariants = cva(
|
|
18
|
+
'flex w-full items-center justify-between rounded-md px-inset text-sm outline-none ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 transition-colors duration-fast ease-move aria-invalid:border-destructive-text aria-invalid:focus-visible:ring-destructive-text [&>span]:truncate [&>span]:min-w-0',
|
|
19
|
+
{
|
|
20
|
+
variants: {
|
|
21
|
+
size: {
|
|
22
|
+
default: 'h-10 py-inline',
|
|
23
|
+
sm: 'h-9',
|
|
24
|
+
},
|
|
25
|
+
variant: {
|
|
26
|
+
default:
|
|
27
|
+
'border border-input bg-background focus-visible:not-data-[pointer-close-focus]:ring-2 focus-visible:not-data-[pointer-close-focus]:ring-ring focus-visible:not-data-[pointer-close-focus]:ring-offset-2',
|
|
28
|
+
filled:
|
|
29
|
+
'border border-transparent bg-input-fill text-foreground data-[placeholder]:text-muted-foreground hover:bg-input-fill-hover focus-visible:not-data-[pointer-close-focus]:border-input focus-visible:not-data-[pointer-close-focus]:bg-background focus-visible:not-data-[pointer-close-focus]:ring-2 focus-visible:not-data-[pointer-close-focus]:ring-ring focus-visible:not-data-[pointer-close-focus]:ring-offset-2 disabled:hover:bg-input-fill aria-invalid:border-destructive-text aria-invalid:focus-visible:border-destructive-text',
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
defaultVariants: {
|
|
33
|
+
size: 'default',
|
|
34
|
+
variant: 'default',
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
export interface SelectTriggerProps
|
|
40
|
+
extends
|
|
41
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger>,
|
|
42
|
+
VariantProps<typeof selectTriggerVariants> {}
|
|
43
|
+
|
|
44
|
+
const SelectTrigger = React.forwardRef<
|
|
45
|
+
React.ElementRef<typeof SelectPrimitive.Trigger>,
|
|
46
|
+
SelectTriggerProps
|
|
47
|
+
>(({ className, variant, size, children, ...props }, ref) => (
|
|
48
|
+
<SelectPrimitive.Trigger
|
|
49
|
+
ref={ref}
|
|
50
|
+
className={cn(selectTriggerVariants({ variant, size, className }))}
|
|
51
|
+
{...props}
|
|
52
|
+
>
|
|
53
|
+
{children}
|
|
54
|
+
<SelectPrimitive.Icon asChild>
|
|
55
|
+
<ChevronDown className="h-4 w-4 opacity-50" />
|
|
56
|
+
</SelectPrimitive.Icon>
|
|
57
|
+
</SelectPrimitive.Trigger>
|
|
58
|
+
));
|
|
59
|
+
SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
|
|
60
|
+
|
|
61
|
+
const SelectScrollUpButton = React.forwardRef<
|
|
62
|
+
React.ElementRef<typeof SelectPrimitive.ScrollUpButton>,
|
|
63
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollUpButton>
|
|
64
|
+
>(({ className, ...props }, ref) => (
|
|
65
|
+
<SelectPrimitive.ScrollUpButton
|
|
66
|
+
ref={ref}
|
|
67
|
+
className={cn(
|
|
68
|
+
'flex cursor-default items-center justify-center py-1',
|
|
69
|
+
className,
|
|
70
|
+
)}
|
|
71
|
+
{...props}
|
|
72
|
+
>
|
|
73
|
+
<ChevronUp className="h-4 w-4" />
|
|
74
|
+
</SelectPrimitive.ScrollUpButton>
|
|
75
|
+
));
|
|
76
|
+
SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;
|
|
77
|
+
|
|
78
|
+
const SelectScrollDownButton = React.forwardRef<
|
|
79
|
+
React.ElementRef<typeof SelectPrimitive.ScrollDownButton>,
|
|
80
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollDownButton>
|
|
81
|
+
>(({ className, ...props }, ref) => (
|
|
82
|
+
<SelectPrimitive.ScrollDownButton
|
|
83
|
+
ref={ref}
|
|
84
|
+
className={cn(
|
|
85
|
+
'flex cursor-default items-center justify-center py-1',
|
|
86
|
+
className,
|
|
87
|
+
)}
|
|
88
|
+
{...props}
|
|
89
|
+
>
|
|
90
|
+
<ChevronDown className="h-4 w-4" />
|
|
91
|
+
</SelectPrimitive.ScrollDownButton>
|
|
92
|
+
));
|
|
93
|
+
SelectScrollDownButton.displayName =
|
|
94
|
+
SelectPrimitive.ScrollDownButton.displayName;
|
|
95
|
+
|
|
96
|
+
const SelectContent = React.forwardRef<
|
|
97
|
+
React.ElementRef<typeof SelectPrimitive.Content>,
|
|
98
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content>
|
|
99
|
+
>(
|
|
100
|
+
(
|
|
101
|
+
{
|
|
102
|
+
className,
|
|
103
|
+
children,
|
|
104
|
+
position = 'popper',
|
|
105
|
+
onPointerDownCapture,
|
|
106
|
+
onClickCapture,
|
|
107
|
+
onKeyDownCapture,
|
|
108
|
+
onEscapeKeyDown,
|
|
109
|
+
onPointerDownOutside,
|
|
110
|
+
onCloseAutoFocus,
|
|
111
|
+
...props
|
|
112
|
+
},
|
|
113
|
+
ref,
|
|
114
|
+
) => {
|
|
115
|
+
const pointerCloseFocus = usePointerCloseFocus({
|
|
116
|
+
onPointerDownCapture,
|
|
117
|
+
onClickCapture,
|
|
118
|
+
onKeyDownCapture,
|
|
119
|
+
onEscapeKeyDown,
|
|
120
|
+
onPointerDownOutside,
|
|
121
|
+
onCloseAutoFocus,
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
return (
|
|
125
|
+
<SelectPrimitive.Portal>
|
|
126
|
+
<SelectPrimitive.Content
|
|
127
|
+
ref={ref}
|
|
128
|
+
className={cn(
|
|
129
|
+
'relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md outline-none duration-fast ease-enter data-[state=closed]:ease-exit data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2',
|
|
130
|
+
position === 'popper' &&
|
|
131
|
+
'data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1',
|
|
132
|
+
className,
|
|
133
|
+
)}
|
|
134
|
+
position={position}
|
|
135
|
+
{...pointerCloseFocus}
|
|
136
|
+
{...props}
|
|
137
|
+
>
|
|
138
|
+
<SelectScrollUpButton />
|
|
139
|
+
<SelectPrimitive.Viewport
|
|
140
|
+
nonce={cspNonce()}
|
|
141
|
+
className={cn(
|
|
142
|
+
'p-1',
|
|
143
|
+
position === 'popper' &&
|
|
144
|
+
'h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]',
|
|
145
|
+
)}
|
|
146
|
+
>
|
|
147
|
+
{children}
|
|
148
|
+
</SelectPrimitive.Viewport>
|
|
149
|
+
<SelectScrollDownButton />
|
|
150
|
+
</SelectPrimitive.Content>
|
|
151
|
+
</SelectPrimitive.Portal>
|
|
152
|
+
);
|
|
153
|
+
},
|
|
154
|
+
);
|
|
155
|
+
SelectContent.displayName = SelectPrimitive.Content.displayName;
|
|
156
|
+
|
|
157
|
+
const SelectLabel = React.forwardRef<
|
|
158
|
+
React.ElementRef<typeof SelectPrimitive.Label>,
|
|
159
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Label>
|
|
160
|
+
>(({ className, ...props }, ref) => (
|
|
161
|
+
<Text
|
|
162
|
+
asChild
|
|
163
|
+
size="sm"
|
|
164
|
+
weight="semibold"
|
|
165
|
+
className={cn('py-1.5 pl-section pr-inline', className)}
|
|
166
|
+
>
|
|
167
|
+
<SelectPrimitive.Label ref={ref} {...props} />
|
|
168
|
+
</Text>
|
|
169
|
+
));
|
|
170
|
+
SelectLabel.displayName = SelectPrimitive.Label.displayName;
|
|
171
|
+
|
|
172
|
+
export interface SelectItemProps extends React.ComponentPropsWithoutRef<
|
|
173
|
+
typeof SelectPrimitive.Item
|
|
174
|
+
> {
|
|
175
|
+
selectionIndicator?: 'check' | 'highlight';
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
const SelectItem = React.forwardRef<
|
|
179
|
+
React.ElementRef<typeof SelectPrimitive.Item>,
|
|
180
|
+
SelectItemProps
|
|
181
|
+
>(({ className, children, selectionIndicator = 'check', ...props }, ref) => (
|
|
182
|
+
<SelectPrimitive.Item
|
|
183
|
+
ref={ref}
|
|
184
|
+
className={cn(
|
|
185
|
+
'relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50',
|
|
186
|
+
selectionIndicator === 'check'
|
|
187
|
+
? 'pl-section pr-inline'
|
|
188
|
+
: 'px-inset data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground focus:ring-2 focus:ring-inset focus:ring-ring data-[state=checked]:focus:ring-primary-foreground',
|
|
189
|
+
className,
|
|
190
|
+
)}
|
|
191
|
+
{...props}
|
|
192
|
+
>
|
|
193
|
+
{selectionIndicator === 'check' && (
|
|
194
|
+
<span className="absolute left-inline flex h-3.5 w-3.5 items-center justify-center">
|
|
195
|
+
<SelectPrimitive.ItemIndicator>
|
|
196
|
+
<Check className="h-4 w-4" />
|
|
197
|
+
</SelectPrimitive.ItemIndicator>
|
|
198
|
+
</span>
|
|
199
|
+
)}
|
|
200
|
+
|
|
201
|
+
<SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
|
|
202
|
+
</SelectPrimitive.Item>
|
|
203
|
+
));
|
|
204
|
+
SelectItem.displayName = SelectPrimitive.Item.displayName;
|
|
205
|
+
|
|
206
|
+
const SelectSeparator = React.forwardRef<
|
|
207
|
+
React.ElementRef<typeof SelectPrimitive.Separator>,
|
|
208
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Separator>
|
|
209
|
+
>(({ className, ...props }, ref) => (
|
|
210
|
+
<SelectPrimitive.Separator
|
|
211
|
+
ref={ref}
|
|
212
|
+
className={cn('-mx-1 my-1 h-px bg-muted', className)}
|
|
213
|
+
{...props}
|
|
214
|
+
/>
|
|
215
|
+
));
|
|
216
|
+
SelectSeparator.displayName = SelectPrimitive.Separator.displayName;
|
|
217
|
+
|
|
218
|
+
export {
|
|
219
|
+
Select,
|
|
220
|
+
SelectGroup,
|
|
221
|
+
SelectValue,
|
|
222
|
+
SelectTrigger,
|
|
223
|
+
SelectContent,
|
|
224
|
+
SelectLabel,
|
|
225
|
+
SelectItem,
|
|
226
|
+
SelectSeparator,
|
|
227
|
+
SelectScrollUpButton,
|
|
228
|
+
SelectScrollDownButton,
|
|
229
|
+
selectTriggerVariants,
|
|
230
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as SeparatorPrimitive from '@radix-ui/react-separator';
|
|
3
|
+
|
|
4
|
+
import { cn } from '../../lib/utils';
|
|
5
|
+
|
|
6
|
+
const Separator = React.forwardRef<
|
|
7
|
+
React.ElementRef<typeof SeparatorPrimitive.Root>,
|
|
8
|
+
React.ComponentPropsWithoutRef<typeof SeparatorPrimitive.Root>
|
|
9
|
+
>(
|
|
10
|
+
(
|
|
11
|
+
{ className, orientation = 'horizontal', decorative = true, ...props },
|
|
12
|
+
ref,
|
|
13
|
+
) => (
|
|
14
|
+
<SeparatorPrimitive.Root
|
|
15
|
+
ref={ref}
|
|
16
|
+
decorative={decorative}
|
|
17
|
+
orientation={orientation}
|
|
18
|
+
className={cn(
|
|
19
|
+
'shrink-0 bg-border',
|
|
20
|
+
orientation === 'horizontal' ? 'h-[1px] w-full' : 'h-full w-[1px]',
|
|
21
|
+
className,
|
|
22
|
+
)}
|
|
23
|
+
{...props}
|
|
24
|
+
/>
|
|
25
|
+
),
|
|
26
|
+
);
|
|
27
|
+
Separator.displayName = SeparatorPrimitive.Root.displayName;
|
|
28
|
+
|
|
29
|
+
export { Separator };
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as SheetPrimitive from '@radix-ui/react-dialog';
|
|
3
|
+
import { cva, type VariantProps } from 'class-variance-authority';
|
|
4
|
+
import { X } from 'lucide-react';
|
|
5
|
+
|
|
6
|
+
import { cn } from '../../lib/utils';
|
|
7
|
+
import { Heading } from './heading';
|
|
8
|
+
import { Text } from './text';
|
|
9
|
+
|
|
10
|
+
const Sheet = SheetPrimitive.Root;
|
|
11
|
+
|
|
12
|
+
const SheetTrigger = SheetPrimitive.Trigger;
|
|
13
|
+
|
|
14
|
+
const SheetClose = SheetPrimitive.Close;
|
|
15
|
+
|
|
16
|
+
const SheetPortal = SheetPrimitive.Portal;
|
|
17
|
+
|
|
18
|
+
const SheetOverlay = React.forwardRef<
|
|
19
|
+
React.ElementRef<typeof SheetPrimitive.Overlay>,
|
|
20
|
+
React.ComponentPropsWithoutRef<typeof SheetPrimitive.Overlay>
|
|
21
|
+
>(({ className, ...props }, ref) => (
|
|
22
|
+
<SheetPrimitive.Overlay
|
|
23
|
+
className={cn(
|
|
24
|
+
'fixed inset-0 z-50 bg-black/80 duration-normal ease-enter data-[state=closed]:ease-exit data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0',
|
|
25
|
+
className,
|
|
26
|
+
)}
|
|
27
|
+
{...props}
|
|
28
|
+
ref={ref}
|
|
29
|
+
/>
|
|
30
|
+
));
|
|
31
|
+
SheetOverlay.displayName = SheetPrimitive.Overlay.displayName;
|
|
32
|
+
|
|
33
|
+
const sheetVariants = cva(
|
|
34
|
+
'fixed z-50 max-h-dvh overflow-y-auto gap-stack bg-background p-6 shadow-lg outline-none transition ease-enter data-[state=closed]:ease-exit data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-slow data-[state=open]:duration-slower',
|
|
35
|
+
{
|
|
36
|
+
variants: {
|
|
37
|
+
side: {
|
|
38
|
+
top: 'inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top',
|
|
39
|
+
bottom:
|
|
40
|
+
'inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom',
|
|
41
|
+
left: 'inset-y-0 left-0 h-full border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left',
|
|
42
|
+
right:
|
|
43
|
+
'inset-y-0 right-0 h-full border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right',
|
|
44
|
+
},
|
|
45
|
+
// Width of a left or right panel. `wide` fits reading content such as a
|
|
46
|
+
// compact table; top and bottom panels always span the viewport.
|
|
47
|
+
size: {
|
|
48
|
+
default: '',
|
|
49
|
+
wide: '',
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
compoundVariants: [
|
|
53
|
+
{
|
|
54
|
+
side: ['left', 'right'],
|
|
55
|
+
size: 'default',
|
|
56
|
+
className: 'w-3/4 mobile:max-w-sm',
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
side: ['left', 'right'],
|
|
60
|
+
size: 'wide',
|
|
61
|
+
className: 'w-full mobile:max-w-2xl',
|
|
62
|
+
},
|
|
63
|
+
],
|
|
64
|
+
defaultVariants: {
|
|
65
|
+
side: 'right',
|
|
66
|
+
size: 'default',
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
interface SheetContentProps
|
|
72
|
+
extends
|
|
73
|
+
React.ComponentPropsWithoutRef<typeof SheetPrimitive.Content>,
|
|
74
|
+
VariantProps<typeof sheetVariants> {
|
|
75
|
+
closeLabel?: string;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const SheetContent = React.forwardRef<
|
|
79
|
+
React.ElementRef<typeof SheetPrimitive.Content>,
|
|
80
|
+
SheetContentProps
|
|
81
|
+
>(
|
|
82
|
+
(
|
|
83
|
+
{
|
|
84
|
+
side = 'right',
|
|
85
|
+
size = 'default',
|
|
86
|
+
className,
|
|
87
|
+
children,
|
|
88
|
+
closeLabel = 'Close',
|
|
89
|
+
...props
|
|
90
|
+
},
|
|
91
|
+
ref,
|
|
92
|
+
) => (
|
|
93
|
+
<SheetPortal>
|
|
94
|
+
<SheetOverlay />
|
|
95
|
+
<SheetPrimitive.Content
|
|
96
|
+
ref={ref}
|
|
97
|
+
className={cn(sheetVariants({ side, size }), className)}
|
|
98
|
+
{...props}
|
|
99
|
+
>
|
|
100
|
+
{children}
|
|
101
|
+
<SheetPrimitive.Close className="absolute right-stack top-stack flex h-6 w-6 items-center justify-center rounded-sm opacity-70 outline-none ring-offset-background transition-opacity hover:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary">
|
|
102
|
+
<X className="h-4 w-4" />
|
|
103
|
+
<span className="sr-only">{closeLabel}</span>
|
|
104
|
+
</SheetPrimitive.Close>
|
|
105
|
+
</SheetPrimitive.Content>
|
|
106
|
+
</SheetPortal>
|
|
107
|
+
),
|
|
108
|
+
);
|
|
109
|
+
SheetContent.displayName = SheetPrimitive.Content.displayName;
|
|
110
|
+
|
|
111
|
+
const SheetHeader = ({
|
|
112
|
+
className,
|
|
113
|
+
...props
|
|
114
|
+
}: React.HTMLAttributes<HTMLDivElement>) => (
|
|
115
|
+
<div
|
|
116
|
+
className={cn(
|
|
117
|
+
'flex flex-col space-y-2 text-center mobile:text-left',
|
|
118
|
+
className,
|
|
119
|
+
)}
|
|
120
|
+
{...props}
|
|
121
|
+
/>
|
|
122
|
+
);
|
|
123
|
+
SheetHeader.displayName = 'SheetHeader';
|
|
124
|
+
|
|
125
|
+
const SheetFooter = ({
|
|
126
|
+
className,
|
|
127
|
+
...props
|
|
128
|
+
}: React.HTMLAttributes<HTMLDivElement>) => (
|
|
129
|
+
<div
|
|
130
|
+
className={cn(
|
|
131
|
+
'flex flex-col-reverse mobile:flex-row mobile:justify-end mobile:space-x-inline',
|
|
132
|
+
className,
|
|
133
|
+
)}
|
|
134
|
+
{...props}
|
|
135
|
+
/>
|
|
136
|
+
);
|
|
137
|
+
SheetFooter.displayName = 'SheetFooter';
|
|
138
|
+
|
|
139
|
+
const SheetTitle = React.forwardRef<
|
|
140
|
+
React.ElementRef<typeof SheetPrimitive.Title>,
|
|
141
|
+
React.ComponentPropsWithoutRef<typeof SheetPrimitive.Title>
|
|
142
|
+
>(({ className, ...props }, ref) => (
|
|
143
|
+
<Heading asChild level={3} size="lg" weight="semibold" className={className}>
|
|
144
|
+
<SheetPrimitive.Title ref={ref} {...props} />
|
|
145
|
+
</Heading>
|
|
146
|
+
));
|
|
147
|
+
SheetTitle.displayName = SheetPrimitive.Title.displayName;
|
|
148
|
+
|
|
149
|
+
const SheetDescription = React.forwardRef<
|
|
150
|
+
React.ElementRef<typeof SheetPrimitive.Description>,
|
|
151
|
+
React.ComponentPropsWithoutRef<typeof SheetPrimitive.Description>
|
|
152
|
+
>(({ className, ...props }, ref) => (
|
|
153
|
+
<Text asChild size="sm" variant="muted" className={className}>
|
|
154
|
+
<SheetPrimitive.Description ref={ref} {...props} />
|
|
155
|
+
</Text>
|
|
156
|
+
));
|
|
157
|
+
SheetDescription.displayName = SheetPrimitive.Description.displayName;
|
|
158
|
+
|
|
159
|
+
export {
|
|
160
|
+
Sheet,
|
|
161
|
+
SheetPortal,
|
|
162
|
+
SheetOverlay,
|
|
163
|
+
SheetTrigger,
|
|
164
|
+
SheetClose,
|
|
165
|
+
SheetContent,
|
|
166
|
+
SheetHeader,
|
|
167
|
+
SheetFooter,
|
|
168
|
+
SheetTitle,
|
|
169
|
+
SheetDescription,
|
|
170
|
+
};
|
|
@@ -0,0 +1,87 @@
|
|
|
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 ShimmerTextTag =
|
|
9
|
+
| 'span'
|
|
10
|
+
| 'p'
|
|
11
|
+
| 'div'
|
|
12
|
+
| 'h1'
|
|
13
|
+
| 'h2'
|
|
14
|
+
| 'h3'
|
|
15
|
+
| 'h4'
|
|
16
|
+
| 'h5'
|
|
17
|
+
| 'h6';
|
|
18
|
+
|
|
19
|
+
const shimmerTextVariants = cva('oaiz-shimmer-text inline-block text-primary', {
|
|
20
|
+
variants: {
|
|
21
|
+
appearance: {
|
|
22
|
+
default: '',
|
|
23
|
+
activity: 'oaiz-shimmer-text--activity',
|
|
24
|
+
rainbow: 'oaiz-shimmer-text--rainbow',
|
|
25
|
+
},
|
|
26
|
+
size: {
|
|
27
|
+
inherit: '',
|
|
28
|
+
xs: 'text-xs leading-4',
|
|
29
|
+
sm: 'text-sm leading-5',
|
|
30
|
+
md: 'text-base leading-6',
|
|
31
|
+
lg: 'text-lg leading-7',
|
|
32
|
+
},
|
|
33
|
+
speed: {
|
|
34
|
+
normal: 'animate-[oaiz-text-shimmer_2s_linear_infinite]',
|
|
35
|
+
fast: 'animate-[oaiz-text-shimmer_1.2s_linear_infinite]',
|
|
36
|
+
slow: 'animate-[oaiz-text-shimmer_3s_linear_infinite]',
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
defaultVariants: {
|
|
40
|
+
appearance: 'default',
|
|
41
|
+
size: 'inherit',
|
|
42
|
+
speed: 'normal',
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
export interface ShimmerTextProps
|
|
47
|
+
extends
|
|
48
|
+
React.HTMLAttributes<HTMLElement>,
|
|
49
|
+
VariantProps<typeof shimmerTextVariants> {
|
|
50
|
+
asChild?: boolean;
|
|
51
|
+
as?: ShimmerTextTag;
|
|
52
|
+
children: React.ReactNode;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const ShimmerText = React.forwardRef<HTMLElement, ShimmerTextProps>(
|
|
56
|
+
(
|
|
57
|
+
{
|
|
58
|
+
className,
|
|
59
|
+
appearance,
|
|
60
|
+
size,
|
|
61
|
+
speed,
|
|
62
|
+
asChild = false,
|
|
63
|
+
as = 'span',
|
|
64
|
+
children,
|
|
65
|
+
...props
|
|
66
|
+
},
|
|
67
|
+
ref,
|
|
68
|
+
) => {
|
|
69
|
+
const Comp = (asChild ? Slot : as) as React.ElementType;
|
|
70
|
+
|
|
71
|
+
return (
|
|
72
|
+
<Comp
|
|
73
|
+
ref={ref}
|
|
74
|
+
className={cn(
|
|
75
|
+
shimmerTextVariants({ appearance, size, speed }),
|
|
76
|
+
className,
|
|
77
|
+
)}
|
|
78
|
+
{...props}
|
|
79
|
+
>
|
|
80
|
+
{children}
|
|
81
|
+
</Comp>
|
|
82
|
+
);
|
|
83
|
+
},
|
|
84
|
+
);
|
|
85
|
+
ShimmerText.displayName = 'ShimmerText';
|
|
86
|
+
|
|
87
|
+
export { ShimmerText, shimmerTextVariants };
|