@ledgerhq/lumen-ui-rnative 0.0.80 → 0.1.0

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 (93) hide show
  1. package/.storybook/docs/style-system/lx/Typographies/Typographies.mdx +34 -0
  2. package/.storybook/docs/style-system/lx/Typographies/TypographyTable.tsx +47 -0
  3. package/ai-rules/RULES.md +9 -17
  4. package/dist/package.json +1 -1
  5. package/dist/src/lib/Components/TabBar/TabBar.d.ts +1 -1
  6. package/dist/src/lib/Components/TabBar/TabBar.d.ts.map +1 -1
  7. package/dist/src/lib/Components/TabBar/TabBar.js +2 -2
  8. package/dist/src/lib/Components/TabBar/types.d.ts +2 -1
  9. package/dist/src/lib/Components/TabBar/types.d.ts.map +1 -1
  10. package/dist/src/styles/theme/createStylesheetTheme.d.ts +0 -5
  11. package/dist/src/styles/theme/createStylesheetTheme.d.ts.map +1 -1
  12. package/dist/src/styles/theme/createStylesheetTheme.js +5 -12
  13. package/dist/src/styles/theme/index.d.ts +1 -1
  14. package/dist/src/styles/theme/index.d.ts.map +1 -1
  15. package/dist/src/styles/theme/index.js +1 -1
  16. package/dist/src/styles/theme/resolvers/resolveFontWeights.d.ts +14 -0
  17. package/dist/src/styles/theme/resolvers/resolveFontWeights.d.ts.map +1 -0
  18. package/dist/src/styles/theme/resolvers/resolveFontWeights.js +30 -0
  19. package/dist/src/styles/theme/resolvers/resolveNegativeSpacing.d.ts +4 -0
  20. package/dist/src/styles/theme/resolvers/resolveNegativeSpacing.d.ts.map +1 -0
  21. package/dist/src/styles/theme/resolvers/resolveNegativeSpacing.js +6 -0
  22. package/package.json +1 -1
  23. package/src/lib/Components/TabBar/TabBar.tsx +4 -1
  24. package/src/lib/Components/TabBar/types.ts +2 -1
  25. package/src/styles/theme/createStylesheetTheme.test.ts +4 -21
  26. package/src/styles/theme/createStylesheetTheme.ts +5 -21
  27. package/src/styles/theme/index.ts +1 -4
  28. package/src/styles/theme/resolvers/resolveFontWeights.test.ts +71 -0
  29. package/src/styles/theme/resolvers/resolveFontWeights.ts +40 -0
  30. package/src/styles/theme/resolvers/resolveNegativeSpacing.test.ts +29 -0
  31. package/src/styles/theme/resolvers/resolveNegativeSpacing.ts +16 -0
  32. package/dist/src/lib/StyleSystem/index.d.ts +0 -2
  33. package/dist/src/lib/StyleSystem/index.d.ts.map +0 -1
  34. package/dist/src/lib/StyleSystem/index.js +0 -1
  35. package/dist/src/lib/StyleSystem/lx/BorderRadius/BorderRadiusTable.d.ts +0 -2
  36. package/dist/src/lib/StyleSystem/lx/BorderRadius/BorderRadiusTable.d.ts.map +0 -1
  37. package/dist/src/lib/StyleSystem/lx/BorderRadius/BorderRadiusTable.js +0 -17
  38. package/dist/src/lib/StyleSystem/lx/BorderRadius/index.d.ts +0 -2
  39. package/dist/src/lib/StyleSystem/lx/BorderRadius/index.d.ts.map +0 -1
  40. package/dist/src/lib/StyleSystem/lx/BorderRadius/index.js +0 -1
  41. package/dist/src/lib/StyleSystem/lx/BorderWidth/BorderWidthTable.d.ts +0 -2
  42. package/dist/src/lib/StyleSystem/lx/BorderWidth/BorderWidthTable.d.ts.map +0 -1
  43. package/dist/src/lib/StyleSystem/lx/BorderWidth/BorderWidthTable.js +0 -19
  44. package/dist/src/lib/StyleSystem/lx/BorderWidth/index.d.ts +0 -2
  45. package/dist/src/lib/StyleSystem/lx/BorderWidth/index.d.ts.map +0 -1
  46. package/dist/src/lib/StyleSystem/lx/BorderWidth/index.js +0 -1
  47. package/dist/src/lib/StyleSystem/lx/Colors/ColorTable.d.ts +0 -6
  48. package/dist/src/lib/StyleSystem/lx/Colors/ColorTable.d.ts.map +0 -1
  49. package/dist/src/lib/StyleSystem/lx/Colors/ColorTable.js +0 -65
  50. package/dist/src/lib/StyleSystem/lx/Colors/index.d.ts +0 -2
  51. package/dist/src/lib/StyleSystem/lx/Colors/index.d.ts.map +0 -1
  52. package/dist/src/lib/StyleSystem/lx/Colors/index.js +0 -1
  53. package/dist/src/lib/StyleSystem/lx/Shadows/ShadowTable.d.ts +0 -2
  54. package/dist/src/lib/StyleSystem/lx/Shadows/ShadowTable.d.ts.map +0 -1
  55. package/dist/src/lib/StyleSystem/lx/Shadows/ShadowTable.js +0 -29
  56. package/dist/src/lib/StyleSystem/lx/Shadows/index.d.ts +0 -2
  57. package/dist/src/lib/StyleSystem/lx/Shadows/index.d.ts.map +0 -1
  58. package/dist/src/lib/StyleSystem/lx/Shadows/index.js +0 -1
  59. package/dist/src/lib/StyleSystem/lx/Sizes/SizeTable.d.ts +0 -2
  60. package/dist/src/lib/StyleSystem/lx/Sizes/SizeTable.d.ts.map +0 -1
  61. package/dist/src/lib/StyleSystem/lx/Sizes/SizeTable.js +0 -24
  62. package/dist/src/lib/StyleSystem/lx/Sizes/index.d.ts +0 -2
  63. package/dist/src/lib/StyleSystem/lx/Sizes/index.d.ts.map +0 -1
  64. package/dist/src/lib/StyleSystem/lx/Sizes/index.js +0 -1
  65. package/dist/src/lib/StyleSystem/lx/Spacings/SpacingTable.d.ts +0 -2
  66. package/dist/src/lib/StyleSystem/lx/Spacings/SpacingTable.d.ts.map +0 -1
  67. package/dist/src/lib/StyleSystem/lx/Spacings/SpacingTable.js +0 -17
  68. package/dist/src/lib/StyleSystem/lx/Spacings/index.d.ts +0 -2
  69. package/dist/src/lib/StyleSystem/lx/Spacings/index.d.ts.map +0 -1
  70. package/dist/src/lib/StyleSystem/lx/Spacings/index.js +0 -1
  71. package/dist/src/lib/StyleSystem/lx/index.d.ts +0 -9549
  72. package/dist/src/lib/StyleSystem/lx/index.d.ts.map +0 -1
  73. package/dist/src/lib/StyleSystem/lx/index.js +0 -17
  74. package/src/lib/StyleSystem/index.ts +0 -1
  75. /package/{src/lib/StyleSystem → .storybook/docs/style-system}/lx/BorderRadius/BorderRadius.mdx +0 -0
  76. /package/{src/lib/StyleSystem → .storybook/docs/style-system}/lx/BorderRadius/BorderRadiusTable.tsx +0 -0
  77. /package/{src/lib/StyleSystem → .storybook/docs/style-system}/lx/BorderRadius/index.ts +0 -0
  78. /package/{src/lib/StyleSystem → .storybook/docs/style-system}/lx/BorderWidth/BorderWidth.mdx +0 -0
  79. /package/{src/lib/StyleSystem → .storybook/docs/style-system}/lx/BorderWidth/BorderWidthTable.tsx +0 -0
  80. /package/{src/lib/StyleSystem → .storybook/docs/style-system}/lx/BorderWidth/index.ts +0 -0
  81. /package/{src/lib/StyleSystem → .storybook/docs/style-system}/lx/Colors/ColorTable.tsx +0 -0
  82. /package/{src/lib/StyleSystem → .storybook/docs/style-system}/lx/Colors/Colors.mdx +0 -0
  83. /package/{src/lib/StyleSystem → .storybook/docs/style-system}/lx/Colors/index.ts +0 -0
  84. /package/{src/lib/StyleSystem → .storybook/docs/style-system}/lx/Shadows/ShadowTable.tsx +0 -0
  85. /package/{src/lib/StyleSystem → .storybook/docs/style-system}/lx/Shadows/Shadows.mdx +0 -0
  86. /package/{src/lib/StyleSystem → .storybook/docs/style-system}/lx/Shadows/index.ts +0 -0
  87. /package/{src/lib/StyleSystem → .storybook/docs/style-system}/lx/Sizes/SizeTable.tsx +0 -0
  88. /package/{src/lib/StyleSystem → .storybook/docs/style-system}/lx/Sizes/Sizes.mdx +0 -0
  89. /package/{src/lib/StyleSystem → .storybook/docs/style-system}/lx/Sizes/index.ts +0 -0
  90. /package/{src/lib/StyleSystem → .storybook/docs/style-system}/lx/Spacings/SpacingTable.tsx +0 -0
  91. /package/{src/lib/StyleSystem → .storybook/docs/style-system}/lx/Spacings/Spacings.mdx +0 -0
  92. /package/{src/lib/StyleSystem → .storybook/docs/style-system}/lx/Spacings/index.ts +0 -0
  93. /package/{src/lib/StyleSystem → .storybook/docs/style-system}/lx/index.ts +0 -0
