@telia-ace/widget-components-tab-stop 1.0.16 → 1.0.18

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 p = (t) => o(t, "tab-stop", import("./tab-stop.403c4dee.js"));
2
+ const p = (t) => o(t, "tab-stop", import("./tab-stop.546b8dc2.js"));
3
3
  export {
4
4
  p as default
5
5
  };
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/tab-stop-component.ts"],"sourcesContent":["import { createReactComponent } from '@telia-ace/widget-ui';\r\nimport { Container } from '@webprovisions/platform';\r\n\r\nexport type TabStopComponentProps = {\r\n position: 'start' | 'end';\r\n};\r\n\r\nconst TabStopComponent = (container: Container) => {\r\n return createReactComponent(container, 'tab-stop', import('./tab-stop'));\r\n};\r\n\r\nexport default TabStopComponent;\r\n"],"names":[],"mappings":";AAOM,MAAA,IAAmB,CAAC,MACf,EAAqB,GAAW,YAAY,OAAO,yBAAa;"}
1
+ {"version":3,"file":"index.js","sources":["../src/tab-stop-component.ts"],"sourcesContent":["import { createReactComponent } from '@telia-ace/widget-ui';\r\nimport { Container } from '@webprovisions/platform';\r\n\r\nexport type TabStopComponentProps = {\r\n position: 'start' | 'end';\r\n};\r\n\r\nconst TabStopComponent = (container: Container) => {\r\n return createReactComponent(container, 'tab-stop', import('./tab-stop'));\r\n};\r\n\r\nexport default TabStopComponent;\r\n"],"names":["TabStopComponent","container","createReactComponent"],"mappings":";AAOM,MAAAA,IAAmB,CAACC,MACfC,EAAqBD,GAAW,YAAY,OAAO,yBAAa;"}
@@ -1,22 +1,22 @@
1
1
  var D = Object.defineProperty, M = Object.defineProperties;
2
2
  var O = Object.getOwnPropertyDescriptors;
3
3
  var s = Object.getOwnPropertySymbols;
