@surflane/ui 0.4.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 (136) hide show
  1. package/README.md +1 -1
  2. package/dist/{disclosure.d.ts → accordion.d.ts} +1 -17
  3. package/dist/{disclosure.js → accordion.js} +3 -17
  4. package/dist/alert-dialog.d.ts +31 -0
  5. package/dist/alert-dialog.js +22 -0
  6. package/dist/app-shell.js +9 -9
  7. package/dist/{input-extensions.d.ts → autocomplete.d.ts} +4 -42
  8. package/dist/{input-extensions.js → autocomplete.js} +7 -26
  9. package/dist/avatar.js +3 -5
  10. package/dist/badge.d.ts +20 -0
  11. package/dist/badge.js +16 -0
  12. package/dist/{navigation.d.ts → breadcrumbs.d.ts} +2 -6
  13. package/dist/breadcrumbs.js +31 -0
  14. package/dist/button.d.ts +11 -0
  15. package/dist/button.js +27 -4
  16. package/dist/{content.d.ts → card.d.ts} +6 -24
  17. package/dist/card.js +26 -0
  18. package/dist/chart.d.ts +19 -0
  19. package/dist/chart.js +24 -6
  20. package/dist/checkbox-group.d.ts +2 -0
  21. package/dist/checkbox-group.js +16 -0
  22. package/dist/checkbox.d.ts +9 -0
  23. package/dist/checkbox.js +29 -0
  24. package/dist/choice-label.d.ts +25 -0
  25. package/dist/choice-label.js +14 -0
  26. package/dist/choice.d.ts +7 -0
  27. package/dist/choice.js +3 -0
  28. package/dist/code.d.ts +21 -0
  29. package/dist/{content.js → code.js} +5 -30
  30. package/dist/collapsible.d.ts +18 -0
  31. package/dist/collapsible.js +21 -0
  32. package/dist/{advanced-forms.d.ts → combobox.d.ts} +5 -25
  33. package/dist/{advanced-forms.js → combobox.js} +13 -49
  34. package/dist/{context-overlays.d.ts → context-menu.d.ts} +6 -28
  35. package/dist/{context-overlays.js → context-menu.js} +5 -25
  36. package/dist/date-picker.js +3 -2
  37. package/dist/dialog.d.ts +6 -24
  38. package/dist/dialog.js +7 -20
  39. package/dist/{panels.d.ts → drawer.d.ts} +3 -34
  40. package/dist/drawer.js +47 -0
  41. package/dist/empty-state.d.ts +29 -0
  42. package/dist/empty-state.js +19 -0
  43. package/dist/field.d.ts +42 -0
  44. package/dist/field.js +21 -0
  45. package/dist/fieldset.d.ts +14 -0
  46. package/dist/fieldset.js +10 -0
  47. package/dist/file-upload.d.ts +3 -1
  48. package/dist/file-upload.js +7 -5
  49. package/dist/filter-bar.js +1 -1
  50. package/dist/form.d.ts +2 -0
  51. package/dist/form.js +7 -0
  52. package/dist/icon.d.ts +10 -0
  53. package/dist/icon.js +18 -3
  54. package/dist/index.d.ts +56 -29
  55. package/dist/index.js +70 -32
  56. package/dist/{messages.d.ts → inline-message.d.ts} +0 -28
  57. package/dist/{messages.js → inline-message.js} +3 -18
  58. package/dist/input.js +2 -2
  59. package/dist/{foundations.d.ts → layout.d.ts} +5 -23
  60. package/dist/{foundations.js → layout.js} +4 -19
  61. package/dist/link.d.ts +6 -0
  62. package/dist/link.js +17 -0
  63. package/dist/list.d.ts +33 -0
  64. package/dist/list.js +21 -0
  65. package/dist/markdown.js +4 -5
  66. package/dist/menu.d.ts +7 -5
  67. package/dist/menu.js +12 -8
  68. package/dist/menubar.d.ts +4 -0
  69. package/dist/menubar.js +4 -0
  70. package/dist/meter.d.ts +29 -0
  71. package/dist/meter.js +13 -0
  72. package/dist/native-select.d.ts +8 -0
  73. package/dist/native-select.js +54 -0
  74. package/dist/navigation-menu.js +8 -5
  75. package/dist/number-field.d.ts +23 -0
  76. package/dist/number-field.js +33 -0
  77. package/dist/page-header.d.ts +12 -0
  78. package/dist/page-header.js +9 -0
  79. package/dist/pagination.js +3 -4
  80. package/dist/panel.d.ts +13 -0
  81. package/dist/panel.js +13 -0
  82. package/dist/parts.d.ts +19 -1
  83. package/dist/parts.js +32 -6
  84. package/dist/popover.d.ts +23 -6
  85. package/dist/popover.js +17 -7
  86. package/dist/preview-card.d.ts +29 -0
  87. package/dist/preview-card.js +27 -0
  88. package/dist/progress.d.ts +29 -0
  89. package/dist/progress.js +13 -0
  90. package/dist/radio-group.d.ts +16 -0
  91. package/dist/radio-group.js +31 -0
  92. package/dist/scroll-area.js +3 -4
  93. package/dist/select.d.ts +8 -8
  94. package/dist/select.js +19 -54
  95. package/dist/separator.d.ts +4 -0
  96. package/dist/separator.js +8 -0
  97. package/dist/sheet.d.ts +29 -0
  98. package/dist/sheet.js +39 -0
  99. package/dist/skeleton.d.ts +8 -0
  100. package/dist/skeleton.js +8 -0
  101. package/dist/slider.d.ts +40 -0
  102. package/dist/slider.js +27 -0
  103. package/dist/spinner.d.ts +13 -0
  104. package/dist/spinner.js +10 -0
  105. package/dist/status.d.ts +1 -19
  106. package/dist/status.js +10 -14
  107. package/dist/switch.d.ts +13 -0
  108. package/dist/switch.js +25 -0
  109. package/dist/syntax-highlighter.js +2 -1
  110. package/dist/{data.d.ts → table.d.ts} +8 -32
  111. package/dist/{data.js → table.js} +15 -30
  112. package/dist/textarea.d.ts +7 -0
  113. package/dist/textarea.js +12 -0
  114. package/dist/toast.js +7 -6
  115. package/dist/toggle-group.d.ts +5 -0
  116. package/dist/toggle-group.js +7 -0
  117. package/dist/toggle.d.ts +7 -0
  118. package/dist/toggle.js +9 -0
  119. package/dist/{commands.d.ts → toolbar.d.ts} +0 -13
  120. package/dist/toolbar.js +14 -0
  121. package/dist/tooltip.d.ts +3 -2
  122. package/dist/tooltip.js +2 -2
  123. package/dist/tree.js +4 -2
  124. package/dist/typography.d.ts +12 -0
  125. package/dist/typography.js +14 -0
  126. package/package.json +237 -21
  127. package/src/styles.css +359 -191
  128. package/dist/chevron.d.ts +0 -3
  129. package/dist/chevron.js +0 -6
  130. package/dist/commands.js +0 -27
  131. package/dist/feedback.d.ts +0 -76
  132. package/dist/feedback.js +0 -35
  133. package/dist/forms.d.ts +0 -91
  134. package/dist/forms.js +0 -109
  135. package/dist/navigation.js +0 -41
  136. package/dist/panels.js +0 -100
