@plexui/react-native 0.2.8 → 0.2.10
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/es/components/IntroHeader/IntroHeader.js +32 -0
- package/dist/es/components/List/List.js +14 -10
- package/dist/es/icons/plex/LayoutGrid.js +3 -0
- package/dist/es/icons/plex/index.js +1 -0
- package/dist/es/index.js +1 -0
- package/dist/types/components/IntroHeader/IntroHeader.d.ts +33 -0
- package/dist/types/components/List/List.d.ts +1 -1
- package/dist/types/icons/plex/LayoutGrid.d.ts +2 -0
- package/dist/types/icons/plex/index.d.ts +1 -0
- package/dist/types/index.d.ts +1 -0
- package/package.json +2 -2
- package/src/components/IntroHeader/IntroHeader.tsx +79 -0
- package/src/components/List/List.tsx +16 -11
- package/src/icons/plex/LayoutGrid.ts +4 -0
- package/src/icons/plex/index.ts +1 -0
- package/src/index.ts +1 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Platform, StyleSheet, View } from "react-native";
|
|
3
|
+
import { useRTL } from "../../internal/direction";
|
|
4
|
+
import { useTheme } from "../../theme/ThemeProvider";
|
|
5
|
+
import { IconDefaultsProvider } from "../Icon/createIcon";
|
|
6
|
+
import { Text } from "../Text/Text";
|
|
7
|
+
/**
|
|
8
|
+
* The header of a step in a sheet or a setup flow: an optional symbol, the step's title and what it asks, as iOS 27's
|
|
9
|
+
* own steps set them (Apple Account, Add Email Address, Recovery Key, Pair Hearing Device, Set Up eSIM, Health's
|
|
10
|
+
* medication steps). Measured on a 430pt phone: the symbol's drawing about 70pt, in the middle, its bottom about 31pt
|
|
11
|
+
* over the title's line; the title in Title 2 bold and the description in Title 2 in the secondary label right under
|
|
12
|
+
* it, both at the start of the column. The header keeps no space round it: the screen sets it 24 under its bar and the
|
|
13
|
+
* content 24 under it. Android: the setup wizard's header, a 40dp symbol in the primary at the start 16 over a Headline
|
|
14
|
+
* Small title, the description in Body Large 16 under it in onSurfaceVariant.
|
|
15
|
+
*/
|
|
16
|
+
export function IntroHeader({ title, description, media, align = "cells", testID, style }) {
|
|
17
|
+
const theme = useTheme();
|
|
18
|
+
const android = theme.isAndroid;
|
|
19
|
+
// On the rows' text: Android's list rows keep their text 21 in (List's ANDROID_INSET), iOS's the row inset
|
|
20
|
+
const inset = align === "text" ? (android ? 21 : theme.length("--list-row-inset", 20)) : 0;
|
|
21
|
+
// The text at the start: React Native turns `left` to the right in a right-to-left layout on a phone, the web keeps
|
|
22
|
+
// it left, so there the side is read from the header's direction
|
|
23
|
+
const { ref, rtl } = useRTL();
|
|
24
|
+
const start = { textAlign: Platform.OS === "web" && rtl ? "right" : "left" };
|
|
25
|
+
return (_jsxs(View, { ref: ref, testID: testID, style: [{ paddingHorizontal: inset }, style], children: [media != null ? (_jsx(View, { "aria-hidden": true, accessibilityElementsHidden: true, importantForAccessibility: "no-hide-descendants",
|
|
26
|
+
// A symbol's box keeps about 7 round its drawing at 80: 24 under the box is the drawing's 31 over the title
|
|
27
|
+
style: [styles.media, { alignSelf: android ? "flex-start" : "center", marginBottom: android ? 16 : 24 }], children: _jsx(IconDefaultsProvider, { size: android ? 40 : 80, color: android ? theme.material.primary : theme.colors.accent, children: media }) })) : null, _jsx(Text, { variant: "title2", weight: android ? "regular" : "bold", accessibilityRole: "header", style: start, children: title }), description != null ? (_jsx(Text, { variant: android ? "body" : "title2", color: "secondary", style: [start, android ? styles.androidDescription : null], children: description })) : null] }));
|
|
28
|
+
}
|
|
29
|
+
const styles = StyleSheet.create({
|
|
30
|
+
media: { alignItems: "center", justifyContent: "center" },
|
|
31
|
+
androidDescription: { marginTop: 16 },
|
|
32
|
+
});
|
|
@@ -105,7 +105,7 @@ export function List({ children, header, description, footer, error, surface = "
|
|
|
105
105
|
}, children: error ?? footer })) : null] }));
|
|
106
106
|
}
|
|
107
107
|
/**
|
|
108
|
-
* A row of a List: the label (17/22, `--field-row-*`: 52 tall,
|
|
108
|
+
* A row of a List: the label (17/22, `--field-row-*`: 52 tall, 62 with a description, 12 above and below the text at
|
|
109
109
|
* least) with a description, a leading symbol, a value (wrapping within 60% of the row, or under the label: `valuePlacement`) or a control, and the chevron
|
|
110
110
|
* of a drill-in (`Disclosure`, in the tertiary label, turned over right to left). A row with `checked` is a switch
|
|
111
111
|
* row. On Android a row of a settings screen: 50dp tall at least (64 with a description, its text 12 from the row's
|
|
@@ -203,7 +203,9 @@ export function ListItem({ label, description, leading, leadingColor, value, val
|
|
|
203
203
|
function ActionRow({ children }) {
|
|
204
204
|
const theme = useTheme();
|
|
205
205
|
const { last } = useContext(PlaceContext);
|
|
206
|
-
return (_jsxs(View, { style: styles.actionRow, children: [_jsx(ListActionContext.Provider, { value: "row", children: children }), last ? null : (_jsx(View, { pointerEvents: "none",
|
|
206
|
+
return (_jsxs(View, { style: styles.actionRow, children: [_jsx(ListActionContext.Provider, { value: "row", children: children }), last ? null : (_jsx(View, { pointerEvents: "none",
|
|
207
|
+
// iOS: from the text to 20 before the group's end, as the other rows' lines
|
|
208
|
+
style: [styles.actionSeparator, theme.isAndroid ? { start: ANDROID_INSET } : { start: theme.length("--list-row-inset", 20), end: theme.length("--list-row-inset", 20) }, { backgroundColor: theme.isAndroid ? divider(theme) : theme.colors.separator }] }))] }));
|
|
207
209
|
}
|
|
208
210
|
/**
|
|
209
211
|
* A field row whose value is a line of its own, as the web's `Field row` with `orientation="vertical"` or `hideLabel`
|
|
@@ -238,7 +240,7 @@ export function ListStackedRow({ label, description, error, disabled = false, ac
|
|
|
238
240
|
const errorOffset = theme.length("--mobile-field-error-offset", 4);
|
|
239
241
|
const errorLine = theme.length("--mobile-field-error-line-height", 20);
|
|
240
242
|
const iconSize = theme.length("--mobile-field-error-icon-size", 16);
|
|
241
|
-
return (_jsx(View, { testID: testID, style: [styles.stackedRow, { paddingStart: inset }], children: _jsxs(View, { style: [styles.stackedColumn, { paddingEnd: inset, paddingVertical: padding, gap: android ? 4 : 0 }], children: [last ? null : _jsx(View, { pointerEvents: "none", style: [styles.iosSeparator, { backgroundColor: android ? divider(theme) : theme.colors.separator }] }), labelText != null && action != null ? (_jsxs(View, { style: [styles.pair, { gap: 8 }, !android && error != null ? { marginBottom: theme.length("--mobile-field-error-offset", 4) } : null], children: [labelText, action] })) : (labelText), _jsx(RowEndContext.Provider, { value: rowEnd, children: children }), description != null ? (_jsx(Text, { color: secondary, style: android ? styles.androidDescription : { fontSize: theme.length("--field-row-description-font-size", 15), lineHeight: theme.length("--field-row-description-line-height", 20) }, children: description })) : null, error == null ? null : android ? (_jsx(Text, { color: dangerText(theme), accessibilityLiveRegion: "polite", style: styles.androidDescription, children: error })) : (_jsxs(View, { accessibilityLiveRegion: "polite", style: [styles.iosError, { marginTop: errorOffset, gap: theme.length("--mobile-field-error-icon-gap", 4) }], children: [_jsx(ExclamationMarkCircle, { size: iconSize, color: errorColor(theme), style: { marginTop: (errorLine - iconSize) / 2 } }), _jsx(Text, { color: errorColor(theme), style: [styles.shrink, { fontSize: theme.length("--mobile-field-error-font-size", 15), lineHeight: errorLine }], children: error })] }))] }) }));
|
|
243
|
+
return (_jsx(View, { testID: testID, style: [styles.stackedRow, { paddingStart: inset }], children: _jsxs(View, { style: [styles.stackedColumn, { paddingEnd: inset, paddingVertical: padding, gap: android ? 4 : 0 }], children: [last ? null : _jsx(View, { pointerEvents: "none", style: [styles.iosSeparator, { backgroundColor: android ? divider(theme) : theme.colors.separator }, android ? null : { end: inset }] }), labelText != null && action != null ? (_jsxs(View, { style: [styles.pair, { gap: 8 }, !android && error != null ? { marginBottom: theme.length("--mobile-field-error-offset", 4) } : null], children: [labelText, action] })) : (labelText), _jsx(RowEndContext.Provider, { value: rowEnd, children: children }), description != null ? (_jsx(Text, { color: secondary, style: android ? styles.androidDescription : { fontSize: theme.length("--field-row-description-font-size", 15), lineHeight: theme.length("--field-row-description-line-height", 20) }, children: description })) : null, error == null ? null : android ? (_jsx(Text, { color: dangerText(theme), accessibilityLiveRegion: "polite", style: styles.androidDescription, children: error })) : (_jsxs(View, { accessibilityLiveRegion: "polite", style: [styles.iosError, { marginTop: errorOffset, gap: theme.length("--mobile-field-error-icon-gap", 4) }], children: [_jsx(ExclamationMarkCircle, { size: iconSize, color: errorColor(theme), style: { marginTop: (errorLine - iconSize) / 2 } }), _jsx(Text, { color: errorColor(theme), style: [styles.shrink, { fontSize: theme.length("--mobile-field-error-font-size", 15), lineHeight: errorLine }], children: error })] }))] }) }));
|
|
242
244
|
}
|
|
243
245
|
/** A Switch, a Checkbox or (inside its RadioGroup) an option given as a row's `trailing`, which the row's press toggles. */
|
|
244
246
|
function rowControl(trailing, inGroup) {
|
|
@@ -282,8 +284,8 @@ function endControl(found, own, setOwn, rowDisabled, name) {
|
|
|
282
284
|
: cloneElement(found.element, { checked: state, onCheckedChange: change, accessibilityLabel });
|
|
283
285
|
return { kind: found.kind, node, toggle: rowDisabled || props.disabled ? undefined : () => change(state !== true) };
|
|
284
286
|
}
|
|
285
|
-
/** A row's least height: 52,
|
|
286
|
-
const iosMinHeight = (theme, described) => described ? theme.length("--field-row-description-min-height",
|
|
287
|
+
/** A row's least height: 52, 62 with a description (as Settings, iOS 26 and 27) (`--field-row-description-min-height`), as the web's NavigationRow. */
|
|
288
|
+
const iosMinHeight = (theme, described) => described ? theme.length("--field-row-description-min-height", 62) : theme.length("--field-row-min-height", 52);
|
|
287
289
|
function iosRow(theme, last, described) {
|
|
288
290
|
const inset = theme.length("--list-row-inset", 20);
|
|
289
291
|
return {
|
|
@@ -350,14 +352,16 @@ function IOSContent({ theme, label, description, descriptionId, leading, leading
|
|
|
350
352
|
// The text's padding centres one line (or a label and its description) in the row's least height, 12 at least, as the
|
|
351
353
|
// web's: a row of more lines (a wrapped label, a value below) keeps those 15 (14) above and below
|
|
352
354
|
// A row with a control at its end is the web's form row (`Field row`): its text keeps the control's 44pt line, 4 above
|
|
353
|
-
// and below it, or
|
|
355
|
+
// and below it, or 10 around a description, so a wrapped label or description grows the row by its own lines only
|
|
354
356
|
const target = theme.length("--control-size-lg", 44);
|
|
355
357
|
const formRow = trailing != null;
|
|
358
|
+
// A two-line row keeps 10 over its label and under its description, as Settings (62 in all)
|
|
359
|
+
const descriptionPadding = theme.length("--field-row-description-padding-block", 10);
|
|
356
360
|
const textPadding = formRow
|
|
357
361
|
? description != null
|
|
358
|
-
?
|
|
362
|
+
? descriptionPadding
|
|
359
363
|
: (iosMinHeight(theme, false) - target) / 2
|
|
360
|
-
: Math.max(theme.length("--field-row-text-padding-block", 12), (iosMinHeight(theme, description != null) - labelType.lineHeight - (description != null ? descriptionLine : 0)) / 2);
|
|
364
|
+
: Math.max(description != null ? descriptionPadding : theme.length("--field-row-text-padding-block", 12), (iosMinHeight(theme, description != null) - labelType.lineHeight - (description != null ? descriptionLine : 0)) / 2);
|
|
361
365
|
// A field at the end fills the room after the label (`RowEnd.fill`)
|
|
362
366
|
const [fill, setFill] = useState(false);
|
|
363
367
|
// In a List with `columns` a field's value starts at one column, 40% into the row (`--field-row-column-width`)
|
|
@@ -383,9 +387,9 @@ function IOSContent({ theme, label, description, descriptionId, leading, leading
|
|
|
383
387
|
error != null ? styles.iosColumn : styles.iosMain,
|
|
384
388
|
{ minHeight: iosMinHeight(theme, description != null || error != null), paddingEnd: inset },
|
|
385
389
|
error != null
|
|
386
|
-
? { paddingVertical: Math.max(
|
|
390
|
+
? { paddingVertical: Math.max(descriptionPadding, (iosMinHeight(theme, true) - labelType.lineHeight - errorOffset - errorLine) / 2) }
|
|
387
391
|
: { gap: below ? disclosureGap : gap },
|
|
388
|
-
], children: [last ? null : _jsx(View, { pointerEvents: "none", style: [styles.iosSeparator, { backgroundColor: theme.colors.separator }] }), probe, line(_jsxs(_Fragment, { children: [_jsxs(View, { style: [columns ? styles.column : fill ? styles.iosTextHug : styles.iosText, { paddingVertical: error != null ? 0 : textPadding }, formRow && description == null && error == null ? { minHeight: target, justifyContent: "center" } : null], children: [_jsx(Text, { color: labelColor, style: labelType, children: label }), below ? (
|
|
392
|
+
], children: [last ? null : _jsx(View, { pointerEvents: "none", style: [styles.iosSeparator, { backgroundColor: theme.colors.separator, end: inset }] }), probe, line(_jsxs(_Fragment, { children: [_jsxs(View, { style: [columns ? styles.column : fill ? styles.iosTextHug : styles.iosText, { paddingVertical: error != null ? 0 : textPadding }, formRow && description == null && error == null ? { minHeight: target, justifyContent: "center" } : null], children: [_jsx(Text, { color: labelColor, style: labelType, children: label }), below ? (
|
|
389
393
|
// Under the label, the lines touching as a subtitle cell's, at the text's start
|
|
390
394
|
_jsx(Text, { color: secondary, style: labelType, children: value })) : null, description != null ? (_jsx(Text, { nativeID: descriptionId, color: secondary, style: { fontSize: theme.length("--field-row-description-font-size", 15), lineHeight: descriptionLine }, children: description })) : null] }), (value != null && !below) || trailing != null || chevron ? (_jsxs(View, { style: [fill || columns ? styles.endFill : styles.end, columns && !startsColumn ? styles.endAtEdge : null, { gap: disclosureGap }], children: [value != null && !below ? (
|
|
391
395
|
// A long value wraps within the 60% the end takes, as the web's, rather than losing its end; set at the
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// Generated by scripts/build-icons.mjs. Do not edit.
|
|
2
|
+
import { createIcon } from "../../components/Icon/createIcon";
|
|
3
|
+
export default createIcon("LayoutGrid", "0 0 24 24", [["path", { "d": "M4 4V9H9V4H4ZM11 9C11 10.1046 10.1046 11 9 11H4C2.89543 11 2 10.1046 2 9V4C2 2.89543 2.89543 2 4 2H9C10.1046 2 11 2.89543 11 4V9Z", "fill": 0 }], ["path", { "d": "M15 4V9H20V4H15ZM22 9C22 10.1046 21.1046 11 20 11H15C13.89543 11 13 10.1046 13 9V4C13 2.89543 13.89543 2 15 2H20C21.1046 2 22 2.89543 22 4V9Z", "fill": 0 }], ["path", { "d": "M4 15V20H9V15H4ZM11 20C11 21.1046 10.1046 22 9 22H4C2.89543 22 2 21.1046 2 20V15C2 13.89543 2.89543 13 4 13H9C10.1046 13 11 13.89543 11 15V20Z", "fill": 0 }], ["path", { "d": "M15 15V20H20V15H15ZM22 20C22 21.1046 21.1046 22 20 22H15C13.89543 22 13 21.1046 13 20V15C13 13.89543 13.89543 13 15 13H20C21.1046 13 22 13.89543 22 15V20Z", "fill": 0 }]]);
|
|
@@ -311,6 +311,7 @@ export { default as Keyboard } from "./Keyboard";
|
|
|
311
311
|
export { default as KeyboardShortcut } from "./KeyboardShortcut";
|
|
312
312
|
export { default as Language } from "./Language";
|
|
313
313
|
export { default as Latency } from "./Latency";
|
|
314
|
+
export { default as LayoutGrid } from "./LayoutGrid";
|
|
314
315
|
export { default as LayoutList } from "./LayoutList";
|
|
315
316
|
export { default as LightMode } from "./LightMode";
|
|
316
317
|
export { default as Lightbulb } from "./Lightbulb";
|
package/dist/es/index.js
CHANGED
|
@@ -35,6 +35,7 @@ export { Toaster, toast } from "./components/Toast/Toast";
|
|
|
35
35
|
export { Avatar, AvatarGroup } from "./components/Avatar/Avatar";
|
|
36
36
|
export { Badge } from "./components/Badge/Badge";
|
|
37
37
|
export { BottomActions } from "./components/BottomActions/BottomActions";
|
|
38
|
+
export { IntroHeader } from "./components/IntroHeader/IntroHeader";
|
|
38
39
|
export { Card, cardColors } from "./components/Card/Card";
|
|
39
40
|
export { List, ListItem } from "./components/List/List";
|
|
40
41
|
export { Chip } from "./components/Chip/Chip";
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import { type StyleProp, type ViewStyle } from "react-native";
|
|
3
|
+
export type IntroHeaderAlign = "cells" | "text";
|
|
4
|
+
export type IntroHeaderProps = {
|
|
5
|
+
/** The step's title: Title 2 bold on iOS (22/28), Headline Small on Android (24/32). Read as a header. */
|
|
6
|
+
title: ReactNode;
|
|
7
|
+
/** An optional line or two under the title: Title 2 in the secondary label on iOS, Body Large on Android. */
|
|
8
|
+
description?: ReactNode;
|
|
9
|
+
/**
|
|
10
|
+
* An optional symbol or picture over the title, in the middle on iOS, at the start on Android. A kit icon takes
|
|
11
|
+
* the accent and 80pt on iOS (its drawing about 67), 40dp in the primary on Android, unless it sets its own.
|
|
12
|
+
*/
|
|
13
|
+
media?: ReactNode;
|
|
14
|
+
/**
|
|
15
|
+
* What the title and description line up with. `cells`: the column the content under them stands on, the edge of
|
|
16
|
+
* the fields, cards and buttons (a step with a field or a few rows, as Apple Account or Set Up eSIM); `text`: the text
|
|
17
|
+
* inside the cells, the row inset (20pt, 21dp) in, over a long grouped list (as Health's Choose the Medication Type).
|
|
18
|
+
* @default "cells"
|
|
19
|
+
*/
|
|
20
|
+
align?: IntroHeaderAlign;
|
|
21
|
+
testID?: string;
|
|
22
|
+
style?: StyleProp<ViewStyle>;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* The header of a step in a sheet or a setup flow: an optional symbol, the step's title and what it asks, as iOS 27's
|
|
26
|
+
* own steps set them (Apple Account, Add Email Address, Recovery Key, Pair Hearing Device, Set Up eSIM, Health's
|
|
27
|
+
* medication steps). Measured on a 430pt phone: the symbol's drawing about 70pt, in the middle, its bottom about 31pt
|
|
28
|
+
* over the title's line; the title in Title 2 bold and the description in Title 2 in the secondary label right under
|
|
29
|
+
* it, both at the start of the column. The header keeps no space round it: the screen sets it 24 under its bar and the
|
|
30
|
+
* content 24 under it. Android: the setup wizard's header, a 40dp symbol in the primary at the start 16 over a Headline
|
|
31
|
+
* Small title, the description in Body Large 16 under it in onSurfaceVariant.
|
|
32
|
+
*/
|
|
33
|
+
export declare function IntroHeader({ title, description, media, align, testID, style }: IntroHeaderProps): import("react").JSX.Element;
|
|
@@ -110,7 +110,7 @@ export type ListItemProps = {
|
|
|
110
110
|
testID?: string;
|
|
111
111
|
};
|
|
112
112
|
/**
|
|
113
|
-
* A row of a List: the label (17/22, `--field-row-*`: 52 tall,
|
|
113
|
+
* A row of a List: the label (17/22, `--field-row-*`: 52 tall, 62 with a description, 12 above and below the text at
|
|
114
114
|
* least) with a description, a leading symbol, a value (wrapping within 60% of the row, or under the label: `valuePlacement`) or a control, and the chevron
|
|
115
115
|
* of a drill-in (`Disclosure`, in the tertiary label, turned over right to left). A row with `checked` is a switch
|
|
116
116
|
* row. On Android a row of a settings screen: 50dp tall at least (64 with a description, its text 12 from the row's
|
|
@@ -309,6 +309,7 @@ export { default as Keyboard } from "./Keyboard";
|
|
|
309
309
|
export { default as KeyboardShortcut } from "./KeyboardShortcut";
|
|
310
310
|
export { default as Language } from "./Language";
|
|
311
311
|
export { default as Latency } from "./Latency";
|
|
312
|
+
export { default as LayoutGrid } from "./LayoutGrid";
|
|
312
313
|
export { default as LayoutList } from "./LayoutList";
|
|
313
314
|
export { default as LightMode } from "./LightMode";
|
|
314
315
|
export { default as Lightbulb } from "./Lightbulb";
|
package/dist/types/index.d.ts
CHANGED
|
@@ -34,6 +34,7 @@ export { Toaster, toast, type ToasterProps, type ToastId, type ToastOptions, typ
|
|
|
34
34
|
export { Avatar, AvatarGroup, type AvatarColor, type AvatarGroupProps, type AvatarProps, type AvatarVariant } from "./components/Avatar/Avatar";
|
|
35
35
|
export { Badge, type BadgeColor, type BadgeProps, type BadgeSize, type BadgeVariant } from "./components/Badge/Badge";
|
|
36
36
|
export { BottomActions, type BottomActionsBackground, type BottomActionsProps } from "./components/BottomActions/BottomActions";
|
|
37
|
+
export { IntroHeader, type IntroHeaderAlign, type IntroHeaderProps } from "./components/IntroHeader/IntroHeader";
|
|
37
38
|
export { Card, cardColors, type CardColor, type CardMediaProps, type CardProps, type CardSize, type CardVariant } from "./components/Card/Card";
|
|
38
39
|
export { List, ListItem, type ListItemProps, type ListProps } from "./components/List/List";
|
|
39
40
|
export { Chip, type ChipProps } from "./components/Chip/Chip";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plexui/react-native",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.10",
|
|
4
4
|
"description": "Plex UI components for React Native and Expo: iOS 26 and Material 3, on the shared @plexui/styles tokens",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://plexui.com",
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
"test": "npm run typecheck && npm run lint && npm run test:web --prefix example"
|
|
85
85
|
},
|
|
86
86
|
"dependencies": {
|
|
87
|
-
"@plexui/styles": "^0.17.
|
|
87
|
+
"@plexui/styles": "^0.17.4"
|
|
88
88
|
},
|
|
89
89
|
"peerDependencies": {
|
|
90
90
|
"expo-blur": ">=15",
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import type { ComponentRef, ReactNode } from "react"
|
|
2
|
+
import { Platform, StyleSheet, View, type StyleProp, type TextStyle, type ViewStyle } from "react-native"
|
|
3
|
+
import { useRTL } from "../../internal/direction"
|
|
4
|
+
import { useTheme } from "../../theme/ThemeProvider"
|
|
5
|
+
import { IconDefaultsProvider } from "../Icon/createIcon"
|
|
6
|
+
import { Text } from "../Text/Text"
|
|
7
|
+
|
|
8
|
+
export type IntroHeaderAlign = "cells" | "text"
|
|
9
|
+
|
|
10
|
+
export type IntroHeaderProps = {
|
|
11
|
+
/** The step's title: Title 2 bold on iOS (22/28), Headline Small on Android (24/32). Read as a header. */
|
|
12
|
+
title: ReactNode
|
|
13
|
+
/** An optional line or two under the title: Title 2 in the secondary label on iOS, Body Large on Android. */
|
|
14
|
+
description?: ReactNode
|
|
15
|
+
/**
|
|
16
|
+
* An optional symbol or picture over the title, in the middle on iOS, at the start on Android. A kit icon takes
|
|
17
|
+
* the accent and 80pt on iOS (its drawing about 67), 40dp in the primary on Android, unless it sets its own.
|
|
18
|
+
*/
|
|
19
|
+
media?: ReactNode
|
|
20
|
+
/**
|
|
21
|
+
* What the title and description line up with. `cells`: the column the content under them stands on, the edge of
|
|
22
|
+
* the fields, cards and buttons (a step with a field or a few rows, as Apple Account or Set Up eSIM); `text`: the text
|
|
23
|
+
* inside the cells, the row inset (20pt, 21dp) in, over a long grouped list (as Health's Choose the Medication Type).
|
|
24
|
+
* @default "cells"
|
|
25
|
+
*/
|
|
26
|
+
align?: IntroHeaderAlign
|
|
27
|
+
testID?: string
|
|
28
|
+
style?: StyleProp<ViewStyle>
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* The header of a step in a sheet or a setup flow: an optional symbol, the step's title and what it asks, as iOS 27's
|
|
33
|
+
* own steps set them (Apple Account, Add Email Address, Recovery Key, Pair Hearing Device, Set Up eSIM, Health's
|
|
34
|
+
* medication steps). Measured on a 430pt phone: the symbol's drawing about 70pt, in the middle, its bottom about 31pt
|
|
35
|
+
* over the title's line; the title in Title 2 bold and the description in Title 2 in the secondary label right under
|
|
36
|
+
* it, both at the start of the column. The header keeps no space round it: the screen sets it 24 under its bar and the
|
|
37
|
+
* content 24 under it. Android: the setup wizard's header, a 40dp symbol in the primary at the start 16 over a Headline
|
|
38
|
+
* Small title, the description in Body Large 16 under it in onSurfaceVariant.
|
|
39
|
+
*/
|
|
40
|
+
export function IntroHeader({ title, description, media, align = "cells", testID, style }: IntroHeaderProps) {
|
|
41
|
+
const theme = useTheme()
|
|
42
|
+
const android = theme.isAndroid
|
|
43
|
+
// On the rows' text: Android's list rows keep their text 21 in (List's ANDROID_INSET), iOS's the row inset
|
|
44
|
+
const inset = align === "text" ? (android ? 21 : theme.length("--list-row-inset", 20)) : 0
|
|
45
|
+
// The text at the start: React Native turns `left` to the right in a right-to-left layout on a phone, the web keeps
|
|
46
|
+
// it left, so there the side is read from the header's direction
|
|
47
|
+
const { ref, rtl } = useRTL<ComponentRef<typeof View>>()
|
|
48
|
+
const start: TextStyle = { textAlign: Platform.OS === "web" && rtl ? "right" : "left" }
|
|
49
|
+
return (
|
|
50
|
+
<View ref={ref} testID={testID} style={[{ paddingHorizontal: inset }, style]}>
|
|
51
|
+
{media != null ? (
|
|
52
|
+
<View
|
|
53
|
+
aria-hidden
|
|
54
|
+
accessibilityElementsHidden
|
|
55
|
+
importantForAccessibility="no-hide-descendants"
|
|
56
|
+
// A symbol's box keeps about 7 round its drawing at 80: 24 under the box is the drawing's 31 over the title
|
|
57
|
+
style={[styles.media, { alignSelf: android ? "flex-start" : "center", marginBottom: android ? 16 : 24 }]}
|
|
58
|
+
>
|
|
59
|
+
<IconDefaultsProvider size={android ? 40 : 80} color={android ? theme.material.primary : theme.colors.accent}>
|
|
60
|
+
{media}
|
|
61
|
+
</IconDefaultsProvider>
|
|
62
|
+
</View>
|
|
63
|
+
) : null}
|
|
64
|
+
<Text variant="title2" weight={android ? "regular" : "bold"} accessibilityRole="header" style={start}>
|
|
65
|
+
{title}
|
|
66
|
+
</Text>
|
|
67
|
+
{description != null ? (
|
|
68
|
+
<Text variant={android ? "body" : "title2"} color="secondary" style={[start, android ? styles.androidDescription : null]}>
|
|
69
|
+
{description}
|
|
70
|
+
</Text>
|
|
71
|
+
) : null}
|
|
72
|
+
</View>
|
|
73
|
+
)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const styles = StyleSheet.create({
|
|
77
|
+
media: { alignItems: "center", justifyContent: "center" },
|
|
78
|
+
androidDescription: { marginTop: 16 },
|
|
79
|
+
})
|
|
@@ -341,7 +341,7 @@ export type ListItemProps = {
|
|
|
341
341
|
}
|
|
342
342
|
|
|
343
343
|
/**
|
|
344
|
-
* A row of a List: the label (17/22, `--field-row-*`: 52 tall,
|
|
344
|
+
* A row of a List: the label (17/22, `--field-row-*`: 52 tall, 62 with a description, 12 above and below the text at
|
|
345
345
|
* least) with a description, a leading symbol, a value (wrapping within 60% of the row, or under the label: `valuePlacement`) or a control, and the chevron
|
|
346
346
|
* of a drill-in (`Disclosure`, in the tertiary label, turned over right to left). A row with `checked` is a switch
|
|
347
347
|
* row. On Android a row of a settings screen: 50dp tall at least (64 with a description, its text 12 from the row's
|
|
@@ -525,7 +525,8 @@ function ActionRow({ children }: { children: ReactNode }) {
|
|
|
525
525
|
{last ? null : (
|
|
526
526
|
<View
|
|
527
527
|
pointerEvents="none"
|
|
528
|
-
|
|
528
|
+
// iOS: from the text to 20 before the group's end, as the other rows' lines
|
|
529
|
+
style={[styles.actionSeparator, theme.isAndroid ? { start: ANDROID_INSET } : { start: theme.length("--list-row-inset", 20), end: theme.length("--list-row-inset", 20) }, { backgroundColor: theme.isAndroid ? divider(theme) : theme.colors.separator }]}
|
|
529
530
|
/>
|
|
530
531
|
)}
|
|
531
532
|
</View>
|
|
@@ -586,7 +587,8 @@ export function ListStackedRow({ label, description, error, disabled = false, ac
|
|
|
586
587
|
return (
|
|
587
588
|
<View testID={testID} style={[styles.stackedRow, { paddingStart: inset }]}>
|
|
588
589
|
<View style={[styles.stackedColumn, { paddingEnd: inset, paddingVertical: padding, gap: android ? 4 : 0 }]}>
|
|
589
|
-
{
|
|
590
|
+
{/* iOS stops the line 20 before the group's end, as its rows' text (Settings, iOS 26 and 27) */}
|
|
591
|
+
{last ? null : <View pointerEvents="none" style={[styles.iosSeparator, { backgroundColor: android ? divider(theme) : theme.colors.separator }, android ? null : { end: inset }]} />}
|
|
590
592
|
{labelText != null && action != null ? (
|
|
591
593
|
<View style={[styles.pair, { gap: 8 }, !android && error != null ? { marginBottom: theme.length("--mobile-field-error-offset", 4) } : null]}>
|
|
592
594
|
{labelText}
|
|
@@ -667,9 +669,9 @@ function endControl(found: Exclude<FoundControl, { kind: "radio" }>, own: boolea
|
|
|
667
669
|
return { kind: found.kind, node, toggle: rowDisabled || props.disabled ? undefined : () => change(state !== true) }
|
|
668
670
|
}
|
|
669
671
|
|
|
670
|
-
/** A row's least height: 52,
|
|
672
|
+
/** A row's least height: 52, 62 with a description (as Settings, iOS 26 and 27) (`--field-row-description-min-height`), as the web's NavigationRow. */
|
|
671
673
|
const iosMinHeight = (theme: Theme, described: boolean) =>
|
|
672
|
-
described ? theme.length("--field-row-description-min-height",
|
|
674
|
+
described ? theme.length("--field-row-description-min-height", 62) : theme.length("--field-row-min-height", 52)
|
|
673
675
|
|
|
674
676
|
function iosRow(theme: Theme, last: boolean, described: boolean): ViewStyle {
|
|
675
677
|
const inset = theme.length("--list-row-inset", 20)
|
|
@@ -772,15 +774,17 @@ function IOSContent({ theme, label, description, descriptionId, leading, leading
|
|
|
772
774
|
// The text's padding centres one line (or a label and its description) in the row's least height, 12 at least, as the
|
|
773
775
|
// web's: a row of more lines (a wrapped label, a value below) keeps those 15 (14) above and below
|
|
774
776
|
// A row with a control at its end is the web's form row (`Field row`): its text keeps the control's 44pt line, 4 above
|
|
775
|
-
// and below it, or
|
|
777
|
+
// and below it, or 10 around a description, so a wrapped label or description grows the row by its own lines only
|
|
776
778
|
const target = theme.length("--control-size-lg", 44)
|
|
777
779
|
const formRow = trailing != null
|
|
780
|
+
// A two-line row keeps 10 over its label and under its description, as Settings (62 in all)
|
|
781
|
+
const descriptionPadding = theme.length("--field-row-description-padding-block", 10)
|
|
778
782
|
const textPadding = formRow
|
|
779
783
|
? description != null
|
|
780
|
-
?
|
|
784
|
+
? descriptionPadding
|
|
781
785
|
: (iosMinHeight(theme, false) - target) / 2
|
|
782
786
|
: Math.max(
|
|
783
|
-
theme.length("--field-row-text-padding-block", 12),
|
|
787
|
+
description != null ? descriptionPadding : theme.length("--field-row-text-padding-block", 12),
|
|
784
788
|
(iosMinHeight(theme, description != null) - labelType.lineHeight - (description != null ? descriptionLine : 0)) / 2,
|
|
785
789
|
)
|
|
786
790
|
// A field at the end fills the room after the label (`RowEnd.fill`)
|
|
@@ -825,12 +829,13 @@ function IOSContent({ theme, label, description, descriptionId, leading, leading
|
|
|
825
829
|
error != null ? styles.iosColumn : styles.iosMain,
|
|
826
830
|
{ minHeight: iosMinHeight(theme, description != null || error != null), paddingEnd: inset },
|
|
827
831
|
error != null
|
|
828
|
-
? { paddingVertical: Math.max(
|
|
832
|
+
? { paddingVertical: Math.max(descriptionPadding, (iosMinHeight(theme, true) - labelType.lineHeight - errorOffset - errorLine) / 2) }
|
|
829
833
|
: { gap: below ? disclosureGap : gap },
|
|
830
834
|
]}
|
|
831
835
|
>
|
|
832
|
-
{/* Over the row's bottom edge, not under it: the row keeps its height, as the web's separator
|
|
833
|
-
|
|
836
|
+
{/* Over the row's bottom edge, not under it: the row keeps its height, as the web's separator. It runs from the
|
|
837
|
+
text to 20 before the group's end (the row's end inset), as Settings draws it on iOS 26 and 27 */}
|
|
838
|
+
{last ? null : <View pointerEvents="none" style={[styles.iosSeparator, { backgroundColor: theme.colors.separator, end: inset }]} />}
|
|
834
839
|
{probe}
|
|
835
840
|
{line(
|
|
836
841
|
<>
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
// Generated by scripts/build-icons.mjs. Do not edit.
|
|
2
|
+
import { createIcon } from "../../components/Icon/createIcon"
|
|
3
|
+
|
|
4
|
+
export default createIcon("LayoutGrid", "0 0 24 24", [["path",{"d":"M4 4V9H9V4H4ZM11 9C11 10.1046 10.1046 11 9 11H4C2.89543 11 2 10.1046 2 9V4C2 2.89543 2.89543 2 4 2H9C10.1046 2 11 2.89543 11 4V9Z","fill":0}],["path",{"d":"M15 4V9H20V4H15ZM22 9C22 10.1046 21.1046 11 20 11H15C13.89543 11 13 10.1046 13 9V4C13 2.89543 13.89543 2 15 2H20C21.1046 2 22 2.89543 22 4V9Z","fill":0}],["path",{"d":"M4 15V20H9V15H4ZM11 20C11 21.1046 10.1046 22 9 22H4C2.89543 22 2 21.1046 2 20V15C2 13.89543 2.89543 13 4 13H9C10.1046 13 11 13.89543 11 15V20Z","fill":0}],["path",{"d":"M15 15V20H20V15H15ZM22 20C22 21.1046 21.1046 22 20 22H15C13.89543 22 13 21.1046 13 20V15C13 13.89543 13.89543 13 15 13H20C21.1046 13 22 13.89543 22 15V20Z","fill":0}]])
|
package/src/icons/plex/index.ts
CHANGED
|
@@ -311,6 +311,7 @@ export { default as Keyboard } from "./Keyboard"
|
|
|
311
311
|
export { default as KeyboardShortcut } from "./KeyboardShortcut"
|
|
312
312
|
export { default as Language } from "./Language"
|
|
313
313
|
export { default as Latency } from "./Latency"
|
|
314
|
+
export { default as LayoutGrid } from "./LayoutGrid"
|
|
314
315
|
export { default as LayoutList } from "./LayoutList"
|
|
315
316
|
export { default as LightMode } from "./LightMode"
|
|
316
317
|
export { default as Lightbulb } from "./Lightbulb"
|
package/src/index.ts
CHANGED
|
@@ -92,6 +92,7 @@ export { Toaster, toast, type ToasterProps, type ToastId, type ToastOptions, typ
|
|
|
92
92
|
export { Avatar, AvatarGroup, type AvatarColor, type AvatarGroupProps, type AvatarProps, type AvatarVariant } from "./components/Avatar/Avatar"
|
|
93
93
|
export { Badge, type BadgeColor, type BadgeProps, type BadgeSize, type BadgeVariant } from "./components/Badge/Badge"
|
|
94
94
|
export { BottomActions, type BottomActionsBackground, type BottomActionsProps } from "./components/BottomActions/BottomActions"
|
|
95
|
+
export { IntroHeader, type IntroHeaderAlign, type IntroHeaderProps } from "./components/IntroHeader/IntroHeader"
|
|
95
96
|
export { Card, cardColors, type CardColor, type CardMediaProps, type CardProps, type CardSize, type CardVariant } from "./components/Card/Card"
|
|
96
97
|
export { List, ListItem, type ListItemProps, type ListProps } from "./components/List/List"
|
|
97
98
|
export { Chip, type ChipProps } from "./components/Chip/Chip"
|