@plexui/react-native 0.2.28 → 0.2.29

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.
@@ -40,10 +40,11 @@ export function BottomActions({ children, floating = false, background = "soft",
40
40
  style: [{ minHeight: height, borderRadius: height / 2 }, props.style],
41
41
  });
42
42
  // A disabled button's fill is see-through (the gray of iOS's disabled button): floating over the content it stands
43
- // on the screen's color, so the rows under it do not show through
44
- if (!floating || !props.disabled || android)
43
+ // on the screen's color, so the rows under it do not show through. The backing stays, clear, while the button is
44
+ // enabled: the button keeps its place in the tree, and with it focus, a screen reader's place and a press
45
+ if (!floating || android)
45
46
  return button;
46
- return (_jsx(View, { style: { borderRadius: height / 2, backgroundColor: canvas, alignSelf: (props.block ?? true) ? "stretch" : "flex-start" }, children: button }, child.key ?? index));
47
+ return (_jsx(View, { style: { borderRadius: height / 2, backgroundColor: props.disabled ? canvas : "transparent", alignSelf: (props.block ?? true) ? "stretch" : "flex-start" }, children: button }, child.key ?? index));
47
48
  });
48
49
  return (_jsxs(View, { testID: testID, pointerEvents: "box-none", style: [styles.bar, { paddingHorizontal: side, paddingTop, paddingBottom: bottom, gap: 8 }, floating ? styles.floating : null, style], children: [floating ? (android ? (_jsx(SoftBottomEdge, { fill: withAlpha(canvas, ANDROID_FADE_ALPHA), top: paddingTop - 13 + 60, tail: 60, blur: 0, stops: ANDROID_FADE_STOPS })) : background === "fade" ? (_jsx(TabBarFade, { fill: canvas, top: paddingTop })) : (_jsx(SoftBottomEdge, { fill: canvas, top: paddingTop, tail: 27, blur: theme.length("--toolbar-edge-blur-small", 3) }))) : null, actions] }));
49
50
  }
