@dynatrace/strato-components 0.84.12 → 0.84.21

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 (78) hide show
  1. package/core/components/app-root/AppRoot.css +1 -0
  2. package/core/components/app-root/AppRoot.js +112 -1
  3. package/core/components/app-root/AppRoot.sty.js +1 -1
  4. package/core/components/focus-scope/FocusScope.js +81 -1
  5. package/core/contexts/FocusContext.js +28 -1
  6. package/core/hooks/useActiveElement.js +36 -1
  7. package/core/hooks/useCurrentTheme.js +54 -1
  8. package/core/hooks/useFocusContext.js +27 -1
  9. package/core/index.js +45 -1
  10. package/core/providers/FocusProvider.js +146 -1
  11. package/core/types/data-props.js +15 -1
  12. package/core/types/styling-props.js +15 -1
  13. package/core/types/with-children.js +15 -1
  14. package/core/utils/focus-management/attempt-focus.js +33 -1
  15. package/core/utils/focus-management/focus-first-descendant.js +35 -1
  16. package/core/utils/focus-management/get-first-focusable-child.js +32 -1
  17. package/core/utils/focus-management/get-last-focusable-child.js +35 -1
  18. package/core/utils/focus-management/is-focusable.js +39 -1
  19. package/core/utils/isBrowser.js +25 -1
  20. package/core/utils/merge-props.js +50 -1
  21. package/esm/core/components/app-root/AppRoot.css +1 -0
  22. package/esm/core/components/app-root/AppRoot.js +88 -1
  23. package/esm/core/components/app-root/AppRoot.js.map +2 -2
  24. package/esm/core/components/app-root/AppRoot.sty.js +1 -1
  25. package/esm/core/components/app-root/AppRoot.sty.js.map +1 -1
  26. package/esm/core/components/focus-scope/FocusScope.js +52 -1
  27. package/esm/core/components/focus-scope/FocusScope.js.map +2 -2
  28. package/esm/core/contexts/FocusContext.js +9 -1
  29. package/esm/core/contexts/FocusContext.js.map +2 -2
  30. package/esm/core/hooks/useActiveElement.js +17 -1
  31. package/esm/core/hooks/useActiveElement.js.map +2 -2
  32. package/esm/core/hooks/useCurrentTheme.js +35 -1
  33. package/esm/core/hooks/useCurrentTheme.js.map +2 -2
  34. package/esm/core/hooks/useFocusContext.js +10 -1
  35. package/esm/core/hooks/useFocusContext.js.map +2 -2
  36. package/esm/core/index.js +32 -1
  37. package/esm/core/index.js.map +2 -2
  38. package/esm/core/providers/FocusProvider.js +117 -1
  39. package/esm/core/providers/FocusProvider.js.map +2 -2
  40. package/esm/core/utils/focus-management/attempt-focus.js +14 -1
  41. package/esm/core/utils/focus-management/attempt-focus.js.map +2 -2
  42. package/esm/core/utils/focus-management/focus-first-descendant.js +16 -1
  43. package/esm/core/utils/focus-management/focus-first-descendant.js.map +2 -2
  44. package/esm/core/utils/focus-management/get-first-focusable-child.js +13 -1
  45. package/esm/core/utils/focus-management/get-first-focusable-child.js.map +2 -2
  46. package/esm/core/utils/focus-management/get-last-focusable-child.js +16 -1
  47. package/esm/core/utils/focus-management/get-last-focusable-child.js.map +2 -2
  48. package/esm/core/utils/focus-management/is-focusable.js +20 -1
  49. package/esm/core/utils/focus-management/is-focusable.js.map +2 -2
  50. package/esm/core/utils/isBrowser.js +6 -1
  51. package/esm/core/utils/isBrowser.js.map +2 -2
  52. package/esm/core/utils/merge-props.js +31 -1
  53. package/esm/core/utils/merge-props.js.map +2 -2
  54. package/esm/index.js +1 -1
  55. package/esm/index.js.map +1 -1
  56. package/index.js +17 -1
  57. package/package.json +1 -1
  58. package/testing/custom-render.js +62 -1
  59. package/testing/index.js +91 -1
  60. package/testing/mocks/bounding-client-rect-mock.js +36 -1
  61. package/testing/mocks/canvas-mock.js +187 -1
  62. package/testing/mocks/create-mock-element.js +99 -1
  63. package/testing/mocks/create-range-mock.js +47 -1
  64. package/testing/mocks/dom-rect-mock.js +56 -1
  65. package/testing/mocks/fetch-mock.js +38 -1
  66. package/testing/mocks/intersection-observer-mock.js +58 -1
  67. package/testing/mocks/match-media-mock.js +45 -1
  68. package/testing/mocks/offset-height-mock.js +39 -1
  69. package/testing/mocks/offset-width-mock.js +39 -1
  70. package/testing/mocks/pointer-event-mock.js +42 -1
  71. package/testing/mocks/resize-observer-mock.js +42 -1
  72. package/testing/mocks/screen-size-mock.js +34 -1
  73. package/testing/mocks/scroll-into-view-mock.js +34 -1
  74. package/testing/mocks/scroll-width-mock.js +39 -1
  75. package/testing/mocks/select-mock.js +45 -1
  76. package/testing/mocks/table-virtualization-mock.js +47 -1
  77. package/testing/mocks/text-ellipsis-mock.js +38 -1
  78. package/testing/setup.js +57 -1
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/core/hooks/useFocusContext.ts"],
4
4
  "sourcesContent": ["import { useContext } from 'react';\n\nimport {\n type FocusContextProps,\n FocusContext,\n} from '../contexts/FocusContext.js';\n\n/**\n * Internal hook wrapper for accessing the FocusContext.\n * @internal\n */\nexport const useFocusContext = (): FocusContextProps => {\n return useContext(FocusContext);\n};\n"],
5
- "mappings": "AAAA,OAAS,cAAAA,MAAkB,QAE3B,OAEE,gBAAAC,MACK,8BAMA,MAAMC,EAAkB,IACtBF,EAAWC,CAAY",
6
- "names": ["useContext", "FocusContext", "useFocusContext"]
5
+ "mappings": "AAAA,SAAS,kBAAkB;AAE3B;AAAA,EAEE;AAAA,OACK;AAMA,MAAM,kBAAkB,MAAyB;AACtD,SAAO,WAAW,YAAY;AAChC;",
6
+ "names": []
7
7
  }