4
- var g = Object.prototype.hasOwnProperty, y = Object.prototype.propertyIsEnumerable;
5
- var m = (e, t, n) => t in e ? D(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, b = (e, t) => {
4
+ var b = Object.prototype.hasOwnProperty, g = Object.prototype.propertyIsEnumerable;
5
+ var m = (e, t, n) => t in e ? D(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, y = (e, t) => {
6
6
  for (var n in t || (t = {}))
7
- g.call(t, n) && m(e, n, t[n]);
7
+ b.call(t, n) && m(e, n, t[n]);
8
8
  if (s)
9
9
  for (var n of s(t))
10
- y.call(t, n) && m(e, n, t[n]);
10
+ g.call(t, n) && m(e, n, t[n]);
11
11
  return e;
12
12
  }, w = (e, t) => M(e, O(t));
13
13
  var E = (e, t) => {
14
14
  var n = {};
15
15
  for (var o in e)
16
- g.call(e, o) && t.indexOf(o) < 0 && (n[o] = e[o]);
16
+ b.call(e, o) && t.indexOf(o) < 0 && (n[o] = e[o]);
17
17
  if (e != null && s)
18
18
  for (var o of s(e))
19
- t.indexOf(o) < 0 && y.call(e, o) && (n[o] = e[o]);
19
+ t.indexOf(o) < 0 && g.call(e, o) && (n[o] = e[o]);
20
20
  return n;
21
21
  };
22
22
  import { useContainer as C, useProperties as R } from "@telia-ace/widget-ui";
@@ -30,7 +30,9 @@ const j = (n) => {
30
30
  d.current = i;
31
31
  }, [i]);
32
32
  const l = () => {
33
- const [c] = f.get("widgetDOMElements"), v = c.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"]):not(.humany-tab-stop)'), a = [].filter.call(v, (u) => typeof window == "undefined" ? !0 : !(window.getComputedStyle(u).display === "none" || u.offsetWidth <= 0 && u.offsetHeight <= 0)), p = d.current === "end" ? a[0] : a[a.length - 1];
33
+ const [c] = f.get("widgetDOMElements"), v = c.querySelectorAll(
34
+ 'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"]):not(.humany-tab-stop):not([tabindex=""])'
35
+ ), a = [].filter.call(v, (u) => typeof window == "undefined" ? !0 : !(window.getComputedStyle(u).display === "none" || u.offsetWidth <= 0 && u.offsetHeight <= 0)), p = d.current === "end" ? a[0] : a[a.length - 1];
34
36
  p && p.focus();
35
37
  };
36
38
  return x(() => {
@@ -38,7 +40,7 @@ const j = (n) => {
38
40
  return r.current && c && r.current.addEventListener("focus", l), () => {
39
41
  r.current && r.current.removeEventListener("focus", l);
40
42
  };
41
- }, []), /* @__PURE__ */ H.createElement(N, w(b({}, t), {
43
+ }, []), /* @__PURE__ */ H.createElement(N, w(y({}, t), {
42
44
  tabIndex: 0,
43
45
  ref: r,
44
46
  className: S(e, "humany-tab-stop")
@@ -50,4 +52,4 @@ const j = (n) => {
50
52
  export {
51
53
  j as default
52
54
  };
53
- //# sourceMappingURL=tab-stop.403c4dee.js.map
55
+ //# sourceMappingURL=tab-stop.546b8dc2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tab-stop.546b8dc2.js","sources":["../src/tab-stop.tsx"],"sourcesContent":["import { useContainer, useProperties } from '@telia-ace/widget-ui';\r\nimport { appendClassNames } from '@telia-ace/widget-utilities';\r\nimport React, { useEffect, useRef } from 'react';\r\nimport styled from 'styled-components';\r\nimport { TabStopComponentProps } from './tab-stop-component';\r\n\r\ntype Props = {\r\n className: string;\r\n};\r\n\r\nconst TabStop: React.SFC<Props> = ({ className, ...other }) => {\r\n const node = useRef() as React.MutableRefObject<HTMLDivElement>;\r\n const container = useContainer();\r\n const { position = 'end' } = useProperties<TabStopComponentProps>();\r\n const positionRef = useRef(position) as React.MutableRefObject<'start' | 'end'>;\r\n\r\n useEffect(() => {\r\n positionRef.current = position;\r\n }, [position]);\r\n\r\n const focusHandler = () => {\r\n const [widgetDOMElement] = container.get('widgetDOMElements') as HTMLElement[];\r\n\r\n const focusable = widgetDOMElement.querySelectorAll(\r\n 'button, [href], input, select, textarea, [tabindex]:not([tabindex=\"-1\"]):not(.humany-tab-stop):not([tabindex=\"\"])'\r\n );\r\n\r\n // ensure that elements is visible\r\n const filtered = [].filter.call(focusable, (el: HTMLElement) => {\r\n if (typeof window === 'undefined') {\r\n return true;\r\n }\r\n\r\n const style = window.getComputedStyle(el);\r\n if (style.display === 'none' || (el.offsetWidth <= 0 && el.offsetHeight <= 0)) {\r\n return false;\r\n }\r\n return true;\r\n }) as HTMLElement[];\r\n\r\n const target = positionRef.current === 'end' ? filtered[0] : filtered[filtered.length - 1];\r\n\r\n if (target) {\r\n target.focus();\r\n }\r\n };\r\n\r\n useEffect(() => {\r\n const [widgetDOMElement] = container.get('widgetDOMElements');\r\n\r\n if (node.current && widgetDOMElement) {\r\n node.current.addEventListener('focus', focusHandler);\r\n }\r\n\r\n return () => {\r\n if (node.current) {\r\n node.current.removeEventListener('focus', focusHandler);\r\n }\r\n };\r\n }, []);\r\n\r\n return (\r\n <Wrapper\r\n {...other}\r\n tabIndex={0}\r\n ref={node}\r\n className={appendClassNames(className, 'humany-tab-stop')}\r\n />\r\n );\r\n};\r\n\r\nexport default TabStop;\r\n\r\nconst Wrapper = styled.div`\r\n opacity: 0;\r\n position: absolute;\r\n`;\r\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,IAA4B,CAACC,MAA4B;AAA5B,MAAAC,IAAAD,GAAE,aAAAE,MAAFD,GAAgBE,IAAAC,EAAhBH,GAAgB,CAAd;AACjC,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;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@telia-ace/widget-components-tab-stop",
3
- "version": "1.0.16",
3
+ "version": "1.0.18",
4
4
  "description": "Tab stop component for ACE Widgets.",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "author": "Telia Company AB",
@@ -8,6 +8,7 @@
8
8
  "telia"
9
9
  ],
10
10
  "main": "dist/index.js",
11
+ "sourceMain": "src/index.ts",
11
12
  "type": "module",
12
13
  "types": "dist/index.d.ts",
13
14
  "files": [
@@ -25,8 +26,8 @@
25
26
  },
26
27
  "sideEffects": false,
27
28
  "dependencies": {
28
- "@telia-ace/widget-ui": "^1.0.20",
29
- "@telia-ace/widget-utilities": "^1.0.2",
29
+ "@telia-ace/widget-ui": "^1.0.22",
30
+ "@telia-ace/widget-utilities": "^1.0.4",
30
31
  "@webprovisions/platform": "^1.1.2"
31
32
  },
32
33
  "peerDependencies": {
@@ -39,5 +40,5 @@
39
40
  "@types/react-dom": "^16.8.0",
40
41
  "@types/styled-components": "^5.1.7"
41
42
  },
42
- "gitHead": "3884b26fc8ea8cafc93d37709cceb66742671918"
43
+ "gitHead": "c3045eebac4251ae8ba27333abd9b6aa3ccd5b38"
43
44
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"tab-stop.403c4dee.js","sources":["../src/tab-stop.tsx"],"sourcesContent":["import { useContainer, useProperties } from '@telia-ace/widget-ui';\r\nimport { appendClassNames } from '@telia-ace/widget-utilities';\r\nimport React, { useEffect, useRef } from 'react';\r\nimport styled from 'styled-components';\r\nimport { TabStopComponentProps } from './tab-stop-component';\r\n\r\ntype Props = {\r\n className: string;\r\n};\r\n\r\nconst TabStop: React.SFC<Props> = ({ className, ...other }) => {\r\n const node = useRef() as React.MutableRefObject<HTMLDivElement>;\r\n const container = useContainer();\r\n const { position = 'end' } = useProperties<TabStopComponentProps>();\r\n const positionRef = useRef(position) as React.MutableRefObject<'start' | 'end'>;\r\n\r\n useEffect(() => {\r\n positionRef.current = position;\r\n }, [position]);\r\n\r\n const focusHandler = () => {\r\n const [widgetDOMElement] = container.get('widgetDOMElements') as HTMLElement[];\r\n\r\n const focusable = widgetDOMElement.querySelectorAll(\r\n 'button, [href], input, select, textarea, [tabindex]:not([tabindex=\"-1\"]):not(.humany-tab-stop)'\r\n );\r\n\r\n // ensure that elements is visible\r\n const filtered = [].filter.call(focusable, (el: HTMLElement) => {\r\n if (typeof window === 'undefined') {\r\n return true;\r\n }\r\n\r\n const style = window.getComputedStyle(el);\r\n if (style.display === 'none' || (el.offsetWidth <= 0 && el.offsetHeight <= 0)) {\r\n return false;\r\n }\r\n return true;\r\n }) as HTMLElement[];\r\n\r\n const target = positionRef.current === 'end' ? filtered[0] : filtered[filtered.length - 1];\r\n\r\n if (target) {\r\n target.focus();\r\n }\r\n };\r\n\r\n useEffect(() => {\r\n const [widgetDOMElement] = container.get('widgetDOMElements');\r\n\r\n if (node.current && widgetDOMElement) {\r\n node.current.addEventListener('focus', focusHandler);\r\n }\r\n\r\n return () => {\r\n if (node.current) {\r\n node.current.removeEventListener('focus', focusHandler);\r\n }\r\n };\r\n }, []);\r\n\r\n return (\r\n <Wrapper\r\n {...other}\r\n tabIndex={0}\r\n ref={node}\r\n className={appendClassNames(className, 'humany-tab-stop')}\r\n />\r\n );\r\n};\r\n\r\nexport default TabStop;\r\n\r\nconst Wrapper = styled.div`\r\n opacity: 0;\r\n position: absolute;\r\n`;\r\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAUA,MAAM,IAA4B,CAAC,MAA4B;AAA5B,aAAE,mBAAF,GAAgB,MAAhB,GAAgB,CAAd;AACjC,QAAM,IAAO,KACP,IAAY,KACZ,EAAE,cAAW,UAAU,EAAqC,GAC5D,IAAc,EAAO,CAAQ;AAEnC,IAAU,MAAM;AACZ,MAAY,UAAU;AAAA,EAAA,GACvB,CAAC,CAAQ,CAAC;AAEb,QAAM,IAAe,MAAM;AACvB,UAAM,CAAC,KAAoB,EAAU,IAAI,mBAAmB,GAEtD,IAAY,EAAiB,iBAC/B,gGACJ,GAGM,IAAW,CAAA,EAAG,OAAO,KAAK,GAAW,CAAC,MACpC,OAAO,UAAW,cACX,KAIP,EADU,OAAO,iBAAiB,CAAE,EAC9B,YAAY,UAAW,EAAG,eAAe,KAAK,EAAG,gBAAgB,EAI9E,GAEK,IAAS,EAAY,YAAY,QAAQ,EAAS,KAAK,EAAS,EAAS,SAAS;AAExF,IAAI,KACA,EAAO,MAAM;AAAA,EACjB;AAGJ,WAAU,MAAM;AACZ,UAAM,CAAC,KAAoB,EAAU,IAAI,mBAAmB;AAExD,WAAA,EAAK,WAAW,KACX,EAAA,QAAQ,iBAAiB,SAAS,CAAY,GAGhD,MAAM;AACT,MAAI,EAAK,WACA,EAAA,QAAQ,oBAAoB,SAAS,CAAY;AAAA,IAC1D;AAAA,EAER,GAAG,CAAE,CAAA,GAGA,kBAAA,cAAA,GAAA,QACO,IADP;AAAA,IAEG,UAAU;AAAA,IACV,KAAK;AAAA,IACL,WAAW,EAAiB,GAAW,iBAAiB;AAAA,EAAA,EAC5D;AAER,GAIM,IAAU,EAAO;AAAA;AAAA;AAAA;"}