@controleonline/ui-default 1.0.263 → 1.0.265

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.
Files changed (61) hide show
  1. package/AGENTS.md +47 -45
  2. package/package.json +20 -20
  3. package/src/react/components/errors/DefaultErrors.js +307 -325
  4. package/src/react/components/files/DefaultFile.js +46 -46
  5. package/src/react/components/filters/CompactFilterSelector.js +78 -24
  6. package/src/react/components/filters/CompactFilterSelector.styles.js +17 -5
  7. package/src/react/components/filters/DefaultColumnFilter.js +191 -57
  8. package/src/react/components/filters/DefaultExternalFilters.js +245 -182
  9. package/src/react/components/filters/DefaultSearch.js +131 -92
  10. package/src/react/components/filters/DefaultSearch.styles.js +65 -70
  11. package/src/react/components/form/DefaultForm.js +172 -151
  12. package/src/react/components/form/DefaultForm.styles.js +71 -66
  13. package/src/react/components/help/DefaultTooltip.js +87 -87
  14. package/src/react/components/help/DefaultTooltip.styles.js +61 -61
  15. package/src/react/components/inputs/DefaultDateInput.js +150 -0
  16. package/src/react/components/inputs/DefaultInput.js +162 -127
  17. package/src/react/components/inputs/DefaultInput.styles.js +6 -0
  18. package/src/react/components/inputs/DefaultSelect.js +320 -152
  19. package/src/react/components/inputs/defaultInputUtils.js +40 -19
  20. package/src/react/components/map/DefaultGoogleMap.styles.js +115 -9
  21. package/src/react/components/map/DefaultGoogleMap.web.js +560 -446
  22. package/src/react/components/map/DefaultMap.native.js +73 -71
  23. package/src/react/components/map/DefaultMap.styles.js +16 -16
  24. package/src/react/components/map/DefaultMap.web.js +68 -66
  25. package/src/react/components/map/DefaultNativeMap.native.js +307 -183
  26. package/src/react/components/map/DefaultNativeMap.shared.js +439 -340
  27. package/src/react/components/map/DefaultNativeMap.styles.js +156 -122
  28. package/src/react/components/table/DefaultColumnMenu.js +108 -0
  29. package/src/react/components/table/DefaultDebug.js +233 -0
  30. package/src/react/components/table/DefaultFiltersModal.js +142 -0
  31. package/src/react/components/table/DefaultModalButton.js +18 -0
  32. package/src/react/components/table/DefaultSearchModal.js +49 -0
  33. package/src/react/components/table/DefaultTable.js +345 -1846
  34. package/src/react/components/table/DefaultTable.styles.js +247 -136
  35. package/src/react/components/table/DefaultTable.utils.js +502 -0
  36. package/src/react/components/table/DefaultTableBody.js +26 -0
  37. package/src/react/components/table/DefaultTableCards.js +171 -0
  38. package/src/react/components/table/DefaultTableControls.js +208 -0
  39. package/src/react/components/table/DefaultTableEmptyState.js +22 -0
  40. package/src/react/components/table/DefaultTableFooter.js +172 -0
  41. package/src/react/components/table/DefaultTableInput.js +145 -0
  42. package/src/react/components/table/DefaultTableRows.js +340 -0
  43. package/src/react/components/table/DefaultTableSearch.js +100 -0
  44. package/src/react/components/table/DefaultTableToolbar.js +98 -0
  45. package/src/react/components/table/DefaultToolbarAction.js +56 -0
  46. package/src/react/components/table/useDefaultTablePagination.js +370 -0
  47. package/src/react/components/table/useDefaultTableSorting.js +126 -0
  48. package/src/react/components/table/useDefaultTableTheme.js +58 -0
  49. package/src/react/index.js +10 -10
  50. package/src/react/utils/tableVisibleColumnsPreferences.js +239 -211
  51. package/src/store/default/actions.js +51 -13
  52. package/src/store/default/getters.js +10 -8
  53. package/src/store/default/mutation_types.js +4 -2
  54. package/src/store/default/mutations.js +10 -1
  55. package/src/tests/react/components/errors/DefaultErrors.test.js +162 -162
  56. package/src/tests/react/components/files/DefaultFile.test.js +80 -80
  57. package/src/tests/react/components/form/DefaultForm.test.js +81 -0
  58. package/src/tests/react/components/inputs/DefaultSelect.test.js +185 -0
  59. package/src/tests/react/components/table/DefaultTable.test.js +1183 -0
  60. package/src/tests/react/store/defaultActions.test.js +59 -0
  61. package/src/tests/react/utils/tableVisibleColumnsPreferences.test.js +247 -168
