@surflane/ui 0.2.0 → 0.4.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/README.md +17 -7
- package/dist/advanced-forms.js +24 -24
- package/dist/app-shell.d.ts +2 -1
- package/dist/app-shell.js +25 -9
- package/dist/avatar.d.ts +24 -0
- package/dist/avatar.js +26 -0
- package/dist/button.js +3 -3
- package/dist/chart.js +6 -3
- package/dist/chevron.d.ts +3 -0
- package/dist/chevron.js +6 -0
- package/dist/commands.js +9 -9
- package/dist/content.js +11 -8
- package/dist/context-overlays.js +6 -6
- package/dist/data.d.ts +57 -12
- package/dist/data.js +60 -18
- package/dist/dialog.js +8 -7
- package/dist/disclosure.d.ts +42 -0
- package/dist/disclosure.js +41 -0
- package/dist/feedback.js +14 -14
- package/dist/file-upload.js +1 -1
- package/dist/filter-bar.js +5 -5
- package/dist/forms.js +17 -17
- package/dist/foundations.js +7 -7
- package/dist/icon.d.ts +1 -0
- package/dist/icon.js +5 -2
- package/dist/index.d.ts +7 -7
- package/dist/index.js +10 -7
- package/dist/input-extensions.js +11 -11
- package/dist/input.js +1 -1
- package/dist/markdown.js +3 -2
- package/dist/menu.js +14 -14
- package/dist/messages.js +11 -11
- package/dist/navigation-menu.js +9 -9
- package/dist/navigation.d.ts +1 -91
- package/dist/navigation.js +8 -75
- package/dist/otp-field.js +4 -4
- package/dist/pagination.js +1 -1
- package/dist/panels.js +12 -11
- package/dist/parts.d.ts +3 -0
- package/dist/parts.js +8 -1
- package/dist/popover.js +2 -2
- package/dist/scroll-area.js +1 -1
- package/dist/select.js +3 -2
- package/dist/sizing.js +1 -1
- package/dist/status.js +2 -2
- package/dist/syntax-context.d.ts +7 -0
- package/dist/syntax-context.js +4 -0
- package/dist/syntax-highlighter.d.ts +4 -1
- package/dist/syntax-highlighter.js +11 -5
- package/dist/syntax-highlighting.d.ts +8 -0
- package/dist/syntax-highlighting.js +12 -0
- package/dist/table-selection.d.ts +31 -0
- package/dist/table-selection.js +50 -0
- package/dist/tabs.d.ts +29 -0
- package/dist/tabs.js +13 -0
- package/dist/toast.js +14 -14
- package/package.json +57 -8
- package/src/all.css +8 -0
- package/src/styles.css +3579 -3598
package/dist/select.js
CHANGED
|
@@ -3,6 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { useComponentSize } from './sizing.js';
|
|
5
5
|
import { Select as BaseSelect } from '@base-ui/react/select';
|
|
6
|
+
import { sizeName } from './parts.js';
|
|
6
7
|
const cx = (...v) => v.filter(Boolean).join(' ');
|
|
7
8
|
function Chevron() {
|
|
8
9
|
return (_jsx("svg", { width: '16', height: '16', viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', strokeWidth: '1.7', "aria-hidden": 'true', children: _jsx("path", { d: 'm7 10 5 5 5-5' }) }));
|
|
@@ -40,7 +41,7 @@ export function Select({ options, value, defaultValue, onValueChange, className,
|
|
|
40
41
|
}, [initialValue, props.form]);
|
|
41
42
|
const selected = value ?? localValue;
|
|
42
43
|
const { name, form, required, disabled, id, ...aria } = props;
|
|
43
|
-
return (_jsx("span", { className: cx('pui-select control-shell select-control', className), "data-size": size, "data-ui-size": scheme, "data-disabled": disabled || undefined, children: _jsxs(BaseSelect.Root, { items: options, value: selected, onValueChange: (v) => {
|
|
44
|
+
return (_jsx("span", { className: cx('pui-select control-shell select-control', className), "data-size": sizeName(size), "data-ui-size": scheme, "data-disabled": disabled || undefined, children: _jsxs(BaseSelect.Root, { items: options, value: selected, onValueChange: (v) => {
|
|
44
45
|
setLocalValue(v ?? '');
|
|
45
46
|
onValueChange?.(v ?? '');
|
|
46
47
|
}, inputRef: (node) => {
|
|
@@ -70,7 +71,7 @@ function optionList(children) {
|
|
|
70
71
|
});
|
|
71
72
|
}
|
|
72
73
|
/** Transitional HTML-option adapter. Submitted values use Base UI's native hidden input. */
|
|
73
|
-
export const NativeSelect = React.forwardRef(function NativeSelect({ children, onChange, value, defaultValue, className, size, ...props }, ref) {
|
|
74
|
+
export const NativeSelect = /* @__PURE__ */ React.forwardRef(function NativeSelect({ children, onChange, value, defaultValue, className, size, ...props }, ref) {
|
|
74
75
|
const input = React.useRef(null);
|
|
75
76
|
const options = optionList(children);
|
|
76
77
|
return (_jsx(Select, { options: options, value: value === undefined ? undefined : String(value), defaultValue: defaultValue === undefined ? undefined : String(defaultValue), className: className, size: size, inputRef: input, triggerRef: ref, name: props.name, form: props.form, disabled: props.disabled, required: props.required, id: props.id, "aria-label": props['aria-label'], "aria-labelledby": props['aria-labelledby'], "aria-describedby": props['aria-describedby'], "aria-invalid": props['aria-invalid'], onValueChange: (next) => {
|
package/dist/sizing.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import * as React from 'react';
|
|
4
|
-
export const ComponentSizeContext = React.createContext(undefined);
|
|
4
|
+
export const ComponentSizeContext = /* @__PURE__ */ React.createContext(undefined);
|
|
5
5
|
export function normalizeSize(size) {
|
|
6
6
|
return size === 'sm'
|
|
7
7
|
? 'small'
|
package/dist/status.js
CHANGED
|
@@ -3,7 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { useComponentSize } from './sizing.js';
|
|
5
5
|
import { useToneTransition } from './tone-transition.js';
|
|
6
|
-
export const Badge = React.forwardRef(function Badge({ tone = 'neutral', icon, children, className, size, ...props }, ref) {
|
|
6
|
+
export const Badge = /* @__PURE__ */ React.forwardRef(function Badge({ tone = 'neutral', icon, children, className, size, ...props }, ref) {
|
|
7
7
|
const scheme = useComponentSize(size);
|
|
8
8
|
const elementRef = useToneTransition(tone, ref);
|
|
9
9
|
return (_jsxs("span", { ...props, ref: elementRef, className: ['pui-badge', className].filter(Boolean).join(' '), "data-tone": tone, "data-ui-size": scheme, children: [icon && (_jsx("span", { className: 'pui-badge-icon', "aria-hidden": 'true', children: icon })), children] }));
|
|
@@ -12,6 +12,6 @@ export function StatusIcon({ tone }) {
|
|
|
12
12
|
return (_jsx("svg", { width: '13', height: '13', viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', strokeWidth: '1.7', "aria-hidden": 'true', children: tone === 'success' ? (_jsx("path", { d: 'm5 12 4 4L19 6' })) : tone === 'caution' ? (_jsxs(_Fragment, { children: [_jsx("path", { d: 'm12 3 10 18H2L12 3Z' }), _jsx("path", { d: 'M12 9v4m0 3v1' })] })) : tone === 'danger' ? (_jsxs(_Fragment, { children: [_jsx("circle", { cx: '12', cy: '12', r: '9' }), _jsx("path", { d: 'M12 7v6m0 3v1' })] })) : tone === 'progress' ? (_jsxs(_Fragment, { children: [_jsx("circle", { cx: '12', cy: '12', r: '9' }), _jsx("path", { d: 'M12 7v6l4 2' })] })) : (_jsxs(_Fragment, { children: [_jsx("circle", { cx: '12', cy: '12', r: '9' }), _jsx("path", { d: 'M8 12h8' })] })) }));
|
|
13
13
|
}
|
|
14
14
|
/** Domain status labels and live announcements remain the caller's responsibility. */
|
|
15
|
-
export const StatusBadge = React.forwardRef(function StatusBadge({ tone = 'neutral', icon, ...props }, ref) {
|
|
15
|
+
export const StatusBadge = /* @__PURE__ */ React.forwardRef(function StatusBadge({ tone = 'neutral', icon, ...props }, ref) {
|
|
16
16
|
return (_jsx(Badge, { ...props, ref: ref, tone: tone, icon: icon === undefined ? _jsx(StatusIcon, { tone: tone }) : icon }));
|
|
17
17
|
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { SyntaxToken } from './syntax-engine.js';
|
|
3
|
+
export type SyntaxEngine = {
|
|
4
|
+
highlightCode(code: string, language: string): Promise<SyntaxToken[][] | null>;
|
|
5
|
+
};
|
|
6
|
+
/** Loads the highlighting engine. Without a provider, code renders as plain text. */
|
|
7
|
+
export declare const SyntaxEngineContext: React.Context<(() => Promise<SyntaxEngine>) | null>;
|
|
@@ -7,7 +7,10 @@ export type SyntaxHighlighterProps = Omit<React.ComponentPropsWithoutRef<'code'>
|
|
|
7
7
|
label?: string;
|
|
8
8
|
wrap?: boolean;
|
|
9
9
|
};
|
|
10
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* Rendering remains selectable React text; it never inserts executable HTML. Tokens are
|
|
12
|
+
* colored inside a SyntaxHighlighting provider; without one, the code renders plain.
|
|
13
|
+
*/
|
|
11
14
|
export declare const SyntaxHighlighter: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>, "ref">, "children"> & {
|
|
12
15
|
code: string;
|
|
13
16
|
language?: string;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { ScrollArea } from './scroll-area.js';
|
|
5
|
+
import { SyntaxEngineContext } from './syntax-context.js';
|
|
5
6
|
export const syntaxLanguages = [
|
|
6
7
|
'tsx',
|
|
7
8
|
'jsx',
|
|
@@ -29,18 +30,23 @@ const aliases = {
|
|
|
29
30
|
plaintext: 'text',
|
|
30
31
|
txt: 'text',
|
|
31
32
|
};
|
|
32
|
-
/**
|
|
33
|
-
|
|
33
|
+
/**
|
|
34
|
+
* Rendering remains selectable React text; it never inserts executable HTML. Tokens are
|
|
35
|
+
* colored inside a SyntaxHighlighting provider; without one, the code renders plain.
|
|
36
|
+
*/
|
|
37
|
+
export const SyntaxHighlighter = /* @__PURE__ */ React.forwardRef(function SyntaxHighlighter({ code, language = 'text', inline = false, label = 'Highlighted source', wrap = false, className, ...props }, ref) {
|
|
38
|
+
const load = React.useContext(SyntaxEngineContext);
|
|
34
39
|
const name = language.trim().toLowerCase();
|
|
35
40
|
const lang = aliases[name] ?? name;
|
|
36
41
|
const [result, setResult] = React.useState();
|
|
37
42
|
React.useEffect(() => {
|
|
38
43
|
let current = true;
|
|
39
|
-
if (
|
|
44
|
+
if (!load ||
|
|
45
|
+
lang === 'text' ||
|
|
40
46
|
!syntaxLanguages.includes(lang) ||
|
|
41
47
|
code.length > 50000)
|
|
42
48
|
return;
|
|
43
|
-
|
|
49
|
+
load()
|
|
44
50
|
.then((engine) => engine.highlightCode(code, lang))
|
|
45
51
|
.then((tokens) => {
|
|
46
52
|
if (current)
|
|
@@ -53,7 +59,7 @@ export const SyntaxHighlighter = React.forwardRef(function SyntaxHighlighter({ c
|
|
|
53
59
|
return () => {
|
|
54
60
|
current = false;
|
|
55
61
|
};
|
|
56
|
-
}, [code, lang]);
|
|
62
|
+
}, [code, lang, load]);
|
|
57
63
|
const tokens = result?.code === code && result.language === lang ? result.tokens : null;
|
|
58
64
|
const eols = code.match(/\r\n|\n|\r/g) ?? [];
|
|
59
65
|
const valid = tokens && tokens.length === eols.length + 1;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Turns on syntax highlighting for CodeBlock, SyntaxHighlighter and Markdown inside it.
|
|
4
|
+
* Requires the optional `shiki` package; without this provider, code renders as plain text.
|
|
5
|
+
*/
|
|
6
|
+
export declare function SyntaxHighlighting({ children, }: {
|
|
7
|
+
children?: React.ReactNode;
|
|
8
|
+
}): React.JSX.Element;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { SyntaxEngineContext } from './syntax-context.js';
|
|
4
|
+
// The engine and each grammar load on first use, in their own chunks.
|
|
5
|
+
const load = () => import('./syntax-engine.js');
|
|
6
|
+
/**
|
|
7
|
+
* Turns on syntax highlighting for CodeBlock, SyntaxHighlighter and Markdown inside it.
|
|
8
|
+
* Requires the optional `shiki` package; without this provider, code renders as plain text.
|
|
9
|
+
*/
|
|
10
|
+
export function SyntaxHighlighting({ children, }) {
|
|
11
|
+
return (_jsx(SyntaxEngineContext.Provider, { value: load, children: children }));
|
|
12
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export type TableSelectionOptions<Row> = {
|
|
2
|
+
/** Rows on the current page, in display order. */
|
|
3
|
+
rows: readonly Row[];
|
|
4
|
+
getId: (row: Row) => string;
|
|
5
|
+
/** Rows that fail stay unselectable, such as read-only resources. */
|
|
6
|
+
canSelect?: (row: Row) => boolean;
|
|
7
|
+
selected?: readonly string[];
|
|
8
|
+
defaultSelected?: readonly string[];
|
|
9
|
+
onSelectedChange?: (selected: string[]) => void;
|
|
10
|
+
};
|
|
11
|
+
export type TableSelectionCheckbox = {
|
|
12
|
+
checked: boolean;
|
|
13
|
+
indeterminate?: boolean;
|
|
14
|
+
disabled: boolean;
|
|
15
|
+
onCheckedChange: (checked: boolean) => void;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Row selection by stable ID that survives paging, sorting and filtering.
|
|
19
|
+
* The page checkbox covers only the selectable rows on the current page;
|
|
20
|
+
* hiddenCount reports selections the reader cannot see.
|
|
21
|
+
*/
|
|
22
|
+
export declare function useTableSelection<Row>({ rows, getId, canSelect, selected: controlled, defaultSelected, onSelectedChange, }: TableSelectionOptions<Row>): {
|
|
23
|
+
selected: readonly string[];
|
|
24
|
+
isSelected: (id: string) => boolean;
|
|
25
|
+
toggle: (id: string, checked: boolean) => void;
|
|
26
|
+
clear: () => void;
|
|
27
|
+
/** Selected rows that are not on the current page. */
|
|
28
|
+
hiddenCount: number;
|
|
29
|
+
pageCheckbox: TableSelectionCheckbox;
|
|
30
|
+
rowCheckbox: (row: Row) => TableSelectionCheckbox;
|
|
31
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* Row selection by stable ID that survives paging, sorting and filtering.
|
|
5
|
+
* The page checkbox covers only the selectable rows on the current page;
|
|
6
|
+
* hiddenCount reports selections the reader cannot see.
|
|
7
|
+
*/
|
|
8
|
+
export function useTableSelection({ rows, getId, canSelect = () => true, selected: controlled, defaultSelected = [], onSelectedChange, }) {
|
|
9
|
+
const [uncontrolled, setUncontrolled] = React.useState(defaultSelected);
|
|
10
|
+
const selected = controlled ?? uncontrolled;
|
|
11
|
+
const update = (next) => {
|
|
12
|
+
if (controlled === undefined)
|
|
13
|
+
setUncontrolled(next);
|
|
14
|
+
onSelectedChange?.(next);
|
|
15
|
+
};
|
|
16
|
+
const chosen = new Set(selected);
|
|
17
|
+
const onPage = new Set(rows.map(getId));
|
|
18
|
+
const selectable = rows.filter(canSelect).map(getId);
|
|
19
|
+
const pageChosen = selectable.filter((id) => chosen.has(id)).length;
|
|
20
|
+
const toggle = (id, checked) => update(checked
|
|
21
|
+
? chosen.has(id)
|
|
22
|
+
? [...selected]
|
|
23
|
+
: [...selected, id]
|
|
24
|
+
: selected.filter((other) => other !== id));
|
|
25
|
+
const pageCheckbox = {
|
|
26
|
+
checked: selectable.length > 0 && pageChosen === selectable.length,
|
|
27
|
+
indeterminate: pageChosen > 0 && pageChosen < selectable.length,
|
|
28
|
+
disabled: selectable.length === 0,
|
|
29
|
+
onCheckedChange: (checked) => update(checked
|
|
30
|
+
? [...new Set([...selected, ...selectable])]
|
|
31
|
+
: selected.filter((id) => !selectable.includes(id))),
|
|
32
|
+
};
|
|
33
|
+
return {
|
|
34
|
+
selected: selected,
|
|
35
|
+
isSelected: (id) => chosen.has(id),
|
|
36
|
+
toggle,
|
|
37
|
+
clear: () => update([]),
|
|
38
|
+
/** Selected rows that are not on the current page. */
|
|
39
|
+
hiddenCount: selected.filter((id) => !onPage.has(id)).length,
|
|
40
|
+
pageCheckbox,
|
|
41
|
+
rowCheckbox: (row) => {
|
|
42
|
+
const id = getId(row);
|
|
43
|
+
return {
|
|
44
|
+
checked: chosen.has(id),
|
|
45
|
+
disabled: !canSelect(row),
|
|
46
|
+
onCheckedChange: (checked) => toggle(id, checked),
|
|
47
|
+
};
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
}
|
package/dist/tabs.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export declare const Tabs: {
|
|
3
|
+
Root: React.ForwardRefExoticComponent<Omit<Omit<Omit<import("@base-ui/react/tabs").TabsRootProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref">, "size"> & {
|
|
4
|
+
size?: import("./sizing.js").ComponentSize;
|
|
5
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
6
|
+
List: React.ForwardRefExoticComponent<Omit<Omit<Omit<import("@base-ui/react/tabs").TabsListProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref">, "size"> & {
|
|
7
|
+
size?: import("./sizing.js").ComponentSize;
|
|
8
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
9
|
+
Tab: React.ForwardRefExoticComponent<Omit<Omit<Omit<import("@base-ui/react/tabs").TabsTabProps, "ref"> & React.RefAttributes<HTMLElement>, "ref">, "size"> & {
|
|
10
|
+
size?: import("./sizing.js").ComponentSize;
|
|
11
|
+
} & React.RefAttributes<HTMLElement>>;
|
|
12
|
+
Panel: React.ForwardRefExoticComponent<Omit<Omit<Omit<import("@base-ui/react/tabs").TabsPanelProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref">, "size"> & {
|
|
13
|
+
size?: import("./sizing.js").ComponentSize;
|
|
14
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
15
|
+
Indicator: React.ForwardRefExoticComponent<Omit<Omit<Omit<import("@base-ui/react/tabs").TabsIndicatorProps, "ref"> & React.RefAttributes<HTMLSpanElement>, "ref">, "size"> & {
|
|
16
|
+
size?: import("./sizing.js").ComponentSize;
|
|
17
|
+
} & React.RefAttributes<HTMLSpanElement>>;
|
|
18
|
+
};
|
|
19
|
+
export declare const TabsIndicator: React.ForwardRefExoticComponent<Omit<Omit<Omit<import("@base-ui/react/tabs").TabsIndicatorProps, "ref"> & React.RefAttributes<HTMLSpanElement>, "ref">, "size"> & {
|
|
20
|
+
size?: import("./sizing.js").ComponentSize;
|
|
21
|
+
} & React.RefAttributes<HTMLSpanElement>>, TabsList: React.ForwardRefExoticComponent<Omit<Omit<Omit<import("@base-ui/react/tabs").TabsListProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref">, "size"> & {
|
|
22
|
+
size?: import("./sizing.js").ComponentSize;
|
|
23
|
+
} & React.RefAttributes<HTMLDivElement>>, TabsPanel: React.ForwardRefExoticComponent<Omit<Omit<Omit<import("@base-ui/react/tabs").TabsPanelProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref">, "size"> & {
|
|
24
|
+
size?: import("./sizing.js").ComponentSize;
|
|
25
|
+
} & React.RefAttributes<HTMLDivElement>>, TabsRoot: React.ForwardRefExoticComponent<Omit<Omit<Omit<import("@base-ui/react/tabs").TabsRootProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref">, "size"> & {
|
|
26
|
+
size?: import("./sizing.js").ComponentSize;
|
|
27
|
+
} & React.RefAttributes<HTMLDivElement>>, TabsTab: React.ForwardRefExoticComponent<Omit<Omit<Omit<import("@base-ui/react/tabs").TabsTabProps, "ref"> & React.RefAttributes<HTMLElement>, "ref">, "size"> & {
|
|
28
|
+
size?: import("./sizing.js").ComponentSize;
|
|
29
|
+
} & React.RefAttributes<HTMLElement>>;
|
package/dist/tabs.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { Tabs as BaseTabs } from '@base-ui/react/tabs';
|
|
3
|
+
import { part } from './parts.js';
|
|
4
|
+
export const Tabs = {
|
|
5
|
+
...BaseTabs,
|
|
6
|
+
Root: /* @__PURE__ */ part(BaseTabs.Root, 'pui-tabs'),
|
|
7
|
+
List: /* @__PURE__ */ part(BaseTabs.List, 'pui-tabs-list'),
|
|
8
|
+
Tab: /* @__PURE__ */ part(BaseTabs.Tab, 'pui-tabs-tab'),
|
|
9
|
+
Panel: /* @__PURE__ */ part(BaseTabs.Panel, 'pui-tabs-panel'),
|
|
10
|
+
Indicator: /* @__PURE__ */ part(BaseTabs.Indicator, 'pui-tabs-indicator'),
|
|
11
|
+
};
|
|
12
|
+
// Flat names for React Server Components, which cannot dot into client exports.
|
|
13
|
+
export const { Indicator: TabsIndicator, List: TabsList, Panel: TabsPanel, Root: TabsRoot, Tab: TabsTab, } = Tabs;
|
package/dist/toast.js
CHANGED
|
@@ -5,21 +5,21 @@ import { useComponentSize } from './sizing.js';
|
|
|
5
5
|
import { Toast as BaseToast } from '@base-ui/react/toast';
|
|
6
6
|
import { part, skin } from './parts.js';
|
|
7
7
|
import { StatusIcon } from './status.js';
|
|
8
|
-
const ToneContext = React.createContext('neutral');
|
|
9
|
-
const Root = React.forwardRef(function Root({ tone = 'neutral', className, ...props }, ref) {
|
|
8
|
+
const ToneContext = /* @__PURE__ */ React.createContext('neutral');
|
|
9
|
+
const Root = /* @__PURE__ */ React.forwardRef(function Root({ tone = 'neutral', className, ...props }, ref) {
|
|
10
10
|
return (_jsx(ToneContext.Provider, { value: tone, children: _jsx(BaseToast.Root, { ...props, ref: ref, "data-tone": tone, className: skin('pui-toast', className) }) }));
|
|
11
11
|
});
|
|
12
|
-
const Icon = React.forwardRef(function Icon({ tone, children, className, ...props }, ref) {
|
|
12
|
+
const Icon = /* @__PURE__ */ React.forwardRef(function Icon({ tone, children, className, ...props }, ref) {
|
|
13
13
|
const inherited = React.useContext(ToneContext);
|
|
14
14
|
return (_jsx("span", { ...props, ref: ref, "aria-hidden": 'true', className: ['pui-toast-icon', className].filter(Boolean).join(' '), children: children ?? _jsx(StatusIcon, { tone: tone ?? inherited }) }));
|
|
15
15
|
});
|
|
16
|
-
const Close = React.forwardRef(function Close({ className, children, ...props }, ref) {
|
|
17
|
-
return (_jsx(BaseToast.Close, { "aria-label": 'Dismiss notification', "aria-hidden": false, "data-variant": 'ghost', "data-size": 'icon', ...props, ref: ref, className: skin('pui-button pui-toast-close', className), children: children ?? (_jsx("svg", { width: '16', height: '16', viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', strokeWidth: '1.6', "aria-hidden": 'true', children: _jsx("path", { d: 'm6 6 12 12M18 6 6 18' }) })) }));
|
|
16
|
+
const Close = /* @__PURE__ */ React.forwardRef(function Close({ className, children, ...props }, ref) {
|
|
17
|
+
return (_jsx(BaseToast.Close, { "aria-label": 'Dismiss notification', "aria-hidden": false, "data-variant": 'ghost', "data-size": 'icon-sm', "data-ui-size": 'small', ...props, ref: ref, className: skin('pui-button pui-toast-close', className), children: children ?? (_jsx("svg", { width: '16', height: '16', viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', strokeWidth: '1.6', "aria-hidden": 'true', children: _jsx("path", { d: 'm6 6 12 12M18 6 6 18' }) })) }));
|
|
18
18
|
});
|
|
19
|
-
const Action = React.forwardRef(function Action({ className, ...props }, ref) {
|
|
20
|
-
return (_jsx(BaseToast.Action, { "data-variant": 'outline', "data-size": '
|
|
19
|
+
const Action = /* @__PURE__ */ React.forwardRef(function Action({ className, ...props }, ref) {
|
|
20
|
+
return (_jsx(BaseToast.Action, { "data-variant": 'outline', "data-size": 'small', "data-ui-size": 'small', ...props, ref: ref, className: skin('pui-button pui-toast-action', className) }));
|
|
21
21
|
});
|
|
22
|
-
const Viewport = React.forwardRef(function Viewport({ layout = 'stack', className, ...props }, ref) {
|
|
22
|
+
const Viewport = /* @__PURE__ */ React.forwardRef(function Viewport({ layout = 'stack', className, ...props }, ref) {
|
|
23
23
|
const viewportRef = React.useRef(null);
|
|
24
24
|
React.useLayoutEffect(() => {
|
|
25
25
|
const viewport = viewportRef.current;
|
|
@@ -31,7 +31,7 @@ const Viewport = React.forwardRef(function Viewport({ layout = 'stack', classNam
|
|
|
31
31
|
const gap = parseFloat(getComputedStyle(viewport).rowGap) || 0;
|
|
32
32
|
const height = cards.reduce((sum, card) => {
|
|
33
33
|
const natural = parseFloat(getComputedStyle(card).getPropertyValue('--toast-height'));
|
|
34
|
-
return
|
|
34
|
+
return sum + (Number.isFinite(natural) ? natural : card.offsetHeight);
|
|
35
35
|
}, 0) +
|
|
36
36
|
Math.max(0, cards.length - 1) * gap;
|
|
37
37
|
const wasOverflow = viewport.hasAttribute('data-stack-overflow');
|
|
@@ -89,11 +89,11 @@ export const Toast = {
|
|
|
89
89
|
Close,
|
|
90
90
|
Action,
|
|
91
91
|
Viewport,
|
|
92
|
-
Content: part(BaseToast.Content, 'pui-toast-content'),
|
|
93
|
-
Title: part(BaseToast.Title, 'pui-toast-title'),
|
|
94
|
-
Description: part(BaseToast.Description, 'pui-toast-description'),
|
|
95
|
-
Text: part('div', 'pui-toast-text'),
|
|
96
|
-
Positioner: part(BaseToast.Positioner, 'pui-positioner'),
|
|
92
|
+
Content: /* @__PURE__ */ part(BaseToast.Content, 'pui-toast-content'),
|
|
93
|
+
Title: /* @__PURE__ */ part(BaseToast.Title, 'pui-toast-title'),
|
|
94
|
+
Description: /* @__PURE__ */ part(BaseToast.Description, 'pui-toast-description'),
|
|
95
|
+
Text: /* @__PURE__ */ part('div', 'pui-toast-text'),
|
|
96
|
+
Positioner: /* @__PURE__ */ part(BaseToast.Positioner, 'pui-positioner'),
|
|
97
97
|
};
|
|
98
98
|
// Flat names for React Server Components, which cannot dot into client exports.
|
|
99
99
|
export const { Action: ToastAction, Arrow: ToastArrow, Close: ToastClose, Content: ToastContent, Description: ToastDescription, Portal: ToastPortal, Positioner: ToastPositioner, Provider: ToastProvider, Root: ToastRoot, Title: ToastTitle, Viewport: ToastViewport, Icon: ToastIcon, Text: ToastText, } = Toast;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@surflane/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.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",
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
"files": [
|
|
30
30
|
"dist",
|
|
31
31
|
"src/styles.css",
|
|
32
|
+
"src/all.css",
|
|
32
33
|
"LICENSE-MIT",
|
|
33
34
|
"LICENSE-APACHE"
|
|
34
35
|
],
|
|
@@ -38,6 +39,7 @@
|
|
|
38
39
|
"import": "./dist/index.js"
|
|
39
40
|
},
|
|
40
41
|
"./styles.css": "./src/styles.css",
|
|
42
|
+
"./all.css": "./src/all.css",
|
|
41
43
|
"./button": {
|
|
42
44
|
"types": "./dist/button.d.ts",
|
|
43
45
|
"import": "./dist/button.js"
|
|
@@ -74,6 +76,14 @@
|
|
|
74
76
|
"types": "./dist/chart.d.ts",
|
|
75
77
|
"import": "./dist/chart.js"
|
|
76
78
|
},
|
|
79
|
+
"./date-picker": {
|
|
80
|
+
"types": "./dist/date-picker.d.ts",
|
|
81
|
+
"import": "./dist/date-picker.js"
|
|
82
|
+
},
|
|
83
|
+
"./tree": {
|
|
84
|
+
"types": "./dist/tree.d.ts",
|
|
85
|
+
"import": "./dist/tree.js"
|
|
86
|
+
},
|
|
77
87
|
"./markdown": {
|
|
78
88
|
"types": "./dist/markdown.d.ts",
|
|
79
89
|
"import": "./dist/markdown.js"
|
|
@@ -82,6 +92,10 @@
|
|
|
82
92
|
"types": "./dist/syntax-highlighter.d.ts",
|
|
83
93
|
"import": "./dist/syntax-highlighter.js"
|
|
84
94
|
},
|
|
95
|
+
"./syntax-highlighting": {
|
|
96
|
+
"types": "./dist/syntax-highlighting.d.ts",
|
|
97
|
+
"import": "./dist/syntax-highlighting.js"
|
|
98
|
+
},
|
|
85
99
|
"./package.json": "./package.json"
|
|
86
100
|
},
|
|
87
101
|
"scripts": {
|
|
@@ -89,10 +103,50 @@
|
|
|
89
103
|
"prepack": "npm run build"
|
|
90
104
|
},
|
|
91
105
|
"dependencies": {
|
|
92
|
-
"@base-ui/react": "1.9.0"
|
|
106
|
+
"@base-ui/react": "1.9.0"
|
|
107
|
+
},
|
|
108
|
+
"peerDependencies": {
|
|
109
|
+
"@headless-tree/core": "^1.8.0",
|
|
110
|
+
"@headless-tree/react": "^1.8.0",
|
|
111
|
+
"@surflane/design-tokens": "^0.4.0",
|
|
112
|
+
"@tanstack/react-virtual": "^3.14.21",
|
|
113
|
+
"react": "^19.0.0",
|
|
114
|
+
"react-aria-components": "^1.22.1",
|
|
115
|
+
"react-dom": "^19.0.0",
|
|
116
|
+
"react-markdown": "^10.1.0",
|
|
117
|
+
"recharts": "^3.10.1",
|
|
118
|
+
"remark-gfm": "^4.0.1",
|
|
119
|
+
"shiki": "^4.5.0"
|
|
120
|
+
},
|
|
121
|
+
"peerDependenciesMeta": {
|
|
122
|
+
"@headless-tree/core": {
|
|
123
|
+
"optional": true
|
|
124
|
+
},
|
|
125
|
+
"@headless-tree/react": {
|
|
126
|
+
"optional": true
|
|
127
|
+
},
|
|
128
|
+
"@tanstack/react-virtual": {
|
|
129
|
+
"optional": true
|
|
130
|
+
},
|
|
131
|
+
"react-aria-components": {
|
|
132
|
+
"optional": true
|
|
133
|
+
},
|
|
134
|
+
"react-markdown": {
|
|
135
|
+
"optional": true
|
|
136
|
+
},
|
|
137
|
+
"recharts": {
|
|
138
|
+
"optional": true
|
|
139
|
+
},
|
|
140
|
+
"remark-gfm": {
|
|
141
|
+
"optional": true
|
|
142
|
+
},
|
|
143
|
+
"shiki": {
|
|
144
|
+
"optional": true
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
"devDependencies": {
|
|
93
148
|
"@headless-tree/core": "1.8.0",
|
|
94
149
|
"@headless-tree/react": "1.8.0",
|
|
95
|
-
"@internationalized/date": "3.12.4",
|
|
96
150
|
"@tanstack/react-virtual": "3.14.21",
|
|
97
151
|
"react-aria-components": "1.22.1",
|
|
98
152
|
"react-markdown": "10.1.0",
|
|
@@ -100,11 +154,6 @@
|
|
|
100
154
|
"remark-gfm": "4.0.1",
|
|
101
155
|
"shiki": "4.5.0"
|
|
102
156
|
},
|
|
103
|
-
"peerDependencies": {
|
|
104
|
-
"@surflane/design-tokens": "^0.2.0",
|
|
105
|
-
"react": "^19.0.0",
|
|
106
|
-
"react-dom": "^19.0.0"
|
|
107
|
-
},
|
|
108
157
|
"publishConfig": {
|
|
109
158
|
"access": "public"
|
|
110
159
|
}
|
package/src/all.css
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/* Every Surflane stylesheet in one import, in the recommended order: tokens, controls,
|
|
2
|
+
* composition, document typography and components. Each file keeps its cascade layer. */
|
|
3
|
+
@layer surflane.tokens, surflane.themes, surflane.base, surflane.components;
|
|
4
|
+
@import '@surflane/design-tokens/tokens.css';
|
|
5
|
+
@import '@surflane/design-tokens/controls.css';
|
|
6
|
+
@import '@surflane/design-tokens/foundations.css';
|
|
7
|
+
@import '@surflane/design-tokens/typography.css';
|
|
8
|
+
@import './styles.css';
|