@@ -0,0 +1,34 @@
1
+ import { Meta } from '@storybook/addon-docs/blocks';
2
+ import { TypographyTable } from './TypographyTable';
3
+
4
+ <Meta title='Style System/Theme/Typographies' />
5
+
6
+ # 🔤 Typographies
7
+
8
+ Our typography system provides a set of predefined text styles that ensure visual consistency across the app. Each token maps directly to the `typography` prop of the `Text` component.
9
+
10
+ ## Usage
11
+
12
+ Apply typographies through the `typography` prop on the `Text` component:
13
+
14
+ ```tsx
15
+ import { Text } from '@ledgerhq/lumen-ui-rnative';
16
+
17
+ <Text typography='heading3'>Page title</Text>
18
+ <Text typography='body1SemiBold'>Emphasized content</Text>
19
+ <Text typography='body2'>Regular paragraph text</Text>
20
+ ```
21
+
22
+ ## Heading
23
+
24
+ Heading styles are used for titles and key content that needs visual hierarchy.
25
+
26
+ <TypographyTable category="heading" />
27
+
28
+ ## Body
29
+
30
+ Body styles are used for general content such as paragraphs, labels, and descriptions.
31
+
32
+ <TypographyTable category="body" />
33
+
34
+
@@ -0,0 +1,47 @@
1
+ import { Text } from 'react-native';
2
+ import { resolveTheme } from '../';
3
+
4
+ type TypographyCategory = 'heading' | 'body';
5
+
6
+ type TypographyTableProps = {
7
+ category: TypographyCategory;
8
+ };
9
+
10
+ export const TypographyTable = ({ category }: TypographyTableProps) => {
11
+ const typographies = resolveTheme().typographies.xs[category];
12
+
13
+ const cells = Object.entries(typographies);
14
+
15
+ return (
16
+ <table style={{ width: '100%' }}>
17
+ <thead>
18
+ <tr>
19
+ <th>Token</th>
20
+ <th>Sample</th>
21
+ </tr>
22
+ </thead>
23
+ <tbody>
24
+ {cells.map(([key, value]) => (
25
+ <tr key={key}>
26
+ <td>
27
+ <code>{key}</code>
28
+ </td>
29
+ <td>
30
+ <Text
31
+ style={{
32
+ fontFamily: value.fontFamily,
33
+ fontSize: value.fontSize,
34
+ fontWeight: value.fontWeight,
35
+ lineHeight: value.lineHeight,
36
+ letterSpacing: value.letterSpacing,
37
+ }}
38
+ >
39
+ The quick brown fox jumps over the lazy dog
40
+ </Text>
41
+ </td>
42
+ </tr>
43
+ ))}
44
+ </tbody>
45
+ </table>
46
+ );
47
+ };
package/ai-rules/RULES.md CHANGED
@@ -82,7 +82,9 @@ Below is a complete list of all available Lumen React Native components. Click a
82
82
 
