@pega/cosmos-react-core 4.0.0-dev.4.0 → 4.0.0-dev.5.1

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 (153) hide show
  1. package/lib/components/AppShell/AppShell.styles.js +1 -1
  2. package/lib/components/AppShell/AppShell.styles.js.map +1 -1
  3. package/lib/components/AppShell/NavigationListItemWrapper.d.ts.map +1 -1
  4. package/lib/components/AppShell/NavigationListItemWrapper.js +4 -2
  5. package/lib/components/AppShell/NavigationListItemWrapper.js.map +1 -1
  6. package/lib/components/Badges/Count.js +1 -1
  7. package/lib/components/Badges/Count.js.map +1 -1
  8. package/lib/components/Badges/Selection.js +1 -1
  9. package/lib/components/Badges/Selection.js.map +1 -1
  10. package/lib/components/Badges/Tag.js +1 -1
  11. package/lib/components/Badges/Tag.js.map +1 -1
  12. package/lib/components/Banner/Banner.d.ts +21 -22
  13. package/lib/components/Banner/Banner.d.ts.map +1 -1
  14. package/lib/components/Banner/Banner.js +130 -95
  15. package/lib/components/Banner/Banner.js.map +1 -1
  16. package/lib/components/List/List.d.ts.map +1 -1
  17. package/lib/components/List/List.js +11 -1
  18. package/lib/components/List/List.js.map +1 -1
  19. package/lib/components/Location/LocationInput.js +1 -1
  20. package/lib/components/Location/LocationInput.js.map +1 -1
  21. package/lib/components/MenuButton/MenuButton.d.ts.map +1 -1
  22. package/lib/components/MenuButton/MenuButton.js +18 -4
  23. package/lib/components/MenuButton/MenuButton.js.map +1 -1
  24. package/lib/components/RadioCheck/RadioCheck.js +1 -1
  25. package/lib/components/RadioCheck/RadioCheck.js.map +1 -1
  26. package/lib/components/Tabs/Tab.js +1 -1
  27. package/lib/components/Tabs/Tab.js.map +1 -1
  28. package/lib/hooks/useI18n.d.ts +8 -0
  29. package/lib/hooks/useI18n.d.ts.map +1 -1
  30. package/lib/i18n/default.d.ts +8 -0
  31. package/lib/i18n/default.d.ts.map +1 -1
  32. package/lib/i18n/default.js +9 -1
  33. package/lib/i18n/default.js.map +1 -1
  34. package/lib/i18n/i18n.d.ts +8 -0
  35. package/lib/i18n/i18n.d.ts.map +1 -1
  36. package/lib/theme/theme.d.ts +26 -26
  37. package/lib/utils/bindAll.d.ts +4 -0
  38. package/lib/utils/bindAll.d.ts.map +1 -0
  39. package/lib/utils/bindAll.js +9 -0
  40. package/lib/utils/bindAll.js.map +1 -0
  41. package/lib/utils/cap.d.ts +4 -0
  42. package/lib/utils/cap.d.ts.map +1 -0
  43. package/lib/utils/cap.js +6 -0
  44. package/lib/utils/cap.js.map +1 -0
  45. package/lib/utils/createStringMatcher.d.ts +10 -0
  46. package/lib/utils/createStringMatcher.d.ts.map +1 -0
  47. package/lib/utils/createStringMatcher.js +21 -0
  48. package/lib/utils/createStringMatcher.js.map +1 -0
  49. package/lib/utils/createUID.d.ts +4 -0
  50. package/lib/utils/createUID.d.ts.map +1 -0
  51. package/lib/utils/createUID.js +6 -0
  52. package/lib/utils/createUID.js.map +1 -0
  53. package/lib/utils/debounce.d.ts +4 -0
  54. package/lib/utils/debounce.d.ts.map +1 -0
  55. package/lib/utils/debounce.js +14 -0
  56. package/lib/utils/debounce.js.map +1 -0
  57. package/lib/utils/deepGet.d.ts +3 -0
  58. package/lib/utils/deepGet.d.ts.map +1 -0
  59. package/lib/utils/deepGet.js +15 -0
  60. package/lib/utils/deepGet.js.map +1 -0
  61. package/lib/utils/deepObjectComparison.d.ts +4 -0
  62. package/lib/utils/deepObjectComparison.d.ts.map +1 -0
  63. package/lib/utils/deepObjectComparison.js +35 -0
  64. package/lib/utils/deepObjectComparison.js.map +1 -0
  65. package/lib/utils/defineSmartGetter.d.ts +3 -0
  66. package/lib/utils/defineSmartGetter.d.ts.map +1 -0
  67. package/lib/utils/defineSmartGetter.js +14 -0
  68. package/lib/utils/defineSmartGetter.js.map +1 -0
  69. package/lib/utils/documentIsAvailable.d.ts +3 -0
  70. package/lib/utils/documentIsAvailable.d.ts.map +1 -0
  71. package/lib/utils/documentIsAvailable.js +3 -0
  72. package/lib/utils/documentIsAvailable.js.map +1 -0
  73. package/lib/utils/escapeRegExp.d.ts +8 -0
  74. package/lib/utils/escapeRegExp.d.ts.map +1 -0
  75. package/lib/utils/escapeRegExp.js +8 -0
  76. package/lib/utils/escapeRegExp.js.map +1 -0
  77. package/lib/utils/focusHeadingOrContainer.d.ts +8 -0
  78. package/lib/utils/focusHeadingOrContainer.d.ts.map +1 -0
  79. package/lib/utils/focusHeadingOrContainer.js +29 -0
  80. package/lib/utils/focusHeadingOrContainer.js.map +1 -0
  81. package/lib/utils/formatListToLocaleString.d.ts +15 -0
  82. package/lib/utils/formatListToLocaleString.d.ts.map +1 -0
  83. package/lib/utils/formatListToLocaleString.js +17 -0
  84. package/lib/utils/formatListToLocaleString.js.map +1 -0
  85. package/lib/utils/getActiveElement.d.ts +8 -0
  86. package/lib/utils/getActiveElement.d.ts.map +1 -0
  87. package/lib/utils/getActiveElement.js +18 -0
  88. package/lib/utils/getActiveElement.js.map +1 -0
  89. package/lib/utils/getFocusables.d.ts +9 -0
  90. package/lib/utils/getFocusables.d.ts.map +1 -0
  91. package/lib/utils/getFocusables.js +15 -0
  92. package/lib/utils/getFocusables.js.map +1 -0
  93. package/lib/utils/getScrollbarWidth.d.ts +4 -0
  94. package/lib/utils/getScrollbarWidth.d.ts.map +1 -0
  95. package/lib/utils/getScrollbarWidth.js +17 -0
  96. package/lib/utils/getScrollbarWidth.js.map +1 -0
  97. package/lib/utils/hasProp.d.ts +4 -0
  98. package/lib/utils/hasProp.d.ts.map +1 -0
  99. package/lib/utils/hasProp.js +6 -0
  100. package/lib/utils/hasProp.js.map +1 -0
  101. package/lib/utils/index.d.ts +27 -1
  102. package/lib/utils/index.d.ts.map +1 -1
  103. package/lib/utils/index.js +27 -1
  104. package/lib/utils/index.js.map +1 -1
  105. package/lib/utils/loadScript.d.ts +3 -0
  106. package/lib/utils/loadScript.d.ts.map +1 -0
  107. package/lib/utils/loadScript.js +9 -0
  108. package/lib/utils/loadScript.js.map +1 -0
  109. package/lib/utils/navigatorIsAvailable.d.ts +3 -0
  110. package/lib/utils/navigatorIsAvailable.d.ts.map +1 -0
  111. package/lib/utils/navigatorIsAvailable.js +3 -0
  112. package/lib/utils/navigatorIsAvailable.js.map +1 -0
  113. package/lib/utils/normalizeElements.d.ts +9 -0
  114. package/lib/utils/normalizeElements.d.ts.map +1 -0
  115. package/lib/utils/normalizeElements.js +14 -0
  116. package/lib/utils/normalizeElements.js.map +1 -0
  117. package/lib/utils/range.d.ts +4 -0
  118. package/lib/utils/range.d.ts.map +1 -0
  119. package/lib/utils/range.js +8 -0
  120. package/lib/utils/range.js.map +1 -0
  121. package/lib/utils/reflow.d.ts +4 -0
  122. package/lib/utils/reflow.d.ts.map +1 -0
  123. package/lib/utils/reflow.js +7 -0
  124. package/lib/utils/reflow.js.map +1 -0
  125. package/lib/utils/replaceMatchWithElement.d.ts +4 -0
  126. package/lib/utils/replaceMatchWithElement.d.ts.map +1 -0
  127. package/lib/utils/replaceMatchWithElement.js +32 -0
  128. package/lib/utils/replaceMatchWithElement.js.map +1 -0
  129. package/lib/utils/sameOrigin.d.ts +7 -0
  130. package/lib/utils/sameOrigin.d.ts.map +1 -0
  131. package/lib/utils/sameOrigin.js +25 -0
  132. package/lib/utils/sameOrigin.js.map +1 -0
  133. package/lib/utils/testElForOverflow.d.ts +4 -0
  134. package/lib/utils/testElForOverflow.d.ts.map +1 -0
  135. package/lib/utils/testElForOverflow.js +6 -0
  136. package/lib/utils/testElForOverflow.js.map +1 -0
  137. package/lib/utils/triple.d.ts +12 -0
  138. package/lib/utils/triple.d.ts.map +1 -0
  139. package/lib/utils/triple.js +13 -0
  140. package/lib/utils/triple.js.map +1 -0
  141. package/lib/utils/tryCatch.d.ts +5 -0
  142. package/lib/utils/tryCatch.d.ts.map +1 -0
  143. package/lib/utils/tryCatch.js +16 -0
  144. package/lib/utils/tryCatch.js.map +1 -0
  145. package/lib/utils/windowIsAvailable.d.ts +3 -0
  146. package/lib/utils/windowIsAvailable.d.ts.map +1 -0
  147. package/lib/utils/windowIsAvailable.js +3 -0
  148. package/lib/utils/windowIsAvailable.js.map +1 -0
  149. package/package.json +1 -1
  150. package/lib/utils/utils.d.ts +0 -99
  151. package/lib/utils/utils.d.ts.map +0 -1
  152. package/lib/utils/utils.js +0 -314
  153. package/lib/utils/utils.js.map +0 -1
