@surflane/ui 0.11.0 → 0.13.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 (137) hide show
  1. package/dist/alert-dialog.d.ts +25 -7
  2. package/dist/alert-dialog.js +9 -4
  3. package/dist/app-shell.d.ts +10 -0
  4. package/dist/app-shell.js +7 -1
  5. package/dist/autocomplete.d.ts +2 -6
  6. package/dist/avatar.d.ts +7 -7
  7. package/dist/avatar.js +2 -2
  8. package/dist/bar-list.d.ts +31 -0
  9. package/dist/bar-list.js +31 -0
  10. package/dist/bottom-navigation.d.ts +6 -2
  11. package/dist/bottom-navigation.js +2 -2
  12. package/dist/button.d.ts +6 -11
  13. package/dist/button.js +8 -8
  14. package/dist/card.d.ts +15 -10
  15. package/dist/card.js +7 -2
  16. package/dist/chart.d.ts +58 -3
  17. package/dist/chart.js +330 -48
  18. package/dist/choice.d.ts +2 -2
  19. package/dist/class-names.d.ts +0 -4
  20. package/dist/class-names.js +0 -14
  21. package/dist/code.d.ts +19 -7
  22. package/dist/code.js +32 -38
  23. package/dist/combobox.d.ts +2 -8
  24. package/dist/combobox.js +2 -2
  25. package/dist/context-menu.d.ts +2 -8
  26. package/dist/context-menu.js +2 -2
  27. package/dist/css/bar-list.css +9 -0
  28. package/dist/css/chart.css +2 -0
  29. package/dist/css/dashboard.css +20 -0
  30. package/dist/css/rules/alert-dialog.css +8 -2
  31. package/dist/css/rules/app-shell.css +57 -10
  32. package/dist/css/rules/bar-list.css +101 -0
  33. package/dist/css/rules/bar.css +5 -12
  34. package/dist/css/rules/bottom-navigation.css +21 -2
  35. package/dist/css/rules/breadcrumbs.css +0 -6
  36. package/dist/css/rules/button.css +4 -12
  37. package/dist/css/rules/card.css +19 -0
  38. package/dist/css/rules/chart.css +87 -8
  39. package/dist/css/rules/choice.css +26 -2
  40. package/dist/css/rules/combobox.css +17 -16
  41. package/dist/css/rules/dashboard.css +118 -0
  42. package/dist/css/rules/date-picker.css +50 -27
  43. package/dist/css/rules/dialog.css +47 -7
  44. package/dist/css/rules/disclosure.css +17 -3
  45. package/dist/css/rules/field-control.css +9 -6
  46. package/dist/css/rules/file-upload.css +9 -5
  47. package/dist/css/rules/filter-bar.css +32 -2
  48. package/dist/css/rules/gauge.css +2 -2
  49. package/dist/css/rules/icon.css +0 -5
  50. package/dist/css/rules/input-group.css +23 -8
  51. package/dist/css/rules/link.css +0 -6
  52. package/dist/css/rules/menu.css +5 -2
  53. package/dist/css/rules/menubar.css +1 -1
  54. package/dist/css/rules/navigation-menu.css +31 -26
  55. package/dist/css/rules/number-field.css +8 -1
  56. package/dist/css/rules/otp-field.css +13 -3
  57. package/dist/css/rules/page-header.css +10 -0
  58. package/dist/css/rules/panel.css +59 -10
  59. package/dist/css/rules/popup.css +50 -0
  60. package/dist/css/rules/preview-card.css +0 -21
  61. package/dist/css/rules/scroll-area.css +20 -1
  62. package/dist/css/rules/select.css +29 -2
  63. package/dist/css/rules/sizing.css +25 -3
  64. package/dist/css/rules/skeleton.css +1 -1
  65. package/dist/css/rules/slider.css +16 -8
  66. package/dist/css/rules/spinner.css +1 -1
  67. package/dist/css/rules/stat.css +66 -0
  68. package/dist/css/rules/tabs.css +14 -6
  69. package/dist/css/rules/textarea.css +28 -0
  70. package/dist/css/rules/time-range-picker.css +14 -0
  71. package/dist/css/rules/toast.css +3 -1
  72. package/dist/css/rules/toggle.css +10 -3
  73. package/dist/css/rules/toolbar.css +10 -3
  74. package/dist/css/rules/tree.css +29 -4
  75. package/dist/css/styles.css +3 -0
  76. package/dist/css/time-range-picker.css +14 -0
  77. package/dist/dashboard.d.ts +58 -0
  78. package/dist/dashboard.js +60 -0
  79. package/dist/date-picker.d.ts +32 -3
  80. package/dist/date-picker.js +43 -4
  81. package/dist/dialog.d.ts +25 -7
  82. package/dist/dialog.js +9 -4
  83. package/dist/drawer.d.ts +10 -2
  84. package/dist/drawer.js +6 -3
  85. package/dist/icon.d.ts +15 -5
  86. package/dist/icon.js +16 -3
  87. package/dist/index.d.ts +9 -6
  88. package/dist/index.js +7 -4
  89. package/dist/inline-message.d.ts +2 -2
  90. package/dist/inline-message.js +7 -2
  91. package/dist/input.d.ts +2 -2
  92. package/dist/layout.d.ts +1 -3
  93. package/dist/layout.js +2 -2
  94. package/dist/native-select.d.ts +2 -2
  95. package/dist/navigation-menu.d.ts +16 -0
  96. package/dist/navigation-menu.js +6 -1
  97. package/dist/page-header.d.ts +10 -2
  98. package/dist/page-header.js +3 -3
  99. package/dist/panel.d.ts +6 -3
  100. package/dist/panel.js +2 -2
  101. package/dist/parts.d.ts +7 -3
  102. package/dist/parts.js +12 -4
  103. package/dist/popover.d.ts +6 -6
  104. package/dist/popover.js +3 -2
  105. package/dist/preview-card.d.ts +2 -8
  106. package/dist/preview-card.js +2 -2
  107. package/dist/select.d.ts +38 -8
  108. package/dist/select.js +110 -22
  109. package/dist/sheet.d.ts +10 -2
  110. package/dist/sheet.js +6 -3
  111. package/dist/size.d.ts +8 -6
  112. package/dist/size.js +2 -7
  113. package/dist/sizing.d.ts +13 -6
  114. package/dist/sizing.js +13 -4
  115. package/dist/sparkline.d.ts +2 -2
  116. package/dist/sparkline.js +2 -2
  117. package/dist/spinner.d.ts +2 -2
  118. package/dist/spinner.js +2 -2
  119. package/dist/stat.d.ts +24 -0
  120. package/dist/stat.js +15 -1
  121. package/dist/table.d.ts +12 -4
  122. package/dist/table.js +8 -3
  123. package/dist/textarea.d.ts +6 -3
  124. package/dist/textarea.js +2 -2
  125. package/dist/time-range-picker.d.ts +42 -0
  126. package/dist/time-range-picker.js +69 -0
  127. package/dist/toggle.d.ts +2 -2
  128. package/dist/toggle.js +2 -2
  129. package/dist/toolbar.d.ts +11 -10
  130. package/dist/toolbar.js +23 -1
  131. package/dist/tooltip.d.ts +1 -3
  132. package/dist/tooltip.js +4 -2
  133. package/dist/tree.d.ts +1 -3
  134. package/dist/tree.js +2 -2
  135. package/dist/typography.d.ts +10 -3
  136. package/dist/typography.js +4 -3
  137. package/package.json +18 -3