package/esm/core/index.js CHANGED
@@ -1,2 +1,33 @@
1
- import{AppRoot as s}from"./components/app-root/AppRoot.js";import{FocusScope as r}from"./components/focus-scope/FocusScope.js";import{useCurrentTheme as c}from"./hooks/useCurrentTheme.js";import{useFocusContext as i}from"./hooks/useFocusContext.js";import{FocusProvider as F}from"./providers/FocusProvider.js";import{attemptFocus as n}from"./utils/focus-management/attempt-focus.js";import{focusFirstDescendant as y}from"./utils/focus-management/focus-first-descendant.js";import{getFirstFocusableChild as _}from"./utils/focus-management/get-first-focusable-child.js";import{getLastFocusableChild as C}from"./utils/focus-management/get-last-focusable-child.js";import{isFocusable as T}from"./utils/focus-management/is-focusable.js";import{isBrowser as b}from"./utils/isBrowser.js";import{mergeProps as j}from"./utils/merge-props.js";export{s as AppRoot,F as _FocusProvider,r as _FocusScope,n as _attemptFocus,y as _focusFirstDescendant,_ as _getFirstFocusableChild,C as _getLastFocusableChild,b as _isBrowser,T as _isFocusable,j as _mergeProps,i as _useFocusContext,c as useCurrentTheme};
1
+ import { AppRoot } from "./components/app-root/AppRoot.js";
2
+ import {
3
+ FocusScope
4
+ } from "./components/focus-scope/FocusScope.js";
5
+ import { useCurrentTheme } from "./hooks/useCurrentTheme.js";
6
+ import { useFocusContext } from "./hooks/useFocusContext.js";
7
+ import {
8
+ FocusProvider
9
+ } from "./providers/FocusProvider.js";
10
+ import { attemptFocus } from "./utils/focus-management/attempt-focus.js";
11
+ import { focusFirstDescendant } from "./utils/focus-management/focus-first-descendant.js";
12
+ import { getFirstFocusableChild } from "./utils/focus-management/get-first-focusable-child.js";
13
+ import { getLastFocusableChild } from "./utils/focus-management/get-last-focusable-child.js";
14
+ import { isFocusable } from "./utils/focus-management/is-focusable.js";
15
+ import { isBrowser } from "./utils/isBrowser.js";
16
+ import {
17
+ mergeProps
18
+ } from "./utils/merge-props.js";
19
+ export {
20
+ AppRoot,
21
+ FocusProvider as _FocusProvider,
22
+ FocusScope as _FocusScope,
23
+ attemptFocus as _attemptFocus,
24
+ focusFirstDescendant as _focusFirstDescendant,
25
+ getFirstFocusableChild as _getFirstFocusableChild,
26
+ getLastFocusableChild as _getLastFocusableChild,
27
+ isBrowser as _isBrowser,
28
+ isFocusable as _isFocusable,
29
+ mergeProps as _mergeProps,
30
+ useFocusContext as _useFocusContext,
31
+ useCurrentTheme
32
+ };
2
33
  //# sourceMappingURL=index.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../src/core/index.ts"],
4
4
  "sourcesContent": ["export { AppRoot, type AppRootProps } from './components/app-root/AppRoot.js';\nexport {\n FocusScope as _FocusScope,\n type FocusScopeProps as _FocusScopeProps,\n} from './components/focus-scope/FocusScope.js';\n\nexport { type FocusContextProps as _FocusContextProps } from './contexts/FocusContext.js';\n\nexport { useCurrentTheme } from './hooks/useCurrentTheme.js';\nexport { useFocusContext as _useFocusContext } from './hooks/useFocusContext.js';\nexport {\n FocusProvider as _FocusProvider,\n type Modality as _Modality,\n} from './providers/FocusProvider.js';\nexport type { DataTestId } from './types/data-props.js';\nexport type { StylingProps } from './types/styling-props.js';\nexport type { WithChildren } from './types/with-children.js';\n\nexport { attemptFocus as _attemptFocus } from './utils/focus-management/attempt-focus.js';\nexport { focusFirstDescendant as _focusFirstDescendant } from './utils/focus-management/focus-first-descendant.js';\nexport { getFirstFocusableChild as _getFirstFocusableChild } from './utils/focus-management/get-first-focusable-child.js';\nexport { getLastFocusableChild as _getLastFocusableChild } from './utils/focus-management/get-last-focusable-child.js';\nexport { isFocusable as _isFocusable } from './utils/focus-management/is-focusable.js';\nexport { isBrowser as _isBrowser } from './utils/isBrowser.js';\nexport {\n mergeProps as _mergeProps,\n type NullToObject as _NullToObject,\n type TupleTypes as _TupleTypes,\n type UnionToIntersection as _UnionToIntersection,\n} from './utils/merge-props.js';\n"],
5
- "mappings": "AAAA,OAAS,WAAAA,MAAkC,mCAC3C,OACgB,cAAdC,MAEK,yCAIP,OAAS,mBAAAC,MAAuB,6BAChC,OAA4B,mBAAnBC,MAA2C,6BACpD,OACmB,iBAAjBC,MAEK,+BAKP,OAAyB,gBAAhBC,MAAqC,4CAC9C,OAAiC,wBAAxBC,MAAqD,qDAC9D,OAAmC,0BAA1BC,MAAyD,wDAClE,OAAkC,yBAAzBC,MAAuD,uDAChE,OAAwB,eAAfC,MAAmC,2CAC5C,OAAsB,aAAbC,MAA+B,uBACxC,OACgB,cAAdC,MAIK",
6
- "names": ["AppRoot", "FocusScope", "useCurrentTheme", "useFocusContext", "FocusProvider", "attemptFocus", "focusFirstDescendant", "getFirstFocusableChild", "getLastFocusableChild", "isFocusable", "isBrowser", "mergeProps"]
5
+ "mappings": "AAAA,SAAS,eAAkC;AAC3C;AAAA,EACgB;AAAA,OAET;AAIP,SAAS,uBAAuB;AAChC,SAA4B,uBAAwB;AACpD;AAAA,EACmB;AAAA,OAEZ;AAKP,SAAyB,oBAAqB;AAC9C,SAAiC,4BAA6B;AAC9D,SAAmC,8BAA+B;AAClE,SAAkC,6BAA8B;AAChE,SAAwB,mBAAoB;AAC5C,SAAsB,iBAAkB;AACxC;AAAA,EACgB;AAAA,OAIT;",
6
+ "names": []
7
7
  }
