@phreshos/react-ui 0.1.35 → 0.1.37

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 (201) hide show
  1. package/README.md +147 -167
  2. package/dist/accordion.d.ts +7 -6
  3. package/dist/accordion.js +5 -5
  4. package/dist/alert-dialog.js +3 -1
  5. package/dist/alert.d.ts +17 -0
  6. package/dist/alert.js +30 -0
  7. package/dist/app-layout.d.ts +13 -0
  8. package/dist/app-layout.js +84 -0
  9. package/dist/button.d.ts +12 -24
  10. package/dist/button.js +34 -39
  11. package/dist/calendar-layout.d.ts +9 -5
  12. package/dist/calendar-layout.js +67 -78
  13. package/dist/calendar-trigger.d.ts +4 -4
  14. package/dist/calendar-trigger.js +7 -29
  15. package/dist/calendar.d.ts +2 -2
  16. package/dist/calendar.js +6 -5
  17. package/dist/checkbox.d.ts +4 -4
  18. package/dist/checkbox.js +16 -6
  19. package/dist/color-area.d.ts +20 -0
  20. package/dist/color-area.js +30 -0
  21. package/dist/color-field.d.ts +17 -0
  22. package/dist/color-field.js +17 -0
  23. package/dist/color-picker.d.ts +24 -0
  24. package/dist/color-picker.js +30 -0
  25. package/dist/color-slider.d.ts +19 -0
  26. package/dist/color-slider.js +29 -0
  27. package/dist/color-swatch-picker.d.ts +23 -0
  28. package/dist/color-swatch-picker.js +36 -0
  29. package/dist/color-swatch.d.ts +18 -0
  30. package/dist/color-swatch.js +20 -0
  31. package/dist/combo-box.d.ts +18 -10
  32. package/dist/combo-box.js +43 -58
  33. package/dist/context-menu.d.ts +14 -10
  34. package/dist/context-menu.js +7 -6
  35. package/dist/control/color-thumb.d.ts +13 -0
  36. package/dist/control/color-thumb.js +33 -0
  37. package/dist/control/color-value.d.ts +6 -0
  38. package/dist/control/color-value.js +7 -0
  39. package/dist/control/control.d.ts +60 -0
  40. package/dist/control/control.js +71 -0
  41. package/dist/control/field-button.d.ts +13 -0
  42. package/dist/control/field-button.js +28 -0
  43. package/dist/control/field.d.ts +20 -0
  44. package/dist/control/field.js +34 -0
  45. package/dist/control/icon.d.ts +11 -0
  46. package/dist/control/icon.js +8 -0
  47. package/dist/control/item.d.ts +34 -0
  48. package/dist/control/item.js +53 -0
  49. package/dist/control/open-state.d.ts +25 -0
  50. package/dist/control/open-state.js +8 -0
  51. package/dist/control/selection-track.d.ts +39 -0
  52. package/dist/control/selection-track.js +122 -0
  53. package/dist/control/selection.d.ts +44 -0
  54. package/dist/{selection.js → control/selection.js} +16 -0
  55. package/dist/control/surface-render.d.ts +10 -0
  56. package/dist/control/surface-render.js +12 -0
  57. package/dist/control/text-control.d.ts +32 -0
  58. package/dist/control/text-control.js +31 -0
  59. package/dist/control/toggle.d.ts +32 -0
  60. package/dist/control/toggle.js +80 -0
  61. package/dist/date-control.d.ts +9 -9
  62. package/dist/date-control.js +31 -34
  63. package/dist/date-field.d.ts +7 -6
  64. package/dist/date-field.js +8 -6
  65. package/dist/date-picker.d.ts +13 -6
  66. package/dist/date-picker.js +9 -6
  67. package/dist/date-range-picker.d.ts +15 -6
  68. package/dist/date-range-picker.js +12 -9
  69. package/dist/dialog.d.ts +22 -8
  70. package/dist/dialog.js +37 -28
  71. package/dist/disclosure.d.ts +8 -7
  72. package/dist/disclosure.js +31 -52
  73. package/dist/drop-zone.d.ts +18 -0
  74. package/dist/drop-zone.js +32 -0
  75. package/dist/dropdown-menu.d.ts +7 -4
  76. package/dist/dropdown-menu.js +5 -4
  77. package/dist/fieldset.d.ts +13 -0
  78. package/dist/fieldset.js +26 -0
  79. package/dist/file-trigger.d.ts +13 -0
  80. package/dist/file-trigger.js +6 -0
  81. package/dist/flex.d.ts +1 -1
  82. package/dist/flex.js +5 -4
  83. package/dist/foundation/appearance.d.ts +83 -0
  84. package/dist/foundation/appearance.js +38 -0
  85. package/dist/{aria-direction.js → foundation/aria-direction.js} +3 -1
  86. package/dist/foundation/color.d.ts +61 -0
  87. package/dist/foundation/color.js +247 -0
  88. package/dist/{layout.d.ts → foundation/layout.d.ts} +6 -4
  89. package/dist/{layout.js → foundation/layout.js} +7 -5
  90. package/dist/foundation/motion-style.d.ts +9 -0
  91. package/dist/foundation/motion-style.js +50 -0
  92. package/dist/foundation/preferences.d.ts +15 -0
  93. package/dist/{ui-provider.d.ts → foundation/provider.d.ts} +3 -5
  94. package/dist/{ui-provider.js → foundation/provider.js} +14 -26
  95. package/dist/{radius.d.ts → foundation/radius.d.ts} +6 -3
  96. package/dist/foundation/radius.js +11 -0
  97. package/dist/foundation/spacing.d.ts +11 -0
  98. package/dist/foundation/spacing.js +4 -0
  99. package/dist/foundation/visual.d.ts +42 -0
  100. package/dist/{appearance-context.js → foundation/visual.js} +41 -27
  101. package/dist/grid.d.ts +1 -1
  102. package/dist/grid.js +5 -4
  103. package/dist/icons/main.d.ts +5 -3
  104. package/dist/icons/main.js +5 -3
  105. package/dist/input.d.ts +2 -2
  106. package/dist/input.js +9 -7
  107. package/dist/list-box.d.ts +24 -19
  108. package/dist/list-box.js +52 -109
  109. package/dist/main.d.ts +27 -16
  110. package/dist/main.js +22 -9
  111. package/dist/menu.d.ts +28 -32
  112. package/dist/menu.js +47 -93
  113. package/dist/number-field.d.ts +17 -0
  114. package/dist/number-field.js +28 -0
  115. package/dist/panel.d.ts +10 -5
  116. package/dist/panel.js +33 -12
  117. package/dist/popover.d.ts +19 -5
  118. package/dist/popover.js +22 -15
  119. package/dist/progress-bar.d.ts +8 -10
  120. package/dist/progress-bar.js +18 -34
  121. package/dist/radio.d.ts +15 -12
  122. package/dist/radio.js +27 -37
  123. package/dist/range-calendar.d.ts +5 -3
  124. package/dist/range-calendar.js +8 -7
  125. package/dist/scroll-area.d.ts +2 -2
  126. package/dist/scroll-area.js +10 -9
  127. package/dist/segmented-control.d.ts +23 -0
  128. package/dist/segmented-control.js +38 -0
  129. package/dist/select.d.ts +40 -13
  130. package/dist/select.js +63 -18
  131. package/dist/slider.d.ts +7 -3
  132. package/dist/slider.js +51 -50
  133. package/dist/spinner.d.ts +5 -8
  134. package/dist/spinner.js +12 -25
  135. package/dist/surface/grain.d.ts +12 -0
  136. package/dist/surface/grain.js +65 -0
  137. package/dist/{material-options.d.ts → surface/material-options.d.ts} +1 -2
  138. package/dist/{material-options.js → surface/material-options.js} +2 -2
  139. package/dist/surface/paint-class.d.ts +6 -0
  140. package/dist/surface/paint-class.js +36 -0
  141. package/dist/{shadow-options.d.ts → surface/shadow-options.d.ts} +13 -1
  142. package/dist/{shadow-options.js → surface/shadow-options.js} +17 -2
  143. package/dist/surface/surface.d.ts +73 -0
  144. package/dist/surface/surface.js +230 -0
  145. package/dist/switch.d.ts +4 -5
  146. package/dist/switch.js +17 -8
  147. package/dist/table.d.ts +29 -32
  148. package/dist/table.js +68 -106
  149. package/dist/tabs.d.ts +16 -15
  150. package/dist/tabs.js +44 -86
  151. package/dist/textarea.d.ts +2 -2
  152. package/dist/textarea.js +10 -14
  153. package/dist/time-field.d.ts +6 -6
  154. package/dist/time-field.js +8 -6
  155. package/dist/toolbar.d.ts +6 -4
  156. package/dist/toolbar.js +16 -15
  157. package/dist/tooltip.d.ts +13 -4
  158. package/dist/tooltip.js +17 -15
  159. package/dist/tree.d.ts +22 -27
  160. package/dist/tree.js +54 -99
  161. package/dist/window.d.ts +2 -2
  162. package/dist/window.js +18 -20
  163. package/package.json +3 -3
  164. package/dist/appearance-context.d.ts +0 -54
  165. package/dist/appearance.d.ts +0 -11
  166. package/dist/appearance.js +0 -11
  167. package/dist/color.d.ts +0 -69
  168. package/dist/color.js +0 -192
  169. package/dist/control-surface.d.ts +0 -20
  170. package/dist/control-surface.js +0 -11
  171. package/dist/control.d.ts +0 -70
  172. package/dist/control.js +0 -105
  173. package/dist/field-style.d.ts +0 -3
  174. package/dist/field-style.js +0 -12
  175. package/dist/material-paint.d.ts +0 -13
  176. package/dist/material-paint.js +0 -119
  177. package/dist/motion-style.d.ts +0 -13
  178. package/dist/motion-style.js +0 -75
  179. package/dist/preferences.d.ts +0 -12
  180. package/dist/radius.js +0 -11
  181. package/dist/readiness.d.ts +0 -37
  182. package/dist/readiness.js +0 -134
  183. package/dist/selection.d.ts +0 -18
  184. package/dist/spacing.d.ts +0 -8
  185. package/dist/spacing.js +0 -8
  186. package/dist/surface-edge.d.ts +0 -11
  187. package/dist/surface-edge.js +0 -55
  188. package/dist/surface.d.ts +0 -27
  189. package/dist/surface.js +0 -92
  190. package/dist/text-control.d.ts +0 -10
  191. package/dist/text-control.js +0 -0
  192. package/dist/toggle-indicator.d.ts +0 -18
  193. package/dist/toggle-indicator.js +0 -49
  194. /package/dist/{aria-direction.d.ts → foundation/aria-direction.d.ts} +0 -0
  195. /package/dist/{direction.d.ts → foundation/direction.d.ts} +0 -0
  196. /package/dist/{direction.js → foundation/direction.js} +0 -0
  197. /package/dist/{overlay-placement.d.ts → foundation/overlay-placement.d.ts} +0 -0
  198. /package/dist/{overlay-placement.js → foundation/overlay-placement.js} +0 -0
  199. /package/dist/{preferences.js → foundation/preferences.js} +0 -0
  200. /package/dist/{scale.d.ts → foundation/scale.d.ts} +0 -0
  201. /package/dist/{scale.js → foundation/scale.js} +0 -0
