@controleonline/ui-default 1.0.265 → 1.0.267

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.
@@ -20,13 +20,15 @@ const DefaultTableToolbar = ({ storeName }) => {
20
20
  const showTotalItemsInCompactToolbar = configs.showTotalItemsInCompactToolbar === true;
21
21
  const showTotalItemsInFooter = configs.showTotalItemsInFooter !== false;
22
22
  const toolbarActions = Array.isArray(configs.toolbarActions) ? configs.toolbarActions : [];
23
- const { toolbarColors } = useDefaultTableTheme();
23
+ const { tableBorderColors, toolbarColors } = useDefaultTableTheme();
24
24
  const {
25
25
  backgroundColor: toolbarBackgroundColor,
26
26
  borderColor: toolbarBorderColor,
27
27
  countBackgroundColor: toolbarCountBackgroundColor,
28
28
  countTextColor: toolbarCountTextColor,
29
29
  } = toolbarColors;
30
+ const resolvedToolbarBorderColor =
31
+ tableBorderColors.toolbarBorderColor || toolbarBorderColor;
30
32
  const storeTotalItems = store?.getters?.totalItems;
31
33
  const resolvedTotalItems = storeTotalItems;
32
34
  const totalItemsNumber = Number(resolvedTotalItems);
@@ -63,7 +65,11 @@ const DefaultTableToolbar = ({ storeName }) => {
63
65
  style={[
64
66
  styles.toolbar,
65
67
  shouldRenderCompactToolbarTotalItems ? styles.toolbarWithCompactTotal : null,
66
- { borderBottomColor: toolbarBorderColor, backgroundColor: toolbarBackgroundColor },
68
+ {
69
+ borderBottomColor: resolvedToolbarBorderColor,
70
+ borderBottomWidth: resolvedToolbarBorderColor ? 1 : 0,
71
+ backgroundColor: toolbarBackgroundColor,
72
+ },
67
73
  ]}
68
74
  >
69
75
  {shouldRenderCompactToolbarTotalItems ? (
@@ -1,58 +1,101 @@
1
1
  import { useMemo } from 'react';
2
2
  import { useStore } from '@store';
3
- import { resolveThemePalette } from '@controleonline/../../src/styles/branding';
4
- import { colors } from '@controleonline/../../src/styles/colors';
3
+
4
+ const firstThemeToken = (themeColors, keys) =>
5
+ keys.map(key => themeColors?.[key]).find(Boolean);
5
6
 
6
7
  const useDefaultTableTheme = (accentColor = null) => {
7
8
  const themeStore = useStore('theme');
8
- const baseColors = themeStore?.getters?.colors || {};
9
- const themeTokens = useMemo(
10
- () => ({ ...baseColors }),
11
- [baseColors],
9
+ const rawThemeColors = themeStore?.getters?.colors || {};
10
+ const themeColors = useMemo(
11
+ () => ({ ...rawThemeColors }),
12
+ [rawThemeColors],
12
13
  );
13
- const palette = useMemo(
14
- () => resolveThemePalette(themeTokens, colors) || {},
15
- [themeTokens],
16
- );
17
- const themeColors = palette.colors || baseColors || colors || {};
18
- const resolvedAccentColor = accentColor || palette.primary || themeColors.primary || '#0EA5E9';
14
+ const themeTokens = useMemo(
15
+ () => ({ ...themeColors }),
16
+ [themeColors],
17
+ );
18
+ const palette = themeColors;
19
+ const resolvedAccentColor = accentColor ?? themeColors.primary;
20
+ const tableBorderColors = {
21
+ containerBorderColor: firstThemeToken(themeColors, [
22
+ 'tableContainerBorder',
23
+ 'tableBorder',
24
+ 'tableHeaderBorder',
25
+ 'tableToolbarBorder',
26
+ 'cardBorder',
27
+ 'listItemBorder',
28
+ 'dividerBorder',
29
+ 'dividerBackground',
30
+ 'inputBorder',
31
+ 'panelBorder',
32
+ 'border',
33
+ ]),
34
+ headerBorderColor: firstThemeToken(themeColors, [
35
+ 'tableHeaderBorder',
36
+ 'tableToolbarBorder',
37
+ 'tableBorder',
38
+ 'dividerBorder',
39
+ 'dividerBackground',
40
+ 'listItemBorder',
41
+ 'border',
42
+ ]),
43
+ rowBorderColor: firstThemeToken(themeColors, [
44
+ 'tableRowBorder',
45
+ 'listItemBorder',
46
+ 'dividerBorder',
47
+ 'dividerBackground',
48
+ 'tableBorder',
49
+ 'border',
50
+ ]),
51
+ toolbarBorderColor: firstThemeToken(themeColors, [
52
+ 'tableToolbarBorder',
53
+ 'tableHeaderBorder',
54
+ 'toolbarBorder',
55
+ 'tableBorder',
56
+ 'dividerBorder',
57
+ 'dividerBackground',
58
+ 'border',
59
+ ]),
60
+ };
19
61
 
20
62
  return {
21
63
  palette,
22
64
  resolvedAccentColor,
65
+ tableBorderColors,
23
66
  themeColors,
24
- themeTokens,
25
- checkboxBorderColor: themeColors.checkboxBorder,
26
- checkboxSelectedMarkColor: themeColors.checkboxSelectedMark,
27
- modalColors: {
28
- backgroundColor: themeColors.modalBackground,
29
- borderColor: themeColors.modalBorder,
30
- closeIconColor: themeColors.modalCloseIcon,
31
- headerTextColor: themeColors.modalHeaderText,
32
- overlayColor: themeColors.modalOverlay,
33
- textColor: themeColors.modalText,
34
- },
35
- tableButtonColors: {
36
- backgroundColor: themeColors.buttonBackground,
37
- borderColor: themeColors.buttonBorder,
38
- iconColor: themeColors.buttonIcon,
39
- pressedBackgroundColor: themeColors.buttonPressedBackground,
40
- pressedBorderColor: themeColors.buttonPressedBorder,
41
- pressedIconColor: themeColors.buttonPressedIcon,
42
- textColor: themeColors.buttonText,
43
- },
44
- tableActionColors: {
45
- backgroundColor: themeColors.tableActionBackground,
46
- borderColor: themeColors.tableActionBorder,
47
- textColor: themeColors.tableActionIcon,
48
- },
49
- toolbarColors: {
50
- backgroundColor: themeColors.toolbarBackground,
51
- borderColor: themeColors.toolbarBorder,
52
- countBackgroundColor: themeColors.badgeBackground,
53
- countTextColor: themeColors.badgeText,
54
- },
55
- };
56
- };
57
-
58
- export default useDefaultTableTheme;
67
+ themeTokens,
68
+ checkboxBorderColor: themeColors.checkboxBorder,
69
+ checkboxSelectedMarkColor: themeColors.checkboxSelectedMark,
70
+ modalColors: {
71
+ backgroundColor: themeColors.modalBackground,
72
+ borderColor: themeColors.modalBorder,
73
+ closeIconColor: themeColors.modalCloseIcon,
74
+ headerTextColor: themeColors.modalHeaderText,
75
+ overlayColor: themeColors.modalOverlay,
76
+ textColor: themeColors.modalText,
77
+ },
78
+ tableButtonColors: {
79
+ backgroundColor: themeColors.buttonBackground,
80
+ borderColor: themeColors.buttonBorder,
81
+ iconColor: themeColors.buttonIcon,
82
+ pressedBackgroundColor: themeColors.buttonPressedBackground,
83
+ pressedBorderColor: themeColors.buttonPressedBorder,
84
+ pressedIconColor: themeColors.buttonPressedIcon,
85
+ textColor: themeColors.buttonText,
86
+ },
87
+ tableActionColors: {
88
+ backgroundColor: themeColors.tableActionBackground,
89
+ borderColor: themeColors.tableActionBorder,
90
+ textColor: themeColors.tableActionIcon,
91
+ },
92
+ toolbarColors: {
93
+ backgroundColor: themeColors.toolbarBackground,
94
+ borderColor: themeColors.toolbarBorder,
95
+ countBackgroundColor: themeColors.badgeBackground,
96
+ countTextColor: themeColors.badgeText,
97
+ },
98
+ };
99
+ };
100
+
101
+ export default useDefaultTableTheme;