@@ -1,2 +1,118 @@
1
- import i,{useCallback as s,useEffect as l,useState as d}from"react";import{FocusContext as y}from"../contexts/FocusContext.js";import{useFocusContext as m}from"../hooks/useFocusContext.js";import{mergeProps as h}from"../utils/merge-props.js";const k=["Alt","AltGraph","CapsLock","Control","Fn","FnLock","Hyper","Meta","NumLock","OS","ScrollLock","Super","Symbol","SymbolLock"],v={keydown:"keyboard",keyup:"keyboard",mousedown:"mouse",mousemove:"mouse",MSPointerDown:"pointer",MSPointerMove:"pointer",pointerdown:"pointer",pointermove:"pointer",touchstart:"touch",touchend:"touch",wheel:"wheel"},f=["Tab","Esc","Escape"," ","ArrowDown","Down","ArrowUp","Up","ArrowLeft","Left","ArrowRight","Right","End","Home","PageDown","PageUp"],b=({children:u})=>{const[r,a]=d(!1),c=m(),[p,t]=d("unknown"),n=s(o=>{if(k.includes(o.key)){t("pointer");return}(!o.target||f.includes(o.key))&&t("keyboard")},[]),e=s(o=>{switch(v[o.type]){case"touch":case"pen":return t("touch");case"mouse":case"pointer":case"wheel":return t("pointer");default:return"unknown"}},[]);l(()=>(window.addEventListener("pointerdown",e),window.addEventListener("keydown",n,{capture:!0}),window.addEventListener("wheel",e),()=>{window.removeEventListener("pointerdown",e),window.removeEventListener("keydown",n,{capture:!0}),window.removeEventListener("wheel",e)}),[n,e]);const w=r?{inert:"true",tabIndex:-1,"aria-hidden":!0}:{inert:void 0,tabIndex:void 0,"aria-hidden":!1};return i.createElement(y.Provider,{value:{...h(c,{backgroundInertness:r,setBackgroundInertness:a,modality:p})}},i.createElement("div",{...w},u))};b.displayName="FocusProvider";export{b as FocusProvider};
1
+ import React, { useCallback, useEffect, useState } from "react";
2
+ import { FocusContext } from "../contexts/FocusContext.js";
3
+ import { useFocusContext } from "../hooks/useFocusContext.js";
4
+ import { mergeProps } from "../utils/merge-props.js";
5
+ const ignoreMap = [
6
+ "Alt",
7
+ "AltGraph",
8
+ "CapsLock",
9
+ "Control",
10
+ "Fn",
11
+ "FnLock",
12
+ "Hyper",
13
+ "Meta",
14
+ // Command (Mac), in some browsers also Windows-key
15
+ "NumLock",
16
+ "OS",
17
+ // Windows-key
18
+ "ScrollLock",
19
+ "Super",
20
+ // Virtual keyboard key
21
+ "Symbol",
22
+ "SymbolLock"
23
+ ];
24
+ const eventTypeMap = {
25
+ keydown: "keyboard",
26
+ keyup: "keyboard",
27
+ mousedown: "mouse",
28
+ mousemove: "mouse",
29
+ MSPointerDown: "pointer",
30
+ MSPointerMove: "pointer",
31
+ pointerdown: "pointer",
32
+ pointermove: "pointer",
33
+ touchstart: "touch",
34
+ touchend: "touch",
35
+ wheel: "wheel"
36
+ };
37
+ const navigationalKeys = [
38
+ "Tab",
39
+ "Esc",
40
+ "Escape",
41
+ " ",
42
+ "ArrowDown",
43
+ "Down",
44
+ "ArrowUp",
45
+ "Up",
46
+ "ArrowLeft",
47
+ "Left",
48
+ "ArrowRight",
49
+ "Right",
50
+ "End",
51
+ "Home",
52
+ "PageDown",
53
+ "PageUp"
54
+ ];
55
+ const FocusProvider = ({ children }) => {
56
+ const [backgroundInertness, setBackgroundInertness] = useState(false);
57
+ const focusContext = useFocusContext();
58
+ const [modality, setModality] = useState("unknown");
59
+ const setKeyboardInputModality = useCallback((event) => {
60
+ if (ignoreMap.includes(event.key)) {
61
+ setModality("pointer");
62
+ return;
63
+ }
64
+ if (!event.target || navigationalKeys.includes(event.key)) {
65
+ setModality("keyboard");
66
+ }
67
+ }, []);
68
+ const setMouseInputModality = useCallback((event) => {
69
+ switch (eventTypeMap[event.type]) {
70
+ case "touch":
71
+ case "pen":
72
+ return setModality("touch");
73
+ case "mouse":
74
+ case "pointer":
75
+ case "wheel":
76
+ return setModality("pointer");
77
+ default:
78
+ return "unknown";
79
+ }
80
+ }, []);
81
+ useEffect(() => {
82
+ window.addEventListener("pointerdown", setMouseInputModality);
83
+ window.addEventListener("keydown", setKeyboardInputModality, {
84
+ capture: true
85
+ });
86
+ window.addEventListener("wheel", setMouseInputModality);
87
+ return () => {
88
+ window.removeEventListener("pointerdown", setMouseInputModality);
89
+ window.removeEventListener("keydown", setKeyboardInputModality, {
90
+ capture: true
91
+ });
92
+ window.removeEventListener("wheel", setMouseInputModality);
93
+ };
94
+ }, [setKeyboardInputModality, setMouseInputModality]);
95
+ const focusProps = backgroundInertness ? {
96
+ inert: "true",
97
+ tabIndex: -1,
98
+ "aria-hidden": true
99
+ } : { inert: void 0, tabIndex: void 0, "aria-hidden": false };
100
+ return /* @__PURE__ */ React.createElement(
101
+ FocusContext.Provider,
102
+ {
103
+ value: {
104
+ ...mergeProps(focusContext, {
105
+ backgroundInertness,
106
+ setBackgroundInertness,
107
+ modality
108
+ })
109
+ }
110
+ },
111
+ /* @__PURE__ */ React.createElement("div", { ...focusProps }, children)
112
+ );
113
+ };
114
+ FocusProvider["displayName"] = "FocusProvider";
115
+ export {
116
+ FocusProvider
117
+ };
2
118
  //# sourceMappingURL=FocusProvider.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/core/providers/FocusProvider.tsx"],
4
4
  "sourcesContent": ["import React, { useCallback, useEffect, useState } from 'react';\n\nimport { FocusContext } from '../contexts/FocusContext.js';\nimport { useFocusContext } from '../hooks/useFocusContext.js';\nimport type { WithChildren } from '../types/with-children.js';\nimport { mergeProps } from '../utils/merge-props.js';\n\n// list of modifier keys commonly used in a mouse or keyboard combination,\n// see https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_key_values#modifier_keys.\nconst ignoreMap = [\n 'Alt',\n 'AltGraph',\n 'CapsLock',\n 'Control',\n 'Fn',\n 'FnLock',\n 'Hyper',\n 'Meta', // Command (Mac), in some browsers also Windows-key\n 'NumLock',\n 'OS', // Windows-key\n 'ScrollLock',\n 'Super', // Virtual keyboard key\n 'Symbol',\n 'SymbolLock',\n];\n\n/** Look-up map of all event types and the corresponding modalities. */\nconst eventTypeMap: Record<string, string> = {\n keydown: 'keyboard',\n keyup: 'keyboard',\n mousedown: 'mouse',\n mousemove: 'mouse',\n MSPointerDown: 'pointer',\n MSPointerMove: 'pointer',\n pointerdown: 'pointer',\n pointermove: 'pointer',\n touchstart: 'touch',\n touchend: 'touch',\n wheel: 'wheel',\n};\n\n/**\n * @internal\n * Type defining the modality options for the focus handling.\n */\nexport type Modality = 'keyboard' | 'pointer' | 'touch' | 'unknown';\n\n/**\n * All navigational keys that should be considered keyboard users,\n * see https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_key_values#navigation_keys\n */\nconst navigationalKeys = [\n 'Tab',\n 'Esc',\n 'Escape',\n ' ',\n 'ArrowDown',\n 'Down',\n 'ArrowUp',\n 'Up',\n 'ArrowLeft',\n 'Left',\n 'ArrowRight',\n 'Right',\n 'End',\n 'Home',\n 'PageDown',\n 'PageUp',\n];\n\n/**\n * @internal\n *\n * Provider that can be reused in components for storing the focus context props.\n * Loosely inspired by [what-input-js](https://github.com/ten1seven/what-input/blob/main/src/scripts/what-input.js).\n */\nexport const FocusProvider = ({ children }: WithChildren) => {\n const [backgroundInertness, setBackgroundInertness] = useState(false);\n const focusContext = useFocusContext();\n const [modality, setModality] = useState<Modality>('unknown');\n\n const setKeyboardInputModality = useCallback((event: KeyboardEvent) => {\n if (ignoreMap.includes(event.key)) {\n setModality('pointer');\n return;\n }\n\n if (!event.target || navigationalKeys.includes(event.key)) {\n setModality('keyboard');\n }\n }, []);\n\n const setMouseInputModality = useCallback((event: MouseEvent) => {\n switch (eventTypeMap[event.type]) {\n case 'touch':\n case 'pen':\n return setModality('touch');\n case 'mouse':\n case 'pointer':\n case 'wheel':\n return setModality('pointer');\n default:\n return 'unknown';\n }\n }, []);\n\n useEffect(() => {\n window.addEventListener('pointerdown', setMouseInputModality);\n // we need to rely on the keydown event (already in the capture phase) here so we don't break usages where the event default behavior is prevented or propagation is stopped,\n // which would otherwise get the wrong, initial, modality (unknown); by using the capture phase, we can ensure we set the modality correctly before the other events occur\n window.addEventListener('keydown', setKeyboardInputModality, {\n capture: true,\n });\n window.addEventListener('wheel', setMouseInputModality);\n\n return () => {\n window.removeEventListener('pointerdown', setMouseInputModality);\n window.removeEventListener('keydown', setKeyboardInputModality, {\n capture: true,\n });\n window.removeEventListener('wheel', setMouseInputModality);\n };\n }, [setKeyboardInputModality, setMouseInputModality]);\n\n const focusProps = backgroundInertness\n ? {\n inert: 'true',\n tabIndex: -1,\n 'aria-hidden': true,\n }\n : { inert: undefined, tabIndex: undefined, 'aria-hidden': false };\n\n return (\n <FocusContext.Provider\n value={{\n ...mergeProps(focusContext, {\n backgroundInertness,\n setBackgroundInertness,\n modality,\n }),\n }}\n >\n <div {...focusProps}>{children}</div>\n </FocusContext.Provider>\n );\n};\n\nFocusProvider['displayName'] = 'FocusProvider';\n"],
