@jobber/components 6.90.4 → 6.91.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 (211) hide show
  1. package/dist/AtlantisThemeContext-es.js +1 -1
  2. package/dist/Autocomplete/index.cjs +12 -15
  3. package/dist/Autocomplete/index.mjs +13 -16
  4. package/dist/Banner/index.cjs +1 -6
  5. package/dist/Banner/index.mjs +1 -6
  6. package/dist/Banner-cjs.js +2 -2
  7. package/dist/Banner-es.js +2 -2
  8. package/dist/Card/index.cjs +1 -4
  9. package/dist/Card/index.mjs +1 -4
  10. package/dist/Chip/index.cjs +1 -3
  11. package/dist/Chip/index.mjs +1 -3
  12. package/dist/Chip-cjs.js +3 -3
  13. package/dist/Chip-es.js +3 -3
  14. package/dist/Chips/InternalChipDismissible/hooks/index.cjs +1 -0
  15. package/dist/Chips/InternalChipDismissible/hooks/index.mjs +1 -0
  16. package/dist/Chips/InternalChipDismissible/index.cjs +1 -3
  17. package/dist/Chips/InternalChipDismissible/index.mjs +1 -3
  18. package/dist/Chips/index.cjs +1 -3
  19. package/dist/Chips/index.mjs +1 -3
  20. package/dist/Combobox/components/ComboboxActivator/index.cjs +1 -3
  21. package/dist/Combobox/components/ComboboxActivator/index.mjs +1 -3
  22. package/dist/Combobox/components/ComboboxContent/ComboboxContentList/index.cjs +1 -1
  23. package/dist/Combobox/components/ComboboxContent/ComboboxContentList/index.mjs +1 -1
  24. package/dist/Combobox/components/ComboboxContent/ComboboxLoadMore/index.cjs +1 -1
  25. package/dist/Combobox/components/ComboboxContent/ComboboxLoadMore/index.mjs +1 -1
  26. package/dist/Combobox/components/ComboboxContent/index.cjs +1 -3
  27. package/dist/Combobox/components/ComboboxContent/index.mjs +1 -3
  28. package/dist/Combobox/components/ComboboxTrigger/index.cjs +1 -3
  29. package/dist/Combobox/components/ComboboxTrigger/index.mjs +1 -3
  30. package/dist/Combobox/index.cjs +1 -6
  31. package/dist/Combobox/index.mjs +1 -6
  32. package/dist/Combobox-cjs.js +2 -2
  33. package/dist/Combobox-es.js +2 -2
  34. package/dist/ComboboxContent-cjs.js +3 -4
  35. package/dist/ComboboxContent-es.js +4 -5
  36. package/dist/ComboboxLoadMore-cjs.js +2 -2
  37. package/dist/ComboboxLoadMore-es.js +2 -2
  38. package/dist/ConfirmationModal/index.cjs +1 -3
  39. package/dist/ConfirmationModal/index.mjs +1 -3
  40. package/dist/ConfirmationModal-cjs.js +2 -2
  41. package/dist/ConfirmationModal-es.js +2 -2
  42. package/dist/ContentBlock/index.cjs +1 -6
  43. package/dist/ContentBlock/index.mjs +1 -6
  44. package/dist/ContentBlock-cjs.js +2 -2
  45. package/dist/ContentBlock-es.js +2 -2
  46. package/dist/DataDump/index.cjs +1 -4
  47. package/dist/DataDump/index.mjs +1 -4
  48. package/dist/DataList/components/DataListActions/index.cjs +1 -5
  49. package/dist/DataList/components/DataListActions/index.mjs +1 -5
  50. package/dist/DataList/components/DataListActionsMenu/index.cjs +1 -5
  51. package/dist/DataList/components/DataListActionsMenu/index.mjs +1 -5
  52. package/dist/DataList/components/DataListBulkActions/index.cjs +1 -5
  53. package/dist/DataList/components/DataListBulkActions/index.mjs +1 -5
  54. package/dist/DataList/components/DataListFilters/components/DataListSort/index.cjs +1 -6
  55. package/dist/DataList/components/DataListFilters/components/DataListSort/index.mjs +1 -6
  56. package/dist/DataList/components/DataListFilters/index.cjs +1 -7
  57. package/dist/DataList/components/DataListFilters/index.mjs +1 -7
  58. package/dist/DataList/components/DataListHeader/index.cjs +1 -5
  59. package/dist/DataList/components/DataListHeader/index.mjs +1 -5
  60. package/dist/DataList/components/DataListHeaderTile/components/index.cjs +1 -2
  61. package/dist/DataList/components/DataListHeaderTile/components/index.mjs +1 -2
  62. package/dist/DataList/components/DataListHeaderTile/index.cjs +1 -3
  63. package/dist/DataList/components/DataListHeaderTile/index.mjs +1 -3
  64. package/dist/DataList/components/DataListItem/index.cjs +1 -5
  65. package/dist/DataList/components/DataListItem/index.mjs +1 -5
  66. package/dist/DataList/components/DataListItemActions/index.cjs +1 -5
  67. package/dist/DataList/components/DataListItemActions/index.mjs +1 -5
  68. package/dist/DataList/components/DataListItemActionsOverflow/index.cjs +1 -5
  69. package/dist/DataList/components/DataListItemActionsOverflow/index.mjs +1 -5
  70. package/dist/DataList/components/DataListItems/index.cjs +1 -5
  71. package/dist/DataList/components/DataListItems/index.mjs +1 -5
  72. package/dist/DataList/components/DataListLayout/index.cjs +1 -5
  73. package/dist/DataList/components/DataListLayout/index.mjs +1 -5
  74. package/dist/DataList/components/DataListLayoutActions/index.cjs +1 -5
  75. package/dist/DataList/components/DataListLayoutActions/index.mjs +1 -5
  76. package/dist/DataList/components/DataListLoadMore/index.cjs +1 -1
  77. package/dist/DataList/components/DataListLoadMore/index.mjs +1 -1
  78. package/dist/DataList/components/DataListOverflowFade/index.cjs +1 -1
  79. package/dist/DataList/components/DataListOverflowFade/index.mjs +1 -1
  80. package/dist/DataList/components/DataListSearch/index.cjs +1 -2
  81. package/dist/DataList/components/DataListSearch/index.mjs +1 -2
  82. package/dist/DataList/components/DataListStatusBar/index.cjs +1 -3
  83. package/dist/DataList/components/DataListStatusBar/index.mjs +1 -3
  84. package/dist/DataList/index.cjs +1 -7
  85. package/dist/DataList/index.mjs +1 -7
  86. package/dist/DataListActionsMenu-cjs.js +5 -8
  87. package/dist/DataListActionsMenu-es.js +5 -8
  88. package/dist/DataListHeaderTile-cjs.js +2 -2
  89. package/dist/DataListHeaderTile-es.js +2 -2
  90. package/dist/DataListLoadMore-cjs.js +2 -2
  91. package/dist/DataListLoadMore-es.js +2 -2
  92. package/dist/DataListOverflowFade-cjs.js +3 -3
  93. package/dist/DataListOverflowFade-es.js +3 -3
  94. package/dist/DataListSearch-cjs.js +2 -2
  95. package/dist/DataListSearch-es.js +2 -2
  96. package/dist/DataListSortingOptions-cjs.js +3 -4
  97. package/dist/DataListSortingOptions-es.js +3 -4
  98. package/dist/DataTable/index.cjs +4 -6
  99. package/dist/DataTable/index.mjs +4 -6
  100. package/dist/DataTable/test-utilities/index.cjs +1 -7
  101. package/dist/DataTable/test-utilities/index.mjs +1 -7
  102. package/dist/DataTable-cjs.js +4 -4
  103. package/dist/DataTable-es.js +4 -4
  104. package/dist/DatePicker/index.cjs +1 -1
  105. package/dist/DatePicker/index.mjs +1 -1
  106. package/dist/DatePicker-cjs.js +2 -2
  107. package/dist/DatePicker-es.js +3 -3
  108. package/dist/Disclosure/index.cjs +1 -6
  109. package/dist/Disclosure/index.mjs +1 -6
  110. package/dist/Disclosure-cjs.js +3 -3
  111. package/dist/Disclosure-es.js +3 -3
  112. package/dist/FormField/FormFieldWrapper.d.ts +1 -1
  113. package/dist/FormField/index.cjs +1 -0
  114. package/dist/FormField/index.mjs +1 -0
  115. package/dist/FormField-cjs.js +2 -21
  116. package/dist/FormField-es.js +2 -21
  117. package/dist/FormatFile/index.cjs +1 -3
  118. package/dist/FormatFile/index.mjs +1 -3
  119. package/dist/Gallery/index.cjs +1 -6
  120. package/dist/Gallery/index.mjs +1 -6
  121. package/dist/InputDate/index.cjs +1 -2
  122. package/dist/InputDate/index.mjs +1 -2
  123. package/dist/InputEmail/index.cjs +1 -0
  124. package/dist/InputEmail/index.mjs +1 -0
  125. package/dist/InputNumber/index.cjs +1 -0
  126. package/dist/InputNumber/index.mjs +1 -0
  127. package/dist/InputPassword/index.cjs +1 -0
  128. package/dist/InputPassword/index.mjs +1 -0
  129. package/dist/InputPassword-cjs.js +1 -0
  130. package/dist/InputPassword-es.js +1 -0
  131. package/dist/InputPhoneNumber/InputPhoneNumber.types.d.ts +1 -1
  132. package/dist/InputPhoneNumber/index.cjs +1 -0
  133. package/dist/InputPhoneNumber/index.mjs +1 -0
  134. package/dist/InputText/InputText.d.ts +2 -2
  135. package/dist/InputText/index.cjs +3 -3
  136. package/dist/InputText/index.mjs +3 -3
  137. package/dist/InputTime/index.cjs +1 -0
  138. package/dist/InputTime/index.mjs +2 -1
  139. package/dist/InternalChipDismissible-cjs.js +1 -0
  140. package/dist/InternalChipDismissible-es.js +1 -0
  141. package/dist/LightBox/index.cjs +1 -6
  142. package/dist/LightBox/index.mjs +1 -6
  143. package/dist/LightBox-cjs.js +12 -74
  144. package/dist/LightBox-es.js +12 -74
  145. package/dist/Menu/index.cjs +1 -4
  146. package/dist/Menu/index.mjs +1 -4
  147. package/dist/Menu-cjs.js +5 -37
  148. package/dist/Menu-es.js +6 -38
  149. package/dist/Modal/index.cjs +4 -6
  150. package/dist/Modal/index.mjs +5 -7
  151. package/dist/Page/index.cjs +2 -10
  152. package/dist/Page/index.mjs +2 -10
  153. package/dist/Page-cjs.js +5 -5
  154. package/dist/Page-es.js +5 -5
  155. package/dist/Popover/index.cjs +1 -1
  156. package/dist/Popover/index.mjs +1 -1
  157. package/dist/Popover-cjs.js +2 -2
  158. package/dist/Popover-es.js +3 -3
  159. package/dist/RecurringSelect/index.cjs +1 -0
  160. package/dist/RecurringSelect/index.mjs +1 -0
  161. package/dist/Select/index.cjs +1 -0
  162. package/dist/Select/index.mjs +1 -0
  163. package/dist/SideDrawer/index.cjs +1 -5
  164. package/dist/SideDrawer/index.mjs +1 -5
  165. package/dist/SideDrawer-cjs.js +7 -10
  166. package/dist/SideDrawer-es.js +7 -10
  167. package/dist/Tabs/index.cjs +0 -1
  168. package/dist/Tabs/index.mjs +0 -1
  169. package/dist/Tabs-cjs.js +76 -2
  170. package/dist/Tabs-es.js +76 -2
  171. package/dist/Tooltip/index.cjs +1 -2
  172. package/dist/Tooltip/index.mjs +1 -2
  173. package/dist/Tooltip-cjs.js +3 -4
  174. package/dist/Tooltip-es.js +4 -5
  175. package/dist/_baseEach-es.js +1 -1
  176. package/dist/_commonjsHelpers-cjs.js +0 -26
  177. package/dist/_commonjsHelpers-es.js +1 -26
  178. package/dist/_isIterateeCall-es.js +1 -1
  179. package/dist/debounce-es.js +2 -2
  180. package/dist/floating-ui.react-es.js +1 -1
  181. package/dist/helpers-cjs.js +21 -2
  182. package/dist/helpers-es.js +1 -1
  183. package/dist/index.cjs +1 -9
  184. package/dist/index.mjs +1 -9
  185. package/dist/isObjectLike-es.js +1 -1
  186. package/dist/isSymbol-es.js +1 -1
  187. package/dist/isTypedArray-es.js +1 -1
  188. package/dist/keysIn-es.js +1 -1
  189. package/dist/omit-es.js +1 -1
  190. package/dist/useScrollToActive-cjs.js +3 -45
  191. package/dist/useScrollToActive-es.js +5 -47
  192. package/package.json +3 -3
  193. package/rollup.config.mjs +0 -15
  194. package/dist/throttle-cjs.js +0 -80
  195. package/dist/throttle-es.js +0 -77
  196. package/dist/useDebounce-cjs.js +0 -4416
  197. package/dist/useDebounce-es.js +0 -4413
  198. package/dist/useFocusTrap-cjs.js +0 -75
  199. package/dist/useFocusTrap-es.js +0 -73
  200. package/dist/useInView-cjs.js +0 -26
  201. package/dist/useInView-es.js +0 -24
  202. package/dist/useIsMounted-cjs.js +0 -51
  203. package/dist/useIsMounted-es.js +0 -49
  204. package/dist/useOnKeyDown-cjs.js +0 -41
  205. package/dist/useOnKeyDown-es.js +0 -39
  206. package/dist/useRefocusOnActivator-cjs.js +0 -33
  207. package/dist/useRefocusOnActivator-es.js +0 -31
  208. package/dist/useResizeObserver-cjs.js +0 -1131
  209. package/dist/useResizeObserver-es.js +0 -1128
  210. package/dist/useSafeLayoutEffect-cjs.js +0 -14
  211. package/dist/useSafeLayoutEffect-es.js +0 -12
