secullum-react-native-ui 4.7.2 → 4.7.4

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.
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Button = void 0;
4
4
  const React = require("react");
5
5
  const theme_1 = require("../modules/theme");
6
+ const test_1 = require("../modules/test");
6
7
  const react_native_1 = require("react-native");
7
8
  const layout_1 = require("../modules/layout");
8
9
  class Button extends React.Component {
@@ -54,7 +55,7 @@ class Button extends React.Component {
54
55
  primary && styles.touchablePrimary,
55
56
  style,
56
57
  disabled && styles.disabled
57
- ], onPress: onPress, disabled: disabled, accessibilityLabel: nativeID },
58
+ ], onPress: onPress, disabled: disabled, testID: (0, test_1.getTestID)(nativeID) },
58
59
  React.createElement(react_native_1.Text, { nativeID: nativeID, style: [
59
60
  styles.text,
60
61
  primary && styles.textPrimary,
@@ -5,6 +5,7 @@ const React = require("react");
5
5
  const FontAwesome_1 = require("react-native-vector-icons/FontAwesome");
6
6
  const layout_1 = require("../modules/layout");
7
7
  const theme_1 = require("../modules/theme");
8
+ const test_1 = require("../modules/test");
8
9
  const react_native_1 = require("react-native");
9
10
  class CheckBox extends React.Component {
10
11
  constructor() {
@@ -42,7 +43,7 @@ class CheckBox extends React.Component {
42
43
  onChange(!value);
43
44
  }
44
45
  } },
45
- React.createElement(FontAwesome_1.default, { nativeID: nativeID, accessibilityLabel: nativeID, name: value ? 'check-square-o' : 'square-o', style: styles.icon }),
46
+ React.createElement(FontAwesome_1.default, { nativeID: nativeID, testID: (0, test_1.getTestID)(nativeID), name: value ? 'check-square-o' : 'square-o', style: styles.icon }),
46
47
  React.createElement(react_native_1.Text, { style: [styles.label, labelStyle] }, renderLabel ? renderLabel() : label)));
47
48
  }
48
49
  }
@@ -7,6 +7,7 @@ const format_1 = require("../modules/format");
7
7
  const layout_1 = require("../modules/layout");
8
8
  const theme_1 = require("../modules/theme");
9
9
  const ImageButton_1 = require("./ImageButton");
10
+ const test_1 = require("../modules/test");
10
11
  const react_native_1 = require("react-native");