5
- "mappings": "AAAA,OAAOA,GAAS,eAAAC,EAAa,aAAAC,EAAW,YAAAC,MAAgB,QAExD,OAAS,gBAAAC,MAAoB,8BAC7B,OAAS,mBAAAC,MAAuB,8BAEhC,OAAS,cAAAC,MAAkB,0BAI3B,MAAMC,EAAY,CAChB,MACA,WACA,WACA,UACA,KACA,SACA,QACA,OACA,UACA,KACA,aACA,QACA,SACA,YACF,EAGMC,EAAuC,CAC3C,QAAS,WACT,MAAO,WACP,UAAW,QACX,UAAW,QACX,cAAe,UACf,cAAe,UACf,YAAa,UACb,YAAa,UACb,WAAY,QACZ,SAAU,QACV,MAAO,OACT,EAYMC,EAAmB,CACvB,MACA,MACA,SACA,IACA,YACA,OACA,UACA,KACA,YACA,OACA,aACA,QACA,MACA,OACA,WACA,QACF,EAQaC,EAAgB,CAAC,CAAE,SAAAC,CAAS,IAAoB,CAC3D,KAAM,CAACC,EAAqBC,CAAsB,EAAIV,EAAS,EAAK,EAC9DW,EAAeT,EAAgB,EAC/B,CAACU,EAAUC,CAAW,EAAIb,EAAmB,SAAS,EAEtDc,EAA2BhB,EAAaiB,GAAyB,CACrE,GAAIX,EAAU,SAASW,EAAM,GAAG,EAAG,CACjCF,EAAY,SAAS,EACrB,MACF,EAEI,CAACE,EAAM,QAAUT,EAAiB,SAASS,EAAM,GAAG,IACtDF,EAAY,UAAU,CAE1B,EAAG,CAAC,CAAC,EAECG,EAAwBlB,EAAaiB,GAAsB,CAC/D,OAAQV,EAAaU,EAAM,IAAI,EAAG,CAChC,IAAK,QACL,IAAK,MACH,OAAOF,EAAY,OAAO,EAC5B,IAAK,QACL,IAAK,UACL,IAAK,QACH,OAAOA,EAAY,SAAS,EAC9B,QACE,MAAO,SACX,CACF,EAAG,CAAC,CAAC,EAELd,EAAU,KACR,OAAO,iBAAiB,cAAeiB,CAAqB,EAG5D,OAAO,iBAAiB,UAAWF,EAA0B,CAC3D,QAAS,EACX,CAAC,EACD,OAAO,iBAAiB,QAASE,CAAqB,EAE/C,IAAM,CACX,OAAO,oBAAoB,cAAeA,CAAqB,EAC/D,OAAO,oBAAoB,UAAWF,EAA0B,CAC9D,QAAS,EACX,CAAC,EACD,OAAO,oBAAoB,QAASE,CAAqB,CAC3D,GACC,CAACF,EAA0BE,CAAqB,CAAC,EAEpD,MAAMC,EAAaR,EACf,CACE,MAAO,OACP,SAAU,GACV,cAAe,EACjB,EACA,CAAE,MAAO,OAAW,SAAU,OAAW,cAAe,EAAM,EAElE,OACEZ,EAAA,cAACI,EAAa,SAAb,CACC,MAAO,CACL,GAAGE,EAAWQ,EAAc,CAC1B,oBAAAF,EACA,uBAAAC,EACA,SAAAE,CACF,CAAC,CACH,GAEAf,EAAA,cAAC,OAAK,GAAGoB,GAAaT,CAAS,CACjC,CAEJ,EAEAD,EAAc,YAAiB",
6
- "names": ["React", "useCallback", "useEffect", "useState", "FocusContext", "useFocusContext", "mergeProps", "ignoreMap", "eventTypeMap", "navigationalKeys", "FocusProvider", "children", "backgroundInertness", "setBackgroundInertness", "focusContext", "modality", "setModality", "setKeyboardInputModality", "event", "setMouseInputModality", "focusProps"]
5
+ "mappings": "AAAA,OAAO,SAAS,aAAa,WAAW,gBAAgB;AAExD,SAAS,oBAAoB;AAC7B,SAAS,uBAAuB;AAEhC,SAAS,kBAAkB;AAI3B,MAAM,YAAY;AAAA,EAChB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA;AAAA,EACA;AAAA,EACA;AAAA;AAAA,EACA;AAAA,EACA;AAAA;AAAA,EACA;AAAA,EACA;AACF;AAGA,MAAM,eAAuC;AAAA,EAC3C,SAAS;AAAA,EACT,OAAO;AAAA,EACP,WAAW;AAAA,EACX,WAAW;AAAA,EACX,eAAe;AAAA,EACf,eAAe;AAAA,EACf,aAAa;AAAA,EACb,aAAa;AAAA,EACb,YAAY;AAAA,EACZ,UAAU;AAAA,EACV,OAAO;AACT;AAYA,MAAM,mBAAmB;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAQO,MAAM,gBAAgB,CAAC,EAAE,SAAS,MAAoB;AAC3D,QAAM,CAAC,qBAAqB,sBAAsB,IAAI,SAAS,KAAK;AACpE,QAAM,eAAe,gBAAgB;AACrC,QAAM,CAAC,UAAU,WAAW,IAAI,SAAmB,SAAS;AAE5D,QAAM,2BAA2B,YAAY,CAAC,UAAyB;AACrE,QAAI,UAAU,SAAS,MAAM,GAAG,GAAG;AACjC,kBAAY,SAAS;AACrB;AAAA,IACF;AAEA,QAAI,CAAC,MAAM,UAAU,iBAAiB,SAAS,MAAM,GAAG,GAAG;AACzD,kBAAY,UAAU;AAAA,IACxB;AAAA,EACF,GAAG,CAAC,CAAC;AAEL,QAAM,wBAAwB,YAAY,CAAC,UAAsB;AAC/D,YAAQ,aAAa,MAAM,IAAI,GAAG;AAAA,MAChC,KAAK;AAAA,MACL,KAAK;AACH,eAAO,YAAY,OAAO;AAAA,MAC5B,KAAK;AAAA,MACL,KAAK;AAAA,MACL,KAAK;AACH,eAAO,YAAY,SAAS;AAAA,MAC9B;AACE,eAAO;AAAA,IACX;AAAA,EACF,GAAG,CAAC,CAAC;AAEL,YAAU,MAAM;AACd,WAAO,iBAAiB,eAAe,qBAAqB;AAG5D,WAAO,iBAAiB,WAAW,0BAA0B;AAAA,MAC3D,SAAS;AAAA,IACX,CAAC;AACD,WAAO,iBAAiB,SAAS,qBAAqB;AAEtD,WAAO,MAAM;AACX,aAAO,oBAAoB,eAAe,qBAAqB;AAC/D,aAAO,oBAAoB,WAAW,0BAA0B;AAAA,QAC9D,SAAS;AAAA,MACX,CAAC;AACD,aAAO,oBAAoB,SAAS,qBAAqB;AAAA,IAC3D;AAAA,EACF,GAAG,CAAC,0BAA0B,qBAAqB,CAAC;AAEpD,QAAM,aAAa,sBACf;AAAA,IACE,OAAO;AAAA,IACP,UAAU;AAAA,IACV,eAAe;AAAA,EACjB,IACA,EAAE,OAAO,QAAW,UAAU,QAAW,eAAe,MAAM;AAElE,SACE;AAAA,IAAC,aAAa;AAAA,IAAb;AAAA,MACC,OAAO;AAAA,QACL,GAAG,WAAW,cAAc;AAAA,UAC1B;AAAA,UACA;AAAA,UACA;AAAA,QACF,CAAC;AAAA,MACH;AAAA;AAAA,IAEA,oCAAC,SAAK,GAAG,cAAa,QAAS;AAAA,EACjC;AAEJ;AAEA,cAAc,aAAa,IAAI;",
6
+ "names": []
7
7
  }
