@arcfusionz/arc-primitive-ui 0.1.0 → 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/dist/components/AILoader/AILoader.d.ts +32 -0
- package/dist/components/AILoader/AILoader.js +157 -0
- package/dist/components/AILoader/index.d.ts +2 -0
- package/dist/components/AILoader/index.js +2 -0
- package/dist/components/Accordion/Accordion.d.ts +96 -0
- package/dist/components/Accordion/Accordion.js +149 -0
- package/dist/components/Accordion/index.d.ts +2 -0
- package/dist/components/Accordion/index.js +2 -0
- package/dist/components/Avatar/Avatar.d.ts +152 -0
- package/dist/components/Avatar/Avatar.js +216 -0
- package/dist/components/Avatar/index.d.ts +2 -0
- package/dist/components/Avatar/index.js +2 -0
- package/dist/components/Badge/Badge.d.ts +87 -0
- package/dist/components/Badge/Badge.js +118 -0
- package/dist/components/Badge/index.d.ts +2 -0
- package/dist/components/Badge/index.js +2 -0
- package/dist/components/Breadcrumb/Breadcrumb.d.ts +109 -0
- package/dist/components/Breadcrumb/Breadcrumb.js +182 -0
- package/dist/components/Breadcrumb/index.d.ts +2 -0
- package/dist/components/Breadcrumb/index.js +2 -0
- package/dist/components/Button/Button.d.ts +57 -0
- package/dist/components/Button/Button.js +177 -0
- package/dist/components/Button/index.d.ts +2 -0
- package/dist/components/Button/index.js +2 -0
- package/dist/components/Calendar/Calendar.d.ts +140 -0
- package/dist/components/Calendar/Calendar.js +468 -0
- package/dist/components/Calendar/index.d.ts +2 -0
- package/dist/components/Calendar/index.js +2 -0
- package/dist/components/Checkbox/Checkbox.d.ts +60 -0
- package/dist/components/Checkbox/Checkbox.js +129 -0
- package/dist/components/Checkbox/index.d.ts +2 -0
- package/dist/components/Checkbox/index.js +2 -0
- package/dist/components/Combobox/Combobox.d.ts +251 -0
- package/dist/components/Combobox/Combobox.js +354 -0
- package/dist/components/Combobox/index.d.ts +2 -0
- package/dist/components/Combobox/index.js +2 -0
- package/dist/components/ContextMenu/ContextMenu.d.ts +129 -0
- package/dist/components/ContextMenu/ContextMenu.js +93 -0
- package/dist/components/ContextMenu/index.d.ts +2 -0
- package/dist/components/ContextMenu/index.js +2 -0
- package/dist/components/DatePicker/DatePicker.d.ts +109 -0
- package/dist/components/DatePicker/DatePicker.js +145 -0
- package/dist/components/DatePicker/index.d.ts +2 -0
- package/dist/components/DatePicker/index.js +2 -0
- package/dist/components/DateRangePicker/DateRangePicker.d.ts +107 -0
- package/dist/components/DateRangePicker/DateRangePicker.js +161 -0
- package/dist/components/DateRangePicker/index.d.ts +2 -0
- package/dist/components/DateRangePicker/index.js +2 -0
- package/dist/components/Dialog/Dialog.d.ts +112 -0
- package/dist/components/Dialog/Dialog.js +141 -0
- package/dist/components/Dialog/index.d.ts +2 -0
- package/dist/components/Dialog/index.js +2 -0
- package/dist/components/Drawer/Drawer.d.ts +188 -0
- package/dist/components/Drawer/Drawer.js +268 -0
- package/dist/components/Drawer/index.d.ts +2 -0
- package/dist/components/Drawer/index.js +2 -0
- package/dist/components/Field/Field.d.ts +123 -0
- package/dist/components/Field/Field.js +241 -0
- package/dist/components/Field/FieldContext.d.ts +43 -0
- package/dist/components/Field/FieldContext.js +28 -0
- package/dist/components/Field/index.d.ts +3 -0
- package/dist/components/Field/index.js +3 -0
- package/dist/components/Fieldset/Fieldset.d.ts +43 -0
- package/dist/components/Fieldset/Fieldset.js +48 -0
- package/dist/components/Fieldset/index.d.ts +2 -0
- package/dist/components/Fieldset/index.js +2 -0
- package/dist/components/Form/Form.d.ts +54 -0
- package/dist/components/Form/Form.js +57 -0
- package/dist/components/Form/index.d.ts +2 -0
- package/dist/components/Form/index.js +2 -0
- package/dist/components/Input/Input.d.ts +64 -0
- package/dist/components/Input/Input.js +111 -0
- package/dist/components/Input/index.d.ts +2 -0
- package/dist/components/Input/index.js +2 -0
- package/dist/components/Menu/Menu.d.ts +212 -0
- package/dist/components/Menu/Menu.js +255 -0
- package/dist/components/Menu/index.d.ts +2 -0
- package/dist/components/Menu/index.js +2 -0
- package/dist/components/Popover/Popover.d.ts +122 -0
- package/dist/components/Popover/Popover.js +116 -0
- package/dist/components/Popover/index.d.ts +2 -0
- package/dist/components/Popover/index.js +2 -0
- package/dist/components/Progress/Progress.d.ts +87 -0
- package/dist/components/Progress/Progress.js +73 -0
- package/dist/components/Progress/index.d.ts +2 -0
- package/dist/components/Progress/index.js +2 -0
- package/dist/components/Radio/Radio.d.ts +65 -0
- package/dist/components/Radio/Radio.js +93 -0
- package/dist/components/Radio/index.d.ts +2 -0
- package/dist/components/Radio/index.js +2 -0
- package/dist/components/Select/Select.d.ts +136 -0
- package/dist/components/Select/Select.js +219 -0
- package/dist/components/Select/index.d.ts +2 -0
- package/dist/components/Select/index.js +2 -0
- package/dist/components/Skeleton/Skeleton.d.ts +39 -0
- package/dist/components/Skeleton/Skeleton.js +44 -0
- package/dist/components/Skeleton/index.d.ts +2 -0
- package/dist/components/Skeleton/index.js +2 -0
- package/dist/components/Stepper/Stepper.d.ts +161 -0
- package/dist/components/Stepper/Stepper.js +344 -0
- package/dist/components/Stepper/index.d.ts +2 -0
- package/dist/components/Stepper/index.js +2 -0
- package/dist/components/Switch/Switch.d.ts +56 -0
- package/dist/components/Switch/Switch.js +87 -0
- package/dist/components/Switch/index.d.ts +2 -0
- package/dist/components/Switch/index.js +2 -0
- package/dist/components/Table/Table.d.ts +116 -0
- package/dist/components/Table/Table.js +143 -0
- package/dist/components/Table/index.d.ts +2 -0
- package/dist/components/Table/index.js +2 -0
- package/dist/components/Tabs/Tabs.d.ts +116 -0
- package/dist/components/Tabs/Tabs.js +158 -0
- package/dist/components/Tabs/index.d.ts +2 -0
- package/dist/components/Tabs/index.js +2 -0
- package/dist/components/Timeline/Timeline.d.ts +137 -0
- package/dist/components/Timeline/Timeline.js +243 -0
- package/dist/components/Timeline/index.d.ts +2 -0
- package/dist/components/Timeline/index.js +2 -0
- package/dist/components/Toast/Toast.d.ts +135 -0
- package/dist/components/Toast/Toast.js +314 -0
- package/dist/components/Toast/index.d.ts +2 -0
- package/dist/components/Toast/index.js +2 -0
- package/dist/components/Tooltip/Tooltip.d.ts +104 -0
- package/dist/components/Tooltip/Tooltip.js +95 -0
- package/dist/components/Tooltip/index.d.ts +2 -0
- package/dist/components/Tooltip/index.js +2 -0
- package/dist/components/Typography/Typography.d.ts +38 -0
- package/dist/components/Typography/Typography.js +53 -0
- package/dist/components/Typography/index.d.ts +2 -0
- package/dist/components/Typography/index.js +2 -0
- package/dist/index.d.ts +66 -3398
- package/dist/index.js +34 -5343
- package/dist/lib/cn.d.ts +6 -0
- package/dist/lib/cn.js +9 -0
- package/package.json +6 -2
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { cn } from "../../lib/cn.js";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
4
|
+
//#region src/components/Table/Table.tsx
|
|
5
|
+
const containerClasses = "relative w-full overflow-auto overscroll-x-contain";
|
|
6
|
+
const containerVariantClasses = {
|
|
7
|
+
plain: "",
|
|
8
|
+
outline: "rounded-md border border-border bg-background",
|
|
9
|
+
elevated: "rounded-md border border-border bg-background shadow-md"
|
|
10
|
+
};
|
|
11
|
+
const tableClasses = "w-full min-w-full border-collapse bg-background font-sans text-sm text-foreground";
|
|
12
|
+
const tableSizeClasses = {
|
|
13
|
+
sm: "[&_th]:h-9 [&_th]:px-3 [&_td]:px-3 [&_td]:py-2",
|
|
14
|
+
md: "[&_th]:h-11 [&_th]:px-4 [&_td]:px-4 [&_td]:py-3",
|
|
15
|
+
lg: "[&_th]:h-12 [&_th]:px-5 [&_th]:text-sm [&_td]:px-5 [&_td]:py-4 [&_td]:text-base"
|
|
16
|
+
};
|
|
17
|
+
const tableLayoutClasses = {
|
|
18
|
+
auto: "table-auto",
|
|
19
|
+
fixed: "table-fixed"
|
|
20
|
+
};
|
|
21
|
+
const tableHeaderClasses = "bg-surface [&_tr]:border-b [&_tr]:border-border [&_th]:border-b [&_th]:border-border";
|
|
22
|
+
const tableBodyClasses = "[&_tr:last-child]:border-b-0";
|
|
23
|
+
const tableFooterClasses = "border-t border-border bg-surface font-sans font-semibold text-foreground [&>tr]:border-b-0";
|
|
24
|
+
const tableRowClasses = "border-b border-border transition-colors duration-150 data-selected:bg-secondary data-selected:hover:bg-secondary";
|
|
25
|
+
const tableHeadClasses = "whitespace-nowrap text-left align-middle font-sans text-xs font-semibold uppercase tracking-widest text-muted-foreground";
|
|
26
|
+
const tableCellClasses = "align-middle font-sans text-sm text-foreground";
|
|
27
|
+
const tableCaptionClasses = "px-4 py-3 text-left font-sans text-xs text-muted-foreground";
|
|
28
|
+
const captionSideClasses = {
|
|
29
|
+
top: "caption-top border-b border-border",
|
|
30
|
+
bottom: "caption-bottom border-t border-border"
|
|
31
|
+
};
|
|
32
|
+
const TableContainer = forwardRef(({ variant = "elevated", render, className, ...rest }, ref) => {
|
|
33
|
+
return useRender({
|
|
34
|
+
defaultTagName: "div",
|
|
35
|
+
render,
|
|
36
|
+
ref,
|
|
37
|
+
state: { variant },
|
|
38
|
+
props: {
|
|
39
|
+
...rest,
|
|
40
|
+
className: cn(containerClasses, containerVariantClasses[variant], className)
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
TableContainer.displayName = "TableContainer";
|
|
45
|
+
const Table = forwardRef(({ size = "md", layout = "auto", striped = false, hoverable = true, stickyHeader = false, showColumnBorders = false, render, className, ...rest }, ref) => {
|
|
46
|
+
return useRender({
|
|
47
|
+
defaultTagName: "table",
|
|
48
|
+
render,
|
|
49
|
+
ref,
|
|
50
|
+
state: {
|
|
51
|
+
size,
|
|
52
|
+
layout,
|
|
53
|
+
striped,
|
|
54
|
+
hoverable,
|
|
55
|
+
stickyHeader,
|
|
56
|
+
showColumnBorders
|
|
57
|
+
},
|
|
58
|
+
props: {
|
|
59
|
+
...rest,
|
|
60
|
+
className: cn(tableClasses, tableSizeClasses[size], tableLayoutClasses[layout], striped && "[&_tbody_tr:nth-child(even)]:bg-surface", hoverable && "[&_tbody_tr]:hover:bg-muted", stickyHeader && "[&_thead_th]:sticky [&_thead_th]:top-0 [&_thead_th]:z-10 [&_thead_th]:bg-surface", showColumnBorders && "[&_tr>*+*]:border-l [&_tr>*+*]:border-border", className)
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
Table.displayName = "Table";
|
|
65
|
+
const TableHeader = forwardRef(({ render, className, ...rest }, ref) => useRender({
|
|
66
|
+
defaultTagName: "thead",
|
|
67
|
+
render,
|
|
68
|
+
ref,
|
|
69
|
+
props: {
|
|
70
|
+
...rest,
|
|
71
|
+
className: cn(tableHeaderClasses, className)
|
|
72
|
+
}
|
|
73
|
+
}));
|
|
74
|
+
TableHeader.displayName = "TableHeader";
|
|
75
|
+
const TableBody = forwardRef(({ render, className, ...rest }, ref) => useRender({
|
|
76
|
+
defaultTagName: "tbody",
|
|
77
|
+
render,
|
|
78
|
+
ref,
|
|
79
|
+
props: {
|
|
80
|
+
...rest,
|
|
81
|
+
className: cn(tableBodyClasses, className)
|
|
82
|
+
}
|
|
83
|
+
}));
|
|
84
|
+
TableBody.displayName = "TableBody";
|
|
85
|
+
const TableFooter = forwardRef(({ render, className, ...rest }, ref) => useRender({
|
|
86
|
+
defaultTagName: "tfoot",
|
|
87
|
+
render,
|
|
88
|
+
ref,
|
|
89
|
+
props: {
|
|
90
|
+
...rest,
|
|
91
|
+
className: cn(tableFooterClasses, className)
|
|
92
|
+
}
|
|
93
|
+
}));
|
|
94
|
+
TableFooter.displayName = "TableFooter";
|
|
95
|
+
const TableRow = forwardRef(({ selected = false, render, className, ...rest }, ref) => {
|
|
96
|
+
return useRender({
|
|
97
|
+
defaultTagName: "tr",
|
|
98
|
+
render,
|
|
99
|
+
ref,
|
|
100
|
+
state: { selected },
|
|
101
|
+
props: {
|
|
102
|
+
...rest,
|
|
103
|
+
className: cn(tableRowClasses, className)
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
TableRow.displayName = "TableRow";
|
|
108
|
+
const TableHead = forwardRef(({ scope = "col", render, className, ...rest }, ref) => useRender({
|
|
109
|
+
defaultTagName: "th",
|
|
110
|
+
render,
|
|
111
|
+
ref,
|
|
112
|
+
props: {
|
|
113
|
+
scope,
|
|
114
|
+
...rest,
|
|
115
|
+
className: cn(tableHeadClasses, className)
|
|
116
|
+
}
|
|
117
|
+
}));
|
|
118
|
+
TableHead.displayName = "TableHead";
|
|
119
|
+
const TableCell = forwardRef(({ render, className, ...rest }, ref) => useRender({
|
|
120
|
+
defaultTagName: "td",
|
|
121
|
+
render,
|
|
122
|
+
ref,
|
|
123
|
+
props: {
|
|
124
|
+
...rest,
|
|
125
|
+
className: cn(tableCellClasses, className)
|
|
126
|
+
}
|
|
127
|
+
}));
|
|
128
|
+
TableCell.displayName = "TableCell";
|
|
129
|
+
const TableCaption = forwardRef(({ side = "bottom", render, className, ...rest }, ref) => {
|
|
130
|
+
return useRender({
|
|
131
|
+
defaultTagName: "caption",
|
|
132
|
+
render,
|
|
133
|
+
ref,
|
|
134
|
+
state: { side },
|
|
135
|
+
props: {
|
|
136
|
+
...rest,
|
|
137
|
+
className: cn(tableCaptionClasses, captionSideClasses[side], className)
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
});
|
|
141
|
+
TableCaption.displayName = "TableCaption";
|
|
142
|
+
//#endregion
|
|
143
|
+
export { Table, TableBody, TableCaption, TableCell, TableContainer, TableFooter, TableHead, TableHeader, TableRow };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { Table, TableBody, TableBodyProps, TableCaption, TableCaptionProps, TableCaptionRenderState, TableCaptionSide, TableCell, TableCellProps, TableContainer, TableContainerProps, TableContainerRenderState, TableContainerVariant, TableFooter, TableFooterProps, TableHead, TableHeadProps, TableHeader, TableHeaderProps, TableLayout, TableProps, TableRenderState, TableRow, TableRowProps, TableRowRenderState, TableSize } from "./Table.js";
|
|
2
|
+
export { Table, TableBody, type TableBodyProps, TableCaption, type TableCaptionProps, type TableCaptionRenderState, type TableCaptionSide, TableCell, type TableCellProps, TableContainer, type TableContainerProps, type TableContainerRenderState, type TableContainerVariant, TableFooter, type TableFooterProps, TableHead, type TableHeadProps, TableHeader, type TableHeaderProps, type TableLayout, type TableProps, type TableRenderState, TableRow, type TableRowProps, type TableRowRenderState, type TableSize };
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { ComponentPropsWithoutRef } from "react";
|
|
2
|
+
import { Tabs } from "@base-ui/react/tabs";
|
|
3
|
+
//#region src/components/Tabs/Tabs.d.ts
|
|
4
|
+
type TabsVariant = "underline" | "pills";
|
|
5
|
+
type TabsSize = "sm" | "md" | "lg";
|
|
6
|
+
type TabsIndicatorPosition = "start" | "end";
|
|
7
|
+
interface TabsListVariantsOptions {
|
|
8
|
+
variant?: TabsVariant;
|
|
9
|
+
fullWidth?: boolean;
|
|
10
|
+
/** Show the passive divider behind an underline list. Has no effect on pills. */
|
|
11
|
+
showDivider?: boolean;
|
|
12
|
+
/** Edge used by the divider when the styled element is a vertical underline list. */
|
|
13
|
+
indicatorPosition?: TabsIndicatorPosition;
|
|
14
|
+
className?: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Class list for an element styled as a TabsList.
|
|
18
|
+
*
|
|
19
|
+
* For navigation that only *looks* like tabs (each "tab" is a different
|
|
20
|
+
* page), keep honest semantics — a `<nav>` of links with `aria-current`, not
|
|
21
|
+
* `role="tablist"`:
|
|
22
|
+
*
|
|
23
|
+
* <nav aria-label="Settings" className={tabsListVariants()}>
|
|
24
|
+
* <a href="/profile" aria-current="page" className={tabsTabVariants({ active: true })}>Profile</a>
|
|
25
|
+
* <a href="/billing" className={tabsTabVariants()}>Billing</a>
|
|
26
|
+
* </nav>
|
|
27
|
+
*/
|
|
28
|
+
declare function tabsListVariants({ variant, fullWidth, showDivider, indicatorPosition, className }?: TabsListVariantsOptions): string;
|
|
29
|
+
interface TabsTabVariantsOptions {
|
|
30
|
+
variant?: TabsVariant;
|
|
31
|
+
size?: TabsSize;
|
|
32
|
+
/**
|
|
33
|
+
* Style as the selected item — the static replacement for Base UI's
|
|
34
|
+
* `data-active` on plain nav elements: underline gains an inset 2px primary
|
|
35
|
+
* bar, pills the raised card.
|
|
36
|
+
*/
|
|
37
|
+
active?: boolean;
|
|
38
|
+
fullWidth?: boolean;
|
|
39
|
+
className?: string;
|
|
40
|
+
}
|
|
41
|
+
/** Class list for an element styled as a TabsTab (see tabsListVariants). */
|
|
42
|
+
declare function tabsTabVariants({ variant, size, active, fullWidth, className }?: TabsTabVariantsOptions): string;
|
|
43
|
+
interface TabsProps extends Omit<ComponentPropsWithoutRef<typeof Tabs.Root>, "className"> {
|
|
44
|
+
/**
|
|
45
|
+
* Visual style shared by every part: `underline` (default) marks the active
|
|
46
|
+
* tab with a 2px primary bar on the list's divider; `pills` renders a
|
|
47
|
+
* segmented control — a muted track with a raised card sliding to the
|
|
48
|
+
* active tab.
|
|
49
|
+
*/
|
|
50
|
+
variant?: TabsVariant;
|
|
51
|
+
/**
|
|
52
|
+
* Control density. Underline tabs are 32/40/48px tall; pill tabs are
|
|
53
|
+
* 24/32/40px inside the track's padding, so `sm` pills sit exactly on the
|
|
54
|
+
* WCAG 2.5.8 24px target-size floor — prefer `md`+ for touch-first
|
|
55
|
+
* surfaces.
|
|
56
|
+
*/
|
|
57
|
+
size?: TabsSize;
|
|
58
|
+
/** Stretch tabs to share the full list width equally. Horizontal orientation only. */
|
|
59
|
+
fullWidth?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Show the muted divider behind the active indicator in `underline` tabs.
|
|
62
|
+
* Set to `false` for an indicator-only treatment. The primary active
|
|
63
|
+
* indicator remains visible; this has no visual effect on `pills`.
|
|
64
|
+
*/
|
|
65
|
+
showDivider?: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Edge for the active indicator and divider in vertical underline tabs.
|
|
68
|
+
* `start` is left in LTR and right in RTL; `end` (default) is the opposite.
|
|
69
|
+
* Has no visual effect on horizontal or pill tabs.
|
|
70
|
+
*/
|
|
71
|
+
indicatorPosition?: TabsIndicatorPosition;
|
|
72
|
+
className?: string;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Groups the tab list and its panels; lays them out in a column, or a row
|
|
76
|
+
* when `orientation="vertical"`.
|
|
77
|
+
*/
|
|
78
|
+
declare const Tabs$1: import("react").ForwardRefExoticComponent<TabsProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
79
|
+
interface TabsListProps extends Omit<ComponentPropsWithoutRef<typeof Tabs.List>, "className" | "activateOnFocus"> {
|
|
80
|
+
/**
|
|
81
|
+
* Whether arrow-key focus immediately activates the focused tab. Defaults
|
|
82
|
+
* to `true` (automatic activation — the WAI-ARIA APG recommendation when
|
|
83
|
+
* panels render instantly); Base UI's own default is manual. Set `false`
|
|
84
|
+
* so Enter/Space activates instead when merely mounting a panel is
|
|
85
|
+
* expensive, e.g. it fetches on mount.
|
|
86
|
+
*/
|
|
87
|
+
activateOnFocus?: boolean;
|
|
88
|
+
className?: string;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Container for the tab buttons. Renders Base UI's `Tabs.Indicator` after the
|
|
92
|
+
* tabs automatically, so the sliding active-tab marker comes for free — don't
|
|
93
|
+
* add one manually. (The indicator positions itself on the client; before
|
|
94
|
+
* hydration the active tab is still distinguished by its text color.)
|
|
95
|
+
*/
|
|
96
|
+
declare const TabsList: import("react").ForwardRefExoticComponent<TabsListProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
97
|
+
interface TabsTabProps extends Omit<ComponentPropsWithoutRef<typeof Tabs.Tab>, "className"> {
|
|
98
|
+
className?: string;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* One tab button; its `value` pairs it with a `TabsPanel`. Icons and badges
|
|
102
|
+
* ride along as children and inherit the icon sizing. For route-driven tabs,
|
|
103
|
+
* render a real link: `render={<a href="…" />}` plus `nativeButton={false}`.
|
|
104
|
+
*/
|
|
105
|
+
declare const TabsTab: import("react").ForwardRefExoticComponent<TabsTabProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
106
|
+
interface TabsPanelProps extends Omit<ComponentPropsWithoutRef<typeof Tabs.Panel>, "className"> {
|
|
107
|
+
className?: string;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Content shown while its `value` matches the active tab. Hidden panels are
|
|
111
|
+
* unmounted unless `keepMounted` is set — use it to preserve form state or
|
|
112
|
+
* scroll position across switches.
|
|
113
|
+
*/
|
|
114
|
+
declare const TabsPanel: import("react").ForwardRefExoticComponent<TabsPanelProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
115
|
+
//#endregion
|
|
116
|
+
export { Tabs$1 as Tabs, TabsIndicatorPosition, TabsList, TabsListProps, TabsListVariantsOptions, TabsPanel, TabsPanelProps, TabsProps, TabsSize, TabsTab, TabsTabProps, TabsTabVariantsOptions, TabsVariant, tabsListVariants, tabsTabVariants };
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { cn } from "../../lib/cn.js";
|
|
2
|
+
import { createContext, forwardRef, useContext, useMemo } from "react";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { Tabs } from "@base-ui/react/tabs";
|
|
5
|
+
//#region src/components/Tabs/Tabs.tsx
|
|
6
|
+
const TabsStyleContext = createContext({
|
|
7
|
+
variant: "underline",
|
|
8
|
+
size: "md",
|
|
9
|
+
fullWidth: false,
|
|
10
|
+
showDivider: true,
|
|
11
|
+
orientation: "horizontal",
|
|
12
|
+
indicatorPosition: "end"
|
|
13
|
+
});
|
|
14
|
+
const rootClasses = "flex flex-col gap-4 data-[orientation=vertical]:flex-row";
|
|
15
|
+
const listBaseClasses = "relative isolate flex shrink-0 data-[orientation=vertical]:flex-col";
|
|
16
|
+
const listVariantClasses = {
|
|
17
|
+
underline: "gap-1",
|
|
18
|
+
pills: "gap-1 rounded-md bg-muted p-1"
|
|
19
|
+
};
|
|
20
|
+
const listDividerClasses = "border-b border-border data-[orientation=vertical]:border-b-0";
|
|
21
|
+
const listIndicatorPositionClasses = {
|
|
22
|
+
start: "data-[orientation=vertical]:border-s",
|
|
23
|
+
end: "data-[orientation=vertical]:border-e"
|
|
24
|
+
};
|
|
25
|
+
const tabBaseClasses = "inline-flex shrink-0 cursor-pointer items-center justify-center whitespace-nowrap select-none rounded-md font-sans font-medium text-slate-600 transition-colors duration-150 hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[orientation=vertical]:justify-start";
|
|
26
|
+
const tabSizeClasses = {
|
|
27
|
+
underline: {
|
|
28
|
+
sm: "h-8 gap-1.5 px-2.5 text-sm",
|
|
29
|
+
md: "h-10 gap-2 px-3 text-sm",
|
|
30
|
+
lg: "h-12 gap-2 px-4 text-base [&_svg:not([class*='size-'])]:size-5"
|
|
31
|
+
},
|
|
32
|
+
pills: {
|
|
33
|
+
sm: "h-6 gap-1.5 px-2.5 text-sm",
|
|
34
|
+
md: "h-8 gap-2 px-3 text-sm",
|
|
35
|
+
lg: "h-10 gap-2 px-4 text-base [&_svg:not([class*='size-'])]:size-5"
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
const tabActiveDataClasses = {
|
|
39
|
+
underline: "data-active:text-primary",
|
|
40
|
+
pills: "data-active:text-foreground"
|
|
41
|
+
};
|
|
42
|
+
const tabActiveStaticClasses = {
|
|
43
|
+
underline: "text-primary shadow-[inset_0_-2px_0_0_var(--color-primary)]",
|
|
44
|
+
pills: "bg-background text-foreground shadow-sm"
|
|
45
|
+
};
|
|
46
|
+
const indicatorBaseClasses = "absolute -z-1 motion-safe:transition-all motion-safe:duration-200 motion-safe:ease-out";
|
|
47
|
+
const indicatorVariantClasses = {
|
|
48
|
+
underline: "rounded-full bg-primary data-[orientation=horizontal]:bottom-0 data-[orientation=horizontal]:left-0 data-[orientation=horizontal]:h-0.5 data-[orientation=horizontal]:w-(--active-tab-width) data-[orientation=horizontal]:translate-x-(--active-tab-left) data-[orientation=vertical]:top-0 data-[orientation=vertical]:w-0.5 data-[orientation=vertical]:h-(--active-tab-height) data-[orientation=vertical]:translate-y-(--active-tab-top)",
|
|
49
|
+
pills: "top-0 left-0 rounded-md bg-background shadow-sm h-(--active-tab-height) w-(--active-tab-width) translate-x-(--active-tab-left) translate-y-(--active-tab-top)"
|
|
50
|
+
};
|
|
51
|
+
const indicatorPositionClasses = {
|
|
52
|
+
start: "data-[orientation=vertical]:start-0",
|
|
53
|
+
end: "data-[orientation=vertical]:end-0"
|
|
54
|
+
};
|
|
55
|
+
const panelClasses = "min-w-0 flex-1 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring";
|
|
56
|
+
/**
|
|
57
|
+
* Class list for an element styled as a TabsList.
|
|
58
|
+
*
|
|
59
|
+
* For navigation that only *looks* like tabs (each "tab" is a different
|
|
60
|
+
* page), keep honest semantics — a `<nav>` of links with `aria-current`, not
|
|
61
|
+
* `role="tablist"`:
|
|
62
|
+
*
|
|
63
|
+
* <nav aria-label="Settings" className={tabsListVariants()}>
|
|
64
|
+
* <a href="/profile" aria-current="page" className={tabsTabVariants({ active: true })}>Profile</a>
|
|
65
|
+
* <a href="/billing" className={tabsTabVariants()}>Billing</a>
|
|
66
|
+
* </nav>
|
|
67
|
+
*/
|
|
68
|
+
function tabsListVariants({ variant = "underline", fullWidth = false, showDivider = true, indicatorPosition = "end", className } = {}) {
|
|
69
|
+
return cn(listBaseClasses, listVariantClasses[variant], variant === "underline" && showDivider && listDividerClasses, variant === "underline" && showDivider && listIndicatorPositionClasses[indicatorPosition], fullWidth && "w-full", className);
|
|
70
|
+
}
|
|
71
|
+
/** Class list for an element styled as a TabsTab (see tabsListVariants). */
|
|
72
|
+
function tabsTabVariants({ variant = "underline", size = "md", active = false, fullWidth = false, className } = {}) {
|
|
73
|
+
return cn(tabBaseClasses, tabSizeClasses[variant][size], active && tabActiveStaticClasses[variant], fullWidth && "flex-1", className);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Groups the tab list and its panels; lays them out in a column, or a row
|
|
77
|
+
* when `orientation="vertical"`.
|
|
78
|
+
*/
|
|
79
|
+
const Tabs$1 = forwardRef(({ variant = "underline", size = "md", fullWidth = false, showDivider = true, orientation = "horizontal", indicatorPosition = "end", className, ...rest }, ref) => {
|
|
80
|
+
const styleContext = useMemo(() => ({
|
|
81
|
+
variant,
|
|
82
|
+
size,
|
|
83
|
+
fullWidth,
|
|
84
|
+
showDivider,
|
|
85
|
+
orientation,
|
|
86
|
+
indicatorPosition
|
|
87
|
+
}), [
|
|
88
|
+
variant,
|
|
89
|
+
size,
|
|
90
|
+
fullWidth,
|
|
91
|
+
showDivider,
|
|
92
|
+
orientation,
|
|
93
|
+
indicatorPosition
|
|
94
|
+
]);
|
|
95
|
+
return /* @__PURE__ */ jsx(TabsStyleContext.Provider, {
|
|
96
|
+
value: styleContext,
|
|
97
|
+
children: /* @__PURE__ */ jsx(Tabs.Root, {
|
|
98
|
+
ref,
|
|
99
|
+
orientation,
|
|
100
|
+
className: cn(rootClasses, className),
|
|
101
|
+
...rest
|
|
102
|
+
})
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
Tabs$1.displayName = "Tabs";
|
|
106
|
+
/**
|
|
107
|
+
* Container for the tab buttons. Renders Base UI's `Tabs.Indicator` after the
|
|
108
|
+
* tabs automatically, so the sliding active-tab marker comes for free — don't
|
|
109
|
+
* add one manually. (The indicator positions itself on the client; before
|
|
110
|
+
* hydration the active tab is still distinguished by its text color.)
|
|
111
|
+
*/
|
|
112
|
+
const TabsList = forwardRef(({ activateOnFocus = true, className, children, ...rest }, ref) => {
|
|
113
|
+
const { variant, fullWidth, showDivider, orientation, indicatorPosition } = useContext(TabsStyleContext);
|
|
114
|
+
return /* @__PURE__ */ jsxs(Tabs.List, {
|
|
115
|
+
ref,
|
|
116
|
+
activateOnFocus,
|
|
117
|
+
className: cn(tabsListVariants({
|
|
118
|
+
variant,
|
|
119
|
+
fullWidth: fullWidth && orientation === "horizontal",
|
|
120
|
+
showDivider,
|
|
121
|
+
indicatorPosition
|
|
122
|
+
}), className),
|
|
123
|
+
...rest,
|
|
124
|
+
children: [children, /* @__PURE__ */ jsx(Tabs.Indicator, { className: cn(indicatorBaseClasses, indicatorVariantClasses[variant], variant === "underline" && indicatorPositionClasses[indicatorPosition]) })]
|
|
125
|
+
});
|
|
126
|
+
});
|
|
127
|
+
TabsList.displayName = "TabsList";
|
|
128
|
+
/**
|
|
129
|
+
* One tab button; its `value` pairs it with a `TabsPanel`. Icons and badges
|
|
130
|
+
* ride along as children and inherit the icon sizing. For route-driven tabs,
|
|
131
|
+
* render a real link: `render={<a href="…" />}` plus `nativeButton={false}`.
|
|
132
|
+
*/
|
|
133
|
+
const TabsTab = forwardRef(({ className, ...rest }, ref) => {
|
|
134
|
+
const { variant, size, fullWidth, orientation } = useContext(TabsStyleContext);
|
|
135
|
+
return /* @__PURE__ */ jsx(Tabs.Tab, {
|
|
136
|
+
ref,
|
|
137
|
+
className: cn(tabsTabVariants({
|
|
138
|
+
variant,
|
|
139
|
+
size,
|
|
140
|
+
fullWidth: fullWidth && orientation === "horizontal"
|
|
141
|
+
}), tabActiveDataClasses[variant], className),
|
|
142
|
+
...rest
|
|
143
|
+
});
|
|
144
|
+
});
|
|
145
|
+
TabsTab.displayName = "TabsTab";
|
|
146
|
+
/**
|
|
147
|
+
* Content shown while its `value` matches the active tab. Hidden panels are
|
|
148
|
+
* unmounted unless `keepMounted` is set — use it to preserve form state or
|
|
149
|
+
* scroll position across switches.
|
|
150
|
+
*/
|
|
151
|
+
const TabsPanel = forwardRef(({ className, ...rest }, ref) => /* @__PURE__ */ jsx(Tabs.Panel, {
|
|
152
|
+
ref,
|
|
153
|
+
className: cn(panelClasses, className),
|
|
154
|
+
...rest
|
|
155
|
+
}));
|
|
156
|
+
TabsPanel.displayName = "TabsPanel";
|
|
157
|
+
//#endregion
|
|
158
|
+
export { Tabs$1 as Tabs, TabsList, TabsPanel, TabsTab, tabsListVariants, tabsTabVariants };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { Tabs, TabsIndicatorPosition, TabsList, TabsListProps, TabsListVariantsOptions, TabsPanel, TabsPanelProps, TabsProps, TabsSize, TabsTab, TabsTabProps, TabsTabVariantsOptions, TabsVariant, tabsListVariants, tabsTabVariants } from "./Tabs.js";
|
|
2
|
+
export { Tabs, type TabsIndicatorPosition, TabsList, type TabsListProps, type TabsListVariantsOptions, TabsPanel, type TabsPanelProps, type TabsProps, type TabsSize, TabsTab, type TabsTabProps, type TabsTabVariantsOptions, type TabsVariant, tabsListVariants, tabsTabVariants };
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { ComponentPropsWithoutRef } from "react";
|
|
2
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
3
|
+
//#region src/components/Timeline/Timeline.d.ts
|
|
4
|
+
type TimelineSize = "sm" | "md" | "lg";
|
|
5
|
+
type TimelineIndicatorVariant = "neutral" | "primary" | "success" | "warning" | "destructive";
|
|
6
|
+
type TimelineIndicatorAppearance = "solid" | "soft" | "outline";
|
|
7
|
+
type TimelineSeparatorVariant = "solid" | "dashed";
|
|
8
|
+
interface TimelineProps extends Omit<ComponentPropsWithoutRef<"ol">, "className"> {
|
|
9
|
+
/**
|
|
10
|
+
* Marker diameter and type scale: `sm` 16px · `md` 20px · `lg` 24px.
|
|
11
|
+
* Markers are non-interactive, so WCAG target-size floors don't apply —
|
|
12
|
+
* pick by information density, `sm` for compact logs.
|
|
13
|
+
*/
|
|
14
|
+
size?: TimelineSize;
|
|
15
|
+
/** Replace the rendered `ol`. Preserve list semantics — they give screen-reader users the "2 of 5" position for free. */
|
|
16
|
+
render?: useRender.RenderProp;
|
|
17
|
+
/** Additional classes merged after the root recipe, e.g. `max-w-md`. */
|
|
18
|
+
className?: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* A chronological list of events, marked up as an ordered list. The timeline
|
|
22
|
+
* is display-only — it holds no current-step state (progress through a flow
|
|
23
|
+
* is Stepper's job) and renders whatever order it receives; feeds usually
|
|
24
|
+
* pass newest-first. Give the list an accessible name (`aria-label` or
|
|
25
|
+
* `aria-labelledby`, e.g. "Deployment history") when the surrounding context
|
|
26
|
+
* doesn't already announce one.
|
|
27
|
+
*/
|
|
28
|
+
declare const Timeline: import("react").ForwardRefExoticComponent<TimelineProps & import("react").RefAttributes<HTMLOListElement>>;
|
|
29
|
+
interface TimelineItemProps extends Omit<ComponentPropsWithoutRef<"li">, "className"> {
|
|
30
|
+
/** Replace the rendered `li`. Preserve list-item semantics. */
|
|
31
|
+
render?: useRender.RenderProp;
|
|
32
|
+
/** Additional classes merged after the item recipe. */
|
|
33
|
+
className?: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* One event: a flex row of an optional leading `TimelineContent` (opposite
|
|
37
|
+
* side), the `TimelineConnector` column, and the trailing `TimelineContent`.
|
|
38
|
+
*/
|
|
39
|
+
declare const TimelineItem: import("react").ForwardRefExoticComponent<TimelineItemProps & import("react").RefAttributes<HTMLLIElement>>;
|
|
40
|
+
interface TimelineConnectorProps extends Omit<ComponentPropsWithoutRef<"div">, "className"> {
|
|
41
|
+
/** Replace the rendered `div`. */
|
|
42
|
+
render?: useRender.RenderProp;
|
|
43
|
+
/** Additional classes merged after the connector recipe. */
|
|
44
|
+
className?: string;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* The marker column: it stretches to the item's height and stacks the
|
|
48
|
+
* `TimelineIndicator` above the `TimelineSeparator`, which fills the rest —
|
|
49
|
+
* so the rail always reaches the next item's marker, however tall the
|
|
50
|
+
* content grows.
|
|
51
|
+
*/
|
|
52
|
+
declare const TimelineConnector: import("react").ForwardRefExoticComponent<TimelineConnectorProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
53
|
+
interface TimelineIndicatorProps extends Omit<ComponentPropsWithoutRef<"span">, "className"> {
|
|
54
|
+
/** Status color of the marker, reusing the Badge vocabulary. */
|
|
55
|
+
variant?: TimelineIndicatorVariant;
|
|
56
|
+
/**
|
|
57
|
+
* Fill treatment: `solid` is the classic filled dot, `soft` the tinted
|
|
58
|
+
* icon circle, `outline` a hollow ring — the upcoming/unreached look in
|
|
59
|
+
* tracking timelines.
|
|
60
|
+
*/
|
|
61
|
+
appearance?: TimelineIndicatorAppearance;
|
|
62
|
+
/** Replace the rendered `span`, e.g. with an `Avatar` for actor feeds. */
|
|
63
|
+
render?: useRender.RenderProp;
|
|
64
|
+
/** Additional classes merged after the marker recipe, e.g. `size-8` for an avatar-sized marker. */
|
|
65
|
+
className?: string;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* The event's marker. Empty it renders as a plain dot; children (an icon, a
|
|
69
|
+
* spinner, a letter) center inside it. Glyphs are decorative next to the
|
|
70
|
+
* event's own text — mark them `aria-hidden`; when the marker alone carries
|
|
71
|
+
* meaning (a bare status dot), pair it with visually-hidden text in the
|
|
72
|
+
* content instead.
|
|
73
|
+
*/
|
|
74
|
+
declare const TimelineIndicator: import("react").ForwardRefExoticComponent<TimelineIndicatorProps & import("react").RefAttributes<HTMLSpanElement>>;
|
|
75
|
+
interface TimelineSeparatorProps extends Omit<ComponentPropsWithoutRef<"span">, "className"> {
|
|
76
|
+
/** Line style. `dashed` marks an unfinished stretch — the rail into upcoming or in-progress events. */
|
|
77
|
+
variant?: TimelineSeparatorVariant;
|
|
78
|
+
/** Replace the rendered `span`. Keep it hidden from assistive technology — the rail is purely visual. */
|
|
79
|
+
render?: useRender.RenderProp;
|
|
80
|
+
/** Additional classes merged after the separator recipe, e.g. `border-primary` for a completed stretch. */
|
|
81
|
+
className?: string;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* The rail segment below a marker, connecting it to the next event. Omit it
|
|
85
|
+
* on the last item so the timeline ends at its final marker.
|
|
86
|
+
*/
|
|
87
|
+
declare const TimelineSeparator: import("react").ForwardRefExoticComponent<TimelineSeparatorProps & import("react").RefAttributes<HTMLSpanElement>>;
|
|
88
|
+
interface TimelineContentProps extends Omit<ComponentPropsWithoutRef<"div">, "className"> {
|
|
89
|
+
/** Replace the rendered `div`. */
|
|
90
|
+
render?: useRender.RenderProp;
|
|
91
|
+
/**
|
|
92
|
+
* Additional classes merged after the content recipe. A leading (opposite
|
|
93
|
+
* side) copy usually caps its width and right-aligns: `flex-none w-24
|
|
94
|
+
* text-end`; leave both sides `flex-1` to center the rail for alternating
|
|
95
|
+
* layouts.
|
|
96
|
+
*/
|
|
97
|
+
className?: string;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* The event's body, holding `TimelineTitle` / `TimelineTime` /
|
|
101
|
+
* `TimelineDescription` or any richer blocks. It carries the spacing between
|
|
102
|
+
* items, so the connector's rail spans the full distance to the next marker.
|
|
103
|
+
* Place one before the connector for opposite-side content (dates in a
|
|
104
|
+
* roadmap, alternating layouts).
|
|
105
|
+
*/
|
|
106
|
+
declare const TimelineContent: import("react").ForwardRefExoticComponent<TimelineContentProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
107
|
+
interface TimelineTitleProps extends Omit<ComponentPropsWithoutRef<"span">, "className"> {
|
|
108
|
+
/** Replace the rendered `span`, e.g. `render={<h3 />}` when changelog entries belong in the document outline. */
|
|
109
|
+
render?: useRender.RenderProp;
|
|
110
|
+
/** Additional classes merged after the title recipe. */
|
|
111
|
+
className?: string;
|
|
112
|
+
}
|
|
113
|
+
/** The event's one-line headline. */
|
|
114
|
+
declare const TimelineTitle: import("react").ForwardRefExoticComponent<TimelineTitleProps & import("react").RefAttributes<HTMLSpanElement>>;
|
|
115
|
+
interface TimelineDescriptionProps extends Omit<ComponentPropsWithoutRef<"span">, "className"> {
|
|
116
|
+
/** Replace the rendered `span`. */
|
|
117
|
+
render?: useRender.RenderProp;
|
|
118
|
+
/** Additional classes merged after the description recipe. */
|
|
119
|
+
className?: string;
|
|
120
|
+
}
|
|
121
|
+
/** Supporting copy under the title. */
|
|
122
|
+
declare const TimelineDescription: import("react").ForwardRefExoticComponent<TimelineDescriptionProps & import("react").RefAttributes<HTMLSpanElement>>;
|
|
123
|
+
interface TimelineTimeProps extends Omit<ComponentPropsWithoutRef<"time">, "className"> {
|
|
124
|
+
/** Replace the rendered `time`. */
|
|
125
|
+
render?: useRender.RenderProp;
|
|
126
|
+
/** Additional classes merged after the time recipe. */
|
|
127
|
+
className?: string;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* The event's timestamp as a real `<time>` element. Feeds abbreviate the
|
|
131
|
+
* visible text ("3h", "May 12") — keep the absolute moment machine-readable
|
|
132
|
+
* in `dateTime`, and put it in the human-readable `title` when the visible
|
|
133
|
+
* form is relative.
|
|
134
|
+
*/
|
|
135
|
+
declare const TimelineTime: import("react").ForwardRefExoticComponent<TimelineTimeProps & import("react").RefAttributes<HTMLTimeElement>>;
|
|
136
|
+
//#endregion
|
|
137
|
+
export { Timeline, TimelineConnector, TimelineConnectorProps, TimelineContent, TimelineContentProps, TimelineDescription, TimelineDescriptionProps, TimelineIndicator, TimelineIndicatorAppearance, TimelineIndicatorProps, TimelineIndicatorVariant, TimelineItem, TimelineItemProps, TimelineProps, TimelineSeparator, TimelineSeparatorProps, TimelineSeparatorVariant, TimelineSize, TimelineTime, TimelineTimeProps, TimelineTitle, TimelineTitleProps };
|