@phreshos/react-ui 0.1.36 → 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.
- package/README.md +147 -167
- package/dist/accordion.d.ts +7 -6
- package/dist/accordion.js +5 -5
- package/dist/alert-dialog.js +3 -1
- package/dist/alert.d.ts +17 -0
- package/dist/alert.js +30 -0
- package/dist/app-layout.d.ts +13 -0
- package/dist/app-layout.js +84 -0
- package/dist/button.d.ts +12 -24
- package/dist/button.js +34 -39
- package/dist/calendar-layout.d.ts +9 -5
- package/dist/calendar-layout.js +67 -78
- package/dist/calendar-trigger.d.ts +4 -4
- package/dist/calendar-trigger.js +7 -29
- package/dist/calendar.d.ts +2 -2
- package/dist/calendar.js +6 -5
- package/dist/checkbox.d.ts +4 -4
- package/dist/checkbox.js +16 -6
- package/dist/color-area.d.ts +20 -0
- package/dist/color-area.js +30 -0
- package/dist/color-field.d.ts +17 -0
- package/dist/color-field.js +17 -0
- package/dist/color-picker.d.ts +24 -0
- package/dist/color-picker.js +30 -0
- package/dist/color-slider.d.ts +19 -0
- package/dist/color-slider.js +29 -0
- package/dist/color-swatch-picker.d.ts +23 -0
- package/dist/color-swatch-picker.js +36 -0
- package/dist/color-swatch.d.ts +18 -0
- package/dist/color-swatch.js +20 -0
- package/dist/combo-box.d.ts +18 -10
- package/dist/combo-box.js +43 -58
- package/dist/context-menu.d.ts +14 -10
- package/dist/context-menu.js +7 -6
- package/dist/control/color-thumb.d.ts +13 -0
- package/dist/control/color-thumb.js +33 -0
- package/dist/control/color-value.d.ts +6 -0
- package/dist/control/color-value.js +7 -0
- package/dist/control/control.d.ts +60 -0
- package/dist/control/control.js +71 -0
- package/dist/control/field-button.d.ts +13 -0
- package/dist/control/field-button.js +28 -0
- package/dist/control/field.d.ts +20 -0
- package/dist/control/field.js +34 -0
- package/dist/control/icon.d.ts +11 -0
- package/dist/control/icon.js +8 -0
- package/dist/control/item.d.ts +34 -0
- package/dist/control/item.js +53 -0
- package/dist/control/open-state.d.ts +25 -0
- package/dist/control/open-state.js +8 -0
- package/dist/control/selection-track.d.ts +39 -0
- package/dist/control/selection-track.js +122 -0
- package/dist/control/selection.d.ts +44 -0
- package/dist/{selection.js → control/selection.js} +16 -0
- package/dist/control/surface-render.d.ts +10 -0
- package/dist/control/surface-render.js +12 -0
- package/dist/control/text-control.d.ts +32 -0
- package/dist/control/text-control.js +31 -0
- package/dist/control/toggle.d.ts +32 -0
- package/dist/control/toggle.js +80 -0
- package/dist/date-control.d.ts +9 -9
- package/dist/date-control.js +31 -34
- package/dist/date-field.d.ts +7 -6
- package/dist/date-field.js +8 -6
- package/dist/date-picker.d.ts +13 -6
- package/dist/date-picker.js +9 -6
- package/dist/date-range-picker.d.ts +15 -6
- package/dist/date-range-picker.js +12 -9
- package/dist/dialog.d.ts +22 -8
- package/dist/dialog.js +37 -28
- package/dist/disclosure.d.ts +8 -7
- package/dist/disclosure.js +31 -52
- package/dist/drop-zone.d.ts +18 -0
- package/dist/drop-zone.js +32 -0
- package/dist/dropdown-menu.d.ts +7 -4
- package/dist/dropdown-menu.js +5 -4
- package/dist/fieldset.d.ts +13 -0
- package/dist/fieldset.js +26 -0
- package/dist/file-trigger.d.ts +13 -0
- package/dist/file-trigger.js +6 -0
- package/dist/flex.d.ts +1 -1
- package/dist/flex.js +5 -4
- package/dist/foundation/appearance.d.ts +83 -0
- package/dist/foundation/appearance.js +38 -0
- package/dist/{aria-direction.js → foundation/aria-direction.js} +3 -1
- package/dist/foundation/color.d.ts +61 -0
- package/dist/foundation/color.js +247 -0
- package/dist/{layout.d.ts → foundation/layout.d.ts} +6 -4
- package/dist/{layout.js → foundation/layout.js} +7 -5
- package/dist/foundation/motion-style.d.ts +9 -0
- package/dist/foundation/motion-style.js +50 -0
- package/dist/foundation/preferences.d.ts +15 -0
- package/dist/{ui-provider.d.ts → foundation/provider.d.ts} +3 -5
- package/dist/{ui-provider.js → foundation/provider.js} +14 -26
- package/dist/{radius.d.ts → foundation/radius.d.ts} +6 -3
- package/dist/foundation/radius.js +11 -0
- package/dist/foundation/spacing.d.ts +11 -0
- package/dist/foundation/spacing.js +4 -0
- package/dist/foundation/visual.d.ts +42 -0
- package/dist/{appearance-context.js → foundation/visual.js} +41 -27
- package/dist/grid.d.ts +1 -1
- package/dist/grid.js +5 -4
- package/dist/icons/main.d.ts +5 -3
- package/dist/icons/main.js +5 -3
- package/dist/input.d.ts +2 -2
- package/dist/input.js +9 -7
- package/dist/list-box.d.ts +24 -19
- package/dist/list-box.js +52 -109
- package/dist/main.d.ts +27 -16
- package/dist/main.js +22 -9
- package/dist/menu.d.ts +28 -32
- package/dist/menu.js +47 -93
- package/dist/number-field.d.ts +17 -0
- package/dist/number-field.js +28 -0
- package/dist/panel.d.ts +10 -5
- package/dist/panel.js +33 -12
- package/dist/popover.d.ts +19 -5
- package/dist/popover.js +22 -15
- package/dist/progress-bar.d.ts +8 -10
- package/dist/progress-bar.js +18 -34
- package/dist/radio.d.ts +15 -12
- package/dist/radio.js +27 -37
- package/dist/range-calendar.d.ts +5 -3
- package/dist/range-calendar.js +8 -7
- package/dist/scroll-area.d.ts +2 -2
- package/dist/scroll-area.js +10 -9
- package/dist/segmented-control.d.ts +23 -0
- package/dist/segmented-control.js +38 -0
- package/dist/select.d.ts +40 -13
- package/dist/select.js +63 -18
- package/dist/slider.d.ts +7 -3
- package/dist/slider.js +51 -50
- package/dist/spinner.d.ts +5 -8
- package/dist/spinner.js +12 -27
- package/dist/surface/grain.d.ts +12 -0
- package/dist/surface/grain.js +65 -0
- package/dist/{material-options.d.ts → surface/material-options.d.ts} +1 -2
- package/dist/{material-options.js → surface/material-options.js} +2 -2
- package/dist/surface/paint-class.d.ts +6 -0
- package/dist/surface/paint-class.js +36 -0
- package/dist/{shadow-options.d.ts → surface/shadow-options.d.ts} +13 -1
- package/dist/{shadow-options.js → surface/shadow-options.js} +17 -2
- package/dist/surface/surface.d.ts +73 -0
- package/dist/surface/surface.js +230 -0
- package/dist/switch.d.ts +4 -5
- package/dist/switch.js +17 -8
- package/dist/table.d.ts +29 -32
- package/dist/table.js +68 -106
- package/dist/tabs.d.ts +16 -15
- package/dist/tabs.js +44 -86
- package/dist/textarea.d.ts +2 -2
- package/dist/textarea.js +10 -14
- package/dist/time-field.d.ts +6 -6
- package/dist/time-field.js +8 -6
- package/dist/toolbar.d.ts +6 -4
- package/dist/toolbar.js +16 -15
- package/dist/tooltip.d.ts +13 -4
- package/dist/tooltip.js +17 -15
- package/dist/tree.d.ts +22 -27
- package/dist/tree.js +54 -99
- package/dist/window.d.ts +2 -2
- package/dist/window.js +18 -20
- package/package.json +3 -3
- package/dist/appearance-context.d.ts +0 -54
- package/dist/appearance.d.ts +0 -11
- package/dist/appearance.js +0 -11
- package/dist/color.d.ts +0 -69
- package/dist/color.js +0 -192
- package/dist/control-surface.d.ts +0 -20
- package/dist/control-surface.js +0 -11
- package/dist/control.d.ts +0 -70
- package/dist/control.js +0 -105
- package/dist/field-style.d.ts +0 -3
- package/dist/field-style.js +0 -12
- package/dist/material-paint.d.ts +0 -13
- package/dist/material-paint.js +0 -119
- package/dist/motion-style.d.ts +0 -13
- package/dist/motion-style.js +0 -75
- package/dist/preferences.d.ts +0 -12
- package/dist/radius.js +0 -11
- package/dist/readiness.d.ts +0 -37
- package/dist/readiness.js +0 -134
- package/dist/selection.d.ts +0 -18
- package/dist/spacing.d.ts +0 -8
- package/dist/spacing.js +0 -8
- package/dist/surface-edge.d.ts +0 -11
- package/dist/surface-edge.js +0 -55
- package/dist/surface.d.ts +0 -27
- package/dist/surface.js +0 -92
- package/dist/text-control.d.ts +0 -10
- package/dist/text-control.js +0 -0
- package/dist/toggle-indicator.d.ts +0 -18
- package/dist/toggle-indicator.js +0 -49
- /package/dist/{aria-direction.d.ts → foundation/aria-direction.d.ts} +0 -0
- /package/dist/{direction.d.ts → foundation/direction.d.ts} +0 -0
- /package/dist/{direction.js → foundation/direction.js} +0 -0
- /package/dist/{overlay-placement.d.ts → foundation/overlay-placement.d.ts} +0 -0
- /package/dist/{overlay-placement.js → foundation/overlay-placement.js} +0 -0
- /package/dist/{preferences.js → foundation/preferences.js} +0 -0
- /package/dist/{scale.d.ts → foundation/scale.d.ts} +0 -0
- /package/dist/{scale.js → foundation/scale.js} +0 -0
package/dist/time-field.js
CHANGED
|
@@ -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 {
|
|
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,
|
|
10
|
-
const
|
|
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(
|
|
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
|
|
4
|
-
import {
|
|
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?:
|
|
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 {
|
|
6
|
-
import { colorOpacity, resolveColor } from "./color.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
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 {
|
|
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
|
|
27
|
+
const foreground = resolveColor(color ?? "foreground", colors);
|
|
28
28
|
const theme = useMemo(() => ({
|
|
29
|
-
gap:
|
|
30
|
-
groupGap:
|
|
29
|
+
gap: resolveSpacing(gap, spacing),
|
|
30
|
+
groupGap: resolveSpacing("small", spacing),
|
|
31
31
|
orientation,
|
|
32
|
-
separator
|
|
33
|
-
|
|
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 {
|
|
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 :
|
|
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
|
|
5
|
-
|
|
6
|
-
|
|
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
|
-
|
|
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
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
|
|
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", ...
|
|
19
|
-
const
|
|
20
|
-
const inset = scale(
|
|
21
|
-
const transition = overlayTransition(
|
|
22
|
-
const direction = resolveDirection(
|
|
23
|
-
return _jsxs(_Fragment, { children: [_jsx(MotionStyle, {}), _jsx(AriaTooltip, { ...
|
|
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
|
|
5
|
-
import type
|
|
6
|
-
import type {
|
|
7
|
-
import
|
|
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
|
-
|
|
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
|
-
|
|
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 =
|
|
20
|
-
|
|
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 =
|
|
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
|
|
35
|
-
|
|
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
|
-
|
|
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 {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { AriaDirectionBoundary } from "./aria-direction.js";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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" ||
|
|
14
|
-
return _jsx(
|
|
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:
|
|
24
|
+
gap: 2,
|
|
18
25
|
minWidth: 0,
|
|
19
|
-
padding:
|
|
26
|
+
padding: metrics.listInset,
|
|
20
27
|
boxSizing: "border-box",
|
|
21
28
|
outline: "none",
|
|
22
29
|
fontFamily: "inherit",
|
|
23
|
-
fontSize:
|
|
30
|
+
fontSize: metrics.fontSize,
|
|
24
31
|
...style
|
|
25
32
|
} }) }) });
|
|
26
33
|
});
|
|
27
|
-
|
|
28
|
-
function
|
|
29
|
-
const
|
|
30
|
-
|
|
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
|
-
...
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
paddingInlineStart:
|
|
70
|
-
|
|
71
|
-
|
|
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:
|
|
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
|
-
|
|
91
|
-
|
|
92
|
-
const
|
|
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:
|
|
101
|
-
height:
|
|
65
|
+
width: box,
|
|
66
|
+
height: box,
|
|
102
67
|
padding: 0,
|
|
103
68
|
border: 0,
|
|
104
|
-
borderRadius:
|
|
105
|
-
outline:
|
|
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(
|
|
112
|
-
: _jsx("span", { "aria-hidden": "true", style: { flex: `0 0 ${
|
|
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
|
|
115
|
-
const
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
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
|
-
|
|
123
|
-
|
|
124
|
-
|
|
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:
|
|
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 {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
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
|
|
38
|
-
const spacing =
|
|
39
|
-
const foreground = style?.color ?? resolveColor(color ?? "foreground
|
|
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(
|
|
46
|
+
iconRadius: scale(visual.radius, "xsmall"),
|
|
44
47
|
maximized,
|
|
45
48
|
onMaximize,
|
|
46
49
|
spacing,
|
|
47
|
-
transition:
|
|
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:
|
|
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(
|
|
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(
|
|
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
|
|
135
|
-
return _jsx(WindowAction, { ...properties, ref: ref, "aria-label": label, color: color, preventFocusOnPress: preventFocusOnPress, children: _jsx(
|
|
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.
|
|
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
|
+
"@phreshos/core": "^0.1.61",
|
|
61
61
|
"colorjs.io": "^0.7.1",
|
|
62
|
-
"
|
|
62
|
+
"lucide-react": "^1.48.0",
|
|
63
63
|
"react-aria": "^3.51.0",
|
|
64
64
|
"react-aria-components": "^1.20.0"
|
|
65
65
|
},
|