carbon-react 105.1.0 → 105.2.0

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 (165) hide show
  1. package/esm/__internal__/tooltip-provider/index.d.ts +19 -24
  2. package/esm/__internal__/tooltip-provider/index.js +0 -10
  3. package/esm/__spec_helper__/mock-match-media.d.ts +3 -1
  4. package/esm/components/app-wrapper/app-wrapper.component.d.ts +4 -0
  5. package/esm/components/badge/badge.style.d.ts +4 -2
  6. package/esm/components/button/button-types.style.d.ts +1 -2
  7. package/esm/components/button/button-types.style.js +3 -1
  8. package/esm/components/button/button.component.d.ts +67 -36
  9. package/esm/components/button/button.component.js +3314 -165
  10. package/esm/components/button/button.config.d.ts +4 -3
  11. package/esm/components/button/button.style.d.ts +6 -8
  12. package/esm/components/button/button.style.js +51 -95
  13. package/esm/components/button/index.d.ts +2 -2
  14. package/esm/components/duelling-picklist/picklist-group/picklist-group.style.d.ts +1 -2
  15. package/esm/components/duelling-picklist/picklist-item/picklist-item.style.d.ts +1 -2
  16. package/esm/components/flat-table/flat-table-body-draggable/flat-table-body-draggable.component.js +10 -3
  17. package/esm/components/flat-table/flat-table-body-draggable/flat-table-body-draggable.style.d.ts +2 -0
  18. package/esm/components/flat-table/flat-table-body-draggable/flat-table-body-draggable.style.js +9 -0
  19. package/esm/components/flat-table/flat-table-row/flat-table-row.style.js +0 -1
  20. package/esm/components/heading/heading.component.d.ts +5 -0
  21. package/esm/components/icon/index.d.ts +1 -0
  22. package/esm/components/multi-action-button/multi-action-button.component.d.ts +3 -1
  23. package/esm/components/multi-action-button/multi-action-button.component.js +7 -5
  24. package/esm/components/multi-action-button/multi-action-button.d.ts +4 -2
  25. package/esm/components/multi-step-wizard/multi-step-wizard.d.ts +22 -0
  26. package/esm/components/multi-step-wizard/step/step.d.ts +6 -0
  27. package/esm/components/multi-step-wizard/step/step.style.d.ts +4 -2
  28. package/esm/components/radio-button/radio-button-svg.component.js +29 -16
  29. package/esm/components/scrollable-list/scrollable-list.component.d.ts +8 -0
  30. package/esm/components/select/option/index.d.ts +1 -1
  31. package/esm/components/split-button/split-button-toggle.style.d.ts +2 -6
  32. package/esm/components/split-button/split-button.component.d.ts +3 -1
  33. package/esm/components/split-button/split-button.component.js +7 -4
  34. package/esm/components/split-button/split-button.d.ts +5 -2
  35. package/esm/components/tooltip/index.d.ts +2 -1
  36. package/esm/components/tooltip/tooltip-pointer.style.d.ts +10 -1
  37. package/esm/components/tooltip/tooltip-pointer.style.js +5 -12
  38. package/esm/components/tooltip/tooltip.component.d.ts +33 -2
  39. package/esm/components/tooltip/tooltip.component.js +255 -110
  40. package/esm/components/tooltip/tooltip.config.d.ts +2 -1
  41. package/esm/components/tooltip/tooltip.style.d.ts +7 -2
  42. package/esm/components/tooltip/tooltip.style.js +7 -21
  43. package/esm/components/typography/typography.component.d.ts +1 -1
  44. package/esm/hooks/__internal__/useCharacterCount/index.d.ts +1 -2
  45. package/esm/hooks/__internal__/useCharacterCount/index.js +1 -18
  46. package/esm/hooks/__internal__/useCharacterCount/useCharacterCount.d.ts +3 -0
  47. package/esm/hooks/__internal__/useCharacterCount/useCharacterCount.js +24 -0
  48. package/esm/hooks/__internal__/useInputAccessibility/index.d.ts +1 -24
  49. package/esm/hooks/__internal__/useInputAccessibility/useInputAccessibility.d.ts +11 -11
  50. package/esm/hooks/__internal__/useInputAccessibility/useInputAccessibility.js +1 -3
  51. package/esm/hooks/__internal__/useIsAboveBreakpoint/index.d.ts +1 -1
  52. package/esm/hooks/__internal__/useIsAboveBreakpoint/index.js +1 -6
  53. package/esm/hooks/__internal__/useIsAboveBreakpoint/useIsAboveBreakpoint.d.ts +1 -0
  54. package/esm/hooks/__internal__/useIsAboveBreakpoint/useIsAboveBreakpoint.js +6 -0
  55. package/esm/hooks/__internal__/useLocale/index.d.ts +1 -1
  56. package/esm/hooks/__internal__/useLocale/index.js +1 -5
  57. package/esm/hooks/__internal__/useLocale/useLocale.d.ts +1 -0
  58. package/esm/hooks/__internal__/useLocale/useLocale.js +5 -0
  59. package/esm/hooks/__internal__/useResizeObserver/index.d.ts +1 -10
  60. package/esm/hooks/__internal__/useResizeObserver/index.js +1 -23
  61. package/esm/hooks/__internal__/useResizeObserver/useResizeObserver.d.ts +8 -0
  62. package/esm/hooks/__internal__/useResizeObserver/useResizeObserver.js +29 -0
  63. package/esm/hooks/__internal__/useScrollBlock/index.d.ts +1 -4
  64. package/esm/hooks/__internal__/useScrollBlock/scroll-block-manager.d.ts +23 -9
  65. package/esm/hooks/__internal__/useScrollBlock/scroll-block-manager.js +24 -12
  66. package/esm/hooks/__internal__/useScrollBlock/useScrollBlock.d.ts +2 -2
  67. package/esm/hooks/__internal__/useScrollBlock/useScrollBlock.js +3 -5
  68. package/esm/hooks/useMediaQuery/index.d.ts +1 -1
  69. package/esm/hooks/useMediaQuery/index.js +1 -19
  70. package/esm/hooks/useMediaQuery/useMediaQuery.d.ts +1 -0
  71. package/esm/hooks/useMediaQuery/useMediaQuery.js +19 -0
  72. package/esm/locales/en-gb.d.ts +3 -5
  73. package/esm/locales/en-gb.js +5 -4
  74. package/esm/locales/index.d.ts +1 -1
  75. package/esm/locales/index.js +2 -0
  76. package/esm/locales/locale.d.ts +99 -105
  77. package/esm/locales/locale.js +1 -0
  78. package/esm/locales/pl-pl.d.ts +3 -5
  79. package/esm/locales/pl-pl.js +5 -4
  80. package/lib/__internal__/tooltip-provider/index.d.ts +19 -24
  81. package/lib/__internal__/tooltip-provider/index.js +1 -12
  82. package/lib/__spec_helper__/mock-match-media.d.ts +3 -1
  83. package/lib/components/app-wrapper/app-wrapper.component.d.ts +4 -0
  84. package/lib/components/badge/badge.style.d.ts +4 -2
  85. package/lib/components/button/button-types.style.d.ts +1 -2
  86. package/lib/components/button/button-types.style.js +0 -1
  87. package/lib/components/button/button.component.d.ts +67 -36
  88. package/lib/components/button/button.component.js +3381 -172
  89. package/lib/components/button/button.config.d.ts +4 -3
  90. package/lib/components/button/button.style.d.ts +6 -8
  91. package/lib/components/button/button.style.js +52 -101
  92. package/lib/components/button/index.d.ts +2 -2
  93. package/lib/components/duelling-picklist/picklist-group/picklist-group.style.d.ts +1 -2
  94. package/lib/components/duelling-picklist/picklist-item/picklist-item.style.d.ts +1 -2
  95. package/lib/components/flat-table/flat-table-body-draggable/flat-table-body-draggable.component.js +10 -3
  96. package/lib/components/flat-table/flat-table-body-draggable/flat-table-body-draggable.style.d.ts +2 -0
  97. package/lib/components/flat-table/flat-table-body-draggable/flat-table-body-draggable.style.js +22 -0
  98. package/lib/components/flat-table/flat-table-row/flat-table-row.style.js +0 -1
  99. package/lib/components/heading/heading.component.d.ts +5 -0
  100. package/lib/components/icon/index.d.ts +1 -0
  101. package/lib/components/multi-action-button/multi-action-button.component.d.ts +3 -1
  102. package/lib/components/multi-action-button/multi-action-button.component.js +6 -4
  103. package/lib/components/multi-action-button/multi-action-button.d.ts +4 -2
  104. package/lib/components/multi-step-wizard/multi-step-wizard.d.ts +22 -0
  105. package/lib/components/multi-step-wizard/step/step.d.ts +6 -0
  106. package/lib/components/multi-step-wizard/step/step.style.d.ts +4 -2
  107. package/lib/components/radio-button/radio-button-svg.component.js +38 -20
  108. package/lib/components/scrollable-list/scrollable-list.component.d.ts +8 -0
  109. package/lib/components/select/option/index.d.ts +1 -1
  110. package/lib/components/split-button/split-button-toggle.style.d.ts +2 -6
  111. package/lib/components/split-button/split-button.component.d.ts +3 -1
  112. package/lib/components/split-button/split-button.component.js +6 -3
  113. package/lib/components/split-button/split-button.d.ts +5 -2
  114. package/lib/components/tooltip/index.d.ts +2 -1
  115. package/lib/components/tooltip/tooltip-pointer.style.d.ts +10 -1
  116. package/lib/components/tooltip/tooltip-pointer.style.js +7 -15
  117. package/lib/components/tooltip/tooltip.component.d.ts +33 -2
  118. package/lib/components/tooltip/tooltip.component.js +221 -130
  119. package/lib/components/tooltip/tooltip.config.d.ts +2 -1
  120. package/lib/components/tooltip/tooltip.style.d.ts +7 -2
  121. package/lib/components/tooltip/tooltip.style.js +7 -22
  122. package/lib/components/typography/typography.component.d.ts +1 -1
  123. package/lib/components/vertical-divider/vertical-divider.component.js +3 -0
  124. package/lib/hooks/__internal__/useCharacterCount/index.d.ts +1 -2
  125. package/lib/hooks/__internal__/useCharacterCount/index.js +8 -27
  126. package/lib/hooks/__internal__/useCharacterCount/useCharacterCount.d.ts +3 -0
  127. package/lib/hooks/__internal__/useCharacterCount/useCharacterCount.js +40 -0
  128. package/lib/hooks/__internal__/useInputAccessibility/index.d.ts +1 -24
  129. package/lib/hooks/__internal__/useInputAccessibility/useInputAccessibility.d.ts +11 -11
  130. package/lib/hooks/__internal__/useInputAccessibility/useInputAccessibility.js +1 -3
  131. package/lib/hooks/__internal__/useIsAboveBreakpoint/index.d.ts +1 -1
  132. package/lib/hooks/__internal__/useIsAboveBreakpoint/index.js +8 -9
  133. package/lib/hooks/__internal__/useIsAboveBreakpoint/useIsAboveBreakpoint.d.ts +1 -0
  134. package/lib/hooks/__internal__/useIsAboveBreakpoint/useIsAboveBreakpoint.js +16 -0
  135. package/lib/hooks/__internal__/useLocale/index.d.ts +1 -1
  136. package/lib/hooks/__internal__/useLocale/index.js +8 -9
  137. package/lib/hooks/__internal__/useLocale/useLocale.d.ts +1 -0
  138. package/lib/hooks/__internal__/useLocale/useLocale.js +16 -0
  139. package/lib/hooks/__internal__/useResizeObserver/index.d.ts +1 -10
  140. package/lib/hooks/__internal__/useResizeObserver/index.js +8 -24
  141. package/lib/hooks/__internal__/useResizeObserver/useResizeObserver.d.ts +8 -0
  142. package/lib/hooks/__internal__/useResizeObserver/useResizeObserver.js +37 -0
  143. package/lib/hooks/__internal__/useScrollBlock/index.d.ts +1 -4
  144. package/lib/hooks/__internal__/useScrollBlock/scroll-block-manager.d.ts +23 -9
  145. package/lib/hooks/__internal__/useScrollBlock/scroll-block-manager.js +24 -12
  146. package/lib/hooks/__internal__/useScrollBlock/useScrollBlock.d.ts +2 -2
  147. package/lib/hooks/__internal__/useScrollBlock/useScrollBlock.js +3 -5
  148. package/lib/hooks/useMediaQuery/index.d.ts +1 -1
  149. package/lib/hooks/useMediaQuery/index.js +8 -25
  150. package/lib/hooks/useMediaQuery/useMediaQuery.d.ts +1 -0
  151. package/lib/hooks/useMediaQuery/useMediaQuery.js +32 -0
  152. package/lib/locales/en-gb.d.ts +3 -5
  153. package/lib/locales/en-gb.js +2 -1
  154. package/lib/locales/index.d.ts +1 -1
  155. package/lib/locales/index.js +23 -0
  156. package/lib/locales/locale.d.ts +99 -105
  157. package/lib/locales/locale.js +5 -0
  158. package/lib/locales/package.json +6 -0
  159. package/lib/locales/pl-pl.d.ts +3 -5
  160. package/lib/locales/pl-pl.js +2 -1
  161. package/package.json +11 -6
  162. package/esm/components/button/button.d.ts +0 -85
  163. package/esm/components/tooltip/tooltip.d.ts +0 -40
  164. package/lib/components/button/button.d.ts +0 -85
  165. package/lib/components/tooltip/tooltip.d.ts +0 -40