package/dist/icon.js CHANGED
@@ -23,6 +23,7 @@ const shapes = {
23
23
  'arrow-back': _jsx("path", { d: 'M20 12H4m7-7-7 7 7 7' }),
24
24
  'arrow-up': _jsx("path", { d: 'M12 19V5m-6 6 6-6 6 6' }),
25
25
  'arrow-down': _jsx("path", { d: 'M12 5v14m-6-6 6 6 6-6' }),
26
+ refresh: _jsx("path", { d: 'M20 12a8 8 0 1 1-2.34-5.66M20 4v4h-4' }),
26
27
  sort: _jsx("path", { d: 'm8 9 4-4 4 4m-8 6 4 4 4-4' }),
27
28
  'external-link': (_jsx(_Fragment, { children: _jsx("path", { d: 'M14 3h7v7m0-7L10 14M10 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-5' }) })),
28
29
  copy: (_jsxs(_Fragment, { children: [_jsx("rect", { x: '8', y: '8', width: '12', height: '13', rx: '2' }), _jsx("path", { d: 'M16 8V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h3' })] })),
@@ -31,6 +32,20 @@ const shapes = {
31
32
  calendar: (_jsxs(_Fragment, { children: [_jsx("rect", { x: '3', y: '5', width: '18', height: '16', rx: '3' }), _jsx("path", { d: 'M7 3v4m10-4v4M3 11h18m-12 4h2' })] })),
32
33
  user: (_jsxs(_Fragment, { children: [_jsx("circle", { cx: '12', cy: '8', r: '4' }), _jsx("path", { d: 'M4 21v-2a8 8 0 0 1 16 0v2' })] })),
33
34
  settings: (_jsx(_Fragment, { children: _jsx("path", { d: 'M4 6h16M4 12h16M4 18h16M9 3v6m6 0v6m-6 0v6' }) })),
35
+ // What a product runs on: machines, storage, links, power and model tokens.
36
+ server: (_jsxs(_Fragment, { children: [_jsx("rect", { x: '3', y: '4', width: '18', height: '7', rx: '2' }), _jsx("rect", { x: '3', y: '13', width: '18', height: '7', rx: '2' }), _jsx("path", { d: 'M7 7.5h3m-3 9h3' })] })),
37
+ database: (_jsxs(_Fragment, { children: [_jsx("ellipse", { cx: '12', cy: '6', rx: '8', ry: '3' }), _jsx("path", { d: 'M4 6v12c0 1.66 3.58 3 8 3s8-1.34 8-3V6M4 12c0 1.66 3.58 3 8 3s8-1.34 8-3' })] })),
38
+ disk: (_jsxs(_Fragment, { children: [_jsx("path", { d: 'M3 14 5.6 5.4A2 2 0 0 1 7.5 4h9a2 2 0 0 1 1.9 1.4L21 14' }), _jsx("rect", { x: '3', y: '14', width: '18', height: '6', rx: '2' }), _jsx("path", { d: 'M7 17h2' })] })),
39
+ chip: (_jsxs(_Fragment, { children: [_jsx("rect", { x: '6', y: '6', width: '12', height: '12', rx: '2' }), _jsx("rect", { x: '9.5', y: '9.5', width: '5', height: '5', rx: '1' }), _jsx("path", { d: 'M9.5 2.5V6m5-3.5V6m-5 12v3.5m5-3.5v3.5M2.5 9.5H6m-3.5 5H6m12-5h3.5M18 14.5h3.5' })] })),
40
+ memory: (_jsxs(_Fragment, { children: [_jsx("rect", { x: '2', y: '7', width: '20', height: '10', rx: '2' }), _jsx("path", { d: 'M6 17v3m4-3v3m4-3v3m4-3v3M7 10.5v3m5-3v3m5-3v3' })] })),
41
+ network: (_jsxs(_Fragment, { children: [_jsx("rect", { x: '9', y: '3', width: '6', height: '5', rx: '1' }), _jsx("rect", { x: '3', y: '16', width: '6', height: '5', rx: '1' }), _jsx("rect", { x: '15', y: '16', width: '6', height: '5', rx: '1' }), _jsx("path", { d: 'M12 8v4M6 16v-4h12v4' })] })),
42
+ bolt: _jsx("path", { d: 'M13 2.5 4.5 13.5H12l-1 8 8.5-11H12l1-8Z' }),
43
+ token: (_jsxs(_Fragment, { children: [_jsx("path", { d: 'm12 3 7.8 4.5v9L12 21l-7.8-4.5v-9L12 3Z' }), _jsx("circle", { cx: '12', cy: '12', r: '3' })] })),
44
+ thermometer: (_jsxs(_Fragment, { children: [_jsx("path", { d: 'M14 14.5V5a2 2 0 0 0-4 0v9.5a4 4 0 1 0 4 0Z' }), _jsx("path", { d: 'M12 9v7.5' })] })),
45
+ // View controls: keep an item in place, and show a list or a grid.
46
+ pin: _jsx("path", { d: 'M9 3h6l-1 6 4 4H6l4-4-1-6ZM12 13v8' }),
47
+ list: _jsx("path", { d: 'M8 6h12M8 12h12M8 18h12M4 6h.01M4 12h.01M4 18h.01' }),
48
+ grid: (_jsxs(_Fragment, { children: [_jsx("rect", { x: '4', y: '4', width: '6', height: '6', rx: '1' }), _jsx("rect", { x: '14', y: '4', width: '6', height: '6', rx: '1' }), _jsx("rect", { x: '4', y: '14', width: '6', height: '6', rx: '1' }), _jsx("rect", { x: '14', y: '14', width: '6', height: '6', rx: '1' })] })),
34
49
  };
35
50
  export const iconNames = Object.keys(shapes);
36
51
  // These point along the reading direction, so they mirror in right-to-left text.
@@ -39,9 +54,7 @@ const directional = new Set([
39
54
  'chevron-back',
40
55
  'arrow-back',
41
56
  ]);
42
- // The short spellings map by pixel size: sm was 16px, which is now the default.
43
- const iconSizes = { sm: 'default', md: 'large', lg: 'lg' };
44
57
  /** Static SVG only. Actions, focus, accessible button names and hit targets belong to the parent control. */
45
58
  export const Icon = function Icon({ name, size, decorative = true, label, className, ref, ...props }) {
46
- return (_jsx("svg", { ...props, ref: ref, className: cx('surf-icon', className), "data-size": size === 'sm' || size === 'md' || size === 'lg' ? iconSizes[size] : size, "data-directional": directional.has(name) ? 'true' : undefined, viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', strokeLinecap: 'round', strokeLinejoin: 'round', focusable: 'false', "aria-hidden": decorative ? true : undefined, role: decorative ? undefined : 'img', "aria-label": decorative ? undefined : label, children: shapes[name] }));
59
+ return (_jsx("svg", { ...props, ref: ref, className: cx('surf-icon', className), "data-size": size, "data-directional": directional.has(name) ? 'true' : undefined, viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', strokeLinecap: 'round', strokeLinejoin: 'round', focusable: 'false', "aria-hidden": decorative ? true : undefined, role: decorative ? undefined : 'img', "aria-label": decorative ? undefined : label, children: shapes[name] }));
47
60
  };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export { Button, type ButtonVariant, type ButtonSize, type ButtonProps, LinkButton, type LinkButtonProps, } from './button.js';
2
2
  export { Toolbar, ToolbarButton, ToolbarGroup, ToolbarInput, ToolbarLink, ToolbarRoot, ToolbarSeparator, } from './toolbar.js';
3
3
  export { Input } from './input.js';
4
- export { Select, type SelectOption, type SelectGroup, type SelectProps, } from './select.js';
4
+ export { Select, type SelectOption, type SelectGroup, type SelectProps, type SelectMultipleProps, type SelectMultipleLabels, } from './select.js';
5
5
  export { NativeSelect, NativeSelectOption, NativeSelectOptGroup, } from './native-select.js';
6
6
  export { Field, FieldControl, FieldDescription, FieldError, FieldItem, FieldLabel, FieldRoot, FieldValidity, } from './field.js';
7
7
  export { Fieldset, FieldsetLegend, FieldsetRoot } from './fieldset.js';
@@ -32,7 +32,7 @@ export { Drawer, DrawerBackdrop, DrawerClose, DrawerContent, DrawerDescription,
32
32
  export { Tabs, TabsIndicator, TabsList, TabsPanel, TabsRoot, TabsTab, } from './tabs.js';
33
33
  export { Accordion, AccordionHeader, AccordionItem, AccordionPanel, AccordionRoot, AccordionTrigger, } from './accordion.js';
34
34
  export { Collapsible, CollapsiblePanel, CollapsibleRoot, CollapsibleTrigger, } from './collapsible.js';
35
- export { NavigationMenu, NavigationMenuArrow, NavigationMenuBackdrop, NavigationMenuContent, NavigationMenuIcon, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuPopup, NavigationMenuPortal, NavigationMenuPositioner, NavigationMenuRoot, NavigationMenuTrigger, NavigationMenuViewport, } from './navigation-menu.js';
35
+ export { NavigationMenu, NavigationMenuArrow, NavigationMenuBackdrop, NavigationMenuContent, NavigationMenuIcon, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuPopup, NavigationMenuPortal, NavigationMenuPositioner, NavigationMenuRoot, NavigationMenuTrigger, NavigationMenuViewport, NavigationMenuLinkTitle, NavigationMenuLinkDescription, } from './navigation-menu.js';
36
36
  export { Menubar } from './menubar.js';
37
37
  export { Link, type LinkProps } from './link.js';
38
38
  export { Breadcrumbs, BreadcrumbsRoot, BreadcrumbsList, BreadcrumbsItem, BreadcrumbsLink, BreadcrumbsSeparator, BreadcrumbsCurrent, } from './breadcrumbs.js';
@@ -42,11 +42,14 @@ export { Avatar, AvatarFallback, AvatarImage, AvatarRoot, AvatarStatus, } from '
42
42
  export { Badge, StatusBadge, type BadgeProps, type StatusTone, } from './badge.js';
43
43
  export { Card, CardRoot, CardHeader, CardTitle, CardDescription, CardBody, CardFooter, } from './card.js';
44
44
  export { Table, TableContainer, TableRoot, TableCaption, TableHead, TableBody, TableFoot, TableRow, TableHeaderCell, TableSortHeader, TableCell, TableTruncate, TableMessage, type TableDensity, type TableVariant, type TableSort, useTableSelection, type TableSelectionOptions, type TableSelectionCheckbox, } from './table.js';
45
- export { CodeBlock, type CodeBlockProps, type CodeBlockLabels } from './code.js';
45
+ export { CodeBlock, CopyButton, type CodeBlockProps, type CodeBlockLabels, type CopyButtonProps, type CopyButtonLabels, } from './code.js';
46
46
  export { SyntaxHighlighter, syntaxLanguages, type SyntaxHighlighterProps, } from './syntax-highlighter.js';
47
47
  export { List, ListRoot, ListItem, ListContent, ListTitle, ListDescription, ListActions, } from './list.js';
48
- export { Stat, StatRoot, StatLabel, StatValue, StatChange, StatCaption, type StatChangeProps, type StatDirection, } from './stat.js';
48
+ export { Stat, StatRoot, StatLabel, StatValue, StatChange, StatCaption, StatStatus, StatGroup, type StatChangeProps, type StatStatusProps, type StatGroupProps, type StatDirection, } from './stat.js';
49
49
  export { Sparkline, type SparklineProps, type SparklineTrend, } from './sparkline.js';
50
+ export { BarList, type BarListProps, type BarListItem } from './bar-list.js';
51
+ export { Dashboard, DashboardRoot, DashboardPanel, type DashboardRootProps, type DashboardPanelProps, type DashboardPanelLabels, } from './dashboard.js';
52
+ export { TimeRangePicker, timeRangeOptions, refreshIntervalOptions, type TimeRangePickerProps, type TimeRangePickerLabels, type TimeRangeOption, } from './time-range-picker.js';
50
53
  export { ScrollArea } from './scroll-area.js';
51
54
  export { Separator } from './separator.js';
52
55
  export { Progress, ProgressIndicator, ProgressLabel, ProgressRoot, ProgressTrack, ProgressValue, } from './progress.js';
@@ -60,9 +63,9 @@ export { Container, Stack, Inline, Grid, GridItem, Surface, type SurfaceKind, ty
60
63
  export { Heading, Text, Prose } from './typography.js';
61
64
  export { formatNumber, formatCurrency, formatPercent, missingValue, type NumberFormatOptions, } from './format.js';
62
65
  export { Icon, iconNames, type IconName, type IconProps } from './icon.js';
63
- export { SizeProvider, type ComponentSize, type ComponentSizeAlias, } from './sizing.js';
66
+ export { SizeProvider, type ComponentDensity, type ComponentSize, type ComponentSizeAlias, } from './sizing.js';
64
67
  export { DirectionProvider } from '@base-ui/react/direction-provider';
65
68
  export { Slot } from './slot.js';
66
- export { AppShell, AppShellRoot, AppShellHeader, AppShellSidebar, AppShellSidebarToggle, type AppShellRootProps, type AppShellSidebarToggleProps, type AppShellSidebarToggleLabels, AppShellBrand, type AppShellBrandProps, AppShellNav, type AppShellNavProps, AppShellContent, AppShellPage, AppShellFooter, AppShellLabel, AppShellLink, type AppShellLinkProps, } from './app-shell.js';
69
+ export { AppShell, AppShellRoot, AppShellHeader, AppShellSidebar, AppShellSidebarToggle, AppShellMenuTrigger, type AppShellRootProps, type AppShellSidebarToggleProps, type AppShellSidebarToggleLabels, type AppShellMenuTriggerProps, AppShellBrand, type AppShellBrandProps, AppShellNav, type AppShellNavProps, AppShellContent, AppShellPage, AppShellFooter, AppShellLabel, AppShellLink, type AppShellLinkProps, } from './app-shell.js';
67
70
  export { PageHeader } from './page-header.js';
68
71
  export { FilterBar, FilterBarRoot, FilterBarControls, FilterBarField, FilterBarActions, FilterBarSummary, } from './filter-bar.js';
package/dist/index.js CHANGED
@@ -41,7 +41,7 @@ export { Drawer, DrawerBackdrop, DrawerClose, DrawerContent, DrawerDescription,
41
41
  export { Tabs, TabsIndicator, TabsList, TabsPanel, TabsRoot, TabsTab, } from './tabs.js';
42
42
  export { Accordion, AccordionHeader, AccordionItem, AccordionPanel, AccordionRoot, AccordionTrigger, } from './accordion.js';
43
43
  export { Collapsible, CollapsiblePanel, CollapsibleRoot, CollapsibleTrigger, } from './collapsible.js';
44
- export { NavigationMenu, NavigationMenuArrow, NavigationMenuBackdrop, NavigationMenuContent, NavigationMenuIcon, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuPopup, NavigationMenuPortal, NavigationMenuPositioner, NavigationMenuRoot, NavigationMenuTrigger, NavigationMenuViewport, } from './navigation-menu.js';
44
+ export { NavigationMenu, NavigationMenuArrow, NavigationMenuBackdrop, NavigationMenuContent, NavigationMenuIcon, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuPopup, NavigationMenuPortal, NavigationMenuPositioner, NavigationMenuRoot, NavigationMenuTrigger, NavigationMenuViewport, NavigationMenuLinkTitle, NavigationMenuLinkDescription, } from './navigation-menu.js';
45
45
  export { Menubar } from './menubar.js';
46
46
  export { Link } from './link.js';
47
47
  export { Breadcrumbs, BreadcrumbsRoot, BreadcrumbsList, BreadcrumbsItem, BreadcrumbsLink, BreadcrumbsSeparator, BreadcrumbsCurrent, } from './breadcrumbs.js';
@@ -52,11 +52,14 @@ export { Avatar, AvatarFallback, AvatarImage, AvatarRoot, AvatarStatus, } from '
52
52
  export { Badge, StatusBadge, } from './badge.js';
53
53
  export { Card, CardRoot, CardHeader, CardTitle, CardDescription, CardBody, CardFooter, } from './card.js';
54
54
  export { Table, TableContainer, TableRoot, TableCaption, TableHead, TableBody, TableFoot, TableRow, TableHeaderCell, TableSortHeader, TableCell, TableTruncate, TableMessage, useTableSelection, } from './table.js';
55
- export { CodeBlock } from './code.js';
55
+ export { CodeBlock, CopyButton, } from './code.js';
56
56
  export { SyntaxHighlighter, syntaxLanguages, } from './syntax-highlighter.js';
57
57
  export { List, ListRoot, ListItem, ListContent, ListTitle, ListDescription, ListActions, } from './list.js';
58
- export { Stat, StatRoot, StatLabel, StatValue, StatChange, StatCaption, } from './stat.js';
58
+ export { Stat, StatRoot, StatLabel, StatValue, StatChange, StatCaption, StatStatus, StatGroup, } from './stat.js';
59
59
  export { Sparkline, } from './sparkline.js';
60
+ export { BarList } from './bar-list.js';
61
+ export { Dashboard, DashboardRoot, DashboardPanel, } from './dashboard.js';
62
+ export { TimeRangePicker, timeRangeOptions, refreshIntervalOptions, } from './time-range-picker.js';
60
63
  // Structure
61
64
  export { ScrollArea } from './scroll-area.js';
62
65
  export { Separator } from './separator.js';
@@ -77,6 +80,6 @@ export { SizeProvider, } from './sizing.js';
77
80
  export { DirectionProvider } from '@base-ui/react/direction-provider';
78
81
  export { Slot } from './slot.js';
79
82
  // Patterns
80
- export { AppShell, AppShellRoot, AppShellHeader, AppShellSidebar, AppShellSidebarToggle, AppShellBrand, AppShellNav, AppShellContent, AppShellPage, AppShellFooter, AppShellLabel, AppShellLink, } from './app-shell.js';
83
+ export { AppShell, AppShellRoot, AppShellHeader, AppShellSidebar, AppShellSidebarToggle, AppShellMenuTrigger, AppShellBrand, AppShellNav, AppShellContent, AppShellPage, AppShellFooter, AppShellLabel, AppShellLink, } from './app-shell.js';
81
84
  export { PageHeader } from './page-header.js';
82
85
  export { FilterBar, FilterBarRoot, FilterBarControls, FilterBarField, FilterBarActions, FilterBarSummary, } from './filter-bar.js';
@@ -6,7 +6,7 @@ export declare const InlineMessage: {
6
6
  } & {
7
7
  ref?: React.Ref<HTMLDivElement>;
8
8
  }) => React.JSX.Element;
9
- Icon: ({ tone, children, className, ref, ...props }: React.ComponentPropsWithoutRef<"span"> & {
9
+ Icon: ({ tone: ownTone, children, className, ref, ...props }: React.ComponentPropsWithoutRef<"span"> & {
10
10
  tone?: StatusTone;
11
11
  } & {
12
12
  ref?: React.Ref<HTMLSpanElement>;
@@ -36,7 +36,7 @@ export declare const InlineMessageRoot: ({ tone, className, ref, ...props }: Rea
36
36
  tone?: StatusTone;
37
37
  } & {
38
38
  ref?: React.Ref<HTMLDivElement>;
39
- }) => React.JSX.Element, InlineMessageIcon: ({ tone, children, className, ref, ...props }: React.ComponentPropsWithoutRef<"span"> & {
39
+ }) => React.JSX.Element, InlineMessageIcon: ({ tone: ownTone, children, className, ref, ...props }: React.ComponentPropsWithoutRef<"span"> & {
40
40
  tone?: StatusTone;
41
41
  } & {
42
42
  ref?: React.Ref<HTMLSpanElement>;
@@ -1,13 +1,18 @@
1
1
  'use client';
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
+ import * as React from 'react';
3
4
  import { useToneTransition } from './tone-transition.js';
4
5
  import { part, cx } from './parts.js';
5
6
  import { StatusIcon } from './status.js';
7
+ /** The Root's tone, so its Icon matches without repeating it, as Toast's does. */
8
+ const MessageTone = /* @__PURE__ */ React.createContext('neutral');
6
9
  const MessageRoot = function MessageRoot({ tone = 'neutral', className, ref, ...props }) {
7
10
  const elementRef = useToneTransition(tone, ref);
8
- return (_jsx("div", { ...props, ref: elementRef, "data-tone": tone, className: cx('surf-message', className) }));
11
+ return (_jsx(MessageTone.Provider, { value: tone, children: _jsx("div", { ...props, ref: elementRef, "data-tone": tone, className: cx('surf-message', className) }) }));
9
12
  };
10
- const MessageIcon = function MessageIcon({ tone = 'neutral', children, className, ref, ...props }) {
13
+ const MessageIcon = function MessageIcon({ tone: ownTone, children, className, ref, ...props }) {
14
+ const inherited = React.useContext(MessageTone);
15
+ const tone = ownTone ?? inherited;
11
16
  return (_jsx("span", { ...props, ref: ref, "aria-hidden": 'true', className: cx('surf-message-icon', className), children: children ?? _jsx(StatusIcon, { tone: tone }) }));
12
17
  };
13
18
  export const InlineMessage = {
package/dist/input.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
- import { type ComponentSizeAlias } from './sizing.js';
2
+ import { type ComponentSize } from './sizing.js';
3
3
  export declare const Input: ({ className, leadingIcon, wrapperClassName, size, ref, ...props }: Omit<React.ComponentPropsWithoutRef<"input">, "size"> & {
4
- size?: number | ComponentSizeAlias;
4
+ size?: number | ComponentSize;
5
5
  leadingIcon?: React.ReactNode;
6
6
  wrapperClassName?: string;
7
7
  } & {
package/dist/layout.d.ts CHANGED
@@ -34,11 +34,9 @@ export declare const GridItem: ({ span, mediumSpan, smallSpan, className, style,
34
34
  ref?: React.Ref<HTMLDivElement>;
35
35
  }) => React.JSX.Element;
36
36
  export type SurfaceKind = 'canvas' | 'subtle';
37
- export declare const Surface: ({ surface, tone, padding, className, style, ref, ...props }: React.ComponentProps<"div"> & {
37
+ export declare const Surface: ({ surface, padding, className, style, ref, ...props }: React.ComponentProps<"div"> & {
38
38
  /** The background: subtle sits on the sheet, canvas matches it. */
39
39
  surface?: SurfaceKind;
40
- /** @deprecated Use surface; tone names a status color elsewhere. */
41
- tone?: SurfaceKind;
42
40
  padding?: Space;
43
41
  } & {
44
42
  ref?: React.Ref<HTMLDivElement>;
package/dist/layout.js CHANGED
@@ -30,8 +30,8 @@ export const GridItem = function GridItem({ span, mediumSpan, smallSpan, classNa
30
30
  ...style,
31
31
  } }));
32
32
  };
33
- export const Surface = function Surface({ surface, tone, padding, className, style, ref, ...props }) {
34
- return (_jsx("div", { ...props, ref: ref, className: cx('surf-surface', className), "data-surface": surface ?? tone ?? 'subtle', style: {
33
+ export const Surface = function Surface({ surface, padding, className, style, ref, ...props }) {
34
+ return (_jsx("div", { ...props, ref: ref, className: cx('surf-surface', className), "data-surface": surface ?? 'subtle', style: {
35
35
  ...(padding === undefined
36
36
  ? {}
37
37
  : { '--surf-surface-padding': `var(--surf-space-${padding})` }),
@@ -1,8 +1,8 @@
1
1
  import * as React from 'react';
2
- import { type ComponentSizeAlias } from './sizing.js';
2
+ import { type ComponentSize } from './sizing.js';
3
3
  /** Transitional HTML-option adapter. Submitted values use Base UI's native hidden input. */
4
4
  export declare const NativeSelect: ({ children, onChange, value, defaultValue, className, size, ref, ...props }: Omit<React.ComponentPropsWithoutRef<"select">, "size" | "multiple"> & {
5
- size?: ComponentSizeAlias;
5
+ size?: ComponentSize;
6
6
  } & {
7
7
  ref?: React.Ref<HTMLButtonElement>;
8
8
  }) => React.JSX.Element;
@@ -23,6 +23,16 @@ export declare const NavigationMenu: {
23
23
  } & {
24
24
  ref?: React.Ref<HTMLAnchorElement> | undefined;
25
25
  }) => React.JSX.Element;
26
+ /** A destination's name, on its own line inside a Link. */
27
+ LinkTitle: ({ className, size, ref, ...rest }: Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref">, "size"> & {
28
+ size?: import("./size.js").ComponentSize;
29
+ ref?: React.Ref<HTMLSpanElement> | undefined;
30
+ }) => React.JSX.Element;
31
+ /** A line under the title that says what is there. */
32
+ LinkDescription: ({ className, size, ref, ...rest }: Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref">, "size"> & {
33
+ size?: import("./size.js").ComponentSize;
34
+ ref?: React.Ref<HTMLSpanElement> | undefined;
35
+ }) => React.JSX.Element;
26
36
  Content: ({ ref, ...props }: Omit<Omit<Omit<import("@base-ui/react/navigation-menu").NavigationMenuContentProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref">, "size"> & {
27
37
  size?: import("./size.js").ComponentSize;
28
38
  } & {
@@ -64,6 +74,12 @@ export declare const NavigationMenuArrow: React.ForwardRefExoticComponent<Omit<i
64
74
  size?: import("./size.js").ComponentSize;
65
75
  } & {
66
76
  ref?: React.Ref<HTMLAnchorElement> | undefined;
77
+ }) => React.JSX.Element, NavigationMenuLinkDescription: ({ className, size, ref, ...rest }: Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref">, "size"> & {
78
+ size?: import("./size.js").ComponentSize;
79
+ ref?: React.Ref<HTMLSpanElement> | undefined;
80
+ }) => React.JSX.Element, NavigationMenuLinkTitle: ({ className, size, ref, ...rest }: Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref">, "size"> & {
81
+ size?: import("./size.js").ComponentSize;
82
+ ref?: React.Ref<HTMLSpanElement> | undefined;
67
83
  }) => React.JSX.Element, NavigationMenuList: ({ ref, ...props }: Omit<Omit<Omit<import("@base-ui/react/navigation-menu").NavigationMenuListProps, "ref"> & React.RefAttributes<HTMLUListElement>, "ref">, "size"> & {
68
84
  size?: import("./size.js").ComponentSize;
69
85
  } & {
@@ -3,6 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { Icon } from './icon.js';
4
4
  import { NavigationMenu as BaseNavigationMenu } from '@base-ui/react/navigation-menu';
5
5
  import { part, skin } from './parts.js';
6
+ import { elementPart } from './element-part.js';
6
7
  function Root(props) {
7
8
  const { className, orientation = 'horizontal', ...rest } = props;
8
9
  return (_jsx(BaseNavigationMenu.Root, { ...rest, orientation: orientation, "data-orientation": orientation, className: skin('surf-navigation-menu', className) }));
@@ -19,6 +20,10 @@ export const NavigationMenu = {
19
20
  List: /* @__PURE__ */ part(BaseNavigationMenu.List, 'surf-navigation-list'),
20
21
  Item: /* @__PURE__ */ part(BaseNavigationMenu.Item, 'surf-navigation-item'),
21
22
  Link: /* @__PURE__ */ part(BaseNavigationMenu.Link, 'surf-navigation-link'),
23
+ /** A destination's name, on its own line inside a Link. */
24
+ LinkTitle: /* @__PURE__ */ elementPart('span', 'surf-navigation-link-title'),
25
+ /** A line under the title that says what is there. */
26
+ LinkDescription: /* @__PURE__ */ elementPart('span', 'surf-navigation-link-description'),
22
27
  Content: /* @__PURE__ */ part(BaseNavigationMenu.Content, 'surf-navigation-content'),
23
28
  Positioner: /* @__PURE__ */ part(BaseNavigationMenu.Positioner, 'surf-positioner surf-navigation-positioner', {
24
29
  portal: true,
@@ -30,4 +35,4 @@ export const NavigationMenu = {
30
35
  },
31
36
  };
32
37
  // Flat names for React Server Components, which cannot dot into client exports.
33
- export const { Arrow: NavigationMenuArrow, Backdrop: NavigationMenuBackdrop, Content: NavigationMenuContent, Icon: NavigationMenuIcon, Item: NavigationMenuItem, Link: NavigationMenuLink, List: NavigationMenuList, Popup: NavigationMenuPopup, Portal: NavigationMenuPortal, Positioner: NavigationMenuPositioner, Root: NavigationMenuRoot, Trigger: NavigationMenuTrigger, Viewport: NavigationMenuViewport, } = NavigationMenu;
38
+ export const { Arrow: NavigationMenuArrow, Backdrop: NavigationMenuBackdrop, Content: NavigationMenuContent, Icon: NavigationMenuIcon, Item: NavigationMenuItem, Link: NavigationMenuLink, LinkDescription: NavigationMenuLinkDescription, LinkTitle: NavigationMenuLinkTitle, List: NavigationMenuList, Popup: NavigationMenuPopup, Portal: NavigationMenuPortal, Positioner: NavigationMenuPositioner, Root: NavigationMenuRoot, Trigger: NavigationMenuTrigger, Viewport: NavigationMenuViewport, } = NavigationMenu;
@@ -1,5 +1,6 @@
1
1
  import * as React from 'react';
2
- export declare function PageHeader({ as: Root, headingProps, actionsLabel, title, description, breadcrumb, actions, level, size, className, ...props }: Omit<React.ComponentProps<'div'>, 'title'> & {
2
+ import { type HeadingVariant } from './typography.js';
3
+ export declare function PageHeader({ as: Root, headingProps, actionsLabel, title, description, breadcrumb, actions, level, variant, size, lead, className, ...props }: Omit<React.ComponentProps<'div'>, 'title'> & {
3
4
  as?: 'div' | 'header';
4
5
  headingProps?: Omit<React.HTMLAttributes<HTMLHeadingElement>, 'children' | 'dangerouslySetInnerHTML'>;
5
6
  actionsLabel?: string;
@@ -8,5 +9,12 @@ export declare function PageHeader({ as: Root, headingProps, actionsLabel, title
8
9
  breadcrumb?: React.ReactNode;
9
10
  actions?: React.ReactNode;
10
11
  level?: 1 | 2 | 3 | 4 | 5 | 6;
11
- size?: 'title' | 'page' | 'workspace' | 'document';
12
+ /** The title's type role, as Heading's variant is. */
13
+ variant?: HeadingVariant;
14
+ /** @deprecated The earlier name for `variant`. `workspace` and `document` are
15
+ * earlier names for `display`. */
16
+ size?: HeadingVariant | 'workspace' | 'document';
17
+ /** Sets the description as the page's lead: the reading role at the reading
18
+ * measure, for a document that opens with it. */
19
+ lead?: boolean;
12
20
  }): React.JSX.Element;
@@ -1,8 +1,8 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { cx } from './class-names.js';
3
3
  import { Heading, Text } from './typography.js';
4
- export function PageHeader({ as: Root = 'div', headingProps, actionsLabel, title, description, breadcrumb, actions, level = 1, size = 'title', className, ...props }) {
5
- return (_jsxs(Root, { ...props, className: cx('surf-page-header', className), children: [breadcrumb != null && breadcrumb !== false && breadcrumb !== '' && (_jsx("div", { className: 'surf-page-header-breadcrumb', children: breadcrumb })), _jsxs("div", { className: 'surf-page-header-content', children: [_jsxs("div", { className: 'surf-page-header-copy', children: [_jsx(Heading, { ...headingProps, level: level, size: size, children: title }), description != null &&
4
+ export function PageHeader({ as: Root = 'div', headingProps, actionsLabel, title, description, breadcrumb, actions, level = 1, variant, size, lead = false, className, ...props }) {
5
+ return (_jsxs(Root, { ...props, className: cx('surf-page-header', className), children: [breadcrumb != null && breadcrumb !== false && breadcrumb !== '' && (_jsx("div", { className: 'surf-page-header-breadcrumb', children: breadcrumb })), _jsxs("div", { className: 'surf-page-header-content', children: [_jsxs("div", { className: 'surf-page-header-copy', children: [_jsx(Heading, { ...headingProps, level: level, size: variant ?? size ?? 'title', children: title }), description != null &&
6
6
  description !== false &&
7
- description !== '' && (_jsx(Text, { color: 'secondary', className: 'surf-page-header-description', children: description }))] }), actions != null && actions !== false && actions !== '' && (_jsx("div", { className: 'surf-page-header-actions', role: actionsLabel ? 'group' : undefined, "aria-label": actionsLabel, children: actions }))] })] }));
7
+ description !== '' && (_jsx(Text, { color: 'secondary', variant: lead ? 'reading' : 'body', "data-lead": lead || undefined, className: 'surf-page-header-description', children: description }))] }), actions != null && actions !== false && actions !== '' && (_jsx("div", { className: 'surf-page-header-actions', role: actionsLabel ? 'group' : undefined, "aria-label": actionsLabel, children: actions }))] })] }));
8
8
  }
package/dist/panel.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import * as React from 'react';
2
- import { type ComponentSizeAlias } from './sizing.js';
2
+ import { type ComponentSize } from './sizing.js';
3
3
  export type PanelSide = 'left' | 'right' | 'top' | 'bottom';
4
4
  export type PanelOptions = {
5
- size?: ComponentSizeAlias;
5
+ size?: ComponentSize;
6
6
  closeLabel?: string;
7
7
  /** Attaches the panel to its edge: no gap, and square corners on that edge, as a
8
8
  * mobile bottom sheet sits. */
@@ -12,4 +12,7 @@ export declare function Header({ className, ...props }: React.ComponentProps<'di
12
12
  export declare const Body: ({ className, ref, ...props }: React.ComponentProps<"div"> & {
13
13
  ref?: React.Ref<HTMLDivElement>;
14
14
  }) => React.JSX.Element;
15
- export declare function Footer({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
15
+ export declare function Footer({ stacked, className, ...props }: React.ComponentProps<'div'> & {
16
+ /** Stacks the actions, each the full width, as a phone's bottom sheet does. */
17
+ stacked?: boolean;
18
+ }): React.JSX.Element;
package/dist/panel.js CHANGED
@@ -7,6 +7,6 @@ export function Header({ className, ...props }) {
7
7
  export const Body = function Body({ className, ref, ...props }) {
8
8
  return (_jsx("div", { ...props, ref: ref, className: cx('surf-panel-body', className) }));
9
9
  };
10
- export function Footer({ className, ...props }) {
11
- return _jsx("div", { ...props, className: cx('surf-panel-footer', className) });
10
+ export function Footer({ stacked = false, className, ...props }) {
11
+ return (_jsx("div", { ...props, "data-stacked": stacked || undefined, className: cx('surf-panel-footer', className) }));
12
12
  }
package/dist/parts.d.ts CHANGED
@@ -1,11 +1,15 @@
1
1
  import { type ComponentSize } from './sizing.js';
2
2
  import * as React from 'react';
3
- export { cx, sizeName } from './class-names.js';
3
+ export { cx } from './class-names.js';
4
4
  /** Preserve Base UI's state-dependent className contract when adding a skin. */
5
5
  export declare function skin<State>(base: string, custom?: string | ((state: State) => string | undefined)): string | ((state: State) => string);
6
+ /** A portal renders outside the element that set dir, so a popup carries the
7
+ * DirectionProvider's direction itself: its text runs and its alignment mirror.
8
+ * Undefined unless the provider says right to left, so a page's own dir stays. */
9
+ export declare function usePortalDirection(): "rtl" | undefined;
6
10
  /** A styled Base UI part or element. A portal part renders outside the tree that sets
7
- * data-ui-size, so it always carries the size scheme; other parts carry it only when
8
- * size is set. */
11
+ * data-ui-size and dir, so it always carries the size scheme and the provider's
12
+ * direction; other parts carry the size only when size is set. */
9
13
  export declare function part<Element extends HTMLElement, Props extends {
10
14
  className?: unknown;
11
15
  }>(Component: React.ElementType, base: string, { portal }?: {
package/dist/parts.js CHANGED
@@ -2,25 +2,33 @@
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import { ComponentSizeContext, useComponentSize, } from './sizing.js';
4
4
  import * as React from 'react';
5
+ import { useDirection } from '@base-ui/react/direction-provider';
5
6
  import { cx } from './class-names.js';
6
- export { cx, sizeName } from './class-names.js';
7
+ export { cx } from './class-names.js';
7
8
  /** Preserve Base UI's state-dependent className contract when adding a skin. */
8
9
  export function skin(base, custom) {
9
10
  if (typeof custom === 'function')
10
11
  return (state) => cx(base, custom(state));
11
12
  return cx(base, custom);
12
13
  }
14
+ /** A portal renders outside the element that set dir, so a popup carries the
15
+ * DirectionProvider's direction itself: its text runs and its alignment mirror.
16
+ * Undefined unless the provider says right to left, so a page's own dir stays. */
17
+ export function usePortalDirection() {
18
+ return useDirection() === 'rtl' ? 'rtl' : undefined;
19
+ }
13
20
  /** A styled Base UI part or element. A portal part renders outside the tree that sets
14
- * data-ui-size, so it always carries the size scheme; other parts carry it only when
15
- * size is set. */
21
+ * data-ui-size and dir, so it always carries the size scheme and the provider's
22
+ * direction; other parts carry the size only when size is set. */
16
23
  export function part(Component, base, { portal = false } = {}) {
17
24
  return function ThemedPart({ ref, ...props }) {
18
25
  const { className, size, ...rest } = props;
19
26
  const scheme = useComponentSize(size);
27
+ const direction = usePortalDirection();
20
28
  const classes = typeof className === 'function'
21
29
  ? (state) => cx(base, className(state))
22
30
  : cx(base, className);
23
- const element = (_jsx(Component, { ...rest, ref: ref, className: classes, "data-ui-size": size ? scheme : portal ? scheme : undefined }));
31
+ const element = (_jsx(Component, { dir: portal ? direction : undefined, ...rest, ref: ref, className: classes, "data-ui-size": size ? scheme : portal ? scheme : undefined }));
24
32
  // Keep the React subtree stable when size changes from omitted to explicit.
25
33
  return (_jsx(ComponentSizeContext.Provider, { value: scheme, children: element }));
26
34
  };
package/dist/popover.d.ts CHANGED
@@ -1,18 +1,18 @@
1
1
  import * as React from 'react';
2
- import { type ComponentSizeAlias } from './sizing.js';
2
+ import { type ComponentSize } from './sizing.js';
3
3
  import { Popover as BasePopover } from '@base-ui/react/popover';
4
4
  declare function PopoverContent({ size, side, align, sideOffset, collisionPadding, className, ...props }: React.ComponentProps<typeof BasePopover.Popup> & Pick<React.ComponentProps<typeof BasePopover.Positioner>, 'side' | 'align' | 'sideOffset' | 'collisionPadding'> & {
5
5
  /** Width and density: small 240px, default 320px, large 480px. Unset, the
6
6
  * popover keeps the default width and takes the surrounding density. */
7
- size?: ComponentSizeAlias;
7
+ size?: ComponentSize;
8
8
  }): React.JSX.Element;
9
9
  declare const PopoverTitle: ({ ref, ...props }: Omit<Omit<Omit<import("@base-ui/react/popover").PopoverTitleProps, "ref"> & React.RefAttributes<HTMLHeadingElement>, "ref">, "size"> & {
10
- size?: import("./size.js").ComponentSize;
10
+ size?: ComponentSize;
11
11
  } & {
12
12
  ref?: React.Ref<HTMLHeadingElement> | undefined;
13
13
  }) => React.JSX.Element;
14
14
  declare const PopoverDescription: ({ ref, ...props }: Omit<Omit<Omit<import("@base-ui/react/popover").PopoverDescriptionProps, "ref"> & React.RefAttributes<HTMLParagraphElement>, "ref">, "size"> & {
15
- size?: import("./size.js").ComponentSize;
15
+ size?: ComponentSize;
16
16
  } & {
17
17
  ref?: React.Ref<HTMLParagraphElement> | undefined;
18
18
  }) => React.JSX.Element;
@@ -22,12 +22,12 @@ export declare const Popover: {
22
22
  Portal: React.ForwardRefExoticComponent<Omit<import("@base-ui/react/popover").PopoverPortalProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
23
23
  Content: typeof PopoverContent;
24
24
  Title: ({ ref, ...props }: Omit<Omit<Omit<import("@base-ui/react/popover").PopoverTitleProps, "ref"> & React.RefAttributes<HTMLHeadingElement>, "ref">, "size"> & {
25
- size?: import("./size.js").ComponentSize;
25
+ size?: ComponentSize;
26
26
  } & {
27
27
  ref?: React.Ref<HTMLHeadingElement> | undefined;
28
28
  }) => React.JSX.Element;
29
29
  Description: ({ ref, ...props }: Omit<Omit<Omit<import("@base-ui/react/popover").PopoverDescriptionProps, "ref"> & React.RefAttributes<HTMLParagraphElement>, "ref">, "size"> & {
30
- size?: import("./size.js").ComponentSize;
30
+ size?: ComponentSize;
31
31
  } & {
32
32
  ref?: React.Ref<HTMLParagraphElement> | undefined;
33
33
  }) => React.JSX.Element;
package/dist/popover.js CHANGED
@@ -1,11 +1,12 @@
1
1
  'use client';
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
- import { OwnPortal, part, scopedPortal, sizeName, skin } from './parts.js';
3
+ import { OwnPortal, part, scopedPortal, skin, usePortalDirection, } from './parts.js';
4
4
  import { useComponentSize } from './sizing.js';
5
5
  import { Popover as BasePopover } from '@base-ui/react/popover';
6
6
  function PopoverContent({ size, side = 'bottom', align = 'start', sideOffset = 8, collisionPadding = 12, className, ...props }) {
7
7
  const scheme = useComponentSize(size);
8
- return (_jsx(OwnPortal, { portal: BasePopover.Portal, children: _jsx(BasePopover.Positioner, { side: side, align: align, sideOffset: sideOffset, collisionPadding: collisionPadding, className: 'surf-positioner', children: _jsx(BasePopover.Popup, { "data-ui-size": scheme, "data-size": sizeName(size), ...props, className: skin('surf-popover', className) }) }) }));
8
+ const dir = usePortalDirection();
9
+ return (_jsx(OwnPortal, { portal: BasePopover.Portal, children: _jsx(BasePopover.Positioner, { dir: dir, side: side, align: align, sideOffset: sideOffset, collisionPadding: collisionPadding, className: 'surf-positioner', children: _jsx(BasePopover.Popup, { "data-ui-size": scheme, "data-size": size, ...props, className: skin('surf-popover', className) }) }) }));
9
10
  }
10
11
  const PopoverTitle = /* @__PURE__ */ part(BasePopover.Title, 'surf-popover-title');
11
12
  const PopoverDescription = /* @__PURE__ */ part(BasePopover.Description, 'surf-popover-description');
@@ -13,10 +13,7 @@ export declare const PreviewCard: {
13
13
  Popup: ({ className, ref, ...props }: React.ComponentPropsWithoutRef<typeof BasePreviewCard.Popup> & {
14
14
  ref?: React.Ref<HTMLDivElement>;
15
15
  }) => React.JSX.Element;
16
- Content: ({ side, align, sideOffset, collisionPadding, positionerProps, ref, ...props }: React.ComponentPropsWithoutRef<typeof BasePreviewCard.Popup> & Placement<typeof BasePreviewCard.Positioner> & {
17
- /** @deprecated Pass side, align, sideOffset and collisionPadding directly. */
18
- positionerProps?: React.ComponentPropsWithoutRef<typeof BasePreviewCard.Positioner>;
19
- } & {
16
+ Content: ({ side, align, sideOffset, collisionPadding, ref, ...props }: React.ComponentPropsWithoutRef<typeof BasePreviewCard.Popup> & Placement<typeof BasePreviewCard.Positioner> & {
20
17
  ref?: React.Ref<HTMLDivElement>;
21
18
  }) => React.JSX.Element;
22
19
  Root: <Payload>(props: BasePreviewCard.Root.Props<Payload>) => React.JSX.Element;
@@ -32,10 +29,7 @@ export declare const PreviewCardArrow: React.ForwardRefExoticComponent<Omit<impo
32
29
  size?: import("./size.js").ComponentSize;
33
30
  } & {
34
31
  ref?: React.Ref<HTMLDivElement> | undefined;
35
- }) => React.JSX.Element, PreviewCardRoot: <Payload>(props: BasePreviewCard.Root.Props<Payload>) => React.JSX.Element, PreviewCardTrigger: typeof PreviewTrigger, PreviewCardViewport: React.ForwardRefExoticComponent<Omit<import("@base-ui/react/preview-card").PreviewCardViewportProps, "ref"> & React.RefAttributes<HTMLDivElement>>, PreviewCardContent: ({ side, align, sideOffset, collisionPadding, positionerProps, ref, ...props }: React.ComponentPropsWithoutRef<typeof BasePreviewCard.Popup> & Placement<typeof BasePreviewCard.Positioner> & {
36
- /** @deprecated Pass side, align, sideOffset and collisionPadding directly. */
37
- positionerProps?: React.ComponentPropsWithoutRef<typeof BasePreviewCard.Positioner>;
38
- } & {
32
+ }) => React.JSX.Element, PreviewCardRoot: <Payload>(props: BasePreviewCard.Root.Props<Payload>) => React.JSX.Element, PreviewCardTrigger: typeof PreviewTrigger, PreviewCardViewport: React.ForwardRefExoticComponent<Omit<import("@base-ui/react/preview-card").PreviewCardViewportProps, "ref"> & React.RefAttributes<HTMLDivElement>>, PreviewCardContent: ({ side, align, sideOffset, collisionPadding, ref, ...props }: React.ComponentPropsWithoutRef<typeof BasePreviewCard.Popup> & Placement<typeof BasePreviewCard.Positioner> & {
39
33
  ref?: React.Ref<HTMLDivElement>;
40
34
  }) => React.JSX.Element;
41
35
  export {};
@@ -11,8 +11,8 @@ function PreviewTrigger(props) {
11
11
  const { className, ...rest } = props;
12
12
  return (_jsx(BasePreviewCard.Trigger, { ...rest, className: skin('surf-link surf-preview-trigger', className) }));
13
13
  }
14
- const PreviewContent = function PreviewContent({ side, align, sideOffset, collisionPadding, positionerProps, ref, ...props }) {
15
- return (_jsx(OwnPortal, { portal: BasePreviewCard.Portal, children: _jsx(PreviewPositioner, { sideOffset: 8, collisionPadding: 12, ...positionerProps, ...defined({ side, align, sideOffset, collisionPadding }), children: _jsx(PreviewPopup, { ...props, ref: ref }) }) }));
14
+ const PreviewContent = function PreviewContent({ side, align, sideOffset, collisionPadding, ref, ...props }) {
15
+ return (_jsx(OwnPortal, { portal: BasePreviewCard.Portal, children: _jsx(PreviewPositioner, { sideOffset: 8, collisionPadding: 12, ...defined({ side, align, sideOffset, collisionPadding }), children: _jsx(PreviewPopup, { ...props, ref: ref }) }) }));
16
16
  };
17
17
  export const PreviewCard = {
18
18
  ...BasePreviewCard,
package/dist/select.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import * as React from 'react';
2
- import { type ComponentSizeAlias } from './sizing.js';
2
+ import { type ComponentSize } from './sizing.js';
3
+ import { Select as BaseSelect } from '@base-ui/react/select';
3
4
  export type SelectOption = {
4
5
  value: string;
5
6
  label: React.ReactNode;
@@ -10,11 +11,8 @@ export type SelectGroup = {
10
11
  label: React.ReactNode;
11
12
  options: SelectOption[];
12
13
  };
13
- export type SelectProps = {
14
+ type SelectCommonProps = {
14
15
  options: (SelectOption | SelectGroup)[];
15
- value?: string;
16
- defaultValue?: string;
17
- onValueChange?: (value: string) => void;
18
16
  name?: string;
19
17
  form?: string;
20
18
  required?: boolean;
@@ -23,13 +21,45 @@ export type SelectProps = {
23
21
  className?: string;
24
22
  inputRef?: React.Ref<HTMLInputElement>;
25
23
  triggerRef?: React.Ref<HTMLButtonElement>;
26
- size?: ComponentSizeAlias;
24
+ size?: ComponentSize;
25
+ /** fill takes its container's width, as a form field does. content fits the
26
+ * longest option, as a native select does, so it sits beside other controls in
27
+ * a header or toolbar and keeps its width when the value changes. */
28
+ width?: 'fill' | 'content';
27
29
  'aria-label'?: string;
28
30
  'aria-labelledby'?: string;
29
31
  'aria-describedby'?: string;
30
32
  'aria-invalid'?: React.AriaAttributes['aria-invalid'];
31
33
  };
32
- /** A single-choice list. The ref reaches the trigger button, as triggerRef does. */
33
- export declare const Select: ({ options: items, value, defaultValue, onValueChange, className, inputRef, triggerRef, size, ref, ...props }: SelectProps & {
34
+ export type SelectProps = SelectCommonProps & {
35
+ multiple?: false;
36
+ value?: string;
37
+ defaultValue?: string;
38
+ /** Runs with the new value and Base UI's event details; call
39
+ * eventDetails.cancel() to keep the current value, as other fields allow. */
40
+ onValueChange?: (value: string, eventDetails: BaseSelect.Root.ChangeEventDetails) => void;
41
+ };
42
+ /** What a multiple Select's trigger says, and its first option. */
43
+ export type SelectMultipleLabels = {
44
+ /** Every option chosen, such as "All projects"; also the option that chooses them. */
45
+ all: string;
46
+ /** Nothing chosen, such as "No projects". */
47
+ none: string;
48
+ /** Several chosen, such as "3 projects". */
49
+ count: (count: number) => string;
50
+ };
51
+ /** Several choices from a list, summed up on one line: a filter of projects, models
52
+ * or nodes. Its first option, labels.all, chooses every option or none. */
53
+ export type SelectMultipleProps = SelectCommonProps & {
54
+ multiple: true;
55
+ value?: readonly string[];
56
+ defaultValue?: readonly string[];
57
+ onValueChange?: (value: string[], eventDetails: BaseSelect.Root.ChangeEventDetails) => void;
58
+ labels?: Partial<SelectMultipleLabels>;
59
+ };
60
+ /** A choice from a list, or several with multiple. The ref reaches the trigger
61
+ * button, as triggerRef does. */
62
+ export declare const Select: (allProps: (SelectProps | SelectMultipleProps) & {
34
63
  ref?: React.Ref<HTMLButtonElement>;
35
64
  }) => React.JSX.Element;
65
+ export {};