@telia-ace/widget-components-tab-stop 1.0.18 → 1.0.19-next.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.
- package/LICENSE.txt +5 -5
- package/README.md +3 -3
- package/dist/index.d.ts +2 -2
- package/dist/index.js.map +1 -1
- package/dist/tab-stop-component.d.ts +6 -6
- package/dist/tab-stop.546b8dc2.js.map +1 -1
- package/dist/tab-stop.d.ts +6 -6
- package/package.json +9 -10
package/LICENSE.txt
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Copyright © 2021, Telia Company AB. All rights reserved.
|
|
2
|
-
|
|
3
|
-
THIS PACKAGE AND CONTAINING SOFTWARE IS PART OF
|
|
4
|
-
THE HUMANY SERVICE. BY USING THIS SOFTWARE YOU
|
|
5
|
-
AGREE TO THE FOLLOWING TERMS AND CONDITIONS:
|
|
1
|
+
Copyright © 2021, Telia Company AB. All rights reserved.
|
|
2
|
+
|
|
3
|
+
THIS PACKAGE AND CONTAINING SOFTWARE IS PART OF
|
|
4
|
+
THE HUMANY SERVICE. BY USING THIS SOFTWARE YOU
|
|
5
|
+
AGREE TO THE FOLLOWING TERMS AND CONDITIONS:
|
|
6
6
|
http://www.humany.com/legal
|
package/README.md
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
# `@telia-ace/widget-components-tab-stop`
|
|
2
|
-
|
|
3
|
-
Tab stop component for ACE Widgets.
|
|
1
|
+
# `@telia-ace/widget-components-tab-stop`
|
|
2
|
+
|
|
3
|
+
Tab stop component for ACE Widgets.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import TabStopComponent from './tab-stop-component';
|
|
2
|
-
export default TabStopComponent;
|
|
1
|
+
import TabStopComponent from './tab-stop-component';
|
|
2
|
+
export default TabStopComponent;
|
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';\
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/tab-stop-component.ts"],"sourcesContent":["import { createReactComponent } from '@telia-ace/widget-ui';\nimport { Container } from '@webprovisions/platform';\n\nexport type TabStopComponentProps = {\n position: 'start' | 'end';\n};\n\nconst TabStopComponent = (container: Container) => {\n return createReactComponent(container, 'tab-stop', import('./tab-stop'));\n};\n\nexport default TabStopComponent;\n"],"names":["TabStopComponent","container","createReactComponent"],"mappings":";AAOM,MAAAA,IAAmB,CAACC,MACfC,EAAqBD,GAAW,YAAY,OAAO,yBAAa;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Container } from '@webprovisions/platform';
|
|
2
|
-
export declare type TabStopComponentProps = {
|
|
3
|
-
position: 'start' | 'end';
|
|
4
|
-
};
|
|
5
|
-
declare const TabStopComponent: (container: Container) => Promise<void>;
|
|
6
|
-
export default TabStopComponent;
|
|
1
|
+
import { Container } from '@webprovisions/platform';
|
|
2
|
+
export declare type TabStopComponentProps = {
|
|
3
|
+
position: 'start' | 'end';
|
|
4
|
+
};
|
|
5
|
+
declare const TabStopComponent: (container: Container) => Promise<void>;
|
|
6
|
+
export default TabStopComponent;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tab-stop.546b8dc2.js","sources":["../src/tab-stop.tsx"],"sourcesContent":["import { useContainer, useProperties } from '@telia-ace/widget-ui';\
|
|
1
|
+
{"version":3,"file":"tab-stop.546b8dc2.js","sources":["../src/tab-stop.tsx"],"sourcesContent":["import { useContainer, useProperties } from '@telia-ace/widget-ui';\nimport { appendClassNames } from '@telia-ace/widget-utilities';\nimport React, { useEffect, useRef } from 'react';\nimport styled from 'styled-components';\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;"}
|
package/dist/tab-stop.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
declare type Props = {
|
|
3
|
-
className: string;
|
|
4
|
-
};
|
|
5
|
-
declare const TabStop: React.
|
|
6
|
-
export default TabStop;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
declare type Props = {
|
|
3
|
+
className: string;
|
|
4
|
+
};
|
|
5
|
+
declare const TabStop: React.FC<Props>;
|
|
6
|
+
export default TabStop;
|
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.19-next.1",
|
|
4
4
|
"description": "Tab stop component for ACE Widgets.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"author": "Telia Company AB",
|
|
@@ -26,19 +26,18 @@
|
|
|
26
26
|
},
|
|
27
27
|
"sideEffects": false,
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@telia-ace/widget-ui": "^1.0.
|
|
30
|
-
"@telia-ace/widget-utilities": "^1.0.
|
|
29
|
+
"@telia-ace/widget-ui": "^1.0.23-next.2",
|
|
30
|
+
"@telia-ace/widget-utilities": "^1.0.5-next.1",
|
|
31
31
|
"@webprovisions/platform": "^1.1.2"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
|
-
"react": "^
|
|
35
|
-
"react-dom": "^
|
|
36
|
-
"styled-components": "^
|
|
34
|
+
"react": "^18.2.0",
|
|
35
|
+
"react-dom": "^18.2.0",
|
|
36
|
+
"styled-components": "^5.3.6"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@types/react": "^
|
|
40
|
-
"@types/
|
|
41
|
-
"@types/styled-components": "^5.1.7"
|
|
39
|
+
"@types/react-dom": "^18.0.6",
|
|
40
|
+
"@types/styled-components": "^5.1.26"
|
|
42
41
|
},
|
|
43
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "9dcb367fa548527b87978ec739d49a4c5c00ef22"
|
|
44
43
|
}
|