package/dist/chart.d.ts CHANGED
@@ -20,12 +20,27 @@ export type ChartProps = Omit<React.ComponentPropsWithoutRef<'figure'>, 'childre
20
20
  height?: number;
21
21
  locale?: string;
22
22
  formatValue?: (value: number) => string;
23
+ /** Text the chart shows or announces; pass translations here. */
24
+ labels?: Partial<ChartLabels>;
25
+ /** @deprecated Use labels.missing. */
23
26
  missingLabel?: string;
27
+ /** @deprecated Use labels.empty. */
24
28
  emptyLabel?: string;
25
29
  hiddenSeries?: readonly string[];
26
30
  defaultHiddenSeries?: readonly string[];
27
31
  onHiddenSeriesChange?: (keys: string[]) => void;
28
32
  };
33
+ export type ChartLabels = {
34
+ missing: string;
35
+ empty: string;
36
+ noSeries: string;
37
+ showAll: string;
38
+ keyboardHelp: string;
39
+ values: (title: string) => string;
40
+ viewTable: string;
41
+ table: (title: string) => string;
42
+ tableCaption: (unit: string) => string;
43
+ };
29
44
  /** Cartesian trends with a persistent, keyboard-readable tooltip region and a
30
45
  * full data-table alternative. Missing values are gaps, never fabricated zeros. */
