@plexui/react-native 0.2.18 → 0.2.19

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.
@@ -12,7 +12,7 @@ import { Glass } from "../../internal/Glass";
12
12
  import { curves } from "../../internal/motion";
13
13
  import { useTabKeys } from "../../internal/tabKeys";
14
14
  import { barSurface, mix, stateLayer, withAlpha } from "../../theme/material";
15
- import { useTheme } from "../../theme/ThemeProvider";
15
+ import { useTheme, useThemeOverrides } from "../../theme/ThemeProvider";
16
16
  import { IconDefaultsProvider } from "../Icon/createIcon";
17
17
  import { Text, textStyle } from "../Text/Text";
18
18
  const TabBarContext = createContext(null);
@@ -382,6 +382,12 @@ function TabBarRoot({ value: valueProp, defaultValue, onValueChange, search, pro
382
382
  slidingPill: pillFrame ? value : undefined,
383
383
  };
384
384
  const pillOutset = theme.length("--tab-bar-pill-outset", 6);
385
+ // The web's selected pill in the dark is a shade of the glass, deeper at its top and lifting toward its bottom, as
386
+ // iOS 26 draws it; a brand that sets the pill's token keeps its color
387
+ const overrides = useThemeOverrides();
388
+ const webPill = theme.scheme === "dark" && overrides?.["--tab-bar-item-background-selected"] == null
389
+ ? { backgroundColor: "transparent", backgroundImage: "linear-gradient(to bottom, rgb(0 0 0 / 22%), rgb(255 255 255 / 8%))" }
390
+ : { backgroundColor: theme.color("--tab-bar-item-background-selected") };
385
391
  const [pillX] = useState(() => new Animated.Value(0));
386
392
  const [pillWidth] = useState(() => new Animated.Value(0));
387
393
  const pillShown = useRef(false);
@@ -444,7 +450,7 @@ function TabBarRoot({ value: valueProp, defaultValue, onValueChange, search, pro
444
450
  ], children: [backdrop, accessory ? (_jsx(Glass, { radius: accessoryHeight / 2, elevation: "raised", style: [styles.accessory, accessoryPlace], children: accessory }, "accessory")) : null, _jsxs(View, { style: [styles.iosRow, { gap: theme.length("--tab-bar-gap", 8), justifyContent: circle || minimized ? "space-between" : "center" }], children: [_jsxs(Glass, { radius: 999, elevation: "raised", style: [styles.capsule, minimized ? { padding: capsulePadding } : { paddingVertical: capsulePadding, paddingHorizontal: theme.length("--tab-bar-capsule-padding-inline", 10) }], children: [pillFrame && Platform.OS === "web" ? (
445
451
  // The web slides the pill in CSS, off the JavaScript thread, so a screen mounting under the new tab
446
452
  // does not stop it
447
- _jsx(CssSlide, { x: pillLeft, width: pillSpan, side: "start", duration: 300, easing: "cubic-bezier(0.25, 0.1, 0.25, 1)", still: theme.reducedMotion, style: [styles.pill, { top: pillFrame.y, height: pillFrame.height, backgroundColor: theme.color("--tab-bar-item-background-selected") }] })) : pillFrame ? (_jsx(Animated.View, { pointerEvents: "none", style: [
453
+ _jsx(CssSlide, { x: pillLeft, width: pillSpan, side: "start", duration: 300, easing: "cubic-bezier(0.25, 0.1, 0.25, 1)", still: theme.reducedMotion, style: [styles.pill, { top: pillFrame.y, height: pillFrame.height }, webPill] })) : pillFrame ? (_jsx(Animated.View, { pointerEvents: "none", style: [
448
454
  styles.pill,
449
455
  { top: pillFrame.y, height: pillFrame.height, start: pillX, width: pillWidth, backgroundColor: theme.color("--tab-bar-item-background-selected") },
450
456
  ] })) : null, visible.map((tab) => (_jsx(Tab, { ...tab, context: context }, tab.value)))] }), circle ? (_jsx(Glass, { radius: circleSize / 2, elevation: "raised", style: { width: circleSize, height: circleSize }, children: _jsx(Tab, { ...circle, context: { ...context, minimized: false }, kind: "circle", hideLabel: true }) })) : null] })] }) }));
