@phreshos/react-ui 0.1.36 → 0.1.38

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 (202) 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.d.ts +2 -2
  5. package/dist/alert-dialog.js +3 -1
  6. package/dist/alert.d.ts +17 -0
  7. package/dist/alert.js +30 -0
  8. package/dist/app-layout.d.ts +13 -0
  9. package/dist/app-layout.js +84 -0
  10. package/dist/button.d.ts +31 -27
  11. package/dist/button.js +48 -40
  12. package/dist/calendar-layout.d.ts +9 -5
  13. package/dist/calendar-layout.js +67 -78
  14. package/dist/calendar-trigger.d.ts +4 -4
  15. package/dist/calendar-trigger.js +7 -29
  16. package/dist/calendar.d.ts +2 -2
  17. package/dist/calendar.js +6 -5
  18. package/dist/checkbox.d.ts +4 -4
  19. package/dist/checkbox.js +16 -6
  20. package/dist/color-area.d.ts +20 -0
  21. package/dist/color-area.js +30 -0
  22. package/dist/color-field.d.ts +17 -0
  23. package/dist/color-field.js +17 -0
  24. package/dist/color-picker.d.ts +24 -0
  25. package/dist/color-picker.js +30 -0
  26. package/dist/color-slider.d.ts +19 -0
  27. package/dist/color-slider.js +29 -0
  28. package/dist/color-swatch-picker.d.ts +23 -0
  29. package/dist/color-swatch-picker.js +36 -0
  30. package/dist/color-swatch.d.ts +18 -0
  31. package/dist/color-swatch.js +20 -0
  32. package/dist/combo-box.d.ts +18 -10
  33. package/dist/combo-box.js +43 -58
  34. package/dist/context-menu.d.ts +14 -10
  35. package/dist/context-menu.js +7 -6
  36. package/dist/control/color-thumb.d.ts +13 -0
  37. package/dist/control/color-thumb.js +33 -0
  38. package/dist/control/color-value.d.ts +6 -0
  39. package/dist/control/color-value.js +7 -0
  40. package/dist/control/control.d.ts +60 -0
  41. package/dist/control/control.js +71 -0
  42. package/dist/control/field-button.d.ts +13 -0
  43. package/dist/control/field-button.js +28 -0
  44. package/dist/control/field.d.ts +20 -0
  45. package/dist/control/field.js +34 -0
  46. package/dist/control/icon.d.ts +11 -0
  47. package/dist/control/icon.js +8 -0
  48. package/dist/control/item.d.ts +37 -0
  49. package/dist/control/item.js +57 -0
  50. package/dist/control/open-state.d.ts +25 -0
  51. package/dist/control/open-state.js +8 -0
  52. package/dist/control/selection-track.d.ts +39 -0
  53. package/dist/control/selection-track.js +122 -0
  54. package/dist/control/selection.d.ts +44 -0
  55. package/dist/{selection.js → control/selection.js} +16 -0
  56. package/dist/control/surface-render.d.ts +10 -0
  57. package/dist/control/surface-render.js +12 -0
  58. package/dist/control/text-control.d.ts +32 -0
  59. package/dist/control/text-control.js +31 -0
  60. package/dist/control/toggle.d.ts +32 -0
  61. package/dist/control/toggle.js +80 -0
  62. package/dist/date-control.d.ts +9 -9
  63. package/dist/date-control.js +31 -34
  64. package/dist/date-field.d.ts +7 -6
  65. package/dist/date-field.js +8 -6
  66. package/dist/date-picker.d.ts +13 -6
  67. package/dist/date-picker.js +9 -6
  68. package/dist/date-range-picker.d.ts +15 -6
  69. package/dist/date-range-picker.js +12 -9
  70. package/dist/dialog.d.ts +29 -15
  71. package/dist/dialog.js +37 -28
  72. package/dist/disclosure.d.ts +8 -7
  73. package/dist/disclosure.js +31 -52
  74. package/dist/drop-zone.d.ts +18 -0
  75. package/dist/drop-zone.js +32 -0
  76. package/dist/dropdown-menu.d.ts +11 -8
  77. package/dist/dropdown-menu.js +5 -4
  78. package/dist/fieldset.d.ts +13 -0
  79. package/dist/fieldset.js +26 -0
  80. package/dist/file-trigger.d.ts +13 -0
  81. package/dist/file-trigger.js +6 -0
  82. package/dist/flex.d.ts +1 -1
  83. package/dist/flex.js +5 -4
  84. package/dist/foundation/appearance.d.ts +83 -0
  85. package/dist/foundation/appearance.js +38 -0
  86. package/dist/{aria-direction.js → foundation/aria-direction.js} +3 -1
  87. package/dist/foundation/color.d.ts +61 -0
  88. package/dist/foundation/color.js +247 -0
  89. package/dist/{layout.d.ts → foundation/layout.d.ts} +6 -4
  90. package/dist/{layout.js → foundation/layout.js} +7 -5
  91. package/dist/foundation/motion-style.d.ts +9 -0
  92. package/dist/foundation/motion-style.js +50 -0
  93. package/dist/foundation/preferences.d.ts +15 -0
  94. package/dist/{ui-provider.d.ts → foundation/provider.d.ts} +9 -5
  95. package/dist/{ui-provider.js → foundation/provider.js} +18 -27
  96. package/dist/{radius.d.ts → foundation/radius.d.ts} +6 -3
  97. package/dist/foundation/radius.js +11 -0
  98. package/dist/foundation/spacing.d.ts +11 -0
  99. package/dist/foundation/spacing.js +4 -0
  100. package/dist/foundation/visual.d.ts +42 -0
  101. package/dist/{appearance-context.js → foundation/visual.js} +41 -27
  102. package/dist/grid.d.ts +1 -1
  103. package/dist/grid.js +5 -4
  104. package/dist/icons/main.d.ts +5 -3
  105. package/dist/icons/main.js +5 -3
  106. package/dist/input.d.ts +2 -2
  107. package/dist/input.js +9 -7
  108. package/dist/list-box.d.ts +24 -19
  109. package/dist/list-box.js +52 -109
  110. package/dist/main.d.ts +28 -17
  111. package/dist/main.js +22 -9
  112. package/dist/menu.d.ts +28 -32
  113. package/dist/menu.js +47 -93
  114. package/dist/number-field.d.ts +17 -0
  115. package/dist/number-field.js +28 -0
  116. package/dist/panel.d.ts +10 -5
  117. package/dist/panel.js +33 -12
  118. package/dist/popover.d.ts +26 -12
  119. package/dist/popover.js +22 -15
  120. package/dist/progress-bar.d.ts +8 -10
  121. package/dist/progress-bar.js +18 -34
  122. package/dist/radio.d.ts +15 -12
  123. package/dist/radio.js +27 -37
  124. package/dist/range-calendar.d.ts +5 -3
  125. package/dist/range-calendar.js +8 -7
  126. package/dist/scroll-area.d.ts +2 -2
  127. package/dist/scroll-area.js +10 -9
  128. package/dist/segmented-control.d.ts +23 -0
  129. package/dist/segmented-control.js +38 -0
  130. package/dist/select.d.ts +40 -13
  131. package/dist/select.js +63 -18
  132. package/dist/slider.d.ts +7 -3
  133. package/dist/slider.js +51 -50
  134. package/dist/spinner.d.ts +5 -8
  135. package/dist/spinner.js +12 -27
  136. package/dist/surface/grain.d.ts +12 -0
  137. package/dist/surface/grain.js +65 -0
  138. package/dist/{material-options.d.ts → surface/material-options.d.ts} +1 -2
  139. package/dist/{material-options.js → surface/material-options.js} +2 -2
  140. package/dist/surface/paint-class.d.ts +13 -0
  141. package/dist/surface/paint-class.js +47 -0
  142. package/dist/{shadow-options.d.ts → surface/shadow-options.d.ts} +13 -1
  143. package/dist/{shadow-options.js → surface/shadow-options.js} +17 -2
  144. package/dist/surface/surface.d.ts +80 -0
  145. package/dist/surface/surface.js +239 -0
  146. package/dist/switch.d.ts +4 -5
  147. package/dist/switch.js +17 -8
  148. package/dist/table.d.ts +29 -32
  149. package/dist/table.js +68 -106
  150. package/dist/tabs.d.ts +16 -15
  151. package/dist/tabs.js +44 -86
  152. package/dist/textarea.d.ts +2 -2
  153. package/dist/textarea.js +10 -14
  154. package/dist/time-field.d.ts +6 -6
  155. package/dist/time-field.js +8 -6
  156. package/dist/toolbar.d.ts +6 -4
  157. package/dist/toolbar.js +16 -15
  158. package/dist/tooltip.d.ts +17 -8
  159. package/dist/tooltip.js +17 -15
  160. package/dist/tree.d.ts +22 -27
  161. package/dist/tree.js +54 -99
  162. package/dist/window.d.ts +4 -4
  163. package/dist/window.js +18 -20
  164. package/package.json +3 -3
  165. package/dist/appearance-context.d.ts +0 -54
  166. package/dist/appearance.d.ts +0 -11
  167. package/dist/appearance.js +0 -11
  168. package/dist/color.d.ts +0 -69
  169. package/dist/color.js +0 -192
  170. package/dist/control-surface.d.ts +0 -20
  171. package/dist/control-surface.js +0 -11
  172. package/dist/control.d.ts +0 -70
  173. package/dist/control.js +0 -105
  174. package/dist/field-style.d.ts +0 -3
  175. package/dist/field-style.js +0 -12
  176. package/dist/material-paint.d.ts +0 -13
  177. package/dist/material-paint.js +0 -119
  178. package/dist/motion-style.d.ts +0 -13
  179. package/dist/motion-style.js +0 -75
  180. package/dist/preferences.d.ts +0 -12
  181. package/dist/radius.js +0 -11
  182. package/dist/readiness.d.ts +0 -37
  183. package/dist/readiness.js +0 -134
  184. package/dist/selection.d.ts +0 -18
  185. package/dist/spacing.d.ts +0 -8
  186. package/dist/spacing.js +0 -8
  187. package/dist/surface-edge.d.ts +0 -11
  188. package/dist/surface-edge.js +0 -55
  189. package/dist/surface.d.ts +0 -27
  190. package/dist/surface.js +0 -92
  191. package/dist/text-control.d.ts +0 -10
  192. package/dist/text-control.js +0 -0
  193. package/dist/toggle-indicator.d.ts +0 -18
  194. package/dist/toggle-indicator.js +0 -49
  195. /package/dist/{aria-direction.d.ts → foundation/aria-direction.d.ts} +0 -0
  196. /package/dist/{direction.d.ts → foundation/direction.d.ts} +0 -0
  197. /package/dist/{direction.js → foundation/direction.js} +0 -0
  198. /package/dist/{overlay-placement.d.ts → foundation/overlay-placement.d.ts} +0 -0
  199. /package/dist/{overlay-placement.js → foundation/overlay-placement.js} +0 -0
  200. /package/dist/{preferences.js → foundation/preferences.js} +0 -0
  201. /package/dist/{scale.d.ts → foundation/scale.d.ts} +0 -0
  202. /package/dist/{scale.js → foundation/scale.js} +0 -0