@@ -1,2 +1,15 @@
1
- import{isFocusable as r}from"./is-focusable.js";const o=t=>{if(!r(t))return!1;try{t.focus({preventScroll:!0})}catch{}return document.activeElement===t};export{o as attemptFocus};
1
+ import { isFocusable } from "./is-focusable.js";
2
+ const attemptFocus = (element) => {
3
+ if (!isFocusable(element)) {
4
+ return false;
5
+ }
6
+ try {
7
+ element.focus({ preventScroll: true });
8
+ } catch (e) {
9
+ }
10
+ return document.activeElement === element;
11
+ };
12
+ export {
13
+ attemptFocus
14
+ };
2
15
  //# sourceMappingURL=attempt-focus.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/core/utils/focus-management/attempt-focus.ts"],
4
4
  "sourcesContent": ["import { isFocusable } from './is-focusable.js';\n\n/**\n * @internal\n *\n * Set Attempt to set focus on the current node.\n * @param element - The node to attempt to focus on.\n * @returns - true if element is focused.\n */\nexport const attemptFocus = (element: HTMLElement) => {\n if (!isFocusable(element)) {\n return false;\n }\n\n try {\n element.focus({ preventScroll: true });\n } catch (e) {\n // continue regardless of error\n }\n\n return document.activeElement === element;\n};\n"],
5
- "mappings": "AAAA,OAAS,eAAAA,MAAmB,oBASrB,MAAMC,EAAgBC,GAAyB,CACpD,GAAI,CAACF,EAAYE,CAAO,EACtB,MAAO,GAGT,GAAI,CACFA,EAAQ,MAAM,CAAE,cAAe,EAAK,CAAC,CACvC,MAAY,CAEZ,CAEA,OAAO,SAAS,gBAAkBA,CACpC",
6
- "names": ["isFocusable", "attemptFocus", "element"]
5
+ "mappings": "AAAA,SAAS,mBAAmB;AASrB,MAAM,eAAe,CAAC,YAAyB;AACpD,MAAI,CAAC,YAAY,OAAO,GAAG;AACzB,WAAO;AAAA,EACT;AAEA,MAAI;AACF,YAAQ,MAAM,EAAE,eAAe,KAAK,CAAC;AAAA,EACvC,SAAS,GAAG;AAAA,EAEZ;AAEA,SAAO,SAAS,kBAAkB;AACpC;",
6
+ "names": []
7
7
  }
@@ -1,2 +1,17 @@
1
- import{attemptFocus as n}from"./attempt-focus.js";const l=t=>{if(!t)return!1;for(let r=0;r<t.children.length;r++){const e=t.children[r];if(n(e)||l(e))return!0}return!1};export{l as focusFirstDescendant};
1
+ import { attemptFocus } from "./attempt-focus.js";
2
+ const focusFirstDescendant = (element) => {
3
+ if (!element) {
4
+ return false;
5
+ }
6
+ for (let i = 0; i < element.children.length; i++) {
7
+ const child = element.children[i];
8
+ if (attemptFocus(child) || focusFirstDescendant(child)) {
9
+ return true;
10
+ }
11
+ }
12
+ return false;
13
+ };
14
+ export {
15
+ focusFirstDescendant
16
+ };
2
17
  //# sourceMappingURL=focus-first-descendant.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/core/utils/focus-management/focus-first-descendant.ts"],
4
4
  "sourcesContent": ["import { attemptFocus } from './attempt-focus.js';\n\n/**\n * @internal\n *\n * Set focus on descendant nodes until the first focusable element is found.\n * @param element - DOM node for which to find the first focusable descendant.\n * @returns true if a focusable element is found and focus is set.\n */\nexport const focusFirstDescendant = (element: HTMLElement | null) => {\n if (!element) {\n return false;\n }\n\n for (let i = 0; i < element.children.length; i++) {\n const child = element.children[i] as HTMLElement;\n if (attemptFocus(child) || focusFirstDescendant(child)) {\n return true;\n }\n }\n\n return false;\n};\n"],
5
- "mappings": "AAAA,OAAS,gBAAAA,MAAoB,qBAStB,MAAMC,EAAwBC,GAAgC,CACnE,GAAI,CAACA,EACH,MAAO,GAGT,QAASC,EAAI,EAAGA,EAAID,EAAQ,SAAS,OAAQC,IAAK,CAChD,MAAMC,EAAQF,EAAQ,SAASC,CAAC,EAChC,GAAIH,EAAaI,CAAK,GAAKH,EAAqBG,CAAK,EACnD,MAAO,EAEX,CAEA,MAAO,EACT",
6
- "names": ["attemptFocus", "focusFirstDescendant", "element", "i", "child"]
5
+ "mappings": "AAAA,SAAS,oBAAoB;AAStB,MAAM,uBAAuB,CAAC,YAAgC;AACnE,MAAI,CAAC,SAAS;AACZ,WAAO;AAAA,EACT;AAEA,WAAS,IAAI,GAAG,IAAI,QAAQ,SAAS,QAAQ,KAAK;AAChD,UAAM,QAAQ,QAAQ,SAAS,CAAC;AAChC,QAAI,aAAa,KAAK,KAAK,qBAAqB,KAAK,GAAG;AACtD,aAAO;AAAA,IACT;AAAA,EACF;AAEA,SAAO;AACT;",
6
+ "names": []
7
7
  }
