@saleor/macaw-ui 0.3.1 → 0.3.2

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 (83) hide show
  1. package/dist/ActionBar/styles.d.ts +1 -1
  2. package/dist/Alert/Alert.d.ts +2 -1
  3. package/dist/Button/Button.d.ts +1 -3
  4. package/dist/Pagination/Pagination.d.ts +2 -2
  5. package/dist/Savebar/styles.d.ts +1 -1
  6. package/dist/cjs/index.js +2 -2
  7. package/dist/cjs/index.js.map +3 -3
  8. package/dist/esm/index.js +2 -2
  9. package/dist/esm/index.js.map +3 -3
  10. package/dist/icons/Logo.d.ts +1 -1
  11. package/dist/icons/LogoLight.d.ts +2 -2
  12. package/dist/icons/index.d.ts +1 -4
  13. package/dist/index.d.ts +0 -3
  14. package/dist/index.js +1 -4
  15. package/dist/index.js.map +3 -3
  16. package/dist/mjs/index.js +5 -0
  17. package/dist/mjs/index.js.map +7 -0
  18. package/dist/theme/createSaleorTheme/overrides/buttons.d.ts +2 -2
  19. package/dist/theme/createSaleorTheme/overrides/index.d.ts +2 -2
  20. package/dist/theme/createSaleorTheme/overrides/inputs.d.ts +2 -2
  21. package/dist/theme/createSaleorTheme/overrides/tables.d.ts +2 -2
  22. package/dist/theme/createSaleorTheme/shadows.d.ts +2 -2
  23. package/dist/theme/createSaleorTheme/types.d.ts +4 -8
  24. package/dist/types/CircleIndicator/CircleIndicator.d.ts +7 -0
  25. package/dist/types/CircleIndicator/CircleIndicator.stories.d.ts +4 -0
  26. package/dist/types/CircleIndicator/index.d.ts +1 -0
  27. package/dist/types/CircleIndicator/styles.d.ts +2 -0
  28. package/dist/types/ConfirmButton/ConfirmButton.d.ts +1 -1
  29. package/dist/types/Pill/Pill.d.ts +1 -1
  30. package/dist/types/StatusChip/styles.d.ts +3 -0
  31. package/dist/types/icons/CircleIndicatorIcon.d.ts +1 -0
  32. package/dist/types/icons/SuccessCircleIndicatorIcon.d.ts +1 -0
  33. package/dist/types/icons/index.d.ts +2 -0
  34. package/dist/types/index.d.ts +1 -0
  35. package/package.json +3 -1
  36. package/src/ActionBar/styles.ts +1 -1
  37. package/src/Alert/Alert.tsx +2 -2
  38. package/src/Backlink/Backlink.stories.tsx +0 -1
  39. package/src/Backlink/Backlink.tsx +1 -1
  40. package/src/BaseList/BaseList.tsx +1 -0
  41. package/src/BaseList/context.ts +1 -0
  42. package/src/BaseList/styles.ts +1 -0
  43. package/src/CircleIndicator/CircleIndicator.stories.tsx +48 -0
  44. package/src/CircleIndicator/CircleIndicator.tsx +34 -0
  45. package/src/CircleIndicator/index.ts +1 -0
  46. package/src/CircleIndicator/styles.ts +31 -0
  47. package/src/ConfirmButton/ConfirmButton.tsx +1 -1
  48. package/src/Filter/Filter.tsx +1 -3
  49. package/src/Filter/FilterBar.tsx +0 -1
  50. package/src/LayoutButton/LayoutButton.tsx +1 -2
  51. package/src/List/List.stories.tsx +4 -2
  52. package/src/List/List.tsx +1 -0
  53. package/src/List/styles.ts +1 -0
  54. package/src/NavigationCard/NavigationCard.stories.tsx +2 -2
  55. package/src/NavigationCard/NavigationCard.tsx +1 -1
  56. package/src/Notification/Notification.tsx +3 -3
  57. package/src/OffsettedList/OffsettedList.stories.tsx +2 -2
  58. package/src/OffsettedList/OffsettedList.tsx +1 -0
  59. package/src/Pill/Pill.stories.tsx +3 -3
  60. package/src/Pill/Pill.tsx +3 -2
  61. package/src/PillLink/PillLink.tsx +1 -0
  62. package/src/Savebar/Savebar.tsx +1 -1
  63. package/src/Sidebar/ExpandButton.tsx +1 -1
  64. package/src/StatusChip/StatusChip.tsx +1 -1
  65. package/src/UserChipMenu/UserChipMenu.tsx +1 -1
  66. package/src/consts.ts +1 -0
  67. package/src/icons/CircleIndicatorIcon.tsx +10 -0
  68. package/src/icons/SuccessCircleIndicatorIcon.tsx +16 -0
  69. package/src/icons/index.ts +2 -0
  70. package/src/index.tsx +1 -0
  71. package/src/theme/ThemeProvider.tsx +0 -1
  72. package/src/theme/createSaleorTheme/createSaleorTheme.tsx +2 -2
  73. package/src/theme/createSaleorTheme/overrides/inputs.ts +1 -1
  74. package/src/theme/utils.test.ts +4 -4
  75. package/src/theme/utils.ts +1 -1
  76. package/src/tools/useLocalStorage.ts +16 -9
  77. package/dist/macaw-ui.cjs.development.js +0 -2626
  78. package/dist/macaw-ui.cjs.development.js.map +0 -1
  79. package/dist/macaw-ui.cjs.production.min.js +0 -2
  80. package/dist/macaw-ui.cjs.production.min.js.map +0 -1
  81. package/dist/macaw-ui.esm.js +0 -2578
  82. package/dist/macaw-ui.esm.js.map +0 -1
  83. package/dist/types/Button/Button.stories.d.ts +0 -5