@@ -1,103 +1,142 @@
1
- import React, { useEffect, useMemo, useState } from 'react';
2
- import { TextInput, TouchableOpacity, View } from 'react-native';
3
- import Icon from 'react-native-vector-icons/Feather';
4
- import styles from './DefaultSearch.styles';
5
-
6
- const normalizeText = value => String(value || '').trim();
7
-
8
- const DefaultSearch = ({
9
- accentColor = '#2563EB',
10
- autoFocus = false,
11
- compact = false,
12
- filters = null,
13
- onChangeFilters = null,
14
- onClear = null,
15
- onSearch = null,
16
- placeholder = '',
17
- searchKey = 'search',
18
- storeName = '',
19
- style = null,
20
- value,
1
+ import React, { useEffect, useMemo, useState } from 'react';
2
+ import { TextInput, TouchableOpacity, View } from 'react-native';
3
+ import Icon from 'react-native-vector-icons/Feather';
4
+ import { useStore } from '@store';
5
+ import styles from './DefaultSearch.styles';
6
+
7
+ const normalizeText = value => String(value || '').trim();
8
+
9
+ const DefaultSearch = ({
10
+ autoFocus = false,
11
+ compact = false,
12
+ filters = null,
13
+ onChangeFilters = null,
14
+ onClear = null,
15
+ onSearch = null,
16
+ placeholder = '',
17
+ searchKey = 'search',
18
+ storeName = '',
19
+ style = null,
20
+ value,
21
21
  }) => {
22
+ const store = useStore(storeName);
23
+ const themeStore = useStore('theme');
24
+ const themeColors = themeStore.getters.colors;
25
+ const resolvedFilters = filters || store?.getters?.filters || {};
26
+ const resolvedChangeFilters = onChangeFilters || store?.actions?.setFilters || null;
27
+ const palette = useMemo(
28
+ () => ({
29
+ buttonBackgroundSecondary: themeColors.buttonBackgroundSecondary,
30
+ buttonBorder: themeColors.buttonBorder,
31
+ buttonIcon: themeColors.buttonIcon,
32
+ buttonIconSecondary: themeColors.buttonIconSecondary,
33
+ inputBackground: themeColors.inputBackground,
34
+ inputBorder: themeColors.inputBorder,
35
+ inputIcon: themeColors.inputIcon,
36
+ inputPlaceholderText: themeColors.inputPlaceholderText,
37
+ inputText: themeColors.inputText,
38
+ }),
39
+ [themeColors],
40
+ );
22
41
  const resolvedValue = useMemo(
23
- () => normalizeText(value ?? filters?.[searchKey]),
24
- [filters, searchKey, value],
42
+ () => normalizeText(value ?? resolvedFilters?.[searchKey]),
43
+ [resolvedFilters, searchKey, value],
25
44
  );
26
- const [draftValue, setDraftValue] = useState(resolvedValue);
27
-
28
- useEffect(() => {
29
- setDraftValue(resolvedValue);
30
- }, [resolvedValue]);
31
-
32
- const commitSearch = nextValue => {
33
- const searchValue = normalizeText(nextValue ?? draftValue);
34
-
35
- if (typeof onChangeFilters === 'function') {
36
- const nextFilters = { ...(filters || {}) };
45
+ const [draftValue, setDraftValue] = useState(resolvedValue);
46
+
47
+ useEffect(() => {
48
+ setDraftValue(resolvedValue);
49
+ }, [resolvedValue]);
50
+
51
+ const commitSearch = nextValue => {
52
+ const searchValue = normalizeText(nextValue ?? draftValue);
53
+
54
+ if (typeof resolvedChangeFilters === 'function') {
55
+ const nextFilters = { ...(resolvedFilters || {}) };
37
56
  if (searchValue) nextFilters[searchKey] = searchValue;
38
57
  else delete nextFilters[searchKey];
39
- onChangeFilters(nextFilters);
58
+ resolvedChangeFilters(nextFilters);
40
59
  }
41
-
42
- onSearch?.(searchValue);
43
- };
44
-
45
- const clearSearch = () => {
46
- setDraftValue('');
47
-
48
- if (typeof onChangeFilters === 'function') {
49
- const nextFilters = { ...(filters || {}) };
60
+
61
+ onSearch?.(searchValue);
62
+ };
63
+
64
+ const clearSearch = () => {
65
+ setDraftValue('');
66
+
67
+ if (typeof resolvedChangeFilters === 'function') {
68
+ const nextFilters = { ...(resolvedFilters || {}) };
50
69
  delete nextFilters[searchKey];
51
- onChangeFilters(nextFilters);
70
+ resolvedChangeFilters(nextFilters);
52
71
  }
53
-
54
- onClear?.();
55
- onSearch?.('');
56
- };
57
-
72
+
73
+ onClear?.();
74
+ onSearch?.('');
75
+ };
76
+
58
77
  const resolvedPlaceholder =
59
78
  placeholder ||
60
79
  global.t?.t(storeName, 'input', searchKey) ||
61
- global.t?.t(storeName, 'placeholder', searchKey) ||
62
- 'Buscar...';
63
-
64
- return (
65
- <View style={[styles.wrap, compact ? styles.wrapCompact : null, style]}>
66
- <Icon name="search" size={compact ? 14 : 16} color="#64748B" />
67
- <TextInput
68
- autoCapitalize="none"
69
- autoCorrect={false}
70
- autoFocus={autoFocus}
71
- placeholder={resolvedPlaceholder}
72
- placeholderTextColor="#94A3B8"
73
- returnKeyType="search"
74
- style={[styles.input, compact ? styles.inputCompact : null]}
75
- value={draftValue}
76
- onChangeText={setDraftValue}
77
- onSubmitEditing={() => commitSearch()}
78
- />
79
- {draftValue ? (
80
- <TouchableOpacity
81
- style={[styles.iconButton, compact ? styles.iconButtonCompact : null]}
82
- activeOpacity={0.82}
83
- onPress={clearSearch}
84
- >
85
- <Icon name="x" size={14} color="#64748B" />
86
- </TouchableOpacity>
87
- ) : null}
88
- <TouchableOpacity
89
- style={[
90
- styles.searchButton,
91
- compact ? styles.searchButtonCompact : null,
92
- { borderColor: accentColor },
93
- ]}
94
- activeOpacity={0.82}
95
- onPress={() => commitSearch()}
96
- >
97
- <Icon name="arrow-right" size={compact ? 13 : 15} color={accentColor} />
98
- </TouchableOpacity>
99
- </View>
100
- );
101
- };
102
-
103
- export default DefaultSearch;
80
+ global.t?.t(storeName, 'placeholder', searchKey);
81
+
82
+ return (
83
+ <View
84
+ style={[
85
+ styles.wrap,
86
+ compact ? styles.wrapCompact : null,
87
+ {
88
+ backgroundColor: palette.inputBackground,
89
+ borderColor: palette.inputBorder,
90
+ },
91
+ style,
92
+ ]}
93
+ >
94
+ <Icon name="search" size={compact ? 14 : 16} color={palette.inputIcon} />
95
+ <TextInput
96
+ autoCapitalize="none"
97
+ autoCorrect={false}
98
+ autoFocus={autoFocus}
99
+ placeholder={resolvedPlaceholder}
100
+ placeholderTextColor={palette.inputPlaceholderText}
101
+ returnKeyType="search"
102
+ style={[
103
+ styles.input,
104
+ compact ? styles.inputCompact : null,
105
+ { color: palette.inputText },
106
+ ]}
107
+ value={draftValue}
108
+ onChangeText={setDraftValue}
109
+ onSubmitEditing={() => commitSearch()}
110
+ />
111
+ {draftValue ? (
112
+ <TouchableOpacity
113
+ style={[
114
+ styles.iconButton,
115
+ compact ? styles.iconButtonCompact : null,
116
+ { backgroundColor: palette.buttonBackgroundSecondary },
117
+ ]}
118
+ activeOpacity={0.82}
119
+ onPress={clearSearch}
120
+ >
121
+ <Icon name="x" size={14} color={palette.buttonIconSecondary} />
122
+ </TouchableOpacity>
123
+ ) : null}
124
+ <TouchableOpacity
125
+ style={[
126
+ styles.searchButton,
127
+ compact ? styles.searchButtonCompact : null,
128
+ {
129
+ backgroundColor: palette.buttonBackgroundSecondary,
130
+ borderColor: palette.buttonBorder,
131
+ },
132
+ ]}
133
+ activeOpacity={0.82}
134
+ onPress={() => commitSearch()}
135
+ >
136
+ <Icon name="arrow-right" size={compact ? 13 : 15} color={palette.buttonIcon} />
137
+ </TouchableOpacity>
138
+ </View>
139
+ );
140
+ };
141
+
142
+ export default DefaultSearch;
@@ -1,70 +1,65 @@
1
- import { StyleSheet } from 'react-native';
2
-
3
- const styles = StyleSheet.create({
4
- wrap: {
5
- minHeight: 40,
6
- minWidth: 180,
7
- borderWidth: 1,
8
- borderColor: '#CBD5E1',
9
- borderRadius: 12,
10
- backgroundColor: '#FFFFFF',
11
- paddingLeft: 10,
12
- paddingRight: 5,
13
- paddingVertical: 5,
14
- flexDirection: 'row',
15
- alignItems: 'center',
16
- gap: 8,
17
- },
18
- wrapCompact: {
19
- minHeight: 30,
20
- minWidth: 150,
21
- maxWidth: 240,
22
- borderRadius: 15,
23
- paddingLeft: 9,
24
- paddingRight: 3,
25
- paddingVertical: 3,
26
- gap: 6,
27
- },
28
- input: {
29
- flex: 1,
30
- minWidth: 0,
31
- padding: 0,
32
- color: '#0F172A',
33
- fontSize: 13,
34
- lineHeight: 16,
35
- fontWeight: '700',
36
- },
37
- inputCompact: {
38
- fontSize: 12,
39
- lineHeight: 14,
40
- },
41
- iconButton: {
42
- width: 28,
43
- height: 28,
44
- borderRadius: 14,
45
- alignItems: 'center',
46
- justifyContent: 'center',
47
- backgroundColor: '#F8FAFC',
48
- },
49
- iconButtonCompact: {
50
- width: 22,
51
- height: 22,
52
- borderRadius: 11,
53
- },
54
- searchButton: {
55
- width: 30,
56
- height: 30,
57
- borderRadius: 15,
58
- borderWidth: 1,
59
- alignItems: 'center',
60
- justifyContent: 'center',
61
- backgroundColor: '#FFFFFF',
62
- },
63
- searchButtonCompact: {
64
- width: 24,
65
- height: 24,
66
- borderRadius: 12,
67
- },
68
- });
69
-
70
- export default styles;
1
+ import { StyleSheet } from 'react-native';
2
+
3
+ const styles = StyleSheet.create({
4
+ wrap: {
5
+ minHeight: 40,
6
+ minWidth: 180,
7
+ borderWidth: 1,
8
+ borderRadius: 12,
9
+ paddingLeft: 10,
10
+ paddingRight: 5,
11
+ paddingVertical: 5,
12
+ flexDirection: 'row',
13
+ alignItems: 'center',
14
+ gap: 8,
15
+ },
16
+ wrapCompact: {
17
+ minHeight: 30,
18
+ minWidth: 150,
19
+ maxWidth: 240,
20
+ borderRadius: 15,
21
+ paddingLeft: 9,
22
+ paddingRight: 3,
23
+ paddingVertical: 3,
24
+ gap: 6,
25
+ },
26
+ input: {
27
+ flex: 1,
28
+ minWidth: 0,
29
+ padding: 0,
30
+ fontSize: 13,
31
+ lineHeight: 16,
32
+ fontWeight: '700',
33
+ },
34
+ inputCompact: {
35
+ fontSize: 12,
36
+ lineHeight: 14,
37
+ },
38
+ iconButton: {
39
+ width: 28,
40
+ height: 28,
41
+ borderRadius: 14,
42
+ alignItems: 'center',
43
+ justifyContent: 'center',
44
+ },
45
+ iconButtonCompact: {
46
+ width: 22,
47
+ height: 22,
48
+ borderRadius: 11,
49
+ },
50
+ searchButton: {
51
+ width: 30,
52
+ height: 30,
53
+ borderRadius: 15,
54
+ borderWidth: 1,
55
+ alignItems: 'center',
56
+ justifyContent: 'center',
57
+ },
58
+ searchButtonCompact: {
59
+ width: 24,
60
+ height: 24,
61
+ borderRadius: 12,
62
+ },
63
+ });
64
+
65
+ export default styles;