@@ -1,2 +1,14 @@
1
- import{isFocusable as t}from"./is-focusable.js";function n(r){const e=document.createTreeWalker(r);for(;e.nextNode();)if(t(e.currentNode))return e.currentNode;return null}export{n as getFirstFocusableChild};
1
+ import { isFocusable } from "./is-focusable.js";
2
+ function getFirstFocusableChild(container) {
3
+ const treeWalker = document.createTreeWalker(container);
4
+ while (treeWalker.nextNode()) {
5
+ if (isFocusable(treeWalker.currentNode)) {
6
+ return treeWalker.currentNode;
7
+ }
8
+ }
9
+ return null;
10
+ }
11
+ export {
12
+ getFirstFocusableChild
13
+ };
2
14
  //# sourceMappingURL=get-first-focusable-child.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/core/utils/focus-management/get-first-focusable-child.ts"],
4
4
  "sourcesContent": ["import { isFocusable } from './is-focusable.js';\n\n/**\n * @internal\n *\n * If you need access to the first focusable descendant of a container, you can use\n * `getFirstFocusableChild`. The function uses the\n * https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker to\n * iterate over the children of the container and returns either a `Node` if a\n * focusable element is found, or `null`.\n */\nexport function getFirstFocusableChild(\n container: HTMLElement | Node,\n): Node | null {\n const treeWalker = document.createTreeWalker(container);\n\n // Iterate over all the nodes inside the container and return the current node if it is focusable.\n while (treeWalker.nextNode()) {\n if (isFocusable(treeWalker.currentNode)) {\n return treeWalker.currentNode;\n }\n }\n\n return null;\n}\n"],
5
- "mappings": "AAAA,OAAS,eAAAA,MAAmB,oBAWrB,SAASC,EACdC,EACa,CACb,MAAMC,EAAa,SAAS,iBAAiBD,CAAS,EAGtD,KAAOC,EAAW,SAAS,GACzB,GAAIH,EAAYG,EAAW,WAAW,EACpC,OAAOA,EAAW,YAItB,OAAO,IACT",
6
- "names": ["isFocusable", "getFirstFocusableChild", "container", "treeWalker"]
5
+ "mappings": "AAAA,SAAS,mBAAmB;AAWrB,SAAS,uBACd,WACa;AACb,QAAM,aAAa,SAAS,iBAAiB,SAAS;AAGtD,SAAO,WAAW,SAAS,GAAG;AAC5B,QAAI,YAAY,WAAW,WAAW,GAAG;AACvC,aAAO,WAAW;AAAA,IACpB;AAAA,EACF;AAEA,SAAO;AACT;",
6
+ "names": []
7
7
  }
@@ -1,2 +1,17 @@
1
- import{isFocusable as l}from"./is-focusable.js";function o(r){const e=document.createTreeWalker(r);for(;e.lastChild();)e.lastChild();do if(l(e.currentNode))return e.currentNode;while(e.previousNode());return null}export{o as getLastFocusableChild};
1
+ import { isFocusable } from "./is-focusable.js";
2
+ function getLastFocusableChild(container) {
3
+ const treeWalker = document.createTreeWalker(container);
4
+ while (treeWalker.lastChild()) {
5
+ treeWalker.lastChild();
6
+ }
7
+ do {
8
+ if (isFocusable(treeWalker.currentNode)) {
9
+ return treeWalker.currentNode;
10
+ }
11
+ } while (treeWalker.previousNode());
12
+ return null;
13
+ }
14
+ export {
15
+ getLastFocusableChild
16
+ };
2
17
  //# sourceMappingURL=get-last-focusable-child.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/core/utils/focus-management/get-last-focusable-child.ts"],
4
4
  "sourcesContent": ["import { isFocusable } from './is-focusable.js';\n\n/**\n * @internal\n *\n * If you need access to the last focusable descendant of a container, you can use\n * `getLastFocusableChild`. The function uses the\n * https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker to\n * iterate over the children of the container and returns either a `Node` if a\n * focusable element is found, or `null`.\n */\nexport function getLastFocusableChild(container: HTMLElement): Node | null {\n const treeWalker = document.createTreeWalker(container);\n\n // Move the current node to the last node of the container.\n while (treeWalker.lastChild()) {\n treeWalker.lastChild();\n }\n\n // Iterate backwards over all the nodes inside the container and return the current node if it is focusable.\n do {\n if (isFocusable(treeWalker.currentNode)) {\n return treeWalker.currentNode;\n }\n } while (treeWalker.previousNode());\n\n return null;\n}\n"],
5
- "mappings": "AAAA,OAAS,eAAAA,MAAmB,oBAWrB,SAASC,EAAsBC,EAAqC,CACzE,MAAMC,EAAa,SAAS,iBAAiBD,CAAS,EAGtD,KAAOC,EAAW,UAAU,GAC1BA,EAAW,UAAU,EAIvB,EACE,IAAIH,EAAYG,EAAW,WAAW,EACpC,OAAOA,EAAW,kBAEbA,EAAW,aAAa,GAEjC,OAAO,IACT",
6
- "names": ["isFocusable", "getLastFocusableChild", "container", "treeWalker"]
5
+ "mappings": "AAAA,SAAS,mBAAmB;AAWrB,SAAS,sBAAsB,WAAqC;AACzE,QAAM,aAAa,SAAS,iBAAiB,SAAS;AAGtD,SAAO,WAAW,UAAU,GAAG;AAC7B,eAAW,UAAU;AAAA,EACvB;AAGA,KAAG;AACD,QAAI,YAAY,WAAW,WAAW,GAAG;AACvC,aAAO,WAAW;AAAA,IACpB;AAAA,EACF,SAAS,WAAW,aAAa;AAEjC,SAAO;AACT;",
6
+ "names": []
7
7
  }
@@ -1,2 +1,21 @@
1
- function r(a){if(a.tabIndex<0||a.disabled)return!1;switch(a.nodeName){case"A":return!!a.href;case"INPUT":return a.type!=="hidden";case"BUTTON":case"SELECT":case"TEXTAREA":return!0;default:return a.tabIndex>=0}}export{r as isFocusable};
1
+ function isFocusable(element) {
2
+ if (element.tabIndex < 0 || element.disabled) {
3
+ return false;
4
+ }
5
+ switch (element.nodeName) {
6
+ case "A":
7
+ return !!element.href;
8
+ case "INPUT":
9
+ return element.type !== "hidden";
10
+ case "BUTTON":
11
+ case "SELECT":
12
+ case "TEXTAREA":
13
+ return true;
14
+ default:
15
+ return element.tabIndex >= 0;
16
+ }
17
+ }
18
+ export {
19
+ isFocusable
20
+ };
2
21
  //# sourceMappingURL=is-focusable.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/core/utils/focus-management/is-focusable.ts"],
4
4
  "sourcesContent": ["/**\n * @internal\n *\n * Use the `isFocusable` utility function to check whether an element can receive\n * focus.\n */\nexport function isFocusable(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n element: any,\n) {\n if (element.tabIndex < 0 || element.disabled) {\n return false;\n }\n\n switch (element.nodeName) {\n case 'A':\n return !!element.href;\n case 'INPUT':\n return element.type !== 'hidden';\n case 'BUTTON':\n case 'SELECT':\n case 'TEXTAREA':\n return true;\n default:\n return element.tabIndex >= 0;\n }\n}\n"],
