@telia-ace/widget-components-tab-stop 1.0.22 → 1.0.23-next.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.
package/dist/index.js
CHANGED
|
@@ -40,11 +40,14 @@ const j = (n) => {
|
|
|
40
40
|
return r.current && c && r.current.addEventListener("focus", l), () => {
|
|
41
41
|
r.current && r.current.removeEventListener("focus", l);
|
|
42
42
|
};
|
|
43
|
-
}, []), /* @__PURE__ */ L.createElement(
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
43
|
+
}, []), /* @__PURE__ */ L.createElement(
|
|
44
|
+
N,
|
|
45
|
+
w(y({}, t), {
|
|
46
|
+
tabIndex: 0,
|
|
47
|
+
ref: r,
|
|
48
|
+
className: H(e, "humany-tab-stop")
|
|
49
|
+
})
|
|
50
|
+
);
|
|
48
51
|
}, N = C.div`
|
|
49
52
|
opacity: 0;
|
|
50
53
|
position: absolute;
|
|
@@ -52,4 +55,4 @@ const j = (n) => {
|
|
|
52
55
|
export {
|
|
53
56
|
j as default
|
|
54
57
|
};
|
|
55
|
-
//# sourceMappingURL=tab-stop.
|
|
58
|
+
//# sourceMappingURL=tab-stop.2e3d0a3b.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tab-stop.
|
|
1
|
+
{"version":3,"file":"tab-stop.2e3d0a3b.js","sources":["../src/tab-stop.tsx"],"sourcesContent":["import styled from '@emotion/styled';\nimport { useContainer, useProperties } from '@telia-ace/widget-ui';\nimport { appendClassNames } from '@telia-ace/widget-utilities';\nimport React, { useEffect, useRef } from 'react';\nimport { TabStopComponentProps } from './tab-stop-component';\n\ntype Props = {\n className: string;\n};\n\nconst TabStop: React.FC<Props> = ({ className, ...other }) => {\n const node = useRef() as React.MutableRefObject<HTMLDivElement>;\n const container = useContainer();\n const { position = 'end' } = useProperties<TabStopComponentProps>();\n const positionRef = useRef(position) as React.MutableRefObject<'start' | 'end'>;\n\n useEffect(() => {\n positionRef.current = position;\n }, [position]);\n\n const focusHandler = () => {\n const [widgetDOMElement] = container.get('widgetDOMElements') as HTMLElement[];\n\n const focusable = widgetDOMElement.querySelectorAll(\n 'button, [href], input, select, textarea, [tabindex]:not([tabindex=\"-1\"]):not(.humany-tab-stop):not([tabindex=\"\"])'\n );\n\n // ensure that elements is visible\n const filtered = [].filter.call(focusable, (el: HTMLElement) => {\n if (typeof window === 'undefined') {\n return true;\n }\n\n const style = window.getComputedStyle(el);\n if (style.display === 'none' || (el.offsetWidth <= 0 && el.offsetHeight <= 0)) {\n return false;\n }\n return true;\n }) as HTMLElement[];\n\n const target = positionRef.current === 'end' ? filtered[0] : filtered[filtered.length - 1];\n\n if (target) {\n target.focus();\n }\n };\n\n useEffect(() => {\n const [widgetDOMElement] = container.get('widgetDOMElements');\n\n if (node.current && widgetDOMElement) {\n node.current.addEventListener('focus', focusHandler);\n }\n\n return () => {\n if (node.current) {\n node.current.removeEventListener('focus', focusHandler);\n }\n };\n }, []);\n\n return (\n <Wrapper\n {...other}\n tabIndex={0}\n ref={node}\n className={appendClassNames(className, 'humany-tab-stop')}\n />\n );\n};\n\nexport default TabStop;\n\nconst Wrapper = styled.div`\n opacity: 0;\n position: absolute;\n`;\n"],"names":["TabStop","_a","_b","className","other","__objRest","node","useRef","container","useContainer","position","useProperties","positionRef","useEffect","focusHandler","widgetDOMElement","focusable","filtered","el","target","React","Wrapper","__spreadProps","__spreadValues","appendClassNames","styled"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAUA,MAAMA,IAA2B,CAACC,MAA4B;AAA5B,MAAAC,IAAAD,GAAE,aAAAE,MAAFD,GAAgBE,IAAAC,EAAhBH,GAAgB,CAAd;AAChC,QAAMI,IAAOC,KACPC,IAAYC,KACZ,EAAE,UAAAC,IAAW,MAAM,IAAIC,EAAqC,GAC5DC,IAAcL,EAAOG,CAAQ;AAEnC,EAAAG,EAAU,MAAM;AACZ,IAAAD,EAAY,UAAUF;AAAA,EAAA,GACvB,CAACA,CAAQ,CAAC;AAEb,QAAMI,IAAe,MAAM;AACvB,UAAM,CAACC,CAAgB,IAAIP,EAAU,IAAI,mBAAmB,GAEtDQ,IAAYD,EAAiB;AAAA,MAC/B;AAAA,IAAA,GAIEE,IAAW,CAAA,EAAG,OAAO,KAAKD,GAAW,CAACE,MACpC,OAAO,UAAW,cACX,KAIP,EADU,OAAO,iBAAiBA,CAAE,EAC9B,YAAY,UAAWA,EAAG,eAAe,KAAKA,EAAG,gBAAgB,EAI9E,GAEKC,IAASP,EAAY,YAAY,QAAQK,EAAS,KAAKA,EAASA,EAAS,SAAS;AAExF,IAAIE,KACAA,EAAO,MAAM;AAAA,EACjB;AAGJ,SAAAN,EAAU,MAAM;AACZ,UAAM,CAACE,CAAgB,IAAIP,EAAU,IAAI,mBAAmB;AAExD,WAAAF,EAAK,WAAWS,KACXT,EAAA,QAAQ,iBAAiB,SAASQ,CAAY,GAGhD,MAAM;AACT,MAAIR,EAAK,WACAA,EAAA,QAAQ,oBAAoB,SAASQ,CAAY;AAAA,IAC1D;AAAA,EAER,GAAG,CAAE,CAAA,GAGD,gBAAAM,EAAA;AAAA,IAACC;AAAA,IAAAC,EAAAC,EAAA,IACOnB,IADP;AAAA,MAEG,UAAU;AAAA,MACV,KAAKE;AAAA,MACL,WAAWkB,EAAiBrB,GAAW,iBAAiB;AAAA,IAAA;AAAA,EAAA;AAGpE,GAIMkB,IAAUI,EAAO;AAAA;AAAA;AAAA;"}
|
package/dist/tab-stop.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@telia-ace/widget-components-tab-stop",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.23-next.0",
|
|
4
4
|
"description": "Tab stop component for ACE Widgets.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"author": "Telia Company AB",
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
},
|
|
22
22
|
"sideEffects": false,
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@telia-ace/widget-ui": "^1.0.
|
|
25
|
-
"@telia-ace/widget-utilities": "^1.0.
|
|
24
|
+
"@telia-ace/widget-ui": "^1.0.27-next.0",
|
|
25
|
+
"@telia-ace/widget-utilities": "^1.0.9-next.0",
|
|
26
26
|
"@webprovisions/platform": "^1.1.2"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
@@ -34,9 +34,9 @@
|
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@emotion/react": "^11.10.5",
|
|
36
36
|
"@emotion/styled": "^11.10.5",
|
|
37
|
-
"@telia-ace/widget-developer-tools": "^1.0.
|
|
38
|
-
"@types/react": "^18.0.
|
|
39
|
-
"@types/react-dom": "^18.0.
|
|
37
|
+
"@telia-ace/widget-developer-tools": "^1.0.15-next.0",
|
|
38
|
+
"@types/react": "^18.0.26",
|
|
39
|
+
"@types/react-dom": "^18.0.9",
|
|
40
40
|
"react": "^18.2.0",
|
|
41
41
|
"react-dom": "^18.2.0"
|
|
42
42
|
},
|