83
83
  ## React Native Style System
84
84
 
85
- Lumen React Native uses a custom style system called `lx` that provides type-safe access to design tokens. Explore the style system documentation:
85
+ Lumen React Native uses a custom style system called `lx` that provides type-safe access to design tokens.
86
+
87
+ Explore the complete theme reference:
86
88
 
87
89
  - [Colors](https://ldls.vercel.app/?path=/docs/style-system-theme-colors--docs) - Semantic color tokens for background, text, and borders
88
90
  - [Spacings](https://ldls.vercel.app/?path=/docs/style-system-theme-spacings--docs) - Spacing scale for padding, margin, and gaps
@@ -93,22 +95,12 @@ Lumen React Native uses a custom style system called `lx` that provides type-saf
93
95
 
94
96
  ### Style System Usage
95
97
 
96
- ```tsx
97
- import { Box, Text } from '@ledgerhq/lumen-ui-rnative';
98
-
99
- // Using lx prop for type-safe styling
100
- <Box
101
- lx={{
102
- backgroundColor: 'base',
103
- padding: 16,
104
- borderRadius: 'md',
105
- borderWidth: 1,
106
- borderColor: 'muted',
107
- }}
108
- >
109
- <Text lx={{ color: 'base', fontSize: 'body-2' }}>Styled with design tokens</Text>
110
- </Box>;
111
- ```
98
+
99
+ - [Style System](https://lumen-ldls.vercel.app/?path=/docs/react-native_style-system-style-system--docs) - high level guidelines
100
+ - [useTheme](https://lumen-ldls.vercel.app/?path=/docs/react-native_style-system-usetheme--docs) - useTheme hook
101
+ - [useStyleSheet](https://lumen-ldls.vercel.app/?path=/docs/react-native_style-system-usestylesheet--docs) - useStyleSheet
102
+ - [lx property](https://lumen-ldls.vercel.app/?path=/docs/react-native_style-system-lx--docs) - lx property
103
+
112
104
 
113
105
  ---
114
106
 
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ledgerhq/lumen-ui-rnative",
3
- "version": "0.0.79",
3
+ "version": "0.0.80",
4
4
  "license": "Apache-2.0",
5
5
  "keywords": [
6
6
  "react-native",
@@ -7,7 +7,7 @@ export declare const TAB_BAR_HEIGHT = 60;
7
7
  * @example
8
8
  * <TabBarItem value="home" label="Home" icon={HomeFill} activeIcon={HomeActive} />
9
9
  */
10
- export declare function TabBarItem({ value, label, icon, activeIcon, }: TabBarItemProps): import("react/jsx-runtime").JSX.Element;
10
+ export declare function TabBarItem({ value, label, icon, activeIcon, style, ...props }: TabBarItemProps): import("react/jsx-runtime").JSX.Element;
11
11
  export declare namespace TabBarItem {
12
12
  var displayName: string;
13
13
  }
@@ -1 +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;AAEvD,eAAO,MAAM,cAAc,KAAK,CAAC;AAGjC;;;;;;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,2CAsFb"}
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;AAEvD,eAAO,MAAM,cAAc,KAAK,CAAC;AAGjC;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,EACzB,KAAK,EACL,KAAK,EACL,IAAI,EACJ,UAAU,EACV,KAAK,EACL,GAAG,KAAK,EACT,EAAE,eAAe,2CAgGjB;yBAvGe,UAAU;;;AA2G1B;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,MAAM,CAAC,EACrB,MAAM,EACN,UAAU,EACV,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,WAAW,2CAsFb"}
@@ -16,7 +16,7 @@ const PILL_INSET = 4;
16
16
  * @example
17
17
  * <TabBarItem value="home" label="Home" icon={HomeFill} activeIcon={HomeActive} />
18
18
  */
19
- export function TabBarItem({ value, label, icon, activeIcon, }) {
19
+ export function TabBarItem({ value, label, icon, activeIcon, style, ...props }) {
20
20
  const styles = useStyles();
21
21
  const { active, onTabPress } = useTabBarContext();
22
22
  const isActive = active === value;
@@ -56,7 +56,7 @@ export function TabBarItem({ value, label, icon, activeIcon, }) {
56
56
  const inactiveIconStyle = useAnimatedStyle(() => ({
57
57
  opacity: 1 - activeProgress.value,
58
58
  }), [activeProgress]);
59
- 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
+ return (_jsxs(Pressable, { style: StyleSheet.flatten([styles.item, style]), onPress: onPress, onPressIn: onPressIn, onPressOut: onPressOut, accessibilityRole: 'tab', accessibilityLabel: label ?? value, accessibilityState: { selected: isActive }, ...props, 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 }))] }));
60
60
  }
61
61
  TabBarItem.displayName = 'TabBarItem';
62
62
  /**
@@ -1,4 +1,5 @@
1
1
  import { ComponentType, ReactNode } from 'react';
2
+ import { StyledViewProps } from '../../../styles';
2
3
  import { IconSize } from '../Icon';
3
4
  import { BoxProps } from '../Utility';
4
5
  type IconComponent = ComponentType<{
@@ -24,7 +25,7 @@ export type TabBarItemProps = {
24
25
  * If not provided, the inactive icon will be used.
25
26
  */
26
27
  activeIcon?: IconComponent;
27
- };
28
+ } & Omit<StyledViewProps, 'children'>;
28
29
  export type TabBarProps = {
29
30
  /**
30
31
  * The value of the currently active tab.
@@ -1 +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"}
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,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,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,GAAG,IAAI,CAAC,eAAe,EAAE,UAAU,CAAC,CAAC;AAEtC,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"}
@@ -1,9 +1,4 @@
1
1
  import { LumenStyleSheetTheme, LumenTheme } from '../types';
2
- import { AddEntriesNegative } from '../types/utility.types';
3
- /**
4
- *
5
- */
6
- export declare const getNegativeSpacings: <Input extends LumenTheme["spacings"], Output = AddEntriesNegative<Input>>(spacings?: Input) => Output;
7
2
  /**
8
3
  * The theme object from design-core is not directly compatible with React Native's StyleSheet.
9
4
  *
@@ -1 +1 @@
1
- {"version":3,"file":"createStylesheetTheme.d.ts","sourceRoot":"","sources":["../../../../src/styles/theme/createStylesheetTheme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAE5D;;GAEG;AACH,eAAO,MAAM,mBAAmB,GAC9B,KAAK,SAAS,UAAU,CAAC,UAAU,CAAC,EACpC,MAAM,yCAEI,KAAK,KACd,MAIF,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,qBAAqB,UACzB,UAAU,KAChB,oBAYF,CAAC"}
1
+ {"version":3,"file":"createStylesheetTheme.d.ts","sourceRoot":"","sources":["../../../../src/styles/theme/createStylesheetTheme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAI5D;;;;;;;GAOG;AACH,eAAO,MAAM,qBAAqB,UACzB,UAAU,KAChB,oBASF,CAAC"}
@@ -1,9 +1,5 @@
1
- /**
2
- *
3
- */
4
- export const getNegativeSpacings = (spacings = {}) => {
5
- return Object.fromEntries(Object.entries(spacings).map(([key, value]) => [`-${key}`, value * -1]));
6
- };
1
+ import { resolveFontWeights } from './resolvers/resolveFontWeights';
2
+ import { resolveNegativeSpacing } from './resolvers/resolveNegativeSpacing';
7
3
  /**
8
4
  * The theme object from design-core is not directly compatible with React Native's StyleSheet.
9
5
  *
@@ -15,13 +11,10 @@ export const getNegativeSpacings = (spacings = {}) => {
15
11
  export const createStylesheetTheme = (theme) => {
16
12
  return {
17
13
  ...theme,
18
- spacings: {
19
- ...theme?.spacings,
20
- ...getNegativeSpacings(theme?.spacings),
21
- },
22
- typographies: {
14
+ spacings: resolveNegativeSpacing(theme?.spacings),
15
+ typographies: resolveFontWeights({
23
16
  ...theme.typographies.xs.heading,
24
17
  ...theme.typographies.xs.body,
25
- },
18
+ }),
26
19
  };
27
20
  };
@@ -1,2 +1,2 @@
1
- export { createStylesheetTheme, getNegativeSpacings, } from './createStylesheetTheme';
1
+ export { createStylesheetTheme } from './createStylesheetTheme';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/styles/theme/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,yBAAyB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/styles/theme/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC"}
@@ -1 +1 @@
1
- export { createStylesheetTheme, getNegativeSpacings, } from './createStylesheetTheme';
1
+ export { createStylesheetTheme } from './createStylesheetTheme';
@@ -0,0 +1,14 @@
1
+ import { LumenTypographyTokens } from '../../types';
2
+ export declare const FONT_WEIGHT_SUFFIX_MAP: {
3
+ '100': string;
4
+ '200': string;
5
+ '300': string;
6
+ '400': string;
7
+ '500': string;
8
+ '600': string;
9
+ '700': string;
10
+ '800': string;
11
+ '900': string;
12
+ };
13
+ export declare const resolveFontWeights: (typographies: LumenTypographyTokens) => LumenTypographyTokens;
14
+ //# sourceMappingURL=resolveFontWeights.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolveFontWeights.d.ts","sourceRoot":"","sources":["../../../../../src/styles/theme/resolvers/resolveFontWeights.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAEpD,eAAO,MAAM,sBAAsB;;;;;;;;;;CAUlC,CAAC;AAEF,eAAO,MAAM,kBAAkB,iBAAkB,qBAAqB,0BAwBrE,CAAC"}
@@ -0,0 +1,30 @@
1
+ import { RuntimeConstants } from '../../../lib/utils';
2
+ export const FONT_WEIGHT_SUFFIX_MAP = {
3
+ '100': 'Thin',
4
+ '200': 'ExtraLight',
5
+ '300': 'Light',
6
+ '400': '',
7
+ '500': 'Medium',
8
+ '600': 'SemiBold',
9
+ '700': 'Bold',
10
+ '800': 'ExtraBold',
11
+ '900': 'Black',
12
+ };
13
+ export const resolveFontWeights = (typographies) => {
14
+ if (RuntimeConstants.isAndroid || RuntimeConstants.isBrowser) {
15
+ return typographies;
16
+ }
17
+ return Object.fromEntries(Object.entries(typographies).map(([key, value]) => {
18
+ const reactNativeFontWeight = FONT_WEIGHT_SUFFIX_MAP[value.fontWeight];
19
+ const concatenatedFontFamily = reactNativeFontWeight
20
+ ? [value.fontFamily, reactNativeFontWeight].join('-')
21
+ : value.fontFamily;
22
+ return [
23
+ key,
24
+ {
25
+ ...value,
26
+ fontFamily: concatenatedFontFamily,
27
+ },
28
+ ];
29
+ }));
30
+ };
@@ -0,0 +1,4 @@
1
+ import { LumenTheme } from '../../types';
2
+ import { AddEntriesNegative } from '../../types/utility.types';
3
+ export declare const resolveNegativeSpacing: <Input extends LumenTheme["spacings"], Output = AddEntriesNegative<Input>>(spacings?: Input) => Output;
4
+ //# sourceMappingURL=resolveNegativeSpacing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolveNegativeSpacing.d.ts","sourceRoot":"","sources":["../../../../../src/styles/theme/resolvers/resolveNegativeSpacing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAE/D,eAAO,MAAM,sBAAsB,GACjC,KAAK,SAAS,UAAU,CAAC,UAAU,CAAC,EACpC,MAAM,yCAEI,KAAK,KACd,MAOF,CAAC"}
@@ -0,0 +1,6 @@
1
+ export const resolveNegativeSpacing = (spacings = {}) => {
2
+ return {
3
+ ...spacings,
4
+ ...Object.fromEntries(Object.entries(spacings).map(([key, value]) => [`-${key}`, value * -1])),
5
+ };
6
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ledgerhq/lumen-ui-rnative",
3
- "version": "0.0.80",
3
+ "version": "0.1.0",
4
4
  "license": "Apache-2.0",
5
5
  "keywords": [
6
6
  "react-native",
@@ -30,6 +30,8 @@ export function TabBarItem({
30
30
  label,
31
31
  icon,
32
32
  activeIcon,
33
+ style,
34
+ ...props
33
35
  }: TabBarItemProps) {
34
36
  const styles = useStyles();
35
37
  const { active, onTabPress } = useTabBarContext();
@@ -97,13 +99,14 @@ export function TabBarItem({
97
99
 
98
100
  return (
99
101
  <Pressable
100
- style={styles.item}
102
+ style={StyleSheet.flatten([styles.item, style])}
101
103
  onPress={onPress}
102
104
  onPressIn={onPressIn}
103
105
  onPressOut={onPressOut}
104
106
  accessibilityRole='tab'
105
107
  accessibilityLabel={label ?? value}
106
108
  accessibilityState={{ selected: isActive }}
109
+ {...props}
107
110
  >
108
111
  <Animated.View style={scaleStyle}>
109
112
  <Box style={styles.itemIconContainer}>
@@ -1,4 +1,5 @@
1
1
  import { ComponentType, ReactNode } from 'react';
2
+ import { StyledViewProps } from '../../../styles';
2
3
  import { IconSize } from '../Icon';
3
4
  import { BoxProps } from '../Utility';
4
5
 
@@ -26,7 +27,7 @@ export type TabBarItemProps = {
26
27
  * If not provided, the inactive icon will be used.
27
28
  */
28
29
  activeIcon?: IconComponent;
29
- };
30
+ } & Omit<StyledViewProps, 'children'>;
30
31
 
31
32
  export type TabBarProps = {
32
33
  /**
@@ -1,27 +1,9 @@
1
- import { describe, it, expect } from '@jest/globals';
1
+ import { describe, it, expect, jest } from '@jest/globals';
2
2
  import { ledgerLiveThemes } from '@ledgerhq/lumen-design-core';
3
- import {
4
- getNegativeSpacings,
5
- createStylesheetTheme,
6
- } from './createStylesheetTheme';
3
+ import { RuntimeConstants } from '../../lib/utils';
4
+ import { createStylesheetTheme } from './createStylesheetTheme';
7
5
 
8
6
  describe('createStylesheetTheme', () => {
9
- describe('getNegativeSpacings', () => {
10
- it('should create negative entries for each spacing', () => {
11
- const spacings = {
12
- s4: 4,
13
- s8: 8,
14
- s16: 16,
15
- } as typeof ledgerLiveThemes.dark.spacings;
16
-
17
- const result = getNegativeSpacings(spacings);
18
-
19
- expect(result['-s4']).toBe(-4);
20
- expect(result['-s8']).toBe(-8);
21
- expect(result['-s16']).toBe(-16);
22
- });
23
- });
24
-
25
7
  describe('createStylesheetTheme', () => {
26
8
  it('should include both positive and negative spacings', () => {
27
9
  const theme = ledgerLiveThemes.dark;
@@ -33,6 +15,7 @@ describe('createStylesheetTheme', () => {
33
15
  });
34
16
 
35
17
  it('should flatten heading/body typography tokens', () => {
18
+ jest.spyOn(RuntimeConstants, 'isAndroid', 'get').mockReturnValue(true);
36
19
  const theme = ledgerLiveThemes.dark;
37
20
 
38
21
  const result = createStylesheetTheme(theme);
@@ -1,19 +1,6 @@
1
1
  import { LumenStyleSheetTheme, LumenTheme } from '../types';
2
- import { AddEntriesNegative } from '../types/utility.types';
3
-
4
- /**
5
- *
6
- */
7
- export const getNegativeSpacings = <
8
- Input extends LumenTheme['spacings'],
9
- Output = AddEntriesNegative<Input>,
10
- >(
11
- spacings: Input = {} as Input,
12
- ): Output => {
13
- return Object.fromEntries(
14
- Object.entries(spacings).map(([key, value]) => [`-${key}`, value * -1]),
15
- ) as Output;
16
- };
2
+ import { resolveFontWeights } from './resolvers/resolveFontWeights';
3
+ import { resolveNegativeSpacing } from './resolvers/resolveNegativeSpacing';
17
4
 
18
5
  /**
19
6
  * The theme object from design-core is not directly compatible with React Native's StyleSheet.
@@ -28,13 +15,10 @@ export const createStylesheetTheme = (
28
15
  ): LumenStyleSheetTheme => {
29
16
  return {
30
17
  ...theme,
31
- spacings: {
32
- ...theme?.spacings,
33
- ...getNegativeSpacings(theme?.spacings),
34
- },
35
- typographies: {
18
+ spacings: resolveNegativeSpacing(theme?.spacings),
19
+ typographies: resolveFontWeights({
36
20
  ...theme.typographies.xs.heading,
37
21
  ...theme.typographies.xs.body,
38
- },
22
+ }),
39
23
  };
40
24
  };
@@ -1,4 +1 @@
1
- export {
2
- createStylesheetTheme,
3
- getNegativeSpacings,
4
- } from './createStylesheetTheme';
1
+ export { createStylesheetTheme } from './createStylesheetTheme';
@@ -0,0 +1,71 @@
1
+ import { describe, it, expect, afterEach, jest } from '@jest/globals';
2
+ import { ledgerLiveThemes } from '@ledgerhq/lumen-design-core';
3
+ import { RuntimeConstants } from '../../../lib/utils';
4
+ import { createStylesheetTheme } from '../createStylesheetTheme';
5
+ import { FONT_WEIGHT_SUFFIX_MAP } from './resolveFontWeights';
6
+
7
+ describe('resolveTypographies', () => {
8
+ afterEach(() => {
9
+ jest.restoreAllMocks();
10
+ });
11
+
12
+ it('should not modify fontFamily on android', () => {
13
+ jest.spyOn(RuntimeConstants, 'isAndroid', 'get').mockReturnValue(true);
14
+ const theme = ledgerLiveThemes.dark;
15
+
16
+ const result = createStylesheetTheme(theme);
17
+
18
+ const typographyTokens = theme.typographies.xs ?? theme.typographies.sm;
19
+ const firstKey = Object.keys(
20
+ typographyTokens.heading,
21
+ )[0] as keyof typeof typographyTokens.heading;
22
+ expect(result.typographies[firstKey].fontFamily).toBe(
23
+ typographyTokens.heading[firstKey].fontFamily,
24
+ );
25
+ });
26
+
27
+ it('should append weight suffix to fontFamily on non-android', () => {
28
+ jest.spyOn(RuntimeConstants, 'isAndroid', 'get').mockReturnValue(false);
29
+ const theme = ledgerLiveThemes.dark;
30
+
31
+ const result = createStylesheetTheme(theme);
32
+
33
+ Object.values(result.typographies).forEach((typography) => {
34
+ const { fontFamily, fontWeight } = typography as {
35
+ fontFamily: string;
36
+ fontWeight: string;
37
+ };
38
+
39
+ const expectedSuffix =
40
+ FONT_WEIGHT_SUFFIX_MAP[
41
+ fontWeight as keyof typeof FONT_WEIGHT_SUFFIX_MAP
42
+ ] ?? '';
43
+ expect(fontFamily).toContain(expectedSuffix);
44
+ });
45
+ });
46
+
47
+ it('should not modify other typography properties on non-android', () => {
48
+ jest.spyOn(RuntimeConstants, 'isAndroid', 'get').mockReturnValue(false);
49
+ const theme = ledgerLiveThemes.dark;
50
+
51
+ const result = createStylesheetTheme(theme);
52
+ const typographyTokens = theme.typographies.xs ?? theme.typographies.sm;
53
+ const allTokens = {
54
+ ...typographyTokens.heading,
55
+ ...typographyTokens.body,
56
+ };
57
+
58
+ Object.entries(result.typographies).forEach(([key, resolved]) => {
59
+ const original = allTokens[key as keyof typeof allTokens];
60
+ const { fontFamily: _f, ...resolvedRest } = resolved as Record<
61
+ string,
62
+ unknown
63
+ >;
64
+ const { fontFamily: _o, ...originalRest } = original as Record<
65
+ string,
66
+ unknown
67
+ >;
68
+ expect(resolvedRest).toEqual(originalRest);
69
+ });
70
+ });
71
+ });
@@ -0,0 +1,40 @@
1
+ import { RuntimeConstants } from '../../../lib/utils';
2
+ import { LumenTypographyTokens } from '../../types';
3
+
4
+ export const FONT_WEIGHT_SUFFIX_MAP = {
5
+ '100': 'Thin',
6
+ '200': 'ExtraLight',
7
+ '300': 'Light',
8
+ '400': '',
9
+ '500': 'Medium',
10
+ '600': 'SemiBold',
11
+ '700': 'Bold',
12
+ '800': 'ExtraBold',
13
+ '900': 'Black',
14
+ };
15
+
16
+ export const resolveFontWeights = (typographies: LumenTypographyTokens) => {
17
+ if (RuntimeConstants.isAndroid || RuntimeConstants.isBrowser) {
18
+ return typographies;
19
+ }
20
+
21
+ return Object.fromEntries(
22
+ Object.entries(typographies).map(([key, value]) => {
23
+ const reactNativeFontWeight =
24
+ FONT_WEIGHT_SUFFIX_MAP[
25
+ value.fontWeight as keyof typeof FONT_WEIGHT_SUFFIX_MAP
26
+ ];
27
+ const concatenatedFontFamily = reactNativeFontWeight
28
+ ? [value.fontFamily, reactNativeFontWeight].join('-')
29
+ : value.fontFamily;
30
+
31
+ return [
32
+ key,
33
+ {
34
+ ...value,
35
+ fontFamily: concatenatedFontFamily,
36
+ },
37
+ ];
38
+ }),
39
+ ) as LumenTypographyTokens;
40
+ };
@@ -0,0 +1,29 @@
1
+ import { describe, it, expect } from '@jest/globals';
2
+ import { ledgerLiveThemes } from '@ledgerhq/lumen-design-core';
3
+ import { resolveNegativeSpacing } from './resolveNegativeSpacing';
4
+
5
+ describe('resolveNegativeSpacing', () => {
6
+ it('should create negative entries for each spacing', () => {
7
+ const spacings = {
8
+ s4: 4,
9
+ s8: 8,
10
+ s16: 16,
11
+ } as typeof ledgerLiveThemes.dark.spacings;
12
+
13
+ const result = resolveNegativeSpacing(spacings);
14
+
15
+ /**
16
+ * Keep positive entries
17
+ */
18
+ expect(result['s4']).toBe(4);
19
+ expect(result['s8']).toBe(8);
20
+ expect(result['s16']).toBe(16);
21
+
22
+ /**
23
+ * Create negative entries
24
+ */
25
+ expect(result['-s4']).toBe(-4);
26
+ expect(result['-s8']).toBe(-8);
27
+ expect(result['-s16']).toBe(-16);
28
+ });
29
+ });
@@ -0,0 +1,16 @@
1
+ import { LumenTheme } from '../../types';
2
+ import { AddEntriesNegative } from '../../types/utility.types';
3
+
4
+ export const resolveNegativeSpacing = <
5
+ Input extends LumenTheme['spacings'],
6
+ Output = AddEntriesNegative<Input>,
7
+ >(
8
+ spacings: Input = {} as Input,
9
+ ): Output => {
10
+ return {
11
+ ...spacings,
12
+ ...Object.fromEntries(
13
+ Object.entries(spacings).map(([key, value]) => [`-${key}`, value * -1]),
14
+ ),
15
+ } as Output;
16
+ };
@@ -1,2 +0,0 @@
1
- export * from './lx';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/StyleSystem/index.ts"],"names":[],"mappings":"AAAA,cAAc,MAAM,CAAC"}
@@ -1 +0,0 @@
1
- export * from './lx';
@@ -1,2 +0,0 @@
1
- export declare const BorderRadiusTable: () => import("react/jsx-runtime").JSX.Element;
2
- //# sourceMappingURL=BorderRadiusTable.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"BorderRadiusTable.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/StyleSystem/lx/BorderRadius/BorderRadiusTable.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,iBAAiB,+CAgD7B,CAAC"}