@phreshos/react-ui 0.1.36 → 0.1.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +147 -167
- package/dist/accordion.d.ts +7 -6
- package/dist/accordion.js +5 -5
- package/dist/alert-dialog.d.ts +2 -2
- 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 +31 -27
- package/dist/button.js +48 -40
- 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 +37 -0
- package/dist/control/item.js +57 -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 +29 -15
- 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 +11 -8
- 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} +9 -5
- package/dist/{ui-provider.js → foundation/provider.js} +18 -27
- 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 +28 -17
- 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 +26 -12
- 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 +13 -0
- package/dist/surface/paint-class.js +47 -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 +80 -0
- package/dist/surface/surface.js +239 -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 +17 -8
- package/dist/tooltip.js +17 -15
- package/dist/tree.d.ts +22 -27
- package/dist/tree.js +54 -99
- package/dist/window.d.ts +4 -4
- 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
|
@@ -1,7 +1,32 @@
|
|
|
1
|
-
import { createContext, useContext,
|
|
1
|
+
import { createContext, useContext, useSyncExternalStore } from "react";
|
|
2
2
|
import { defaultAppearance } from "./appearance.js";
|
|
3
|
+
const visuals = new WeakMap();
|
|
4
|
+
/** Resolves and memoizes one Visual per Appearance, Theme, and animation preference. */
|
|
5
|
+
export function resolveVisual(appearance, preferences) {
|
|
6
|
+
let resolved = visuals.get(appearance);
|
|
7
|
+
if (resolved === undefined)
|
|
8
|
+
visuals.set(appearance, resolved = new Map());
|
|
9
|
+
const key = `${preferences.theme}:${preferences.animations}`;
|
|
10
|
+
const cached = resolved.get(key);
|
|
11
|
+
if (cached !== undefined)
|
|
12
|
+
return cached;
|
|
13
|
+
const duration = preferences.animations ? appearance.transaction.duration : 0;
|
|
14
|
+
const visual = Object.freeze({
|
|
15
|
+
appearance,
|
|
16
|
+
preferences,
|
|
17
|
+
colors: appearance.colors[preferences.theme],
|
|
18
|
+
material: appearance.material[preferences.theme],
|
|
19
|
+
shadow: appearance.shadow[preferences.theme],
|
|
20
|
+
spacing: appearance.spacing,
|
|
21
|
+
radius: appearance.radius,
|
|
22
|
+
duration,
|
|
23
|
+
easing: cssEasing(appearance.transaction.easing)
|
|
24
|
+
});
|
|
25
|
+
resolved.set(key, visual);
|
|
26
|
+
return visual;
|
|
27
|
+
}
|
|
3
28
|
export const AppearanceContext = createContext(defaultAppearance);
|
|
4
|
-
/** Returns the nearest
|
|
29
|
+
/** Returns the nearest Appearance, or React UI's default. */
|
|
5
30
|
export function useAppearance() {
|
|
6
31
|
return useContext(AppearanceContext);
|
|
7
32
|
}
|
|
@@ -10,35 +35,29 @@ export function usePreferences() {
|
|
|
10
35
|
const source = useContext(PreferencesContext);
|
|
11
36
|
return useSyncExternalStore(source.subscribe, source.getSnapshot, source.getServerSnapshot);
|
|
12
37
|
}
|
|
13
|
-
/**
|
|
14
|
-
export function
|
|
15
|
-
return
|
|
38
|
+
/** Returns the shared resolved Visual for the nearest Appearance and Preferences. */
|
|
39
|
+
export function useVisual() {
|
|
40
|
+
return resolveVisual(useAppearance(), usePreferences());
|
|
16
41
|
}
|
|
17
|
-
/** Selects the active branch of one
|
|
42
|
+
/** Selects the active branch of one themed value. */
|
|
18
43
|
export function useThemedValue(value) {
|
|
19
44
|
return value[usePreferences().theme];
|
|
20
45
|
}
|
|
21
|
-
/**
|
|
22
|
-
export function
|
|
23
|
-
|
|
24
|
-
const preferences = usePreferences();
|
|
25
|
-
return useMemo(() => ({
|
|
26
|
-
appearance,
|
|
27
|
-
preferences,
|
|
28
|
-
colors: appearance.colors[preferences.theme],
|
|
29
|
-
material: appearance.material[preferences.theme],
|
|
30
|
-
shadow: appearance.shadow[preferences.theme],
|
|
31
|
-
transaction: appearance.transaction
|
|
32
|
-
}), [appearance, preferences]);
|
|
46
|
+
/** Reactively reads the browser's complete visual preferences. */
|
|
47
|
+
export function useBrowserPreferences() {
|
|
48
|
+
return useSyncExternalStore(browserPreferencesSource.subscribe, browserPreferencesSource.getSnapshot, browserPreferencesSource.getServerSnapshot);
|
|
33
49
|
}
|
|
34
|
-
/** Creates a stable source for
|
|
50
|
+
/** Creates a stable source for one explicitly supplied Preferences value. */
|
|
35
51
|
export function fixedPreferencesSource(preferences) {
|
|
36
52
|
return {
|
|
37
53
|
getSnapshot: () => preferences,
|
|
38
54
|
getServerSnapshot: () => preferences,
|
|
39
|
-
subscribe:
|
|
55
|
+
subscribe: () => () => undefined
|
|
40
56
|
};
|
|
41
57
|
}
|
|
58
|
+
export function cssEasing(easing) {
|
|
59
|
+
return typeof easing === "string" ? easing : `cubic-bezier(${easing.join(", ")})`;
|
|
60
|
+
}
|
|
42
61
|
const defaultPreferences = Object.freeze({ theme: "light", animations: true });
|
|
43
62
|
const subscribers = new Set();
|
|
44
63
|
let darkPreference;
|
|
@@ -47,8 +66,8 @@ let browserSnapshot = defaultPreferences;
|
|
|
47
66
|
function readBrowserPreferences() {
|
|
48
67
|
if (typeof window === "undefined" || typeof window.matchMedia !== "function")
|
|
49
68
|
return defaultPreferences;
|
|
50
|
-
darkPreference ??= window.matchMedia(
|
|
51
|
-
reducedMotionPreference ??= window.matchMedia(
|
|
69
|
+
darkPreference ??= window.matchMedia("(prefers-color-scheme: dark)");
|
|
70
|
+
reducedMotionPreference ??= window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
52
71
|
const theme = darkPreference.matches ? "dark" : "light";
|
|
53
72
|
const animations = !reducedMotionPreference.matches;
|
|
54
73
|
if (browserSnapshot.theme !== theme || browserSnapshot.animations !== animations) {
|
|
@@ -78,14 +97,9 @@ function publishBrowserPreferences() {
|
|
|
78
97
|
for (const subscriber of subscribers)
|
|
79
98
|
subscriber();
|
|
80
99
|
}
|
|
81
|
-
function emptySubscription() {
|
|
82
|
-
return () => undefined;
|
|
83
|
-
}
|
|
84
100
|
const browserPreferencesSource = {
|
|
85
101
|
getSnapshot: readBrowserPreferences,
|
|
86
102
|
getServerSnapshot: () => defaultPreferences,
|
|
87
103
|
subscribe: subscribeBrowserPreferences
|
|
88
104
|
};
|
|
89
105
|
export const PreferencesContext = createContext(browserPreferencesSource);
|
|
90
|
-
const darkThemeQuery = "(prefers-color-scheme: dark)";
|
|
91
|
-
const reducedMotionQuery = "(prefers-reduced-motion: reduce)";
|
package/dist/grid.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ComponentPropsWithoutRef, CSSProperties } from "react";
|
|
2
|
-
import type { LayoutAlignment, LayoutGap, LayoutJustification } from "./layout.js";
|
|
2
|
+
import type { LayoutAlignment, LayoutGap, LayoutJustification } from "./foundation/layout.js";
|
|
3
3
|
/** Properties accepted by the Grid layout primitive. */
|
|
4
4
|
export interface GridProps extends ComponentPropsWithoutRef<"div"> {
|
|
5
5
|
/** Equal-width column count or native CSS column-track expression. */
|
package/dist/grid.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
|
-
import { alignment, justification,
|
|
4
|
-
import {
|
|
3
|
+
import { alignment, justification, tracks } from "./foundation/layout.js";
|
|
4
|
+
import { resolveSpacing } from "./foundation/spacing.js";
|
|
5
|
+
import { useVisual } from "./foundation/visual.js";
|
|
5
6
|
/** A predictable CSS Grid container with no visual appearance of its own. */
|
|
6
7
|
export const Grid = forwardRef(function Grid({ align, columns, flow, gap, inline = false, justify, rows, style, ...properties }, ref) {
|
|
7
|
-
const
|
|
8
|
+
const { spacing } = useVisual();
|
|
8
9
|
return _jsx("div", { ...properties, ref: ref, style: {
|
|
9
10
|
...style,
|
|
10
11
|
display: inline ? "inline-grid" : "grid",
|
|
11
12
|
alignItems: alignment(align) ?? style?.alignItems,
|
|
12
|
-
gap: gap === undefined ? style?.gap :
|
|
13
|
+
gap: gap === undefined ? style?.gap : resolveSpacing(gap, spacing),
|
|
13
14
|
gridAutoFlow: flow ?? style?.gridAutoFlow,
|
|
14
15
|
gridTemplateColumns: tracks(columns, "columns") ?? style?.gridTemplateColumns,
|
|
15
16
|
gridTemplateRows: tracks(rows, "rows") ?? style?.gridTemplateRows,
|
package/dist/icons/main.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Public entry point for icons that belong to the React UI visual language.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Every Lucide icon is available here under its Lucide name. Programs import
|
|
5
|
+
* icons only from this entry, so the icon source stays an implementation
|
|
6
|
+
* detail. Inside a UIProvider an icon follows its text size and color with a
|
|
7
|
+
* constant 1.5px stroke; its own `size`, `color`, or `strokeWidth` still wins.
|
|
6
8
|
*/
|
|
7
|
-
export
|
|
9
|
+
export * from "lucide-react";
|
package/dist/icons/main.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Public entry point for icons that belong to the React UI visual language.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Every Lucide icon is available here under its Lucide name. Programs import
|
|
5
|
+
* icons only from this entry, so the icon source stays an implementation
|
|
6
|
+
* detail. Inside a UIProvider an icon follows its text size and color with a
|
|
7
|
+
* constant 1.5px stroke; its own `size`, `color`, or `strokeWidth` still wins.
|
|
6
8
|
*/
|
|
7
|
-
export
|
|
9
|
+
export * from "lucide-react";
|
package/dist/input.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type TextControlProps } from "./control/text-control.js";
|
|
2
2
|
export type InputProps = TextControlProps;
|
|
3
|
-
/** A labeled single-line text
|
|
3
|
+
/** A labeled single-line text field. `onChange` receives the string value. */
|
|
4
4
|
export declare const Input: import("react").ForwardRefExoticComponent<TextControlProps & import("react").RefAttributes<HTMLInputElement>>;
|
package/dist/input.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
3
|
import { Input as AriaInput, TextField } from "react-aria-components";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
import { useControlMetrics } from "./control/control.js";
|
|
5
|
+
import { FieldFeedback, FieldLabel, fieldStyle } from "./control/field.js";
|
|
6
|
+
import { nativeTextStyle, TextWell } from "./control/text-control.js";
|
|
7
|
+
import MotionStyle, { textControlClass } from "./foundation/motion-style.js";
|
|
8
|
+
import { dimmedClass } from "./surface/surface.js";
|
|
9
|
+
/** A labeled single-line text field. `onChange` receives the string value. */
|
|
10
|
+
export const Input = forwardRef(function Input({ label, description, errorMessage, disabled, readOnly, required, invalid, size, color = "background", radius, style, className, placeholder, material, ...properties }, ref) {
|
|
11
|
+
const metrics = useControlMetrics(size, radius);
|
|
12
|
+
return _jsxs(TextField, { ...properties, className: dimmedClass(disabled ?? false, className), isDisabled: disabled, isReadOnly: readOnly, isRequired: required, isInvalid: invalid, style: fieldStyle(metrics, style), children: [_jsx(MotionStyle, {}), _jsx(FieldLabel, { label: label }), _jsx(AriaInput, { ref: ref, placeholder: placeholder, className: textControlClass, render: (native, state) => _jsx(TextWell, { color: color, material: material, metrics: metrics, state: state, children: _jsx("input", { ...native }) }), style: nativeTextStyle(metrics, false) }), _jsx(FieldFeedback, { metrics: metrics, description: description, errorMessage: errorMessage })] });
|
|
11
13
|
});
|
package/dist/list-box.d.ts
CHANGED
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
import type { CSSProperties, ReactElement, RefAttributes } from "react";
|
|
2
2
|
import type { HeaderProps as AriaHeaderProps, ListBoxItemProps as AriaListBoxItemProps, ListBoxProps as AriaListBoxProps, ListBoxSectionProps as AriaListBoxSectionProps } from "react-aria-components";
|
|
3
|
-
import type
|
|
4
|
-
import type
|
|
5
|
-
import type {
|
|
6
|
-
import
|
|
7
|
-
type
|
|
3
|
+
import { type ControlMetrics } from "./control/control.js";
|
|
4
|
+
import { type MultipleSelectionProps, type MultipleStringSelection, type SingleStringSelectionProps } 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 ListBoxRootBaseProps<T extends object> = Omit<AriaListBoxProps<T>, "className" | "defaultSelectedKeys" | "disabledKeys" | "onSelectionChange" | "selectedKeys" | "selectionMode" | "style" | "shouldFocusOnHover" | "shouldFocusWrap" | "shouldSelectOnPressUp"> & RadiusProps & Readonly<{
|
|
8
9
|
className?: string;
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
/** Color laid beneath selected Items. */
|
|
11
|
+
color?: Color;
|
|
12
|
+
/** Whether pointing at an Item moves focus to it. */
|
|
13
|
+
focusOnHover?: boolean;
|
|
14
|
+
/** Whether arrow keys wrap from the last Item to the first. */
|
|
15
|
+
focusWrap?: boolean;
|
|
16
|
+
/** Whether an Item is selected when the press ends instead of when it starts. */
|
|
17
|
+
selectOnPressUp?: boolean;
|
|
11
18
|
size?: ScaleLevel;
|
|
12
19
|
style?: CSSProperties;
|
|
13
20
|
}>;
|
|
@@ -15,31 +22,29 @@ export type ListBoxSingleSelectionProps = SingleStringSelectionProps & Readonly<
|
|
|
15
22
|
selectionMode?: "single";
|
|
16
23
|
}>;
|
|
17
24
|
export type ListBoxMultipleValue = MultipleStringSelection;
|
|
18
|
-
export type ListBoxMultipleSelectionProps =
|
|
19
|
-
|
|
20
|
-
}>;
|
|
21
|
-
/** Properties accepted by the selectable collection. Single selection is the default. */
|
|
25
|
+
export type ListBoxMultipleSelectionProps = MultipleSelectionProps;
|
|
26
|
+
/** A selectable collection. Single selection is the default. */
|
|
22
27
|
export type ListBoxRootProps<T extends object = object> = ListBoxRootBaseProps<T> & (ListBoxSingleSelectionProps | ListBoxMultipleSelectionProps);
|
|
23
28
|
export type ListBoxRootComponent = <T extends object = object>(properties: ListBoxRootProps<T> & RefAttributes<HTMLDivElement>) => ReactElement | null;
|
|
24
|
-
export
|
|
25
|
-
|
|
29
|
+
export interface ListBoxItemProps<T = object> extends Omit<AriaListBoxItemProps<T>, "className" | "id" | "isDisabled" | "render" | "style"> {
|
|
30
|
+
/** Identity of this Item within its collection. */
|
|
31
|
+
readonly id: string;
|
|
26
32
|
readonly className?: string;
|
|
27
|
-
|
|
33
|
+
/** Color laid beneath this Item when it is selected. */
|
|
34
|
+
readonly color?: Color;
|
|
28
35
|
readonly disabled?: boolean;
|
|
29
|
-
readonly id: string;
|
|
30
36
|
readonly style?: CSSProperties;
|
|
31
37
|
}
|
|
32
38
|
export type ListBoxItemComponent = <T = object>(properties: ListBoxItemProps<T> & RefAttributes<HTMLDivElement>) => ReactElement | null;
|
|
33
|
-
export declare const ListBoxItem: ListBoxItemComponent;
|
|
34
39
|
export interface ListBoxSectionProps<T extends object = object> extends Omit<AriaListBoxSectionProps<T>, "className" | "style"> {
|
|
35
40
|
readonly className?: string;
|
|
36
41
|
readonly style?: CSSProperties;
|
|
37
42
|
}
|
|
38
43
|
export type ListBoxSectionComponent = <T extends object = object>(properties: ListBoxSectionProps<T> & RefAttributes<HTMLElement>) => ReactElement | null;
|
|
39
|
-
export declare const ListBoxSection: ListBoxSectionComponent;
|
|
40
44
|
export type ListBoxHeaderProps = AriaHeaderProps;
|
|
41
|
-
|
|
42
|
-
|
|
45
|
+
/** Heading treatment shared by list and menu sections. */
|
|
46
|
+
export declare function collectionHeaderStyle(metrics: ControlMetrics, style?: CSSProperties): CSSProperties;
|
|
47
|
+
/** A selectable collection whose Items and Sections remain independently composable. */
|
|
43
48
|
export declare const ListBox: ListBoxRootComponent & {
|
|
44
49
|
Item: ListBoxItemComponent;
|
|
45
50
|
Section: ListBoxSectionComponent;
|
package/dist/list-box.js
CHANGED
|
@@ -1,129 +1,72 @@
|
|
|
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 { Header as AriaHeader, ListBox as AriaListBox, ListBoxItem as AriaListBoxItem, ListBoxSection as AriaListBoxSection } from "react-aria-components";
|
|
4
|
-
import { controlFontWeight, controlOpacity,
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const
|
|
4
|
+
import { controlFontWeight, controlOpacity, useControlMetrics } from "./control/control.js";
|
|
5
|
+
import { itemStyle, itemSurface, SelectionMark } from "./control/item.js";
|
|
6
|
+
import { ariaSelection } from "./control/selection.js";
|
|
7
|
+
import { surfaceRender } from "./control/surface-render.js";
|
|
8
|
+
import { AriaDirectionBoundary } from "./foundation/aria-direction.js";
|
|
9
|
+
import { resolveDirection, useDirection } from "./foundation/direction.js";
|
|
10
|
+
const ListBoxStyleContext = createContext(null);
|
|
11
|
+
const ListBoxRootImplementation = forwardRef(function ListBox(properties, ref) {
|
|
12
|
+
const { className, color = "primary", defaultValue: _defaultValue, onChange: _onChange, radius, selectionMode: _selectionMode, focusOnHover = false, focusWrap, selectOnPressUp, 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 }), [color, metrics, itemRadius]);
|
|
13
17
|
const direction = resolveDirection(native.dir, useDirection());
|
|
14
|
-
|
|
15
|
-
return _jsx(ListBoxThemeContext.Provider, { value: context, children: _jsx(AriaDirectionBoundary, { direction: direction, children: _jsx(AriaListBox, { ...native, ...selection, ref: ref, dir: direction, selectionMode: selectionMode, shouldFocusOnHover: shouldFocusOnHover, className: className, style: {
|
|
18
|
+
return _jsx(ListBoxStyleContext.Provider, { value: context, children: _jsx(AriaDirectionBoundary, { direction: direction, children: _jsx(AriaListBox, { ...native, ...ariaSelection(properties, "single"), ref: ref, dir: direction, shouldFocusOnHover: focusOnHover, shouldFocusWrap: focusWrap, shouldSelectOnPressUp: selectOnPressUp, className: className, style: {
|
|
16
19
|
display: "grid",
|
|
17
|
-
gap:
|
|
20
|
+
gap: 2,
|
|
18
21
|
minWidth: 0,
|
|
19
|
-
padding:
|
|
22
|
+
padding: metrics.listInset,
|
|
20
23
|
boxSizing: "border-box",
|
|
21
24
|
outline: "none",
|
|
22
25
|
fontFamily: "inherit",
|
|
23
|
-
fontSize:
|
|
26
|
+
fontSize: metrics.fontSize,
|
|
24
27
|
...style
|
|
25
28
|
} }) }) });
|
|
26
29
|
});
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
const
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
properties.onChange?.(singleSelection(selection));
|
|
40
|
-
};
|
|
41
|
-
return {
|
|
42
|
-
...(selectedKeys !== undefined ? { selectedKeys } : {}),
|
|
43
|
-
...(defaultSelectedKeys !== undefined ? { defaultSelectedKeys } : {}),
|
|
44
|
-
...(disabledKeys !== undefined ? { disabledKeys } : {}),
|
|
45
|
-
...(onSelectionChange !== undefined ? { onSelectionChange } : {})
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
const ListBoxItemImplementation = forwardRef(function ListBoxItem({ children, className, color, disabled = false, style, ...properties }, ref) {
|
|
49
|
-
const inherited = useContext(ListBoxThemeContext);
|
|
50
|
-
const item = {
|
|
51
|
-
children,
|
|
52
|
-
className,
|
|
53
|
-
disabled,
|
|
54
|
-
properties: {
|
|
55
|
-
...properties,
|
|
56
|
-
textValue: properties.textValue ?? (typeof children === "string" ? children : undefined)
|
|
57
|
-
},
|
|
58
|
-
ref,
|
|
59
|
-
style
|
|
60
|
-
};
|
|
61
|
-
return inherited != null && color === undefined
|
|
62
|
-
? _jsx(ListBoxItemView, { ...item, theme: inherited.theme })
|
|
63
|
-
: _jsx(ResolvedListBoxItem, { ...item, color: color ?? inherited?.color, radius: inherited?.radius, size: inherited?.size });
|
|
30
|
+
const ListBoxItemImplementation = forwardRef(function ListBoxItem({ children, className, color, disabled = false, style, textValue, ...properties }, ref) {
|
|
31
|
+
const inherited = useListBoxStyle();
|
|
32
|
+
const itemColor = color ?? inherited.color;
|
|
33
|
+
const { metrics, itemRadius } = inherited;
|
|
34
|
+
return _jsx(AriaListBoxItem, { ...properties, ref: ref, textValue: textValue ?? (typeof children === "string" ? children : undefined), className: className, isDisabled: disabled, render: surfaceRender("div", state => itemSurface(metrics.visual, itemColor, {
|
|
35
|
+
selected: state.isSelected,
|
|
36
|
+
hovered: state.isHovered,
|
|
37
|
+
pressed: state.isPressed,
|
|
38
|
+
focusVisible: state.isFocusVisible,
|
|
39
|
+
disabled: state.isDisabled
|
|
40
|
+
}, itemRadius)), style: { ...itemStyle(metrics, disabled), ...style }, children: state => _jsxs(_Fragment, { children: [typeof children === "function" ? children(state) : children, _jsx(SelectionMark, { visible: state.isSelected })] }) });
|
|
64
41
|
});
|
|
65
|
-
function ResolvedListBoxItem({ color, radius, size, ...properties }) {
|
|
66
|
-
return _jsx(ListBoxItemView, { ...properties, theme: useControlTheme({ color, radius, size }) });
|
|
67
|
-
}
|
|
68
|
-
function ListBoxItemView({ children, className, disabled, properties, ref, style, theme }) {
|
|
69
|
-
return _jsx(AriaListBoxItem, { ...properties, ref: ref, className: className, isDisabled: disabled, style: state => ({
|
|
70
|
-
...theme.transition,
|
|
71
|
-
display: "flex",
|
|
72
|
-
alignItems: "center",
|
|
73
|
-
justifyContent: "space-between",
|
|
74
|
-
gap: theme.gap,
|
|
75
|
-
minWidth: 0,
|
|
76
|
-
minHeight: theme.height,
|
|
77
|
-
paddingInline: Math.max(8, theme.spacing),
|
|
78
|
-
boxSizing: "border-box",
|
|
79
|
-
borderRadius: theme.radius,
|
|
80
|
-
outline: state.isFocusVisible && !state.isSelected ? `1px solid ${theme.focusColor}` : "none",
|
|
81
|
-
outlineOffset: 1,
|
|
82
|
-
cursor: disabled ? "not-allowed" : "pointer",
|
|
83
|
-
opacity: disabled ? controlOpacity.disabled : 1,
|
|
84
|
-
userSelect: "none",
|
|
85
|
-
...(state.isSelected
|
|
86
|
-
? state.isPressed
|
|
87
|
-
? theme.paints.palette.pressed
|
|
88
|
-
: state.isHovered
|
|
89
|
-
? theme.paints.palette.hover
|
|
90
|
-
: theme.paints.palette.rest
|
|
91
|
-
: state.isHovered
|
|
92
|
-
? theme.paints.subtle.hover
|
|
93
|
-
: { background: "transparent", color: "inherit" }),
|
|
94
|
-
...style
|
|
95
|
-
}), children: state => _jsxs(_Fragment, { children: [typeof children === "function" ? children(state) : children, _jsx("span", { "aria-hidden": "true", style: { flexShrink: 0, width: "1em", textAlign: "center" }, children: state.isSelected ? "✓" : null })] }) });
|
|
96
|
-
}
|
|
97
|
-
export const ListBoxItem = ListBoxItemImplementation;
|
|
98
42
|
const ListBoxSectionImplementation = forwardRef(function ListBoxSection({ className, style, ...properties }, ref) {
|
|
99
|
-
|
|
100
|
-
return _jsx(AriaListBoxSection, { ...properties, ref: ref, className: className, style: {
|
|
101
|
-
display: "grid",
|
|
102
|
-
gap: theme.gap,
|
|
103
|
-
minWidth: 0,
|
|
104
|
-
...style
|
|
105
|
-
} });
|
|
43
|
+
useListBoxStyle();
|
|
44
|
+
return _jsx(AriaListBoxSection, { ...properties, ref: ref, className: className, style: { display: "grid", gap: 2, minWidth: 0, ...style } });
|
|
106
45
|
});
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
return _jsx(AriaHeader, { ...properties, ref: ref, style: {
|
|
111
|
-
paddingInline: Math.max(8, theme.spacing),
|
|
112
|
-
paddingBlock: theme.gap,
|
|
113
|
-
fontWeight: controlFontWeight,
|
|
114
|
-
opacity: controlOpacity.secondary,
|
|
115
|
-
...style
|
|
116
|
-
} });
|
|
46
|
+
const ListBoxHeader = forwardRef(function ListBoxHeader({ style, ...properties }, ref) {
|
|
47
|
+
const { metrics } = useListBoxStyle();
|
|
48
|
+
return _jsx(AriaHeader, { ...properties, ref: ref, style: collectionHeaderStyle(metrics, style) });
|
|
117
49
|
});
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
50
|
+
/** Heading treatment shared by list and menu sections. */
|
|
51
|
+
export function collectionHeaderStyle(metrics, style) {
|
|
52
|
+
return {
|
|
53
|
+
paddingInline: metrics.inset,
|
|
54
|
+
paddingBlock: metrics.gap,
|
|
55
|
+
fontSize: "0.92em",
|
|
56
|
+
fontWeight: controlFontWeight,
|
|
57
|
+
opacity: controlOpacity.secondary,
|
|
58
|
+
...style
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
function useListBoxStyle() {
|
|
62
|
+
const context = useContext(ListBoxStyleContext);
|
|
63
|
+
if (context == null)
|
|
121
64
|
throw new Error("ListBox parts must be used inside ListBox");
|
|
122
|
-
return
|
|
65
|
+
return context;
|
|
123
66
|
}
|
|
124
|
-
/** A selectable collection whose
|
|
125
|
-
export const ListBox = Object.assign(
|
|
126
|
-
Item:
|
|
127
|
-
Section:
|
|
67
|
+
/** A selectable collection whose Items and Sections remain independently composable. */
|
|
68
|
+
export const ListBox = Object.assign(ListBoxRootImplementation, {
|
|
69
|
+
Item: ListBoxItemImplementation,
|
|
70
|
+
Section: ListBoxSectionImplementation,
|
|
128
71
|
Header: ListBoxHeader
|
|
129
72
|
});
|
package/dist/main.d.ts
CHANGED
|
@@ -4,18 +4,19 @@
|
|
|
4
4
|
* Components enter this surface only after their implementation-independent
|
|
5
5
|
* behavior contract has been established by the package's tests.
|
|
6
6
|
*/
|
|
7
|
-
export { defaultAppearance, type Appearance, type
|
|
8
|
-
export { UIProvider,
|
|
9
|
-
export
|
|
10
|
-
export type
|
|
7
|
+
export { appearanceLimits, defaultAppearance, type Appearance, type AppearanceColor, type AppearanceColors, type AppearanceMaterial, type AppearanceRange, type AppearanceShadow, type AppearanceTransaction, type AppearanceUpdate, type Easing, type ThemedValue } from "./foundation/appearance.js";
|
|
8
|
+
export { UIProvider, type UIProviderProps } from "./foundation/provider.js";
|
|
9
|
+
export { useAppearance, useBrowserPreferences, usePreferences, useThemedValue } from "./foundation/visual.js";
|
|
10
|
+
export { useDirection, useDocumentDirection, type Direction } from "./foundation/direction.js";
|
|
11
|
+
export type { Preferences, PreferencesUpdate, Theme } from "./foundation/preferences.js";
|
|
11
12
|
export { Flex, type FlexProps } from "./flex.js";
|
|
12
13
|
export { Grid, type GridProps } from "./grid.js";
|
|
13
|
-
export { Surface, type MaterialMode, type MaterialOptions, type ShadowOptions, type SurfaceComponent, type SurfaceHost, type SurfaceHostProps, type SurfaceOwnProps, type SurfaceProps } from "./surface.js";
|
|
14
|
-
export {
|
|
14
|
+
export { Surface, type MaterialMode, type MaterialOptions, type ShadowOptions, type SurfaceComponent, type SurfaceDepth, type SurfaceHost, type SurfaceHostProps, type SurfaceOwnProps, type SurfaceProps } from "./surface/surface.js";
|
|
15
|
+
export { resolveColor, useColor, useContrastingColor, type Color, type ColorLevel, type ColorScale } from "./foundation/color.js";
|
|
15
16
|
export { Panel, type PanelProps, type PanelHeaderProps, type PanelContentProps } from "./panel.js";
|
|
16
17
|
export { Window, type WindowProps, type WindowContentProps, type WindowHeaderProps, type WindowIdentityProps, type WindowCenterProps, type WindowActionsProps, type WindowActionProps, type WindowControlProps, type WindowMaximizeProps, type WindowCloseProps, type WindowMoveCaptureProps } from "./window.js";
|
|
17
18
|
export { default as useWindowMoveHandle, type WindowMoveHandle } from "./use-window-move-handle.js";
|
|
18
|
-
export { Button, type ButtonColor, type ButtonProps } from "./button.js";
|
|
19
|
+
export { Button, type ButtonActionProps, type ButtonColor, type ButtonLinkProps, type ButtonProps } from "./button.js";
|
|
19
20
|
export { Input, type InputProps } from "./input.js";
|
|
20
21
|
export { Textarea, type TextareaProps } from "./textarea.js";
|
|
21
22
|
export { DateField, type DateFieldProps } from "./date-field.js";
|
|
@@ -28,8 +29,8 @@ export type { DateRange } from "./date-range.js";
|
|
|
28
29
|
export { Checkbox, type CheckboxProps } from "./checkbox.js";
|
|
29
30
|
export { RadioGroup, type RadioGroupProps, type RadioGroupItemProps } from "./radio.js";
|
|
30
31
|
export { Switch, type SwitchProps } from "./switch.js";
|
|
31
|
-
export { Select, type SelectProps
|
|
32
|
-
export { ComboBox, type ComboBoxProps
|
|
32
|
+
export { Select, type SelectProps } from "./select.js";
|
|
33
|
+
export { ComboBox, type ComboBoxProps } from "./combo-box.js";
|
|
33
34
|
export { ListBox, type ListBoxProps, type ListBoxSingleSelectionProps, type ListBoxMultipleSelectionProps, type ListBoxMultipleValue, type ListBoxItemProps, type ListBoxSectionProps, type ListBoxHeaderProps } from "./list-box.js";
|
|
34
35
|
export { Tabs, type TabsProps, type TabsListProps, type TabsTabProps, type TabsPanelsProps, type TabsPanelProps } from "./tabs.js";
|
|
35
36
|
export { Table, type TableProps, type TableNoSelectionProps, type TableSingleSelectionProps, type TableMultipleSelectionProps, type TableMultipleValue, type TableSort, type TableSortDirection, type TableHeaderProps, type TableColumnProps, type TableBodyProps, type TableRowProps, type TableCellProps } from "./table.js";
|
|
@@ -37,7 +38,19 @@ export { Tree, type TreeProps, type TreeNoSelectionProps, type TreeSingleSelecti
|
|
|
37
38
|
export { Slider, type SliderProps } from "./slider.js";
|
|
38
39
|
export { ProgressBar, type ProgressBarProps } from "./progress-bar.js";
|
|
39
40
|
export { Spinner, type SpinnerProps } from "./spinner.js";
|
|
40
|
-
export {
|
|
41
|
+
export { NumberField, type NumberFieldProps } from "./number-field.js";
|
|
42
|
+
export { SegmentedControl, type SegmentedControlProps, type SegmentedControlItemProps } from "./segmented-control.js";
|
|
43
|
+
export { Alert, type AlertProps } from "./alert.js";
|
|
44
|
+
export { FileTrigger, type FileTriggerProps } from "./file-trigger.js";
|
|
45
|
+
export { DropZone, type DropZoneProps } from "./drop-zone.js";
|
|
46
|
+
export { Fieldset, type FieldsetProps } from "./fieldset.js";
|
|
47
|
+
export { AppLayout, type AppLayoutProps, type AppLayoutRegionProps } from "./app-layout.js";
|
|
48
|
+
export { ColorSwatch, type ColorSwatchProps } from "./color-swatch.js";
|
|
49
|
+
export { ColorSwatchPicker, type ColorSwatchPickerProps, type ColorSwatchPickerItemProps } from "./color-swatch-picker.js";
|
|
50
|
+
export { ColorSlider, type ColorSliderProps } from "./color-slider.js";
|
|
51
|
+
export { ColorArea, type ColorAreaProps } from "./color-area.js";
|
|
52
|
+
export { ColorField, type ColorFieldProps } from "./color-field.js";
|
|
53
|
+
export { ColorPicker, type ColorPickerRootProps, type ColorPickerTriggerProps, type ColorPickerContentProps } from "./color-picker.js";
|
|
41
54
|
export { ScrollArea, type ScrollAreaAxis, type ScrollAreaProps } from "./scroll-area.js";
|
|
42
55
|
export { Toolbar, type ToolbarProps, type ToolbarGroupProps, type ToolbarSeparatorProps } from "./toolbar.js";
|
|
43
56
|
export { Disclosure, type DisclosureProps, type DisclosureTriggerProps, type DisclosureContentProps } from "./disclosure.js";
|
|
@@ -46,12 +59,10 @@ export { Popover, type PopoverProps, type PopoverTriggerProps, type PopoverConte
|
|
|
46
59
|
export { Menu, type MenuProps, type MenuNoSelectionProps, type MenuSingleSelectionProps, type MenuMultipleSelectionProps, type MenuMultipleValue, type MenuItemProps, type MenuSectionProps, type MenuHeaderProps, type MenuSeparatorProps } from "./menu.js";
|
|
47
60
|
export { DropdownMenu, type DropdownMenuProps, type DropdownMenuTriggerProps } from "./dropdown-menu.js";
|
|
48
61
|
export { ContextMenu, type ContextMenuProps, type ContextMenuTriggerProps, type ContextMenuContentProps } from "./context-menu.js";
|
|
49
|
-
export { Dialog, type DialogProps, type DialogTriggerProps, type DialogBackdropProps, type DialogContentProps, type DialogHeaderProps, type DialogTitleProps, type DialogDescriptionProps, type DialogBodyProps, type DialogFooterProps, type DialogCloseProps } from "./dialog.js";
|
|
62
|
+
export { Dialog, type DialogProps, type DialogTriggerProps, type DialogBackdropProps, type DialogBackdropVariant, type DialogContentProps, type DialogHeaderProps, type DialogTitleProps, type DialogDescriptionProps, type DialogBodyProps, type DialogFooterProps, type DialogCloseProps } from "./dialog.js";
|
|
50
63
|
export { AlertDialog, type AlertDialogProps, type AlertDialogBackdropProps, type AlertDialogContentProps } from "./alert-dialog.js";
|
|
51
64
|
export { Tooltip, type TooltipProps, type TooltipTriggerProps, type TooltipContentProps } from "./tooltip.js";
|
|
52
|
-
export type {
|
|
53
|
-
export
|
|
54
|
-
export {
|
|
55
|
-
export {
|
|
56
|
-
export { useColor, useContrastingColor } from "./color.js";
|
|
57
|
-
export { useScale, type NumericScale, type ScaleLevel } from "./scale.js";
|
|
65
|
+
export type { LayoutAlignment, LayoutGap, LayoutJustification } from "./foundation/layout.js";
|
|
66
|
+
export { resolveRadius, type Radius, type RadiusProps } from "./foundation/radius.js";
|
|
67
|
+
export { resolveSpacing, type Spacing } from "./foundation/spacing.js";
|
|
68
|
+
export { useScale, type NumericScale, type ScaleLevel } from "./foundation/scale.js";
|
package/dist/main.js
CHANGED
|
@@ -4,12 +4,14 @@
|
|
|
4
4
|
* Components enter this surface only after their implementation-independent
|
|
5
5
|
* behavior contract has been established by the package's tests.
|
|
6
6
|
*/
|
|
7
|
-
export { defaultAppearance } from "./appearance.js";
|
|
8
|
-
export { UIProvider
|
|
7
|
+
export { appearanceLimits, defaultAppearance } from "./foundation/appearance.js";
|
|
8
|
+
export { UIProvider } from "./foundation/provider.js";
|
|
9
|
+
export { useAppearance, useBrowserPreferences, usePreferences, useThemedValue } from "./foundation/visual.js";
|
|
10
|
+
export { useDirection, useDocumentDirection } from "./foundation/direction.js";
|
|
9
11
|
export { Flex } from "./flex.js";
|
|
10
12
|
export { Grid } from "./grid.js";
|
|
11
|
-
export { Surface } from "./surface.js";
|
|
12
|
-
export {
|
|
13
|
+
export { Surface } from "./surface/surface.js";
|
|
14
|
+
export { resolveColor, useColor, useContrastingColor } from "./foundation/color.js";
|
|
13
15
|
// Context-dependent parts are public only through their owning component family.
|
|
14
16
|
export { Panel } from "./panel.js";
|
|
15
17
|
export { Window } from "./window.js";
|
|
@@ -35,7 +37,19 @@ export { Tree } from "./tree.js";
|
|
|
35
37
|
export { Slider } from "./slider.js";
|
|
36
38
|
export { ProgressBar } from "./progress-bar.js";
|
|
37
39
|
export { Spinner } from "./spinner.js";
|
|
38
|
-
export {
|
|
40
|
+
export { NumberField } from "./number-field.js";
|
|
41
|
+
export { SegmentedControl } from "./segmented-control.js";
|
|
42
|
+
export { Alert } from "./alert.js";
|
|
43
|
+
export { FileTrigger } from "./file-trigger.js";
|
|
44
|
+
export { DropZone } from "./drop-zone.js";
|
|
45
|
+
export { Fieldset } from "./fieldset.js";
|
|
46
|
+
export { AppLayout } from "./app-layout.js";
|
|
47
|
+
export { ColorSwatch } from "./color-swatch.js";
|
|
48
|
+
export { ColorSwatchPicker } from "./color-swatch-picker.js";
|
|
49
|
+
export { ColorSlider } from "./color-slider.js";
|
|
50
|
+
export { ColorArea } from "./color-area.js";
|
|
51
|
+
export { ColorField } from "./color-field.js";
|
|
52
|
+
export { ColorPicker } from "./color-picker.js";
|
|
39
53
|
export { ScrollArea } from "./scroll-area.js";
|
|
40
54
|
export { Toolbar } from "./toolbar.js";
|
|
41
55
|
export { Disclosure } from "./disclosure.js";
|
|
@@ -47,7 +61,6 @@ export { ContextMenu } from "./context-menu.js";
|
|
|
47
61
|
export { Dialog } from "./dialog.js";
|
|
48
62
|
export { AlertDialog } from "./alert-dialog.js";
|
|
49
63
|
export { Tooltip } from "./tooltip.js";
|
|
50
|
-
export { resolveRadius } from "./radius.js";
|
|
51
|
-
export { resolveSpacing } from "./spacing.js";
|
|
52
|
-
export {
|
|
53
|
-
export { useScale } from "./scale.js";
|
|
64
|
+
export { resolveRadius } from "./foundation/radius.js";
|
|
65
|
+
export { resolveSpacing } from "./foundation/spacing.js";
|
|
66
|
+
export { useScale } from "./foundation/scale.js";
|