@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
@@ -0,0 +1,40 @@
1
+ import * as React from 'react';
2
+ import { Slider as BaseSlider } from '@base-ui/react/slider';
3
+ declare function SliderRoot<Value extends number | readonly number[]>({ value, defaultValue, onValueChange, ref, className, form, thumbAlignment, ...props }: BaseSlider.Root.Props<Value> & {
4
+ ref?: React.Ref<HTMLDivElement>;
5
+ }): React.JSX.Element;
6
+ export declare const Slider: {
7
+ Root: typeof SliderRoot;
8
+ Label: React.ForwardRefExoticComponent<Omit<Omit<Omit<import("@base-ui/react/slider").SliderLabelProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref">, "size"> & {
9
+ size?: import("./sizing.js").ComponentSize;
10
+ } & React.RefAttributes<HTMLDivElement>>;
11
+ Value: React.ForwardRefExoticComponent<Omit<Omit<Omit<import("@base-ui/react/slider").SliderValueProps, "ref"> & React.RefAttributes<HTMLOutputElement>, "ref">, "size"> & {
12
+ size?: import("./sizing.js").ComponentSize;
13
+ } & React.RefAttributes<HTMLOutputElement>>;
14
+ Control: React.ForwardRefExoticComponent<Omit<Omit<Omit<import("@base-ui/react/slider").SliderControlProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref">, "size"> & {
15
+ size?: import("./sizing.js").ComponentSize;
16
+ } & React.RefAttributes<HTMLDivElement>>;
17
+ Track: React.ForwardRefExoticComponent<Omit<Omit<Omit<import("@base-ui/react/slider").SliderTrackProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref">, "size"> & {
18
+ size?: import("./sizing.js").ComponentSize;
19
+ } & React.RefAttributes<HTMLDivElement>>;
20
+ Indicator: React.ForwardRefExoticComponent<Omit<Omit<Omit<import("@base-ui/react/slider").SliderIndicatorProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref">, "size"> & {
21
+ size?: import("./sizing.js").ComponentSize;
22
+ } & React.RefAttributes<HTMLDivElement>>;
23
+ Thumb: React.ForwardRefExoticComponent<Omit<Omit<Omit<import("@base-ui/react/slider").SliderThumbProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref">, "size"> & {
24
+ size?: import("./sizing.js").ComponentSize;
25
+ } & React.RefAttributes<HTMLDivElement>>;
26
+ };
27
+ export { SliderRoot };
28
+ export declare const SliderControl: React.ForwardRefExoticComponent<Omit<Omit<Omit<import("@base-ui/react/slider").SliderControlProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref">, "size"> & {
29
+ size?: import("./sizing.js").ComponentSize;
30
+ } & React.RefAttributes<HTMLDivElement>>, SliderIndicator: React.ForwardRefExoticComponent<Omit<Omit<Omit<import("@base-ui/react/slider").SliderIndicatorProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref">, "size"> & {
31
+ size?: import("./sizing.js").ComponentSize;
32
+ } & React.RefAttributes<HTMLDivElement>>, SliderLabel: React.ForwardRefExoticComponent<Omit<Omit<Omit<import("@base-ui/react/slider").SliderLabelProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref">, "size"> & {
33
+ size?: import("./sizing.js").ComponentSize;
34
+ } & React.RefAttributes<HTMLDivElement>>, SliderThumb: React.ForwardRefExoticComponent<Omit<Omit<Omit<import("@base-ui/react/slider").SliderThumbProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref">, "size"> & {
35
+ size?: import("./sizing.js").ComponentSize;
36
+ } & React.RefAttributes<HTMLDivElement>>, SliderTrack: React.ForwardRefExoticComponent<Omit<Omit<Omit<import("@base-ui/react/slider").SliderTrackProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref">, "size"> & {
37
+ size?: import("./sizing.js").ComponentSize;
38
+ } & React.RefAttributes<HTMLDivElement>>, SliderValue: React.ForwardRefExoticComponent<Omit<Omit<Omit<import("@base-ui/react/slider").SliderValueProps, "ref"> & React.RefAttributes<HTMLOutputElement>, "ref">, "size"> & {
39
+ size?: import("./sizing.js").ComponentSize;
40
+ } & React.RefAttributes<HTMLOutputElement>>;
package/dist/slider.js ADDED
@@ -0,0 +1,27 @@
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { Slider as BaseSlider } from '@base-ui/react/slider';
4
+ import { part, skin } from './parts.js';
5
+ import { useResetValue, useRootRef } from './form-state.js';
6
+ function SliderRoot({ value, defaultValue, onValueChange, ref, className, form, thumbAlignment = 'edge', ...props }) {
7
+ const [element, attach] = useRootRef(ref);
8
+ const [selected, setSelected] = useResetValue(value, (defaultValue ?? props.min ?? 0), element, form);
9
+ return (_jsx(BaseSlider.Root, { ...props, form: form, ref: attach, value: selected, thumbAlignment: thumbAlignment, className: skin('pui-slider', className), onValueChange: (next, event) => {
10
+ onValueChange?.(next, event);
11
+ if (value === undefined && !event.isCanceled)
12
+ setSelected(next);
13
+ } }));
14
+ }
15
+ export const Slider = {
16
+ ...BaseSlider,
17
+ Root: SliderRoot,
18
+ Label: /* @__PURE__ */ part(BaseSlider.Label, 'pui-slider-label'),
19
+ Value: /* @__PURE__ */ part(BaseSlider.Value, 'pui-slider-value'),
20
+ Control: /* @__PURE__ */ part(BaseSlider.Control, 'pui-slider-control'),
21
+ Track: /* @__PURE__ */ part(BaseSlider.Track, 'pui-slider-track'),
22
+ Indicator: /* @__PURE__ */ part(BaseSlider.Indicator, 'pui-slider-indicator'),
23
+ Thumb: /* @__PURE__ */ part(BaseSlider.Thumb, 'pui-slider-thumb'),
24
+ };
25
+ // Flat names for React Server Components, which cannot dot into client exports.
26
+ export { SliderRoot };
27
+ export const { Control: SliderControl, Indicator: SliderIndicator, Label: SliderLabel, Thumb: SliderThumb, Track: SliderTrack, Value: SliderValue, } = Slider;
@@ -0,0 +1,13 @@
1
+ import * as React from 'react';
2
+ import { type ComponentSizeAlias } from './sizing.js';
3
+ export type SpinnerProps = Omit<React.ComponentPropsWithoutRef<'span'>, 'children'> & {
4
+ label?: string;
5
+ decorative?: boolean;
6
+ size?: ComponentSizeAlias;
7
+ };
8
+ /** Use decorative within a loading region that already owns the announcement. */
9
+ export declare const Spinner: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref">, "children"> & {
10
+ label?: string;
11
+ decorative?: boolean;
12
+ size?: ComponentSizeAlias;
13
+ } & React.RefAttributes<HTMLSpanElement>>;
@@ -0,0 +1,10 @@
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 { sizeName, cx } from './parts.js';
6
+ /** Use decorative within a loading region that already owns the announcement. */
7
+ export const Spinner = /* @__PURE__ */ React.forwardRef(function Spinner({ label = 'Loading', decorative = false, size, className, ...props }, ref) {
8
+ const scheme = useComponentSize(size);
9
+ return (_jsxs("span", { ...props, ref: ref, className: cx('pui-spinner', className), "data-size": sizeName(size), "data-ui-size": scheme, role: decorative ? undefined : 'status', "aria-hidden": decorative || undefined, children: [_jsxs("svg", { viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', strokeWidth: '2', "aria-hidden": 'true', children: [_jsx("circle", { cx: '12', cy: '12', r: '9', opacity: '.2' }), _jsx("path", { d: 'M12 3a9 9 0 0 1 9 9', strokeLinecap: 'round' })] }), !decorative && _jsx("span", { className: 'pui-feedback-sr', children: label })] }));
10
+ });
package/dist/status.d.ts CHANGED
@@ -1,22 +1,4 @@
1
- import * as React from 'react';
2
- import { type ComponentSize } from './sizing.js';
3
1
  export type StatusTone = 'neutral' | 'success' | 'danger' | 'caution' | 'progress';
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
2
  export declare function StatusIcon({ tone }: {
15
3
  tone: StatusTone;
16
- }): React.JSX.Element;
17
- /** Domain status labels and live announcements remain the caller's responsibility. */
18
- export declare const StatusBadge: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & {
19
- size?: ComponentSize;
20
- tone?: StatusTone;
21
- icon?: React.ReactNode;
22
- } & React.RefAttributes<HTMLSpanElement>>;
4
+ }): import("react").JSX.Element;
package/dist/status.js CHANGED
@@ -1,17 +1,13 @@
1
1
  'use client';
2
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
- import * as React from 'react';
4
- import { useComponentSize } from './sizing.js';
5
- import { useToneTransition } from './tone-transition.js';
6
- export const Badge = React.forwardRef(function Badge({ tone = 'neutral', icon, children, className, size, ...props }, ref) {
7
- const scheme = useComponentSize(size);
8
- const elementRef = useToneTransition(tone, ref);
9
- return (_jsxs("span", { ...props, ref: elementRef, className: ['pui-badge', className].filter(Boolean).join(' '), "data-tone": tone, "data-ui-size": scheme, children: [icon && (_jsx("span", { className: 'pui-badge-icon', "aria-hidden": 'true', children: icon })), children] }));
10
- });
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { Icon } from './icon.js';
4
+ const statusIcons = {
5
+ neutral: 'minus-circle',
6
+ success: 'check',
7
+ danger: 'alert',
8
+ caution: 'warning',
9
+ progress: 'clock',
10
+ };
11
11
  export function StatusIcon({ tone }) {
12
- return (_jsx("svg", { width: '13', height: '13', viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', strokeWidth: '1.7', "aria-hidden": 'true', children: tone === 'success' ? (_jsx("path", { d: 'm5 12 4 4L19 6' })) : tone === 'caution' ? (_jsxs(_Fragment, { children: [_jsx("path", { d: 'm12 3 10 18H2L12 3Z' }), _jsx("path", { d: 'M12 9v4m0 3v1' })] })) : tone === 'danger' ? (_jsxs(_Fragment, { children: [_jsx("circle", { cx: '12', cy: '12', r: '9' }), _jsx("path", { d: 'M12 7v6m0 3v1' })] })) : tone === 'progress' ? (_jsxs(_Fragment, { children: [_jsx("circle", { cx: '12', cy: '12', r: '9' }), _jsx("path", { d: 'M12 7v6l4 2' })] })) : (_jsxs(_Fragment, { children: [_jsx("circle", { cx: '12', cy: '12', r: '9' }), _jsx("path", { d: 'M8 12h8' })] })) }));
12
+ return _jsx(Icon, { name: statusIcons[tone] });
13
13
  }
14
- /** Domain status labels and live announcements remain the caller's responsibility. */
15
- export const StatusBadge = React.forwardRef(function StatusBadge({ tone = 'neutral', icon, ...props }, ref) {
16
- return (_jsx(Badge, { ...props, ref: ref, tone: tone, icon: icon === undefined ? _jsx(StatusIcon, { tone: tone }) : icon }));
17
- });
@@ -0,0 +1,13 @@
1
+ import * as React from 'react';
2
+ import { type ChoiceSize } from './choice.js';
3
+ declare const SwitchRoot: React.ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react/switch").SwitchRootProps, "ref"> & React.RefAttributes<HTMLElement>, "ref"> & ChoiceSize & React.RefAttributes<HTMLElement>>;
4
+ export declare const Switch: {
5
+ Root: React.ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react/switch").SwitchRootProps, "ref"> & React.RefAttributes<HTMLElement>, "ref"> & ChoiceSize & React.RefAttributes<HTMLElement>>;
6
+ Thumb: React.ForwardRefExoticComponent<Omit<Omit<Omit<import("@base-ui/react/switch").SwitchThumbProps, "ref"> & React.RefAttributes<HTMLSpanElement>, "ref">, "size"> & {
7
+ size?: import("./sizing.js").ComponentSize;
8
+ } & React.RefAttributes<HTMLSpanElement>>;
9
+ };
10
+ export { SwitchRoot };
11
+ export declare const SwitchThumb: React.ForwardRefExoticComponent<Omit<Omit<Omit<import("@base-ui/react/switch").SwitchThumbProps, "ref"> & React.RefAttributes<HTMLSpanElement>, "ref">, "size"> & {
12
+ size?: import("./sizing.js").ComponentSize;
13
+ } & React.RefAttributes<HTMLSpanElement>>;
package/dist/switch.js ADDED
@@ -0,0 +1,25 @@
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import * as React from 'react';
4
+ import { useComponentSize } from './sizing.js';
5
+ import { Switch as BaseSwitch } from '@base-ui/react/switch';
6
+ import { skin, part } from './parts.js';
7
+ import { useRootRef, useResetValue } from './form-state.js';
8
+ const SwitchRoot = /* @__PURE__ */ React.forwardRef(function SwitchRoot({ size, checked, defaultChecked = false, onCheckedChange, className, form, ...props }, ref) {
9
+ const scheme = useComponentSize(size);
10
+ const [element, attach] = useRootRef(ref);
11
+ const [selected, setSelected] = useResetValue(checked, defaultChecked, element, form);
12
+ return (_jsx(BaseSwitch.Root, { ...props, "data-ui-size": size ? scheme : undefined, form: form, ref: attach, checked: selected, className: skin('pui-switch', className), onCheckedChange: (next, event) => {
13
+ onCheckedChange?.(next, event);
14
+ if (checked === undefined && !event.isCanceled)
15
+ setSelected(next);
16
+ } }));
17
+ });
18
+ export const Switch = {
19
+ ...BaseSwitch,
20
+ Root: SwitchRoot,
21
+ Thumb: /* @__PURE__ */ part(BaseSwitch.Thumb, 'pui-switch-thumb'),
22
+ };
23
+ // Flat names for React Server Components, which cannot dot into client exports.
24
+ export { SwitchRoot };
25
+ export const { Thumb: SwitchThumb } = Switch;
@@ -0,0 +1,7 @@
1
+ import * as React from 'react';
2
+ import type { SyntaxToken } from './syntax-engine.js';
3
+ export type SyntaxEngine = {
4
+ highlightCode(code: string, language: string): Promise<SyntaxToken[][] | null>;
5
+ };
6
+ /** Loads the highlighting engine. Without a provider, code renders as plain text. */
7
+ export declare const SyntaxEngineContext: React.Context<(() => Promise<SyntaxEngine>) | null>;
@@ -0,0 +1,4 @@
1
+ 'use client';
2
+ import * as React from 'react';
3
+ /** Loads the highlighting engine. Without a provider, code renders as plain text. */
4
+ export const SyntaxEngineContext = /* @__PURE__ */ React.createContext(null);
@@ -7,7 +7,10 @@ export type SyntaxHighlighterProps = Omit<React.ComponentPropsWithoutRef<'code'>
7
7
  label?: string;
8
8
  wrap?: boolean;
9
9
  };
10
- /** Rendering remains selectable React text; it never inserts executable HTML. */
10
+ /**
11
+ * Rendering remains selectable React text; it never inserts executable HTML. Tokens are
12
+ * colored inside a SyntaxHighlighting provider; without one, the code renders plain.
13
+ */
11
14
  export declare const SyntaxHighlighter: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>, "ref">, "children"> & {
12
15
  code: string;
13
16
  language?: string;
@@ -2,6 +2,8 @@
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import * as React from 'react';
4
4
  import { ScrollArea } from './scroll-area.js';
5
+ import { SyntaxEngineContext } from './syntax-context.js';
6
+ import { cx } from './parts.js';
5
7
  export const syntaxLanguages = [
6
8
  'tsx',
7
9
  'jsx',
@@ -29,18 +31,23 @@ const aliases = {
29
31
  plaintext: 'text',
30
32
  txt: 'text',
31
33
  };
32
- /** Rendering remains selectable React text; it never inserts executable HTML. */
33
- export const SyntaxHighlighter = React.forwardRef(function SyntaxHighlighter({ code, language = 'text', inline = false, label = 'Highlighted source', wrap = false, className, ...props }, ref) {
34
+ /**
35
+ * Rendering remains selectable React text; it never inserts executable HTML. Tokens are
36
+ * colored inside a SyntaxHighlighting provider; without one, the code renders plain.
37
+ */
38
+ export const SyntaxHighlighter = /* @__PURE__ */ React.forwardRef(function SyntaxHighlighter({ code, language = 'text', inline = false, label = 'Highlighted source', wrap = false, className, ...props }, ref) {
39
+ const load = React.useContext(SyntaxEngineContext);
34
40
  const name = language.trim().toLowerCase();
35
41
  const lang = aliases[name] ?? name;
36
42
  const [result, setResult] = React.useState();
37
43
  React.useEffect(() => {
38
44
  let current = true;
39
- if (lang === 'text' ||
45
+ if (!load ||
46
+ lang === 'text' ||
40
47
  !syntaxLanguages.includes(lang) ||
41
48
  code.length > 50000)
42
49
  return;
43
- import('./syntax-engine.js')
50
+ load()
44
51
  .then((engine) => engine.highlightCode(code, lang))
45
52
  .then((tokens) => {
46
53
  if (current)
@@ -53,11 +60,11 @@ export const SyntaxHighlighter = React.forwardRef(function SyntaxHighlighter({ c
53
60
  return () => {
54
61
  current = false;
55
62
  };
56
- }, [code, lang]);
63
+ }, [code, lang, load]);
57
64
  const tokens = result?.code === code && result.language === lang ? result.tokens : null;
58
65
  const eols = code.match(/\r\n|\n|\r/g) ?? [];
59
66
  const valid = tokens && tokens.length === eols.length + 1;
60
- const element = (_jsx("code", { ...props, ref: ref, className: ['pui-syntax', className].filter(Boolean).join(' '), "data-language": lang, "data-highlighted": valid ? 'true' : 'false', children: valid
67
+ const element = (_jsx("code", { ...props, ref: ref, className: cx('pui-syntax', className), "data-language": lang, "data-highlighted": valid ? 'true' : 'false', children: valid
61
68
  ? tokens.map((line, i) => (_jsxs(React.Fragment, { children: [line.map((token, j) => (_jsx("span", { "data-syntax": token.role, children: token.content }, j))), eols[i] ?? ''] }, i)))
62
69
  : code }));
63
70
  return inline ? (element) : (_jsx(ScrollArea, { label: label, orientation: 'horizontal', rootClassName: 'pui-syntax-scroll', children: _jsx("pre", { className: 'pui-syntax-pre', "data-wrap": wrap || undefined, children: element }) }));
@@ -0,0 +1,8 @@
1
+ import * as React from 'react';
2
+ /**
3
+ * Turns on syntax highlighting for CodeBlock, SyntaxHighlighter and Markdown inside it.
4
+ * Requires the optional `shiki` package; without this provider, code renders as plain text.
5
+ */
6
+ export declare function SyntaxHighlighting({ children, }: {
7
+ children?: React.ReactNode;
8
+ }): React.JSX.Element;
@@ -0,0 +1,12 @@
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { SyntaxEngineContext } from './syntax-context.js';
4
+ // The engine and each grammar load on first use, in their own chunks.
5
+ const load = () => import('./syntax-engine.js');
6
+ /**
7
+ * Turns on syntax highlighting for CodeBlock, SyntaxHighlighter and Markdown inside it.
8
+ * Requires the optional `shiki` package; without this provider, code renders as plain text.
9
+ */
10
+ export function SyntaxHighlighting({ children, }) {
11
+ return (_jsx(SyntaxEngineContext.Provider, { value: load, children: children }));
12
+ }
@@ -7,6 +7,9 @@ declare const TableContainer: React.ForwardRefExoticComponent<Omit<Omit<React.De
7
7
  scrollChain?: "auto" | "contain";
8
8
  } & React.RefAttributes<HTMLDivElement>, "ref"> & {
9
9
  label: string;
10
+ /** Hangs the table into the gutter by its cell inset, so cell text lines up with
11
+ * the text around it and a row's hover reaches past it evenly on both sides. */
12
+ bleed?: boolean;
10
13
  } & React.RefAttributes<HTMLDivElement>>;
11
14
  export type TableDensity = 'default' | 'compact';
12
15
  declare const TableRoot: React.ForwardRefExoticComponent<Omit<Omit<Omit<React.DetailedHTMLProps<React.TableHTMLAttributes<HTMLTableElement>, HTMLTableElement>, "ref">, "size"> & {
@@ -55,6 +58,9 @@ export declare const Table: {
55
58
  scrollChain?: "auto" | "contain";
56
59
  } & React.RefAttributes<HTMLDivElement>, "ref"> & {
57
60
  label: string;
61
+ /** Hangs the table into the gutter by its cell inset, so cell text lines up with
62
+ * the text around it and a row's hover reaches past it evenly on both sides. */
63
+ bleed?: boolean;
58
64
  } & React.RefAttributes<HTMLDivElement>>;
59
65
  Root: React.ForwardRefExoticComponent<Omit<Omit<Omit<React.DetailedHTMLProps<React.TableHTMLAttributes<HTMLTableElement>, HTMLTableElement>, "ref">, "size"> & {
60
66
  size?: import("./sizing.js").ComponentSize;
@@ -97,38 +103,7 @@ export declare const Table: {
97
103
  colSpan: number;
98
104
  } & React.RefAttributes<HTMLTableCellElement>>;
99
105
  };
100
- declare const ListRoot: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLUListElement>, HTMLUListElement>, "ref"> & React.RefAttributes<HTMLUListElement>>;
101
- declare const ListItem: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, "ref"> & {
102
- selected?: boolean;
103
- } & React.RefAttributes<HTMLLIElement>>;
104
- export declare const List: {
105
- Root: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLUListElement>, HTMLUListElement>, "ref"> & React.RefAttributes<HTMLUListElement>>;
106
- Item: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, "ref"> & {
107
- selected?: boolean;
108
- } & React.RefAttributes<HTMLLIElement>>;
109
- Content: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "size"> & {
110
- size?: import("./sizing.js").ComponentSize;
111
- } & React.RefAttributes<HTMLDivElement>>;
112
- Title: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "size"> & {
113
- size?: import("./sizing.js").ComponentSize;
114
- } & React.RefAttributes<HTMLDivElement>>;
115
- Description: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, "ref">, "size"> & {
116
- size?: import("./sizing.js").ComponentSize;
117
- } & React.RefAttributes<HTMLParagraphElement>>;
118
- Actions: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "size"> & {
119
- size?: import("./sizing.js").ComponentSize;
120
- } & React.RefAttributes<HTMLDivElement>>;
121
- };
122
- export { ListRoot, ListItem, TableContainer, TableRoot, TableRow, TableHeaderCell, TableSortHeader, TableCell, TableTruncate, TableMessage, };
123
- export declare const ListContent: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "size"> & {
124
- size?: import("./sizing.js").ComponentSize;
125
- } & React.RefAttributes<HTMLDivElement>>, ListTitle: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "size"> & {
126
- size?: import("./sizing.js").ComponentSize;
127
- } & React.RefAttributes<HTMLDivElement>>, ListDescription: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, "ref">, "size"> & {
128
- size?: import("./sizing.js").ComponentSize;
129
- } & React.RefAttributes<HTMLParagraphElement>>, ListActions: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "size"> & {
130
- size?: import("./sizing.js").ComponentSize;
131
- } & React.RefAttributes<HTMLDivElement>>;
106
+ export { TableContainer, TableRoot, TableRow, TableHeaderCell, TableSortHeader, TableCell, TableTruncate, TableMessage, };
132
107
  export declare const TableCaption: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>, "ref">, "size"> & {
133
108
  size?: import("./sizing.js").ComponentSize;
134
109
  } & React.RefAttributes<HTMLTableCaptionElement>>, TableHead: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>, "ref">, "size"> & {
@@ -138,3 +113,4 @@ export declare const TableCaption: React.ForwardRefExoticComponent<Omit<Omit<Rea
138
113
  } & React.RefAttributes<HTMLTableSectionElement>>, TableFoot: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>, "ref">, "size"> & {
139
114
  size?: import("./sizing.js").ComponentSize;
140
115
  } & React.RefAttributes<HTMLTableSectionElement>>;
116
+ export { useTableSelection, type TableSelectionOptions, type TableSelectionCheckbox, } from './table-selection.js';
package/dist/table.js ADDED
@@ -0,0 +1,67 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import * as React from 'react';
4
+ import { Icon } from './icon.js';
5
+ import { Button } from './button.js';
6
+ import { part, cx } from './parts.js';
7
+ import { ScrollArea } from './scroll-area.js';
8
+ const TableContainer = /* @__PURE__ */ React.forwardRef(function TableContainer({ bleed, rootClassName, ...props }, ref) {
9
+ return (_jsx(ScrollArea, { ...props, ref: ref, rootClassName: cx(bleed && 'pui-table-bleed', rootClassName) }));
10
+ });
11
+ const RootPart = /* @__PURE__ */ part('table', 'pui-table');
12
+ const TableRoot = /* @__PURE__ */ React.forwardRef(function TableRoot({ density, stickyHeader, ...props }, ref) {
13
+ return (_jsx(RootPart, { ...props, ref: ref, "data-density": density === 'compact' ? 'compact' : undefined, "data-sticky-header": stickyHeader || undefined }));
14
+ });
15
+ const layout = ({ align, numeric }) => ({
16
+ 'data-align': numeric ? 'end' : align,
17
+ 'data-numeric': numeric || undefined,
18
+ });
19
+ const HeaderCellPart = /* @__PURE__ */ part('th', 'pui-table-cell pui-table-header');
20
+ const CellPart = /* @__PURE__ */ part('td', 'pui-table-cell');
21
+ // align replaces the obsolete HTML align attribute of th and td.
22
+ const TableHeaderCell = /* @__PURE__ */ React.forwardRef(function TableHeaderCell({ align, numeric, ...props }, ref) {
23
+ return _jsx(HeaderCellPart, { ...props, ...layout({ align, numeric }), ref: ref });
24
+ });
25
+ const TableCell = /* @__PURE__ */ React.forwardRef(function TableCell({ align, numeric, ...props }, ref) {
26
+ return _jsx(CellPart, { ...props, ...layout({ align, numeric }), ref: ref });
27
+ });
28
+ function SortIcon({ sort }) {
29
+ return (_jsx(Icon, { name: sort === 'ascending'
30
+ ? 'arrow-up'
31
+ : sort === 'descending'
32
+ ? 'arrow-down'
33
+ : 'sort', className: 'pui-table-sort-icon' }));
34
+ }
35
+ /** A column header whose button sorts the column. aria-sort names the order on the sorted column only. */
36
+ const TableSortHeader = /* @__PURE__ */ React.forwardRef(function TableSortHeader({ sort, onSort, disabled, children, className, ...props }, ref) {
37
+ return (_jsx(TableHeaderCell, { ...props, ref: ref, scope: 'col', "aria-sort": sort, className: cx('pui-table-sort-header', className), 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 })] }) }));
38
+ });
39
+ /** One-line text that ends in an ellipsis. String content also becomes the title. */
40
+ const TableTruncate = /* @__PURE__ */ React.forwardRef(function TableTruncate({ className, title, children, ...props }, ref) {
41
+ return (_jsx("span", { ...props, ref: ref, title: title ?? (typeof children === 'string' ? children : undefined), className: cx('pui-table-truncate', className), children: children }));
42
+ });
43
+ /** A full-width body row for loading, empty, error and permission messages. It has no hover. */
44
+ const TableMessage = /* @__PURE__ */ React.forwardRef(function TableMessage({ className, ...props }, ref) {
45
+ return (_jsx("tr", { className: 'pui-table-row pui-table-message-row', children: _jsx("td", { ...props, ref: ref, className: cx('pui-table-cell pui-table-message', className) }) }));
46
+ });
47
+ const TableRow = /* @__PURE__ */ React.forwardRef(function TableRow({ selected, className, ...props }, ref) {
48
+ return (_jsx("tr", { ...props, ref: ref, "data-selected": selected || undefined, className: cx('pui-table-row', className) }));
49
+ });
50
+ export const Table = {
51
+ Container: TableContainer,
52
+ Root: TableRoot,
53
+ Caption: /* @__PURE__ */ part('caption', 'pui-table-caption'),
54
+ Head: /* @__PURE__ */ part('thead', 'pui-table-head'),
55
+ Body: /* @__PURE__ */ part('tbody', 'pui-table-body'),
56
+ Foot: /* @__PURE__ */ part('tfoot', 'pui-table-foot'),
57
+ Row: TableRow,
58
+ HeaderCell: TableHeaderCell,
59
+ SortHeader: TableSortHeader,
60
+ Cell: TableCell,
61
+ Truncate: TableTruncate,
62
+ Message: TableMessage,
63
+ };
64
+ // Flat names for React Server Components, which cannot dot into client exports.
65
+ export { TableContainer, TableRoot, TableRow, TableHeaderCell, TableSortHeader, TableCell, TableTruncate, TableMessage, };
66
+ export const { Caption: TableCaption, Head: TableHead, Body: TableBody, Foot: TableFoot, } = Table;
67
+ export { useTableSelection, } from './table-selection.js';
package/dist/tabs.d.ts ADDED
@@ -0,0 +1,29 @@
1
+ import * as React from 'react';
2
+ export declare const Tabs: {
3
+ Root: React.ForwardRefExoticComponent<Omit<Omit<Omit<import("@base-ui/react/tabs").TabsRootProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref">, "size"> & {
4
+ size?: import("./sizing.js").ComponentSize;
5
+ } & React.RefAttributes<HTMLDivElement>>;
6
+ List: React.ForwardRefExoticComponent<Omit<Omit<Omit<import("@base-ui/react/tabs").TabsListProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref">, "size"> & {
7
+ size?: import("./sizing.js").ComponentSize;
8
+ } & React.RefAttributes<HTMLDivElement>>;
9
+ Tab: React.ForwardRefExoticComponent<Omit<Omit<Omit<import("@base-ui/react/tabs").TabsTabProps, "ref"> & React.RefAttributes<HTMLElement>, "ref">, "size"> & {
10
+ size?: import("./sizing.js").ComponentSize;
11
+ } & React.RefAttributes<HTMLElement>>;
12
+ Panel: React.ForwardRefExoticComponent<Omit<Omit<Omit<import("@base-ui/react/tabs").TabsPanelProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref">, "size"> & {
13
+ size?: import("./sizing.js").ComponentSize;
14
+ } & React.RefAttributes<HTMLDivElement>>;
15
+ Indicator: React.ForwardRefExoticComponent<Omit<Omit<Omit<import("@base-ui/react/tabs").TabsIndicatorProps, "ref"> & React.RefAttributes<HTMLSpanElement>, "ref">, "size"> & {
16
+ size?: import("./sizing.js").ComponentSize;
17
+ } & React.RefAttributes<HTMLSpanElement>>;
18
+ };
19
+ export declare const TabsIndicator: React.ForwardRefExoticComponent<Omit<Omit<Omit<import("@base-ui/react/tabs").TabsIndicatorProps, "ref"> & React.RefAttributes<HTMLSpanElement>, "ref">, "size"> & {
20
+ size?: import("./sizing.js").ComponentSize;
21
+ } & React.RefAttributes<HTMLSpanElement>>, TabsList: React.ForwardRefExoticComponent<Omit<Omit<Omit<import("@base-ui/react/tabs").TabsListProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref">, "size"> & {
22
+ size?: import("./sizing.js").ComponentSize;
23
+ } & React.RefAttributes<HTMLDivElement>>, TabsPanel: React.ForwardRefExoticComponent<Omit<Omit<Omit<import("@base-ui/react/tabs").TabsPanelProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref">, "size"> & {
24
+ size?: import("./sizing.js").ComponentSize;
25
+ } & React.RefAttributes<HTMLDivElement>>, TabsRoot: React.ForwardRefExoticComponent<Omit<Omit<Omit<import("@base-ui/react/tabs").TabsRootProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref">, "size"> & {
26
+ size?: import("./sizing.js").ComponentSize;
27
+ } & React.RefAttributes<HTMLDivElement>>, TabsTab: React.ForwardRefExoticComponent<Omit<Omit<Omit<import("@base-ui/react/tabs").TabsTabProps, "ref"> & React.RefAttributes<HTMLElement>, "ref">, "size"> & {
28
+ size?: import("./sizing.js").ComponentSize;
29
+ } & React.RefAttributes<HTMLElement>>;
package/dist/tabs.js ADDED
@@ -0,0 +1,13 @@
1
+ 'use client';
2
+ import { Tabs as BaseTabs } from '@base-ui/react/tabs';
3
+ import { part } from './parts.js';
4
+ export const Tabs = {
5
+ ...BaseTabs,
6
+ Root: /* @__PURE__ */ part(BaseTabs.Root, 'pui-tabs'),
7
+ List: /* @__PURE__ */ part(BaseTabs.List, 'pui-tabs-list'),
8
+ Tab: /* @__PURE__ */ part(BaseTabs.Tab, 'pui-tabs-tab'),
9
+ Panel: /* @__PURE__ */ part(BaseTabs.Panel, 'pui-tabs-panel'),
10
+ Indicator: /* @__PURE__ */ part(BaseTabs.Indicator, 'pui-tabs-indicator'),
11
+ };
12
+ // Flat names for React Server Components, which cannot dot into client exports.
13
+ export const { Indicator: TabsIndicator, List: TabsList, Panel: TabsPanel, Root: TabsRoot, Tab: TabsTab, } = Tabs;
@@ -0,0 +1,7 @@
1
+ import * as React from 'react';
2
+ import { type ComponentSizeAlias } from './sizing.js';
3
+ /** A multi-line text field. Inside Field.Root it takes the label, description and
4
+ * error from the field, as Input does. */
5
+ export declare const Textarea: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>, "ref"> & {
6
+ size?: ComponentSizeAlias;
7
+ } & React.RefAttributes<HTMLTextAreaElement>>;
@@ -0,0 +1,12 @@
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import * as React from 'react';
4
+ import { useComponentSize } from './sizing.js';
5
+ import { Field as BaseField } from '@base-ui/react/field';
6
+ import { cx } from './parts.js';
7
+ /** A multi-line text field. Inside Field.Root it takes the label, description and
8
+ * error from the field, as Input does. */
9
+ export const Textarea = /* @__PURE__ */ React.forwardRef(function Textarea({ className, size, rows, cols, wrap, ...props }, ref) {
10
+ const scheme = useComponentSize(size);
11
+ return (_jsx(BaseField.Control, { ...props, ref: ref, "data-ui-size": scheme, render: _jsx("textarea", { rows: rows, cols: cols, wrap: wrap }), className: cx('pui-input pui-textarea', className) }));
12
+ });
package/dist/toast.js CHANGED
@@ -1,25 +1,26 @@
1
1
  'use client';
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import * as React from 'react';
4
+ import { Icon } from './icon.js';
4
5
  import { useComponentSize } from './sizing.js';
5
6
  import { Toast as BaseToast } from '@base-ui/react/toast';
6
- import { part, skin } from './parts.js';
7
+ import { part, skin, cx } from './parts.js';
7
8
  import { StatusIcon } from './status.js';
8
- const ToneContext = React.createContext('neutral');
9
- const Root = React.forwardRef(function Root({ tone = 'neutral', className, ...props }, ref) {
9
+ const ToneContext = /* @__PURE__ */ React.createContext('neutral');
10
+ const Root = /* @__PURE__ */ React.forwardRef(function Root({ tone = 'neutral', className, ...props }, ref) {
10
11
  return (_jsx(ToneContext.Provider, { value: tone, children: _jsx(BaseToast.Root, { ...props, ref: ref, "data-tone": tone, className: skin('pui-toast', className) }) }));
11
12
  });
12
- const Icon = React.forwardRef(function Icon({ tone, children, className, ...props }, ref) {
13
+ const ToneIcon = /* @__PURE__ */ React.forwardRef(function ToastIcon({ tone, children, className, ...props }, ref) {
13
14
  const inherited = React.useContext(ToneContext);
14
- return (_jsx("span", { ...props, ref: ref, "aria-hidden": 'true', className: ['pui-toast-icon', className].filter(Boolean).join(' '), children: children ?? _jsx(StatusIcon, { tone: tone ?? inherited }) }));
15
+ return (_jsx("span", { ...props, ref: ref, "aria-hidden": 'true', className: cx('pui-toast-icon', className), children: children ?? _jsx(StatusIcon, { tone: tone ?? inherited }) }));
15
16
  });
16
- const Close = React.forwardRef(function Close({ className, children, ...props }, ref) {
17
- return (_jsx(BaseToast.Close, { "aria-label": 'Dismiss notification', "aria-hidden": false, "data-variant": 'ghost', "data-size": 'icon', ...props, ref: ref, className: skin('pui-button pui-toast-close', className), children: children ?? (_jsx("svg", { width: '16', height: '16', viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', strokeWidth: '1.6', "aria-hidden": 'true', children: _jsx("path", { d: 'm6 6 12 12M18 6 6 18' }) })) }));
17
+ const Close = /* @__PURE__ */ React.forwardRef(function Close({ className, children, ...props }, ref) {
18
+ return (_jsx(BaseToast.Close, { "aria-label": 'Dismiss notification', "aria-hidden": false, "data-variant": 'ghost', "data-size": 'icon-sm', "data-ui-size": 'small', ...props, ref: ref, className: skin('pui-button pui-toast-close', className), children: children ?? _jsx(Icon, { name: 'close' }) }));
18
19
  });
19
- const Action = React.forwardRef(function Action({ className, ...props }, ref) {
20
- return (_jsx(BaseToast.Action, { "data-variant": 'outline', "data-size": 'sm', ...props, ref: ref, className: skin('pui-button pui-toast-action', className) }));
20
+ const Action = /* @__PURE__ */ React.forwardRef(function Action({ className, ...props }, ref) {
21
+ return (_jsx(BaseToast.Action, { "data-variant": 'outline', "data-size": 'small', "data-ui-size": 'small', ...props, ref: ref, className: skin('pui-button pui-toast-action', className) }));
21
22
  });
22
- const Viewport = React.forwardRef(function Viewport({ layout = 'stack', className, ...props }, ref) {
23
+ const Viewport = /* @__PURE__ */ React.forwardRef(function Viewport({ layout = 'stack', className, ...props }, ref) {
23
24
  const viewportRef = React.useRef(null);
24
25
  React.useLayoutEffect(() => {
25
26
  const viewport = viewportRef.current;
@@ -31,7 +32,7 @@ const Viewport = React.forwardRef(function Viewport({ layout = 'stack', classNam
31
32
  const gap = parseFloat(getComputedStyle(viewport).rowGap) || 0;
32
33
  const height = cards.reduce((sum, card) => {
33
34
  const natural = parseFloat(getComputedStyle(card).getPropertyValue('--toast-height'));
34
- return (sum + (Number.isFinite(natural) ? natural : card.offsetHeight));
35
+ return sum + (Number.isFinite(natural) ? natural : card.offsetHeight);
35
36
  }, 0) +
36
37
  Math.max(0, cards.length - 1) * gap;
37
38
  const wasOverflow = viewport.hasAttribute('data-stack-overflow');
@@ -85,15 +86,15 @@ const Viewport = React.forwardRef(function Viewport({ layout = 'stack', classNam
85
86
  export const Toast = {
86
87
  ...BaseToast,
87
88
  Root,
88
- Icon,
89
+ Icon: ToneIcon,
89
90
  Close,
90
91
  Action,
91
92
  Viewport,
92
- Content: part(BaseToast.Content, 'pui-toast-content'),
93
- Title: part(BaseToast.Title, 'pui-toast-title'),
94
- Description: part(BaseToast.Description, 'pui-toast-description'),
95
- Text: part('div', 'pui-toast-text'),
96
- Positioner: part(BaseToast.Positioner, 'pui-positioner'),
93
+ Content: /* @__PURE__ */ part(BaseToast.Content, 'pui-toast-content'),
94
+ Title: /* @__PURE__ */ part(BaseToast.Title, 'pui-toast-title'),
95
+ Description: /* @__PURE__ */ part(BaseToast.Description, 'pui-toast-description'),
96
+ Text: /* @__PURE__ */ part('div', 'pui-toast-text'),
97
+ Positioner: /* @__PURE__ */ part(BaseToast.Positioner, 'pui-positioner', { portal: true }),
97
98
  };
98
99
  // Flat names for React Server Components, which cannot dot into client exports.
99
100
  export const { Action: ToastAction, Arrow: ToastArrow, Close: ToastClose, Content: ToastContent, Description: ToastDescription, Portal: ToastPortal, Positioner: ToastPositioner, Provider: ToastProvider, Root: ToastRoot, Title: ToastTitle, Viewport: ToastViewport, Icon: ToastIcon, Text: ToastText, } = Toast;
@@ -0,0 +1,5 @@
1
+ import * as React from 'react';
2
+ import { ToggleGroup as BaseToggleGroup } from '@base-ui/react/toggle-group';
3
+ export declare function ToggleGroup<Value extends string>({ className, ref, ...props }: BaseToggleGroup.Props<Value> & {
4
+ ref?: React.Ref<HTMLDivElement>;
5
+ }): React.JSX.Element;
@@ -0,0 +1,7 @@
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { ToggleGroup as BaseToggleGroup } from '@base-ui/react/toggle-group';
4
+ import { skin } from './parts.js';
5
+ export function ToggleGroup({ className, ref, ...props }) {
6
+ return (_jsx(BaseToggleGroup, { ...props, ref: ref, className: skin('pui-toggle-group', className) }));
7
+ }
@@ -0,0 +1,7 @@
1
+ import * as React from 'react';
2
+ import { type ComponentSizeAlias } from './sizing.js';
3
+ import { Toggle as BaseToggle } from '@base-ui/react/toggle';
4
+ export declare function Toggle<Value extends string>({ className, size, ref, ...props }: BaseToggle.Props<Value> & {
5
+ size?: ComponentSizeAlias | 'icon';
6
+ ref?: React.Ref<HTMLButtonElement>;
7
+ }): React.JSX.Element;
package/dist/toggle.js ADDED
@@ -0,0 +1,9 @@
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { useComponentSize } from './sizing.js';
4
+ import { Toggle as BaseToggle } from '@base-ui/react/toggle';
5
+ import { sizeName, skin } from './parts.js';
6
+ export function Toggle({ className, size, ref, ...props }) {
7
+ const scheme = useComponentSize(size === 'icon' ? undefined : size);
8
+ return (_jsx(BaseToggle, { ...props, ref: ref, className: skin('pui-button pui-toggle', className), "data-size": sizeName(size), "data-ui-size": scheme }));
9
+ }