@ledgerhq/lumen-ui-rnative 0.0.62 → 0.0.63

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 (57) hide show
  1. package/.storybook/main.ts +3 -0
  2. package/.storybook/mocks/blur.tsx +11 -0
  3. package/babel.config.js +1 -1
  4. package/dist/package.json +1 -1
  5. package/dist/src/lib/Components/Icon/Icon.js +1 -1
  6. package/dist/src/lib/Components/Spot/Spot.d.ts.map +1 -1
  7. package/dist/src/lib/Components/TabBar/TabBar.d.ts +33 -0
  8. package/dist/src/lib/Components/TabBar/TabBar.d.ts.map +1 -0
  9. package/dist/src/lib/Components/TabBar/TabBar.js +176 -0
  10. package/dist/src/lib/Components/TabBar/TabBar.stories.d.ts +50 -0
  11. package/dist/src/lib/Components/TabBar/TabBar.stories.d.ts.map +1 -0
  12. package/dist/src/lib/Components/TabBar/TabBar.stories.js +60 -0
  13. package/dist/src/lib/Components/TabBar/TabBarContext.d.ts +11 -0
  14. package/dist/src/lib/Components/TabBar/TabBarContext.d.ts.map +1 -0
  15. package/dist/src/lib/Components/TabBar/TabBarContext.js +7 -0
  16. package/dist/src/lib/Components/TabBar/index.d.ts +3 -0
  17. package/dist/src/lib/Components/TabBar/index.d.ts.map +1 -0
  18. package/dist/src/lib/Components/TabBar/index.js +1 -0
  19. package/dist/src/lib/Components/TabBar/types.d.ts +43 -0
  20. package/dist/src/lib/Components/TabBar/types.d.ts.map +1 -0
  21. package/dist/src/lib/Components/TabBar/types.js +1 -0
  22. package/dist/src/lib/Components/index.d.ts +1 -0
  23. package/dist/src/lib/Components/index.d.ts.map +1 -1
  24. package/dist/src/lib/Components/index.js +1 -0
  25. package/dist/src/lib/StyleSystem/lx/index.d.ts +5216 -4010
  26. package/dist/src/lib/StyleSystem/lx/index.d.ts.map +1 -1
  27. package/dist/src/styles/theme/createStylesheetTheme.d.ts.map +1 -1
  28. package/dist/src/styles/theme/createStylesheetTheme.js +4 -1
  29. package/dist/src/styles/types/factories.types.d.ts +2 -2
  30. package/dist/src/styles/types/factories.types.d.ts.map +1 -1
  31. package/dist/src/styles/types/theme.types.d.ts +6 -1
  32. package/dist/src/styles/types/theme.types.d.ts.map +1 -1
  33. package/package.json +2 -2
  34. package/src/lib/Components/Icon/Icon.test.tsx +0 -1
  35. package/src/lib/Components/Icon/Icon.tsx +1 -1
  36. package/src/lib/Components/Link/Link.test.tsx +5 -1
  37. package/src/lib/Components/Spot/Spot.tsx +2 -3
  38. package/src/lib/Components/TabBar/TabBar.mdx +185 -0
  39. package/src/lib/Components/TabBar/TabBar.stories.tsx +120 -0
  40. package/src/lib/Components/TabBar/TabBar.test.tsx +71 -0
  41. package/src/lib/Components/TabBar/TabBar.tsx +287 -0
  42. package/src/lib/Components/TabBar/TabBarContext.tsx +17 -0
  43. package/src/lib/Components/TabBar/index.ts +2 -0
  44. package/src/lib/Components/TabBar/types.ts +44 -0
  45. package/src/lib/Components/ThemeProvider/ThemeProvider.test.tsx +2 -2
  46. package/src/lib/Components/Utility/Text/Text.mdx +0 -8
  47. package/src/lib/Components/index.ts +1 -0
  48. package/src/styles/hooks/useStyleSheet.test.tsx +2 -2
  49. package/src/styles/lx/createStyledPressable.test.tsx +2 -2
  50. package/src/styles/lx/createStyledText.test.tsx +18 -12
  51. package/src/styles/lx/createStyledView.test.tsx +2 -2
  52. package/src/styles/lx/resolveStyle.test.tsx +1 -5
  53. package/src/styles/provider/LumenStyleSheetProvider.test.tsx +2 -2
  54. package/src/styles/theme/createStylesheetTheme.test.ts +6 -2
  55. package/src/styles/theme/createStylesheetTheme.ts +4 -1
  56. package/src/styles/types/factories.types.ts +2 -2
  57. package/src/styles/types/theme.types.ts +11 -1
