glacia-native 0.5.1 → 0.5.2

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.
Files changed (75) hide show
  1. package/LICENSE +29 -4
  2. package/README.md +27 -0
  3. package/lib/module/Bars.js +10 -9
  4. package/lib/module/Button.js +11 -8
  5. package/lib/module/Card.js +2 -2
  6. package/lib/module/Dialog.js +16 -17
  7. package/lib/module/Display.js +8 -7
  8. package/lib/module/Feedback.js +24 -15
  9. package/lib/module/Form.js +29 -33
  10. package/lib/module/Forms2.js +38 -21
  11. package/lib/module/Glass.js +2 -2
  12. package/lib/module/Input.js +12 -10
  13. package/lib/module/Message.js +11 -15
  14. package/lib/module/Overlays.js +22 -6
  15. package/lib/module/Pickers.js +16 -16
  16. package/lib/module/SegmentedControl.js +19 -10
  17. package/lib/module/Slider.js +18 -9
  18. package/lib/module/Switch.js +21 -9
  19. package/lib/module/TabBar.js +18 -12
  20. package/lib/module/Table.js +4 -3
  21. package/lib/module/Tabs.js +3 -2
  22. package/lib/module/ai.js +18 -15
  23. package/lib/module/charts/BarChart.js +11 -3
  24. package/lib/module/internal/GlassView.js +2 -2
  25. package/lib/module/internal/blur.js +78 -0
  26. package/lib/module/internal/fallback.js +110 -20
  27. package/lib/module/internal/glow.js +36 -0
  28. package/lib/module/internal/lens.js +70 -0
  29. package/lib/module/internal/material.js +64 -0
  30. package/lib/module/internal/primitives.js +1 -0
  31. package/lib/module/internal/rim.js +35 -0
  32. package/lib/module/internal/tokens.js +34 -2
  33. package/lib/typescript/Message.d.ts +5 -9
  34. package/lib/typescript/index.d.ts +1 -0
  35. package/lib/typescript/internal/GlassView.d.ts +13 -0
  36. package/lib/typescript/internal/blur.d.ts +24 -0
  37. package/lib/typescript/internal/fallback.d.ts +27 -2
  38. package/lib/typescript/internal/glow.d.ts +11 -0
  39. package/lib/typescript/internal/lens.d.ts +47 -0
  40. package/lib/typescript/internal/material.d.ts +27 -0
  41. package/lib/typescript/internal/primitives.d.ts +2 -0
  42. package/lib/typescript/internal/rim.d.ts +16 -0
  43. package/lib/typescript/internal/tokens.d.ts +36 -0
  44. package/package.json +12 -3
  45. package/src/Bars.tsx +12 -2
  46. package/src/Button.tsx +16 -9
  47. package/src/Card.tsx +2 -2
  48. package/src/Dialog.tsx +37 -26
  49. package/src/Display.tsx +8 -5
  50. package/src/Feedback.tsx +36 -13
  51. package/src/Form.tsx +60 -40
  52. package/src/Forms2.tsx +65 -24
  53. package/src/Glass.tsx +4 -0
  54. package/src/Input.tsx +15 -11
  55. package/src/Message.tsx +15 -16
  56. package/src/Overlays.tsx +25 -6
  57. package/src/Pickers.tsx +11 -6
  58. package/src/SegmentedControl.tsx +33 -9
  59. package/src/Slider.tsx +19 -10
  60. package/src/Switch.tsx +24 -10
  61. package/src/TabBar.tsx +33 -12
  62. package/src/Table.tsx +4 -3
  63. package/src/Tabs.tsx +5 -0
  64. package/src/ai.tsx +28 -20
  65. package/src/charts/BarChart.tsx +41 -3
  66. package/src/index.ts +1 -0
  67. package/src/internal/GlassView.tsx +17 -0
  68. package/src/internal/blur.ts +90 -0
  69. package/src/internal/fallback.tsx +158 -20
  70. package/src/internal/glow.tsx +62 -0
  71. package/src/internal/lens.tsx +105 -0
  72. package/src/internal/material.ts +92 -0
  73. package/src/internal/primitives.ts +3 -0
  74. package/src/internal/rim.tsx +79 -0
  75. package/src/internal/tokens.ts +34 -1
