ku4web-components 6.4.80 → 6.4.83
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-6ca600c2.js +6 -0
- package/dist/cjs/dom-8d415461.js +75 -0
- package/dist/cjs/index-652a3cbf.js +14 -0
- package/dist/cjs/{index-1e13241e.js → index-a7b6d98c.js} +1 -1
- package/dist/cjs/index-c904eb3a.js +10 -0
- package/dist/cjs/index-ca4336bd.js +3093 -0
- package/dist/cjs/{index-da3ed39d.js → index-f78c109e.js} +1 -1
- package/dist/cjs/ku4-carousel-controls.cjs.entry.js +10 -4
- package/dist/cjs/ku4-carousel-slide.cjs.entry.js +1 -1
- package/dist/cjs/ku4-carousel.cjs.entry.js +14 -7
- 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 +2 -2
- 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 +103 -8
- package/dist/cjs/loader.cjs.js +19 -3
- package/dist/cjs/{shadow-css-8940f82d.js → shadow-css-78860e39.js} +1 -1
- package/dist/cjs/{uid-d6942c42.js → uid-97baaecc.js} +1 -1
- package/dist/cjs/uid-eb3bec28.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 +225 -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 +458 -0
- package/dist/collection/components/ku4-modal/ku4-modal.css +85 -0
- package/dist/collection/components/ku4-modal/ku4-modal.js +208 -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-e6dd2538.js +4 -0
- package/dist/esm/dom-7fc649b0.js +73 -0
- package/dist/esm/index-3e1e5aa3.js +3 -0
- package/dist/esm/index-7fe386de.js +3057 -0
- package/dist/esm/index-7ff6e718.js +3 -0
- package/dist/esm/{index-9e3af5f4.js → index-81a98b72.js} +1 -1
- package/dist/esm/{index-20c3926d.js → index-bdb0771a.js} +1 -1
- package/dist/esm/ku4-carousel-controls.entry.js +10 -4
- package/dist/esm/ku4-carousel-slide.entry.js +1 -1
- package/dist/esm/ku4-carousel.entry.js +14 -7
- 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 +2 -2
- 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 +103 -8
- package/dist/esm/loader.js +19 -3
- package/dist/esm/{shadow-css-5d2d01ce.js → shadow-css-4d56fa31.js} +1 -1
- package/dist/esm/{uid-15f8c937.js → uid-1ec3509b.js} +1 -1
- package/dist/esm/uid-9dbd7ad0.js +9 -0
- package/dist/esm-es5/{index-9e3af5f4.js → index-81a98b72.js} +1 -1
- package/dist/esm-es5/{index-20c3926d.js → index-bdb0771a.js} +1 -1
- package/dist/esm-es5/ku4-carousel-controls.entry.js +1 -1
- package/dist/esm-es5/ku4-carousel-slide.entry.js +1 -1
- package/dist/esm-es5/ku4-carousel.entry.js +1 -1
- package/dist/esm-es5/ku4-col.entry.js +1 -1
- package/dist/esm-es5/ku4-drawer.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-grid.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-panel.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-table.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/ku4web-components.js +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/{shadow-css-5d2d01ce.js → shadow-css-4d56fa31.js} +0 -0
- package/dist/esm-es5/uid-1ec3509b.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-b6eec689.system.js +1 -0
- package/dist/ku4web-components/css-shim-e6dd2538.js +4 -0
- package/dist/ku4web-components/dom-7fc649b0.js +73 -0
- package/dist/ku4web-components/dom-88962da0.system.js +21 -0
- package/dist/ku4web-components/index-380cbe3a.system.js +1 -0
- package/dist/ku4web-components/index-3e1e5aa3.js +3 -0
- package/dist/ku4web-components/index-5029fd1f.system.js +1 -0
- package/dist/ku4web-components/index-7d482e8a.system.js +1 -0
- package/dist/ku4web-components/index-7fe386de.js +3057 -0
- package/dist/ku4web-components/index-7ff6e718.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 +112 -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 +342 -0
- package/dist/ku4web-components/ku4-mask.system.entry.js +1 -0
- package/dist/ku4web-components/ku4-modal.entry.js +75 -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-15ee8b8e.system.entry.js → p-02328d34.system.entry.js} +1 -1
- package/dist/ku4web-components/{p-01debe28.system.entry.js → p-050f184b.system.entry.js} +1 -1
- package/dist/ku4web-components/{p-8e2fca0b.system.entry.js → p-073cefec.system.entry.js} +1 -1
- package/dist/ku4web-components/{p-22eed87f.entry.js → p-097ba217.entry.js} +1 -1
- package/dist/ku4web-components/{p-f1cc1b2d.entry.js → p-0adeb8e4.entry.js} +1 -1
- package/dist/ku4web-components/{p-840704e4.entry.js → p-0ce97586.entry.js} +1 -1
- package/dist/ku4web-components/p-0f77bef9.system.js +1 -0
- package/dist/ku4web-components/{p-761b2cbc.system.entry.js → p-136e5a03.system.entry.js} +1 -1
- package/dist/ku4web-components/p-17d548db.js +1 -0
- package/dist/ku4web-components/{p-c1068ffa.js → p-189cde73.js} +1 -1
- package/dist/ku4web-components/{p-2f2d74dc.system.entry.js → p-1d5a1caf.system.entry.js} +1 -1
- package/dist/ku4web-components/{p-a5c7f5f7.system.entry.js → p-288482da.system.entry.js} +1 -1
- package/dist/ku4web-components/{p-0e010c10.system.entry.js → p-3a0d1ff7.system.entry.js} +1 -1
- package/dist/ku4web-components/{p-d360c64a.entry.js → p-3f147a02.entry.js} +1 -1
- package/dist/ku4web-components/{p-0f8708f8.entry.js → p-3f2a008c.entry.js} +1 -1
- package/dist/ku4web-components/{p-8faad87d.entry.js → p-3f4082d5.entry.js} +1 -1
- package/dist/ku4web-components/{p-7273db60.entry.js → p-49275772.entry.js} +1 -1
- package/dist/ku4web-components/{p-232787a5.system.entry.js → p-4bfca34b.system.entry.js} +1 -1
- package/dist/ku4web-components/{p-04948520.system.entry.js → p-524cef27.system.entry.js} +1 -1
- package/dist/ku4web-components/{p-67adc5b1.system.entry.js → p-52d815ab.system.entry.js} +1 -1
- package/dist/ku4web-components/{p-2edd35f8.system.entry.js → p-596beaad.system.entry.js} +1 -1
- package/dist/ku4web-components/{p-f06bf0ae.entry.js → p-5f9d0077.entry.js} +1 -1
- package/dist/ku4web-components/{p-660ebd19.entry.js → p-5fcea805.entry.js} +1 -1
- package/dist/ku4web-components/{p-adddaeef.entry.js → p-61214088.entry.js} +1 -1
- package/dist/ku4web-components/{p-d6ec34c3.entry.js → p-66b8247f.entry.js} +1 -1
- package/dist/ku4web-components/{p-9c0d71af.system.entry.js → p-6b9e3523.system.entry.js} +1 -1
- package/dist/ku4web-components/{p-02e342f7.system.entry.js → p-6cfd9011.system.entry.js} +1 -1
- package/dist/ku4web-components/{p-8d9eb18b.system.entry.js → p-7bfc256a.system.entry.js} +1 -1
- package/dist/ku4web-components/{p-77f1853c.entry.js → p-818caf0f.entry.js} +1 -1
- package/dist/ku4web-components/{p-3874127d.entry.js → p-8642aef5.entry.js} +1 -1
- package/dist/ku4web-components/{p-f6455ab3.js → p-881e100a.js} +0 -0
- package/dist/ku4web-components/{p-19a8c0f6.system.entry.js → p-95698618.system.entry.js} +1 -1
- package/dist/ku4web-components/{p-f0b1c07c.system.js → p-96ec7b4f.system.js} +1 -1
- package/dist/ku4web-components/{p-ce6eddc3.system.entry.js → p-a0d0c99e.system.entry.js} +1 -1
- package/dist/ku4web-components/{p-b4488a7d.system.entry.js → p-acb43765.system.entry.js} +1 -1
- package/dist/ku4web-components/{p-c19fd841.entry.js → p-b47bb3d0.entry.js} +1 -1
- package/dist/ku4web-components/{p-0785fc39.system.js → p-c3293202.system.js} +1 -1
- package/dist/ku4web-components/{p-eb6882c8.entry.js → p-c798faf2.entry.js} +1 -1
- package/dist/ku4web-components/{p-3c182b2f.entry.js → p-cd0d0b40.entry.js} +1 -1
- package/dist/ku4web-components/p-cd4cdcbb.entry.js +1 -0
- package/dist/ku4web-components/{p-8f480cb5.system.entry.js → p-d848909c.system.entry.js} +1 -1
- package/dist/ku4web-components/{p-90c37394.entry.js → p-d8868855.entry.js} +1 -1
- package/dist/ku4web-components/p-db3040f3.system.js +1 -0
- package/dist/ku4web-components/{p-2aac6c90.js → p-e6b3a708.js} +1 -1
- package/dist/ku4web-components/{p-c50540ec.system.entry.js → p-ea4b32de.system.entry.js} +1 -1
- package/dist/ku4web-components/{p-e4ff1c36.entry.js → p-f3fbe1e6.entry.js} +1 -1
- package/dist/ku4web-components/p-f64c1f55.entry.js +1 -0
- package/dist/ku4web-components/{p-71d57b8b.system.js → p-fbf3ad1e.system.js} +0 -0
- package/dist/ku4web-components/{p-0eb73a0f.system.entry.js → p-fc0c3bf4.system.entry.js} +1 -1
- package/dist/ku4web-components/shadow-css-4d56fa31.js +388 -0
- package/dist/ku4web-components/shadow-css-d0426811.system.js +13 -0
- package/dist/ku4web-components/uid-9dbd7ad0.js +9 -0
- package/dist/ku4web-components/uid-fb867945.system.js +1 -0
- package/dist/types/components/ku4-carousel/ku4-carousel.d.ts +3 -2
- package/dist/types/components/ku4-carousel-controls/ku4-carousel-controls.d.ts +1 -0
- package/dist/types/components/ku4-carousel-slide/ku4-carousel-slide.d.ts +6 -0
- package/dist/types/components.d.ts +10 -2
- package/package.json +15 -15
- 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/esm-es5/uid-15f8c937.js +0 -1
- package/dist/ku4web-components/p-7a47027b.entry.js +0 -1
- package/dist/ku4web-components/p-b590da20.entry.js +0 -1
- package/dist/ku4web-components/p-be7890a1.system.js +0 -1
- package/dist/ku4web-components/p-cbbb4b1b.js +0 -1
- package/dist/ku4web-components/p-eb58b04b.system.js +0 -1
@@ -0,0 +1,29 @@
|
|
1
|
+
import { r as registerInstance, h, f as Host, g as getElement } from './index-7fe386de.js';
|
2
|
+
import { t } from './index-3e1e5aa3.js';
|
3
|
+
|
4
|
+
const Ku4Feature = class {
|
5
|
+
constructor(hostRef) {
|
6
|
+
registerInstance(this, hostRef);
|
7
|
+
/**
|
8
|
+
* A function or method that returns a boolean.
|
9
|
+
* A return value of true will turn on the this
|
10
|
+
* feature. (optional)
|
11
|
+
*/
|
12
|
+
this.policy = '';
|
13
|
+
this.enabled = false;
|
14
|
+
const policy = this.policy.trim();
|
15
|
+
this.featurePolicy = t.isNullOrEmpty(policy)
|
16
|
+
? () => false
|
17
|
+
: new Function((/^return/.test(policy) ? policy : `return ${policy}`));
|
18
|
+
}
|
19
|
+
componentWillLoad() {
|
20
|
+
const { on, featurePolicy } = this;
|
21
|
+
on || featurePolicy.call(this.host)
|
22
|
+
? this.render = () => h("slot", null)
|
23
|
+
: this.host.parentNode.removeChild(this.host);
|
24
|
+
}
|
25
|
+
render() { return h(Host, null); }
|
26
|
+
get host() { return getElement(this); }
|
27
|
+
};
|
28
|
+
|
29
|
+
export { Ku4Feature as ku4_feature };
|
@@ -0,0 +1 @@
|
|
1
|
+
System.register(["./index-5029fd1f.system.js","./index-380cbe3a.system.js"],(function(t){"use strict";var e,n,r,i,o;return{setters:[function(t){e=t.r;n=t.h;r=t.f;i=t.g},function(t){o=t.t}],execute:function(){var s=t("ku4_feature",function(){function t(t){e(this,t);this.policy="";this.enabled=false;var n=this.policy.trim();this.featurePolicy=o.isNullOrEmpty(n)?function(){return false}:new Function(/^return/.test(n)?n:"return ".concat(n))}t.prototype.componentWillLoad=function(){var t=this,e=t.on,r=t.featurePolicy;e||r.call(this.host)?this.render=function(){return n("slot",null)}:this.host.parentNode.removeChild(this.host)};t.prototype.render=function(){return n(r,null)};Object.defineProperty(t.prototype,"host",{get:function(){return i(this)},enumerable:false,configurable:true});return t}())}}}));
|
@@ -0,0 +1,323 @@
|
|
1
|
+
import { r as registerInstance, h, g as getElement } from './index-7fe386de.js';
|
2
|
+
import { t, o } from './index-3e1e5aa3.js';
|
3
|
+
import { K as Key, E as Event } from './index-7ff6e718.js';
|
4
|
+
|
5
|
+
/**
|
6
|
+
* Sets aria-hidden attribute for passed elements
|
7
|
+
* @param {Array} elements - List of elements to set aria-hidden on
|
8
|
+
* @param {boolean} [value] - Optional value for aria-hidden.
|
9
|
+
* No value will set to previous value if available.
|
10
|
+
*/
|
11
|
+
const ariaHidden = (elements, value) => {
|
12
|
+
if (!value) {
|
13
|
+
// eslint-disable-next-line @stencil/ban-side-effects
|
14
|
+
elements.forEach((element) => {
|
15
|
+
if (!element.currentAriaHidden) {
|
16
|
+
element.removeAttribute('aria-hidden');
|
17
|
+
}
|
18
|
+
else {
|
19
|
+
element.setAttribute('aria-hidden', element.currentAriaHidden);
|
20
|
+
}
|
21
|
+
});
|
22
|
+
}
|
23
|
+
else {
|
24
|
+
// eslint-disable-next-line @stencil/ban-side-effects
|
25
|
+
elements.forEach((element) => {
|
26
|
+
element.currentAriaHidden = element.getAttribute('aria-hidden');
|
27
|
+
element.setAttribute('aria-hidden', value);
|
28
|
+
});
|
29
|
+
}
|
30
|
+
};
|
31
|
+
|
32
|
+
const focusableTags = ['A', 'BUTTON', 'INPUT', 'SELECT', 'TEXTAREA'];
|
33
|
+
const isFocusable = (element) => {
|
34
|
+
const tabindex = element.getAttribute('tabindex');
|
35
|
+
return (focusableTags.includes(element.tagName.toUpperCase()) ||
|
36
|
+
element.getAttribute('href')) &&
|
37
|
+
(!tabindex || isNaN(tabindex) || parseInt(tabindex) > -1);
|
38
|
+
};
|
39
|
+
|
40
|
+
const queryFocusable = element => [].slice.call(element.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'));
|
41
|
+
const queryTabbable = element => [].slice.call(element.querySelectorAll(':not([tabindex="-1"])'));
|
42
|
+
|
43
|
+
const ku4FocusTrapCss = ":host{position:static}";
|
44
|
+
|
45
|
+
const { tab } = Key;
|
46
|
+
const tabShift = Key.tab.shift;
|
47
|
+
const tabAlt = Key.tab.alt;
|
48
|
+
const tabAltShift = Key.tab.alt.shift;
|
49
|
+
const Ku4FocusTrap = class {
|
50
|
+
constructor(hostRef) {
|
51
|
+
registerInstance(this, hostRef);
|
52
|
+
this.iframes = [];
|
53
|
+
/**
|
54
|
+
* Focus trap will be active when true.
|
55
|
+
*/
|
56
|
+
this.active = false;
|
57
|
+
this.handleKeyDown = this.handleKeyDown.bind(this);
|
58
|
+
this.handleKeyUp = this.handleKeyUp.bind(this);
|
59
|
+
this.handleMouse = this.handleMouse.bind(this);
|
60
|
+
}
|
61
|
+
activeHandler(value) {
|
62
|
+
value ? this.handleActivate() : this.handleDeactivate();
|
63
|
+
}
|
64
|
+
/**
|
65
|
+
* Activate focus trap
|
66
|
+
* @param {Element} [element] - Element to return focus to when trap is deactivated.
|
67
|
+
*/
|
68
|
+
async activate(element) {
|
69
|
+
this.lastActiveElement = element || document.querySelector(this.return || null);
|
70
|
+
this.active = true;
|
71
|
+
}
|
72
|
+
/**
|
73
|
+
* Deactivate focus trap.
|
74
|
+
*/
|
75
|
+
async deactivate() {
|
76
|
+
this.active = false;
|
77
|
+
}
|
78
|
+
handleActivate() {
|
79
|
+
this.lastActiveElement = this.lastActiveElement || document.activeElement;
|
80
|
+
if (this.lastActiveElement && this.lastActiveElement.blur) {
|
81
|
+
this.lastActiveElement.blur();
|
82
|
+
}
|
83
|
+
this.addEventListeners(this.elements);
|
84
|
+
ariaHidden(this.outerElements, true);
|
85
|
+
window.requestAnimationFrame(() => {
|
86
|
+
const element = (document.querySelector(this.initial || null) ||
|
87
|
+
this.focusableElements[0] ||
|
88
|
+
this.trapElements[0]);
|
89
|
+
element.blur();
|
90
|
+
element.focus();
|
91
|
+
this.activateTraps();
|
92
|
+
});
|
93
|
+
}
|
94
|
+
handleDeactivate() {
|
95
|
+
this.removeEventListeners(this.elements);
|
96
|
+
this.deactivateTraps();
|
97
|
+
ariaHidden(this.outerElements);
|
98
|
+
if (this.lastActiveElement && this.lastActiveElement.focus) {
|
99
|
+
this.lastActiveElement.focus();
|
100
|
+
}
|
101
|
+
this.lastActiveElement = null;
|
102
|
+
}
|
103
|
+
// Handles keydown and mutes the event if it occurs on a focusable
|
104
|
+
// item that is in the focus trap. This allows this block to force
|
105
|
+
// the decision as to who will get next focus and not let that
|
106
|
+
// decisioning fall out to the browser.
|
107
|
+
handleKeyDown(e) {
|
108
|
+
if ((tabShift.didFire(e) || tabAltShift.didFire(e))) {
|
109
|
+
try {
|
110
|
+
if (this.iframes.length > 0 && (this.trapElements[1] === e.target ||
|
111
|
+
!t.isNull(e.target.getAttribute('ku4-focus-wrap')) ||
|
112
|
+
this.iframes.some(iframe => iframe.contains(e.target)))) {
|
113
|
+
return;
|
114
|
+
}
|
115
|
+
if (this.trapElements[0] === e.target) {
|
116
|
+
this.trapElements[1].focus();
|
117
|
+
return Event.mute(e);
|
118
|
+
}
|
119
|
+
const nextIndex = this.focusableElements.indexOf(e.target) - 1;
|
120
|
+
const next = nextIndex < 0 ? this.focusableElements.length - 1 : nextIndex;
|
121
|
+
this.focusableElements[next].focus();
|
122
|
+
return Event.mute(e);
|
123
|
+
}
|
124
|
+
catch (e) {
|
125
|
+
return Event.mute(e);
|
126
|
+
}
|
127
|
+
}
|
128
|
+
if ((tab.didFire(e) || tabAlt.didFire(e))) {
|
129
|
+
try {
|
130
|
+
if (this.iframes.length > 0 && (this.trapElements[0] === e.target ||
|
131
|
+
!t.isNull(e.target.getAttribute('ku4-focus-wrap')) ||
|
132
|
+
this.iframes.some(iframe => iframe.contains(e.target)))) {
|
133
|
+
return;
|
134
|
+
}
|
135
|
+
if (this.trapElements[1] === e.target) {
|
136
|
+
this.trapElements[0].focus();
|
137
|
+
return Event.mute(e);
|
138
|
+
}
|
139
|
+
const nextIndex = this.focusableElements.indexOf(e.target) + 1;
|
140
|
+
const next = nextIndex >= this.focusableElements.length ? 0 : nextIndex;
|
141
|
+
this.focusableElements[next].focus();
|
142
|
+
return Event.mute(e);
|
143
|
+
}
|
144
|
+
catch (e) {
|
145
|
+
return Event.mute(e);
|
146
|
+
}
|
147
|
+
}
|
148
|
+
}
|
149
|
+
// Handles keyup and mutes the event if it occurs on a focusable
|
150
|
+
// item that is in the focus trap. This allows for us to determine
|
151
|
+
// if we need to move to the next focusable if the key is released
|
152
|
+
// on one of the trapElements (the two dynamically created wrapper
|
153
|
+
// elements that create the trap);
|
154
|
+
handleKeyUp(e) {
|
155
|
+
const index = this.trapElements.indexOf(e.target);
|
156
|
+
if (index === 0 && (tabShift.didFire(e) || tabAltShift.didFire(e))) {
|
157
|
+
const element = this.focusableElements[this.focusableElements.length - 1] || this.trapElements[1];
|
158
|
+
element.focus();
|
159
|
+
return Event.mute(e);
|
160
|
+
}
|
161
|
+
if (index === 1 && (tab.didFire(e) || tabAlt.didFire(e))) {
|
162
|
+
const element = this.focusableElements[0] || this.trapElements[0];
|
163
|
+
element.focus();
|
164
|
+
return Event.mute(e);
|
165
|
+
}
|
166
|
+
}
|
167
|
+
// Prevents all mouse activity on any elements that are not focusable
|
168
|
+
// inside of the active trap.
|
169
|
+
handleMouse(e) {
|
170
|
+
if (!this.elements.some(element => element === e.target)) {
|
171
|
+
Event.mute(e);
|
172
|
+
}
|
173
|
+
}
|
174
|
+
addEventListeners(elements) {
|
175
|
+
elements.forEach(element => element.addEventListener('keydown', this.handleKeyDown, { passive: true }));
|
176
|
+
elements.forEach(element => element.addEventListener('keyup', this.handleKeyUp, { passive: true }));
|
177
|
+
window.addEventListener('click', this.handleMouse, { passive: true });
|
178
|
+
window.addEventListener('mousedown', this.handleMouse, { passive: true });
|
179
|
+
window.addEventListener('mouseup', this.handleMouse, { passive: true });
|
180
|
+
window.addEventListener('touchstart', this.handleMouse, { passive: true });
|
181
|
+
}
|
182
|
+
removeEventListeners(elements) {
|
183
|
+
elements.forEach(element => element.removeEventListener('keydown', this.handleKeyDown, true));
|
184
|
+
elements.forEach(element => element.removeEventListener('keyup', this.handleKeyUp, true));
|
185
|
+
window.removeEventListener('click', this.handleMouse, true);
|
186
|
+
window.removeEventListener('mousedown', this.handleMouse, true);
|
187
|
+
window.removeEventListener('mouseup', this.handleMouse, true);
|
188
|
+
window.addEventListener('touchstart', this.handleMouse, true);
|
189
|
+
}
|
190
|
+
activateTraps() {
|
191
|
+
this.setTraps(0);
|
192
|
+
}
|
193
|
+
deactivateTraps() {
|
194
|
+
this.setTraps(-1);
|
195
|
+
}
|
196
|
+
setTraps(value) {
|
197
|
+
[].slice.call(this.host.querySelectorAll('[ku4-focus-trap], [ku4-focus-wrap]'))
|
198
|
+
.forEach(element => element.setAttribute('tabindex', value));
|
199
|
+
}
|
200
|
+
wrap(element) {
|
201
|
+
const fragment = document.createDocumentFragment();
|
202
|
+
fragment.appendChild(this.createWrapTag());
|
203
|
+
fragment.appendChild(element.cloneNode());
|
204
|
+
fragment.appendChild(this.createWrapTag());
|
205
|
+
element.parentNode.replaceChild(fragment, element);
|
206
|
+
}
|
207
|
+
createTrapTag() {
|
208
|
+
return this.createTag('ku4-focus-trap');
|
209
|
+
}
|
210
|
+
createWrapTag() {
|
211
|
+
return this.createTag('ku4-focus-wrap');
|
212
|
+
}
|
213
|
+
createTag(type) {
|
214
|
+
const trap = document.createElement('button');
|
215
|
+
trap.setAttribute(type, '');
|
216
|
+
trap.setAttribute('tabindex', '0');
|
217
|
+
trap.setAttribute('aria-hidden', 'true');
|
218
|
+
trap.style.position = 'static';
|
219
|
+
trap.style.display = 'block';
|
220
|
+
trap.style.width = '0';
|
221
|
+
trap.style.height = '0';
|
222
|
+
trap.style.margin = '0';
|
223
|
+
trap.style.padding = '0';
|
224
|
+
trap.style.border = 'none';
|
225
|
+
trap.style.outline = 'none';
|
226
|
+
return trap;
|
227
|
+
}
|
228
|
+
initialize() {
|
229
|
+
// All elements in this focus-trap
|
230
|
+
const innerElements = [].slice.call(this.host.querySelectorAll('*'));
|
231
|
+
// May need to break this out as it is really included for the mouse events
|
232
|
+
// e.g. for an overlay on a modal to make that clickable that is make it
|
233
|
+
// so this does not include it for muting the mouse events. This component
|
234
|
+
// is very powerful in shutting everything down and needs to allow for
|
235
|
+
// the ability to let items be clickable.
|
236
|
+
const inclusions = [].slice.call(document.querySelectorAll(this.include || null) || []);
|
237
|
+
// May need to break this out as it is really here to explicitly exclude items from
|
238
|
+
// being read out by screen readers. That is make them hidden so that screen
|
239
|
+
// readers get the same treatment as regular users.
|
240
|
+
const exclusions = [].slice.call(document.querySelectorAll(this.exclude) || []);
|
241
|
+
let shadowExclusions = [];
|
242
|
+
(this.excludeShadow || '').split(',').forEach((selector) => {
|
243
|
+
if (t.isNullOrEmpty(selector)) {
|
244
|
+
return;
|
245
|
+
}
|
246
|
+
try {
|
247
|
+
const parts = selector.trim().replace(/\s/, '|').split('|');
|
248
|
+
const shadowElements = document.querySelector(parts[0]).shadowRoot.querySelectorAll(parts[1]);
|
249
|
+
shadowExclusions = shadowExclusions.concat([].slice.call(shadowElements || []));
|
250
|
+
}
|
251
|
+
catch (e) {
|
252
|
+
// eslint-disable-next-line no-console
|
253
|
+
console.error('Invalid shadow selector', selector);
|
254
|
+
}
|
255
|
+
});
|
256
|
+
// Get all of the iframes as we cannot reach into them to find
|
257
|
+
// their focusable elements. We can only focus on the trap elements
|
258
|
+
// that wrap it
|
259
|
+
this.iframes = [].slice.call(this.host.querySelectorAll('iframe') || []);
|
260
|
+
this.iframes.forEach(iframe => this.wrap(iframe));
|
261
|
+
// Set element in this trap deduplicating any that may have been duplicated
|
262
|
+
// with careless user inclusions.
|
263
|
+
this.elements = o([...queryTabbable(this.host), ...inclusions]);
|
264
|
+
// Get the focusable elements. This may be overkill as we really only need
|
265
|
+
// to know the first and last focusable. If that is the case, we may be
|
266
|
+
// able to just use the first and last `this.element` it is still not clear.
|
267
|
+
this.focusableElements = this.elements
|
268
|
+
.reduce((acc, value) => {
|
269
|
+
if (isFocusable(value) && !this.trapElements.includes(value)) {
|
270
|
+
acc.push(value);
|
271
|
+
}
|
272
|
+
return acc;
|
273
|
+
}, []);
|
274
|
+
/**
|
275
|
+
* We can not currently do this this way because MSEdge
|
276
|
+
* is reordering querySelectorAll items such that they
|
277
|
+
* not selecting in DOM order. If/when we dump support
|
278
|
+
* for MSEdge (non Chromium) or it fixes support we
|
279
|
+
* can move to this more efficient way. Until then, we
|
280
|
+
* need to use the && condition .includes in the
|
281
|
+
* `reduce` above. It will be more efficient to do it
|
282
|
+
* the below way when we can.
|
283
|
+
*/
|
284
|
+
// this.focusableElements.shift();
|
285
|
+
// this.focusableElements.pop();
|
286
|
+
//This may need to be defied more specifically as a11y as it is needed
|
287
|
+
//for the screen reader capabilities and may be interfering with
|
288
|
+
//regular usage.
|
289
|
+
this.outerElements = [...queryFocusable(document.body), ...exclusions, ...shadowExclusions]
|
290
|
+
.filter(element => !(element === this.host ||
|
291
|
+
innerElements.includes(element) ||
|
292
|
+
inclusions.includes(element)));
|
293
|
+
}
|
294
|
+
componentDidLoad() {
|
295
|
+
const trapStart = this.createTrapTag();
|
296
|
+
const trapEnd = this.createTrapTag();
|
297
|
+
this.trapElements = [trapStart, trapEnd];
|
298
|
+
this.host.insertBefore(trapStart, this.host.firstChild);
|
299
|
+
this.host.appendChild(trapEnd);
|
300
|
+
this.initialize();
|
301
|
+
if (this.active) {
|
302
|
+
this.handleActivate();
|
303
|
+
}
|
304
|
+
else {
|
305
|
+
this.handleDeactivate();
|
306
|
+
}
|
307
|
+
}
|
308
|
+
disconnectedCallback() {
|
309
|
+
if (this.active) {
|
310
|
+
this.handleDeactivate();
|
311
|
+
}
|
312
|
+
}
|
313
|
+
render() {
|
314
|
+
return h("slot", null);
|
315
|
+
}
|
316
|
+
get host() { return getElement(this); }
|
317
|
+
static get watchers() { return {
|
318
|
+
"active": ["activeHandler"]
|
319
|
+
}; }
|
320
|
+
};
|
321
|
+
Ku4FocusTrap.style = ku4FocusTrapCss;
|
322
|
+
|
323
|
+
export { Ku4FocusTrap as ku4_focus_trap };
|
@@ -0,0 +1 @@
|
|
1
|
+
var __awaiter=this&&this.__awaiter||function(t,e,r,n){function i(t){return t instanceof r?t:new r((function(e){e(t)}))}return new(r||(r=Promise))((function(r,a){function s(t){try{u(n.next(t))}catch(e){a(e)}}function o(t){try{u(n["throw"](t))}catch(e){a(e)}}function u(t){t.done?r(t.value):i(t.value).then(s,o)}u((n=n.apply(t,e||[])).next())}))};var __generator=this&&this.__generator||function(t,e){var r={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,i,a,s;return s={next:o(0),throw:o(1),return:o(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function o(t){return function(e){return u([t,e])}}function u(s){if(n)throw new TypeError("Generator is already executing.");while(r)try{if(n=1,i&&(a=s[0]&2?i["return"]:s[0]?i["throw"]||((a=i["return"])&&a.call(i),0):i.next)&&!(a=a.call(i,s[1])).done)return a;if(i=0,a)s=[s[0]&2,a.value];switch(s[0]){case 0:case 1:a=s;break;case 4:r.label++;return{value:s[1],done:false};case 5:r.label++;i=s[1];s=[0];continue;case 7:s=r.ops.pop();r.trys.pop();continue;default:if(!(a=r.trys,a=a.length>0&&a[a.length-1])&&(s[0]===6||s[0]===2)){r=0;continue}if(s[0]===3&&(!a||s[1]>a[0]&&s[1]<a[3])){r.label=s[1];break}if(s[0]===6&&r.label<a[1]){r.label=a[1];a=s;break}if(a&&r.label<a[2]){r.label=a[2];r.ops.push(s);break}if(a[2])r.ops.pop();r.trys.pop();continue}s=e.call(t,r)}catch(o){s=[6,o];i=0}finally{n=a=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(t,e,r){if(r||arguments.length===2)for(var n=0,i=e.length,a;n<i;n++){if(a||!(n in e)){if(!a)a=Array.prototype.slice.call(e,0,n);a[n]=e[n]}}return t.concat(a||Array.prototype.slice.call(e))};System.register(["./index-5029fd1f.system.js","./index-380cbe3a.system.js","./index-7d482e8a.system.js"],(function(t){"use strict";var e,r,n,i,a,s,o;return{setters:[function(t){e=t.r;r=t.h;n=t.g},function(t){i=t.t;a=t.o},function(t){s=t.K;o=t.E}],execute:function(){var u=function(t,e){if(!e){t.forEach((function(t){if(!t.currentAriaHidden){t.removeAttribute("aria-hidden")}else{t.setAttribute("aria-hidden",t.currentAriaHidden)}}))}else{t.forEach((function(t){t.currentAriaHidden=t.getAttribute("aria-hidden");t.setAttribute("aria-hidden",e)}))}};var l=["A","BUTTON","INPUT","SELECT","TEXTAREA"];var c=function(t){var e=t.getAttribute("tabindex");return(l.includes(t.tagName.toUpperCase())||t.getAttribute("href"))&&(!e||isNaN(e)||parseInt(e)>-1)};var h=function(t){return[].slice.call(t.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'))};var d=function(t){return[].slice.call(t.querySelectorAll(':not([tabindex="-1"])'))};var f=":host{position:static}";var p=s.tab;var v=s.tab.shift;var m=s.tab.alt;var y=s.tab.alt.shift;var E=t("ku4_focus_trap",function(){function t(t){e(this,t);this.iframes=[];this.active=false;this.handleKeyDown=this.handleKeyDown.bind(this);this.handleKeyUp=this.handleKeyUp.bind(this);this.handleMouse=this.handleMouse.bind(this)}t.prototype.activeHandler=function(t){t?this.handleActivate():this.handleDeactivate()};t.prototype.activate=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){this.lastActiveElement=t||document.querySelector(this.return||null);this.active=true;return[2]}))}))};t.prototype.deactivate=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){this.active=false;return[2]}))}))};t.prototype.handleActivate=function(){var t=this;this.lastActiveElement=this.lastActiveElement||document.activeElement;if(this.lastActiveElement&&this.lastActiveElement.blur){this.lastActiveElement.blur()}this.addEventListeners(this.elements);u(this.outerElements,true);window.requestAnimationFrame((function(){var e=document.querySelector(t.initial||null)||t.focusableElements[0]||t.trapElements[0];e.blur();e.focus();t.activateTraps()}))};t.prototype.handleDeactivate=function(){this.removeEventListeners(this.elements);this.deactivateTraps();u(this.outerElements);if(this.lastActiveElement&&this.lastActiveElement.focus){this.lastActiveElement.focus()}this.lastActiveElement=null};t.prototype.handleKeyDown=function(t){if(v.didFire(t)||y.didFire(t)){try{if(this.iframes.length>0&&(this.trapElements[1]===t.target||!i.isNull(t.target.getAttribute("ku4-focus-wrap"))||this.iframes.some((function(e){return e.contains(t.target)})))){return}if(this.trapElements[0]===t.target){this.trapElements[1].focus();return o.mute(t)}var e=this.focusableElements.indexOf(t.target)-1;var r=e<0?this.focusableElements.length-1:e;this.focusableElements[r].focus();return o.mute(t)}catch(t){return o.mute(t)}}if(p.didFire(t)||m.didFire(t)){try{if(this.iframes.length>0&&(this.trapElements[0]===t.target||!i.isNull(t.target.getAttribute("ku4-focus-wrap"))||this.iframes.some((function(e){return e.contains(t.target)})))){return}if(this.trapElements[1]===t.target){this.trapElements[0].focus();return o.mute(t)}var e=this.focusableElements.indexOf(t.target)+1;var r=e>=this.focusableElements.length?0:e;this.focusableElements[r].focus();return o.mute(t)}catch(t){return o.mute(t)}}};t.prototype.handleKeyUp=function(t){var e=this.trapElements.indexOf(t.target);if(e===0&&(v.didFire(t)||y.didFire(t))){var r=this.focusableElements[this.focusableElements.length-1]||this.trapElements[1];r.focus();return o.mute(t)}if(e===1&&(p.didFire(t)||m.didFire(t))){var r=this.focusableElements[0]||this.trapElements[0];r.focus();return o.mute(t)}};t.prototype.handleMouse=function(t){if(!this.elements.some((function(e){return e===t.target}))){o.mute(t)}};t.prototype.addEventListeners=function(t){var e=this;t.forEach((function(t){return t.addEventListener("keydown",e.handleKeyDown,{passive:true})}));t.forEach((function(t){return t.addEventListener("keyup",e.handleKeyUp,{passive:true})}));window.addEventListener("click",this.handleMouse,{passive:true});window.addEventListener("mousedown",this.handleMouse,{passive:true});window.addEventListener("mouseup",this.handleMouse,{passive:true});window.addEventListener("touchstart",this.handleMouse,{passive:true})};t.prototype.removeEventListeners=function(t){var e=this;t.forEach((function(t){return t.removeEventListener("keydown",e.handleKeyDown,true)}));t.forEach((function(t){return t.removeEventListener("keyup",e.handleKeyUp,true)}));window.removeEventListener("click",this.handleMouse,true);window.removeEventListener("mousedown",this.handleMouse,true);window.removeEventListener("mouseup",this.handleMouse,true);window.addEventListener("touchstart",this.handleMouse,true)};t.prototype.activateTraps=function(){this.setTraps(0)};t.prototype.deactivateTraps=function(){this.setTraps(-1)};t.prototype.setTraps=function(t){[].slice.call(this.host.querySelectorAll("[ku4-focus-trap], [ku4-focus-wrap]")).forEach((function(e){return e.setAttribute("tabindex",t)}))};t.prototype.wrap=function(t){var e=document.createDocumentFragment();e.appendChild(this.createWrapTag());e.appendChild(t.cloneNode());e.appendChild(this.createWrapTag());t.parentNode.replaceChild(e,t)};t.prototype.createTrapTag=function(){return this.createTag("ku4-focus-trap")};t.prototype.createWrapTag=function(){return this.createTag("ku4-focus-wrap")};t.prototype.createTag=function(t){var e=document.createElement("button");e.setAttribute(t,"");e.setAttribute("tabindex","0");e.setAttribute("aria-hidden","true");e.style.position="static";e.style.display="block";e.style.width="0";e.style.height="0";e.style.margin="0";e.style.padding="0";e.style.border="none";e.style.outline="none";return e};t.prototype.initialize=function(){var t=this;var e=[].slice.call(this.host.querySelectorAll("*"));var r=[].slice.call(document.querySelectorAll(this.include||null)||[]);var n=[].slice.call(document.querySelectorAll(this.exclude)||[]);var s=[];(this.excludeShadow||"").split(",").forEach((function(t){if(i.isNullOrEmpty(t)){return}try{var e=t.trim().replace(/\s/,"|").split("|");var r=document.querySelector(e[0]).shadowRoot.querySelectorAll(e[1]);s=s.concat([].slice.call(r||[]))}catch(n){console.error("Invalid shadow selector",t)}}));this.iframes=[].slice.call(this.host.querySelectorAll("iframe")||[]);this.iframes.forEach((function(e){return t.wrap(e)}));this.elements=a(__spreadArray(__spreadArray([],d(this.host),true),r,true));this.focusableElements=this.elements.reduce((function(e,r){if(c(r)&&!t.trapElements.includes(r)){e.push(r)}return e}),[]);this.outerElements=__spreadArray(__spreadArray(__spreadArray([],h(document.body),true),n,true),s,true).filter((function(n){return!(n===t.host||e.includes(n)||r.includes(n))}))};t.prototype.componentDidLoad=function(){var t=this.createTrapTag();var e=this.createTrapTag();this.trapElements=[t,e];this.host.insertBefore(t,this.host.firstChild);this.host.appendChild(e);this.initialize();if(this.active){this.handleActivate()}else{this.handleDeactivate()}};t.prototype.disconnectedCallback=function(){if(this.active){this.handleDeactivate()}};t.prototype.render=function(){return r("slot",null)};Object.defineProperty(t.prototype,"host",{get:function(){return n(this)},enumerable:false,configurable:true});Object.defineProperty(t,"watchers",{get:function(){return{active:["activeHandler"]}},enumerable:false,configurable:true});return t}());E.style=f}}}));
|
@@ -0,0 +1,112 @@
|
|
1
|
+
import { r as registerInstance, h, g as getElement } from './index-7fe386de.js';
|
2
|
+
import { t } from './index-3e1e5aa3.js';
|
3
|
+
import { i as index } from './index-7ff6e718.js';
|
4
|
+
|
5
|
+
const Ku4Form = class {
|
6
|
+
constructor(hostRef) {
|
7
|
+
registerInstance(this, hostRef);
|
8
|
+
this.validate = this.validate.bind(this);
|
9
|
+
this.handleReset = this.handleReset.bind(this);
|
10
|
+
}
|
11
|
+
/**
|
12
|
+
* Returns a list of the names of all of the fields
|
13
|
+
* associated with this form.
|
14
|
+
*/
|
15
|
+
async listFieldNames() {
|
16
|
+
return index.readFieldNames(this.form);
|
17
|
+
}
|
18
|
+
/**
|
19
|
+
* Validates this form. This method is automatically called
|
20
|
+
* internally on submit of the form only allowing a successful
|
21
|
+
* submit if the form is valid.
|
22
|
+
*/
|
23
|
+
async validate() {
|
24
|
+
const { fields } = this;
|
25
|
+
const methods = fields.map(field => field.validate());
|
26
|
+
this.isValid = await Promise.all(methods).then(values => !values.some(v => v === false));
|
27
|
+
this.invalid = !this.isValid;
|
28
|
+
return this.isValid;
|
29
|
+
}
|
30
|
+
/**
|
31
|
+
* A string of the name of the field to invalidate
|
32
|
+
* @param {string} name
|
33
|
+
*/
|
34
|
+
async invalidate(name) {
|
35
|
+
if (t.isArray(name)) {
|
36
|
+
name.forEach((name) => {
|
37
|
+
const field = this.fields.find(field => field.for === name);
|
38
|
+
if (field) {
|
39
|
+
field.invalid = true;
|
40
|
+
}
|
41
|
+
});
|
42
|
+
}
|
43
|
+
else {
|
44
|
+
const field = this.fields.find(field => field.for === name);
|
45
|
+
if (field) {
|
46
|
+
field.invalid = true;
|
47
|
+
}
|
48
|
+
}
|
49
|
+
this.invalid = true;
|
50
|
+
return this;
|
51
|
+
}
|
52
|
+
/**
|
53
|
+
* Reads data from the associated form
|
54
|
+
*/
|
55
|
+
async read() {
|
56
|
+
return index.read(this.form);
|
57
|
+
}
|
58
|
+
/**
|
59
|
+
* Writes data to the associated form
|
60
|
+
*/
|
61
|
+
async write(data) {
|
62
|
+
index.write(this.form, data);
|
63
|
+
Object.keys(data).forEach((name) => {
|
64
|
+
try {
|
65
|
+
this.form.querySelector(`[name="${name}"]`)
|
66
|
+
.dispatchEvent(new Event('change'));
|
67
|
+
}
|
68
|
+
catch (e) {
|
69
|
+
/* Fail silently */
|
70
|
+
}
|
71
|
+
});
|
72
|
+
return this;
|
73
|
+
}
|
74
|
+
get form() {
|
75
|
+
return this.host.querySelector('form');
|
76
|
+
}
|
77
|
+
get fields() {
|
78
|
+
return [].slice.call(this.form.querySelectorAll('ku4-validation'));
|
79
|
+
}
|
80
|
+
handleReset() {
|
81
|
+
this.isValid = true;
|
82
|
+
this.invalid = !this.isValid;
|
83
|
+
}
|
84
|
+
componentWillLoad() {
|
85
|
+
const { form } = this;
|
86
|
+
if (t.exists(form)) {
|
87
|
+
const onsubmit = form.onsubmit || (() => { });
|
88
|
+
form.onsubmit = (e) => {
|
89
|
+
e.preventDefault();
|
90
|
+
this.validate()
|
91
|
+
.then(valid => valid && onsubmit.call(form, e))
|
92
|
+
.then(returnValue => !t.isFalse(returnValue) && form.submit());
|
93
|
+
return false;
|
94
|
+
};
|
95
|
+
form.addEventListener('reset', this.handleReset);
|
96
|
+
this.fields.forEach(field => field.addEventListener('validated', this.validate));
|
97
|
+
}
|
98
|
+
}
|
99
|
+
disconnectedCallback() {
|
100
|
+
const { form } = this;
|
101
|
+
if (t.exists(form)) {
|
102
|
+
form.removeEventListener('reset', this.handleReset);
|
103
|
+
this.fields.forEach(field => field.removeEventListener('validated', this.validate));
|
104
|
+
}
|
105
|
+
}
|
106
|
+
render() {
|
107
|
+
return h("slot", null);
|
108
|
+
}
|
109
|
+
get host() { return getElement(this); }
|
110
|
+
};
|
111
|
+
|
112
|
+
export { Ku4Form as ku4_form };
|
@@ -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 a(t){try{u(r.next(t))}catch(e){o(e)}}function s(t){try{u(r["throw"](t))}catch(e){o(e)}}function u(t){t.done?n(t.value):i(t.value).then(a,s)}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,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(t){return function(e){return u([t,e])}}function u(a){if(r)throw new TypeError("Generator is already executing.");while(n)try{if(r=1,i&&(o=a[0]&2?i["return"]:a[0]?i["throw"]||((o=i["return"])&&o.call(i),0):i.next)&&!(o=o.call(i,a[1])).done)return o;if(i=0,o)a=[a[0]&2,o.value];switch(a[0]){case 0:case 1:o=a;break;case 4:n.label++;return{value:a[1],done:false};case 5:n.label++;i=a[1];a=[0];continue;case 7:a=n.ops.pop();n.trys.pop();continue;default:if(!(o=n.trys,o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){n=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){n.label=a[1];break}if(a[0]===6&&n.label<o[1]){n.label=o[1];o=a;break}if(o&&n.label<o[2]){n.label=o[2];n.ops.push(a);break}if(o[2])n.ops.pop();n.trys.pop();continue}a=e.call(t,n)}catch(s){a=[6,s];i=0}finally{r=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};System.register(["./index-5029fd1f.system.js","./index-380cbe3a.system.js","./index-7d482e8a.system.js"],(function(t){"use strict";var e,n,r,i,o;return{setters:[function(t){e=t.r;n=t.h;r=t.g},function(t){i=t.t},function(t){o=t.i}],execute:function(){var a=t("ku4_form",function(){function t(t){e(this,t);this.validate=this.validate.bind(this);this.handleReset=this.handleReset.bind(this)}t.prototype.listFieldNames=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){return[2,o.readFieldNames(this.form)]}))}))};t.prototype.validate=function(){return __awaiter(this,void 0,void 0,(function(){var t,e,n;return __generator(this,(function(r){switch(r.label){case 0:t=this.fields;e=t.map((function(t){return t.validate()}));n=this;return[4,Promise.all(e).then((function(t){return!t.some((function(t){return t===false}))}))];case 1:n.isValid=r.sent();this.invalid=!this.isValid;return[2,this.isValid]}}))}))};t.prototype.invalidate=function(t){return __awaiter(this,void 0,void 0,(function(){var e;var n=this;return __generator(this,(function(r){if(i.isArray(t)){t.forEach((function(t){var e=n.fields.find((function(e){return e.for===t}));if(e){e.invalid=true}}))}else{e=this.fields.find((function(e){return e.for===t}));if(e){e.invalid=true}}this.invalid=true;return[2,this]}))}))};t.prototype.read=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){return[2,o.read(this.form)]}))}))};t.prototype.write=function(t){return __awaiter(this,void 0,void 0,(function(){var e=this;return __generator(this,(function(n){o.write(this.form,t);Object.keys(t).forEach((function(t){try{e.form.querySelector('[name="'.concat(t,'"]')).dispatchEvent(new Event("change"))}catch(n){}}));return[2,this]}))}))};Object.defineProperty(t.prototype,"form",{get:function(){return this.host.querySelector("form")},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"fields",{get:function(){return[].slice.call(this.form.querySelectorAll("ku4-validation"))},enumerable:false,configurable:true});t.prototype.handleReset=function(){this.isValid=true;this.invalid=!this.isValid};t.prototype.componentWillLoad=function(){var t=this;var e=this.form;if(i.exists(e)){var n=e.onsubmit||function(){};e.onsubmit=function(r){r.preventDefault();t.validate().then((function(t){return t&&n.call(e,r)})).then((function(t){return!i.isFalse(t)&&e.submit()}));return false};e.addEventListener("reset",this.handleReset);this.fields.forEach((function(e){return e.addEventListener("validated",t.validate)}))}};t.prototype.disconnectedCallback=function(){var t=this;var e=this.form;if(i.exists(e)){e.removeEventListener("reset",this.handleReset);this.fields.forEach((function(e){return e.removeEventListener("validated",t.validate)}))}};t.prototype.render=function(){return n("slot",null)};Object.defineProperty(t.prototype,"host",{get:function(){return r(this)},enumerable:false,configurable:true});return t}())}}}));
|
@@ -0,0 +1,108 @@
|
|
1
|
+
import { r as registerInstance, h, f as Host } from './index-7fe386de.js';
|
2
|
+
|
3
|
+
const ku4GridCss = ":host{position:relative;display:block;width:100%;-webkit-box-sizing:border-box;box-sizing:border-box}@media only screen and (min-width: 1px){:host(.columns-xs-1){display:grid;grid-template-columns:repeat(auto-fill, minmax(100%, auto));margin-bottom:0}:host(.columns-xs-2){display:grid;grid-template-columns:repeat(auto-fill, minmax(50%, auto));margin-bottom:0}:host(.columns-xs-3){display:grid;grid-template-columns:repeat(auto-fill, minmax(33.3333333333%, auto));margin-bottom:0}:host(.columns-xs-4){display:grid;grid-template-columns:repeat(auto-fill, minmax(25%, auto));margin-bottom:0}:host(.columns-xs-5){display:grid;grid-template-columns:repeat(auto-fill, minmax(20%, auto));margin-bottom:0}:host(.columns-xs-6){display:grid;grid-template-columns:repeat(auto-fill, minmax(16.6666666667%, auto));margin-bottom:0}:host(.columns-xs-7){display:grid;grid-template-columns:repeat(auto-fill, minmax(14.2857142857%, auto));margin-bottom:0}:host(.columns-xs-8){display:grid;grid-template-columns:repeat(auto-fill, minmax(12.5%, auto));margin-bottom:0}:host(.columns-xs-9){display:grid;grid-template-columns:repeat(auto-fill, minmax(11.1111111111%, auto));margin-bottom:0}:host(.columns-xs-10){display:grid;grid-template-columns:repeat(auto-fill, minmax(10%, auto));margin-bottom:0}:host(.columns-xs-11){display:grid;grid-template-columns:repeat(auto-fill, minmax(9.0909090909%, auto));margin-bottom:0}:host(.columns-xs-12){display:grid;grid-template-columns:repeat(auto-fill, minmax(8.3333333333%, auto));margin-bottom:0}:host(.columns-xs-13){display:grid;grid-template-columns:repeat(auto-fill, minmax(7.6923076923%, auto));margin-bottom:0}:host(.columns-xs-14){display:grid;grid-template-columns:repeat(auto-fill, minmax(7.1428571429%, auto));margin-bottom:0}:host(.columns-xs-15){display:grid;grid-template-columns:repeat(auto-fill, minmax(6.6666666667%, auto));margin-bottom:0}:host(.columns-xs-16){display:grid;grid-template-columns:repeat(auto-fill, minmax(6.25%, auto));margin-bottom:0}:host(.offset-left-xs-0){padding-left:calc(((100% + 8.33px) / 12) * 0)}:host(.offset-left-xs-1){padding-left:calc(((100% + 8.33px) / 12) * 1)}:host(.offset-left-xs-2){padding-left:calc(((100% + 8.33px) / 12) * 2)}:host(.offset-left-xs-3){padding-left:calc(((100% + 8.33px) / 12) * 3)}:host(.offset-left-xs-4){padding-left:calc(((100% + 8.33px) / 12) * 4)}:host(.offset-left-xs-5){padding-left:calc(((100% + 8.33px) / 12) * 5)}:host(.offset-right-xs-0){padding-right:calc(((100% + 8.33px) / 12) * 0)}:host(.offset-right-xs-1){padding-right:calc(((100% + 8.33px) / 12) * 1)}:host(.offset-right-xs-2){padding-right:calc(((100% + 8.33px) / 12) * 2)}:host(.offset-right-xs-3){padding-right:calc(((100% + 8.33px) / 12) * 3)}:host(.offset-right-xs-4){padding-right:calc(((100% + 8.33px) / 12) * 4)}:host(.offset-right-xs-5){padding-right:calc(((100% + 8.33px) / 12) * 5)}:host(.offset-xs-0){padding-left:calc(((100% + 8.33px) / 12) * 0);padding-right:calc(((100% + 8.33px) / 12) * 0)}:host(.offset-xs-1){padding-left:calc(((100% + 8.33px) / 12) * 1);padding-right:calc(((100% + 8.33px) / 12) * 1)}:host(.offset-xs-2){padding-left:calc(((100% + 8.33px) / 12) * 2);padding-right:calc(((100% + 8.33px) / 12) * 2)}:host(.offset-xs-3){padding-left:calc(((100% + 8.33px) / 12) * 3);padding-right:calc(((100% + 8.33px) / 12) * 3)}:host(.offset-xs-4){padding-left:calc(((100% + 8.33px) / 12) * 4);padding-right:calc(((100% + 8.33px) / 12) * 4)}:host(.offset-xs-5){padding-left:calc(((100% + 8.33px) / 12) * 5);padding-right:calc(((100% + 8.33px) / 12) * 5)}:host{margin-bottom:calc(-1 * var(--ku4-grid-row-gutter-xs, 6px))}:host::slotted(*){margin-bottom:var(--ku4-grid-row-gutter-xs, 6px)}:host ::slotted(*){margin-bottom:var(--ku4-grid-row-gutter-xs, 6px)}}@media only screen and (min-width: 768px){:host(.columns-sm-1){display:grid;grid-template-columns:repeat(auto-fill, minmax(100%, auto));margin-bottom:0}:host(.columns-sm-2){display:grid;grid-template-columns:repeat(auto-fill, minmax(50%, auto));margin-bottom:0}:host(.columns-sm-3){display:grid;grid-template-columns:repeat(auto-fill, minmax(33.3333333333%, auto));margin-bottom:0}:host(.columns-sm-4){display:grid;grid-template-columns:repeat(auto-fill, minmax(25%, auto));margin-bottom:0}:host(.columns-sm-5){display:grid;grid-template-columns:repeat(auto-fill, minmax(20%, auto));margin-bottom:0}:host(.columns-sm-6){display:grid;grid-template-columns:repeat(auto-fill, minmax(16.6666666667%, auto));margin-bottom:0}:host(.columns-sm-7){display:grid;grid-template-columns:repeat(auto-fill, minmax(14.2857142857%, auto));margin-bottom:0}:host(.columns-sm-8){display:grid;grid-template-columns:repeat(auto-fill, minmax(12.5%, auto));margin-bottom:0}:host(.columns-sm-9){display:grid;grid-template-columns:repeat(auto-fill, minmax(11.1111111111%, auto));margin-bottom:0}:host(.columns-sm-10){display:grid;grid-template-columns:repeat(auto-fill, minmax(10%, auto));margin-bottom:0}:host(.columns-sm-11){display:grid;grid-template-columns:repeat(auto-fill, minmax(9.0909090909%, auto));margin-bottom:0}:host(.columns-sm-12){display:grid;grid-template-columns:repeat(auto-fill, minmax(8.3333333333%, auto));margin-bottom:0}:host(.columns-sm-13){display:grid;grid-template-columns:repeat(auto-fill, minmax(7.6923076923%, auto));margin-bottom:0}:host(.columns-sm-14){display:grid;grid-template-columns:repeat(auto-fill, minmax(7.1428571429%, auto));margin-bottom:0}:host(.columns-sm-15){display:grid;grid-template-columns:repeat(auto-fill, minmax(6.6666666667%, auto));margin-bottom:0}:host(.columns-sm-16){display:grid;grid-template-columns:repeat(auto-fill, minmax(6.25%, auto));margin-bottom:0}:host(.offset-left-sm-0){padding-left:calc(((100% + 8.33px) / 12) * 0)}:host(.offset-left-sm-1){padding-left:calc(((100% + 8.33px) / 12) * 1)}:host(.offset-left-sm-2){padding-left:calc(((100% + 8.33px) / 12) * 2)}:host(.offset-left-sm-3){padding-left:calc(((100% + 8.33px) / 12) * 3)}:host(.offset-left-sm-4){padding-left:calc(((100% + 8.33px) / 12) * 4)}:host(.offset-left-sm-5){padding-left:calc(((100% + 8.33px) / 12) * 5)}:host(.offset-right-sm-0){padding-right:calc(((100% + 8.33px) / 12) * 0)}:host(.offset-right-sm-1){padding-right:calc(((100% + 8.33px) / 12) * 1)}:host(.offset-right-sm-2){padding-right:calc(((100% + 8.33px) / 12) * 2)}:host(.offset-right-sm-3){padding-right:calc(((100% + 8.33px) / 12) * 3)}:host(.offset-right-sm-4){padding-right:calc(((100% + 8.33px) / 12) * 4)}:host(.offset-right-sm-5){padding-right:calc(((100% + 8.33px) / 12) * 5)}:host(.offset-sm-0){padding-left:calc(((100% + 8.33px) / 12) * 0);padding-right:calc(((100% + 8.33px) / 12) * 0)}:host(.offset-sm-1){padding-left:calc(((100% + 8.33px) / 12) * 1);padding-right:calc(((100% + 8.33px) / 12) * 1)}:host(.offset-sm-2){padding-left:calc(((100% + 8.33px) / 12) * 2);padding-right:calc(((100% + 8.33px) / 12) * 2)}:host(.offset-sm-3){padding-left:calc(((100% + 8.33px) / 12) * 3);padding-right:calc(((100% + 8.33px) / 12) * 3)}:host(.offset-sm-4){padding-left:calc(((100% + 8.33px) / 12) * 4);padding-right:calc(((100% + 8.33px) / 12) * 4)}:host(.offset-sm-5){padding-left:calc(((100% + 8.33px) / 12) * 5);padding-right:calc(((100% + 8.33px) / 12) * 5)}:host{margin-bottom:calc(-1 * var(--ku4-grid-row-gutter-sm, 10px))}:host::slotted(*){margin-bottom:var(--ku4-grid-row-gutter-sm, 10px)}:host ::slotted(*){margin-bottom:var(--ku4-grid-row-gutter-sm, 10px)}}@media only screen and (min-width: 992px){:host(.columns-md-1){display:grid;grid-template-columns:repeat(auto-fill, minmax(100%, auto));margin-bottom:0}:host(.columns-md-2){display:grid;grid-template-columns:repeat(auto-fill, minmax(50%, auto));margin-bottom:0}:host(.columns-md-3){display:grid;grid-template-columns:repeat(auto-fill, minmax(33.3333333333%, auto));margin-bottom:0}:host(.columns-md-4){display:grid;grid-template-columns:repeat(auto-fill, minmax(25%, auto));margin-bottom:0}:host(.columns-md-5){display:grid;grid-template-columns:repeat(auto-fill, minmax(20%, auto));margin-bottom:0}:host(.columns-md-6){display:grid;grid-template-columns:repeat(auto-fill, minmax(16.6666666667%, auto));margin-bottom:0}:host(.columns-md-7){display:grid;grid-template-columns:repeat(auto-fill, minmax(14.2857142857%, auto));margin-bottom:0}:host(.columns-md-8){display:grid;grid-template-columns:repeat(auto-fill, minmax(12.5%, auto));margin-bottom:0}:host(.columns-md-9){display:grid;grid-template-columns:repeat(auto-fill, minmax(11.1111111111%, auto));margin-bottom:0}:host(.columns-md-10){display:grid;grid-template-columns:repeat(auto-fill, minmax(10%, auto));margin-bottom:0}:host(.columns-md-11){display:grid;grid-template-columns:repeat(auto-fill, minmax(9.0909090909%, auto));margin-bottom:0}:host(.columns-md-12){display:grid;grid-template-columns:repeat(auto-fill, minmax(8.3333333333%, auto));margin-bottom:0}:host(.columns-md-13){display:grid;grid-template-columns:repeat(auto-fill, minmax(7.6923076923%, auto));margin-bottom:0}:host(.columns-md-14){display:grid;grid-template-columns:repeat(auto-fill, minmax(7.1428571429%, auto));margin-bottom:0}:host(.columns-md-15){display:grid;grid-template-columns:repeat(auto-fill, minmax(6.6666666667%, auto));margin-bottom:0}:host(.columns-md-16){display:grid;grid-template-columns:repeat(auto-fill, minmax(6.25%, auto));margin-bottom:0}:host(.offset-left-md-0){padding-left:calc(((100% + 8.33px) / 12) * 0)}:host(.offset-left-md-1){padding-left:calc(((100% + 8.33px) / 12) * 1)}:host(.offset-left-md-2){padding-left:calc(((100% + 8.33px) / 12) * 2)}:host(.offset-left-md-3){padding-left:calc(((100% + 8.33px) / 12) * 3)}:host(.offset-left-md-4){padding-left:calc(((100% + 8.33px) / 12) * 4)}:host(.offset-left-md-5){padding-left:calc(((100% + 8.33px) / 12) * 5)}:host(.offset-right-md-0){padding-right:calc(((100% + 8.33px) / 12) * 0)}:host(.offset-right-md-1){padding-right:calc(((100% + 8.33px) / 12) * 1)}:host(.offset-right-md-2){padding-right:calc(((100% + 8.33px) / 12) * 2)}:host(.offset-right-md-3){padding-right:calc(((100% + 8.33px) / 12) * 3)}:host(.offset-right-md-4){padding-right:calc(((100% + 8.33px) / 12) * 4)}:host(.offset-right-md-5){padding-right:calc(((100% + 8.33px) / 12) * 5)}:host(.offset-md-0){padding-left:calc(((100% + 8.33px) / 12) * 0);padding-right:calc(((100% + 8.33px) / 12) * 0)}:host(.offset-md-1){padding-left:calc(((100% + 8.33px) / 12) * 1);padding-right:calc(((100% + 8.33px) / 12) * 1)}:host(.offset-md-2){padding-left:calc(((100% + 8.33px) / 12) * 2);padding-right:calc(((100% + 8.33px) / 12) * 2)}:host(.offset-md-3){padding-left:calc(((100% + 8.33px) / 12) * 3);padding-right:calc(((100% + 8.33px) / 12) * 3)}:host(.offset-md-4){padding-left:calc(((100% + 8.33px) / 12) * 4);padding-right:calc(((100% + 8.33px) / 12) * 4)}:host(.offset-md-5){padding-left:calc(((100% + 8.33px) / 12) * 5);padding-right:calc(((100% + 8.33px) / 12) * 5)}:host{margin-bottom:calc(-1 * var(--ku4-grid-row-gutter-md, 12px))}:host::slotted(*){margin-bottom:var(--ku4-grid-row-gutter-md, 12px)}:host ::slotted(*){margin-bottom:var(--ku4-grid-row-gutter-md, 12px)}}@media only screen and (min-width: 1200px){:host(.columns-lg-1){display:grid;grid-template-columns:repeat(auto-fill, minmax(100%, auto));margin-bottom:0}:host(.columns-lg-2){display:grid;grid-template-columns:repeat(auto-fill, minmax(50%, auto));margin-bottom:0}:host(.columns-lg-3){display:grid;grid-template-columns:repeat(auto-fill, minmax(33.3333333333%, auto));margin-bottom:0}:host(.columns-lg-4){display:grid;grid-template-columns:repeat(auto-fill, minmax(25%, auto));margin-bottom:0}:host(.columns-lg-5){display:grid;grid-template-columns:repeat(auto-fill, minmax(20%, auto));margin-bottom:0}:host(.columns-lg-6){display:grid;grid-template-columns:repeat(auto-fill, minmax(16.6666666667%, auto));margin-bottom:0}:host(.columns-lg-7){display:grid;grid-template-columns:repeat(auto-fill, minmax(14.2857142857%, auto));margin-bottom:0}:host(.columns-lg-8){display:grid;grid-template-columns:repeat(auto-fill, minmax(12.5%, auto));margin-bottom:0}:host(.columns-lg-9){display:grid;grid-template-columns:repeat(auto-fill, minmax(11.1111111111%, auto));margin-bottom:0}:host(.columns-lg-10){display:grid;grid-template-columns:repeat(auto-fill, minmax(10%, auto));margin-bottom:0}:host(.columns-lg-11){display:grid;grid-template-columns:repeat(auto-fill, minmax(9.0909090909%, auto));margin-bottom:0}:host(.columns-lg-12){display:grid;grid-template-columns:repeat(auto-fill, minmax(8.3333333333%, auto));margin-bottom:0}:host(.columns-lg-13){display:grid;grid-template-columns:repeat(auto-fill, minmax(7.6923076923%, auto));margin-bottom:0}:host(.columns-lg-14){display:grid;grid-template-columns:repeat(auto-fill, minmax(7.1428571429%, auto));margin-bottom:0}:host(.columns-lg-15){display:grid;grid-template-columns:repeat(auto-fill, minmax(6.6666666667%, auto));margin-bottom:0}:host(.columns-lg-16){display:grid;grid-template-columns:repeat(auto-fill, minmax(6.25%, auto));margin-bottom:0}:host(.offset-left-lg-0){padding-left:calc(((100% + 8.33px) / 12) * 0)}:host(.offset-left-lg-1){padding-left:calc(((100% + 8.33px) / 12) * 1)}:host(.offset-left-lg-2){padding-left:calc(((100% + 8.33px) / 12) * 2)}:host(.offset-left-lg-3){padding-left:calc(((100% + 8.33px) / 12) * 3)}:host(.offset-left-lg-4){padding-left:calc(((100% + 8.33px) / 12) * 4)}:host(.offset-left-lg-5){padding-left:calc(((100% + 8.33px) / 12) * 5)}:host(.offset-right-lg-0){padding-right:calc(((100% + 8.33px) / 12) * 0)}:host(.offset-right-lg-1){padding-right:calc(((100% + 8.33px) / 12) * 1)}:host(.offset-right-lg-2){padding-right:calc(((100% + 8.33px) / 12) * 2)}:host(.offset-right-lg-3){padding-right:calc(((100% + 8.33px) / 12) * 3)}:host(.offset-right-lg-4){padding-right:calc(((100% + 8.33px) / 12) * 4)}:host(.offset-right-lg-5){padding-right:calc(((100% + 8.33px) / 12) * 5)}:host(.offset-lg-0){padding-left:calc(((100% + 8.33px) / 12) * 0);padding-right:calc(((100% + 8.33px) / 12) * 0)}:host(.offset-lg-1){padding-left:calc(((100% + 8.33px) / 12) * 1);padding-right:calc(((100% + 8.33px) / 12) * 1)}:host(.offset-lg-2){padding-left:calc(((100% + 8.33px) / 12) * 2);padding-right:calc(((100% + 8.33px) / 12) * 2)}:host(.offset-lg-3){padding-left:calc(((100% + 8.33px) / 12) * 3);padding-right:calc(((100% + 8.33px) / 12) * 3)}:host(.offset-lg-4){padding-left:calc(((100% + 8.33px) / 12) * 4);padding-right:calc(((100% + 8.33px) / 12) * 4)}:host(.offset-lg-5){padding-left:calc(((100% + 8.33px) / 12) * 5);padding-right:calc(((100% + 8.33px) / 12) * 5)}:host{margin-bottom:calc(-1 * var(--ku4-grid-row-gutter-lg, 16px))}:host::slotted(*){margin-bottom:var(--ku4-grid-row-gutter-lg, 16px)}:host ::slotted(*){margin-bottom:var(--ku4-grid-row-gutter-lg, 16px)}}::slotted(*){margin-left:var(--ku4-grid-column-gutter, 15px);margin-right:var(--ku4-grid-column-gutter, 15px)}";
|
4
|
+
|
5
|
+
const Ku4Grid = class {
|
6
|
+
constructor(hostRef) {
|
7
|
+
registerInstance(this, hostRef);
|
8
|
+
//<editor-fold desc="columns">
|
9
|
+
/**
|
10
|
+
* Number of columns to render at extra-small (optional).
|
11
|
+
*/
|
12
|
+
this.columnsXs = 1;
|
13
|
+
//</editor-fold>
|
14
|
+
//<editor-fold desc="offset-left">
|
15
|
+
/**
|
16
|
+
* Number of columns to offset left at extra-small (optional).
|
17
|
+
*/
|
18
|
+
this.offsetLeftXs = 0;
|
19
|
+
//</editor-fold>
|
20
|
+
//<editor-fold desc="offset-right">
|
21
|
+
/**
|
22
|
+
* Number of columns to offset right (optional).
|
23
|
+
*/
|
24
|
+
this.offsetRight = 0;
|
25
|
+
//</editor-fold>
|
26
|
+
//<editor-fold desc="offset">
|
27
|
+
/**
|
28
|
+
* Number of columns to offset left and right at extra-small (optional).
|
29
|
+
*/
|
30
|
+
this.offsetXs = 0;
|
31
|
+
}
|
32
|
+
//</editor-fold>
|
33
|
+
get columnClass() {
|
34
|
+
const { columnsXs, columnsSm, columnsMd, columnsLg } = this;
|
35
|
+
const value = [];
|
36
|
+
if (columnsXs && !Number.isNaN(columnsXs)) {
|
37
|
+
value.push(`columns-xs-${columnsXs}`);
|
38
|
+
}
|
39
|
+
if (columnsSm && !Number.isNaN(columnsSm)) {
|
40
|
+
value.push(`columns-sm-${columnsSm}`);
|
41
|
+
}
|
42
|
+
if (columnsMd && !Number.isNaN(columnsMd)) {
|
43
|
+
value.push(`columns-md-${columnsMd}`);
|
44
|
+
}
|
45
|
+
if (columnsLg && !Number.isNaN(columnsLg)) {
|
46
|
+
value.push(`columns-lg-${columnsLg}`);
|
47
|
+
}
|
48
|
+
return value.join(' ');
|
49
|
+
}
|
50
|
+
get offsetLeftClass() {
|
51
|
+
const { offsetLeftXs, offsetLeftSm, offsetLeftMd, offsetLeftLg } = this;
|
52
|
+
const value = [];
|
53
|
+
if (offsetLeftXs && !Number.isNaN(offsetLeftXs)) {
|
54
|
+
value.push(`offset-left-xs-${offsetLeftXs}`);
|
55
|
+
}
|
56
|
+
if (offsetLeftSm && !Number.isNaN(offsetLeftSm)) {
|
57
|
+
value.push(`offset-left-sm-${offsetLeftSm}`);
|
58
|
+
}
|
59
|
+
if (offsetLeftMd && !Number.isNaN(offsetLeftMd)) {
|
60
|
+
value.push(`offset-left-md-${offsetLeftMd}`);
|
61
|
+
}
|
62
|
+
if (offsetLeftLg && !Number.isNaN(offsetLeftLg)) {
|
63
|
+
value.push(`offset-left-lg-${offsetLeftLg}`);
|
64
|
+
}
|
65
|
+
return value.join(' ');
|
66
|
+
}
|
67
|
+
get offsetRightClass() {
|
68
|
+
const { offsetRightXs, offsetRightSm, offsetRightMd, offsetRightLg } = this;
|
69
|
+
const value = [];
|
70
|
+
if (offsetRightXs && !Number.isNaN(offsetRightXs)) {
|
71
|
+
value.push(`offset-right-xs-${offsetRightXs}`);
|
72
|
+
}
|
73
|
+
if (offsetRightSm && !Number.isNaN(offsetRightSm)) {
|
74
|
+
value.push(`offset-right-sm-${offsetRightSm}`);
|
75
|
+
}
|
76
|
+
if (offsetRightMd && !Number.isNaN(offsetRightMd)) {
|
77
|
+
value.push(`offset-right-md-${offsetRightMd}`);
|
78
|
+
}
|
79
|
+
if (offsetRightLg && !Number.isNaN(offsetRightLg)) {
|
80
|
+
value.push(`offset-right-lg-${offsetRightLg}`);
|
81
|
+
}
|
82
|
+
return value.join(' ');
|
83
|
+
}
|
84
|
+
get offsetClass() {
|
85
|
+
const { offsetXs, offsetSm, offsetMd, offsetLg } = this;
|
86
|
+
const value = [];
|
87
|
+
if (offsetXs && !Number.isNaN(offsetXs)) {
|
88
|
+
value.push(`offset-xs-${offsetXs}`);
|
89
|
+
}
|
90
|
+
if (offsetSm && !Number.isNaN(offsetSm)) {
|
91
|
+
value.push(`offset-sm-${offsetSm}`);
|
92
|
+
}
|
93
|
+
if (offsetMd && !Number.isNaN(offsetMd)) {
|
94
|
+
value.push(`offset-md-${offsetMd}`);
|
95
|
+
}
|
96
|
+
if (offsetLg && !Number.isNaN(offsetLg)) {
|
97
|
+
value.push(`offset-lg-${offsetLg}`);
|
98
|
+
}
|
99
|
+
return value.join(' ');
|
100
|
+
}
|
101
|
+
render() {
|
102
|
+
const { columnClass, offsetClass, offsetLeftClass, offsetRightClass, } = this;
|
103
|
+
return (h(Host, { class: `${columnClass} ${offsetLeftClass} ${offsetRightClass} ${offsetClass}` }, h("slot", null)));
|
104
|
+
}
|
105
|
+
};
|
106
|
+
Ku4Grid.style = ku4GridCss;
|
107
|
+
|
108
|
+
export { Ku4Grid as ku4_grid };
|