@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
@@ -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,14 +1,23 @@
1
1
  import type { ComponentProps, CSSProperties, ReactNode } from "react";
2
2
  import type { TooltipProps as AriaTooltipProps, TooltipTriggerComponentProps as AriaTooltipTriggerProps } from "react-aria-components";
3
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;
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;
7
14
  export type TooltipTriggerProps = ButtonProps;
8
15
  export declare const TooltipTrigger: import("react").ForwardRefExoticComponent<ButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
9
- export interface TooltipContentProps extends Omit<AriaTooltipProps, "children" | "className" | "color" | "style">, SurfaceOwnProps {
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>>;
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>>;
package/dist/tree.js CHANGED
@@ -1,134 +1,89 @@
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 { Button as AriaButton, Collection as AriaCollection, Tree as AriaTree, TreeItem as AriaTreeItem, TreeItemContent as AriaTreeItemContent } from "react-aria-components";
4
- import { controlOpacity, useControlTheme } from "./control.js";
5
- import { resolveDirection, useDirection } from "./direction.js";
6
- import { multipleSelection, singleSelection, stringKey, stringKeys, toAriaSelection } from "./selection.js";
7
- import { AriaDirectionBoundary } from "./aria-direction.js";
8
- const TreeThemeContext = createContext(null);
9
- const TreeRootImplementation = forwardRef(function TreeRoot(properties, ref) {
10
- const { className, color, defaultExpanded, defaultValue, disabledValues, expanded, onChange, onExpandedChange, onItemAction, radius = "medium", selectionMode = "none", size = "medium", style, value, ...native } = properties;
11
- const theme = useControlTheme({ color, radius, size });
4
+ import { proportionalRadius, transition, useControlMetrics } from "./control/control.js";
5
+ import { itemPaint, itemStyle } from "./control/item.js";
6
+ import { ariaSelection, stringKey, stringKeys } 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
+ import { ChevronRight } from "lucide-react";
12
+ import { iconProps } from "./control/icon.js";
13
+ const TreeStyleContext = createContext(null);
14
+ const TreeRootImplementation = forwardRef(function Tree(properties, ref) {
15
+ const { className, color = "primary", defaultExpanded, defaultValue: _defaultValue, expanded, onAction, onChange: _onChange, onExpandedChange, radius, selectOnPressUp, selectionMode = "none", size, style, value: _value, ...native } = properties;
16
+ const metrics = useControlMetrics(size, radius);
17
+ // Items are controls: they take the control radius at their size.
18
+ const itemRadius = metrics.radius;
12
19
  const direction = resolveDirection(native.dir, useDirection());
13
- const context = useMemo(() => ({ direction, interactive: selectionMode !== "none" || onItemAction != null, theme }), [direction, onItemAction, selectionMode, theme]);
14
- return _jsx(TreeThemeContext.Provider, { value: context, children: _jsx(AriaDirectionBoundary, { direction: direction, children: _jsx(AriaTree, { ...native, ...selectionProperties(properties), ...expansionProperties({ defaultExpanded, expanded, onExpandedChange }), ref: ref, dir: direction, className: className, disabledKeys: disabledValues, selectionMode: selectionMode, onAction: onItemAction == null ? undefined : key => onItemAction(stringKey(key)), style: {
20
+ const context = useMemo(() => ({ color, direction, interactive: selectionMode !== "none" || onAction != null, metrics, itemRadius }), [color, direction, metrics, itemRadius, onAction, selectionMode]);
21
+ return _jsx(TreeStyleContext.Provider, { value: context, children: _jsx(AriaDirectionBoundary, { direction: direction, children: _jsx(AriaTree, { ...native, shouldSelectOnPressUp: selectOnPressUp, ...ariaSelection(properties, "none"), ...(expanded !== undefined ? { expandedKeys: new Set(expanded) } : {}), ...(defaultExpanded !== undefined ? { defaultExpandedKeys: new Set(defaultExpanded) } : {}), ...(onExpandedChange !== undefined ? { onExpandedChange: (keys) => onExpandedChange(stringKeys(keys)) } : {}), ref: ref, dir: direction, className: className, onAction: onAction == null ? undefined : key => onAction(stringKey(key)), style: {
15
22
  display: "grid",
16
23
  alignContent: "start",
17
- gap: theme.gap,
24
+ gap: 2,
18
25
  minWidth: 0,
19
- padding: theme.gap,
26
+ padding: metrics.listInset,
20
27
  boxSizing: "border-box",
21
28
  outline: "none",
22
29
  fontFamily: "inherit",
23
- fontSize: theme.fontSize,
30
+ fontSize: metrics.fontSize,
24
31
  ...style
25
32
  } }) }) });
26
33
  });
27
- export const TreeRoot = TreeRootImplementation;
28
- function selectionProperties(properties) {
29
- const selectedKeys = toAriaSelection(properties.value);
30
- const defaultSelectedKeys = toAriaSelection(properties.defaultValue);
31
- const onSelectionChange = properties.onChange == null
32
- ? undefined
33
- : (selection) => {
34
- if (properties.selectionMode === "multiple") {
35
- properties.onChange?.(multipleSelection(selection));
36
- return;
37
- }
38
- if (properties.selectionMode === "single")
39
- properties.onChange?.(singleSelection(selection));
40
- };
41
- return {
42
- ...(selectedKeys !== undefined ? { selectedKeys } : {}),
43
- ...(defaultSelectedKeys !== undefined ? { defaultSelectedKeys } : {}),
44
- ...(onSelectionChange !== undefined ? { onSelectionChange } : {})
45
- };
46
- }
47
- function expansionProperties({ defaultExpanded, expanded, onExpandedChange }) {
48
- return {
49
- ...(expanded !== undefined ? { expandedKeys: new Set(expanded) } : {}),
50
- ...(defaultExpanded !== undefined ? { defaultExpandedKeys: new Set(defaultExpanded) } : {}),
51
- ...(onExpandedChange !== undefined
52
- ? { onExpandedChange: (keys) => onExpandedChange(stringKeys(keys)) }
53
- : {})
54
- };
55
- }
56
- const TreeItemImplementation = forwardRef(function TreeItem({ className, disabled = false, onAction, style, ...properties }, ref) {
57
- const { interactive, theme } = useTreeTheme();
58
- return _jsx(AriaTreeItem, { ...properties, ref: ref, className: className, isDisabled: disabled, onAction: onAction, style: state => {
34
+ /** Tree entries use the collection Item treatment as their own paint. */
35
+ const TreeItemImplementation = forwardRef(function TreeItem({ arrowNavigation, className, disabled = false, expandable, onAction, style, ...properties }, ref) {
36
+ const { color, interactive, itemRadius, metrics } = useTreeStyle();
37
+ return _jsx(AriaTreeItem, { ...properties, allowsArrowNavigation: arrowNavigation, hasChildItems: expandable, ref: ref, className: state => dimmedClass(state.isDisabled, className ?? state.defaultClassName) ?? "", isDisabled: disabled, onAction: onAction, style: state => {
59
38
  const responds = interactive || onAction != null || state.hasChildItems;
60
39
  return {
61
- ...theme.transition,
62
- display: "flex",
63
- alignItems: "center",
64
- gap: theme.gap,
65
- minWidth: 0,
66
- minHeight: theme.height,
67
- paddingBlock: 0,
68
- paddingInlineEnd: Math.max(8, theme.spacing),
69
- paddingInlineStart: Math.max(8, theme.spacing) + Math.max(0, state.level - 1) * theme.spacing,
70
- boxSizing: "border-box",
71
- borderRadius: theme.radius,
72
- outline: state.isFocusVisible ? `1px solid ${theme.focusColor}` : "none",
40
+ ...itemStyle(metrics, state.isDisabled),
41
+ ...itemPaint(metrics.visual, color, {
42
+ selected: state.isSelected,
43
+ hovered: responds && state.isHovered,
44
+ pressed: responds && state.isPressed,
45
+ focusVisible: false,
46
+ disabled: state.isDisabled
47
+ }),
48
+ paddingInlineStart: metrics.inset / 2 + Math.max(0, state.level - 1) * metrics.spacing,
49
+ borderRadius: itemRadius,
50
+ outline: `3px solid ${state.isFocusVisible ? colorOpacity(metrics.visual.colors.primary, 0.34) : "transparent"}`,
73
51
  outlineOffset: 1,
74
- cursor: disabled ? "not-allowed" : responds ? "pointer" : "default",
75
- opacity: disabled ? controlOpacity.disabled : 1,
76
- userSelect: "none",
77
- ...(state.isSelected
78
- ? state.isPressed
79
- ? theme.paints.palette.pressed
80
- : state.isHovered
81
- ? theme.paints.palette.hover
82
- : theme.paints.palette.rest
83
- : state.isHovered && responds
84
- ? theme.paints.subtle.hover
85
- : { background: "transparent", color: "inherit" }),
52
+ cursor: state.isDisabled ? "not-allowed" : responds ? "pointer" : "default",
86
53
  ...style
87
54
  };
88
55
  } });
89
56
  });
90
- export const TreeItem = TreeItemImplementation;
91
- export const TreeContent = forwardRef(function TreeContent({ children }, ref) {
92
- const { direction, theme } = useTreeTheme();
57
+ const TreeContent = forwardRef(function TreeContent({ children }, ref) {
58
+ const { direction, metrics } = useTreeStyle();
59
+ const box = Math.round(metrics.indicator);
93
60
  return _jsx(AriaTreeItemContent, { ref: ref, children: state => _jsxs(_Fragment, { children: [state.hasChildItems
94
61
  ? _jsx(AriaButton, { slot: "chevron", style: ({ isFocusVisible }) => ({
95
- ...theme.transition,
96
- appearance: "none",
97
62
  display: "inline-grid",
98
63
  flex: "0 0 auto",
99
64
  placeItems: "center",
100
- width: theme.indicatorSize,
101
- height: theme.indicatorSize,
65
+ width: box,
66
+ height: box,
102
67
  padding: 0,
103
68
  border: 0,
104
- borderRadius: theme.radius,
105
- outline: isFocusVisible ? `1px solid ${theme.focusColor}` : "none",
106
- outlineOffset: 1,
69
+ borderRadius: proportionalRadius(metrics.visual, box),
70
+ outline: `3px solid ${isFocusVisible ? colorOpacity(metrics.visual.colors.primary, 0.34) : "transparent"}`,
107
71
  background: "transparent",
108
72
  color: "inherit",
109
73
  cursor: state.isDisabled ? "not-allowed" : "pointer",
110
74
  font: "inherit"
111
- }), children: _jsx(Chevron, { direction: direction, expanded: state.isExpanded, theme: theme }) })
112
- : _jsx("span", { "aria-hidden": "true", style: { flex: `0 0 ${theme.indicatorSize}px`, width: theme.indicatorSize } }), _jsx("span", { style: { flex: "1 1 auto", minWidth: 0 }, children: typeof children === "function" ? children(state) : children })] }) });
75
+ }), children: _jsx(ChevronRight, { ...iconProps(14), style: { ...transition(metrics.visual, "rotate"), rotate: state.isExpanded ? "90deg" : direction === "rtl" ? "180deg" : "0deg" } }) })
76
+ : _jsx("span", { "aria-hidden": "true", style: { flex: `0 0 ${box}px` } }), _jsx("span", { style: { flex: "1 1 auto", minWidth: 0, display: "flex", alignItems: "center", gap: metrics.gap }, children: typeof children === "function" ? children(state) : children })] }) });
113
77
  });
114
- function Chevron({ direction, expanded, theme }) {
115
- const collapsedRotation = direction === "rtl" ? 180 : 0;
116
- return _jsx("svg", { "aria-hidden": "true", width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", style: {
117
- ...theme.transition,
118
- transitionProperty: "transform",
119
- transform: `rotate(${expanded ? 90 : collapsedRotation}deg)`
120
- }, children: _jsx("path", { d: "m4 2 4 4-4 4" }) });
78
+ function useTreeStyle() {
79
+ const context = useContext(TreeStyleContext);
80
+ if (context == null)
81
+ throw new Error("Tree parts must be used inside Tree");
82
+ return context;
121
83
  }
122
- export const TreeCollection = AriaCollection;
123
- /** Hierarchical navigation with independently controlled expansion, selection, and item actions. */
124
- export const Tree = Object.assign(TreeRoot, {
125
- Item: TreeItem,
84
+ /** Hierarchical navigation with independently controlled expansion, selection, and actions. */
85
+ export const Tree = Object.assign(TreeRootImplementation, {
86
+ Item: TreeItemImplementation,
126
87
  Content: TreeContent,
127
- Collection: TreeCollection
88
+ Collection: AriaCollection
128
89
  });
129
- function useTreeTheme() {
130
- const value = useContext(TreeThemeContext);
131
- if (value == null)
132
- throw new Error("Tree parts must be used inside Tree");
133
- return value;
134
- }
package/dist/window.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import type { HTMLAttributes, ReactNode } from "react";
2
2
  import type { BeginWindowMoveGesture } from "@phreshos/core";
3
3
  import { type ButtonProps } from "./button.js";
4
- import { type Color } from "./color.js";
5
- import { type SurfaceProps } from "./surface.js";
4
+ import { type Color } from "./foundation/color.js";
5
+ import { type SurfaceProps } from "./surface/surface.js";
6
6
  /** The material shell that establishes the complete header-and-content layout. */
7
7
  export type WindowProps = SurfaceProps;
8
8
  /** The remaining window area. Its consumer owns content behavior, including overflow. */
package/dist/window.js CHANGED
@@ -1,12 +1,15 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { createContext, forwardRef, useContext } from "react";
3
- import { useResolvedAppearance } from "./appearance-context.js";
4
3
  import { Button } from "./button.js";
5
- import { resolveColor } from "./color.js";
6
- import { transitionTiming } from "./motion-style.js";
7
- import { scale } from "./scale.js";
8
- import { Surface } from "./surface.js";
4
+ import { transition } from "./control/control.js";
5
+ import { resolveColor } from "./foundation/color.js";
6
+ import { headerHeight } from "./foundation/layout.js";
7
+ import { scale } from "./foundation/scale.js";
8
+ import { useVisual } from "./foundation/visual.js";
9
+ import { Surface } from "./surface/surface.js";
9
10
  import useWindowMoveHandle from "./use-window-move-handle.js";
11
+ import { ArrowDownLeft, Maximize2, Minimize2, X } from "lucide-react";
12
+ import { iconProps } from "./control/icon.js";
10
13
  const HeaderContext = createContext(null);
11
14
  function useHeader() {
12
15
  const value = useContext(HeaderContext);
@@ -34,17 +37,17 @@ const WindowContent = forwardRef(function WindowContent({ style, ...properties }
34
37
  });
35
38
  /** The composable top region of a window; its enclosing Surface owns the material. */
36
39
  const HeaderRoot = forwardRef(function HeaderRoot({ active = true, beginMoveGesture, children, color, maximized = false, onDoubleClick, onLostPointerCapture, onMaximize, onMoveError, onPointerCancel, onPointerDown, onPointerMove, onPointerUp, style, ...properties }, ref) {
37
- const resolved = useResolvedAppearance();
38
- const spacing = resolved.appearance.spacing;
39
- const foreground = style?.color ?? resolveColor(color ?? "foreground:base", resolved.colors);
40
+ const visual = useVisual();
41
+ const spacing = visual.spacing;
42
+ const foreground = style?.color ?? resolveColor(color ?? "foreground", visual.colors);
40
43
  const state = {
41
44
  active,
42
45
  foreground,
43
- iconRadius: scale(resolved.appearance.radius, "xsmall"),
46
+ iconRadius: scale(visual.radius, "xsmall"),
44
47
  maximized,
45
48
  onMaximize,
46
49
  spacing,
47
- transition: transitionTiming(resolved.transaction, resolved.preferences.animations)
50
+ transition: transition(visual, "opacity")
48
51
  };
49
52
  const move = useWindowMoveHandle(beginMoveGesture, onMoveError);
50
53
  return _jsx(HeaderContext.Provider, { value: state, children: _jsx("div", { ...properties, ref: ref, onPointerDown: event => {
@@ -61,7 +64,7 @@ const HeaderRoot = forwardRef(function HeaderRoot({ active = true, beginMoveGest
61
64
  alignItems: "center",
62
65
  gap: spacing,
63
66
  minWidth: 0,
64
- height: 16 + spacing * 2,
67
+ height: headerHeight(spacing),
65
68
  paddingInline: spacing,
66
69
  flexShrink: 0,
67
70
  userSelect: "none",
@@ -122,21 +125,16 @@ const WindowAction = forwardRef(function WindowAction({ ...properties }, ref) {
122
125
  return _jsx(Button, { ...properties, ref: ref, size: "xsmall" });
123
126
  });
124
127
  const WindowMinimize = forwardRef(function WindowMinimize({ "aria-label": label = "Minimize", preventFocusOnPress = true, ...properties }, ref) {
125
- return _jsx(WindowAction, { ...properties, ref: ref, "aria-label": label, preventFocusOnPress: preventFocusOnPress, children: _jsx(ControlIcon, { children: _jsx("path", { d: "M1.5 7.5h7" }) }) });
128
+ return _jsx(WindowAction, { ...properties, ref: ref, "aria-label": label, preventFocusOnPress: preventFocusOnPress, children: _jsx(ArrowDownLeft, { ...iconProps(14) }) });
126
129
  });
127
130
  const WindowMaximize = forwardRef(function WindowMaximize({ "aria-label": label, maximized, onPress, ...properties }, ref) {
128
131
  const header = useHeader();
129
132
  const selected = maximized ?? header.maximized;
130
- return _jsx(WindowAction, { ...properties, ref: ref, onPress: onPress ?? header.onMaximize, "aria-label": label ?? (selected ? "Restore" : "Maximize"), children: _jsx(ControlIcon, { children: selected
131
- ? _jsx("path", { d: "M1 4h5v5H1zM4 1h5v5H6.5", strokeWidth: "1.3", strokeLinejoin: "round" })
132
- : _jsx("path", { d: "M1.5 1.5h7v7h-7z", strokeWidth: "1.3", strokeLinejoin: "round" }) }) });
133
+ return _jsx(WindowAction, { ...properties, ref: ref, onPress: onPress ?? header.onMaximize, "aria-label": label ?? (selected ? "Restore" : "Maximize"), children: selected ? _jsx(Minimize2, { ...iconProps(14) }) : _jsx(Maximize2, { ...iconProps(14) }) });
133
134
  });
134
- const WindowClose = forwardRef(function WindowClose({ "aria-label": label = "Close", color = "danger:base", preventFocusOnPress = true, ...properties }, ref) {
135
- return _jsx(WindowAction, { ...properties, ref: ref, "aria-label": label, color: color, preventFocusOnPress: preventFocusOnPress, children: _jsx(ControlIcon, { children: _jsx("path", { d: "M1.5 1.5 8.5 8.5M8.5 1.5 1.5 8.5" }) }) });
135
+ const WindowClose = forwardRef(function WindowClose({ "aria-label": label = "Close", color = "danger", preventFocusOnPress = true, ...properties }, ref) {
136
+ return _jsx(WindowAction, { ...properties, ref: ref, "aria-label": label, color: color, preventFocusOnPress: preventFocusOnPress, children: _jsx(X, { ...iconProps(14) }) });
136
137
  });
137
- function ControlIcon({ children }) {
138
- return _jsx("svg", { "aria-hidden": "true", width: "10", height: "10", viewBox: "0 0 10 10", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", children: children });
139
- }
140
138
  const Header = Object.assign(HeaderRoot, {
141
139
  Identity: WindowIdentity,
142
140
  Center: WindowCenter,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phreshos/react-ui",
3
- "version": "0.1.35",
3
+ "version": "0.1.37",
4
4
  "description": "React components for coherent PhreshOS Program interfaces.",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -57,9 +57,9 @@
57
57
  "dependencies": {
58
58
  "@base-ui/react": "^1.7.0",
59
59
  "@internationalized/date": "^3.12.3",
60
- "@phreshos/core": "^0.1.60",
60
+ "@phreshos/core": "^0.1.61",
61
61
  "colorjs.io": "^0.7.1",
62
- "motion": "^13.2.0",
62
+ "lucide-react": "^1.48.0",
63
63
  "react-aria": "^3.51.0",
64
64
  "react-aria-components": "^1.20.0"
65
65
  },