31
46
  export declare const Chart: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>, "ref">, "children" | "title"> & {
@@ -40,7 +55,11 @@ export declare const Chart: React.ForwardRefExoticComponent<Omit<Omit<React.Deta
40
55
  height?: number;
41
56
  locale?: string;
42
57
  formatValue?: (value: number) => string;
58
+ /** Text the chart shows or announces; pass translations here. */
59
+ labels?: Partial<ChartLabels>;
60
+ /** @deprecated Use labels.missing. */
43
61
  missingLabel?: string;
62
+ /** @deprecated Use labels.empty. */
44
63
  emptyLabel?: string;
45
64
  hiddenSeries?: readonly string[];
46
65
  defaultHiddenSeries?: readonly string[];
package/dist/chart.js CHANGED
@@ -2,8 +2,20 @@
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
3
  import * as React from 'react';
4
4
  import { Area, Bar, CartesianGrid, ComposedChart, Line, ReferenceLine, ResponsiveContainer, Tooltip, XAxis, YAxis, } from 'recharts';
5
- import { Table } from './data.js';
5
+ import { Table } from './table.js';
6
6
  import { Button } from './button.js';
7
+ import { cx } from './parts.js';
8
+ const chartLabels = {
9
+ missing: 'Not available',
10
+ empty: 'No numeric measurements to display.',
11
+ noSeries: 'No series selected.',
12
+ showAll: 'Show all series',
13
+ keyboardHelp: 'Focus the chart and use Left/Right to inspect points. Escape clears details. The data table includes every series.',
14
+ values: (title) => `${title} values`,
15
+ viewTable: 'View data table',
16
+ table: (title) => `${title} data table`,
17
+ tableCaption: (unit) => `All input measurements, including hidden series. Unit: ${unit}.`,
18
+ };
7
19
  const dashes = [undefined, '7 4', '2 4', '10 3 2 3', '12 5', '4 3'];
8
20
  const colorFor = (index) => `var(--chart-series-${(index % 3) + 1})`;
9
21
  function Marker({ cx, cy, color, index, }) {
@@ -20,7 +32,13 @@ function Pattern({ id, index, color, }) {
20
32
  }
21
33
  /** Cartesian trends with a persistent, keyboard-readable tooltip region and a
22
34
  * full data-table alternative. Missing values are gaps, never fabricated zeros. */
23
- export const Chart = /* @__PURE__ */ React.forwardRef(function Chart({ title, description, data, series, unit, xLabel, yLabel, type = 'line', height = 280, locale = 'en-US', formatValue, missingLabel = 'Not available', emptyLabel = 'No numeric measurements to display.', hiddenSeries, defaultHiddenSeries = [], onHiddenSeriesChange, className, ...props }, ref) {
35
+ export const Chart = /* @__PURE__ */ React.forwardRef(function Chart({ title, description, data, series, unit, xLabel, yLabel, type = 'line', height = 280, locale = 'en-US', formatValue, labels, missingLabel, emptyLabel, hiddenSeries, defaultHiddenSeries = [], onHiddenSeriesChange, className, ...props }, ref) {
36
+ const text = {
37
+ ...chartLabels,
38
+ ...(missingLabel === undefined ? {} : { missing: missingLabel }),
39
+ ...(emptyLabel === undefined ? {} : { empty: emptyLabel }),
40
+ ...labels,
41
+ };
24
42
  const id = React.useId().replace(/[^a-zA-Z0-9_-]/g, '_');
25
43
  const [internalHidden, setInternalHidden] = React.useState(defaultHiddenSeries);
26
44
  const hidden = new Set(hiddenSeries ?? internalHidden);
@@ -43,7 +61,7 @@ export const Chart = /* @__PURE__ */ React.forwardRef(function Chart({ title, de
43
61
  }), [locale]);
44
62
  const format = (value) => typeof value === 'number' && Number.isFinite(value)
45
63
  ? `${formatValue ? formatValue(value) : number.format(value)} ${unit}`
46
- : missingLabel;
64
+ : text.missing;
47
65
  const rows = React.useMemo(() => {
48
66
  const ids = new Set(), keys = new Set();
49
67
  for (const s of series) {
@@ -82,7 +100,7 @@ export const Chart = /* @__PURE__ */ React.forwardRef(function Chart({ title, de
82
100
  .filter((s) => (s.key === key ? !hidden.has(key) : hidden.has(s.key)))
83
101
  .map((s) => s.key));
84
102
  const chartHeight = Number.isFinite(height) ? Math.max(200, height) : 280;
85
- return (_jsxs("figure", { ...props, ref: ref, className: ['pui-chart', className].filter(Boolean).join(' '), "aria-labelledby": `${id}-title`, children: [_jsxs("figcaption", { className: 'pui-chart-caption', children: [_jsx("strong", { id: `${id}-title`, children: title }), _jsx("p", { id: `${id}-summary`, children: description })] }), _jsx("ul", { className: 'pui-chart-legend', "aria-label": `${title} series`, children: series.map((s, index) => (_jsx("li", { children: _jsxs("button", { ref: index === 0 ? firstLegend : undefined, type: 'button', className: 'pui-chart-legend-button', "aria-label": `${s.label} series`, "aria-pressed": !hidden.has(s.key), onClick: () => toggle(s.key), children: [_jsx("svg", { width: '32', height: '20', viewBox: '0 0 32 20', "aria-hidden": 'true', children: type === 'bar' ? (_jsxs(_Fragment, { children: [_jsx("defs", { children: _jsx(Pattern, { id: `${id}-legend-${index}`, color: colorFor(index), index: index }) }), _jsx("rect", { x: '4', y: '3', width: '24', height: '14', rx: '2', fill: `url(#${id}-legend-${index})` })] })) : (_jsxs(_Fragment, { children: [_jsx("path", { d: 'M1 10h30', stroke: colorFor(index), strokeWidth: '2', strokeDasharray: dashes[index % dashes.length] }), _jsx(Marker, { cx: 16, cy: 10, index: index, color: colorFor(index) })] })) }), _jsx("span", { children: s.label })] }) }, s.key))) }), _jsxs("p", { className: 'pui-chart-axis-label', children: [yLabel, " (", unit, ")"] }), hasValues ? (_jsxs(_Fragment, { children: [_jsx("p", { className: 'pui-chart-help', id: `${id}-keys`, children: "Focus the chart and use Left/Right to inspect points. Escape clears details. The data table includes every series." }), _jsx("div", { className: 'pui-chart-plot', onKeyDownCapture: (event) => {
103
+ return (_jsxs("figure", { ...props, ref: ref, className: cx('pui-chart', className), "aria-labelledby": `${id}-title`, children: [_jsxs("figcaption", { className: 'pui-chart-caption', children: [_jsx("strong", { id: `${id}-title`, children: title }), _jsx("p", { id: `${id}-summary`, children: description })] }), _jsx("ul", { className: 'pui-chart-legend', "aria-label": `${title} series`, children: series.map((s, index) => (_jsx("li", { children: _jsxs("button", { ref: index === 0 ? firstLegend : undefined, type: 'button', className: 'pui-chart-legend-button', "aria-label": `${s.label} series`, "aria-pressed": !hidden.has(s.key), onClick: () => toggle(s.key), children: [_jsx("svg", { width: '32', height: '20', viewBox: '0 0 32 20', "aria-hidden": 'true', children: type === 'bar' ? (_jsxs(_Fragment, { children: [_jsx("defs", { children: _jsx(Pattern, { id: `${id}-legend-${index}`, color: colorFor(index), index: index }) }), _jsx("rect", { x: '4', y: '3', width: '24', height: '14', rx: '2', fill: `url(#${id}-legend-${index})` })] })) : (_jsxs(_Fragment, { children: [_jsx("path", { d: 'M1 10h30', stroke: colorFor(index), strokeWidth: '2', strokeDasharray: dashes[index % dashes.length] }), _jsx(Marker, { cx: 16, cy: 10, index: index, color: colorFor(index) })] })) }), _jsx("span", { children: s.label })] }) }, s.key))) }), _jsxs("p", { className: 'pui-chart-axis-label', children: [yLabel, " (", unit, ")"] }), hasValues ? (_jsxs(_Fragment, { children: [_jsx("p", { className: 'pui-chart-help', id: `${id}-keys`, children: text.keyboardHelp }), _jsx("div", { className: 'pui-chart-plot', onKeyDownCapture: (event) => {
86
104
  if (event.key === 'Escape')
87
105
  setDismissed(true);
88
106
  else if (event.key === 'ArrowLeft' ||
@@ -122,8 +140,8 @@ export const Chart = /* @__PURE__ */ React.forwardRef(function Chart({ title, de
122
140
  : (dot) => (_jsx(Marker, { ...dot, color: colorFor(index), index: index })), activeDot: false }, s.key)) : (_jsx(Line, { ...common, type: 'linear', strokeWidth: 2, strokeDasharray: dashes[index % dashes.length], connectNulls: false, dot: rows.length > 40
123
141
  ? false
124
142
  : (dot) => (_jsx(Marker, { ...dot, color: colorFor(index), index: index })), activeDot: false }, s.key));
125
- })] }) }) }), _jsx("p", { className: 'pui-chart-axis-label pui-chart-x-label', children: xLabel })] })) : (_jsx("div", { className: 'pui-chart-empty', role: 'status', children: visible.length === 0 && series.length > 0 ? (_jsxs(_Fragment, { children: [_jsx("p", { children: "No series selected." }), _jsx(Button, { variant: 'outline', onClick: () => {
143
+ })] }) }) }), _jsx("p", { className: 'pui-chart-axis-label pui-chart-x-label', children: xLabel })] })) : (_jsx("div", { className: 'pui-chart-empty', role: 'status', children: visible.length === 0 && series.length > 0 ? (_jsxs(_Fragment, { children: [_jsx("p", { children: text.noSeries }), _jsx(Button, { variant: 'outline', onClick: () => {
126
144
  setRestoreRequested(true);
127
145
  changeHidden([]);
128
- }, children: "Show all series" })] })) : (_jsx("p", { children: emptyLabel })) })), _jsx("div", { className: 'pui-chart-inspector', ref: setHost, role: 'status', "aria-live": 'polite', "aria-atomic": 'true', "aria-label": `${title} values`, hidden: !hasValues }), _jsxs("details", { className: 'pui-chart-table', children: [_jsx("summary", { children: "View data table" }), _jsx(Table.Container, { label: `${title} data table`, orientation: 'both', scrollChain: 'contain', style: { maxHeight: 320 }, children: _jsxs(Table.Root, { children: [_jsxs(Table.Caption, { children: ["All input measurements, including hidden series. Unit: ", unit, "."] }), _jsx(Table.Head, { children: _jsxs(Table.Row, { children: [_jsx(Table.HeaderCell, { scope: 'col', children: xLabel }), series.map((s) => (_jsxs(Table.HeaderCell, { scope: 'col', children: [s.label, " (", unit, ")"] }, s.key)))] }) }), _jsx(Table.Body, { children: rows.length ? (rows.map((row) => (_jsxs(Table.Row, { children: [_jsx(Table.HeaderCell, { scope: 'row', children: row.label }), series.map((s) => (_jsx(Table.Cell, { children: format(row.values[s.key]) }, s.key)))] }, row.id)))) : (_jsx(Table.Row, { children: _jsx(Table.Cell, { colSpan: series.length + 1, children: "No rows." }) })) })] }) })] })] }));
146
+ }, children: text.showAll })] })) : (_jsx("p", { children: text.empty })) })), _jsx("div", { className: 'pui-chart-inspector', ref: setHost, role: 'status', "aria-live": 'polite', "aria-atomic": 'true', "aria-label": text.values(title), hidden: !hasValues }), _jsxs("details", { className: 'pui-chart-table', children: [_jsx("summary", { children: text.viewTable }), _jsx(Table.Container, { label: text.table(title), orientation: 'both', scrollChain: 'contain', children: _jsxs(Table.Root, { children: [_jsx(Table.Caption, { children: text.tableCaption(unit) }), _jsx(Table.Head, { children: _jsxs(Table.Row, { children: [_jsx(Table.HeaderCell, { scope: 'col', children: xLabel }), series.map((s) => (_jsxs(Table.HeaderCell, { scope: 'col', children: [s.label, " (", unit, ")"] }, s.key)))] }) }), _jsx(Table.Body, { children: rows.length ? (rows.map((row) => (_jsxs(Table.Row, { children: [_jsx(Table.HeaderCell, { scope: 'row', children: row.label }), series.map((s) => (_jsx(Table.Cell, { children: format(row.values[s.key]) }, s.key)))] }, row.id)))) : (_jsx(Table.Row, { children: _jsx(Table.Cell, { colSpan: series.length + 1, children: "No rows." }) })) })] }) })] })] }));
129
147
  });
