@proximus/lavender-topnavigation-native 0.1.0-alpha.5 → 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"}
@@ -1,7 +1,7 @@
1
1
  import { ScrollView, StyleSheet, View, } from 'react-native';
2
2
  import React, { useEffect, useState } from 'react';
3
3
  import LinearGradient from 'react-native-linear-gradient';
4
- import { a11y } from '@proximus/lavender-common-native';
4
+ import { a11y, e2eID } from '@proximus/lavender-common-native';
5
5
  import { Body, Header as TextHeader } from '@proximus/lavender-texts-native';
6
6
  import { useSafeAreaInsets } from 'react-native-safe-area-context';
7
7
  import { PxIcon } from '@proximus/lavender-icon-native';
@@ -21,7 +21,7 @@ function isWhiteColor(color) {
21
21
  return true;
22
22
  return false;
23
23
  }
24
- function LeftComponent({ title, titleColor, description, prefix, descriptionContent, centerTitle = false, }) {
24
+ function LeftComponent({ title, titleColor, description, prefix, descriptionContent, centerTitle = false, testId, }) {
25
25
  const { theme } = useTheme();
26
26
  return (React.createElement(View, { style: styles.leftComponent },
27
27
  prefix,
@@ -34,7 +34,7 @@ function LeftComponent({ title, titleColor, description, prefix, descriptionCont
34
34
  },
35
35
  ], ...a11y({
36
36
  accessibilityRole: 'header',
37
- }) }, [title]),
37
+ }), ...(testId && e2eID(`${testId}-topnav-title`)) }, [title]),
38
38
  (descriptionContent && (React.createElement(View, { style: {
39
39
  alignItems: 'flex-start',
40
40
  } }, descriptionContent))) ||
@@ -44,7 +44,7 @@ function LeftComponent({ title, titleColor, description, prefix, descriptionCont
44
44
  color: titleColor || theme.t('ColorTextBrandInverted'),
45
45
  textAlign: centerTitle ? 'center' : 'left',
46
46
  },
47
- ] }, description))))));
47
+ ], ...(testId && e2eID(`${testId}-topnav-description`)) }, description))))));
48
48
  }
49
49
  function RightComponent({ suffix }) {
50
50
  return React.createElement(View, { style: styles.rightComponent }, suffix);
@@ -72,7 +72,7 @@ function Search({ searchElement, colors }) {
72
72
  }),
73
73
  },
74
74
  ] },
75
- React.createElement(PxIcon, { name: 'search', size: 24, color: isWhiteBackground || !colors?.[0]
75
+ React.createElement(PxIcon, { name: 'search', size: 'M', deprecatedColor: isWhiteBackground || !colors?.[0]
76
76
  ? theme.t('ColorIconBrandDefault')
77
77
  : colors?.[0], accessible: false, accessibilityElementsHidden: true, importantForAccessibility: 'no-hide-descendants' }),
78
78
  React.createElement(View, { style: { flex: 1, marginLeft: 8 } }, searchElement)));
package/package.json CHANGED
@@ -1,48 +1,21 @@
1
1
  {
2
2
  "name": "@proximus/lavender-topnavigation-native",
3
- "version": "0.1.0-alpha.5",
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
- "transform-package-json": "node ../../../scripts/tranformPackageJson.js package.json dist/far/away",
11
- "prepublish": "yarn clean && yarn transform-package-json && yarn build",
12
- "build": "npx tsc -p tsconfig.json"
13
- },
14
11
  "peerDependencies": {
15
- "@proximus/lavender-common-native": "workspace:*",
16
- "@proximus/lavender-icon-native": "workspace:*",
17
- "@proximus/lavender-styling-native": "workspace:*",
18
- "@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": "*",
19
16
  "react-native-gesture-handler": "*"
20
17
  },
21
- "devDependencies": {
22
- "@proximus/lavender-common-native": "0.1.0-alpha.6",
23
- "@proximus/lavender-icon-native": "0.1.0-alpha.6",
24
- "@proximus/lavender-styling-native": "0.1.0-alpha.5",
25
- "@proximus/lavender-texts-native": "0.1.0-alpha.6"
26
- },
27
18
  "publishConfig": {
28
19
  "access": "public"
29
- },
30
- "lerna": {
31
- "command": {
32
- "publish": {
33
- "assets": [
34
- {
35
- "from": "dist/far/away/package.json",
36
- "to": "."
37
- },
38
- "dist/*.js",
39
- "dist/*.d.ts",
40
- "dist/*.d.ts.map",
41
- "src",
42
- "package.json"
43
- ]
44
- }
45
- }
46
- },
47
- "gitHead": "e50a17526561b3eafb159e36c737173956093e0d"
20
+ }
48
21
  }
package/CHANGELOG.md DELETED
@@ -1,14 +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.5](https://github.com/Pxs-Corporate/react-native-lavender/compare/@proximus/lavender-topnavigation-native@0.1.0-alpha.4...@proximus/lavender-topnavigation-native@0.1.0-alpha.5) (2025-09-26)
7
-
8
- **Note:** Version bump only for package @proximus/lavender-topnavigation-native
9
-
10
- # [0.1.0-alpha.4](https://github.com/Pxs-Corporate/react-native-lavender/compare/@proximus/lavender-topnavigation-native@0.1.0-alpha.3...@proximus/lavender-topnavigation-native@0.1.0-alpha.4) (2025-09-25)
11
-
12
- ### Bug Fixes
13
-
14
- - **BCRI-000000:** no free space on gh runner during build ([#27](https://github.com/Pxs-Corporate/react-native-lavender/issues/27)) ([a7c8604](https://github.com/Pxs-Corporate/react-native-lavender/commit/a7c86043b5cefcb10fd768d449c5718fbabe87ec))
@@ -1,36 +0,0 @@
1
- {
2
- "name": "@proximus/lavender-topnavigation-native",
3
- "version": "0.1.0-alpha.5",
4
- "description": "Lavender react native top navigation component",
5
- "license": "MIT",
6
- "main": "dist/index.js",
7
- "type": "module",
8
- "peerDependencies": {
9
- "@proximus/lavender-common-native": "*",
10
- "@proximus/lavender-icon-native": "*",
11
- "@proximus/lavender-styling-native": "*",
12
- "@proximus/lavender-texts-native": "*",
13
- "react-native-gesture-handler": "*"
14
- },
15
- "publishConfig": {
16
- "access": "public"
17
- },
18
- "lerna": {
19
- "command": {
20
- "publish": {
21
- "assets": [
22
- {
23
- "from": "dist/far/away/package.json",
24
- "to": "."
25
- },
26
- "dist/*.js",
27
- "dist/*.d.ts",
28
- "dist/*.d.ts.map",
29
- "src",
30
- "package.json"
31
- ]
32
- }
33
- }
34
- },
35
- "gitHead": "e50a17526561b3eafb159e36c737173956093e0d"
36
- }
@@ -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/src/index.ts DELETED
@@ -1 +0,0 @@
1
- export { PxTopNavigation } from './PxTopNavigation';
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/**/*.spec.tsx", "src/**/*.spec.ts"]
8
- }