package/dist/tabs.d.ts CHANGED
@@ -1,11 +1,13 @@
1
1
  import type { CSSProperties, ReactElement, RefAttributes } from "react";
2
2
  import type { TabListProps as AriaTabListProps, TabPanelProps as AriaTabPanelProps, TabPanelsProps as AriaTabPanelsProps, TabProps as AriaTabProps, TabsProps as AriaTabsProps } 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
- export interface TabsRootProps extends Omit<AriaTabsProps, "className" | "defaultSelectedKey" | "isDisabled" | "onSelectionChange" | "selectedKey" | "style">, RadiusProps {
3
+ import { type Color } from "./foundation/color.js";
4
+ import type { RadiusProps } from "./foundation/radius.js";
5
+ import type { ScaleLevel } from "./foundation/scale.js";
6
+ import type { MaterialOverrides } from "./surface/material-options.js";
7
+ export interface TabsRootProps extends Omit<AriaTabsProps, "className" | "defaultSelectedKey" | "disabledKeys" | "isDisabled" | "onSelectionChange" | "selectedKey" | "style">, RadiusProps, MaterialOverrides {
7
8
  readonly className?: string;
8
- readonly color?: ControlColor;
9
+ /** Paint of the raised selection. */
10
+ readonly color?: Color;
9
11
  readonly defaultValue?: string;
10
12
  readonly disabled?: boolean;
11
13
  readonly onChange?: (value: string) => void;
@@ -13,29 +15,28 @@ export interface TabsRootProps extends Omit<AriaTabsProps, "className" | "defaul
13
15
  readonly style?: CSSProperties;
14
16
  readonly value?: string;
15
17
  }
16
- export declare const TabsRoot: import("react").ForwardRefExoticComponent<TabsRootProps & RefAttributes<HTMLDivElement>>;
17
18
  export interface TabsListProps<T extends object = object> extends Omit<AriaTabListProps<T>, "className" | "style"> {
18
19
  readonly className?: string;
19
20
  readonly style?: CSSProperties;
20
21
  }
21
22
  export type TabsListComponent = <T extends object = object>(properties: TabsListProps<T> & RefAttributes<HTMLDivElement>) => ReactElement | null;
22
- export declare const TabsList: TabsListComponent;
23
- export interface TabsTabProps extends Omit<AriaTabProps, "className" | "id" | "isDisabled" | "style"> {
23
+ export interface TabsTabProps extends Omit<AriaTabProps, "className" | "id" | "isDisabled" | "render" | "style"> {
24
+ /** Identity shared with the corresponding Panel. */
25
+ readonly id: string;
24
26
  readonly className?: string;
25
27
  readonly disabled?: boolean;
26
- readonly id: string;
27
28
  readonly style?: CSSProperties;
28
29
  }
29
- export declare const TabsTab: import("react").ForwardRefExoticComponent<TabsTabProps & RefAttributes<HTMLDivElement>>;
30
30
  export type TabsPanelsProps<T extends object = object> = AriaTabPanelsProps<T>;
31
- export declare const TabsPanels: <T>(props: AriaTabPanelsProps<T> & React.RefAttributes<HTMLDivElement>) => React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | null;
32
- export interface TabsPanelProps extends Omit<AriaTabPanelProps, "className" | "id" | "style"> {
33
- readonly className?: string;
31
+ export interface TabsPanelProps extends Omit<AriaTabPanelProps, "className" | "id" | "style" | "shouldForceMount"> {
32
+ /** Identity shared with the corresponding Tab. */
34
33
  readonly id: string;
34
+ readonly className?: string;
35
+ /** Whether the Panel stays mounted while another Tab is selected. */
36
+ readonly forceMount?: boolean;
35
37
  readonly style?: CSSProperties;
36
38
  }
37
- export declare const TabsPanel: import("react").ForwardRefExoticComponent<TabsPanelProps & RefAttributes<HTMLDivElement>>;
38
- /** Peer views with one selected tab and one corresponding panel. */
39
+ /** Peer views with one selected Tab and one corresponding Panel. */
39
40
  export declare const Tabs: import("react").ForwardRefExoticComponent<TabsRootProps & RefAttributes<HTMLDivElement>> & {
40
41
  List: TabsListComponent;
41
42
  Tab: import("react").ForwardRefExoticComponent<TabsTabProps & RefAttributes<HTMLDivElement>>;
package/dist/tabs.js CHANGED
@@ -1,103 +1,61 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { createContext, forwardRef, useContext, useId, useMemo } from "react";
3
- import { Tab as AriaTab, TabList as AriaTabList, TabPanel as AriaTabPanel, TabPanels as AriaTabPanels, Tabs as AriaTabs } from "react-aria-components";
4
- import { LayoutGroup, motion } from "motion/react";
5
- import { AriaDirectionBoundary } from "./aria-direction.js";
6
- import { controlOpacity, useControlTheme } from "./control.js";
7
- import { resolveDirection, useDirection } from "./direction.js";
8
- import { stringKey } from "./selection.js";
9
- import { Surface } from "./surface.js";
10
- const TabsThemeContext = createContext(null);
11
- export const TabsRoot = forwardRef(function TabsRoot({ className, color, defaultValue, disabled = false, onChange, orientation = "horizontal", radius = "medium", size = "medium", style, value, ...properties }, ref) {
12
- const theme = useControlTheme({ color, radius, size });
13
- const context = useMemo(() => ({ orientation, theme }), [orientation, theme]);
14
- const layoutGroup = useId();
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { createContext, forwardRef, useContext, useMemo } from "react";
3
+ import { Tab as AriaTab, TabList as AriaTabList, TabPanel as AriaTabPanel, TabPanels as AriaTabPanels, Tabs as AriaTabs, TabListStateContext } from "react-aria-components";
4
+ import { useControlMetrics } from "./control/control.js";
5
+ import { SelectionItemLabel, selectionItemStyle, selectionListStyle, SelectionTrack } from "./control/selection-track.js";
6
+ import { stringKey } from "./control/selection.js";
7
+ import { AriaDirectionBoundary } from "./foundation/aria-direction.js";
8
+ import { colorOpacity } from "./foundation/color.js";
9
+ import { resolveDirection, useDirection } from "./foundation/direction.js";
10
+ import { dimmedClass } from "./surface/surface.js";
11
+ const TabsStyleContext = createContext(null);
12
+ /** Peer views with one selected Tab and its corresponding Panel. */
13
+ const TabsRoot = forwardRef(function Tabs({ className, color = "default", defaultValue, disabled = false, onChange, orientation = "horizontal", material, radius, size, style, value, ...properties }, ref) {
14
+ const metrics = useControlMetrics(size, radius);
15
+ const context = useMemo(() => ({ color, material, metrics, orientation }), [color, material, metrics, orientation]);
15
16
  const direction = resolveDirection(properties.dir, useDirection());
16
- return _jsx(TabsThemeContext.Provider, { value: context, children: _jsx(LayoutGroup, { id: layoutGroup, children: _jsx(AriaDirectionBoundary, { direction: direction, children: _jsx(AriaTabs, { ...properties, ...(value !== undefined ? { selectedKey: value } : {}), ...(defaultValue !== undefined ? { defaultSelectedKey: defaultValue } : {}), ref: ref, dir: direction, className: className, isDisabled: disabled, orientation: orientation, onSelectionChange: key => onChange?.(stringKey(key)), style: {
17
- display: "flex",
18
- flexDirection: orientation === "horizontal" ? "column" : "row",
19
- alignItems: "stretch",
20
- gap: theme.gap,
21
- minWidth: 0,
22
- fontFamily: "inherit",
23
- fontSize: theme.fontSize,
24
- ...style
25
- } }) }) }) });
17
+ return _jsx(TabsStyleContext.Provider, { value: context, children: _jsx(AriaDirectionBoundary, { direction: direction, children: _jsx(AriaTabs, { ...properties, ...(value !== undefined ? { selectedKey: value } : {}), ...(defaultValue !== undefined ? { defaultSelectedKey: defaultValue } : {}), ref: ref, dir: direction, className: className, isDisabled: disabled, orientation: orientation, onSelectionChange: key => onChange?.(stringKey(key)), style: {
18
+ display: "flex",
19
+ flexDirection: orientation === "horizontal" ? "column" : "row",
20
+ alignItems: "stretch",
21
+ gap: metrics.gap,
22
+ minWidth: 0,
23
+ fontFamily: "inherit",
24
+ fontSize: metrics.fontSize,
25
+ ...style
26
+ } }) }) });
26
27
  });
28
+ /** The Tabs sit in a SelectionTrack; the selection slides to the selected Tab. */
27
29
  const TabsListImplementation = forwardRef(function TabsList({ className, style, ...properties }, ref) {
28
- const { orientation, theme } = useTabsTheme();
29
- return _jsx(AriaTabList, { ...properties, ref: ref, className: className, style: {
30
- display: "grid",
31
- gridAutoFlow: orientation === "horizontal" ? "column" : "row",
32
- gridAutoColumns: orientation === "horizontal" ? "minmax(0, 1fr)" : undefined,
33
- alignContent: "start",
34
- alignItems: "stretch",
35
- gap: Math.max(2, theme.gap / 2),
36
- minWidth: 0,
37
- width: orientation === "horizontal" ? "100%" : undefined,
38
- boxSizing: "border-box",
39
- padding: Math.max(2, theme.gap / 2),
40
- borderRadius: theme.radius,
41
- background: theme.paints.palette.rest.background,
42
- ...style
43
- } });
30
+ const { color, material, metrics, orientation } = useTabsStyle();
31
+ const selectedKey = useContext(TabListStateContext)?.selectedKey;
32
+ return _jsx(SelectionTrack, { metrics: metrics, color: color, material: material, orientation: orientation, selectedKey: selectedKey, className: className, style: style, children: _jsx(AriaTabList, { ...properties, ref: ref, "data-selection-list": "", style: selectionListStyle(orientation) }) });
44
33
  });
45
- export const TabsList = TabsListImplementation;
46
- export const TabsTab = forwardRef(function TabsTab({ children, className, disabled = false, style, ...properties }, ref) {
47
- const { orientation, theme } = useTabsTheme();
48
- return _jsx(AriaTab, { ...properties, ref: ref, className: className, isDisabled: disabled, style: state => ({
49
- ...theme.transition,
50
- position: "relative",
51
- zIndex: 0,
52
- display: "flex",
53
- alignItems: "center",
54
- justifyContent: "center",
55
- width: "100%",
56
- minWidth: 0,
57
- minHeight: theme.height,
58
- paddingBlock: 0,
59
- paddingInline: Math.max(8, theme.spacing),
60
- boxSizing: "border-box",
61
- borderRadius: theme.radius,
62
- outline: state.isFocusVisible ? `1px solid ${theme.focusColor}` : "none",
63
- outlineOffset: 1,
64
- cursor: disabled ? "not-allowed" : "pointer",
65
- opacity: disabled ? controlOpacity.disabled : 1,
66
- userSelect: "none",
67
- background: "transparent",
68
- color: theme.paints.palette.rest.color,
69
- ...(orientation === "vertical" ? { justifyContent: "start" } : {}),
70
- ...style
71
- }), children: state => _jsxs(_Fragment, { children: [state.isSelected && _jsx(Surface, { as: motion.span, "data-tabs-indicator": "", "aria-hidden": "true", initial: false, layoutId: "selection", color: theme.paints.palette.hover.background, transition: theme.motionTransition, style: {
72
- position: "absolute",
73
- zIndex: -1,
74
- inset: 0,
75
- boxSizing: "border-box",
76
- borderRadius: theme.radius,
77
- pointerEvents: "none"
78
- } }), _jsx("span", { style: { minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: typeof children === "function" ? children(state) : children })] }) });
34
+ const TabsTab = forwardRef(function TabsTab({ children, className, disabled = false, style, ...properties }, ref) {
35
+ const { color, metrics, orientation } = useTabsStyle();
36
+ return _jsx(AriaTab, { ...properties, ref: ref, className: state => dimmedClass(state.isDisabled, className ?? state.defaultClassName) ?? "", isDisabled: disabled, style: state => ({ ...selectionItemStyle(metrics, color, orientation, state), ...style }), children: state => _jsx(SelectionItemLabel, { metrics: metrics, emphasized: state.isSelected || state.isHovered, children: typeof children === "function" ? children(state) : children }) });
79
37
  });
80
- export const TabsPanels = AriaTabPanels;
81
- export const TabsPanel = forwardRef(function TabsPanel({ className, style, ...properties }, ref) {
82
- const { orientation, theme } = useTabsTheme();
83
- return _jsx(AriaTabPanel, { ...properties, ref: ref, className: className, style: state => ({
38
+ const TabsPanel = forwardRef(function TabsPanel({ className, forceMount, style, ...properties }, ref) {
39
+ const { metrics, orientation } = useTabsStyle();
40
+ return _jsx(AriaTabPanel, { ...properties, shouldForceMount: forceMount, ref: ref, className: className, style: state => ({
84
41
  flex: orientation === "vertical" ? "1 1 auto" : undefined,
85
42
  minWidth: 0,
86
- outline: state.isFocusVisible ? `1px solid ${theme.focusColor}` : "none",
43
+ borderRadius: metrics.radius,
44
+ outline: `3px solid ${state.isFocusVisible ? colorOpacity(metrics.visual.colors.primary, 0.34) : "transparent"}`,
87
45
  outlineOffset: 1,
88
46
  ...style
89
47
  }) });
90
48
  });
91
- function useTabsTheme() {
92
- const value = useContext(TabsThemeContext);
93
- if (value == null)
49
+ function useTabsStyle() {
50
+ const context = useContext(TabsStyleContext);
51
+ if (context == null)
94
52
  throw new Error("Tabs parts must be used inside Tabs");
95
- return value;
53
+ return context;
96
54
  }
97
- /** Peer views with one selected tab and one corresponding panel. */
55
+ /** Peer views with one selected Tab and one corresponding Panel. */
98
56
  export const Tabs = Object.assign(TabsRoot, {
99
- List: TabsList,
57
+ List: TabsListImplementation,
100
58
  Tab: TabsTab,
101
- Panels: TabsPanels,
59
+ Panels: AriaTabPanels,
102
60
  Panel: TabsPanel
103
61
  });
@@ -1,6 +1,6 @@
1
- import type { TextControlProps } from "./text-control.js";
1
+ import { type TextControlProps } from "./control/text-control.js";
2
2
  export interface TextareaProps extends Omit<TextControlProps, "type" | "pattern"> {
3
3
  readonly rows?: number;
4
4
  }
5
- /** A labeled multiline text control, vertically resizable without escaping its width. */
5
+ /** A labeled multiline text field, vertically resizable without escaping its width. */
6
6
  export declare const Textarea: import("react").ForwardRefExoticComponent<TextareaProps & import("react").RefAttributes<HTMLTextAreaElement>>;
package/dist/textarea.js CHANGED
@@ -1,17 +1,13 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { forwardRef } from "react";
3
- import { TextArea as AriaTextarea, 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 multiline text control, vertically resizable without escaping its width. */
8
- export const Textarea = forwardRef(function Textarea({ label, description, errorMessage, disabled, readOnly, required, invalid, size, color, radius, style, className, placeholder, rows = 4, 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(AriaTextarea, { ref: ref, placeholder: placeholder, rows: rows, 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("textarea", { ...native, style: { ...native.style, borderRadius: "inherit", background: "transparent" } }) }), style: state => ({
11
- ...controlStyle(theme, state.isFocused, state.isInvalid, state.isHovered, state.isFocusVisible),
12
- height: "auto",
13
- minHeight: theme.height,
14
- paddingBlock: Math.max(6, theme.spacing / 2),
15
- resize: "vertical"
16
- }) }), _jsx(FieldFeedback, { theme: theme, description: description, errorMessage: errorMessage })] });
3
+ import { TextArea as AriaTextArea, TextField } from "react-aria-components";
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 multiline text field, vertically resizable without escaping its width. */
10
+ export const Textarea = forwardRef(function Textarea({ label, description, errorMessage, disabled, readOnly, required, invalid, size, color = "background", radius, style, className, placeholder, rows = 4, 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(AriaTextArea, { ref: ref, placeholder: placeholder, rows: rows, className: textControlClass, render: (native, state) => _jsx(TextWell, { color: color, material: material, metrics: metrics, state: state, children: _jsx("textarea", { ...native }) }), style: nativeTextStyle(metrics, true) }), _jsx(FieldFeedback, { metrics: metrics, description: description, errorMessage: errorMessage })] });
17
13
  });
@@ -1,11 +1,10 @@
1
1
  import type { Time } from "@internationalized/date";
2
2
  import type { TimeFieldProps as AriaTimeFieldProps } from "react-aria-components";
3
- import type { ControlOverrides, ControlProps, FieldProps } from "./control.js";
4
- import type { MaterialOverrides } from "./material-options.js";
5
- import type { RadiusProps } from "./radius.js";
6
- import type { ShadowOverrides } from "./shadow-options.js";
3
+ import { type ControlOverrides, type ControlProps, type FieldProps } from "./control/control.js";
4
+ import type { MaterialOverrides } from "./surface/material-options.js";
5
+ import type { RadiusProps } from "./foundation/radius.js";
7
6
  type TimeFieldOverrides = ControlOverrides | "isReadOnly" | "value" | "defaultValue" | "onChange" | "minValue" | "maxValue" | "placeholderValue" | "granularity" | "hourCycle" | "hideTimeZone" | "shouldForceLeadingZeros";
8
- export interface TimeFieldProps extends Omit<AriaTimeFieldProps<Time>, TimeFieldOverrides>, ControlProps, FieldProps, RadiusProps, MaterialOverrides, ShadowOverrides {
7
+ export interface TimeFieldProps extends Omit<AriaTimeFieldProps<Time>, TimeFieldOverrides>, ControlProps, FieldProps, RadiusProps, MaterialOverrides {
9
8
  readonly value?: Time | null;
10
9
  readonly defaultValue?: Time | null;
11
10
  readonly onChange?: (value: Time | null) => void;
@@ -14,7 +13,8 @@ export interface TimeFieldProps extends Omit<AriaTimeFieldProps<Time>, TimeField
14
13
  readonly placeholderValue?: Time;
15
14
  readonly granularity?: "hour" | "minute" | "second";
16
15
  readonly hourCycle?: 12 | 24;
17
- readonly shouldForceLeadingZeros?: boolean;
16
+ /** Whether hours, days, and months always show two digits. */
17
+ readonly leadingZeros?: boolean;
18
18
  readonly readOnly?: boolean;
19
19
  }
20
20
  /** A locale-aware time-only field whose visible clock units are independent editable segments. */
@@ -1,13 +1,15 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { forwardRef } from "react";
3
3
  import { TimeField as AriaTimeField } from "react-aria-components";
4
- import { AriaDirectionBoundary } from "./aria-direction.js";
5
- import { FieldFeedback, FieldLabel, fieldStyle, useControlTheme } from "./control.js";
4
+ import { AriaDirectionBoundary } from "./foundation/aria-direction.js";
5
+ import { useControlMetrics } from "./control/control.js";
6
+ import { FieldFeedback, FieldLabel, fieldStyle } from "./control/field.js";
6
7
  import { DateControl } from "./date-control.js";
7
- import { resolveDirection, useDirection } from "./direction.js";
8
+ import { resolveDirection, useDirection } from "./foundation/direction.js";
9
+ import { dimmedClass } from "./surface/surface.js";
8
10
  /** A locale-aware time-only field whose visible clock units are independent editable segments. */
9
- export const TimeField = forwardRef(function TimeField({ label, description, errorMessage, disabled, readOnly, required, invalid, size, color, radius, material, shadow, style, className, ...properties }, ref) {
10
- const theme = useControlTheme({ size, color, radius });
11
+ export const TimeField = forwardRef(function TimeField({ label, description, errorMessage, disabled, readOnly, required, invalid, size, color, radius, material, style, className, leadingZeros, ...properties }, ref) {
12
+ const metrics = useControlMetrics(size, radius);
11
13
  const direction = resolveDirection(properties.dir, useDirection());
12
- return _jsx(AriaDirectionBoundary, { direction: direction, children: _jsx(AriaTimeField, { ...properties, ref: ref, dir: direction, className: className, isDisabled: disabled, isReadOnly: readOnly, isRequired: required, isInvalid: invalid, style: fieldStyle(theme, disabled, style), children: state => _jsxs(_Fragment, { children: [_jsx(FieldLabel, { label: label }), _jsx(DateControl, { disabled: state.isDisabled, invalid: state.isInvalid, material: material, shadow: shadow, theme: theme }), _jsx(FieldFeedback, { theme: theme, description: description, errorMessage: errorMessage })] }) }) });
14
+ return _jsx(AriaDirectionBoundary, { direction: direction, children: _jsx(AriaTimeField, { ...properties, ref: ref, dir: direction, className: dimmedClass(disabled ?? false, className), isDisabled: disabled, isReadOnly: readOnly, shouldForceLeadingZeros: leadingZeros, isRequired: required, isInvalid: invalid, style: fieldStyle(metrics, style), children: state => _jsxs(_Fragment, { children: [_jsx(FieldLabel, { label: label }), _jsx(DateControl, { disabled: state.isDisabled, invalid: state.isInvalid, material: material, color: color ?? "background", metrics: metrics }), _jsx(FieldFeedback, { metrics: metrics, description: description, errorMessage: errorMessage })] }) }) });
13
15
  });
package/dist/toolbar.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  import type { ComponentPropsWithoutRef, CSSProperties, ReactElement } from "react";
2
2
  import type { GroupProps as AriaGroupProps, SeparatorProps as AriaSeparatorProps } from "react-aria-components";
3
- import { type ControlColor } from "./control.js";
4
- import { type LayoutGap } from "./layout.js";
3
+ import { type Color } from "./foundation/color.js";
4
+ import type { LayoutGap } from "./foundation/layout.js";
5
5
  type ToolbarOrientation = "horizontal" | "vertical";
6
6
  export interface ToolbarRootProps extends Omit<ComponentPropsWithoutRef<"div">, "className" | "color" | "role" | "style"> {
7
7
  /** Base color inherited by toolbar-owned text and separators. */
8
- readonly color?: ControlColor;
8
+ readonly color?: Color;
9
9
  /** Space between the Toolbar's direct children. */
10
10
  readonly gap?: LayoutGap;
11
11
  /** Axis used both for layout and arrow-key navigation. */
@@ -17,7 +17,9 @@ export interface ToolbarRootProps extends Omit<ComponentPropsWithoutRef<"div">,
17
17
  }
18
18
  /** A labelled group of controls with orientation-aware arrow-key navigation. */
19
19
  export declare const ToolbarRoot: import("react").ForwardRefExoticComponent<ToolbarRootProps & import("react").RefAttributes<HTMLDivElement>>;
20
- export interface ToolbarGroupProps extends Omit<AriaGroupProps, "className" | "style"> {
20
+ export interface ToolbarGroupProps extends Omit<AriaGroupProps, "className" | "style" | "isDisabled" | "isInvalid" | "isReadOnly"> {
21
+ /** Whether every control in this group is disabled. */
22
+ readonly disabled?: boolean;
21
23
  /** Space between the controls in this group. */
22
24
  readonly gap?: LayoutGap;
23
25
  /** Native class name applied without replacing the group contract. */
package/dist/toolbar.js CHANGED
@@ -2,18 +2,18 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { createContext, forwardRef, useContext, useMemo, useRef } from "react";
3
3
  import { FocusScope, mergeProps, mergeRefs, useFocusManager, useToolbar } from "react-aria";
4
4
  import { Group as AriaGroup, Separator as AriaSeparator } from "react-aria-components";
5
- import { useResolvedAppearance } from "./appearance-context.js";
6
- import { colorOpacity, resolveColor } from "./color.js";
7
- import { controlOpacity } from "./control.js";
8
- import { resolveDirection, useDirection } from "./direction.js";
9
- import { resolveGap } from "./layout.js";
5
+ import { separatorOpacity } from "./control/field.js";
6
+ import { colorOpacity, resolveColor } from "./foundation/color.js";
7
+ import { resolveDirection, useDirection } from "./foundation/direction.js";
8
+ import { resolveSpacing } from "./foundation/spacing.js";
9
+ import { useVisual } from "./foundation/visual.js";
10
10
  const ToolbarThemeContext = createContext(null);
11
11
  /** A labelled group of controls with orientation-aware arrow-key navigation. */
12
12
  export const ToolbarRoot = forwardRef(function ToolbarRoot(properties, ref) {
13
13
  return _jsx(FocusScope, { children: _jsx(ToolbarLayout, { ...properties, ref: ref }) });
14
14
  });
15
15
  const ToolbarLayout = forwardRef(function ToolbarLayout({ className, color, gap = "medium", orientation = "horizontal", style, ...properties }, ref) {
16
- const { appearance, colors } = useResolvedAppearance();
16
+ const { spacing, colors } = useVisual();
17
17
  const fallbackDirection = useDirection();
18
18
  const direction = resolveDirection(properties.dir, fallbackDirection);
19
19
  const localRef = useRef(null);
@@ -24,13 +24,14 @@ const ToolbarLayout = forwardRef(function ToolbarLayout({ className, color, gap
24
24
  orientation
25
25
  }, localRef);
26
26
  const { onKeyDownCapture: _localeKeyDown, ...behaviorProperties } = toolbarProps;
27
- const foreground = resolveColor(color ?? "foreground:base", colors);
27
+ const foreground = resolveColor(color ?? "foreground", colors);
28
28
  const theme = useMemo(() => ({
29
- gap: resolveGap(gap, appearance),
30
- groupGap: resolveGap("small", appearance),
29
+ gap: resolveSpacing(gap, spacing),
30
+ groupGap: resolveSpacing("small", spacing),
31
31
  orientation,
32
- separator: colorOpacity(foreground, controlOpacity.separator)
33
- }), [appearance, foreground, gap, orientation]);
32
+ // A Toolbar may carry its own text color; its separator shows it like every separator.
33
+ separator: colorOpacity(foreground, separatorOpacity)
34
+ }), [spacing, foreground, gap, orientation]);
34
35
  return _jsx(ToolbarThemeContext.Provider, { value: theme, children: _jsx("div", { ...mergeProps(properties, behaviorProperties, {
35
36
  onKeyDownCapture: toolbarKeyDown(focusManager, orientation, direction)
36
37
  }), ref: mergeRefs(localRef, ref), className: className, style: {
@@ -79,14 +80,14 @@ function toolbarKeyDown(focusManager, orientation, direction) {
79
80
  };
80
81
  }
81
82
  /** A semantic group of related controls within a Toolbar. */
82
- export const ToolbarGroup = forwardRef(function ToolbarGroup({ className, gap, style, ...properties }, ref) {
83
+ export const ToolbarGroup = forwardRef(function ToolbarGroup({ className, disabled, gap, style, ...properties }, ref) {
83
84
  const inherited = useToolbarTheme();
84
- const { appearance } = useResolvedAppearance();
85
- return _jsx(AriaGroup, { ...properties, ref: ref, className: className, style: {
85
+ const { spacing } = useVisual();
86
+ return _jsx(AriaGroup, { ...properties, isDisabled: disabled, ref: ref, className: className, style: {
86
87
  display: "flex",
87
88
  flexDirection: inherited.orientation === "horizontal" ? "row" : "column",
88
89
  alignItems: inherited.orientation === "horizontal" ? "center" : "flex-start",
89
- gap: gap === undefined ? inherited.groupGap : resolveGap(gap, appearance),
90
+ gap: gap === undefined ? inherited.groupGap : resolveSpacing(gap, spacing),
90
91
  minWidth: 0,
91
92
  ...style
92
93
  } });
package/dist/tooltip.d.ts CHANGED
@@ -1,20 +1,29 @@
1
1
  import type { ComponentProps, CSSProperties, ReactNode } from "react";
2
2
  import type { TooltipProps as AriaTooltipProps, TooltipTriggerComponentProps as AriaTooltipTriggerProps } from "react-aria-components";
3
- import { type ButtonProps } from "./button.js";
4
- import { type SurfaceOwnProps } from "./surface.js";
5
- export type TooltipRootProps = AriaTooltipTriggerProps;
6
- export declare function TooltipRoot(properties: TooltipRootProps): import("react").JSX.Element;
7
- export type TooltipTriggerProps = ButtonProps;
8
- export declare const TooltipTrigger: import("react").ForwardRefExoticComponent<ButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
9
- export interface TooltipContentProps extends Omit<AriaTooltipProps, "children" | "className" | "color" | "style">, SurfaceOwnProps {
3
+ import { type ButtonActionProps } from "./button.js";
4
+ import { type AriaOverlayInternals, type OverlayRootProps } from "./control/open-state.js";
5
+ import { type Direction } from "./foundation/direction.js";
6
+ import { type SurfaceOwnProps } from "./surface/surface.js";
7
+ export type TooltipRootProps = OverlayRootProps & Readonly<Pick<AriaTooltipTriggerProps, "delay" | "closeDelay" | "trigger">> & Readonly<{
8
+ /** Whether the Tooltip is prevented from opening. */
9
+ disabled?: boolean;
10
+ /** Whether pressing the trigger closes the Tooltip. Defaults to `true`. */
11
+ closeOnPress?: boolean;
12
+ }>;
13
+ export declare function TooltipRoot({ children, delay, closeDelay, trigger, disabled, closeOnPress, ...state }: TooltipRootProps): import("react").JSX.Element;
14
+ export type TooltipTriggerProps = ButtonActionProps;
15
+ export declare const TooltipTrigger: import("react").ForwardRefExoticComponent<ButtonActionProps & import("react").RefAttributes<HTMLButtonElement>>;
16
+ /** The floating Surface of a Tooltip: its placement, its own Surface, and element attributes. */
17
+ export interface TooltipContentProps extends Omit<AriaTooltipProps, AriaOverlayInternals | "children" | "className" | "color" | "style" | "dir">, SurfaceOwnProps {
10
18
  readonly children?: ReactNode;
11
19
  readonly className?: string;
20
+ readonly dir?: Direction;
12
21
  readonly style?: CSSProperties;
13
22
  }
14
23
  export declare const TooltipContent: import("react").ForwardRefExoticComponent<TooltipContentProps & import("react").RefAttributes<HTMLDivElement>>;
15
24
  /** A description shown from the focus and hover state of its trigger. */
16
25
  export declare const Tooltip: typeof TooltipRoot & {
17
- Trigger: import("react").ForwardRefExoticComponent<ButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
26
+ Trigger: import("react").ForwardRefExoticComponent<ButtonActionProps & import("react").RefAttributes<HTMLButtonElement>>;
18
27
  Content: import("react").ForwardRefExoticComponent<TooltipContentProps & import("react").RefAttributes<HTMLDivElement>>;
19
28
  };
20
29
  export type TooltipProps = ComponentProps<typeof TooltipRoot>;
package/dist/tooltip.js CHANGED
@@ -1,26 +1,28 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { forwardRef } from "react";
3
3
  import { Tooltip as AriaTooltip, TooltipTrigger as AriaTooltipTrigger } from "react-aria-components";
4
- import { useResolvedAppearance } from "./appearance-context.js";
5
4
  import { Button } from "./button.js";
6
- import { controlFontSizes } from "./control.js";
7
- import MotionStyle, { overlayMotionClass, overlayTransition } from "./motion-style.js";
8
- import { scale } from "./scale.js";
9
- import { Surface } from "./surface.js";
10
- import { resolveDirection, useDirection } from "./direction.js";
11
- import { resolveDirectionalPlacement } from "./overlay-placement.js";
12
- export function TooltipRoot(properties) {
13
- return _jsx(AriaTooltipTrigger, { ...properties });
5
+ import { controlFontSizes } from "./control/control.js";
6
+ import { ariaOpenState } from "./control/open-state.js";
7
+ import { resolveDirection, useDirection } from "./foundation/direction.js";
8
+ import MotionStyle, { overlayMotionClass, overlayTransition } from "./foundation/motion-style.js";
9
+ import { resolveDirectionalPlacement } from "./foundation/overlay-placement.js";
10
+ import { scale } from "./foundation/scale.js";
11
+ import { useVisual } from "./foundation/visual.js";
12
+ import { floatingShadow } from "./surface/shadow-options.js";
13
+ import { Surface } from "./surface/surface.js";
14
+ export function TooltipRoot({ children, delay, closeDelay, trigger, disabled, closeOnPress, ...state }) {
15
+ return _jsx(AriaTooltipTrigger, { ...ariaOpenState(state), delay: delay, closeDelay: closeDelay, trigger: trigger, isDisabled: disabled, shouldCloseOnPress: closeOnPress, children: children });
14
16
  }
15
17
  export const TooltipTrigger = forwardRef(function TooltipTrigger(properties, ref) {
16
18
  return _jsx(Button, { ...properties, ref: ref });
17
19
  });
18
- export const TooltipContent = forwardRef(function TooltipContent({ children, className, color, material, radius, shadow, style, offset, placement = "top", ...properties }, ref) {
19
- const resolved = useResolvedAppearance();
20
- const inset = scale(resolved.appearance.spacing, "small");
21
- const transition = overlayTransition(resolved.transaction, resolved.preferences.animations);
22
- const direction = resolveDirection(properties.dir, useDirection());
23
- return _jsxs(_Fragment, { children: [_jsx(MotionStyle, {}), _jsx(AriaTooltip, { ...properties, ref: ref, dir: direction, offset: offset ?? inset, placement: resolveDirectionalPlacement(placement, direction), className: overlayMotionClass, style: transition, children: _jsx(Surface, { dir: direction, className: className, color: color, material: material, radius: radius, shadow: shadow, style: {
20
+ export const TooltipContent = forwardRef(function TooltipContent({ children, className, color, material, radius, shadow, style, offset, placement = "top", dir, ...attributes }, ref) {
21
+ const visual = useVisual();
22
+ const inset = scale(visual.spacing, "small");
23
+ const transition = overlayTransition(visual);
24
+ const direction = resolveDirection(dir, useDirection());
25
+ return _jsxs(_Fragment, { children: [_jsx(MotionStyle, {}), _jsx(AriaTooltip, { ...attributes, ref: ref, dir: direction, offset: offset ?? inset, placement: resolveDirectionalPlacement(placement, direction), className: overlayMotionClass, style: transition, children: _jsx(Surface, { dir: direction, className: className, color: color ?? "foreground", material: material, radius: radius, shadow: shadow ?? floatingShadow(visual.shadow), style: {
24
26
  boxSizing: "border-box",
25
27
  maxWidth: "28em",
26
28
  paddingBlock: inset,
package/dist/tree.d.ts CHANGED
@@ -1,52 +1,47 @@
1
1
  import type { CSSProperties, ReactElement, RefAttributes } from "react";
2
2
  import { Collection as AriaCollection } from "react-aria-components";
3
3
  import type { CollectionProps as AriaCollectionProps, TreeItemContentProps as AriaTreeItemContentProps, TreeItemProps as AriaTreeItemProps, TreeProps as AriaTreeProps } from "react-aria-components";
4
- import type { ControlColor } from "./control.js";
5
- import type { RadiusProps } from "./radius.js";
6
- import type { ScaleLevel } from "./scale.js";
7
- import { type MultipleStringSelection, type MultipleStringSelectionProps, type SingleStringSelectionProps } from "./selection.js";
8
- type TreeRootBaseProps<T extends object> = Omit<AriaTreeProps<T>, "className" | "defaultExpandedKeys" | "defaultSelectedKeys" | "disabledKeys" | "expandedKeys" | "onAction" | "onExpandedChange" | "onSelectionChange" | "selectedKeys" | "selectionMode" | "style"> & RadiusProps & Readonly<{
4
+ import { type MultipleSelectionProps, type MultipleStringSelection, type NoSelectionProps, type SingleSelectionProps } 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 TreeRootBaseProps<T extends object> = Omit<AriaTreeProps<T>, "className" | "defaultExpandedKeys" | "defaultSelectedKeys" | "disabledKeys" | "expandedKeys" | "onAction" | "onExpandedChange" | "onSelectionChange" | "selectedKeys" | "selectionMode" | "style" | "shouldSelectOnPressUp"> & RadiusProps & Readonly<{
9
9
  className?: string;
10
- color?: ControlColor;
10
+ /** Color laid beneath selected Items. */
11
+ color?: Color;
11
12
  defaultExpanded?: readonly string[];
12
- disabledValues?: readonly string[];
13
13
  expanded?: readonly string[];
14
14
  onExpandedChange?: (values: readonly string[]) => void;
15
- onItemAction?: (value: string) => void;
15
+ /** Runs with the value of the Item that was activated. */
16
+ onAction?: (value: string) => void;
17
+ /** Whether an Item is selected when the press ends instead of when it starts. */
18
+ selectOnPressUp?: boolean;
16
19
  size?: ScaleLevel;
17
20
  style?: CSSProperties;
18
21
  }>;
19
- export type TreeNoSelectionProps = Readonly<{
20
- selectionMode?: "none";
21
- value?: never;
22
- defaultValue?: never;
23
- onChange?: never;
24
- }>;
25
- export type TreeSingleSelectionProps = SingleStringSelectionProps & Readonly<{
26
- selectionMode: "single";
27
- }>;
22
+ export type TreeNoSelectionProps = NoSelectionProps;
23
+ export type TreeSingleSelectionProps = SingleSelectionProps;
28
24
  export type TreeMultipleValue = MultipleStringSelection;
29
- export type TreeMultipleSelectionProps = MultipleStringSelectionProps & Readonly<{
30
- selectionMode: "multiple";
31
- }>;
25
+ export type TreeMultipleSelectionProps = MultipleSelectionProps;
32
26
  export type TreeRootProps<T extends object = object> = TreeRootBaseProps<T> & (TreeNoSelectionProps | TreeSingleSelectionProps | TreeMultipleSelectionProps);
33
27
  export type TreeRootComponent = <T extends object = object>(properties: TreeRootProps<T> & RefAttributes<HTMLDivElement>) => ReactElement | null;
34
- export declare const TreeRoot: TreeRootComponent;
35
- export interface TreeItemProps<T = object> extends Omit<AriaTreeItemProps<T>, "className" | "id" | "isDisabled" | "style"> {
28
+ export interface TreeItemProps<T = object> extends Omit<AriaTreeItemProps<T>, "className" | "id" | "isDisabled" | "style" | "hasChildItems" | "allowsArrowNavigation"> {
29
+ /** Identity of this Item within its Tree. */
30
+ readonly id: string;
31
+ /** Whether arrow keys move between cells while focus is inside this one. */
32
+ readonly arrowNavigation?: boolean;
33
+ /** Whether this Item can expand before its children have loaded. */
34
+ readonly expandable?: boolean;
36
35
  readonly className?: string;
37
36
  readonly disabled?: boolean;
38
- readonly id: string;
39
37
  readonly style?: CSSProperties;
40
38
  }
41
39
  export type TreeItemComponent = <T = object>(properties: TreeItemProps<T> & RefAttributes<HTMLDivElement>) => ReactElement | null;
42
- export declare const TreeItem: TreeItemComponent;
43
40
  export interface TreeContentProps extends AriaTreeItemContentProps {
44
41
  readonly children: AriaTreeItemContentProps["children"];
45
42
  }
46
- export declare const TreeContent: import("react").ForwardRefExoticComponent<TreeContentProps & RefAttributes<Element>>;
47
43
  export type TreeCollectionProps<T extends object = object> = AriaCollectionProps<T>;
48
- export declare const TreeCollection: typeof AriaCollection;
49
- /** Hierarchical navigation with independently controlled expansion, selection, and item actions. */
44
+ /** Hierarchical navigation with independently controlled expansion, selection, and actions. */
50
45
  export declare const Tree: TreeRootComponent & {
51
46
  Item: TreeItemComponent;
52
47
  Content: import("react").ForwardRefExoticComponent<TreeContentProps & RefAttributes<Element>>;