@@ -0,0 +1,2 @@
1
+ import * as React from 'react';
2
+ export declare const CheckboxGroup: React.ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react/checkbox-group").CheckboxGroupProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,16 @@
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import * as React from 'react';
4
+ import { CheckboxGroup as BaseCheckboxGroup } from '@base-ui/react/checkbox-group';
5
+ import { skin } from './parts.js';
6
+ import { useRootRef, useResetValue } from './form-state.js';
7
+ import { ChoiceResetPaint } from './choice.js';
8
+ export const CheckboxGroup = /* @__PURE__ */ React.forwardRef(function CheckboxGroup({ value, defaultValue = [], onValueChange, className, ...props }, ref) {
9
+ const [element, attach] = useRootRef(ref);
10
+ const [selected, setSelected, revision] = useResetValue(value, defaultValue, element);
11
+ return (_jsx(ChoiceResetPaint.Provider, { value: revision, children: _jsx(BaseCheckboxGroup, { ...props, ref: attach, value: selected, className: skin('pui-choice-group', className), onValueChange: (next, event) => {
12
+ onValueChange?.(next, event);
13
+ if (value === undefined && !event.isCanceled)
14
+ setSelected(next);
15
+ } }) }));
16
+ });
@@ -0,0 +1,9 @@
1
+ import * as React from 'react';
2
+ import { type ChoiceSize } from './choice.js';
3
+ declare const CheckboxRoot: React.ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react/checkbox").CheckboxRootProps, "ref"> & React.RefAttributes<HTMLElement>, "ref"> & ChoiceSize & React.RefAttributes<HTMLElement>>;
4
+ declare const CheckboxIndicator: React.ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react/checkbox").CheckboxIndicatorProps, "ref"> & React.RefAttributes<HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLSpanElement>>;
5
+ export declare const Checkbox: {
6
+ Root: React.ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react/checkbox").CheckboxRootProps, "ref"> & React.RefAttributes<HTMLElement>, "ref"> & ChoiceSize & React.RefAttributes<HTMLElement>>;
7
+ Indicator: React.ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react/checkbox").CheckboxIndicatorProps, "ref"> & React.RefAttributes<HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLSpanElement>>;
8
+ };
9
+ export { CheckboxIndicator, CheckboxRoot };
@@ -0,0 +1,29 @@
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 { Checkbox as BaseCheckbox } from '@base-ui/react/checkbox';
6
+ import { skin } from './parts.js';
7
+ import { useRootRef, useResetValue } from './form-state.js';
8
+ import { ChoiceResetPaint } from './choice.js';
9
+ const CheckboxRoot = /* @__PURE__ */ React.forwardRef(function CheckboxRoot({ size, checked, defaultChecked = false, onCheckedChange, className, form, ...props }, ref) {
10
+ React.useContext(ChoiceResetPaint);
11
+ const scheme = useComponentSize(size);
12
+ const [element, attach] = useRootRef(ref);
13
+ const [selected, setSelected] = useResetValue(checked, defaultChecked, element, form);
14
+ return (_jsx(BaseCheckbox.Root, { ...props, "data-ui-size": size ? scheme : undefined, form: form, ref: attach, checked: selected, className: skin('pui-checkbox', className), onCheckedChange: (next, event) => {
15
+ onCheckedChange?.(next, event);
16
+ if (checked === undefined && !event.isCanceled)
17
+ setSelected(next);
18
+ } }));
19
+ });
20
+ const CheckboxIndicator = /* @__PURE__ */ React.forwardRef(function CheckboxIndicator({ className, children, ...props }, ref) {
21
+ return (_jsx(BaseCheckbox.Indicator, { ...props, ref: ref, className: skin('pui-checkbox-indicator', className), children: children ?? (_jsxs("svg", { width: '14', height: '14', viewBox: '0 0 20 20', fill: 'none', stroke: 'currentColor', strokeWidth: '2', "aria-hidden": 'true', children: [_jsx("path", { className: 'pui-checkbox-check', d: 'm4 10 4 4 8-8' }), _jsx("path", { className: 'pui-checkbox-mixed', d: 'M4 10h12' })] })) }));
22
+ });
23
+ export const Checkbox = {
24
+ ...BaseCheckbox,
25
+ Root: CheckboxRoot,
26
+ Indicator: CheckboxIndicator,
27
+ };
28
+ // Flat names for React Server Components, which cannot dot into client exports.
29
+ export { CheckboxIndicator, CheckboxRoot };
@@ -0,0 +1,25 @@
1
+ import * as React from 'react';
2
+ export type ChoiceLabelProps = Omit<React.ComponentPropsWithoutRef<'label'>, 'children'> & {
3
+ /** The Checkbox, Radio or Switch the label names. */
4
+ control: React.ReactElement<{
5
+ 'aria-labelledby'?: string;
6
+ 'aria-describedby'?: string;
7
+ }>;
8
+ /** The label text; it alone names the control. */
9
+ children: React.ReactNode;
10
+ /** A longer explanation, read as the control's description. */
11
+ description?: React.ReactNode;
12
+ };
13
+ /** A checkbox, radio or switch with its label, and an optional description below it.
14
+ * The whole label toggles the control; the control sits on the first line. */
15
+ export declare const ChoiceLabel: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, "ref">, "children"> & {
16
+ /** The Checkbox, Radio or Switch the label names. */
17
+ control: React.ReactElement<{
18
+ "aria-labelledby"?: string;
19
+ "aria-describedby"?: string;
20
+ }>;
21
+ /** The label text; it alone names the control. */
22
+ children: React.ReactNode;
23
+ /** A longer explanation, read as the control's description. */
24
+ description?: React.ReactNode;
25
+ } & React.RefAttributes<HTMLLabelElement>>;
@@ -0,0 +1,14 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import * as React from 'react';
4
+ import { cx } from './parts.js';
5
+ /** A checkbox, radio or switch with its label, and an optional description below it.
6
+ * The whole label toggles the control; the control sits on the first line. */
7
+ export const ChoiceLabel = /* @__PURE__ */ React.forwardRef(function ChoiceLabel({ control, children, description, className, ...props }, ref) {
8
+ const id = React.useId();
9
+ return (_jsxs("label", { ...props, ref: ref, className: cx('pui-choice-label', className), children: [_jsx("span", { className: 'pui-choice-control', children: React.cloneElement(control, {
10
+ 'aria-labelledby': control.props['aria-labelledby'] ?? `${id}-label`,
11
+ 'aria-describedby': control.props['aria-describedby'] ??
12
+ (description ? `${id}-description` : undefined),
13
+ }) }), _jsxs("span", { className: 'pui-choice-text', children: [_jsx("span", { id: `${id}-label`, children: children }), description && (_jsx("span", { className: 'pui-choice-description', id: `${id}-description`, children: description }))] })] }));
14
+ });
@@ -0,0 +1,7 @@
1
+ import * as React from 'react';
2
+ import { type ComponentSizeAlias } from './sizing.js';
3
+ export declare const ChoiceResetPaint: React.Context<number>;
4
+ /** Choice controls follow the surrounding size; `size` sets one control's scale. */
5
+ export type ChoiceSize = {
6
+ size?: ComponentSizeAlias;
7
+ };
package/dist/choice.js ADDED
@@ -0,0 +1,3 @@
1
+ 'use client';
2
+ import * as React from 'react';
3
+ export const ChoiceResetPaint = /* @__PURE__ */ React.createContext(0);
package/dist/code.d.ts ADDED
@@ -0,0 +1,21 @@
1
+ import * as React from 'react';
2
+ export type CodeBlockProps = Omit<React.ComponentPropsWithoutRef<'div'>, 'children' | 'onCopy'> & {
3
+ code: string;
4
+ label?: string;
5
+ language?: string;
6
+ wrap?: boolean;
7
+ copyLabel?: string;
8
+ copiedLabel?: string;
9
+ copyErrorLabel?: string;
10
+ onCopy?: (code: string) => void | Promise<void>;
11
+ };
12
+ export declare const CodeBlock: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "children" | "onCopy"> & {
13
+ code: string;
14
+ label?: string;
15
+ language?: string;
16
+ wrap?: boolean;
17
+ copyLabel?: string;
18
+ copiedLabel?: string;
19
+ copyErrorLabel?: string;
20
+ onCopy?: (code: string) => void | Promise<void>;
21
+ } & React.RefAttributes<HTMLDivElement>>;
@@ -1,34 +1,12 @@
1
1
  'use client';
