glacia-native 0.5.0 → 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 (100) hide show
  1. package/LICENSE +29 -4
  2. package/README.md +27 -0
  3. package/lib/module/Bars.js +103 -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 +86 -8
  8. package/lib/module/Feedback.js +244 -21
  9. package/lib/module/Form.js +29 -33
  10. package/lib/module/Forms2.js +257 -13
  11. package/lib/module/Glass.js +2 -2
  12. package/lib/module/Input.js +12 -10
  13. package/lib/module/Message.js +84 -0
  14. package/lib/module/Overlays.js +195 -17
  15. package/lib/module/Pickers.js +16 -16
  16. package/lib/module/SegmentedControl.js +24 -11
  17. package/lib/module/Slider.js +24 -10
  18. package/lib/module/Switch.js +25 -10
  19. package/lib/module/TabBar.js +23 -13
  20. package/lib/module/Table.js +4 -3
  21. package/lib/module/Tabs.js +3 -2
  22. package/lib/module/ai.js +26 -18
  23. package/lib/module/charts/BarChart.js +11 -3
  24. package/lib/module/index.js +23 -2
  25. package/lib/module/internal/GlassContainer.js +54 -0
  26. package/lib/module/internal/GlassView.js +10 -2
  27. package/lib/module/internal/a11y.js +94 -0
  28. package/lib/module/internal/blur.js +78 -0
  29. package/lib/module/internal/fallback.js +120 -19
  30. package/lib/module/internal/glass-routing.js +7 -0
  31. package/lib/module/internal/glow.js +36 -0
  32. package/lib/module/internal/haptics.js +54 -0
  33. package/lib/module/internal/lens.js +70 -0
  34. package/lib/module/internal/material.js +64 -0
  35. package/lib/module/internal/motion.js +10 -1
  36. package/lib/module/internal/primitives.js +70 -4
  37. package/lib/module/internal/rim.js +35 -0
  38. package/lib/module/internal/tokens.js +80 -2
  39. package/lib/typescript/Bars.d.ts +67 -0
  40. package/lib/typescript/Display.d.ts +59 -0
  41. package/lib/typescript/Feedback.d.ts +58 -0
  42. package/lib/typescript/Forms2.d.ts +81 -0
  43. package/lib/typescript/Message.d.ts +67 -0
  44. package/lib/typescript/Overlays.d.ts +41 -0
  45. package/lib/typescript/SegmentedControl.d.ts +2 -0
  46. package/lib/typescript/Slider.d.ts +2 -0
  47. package/lib/typescript/Switch.d.ts +2 -0
  48. package/lib/typescript/TabBar.d.ts +2 -0
  49. package/lib/typescript/index.d.ts +9 -6
  50. package/lib/typescript/internal/GlassContainer.d.ts +37 -0
  51. package/lib/typescript/internal/GlassView.d.ts +21 -0
  52. package/lib/typescript/internal/a11y.d.ts +19 -0
  53. package/lib/typescript/internal/blur.d.ts +24 -0
  54. package/lib/typescript/internal/fallback.d.ts +32 -2
  55. package/lib/typescript/internal/glass-routing.d.ts +10 -0
  56. package/lib/typescript/internal/glow.d.ts +11 -0
  57. package/lib/typescript/internal/haptics.d.ts +7 -0
  58. package/lib/typescript/internal/lens.d.ts +47 -0
  59. package/lib/typescript/internal/material.d.ts +27 -0
  60. package/lib/typescript/internal/motion.d.ts +4 -0
  61. package/lib/typescript/internal/primitives.d.ts +23 -0
  62. package/lib/typescript/internal/rim.d.ts +16 -0
  63. package/lib/typescript/internal/tokens.d.ts +89 -0
  64. package/package.json +12 -3
  65. package/src/Bars.tsx +239 -2
  66. package/src/Button.tsx +16 -9
  67. package/src/Card.tsx +2 -2
  68. package/src/Dialog.tsx +37 -26
  69. package/src/Display.tsx +237 -6
  70. package/src/Feedback.tsx +448 -35
  71. package/src/Form.tsx +60 -40
  72. package/src/Forms2.tsx +455 -8
  73. package/src/Glass.tsx +4 -0
  74. package/src/Input.tsx +15 -11
  75. package/src/Message.tsx +218 -0
  76. package/src/Overlays.tsx +269 -39
  77. package/src/Pickers.tsx +11 -6
  78. package/src/SegmentedControl.tsx +39 -9
  79. package/src/Slider.tsx +26 -10
  80. package/src/Switch.tsx +29 -10
  81. package/src/TabBar.tsx +39 -12
  82. package/src/Table.tsx +4 -3
  83. package/src/Tabs.tsx +5 -0
  84. package/src/ai.tsx +37 -23
  85. package/src/charts/BarChart.tsx +41 -3
  86. package/src/index.ts +43 -1
  87. package/src/internal/GlassContainer.tsx +82 -0
  88. package/src/internal/GlassView.tsx +25 -0
  89. package/src/internal/a11y.ts +105 -0
  90. package/src/internal/blur.ts +90 -0
  91. package/src/internal/fallback.tsx +170 -15
  92. package/src/internal/glass-routing.ts +17 -0
  93. package/src/internal/glow.tsx +62 -0
  94. package/src/internal/haptics.ts +59 -0
  95. package/src/internal/lens.tsx +105 -0
  96. package/src/internal/material.ts +92 -0
  97. package/src/internal/motion.ts +10 -1
  98. package/src/internal/primitives.ts +83 -4
  99. package/src/internal/rim.tsx +79 -0
  100. package/src/internal/tokens.ts +82 -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>