@@ -1,14 +1,14 @@
1
1
  export default function useInputAccessibility({ id, error, warning, info, label, fieldHelp, }: {
2
- id: any;
3
- error: any;
4
- warning: any;
5
- info: any;
6
- label: any;
7
- fieldHelp: any;
2
+ id: string;
3
+ error?: string;
4
+ warning?: string;
5
+ info?: string;
6
+ label?: string;
7
+ fieldHelp?: string;
8
8
  }): {
9
- labelId: string | undefined;
10
- validationIconId: string | undefined;
11
- fieldHelpId: string | undefined;
12
- ariaDescribedBy: string;
13
- ariaLabelledBy: string | undefined;
9
+ labelId?: string;
10
+ validationIconId?: string;
11
+ fieldHelpId?: string;
12
+ ariaDescribedBy?: string;
13
+ ariaLabelledBy?: string;
14
14
  };
@@ -7,9 +7,7 @@ export default function useInputAccessibility({
7
7
  fieldHelp
8
8
  }) {
9
9
  const labelId = label ? `${id}-label` : undefined;
10
- const validationIconId = [error, warning, info].filter(validation => {
11
- return validation && typeof validation === "string";
12
- }).length ? `${id}-validation-icon` : undefined;
10
+ const validationIconId = [error, warning, info].filter(validation => validation && typeof validation === "string").length ? `${id}-validation-icon` : undefined;
13
11
  const fieldHelpId = fieldHelp ? `${id}-field-help` : undefined;
14
12
  const ariaDescribedBy = [fieldHelpId, validationIconId].filter(Boolean).join(" ");
15
13
  const ariaLabelledBy = labelId;
@@ -1 +1 @@
1
- export default function useIsAboveBreakpoint(breakpoint?: number): boolean;
1
+ export { default } from "./useIsAboveBreakpoint";
@@ -1,6 +1 @@
1
- import useMediaQuery from "../../useMediaQuery";
2
- export default function useIsAboveBreakpoint(breakpoint) {
3
- const matchesQuery = useMediaQuery(`(min-width:${breakpoint}px)`);
4
- if (!breakpoint) return undefined;
5
- return matchesQuery;
6
- }
1
+ export { default } from "./useIsAboveBreakpoint";
@@ -0,0 +1 @@
1
+ export default function useIsAboveBreakpoint(breakpoint?: number): boolean | undefined;
@@ -0,0 +1,6 @@
1
+ import useMediaQuery from "../../useMediaQuery";
2
+ export default function useIsAboveBreakpoint(breakpoint) {
3
+ const matchesQuery = useMediaQuery(`(min-width:${breakpoint}px)`);
4
+ if (!breakpoint) return undefined;
5
+ return matchesQuery;
6
+ }
@@ -1 +1 @@
1
- export default function useLocale(): import("../../../locales/locale").default;
1
+ export { default } from "./useLocale";
@@ -1,5 +1 @@
1
- import { useContext } from "react";
2
- import Context from "../../../__internal__/i18n-context";
3
- export default function useLocale() {
4
- return useContext(Context);
5
- }
1
+ export { default } from "./useLocale";
@@ -0,0 +1 @@
1
+ export default function useLocale(): import("../../../locales/locale").default;
@@ -0,0 +1,5 @@
1
+ import { useContext } from "react";
2
+ import Context from "../../../__internal__/i18n-context";
3
+ export default function useLocale() {
4
+ return useContext(Context);
5
+ }
@@ -1,10 +1 @@
1
- import * as React from "react";
2
-
3
- export default function useResizeObserver(
4
- /** Reference to the resizable HTML element - */
5
- ref: React.RefObject<HTMLElement>,
6
- /** Callback meant to be executed on element resize */
7
- onResize: () => void,
8
- /** Flag to indicate whether hook should be disabled */
9
- disabled?: boolean
10
- ): void;
1
+ export { default } from "./useResizeObserver";
@@ -1,23 +1 @@
1
- import { useRef, useLayoutEffect } from "react";
2
- export default function useResizeObserver(ref, onResize, disabled) {
3
- const observer = useRef(null);
4
- const onResizeRef = useRef(null);
5
- onResizeRef.current = onResize;
6
- useLayoutEffect(() => {
7
- const referenceRef = ref.current;
8
-
9
- if (!disabled) {
10
- observer.current = new ResizeObserver(() => {
11
- onResizeRef === null || onResizeRef === void 0 ? void 0 : onResizeRef.current();
12
- });
13
- observer.current.observe(referenceRef);
14
- }
15
-
16
- return () => {
17
- if (!disabled) {
18
- observer.current.unobserve(referenceRef);
19
- observer.current.disconnect();
20
- }
21
- };
22
- }, [ref, disabled]);
23
- }
1
+ export { default } from "./useResizeObserver";
@@ -0,0 +1,8 @@
1
+ import { RefObject } from "react";
2
+ export default function useResizeObserver(
3
+ /** Reference to the resizable HTML element */
4
+ ref: RefObject<Element>,
5
+ /** Callback meant to be executed on element resize */
6
+ onResize: () => void,
7
+ /** Flag to indicate whether hook should be disabled */
8
+ disabled?: boolean): void;
@@ -0,0 +1,29 @@
1
+ import { useRef, useLayoutEffect } from "react";
2
+ export default function useResizeObserver(
3
+ /** Reference to the resizable HTML element */
4
+ ref,
5
+ /** Callback meant to be executed on element resize */
6
+ onResize,
7
+ /** Flag to indicate whether hook should be disabled */
8
+ disabled) {
9
+ const observer = useRef();
10
+ const onResizeRef = useRef(onResize);
11
+ onResizeRef.current = onResize;
12
+ useLayoutEffect(() => {
13
+ const referenceRef = ref.current;
14
+
15
+ if (!disabled && referenceRef) {
16
+ observer.current = new ResizeObserver(() => {
17
+ onResizeRef === null || onResizeRef === void 0 ? void 0 : onResizeRef.current();
18
+ });
19
+ observer.current.observe(referenceRef);
20
+ }
21
+
22
+ return () => {
23
+ if (!disabled && referenceRef && observer.current) {
24
+ observer.current.unobserve(referenceRef);
25
+ observer.current.disconnect();
26
+ }
27
+ };
28
+ }, [ref, disabled]);
29
+ }
@@ -1,4 +1 @@
1
- export default function useScrollBlock(): {
2
- blockScroll: () => void;
3
- allowScroll: () => void;
4
- };
1
+ export { default } from "./useScrollBlock";
@@ -1,12 +1,26 @@
1
- export default ScrollBlockManager;
1
+ declare global {
2
+ interface Window {
3
+ __CARBON_INTERNALS_SCROLL_BLOCKERS?: {
4
+ components: {
5
+ [key: string]: boolean;
6
+ };
7
+ originalValues: string[];
8
+ restoreValues?: (() => void) | null;
9
+ };
10
+ }
11
+ }
2
12
  declare class ScrollBlockManager {
3
- components: any;
4
- originalValues: any;
5
- registerComponent(id: any): void;
6
- unregisterComponent(id: any): void;
7
- saveOriginalValues(values: any): void;
8
- saveRestoreValuesCallback(callback: any): void;
9
- getRestoreValuesCallback(): any;
10
- getOriginalValues(): any;
13
+ components: {
14
+ [key: string]: boolean;
15
+ };
16
+ originalValues: string[];
17
+ constructor();
18
+ registerComponent(id: string): void;
19
+ unregisterComponent(id: string): void;
20
+ saveRestoreValuesCallback(callback: (() => void) | null): void;
21
+ getRestoreValuesCallback(): (() => void) | null | undefined;
22
+ saveOriginalValues(values: string[]): void;
23
+ getOriginalValues(): string[];
11
24
  isBlocked(): boolean;
12
25
  }
26
+ export default ScrollBlockManager;
@@ -4,19 +4,26 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+
4
4
 
5
5
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
6
6
 
7
- // TODO: This component can be refactored to remove redundant code after
8
- // we can confirm that all Sage products use version 105.0.0^
7
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
8
+
9
+ // TODO: This component can be refactored to remove redundant code
10
+ // once we can confirm that all Sage products use version 105.0.0^
9
11
  let ScrollBlockManager = /*#__PURE__*/function () {
10
12
  function ScrollBlockManager() {
11
13
  _classCallCheck(this, ScrollBlockManager);
12
14
 
15
+ _defineProperty(this, "components", void 0);
16
+
17
+ _defineProperty(this, "originalValues", void 0);
18
+
13
19
  // Due to possibility of multiple carbon versions using it
14
20
  // it is necessary to maintain same structure in this global variable
15
21
  if (!window.__CARBON_INTERNALS_SCROLL_BLOCKERS) {
16
22
  window.__CARBON_INTERNALS_SCROLL_BLOCKERS = {
17
23
  components: {},
18
24
  // originalValues can be removed
19
- originalValues: []
25
+ originalValues: [],
26
+ restoreValues: null
20
27
  };
21
28
  }
22
29
 
@@ -34,23 +41,28 @@ let ScrollBlockManager = /*#__PURE__*/function () {
34
41
  key: "unregisterComponent",
35
42
  value: function unregisterComponent(id) {
36
43
  delete this.components[id];
37
- } // TODO: saveOriginalValues can be removed
38
-
39
- }, {
40
- key: "saveOriginalValues",
41
- value: function saveOriginalValues(values) {
42
- this.originalValues.length = 0;
43
- this.originalValues.push(...values);
44
44
  }
45
45
  }, {
46
46
  key: "saveRestoreValuesCallback",
47
47
  value: function saveRestoreValuesCallback(callback) {
48
- window.__CARBON_INTERNALS_SCROLL_BLOCKERS.restoreValues = callback;
48
+ /* istanbul ignore else */
49
+ if (window.__CARBON_INTERNALS_SCROLL_BLOCKERS) {
50
+ window.__CARBON_INTERNALS_SCROLL_BLOCKERS.restoreValues = callback;
51
+ }
49
52
  }
50
53
  }, {
51
54
  key: "getRestoreValuesCallback",
52
55
  value: function getRestoreValuesCallback() {
53
- return window.__CARBON_INTERNALS_SCROLL_BLOCKERS.restoreValues;
56
+ var _window$__CARBON_INTE;
57
+
58
+ return (_window$__CARBON_INTE = window.__CARBON_INTERNALS_SCROLL_BLOCKERS) === null || _window$__CARBON_INTE === void 0 ? void 0 : _window$__CARBON_INTE.restoreValues;
59
+ } // TODO: saveOriginalValues can be removed
60
+
61
+ }, {
62
+ key: "saveOriginalValues",
63
+ value: function saveOriginalValues(values) {
64
+ this.originalValues.length = 0;
65
+ this.originalValues.push(...values);
54
66
  } // TODO: getOriginalValues can be removed
55
67
 
56
68
  }, {
@@ -1,5 +1,5 @@
1
- export default useScrollBlock;
2
- declare function useScrollBlock(): {
1
+ declare const useScrollBlock: () => {
3
2
  blockScroll: () => void;
4
3
  allowScroll: () => void;
5
4
  };
5
+ export default useScrollBlock;
@@ -4,20 +4,18 @@ import ScrollBlockManager from "./scroll-block-manager"; // TODO: This component
4
4
  // we can confirm that all Sage products use version 105.0.0^
5
5
 
6
6
  const scrollBlockManager = new ScrollBlockManager();
7
- /* istanbul ignore next */
8
-
9
- const safeDocument = typeof document !== "undefined" ? document : {};
10
7
 
11
8
  const useScrollBlock = () => {
12
9
  const {
13
10
  current: containerGuid
14
11
  } = useRef(guid());
15
- const originalValuesRef = useRef();
12
+ const originalValuesRef = useRef([]);
16
13
  const rules = useMemo(() => {
14
+ /* istanbul ignore next */
17
15
  const {
18
16
  documentElement,
19
17
  body
20
- } = safeDocument;
18
+ } = document || {};
21
19
  const scrollBarWidth = window.innerWidth - documentElement.clientWidth;
22
20
  const bodyPaddingRight = parseInt(window.getComputedStyle(body).getPropertyValue("padding-right")) || 0;
23
21
  return [// TODO: First two entries of this array with the documentElement can be removed
@@ -1 +1 @@
1
- export default function useMediaQuery(query: string): boolean;
1
+ export { default } from "./useMediaQuery";
@@ -1,19 +1 @@
1
- import React from "react";
2
- export default function useMediaQuery(queryInput) {
3
- const query = queryInput.replace(/^@media( ?)/m, "");
4
- const [match, setMatch] = React.useState(() => false);
5
- React.useEffect(() => {
6
- const queryList = window.matchMedia(query);
7
-
8
- const updateMatch = () => {
9
- setMatch(queryList.matches);
10
- };
11
-
12
- updateMatch();
13
- queryList.addListener(updateMatch);
14
- return () => {
15
- queryList.removeListener(updateMatch);
16
- };
17
- }, [query]);
18
- return match;
19
- }
1
+ export { default } from "./useMediaQuery";
@@ -0,0 +1 @@
1
+ export default function useMediaQuery(queryInput: string): boolean;
@@ -0,0 +1,19 @@
1
+ import React from "react";
2
+ export default function useMediaQuery(queryInput) {
3
+ const query = queryInput.replace(/^@media( ?)/m, "");
4
+ const [match, setMatch] = React.useState(() => false);
5
+ React.useEffect(() => {
6
+ const queryList = window.matchMedia(query);
7
+
8
+ const updateMatch = () => {
9
+ setMatch(queryList.matches);
10
+ };
11
+
12
+ updateMatch();
13
+ queryList.addListener(updateMatch);
14
+ return () => {
15
+ queryList.removeListener(updateMatch);
16
+ };
17
+ }, [query]);
18
+ return match;
19
+ }
@@ -1,5 +1,3 @@
1
- import Locale from ".";
2
-
3
- declare const EnGb: Locale;
4
-
5
- export default EnGb;
1
+ import Locale from "./locale";
2
+ declare const enGB: Locale;
3
+ export default enGB;
@@ -1,8 +1,8 @@
1
- import { enGB } from "./date-fns-locales";
1
+ import { enGB as enGBDateLocale } from "./date-fns-locales";
2
2
 
3
3
  const isSingular = count => (typeof count === "string" ? parseInt(count) : count) === 1;
4
4
 
5
- export default {
5
+ const enGB = {
6
6
  locale: () => "en-GB",
7
7
  actions: {
8
8
  edit: () => "Edit",
@@ -19,7 +19,7 @@ export default {
19
19
  yes: () => "Yes"
20
20
  },
21
21
  date: {
22
- dateFnsLocale: () => enGB
22
+ dateFnsLocale: () => enGBDateLocale
23
23
  },
24
24
  dialog: {
25
25
  ariaLabels: {
@@ -128,4 +128,5 @@ export default {
128
128
  }
129
129
  }
130
130
  }
131
- };
131
+ };
132
+ export default enGB;
@@ -1,3 +1,3 @@
1
- export { default } from "./locale";
1
+ export type { default } from "./locale";
2
2
  export { default as EnGb } from "./en-gb";
3
3
  export { default as PlPl } from "./pl-pl";
@@ -0,0 +1,2 @@
1
+ export { default as EnGb } from "./en-gb";
2
+ export { default as PlPl } from "./pl-pl";
@@ -1,111 +1,105 @@
1
1
  import { Locale as DateFnsLocale } from "date-fns";
2
-
3
2
  interface Locale {
4
- locale: () => string;
5
- actions: {
6
- edit: () => string;
7
- delete: () => string;
8
- };
9
- actionPopover: {
10
- ariaLabel: () => string;
11
- };
12
- batchSelection: {
13
- selected: (count: number | string) => string;
14
- };
15
- confirm: {
16
- no: () => string;
17
- yes: () => string;
18
- };
19
- date: {
20
- dateFnsLocale: () => DateFnsLocale;
21
- };
22
- dialog: {
23
- ariaLabels: {
24
- close: () => string;
25
- };
26
- };
27
- dialogFullScreen: {
28
- ariaLabels: {
29
- close: () => string;
30
- };
31
- };
32
- errors: {
33
- messages: {
34
- formSummary: (
35
- errors: number,
36
- warnings: number,
37
- type: string
38
- ) => [string, string] | null;
39
- };
40
- };
41
- message: {
42
- closeButtonAriaLabel: () => string;
43
- };
44
- numeralDate: {
45
- validation: {
46
- day: () => string;
47
- month: () => string;
48
- year: () => string;
49
- };
50
- };
51
- pager: {
52
- show: () => string;
53
- records: (count: number | string, showNumber: boolean) => string;
54
- first: () => string;
55
- last: () => string;
56
- next: () => string;
57
- previous: () => string;
58
- pageX: () => string;
59
- ofY: (count: string | number) => string;
60
- };
61
- select: {
62
- actionButtonText: () => string;
63
- placeholder: () => string;
64
- noResultsForTerm: (term: string) => string;
65
- };
66
- link: {
67
- skipLinkLabel: () => string;
68
- };
69
- sidebar: {
70
- ariaLabels: {
71
- close: () => string;
72
- };
73
- };
74
- switch: {
75
- on: () => string;
76
- off: () => string;
77
- };
78
- textEditor: {
79
- tooltipMessages: {
80
- bold: () => string;
81
- italic: () => string;
82
- bulletList: () => string;
83
- numberList: () => string;
84
- };
85
- ariaLabels: {
86
- bold: () => string;
87
- italic: () => string;
88
- bulletList: () => string;
89
- numberList: () => string;
90
- };
91
- };
92
- tileSelect: {
93
- deselect: () => string;
94
- };
95
- toast: {
96
- ariaLabels: {
97
- close: () => string;
98
- };
99
- };
100
- wizards: {
101
- multiStep: {
102
- buttons: {
103
- submit: () => string;
3
+ locale: () => string;
4
+ actions: {
5
+ edit: () => string;
6
+ delete: () => string;
7
+ };
8
+ actionPopover: {
9
+ ariaLabel: () => string;
10
+ };
11
+ batchSelection: {
12
+ selected: (count: number | string) => string;
13
+ };
14
+ confirm: {
15
+ no: () => string;
16
+ yes: () => string;
17
+ };
18
+ date: {
19
+ dateFnsLocale: () => DateFnsLocale;
20
+ };
21
+ dialog: {
22
+ ariaLabels: {
23
+ close: () => string;
24
+ };
25
+ };
26
+ dialogFullScreen: {
27
+ ariaLabels: {
28
+ close: () => string;
29
+ };
30
+ };
31
+ errors: {
32
+ messages: {
33
+ formSummary: (errors: number, warnings: number, type: string) => [string, string] | null;
34
+ };
35
+ };
36
+ message: {
37
+ closeButtonAriaLabel: () => string;
38
+ };
39
+ numeralDate: {
40
+ validation: {
41
+ day: () => string;
42
+ month: () => string;
43
+ year: () => string;
44
+ };
45
+ };
46
+ pager: {
47
+ show: () => string;
48
+ records: (count: number | string, showNumber: boolean) => string;
49
+ first: () => string;
50
+ last: () => string;
104
51
  next: () => string;
105
- back: () => string;
106
- };
52
+ previous: () => string;
53
+ pageX: () => string;
54
+ ofY: (count: string | number) => string;
55
+ };
56
+ select: {
57
+ actionButtonText: () => string;
58
+ placeholder: () => string;
59
+ noResultsForTerm: (term: string) => string;
60
+ };
61
+ link: {
62
+ skipLinkLabel: () => string;
63
+ };
64
+ sidebar: {
65
+ ariaLabels: {
66
+ close: () => string;
67
+ };
68
+ };
69
+ switch: {
70
+ on: () => string;
71
+ off: () => string;
72
+ };
73
+ textEditor: {
74
+ tooltipMessages: {
75
+ bold: () => string;
76
+ italic: () => string;
77
+ bulletList: () => string;
78
+ numberList: () => string;
79
+ };
80
+ ariaLabels: {
81
+ bold: () => string;
82
+ italic: () => string;
83
+ bulletList: () => string;
84
+ numberList: () => string;
85
+ };
86
+ };
87
+ tileSelect: {
88
+ deselect: () => string;
89
+ };
90
+ toast: {
91
+ ariaLabels: {
92
+ close: () => string;
93
+ };
94
+ };
95
+ wizards: {
96
+ multiStep: {
97
+ buttons: {
98
+ submit: () => string;
99
+ next: () => string;
100
+ back: () => string;
101
+ };
102
+ };
107
103
  };
108
- };
109
104
  }
110
-
111
105
  export default Locale;
@@ -0,0 +1 @@
1
+ export {};
@@ -1,5 +1,3 @@
1
- import Locale from ".";
2
-
3
- declare const PlPl: Locale;
4
-
5
- export default PlPl;
1
+ import Locale from "./locale";
2
+ declare const plPL: Locale;
3
+ export default plPL;
@@ -1,8 +1,8 @@
1
- import { pl } from "./date-fns-locales";
1
+ import { pl as plDateLocale } from "./date-fns-locales";
2
2
 
3
3
  const isSingular = count => (typeof count === "string" ? parseInt(count) : count) === 1;
4
4
 
5
- export default {
5
+ const plPL = {
6
6
  locale: () => "pl-PL",
7
7
  actions: {
8
8
  edit: () => "Edytuj",
@@ -19,7 +19,7 @@ export default {
19
19
  yes: () => "Tak"
20
20
  },
21
21
  date: {
22
- dateFnsLocale: () => pl
22
+ dateFnsLocale: () => plDateLocale
23
23
  },
24
24
  dialog: {
25
25
  ariaLabels: {
@@ -126,4 +126,5 @@ export default {
126
126
  }
127
127
  }
128
128
  }
129
- };
129
+ };
130
+ export default plPL;