@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.
- 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 -25
- 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/menu.js
CHANGED
|
@@ -1,116 +1,70 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { createContext, forwardRef, useContext, useMemo } from "react";
|
|
3
3
|
import { Header as AriaHeader, Menu as AriaMenu, MenuItem as AriaMenuItem, MenuSection as AriaMenuSection, Separator as AriaSeparator } from "react-aria-components";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
4
|
+
import { useControlMetrics } from "./control/control.js";
|
|
5
|
+
import { separatorColor } from "./control/field.js";
|
|
6
|
+
import { itemStyle, itemSurface, SelectionMark } from "./control/item.js";
|
|
7
|
+
import { ariaSelection, stringKey } from "./control/selection.js";
|
|
8
|
+
import { surfaceRender } from "./control/surface-render.js";
|
|
9
|
+
import { collectionHeaderStyle } from "./list-box.js";
|
|
10
|
+
const MenuStyleContext = createContext(null);
|
|
11
|
+
const MenuRootImplementation = forwardRef(function Menu(properties, ref) {
|
|
12
|
+
const { className, closeOnSelect, color = "primary", defaultValue: _defaultValue, focusWrap, onAction, onChange: _onChange, radius, selectionMode = "none", size, style, value: _value, ...native } = properties;
|
|
13
|
+
const metrics = useControlMetrics(size, radius);
|
|
14
|
+
// Items are controls: they take the control radius at their size.
|
|
15
|
+
const itemRadius = metrics.radius;
|
|
16
|
+
const context = useMemo(() => ({ color, metrics, itemRadius, selecting: selectionMode !== "none" }), [color, metrics, itemRadius, selectionMode]);
|
|
17
|
+
const selection = ariaSelection(properties, "none");
|
|
18
|
+
return _jsx(MenuStyleContext.Provider, { value: context, children: _jsx(AriaMenu, { ...native, ...selection, selectionMode: selection.selectionMode === "none" ? undefined : selection.selectionMode, shouldCloseOnSelect: closeOnSelect, shouldFocusWrap: focusWrap, ref: ref, className: className, onAction: onAction == null ? undefined : key => onAction(stringKey(key)), style: {
|
|
13
19
|
display: "grid",
|
|
14
|
-
gap:
|
|
15
|
-
minWidth:
|
|
16
|
-
padding:
|
|
20
|
+
gap: 2,
|
|
21
|
+
minWidth: metrics.height * 5,
|
|
22
|
+
padding: metrics.listInset,
|
|
17
23
|
boxSizing: "border-box",
|
|
18
24
|
outline: "none",
|
|
19
25
|
fontFamily: "inherit",
|
|
20
|
-
fontSize:
|
|
26
|
+
fontSize: metrics.fontSize,
|
|
21
27
|
...style
|
|
22
28
|
} }) });
|
|
23
29
|
});
|
|
24
|
-
function
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
};
|
|
37
|
-
return {
|
|
38
|
-
...(selectedKeys !== undefined ? { selectedKeys } : {}),
|
|
39
|
-
...(defaultSelectedKeys !== undefined ? { defaultSelectedKeys } : {}),
|
|
40
|
-
...(onSelectionChange !== undefined ? { onSelectionChange } : {})
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
export const MenuRoot = MenuRootImplementation;
|
|
44
|
-
const MenuItemImplementation = forwardRef(function MenuItem({ className, color, disabled = false, style, ...properties }, ref) {
|
|
45
|
-
const inherited = useContext(MenuThemeContext);
|
|
46
|
-
const item = { className, disabled, properties, ref, style };
|
|
47
|
-
return inherited != null && color === undefined
|
|
48
|
-
? _jsx(MenuItemView, { ...item, theme: inherited.theme })
|
|
49
|
-
: _jsx(ResolvedMenuItem, { ...item, color: color ?? inherited?.color, size: inherited?.size });
|
|
30
|
+
const MenuItemImplementation = forwardRef(function MenuItem({ children, className, closeOnSelect, color, disabled = false, style, textValue, ...properties }, ref) {
|
|
31
|
+
const { color: inherited, metrics, itemRadius, selecting } = useMenuStyle();
|
|
32
|
+
const itemColor = color ?? inherited;
|
|
33
|
+
return _jsx(AriaMenuItem, { ...properties, shouldCloseOnSelect: closeOnSelect, ref: ref, textValue: textValue ?? (typeof children === "string" ? children : undefined), className: className, isDisabled: disabled, render: surfaceRender("div", state => itemSurface(metrics.visual, itemColor, {
|
|
34
|
+
selected: state.isSelected,
|
|
35
|
+
// Keyboard focus moves the highlight through a menu the way the pointer does;
|
|
36
|
+
// pointer-restored focus alone must not keep an item highlighted.
|
|
37
|
+
hovered: state.isHovered || state.isFocusVisible,
|
|
38
|
+
pressed: state.isPressed,
|
|
39
|
+
focusVisible: false,
|
|
40
|
+
disabled: state.isDisabled
|
|
41
|
+
}, itemRadius)), style: { ...itemStyle(metrics, disabled), ...style }, children: state => _jsxs(_Fragment, { children: [typeof children === "function" ? children(state) : children, selecting && _jsx(SelectionMark, { visible: state.isSelected })] }) });
|
|
50
42
|
});
|
|
51
|
-
function
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
function MenuItemView({ className, disabled, properties, ref, style, theme }) {
|
|
55
|
-
return _jsx(AriaMenuItem, { ...properties, ref: ref, className: className, isDisabled: disabled, style: state => {
|
|
56
|
-
const paint = state.isPressed
|
|
57
|
-
? theme.paints.palette.pressed
|
|
58
|
-
: state.isHovered || state.isSelected
|
|
59
|
-
? theme.paints.palette.hover
|
|
60
|
-
: { background: "transparent", color: "inherit" };
|
|
61
|
-
return {
|
|
62
|
-
...theme.transition,
|
|
63
|
-
display: "flex",
|
|
64
|
-
alignItems: "center",
|
|
65
|
-
justifyContent: "space-between",
|
|
66
|
-
gap: theme.gap,
|
|
67
|
-
minWidth: 0,
|
|
68
|
-
minHeight: theme.height,
|
|
69
|
-
paddingInline: Math.max(8, theme.spacing),
|
|
70
|
-
boxSizing: "border-box",
|
|
71
|
-
borderRadius: theme.radius,
|
|
72
|
-
outline: state.isFocusVisible ? `1px solid ${theme.focusColor}` : "none",
|
|
73
|
-
outlineOffset: 1,
|
|
74
|
-
cursor: disabled ? "not-allowed" : "pointer",
|
|
75
|
-
opacity: disabled ? controlOpacity.disabled : 1,
|
|
76
|
-
userSelect: "none",
|
|
77
|
-
...paint,
|
|
78
|
-
...style
|
|
79
|
-
};
|
|
80
|
-
} });
|
|
81
|
-
}
|
|
82
|
-
export const MenuItem = MenuItemImplementation;
|
|
83
|
-
export const MenuSection = AriaMenuSection;
|
|
84
|
-
export const MenuHeader = forwardRef(function MenuHeader({ style, ...properties }, ref) {
|
|
85
|
-
const theme = useMenuTheme();
|
|
86
|
-
return _jsx(AriaHeader, { ...properties, ref: ref, style: {
|
|
87
|
-
paddingInline: Math.max(8, theme.spacing),
|
|
88
|
-
paddingBlock: theme.gap,
|
|
89
|
-
fontWeight: controlFontWeight,
|
|
90
|
-
opacity: controlOpacity.secondary,
|
|
91
|
-
...style
|
|
92
|
-
} });
|
|
43
|
+
const MenuHeader = forwardRef(function MenuHeader({ style, ...properties }, ref) {
|
|
44
|
+
const { metrics } = useMenuStyle();
|
|
45
|
+
return _jsx(AriaHeader, { ...properties, ref: ref, style: collectionHeaderStyle(metrics, style) });
|
|
93
46
|
});
|
|
94
|
-
|
|
95
|
-
const
|
|
47
|
+
const MenuSeparator = forwardRef(function MenuSeparator({ style, ...properties }, ref) {
|
|
48
|
+
const { metrics } = useMenuStyle();
|
|
96
49
|
return _jsx(AriaSeparator, { ...properties, ref: ref, style: {
|
|
97
50
|
height: 1,
|
|
98
|
-
marginBlock:
|
|
51
|
+
marginBlock: 4,
|
|
52
|
+
marginInline: metrics.inset,
|
|
99
53
|
border: 0,
|
|
100
|
-
background:
|
|
54
|
+
background: separatorColor(metrics),
|
|
101
55
|
...style
|
|
102
56
|
} });
|
|
103
57
|
});
|
|
104
|
-
function
|
|
105
|
-
const
|
|
106
|
-
if (
|
|
58
|
+
function useMenuStyle() {
|
|
59
|
+
const context = useContext(MenuStyleContext);
|
|
60
|
+
if (context == null)
|
|
107
61
|
throw new Error("Menu parts must be used inside Menu");
|
|
108
|
-
return
|
|
62
|
+
return context;
|
|
109
63
|
}
|
|
110
64
|
/** A keyboard-navigable collection of commands or selectable options. */
|
|
111
|
-
export const Menu = Object.assign(
|
|
112
|
-
Item:
|
|
113
|
-
Section:
|
|
65
|
+
export const Menu = Object.assign(MenuRootImplementation, {
|
|
66
|
+
Item: MenuItemImplementation,
|
|
67
|
+
Section: AriaMenuSection,
|
|
114
68
|
Header: MenuHeader,
|
|
115
69
|
Separator: MenuSeparator
|
|
116
70
|
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { NumberFieldProps as AriaNumberFieldProps } from "react-aria-components";
|
|
2
|
+
import { type ControlOverrides, type ControlProps, type FieldProps } from "./control/control.js";
|
|
3
|
+
import type { RadiusProps } from "./foundation/radius.js";
|
|
4
|
+
import type { MaterialOverrides } from "./surface/material-options.js";
|
|
5
|
+
export interface NumberFieldProps extends Omit<AriaNumberFieldProps, ControlOverrides | "value" | "defaultValue" | "onChange" | "className" | "style">, ControlProps, FieldProps, RadiusProps, MaterialOverrides {
|
|
6
|
+
/** A number, or `null` while the field is empty. */
|
|
7
|
+
readonly value?: number | null;
|
|
8
|
+
readonly defaultValue?: number | null;
|
|
9
|
+
readonly onChange?: (value: number | null) => void;
|
|
10
|
+
readonly placeholder?: string;
|
|
11
|
+
readonly readOnly?: boolean;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* A number typed or stepped within a range. It is formatted by the locale and
|
|
15
|
+
* `formatOptions`, such as a unit, and checked against its range on blur.
|
|
16
|
+
*/
|
|
17
|
+
export declare const NumberField: import("react").ForwardRefExoticComponent<NumberFieldProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { Group, Input as AriaInput, NumberField as AriaNumberField } from "react-aria-components";
|
|
4
|
+
import { Minus, Plus } from "lucide-react";
|
|
5
|
+
import { useControlMetrics } from "./control/control.js";
|
|
6
|
+
import { FieldButton } from "./control/field-button.js";
|
|
7
|
+
import { FieldFeedback, FieldLabel, fieldStyle } from "./control/field.js";
|
|
8
|
+
import { iconProps } from "./control/icon.js";
|
|
9
|
+
import { surfaceRender } from "./control/surface-render.js";
|
|
10
|
+
import { nativeTextStyle } from "./control/text-control.js";
|
|
11
|
+
import MotionStyle, { textControlClass } from "./foundation/motion-style.js";
|
|
12
|
+
import { dimmedClass } from "./surface/surface.js";
|
|
13
|
+
/**
|
|
14
|
+
* A number typed or stepped within a range. It is formatted by the locale and
|
|
15
|
+
* `formatOptions`, such as a unit, and checked against its range on blur.
|
|
16
|
+
*/
|
|
17
|
+
export const NumberField = forwardRef(function NumberField({ label, description, errorMessage, disabled, readOnly, required, invalid, value, defaultValue, onChange, size, color = "background", radius, style, className, placeholder, material, ...properties }, ref) {
|
|
18
|
+
const metrics = useControlMetrics(size, radius);
|
|
19
|
+
// React Aria spells an empty number as NaN; React UI spells it as null.
|
|
20
|
+
const number = (next) => next === null ? Number.NaN : next;
|
|
21
|
+
return _jsxs(AriaNumberField, { ...properties, ...(value !== undefined ? { value: number(value) } : {}), ...(defaultValue !== undefined ? { defaultValue: number(defaultValue) } : {}), onChange: next => onChange?.(Number.isNaN(next) ? null : next), className: dimmedClass(disabled ?? false, className), isDisabled: disabled, isReadOnly: readOnly, isRequired: required, isInvalid: invalid, style: fieldStyle(metrics, style), children: [_jsx(MotionStyle, {}), _jsx(FieldLabel, { label: label }), _jsxs(Group, { render: surfaceRender("div", group => ({
|
|
22
|
+
color,
|
|
23
|
+
depth: "recessed",
|
|
24
|
+
material,
|
|
25
|
+
radius: metrics.radius,
|
|
26
|
+
interaction: { hovered: group.isHovered, focusVisible: group.isFocusWithin, invalid: group.isInvalid, disabled: group.isDisabled }
|
|
27
|
+
})), style: { display: "grid", gridTemplateColumns: "minmax(0, 1fr) auto auto", alignItems: "center", minWidth: 0, height: metrics.height, paddingInlineEnd: 4 }, children: [_jsx(AriaInput, { ref: ref, placeholder: placeholder, className: textControlClass, style: { ...nativeTextStyle(metrics, false), paddingInlineEnd: metrics.gap, fontVariantNumeric: "tabular-nums" } }), _jsx(FieldButton, { slot: "decrement", metrics: metrics, children: _jsx(Minus, { ...iconProps(14) }) }), _jsx(FieldButton, { slot: "increment", metrics: metrics, children: _jsx(Plus, { ...iconProps(14) }) })] }), _jsx(FieldFeedback, { metrics: metrics, description: description, errorMessage: errorMessage })] });
|
|
28
|
+
});
|
package/dist/panel.d.ts
CHANGED
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
import type { ComponentProps, HTMLAttributes } from "react";
|
|
2
|
-
import { type SurfaceProps } from "./surface.js";
|
|
3
|
-
/** Optional
|
|
2
|
+
import { type SurfaceProps } from "./surface/surface.js";
|
|
3
|
+
/** Optional heading placed before the inset Panel content. */
|
|
4
4
|
export type PanelHeaderProps = HTMLAttributes<HTMLDivElement>;
|
|
5
5
|
export declare const PanelHeader: import("react").ForwardRefExoticComponent<PanelHeaderProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
6
|
-
/** The
|
|
6
|
+
/** The raised, frosted shell that owns a Panel's vertical composition. */
|
|
7
7
|
export type PanelRootProps = SurfaceProps;
|
|
8
8
|
export declare const PanelRoot: import("react").ForwardRefExoticComponent<Omit<PanelRootProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
9
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
* The inset region that holds a Panel's content. It is the Panel's own color,
|
|
11
|
+
* raised, with a more solid material than the frosted shell, so recessed
|
|
12
|
+
* fields inside it stand out. It sits `small` spacing inside the frame and
|
|
13
|
+
* pads its content by the Appearance spacing.
|
|
14
|
+
*/
|
|
10
15
|
export type PanelContentProps = SurfaceProps;
|
|
11
16
|
export declare const PanelContent: import("react").ForwardRefExoticComponent<Omit<PanelContentProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
12
|
-
/** A
|
|
17
|
+
/** A raised shell with an optional header and one inset content region. */
|
|
13
18
|
export declare const Panel: import("react").ForwardRefExoticComponent<Omit<PanelRootProps, "ref"> & import("react").RefAttributes<HTMLDivElement>> & {
|
|
14
19
|
Header: import("react").ForwardRefExoticComponent<PanelHeaderProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
15
20
|
Content: import("react").ForwardRefExoticComponent<Omit<PanelContentProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
package/dist/panel.js
CHANGED
|
@@ -1,18 +1,34 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Children, createContext, forwardRef, isValidElement, useContext } from "react";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
3
|
+
import { controlFontSizes, controlFontWeight } from "./control/control.js";
|
|
4
|
+
import { headerHeight } from "./foundation/layout.js";
|
|
5
|
+
import { resolveRadius } from "./foundation/radius.js";
|
|
6
|
+
import { scale } from "./foundation/scale.js";
|
|
7
|
+
import { useVisual } from "./foundation/visual.js";
|
|
8
|
+
import { paintClass, paintClassesAvailable } from "./surface/paint-class.js";
|
|
9
|
+
import { Surface } from "./surface/surface.js";
|
|
10
|
+
const PanelContext = createContext({ color: undefined, hasHeader: false, radius: undefined });
|
|
7
11
|
export const PanelHeader = forwardRef(function PanelHeader({ style, ...properties }, ref) {
|
|
12
|
+
const { spacing } = useVisual();
|
|
13
|
+
// The same header row as a Window: its height and its side padding.
|
|
8
14
|
return _jsx("div", { ...properties, ref: ref, style: {
|
|
15
|
+
boxSizing: "border-box",
|
|
16
|
+
// A grid keeps the header's content full width and centers it in the row.
|
|
17
|
+
display: "grid",
|
|
18
|
+
alignContent: "center",
|
|
9
19
|
minWidth: 0,
|
|
20
|
+
minHeight: headerHeight(spacing),
|
|
21
|
+
paddingInline: spacing,
|
|
22
|
+
fontSize: controlFontSizes.medium,
|
|
23
|
+
fontWeight: controlFontWeight,
|
|
10
24
|
...style
|
|
11
25
|
} });
|
|
12
26
|
});
|
|
13
|
-
export const PanelRoot = forwardRef(function
|
|
27
|
+
export const PanelRoot = forwardRef(function Panel({ children, style, ...properties }, ref) {
|
|
14
28
|
const hasHeader = Children.toArray(children).some(child => isValidElement(child) && child.type === PanelHeader);
|
|
15
|
-
|
|
29
|
+
// The shell and its content share one radius: the Appearance radius.
|
|
30
|
+
const radius = resolveRadius(properties.radius ?? "medium", useVisual().radius);
|
|
31
|
+
return _jsx(PanelContext.Provider, { value: { color: properties.color, hasHeader, radius }, children: _jsx(Surface, { material: "full", ...properties, ref: ref, radius: radius, style: {
|
|
16
32
|
display: "grid",
|
|
17
33
|
gridTemplateRows: hasHeader ? "auto minmax(0, 1fr)" : "minmax(0, 1fr)",
|
|
18
34
|
minWidth: 0,
|
|
@@ -21,11 +37,16 @@ export const PanelRoot = forwardRef(function PanelRoot({ children, style, ...pro
|
|
|
21
37
|
...style
|
|
22
38
|
}, children: children }) });
|
|
23
39
|
});
|
|
24
|
-
export const PanelContent = forwardRef(function PanelContent({ style, ...properties }, ref) {
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
40
|
+
export const PanelContent = forwardRef(function PanelContent({ className, style, ...properties }, ref) {
|
|
41
|
+
const { spacing } = useVisual();
|
|
42
|
+
const inset = scale(spacing, "small");
|
|
43
|
+
const padding = scale(spacing, "medium");
|
|
44
|
+
const { color, hasHeader, radius } = useContext(PanelContext);
|
|
45
|
+
// A zero-specificity class keeps the padding a default: any consumer class
|
|
46
|
+
// or style still sets its own.
|
|
47
|
+
const padded = paintClassesAvailable ? paintClass(`padding: ${padding}px`) : undefined;
|
|
48
|
+
return _jsx(Surface, { color: color, material: "extended", radius: radius, ...properties, ref: ref, className: [padded, className].filter(Boolean).join(" ") || undefined, style: {
|
|
49
|
+
...(padded === undefined ? { padding } : {}),
|
|
29
50
|
minWidth: 0,
|
|
30
51
|
minHeight: 0,
|
|
31
52
|
margin: inset,
|
|
@@ -34,7 +55,7 @@ export const PanelContent = forwardRef(function PanelContent({ style, ...propert
|
|
|
34
55
|
...style
|
|
35
56
|
} });
|
|
36
57
|
});
|
|
37
|
-
/** A
|
|
58
|
+
/** A raised shell with an optional header and one inset content region. */
|
|
38
59
|
export const Panel = Object.assign(PanelRoot, {
|
|
39
60
|
Header: PanelHeader,
|
|
40
61
|
Content: PanelContent
|
package/dist/popover.d.ts
CHANGED
|
@@ -1,14 +1,24 @@
|
|
|
1
1
|
import type { ComponentProps, CSSProperties, ReactNode } from "react";
|
|
2
|
-
import type { DialogProps as AriaDialogProps,
|
|
2
|
+
import type { DialogProps as AriaDialogProps, HeadingProps as AriaHeadingProps, PopoverProps as AriaPopoverProps } 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 PopoverRootProps = OverlayRootProps;
|
|
8
|
+
export declare function PopoverRoot({ children, ...state }: PopoverRootProps): import("react").JSX.Element;
|
|
7
9
|
export type PopoverTriggerProps = ButtonProps;
|
|
8
10
|
export declare const PopoverTrigger: import("react").ForwardRefExoticComponent<ButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
9
|
-
|
|
11
|
+
/**
|
|
12
|
+
* The floating Surface of an overlay. Its open state belongs to the family
|
|
13
|
+
* root, so this part takes placement, its own Surface, and ordinary element
|
|
14
|
+
* attributes.
|
|
15
|
+
*/
|
|
16
|
+
export interface PopoverContentProps extends Omit<AriaPopoverProps, AriaOverlayInternals | "children" | "className" | "color" | "style" | "dir">, SurfaceOwnProps {
|
|
10
17
|
readonly children?: ReactNode;
|
|
11
18
|
readonly className?: string;
|
|
19
|
+
readonly dir?: Direction;
|
|
20
|
+
/** DOM container that owns the positioned overlay's coordinate space. */
|
|
21
|
+
readonly portalContainer?: Element;
|
|
12
22
|
readonly style?: CSSProperties;
|
|
13
23
|
}
|
|
14
24
|
export declare const PopoverContent: import("react").ForwardRefExoticComponent<PopoverContentProps & import("react").RefAttributes<HTMLElement>>;
|
|
@@ -18,6 +28,10 @@ export type PopoverTitleProps = AriaHeadingProps;
|
|
|
18
28
|
export declare const PopoverTitle: import("react").ForwardRefExoticComponent<AriaHeadingProps & import("react").RefAttributes<HTMLHeadingElement>>;
|
|
19
29
|
export type PopoverCloseProps = ButtonProps;
|
|
20
30
|
export declare const PopoverClose: import("react").ForwardRefExoticComponent<ButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
31
|
+
/** Positioned content that holds a Menu; it keeps the Appearance radius like every shell. */
|
|
32
|
+
export declare const MenuContent: import("react").ForwardRefExoticComponent<PopoverContentProps & Readonly<{
|
|
33
|
+
nonModal?: boolean;
|
|
34
|
+
}> & import("react").RefAttributes<HTMLElement>>;
|
|
21
35
|
/** An anchored non-modal overlay with explicit trigger, surface, and dialog roles. */
|
|
22
36
|
export declare const Popover: typeof PopoverRoot & {
|
|
23
37
|
Trigger: import("react").ForwardRefExoticComponent<ButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
|
package/dist/popover.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 { Dialog as AriaDialog, DialogTrigger as AriaDialogTrigger, Heading as AriaHeading, Popover as AriaPopover } from "react-aria-components";
|
|
4
|
-
import { useResolvedAppearance } from "./appearance-context.js";
|
|
5
4
|
import { Button } from "./button.js";
|
|
6
|
-
import { controlFontSizes, controlFontWeight } from "./control.js";
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
|
|
5
|
+
import { controlFontSizes, controlFontWeight } 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 PopoverRoot({ children, ...state }) {
|
|
15
|
+
return _jsx(AriaDialogTrigger, { ...ariaOpenState(state), children: children });
|
|
14
16
|
}
|
|
15
17
|
export const PopoverTrigger = forwardRef(function PopoverTrigger(properties, ref) {
|
|
16
18
|
return _jsx(Button, { ...properties, ref: ref });
|
|
17
19
|
});
|
|
18
|
-
|
|
19
|
-
const
|
|
20
|
-
const inset = scale(
|
|
21
|
-
const transition = overlayTransition(
|
|
22
|
-
const direction = resolveDirection(
|
|
23
|
-
return _jsxs(_Fragment, { children: [_jsx(MotionStyle, {}), _jsx(AriaPopover, { ...
|
|
20
|
+
const PositionedContent = forwardRef(function PositionedContent({ children, className, color, material, radius, shadow, style, offset, placement = "bottom", nonModal, dir, portalContainer, ...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(AriaPopover, { ...attributes, isNonModal: nonModal, ref: ref, dir: direction, offset: offset ?? inset, placement: resolveDirectionalPlacement(placement, direction), UNSTABLE_portalContainer: portalContainer, className: overlayMotionClass, style: transition, children: _jsx(Surface, { dir: direction, className: className, color: color, material: material, shadow: shadow ?? floatingShadow(visual.shadow), radius: radius, style: {
|
|
24
26
|
boxSizing: "border-box",
|
|
25
27
|
maxWidth: `calc(100vw - ${inset * 2}px)`,
|
|
26
28
|
maxHeight: `calc(100vh - ${inset * 2}px)`,
|
|
@@ -28,6 +30,9 @@ export const PopoverContent = forwardRef(function PopoverContent({ children, cla
|
|
|
28
30
|
...style
|
|
29
31
|
}, children: children }) })] });
|
|
30
32
|
});
|
|
33
|
+
export const PopoverContent = forwardRef(function PopoverContent(properties, ref) {
|
|
34
|
+
return _jsx(PositionedContent, { ...properties, ref: ref });
|
|
35
|
+
});
|
|
31
36
|
export const PopoverDialog = forwardRef(function PopoverDialog({ style, ...properties }, ref) {
|
|
32
37
|
return _jsx(AriaDialog, { ...properties, ref: ref, style: { minWidth: 0, outline: "none", ...style } });
|
|
33
38
|
});
|
|
@@ -47,6 +52,8 @@ export const PopoverTitle = forwardRef(function PopoverTitle({ style, ...propert
|
|
|
47
52
|
export const PopoverClose = forwardRef(function PopoverClose(properties, ref) {
|
|
48
53
|
return _jsx(Button, { ...properties, ref: ref, slot: "close" });
|
|
49
54
|
});
|
|
55
|
+
/** Positioned content that holds a Menu; it keeps the Appearance radius like every shell. */
|
|
56
|
+
export const MenuContent = PositionedContent;
|
|
50
57
|
/** An anchored non-modal overlay with explicit trigger, surface, and dialog roles. */
|
|
51
58
|
export const Popover = Object.assign(PopoverRoot, {
|
|
52
59
|
Trigger: PopoverTrigger,
|
package/dist/progress-bar.d.ts
CHANGED
|
@@ -1,22 +1,20 @@
|
|
|
1
1
|
import type { CSSProperties, ReactNode } from "react";
|
|
2
2
|
import type { ProgressBarProps as AriaProgressBarProps } from "react-aria-components";
|
|
3
|
-
import type
|
|
4
|
-
import type { ScaleLevel } from "./scale.js";
|
|
3
|
+
import { type Color } from "./foundation/color.js";
|
|
4
|
+
import type { ScaleLevel } from "./foundation/scale.js";
|
|
5
|
+
import type { MaterialOverrides } from "./surface/material-options.js";
|
|
5
6
|
type NativeProgressBarProps = Omit<AriaProgressBarProps, "children" | "className" | "isIndeterminate" | "style">;
|
|
6
|
-
export interface ProgressBarProps extends NativeProgressBarProps {
|
|
7
|
-
/** Native class name applied without replacing the component contract. */
|
|
7
|
+
export interface ProgressBarProps extends NativeProgressBarProps, MaterialOverrides {
|
|
8
8
|
readonly className?: string;
|
|
9
|
-
/** Color
|
|
10
|
-
readonly color?:
|
|
11
|
-
/**
|
|
9
|
+
/** Color of the completed or moving portion. */
|
|
10
|
+
readonly color?: Color;
|
|
11
|
+
/** Shows progress without asserting a current value. */
|
|
12
12
|
readonly indeterminate?: boolean;
|
|
13
13
|
/** Visible label associated with the progress value. */
|
|
14
14
|
readonly label?: ReactNode;
|
|
15
|
-
/** Derives typography and track thickness from Appearance. */
|
|
16
15
|
readonly size?: ScaleLevel;
|
|
17
|
-
/** Native styles applied after ProgressBar defaults. */
|
|
18
16
|
readonly style?: CSSProperties;
|
|
19
17
|
}
|
|
20
|
-
/**
|
|
18
|
+
/** Progress over time: a recessed rail filled in the owner's color. */
|
|
21
19
|
export declare const ProgressBar: import("react").ForwardRefExoticComponent<ProgressBarProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
22
20
|
export {};
|
package/dist/progress-bar.js
CHANGED
|
@@ -1,46 +1,30 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
3
|
import { Label, ProgressBar as AriaProgressBar } from "react-aria-components";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
return _jsx(AriaProgressBar, { ...properties, ref: ref, className: className, value: value, minValue: minValue, maxValue: maxValue, isIndeterminate: indeterminate, style: {
|
|
17
|
-
...fieldStyle(theme, false),
|
|
18
|
-
width: "100%",
|
|
19
|
-
...style
|
|
20
|
-
}, children: state => {
|
|
4
|
+
import { controlFontWeight, controlOpacity, transition, useControlMetrics } from "./control/control.js";
|
|
5
|
+
import { fieldStyle } from "./control/field.js";
|
|
6
|
+
import { resolveColor } from "./foundation/color.js";
|
|
7
|
+
import MotionStyle from "./foundation/motion-style.js";
|
|
8
|
+
import { SurfaceView } from "./surface/surface.js";
|
|
9
|
+
/** Progress over time: a recessed rail filled in the owner's color. */
|
|
10
|
+
export const ProgressBar = forwardRef(function ProgressBar({ className, color = "primary", indeterminate = false, label, material, size, style, value, minValue = 0, maxValue = 100, ...properties }, ref) {
|
|
11
|
+
const metrics = useControlMetrics(size);
|
|
12
|
+
const thickness = Math.max(4, Math.round(metrics.spacing / 2));
|
|
13
|
+
const fill = resolveColor(color, metrics.visual.colors);
|
|
14
|
+
const moving = indeterminate && metrics.visual.duration > 0;
|
|
15
|
+
return _jsx(AriaProgressBar, { ...properties, ref: ref, className: className, value: value, minValue: minValue, maxValue: maxValue, isIndeterminate: indeterminate, style: fieldStyle(metrics, { width: "100%", ...style }), children: state => {
|
|
21
16
|
const output = properties.valueLabel ?? state.valueText;
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
position: "relative",
|
|
26
|
-
display: "block",
|
|
27
|
-
width: "100%",
|
|
28
|
-
height: thickness,
|
|
29
|
-
overflow: "hidden",
|
|
30
|
-
borderRadius: thickness,
|
|
31
|
-
background: theme.paints.subtle.rest.background
|
|
32
|
-
}, children: _jsx(motion.span, { "data-progress-fill": "", initial: false, animate: { x: moving ? sweep : "0%" }, transition: moving
|
|
33
|
-
? { ...theme.motionTransition, duration, repeat: Infinity }
|
|
34
|
-
: theme.motionTransition, style: {
|
|
35
|
-
...theme.transition,
|
|
17
|
+
const heading = label != null || (!state.isIndeterminate && output != null);
|
|
18
|
+
return _jsxs(_Fragment, { children: [_jsx(MotionStyle, {}), heading && _jsxs("span", { style: { display: "flex", alignItems: "baseline", justifyContent: "space-between", gap: metrics.gap }, children: [label != null && _jsx(Label, { style: { fontWeight: controlFontWeight }, children: label }), !state.isIndeterminate && output != null && _jsx("span", { style: { fontVariantNumeric: "tabular-nums", opacity: controlOpacity.secondary }, children: output })] }), _jsx(SurfaceView, { as: "span", "aria-hidden": "true", "data-progress-track": "", color: "background", depth: "recessed", material: material, radius: "full", style: { display: "block", height: thickness, overflow: "hidden" }, children: _jsx("span", { "data-progress-fill": "", style: {
|
|
19
|
+
...transition(metrics.visual, "width", 1.5),
|
|
36
20
|
position: "absolute",
|
|
37
21
|
insetBlock: 0,
|
|
38
|
-
insetInlineStart: state.isIndeterminate
|
|
22
|
+
insetInlineStart: state.isIndeterminate ? "30%" : 0,
|
|
39
23
|
display: "block",
|
|
40
24
|
width: state.isIndeterminate ? "40%" : `${state.percentage ?? 0}%`,
|
|
41
25
|
borderRadius: "inherit",
|
|
42
|
-
background:
|
|
43
|
-
|
|
26
|
+
background: fill,
|
|
27
|
+
animation: moving ? `phreshos-ui-sweep ${Math.max(900, metrics.visual.appearance.transaction.duration * 8)}ms ${metrics.visual.easing} infinite` : undefined
|
|
44
28
|
} }) })] });
|
|
45
29
|
} });
|
|
46
30
|
});
|
package/dist/radio.d.ts
CHANGED
|
@@ -1,21 +1,24 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { RadioGroupProps as
|
|
3
|
-
import type
|
|
4
|
-
import type {
|
|
5
|
-
|
|
6
|
-
import type { ShadowOverrides } from "./shadow-options.js";
|
|
7
|
-
export interface RadioGroupProps extends Omit<BaseRadioGroupProps<string | null>, "children" | "className" | "defaultValue" | "disabled" | "onChange" | "onValueChange" | "readOnly" | "required" | "style" | "value">, ControlProps, FieldProps, MaterialOverrides, ShadowOverrides {
|
|
1
|
+
import type { CSSProperties, ReactNode } from "react";
|
|
2
|
+
import type { RadioFieldProps, RadioGroupProps as AriaRadioGroupProps } from "react-aria-components";
|
|
3
|
+
import { type ControlOverrides, type ControlProps, type FieldProps } from "./control/control.js";
|
|
4
|
+
import type { MaterialOverrides } from "./surface/material-options.js";
|
|
5
|
+
export interface RadioGroupProps extends Omit<AriaRadioGroupProps, ControlOverrides | "value" | "defaultValue" | "onChange">, ControlProps, FieldProps, MaterialOverrides {
|
|
8
6
|
readonly children: ReactNode;
|
|
9
7
|
readonly value?: string | null;
|
|
10
8
|
readonly defaultValue?: string | null;
|
|
9
|
+
/** Receives the newly selected value; a radio selection cannot be cleared. */
|
|
11
10
|
readonly onChange?: (value: string) => void;
|
|
12
11
|
readonly readOnly?: boolean;
|
|
13
|
-
readonly orientation?: "horizontal" | "vertical";
|
|
14
12
|
}
|
|
15
|
-
export interface RadioGroupItemProps extends Omit<
|
|
13
|
+
export interface RadioGroupItemProps extends Omit<RadioFieldProps, "children" | "className" | "isDisabled" | "style" | "value"> {
|
|
16
14
|
readonly value: string;
|
|
15
|
+
readonly label?: ReactNode;
|
|
16
|
+
readonly description?: ReactNode;
|
|
17
|
+
readonly disabled?: boolean;
|
|
18
|
+
readonly className?: string;
|
|
19
|
+
readonly style?: CSSProperties;
|
|
17
20
|
}
|
|
18
|
-
/** One exclusive-choice field whose
|
|
19
|
-
export declare const RadioGroup: import("react").ForwardRefExoticComponent<
|
|
20
|
-
Item: import("react").ForwardRefExoticComponent<
|
|
21
|
+
/** One exclusive-choice field whose options are its Items. */
|
|
22
|
+
export declare const RadioGroup: import("react").ForwardRefExoticComponent<RadioGroupProps & import("react").RefAttributes<HTMLDivElement>> & {
|
|
23
|
+
Item: import("react").ForwardRefExoticComponent<RadioGroupItemProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
21
24
|
};
|