@plexui/react-native 0.2.29 → 0.2.31

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.
@@ -6,7 +6,20 @@ import { createIcon } from "./createIcon";
6
6
  */
7
7
  /** `arrow_drop_down`: a sharp 10x5 triangle in a 24dp box (Compose `ExposedDropdownMenuDefaults.TrailingIcon`). */
8
8
  export const MaterialArrowDropDown = createIcon("MaterialArrowDropDown", "0 0 24 24", [["path", { d: "M7 10l5 5 5-5z", fill: 0 }]]);
9
- /** `cancel`: a ring with an X, the clear button of a text field's trailing slot. */
9
+ /**
10
+ * Material Components' `mtrl_ic_cancel`: a solid circle with the X cut out, 24dp, the clear-text end icon of a text
11
+ * field (TextInputLayout END_ICON_CLEAR_TEXT), tinted onSurfaceVariant.
12
+ */
13
+ export const MaterialCancelFilled = createIcon("MaterialCancelFilled", "0 0 24 24", [
14
+ [
15
+ "path",
16
+ {
17
+ d: "M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm5 13.59L15.59 17 12 13.41 8.41 17 7 15.59 10.59 12 7 8.41 8.41 7 12 10.59 15.59 7 17 8.41 13.41 12 17 15.59z",
18
+ fill: 0,
19
+ },
20
+ ],
21
+ ]);
22
+ /** `cancel`: a ring with an X (Material Symbols Outlined). */
10
23
  export const MaterialCancel = createIcon("MaterialCancel", "0 -960 960 960", [
11
24
  [
12
25
  "path",
@@ -14,7 +14,7 @@ import { androidGray, barShadow, barSurface, withAlpha, dangerText, stateLayer }
14
14
  import { useTheme } from "../../theme/ThemeProvider";
15
15
  import { BarFieldContext } from "../Button/Button";
16
16
  import { IconDefaultsProvider } from "../Icon/createIcon";
17
- import { MaterialCancel, MaterialClose } from "../Icon/material";
17
+ import { MaterialCancelFilled, MaterialClose } from "../Icon/material";
18
18
  /**
19
19
  * The phone layer's field at each size: Input.module.css's size table under touch.css's phone rules, which give every
20
20
  * size 17pt text and a 14pt gutter (11 beside a start adornment, `html [data-slot="input"]`, scoped rules with no root
@@ -116,7 +116,7 @@ export function fieldLook(theme, { variant, size, pill, startAdornment = false,
116
116
  gutter: 18,
117
117
  };
118
118
  }
119
- // Android's fields: `outline` is the outlined field (radius 8, a hairline in a light gray that thickens to 1.5dp in
119
+ // Android's fields: `outline` is the outlined field (radius 8, a hairline in Material's outline that thickens to 1.5dp in
120
120
  // the accent on focus, the label floating on the top line, the text 16), `soft` a field filled with the text color
121
121
  // at 5% (the chips' and sheets' search fields), `ghost` the bare field of a card (the text 17, 22 in). The hint is
122
122
  // a light gray (#A8A8A8, #7D7D7D at night); a field is 50dp (a row's height), 56 with a label; disabled dims it to
@@ -126,8 +126,9 @@ export function fieldLook(theme, { variant, size, pill, startAdornment = false,
126
126
  const accent = state.invalid ? dangerText(theme) : state.focused ? focusAccent(theme) : null;
127
127
  const height = label ? 56 : 50;
128
128
  const radius = pill ? height / 2 : 8;
129
- // The idle line: a hairline in a light gray (#DBDBDB), the text at 24% in dark mode
130
- const idle = androidGray(theme, "fieldLine");
129
+ // The idle line: Material 3's `outline` role (tone 50, 60 at night), at least 3:1 on the surface as a field's
130
+ // boundary needs; the lighter `--android-field-line` gray read as no field at all on a light screen
131
+ const idle = m.outline;
131
132
  const frame = outlined
132
133
  ? { outlined: true, color: accent ?? idle, width: state.focused && !state.disabled ? FOCUS_LINE : hairline(), radius }
133
134
  : state.invalid
@@ -166,7 +167,8 @@ export function fieldLook(theme, { variant, size, pill, startAdornment = false,
166
167
  }
167
168
  if (bar) {
168
169
  // A Toolbar's search field (Toolbar.module.css, iOS 26 kit Search Top and Bottom): the bar's item height, the
169
- // glass of its buttons, the bar's magnifier in the label color, its text Regular at the bar's label size
170
+ // glass of its buttons, the bar's magnifier in the hint's gray (iOS 26 draws the glyph and "Search" in one
171
+ // color, typed in or not), its text Regular at the bar's label size
170
172
  const gutter = theme.length("--toolbar-search-gutter", 10.54);
171
173
  return {
172
174
  box: {
@@ -184,7 +186,7 @@ export function fieldLook(theme, { variant, size, pill, startAdornment = false,
184
186
  color: theme.color("--input-text-color", theme.colors.text),
185
187
  },
186
188
  placeholder: theme.color("--toolbar-search-placeholder-color", theme.colors.textTertiary),
187
- icon: theme.color("--color-text", theme.colors.text),
189
+ icon: theme.color("--toolbar-search-icon-color", theme.color("--toolbar-search-placeholder-color", theme.colors.textTertiary)),
188
190
  frame: null,
189
191
  trailingIcon: theme.color("--mobile-label-secondary"),
190
192
  caret: theme.color("--color-background-accent-solid"),
@@ -441,16 +443,18 @@ export function InputField({ variant = "outline", size = "md", disabled = false,
441
443
  useEffect(() => springTo(line, thick ? 1 : 0, FIELD_SPRING, theme.reducedMotion), [thick, line, theme.reducedMotion]);
442
444
  const lineColor = useSpringColor(look.frame?.color ?? "transparent", FIELD_SPRING.stiffness, !lined || theme.reducedMotion);
443
445
  const lineMotion = lined ? { color: lineColor, width: line.interpolate({ inputRange: [0, 1], outputRange: [hairline(), FOCUS_LINE] }) } : null;
444
- // Android's label is in the hint color at rest and in the accent while the field has focus, springing between them
445
- const labelColor = invalid ? dangerText(theme) : focused ? focusAccent(theme) : look.placeholder;
446
+ // Android's label is Material 3's `onSurfaceVariant` at rest or floating (tone 30, 80 at night: text contrast, which
447
+ // the hint gray is not) and the accent while the field has focus, springing between them; the hint stays lighter
448
+ const labelColor = invalid ? dangerText(theme) : focused ? focusAccent(theme) : theme.isAndroid ? theme.material.onSurfaceVariant : look.placeholder;
446
449
  const labelTint = useSpringColor(labelColor, FIELD_SPRING.stiffness, !floating || theme.reducedMotion);
447
450
  // iOS shows a form field's clear button while it is edited (UITextField's whileEditing), a search field's while it
448
- // has text; Android while the field has text
451
+ // has text; Android's text field while it has focus and text (Material Components' ClearTextEndIconDelegate), its
452
+ // search fields with the text (androidClear, below)
449
453
  const searchField = rest.inputMode === "search" || barField != null;
450
454
  // A value at a row's end has no clear button on iOS, as Settings' and Contacts' rows: only a value that starts its
451
455
  // column or stands on its own line under the label takes one
452
456
  const valueRight = !startAligned && (inRow || (fillsRow && valueAtEnd));
453
- const showClear = !!onClear && filled && !disabled && !readOnly && (theme.isAndroid || ((focused || clearing || searchField) && !valueRight));
457
+ const showClear = !!onClear && filled && !disabled && !readOnly && (theme.isAndroid ? focused || clearing : (focused || clearing || searchField) && !valueRight);
454
458
  // Android's search fields keep their clear button in place and show it with the text
455
459
  const androidClear = (search || barSearch) && !!onClear && !disabled && !readOnly;
456
460
  // A 24dp icon stands 12 in, the text 12 past it (48 in); otherwise the text is 14 in (the outlined field), 21 in a
@@ -552,14 +556,16 @@ export function InputField({ variant = "outline", size = "md", disabled = false,
552
556
  if (!locked)
553
557
  input.current?.focus();
554
558
  } })) : showClear ? (_jsx(Pressable, { accessibilityRole: "button", accessibilityLabel: "Clear", onFocus: () => setClearing(true), onBlur: () => setClearing(false), ...(Platform.OS === "web" ? { onMouseDown: (event) => event.preventDefault() } : null), onPress: () => {
555
- // As UIKit's clear button, the field keeps editing; first, so a caller's onClear may still move the focus
556
- if (!theme.isAndroid && !searchField)
559
+ // As UIKit's clear button and Material's clear-text icon, the field keeps editing (the button goes with
560
+ // the text, so it lets its own focus go); first, so a caller's onClear may still move the focus
561
+ setClearing(false);
562
+ if (!searchField)
557
563
  input.current?.focus();
558
564
  if (value === undefined)
559
565
  setOwn("");
560
566
  onChangeText?.("");
561
567
  onClear();
562
- }, style: [styles.clear, { width: look.clearTarget, minHeight: look.clearTarget }, theme.isAndroid ? styles.clearStretch : null, clearMargin], children: theme.isAndroid ? _jsx(MaterialCancel, { size: look.clearSize, color: look.trailingIcon }) : _jsx(XCircleFilled, { size: look.clearSize, color: theme.color("--mobile-label-tertiary") }) })) : null, endAdornment ? (_jsx(IconDefaultsProvider, { size: look.iconSize, color: look.trailingIcon, children: adornment(endAdornment, "end") })) : null] }));
568
+ }, style: [styles.clear, { width: look.clearTarget, minHeight: look.clearTarget }, theme.isAndroid ? styles.clearStretch : null, clearMargin], children: theme.isAndroid ? _jsx(MaterialCancelFilled, { size: look.clearSize, color: look.trailingIcon }) : _jsx(XCircleFilled, { size: look.clearSize, color: theme.color("--mobile-label-tertiary") }) })) : null, endAdornment ? (_jsx(IconDefaultsProvider, { size: look.iconSize, color: look.trailingIcon, children: adornment(endAdornment, "end") })) : null] }));
563
569
  }
564
570
  /**
565
571
  * The field's box: a View, or for a bar's search field the glass of the bar's buttons. With `shift` it moves sideways
@@ -5,7 +5,12 @@
5
5
  */
6
6
  /** `arrow_drop_down`: a sharp 10x5 triangle in a 24dp box (Compose `ExposedDropdownMenuDefaults.TrailingIcon`). */
7
7
  export declare const MaterialArrowDropDown: import("./createIcon").IconComponent;
8
- /** `cancel`: a ring with an X, the clear button of a text field's trailing slot. */
8
+ /**
9
+ * Material Components' `mtrl_ic_cancel`: a solid circle with the X cut out, 24dp, the clear-text end icon of a text
10
+ * field (TextInputLayout END_ICON_CLEAR_TEXT), tinted onSurfaceVariant.
11
+ */
12
+ export declare const MaterialCancelFilled: import("./createIcon").IconComponent;
13
+ /** `cancel`: a ring with an X (Material Symbols Outlined). */
9
14
  export declare const MaterialCancel: import("./createIcon").IconComponent;
10
15
  /** `close`: a 14dp X of 2dp strokes in a 24dp box (`Icons.Filled.Close`, the snackbar's dismiss action, an app bar's close). */
11
16
  export declare const MaterialClose: import("./createIcon").IconComponent;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plexui/react-native",
3
- "version": "0.2.29",
3
+ "version": "0.2.31",
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.6",
87
+ "@plexui/styles": "^0.17.10",
88
88
  "libphonenumber-js": "^1.13.17"
89
89
  },
90
90
  "peerDependencies": {
@@ -9,7 +9,21 @@ import { createIcon } from "./createIcon"
9
9
  /** `arrow_drop_down`: a sharp 10x5 triangle in a 24dp box (Compose `ExposedDropdownMenuDefaults.TrailingIcon`). */
10
10
  export const MaterialArrowDropDown = createIcon("MaterialArrowDropDown", "0 0 24 24", [["path", { d: "M7 10l5 5 5-5z", fill: 0 }]])
11
11
 
12
- /** `cancel`: a ring with an X, the clear button of a text field's trailing slot. */
12
+ /**
13
+ * Material Components' `mtrl_ic_cancel`: a solid circle with the X cut out, 24dp, the clear-text end icon of a text
14
+ * field (TextInputLayout END_ICON_CLEAR_TEXT), tinted onSurfaceVariant.
15
+ */
16
+ export const MaterialCancelFilled = createIcon("MaterialCancelFilled", "0 0 24 24", [
17
+ [
18
+ "path",
19
+ {
20
+ d: "M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm5 13.59L15.59 17 12 13.41 8.41 17 7 15.59 10.59 12 7 8.41 8.41 7 12 10.59 15.59 7 17 8.41 13.41 12 17 15.59z",
21
+ fill: 0,
22
+ },
23
+ ],
24
+ ])
25
+
26
+ /** `cancel`: a ring with an X (Material Symbols Outlined). */
13
27
  export const MaterialCancel = createIcon("MaterialCancel", "0 -960 960 960", [
14
28
  [
15
29
  "path",
@@ -14,7 +14,7 @@ import { useTheme } from "../../theme/ThemeProvider"
14
14
  import type { Theme } from "../../theme/types"
15
15
  import { BarFieldContext, type ControlSize } from "../Button/Button"
16
16
  import { IconDefaultsProvider } from "../Icon/createIcon"
17
- import { MaterialCancel, MaterialClose } from "../Icon/material"
17
+ import { MaterialCancelFilled, MaterialClose } from "../Icon/material"
18
18
 
19
19
  export type InputVariant = "outline" | "soft" | "ghost"
20
20
 
@@ -174,7 +174,7 @@ export function fieldLook(
174
174
  gutter: 18,
175
175
  }
176
176
  }
177
- // Android's fields: `outline` is the outlined field (radius 8, a hairline in a light gray that thickens to 1.5dp in
177
+ // Android's fields: `outline` is the outlined field (radius 8, a hairline in Material's outline that thickens to 1.5dp in
178
178
  // the accent on focus, the label floating on the top line, the text 16), `soft` a field filled with the text color
179
179
  // at 5% (the chips' and sheets' search fields), `ghost` the bare field of a card (the text 17, 22 in). The hint is
180
180
  // a light gray (#A8A8A8, #7D7D7D at night); a field is 50dp (a row's height), 56 with a label; disabled dims it to
@@ -184,8 +184,9 @@ export function fieldLook(
184
184
  const accent = state.invalid ? dangerText(theme) : state.focused ? focusAccent(theme) : null
185
185
  const height = label ? 56 : 50
186
186
  const radius = pill ? height / 2 : 8
187
- // The idle line: a hairline in a light gray (#DBDBDB), the text at 24% in dark mode
188
- const idle = androidGray(theme, "fieldLine")
187
+ // The idle line: Material 3's `outline` role (tone 50, 60 at night), at least 3:1 on the surface as a field's
188
+ // boundary needs; the lighter `--android-field-line` gray read as no field at all on a light screen
189
+ const idle = m.outline
189
190
  const frame: FieldFrame | null = outlined
190
191
  ? { outlined: true, color: accent ?? idle, width: state.focused && !state.disabled ? FOCUS_LINE : hairline(), radius }
191
192
  : state.invalid
@@ -224,7 +225,8 @@ export function fieldLook(
224
225
  }
225
226
  if (bar) {
226
227
  // A Toolbar's search field (Toolbar.module.css, iOS 26 kit Search Top and Bottom): the bar's item height, the
227
- // glass of its buttons, the bar's magnifier in the label color, its text Regular at the bar's label size
228
+ // glass of its buttons, the bar's magnifier in the hint's gray (iOS 26 draws the glyph and "Search" in one
229
+ // color, typed in or not), its text Regular at the bar's label size
228
230
  const gutter = theme.length("--toolbar-search-gutter", 10.54)
229
231
  return {
230
232
  box: {
@@ -242,7 +244,7 @@ export function fieldLook(
242
244
  color: theme.color("--input-text-color", theme.colors.text),
243
245
  },
244
246
  placeholder: theme.color("--toolbar-search-placeholder-color", theme.colors.textTertiary),
245
- icon: theme.color("--color-text", theme.colors.text),
247
+ icon: theme.color("--toolbar-search-icon-color", theme.color("--toolbar-search-placeholder-color", theme.colors.textTertiary)),
246
248
  frame: null as FieldFrame | null,
247
249
  trailingIcon: theme.color("--mobile-label-secondary"),
248
250
  caret: theme.color("--color-background-accent-solid"),
@@ -648,17 +650,19 @@ export function InputField({
648
650
  useEffect(() => springTo(line, thick ? 1 : 0, FIELD_SPRING, theme.reducedMotion), [thick, line, theme.reducedMotion])
649
651
  const lineColor = useSpringColor(look.frame?.color ?? "transparent", FIELD_SPRING.stiffness, !lined || theme.reducedMotion)
650
652
  const lineMotion: FrameMotion | null = lined ? { color: lineColor, width: line.interpolate({ inputRange: [0, 1], outputRange: [hairline(), FOCUS_LINE] }) } : null
651
- // Android's label is in the hint color at rest and in the accent while the field has focus, springing between them
652
- const labelColor = invalid ? dangerText(theme) : focused ? focusAccent(theme) : look.placeholder
653
+ // Android's label is Material 3's `onSurfaceVariant` at rest or floating (tone 30, 80 at night: text contrast, which
654
+ // the hint gray is not) and the accent while the field has focus, springing between them; the hint stays lighter
655
+ const labelColor = invalid ? dangerText(theme) : focused ? focusAccent(theme) : theme.isAndroid ? theme.material.onSurfaceVariant : look.placeholder
653
656
  const labelTint = useSpringColor(labelColor, FIELD_SPRING.stiffness, !floating || theme.reducedMotion)
654
657
  // iOS shows a form field's clear button while it is edited (UITextField's whileEditing), a search field's while it
655
- // has text; Android while the field has text
658
+ // has text; Android's text field while it has focus and text (Material Components' ClearTextEndIconDelegate), its
659
+ // search fields with the text (androidClear, below)
656
660
  const searchField = rest.inputMode === "search" || barField != null
657
661
  // A value at a row's end has no clear button on iOS, as Settings' and Contacts' rows: only a value that starts its
658
662
  // column or stands on its own line under the label takes one
659
663
  const valueRight = !startAligned && (inRow || (fillsRow && valueAtEnd))
660
664
  const showClear =
661
- !!onClear && filled && !disabled && !readOnly && (theme.isAndroid || ((focused || clearing || searchField) && !valueRight))
665
+ !!onClear && filled && !disabled && !readOnly && (theme.isAndroid ? focused || clearing : (focused || clearing || searchField) && !valueRight)
662
666
  // Android's search fields keep their clear button in place and show it with the text
663
667
  const androidClear = (search || barSearch) && !!onClear && !disabled && !readOnly
664
668
  // A 24dp icon stands 12 in, the text 12 past it (48 in); otherwise the text is 14 in (the outlined field), 21 in a
@@ -857,15 +861,17 @@ export function InputField({
857
861
  // On the web a press would blur the field before it lands and take the button away: the field keeps focus
858
862
  {...(Platform.OS === "web" ? ({ onMouseDown: (event: { preventDefault: () => void }) => event.preventDefault() } as object) : null)}
859
863
  onPress={() => {
860
- // As UIKit's clear button, the field keeps editing; first, so a caller's onClear may still move the focus
861
- if (!theme.isAndroid && !searchField) input.current?.focus()
864
+ // As UIKit's clear button and Material's clear-text icon, the field keeps editing (the button goes with
865
+ // the text, so it lets its own focus go); first, so a caller's onClear may still move the focus
866
+ setClearing(false)
867
+ if (!searchField) input.current?.focus()
862
868
  if (value === undefined) setOwn("")
863
869
  onChangeText?.("")
864
870
  onClear()
865
871
  }}
866
872
  style={[styles.clear, { width: look.clearTarget, minHeight: look.clearTarget }, theme.isAndroid ? styles.clearStretch : null, clearMargin]}
867
873
  >
868
- {theme.isAndroid ? <MaterialCancel size={look.clearSize} color={look.trailingIcon} /> : <XCircleFilled size={look.clearSize} color={theme.color("--mobile-label-tertiary")} />}
874
+ {theme.isAndroid ? <MaterialCancelFilled size={look.clearSize} color={look.trailingIcon} /> : <XCircleFilled size={look.clearSize} color={theme.color("--mobile-label-tertiary")} />}
869
875
  </Pressable>
870
876
  ) : null}
871
877
  {endAdornment ? (