@phreshos/react-ui 0.1.42 → 0.1.43
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/dist/alert.js +3 -3
- package/dist/badge.js +2 -2
- package/dist/breadcrumbs.js +2 -2
- package/dist/calendar-layout.js +2 -2
- package/dist/color-slider.js +2 -2
- package/dist/control/control.d.ts +4 -0
- package/dist/control/control.js +4 -0
- package/dist/control/field.d.ts +2 -0
- package/dist/control/field.js +5 -3
- package/dist/control/text-control.js +2 -1
- package/dist/disclosure.js +2 -2
- package/dist/list-box.js +2 -2
- package/dist/radio.js +3 -3
- package/dist/segmented-control.js +3 -3
- package/dist/select.js +2 -2
- package/dist/slider.js +2 -2
- package/dist/table.js +2 -2
- package/dist/toast.js +3 -3
- package/dist/typography.d.ts +1 -0
- package/dist/typography.js +3 -4
- package/package.json +2 -2
package/dist/alert.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
|
-
import { controlFontSizes, controlFontWeight, useControlMetrics } from "./control/control.js";
|
|
3
|
+
import { controlFontSizes, controlFontWeight, useControlMetrics, controlLineHeight } from "./control/control.js";
|
|
4
4
|
import { iconProps } from "./control/icon.js";
|
|
5
5
|
import { meaningIcon, urgentMeaning } from "./control/meaning.js";
|
|
6
6
|
import { colorLevel, resolveColor } from "./foundation/color.js";
|
|
@@ -24,7 +24,7 @@ export const Alert = forwardRef(function Alert({ color = "info", title, icon, ch
|
|
|
24
24
|
gap: metrics.gap * 2,
|
|
25
25
|
padding: containerPadding(metrics.visual.spacing),
|
|
26
26
|
fontSize: controlFontSizes.medium,
|
|
27
|
-
lineHeight:
|
|
27
|
+
lineHeight: controlLineHeight,
|
|
28
28
|
...style
|
|
29
|
-
}, children: [icon !== false && _jsx("span", { style: { display: "grid", height:
|
|
29
|
+
}, children: [icon !== false && _jsx("span", { style: { display: "grid", height: `${controlLineHeight}em`, alignItems: "center" }, children: icon ?? _jsx(MeaningIcon, { ...iconProps(16) }) }), _jsxs("div", { style: { display: "grid", gap: 2, minWidth: 0 }, children: [title != null && _jsx("strong", { style: { fontWeight: controlFontWeight }, children: title }), children != null && _jsx("div", { children: children })] })] });
|
|
30
30
|
});
|
package/dist/badge.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
|
-
import { controlFontSizes, controlFontWeight, useControlMetrics } from "./control/control.js";
|
|
3
|
+
import { controlFontSizes, controlFontWeight, useControlMetrics, controlLineHeight } from "./control/control.js";
|
|
4
4
|
import { colorLevel, resolveColor } from "./foundation/color.js";
|
|
5
5
|
import { Surface } from "./surface/surface.js";
|
|
6
6
|
const smaller = Object.freeze({ xsmall: "xsmall", small: "xsmall", medium: "small", large: "medium", xlarge: "large" });
|
|
@@ -23,7 +23,7 @@ export const Badge = forwardRef(function Badge({ children, color = "foreground",
|
|
|
23
23
|
color: colorLevel(base, "strong", colors),
|
|
24
24
|
fontSize: controlFontSizes[smaller[size ?? "medium"]],
|
|
25
25
|
fontWeight: controlFontWeight,
|
|
26
|
-
lineHeight:
|
|
26
|
+
lineHeight: controlLineHeight,
|
|
27
27
|
whiteSpace: "nowrap",
|
|
28
28
|
verticalAlign: "middle",
|
|
29
29
|
...style
|
package/dist/breadcrumbs.js
CHANGED
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
2
2
|
import { createContext, forwardRef, useContext } from "react";
|
|
3
3
|
import { Breadcrumb as AriaBreadcrumb, Breadcrumbs as AriaBreadcrumbs, Link as AriaLink } from "react-aria-components";
|
|
4
4
|
import { ChevronRight } from "lucide-react";
|
|
5
|
-
import { controlFontWeight, controlOpacity, transition, useControlMetrics } from "./control/control.js";
|
|
5
|
+
import { controlFontWeight, controlOpacity, transition, useControlMetrics, controlLineHeight } from "./control/control.js";
|
|
6
6
|
import { iconProps } from "./control/icon.js";
|
|
7
7
|
import { surfacePaint } from "./surface/surface.js";
|
|
8
8
|
const BreadcrumbsContext = createContext(null);
|
|
@@ -18,7 +18,7 @@ const BreadcrumbsRoot = forwardRef(function Breadcrumbs({ children, size, style,
|
|
|
18
18
|
padding: 0,
|
|
19
19
|
listStyle: "none",
|
|
20
20
|
fontSize: metrics.fontSize,
|
|
21
|
-
lineHeight:
|
|
21
|
+
lineHeight: controlLineHeight,
|
|
22
22
|
...style
|
|
23
23
|
}, children: children }) });
|
|
24
24
|
});
|
package/dist/calendar-layout.js
CHANGED
|
@@ -3,7 +3,7 @@ import { useContext } from "react";
|
|
|
3
3
|
import { isSameDay } from "@internationalized/date";
|
|
4
4
|
import { CalendarCell, CalendarGrid, CalendarGridBody, CalendarGridHeader, CalendarHeaderCell, CalendarHeading, CalendarStateContext, RangeCalendarStateContext } from "react-aria-components";
|
|
5
5
|
import { Button } from "./button.js";
|
|
6
|
-
import { controlFontWeight, controlOpacity, transition } from "./control/control.js";
|
|
6
|
+
import { controlFontWeight, controlOpacity, transition, controlLineHeight } from "./control/control.js";
|
|
7
7
|
import { selectionColor } from "./control/item.js";
|
|
8
8
|
import { colorOpacity, readableColor, resolveColor } from "./foundation/color.js";
|
|
9
9
|
import { useDirection } from "./foundation/direction.js";
|
|
@@ -28,7 +28,7 @@ export function calendarRootStyle(metrics, style) {
|
|
|
28
28
|
padding: metrics.spacing,
|
|
29
29
|
fontFamily: "inherit",
|
|
30
30
|
fontSize: metrics.fontSize,
|
|
31
|
-
lineHeight:
|
|
31
|
+
lineHeight: controlLineHeight
|
|
32
32
|
};
|
|
33
33
|
}
|
|
34
34
|
/**
|
package/dist/color-slider.js
CHANGED
|
@@ -4,7 +4,7 @@ import { ColorSlider as AriaColorSlider, Label, SliderOutput, SliderTrack } from
|
|
|
4
4
|
import { colorEdge, ColorThumb } from "./control/color-thumb.js";
|
|
5
5
|
import { colorValue } from "./control/color-value.js";
|
|
6
6
|
import { controlFontWeight, controlOpacity, useControlMetrics } from "./control/control.js";
|
|
7
|
-
import { fieldStyle } from "./control/field.js";
|
|
7
|
+
import { fieldStyle, descriptionStyle } from "./control/field.js";
|
|
8
8
|
import { AriaDirectionBoundary } from "./foundation/aria-direction.js";
|
|
9
9
|
import { resolveDirection, useDirection } from "./foundation/direction.js";
|
|
10
10
|
import { dimmedClass } from "./surface/surface.js";
|
|
@@ -25,5 +25,5 @@ export const ColorSlider = forwardRef(function ColorSlider({ label, description,
|
|
|
25
25
|
// A track is round by its form.
|
|
26
26
|
borderRadius: 9999,
|
|
27
27
|
boxShadow: colorEdge(metrics)
|
|
28
|
-
}), children: _jsx(ColorThumb, { metrics: metrics, center: vertical ? "left" : "top" }) }), description != null && _jsx("span", { style:
|
|
28
|
+
}), children: _jsx(ColorThumb, { metrics: metrics, center: vertical ? "left" : "top" }) }), description != null && _jsx("span", { style: descriptionStyle, children: description })] }) });
|
|
29
29
|
});
|
|
@@ -29,6 +29,10 @@ export type ControlOverrides = keyof ControlProps | keyof FieldProps | "children
|
|
|
29
29
|
export declare const controlFontSizes: Readonly<Record<ScaleLevel, string>>;
|
|
30
30
|
/** A control text size relative to an element that already applies another level. */
|
|
31
31
|
export declare function relativeFontSize(level: ScaleLevel, within: ScaleLevel): string;
|
|
32
|
+
/** Secondary text, such as a description or a section header, reads a step smaller than its control. */
|
|
33
|
+
export declare const secondaryFontSize = "0.92em";
|
|
34
|
+
/** The line height of text in controls and the Surfaces around them. */
|
|
35
|
+
export declare const controlLineHeight = 1.45;
|
|
32
36
|
export declare const controlFontWeight = 600;
|
|
33
37
|
/** Attenuation shared by every control family. */
|
|
34
38
|
export declare const controlOpacity: Readonly<{
|
package/dist/control/control.js
CHANGED
|
@@ -14,6 +14,10 @@ export const controlFontSizes = Object.freeze({
|
|
|
14
14
|
export function relativeFontSize(level, within) {
|
|
15
15
|
return `${Number.parseFloat(controlFontSizes[level]) / Number.parseFloat(controlFontSizes[within])}em`;
|
|
16
16
|
}
|
|
17
|
+
/** Secondary text, such as a description or a section header, reads a step smaller than its control. */
|
|
18
|
+
export const secondaryFontSize = "0.92em";
|
|
19
|
+
/** The line height of text in controls and the Surfaces around them. */
|
|
20
|
+
export const controlLineHeight = 1.45;
|
|
17
21
|
export const controlFontWeight = 600;
|
|
18
22
|
/** Attenuation shared by every control family. */
|
|
19
23
|
export const controlOpacity = Object.freeze({
|
package/dist/control/field.d.ts
CHANGED
|
@@ -8,6 +8,8 @@ export declare function fieldStyle(metrics: ControlMetrics, style?: CSSPropertie
|
|
|
8
8
|
export declare function FieldLabel({ label }: Readonly<{
|
|
9
9
|
label?: ReactNode;
|
|
10
10
|
}>): import("react").JSX.Element | null;
|
|
11
|
+
/** The treatment of a control's description: a little smaller and quieter than its label. */
|
|
12
|
+
export declare const descriptionStyle: CSSProperties;
|
|
11
13
|
/** Description and validation text shared by every field. */
|
|
12
14
|
export declare function FieldFeedback({ description, errorMessage, metrics }: Readonly<{
|
|
13
15
|
description?: ReactNode;
|
package/dist/control/field.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { FieldError, Label, Text } from "react-aria-components";
|
|
3
3
|
import { colorOpacity, mixColor } from "../foundation/color.js";
|
|
4
|
-
import { controlFontWeight, controlOpacity } from "./control.js";
|
|
4
|
+
import { controlFontWeight, controlOpacity, controlLineHeight, secondaryFontSize } from "./control.js";
|
|
5
5
|
/**
|
|
6
6
|
* The root of every value-holding component. It is the only element that
|
|
7
7
|
* applies the control text scale; every part inherits from it.
|
|
@@ -14,17 +14,19 @@ export function fieldStyle(metrics, style) {
|
|
|
14
14
|
minWidth: 0,
|
|
15
15
|
fontFamily: "inherit",
|
|
16
16
|
fontSize: metrics.fontSize,
|
|
17
|
-
lineHeight:
|
|
17
|
+
lineHeight: controlLineHeight,
|
|
18
18
|
...style
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
21
|
export function FieldLabel({ label }) {
|
|
22
22
|
return label == null ? null : _jsx(Label, { style: { fontWeight: controlFontWeight }, children: label });
|
|
23
23
|
}
|
|
24
|
+
/** The treatment of a control's description: a little smaller and quieter than its label. */
|
|
25
|
+
export const descriptionStyle = Object.freeze({ fontSize: secondaryFontSize, opacity: controlOpacity.secondary });
|
|
24
26
|
/** Description and validation text shared by every field. */
|
|
25
27
|
export function FieldFeedback({ description, errorMessage, metrics }) {
|
|
26
28
|
const { colors } = metrics.visual;
|
|
27
|
-
return _jsxs(_Fragment, { children: [description != null && _jsx(Text, { slot: "description", style:
|
|
29
|
+
return _jsxs(_Fragment, { children: [description != null && _jsx(Text, { slot: "description", style: descriptionStyle, children: description }), _jsx(FieldError, { style: { fontSize: descriptionStyle.fontSize, color: mixColor(colors.danger, colors.foreground, 0.15) }, children: errorMessage })] });
|
|
28
30
|
}
|
|
29
31
|
/** How strongly every separator shows its text color. */
|
|
30
32
|
export const separatorOpacity = 0.1;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { SurfaceView } from "../surface/surface.js";
|
|
3
|
+
import { controlLineHeight } from "./control.js";
|
|
3
4
|
/**
|
|
4
5
|
* The recessed well that holds typed content. Native text elements cannot host
|
|
5
6
|
* Surface layers, so the well wraps the element that React Aria renders.
|
|
@@ -25,7 +26,7 @@ export function nativeTextStyle(metrics, multiline) {
|
|
|
25
26
|
color: "inherit",
|
|
26
27
|
caretColor: "currentColor",
|
|
27
28
|
font: "inherit",
|
|
28
|
-
lineHeight:
|
|
29
|
+
lineHeight: controlLineHeight,
|
|
29
30
|
resize: multiline ? "vertical" : undefined
|
|
30
31
|
};
|
|
31
32
|
}
|
package/dist/disclosure.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { createContext, forwardRef, useContext, useMemo } from "react";
|
|
3
3
|
import { Button as AriaButton, Disclosure as AriaDisclosure, DisclosurePanel as AriaDisclosurePanel, DisclosureStateContext } from "react-aria-components";
|
|
4
|
-
import { transition, useControlMetrics } from "./control/control.js";
|
|
4
|
+
import { transition, useControlMetrics, controlLineHeight } from "./control/control.js";
|
|
5
5
|
import { surfaceRender } from "./control/surface-render.js";
|
|
6
6
|
import { resolveSpacing } from "./foundation/spacing.js";
|
|
7
7
|
import { ChevronDown } from "lucide-react";
|
|
@@ -39,7 +39,7 @@ export const DisclosureTrigger = forwardRef(function DisclosureTrigger({ childre
|
|
|
39
39
|
cursor: "pointer",
|
|
40
40
|
font: "inherit",
|
|
41
41
|
fontWeight: 500,
|
|
42
|
-
lineHeight:
|
|
42
|
+
lineHeight: controlLineHeight,
|
|
43
43
|
textAlign: "start",
|
|
44
44
|
userSelect: "none",
|
|
45
45
|
WebkitTapHighlightColor: "transparent",
|
package/dist/list-box.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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, useControlMetrics } from "./control/control.js";
|
|
4
|
+
import { controlFontWeight, controlOpacity, useControlMetrics, secondaryFontSize } from "./control/control.js";
|
|
5
5
|
import { itemStyle, itemSurface, SelectionMark } from "./control/item.js";
|
|
6
6
|
import { ariaSelection } from "./control/selection.js";
|
|
7
7
|
import { surfaceRender } from "./control/surface-render.js";
|
|
@@ -52,7 +52,7 @@ export function collectionHeaderStyle(metrics, style) {
|
|
|
52
52
|
return {
|
|
53
53
|
paddingInline: metrics.inset,
|
|
54
54
|
paddingBlock: metrics.gap,
|
|
55
|
-
fontSize:
|
|
55
|
+
fontSize: secondaryFontSize,
|
|
56
56
|
fontWeight: controlFontWeight,
|
|
57
57
|
opacity: controlOpacity.secondary,
|
|
58
58
|
...style
|
package/dist/radio.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { createContext, forwardRef, useContext, useMemo } from "react";
|
|
3
3
|
import { Label, RadioButton, RadioField, RadioGroup as AriaRadioGroup, Text } from "react-aria-components";
|
|
4
|
-
import { controlFontWeight,
|
|
5
|
-
import { FieldFeedback, fieldStyle } from "./control/field.js";
|
|
4
|
+
import { controlFontWeight, useControlMetrics } from "./control/control.js";
|
|
5
|
+
import { FieldFeedback, fieldStyle, descriptionStyle } from "./control/field.js";
|
|
6
6
|
import { ToggleIndicator, toggleRowStyle } from "./control/toggle.js";
|
|
7
7
|
import { AriaDirectionBoundary } from "./foundation/aria-direction.js";
|
|
8
8
|
import { resolveDirection, useDirection } from "./foundation/direction.js";
|
|
@@ -29,7 +29,7 @@ const RadioGroupItem = forwardRef(function RadioGroupItem({ label, description,
|
|
|
29
29
|
focusVisible: state.isFocusVisible,
|
|
30
30
|
invalid: state.isInvalid,
|
|
31
31
|
disabled: state.isDisabled
|
|
32
|
-
} }), label] }) }), description != null && _jsx(Text, { slot: "description", style: {
|
|
32
|
+
} }), label] }) }), description != null && _jsx(Text, { slot: "description", style: { ...descriptionStyle, paddingInlineStart: metrics.indicator + metrics.gap }, children: description })] });
|
|
33
33
|
});
|
|
34
34
|
/** One exclusive-choice field whose options are its Items. */
|
|
35
35
|
export const RadioGroup = Object.assign(RadioGroupRoot, {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { createContext, forwardRef, useContext, useId, useMemo } from "react";
|
|
3
3
|
import { ToggleButton as AriaToggleButton, ToggleButtonGroup as AriaToggleButtonGroup } from "react-aria-components";
|
|
4
|
-
import { controlFontWeight,
|
|
5
|
-
import { fieldStyle } from "./control/field.js";
|
|
4
|
+
import { controlFontWeight, useControlMetrics } from "./control/control.js";
|
|
5
|
+
import { fieldStyle, descriptionStyle } from "./control/field.js";
|
|
6
6
|
import { SelectionItemLabel, selectionItemStyle, selectionListStyle, SelectionTrack } from "./control/selection-track.js";
|
|
7
7
|
import { stringKey } from "./control/selection.js";
|
|
8
8
|
import { AriaDirectionBoundary } from "./foundation/aria-direction.js";
|
|
@@ -25,7 +25,7 @@ const SegmentedControlRoot = forwardRef(function SegmentedControl({ label, descr
|
|
|
25
25
|
const [key] = keys;
|
|
26
26
|
if (key !== undefined)
|
|
27
27
|
onChange?.(stringKey(key));
|
|
28
|
-
}, isDisabled: disabled, style: selectionListStyle(orientation), children: children }) }) }), description != null && _jsx("span", { id: descriptionId, style:
|
|
28
|
+
}, isDisabled: disabled, style: selectionListStyle(orientation), children: children }) }) }), description != null && _jsx("span", { id: descriptionId, style: descriptionStyle, children: description })] }) });
|
|
29
29
|
});
|
|
30
30
|
/** One option; its label may lead with an icon. */
|
|
31
31
|
const SegmentedControlItem = forwardRef(function SegmentedControlItem({ children, disabled, className, style, ...properties }, ref) {
|
package/dist/select.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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 { Button as AriaButton, Select as AriaSelect, SelectValue } from "react-aria-components";
|
|
4
|
-
import { controlOpacity, transition, useControlMetrics } from "./control/control.js";
|
|
4
|
+
import { controlOpacity, transition, useControlMetrics, controlLineHeight } from "./control/control.js";
|
|
5
5
|
import { FieldFeedback, FieldLabel, fieldStyle } from "./control/field.js";
|
|
6
6
|
import { surfaceRender } from "./control/surface-render.js";
|
|
7
7
|
import { resolveDirection, useDirection } from "./foundation/direction.js";
|
|
@@ -54,7 +54,7 @@ export function fieldTriggerStyle(metrics, disabled) {
|
|
|
54
54
|
border: 0,
|
|
55
55
|
background: "none",
|
|
56
56
|
font: "inherit",
|
|
57
|
-
lineHeight:
|
|
57
|
+
lineHeight: controlLineHeight,
|
|
58
58
|
textAlign: "start",
|
|
59
59
|
cursor: disabled ? "not-allowed" : "pointer"
|
|
60
60
|
};
|
package/dist/slider.js
CHANGED
|
@@ -5,7 +5,7 @@ import { Slider as BaseSlider } from "@base-ui/react/slider";
|
|
|
5
5
|
import { DirectionProvider as BaseDirectionProvider } from "@base-ui/react/direction-provider";
|
|
6
6
|
import { forwardRef, useEffect, useId, useRef, useState } from "react";
|
|
7
7
|
import { controlFontWeight, controlOpacity, transition, useControlMetrics } from "./control/control.js";
|
|
8
|
-
import { fieldStyle } from "./control/field.js";
|
|
8
|
+
import { fieldStyle, descriptionStyle } from "./control/field.js";
|
|
9
9
|
import { lightColor } from "./foundation/color.js";
|
|
10
10
|
import { resolveDirection, useDirection } from "./foundation/direction.js";
|
|
11
11
|
import { SurfaceView, dimmedClass } from "./surface/surface.js";
|
|
@@ -68,5 +68,5 @@ export const Slider = forwardRef(function Slider({ label, description, name, for
|
|
|
68
68
|
height: thumb,
|
|
69
69
|
cursor: state.disabled ? "not-allowed" : state.dragging ? "grabbing" : "grab",
|
|
70
70
|
scale: state.dragging ? "0.92" : "1"
|
|
71
|
-
} }) })] }) }) }), description != null && _jsx("span", { id: descriptionId, style:
|
|
71
|
+
} }) })] }) }) }), description != null && _jsx("span", { id: descriptionId, style: descriptionStyle, children: description })] }) });
|
|
72
72
|
});
|
package/dist/table.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { createContext, forwardRef, useContext, useMemo } from "react";
|
|
3
3
|
import { Cell as AriaCell, Column as AriaColumn, Row as AriaRow, Table as AriaTable, TableBody as AriaTableBody, TableHeader as AriaTableHeader } from "react-aria-components";
|
|
4
|
-
import { controlFontWeight, controlOpacity, transition, useControlMetrics } from "./control/control.js";
|
|
4
|
+
import { controlFontWeight, controlOpacity, transition, useControlMetrics, secondaryFontSize } from "./control/control.js";
|
|
5
5
|
import { separatorColor } from "./control/field.js";
|
|
6
6
|
import { itemPaint } from "./control/item.js";
|
|
7
7
|
import { ariaSelection, stringKey } from "./control/selection.js";
|
|
@@ -50,7 +50,7 @@ const TableColumn = forwardRef(function TableColumn({ sortable = false, rowHeade
|
|
|
50
50
|
outline: `3px solid ${state.isFocusVisible ? colorOpacity(colors.primary, 0.34) : "transparent"}`,
|
|
51
51
|
outlineOffset: -3,
|
|
52
52
|
cursor: sortable ? "pointer" : "default",
|
|
53
|
-
fontSize:
|
|
53
|
+
fontSize: secondaryFontSize,
|
|
54
54
|
fontWeight: controlFontWeight,
|
|
55
55
|
textAlign: "start",
|
|
56
56
|
userSelect: "none",
|
package/dist/toast.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { Text, UNSTABLE_Toast as AriaToast, UNSTABLE_ToastContent as AriaToastContent, UNSTABLE_ToastQueue as AriaToastQueue, UNSTABLE_ToastRegion as AriaToastRegion } from "react-aria-components";
|
|
3
3
|
import { X } from "lucide-react";
|
|
4
|
-
import { controlFontSizes, controlFontWeight, controlOpacity, useControlMetrics } from "./control/control.js";
|
|
4
|
+
import { controlFontSizes, controlFontWeight, controlOpacity, useControlMetrics, controlLineHeight } from "./control/control.js";
|
|
5
5
|
import { FieldButton } from "./control/field-button.js";
|
|
6
6
|
import { iconProps } from "./control/icon.js";
|
|
7
7
|
import { meaningIcon } from "./control/meaning.js";
|
|
@@ -58,7 +58,7 @@ export function ToastRegion({ className, style }) {
|
|
|
58
58
|
// The close button carries its own padding, so the end keeps less.
|
|
59
59
|
paddingInlineEnd: metrics.spacing / 2,
|
|
60
60
|
fontSize: controlFontSizes.medium,
|
|
61
|
-
lineHeight:
|
|
62
|
-
}, children: [_jsx("span", { style: { display: "grid", height:
|
|
61
|
+
lineHeight: controlLineHeight
|
|
62
|
+
}, children: [_jsx("span", { style: { display: "grid", height: `${controlLineHeight}em`, alignItems: "center", color: colorLevel(resolveColor(color, visual.colors), "strong", visual.colors) }, children: _jsx(Icon, { ...iconProps(16) }) }), _jsxs(AriaToastContent, { style: { display: "grid", gap: 2, minWidth: 0 }, children: [_jsx(Text, { slot: "title", style: { fontWeight: controlFontWeight }, children: item.content.title }), item.content.description != null && _jsx(Text, { slot: "description", style: { opacity: controlOpacity.secondary }, children: item.content.description })] }), _jsx(FieldButton, { slot: "close", metrics: metrics, "aria-label": "Close", children: _jsx(X, { ...iconProps(14) }) })] }) });
|
|
63
63
|
} })] });
|
|
64
64
|
}
|
package/dist/typography.d.ts
CHANGED
|
@@ -33,6 +33,7 @@ export interface KbdProps {
|
|
|
33
33
|
readonly className?: string;
|
|
34
34
|
readonly style?: CSSProperties;
|
|
35
35
|
}
|
|
36
|
+
/** Running text sets its lines at this height, relative to its size. */
|
|
36
37
|
/**
|
|
37
38
|
* A key to press, drawn as a small raised keycap. Its label takes the control
|
|
38
39
|
* text scale, and the cap is as tall as the line of text around it, so it
|
package/dist/typography.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
3
|
import { Heading as AriaHeading, Keyboard as AriaKeyboard, Text as AriaText } from "react-aria-components";
|
|
4
|
-
import { controlFontSizes, controlFontWeight, controlOpacity, useControlMetrics } from "./control/control.js";
|
|
4
|
+
import { controlFontSizes, controlFontWeight, controlLineHeight, controlOpacity, useControlMetrics } from "./control/control.js";
|
|
5
5
|
import { scale, scaleMultiplier } from "./foundation/scale.js";
|
|
6
6
|
import { useVisual } from "./foundation/visual.js";
|
|
7
7
|
import { Surface } from "./surface/surface.js";
|
|
@@ -28,13 +28,12 @@ export const Heading = forwardRef(function Heading({ level = 2, size, style, ...
|
|
|
28
28
|
export const Text = forwardRef(function Text({ tone = "default", size, style, ...properties }, ref) {
|
|
29
29
|
return _jsx(AriaText, { ...properties, ref: ref, style: {
|
|
30
30
|
fontSize: size === undefined ? undefined : controlFontSizes[size],
|
|
31
|
-
lineHeight:
|
|
31
|
+
lineHeight: controlLineHeight,
|
|
32
32
|
opacity: tone === "secondary" ? controlOpacity.secondary : undefined,
|
|
33
33
|
...style
|
|
34
34
|
} });
|
|
35
35
|
});
|
|
36
36
|
/** Running text sets its lines at this height, relative to its size. */
|
|
37
|
-
const textLineHeight = 1.45;
|
|
38
37
|
/**
|
|
39
38
|
* A key to press, drawn as a small raised keycap. Its label takes the control
|
|
40
39
|
* text scale, and the cap is as tall as the line of text around it, so it
|
|
@@ -43,7 +42,7 @@ const textLineHeight = 1.45;
|
|
|
43
42
|
export const Kbd = forwardRef(function Kbd({ children, className, style }, ref) {
|
|
44
43
|
const metrics = useControlMetrics("xsmall");
|
|
45
44
|
const label = Number.parseFloat(controlFontSizes.medium);
|
|
46
|
-
const cap = `${
|
|
45
|
+
const cap = `${controlLineHeight / label}em`;
|
|
47
46
|
return _jsx(AriaKeyboard, { ref: ref, className: className, style: { display: "inline-block", verticalAlign: "middle", lineHeight: 1 }, children: _jsx(Surface, { as: "span", radius: metrics.radius, shadow: false, style: {
|
|
48
47
|
display: "inline-flex",
|
|
49
48
|
alignItems: "center",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@phreshos/react-ui",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.43",
|
|
4
4
|
"description": "React components for coherent PhreshOS Program interfaces.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"dependencies": {
|
|
58
58
|
"@base-ui/react": "^1.7.0",
|
|
59
59
|
"@internationalized/date": "^3.12.3",
|
|
60
|
-
"@phreshos/core": "^0.1.
|
|
60
|
+
"@phreshos/core": "^0.1.63",
|
|
61
61
|
"colorjs.io": "^0.7.1",
|
|
62
62
|
"lucide-react": "^1.48.0",
|
|
63
63
|
"react-aria": "^3.51.0",
|