@olympusoss/canvas 2.20.2 → 4.0.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/package.json +41 -177
- package/src/cn.ts +3 -0
- package/src/index.ts +12 -603
- package/src/theme.ts +41 -0
- package/src/tokens.ts +11 -0
- package/styles/base.css +17 -0
- package/styles/canvas.css +69 -52
- package/styles/components/alert.css +66 -0
- package/styles/components/app-shell.css +46 -0
- package/styles/components/avatar.css +15 -0
- package/styles/components/badge.css +83 -0
- package/styles/components/breadcrumb.css +35 -0
- package/styles/components/button-group.css +23 -0
- package/styles/components/button.css +107 -0
- package/styles/components/calendar.css +73 -0
- package/styles/components/card.css +58 -0
- package/styles/components/checkbox.css +55 -0
- package/styles/components/code-block.css +18 -0
- package/styles/components/combobox.css +75 -0
- package/styles/components/command.css +94 -0
- package/styles/components/data-table.css +142 -0
- package/styles/components/dialog.css +72 -0
- package/styles/components/dropdown.css +54 -0
- package/styles/components/empty-state.css +17 -0
- package/styles/components/field.css +27 -0
- package/styles/components/filter-panel.css +58 -0
- package/styles/components/form.css +27 -0
- package/styles/components/icon.css +8 -0
- package/styles/components/input-group.css +45 -0
- package/styles/components/input.css +56 -0
- package/styles/components/kbd.css +15 -0
- package/styles/components/page-header.css +52 -0
- package/styles/components/pagination.css +48 -0
- package/styles/components/popover.css +14 -0
- package/styles/components/radio.css +28 -0
- package/styles/components/row-menu.css +69 -0
- package/styles/components/section-card.css +49 -0
- package/styles/components/select.css +57 -0
- package/styles/components/separator.css +32 -0
- package/styles/components/sheet.css +70 -0
- package/styles/components/sidebar.css +146 -0
- package/styles/components/skeleton.css +32 -0
- package/styles/components/spinner.css +26 -0
- package/styles/components/stat-card.css +71 -0
- package/styles/components/stepper.css +63 -0
- package/styles/components/switch.css +45 -0
- package/styles/components/tabs.css +40 -0
- package/styles/components/textarea.css +31 -0
- package/styles/components/toast.css +95 -0
- package/styles/components/tooltip.css +53 -0
- package/styles/components/topbar.css +24 -0
- package/styles/components/typography.css +105 -0
- package/styles/patterns/backdrops.css +35 -0
- package/styles/patterns/density.css +66 -0
- package/styles/patterns/focus.css +38 -0
- package/styles/patterns/glass.css +85 -0
- package/styles/patterns/high-contrast.css +70 -0
- package/styles/patterns/reduced-motion.css +12 -0
- package/styles/patterns/scrollbar.css +10 -0
- package/styles/reset.css +89 -0
- package/styles/tokens/colors.css +106 -0
- package/styles/tokens/motion.css +33 -0
- package/styles/tokens/radius.css +10 -0
- package/styles/tokens/shadows.css +35 -0
- package/styles/tokens/spacing.css +19 -0
- package/styles/tokens/typography.css +6 -0
- package/styles/tokens/z-index.css +12 -0
- package/tsconfig.json +20 -21
- package/README.md +0 -60
- package/src/components/atoms/README.md +0 -11
- package/src/components/atoms/aspect-ratio.tsx +0 -32
- package/src/components/atoms/avatar.tsx +0 -98
- package/src/components/atoms/badge.tsx +0 -44
- package/src/components/atoms/brand-mark.tsx +0 -74
- package/src/components/atoms/button.tsx +0 -105
- package/src/components/atoms/checkbox.tsx +0 -63
- package/src/components/atoms/flex-box.tsx +0 -105
- package/src/components/atoms/icon.tsx +0 -34
- package/src/components/atoms/input.tsx +0 -92
- package/src/components/atoms/label.tsx +0 -41
- package/src/components/atoms/logo.tsx +0 -89
- package/src/components/atoms/progress.tsx +0 -55
- package/src/components/atoms/radio-group.tsx +0 -122
- package/src/components/atoms/scroll-area.tsx +0 -106
- package/src/components/atoms/section.tsx +0 -48
- package/src/components/atoms/separator.tsx +0 -45
- package/src/components/atoms/skeleton.tsx +0 -17
- package/src/components/atoms/slider.tsx +0 -93
- package/src/components/atoms/spinner.tsx +0 -47
- package/src/components/atoms/switch.tsx +0 -60
- package/src/components/atoms/textarea.tsx +0 -78
- package/src/components/atoms/toggle.tsx +0 -80
- package/src/components/charts/activity-heatmap.tsx +0 -186
- package/src/components/charts/axes.tsx +0 -21
- package/src/components/charts/chart-container.tsx +0 -254
- package/src/components/charts/chart-legend.tsx +0 -67
- package/src/components/charts/chart-tooltip.tsx +0 -161
- package/src/components/charts/chart-types.tsx +0 -49
- package/src/components/charts/containers.tsx +0 -11
- package/src/components/charts/data.tsx +0 -16
- package/src/components/charts/details.tsx +0 -25
- package/src/components/charts/dot-pulse.tsx +0 -61
- package/src/components/charts/gauge.tsx +0 -106
- package/src/components/charts/grids.tsx +0 -8
- package/src/components/charts/index.ts +0 -62
- package/src/components/charts/labeled-bar-list.tsx +0 -85
- package/src/components/charts/metric-breakdown.tsx +0 -316
- package/src/components/charts/references.tsx +0 -8
- package/src/components/charts/service-health-list.tsx +0 -85
- package/src/components/charts/sparkline-area.tsx +0 -80
- package/src/components/charts/sparkline.tsx +0 -52
- package/src/components/charts/stacked-bar.tsx +0 -104
- package/src/components/charts/text.tsx +0 -10
- package/src/components/charts/world-heat-map-inner.tsx +0 -317
- package/src/components/charts/world-heat-map.tsx +0 -184
- package/src/components/molecules/README.md +0 -12
- package/src/components/molecules/action-bar.tsx +0 -73
- package/src/components/molecules/activity-item.tsx +0 -74
- package/src/components/molecules/alert.tsx +0 -86
- package/src/components/molecules/animated-background.tsx +0 -92
- package/src/components/molecules/auth-shell.tsx +0 -95
- package/src/components/molecules/brand-lockup.tsx +0 -48
- package/src/components/molecules/breadcrumb.tsx +0 -157
- package/src/components/molecules/button-group.tsx +0 -104
- package/src/components/molecules/calendar.tsx +0 -217
- package/src/components/molecules/card.tsx +0 -102
- package/src/components/molecules/client-brand.tsx +0 -95
- package/src/components/molecules/code-block.tsx +0 -86
- package/src/components/molecules/countdown-button.tsx +0 -92
- package/src/components/molecules/empty-state.tsx +0 -56
- package/src/components/molecules/error-state.tsx +0 -42
- package/src/components/molecules/field-display.tsx +0 -35
- package/src/components/molecules/input-otp.tsx +0 -74
- package/src/components/molecules/launcher-card.tsx +0 -152
- package/src/components/molecules/loading-state.tsx +0 -36
- package/src/components/molecules/notification-item.tsx +0 -67
- package/src/components/molecules/notification-list.tsx +0 -45
- package/src/components/molecules/number-badge.tsx +0 -53
- package/src/components/molecules/or-separator.tsx +0 -38
- package/src/components/molecules/page-header.tsx +0 -88
- package/src/components/molecules/page-tabs.tsx +0 -94
- package/src/components/molecules/pagination.tsx +0 -150
- package/src/components/molecules/password-input.tsx +0 -83
- package/src/components/molecules/password-strength-meter.tsx +0 -104
- package/src/components/molecules/phone-input.tsx +0 -200
- package/src/components/molecules/search-bar.tsx +0 -64
- package/src/components/molecules/secret-field.tsx +0 -158
- package/src/components/molecules/section-card.tsx +0 -91
- package/src/components/molecules/social-buttons.tsx +0 -165
- package/src/components/molecules/stat-card.tsx +0 -100
- package/src/components/molecules/status-badge.tsx +0 -42
- package/src/components/molecules/stepper.tsx +0 -96
- package/src/components/molecules/table.tsx +0 -157
- package/src/components/molecules/terminal.tsx +0 -74
- package/src/components/molecules/toggle-group.tsx +0 -145
- package/src/components/molecules/tooltip.tsx +0 -155
- package/src/components/molecules/user-avatar-chip.tsx +0 -71
- package/src/components/organisms/README.md +0 -14
- package/src/components/organisms/accordion.tsx +0 -154
- package/src/components/organisms/alert-dialog.tsx +0 -277
- package/src/components/organisms/carousel.tsx +0 -244
- package/src/components/organisms/collapsible.tsx +0 -69
- package/src/components/organisms/command.tsx +0 -144
- package/src/components/organisms/context-menu.tsx +0 -339
- package/src/components/organisms/dashboard-grid.tsx +0 -369
- package/src/components/organisms/data-table.tsx +0 -330
- package/src/components/organisms/dialog.tsx +0 -312
- package/src/components/organisms/drawer.tsx +0 -123
- package/src/components/organisms/dropdown-menu.tsx +0 -440
- package/src/components/organisms/editors/code-editor.tsx +0 -144
- package/src/components/organisms/editors/index.ts +0 -4
- package/src/components/organisms/editors/markdown-editor.tsx +0 -153
- package/src/components/organisms/editors/markdown-renderer.ts +0 -27
- package/src/components/organisms/editors/prose-canvas-classes.ts +0 -45
- package/src/components/organisms/editors/rich-text-editor.tsx +0 -126
- package/src/components/organisms/editors/toolbar/md-toolbar.tsx +0 -129
- package/src/components/organisms/editors/toolbar/rte-toolbar.tsx +0 -211
- package/src/components/organisms/editors/toolbar/toolbar-shell.tsx +0 -45
- package/src/components/organisms/editors/use-codemirror-theme.ts +0 -61
- package/src/components/organisms/error-boundary.tsx +0 -61
- package/src/components/organisms/form.tsx +0 -174
- package/src/components/organisms/hover-card.tsx +0 -115
- package/src/components/organisms/menubar.tsx +0 -498
- package/src/components/organisms/navbar.tsx +0 -104
- package/src/components/organisms/navigation-menu.tsx +0 -235
- package/src/components/organisms/popover.tsx +0 -149
- package/src/components/organisms/resizable.tsx +0 -58
- package/src/components/organisms/schema-form.tsx +0 -232
- package/src/components/organisms/select.tsx +0 -309
- package/src/components/organisms/sheet.tsx +0 -265
- package/src/components/organisms/sidebar.tsx +0 -1040
- package/src/components/organisms/sonner.tsx +0 -96
- package/src/components/organisms/tabs.tsx +0 -133
- package/src/components/organisms/theme-provider.tsx +0 -101
- package/src/hooks/use-mobile.tsx +0 -19
- package/src/lib/portal-container.tsx +0 -35
- package/src/lib/utils.ts +0 -6
- package/src/native.ts +0 -23
- package/src/tokens/colors.ts +0 -91
- package/src/tokens/index.ts +0 -3
- package/src/tokens/spacing.ts +0 -55
- package/src/tokens/typography.ts +0 -27
- package/styles/dashboard-grid.css +0 -47
- package/styles/fonts/Roboto-VariableFont_wdth_wght.ttf +0 -0
- package/styles/glass.css +0 -175
- package/styles/leaflet.css +0 -13
- package/styles/tokens.css +0 -317
- package/tailwind.config.ts +0 -70
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
|
|
3
|
-
import { cn } from "../../lib/utils";
|
|
4
|
-
|
|
5
|
-
export interface TableProps extends React.HTMLAttributes<HTMLTableElement> {
|
|
6
|
-
/** `<TableHeader>` + `<TableBody>` + optional `<TableFooter>` + optional `<TableCaption>`. */
|
|
7
|
-
children?: React.ReactNode;
|
|
8
|
-
/** Tailwind / CSS classes merged onto the `<table>` via `cn()`. */
|
|
9
|
-
className?: string;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
const Table = React.forwardRef<HTMLTableElement, TableProps>(({ className, ...props }, ref) => (
|
|
13
|
-
<div className="relative w-full overflow-auto">
|
|
14
|
-
<table ref={ref} className={cn("w-full caption-bottom text-sm", className)} {...props} />
|
|
15
|
-
</div>
|
|
16
|
-
));
|
|
17
|
-
Table.displayName = "Table";
|
|
18
|
-
|
|
19
|
-
export interface TableHeaderProps extends React.HTMLAttributes<HTMLTableSectionElement> {
|
|
20
|
-
/** A single `<TableRow>` of `<TableHead>` cells. */
|
|
21
|
-
children?: React.ReactNode;
|
|
22
|
-
/** Tailwind / CSS classes merged onto the `<thead>` via `cn()`. */
|
|
23
|
-
className?: string;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const TableHeader = React.forwardRef<HTMLTableSectionElement, TableHeaderProps>(
|
|
27
|
-
({ className, ...props }, ref) => (
|
|
28
|
-
<thead ref={ref} className={cn("[&_tr]:border-b", className)} {...props} />
|
|
29
|
-
),
|
|
30
|
-
);
|
|
31
|
-
TableHeader.displayName = "TableHeader";
|
|
32
|
-
|
|
33
|
-
export interface TableBodyProps extends React.HTMLAttributes<HTMLTableSectionElement> {
|
|
34
|
-
/** A list of `<TableRow>`s of `<TableCell>`s. */
|
|
35
|
-
children?: React.ReactNode;
|
|
36
|
-
/** Tailwind / CSS classes merged onto the `<tbody>` via `cn()`. */
|
|
37
|
-
className?: string;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
const TableBody = React.forwardRef<HTMLTableSectionElement, TableBodyProps>(
|
|
41
|
-
({ className, ...props }, ref) => (
|
|
42
|
-
<tbody ref={ref} className={cn("[&_tr:last-child]:border-0", className)} {...props} />
|
|
43
|
-
),
|
|
44
|
-
);
|
|
45
|
-
TableBody.displayName = "TableBody";
|
|
46
|
-
|
|
47
|
-
export interface TableFooterProps extends React.HTMLAttributes<HTMLTableSectionElement> {
|
|
48
|
-
/** A `<TableRow>` of summary `<TableCell>`s (totals, etc.). */
|
|
49
|
-
children?: React.ReactNode;
|
|
50
|
-
/** Tailwind / CSS classes merged onto the `<tfoot>` via `cn()`. */
|
|
51
|
-
className?: string;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
const TableFooter = React.forwardRef<HTMLTableSectionElement, TableFooterProps>(
|
|
55
|
-
({ className, ...props }, ref) => (
|
|
56
|
-
<tfoot
|
|
57
|
-
ref={ref}
|
|
58
|
-
className={cn("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0", className)}
|
|
59
|
-
{...props}
|
|
60
|
-
/>
|
|
61
|
-
),
|
|
62
|
-
);
|
|
63
|
-
TableFooter.displayName = "TableFooter";
|
|
64
|
-
|
|
65
|
-
export interface TableRowProps extends React.HTMLAttributes<HTMLTableRowElement> {
|
|
66
|
-
/** `<TableHead>` or `<TableCell>` children. */
|
|
67
|
-
children?: React.ReactNode;
|
|
68
|
-
/** Tailwind / CSS classes merged onto the `<tr>` via `cn()`. */
|
|
69
|
-
className?: string;
|
|
70
|
-
/**
|
|
71
|
-
* Optional data-state — pass `"selected"` to highlight selected rows
|
|
72
|
-
* (e.g. checkbox-driven multi-select tables). Mirrors Radix's pattern.
|
|
73
|
-
*/
|
|
74
|
-
"data-state"?: "selected";
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
const TableRow = React.forwardRef<HTMLTableRowElement, TableRowProps>(
|
|
78
|
-
({ className, ...props }, ref) => (
|
|
79
|
-
<tr
|
|
80
|
-
ref={ref}
|
|
81
|
-
className={cn(
|
|
82
|
-
"border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",
|
|
83
|
-
className,
|
|
84
|
-
)}
|
|
85
|
-
{...props}
|
|
86
|
-
/>
|
|
87
|
-
),
|
|
88
|
-
);
|
|
89
|
-
TableRow.displayName = "TableRow";
|
|
90
|
-
|
|
91
|
-
export interface TableHeadProps extends React.ThHTMLAttributes<HTMLTableCellElement> {
|
|
92
|
-
/** Column header text. */
|
|
93
|
-
children?: React.ReactNode;
|
|
94
|
-
/** Tailwind / CSS classes merged onto the `<th>` via `cn()`. */
|
|
95
|
-
className?: string;
|
|
96
|
-
/** Number of columns this header spans. */
|
|
97
|
-
colSpan?: number;
|
|
98
|
-
/** Number of rows this header spans. */
|
|
99
|
-
rowSpan?: number;
|
|
100
|
-
/** Scope of the header — `"col"` (default) or `"row"` for row-headers. */
|
|
101
|
-
scope?: "col" | "row" | "rowgroup" | "colgroup";
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
const TableHead = React.forwardRef<HTMLTableCellElement, TableHeadProps>(
|
|
105
|
-
({ className, ...props }, ref) => (
|
|
106
|
-
<th
|
|
107
|
-
ref={ref}
|
|
108
|
-
className={cn(
|
|
109
|
-
"h-10 px-2 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
|
|
110
|
-
className,
|
|
111
|
-
)}
|
|
112
|
-
{...props}
|
|
113
|
-
/>
|
|
114
|
-
),
|
|
115
|
-
);
|
|
116
|
-
TableHead.displayName = "TableHead";
|
|
117
|
-
|
|
118
|
-
export interface TableCellProps extends React.TdHTMLAttributes<HTMLTableCellElement> {
|
|
119
|
-
/** Cell content. */
|
|
120
|
-
children?: React.ReactNode;
|
|
121
|
-
/** Tailwind / CSS classes merged onto the `<td>` via `cn()`. */
|
|
122
|
-
className?: string;
|
|
123
|
-
/** Number of columns this cell spans. */
|
|
124
|
-
colSpan?: number;
|
|
125
|
-
/** Number of rows this cell spans. */
|
|
126
|
-
rowSpan?: number;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
const TableCell = React.forwardRef<HTMLTableCellElement, TableCellProps>(
|
|
130
|
-
({ className, ...props }, ref) => (
|
|
131
|
-
<td
|
|
132
|
-
ref={ref}
|
|
133
|
-
className={cn(
|
|
134
|
-
"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
|
|
135
|
-
className,
|
|
136
|
-
)}
|
|
137
|
-
{...props}
|
|
138
|
-
/>
|
|
139
|
-
),
|
|
140
|
-
);
|
|
141
|
-
TableCell.displayName = "TableCell";
|
|
142
|
-
|
|
143
|
-
export interface TableCaptionProps extends React.HTMLAttributes<HTMLTableCaptionElement> {
|
|
144
|
-
/** A short label describing the table — read by screen readers. */
|
|
145
|
-
children?: React.ReactNode;
|
|
146
|
-
/** Tailwind / CSS classes merged onto the `<caption>` via `cn()`. */
|
|
147
|
-
className?: string;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
const TableCaption = React.forwardRef<HTMLTableCaptionElement, TableCaptionProps>(
|
|
151
|
-
({ className, ...props }, ref) => (
|
|
152
|
-
<caption ref={ref} className={cn("mt-4 text-sm text-muted-foreground", className)} {...props} />
|
|
153
|
-
),
|
|
154
|
-
);
|
|
155
|
-
TableCaption.displayName = "TableCaption";
|
|
156
|
-
|
|
157
|
-
export { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow };
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
// molecules: can import tokens/, lib/utils, atoms/.
|
|
2
|
-
import * as React from "react";
|
|
3
|
-
|
|
4
|
-
import { cn } from "../../lib/utils";
|
|
5
|
-
|
|
6
|
-
export interface TerminalProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "title"> {
|
|
7
|
-
/**
|
|
8
|
-
* Optional label rendered in the macOS-style chrome strip, next to the
|
|
9
|
-
* traffic-light dots. Typical use: a working directory + command
|
|
10
|
-
* (e.g. `~/Olympus · octl`).
|
|
11
|
-
*/
|
|
12
|
-
title?: React.ReactNode;
|
|
13
|
-
/**
|
|
14
|
-
* Terminal body. Renders inside a `<pre>` with mono font and 1.7 line
|
|
15
|
-
* height. Free-form — drop plain text, ANSI-coloured `<span>`s, or any
|
|
16
|
-
* inline highlights you want.
|
|
17
|
-
*/
|
|
18
|
-
children: React.ReactNode;
|
|
19
|
-
className?: string;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const Terminal = React.forwardRef<HTMLDivElement, TerminalProps>(
|
|
23
|
-
({ title, children, className, ...props }, ref) => (
|
|
24
|
-
<div
|
|
25
|
-
ref={ref}
|
|
26
|
-
data-slot="terminal"
|
|
27
|
-
className={cn(
|
|
28
|
-
"overflow-hidden rounded-xl border border-border shadow-[0_30px_60px_-20px_rgb(0_0_0/0.35)]",
|
|
29
|
-
className,
|
|
30
|
-
)}
|
|
31
|
-
style={{ background: "#0a0a0b" }}
|
|
32
|
-
{...props}
|
|
33
|
-
>
|
|
34
|
-
<div
|
|
35
|
-
className="flex items-center gap-1.5 px-3"
|
|
36
|
-
style={{
|
|
37
|
-
height: 32,
|
|
38
|
-
background: "#141417",
|
|
39
|
-
borderBottom: "1px solid #222",
|
|
40
|
-
}}
|
|
41
|
-
>
|
|
42
|
-
<span
|
|
43
|
-
aria-hidden="true"
|
|
44
|
-
className="inline-block h-2.5 w-2.5 rounded-full"
|
|
45
|
-
style={{ background: "#ff5f57" }}
|
|
46
|
-
/>
|
|
47
|
-
<span
|
|
48
|
-
aria-hidden="true"
|
|
49
|
-
className="inline-block h-2.5 w-2.5 rounded-full"
|
|
50
|
-
style={{ background: "#febc2e" }}
|
|
51
|
-
/>
|
|
52
|
-
<span
|
|
53
|
-
aria-hidden="true"
|
|
54
|
-
className="inline-block h-2.5 w-2.5 rounded-full"
|
|
55
|
-
style={{ background: "#28c840" }}
|
|
56
|
-
/>
|
|
57
|
-
{title != null && (
|
|
58
|
-
<span className="ml-2.5 font-mono text-[11px]" style={{ color: "#6b7280" }}>
|
|
59
|
-
{title}
|
|
60
|
-
</span>
|
|
61
|
-
)}
|
|
62
|
-
</div>
|
|
63
|
-
<pre
|
|
64
|
-
className="m-0 overflow-x-auto p-5 font-mono text-[12.5px] leading-[1.7]"
|
|
65
|
-
style={{ color: "#e4e4e7" }}
|
|
66
|
-
>
|
|
67
|
-
{children}
|
|
68
|
-
</pre>
|
|
69
|
-
</div>
|
|
70
|
-
),
|
|
71
|
-
);
|
|
72
|
-
Terminal.displayName = "Terminal";
|
|
73
|
-
|
|
74
|
-
export { Terminal };
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import * as ToggleGroupPrimitive from "@radix-ui/react-toggle-group";
|
|
4
|
-
import type { VariantProps } from "class-variance-authority";
|
|
5
|
-
import * as React from "react";
|
|
6
|
-
|
|
7
|
-
import { cn } from "../../lib/utils";
|
|
8
|
-
import { toggleVariants } from "../atoms/toggle";
|
|
9
|
-
|
|
10
|
-
const ToggleGroupContext = React.createContext<VariantProps<typeof toggleVariants>>({
|
|
11
|
-
size: "default",
|
|
12
|
-
variant: "default",
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
export interface ToggleGroupProps {
|
|
16
|
-
/**
|
|
17
|
-
* Selection mode. `"single"` allows one item active at a time;
|
|
18
|
-
* `"multiple"` allows independent toggles.
|
|
19
|
-
*/
|
|
20
|
-
type: "single" | "multiple";
|
|
21
|
-
/**
|
|
22
|
-
* Controlled value. For `type="single"` it's a string; for
|
|
23
|
-
* `type="multiple"` it's an array of strings.
|
|
24
|
-
*/
|
|
25
|
-
value?: string | string[];
|
|
26
|
-
/** Initial value for uncontrolled usage. */
|
|
27
|
-
defaultValue?: string | string[];
|
|
28
|
-
/** Fires when the user toggles an item. */
|
|
29
|
-
onValueChange?: (value: string & string[]) => void;
|
|
30
|
-
/**
|
|
31
|
-
* Disable every toggle in the group.
|
|
32
|
-
* @default false
|
|
33
|
-
*/
|
|
34
|
-
disabled?: boolean;
|
|
35
|
-
/**
|
|
36
|
-
* Layout direction.
|
|
37
|
-
* @default "horizontal"
|
|
38
|
-
*/
|
|
39
|
-
orientation?: "horizontal" | "vertical";
|
|
40
|
-
/**
|
|
41
|
-
* Reading direction. Affects keyboard arrow navigation.
|
|
42
|
-
* @default "ltr"
|
|
43
|
-
*/
|
|
44
|
-
dir?: "ltr" | "rtl";
|
|
45
|
-
/**
|
|
46
|
-
* When true, arrow-key navigation wraps from the last item to the first.
|
|
47
|
-
* @default true
|
|
48
|
-
*/
|
|
49
|
-
loop?: boolean;
|
|
50
|
-
/**
|
|
51
|
-
* Filled vs outlined preset (inherits from `<Toggle>`).
|
|
52
|
-
* @default "default"
|
|
53
|
-
*/
|
|
54
|
-
variant?: "default" | "outline";
|
|
55
|
-
/**
|
|
56
|
-
* Size preset (inherits from `<Toggle>`).
|
|
57
|
-
* @default "default"
|
|
58
|
-
*/
|
|
59
|
-
size?: "default" | "sm" | "lg";
|
|
60
|
-
/**
|
|
61
|
-
* Render as a Radix Slot — forwards props onto the immediate child.
|
|
62
|
-
* @default false
|
|
63
|
-
*/
|
|
64
|
-
asChild?: boolean;
|
|
65
|
-
/** A flat list of `<ToggleGroupItem>`s. */
|
|
66
|
-
children?: React.ReactNode;
|
|
67
|
-
/** Tailwind / CSS classes merged onto the group via `cn()`. */
|
|
68
|
-
className?: string;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
const ToggleGroupImpl = React.forwardRef<
|
|
72
|
-
React.ElementRef<typeof ToggleGroupPrimitive.Root>,
|
|
73
|
-
ToggleGroupProps
|
|
74
|
-
>(({ className, variant, size, children, ...props }, ref) => (
|
|
75
|
-
<ToggleGroupPrimitive.Root
|
|
76
|
-
ref={ref}
|
|
77
|
-
{...(props as React.ComponentPropsWithoutRef<typeof ToggleGroupPrimitive.Root>)}
|
|
78
|
-
className={cn("flex items-center justify-center gap-1", className)}
|
|
79
|
-
>
|
|
80
|
-
<ToggleGroupContext.Provider value={{ variant, size }}>{children}</ToggleGroupContext.Provider>
|
|
81
|
-
</ToggleGroupPrimitive.Root>
|
|
82
|
-
));
|
|
83
|
-
|
|
84
|
-
ToggleGroupImpl.displayName = ToggleGroupPrimitive.Root.displayName;
|
|
85
|
-
|
|
86
|
-
const ToggleGroup = ToggleGroupImpl as React.ForwardRefExoticComponent<
|
|
87
|
-
ToggleGroupProps & React.RefAttributes<HTMLDivElement>
|
|
88
|
-
>;
|
|
89
|
-
|
|
90
|
-
export interface ToggleGroupItemProps
|
|
91
|
-
extends React.ComponentPropsWithoutRef<typeof ToggleGroupPrimitive.Item>,
|
|
92
|
-
VariantProps<typeof toggleVariants> {
|
|
93
|
-
/** Required — value reported when this toggle is active. */
|
|
94
|
-
value: string;
|
|
95
|
-
/**
|
|
96
|
-
* Disable only this toggle.
|
|
97
|
-
* @default false
|
|
98
|
-
*/
|
|
99
|
-
disabled?: boolean;
|
|
100
|
-
/**
|
|
101
|
-
* Filled vs outlined. Defaults to inheriting from the parent
|
|
102
|
-
* `<ToggleGroup>`.
|
|
103
|
-
*/
|
|
104
|
-
variant?: "default" | "outline";
|
|
105
|
-
/**
|
|
106
|
-
* Size preset. Defaults to inheriting from the parent `<ToggleGroup>`.
|
|
107
|
-
*/
|
|
108
|
-
size?: "default" | "sm" | "lg";
|
|
109
|
-
/**
|
|
110
|
-
* Render as a Radix Slot — forwards props onto the immediate child.
|
|
111
|
-
* @default false
|
|
112
|
-
*/
|
|
113
|
-
asChild?: boolean;
|
|
114
|
-
/** Toggle label or icon. */
|
|
115
|
-
children?: React.ReactNode;
|
|
116
|
-
/** Tailwind / CSS classes merged onto the toggle via `cn()`. */
|
|
117
|
-
className?: string;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
const ToggleGroupItem = React.forwardRef<
|
|
121
|
-
React.ElementRef<typeof ToggleGroupPrimitive.Item>,
|
|
122
|
-
ToggleGroupItemProps
|
|
123
|
-
>(({ className, children, variant, size, ...props }, ref) => {
|
|
124
|
-
const context = React.useContext(ToggleGroupContext);
|
|
125
|
-
|
|
126
|
-
return (
|
|
127
|
-
<ToggleGroupPrimitive.Item
|
|
128
|
-
ref={ref}
|
|
129
|
-
className={cn(
|
|
130
|
-
toggleVariants({
|
|
131
|
-
variant: context.variant || variant,
|
|
132
|
-
size: context.size || size,
|
|
133
|
-
}),
|
|
134
|
-
className,
|
|
135
|
-
)}
|
|
136
|
-
{...props}
|
|
137
|
-
>
|
|
138
|
-
{children}
|
|
139
|
-
</ToggleGroupPrimitive.Item>
|
|
140
|
-
);
|
|
141
|
-
});
|
|
142
|
-
|
|
143
|
-
ToggleGroupItem.displayName = ToggleGroupPrimitive.Item.displayName;
|
|
144
|
-
|
|
145
|
-
export { ToggleGroup, ToggleGroupItem };
|
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
4
|
-
import * as React from "react";
|
|
5
|
-
|
|
6
|
-
import { usePortalContainer } from "../../lib/portal-container";
|
|
7
|
-
import { cn } from "../../lib/utils";
|
|
8
|
-
|
|
9
|
-
export interface TooltipProviderProps
|
|
10
|
-
extends React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Provider> {
|
|
11
|
-
/**
|
|
12
|
-
* Delay in ms before any tooltip in the provider opens. Set to 0 for
|
|
13
|
-
* instant tooltips (e.g. icon rails).
|
|
14
|
-
* @default 700
|
|
15
|
-
*/
|
|
16
|
-
delayDuration?: number;
|
|
17
|
-
/**
|
|
18
|
-
* Delay in ms before a tooltip closes after the cursor leaves. Useful
|
|
19
|
-
* for letting users drag from the trigger to the content.
|
|
20
|
-
* @default 300
|
|
21
|
-
*/
|
|
22
|
-
skipDelayDuration?: number;
|
|
23
|
-
/**
|
|
24
|
-
* When true, the tooltip will not close while the user is interacting
|
|
25
|
-
* with content inside it (e.g. hover, focus).
|
|
26
|
-
* @default false
|
|
27
|
-
*/
|
|
28
|
-
disableHoverableContent?: boolean;
|
|
29
|
-
/** All `<Tooltip>`s in the subtree share this provider's delays. */
|
|
30
|
-
children: React.ReactNode;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const TooltipProvider = TooltipPrimitive.Provider as React.FC<TooltipProviderProps>;
|
|
34
|
-
|
|
35
|
-
export interface TooltipProps extends React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Root> {
|
|
36
|
-
/** Controlled open state. */
|
|
37
|
-
open?: boolean;
|
|
38
|
-
/** Initial open state for uncontrolled usage. */
|
|
39
|
-
defaultOpen?: boolean;
|
|
40
|
-
/** Fires whenever the tooltip opens or closes. */
|
|
41
|
-
onOpenChange?: (open: boolean) => void;
|
|
42
|
-
/**
|
|
43
|
-
* Override the parent provider's `delayDuration` for this tooltip
|
|
44
|
-
* specifically.
|
|
45
|
-
*/
|
|
46
|
-
delayDuration?: number;
|
|
47
|
-
/**
|
|
48
|
-
* Override the parent provider's `disableHoverableContent` for this
|
|
49
|
-
* tooltip.
|
|
50
|
-
*/
|
|
51
|
-
disableHoverableContent?: boolean;
|
|
52
|
-
/** Trigger + Content. */
|
|
53
|
-
children?: React.ReactNode;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
const Tooltip = TooltipPrimitive.Root as React.FC<TooltipProps>;
|
|
57
|
-
|
|
58
|
-
export interface TooltipTriggerProps
|
|
59
|
-
extends React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Trigger> {
|
|
60
|
-
/**
|
|
61
|
-
* Render as a Radix Slot — forwards props onto the immediate child.
|
|
62
|
-
* Common pattern for wrapping a `<Button>` or icon.
|
|
63
|
-
* @default false
|
|
64
|
-
*/
|
|
65
|
-
asChild?: boolean;
|
|
66
|
-
/** The element that opens the tooltip on hover/focus. */
|
|
67
|
-
children?: React.ReactNode;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
const TooltipTrigger = TooltipPrimitive.Trigger as React.ForwardRefExoticComponent<
|
|
71
|
-
TooltipTriggerProps & React.RefAttributes<HTMLButtonElement>
|
|
72
|
-
>;
|
|
73
|
-
|
|
74
|
-
export interface TooltipContentProps
|
|
75
|
-
extends React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content> {
|
|
76
|
-
/**
|
|
77
|
-
* Distance in pixels between the trigger and the tooltip content.
|
|
78
|
-
* @default 4
|
|
79
|
-
*/
|
|
80
|
-
sideOffset?: number;
|
|
81
|
-
/**
|
|
82
|
-
* Distance from the alignment edge.
|
|
83
|
-
* @default 0
|
|
84
|
-
*/
|
|
85
|
-
alignOffset?: number;
|
|
86
|
-
/**
|
|
87
|
-
* Preferred side of the trigger to render on.
|
|
88
|
-
* @default "top"
|
|
89
|
-
*/
|
|
90
|
-
side?: "top" | "right" | "bottom" | "left";
|
|
91
|
-
/**
|
|
92
|
-
* Alignment along the chosen side.
|
|
93
|
-
* @default "center"
|
|
94
|
-
*/
|
|
95
|
-
align?: "start" | "center" | "end";
|
|
96
|
-
/**
|
|
97
|
-
* Avoid colliding with the viewport edges by flipping/shifting.
|
|
98
|
-
* @default true
|
|
99
|
-
*/
|
|
100
|
-
avoidCollisions?: boolean;
|
|
101
|
-
/**
|
|
102
|
-
* Padding kept from collision boundaries.
|
|
103
|
-
* @default 0
|
|
104
|
-
*/
|
|
105
|
-
collisionPadding?: number | { top?: number; right?: number; bottom?: number; left?: number };
|
|
106
|
-
/**
|
|
107
|
-
* Stick to the trigger or partially follow on scroll.
|
|
108
|
-
* @default "partial"
|
|
109
|
-
*/
|
|
110
|
-
sticky?: "partial" | "always";
|
|
111
|
-
/** Hide the content when the trigger is detached or covered. */
|
|
112
|
-
hideWhenDetached?: boolean;
|
|
113
|
-
/**
|
|
114
|
-
* Force the content to mount even when closed. Pair with a CSS
|
|
115
|
-
* animation that fades in/out based on `data-state`.
|
|
116
|
-
* @default false
|
|
117
|
-
*/
|
|
118
|
-
forceMount?: true;
|
|
119
|
-
/**
|
|
120
|
-
* Render as a Radix Slot — forwards props onto the immediate child.
|
|
121
|
-
* @default false
|
|
122
|
-
*/
|
|
123
|
-
asChild?: boolean;
|
|
124
|
-
/** Tooltip body. Keep terse — one short line is the convention. */
|
|
125
|
-
children?: React.ReactNode;
|
|
126
|
-
/** Tailwind / CSS classes merged onto the content via `cn()`. */
|
|
127
|
-
className?: string;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
const TooltipContent = React.forwardRef<
|
|
131
|
-
React.ElementRef<typeof TooltipPrimitive.Content>,
|
|
132
|
-
TooltipContentProps
|
|
133
|
-
>(({ className, sideOffset = 6, children, ...props }, ref) => {
|
|
134
|
-
const container = usePortalContainer();
|
|
135
|
-
return (
|
|
136
|
-
<TooltipPrimitive.Portal container={container ?? undefined}>
|
|
137
|
-
<TooltipPrimitive.Content
|
|
138
|
-
ref={ref}
|
|
139
|
-
data-slot="tooltip-content"
|
|
140
|
-
sideOffset={sideOffset}
|
|
141
|
-
className={cn(
|
|
142
|
-
"z-50 max-w-xs overflow-hidden rounded-md border border-border/50 bg-popover px-2 py-1 text-[11px] font-medium text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-1 data-[side=left]:slide-in-from-right-1 data-[side=right]:slide-in-from-left-1 data-[side=top]:slide-in-from-bottom-1 origin-[var(--radix-tooltip-content-transform-origin)]",
|
|
143
|
-
className,
|
|
144
|
-
)}
|
|
145
|
-
{...props}
|
|
146
|
-
>
|
|
147
|
-
{children}
|
|
148
|
-
<TooltipPrimitive.Arrow width={10} height={5} style={{ fill: "hsl(var(--popover))" }} />
|
|
149
|
-
</TooltipPrimitive.Content>
|
|
150
|
-
</TooltipPrimitive.Portal>
|
|
151
|
-
);
|
|
152
|
-
});
|
|
153
|
-
TooltipContent.displayName = TooltipPrimitive.Content.displayName;
|
|
154
|
-
|
|
155
|
-
export { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger };
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { ChevronDown } from "lucide-react";
|
|
4
|
-
import * as React from "react";
|
|
5
|
-
|
|
6
|
-
import { cn } from "../../lib/utils";
|
|
7
|
-
import { Avatar, AvatarFallback, AvatarImage } from "../atoms/avatar";
|
|
8
|
-
|
|
9
|
-
export interface UserAvatarChipProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
10
|
-
/** Display name (rendered next to the avatar). */
|
|
11
|
-
name: string;
|
|
12
|
-
/** Optional secondary line. Hidden when `collapsed`. */
|
|
13
|
-
email?: string;
|
|
14
|
-
/** Initials shown by AvatarFallback when no image is provided. */
|
|
15
|
-
fallback?: string;
|
|
16
|
-
/** Avatar image src. */
|
|
17
|
-
imageSrc?: string;
|
|
18
|
-
/** When true, renders only the avatar without name + chevron. */
|
|
19
|
-
collapsed?: boolean;
|
|
20
|
-
/** Set to false to hide the trailing ChevronDown affordance. */
|
|
21
|
-
chevron?: boolean;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export const UserAvatarChip = React.forwardRef<HTMLButtonElement, UserAvatarChipProps>(
|
|
25
|
-
(
|
|
26
|
-
{ name, email, fallback, imageSrc, collapsed = false, chevron = true, className, ...props },
|
|
27
|
-
ref,
|
|
28
|
-
) => {
|
|
29
|
-
const initials =
|
|
30
|
-
fallback ??
|
|
31
|
-
name
|
|
32
|
-
.split(" ")
|
|
33
|
-
.map((part) => part[0])
|
|
34
|
-
.filter(Boolean)
|
|
35
|
-
.slice(0, 2)
|
|
36
|
-
.join("")
|
|
37
|
-
.toUpperCase();
|
|
38
|
-
return (
|
|
39
|
-
<button
|
|
40
|
-
ref={ref}
|
|
41
|
-
type="button"
|
|
42
|
-
aria-label={collapsed ? name : undefined}
|
|
43
|
-
className={cn(
|
|
44
|
-
"inline-flex items-center gap-2 rounded-full border border-border bg-card text-[13px] font-medium text-foreground transition-colors hover:bg-accent",
|
|
45
|
-
collapsed ? "p-1" : "py-1 pl-1 pr-3",
|
|
46
|
-
className,
|
|
47
|
-
)}
|
|
48
|
-
{...props}
|
|
49
|
-
>
|
|
50
|
-
<Avatar className="h-7 w-7">
|
|
51
|
-
{imageSrc && <AvatarImage src={imageSrc} alt={name} />}
|
|
52
|
-
<AvatarFallback className="text-[11px] font-semibold">{initials}</AvatarFallback>
|
|
53
|
-
</Avatar>
|
|
54
|
-
{!collapsed && (
|
|
55
|
-
<>
|
|
56
|
-
<div className="flex flex-col items-start leading-tight">
|
|
57
|
-
<span className="truncate">{name}</span>
|
|
58
|
-
{email && (
|
|
59
|
-
<span className="truncate text-[11px] font-normal text-muted-foreground">
|
|
60
|
-
{email}
|
|
61
|
-
</span>
|
|
62
|
-
)}
|
|
63
|
-
</div>
|
|
64
|
-
{chevron && <ChevronDown className="h-3 w-3 text-muted-foreground" aria-hidden />}
|
|
65
|
-
</>
|
|
66
|
-
)}
|
|
67
|
-
</button>
|
|
68
|
-
);
|
|
69
|
-
},
|
|
70
|
-
);
|
|
71
|
-
UserAvatarChip.displayName = "UserAvatarChip";
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
# Organisms
|
|
2
|
-
|
|
3
|
-
Stateful surfaces. Compositions of atoms + molecules that own interactive
|
|
4
|
-
state (open/close, selection, form state) or complete complex UX.
|
|
5
|
-
|
|
6
|
-
**Can import**: `tokens/`, `lib/utils`, `atoms/`, `molecules/`, React.
|
|
7
|
-
|
|
8
|
-
**Cannot import**: anything from `templates/`.
|
|
9
|
-
|
|
10
|
-
Organisms are reusable — they don't know about specific app routes or domain
|
|
11
|
-
data. `DataTable` is an organism; `IdentitiesTable` (which knows how to render
|
|
12
|
-
a `Kratos.Identity`) is app-specific and belongs in that app's `features/`.
|
|
13
|
-
|
|
14
|
-
See [CONTRIBUTING.md](../../../CONTRIBUTING.md) for the full atomic-design rules.
|