@surflane/ui 0.1.0 → 0.3.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 +8 -8
- package/dist/advanced-forms.d.ts +2 -2
- package/dist/advanced-forms.js +39 -39
- package/dist/app-shell.d.ts +3 -2
- package/dist/app-shell.js +29 -13
- package/dist/button.d.ts +5 -5
- package/dist/button.js +12 -12
- package/dist/chart.d.ts +3 -3
- package/dist/chart.js +36 -34
- package/dist/commands.d.ts +5 -5
- package/dist/commands.js +17 -17
- package/dist/content.d.ts +2 -2
- package/dist/content.js +66 -28
- package/dist/context-overlays.d.ts +3 -3
- package/dist/context-overlays.js +11 -11
- package/dist/data.d.ts +58 -13
- package/dist/data.js +63 -21
- package/dist/date-picker.d.ts +8 -8
- package/dist/date-picker.js +18 -18
- package/dist/dialog-focus.js +7 -7
- package/dist/dialog.d.ts +5 -5
- package/dist/dialog.js +16 -16
- package/dist/feedback.d.ts +5 -5
- package/dist/feedback.js +20 -20
- package/dist/file-upload.d.ts +9 -9
- package/dist/file-upload.js +64 -63
- package/dist/filter-bar.d.ts +1 -1
- package/dist/filter-bar.js +9 -9
- package/dist/form-state.d.ts +1 -1
- package/dist/form-state.js +11 -11
- package/dist/forms.d.ts +5 -5
- package/dist/forms.js +32 -32
- package/dist/foundations.d.ts +10 -10
- package/dist/foundations.js +26 -26
- package/dist/icon.d.ts +8 -7
- package/dist/icon.js +23 -22
- package/dist/index.d.ts +38 -37
- package/dist/index.js +39 -38
- package/dist/input-extensions.d.ts +3 -3
- package/dist/input-extensions.js +21 -21
- package/dist/input.d.ts +2 -2
- package/dist/input.js +7 -7
- package/dist/markdown.d.ts +2 -2
- package/dist/markdown.js +38 -38
- package/dist/menu.d.ts +2 -2
- package/dist/menu.js +19 -19
- package/dist/messages.d.ts +2 -2
- package/dist/messages.js +18 -18
- package/dist/navigation-menu.d.ts +2 -2
- package/dist/navigation-menu.js +16 -16
- package/dist/navigation.d.ts +5 -5
- package/dist/navigation.js +40 -40
- package/dist/otp-field.d.ts +1 -1
- package/dist/otp-field.js +14 -14
- package/dist/pagination.d.ts +2 -2
- package/dist/pagination.js +12 -12
- package/dist/panels.d.ts +8 -8
- package/dist/panels.js +39 -39
- package/dist/parts.d.ts +2 -2
- package/dist/parts.js +8 -8
- package/dist/popover.d.ts +3 -3
- package/dist/popover.js +6 -6
- package/dist/scroll-area.d.ts +1 -1
- package/dist/scroll-area.js +20 -20
- package/dist/select.d.ts +8 -8
- package/dist/select.js +21 -21
- package/dist/sizing.d.ts +3 -3
- package/dist/sizing.js +9 -9
- package/dist/slot.d.ts +1 -1
- package/dist/slot.js +4 -4
- package/dist/status.d.ts +4 -4
- package/dist/status.js +8 -8
- package/dist/syntax-engine.js +43 -43
- package/dist/syntax-highlighter.d.ts +2 -2
- package/dist/syntax-highlighter.js +32 -32
- package/dist/table-selection.d.ts +31 -0
- package/dist/table-selection.js +50 -0
- package/dist/toast.d.ts +4 -4
- package/dist/toast.js +33 -33
- package/dist/tone-transition.d.ts +1 -1
- package/dist/tone-transition.js +17 -17
- package/dist/tooltip.d.ts +1 -1
- package/dist/tooltip.js +4 -4
- package/dist/tree.d.ts +4 -4
- package/dist/tree.js +60 -60
- package/package.json +2 -2
- package/src/styles.css +266 -142
package/dist/content.js
CHANGED
|
@@ -1,65 +1,103 @@
|
|
|
1
|
-
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import * as React from
|
|
4
|
-
import { Surface } from
|
|
5
|
-
import { part } from
|
|
6
|
-
import { Button } from
|
|
7
|
-
import { SyntaxHighlighter } from
|
|
8
|
-
import { ScrollArea } from
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { Surface } from './foundations.js';
|
|
5
|
+
import { part } from './parts.js';
|
|
6
|
+
import { Button } from './button.js';
|
|
7
|
+
import { SyntaxHighlighter } from './syntax-highlighter.js';
|
|
8
|
+
import { ScrollArea } from './scroll-area.js';
|
|
9
9
|
const CardRoot = React.forwardRef(function CardRoot({ className, padding, ...props }, ref) {
|
|
10
|
-
return (_jsx(Surface, { ...props, padding: padding, ref: ref, className: [
|
|
10
|
+
return (_jsx(Surface, { ...props, padding: padding, ref: ref, className: ['pui-card', className].filter(Boolean).join(' ') }));
|
|
11
11
|
});
|
|
12
12
|
const CardTitle = React.forwardRef(function CardTitle({ level = 3, className, ...props }, ref) {
|
|
13
13
|
return React.createElement(`h${level}`, {
|
|
14
14
|
...props,
|
|
15
15
|
ref,
|
|
16
|
-
className: [
|
|
16
|
+
className: ['pui-card-title', className].filter(Boolean).join(' '),
|
|
17
17
|
});
|
|
18
18
|
});
|
|
19
19
|
export const Card = {
|
|
20
20
|
Root: CardRoot,
|
|
21
|
-
Header: part(
|
|
21
|
+
Header: part('div', 'pui-card-header'),
|
|
22
22
|
Title: CardTitle,
|
|
23
|
-
Description: part(
|
|
24
|
-
Body: part(
|
|
25
|
-
Footer: part(
|
|
23
|
+
Description: part('p', 'pui-card-description'),
|
|
24
|
+
Body: part('div', 'pui-card-body'),
|
|
25
|
+
Footer: part('div', 'pui-card-footer'),
|
|
26
26
|
};
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
const copyIcons = {
|
|
28
|
+
idle: (_jsxs(_Fragment, { children: [_jsx("rect", { x: '8', y: '8', width: '12', height: '12', rx: '2' }), _jsx("path", { d: 'M16 8V4H4v12h4' })] })),
|
|
29
|
+
copied: _jsx("path", { d: 'm5 12.5 4.5 4.5L19 7.5' }),
|
|
30
|
+
failed: (_jsx("path", { d: 'M12 7v6m0 4v.01M4.5 12a7.5 7.5 0 1 0 15 0 7.5 7.5 0 0 0-15 0' })),
|
|
31
|
+
};
|
|
32
|
+
// Feedback stays inside the copy button and returns to the action after this long.
|
|
33
|
+
const copyFeedbackDuration = 2000;
|
|
34
|
+
export const CodeBlock = React.forwardRef(function CodeBlock({ code, label = 'Code', language, wrap = false, copyLabel = 'Copy code', copiedLabel = 'Copied', copyErrorLabel = 'Copy unavailable', onCopy, className, ...props }, ref) {
|
|
35
|
+
const [state, setState] = React.useState('idle');
|
|
36
|
+
// After the first copy, each change of label fades in; the first render does not.
|
|
37
|
+
const [used, setUsed] = React.useState(false);
|
|
38
|
+
const revision = React.useRef(0), mounted = React.useRef(false), timer = React.useRef(undefined);
|
|
39
|
+
const button = React.useRef(null), source = React.useRef(null);
|
|
30
40
|
React.useEffect(() => {
|
|
31
41
|
mounted.current = true;
|
|
32
42
|
return () => {
|
|
33
43
|
mounted.current = false;
|
|
34
44
|
revision.current++;
|
|
45
|
+
clearTimeout(timer.current);
|
|
35
46
|
};
|
|
36
47
|
}, []);
|
|
37
48
|
React.useEffect(() => {
|
|
38
49
|
revision.current++;
|
|
39
|
-
|
|
40
|
-
|
|
50
|
+
clearTimeout(timer.current);
|
|
51
|
+
setState('idle');
|
|
41
52
|
}, [code]);
|
|
53
|
+
// The button keeps its resting width, so the feedback never moves the toolbar.
|
|
54
|
+
React.useLayoutEffect(() => {
|
|
55
|
+
const element = button.current;
|
|
56
|
+
if (!element || state !== 'idle')
|
|
57
|
+
return;
|
|
58
|
+
const measure = () => {
|
|
59
|
+
element.style.minInlineSize = '';
|
|
60
|
+
element.style.minInlineSize = `${element.getBoundingClientRect().width}px`;
|
|
61
|
+
};
|
|
62
|
+
measure();
|
|
63
|
+
document.fonts?.ready.then(() => {
|
|
64
|
+
if (mounted.current)
|
|
65
|
+
measure();
|
|
66
|
+
});
|
|
67
|
+
}, [copyLabel, state]);
|
|
42
68
|
async function copy() {
|
|
43
69
|
const request = ++revision.current;
|
|
44
|
-
|
|
45
|
-
|
|
70
|
+
clearTimeout(timer.current);
|
|
71
|
+
setUsed(true);
|
|
72
|
+
setState('busy');
|
|
46
73
|
let outcome;
|
|
47
74
|
try {
|
|
48
75
|
if (onCopy)
|
|
49
76
|
await onCopy(code);
|
|
50
77
|
else
|
|
51
78
|
await navigator.clipboard.writeText(code);
|
|
52
|
-
outcome =
|
|
79
|
+
outcome = 'copied';
|
|
53
80
|
}
|
|
54
81
|
catch {
|
|
55
|
-
outcome =
|
|
56
|
-
}
|
|
57
|
-
if (mounted.current && request === revision.current) {
|
|
58
|
-
setResult(outcome);
|
|
59
|
-
setBusy(false);
|
|
82
|
+
outcome = 'failed';
|
|
60
83
|
}
|
|
84
|
+
if (!mounted.current || request !== revision.current)
|
|
85
|
+
return;
|
|
86
|
+
setState(outcome);
|
|
87
|
+
// A failed copy selects the source, so the keyboard copy shortcut works next.
|
|
88
|
+
if (outcome === 'failed' && source.current)
|
|
89
|
+
window.getSelection()?.selectAllChildren(source.current);
|
|
90
|
+
timer.current = setTimeout(() => {
|
|
91
|
+
if (mounted.current && request === revision.current)
|
|
92
|
+
setState('idle');
|
|
93
|
+
}, copyFeedbackDuration);
|
|
61
94
|
}
|
|
62
|
-
|
|
95
|
+
const icon = state === 'copied' || state === 'failed' ? state : 'idle';
|
|
96
|
+
return (_jsxs("div", { ...props, ref: ref, "data-wrap": wrap || undefined, className: ['pui-code-block', className].filter(Boolean).join(' '), children: [_jsxs("div", { className: 'pui-code-toolbar', children: [_jsxs("span", { className: 'pui-code-label', children: [label, language && _jsx("span", { className: 'pui-code-language', children: language })] }), _jsxs(Button, { ref: button, type: 'button', variant: 'outline', size: 'sm', className: 'pui-code-copy', onClick: copy, disabled: state === 'busy', "aria-busy": state === 'busy' || undefined, "data-copy-state": icon === 'idle' ? undefined : icon, "data-copy-used": used || undefined, children: [_jsx("svg", { className: 'pui-code-copy-icon', width: '14', height: '14', viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', strokeWidth: '1.6', strokeLinecap: 'round', strokeLinejoin: 'round', "aria-hidden": 'true', children: copyIcons[icon] }, icon), _jsx("span", { "aria-live": 'polite', children: _jsx("span", { className: 'pui-code-copy-label', children: state === 'copied'
|
|
97
|
+
? copiedLabel
|
|
98
|
+
: state === 'failed'
|
|
99
|
+
? copyErrorLabel
|
|
100
|
+
: copyLabel }, icon) })] })] }), _jsx(ScrollArea, { label: label, orientation: 'horizontal', children: _jsx("pre", { ref: source, className: 'pui-code-text', children: _jsx(SyntaxHighlighter, { code: code, language: language, inline: true }) }) })] }));
|
|
63
101
|
});
|
|
64
102
|
// Flat names for React Server Components, which cannot dot into client exports.
|
|
65
103
|
export { CardRoot, CardTitle };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as React from
|
|
2
|
-
import { ContextMenu as BaseContextMenu } from
|
|
3
|
-
import { PreviewCard as BasePreviewCard } from
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ContextMenu as BaseContextMenu } from '@base-ui/react/context-menu';
|
|
3
|
+
import { PreviewCard as BasePreviewCard } from '@base-ui/react/preview-card';
|
|
4
4
|
/** Same menu anatomy and styling, with the context-specific cursor positioner. */
|
|
5
5
|
export declare const ContextMenu: {
|
|
6
6
|
Trigger: React.ForwardRefExoticComponent<Omit<Omit<Omit<import("@base-ui/react/context-menu").ContextMenuTriggerProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref">, "size"> & {
|
package/dist/context-overlays.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
'use client';
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import * as React from
|
|
4
|
-
import { ContextMenu as BaseContextMenu } from
|
|
5
|
-
import { PreviewCard as BasePreviewCard } from
|
|
6
|
-
import { Menu } from
|
|
7
|
-
import { part, skin } from
|
|
8
|
-
const ContextPositioner = part(BaseContextMenu.Positioner,
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { ContextMenu as BaseContextMenu } from '@base-ui/react/context-menu';
|
|
5
|
+
import { PreviewCard as BasePreviewCard } from '@base-ui/react/preview-card';
|
|
6
|
+
import { Menu } from './menu.js';
|
|
7
|
+
import { part, skin } from './parts.js';
|
|
8
|
+
const ContextPositioner = part(BaseContextMenu.Positioner, 'pui-positioner');
|
|
9
9
|
const ContextContent = React.forwardRef(function ContextContent({ positionerProps, ...props }, ref) {
|
|
10
10
|
return (_jsx(ContextPositioner, { ...positionerProps, children: _jsx(Menu.Popup, { ...props, ref: ref }) }));
|
|
11
11
|
});
|
|
12
12
|
/** Same menu anatomy and styling, with the context-specific cursor positioner. */
|
|
13
13
|
export const ContextMenu = {
|
|
14
14
|
...BaseContextMenu,
|
|
15
|
-
Trigger: part(BaseContextMenu.Trigger,
|
|
15
|
+
Trigger: part(BaseContextMenu.Trigger, 'pui-context-trigger'),
|
|
16
16
|
Positioner: ContextPositioner,
|
|
17
17
|
Content: ContextContent,
|
|
18
18
|
Popup: Menu.Popup,
|
|
@@ -26,14 +26,14 @@ export const ContextMenu = {
|
|
|
26
26
|
Separator: Menu.Separator,
|
|
27
27
|
SubmenuTrigger: Menu.SubmenuTrigger,
|
|
28
28
|
};
|
|
29
|
-
const PreviewPositioner = part(BasePreviewCard.Positioner,
|
|
29
|
+
const PreviewPositioner = part(BasePreviewCard.Positioner, 'pui-positioner');
|
|
30
30
|
// The preview is visual enhancement; its destination is the accessible interface.
|
|
31
31
|
const PreviewPopup = React.forwardRef(function PreviewPopup({ className, ...props }, ref) {
|
|
32
|
-
return (_jsx(BasePreviewCard.Popup, { ...props, ref: ref, "aria-hidden":
|
|
32
|
+
return (_jsx(BasePreviewCard.Popup, { ...props, ref: ref, "aria-hidden": 'true', className: skin('pui-preview-card', className) }));
|
|
33
33
|
});
|
|
34
34
|
function PreviewTrigger(props) {
|
|
35
35
|
const { className, ...rest } = props;
|
|
36
|
-
return (_jsx(BasePreviewCard.Trigger, { ...rest, className: skin(
|
|
36
|
+
return (_jsx(BasePreviewCard.Trigger, { ...rest, className: skin('pui-link pui-preview-trigger', className) }));
|
|
37
37
|
}
|
|
38
38
|
const PreviewContent = React.forwardRef(function PreviewContent({ positionerProps, ...props }, ref) {
|
|
39
39
|
return (_jsx(PreviewPositioner, { sideOffset: 8, collisionPadding: 12, ...positionerProps, children: _jsx(PreviewPopup, { ...props, ref: ref }) }));
|
package/dist/data.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as React from
|
|
1
|
+
import * as React from 'react';
|
|
2
2
|
declare const TableContainer: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
3
3
|
label?: string;
|
|
4
4
|
rootClassName?: string;
|
|
@@ -8,6 +8,41 @@ declare const TableContainer: React.ForwardRefExoticComponent<Omit<Omit<React.De
|
|
|
8
8
|
} & React.RefAttributes<HTMLDivElement>, "ref"> & {
|
|
9
9
|
label: string;
|
|
10
10
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
11
|
+
export type TableDensity = 'default' | 'compact';
|
|
12
|
+
declare const TableRoot: React.ForwardRefExoticComponent<Omit<Omit<Omit<React.DetailedHTMLProps<React.TableHTMLAttributes<HTMLTableElement>, HTMLTableElement>, "ref">, "size"> & {
|
|
13
|
+
size?: import("./sizing.js").ComponentSize;
|
|
14
|
+
} & React.RefAttributes<HTMLTableElement>, "ref"> & {
|
|
15
|
+
/** compact tightens rows for scanning many records with a pointer. */
|
|
16
|
+
density?: TableDensity;
|
|
17
|
+
/** Keeps the header visible while a bounded Container scrolls vertically. */
|
|
18
|
+
stickyHeader?: boolean;
|
|
19
|
+
} & React.RefAttributes<HTMLTableElement>>;
|
|
20
|
+
type CellLayout = {
|
|
21
|
+
align?: 'start' | 'center' | 'end';
|
|
22
|
+
/** Aligns to the end with tabular figures, so digits line up down the column. */
|
|
23
|
+
numeric?: boolean;
|
|
24
|
+
};
|
|
25
|
+
declare const TableHeaderCell: React.ForwardRefExoticComponent<Omit<Omit<Omit<Omit<React.DetailedHTMLProps<React.ThHTMLAttributes<HTMLTableHeaderCellElement>, HTMLTableHeaderCellElement>, "ref">, "size"> & {
|
|
26
|
+
size?: import("./sizing.js").ComponentSize;
|
|
27
|
+
} & React.RefAttributes<HTMLTableCellElement>, "ref">, "align"> & CellLayout & React.RefAttributes<HTMLTableCellElement>>;
|
|
28
|
+
declare const TableCell: React.ForwardRefExoticComponent<Omit<Omit<Omit<Omit<React.DetailedHTMLProps<React.TdHTMLAttributes<HTMLTableDataCellElement>, HTMLTableDataCellElement>, "ref">, "size"> & {
|
|
29
|
+
size?: import("./sizing.js").ComponentSize;
|
|
30
|
+
} & React.RefAttributes<HTMLTableCellElement>, "ref">, "align"> & CellLayout & React.RefAttributes<HTMLTableCellElement>>;
|
|
31
|
+
export type TableSort = 'ascending' | 'descending';
|
|
32
|
+
/** A column header whose button sorts the column. aria-sort names the order on the sorted column only. */
|
|
33
|
+
declare const TableSortHeader: React.ForwardRefExoticComponent<Omit<Omit<Omit<Omit<Omit<Omit<React.DetailedHTMLProps<React.ThHTMLAttributes<HTMLTableHeaderCellElement>, HTMLTableHeaderCellElement>, "ref">, "size"> & {
|
|
34
|
+
size?: import("./sizing.js").ComponentSize;
|
|
35
|
+
} & React.RefAttributes<HTMLTableCellElement>, "ref">, "align"> & CellLayout & React.RefAttributes<HTMLTableCellElement>, "ref">, "scope" | "aria-sort" | "onClick"> & {
|
|
36
|
+
sort?: TableSort;
|
|
37
|
+
onSort: () => void;
|
|
38
|
+
disabled?: boolean;
|
|
39
|
+
} & React.RefAttributes<HTMLTableCellElement>>;
|
|
40
|
+
/** One-line text that ends in an ellipsis. String content also becomes the title. */
|
|
41
|
+
declare const TableTruncate: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLSpanElement>>;
|
|
42
|
+
/** A full-width body row for loading, empty, error and permission messages. It has no hover. */
|
|
43
|
+
declare const TableMessage: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.TdHTMLAttributes<HTMLTableDataCellElement>, HTMLTableDataCellElement>, "ref"> & {
|
|
44
|
+
colSpan: number;
|
|
45
|
+
} & React.RefAttributes<HTMLTableCellElement>>;
|
|
11
46
|
declare const TableRow: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLTableRowElement>, HTMLTableRowElement>, "ref"> & {
|
|
12
47
|
selected?: boolean;
|
|
13
48
|
} & React.RefAttributes<HTMLTableRowElement>>;
|
|
@@ -21,8 +56,13 @@ export declare const Table: {
|
|
|
21
56
|
} & React.RefAttributes<HTMLDivElement>, "ref"> & {
|
|
22
57
|
label: string;
|
|
23
58
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
24
|
-
Root: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.TableHTMLAttributes<HTMLTableElement>, HTMLTableElement>, "ref">, "size"> & {
|
|
59
|
+
Root: React.ForwardRefExoticComponent<Omit<Omit<Omit<React.DetailedHTMLProps<React.TableHTMLAttributes<HTMLTableElement>, HTMLTableElement>, "ref">, "size"> & {
|
|
25
60
|
size?: import("./sizing.js").ComponentSize;
|
|
61
|
+
} & React.RefAttributes<HTMLTableElement>, "ref"> & {
|
|
62
|
+
/** compact tightens rows for scanning many records with a pointer. */
|
|
63
|
+
density?: TableDensity;
|
|
64
|
+
/** Keeps the header visible while a bounded Container scrolls vertically. */
|
|
65
|
+
stickyHeader?: boolean;
|
|
26
66
|
} & React.RefAttributes<HTMLTableElement>>;
|
|
27
67
|
Caption: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>, "ref">, "size"> & {
|
|
28
68
|
size?: import("./sizing.js").ComponentSize;
|
|
@@ -39,11 +79,22 @@ export declare const Table: {
|
|
|
39
79
|
Row: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLTableRowElement>, HTMLTableRowElement>, "ref"> & {
|
|
40
80
|
selected?: boolean;
|
|
41
81
|
} & React.RefAttributes<HTMLTableRowElement>>;
|
|
42
|
-
HeaderCell: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.ThHTMLAttributes<HTMLTableHeaderCellElement>, HTMLTableHeaderCellElement>, "ref">, "size"> & {
|
|
82
|
+
HeaderCell: React.ForwardRefExoticComponent<Omit<Omit<Omit<Omit<React.DetailedHTMLProps<React.ThHTMLAttributes<HTMLTableHeaderCellElement>, HTMLTableHeaderCellElement>, "ref">, "size"> & {
|
|
83
|
+
size?: import("./sizing.js").ComponentSize;
|
|
84
|
+
} & React.RefAttributes<HTMLTableCellElement>, "ref">, "align"> & CellLayout & React.RefAttributes<HTMLTableCellElement>>;
|
|
85
|
+
SortHeader: React.ForwardRefExoticComponent<Omit<Omit<Omit<Omit<Omit<Omit<React.DetailedHTMLProps<React.ThHTMLAttributes<HTMLTableHeaderCellElement>, HTMLTableHeaderCellElement>, "ref">, "size"> & {
|
|
43
86
|
size?: import("./sizing.js").ComponentSize;
|
|
87
|
+
} & React.RefAttributes<HTMLTableCellElement>, "ref">, "align"> & CellLayout & React.RefAttributes<HTMLTableCellElement>, "ref">, "scope" | "aria-sort" | "onClick"> & {
|
|
88
|
+
sort?: TableSort;
|
|
89
|
+
onSort: () => void;
|
|
90
|
+
disabled?: boolean;
|
|
44
91
|
} & React.RefAttributes<HTMLTableCellElement>>;
|
|
45
|
-
Cell: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.TdHTMLAttributes<HTMLTableDataCellElement>, HTMLTableDataCellElement>, "ref">, "size"> & {
|
|
92
|
+
Cell: React.ForwardRefExoticComponent<Omit<Omit<Omit<Omit<React.DetailedHTMLProps<React.TdHTMLAttributes<HTMLTableDataCellElement>, HTMLTableDataCellElement>, "ref">, "size"> & {
|
|
46
93
|
size?: import("./sizing.js").ComponentSize;
|
|
94
|
+
} & React.RefAttributes<HTMLTableCellElement>, "ref">, "align"> & CellLayout & React.RefAttributes<HTMLTableCellElement>>;
|
|
95
|
+
Truncate: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLSpanElement>>;
|
|
96
|
+
Message: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.TdHTMLAttributes<HTMLTableDataCellElement>, HTMLTableDataCellElement>, "ref"> & {
|
|
97
|
+
colSpan: number;
|
|
47
98
|
} & React.RefAttributes<HTMLTableCellElement>>;
|
|
48
99
|
};
|
|
49
100
|
declare const ListRoot: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLUListElement>, HTMLUListElement>, "ref"> & React.RefAttributes<HTMLUListElement>>;
|
|
@@ -68,7 +119,7 @@ export declare const List: {
|
|
|
68
119
|
size?: import("./sizing.js").ComponentSize;
|
|
69
120
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
70
121
|
};
|
|
71
|
-
export { ListRoot, ListItem, TableContainer, TableRow };
|
|
122
|
+
export { ListRoot, ListItem, TableContainer, TableRoot, TableRow, TableHeaderCell, TableSortHeader, TableCell, TableTruncate, TableMessage, };
|
|
72
123
|
export declare const ListContent: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "size"> & {
|
|
73
124
|
size?: import("./sizing.js").ComponentSize;
|
|
74
125
|
} & React.RefAttributes<HTMLDivElement>>, ListTitle: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "size"> & {
|
|
@@ -78,9 +129,7 @@ export declare const ListContent: React.ForwardRefExoticComponent<Omit<Omit<Reac
|
|
|
78
129
|
} & React.RefAttributes<HTMLParagraphElement>>, ListActions: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "size"> & {
|
|
79
130
|
size?: import("./sizing.js").ComponentSize;
|
|
80
131
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
81
|
-
export declare const
|
|
82
|
-
size?: import("./sizing.js").ComponentSize;
|
|
83
|
-
} & React.RefAttributes<HTMLTableElement>>, TableCaption: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>, "ref">, "size"> & {
|
|
132
|
+
export declare const TableCaption: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>, "ref">, "size"> & {
|
|
84
133
|
size?: import("./sizing.js").ComponentSize;
|
|
85
134
|
} & React.RefAttributes<HTMLTableCaptionElement>>, TableHead: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>, "ref">, "size"> & {
|
|
86
135
|
size?: import("./sizing.js").ComponentSize;
|
|
@@ -88,8 +137,4 @@ export declare const TableRoot: React.ForwardRefExoticComponent<Omit<Omit<React.
|
|
|
88
137
|
size?: import("./sizing.js").ComponentSize;
|
|
89
138
|
} & React.RefAttributes<HTMLTableSectionElement>>, TableFoot: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>, "ref">, "size"> & {
|
|
90
139
|
size?: import("./sizing.js").ComponentSize;
|
|
91
|
-
} & React.RefAttributes<HTMLTableSectionElement
|
|
92
|
-
size?: import("./sizing.js").ComponentSize;
|
|
93
|
-
} & React.RefAttributes<HTMLTableCellElement>>, TableCell: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.TdHTMLAttributes<HTMLTableDataCellElement>, HTMLTableDataCellElement>, "ref">, "size"> & {
|
|
94
|
-
size?: import("./sizing.js").ComponentSize;
|
|
95
|
-
} & React.RefAttributes<HTMLTableCellElement>>;
|
|
140
|
+
} & React.RefAttributes<HTMLTableSectionElement>>;
|
package/dist/data.js
CHANGED
|
@@ -1,40 +1,82 @@
|
|
|
1
|
-
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import * as React from
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
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 { part } from './parts.js';
|
|
6
|
+
import { ScrollArea } from './scroll-area.js';
|
|
6
7
|
const TableContainer = React.forwardRef(function TableContainer(props, ref) {
|
|
7
8
|
return _jsx(ScrollArea, { ...props, ref: ref });
|
|
8
9
|
});
|
|
10
|
+
const RootPart = part('table', 'pui-table');
|
|
11
|
+
const TableRoot = React.forwardRef(function TableRoot({ density, stickyHeader, ...props }, ref) {
|
|
12
|
+
return (_jsx(RootPart, { ...props, ref: ref, "data-density": density === 'compact' ? 'compact' : undefined, "data-sticky-header": stickyHeader || undefined }));
|
|
13
|
+
});
|
|
14
|
+
const layout = ({ align, numeric }) => ({
|
|
15
|
+
'data-align': numeric ? 'end' : align,
|
|
16
|
+
'data-numeric': numeric || undefined,
|
|
17
|
+
});
|
|
18
|
+
const HeaderCellPart = part('th', 'pui-table-cell pui-table-header');
|
|
19
|
+
const CellPart = part('td', 'pui-table-cell');
|
|
20
|
+
// align replaces the obsolete HTML align attribute of th and td.
|
|
21
|
+
const TableHeaderCell = React.forwardRef(function TableHeaderCell({ align, numeric, ...props }, ref) {
|
|
22
|
+
return _jsx(HeaderCellPart, { ...props, ...layout({ align, numeric }), ref: ref });
|
|
23
|
+
});
|
|
24
|
+
const TableCell = React.forwardRef(function TableCell({ align, numeric, ...props }, ref) {
|
|
25
|
+
return _jsx(CellPart, { ...props, ...layout({ align, numeric }), ref: ref });
|
|
26
|
+
});
|
|
27
|
+
function SortIcon({ sort }) {
|
|
28
|
+
return (_jsx("svg", { className: 'pui-table-sort-icon', width: '16', height: '16', viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', strokeWidth: '1.6', strokeLinecap: 'round', strokeLinejoin: 'round', "aria-hidden": 'true', children: _jsx("path", { d: sort === 'ascending'
|
|
29
|
+
? 'M12 19V5m-6 6 6-6 6 6'
|
|
30
|
+
: sort === 'descending'
|
|
31
|
+
? 'M12 5v14m-6-6 6 6 6-6'
|
|
32
|
+
: 'm8 9 4-4 4 4m-8 6 4 4 4-4' }) }));
|
|
33
|
+
}
|
|
34
|
+
/** A column header whose button sorts the column. aria-sort names the order on the sorted column only. */
|
|
35
|
+
const TableSortHeader = React.forwardRef(function TableSortHeader({ sort, onSort, disabled, children, className, ...props }, ref) {
|
|
36
|
+
return (_jsx(TableHeaderCell, { ...props, ref: ref, scope: 'col', "aria-sort": sort, className: ['pui-table-sort-header', className].filter(Boolean).join(' '), children: _jsxs(Button, { variant: 'ghost', className: 'pui-table-sort', "data-sort": sort, disabled: disabled, onClick: onSort, children: [_jsx("span", { children: children }), _jsx(SortIcon, { sort: sort })] }) }));
|
|
37
|
+
});
|
|
38
|
+
/** One-line text that ends in an ellipsis. String content also becomes the title. */
|
|
39
|
+
const TableTruncate = React.forwardRef(function TableTruncate({ className, title, children, ...props }, ref) {
|
|
40
|
+
return (_jsx("span", { ...props, ref: ref, title: title ?? (typeof children === 'string' ? children : undefined), className: ['pui-table-truncate', className].filter(Boolean).join(' '), children: children }));
|
|
41
|
+
});
|
|
42
|
+
/** A full-width body row for loading, empty, error and permission messages. It has no hover. */
|
|
43
|
+
const TableMessage = React.forwardRef(function TableMessage({ className, ...props }, ref) {
|
|
44
|
+
return (_jsx("tr", { className: 'pui-table-row pui-table-message-row', children: _jsx("td", { ...props, ref: ref, className: ['pui-table-cell pui-table-message', className]
|
|
45
|
+
.filter(Boolean)
|
|
46
|
+
.join(' ') }) }));
|
|
47
|
+
});
|
|
9
48
|
const TableRow = React.forwardRef(function TableRow({ selected, className, ...props }, ref) {
|
|
10
|
-
return (_jsx("tr", { ...props, ref: ref, "data-selected": selected || undefined, className: [
|
|
49
|
+
return (_jsx("tr", { ...props, ref: ref, "data-selected": selected || undefined, className: ['pui-table-row', className].filter(Boolean).join(' ') }));
|
|
11
50
|
});
|
|
12
51
|
export const Table = {
|
|
13
52
|
Container: TableContainer,
|
|
14
|
-
Root:
|
|
15
|
-
Caption: part(
|
|
16
|
-
Head: part(
|
|
17
|
-
Body: part(
|
|
18
|
-
Foot: part(
|
|
53
|
+
Root: TableRoot,
|
|
54
|
+
Caption: part('caption', 'pui-table-caption'),
|
|
55
|
+
Head: part('thead', 'pui-table-head'),
|
|
56
|
+
Body: part('tbody', 'pui-table-body'),
|
|
57
|
+
Foot: part('tfoot', 'pui-table-foot'),
|
|
19
58
|
Row: TableRow,
|
|
20
|
-
HeaderCell:
|
|
21
|
-
|
|
59
|
+
HeaderCell: TableHeaderCell,
|
|
60
|
+
SortHeader: TableSortHeader,
|
|
61
|
+
Cell: TableCell,
|
|
62
|
+
Truncate: TableTruncate,
|
|
63
|
+
Message: TableMessage,
|
|
22
64
|
};
|
|
23
65
|
const ListRoot = React.forwardRef(function ListRoot({ className, ...props }, ref) {
|
|
24
|
-
return (_jsx("ul", { role:
|
|
66
|
+
return (_jsx("ul", { role: 'list', ...props, ref: ref, className: ['pui-list', className].filter(Boolean).join(' ') }));
|
|
25
67
|
});
|
|
26
68
|
const ListItem = React.forwardRef(function ListItem({ selected, className, ...props }, ref) {
|
|
27
|
-
return (_jsx("li", { ...props, ref: ref, "data-selected": selected || undefined, className: [
|
|
69
|
+
return (_jsx("li", { ...props, ref: ref, "data-selected": selected || undefined, className: ['pui-list-item', className].filter(Boolean).join(' ') }));
|
|
28
70
|
});
|
|
29
71
|
export const List = {
|
|
30
72
|
Root: ListRoot,
|
|
31
73
|
Item: ListItem,
|
|
32
|
-
Content: part(
|
|
33
|
-
Title: part(
|
|
34
|
-
Description: part(
|
|
35
|
-
Actions: part(
|
|
74
|
+
Content: part('div', 'pui-list-content'),
|
|
75
|
+
Title: part('div', 'pui-list-title'),
|
|
76
|
+
Description: part('p', 'pui-list-description'),
|
|
77
|
+
Actions: part('div', 'pui-list-actions'),
|
|
36
78
|
};
|
|
37
79
|
// Flat names for React Server Components, which cannot dot into client exports.
|
|
38
|
-
export { ListRoot, ListItem, TableContainer, TableRow };
|
|
80
|
+
export { ListRoot, ListItem, TableContainer, TableRoot, TableRow, TableHeaderCell, TableSortHeader, TableCell, TableTruncate, TableMessage, };
|
|
39
81
|
export const { Content: ListContent, Title: ListTitle, Description: ListDescription, Actions: ListActions, } = List;
|
|
40
|
-
export const {
|
|
82
|
+
export const { Caption: TableCaption, Head: TableHead, Body: TableBody, Foot: TableFoot, } = Table;
|
package/dist/date-picker.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import * as React from
|
|
2
|
-
import { type DatePickerProps as AriaDatePickerProps, type DateValue, type ValidationResult } from
|
|
3
|
-
import { type DateRangePickerProps as AriaDateRangePickerProps } from
|
|
4
|
-
import { type TimeFieldProps as AriaTimeFieldProps, type TimeValue } from
|
|
5
|
-
export { I18nProvider as DateLocaleProvider } from
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type DatePickerProps as AriaDatePickerProps, type DateValue, type ValidationResult } from 'react-aria-components/DatePicker';
|
|
3
|
+
import { type DateRangePickerProps as AriaDateRangePickerProps } from 'react-aria-components/DateRangePicker';
|
|
4
|
+
import { type TimeFieldProps as AriaTimeFieldProps, type TimeValue } from 'react-aria-components/TimeField';
|
|
5
|
+
export { I18nProvider as DateLocaleProvider } from 'react-aria-components/I18nProvider';
|
|
6
6
|
export type { DateValue, TimeValue };
|
|
7
7
|
type FieldContent = {
|
|
8
8
|
label: string;
|
|
@@ -13,9 +13,9 @@ type FieldContent = {
|
|
|
13
13
|
type CalendarContent = {
|
|
14
14
|
calendarLabel?: string;
|
|
15
15
|
};
|
|
16
|
-
export type DatePickerProps<T extends DateValue> = Omit<AriaDatePickerProps<T>,
|
|
17
|
-
export type DateRangePickerProps<T extends DateValue> = Omit<AriaDateRangePickerProps<T>,
|
|
18
|
-
export type TimeFieldProps<T extends TimeValue> = Omit<AriaTimeFieldProps<T>,
|
|
16
|
+
export type DatePickerProps<T extends DateValue> = Omit<AriaDatePickerProps<T>, 'children'> & FieldContent & CalendarContent;
|
|
17
|
+
export type DateRangePickerProps<T extends DateValue> = Omit<AriaDateRangePickerProps<T>, 'children'> & FieldContent & CalendarContent;
|
|
18
|
+
export type TimeFieldProps<T extends TimeValue> = Omit<AriaTimeFieldProps<T>, 'children'> & FieldContent;
|
|
19
19
|
/** Locale-aware segmented entry with a keyboard and touch calendar. DateValue
|
|
20
20
|
* retains calendar/time-zone semantics; conversion to an instant is caller-owned. */
|
|
21
21
|
export declare function DatePicker<T extends DateValue>({ label, description, errorMessage, calendarLabel, className, ...props }: DatePickerProps<T>): React.JSX.Element;
|
package/dist/date-picker.js
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
|
|
1
|
+
'use client';
|
|
2
2
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useComponentSize } from
|
|
4
|
-
import { DatePicker as AriaDatePicker, DateInput, DateSegment, Group, Label, Text, FieldError, Calendar, CalendarGrid, CalendarGridHeader, CalendarGridBody, CalendarHeaderCell, CalendarCell, Button, Popover, } from
|
|
5
|
-
import { DateRangePicker as AriaDateRangePicker, RangeCalendar, } from
|
|
6
|
-
import { TimeField as AriaTimeField, } from
|
|
7
|
-
import { Heading } from
|
|
8
|
-
import { Dialog } from
|
|
9
|
-
import { skin } from
|
|
10
|
-
import { useLocale } from
|
|
11
|
-
export { I18nProvider as DateLocaleProvider } from
|
|
3
|
+
import { useComponentSize } from './sizing.js';
|
|
4
|
+
import { DatePicker as AriaDatePicker, DateInput, DateSegment, Group, Label, Text, FieldError, Calendar, CalendarGrid, CalendarGridHeader, CalendarGridBody, CalendarHeaderCell, CalendarCell, Button, Popover, } from 'react-aria-components/DatePicker';
|
|
5
|
+
import { DateRangePicker as AriaDateRangePicker, RangeCalendar, } from 'react-aria-components/DateRangePicker';
|
|
6
|
+
import { TimeField as AriaTimeField, } from 'react-aria-components/TimeField';
|
|
7
|
+
import { Heading } from 'react-aria-components/Heading';
|
|
8
|
+
import { Dialog } from 'react-aria-components/Dialog';
|
|
9
|
+
import { skin } from './parts.js';
|
|
10
|
+
import { useLocale } from 'react-aria-components/I18nProvider';
|
|
11
|
+
export { I18nProvider as DateLocaleProvider } from 'react-aria-components/I18nProvider';
|
|
12
12
|
function Segments({ slot }) {
|
|
13
|
-
return (_jsx(DateInput, { slot: slot, className:
|
|
13
|
+
return (_jsx(DateInput, { slot: slot, className: 'pui-date-input', children: (segment) => (_jsx(DateSegment, { segment: segment, className: 'pui-date-segment' })) }));
|
|
14
14
|
}
|
|
15
15
|
function FieldHelp({ description, errorMessage, }) {
|
|
16
|
-
return (_jsxs(_Fragment, { children: [description && (_jsx(Text, { slot:
|
|
16
|
+
return (_jsxs(_Fragment, { children: [description && (_jsx(Text, { slot: 'description', className: 'pui-field-description', children: description })), _jsx(FieldError, { className: 'pui-field-error', children: errorMessage })] }));
|
|
17
17
|
}
|
|
18
18
|
function CalendarButton() {
|
|
19
|
-
return (_jsx(Button, { className:
|
|
19
|
+
return (_jsx(Button, { className: 'pui-date-trigger', children: _jsxs("svg", { width: '16', height: '16', viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', strokeWidth: '1.7', "aria-hidden": 'true', children: [_jsx("rect", { x: '3', y: '5', width: '18', height: '16', rx: '3' }), _jsx("path", { d: 'M7 3v4m10-4v4M3 11h18m-12 4h2' })] }) }));
|
|
20
20
|
}
|
|
21
21
|
function CalendarContents() {
|
|
22
22
|
const { locale } = useLocale();
|
|
23
|
-
return (_jsxs(_Fragment, { children: [_jsxs("div", { className:
|
|
23
|
+
return (_jsxs(_Fragment, { children: [_jsxs("div", { className: 'pui-calendar-header', children: [_jsx(Button, { slot: 'previous', className: 'pui-calendar-nav', children: _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: 'm15 6-6 6 6 6' }) }) }), _jsx(Heading, { className: 'pui-calendar-heading' }), _jsx(Button, { slot: 'next', className: 'pui-calendar-nav', children: _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: 'm9 6 6 6-6 6' }) }) })] }), _jsxs(CalendarGrid, { className: 'pui-calendar-grid', weekdayStyle: 'short', children: [_jsx(CalendarGridHeader, { children: (day) => (_jsx(CalendarHeaderCell, { className: 'pui-calendar-weekday', children: day })) }), _jsx(CalendarGridBody, { children: (date) => (_jsx(CalendarCell, { date: date, className: 'pui-calendar-day', children: ({ formattedDate }) => locale.startsWith('ko') ? `${formattedDate}일` : formattedDate })) })] })] }));
|
|
24
24
|
}
|
|
25
25
|
function CalendarPopup({ label, range }) {
|
|
26
26
|
const scheme = useComponentSize();
|
|
27
|
-
return (_jsx(Popover, { "data-ui-size": scheme, className:
|
|
27
|
+
return (_jsx(Popover, { "data-ui-size": scheme, className: 'pui-date-popover', offset: 8, placement: 'bottom start', children: _jsx(Dialog, { "aria-label": label, className: 'pui-date-dialog', children: range ? (_jsx(RangeCalendar, { className: 'pui-calendar', children: _jsx(CalendarContents, {}) })) : (_jsx(Calendar, { className: 'pui-calendar', children: _jsx(CalendarContents, {}) })) }) }));
|
|
28
28
|
}
|
|
29
29
|
/** Locale-aware segmented entry with a keyboard and touch calendar. DateValue
|
|
30
30
|
* retains calendar/time-zone semantics; conversion to an instant is caller-owned. */
|
|
31
31
|
export function DatePicker({ label, description, errorMessage, calendarLabel, className, ...props }) {
|
|
32
|
-
return (_jsxs(AriaDatePicker, { ...props, className: skin(
|
|
32
|
+
return (_jsxs(AriaDatePicker, { ...props, className: skin('pui-date-picker', className), children: [_jsx(Label, { className: 'pui-field-label', children: label }), _jsxs(Group, { className: 'pui-date-group', children: [_jsx(Segments, {}), _jsx(CalendarButton, {})] }), _jsx(FieldHelp, { description: description, errorMessage: errorMessage }), _jsx(CalendarPopup, { label: calendarLabel ?? label })] }));
|
|
33
33
|
}
|
|
34
34
|
export function DateRangePicker({ label, description, errorMessage, calendarLabel, className, ...props }) {
|
|
35
|
-
return (_jsxs(AriaDateRangePicker, { ...props, className: skin(
|
|
35
|
+
return (_jsxs(AriaDateRangePicker, { ...props, className: skin('pui-date-picker pui-date-range-picker', className), children: [_jsx(Label, { className: 'pui-field-label', children: label }), _jsxs(Group, { className: 'pui-date-group', children: [_jsxs("div", { className: 'pui-date-range-inputs', children: [_jsx(Segments, { slot: 'start' }), _jsx("span", { "aria-hidden": 'true', className: 'pui-date-range-separator', children: "\u2013" }), _jsx(Segments, { slot: 'end' })] }), _jsx(CalendarButton, {})] }), _jsx(FieldHelp, { description: description, errorMessage: errorMessage }), _jsx(CalendarPopup, { label: calendarLabel ?? label, range: true })] }));
|
|
36
36
|
}
|
|
37
37
|
export function TimeField({ label, description, errorMessage, className, ...props }) {
|
|
38
|
-
return (_jsxs(AriaTimeField, { ...props, className: skin(
|
|
38
|
+
return (_jsxs(AriaTimeField, { ...props, className: skin('pui-time-field', className), children: [_jsx(Label, { className: 'pui-field-label', children: label }), _jsx("div", { className: 'pui-date-group', children: _jsx(Segments, {}) }), _jsx(FieldHelp, { description: description, errorMessage: errorMessage })] }));
|
|
39
39
|
}
|
package/dist/dialog-focus.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
import * as React from
|
|
1
|
+
'use client';
|
|
2
|
+
import * as React from 'react';
|
|
3
3
|
/** Base UI 1.9 exposes WebKit's focus guards as buttons for VoiceOver.
|
|
4
4
|
* Give those boundaries a name without hiding or changing their focus behavior.
|
|
5
5
|
* Scope observation to this portal and disconnect it on React ref cleanup.
|
|
@@ -11,8 +11,8 @@ export function useDialogFocusBoundary(label) {
|
|
|
11
11
|
const owned = new Set();
|
|
12
12
|
const nameBoundaries = () => {
|
|
13
13
|
for (const guard of portal.querySelectorAll(':scope > [data-base-ui-focus-guard][role="button"]')) {
|
|
14
|
-
if (!guard.hasAttribute(
|
|
15
|
-
guard.setAttribute(
|
|
14
|
+
if (!guard.hasAttribute('aria-label')) {
|
|
15
|
+
guard.setAttribute('aria-label', label);
|
|
16
16
|
owned.add(guard);
|
|
17
17
|
}
|
|
18
18
|
}
|
|
@@ -23,13 +23,13 @@ export function useDialogFocusBoundary(label) {
|
|
|
23
23
|
childList: true,
|
|
24
24
|
subtree: true,
|
|
25
25
|
attributes: true,
|
|
26
|
-
attributeFilter: [
|
|
26
|
+
attributeFilter: ['role'],
|
|
27
27
|
});
|
|
28
28
|
return () => {
|
|
29
29
|
observer.disconnect();
|
|
30
30
|
for (const guard of owned)
|
|
31
|
-
if (guard.getAttribute(
|
|
32
|
-
guard.removeAttribute(
|
|
31
|
+
if (guard.getAttribute('aria-label') === label)
|
|
32
|
+
guard.removeAttribute('aria-label');
|
|
33
33
|
};
|
|
34
34
|
}, [label]);
|
|
35
35
|
}
|
package/dist/dialog.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as React from
|
|
2
|
-
import { Dialog as BaseDialog } from
|
|
3
|
-
import { AlertDialog as BaseAlertDialog } from
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Dialog as BaseDialog } from '@base-ui/react/dialog';
|
|
3
|
+
import { AlertDialog as BaseAlertDialog } from '@base-ui/react/alert-dialog';
|
|
4
4
|
/** Visible icon close action; inherits Dialog focus and dismissal behavior. */
|
|
5
5
|
declare const DialogCloseButton: React.ForwardRefExoticComponent<Omit<Omit<Omit<import("@base-ui/react/dialog").DialogCloseProps, "ref"> & React.RefAttributes<HTMLButtonElement>, "ref">, "children"> & React.RefAttributes<HTMLButtonElement>>;
|
|
6
6
|
declare const DialogContent: React.ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react/dialog").DialogPopupProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref"> & {
|
|
@@ -8,9 +8,9 @@ declare const DialogContent: React.ForwardRefExoticComponent<Omit<Omit<import("@
|
|
|
8
8
|
closeDisabled?: boolean;
|
|
9
9
|
focusBoundaryLabel?: string;
|
|
10
10
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
11
|
-
declare function DialogHeader({ className, ...props }: React.ComponentProps<
|
|
11
|
+
declare function DialogHeader({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
|
|
12
12
|
declare const DialogBody: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
13
|
-
declare function DialogFooter({ className, ...props }: React.ComponentProps<
|
|
13
|
+
declare function DialogFooter({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
|
|
14
14
|
export declare const Dialog: {
|
|
15
15
|
Content: React.ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react/dialog").DialogPopupProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref"> & {
|
|
16
16
|
closeLabel?: string;
|