@ledgerhq/lumen-ui-rnative 0.1.73 → 0.1.75

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 (61) hide show
  1. package/dist/module/lib/Components/core/DotSymbol/DotSymbol.js +1 -1
  2. package/dist/module/lib/Components/core/Spot/Spot.js +1 -1
  3. package/dist/module/lib/Components/core/TabBar/TabBar.js +298 -133
  4. package/dist/module/lib/Components/core/TabBar/TabBar.js.map +1 -1
  5. package/dist/module/lib/Components/core/TabBar/TabBarContext.js.map +1 -1
  6. package/dist/module/lib/Components/internal/BaseTag/BaseTag.js.map +1 -1
  7. package/dist/module/lib/Components/symbols/icons/BadgeVerified.js +49 -0
  8. package/dist/module/lib/Components/symbols/icons/BadgeVerified.js.map +1 -0
  9. package/dist/module/lib/Components/symbols/icons/BadgeVerifiedFill.js +47 -0
  10. package/dist/module/lib/Components/symbols/icons/BadgeVerifiedFill.js.map +1 -0
  11. package/dist/module/lib/Components/symbols/icons/Building.js +49 -0
  12. package/dist/module/lib/Components/symbols/icons/Building.js.map +1 -0
  13. package/dist/module/lib/Components/symbols/icons/Play.js +48 -0
  14. package/dist/module/lib/Components/symbols/icons/Play.js.map +1 -0
  15. package/dist/module/lib/Components/symbols/icons/Sort.js +49 -0
  16. package/dist/module/lib/Components/symbols/icons/Sort.js.map +1 -0
  17. package/dist/module/lib/Components/symbols/icons/TextEdit.js +49 -0
  18. package/dist/module/lib/Components/symbols/icons/TextEdit.js.map +1 -0
  19. package/dist/module/lib/Components/symbols/index.js +6 -0
  20. package/dist/module/lib/Components/symbols/index.js.map +1 -1
  21. package/dist/typescript/src/lib/Components/core/TabBar/TabBar.d.ts +3 -2
  22. package/dist/typescript/src/lib/Components/core/TabBar/TabBar.d.ts.map +1 -1
  23. package/dist/typescript/src/lib/Components/core/TabBar/TabBarContext.d.ts +3 -0
  24. package/dist/typescript/src/lib/Components/core/TabBar/TabBarContext.d.ts.map +1 -1
  25. package/dist/typescript/src/lib/Components/core/TabBar/types.d.ts +8 -0
  26. package/dist/typescript/src/lib/Components/core/TabBar/types.d.ts.map +1 -1
  27. package/dist/typescript/src/lib/Components/core/Tag/types.d.ts +3 -22
  28. package/dist/typescript/src/lib/Components/core/Tag/types.d.ts.map +1 -1
  29. package/dist/typescript/src/lib/Components/internal/BaseTag/BaseTag.d.ts.map +1 -1
  30. package/dist/typescript/src/lib/Components/internal/BaseTag/types.d.ts +23 -2
  31. package/dist/typescript/src/lib/Components/internal/BaseTag/types.d.ts.map +1 -1
  32. package/dist/typescript/src/lib/Components/symbols/icons/BadgeVerified.d.ts +35 -0
  33. package/dist/typescript/src/lib/Components/symbols/icons/BadgeVerified.d.ts.map +1 -0
  34. package/dist/typescript/src/lib/Components/symbols/icons/BadgeVerifiedFill.d.ts +35 -0
  35. package/dist/typescript/src/lib/Components/symbols/icons/BadgeVerifiedFill.d.ts.map +1 -0
  36. package/dist/typescript/src/lib/Components/symbols/icons/Building.d.ts +35 -0
  37. package/dist/typescript/src/lib/Components/symbols/icons/Building.d.ts.map +1 -0
  38. package/dist/typescript/src/lib/Components/symbols/icons/Play.d.ts +35 -0
  39. package/dist/typescript/src/lib/Components/symbols/icons/Play.d.ts.map +1 -0
  40. package/dist/typescript/src/lib/Components/symbols/icons/Sort.d.ts +35 -0
  41. package/dist/typescript/src/lib/Components/symbols/icons/Sort.d.ts.map +1 -0
  42. package/dist/typescript/src/lib/Components/symbols/icons/TextEdit.d.ts +35 -0
  43. package/dist/typescript/src/lib/Components/symbols/icons/TextEdit.d.ts.map +1 -0
  44. package/dist/typescript/src/lib/Components/symbols/index.d.ts +6 -0
  45. package/dist/typescript/src/lib/Components/symbols/index.d.ts.map +1 -1
  46. package/package.json +2 -2
  47. package/src/lib/Components/core/DotSymbol/DotSymbol.tsx +1 -1
  48. package/src/lib/Components/core/Spot/Spot.tsx +1 -1
  49. package/src/lib/Components/core/TabBar/TabBar.tsx +212 -109
  50. package/src/lib/Components/core/TabBar/TabBarContext.tsx +3 -0
  51. package/src/lib/Components/core/TabBar/types.ts +9 -0
  52. package/src/lib/Components/core/Tag/types.ts +3 -30
  53. package/src/lib/Components/internal/BaseTag/BaseTag.tsx +2 -3
  54. package/src/lib/Components/internal/BaseTag/types.ts +32 -2
  55. package/src/lib/Components/symbols/icons/BadgeVerified.tsx +44 -0
  56. package/src/lib/Components/symbols/icons/BadgeVerifiedFill.tsx +42 -0
  57. package/src/lib/Components/symbols/icons/Building.tsx +44 -0
  58. package/src/lib/Components/symbols/icons/Play.tsx +43 -0
  59. package/src/lib/Components/symbols/icons/Sort.tsx +44 -0
  60. package/src/lib/Components/symbols/icons/TextEdit.tsx +44 -0
  61. package/src/lib/Components/symbols/index.ts +6 -0
