@surflane/ui 0.11.0 → 0.13.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/alert-dialog.d.ts +25 -7
- package/dist/alert-dialog.js +9 -4
- package/dist/app-shell.d.ts +10 -0
- package/dist/app-shell.js +7 -1
- package/dist/autocomplete.d.ts +2 -6
- package/dist/avatar.d.ts +7 -7
- package/dist/avatar.js +2 -2
- package/dist/bar-list.d.ts +31 -0
- package/dist/bar-list.js +31 -0
- package/dist/bottom-navigation.d.ts +6 -2
- package/dist/bottom-navigation.js +2 -2
- package/dist/button.d.ts +6 -11
- package/dist/button.js +8 -8
- package/dist/card.d.ts +15 -10
- package/dist/card.js +7 -2
- package/dist/chart.d.ts +58 -3
- package/dist/chart.js +330 -48
- package/dist/choice.d.ts +2 -2
- package/dist/class-names.d.ts +0 -4
- package/dist/class-names.js +0 -14
- package/dist/code.d.ts +19 -7
- package/dist/code.js +32 -38
- package/dist/combobox.d.ts +2 -8
- package/dist/combobox.js +2 -2
- package/dist/context-menu.d.ts +2 -8
- package/dist/context-menu.js +2 -2
- package/dist/css/bar-list.css +9 -0
- package/dist/css/chart.css +2 -0
- package/dist/css/dashboard.css +20 -0
- package/dist/css/rules/alert-dialog.css +8 -2
- package/dist/css/rules/app-shell.css +57 -10
- package/dist/css/rules/bar-list.css +101 -0
- package/dist/css/rules/bar.css +5 -12
- package/dist/css/rules/bottom-navigation.css +21 -2
- package/dist/css/rules/breadcrumbs.css +0 -6
- package/dist/css/rules/button.css +4 -12
- package/dist/css/rules/card.css +19 -0
- package/dist/css/rules/chart.css +87 -8
- package/dist/css/rules/choice.css +26 -2
- package/dist/css/rules/combobox.css +17 -16
- package/dist/css/rules/dashboard.css +118 -0
- package/dist/css/rules/date-picker.css +50 -27
- package/dist/css/rules/dialog.css +47 -7
- package/dist/css/rules/disclosure.css +17 -3
- package/dist/css/rules/field-control.css +9 -6
- package/dist/css/rules/file-upload.css +9 -5
- package/dist/css/rules/filter-bar.css +32 -2
- package/dist/css/rules/gauge.css +2 -2
- package/dist/css/rules/icon.css +0 -5
- package/dist/css/rules/input-group.css +23 -8
- package/dist/css/rules/link.css +0 -6
- package/dist/css/rules/menu.css +5 -2
- package/dist/css/rules/menubar.css +1 -1
- package/dist/css/rules/navigation-menu.css +31 -26
- package/dist/css/rules/number-field.css +8 -1
- package/dist/css/rules/otp-field.css +13 -3
- package/dist/css/rules/page-header.css +10 -0
- package/dist/css/rules/panel.css +59 -10
- package/dist/css/rules/popup.css +50 -0
- package/dist/css/rules/preview-card.css +0 -21
- package/dist/css/rules/scroll-area.css +20 -1
- package/dist/css/rules/select.css +29 -2
- package/dist/css/rules/sizing.css +25 -3
- package/dist/css/rules/skeleton.css +1 -1
- package/dist/css/rules/slider.css +16 -8
- package/dist/css/rules/spinner.css +1 -1
- package/dist/css/rules/stat.css +66 -0
- package/dist/css/rules/tabs.css +14 -6
- package/dist/css/rules/textarea.css +28 -0
- package/dist/css/rules/time-range-picker.css +14 -0
- package/dist/css/rules/toast.css +3 -1
- package/dist/css/rules/toggle.css +10 -3
- package/dist/css/rules/toolbar.css +10 -3
- package/dist/css/rules/tree.css +29 -4
- package/dist/css/styles.css +3 -0
- package/dist/css/time-range-picker.css +14 -0
- package/dist/dashboard.d.ts +58 -0
- package/dist/dashboard.js +60 -0
- package/dist/date-picker.d.ts +32 -3
- package/dist/date-picker.js +43 -4
- package/dist/dialog.d.ts +25 -7
- package/dist/dialog.js +9 -4
- package/dist/drawer.d.ts +10 -2
- package/dist/drawer.js +6 -3
- package/dist/icon.d.ts +15 -5
- package/dist/icon.js +16 -3
- package/dist/index.d.ts +9 -6
- package/dist/index.js +7 -4
- package/dist/inline-message.d.ts +2 -2
- package/dist/inline-message.js +7 -2
- package/dist/input.d.ts +2 -2
- package/dist/layout.d.ts +1 -3
- package/dist/layout.js +2 -2
- package/dist/native-select.d.ts +2 -2
- package/dist/navigation-menu.d.ts +16 -0
- package/dist/navigation-menu.js +6 -1
- package/dist/page-header.d.ts +10 -2
- package/dist/page-header.js +3 -3
- package/dist/panel.d.ts +6 -3
- package/dist/panel.js +2 -2
- package/dist/parts.d.ts +7 -3
- package/dist/parts.js +12 -4
- package/dist/popover.d.ts +6 -6
- package/dist/popover.js +3 -2
- package/dist/preview-card.d.ts +2 -8
- package/dist/preview-card.js +2 -2
- package/dist/select.d.ts +38 -8
- package/dist/select.js +110 -22
- package/dist/sheet.d.ts +10 -2
- package/dist/sheet.js +6 -3
- package/dist/size.d.ts +8 -6
- package/dist/size.js +2 -7
- package/dist/sizing.d.ts +13 -6
- package/dist/sizing.js +13 -4
- package/dist/sparkline.d.ts +2 -2
- package/dist/sparkline.js +2 -2
- package/dist/spinner.d.ts +2 -2
- package/dist/spinner.js +2 -2
- package/dist/stat.d.ts +24 -0
- package/dist/stat.js +15 -1
- package/dist/table.d.ts +12 -4
- package/dist/table.js +8 -3
- package/dist/textarea.d.ts +6 -3
- package/dist/textarea.js +2 -2
- package/dist/time-range-picker.d.ts +42 -0
- package/dist/time-range-picker.js +69 -0
- package/dist/toggle.d.ts +2 -2
- package/dist/toggle.js +2 -2
- package/dist/toolbar.d.ts +11 -10
- package/dist/toolbar.js +23 -1
- package/dist/tooltip.d.ts +1 -3
- package/dist/tooltip.js +4 -2
- package/dist/tree.d.ts +1 -3
- package/dist/tree.js +2 -2
- package/dist/typography.d.ts +10 -3
- package/dist/typography.js +4 -3
- package/package.json +18 -3
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { Button } from './button.js';
|
|
5
|
+
import { Icon } from './icon.js';
|
|
6
|
+
import { Select } from './select.js';
|
|
7
|
+
import { cx } from './class-names.js';
|
|
8
|
+
const MINUTE = 60_000, HOUR = 60 * MINUTE, DAY = 24 * HOUR;
|
|
9
|
+
export const timeRangeOptions = [
|
|
10
|
+
{ value: 15 * MINUTE, label: 'Last 15 minutes' },
|
|
11
|
+
{ value: HOUR, label: 'Last hour' },
|
|
12
|
+
{ value: 6 * HOUR, label: 'Last 6 hours' },
|
|
13
|
+
{ value: DAY, label: 'Last 24 hours' },
|
|
14
|
+
{ value: 7 * DAY, label: 'Last 7 days' },
|
|
15
|
+
{ value: 30 * DAY, label: 'Last 30 days' },
|
|
16
|
+
];
|
|
17
|
+
/** 0 is off. */
|
|
18
|
+
export const refreshIntervalOptions = [
|
|
19
|
+
{ value: 0, label: 'Off' },
|
|
20
|
+
{ value: 10_000, label: 'Every 10 seconds' },
|
|
21
|
+
{ value: 30_000, label: 'Every 30 seconds' },
|
|
22
|
+
{ value: MINUTE, label: 'Every minute' },
|
|
23
|
+
{ value: 5 * MINUTE, label: 'Every 5 minutes' },
|
|
24
|
+
];
|
|
25
|
+
const pickerLabels = {
|
|
26
|
+
range: 'Time range',
|
|
27
|
+
refresh: 'Refresh interval',
|
|
28
|
+
refreshNow: 'Refresh now',
|
|
29
|
+
};
|
|
30
|
+
/** The span a monitoring screen shows, back from now, with how often it refreshes and
|
|
31
|
+
* a button to refresh now. For a fixed span between two dates, put a DateRangePicker
|
|
32
|
+
* beside it. */
|
|
33
|
+
export const TimeRangePicker = function TimeRangePicker({ label, range, onRangeChange, ranges = timeRangeOptions, refreshInterval, onRefreshIntervalChange, refreshIntervals: intervals = refreshIntervalOptions, onRefresh, labels, size, className, ref, ...props }) {
|
|
34
|
+
const text = { ...pickerLabels, ...labels };
|
|
35
|
+
const refresh = React.useRef(onRefresh);
|
|
36
|
+
refresh.current = onRefresh;
|
|
37
|
+
// The interval pauses while the page is hidden, and refreshes once it shows again.
|
|
38
|
+
React.useEffect(() => {
|
|
39
|
+
if (!refreshInterval || !refresh.current)
|
|
40
|
+
return;
|
|
41
|
+
let due = false;
|
|
42
|
+
const timer = setInterval(() => {
|
|
43
|
+
if (document.hidden)
|
|
44
|
+
due = true;
|
|
45
|
+
else
|
|
46
|
+
refresh.current?.();
|
|
47
|
+
}, refreshInterval);
|
|
48
|
+
const shown = () => {
|
|
49
|
+
if (!document.hidden && due) {
|
|
50
|
+
due = false;
|
|
51
|
+
refresh.current?.();
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
document.addEventListener('visibilitychange', shown);
|
|
55
|
+
return () => {
|
|
56
|
+
clearInterval(timer);
|
|
57
|
+
document.removeEventListener('visibilitychange', shown);
|
|
58
|
+
};
|
|
59
|
+
}, [refreshInterval]);
|
|
60
|
+
const options = (list) => list.map((option) => ({
|
|
61
|
+
value: String(option.value),
|
|
62
|
+
label: option.label,
|
|
63
|
+
}));
|
|
64
|
+
return (_jsxs("div", { role: 'group', "aria-label": label, ...props, ref: ref, className: cx('surf-time-range', className), children: [_jsx(Select, { width: 'content', size: size, options: options(ranges), value: String(range), onValueChange: (value) => onRangeChange(Number(value)), "aria-label": text.range }), refreshInterval !== undefined && (_jsx(Select, { width: 'content', size: size, options: options(intervals), value: String(refreshInterval), onValueChange: (value) => onRefreshIntervalChange?.(Number(value)), "aria-label": text.refresh })), onRefresh && (_jsx(Button, { variant: 'outline', size: size === 'small'
|
|
65
|
+
? 'icon-small'
|
|
66
|
+
: size === 'large'
|
|
67
|
+
? 'icon-large'
|
|
68
|
+
: 'icon', "aria-label": text.refreshNow, onClick: () => onRefresh(), children: _jsx(Icon, { name: 'refresh' }) }))] }));
|
|
69
|
+
};
|
package/dist/toggle.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { type
|
|
2
|
+
import { type ComponentSize } from './sizing.js';
|
|
3
3
|
import { Toggle as BaseToggle } from '@base-ui/react/toggle';
|
|
4
4
|
export declare function Toggle<Value extends string>({ className, size, ref, ...props }: BaseToggle.Props<Value> & {
|
|
5
|
-
size?:
|
|
5
|
+
size?: ComponentSize | 'icon';
|
|
6
6
|
ref?: React.Ref<HTMLButtonElement>;
|
|
7
7
|
}): React.JSX.Element;
|
package/dist/toggle.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { useComponentSize } from './sizing.js';
|
|
4
4
|
import { Toggle as BaseToggle } from '@base-ui/react/toggle';
|
|
5
|
-
import {
|
|
5
|
+
import { skin } from './parts.js';
|
|
6
6
|
export function Toggle({ className, size, ref, ...props }) {
|
|
7
7
|
const scheme = useComponentSize(size === 'icon' ? undefined : size);
|
|
8
|
-
return (_jsx(BaseToggle, { ...props, ref: ref, className: skin('surf-button surf-toggle', className), "data-size":
|
|
8
|
+
return (_jsx(BaseToggle, { ...props, ref: ref, className: skin('surf-button surf-toggle', className), "data-size": size, "data-ui-size": scheme }));
|
|
9
9
|
}
|
package/dist/toolbar.d.ts
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
declare const RootPart: ({ ref, ...props }: Omit<Omit<Omit<import("@base-ui/react/toolbar").ToolbarRootProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref">, "size"> & {
|
|
3
|
+
size?: import("./size.js").ComponentSize;
|
|
4
|
+
} & {
|
|
5
|
+
ref?: React.Ref<HTMLDivElement> | undefined;
|
|
6
|
+
}) => React.JSX.Element;
|
|
7
|
+
/** Home and End reach the first and last item, as they do in ToggleGroup, Tabs and
|
|
8
|
+
* Menubar; Base UI's toolbar leaves them out. Inside an input they move the caret. */
|
|
9
|
+
declare function Root({ onKeyDown, ...props }: React.ComponentProps<typeof RootPart>): React.JSX.Element;
|
|
2
10
|
export declare const Toolbar: {
|
|
3
|
-
Root:
|
|
4
|
-
size?: import("./size.js").ComponentSize;
|
|
5
|
-
} & {
|
|
6
|
-
ref?: React.Ref<HTMLDivElement> | undefined;
|
|
7
|
-
}) => React.JSX.Element;
|
|
11
|
+
Root: typeof Root;
|
|
8
12
|
Group: ({ ref, ...props }: Omit<Omit<Omit<import("@base-ui/react/toolbar").ToolbarGroupProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref">, "size"> & {
|
|
9
13
|
size?: import("./size.js").ComponentSize;
|
|
10
14
|
} & {
|
|
@@ -47,12 +51,9 @@ export declare const ToolbarButton: ({ ref, ...props }: Omit<Omit<Omit<import("@
|
|
|
47
51
|
size?: import("./size.js").ComponentSize;
|
|
48
52
|
} & {
|
|
49
53
|
ref?: React.Ref<HTMLAnchorElement> | undefined;
|
|
50
|
-
}) => React.JSX.Element, ToolbarRoot: ({ ref, ...props }: Omit<Omit<Omit<import("@base-ui/react/toolbar").
|
|
51
|
-
size?: import("./size.js").ComponentSize;
|
|
52
|
-
} & {
|
|
53
|
-
ref?: React.Ref<HTMLDivElement> | undefined;
|
|
54
|
-
}) => React.JSX.Element, ToolbarSeparator: ({ ref, ...props }: Omit<Omit<Omit<import("@base-ui/react/toolbar").ToolbarSeparatorProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref">, "size"> & {
|
|
54
|
+
}) => React.JSX.Element, ToolbarRoot: typeof Root, ToolbarSeparator: ({ ref, ...props }: Omit<Omit<Omit<import("@base-ui/react/toolbar").ToolbarSeparatorProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref">, "size"> & {
|
|
55
55
|
size?: import("./size.js").ComponentSize;
|
|
56
56
|
} & {
|
|
57
57
|
ref?: React.Ref<HTMLDivElement> | undefined;
|
|
58
58
|
}) => React.JSX.Element;
|
|
59
|
+
export {};
|
package/dist/toolbar.js
CHANGED
|
@@ -1,9 +1,31 @@
|
|
|
1
1
|
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
3
|
import { Toolbar as BaseToolbar } from '@base-ui/react/toolbar';
|
|
3
4
|
import { part } from './parts.js';
|
|
5
|
+
const RootPart = /* @__PURE__ */ part(BaseToolbar.Root, 'surf-toolbar');
|
|
6
|
+
/** Home and End reach the first and last item, as they do in ToggleGroup, Tabs and
|
|
7
|
+
* Menubar; Base UI's toolbar leaves them out. Inside an input they move the caret. */
|
|
8
|
+
function Root({ onKeyDown, ...props }) {
|
|
9
|
+
return (_jsx(RootPart, { ...props, onKeyDown: (event) => {
|
|
10
|
+
onKeyDown?.(event);
|
|
11
|
+
const toolbar = event.currentTarget;
|
|
12
|
+
if (event.defaultPrevented ||
|
|
13
|
+
(event.key !== 'Home' && event.key !== 'End') ||
|
|
14
|
+
event.target.matches('input, textarea'))
|
|
15
|
+
return;
|
|
16
|
+
const items = [
|
|
17
|
+
...toolbar.querySelectorAll('[tabindex]'),
|
|
18
|
+
].filter((item) => item.closest('[role="toolbar"]') === toolbar);
|
|
19
|
+
const item = event.key === 'Home' ? items[0] : items.at(-1);
|
|
20
|
+
if (!item)
|
|
21
|
+
return;
|
|
22
|
+
event.preventDefault();
|
|
23
|
+
item.focus();
|
|
24
|
+
} }));
|
|
25
|
+
}
|
|
4
26
|
export const Toolbar = {
|
|
5
27
|
...BaseToolbar,
|
|
6
|
-
Root
|
|
28
|
+
Root,
|
|
7
29
|
Group: /* @__PURE__ */ part(BaseToolbar.Group, 'surf-toolbar-group'),
|
|
8
30
|
Button: /* @__PURE__ */ part(BaseToolbar.Button, 'surf-button surf-toolbar-button'),
|
|
9
31
|
Link: /* @__PURE__ */ part(BaseToolbar.Link, 'surf-button surf-toolbar-link'),
|
package/dist/tooltip.d.ts
CHANGED
|
@@ -14,8 +14,6 @@ export type TooltipProps = {
|
|
|
14
14
|
shortcut?: string;
|
|
15
15
|
/** Keeps the tooltip from opening while the trigger stays as it is. */
|
|
16
16
|
disabled?: boolean;
|
|
17
|
-
/** @deprecated Use `disabled`. Removed in a later minor. */
|
|
18
|
-
enabled?: boolean;
|
|
19
17
|
children: React.ReactElement;
|
|
20
18
|
} & Pick<React.ComponentPropsWithoutRef<typeof BaseTooltip.Positioner>, 'side' | 'align' | 'sideOffset'>;
|
|
21
|
-
export declare function Tooltip({ label, shortcut, disabled,
|
|
19
|
+
export declare function Tooltip({ label, shortcut, disabled, side, align, sideOffset, children, }: TooltipProps): React.JSX.Element;
|
package/dist/tooltip.js
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useComponentSize } from './sizing.js';
|
|
4
|
+
import { usePortalDirection } from './parts.js';
|
|
4
5
|
import { Tooltip as BaseTooltip } from '@base-ui/react/tooltip';
|
|
5
6
|
export function TooltipProvider({ delayDuration = 150, skipDelayDuration = 300, children, }) {
|
|
6
7
|
return (_jsx(BaseTooltip.Provider, { delay: delayDuration, closeDelay: 0, timeout: skipDelayDuration, children: children }));
|
|
7
8
|
}
|
|
8
|
-
export function Tooltip({ label, shortcut, disabled = false,
|
|
9
|
+
export function Tooltip({ label, shortcut, disabled = false, side = 'right', align, sideOffset = 10, children, }) {
|
|
9
10
|
const scheme = useComponentSize();
|
|
11
|
+
const dir = usePortalDirection();
|
|
10
12
|
// Disabling keeps the trigger mounted, so turning the tooltip on or off never
|
|
11
13
|
// moves focus.
|
|
12
|
-
return (_jsxs(BaseTooltip.Root, { disabled: disabled
|
|
14
|
+
return (_jsxs(BaseTooltip.Root, { disabled: disabled, children: [_jsx(BaseTooltip.Trigger, { render: children }), _jsx(BaseTooltip.Portal, { children: _jsx(BaseTooltip.Positioner, { dir: dir, side: side, align: align, sideOffset: sideOffset, collisionPadding: 8, className: 'surf-positioner surf-tooltip-positioner', children: _jsxs(BaseTooltip.Popup, { className: 'surf-tooltip', "data-ui-size": scheme, children: [label, shortcut && (_jsx("kbd", { className: 'surf-tooltip-shortcut', children: shortcut }))] }) }) })] }));
|
|
13
15
|
}
|
package/dist/tree.d.ts
CHANGED
|
@@ -30,10 +30,8 @@ export type TreeProps = {
|
|
|
30
30
|
size?: ComponentSize;
|
|
31
31
|
virtualized?: boolean;
|
|
32
32
|
labels?: Partial<TreeLabels>;
|
|
33
|
-
/** @deprecated Use `labels.empty`. Removed in a later minor. */
|
|
34
|
-
emptyLabel?: string;
|
|
35
33
|
dir?: 'ltr' | 'rtl';
|
|
36
34
|
className?: string;
|
|
37
35
|
};
|
|
38
36
|
/** Loaded, immutable hierarchy. Remote loading, permission checks and mutations remain caller-owned. */
|
|
39
|
-
export declare function Tree({ nodes, label, expandedIds, defaultExpandedIds, onExpandedIdsChange, selectedIds, defaultSelectedIds, onSelectedIdsChange, selectionMode, height, rowHeight: explicitRowHeight, size, virtualized, labels,
|
|
37
|
+
export declare function Tree({ nodes, label, expandedIds, defaultExpandedIds, onExpandedIdsChange, selectedIds, defaultSelectedIds, onSelectedIdsChange, selectionMode, height, rowHeight: explicitRowHeight, size, virtualized, labels, dir, className, }: TreeProps): React.JSX.Element;
|
package/dist/tree.js
CHANGED
|
@@ -11,7 +11,7 @@ import { ScrollArea } from './scroll-area.js';
|
|
|
11
11
|
import { cx } from './parts.js';
|
|
12
12
|
const normalize = (text) => text.normalize('NFKC').toLocaleLowerCase();
|
|
13
13
|
/** Loaded, immutable hierarchy. Remote loading, permission checks and mutations remain caller-owned. */
|
|
14
|
-
export function Tree({ nodes, label, expandedIds, defaultExpandedIds = [], onExpandedIdsChange, selectedIds, defaultSelectedIds = [], onSelectedIdsChange, selectionMode = 'single', height = 320, rowHeight: explicitRowHeight, size, virtualized = true, labels,
|
|
14
|
+
export function Tree({ nodes, label, expandedIds, defaultExpandedIds = [], onExpandedIdsChange, selectedIds, defaultSelectedIds = [], onSelectedIdsChange, selectionMode = 'single', height = 320, rowHeight: explicitRowHeight, size, virtualized = true, labels, dir, className, }) {
|
|
15
15
|
const scheme = useComponentSize(size);
|
|
16
16
|
const touchFloor = React.useSyncExternalStore((listener) => {
|
|
17
17
|
const query = matchMedia('(max-width: 760px), (pointer: coarse)');
|
|
@@ -313,5 +313,5 @@ export function Tree({ nodes, label, expandedIds, defaultExpandedIds = [], onExp
|
|
|
313
313
|
item.expand();
|
|
314
314
|
}, children: _jsx(Icon, { name: 'chevron-forward', "data-expanded": item.isExpanded() || undefined }) })) : (_jsx("span", { className: 'surf-tree-leaf', "aria-hidden": 'true' })),
|
|
315
315
|
_jsx("span", { className: 'surf-tree-label', children: node.label })));
|
|
316
|
-
}) })) : (_jsx("div", { role: 'status', className: 'surf-tree-empty', children: labels?.empty ??
|
|
316
|
+
}) })) : (_jsx("div", { role: 'status', className: 'surf-tree-empty', children: labels?.empty ?? 'No items.' })) }));
|
|
317
317
|
}
|
package/dist/typography.d.ts
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
export
|
|
2
|
+
export type HeadingVariant = 'display' | 'title' | 'page' | 'section' | 'subsection';
|
|
3
|
+
export declare function Heading({ level, variant, size, className, ...props }: React.HTMLAttributes<HTMLHeadingElement> & {
|
|
3
4
|
level?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
4
|
-
|
|
5
|
+
/** The type role, as Text's variant is: display, title, page, section or
|
|
6
|
+
* subsection. */
|
|
7
|
+
variant?: HeadingVariant;
|
|
8
|
+
/** @deprecated The earlier name for `variant`. `workspace` and `document` are
|
|
9
|
+
* earlier names for `display`. */
|
|
10
|
+
size?: HeadingVariant | 'workspace' | 'document';
|
|
5
11
|
}): React.JSX.Element;
|
|
6
12
|
export declare function Text({ as: Tag, variant, color, weight, className, ...props }: React.HTMLAttributes<HTMLElement> & {
|
|
7
13
|
as?: 'p' | 'span' | 'div';
|
|
8
|
-
|
|
14
|
+
/** `table` is the earlier name for `compact`, deprecated: it renders the same. */
|
|
15
|
+
variant?: 'body' | 'reading' | 'compact' | 'table' | 'caption' | 'label' | 'mono' | 'metric';
|
|
9
16
|
color?: 'primary' | 'secondary' | 'muted';
|
|
10
17
|
weight?: 'regular' | 'medium';
|
|
11
18
|
}): React.JSX.Element;
|
package/dist/typography.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { cx } from './class-names.js';
|
|
3
|
-
export function Heading({ level = 2, size
|
|
3
|
+
export function Heading({ level = 2, variant, size, className, ...props }) {
|
|
4
4
|
const Tag = `h${level}`;
|
|
5
|
-
|
|
5
|
+
// The role stays in data-size, which @surflane/css's heading classes read.
|
|
6
|
+
return (_jsx(Tag, { ...props, className: cx('surf-heading', className), "data-size": variant ?? size ?? 'section' }));
|
|
6
7
|
}
|
|
7
8
|
export function Text({ as: Tag = 'p', variant = 'body', color = 'primary', weight = 'regular', className, ...props }) {
|
|
8
|
-
return (_jsx(Tag, { ...props, className: cx('surf-text', className), "data-variant": variant, "data-color": color, "data-weight": weight }));
|
|
9
|
+
return (_jsx(Tag, { ...props, className: cx('surf-text', className), "data-variant": variant === 'table' ? 'compact' : variant, "data-color": color, "data-weight": weight }));
|
|
9
10
|
}
|
|
10
11
|
export const Prose = function Prose({ className, ref, ...props }) {
|
|
11
12
|
return _jsx("div", { ...props, ref: ref, className: cx('surf-prose', className) });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@surflane/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"description": "Surflane React components built on Base UI, with data, chart, code and Markdown components.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"design-system",
|
|
@@ -90,6 +90,9 @@
|
|
|
90
90
|
"./list.css": "./dist/css/list.css",
|
|
91
91
|
"./stat.css": "./dist/css/stat.css",
|
|
92
92
|
"./sparkline.css": "./dist/css/sparkline.css",
|
|
93
|
+
"./bar-list.css": "./dist/css/bar-list.css",
|
|
94
|
+
"./dashboard.css": "./dist/css/dashboard.css",
|
|
95
|
+
"./time-range-picker.css": "./dist/css/time-range-picker.css",
|
|
93
96
|
"./tree.css": "./dist/css/tree.css",
|
|
94
97
|
"./chart.css": "./dist/css/chart.css",
|
|
95
98
|
"./scroll-area.css": "./dist/css/scroll-area.css",
|
|
@@ -316,6 +319,18 @@
|
|
|
316
319
|
"types": "./dist/sparkline.d.ts",
|
|
317
320
|
"import": "./dist/sparkline.js"
|
|
318
321
|
},
|
|
322
|
+
"./bar-list": {
|
|
323
|
+
"types": "./dist/bar-list.d.ts",
|
|
324
|
+
"import": "./dist/bar-list.js"
|
|
325
|
+
},
|
|
326
|
+
"./dashboard": {
|
|
327
|
+
"types": "./dist/dashboard.d.ts",
|
|
328
|
+
"import": "./dist/dashboard.js"
|
|
329
|
+
},
|
|
330
|
+
"./time-range-picker": {
|
|
331
|
+
"types": "./dist/time-range-picker.d.ts",
|
|
332
|
+
"import": "./dist/time-range-picker.js"
|
|
333
|
+
},
|
|
319
334
|
"./tree": {
|
|
320
335
|
"types": "./dist/tree.d.ts",
|
|
321
336
|
"import": "./dist/tree.js"
|
|
@@ -406,8 +421,8 @@
|
|
|
406
421
|
"@base-ui/react": "^1.9.0",
|
|
407
422
|
"@headless-tree/core": "^1.8.0",
|
|
408
423
|
"@headless-tree/react": "^1.8.0",
|
|
409
|
-
"@surflane/css": "^0.
|
|
410
|
-
"@surflane/design-tokens": "^0.
|
|
424
|
+
"@surflane/css": "^0.13.0",
|
|
425
|
+
"@surflane/design-tokens": "^0.13.0",
|
|
411
426
|
"@tanstack/react-virtual": "^3.14.21",
|
|
412
427
|
"react": "^19.0.0",
|
|
413
428
|
"react-aria-components": "^1.22.1",
|