@@ -5,19 +5,25 @@ import { Glass } from "./Glass";
5
5
  import { colors, radii } from "./internal/tokens";
6
6
  import { primitives } from "./internal/primitives";
7
7
  import { useIsDark, useSpring } from "./internal/motion";
8
+ import { hapticSelection } from "./internal/haptics";
9
+ import { LensRim, lensShadow } from "./internal/lens";
8
10
 
9
11
  export interface SegmentedControlProps {
10
12
  values: string[];
11
13
  selectedIndex?: number;
12
14
  defaultIndex?: number;
13
15
  onValueChange?: (value: string, index: number) => void;
16
+ /** One selection tick when the segment changes. `false` opts out. */
17
+ haptics?: boolean;
14
18
  style?: StyleProp<ViewStyle>;
15
19
  isDark?: boolean;
16
20
  /** Passed through to the control so it is testable. */
17
21
  testID?: string;
18
22
  }
19
23
 
20
- 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;
21
27
 
22
28
  /**
23
29
  * A row of mutually exclusive segments on one glass container.
@@ -32,6 +38,7 @@ export const SegmentedControl = forwardRef<any, SegmentedControlProps>(function
32
38
  selectedIndex: selectedProp,
33
39
  defaultIndex = 0,
34
40
  onValueChange,
41
+ haptics = true,
35
42
  style,
36
43
  isDark: isDarkProp,
37
44
  testID,
@@ -44,6 +51,7 @@ export const SegmentedControl = forwardRef<any, SegmentedControlProps>(function
44
51
  const { View, Text, Pressable, Animated } = primitives();
45
52
 
46
53
  const [internalIndex, setInternalIndex] = useState(defaultIndex);
54
+ const [held, setHeld] = useState(false);
47
55
  const activeIndex = selectedProp !== undefined ? selectedProp : internalIndex;
48
56
  const safeIndex = Math.min(Math.max(activeIndex, 0), Math.max(values.length - 1, 0));
49
57
 
@@ -52,6 +60,8 @@ export const SegmentedControl = forwardRef<any, SegmentedControlProps>(function
52
60
  const { value: slide, animated } = useSpring(safeIndex, "snappy");
53
61
 
54
62
  const handleSelect = (index: number) => {
63
+ // Only a change ticks: re-pressing the current segment is not a selection.
64
+ if (haptics && index !== safeIndex) hapticSelection();
55
65
  if (selectedProp === undefined) setInternalIndex(index);
56
66
  const val = values[index];
57
67
  if (val !== undefined) onValueChange?.(val, index);
@@ -66,8 +76,10 @@ export const SegmentedControl = forwardRef<any, SegmentedControlProps>(function
66
76
  alignItems: "center",
67
77
  alignSelf: "flex-start",
68
78
  padding: 2,
69
- borderRadius: radii.md,
70
- 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,
71
83
  ...(style as ViewStyle),
72
84
  };
73
85
 
@@ -80,7 +92,16 @@ export const SegmentedControl = forwardRef<any, SegmentedControlProps>(function
80
92
  : `${(safeIndex * 100) / count}%`;
81
93
 
82
94
  return (
83
- <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
+ >
84
105
  {/* The sliding pill: one View behind the labels, coloured by the theme. */}