@@ -12,18 +12,18 @@ import { useReduceTransparency } from "./reduceTransparency";
12
12
  const WEB_DENSE = {
13
13
  "--mobile-glass-background": {
14
14
  fill: "--mobile-glass-web-background",
15
- light: "rgba(243, 243, 243, 0.8)",
16
- dark: "rgba(28, 28, 30, 0.7)",
15
+ light: "rgba(250, 250, 252, 0.62)",
16
+ dark: "rgba(52, 52, 56, 0.74)",
17
17
  filter: "--mobile-glass-web-backdrop-filter",
18
- blur: "blur(20px)",
18
+ blur: "blur(8px) saturate(180%)",
19
19
  },
20
20
  // Pressed, a step deeper, as the shared tokens step from 55% to 75%
21
21
  "--mobile-glass-background-active": {
22
22
  fill: "--mobile-glass-web-background-active",
23
- light: "rgba(232, 232, 232, 0.9)",
24
- dark: "rgba(58, 58, 60, 0.8)",
23
+ light: "rgba(238, 238, 242, 0.8)",
24
+ dark: "rgba(72, 72, 76, 0.84)",
25
25
  filter: "--mobile-glass-web-backdrop-filter",
26
- blur: "blur(20px)",
26
+ blur: "blur(8px) saturate(180%)",
27
27
  },
28
28
  "--menu-mobile-background": {
29
29
  fill: "--menu-mobile-web-background",
@@ -33,6 +33,29 @@ const WEB_DENSE = {
33
33
  blur: "blur(30px)",
34
34
  },
35
35
  };
36
+ /**
37
+ * The web's plain glass drawn as iOS 26's Liquid Glass reads (measured on its tab bars and bar buttons): a lighter fill
38
+ * than a tint of white in the dark, a sheen down the glass (a shade under its top edge in the light, a lift toward its
39
+ * bottom in the dark), a bright rim on every side, and a lens at the edge, where what is under the glass is blurred and
40
+ * lit more, as Liquid Glass bends it there (a browser cannot bend it). Each part a token a theme may set.
41
+ */
42
+ const WEB_LIQUID = {
43
+ sheen: { token: "--mobile-glass-web-sheen", light: "linear-gradient(to bottom, rgb(0 0 0 / 3.5%), rgb(0 0 0 / 0) 35%)", dark: "linear-gradient(to bottom, rgb(255 255 255 / 0), rgb(255 255 255 / 5%))" },
44
+ shadow: {
45
+ token: "--mobile-glass-web-shadow",
46
+ light: "0 8px 24px rgb(0 0 0 / 6%), 0 0 0 0.5px rgb(0 0 0 / 12%), inset 0 1px 0 rgb(255 255 255), inset 0 -1px 0 rgb(255 255 255 / 90%), inset 1px 0 0 rgb(255 255 255 / 70%), inset -1px 0 0 rgb(255 255 255 / 70%)",
47
+ dark: "0 8px 24px rgb(0 0 0 / 25%), inset 0 1px 0 rgb(255 255 255 / 36%), inset 0 -1px 0 rgb(255 255 255 / 20%), inset 1px 0 0 rgb(255 255 255 / 12%), inset -1px 0 0 rgb(255 255 255 / 12%)",
48
+ },
49
+ shadowRaised: {
50
+ token: "--mobile-glass-web-shadow-raised",
51
+ light: "0 8px 40px rgb(0 0 0 / 12%), 0 0 0 0.5px rgb(0 0 0 / 12%), inset 0 1px 0 rgb(255 255 255), inset 0 -1px 0 rgb(255 255 255 / 90%), inset 1px 0 0 rgb(255 255 255 / 70%), inset -1px 0 0 rgb(255 255 255 / 70%)",
52
+ dark: "0 8px 40px rgb(0 0 0 / 30%), inset 0 1px 0 rgb(255 255 255 / 36%), inset 0 -1px 0 rgb(255 255 255 / 20%), inset 1px 0 0 rgb(255 255 255 / 12%), inset -1px 0 0 rgb(255 255 255 / 12%)",
53
+ },
54
+ lens: { token: "--mobile-glass-web-lens-filter", value: "blur(3px) brightness(1.12) saturate(200%)" },
55
+ };
56
+ // The lens: the glass's edge only, 14 in from its sides and 9 from its top and bottom (a small glass keeps a third)
57
+ const lensMask = (inline, block) => `linear-gradient(to right, #000 0, transparent ${inline}px, transparent calc(100% - ${inline}px), #000 100%), ` +
58
+ `linear-gradient(to bottom, #000 0, transparent ${block}px, transparent calc(100% - ${block}px), #000 100%)`;
36
59
  /** The filter and the shadow of the glass surfaces of the phone layer, by their fill (mobile-materials.css, touch.css). */
37
60
  const SURFACES = {
38
61
  "--menu-mobile-background": { filter: "--menu-mobile-backdrop-filter", shadow: "--menu-shadow" },
@@ -81,8 +104,31 @@ export function Glass({ radius = 0, elevation = "regular", tint, interactive, fi
81
104
  const module = web || Platform.OS !== "ios" ? null : blurModule();
82
105
  const opaque = reduceTransparency || (!web && module == null);
83
106
  if (web && !opaque) {
107
+ // The plain glass (bars, bar buttons, the tab bar, the large segmented control) reads as Liquid Glass; menus,
108
+ // toasts and alerts keep their frosted panels
109
+ const liquid = !theme.isAndroid && (fillName === "--mobile-glass-background" || fillName === "--mobile-glass-background-active" || plainFilter);
110
+ const scheme = theme.scheme === "dark" ? "dark" : "light";
111
+ const own = (part) => {
112
+ const value = theme.token(part.token);
113
+ return typeof value === "string" ? value : part[scheme];
114
+ };
115
+ const ownShadow = shadowToken == null && surface == null && overrides?.["--mobile-glass-shadow"] == null && overrides?.["--mobile-glass-shadow-raised"] == null;
116
+ const liquidShadow = liquid && ownShadow ? own(elevation === "raised" ? WEB_LIQUID.shadowRaised : WEB_LIQUID.shadow) : boxShadow;
117
+ const sheen = liquid && tint == null ? own(WEB_LIQUID.sheen) : undefined;
118
+ const lensToken = theme.token(WEB_LIQUID.lens.token);
119
+ const lensFilter = typeof lensToken === "string" ? lensToken : WEB_LIQUID.lens.value;
120
+ const mask = lensMask(Math.min(14, radius > 0 ? radius / 2 : 14), Math.min(9, radius > 0 ? radius / 3 : 9));
84
121
  // An Animated.View, so a panel can move its own glass (a transform above the blur would stop it)
85
- return (_jsx(Animated.View, { ...rest, style: [shape, { backgroundColor: fill, boxShadow }, { backdropFilter: filter, WebkitBackdropFilter: filter }, style], children: children }));
122
+ return (_jsxs(Animated.View, { ...rest, style: [
123
+ shape,
124
+ { backgroundColor: fill, boxShadow: liquidShadow },
125
+ { backdropFilter: filter, WebkitBackdropFilter: filter, backgroundImage: sheen },
126
+ style,
127
+ ], children: [liquid && lensFilter !== "none" ? (_jsx(View, { pointerEvents: "none", "aria-hidden": true, style: [
128
+ StyleSheet.absoluteFill,
129
+ shape,
130
+ { backdropFilter: lensFilter, WebkitBackdropFilter: lensFilter, maskImage: mask, WebkitMaskImage: mask },
131
+ ] })) : null, children] }));
86
132
  }
87
133
  const radiusPx = Number(/blur\(\s*([\d.]+)px\s*\)/.exec(filter)?.[1] ?? 12);
88
134
  return (_jsxs(View, { ...rest, style: [shape, { boxShadow }, style], children: [_jsxs(View, { style: [StyleSheet.absoluteFill, shape, { overflow: "hidden" }], pointerEvents: "none", children: [opaque ? (_jsx(View, { style: [StyleSheet.absoluteFill, { backgroundColor: theme.color("--mobile-surface-elevated-plain-primary", theme.colors.surfaceElevated) }] })) : module ? (_jsx(module.BlurView, { intensity: intensityOf(radiusPx), tint: theme.scheme === "dark" ? "systemChromeMaterialDark" : "systemChromeMaterialLight", style: StyleSheet.absoluteFill })) : null, _jsx(View, { style: [StyleSheet.absoluteFill, { backgroundColor: fill }] })] }), children] }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plexui/react-native",
3
- "version": "0.2.18",
3
+ "version": "0.2.19",
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",
@@ -11,7 +11,7 @@ import { Glass } from "../../internal/Glass"
11
11
  import { curves } from "../../internal/motion"
12
12
  import { useTabKeys } from "../../internal/tabKeys"
13
13
  import { barSurface, mix, stateLayer, withAlpha } from "../../theme/material"
14
- import { useTheme } from "../../theme/ThemeProvider"
14
+ import { useTheme, useThemeOverrides } from "../../theme/ThemeProvider"
15
15
  import type { Theme } from "../../theme/types"
16
16
  import { IconDefaultsProvider } from "../Icon/createIcon"
17
17
  import { Text, textStyle } from "../Text/Text"
@@ -732,6 +732,13 @@ function TabBarRoot({
732
732
  slidingPill: pillFrame ? value : undefined,
733
733
  }
734
734
  const pillOutset = theme.length("--tab-bar-pill-outset", 6)
735
+ // The web's selected pill in the dark is a shade of the glass, deeper at its top and lifting toward its bottom, as
736
+ // iOS 26 draws it; a brand that sets the pill's token keeps its color
737
+ const overrides = useThemeOverrides()
738
+ const webPill: ViewStyle =
739
+ theme.scheme === "dark" && overrides?.["--tab-bar-item-background-selected"] == null
740
+ ? ({ backgroundColor: "transparent", backgroundImage: "linear-gradient(to bottom, rgb(0 0 0 / 22%), rgb(255 255 255 / 8%))" } as ViewStyle)
741
+ : { backgroundColor: theme.color("--tab-bar-item-background-selected") }
735
742
  const [pillX] = useState(() => new Animated.Value(0))
736
743
  const [pillWidth] = useState(() => new Animated.Value(0))
737
744
  const pillShown = useRef(false)
@@ -845,7 +852,7 @@ function TabBarRoot({
845
852
  duration={300}
846
853
  easing="cubic-bezier(0.25, 0.1, 0.25, 1)"
847
854
  still={theme.reducedMotion}
848
- style={[styles.pill, { top: pillFrame.y, height: pillFrame.height, backgroundColor: theme.color("--tab-bar-item-background-selected") }]}
855
+ style={[styles.pill, { top: pillFrame.y, height: pillFrame.height }, webPill]}
849
856
  />
850
857
  ) : pillFrame ? (
851
858
  <Animated.View
@@ -38,18 +38,18 @@ export type GlassProps = ViewProps & {
38
38
  const WEB_DENSE: Record<string, { fill: string; light: string; dark: string; filter: string; blur: string }> = {
39
39
  "--mobile-glass-background": {
40
40
  fill: "--mobile-glass-web-background",
41
- light: "rgba(243, 243, 243, 0.8)",
42
- dark: "rgba(28, 28, 30, 0.7)",
41
+ light: "rgba(250, 250, 252, 0.62)",
42
+ dark: "rgba(52, 52, 56, 0.74)",
43
43
  filter: "--mobile-glass-web-backdrop-filter",
44
- blur: "blur(20px)",
44
+ blur: "blur(8px) saturate(180%)",
45
45
  },
46
46
  // Pressed, a step deeper, as the shared tokens step from 55% to 75%
47
47
  "--mobile-glass-background-active": {
48
48
  fill: "--mobile-glass-web-background-active",
49
- light: "rgba(232, 232, 232, 0.9)",
50
- dark: "rgba(58, 58, 60, 0.8)",
49
+ light: "rgba(238, 238, 242, 0.8)",
50
+ dark: "rgba(72, 72, 76, 0.84)",
51
51
  filter: "--mobile-glass-web-backdrop-filter",
52
- blur: "blur(20px)",
52
+ blur: "blur(8px) saturate(180%)",
53
53
  },
54
54
  "--menu-mobile-background": {
55
55
  fill: "--menu-mobile-web-background",
@@ -60,6 +60,34 @@ const WEB_DENSE: Record<string, { fill: string; light: string; dark: string; fil
60
60
  },
61
61
  }
62
62
 
63
+ /**
64
+ * The web's plain glass drawn as iOS 26's Liquid Glass reads (measured on its tab bars and bar buttons): a lighter fill
65
+ * than a tint of white in the dark, a sheen down the glass (a shade under its top edge in the light, a lift toward its
66
+ * bottom in the dark), a bright rim on every side, and a lens at the edge, where what is under the glass is blurred and
67
+ * lit more, as Liquid Glass bends it there (a browser cannot bend it). Each part a token a theme may set.
68
+ */
69
+ const WEB_LIQUID = {
70
+ sheen: { token: "--mobile-glass-web-sheen", light: "linear-gradient(to bottom, rgb(0 0 0 / 3.5%), rgb(0 0 0 / 0) 35%)", dark: "linear-gradient(to bottom, rgb(255 255 255 / 0), rgb(255 255 255 / 5%))" },
71
+ shadow: {
72
+ token: "--mobile-glass-web-shadow",
73
+ light:
74
+ "0 8px 24px rgb(0 0 0 / 6%), 0 0 0 0.5px rgb(0 0 0 / 12%), inset 0 1px 0 rgb(255 255 255), inset 0 -1px 0 rgb(255 255 255 / 90%), inset 1px 0 0 rgb(255 255 255 / 70%), inset -1px 0 0 rgb(255 255 255 / 70%)",
75
+ dark: "0 8px 24px rgb(0 0 0 / 25%), inset 0 1px 0 rgb(255 255 255 / 36%), inset 0 -1px 0 rgb(255 255 255 / 20%), inset 1px 0 0 rgb(255 255 255 / 12%), inset -1px 0 0 rgb(255 255 255 / 12%)",
76
+ },
77
+ shadowRaised: {
78
+ token: "--mobile-glass-web-shadow-raised",
79
+ light:
80
+ "0 8px 40px rgb(0 0 0 / 12%), 0 0 0 0.5px rgb(0 0 0 / 12%), inset 0 1px 0 rgb(255 255 255), inset 0 -1px 0 rgb(255 255 255 / 90%), inset 1px 0 0 rgb(255 255 255 / 70%), inset -1px 0 0 rgb(255 255 255 / 70%)",
81
+ dark: "0 8px 40px rgb(0 0 0 / 30%), inset 0 1px 0 rgb(255 255 255 / 36%), inset 0 -1px 0 rgb(255 255 255 / 20%), inset 1px 0 0 rgb(255 255 255 / 12%), inset -1px 0 0 rgb(255 255 255 / 12%)",
82
+ },
83
+ lens: { token: "--mobile-glass-web-lens-filter", value: "blur(3px) brightness(1.12) saturate(200%)" },
84
+ }
85
+
86
+ // The lens: the glass's edge only, 14 in from its sides and 9 from its top and bottom (a small glass keeps a third)
87
+ const lensMask = (inline: number, block: number) =>
88
+ `linear-gradient(to right, #000 0, transparent ${inline}px, transparent calc(100% - ${inline}px), #000 100%), ` +
89
+ `linear-gradient(to bottom, #000 0, transparent ${block}px, transparent calc(100% - ${block}px), #000 100%)`
90
+
63
91
  /** The filter and the shadow of the glass surfaces of the phone layer, by their fill (mobile-materials.css, touch.css). */
64
92
  const SURFACES: Record<string, { filter: string; shadow: string }> = {
65
93
  "--menu-mobile-background": { filter: "--menu-mobile-backdrop-filter", shadow: "--menu-shadow" },
@@ -133,12 +161,42 @@ export function Glass({
133
161
  const module = web || Platform.OS !== "ios" ? null : blurModule()
134
162
  const opaque = reduceTransparency || (!web && module == null)
135
163
  if (web && !opaque) {
164
+ // The plain glass (bars, bar buttons, the tab bar, the large segmented control) reads as Liquid Glass; menus,
165
+ // toasts and alerts keep their frosted panels
166
+ const liquid = !theme.isAndroid && (fillName === "--mobile-glass-background" || fillName === "--mobile-glass-background-active" || plainFilter)
167
+ const scheme = theme.scheme === "dark" ? "dark" : "light"
168
+ const own = (part: { token: string; light: string; dark: string }) => {
169
+ const value = theme.token(part.token)
170
+ return typeof value === "string" ? value : part[scheme]
171
+ }
172
+ const ownShadow = shadowToken == null && surface == null && overrides?.["--mobile-glass-shadow"] == null && overrides?.["--mobile-glass-shadow-raised"] == null
173
+ const liquidShadow = liquid && ownShadow ? own(elevation === "raised" ? WEB_LIQUID.shadowRaised : WEB_LIQUID.shadow) : boxShadow
174
+ const sheen = liquid && tint == null ? own(WEB_LIQUID.sheen) : undefined
175
+ const lensToken = theme.token(WEB_LIQUID.lens.token)
176
+ const lensFilter = typeof lensToken === "string" ? lensToken : WEB_LIQUID.lens.value
177
+ const mask = lensMask(Math.min(14, radius > 0 ? radius / 2 : 14), Math.min(9, radius > 0 ? radius / 3 : 9))
136
178
  // An Animated.View, so a panel can move its own glass (a transform above the blur would stop it)
137
179
  return (
138
180
  <Animated.View
139
181
  {...rest}
140
- style={[shape, { backgroundColor: fill, boxShadow }, { backdropFilter: filter, WebkitBackdropFilter: filter } as ViewStyle, style]}
182
+ style={[
183
+ shape,
184
+ { backgroundColor: fill, boxShadow: liquidShadow },
185
+ { backdropFilter: filter, WebkitBackdropFilter: filter, backgroundImage: sheen } as ViewStyle,
186
+ style,
187
+ ]}
141
188
  >
189
+ {liquid && lensFilter !== "none" ? (
190
+ <View
191
+ pointerEvents="none"
192
+ aria-hidden
193
+ style={[
194
+ StyleSheet.absoluteFill,
195
+ shape,
196
+ { backdropFilter: lensFilter, WebkitBackdropFilter: lensFilter, maskImage: mask, WebkitMaskImage: mask } as ViewStyle,
197
+ ]}
198
+ />
199
+ ) : null}
142
200
  {children}
143
201
  </Animated.View>
144
202
  )