2
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import * as React from 'react';
4
- import { Surface } from './foundations.js';
5
- import { part } from './parts.js';
4
+ import { Icon } from './icon.js';
5
+ import { cx } from './parts.js';
6
6
  import { Button } from './button.js';
7
7
  import { SyntaxHighlighter } from './syntax-highlighter.js';
8
8
  import { ScrollArea } from './scroll-area.js';
9
- const CardRoot = /* @__PURE__ */ React.forwardRef(function CardRoot({ className, padding, ...props }, ref) {
10
- return (_jsx(Surface, { ...props, padding: padding, ref: ref, className: ['pui-card', className].filter(Boolean).join(' ') }));
11
- });
12
- const CardTitle = /* @__PURE__ */ React.forwardRef(function CardTitle({ level = 3, className, ...props }, ref) {
13
- return React.createElement(`h${level}`, {
14
- ...props,
15
- ref,
16
- className: ['pui-card-title', className].filter(Boolean).join(' '),
17
- });
18
- });
19
- export const Card = {
20
- Root: CardRoot,
21
- Header: /* @__PURE__ */ part('div', 'pui-card-header'),
22
- Title: CardTitle,
23
- Description: /* @__PURE__ */ part('p', 'pui-card-description'),
24
- Body: /* @__PURE__ */ part('div', 'pui-card-body'),
25
- Footer: /* @__PURE__ */ part('div', 'pui-card-footer'),
26
- };
27
- const copyIcons = {
28
- idle: (_jsxs(_Fragment, { children: [_jsx("rect", { x: '8', y: '8', width: '12', height: '12', rx: '2' }), _jsx("path", { d: 'M16 8V4H4v12h4' })] })),
29
- copied: _jsx("path", { d: 'm5 12.5 4.5 4.5L19 7.5' }),
30
- failed: (_jsx("path", { d: 'M12 7v6m0 4v.01M4.5 12a7.5 7.5 0 1 0 15 0 7.5 7.5 0 0 0-15 0' })),
31
- };
9
+ const copyIcons = { idle: 'copy', copied: 'check', failed: 'alert' };
32
10
  // Feedback stays inside the copy button and returns to the action after this long.
33
11
  const copyFeedbackDuration = 2000;