5
- "mappings": "AAMO,SAASA,EAEdC,EACA,CACA,GAAIA,EAAQ,SAAW,GAAKA,EAAQ,SAClC,MAAO,GAGT,OAAQA,EAAQ,SAAU,CACxB,IAAK,IACH,MAAO,CAAC,CAACA,EAAQ,KACnB,IAAK,QACH,OAAOA,EAAQ,OAAS,SAC1B,IAAK,SACL,IAAK,SACL,IAAK,WACH,MAAO,GACT,QACE,OAAOA,EAAQ,UAAY,CAC/B,CACF",
6
- "names": ["isFocusable", "element"]
5
+ "mappings": "AAMO,SAAS,YAEd,SACA;AACA,MAAI,QAAQ,WAAW,KAAK,QAAQ,UAAU;AAC5C,WAAO;AAAA,EACT;AAEA,UAAQ,QAAQ,UAAU;AAAA,IACxB,KAAK;AACH,aAAO,CAAC,CAAC,QAAQ;AAAA,IACnB,KAAK;AACH,aAAO,QAAQ,SAAS;AAAA,IAC1B,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AACH,aAAO;AAAA,IACT;AACE,aAAO,QAAQ,YAAY;AAAA,EAC/B;AACF;",
6
+ "names": []
7
7
  }
@@ -1,2 +1,7 @@
1
- const e=!!(typeof window<"u"&&window.document&&window.document.createElement);export{e as isBrowser};
1
+ const isBrowser = (() => {
2
+ return !!(typeof window !== "undefined" && window.document && window.document.createElement);
3
+ })();
4
+ export {
5
+ isBrowser
6
+ };
2
7
  //# sourceMappingURL=isBrowser.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/core/utils/isBrowser.ts"],
4
4
  "sourcesContent": ["/**\n * @internal\n *\n * Whether the code is currently executed in a browser\n * @see https://github.com/chakra-ui/chakra-ui/blob/main/packages/utils/src/dom.ts\n */\nexport const isBrowser = (() => {\n return !!(\n typeof window !== 'undefined' &&\n window.document &&\n window.document.createElement\n );\n})();\n"],
5
- "mappings": "AAMO,MAAMA,EACJ,CAAC,EACN,OAAO,OAAW,KAClB,OAAO,UACP,OAAO,SAAS",
6
- "names": ["isBrowser"]
5
+ "mappings": "AAMO,MAAM,aAAa,MAAM;AAC9B,SAAO,CAAC,EACN,OAAO,WAAW,eAClB,OAAO,YACP,OAAO,SAAS;AAEpB,GAAG;",
6
+ "names": []
7
7
  }
@@ -1,2 +1,32 @@
1
- function c(...t){return(...n)=>{for(const o of t)typeof o=="function"&&o(...n)}}function T(...t){const n={...t[0]};for(let o=1;o<t.length;o++){const s=t[o];for(const e in s){const r=n[e],i=s[e];typeof r=="function"&&typeof i=="function"&&e[0]==="o"&&e[1]==="n"&&e.charCodeAt(2)>=65&&e.charCodeAt(2)<=90?n[e]=c(r,i):n[e]=i!==void 0?i:r}}return n}export{T as mergeProps};
1
+ function chain(...callbacks) {
2
+ return (...args) => {
3
+ for (const callback of callbacks) {
4
+ if (typeof callback === "function") {
5
+ callback(...args);
6
+ }
7
+ }
8
+ };
9
+ }
10
+ function mergeProps(...args) {
11
+ const result = { ...args[0] };
12
+ for (let i = 1; i < args.length; i++) {
13
+ const props = args[i];
14
+ for (const key in props) {
15
+ const a = result[key];
16
+ const b = props[key];
17
+ if (typeof a === "function" && typeof b === "function" && // This is a lot faster than a regex.
18
+ key[0] === "o" && key[1] === "n" && key.charCodeAt(2) >= /* 'A' */
19
+ 65 && key.charCodeAt(2) <= /* 'Z' */
20
+ 90) {
21
+ result[key] = chain(a, b);
22
+ } else {
23
+ result[key] = b !== void 0 ? b : a;
24
+ }
25
+ }
26
+ }
27
+ return result;
28
+ }
29
+ export {
30
+ mergeProps
31
+ };
2
32
  //# sourceMappingURL=merge-props.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/core/utils/merge-props.ts"],
4
4
  "sourcesContent": ["/* eslint-disable @typescript-eslint/no-explicit-any */\n\n/**\n * Calls all functions in the order they were chained with the same arguments.\n */\nfunction chain(...callbacks: any[]): (...args: any[]) => void {\n return (...args: any[]) => {\n for (const callback of callbacks) {\n if (typeof callback === 'function') {\n callback(...args);\n }\n }\n };\n}\n\n// taken from: https://stackoverflow.com/questions/51603250/typescript-3-parameter-list-intersection-type/51604379#51604379\n/**\n * @internal\n * Internal helper mapper type for mergeProps\n */\nexport type TupleTypes<T> = { [P in keyof T]: T[P] } extends {\n [key: number]: infer V;\n}\n ? NullToObject<V>\n : never;\n\n/**\n * @internal\n * Internal helper mapper type for mergeProps\n */\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport type NullToObject<T> = T extends null | undefined ? {} : T;\n\n/**\n * @internal\n * Internal helper mapper type for mergeProps\n */\n// eslint-disable-next-line no-undef, @typescript-eslint/no-unused-vars\nexport type UnionToIntersection<U> = (\n U extends any ? (k: U) => void : never\n) extends (k: infer I) => void\n ? I\n : never;\n\n/**\n * @internal\n *\n * Merges multiple props objects together. Event handlers are chained,\n * classNames are combined, and ids are deduplicated - different ids\n * will trigger a side-effect and re-render components hooked up with `useId`.\n * For all other props, the last prop object overrides all previous ones.\n * @param args - Multiple sets of props to merge together.\n */\nexport function mergeProps<\n T extends (\n | {\n [key: string]: any;\n }\n | null\n | undefined\n )[],\n>(...args: T): UnionToIntersection<TupleTypes<T>> {\n // Start with a base clone of the first argument. This is a lot faster than starting\n // with an empty object and adding properties as we go.\n const result = { ...args[0] };\n for (let i = 1; i < args.length; i++) {\n const props = args[i];\n for (const key in props) {\n const a = result[key];\n const b = props[key];\n\n // Chain events\n if (\n typeof a === 'function' &&\n typeof b === 'function' &&\n // This is a lot faster than a regex.\n key[0] === 'o' &&\n key[1] === 'n' &&\n key.charCodeAt(2) >= /* 'A' */ 65 &&\n key.charCodeAt(2) <= /* 'Z' */ 90\n ) {\n result[key] = chain(a, b);\n } else {\n result[key] = b !== undefined ? b : a;\n }\n }\n }\n\n return result as UnionToIntersection<TupleTypes<T>>;\n}\n"],