@@ -13,7 +13,7 @@ const dotSquareRadiusMap = {
13
13
  16: 5,
14
14
  20: 6,
15
15
  24: 8,
16
- 32: 10
16
+ 32: 12
17
17
  };
18
18
  const offsetBySize = {
19
19
  8: -2,
@@ -6,7 +6,7 @@ import { Box } from "../../primitives/index.js";
6
6
  import { useSpotStyles } from "./useSpotStyles.js";
7
7
  import { jsx as _jsx } from "react/jsx-runtime";
8
8
  const iconSizeMap = {
9
- 32: 12,
9
+ 32: 16,
10
10
  40: 16,
11
11
  48: 20,
12
12
  56: 24,
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
 
3
3
  import { BlurView } from '@sbaiahmed1/react-native-blur';
4
- import { Children, isValidElement, useEffect, useMemo, useRef } from 'react';
5
- import { StyleSheet, Text, View } from 'react-native';
6
- import Animated, { cancelAnimation, useAnimatedStyle, useSharedValue, withDelay, withSequence, withTiming } from 'react-native-reanimated';
4
+ import { Children, isValidElement, useEffect } from 'react';
5
+ import { StyleSheet, Text, useWindowDimensions, View } from 'react-native';
6
+ import Animated, { cancelAnimation, interpolate, useAnimatedStyle, useSharedValue, withDelay, withSequence, withTiming } from 'react-native-reanimated';
7
7
  import { useStyleSheet, useTheme } from "../../../../styles/index.js";
8
8
  import { triggerHapticFeedback } from "../../../Haptics/index.js";
9
9
  import { RuntimeConstants } from "../../../utils/index.js";
@@ -12,25 +12,54 @@ import { Box, Pressable } from "../../primitives/index.js";
12
12
  import { Placeholder } from "../../symbols/index.js";
13
13
  import { TabBarContextProvider, useTabBarContext } from "./TabBarContext.js";
14
14
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
15
- export const TAB_BAR_HEIGHT = 60;
15
+ export const TAB_BAR_EXPANDED_HEIGHT = 60;
16
+ export const TAB_BAR_COMPACT_HEIGHT = 44;
16
17
  const PILL_INSET = 4;
18
+ const ICON_SIZE = 20;
19
+ const ICON_LABEL_GAP = 4;
20
+ const useLabelLineHeight = () => {
21
+ const {
22
+ theme
23
+ } = useTheme();
24
+ const {
25
+ fontScale
26
+ } = useWindowDimensions();
27
+ const base = theme.typographies.body4.lineHeight ?? 0;
28
+ return {
29
+ base,
30
+ scaled: base * fontScale
31
+ };
32
+ };
17
33
  const _worklet_12151274743312_init_data = {
18
34
  code: "function TabBarTsx1(){const{pressProgress}=this.__closure;return{transform:[{scale:pressProgress.value}]};}",
19
35
  location: "/home/runner/work/lumen/lumen/libs/ui-rnative/src/lib/Components/core/TabBar/TabBar.tsx",
20
- sourceMap: "{\"version\":3,\"names\":[\"TabBarTsx1\",\"pressProgress\",\"__closure\",\"transform\",\"scale\",\"value\"],\"sources\":[\"/home/runner/work/lumen/lumen/libs/ui-rnative/src/lib/Components/core/TabBar/TabBar.tsx\"],\"mappings\":\"AAkEI,SAAAA,WAAA,QAAAC,aAAA,OAAAC,SAAA,OAAO,CACLC,SAAS,CAAE,CAAC,CAAEC,KAAK,CAAEH,aAAa,CAACI,KAAM,CAAC,CAC5C,CAAC\",\"ignoreList\":[]}"
36
+ sourceMap: "{\"version\":3,\"names\":[\"TabBarTsx1\",\"pressProgress\",\"__closure\",\"transform\",\"scale\",\"value\"],\"sources\":[\"/home/runner/work/lumen/lumen/libs/ui-rnative/src/lib/Components/core/TabBar/TabBar.tsx\"],\"mappings\":\"AAuFI,SAAAA,WAAA,QAAAC,aAAA,OAAAC,SAAA,OAAO,CACLC,SAAS,CAAE,CAAC,CAAEC,KAAK,CAAEH,aAAa,CAACI,KAAM,CAAC,CAC5C,CAAC\",\"ignoreList\":[]}"
21
37
  };
22
38
  const _worklet_7396791557540_init_data = {
23
39
  code: "function TabBarTsx2(){const{activeProgress}=this.__closure;return{opacity:activeProgress.value};}",
24
40
  location: "/home/runner/work/lumen/lumen/libs/ui-rnative/src/lib/Components/core/TabBar/TabBar.tsx",
25
- sourceMap: "{\"version\":3,\"names\":[\"TabBarTsx2\",\"activeProgress\",\"__closure\",\"opacity\",\"value\"],\"sources\":[\"/home/runner/work/lumen/lumen/libs/ui-rnative/src/lib/Components/core/TabBar/TabBar.tsx\"],\"mappings\":\"AAyEI,SAAAA,WAAA,QAAAC,cAAA,OAAAC,SAAA,OAAO,CACLC,OAAO,CAAEF,cAAc,CAACG,KAC1B,CAAC\",\"ignoreList\":[]}"
41
+ sourceMap: "{\"version\":3,\"names\":[\"TabBarTsx2\",\"activeProgress\",\"__closure\",\"opacity\",\"value\"],\"sources\":[\"/home/runner/work/lumen/lumen/libs/ui-rnative/src/lib/Components/core/TabBar/TabBar.tsx\"],\"mappings\":\"AA8FI,SAAAA,WAAA,QAAAC,cAAA,OAAAC,SAAA,OAAO,CACLC,OAAO,CAAEF,cAAc,CAACG,KAC1B,CAAC\",\"ignoreList\":[]}"
26
42
  };
27
43
  const _worklet_11977595001241_init_data = {
28
44
  code: "function TabBarTsx3(){const{activeProgress}=this.__closure;return{opacity:1-activeProgress.value};}",
29
45
  location: "/home/runner/work/lumen/lumen/libs/ui-rnative/src/lib/Components/core/TabBar/TabBar.tsx",
30
- sourceMap: "{\"version\":3,\"names\":[\"TabBarTsx3\",\"activeProgress\",\"__closure\",\"opacity\",\"value\"],\"sources\":[\"/home/runner/work/lumen/lumen/libs/ui-rnative/src/lib/Components/core/TabBar/TabBar.tsx\"],\"mappings\":\"AAgFI,SAAAA,WAAA,QAAAC,cAAA,OAAAC,SAAA,OAAO,CACLC,OAAO,CAAE,CAAC,CAAGF,cAAc,CAACG,KAC9B,CAAC\",\"ignoreList\":[]}"
46
+ sourceMap: "{\"version\":3,\"names\":[\"TabBarTsx3\",\"activeProgress\",\"__closure\",\"opacity\",\"value\"],\"sources\":[\"/home/runner/work/lumen/lumen/libs/ui-rnative/src/lib/Components/core/TabBar/TabBar.tsx\"],\"mappings\":\"AAqGI,SAAAA,WAAA,QAAAC,cAAA,OAAAC,SAAA,OAAO,CACLC,OAAO,CAAE,CAAC,CAAGF,cAAc,CAACG,KAC9B,CAAC\",\"ignoreList\":[]}"
47
+ };
48
+ const _worklet_13573149629465_init_data = {
49
+ code: "function TabBarTsx4(){const{iconShift,densityProgress}=this.__closure;return{transform:[{translateY:-iconShift*densityProgress.value}]};}",
50
+ location: "/home/runner/work/lumen/lumen/libs/ui-rnative/src/lib/Components/core/TabBar/TabBar.tsx",
51
+ sourceMap: "{\"version\":3,\"names\":[\"TabBarTsx4\",\"iconShift\",\"densityProgress\",\"__closure\",\"transform\",\"translateY\",\"value\"],\"sources\":[\"/home/runner/work/lumen/lumen/libs/ui-rnative/src/lib/Components/core/TabBar/TabBar.tsx\"],\"mappings\":\"AA4GI,SAAAA,WAAA,QAAAC,SAAA,CAAAC,eAAA,OAAAC,SAAA,OAAO,CACLC,SAAS,CAAE,CAAC,CAAEC,UAAU,CAAE,CAACJ,SAAS,CAAGC,eAAe,CAACI,KAAM,CAAC,CAChE,CAAC\",\"ignoreList\":[]}"
52
+ };
53
+ const _worklet_9323961691555_init_data = {
54
+ code: "function TabBarTsx5(){const{labelOpacity,ICON_LABEL_GAP,densityProgress}=this.__closure;return{opacity:labelOpacity.value,transform:[{translateY:-ICON_LABEL_GAP*(1-densityProgress.value)}]};}",
55
+ location: "/home/runner/work/lumen/lumen/libs/ui-rnative/src/lib/Components/core/TabBar/TabBar.tsx",
56
+ sourceMap: "{\"version\":3,\"names\":[\"TabBarTsx5\",\"labelOpacity\",\"ICON_LABEL_GAP\",\"densityProgress\",\"__closure\",\"opacity\",\"value\",\"transform\",\"translateY\"],\"sources\":[\"/home/runner/work/lumen/lumen/libs/ui-rnative/src/lib/Components/core/TabBar/TabBar.tsx\"],\"mappings\":\"AAmHI,SAAAA,WAAA,QAAAC,YAAA,CAAAC,cAAA,CAAAC,eAAA,OAAAC,SAAA,OAAO,CACLC,OAAO,CAAEJ,YAAY,CAACK,KAAK,CAE3BC,SAAS,CAAE,CACT,CAAEC,UAAU,CAAE,CAACN,cAAc,EAAI,CAAC,CAAGC,eAAe,CAACG,KAAK,CAAE,CAAC,CAEjE,CAAC\",\"ignoreList\":[]}"
31
57
  };
32
58
  const useTabBarItemAnimations = ({
33
- isActive
59
+ isActive,
60
+ densityProgress,
61
+ labelOpacity,
62
+ iconShift
34
63
  }) => {
35
64
  const activeProgress = useSharedValue(isActive ? 1 : 0);
36
65
  const pressProgress = useSharedValue(1);
@@ -121,101 +150,198 @@ const useTabBarItemAnimations = ({
121
150
  _worklet_11977595001241_init_data,
122
151
  activeProgress
123
152
  }), [activeProgress]);
153
+ const contentStyle = useAnimatedStyle(function TabBarTsx4Factory({
154
+ _worklet_13573149629465_init_data,
155
+ iconShift,
156
+ densityProgress
157
+ }) {
158
+ const _e = [new global.Error(), -3, -27];
159
+ const TabBarTsx4 = () => ({
160
+ transform: [{
161
+ translateY: -iconShift * densityProgress.value
162
+ }]
163
+ });
164
+ TabBarTsx4.__closure = {
165
+ iconShift,
166
+ densityProgress
167
+ };
168
+ TabBarTsx4.__workletHash = 13573149629465;
169
+ TabBarTsx4.__pluginVersion = "0.10.1";
170
+ TabBarTsx4.__initData = _worklet_13573149629465_init_data;
171
+ TabBarTsx4.__stackDetails = _e;
172
+ return TabBarTsx4;
173
+ }({
174
+ _worklet_13573149629465_init_data,
175
+ iconShift,
176
+ densityProgress
177
+ }), [densityProgress, iconShift]);
178
+ const labelStyle = useAnimatedStyle(function TabBarTsx5Factory({
179
+ _worklet_9323961691555_init_data,
180
+ labelOpacity,
181
+ ICON_LABEL_GAP,
182
+ densityProgress
183
+ }) {
184
+ const _e = [new global.Error(), -4, -27];
185
+ const TabBarTsx5 = () => ({
186
+ opacity: labelOpacity.value,
187
+ // Closes the icon/label gap as the bar collapses.
188
+ transform: [{
189
+ translateY: -ICON_LABEL_GAP * (1 - densityProgress.value)
190
+ }]
191
+ });
192
+ TabBarTsx5.__closure = {
193
+ labelOpacity,
194
+ ICON_LABEL_GAP,
195
+ densityProgress
196
+ };
197
+ TabBarTsx5.__workletHash = 9323961691555;
198
+ TabBarTsx5.__pluginVersion = "0.10.1";
199
+ TabBarTsx5.__initData = _worklet_9323961691555_init_data;
200
+ TabBarTsx5.__stackDetails = _e;
201
+ return TabBarTsx5;
202
+ }({
203
+ _worklet_9323961691555_init_data,
204
+ labelOpacity,
205
+ ICON_LABEL_GAP,
206
+ densityProgress
207
+ }), [labelOpacity, densityProgress]);
124
208
  return {
125
209
  onPressIn,
126
210
  onPressOut,
127
211
  scaleStyle,
128
212
  activeIconStyle,
129
- inactiveIconStyle
213
+ inactiveIconStyle,
214
+ contentStyle,
215
+ labelStyle
130
216
  };
131
217
  };
132
- const _worklet_12147453282099_init_data = {
133
- code: "function TabBarTsx4(){const{pillProgress,itemWidth,itemHeight,PILL_INSET}=this.__closure;return{transform:[{translateX:pillProgress.value}],width:itemWidth.value,height:itemHeight.value-PILL_INSET*2};}",
218
+ const _worklet_8753718797100_init_data = {
219
+ code: "function TabBarTsx6(){const{interpolate,densityProgress,compactInset,TAB_BAR_COMPACT_HEIGHT,expandedHeight}=this.__closure;const inset=interpolate(densityProgress.value,[0,1],[compactInset,0]);return{height:interpolate(densityProgress.value,[0,1],[TAB_BAR_COMPACT_HEIGHT,expandedHeight]),marginLeft:inset,marginRight:inset};}",
220
+ location: "/home/runner/work/lumen/lumen/libs/ui-rnative/src/lib/Components/core/TabBar/TabBar.tsx",
221
+ sourceMap: "{\"version\":3,\"names\":[\"TabBarTsx6\",\"interpolate\",\"densityProgress\",\"compactInset\",\"TAB_BAR_COMPACT_HEIGHT\",\"expandedHeight\",\"__closure\",\"inset\",\"value\",\"height\",\"marginLeft\",\"marginRight\"],\"sources\":[\"/home/runner/work/lumen/lumen/libs/ui-rnative/src/lib/Components/core/TabBar/TabBar.tsx\"],\"mappings\":\"AAoNoC,SAAAA,UAAMA,CAAA,QAAAC,WAAA,CAAAC,eAAA,CAAAC,YAAA,CAAAC,sBAAA,CAAAC,cAAA,OAAAC,SAAA,CACtC,KAAM,CAAAC,KAAK,CAAGN,WAAW,CAACC,eAAe,CAACM,KAAK,CAAE,CAAC,CAAC,CAAE,CAAC,CAAC,CAAE,CAACL,YAAY,CAAE,CAAC,CAAC,CAAC,CAC3E,MAAO,CACLM,MAAM,CAAER,WAAW,CACjBC,eAAe,CAACM,KAAK,CACrB,CAAC,CAAC,CAAE,CAAC,CAAC,CACN,CAACJ,sBAAsB,CAAEC,cAAc,CACzC,CAAC,CACDK,UAAU,CAAEH,KAAK,CACjBI,WAAW,CAAEJ,KACf,CAAC,CACH\",\"ignoreList\":[]}"
222
+ };
223
+ const _worklet_8468015130326_init_data = {
224
+ code: "function TabBarTsx7(){const{count,pillIndex}=this.__closure;return{width:100/count+\"%\",left:pillIndex.value*100/count+\"%\"};}",
134
225
  location: "/home/runner/work/lumen/lumen/libs/ui-rnative/src/lib/Components/core/TabBar/TabBar.tsx",
135
- sourceMap: "{\"version\":3,\"names\":[\"TabBarTsx4\",\"pillProgress\",\"itemWidth\",\"itemHeight\",\"PILL_INSET\",\"__closure\",\"transform\",\"translateX\",\"value\",\"width\",\"height\"],\"sources\":[\"/home/runner/work/lumen/lumen/libs/ui-rnative/src/lib/Components/core/TabBar/TabBar.tsx\"],\"mappings\":\"AA0JI,SAAAA,WAAA,QAAAC,YAAA,CAAAC,SAAA,CAAAC,UAAA,CAAAC,UAAA,OAAAC,SAAA,OAAO,CACLC,SAAS,CAAE,CAAC,CAAEC,UAAU,CAAEN,YAAY,CAACO,KAAM,CAAC,CAAC,CAC/CC,KAAK,CAAEP,SAAS,CAACM,KAAK,CACtBE,MAAM,CAAEP,UAAU,CAACK,KAAK,CAAGJ,UAAU,CAAG,CAC1C,CAAC\",\"ignoreList\":[]}"
226
+ sourceMap: "{\"version\":3,\"names\":[\"TabBarTsx7\",\"count\",\"pillIndex\",\"__closure\",\"width\",\"left\",\"value\"],\"sources\":[\"/home/runner/work/lumen/lumen/libs/ui-rnative/src/lib/Components/core/TabBar/TabBar.tsx\"],\"mappings\":\"AAkOI,SAAAA,WAAA,QAAAC,KAAA,CAAAC,SAAA,OAAAC,SAAA,OAAO,CACLC,KAAK,CAAK,GAAG,CAAGH,KAAK,IAAG,CACxBI,IAAI,CAAMH,SAAS,CAACI,KAAK,CAAG,GAAG,CAAIL,KAAK,IAC1C,CAAC\",\"ignoreList\":[]}"
136
227
  };
137
- const useTabBarPillLayout = ({
228
+ const useTabBarAnimations = ({
138
229
  active,
230
+ density,
139
231
  children
140
232
  }) => {
141
- const pillProgress = useSharedValue(0);
142
- const itemWidth = useSharedValue(0);
143
- const itemHeight = useSharedValue(0);
144
- const hasLayoutRef = useRef(false);
145
- const timingConfig = useTimingConfig({
233
+ const {
234
+ theme
235
+ } = useTheme();
236
+ const items = Children.toArray(children).filter(isValidElement);
237
+ const count = items.length;
238
+ const activeIndex = items.findIndex(item => item.props.value === active);
239
+ const isExpanded = density === 'expanded';
240
+ const pillIndex = useSharedValue(Math.max(activeIndex, 0));
241
+ const densityProgress = useSharedValue(isExpanded ? 1 : 0);
242
+ const labelOpacity = useSharedValue(isExpanded ? 1 : 0);
243
+ const pillTimingConfig = useTimingConfig({
146
244
  duration: 300,
147
245
  easing: 'easeInOut'
148
246
  });
149
- const activeIndex = useMemo(() => {
150
- return Children.toArray(children).findIndex(child => {
151
- if (/*#__PURE__*/isValidElement(child)) {
152
- return child.props.value === active;
153
- }
154
- return false;
155
- });
156
- }, [active, children]);
157
- const activeIndexRef = useRef(activeIndex);
158
- activeIndexRef.current = activeIndex;
159
- const onLayout = e => {
160
- const {
161
- width,
162
- height
163
- } = e.nativeEvent.layout;
164
- const count = Children.count(children);
165
- const slotWidth = (width - PILL_INSET * 2) / count;
166
- itemWidth.value = slotWidth;
167
- itemHeight.value = height;
168
- if (!hasLayoutRef.current) {
169
- hasLayoutRef.current = true;
170
- const index = activeIndexRef.current;
171
- if (index >= 0) {
172
- pillProgress.value = index * slotWidth;
173
- }
174
- }
175
- };
247
+ const densityTimingConfig = useTimingConfig({
248
+ duration: 300,
249
+ easing: 'easeOut'
250
+ });
251
+ const labelOutTimingConfig = useTimingConfig({
252
+ duration: 150,
253
+ easing: 'easeOut'
254
+ });
255
+ const labelInTimingConfig = useTimingConfig({
256
+ duration: 200,
257
+ easing: 'easeOut'
258
+ });
259
+ const labelInDelay = theme.motion.delays[75];
260
+ const compactInset = theme.spacings.s32;
261
+ const labelLineHeight = useLabelLineHeight();
262
+ const expandedHeight = TAB_BAR_EXPANDED_HEIGHT + Math.max(labelLineHeight.scaled - labelLineHeight.base, 0);
176
263
  useEffect(() => {
177
- if (!hasLayoutRef.current) return;
178
- if (activeIndex >= 0 && itemWidth.value > 0) {
179
- pillProgress.value = withTiming(activeIndex * itemWidth.value, timingConfig);
264
+ if (activeIndex >= 0) {
265
+ pillIndex.value = withTiming(activeIndex, pillTimingConfig);
180
266
  }
181
- }, [activeIndex, itemWidth, pillProgress, timingConfig]);
182
- useEffect(() => () => cancelAnimation(pillProgress), [pillProgress]);
183
- const animatedPillStyle = useAnimatedStyle(function TabBarTsx4Factory({
184
- _worklet_12147453282099_init_data,
185
- pillProgress,
186
- itemWidth,
187
- itemHeight,
188
- PILL_INSET
267
+ }, [activeIndex, pillIndex, pillTimingConfig]);
268
+ useEffect(() => {
269
+ densityProgress.value = withTiming(isExpanded ? 1 : 0, densityTimingConfig);
270
+ // Labels leave quickly, but only come back once the bar has started
271
+ // making room for them.
272
+ labelOpacity.value = isExpanded ? withDelay(labelInDelay, withTiming(1, labelInTimingConfig)) : withTiming(0, labelOutTimingConfig);
273
+ }, [isExpanded, densityProgress, labelOpacity, densityTimingConfig, labelInTimingConfig, labelOutTimingConfig, labelInDelay]);
274
+ useEffect(() => () => {
275
+ cancelAnimation(pillIndex);
276
+ cancelAnimation(densityProgress);
277
+ cancelAnimation(labelOpacity);
278
+ }, [pillIndex, densityProgress, labelOpacity]);
279
+ const barStyle = useAnimatedStyle(function TabBarTsx6Factory({
280
+ _worklet_8753718797100_init_data,
281
+ interpolate,
282
+ densityProgress,
283
+ compactInset,
284
+ TAB_BAR_COMPACT_HEIGHT,
285
+ expandedHeight
189
286
  }) {
190
- const _e = [new global.Error(), -5, -27];
191
- const TabBarTsx4 = () => ({
192
- transform: [{
193
- translateX: pillProgress.value
194
- }],
195
- width: itemWidth.value,
196
- height: itemHeight.value - PILL_INSET * 2
287
+ const _e = [new global.Error(), -6, -27];
288
+ const TabBarTsx6 = function () {
289
+ const inset = interpolate(densityProgress.value, [0, 1], [compactInset, 0]);
290
+ return {
291
+ height: interpolate(densityProgress.value, [0, 1], [TAB_BAR_COMPACT_HEIGHT, expandedHeight]),
292
+ marginLeft: inset,
293
+ marginRight: inset
294
+ };
295
+ };
296
+ TabBarTsx6.__closure = {
297
+ interpolate,
298
+ densityProgress,
299
+ compactInset,
300
+ TAB_BAR_COMPACT_HEIGHT,
301
+ expandedHeight
302
+ };
303
+ TabBarTsx6.__workletHash = 8753718797100;
304
+ TabBarTsx6.__pluginVersion = "0.10.1";
305
+ TabBarTsx6.__initData = _worklet_8753718797100_init_data;
306
+ TabBarTsx6.__stackDetails = _e;
307
+ return TabBarTsx6;
308
+ }({
309
+ _worklet_8753718797100_init_data,
310
+ interpolate,
311
+ densityProgress,
312
+ compactInset,
313
+ TAB_BAR_COMPACT_HEIGHT,
314
+ expandedHeight
315
+ }), [densityProgress, compactInset, expandedHeight]);
316
+ const pillStyle = useAnimatedStyle(function TabBarTsx7Factory({
317
+ _worklet_8468015130326_init_data,
318
+ count,
319
+ pillIndex
320
+ }) {
321
+ const _e = [new global.Error(), -3, -27];
322
+ const TabBarTsx7 = () => ({
323
+ width: `${100 / count}%`,
324
+ left: `${pillIndex.value * 100 / count}%`
197
325
  });
198
- TabBarTsx4.__closure = {
199
- pillProgress,
200
- itemWidth,
201
- itemHeight,
202
- PILL_INSET
326
+ TabBarTsx7.__closure = {
327
+ count,
328
+ pillIndex
203
329
  };
204
- TabBarTsx4.__workletHash = 12147453282099;
205
- TabBarTsx4.__pluginVersion = "0.10.1";
206
- TabBarTsx4.__initData = _worklet_12147453282099_init_data;
207
- TabBarTsx4.__stackDetails = _e;
208
- return TabBarTsx4;
330
+ TabBarTsx7.__workletHash = 8468015130326;
331
+ TabBarTsx7.__pluginVersion = "0.10.1";
332
+ TabBarTsx7.__initData = _worklet_8468015130326_init_data;
333
+ TabBarTsx7.__stackDetails = _e;
334
+ return TabBarTsx7;
209
335
  }({
210
- _worklet_12147453282099_init_data,
211
- pillProgress,
212
- itemWidth,
213
- itemHeight,
214
- PILL_INSET
215
- }), [pillProgress, itemWidth, itemHeight]);
336
+ _worklet_8468015130326_init_data,
337
+ count,
338
+ pillIndex
339
+ }), [pillIndex, count]);
216
340
  return {
217
- onLayout,
218
- animatedPillStyle
341
+ densityProgress,
342
+ labelOpacity,
343
+ barStyle,
344
+ pillStyle
219
345
  };
220
346
  };
221
347
  export function TabBarItem({
@@ -227,9 +353,12 @@ export function TabBarItem({
227
353
  ...props
228
354
  }) {
229
355
  const styles = useStyles();
356
+ const labelLineHeight = useLabelLineHeight();
230
357
  const {
231
358
  active,
232
- onTabPress
359
+ onTabPress,
360
+ densityProgress,
361
+ labelOpacity
233
362
  } = useTabBarContext();
234
363
  const isActive = active === value;
235
364
  const Icon = icon ?? Placeholder;
@@ -239,14 +368,19 @@ export function TabBarItem({
239
368
  onPressOut,
240
369
  scaleStyle,
241
370
  activeIconStyle,
242
- inactiveIconStyle
371
+ inactiveIconStyle,
372
+ contentStyle,
373
+ labelStyle
243
374
  } = useTabBarItemAnimations({
244
- isActive
375
+ isActive,
376
+ densityProgress,
377
+ labelOpacity,
378
+ iconShift: label ? (ICON_LABEL_GAP + labelLineHeight.scaled) / 2 : 0
245
379
  });
246
380
  function onPress() {
247
381
  onTabPress(value);
248
382
  }
249
- return /*#__PURE__*/_jsxs(Pressable, {
383
+ return /*#__PURE__*/_jsx(Pressable, {
250
384
  style: StyleSheet.flatten([styles.item, style]),
251
385
  onPress: onPress,
252
386
  onPressIn: onPressIn,
@@ -257,27 +391,33 @@ export function TabBarItem({
257
391
  selected: isActive
258
392
  },
259
393
  ...props,
260
- children: [/*#__PURE__*/_jsx(Animated.View, {
261
- style: scaleStyle,
262
- children: /*#__PURE__*/_jsxs(Box, {
263
- style: styles.itemIconContainer,
264
- children: [/*#__PURE__*/_jsx(Animated.View, {
265
- style: [styles.itemIcon, inactiveIconStyle],
266
- children: /*#__PURE__*/_jsx(Icon, {
267
- size: 20
268
- })
269
- }), /*#__PURE__*/_jsx(Animated.View, {
270
- style: [styles.itemIcon, activeIconStyle],
271
- children: /*#__PURE__*/_jsx(ActiveIcon, {
272
- size: 20
273
- })
274
- })]
275
- })
276
- }), label && /*#__PURE__*/_jsx(Text, {
277
- style: [styles.itemText, isActive && styles.activeItemText],
278
- numberOfLines: 1,
279
- children: label
280
- })]
394
+ children: /*#__PURE__*/_jsxs(Animated.View, {
395
+ style: [styles.itemContent, contentStyle],
396
+ children: [/*#__PURE__*/_jsx(Animated.View, {
397
+ style: scaleStyle,
398
+ children: /*#__PURE__*/_jsxs(Box, {
399
+ style: styles.itemIconContainer,
400
+ children: [/*#__PURE__*/_jsx(Animated.View, {
401
+ style: [styles.itemIcon, inactiveIconStyle],
402
+ children: /*#__PURE__*/_jsx(Icon, {
403
+ size: ICON_SIZE
404
+ })
405
+ }), /*#__PURE__*/_jsx(Animated.View, {
406
+ style: [styles.itemIcon, activeIconStyle],
407
+ children: /*#__PURE__*/_jsx(ActiveIcon, {
408
+ size: ICON_SIZE
409
+ })
410
+ })]
411
+ })
412
+ }), label && /*#__PURE__*/_jsx(Animated.View, {
413
+ style: [styles.itemLabel, labelStyle],
414
+ children: /*#__PURE__*/_jsx(Text, {
415
+ style: [styles.itemText, isActive && styles.activeItemText],
416
+ numberOfLines: 1,
417
+ children: label
418
+ })
419
+ })]
420
+ })
281
421
  });
282
422
  }
283
423
 
@@ -302,6 +442,7 @@ export function TabBarItem({
302
442
  export function TabBar({
303
443
  active,
304
444
  onTabPress,
445
+ density = 'expanded',
305
446
  children,
306
447
  ...props
307
448
  }) {
@@ -311,39 +452,47 @@ export function TabBar({
311
452
  colorScheme
312
453
  } = useTheme();
313
454
  const {
314
- onLayout,
315
- animatedPillStyle
316
- } = useTabBarPillLayout({
455
+ densityProgress,
456
+ labelOpacity,
457
+ barStyle,
458
+ pillStyle
459
+ } = useTabBarAnimations({
317
460
  active,
461
+ density,
318
462
  children
319
463
  });
320
464
  return /*#__PURE__*/_jsx(TabBarContextProvider, {
321
465
  value: {
322
466
  active,
323
- onTabPress: value => onTabPress(value)
467
+ onTabPress: value => onTabPress(value),
468
+ densityProgress,
469
+ labelOpacity
324
470
  },
325
- children: /*#__PURE__*/_jsxs(Box, {
326
- style: styles.container,
327
- onLayout: onLayout,
471
+ children: /*#__PURE__*/_jsx(Box, {
328
472
  accessibilityRole: "tablist",
329
473
  ...props,
330
- children: [children, RuntimeConstants.isAndroid ? /*#__PURE__*/_jsx(View, {
331
- style: styles.fallbackBackground
332
- }) : /*#__PURE__*/_jsx(BlurView, {
333
- style: styles.blur,
334
- blurAmount: theme.blur.lg,
335
- blurType: colorScheme === 'dark' ? 'dark' : 'light',
336
- overlayColor: colorScheme === 'dark' ? 'rgba(0,0,0,0.15)' : 'rgba(255,255,255,0.2)',
337
- reducedTransparencyFallbackColor: styles.fallbackBackground.backgroundColor
338
- }), /*#__PURE__*/_jsx(Animated.View, {
339
- style: [styles.pill, animatedPillStyle]
340
- })]
474
+ children: /*#__PURE__*/_jsxs(Animated.View, {
475
+ style: [styles.container, barStyle],
476
+ children: [children, RuntimeConstants.isAndroid ? /*#__PURE__*/_jsx(View, {
477
+ style: styles.fallbackBackground
478
+ }) : /*#__PURE__*/_jsx(BlurView, {
479
+ style: styles.blur,
480
+ blurAmount: theme.blur.lg,
481
+ blurType: colorScheme === 'dark' ? 'dark' : 'light',
482
+ overlayColor: colorScheme === 'dark' ? 'rgba(0,0,0,0.15)' : 'rgba(255,255,255,0.2)',
483
+ reducedTransparencyFallbackColor: styles.fallbackBackground.backgroundColor
484
+ }), /*#__PURE__*/_jsx(View, {
485
+ style: styles.pillTrack,
486
+ children: /*#__PURE__*/_jsx(Animated.View, {
487
+ style: [styles.pill, pillStyle]
488
+ })
489
+ })]
490
+ })
341
491
  })
342
492
  });
343
493
  }
344
494
  const useStyles = () => useStyleSheet(t => ({
345
495
  container: {
346
- minHeight: TAB_BAR_HEIGHT,
347
496
  flexDirection: 'row',
348
497
  justifyContent: 'center',
349
498
  padding: t.spacings.s4,
@@ -371,32 +520,48 @@ const useStyles = () => useStyleSheet(t => ({
371
520
  },
372
521
  item: {
373
522
  flex: 1,
374
- paddingVertical: t.spacings.s4,
375
- alignItems: 'center',
376
- justifyContent: 'center',
377
- gap: t.spacings.s2
523
+ alignSelf: 'stretch',
524
+ marginVertical: -t.spacings.s4,
525
+ justifyContent: 'center'
526
+ },
527
+ itemContent: {
528
+ alignItems: 'center'
529
+ },
530
+ itemLabel: {
531
+ position: 'absolute',
532
+ top: ICON_SIZE + ICON_LABEL_GAP,
533
+ left: 0,
534
+ right: 0,
535
+ alignItems: 'center'
378
536
  },
379
537
  itemText: {
380
538
  ...t.typographies.body4,
381
- paddingHorizontal: t.spacings.s12,
539
+ paddingHorizontal: t.spacings.s8,
382
540
  color: t.colors.text.base
383
541
  },
384
542
  itemIcon: {
385
543
  position: 'absolute'
386
544
  },
387
545
  itemIconContainer: {
388
- width: 20,
389
- height: 20,
546
+ width: ICON_SIZE,
547
+ height: ICON_SIZE,
390
548
  position: 'relative'
391
549
  },
392
550
  activeItemText: {
393
551
  ...t.typographies.body4SemiBold
394
552
  },
395
- pill: {
553
+ pillTrack: {
396
554
  position: 'absolute',
397
555
  pointerEvents: 'none',
398
556
  top: PILL_INSET,
557
+ bottom: PILL_INSET,
399
558
  left: PILL_INSET,
559
+ right: PILL_INSET
560
+ },
561
+ pill: {
562
+ position: 'absolute',
563
+ top: 0,
564
+ bottom: 0,
400
565
  borderRadius: t.borderRadius.full,
401
566
  backgroundColor: t.colors.bg.mutedTransparent
402
567
  }