@surflane/ui 0.3.0 → 0.5.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.
Files changed (151) hide show
  1. package/README.md +18 -8
  2. package/dist/accordion.d.ts +26 -0
  3. package/dist/accordion.js +27 -0
  4. package/dist/alert-dialog.d.ts +31 -0
  5. package/dist/alert-dialog.js +22 -0
  6. package/dist/app-shell.js +17 -17
  7. package/dist/{input-extensions.d.ts → autocomplete.d.ts} +4 -42
  8. package/dist/{input-extensions.js → autocomplete.js} +12 -31
  9. package/dist/avatar.d.ts +24 -0
  10. package/dist/avatar.js +24 -0
  11. package/dist/badge.d.ts +20 -0
  12. package/dist/badge.js +16 -0
  13. package/dist/breadcrumbs.d.ts +13 -0
  14. package/dist/breadcrumbs.js +31 -0
  15. package/dist/button.d.ts +11 -0
  16. package/dist/button.js +28 -5
  17. package/dist/{content.d.ts → card.d.ts} +6 -24
  18. package/dist/card.js +26 -0
  19. package/dist/chart.d.ts +19 -0
  20. package/dist/chart.js +29 -8
  21. package/dist/checkbox-group.d.ts +2 -0
  22. package/dist/checkbox-group.js +16 -0
  23. package/dist/checkbox.d.ts +9 -0
  24. package/dist/checkbox.js +29 -0
  25. package/dist/choice-label.d.ts +25 -0
  26. package/dist/choice-label.js +14 -0
  27. package/dist/choice.d.ts +7 -0
  28. package/dist/choice.js +3 -0
  29. package/dist/code.d.ts +21 -0
  30. package/dist/{content.js → code.js} +10 -32
  31. package/dist/collapsible.d.ts +18 -0
  32. package/dist/collapsible.js +21 -0
  33. package/dist/{advanced-forms.d.ts → combobox.d.ts} +5 -25
  34. package/dist/combobox.js +57 -0
  35. package/dist/{context-overlays.d.ts → context-menu.d.ts} +6 -28
  36. package/dist/context-menu.js +30 -0
  37. package/dist/date-picker.js +3 -2
  38. package/dist/dialog.d.ts +6 -24
  39. package/dist/dialog.js +9 -21
  40. package/dist/{panels.d.ts → drawer.d.ts} +3 -34
  41. package/dist/drawer.js +47 -0
  42. package/dist/empty-state.d.ts +29 -0
  43. package/dist/empty-state.js +19 -0
  44. package/dist/field.d.ts +42 -0
  45. package/dist/field.js +21 -0
  46. package/dist/fieldset.d.ts +14 -0
  47. package/dist/fieldset.js +10 -0
  48. package/dist/file-upload.d.ts +3 -1
  49. package/dist/file-upload.js +8 -6
  50. package/dist/filter-bar.js +6 -6
  51. package/dist/form.d.ts +2 -0
  52. package/dist/form.js +7 -0
  53. package/dist/icon.d.ts +10 -0
  54. package/dist/icon.js +19 -2
  55. package/dist/index.d.ts +57 -31
  56. package/dist/index.js +71 -31
  57. package/dist/{messages.d.ts → inline-message.d.ts} +0 -28
  58. package/dist/inline-message.js +23 -0
  59. package/dist/input.js +3 -3
  60. package/dist/{foundations.d.ts → layout.d.ts} +5 -23
  61. package/dist/layout.js +40 -0
  62. package/dist/link.d.ts +6 -0
  63. package/dist/link.js +17 -0
  64. package/dist/list.d.ts +33 -0
  65. package/dist/list.js +21 -0
  66. package/dist/markdown.js +7 -7
  67. package/dist/menu.d.ts +7 -5
  68. package/dist/menu.js +24 -20
  69. package/dist/menubar.d.ts +4 -0
  70. package/dist/menubar.js +4 -0
  71. package/dist/meter.d.ts +29 -0
  72. package/dist/meter.js +13 -0
  73. package/dist/native-select.d.ts +8 -0
  74. package/dist/native-select.js +54 -0
  75. package/dist/navigation-menu.js +14 -11
  76. package/dist/number-field.d.ts +23 -0
  77. package/dist/number-field.js +33 -0
  78. package/dist/otp-field.js +4 -4
  79. package/dist/page-header.d.ts +12 -0
  80. package/dist/page-header.js +9 -0
  81. package/dist/pagination.js +4 -5
  82. package/dist/panel.d.ts +13 -0
  83. package/dist/panel.js +13 -0
  84. package/dist/parts.d.ts +22 -1
  85. package/dist/parts.js +40 -7
  86. package/dist/popover.d.ts +23 -6
  87. package/dist/popover.js +17 -7
  88. package/dist/preview-card.d.ts +29 -0
  89. package/dist/preview-card.js +27 -0
  90. package/dist/progress.d.ts +29 -0
  91. package/dist/progress.js +13 -0
  92. package/dist/radio-group.d.ts +16 -0
  93. package/dist/radio-group.js +31 -0
  94. package/dist/scroll-area.js +4 -5
  95. package/dist/select.d.ts +8 -8
  96. package/dist/select.js +19 -53
  97. package/dist/separator.d.ts +4 -0
  98. package/dist/separator.js +8 -0
  99. package/dist/sheet.d.ts +29 -0
  100. package/dist/sheet.js +39 -0
  101. package/dist/sizing.js +1 -1
  102. package/dist/skeleton.d.ts +8 -0
  103. package/dist/skeleton.js +8 -0
  104. package/dist/slider.d.ts +40 -0
  105. package/dist/slider.js +27 -0
  106. package/dist/spinner.d.ts +13 -0
  107. package/dist/spinner.js +10 -0
  108. package/dist/status.d.ts +1 -19
  109. package/dist/status.js +10 -14
  110. package/dist/switch.d.ts +13 -0
  111. package/dist/switch.js +25 -0
  112. package/dist/syntax-context.d.ts +7 -0
  113. package/dist/syntax-context.js +4 -0
  114. package/dist/syntax-highlighter.d.ts +4 -1
  115. package/dist/syntax-highlighter.js +13 -6
  116. package/dist/syntax-highlighting.d.ts +8 -0
  117. package/dist/syntax-highlighting.js +12 -0
  118. package/dist/{data.d.ts → table.d.ts} +8 -32
  119. package/dist/table.js +67 -0
  120. package/dist/tabs.d.ts +29 -0
  121. package/dist/tabs.js +13 -0
  122. package/dist/textarea.d.ts +7 -0
  123. package/dist/textarea.js +12 -0
  124. package/dist/toast.js +18 -17
  125. package/dist/toggle-group.d.ts +5 -0
  126. package/dist/toggle-group.js +7 -0
  127. package/dist/toggle.d.ts +7 -0
  128. package/dist/toggle.js +9 -0
  129. package/dist/{commands.d.ts → toolbar.d.ts} +0 -13
  130. package/dist/toolbar.js +14 -0
  131. package/dist/tooltip.d.ts +3 -2
  132. package/dist/tooltip.js +2 -2
  133. package/dist/tree.js +4 -2
  134. package/dist/typography.d.ts +12 -0
  135. package/dist/typography.js +14 -0
  136. package/package.json +286 -21
  137. package/src/all.css +8 -0
  138. package/src/styles.css +3745 -3629
  139. package/dist/advanced-forms.js +0 -93
  140. package/dist/commands.js +0 -27
  141. package/dist/context-overlays.js +0 -50
  142. package/dist/data.js +0 -82
  143. package/dist/feedback.d.ts +0 -76
  144. package/dist/feedback.js +0 -35
  145. package/dist/forms.d.ts +0 -91
  146. package/dist/forms.js +0 -109
  147. package/dist/foundations.js +0 -55
  148. package/dist/messages.js +0 -38
  149. package/dist/navigation.d.ts +0 -107
  150. package/dist/navigation.js +0 -108
  151. package/dist/panels.js +0 -99
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/design-tokens/tokens.css';
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 {
@@ -45,7 +41,21 @@ export function Example() {
45
41
  }
46
42
  ```
47
43
 
48
- 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.
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. Every component also has its own entry point, named after its page in the catalog, such as `@surflane/ui/checkbox` or `@surflane/ui/sheet`.
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.
49
59
 
50
60
  ## Frameworks
51
61
 
@@ -0,0 +1,26 @@
1
+ import * as React from 'react';
2
+ import { Accordion as BaseAccordion } from '@base-ui/react/accordion';
3
+ declare function AccordionRoot<Value = string>({ className, ...props }: BaseAccordion.Root.Props<Value>): React.JSX.Element;
4
+ declare const AccordionTrigger: React.ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react/accordion").AccordionTriggerProps, "ref"> & React.RefAttributes<HTMLElement>, "ref"> & {
5
+ indicator?: React.ReactNode;
6
+ } & React.RefAttributes<HTMLElement>>;
7
+ declare const AccordionPanel: React.ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react/accordion").AccordionPanelProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
8
+ export declare const Accordion: {
9
+ Root: typeof AccordionRoot;
10
+ Item: React.ForwardRefExoticComponent<Omit<Omit<Omit<import("@base-ui/react/accordion").AccordionItemProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref">, "size"> & {
11
+ size?: import("./sizing.js").ComponentSize;
12
+ } & React.RefAttributes<HTMLDivElement>>;
13
+ Header: React.ForwardRefExoticComponent<Omit<Omit<Omit<import("@base-ui/react/accordion").AccordionHeaderProps, "ref"> & React.RefAttributes<HTMLHeadingElement>, "ref">, "size"> & {
14
+ size?: import("./sizing.js").ComponentSize;
15
+ } & React.RefAttributes<HTMLHeadingElement>>;
16
+ Trigger: React.ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react/accordion").AccordionTriggerProps, "ref"> & React.RefAttributes<HTMLElement>, "ref"> & {
17
+ indicator?: React.ReactNode;
18
+ } & React.RefAttributes<HTMLElement>>;
19
+ Panel: React.ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react/accordion").AccordionPanelProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
20
+ };
21
+ export { AccordionPanel, AccordionRoot, AccordionTrigger };
22
+ export declare const AccordionHeader: React.ForwardRefExoticComponent<Omit<Omit<Omit<import("@base-ui/react/accordion").AccordionHeaderProps, "ref"> & React.RefAttributes<HTMLHeadingElement>, "ref">, "size"> & {
23
+ size?: import("./sizing.js").ComponentSize;
24
+ } & React.RefAttributes<HTMLHeadingElement>>, AccordionItem: React.ForwardRefExoticComponent<Omit<Omit<Omit<import("@base-ui/react/accordion").AccordionItemProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref">, "size"> & {
25
+ size?: import("./sizing.js").ComponentSize;
26
+ } & React.RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,27 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import * as React from 'react';
4
+ import { Accordion as BaseAccordion } from '@base-ui/react/accordion';
5
+ import { Icon } from './icon.js';
6
+ import { skin, part } from './parts.js';
7
+ function AccordionRoot({ className, ...props }) {
8
+ return (_jsx(BaseAccordion.Root, { ...props, className: skin('pui-accordion', className) }));
9
+ }
10
+ const AccordionTrigger = /* @__PURE__ */ React.forwardRef(function AccordionTrigger({ className, children, indicator, ...props }, ref) {
11
+ return (_jsxs(BaseAccordion.Trigger, { ...props, ref: ref, className: skin('pui-disclosure-trigger', className), children: [_jsx("span", { className: 'pui-disclosure-label', children: children }), indicator === undefined ? (_jsx(Icon, { name: 'chevron-forward', className: 'pui-disclosure-chevron' })) : (indicator)] }));
12
+ });
13
+ const AccordionPanel = /* @__PURE__ */ React.forwardRef(function AccordionPanel({ className, children, render, ...props }, ref) {
14
+ return (_jsx(BaseAccordion.Panel, { ...props, ref: ref, className: skin('pui-accordion-panel', className), render: render ??
15
+ ((panelProps, state) => (_jsx("div", { ...panelProps, inert: state.transitionStatus === 'ending' || undefined, "aria-hidden": state.transitionStatus === 'ending' || undefined }))), children: _jsx("div", { className: 'pui-disclosure-body', children: children }) }));
16
+ });
17
+ export const Accordion = {
18
+ ...BaseAccordion,
19
+ Root: AccordionRoot,
20
+ Item: /* @__PURE__ */ part(BaseAccordion.Item, 'pui-accordion-item'),
21
+ Header: /* @__PURE__ */ part(BaseAccordion.Header, 'pui-accordion-header'),
22
+ Trigger: AccordionTrigger,
23
+ Panel: AccordionPanel,
24
+ };
25
+ // Flat names for React Server Components, which cannot dot into client exports.
26
+ export { AccordionPanel, AccordionRoot, AccordionTrigger };
27
+ export const { Header: AccordionHeader, Item: AccordionItem } = Accordion;
@@ -0,0 +1,31 @@
1
+ import * as React from 'react';
2
+ import { type ComponentSizeAlias } from './sizing.js';
3
+ import { AlertDialog as BaseAlertDialog } from '@base-ui/react/alert-dialog';
4
+ import { DialogFooter, DialogHeader } from './dialog.js';
5
+ declare const AlertDialogContent: React.ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react/alert-dialog").AlertDialogPopupProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref"> & {
6
+ /** Width and density; an alert dialog is small unless set. */
7
+ size?: ComponentSizeAlias;
8
+ focusBoundaryLabel?: string;
9
+ } & React.RefAttributes<HTMLDivElement>>;
10
+ export declare const AlertDialog: {
11
+ Content: React.ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react/alert-dialog").AlertDialogPopupProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref"> & {
12
+ /** Width and density; an alert dialog is small unless set. */
13
+ size?: ComponentSizeAlias;
14
+ focusBoundaryLabel?: string;
15
+ } & React.RefAttributes<HTMLDivElement>>;
16
+ Header: typeof DialogHeader;
17
+ Footer: typeof DialogFooter;
18
+ Root: typeof BaseAlertDialog.Root;
19
+ Backdrop: React.ForwardRefExoticComponent<Omit<import("@base-ui/react/alert-dialog").AlertDialogBackdropProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
20
+ Close: React.ForwardRefExoticComponent<Omit<import("@base-ui/react/alert-dialog").AlertDialogCloseProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
21
+ Description: React.ForwardRefExoticComponent<Omit<import("@base-ui/react/alert-dialog").AlertDialogDescriptionProps, "ref"> & React.RefAttributes<HTMLParagraphElement>>;
22
+ Popup: React.ForwardRefExoticComponent<Omit<import("@base-ui/react/alert-dialog").AlertDialogPopupProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
23
+ Portal: React.ForwardRefExoticComponent<Omit<import("@base-ui/react/alert-dialog").AlertDialogPortalProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
24
+ Title: React.ForwardRefExoticComponent<Omit<import("@base-ui/react/alert-dialog").AlertDialogTitleProps, "ref"> & React.RefAttributes<HTMLHeadingElement>>;
25
+ Trigger: BaseAlertDialog.Trigger;
26
+ Viewport: React.ForwardRefExoticComponent<Omit<import("@base-ui/react/alert-dialog").AlertDialogViewportProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
27
+ Handle: typeof BaseAlertDialog.Handle;
28
+ createHandle: typeof BaseAlertDialog.createHandle;
29
+ };
30
+ export { AlertDialogContent };
31
+ export declare const AlertDialogBackdrop: React.ForwardRefExoticComponent<Omit<import("@base-ui/react/alert-dialog").AlertDialogBackdropProps, "ref"> & React.RefAttributes<HTMLDivElement>>, AlertDialogClose: React.ForwardRefExoticComponent<Omit<import("@base-ui/react/alert-dialog").AlertDialogCloseProps, "ref"> & React.RefAttributes<HTMLButtonElement>>, AlertDialogDescription: React.ForwardRefExoticComponent<Omit<import("@base-ui/react/alert-dialog").AlertDialogDescriptionProps, "ref"> & React.RefAttributes<HTMLParagraphElement>>, AlertDialogHandle: typeof BaseAlertDialog.Handle, AlertDialogPopup: React.ForwardRefExoticComponent<Omit<import("@base-ui/react/alert-dialog").AlertDialogPopupProps, "ref"> & React.RefAttributes<HTMLDivElement>>, AlertDialogPortal: React.ForwardRefExoticComponent<Omit<import("@base-ui/react/alert-dialog").AlertDialogPortalProps, "ref"> & React.RefAttributes<HTMLDivElement>>, AlertDialogRoot: typeof BaseAlertDialog.Root, AlertDialogTitle: React.ForwardRefExoticComponent<Omit<import("@base-ui/react/alert-dialog").AlertDialogTitleProps, "ref"> & React.RefAttributes<HTMLHeadingElement>>, AlertDialogTrigger: BaseAlertDialog.Trigger, AlertDialogViewport: React.ForwardRefExoticComponent<Omit<import("@base-ui/react/alert-dialog").AlertDialogViewportProps, "ref"> & React.RefAttributes<HTMLDivElement>>, AlertDialogHeader: typeof DialogHeader, AlertDialogFooter: typeof DialogFooter;
@@ -0,0 +1,22 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import * as React from 'react';
4
+ import { sizeName, skin } from './parts.js';
5
+ import { useDialogFocusBoundary } from './dialog-focus.js';
6
+ import { useComponentSize } from './sizing.js';
7
+ import { AlertDialog as BaseAlertDialog } from '@base-ui/react/alert-dialog';
8
+ import { DialogFooter, DialogHeader } from './dialog.js';
9
+ const AlertDialogContent = /* @__PURE__ */ React.forwardRef(function AlertDialogContent({ size, className, focusBoundaryLabel = 'Continue dialog navigation', ...props }, ref) {
10
+ const scheme = useComponentSize(size);
11
+ const portalRef = useDialogFocusBoundary(focusBoundaryLabel);
12
+ return (_jsxs(BaseAlertDialog.Portal, { ref: portalRef, children: [_jsx(BaseAlertDialog.Backdrop, { className: 'pui-dialog-backdrop' }), _jsx(BaseAlertDialog.Popup, { "data-ui-size": scheme, "data-size": sizeName(size), ...props, ref: ref, className: skin('pui-dialog-popup pui-dialog-content pui-confirm-content', className) })] }));
13
+ });
14
+ export const AlertDialog = {
15
+ ...BaseAlertDialog,
16
+ Content: AlertDialogContent,
17
+ Header: DialogHeader,
18
+ Footer: DialogFooter,
19
+ };
20
+ // Flat names for React Server Components, which cannot dot into client exports.
21
+ export { AlertDialogContent };
22
+ export const { Backdrop: AlertDialogBackdrop, Close: AlertDialogClose, Description: AlertDialogDescription, Handle: AlertDialogHandle, Popup: AlertDialogPopup, Portal: AlertDialogPortal, Root: AlertDialogRoot, Title: AlertDialogTitle, Trigger: AlertDialogTrigger, Viewport: AlertDialogViewport, Header: AlertDialogHeader, Footer: AlertDialogFooter, } = AlertDialog;
package/dist/app-shell.js CHANGED
@@ -1,35 +1,35 @@
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
- const skin = (base, extra) => [base, extra].filter(Boolean).join(' ');
4
+ import { cx } from './parts.js';
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) {
7
- return (_jsx("div", { ...props, ref: ref, "data-layout": layout, "data-sidebar": collapsed ? 'collapsed' : 'expanded', className: skin('pui-app-shell', className) }));
6
+ const Root = /* @__PURE__ */ React.forwardRef(function AppShellRoot({ collapsed = false, layout = 'header', className, ...props }, ref) {
7
+ return (_jsx("div", { ...props, ref: ref, "data-layout": layout, "data-sidebar": collapsed ? 'collapsed' : 'expanded', className: cx('pui-app-shell', className) }));
8
8
  });
9
- const Header = React.forwardRef(function AppShellHeader({ className, ...props }, ref) {
10
- return (_jsx("div", { ...props, ref: ref, className: skin('pui-app-shell-header', className) }));
9
+ const Header = /* @__PURE__ */ React.forwardRef(function AppShellHeader({ className, ...props }, ref) {
10
+ return (_jsx("div", { ...props, ref: ref, className: cx('pui-app-shell-header', className) }));
11
11
  });
12
- const Sidebar = React.forwardRef(function AppShellSidebar({ className, ...props }, ref) {
13
- return (_jsx("aside", { ...props, ref: ref, className: skin('pui-app-shell-sidebar', className) }));
12
+ const Sidebar = /* @__PURE__ */ React.forwardRef(function AppShellSidebar({ className, ...props }, ref) {
13
+ return (_jsx("aside", { ...props, ref: ref, className: cx('pui-app-shell-sidebar', className) }));
14
14
  });
15
- const Content = React.forwardRef(function AppShellContent({ className, ...props }, ref) {
16
- return (_jsx("div", { ...props, ref: ref, className: skin('pui-app-shell-content', className) }));
15
+ const Content = /* @__PURE__ */ React.forwardRef(function AppShellContent({ className, ...props }, ref) {
16
+ return (_jsx("div", { ...props, ref: ref, className: cx('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) {
23
- return (_jsx("div", { ...props, ref: ref, className: skin('pui-app-shell-page', className) }));
22
+ const Page = /* @__PURE__ */ React.forwardRef(function AppShellPage({ className, ...props }, ref) {
23
+ return (_jsx("div", { ...props, ref: ref, className: cx('pui-app-shell-page', className) }));
24
24
  });
25
- const Footer = React.forwardRef(function AppShellFooter({ className, ...props }, ref) {
26
- return (_jsx("div", { ...props, ref: ref, className: skin('pui-app-shell-footer', className) }));
25
+ const Footer = /* @__PURE__ */ React.forwardRef(function AppShellFooter({ className, ...props }, ref) {
26
+ return (_jsx("div", { ...props, ref: ref, className: cx('pui-app-shell-footer', className) }));
27
27
  });
28
- const Label = React.forwardRef(function AppShellLabel({ className, ...props }, ref) {
29
- return (_jsx("span", { ...props, ref: ref, className: skin('pui-app-shell-label', className) }));
28
+ const Label = /* @__PURE__ */ React.forwardRef(function AppShellLabel({ className, ...props }, ref) {
29
+ return (_jsx("span", { ...props, ref: ref, className: cx('pui-app-shell-label', className) }));
30
30
  });
31
- const Link = React.forwardRef(function AppShellLink({ icon, label, className, ...props }, ref) {
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 })] }));
31
+ const Link = /* @__PURE__ */ React.forwardRef(function AppShellLink({ icon, label, className, ...props }, ref) {
32
+ return (_jsxs("a", { ...props, ref: ref, "aria-label": props['aria-label'] ?? label, className: cx('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 = {
35
35
  Root,
@@ -1,10 +1,10 @@
1
1
  import * as React from 'react';
2
2
  import { Autocomplete as BaseAutocomplete } from '@base-ui/react/autocomplete';
3
- import { Slider as BaseSlider } from '@base-ui/react/slider';
4
3
  declare const AutocompleteRoot: typeof BaseAutocomplete.Root;
5
4
  export declare const Autocomplete: {
6
5
  Root: typeof BaseAutocomplete.Root;
7
- Content: React.ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react/autocomplete").AutocompletePopupProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref"> & {
6
+ Portal: React.ForwardRefExoticComponent<Omit<import("@base-ui/react/autocomplete").AutocompletePortalProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
7
+ Content: React.ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react/autocomplete").AutocompletePopupProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref"> & Pick<Omit<Omit<import("@base-ui/react/autocomplete").AutocompletePositionerProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref">, "side" | "align" | "sideOffset" | "collisionPadding"> & {
8
8
  positionerProps?: React.ComponentPropsWithoutRef<typeof BaseAutocomplete.Positioner>;
9
9
  } & React.RefAttributes<HTMLDivElement>>;
10
10
  Popup: React.ForwardRefExoticComponent<Omit<Omit<Omit<import("@base-ui/react/autocomplete").AutocompletePopupProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref">, "size"> & {
@@ -44,7 +44,6 @@ export declare const Autocomplete: {
44
44
  } & React.RefAttributes<HTMLDivElement>>;
45
45
  Value: typeof BaseAutocomplete.Value;
46
46
  Icon: React.ForwardRefExoticComponent<Omit<import("@base-ui/react/autocomplete").AutocompleteIconProps, "ref"> & React.RefAttributes<HTMLSpanElement>>;
47
- Portal: React.ForwardRefExoticComponent<Omit<import("@base-ui/react/autocomplete").AutocompletePortalProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
48
47
  Backdrop: React.ForwardRefExoticComponent<Omit<import("@base-ui/react/autocomplete").AutocompleteBackdropProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
49
48
  Arrow: React.ForwardRefExoticComponent<Omit<import("@base-ui/react/autocomplete").AutocompleteArrowProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
50
49
  Row: React.ForwardRefExoticComponent<Omit<import("@base-ui/react/autocomplete").AutocompleteRowProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
@@ -52,31 +51,7 @@ export declare const Autocomplete: {
52
51
  useFilter: typeof import("@base-ui/react/internals/filter").getFilter;
53
52
  useFilteredItems: typeof BaseAutocomplete.useFilteredItems;
54
53
  };
55
- declare function SliderRoot<Value extends number | readonly number[]>({ value, defaultValue, onValueChange, ref, className, form, thumbAlignment, ...props }: BaseSlider.Root.Props<Value> & {
56
- ref?: React.Ref<HTMLDivElement>;
57
- }): React.JSX.Element;
58
- export declare const Slider: {
59
- Root: typeof SliderRoot;
60
- Label: React.ForwardRefExoticComponent<Omit<Omit<Omit<import("@base-ui/react/slider").SliderLabelProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref">, "size"> & {
61
- size?: import("./sizing.js").ComponentSize;
62
- } & React.RefAttributes<HTMLDivElement>>;
63
- Value: React.ForwardRefExoticComponent<Omit<Omit<Omit<import("@base-ui/react/slider").SliderValueProps, "ref"> & React.RefAttributes<HTMLOutputElement>, "ref">, "size"> & {
64
- size?: import("./sizing.js").ComponentSize;
65
- } & React.RefAttributes<HTMLOutputElement>>;
66
- Control: React.ForwardRefExoticComponent<Omit<Omit<Omit<import("@base-ui/react/slider").SliderControlProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref">, "size"> & {
67
- size?: import("./sizing.js").ComponentSize;
68
- } & React.RefAttributes<HTMLDivElement>>;
69
- Track: React.ForwardRefExoticComponent<Omit<Omit<Omit<import("@base-ui/react/slider").SliderTrackProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref">, "size"> & {
70
- size?: import("./sizing.js").ComponentSize;
71
- } & React.RefAttributes<HTMLDivElement>>;
72
- Indicator: React.ForwardRefExoticComponent<Omit<Omit<Omit<import("@base-ui/react/slider").SliderIndicatorProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref">, "size"> & {
73
- size?: import("./sizing.js").ComponentSize;
74
- } & React.RefAttributes<HTMLDivElement>>;
75
- Thumb: React.ForwardRefExoticComponent<Omit<Omit<Omit<import("@base-ui/react/slider").SliderThumbProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref">, "size"> & {
76
- size?: import("./sizing.js").ComponentSize;
77
- } & React.RefAttributes<HTMLDivElement>>;
78
- };
79
- export { AutocompleteRoot, SliderRoot };
54
+ export { AutocompleteRoot };
80
55
  export declare const AutocompleteArrow: React.ForwardRefExoticComponent<Omit<import("@base-ui/react/autocomplete").AutocompleteArrowProps, "ref"> & React.RefAttributes<HTMLDivElement>>, AutocompleteBackdrop: React.ForwardRefExoticComponent<Omit<import("@base-ui/react/autocomplete").AutocompleteBackdropProps, "ref"> & React.RefAttributes<HTMLDivElement>>, AutocompleteClear: React.ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react/autocomplete").AutocompleteClearProps, "ref"> & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>, AutocompleteCollection: typeof BaseAutocomplete.Collection, AutocompleteEmpty: React.ForwardRefExoticComponent<Omit<Omit<Omit<import("@base-ui/react/autocomplete").AutocompleteEmptyProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref">, "size"> & {
81
56
  size?: import("./sizing.js").ComponentSize;
82
57
  } & React.RefAttributes<HTMLDivElement>>, AutocompleteGroup: React.ForwardRefExoticComponent<Omit<Omit<Omit<import("@base-ui/react/autocomplete").AutocompleteGroupProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref">, "size"> & {
@@ -99,19 +74,6 @@ export declare const AutocompleteArrow: React.ForwardRefExoticComponent<Omit<imp
99
74
  size?: import("./sizing.js").ComponentSize;
100
75
  } & React.RefAttributes<HTMLDivElement>>, AutocompleteStatus: React.ForwardRefExoticComponent<Omit<Omit<Omit<import("@base-ui/react/autocomplete").AutocompleteStatusProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref">, "size"> & {
101
76
  size?: import("./sizing.js").ComponentSize;
102
- } & React.RefAttributes<HTMLDivElement>>, AutocompleteTrigger: React.ForwardRefExoticComponent<Omit<import("@base-ui/react/autocomplete").AutocompleteTriggerProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>, AutocompleteValue: typeof BaseAutocomplete.Value, AutocompleteContent: React.ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react/autocomplete").AutocompletePopupProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref"> & {
77
+ } & React.RefAttributes<HTMLDivElement>>, AutocompleteTrigger: React.ForwardRefExoticComponent<Omit<import("@base-ui/react/autocomplete").AutocompleteTriggerProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>, AutocompleteValue: typeof BaseAutocomplete.Value, AutocompleteContent: React.ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react/autocomplete").AutocompletePopupProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref"> & Pick<Omit<Omit<import("@base-ui/react/autocomplete").AutocompletePositionerProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref">, "side" | "align" | "sideOffset" | "collisionPadding"> & {
103
78
  positionerProps?: React.ComponentPropsWithoutRef<typeof BaseAutocomplete.Positioner>;
104
79
  } & React.RefAttributes<HTMLDivElement>>;
105
- export declare const SliderControl: React.ForwardRefExoticComponent<Omit<Omit<Omit<import("@base-ui/react/slider").SliderControlProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref">, "size"> & {
106
- size?: import("./sizing.js").ComponentSize;
107
- } & React.RefAttributes<HTMLDivElement>>, SliderIndicator: React.ForwardRefExoticComponent<Omit<Omit<Omit<import("@base-ui/react/slider").SliderIndicatorProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref">, "size"> & {
108
- size?: import("./sizing.js").ComponentSize;
109
- } & React.RefAttributes<HTMLDivElement>>, SliderLabel: React.ForwardRefExoticComponent<Omit<Omit<Omit<import("@base-ui/react/slider").SliderLabelProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref">, "size"> & {
110
- size?: import("./sizing.js").ComponentSize;
111
- } & React.RefAttributes<HTMLDivElement>>, SliderThumb: React.ForwardRefExoticComponent<Omit<Omit<Omit<import("@base-ui/react/slider").SliderThumbProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref">, "size"> & {
112
- size?: import("./sizing.js").ComponentSize;
113
- } & React.RefAttributes<HTMLDivElement>>, SliderTrack: React.ForwardRefExoticComponent<Omit<Omit<Omit<import("@base-ui/react/slider").SliderTrackProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref">, "size"> & {
114
- size?: import("./sizing.js").ComponentSize;
115
- } & React.RefAttributes<HTMLDivElement>>, SliderValue: React.ForwardRefExoticComponent<Omit<Omit<Omit<import("@base-ui/react/slider").SliderValueProps, "ref"> & React.RefAttributes<HTMLOutputElement>, "ref">, "size"> & {
116
- size?: import("./sizing.js").ComponentSize;
117
- } & React.RefAttributes<HTMLOutputElement>>;
@@ -1,11 +1,11 @@
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 { Icon } from './icon.js';
4
5
  import { Autocomplete as BaseAutocomplete } from '@base-ui/react/autocomplete';
5
- import { Slider as BaseSlider } from '@base-ui/react/slider';
6
- import { Combobox } from './advanced-forms.js';
7
- import { skin, part } from './parts.js';
8
- import { useResetValue, useRootRef } from './form-state.js';
6
+ import { Combobox } from './combobox.js';
7
+ import { part, scopedPortal, skin } from './parts.js';
8
+ import { useResetValue } from './form-state.js';
9
9
  const AutocompleteRoot = function AutocompleteRoot({ children, form, value, defaultValue, onValueChange, ...props }) {
10
10
  const anchor = React.useRef(null);
11
11
  const [query, setQuery, revision] = useResetValue(value, defaultValue ?? '', anchor, form);
@@ -15,15 +15,16 @@ const AutocompleteRoot = function AutocompleteRoot({ children, form, value, defa
15
15
  setQuery(next);
16
16
  }, children: [_jsx("span", { hidden: true, ref: anchor }), children] }, revision));
17
17
  };
18
- const AutoTrigger = React.forwardRef(function AutoTrigger({ className, children, ...props }, ref) {
19
- return (_jsx(BaseAutocomplete.Trigger, { "aria-label": 'Show suggestions', ...props, ref: ref, className: skin('pui-combobox-action', className), children: children ?? (_jsx("svg", { width: '16', height: '16', viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', strokeWidth: '1.6', "aria-hidden": 'true', children: _jsx("path", { d: 'm6 9 6 6 6-6' }) })) }));
18
+ const AutoTrigger = /* @__PURE__ */ React.forwardRef(function AutoTrigger({ className, children, ...props }, ref) {
19
+ return (_jsx(BaseAutocomplete.Trigger, { "aria-label": 'Show suggestions', ...props, ref: ref, className: skin('pui-combobox-action', className), children: children ?? _jsx(Icon, { name: 'chevron-down' }) }));
20
20
  });
21
- const AutoClear = React.forwardRef(function AutoClear(props, ref) {
21
+ const AutoClear = /* @__PURE__ */ React.forwardRef(function AutoClear(props, ref) {
22
22
  return _jsx(Combobox.Clear, { "aria-label": 'Clear input', ...props, ref: ref });
23
23
  });
24
24
  export const Autocomplete = {
25
25
  ...BaseAutocomplete,
26
26
  Root: AutocompleteRoot,
27
+ Portal: /* @__PURE__ */ scopedPortal(BaseAutocomplete.Portal),
27
28
  Content: Combobox.Content,
28
29
  Popup: Combobox.Popup,
29
30
  Positioner: Combobox.Positioner,
@@ -35,30 +36,10 @@ export const Autocomplete = {
35
36
  GroupLabel: Combobox.GroupLabel,
36
37
  Clear: AutoClear,
37
38
  Trigger: AutoTrigger,
38
- InputGroup: part(BaseAutocomplete.InputGroup, 'pui-combobox-group'),
39
- Item: part(BaseAutocomplete.Item, 'pui-combobox-item'),
40
- Separator: part(BaseAutocomplete.Separator, 'pui-combobox-separator'),
41
- };
42
- function SliderRoot({ value, defaultValue, onValueChange, ref, className, form, thumbAlignment = 'edge', ...props }) {
43
- const [element, attach] = useRootRef(ref);
44
- const [selected, setSelected] = useResetValue(value, (defaultValue ?? props.min ?? 0), element, form);
45
- return (_jsx(BaseSlider.Root, { ...props, form: form, ref: attach, value: selected, thumbAlignment: thumbAlignment, className: skin('pui-slider', className), onValueChange: (next, event) => {
46
- onValueChange?.(next, event);
47
- if (value === undefined && !event.isCanceled)
48
- setSelected(next);
49
- } }));
50
- }
51
- export const Slider = {
52
- ...BaseSlider,
53
- Root: SliderRoot,
54
- Label: part(BaseSlider.Label, 'pui-slider-label'),
55
- Value: part(BaseSlider.Value, 'pui-slider-value'),
56
- Control: part(BaseSlider.Control, 'pui-slider-control'),
57
- Track: part(BaseSlider.Track, 'pui-slider-track'),
58
- Indicator: part(BaseSlider.Indicator, 'pui-slider-indicator'),
59
- Thumb: part(BaseSlider.Thumb, 'pui-slider-thumb'),
39
+ InputGroup: /* @__PURE__ */ part(BaseAutocomplete.InputGroup, 'pui-combobox-group'),
40
+ Item: /* @__PURE__ */ part(BaseAutocomplete.Item, 'pui-combobox-item'),
41
+ Separator: /* @__PURE__ */ part(BaseAutocomplete.Separator, 'pui-combobox-separator'),
60
42
  };
61
43
  // Flat names for React Server Components, which cannot dot into client exports.
62
- export { AutocompleteRoot, SliderRoot };
44
+ export { AutocompleteRoot };
63
45
  export const { Arrow: AutocompleteArrow, Backdrop: AutocompleteBackdrop, Clear: AutocompleteClear, Collection: AutocompleteCollection, Empty: AutocompleteEmpty, Group: AutocompleteGroup, GroupLabel: AutocompleteGroupLabel, Icon: AutocompleteIcon, Input: AutocompleteInput, InputGroup: AutocompleteInputGroup, Item: AutocompleteItem, List: AutocompleteList, Popup: AutocompletePopup, Portal: AutocompletePortal, Positioner: AutocompletePositioner, Row: AutocompleteRow, Separator: AutocompleteSeparator, Status: AutocompleteStatus, Trigger: AutocompleteTrigger, Value: AutocompleteValue, Content: AutocompleteContent, } = Autocomplete;
64
- export const { Control: SliderControl, Indicator: SliderIndicator, Label: SliderLabel, Thumb: SliderThumb, Track: SliderTrack, Value: SliderValue, } = Slider;
@@ -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,24 @@
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import * as React from 'react';
4
+ import { Icon } from './icon.js';
5
+ import { Avatar as BaseAvatar } from '@base-ui/react/avatar';
6
+ import { useComponentSize } from './sizing.js';
7
+ import { sizeName, skin, part } from './parts.js';
8
+ const AvatarRoot = /* @__PURE__ */ React.forwardRef(function AvatarRoot({ size, className, ...props }, ref) {
9
+ const scheme = useComponentSize(size);
10
+ return (_jsx(BaseAvatar.Root, { ...props, ref: ref, "data-size": sizeName(size), "data-ui-size": scheme, className: skin('pui-avatar', className) }));
11
+ });
12
+ const AvatarFallback = /* @__PURE__ */ React.forwardRef(function AvatarFallback({ children, className, ...props }, ref) {
13
+ return (_jsx(BaseAvatar.Fallback, { ...props, ref: ref, className: skin('pui-avatar-fallback', className), children: children ?? _jsx(Icon, { name: 'user' }) }));
14
+ });
15
+ export const Avatar = {
16
+ ...BaseAvatar,
17
+ Root: AvatarRoot,
18
+ Status: /* @__PURE__ */ part('span', 'pui-avatar-status'),
19
+ Fallback: AvatarFallback,
20
+ Image: /* @__PURE__ */ part(BaseAvatar.Image, 'pui-avatar-image'),
21
+ };
22
+ // Flat names for React Server Components, which cannot dot into client exports.
23
+ export { AvatarFallback, AvatarRoot };
24
+ export const { Image: AvatarImage, Status: AvatarStatus } = Avatar;
@@ -0,0 +1,20 @@
1
+ import * as React from 'react';
2
+ import { type ComponentSize } from './sizing.js';
3
+ import { type StatusTone } from './status.js';
4
+ export type BadgeProps = React.ComponentPropsWithoutRef<'span'> & {
5
+ size?: ComponentSize;
6
+ tone?: StatusTone;
7
+ icon?: React.ReactNode;
8
+ };
9
+ export declare const Badge: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & {
10
+ size?: ComponentSize;
11
+ tone?: StatusTone;
12
+ icon?: React.ReactNode;
13
+ } & React.RefAttributes<HTMLSpanElement>>;
14
+ /** Domain status labels and live announcements remain the caller's responsibility. */
15
+ export declare const StatusBadge: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & {
16
+ size?: ComponentSize;
17
+ tone?: StatusTone;
18
+ icon?: React.ReactNode;
19
+ } & React.RefAttributes<HTMLSpanElement>>;
20
+ export type { StatusTone } from './status.js';
package/dist/badge.js ADDED
@@ -0,0 +1,16 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import * as React from 'react';
4
+ import { useComponentSize } from './sizing.js';
5
+ import { useToneTransition } from './tone-transition.js';
6
+ import { cx } from './parts.js';
7
+ import { StatusIcon } from './status.js';
8
+ export const Badge = /* @__PURE__ */ React.forwardRef(function Badge({ tone = 'neutral', icon, children, className, size, ...props }, ref) {
9
+ const scheme = useComponentSize(size);
10
+ const elementRef = useToneTransition(tone, ref);
11
+ return (_jsxs("span", { ...props, ref: elementRef, className: cx('pui-badge', className), "data-tone": tone, "data-ui-size": scheme, children: [icon && (_jsx("span", { className: 'pui-badge-icon', "aria-hidden": 'true', children: icon })), children] }));
12
+ });
13
+ /** Domain status labels and live announcements remain the caller's responsibility. */
14
+ export const StatusBadge = /* @__PURE__ */ React.forwardRef(function StatusBadge({ tone = 'neutral', icon, ...props }, ref) {
15
+ return (_jsx(Badge, { ...props, ref: ref, tone: tone, icon: icon === undefined ? _jsx(StatusIcon, { tone: tone }) : icon }));
16
+ });
@@ -0,0 +1,13 @@
1
+ import * as React from 'react';
2
+ declare function BreadcrumbSeparator({ className, ...props }: React.ComponentProps<'span'>): React.JSX.Element;
3
+ declare function BreadcrumbCurrent({ className, ...props }: React.ComponentProps<'span'>): React.JSX.Element;
4
+ export declare const Breadcrumbs: {
5
+ Root: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>, "ref"> & React.RefAttributes<HTMLElement>>;
6
+ List: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.OlHTMLAttributes<HTMLOListElement>, HTMLOListElement>, "ref"> & React.RefAttributes<HTMLOListElement>>;
7
+ Item: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, "ref"> & React.RefAttributes<HTMLLIElement>>;
8
+ Link: React.ForwardRefExoticComponent<import("./link.js").LinkProps & React.RefAttributes<HTMLAnchorElement>>;
9
+ Separator: typeof BreadcrumbSeparator;
10
+ Current: typeof BreadcrumbCurrent;
11
+ };
12
+ export declare const BreadcrumbsRoot: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>, "ref"> & React.RefAttributes<HTMLElement>>, BreadcrumbsList: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.OlHTMLAttributes<HTMLOListElement>, HTMLOListElement>, "ref"> & React.RefAttributes<HTMLOListElement>>, BreadcrumbsItem: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, "ref"> & React.RefAttributes<HTMLLIElement>>, BreadcrumbsLink: React.ForwardRefExoticComponent<import("./link.js").LinkProps & React.RefAttributes<HTMLAnchorElement>>, BreadcrumbsSeparator: typeof BreadcrumbSeparator, BreadcrumbsCurrent: typeof BreadcrumbCurrent;
13
+ export {};
@@ -0,0 +1,31 @@
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import * as React from 'react';
4
+ import { Icon } from './icon.js';
5
+ import { cx } from './parts.js';
6
+ import { Link } from './link.js';
7
+ const BreadcrumbRoot = /* @__PURE__ */ React.forwardRef(function BreadcrumbRoot({ className, 'aria-label': label = 'Breadcrumb', ...props }, ref) {
8
+ return (_jsx("nav", { ...props, ref: ref, "aria-label": label, className: cx('pui-breadcrumbs', className) }));
9
+ });
10
+ const BreadcrumbList = /* @__PURE__ */ React.forwardRef(function BreadcrumbList({ className, role = 'list', ...props }, ref) {
11
+ return (_jsx("ol", { ...props, role: role, ref: ref, className: cx('pui-breadcrumb-list', className) }));
12
+ });
13
+ const BreadcrumbItem = /* @__PURE__ */ React.forwardRef(function BreadcrumbItem({ className, ...props }, ref) {
14
+ return (_jsx("li", { ...props, ref: ref, className: cx('pui-breadcrumb-item', className) }));
15
+ });
16
+ function BreadcrumbSeparator({ className, ...props }) {
17
+ return (_jsx("span", { ...props, className: cx('pui-breadcrumb-separator', className), "aria-hidden": 'true', children: _jsx(Icon, { name: 'chevron-forward' }) }));
18
+ }
19
+ function BreadcrumbCurrent({ className, ...props }) {
20
+ return (_jsx("span", { ...props, className: cx('pui-breadcrumb-current', className), "aria-current": 'page' }));
21
+ }
22
+ export const Breadcrumbs = {
23
+ Root: BreadcrumbRoot,
24
+ List: BreadcrumbList,
25
+ Item: BreadcrumbItem,
26
+ Link,
27
+ Separator: BreadcrumbSeparator,
28
+ Current: BreadcrumbCurrent,
29
+ };
30
+ // Flat names for React Server Components, which cannot dot into client exports.
31
+ export const { Root: BreadcrumbsRoot, List: BreadcrumbsList, Item: BreadcrumbsItem, Link: BreadcrumbsLink, Separator: BreadcrumbsSeparator, Current: BreadcrumbsCurrent, } = Breadcrumbs;
package/dist/button.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { Button as BaseButton } from '@base-ui/react/button';
3
+ import { useRender } from '@base-ui/react/use-render';
3
4
  import { type ComponentSizeAlias } from './sizing.js';
4
5
  /** Visual priority. `default` remains a compatibility alias of `primary`. */
5
6
  export type ButtonVariant = 'primary' | 'default' | 'secondary' | 'outline' | 'ghost' | 'destructive' | 'link';
@@ -9,3 +10,13 @@ export type ButtonProps = React.ComponentProps<typeof BaseButton> & {
9
10
  size?: ButtonSize;
10
11
  };
11
12
  export declare const Button: React.ForwardRefExoticComponent<Omit<ButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
13
+ export type LinkButtonProps = Omit<useRender.ComponentProps<'a'>, 'ref'> & {
14
+ variant?: ButtonVariant;
15
+ size?: ButtonSize;
16
+ };
17
+ /** A link that looks like a Button. It navigates, so it stays a link for assistive
18
+ * technology; pass a router's link element as `render` to keep client navigation. */
19
+ export declare const LinkButton: React.ForwardRefExoticComponent<Omit<useRender.ComponentProps<"a", {}, import("@base-ui/react/types").HTMLProps>, "ref"> & {
20
+ variant?: ButtonVariant;
21
+ size?: ButtonSize;
22
+ } & React.RefAttributes<HTMLAnchorElement>>;
package/dist/button.js CHANGED
@@ -2,15 +2,38 @@
2
2
  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
+ import { useRender } from '@base-ui/react/use-render';
5
6
  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) {
8
- const scheme = useComponentSize(size === 'icon-sm' || size === 'icon-xs'
7
+ import { sizeName, skin, cx } from './parts.js';
8
+ /** The size scheme a button size implies: icon sizes follow the scale, xs and icon
9
+ * keep the surrounding scheme. */
10
+ function schemeOf(size) {
11
+ return size === 'icon-sm' || size === 'icon-xs'
9
12
  ? 'small'
10
13
  : size === 'icon-lg'
11
14
  ? 'large'
12
15
  : size === 'xs' || size === 'icon'
13
16
  ? undefined
14
- : size);
15
- return (_jsx(BaseButton, { ref: ref, ...props, className: skin('pui-button', className), "data-variant": variant, "data-size": size, "data-ui-size": scheme }));
17
+ : size;
18
+ }
19
+ export const Button = /* @__PURE__ */ React.forwardRef(function Button({ className, variant = 'default', size, ...props }, ref) {
20
+ const scheme = useComponentSize(schemeOf(size));
21
+ return (_jsx(BaseButton, { ref: ref, ...props, className: skin('pui-button', className), "data-variant": variant, "data-size": sizeName(size), "data-ui-size": scheme }));
22
+ });
23
+ /** A link that looks like a Button. It navigates, so it stays a link for assistive
24
+ * technology; pass a router's link element as `render` to keep client navigation. */
25
+ export const LinkButton = /* @__PURE__ */ React.forwardRef(function LinkButton({ render, className, variant = 'default', size, ...props }, ref) {
26
+ const scheme = useComponentSize(schemeOf(size));
27
+ return useRender({
28
+ defaultTagName: 'a',
29
+ render,
30
+ ref,
31
+ props: {
32
+ ...props,
33
+ className: cx('pui-button', className),
34
+ 'data-variant': variant,
35
+ 'data-size': sizeName(size),
36
+ 'data-ui-size': scheme,
37
+ },
38
+ });
16
39
  });