@widergy/mobile-ui 1.1.0 → 1.2.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.2.1](https://github.com/widergy/mobile-ui/compare/v1.2.0...v1.2.1) (2024-03-08)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * added utworkflowcontainer readmes ([#262](https://github.com/widergy/mobile-ui/issues/262)) ([47204d6](https://github.com/widergy/mobile-ui/commit/47204d6bfc4e54a605d4007090622450c004e063))
7
+
8
+ # [1.2.0](https://github.com/widergy/mobile-ui/compare/v1.1.0...v1.2.0) (2024-03-01)
9
+
10
+
11
+ ### Features
12
+
13
+ * added left icon placement for button and fixed button icons ([#260](https://github.com/widergy/mobile-ui/issues/260)) ([a4bd297](https://github.com/widergy/mobile-ui/commit/a4bd297a2a49bfac3bbf7efb1af53b9506b06bf9))
14
+
1
15
  # [1.1.0](https://github.com/widergy/mobile-ui/compare/v1.0.0...v1.1.0) (2024-02-26)
2
16
 
3
17
 
@@ -4,3 +4,8 @@ export const CONTAINED_ELEVATION = 2;
4
4
  export const CONTAINED = 'contained';
5
5
  export const OUTLINED = 'outlined';
6
6
  export const TEXT = 'text';
7
+
8
+ export const ICON_PLACEMENTS = {
9
+ left: 'left',
10
+ right: 'right'
11
+ };
@@ -9,7 +9,7 @@ import { withTheme } from '../../theming';
9
9
 
10
10
  import propTypes, { buttonDefaultProps } from './propTypes';
11
11
  import styles, { getThemeStyles, getButtonModeStyles, getEffectColor } from './styles';
12
- import { NO_ELEVATION, OUTLINED, TEXT } from './constants';
12
+ import { ICON_PLACEMENTS, NO_ELEVATION, OUTLINED, TEXT } from './constants';
13
13
 
14
14
  const Button = ({
15
15
  color,
@@ -20,6 +20,7 @@ const Button = ({
20
20
  elevation,
21
21
  icon,
22
22
  iconStyle,
23
+ iconPlacement,
23
24
  labelColor,
24
25
  testID,
25
26
  labelProps,
@@ -59,7 +60,7 @@ const Button = ({
59
60
  effectColor={getEffectColor(textColor, theme, effectColor)}
60
61
  >
61
62
  <View style={[styles.button, contentStyle]}>
62
- {icon && (
63
+ {icon && iconPlacement !== ICON_PLACEMENTS.right && (
63
64
  <Icon
64
65
  color={textColor}
65
66
  name={icon.name}
@@ -75,6 +76,17 @@ const Button = ({
75
76
  {lowerCase ? title : title.toUpperCase()}
76
77
  </Label>
77
78
  )}
79
+ {icon && iconPlacement === ICON_PLACEMENTS.right && (
80
+ <Icon
81
+ color={textColor}
82
+ name={icon.name}
83
+ type={icon.type}
84
+ style={[title && styles.rightIcon, iconStyle]}
85
+ size={icon.size || themeStyles.fontSize}
86
+ width={icon.width}
87
+ height={icon.height}
88
+ />
89
+ )}
78
90
  </View>
79
91
  </Touchable>
80
92
  </Surface>
@@ -82,11 +82,14 @@ export default StyleSheet.create({
82
82
  overflow: 'hidden'
83
83
  },
84
84
  leftIcon: {
85
- paddingRight: portraitHorizontalScale(8)
85
+ marginRight: portraitHorizontalScale(8)
86
86
  },
87
87
  outerContainer: {
88
88
  alignItems: 'center'
89
89
  },
90
+ rightIcon: {
91
+ marginLeft: portraitHorizontalScale(8)
92
+ },
90
93
  touchable: {
91
94
  alignItems: 'center',
92
95
  justifyContent: 'center'
@@ -0,0 +1,19 @@
1
+ # UTBanner
2
+
3
+ ### Description
4
+
5
+ This component displays a banner with information
6
+
7
+ ## Props
8
+
9
+ | Name | Type | Default | Description |
10
+ | ----- | --------- | ------- | ----------- |
11
+ | icon | iconType | | Icon to be displayed at the left side of the banner. |
12
+ | style | ViewStyle | | Custom optional styles to be applied to the banner. |
13
+ | text | string | | Text that will be displayed inside the banner. |
14
+
15
+ ### Custom Types
16
+
17
+ | Type | Shape |
18
+ | ----------- | ----- |
19
+ | iconType | `{ name: string, type: string }` |
@@ -0,0 +1,24 @@
1
+ # UTHeader
2
+
3
+ ### Description
4
+
5
+ This component displays a series of texts in different variants. It also handles a dropdown menu for actions in the top right corner
6
+
7
+ ## Props
8
+
9
+ | Name | Type | Default | Description |
10
+ | ------------------ | ----------- | ------- | ----------- |
11
+ | banner | bannerType | | Renders a banner at the bottom of the header. |
12
+ | helpText | string | | Text that will be rendered at the bottom of the header. |
13
+ | requiredFieldInfo | string | | Text to display as a helper for required fields, it will be rendered below the description. |
14
+ | subtitle | string | | Text that will be rendered below the title. |
15
+ | tagline | string | | Text that will be rendered in uppercase on top of the title. |
16
+ | title | string | | Main text rendered in the middle of the header. |
17
+ | useMarkdown | bool | | Defines whether to use markdown in the components |
18
+
19
+ ### Custom Types
20
+
21
+ | Type | Shape |
22
+ | ----------- | ----- |
23
+ | bannerType | `{ text: string, icon: iconType }` |
24
+ | iconType | `{ name: string, type: string }` |
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { View } from 'react-native';
3
- import { string, bool, shape, element } from 'prop-types';
3
+ import { string, bool, shape } from 'prop-types';
4
4
 
5
5
  import Label from '../Label';
6
6
  import UTBanner from '../UTBanner';
@@ -42,7 +42,7 @@ const Header = ({ tagline, title, subtitle, requiredFieldInfo, helpText, useMark
42
42
 
43
43
  Header.propTypes = {
44
44
  banner: shape({
45
- Icon: element,
45
+ icon: shape({ name: string, type: string }),
46
46
  text: string
47
47
  }),
48
48
  helpText: string,
@@ -0,0 +1,18 @@
1
+ # UTStepper
2
+
3
+ ### Description
4
+
5
+ This components displays a chain of rounded icons which can be gradually completed and represent progress through a series of steps
6
+
7
+ ## Props
8
+
9
+ | Name | Type | Default | Description |
10
+ | ------------------ | ----------- | ------- | ----------- |
11
+ | currentStage | number | | Receives a number that represents which stage id will be active. |
12
+ | stages | stageType | | Defines the structure of the stepper indicator. It is required for each element inside the array given to have a property `id`, the indicator will be ordered by id. |
13
+
14
+ ### Custom Types
15
+
16
+ | Type | Shape |
17
+ | ----------- | ----- |
18
+ | stageType | arrayOf( `{ id: number }` ) |
@@ -0,0 +1,23 @@
1
+ # UTTopbar
2
+
3
+ ### Description
4
+
5
+ This components replaces the native topbar when needed more complex behaviour
6
+
7
+ ## Props
8
+
9
+ | Name | Type | Default | Description |
10
+ | ------------------ | ----------- | ------- | ----------- |
11
+ | currentStage | number | | Receives a number that represents which stage id will be active. |
12
+ | currentStep | number | | Receives a number that will fill up the progress bar proportionally to the number of steps given. |
13
+ | stages | stageType | | Defines the structure of the stepper indicator. It is required for each element inside the array given to have a property `id`, the indicator will be ordered by id. |
14
+ | stepsCount | number | | Receives a number that represent the total amount of steps. Its only purpose is for properly rendering the progressBar. |
15
+ | topbar | topbarType | `{ colorTheme: 'light', variant: 'secondary' }` | Defines the rendering of the topbar that will replace the native topbar |
16
+
17
+ ### Custom Types
18
+
19
+ | Type | Shape |
20
+ | ----------- | ----- |
21
+ | iconType | `{ name: string, type: string, size: number, height: number, width: number }` |
22
+ | stageType | arrayOf( `{ id: number }` ) |
23
+ | topbarType | `{ colorTheme: 'light' \| 'dark', goBack: func, title: string, variant: 'primary' \| 'secondary', icon: iconType }` |
@@ -0,0 +1,41 @@
1
+ # UTWorkflowContainer
2
+
3
+ ### Description
4
+
5
+ This component serves as a wrapper for each step of a workflow
6
+
7
+ ## Props
8
+
9
+ | Name | Type | Default | Description |
10
+ | ------------------ | ----------- | ------- | ----------- |
11
+ | banner | bannerType | | Renders a banner at the bottom of the header. |
12
+ | children | element | | The contents that will be rendered inside the component.
13
+ | currentStage | number | | Receives a number that represents which stage id will be active. It is up to the parent component to update this number accordingly. |
14
+ | currentStep | number | | Receives a number that will fill up the progress bar proportionally to the number of steps given. |
15
+ | helpText | string | | Text that will be rendered at the bottom of the header. |
16
+ | message | messageType | | If present, renders a message above the navigation actions. |
17
+ | nextButton | buttonType | | Defines behaviour and/or rendering of the button on the right corner. |
18
+ | onExit | func | | Cleanup function. |
19
+ | requiredFieldInfo | string | | Text to display as a helper for required fields, it will be rendered below the description. |
20
+ | returnButton | buttonType | | Defines behaviour and/or rendering of the button on the left corner. |
21
+ | stages | stageType | | Defines the structure of the stepper indicator rendered inside the topbar. It is required for each element inside the array given to have a property `id`, the indicator will be ordered by id. |
22
+ | stepsCount | number | | Receives a number that represent the total amount of steps. Its only purpose is for properly rendering the progressBar. |
23
+ | subtitle | string | | Text that will be rendered below the title. |
24
+ | summary | summaryType | | If present, renders a rounded tab above the navigation actions with additional information and actions |
25
+ | tagline | string | | Text that will be rendered in uppercase on top of the title. |
26
+ | title | string | | Text that will be rendered between the topbar and the content. It is required in order to show any other text header elements. |
27
+ | topbar | topbarType | | Defines the rendering of the topbar that will replace the native topbar |
28
+ | useMarkdown | bool | | Defines whether to use markdown in the header components |
29
+
30
+ ### Custom Types
31
+
32
+ | Type | Shape |
33
+ | ----------- | ----- |
34
+ | actionType | `{ name: string, icon: iconType, title: string, onPress: func }` |
35
+ | bannerType | `{ text: string, icon: iconType }` |
36
+ | buttonType | `{ hidden: bool, disabled: bool, label: string, onPress: func, mode: 'contained' \| 'outlined' \| 'text' }` |
37
+ | iconType | `{ name: string, type: string, size: number, height: number, width: number }` |
38
+ | messageType | `{ icon: iconType, variant: string , title: string }` |
39
+ | stageType | arrayOf( `{ id: number }` ) |
40
+ | summaryType | `{ checkbox: objectOf( UTCheckbox props ), title: string, mainInfo: string, actions: actionType }` |
41
+ | topbarType | `{ colorTheme: 'light' \| 'dark', goBack: func, title: string, variant: 'primary' \| 'secondary', icon: iconType }` |
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.1.0",
5
+ "version": "1.2.1",
6
6
  "repository": "https://github.com/widergy/mobile-ui.git",
7
7
  "main": "lib/index.js",
8
8
  "files": [