@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
@@ -1,5 +1,5 @@
1
1
  import { createReactComponent as o } from "@telia-ace/widget-ui";
2
- const e = (t) => o(t, "tab-stop", import("./tab-stop.da894e36.js")), p = e;
2
+ const e = (t) => o(t, "tab-stop", import("./tab-stop.2e3d0a3b.js")), p = e;
3
3
  export {
4
4
  p as default
5
5
  };
@@ -1,5 +1,5 @@
1
1
  import { Container } from '@webprovisions/platform';
2
- export declare type TabStopComponentProps = {
2
+ export type TabStopComponentProps = {
3
3
  position: 'start' | 'end';
4
4
  };
5
5
  declare const TabStopComponent: (container: Container) => Promise<void>;
@@ -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(N, w(y({}, t), {
44
- tabIndex: 0,
45
- ref: r,
46
- className: H(e, "humany-tab-stop")
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.da894e36.js.map
58
+ //# sourceMappingURL=tab-stop.2e3d0a3b.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"tab-stop.da894e36.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,GAGA,gBAAAM,EAAA,cAAAC,GAAAC,EAAAC,EAAA,IACOnB,IADP;AAAA,IAEG,UAAU;AAAA,IACV,KAAKE;AAAA,IACL,WAAWkB,EAAiBrB,GAAW,iBAAiB;AAAA,EAAA,EAC5D;AAER,GAIMkB,IAAUI,EAAO;AAAA;AAAA;AAAA;"}
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,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 type Props = {
3
3
  className: string;
4
4
  };
5
5
  declare const TabStop: React.FC<Props>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@telia-ace/widget-components-tab-stop",
3
- "version": "1.0.22",
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.26",
25
- "@telia-ace/widget-utilities": "^1.0.8",
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.14",
38
- "@types/react": "^18.0.25",
39
- "@types/react-dom": "^18.0.8",
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
  },