5
- "mappings": "AAKA,SAASA,KAASC,EAA4C,CAC5D,MAAO,IAAIC,IAAgB,CACzB,UAAWC,KAAYF,EACjB,OAAOE,GAAa,YACtBA,EAAS,GAAGD,CAAI,CAGtB,CACF,CAwCO,SAASE,KAQXF,EAA6C,CAGhD,MAAMG,EAAS,CAAE,GAAGH,EAAK,CAAC,CAAE,EAC5B,QAASI,EAAI,EAAGA,EAAIJ,EAAK,OAAQI,IAAK,CACpC,MAAMC,EAAQL,EAAKI,CAAC,EACpB,UAAWE,KAAOD,EAAO,CACvB,MAAME,EAAIJ,EAAOG,CAAG,EACdE,EAAIH,EAAMC,CAAG,EAIjB,OAAOC,GAAM,YACb,OAAOC,GAAM,YAEbF,EAAI,CAAC,IAAM,KACXA,EAAI,CAAC,IAAM,KACXA,EAAI,WAAW,CAAC,GAAe,IAC/BA,EAAI,WAAW,CAAC,GAAe,GAE/BH,EAAOG,CAAG,EAAIR,EAAMS,EAAGC,CAAC,EAExBL,EAAOG,CAAG,EAAIE,IAAM,OAAYA,EAAID,CAExC,CACF,CAEA,OAAOJ,CACT",
6
- "names": ["chain", "callbacks", "args", "callback", "mergeProps", "result", "i", "props", "key", "a", "b"]
5
+ "mappings": "AAKA,SAAS,SAAS,WAA4C;AAC5D,SAAO,IAAI,SAAgB;AACzB,eAAW,YAAY,WAAW;AAChC,UAAI,OAAO,aAAa,YAAY;AAClC,iBAAS,GAAG,IAAI;AAAA,MAClB;AAAA,IACF;AAAA,EACF;AACF;AAwCO,SAAS,cAQX,MAA6C;AAGhD,QAAM,SAAS,EAAE,GAAG,KAAK,CAAC,EAAE;AAC5B,WAAS,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK;AACpC,UAAM,QAAQ,KAAK,CAAC;AACpB,eAAW,OAAO,OAAO;AACvB,YAAM,IAAI,OAAO,GAAG;AACpB,YAAM,IAAI,MAAM,GAAG;AAGnB,UACE,OAAO,MAAM,cACb,OAAO,MAAM;AAAA,MAEb,IAAI,CAAC,MAAM,OACX,IAAI,CAAC,MAAM,OACX,IAAI,WAAW,CAAC;AAAA,MAAe,MAC/B,IAAI,WAAW,CAAC;AAAA,MAAe,IAC/B;AACA,eAAO,GAAG,IAAI,MAAM,GAAG,CAAC;AAAA,MAC1B,OAAO;AACL,eAAO,GAAG,IAAI,MAAM,SAAY,IAAI;AAAA,MACtC;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;",
6
+ "names": []
7
7
  }
package/esm/index.js CHANGED
@@ -1,2 +1,2 @@
1
- export*from"./core/index.js";
1
+ export * from "./core/index.js";
2
2
  //# sourceMappingURL=index.js.map
package/esm/index.js.map CHANGED
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/index.ts"],
4
4
  "sourcesContent": ["export * from './core/index.js';\n"],
5
- "mappings": "AAAA,WAAc",
5
+ "mappings": "AAAA,cAAc;",
6
6
  "names": []
7
7
  }
package/index.js CHANGED
@@ -1 +1,17 @@
1
- var a=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var p=(r,o,f,x)=>{if(o&&typeof o=="object"||typeof o=="function")for(let e of c(o))!d.call(r,e)&&e!==f&&a(r,e,{get:()=>o[e],enumerable:!(x=b(o,e))||x.enumerable});return r},t=(r,o,f)=>(p(r,o,"default"),f&&p(f,o,"default"));var g=r=>p(a({},"__esModule",{value:!0}),r);var m={};module.exports=g(m);t(m,require("./core/index.js"),module.exports);
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from))
8
+ if (!__hasOwnProp.call(to, key) && key !== except)
9
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
+ }
11
+ return to;
12
+ };
13
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+ var src_exports = {};
16
+ module.exports = __toCommonJS(src_exports);
17
+ __reExport(src_exports, require("./core/index.js"), module.exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynatrace/strato-components",
3
- "version": "0.84.12",
3
+ "version": "0.84.21",
4
4
  "private": false,
5
5
  "license": "Apache-2.0",
6
6
  "lang": "lang/uncompiled",
@@ -1 +1,62 @@
1
- var h=Object.create;var s=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var R=Object.getOwnPropertyNames;var W=Object.getPrototypeOf,f=Object.prototype.hasOwnProperty;var v=(r,e)=>{for(var n in e)s(r,n,{get:e[n],enumerable:!0})},l=(r,e,n,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of R(e))!f.call(r,t)&&t!==n&&s(r,t,{get:()=>e[t],enumerable:!(i=c(e,t))||i.enumerable});return r},d=(r,e,n)=>(l(r,e,"default"),n&&l(n,e,"default")),C=(r,e,n)=>(n=r!=null?h(W(r)):{},l(e||!r||!r.__esModule?s(n,"default",{value:r,enumerable:!0}):n,r)),O=r=>l(s({},"__esModule",{value:!0}),r);var p={};v(p,{customRender:()=>a,render:()=>a});module.exports=O(p);var m=require("@testing-library/react"),o=C(require("react")),P=require("react-intl");d(p,require("@testing-library/react"),module.exports);const g=({children:r,locale:e="en",timeZone:n="UTC"})=>o.default.createElement(P.IntlProvider,{locale:e,timeZone:n},r),A=r=>o.default.createElement(o.default.Fragment,null,r.children),a=(r,{locale:e="en",timeZone:n="UTC",wrapper:i=A,...t}={})=>(0,m.render)(r,{wrapper:({children:u})=>o.default.createElement(g,{locale:e,timeZone:n},o.default.createElement(i,null,u)),...t});
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var custom_render_exports = {};
30
+ __export(custom_render_exports, {
31
+ customRender: () => customRender,
32
+ render: () => customRender
33
+ });
34
+ module.exports = __toCommonJS(custom_render_exports);
35
+ var import_react = require("@testing-library/react");
36
+ var import_react2 = __toESM(require("react"));
37
+ var import_react_intl = require("react-intl");
38
+ __reExport(custom_render_exports, require("@testing-library/react"), module.exports);
39
+ const AllProviders = ({
40
+ children,
41
+ locale = "en",
42
+ timeZone = "UTC"
43
+ }) => {
44
+ return /* @__PURE__ */ import_react2.default.createElement(import_react_intl.IntlProvider, { locale, timeZone }, children);
45
+ };
46
+ const DefaultWrapper = (props) => (
47
+ // eslint-disable-next-line react/jsx-no-useless-fragment
48
+ /* @__PURE__ */ import_react2.default.createElement(import_react2.default.Fragment, null, props.children)
49
+ );
50
+ const customRender = (ui, {
51
+ locale = "en",
52
+ timeZone = "UTC",
53
+ wrapper: CustomWrapper = DefaultWrapper,
54
+ ...renderOptions
55
+ } = {}) => {
56
+ return (0, import_react.render)(ui, {
57
+ wrapper: ({ children }) => {
58
+ return /* @__PURE__ */ import_react2.default.createElement(AllProviders, { locale, timeZone }, /* @__PURE__ */ import_react2.default.createElement(CustomWrapper, null, children));
59
+ },
60
+ ...renderOptions
61
+ });
62
+ };