@@ -229,7 +229,7 @@ export function BottomSheetBase({ open, onOpenChange, title, children, dismissib
229
229
  // (69 in all). Content scrolled under it shows through the sheet's color at
230
230
  // 63% over a light blur, let go over its last 32dp (12 past the bar), with no line
231
231
  const barItem = useMemoBarItem(background);
232
- const header = android ? (title != null ? (_jsxs(View, { onStartShouldSetResponderCapture: gesture.chrome, onLayout: (event) => setAndroidBarHeight(Math.max(ANDROID_BAR_HEIGHT, event.nativeEvent.layout.height)), style: styles.androidBar, children: [_jsx(SheetBarFade, { fill: background, shown: scrolled }), _jsx(View, { style: styles.androidCircle, children: dismissible ? (_jsx(BarItemContext.Provider, { value: barItem, children: _jsx(NavigationButton, { action: "close", accessibilityLabel: closeLabel, onPress: close }) })) : null }), _jsx(View, { style: styles.androidHeading, children: _jsx(Text, { nativeID: titleId, accessibilityRole: "header", weight: "medium", align: "center", numberOfLines: 2, color: m.onSurface, style: { fontSize: titleType.fontSize, lineHeight: titleType.lineHeight }, children: title }) }), _jsx(View, { style: styles.androidCircle })] })) : (_jsx(View, { onStartShouldSetResponderCapture: gesture.chrome, style: styles.androidGrip }))) : dismissible || title != null ? (
232
+ const header = android ? (title != null ? (_jsxs(View, { onStartShouldSetResponderCapture: gesture.chrome, onLayout: (event) => setAndroidBarHeight(Math.max(ANDROID_BAR_HEIGHT, event.nativeEvent.layout.height)), style: [styles.androidBar, { paddingHorizontal: androidInline }], children: [_jsx(SheetBarFade, { fill: background, shown: scrolled }), _jsx(View, { style: styles.androidCircle, children: dismissible ? (_jsx(BarItemContext.Provider, { value: barItem, children: _jsx(NavigationButton, { action: "close", accessibilityLabel: closeLabel, onPress: close }) })) : null }), _jsx(View, { style: styles.androidHeading, children: _jsx(Text, { nativeID: titleId, accessibilityRole: "header", weight: "medium", align: "center", numberOfLines: 2, color: m.onSurface, style: { fontSize: titleType.fontSize, lineHeight: titleType.lineHeight }, children: title }) }), _jsx(View, { style: styles.androidCircle })] })) : (_jsx(View, { onStartShouldSetResponderCapture: gesture.chrome, style: styles.androidGrip }))) : dismissible || title != null ? (
233
233
  // The web's phone Sheet bar: one 44 row 16 under the top edge, Close at the leading edge and the title alone centered
234
234
  // The bar is the web's Toolbar: 16 above the row and --toolbar-padding-bottom under it
235
235
  _jsxs(View, { ...responder.panHandlers, style: [styles.iosBar, { paddingTop: theme.length("--dialog-sheet-action-inset-block", 16), paddingBottom: theme.length("--toolbar-padding-bottom", 10), paddingHorizontal: margin }], children: [_jsx(View, { style: { width: closeSize, height: closeSize }, children: dismissible ? _jsx(NavigationButton, { action: "close", accessibilityLabel: closeLabel, onPress: close }) : null }), _jsx(View, { style: [styles.iosHeading, { minHeight: closeSize }], children: title != null ? (_jsx(Text, { nativeID: titleId, accessibilityRole: "header", weight: "semibold", align: "center", style: { fontSize: titleType.fontSize, lineHeight: titleType.lineHeight }, children: title })) : null }), _jsx(View, { style: { width: closeSize } })] })) : null;
@@ -579,11 +579,12 @@ export function TextField({ label, description, errorMessage, required, invalid,
579
579
  const theme = useTheme();
580
580
  const [typed, setTyped] = useState((input.defaultValue ?? "").length);
581
581
  const count = input.value != null ? input.value.length : typed;
582
- const counterText = counter && input.maxLength != null ? (_jsxs(Text, { color: "secondary", accessibilityLabel: `${count} of ${input.maxLength}`, style: [
582
+ const own = typeof counter === "string" ? counter : null;
583
+ const counterText = own != null || (counter === true && input.maxLength != null) ? (_jsx(Text, { color: "secondary", accessibilityLabel: own ?? `${count} of ${input.maxLength}`, style: [
583
584
  theme.isAndroid ? styles.androidCounter : styles.iosCounter,
584
585
  { opacity: input.disabled ? 0.5 : 1 },
585
586
  theme.isAndroid ? { color: theme.colors.textSecondary } : null,
586
- ], children: [count, "/", input.maxLength] })) : null;
587
+ ], children: own ?? `${count}/${input.maxLength}` })) : null;
587
588
  const end = labelAction != null && counterText != null ? (_jsxs(View, { style: styles.endRow, children: [labelAction, counterText] })) : (labelAction ?? counterText);
588
589
  // The count follows every edit, so a counter shown later reads the text as it is
589
590
  const field = { ...input, onChangeText: (next) => (setTyped(next.length), input.onChangeText?.(next)) };
@@ -489,8 +489,11 @@ function AndroidContent({ handPress, valueColor, theme, label, description, desc
489
489
  // Android's row symbols are the text's ink over a light card and a gray over a dark one
490
490
  const symbol = dim(destructive ? danger : theme.scheme === "dark" ? theme.colors.labelSecondary : theme.colors.text);
491
491
  const tile = leading != null && !!leadingColor;
492
+ // A picture wider than the symbol's 24 (a photo, an avatar) keeps its own size from the rows' inset (21, where the
493
+ // header and the footer stand), the text 16 past it, as Material's list item with a leading avatar; 0 for a symbol
494
+ const [wide, setWide] = useState(0);
492
495
  // The text (and the divider) 21 in, or 64 after a symbol, a tile or a choice's mark (its 20dp circle 22 in)
493
- const textStart = leading == null ? ANDROID_INSET : 64;
496
+ const textStart = leading == null ? ANDROID_INSET : wide > 0 && !tile && !leadingMark ? ANDROID_INSET + wide + 16 : 64;
494
497
  // A value that ends the row stands 17 from the end (a value row), 20 in a row with a tile (a tiled row)
495
498
  const valueEnd = trailing == null && !tile ? 17 : 20;
496
499
  // At the end the value takes half the row at most, 16 from the label and from a control
@@ -503,7 +506,14 @@ function AndroidContent({ handPress, valueColor, theme, label, description, desc
503
506
  const columns = useContext(ListOptionsContext)?.columns === true && trailing != null;
504
507
  const startsColumn = columns && !edgeControl;
505
508
  const rowEnd = useMemo(() => ({ fill: setFill, press: handPress, align: startsColumn ? "start" : "end", valueColor }), [handPress, startsColumn, valueColor]);
506
- const parts = (_jsxs(_Fragment, { children: [leading == null ? null : leadingMark ? (_jsx(View, { style: styles.androidMark, children: leading })) : (_jsx(View, { style: tile ? [styles.androidTile, { backgroundColor: leadingColor, opacity: disabled ? 0.5 : 1 }] : styles.androidIcon, children: _jsx(IconDefaultsProvider, { size: 24, color: tile ? "#ffffff" : symbol, children: leading }) })), _jsxs(View, { style: [
509
+ const parts = (_jsxs(_Fragment, { children: [leading == null ? null : leadingMark ? (_jsx(View, { style: styles.androidMark, children: leading })) : (_jsx(View, { style: tile ? [styles.androidTile, { backgroundColor: leadingColor, opacity: disabled ? 0.5 : 1 }] : [styles.androidIcon, wide > 0 ? styles.androidWide : null], onLayout: tile
510
+ ? undefined
511
+ : (event) => {
512
+ const width = event.nativeEvent.layout.width;
513
+ const next = width > 24.5 ? width : 0;
514
+ if (Math.abs(next - wide) > 0.5)
515
+ setWide(next);
516
+ }, children: _jsx(IconDefaultsProvider, { size: 24, color: tile ? "#ffffff" : symbol, children: leading }) })), _jsxs(View, { style: [
507
517
  columns ? [styles.androidTextHug, styles.column] : fill ? styles.androidTextHug : styles.androidText,
508
518
  // One line centred in the 50dp row (54 beside a text field: a card's input row); with a second line 12 above
509
519
  // and below (a 64dp row)
@@ -547,7 +557,8 @@ const styles = StyleSheet.create({
547
557
  androidFooterPlain: { paddingHorizontal: ANDROID_INSET },
548
558
  androidRow: { flexDirection: "row", alignItems: "center", minHeight: 50, paddingStart: ANDROID_INSET, paddingEnd: ANDROID_INSET },
549
559
  // A 24dp symbol at 20, a 28dp tile at 18 with a 24dp symbol, or a choice's 20dp mark at 22: the text at 64
550
- androidIcon: { width: 24, height: 24, alignItems: "center", justifyContent: "center", marginStart: -1, marginEnd: 20 },
560
+ androidIcon: { minWidth: 24, minHeight: 24, alignItems: "center", justifyContent: "center", marginStart: -1, marginEnd: 20 },
561
+ androidWide: { marginStart: 0, marginEnd: 16 },
551
562
  androidMark: { width: 20, alignItems: "center", justifyContent: "center", marginStart: 1, marginEnd: 22 },
552
563
  androidTile: { width: 28, height: 28, borderRadius: 10, alignItems: "center", justifyContent: "center", marginStart: -3, marginEnd: 18 },
553
564
  androidText: { flex: 1, minWidth: 0, gap: 4 },
@@ -153,9 +153,10 @@ export type TextFieldProps = InputProps & {
153
153
  labelAction?: ReactNode;
154
154
  /**
155
155
  * Shows the count of characters against `maxLength` (`3/15`): Material's counter at the end of the help's line on
156
- * Android, at the end of the label's line on iOS.
156
+ * Android, at the end of the label's line on iOS. A string is a count of its own in that place (chosen tags,
157
+ * `"3/10"`).
157
158
  */
158
- counter?: boolean;
159
+ counter?: boolean | string;
159
160
  };
160
161
  /**
161
162
  * A labelled text field: Plex UI's Field around an Input. iOS sets the label over the field (15/20 medium) and the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plexui/react-native",
3
- "version": "0.2.28",
3
+ "version": "0.2.29",
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",
@@ -74,10 +74,14 @@ export function BottomActions({ children, floating = false, background = "soft",
74
74
  style: [{ minHeight: height, borderRadius: height / 2 }, props.style],
75
75
  })
76
76
  // A disabled button's fill is see-through (the gray of iOS's disabled button): floating over the content it stands
77
- // on the screen's color, so the rows under it do not show through
78
- if (!floating || !props.disabled || android) return button
77
+ // on the screen's color, so the rows under it do not show through. The backing stays, clear, while the button is
78
+ // enabled: the button keeps its place in the tree, and with it focus, a screen reader's place and a press
79
+ if (!floating || android) return button
79
80
  return (
80
- <View key={child.key ?? index} style={{ borderRadius: height / 2, backgroundColor: canvas, alignSelf: (props.block ?? true) ? "stretch" : "flex-start" }}>
81
+ <View
82
+ key={child.key ?? index}
83
+ style={{ borderRadius: height / 2, backgroundColor: props.disabled ? canvas : "transparent", alignSelf: (props.block ?? true) ? "stretch" : "flex-start" }}
84
+ >
81
85
  {button}
82
86
  </View>
83
87
  )
@@ -286,7 +286,7 @@ export function BottomSheetBase({
286
286
  const barItem = useMemoBarItem(background)
287
287
  const header = android ? (
288
288
  title != null ? (
289
- <View onStartShouldSetResponderCapture={gesture.chrome} onLayout={(event) => setAndroidBarHeight(Math.max(ANDROID_BAR_HEIGHT, event.nativeEvent.layout.height))} style={styles.androidBar}>
289
+ <View onStartShouldSetResponderCapture={gesture.chrome} onLayout={(event) => setAndroidBarHeight(Math.max(ANDROID_BAR_HEIGHT, event.nativeEvent.layout.height))} style={[styles.androidBar, { paddingHorizontal: androidInline }]}>
290
290
  <SheetBarFade fill={background} shown={scrolled} />
291
291
  <View style={styles.androidCircle}>
292
292
  {dismissible ? (
@@ -901,9 +901,10 @@ export type TextFieldProps = InputProps & {
901
901
  labelAction?: ReactNode
902
902
  /**
903
903
  * Shows the count of characters against `maxLength` (`3/15`): Material's counter at the end of the help's line on
904
- * Android, at the end of the label's line on iOS.
904
+ * Android, at the end of the label's line on iOS. A string is a count of its own in that place (chosen tags,
905
+ * `"3/10"`).
905
906
  */
906
- counter?: boolean
907
+ counter?: boolean | string
907
908
  }
908
909
 
909
910
  /**
@@ -915,18 +916,19 @@ export function TextField({ label, description, errorMessage, required, invalid,
915
916
  const theme = useTheme()
916
917
  const [typed, setTyped] = useState((input.defaultValue ?? "").length)
917
918
  const count = input.value != null ? input.value.length : typed
919
+ const own = typeof counter === "string" ? counter : null
918
920
  const counterText =
919
- counter && input.maxLength != null ? (
921
+ own != null || (counter === true && input.maxLength != null) ? (
920
922
  <Text
921
923
  color="secondary"
922
- accessibilityLabel={`${count} of ${input.maxLength}`}
924
+ accessibilityLabel={own ?? `${count} of ${input.maxLength}`}
923
925
  style={[
924
926
  theme.isAndroid ? styles.androidCounter : styles.iosCounter,
925
927
  { opacity: input.disabled ? 0.5 : 1 },
926
928
  theme.isAndroid ? { color: theme.colors.textSecondary } : null,
927
929
  ]}
928
930
  >
929
- {count}/{input.maxLength}
931
+ {own ?? `${count}/${input.maxLength}`}
930
932
  </Text>
931
933
  ) : null
932
934
  const end =
@@ -1067,8 +1067,11 @@ function AndroidContent({
1067
1067
  // Android's row symbols are the text's ink over a light card and a gray over a dark one
1068
1068
  const symbol = dim(destructive ? danger : theme.scheme === "dark" ? theme.colors.labelSecondary : theme.colors.text)
1069
1069
  const tile = leading != null && !!leadingColor
1070
+ // A picture wider than the symbol's 24 (a photo, an avatar) keeps its own size from the rows' inset (21, where the
1071
+ // header and the footer stand), the text 16 past it, as Material's list item with a leading avatar; 0 for a symbol
1072
+ const [wide, setWide] = useState(0)
1070
1073
  // The text (and the divider) 21 in, or 64 after a symbol, a tile or a choice's mark (its 20dp circle 22 in)
1071
- const textStart = leading == null ? ANDROID_INSET : 64
1074
+ const textStart = leading == null ? ANDROID_INSET : wide > 0 && !tile && !leadingMark ? ANDROID_INSET + wide + 16 : 64
1072
1075
  // A value that ends the row stands 17 from the end (a value row), 20 in a row with a tile (a tiled row)
1073
1076
  const valueEnd = trailing == null && !tile ? 17 : 20
1074
1077
  // At the end the value takes half the row at most, 16 from the label and from a control
@@ -1086,7 +1089,18 @@ function AndroidContent({
1086
1089
  {leading == null ? null : leadingMark ? (
1087
1090
  <View style={styles.androidMark}>{leading}</View>
1088
1091
  ) : (
1089
- <View style={tile ? [styles.androidTile, { backgroundColor: leadingColor, opacity: disabled ? 0.5 : 1 }] : styles.androidIcon}>
1092
+ <View
1093
+ style={tile ? [styles.androidTile, { backgroundColor: leadingColor, opacity: disabled ? 0.5 : 1 }] : [styles.androidIcon, wide > 0 ? styles.androidWide : null]}
1094
+ onLayout={
1095
+ tile
1096
+ ? undefined
1097
+ : (event) => {
1098
+ const width = event.nativeEvent.layout.width
1099
+ const next = width > 24.5 ? width : 0
1100
+ if (Math.abs(next - wide) > 0.5) setWide(next)
1101
+ }
1102
+ }
1103
+ >
1090
1104
  <IconDefaultsProvider size={24} color={tile ? "#ffffff" : symbol}>
1091
1105
  {leading}
1092
1106
  </IconDefaultsProvider>
@@ -1184,7 +1198,8 @@ const styles = StyleSheet.create({
1184
1198
  androidFooterPlain: { paddingHorizontal: ANDROID_INSET },
1185
1199
  androidRow: { flexDirection: "row", alignItems: "center", minHeight: 50, paddingStart: ANDROID_INSET, paddingEnd: ANDROID_INSET },
1186
1200
  // A 24dp symbol at 20, a 28dp tile at 18 with a 24dp symbol, or a choice's 20dp mark at 22: the text at 64
1187
- androidIcon: { width: 24, height: 24, alignItems: "center", justifyContent: "center", marginStart: -1, marginEnd: 20 },
1201
+ androidIcon: { minWidth: 24, minHeight: 24, alignItems: "center", justifyContent: "center", marginStart: -1, marginEnd: 20 },
1202
+ androidWide: { marginStart: 0, marginEnd: 16 },
1188
1203
  androidMark: { width: 20, alignItems: "center", justifyContent: "center", marginStart: 1, marginEnd: 22 },
1189
1204
  androidTile: { width: 28, height: 28, borderRadius: 10, alignItems: "center", justifyContent: "center", marginStart: -3, marginEnd: 18 },
1190
1205
  androidText: { flex: 1, minWidth: 0, gap: 4 },