@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.
- package/dist/module/lib/Components/core/DotSymbol/DotSymbol.js +1 -1
- package/dist/module/lib/Components/core/Spot/Spot.js +1 -1
- package/dist/module/lib/Components/core/TabBar/TabBar.js +298 -133
- package/dist/module/lib/Components/core/TabBar/TabBar.js.map +1 -1
- package/dist/module/lib/Components/core/TabBar/TabBarContext.js.map +1 -1
- package/dist/module/lib/Components/internal/BaseTag/BaseTag.js.map +1 -1
- package/dist/module/lib/Components/symbols/icons/BadgeVerified.js +49 -0
- package/dist/module/lib/Components/symbols/icons/BadgeVerified.js.map +1 -0
- package/dist/module/lib/Components/symbols/icons/BadgeVerifiedFill.js +47 -0
- package/dist/module/lib/Components/symbols/icons/BadgeVerifiedFill.js.map +1 -0
- package/dist/module/lib/Components/symbols/icons/Building.js +49 -0
- package/dist/module/lib/Components/symbols/icons/Building.js.map +1 -0
- package/dist/module/lib/Components/symbols/icons/Play.js +48 -0
- package/dist/module/lib/Components/symbols/icons/Play.js.map +1 -0
- package/dist/module/lib/Components/symbols/icons/Sort.js +49 -0
- package/dist/module/lib/Components/symbols/icons/Sort.js.map +1 -0
- package/dist/module/lib/Components/symbols/icons/TextEdit.js +49 -0
- package/dist/module/lib/Components/symbols/icons/TextEdit.js.map +1 -0
- package/dist/module/lib/Components/symbols/index.js +6 -0
- package/dist/module/lib/Components/symbols/index.js.map +1 -1
- package/dist/typescript/src/lib/Components/core/TabBar/TabBar.d.ts +3 -2
- package/dist/typescript/src/lib/Components/core/TabBar/TabBar.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/core/TabBar/TabBarContext.d.ts +3 -0
- package/dist/typescript/src/lib/Components/core/TabBar/TabBarContext.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/core/TabBar/types.d.ts +8 -0
- package/dist/typescript/src/lib/Components/core/TabBar/types.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/core/Tag/types.d.ts +3 -22
- package/dist/typescript/src/lib/Components/core/Tag/types.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/internal/BaseTag/BaseTag.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/internal/BaseTag/types.d.ts +23 -2
- package/dist/typescript/src/lib/Components/internal/BaseTag/types.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/symbols/icons/BadgeVerified.d.ts +35 -0
- package/dist/typescript/src/lib/Components/symbols/icons/BadgeVerified.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/symbols/icons/BadgeVerifiedFill.d.ts +35 -0
- package/dist/typescript/src/lib/Components/symbols/icons/BadgeVerifiedFill.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/symbols/icons/Building.d.ts +35 -0
- package/dist/typescript/src/lib/Components/symbols/icons/Building.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/symbols/icons/Play.d.ts +35 -0
- package/dist/typescript/src/lib/Components/symbols/icons/Play.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/symbols/icons/Sort.d.ts +35 -0
- package/dist/typescript/src/lib/Components/symbols/icons/Sort.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/symbols/icons/TextEdit.d.ts +35 -0
- package/dist/typescript/src/lib/Components/symbols/icons/TextEdit.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/symbols/index.d.ts +6 -0
- package/dist/typescript/src/lib/Components/symbols/index.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/lib/Components/core/DotSymbol/DotSymbol.tsx +1 -1
- package/src/lib/Components/core/Spot/Spot.tsx +1 -1
- package/src/lib/Components/core/TabBar/TabBar.tsx +212 -109
- package/src/lib/Components/core/TabBar/TabBarContext.tsx +3 -0
- package/src/lib/Components/core/TabBar/types.ts +9 -0
- package/src/lib/Components/core/Tag/types.ts +3 -30
- package/src/lib/Components/internal/BaseTag/BaseTag.tsx +2 -3
- package/src/lib/Components/internal/BaseTag/types.ts +32 -2
- package/src/lib/Components/symbols/icons/BadgeVerified.tsx +44 -0
- package/src/lib/Components/symbols/icons/BadgeVerifiedFill.tsx +42 -0
- package/src/lib/Components/symbols/icons/Building.tsx +44 -0
- package/src/lib/Components/symbols/icons/Play.tsx +43 -0
- package/src/lib/Components/symbols/icons/Sort.tsx +44 -0
- package/src/lib/Components/symbols/icons/TextEdit.tsx +44 -0
- package/src/lib/Components/symbols/index.ts +6 -0
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { BlurView } from '@sbaiahmed1/react-native-blur';
|
|
2
2
|
import type { ReactElement, ReactNode } from 'react';
|
|
3
|
-
import { Children, isValidElement, useEffect
|
|
4
|
-
import
|
|
5
|
-
import { StyleSheet, Text, View } from 'react-native';
|
|
3
|
+
import { Children, isValidElement, useEffect } from 'react';
|
|
4
|
+
import { StyleSheet, Text, useWindowDimensions, View } from 'react-native';
|
|
6
5
|
import Animated, {
|
|
7
6
|
cancelAnimation,
|
|
7
|
+
interpolate,
|
|
8
8
|
useAnimatedStyle,
|
|
9
9
|
useSharedValue,
|
|
10
10
|
withDelay,
|
|
11
11
|
withSequence,
|
|
12
12
|
withTiming,
|
|
13
13
|
} from 'react-native-reanimated';
|
|
14
|
+
import type { SharedValue } from 'react-native-reanimated';
|
|
14
15
|
import { useStyleSheet, useTheme } from '../../../../styles';
|
|
15
16
|
import { triggerHapticFeedback } from '../../../Haptics';
|
|
16
17
|
import { RuntimeConstants } from '../../../utils';
|
|
@@ -20,10 +21,30 @@ import { Placeholder } from '../../symbols';
|
|
|
20
21
|
import { TabBarContextProvider, useTabBarContext } from './TabBarContext';
|
|
21
22
|
import type { TabBarItemProps, TabBarProps, TabBarValue } from './types';
|
|
22
23
|
|
|
23
|
-
export const
|
|
24
|
+
export const TAB_BAR_EXPANDED_HEIGHT = 60;
|
|
25
|
+
export const TAB_BAR_COMPACT_HEIGHT = 44;
|
|
24
26
|
const PILL_INSET = 4;
|
|
27
|
+
const ICON_SIZE = 20;
|
|
28
|
+
const ICON_LABEL_GAP = 4;
|
|
29
|
+
|
|
30
|
+
const useLabelLineHeight = (): { base: number; scaled: number } => {
|
|
31
|
+
const { theme } = useTheme();
|
|
32
|
+
const { fontScale } = useWindowDimensions();
|
|
33
|
+
const base = theme.typographies.body4.lineHeight ?? 0;
|
|
34
|
+
return { base, scaled: base * fontScale };
|
|
35
|
+
};
|
|
25
36
|
|
|
26
|
-
const useTabBarItemAnimations = ({
|
|
37
|
+
const useTabBarItemAnimations = ({
|
|
38
|
+
isActive,
|
|
39
|
+
densityProgress,
|
|
40
|
+
labelOpacity,
|
|
41
|
+
iconShift,
|
|
42
|
+
}: {
|
|
43
|
+
isActive: boolean;
|
|
44
|
+
densityProgress: SharedValue<number>;
|
|
45
|
+
labelOpacity: SharedValue<number>;
|
|
46
|
+
iconShift: number;
|
|
47
|
+
}) => {
|
|
27
48
|
const activeProgress = useSharedValue(isActive ? 1 : 0);
|
|
28
49
|
const pressProgress = useSharedValue(1);
|
|
29
50
|
|
|
@@ -84,83 +105,133 @@ const useTabBarItemAnimations = ({ isActive }: { isActive: boolean }) => {
|
|
|
84
105
|
[activeProgress],
|
|
85
106
|
);
|
|
86
107
|
|
|
108
|
+
const contentStyle = useAnimatedStyle(
|
|
109
|
+
() => ({
|
|
110
|
+
transform: [{ translateY: -iconShift * densityProgress.value }],
|
|
111
|
+
}),
|
|
112
|
+
[densityProgress, iconShift],
|
|
113
|
+
);
|
|
114
|
+
|
|
115
|
+
const labelStyle = useAnimatedStyle(
|
|
116
|
+
() => ({
|
|
117
|
+
opacity: labelOpacity.value,
|
|
118
|
+
// Closes the icon/label gap as the bar collapses.
|
|
119
|
+
transform: [
|
|
120
|
+
{ translateY: -ICON_LABEL_GAP * (1 - densityProgress.value) },
|
|
121
|
+
],
|
|
122
|
+
}),
|
|
123
|
+
[labelOpacity, densityProgress],
|
|
124
|
+
);
|
|
125
|
+
|
|
87
126
|
return {
|
|
88
127
|
onPressIn,
|
|
89
128
|
onPressOut,
|
|
90
129
|
scaleStyle,
|
|
91
130
|
activeIconStyle,
|
|
92
131
|
inactiveIconStyle,
|
|
132
|
+
contentStyle,
|
|
133
|
+
labelStyle,
|
|
93
134
|
};
|
|
94
135
|
};
|
|
95
136
|
|
|
96
|
-
const
|
|
137
|
+
const useTabBarAnimations = ({
|
|
97
138
|
active,
|
|
139
|
+
density,
|
|
98
140
|
children,
|
|
99
141
|
}: {
|
|
100
142
|
active: string;
|
|
143
|
+
density: TabBarProps['density'];
|
|
101
144
|
children: ReactNode;
|
|
102
145
|
}) => {
|
|
103
|
-
const
|
|
104
|
-
const
|
|
105
|
-
|
|
106
|
-
|
|
146
|
+
const { theme } = useTheme();
|
|
147
|
+
const items = Children.toArray(children).filter(
|
|
148
|
+
isValidElement<TabBarItemProps>,
|
|
149
|
+
);
|
|
150
|
+
const count = items.length;
|
|
151
|
+
const activeIndex = items.findIndex((item) => item.props.value === active);
|
|
152
|
+
|
|
153
|
+
const isExpanded = density === 'expanded';
|
|
154
|
+
const pillIndex = useSharedValue(Math.max(activeIndex, 0));
|
|
155
|
+
const densityProgress = useSharedValue(isExpanded ? 1 : 0);
|
|
156
|
+
const labelOpacity = useSharedValue(isExpanded ? 1 : 0);
|
|
107
157
|
|
|
108
|
-
const
|
|
158
|
+
const pillTimingConfig = useTimingConfig({
|
|
109
159
|
duration: 300,
|
|
110
160
|
easing: 'easeInOut',
|
|
111
161
|
});
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
const
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
itemWidth.value = slotWidth;
|
|
131
|
-
itemHeight.value = height;
|
|
132
|
-
|
|
133
|
-
if (!hasLayoutRef.current) {
|
|
134
|
-
hasLayoutRef.current = true;
|
|
135
|
-
const index = activeIndexRef.current;
|
|
136
|
-
if (index >= 0) {
|
|
137
|
-
pillProgress.value = index * slotWidth;
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
};
|
|
162
|
+
const densityTimingConfig = useTimingConfig({
|
|
163
|
+
duration: 300,
|
|
164
|
+
easing: 'easeOut',
|
|
165
|
+
});
|
|
166
|
+
const labelOutTimingConfig = useTimingConfig({
|
|
167
|
+
duration: 150,
|
|
168
|
+
easing: 'easeOut',
|
|
169
|
+
});
|
|
170
|
+
const labelInTimingConfig = useTimingConfig({
|
|
171
|
+
duration: 200,
|
|
172
|
+
easing: 'easeOut',
|
|
173
|
+
});
|
|
174
|
+
const labelInDelay = theme.motion.delays[75];
|
|
175
|
+
const compactInset = theme.spacings.s32;
|
|
176
|
+
const labelLineHeight = useLabelLineHeight();
|
|
177
|
+
const expandedHeight =
|
|
178
|
+
TAB_BAR_EXPANDED_HEIGHT +
|
|
179
|
+
Math.max(labelLineHeight.scaled - labelLineHeight.base, 0);
|
|
141
180
|
|
|
142
181
|
useEffect(() => {
|
|
143
|
-
if (
|
|
144
|
-
|
|
145
|
-
pillProgress.value = withTiming(
|
|
146
|
-
activeIndex * itemWidth.value,
|
|
147
|
-
timingConfig,
|
|
148
|
-
);
|
|
182
|
+
if (activeIndex >= 0) {
|
|
183
|
+
pillIndex.value = withTiming(activeIndex, pillTimingConfig);
|
|
149
184
|
}
|
|
150
|
-
}, [activeIndex,
|
|
185
|
+
}, [activeIndex, pillIndex, pillTimingConfig]);
|
|
151
186
|
|
|
152
|
-
useEffect(() =>
|
|
187
|
+
useEffect(() => {
|
|
188
|
+
densityProgress.value = withTiming(isExpanded ? 1 : 0, densityTimingConfig);
|
|
189
|
+
// Labels leave quickly, but only come back once the bar has started
|
|
190
|
+
// making room for them.
|
|
191
|
+
labelOpacity.value = isExpanded
|
|
192
|
+
? withDelay(labelInDelay, withTiming(1, labelInTimingConfig))
|
|
193
|
+
: withTiming(0, labelOutTimingConfig);
|
|
194
|
+
}, [
|
|
195
|
+
isExpanded,
|
|
196
|
+
densityProgress,
|
|
197
|
+
labelOpacity,
|
|
198
|
+
densityTimingConfig,
|
|
199
|
+
labelInTimingConfig,
|
|
200
|
+
labelOutTimingConfig,
|
|
201
|
+
labelInDelay,
|
|
202
|
+
]);
|
|
203
|
+
|
|
204
|
+
useEffect(
|
|
205
|
+
() => () => {
|
|
206
|
+
cancelAnimation(pillIndex);
|
|
207
|
+
cancelAnimation(densityProgress);
|
|
208
|
+
cancelAnimation(labelOpacity);
|
|
209
|
+
},
|
|
210
|
+
[pillIndex, densityProgress, labelOpacity],
|
|
211
|
+
);
|
|
153
212
|
|
|
154
|
-
const
|
|
213
|
+
const barStyle = useAnimatedStyle(() => {
|
|
214
|
+
const inset = interpolate(densityProgress.value, [0, 1], [compactInset, 0]);
|
|
215
|
+
return {
|
|
216
|
+
height: interpolate(
|
|
217
|
+
densityProgress.value,
|
|
218
|
+
[0, 1],
|
|
219
|
+
[TAB_BAR_COMPACT_HEIGHT, expandedHeight],
|
|
220
|
+
),
|
|
221
|
+
marginLeft: inset,
|
|
222
|
+
marginRight: inset,
|
|
223
|
+
};
|
|
224
|
+
}, [densityProgress, compactInset, expandedHeight]);
|
|
225
|
+
|
|
226
|
+
const pillStyle = useAnimatedStyle(
|
|
155
227
|
() => ({
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
height: itemHeight.value - PILL_INSET * 2,
|
|
228
|
+
width: `${100 / count}%`,
|
|
229
|
+
left: `${(pillIndex.value * 100) / count}%`,
|
|
159
230
|
}),
|
|
160
|
-
[
|
|
231
|
+
[pillIndex, count],
|
|
161
232
|
);
|
|
162
233
|
|
|
163
|
-
return {
|
|
234
|
+
return { densityProgress, labelOpacity, barStyle, pillStyle };
|
|
164
235
|
};
|
|
165
236
|
|
|
166
237
|
export function TabBarItem({
|
|
@@ -172,7 +243,9 @@ export function TabBarItem({
|
|
|
172
243
|
...props
|
|
173
244
|
}: TabBarItemProps) {
|
|
174
245
|
const styles = useStyles();
|
|
175
|
-
const
|
|
246
|
+
const labelLineHeight = useLabelLineHeight();
|
|
247
|
+
const { active, onTabPress, densityProgress, labelOpacity } =
|
|
248
|
+
useTabBarContext();
|
|
176
249
|
|
|
177
250
|
const isActive = active === value;
|
|
178
251
|
const Icon = icon ?? Placeholder;
|
|
@@ -184,7 +257,14 @@ export function TabBarItem({
|
|
|
184
257
|
scaleStyle,
|
|
185
258
|
activeIconStyle,
|
|
186
259
|
inactiveIconStyle,
|
|
187
|
-
|
|
260
|
+
contentStyle,
|
|
261
|
+
labelStyle,
|
|
262
|
+
} = useTabBarItemAnimations({
|
|
263
|
+
isActive,
|
|
264
|
+
densityProgress,
|
|
265
|
+
labelOpacity,
|
|
266
|
+
iconShift: label ? (ICON_LABEL_GAP + labelLineHeight.scaled) / 2 : 0,
|
|
267
|
+
});
|
|
188
268
|
|
|
189
269
|
function onPress() {
|
|
190
270
|
onTabPress(value);
|
|
@@ -201,24 +281,28 @@ export function TabBarItem({
|
|
|
201
281
|
accessibilityState={{ selected: isActive }}
|
|
202
282
|
{...props}
|
|
203
283
|
>
|
|
204
|
-
<Animated.View style={
|
|
205
|
-
<
|
|
206
|
-
<
|
|
207
|
-
<
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
<
|
|
284
|
+
<Animated.View style={[styles.itemContent, contentStyle]}>
|
|
285
|
+
<Animated.View style={scaleStyle}>
|
|
286
|
+
<Box style={styles.itemIconContainer}>
|
|
287
|
+
<Animated.View style={[styles.itemIcon, inactiveIconStyle]}>
|
|
288
|
+
<Icon size={ICON_SIZE} />
|
|
289
|
+
</Animated.View>
|
|
290
|
+
<Animated.View style={[styles.itemIcon, activeIconStyle]}>
|
|
291
|
+
<ActiveIcon size={ICON_SIZE} />
|
|
292
|
+
</Animated.View>
|
|
293
|
+
</Box>
|
|
294
|
+
</Animated.View>
|
|
295
|
+
{label && (
|
|
296
|
+
<Animated.View style={[styles.itemLabel, labelStyle]}>
|
|
297
|
+
<Text
|
|
298
|
+
style={[styles.itemText, isActive && styles.activeItemText]}
|
|
299
|
+
numberOfLines={1}
|
|
300
|
+
>
|
|
301
|
+
{label}
|
|
302
|
+
</Text>
|
|
211
303
|
</Animated.View>
|
|
212
|
-
|
|
304
|
+
)}
|
|
213
305
|
</Animated.View>
|
|
214
|
-
{label && (
|
|
215
|
-
<Text
|
|
216
|
-
style={[styles.itemText, isActive && styles.activeItemText]}
|
|
217
|
-
numberOfLines={1}
|
|
218
|
-
>
|
|
219
|
-
{label}
|
|
220
|
-
</Text>
|
|
221
|
-
)}
|
|
222
306
|
</Pressable>
|
|
223
307
|
);
|
|
224
308
|
}
|
|
@@ -244,49 +328,53 @@ export function TabBarItem({
|
|
|
244
328
|
export function TabBar<T extends TabBarValue = TabBarValue>({
|
|
245
329
|
active,
|
|
246
330
|
onTabPress,
|
|
331
|
+
density = 'expanded',
|
|
247
332
|
children,
|
|
248
333
|
...props
|
|
249
334
|
}: TabBarProps<T>) {
|
|
250
335
|
const styles = useStyles();
|
|
251
336
|
const { theme, colorScheme } = useTheme();
|
|
252
337
|
|
|
253
|
-
const {
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
338
|
+
const { densityProgress, labelOpacity, barStyle, pillStyle } =
|
|
339
|
+
useTabBarAnimations({
|
|
340
|
+
active,
|
|
341
|
+
density,
|
|
342
|
+
children,
|
|
343
|
+
});
|
|
257
344
|
|
|
258
345
|
return (
|
|
259
346
|
<TabBarContextProvider
|
|
260
347
|
value={{
|
|
261
348
|
active,
|
|
262
349
|
onTabPress: (value) => onTabPress(value as T),
|
|
350
|
+
densityProgress,
|
|
351
|
+
labelOpacity,
|
|
263
352
|
}}
|
|
264
353
|
>
|
|
265
|
-
<Box
|
|
266
|
-
style={styles.container}
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
<Animated.View style={[styles.pill, animatedPillStyle]} />
|
|
354
|
+
<Box accessibilityRole='tablist' {...props}>
|
|
355
|
+
<Animated.View style={[styles.container, barStyle]}>
|
|
356
|
+
{children}
|
|
357
|
+
{RuntimeConstants.isAndroid ? (
|
|
358
|
+
<View style={styles.fallbackBackground} />
|
|
359
|
+
) : (
|
|
360
|
+
<BlurView
|
|
361
|
+
style={styles.blur}
|
|
362
|
+
blurAmount={theme.blur.lg}
|
|
363
|
+
blurType={colorScheme === 'dark' ? 'dark' : 'light'}
|
|
364
|
+
overlayColor={
|
|
365
|
+
colorScheme === 'dark'
|
|
366
|
+
? 'rgba(0,0,0,0.15)'
|
|
367
|
+
: 'rgba(255,255,255,0.2)'
|
|
368
|
+
}
|
|
369
|
+
reducedTransparencyFallbackColor={
|
|
370
|
+
styles.fallbackBackground.backgroundColor
|
|
371
|
+
}
|
|
372
|
+
/>
|
|
373
|
+
)}
|
|
374
|
+
<View style={styles.pillTrack}>
|
|
375
|
+
<Animated.View style={[styles.pill, pillStyle]} />
|
|
376
|
+
</View>
|
|
377
|
+
</Animated.View>
|
|
290
378
|
</Box>
|
|
291
379
|
</TabBarContextProvider>
|
|
292
380
|
);
|
|
@@ -296,7 +384,6 @@ const useStyles = () =>
|
|
|
296
384
|
useStyleSheet(
|
|
297
385
|
(t) => ({
|
|
298
386
|
container: {
|
|
299
|
-
minHeight: TAB_BAR_HEIGHT,
|
|
300
387
|
flexDirection: 'row',
|
|
301
388
|
justifyContent: 'center',
|
|
302
389
|
padding: t.spacings.s4,
|
|
@@ -324,32 +411,48 @@ const useStyles = () =>
|
|
|
324
411
|
},
|
|
325
412
|
item: {
|
|
326
413
|
flex: 1,
|
|
327
|
-
|
|
328
|
-
|
|
414
|
+
alignSelf: 'stretch',
|
|
415
|
+
marginVertical: -t.spacings.s4,
|
|
329
416
|
justifyContent: 'center',
|
|
330
|
-
|
|
417
|
+
},
|
|
418
|
+
itemContent: {
|
|
419
|
+
alignItems: 'center',
|
|
420
|
+
},
|
|
421
|
+
itemLabel: {
|
|
422
|
+
position: 'absolute',
|
|
423
|
+
top: ICON_SIZE + ICON_LABEL_GAP,
|
|
424
|
+
left: 0,
|
|
425
|
+
right: 0,
|
|
426
|
+
alignItems: 'center',
|
|
331
427
|
},
|
|
332
428
|
itemText: {
|
|
333
429
|
...t.typographies.body4,
|
|
334
|
-
paddingHorizontal: t.spacings.
|
|
430
|
+
paddingHorizontal: t.spacings.s8,
|
|
335
431
|
color: t.colors.text.base,
|
|
336
432
|
},
|
|
337
433
|
itemIcon: {
|
|
338
434
|
position: 'absolute',
|
|
339
435
|
},
|
|
340
436
|
itemIconContainer: {
|
|
341
|
-
width:
|
|
342
|
-
height:
|
|
437
|
+
width: ICON_SIZE,
|
|
438
|
+
height: ICON_SIZE,
|
|
343
439
|
position: 'relative',
|
|
344
440
|
},
|
|
345
441
|
activeItemText: {
|
|
346
442
|
...t.typographies.body4SemiBold,
|
|
347
443
|
},
|
|
348
|
-
|
|
444
|
+
pillTrack: {
|
|
349
445
|
position: 'absolute',
|
|
350
446
|
pointerEvents: 'none',
|
|
351
447
|
top: PILL_INSET,
|
|
448
|
+
bottom: PILL_INSET,
|
|
352
449
|
left: PILL_INSET,
|
|
450
|
+
right: PILL_INSET,
|
|
451
|
+
},
|
|
452
|
+
pill: {
|
|
453
|
+
position: 'absolute',
|
|
454
|
+
top: 0,
|
|
455
|
+
bottom: 0,
|
|
353
456
|
borderRadius: t.borderRadius.full,
|
|
354
457
|
backgroundColor: t.colors.bg.mutedTransparent,
|
|
355
458
|
},
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { createSafeContext } from '@ledgerhq/lumen-utils-shared';
|
|
2
|
+
import type { SharedValue } from 'react-native-reanimated';
|
|
2
3
|
|
|
3
4
|
export type TabBarContextValue = {
|
|
4
5
|
active?: string;
|
|
5
6
|
onTabPress: (value: string) => void;
|
|
7
|
+
densityProgress: SharedValue<number>;
|
|
8
|
+
labelOpacity: SharedValue<number>;
|
|
6
9
|
};
|
|
7
10
|
|
|
8
11
|
const [TabBarContextProvider, _useTabBarSafeContext] =
|
|
@@ -9,11 +9,20 @@ type IconComponent = ComponentType<{
|
|
|
9
9
|
|
|
10
10
|
export type TabBarValue = string;
|
|
11
11
|
|
|
12
|
+
export type TabBarDensity = 'compact' | 'expanded';
|
|
13
|
+
|
|
12
14
|
export type TabBarProps<T extends TabBarValue = TabBarValue> = {
|
|
13
15
|
/**
|
|
14
16
|
* The value of the currently active tab.
|
|
15
17
|
*/
|
|
16
18
|
active: T;
|
|
19
|
+
/**
|
|
20
|
+
* The density of the tab bar. `compact` hides the labels, shrinks the bar's
|
|
21
|
+
* size and insets it horizontally within its container.
|
|
22
|
+
* The transition is animated.
|
|
23
|
+
* @default 'expanded'
|
|
24
|
+
*/
|
|
25
|
+
density?: TabBarDensity;
|
|
17
26
|
/**
|
|
18
27
|
* The callback function called when a tab is pressed.
|
|
19
28
|
*/
|
|
@@ -1,37 +1,10 @@
|
|
|
1
1
|
import type { ComponentType } from 'react';
|
|
2
|
-
import type {
|
|
2
|
+
import type { BaseTagSharedProps } from '../../internal/BaseTag';
|
|
3
3
|
import type { IconProps } from '../../symbols/Icon';
|
|
4
4
|
|
|
5
|
-
export type TagProps = {
|
|
6
|
-
/**
|
|
7
|
-
* The appearance of the tag.
|
|
8
|
-
*/
|
|
9
|
-
appearance?:
|
|
10
|
-
| 'base'
|
|
11
|
-
| 'gray'
|
|
12
|
-
| 'accent'
|
|
13
|
-
| 'accent-subtle'
|
|
14
|
-
| 'success'
|
|
15
|
-
| 'error'
|
|
16
|
-
| 'warning'
|
|
17
|
-
| 'white';
|
|
5
|
+
export type TagProps = BaseTagSharedProps & {
|
|
18
6
|
/**
|
|
19
7
|
* The icon of the tag.
|
|
20
8
|
*/
|
|
21
9
|
icon?: ComponentType<IconProps>;
|
|
22
|
-
|
|
23
|
-
* The label of the tag.
|
|
24
|
-
*/
|
|
25
|
-
label: string;
|
|
26
|
-
/**
|
|
27
|
-
* The size of the tag.
|
|
28
|
-
* @default 'md'
|
|
29
|
-
*/
|
|
30
|
-
size?: 'sm' | 'md';
|
|
31
|
-
/**
|
|
32
|
-
* When `true`, prevents the user from interacting with the tag.
|
|
33
|
-
*
|
|
34
|
-
* @default false
|
|
35
|
-
*/
|
|
36
|
-
disabled?: boolean;
|
|
37
|
-
} & StyledViewProps;
|
|
10
|
+
};
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { useDisabledContext } from '@ledgerhq/lumen-utils-shared';
|
|
2
2
|
import { StyleSheet, Text } from 'react-native';
|
|
3
3
|
import { useStyleSheet } from '../../../../styles';
|
|
4
|
-
import type { TagProps } from '../../core/Tag/types';
|
|
5
4
|
import { Box } from '../../primitives';
|
|
6
5
|
import type { BaseTagProps, BaseTagVariant } from './types';
|
|
7
6
|
|
|
8
|
-
type Appearance = NonNullable<
|
|
9
|
-
type Size = NonNullable<
|
|
7
|
+
type Appearance = NonNullable<BaseTagProps['appearance']>;
|
|
8
|
+
type Size = NonNullable<BaseTagProps['size']>;
|
|
10
9
|
|
|
11
10
|
const useBaseTagStyles = ({
|
|
12
11
|
appearance,
|
|
@@ -1,10 +1,40 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import type { StyleProp, TextStyle } from 'react-native';
|
|
3
|
-
import type {
|
|
3
|
+
import type { StyledViewProps } from '../../../../styles';
|
|
4
|
+
|
|
5
|
+
export type BaseTagSharedProps = {
|
|
6
|
+
/**
|
|
7
|
+
* The appearance of the tag.
|
|
8
|
+
*/
|
|
9
|
+
appearance?:
|
|
10
|
+
| 'base'
|
|
11
|
+
| 'gray'
|
|
12
|
+
| 'accent'
|
|
13
|
+
| 'accent-subtle'
|
|
14
|
+
| 'success'
|
|
15
|
+
| 'error'
|
|
16
|
+
| 'warning'
|
|
17
|
+
| 'white';
|
|
18
|
+
/**
|
|
19
|
+
* The label of the tag.
|
|
20
|
+
*/
|
|
21
|
+
label: string;
|
|
22
|
+
/**
|
|
23
|
+
* The size of the tag.
|
|
24
|
+
* @default 'md'
|
|
25
|
+
*/
|
|
26
|
+
size?: 'sm' | 'md';
|
|
27
|
+
/**
|
|
28
|
+
* When `true`, prevents the user from interacting with the tag.
|
|
29
|
+
*
|
|
30
|
+
* @default false
|
|
31
|
+
*/
|
|
32
|
+
disabled?: boolean;
|
|
33
|
+
} & StyledViewProps;
|
|
4
34
|
|
|
5
35
|
export type BaseTagVariant = 'tag' | 'media';
|
|
6
36
|
|
|
7
|
-
export type BaseTagProps =
|
|
37
|
+
export type BaseTagProps = BaseTagSharedProps & {
|
|
8
38
|
variant: BaseTagVariant;
|
|
9
39
|
consumerName: string;
|
|
10
40
|
renderIcon?: (style: StyleProp<TextStyle>) => ReactNode;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import Svg, { Path } from 'react-native-svg';
|
|
2
|
+
import createIcon from '../Icon/createIcon';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* BadgeVerified icon component for React Native.
|
|
6
|
+
*
|
|
7
|
+
* This icon component is automatically generated from SVG files and uses the createIcon utility
|
|
8
|
+
* to create a consistent icon interface. It supports all standard SVG props (from react-native-svg)
|
|
9
|
+
* and additional size variants defined in the Icon component.
|
|
10
|
+
*
|
|
11
|
+
* @component
|
|
12
|
+
* @param {16 | 20 | 24 | 40 | 48 | 56} [size=24] - The size of the icon in pixels.
|
|
13
|
+
* @param {string} [color] - The color of the icon.
|
|
14
|
+
* @param {SVGProps} [...props] - All standard SVG element props (from react-native-svg).
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* // Basic usage with default size (24px)
|
|
18
|
+
* import { BadgeVerified } from '@ledgerhq/lumen-ui-rnative/symbols';
|
|
19
|
+
*
|
|
20
|
+
* <BadgeVerified />
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* // With custom size and style
|
|
24
|
+
* <BadgeVerified size={40} color="warning" lx={{ marginTop: 's4' }} />
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* // Used within a Button component
|
|
28
|
+
* import { Button } from '@ledgerhq/lumen-ui-rnative';
|
|
29
|
+
*
|
|
30
|
+
* <Button icon={BadgeVerified} size="md">
|
|
31
|
+
* Click me
|
|
32
|
+
* </Button>
|
|
33
|
+
*/
|
|
34
|
+
export const BadgeVerified = createIcon(
|
|
35
|
+
'BadgeVerified',
|
|
36
|
+
<Svg width={24} height={24} fill='currentColor' viewBox='0 0 16 16'>
|
|
37
|
+
<Path
|
|
38
|
+
stroke='currentColor'
|
|
39
|
+
strokeLinecap='round'
|
|
40
|
+
strokeLinejoin='round'
|
|
41
|
+
d='M10 7 7.5 9.5 6 8m-.115 4.397H4.23c-.374 0-.674-.264-.674-.637V10.1a.66.66 0 0 0-.2-.473L2.184 8.453a.66.66 0 0 1 0-.946l1.18-1.187c.113-.12.18-.28.18-.447V4.2c0-.373.293-.673.667-.673h1.653a.64.64 0 0 0 .467-.2l1.166-1.174a.65.65 0 0 1 .94 0L9.604 3.32c.12.12.293.193.467.193h1.653c.367 0 .667.294.667.667v1.653c0 .178.066.347.193.467l1.167 1.167c.26.26.26.68 0 .94l-1.174 1.166a.65.65 0 0 0-.2.467v1.653c0 .367-.3.704-.673.704h-1.66c-.177 0-.353.03-.473.156L8.397 13.72a.67.67 0 0 1-.946 0l-1.174-1.173c-.126-.134-.219-.15-.392-.15'
|
|
42
|
+
/>
|
|
43
|
+
</Svg>,
|
|
44
|
+
);
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import Svg, { Path } from 'react-native-svg';
|
|
2
|
+
import createIcon from '../Icon/createIcon';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* BadgeVerifiedFill icon component for React Native.
|
|
6
|
+
*
|
|
7
|
+
* This icon component is automatically generated from SVG files and uses the createIcon utility
|
|
8
|
+
* to create a consistent icon interface. It supports all standard SVG props (from react-native-svg)
|
|
9
|
+
* and additional size variants defined in the Icon component.
|
|
10
|
+
*
|
|
11
|
+
* @component
|
|
12
|
+
* @param {16 | 20 | 24 | 40 | 48 | 56} [size=24] - The size of the icon in pixels.
|
|
13
|
+
* @param {string} [color] - The color of the icon.
|
|
14
|
+
* @param {SVGProps} [...props] - All standard SVG element props (from react-native-svg).
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* // Basic usage with default size (24px)
|
|
18
|
+
* import { BadgeVerifiedFill } from '@ledgerhq/lumen-ui-rnative/symbols';
|
|
19
|
+
*
|
|
20
|
+
* <BadgeVerifiedFill />
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* // With custom size and style
|
|
24
|
+
* <BadgeVerifiedFill size={40} color="warning" lx={{ marginTop: 's4' }} />
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* // Used within a Button component
|
|
28
|
+
* import { Button } from '@ledgerhq/lumen-ui-rnative';
|
|
29
|
+
*
|
|
30
|
+
* <Button icon={BadgeVerifiedFill} size="md">
|
|
31
|
+
* Click me
|
|
32
|
+
* </Button>
|
|
33
|
+
*/
|
|
34
|
+
export const BadgeVerifiedFill = createIcon(
|
|
35
|
+
'BadgeVerifiedFill',
|
|
36
|
+
<Svg width={24} height={24} fill='currentColor' viewBox='0 0 16 16'>
|
|
37
|
+
<Path
|
|
38
|
+
fill='currentColor'
|
|
39
|
+
d='M6.965 1.625a1.4 1.4 0 0 1 2.002-.002l1.14 1.14h1.617c.776 0 1.416.624 1.416 1.416v1.617l1.14 1.14a1.413 1.413 0 0 1 0 2v.002l-1.153 1.145v1.61a1.42 1.42 0 0 1-1.424 1.416h-1.628l-1.149 1.143-.006.005c-.554.54-1.443.55-2-.007l-1.067-1.067H4.23a1.423 1.423 0 0 1-1.424-1.424v-1.623L1.654 8.984a1.41 1.41 0 0 1-.001-2.006l1.14-1.147V4.2c0-.777.62-1.424 1.417-1.424h1.61l1.145-1.152M10.46 6.54a.65.65 0 0 0-.92 0L7.5 8.58 6.46 7.54a.651.651 0 0 0-.92.92l1.5 1.5a.65.65 0 0 0 .92 0l2.5-2.5a.65.65 0 0 0 0-.92'
|
|
40
|
+
/>
|
|
41
|
+
</Svg>,
|
|
42
|
+
);
|