package/src/Pickers.tsx CHANGED
@@ -7,6 +7,7 @@ import { Sheet } from "./Overlays";
7
7
  import { colors, radii } from "./internal/tokens";
8
8
  import { primitives } from "./internal/primitives";
9
9
  import { useIsDark } from "./internal/motion";
10
+ import { SelectedLens, lensFill } from "./internal/lens";
10
11
 
11
12
  // ---------------------------------------------------------------------------
12
13
  // Date helpers
@@ -211,12 +212,16 @@ export const Calendar = forwardRef<any, CalendarProps>(function Calendar(
211
212
  borderRadius: cellSize / 2,
212
213
  alignItems: "center",
213
214
  justifyContent: "center",
214
- backgroundColor: selected ? theme.glassActive : "transparent",
215
- borderWidth: isToday && !selected ? 0.5 : selected ? 1 : 0,
215
+ backgroundColor: "transparent",
216
+ // Today is ringed; the selection is a lens on top of it.
217
+ borderWidth: isToday && !selected ? 0.5 : 0,
216
218
  borderColor: isToday && !selected ? theme.fill : theme.edge,
217
219
  opacity: disabled ? 0.28 : cell.outside ? 0.45 : 1,
218
220
  }}
219
221
  >
222
+ {selected ? (
223
+ <SelectedLens radius={cellSize / 2} isDark={isDark} style={lensFill} />
224
+ ) : null}
220
225
  <RNText