85
106
  {animated ? (
86
107
  <Animated.View
@@ -90,14 +111,18 @@ export const SegmentedControl = forwardRef<any, SegmentedControlProps>(function
90
111
  left: 2,
91
112
  width: pillWidth,
92
113
  height: SEGMENT_HEIGHT,
93
- borderRadius: radii.sm,
114
+ borderRadius: radii.pill,
94
115
  backgroundColor: themeColors.glassActive,
95
116
  borderWidth: 0.5,
96
117
  borderColor: themeColors.edge,
118
+ // The thumb is a lens: lifted off the rail, with its own rim.
119
+ ...lensShadow(isDark),
97
120
  transform: [{ translateX: pillTranslate }],
98
121
  }}
99
122
  pointerEvents="none"
100
- />
123
+ >
124
+ <LensRim radius={radii.pill} isDark={isDark} />
125
+ </Animated.View>
101
126
  ) : (
102
127
  <View
103
128
  style={{
@@ -106,13 +131,16 @@ export const SegmentedControl = forwardRef<any, SegmentedControlProps>(function
106
131
  left: `${2 + (safeIndex * 100) / count}%`,
107
132
  width: pillWidth,
108
133
  height: SEGMENT_HEIGHT,
109
- borderRadius: radii.sm,
134
+ borderRadius: radii.pill,
110
135
  backgroundColor: themeColors.glassActive,
111
136
  borderWidth: 0.5,
112
137
  borderColor: themeColors.edge,
138
+ ...lensShadow(isDark),
113
139
  }}
114
140
  pointerEvents="none"
115
- />
141
+ >
142
+ <LensRim radius={radii.pill} isDark={isDark} />
143
+ </View>
116
144
  )}
117
145
 