@@ -60,7 +60,6 @@ export const ThemeProvider: React.FC<ThemeProviderProps> = ({
60
60
  useEffect(() => {
61
61
  sendThemeToExtension();
62
62
  changeColorMeta(theme.palette.background.default);
63
- // eslint-disable-next-line react-hooks/exhaustive-deps
64
63
  }, [themeType]);
65
64
 
66
65
  return (
@@ -86,8 +86,8 @@ export const createTheme = (colors: SaleorThemeColors): SaleorTheme =>
86
86
  root: {
87
87
  overflowX: undefined,
88
88
  overflowY: undefined,
89
- padding: `24px 0px`,
90
- margin: `0px 24px`,
89
+ padding: "24px 0px",
90
+ margin: "0px 24px",
91
91
  },
92
92
  },
93
93
  MuiDialogContentText: {
@@ -122,7 +122,7 @@ export const inputOverrides = (
122
122
  backgroundColor: colors.background.default,
123
123
  color: colors.main[3],
124
124
  },
125
- boxShadow: `0 0 0 0 transparent !important`,
125
+ boxShadow: "0 0 0 0 transparent !important",
126
126
  backgroundColor: colors.background.default,
127
127
  },
128
128
  "&$error": {
@@ -12,11 +12,11 @@ describe("Changing color meta tag", () => {
12
12
 
13
13
  // Then
14
14
  expect(
15
- document.querySelector(`head meta[name="tag1"]`)?.getAttribute("content")
15
+ document.querySelector('head meta[name="tag1"]')?.getAttribute("content")
16
16
  ).toBe("value1");
17
17
  expect(
18
18
  document
19
- .querySelector(`head meta[name="theme-color"]`)
19
+ .querySelector('head meta[name="theme-color"]')
20
20
  ?.getAttribute("content")
21
21
  ).toBe("#FF0000");
22
22
  });
@@ -32,11 +32,11 @@ describe("Changing color meta tag", () => {
32
32
 
33
33
  // Then
34
34
  expect(
35
- document.querySelector(`head meta[name="tag1"]`)?.getAttribute("content")
35
+ document.querySelector('head meta[name="tag1"]')?.getAttribute("content")
36
36
  ).toBe("value1");
37
37
  expect(
38
38
  document
39
- .querySelector(`head meta[name="theme-color"]`)
39
+ .querySelector('head meta[name="theme-color"]')
40
40
  ?.getAttribute("content")
41
41
  ).toBe("#FF0000");
42
42
  });
@@ -4,7 +4,7 @@ export function changeColorMeta(color: string) {
4
4
  themeColorTag.setAttribute("name", "theme-color");
5
5
 
6
6
  const existingColorTag = document.head.querySelector(
7
- `meta[name="theme-color"]`
7
+ 'meta[name="theme-color"]'
8
8
  );
9
9
  if (existingColorTag) {
10
10
  existingColorTag.remove();
@@ -4,6 +4,8 @@
4
4
 
5
5
  import { useCallback, useEffect, useState } from "react";
6
6
 
7
+ import { isWindowDefined } from "../consts";
8
+
7
9
  // FIXME: We also had to tweak return signature because tuples were bugging
8
10
  // typescript parser
9
11
  // https://stackoverflow.com/questions/62079477/line-0-parsing-error-cannot-read-property-map-of-undefined
@@ -18,19 +20,22 @@ export default function useLocalStorage(
18
20
  initialValue: string = ""
19
21
  ): UseLocalStorage {
20
22
  const [value, setValue] = useState(
21
- () => window.localStorage.getItem(key) || initialValue
23
+ () => (isWindowDefined && window.localStorage.getItem(key)) || initialValue
22
24
  );
23
25
 
24
26
  const setItem = (newValue: string) => {
25
27
  setValue(newValue);
26
- window.localStorage.setItem(key, newValue);
28
+ if (isWindowDefined) {
29
+ window.localStorage.setItem(key, newValue);
30
+ }
27
31
  };
28
32
 
29
- // eslint-disable-next-line react-hooks/exhaustive-deps
30
33
  useEffect(() => {
31
- const newValue = window.localStorage.getItem(key);
32
- if (value !== newValue) {
33
- setValue(newValue || initialValue);
34
+ if (isWindowDefined) {
35
+ const newValue = window.localStorage.getItem(key);
36
+ if (value !== newValue) {
37
+ setValue(newValue || initialValue);
38
+ }
34
39
  }
35
40
  });
36
41
 
@@ -40,13 +45,15 @@ export default function useLocalStorage(
40
45
  setValue(event.newValue || initialValue);
41
46
  }
42
47
  },
43
- // eslint-disable-next-line react-hooks/exhaustive-deps
44
48
  [value, key]
45
49
  );
46
50
 
47
51
  useEffect(() => {
48
- window.addEventListener("storage", handleStorage);
49
- return () => window.removeEventListener("storage", handleStorage);
52
+ if (isWindowDefined) {
53
+ window.addEventListener("storage", handleStorage);
54
+ return () => window.removeEventListener("storage", handleStorage);
55
+ }
56
+ return;
50
57
  }, [handleStorage]);
51
58
 
52
59
  return {