221
226
  style={{
222
227
  fontSize: 14,
@@ -514,11 +519,10 @@ export const TimePicker = forwardRef<any, TimePickerProps>(function TimePicker(
514
519
  borderRadius: radii.sm,
515
520
  alignItems: "center",
516
521
  justifyContent: "center",
517
- backgroundColor: active ? theme.glassActive : "transparent",
518
- borderWidth: 0.5,
519
- borderColor: active ? theme.edge : "transparent",
522
+ backgroundColor: "transparent",
520
523
  }}
521
524
  >
525
+ {active ? <SelectedLens radius={radii.sm} isDark={isDark} style={lensFill} /> : null}
522
526
  <RNText style={{ fontSize: 14, fontWeight: active ? "600" : "500", color: active ? theme.foreground : theme.muted }}>
523
527
  {label}
524
528
  </RNText>
@@ -565,9 +569,10 @@ function ScrollColumn({
565
569
  alignItems: "center",
566
570
  justifyContent: "center",
567
571
  borderRadius: radii.sm,
568
- backgroundColor: active ? theme.glassActive : "transparent",
572
+ backgroundColor: "transparent",
569
573
  }}
570
574
  >
575
+ {active ? <SelectedLens radius={radii.sm} isDark={isDark} style={lensFill} /> : null}
571
576
  <RNText style={{ fontSize: 17, fontWeight: active ? "600" : "400", color: active ? theme.foreground : theme.muted }}>
572
577
  {String(item).padStart(pad, "0")}
573
578
  </RNText>
@@ -6,6 +6,7 @@ import { colors, radii } from "./internal/tokens";
6
6
  import { primitives } from "./internal/primitives";
7
7
  import { useIsDark, useSpring } from "./internal/motion";
8
8
  import { hapticSelection } from "./internal/haptics";
9
+ import { LensRim, lensShadow } from "./internal/lens";
9
10
 
10
11
  export interface SegmentedControlProps {
11
12
  values: string[];
@@ -20,7 +21,9 @@ export interface SegmentedControlProps {
20
21
  testID?: string;
21
22
  }
22
23
 
23
- const SEGMENT_HEIGHT = 30;
24
+ // The web segment is 32 high inside a 2pt inset, on a pill container, with the
25
+ // selected pill itself a pill: 500/400 weights, not a bold selected label.
26
+ const SEGMENT_HEIGHT = 32;
24
27
 
25
28
  /**
26
29
  * A row of mutually exclusive segments on one glass container.
@@ -48,6 +51,7 @@ export const SegmentedControl = forwardRef<any, SegmentedControlProps>(function
48
51
  const { View, Text, Pressable, Animated } = primitives();
49
52
 
50
53
  const [internalIndex, setInternalIndex] = useState(defaultIndex);
54
+ const [held, setHeld] = useState(false);
51
55
  const activeIndex = selectedProp !== undefined ? selectedProp : internalIndex;
52
56
  const safeIndex = Math.min(Math.max(activeIndex, 0), Math.max(values.length - 1, 0));
53
57
 
@@ -72,8 +76,10 @@ export const SegmentedControl = forwardRef<any, SegmentedControlProps>(function
72
76
  alignItems: "center",
73
77
  alignSelf: "flex-start",
74
78
  padding: 2,
75
- borderRadius: radii.md,
76
- backgroundColor: "rgba(118, 118, 128, 0.12)",
79
+ borderRadius: radii.pill,
80
+ // The web lays the segment track tint over glass; the fallback paints the
81
+ // same tint as the flat track the web sees through the glass.
82
+ backgroundColor: themeColors.fieldWash,
77
83
  ...(style as ViewStyle),
78
84
  };
79
85
 
@@ -86,7 +92,16 @@ export const SegmentedControl = forwardRef<any, SegmentedControlProps>(function
86
92
  : `${(safeIndex * 100) / count}%`;
87
93
 
88
94
  return (
89
- <Glass ref={ref} effect="regular" isDark={isDark} style={containerStyle} testID={testID} {...props}>
95
+ <Glass
96
+ ref={ref}
97
+ effect="regular"
98
+ surface="rail"
99
+ pressed={held}
100
+ isDark={isDark}
101
+ style={containerStyle}
102
+ testID={testID}
103
+ {...props}
104
+ >
90
105
  {/* The sliding pill: one View behind the labels, coloured by the theme. */}
91
106
  {animated ? (
92
107
  <Animated.View
@@ -96,14 +111,18 @@ export const SegmentedControl = forwardRef<any, SegmentedControlProps>(function
96
111
  left: 2,
97
112
  width: pillWidth,
98
113
  height: SEGMENT_HEIGHT,
99
- borderRadius: radii.sm,
114
+ borderRadius: radii.pill,
100
115
  backgroundColor: themeColors.glassActive,
101
116
  borderWidth: 0.5,
102
117
  borderColor: themeColors.edge,
118
+ // The thumb is a lens: lifted off the rail, with its own rim.
119
+ ...lensShadow(isDark),
103
120
  transform: [{ translateX: pillTranslate }],
104
121
  }}
105
122
  pointerEvents="none"
106
- />
123
+ >
124
+ <LensRim radius={radii.pill} isDark={isDark} />
125
+ </Animated.View>
107
126
  ) : (
108
127
  <View
109
128
  style={{
@@ -112,13 +131,16 @@ export const SegmentedControl = forwardRef<any, SegmentedControlProps>(function
112
131
  left: `${2 + (safeIndex * 100) / count}%`,
113
132
  width: pillWidth,
114
133
  height: SEGMENT_HEIGHT,
115
- borderRadius: radii.sm,
134
+ borderRadius: radii.pill,
116
135
  backgroundColor: themeColors.glassActive,
117
136
  borderWidth: 0.5,
118
137
  borderColor: themeColors.edge,
138
+ ...lensShadow(isDark),
119
139
  }}
120
140
  pointerEvents="none"
121
- />
141
+ >
142
+ <LensRim radius={radii.pill} isDark={isDark} />
143
+ </View>
122
144
  )}
123
145
 
124
146
  {values.map((label, idx) => {
@@ -130,6 +152,8 @@ export const SegmentedControl = forwardRef<any, SegmentedControlProps>(function
130
152
  accessibilityLabel={label}
131
153
  accessibilityState={{ selected: isSelected }}
132
154
  onPress={() => handleSelect(idx)}
155
+ onPressIn={() => setHeld(true)}
156
+ onPressOut={() => setHeld(false)}
133
157
  style={{
134
158
  flex: 1,
135
159
  height: SEGMENT_HEIGHT,
@@ -143,7 +167,7 @@ export const SegmentedControl = forwardRef<any, SegmentedControlProps>(function
143
167
  numberOfLines={1}
144
168
  style={{
145
169
  fontSize: 13,
146
- fontWeight: isSelected ? "600" : "500",
170
+ fontWeight: isSelected ? "500" : "400",
147
171
  color: isSelected ? themeColors.foreground : themeColors.muted,
148
172
  }}
149
173
  >
package/src/Slider.tsx CHANGED
@@ -3,7 +3,7 @@ import { measurePreviewWidth } from "./internal/primitives";
3
3
  import type { StyleProp, ViewStyle } from "react-native";
4
4
 
5
5
  import { Glass } from "./Glass";
6
- import { colors } from "./internal/tokens";
6
+ import { colors, material } from "./internal/tokens";
7
7
  import { primitives } from "./internal/primitives";
8
8
  import { useIsDark } from "./internal/motion";
9
9
  import { hapticSelection } from "./internal/haptics";
@@ -25,8 +25,10 @@ export interface SliderProps {
25
25
  testID?: string;
26
26
  }
27
27
 
28
- const TRACK_HEIGHT = 8;
29
- const THUMB = 22;
28
+ // The web slider: a 6pt track and a glass-lens thumb rather than a small dot.
29
+ const TRACK_HEIGHT = 6;
30
+ const THUMB_WIDTH = 36;
31
+ const THUMB_HEIGHT = 24;
30
32
  const CONTAINER_HEIGHT = 40;
31
33
 
32
34
  /** Rounds `value` onto the nearest step from `min`, clamped to the range. */
@@ -160,15 +162,22 @@ export const Slider = forwardRef<any, SliderProps>(function Slider(
160
162
 
161
163
  const thumbStyle: ViewStyle = {
162
164
  position: "absolute",
163
- top: (CONTAINER_HEIGHT - THUMB) / 2,
165
+ top: (CONTAINER_HEIGHT - THUMB_HEIGHT) / 2,
164
166
  left: `${Math.min(100, Math.max(0, percentage))}%`,
165
- width: THUMB,
166
- height: THUMB,
167
- marginLeft: -THUMB / 2,
168
- borderRadius: THUMB / 2,
169
- backgroundColor: "#FFFFFF",
167
+ width: THUMB_WIDTH,
168
+ height: THUMB_HEIGHT,
169
+ marginLeft: -THUMB_WIDTH / 2,
170
+ borderRadius: THUMB_HEIGHT / 2,
171
+ backgroundColor: themeColors.onTint,
170
172
  borderWidth: 0.5,
171
- borderColor: "rgba(0, 0, 0, 0.12)",
173
+ borderColor: themeColors.edge,
174
+ // The same lens shadow stack the Switch thumb carries: the web thumb is a
175
+ // lens with real depth, not a white dot painted on the track.
176
+ shadowColor: material.shadowColor,
177
+ shadowOpacity: 0.2,
178
+ shadowRadius: 8,
179
+ shadowOffset: { width: 0, height: 3 },
180
+ elevation: 3,
172
181
  };
173
182
 
174
183
  return (
package/src/Switch.tsx CHANGED
@@ -2,7 +2,7 @@ import { forwardRef, useState } from "react";
2
2
  import type { StyleProp, ViewStyle } from "react-native";
3
3
 
4
4
  import { Glass } from "./Glass";
5
- import { colors } from "./internal/tokens";
5
+ import { colors, material } from "./internal/tokens";
6
6
  import { primitives } from "./internal/primitives";
7
7
  import { useIsDark, useSpring } from "./internal/motion";
8
8
  import { hapticSelection } from "./internal/haptics";
@@ -21,9 +21,12 @@ export interface SwitchProps {
21
21
  testID?: string;
22
22
  }
23
23
 
24
- const TRACK_WIDTH = 51;
25
- const TRACK_HEIGHT = 31;
26
- const THUMB = 27;
24
+ // The web switch's geometry: a 60 x 25 track with a 21pt thumb, which the web
25
+ // draws at 160 x 67 and scales down by 0.375. The thumb is a lens, not a dot:
26
+ // it carries the same shadow stack as the slider's.
27
+ const TRACK_WIDTH = 60;
28
+ const TRACK_HEIGHT = 25;
29
+ const THUMB = 21;
27
30
  const TRAVEL = TRACK_WIDTH - THUMB - 4;
28
31
 
29
32
  /**
@@ -53,6 +56,7 @@ export const Switch = forwardRef<any, SwitchProps>(function Switch(
53
56
  const themeColors = isDark ? colors.dark : colors.light;
54
57
  const { View, Pressable, Animated } = primitives();
55
58
  const [internalChecked, setInternalChecked] = useState(defaultChecked);
59
+ const [held, setHeld] = useState(false);
56
60
  const isChecked = checkedProp !== undefined ? checkedProp : internalChecked;
57
61
 
58
62
  // The thumb's travel is a single number animated on the springs token.
@@ -81,12 +85,20 @@ export const Switch = forwardRef<any, SwitchProps>(function Switch(
81
85
  width: THUMB,
82
86
  height: THUMB,
83
87
  borderRadius: THUMB / 2,
84
- backgroundColor: "#FFFFFF",
85
- // A hairline edge instead of a drop shadow: RN shadows need per-platform
86
- // props, and the edge reads correctly on a translucent track.
88
+ backgroundColor: themeColors.onTint,
87
89
  borderWidth: 0.5,
88
- borderColor: "rgba(0, 0, 0, 0.12)",
89
- transform: [{ translateX: animated ? offset : isChecked ? TRAVEL : 0 }],
90
+ borderColor: themeColors.edge,
91
+ // The lens's lift: a soft shadow under the thumb, and a slight growth
92
+ // while it is held, matching the web thumb.
93
+ shadowColor: material.shadowColor,
94
+ shadowOpacity: 0.2,
95
+ shadowRadius: 8,
96
+ shadowOffset: { width: 0, height: 3 },
97
+ elevation: 3,
98
+ transform: [
99
+ { translateX: animated ? offset : isChecked ? TRAVEL : 0 },
100
+ { scale: held ? 1.06 : 1 },
101
+ ],
90
102
  };
91
103
 
92
104
  return (
@@ -98,10 +110,12 @@ export const Switch = forwardRef<any, SwitchProps>(function Switch(
98
110
  accessibilityState={{ checked: isChecked, disabled }}
99
111
  disabled={disabled}
100
112
  onPress={toggle}
113
+ onPressIn={() => setHeld(true)}
114
+ onPressOut={() => setHeld(false)}
101
115
  style={{ alignSelf: "flex-start" }}
102
116
  {...props}
103
117
  >
104
- <Glass effect="regular" isDark={isDark} style={trackStyle}>
118
+ <Glass effect="regular" surface="control" isDark={isDark} style={trackStyle}>
105
119
  {animated ? <Animated.View style={thumbStyle} /> : <View style={thumbStyle} />}
106
120
  </Glass>
107
121
  </Pressable>
package/src/TabBar.tsx CHANGED
@@ -6,6 +6,7 @@ import { colors, radii } from "./internal/tokens";
6
6
  import { primitives } from "./internal/primitives";
7
7
  import { useIsDark, useSpring } from "./internal/motion";
8
8
  import { hapticSelection } from "./internal/haptics";
9
+ import { LensRim, lensShadow } from "./internal/lens";
9
10
 
10
11
  export interface TabBarItem {
11
12
  id: string;
@@ -26,7 +27,9 @@ export interface TabBarProps {
26
27
  testID?: string;
27
28
  }
28
29
 
29
- const BAR_HEIGHT = 52;
30
+ // The web bar: a 40pt rail (32pt tabs in a 4pt inset) with a 20pt radius, a
31
+ // glass lens filling the active slot, and 13pt labels at 500/400 weight.
32
+ const BAR_HEIGHT = 40;
30
33
 
31
34
  /**
32
35
  * The bottom bar of an app: a row of tabs on one glass surface.
@@ -56,6 +59,7 @@ export const TabBar = forwardRef<any, TabBarProps>(function TabBar(
56
59
  const { View, Text, Pressable, Animated } = primitives();
57
60
 
58
61
  const [internalId, setInternalId] = useState(defaultActiveId || items[0]?.id || "");
62
+ const [held, setHeld] = useState(false);
59
63
  const activeId = activeProp !== undefined ? activeProp : internalId;
60
64
 
61
65
  const activeIndex = Math.max(
@@ -77,8 +81,8 @@ export const TabBar = forwardRef<any, TabBarProps>(function TabBar(
77
81
  alignItems: "center",
78
82
  justifyContent: "space-around",
79
83
  height: BAR_HEIGHT,
80
- paddingHorizontal: 8,
81
- borderRadius: radii.xl,
84
+ paddingHorizontal: 4,
85
+ borderRadius: radii.lg,
82
86
  ...(style as ViewStyle),
83
87
  };
84
88
 
@@ -87,17 +91,28 @@ export const TabBar = forwardRef<any, TabBarProps>(function TabBar(
87
91
 
88
92
  const indicatorStyle = {
89
93
  position: "absolute" as const,
90
- top: 6,
91
- bottom: 6,
92
- left: 8,
94
+ top: 4,
95
+ bottom: 4,
96
+ left: 4,
93
97
  width: itemWidth,
94
- borderRadius: radii.lg,
98
+ borderRadius: radii.pill,
95
99
  backgroundColor: themeColors.glassActive,
96
100
  opacity: 0.75,
101
+ // A lens, not a wash: it lifts off the rail and carries the rim.
102
+ ...lensShadow(isDark),
97
103
  };
98
104
 
99
105
  return (
100
- <Glass ref={ref} effect="regular" isDark={isDark} style={barStyle} testID={testID} {...props}>
106
+ <Glass
107
+ ref={ref}
108
+ effect="regular"
109
+ surface="rail"
110
+ pressed={held}
111
+ isDark={isDark}
112
+ style={barStyle}
113
+ testID={testID}
114
+ {...props}
115
+ >
101
116
  {/* The selected item's wash, one View behind the labels. */}
102
117
  {animated ? (
103
118
  <Animated.View
@@ -116,12 +131,16 @@ export const TabBar = forwardRef<any, TabBarProps>(function TabBar(
116
131
  },
117
132
  ],
118
133
  }}
119
- />
134
+ >
135
+ <LensRim radius={radii.pill} isDark={isDark} />
136
+ </Animated.View>
120
137
  ) : (
121
138
  <View
122
139
  pointerEvents="none"
123
140
  style={{ ...indicatorStyle, left: `${(activeIndex * 100) / count}%` }}
124
- />
141
+ >
142
+ <LensRim radius={radii.pill} isDark={isDark} />
143
+ </View>
125
144
  )}
126
145
 
127
146
  {items.map((tab) => {
@@ -133,6 +152,8 @@ export const TabBar = forwardRef<any, TabBarProps>(function TabBar(
133
152
  accessibilityLabel={tab.label}
134
153
  accessibilityState={{ selected: isActive }}
135
154
  onPress={() => handleSelect(tab.id)}
155
+ onPressIn={() => setHeld(true)}
156
+ onPressOut={() => setHeld(false)}
136
157
  style={{
137
158
  flex: 1,
138
159
  height: "100%",
@@ -148,8 +169,8 @@ export const TabBar = forwardRef<any, TabBarProps>(function TabBar(
148
169
  <Text
149
170
  numberOfLines={1}
150
171
  style={{
151
- fontSize: 11,
152
- fontWeight: isActive ? "600" : "500",
172
+ fontSize: 13,
173
+ fontWeight: isActive ? "500" : "400",
153
174
  color: isActive ? themeColors.fill : themeColors.muted,
154
175
  }}
155
176
  >
package/src/Table.tsx CHANGED
@@ -79,7 +79,7 @@ export function NativeTable({
79
79
  return (
80
80
  <View style={style as ViewStyle} testID={testID}>
81
81
  {caption && (
82
- <Text style={{ fontSize: 11, color: theme.muted, marginBottom: 8 }}>{caption}</Text>
82
+ <Text style={{ fontSize: 12, color: theme.muted, marginBottom: 8 }}>{caption}</Text>
83
83
  )}
84
84
 
85
85
  {rows.map((row) => {
@@ -97,7 +97,8 @@ export function NativeTable({
97
97
  key={row.id}
98
98
  {...wrapperProps}
99
99
  style={{
100
- paddingVertical: 10,
100
+ paddingVertical: 12,
101
+ paddingHorizontal: 16,
101
102
  borderBottomWidth: 1,
102
103
  borderBottomColor: theme.edge,
103
104
  }}
@@ -127,7 +128,7 @@ export function NativeTable({
127
128
  gap: 12,
128
129
  }}
129
130
  >
130
- <Text style={{ fontSize: 11, color: theme.muted }}>{column.header}</Text>
131
+ <Text style={{ fontSize: 12, fontWeight: "600", color: theme.muted }}>{column.header}</Text>
131
132
  <Text
132
133
  style={{
133
134
  fontSize: 12,
package/src/Tabs.tsx CHANGED
@@ -54,6 +54,7 @@ export const Tabs = forwardRef<any, TabsProps>(function Tabs(
54
54
  const { View, Text, Pressable, Animated } = primitives();
55
55
 
56
56
  const [internalId, setInternalId] = useState(defaultActiveId || items[0]?.id || "");
57
+ const [held, setHeld] = useState(false);
57
58
  const activeId = activeProp !== undefined ? activeProp : internalId;
58
59
 
59
60
  const activeIndex = Math.max(
@@ -87,6 +88,8 @@ export const Tabs = forwardRef<any, TabsProps>(function Tabs(
87
88
  <Glass
88
89
  ref={ref}
89
90
  effect="regular"
91
+ surface="rail"
92
+ pressed={held}
90
93
  isDark={isDark}
91
94
  style={{
92
95
  flexDirection: "row",
@@ -131,6 +134,8 @@ export const Tabs = forwardRef<any, TabsProps>(function Tabs(
131
134
  accessibilityLabel={tab.label}
132
135
  accessibilityState={{ selected: isActive }}
133
136
  onPress={() => handleSelect(tab.id)}
137
+ onPressIn={() => setHeld(true)}
138
+ onPressOut={() => setHeld(false)}
134
139
  style={{
135
140
  flex: 1,
136
141
  height: 36,
package/src/ai.tsx CHANGED
@@ -1,9 +1,11 @@
1
1
  import { useEffect, useState, type ReactNode } from "react";
2
2
  import type { StyleProp, ViewStyle } from "react-native";
3
3
 
4
+ import { Glass } from "./Glass";
4
5
  import { colors, radii } from "./internal/tokens";
5
6
  import { primitives } from "./internal/primitives";
6
7
  import { useIsDark } from "./internal/motion";
8
+ import { SelectedLens, lensFill } from "./internal/lens";
7
9
  import { useReducedMotion } from "./internal/a11y";
8
10
 
9
11
  export interface NativePlanStep {
@@ -42,7 +44,7 @@ export function NativePlan({ title = "Plan", steps, isDark: isDarkProp, style }:
42
44
  : theme.muted;
43
45
 
44
46
  return (
45
- <View style={style}>
47
+ <Glass surface="panel" isDark={isDark} style={[{ paddingHorizontal: 14, paddingVertical: 12, borderRadius: radii.lg }, style]}>
46
48
  <View
47
49
  style={{
48
50
  flexDirection: "row",
@@ -99,7 +101,7 @@ export function NativePlan({ title = "Plan", steps, isDark: isDarkProp, style }:
99
101
  </View>
100
102
  </View>
101
103
  ))}
102
- </View>
104
+ </Glass>
103
105
  );
104
106
  }
105
107
 
@@ -139,7 +141,7 @@ export function NativeSources({
139
141
  if (sources.length === 0) return null;
140
142
 
141
143
  return (
142
- <View style={style}>
144
+ <Glass surface="panel" isDark={isDark} style={[{ paddingHorizontal: 14, paddingVertical: 12, borderRadius: radii.lg }, style]}>
143
145
  <Text style={{ fontSize: 11, fontWeight: "600", color: theme.muted, marginBottom: 6 }}>
144
146
  {title}
145
147
  </Text>
@@ -179,7 +181,7 @@ export function NativeSources({
179
181
  </View>
180
182
  </Pressable>
181
183
  ))}
182
- </View>
184
+ </Glass>
183
185
  );
184
186
  }
185
187
 
@@ -213,7 +215,7 @@ export function NativeResponse({
213
215
  const isStreaming = streaming ?? (revealed != null && revealed < text.length);
214
216
 
215
217
  return (
216
- <View style={style}>
218
+ <Glass surface="panel" isDark={isDark} style={[{ paddingHorizontal: 14, paddingVertical: 12, borderRadius: radii.lg }, style]}>
217
219
  <Text
218
220
  accessibilityRole="text"
219
221
  accessibilityLabel={shown}
@@ -226,7 +228,7 @@ export function NativeResponse({
226
228
  <Text accessibilityRole="alert" style={{ height: 0, opacity: 0, fontSize: 0 }}>
227
229
  {isStreaming ? "Response streaming" : "Response complete"}
228
230
  </Text>
229
- </View>
231
+ </Glass>
230
232
  );
231
233
  }
232
234
 
@@ -255,7 +257,9 @@ export function NativeTask({ task, isDark: isDarkProp, style }: NativeTaskProps)
255
257
  status === "failed" ? theme.destructive : status === "done" ? "#34c759" : theme.fill;
256
258
 
257
259
  return (
258
- <View
260
+ <Glass
261
+ surface="panel"
262
+ isDark={isDark}
259
263
  accessibilityRole="progressbar"
260
264
  accessibilityLabel={task.label ?? "Task progress"}
261
265
  // Without the value, a screen reader only reads the label and never says
@@ -264,7 +268,7 @@ export function NativeTask({ task, isDark: isDarkProp, style }: NativeTaskProps)
264
268
  accessibilityState={{
265
269
  disabled: false,
266
270
  }}
267
- style={style as StyleProp<ViewStyle>}
271
+ style={[{ paddingHorizontal: 14, paddingVertical: 12, borderRadius: radii.lg }, style as StyleProp<ViewStyle>]}
268
272
  >
269
273
  <View
270
274
  style={{ flexDirection: "row", justifyContent: "space-between", marginBottom: 6 }}
@@ -300,7 +304,7 @@ export function NativeTask({ task, isDark: isDarkProp, style }: NativeTaskProps)
300
304
  {task.detail && (
301
305
  <Text style={{ fontSize: 11, color: theme.muted, marginTop: 6 }}>{task.detail}</Text>
302
306
  )}
303
- </View>
307
+ </Glass>
304
308
  );
305
309
  }
306
310
 
@@ -461,7 +465,7 @@ export function NativePanelside({
461
465
  const { View, Text, Pressable } = primitives();
462
466
 
463
467
  return (
464
- <View style={style}>
468
+ <Glass surface="panel" isDark={isDark} style={[{ paddingHorizontal: 14, paddingVertical: 12, borderRadius: radii.lg }, style]}>
465
469
  {title && (
466
470
  <Text style={{ fontSize: 11, fontWeight: "600", color: theme.muted, marginBottom: 6 }}>
467
471
  {title}
@@ -484,10 +488,11 @@ export function NativePanelside({
484
488
  paddingVertical: 9,
485
489
  paddingHorizontal: 11,
486
490
  borderRadius: radii.md,
487
- backgroundColor: isActive ? theme.glassActive : "transparent",
491
+ backgroundColor: "transparent",
488
492
  marginBottom: 2,
489
493
  }}
490
494
  >
495
+ {isActive ? <SelectedLens radius={radii.md} isDark={isDark} style={lensFill} /> : null}
491
496
  <Text
492
497
  style={{
493
498
  fontSize: 13,
@@ -503,7 +508,7 @@ export function NativePanelside({
503
508
  </Pressable>
504
509
  );
505
510
  })}
506
- </View>
511
+ </Glass>
507
512
  );
508
513
  }
509
514
 
@@ -563,16 +568,17 @@ export function NativeAIInput({
563
568
 
564
569
  return (
565
570
  <View style={style as StyleProp<ViewStyle>}>
566
- <View
571
+ <Glass
572
+ surface="field"
573
+ isDark={isDark}
567
574
  style={{
568
575
  flexDirection: "row",
569
576
  alignItems: "flex-end",
570
577
  gap: 8,
571
- padding: 8,
572
- borderRadius: radii.lg,
573
- borderWidth: 1,
574
- borderColor: theme.edge,
575
- backgroundColor: theme.glass,
578
+ paddingVertical: 6,
579
+ paddingRight: 6,
580
+ paddingLeft: 16,
581
+ borderRadius: radii.pill,
576
582
  opacity: disabled ? 0.5 : 1,
577
583
  }}
578
584
  >
@@ -618,8 +624,10 @@ export function NativeAIInput({
618
624
  disabled={!canSend}
619
625
  onPress={() => canSend && onSubmit?.()}
620
626
  style={{
621
- paddingVertical: 8,
627
+ height: 34,
622
628
  paddingHorizontal: 14,
629
+ alignItems: "center",
630
+ justifyContent: "center",
623
631
  borderRadius: radii.pill,
624
632
  backgroundColor: canSend ? theme.fill : theme.edge,
625
633
  }}
@@ -628,7 +636,7 @@ export function NativeAIInput({
628
636
  {busy ? "…" : sendLabel}
629
637
  </Text>
630
638
  </Pressable>
631
- </View>
639
+ </Glass>
632
640
 
633
641
  {footer}
634
642
  </View>