34
12
  export const CodeBlock = /* @__PURE__ */ React.forwardRef(function CodeBlock({ code, label = 'Code', language, wrap = false, copyLabel = 'Copy code', copiedLabel = 'Copied', copyErrorLabel = 'Copy unavailable', onCopy, className, ...props }, ref) {
@@ -96,12 +74,9 @@ export const CodeBlock = /* @__PURE__ */ React.forwardRef(function CodeBlock({ c
96
74
  }, copyFeedbackDuration);
97
75
  }
98
76
  const icon = state === 'copied' || state === 'failed' ? state : 'idle';
99
- return (_jsxs("div", { ...props, ref: ref, "data-wrap": wrap || undefined, className: ['pui-code-block', className].filter(Boolean).join(' '), children: [_jsxs("div", { className: 'pui-code-toolbar', children: [_jsxs("span", { className: 'pui-code-label', children: [label, language && _jsx("span", { className: 'pui-code-language', children: language })] }), _jsxs(Button, { ref: button, type: 'button', variant: 'outline', size: 'sm', className: 'pui-code-copy', onClick: copy, disabled: state === 'busy', "aria-busy": state === 'busy' || undefined, "data-copy-state": icon === 'idle' ? undefined : icon, "data-copy-used": used || undefined, children: [_jsx("svg", { className: 'pui-code-copy-icon', width: '14', height: '14', viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', strokeWidth: '1.6', strokeLinecap: 'round', strokeLinejoin: 'round', "aria-hidden": 'true', children: copyIcons[icon] }, icon), _jsx("span", { "aria-live": 'polite', children: _jsx("span", { className: 'pui-code-copy-label', children: state === 'copied'
77
+ return (_jsxs("div", { ...props, ref: ref, "data-wrap": wrap || undefined, className: cx('pui-code-block', className), children: [_jsxs("div", { className: 'pui-code-toolbar', children: [_jsxs("span", { className: 'pui-code-label', children: [label, language && _jsx("span", { className: 'pui-code-language', children: language })] }), _jsxs(Button, { ref: button, type: 'button', variant: 'outline', size: 'sm', className: 'pui-code-copy', onClick: copy, disabled: state === 'busy', "aria-busy": state === 'busy' || undefined, "data-copy-state": icon === 'idle' ? undefined : icon, "data-copy-used": used || undefined, children: [_jsx(Icon, { name: copyIcons[icon], className: 'pui-code-copy-icon' }, icon), _jsx("span", { "aria-live": 'polite', children: _jsx("span", { className: 'pui-code-copy-label', children: state === 'copied'
100
78
  ? copiedLabel
101
79
  : state === 'failed'
102
80
  ? copyErrorLabel
103
81
  : copyLabel }, icon) })] })] }), _jsx(ScrollArea, { label: label, orientation: 'horizontal', children: _jsx("pre", { ref: source, className: 'pui-code-text', children: _jsx(SyntaxHighlighter, { code: code, language: language, inline: true }) }) })] }));
104
82
  });
105
- // Flat names for React Server Components, which cannot dot into client exports.
106
- export { CardRoot, CardTitle };
107
- export const { Header: CardHeader, Description: CardDescription, Body: CardBody, Footer: CardFooter, } = Card;
@@ -0,0 +1,18 @@
1
+ import * as React from 'react';
2
+ declare const CollapsibleTrigger: React.ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react/collapsible").CollapsibleTriggerProps, "ref"> & React.RefAttributes<HTMLButtonElement>, "ref"> & {
3
+ indicator?: React.ReactNode;
4
+ } & React.RefAttributes<HTMLButtonElement>>;
5
+ declare const CollapsiblePanel: React.ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react/collapsible").CollapsiblePanelProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
6
+ export declare const Collapsible: {
7
+ Root: React.ForwardRefExoticComponent<Omit<Omit<Omit<import("@base-ui/react/collapsible").CollapsibleRootProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref">, "size"> & {
8
+ size?: import("./sizing.js").ComponentSize;
9
+ } & React.RefAttributes<HTMLDivElement>>;
10
+ Trigger: React.ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react/collapsible").CollapsibleTriggerProps, "ref"> & React.RefAttributes<HTMLButtonElement>, "ref"> & {
11
+ indicator?: React.ReactNode;
12
+ } & React.RefAttributes<HTMLButtonElement>>;
13
+ Panel: React.ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react/collapsible").CollapsiblePanelProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
14
+ };
15
+ export { CollapsiblePanel, CollapsibleTrigger };
16
+ export declare const CollapsibleRoot: React.ForwardRefExoticComponent<Omit<Omit<Omit<import("@base-ui/react/collapsible").CollapsibleRootProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref">, "size"> & {
17
+ size?: import("./sizing.js").ComponentSize;
18
+ } & React.RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,21 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import * as React from 'react';
4
+ import { Collapsible as BaseCollapsible } from '@base-ui/react/collapsible';
5
+ import { Icon } from './icon.js';
6
+ import { skin, part } from './parts.js';
7
+ const CollapsibleTrigger = /* @__PURE__ */ React.forwardRef(function CollapsibleTrigger({ className, children, indicator, ...props }, ref) {
8
+ return (_jsxs(BaseCollapsible.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)] }));
9
+ });
10
+ const CollapsiblePanel = /* @__PURE__ */ React.forwardRef(function CollapsiblePanel({ className, children, ...props }, ref) {
11
+ return (_jsx(BaseCollapsible.Panel, { ...props, ref: ref, className: skin('pui-collapsible-panel', className), children: _jsx("div", { className: 'pui-disclosure-body', children: children }) }));
12
+ });
13
+ export const Collapsible = {
14
+ ...BaseCollapsible,
15
+ Root: /* @__PURE__ */ part(BaseCollapsible.Root, 'pui-collapsible'),
16
+ Trigger: CollapsibleTrigger,
17
+ Panel: CollapsiblePanel,
18
+ };
19
+ // Flat names for React Server Components, which cannot dot into client exports.
20
+ export { CollapsiblePanel, CollapsibleTrigger };
21
+ export const { Root: CollapsibleRoot } = Collapsible;
@@ -3,7 +3,9 @@ import { Combobox as BaseCombobox } from '@base-ui/react/combobox';
3
3
  declare function ComboboxRoot<Value, Multiple extends boolean | undefined = false, Item = Value>({ children, form, ...props }: BaseCombobox.Root.Props<Value, Multiple, Item>): React.JSX.Element;
4
4
  export declare const Combobox: {
5
5
  Root: typeof ComboboxRoot;
6
- Content: React.ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react/combobox").ComboboxPopupProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref"> & {
6
+ Portal: React.ForwardRefExoticComponent<Omit<import("@base-ui/react/combobox").ComboboxPortalProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
7
+ Content: React.ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react/combobox").ComboboxPopupProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref"> & Pick<Omit<Omit<import("@base-ui/react/combobox").ComboboxPositionerProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref">, "side" | "align" | "sideOffset" | "collisionPadding"> & {
8
+ /** @deprecated Pass side, align, sideOffset and collisionPadding directly. */
7
9
  positionerProps?: React.ComponentPropsWithoutRef<typeof BaseCombobox.Positioner>;
8
10
  } & React.RefAttributes<HTMLDivElement>>;
9
11
  Popup: React.ForwardRefExoticComponent<Omit<Omit<Omit<import("@base-ui/react/combobox").ComboboxPopupProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref">, "size"> & {
@@ -51,7 +53,6 @@ export declare const Combobox: {
51
53
  } & React.RefAttributes<HTMLDivElement>>;
52
54
  Label: React.ForwardRefExoticComponent<Omit<import("@base-ui/react/combobox").ComboboxLabelProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
53
55
  Value: typeof BaseCombobox.Value;
54
- Portal: React.ForwardRefExoticComponent<Omit<import("@base-ui/react/combobox").ComboboxPortalProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
55
56
  Backdrop: React.ForwardRefExoticComponent<Omit<import("@base-ui/react/combobox").ComboboxBackdropProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
56
57
  Arrow: React.ForwardRefExoticComponent<Omit<import("@base-ui/react/combobox").ComboboxArrowProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
57
58
  Icon: React.ForwardRefExoticComponent<Omit<import("@base-ui/react/combobox").ComboboxIconProps, "ref"> & React.RefAttributes<HTMLSpanElement>>;
@@ -61,21 +62,6 @@ export declare const Combobox: {
61
62
  useFilteredItems: typeof BaseCombobox.useFilteredItems;
62
63
  createItems: typeof BaseCombobox.createItems;
63
64
  };
64
- export declare const NumberField: {
65
- Root: React.ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react/number-field").NumberFieldRootProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
66
- Increment: React.ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react/number-field").NumberFieldIncrementProps, "ref"> & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
67
- Decrement: React.ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react/number-field").NumberFieldDecrementProps, "ref"> & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
68
- Group: React.ForwardRefExoticComponent<Omit<Omit<Omit<import("@base-ui/react/number-field").NumberFieldGroupProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref">, "size"> & {
69
- size?: import("./sizing.js").ComponentSize;
70
- } & React.RefAttributes<HTMLDivElement>>;
71
- Input: React.ForwardRefExoticComponent<Omit<Omit<Omit<import("@base-ui/react/number-field").NumberFieldInputProps, "ref"> & React.RefAttributes<HTMLInputElement>, "ref">, "size"> & {
72
- size?: import("./sizing.js").ComponentSize;
73
- } & React.RefAttributes<HTMLInputElement>>;
74
- ScrubArea: React.ForwardRefExoticComponent<Omit<Omit<Omit<import("@base-ui/react/number-field").NumberFieldScrubAreaProps, "ref"> & React.RefAttributes<HTMLSpanElement>, "ref">, "size"> & {
75
- size?: import("./sizing.js").ComponentSize;
76
- } & React.RefAttributes<HTMLSpanElement>>;
77
- ScrubAreaCursor: React.ForwardRefExoticComponent<Omit<import("@base-ui/react/number-field").NumberFieldScrubAreaCursorProps, "ref"> & React.RefAttributes<HTMLSpanElement>>;
78
- };
79
65
  export { ComboboxRoot };
80
66
  export declare const ComboboxArrow: React.ForwardRefExoticComponent<Omit<import("@base-ui/react/combobox").ComboboxArrowProps, "ref"> & React.RefAttributes<HTMLDivElement>>, ComboboxBackdrop: React.ForwardRefExoticComponent<Omit<import("@base-ui/react/combobox").ComboboxBackdropProps, "ref"> & React.RefAttributes<HTMLDivElement>>, ComboboxChip: React.ForwardRefExoticComponent<Omit<Omit<Omit<import("@base-ui/react/combobox").ComboboxChipProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref">, "size"> & {
81
67
  size?: import("./sizing.js").ComponentSize;
@@ -103,13 +89,7 @@ export declare const ComboboxArrow: React.ForwardRefExoticComponent<Omit<import(
103
89
  size?: import("./sizing.js").ComponentSize;
104
90
  } & React.RefAttributes<HTMLDivElement>>, ComboboxStatus: React.ForwardRefExoticComponent<Omit<Omit<Omit<import("@base-ui/react/combobox").ComboboxStatusProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref">, "size"> & {
105
91
  size?: import("./sizing.js").ComponentSize;
106
- } & React.RefAttributes<HTMLDivElement>>, ComboboxTrigger: React.ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react/combobox").ComboboxTriggerProps, "ref"> & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>, ComboboxValue: typeof BaseCombobox.Value, ComboboxContent: React.ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react/combobox").ComboboxPopupProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref"> & {
92
+ } & React.RefAttributes<HTMLDivElement>>, ComboboxTrigger: React.ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react/combobox").ComboboxTriggerProps, "ref"> & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>, ComboboxValue: typeof BaseCombobox.Value, ComboboxContent: React.ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react/combobox").ComboboxPopupProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref"> & Pick<Omit<Omit<import("@base-ui/react/combobox").ComboboxPositionerProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref">, "side" | "align" | "sideOffset" | "collisionPadding"> & {
93
+ /** @deprecated Pass side, align, sideOffset and collisionPadding directly. */
107
94
  positionerProps?: React.ComponentPropsWithoutRef<typeof BaseCombobox.Positioner>;
108
95
  } & React.RefAttributes<HTMLDivElement>>;
109
- export declare const NumberFieldDecrement: React.ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react/number-field").NumberFieldDecrementProps, "ref"> & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>, NumberFieldGroup: React.ForwardRefExoticComponent<Omit<Omit<Omit<import("@base-ui/react/number-field").NumberFieldGroupProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref">, "size"> & {
110
- size?: import("./sizing.js").ComponentSize;
111
- } & React.RefAttributes<HTMLDivElement>>, NumberFieldIncrement: React.ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react/number-field").NumberFieldIncrementProps, "ref"> & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>, NumberFieldInput: React.ForwardRefExoticComponent<Omit<Omit<Omit<import("@base-ui/react/number-field").NumberFieldInputProps, "ref"> & React.RefAttributes<HTMLInputElement>, "ref">, "size"> & {
112
- size?: import("./sizing.js").ComponentSize;
113
- } & React.RefAttributes<HTMLInputElement>>, NumberFieldRoot: React.ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react/number-field").NumberFieldRootProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>, NumberFieldScrubArea: React.ForwardRefExoticComponent<Omit<Omit<Omit<import("@base-ui/react/number-field").NumberFieldScrubAreaProps, "ref"> & React.RefAttributes<HTMLSpanElement>, "ref">, "size"> & {
114
- size?: import("./sizing.js").ComponentSize;
115
- } & React.RefAttributes<HTMLSpanElement>>, NumberFieldScrubAreaCursor: React.ForwardRefExoticComponent<Omit<import("@base-ui/react/number-field").NumberFieldScrubAreaCursorProps, "ref"> & React.RefAttributes<HTMLSpanElement>>;
@@ -1,22 +1,10 @@
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 { Combobox as BaseCombobox } from '@base-ui/react/combobox';
5
- import { NumberField as BaseNumberField } from '@base-ui/react/number-field';
6
- import { skin, part } from './parts.js';
7
- import { useRootRef, useResetValue } from './form-state.js';
8
- function Mark({ kind, }) {
9
- const path = kind === 'check'
10
- ? 'm5 12 4 4L19 6'
11
- : kind === 'clear'
12
- ? 'm6 6 12 12M6 18 18 6'
13
- : kind === 'expand'
14
- ? 'm6 9 6 6 6-6'
15
- : kind === 'plus'
16
- ? 'M5 12h14M12 5v14'
17
- : 'M5 12h14';
18
- return (_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: path }) }));
19
- }
6
+ import { OwnPortal, defined, part, scopedPortal, skin } from './parts.js';
7
+ import { useResetValue } from './form-state.js';
20
8
  function ComboboxRoot({ children, form, ...props }) {
21
9
  const anchor = React.useRef(null);
22
10
  // Base UI does not reset its internal selection/query model on native form reset.
@@ -24,26 +12,27 @@ function ComboboxRoot({ children, form, ...props }) {
24
12
  const [, , revision] = useResetValue(true, true, anchor, form);
25
13
  return (_jsxs(BaseCombobox.Root, { ...props, form: form, children: [_jsx("span", { hidden: true, ref: anchor }), children] }, revision));
26
14
  }
27
- const ComboPopup = /* @__PURE__ */ part(BaseCombobox.Popup, 'pui-combobox-popup');
28
- const ComboPositioner = /* @__PURE__ */ part(BaseCombobox.Positioner, 'pui-positioner');
29
- const ComboContent = /* @__PURE__ */ React.forwardRef(function ComboContent({ positionerProps, ...props }, ref) {
30
- return (_jsx(BaseCombobox.Portal, { children: _jsx(ComboPositioner, { sideOffset: 6, ...positionerProps, children: _jsx(ComboPopup, { ...props, ref: ref }) }) }));
15
+ const ComboPopup = /* @__PURE__ */ part(BaseCombobox.Popup, 'pui-combobox-popup', { portal: true });
16
+ const ComboPositioner = /* @__PURE__ */ part(BaseCombobox.Positioner, 'pui-positioner', { portal: true });
17
+ const ComboContent = /* @__PURE__ */ React.forwardRef(function ComboContent({ side, align, sideOffset, collisionPadding, positionerProps, ...props }, ref) {
18
+ return (_jsx(OwnPortal, { portal: BaseCombobox.Portal, children: _jsx(ComboPositioner, { sideOffset: 6, ...positionerProps, ...defined({ side, align, sideOffset, collisionPadding }), children: _jsx(ComboPopup, { ...props, ref: ref }) }) }));
31
19
  });
32
20
  const ComboTrigger = /* @__PURE__ */ React.forwardRef(function ComboTrigger({ children, className, ...props }, ref) {
33
- return (_jsx(BaseCombobox.Trigger, { "aria-label": 'Show options', ...props, ref: ref, className: skin('pui-combobox-action', className), children: children ?? _jsx(Mark, { kind: 'expand' }) }));
21
+ return (_jsx(BaseCombobox.Trigger, { "aria-label": 'Show options', ...props, ref: ref, className: skin('pui-combobox-action', className), children: children ?? _jsx(Icon, { name: 'chevron-down' }) }));
34
22
  });
35
23
  const ComboClear = /* @__PURE__ */ React.forwardRef(function ComboClear({ children, className, ...props }, ref) {
36
- return (_jsx(BaseCombobox.Clear, { "aria-label": 'Clear selection', ...props, ref: ref, className: skin('pui-combobox-action', className), children: children ?? _jsx(Mark, { kind: 'clear' }) }));
24
+ return (_jsx(BaseCombobox.Clear, { "aria-label": 'Clear selection', ...props, ref: ref, className: skin('pui-combobox-action', className), children: children ?? _jsx(Icon, { name: 'close' }) }));
37
25
  });
38
26
  const ComboIndicator = /* @__PURE__ */ React.forwardRef(function ComboIndicator({ children, className, ...props }, ref) {
39
- return (_jsx(BaseCombobox.ItemIndicator, { keepMounted: true, ...props, ref: ref, className: skin('pui-combobox-indicator', className), children: children ?? _jsx(Mark, { kind: 'check' }) }));
27
+ return (_jsx(BaseCombobox.ItemIndicator, { keepMounted: true, ...props, ref: ref, className: skin('pui-combobox-indicator', className), children: children ?? _jsx(Icon, { name: 'check' }) }));
40
28
  });
41
29
  const ComboRemove = /* @__PURE__ */ React.forwardRef(function ComboRemove({ children, className, ...props }, ref) {
42
- return (_jsx(BaseCombobox.ChipRemove, { ...props, ref: ref, className: skin('pui-combobox-chip-remove', className), children: children ?? _jsx(Mark, { kind: 'clear' }) }));
30
+ return (_jsx(BaseCombobox.ChipRemove, { ...props, ref: ref, className: skin('pui-combobox-chip-remove', className), children: children ?? _jsx(Icon, { name: 'close' }) }));
43
31
  });
44
32
  export const Combobox = {
45
33
  ...BaseCombobox,
46
34
  Root: ComboboxRoot,
35
+ Portal: /* @__PURE__ */ scopedPortal(BaseCombobox.Portal),
47
36
  Content: ComboContent,
48
37
  Popup: ComboPopup,
49
38
  Positioner: ComboPositioner,
@@ -53,7 +42,7 @@ export const Combobox = {
53
42
  ChipRemove: ComboRemove,
54
43
  Input: /* @__PURE__ */ part(BaseCombobox.Input, 'pui-input pui-combobox-input'),
55
44
  InputGroup: /* @__PURE__ */ part(BaseCombobox.InputGroup, 'pui-combobox-group'),
56
- List: /* @__PURE__ */ part(BaseCombobox.List, 'pui-combobox-list scroll-area'),
45
+ List: /* @__PURE__ */ part(BaseCombobox.List, 'pui-combobox-list'),
57
46
  Item: /* @__PURE__ */ part(BaseCombobox.Item, 'pui-combobox-item'),
58
47
  Empty: /* @__PURE__ */ part(BaseCombobox.Empty, 'pui-combobox-empty'),
59
48
  Status: /* @__PURE__ */ part(BaseCombobox.Status, 'pui-combobox-status'),
@@ -63,31 +52,6 @@ export const Combobox = {
63
52
  Chips: /* @__PURE__ */ part(BaseCombobox.Chips, 'pui-combobox-chips'),
64
53
  Chip: /* @__PURE__ */ part(BaseCombobox.Chip, 'pui-combobox-chip'),
65
54
  };
66
- const NumberRoot = /* @__PURE__ */ React.forwardRef(function NumberRoot({ value, defaultValue, onValueChange, className, form, ...props }, ref) {
67
- const [element, attach] = useRootRef(ref);
68
- const [numeric, setNumeric] = useResetValue(value, defaultValue ?? null, element, form);
69
- return (_jsx(BaseNumberField.Root, { ...props, form: form, ref: attach, value: numeric, className: skin('pui-number-field', className), onValueChange: (next, event) => {
70
- onValueChange?.(next, event);
71
- if (value === undefined && !event.isCanceled)
72
- setNumeric(next);
73
- } }));
74
- });
75
- const NumberIncrement = /* @__PURE__ */ React.forwardRef(function NumberIncrement({ className, children, ...props }, ref) {
76
- return (_jsx(BaseNumberField.Increment, { "aria-label": 'Increase value', ...props, ref: ref, className: skin('pui-number-step', className), children: children ?? _jsx(Mark, { kind: 'plus' }) }));
77
- });
78
- const NumberDecrement = /* @__PURE__ */ React.forwardRef(function NumberDecrement({ className, children, ...props }, ref) {
79
- return (_jsx(BaseNumberField.Decrement, { "aria-label": 'Decrease value', ...props, ref: ref, className: skin('pui-number-step', className), children: children ?? _jsx(Mark, { kind: 'minus' }) }));
80
- });
81
- export const NumberField = {
82
- ...BaseNumberField,
83
- Root: NumberRoot,
84
- Increment: NumberIncrement,
85
- Decrement: NumberDecrement,
86
- Group: /* @__PURE__ */ part(BaseNumberField.Group, 'pui-number-group'),
87
- Input: /* @__PURE__ */ part(BaseNumberField.Input, 'pui-number-input'),
88
- ScrubArea: /* @__PURE__ */ part(BaseNumberField.ScrubArea, 'pui-number-scrub'),
89
- };
90
55
  // Flat names for React Server Components, which cannot dot into client exports.
91
56
  export { ComboboxRoot };
92
57
  export const { Arrow: ComboboxArrow, Backdrop: ComboboxBackdrop, Chip: ComboboxChip, ChipRemove: ComboboxChipRemove, Chips: ComboboxChips, Clear: ComboboxClear, Collection: ComboboxCollection, Empty: ComboboxEmpty, Group: ComboboxGroup, GroupLabel: ComboboxGroupLabel, Icon: ComboboxIcon, Input: ComboboxInput, InputGroup: ComboboxInputGroup, Item: ComboboxItem, ItemIndicator: ComboboxItemIndicator, Label: ComboboxLabel, List: ComboboxList, Popup: ComboboxPopup, Portal: ComboboxPortal, Positioner: ComboboxPositioner, Row: ComboboxRow, Separator: ComboboxSeparator, Status: ComboboxStatus, Trigger: ComboboxTrigger, Value: ComboboxValue, Content: ComboboxContent, } = Combobox;
93
- export const { Decrement: NumberFieldDecrement, Group: NumberFieldGroup, Increment: NumberFieldIncrement, Input: NumberFieldInput, Root: NumberFieldRoot, ScrubArea: NumberFieldScrubArea, ScrubAreaCursor: NumberFieldScrubAreaCursor, } = NumberField;