@proximus/lavender-topnavigation-native 0.1.0-alpha.3 → 0.1.0-beta.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.
@@ -1 +1 @@
1
- {"version":3,"file":"PxTopNavigation.d.ts","sourceRoot":"","sources":["../src/PxTopNavigation.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,SAAS,EAGT,SAAS,EACV,MAAM,cAAc,CAAC;AACtB,OAAO,KAA8B,MAAM,OAAO,CAAC;AAyBnD,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,MAAM,CAAC,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACpC,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAChC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,kBAAkB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACtC;AA8HD,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,qBAqB1D"}
1
+ {"version":3,"file":"PxTopNavigation.d.ts","sourceRoot":"","sources":["../src/PxTopNavigation.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,SAAS,EAGT,SAAS,EACV,MAAM,cAAc,CAAC;AACtB,OAAO,KAA8B,MAAM,OAAO,CAAC;AAyBnD,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,MAAM,CAAC,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACpC,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAChC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,kBAAkB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACtC;AAiID,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,qBAqB1D"}
@@ -0,0 +1,133 @@
1
+ import { ScrollView, StyleSheet, View, } from 'react-native';
2
+ import React, { useEffect, useState } from 'react';
3
+ import LinearGradient from 'react-native-linear-gradient';
4
+ import { a11y, e2eID } from '@proximus/lavender-common-native';
5
+ import { Body, Header as TextHeader } from '@proximus/lavender-texts-native';
6
+ import { useSafeAreaInsets } from 'react-native-safe-area-context';
7
+ import { PxIcon } from '@proximus/lavender-icon-native';
8
+ import { useTheme } from '@proximus/lavender-styling-native';
9
+ function isWhiteColor(color) {
10
+ if (!color)
11
+ return false;
12
+ const str = color.toString().trim();
13
+ // Hex: #fff, #ffffff, fff, ffffff (case-insensitive)
14
+ if (/^#?fff(f)?(f)?$/i.test(str.replace(/^#/, '')))
15
+ return true;
16
+ // RGB: rgb(255,255,255) or with spaces
17
+ if (/^rgb\(\s*255\s*,\s*255\s*,\s*255\s*\)$/i.test(str))
18
+ return true;
19
+ // RGBA: rgba(255,255,255,1) or with spaces, alpha 1 or 1.0 or 100%
20
+ if (/^rgba\(\s*255\s*,\s*255\s*,\s*255\s*,\s*(1(\.0+)?|100%|1\.0+)\s*\)$/i.test(str))
21
+ return true;
22
+ return false;
23
+ }
24
+ function LeftComponent({ title, titleColor, description, prefix, descriptionContent, centerTitle = false, testId, }) {
25
+ const { theme } = useTheme();
26
+ return (React.createElement(View, { style: styles.leftComponent },
27
+ prefix,
28
+ React.createElement(View, { style: [styles.title, { flex: 1 }] },
29
+ React.createElement(TextHeader, { ellipsizeMode: 'tail', numberOfLines: 1, style: [
30
+ styles.textHeader,
31
+ {
32
+ color: titleColor || theme.t('ColorTextBrandInverted'),
33
+ textAlign: centerTitle ? 'center' : 'left',
34
+ },
35
+ ], ...a11y({
36
+ accessibilityRole: 'header',
37
+ }), ...(testId && e2eID(`${testId}-topnav-title`)) }, [title]),
38
+ (descriptionContent && (React.createElement(View, { style: {
39
+ alignItems: 'flex-start',
40
+ } }, descriptionContent))) ||
41
+ (description && (React.createElement(Body, { ellipsizeMode: 'tail', numberOfLines: 1, style: [
42
+ styles.description,
43
+ {
44
+ color: titleColor || theme.t('ColorTextBrandInverted'),
45
+ textAlign: centerTitle ? 'center' : 'left',
46
+ },
47
+ ], ...(testId && e2eID(`${testId}-topnav-description`)) }, description))))));
48
+ }
49
+ function RightComponent({ suffix }) {
50
+ return React.createElement(View, { style: styles.rightComponent }, suffix);
51
+ }
52
+ function Menu({ menuElement }) {
53
+ return (React.createElement(ScrollView, { horizontal: true, contentContainerStyle: styles.menu, showsHorizontalScrollIndicator: false, showsVerticalScrollIndicator: false }, menuElement));
54
+ }
55
+ function Search({ searchElement, colors }) {
56
+ const [isWhiteBackground, setIsWhiteBackground] = useState(false);
57
+ const { theme } = useTheme();
58
+ useEffect(() => {
59
+ setIsWhiteBackground(isWhiteColor(colors?.[0]) && isWhiteColor(colors?.[1]));
60
+ }, [colors]);
61
+ return (React.createElement(View, { style: [
62
+ styles.search,
63
+ {
64
+ ...(isWhiteBackground
65
+ ? {
66
+ backgroundColor: theme.t('ColorBackgroundContainerDefaultDefault'),
67
+ borderColor: theme.t('ColorBorderNeutralDefault'),
68
+ borderWidth: theme.t('SizeBorderS').number,
69
+ }
70
+ : {
71
+ backgroundColor: theme.t('ColorBackgroundContainerLightDefault'),
72
+ }),
73
+ },
74
+ ] },
75
+ React.createElement(PxIcon, { name: 'search', size: 'M', deprecatedColor: isWhiteBackground || !colors?.[0]
76
+ ? theme.t('ColorIconBrandDefault')
77
+ : colors?.[0], accessible: false, accessibilityElementsHidden: true, importantForAccessibility: 'no-hide-descendants' }),
78
+ React.createElement(View, { style: { flex: 1, marginLeft: 8 } }, searchElement)));
79
+ }
80
+ export function PxTopNavigation(props) {
81
+ const insets = useSafeAreaInsets();
82
+ return (React.createElement(LinearGradient, { colors: props.colors || ['#5C2D91', '#9F3ACE'], start: { x: 0, y: 1.0 }, end: { x: 1.0, y: 1.0 }, style: props.wrapperStyle },
83
+ React.createElement(View, { style: [
84
+ { paddingBottom: 8, paddingTop: insets.top }, // Horizontal padding is added in the children
85
+ ] },
86
+ React.createElement(Header, { ...props }),
87
+ props.menuElement && React.createElement(Menu, { ...props }),
88
+ props.searchElement && React.createElement(Search, { ...props }))));
89
+ }
90
+ function Header(props) {
91
+ return (React.createElement(View, { style: [styles.container] },
92
+ React.createElement(LeftComponent, { ...props }),
93
+ React.createElement(RightComponent, { ...props })));
94
+ }
95
+ const styles = StyleSheet.create({
96
+ container: {
97
+ flexDirection: 'row',
98
+ paddingHorizontal: 8,
99
+ },
100
+ title: {
101
+ margin: 8,
102
+ },
103
+ textHeader: {
104
+ fontSize: 16,
105
+ },
106
+ description: {
107
+ fontSize: 12,
108
+ },
109
+ leftComponent: {
110
+ flex: 1,
111
+ flexDirection: 'row',
112
+ alignItems: 'center',
113
+ justifyContent: 'flex-start',
114
+ },
115
+ rightComponent: {
116
+ flexDirection: 'row',
117
+ alignItems: 'center',
118
+ },
119
+ menu: {
120
+ paddingBottom: 8,
121
+ paddingTop: 16,
122
+ paddingHorizontal: 16,
123
+ gap: 8,
124
+ },
125
+ search: {
126
+ padding: 11,
127
+ borderRadius: 12,
128
+ marginVertical: 8,
129
+ marginHorizontal: 16,
130
+ flexDirection: 'row',
131
+ alignItems: 'center',
132
+ },
133
+ });
package/package.json CHANGED
@@ -1,41 +1,21 @@
1
1
  {
2
2
  "name": "@proximus/lavender-topnavigation-native",
3
- "version": "0.1.0-alpha.3",
3
+ "version": "0.1.0-beta.0",
4
4
  "description": "Lavender react native top navigation component",
5
5
  "license": "MIT",
6
- "main": "src/index.ts",
6
+ "main": "dist/index.js",
7
+ "files": [
8
+ "dist"
9
+ ],
7
10
  "type": "module",
8
- "scripts": {
9
- "clean": "rm -rf dist",
10
- "prepublish": "yarn clean && yarn build",
11
- "build": "npx tsc -p tsconfig.json"
12
- },
13
11
  "peerDependencies": {
14
- "@proximus/lavender-common-native": "workspace:*",
15
- "@proximus/lavender-icon-native": "workspace:*",
16
- "@proximus/lavender-styling-native": "workspace:*",
17
- "@proximus/lavender-texts-native": "workspace:*",
12
+ "@proximus/lavender-common-native": "*",
13
+ "@proximus/lavender-icon-native": "*",
14
+ "@proximus/lavender-styling-native": "*",
15
+ "@proximus/lavender-texts-native": "*",
18
16
  "react-native-gesture-handler": "*"
19
17
  },
20
- "devDependencies": {
21
- "@proximus/lavender-common-native": "0.1.0-alpha.4",
22
- "@proximus/lavender-icon-native": "0.1.0-alpha.4",
23
- "@proximus/lavender-styling-native": "0.1.0-alpha.3",
24
- "@proximus/lavender-texts-native": "0.1.0-alpha.4"
25
- },
26
18
  "publishConfig": {
27
19
  "access": "public"
28
- },
29
- "lerna": {
30
- "command": {
31
- "publish": {
32
- "assets": [
33
- "dist",
34
- "src",
35
- "package.json"
36
- ]
37
- }
38
- }
39
- },
40
- "gitHead": "6e9252a716a08ededdfbfd6f5b1db70ab21e026e"
20
+ }
41
21
  }
package/CHANGELOG.md DELETED
@@ -1,37 +0,0 @@
1
- # Change Log
2
-
3
- All notable changes to this project will be documented in this file.
4
- See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
-
6
- # [0.1.0-alpha.3](https://github.com/Pxs-Corporate/react-native-lavender/compare/@proximus/lavender-topnavigation-native@0.1.0-alpha.2...@proximus/lavender-topnavigation-native@0.1.0-alpha.3) (2025-09-19)
7
-
8
- **Note:** Version bump only for package @proximus/lavender-topnavigation-native
9
-
10
- # [0.1.0-alpha.2](https://github.com/Pxs-Corporate/react-native-lavender/compare/@proximus/lavender-topnavigation-native@0.1.0-alpha.1...@proximus/lavender-topnavigation-native@0.1.0-alpha.2) (2025-09-12)
11
-
12
- **Note:** Version bump only for package @proximus/lavender-topnavigation-native
13
-
14
- # [0.1.0-alpha.1](https://github.com/Pxs-Corporate/react-native-lavender/compare/@proximus/lavender-topnavigation-native@0.1.0-alpha.0...@proximus/lavender-topnavigation-native@0.1.0-alpha.1) (2025-09-05)
15
-
16
- ### Features
17
-
18
- - **BCRI-4279213:** update token architecture and component styles ([#18](https://github.com/Pxs-Corporate/react-native-lavender/issues/18)) ([2fabf41](https://github.com/Pxs-Corporate/react-native-lavender/commit/2fabf416ce069e9756daa868c3012181db87e7f5))
19
-
20
- # 0.1.0-alpha.0 (2025-08-14)
21
-
22
- ### Bug Fixes
23
-
24
- - **BCRI-3998258:** long title-description truncation ([d3cde41](https://github.com/Pxs-Corporate/react-native-lavender/commit/d3cde41c876c8c1fb38e98773b7a5c78635bb9ce))
25
- - **BCRI-4210372:** fix types field in modules ([68ac126](https://github.com/Pxs-Corporate/react-native-lavender/commit/68ac12657112473ae9e0e683076b1d9172be9ce6))
26
- - **BCRI-4210372:** topnavigation version number ([675d1c3](https://github.com/Pxs-Corporate/react-native-lavender/commit/675d1c3371d3d9505a3df5c005fc7bd47850654b))
27
-
28
- ### Features
29
-
30
- - **BCRI-000000:** remove default E2E on DEV env build for all components ([a5d27bf](https://github.com/Pxs-Corporate/react-native-lavender/commit/a5d27bfaaebf5b75f3160f31c64b590b7bd00b93))
31
- - **BCRI-3619796:** top navigation bar ([0b2bcae](https://github.com/Pxs-Corporate/react-native-lavender/commit/0b2bcaee7243b9f00f88e2b2fb97d86cf0cf5b77))
32
- - **BCRI-3651772:** top navigation module ([8be234c](https://github.com/Pxs-Corporate/react-native-lavender/commit/8be234c30f8a35093ff306b25512ebf1e10e75f2))
33
- - **BCRI-3660857:** cell components ([af9e45c](https://github.com/Pxs-Corporate/react-native-lavender/commit/af9e45cefc20d08d2338380ff4cd8cd6851abe24))
34
- - **BCRI-3713127:** demo app ([6907714](https://github.com/Pxs-Corporate/react-native-lavender/commit/6907714ac2313813bf74657a72cf5cb10c99fec3))
35
- - **BCRI-4002610:** update icon handling and remove deprecated font references ([4399fe4](https://github.com/Pxs-Corporate/react-native-lavender/commit/4399fe4bff06aa70f5c29705fcc89d5243b0e3e7))
36
- - **BCRI-4002610:** update package versions and add new dependencies for styling and icon handling ([bd36e12](https://github.com/Pxs-Corporate/react-native-lavender/commit/bd36e120c36fd33602f441ceed5f41f15f81f0ea))
37
- - **BCRI-4210372:** automatic versionning ([9c1f0a0](https://github.com/Pxs-Corporate/react-native-lavender/commit/9c1f0a00e19a9d1a277044ea627632032a674102))
@@ -1,243 +0,0 @@
1
- import {
2
- ScrollView,
3
- StyleProp,
4
- StyleSheet,
5
- View,
6
- ViewStyle,
7
- } from 'react-native';
8
- import React, { useEffect, useState } from 'react';
9
- import LinearGradient from 'react-native-linear-gradient';
10
- import { a11y } from '@proximus/lavender-common-native';
11
- import { Body, Header as TextHeader } from '@proximus/lavender-texts-native';
12
- import { useSafeAreaInsets } from 'react-native-safe-area-context';
13
- import { PxIcon } from '@proximus/lavender-icon-native';
14
- import { useTheme } from '@proximus/lavender-styling-native';
15
-
16
- function isWhiteColor(color: string | number | undefined): boolean {
17
- if (!color) return false;
18
- const str = color.toString().trim();
19
- // Hex: #fff, #ffffff, fff, ffffff (case-insensitive)
20
- if (/^#?fff(f)?(f)?$/i.test(str.replace(/^#/, ''))) return true;
21
- // RGB: rgb(255,255,255) or with spaces
22
- if (/^rgb\(\s*255\s*,\s*255\s*,\s*255\s*\)$/i.test(str)) return true;
23
- // RGBA: rgba(255,255,255,1) or with spaces, alpha 1 or 1.0 or 100%
24
- if (
25
- /^rgba\(\s*255\s*,\s*255\s*,\s*255\s*,\s*(1(\.0+)?|100%|1\.0+)\s*\)$/i.test(
26
- str
27
- )
28
- )
29
- return true;
30
- return false;
31
- }
32
-
33
- export interface PxTopNavigationProps {
34
- title: string;
35
- titleColor?: string;
36
- centerTitle?: boolean;
37
- colors?: (string | number)[];
38
- description?: string;
39
- testId?: string;
40
- wrapperStyle?: StyleProp<ViewStyle>;
41
- menuElement?: React.ReactNode;
42
- searchElement?: React.ReactNode;
43
- accessibilityLabel?: string;
44
- prefix?: React.ReactNode;
45
- suffix?: React.ReactNode;
46
- descriptionContent?: React.ReactNode;
47
- }
48
-
49
- function LeftComponent({
50
- title,
51
- titleColor,
52
- description,
53
- prefix,
54
- descriptionContent,
55
- centerTitle = false,
56
- }: PxTopNavigationProps) {
57
- const { theme } = useTheme();
58
-
59
- return (
60
- <View style={styles.leftComponent}>
61
- {prefix}
62
- <View style={[styles.title, { flex: 1 }]}>
63
- <TextHeader
64
- ellipsizeMode={'tail'}
65
- numberOfLines={1}
66
- style={[
67
- styles.textHeader,
68
- {
69
- color: titleColor || theme.t('ColorTextBrandInverted'),
70
- textAlign: centerTitle ? 'center' : 'left',
71
- },
72
- ]}
73
- {...a11y({
74
- accessibilityRole: 'header',
75
- })}
76
- >
77
- {[title]}
78
- </TextHeader>
79
- {(descriptionContent && (
80
- <View
81
- style={{
82
- alignItems: 'flex-start',
83
- }}
84
- >
85
- {descriptionContent}
86
- </View>
87
- )) ||
88
- (description && (
89
- <Body
90
- ellipsizeMode={'tail'}
91
- numberOfLines={1}
92
- style={[
93
- styles.description,
94
- {
95
- color: titleColor || theme.t('ColorTextBrandInverted'),
96
- textAlign: centerTitle ? 'center' : 'left',
97
- },
98
- ]}
99
- >
100
- {description}
101
- </Body>
102
- ))}
103
- </View>
104
- </View>
105
- );
106
- }
107
-
108
- function RightComponent({ suffix }: PxTopNavigationProps) {
109
- return <View style={styles.rightComponent}>{suffix}</View>;
110
- }
111
-
112
- function Menu({ menuElement }: PxTopNavigationProps) {
113
- return (
114
- <ScrollView
115
- horizontal={true}
116
- contentContainerStyle={styles.menu}
117
- showsHorizontalScrollIndicator={false}
118
- showsVerticalScrollIndicator={false}
119
- >
120
- {menuElement}
121
- </ScrollView>
122
- );
123
- }
124
-
125
- function Search({ searchElement, colors }: PxTopNavigationProps) {
126
- const [isWhiteBackground, setIsWhiteBackground] = useState(false);
127
-
128
- const { theme } = useTheme();
129
-
130
- useEffect(() => {
131
- setIsWhiteBackground(
132
- isWhiteColor(colors?.[0]) && isWhiteColor(colors?.[1])
133
- );
134
- }, [colors]);
135
- return (
136
- <View
137
- style={[
138
- styles.search,
139
- {
140
- ...(isWhiteBackground
141
- ? {
142
- backgroundColor: theme.t(
143
- 'ColorBackgroundContainerDefaultDefault'
144
- ),
145
- borderColor: theme.t('ColorBorderNeutralDefault'),
146
- borderWidth: theme.t('SizeBorderS').number,
147
- }
148
- : {
149
- backgroundColor: theme.t(
150
- 'ColorBackgroundContainerLightDefault'
151
- ),
152
- }),
153
- },
154
- ]}
155
- >
156
- <PxIcon
157
- name={'search'}
158
- size={24}
159
- color={
160
- isWhiteBackground || !colors?.[0]
161
- ? theme.t('ColorIconBrandDefault')
162
- : (colors?.[0] as string)
163
- }
164
- accessible={false}
165
- accessibilityElementsHidden={true}
166
- importantForAccessibility={'no-hide-descendants'}
167
- />
168
- <View style={{ flex: 1, marginLeft: 8 }}>{searchElement}</View>
169
- </View>
170
- );
171
- }
172
-
173
- export function PxTopNavigation(props: PxTopNavigationProps) {
174
- const insets = useSafeAreaInsets();
175
-
176
- return (
177
- <LinearGradient
178
- colors={props.colors || ['#5C2D91', '#9F3ACE']}
179
- start={{ x: 0, y: 1.0 }}
180
- end={{ x: 1.0, y: 1.0 }}
181
- style={props.wrapperStyle as any}
182
- >
183
- <View
184
- style={[
185
- { paddingBottom: 8, paddingTop: insets.top }, // Horizontal padding is added in the children
186
- ]}
187
- >
188
- <Header {...props} />
189
- {props.menuElement && <Menu {...props} />}
190
- {props.searchElement && <Search {...props} />}
191
- </View>
192
- </LinearGradient>
193
- );
194
- }
195
-
196
- function Header(props: PxTopNavigationProps) {
197
- return (
198
- <View style={[styles.container]}>
199
- <LeftComponent {...props} />
200
- <RightComponent {...props} />
201
- </View>
202
- );
203
- }
204
-
205
- const styles = StyleSheet.create({
206
- container: {
207
- flexDirection: 'row',
208
- paddingHorizontal: 8,
209
- },
210
- title: {
211
- margin: 8,
212
- },
213
- textHeader: {
214
- fontSize: 16,
215
- },
216
- description: {
217
- fontSize: 12,
218
- },
219
- leftComponent: {
220
- flex: 1,
221
- flexDirection: 'row',
222
- alignItems: 'center',
223
- justifyContent: 'flex-start',
224
- },
225
- rightComponent: {
226
- flexDirection: 'row',
227
- alignItems: 'center',
228
- },
229
- menu: {
230
- paddingBottom: 8,
231
- paddingTop: 16,
232
- paddingHorizontal: 16,
233
- gap: 8,
234
- },
235
- search: {
236
- padding: 11,
237
- borderRadius: 12,
238
- marginVertical: 8,
239
- marginHorizontal: 16,
240
- flexDirection: 'row',
241
- alignItems: 'center',
242
- },
243
- });
package/tsconfig.json DELETED
@@ -1,8 +0,0 @@
1
- {
2
- "extends": "../../../tsconfig.npm.json",
3
- "compilerOptions": {
4
- "outDir": "dist"
5
- },
6
- "include": ["src","../../../lib.d.ts"],
7
- "exclude": ["dist", "node_modules", "src/**/*.test.ts", "src/**/*.spec.ts"]
8
- }
File without changes