@widergy/mobile-ui 1.15.1 → 1.16.1

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/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ ## [1.16.1](https://github.com/widergy/mobile-ui/compare/v1.16.0...v1.16.1) (2024-07-31)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * dependencies fixes ([#326](https://github.com/widergy/mobile-ui/issues/326)) ([69444ae](https://github.com/widergy/mobile-ui/commit/69444aeebe68a79d88a9c0d2373d3c0c4c963479))
7
+
8
+ # [1.16.0](https://github.com/widergy/mobile-ui/compare/v1.15.1...v1.16.0) (2024-07-31)
9
+
10
+
11
+ ### Features
12
+
13
+ * internal color and widergy icons added ([#324](https://github.com/widergy/mobile-ui/issues/324)) ([a1974cf](https://github.com/widergy/mobile-ui/commit/a1974cfd023990bb82198b2cb2bc821ecd44f3a3))
14
+
1
15
  ## [1.15.1](https://github.com/widergy/mobile-ui/compare/v1.15.0...v1.15.1) (2024-07-31)
2
16
 
3
17
 
@@ -13,13 +13,14 @@ For a comprehensive list of available icons and their design specifications, ref
13
13
 
14
14
  ## Props
15
15
 
16
- | Name | Type | Default | Description |
17
- | ---------- | ------ | ------- | --------------------------------------------------- |
18
- | colorTheme | string | 'dark' | The icon color, must be from the theme palette. |
19
- | name | string | | The name of the icon from the Tabler Icons library. |
20
- | shade | string | | The shade of the color theme to use. |
21
- | size | number | | The size of the icon. |
22
- | style | object | | Custom styles to apply to the icon. |
16
+ | Name | Type | Default | Description |
17
+ | ---------- | ------ | ------- | ------------------------------------------------------- |
18
+ | colorTheme | string | 'dark' | The icon color, must be from the theme palette. |
19
+ | fillTheme | string | | The internal fill color must be from the theme palette. |
20
+ | name | string | | The name of the icon from the Tabler Icons library. |
21
+ | shade | string | | The shade of the color theme to use. |
22
+ | size | number | | The size of the icon. |
23
+ | style | object | | Custom styles to apply to the icon. |
23
24
 
24
25
  ## Icon Names
25
26
 
@@ -39,6 +40,11 @@ Example:
39
40
 
40
41
  Exceptions to these rules may exist.
41
42
 
43
+ ###### Custom Widergy icons are now available.
44
+
45
+ The convection to use is: Energy + Icon + Name.
46
+ Example: EnergyIconDelivery
47
+
42
48
  ## Color Themes
43
49
 
44
50
  The `colorTheme` prop must be one of these values:
@@ -72,6 +78,39 @@ For `gray`: `shade04`
72
78
  For `light`: `shade01`
73
79
  For all others: `shade05`
74
80
 
81
+ ## Fill Theme (opcional)
82
+
83
+ The `fillTheme` prop could be one of these values:
84
+
85
+ - `accent`
86
+ - `dark`
87
+ - `error`
88
+ - `gray`
89
+ - `information`
90
+ - `light`
91
+ - `negative`
92
+ - `neutral`
93
+ - `success`
94
+ - `warning`
95
+
96
+ Clarifications:
97
+
98
+ - Note that not all icons look good with an internal fill color.
99
+
100
+ ## Fill Shade (opcional)
101
+
102
+ The `fillShade` prop must be one of these:
103
+
104
+ - `01`
105
+ - `02`
106
+ - `03`
107
+ - `04`
108
+ - `05`
109
+
110
+ Clarifications:
111
+
112
+ - The default shade is '02' (if 'fillTheme' exists).
113
+
75
114
  ## Usage
76
115
 
77
116
  ```javascript
@@ -0,0 +1,17 @@
1
+ <svg
2
+ xmlns="http://www.w3.org/2000/svg"
3
+ width="24"
4
+ height="24"
5
+ viewBox="0 0 24 24"
6
+ fill="none"
7
+ stroke="currentColor"
8
+ stroke-width="1.5"
9
+ stroke-linecap="round"
10
+ stroke-linejoin="round"
11
+ class="icon icon-tabler icons-tabler-outline icon-tabler-car"
12
+ >
13
+ <path stroke="none" d="M0 0h24v24H0z" fill="none" />
14
+ <path d="M5 17h-2v-6l2 -5h9l4 5h1a2 2 0 0 1 2 2v4h-2m-4 0h-6m-6 -6h15m-6 0v-5" />
15
+ <path d="M7 17m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0" />
16
+ <path d="M17 17m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0" />
17
+ </svg>
@@ -0,0 +1,6 @@
1
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M4 19C4 19.5304 4.21071 20.0391 4.58579 20.4142C4.96086 20.7893 5.46957 21 6 21C6.53043 21 7.03914 20.7893 7.41421 20.4142C7.78929 20.0391 8 19.5304 8 19C8 18.4696 7.78929 17.9609 7.41421 17.5858C7.03914 17.2107 6.53043 17 6 17C5.46957 17 4.96086 17.2107 4.58579 17.5858C4.21071 17.9609 4 18.4696 4 19Z" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
3
+ <path d="M15 19C15 19.5304 15.2107 20.0391 15.5858 20.4142C15.9609 20.7893 16.4696 21 17 21C17.5304 21 18.0391 20.7893 18.4142 20.4142C18.7893 20.0391 19 19.5304 19 19C19 18.4696 18.7893 17.9609 18.4142 17.5858C18.0391 17.2107 17.5304 17 17 17C16.4696 17 15.9609 17.2107 15.5858 17.5858C15.2107 17.9609 15 18.4696 15 19Z" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
4
+ <path d="M6 5L20 6L19 13H6" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
5
+ <path d="M4 3H6V17H17" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" fill="none"/>
6
+ </svg>
@@ -0,0 +1,5 @@
1
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M9.02 2.84016L3.63 7.04016C2.73 7.74016 2 9.23016 2 10.3602V17.7702C2 20.0902 3.89 21.9902 6.21 21.9902H17.79C20.11 21.9902 22 20.0902 22 17.7802V10.5002C22 9.29016 21.19 7.74016 20.2 7.05016L14.02 2.72016C12.62 1.74016 10.37 1.79016 9.02 2.84016Z" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
3
+ <path d="M12 17.9902V14.9902V17.9902Z" />
4
+ <path d="M12 17.9902V14.9902" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
5
+ </svg>
@@ -0,0 +1,7 @@
1
+ <svg width="24" height="24" viewBox="0 0 64 64" fill="none" stroke="currentColor" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M8 45.3333V13.3333H34.6667V16H48L56 29.3333V45.3333H52C49.8658 49.5691 48.3837 50.634 45.3333 50.6666C41.734 50.2423 40.547 49.0674 40 45.3333H24C23.6323 49.2151 22.3927 50.3076 18.6667 50.6666C14.9687 49.8222 13.6336 48.7628 13.3333 45.3333H8Z" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/>
3
+ <path d="M13.3333 45.3333C13.3333 46.7478 13.8952 48.1044 14.8954 49.1046C15.8956 50.1048 17.2522 50.6667 18.6667 50.6667C20.0812 50.6667 21.4377 50.1048 22.4379 49.1046C23.4381 48.1044 24 46.7478 24 45.3333C24 43.9188 23.4381 42.5623 22.4379 41.5621C21.4377 40.5619 20.0812 40 18.6667 40C17.2522 40 15.8956 40.5619 14.8954 41.5621C13.8952 42.5623 13.3333 43.9188 13.3333 45.3333Z" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/>
4
+ <path d="M40 45.3333C40 46.7478 40.5619 48.1044 41.5621 49.1046C42.5623 50.1048 43.9188 50.6667 45.3333 50.6667C46.7478 50.6667 48.1044 50.1048 49.1046 49.1046C50.1048 48.1044 50.6667 46.7478 50.6667 45.3333C50.6667 43.9188 50.1048 42.5623 49.1046 41.5621C48.1044 40.5619 46.7478 40 45.3333 40C43.9188 40 42.5623 40.5619 41.5621 41.5621C40.5619 42.5623 40 43.9188 40 45.3333Z" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/>
5
+ <path d="M13.3333 45.3333H8V34.6666M5.33334 13.3333H34.6667V45.3333M24 45.3333H40M50.6667 45.3333H56V29.3333M56 29.3333H34.6667M56 29.3333L48 16H34.6667" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/>
6
+ <path d="M8 24H18.6667" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/>
7
+ </svg>
@@ -1,3 +1,8 @@
1
+ import EnergyIconCar from './components/EnergyIcons/EnergyIconCar.svg';
2
+ import EnergyIconCart from './components/EnergyIcons/EnergyIconCart.svg';
3
+ import EnergyIconHome from './components/EnergyIcons/EnergyIconHome.svg';
4
+ import EnergyIconTruck from './components/EnergyIcons/EnergyIconTruck.svg';
5
+
1
6
  export const SHADES = {
2
7
  shade01: '01',
3
8
  shade02: '02',
@@ -22,3 +27,12 @@ export const COLOR_THEMES = {
22
27
  export const DEFAULT_PROPS = {
23
28
  color: 'dark'
24
29
  };
30
+
31
+ export const DEFAULT_INTERNAL_SHADE = SHADES.shade02;
32
+
33
+ export const ENERGY_ICONS = {
34
+ EnergyIconCar,
35
+ EnergyIconCart,
36
+ EnergyIconHome,
37
+ EnergyIconTruck
38
+ };
@@ -5,19 +5,28 @@ import * as TablerIcons from '@tabler/icons-react-native';
5
5
 
6
6
  import { useTheme } from '../../theming';
7
7
 
8
- import { retrieveColor } from './theme';
8
+ import { ENERGY_ICONS } from './constants';
9
+ import { getIconProps } from './utils';
9
10
 
10
- const UTIcon = ({ color, colorTheme = 'dark', name, shade, size, style }) => {
11
+ const UTIcon = ({ color, colorTheme = 'dark', fillShade, fillTheme, name, shade, size, style }) => {
11
12
  const theme = useTheme();
12
13
 
13
- const IconComponent = TablerIcons[name];
14
+ const IconComponent = ENERGY_ICONS[name] || TablerIcons[name];
14
15
  if (!IconComponent) return null;
15
16
 
16
- const themeColor = retrieveColor({ colorTheme: color || colorTheme, theme, shade });
17
- const filled = name.endsWith('Filled');
18
- const iconColor = filled ? 'transparent' : themeColor;
19
-
20
- return <IconComponent color={iconColor} size={size} style={[filled && { color: themeColor }, style]} />;
17
+ const iconProps = getIconProps({
18
+ color,
19
+ colorTheme,
20
+ fillShade,
21
+ fillTheme,
22
+ name,
23
+ shade,
24
+ size,
25
+ style,
26
+ theme
27
+ });
28
+
29
+ return <IconComponent {...iconProps} />;
21
30
  };
22
31
 
23
32
  UTIcon.propTypes = {
@@ -26,6 +35,8 @@ UTIcon.propTypes = {
26
35
  */
27
36
  color: string,
28
37
  colorTheme: string,
38
+ fillShade: string,
39
+ fillTheme: string,
29
40
  name: string,
30
41
  shade: string,
31
42
  size: number,
@@ -1 +1,35 @@
1
+ import { DEFAULT_INTERNAL_SHADE } from './constants';
2
+ import { retrieveColor } from './theme';
3
+
1
4
  export const isUTIcon = icon => typeof icon === 'string';
5
+
6
+ export const getIconProps = ({
7
+ name,
8
+ theme,
9
+ color,
10
+ colorTheme,
11
+ shade,
12
+ fillTheme,
13
+ fillShade,
14
+ size,
15
+ style
16
+ }) => {
17
+ const themeColor = retrieveColor({ colorTheme: color || colorTheme, theme, shade });
18
+ const filled = name.endsWith('Filled');
19
+ const isEnergyIcon = name.startsWith('Energy');
20
+ const iconColor = filled ? 'transparent' : themeColor;
21
+ const internalFill =
22
+ fillTheme && retrieveColor({ colorTheme: fillTheme, theme, shade: fillShade || DEFAULT_INTERNAL_SHADE });
23
+
24
+ const defaultIconProps = { color: iconColor, size };
25
+ const energyIconProps = {
26
+ stroke: iconColor,
27
+ ...(size && { width: size, height: size })
28
+ };
29
+
30
+ return {
31
+ style: [filled && { color: themeColor }, style],
32
+ ...(internalFill && { fill: internalFill }),
33
+ ...(isEnergyIcon ? energyIconProps : defaultIconProps)
34
+ };
35
+ };
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@widergy/mobile-ui",
3
3
  "description": "Widergy Mobile Components",
4
4
  "author": "widergy",
5
- "version": "1.15.1",
5
+ "version": "1.16.1",
6
6
  "repository": "https://github.com/widergy/mobile-ui.git",
7
7
  "main": "lib/index.js",
8
8
  "files": [
@@ -47,7 +47,7 @@
47
47
  "react-native-modal": "^13.0.1",
48
48
  "react-native-pager-view": "^6.2.1",
49
49
  "react-native-svg": "^13.13.0",
50
- "react-native-safe-area-context": "4.10.1"
50
+ "react-native-safe-area-context": "^4.5.0"
51
51
  },
52
52
  "devDependencies": {
53
53
  "@babel/cli": "^7.22.10",