118
146
  {values.map((label, idx) => {
@@ -124,6 +152,8 @@ export const SegmentedControl = forwardRef<any, SegmentedControlProps>(function
124
152
  accessibilityLabel={label}
125
153
  accessibilityState={{ selected: isSelected }}
126
154
  onPress={() => handleSelect(idx)}
155
+ onPressIn={() => setHeld(true)}
156
+ onPressOut={() => setHeld(false)}
127
157
  style={{
128
158
  flex: 1,
129
159
  height: SEGMENT_HEIGHT,
@@ -137,7 +167,7 @@ export const SegmentedControl = forwardRef<any, SegmentedControlProps>(function
137
167
  numberOfLines={1}
138
168
  style={{
139
169
  fontSize: 13,
140
- fontWeight: isSelected ? "600" : "500",
170
+ fontWeight: isSelected ? "500" : "400",
141
171
  color: isSelected ? themeColors.foreground : themeColors.muted,
142
172
  }}
143
173
  >
package/src/Slider.tsx CHANGED
@@ -3,9 +3,10 @@ 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
+ import { hapticSelection } from "./internal/haptics";
9
10
 
10
11
  export interface SliderProps {
11
12
  value?: number;
@@ -15,6 +16,8 @@ export interface SliderProps {
15
16
  step?: number;
16
17
  onValueChange?: (value: number) => void;
17
18
  disabled?: boolean;
19
+ /** One selection tick each time the stepped value changes while dragging. */
20
+ haptics?: boolean;
18
21
  accessibilityLabel: string;
19
22
  style?: StyleProp<ViewStyle>;
20
23
  isDark?: boolean;
@@ -22,8 +25,10 @@ export interface SliderProps {
22
25
  testID?: string;
23
26
  }
24
27
 
25
- const TRACK_HEIGHT = 8;
26
- 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;
27
32
  const CONTAINER_HEIGHT = 40;
28
33
 
29
34
  /** Rounds `value` onto the nearest step from `min`, clamped to the range. */
@@ -55,6 +60,7 @@ export const Slider = forwardRef<any, SliderProps>(function Slider(
55
60
  step = 1,
56
61
  onValueChange,
57
62
  disabled = false,
63
+ haptics = true,
58
64
  accessibilityLabel,
59
65
  style,
60
66
  isDark: isDarkProp,
@@ -93,7 +99,10 @@ export const Slider = forwardRef<any, SliderProps>(function Slider(
93
99
  );
94
100
 
95
101
  const report = (next: number) => {
102
+ // Only a real step change ticks: a drag that stays inside one step is not
103
+ // a selection, and reporting the same value twice must not buzz twice.
96
104
  if (next === valueRef.current) return;
105
+ if (haptics) hapticSelection();
97
106
  valueRef.current = next;
98
107
  if (valueProp === undefined) setInternalValue(next);
99
108
  onValueChange?.(next);
@@ -153,15 +162,22 @@ export const Slider = forwardRef<any, SliderProps>(function Slider(
153
162
 
154
163
  const thumbStyle: ViewStyle = {
155
164
  position: "absolute",
156
- top: (CONTAINER_HEIGHT - THUMB) / 2,
165
+ top: (CONTAINER_HEIGHT - THUMB_HEIGHT) / 2,
157
166
  left: `${Math.min(100, Math.max(0, percentage))}%`,
158
- width: THUMB,
159
- height: THUMB,
160
- marginLeft: -THUMB / 2,
161
- borderRadius: THUMB / 2,
162
- backgroundColor: "#FFFFFF",
167
+ width: THUMB_WIDTH,
168
+ height: THUMB_HEIGHT,
169
+ marginLeft: -THUMB_WIDTH / 2,
170
+ borderRadius: THUMB_HEIGHT / 2,
171
+ backgroundColor: themeColors.onTint,
163
172
  borderWidth: 0.5,
164
- 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,
165
181
  };
166
182
 
167
183
  return (
package/src/Switch.tsx CHANGED
@@ -2,14 +2,17 @@ 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
+ import { hapticSelection } from "./internal/haptics";
8
9
 
9
10
  export interface SwitchProps {
10
11
  checked?: boolean;
11
12
  defaultChecked?: boolean;
12
13
  onCheckedChange?: (checked: boolean) => void;
14
+ /** One selection tick when it toggles. `false` opts out. */
15
+ haptics?: boolean;
13
16
  disabled?: boolean;
14
17
  accessibilityLabel: string;
15
18
  style?: StyleProp<ViewStyle>;
@@ -18,9 +21,12 @@ export interface SwitchProps {
18
21
  testID?: string;
19
22
  }
20
23
 
21
- const TRACK_WIDTH = 51;
22
- const TRACK_HEIGHT = 31;
23
- 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;
24
30
  const TRAVEL = TRACK_WIDTH - THUMB - 4;
25
31
 
26
32
  /**
@@ -37,6 +43,7 @@ export const Switch = forwardRef<any, SwitchProps>(function Switch(
37
43
  defaultChecked = false,
38
44
  onCheckedChange,
39
45
  disabled = false,
46
+ haptics = true,
40
47
  accessibilityLabel,
41
48
  style,
42
49
  isDark: isDarkProp,
@@ -49,6 +56,7 @@ export const Switch = forwardRef<any, SwitchProps>(function Switch(
49
56
  const themeColors = isDark ? colors.dark : colors.light;
50
57
  const { View, Pressable, Animated } = primitives();
51
58
  const [internalChecked, setInternalChecked] = useState(defaultChecked);
59
+ const [held, setHeld] = useState(false);
52
60
  const isChecked = checkedProp !== undefined ? checkedProp : internalChecked;
53
61
 
54
62
  // The thumb's travel is a single number animated on the springs token.
@@ -57,6 +65,7 @@ export const Switch = forwardRef<any, SwitchProps>(function Switch(
57
65
  const toggle = () => {
58
66
  if (disabled) return;
59
67
  const next = !isChecked;
68
+ if (haptics) hapticSelection();
60
69
  if (checkedProp === undefined) setInternalChecked(next);
61
70
  onCheckedChange?.(next);
62
71
  };
@@ -76,12 +85,20 @@ export const Switch = forwardRef<any, SwitchProps>(function Switch(
76
85
  width: THUMB,
77
86
  height: THUMB,
78
87
  borderRadius: THUMB / 2,
79
- backgroundColor: "#FFFFFF",
80
- // A hairline edge instead of a drop shadow: RN shadows need per-platform
81
- // props, and the edge reads correctly on a translucent track.
88
+ backgroundColor: themeColors.onTint,
82
89
  borderWidth: 0.5,
83
- borderColor: "rgba(0, 0, 0, 0.12)",
84
- 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
+ ],
85
102
  };
86
103
 
87
104
  return (
@@ -93,10 +110,12 @@ export const Switch = forwardRef<any, SwitchProps>(function Switch(
93
110
  accessibilityState={{ checked: isChecked, disabled }}
94
111
  disabled={disabled}
95
112
  onPress={toggle}
113
+ onPressIn={() => setHeld(true)}
114
+ onPressOut={() => setHeld(false)}
96
115
  style={{ alignSelf: "flex-start" }}
97
116
  {...props}
98
117
  >
99
- <Glass effect="regular" isDark={isDark} style={trackStyle}>
118
+ <Glass effect="regular" surface="control" isDark={isDark} style={trackStyle}>
100
119
  {animated ? <Animated.View style={thumbStyle} /> : <View style={thumbStyle} />}
101
120
  </Glass>
102
121
  </Pressable>
package/src/TabBar.tsx CHANGED
@@ -5,6 +5,8 @@ import { Glass } from "./Glass";
5
5
  import { colors, radii } from "./internal/tokens";
6
6
  import { primitives } from "./internal/primitives";
7
7
  import { useIsDark, useSpring } from "./internal/motion";
8
+ import { hapticSelection } from "./internal/haptics";
9
+ import { LensRim, lensShadow } from "./internal/lens";
8
10
 
9
11
  export interface TabBarItem {
10
12
  id: string;
@@ -17,13 +19,17 @@ export interface TabBarProps {
17
19
  activeId?: string;
18
20
  defaultActiveId?: string;
19
21
  onTabChange?: (id: string) => void;
22
+ /** One selection tick when the tab changes. `false` opts out. */
23
+ haptics?: boolean;
20
24
  style?: StyleProp<ViewStyle>;
21
25
  isDark?: boolean;
22
26
  /** Passed through to the bar so it is testable. */
23
27
  testID?: string;
24
28
  }
25
29
 
26
- 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;
27
33
 
28
34
  /**
29
35
  * The bottom bar of an app: a row of tabs on one glass surface.
@@ -40,6 +46,7 @@ export const TabBar = forwardRef<any, TabBarProps>(function TabBar(
40
46
  activeId: activeProp,
41
47
  defaultActiveId,
42
48
  onTabChange,
49
+ haptics = true,
43
50
  style,
44
51
  isDark: isDarkProp,
45
52
  testID,
@@ -52,6 +59,7 @@ export const TabBar = forwardRef<any, TabBarProps>(function TabBar(
52
59
  const { View, Text, Pressable, Animated } = primitives();
53
60
 
54
61
  const [internalId, setInternalId] = useState(defaultActiveId || items[0]?.id || "");
62
+ const [held, setHeld] = useState(false);
55
63
  const activeId = activeProp !== undefined ? activeProp : internalId;
56
64
 
57
65
  const activeIndex = Math.max(
@@ -62,6 +70,8 @@ export const TabBar = forwardRef<any, TabBarProps>(function TabBar(
62
70
  const { value: slide, animated } = useSpring(activeIndex, "snappy");
63
71
 
64
72
  const handleSelect = (id: string) => {
73
+ // Selecting the tab already active is not a change, so it does not tick.
74
+ if (haptics && id !== activeId) hapticSelection();
65
75
  if (activeProp === undefined) setInternalId(id);
66
76
  onTabChange?.(id);
67
77
  };
@@ -71,8 +81,8 @@ export const TabBar = forwardRef<any, TabBarProps>(function TabBar(
71
81
  alignItems: "center",
72
82
  justifyContent: "space-around",
73
83
  height: BAR_HEIGHT,
74
- paddingHorizontal: 8,
75
- borderRadius: radii.xl,
84
+ paddingHorizontal: 4,
85
+ borderRadius: radii.lg,
76
86
  ...(style as ViewStyle),
77
87
  };
78
88
 
@@ -81,17 +91,28 @@ export const TabBar = forwardRef<any, TabBarProps>(function TabBar(
81
91
 
82
92
  const indicatorStyle = {
83
93
  position: "absolute" as const,
84
- top: 6,
85
- bottom: 6,
86
- left: 8,
94
+ top: 4,
95
+ bottom: 4,
96
+ left: 4,
87
97
  width: itemWidth,
88
- borderRadius: radii.lg,
98
+ borderRadius: radii.pill,
89
99
  backgroundColor: themeColors.glassActive,
90
100
  opacity: 0.75,
101
+ // A lens, not a wash: it lifts off the rail and carries the rim.
102
+ ...lensShadow(isDark),
91
103
  };
92
104
 
93
105
  return (
94
- <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
+ >
95
116
  {/* The selected item's wash, one View behind the labels. */}
96
117
  {animated ? (
97
118
  <Animated.View
@@ -110,12 +131,16 @@ export const TabBar = forwardRef<any, TabBarProps>(function TabBar(
110
131
  },
111
132
  ],
112
133
  }}
113
- />
134
+ >
135
+ <LensRim radius={radii.pill} isDark={isDark} />
136
+ </Animated.View>
114
137
  ) : (
115
138
  <View
116
139
  pointerEvents="none"
117
140
  style={{ ...indicatorStyle, left: `${(activeIndex * 100) / count}%` }}
118
- />
141
+ >
142
+ <LensRim radius={radii.pill} isDark={isDark} />
143
+ </View>
119
144
  )}
120
145
 
121
146
  {items.map((tab) => {
@@ -127,6 +152,8 @@ export const TabBar = forwardRef<any, TabBarProps>(function TabBar(
127
152
  accessibilityLabel={tab.label}
128
153
  accessibilityState={{ selected: isActive }}
129
154
  onPress={() => handleSelect(tab.id)}
155
+ onPressIn={() => setHeld(true)}
156
+ onPressOut={() => setHeld(false)}
130
157
  style={{
131
158
  flex: 1,
132
159
  height: "100%",
@@ -142,8 +169,8 @@ export const TabBar = forwardRef<any, TabBarProps>(function TabBar(
142
169
  <Text
143
170
  numberOfLines={1}
144
171
  style={{
145
- fontSize: 11,
146
- fontWeight: isActive ? "600" : "500",
172
+ fontSize: 13,
173
+ fontWeight: isActive ? "500" : "400",
147
174
  color: isActive ? themeColors.fill : themeColors.muted,
148
175
  }}
149
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,