@optimum-intelligence/opti-ui 0.0.0-stage → 0.2.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/LICENSE +23 -0
- package/README.md +161 -2
- package/dist/components/accordion/Accordion.d.ts +17 -0
- package/dist/components/accordion/Accordion.js +204 -0
- package/dist/components/accordion/Accordion.js.map +1 -0
- package/dist/components/alert/Alert.d.ts +18 -0
- package/dist/components/alert/Alert.js +164 -0
- package/dist/components/alert/Alert.js.map +1 -0
- package/dist/components/app-shell/AppShell.d.ts +97 -0
- package/dist/components/app-shell/AppShell.js +689 -0
- package/dist/components/app-shell/AppShell.js.map +1 -0
- package/dist/components/avatar/Avatar.d.ts +21 -0
- package/dist/components/avatar/Avatar.js +190 -0
- package/dist/components/avatar/Avatar.js.map +1 -0
- package/dist/components/badge/Badge.d.ts +16 -0
- package/dist/components/badge/Badge.js +94 -0
- package/dist/components/badge/Badge.js.map +1 -0
- package/dist/components/breadcrumbs/Breadcrumbs.d.ts +18 -0
- package/dist/components/breadcrumbs/Breadcrumbs.js +154 -0
- package/dist/components/breadcrumbs/Breadcrumbs.js.map +1 -0
- package/dist/components/button/Button.d.ts +23 -0
- package/dist/components/button/Button.js +159 -0
- package/dist/components/button/Button.js.map +1 -0
- package/dist/components/calendar/Calendar.d.ts +59 -0
- package/dist/components/calendar/Calendar.js +709 -0
- package/dist/components/calendar/Calendar.js.map +1 -0
- package/dist/components/calendar/date-utils.d.ts +32 -0
- package/dist/components/calendar/date-utils.js +112 -0
- package/dist/components/calendar/date-utils.js.map +1 -0
- package/dist/components/card/Card.d.ts +42 -0
- package/dist/components/card/Card.js +82 -0
- package/dist/components/card/Card.js.map +1 -0
- package/dist/components/choice/Choice.d.ts +32 -0
- package/dist/components/choice/Choice.js +371 -0
- package/dist/components/choice/Choice.js.map +1 -0
- package/dist/components/collapsible/Collapsible.d.ts +15 -0
- package/dist/components/collapsible/Collapsible.js +155 -0
- package/dist/components/collapsible/Collapsible.js.map +1 -0
- package/dist/components/combobox/Combobox.d.ts +68 -0
- package/dist/components/combobox/Combobox.js +752 -0
- package/dist/components/combobox/Combobox.js.map +1 -0
- package/dist/components/command-palette/CommandPalette.d.ts +52 -0
- package/dist/components/command-palette/CommandPalette.js +328 -0
- package/dist/components/command-palette/CommandPalette.js.map +1 -0
- package/dist/components/data-table/DataTable.d.ts +111 -0
- package/dist/components/data-table/DataTable.js +444 -0
- package/dist/components/data-table/DataTable.js.map +1 -0
- package/dist/components/date-picker/DatePicker.d.ts +50 -0
- package/dist/components/date-picker/DatePicker.js +485 -0
- package/dist/components/date-picker/DatePicker.js.map +1 -0
- package/dist/components/date-picker/DateRangePicker.d.ts +39 -0
- package/dist/components/date-picker/DateRangePicker.js +339 -0
- package/dist/components/date-picker/DateRangePicker.js.map +1 -0
- package/dist/components/date-picker/PickerField.d.ts +38 -0
- package/dist/components/date-picker/PickerField.js +238 -0
- package/dist/components/date-picker/PickerField.js.map +1 -0
- package/dist/components/dialog/Dialog.d.ts +70 -0
- package/dist/components/dialog/Dialog.js +354 -0
- package/dist/components/dialog/Dialog.js.map +1 -0
- package/dist/components/drawer/Drawer.d.ts +39 -0
- package/dist/components/drawer/Drawer.js +225 -0
- package/dist/components/drawer/Drawer.js.map +1 -0
- package/dist/components/empty-state/EmptyState.d.ts +12 -0
- package/dist/components/empty-state/EmptyState.js +116 -0
- package/dist/components/empty-state/EmptyState.js.map +1 -0
- package/dist/components/field/Field.d.ts +36 -0
- package/dist/components/field/Field.js +337 -0
- package/dist/components/field/Field.js.map +1 -0
- package/dist/components/file-upload/FileUpload.d.ts +91 -0
- package/dist/components/file-upload/FileUpload.js +714 -0
- package/dist/components/file-upload/FileUpload.js.map +1 -0
- package/dist/components/input/Input.d.ts +49 -0
- package/dist/components/input/Input.js +538 -0
- package/dist/components/input/Input.js.map +1 -0
- package/dist/components/link/Link.d.ts +17 -0
- package/dist/components/link/Link.js +91 -0
- package/dist/components/link/Link.js.map +1 -0
- package/dist/components/menu/Menu.d.ts +79 -0
- package/dist/components/menu/Menu.js +615 -0
- package/dist/components/menu/Menu.js.map +1 -0
- package/dist/components/number-field/NumberField.d.ts +16 -0
- package/dist/components/number-field/NumberField.js +188 -0
- package/dist/components/number-field/NumberField.js.map +1 -0
- package/dist/components/pagination/Pagination.d.ts +34 -0
- package/dist/components/pagination/Pagination.js +244 -0
- package/dist/components/pagination/Pagination.js.map +1 -0
- package/dist/components/popover/Popover.d.ts +22 -0
- package/dist/components/popover/Popover.js +186 -0
- package/dist/components/popover/Popover.js.map +1 -0
- package/dist/components/preview-card/PreviewCard.d.ts +20 -0
- package/dist/components/preview-card/PreviewCard.js +114 -0
- package/dist/components/preview-card/PreviewCard.js.map +1 -0
- package/dist/components/progress/Progress.d.ts +20 -0
- package/dist/components/progress/Progress.js +169 -0
- package/dist/components/progress/Progress.js.map +1 -0
- package/dist/components/scroll-area/ScrollArea.d.ts +8 -0
- package/dist/components/scroll-area/ScrollArea.js +112 -0
- package/dist/components/scroll-area/ScrollArea.js.map +1 -0
- package/dist/components/search-input/SearchInput.d.ts +14 -0
- package/dist/components/search-input/SearchInput.js +114 -0
- package/dist/components/search-input/SearchInput.js.map +1 -0
- package/dist/components/select/Select.d.ts +66 -0
- package/dist/components/select/Select.js +601 -0
- package/dist/components/select/Select.js.map +1 -0
- package/dist/components/separator/Separator.d.ts +4 -0
- package/dist/components/separator/Separator.js +46 -0
- package/dist/components/separator/Separator.js.map +1 -0
- package/dist/components/skeleton/Skeleton.d.ts +16 -0
- package/dist/components/skeleton/Skeleton.js +135 -0
- package/dist/components/skeleton/Skeleton.js.map +1 -0
- package/dist/components/slider/Slider.d.ts +11 -0
- package/dist/components/slider/Slider.js +107 -0
- package/dist/components/slider/Slider.js.map +1 -0
- package/dist/components/spinner/Spinner.d.ts +9 -0
- package/dist/components/spinner/Spinner.js +78 -0
- package/dist/components/spinner/Spinner.js.map +1 -0
- package/dist/components/stack/Stack.d.ts +23 -0
- package/dist/components/stack/Stack.js +79 -0
- package/dist/components/stack/Stack.js.map +1 -0
- package/dist/components/stat-card/StatCard.d.ts +22 -0
- package/dist/components/stat-card/StatCard.js +153 -0
- package/dist/components/stat-card/StatCard.js.map +1 -0
- package/dist/components/stepper/Stepper.d.ts +30 -0
- package/dist/components/stepper/Stepper.js +131 -0
- package/dist/components/stepper/Stepper.js.map +1 -0
- package/dist/components/table/Table.d.ts +53 -0
- package/dist/components/table/Table.js +221 -0
- package/dist/components/table/Table.js.map +1 -0
- package/dist/components/tabs/Tabs.d.ts +19 -0
- package/dist/components/tabs/Tabs.js +183 -0
- package/dist/components/tabs/Tabs.js.map +1 -0
- package/dist/components/tag/Tag.d.ts +22 -0
- package/dist/components/tag/Tag.js +121 -0
- package/dist/components/tag/Tag.js.map +1 -0
- package/dist/components/toast/Toast.d.ts +34 -0
- package/dist/components/toast/Toast.js +187 -0
- package/dist/components/toast/Toast.js.map +1 -0
- package/dist/components/toggle/Toggle.d.ts +31 -0
- package/dist/components/toggle/Toggle.js +197 -0
- package/dist/components/toggle/Toggle.js.map +1 -0
- package/dist/components/toolbar/Toolbar.d.ts +21 -0
- package/dist/components/toolbar/Toolbar.js +239 -0
- package/dist/components/toolbar/Toolbar.js.map +1 -0
- package/dist/components/tooltip/Tooltip.d.ts +33 -0
- package/dist/components/tooltip/Tooltip.js +182 -0
- package/dist/components/tooltip/Tooltip.js.map +1 -0
- package/dist/components/typography/Typography.d.ts +32 -0
- package/dist/components/typography/Typography.js +183 -0
- package/dist/components/typography/Typography.js.map +1 -0
- package/dist/fonts.css +3 -0
- package/dist/icons/index.d.ts +125 -0
- package/dist/icons/index.js +174 -0
- package/dist/icons/index.js.map +1 -0
- package/dist/index.d.ts +53 -0
- package/dist/index.js +56 -0
- package/dist/opti-ui.css +5365 -0
- package/dist/theme/ThemeProvider.d.ts +22 -0
- package/dist/theme/ThemeProvider.js +115 -0
- package/dist/theme/ThemeProvider.js.map +1 -0
- package/dist/theme/index.d.ts +2 -0
- package/dist/utils/cx.d.ts +10 -0
- package/dist/utils/cx.js +18 -0
- package/dist/utils/cx.js.map +1 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/portal.d.ts +8 -0
- package/dist/utils/portal.js +16 -0
- package/dist/utils/portal.js.map +1 -0
- package/dist/utils/primitive.d.ts +13 -0
- package/dist/utils/primitive.js +61 -0
- package/dist/utils/primitive.js.map +1 -0
- package/dist/utils/search.d.ts +4 -0
- package/dist/utils/search.js +15 -0
- package/dist/utils/search.js.map +1 -0
- package/package.json +71 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StatCard.js","names":["React","cx","Card","CardProps","Skeleton","TrendingDownIcon","TrendingUpIcon","StatTrend","StatTone","StatCardProps","Omit","label","ReactNode","value","unit","delta","trend","tone","hint","icon","loading","StatCard","t0","$","_c","className","props","ref","resolvedTone","t1","t2","t3","t4","t5","t6","_c","_Fragment"],"sources":["../../../src/components/stat-card/StatCard.tsx"],"sourcesContent":["import * as React from 'react';\nimport { cx } from '../../utils/cx';\nimport { Card, type CardProps } from '../card/Card';\nimport { Skeleton } from '../skeleton/Skeleton';\nimport { TrendingDownIcon, TrendingUpIcon } from '../../icons';\n\nexport type StatTrend = 'up' | 'down' | 'flat';\nexport type StatTone = 'positive' | 'negative' | 'neutral';\n\nexport interface StatCardProps extends Omit<CardProps, 'children'> {\n label: React.ReactNode;\n value: React.ReactNode;\n /** Small uppercase unit under the value, e.g. \"kWh\" or \"orders\". */\n unit?: React.ReactNode;\n /** Change indicator, e.g. \"+12.4%\". */\n delta?: React.ReactNode;\n trend?: StatTrend;\n /** Color of the delta. Defaults to positive for `up`, negative for `down`. */\n tone?: StatTone;\n /** Supporting text under the value. */\n hint?: React.ReactNode;\n /** Icon tile shown in the top-right corner. */\n icon?: React.ReactNode;\n loading?: boolean;\n}\n\n/** KPI tile: label, large value, optional unit and trend. */\nexport function StatCard({\n label,\n value,\n unit,\n delta,\n trend,\n tone,\n hint,\n icon,\n loading,\n className,\n ref,\n ...props\n}: StatCardProps) {\n const resolvedTone: StatTone = tone ?? (trend === 'up' ? 'positive' : trend === 'down' ? 'negative' : 'neutral');\n return (\n <Card ref={ref} className={cx('oui-stat', className)} {...props}>\n <div className=\"oui-stat__header\">\n <p className=\"oui-stat__label\">{label}</p>\n {icon && <span className=\"oui-stat__icon\">{icon}</span>}\n </div>\n {loading ? (\n <div className=\"oui-stat__loading\">\n <Skeleton height=\"2.25rem\" width=\"55%\" />\n <Skeleton height=\"0.9rem\" width=\"35%\" />\n </div>\n ) : (\n <>\n <div className=\"oui-stat__body\">\n <p className=\"oui-stat__value\">{value}</p>\n {unit && <p className=\"oui-stat__unit\">{unit}</p>}\n </div>\n {(delta || hint) && (\n <div className=\"oui-stat__footer\">\n {delta && (\n <span className=\"oui-stat__delta\" data-tone={resolvedTone}>\n {trend === 'up' && <TrendingUpIcon />}\n {trend === 'down' && <TrendingDownIcon />}\n {delta}\n </span>\n )}\n {hint && <span className=\"oui-stat__hint\">{hint}</span>}\n </div>\n )}\n </>\n )}\n </Card>\n );\n}\n"],"mappings":";;;;;;;;;;AA2BA,SAAOqB,SAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAA,IAAAC;CAAA,IAAAV;CAAA,IAAAG;CAAA,IAAAC;CAAA,IAAAR;CAAA,IAAAS;CAAA,IAAAM;CAAA,IAAAC;CAAA,IAAAV;CAAA,IAAAD;CAAA,IAAAF;CAAA,IAAAD;CAAA,IAAAU,EAAA,OAAAD,IAAA;EAAkB,CAAA,CAAAX,OAAAE,OAAAC,MAAAC,OAAAC,OAAAC,MAAAC,MAAAC,MAAAC,SAAAK,WAAAE,KAAA,GAAAD,SAAAJ;EAaTC,EAAA,KAAAD;EAAAC,EAAA,KAAAE;EAAAF,EAAA,KAAAR;EAAAQ,EAAA,KAAAL;EAAAK,EAAA,KAAAJ;EAAAI,EAAA,KAAAZ;EAAAY,EAAA,KAAAH;EAAAG,EAAA,KAAAG;EAAAH,EAAA,KAA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gB,WAAAE;GAAyB,GAAMH;GAA1D,UAAA,CACEM,IAICC,EALE;;EA8BEV,EAAA,MAAAG;EAAAH,EAAA,MAAAI;EAAAJ,EAAA,MAAAM;EAAAN,EAAA,MAAAS;EAAAT,EAAA,MAAAU;EAAAV,EAAA,MAAAW;CAAA,OAAAA,KAAAX,EAAA;CAAA,OA9BPW;AA8BO"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export type StepStatus = 'complete' | 'current' | 'upcoming' | 'error';
|
|
3
|
+
export interface StepItem {
|
|
4
|
+
/** Stable key; falls back to the index. */
|
|
5
|
+
id?: string;
|
|
6
|
+
label: React.ReactNode;
|
|
7
|
+
description?: React.ReactNode;
|
|
8
|
+
/** Overrides the status derived from `current`. */
|
|
9
|
+
status?: StepStatus;
|
|
10
|
+
/** Replaces the number / check mark inside the marker. */
|
|
11
|
+
icon?: React.ReactNode;
|
|
12
|
+
}
|
|
13
|
+
export interface StepperLabels {
|
|
14
|
+
complete: string;
|
|
15
|
+
current: string;
|
|
16
|
+
upcoming: string;
|
|
17
|
+
error: string;
|
|
18
|
+
}
|
|
19
|
+
export interface StepperProps extends React.OlHTMLAttributes<HTMLOListElement> {
|
|
20
|
+
ref?: React.Ref<HTMLOListElement>;
|
|
21
|
+
steps: StepItem[];
|
|
22
|
+
/** Index of the active step. Earlier steps are complete; `steps.length` completes all of them. */
|
|
23
|
+
current?: number;
|
|
24
|
+
orientation?: 'horizontal' | 'vertical';
|
|
25
|
+
size?: 'sm' | 'md';
|
|
26
|
+
/** Screen-reader text for each status. */
|
|
27
|
+
labels?: Partial<StepperLabels>;
|
|
28
|
+
}
|
|
29
|
+
/** Progress through an ordered sequence: a wizard, a checkout, a background job's phases. */
|
|
30
|
+
export declare function Stepper({ steps, current, orientation, size, labels, className, ref, ...props }: StepperProps): React.JSX.Element;
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cx } from "../../utils/cx.js";
|
|
3
|
+
import { CheckIcon, XIcon } from "../../icons/index.js";
|
|
4
|
+
import { c } from "react/compiler-runtime";
|
|
5
|
+
import "react";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
//#region src/components/stepper/Stepper.tsx
|
|
8
|
+
var defaultLabels = {
|
|
9
|
+
complete: "Completed",
|
|
10
|
+
current: "Current",
|
|
11
|
+
upcoming: "Not started",
|
|
12
|
+
error: "Failed"
|
|
13
|
+
};
|
|
14
|
+
/** Progress through an ordered sequence: a wizard, a checkout, a background job's phases. */
|
|
15
|
+
function Stepper(t0) {
|
|
16
|
+
const $ = c(27);
|
|
17
|
+
let className;
|
|
18
|
+
let labels;
|
|
19
|
+
let props;
|
|
20
|
+
let ref;
|
|
21
|
+
let steps;
|
|
22
|
+
let t1;
|
|
23
|
+
let t2;
|
|
24
|
+
let t3;
|
|
25
|
+
if ($[0] !== t0) {
|
|
26
|
+
({steps, current: t1, orientation: t2, size: t3, labels, className, ref, ...props} = t0);
|
|
27
|
+
$[0] = t0;
|
|
28
|
+
$[1] = className;
|
|
29
|
+
$[2] = labels;
|
|
30
|
+
$[3] = props;
|
|
31
|
+
$[4] = ref;
|
|
32
|
+
$[5] = steps;
|
|
33
|
+
$[6] = t1;
|
|
34
|
+
$[7] = t2;
|
|
35
|
+
$[8] = t3;
|
|
36
|
+
} else {
|
|
37
|
+
className = $[1];
|
|
38
|
+
labels = $[2];
|
|
39
|
+
props = $[3];
|
|
40
|
+
ref = $[4];
|
|
41
|
+
steps = $[5];
|
|
42
|
+
t1 = $[6];
|
|
43
|
+
t2 = $[7];
|
|
44
|
+
t3 = $[8];
|
|
45
|
+
}
|
|
46
|
+
const current = t1 === void 0 ? 0 : t1;
|
|
47
|
+
const orientation = t2 === void 0 ? "horizontal" : t2;
|
|
48
|
+
const size = t3 === void 0 ? "md" : t3;
|
|
49
|
+
let t4;
|
|
50
|
+
if ($[9] !== labels) {
|
|
51
|
+
t4 = {
|
|
52
|
+
...defaultLabels,
|
|
53
|
+
...labels
|
|
54
|
+
};
|
|
55
|
+
$[9] = labels;
|
|
56
|
+
$[10] = t4;
|
|
57
|
+
} else t4 = $[10];
|
|
58
|
+
const text = t4;
|
|
59
|
+
let t5;
|
|
60
|
+
if ($[11] !== className) {
|
|
61
|
+
t5 = cx("oui-stepper", className);
|
|
62
|
+
$[11] = className;
|
|
63
|
+
$[12] = t5;
|
|
64
|
+
} else t5 = $[12];
|
|
65
|
+
let t6;
|
|
66
|
+
if ($[13] !== current || $[14] !== steps || $[15] !== text) {
|
|
67
|
+
let t7;
|
|
68
|
+
if ($[17] !== current || $[18] !== text) {
|
|
69
|
+
t7 = (step, index) => {
|
|
70
|
+
const status = step.status ?? (index < current ? "complete" : index === current ? "current" : "upcoming");
|
|
71
|
+
return /* @__PURE__ */ jsxs("li", {
|
|
72
|
+
className: "oui-stepper__step",
|
|
73
|
+
"data-status": status,
|
|
74
|
+
"aria-current": status === "current" ? "step" : void 0,
|
|
75
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
76
|
+
className: "oui-stepper__marker",
|
|
77
|
+
"aria-hidden": true,
|
|
78
|
+
children: step.icon ?? (status === "complete" ? /* @__PURE__ */ jsx(CheckIcon, { strokeWidth: 3 }) : status === "error" ? /* @__PURE__ */ jsx(XIcon, { strokeWidth: 3 }) : index + 1)
|
|
79
|
+
}), /* @__PURE__ */ jsxs("span", {
|
|
80
|
+
className: "oui-stepper__text",
|
|
81
|
+
children: [/* @__PURE__ */ jsxs("span", {
|
|
82
|
+
className: "oui-stepper__label",
|
|
83
|
+
children: [step.label, /* @__PURE__ */ jsxs("span", {
|
|
84
|
+
className: "oui-visually-hidden",
|
|
85
|
+
children: [
|
|
86
|
+
" (",
|
|
87
|
+
text[status],
|
|
88
|
+
")"
|
|
89
|
+
]
|
|
90
|
+
})]
|
|
91
|
+
}), step.description && /* @__PURE__ */ jsx("span", {
|
|
92
|
+
className: "oui-stepper__description",
|
|
93
|
+
children: step.description
|
|
94
|
+
})]
|
|
95
|
+
})]
|
|
96
|
+
}, step.id ?? index);
|
|
97
|
+
};
|
|
98
|
+
$[17] = current;
|
|
99
|
+
$[18] = text;
|
|
100
|
+
$[19] = t7;
|
|
101
|
+
} else t7 = $[19];
|
|
102
|
+
t6 = steps.map(t7);
|
|
103
|
+
$[13] = current;
|
|
104
|
+
$[14] = steps;
|
|
105
|
+
$[15] = text;
|
|
106
|
+
$[16] = t6;
|
|
107
|
+
} else t6 = $[16];
|
|
108
|
+
let t7;
|
|
109
|
+
if ($[20] !== orientation || $[21] !== props || $[22] !== ref || $[23] !== size || $[24] !== t5 || $[25] !== t6) {
|
|
110
|
+
t7 = /* @__PURE__ */ jsx("ol", {
|
|
111
|
+
ref,
|
|
112
|
+
className: t5,
|
|
113
|
+
"data-orientation": orientation,
|
|
114
|
+
"data-size": size,
|
|
115
|
+
...props,
|
|
116
|
+
children: t6
|
|
117
|
+
});
|
|
118
|
+
$[20] = orientation;
|
|
119
|
+
$[21] = props;
|
|
120
|
+
$[22] = ref;
|
|
121
|
+
$[23] = size;
|
|
122
|
+
$[24] = t5;
|
|
123
|
+
$[25] = t6;
|
|
124
|
+
$[26] = t7;
|
|
125
|
+
} else t7 = $[26];
|
|
126
|
+
return t7;
|
|
127
|
+
}
|
|
128
|
+
//#endregion
|
|
129
|
+
export { Stepper };
|
|
130
|
+
|
|
131
|
+
//# sourceMappingURL=Stepper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Stepper.js","names":["React","cx","CheckIcon","XIcon","StepStatus","StepItem","id","label","ReactNode","description","status","icon","StepperLabels","complete","current","upcoming","error","defaultLabels","StepperProps","OlHTMLAttributes","HTMLOListElement","ref","Ref","steps","orientation","size","labels","Partial","Stepper","t0","$","_c","className","props","t1","t2","t3","undefined","t4","text","t5","t6","t7","step","index","map","_c"],"sources":["../../../src/components/stepper/Stepper.tsx"],"sourcesContent":["import * as React from 'react';\nimport { cx } from '../../utils/cx';\nimport { CheckIcon, XIcon } from '../../icons';\n\nexport type StepStatus = 'complete' | 'current' | 'upcoming' | 'error';\n\nexport interface StepItem {\n /** Stable key; falls back to the index. */\n id?: string;\n label: React.ReactNode;\n description?: React.ReactNode;\n /** Overrides the status derived from `current`. */\n status?: StepStatus;\n /** Replaces the number / check mark inside the marker. */\n icon?: React.ReactNode;\n}\n\nexport interface StepperLabels {\n complete: string;\n current: string;\n upcoming: string;\n error: string;\n}\n\nconst defaultLabels: StepperLabels = {\n complete: 'Completed',\n current: 'Current',\n upcoming: 'Not started',\n error: 'Failed',\n};\n\nexport interface StepperProps extends React.OlHTMLAttributes<HTMLOListElement> {\n ref?: React.Ref<HTMLOListElement>;\n steps: StepItem[];\n /** Index of the active step. Earlier steps are complete; `steps.length` completes all of them. */\n current?: number;\n orientation?: 'horizontal' | 'vertical';\n size?: 'sm' | 'md';\n /** Screen-reader text for each status. */\n labels?: Partial<StepperLabels>;\n}\n\n/** Progress through an ordered sequence: a wizard, a checkout, a background job's phases. */\nexport function Stepper({\n steps,\n current = 0,\n orientation = 'horizontal',\n size = 'md',\n labels,\n className,\n ref,\n ...props\n}: StepperProps) {\n const text = { ...defaultLabels, ...labels };\n return (\n <ol ref={ref} className={cx('oui-stepper', className)} data-orientation={orientation} data-size={size} {...props}>\n {steps.map((step, index) => {\n const status: StepStatus =\n step.status ?? (index < current ? 'complete' : index === current ? 'current' : 'upcoming');\n return (\n <li\n key={step.id ?? index}\n className=\"oui-stepper__step\"\n data-status={status}\n aria-current={status === 'current' ? 'step' : undefined}\n >\n <span className=\"oui-stepper__marker\" aria-hidden>\n {step.icon ?? (status === 'complete' ? <CheckIcon strokeWidth={3} /> : status === 'error' ? <XIcon strokeWidth={3} /> : index + 1)}\n </span>\n <span className=\"oui-stepper__text\">\n <span className=\"oui-stepper__label\">\n {step.label}\n <span className=\"oui-visually-hidden\"> ({text[status]})</span>\n </span>\n {step.description && <span className=\"oui-stepper__description\">{step.description}</span>}\n </span>\n </li>\n );\n })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KAAAX,EAAA;CAAA,IAAAY;CAAA,IAAAZ,EAAA,QAAAN,eAAAM,EAAA,QAAAG,SAAAH,EAAA,QAAAT,OAAAS,EAAA,QAAAL,QAAAK,EAAA,QAAAU,MAAAV,EAAA,QAAAW,IAAA;EAvBJC,KAAA,oBAAA,MAAA;GAASrB;GAAgB,WAAAmB;GAAgDhB,oBAAAA;GAAwBC,aAAAA;GAAI,GAAMQ;GACxGQ,UAAAA;EAuBE,CAAA;EAAAX,EAAA,MAAAN;EAAAM,EAAA,MAAAG;EAAAH,EAAA,MAAAT;EAAAS,EAAA,MAAAL;EAAAK,EAAA,MAAAU;EAAAV,EAAA,MAAAW;EAAAX,EAAA,MAAAY;CAAA,OAAAA,KAAAZ,EAAA;CAAA,OAxBLY;AAwBK"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export interface TableProps extends React.TableHTMLAttributes<HTMLTableElement> {
|
|
3
|
+
ref?: React.Ref<HTMLTableElement>;
|
|
4
|
+
/** Row height. */
|
|
5
|
+
density?: 'compact' | 'normal' | 'comfortable';
|
|
6
|
+
/** Alternating row background. */
|
|
7
|
+
striped?: boolean;
|
|
8
|
+
/** Highlight rows on hover. */
|
|
9
|
+
hoverable?: boolean;
|
|
10
|
+
/** Keep the header visible while the wrapper scrolls (set a max height on it). */
|
|
11
|
+
stickyHeader?: boolean;
|
|
12
|
+
/** Props for the horizontally scrolling wrapper. */
|
|
13
|
+
wrapperProps?: React.HTMLAttributes<HTMLDivElement>;
|
|
14
|
+
}
|
|
15
|
+
export declare function Table({ density, striped, hoverable, stickyHeader, wrapperProps, className, ref, ...props }: TableProps): React.JSX.Element;
|
|
16
|
+
export declare const TableHeader: {
|
|
17
|
+
(props: import("../../utils/primitive").PrimitiveProps<"thead">): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>;
|
|
18
|
+
displayName: string;
|
|
19
|
+
};
|
|
20
|
+
export declare const TableBody: {
|
|
21
|
+
(props: import("../../utils/primitive").PrimitiveProps<"tbody">): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>;
|
|
22
|
+
displayName: string;
|
|
23
|
+
};
|
|
24
|
+
export declare const TableFooter: {
|
|
25
|
+
(props: import("../../utils/primitive").PrimitiveProps<"tfoot">): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>;
|
|
26
|
+
displayName: string;
|
|
27
|
+
};
|
|
28
|
+
export declare const TableRow: {
|
|
29
|
+
(props: import("../../utils/primitive").PrimitiveProps<"tr">): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>;
|
|
30
|
+
displayName: string;
|
|
31
|
+
};
|
|
32
|
+
export declare const TableCaption: {
|
|
33
|
+
(props: import("../../utils/primitive").PrimitiveProps<"caption">): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>;
|
|
34
|
+
displayName: string;
|
|
35
|
+
};
|
|
36
|
+
type Align = 'start' | 'center' | 'end';
|
|
37
|
+
export type SortDirection = 'asc' | 'desc' | false;
|
|
38
|
+
export interface TableHeadProps extends Omit<React.ThHTMLAttributes<HTMLTableCellElement>, 'align'> {
|
|
39
|
+
ref?: React.Ref<HTMLTableCellElement>;
|
|
40
|
+
align?: Align;
|
|
41
|
+
/** Current sort of this column. Passing it (even `false`) makes the header sortable. */
|
|
42
|
+
sort?: SortDirection;
|
|
43
|
+
onSort?: () => void;
|
|
44
|
+
}
|
|
45
|
+
export declare function TableHead({ align, sort, onSort, className, children, ref, ...props }: TableHeadProps): React.JSX.Element;
|
|
46
|
+
export interface TableCellProps extends Omit<React.TdHTMLAttributes<HTMLTableCellElement>, 'align'> {
|
|
47
|
+
ref?: React.Ref<HTMLTableCellElement>;
|
|
48
|
+
align?: Align;
|
|
49
|
+
/** Tabular figures for numeric columns. */
|
|
50
|
+
numeric?: boolean;
|
|
51
|
+
}
|
|
52
|
+
export declare function TableCell({ align, numeric, className, ref, ...props }: TableCellProps): React.JSX.Element;
|
|
53
|
+
export {};
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cx } from "../../utils/cx.js";
|
|
3
|
+
import { createPrimitive } from "../../utils/primitive.js";
|
|
4
|
+
import { ArrowDownIcon, ArrowUpIcon, ChevronsUpDownIcon } from "../../icons/index.js";
|
|
5
|
+
import { c } from "react/compiler-runtime";
|
|
6
|
+
import "react";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
//#region src/components/table/Table.tsx
|
|
9
|
+
function Table(t0) {
|
|
10
|
+
const $ = c(25);
|
|
11
|
+
let className;
|
|
12
|
+
let props;
|
|
13
|
+
let ref;
|
|
14
|
+
let stickyHeader;
|
|
15
|
+
let striped;
|
|
16
|
+
let t1;
|
|
17
|
+
let t2;
|
|
18
|
+
let wrapperProps;
|
|
19
|
+
if ($[0] !== t0) {
|
|
20
|
+
({density: t1, striped, hoverable: t2, stickyHeader, wrapperProps, className, ref, ...props} = t0);
|
|
21
|
+
$[0] = t0;
|
|
22
|
+
$[1] = className;
|
|
23
|
+
$[2] = props;
|
|
24
|
+
$[3] = ref;
|
|
25
|
+
$[4] = stickyHeader;
|
|
26
|
+
$[5] = striped;
|
|
27
|
+
$[6] = t1;
|
|
28
|
+
$[7] = t2;
|
|
29
|
+
$[8] = wrapperProps;
|
|
30
|
+
} else {
|
|
31
|
+
className = $[1];
|
|
32
|
+
props = $[2];
|
|
33
|
+
ref = $[3];
|
|
34
|
+
stickyHeader = $[4];
|
|
35
|
+
striped = $[5];
|
|
36
|
+
t1 = $[6];
|
|
37
|
+
t2 = $[7];
|
|
38
|
+
wrapperProps = $[8];
|
|
39
|
+
}
|
|
40
|
+
const density = t1 === void 0 ? "normal" : t1;
|
|
41
|
+
const hoverable = t2 === void 0 ? true : t2;
|
|
42
|
+
const t3 = wrapperProps?.className;
|
|
43
|
+
let t4;
|
|
44
|
+
if ($[9] !== t3) {
|
|
45
|
+
t4 = cx("oui-table-wrap", t3);
|
|
46
|
+
$[9] = t3;
|
|
47
|
+
$[10] = t4;
|
|
48
|
+
} else t4 = $[10];
|
|
49
|
+
let t5;
|
|
50
|
+
if ($[11] !== className) {
|
|
51
|
+
t5 = cx("oui-table", className);
|
|
52
|
+
$[11] = className;
|
|
53
|
+
$[12] = t5;
|
|
54
|
+
} else t5 = $[12];
|
|
55
|
+
const t6 = striped || void 0;
|
|
56
|
+
const t7 = hoverable || void 0;
|
|
57
|
+
const t8 = stickyHeader || void 0;
|
|
58
|
+
let t9;
|
|
59
|
+
if ($[13] !== density || $[14] !== props || $[15] !== ref || $[16] !== t5 || $[17] !== t6 || $[18] !== t7 || $[19] !== t8) {
|
|
60
|
+
t9 = /* @__PURE__ */ jsx("table", {
|
|
61
|
+
ref,
|
|
62
|
+
className: t5,
|
|
63
|
+
"data-density": density,
|
|
64
|
+
"data-striped": t6,
|
|
65
|
+
"data-hoverable": t7,
|
|
66
|
+
"data-sticky-header": t8,
|
|
67
|
+
...props
|
|
68
|
+
});
|
|
69
|
+
$[13] = density;
|
|
70
|
+
$[14] = props;
|
|
71
|
+
$[15] = ref;
|
|
72
|
+
$[16] = t5;
|
|
73
|
+
$[17] = t6;
|
|
74
|
+
$[18] = t7;
|
|
75
|
+
$[19] = t8;
|
|
76
|
+
$[20] = t9;
|
|
77
|
+
} else t9 = $[20];
|
|
78
|
+
let t10;
|
|
79
|
+
if ($[21] !== t4 || $[22] !== t9 || $[23] !== wrapperProps) {
|
|
80
|
+
t10 = /* @__PURE__ */ jsx("div", {
|
|
81
|
+
...wrapperProps,
|
|
82
|
+
className: t4,
|
|
83
|
+
children: t9
|
|
84
|
+
});
|
|
85
|
+
$[21] = t4;
|
|
86
|
+
$[22] = t9;
|
|
87
|
+
$[23] = wrapperProps;
|
|
88
|
+
$[24] = t10;
|
|
89
|
+
} else t10 = $[24];
|
|
90
|
+
return t10;
|
|
91
|
+
}
|
|
92
|
+
var TableHeader = createPrimitive("thead", "oui-table__header", "TableHeader");
|
|
93
|
+
var TableBody = createPrimitive("tbody", "oui-table__body", "TableBody");
|
|
94
|
+
var TableFooter = createPrimitive("tfoot", "oui-table__footer", "TableFooter");
|
|
95
|
+
var TableRow = createPrimitive("tr", "oui-table__row", "TableRow");
|
|
96
|
+
var TableCaption = createPrimitive("caption", "oui-table__caption", "TableCaption");
|
|
97
|
+
function TableHead(t0) {
|
|
98
|
+
const $ = c(22);
|
|
99
|
+
let children;
|
|
100
|
+
let className;
|
|
101
|
+
let onSort;
|
|
102
|
+
let props;
|
|
103
|
+
let ref;
|
|
104
|
+
let sort;
|
|
105
|
+
let t1;
|
|
106
|
+
if ($[0] !== t0) {
|
|
107
|
+
({align: t1, sort, onSort, className, children, ref, ...props} = t0);
|
|
108
|
+
$[0] = t0;
|
|
109
|
+
$[1] = children;
|
|
110
|
+
$[2] = className;
|
|
111
|
+
$[3] = onSort;
|
|
112
|
+
$[4] = props;
|
|
113
|
+
$[5] = ref;
|
|
114
|
+
$[6] = sort;
|
|
115
|
+
$[7] = t1;
|
|
116
|
+
} else {
|
|
117
|
+
children = $[1];
|
|
118
|
+
className = $[2];
|
|
119
|
+
onSort = $[3];
|
|
120
|
+
props = $[4];
|
|
121
|
+
ref = $[5];
|
|
122
|
+
sort = $[6];
|
|
123
|
+
t1 = $[7];
|
|
124
|
+
}
|
|
125
|
+
const align = t1 === void 0 ? "start" : t1;
|
|
126
|
+
const sortable = sort !== void 0;
|
|
127
|
+
let t2;
|
|
128
|
+
if ($[8] !== className) {
|
|
129
|
+
t2 = cx("oui-table__head", className);
|
|
130
|
+
$[8] = className;
|
|
131
|
+
$[9] = t2;
|
|
132
|
+
} else t2 = $[9];
|
|
133
|
+
const t3 = sort === "asc" ? "ascending" : sort === "desc" ? "descending" : void 0;
|
|
134
|
+
let t4;
|
|
135
|
+
if ($[10] !== children || $[11] !== onSort || $[12] !== sort || $[13] !== sortable) {
|
|
136
|
+
t4 = sortable ? /* @__PURE__ */ jsxs("button", {
|
|
137
|
+
type: "button",
|
|
138
|
+
className: "oui-table__sort",
|
|
139
|
+
"data-active": sort ? "" : void 0,
|
|
140
|
+
onClick: onSort,
|
|
141
|
+
children: [children, sort === "asc" ? /* @__PURE__ */ jsx(ArrowUpIcon, {}) : sort === "desc" ? /* @__PURE__ */ jsx(ArrowDownIcon, {}) : /* @__PURE__ */ jsx(ChevronsUpDownIcon, {})]
|
|
142
|
+
}) : children;
|
|
143
|
+
$[10] = children;
|
|
144
|
+
$[11] = onSort;
|
|
145
|
+
$[12] = sort;
|
|
146
|
+
$[13] = sortable;
|
|
147
|
+
$[14] = t4;
|
|
148
|
+
} else t4 = $[14];
|
|
149
|
+
let t5;
|
|
150
|
+
if ($[15] !== align || $[16] !== props || $[17] !== ref || $[18] !== t2 || $[19] !== t3 || $[20] !== t4) {
|
|
151
|
+
t5 = /* @__PURE__ */ jsx("th", {
|
|
152
|
+
ref,
|
|
153
|
+
scope: "col",
|
|
154
|
+
className: t2,
|
|
155
|
+
"data-align": align,
|
|
156
|
+
"aria-sort": t3,
|
|
157
|
+
...props,
|
|
158
|
+
children: t4
|
|
159
|
+
});
|
|
160
|
+
$[15] = align;
|
|
161
|
+
$[16] = props;
|
|
162
|
+
$[17] = ref;
|
|
163
|
+
$[18] = t2;
|
|
164
|
+
$[19] = t3;
|
|
165
|
+
$[20] = t4;
|
|
166
|
+
$[21] = t5;
|
|
167
|
+
} else t5 = $[21];
|
|
168
|
+
return t5;
|
|
169
|
+
}
|
|
170
|
+
function TableCell(t0) {
|
|
171
|
+
const $ = c(14);
|
|
172
|
+
let align;
|
|
173
|
+
let className;
|
|
174
|
+
let numeric;
|
|
175
|
+
let props;
|
|
176
|
+
let ref;
|
|
177
|
+
if ($[0] !== t0) {
|
|
178
|
+
({align, numeric, className, ref, ...props} = t0);
|
|
179
|
+
$[0] = t0;
|
|
180
|
+
$[1] = align;
|
|
181
|
+
$[2] = className;
|
|
182
|
+
$[3] = numeric;
|
|
183
|
+
$[4] = props;
|
|
184
|
+
$[5] = ref;
|
|
185
|
+
} else {
|
|
186
|
+
align = $[1];
|
|
187
|
+
className = $[2];
|
|
188
|
+
numeric = $[3];
|
|
189
|
+
props = $[4];
|
|
190
|
+
ref = $[5];
|
|
191
|
+
}
|
|
192
|
+
let t1;
|
|
193
|
+
if ($[6] !== className) {
|
|
194
|
+
t1 = cx("oui-table__cell", className);
|
|
195
|
+
$[6] = className;
|
|
196
|
+
$[7] = t1;
|
|
197
|
+
} else t1 = $[7];
|
|
198
|
+
const t2 = align ?? (numeric ? "end" : "start");
|
|
199
|
+
const t3 = numeric || void 0;
|
|
200
|
+
let t4;
|
|
201
|
+
if ($[8] !== props || $[9] !== ref || $[10] !== t1 || $[11] !== t2 || $[12] !== t3) {
|
|
202
|
+
t4 = /* @__PURE__ */ jsx("td", {
|
|
203
|
+
ref,
|
|
204
|
+
className: t1,
|
|
205
|
+
"data-align": t2,
|
|
206
|
+
"data-numeric": t3,
|
|
207
|
+
...props
|
|
208
|
+
});
|
|
209
|
+
$[8] = props;
|
|
210
|
+
$[9] = ref;
|
|
211
|
+
$[10] = t1;
|
|
212
|
+
$[11] = t2;
|
|
213
|
+
$[12] = t3;
|
|
214
|
+
$[13] = t4;
|
|
215
|
+
} else t4 = $[13];
|
|
216
|
+
return t4;
|
|
217
|
+
}
|
|
218
|
+
//#endregion
|
|
219
|
+
export { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow };
|
|
220
|
+
|
|
221
|
+
//# sourceMappingURL=Table.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Table.js","names":["React","cx","createPrimitive","ArrowDownIcon","ArrowUpIcon","ChevronsUpDownIcon","TableProps","TableHTMLAttributes","HTMLTableElement","ref","Ref","density","striped","hoverable","stickyHeader","wrapperProps","HTMLAttributes","HTMLDivElement","Table","t0","$","_c","className","props","t1","t2","undefined","t3","t4","t5","t6","t7","t8","t9","t10","TableHeader","TableBody","TableFooter","TableRow","TableCaption","Align","SortDirection","TableHeadProps","Omit","ThHTMLAttributes","HTMLTableCellElement","align","sort","onSort","TableHead","children","sortable","TableCellProps","TdHTMLAttributes","numeric","TableCell","_c"],"sources":["../../../src/components/table/Table.tsx"],"sourcesContent":["import * as React from 'react';\nimport { cx } from '../../utils/cx';\nimport { createPrimitive } from '../../utils/primitive';\nimport { ArrowDownIcon, ArrowUpIcon, ChevronsUpDownIcon } from '../../icons';\n\nexport interface TableProps extends React.TableHTMLAttributes<HTMLTableElement> {\n ref?: React.Ref<HTMLTableElement>;\n /** Row height. */\n density?: 'compact' | 'normal' | 'comfortable';\n /** Alternating row background. */\n striped?: boolean;\n /** Highlight rows on hover. */\n hoverable?: boolean;\n /** Keep the header visible while the wrapper scrolls (set a max height on it). */\n stickyHeader?: boolean;\n /** Props for the horizontally scrolling wrapper. */\n wrapperProps?: React.HTMLAttributes<HTMLDivElement>;\n}\n\nexport function Table({\n density = 'normal',\n striped,\n hoverable = true,\n stickyHeader,\n wrapperProps,\n className,\n ref,\n ...props\n}: TableProps) {\n return (\n <div {...wrapperProps} className={cx('oui-table-wrap', wrapperProps?.className)}>\n <table\n ref={ref}\n className={cx('oui-table', className)}\n data-density={density}\n data-striped={striped || undefined}\n data-hoverable={hoverable || undefined}\n data-sticky-header={stickyHeader || undefined}\n {...props}\n />\n </div>\n );\n}\n\nexport const TableHeader = createPrimitive('thead', 'oui-table__header', 'TableHeader');\nexport const TableBody = createPrimitive('tbody', 'oui-table__body', 'TableBody');\nexport const TableFooter = createPrimitive('tfoot', 'oui-table__footer', 'TableFooter');\nexport const TableRow = createPrimitive('tr', 'oui-table__row', 'TableRow');\nexport const TableCaption = createPrimitive('caption', 'oui-table__caption', 'TableCaption');\n\ntype Align = 'start' | 'center' | 'end';\nexport type SortDirection = 'asc' | 'desc' | false;\n\nexport interface TableHeadProps extends Omit<React.ThHTMLAttributes<HTMLTableCellElement>, 'align'> {\n ref?: React.Ref<HTMLTableCellElement>;\n align?: Align;\n /** Current sort of this column. Passing it (even `false`) makes the header sortable. */\n sort?: SortDirection;\n onSort?: () => void;\n}\n\nexport function TableHead({ align = 'start', sort, onSort, className, children, ref, ...props }: TableHeadProps) {\n const sortable = sort !== undefined;\n return (\n <th\n ref={ref}\n scope=\"col\"\n className={cx('oui-table__head', className)}\n data-align={align}\n aria-sort={sort === 'asc' ? 'ascending' : sort === 'desc' ? 'descending' : undefined}\n {...props}\n >\n {sortable ? (\n <button type=\"button\" className=\"oui-table__sort\" data-active={sort ? '' : undefined} onClick={onSort}>\n {children}\n {sort === 'asc' ? <ArrowUpIcon /> : sort === 'desc' ? <ArrowDownIcon /> : <ChevronsUpDownIcon />}\n </button>\n ) : (\n children\n )}\n </th>\n );\n}\n\nexport interface TableCellProps extends Omit<React.TdHTMLAttributes<HTMLTableCellElement>, 'align'> {\n ref?: React.Ref<HTMLTableCellElement>;\n align?: Align;\n /** Tabular figures for numeric columns. */\n numeric?: boolean;\n}\n\nexport function TableCell({ align, numeric, className, ref, ...props }: TableCellProps) {\n return (\n <td\n ref={ref}\n className={cx('oui-table__cell', className)}\n data-align={align ?? (numeric ? 'end' : 'start')}\n data-numeric={numeric || undefined}\n {...props}\n />\n );\n}\n"],"mappings":";;;;;;;;AAmBA,SAAOkB,MAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAd;CAAA,IAAAK;CAAA,IAAAF;CAAA,IAAAY;CAAA,IAAAC;CAAA,IAAAV;CAAA,IAAAK,EAAA,OAAAD,IAAA;EAAe,CAAA,CAAAR,SAAAa,IAAAZ,SAAAC,WAAAY,IAAAX,cAAAC,cAAAO,WAAAb,KAAA,GAAAc,SAAAJ;EASTC,EAAA,KAAAD;EAAAC,EAAA,KAAAE;EAAAF,EAAA,KAAAG;EAAAH,EAAA,KAAAX;EAAAW,EAAA,KAAAN;EAAAM,EAAA,KAAAR;EAAAQ,EAAA,KAAAI;EAAAJ,EAAA,KAAAK;EAAAL,EAAA,KAAAL;CAAA,OAAA;EAAAO,YAAAF,EAAA;EAAAG,QAAAH,EAAA;EAAAX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s.List.Props {
|
|
4
|
+
/** `underline` (default) for page sections, `segmented` for compact switchers. */
|
|
5
|
+
variant?: TabsVariant;
|
|
6
|
+
size?: 'sm' | 'md';
|
|
7
|
+
}
|
|
8
|
+
declare function TabsRoot({ className, ref, ...props }: BaseTabs.Root.Props): import("react").JSX.Element;
|
|
9
|
+
declare function TabsList({ variant, size, className, children, ref, ...props }: TabsListProps): import("react").JSX.Element;
|
|
10
|
+
declare function TabsTab({ className, ref, ...props }: BaseTabs.Tab.Props): import("react").JSX.Element;
|
|
11
|
+
declare function TabsPanel({ className, ref, ...props }: BaseTabs.Panel.Props): import("react").JSX.Element;
|
|
12
|
+
/** `Tabs.Root` › `Tabs.List` › `Tabs.Tab`, then one `Tabs.Panel` per value. */
|
|
13
|
+
export declare const Tabs: {
|
|
14
|
+
Root: typeof TabsRoot;
|
|
15
|
+
List: typeof TabsList;
|
|
16
|
+
Tab: typeof TabsTab;
|
|
17
|
+
Panel: typeof TabsPanel;
|
|
18
|
+
};
|
|
19
|
+
export {};
|