@surflane/ui 0.3.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.js +8 -8
- 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.js +21 -21
- 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.js +4 -2
- package/dist/index.d.ts +4 -5
- package/dist/index.js +7 -5
- 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/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 +3571 -3623
package/README.md
CHANGED
|
@@ -12,17 +12,13 @@ npm install @surflane/ui @surflane/design-tokens
|
|
|
12
12
|
|
|
13
13
|
## Usage
|
|
14
14
|
|
|
15
|
-
Import the stylesheets once at the application root:
|
|
15
|
+
Import the stylesheets once at the application root. `all.css` brings the tokens, controls, composition, document typography and component styles:
|
|
16
16
|
|
|
17
17
|
```css
|
|
18
|
-
@import '@surflane/
|
|
19
|
-
@import '@surflane/design-tokens/controls.css';
|
|
20
|
-
@import '@surflane/design-tokens/foundations.css';
|
|
21
|
-
@import '@surflane/design-tokens/typography.css';
|
|
22
|
-
@import '@surflane/ui/styles.css';
|
|
18
|
+
@import '@surflane/ui/all.css';
|
|
23
19
|
```
|
|
24
20
|
|
|
25
|
-
Set `data-theme="light"` or `data-theme="dark"` on `<html>` before the first paint and add `pui-typography` to `<body>`.
|
|
21
|
+
The rules sit in `surflane.*` cascade layers, so your unlayered CSS overrides them. Set `data-theme="light"` or `data-theme="dark"` on `<html>` before the first paint and add `pui-typography` to `<body>`. The [install guide](https://surflane.page/install) walks through Vite, Next.js, React Router and Astro, with or without Tailwind CSS.
|
|
26
22
|
|
|
27
23
|
```tsx
|
|
28
24
|
import {
|
|
@@ -47,6 +43,20 @@ export function Example() {
|
|
|
47
43
|
|
|
48
44
|
Compound components are available both as namespaces (`Dialog.Root`) and as flat names (`DialogRoot`). Use flat names in React Server Components, which cannot dot into client exports. Subpath entry points such as `@surflane/ui/button` and `@surflane/ui/dialog` keep bundles small.
|
|
49
45
|
|
|
46
|
+
## Optional components
|
|
47
|
+
|
|
48
|
+
Chart, DatePicker, Markdown, Tree and syntax highlighting have their own entry points, and their libraries are optional peer dependencies. Install a library only when you use its component:
|
|
49
|
+
|
|
50
|
+
| Import | Install |
|
|
51
|
+
| -------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------ |
|
|
52
|
+
| `Chart` from `@surflane/ui/chart` | `recharts` |
|
|
53
|
+
| `DatePicker`, `DateRangePicker`, `TimeField`, `DateLocaleProvider` from `@surflane/ui/date-picker` | `react-aria-components` |
|
|
54
|
+
| `Markdown` from `@surflane/ui/markdown` | `react-markdown remark-gfm` |
|
|
55
|
+
| `Tree` from `@surflane/ui/tree` | `@headless-tree/core @headless-tree/react @tanstack/react-virtual` |
|
|
56
|
+
| `SyntaxHighlighting` from `@surflane/ui/syntax-highlighting` | `shiki` |
|
|
57
|
+
|
|
58
|
+
`CodeBlock` and `SyntaxHighlighter` render plain text until a `<SyntaxHighlighting>` provider wraps them.
|
|
59
|
+
|
|
50
60
|
## Frameworks
|
|
51
61
|
|
|
52
62
|
Next.js (App Router), React Router, Astro and Vite are verified in CI with example applications. See [framework integration](https://github.com/Ashon/surflane/blob/main/docs/frameworks.md) and [examples](https://github.com/Ashon/surflane/tree/main/examples).
|
package/dist/advanced-forms.js
CHANGED
|
@@ -24,21 +24,21 @@ function ComboboxRoot({ children, form, ...props }) {
|
|
|
24
24
|
const [, , revision] = useResetValue(true, true, anchor, form);
|
|
25
25
|
return (_jsxs(BaseCombobox.Root, { ...props, form: form, children: [_jsx("span", { hidden: true, ref: anchor }), children] }, revision));
|
|
26
26
|
}
|
|
27
|
-
const ComboPopup = part(BaseCombobox.Popup, 'pui-combobox-popup');
|
|
28
|
-
const ComboPositioner = part(BaseCombobox.Positioner, 'pui-positioner');
|
|
29
|
-
const ComboContent = React.forwardRef(function ComboContent({ positionerProps, ...props }, ref) {
|
|
27
|
+
const ComboPopup = /* @__PURE__ */ part(BaseCombobox.Popup, 'pui-combobox-popup');
|
|
28
|
+
const ComboPositioner = /* @__PURE__ */ part(BaseCombobox.Positioner, 'pui-positioner');
|
|
29
|
+
const ComboContent = /* @__PURE__ */ React.forwardRef(function ComboContent({ positionerProps, ...props }, ref) {
|
|
30
30
|
return (_jsx(BaseCombobox.Portal, { children: _jsx(ComboPositioner, { sideOffset: 6, ...positionerProps, children: _jsx(ComboPopup, { ...props, ref: ref }) }) }));
|
|
31
31
|
});
|
|
32
|
-
const ComboTrigger = React.forwardRef(function ComboTrigger({ children, className, ...props }, ref) {
|
|
32
|
+
const ComboTrigger = /* @__PURE__ */ React.forwardRef(function ComboTrigger({ children, className, ...props }, ref) {
|
|
33
33
|
return (_jsx(BaseCombobox.Trigger, { "aria-label": 'Show options', ...props, ref: ref, className: skin('pui-combobox-action', className), children: children ?? _jsx(Mark, { kind: 'expand' }) }));
|
|
34
34
|
});
|
|
35
|
-
const ComboClear = React.forwardRef(function ComboClear({ children, className, ...props }, ref) {
|
|
35
|
+
const ComboClear = /* @__PURE__ */ React.forwardRef(function ComboClear({ children, className, ...props }, ref) {
|
|
36
36
|
return (_jsx(BaseCombobox.Clear, { "aria-label": 'Clear selection', ...props, ref: ref, className: skin('pui-combobox-action', className), children: children ?? _jsx(Mark, { kind: 'clear' }) }));
|
|
37
37
|
});
|
|
38
|
-
const ComboIndicator = React.forwardRef(function ComboIndicator({ children, className, ...props }, ref) {
|
|
38
|
+
const ComboIndicator = /* @__PURE__ */ React.forwardRef(function ComboIndicator({ children, className, ...props }, ref) {
|
|
39
39
|
return (_jsx(BaseCombobox.ItemIndicator, { keepMounted: true, ...props, ref: ref, className: skin('pui-combobox-indicator', className), children: children ?? _jsx(Mark, { kind: 'check' }) }));
|
|
40
40
|
});
|
|
41
|
-
const ComboRemove = React.forwardRef(function ComboRemove({ children, className, ...props }, ref) {
|
|
41
|
+
const ComboRemove = /* @__PURE__ */ React.forwardRef(function ComboRemove({ children, className, ...props }, ref) {
|
|
42
42
|
return (_jsx(BaseCombobox.ChipRemove, { ...props, ref: ref, className: skin('pui-combobox-chip-remove', className), children: children ?? _jsx(Mark, { kind: 'clear' }) }));
|
|
43
43
|
});
|
|
44
44
|
export const Combobox = {
|
|
@@ -51,19 +51,19 @@ export const Combobox = {
|
|
|
51
51
|
Clear: ComboClear,
|
|
52
52
|
ItemIndicator: ComboIndicator,
|
|
53
53
|
ChipRemove: ComboRemove,
|
|
54
|
-
Input: part(BaseCombobox.Input, 'pui-input pui-combobox-input'),
|
|
55
|
-
InputGroup: part(BaseCombobox.InputGroup, 'pui-combobox-group'),
|
|
56
|
-
List: part(BaseCombobox.List, 'pui-combobox-list scroll-area'),
|
|
57
|
-
Item: part(BaseCombobox.Item, 'pui-combobox-item'),
|
|
58
|
-
Empty: part(BaseCombobox.Empty, 'pui-combobox-empty'),
|
|
59
|
-
Status: part(BaseCombobox.Status, 'pui-combobox-status'),
|
|
60
|
-
Group: part(BaseCombobox.Group, 'pui-combobox-section'),
|
|
61
|
-
GroupLabel: part(BaseCombobox.GroupLabel, 'pui-combobox-section-label'),
|
|
62
|
-
Separator: part(BaseCombobox.Separator, 'pui-combobox-separator'),
|
|
63
|
-
Chips: part(BaseCombobox.Chips, 'pui-combobox-chips'),
|
|
64
|
-
Chip: part(BaseCombobox.Chip, 'pui-combobox-chip'),
|
|
54
|
+
Input: /* @__PURE__ */ part(BaseCombobox.Input, 'pui-input pui-combobox-input'),
|
|
55
|
+
InputGroup: /* @__PURE__ */ part(BaseCombobox.InputGroup, 'pui-combobox-group'),
|
|
56
|
+
List: /* @__PURE__ */ part(BaseCombobox.List, 'pui-combobox-list scroll-area'),
|
|
57
|
+
Item: /* @__PURE__ */ part(BaseCombobox.Item, 'pui-combobox-item'),
|
|
58
|
+
Empty: /* @__PURE__ */ part(BaseCombobox.Empty, 'pui-combobox-empty'),
|
|
59
|
+
Status: /* @__PURE__ */ part(BaseCombobox.Status, 'pui-combobox-status'),
|
|
60
|
+
Group: /* @__PURE__ */ part(BaseCombobox.Group, 'pui-combobox-section'),
|
|
61
|
+
GroupLabel: /* @__PURE__ */ part(BaseCombobox.GroupLabel, 'pui-combobox-section-label'),
|
|
62
|
+
Separator: /* @__PURE__ */ part(BaseCombobox.Separator, 'pui-combobox-separator'),
|
|
63
|
+
Chips: /* @__PURE__ */ part(BaseCombobox.Chips, 'pui-combobox-chips'),
|
|
64
|
+
Chip: /* @__PURE__ */ part(BaseCombobox.Chip, 'pui-combobox-chip'),
|
|
65
65
|
};
|
|
66
|
-
const NumberRoot = React.forwardRef(function NumberRoot({ value, defaultValue, onValueChange, className, form, ...props }, ref) {
|
|
66
|
+
const NumberRoot = /* @__PURE__ */ React.forwardRef(function NumberRoot({ value, defaultValue, onValueChange, className, form, ...props }, ref) {
|
|
67
67
|
const [element, attach] = useRootRef(ref);
|
|
68
68
|
const [numeric, setNumeric] = useResetValue(value, defaultValue ?? null, element, form);
|
|
69
69
|
return (_jsx(BaseNumberField.Root, { ...props, form: form, ref: attach, value: numeric, className: skin('pui-number-field', className), onValueChange: (next, event) => {
|
|
@@ -72,10 +72,10 @@ const NumberRoot = React.forwardRef(function NumberRoot({ value, defaultValue, o
|
|
|
72
72
|
setNumeric(next);
|
|
73
73
|
} }));
|
|
74
74
|
});
|
|
75
|
-
const NumberIncrement = React.forwardRef(function NumberIncrement({ className, children, ...props }, ref) {
|
|
75
|
+
const NumberIncrement = /* @__PURE__ */ React.forwardRef(function NumberIncrement({ className, children, ...props }, ref) {
|
|
76
76
|
return (_jsx(BaseNumberField.Increment, { "aria-label": 'Increase value', ...props, ref: ref, className: skin('pui-number-step', className), children: children ?? _jsx(Mark, { kind: 'plus' }) }));
|
|
77
77
|
});
|
|
78
|
-
const NumberDecrement = React.forwardRef(function NumberDecrement({ className, children, ...props }, ref) {
|
|
78
|
+
const NumberDecrement = /* @__PURE__ */ React.forwardRef(function NumberDecrement({ className, children, ...props }, ref) {
|
|
79
79
|
return (_jsx(BaseNumberField.Decrement, { "aria-label": 'Decrease value', ...props, ref: ref, className: skin('pui-number-step', className), children: children ?? _jsx(Mark, { kind: 'minus' }) }));
|
|
80
80
|
});
|
|
81
81
|
export const NumberField = {
|
|
@@ -83,9 +83,9 @@ export const NumberField = {
|
|
|
83
83
|
Root: NumberRoot,
|
|
84
84
|
Increment: NumberIncrement,
|
|
85
85
|
Decrement: NumberDecrement,
|
|
86
|
-
Group: part(BaseNumberField.Group, 'pui-number-group'),
|
|
87
|
-
Input: part(BaseNumberField.Input, 'pui-number-input'),
|
|
88
|
-
ScrubArea: part(BaseNumberField.ScrubArea, 'pui-number-scrub'),
|
|
86
|
+
Group: /* @__PURE__ */ part(BaseNumberField.Group, 'pui-number-group'),
|
|
87
|
+
Input: /* @__PURE__ */ part(BaseNumberField.Input, 'pui-number-input'),
|
|
88
|
+
ScrubArea: /* @__PURE__ */ part(BaseNumberField.ScrubArea, 'pui-number-scrub'),
|
|
89
89
|
};
|
|
90
90
|
// Flat names for React Server Components, which cannot dot into client exports.
|
|
91
91
|
export { ComboboxRoot };
|
package/dist/app-shell.js
CHANGED
|
@@ -3,32 +3,32 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
const skin = (base, extra) => [base, extra].filter(Boolean).join(' ');
|
|
5
5
|
/** Layout only. Routing, session, theme and mobile disclosure belong to the caller. */
|
|
6
|
-
const Root = React.forwardRef(function AppShellRoot({ collapsed = false, layout = 'header', className, ...props }, ref) {
|
|
6
|
+
const Root = /* @__PURE__ */ React.forwardRef(function AppShellRoot({ collapsed = false, layout = 'header', className, ...props }, ref) {
|
|
7
7
|
return (_jsx("div", { ...props, ref: ref, "data-layout": layout, "data-sidebar": collapsed ? 'collapsed' : 'expanded', className: skin('pui-app-shell', className) }));
|
|
8
8
|
});
|
|
9
|
-
const Header = React.forwardRef(function AppShellHeader({ className, ...props }, ref) {
|
|
9
|
+
const Header = /* @__PURE__ */ React.forwardRef(function AppShellHeader({ className, ...props }, ref) {
|
|
10
10
|
return (_jsx("div", { ...props, ref: ref, className: skin('pui-app-shell-header', className) }));
|
|
11
11
|
});
|
|
12
|
-
const Sidebar = React.forwardRef(function AppShellSidebar({ className, ...props }, ref) {
|
|
12
|
+
const Sidebar = /* @__PURE__ */ React.forwardRef(function AppShellSidebar({ className, ...props }, ref) {
|
|
13
13
|
return (_jsx("aside", { ...props, ref: ref, className: skin('pui-app-shell-sidebar', className) }));
|
|
14
14
|
});
|
|
15
|
-
const Content = React.forwardRef(function AppShellContent({ className, ...props }, ref) {
|
|
15
|
+
const Content = /* @__PURE__ */ React.forwardRef(function AppShellContent({ className, ...props }, ref) {
|
|
16
16
|
return (_jsx("div", { ...props, ref: ref, className: skin('pui-app-shell-content', className) }));
|
|
17
17
|
});
|
|
18
18
|
/**
|
|
19
19
|
* The page surface inside a workspace Content. It insets from the shell on every
|
|
20
20
|
* side but the sidebar's; without the sidebar, on narrow screens, it insets evenly.
|
|
21
21
|
*/
|
|
22
|
-
const Page = React.forwardRef(function AppShellPage({ className, ...props }, ref) {
|
|
22
|
+
const Page = /* @__PURE__ */ React.forwardRef(function AppShellPage({ className, ...props }, ref) {
|
|
23
23
|
return (_jsx("div", { ...props, ref: ref, className: skin('pui-app-shell-page', className) }));
|
|
24
24
|
});
|
|
25
|
-
const Footer = React.forwardRef(function AppShellFooter({ className, ...props }, ref) {
|
|
25
|
+
const Footer = /* @__PURE__ */ React.forwardRef(function AppShellFooter({ className, ...props }, ref) {
|
|
26
26
|
return (_jsx("div", { ...props, ref: ref, className: skin('pui-app-shell-footer', className) }));
|
|
27
27
|
});
|
|
28
|
-
const Label = React.forwardRef(function AppShellLabel({ className, ...props }, ref) {
|
|
28
|
+
const Label = /* @__PURE__ */ React.forwardRef(function AppShellLabel({ className, ...props }, ref) {
|
|
29
29
|
return (_jsx("span", { ...props, ref: ref, className: skin('pui-app-shell-label', className) }));
|
|
30
30
|
});
|
|
31
|
-
const Link = React.forwardRef(function AppShellLink({ icon, label, className, ...props }, ref) {
|
|
31
|
+
const Link = /* @__PURE__ */ React.forwardRef(function AppShellLink({ icon, label, className, ...props }, ref) {
|
|
32
32
|
return (_jsxs("a", { ...props, ref: ref, "aria-label": props['aria-label'] ?? label, className: skin('pui-app-shell-link', className), children: [_jsx("span", { className: 'pui-app-shell-icon', "aria-hidden": 'true', children: icon }), _jsx(Label, { "aria-hidden": 'true', children: label })] }));
|
|
33
33
|
});
|
|
34
34
|
export const AppShell = {
|
package/dist/avatar.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type ComponentSizeAlias } from './sizing.js';
|
|
3
|
+
declare const AvatarRoot: React.ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react/avatar").AvatarRootProps, "ref"> & React.RefAttributes<HTMLSpanElement>, "ref"> & {
|
|
4
|
+
size?: ComponentSizeAlias;
|
|
5
|
+
} & React.RefAttributes<HTMLSpanElement>>;
|
|
6
|
+
declare const AvatarFallback: React.ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react/avatar").AvatarFallbackProps, "ref"> & React.RefAttributes<HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLSpanElement>>;
|
|
7
|
+
export declare const Avatar: {
|
|
8
|
+
Root: React.ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react/avatar").AvatarRootProps, "ref"> & React.RefAttributes<HTMLSpanElement>, "ref"> & {
|
|
9
|
+
size?: ComponentSizeAlias;
|
|
10
|
+
} & React.RefAttributes<HTMLSpanElement>>;
|
|
11
|
+
Status: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref">, "size"> & {
|
|
12
|
+
size?: import("./sizing.js").ComponentSize;
|
|
13
|
+
} & React.RefAttributes<HTMLSpanElement>>;
|
|
14
|
+
Fallback: React.ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react/avatar").AvatarFallbackProps, "ref"> & React.RefAttributes<HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLSpanElement>>;
|
|
15
|
+
Image: React.ForwardRefExoticComponent<Omit<Omit<Omit<import("@base-ui/react/avatar").AvatarImageProps, "ref"> & React.RefAttributes<HTMLImageElement>, "ref">, "size"> & {
|
|
16
|
+
size?: import("./sizing.js").ComponentSize;
|
|
17
|
+
} & React.RefAttributes<HTMLImageElement>>;
|
|
18
|
+
};
|
|
19
|
+
export { AvatarFallback, AvatarRoot };
|
|
20
|
+
export declare const AvatarImage: React.ForwardRefExoticComponent<Omit<Omit<Omit<import("@base-ui/react/avatar").AvatarImageProps, "ref"> & React.RefAttributes<HTMLImageElement>, "ref">, "size"> & {
|
|
21
|
+
size?: import("./sizing.js").ComponentSize;
|
|
22
|
+
} & React.RefAttributes<HTMLImageElement>>, AvatarStatus: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref">, "size"> & {
|
|
23
|
+
size?: import("./sizing.js").ComponentSize;
|
|
24
|
+
} & React.RefAttributes<HTMLSpanElement>>;
|
package/dist/avatar.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { Avatar as BaseAvatar } from '@base-ui/react/avatar';
|
|
5
|
+
import { useComponentSize } from './sizing.js';
|
|
6
|
+
import { sizeName, skin, part } from './parts.js';
|
|
7
|
+
const AvatarRoot = /* @__PURE__ */ React.forwardRef(function AvatarRoot({ size, className, ...props }, ref) {
|
|
8
|
+
const scheme = useComponentSize(size);
|
|
9
|
+
return (_jsx(BaseAvatar.Root, { ...props, ref: ref, "data-size": sizeName(size), "data-ui-size": scheme, className: skin('pui-avatar', className) }));
|
|
10
|
+
});
|
|
11
|
+
function Person() {
|
|
12
|
+
return (_jsxs("svg", { width: '18', height: '18', viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', strokeWidth: '1.5', "aria-hidden": 'true', children: [_jsx("circle", { cx: '12', cy: '8', r: '4' }), _jsx("path", { d: 'M4 21v-2a8 8 0 0 1 16 0v2' })] }));
|
|
13
|
+
}
|
|
14
|
+
const AvatarFallback = /* @__PURE__ */ React.forwardRef(function AvatarFallback({ children, className, ...props }, ref) {
|
|
15
|
+
return (_jsx(BaseAvatar.Fallback, { ...props, ref: ref, className: skin('pui-avatar-fallback', className), children: children ?? _jsx(Person, {}) }));
|
|
16
|
+
});
|
|
17
|
+
export const Avatar = {
|
|
18
|
+
...BaseAvatar,
|
|
19
|
+
Root: AvatarRoot,
|
|
20
|
+
Status: /* @__PURE__ */ part('span', 'pui-avatar-status'),
|
|
21
|
+
Fallback: AvatarFallback,
|
|
22
|
+
Image: /* @__PURE__ */ part(BaseAvatar.Image, 'pui-avatar-image'),
|
|
23
|
+
};
|
|
24
|
+
// Flat names for React Server Components, which cannot dot into client exports.
|
|
25
|
+
export { AvatarFallback, AvatarRoot };
|
|
26
|
+
export const { Image: AvatarImage, Status: AvatarStatus } = Avatar;
|
package/dist/button.js
CHANGED
|
@@ -3,8 +3,8 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { Button as BaseButton } from '@base-ui/react/button';
|
|
5
5
|
import { useComponentSize } from './sizing.js';
|
|
6
|
-
import { skin } from './parts.js';
|
|
7
|
-
export const Button = React.forwardRef(function Button({ className, variant = 'default', size, ...props }, ref) {
|
|
6
|
+
import { sizeName, skin } from './parts.js';
|
|
7
|
+
export const Button = /* @__PURE__ */ React.forwardRef(function Button({ className, variant = 'default', size, ...props }, ref) {
|
|
8
8
|
const scheme = useComponentSize(size === 'icon-sm' || size === 'icon-xs'
|
|
9
9
|
? 'small'
|
|
10
10
|
: size === 'icon-lg'
|
|
@@ -12,5 +12,5 @@ export const Button = React.forwardRef(function Button({ className, variant = 'd
|
|
|
12
12
|
: size === 'xs' || size === 'icon'
|
|
13
13
|
? undefined
|
|
14
14
|
: size);
|
|
15
|
-
return (_jsx(BaseButton, { ref: ref, ...props, className: skin('pui-button', className), "data-variant": variant, "data-size": size, "data-ui-size": scheme }));
|
|
15
|
+
return (_jsx(BaseButton, { ref: ref, ...props, className: skin('pui-button', className), "data-variant": variant, "data-size": sizeName(size), "data-ui-size": scheme }));
|
|
16
16
|
});
|
package/dist/chart.js
CHANGED
|
@@ -20,7 +20,7 @@ function Pattern({ id, index, color, }) {
|
|
|
20
20
|
}
|
|
21
21
|
/** Cartesian trends with a persistent, keyboard-readable tooltip region and a
|
|
22
22
|
* full data-table alternative. Missing values are gaps, never fabricated zeros. */
|
|
23
|
-
export const Chart = React.forwardRef(function Chart({ title, description, data, series, unit, xLabel, yLabel, type = 'line', height = 280, locale = 'en-US', formatValue, missingLabel = 'Not available', emptyLabel = 'No numeric measurements to display.', hiddenSeries, defaultHiddenSeries = [], onHiddenSeriesChange, className, ...props }, ref) {
|
|
23
|
+
export const Chart = /* @__PURE__ */ React.forwardRef(function Chart({ title, description, data, series, unit, xLabel, yLabel, type = 'line', height = 280, locale = 'en-US', formatValue, missingLabel = 'Not available', emptyLabel = 'No numeric measurements to display.', hiddenSeries, defaultHiddenSeries = [], onHiddenSeriesChange, className, ...props }, ref) {
|
|
24
24
|
const id = React.useId().replace(/[^a-zA-Z0-9_-]/g, '_');
|
|
25
25
|
const [internalHidden, setInternalHidden] = React.useState(defaultHiddenSeries);
|
|
26
26
|
const hidden = new Set(hiddenSeries ?? internalHidden);
|
|
@@ -85,13 +85,16 @@ export const Chart = React.forwardRef(function Chart({ title, description, data,
|
|
|
85
85
|
return (_jsxs("figure", { ...props, ref: ref, className: ['pui-chart', className].filter(Boolean).join(' '), "aria-labelledby": `${id}-title`, children: [_jsxs("figcaption", { className: 'pui-chart-caption', children: [_jsx("strong", { id: `${id}-title`, children: title }), _jsx("p", { id: `${id}-summary`, children: description })] }), _jsx("ul", { className: 'pui-chart-legend', "aria-label": `${title} series`, children: series.map((s, index) => (_jsx("li", { children: _jsxs("button", { ref: index === 0 ? firstLegend : undefined, type: 'button', className: 'pui-chart-legend-button', "aria-label": `${s.label} series`, "aria-pressed": !hidden.has(s.key), onClick: () => toggle(s.key), children: [_jsx("svg", { width: '32', height: '20', viewBox: '0 0 32 20', "aria-hidden": 'true', children: type === 'bar' ? (_jsxs(_Fragment, { children: [_jsx("defs", { children: _jsx(Pattern, { id: `${id}-legend-${index}`, color: colorFor(index), index: index }) }), _jsx("rect", { x: '4', y: '3', width: '24', height: '14', rx: '2', fill: `url(#${id}-legend-${index})` })] })) : (_jsxs(_Fragment, { children: [_jsx("path", { d: 'M1 10h30', stroke: colorFor(index), strokeWidth: '2', strokeDasharray: dashes[index % dashes.length] }), _jsx(Marker, { cx: 16, cy: 10, index: index, color: colorFor(index) })] })) }), _jsx("span", { children: s.label })] }) }, s.key))) }), _jsxs("p", { className: 'pui-chart-axis-label', children: [yLabel, " (", unit, ")"] }), hasValues ? (_jsxs(_Fragment, { children: [_jsx("p", { className: 'pui-chart-help', id: `${id}-keys`, children: "Focus the chart and use Left/Right to inspect points. Escape clears details. The data table includes every series." }), _jsx("div", { className: 'pui-chart-plot', onKeyDownCapture: (event) => {
|
|
86
86
|
if (event.key === 'Escape')
|
|
87
87
|
setDismissed(true);
|
|
88
|
-
else if (event.key === 'ArrowLeft' ||
|
|
88
|
+
else if (event.key === 'ArrowLeft' ||
|
|
89
|
+
event.key === 'ArrowRight')
|
|
89
90
|
setDismissed(false);
|
|
90
91
|
}, onMouseMoveCapture: () => setDismissed(false), onTouchStartCapture: () => setDismissed(false), onFocusCapture: () => setDismissed(false), children: _jsx(ResponsiveContainer, { width: '100%', height: chartHeight, minWidth: 0, initialDimension: { width: 320, height: chartHeight }, children: _jsxs(ComposedChart, { data: rows, accessibilityLayer: true, role: 'application', "aria-label": title, "aria-describedby": `${id}-summary ${id}-keys`, margin: { top: 16, right: 20, bottom: 8, left: 0 }, children: [_jsx("defs", { children: series.map((s, index) => (_jsx(Pattern, { id: `${id}-pattern-${index}`, index: index, color: colorFor(index) }, s.key))) }), _jsx(CartesianGrid, { vertical: false, stroke: 'var(--line)' }), _jsx(XAxis, { dataKey: 'id', tickFormatter: (value) => {
|
|
91
92
|
const label = byId.get(String(value))?.label ?? String(value);
|
|
92
93
|
// minTickGap already drops ticks that would overlap; the cap
|
|
93
94
|
// only keeps one very long label from crowding the axis.
|
|
94
|
-
return label.length > 24
|
|
95
|
+
return label.length > 24
|
|
96
|
+
? label.slice(0, 23) + '…'
|
|
97
|
+
: label;
|
|
95
98
|
}, tick: { fill: 'var(--ink-muted)', fontSize: 12 }, tickLine: false, axisLine: { stroke: 'var(--line)' }, minTickGap: 24, interval: 'preserveStartEnd' }), _jsx(YAxis, { width: 56, tickFormatter: (value) => compact.format(Number(value)), tick: { fill: 'var(--ink-muted)', fontSize: 12 }, tickLine: false, axisLine: false, domain: [min, max === min ? max + 1 : max] }), _jsx(ReferenceLine, { y: 0, stroke: 'var(--ink-muted)' }), host && (_jsx(Tooltip, { portal: host, isAnimationActive: false, active: dismissed ? false : undefined, filterNull: false, cursor: dismissed
|
|
96
99
|
? false
|
|
97
100
|
: {
|
package/dist/chevron.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
/** The disclosure and breadcrumb chevron. Internal: not exported from the package. */
|
|
4
|
+
export function Chevron() {
|
|
5
|
+
return (_jsx("svg", { className: 'pui-disclosure-chevron', width: '16', height: '16', viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', strokeWidth: '1.5', "aria-hidden": 'true', children: _jsx("path", { d: 'm9 6 6 6-6 6' }) }));
|
|
6
|
+
}
|
package/dist/commands.js
CHANGED
|
@@ -5,23 +5,23 @@ import { Toggle as BaseToggle } from '@base-ui/react/toggle';
|
|
|
5
5
|
import { ToggleGroup as BaseToggleGroup } from '@base-ui/react/toggle-group';
|
|
6
6
|
import { Toolbar as BaseToolbar } from '@base-ui/react/toolbar';
|
|
7
7
|
import { Menubar as BaseMenubar } from '@base-ui/react/menubar';
|
|
8
|
-
import { skin, part } from './parts.js';
|
|
8
|
+
import { sizeName, skin, part } from './parts.js';
|
|
9
9
|
export function Toggle({ className, size, ref, ...props }) {
|
|
10
10
|
const scheme = useComponentSize(size === 'icon' ? undefined : size);
|
|
11
|
-
return (_jsx(BaseToggle, { ...props, ref: ref, className: skin('pui-button pui-toggle', className), "data-size": size, "data-ui-size": scheme }));
|
|
11
|
+
return (_jsx(BaseToggle, { ...props, ref: ref, className: skin('pui-button pui-toggle', className), "data-size": sizeName(size), "data-ui-size": scheme }));
|
|
12
12
|
}
|
|
13
13
|
export function ToggleGroup({ className, ref, ...props }) {
|
|
14
14
|
return (_jsx(BaseToggleGroup, { ...props, ref: ref, className: skin('pui-toggle-group', className) }));
|
|
15
15
|
}
|
|
16
16
|
export const Toolbar = {
|
|
17
17
|
...BaseToolbar,
|
|
18
|
-
Root: part(BaseToolbar.Root, 'pui-toolbar'),
|
|
19
|
-
Group: part(BaseToolbar.Group, 'pui-toolbar-group'),
|
|
20
|
-
Button: part(BaseToolbar.Button, 'pui-button pui-toolbar-button'),
|
|
21
|
-
Link: part(BaseToolbar.Link, 'pui-button pui-toolbar-link'),
|
|
22
|
-
Input: part(BaseToolbar.Input, 'pui-input pui-toolbar-input'),
|
|
23
|
-
Separator: part(BaseToolbar.Separator, 'pui-toolbar-separator'),
|
|
18
|
+
Root: /* @__PURE__ */ part(BaseToolbar.Root, 'pui-toolbar'),
|
|
19
|
+
Group: /* @__PURE__ */ part(BaseToolbar.Group, 'pui-toolbar-group'),
|
|
20
|
+
Button: /* @__PURE__ */ part(BaseToolbar.Button, 'pui-button pui-toolbar-button'),
|
|
21
|
+
Link: /* @__PURE__ */ part(BaseToolbar.Link, 'pui-button pui-toolbar-link'),
|
|
22
|
+
Input: /* @__PURE__ */ part(BaseToolbar.Input, 'pui-input pui-toolbar-input'),
|
|
23
|
+
Separator: /* @__PURE__ */ part(BaseToolbar.Separator, 'pui-toolbar-separator'),
|
|
24
24
|
};
|
|
25
|
-
export const Menubar = part(BaseMenubar, 'pui-menubar');
|
|
25
|
+
export const Menubar = /* @__PURE__ */ part(BaseMenubar, 'pui-menubar');
|
|
26
26
|
// Flat names for React Server Components, which cannot dot into client exports.
|
|
27
27
|
export const { Button: ToolbarButton, Group: ToolbarGroup, Input: ToolbarInput, Link: ToolbarLink, Root: ToolbarRoot, Separator: ToolbarSeparator, } = Toolbar;
|
package/dist/content.js
CHANGED
|
@@ -6,10 +6,10 @@ import { part } from './parts.js';
|
|
|
6
6
|
import { Button } from './button.js';
|
|
7
7
|
import { SyntaxHighlighter } from './syntax-highlighter.js';
|
|
8
8
|
import { ScrollArea } from './scroll-area.js';
|
|
9
|
-
const CardRoot = React.forwardRef(function CardRoot({ className, padding, ...props }, ref) {
|
|
9
|
+
const CardRoot = /* @__PURE__ */ React.forwardRef(function CardRoot({ className, padding, ...props }, ref) {
|
|
10
10
|
return (_jsx(Surface, { ...props, padding: padding, ref: ref, className: ['pui-card', className].filter(Boolean).join(' ') }));
|
|
11
11
|
});
|
|
12
|
-
const CardTitle = React.forwardRef(function CardTitle({ level = 3, className, ...props }, ref) {
|
|
12
|
+
const CardTitle = /* @__PURE__ */ React.forwardRef(function CardTitle({ level = 3, className, ...props }, ref) {
|
|
13
13
|
return React.createElement(`h${level}`, {
|
|
14
14
|
...props,
|
|
15
15
|
ref,
|
|
@@ -18,11 +18,11 @@ const CardTitle = React.forwardRef(function CardTitle({ level = 3, className, ..
|
|
|
18
18
|
});
|
|
19
19
|
export const Card = {
|
|
20
20
|
Root: CardRoot,
|
|
21
|
-
Header: part('div', 'pui-card-header'),
|
|
21
|
+
Header: /* @__PURE__ */ part('div', 'pui-card-header'),
|
|
22
22
|
Title: CardTitle,
|
|
23
|
-
Description: part('p', 'pui-card-description'),
|
|
24
|
-
Body: part('div', 'pui-card-body'),
|
|
25
|
-
Footer: part('div', 'pui-card-footer'),
|
|
23
|
+
Description: /* @__PURE__ */ part('p', 'pui-card-description'),
|
|
24
|
+
Body: /* @__PURE__ */ part('div', 'pui-card-body'),
|
|
25
|
+
Footer: /* @__PURE__ */ part('div', 'pui-card-footer'),
|
|
26
26
|
};
|
|
27
27
|
const copyIcons = {
|
|
28
28
|
idle: (_jsxs(_Fragment, { children: [_jsx("rect", { x: '8', y: '8', width: '12', height: '12', rx: '2' }), _jsx("path", { d: 'M16 8V4H4v12h4' })] })),
|
|
@@ -31,7 +31,7 @@ const copyIcons = {
|
|
|
31
31
|
};
|
|
32
32
|
// Feedback stays inside the copy button and returns to the action after this long.
|
|
33
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) {
|
|
34
|
+
export const CodeBlock = /* @__PURE__ */ React.forwardRef(function CodeBlock({ code, label = 'Code', language, wrap = false, copyLabel = 'Copy code', copiedLabel = 'Copied', copyErrorLabel = 'Copy unavailable', onCopy, className, ...props }, ref) {
|
|
35
35
|
const [state, setState] = React.useState('idle');
|
|
36
36
|
// After the first copy, each change of label fades in; the first render does not.
|
|
37
37
|
const [used, setUsed] = React.useState(false);
|
|
@@ -50,6 +50,8 @@ export const CodeBlock = React.forwardRef(function CodeBlock({ code, label = 'Co
|
|
|
50
50
|
clearTimeout(timer.current);
|
|
51
51
|
setState('idle');
|
|
52
52
|
}, [code]);
|
|
53
|
+
const resting = React.useRef(true);
|
|
54
|
+
resting.current = state === 'idle';
|
|
53
55
|
// The button keeps its resting width, so the feedback never moves the toolbar.
|
|
54
56
|
React.useLayoutEffect(() => {
|
|
55
57
|
const element = button.current;
|
|
@@ -60,8 +62,9 @@ export const CodeBlock = React.forwardRef(function CodeBlock({ code, label = 'Co
|
|
|
60
62
|
element.style.minInlineSize = `${element.getBoundingClientRect().width}px`;
|
|
61
63
|
};
|
|
62
64
|
measure();
|
|
65
|
+
// Fonts can finish loading after a copy; the result label must not set the width.
|
|
63
66
|
document.fonts?.ready.then(() => {
|
|
64
|
-
if (mounted.current)
|
|
67
|
+
if (mounted.current && resting.current)
|
|
65
68
|
measure();
|
|
66
69
|
});
|
|
67
70
|
}, [copyLabel, state]);
|
package/dist/context-overlays.js
CHANGED
|
@@ -5,14 +5,14 @@ import { ContextMenu as BaseContextMenu } from '@base-ui/react/context-menu';
|
|
|
5
5
|
import { PreviewCard as BasePreviewCard } from '@base-ui/react/preview-card';
|
|
6
6
|
import { Menu } from './menu.js';
|
|
7
7
|
import { part, skin } from './parts.js';
|
|
8
|
-
const ContextPositioner = part(BaseContextMenu.Positioner, 'pui-positioner');
|
|
9
|
-
const ContextContent = React.forwardRef(function ContextContent({ positionerProps, ...props }, ref) {
|
|
8
|
+
const ContextPositioner = /* @__PURE__ */ part(BaseContextMenu.Positioner, 'pui-positioner');
|
|
9
|
+
const ContextContent = /* @__PURE__ */ 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, 'pui-context-trigger'),
|
|
15
|
+
Trigger: /* @__PURE__ */ part(BaseContextMenu.Trigger, 'pui-context-trigger'),
|
|
16
16
|
Positioner: ContextPositioner,
|
|
17
17
|
Content: ContextContent,
|
|
18
18
|
Popup: Menu.Popup,
|
|
@@ -26,16 +26,16 @@ export const ContextMenu = {
|
|
|
26
26
|
Separator: Menu.Separator,
|
|
27
27
|
SubmenuTrigger: Menu.SubmenuTrigger,
|
|
28
28
|
};
|
|
29
|
-
const PreviewPositioner = part(BasePreviewCard.Positioner, 'pui-positioner');
|
|
29
|
+
const PreviewPositioner = /* @__PURE__ */ part(BasePreviewCard.Positioner, 'pui-positioner');
|
|
30
30
|
// The preview is visual enhancement; its destination is the accessible interface.
|
|
31
|
-
const PreviewPopup = React.forwardRef(function PreviewPopup({ className, ...props }, ref) {
|
|
31
|
+
const PreviewPopup = /* @__PURE__ */ React.forwardRef(function PreviewPopup({ className, ...props }, ref) {
|
|
32
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
36
|
return (_jsx(BasePreviewCard.Trigger, { ...rest, className: skin('pui-link pui-preview-trigger', className) }));
|
|
37
37
|
}
|
|
38
|
-
const PreviewContent = React.forwardRef(function PreviewContent({ positionerProps, ...props }, ref) {
|
|
38
|
+
const PreviewContent = /* @__PURE__ */ React.forwardRef(function PreviewContent({ positionerProps, ...props }, ref) {
|
|
39
39
|
return (_jsx(PreviewPositioner, { sideOffset: 8, collisionPadding: 12, ...positionerProps, children: _jsx(PreviewPopup, { ...props, ref: ref }) }));
|
|
40
40
|
});
|
|
41
41
|
export const PreviewCard = {
|
package/dist/data.js
CHANGED
|
@@ -4,24 +4,24 @@ import * as React from 'react';
|
|
|
4
4
|
import { Button } from './button.js';
|
|
5
5
|
import { part } from './parts.js';
|
|
6
6
|
import { ScrollArea } from './scroll-area.js';
|
|
7
|
-
const TableContainer = React.forwardRef(function TableContainer(props, ref) {
|
|
7
|
+
const TableContainer = /* @__PURE__ */ React.forwardRef(function TableContainer(props, ref) {
|
|
8
8
|
return _jsx(ScrollArea, { ...props, ref: ref });
|
|
9
9
|
});
|
|
10
|
-
const RootPart = part('table', 'pui-table');
|
|
11
|
-
const TableRoot = React.forwardRef(function TableRoot({ density, stickyHeader, ...props }, ref) {
|
|
10
|
+
const RootPart = /* @__PURE__ */ part('table', 'pui-table');
|
|
11
|
+
const TableRoot = /* @__PURE__ */ React.forwardRef(function TableRoot({ density, stickyHeader, ...props }, ref) {
|
|
12
12
|
return (_jsx(RootPart, { ...props, ref: ref, "data-density": density === 'compact' ? 'compact' : undefined, "data-sticky-header": stickyHeader || undefined }));
|
|
13
13
|
});
|
|
14
14
|
const layout = ({ align, numeric }) => ({
|
|
15
15
|
'data-align': numeric ? 'end' : align,
|
|
16
16
|
'data-numeric': numeric || undefined,
|
|
17
17
|
});
|
|
18
|
-
const HeaderCellPart = part('th', 'pui-table-cell pui-table-header');
|
|
19
|
-
const CellPart = part('td', 'pui-table-cell');
|
|
18
|
+
const HeaderCellPart = /* @__PURE__ */ part('th', 'pui-table-cell pui-table-header');
|
|
19
|
+
const CellPart = /* @__PURE__ */ part('td', 'pui-table-cell');
|
|
20
20
|
// align replaces the obsolete HTML align attribute of th and td.
|
|
21
|
-
const TableHeaderCell = React.forwardRef(function TableHeaderCell({ align, numeric, ...props }, ref) {
|
|
21
|
+
const TableHeaderCell = /* @__PURE__ */ React.forwardRef(function TableHeaderCell({ align, numeric, ...props }, ref) {
|
|
22
22
|
return _jsx(HeaderCellPart, { ...props, ...layout({ align, numeric }), ref: ref });
|
|
23
23
|
});
|
|
24
|
-
const TableCell = React.forwardRef(function TableCell({ align, numeric, ...props }, ref) {
|
|
24
|
+
const TableCell = /* @__PURE__ */ React.forwardRef(function TableCell({ align, numeric, ...props }, ref) {
|
|
25
25
|
return _jsx(CellPart, { ...props, ...layout({ align, numeric }), ref: ref });
|
|
26
26
|
});
|
|
27
27
|
function SortIcon({ sort }) {
|
|
@@ -32,29 +32,29 @@ function SortIcon({ sort }) {
|
|
|
32
32
|
: 'm8 9 4-4 4 4m-8 6 4 4 4-4' }) }));
|
|
33
33
|
}
|
|
34
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) {
|
|
35
|
+
const TableSortHeader = /* @__PURE__ */ React.forwardRef(function TableSortHeader({ sort, onSort, disabled, children, className, ...props }, ref) {
|
|
36
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
37
|
});
|
|
38
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) {
|
|
39
|
+
const TableTruncate = /* @__PURE__ */ React.forwardRef(function TableTruncate({ className, title, children, ...props }, ref) {
|
|
40
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
41
|
});
|
|
42
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) {
|
|
43
|
+
const TableMessage = /* @__PURE__ */ React.forwardRef(function TableMessage({ className, ...props }, ref) {
|
|
44
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
45
|
.filter(Boolean)
|
|
46
46
|
.join(' ') }) }));
|
|
47
47
|
});
|
|
48
|
-
const TableRow = React.forwardRef(function TableRow({ selected, className, ...props }, ref) {
|
|
48
|
+
const TableRow = /* @__PURE__ */ React.forwardRef(function TableRow({ selected, className, ...props }, ref) {
|
|
49
49
|
return (_jsx("tr", { ...props, ref: ref, "data-selected": selected || undefined, className: ['pui-table-row', className].filter(Boolean).join(' ') }));
|
|
50
50
|
});
|
|
51
51
|
export const Table = {
|
|
52
52
|
Container: TableContainer,
|
|
53
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'),
|
|
54
|
+
Caption: /* @__PURE__ */ part('caption', 'pui-table-caption'),
|
|
55
|
+
Head: /* @__PURE__ */ part('thead', 'pui-table-head'),
|
|
56
|
+
Body: /* @__PURE__ */ part('tbody', 'pui-table-body'),
|
|
57
|
+
Foot: /* @__PURE__ */ part('tfoot', 'pui-table-foot'),
|
|
58
58
|
Row: TableRow,
|
|
59
59
|
HeaderCell: TableHeaderCell,
|
|
60
60
|
SortHeader: TableSortHeader,
|
|
@@ -62,19 +62,19 @@ export const Table = {
|
|
|
62
62
|
Truncate: TableTruncate,
|
|
63
63
|
Message: TableMessage,
|
|
64
64
|
};
|
|
65
|
-
const ListRoot = React.forwardRef(function ListRoot({ className, ...props }, ref) {
|
|
65
|
+
const ListRoot = /* @__PURE__ */ React.forwardRef(function ListRoot({ className, ...props }, ref) {
|
|
66
66
|
return (_jsx("ul", { role: 'list', ...props, ref: ref, className: ['pui-list', className].filter(Boolean).join(' ') }));
|
|
67
67
|
});
|
|
68
|
-
const ListItem = React.forwardRef(function ListItem({ selected, className, ...props }, ref) {
|
|
68
|
+
const ListItem = /* @__PURE__ */ React.forwardRef(function ListItem({ selected, className, ...props }, ref) {
|
|
69
69
|
return (_jsx("li", { ...props, ref: ref, "data-selected": selected || undefined, className: ['pui-list-item', className].filter(Boolean).join(' ') }));
|
|
70
70
|
});
|
|
71
71
|
export const List = {
|
|
72
72
|
Root: ListRoot,
|
|
73
73
|
Item: ListItem,
|
|
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'),
|
|
74
|
+
Content: /* @__PURE__ */ part('div', 'pui-list-content'),
|
|
75
|
+
Title: /* @__PURE__ */ part('div', 'pui-list-title'),
|
|
76
|
+
Description: /* @__PURE__ */ part('p', 'pui-list-description'),
|
|
77
|
+
Actions: /* @__PURE__ */ part('div', 'pui-list-actions'),
|
|
78
78
|
};
|
|
79
79
|
// Flat names for React Server Components, which cannot dot into client exports.
|
|
80
80
|
export { ListRoot, ListItem, TableContainer, TableRoot, TableRow, TableHeaderCell, TableSortHeader, TableCell, TableTruncate, TableMessage, };
|
package/dist/dialog.js
CHANGED
|
@@ -1,24 +1,25 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import * as React from 'react';
|
|
4
|
+
import { skin } from './parts.js';
|
|
4
5
|
import { useDialogFocusBoundary } from './dialog-focus.js';
|
|
5
6
|
import { useComponentSize } from './sizing.js';
|
|
6
7
|
import { Dialog as BaseDialog } from '@base-ui/react/dialog';
|
|
7
8
|
import { AlertDialog as BaseAlertDialog } from '@base-ui/react/alert-dialog';
|
|
8
9
|
const cx = (...v) => v.filter(Boolean).join(' ');
|
|
9
10
|
/** Visible icon close action; inherits Dialog focus and dismissal behavior. */
|
|
10
|
-
const DialogCloseButton = React.forwardRef(function DialogCloseButton({ className, 'aria-label': label = 'Close dialog', ...props }, ref) {
|
|
11
|
-
return (_jsx(BaseDialog.Close, { ...props, ref: ref, "aria-label": label, className:
|
|
11
|
+
const DialogCloseButton = /* @__PURE__ */ React.forwardRef(function DialogCloseButton({ className, 'aria-label': label = 'Close dialog', ...props }, ref) {
|
|
12
|
+
return (_jsx(BaseDialog.Close, { ...props, ref: ref, "aria-label": label, className: skin('pui-icon-button pui-dialog-close', className), children: _jsx("svg", { width: '18', height: '18', viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', strokeWidth: '1.7', "aria-hidden": 'true', children: _jsx("path", { d: 'm6 6 12 12M18 6 6 18' }) }) }));
|
|
12
13
|
});
|
|
13
|
-
const DialogContent = React.forwardRef(function DialogContent({ className, children, closeLabel = 'Close dialog', closeDisabled, focusBoundaryLabel = 'Continue dialog navigation', ...props }, ref) {
|
|
14
|
+
const DialogContent = /* @__PURE__ */ React.forwardRef(function DialogContent({ className, children, closeLabel = 'Close dialog', closeDisabled, focusBoundaryLabel = 'Continue dialog navigation', ...props }, ref) {
|
|
14
15
|
const scheme = useComponentSize();
|
|
15
16
|
const portalRef = useDialogFocusBoundary(focusBoundaryLabel);
|
|
16
|
-
return (_jsxs(BaseDialog.Portal, { ref: portalRef, children: [_jsx(BaseDialog.Backdrop, { className: 'pui-dialog-backdrop' }), _jsxs(BaseDialog.Popup, { "data-ui-size": scheme, ...props, ref: ref, className:
|
|
17
|
+
return (_jsxs(BaseDialog.Portal, { ref: portalRef, children: [_jsx(BaseDialog.Backdrop, { className: 'pui-dialog-backdrop' }), _jsxs(BaseDialog.Popup, { "data-ui-size": scheme, ...props, ref: ref, className: skin('pui-dialog-popup pui-dialog-content', className), children: [_jsx(DialogCloseButton, { "aria-label": closeLabel, disabled: closeDisabled }), children] })] }));
|
|
17
18
|
});
|
|
18
19
|
function DialogHeader({ className, ...props }) {
|
|
19
20
|
return _jsx("div", { ...props, className: cx('pui-dialog-header', className) });
|
|
20
21
|
}
|
|
21
|
-
const DialogBody = React.forwardRef(function DialogBody({ className, ...props }, ref) {
|
|
22
|
+
const DialogBody = /* @__PURE__ */ React.forwardRef(function DialogBody({ className, ...props }, ref) {
|
|
22
23
|
return (_jsx("div", { ...props, ref: ref, className: cx('pui-dialog-body', className) }));
|
|
23
24
|
});
|
|
24
25
|
function DialogFooter({ className, ...props }) {
|
|
@@ -32,10 +33,10 @@ export const Dialog = {
|
|
|
32
33
|
Footer: DialogFooter,
|
|
33
34
|
CloseButton: DialogCloseButton,
|
|
34
35
|
};
|
|
35
|
-
const AlertDialogContent = React.forwardRef(function AlertDialogContent({ className, focusBoundaryLabel = 'Continue dialog navigation', ...props }, ref) {
|
|
36
|
+
const AlertDialogContent = /* @__PURE__ */ React.forwardRef(function AlertDialogContent({ className, focusBoundaryLabel = 'Continue dialog navigation', ...props }, ref) {
|
|
36
37
|
const scheme = useComponentSize();
|
|
37
38
|
const portalRef = useDialogFocusBoundary(focusBoundaryLabel);
|
|
38
|
-
return (_jsxs(BaseAlertDialog.Portal, { ref: portalRef, children: [_jsx(BaseAlertDialog.Backdrop, { className: 'pui-dialog-backdrop' }), _jsx(BaseAlertDialog.Popup, { "data-ui-size": scheme, ...props, ref: ref, className:
|
|
39
|
+
return (_jsxs(BaseAlertDialog.Portal, { ref: portalRef, children: [_jsx(BaseAlertDialog.Backdrop, { className: 'pui-dialog-backdrop' }), _jsx(BaseAlertDialog.Popup, { "data-ui-size": scheme, ...props, ref: ref, className: skin('pui-dialog-popup pui-dialog-content pui-confirm-content', className) })] }));
|
|
39
40
|
});
|
|
40
41
|
export const AlertDialog = {
|
|
41
42
|
...BaseAlertDialog,
|