@plexui/react-native 0.2.29 → 0.2.30

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
@@ -441,16 +442,18 @@ export function InputField({ variant = "outline", size = "md", disabled = false,
441
442
  useEffect(() => springTo(line, thick ? 1 : 0, FIELD_SPRING, theme.reducedMotion), [thick, line, theme.reducedMotion]);
442
443
  const lineColor = useSpringColor(look.frame?.color ?? "transparent", FIELD_SPRING.stiffness, !lined || theme.reducedMotion);
443
444
  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;
445
+ // Android's label is Material 3's `onSurfaceVariant` at rest or floating (tone 30, 80 at night: text contrast, which
446
+ // the hint gray is not) and the accent while the field has focus, springing between them; the hint stays lighter
447
+ const labelColor = invalid ? dangerText(theme) : focused ? focusAccent(theme) : theme.isAndroid ? theme.material.onSurfaceVariant : look.placeholder;
446
448
  const labelTint = useSpringColor(labelColor, FIELD_SPRING.stiffness, !floating || theme.reducedMotion);
447
449
  // 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
450
+ // has text; Android's text field while it has focus and text (Material Components' ClearTextEndIconDelegate), its
451
+ // search fields with the text (androidClear, below)
449
452
  const searchField = rest.inputMode === "search" || barField != null;
450
453
  // 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
454
  // column or stands on its own line under the label takes one
452
455
  const valueRight = !startAligned && (inRow || (fillsRow && valueAtEnd));
453
- const showClear = !!onClear && filled && !disabled && !readOnly && (theme.isAndroid || ((focused || clearing || searchField) && !valueRight));
456
+ const showClear = !!onClear && filled && !disabled && !readOnly && (theme.isAndroid ? focused || clearing : (focused || clearing || searchField) && !valueRight);
454
457
  // Android's search fields keep their clear button in place and show it with the text
455
458
  const androidClear = (search || barSearch) && !!onClear && !disabled && !readOnly;
456
459
  // 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 +555,16 @@ export function InputField({ variant = "outline", size = "md", disabled = false,
552
555
  if (!locked)
553
556
  input.current?.focus();
554
557
  } })) : 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)
558
+ // As UIKit's clear button and Material's clear-text icon, the field keeps editing (the button goes with
559
+ // the text, so it lets its own focus go); first, so a caller's onClear may still move the focus
560
+ setClearing(false);
561
+ if (!searchField)
557
562
  input.current?.focus();
558
563
  if (value === undefined)
559
564
  setOwn("");
560
565
  onChangeText?.("");
561
566
  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] }));
567
+ }, 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
568
  }
564
569
  /**
565
570
  * 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.30",
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",
@@ -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
@@ -648,17 +649,19 @@ export function InputField({
648
649
  useEffect(() => springTo(line, thick ? 1 : 0, FIELD_SPRING, theme.reducedMotion), [thick, line, theme.reducedMotion])
649
650
  const lineColor = useSpringColor(look.frame?.color ?? "transparent", FIELD_SPRING.stiffness, !lined || theme.reducedMotion)
650
651
  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
652
+ // Android's label is Material 3's `onSurfaceVariant` at rest or floating (tone 30, 80 at night: text contrast, which
653
+ // the hint gray is not) and the accent while the field has focus, springing between them; the hint stays lighter
654
+ const labelColor = invalid ? dangerText(theme) : focused ? focusAccent(theme) : theme.isAndroid ? theme.material.onSurfaceVariant : look.placeholder
653
655
  const labelTint = useSpringColor(labelColor, FIELD_SPRING.stiffness, !floating || theme.reducedMotion)
654
656
  // 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
657
+ // has text; Android's text field while it has focus and text (Material Components' ClearTextEndIconDelegate), its
658
+ // search fields with the text (androidClear, below)
656
659
  const searchField = rest.inputMode === "search" || barField != null
657
660
  // 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
661
  // column or stands on its own line under the label takes one
659
662
  const valueRight = !startAligned && (inRow || (fillsRow && valueAtEnd))
660
663
  const showClear =
661
- !!onClear && filled && !disabled && !readOnly && (theme.isAndroid || ((focused || clearing || searchField) && !valueRight))
664
+ !!onClear && filled && !disabled && !readOnly && (theme.isAndroid ? focused || clearing : (focused || clearing || searchField) && !valueRight)
662
665
  // Android's search fields keep their clear button in place and show it with the text
663
666
  const androidClear = (search || barSearch) && !!onClear && !disabled && !readOnly
664
667
  // 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 +860,17 @@ export function InputField({
857
860
  // On the web a press would blur the field before it lands and take the button away: the field keeps focus
858
861
  {...(Platform.OS === "web" ? ({ onMouseDown: (event: { preventDefault: () => void }) => event.preventDefault() } as object) : null)}
859
862
  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()
863
+ // As UIKit's clear button and Material's clear-text icon, the field keeps editing (the button goes with
864
+ // the text, so it lets its own focus go); first, so a caller's onClear may still move the focus
865
+ setClearing(false)
866
+ if (!searchField) input.current?.focus()
862
867
  if (value === undefined) setOwn("")
863
868
  onChangeText?.("")
864
869
  onClear()
865
870
  }}
866
871
  style={[styles.clear, { width: look.clearTarget, minHeight: look.clearTarget }, theme.isAndroid ? styles.clearStretch : null, clearMargin]}
867
872
  >
868
- {theme.isAndroid ? <MaterialCancel size={look.clearSize} color={look.trailingIcon} /> : <XCircleFilled size={look.clearSize} color={theme.color("--mobile-label-tertiary")} />}
873
+ {theme.isAndroid ? <MaterialCancelFilled size={look.clearSize} color={look.trailingIcon} /> : <XCircleFilled size={look.clearSize} color={theme.color("--mobile-label-tertiary")} />}
869
874
  </Pressable>
870
875
  ) : null}
871
876
  {endAdornment ? (