@@ -28,6 +28,9 @@ const config: StorybookConfig = {
28
28
  ...config.resolve.alias,
29
29
  'react-native': 'react-native-web',
30
30
  'react-native-svg': 'react-native-svg-web',
31
+ '@react-native-community/blur': fileURLToPath(
32
+ new URL('./mocks/blur.tsx', import.meta.url),
33
+ ),
31
34
  };
32
35
 
33
36
  return mergeConfig(config, {
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import { View, ViewProps } from 'react-native';
3
+
4
+ /**
5
+ * Mock BlurView for web/storybook
6
+ * @react-native-community/blur doesn't work on web, so we use a simple View
7
+ */
8
+ export const BlurView = (props: ViewProps & { blurAmount?: number }) => {
9
+ const { blurAmount, ...restProps } = props;
10
+ return <View {...restProps} />;
11
+ };
package/babel.config.js CHANGED
@@ -11,7 +11,7 @@ export default function (api) {
11
11
  },
12
12
  ],
13
13
  ],
14
- plugins: ['react-native-worklets/plugin'],
14
+ plugins: ['react-native-worklets/plugin', 'react-native-reanimated/plugin'],
15
15
  env: {
16
16
  test: {
17
17
  presets: [
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ledgerhq/lumen-ui-rnative",
3
- "version": "0.0.61",
3
+ "version": "0.0.62",
4
4
  "license": "Apache-2.0",
5
5
  "keywords": [
6
6
  "react-native",
@@ -31,6 +31,6 @@ const useStyles = (lx, size, color) => {
31
31
  };
32
32
  export const Icon = ({ size = 24, color, lx = {}, children, viewBox, ref, ...props }) => {
33
33
  const styles = useStyles(lx, size, color);
34
- return (_jsx(Svg, { ref: ref, width: styles.container.width, height: styles.container.height, strokeWidth: styles.container.strokeWidth, viewBox: viewBox, color: styles.color, fill: 'none', pointerEvents: 'none', ...props, children: children }));
34
+ return (_jsx(Svg, { ref: ref, width: styles.container.width, height: styles.container.height, strokeWidth: styles.container.strokeWidth, viewBox: viewBox, color: styles.color, fill: 'none', style: { pointerEvents: 'none' }, ...props, children: children }));
35
35
  };
36
36
  Icon.displayName = 'Icon';
@@ -1 +1 @@
1
- {"version":3,"file":"Spot.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/Spot/Spot.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAkB,SAAS,EAAY,MAAM,SAAS,CAAC;AAgF9D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,eAAO,MAAM,IAAI,UAAW,SAAS,4CA2DpC,CAAC"}
1
+ {"version":3,"file":"Spot.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/Spot/Spot.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAkB,SAAS,EAAY,MAAM,SAAS,CAAC;AAgF9D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,eAAO,MAAM,IAAI,UAAW,SAAS,4CA2DpC,CAAC"}
@@ -0,0 +1,33 @@
1
+ import { TabBarItemProps, TabBarProps } from './types';
2
+ /**
3
+ * Individual tab item component that displays an icon and label.
4
+ * Must be used as a child of TabBar.
5
+ *
6
+ * @example
7
+ * <TabBarItem value="home" label="Home" icon={HomeFill} activeIcon={HomeActive} />
8
+ */
9
+ export declare function TabBarItem({ value, label, icon, activeIcon, }: TabBarItemProps): import("react/jsx-runtime").JSX.Element;
10
+ export declare namespace TabBarItem {
11
+ var displayName: string;
12
+ }
13
+ /**
14
+ * A horizontal tab bar with animated pill background and icon transitions.
15
+ * Provides smooth animations for active state changes and press interactions.
16
+ *
17
+ * @see {@link https://ldls.vercel.app/?path=/docs/react-native_navigation-tabbar--docs Storybook}
18
+ * @see {@link https://ldls.vercel.app/?path=/docs/react-native_navigation-tabbar--docs#dos-and-donts Guidelines}
19
+ *
20
+ * @warning The `lx` prop should only be used for layout adjustments like margins or positioning.
21
+ *
22
+ * @example
23
+ * import { TabBar, TabBarItem } from '@ledgerhq/lumen-ui-rnative';
24
+ * import { HomeFill, Settings } from '@ledgerhq/lumen-ui-rnative/symbols';
25
+ *
26
+ * const [activeTab, setActiveTab] = useState('home');
27
+ * <TabBar active={activeTab} onTabPress={setActiveTab}>
28
+ * <TabBarItem value="home" label="Home" icon={HomeFill} />
29
+ * <TabBarItem value="settings" label="Settings" icon={Settings} />
30
+ * </TabBar>
31
+ */
32
+ export declare function TabBar({ active, onTabPress, children, ...props }: TabBarProps): import("react/jsx-runtime").JSX.Element;
33
+ //# sourceMappingURL=TabBar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TabBar.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/TabBar/TabBar.tsx"],"names":[],"mappings":"AAeA,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAIvD;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,EACzB,KAAK,EACL,KAAK,EACL,IAAI,EACJ,UAAU,GACX,EAAE,eAAe,2CA+FjB;yBApGe,UAAU;;;AAwG1B;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,MAAM,CAAC,EACrB,MAAM,EACN,UAAU,EACV,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,WAAW,2CAiFb"}
@@ -0,0 +1,176 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { BlurView } from '@react-native-community/blur';
3
+ import React, { useCallback, useEffect, useRef } from 'react';
4
+ import { StyleSheet, Text } from 'react-native';
5
+ import Animated, { Easing, useAnimatedStyle, useSharedValue, withDelay, withSequence, withTiming, } from 'react-native-reanimated';
6
+ import { useStyleSheet, useTheme } from '../../../styles';
7
+ import { Placeholder } from '../../Symbols';
8
+ import { Box, Pressable } from '../Utility';
9
+ import { TabBarContextProvider, useTabBarContext } from './TabBarContext';
10
+ const PILL_INSET = 4;
11
+ /**
12
+ * Individual tab item component that displays an icon and label.
13
+ * Must be used as a child of TabBar.
14
+ *
15
+ * @example
16
+ * <TabBarItem value="home" label="Home" icon={HomeFill} activeIcon={HomeActive} />
17
+ */
18
+ export function TabBarItem({ value, label, icon, activeIcon, }) {
19
+ const styles = useStyles();
20
+ const { active, onTabPress } = useTabBarContext();
21
+ const isActive = active === value;
22
+ const activeProgress = useSharedValue(isActive ? 1 : 0);
23
+ const pressProgress = useSharedValue(1);
24
+ const Icon = icon ?? Placeholder;
25
+ const ActiveIcon = activeIcon ?? Icon;
26
+ useEffect(() => {
27
+ activeProgress.value = withDelay(50, withTiming(isActive ? 1 : 0, {
28
+ duration: 200,
29
+ easing: Easing.bezier(0.4, 0, 0.2, 1),
30
+ }));
31
+ }, [isActive, activeProgress]);
32
+ function onPress() {
33
+ onTabPress(value);
34
+ }
35
+ function onPressIn() {
36
+ pressProgress.value = withTiming(0.9, {
37
+ duration: 100,
38
+ easing: Easing.bezier(0, 0, 0.2, 1),
39
+ });
40
+ }
41
+ function onPressOut() {
42
+ pressProgress.value = withSequence(withTiming(0.95, {
43
+ duration: 0,
44
+ }), withTiming(1, {
45
+ duration: 120,
46
+ easing: Easing.out(Easing.quad),
47
+ }));
48
+ }
49
+ const scaleStyle = useAnimatedStyle(() => ({
50
+ transform: [{ scale: pressProgress.value }],
51
+ }), [pressProgress]);
52
+ const activeIconStyle = useAnimatedStyle(() => ({
53
+ opacity: activeProgress.value,
54
+ }), [activeProgress]);
55
+ const inactiveIconStyle = useAnimatedStyle(() => ({
56
+ opacity: 1 - activeProgress.value,
57
+ }), [activeProgress]);
58
+ return (_jsxs(Pressable, { style: styles.item, onPress: onPress, onPressIn: onPressIn, onPressOut: onPressOut, accessibilityRole: 'tab', accessibilityLabel: label ?? value, accessibilityState: { selected: isActive }, children: [_jsx(Animated.View, { style: scaleStyle, children: _jsxs(Box, { style: styles.itemIconContainer, children: [_jsx(Animated.View, { style: [styles.itemIcon, inactiveIconStyle], children: _jsx(Icon, { size: 20 }) }), _jsx(Animated.View, { style: [styles.itemIcon, activeIconStyle], children: _jsx(ActiveIcon, { size: 20 }) })] }) }), label && (_jsx(Text, { style: [styles.itemText, isActive && styles.activeItemText], numberOfLines: 1, children: label }))] }));
59
+ }
60
+ TabBarItem.displayName = 'TabBarItem';
61
+ /**
62
+ * A horizontal tab bar with animated pill background and icon transitions.
63
+ * Provides smooth animations for active state changes and press interactions.
64
+ *
65
+ * @see {@link https://ldls.vercel.app/?path=/docs/react-native_navigation-tabbar--docs Storybook}
66
+ * @see {@link https://ldls.vercel.app/?path=/docs/react-native_navigation-tabbar--docs#dos-and-donts Guidelines}
67
+ *
68
+ * @warning The `lx` prop should only be used for layout adjustments like margins or positioning.
69
+ *
70
+ * @example
71
+ * import { TabBar, TabBarItem } from '@ledgerhq/lumen-ui-rnative';
72
+ * import { HomeFill, Settings } from '@ledgerhq/lumen-ui-rnative/symbols';
73
+ *
74
+ * const [activeTab, setActiveTab] = useState('home');
75
+ * <TabBar active={activeTab} onTabPress={setActiveTab}>
76
+ * <TabBarItem value="home" label="Home" icon={HomeFill} />
77
+ * <TabBarItem value="settings" label="Settings" icon={Settings} />
78
+ * </TabBar>
79
+ */
80
+ export function TabBar({ active, onTabPress, children, ...props }) {
81
+ const styles = useStyles();
82
+ const { theme, colorScheme } = useTheme();
83
+ const pillProgress = useSharedValue(0);
84
+ const itemWidth = useSharedValue(0);
85
+ const itemHeight = useSharedValue(0);
86
+ const hasLayoutRef = useRef(false);
87
+ const getActiveIndex = useCallback(() => {
88
+ return React.Children.toArray(children).findIndex((child) => {
89
+ if (React.isValidElement(child)) {
90
+ return child.props.value === active;
91
+ }
92
+ return false;
93
+ });
94
+ }, [active, children]);
95
+ function onLayout(e) {
96
+ const { width, height } = e.nativeEvent.layout;
97
+ const count = React.Children.count(children);
98
+ const slotWidth = (width - PILL_INSET * 2) / count;
99
+ itemWidth.value = slotWidth;
100
+ itemHeight.value = height;
101
+ if (!hasLayoutRef.current) {
102
+ hasLayoutRef.current = true;
103
+ const index = getActiveIndex();
104
+ if (index >= 0) {
105
+ pillProgress.value = index * slotWidth;
106
+ }
107
+ }
108
+ }
109
+ function handleTabPress(value) {
110
+ onTabPress?.(value);
111
+ }
112
+ useEffect(() => {
113
+ if (!hasLayoutRef.current) {
114
+ return;
115
+ }
116
+ const index = getActiveIndex();
117
+ if (index >= 0 && itemWidth.value > 0) {
118
+ pillProgress.value = withTiming(index * itemWidth.value, {
119
+ duration: 300,
120
+ easing: Easing.bezier(0.4, 0, 0.2, 1),
121
+ });
122
+ }
123
+ }, [itemWidth, pillProgress, getActiveIndex]);
124
+ const animatedPillStyle = useAnimatedStyle(() => ({
125
+ transform: [{ translateX: pillProgress.value }],
126
+ width: itemWidth.value,
127
+ height: itemHeight.value - PILL_INSET * 2,
128
+ }), [pillProgress, itemWidth, itemHeight]);
129
+ return (_jsx(TabBarContextProvider, { value: { active, onTabPress: handleTabPress }, children: _jsxs(Box, { style: styles.container, onLayout: onLayout, accessibilityRole: 'tablist', ...props, children: [children, _jsx(BlurView, { style: styles.blur, blurAmount: theme.blur.md, blurType: colorScheme === 'dark' ? 'dark' : 'light' }), _jsx(Animated.View, { style: [styles.pill, animatedPillStyle] })] }) }));
130
+ }
131
+ const useStyles = () => useStyleSheet((t) => ({
132
+ container: {
133
+ height: t.sizes.s56,
134
+ flexDirection: 'row',
135
+ justifyContent: 'center',
136
+ padding: t.spacings.s4,
137
+ alignItems: 'center',
138
+ borderRadius: t.borderRadius.full,
139
+ backgroundColor: t.colors.bg.mutedTransparent,
140
+ overflow: 'hidden',
141
+ },
142
+ blur: {
143
+ ...StyleSheet.absoluteFillObject,
144
+ zIndex: -1,
145
+ },
146
+ item: {
147
+ flex: 1,
148
+ paddingVertical: t.spacings.s4,
149
+ alignItems: 'center',
150
+ justifyContent: 'center',
151
+ gap: t.spacings.s2,
152
+ },
153
+ itemText: {
154
+ ...t.typographies.body4,
155
+ paddingHorizontal: t.spacings.s12,
156
+ color: t.colors.text.base,
157
+ },
158
+ itemIcon: {
159
+ position: 'absolute',
160
+ },
161
+ itemIconContainer: {
162
+ width: 20,
163
+ height: 20,
164
+ position: 'relative',
165
+ },
166
+ activeItemText: {
167
+ ...t.typographies.body4SemiBold,
168
+ },
169
+ pill: {
170
+ position: 'absolute',
171
+ top: PILL_INSET,
172
+ left: PILL_INSET,
173
+ borderRadius: t.borderRadius.full,
174
+ backgroundColor: t.colors.bg.mutedTransparent,
175
+ },
176
+ }), []);
@@ -0,0 +1,50 @@
1
+ import type { StoryObj } from '@storybook/react-native-web-vite';
2
+ import { TabBar, TabBarItem } from './TabBar';
3
+ declare const meta: {
4
+ title: string;
5
+ component: typeof TabBar;
6
+ subcomponents: {
7
+ TabBarItem: typeof TabBarItem;
8
+ };
9
+ parameters: {
10
+ layout: string;
11
+ backgrounds: {
12
+ default: string;
13
+ };
14
+ };
15
+ argTypes: {
16
+ active: {
17
+ control: "text";
18
+ description: string;
19
+ table: {
20
+ type: {
21
+ summary: string;
22
+ };
23
+ };
24
+ };
25
+ onTabPress: {
26
+ action: string;
27
+ description: string;
28
+ table: {
29
+ type: {
30
+ summary: string;
31
+ };
32
+ };
33
+ };
34
+ children: {
35
+ control: false;
36
+ description: string;
37
+ table: {
38
+ type: {
39
+ summary: string;
40
+ };
41
+ };
42
+ };
43
+ };
44
+ };
45
+ export default meta;
46
+ type Story = StoryObj<typeof meta>;
47
+ export declare const Base: Story;
48
+ export declare const Complex: Story;
49
+ export declare const MissingLabel: Story;
50
+ //# sourceMappingURL=TabBar.stories.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TabBar.stories.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/TabBar/TabBar.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAiBvE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAE9C,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiCqB,CAAC;AAEhC,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,IAAI,EAAE,KA2BlB,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,KAmBrB,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,KAY1B,CAAC"}
@@ -0,0 +1,60 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState } from 'react';
3
+ import { BasketPutIn, HomeFill, Settings, Placeholder, Chart1, Bell, CoinPercent, Home, LifeRing, LifeRingFill, Cart, CreditCard, CreditCardFill, } from '../../Symbols';
4
+ import { TabBar, TabBarItem } from './TabBar';
5
+ const meta = {
6
+ title: 'Navigation/TabBar',
7
+ component: TabBar,
8
+ subcomponents: {
9
+ TabBarItem,
10
+ },
11
+ parameters: {
12
+ layout: 'centered',
13
+ backgrounds: { default: 'light' },
14
+ },
15
+ argTypes: {
16
+ active: {
17
+ control: 'text',
18
+ description: 'The currently active tab value',
19
+ table: {
20
+ type: { summary: 'string' },
21
+ },
22
+ },
23
+ onTabPress: {
24
+ action: 'tab pressed',
25
+ description: 'Callback function when a tab is pressed',
26
+ table: {
27
+ type: { summary: '(active: string) => void' },
28
+ },
29
+ },
30
+ children: {
31
+ control: false,
32
+ description: 'TabBarItem children',
33
+ table: {
34
+ type: { summary: 'TabBarChildren' },
35
+ },
36
+ },
37
+ },
38
+ };
39
+ export default meta;
40
+ export const Base = {
41
+ args: {},
42
+ render: () => {
43
+ const [active, setActive] = useState('home');
44
+ return (_jsxs(TabBar, { active: active, onTabPress: setActive, lx: { width: 's320' }, children: [_jsx(TabBarItem, { value: 'home', label: 'Home', icon: Home, activeIcon: HomeFill }), _jsx(TabBarItem, { value: 'pay', label: 'Pay', icon: CreditCard, activeIcon: CreditCardFill }), _jsx(TabBarItem, { value: 'help', label: 'Help', icon: LifeRing, activeIcon: LifeRingFill })] }));
45
+ },
46
+ };
47
+ export const Complex = {
48
+ args: {},
49
+ render: () => {
50
+ const [active, setActive] = useState('portfolio');
51
+ return (_jsxs(TabBar, { active: active, onTabPress: setActive, lx: { width: 's320' }, children: [_jsx(TabBarItem, { value: 'market', label: 'Market', icon: Chart1 }), _jsx(TabBarItem, { value: 'portfolio', label: 'Portfolio', icon: CoinPercent, activeIcon: CoinPercent }), _jsx(TabBarItem, { value: 'shop', label: 'Shop', icon: BasketPutIn }), _jsx(TabBarItem, { value: 'notifications', label: 'Alerts', icon: Bell }), _jsx(TabBarItem, { value: 'settings', label: 'Settings', icon: Settings })] }));
52
+ },
53
+ };
54
+ export const MissingLabel = {
55
+ args: {},
56
+ render: () => {
57
+ const [active, setActive] = useState('tab1');
58
+ return (_jsxs(TabBar, { active: active, onTabPress: setActive, lx: { width: 's320' }, children: [_jsx(TabBarItem, { value: 'tab1' }), _jsx(TabBarItem, { value: 'tab2', label: 'Tab', icon: Placeholder }), _jsx(TabBarItem, { value: 'tab3', icon: Cart })] }));
59
+ },
60
+ };
@@ -0,0 +1,11 @@
1
+ export type TabBarContextValue = {
2
+ active?: string;
3
+ onTabPress: (value: string) => void;
4
+ };
5
+ declare const TabBarContextProvider: import("react").FC<{
6
+ children: import("react").ReactNode;
7
+ value: TabBarContextValue;
8
+ }>;
9
+ export declare const useTabBarContext: () => TabBarContextValue;
10
+ export { TabBarContextProvider };
11
+ //# sourceMappingURL=TabBarContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TabBarContext.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/TabBar/TabBarContext.tsx"],"names":[],"mappings":"AAEA,MAAM,MAAM,kBAAkB,GAAG;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACrC,CAAC;AAEF,QAAA,MAAO,qBAAqB;;;EACqB,CAAC;AAElD,eAAO,MAAM,gBAAgB,0BAIzB,CAAC;AAEL,OAAO,EAAE,qBAAqB,EAAE,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { createSafeContext } from '@ledgerhq/lumen-utils-shared';
2
+ const [TabBarContextProvider, _useTabBarSafeContext] = createSafeContext('TabBar');
3
+ export const useTabBarContext = () => _useTabBarSafeContext({
4
+ consumerName: 'TabBarItem',
5
+ contextRequired: true,
6
+ });
7
+ export { TabBarContextProvider };
@@ -0,0 +1,3 @@
1
+ export { TabBar, TabBarItem } from './TabBar';
2
+ export type { TabBarProps, TabBarItemProps } from './types';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/TabBar/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAC9C,YAAY,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC"}
@@ -0,0 +1 @@
1
+ export { TabBar, TabBarItem } from './TabBar';
@@ -0,0 +1,43 @@
1
+ import { ComponentType, ReactNode } from 'react';
2
+ import { IconSize } from '../Icon';
3
+ import { BoxProps } from '../Utility';
4
+ type IconComponent = ComponentType<{
5
+ size?: IconSize;
6
+ className?: string;
7
+ }>;
8
+ export type TabBarItemProps = {
9
+ /**
10
+ * The unique identifier for the tab item.
11
+ */
12
+ value: string;
13
+ /**
14
+ * The display label for the tab item.
15
+ * If not provided, the icon will be centered.
16
+ */
17
+ label?: string;
18
+ /**
19
+ * The icon component to display when the tab is inactive.
20
+ */
21
+ icon?: IconComponent;
22
+ /**
23
+ * The icon component to display when the tab is active.
24
+ * If not provided, the inactive icon will be used.
25
+ */
26
+ activeIcon?: IconComponent;
27
+ };
28
+ export type TabBarProps = {
29
+ /**
30
+ * The value of the currently active tab.
31
+ */
32
+ active: string;
33
+ /**
34
+ * The callback function called when a tab is pressed.
35
+ */
36
+ onTabPress: (active: string) => void;
37
+ /**
38
+ * The tab items to display.
39
+ */
40
+ children: ReactNode;
41
+ } & Omit<BoxProps, 'children'>;
42
+ export {};
43
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/TabBar/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,KAAK,aAAa,GAAG,aAAa,CAAC;IACjC,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG;IAC5B;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,IAAI,CAAC,EAAE,aAAa,CAAC;IACrB;;;OAGG;IACH,UAAU,CAAC,EAAE,aAAa,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;CACrB,GAAG,IAAI,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -16,6 +16,7 @@ export * from './Select';
16
16
  export * from './Spot';
17
17
  export * from './Subheader';
18
18
  export * from './Switch';
19
+ export * from './TabBar';
19
20
  export * from './Tag';
20
21
  export * from './Utility';
21
22
  export * from './TextInput';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/Components/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,OAAO,CAAC;AACtB,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/Components/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,OAAO,CAAC;AACtB,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC"}
@@ -16,6 +16,7 @@ export * from './Select';
16
16
  export * from './Spot';
17
17
  export * from './Subheader';
18
18
  export * from './Switch';
19
+ export * from './TabBar';
19
20
  export * from './Tag';
20
21
  export * from './Utility';
21
22
  export * from './TextInput';