11
12
  class DatePicker extends React.Component {
12
13
  constructor() {
@@ -89,7 +90,7 @@ class DatePicker extends React.Component {
89
90
  const styles = this.getStyles();
90
91
  const theme = (0, theme_1.getTheme)();
91
92
  return (React.createElement(react_native_1.TouchableWithoutFeedback, { disabled: disabled, onPress: this.handlePress },
92
- React.createElement(react_native_1.View, { nativeID: nativeID, accessibilityLabel: nativeID, style: [styles.container, style, disabled ? styles.readonly : null] },
93
+ React.createElement(react_native_1.View, { nativeID: nativeID, testID: (0, test_1.getTestID)(nativeID), style: [styles.container, style, disabled ? styles.readonly : null] },
93
94
  React.createElement(react_native_1.View, null,
94
95
  React.createElement(react_native_1.Text, { style: styles.label }, label),
95
96
  React.createElement(react_native_1.Text, { style: styles.value }, value ? (0, format_1.formatDate)(value, 'cccc, dd/MM/yyyy') : '')),
@@ -84,9 +84,7 @@ class DatePicker extends React.Component {
84
84
  const theme = (0, theme_1.getTheme)();
85
85
  return (React.createElement(react_native_1.TouchableWithoutFeedback, { onPress: this.handlePress },
86
86
  React.createElement(react_native_1.View, { nativeID: nativeID, style: [styles.container, style] },
87
- React.createElement(react_native_1.View, { ref: ref => ref &&
88
- ref.setNativeProps &&
89
- ref.setNativeProps({ id: 'date-picker' }) },
87
+ React.createElement(react_native_1.View, null,
90
88
  React.createElement(react_native_1.Text, { style: styles.label }, label),
91
89
  React.createElement(react_native_1.Text, { style: styles.value }, value != undefined ? (0, format_1.formatDate)(value, dateFormat) : '')),
92
90
  React.createElement(ImageButton_1.ImageButton, { icon: value && clearable ? 'times' : 'calendar', style: styles.clearIcon, iconColor: value && clearable ? theme.textColor1 : theme.textColor2, onPress: value && clearable ? this.handleClear : this.handlePress, hitBoxSize: 30 }),
@@ -7,6 +7,7 @@ const FontAwesome_1 = require("react-native-vector-icons/FontAwesome");
7
7
  const Card_1 = require("./Card");
8
8
  const Space_1 = require("./Space");
9
9
  const theme_1 = require("../modules/theme");
10
+ const test_1 = require("../modules/test");
10
11
  const layout_1 = require("../modules/layout");
11
12
  class Details extends React.Component {
12
13
  constructor() {
@@ -58,7 +59,7 @@ class Details extends React.Component {
58
59
  };
59
60
  this.renderIcon = (icon, index) => {
60
61
  const styles = this.getStyles();
61
- const fa = (React.createElement(FontAwesome_1.default, { key: index, accessibilityLabel: icon.name, name: icon.name, color: icon.color, size: icon.size, style: styles.lineValueIcon }));
62
+ const fa = (React.createElement(FontAwesome_1.default, { key: index, testID: (0, test_1.getTestID)(icon.name), name: icon.name, color: icon.color, size: icon.size, style: styles.lineValueIcon }));
62
63
  if (icon.onPress) {
63
64
  return (React.createElement(react_native_1.TouchableOpacity, { key: index, onPress: icon.onPress }, fa));
64
65
  }
@@ -6,6 +6,7 @@ const FontAwesome_1 = require("react-native-vector-icons/FontAwesome");
6
6
  const Modal_1 = require("./Modal");
7
7
  const layout_1 = require("../modules/layout");
8
8
  const theme_1 = require("../modules/theme");
9
+ const test_1 = require("../modules/test");
9
10
  const react_native_1 = require("react-native");
10
11
  class DropDownItem extends React.PureComponent {
11
12
  constructor() {
@@ -75,7 +76,7 @@ class DropDownItem extends React.PureComponent {
75
76
  render() {
76
77
  const { first, last, value, onPress, nativeID } = this.props;
77
78
  const theme = (0, theme_1.getTheme)();
78
- return (React.createElement(react_native_1.TouchableHighlight, { onPress: () => onPress(value), accessibilityLabel: nativeID, underlayColor: theme.backgroundColor2, style: {
79
+ return (React.createElement(react_native_1.TouchableHighlight, { onPress: () => onPress(value), testID: (0, test_1.getTestID)(nativeID), underlayColor: theme.backgroundColor2, style: {
79
80
  borderTopLeftRadius: first ? 5 : 0,
80
81
  borderTopRightRadius: first ? 5 : 0,
81
82
  borderBottomLeftRadius: last ? 5 : 0,
@@ -236,7 +237,7 @@ class DropDown extends React.Component {
236
237
  const styles = this.getStyles();
237
238
  const theme = (0, theme_1.getTheme)();
238
239
  return (React.createElement(react_native_1.TouchableWithoutFeedback, { onPress: () => this.setState({ modalOpen: true }), disabled: disabled },
239
- React.createElement(react_native_1.View, { nativeID: nativeID, accessibilityLabel: nativeID, style: [styles.container, style, disabled ? styles.readonly : null] },
240
+ React.createElement(react_native_1.View, { nativeID: nativeID, testID: (0, test_1.getTestID)(nativeID), style: [styles.container, style, disabled ? styles.readonly : null] },
240
241
  icon ? (React.createElement(FontAwesome_1.default, { name: icon, style: styles.iconOnLine })) : (React.createElement(react_native_1.Text, { style: [styles.label, labelStyle] }, label)),
241
242
  this.renderClosedDropDown(selectedItem, inputStyle),
242
243
  React.createElement(Modal_1.Modal, { visible: modalOpen, onRequestClose: () => this.setState({ modalOpen: false }), overlayStyle: styles.modalOverlay },
@@ -4,6 +4,7 @@ exports.ErrorMessage = void 0;
4
4
  const React = require("react");
5
5
  const react_native_1 = require("react-native");
6
6
  const theme_1 = require("../modules/theme");
7
+ const test_1 = require("../modules/test");
7
8
  class ErrorMessage extends React.Component {
8
9
  constructor() {
9
10
  super(...arguments);
@@ -24,7 +25,7 @@ class ErrorMessage extends React.Component {
24
25
  if (!message) {
25
26
  return null;
26
27
  }
27
- return (React.createElement(react_native_1.Text, { nativeID: nativeID, accessibilityLabel: nativeID, style: [styles.errorMessage, style] }, message));
28
+ return (React.createElement(react_native_1.Text, { nativeID: nativeID, testID: (0, test_1.getTestID)(nativeID), style: [styles.errorMessage, style] }, message));
28
29
  }
29
30
  }
30
31
  exports.ErrorMessage = ErrorMessage;
@@ -6,6 +6,7 @@ const react_native_1 = require("react-native");
6
6
  const FontAwesome_1 = require("react-native-vector-icons/FontAwesome");
7
7
  const theme_1 = require("../modules/theme");
8
8
  const layout_1 = require("../modules/layout");
9
+ const test_1 = require("../modules/test");
9
10
  class FilePicker extends React.Component {
10
11
  constructor() {
11
12
  super(...arguments);
@@ -36,7 +37,7 @@ class FilePicker extends React.Component {
36
37
  const styles = this.getStyles();
37
38
  return (React.createElement(react_native_1.TouchableOpacity, { activeOpacity: 0.5, style: styles.container, onPress: onPress },
38
39
  React.createElement(FontAwesome_1.default, { name: icon, color: theme.textColor3, size: 30 }),
39
- React.createElement(react_native_1.Text, { nativeID: nativeID, accessibilityLabel: nativeID, style: styles.text }, label)));
40
+ React.createElement(react_native_1.Text, { nativeID: nativeID, testID: (0, test_1.getTestID)(nativeID), style: styles.text }, label)));
40
41
  }
41
42
  }
42
43
  exports.FilePicker = FilePicker;
@@ -6,6 +6,7 @@ const react_native_1 = require("react-native");
6
6
  const FontAwesome_1 = require("react-native-vector-icons/FontAwesome");
7
7
  const theme_1 = require("../modules/theme");
8
8
  const layout_1 = require("../modules/layout");
9
+ const test_1 = require("../modules/test");
9
10
  class Header extends React.Component {
10
11
  constructor() {
11
12
  super(...arguments);
@@ -49,7 +50,7 @@ class Header extends React.Component {
49
50
  const styles = this.getStyles();
50
51
  const theme = (0, theme_1.getTheme)();
51
52
  const icon = (React.createElement(React.Fragment, null,
52
- React.createElement(FontAwesome_1.default, { nativeID: button.nativeID, accessibilityLabel: button.nativeID, name: button.icon, size: (0, layout_1.isTablet)() ? 30 : 20, color: button.disabled ? theme.textColor1 : theme.textColor4,
53
+ React.createElement(FontAwesome_1.default, { nativeID: button.nativeID, testID: (0, test_1.getTestID)(button.nativeID), name: button.icon, size: (0, layout_1.isTablet)() ? 30 : 20, color: button.disabled ? theme.textColor1 : theme.textColor4,
53
54
  // @ts-ignore : The component uses a different version of typing
54
55
  style: button.buttonStyle }),
55
56
  button.counter ? (React.createElement(react_native_1.View, { style: styles.counterContainer },
@@ -4,6 +4,7 @@ exports.ImageButton = void 0;
4
4
  const React = require("react");
5
5
  const FontAwesome_1 = require("react-native-vector-icons/FontAwesome");
6
6
  const theme_1 = require("../modules/theme");
7
+ const test_1 = require("../modules/test");
7
8
  const react_native_1 = require("react-native");
8
9
  class ImageButton extends React.Component {
9
10
  render() {
@@ -16,7 +17,7 @@ class ImageButton extends React.Component {
16
17
  right: hitBoxSize
17
18
  }
18
19
  : undefined },
19
- React.createElement(FontAwesome_1.default, { nativeID: nativeID, accessibilityLabel: nativeID, name: icon, size: iconSize || 20, color: iconColor || theme.textColor1 })));
20
+ React.createElement(FontAwesome_1.default, { nativeID: nativeID, testID: (0, test_1.getTestID)(nativeID), name: icon, size: iconSize || 20, color: iconColor || theme.textColor1 })));
20
21
  }
21
22
  }
22
23
  exports.ImageButton = ImageButton;
@@ -4,6 +4,7 @@ exports.Menu = exports.MenuItem = void 0;
4
4
  const React = require("react");
5
5
  const FontAwesome_1 = require("react-native-vector-icons/FontAwesome");
6
6
  const theme_1 = require("../modules/theme");
7
+ const test_1 = require("../modules/test");
7
8
  const layout_1 = require("../modules/layout");
8
9
  const react_native_1 = require("react-native");
9
10
  function MenuItem(props) {
@@ -42,7 +43,7 @@ function MenuItem(props) {
42
43
  menuItem.path != undefined &&
43
44
  isCurrentMenuPath(menuItem.path);
44
45
  return (React.createElement(react_native_1.TouchableOpacity, { disabled: menuItem.disabled, style: styles.container, onPress: onPress },
45
- React.createElement(react_native_1.Text, { nativeID: menuItem.nativeID, accessibilityLabel: menuItem.nativeID, style: [
46
+ React.createElement(react_native_1.Text, { nativeID: menuItem.nativeID, testID: (0, test_1.getTestID)(menuItem.nativeID), style: [
46
47
  styles.text,
47
48
  menuItem.disabled && styles.textDisabled,
48
49
  selected && styles.textSelected,
@@ -7,6 +7,7 @@ const FontAwesome_1 = require("react-native-vector-icons/FontAwesome");
7
7
  const Modal_1 = require("./Modal");
8
8
  const theme_1 = require("../modules/theme");
9
9
  const layout_1 = require("../modules/layout");
10
+ const test_1 = require("../modules/test");
10
11
  class Message extends React.Component {
11
12
  constructor() {
12
13
  super(...arguments);
@@ -42,7 +43,7 @@ class Message extends React.Component {
42
43
  return (React.createElement(Modal_1.Modal, { visible: visible, onRequestClose: onRequestClose, overlayStyle: styles.overlay },
43
44
  React.createElement(react_native_1.View, { nativeID: nativeID, style: styles.container },
44
45
  React.createElement(FontAwesome_1.default, { name: type === 'warning' ? 'warning' : 'check-circle', color: type === 'warning' ? theme.warningColor : theme.successColor, size: (0, layout_1.isTablet)() ? 52 : 42 }),
45
- React.createElement(react_native_1.Text, { style: [styles.text, textStyle], accessibilityLabel: nativeID }, message))));
46
+ React.createElement(react_native_1.Text, { style: [styles.text, textStyle], testID: (0, test_1.getTestID)(nativeID) }, message))));
46
47
  }
47
48
  }
48
49
  exports.Message = Message;
@@ -8,6 +8,7 @@ const format_1 = require("../modules/format");
8
8
  const layout_1 = require("../modules/layout");
9
9
  const theme_1 = require("../modules/theme");
10
10
  const Delay_1 = require("./Delay");
11
+ const test_1 = require("../modules/test");
11
12
  const react_native_1 = require("react-native");
12
13
  class RangeDatePicker extends React.Component {
13
14
  constructor() {
@@ -109,7 +110,7 @@ class RangeDatePicker extends React.Component {
109
110
  (0, format_1.formatDate)(endDate, displayFormat);
110
111
  const styles = this.getStyles();
111
112
  return (React.createElement(react_native_1.TouchableWithoutFeedback, { onPress: this.handleDatePickerPress },
112
- React.createElement(react_native_1.View, { nativeID: nativeID, accessibilityLabel: nativeID, style: [styles.container, style] },
113
+ React.createElement(react_native_1.View, { nativeID: nativeID, testID: (0, test_1.getTestID)(nativeID), style: [styles.container, style] },
113
114
  React.createElement(react_native_1.View, null,
114
115
  React.createElement(react_native_1.Text, { style: styles.label }, label),
115
116
  React.createElement(react_native_1.Text, { style: styles.value }, displayText)),
@@ -96,9 +96,7 @@ class RangeDatePicker extends React.Component {
96
96
  const styles = this.getStyles();
97
97
  return (React.createElement(react_native_1.TouchableWithoutFeedback, { onPress: this.handleDatePickerPress },
98
98
  React.createElement(react_native_1.View, { nativeID: nativeID, style: [styles.container, style] },
99
- React.createElement(react_native_1.View, { ref: ref => ref &&
100
- ref.setNativeProps &&
101
- ref.setNativeProps({ id: 'range-date-picker' }) },
99
+ React.createElement(react_native_1.View, null,
102
100
  React.createElement(react_native_1.Text, { style: styles.label }, label),
103
101
  React.createElement(react_native_1.Text, { style: styles.value }, displayText)),
104
102
  React.createElement(FontAwesome_1.default, { name: "calendar", style: styles.icon }),
@@ -4,6 +4,7 @@ exports.Table = void 0;
4
4
  const React = require("react");
5
5
  const FontAwesome_1 = require("react-native-vector-icons/FontAwesome");
6
6
  const theme_1 = require("../modules/theme");
7
+ const test_1 = require("../modules/test");
7
8
  const react_native_1 = require("react-native");
8
9
  const CheckBox_1 = require("./CheckBox");
9
10
  class Table extends React.Component {
@@ -43,7 +44,7 @@ class Table extends React.Component {
43
44
  render() {
44
45
  const { columns, data, style, nativeID, subHeaderData } = this.props;
45
46
  return (React.createElement(react_native_1.ScrollView, { horizontal: true },
46
- React.createElement(react_native_1.View, { nativeID: nativeID, style: style, accessibilityLabel: nativeID },
47
+ React.createElement(react_native_1.View, { nativeID: nativeID, style: style, testID: (0, test_1.getTestID)(nativeID) },
47
48
  React.createElement(react_native_1.View, { style: styles.row }, columns.map(column => this.renderHeaderColumn(column))),
48
49
  subHeaderData && (React.createElement(react_native_1.View, { style: styles.row }, subHeaderData.map(column => this.renderHeaderColumn(column)))),
49
50
  data.map((row, rowIndex) => this.renderDataTable(row, rowIndex)))));
@@ -4,6 +4,7 @@ exports.Text = void 0;
4
4
  const React = require("react");
5
5
  const react_native_1 = require("react-native");
6
6
  const theme_1 = require("../modules/theme");
7
+ const test_1 = require("../modules/test");
7
8
  const theme = (0, theme_1.getTheme)();
8
9
  class Text extends React.Component {
9
10
  constructor() {
@@ -26,7 +27,7 @@ class Text extends React.Component {
26
27
  render() {
27
28
  const { style, children, nativeID } = this.props;
28
29
  const textStyle = this.getStyles();
29
- return (React.createElement(react_native_1.Text, { nativeID: nativeID, accessibilityLabel: nativeID, style: [textStyle.text, style] }, children));
30
+ return (React.createElement(react_native_1.Text, { nativeID: nativeID, testID: (0, test_1.getTestID)(nativeID), style: [textStyle.text, style] }, children));
30
31
  }
31
32
  }
32
33
  exports.Text = Text;
@@ -5,6 +5,7 @@ const React = require("react");
5
5
  const theme_1 = require("../modules/theme");
6
6
  const layout_1 = require("../modules/layout");
7
7
  const FontAwesome_1 = require("react-native-vector-icons/FontAwesome");
8
+ const test_1 = require("../modules/test");
8
9
  const react_native_1 = require("react-native");
9
10
  class TextBox extends React.Component {
10
11
  constructor() {
@@ -47,7 +48,7 @@ class TextBox extends React.Component {
47
48
  const styles = this.getStyles();
48
49
  const incomingProps = {
49
50
  nativeID: this.props.nativeID,
50
- accessibilityLabel: this.props.nativeID,
51
+ testID: (0, test_1.getTestID)(this.props.nativeID),
51
52
  autoFocus: this.props.autoFocus,
52
53
  value: this.props.value,
53
54
  onChangeText: this.props.onChange,
@@ -87,13 +88,12 @@ class TextBox extends React.Component {
87
88
  this.props.onKeyPress(react_native_1.Platform.OS === 'web' ? event : event.nativeEvent);
88
89
  }
89
90
  };
90
- return (React.createElement(react_native_1.TouchableWithoutFeedback, { accessible: false, onPress: () => (onPress ? onPress() : this.focus()), ref: react_native_1.Platform.OS === 'web'
91
- ? ref => ref &&
92
- //@ts-ignore
93
- ref.setNativeProps &&
94
- //@ts-ignore
95
- ref.setNativeProps({ tabIndex: -1 })
96
- : undefined },
91
+ return (React.createElement(react_native_1.TouchableWithoutFeedback, { accessible: false, onPress: () => (onPress ? onPress() : this.focus()), ref: ref => {
92
+ if (react_native_1.Platform.OS === 'web' && ref != null) {
93
+ // @ts-ignore na web, a ref recebida é o próprio elemento DOM
94
+ ref.tabIndex = -1;
95
+ }
96
+ } },
97
97
  React.createElement(react_native_1.View, { style: [styles.container, style, editable ? null : styles.readonly] },
98
98
  icon ? (React.createElement(FontAwesome_1.default, { name: icon, style: styles.icon })) : (React.createElement(react_native_1.Text, { style: [styles.label, labelStyle] }, label)),
99
99
  renderInput
@@ -45,9 +45,12 @@ class TimePicker extends React.Component {
45
45
  render() {
46
46
  const { label, style, disabled, value, nativeID } = this.props;
47
47
  const styles = this.getStyles();
48
- return (React.createElement(react_native_1.TouchableWithoutFeedback, { accessible: false, disabled: disabled, ref: ref =>
49
- //@ts-ignore
50
- ref && ref.setNativeProps && ref.setNativeProps({ tabIndex: -1 }) },
48
+ return (React.createElement(react_native_1.TouchableWithoutFeedback, { accessible: false, disabled: disabled, ref: ref => {
49
+ if (ref != null) {
50
+ //@ts-ignore
51
+ ref.tabIndex = -1;
52
+ }
53
+ } },
51
54
  React.createElement(react_native_1.View, { style: [styles.container, style, !disabled ? null : styles.readonly] },
52
55
  React.createElement(react_native_1.Text, { style: styles.label }, label),
53
56
  React.createElement(react_native_1.TextInput, { nativeID: nativeID, value: value, style: styles.input, maxLength: 5, onKeyPress: (e) => {
@@ -0,0 +1,2 @@
1
+ export declare const setTestIDPrefix: (value: string) => void;
2
+ export declare const getTestID: (testID?: string) => string | undefined;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getTestID = exports.setTestIDPrefix = void 0;
4
+ let testIdPrefix = '';
5
+ const setTestIDPrefix = (value) => {
6
+ testIdPrefix = value;
7
+ };
8
+ exports.setTestIDPrefix = setTestIDPrefix;
9
+ const getTestID = (testID) => {
10
+ if (!testID) {
11
+ return testID;
12
+ }
13
+ if (testIdPrefix) {
14
+ return `${testIdPrefix}${testID}`;
15
+ }
16
+ return testID;
17
+ };
18
+ exports.getTestID = getTestID;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "secullum-react-native-ui",
3
- "version": "4.7.2",
3
+ "version": "4.7.4",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "files": [