ku4web-components 6.5.5 → 6.5.6
Sign up to get free protection for your applications and to get access to all the features.
- package/angular/index.js +1 -1
- package/angular/index.mjs +1 -1
- package/dist/cjs/app-globals-3a1e7e63.js +5 -0
- package/dist/cjs/css-shim-f1391d35.js +6 -0
- package/dist/cjs/dom-5345ed9a.js +75 -0
- package/dist/cjs/index-065185f8.js +3093 -0
- package/dist/cjs/index-16f16ed9.js +14 -0
- package/dist/cjs/index-1a439af7.js +14 -0
- package/dist/cjs/index-436596bf.js +10 -0
- package/dist/cjs/index-49d3746b.js +10 -0
- package/dist/cjs/ku4-carousel-controls.cjs.entry.js +2 -2
- package/dist/cjs/ku4-carousel-slide.cjs.entry.js +1 -1
- package/dist/cjs/ku4-carousel.cjs.entry.js +3 -3
- package/dist/cjs/ku4-col.cjs.entry.js +1 -1
- package/dist/cjs/ku4-drawer.cjs.entry.js +1 -1
- package/dist/cjs/ku4-feature.cjs.entry.js +2 -2
- package/dist/cjs/ku4-focus-trap.cjs.entry.js +26 -26
- package/dist/cjs/ku4-form.cjs.entry.js +3 -3
- package/dist/cjs/ku4-grid.cjs.entry.js +1 -1
- package/dist/cjs/ku4-label.cjs.entry.js +2 -2
- package/dist/cjs/ku4-mask.cjs.entry.js +3 -3
- package/dist/cjs/ku4-modal.cjs.entry.js +3 -3
- package/dist/cjs/ku4-panel.cjs.entry.js +1 -1
- package/dist/cjs/ku4-preview.cjs.entry.js +43 -14
- package/dist/cjs/ku4-tab-list.cjs.entry.js +4 -4
- package/dist/cjs/ku4-tab-panel.cjs.entry.js +3 -3
- package/dist/cjs/ku4-tab.cjs.entry.js +3 -3
- package/dist/cjs/ku4-table.cjs.entry.js +1 -1
- package/dist/cjs/ku4-tooltip.cjs.entry.js +2 -2
- package/dist/cjs/ku4-validation.cjs.entry.js +2 -2
- package/dist/cjs/ku4web-components.cjs.js +101 -6
- package/dist/cjs/loader.cjs.js +17 -1
- package/dist/cjs/{uid-d533dbb1.js → uid-7f3954c8.js} +1 -1
- package/dist/cjs/uid-a1348ea5.js +11 -0
- package/dist/collection/capabilities/a11y/aria.js +26 -0
- package/dist/collection/capabilities/angular/index.js +24 -0
- package/dist/collection/capabilities/decorators/deprecated.js +20 -0
- package/dist/collection/capabilities/decorators/index.js +3 -0
- package/dist/collection/capabilities/decorators/memoize.js +7 -0
- package/dist/collection/capabilities/dom/isFocusable.js +7 -0
- package/dist/collection/capabilities/dom/queryFocusable.js +2 -0
- package/dist/collection/capabilities/identity/uid.js +6 -0
- package/dist/collection/capabilities/mask/index.js +5 -0
- package/dist/collection/capabilities/mask/patterns/date.js +40 -0
- package/dist/collection/capabilities/mask/patterns/index.js +7 -0
- package/dist/collection/capabilities/react/index.js +25 -0
- package/dist/collection/capabilities/testing/html.js +14 -0
- package/dist/collection/capabilities/testing/styles.js +14 -0
- package/dist/collection/capabilities/vue/index.js +28 -0
- package/dist/collection/capabilities/vue3/index.js +26 -0
- package/dist/collection/collection-manifest.json +31 -0
- package/dist/collection/components/ku4-carousel/ku4-carousel.css +221 -0
- package/dist/collection/components/ku4-carousel/ku4-carousel.js +369 -0
- package/dist/collection/components/ku4-carousel-controls/ku4-carousel-controls.css +32 -0
- package/dist/collection/components/ku4-carousel-controls/ku4-carousel-controls.js +112 -0
- package/dist/collection/components/ku4-carousel-slide/ku4-carousel-slide.css +3 -0
- package/dist/collection/components/ku4-carousel-slide/ku4-carousel-slide.js +159 -0
- package/dist/collection/components/ku4-col/ku4-col.css +601 -0
- package/dist/collection/components/ku4-col/ku4-col.js +288 -0
- package/dist/collection/components/ku4-drawer/ku4-drawer.css +56 -0
- package/dist/collection/components/ku4-drawer/ku4-drawer.js +163 -0
- package/dist/collection/components/ku4-feature/ku4-feature.js +70 -0
- package/dist/collection/components/ku4-focus-trap/ku4-focus-trap.css +3 -0
- package/dist/collection/components/ku4-focus-trap/ku4-focus-trap.js +441 -0
- package/dist/collection/components/ku4-form/ku4-form.js +265 -0
- package/dist/collection/components/ku4-grid/ku4-grid.css +751 -0
- package/dist/collection/components/ku4-grid/ku4-grid.js +408 -0
- package/dist/collection/components/ku4-label/ku4-label.css +36 -0
- package/dist/collection/components/ku4-label/ku4-label.js +115 -0
- package/dist/collection/components/ku4-mask/ku4-mask.css +3 -0
- package/dist/collection/components/ku4-mask/ku4-mask.js +459 -0
- package/dist/collection/components/ku4-modal/ku4-modal.css +85 -0
- package/dist/collection/components/ku4-modal/ku4-modal.js +231 -0
- package/dist/collection/components/ku4-panel/ku4-panel.css +14 -0
- package/dist/collection/components/ku4-panel/ku4-panel.js +119 -0
- package/dist/collection/components/ku4-preview/ku4-preview.css +23 -0
- package/dist/collection/components/ku4-preview/ku4-preview.js +266 -0
- package/dist/collection/components/ku4-tab/ku4-tab.css +82 -0
- package/dist/collection/components/ku4-tab/ku4-tab.js +191 -0
- package/dist/collection/components/ku4-tab-list/ku4-tab-list.css +6 -0
- package/dist/collection/components/ku4-tab-list/ku4-tab-list.js +118 -0
- package/dist/collection/components/ku4-tab-panel/ku4-tab-panel.css +26 -0
- package/dist/collection/components/ku4-tab-panel/ku4-tab-panel.js +166 -0
- package/dist/collection/components/ku4-table/ku4-table.css +116 -0
- package/dist/collection/components/ku4-table/ku4-table.js +120 -0
- package/dist/collection/components/ku4-tooltip/ku4-tooltip.css +56 -0
- package/dist/collection/components/ku4-tooltip/ku4-tooltip.js +274 -0
- package/dist/collection/components/ku4-validation/ku4-validation.css +19 -0
- package/dist/collection/components/ku4-validation/ku4-validation.js +364 -0
- package/dist/collection/components/ku4-validation/validate.js +14 -0
- package/dist/collection/index.js +1 -0
- package/dist/collection/security.js +27 -0
- package/dist/esm/app-globals-0f993ce5.js +3 -0
- package/dist/esm/css-shim-10e6e2ae.js +4 -0
- package/dist/esm/dom-7cd9cf71.js +73 -0
- package/dist/esm/index-5448a818.js +3 -0
- package/dist/esm/index-6cfd87e4.js +3 -0
- package/dist/esm/index-77bdf1f1.js +3 -0
- package/dist/esm/index-a02dcfc8.js +3057 -0
- package/dist/esm/index-aa119486.js +3 -0
- package/dist/esm/ku4-carousel-controls.entry.js +2 -2
- package/dist/esm/ku4-carousel-slide.entry.js +1 -1
- package/dist/esm/ku4-carousel.entry.js +3 -3
- package/dist/esm/ku4-col.entry.js +1 -1
- package/dist/esm/ku4-drawer.entry.js +1 -1
- package/dist/esm/ku4-feature.entry.js +2 -2
- package/dist/esm/ku4-focus-trap.entry.js +3 -3
- package/dist/esm/ku4-form.entry.js +3 -3
- package/dist/esm/ku4-grid.entry.js +1 -1
- package/dist/esm/ku4-label.entry.js +2 -2
- package/dist/esm/ku4-mask.entry.js +3 -3
- package/dist/esm/ku4-modal.entry.js +3 -3
- package/dist/esm/ku4-panel.entry.js +1 -1
- package/dist/esm/ku4-preview.entry.js +34 -5
- package/dist/esm/ku4-tab-list.entry.js +4 -4
- package/dist/esm/ku4-tab-panel.entry.js +3 -3
- package/dist/esm/ku4-tab.entry.js +3 -3
- package/dist/esm/ku4-table.entry.js +1 -1
- package/dist/esm/ku4-tooltip.entry.js +2 -2
- package/dist/esm/ku4-validation.entry.js +2 -2
- package/dist/esm/ku4web-components.js +101 -6
- package/dist/esm/loader.js +17 -1
- package/dist/esm/uid-3716c2c4.js +9 -0
- package/dist/esm/{uid-fbebccfd.js → uid-d593801c.js} +1 -1
- package/dist/esm-es5/index-5448a818.js +1 -0
- package/dist/esm-es5/index-77bdf1f1.js +1 -0
- package/dist/esm-es5/ku4-carousel-controls.entry.js +1 -1
- package/dist/esm-es5/ku4-carousel.entry.js +1 -1
- package/dist/esm-es5/ku4-feature.entry.js +1 -1
- package/dist/esm-es5/ku4-focus-trap.entry.js +1 -1
- package/dist/esm-es5/ku4-form.entry.js +1 -1
- package/dist/esm-es5/ku4-label.entry.js +1 -1
- package/dist/esm-es5/ku4-mask.entry.js +1 -1
- package/dist/esm-es5/ku4-modal.entry.js +1 -1
- package/dist/esm-es5/ku4-preview.entry.js +1 -1
- package/dist/esm-es5/ku4-tab-list.entry.js +1 -1
- package/dist/esm-es5/ku4-tab-panel.entry.js +1 -1
- package/dist/esm-es5/ku4-tab.entry.js +1 -1
- package/dist/esm-es5/ku4-tooltip.entry.js +1 -1
- package/dist/esm-es5/ku4-validation.entry.js +1 -1
- package/dist/esm-es5/uid-d593801c.js +1 -0
- package/dist/index.js +1 -1
- package/dist/ku4web-components/app-globals-0f993ce5.js +3 -0
- package/dist/ku4web-components/app-globals-497eb362.system.js +1 -0
- package/dist/ku4web-components/css-shim-10e6e2ae.js +4 -0
- package/dist/ku4web-components/css-shim-c8dd4551.system.js +1 -0
- package/dist/ku4web-components/dom-67d1e45e.system.js +21 -0
- package/dist/ku4web-components/dom-7cd9cf71.js +73 -0
- package/dist/ku4web-components/index-1c93827a.system.js +1 -0
- package/dist/ku4web-components/index-29f2b09f.system.js +1 -0
- package/dist/ku4web-components/index-5d0cb00d.system.js +1 -0
- package/dist/ku4web-components/index-6cfd87e4.js +3 -0
- package/dist/ku4web-components/index-a02dcfc8.js +3057 -0
- package/dist/ku4web-components/index-aa119486.js +3 -0
- package/dist/ku4web-components/index.esm.js +1 -0
- package/dist/ku4web-components/index.system.js +1 -0
- package/dist/ku4web-components/ku4-carousel-controls.entry.js +89 -0
- package/dist/ku4web-components/ku4-carousel-controls.system.entry.js +1 -0
- package/dist/ku4web-components/ku4-carousel-slide.entry.js +47 -0
- package/dist/ku4web-components/ku4-carousel-slide.system.entry.js +1 -0
- package/dist/ku4web-components/ku4-carousel.entry.js +175 -0
- package/dist/ku4web-components/ku4-carousel.system.entry.js +1 -0
- package/dist/ku4web-components/ku4-col.entry.js +75 -0
- package/dist/ku4web-components/ku4-col.system.entry.js +1 -0
- package/dist/ku4web-components/ku4-drawer.entry.js +35 -0
- package/dist/ku4web-components/ku4-drawer.system.entry.js +1 -0
- package/dist/ku4web-components/ku4-feature.entry.js +29 -0
- package/dist/ku4web-components/ku4-feature.system.entry.js +1 -0
- package/dist/ku4web-components/ku4-focus-trap.entry.js +323 -0
- package/dist/ku4web-components/ku4-focus-trap.system.entry.js +1 -0
- package/dist/ku4web-components/ku4-form.entry.js +120 -0
- package/dist/ku4web-components/ku4-form.system.entry.js +1 -0
- package/dist/ku4web-components/ku4-grid.entry.js +108 -0
- package/dist/ku4web-components/ku4-grid.system.entry.js +1 -0
- package/dist/ku4web-components/ku4-label.entry.js +70 -0
- package/dist/ku4web-components/ku4-label.system.entry.js +1 -0
- package/dist/ku4web-components/ku4-mask.entry.js +343 -0
- package/dist/ku4web-components/ku4-mask.system.entry.js +1 -0
- package/dist/ku4web-components/ku4-modal.entry.js +80 -0
- package/dist/ku4web-components/ku4-modal.system.entry.js +1 -0
- package/dist/ku4web-components/ku4-panel.entry.js +49 -0
- package/dist/ku4web-components/ku4-panel.system.entry.js +1 -0
- package/dist/ku4web-components/ku4-preview.entry.js +128 -0
- package/dist/ku4web-components/ku4-preview.system.entry.js +1 -0
- package/dist/ku4web-components/ku4-tab-list.entry.js +76 -0
- package/dist/ku4web-components/ku4-tab-list.system.entry.js +1 -0
- package/dist/ku4web-components/ku4-tab-panel.entry.js +72 -0
- package/dist/ku4web-components/ku4-tab-panel.system.entry.js +1 -0
- package/dist/ku4web-components/ku4-tab.entry.js +63 -0
- package/dist/ku4web-components/ku4-tab.system.entry.js +1 -0
- package/dist/ku4web-components/ku4-table.entry.js +79 -0
- package/dist/ku4web-components/ku4-table.system.entry.js +1 -0
- package/dist/ku4web-components/ku4-tooltip.entry.js +120 -0
- package/dist/ku4web-components/ku4-tooltip.system.entry.js +1 -0
- package/dist/ku4web-components/ku4-validation.entry.js +162 -0
- package/dist/ku4web-components/ku4-validation.system.entry.js +1 -0
- package/dist/ku4web-components/ku4web-components.css +299 -1
- package/dist/ku4web-components/ku4web-components.esm.js +129 -1
- package/dist/ku4web-components/ku4web-components.js +1 -1
- package/dist/ku4web-components/ku4web-components.system.js +1 -0
- package/dist/ku4web-components/{p-c6a2f4ba.entry.js → p-046b3990.entry.js} +1 -1
- package/dist/ku4web-components/{p-018d598f.entry.js → p-0b777b57.entry.js} +1 -1
- package/dist/ku4web-components/p-0de744b1.system.js +1 -0
- package/dist/ku4web-components/{p-c760ec1e.system.entry.js → p-0f1646ca.system.entry.js} +1 -1
- package/dist/ku4web-components/p-14752b72.system.js +1 -0
- package/dist/ku4web-components/{p-5d39e051.system.entry.js → p-17c2a7ac.system.entry.js} +1 -1
- package/dist/ku4web-components/{p-536d6073.entry.js → p-1abe6f26.entry.js} +1 -1
- package/dist/ku4web-components/{p-7bac5d20.system.entry.js → p-1e19bc01.system.entry.js} +1 -1
- package/dist/ku4web-components/{p-dfc33643.system.entry.js → p-27647af0.system.entry.js} +1 -1
- package/dist/ku4web-components/p-2ee63f57.system.js +1 -1
- package/dist/ku4web-components/{p-973be48d.system.entry.js → p-3deab7f6.system.entry.js} +1 -1
- package/dist/ku4web-components/{p-23b35ab3.system.entry.js → p-4ecd9b1d.system.entry.js} +1 -1
- package/dist/ku4web-components/p-563d1517.system.js +1 -0
- package/dist/ku4web-components/p-5a54ccf4.js +1 -0
- package/dist/ku4web-components/{p-2681e152.system.entry.js → p-5e8921ef.system.entry.js} +1 -1
- package/dist/ku4web-components/{p-6459c75c.system.entry.js → p-6509d3e7.system.entry.js} +1 -1
- package/dist/ku4web-components/p-791e2dfc.js +1 -0
- package/dist/ku4web-components/{p-4a012d6d.entry.js → p-7b6ca6a8.entry.js} +1 -1
- package/dist/ku4web-components/{p-ec165afd.system.entry.js → p-7b93a362.system.entry.js} +1 -1
- package/dist/ku4web-components/{p-2faea8a9.system.entry.js → p-8173d389.system.entry.js} +1 -1
- package/dist/ku4web-components/{p-13c90d3d.system.entry.js → p-96033515.system.entry.js} +1 -1
- package/dist/ku4web-components/{p-e7d401cc.system.entry.js → p-9778d082.system.entry.js} +1 -1
- package/dist/ku4web-components/{p-09fb8c34.entry.js → p-9b01a63a.entry.js} +1 -1
- package/dist/ku4web-components/p-a110d244.js +1 -0
- package/dist/ku4web-components/{p-ff9db3e7.entry.js → p-ac7884f3.entry.js} +1 -1
- package/dist/ku4web-components/{p-27d5ad45.system.entry.js → p-ae7ce1fe.system.entry.js} +1 -1
- package/dist/ku4web-components/{p-be0d8b6a.entry.js → p-b1680ef4.entry.js} +1 -1
- package/dist/ku4web-components/{p-2f1425ac.entry.js → p-bb5410b5.entry.js} +1 -1
- package/dist/ku4web-components/{p-cbee5388.system.entry.js → p-bb698020.system.entry.js} +1 -1
- package/dist/ku4web-components/{p-eed33b36.entry.js → p-d42bd64d.entry.js} +1 -1
- package/dist/ku4web-components/{p-7a3871e3.entry.js → p-d4877fdf.entry.js} +1 -1
- package/dist/ku4web-components/{p-1ebea98a.entry.js → p-da8a8b83.entry.js} +1 -1
- package/dist/ku4web-components/{p-507093a6.entry.js → p-de3b2ba1.entry.js} +1 -1
- package/dist/ku4web-components/{p-f791cd06.entry.js → p-e11fbd79.entry.js} +1 -1
- package/dist/ku4web-components/{p-991d53c6.entry.js → p-ea1961f5.entry.js} +1 -1
- package/dist/ku4web-components/shadow-css-38a1326b.js +388 -0
- package/dist/ku4web-components/shadow-css-7fde17ac.system.js +13 -0
- package/dist/ku4web-components/uid-2ed9f227.system.js +1 -0
- package/dist/ku4web-components/uid-3716c2c4.js +9 -0
- package/package.json +5 -5
- package/react/index.js +1 -1
- package/react/index.mjs +1 -1
- package/vue/index.js +1 -1
- package/vue/index.mjs +1 -1
- package/vue3/index.js +1 -1
- package/vue3/index.mjs +1 -1
- package/dist/cjs/index-57e2cfa5.js +0 -10
- package/dist/cjs/index-b46d22c6.js +0 -14
- package/dist/esm/index-919b08e6.js +0 -3
- package/dist/esm/index-f9890388.js +0 -3
- package/dist/esm-es5/index-919b08e6.js +0 -1
- package/dist/esm-es5/index-f9890388.js +0 -1
- package/dist/esm-es5/uid-fbebccfd.js +0 -1
- package/dist/ku4web-components/p-16f6027a.js +0 -1
- package/dist/ku4web-components/p-50ea6684.js +0 -1
- package/dist/ku4web-components/p-c38c9cd1.system.js +0 -1
- package/dist/ku4web-components/p-cbb6fb91.js +0 -1
- package/dist/ku4web-components/p-e9770900.system.js +0 -1
- package/dist/ku4web-components/p-f8a2bf9b.system.js +0 -1
@@ -0,0 +1,76 @@
|
|
1
|
+
import { r as registerInstance, h, f as Host, g as getElement } from './index-a02dcfc8.js';
|
2
|
+
import { K as Key } from './index-aa119486.js';
|
3
|
+
import { u as uid } from './uid-3716c2c4.js';
|
4
|
+
import './index-6cfd87e4.js';
|
5
|
+
|
6
|
+
const ku4TabListCss = ":host{position:relative;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-wrap:wrap;flex-wrap:wrap}";
|
7
|
+
|
8
|
+
const Ku4TabList = class {
|
9
|
+
constructor(hostRef) {
|
10
|
+
registerInstance(this, hostRef);
|
11
|
+
}
|
12
|
+
handleTabClick({ target }) {
|
13
|
+
this.tabs.includes(target) && this.open(target);
|
14
|
+
}
|
15
|
+
handleTabKeyUp({ target, detail: e }) {
|
16
|
+
if (!(this.tabs.includes(target))) {
|
17
|
+
return;
|
18
|
+
}
|
19
|
+
if (Key.left.didFire(e)) {
|
20
|
+
this.open(this.previous(target));
|
21
|
+
}
|
22
|
+
if (Key.right.didFire(e)) {
|
23
|
+
this.open(this.next(target));
|
24
|
+
}
|
25
|
+
}
|
26
|
+
/**
|
27
|
+
* Open a ku4-tab in this ku4-tab-list.
|
28
|
+
* @param {Ku4Tab} tab - ku4-tab target to open.
|
29
|
+
*/
|
30
|
+
async open(tab) {
|
31
|
+
return this.reset().select(tab);
|
32
|
+
}
|
33
|
+
select(tab) {
|
34
|
+
tab.select();
|
35
|
+
return this;
|
36
|
+
}
|
37
|
+
deselect(tab) {
|
38
|
+
tab.deselect();
|
39
|
+
return this;
|
40
|
+
}
|
41
|
+
reset() {
|
42
|
+
this.tabs.forEach(tab => this.deselect(tab));
|
43
|
+
return this;
|
44
|
+
}
|
45
|
+
previous(tab) {
|
46
|
+
const { tabs, tabs: { length } } = this;
|
47
|
+
const index = tabs.indexOf(tab) - 1;
|
48
|
+
return tabs[index > -1 ? index : length - 1];
|
49
|
+
}
|
50
|
+
next(tab) {
|
51
|
+
const { tabs, tabs: { length } } = this;
|
52
|
+
const index = tabs.indexOf(tab) + 1;
|
53
|
+
return tabs[index < length ? index : 0];
|
54
|
+
}
|
55
|
+
componentDidRender() {
|
56
|
+
const tabs = [];
|
57
|
+
const panels = [];
|
58
|
+
[].slice.call(this.host.children).forEach((child) => {
|
59
|
+
if (child.tagName === 'KU4-TAB') {
|
60
|
+
tabs.push(child);
|
61
|
+
}
|
62
|
+
if (child.tagName === 'KU4-TAB-PANEL') {
|
63
|
+
panels.push(child);
|
64
|
+
}
|
65
|
+
});
|
66
|
+
this.tabs = tabs;
|
67
|
+
this.tabs.forEach((tab, index) => tab.connect(panels[index]));
|
68
|
+
}
|
69
|
+
render() {
|
70
|
+
return (h(Host, { id: this.host.id || uid(), role: "tablist", "aria-owns": this.host.id || uid() }, h("slot", null)));
|
71
|
+
}
|
72
|
+
get host() { return getElement(this); }
|
73
|
+
};
|
74
|
+
Ku4TabList.style = ku4TabListCss;
|
75
|
+
|
76
|
+
export { Ku4TabList as ku4_tab_list };
|
@@ -0,0 +1 @@
|
|
1
|
+
var __awaiter=this&&this.__awaiter||function(t,e,n,r){function i(t){return t instanceof n?t:new n((function(e){e(t)}))}return new(n||(n=Promise))((function(n,o){function s(t){try{u(r.next(t))}catch(e){o(e)}}function a(t){try{u(r["throw"](t))}catch(e){o(e)}}function u(t){t.done?n(t.value):i(t.value).then(s,a)}u((r=r.apply(t,e||[])).next())}))};var __generator=this&&this.__generator||function(t,e){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(t){return function(e){return u([t,e])}}function u(s){if(r)throw new TypeError("Generator is already executing.");while(n)try{if(r=1,i&&(o=s[0]&2?i["return"]:s[0]?i["throw"]||((o=i["return"])&&o.call(i),0):i.next)&&!(o=o.call(i,s[1])).done)return o;if(i=0,o)s=[s[0]&2,o.value];switch(s[0]){case 0:case 1:o=s;break;case 4:n.label++;return{value:s[1],done:false};case 5:n.label++;i=s[1];s=[0];continue;case 7:s=n.ops.pop();n.trys.pop();continue;default:if(!(o=n.trys,o=o.length>0&&o[o.length-1])&&(s[0]===6||s[0]===2)){n=0;continue}if(s[0]===3&&(!o||s[1]>o[0]&&s[1]<o[3])){n.label=s[1];break}if(s[0]===6&&n.label<o[1]){n.label=o[1];o=s;break}if(o&&n.label<o[2]){n.label=o[2];n.ops.push(s);break}if(o[2])n.ops.pop();n.trys.pop();continue}s=e.call(t,n)}catch(a){s=[6,a];i=0}finally{r=o=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};System.register(["./index-29f2b09f.system.js","./index-1c93827a.system.js","./uid-2ed9f227.system.js","./index-5d0cb00d.system.js"],(function(t){"use strict";var e,n,r,i,o,s;return{setters:[function(t){e=t.r;n=t.h;r=t.f;i=t.g},function(t){o=t.K},function(t){s=t.u},function(){}],execute:function(){var a=":host{position:relative;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-wrap:wrap;flex-wrap:wrap}";var u=t("ku4_tab_list",function(){function t(t){e(this,t)}t.prototype.handleTabClick=function(t){var e=t.target;this.tabs.includes(e)&&this.open(e)};t.prototype.handleTabKeyUp=function(t){var e=t.target,n=t.detail;if(!this.tabs.includes(e)){return}if(o.left.didFire(n)){this.open(this.previous(e))}if(o.right.didFire(n)){this.open(this.next(e))}};t.prototype.open=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){return[2,this.reset().select(t)]}))}))};t.prototype.select=function(t){t.select();return this};t.prototype.deselect=function(t){t.deselect();return this};t.prototype.reset=function(){var t=this;this.tabs.forEach((function(e){return t.deselect(e)}));return this};t.prototype.previous=function(t){var e=this,n=e.tabs,r=e.tabs.length;var i=n.indexOf(t)-1;return n[i>-1?i:r-1]};t.prototype.next=function(t){var e=this,n=e.tabs,r=e.tabs.length;var i=n.indexOf(t)+1;return n[i<r?i:0]};t.prototype.componentDidRender=function(){var t=[];var e=[];[].slice.call(this.host.children).forEach((function(n){if(n.tagName==="KU4-TAB"){t.push(n)}if(n.tagName==="KU4-TAB-PANEL"){e.push(n)}}));this.tabs=t;this.tabs.forEach((function(t,n){return t.connect(e[n])}))};t.prototype.render=function(){return n(r,{id:this.host.id||s(),role:"tablist","aria-owns":this.host.id||s()},n("slot",null))};Object.defineProperty(t.prototype,"host",{get:function(){return i(this)},enumerable:false,configurable:true});return t}());u.style=a}}}));
|
@@ -0,0 +1,72 @@
|
|
1
|
+
import { r as registerInstance, h, f as Host, g as getElement } from './index-a02dcfc8.js';
|
2
|
+
import { u as uid } from './uid-3716c2c4.js';
|
3
|
+
import './index-6cfd87e4.js';
|
4
|
+
|
5
|
+
const ku4TabPanelCss = ":host{-webkit-backface-visibility:hidden;display:block;width:100%;height:auto;max-height:0;-webkit-transition:max-height 0.4s, padding 0.6s;transition:max-height 0.4s, padding 0.6s;overflow:auto}@media only screen and (min-width: 768px){:host{display:none;border-top:1px solid #ccc;border-bottom:1px solid #ccc;max-height:initial !important;-webkit-transition:none;transition:none;-ms-flex-order:2;order:2}:host([selected]){display:block;max-height:initial !important;-webkit-transition:none;transition:none}}";
|
6
|
+
|
7
|
+
const Ku4TabPanel = class {
|
8
|
+
constructor(hostRef) {
|
9
|
+
registerInstance(this, hostRef);
|
10
|
+
/**
|
11
|
+
* Set true to display panel
|
12
|
+
*/
|
13
|
+
this.selected = false;
|
14
|
+
this.maxHeight = this.selected ? 'none' : '0px';
|
15
|
+
}
|
16
|
+
handleTransitionEnd() {
|
17
|
+
this.maxHeight = this.selected ? 'none' : '0px';
|
18
|
+
}
|
19
|
+
/**
|
20
|
+
* Set this panel as selected.
|
21
|
+
*/
|
22
|
+
async select() {
|
23
|
+
if (this.selected) {
|
24
|
+
return;
|
25
|
+
}
|
26
|
+
this.selected = true;
|
27
|
+
if (this.hasTransition) {
|
28
|
+
this.maxHeight = `${this.host.scrollHeight}px`;
|
29
|
+
}
|
30
|
+
else {
|
31
|
+
this.handleTransitionEnd();
|
32
|
+
}
|
33
|
+
}
|
34
|
+
/**
|
35
|
+
* Unset this panel as selected.
|
36
|
+
*/
|
37
|
+
async deselect() {
|
38
|
+
if (!this.selected) {
|
39
|
+
return;
|
40
|
+
}
|
41
|
+
this.selected = false;
|
42
|
+
this.host.style.maxHeight = `${this.host.scrollHeight}px`;
|
43
|
+
if (this.hasTransition) {
|
44
|
+
this.maxHeight = '0px';
|
45
|
+
}
|
46
|
+
else {
|
47
|
+
this.handleTransitionEnd();
|
48
|
+
}
|
49
|
+
}
|
50
|
+
/**
|
51
|
+
* Connect this panel to a tab.
|
52
|
+
* @param {Ku4Tab} tab - Tab to connect to this panel
|
53
|
+
*/
|
54
|
+
async connect(tab) {
|
55
|
+
tab.$assignPanel(this);
|
56
|
+
this.tab = tab;
|
57
|
+
}
|
58
|
+
get hasTransition() {
|
59
|
+
const transition = window
|
60
|
+
.getComputedStyle(this.host)
|
61
|
+
.getPropertyValue('transition');
|
62
|
+
return !/none/.test(transition);
|
63
|
+
}
|
64
|
+
render() {
|
65
|
+
const { selected, tab, maxHeight } = this;
|
66
|
+
return (h(Host, { role: "tabpanel", id: this.host.id || uid(), "aria-hidden": selected ? 'false' : 'true', "aria-labelledby": tab && tab.id, tabIndex: selected ? 0 : -1, style: { maxHeight } }, h("slot", null)));
|
67
|
+
}
|
68
|
+
get host() { return getElement(this); }
|
69
|
+
};
|
70
|
+
Ku4TabPanel.style = ku4TabPanelCss;
|
71
|
+
|
72
|
+
export { Ku4TabPanel as ku4_tab_panel };
|
@@ -0,0 +1 @@
|
|
1
|
+
var __awaiter=this&&this.__awaiter||function(t,e,n,i){function r(t){return t instanceof n?t:new n((function(e){e(t)}))}return new(n||(n=Promise))((function(n,o){function s(t){try{l(i.next(t))}catch(e){o(e)}}function a(t){try{l(i["throw"](t))}catch(e){o(e)}}function l(t){t.done?n(t.value):r(t.value).then(s,a)}l((i=i.apply(t,e||[])).next())}))};var __generator=this&&this.__generator||function(t,e){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},i,r,o,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(t){return function(e){return l([t,e])}}function l(s){if(i)throw new TypeError("Generator is already executing.");while(n)try{if(i=1,r&&(o=s[0]&2?r["return"]:s[0]?r["throw"]||((o=r["return"])&&o.call(r),0):r.next)&&!(o=o.call(r,s[1])).done)return o;if(r=0,o)s=[s[0]&2,o.value];switch(s[0]){case 0:case 1:o=s;break;case 4:n.label++;return{value:s[1],done:false};case 5:n.label++;r=s[1];s=[0];continue;case 7:s=n.ops.pop();n.trys.pop();continue;default:if(!(o=n.trys,o=o.length>0&&o[o.length-1])&&(s[0]===6||s[0]===2)){n=0;continue}if(s[0]===3&&(!o||s[1]>o[0]&&s[1]<o[3])){n.label=s[1];break}if(s[0]===6&&n.label<o[1]){n.label=o[1];o=s;break}if(o&&n.label<o[2]){n.label=o[2];n.ops.push(s);break}if(o[2])n.ops.pop();n.trys.pop();continue}s=e.call(t,n)}catch(a){s=[6,a];r=0}finally{i=o=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};System.register(["./index-29f2b09f.system.js","./uid-2ed9f227.system.js","./index-5d0cb00d.system.js"],(function(t){"use strict";var e,n,i,r,o;return{setters:[function(t){e=t.r;n=t.h;i=t.f;r=t.g},function(t){o=t.u},function(){}],execute:function(){var s=":host{-webkit-backface-visibility:hidden;display:block;width:100%;height:auto;max-height:0;-webkit-transition:max-height 0.4s, padding 0.6s;transition:max-height 0.4s, padding 0.6s;overflow:auto}@media only screen and (min-width: 768px){:host{display:none;border-top:1px solid #ccc;border-bottom:1px solid #ccc;max-height:initial !important;-webkit-transition:none;transition:none;-ms-flex-order:2;order:2}:host([selected]){display:block;max-height:initial !important;-webkit-transition:none;transition:none}}";var a=t("ku4_tab_panel",function(){function t(t){e(this,t);this.selected=false;this.maxHeight=this.selected?"none":"0px"}t.prototype.handleTransitionEnd=function(){this.maxHeight=this.selected?"none":"0px"};t.prototype.select=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){if(this.selected){return[2]}this.selected=true;if(this.hasTransition){this.maxHeight="".concat(this.host.scrollHeight,"px")}else{this.handleTransitionEnd()}return[2]}))}))};t.prototype.deselect=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){if(!this.selected){return[2]}this.selected=false;this.host.style.maxHeight="".concat(this.host.scrollHeight,"px");if(this.hasTransition){this.maxHeight="0px"}else{this.handleTransitionEnd()}return[2]}))}))};t.prototype.connect=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){t.$assignPanel(this);this.tab=t;return[2]}))}))};Object.defineProperty(t.prototype,"hasTransition",{get:function(){var t=window.getComputedStyle(this.host).getPropertyValue("transition");return!/none/.test(t)},enumerable:false,configurable:true});t.prototype.render=function(){var t=this,e=t.selected,r=t.tab,s=t.maxHeight;return n(i,{role:"tabpanel",id:this.host.id||o(),"aria-hidden":e?"false":"true","aria-labelledby":r&&r.id,tabIndex:e?0:-1,style:{maxHeight:s}},n("slot",null))};Object.defineProperty(t.prototype,"host",{get:function(){return r(this)},enumerable:false,configurable:true});return t}());a.style=s}}}));
|
@@ -0,0 +1,63 @@
|
|
1
|
+
import { r as registerInstance, e as createEvent, h, f as Host, g as getElement } from './index-a02dcfc8.js';
|
2
|
+
import { u as uid } from './uid-3716c2c4.js';
|
3
|
+
import './index-6cfd87e4.js';
|
4
|
+
|
5
|
+
const ku4TabCss = "button{margin:0;padding:0;border:none;background:transparent;-webkit-appearance:none}:host{position:relative;display:block;width:100%;padding:20px 30px;background-color:#eee;text-align:center;color:#aaa;cursor:pointer}:host(:focus){background-color:#eee;color:#666;z-index:2}:host(:hover){background-color:#eee;color:#666}:host(:active){background-color:#fff;color:#333}:host([selected]){border-top:1px solid #ccc;border-bottom:1px solid #ccc;background-color:#fff;color:#444}button{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;width:100%}@media only screen and (min-width: 768px){:host{width:auto;border-top:1px solid #ccc;border-right:1px solid #ccc;border-top-left-radius:4px;border-top-right-radius:4px;background-color:#eee}:host(:first-of-type){border-left:1px solid #ccc}:host([selected]){padding-bottom:1px;border-top:1px solid #ccc;border-bottom:none}:host([selected]):after{content:\" \";position:absolute;display:block;left:0;bottom:-1px;width:100%;height:1px;-webkit-box-sizing:border-box;box-sizing:border-box;background-color:inherit}}";
|
6
|
+
|
7
|
+
const Ku4Tab = class {
|
8
|
+
constructor(hostRef) {
|
9
|
+
registerInstance(this, hostRef);
|
10
|
+
this.tabClick = createEvent(this, "ku4TabClick", 7);
|
11
|
+
this.tabKeyUp = createEvent(this, "ku4TabKeyup", 7);
|
12
|
+
/**
|
13
|
+
* Active when true
|
14
|
+
*/
|
15
|
+
this.selected = false;
|
16
|
+
}
|
17
|
+
handleClick(e) {
|
18
|
+
this.tabClick.emit(e);
|
19
|
+
}
|
20
|
+
handleKeyUp(e) {
|
21
|
+
this.tabKeyUp.emit(e);
|
22
|
+
}
|
23
|
+
/**
|
24
|
+
* Set this tab as selected.
|
25
|
+
*/
|
26
|
+
async select() {
|
27
|
+
this.selected = true;
|
28
|
+
this.panel.select();
|
29
|
+
this.host.focus();
|
30
|
+
}
|
31
|
+
/**
|
32
|
+
* Unset this tab as selected
|
33
|
+
*/
|
34
|
+
async deselect() {
|
35
|
+
this.selected = false;
|
36
|
+
this.panel.deselect();
|
37
|
+
}
|
38
|
+
/**
|
39
|
+
* Connect this tab to a panel
|
40
|
+
* @param {HTMLElement} panel - The target ku4-tab-panel HTMLElement
|
41
|
+
*/
|
42
|
+
async connect(panel) {
|
43
|
+
panel.connect(this);
|
44
|
+
}
|
45
|
+
get id() {
|
46
|
+
return this.host.id || uid();
|
47
|
+
}
|
48
|
+
/**
|
49
|
+
* @param {Ku4TabPanel} panel - panel to assign to this tab
|
50
|
+
* @internal
|
51
|
+
*/
|
52
|
+
$assignPanel(panel) {
|
53
|
+
this.panel = panel;
|
54
|
+
}
|
55
|
+
render() {
|
56
|
+
const { selected, panel } = this;
|
57
|
+
return (h(Host, { id: this.host.id || uid(), role: "tab", type: "button", tabIndex: selected ? 0 : -1, "aria-controls": panel && panel.id, "aria-selected": selected ? 'true' : 'false' }, h("slot", null)));
|
58
|
+
}
|
59
|
+
get host() { return getElement(this); }
|
60
|
+
};
|
61
|
+
Ku4Tab.style = ku4TabCss;
|
62
|
+
|
63
|
+
export { Ku4Tab as ku4_tab };
|
@@ -0,0 +1 @@
|
|
1
|
+
var __awaiter=this&&this.__awaiter||function(t,e,o,r){function n(t){return t instanceof o?t:new o((function(e){e(t)}))}return new(o||(o=Promise))((function(o,i){function c(t){try{a(r.next(t))}catch(e){i(e)}}function s(t){try{a(r["throw"](t))}catch(e){i(e)}}function a(t){t.done?o(t.value):n(t.value).then(c,s)}a((r=r.apply(t,e||[])).next())}))};var __generator=this&&this.__generator||function(t,e){var o={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,n,i,c;return c={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(c[Symbol.iterator]=function(){return this}),c;function s(t){return function(e){return a([t,e])}}function a(c){if(r)throw new TypeError("Generator is already executing.");while(o)try{if(r=1,n&&(i=c[0]&2?n["return"]:c[0]?n["throw"]||((i=n["return"])&&i.call(n),0):n.next)&&!(i=i.call(n,c[1])).done)return i;if(n=0,i)c=[c[0]&2,i.value];switch(c[0]){case 0:case 1:i=c;break;case 4:o.label++;return{value:c[1],done:false};case 5:o.label++;n=c[1];c=[0];continue;case 7:c=o.ops.pop();o.trys.pop();continue;default:if(!(i=o.trys,i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){o=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){o.label=c[1];break}if(c[0]===6&&o.label<i[1]){o.label=i[1];i=c;break}if(i&&o.label<i[2]){o.label=i[2];o.ops.push(c);break}if(i[2])o.ops.pop();o.trys.pop();continue}c=e.call(t,o)}catch(s){c=[6,s];n=0}finally{r=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:true}}};System.register(["./index-29f2b09f.system.js","./uid-2ed9f227.system.js","./index-5d0cb00d.system.js"],(function(t){"use strict";var e,o,r,n,i,c;return{setters:[function(t){e=t.r;o=t.e;r=t.h;n=t.f;i=t.g},function(t){c=t.u},function(){}],execute:function(){var s='button{margin:0;padding:0;border:none;background:transparent;-webkit-appearance:none}:host{position:relative;display:block;width:100%;padding:20px 30px;background-color:#eee;text-align:center;color:#aaa;cursor:pointer}:host(:focus){background-color:#eee;color:#666;z-index:2}:host(:hover){background-color:#eee;color:#666}:host(:active){background-color:#fff;color:#333}:host([selected]){border-top:1px solid #ccc;border-bottom:1px solid #ccc;background-color:#fff;color:#444}button{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;width:100%}@media only screen and (min-width: 768px){:host{width:auto;border-top:1px solid #ccc;border-right:1px solid #ccc;border-top-left-radius:4px;border-top-right-radius:4px;background-color:#eee}:host(:first-of-type){border-left:1px solid #ccc}:host([selected]){padding-bottom:1px;border-top:1px solid #ccc;border-bottom:none}:host([selected]):after{content:" ";position:absolute;display:block;left:0;bottom:-1px;width:100%;height:1px;-webkit-box-sizing:border-box;box-sizing:border-box;background-color:inherit}}';var a=t("ku4_tab",function(){function t(t){e(this,t);this.tabClick=o(this,"ku4TabClick",7);this.tabKeyUp=o(this,"ku4TabKeyup",7);this.selected=false}t.prototype.handleClick=function(t){this.tabClick.emit(t)};t.prototype.handleKeyUp=function(t){this.tabKeyUp.emit(t)};t.prototype.select=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){this.selected=true;this.panel.select();this.host.focus();return[2]}))}))};t.prototype.deselect=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){this.selected=false;this.panel.deselect();return[2]}))}))};t.prototype.connect=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){t.connect(this);return[2]}))}))};Object.defineProperty(t.prototype,"id",{get:function(){return this.host.id||c()},enumerable:false,configurable:true});t.prototype.$assignPanel=function(t){this.panel=t};t.prototype.render=function(){var t=this,e=t.selected,o=t.panel;return r(n,{id:this.host.id||c(),role:"tab",type:"button",tabIndex:e?0:-1,"aria-controls":o&&o.id,"aria-selected":e?"true":"false"},r("slot",null))};Object.defineProperty(t.prototype,"host",{get:function(){return i(this)},enumerable:false,configurable:true});return t}());a.style=s}}}));
|
@@ -0,0 +1,79 @@
|
|
1
|
+
import { r as registerInstance, h, g as getElement } from './index-a02dcfc8.js';
|
2
|
+
|
3
|
+
const ku4TableCss = "ku4-table{position:relative;display:block}@media only screen and (min-width: 1px) and (max-width: 767px){@supports (display: contents){ku4-table[stack-xs=column] table{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}ku4-table[stack-xs=column] thead,ku4-table[stack-xs=column] tbody,ku4-table[stack-xs=column] tfoot,ku4-table[stack-xs=column] tr{display:contents}ku4-table[stack-xs=column] thead .ku4-head-header{display:none}ku4-table[stack-xs=column] tbody th,ku4-table[stack-xs=column] tfoot th{position:absolute;display:block;width:0;height:0;margin:0;padding:0;line-height:0;font-size:0}ku4-table[stack-xs=column] tbody td,ku4-table[stack-xs=column] tfoot td{display:-ms-flexbox;display:flex}ku4-table[stack-xs=column] tbody td:before,ku4-table[stack-xs=column] tfoot td:before{content:attr(data-ku4-row-header)}}ku4-table[stack-xs=row] table{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}ku4-table[stack-xs=row] thead th,ku4-table[stack-xs=row] thead td{display:none}ku4-table[stack-xs=row] thead,ku4-table[stack-xs=row] tbody,ku4-table[stack-xs=row] tfoot,ku4-table[stack-xs=row] tr,ku4-table[stack-xs=row] th,ku4-table[stack-xs=row] td{display:block}ku4-table[stack-xs=row] tbody td:before,ku4-table[stack-xs=row] tfoot td:before{content:attr(data-ku4-column-header)}}@media only screen and (min-width: 768px) and (max-width: 991px){@supports (display: contents){ku4-table[stack-sm=column] table{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}ku4-table[stack-sm=column] thead,ku4-table[stack-sm=column] tbody,ku4-table[stack-sm=column] tfoot,ku4-table[stack-sm=column] tr{display:contents}ku4-table[stack-sm=column] thead .ku4-head-header{display:none}ku4-table[stack-sm=column] tbody th,ku4-table[stack-sm=column] tfoot th{position:absolute;display:block;width:0;height:0;margin:0;padding:0;line-height:0;font-size:0}ku4-table[stack-sm=column] tbody td,ku4-table[stack-sm=column] tfoot td{display:-ms-flexbox;display:flex}ku4-table[stack-sm=column] tbody td:before,ku4-table[stack-sm=column] tfoot td:before{content:attr(data-ku4-row-header)}}ku4-table[stack-sm=row] table{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}ku4-table[stack-sm=row] thead th,ku4-table[stack-sm=row] thead td{display:none}ku4-table[stack-sm=row] thead,ku4-table[stack-sm=row] tbody,ku4-table[stack-sm=row] tfoot,ku4-table[stack-sm=row] tr,ku4-table[stack-sm=row] th,ku4-table[stack-sm=row] td{display:block}ku4-table[stack-sm=row] tbody td:before,ku4-table[stack-sm=row] tfoot td:before{content:attr(data-ku4-column-header)}}";
|
4
|
+
|
5
|
+
const Ku4Table = class {
|
6
|
+
constructor(hostRef) {
|
7
|
+
registerInstance(this, hostRef);
|
8
|
+
/**
|
9
|
+
* The member to stack on at extra-small views.
|
10
|
+
*/
|
11
|
+
// eslint-disable-next-line @stencil/strict-mutable
|
12
|
+
this.stackXs = '';
|
13
|
+
/**
|
14
|
+
* The member to stack on at small views.
|
15
|
+
*/
|
16
|
+
// eslint-disable-next-line @stencil/strict-mutable
|
17
|
+
this.stackSm = '';
|
18
|
+
}
|
19
|
+
stack() {
|
20
|
+
const theadHeaders = [].slice.call(this.host.querySelectorAll('thead th'));
|
21
|
+
const tbodyHeaders = [].slice.call(this.host.querySelectorAll('tbody th'));
|
22
|
+
const tfootHeaders = [].slice.call(this.host.querySelectorAll('tfoot th'));
|
23
|
+
const hasBodyHeaders = tbodyHeaders.length > 0;
|
24
|
+
const headerRows = this.host.querySelector('thead tr :first-child');
|
25
|
+
if (hasBodyHeaders) {
|
26
|
+
headerRows.classList.add('ku4-head-header');
|
27
|
+
}
|
28
|
+
theadHeaders.forEach((th, i) => {
|
29
|
+
// eslint-disable-next-line no-param-reassign
|
30
|
+
th.style.order = i + (!hasBodyHeaders);
|
31
|
+
});
|
32
|
+
[].slice.call(this.host.querySelectorAll('tbody tr')).forEach((tr, i) => {
|
33
|
+
[].slice.call(tr.querySelectorAll('td')).forEach((element, j) => {
|
34
|
+
// eslint-disable-next-line no-param-reassign
|
35
|
+
element.style.order = j + 1;
|
36
|
+
try {
|
37
|
+
const columnHeader = theadHeaders[j + hasBodyHeaders];
|
38
|
+
const rowHeader = tbodyHeaders[i];
|
39
|
+
element.setAttribute('data-ku4-column-header', columnHeader.getAttribute('data-ku4-stack-header') || columnHeader.textContent);
|
40
|
+
element.setAttribute('data-ku4-row-header', rowHeader.getAttribute('data-ku4-stack-header') || rowHeader.textContent);
|
41
|
+
}
|
42
|
+
catch (e) { /*Fail silently*/ }
|
43
|
+
});
|
44
|
+
});
|
45
|
+
[].slice.call(this.host.querySelectorAll('tfoot tr')).forEach((tr, i) => {
|
46
|
+
[].slice.call(tr.querySelectorAll('td')).forEach((element, j) => {
|
47
|
+
// eslint-disable-next-line no-param-reassign
|
48
|
+
element.style.order = j + 1;
|
49
|
+
try {
|
50
|
+
const columnHeader = theadHeaders[j + hasBodyHeaders];
|
51
|
+
const rowHeader = tfootHeaders[i];
|
52
|
+
element.setAttribute('data-ku4-column-header', columnHeader.getAttribute('data-ku4-stack-header') || columnHeader.textContent);
|
53
|
+
element.setAttribute('data-ku4-row-header', rowHeader.getAttribute('data-ku4-stack-header') || rowHeader.textContent);
|
54
|
+
}
|
55
|
+
catch (e) { /*Fail silently*/ }
|
56
|
+
});
|
57
|
+
});
|
58
|
+
}
|
59
|
+
componentDidLoad() {
|
60
|
+
this.stack();
|
61
|
+
this.mutationObserver = new MutationObserver(() => this.stack());
|
62
|
+
this.mutationObserver.observe(this.host, { childList: true, subtree: true });
|
63
|
+
}
|
64
|
+
disconnectedCallback() {
|
65
|
+
try {
|
66
|
+
this.mutationObserver.disconnect();
|
67
|
+
}
|
68
|
+
catch (e) {
|
69
|
+
/** Fail silently **/
|
70
|
+
}
|
71
|
+
}
|
72
|
+
render() {
|
73
|
+
return h("slot", null);
|
74
|
+
}
|
75
|
+
get host() { return getElement(this); }
|
76
|
+
};
|
77
|
+
Ku4Table.style = ku4TableCss;
|
78
|
+
|
79
|
+
export { Ku4Table as ku4_table };
|
@@ -0,0 +1 @@
|
|
1
|
+
System.register(["./index-29f2b09f.system.js"],(function(t){"use strict";var e,a,o;return{setters:[function(t){e=t.r;a=t.h;o=t.g}],execute:function(){var s="ku4-table{position:relative;display:block}@media only screen and (min-width: 1px) and (max-width: 767px){@supports (display: contents){ku4-table[stack-xs=column] table{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}ku4-table[stack-xs=column] thead,ku4-table[stack-xs=column] tbody,ku4-table[stack-xs=column] tfoot,ku4-table[stack-xs=column] tr{display:contents}ku4-table[stack-xs=column] thead .ku4-head-header{display:none}ku4-table[stack-xs=column] tbody th,ku4-table[stack-xs=column] tfoot th{position:absolute;display:block;width:0;height:0;margin:0;padding:0;line-height:0;font-size:0}ku4-table[stack-xs=column] tbody td,ku4-table[stack-xs=column] tfoot td{display:-ms-flexbox;display:flex}ku4-table[stack-xs=column] tbody td:before,ku4-table[stack-xs=column] tfoot td:before{content:attr(data-ku4-row-header)}}ku4-table[stack-xs=row] table{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}ku4-table[stack-xs=row] thead th,ku4-table[stack-xs=row] thead td{display:none}ku4-table[stack-xs=row] thead,ku4-table[stack-xs=row] tbody,ku4-table[stack-xs=row] tfoot,ku4-table[stack-xs=row] tr,ku4-table[stack-xs=row] th,ku4-table[stack-xs=row] td{display:block}ku4-table[stack-xs=row] tbody td:before,ku4-table[stack-xs=row] tfoot td:before{content:attr(data-ku4-column-header)}}@media only screen and (min-width: 768px) and (max-width: 991px){@supports (display: contents){ku4-table[stack-sm=column] table{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}ku4-table[stack-sm=column] thead,ku4-table[stack-sm=column] tbody,ku4-table[stack-sm=column] tfoot,ku4-table[stack-sm=column] tr{display:contents}ku4-table[stack-sm=column] thead .ku4-head-header{display:none}ku4-table[stack-sm=column] tbody th,ku4-table[stack-sm=column] tfoot th{position:absolute;display:block;width:0;height:0;margin:0;padding:0;line-height:0;font-size:0}ku4-table[stack-sm=column] tbody td,ku4-table[stack-sm=column] tfoot td{display:-ms-flexbox;display:flex}ku4-table[stack-sm=column] tbody td:before,ku4-table[stack-sm=column] tfoot td:before{content:attr(data-ku4-row-header)}}ku4-table[stack-sm=row] table{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}ku4-table[stack-sm=row] thead th,ku4-table[stack-sm=row] thead td{display:none}ku4-table[stack-sm=row] thead,ku4-table[stack-sm=row] tbody,ku4-table[stack-sm=row] tfoot,ku4-table[stack-sm=row] tr,ku4-table[stack-sm=row] th,ku4-table[stack-sm=row] td{display:block}ku4-table[stack-sm=row] tbody td:before,ku4-table[stack-sm=row] tfoot td:before{content:attr(data-ku4-column-header)}}";var l=t("ku4_table",function(){function t(t){e(this,t);this.stackXs="";this.stackSm=""}t.prototype.stack=function(){var t=[].slice.call(this.host.querySelectorAll("thead th"));var e=[].slice.call(this.host.querySelectorAll("tbody th"));var a=[].slice.call(this.host.querySelectorAll("tfoot th"));var o=e.length>0;var s=this.host.querySelector("thead tr :first-child");if(o){s.classList.add("ku4-head-header")}t.forEach((function(t,e){t.style.order=e+!o}));[].slice.call(this.host.querySelectorAll("tbody tr")).forEach((function(a,s){[].slice.call(a.querySelectorAll("td")).forEach((function(a,l){a.style.order=l+1;try{var c=t[l+o];var r=e[s];a.setAttribute("data-ku4-column-header",c.getAttribute("data-ku4-stack-header")||c.textContent);a.setAttribute("data-ku4-row-header",r.getAttribute("data-ku4-stack-header")||r.textContent)}catch(u){}}))}));[].slice.call(this.host.querySelectorAll("tfoot tr")).forEach((function(e,s){[].slice.call(e.querySelectorAll("td")).forEach((function(e,l){e.style.order=l+1;try{var c=t[l+o];var r=a[s];e.setAttribute("data-ku4-column-header",c.getAttribute("data-ku4-stack-header")||c.textContent);e.setAttribute("data-ku4-row-header",r.getAttribute("data-ku4-stack-header")||r.textContent)}catch(u){}}))}))};t.prototype.componentDidLoad=function(){var t=this;this.stack();this.mutationObserver=new MutationObserver((function(){return t.stack()}));this.mutationObserver.observe(this.host,{childList:true,subtree:true})};t.prototype.disconnectedCallback=function(){try{this.mutationObserver.disconnect()}catch(t){}};t.prototype.render=function(){return a("slot",null)};Object.defineProperty(t.prototype,"host",{get:function(){return o(this)},enumerable:false,configurable:true});return t}());l.style=s}}}));
|
@@ -0,0 +1,120 @@
|
|
1
|
+
import { r as registerInstance, h, f as Host, g as getElement } from './index-a02dcfc8.js';
|
2
|
+
import { C, j, M } from './index-6cfd87e4.js';
|
3
|
+
|
4
|
+
const ku4TooltipCss = ":host{position:fixed;display:none;opacity:0;z-index:2;background-color:#fff;border:solid 1px #ccc}:host([visible]){display:block;opacity:1;-webkit-transition:opacity 0.4s;transition:opacity 0.4s}:host .arrow{position:absolute;width:var(--ku4-tooltip-arrow-size, 14px);height:var(--ku4-tooltip-arrow-size, 14px);background-color:inherit;-webkit-transform:rotate(45deg);transform:rotate(45deg);border:inherit;-webkit-box-shadow:var(--ku4-tooltip-arrow-box-shadow, none);box-shadow:var(--ku4-tooltip-arrow-box-shadow, none)}:host .content{position:relative}:host([top]) .arrow{top:calc(100% - var(--ku4-tooltip-arrow-offset, 7px));left:calc(50% - var(--ku4-tooltip-arrow-offset, 7px));border-top:none !important;border-left:none !important}:host([left]) .arrow{top:calc(50% - var(--ku4-tooltip-arrow-offset, 7px));left:calc(100% - var(--ku4-tooltip-arrow-offset, 7px));border-left:none !important;border-bottom:none !important}:host([bottom]) .arrow{left:calc(50% - var(--ku4-tooltip-arrow-offset, 7px));bottom:calc(100% - var(--ku4-tooltip-arrow-offset, 7px));border-bottom:none !important;border-right:none !important}:host([right]) .arrow{top:calc(50% - var(--ku4-tooltip-arrow-offset, 7px));right:calc(100% - var(--ku4-tooltip-arrow-offset, 7px));border-top:none !important;border-right:none !important}";
|
5
|
+
|
6
|
+
const Ku4Tooltip = class {
|
7
|
+
constructor(hostRef) {
|
8
|
+
registerInstance(this, hostRef);
|
9
|
+
this.isShowing = false;
|
10
|
+
this.show = this.show.bind(this);
|
11
|
+
this.hide = this.hide.bind(this);
|
12
|
+
this._show = this._show.bind(this);
|
13
|
+
this._hide = this._hide.bind(this);
|
14
|
+
this._toggle = this._toggle.bind(this);
|
15
|
+
this.hideTimeout = new C(200).onTimeout(this._hide);
|
16
|
+
}
|
17
|
+
/**
|
18
|
+
* Show tooltip on target element.
|
19
|
+
* @param {HTMLElement} element - Element to show tooltip on
|
20
|
+
*/
|
21
|
+
async show(element) {
|
22
|
+
this.hideTimeout.clear();
|
23
|
+
if (this.host.contains(element)) {
|
24
|
+
return;
|
25
|
+
}
|
26
|
+
else {
|
27
|
+
this.isShowing = true;
|
28
|
+
this.host.setAttribute('visible', 'true');
|
29
|
+
this.calcualatePosition(element);
|
30
|
+
this.scrollListener = j(() => this.calcualatePosition(element));
|
31
|
+
window.addEventListener('scroll', this.scrollListener, { passive: true });
|
32
|
+
}
|
33
|
+
}
|
34
|
+
/**
|
35
|
+
* Hide tool tip.
|
36
|
+
*/
|
37
|
+
async hide() {
|
38
|
+
this.hideTimeout.clear().start();
|
39
|
+
}
|
40
|
+
_show(e) {
|
41
|
+
this.show(e.target);
|
42
|
+
}
|
43
|
+
_hide() {
|
44
|
+
window.removeEventListener('scroll', this.scrollListener);
|
45
|
+
this.host.removeAttribute('visible');
|
46
|
+
this.isShowing = false;
|
47
|
+
}
|
48
|
+
_toggle(e) {
|
49
|
+
this.isShowing ? this._hide() : this._show(e);
|
50
|
+
}
|
51
|
+
calcualatePosition(target) {
|
52
|
+
const { left, top, width, height } = target.getBoundingClientRect();
|
53
|
+
const { left: hleft, top: htop, width: hwidth, height: hheight } = this.host.getBoundingClientRect();
|
54
|
+
const targetBox = new M(left, top, width, height);
|
55
|
+
const hostBox = new M(hleft, htop, hwidth, hheight);
|
56
|
+
/**
|
57
|
+
* The measurements aren't quite lining up with center. They are off by a small bit
|
58
|
+
* Need to figure out why.
|
59
|
+
* Also the Arrow is not lining up. Looks like some small margin mistakes fix.
|
60
|
+
* Could also stand to figure out a way to support an arrow that is white with a border.
|
61
|
+
*/
|
62
|
+
if (this.top) {
|
63
|
+
this.host.style.left = `${targetBox.origin.x + targetBox.dimensions.x / 2 - hostBox.dimensions.x / 2}px`;
|
64
|
+
this.host.style.top = `${targetBox.origin.y - hostBox.dimensions.y - 15}px`;
|
65
|
+
}
|
66
|
+
else if (this.left) {
|
67
|
+
this.host.style.left = `${targetBox.origin.x - hostBox.dimensions.x - 15}px`;
|
68
|
+
this.host.style.top = `${targetBox.origin.y + targetBox.dimensions.y / 2 - hostBox.dimensions.y / 2}px`;
|
69
|
+
}
|
70
|
+
else if (this.bottom) {
|
71
|
+
this.host.style.left = `${targetBox.origin.x + targetBox.dimensions.x / 2 - hostBox.dimensions.x / 2}px`;
|
72
|
+
this.host.style.top = `${targetBox.origin.y + targetBox.dimensions.y + 15}px`;
|
73
|
+
}
|
74
|
+
else if (this.right) {
|
75
|
+
this.host.style.left = `${targetBox.origin.x + targetBox.dimensions.x + 15}px`;
|
76
|
+
this.host.style.top = `${targetBox.origin.y + targetBox.dimensions.y / 2 - hostBox.dimensions.y / 2}px`;
|
77
|
+
}
|
78
|
+
else {
|
79
|
+
this.host.style.left = `${targetBox.origin.x + targetBox.dimensions.x / 2 - hostBox.dimensions.x / 2}px`;
|
80
|
+
this.host.style.top = `${targetBox.origin.y + targetBox.dimensions.y + 15}px`;
|
81
|
+
}
|
82
|
+
}
|
83
|
+
componentWillLoad() {
|
84
|
+
const { debug, element, host, top, left, bottom, right } = this;
|
85
|
+
if (!(top || left || bottom || right)) {
|
86
|
+
this.host.setAttribute('bottom', '');
|
87
|
+
}
|
88
|
+
document.querySelectorAll(element).forEach((element) => {
|
89
|
+
host.addEventListener('mouseover', this._show);
|
90
|
+
element.addEventListener('mouseover', this._show);
|
91
|
+
element.addEventListener('touchstart', this._toggle, { passive: true });
|
92
|
+
if (debug) {
|
93
|
+
return;
|
94
|
+
}
|
95
|
+
host.addEventListener('mouseout', this.hide);
|
96
|
+
element.addEventListener('mouseout', this.hide);
|
97
|
+
});
|
98
|
+
}
|
99
|
+
disconnectedCallback() {
|
100
|
+
const { debug, element, hideTimeout, host } = this;
|
101
|
+
document.querySelectorAll(element).forEach((element) => {
|
102
|
+
host.removeEventListener('mouseover', this._show);
|
103
|
+
element.removeEventListener('mouseover', this._show);
|
104
|
+
element.removeEventListener('touchstart', this._toggle);
|
105
|
+
if (debug) {
|
106
|
+
return;
|
107
|
+
}
|
108
|
+
host.removeEventListener('mouseout', this.hide);
|
109
|
+
element.removeEventListener('mouseout', this.hide);
|
110
|
+
});
|
111
|
+
hideTimeout.clear();
|
112
|
+
}
|
113
|
+
render() {
|
114
|
+
return (h(Host, { role: "tooltip" }, h("div", { class: "arrow" }), h("div", { class: "content" }, h("slot", null))));
|
115
|
+
}
|
116
|
+
get host() { return getElement(this); }
|
117
|
+
};
|
118
|
+
Ku4Tooltip.style = ku4TooltipCss;
|
119
|
+
|
120
|
+
export { Ku4Tooltip as ku4_tooltip };
|
@@ -0,0 +1 @@
|
|
1
|
+
var __awaiter=this&&this.__awaiter||function(t,o,e,i){function n(t){return t instanceof e?t:new e((function(o){o(t)}))}return new(e||(e=Promise))((function(e,r){function s(t){try{h(i.next(t))}catch(o){r(o)}}function a(t){try{h(i["throw"](t))}catch(o){r(o)}}function h(t){t.done?e(t.value):n(t.value).then(s,a)}h((i=i.apply(t,o||[])).next())}))};var __generator=this&&this.__generator||function(t,o){var e={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},i,n,r,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(t){return function(o){return h([t,o])}}function h(s){if(i)throw new TypeError("Generator is already executing.");while(e)try{if(i=1,n&&(r=s[0]&2?n["return"]:s[0]?n["throw"]||((r=n["return"])&&r.call(n),0):n.next)&&!(r=r.call(n,s[1])).done)return r;if(n=0,r)s=[s[0]&2,r.value];switch(s[0]){case 0:case 1:r=s;break;case 4:e.label++;return{value:s[1],done:false};case 5:e.label++;n=s[1];s=[0];continue;case 7:s=e.ops.pop();e.trys.pop();continue;default:if(!(r=e.trys,r=r.length>0&&r[r.length-1])&&(s[0]===6||s[0]===2)){e=0;continue}if(s[0]===3&&(!r||s[1]>r[0]&&s[1]<r[3])){e.label=s[1];break}if(s[0]===6&&e.label<r[1]){e.label=r[1];r=s;break}if(r&&e.label<r[2]){e.label=r[2];e.ops.push(s);break}if(r[2])e.ops.pop();e.trys.pop();continue}s=o.call(t,e)}catch(a){s=[6,a];n=0}finally{i=r=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};System.register(["./index-29f2b09f.system.js","./index-5d0cb00d.system.js"],(function(t){"use strict";var o,e,i,n,r,s,a;return{setters:[function(t){o=t.r;e=t.h;i=t.f;n=t.g},function(t){r=t.C;s=t.j;a=t.M}],execute:function(){var h=":host{position:fixed;display:none;opacity:0;z-index:2;background-color:#fff;border:solid 1px #ccc}:host([visible]){display:block;opacity:1;-webkit-transition:opacity 0.4s;transition:opacity 0.4s}:host .arrow{position:absolute;width:var(--ku4-tooltip-arrow-size, 14px);height:var(--ku4-tooltip-arrow-size, 14px);background-color:inherit;-webkit-transform:rotate(45deg);transform:rotate(45deg);border:inherit;-webkit-box-shadow:var(--ku4-tooltip-arrow-box-shadow, none);box-shadow:var(--ku4-tooltip-arrow-box-shadow, none)}:host .content{position:relative}:host([top]) .arrow{top:calc(100% - var(--ku4-tooltip-arrow-offset, 7px));left:calc(50% - var(--ku4-tooltip-arrow-offset, 7px));border-top:none !important;border-left:none !important}:host([left]) .arrow{top:calc(50% - var(--ku4-tooltip-arrow-offset, 7px));left:calc(100% - var(--ku4-tooltip-arrow-offset, 7px));border-left:none !important;border-bottom:none !important}:host([bottom]) .arrow{left:calc(50% - var(--ku4-tooltip-arrow-offset, 7px));bottom:calc(100% - var(--ku4-tooltip-arrow-offset, 7px));border-bottom:none !important;border-right:none !important}:host([right]) .arrow{top:calc(50% - var(--ku4-tooltip-arrow-offset, 7px));right:calc(100% - var(--ku4-tooltip-arrow-offset, 7px));border-top:none !important;border-right:none !important}";var l=t("ku4_tooltip",function(){function t(t){o(this,t);this.isShowing=false;this.show=this.show.bind(this);this.hide=this.hide.bind(this);this._show=this._show.bind(this);this._hide=this._hide.bind(this);this._toggle=this._toggle.bind(this);this.hideTimeout=new r(200).onTimeout(this._hide)}t.prototype.show=function(t){return __awaiter(this,void 0,void 0,(function(){var o=this;return __generator(this,(function(e){this.hideTimeout.clear();if(this.host.contains(t)){return[2]}else{this.isShowing=true;this.host.setAttribute("visible","true");this.calcualatePosition(t);this.scrollListener=s((function(){return o.calcualatePosition(t)}));window.addEventListener("scroll",this.scrollListener,{passive:true})}return[2]}))}))};t.prototype.hide=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){this.hideTimeout.clear().start();return[2]}))}))};t.prototype._show=function(t){this.show(t.target)};t.prototype._hide=function(){window.removeEventListener("scroll",this.scrollListener);this.host.removeAttribute("visible");this.isShowing=false};t.prototype._toggle=function(t){this.isShowing?this._hide():this._show(t)};t.prototype.calcualatePosition=function(t){var o=t.getBoundingClientRect(),e=o.left,i=o.top,n=o.width,r=o.height;var s=this.host.getBoundingClientRect(),h=s.left,l=s.top,c=s.width,u=s.height;var p=new a(e,i,n,r);var f=new a(h,l,c,u);if(this.top){this.host.style.left="".concat(p.origin.x+p.dimensions.x/2-f.dimensions.x/2,"px");this.host.style.top="".concat(p.origin.y-f.dimensions.y-15,"px")}else if(this.left){this.host.style.left="".concat(p.origin.x-f.dimensions.x-15,"px");this.host.style.top="".concat(p.origin.y+p.dimensions.y/2-f.dimensions.y/2,"px")}else if(this.bottom){this.host.style.left="".concat(p.origin.x+p.dimensions.x/2-f.dimensions.x/2,"px");this.host.style.top="".concat(p.origin.y+p.dimensions.y+15,"px")}else if(this.right){this.host.style.left="".concat(p.origin.x+p.dimensions.x+15,"px");this.host.style.top="".concat(p.origin.y+p.dimensions.y/2-f.dimensions.y/2,"px")}else{this.host.style.left="".concat(p.origin.x+p.dimensions.x/2-f.dimensions.x/2,"px");this.host.style.top="".concat(p.origin.y+p.dimensions.y+15,"px")}};t.prototype.componentWillLoad=function(){var t=this;var o=this,e=o.debug,i=o.element,n=o.host,r=o.top,s=o.left,a=o.bottom,h=o.right;if(!(r||s||a||h)){this.host.setAttribute("bottom","")}document.querySelectorAll(i).forEach((function(o){n.addEventListener("mouseover",t._show);o.addEventListener("mouseover",t._show);o.addEventListener("touchstart",t._toggle,{passive:true});if(e){return}n.addEventListener("mouseout",t.hide);o.addEventListener("mouseout",t.hide)}))};t.prototype.disconnectedCallback=function(){var t=this;var o=this,e=o.debug,i=o.element,n=o.hideTimeout,r=o.host;document.querySelectorAll(i).forEach((function(o){r.removeEventListener("mouseover",t._show);o.removeEventListener("mouseover",t._show);o.removeEventListener("touchstart",t._toggle);if(e){return}r.removeEventListener("mouseout",t.hide);o.removeEventListener("mouseout",t.hide)}));n.clear()};t.prototype.render=function(){return e(i,{role:"tooltip"},e("div",{class:"arrow"}),e("div",{class:"content"},e("slot",null)))};Object.defineProperty(t.prototype,"host",{get:function(){return n(this)},enumerable:false,configurable:true});return t}());l.style=h}}}));
|
@@ -0,0 +1,162 @@
|
|
1
|
+
import { r as registerInstance, e as createEvent, h, f as Host, g as getElement } from './index-a02dcfc8.js';
|
2
|
+
import { t, R, Y } from './index-6cfd87e4.js';
|
3
|
+
|
4
|
+
/**
|
5
|
+
* Business logic for form validation:
|
6
|
+
* It tests against a list of regular expressions that all must pass for this
|
7
|
+
* to return true. And IFF an element is passed it will also have to match this value.
|
8
|
+
* @param {Array<RegExp>} expressions - List of regular expressions to test against.
|
9
|
+
* @param {string} value - The value to test
|
10
|
+
* @param {Array<string>} [options] - A list of valid options that this value must match if not null
|
11
|
+
* @param {HTMLElement} [element] - An element to test if the value matches its value if not null.
|
12
|
+
*/
|
13
|
+
const validate = (expressions, value, options, element) => options
|
14
|
+
? options.some(v => v === value) && expressions.every(r => r.test(value))
|
15
|
+
: element
|
16
|
+
? element.value === value && expressions.every(r => r.test(value))
|
17
|
+
: expressions.every(r => r.test(value));
|
18
|
+
|
19
|
+
const ku4ValidationCss = ":host{visibility:hidden !important}:host([invalid]){visibility:visible !important}:host([disabled]){visibility:hidden !important}:host([invalid][disabled]){visibility:hidden !important}:host([invalid][hidden]){visibility:hidden !important}";
|
20
|
+
|
21
|
+
const Ku4Validation = class {
|
22
|
+
constructor(hostRef) {
|
23
|
+
registerInstance(this, hostRef);
|
24
|
+
this.didValidate = createEvent(this, "validate", 7);
|
25
|
+
/**
|
26
|
+
* Validation RegExp pattern that the target field must match to
|
27
|
+
* be considered valid. Multiple patterns can be passed delimited
|
28
|
+
* by a `space` character. e.g. pattern1 pattern2 pattern3 etc.
|
29
|
+
* If your target field is optional you can accomplish this with
|
30
|
+
* your pattern using "(^$)|(YOUR-PATTERN)". This says that the
|
31
|
+
* field must be empty (^$) OR (YOUR-PATTERN).
|
32
|
+
*/
|
33
|
+
this.pattern = '.*';
|
34
|
+
/**
|
35
|
+
* Any RegExp flags that you want to include in your pattern. Multiple
|
36
|
+
* patterns can be passed delimited by a `space` character. e.g.
|
37
|
+
* using the pattern1 pattern2 pattern3 example from the `pattern`
|
38
|
+
* property, you could pass "gimsuy gim gi". If you wanted to pass
|
39
|
+
* flags only for patterns 1 and 3 you will just skip flags for pattern2
|
40
|
+
* by typing nothing and instead typing another "space" e.g. "gimsuy gi".
|
41
|
+
* If you wanted to skip flags for pattern1 you could start flags with a
|
42
|
+
* "space" e.g. " gim gi".
|
43
|
+
*/
|
44
|
+
this.flags = '';
|
45
|
+
/**
|
46
|
+
* A reference to a named function or a function body that
|
47
|
+
* define a validation criteria and return `true` when the
|
48
|
+
* defined validation criteria are satisfied.
|
49
|
+
* The function will be called with one argument, `value`,
|
50
|
+
* that will contain the current value of the target field.
|
51
|
+
* Example: method="return value === 'valid'", or
|
52
|
+
* function validate(value) { return value === 'valid'; }
|
53
|
+
* method="validate(value)"
|
54
|
+
*/
|
55
|
+
this.method = '';
|
56
|
+
const patterns = this.pattern.split(' ');
|
57
|
+
const flags = this.flags.split(' ');
|
58
|
+
const method = this.method.trim();
|
59
|
+
this.regex = patterns.map((pattern, i) => new RegExp(pattern, flags[i]));
|
60
|
+
this.validationMethod = t.isNullOrEmpty(method)
|
61
|
+
? () => true
|
62
|
+
: new Function('value', (/^return/.test(method) ? method : `return ${method}`));
|
63
|
+
this.handleInput = this.handleInput.bind(this);
|
64
|
+
this.handleChange = this.handleChange.bind(this);
|
65
|
+
this.handleBlur = this.handleBlur.bind(this);
|
66
|
+
this.handleReset = this.handleReset.bind(this);
|
67
|
+
}
|
68
|
+
/**
|
69
|
+
* Call to explicitly validate this validation. This method
|
70
|
+
* is called internally on change and blur of the input internally.
|
71
|
+
* There is no default need to call this method.
|
72
|
+
*/
|
73
|
+
async validate() {
|
74
|
+
return this.assert();
|
75
|
+
}
|
76
|
+
handleInput() {
|
77
|
+
(this.input.type === 'file' || t.isFalse(this.isValid)) && this.assert();
|
78
|
+
}
|
79
|
+
handleChange() {
|
80
|
+
(this.input.type === 'file' || t.isFalse(this.isValid)) && this.assert();
|
81
|
+
}
|
82
|
+
handleBlur() {
|
83
|
+
this.assert();
|
84
|
+
}
|
85
|
+
handleReset() {
|
86
|
+
this.isValid = true;
|
87
|
+
this.invalid = !this.isValid;
|
88
|
+
this.input.setAttribute('aria-invalid', this.invalid);
|
89
|
+
}
|
90
|
+
assert() {
|
91
|
+
const { ele, validOptions, input, regex, checked } = this;
|
92
|
+
if (input.type === 'file' && t.isNullOrEmpty(input.value)) {
|
93
|
+
return;
|
94
|
+
}
|
95
|
+
const previousIsValid = this.isValid;
|
96
|
+
this.isValid = this.disabled
|
97
|
+
? true
|
98
|
+
: t.isBool(checked)
|
99
|
+
? input.checked === checked
|
100
|
+
: validate(regex, input.value, validOptions, ele) && this.validationMethod(input.value);
|
101
|
+
this.invalid = !this.isValid;
|
102
|
+
input.setAttribute('aria-invalid', this.invalid);
|
103
|
+
if (t.isFalse(previousIsValid) && this.isValid) {
|
104
|
+
this.didValidate.emit(this.isValid);
|
105
|
+
}
|
106
|
+
return this.isValid;
|
107
|
+
}
|
108
|
+
componentWillLoad() {
|
109
|
+
this.input = document.getElementById(this.for);
|
110
|
+
if (t.exists(this.input)) {
|
111
|
+
this.ele = document.getElementById(this.element) || document.querySelector(this.element);
|
112
|
+
this.validOptions = t.exists(this.values)
|
113
|
+
? this.values.split(',')
|
114
|
+
: (this.ele && this.ele.nodeName === 'DATALIST' &&
|
115
|
+
[].slice.call(this.ele.querySelectorAll('option'))
|
116
|
+
.map(option => option.value));
|
117
|
+
const describedby = this.input.getAttribute('aria-describedby');
|
118
|
+
const id = this.host.getAttribute('id') || R.uid();
|
119
|
+
this.host.setAttribute('id', id);
|
120
|
+
if (t.isNullOrEmpty(describedby)) {
|
121
|
+
this.input.setAttribute('aria-describedby', id);
|
122
|
+
}
|
123
|
+
/**
|
124
|
+
* We "wait" to put this on the next event loop. This allows
|
125
|
+
* ku4-mask to be placed anywhere in the dom and not affect
|
126
|
+
* to workings of ku4-validation.
|
127
|
+
*/
|
128
|
+
Y(0).then(() => {
|
129
|
+
this.input.addEventListener('input', this.handleInput);
|
130
|
+
this.input.addEventListener('change', this.handleChange);
|
131
|
+
this.input.addEventListener('blur', this.handleBlur);
|
132
|
+
});
|
133
|
+
if (t.isFunction(this.host.closest)) {
|
134
|
+
this.form = this.host.closest('form');
|
135
|
+
if (this.form && this.form.addEventListener) {
|
136
|
+
this.form.addEventListener('reset', this.handleReset);
|
137
|
+
}
|
138
|
+
}
|
139
|
+
}
|
140
|
+
else {
|
141
|
+
// eslint-disable-next-line no-console
|
142
|
+
console.error('ku4-validation must have a valid `for` referencing target field `id`.');
|
143
|
+
}
|
144
|
+
}
|
145
|
+
disconnectedCallback() {
|
146
|
+
if (this.input && this.input.removeEventListener) {
|
147
|
+
this.input.removeEventListener('input', this.handleInput);
|
148
|
+
this.input.removeEventListener('change', this.handleChange);
|
149
|
+
this.input.removeEventListener('blur', this.handleBlur);
|
150
|
+
}
|
151
|
+
if (this.form && this.form.removeEventListener) {
|
152
|
+
this.form.removeEventListener('reset', this.handleReset);
|
153
|
+
}
|
154
|
+
}
|
155
|
+
render() {
|
156
|
+
return h(Host, { role: "alert", "aria-live": "assertive" }, h("slot", null));
|
157
|
+
}
|
158
|
+
get host() { return getElement(this); }
|
159
|
+
};
|
160
|
+
Ku4Validation.style = ku4ValidationCss;
|
161
|
+
|
162
|
+
export { Ku4Validation as ku4_validation };
|
@@ -0,0 +1 @@
|
|
1
|
+
var __awaiter=this&&this.__awaiter||function(t,e,i,n){function s(t){return t instanceof i?t:new i((function(e){e(t)}))}return new(i||(i=Promise))((function(i,r){function a(t){try{o(n.next(t))}catch(e){r(e)}}function l(t){try{o(n["throw"](t))}catch(e){r(e)}}function o(t){t.done?i(t.value):s(t.value).then(a,l)}o((n=n.apply(t,e||[])).next())}))};var __generator=this&&this.__generator||function(t,e){var i={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},n,s,r,a;return a={next:l(0),throw:l(1),return:l(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function l(t){return function(e){return o([t,e])}}function o(a){if(n)throw new TypeError("Generator is already executing.");while(i)try{if(n=1,s&&(r=a[0]&2?s["return"]:a[0]?s["throw"]||((r=s["return"])&&r.call(s),0):s.next)&&!(r=r.call(s,a[1])).done)return r;if(s=0,r)a=[a[0]&2,r.value];switch(a[0]){case 0:case 1:r=a;break;case 4:i.label++;return{value:a[1],done:false};case 5:i.label++;s=a[1];a=[0];continue;case 7:a=i.ops.pop();i.trys.pop();continue;default:if(!(r=i.trys,r=r.length>0&&r[r.length-1])&&(a[0]===6||a[0]===2)){i=0;continue}if(a[0]===3&&(!r||a[1]>r[0]&&a[1]<r[3])){i.label=a[1];break}if(a[0]===6&&i.label<r[1]){i.label=r[1];r=a;break}if(r&&i.label<r[2]){i.label=r[2];i.ops.push(a);break}if(r[2])i.ops.pop();i.trys.pop();continue}a=e.call(t,i)}catch(l){a=[6,l];s=0}finally{n=r=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};System.register(["./index-29f2b09f.system.js","./index-5d0cb00d.system.js"],(function(t){"use strict";var e,i,n,s,r,a,l,o;return{setters:[function(t){e=t.r;i=t.e;n=t.h;s=t.f;r=t.g},function(t){a=t.t;l=t.R;o=t.Y}],execute:function(){var h=function(t,e,i,n){return i?i.some((function(t){return t===e}))&&t.every((function(t){return t.test(e)})):n?n.value===e&&t.every((function(t){return t.test(e)})):t.every((function(t){return t.test(e)}))};var u=":host{visibility:hidden !important}:host([invalid]){visibility:visible !important}:host([disabled]){visibility:hidden !important}:host([invalid][disabled]){visibility:hidden !important}:host([invalid][hidden]){visibility:hidden !important}";var d=t("ku4_validation",function(){function t(t){e(this,t);this.didValidate=i(this,"validate",7);this.pattern=".*";this.flags="";this.method="";var n=this.pattern.split(" ");var s=this.flags.split(" ");var r=this.method.trim();this.regex=n.map((function(t,e){return new RegExp(t,s[e])}));this.validationMethod=a.isNullOrEmpty(r)?function(){return true}:new Function("value",/^return/.test(r)?r:"return ".concat(r));this.handleInput=this.handleInput.bind(this);this.handleChange=this.handleChange.bind(this);this.handleBlur=this.handleBlur.bind(this);this.handleReset=this.handleReset.bind(this)}t.prototype.validate=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){return[2,this.assert()]}))}))};t.prototype.handleInput=function(){(this.input.type==="file"||a.isFalse(this.isValid))&&this.assert()};t.prototype.handleChange=function(){(this.input.type==="file"||a.isFalse(this.isValid))&&this.assert()};t.prototype.handleBlur=function(){this.assert()};t.prototype.handleReset=function(){this.isValid=true;this.invalid=!this.isValid;this.input.setAttribute("aria-invalid",this.invalid)};t.prototype.assert=function(){var t=this,e=t.ele,i=t.validOptions,n=t.input,s=t.regex,r=t.checked;if(n.type==="file"&&a.isNullOrEmpty(n.value)){return}var l=this.isValid;this.isValid=this.disabled?true:a.isBool(r)?n.checked===r:h(s,n.value,i,e)&&this.validationMethod(n.value);this.invalid=!this.isValid;n.setAttribute("aria-invalid",this.invalid);if(a.isFalse(l)&&this.isValid){this.didValidate.emit(this.isValid)}return this.isValid};t.prototype.componentWillLoad=function(){var t=this;this.input=document.getElementById(this.for);if(a.exists(this.input)){this.ele=document.getElementById(this.element)||document.querySelector(this.element);this.validOptions=a.exists(this.values)?this.values.split(","):this.ele&&this.ele.nodeName==="DATALIST"&&[].slice.call(this.ele.querySelectorAll("option")).map((function(t){return t.value}));var e=this.input.getAttribute("aria-describedby");var i=this.host.getAttribute("id")||l.uid();this.host.setAttribute("id",i);if(a.isNullOrEmpty(e)){this.input.setAttribute("aria-describedby",i)}o(0).then((function(){t.input.addEventListener("input",t.handleInput);t.input.addEventListener("change",t.handleChange);t.input.addEventListener("blur",t.handleBlur)}));if(a.isFunction(this.host.closest)){this.form=this.host.closest("form");if(this.form&&this.form.addEventListener){this.form.addEventListener("reset",this.handleReset)}}}else{console.error("ku4-validation must have a valid `for` referencing target field `id`.")}};t.prototype.disconnectedCallback=function(){if(this.input&&this.input.removeEventListener){this.input.removeEventListener("input",this.handleInput);this.input.removeEventListener("change",this.handleChange);this.input.removeEventListener("blur",this.handleBlur)}if(this.form&&this.form.removeEventListener){this.form.removeEventListener("reset",this.handleReset)}};t.prototype.render=function(){return n(s,{role:"alert","aria-live":"assertive"},n("slot",null))};Object.defineProperty(t.prototype,"host",{get:function(){return r(this)},enumerable:false,configurable:true});return t}());d.style=u}}}));
|