@@ -1,75 +0,0 @@
1
- 'use strict';
2
-
3
- var React = require('react');
4
-
5
- var useFocusTrap$1 = {};
6
-
7
- Object.defineProperty(useFocusTrap$1, "__esModule", { value: true });
8
- var useFocusTrap_2 = useFocusTrap$1.useFocusTrap = useFocusTrap;
9
- const react_1 = React;
10
- /**
11
- * Traps the focus within the children of the ref element.
12
- *
13
- * @param active - Turns the focus trapping on or off. Also adds aria-hidden on the
14
- * body but not the dialog.
15
- *
16
- * @returns ref
17
- */
18
- function useFocusTrap(active) {
19
- // There's an ongoing issue with useRef return type clashing with an element's
20
- // ref prop type. TLDR: Use null because useRef doesn't expect undefined.
21
- // https://github.com/DefinitelyTyped/DefinitelyTyped/issues/35572
22
- const ref = (0, react_1.useRef)(null);
23
- function handleKeyDown(event) {
24
- if (!(active && ref.current) || event.key !== "Tab") {
25
- return;
26
- }
27
- const { firstElement, lastElement } = getElements(ref.current);
28
- if (event.shiftKey) {
29
- if (document.activeElement === firstElement) {
30
- lastElement.focus();
31
- event.preventDefault();
32
- }
33
- }
34
- else {
35
- if (document.activeElement === lastElement) {
36
- firstElement.focus();
37
- event.preventDefault();
38
- }
39
- }
40
- }
41
- (0, react_1.useEffect)(() => {
42
- if (active && ref.current) {
43
- const { firstElement } = getElements(ref.current);
44
- firstElement.focus();
45
- ref.current.addEventListener("keydown", handleKeyDown);
46
- }
47
- return () => {
48
- var _a;
49
- (_a = ref.current) === null || _a === void 0 ? void 0 : _a.removeEventListener("keydown", handleKeyDown);
50
- };
51
- }, [active]);
52
- return ref;
53
- }
54
- function getElements(ref) {
55
- const focusables = [
56
- "button",
57
- "[href]",
58
- "input",
59
- "select",
60
- "textarea",
61
- '[tabindex]:not([tabindex="-1"])',
62
- ];
63
- const elements = [
64
- ...ref.querySelectorAll(focusables.join(", ")),
65
- ];
66
- // If the ref is focusable, ensure it's the first element to be focused.
67
- if (ref.getAttribute("tabindex") === "0") {
68
- elements.unshift(ref);
69
- }
70
- const firstElement = elements[0];
71
- const lastElement = elements[elements.length - 1];
72
- return { firstElement, lastElement };
73
- }
74
-
75
- exports.useFocusTrap_2 = useFocusTrap_2;
@@ -1,73 +0,0 @@
1
- import React__default from 'react';
2
-
3
- var useFocusTrap$1 = {};
4
-
5
- Object.defineProperty(useFocusTrap$1, "__esModule", { value: true });
6
- var useFocusTrap_2 = useFocusTrap$1.useFocusTrap = useFocusTrap;
7
- const react_1 = React__default;
8
- /**
9
- * Traps the focus within the children of the ref element.
10
- *
11
- * @param active - Turns the focus trapping on or off. Also adds aria-hidden on the
12
- * body but not the dialog.
13
- *
14
- * @returns ref
15
- */
16
- function useFocusTrap(active) {
17
- // There's an ongoing issue with useRef return type clashing with an element's
18
- // ref prop type. TLDR: Use null because useRef doesn't expect undefined.
19
- // https://github.com/DefinitelyTyped/DefinitelyTyped/issues/35572
20
- const ref = (0, react_1.useRef)(null);
21
- function handleKeyDown(event) {
22
- if (!(active && ref.current) || event.key !== "Tab") {
23
- return;
24
- }
25
- const { firstElement, lastElement } = getElements(ref.current);
26
- if (event.shiftKey) {
27
- if (document.activeElement === firstElement) {
28
- lastElement.focus();
29
- event.preventDefault();
30
- }
31
- }
32
- else {
33
- if (document.activeElement === lastElement) {
34
- firstElement.focus();
35
- event.preventDefault();
36
- }
37
- }
38
- }
39
- (0, react_1.useEffect)(() => {
40
- if (active && ref.current) {
41
- const { firstElement } = getElements(ref.current);
42
- firstElement.focus();
43
- ref.current.addEventListener("keydown", handleKeyDown);
44
- }
45
- return () => {
46
- var _a;
47
- (_a = ref.current) === null || _a === void 0 ? void 0 : _a.removeEventListener("keydown", handleKeyDown);
48
- };
49
- }, [active]);
50
- return ref;
51
- }
52
- function getElements(ref) {
53
- const focusables = [
54
- "button",
55
- "[href]",
56
- "input",
57
- "select",
58
- "textarea",
59
- '[tabindex]:not([tabindex="-1"])',
60
- ];
61
- const elements = [
62
- ...ref.querySelectorAll(focusables.join(", ")),
63
- ];
64
- // If the ref is focusable, ensure it's the first element to be focused.
65
- if (ref.getAttribute("tabindex") === "0") {
66
- elements.unshift(ref);
67
- }
68
- const firstElement = elements[0];
69
- const lastElement = elements[elements.length - 1];
70
- return { firstElement, lastElement };
71
- }
72
-
73
- export { useFocusTrap_2 as u };
@@ -1,26 +0,0 @@
1
- 'use strict';
2
-
3
- var React = require('react');
4
-
5
- var useInView$1 = {};
6
-
7
- Object.defineProperty(useInView$1, "__esModule", { value: true });
8
- var useInView_2 = useInView$1.useInView = useInView;
9
- const react_1 = React;
10
- function useInView() {
11
- const ref = (0, react_1.useRef)(null);
12
- const [isInView, setIsInView] = (0, react_1.useState)(false);
13
- const handleIntersection = (0, react_1.useCallback)(entries => setIsInView(entries[0].isIntersecting), [setIsInView]);
14
- (0, react_1.useEffect)(() => {
15
- if (!window.IntersectionObserver)
16
- return;
17
- const observer = new IntersectionObserver(handleIntersection);
18
- ref.current && observer.observe(ref.current);
19
- return () => {
20
- ref.current && observer.unobserve(ref.current);
21
- };
22
- }, [handleIntersection, ref.current]);
23
- return [ref, isInView];
24
- }
25
-
26
- exports.useInView_2 = useInView_2;
@@ -1,24 +0,0 @@
1
- import React__default from 'react';
2
-
3
- var useInView$1 = {};
4
-
5
- Object.defineProperty(useInView$1, "__esModule", { value: true });
6
- var useInView_2 = useInView$1.useInView = useInView;
7
- const react_1 = React__default;
8
- function useInView() {
9
- const ref = (0, react_1.useRef)(null);
10
- const [isInView, setIsInView] = (0, react_1.useState)(false);
11
- const handleIntersection = (0, react_1.useCallback)(entries => setIsInView(entries[0].isIntersecting), [setIsInView]);
12
- (0, react_1.useEffect)(() => {
13
- if (!window.IntersectionObserver)
14
- return;
15
- const observer = new IntersectionObserver(handleIntersection);
16
- ref.current && observer.observe(ref.current);
17
- return () => {
18
- ref.current && observer.unobserve(ref.current);
19
- };
20
- }, [handleIntersection, ref.current]);
21
- return [ref, isInView];
22
- }
23
-
24
- export { useInView_2 as u };
@@ -1,51 +0,0 @@
1
- 'use strict';
2
-
3
- var React = require('react');
4
- var useSafeLayoutEffect$1 = require('./useSafeLayoutEffect-cjs.js');
5
-
6
- var useIsMounted$1 = {};
7
-
8
- var useSafeLayoutEffect = {};
9
-
10
- (function (exports) {
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.useSafeLayoutEffect = void 0;
13
- var useSafeLayoutEffect_1 = useSafeLayoutEffect$1.useSafeLayoutEffect;
14
- Object.defineProperty(exports, "useSafeLayoutEffect", { enumerable: true, get: function () { return useSafeLayoutEffect_1.useSafeLayoutEffect; } });
15
- } (useSafeLayoutEffect));
16
-
17
- Object.defineProperty(useIsMounted$1, "__esModule", { value: true });
18
- var useIsMounted_2 = useIsMounted$1.useIsMounted = useIsMounted;
19
- const react_1 = React;
20
- const useSafeLayoutEffect_1 = useSafeLayoutEffect;
21
- /**
22
- * If you are using this hook in order to only perform an action once after mounting (for example sending
23
- * analytics events), use `useOnMount` instead
24
- *
25
- * Why does this work?
26
- *
27
- * The following is from the react docs:
28
- * [The return function from `useLayoutEffect`] is the optional cleanup mechanism for effects.
29
- * Every effect may return a function that cleans up after it.
30
- *
31
- * When exactly does React clean up an effect? React performs the cleanup when the component unmounts.
32
- * The cleanup for useLayoutEffect is called after component unmounts and before before browser painting
33
- * the screen
34
- *
35
- * What does that mean for us? When this hook is initially loaded, we then trigger a `useLayoutEffect` that
36
- * sets the isMounted to true right after the component is mounted.
37
- * When the component unmounts, it calls the cleanup function that sets `isMounted` to false.
38
- * This `useLayoutEffect` hook will only be run once.
39
- */
40
- function useIsMounted() {
41
- const isMounted = (0, react_1.useRef)(false);
42
- (0, useSafeLayoutEffect_1.useSafeLayoutEffect)(() => {
43
- isMounted.current = true;
44
- return () => {
45
- isMounted.current = false;
46
- };
47
- }, []);
48
- return isMounted;
49
- }
50
-
51
- exports.useIsMounted_2 = useIsMounted_2;
@@ -1,49 +0,0 @@
1
- import React__default from 'react';
2
- import { a as useSafeLayoutEffect$1 } from './useSafeLayoutEffect-es.js';
3
-
4
- var useIsMounted$1 = {};
5
-
6
- var useSafeLayoutEffect = {};
7
-
8
- (function (exports) {
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.useSafeLayoutEffect = void 0;
11
- var useSafeLayoutEffect_1 = useSafeLayoutEffect$1;
12
- Object.defineProperty(exports, "useSafeLayoutEffect", { enumerable: true, get: function () { return useSafeLayoutEffect_1.useSafeLayoutEffect; } });
13
- } (useSafeLayoutEffect));
14
-
15
- Object.defineProperty(useIsMounted$1, "__esModule", { value: true });
16
- var useIsMounted_2 = useIsMounted$1.useIsMounted = useIsMounted;
17
- const react_1 = React__default;
18
- const useSafeLayoutEffect_1 = useSafeLayoutEffect;
19
- /**
20
- * If you are using this hook in order to only perform an action once after mounting (for example sending
21
- * analytics events), use `useOnMount` instead
22
- *
23
- * Why does this work?
24
- *
25
- * The following is from the react docs:
26
- * [The return function from `useLayoutEffect`] is the optional cleanup mechanism for effects.
27
- * Every effect may return a function that cleans up after it.
28
- *
29
- * When exactly does React clean up an effect? React performs the cleanup when the component unmounts.
30
- * The cleanup for useLayoutEffect is called after component unmounts and before before browser painting
31
- * the screen
32
- *
33
- * What does that mean for us? When this hook is initially loaded, we then trigger a `useLayoutEffect` that
34
- * sets the isMounted to true right after the component is mounted.
35
- * When the component unmounts, it calls the cleanup function that sets `isMounted` to false.
36
- * This `useLayoutEffect` hook will only be run once.
37
- */
38
- function useIsMounted() {
39
- const isMounted = (0, react_1.useRef)(false);
40
- (0, useSafeLayoutEffect_1.useSafeLayoutEffect)(() => {
41
- isMounted.current = true;
42
- return () => {
43
- isMounted.current = false;
44
- };
45
- }, []);
46
- return isMounted;
47
- }
48
-
49
- export { useIsMounted_2 as u };
@@ -1,41 +0,0 @@
1
- 'use strict';
2
-
3
- var React = require('react');
4
-
5
- var useOnKeyDown$1 = {};
6
-
7
- Object.defineProperty(useOnKeyDown$1, "__esModule", { value: true });
8
- var useOnKeyDown_2 = useOnKeyDown$1.useOnKeyDown = useOnKeyDown;
9
- const react_1 = React;
10
- function useOnKeyDown(callback, keys) {
11
- (0, react_1.useEffect)(() => {
12
- window.addEventListener("keydown", handler);
13
- return () => {
14
- window.removeEventListener("keydown", handler);
15
- };
16
- }, [handler]);
17
- function handler(event) {
18
- const keyboardEvent = event;
19
- if (typeof keys === "string" && keyboardEvent.key === keys) {
20
- callback(event);
21
- return;
22
- }
23
- if (Array.isArray(keys) &&
24
- keys.some(item => {
25
- if (typeof item === "string")
26
- return keyboardEvent.key === item;
27
- return Object.keys(item).every(index => keyboardEvent[index] === item[index]);
28
- })) {
29
- callback(event);
30
- return;
31
- }
32
- if (!Array.isArray(keys) &&
33
- typeof keys !== "string" &&
34
- Object.keys(keys).every(index => keyboardEvent[index] === keys[index])) {
35
- callback(event);
36
- return;
37
- }
38
- }
39
- }
40
-
41
- exports.useOnKeyDown_2 = useOnKeyDown_2;
@@ -1,39 +0,0 @@
1
- import React__default from 'react';
2
-
3
- var useOnKeyDown$1 = {};
4
-
5
- Object.defineProperty(useOnKeyDown$1, "__esModule", { value: true });
6
- var useOnKeyDown_2 = useOnKeyDown$1.useOnKeyDown = useOnKeyDown;
7
- const react_1 = React__default;
8
- function useOnKeyDown(callback, keys) {
9
- (0, react_1.useEffect)(() => {
10
- window.addEventListener("keydown", handler);
11
- return () => {
12
- window.removeEventListener("keydown", handler);
13
- };
14
- }, [handler]);
15
- function handler(event) {
16
- const keyboardEvent = event;
17
- if (typeof keys === "string" && keyboardEvent.key === keys) {
18
- callback(event);
19
- return;
20
- }
21
- if (Array.isArray(keys) &&
22
- keys.some(item => {
23
- if (typeof item === "string")
24
- return keyboardEvent.key === item;
25
- return Object.keys(item).every(index => keyboardEvent[index] === item[index]);
26
- })) {
27
- callback(event);
28
- return;
29
- }
30
- if (!Array.isArray(keys) &&
31
- typeof keys !== "string" &&
32
- Object.keys(keys).every(index => keyboardEvent[index] === keys[index])) {
33
- callback(event);
34
- return;
35
- }
36
- }
37
- }
38
-
39
- export { useOnKeyDown_2 as u };
@@ -1,33 +0,0 @@
1
- 'use strict';
2
-
3
- var React = require('react');
4
-
5
- var useRefocusOnActivator$1 = {};
6
-
7
- Object.defineProperty(useRefocusOnActivator$1, "__esModule", { value: true });
8
- var useRefocusOnActivator_2 = useRefocusOnActivator$1.useRefocusOnActivator = useRefocusOnActivator;
9
- const react_1 = React;
10
- /**
11
- * Brings back the focus to the element that opened an overlaid element once
12
- * said overlaid element is dismissed.
13
- *
14
- * @param active - Determines if it should focus or not
15
- */
16
- function useRefocusOnActivator(active) {
17
- (0, react_1.useEffect)(() => {
18
- let activator;
19
- if (active && !activator) {
20
- activator = document.activeElement;
21
- }
22
- return () => {
23
- if (active) {
24
- if (activator instanceof HTMLElement) {
25
- activator.focus();
26
- }
27
- activator = undefined;
28
- }
29
- };
30
- }, [active]);
31
- }
32
-
33
- exports.useRefocusOnActivator_2 = useRefocusOnActivator_2;
@@ -1,31 +0,0 @@
1
- import React__default from 'react';
2
-
3
- var useRefocusOnActivator$1 = {};
4
-
5
- Object.defineProperty(useRefocusOnActivator$1, "__esModule", { value: true });
6
- var useRefocusOnActivator_2 = useRefocusOnActivator$1.useRefocusOnActivator = useRefocusOnActivator;
7
- const react_1 = React__default;
8
- /**
9
- * Brings back the focus to the element that opened an overlaid element once
10
- * said overlaid element is dismissed.
11
- *
12
- * @param active - Determines if it should focus or not
13
- */
14
- function useRefocusOnActivator(active) {
15
- (0, react_1.useEffect)(() => {
16
- let activator;
17
- if (active && !activator) {
18
- activator = document.activeElement;
19
- }
20
- return () => {
21
- if (active) {
22
- if (activator instanceof HTMLElement) {
23
- activator.focus();
24
- }
25
- activator = undefined;
26
- }
27
- };
28
- }, [active]);
29
- }
30
-
31
- export { useRefocusOnActivator_2 as u };