@@ -1574,6 +1574,7 @@ export declare const WorkTheme: {
1574
1574
  readonly dark: string;
1575
1575
  readonly light: string;
1576
1576
  readonly "background-color": string;
1577
+ readonly success: string;
1577
1578
  readonly "app-background": string;
1578
1579
  readonly "primary-background": string;
1579
1580
  readonly "secondary-background": string;
@@ -1582,7 +1583,6 @@ export declare const WorkTheme: {
1582
1583
  readonly "brand-secondary": string;
1583
1584
  readonly urgent: string;
1584
1585
  readonly warn: string;
1585
- readonly success: string;
1586
1586
  readonly pending: string;
1587
1587
  readonly info: string;
1588
1588
  readonly interactive: string;
@@ -1765,19 +1765,19 @@ export declare const WorkTheme: {
1765
1765
  readonly "touch-width": string;
1766
1766
  };
1767
1767
  readonly banner: {
1768
- readonly urgent: {
1768
+ readonly warning: {
1769
1769
  readonly background: string;
1770
1770
  };
1771
1771
  readonly success: {
1772
1772
  readonly background: string;
1773
1773
  };
1774
- readonly info: {
1774
+ readonly urgent: {
1775
1775
  readonly background: string;
1776
1776
  };
1777
- readonly "icon-color": string;
1778
- readonly warning: {
1777
+ readonly info: {
1779
1778
  readonly background: string;
1780
1779
  };
1780
+ readonly "icon-color": string;
1781
1781
  };
1782
1782
  readonly "app-shell": {
1783
1783
  readonly header: {
@@ -1796,23 +1796,23 @@ export declare const WorkTheme: {
1796
1796
  readonly base: {
1797
1797
  readonly "border-color": string;
1798
1798
  };
1799
- readonly urgent: {
1799
+ readonly success: {
1800
1800
  readonly background: string;
1801
1801
  };
1802
- readonly success: {
1802
+ readonly urgent: {
1803
1803
  readonly background: string;
1804
1804
  };
1805
1805
  };
1806
1806
  readonly status: {
1807
- readonly urgent: {
1807
+ readonly success: {
1808
1808
  readonly background: string;
1809
1809
  readonly foreground: string;
1810
1810
  };
1811
- readonly warn: {
1811
+ readonly urgent: {
1812
1812
  readonly background: string;
1813
1813
  readonly foreground: string;
1814
1814
  };
1815
- readonly success: {
1815
+ readonly warn: {
1816
1816
  readonly background: string;
1817
1817
  readonly foreground: string;
1818
1818
  };
@@ -1933,13 +1933,13 @@ export declare const WorkTheme: {
1933
1933
  readonly error: {
1934
1934
  readonly "status-color": string;
1935
1935
  };
1936
- readonly success: {
1936
+ readonly warning: {
1937
1937
  readonly "status-color": string;
1938
1938
  };
1939
- readonly pending: {
1939
+ readonly success: {
1940
1940
  readonly "status-color": string;
1941
1941
  };
1942
- readonly warning: {
1942
+ readonly pending: {
1943
1943
  readonly "status-color": string;
1944
1944
  };
1945
1945
  };
@@ -2148,6 +2148,7 @@ export declare const defaultThemeProp: Readonly<{
2148
2148
  readonly dark: string;
2149
2149
  readonly light: string;
2150
2150
  readonly "background-color": string;
2151
+ readonly success: string;
2151
2152
  readonly "app-background": string;
2152
2153
  readonly "primary-background": string;
2153
2154
  readonly "secondary-background": string;
@@ -2156,7 +2157,6 @@ export declare const defaultThemeProp: Readonly<{
2156
2157
  readonly "brand-secondary": string;
2157
2158
  readonly urgent: string;
2158
2159
  readonly warn: string;
2159
- readonly success: string;
2160
2160
  readonly pending: string;
2161
2161
  readonly info: string;
2162
2162
  readonly interactive: string;
@@ -2339,19 +2339,19 @@ export declare const defaultThemeProp: Readonly<{
2339
2339
  readonly "touch-width": string;
2340
2340
  };
2341
2341
  readonly banner: {
2342
- readonly urgent: {
2342
+ readonly warning: {
2343
2343
  readonly background: string;
2344
2344
  };
2345
2345
  readonly success: {
2346
2346
  readonly background: string;
2347
2347
  };
2348
- readonly info: {
2348
+ readonly urgent: {
2349
2349
  readonly background: string;
2350
2350
  };
2351
- readonly "icon-color": string;
2352
- readonly warning: {
2351
+ readonly info: {
2353
2352
  readonly background: string;
2354
2353
  };
2354
+ readonly "icon-color": string;
2355
2355
  };
2356
2356
  readonly "app-shell": {
2357
2357
  readonly header: {
@@ -2370,23 +2370,23 @@ export declare const defaultThemeProp: Readonly<{
2370
2370
  readonly base: {
2371
2371
  readonly "border-color": string;
2372
2372
  };
2373
- readonly urgent: {
2373
+ readonly success: {
2374
2374
  readonly background: string;
2375
2375
  };
2376
- readonly success: {
2376
+ readonly urgent: {
2377
2377
  readonly background: string;
2378
2378
  };
2379
2379
  };
2380
2380
  readonly status: {
2381
- readonly urgent: {
2381
+ readonly success: {
2382
2382
  readonly background: string;
2383
2383
  readonly foreground: string;
2384
2384
  };
2385
- readonly warn: {
2385
+ readonly urgent: {
2386
2386
  readonly background: string;
2387
2387
  readonly foreground: string;
2388
2388
  };
2389
- readonly success: {
2389
+ readonly warn: {
2390
2390
  readonly background: string;
2391
2391
  readonly foreground: string;
2392
2392
  };
@@ -2507,13 +2507,13 @@ export declare const defaultThemeProp: Readonly<{
2507
2507
  readonly error: {
2508
2508
  readonly "status-color": string;
2509
2509
  };
2510
- readonly success: {
2510
+ readonly warning: {
2511
2511
  readonly "status-color": string;
2512
2512
  };
2513
- readonly pending: {
2513
+ readonly success: {
2514
2514
  readonly "status-color": string;
2515
2515
  };
2516
- readonly warning: {
2516
+ readonly pending: {
2517
2517
  readonly "status-color": string;
2518
2518
  };
2519
2519
  };
@@ -0,0 +1,4 @@
1
+ /** @deprecated */
2
+ declare const bindAll: <T extends object, K extends keyof T>(obj: T, names: K[]) => void;
3
+ export default bindAll;
4
+ //# sourceMappingURL=bindAll.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bindAll.d.ts","sourceRoot":"","sources":["../../src/utils/bindAll.ts"],"names":[],"mappings":"AACA,kBAAkB;AAClB,QAAA,MAAM,OAAO,+DAA8D,IAI1E,CAAC;AAEF,eAAe,OAAO,CAAC"}
@@ -0,0 +1,9 @@
1
+ // Add some context...
2
+ /** @deprecated */
3
+ const bindAll = (obj, names) => {
4
+ names.forEach(fn => {
5
+ obj[fn] = obj[fn].bind(obj);
6
+ });
7
+ };
8
+ export default bindAll;
9
+ //# sourceMappingURL=bindAll.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bindAll.js","sourceRoot":"","sources":["../../src/utils/bindAll.ts"],"names":[],"mappings":"AAAA,sBAAsB;AACtB,kBAAkB;AAClB,MAAM,OAAO,GAAG,CAAsC,GAAM,EAAE,KAAU,EAAQ,EAAE;IAChF,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE;QACjB,GAAG,CAAC,EAAE,CAAC,GAAI,GAAG,CAAC,EAAE,CAAyB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACvD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,eAAe,OAAO,CAAC","sourcesContent":["// Add some context...\n/** @deprecated */\nconst bindAll = <T extends object, K extends keyof T>(obj: T, names: K[]): void => {\n names.forEach(fn => {\n obj[fn] = (obj[fn] as unknown as Function).bind(obj);\n });\n};\n\nexport default bindAll;\n"]}
@@ -0,0 +1,4 @@
1
+ /** Capitalize */
2
+ declare const cap: (s: string) => string;
3
+ export default cap;
4
+ //# sourceMappingURL=cap.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cap.d.ts","sourceRoot":"","sources":["../../src/utils/cap.ts"],"names":[],"mappings":"AAAA,iBAAiB;AACjB,QAAA,MAAM,GAAG,MAAO,MAAM,KAAG,MAExB,CAAC;AAEF,eAAe,GAAG,CAAC"}
@@ -0,0 +1,6 @@
1
+ /** Capitalize */
2
+ const cap = (s) => {
3
+ return s.charAt(0).toUpperCase() + s.slice(1);
4
+ };
5
+ export default cap;
6
+ //# sourceMappingURL=cap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cap.js","sourceRoot":"","sources":["../../src/utils/cap.ts"],"names":[],"mappings":"AAAA,iBAAiB;AACjB,MAAM,GAAG,GAAG,CAAC,CAAS,EAAU,EAAE;IAChC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAChD,CAAC,CAAC;AAEF,eAAe,GAAG,CAAC","sourcesContent":["/** Capitalize */\nconst cap = (s: string): string => {\n return s.charAt(0).toUpperCase() + s.slice(1);\n};\n\nexport default cap;\n"]}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Generate a RegExp with a string parameter.
3
+ * @param s The string to match.
4
+ * @param type How to match.
5
+ * @param flags Standard RegExp flags.
6
+ * @returns A RegExp with the match pattern.
7
+ */
8
+ declare const createStringMatcher: (s: string, type?: 'contains' | 'start' | 'boundary', flags?: string) => RegExp;
9
+ export default createStringMatcher;
10
+ //# sourceMappingURL=createStringMatcher.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createStringMatcher.d.ts","sourceRoot":"","sources":["../../src/utils/createStringMatcher.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,QAAA,MAAM,mBAAmB,MACpB,MAAM,SACH,UAAU,GAAG,OAAO,GAAG,UAAU,UAChC,MAAM,KACZ,MAWF,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
@@ -0,0 +1,21 @@
1
+ import escapeRegExp from './escapeRegExp';
2
+ /**
3
+ * Generate a RegExp with a string parameter.
4
+ * @param s The string to match.
5
+ * @param type How to match.
6
+ * @param flags Standard RegExp flags.
7
+ * @returns A RegExp with the match pattern.
8
+ */
9
+ const createStringMatcher = (s, type = 'contains', flags = 'i') => {
10
+ const escaped = escapeRegExp(s);
11
+ let pattern = escaped;
12
+ if (type === 'start') {
13
+ pattern = `^${escaped}`;
14
+ }
15
+ else if (type === 'boundary') {
16
+ pattern = `(?:^|\\s)${escaped}`;
17
+ }
18
+ return new RegExp(pattern, flags);
19
+ };
20
+ export default createStringMatcher;
21
+ //# sourceMappingURL=createStringMatcher.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createStringMatcher.js","sourceRoot":"","sources":["../../src/utils/createStringMatcher.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAE1C;;;;;;GAMG;AACH,MAAM,mBAAmB,GAAG,CAC1B,CAAS,EACT,OAA0C,UAAU,EACpD,QAAgB,GAAG,EACX,EAAE;IACV,MAAM,OAAO,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC;IAChC,IAAI,OAAO,GAAW,OAAO,CAAC;IAE9B,IAAI,IAAI,KAAK,OAAO,EAAE;QACpB,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;KACzB;SAAM,IAAI,IAAI,KAAK,UAAU,EAAE;QAC9B,OAAO,GAAG,YAAY,OAAO,EAAE,CAAC;KACjC;IAED,OAAO,IAAI,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;AACpC,CAAC,CAAC;AAEF,eAAe,mBAAmB,CAAC","sourcesContent":["import escapeRegExp from './escapeRegExp';\n\n/**\n * Generate a RegExp with a string parameter.\n * @param s The string to match.\n * @param type How to match.\n * @param flags Standard RegExp flags.\n * @returns A RegExp with the match pattern.\n */\nconst createStringMatcher = (\n s: string,\n type: 'contains' | 'start' | 'boundary' = 'contains',\n flags: string = 'i'\n): RegExp => {\n const escaped = escapeRegExp(s);\n let pattern: string = escaped;\n\n if (type === 'start') {\n pattern = `^${escaped}`;\n } else if (type === 'boundary') {\n pattern = `(?:^|\\\\s)${escaped}`;\n }\n\n return new RegExp(pattern, flags);\n};\n\nexport default createStringMatcher;\n"]}
@@ -0,0 +1,4 @@
1
+ /** Generate unique id for elements */
2
+ declare const createUID: () => string;
3
+ export default createUID;
4
+ //# sourceMappingURL=createUID.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createUID.d.ts","sourceRoot":"","sources":["../../src/utils/createUID.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,QAAA,MAAM,SAAS,QAAO,MAErB,CAAC;AAEF,eAAe,SAAS,CAAC"}
@@ -0,0 +1,6 @@
1
+ /** Generate unique id for elements */
2
+ const createUID = () => {
3
+ return `_${Math.random().toString(36).slice(2, 11)}`;
4
+ };
5
+ export default createUID;
6
+ //# sourceMappingURL=createUID.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createUID.js","sourceRoot":"","sources":["../../src/utils/createUID.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,MAAM,SAAS,GAAG,GAAW,EAAE;IAC7B,OAAO,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC;AACvD,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC","sourcesContent":["/** Generate unique id for elements */\nconst createUID = (): string => {\n return `_${Math.random().toString(36).slice(2, 11)}`;\n};\n\nexport default createUID;\n"]}
@@ -0,0 +1,4 @@
1
+ /** @returns Debounced function that can be called only once in given timeout */
2
+ declare function debounce<F extends (...args: any[]) => any>(this: any, func: F, waitTime: number): (...args: Parameters<F>) => void;
3
+ export default debounce;
4
+ //# sourceMappingURL=debounce.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debounce.d.ts","sourceRoot":"","sources":["../../src/utils/debounce.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,iBAAS,QAAQ,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,EACjD,IAAI,EAAE,GAAG,EACT,IAAI,EAAE,CAAC,EACP,QAAQ,EAAE,MAAM,GACf,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,IAAI,CAUlC;AAED,eAAe,QAAQ,CAAC"}
@@ -0,0 +1,14 @@
1
+ /** @returns Debounced function that can be called only once in given timeout */
2
+ function debounce(func, waitTime) {
3
+ let timeout;
4
+ return (...args) => {
5
+ const waitFunc = () => {
6
+ timeout = null;
7
+ func.apply(this, args);
8
+ };
9
+ clearTimeout(timeout);
10
+ timeout = setTimeout(waitFunc, waitTime);
11
+ };
12
+ }
13
+ export default debounce;
14
+ //# sourceMappingURL=debounce.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debounce.js","sourceRoot":"","sources":["../../src/utils/debounce.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,SAAS,QAAQ,CAEf,IAAO,EACP,QAAgB;IAEhB,IAAI,OAAY,CAAC;IACjB,OAAO,CAAC,GAAG,IAAI,EAAE,EAAE;QACjB,MAAM,QAAQ,GAAG,GAAG,EAAE;YACpB,OAAO,GAAG,IAAI,CAAC;YACf,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACzB,CAAC,CAAC;QACF,YAAY,CAAC,OAAO,CAAC,CAAC;QACtB,OAAO,GAAG,UAAU,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAC3C,CAAC,CAAC;AACJ,CAAC;AAED,eAAe,QAAQ,CAAC","sourcesContent":["/** @returns Debounced function that can be called only once in given timeout */\nfunction debounce<F extends (...args: any[]) => any>(\n this: any,\n func: F,\n waitTime: number\n): (...args: Parameters<F>) => void {\n let timeout: any;\n return (...args) => {\n const waitFunc = () => {\n timeout = null;\n func.apply(this, args);\n };\n clearTimeout(timeout);\n timeout = setTimeout(waitFunc, waitTime);\n };\n}\n\nexport default debounce;\n"]}
@@ -0,0 +1,3 @@
1
+ declare const deepGet: (obj: Record<PropertyKey, any>, keys: PropertyKey[]) => any;
2
+ export default deepGet;
3
+ //# sourceMappingURL=deepGet.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deepGet.d.ts","sourceRoot":"","sources":["../../src/utils/deepGet.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,OAAO,QAAS,OAAO,WAAW,EAAE,GAAG,CAAC,QAAQ,WAAW,EAAE,KAAG,GAcrE,CAAC;AAEF,eAAe,OAAO,CAAC"}
@@ -0,0 +1,15 @@
1
+ const deepGet = (obj, keys) => {
2
+ let rtn = obj;
3
+ const found = keys.every(key => {
4
+ if (typeof rtn === 'object' && rtn) {
5
+ rtn = rtn[key];
6
+ return true;
7
+ }
8
+ return false;
9
+ });
10
+ if (found)
11
+ return rtn;
12
+ return undefined;
13
+ };
14
+ export default deepGet;
15
+ //# sourceMappingURL=deepGet.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deepGet.js","sourceRoot":"","sources":["../../src/utils/deepGet.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,GAAG,CAAC,GAA6B,EAAE,IAAmB,EAAO,EAAE;IAC1E,IAAI,GAAG,GAAQ,GAAG,CAAC;IAEnB,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE;QAC7B,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,EAAE;YAClC,GAAG,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;YACf,OAAO,IAAI,CAAC;SACb;QACD,OAAO,KAAK,CAAC;IACf,CAAC,CAAC,CAAC;IAEH,IAAI,KAAK;QAAE,OAAO,GAAG,CAAC;IAEtB,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AAEF,eAAe,OAAO,CAAC","sourcesContent":["const deepGet = (obj: Record<PropertyKey, any>, keys: PropertyKey[]): any => {\n let rtn: any = obj;\n\n const found = keys.every(key => {\n if (typeof rtn === 'object' && rtn) {\n rtn = rtn[key];\n return true;\n }\n return false;\n });\n\n if (found) return rtn;\n\n return undefined;\n};\n\nexport default deepGet;\n"]}
@@ -0,0 +1,4 @@
1
+ /** Compares two objects by comparing each key value regardless of order. */
2
+ declare const deepObjectComparison: (valueA: any, valueB: any) => boolean;
3
+ export default deepObjectComparison;
4
+ //# sourceMappingURL=deepObjectComparison.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deepObjectComparison.d.ts","sourceRoot":"","sources":["../../src/utils/deepObjectComparison.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,QAAA,MAAM,oBAAoB,WAAY,GAAG,UAAU,GAAG,KAAG,OAiCxD,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
@@ -0,0 +1,35 @@
1
+ /** Compares two objects by comparing each key value regardless of order. */
2
+ const deepObjectComparison = (valueA, valueB) => {
3
+ // If the values are strictly equal, return true
4
+ if (valueA === valueB)
5
+ return true;
6
+ // If the values are not objects and are not equal, return false
7
+ if (typeof valueA !== 'object' ||
8
+ typeof valueB !== 'object' ||
9
+ valueA === null ||
10
+ valueB === null)
11
+ return false;
12
+ const keysA = Object.keys(valueA);
13
+ const keysB = Object.keys(valueB);
14
+ // If the objects have different numbers of keys, return false
15
+ if (keysA.length !== keysB.length)
16
+ return false;
17
+ for (let i = 0; i < keysA.length; i += 1) {
18
+ const key = keysA[i];
19
+ // If there is not a 1:1 mapping of keys between the objects, return false
20
+ if (!keysB.includes(key))
21
+ return false;
22
+ if (typeof valueA[key] === 'function' || typeof valueB[key] === 'function') {
23
+ // If the value of a given key is a function, and the functions are not equivalent between the objects, return false
24
+ if (valueA[key].toString() !== valueB[key].toString())
25
+ return false;
26
+ // If all checks have passed thus far, compare the next set of nested values
27
+ }
28
+ else if (!deepObjectComparison(valueA[key], valueB[key]))
29
+ return false;
30
+ }
31
+ // If all checks have passed, the objects are deeply equal
32
+ return true;
33
+ };
34
+ export default deepObjectComparison;
35
+ //# sourceMappingURL=deepObjectComparison.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deepObjectComparison.js","sourceRoot":"","sources":["../../src/utils/deepObjectComparison.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,MAAM,oBAAoB,GAAG,CAAC,MAAW,EAAE,MAAW,EAAW,EAAE;IACjE,gDAAgD;IAChD,IAAI,MAAM,KAAK,MAAM;QAAE,OAAO,IAAI,CAAC;IAEnC,gEAAgE;IAChE,IACE,OAAO,MAAM,KAAK,QAAQ;QAC1B,OAAO,MAAM,KAAK,QAAQ;QAC1B,MAAM,KAAK,IAAI;QACf,MAAM,KAAK,IAAI;QAEf,OAAO,KAAK,CAAC;IAEf,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAClC,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAElC,8DAA8D;IAC9D,IAAI,KAAK,CAAC,MAAM,KAAK,KAAK,CAAC,MAAM;QAAE,OAAO,KAAK,CAAC;IAEhD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE;QACxC,MAAM,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QACrB,0EAA0E;QAC1E,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC;YAAE,OAAO,KAAK,CAAC;QAEvC,IAAI,OAAO,MAAM,CAAC,GAAG,CAAC,KAAK,UAAU,IAAI,OAAO,MAAM,CAAC,GAAG,CAAC,KAAK,UAAU,EAAE;YAC1E,oHAAoH;YACpH,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,KAAK,MAAM,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE;gBAAE,OAAO,KAAK,CAAC;YACpE,4EAA4E;SAC7E;aAAM,IAAI,CAAC,oBAAoB,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC;YAAE,OAAO,KAAK,CAAC;KAC1E;IAED,0DAA0D;IAC1D,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEF,eAAe,oBAAoB,CAAC","sourcesContent":["/** Compares two objects by comparing each key value regardless of order. */\nconst deepObjectComparison = (valueA: any, valueB: any): boolean => {\n // If the values are strictly equal, return true\n if (valueA === valueB) return true;\n\n // If the values are not objects and are not equal, return false\n if (\n typeof valueA !== 'object' ||\n typeof valueB !== 'object' ||\n valueA === null ||\n valueB === null\n )\n return false;\n\n const keysA = Object.keys(valueA);\n const keysB = Object.keys(valueB);\n\n // If the objects have different numbers of keys, return false\n if (keysA.length !== keysB.length) return false;\n\n for (let i = 0; i < keysA.length; i += 1) {\n const key = keysA[i];\n // If there is not a 1:1 mapping of keys between the objects, return false\n if (!keysB.includes(key)) return false;\n\n if (typeof valueA[key] === 'function' || typeof valueB[key] === 'function') {\n // If the value of a given key is a function, and the functions are not equivalent between the objects, return false\n if (valueA[key].toString() !== valueB[key].toString()) return false;\n // If all checks have passed thus far, compare the next set of nested values\n } else if (!deepObjectComparison(valueA[key], valueB[key])) return false;\n }\n\n // If all checks have passed, the objects are deeply equal\n return true;\n};\n\nexport default deepObjectComparison;\n"]}
@@ -0,0 +1,3 @@
1
+ declare const defineSmartGetter: (obj: Record<string, any>, key: string, valueFn: (...args: any[]) => any) => Record<string, any>;
2
+ export default defineSmartGetter;
3
+ //# sourceMappingURL=defineSmartGetter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defineSmartGetter.d.ts","sourceRoot":"","sources":["../../src/utils/defineSmartGetter.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,iBAAiB,QAChB,OAAO,MAAM,EAAE,GAAG,CAAC,OACnB,MAAM,qBACQ,GAAG,EAAE,KAAK,GAAG,KAC/B,OAAO,MAAM,EAAE,GAAG,CAYpB,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
@@ -0,0 +1,14 @@
1
+ const defineSmartGetter = (obj, key, valueFn) => {
2
+ Object.defineProperty(obj, key, {
3
+ get: () => {
4
+ delete obj[key];
5
+ obj[key] = valueFn();
6
+ return obj[key];
7
+ },
8
+ enumerable: true,
9
+ configurable: true
10
+ });
11
+ return obj;
12
+ };
13
+ export default defineSmartGetter;
14
+ //# sourceMappingURL=defineSmartGetter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defineSmartGetter.js","sourceRoot":"","sources":["../../src/utils/defineSmartGetter.ts"],"names":[],"mappings":"AAAA,MAAM,iBAAiB,GAAG,CACxB,GAAwB,EACxB,GAAW,EACX,OAAgC,EACX,EAAE;IACvB,MAAM,CAAC,cAAc,CAAC,GAAG,EAAE,GAAG,EAAE;QAC9B,GAAG,EAAE,GAAG,EAAE;YACR,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC;YAChB,GAAG,CAAC,GAAG,CAAC,GAAG,OAAO,EAAE,CAAC;YACrB,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC;QAClB,CAAC;QACD,UAAU,EAAE,IAAI;QAChB,YAAY,EAAE,IAAI;KACnB,CAAC,CAAC;IAEH,OAAO,GAAG,CAAC;AACb,CAAC,CAAC;AAEF,eAAe,iBAAiB,CAAC","sourcesContent":["const defineSmartGetter = (\n obj: Record<string, any>,\n key: string,\n valueFn: (...args: any[]) => any\n): Record<string, any> => {\n Object.defineProperty(obj, key, {\n get: () => {\n delete obj[key];\n obj[key] = valueFn();\n return obj[key];\n },\n enumerable: true,\n configurable: true\n });\n\n return obj;\n};\n\nexport default defineSmartGetter;\n"]}
@@ -0,0 +1,3 @@
1
+ declare const documentIsAvailable: boolean;
2
+ export default documentIsAvailable;
3
+ //# sourceMappingURL=documentIsAvailable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"documentIsAvailable.d.ts","sourceRoot":"","sources":["../../src/utils/documentIsAvailable.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,mBAAmB,SAAkC,CAAC;AAE5D,eAAe,mBAAmB,CAAC"}
@@ -0,0 +1,3 @@
1
+ const documentIsAvailable = typeof document !== 'undefined';
2
+ export default documentIsAvailable;
3
+ //# sourceMappingURL=documentIsAvailable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"documentIsAvailable.js","sourceRoot":"","sources":["../../src/utils/documentIsAvailable.ts"],"names":[],"mappings":"AAAA,MAAM,mBAAmB,GAAG,OAAO,QAAQ,KAAK,WAAW,CAAC;AAE5D,eAAe,mBAAmB,CAAC","sourcesContent":["const documentIsAvailable = typeof document !== 'undefined';\n\nexport default documentIsAvailable;\n"]}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Escape special characters in order to pass a string to the RegExp constructor.
3
+ * @param s a string.
4
+ * @returns a string with special characters escaped.
5
+ */
6
+ declare const escapeRegExp: (s: string) => string;
7
+ export default escapeRegExp;
8
+ //# sourceMappingURL=escapeRegExp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"escapeRegExp.d.ts","sourceRoot":"","sources":["../../src/utils/escapeRegExp.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,QAAA,MAAM,YAAY,MAAO,MAAM,KAAG,MAA0D,CAAC;AAE7F,eAAe,YAAY,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Escape special characters in order to pass a string to the RegExp constructor.
3
+ * @param s a string.
4
+ * @returns a string with special characters escaped.
5
+ */
6
+ const escapeRegExp = (s) => String(s).replace(/[\\^$*+?.()|[\]{}]/g, '\\$&');
7
+ export default escapeRegExp;
8
+ //# sourceMappingURL=escapeRegExp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"escapeRegExp.js","sourceRoot":"","sources":["../../src/utils/escapeRegExp.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,YAAY,GAAG,CAAC,CAAS,EAAU,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;AAE7F,eAAe,YAAY,CAAC","sourcesContent":["/**\n * Escape special characters in order to pass a string to the RegExp constructor.\n * @param s a string.\n * @returns a string with special characters escaped.\n */\nconst escapeRegExp = (s: string): string => String(s).replace(/[\\\\^$*+?.()|[\\]{}]/g, '\\\\$&');\n\nexport default escapeRegExp;\n"]}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Focuses the highest level heading element in a container, or the container itself if there are no headings.
3
+ * @param container Node to query for a heading.
4
+ * @param label Fallback label to apply to the container if focused.
5
+ */
6
+ declare const focusHeadingOrContainer: (container: ParentNode, label: string) => void;
7
+ export default focusHeadingOrContainer;
8
+ //# sourceMappingURL=focusHeadingOrContainer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"focusHeadingOrContainer.d.ts","sourceRoot":"","sources":["../../src/utils/focusHeadingOrContainer.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,QAAA,MAAM,uBAAuB,cAAe,UAAU,SAAS,MAAM,SAkCpE,CAAC;AAEF,eAAe,uBAAuB,CAAC"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Focuses the highest level heading element in a container, or the container itself if there are no headings.
3
+ * @param container Node to query for a heading.
4
+ * @param label Fallback label to apply to the container if focused.
5
+ */
6
+ const focusHeadingOrContainer = (container, label) => {
7
+ const heading = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'].reduce((el, tag) => el ?? container.querySelector(tag), null);
8
+ const target = heading ?? container;
9
+ if (!(target instanceof HTMLElement || target instanceof SVGElement))
10
+ return;
11
+ if (target === container && !target.hasAttribute('aria-label')) {
12
+ target.setAttribute('aria-label', label);
13
+ target.addEventListener('focusout', () => {
14
+ target.removeAttribute('aria-label');
15
+ }, { once: true });
16
+ }
17
+ if (target.hasAttribute('tabindex')) {
18
+ target.focus();
19
+ }
20
+ else {
21
+ target.setAttribute('tabindex', '-1');
22
+ target.focus();
23
+ target.addEventListener('focusout', () => {
24
+ target.removeAttribute('tabindex');
25
+ }, { once: true });
26
+ }
27
+ };
28
+ export default focusHeadingOrContainer;
29
+ //# sourceMappingURL=focusHeadingOrContainer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"focusHeadingOrContainer.js","sourceRoot":"","sources":["../../src/utils/focusHeadingOrContainer.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,uBAAuB,GAAG,CAAC,SAAqB,EAAE,KAAa,EAAE,EAAE;IACvE,MAAM,OAAO,GAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAW,CAAC,MAAM,CACpE,CAAC,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC,EAAE,IAAI,SAAS,CAAC,aAAa,CAAC,GAAG,CAAC,EAC/C,IAAI,CACL,CAAC;IAEF,MAAM,MAAM,GAAG,OAAO,IAAI,SAAS,CAAC;IAEpC,IAAI,CAAC,CAAC,MAAM,YAAY,WAAW,IAAI,MAAM,YAAY,UAAU,CAAC;QAAE,OAAO;IAE7E,IAAI,MAAM,KAAK,SAAS,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,YAAY,CAAC,EAAE;QAC9D,MAAM,CAAC,YAAY,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC;QACzC,MAAM,CAAC,gBAAgB,CACrB,UAAU,EACV,GAAG,EAAE;YACH,MAAM,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC;QACvC,CAAC,EACD,EAAE,IAAI,EAAE,IAAI,EAAE,CACf,CAAC;KACH;IAED,IAAI,MAAM,CAAC,YAAY,CAAC,UAAU,CAAC,EAAE;QACnC,MAAM,CAAC,KAAK,EAAE,CAAC;KAChB;SAAM;QACL,MAAM,CAAC,YAAY,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;QACtC,MAAM,CAAC,KAAK,EAAE,CAAC;QACf,MAAM,CAAC,gBAAgB,CACrB,UAAU,EACV,GAAG,EAAE;YACH,MAAM,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC;QACrC,CAAC,EACD,EAAE,IAAI,EAAE,IAAI,EAAE,CACf,CAAC;KACH;AACH,CAAC,CAAC;AAEF,eAAe,uBAAuB,CAAC","sourcesContent":["/**\n * Focuses the highest level heading element in a container, or the container itself if there are no headings.\n * @param container Node to query for a heading.\n * @param label Fallback label to apply to the container if focused.\n */\nconst focusHeadingOrContainer = (container: ParentNode, label: string) => {\n const heading = (['h1', 'h2', 'h3', 'h4', 'h5', 'h6'] as const).reduce<HTMLHeadingElement | null>(\n (el, tag) => el ?? container.querySelector(tag),\n null\n );\n\n const target = heading ?? container;\n\n if (!(target instanceof HTMLElement || target instanceof SVGElement)) return;\n\n if (target === container && !target.hasAttribute('aria-label')) {\n target.setAttribute('aria-label', label);\n target.addEventListener(\n 'focusout',\n () => {\n target.removeAttribute('aria-label');\n },\n { once: true }\n );\n }\n\n if (target.hasAttribute('tabindex')) {\n target.focus();\n } else {\n target.setAttribute('tabindex', '-1');\n target.focus();\n target.addEventListener(\n 'focusout',\n () => {\n target.removeAttribute('tabindex');\n },\n { once: true }\n );\n }\n};\n\nexport default focusHeadingOrContainer;\n"]}
@@ -0,0 +1,15 @@
1
+ import type { TranslationFunction, TranslationPack } from '../i18n';
2
+ /**
3
+ * Function generates string representation of the given list accordingly to localization rules of given locale.
4
+ * @param list list of strings to format
5
+ * @param t translation function used internally
6
+ * @param locale locale tag to get the localization rules for
7
+ * @param options formatting options
8
+ * @returns
9
+ */
10
+ declare const formatListToLocaleString: (list: string[], t: TranslationFunction<TranslationPack>, locale: string, { count, separator }?: {
11
+ count?: number | undefined;
12
+ separator?: string | undefined;
13
+ }) => string;
14
+ export default formatListToLocaleString;
15
+ //# sourceMappingURL=formatListToLocaleString.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatListToLocaleString.d.ts","sourceRoot":"","sources":["../../src/utils/formatListToLocaleString.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAEpE;;;;;;;GAOG;AACH,QAAA,MAAM,wBAAwB,SACtB,MAAM,EAAE,KACX,oBAAoB,eAAe,CAAC,UAC/B,MAAM;;;MAQb,MASF,CAAC;AAEF,eAAe,wBAAwB,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Function generates string representation of the given list accordingly to localization rules of given locale.
3
+ * @param list list of strings to format
4
+ * @param t translation function used internally
5
+ * @param locale locale tag to get the localization rules for
6
+ * @param options formatting options
7
+ * @returns
8
+ */
9
+ const formatListToLocaleString = (list, t, locale, { count = list.length, separator } = {}) => {
10
+ const remainder = list.length ? count - list.length : 0;
11
+ const toFormat = remainder > 0 ? [...list, t('more_count', [remainder], { count: remainder })] : list;
12
+ if (separator || !('ListFormat' in Intl))
13
+ return toFormat.join(separator ?? ', ');
14
+ return new Intl.ListFormat(locale, { style: 'long' }).format(toFormat);
15
+ };
16
+ export default formatListToLocaleString;
17
+ //# sourceMappingURL=formatListToLocaleString.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatListToLocaleString.js","sourceRoot":"","sources":["../../src/utils/formatListToLocaleString.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,MAAM,wBAAwB,GAAG,CAC/B,IAAc,EACd,CAAuC,EACvC,MAAc,EACd,EACE,KAAK,GAAG,IAAI,CAAC,MAAM,EACnB,SAAS,KAIP,EAAE,EACE,EAAE;IACV,MAAM,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IAExD,MAAM,QAAQ,GACZ,SAAS,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC,YAAY,EAAE,CAAC,SAAS,CAAC,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAEvF,IAAI,SAAS,IAAI,CAAC,CAAC,YAAY,IAAI,IAAI,CAAC;QAAE,OAAO,QAAQ,CAAC,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,CAAC;IAElF,OAAO,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;AACzE,CAAC,CAAC;AAEF,eAAe,wBAAwB,CAAC","sourcesContent":["import type { TranslationFunction, TranslationPack } from '../i18n';\n\n/**\n * Function generates string representation of the given list accordingly to localization rules of given locale.\n * @param list list of strings to format\n * @param t translation function used internally\n * @param locale locale tag to get the localization rules for\n * @param options formatting options\n * @returns\n */\nconst formatListToLocaleString = (\n list: string[],\n t: TranslationFunction<TranslationPack>,\n locale: string,\n {\n count = list.length,\n separator\n }: {\n count?: number;\n separator?: string;\n } = {}\n): string => {\n const remainder = list.length ? count - list.length : 0;\n\n const toFormat =\n remainder > 0 ? [...list, t('more_count', [remainder], { count: remainder })] : list;\n\n if (separator || !('ListFormat' in Intl)) return toFormat.join(separator ?? ', ');\n\n return new Intl.ListFormat(locale, { style: 'long' }).format(toFormat);\n};\n\nexport default formatListToLocaleString;\n"]}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Gets element that currently has focus with support for open shadow roots.
3
+ * @param root Optional container to search for the active element. Defaults to `document`.
4
+ * @returns The Element within the DOM that currently has focus.
5
+ */
6
+ declare const getActiveElement: (root?: DocumentOrShadowRoot) => Element | null;
7
+ export default getActiveElement;
8
+ //# sourceMappingURL=getActiveElement.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getActiveElement.d.ts","sourceRoot":"","sources":["../../src/utils/getActiveElement.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,QAAA,MAAM,gBAAgB,UAAU,oBAAoB,KAAc,OAAO,GAAG,IAc3E,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Gets element that currently has focus with support for open shadow roots.
3
+ * @param root Optional container to search for the active element. Defaults to `document`.
4
+ * @returns The Element within the DOM that currently has focus.
5
+ */
6
+ const getActiveElement = (root = document) => {
7
+ let activeEl = root.activeElement;
8
+ if (!activeEl)
9
+ return null;
10
+ if (activeEl.tagName.toLowerCase() === 'iframe' &&
11
+ activeEl.contentDocument)
12
+ activeEl = getActiveElement(activeEl.contentDocument) ?? activeEl;
13
+ if (activeEl.shadowRoot)
14
+ activeEl = getActiveElement(activeEl.shadowRoot) ?? activeEl;
15
+ return activeEl;
16
+ };
17
+ export default getActiveElement;
18
+ //# sourceMappingURL=getActiveElement.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getActiveElement.js","sourceRoot":"","sources":["../../src/utils/getActiveElement.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,gBAAgB,GAAG,CAAC,OAA6B,QAAQ,EAAkB,EAAE;IACjF,IAAI,QAAQ,GAAG,IAAI,CAAC,aAAa,CAAC;IAElC,IAAI,CAAC,QAAQ;QAAE,OAAO,IAAI,CAAC;IAE3B,IACE,QAAQ,CAAC,OAAO,CAAC,WAAW,EAAE,KAAK,QAAQ;QAC1C,QAA8B,CAAC,eAAe;QAE/C,QAAQ,GAAG,gBAAgB,CAAE,QAA8B,CAAC,eAAgB,CAAC,IAAI,QAAQ,CAAC;IAE5F,IAAI,QAAQ,CAAC,UAAU;QAAE,QAAQ,GAAG,gBAAgB,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,QAAQ,CAAC;IAEtF,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC;AAEF,eAAe,gBAAgB,CAAC","sourcesContent":["/**\n * Gets element that currently has focus with support for open shadow roots.\n * @param root Optional container to search for the active element. Defaults to `document`.\n * @returns The Element within the DOM that currently has focus.\n */\nconst getActiveElement = (root: DocumentOrShadowRoot = document): Element | null => {\n let activeEl = root.activeElement;\n\n if (!activeEl) return null;\n\n if (\n activeEl.tagName.toLowerCase() === 'iframe' &&\n (activeEl as HTMLIFrameElement).contentDocument\n )\n activeEl = getActiveElement((activeEl as HTMLIFrameElement).contentDocument!) ?? activeEl;\n\n if (activeEl.shadowRoot) activeEl = getActiveElement(activeEl.shadowRoot) ?? activeEl;\n\n return activeEl;\n};\n\nexport default getActiveElement;\n"]}
@@ -0,0 +1,9 @@
1
+ import type { RefObject } from 'react';
2
+ /**
3
+ * Returns all valid focusable elements within a given ref.
4
+ * @param focusablesRef The ref containing the element to search for focusable elements within.
5
+ * @returns a list of valid focusable elements within the given ref.
6
+ */
7
+ declare const getFocusables: (focusablesRef: RefObject<HTMLElement>) => HTMLElement[];
8
+ export default getFocusables;
9
+ //# sourceMappingURL=getFocusables.d.ts.map