package/dist/grid.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { ComponentPropsWithoutRef, CSSProperties } from "react";
2
- import type { LayoutAlignment, LayoutGap, LayoutJustification } from "./layout.js";
2
+ import type { LayoutAlignment, LayoutGap, LayoutJustification } from "./foundation/layout.js";
3
3
  /** Properties accepted by the Grid layout primitive. */
4
4
  export interface GridProps extends ComponentPropsWithoutRef<"div"> {
5
5
  /** Equal-width column count or native CSS column-track expression. */
package/dist/grid.js CHANGED
@@ -1,15 +1,16 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { forwardRef } from "react";
3
- import { alignment, justification, resolveGap, tracks } from "./layout.js";
4
- import { useAppearance } from "./ui-provider.js";
3
+ import { alignment, justification, tracks } from "./foundation/layout.js";
4
+ import { resolveSpacing } from "./foundation/spacing.js";
5
+ import { useVisual } from "./foundation/visual.js";
5
6
  /** A predictable CSS Grid container with no visual appearance of its own. */
6
7
  export const Grid = forwardRef(function Grid({ align, columns, flow, gap, inline = false, justify, rows, style, ...properties }, ref) {
7
- const appearance = useAppearance();
8
+ const { spacing } = useVisual();
8
9
  return _jsx("div", { ...properties, ref: ref, style: {
9
10
  ...style,
10
11
  display: inline ? "inline-grid" : "grid",
11
12
  alignItems: alignment(align) ?? style?.alignItems,
12
- gap: gap === undefined ? style?.gap : resolveGap(gap, appearance),
13
+ gap: gap === undefined ? style?.gap : resolveSpacing(gap, spacing),
13
14
  gridAutoFlow: flow ?? style?.gridAutoFlow,
14
15
  gridTemplateColumns: tracks(columns, "columns") ?? style?.gridTemplateColumns,
15
16
  gridTemplateRows: tracks(rows, "rows") ?? style?.gridTemplateRows,
@@ -1,7 +1,9 @@
1
1
  /**
2
2
  * Public entry point for icons that belong to the React UI visual language.
3
3
  *
4
- * Icons enter this surface only after their source, accessibility behavior,
5
- * and customization contract have been established.
4
+ * Every Lucide icon is available here under its Lucide name. Programs import
5
+ * icons only from this entry, so the icon source stays an implementation
6
+ * detail. Inside a UIProvider an icon follows its text size and color with a
7
+ * constant 1.5px stroke; its own `size`, `color`, or `strokeWidth` still wins.
6
8
  */
7
- export {};
9
+ export * from "lucide-react";
@@ -1,7 +1,9 @@
1
1
  /**
2
2
  * Public entry point for icons that belong to the React UI visual language.
3
3
  *
4
- * Icons enter this surface only after their source, accessibility behavior,
5
- * and customization contract have been established.
4
+ * Every Lucide icon is available here under its Lucide name. Programs import
5
+ * icons only from this entry, so the icon source stays an implementation
6
+ * detail. Inside a UIProvider an icon follows its text size and color with a
7
+ * constant 1.5px stroke; its own `size`, `color`, or `strokeWidth` still wins.
6
8
  */
7
- export {};
9
+ export * from "lucide-react";
package/dist/input.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { TextControlProps } from "./text-control.js";
1
+ import { type TextControlProps } from "./control/text-control.js";
2
2
  export type InputProps = TextControlProps;
3
- /** A labeled single-line text control. onChange receives the string value. */
3
+ /** A labeled single-line text field. `onChange` receives the string value. */
4
4
  export declare const Input: import("react").ForwardRefExoticComponent<TextControlProps & import("react").RefAttributes<HTMLInputElement>>;
package/dist/input.js CHANGED
@@ -1,11 +1,13 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { forwardRef } from "react";
3
3
  import { Input as AriaInput, TextField } from "react-aria-components";
4
- import { controlPaint, controlStyle, FieldFeedback, FieldLabel, fieldStyle, useControlTheme } from "./control.js";
5
- import { SurfaceField } from "./control-surface.js";
6
- import FieldStyle, { textControlClass } from "./field-style.js";
7
- /** A labeled single-line text control. onChange receives the string value. */
8
- export const Input = forwardRef(function Input({ label, description, errorMessage, disabled, readOnly, required, invalid, size, color, radius, style, className, placeholder, material, shadow, ...properties }, ref) {
9
- const theme = useControlTheme({ size, color, radius });
10
- return _jsxs(TextField, { ...properties, className: className, isDisabled: disabled, isReadOnly: readOnly, isRequired: required, isInvalid: invalid, style: fieldStyle(theme, disabled, style), children: [_jsx(FieldStyle, {}), _jsx(FieldLabel, { label: label }), _jsx(AriaInput, { ref: ref, placeholder: placeholder, className: textControlClass, render: (native, state) => _jsx(SurfaceField, { material: material, shadow: shadow, radius: theme.radius, paint: controlPaint(theme, state.isFocused, state.isInvalid, state.isHovered), children: _jsx("input", { ...native, style: { ...native.style, borderRadius: "inherit", background: "transparent" } }) }), style: state => controlStyle(theme, state.isFocused, state.isInvalid, state.isHovered, state.isFocusVisible) }), _jsx(FieldFeedback, { theme: theme, description: description, errorMessage: errorMessage })] });
4
+ import { useControlMetrics } from "./control/control.js";
5
+ import { FieldFeedback, FieldLabel, fieldStyle } from "./control/field.js";
6
+ import { nativeTextStyle, TextWell } from "./control/text-control.js";
7
+ import MotionStyle, { textControlClass } from "./foundation/motion-style.js";
8
+ import { dimmedClass } from "./surface/surface.js";
9
+ /** A labeled single-line text field. `onChange` receives the string value. */
10
+ export const Input = forwardRef(function Input({ label, description, errorMessage, disabled, readOnly, required, invalid, size, color = "background", radius, style, className, placeholder, material, ...properties }, ref) {
11
+ const metrics = useControlMetrics(size, radius);
12
+ return _jsxs(TextField, { ...properties, className: dimmedClass(disabled ?? false, className), isDisabled: disabled, isReadOnly: readOnly, isRequired: required, isInvalid: invalid, style: fieldStyle(metrics, style), children: [_jsx(MotionStyle, {}), _jsx(FieldLabel, { label: label }), _jsx(AriaInput, { ref: ref, placeholder: placeholder, className: textControlClass, render: (native, state) => _jsx(TextWell, { color: color, material: material, metrics: metrics, state: state, children: _jsx("input", { ...native }) }), style: nativeTextStyle(metrics, false) }), _jsx(FieldFeedback, { metrics: metrics, description: description, errorMessage: errorMessage })] });
11
13
  });
@@ -1,13 +1,20 @@
1
1
  import type { CSSProperties, ReactElement, RefAttributes } from "react";
2
2
  import type { HeaderProps as AriaHeaderProps, ListBoxItemProps as AriaListBoxItemProps, ListBoxProps as AriaListBoxProps, ListBoxSectionProps as AriaListBoxSectionProps } from "react-aria-components";
3
- import type { ControlColor } from "./control.js";
4
- import type { RadiusProps } from "./radius.js";
5
- import type { ScaleLevel } from "./scale.js";
6
- import { type MultipleStringSelection, type MultipleStringSelectionProps, type SingleStringSelectionProps } from "./selection.js";
7
- type ListBoxRootBaseProps<T extends object> = Omit<AriaListBoxProps<T>, "className" | "defaultSelectedKeys" | "disabledKeys" | "onSelectionChange" | "selectedKeys" | "selectionMode" | "style"> & RadiusProps & Readonly<{
3
+ import { type ControlMetrics } from "./control/control.js";
4
+ import { type MultipleSelectionProps, type MultipleStringSelection, type SingleStringSelectionProps } from "./control/selection.js";
5
+ import type { Color } from "./foundation/color.js";
6
+ import type { RadiusProps } from "./foundation/radius.js";
7
+ import type { ScaleLevel } from "./foundation/scale.js";
8
+ type ListBoxRootBaseProps<T extends object> = Omit<AriaListBoxProps<T>, "className" | "defaultSelectedKeys" | "disabledKeys" | "onSelectionChange" | "selectedKeys" | "selectionMode" | "style" | "shouldFocusOnHover" | "shouldFocusWrap" | "shouldSelectOnPressUp"> & RadiusProps & Readonly<{
8
9
  className?: string;
9
- color?: ControlColor;
10
- disabledValues?: readonly string[];
10
+ /** Color laid beneath selected Items. */
11
+ color?: Color;
12
+ /** Whether pointing at an Item moves focus to it. */
13
+ focusOnHover?: boolean;
14
+ /** Whether arrow keys wrap from the last Item to the first. */
15
+ focusWrap?: boolean;
16
+ /** Whether an Item is selected when the press ends instead of when it starts. */
17
+ selectOnPressUp?: boolean;
11
18
  size?: ScaleLevel;
12
19
  style?: CSSProperties;
13
20
  }>;
@@ -15,31 +22,29 @@ export type ListBoxSingleSelectionProps = SingleStringSelectionProps & Readonly<
15
22
  selectionMode?: "single";
16
23
  }>;
17
24
  export type ListBoxMultipleValue = MultipleStringSelection;
18
- export type ListBoxMultipleSelectionProps = MultipleStringSelectionProps & Readonly<{
19
- selectionMode: "multiple";
20
- }>;
21
- /** Properties accepted by the selectable collection. Single selection is the default. */
25
+ export type ListBoxMultipleSelectionProps = MultipleSelectionProps;
26
+ /** A selectable collection. Single selection is the default. */
22
27
  export type ListBoxRootProps<T extends object = object> = ListBoxRootBaseProps<T> & (ListBoxSingleSelectionProps | ListBoxMultipleSelectionProps);
23
28
  export type ListBoxRootComponent = <T extends object = object>(properties: ListBoxRootProps<T> & RefAttributes<HTMLDivElement>) => ReactElement | null;
24
- export declare const ListBoxRoot: ListBoxRootComponent;
25
- export interface ListBoxItemProps<T = object> extends Omit<AriaListBoxItemProps<T>, "className" | "id" | "isDisabled" | "style"> {
29
+ export interface ListBoxItemProps<T = object> extends Omit<AriaListBoxItemProps<T>, "className" | "id" | "isDisabled" | "render" | "style"> {
30
+ /** Identity of this Item within its collection. */
31
+ readonly id: string;
26
32
  readonly className?: string;
27
- readonly color?: ControlColor;
33
+ /** Color laid beneath this Item when it is selected. */
34
+ readonly color?: Color;
28
35
  readonly disabled?: boolean;
29
- readonly id: string;
30
36
  readonly style?: CSSProperties;
31
37
  }
32
38
  export type ListBoxItemComponent = <T = object>(properties: ListBoxItemProps<T> & RefAttributes<HTMLDivElement>) => ReactElement | null;
33
- export declare const ListBoxItem: ListBoxItemComponent;
34
39
  export interface ListBoxSectionProps<T extends object = object> extends Omit<AriaListBoxSectionProps<T>, "className" | "style"> {
35
40
  readonly className?: string;
36
41
  readonly style?: CSSProperties;
37
42
  }
38
43
  export type ListBoxSectionComponent = <T extends object = object>(properties: ListBoxSectionProps<T> & RefAttributes<HTMLElement>) => ReactElement | null;
39
- export declare const ListBoxSection: ListBoxSectionComponent;
40
44
  export type ListBoxHeaderProps = AriaHeaderProps;
41
- export declare const ListBoxHeader: import("react").ForwardRefExoticComponent<AriaHeaderProps & RefAttributes<HTMLElement>>;
42
- /** A selectable collection whose items and groups remain independently composable. */
45
+ /** Heading treatment shared by list and menu sections. */
46
+ export declare function collectionHeaderStyle(metrics: ControlMetrics, style?: CSSProperties): CSSProperties;
47
+ /** A selectable collection whose Items and Sections remain independently composable. */
43
48
  export declare const ListBox: ListBoxRootComponent & {
44
49
  Item: ListBoxItemComponent;
45
50
  Section: ListBoxSectionComponent;
package/dist/list-box.js CHANGED
@@ -1,129 +1,72 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { createContext, forwardRef, useContext, useMemo } from "react";
3
3
  import { Header as AriaHeader, ListBox as AriaListBox, ListBoxItem as AriaListBoxItem, ListBoxSection as AriaListBoxSection } from "react-aria-components";
4
- import { controlFontWeight, controlOpacity, useControlTheme } from "./control.js";
5
- import { resolveDirection, useDirection } from "./direction.js";
6
- import { multipleSelection, singleSelection, toAriaSelection } from "./selection.js";
7
- import { AriaDirectionBoundary } from "./aria-direction.js";
8
- const ListBoxThemeContext = createContext(null);
9
- const ListBoxRootImplementation = forwardRef(function ListBoxRoot(properties, ref) {
10
- const { className, color, defaultValue, disabledValues, onChange, radius = "medium", selectionMode = "single", shouldFocusOnHover = false, size = "medium", style, value, ...native } = properties;
11
- const theme = useControlTheme({ color, radius, size });
12
- const context = useMemo(() => ({ color, radius, size, theme }), [color, radius, size, theme]);
4
+ import { controlFontWeight, controlOpacity, useControlMetrics } from "./control/control.js";
5
+ import { itemStyle, itemSurface, SelectionMark } from "./control/item.js";
6
+ import { ariaSelection } from "./control/selection.js";
7
+ import { surfaceRender } from "./control/surface-render.js";
8
+ import { AriaDirectionBoundary } from "./foundation/aria-direction.js";
9
+ import { resolveDirection, useDirection } from "./foundation/direction.js";
10
+ const ListBoxStyleContext = createContext(null);
11
+ const ListBoxRootImplementation = forwardRef(function ListBox(properties, ref) {
12
+ const { className, color = "primary", defaultValue: _defaultValue, onChange: _onChange, radius, selectionMode: _selectionMode, focusOnHover = false, focusWrap, selectOnPressUp, size, style, value: _value, ...native } = properties;
13
+ const metrics = useControlMetrics(size, radius);
14
+ // Items are controls: they take the control radius at their size.
15
+ const itemRadius = metrics.radius;
16
+ const context = useMemo(() => ({ color, metrics, itemRadius }), [color, metrics, itemRadius]);
13
17
  const direction = resolveDirection(native.dir, useDirection());
14
- const selection = selectionProperties(properties);
15
- return _jsx(ListBoxThemeContext.Provider, { value: context, children: _jsx(AriaDirectionBoundary, { direction: direction, children: _jsx(AriaListBox, { ...native, ...selection, ref: ref, dir: direction, selectionMode: selectionMode, shouldFocusOnHover: shouldFocusOnHover, className: className, style: {
18
+ return _jsx(ListBoxStyleContext.Provider, { value: context, children: _jsx(AriaDirectionBoundary, { direction: direction, children: _jsx(AriaListBox, { ...native, ...ariaSelection(properties, "single"), ref: ref, dir: direction, shouldFocusOnHover: focusOnHover, shouldFocusWrap: focusWrap, shouldSelectOnPressUp: selectOnPressUp, className: className, style: {
16
19
  display: "grid",
17
- gap: theme.gap,
20
+ gap: 2,
18
21
  minWidth: 0,
19
- padding: theme.gap,
22
+ padding: metrics.listInset,
20
23
  boxSizing: "border-box",
21
24
  outline: "none",
22
25
  fontFamily: "inherit",
23
- fontSize: theme.fontSize,
26
+ fontSize: metrics.fontSize,
24
27
  ...style
25
28
  } }) }) });
26
29
  });
27
- export const ListBoxRoot = ListBoxRootImplementation;
28
- function selectionProperties(properties) {
29
- const selectedKeys = toAriaSelection(properties.value);
30
- const defaultSelectedKeys = toAriaSelection(properties.defaultValue);
31
- const disabledKeys = properties.disabledValues;
32
- const onSelectionChange = properties.onChange == null
33
- ? undefined
34
- : (selection) => {
35
- if (properties.selectionMode === "multiple") {
36
- properties.onChange?.(multipleSelection(selection));
37
- return;
38
- }
39
- properties.onChange?.(singleSelection(selection));
40
- };
41
- return {
42
- ...(selectedKeys !== undefined ? { selectedKeys } : {}),
43
- ...(defaultSelectedKeys !== undefined ? { defaultSelectedKeys } : {}),
44
- ...(disabledKeys !== undefined ? { disabledKeys } : {}),
45
- ...(onSelectionChange !== undefined ? { onSelectionChange } : {})
46
- };
47
- }
48
- const ListBoxItemImplementation = forwardRef(function ListBoxItem({ children, className, color, disabled = false, style, ...properties }, ref) {
49
- const inherited = useContext(ListBoxThemeContext);
50
- const item = {
51
- children,
52
- className,
53
- disabled,
54
- properties: {
55
- ...properties,
56
- textValue: properties.textValue ?? (typeof children === "string" ? children : undefined)
57
- },
58
- ref,
59
- style
60
- };
61
- return inherited != null && color === undefined
62
- ? _jsx(ListBoxItemView, { ...item, theme: inherited.theme })
63
- : _jsx(ResolvedListBoxItem, { ...item, color: color ?? inherited?.color, radius: inherited?.radius, size: inherited?.size });
30
+ const ListBoxItemImplementation = forwardRef(function ListBoxItem({ children, className, color, disabled = false, style, textValue, ...properties }, ref) {
31
+ const inherited = useListBoxStyle();
32
+ const itemColor = color ?? inherited.color;
33
+ const { metrics, itemRadius } = inherited;
34
+ return _jsx(AriaListBoxItem, { ...properties, ref: ref, textValue: textValue ?? (typeof children === "string" ? children : undefined), className: className, isDisabled: disabled, render: surfaceRender("div", state => itemSurface(metrics.visual, itemColor, {
35
+ selected: state.isSelected,
36
+ hovered: state.isHovered,
37
+ pressed: state.isPressed,
38
+ focusVisible: state.isFocusVisible,
39
+ disabled: state.isDisabled
40
+ }, itemRadius)), style: { ...itemStyle(metrics, disabled), ...style }, children: state => _jsxs(_Fragment, { children: [typeof children === "function" ? children(state) : children, _jsx(SelectionMark, { visible: state.isSelected })] }) });
64
41
  });
65
- function ResolvedListBoxItem({ color, radius, size, ...properties }) {
66
- return _jsx(ListBoxItemView, { ...properties, theme: useControlTheme({ color, radius, size }) });
67
- }
68
- function ListBoxItemView({ children, className, disabled, properties, ref, style, theme }) {
69
- return _jsx(AriaListBoxItem, { ...properties, ref: ref, className: className, isDisabled: disabled, style: state => ({
70
- ...theme.transition,
71
- display: "flex",
72
- alignItems: "center",
73
- justifyContent: "space-between",
74
- gap: theme.gap,
75
- minWidth: 0,
76
- minHeight: theme.height,
77
- paddingInline: Math.max(8, theme.spacing),
78
- boxSizing: "border-box",
79
- borderRadius: theme.radius,
80
- outline: state.isFocusVisible && !state.isSelected ? `1px solid ${theme.focusColor}` : "none",
81
- outlineOffset: 1,
82
- cursor: disabled ? "not-allowed" : "pointer",
83
- opacity: disabled ? controlOpacity.disabled : 1,
84
- userSelect: "none",
85
- ...(state.isSelected
86
- ? state.isPressed
87
- ? theme.paints.palette.pressed
88
- : state.isHovered
89
- ? theme.paints.palette.hover
90
- : theme.paints.palette.rest
91
- : state.isHovered
92
- ? theme.paints.subtle.hover
93
- : { background: "transparent", color: "inherit" }),
94
- ...style
95
- }), children: state => _jsxs(_Fragment, { children: [typeof children === "function" ? children(state) : children, _jsx("span", { "aria-hidden": "true", style: { flexShrink: 0, width: "1em", textAlign: "center" }, children: state.isSelected ? "✓" : null })] }) });
96
- }
97
- export const ListBoxItem = ListBoxItemImplementation;
98
42
  const ListBoxSectionImplementation = forwardRef(function ListBoxSection({ className, style, ...properties }, ref) {
99
- const theme = useListBoxTheme();
100
- return _jsx(AriaListBoxSection, { ...properties, ref: ref, className: className, style: {
101
- display: "grid",
102
- gap: theme.gap,
103
- minWidth: 0,
104
- ...style
105
- } });
43
+ useListBoxStyle();
44
+ return _jsx(AriaListBoxSection, { ...properties, ref: ref, className: className, style: { display: "grid", gap: 2, minWidth: 0, ...style } });
106
45
  });
107
- export const ListBoxSection = ListBoxSectionImplementation;
108
- export const ListBoxHeader = forwardRef(function ListBoxHeader({ style, ...properties }, ref) {
109
- const theme = useListBoxTheme();
110
- return _jsx(AriaHeader, { ...properties, ref: ref, style: {
111
- paddingInline: Math.max(8, theme.spacing),
112
- paddingBlock: theme.gap,
113
- fontWeight: controlFontWeight,
114
- opacity: controlOpacity.secondary,
115
- ...style
116
- } });
46
+ const ListBoxHeader = forwardRef(function ListBoxHeader({ style, ...properties }, ref) {
47
+ const { metrics } = useListBoxStyle();
48
+ return _jsx(AriaHeader, { ...properties, ref: ref, style: collectionHeaderStyle(metrics, style) });
117
49
  });
118
- function useListBoxTheme() {
119
- const inherited = useContext(ListBoxThemeContext);
120
- if (inherited == null)
50
+ /** Heading treatment shared by list and menu sections. */
51
+ export function collectionHeaderStyle(metrics, style) {
52
+ return {
53
+ paddingInline: metrics.inset,
54
+ paddingBlock: metrics.gap,
55
+ fontSize: "0.92em",
56
+ fontWeight: controlFontWeight,
57
+ opacity: controlOpacity.secondary,
58
+ ...style
59
+ };
60
+ }
61
+ function useListBoxStyle() {
62
+ const context = useContext(ListBoxStyleContext);
63
+ if (context == null)
121
64
  throw new Error("ListBox parts must be used inside ListBox");
122
- return inherited.theme;
65
+ return context;
123
66
  }
124
- /** A selectable collection whose items and groups remain independently composable. */
125
- export const ListBox = Object.assign(ListBoxRoot, {
126
- Item: ListBoxItem,
127
- Section: ListBoxSection,
67
+ /** A selectable collection whose Items and Sections remain independently composable. */
68
+ export const ListBox = Object.assign(ListBoxRootImplementation, {
69
+ Item: ListBoxItemImplementation,
70
+ Section: ListBoxSectionImplementation,
128
71
  Header: ListBoxHeader
129
72
  });
package/dist/main.d.ts CHANGED
@@ -4,14 +4,15 @@
4
4
  * Components enter this surface only after their implementation-independent
5
5
  * behavior contract has been established by the package's tests.
6
6
  */
7
- export { defaultAppearance, type Appearance, type AppearanceUpdate, type AppearanceColor, type AppearanceColors, type AppearanceMaterial, type AppearanceShadow, type AppearanceTransaction, type Easing, type ThemedValue } from "./appearance.js";
8
- export { UIProvider, useAppearance, useBrowserPreferences, useDirection, useDocumentDirection, usePreferences, useThemedValue, type UIProviderProps } from "./ui-provider.js";
9
- export type { Preferences, PreferencesUpdate, Theme } from "./preferences.js";
10
- export type { Direction } from "./direction.js";
7
+ export { appearanceLimits, defaultAppearance, type Appearance, type AppearanceColor, type AppearanceColors, type AppearanceMaterial, type AppearanceRange, type AppearanceShadow, type AppearanceTransaction, type AppearanceUpdate, type Easing, type ThemedValue } from "./foundation/appearance.js";
8
+ export { UIProvider, type UIProviderProps } from "./foundation/provider.js";
9
+ export { useAppearance, useBrowserPreferences, usePreferences, useThemedValue } from "./foundation/visual.js";
10
+ export { useDirection, useDocumentDirection, type Direction } from "./foundation/direction.js";
11
+ export type { Preferences, PreferencesUpdate, Theme } from "./foundation/preferences.js";
11
12
  export { Flex, type FlexProps } from "./flex.js";
12
13
  export { Grid, type GridProps } from "./grid.js";
13
- export { Surface, type MaterialMode, type MaterialOptions, type ShadowOptions, type SurfaceComponent, type SurfaceHost, type SurfaceHostProps, type SurfaceOwnProps, type SurfaceProps } from "./surface.js";
14
- export { defaultColor, type Color, type ColorLevel, type ColorScale } from "./color.js";
14
+ export { Surface, type MaterialMode, type MaterialOptions, type ShadowOptions, type SurfaceComponent, type SurfaceDepth, type SurfaceHost, type SurfaceHostProps, type SurfaceOwnProps, type SurfaceProps } from "./surface/surface.js";
15
+ export { resolveColor, useColor, useContrastingColor, type Color, type ColorLevel, type ColorScale } from "./foundation/color.js";
15
16
  export { Panel, type PanelProps, type PanelHeaderProps, type PanelContentProps } from "./panel.js";
16
17
  export { Window, type WindowProps, type WindowContentProps, type WindowHeaderProps, type WindowIdentityProps, type WindowCenterProps, type WindowActionsProps, type WindowActionProps, type WindowControlProps, type WindowMaximizeProps, type WindowCloseProps, type WindowMoveCaptureProps } from "./window.js";
17
18
  export { default as useWindowMoveHandle, type WindowMoveHandle } from "./use-window-move-handle.js";
@@ -28,8 +29,8 @@ export type { DateRange } from "./date-range.js";
28
29
  export { Checkbox, type CheckboxProps } from "./checkbox.js";
29
30
  export { RadioGroup, type RadioGroupProps, type RadioGroupItemProps } from "./radio.js";
30
31
  export { Switch, type SwitchProps } from "./switch.js";
31
- export { Select, type SelectProps, type SelectOption } from "./select.js";
32
- export { ComboBox, type ComboBoxProps, type ComboBoxOption } from "./combo-box.js";
32
+ export { Select, type SelectProps } from "./select.js";
33
+ export { ComboBox, type ComboBoxProps } from "./combo-box.js";
33
34
  export { ListBox, type ListBoxProps, type ListBoxSingleSelectionProps, type ListBoxMultipleSelectionProps, type ListBoxMultipleValue, type ListBoxItemProps, type ListBoxSectionProps, type ListBoxHeaderProps } from "./list-box.js";
34
35
  export { Tabs, type TabsProps, type TabsListProps, type TabsTabProps, type TabsPanelsProps, type TabsPanelProps } from "./tabs.js";
35
36
  export { Table, type TableProps, type TableNoSelectionProps, type TableSingleSelectionProps, type TableMultipleSelectionProps, type TableMultipleValue, type TableSort, type TableSortDirection, type TableHeaderProps, type TableColumnProps, type TableBodyProps, type TableRowProps, type TableCellProps } from "./table.js";
@@ -37,7 +38,19 @@ export { Tree, type TreeProps, type TreeNoSelectionProps, type TreeSingleSelecti
37
38
  export { Slider, type SliderProps } from "./slider.js";
38
39
  export { ProgressBar, type ProgressBarProps } from "./progress-bar.js";
39
40
  export { Spinner, type SpinnerProps } from "./spinner.js";
40
- export { Readiness, useReadiness, useRequirement, type ReadinessFallback, type ReadinessProps, type ReadinessRequirement, type ReadinessRequirementProps } from "./readiness.js";
41
+ export { NumberField, type NumberFieldProps } from "./number-field.js";
42
+ export { SegmentedControl, type SegmentedControlProps, type SegmentedControlItemProps } from "./segmented-control.js";
43
+ export { Alert, type AlertProps } from "./alert.js";
44
+ export { FileTrigger, type FileTriggerProps } from "./file-trigger.js";
45
+ export { DropZone, type DropZoneProps } from "./drop-zone.js";
46
+ export { Fieldset, type FieldsetProps } from "./fieldset.js";
47
+ export { AppLayout, type AppLayoutProps, type AppLayoutRegionProps } from "./app-layout.js";
48
+ export { ColorSwatch, type ColorSwatchProps } from "./color-swatch.js";
49
+ export { ColorSwatchPicker, type ColorSwatchPickerProps, type ColorSwatchPickerItemProps } from "./color-swatch-picker.js";
50
+ export { ColorSlider, type ColorSliderProps } from "./color-slider.js";
51
+ export { ColorArea, type ColorAreaProps } from "./color-area.js";
52
+ export { ColorField, type ColorFieldProps } from "./color-field.js";
53
+ export { ColorPicker, type ColorPickerRootProps, type ColorPickerTriggerProps, type ColorPickerContentProps } from "./color-picker.js";
41
54
  export { ScrollArea, type ScrollAreaAxis, type ScrollAreaProps } from "./scroll-area.js";
42
55
  export { Toolbar, type ToolbarProps, type ToolbarGroupProps, type ToolbarSeparatorProps } from "./toolbar.js";
43
56
  export { Disclosure, type DisclosureProps, type DisclosureTriggerProps, type DisclosureContentProps } from "./disclosure.js";
@@ -46,12 +59,10 @@ export { Popover, type PopoverProps, type PopoverTriggerProps, type PopoverConte
46
59
  export { Menu, type MenuProps, type MenuNoSelectionProps, type MenuSingleSelectionProps, type MenuMultipleSelectionProps, type MenuMultipleValue, type MenuItemProps, type MenuSectionProps, type MenuHeaderProps, type MenuSeparatorProps } from "./menu.js";
47
60
  export { DropdownMenu, type DropdownMenuProps, type DropdownMenuTriggerProps } from "./dropdown-menu.js";
48
61
  export { ContextMenu, type ContextMenuProps, type ContextMenuTriggerProps, type ContextMenuContentProps } from "./context-menu.js";
49
- export { Dialog, type DialogProps, type DialogTriggerProps, type DialogBackdropProps, type DialogContentProps, type DialogHeaderProps, type DialogTitleProps, type DialogDescriptionProps, type DialogBodyProps, type DialogFooterProps, type DialogCloseProps } from "./dialog.js";
62
+ export { Dialog, type DialogProps, type DialogTriggerProps, type DialogBackdropProps, type DialogBackdropVariant, type DialogContentProps, type DialogHeaderProps, type DialogTitleProps, type DialogDescriptionProps, type DialogBodyProps, type DialogFooterProps, type DialogCloseProps } from "./dialog.js";
50
63
  export { AlertDialog, type AlertDialogProps, type AlertDialogBackdropProps, type AlertDialogContentProps } from "./alert-dialog.js";
51
64
  export { Tooltip, type TooltipProps, type TooltipTriggerProps, type TooltipContentProps } from "./tooltip.js";
52
- export type { ControlColor } from "./control.js";
53
- export type { LayoutAlignment, LayoutGap, LayoutJustification } from "./layout.js";
54
- export { resolveRadius, type Radius, type RadiusProps } from "./radius.js";
55
- export { resolveSpacing, type Spacing } from "./spacing.js";
56
- export { useColor, useContrastingColor } from "./color.js";
57
- export { useScale, type NumericScale, type ScaleLevel } from "./scale.js";
65
+ export type { LayoutAlignment, LayoutGap, LayoutJustification } from "./foundation/layout.js";
66
+ export { resolveRadius, type Radius, type RadiusProps } from "./foundation/radius.js";
67
+ export { resolveSpacing, type Spacing } from "./foundation/spacing.js";
68
+ export { useScale, type NumericScale, type ScaleLevel } from "./foundation/scale.js";
package/dist/main.js CHANGED
@@ -4,12 +4,14 @@
4
4
  * Components enter this surface only after their implementation-independent
5
5
  * behavior contract has been established by the package's tests.
6
6
  */
7
- export { defaultAppearance } from "./appearance.js";
8
- export { UIProvider, useAppearance, useBrowserPreferences, useDirection, useDocumentDirection, usePreferences, useThemedValue } from "./ui-provider.js";
7
+ export { appearanceLimits, defaultAppearance } from "./foundation/appearance.js";
8
+ export { UIProvider } from "./foundation/provider.js";
9
+ export { useAppearance, useBrowserPreferences, usePreferences, useThemedValue } from "./foundation/visual.js";
10
+ export { useDirection, useDocumentDirection } from "./foundation/direction.js";
9
11
  export { Flex } from "./flex.js";
10
12
  export { Grid } from "./grid.js";
11
- export { Surface } from "./surface.js";
12
- export { defaultColor } from "./color.js";
13
+ export { Surface } from "./surface/surface.js";
14
+ export { resolveColor, useColor, useContrastingColor } from "./foundation/color.js";
13
15
  // Context-dependent parts are public only through their owning component family.
14
16
  export { Panel } from "./panel.js";
15
17
  export { Window } from "./window.js";
@@ -35,7 +37,19 @@ export { Tree } from "./tree.js";
35
37
  export { Slider } from "./slider.js";
36
38
  export { ProgressBar } from "./progress-bar.js";
37
39
  export { Spinner } from "./spinner.js";
38
- export { Readiness, useReadiness, useRequirement } from "./readiness.js";
40
+ export { NumberField } from "./number-field.js";
41
+ export { SegmentedControl } from "./segmented-control.js";
42
+ export { Alert } from "./alert.js";
43
+ export { FileTrigger } from "./file-trigger.js";
44
+ export { DropZone } from "./drop-zone.js";
45
+ export { Fieldset } from "./fieldset.js";
46
+ export { AppLayout } from "./app-layout.js";
47
+ export { ColorSwatch } from "./color-swatch.js";
48
+ export { ColorSwatchPicker } from "./color-swatch-picker.js";
49
+ export { ColorSlider } from "./color-slider.js";
50
+ export { ColorArea } from "./color-area.js";
51
+ export { ColorField } from "./color-field.js";
52
+ export { ColorPicker } from "./color-picker.js";
39
53
  export { ScrollArea } from "./scroll-area.js";
40
54
  export { Toolbar } from "./toolbar.js";
41
55
  export { Disclosure } from "./disclosure.js";
@@ -47,7 +61,6 @@ export { ContextMenu } from "./context-menu.js";
47
61
  export { Dialog } from "./dialog.js";
48
62
  export { AlertDialog } from "./alert-dialog.js";
49
63
  export { Tooltip } from "./tooltip.js";
50
- export { resolveRadius } from "./radius.js";
51
- export { resolveSpacing } from "./spacing.js";
52
- export { useColor, useContrastingColor } from "./color.js";
53
- export { useScale } from "./scale.js";
64
+ export { resolveRadius } from "./foundation/radius.js";
65
+ export { resolveSpacing } from "./foundation/spacing.js";
66
+ export { useScale } from "./foundation/scale.js";
package/dist/menu.d.ts CHANGED
@@ -1,51 +1,47 @@
1
1
  import type { CSSProperties, ReactElement, RefAttributes } from "react";
2
2
  import type { HeaderProps as AriaHeaderProps, MenuItemProps as AriaMenuItemProps, MenuProps as AriaMenuProps, MenuSectionProps as AriaMenuSectionProps, SeparatorProps as AriaSeparatorProps } from "react-aria-components";
3
- import { type ControlColor } from "./control.js";
4
- import type { ScaleLevel } from "./scale.js";
5
- import { type MultipleStringSelection, type MultipleStringSelectionProps, type SingleStringSelectionProps } from "./selection.js";
6
- type MenuRootBaseProps<T extends object> = Omit<AriaMenuProps<T>, "className" | "defaultSelectedKeys" | "disabledKeys" | "onAction" | "onSelectionChange" | "selectedKeys" | "selectionMode" | "style"> & Readonly<{
7
- readonly className?: string;
8
- readonly color?: ControlColor;
9
- readonly disabledValues?: readonly string[];
10
- readonly onItemAction?: (value: string) => void;
11
- readonly size?: ScaleLevel;
12
- readonly style?: CSSProperties;
13
- }>;
14
- export type MenuNoSelectionProps = Readonly<{
15
- selectionMode?: "none";
16
- value?: never;
17
- defaultValue?: never;
18
- onChange?: never;
19
- }>;
20
- export type MenuSingleSelectionProps = SingleStringSelectionProps & Readonly<{
21
- selectionMode: "single";
3
+ import { type MultipleSelectionProps, type MultipleStringSelection, type NoSelectionProps, type SingleSelectionProps } from "./control/selection.js";
4
+ import type { Color } from "./foundation/color.js";
5
+ import type { RadiusProps } from "./foundation/radius.js";
6
+ import type { ScaleLevel } from "./foundation/scale.js";
7
+ type MenuRootBaseProps<T extends object> = Omit<AriaMenuProps<T>, "className" | "defaultSelectedKeys" | "disabledKeys" | "onAction" | "onSelectionChange" | "selectedKeys" | "selectionMode" | "style" | "shouldFocusWrap" | "shouldCloseOnSelect"> & RadiusProps & Readonly<{
8
+ className?: string;
9
+ /** Whether activating an Item closes the menu. Defaults to `true`. */
10
+ closeOnSelect?: boolean;
11
+ /** Color laid beneath selected Items. */
12
+ color?: Color;
13
+ /** Whether arrow keys wrap from the last Item to the first. */
14
+ focusWrap?: boolean;
15
+ /** Runs with the value of the Item that was activated. */
16
+ onAction?: (value: string) => void;
17
+ size?: ScaleLevel;
18
+ style?: CSSProperties;
22
19
  }>;
20
+ export type MenuNoSelectionProps = NoSelectionProps;
21
+ export type MenuSingleSelectionProps = SingleSelectionProps;
23
22
  export type MenuMultipleValue = MultipleStringSelection;
24
- export type MenuMultipleSelectionProps = MultipleStringSelectionProps & Readonly<{
25
- selectionMode: "multiple";
26
- }>;
23
+ export type MenuMultipleSelectionProps = MultipleSelectionProps;
27
24
  export type MenuRootProps<T extends object = object> = MenuRootBaseProps<T> & (MenuNoSelectionProps | MenuSingleSelectionProps | MenuMultipleSelectionProps);
28
25
  export type MenuRootComponent = <T extends object = object>(properties: MenuRootProps<T> & RefAttributes<HTMLDivElement>) => ReactElement | null;
29
- export declare const MenuRoot: MenuRootComponent;
30
- export interface MenuItemProps<T = object> extends Omit<AriaMenuItemProps<T>, "className" | "id" | "isDisabled" | "style"> {
26
+ export interface MenuItemProps<T = object> extends Omit<AriaMenuItemProps<T>, "className" | "id" | "isDisabled" | "render" | "style" | "shouldCloseOnSelect"> {
27
+ /** Identity of this Item within its Menu. */
28
+ readonly id: string;
31
29
  readonly className?: string;
32
- readonly color?: ControlColor;
30
+ /** Whether activating this Item closes the menu, overriding the Menu. */
31
+ readonly closeOnSelect?: boolean;
32
+ /** Color laid beneath this Item when it is selected. */
33
+ readonly color?: Color;
33
34
  readonly disabled?: boolean;
34
- readonly id?: string;
35
35
  readonly style?: CSSProperties;
36
36
  }
37
37
  export type MenuItemComponent = <T = object>(properties: MenuItemProps<T> & RefAttributes<HTMLDivElement>) => ReactElement | null;
38
- export declare const MenuItem: MenuItemComponent;
39
- export type MenuSectionProps<T extends object = object> = AriaMenuSectionProps<T>;
40
- export declare const MenuSection: <T>(props: AriaMenuSectionProps<T> & React.RefAttributes<HTMLElement>) => ReactElement<unknown, string | React.JSXElementConstructor<any>> | null;
38
+ export type MenuSectionProps<T extends object = object> = Omit<AriaMenuSectionProps<T>, "defaultSelectedKeys" | "selectedKeys" | "onSelectionChange" | "selectionMode" | "disallowEmptySelection" | "shouldCloseOnSelect">;
41
39
  export type MenuHeaderProps = AriaHeaderProps;
42
- export declare const MenuHeader: import("react").ForwardRefExoticComponent<AriaHeaderProps & RefAttributes<HTMLElement>>;
43
40
  export type MenuSeparatorProps = AriaSeparatorProps;
44
- export declare const MenuSeparator: import("react").ForwardRefExoticComponent<AriaSeparatorProps & RefAttributes<HTMLElement>>;
45
41
  /** A keyboard-navigable collection of commands or selectable options. */
46
42
  export declare const Menu: MenuRootComponent & {
47
43
  Item: MenuItemComponent;
48
- Section: <T>(props: AriaMenuSectionProps<T> & React.RefAttributes<HTMLElement>) => ReactElement<unknown, string | React.JSXElementConstructor<any>> | null;
44
+ Section: <T extends object = object>(properties: MenuSectionProps<T>) => ReactElement | null;
49
45
  Header: import("react").ForwardRefExoticComponent<AriaHeaderProps & RefAttributes<HTMLElement>>;
50
46
  Separator: import("react").ForwardRefExoticComponent<AriaSeparatorProps & RefAttributes<HTMLElement>>;
51
47
  };