@phreshos/react-ui 0.1.29 → 0.1.30
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 +35 -21
- package/dist/main.d.ts +2 -2
- package/dist/main.js +1 -1
- package/dist/material-options.d.ts +4 -2
- package/dist/surface.d.ts +1 -1
- package/dist/surface.js +22 -3
- package/dist/window.d.ts +36 -0
- package/dist/{window-header.js → window.js} +52 -29
- package/package.json +2 -2
- package/dist/window-header.d.ts +0 -42
package/README.md
CHANGED
|
@@ -115,11 +115,18 @@ required geometry.
|
|
|
115
115
|
`MaterialOptions` defines `opacity`, `backdrop`, `grain`, `grainAmount`,
|
|
116
116
|
`distortion`, and `saturation`. Every material-bearing component, including
|
|
117
117
|
Surface, exposes these values through its `material` prop. Color remains a
|
|
118
|
-
separate property. Omission
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
opacity
|
|
122
|
-
|
|
118
|
+
separate property. Omission uses the resource-efficient `basic` rendering mode.
|
|
119
|
+
`none` ignores Material and paints the resolved color as a normal background;
|
|
120
|
+
`basic` adds Material paint, grain, and its edge while remaining solid, with
|
|
121
|
+
Material opacity applied only to the grain; `extended` applies that opacity to
|
|
122
|
+
the complete Material instead; and `full` adds backdrop, distortion, and
|
|
123
|
+
saturation. A `MaterialOptions` object selects full rendering with those
|
|
124
|
+
overrides. Effect options accept a scale level or a direct number; opacity
|
|
125
|
+
affects Surface paint only, never its content. The material edge is part of the
|
|
126
|
+
same Surface rather than a second public entity.
|
|
127
|
+
|
|
128
|
+
The modes are progressive: each level preserves the rendering of the previous
|
|
129
|
+
one and adds only its own Material capability.
|
|
123
130
|
|
|
124
131
|
Surface-based controls expose the same separate `color` and `material` props.
|
|
125
132
|
`ShadowOptions` similarly groups `x`, `y`, `blur`, `spread`, and `opacity` under
|
|
@@ -133,7 +140,8 @@ to its options, and a Radio can override them. Shadow follows the same targets a
|
|
|
133
140
|
inheritance path.
|
|
134
141
|
|
|
135
142
|
```tsx
|
|
136
|
-
<Button color="primary:base" material=
|
|
143
|
+
<Button color="primary:base" material="full">Save</Button>
|
|
144
|
+
<Surface material={{ opacity: 0.6, backdrop: 0 }}>Translucent</Surface>
|
|
137
145
|
<Input label="Name" radius="large" material={{ grain: "small" }} shadow={{ blur: "small" }} />
|
|
138
146
|
```
|
|
139
147
|
|
|
@@ -154,23 +162,29 @@ Native properties and the root ref target the outer Surface. `Panel.Header`
|
|
|
154
162
|
owns the optional leading region, while `Panel.Content` is the independently
|
|
155
163
|
configurable inner Surface.
|
|
156
164
|
|
|
157
|
-
`
|
|
158
|
-
|
|
159
|
-
optional flexible space, and
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
165
|
+
`Window` provides one Surface with a ready header-and-content layout.
|
|
166
|
+
`Window.Header.Identity` presents the icon and truncating title,
|
|
167
|
+
`Window.Header.Center` is optional flexible space, and
|
|
168
|
+
`Window.Header.Actions` aligns compact controls at the end. `Window.Content`
|
|
169
|
+
fills the remaining area without deciding its overflow behavior. The header
|
|
170
|
+
uses the enclosing Surface rather than creating another material layer, and it
|
|
171
|
+
can also be composed independently inside any Surface. Its controls are React
|
|
172
|
+
UI Buttons; callers connect them to their own window operations. Pointer and
|
|
173
|
+
double-click handlers on the header can implement a drag area, while the center
|
|
174
|
+
and actions keep their interactions separate.
|
|
164
175
|
|
|
165
176
|
```tsx
|
|
166
|
-
<
|
|
167
|
-
<
|
|
168
|
-
|
|
169
|
-
<
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
</
|
|
177
|
+
<Window>
|
|
178
|
+
<Window.Header active={active} onPointerDown={beginDrag}>
|
|
179
|
+
<Window.Header.Identity icon={icon} title={title} />
|
|
180
|
+
<Window.Header.Actions>
|
|
181
|
+
<Window.Header.Minimize onPress={minimize} />
|
|
182
|
+
<Window.Header.Maximize maximized={maximized} onPress={toggleMaximize} />
|
|
183
|
+
<Window.Header.Close onPress={close} />
|
|
184
|
+
</Window.Header.Actions>
|
|
185
|
+
</Window.Header>
|
|
186
|
+
<Window.Content>{children}</Window.Content>
|
|
187
|
+
</Window>
|
|
174
188
|
```
|
|
175
189
|
|
|
176
190
|
## Overlays
|
package/dist/main.d.ts
CHANGED
|
@@ -10,10 +10,10 @@ export type { Preferences, Theme } from "./preferences.js";
|
|
|
10
10
|
export type { Direction } from "./direction.js";
|
|
11
11
|
export { Flex, type FlexProps } from "./flex.js";
|
|
12
12
|
export { Grid, type GridProps } from "./grid.js";
|
|
13
|
-
export { Surface, type MaterialOptions, type ShadowOptions, type SurfaceComponent, type SurfaceHost, type SurfaceHostProps, type SurfaceOwnProps, type SurfaceProps } from "./surface.js";
|
|
13
|
+
export { Surface, type MaterialMode, type MaterialOptions, type ShadowOptions, type SurfaceComponent, type SurfaceHost, type SurfaceHostProps, type SurfaceOwnProps, type SurfaceProps } from "./surface.js";
|
|
14
14
|
export { defaultColor, type Color, type ColorLevel, type ColorScale } from "./color.js";
|
|
15
15
|
export { Panel, PanelRoot, PanelHeader, PanelContent, type PanelProps, type PanelRootProps, type PanelHeaderProps, type PanelContentProps } from "./panel.js";
|
|
16
|
-
export {
|
|
16
|
+
export { Window, type WindowProps, type WindowContentProps, type WindowHeaderProps, type WindowIdentityProps, type WindowCenterProps, type WindowActionsProps, type WindowActionProps, type WindowControlProps, type WindowMaximizeProps, type WindowCloseProps } from "./window.js";
|
|
17
17
|
export { Button, type ButtonColor, type ButtonProps } from "./button.js";
|
|
18
18
|
export { Input, type InputProps } from "./input.js";
|
|
19
19
|
export { Textarea, type TextareaProps } from "./textarea.js";
|
package/dist/main.js
CHANGED
|
@@ -11,7 +11,7 @@ export { Grid } from "./grid.js";
|
|
|
11
11
|
export { Surface } from "./surface.js";
|
|
12
12
|
export { defaultColor } from "./color.js";
|
|
13
13
|
export { Panel, PanelRoot, PanelHeader, PanelContent } from "./panel.js";
|
|
14
|
-
export {
|
|
14
|
+
export { Window } from "./window.js";
|
|
15
15
|
export { Button } from "./button.js";
|
|
16
16
|
export { Input } from "./input.js";
|
|
17
17
|
export { Textarea } from "./textarea.js";
|
|
@@ -8,10 +8,12 @@ export interface MaterialOptions {
|
|
|
8
8
|
readonly distortion?: ScaleLevel | number;
|
|
9
9
|
readonly saturation?: ScaleLevel | number;
|
|
10
10
|
}
|
|
11
|
+
/** React UI's progressively complete browser rendering strategies for a resolved Material. */
|
|
12
|
+
export type MaterialMode = "none" | "basic" | "extended" | "full";
|
|
11
13
|
/** Grouped material customization exposed by components built on Surface. */
|
|
12
14
|
export interface MaterialOverrides {
|
|
13
|
-
/** Omission
|
|
14
|
-
readonly material?:
|
|
15
|
+
/** Omission uses basic rendering. An options object uses full rendering with those overrides. */
|
|
16
|
+
readonly material?: MaterialMode | MaterialOptions;
|
|
15
17
|
}
|
|
16
18
|
/** Resolves overrides against an already selected material branch. */
|
|
17
19
|
export declare function resolveMaterialOptions(values: MaterialOptions, defaults: Readonly<{
|
package/dist/surface.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { type MaterialOverrides } from "./material-options.js";
|
|
|
4
4
|
import { type RadiusProps } from "./radius.js";
|
|
5
5
|
import { type ShadowOverrides } from "./shadow-options.js";
|
|
6
6
|
import type { Direction } from "./direction.js";
|
|
7
|
-
export type { MaterialOptions } from "./material-options.js";
|
|
7
|
+
export type { MaterialMode, MaterialOptions } from "./material-options.js";
|
|
8
8
|
export type { ShadowOptions } from "./shadow-options.js";
|
|
9
9
|
export interface SurfaceOwnProps extends MaterialOverrides, ShadowOverrides, RadiusProps {
|
|
10
10
|
readonly color?: Color;
|
package/dist/surface.js
CHANGED
|
@@ -35,15 +35,34 @@ const SurfaceRoot = forwardRef(function Surface({ as: Element = "div", color, ma
|
|
|
35
35
|
});
|
|
36
36
|
export const Surface = SurfaceRoot;
|
|
37
37
|
function resolveSurface(color, options, resolved) {
|
|
38
|
+
const mode = typeof options === "object" ? "full" : options ?? "basic";
|
|
39
|
+
const level = materialLevel[mode];
|
|
38
40
|
const material = resolveMaterialOptions(typeof options === "object" ? options : {}, resolved.material);
|
|
39
41
|
const fill = resolveColor(color, resolved.colors);
|
|
42
|
+
const opacity = level >= materialLevel.extended ? material.opacity : 1;
|
|
43
|
+
const backdrop = level >= materialLevel.full;
|
|
44
|
+
const grain = level === materialLevel.basic
|
|
45
|
+
? material.grain * material.opacity
|
|
46
|
+
: material.grain;
|
|
40
47
|
return {
|
|
41
48
|
...material,
|
|
42
|
-
enabled:
|
|
49
|
+
enabled: level >= materialLevel.basic,
|
|
50
|
+
opacity,
|
|
51
|
+
fillOpacity: opacity,
|
|
52
|
+
grain,
|
|
53
|
+
backdrop: backdrop ? material.backdrop : 0,
|
|
54
|
+
distortion: backdrop ? material.distortion : 0,
|
|
55
|
+
saturation: backdrop ? material.saturation : 1,
|
|
43
56
|
color: fill,
|
|
44
57
|
foreground: contrastingColor(color ?? defaultColor, resolved.colors)
|
|
45
58
|
};
|
|
46
59
|
}
|
|
60
|
+
const materialLevel = Object.freeze({
|
|
61
|
+
none: 0,
|
|
62
|
+
basic: 1,
|
|
63
|
+
extended: 2,
|
|
64
|
+
full: 3
|
|
65
|
+
});
|
|
47
66
|
const layerStyle = {
|
|
48
67
|
position: "absolute",
|
|
49
68
|
inset: 0,
|
|
@@ -51,7 +70,7 @@ const layerStyle = {
|
|
|
51
70
|
pointerEvents: "none"
|
|
52
71
|
};
|
|
53
72
|
function SurfaceLayers({ material, paintTransition }) {
|
|
54
|
-
const filtersVisible = material.
|
|
73
|
+
const filtersVisible = material.fillOpacity < 1;
|
|
55
74
|
const backdrop = filtersVisible ? material.backdrop : 0;
|
|
56
75
|
const saturation = filtersVisible ? material.saturation : 1;
|
|
57
76
|
const distortion = filtersVisible ? material.distortion : 0;
|
|
@@ -60,7 +79,7 @@ function SurfaceLayers({ material, paintTransition }) {
|
|
|
60
79
|
saturation === 1 ? "" : `saturate(${saturation})`
|
|
61
80
|
].filter(Boolean).join(" ");
|
|
62
81
|
const identity = `phresh-material-${useId().replaceAll(":", "")}`;
|
|
63
|
-
return _jsxs("span", { "data-material": "", "aria-hidden": "true", style: layerStyle, children: [distortion > 0 && _jsx(BackdropLayer, { name: "refraction", filter: `url("#${identity}-distortion")`, zIndex: -3 }), frost && _jsx(BackdropLayer, { name: "frost", filter: frost, zIndex: -2 }), _jsx(MaterialPaint, { identity: identity, distortion: distortion, color: material.color, grain: material.grain, grainAmount: material.grainAmount, opacity: material.
|
|
82
|
+
return _jsxs("span", { "data-material": "", "aria-hidden": "true", style: layerStyle, children: [distortion > 0 && _jsx(BackdropLayer, { name: "refraction", filter: `url("#${identity}-distortion")`, zIndex: -3 }), frost && _jsx(BackdropLayer, { name: "frost", filter: frost, zIndex: -2 }), _jsx(MaterialPaint, { identity: identity, distortion: distortion, color: material.color, grain: material.grain, grainAmount: material.grainAmount, opacity: material.fillOpacity, transition: paintTransition })] });
|
|
64
83
|
}
|
|
65
84
|
/** Keep refraction and native frost in independent compositor passes. */
|
|
66
85
|
function BackdropLayer({ filter, name, zIndex }) {
|
package/dist/window.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { HTMLAttributes, ReactNode } from "react";
|
|
2
|
+
import { type ButtonProps } from "./button.js";
|
|
3
|
+
import { type SurfaceProps } from "./surface.js";
|
|
4
|
+
/** The material shell that establishes the complete header-and-content layout. */
|
|
5
|
+
export type WindowProps = SurfaceProps;
|
|
6
|
+
/** The remaining window area. Its consumer owns content behavior, including overflow. */
|
|
7
|
+
export type WindowContentProps = HTMLAttributes<HTMLDivElement>;
|
|
8
|
+
export interface WindowHeaderProps extends HTMLAttributes<HTMLDivElement> {
|
|
9
|
+
/** Attenuates the identity when this header is not active. */
|
|
10
|
+
readonly active?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface WindowIdentityProps extends Omit<HTMLAttributes<HTMLDivElement>, "title"> {
|
|
13
|
+
readonly icon?: string;
|
|
14
|
+
readonly title?: ReactNode;
|
|
15
|
+
}
|
|
16
|
+
export type WindowCenterProps = HTMLAttributes<HTMLDivElement>;
|
|
17
|
+
export type WindowActionsProps = HTMLAttributes<HTMLDivElement>;
|
|
18
|
+
export type WindowActionProps = Omit<ButtonProps, "size">;
|
|
19
|
+
export type WindowControlProps = Omit<WindowActionProps, "children">;
|
|
20
|
+
export interface WindowMaximizeProps extends WindowControlProps {
|
|
21
|
+
readonly maximized?: boolean;
|
|
22
|
+
}
|
|
23
|
+
export type WindowCloseProps = Omit<WindowControlProps, "color">;
|
|
24
|
+
/** One Surface with a ready-to-use header-and-content composition. */
|
|
25
|
+
export declare const Window: import("react").ForwardRefExoticComponent<Omit<WindowProps, "ref"> & import("react").RefAttributes<HTMLDivElement>> & {
|
|
26
|
+
Header: import("react").ForwardRefExoticComponent<WindowHeaderProps & import("react").RefAttributes<HTMLDivElement>> & {
|
|
27
|
+
Identity: import("react").ForwardRefExoticComponent<WindowIdentityProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
28
|
+
Center: import("react").ForwardRefExoticComponent<WindowCenterProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
29
|
+
Actions: import("react").ForwardRefExoticComponent<WindowActionsProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
30
|
+
Action: import("react").ForwardRefExoticComponent<WindowActionProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
31
|
+
Minimize: import("react").ForwardRefExoticComponent<WindowControlProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
32
|
+
Maximize: import("react").ForwardRefExoticComponent<WindowMaximizeProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
33
|
+
Close: import("react").ForwardRefExoticComponent<WindowCloseProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
34
|
+
};
|
|
35
|
+
Content: import("react").ForwardRefExoticComponent<WindowContentProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
36
|
+
};
|
|
@@ -4,15 +4,34 @@ import { useResolvedAppearance } from "./appearance-context.js";
|
|
|
4
4
|
import { Button } from "./button.js";
|
|
5
5
|
import { transitionTiming } from "./motion-style.js";
|
|
6
6
|
import { scale } from "./scale.js";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
import { Surface } from "./surface.js";
|
|
8
|
+
const HeaderContext = createContext(null);
|
|
9
|
+
function useHeader() {
|
|
10
|
+
const value = useContext(HeaderContext);
|
|
10
11
|
if (value === null)
|
|
11
|
-
throw new Error("
|
|
12
|
+
throw new Error("Window.Header parts require Window.Header");
|
|
12
13
|
return value;
|
|
13
14
|
}
|
|
15
|
+
const WindowRoot = forwardRef(function WindowRoot({ children, style, ...properties }, ref) {
|
|
16
|
+
return _jsx(Surface, { ...properties, ref: ref, style: {
|
|
17
|
+
display: "flex",
|
|
18
|
+
flexDirection: "column",
|
|
19
|
+
minWidth: 0,
|
|
20
|
+
minHeight: 0,
|
|
21
|
+
...style
|
|
22
|
+
}, children: children });
|
|
23
|
+
});
|
|
24
|
+
const WindowContent = forwardRef(function WindowContent({ style, ...properties }, ref) {
|
|
25
|
+
return _jsx("div", { ...properties, ref: ref, style: {
|
|
26
|
+
position: "relative",
|
|
27
|
+
flex: "1 1 auto",
|
|
28
|
+
minWidth: 0,
|
|
29
|
+
minHeight: 0,
|
|
30
|
+
...style
|
|
31
|
+
} });
|
|
32
|
+
});
|
|
14
33
|
/** The composable top region of a window; its enclosing Surface owns the material. */
|
|
15
|
-
|
|
34
|
+
const HeaderRoot = forwardRef(function HeaderRoot({ active = true, children, onPointerDown, style, ...properties }, ref) {
|
|
16
35
|
const resolved = useResolvedAppearance();
|
|
17
36
|
const spacing = resolved.appearance.spacing;
|
|
18
37
|
const state = {
|
|
@@ -22,7 +41,7 @@ export const WindowHeaderRoot = forwardRef(function WindowHeaderRoot({ active =
|
|
|
22
41
|
spacing,
|
|
23
42
|
transition: transitionTiming(resolved.transaction, resolved.preferences.animations)
|
|
24
43
|
};
|
|
25
|
-
return _jsx(
|
|
44
|
+
return _jsx(HeaderContext.Provider, { value: state, children: _jsx("div", { ...properties, ref: ref, onPointerDown: onPointerDown, style: {
|
|
26
45
|
boxSizing: "border-box",
|
|
27
46
|
display: "flex",
|
|
28
47
|
alignItems: "center",
|
|
@@ -38,8 +57,8 @@ export const WindowHeaderRoot = forwardRef(function WindowHeaderRoot({ active =
|
|
|
38
57
|
}, children: children }) });
|
|
39
58
|
});
|
|
40
59
|
/** The icon and truncating title share the window's active treatment. */
|
|
41
|
-
|
|
42
|
-
const { active, iconRadius, spacing, transition } =
|
|
60
|
+
const WindowIdentity = forwardRef(function WindowIdentity({ icon, title, style, ...properties }, ref) {
|
|
61
|
+
const { active, iconRadius, spacing, transition } = useHeader();
|
|
43
62
|
return _jsxs("div", { ...properties, ref: ref, style: {
|
|
44
63
|
...transition,
|
|
45
64
|
transitionProperty: "opacity",
|
|
@@ -66,13 +85,13 @@ export const WindowHeaderIdentity = forwardRef(function WindowHeaderIdentity({ i
|
|
|
66
85
|
}, children: title })] });
|
|
67
86
|
});
|
|
68
87
|
/** Optional flexible space for application-owned content. */
|
|
69
|
-
|
|
70
|
-
|
|
88
|
+
const WindowCenter = forwardRef(function WindowCenter({ onDoubleClick, onPointerDown, style, ...properties }, ref) {
|
|
89
|
+
useHeader();
|
|
71
90
|
return _jsx("div", { ...properties, ref: ref, onDoubleClick: event => { event.stopPropagation(); onDoubleClick?.(event); }, onPointerDown: event => { event.stopPropagation(); onPointerDown?.(event); }, style: { display: "flex", alignItems: "center", flex: "1 1 auto", minWidth: 0, ...style } });
|
|
72
91
|
});
|
|
73
92
|
/** End-aligned controls that do not begin a header drag or double-click action. */
|
|
74
|
-
|
|
75
|
-
const { spacing } =
|
|
93
|
+
const WindowActions = forwardRef(function WindowActions({ onDoubleClick, onPointerDown, style, ...properties }, ref) {
|
|
94
|
+
const { spacing } = useHeader();
|
|
76
95
|
return _jsx("div", { ...properties, ref: ref, onDoubleClick: event => { event.stopPropagation(); onDoubleClick?.(event); }, onPointerDown: event => { event.stopPropagation(); onPointerDown?.(event); }, style: {
|
|
77
96
|
display: "flex",
|
|
78
97
|
alignItems: "center",
|
|
@@ -83,31 +102,35 @@ export const WindowHeaderActions = forwardRef(function WindowHeaderActions({ onD
|
|
|
83
102
|
} });
|
|
84
103
|
});
|
|
85
104
|
/** A compact header action; extra actions use the same treatment as the standard controls. */
|
|
86
|
-
|
|
87
|
-
const { foreground } =
|
|
105
|
+
const WindowAction = forwardRef(function WindowAction({ style, ...properties }, ref) {
|
|
106
|
+
const { foreground } = useHeader();
|
|
88
107
|
return _jsx(Button, { ...properties, ref: ref, size: "xsmall", style: { color: foreground, ...style } });
|
|
89
108
|
});
|
|
90
|
-
|
|
91
|
-
return _jsx(
|
|
109
|
+
const WindowMinimize = forwardRef(function WindowMinimize({ "aria-label": label = "Minimize", preventFocusOnPress = true, ...properties }, ref) {
|
|
110
|
+
return _jsx(WindowAction, { ...properties, ref: ref, "aria-label": label, preventFocusOnPress: preventFocusOnPress, children: _jsx(ControlIcon, { children: _jsx("path", { d: "M1.5 7.5h7" }) }) });
|
|
92
111
|
});
|
|
93
|
-
|
|
94
|
-
return _jsx(
|
|
112
|
+
const WindowMaximize = forwardRef(function WindowMaximize({ "aria-label": label, maximized = false, ...properties }, ref) {
|
|
113
|
+
return _jsx(WindowAction, { ...properties, ref: ref, "aria-label": label ?? (maximized ? "Restore" : "Maximize"), children: _jsx(ControlIcon, { children: maximized
|
|
95
114
|
? _jsx("path", { d: "M1 4h5v5H1zM4 1h5v5H6.5", strokeWidth: "1.3", strokeLinejoin: "round" })
|
|
96
115
|
: _jsx("path", { d: "M1.5 1.5h7v7h-7z", strokeWidth: "1.3", strokeLinejoin: "round" }) }) });
|
|
97
116
|
});
|
|
98
|
-
|
|
99
|
-
return _jsx(
|
|
117
|
+
const WindowClose = forwardRef(function WindowClose({ "aria-label": label = "Close", preventFocusOnPress = true, ...properties }, ref) {
|
|
118
|
+
return _jsx(WindowAction, { ...properties, ref: ref, "aria-label": label, color: "danger:base", preventFocusOnPress: preventFocusOnPress, children: _jsx(ControlIcon, { children: _jsx("path", { d: "M1.5 1.5 8.5 8.5M8.5 1.5 1.5 8.5" }) }) });
|
|
100
119
|
});
|
|
101
120
|
function ControlIcon({ children }) {
|
|
102
121
|
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 });
|
|
103
122
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
123
|
+
const Header = Object.assign(HeaderRoot, {
|
|
124
|
+
Identity: WindowIdentity,
|
|
125
|
+
Center: WindowCenter,
|
|
126
|
+
Actions: WindowActions,
|
|
127
|
+
Action: WindowAction,
|
|
128
|
+
Minimize: WindowMinimize,
|
|
129
|
+
Maximize: WindowMaximize,
|
|
130
|
+
Close: WindowClose
|
|
131
|
+
});
|
|
132
|
+
/** One Surface with a ready-to-use header-and-content composition. */
|
|
133
|
+
export const Window = Object.assign(WindowRoot, {
|
|
134
|
+
Header,
|
|
135
|
+
Content: WindowContent
|
|
113
136
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@phreshos/react-ui",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.30",
|
|
4
4
|
"description": "React components for coherent PhreshOS Program interfaces.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
58
|
"@base-ui/react": "^1.7.0",
|
|
59
|
-
"@phreshos/core": "^0.1.
|
|
59
|
+
"@phreshos/core": "^0.1.55",
|
|
60
60
|
"colorjs.io": "^0.7.1",
|
|
61
61
|
"motion": "^13.2.0",
|
|
62
62
|
"react-aria-components": "^1.20.0"
|
package/dist/window-header.d.ts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import type { ComponentProps, HTMLAttributes, ReactNode } from "react";
|
|
2
|
-
import { type ButtonProps } from "./button.js";
|
|
3
|
-
export interface WindowHeaderRootProps extends HTMLAttributes<HTMLDivElement> {
|
|
4
|
-
/** Attenuates the identity when this header is not active. */
|
|
5
|
-
readonly active?: boolean;
|
|
6
|
-
}
|
|
7
|
-
/** The composable top region of a window; its enclosing Surface owns the material. */
|
|
8
|
-
export declare const WindowHeaderRoot: import("react").ForwardRefExoticComponent<WindowHeaderRootProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
9
|
-
export interface WindowHeaderIdentityProps extends Omit<HTMLAttributes<HTMLDivElement>, "title"> {
|
|
10
|
-
readonly icon?: string;
|
|
11
|
-
readonly title?: ReactNode;
|
|
12
|
-
}
|
|
13
|
-
/** The icon and truncating title share the window's active treatment. */
|
|
14
|
-
export declare const WindowHeaderIdentity: import("react").ForwardRefExoticComponent<WindowHeaderIdentityProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
15
|
-
export type WindowHeaderCenterProps = HTMLAttributes<HTMLDivElement>;
|
|
16
|
-
/** Optional flexible space for application-owned content. */
|
|
17
|
-
export declare const WindowHeaderCenter: import("react").ForwardRefExoticComponent<WindowHeaderCenterProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
18
|
-
export type WindowHeaderActionsProps = HTMLAttributes<HTMLDivElement>;
|
|
19
|
-
/** End-aligned controls that do not begin a header drag or double-click action. */
|
|
20
|
-
export declare const WindowHeaderActions: import("react").ForwardRefExoticComponent<WindowHeaderActionsProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
21
|
-
export type WindowHeaderActionProps = Omit<ButtonProps, "size">;
|
|
22
|
-
/** A compact header action; extra actions use the same treatment as the standard controls. */
|
|
23
|
-
export declare const WindowHeaderAction: import("react").ForwardRefExoticComponent<WindowHeaderActionProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
24
|
-
export type WindowHeaderControlProps = Omit<WindowHeaderActionProps, "children">;
|
|
25
|
-
export declare const WindowHeaderMinimize: import("react").ForwardRefExoticComponent<WindowHeaderControlProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
26
|
-
export interface WindowHeaderMaximizeProps extends WindowHeaderControlProps {
|
|
27
|
-
readonly maximized?: boolean;
|
|
28
|
-
}
|
|
29
|
-
export declare const WindowHeaderMaximize: import("react").ForwardRefExoticComponent<WindowHeaderMaximizeProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
30
|
-
export type WindowHeaderCloseProps = Omit<WindowHeaderControlProps, "color">;
|
|
31
|
-
export declare const WindowHeaderClose: import("react").ForwardRefExoticComponent<WindowHeaderCloseProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
32
|
-
export declare const WindowHeader: import("react").ForwardRefExoticComponent<WindowHeaderRootProps & import("react").RefAttributes<HTMLDivElement>> & {
|
|
33
|
-
Root: import("react").ForwardRefExoticComponent<WindowHeaderRootProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
34
|
-
Identity: import("react").ForwardRefExoticComponent<WindowHeaderIdentityProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
35
|
-
Center: import("react").ForwardRefExoticComponent<WindowHeaderCenterProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
36
|
-
Actions: import("react").ForwardRefExoticComponent<WindowHeaderActionsProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
37
|
-
Action: import("react").ForwardRefExoticComponent<WindowHeaderActionProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
38
|
-
Minimize: import("react").ForwardRefExoticComponent<WindowHeaderControlProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
39
|
-
Maximize: import("react").ForwardRefExoticComponent<WindowHeaderMaximizeProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
40
|
-
Close: import("react").ForwardRefExoticComponent<WindowHeaderCloseProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
41
|
-
};
|
|
42
|
-
export type WindowHeaderProps = ComponentProps<typeof WindowHeaderRoot>;
|