ku4web-components 6.7.1 → 6.7.2
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/ku4-validation.cjs.entry.js +67 -31
- package/dist/esm/ku4-validation.entry.js +68 -32
- package/dist/esm-es5/ku4-validation.entry.js +1 -1
- package/dist/ku4web-components/ku4web-components.esm.js +1 -1
- package/dist/ku4web-components/p-43d724df.system.entry.js +1 -0
- package/dist/ku4web-components/p-b3ad84eb.system.js +1 -1
- package/dist/ku4web-components/p-f23287da.entry.js +1 -0
- package/dist/types/components/ku4-validation/ku4-validation.d.ts +4 -1
- package/dist/types/components.d.ts +2 -2
- package/package.json +1 -1
- package/dist/ku4web-components/p-baf510f5.entry.js +0 -1
- package/dist/ku4web-components/p-d7736b02.system.entry.js +0 -1
@@ -81,11 +81,11 @@ const Ku4Validation = class {
|
|
81
81
|
async validate() {
|
82
82
|
return await this.assert();
|
83
83
|
}
|
84
|
-
async handleInput() {
|
85
|
-
(
|
84
|
+
async handleInput({ target }) {
|
85
|
+
(target.type === 'file' || index$1.t.isFalse(this.isValid)) && await this.assert();
|
86
86
|
}
|
87
|
-
async handleChange() {
|
88
|
-
(
|
87
|
+
async handleChange({ target }) {
|
88
|
+
(target.type === 'file' || index$1.t.isFalse(this.isValid)) && await this.assert();
|
89
89
|
}
|
90
90
|
async handleBlur() {
|
91
91
|
await this.assert();
|
@@ -93,36 +93,70 @@ const Ku4Validation = class {
|
|
93
93
|
handleReset() {
|
94
94
|
this.isValid = true;
|
95
95
|
this.invalid = !this.isValid;
|
96
|
-
this.input.setAttribute('aria-invalid', this.invalid);
|
96
|
+
this.input && this.input.setAttribute('aria-invalid', this.invalid);
|
97
97
|
}
|
98
98
|
async assert() {
|
99
|
-
const { ele, validOptions, input, regex, checked } = this;
|
99
|
+
const { ele, validOptions, inputs, input, regex, checked } = this;
|
100
|
+
const previousIsValid = this.isValid;
|
100
101
|
const values = await index$1.h.async(async () => await this.ku4Form.read(), {});
|
101
|
-
if (
|
102
|
-
|
102
|
+
if (!this.disabled) {
|
103
|
+
const assertInput = async (i) => {
|
104
|
+
if (i.type === 'file' && index$1.t.isNullOrEmpty(i.value)) {
|
105
|
+
return true;
|
106
|
+
}
|
107
|
+
const valid = index$1.t.isBool(checked)
|
108
|
+
? i.checked === checked
|
109
|
+
: validate(regex, i.value, validOptions, ele) && await this.validationMethod(i.value, values);
|
110
|
+
i.setAttribute('aria-invalid', !valid);
|
111
|
+
return valid;
|
112
|
+
};
|
113
|
+
this.isValid = inputs
|
114
|
+
? !(await Promise.all(inputs.map(i => assertInput(i)))).some(v => !v)
|
115
|
+
: input
|
116
|
+
? await assertInput(input)
|
117
|
+
: true;
|
118
|
+
}
|
119
|
+
else {
|
120
|
+
this.isValid = true;
|
103
121
|
}
|
104
|
-
const previousIsValid = this.isValid;
|
105
|
-
this.isValid = this.disabled
|
106
|
-
? true
|
107
|
-
: index$1.t.isBool(checked)
|
108
|
-
? input.checked === checked
|
109
|
-
: validate(regex, input.value, validOptions, ele) && await this.validationMethod(input.value, values);
|
110
|
-
this.invalid = !this.isValid;
|
111
|
-
input.setAttribute('aria-invalid', this.invalid);
|
112
122
|
if (index$1.t.isFalse(previousIsValid) && this.isValid) {
|
113
123
|
this.didValidate.emit(this.isValid);
|
114
124
|
}
|
125
|
+
this.invalid = !this.isValid;
|
115
126
|
return this.isValid;
|
116
127
|
}
|
117
128
|
componentWillLoad() {
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
129
|
+
const ids = this.for.replace(/\s/g, '').replace(/,/g, ',#');
|
130
|
+
this.inputs = /,/.test(this.for) && Array.from(document.querySelectorAll(`#${ids}`));
|
131
|
+
this.input = !/,/.test(this.for) && document.getElementById(this.for);
|
132
|
+
this.ele = document.getElementById(this.element) || document.querySelector(this.element);
|
133
|
+
this.validOptions = index$1.t.exists(this.values)
|
134
|
+
? this.values.split(',')
|
135
|
+
: (this.ele && this.ele.nodeName === 'DATALIST' &&
|
136
|
+
[].slice.call(this.ele.querySelectorAll('option'))
|
137
|
+
.map(option => option.value));
|
138
|
+
if (index$1.t.isFunction(this.host.closest)) {
|
139
|
+
this.ku4Form = this.host.closest('ku4-form');
|
140
|
+
this.form = this.host.closest('form');
|
141
|
+
if (this.form && this.form.addEventListener) {
|
142
|
+
this.form.addEventListener('reset', this.handleReset);
|
143
|
+
}
|
144
|
+
}
|
145
|
+
if (this.inputs) {
|
146
|
+
/**
|
147
|
+
* We "wait" to put this on the next event loop. This allows
|
148
|
+
* ku4-mask to be placed anywhere in the dom and not affect
|
149
|
+
* to workings of ku4-validation.
|
150
|
+
*/
|
151
|
+
index$1.Y(0).then(() => {
|
152
|
+
this.inputs.forEach((input) => {
|
153
|
+
input.addEventListener('input', this.handleInput);
|
154
|
+
input.addEventListener('change', this.handleChange);
|
155
|
+
input.addEventListener('blur', this.handleBlur);
|
156
|
+
});
|
157
|
+
});
|
158
|
+
}
|
159
|
+
else if (this.input) {
|
126
160
|
const describedby = this.input.getAttribute('aria-describedby');
|
127
161
|
const id = this.host.getAttribute('id') || index$1.R.uid();
|
128
162
|
this.host.setAttribute('id', id);
|
@@ -139,13 +173,6 @@ const Ku4Validation = class {
|
|
139
173
|
this.input.addEventListener('change', this.handleChange);
|
140
174
|
this.input.addEventListener('blur', this.handleBlur);
|
141
175
|
});
|
142
|
-
if (index$1.t.isFunction(this.host.closest)) {
|
143
|
-
this.ku4Form = this.host.closest('ku4-form');
|
144
|
-
this.form = this.host.closest('form');
|
145
|
-
if (this.form && this.form.addEventListener) {
|
146
|
-
this.form.addEventListener('reset', this.handleReset);
|
147
|
-
}
|
148
|
-
}
|
149
176
|
}
|
150
177
|
else {
|
151
178
|
// eslint-disable-next-line no-console
|
@@ -153,6 +180,15 @@ const Ku4Validation = class {
|
|
153
180
|
}
|
154
181
|
}
|
155
182
|
disconnectedCallback() {
|
183
|
+
if (this.inputs) {
|
184
|
+
this.inputs.forEach((input) => {
|
185
|
+
if (input && input.removeEventListener) {
|
186
|
+
input.removeEventListener('input', this.handleInput);
|
187
|
+
input.removeEventListener('change', this.handleChange);
|
188
|
+
input.removeEventListener('blur', this.handleBlur);
|
189
|
+
}
|
190
|
+
});
|
191
|
+
}
|
156
192
|
if (this.input && this.input.removeEventListener) {
|
157
193
|
this.input.removeEventListener('input', this.handleInput);
|
158
194
|
this.input.removeEventListener('change', this.handleChange);
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { r as registerInstance, c as createEvent, h as h$1, H as Host, g as getElement } from './index-21724a14.js';
|
2
|
-
import { t, h,
|
2
|
+
import { t, h, Y, R } from './index-4dba724d.js';
|
3
3
|
|
4
4
|
/**
|
5
5
|
* Business logic for form validation:
|
@@ -77,11 +77,11 @@ const Ku4Validation = class {
|
|
77
77
|
async validate() {
|
78
78
|
return await this.assert();
|
79
79
|
}
|
80
|
-
async handleInput() {
|
81
|
-
(
|
80
|
+
async handleInput({ target }) {
|
81
|
+
(target.type === 'file' || t.isFalse(this.isValid)) && await this.assert();
|
82
82
|
}
|
83
|
-
async handleChange() {
|
84
|
-
(
|
83
|
+
async handleChange({ target }) {
|
84
|
+
(target.type === 'file' || t.isFalse(this.isValid)) && await this.assert();
|
85
85
|
}
|
86
86
|
async handleBlur() {
|
87
87
|
await this.assert();
|
@@ -89,36 +89,70 @@ const Ku4Validation = class {
|
|
89
89
|
handleReset() {
|
90
90
|
this.isValid = true;
|
91
91
|
this.invalid = !this.isValid;
|
92
|
-
this.input.setAttribute('aria-invalid', this.invalid);
|
92
|
+
this.input && this.input.setAttribute('aria-invalid', this.invalid);
|
93
93
|
}
|
94
94
|
async assert() {
|
95
|
-
const { ele, validOptions, input, regex, checked } = this;
|
95
|
+
const { ele, validOptions, inputs, input, regex, checked } = this;
|
96
|
+
const previousIsValid = this.isValid;
|
96
97
|
const values = await h.async(async () => await this.ku4Form.read(), {});
|
97
|
-
if (
|
98
|
-
|
98
|
+
if (!this.disabled) {
|
99
|
+
const assertInput = async (i) => {
|
100
|
+
if (i.type === 'file' && t.isNullOrEmpty(i.value)) {
|
101
|
+
return true;
|
102
|
+
}
|
103
|
+
const valid = t.isBool(checked)
|
104
|
+
? i.checked === checked
|
105
|
+
: validate(regex, i.value, validOptions, ele) && await this.validationMethod(i.value, values);
|
106
|
+
i.setAttribute('aria-invalid', !valid);
|
107
|
+
return valid;
|
108
|
+
};
|
109
|
+
this.isValid = inputs
|
110
|
+
? !(await Promise.all(inputs.map(i => assertInput(i)))).some(v => !v)
|
111
|
+
: input
|
112
|
+
? await assertInput(input)
|
113
|
+
: true;
|
114
|
+
}
|
115
|
+
else {
|
116
|
+
this.isValid = true;
|
99
117
|
}
|
100
|
-
const previousIsValid = this.isValid;
|
101
|
-
this.isValid = this.disabled
|
102
|
-
? true
|
103
|
-
: t.isBool(checked)
|
104
|
-
? input.checked === checked
|
105
|
-
: validate(regex, input.value, validOptions, ele) && await this.validationMethod(input.value, values);
|
106
|
-
this.invalid = !this.isValid;
|
107
|
-
input.setAttribute('aria-invalid', this.invalid);
|
108
118
|
if (t.isFalse(previousIsValid) && this.isValid) {
|
109
119
|
this.didValidate.emit(this.isValid);
|
110
120
|
}
|
121
|
+
this.invalid = !this.isValid;
|
111
122
|
return this.isValid;
|
112
123
|
}
|
113
124
|
componentWillLoad() {
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
125
|
+
const ids = this.for.replace(/\s/g, '').replace(/,/g, ',#');
|
126
|
+
this.inputs = /,/.test(this.for) && Array.from(document.querySelectorAll(`#${ids}`));
|
127
|
+
this.input = !/,/.test(this.for) && document.getElementById(this.for);
|
128
|
+
this.ele = document.getElementById(this.element) || document.querySelector(this.element);
|
129
|
+
this.validOptions = t.exists(this.values)
|
130
|
+
? this.values.split(',')
|
131
|
+
: (this.ele && this.ele.nodeName === 'DATALIST' &&
|
132
|
+
[].slice.call(this.ele.querySelectorAll('option'))
|
133
|
+
.map(option => option.value));
|
134
|
+
if (t.isFunction(this.host.closest)) {
|
135
|
+
this.ku4Form = this.host.closest('ku4-form');
|
136
|
+
this.form = this.host.closest('form');
|
137
|
+
if (this.form && this.form.addEventListener) {
|
138
|
+
this.form.addEventListener('reset', this.handleReset);
|
139
|
+
}
|
140
|
+
}
|
141
|
+
if (this.inputs) {
|
142
|
+
/**
|
143
|
+
* We "wait" to put this on the next event loop. This allows
|
144
|
+
* ku4-mask to be placed anywhere in the dom and not affect
|
145
|
+
* to workings of ku4-validation.
|
146
|
+
*/
|
147
|
+
Y(0).then(() => {
|
148
|
+
this.inputs.forEach((input) => {
|
149
|
+
input.addEventListener('input', this.handleInput);
|
150
|
+
input.addEventListener('change', this.handleChange);
|
151
|
+
input.addEventListener('blur', this.handleBlur);
|
152
|
+
});
|
153
|
+
});
|
154
|
+
}
|
155
|
+
else if (this.input) {
|
122
156
|
const describedby = this.input.getAttribute('aria-describedby');
|
123
157
|
const id = this.host.getAttribute('id') || R.uid();
|
124
158
|
this.host.setAttribute('id', id);
|
@@ -135,13 +169,6 @@ const Ku4Validation = class {
|
|
135
169
|
this.input.addEventListener('change', this.handleChange);
|
136
170
|
this.input.addEventListener('blur', this.handleBlur);
|
137
171
|
});
|
138
|
-
if (t.isFunction(this.host.closest)) {
|
139
|
-
this.ku4Form = this.host.closest('ku4-form');
|
140
|
-
this.form = this.host.closest('form');
|
141
|
-
if (this.form && this.form.addEventListener) {
|
142
|
-
this.form.addEventListener('reset', this.handleReset);
|
143
|
-
}
|
144
|
-
}
|
145
172
|
}
|
146
173
|
else {
|
147
174
|
// eslint-disable-next-line no-console
|
@@ -149,6 +176,15 @@ const Ku4Validation = class {
|
|
149
176
|
}
|
150
177
|
}
|
151
178
|
disconnectedCallback() {
|
179
|
+
if (this.inputs) {
|
180
|
+
this.inputs.forEach((input) => {
|
181
|
+
if (input && input.removeEventListener) {
|
182
|
+
input.removeEventListener('input', this.handleInput);
|
183
|
+
input.removeEventListener('change', this.handleChange);
|
184
|
+
input.removeEventListener('blur', this.handleBlur);
|
185
|
+
}
|
186
|
+
});
|
187
|
+
}
|
152
188
|
if (this.input && this.input.removeEventListener) {
|
153
189
|
this.input.removeEventListener('input', this.handleInput);
|
154
190
|
this.input.removeEventListener('change', this.handleChange);
|
@@ -1 +1 @@
|
|
1
|
-
var __awaiter=this&&this.__awaiter||function(t,e,i,n){function r(t){return t instanceof i?t:new i((function(e){e(t)}))}return new(i||(i=Promise))((function(i,s){function a(t){try{
|
1
|
+
var __awaiter=this&&this.__awaiter||function(t,e,i,n){function r(t){return t instanceof i?t:new i((function(e){e(t)}))}return new(i||(i=Promise))((function(i,s){function a(t){try{u(n.next(t))}catch(e){s(e)}}function o(t){try{u(n["throw"](t))}catch(e){s(e)}}function u(t){t.done?i(t.value):r(t.value).then(a,o)}u((n=n.apply(t,e||[])).next())}))};var __generator=this&&this.__generator||function(t,e){var i={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,r,s,a;return a={next:o(0),throw:o(1),return:o(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function o(t){return function(e){return u([t,e])}}function u(a){if(n)throw new TypeError("Generator is already executing.");while(i)try{if(n=1,r&&(s=a[0]&2?r["return"]:a[0]?r["throw"]||((s=r["return"])&&s.call(r),0):r.next)&&!(s=s.call(r,a[1])).done)return s;if(r=0,s)a=[a[0]&2,s.value];switch(a[0]){case 0:case 1:s=a;break;case 4:i.label++;return{value:a[1],done:false};case 5:i.label++;r=a[1];a=[0];continue;case 7:a=i.ops.pop();i.trys.pop();continue;default:if(!(s=i.trys,s=s.length>0&&s[s.length-1])&&(a[0]===6||a[0]===2)){i=0;continue}if(a[0]===3&&(!s||a[1]>s[0]&&a[1]<s[3])){i.label=a[1];break}if(a[0]===6&&i.label<s[1]){i.label=s[1];s=a;break}if(s&&i.label<s[2]){i.label=s[2];i.ops.push(a);break}if(s[2])i.ops.pop();i.trys.pop();continue}a=e.call(t,i)}catch(o){a=[6,o];r=0}finally{n=s=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};import{r as registerInstance,c as createEvent,h as h$1,H as Host,g as getElement}from"./index-21724a14.js";import{t,h,Y,R}from"./index-4dba724d.js";var validate=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 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}";var Ku4Validation=function(){function e(e){registerInstance(this,e);this.didValidate=createEvent(this,"validate",7);this.pattern=".*";this.flags="";this.method="";var i=this.pattern.split(" ");var n=this.flags.split(" ");var r=t.isString(this.method)?this.method.trim():this.method;this.regex=i.map((function(t,e){return new RegExp(t,n[e])}));this.validationMethod=t.isNullOrEmpty(r)?function(){return true}:t.isString(r)?new Function("value, values",/^return/.test(r)?r:"return ".concat(r)):t.isFunction(r)?r:function(){return true};this.handleInput=this.handleInput.bind(this);this.handleChange=this.handleChange.bind(this);this.handleBlur=this.handleBlur.bind(this);this.handleReset=this.handleReset.bind(this)}e.prototype.validate=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){switch(t.label){case 0:return[4,this.assert()];case 1:return[2,t.sent()]}}))}))};e.prototype.handleInput=function(e){var i=e.target;return __awaiter(this,void 0,void 0,(function(){var e;return __generator(this,(function(n){switch(n.label){case 0:e=i.type==="file"||t.isFalse(this.isValid);if(!e)return[3,2];return[4,this.assert()];case 1:e=n.sent();n.label=2;case 2:e;return[2]}}))}))};e.prototype.handleChange=function(e){var i=e.target;return __awaiter(this,void 0,void 0,(function(){var e;return __generator(this,(function(n){switch(n.label){case 0:e=i.type==="file"||t.isFalse(this.isValid);if(!e)return[3,2];return[4,this.assert()];case 1:e=n.sent();n.label=2;case 2:e;return[2]}}))}))};e.prototype.handleBlur=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){switch(t.label){case 0:return[4,this.assert()];case 1:t.sent();return[2]}}))}))};e.prototype.handleReset=function(){this.isValid=true;this.invalid=!this.isValid;this.input&&this.input.setAttribute("aria-invalid",this.invalid)};e.prototype.assert=function(){return __awaiter(this,void 0,void 0,(function(){var e,i,n,r,s,a,o,u,l,c,d,f,v;var p=this;return __generator(this,(function(m){switch(m.label){case 0:e=this,i=e.ele,n=e.validOptions,r=e.inputs,s=e.input,a=e.regex,o=e.checked;u=this.isValid;return[4,h.async((function(){return __awaiter(p,void 0,void 0,(function(){return __generator(this,(function(t){switch(t.label){case 0:return[4,this.ku4Form.read()];case 1:return[2,t.sent()]}}))}))}),{})];case 1:l=m.sent();if(!!this.disabled)return[3,8];c=function(e){return __awaiter(p,void 0,void 0,(function(){var r,s,u;return __generator(this,(function(h){switch(h.label){case 0:if(e.type==="file"&&t.isNullOrEmpty(e.value)){return[2,true]}if(!t.isBool(o))return[3,1];s=e.checked===o;return[3,4];case 1:u=validate(a,e.value,n,i);if(!u)return[3,3];return[4,this.validationMethod(e.value,l)];case 2:u=h.sent();h.label=3;case 3:s=u;h.label=4;case 4:r=s;e.setAttribute("aria-invalid",!r);return[2,r]}}))}))};d=this;if(!r)return[3,3];return[4,Promise.all(r.map((function(t){return c(t)})))];case 2:f=!m.sent().some((function(t){return!t}));return[3,7];case 3:if(!s)return[3,5];return[4,c(s)];case 4:v=m.sent();return[3,6];case 5:v=true;m.label=6;case 6:f=v;m.label=7;case 7:d.isValid=f;return[3,9];case 8:this.isValid=true;m.label=9;case 9:if(t.isFalse(u)&&this.isValid){this.didValidate.emit(this.isValid)}this.invalid=!this.isValid;return[2,this.isValid]}}))}))};e.prototype.componentWillLoad=function(){var e=this;var i=this.for.replace(/\s/g,"").replace(/,/g,",#");this.inputs=/,/.test(this.for)&&Array.from(document.querySelectorAll("#".concat(i)));this.input=!/,/.test(this.for)&&document.getElementById(this.for);this.ele=document.getElementById(this.element)||document.querySelector(this.element);this.validOptions=t.exists(this.values)?this.values.split(","):this.ele&&this.ele.nodeName==="DATALIST"&&[].slice.call(this.ele.querySelectorAll("option")).map((function(t){return t.value}));if(t.isFunction(this.host.closest)){this.ku4Form=this.host.closest("ku4-form");this.form=this.host.closest("form");if(this.form&&this.form.addEventListener){this.form.addEventListener("reset",this.handleReset)}}if(this.inputs){Y(0).then((function(){e.inputs.forEach((function(t){t.addEventListener("input",e.handleInput);t.addEventListener("change",e.handleChange);t.addEventListener("blur",e.handleBlur)}))}))}else if(this.input){var n=this.input.getAttribute("aria-describedby");var r=this.host.getAttribute("id")||R.uid();this.host.setAttribute("id",r);if(t.isNullOrEmpty(n)){this.input.setAttribute("aria-describedby",r)}Y(0).then((function(){e.input.addEventListener("input",e.handleInput);e.input.addEventListener("change",e.handleChange);e.input.addEventListener("blur",e.handleBlur)}))}else{console.error("ku4-validation must have a valid `for` referencing target field `id`.")}};e.prototype.disconnectedCallback=function(){var t=this;if(this.inputs){this.inputs.forEach((function(e){if(e&&e.removeEventListener){e.removeEventListener("input",t.handleInput);e.removeEventListener("change",t.handleChange);e.removeEventListener("blur",t.handleBlur)}}))}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)}};e.prototype.render=function(){return h$1(Host,{role:"alert","aria-live":"assertive"},h$1("slot",null))};Object.defineProperty(e.prototype,"host",{get:function(){return getElement(this)},enumerable:false,configurable:true});return e}();Ku4Validation.style=ku4ValidationCss;export{Ku4Validation as ku4_validation};
|
@@ -1 +1 @@
|
|
1
|
-
import{d as e,N as t,w as s,p as a,b as o}from"./p-0943c493.js";(()=>{const o=Array.from(e.querySelectorAll("script")).find((e=>new RegExp(`/${t}(\\.esm)?\\.js($|\\?|#)`).test(e.src)||e.getAttribute("data-stencil-namespace")===t)),l={};return"onbeforeload"in o&&!history.scrollRestoration?{then(){}}:(l.resourcesUrl=new URL(".",new URL(o.getAttribute("data-resources-url")||o.src,s.location.href)).href,a(l))})().then((e=>o([["p-5acd5997",[[1,"ku4-carousel",{swipeTolerance:[2,"swipe-tolerance"],auto:[4],noSwipe:[4,"no-swipe"],delay:[2],slideState:[32],next:[64],previous:[64],slideTo:[64],pause:[64],play:[64]}]]],["p-9d027a50",[[1,"ku4-carousel-controls",{for:[1]}]]],["p-f33f1619",[[1,"ku4-carousel-slide",{name:[1544],active:[32],classList:[32],slideIn:[64],slideOut:[64],activate:[64],deactivate:[64]}]]],["p-a4cd5761",[[1,"ku4-col",{startXs:[2,"start-xs"],startSm:[2,"start-sm"],startMd:[2,"start-md"],startLg:[2,"start-lg"],spanXs:[2,"span-xs"],spanSm:[2,"span-sm"],spanMd:[2,"span-md"],spanLg:[2,"span-lg"],orderXs:[2,"order-xs"],orderSm:[2,"order-sm"],orderMd:[2,"order-md"],orderLg:[2,"order-lg"]}]]],["p-2f4a16d7",[[1,"ku4-drawer",{bottom:[516],left:[516],right:[516],top:[516],size:[1],open:[1540],toggle:[64]}]]],["p-c305fd7d",[[1,"ku4-feature",{on:[4],policy:[1],enabled:[32]}]]],["p-3742c929",[[1,"ku4-focus-trap",{active:[1540],include:[1],exclude:[1],excludeShadow:[1,"exclude-shadow"],initial:[1],return:[1],activate:[64],deactivate:[64]}]]],["p-20a7e124",[[4,"ku4-form",{valid:[1028],invalid:[1540],listFieldNames:[64],validate:[64],invalidate:[64],read:[64],write:[64],focusFirstInvalid:[64]}]]],["p-0669a534",[[1,"ku4-grid",{columnsXs:[2,"columns-xs"],columnsSm:[2,"columns-sm"],columnsMd:[2,"columns-md"],columnsLg:[2,"columns-lg"],offsetLeftXs:[2,"offset-left-xs"],offsetLeftSm:[2,"offset-left-sm"],offsetLeftMd:[2,"offset-left-md"],offsetLeftLg:[2,"offset-left-lg"],offsetRight:[2,"offset-right"],offsetRightXs:[2,"offset-right-xs"],offsetRightSm:[2,"offset-right-sm"],offsetRightMd:[2,"offset-right-md"],offsetRightLg:[2,"offset-right-lg"],offsetXs:[2,"offset-xs"],offsetSm:[2,"offset-sm"],offsetMd:[2,"offset-md"],offsetLg:[2,"offset-lg"]}]]],["p-3d59749e",[[1,"ku4-label",{for:[1],value:[1],empty:[32]}]]],["p-d9a5870c",[[1,"ku4-mask",{for:[1],template:[1],ban:[1],pattern:[1],char:[1],hidden:[4]}]]],["p-d1b4d5dc",[[1,"ku4-modal",{visible:[1540],dismissable:[4],dismissible:[4],focusTrap:[1,"focus-trap"],display:[64],dismiss:[64]},[[8,"keyup","handleKeyUp"]]]]],["p-996461ba",[[1,"ku4-panel",{open:[1540],maxHeight:[32],toggle:[64],close:[64]},[[0,"transitionend","handleTransitionEnd"]]]]],["p-332a5a54",[[1,"ku4-preview",{for:[1],src:[1],altsrc:[1],orientation:[2],resolutionX:[2,"resolution-x"],resolutionY:[2,"resolution-y"],capture:[1],status:[1537],alt:[1],currentSrc:[32],read:[64]}]]],["p-bb380a04",[[1,"ku4-tab",{selected:[1540],panel:[32],select:[64],deselect:[64],connect:[64]},[[0,"click","handleClick"],[0,"keyup","handleKeyUp"]]]]],["p-5119224c",[[1,"ku4-tab-list",{open:[64]},[[0,"ku4TabClick","handleTabClick"],[0,"ku4TabKeyup","handleTabKeyUp"]]]]],["p-56f61856",[[1,"ku4-tab-panel",{selected:[1540],maxHeight:[32],tab:[32],select:[64],deselect:[64],connect:[64]},[[0,"transitionend","handleTransitionEnd"]]]]],["p-6f6a8c8d",[[4,"ku4-table",{stackXs:[1537,"stack-xs"],stackSm:[1537,"stack-sm"]}]]],["p-7875dc99",[[1,"ku4-tooltip",{element:[1],top:[4],left:[4],bottom:[4],right:[4],debug:[4],show:[64],hide:[64]}]]],["p-
|
1
|
+
import{d as e,N as t,w as s,p as a,b as o}from"./p-0943c493.js";(()=>{const o=Array.from(e.querySelectorAll("script")).find((e=>new RegExp(`/${t}(\\.esm)?\\.js($|\\?|#)`).test(e.src)||e.getAttribute("data-stencil-namespace")===t)),l={};return"onbeforeload"in o&&!history.scrollRestoration?{then(){}}:(l.resourcesUrl=new URL(".",new URL(o.getAttribute("data-resources-url")||o.src,s.location.href)).href,a(l))})().then((e=>o([["p-5acd5997",[[1,"ku4-carousel",{swipeTolerance:[2,"swipe-tolerance"],auto:[4],noSwipe:[4,"no-swipe"],delay:[2],slideState:[32],next:[64],previous:[64],slideTo:[64],pause:[64],play:[64]}]]],["p-9d027a50",[[1,"ku4-carousel-controls",{for:[1]}]]],["p-f33f1619",[[1,"ku4-carousel-slide",{name:[1544],active:[32],classList:[32],slideIn:[64],slideOut:[64],activate:[64],deactivate:[64]}]]],["p-a4cd5761",[[1,"ku4-col",{startXs:[2,"start-xs"],startSm:[2,"start-sm"],startMd:[2,"start-md"],startLg:[2,"start-lg"],spanXs:[2,"span-xs"],spanSm:[2,"span-sm"],spanMd:[2,"span-md"],spanLg:[2,"span-lg"],orderXs:[2,"order-xs"],orderSm:[2,"order-sm"],orderMd:[2,"order-md"],orderLg:[2,"order-lg"]}]]],["p-2f4a16d7",[[1,"ku4-drawer",{bottom:[516],left:[516],right:[516],top:[516],size:[1],open:[1540],toggle:[64]}]]],["p-c305fd7d",[[1,"ku4-feature",{on:[4],policy:[1],enabled:[32]}]]],["p-3742c929",[[1,"ku4-focus-trap",{active:[1540],include:[1],exclude:[1],excludeShadow:[1,"exclude-shadow"],initial:[1],return:[1],activate:[64],deactivate:[64]}]]],["p-20a7e124",[[4,"ku4-form",{valid:[1028],invalid:[1540],listFieldNames:[64],validate:[64],invalidate:[64],read:[64],write:[64],focusFirstInvalid:[64]}]]],["p-0669a534",[[1,"ku4-grid",{columnsXs:[2,"columns-xs"],columnsSm:[2,"columns-sm"],columnsMd:[2,"columns-md"],columnsLg:[2,"columns-lg"],offsetLeftXs:[2,"offset-left-xs"],offsetLeftSm:[2,"offset-left-sm"],offsetLeftMd:[2,"offset-left-md"],offsetLeftLg:[2,"offset-left-lg"],offsetRight:[2,"offset-right"],offsetRightXs:[2,"offset-right-xs"],offsetRightSm:[2,"offset-right-sm"],offsetRightMd:[2,"offset-right-md"],offsetRightLg:[2,"offset-right-lg"],offsetXs:[2,"offset-xs"],offsetSm:[2,"offset-sm"],offsetMd:[2,"offset-md"],offsetLg:[2,"offset-lg"]}]]],["p-3d59749e",[[1,"ku4-label",{for:[1],value:[1],empty:[32]}]]],["p-d9a5870c",[[1,"ku4-mask",{for:[1],template:[1],ban:[1],pattern:[1],char:[1],hidden:[4]}]]],["p-d1b4d5dc",[[1,"ku4-modal",{visible:[1540],dismissable:[4],dismissible:[4],focusTrap:[1,"focus-trap"],display:[64],dismiss:[64]},[[8,"keyup","handleKeyUp"]]]]],["p-996461ba",[[1,"ku4-panel",{open:[1540],maxHeight:[32],toggle:[64],close:[64]},[[0,"transitionend","handleTransitionEnd"]]]]],["p-332a5a54",[[1,"ku4-preview",{for:[1],src:[1],altsrc:[1],orientation:[2],resolutionX:[2,"resolution-x"],resolutionY:[2,"resolution-y"],capture:[1],status:[1537],alt:[1],currentSrc:[32],read:[64]}]]],["p-bb380a04",[[1,"ku4-tab",{selected:[1540],panel:[32],select:[64],deselect:[64],connect:[64]},[[0,"click","handleClick"],[0,"keyup","handleKeyUp"]]]]],["p-5119224c",[[1,"ku4-tab-list",{open:[64]},[[0,"ku4TabClick","handleTabClick"],[0,"ku4TabKeyup","handleTabKeyUp"]]]]],["p-56f61856",[[1,"ku4-tab-panel",{selected:[1540],maxHeight:[32],tab:[32],select:[64],deselect:[64],connect:[64]},[[0,"transitionend","handleTransitionEnd"]]]]],["p-6f6a8c8d",[[4,"ku4-table",{stackXs:[1537,"stack-xs"],stackSm:[1537,"stack-sm"]}]]],["p-7875dc99",[[1,"ku4-tooltip",{element:[1],top:[4],left:[4],bottom:[4],right:[4],debug:[4],show:[64],hide:[64]}]]],["p-f23287da",[[1,"ku4-validation",{for:[513],element:[513],pattern:[1],flags:[1],values:[1],checked:[4],method:[1],invalid:[1540],disabled:[1540],hidden:[1540],isValid:[32],validate:[64]}]]]],e)));
|
@@ -0,0 +1 @@
|
|
1
|
+
var __awaiter=this&&this.__awaiter||function(t,e,i,n){function r(t){return t instanceof i?t:new i((function(e){e(t)}))}return new(i||(i=Promise))((function(i,s){function a(t){try{o(n.next(t))}catch(e){s(e)}}function u(t){try{o(n["throw"](t))}catch(e){s(e)}}function o(t){t.done?i(t.value):r(t.value).then(a,u)}o((n=n.apply(t,e||[])).next())}))};var __generator=this&&this.__generator||function(t,e){var i={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,r,s,a;return a={next:u(0),throw:u(1),return:u(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function u(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,r&&(s=a[0]&2?r["return"]:a[0]?r["throw"]||((s=r["return"])&&s.call(r),0):r.next)&&!(s=s.call(r,a[1])).done)return s;if(r=0,s)a=[a[0]&2,s.value];switch(a[0]){case 0:case 1:s=a;break;case 4:i.label++;return{value:a[1],done:false};case 5:i.label++;r=a[1];a=[0];continue;case 7:a=i.ops.pop();i.trys.pop();continue;default:if(!(s=i.trys,s=s.length>0&&s[s.length-1])&&(a[0]===6||a[0]===2)){i=0;continue}if(a[0]===3&&(!s||a[1]>s[0]&&a[1]<s[3])){i.label=a[1];break}if(a[0]===6&&i.label<s[1]){i.label=s[1];s=a;break}if(s&&i.label<s[2]){i.label=s[2];i.ops.push(a);break}if(s[2])i.ops.pop();i.trys.pop();continue}a=e.call(t,i)}catch(u){a=[6,u];r=0}finally{n=s=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};System.register(["./p-55f5c91c.system.js","./p-e11b977e.system.js"],(function(t){"use strict";var e,i,n,r,s,a,u,o,l;return{setters:[function(t){e=t.r;i=t.c;n=t.h;r=t.H;s=t.g},function(t){a=t.t;u=t.h;o=t.Y;l=t.R}],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 c=":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 r=this.flags.split(" ");var s=a.isString(this.method)?this.method.trim():this.method;this.regex=n.map((function(t,e){return new RegExp(t,r[e])}));this.validationMethod=a.isNullOrEmpty(s)?function(){return true}:a.isString(s)?new Function("value, values",/^return/.test(s)?s:"return ".concat(s)):a.isFunction(s)?s:function(){return true};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){switch(t.label){case 0:return[4,this.assert()];case 1:return[2,t.sent()]}}))}))};t.prototype.handleInput=function(t){var e=t.target;return __awaiter(this,void 0,void 0,(function(){var t;return __generator(this,(function(i){switch(i.label){case 0:t=e.type==="file"||a.isFalse(this.isValid);if(!t)return[3,2];return[4,this.assert()];case 1:t=i.sent();i.label=2;case 2:t;return[2]}}))}))};t.prototype.handleChange=function(t){var e=t.target;return __awaiter(this,void 0,void 0,(function(){var t;return __generator(this,(function(i){switch(i.label){case 0:t=e.type==="file"||a.isFalse(this.isValid);if(!t)return[3,2];return[4,this.assert()];case 1:t=i.sent();i.label=2;case 2:t;return[2]}}))}))};t.prototype.handleBlur=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){switch(t.label){case 0:return[4,this.assert()];case 1:t.sent();return[2]}}))}))};t.prototype.handleReset=function(){this.isValid=true;this.invalid=!this.isValid;this.input&&this.input.setAttribute("aria-invalid",this.invalid)};t.prototype.assert=function(){return __awaiter(this,void 0,void 0,(function(){var t,e,i,n,r,s,o,l,c,d,f,v,p;var b=this;return __generator(this,(function(m){switch(m.label){case 0:t=this,e=t.ele,i=t.validOptions,n=t.inputs,r=t.input,s=t.regex,o=t.checked;l=this.isValid;return[4,u.async((function(){return __awaiter(b,void 0,void 0,(function(){return __generator(this,(function(t){switch(t.label){case 0:return[4,this.ku4Form.read()];case 1:return[2,t.sent()]}}))}))}),{})];case 1:c=m.sent();if(!!this.disabled)return[3,8];d=function(t){return __awaiter(b,void 0,void 0,(function(){var n,r,u;return __generator(this,(function(l){switch(l.label){case 0:if(t.type==="file"&&a.isNullOrEmpty(t.value)){return[2,true]}if(!a.isBool(o))return[3,1];r=t.checked===o;return[3,4];case 1:u=h(s,t.value,i,e);if(!u)return[3,3];return[4,this.validationMethod(t.value,c)];case 2:u=l.sent();l.label=3;case 3:r=u;l.label=4;case 4:n=r;t.setAttribute("aria-invalid",!n);return[2,n]}}))}))};f=this;if(!n)return[3,3];return[4,Promise.all(n.map((function(t){return d(t)})))];case 2:v=!m.sent().some((function(t){return!t}));return[3,7];case 3:if(!r)return[3,5];return[4,d(r)];case 4:p=m.sent();return[3,6];case 5:p=true;m.label=6;case 6:v=p;m.label=7;case 7:f.isValid=v;return[3,9];case 8:this.isValid=true;m.label=9;case 9:if(a.isFalse(l)&&this.isValid){this.didValidate.emit(this.isValid)}this.invalid=!this.isValid;return[2,this.isValid]}}))}))};t.prototype.componentWillLoad=function(){var t=this;var e=this.for.replace(/\s/g,"").replace(/,/g,",#");this.inputs=/,/.test(this.for)&&Array.from(document.querySelectorAll("#".concat(e)));this.input=!/,/.test(this.for)&&document.getElementById(this.for);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}));if(a.isFunction(this.host.closest)){this.ku4Form=this.host.closest("ku4-form");this.form=this.host.closest("form");if(this.form&&this.form.addEventListener){this.form.addEventListener("reset",this.handleReset)}}if(this.inputs){o(0).then((function(){t.inputs.forEach((function(e){e.addEventListener("input",t.handleInput);e.addEventListener("change",t.handleChange);e.addEventListener("blur",t.handleBlur)}))}))}else if(this.input){var i=this.input.getAttribute("aria-describedby");var n=this.host.getAttribute("id")||l.uid();this.host.setAttribute("id",n);if(a.isNullOrEmpty(i)){this.input.setAttribute("aria-describedby",n)}o(0).then((function(){t.input.addEventListener("input",t.handleInput);t.input.addEventListener("change",t.handleChange);t.input.addEventListener("blur",t.handleBlur)}))}else{console.error("ku4-validation must have a valid `for` referencing target field `id`.")}};t.prototype.disconnectedCallback=function(){var t=this;if(this.inputs){this.inputs.forEach((function(e){if(e&&e.removeEventListener){e.removeEventListener("input",t.handleInput);e.removeEventListener("change",t.handleChange);e.removeEventListener("blur",t.handleBlur)}}))}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(r,{role:"alert","aria-live":"assertive"},n("slot",null))};Object.defineProperty(t.prototype,"host",{get:function(){return s(this)},enumerable:false,configurable:true});return t}());d.style=c}}}));
|
@@ -1 +1 @@
|
|
1
|
-
System.register(["./p-55f5c91c.system.js"],(function(){"use strict";var e,t,s,a,o;return{setters:[function(r){e=r.d;t=r.N;s=r.w;a=r.p;o=r.b}],execute:function(){var r=function(){var o=Array.from(e.querySelectorAll("script")).find((function(e){return new RegExp("/".concat(t,"(\\.esm)?\\.js($|\\?|#)")).test(e.src)||e.getAttribute("data-stencil-namespace")===t}));var r={};if("onbeforeload"in o&&!history.scrollRestoration){return{then:function(){}}}{r.resourcesUrl=new URL(".",new URL(o.getAttribute("data-resources-url")||o.src,s.location.href)).href}return a(r)};r().then((function(e){return o([["p-746378d8.system",[[1,"ku4-carousel",{swipeTolerance:[2,"swipe-tolerance"],auto:[4],noSwipe:[4,"no-swipe"],delay:[2],slideState:[32],next:[64],previous:[64],slideTo:[64],pause:[64],play:[64]}]]],["p-6715c004.system",[[1,"ku4-carousel-controls",{for:[1]}]]],["p-6c7c6b42.system",[[1,"ku4-carousel-slide",{name:[1544],active:[32],classList:[32],slideIn:[64],slideOut:[64],activate:[64],deactivate:[64]}]]],["p-b2af9e06.system",[[1,"ku4-col",{startXs:[2,"start-xs"],startSm:[2,"start-sm"],startMd:[2,"start-md"],startLg:[2,"start-lg"],spanXs:[2,"span-xs"],spanSm:[2,"span-sm"],spanMd:[2,"span-md"],spanLg:[2,"span-lg"],orderXs:[2,"order-xs"],orderSm:[2,"order-sm"],orderMd:[2,"order-md"],orderLg:[2,"order-lg"]}]]],["p-2da96838.system",[[1,"ku4-drawer",{bottom:[516],left:[516],right:[516],top:[516],size:[1],open:[1540],toggle:[64]}]]],["p-d56159f9.system",[[1,"ku4-feature",{on:[4],policy:[1],enabled:[32]}]]],["p-ee51fe4d.system",[[1,"ku4-focus-trap",{active:[1540],include:[1],exclude:[1],excludeShadow:[1,"exclude-shadow"],initial:[1],return:[1],activate:[64],deactivate:[64]}]]],["p-03c61943.system",[[4,"ku4-form",{valid:[1028],invalid:[1540],listFieldNames:[64],validate:[64],invalidate:[64],read:[64],write:[64],focusFirstInvalid:[64]}]]],["p-be3b5409.system",[[1,"ku4-grid",{columnsXs:[2,"columns-xs"],columnsSm:[2,"columns-sm"],columnsMd:[2,"columns-md"],columnsLg:[2,"columns-lg"],offsetLeftXs:[2,"offset-left-xs"],offsetLeftSm:[2,"offset-left-sm"],offsetLeftMd:[2,"offset-left-md"],offsetLeftLg:[2,"offset-left-lg"],offsetRight:[2,"offset-right"],offsetRightXs:[2,"offset-right-xs"],offsetRightSm:[2,"offset-right-sm"],offsetRightMd:[2,"offset-right-md"],offsetRightLg:[2,"offset-right-lg"],offsetXs:[2,"offset-xs"],offsetSm:[2,"offset-sm"],offsetMd:[2,"offset-md"],offsetLg:[2,"offset-lg"]}]]],["p-74ef5565.system",[[1,"ku4-label",{for:[1],value:[1],empty:[32]}]]],["p-96c08f79.system",[[1,"ku4-mask",{for:[1],template:[1],ban:[1],pattern:[1],char:[1],hidden:[4]}]]],["p-36e2caf6.system",[[1,"ku4-modal",{visible:[1540],dismissable:[4],dismissible:[4],focusTrap:[1,"focus-trap"],display:[64],dismiss:[64]},[[8,"keyup","handleKeyUp"]]]]],["p-220c33c5.system",[[1,"ku4-panel",{open:[1540],maxHeight:[32],toggle:[64],close:[64]},[[0,"transitionend","handleTransitionEnd"]]]]],["p-4243b0a9.system",[[1,"ku4-preview",{for:[1],src:[1],altsrc:[1],orientation:[2],resolutionX:[2,"resolution-x"],resolutionY:[2,"resolution-y"],capture:[1],status:[1537],alt:[1],currentSrc:[32],read:[64]}]]],["p-9404f926.system",[[1,"ku4-tab",{selected:[1540],panel:[32],select:[64],deselect:[64],connect:[64]},[[0,"click","handleClick"],[0,"keyup","handleKeyUp"]]]]],["p-90553d69.system",[[1,"ku4-tab-list",{open:[64]},[[0,"ku4TabClick","handleTabClick"],[0,"ku4TabKeyup","handleTabKeyUp"]]]]],["p-6fc54c2b.system",[[1,"ku4-tab-panel",{selected:[1540],maxHeight:[32],tab:[32],select:[64],deselect:[64],connect:[64]},[[0,"transitionend","handleTransitionEnd"]]]]],["p-2df06b36.system",[[4,"ku4-table",{stackXs:[1537,"stack-xs"],stackSm:[1537,"stack-sm"]}]]],["p-22afbc6b.system",[[1,"ku4-tooltip",{element:[1],top:[4],left:[4],bottom:[4],right:[4],debug:[4],show:[64],hide:[64]}]]],["p-
|
1
|
+
System.register(["./p-55f5c91c.system.js"],(function(){"use strict";var e,t,s,a,o;return{setters:[function(r){e=r.d;t=r.N;s=r.w;a=r.p;o=r.b}],execute:function(){var r=function(){var o=Array.from(e.querySelectorAll("script")).find((function(e){return new RegExp("/".concat(t,"(\\.esm)?\\.js($|\\?|#)")).test(e.src)||e.getAttribute("data-stencil-namespace")===t}));var r={};if("onbeforeload"in o&&!history.scrollRestoration){return{then:function(){}}}{r.resourcesUrl=new URL(".",new URL(o.getAttribute("data-resources-url")||o.src,s.location.href)).href}return a(r)};r().then((function(e){return o([["p-746378d8.system",[[1,"ku4-carousel",{swipeTolerance:[2,"swipe-tolerance"],auto:[4],noSwipe:[4,"no-swipe"],delay:[2],slideState:[32],next:[64],previous:[64],slideTo:[64],pause:[64],play:[64]}]]],["p-6715c004.system",[[1,"ku4-carousel-controls",{for:[1]}]]],["p-6c7c6b42.system",[[1,"ku4-carousel-slide",{name:[1544],active:[32],classList:[32],slideIn:[64],slideOut:[64],activate:[64],deactivate:[64]}]]],["p-b2af9e06.system",[[1,"ku4-col",{startXs:[2,"start-xs"],startSm:[2,"start-sm"],startMd:[2,"start-md"],startLg:[2,"start-lg"],spanXs:[2,"span-xs"],spanSm:[2,"span-sm"],spanMd:[2,"span-md"],spanLg:[2,"span-lg"],orderXs:[2,"order-xs"],orderSm:[2,"order-sm"],orderMd:[2,"order-md"],orderLg:[2,"order-lg"]}]]],["p-2da96838.system",[[1,"ku4-drawer",{bottom:[516],left:[516],right:[516],top:[516],size:[1],open:[1540],toggle:[64]}]]],["p-d56159f9.system",[[1,"ku4-feature",{on:[4],policy:[1],enabled:[32]}]]],["p-ee51fe4d.system",[[1,"ku4-focus-trap",{active:[1540],include:[1],exclude:[1],excludeShadow:[1,"exclude-shadow"],initial:[1],return:[1],activate:[64],deactivate:[64]}]]],["p-03c61943.system",[[4,"ku4-form",{valid:[1028],invalid:[1540],listFieldNames:[64],validate:[64],invalidate:[64],read:[64],write:[64],focusFirstInvalid:[64]}]]],["p-be3b5409.system",[[1,"ku4-grid",{columnsXs:[2,"columns-xs"],columnsSm:[2,"columns-sm"],columnsMd:[2,"columns-md"],columnsLg:[2,"columns-lg"],offsetLeftXs:[2,"offset-left-xs"],offsetLeftSm:[2,"offset-left-sm"],offsetLeftMd:[2,"offset-left-md"],offsetLeftLg:[2,"offset-left-lg"],offsetRight:[2,"offset-right"],offsetRightXs:[2,"offset-right-xs"],offsetRightSm:[2,"offset-right-sm"],offsetRightMd:[2,"offset-right-md"],offsetRightLg:[2,"offset-right-lg"],offsetXs:[2,"offset-xs"],offsetSm:[2,"offset-sm"],offsetMd:[2,"offset-md"],offsetLg:[2,"offset-lg"]}]]],["p-74ef5565.system",[[1,"ku4-label",{for:[1],value:[1],empty:[32]}]]],["p-96c08f79.system",[[1,"ku4-mask",{for:[1],template:[1],ban:[1],pattern:[1],char:[1],hidden:[4]}]]],["p-36e2caf6.system",[[1,"ku4-modal",{visible:[1540],dismissable:[4],dismissible:[4],focusTrap:[1,"focus-trap"],display:[64],dismiss:[64]},[[8,"keyup","handleKeyUp"]]]]],["p-220c33c5.system",[[1,"ku4-panel",{open:[1540],maxHeight:[32],toggle:[64],close:[64]},[[0,"transitionend","handleTransitionEnd"]]]]],["p-4243b0a9.system",[[1,"ku4-preview",{for:[1],src:[1],altsrc:[1],orientation:[2],resolutionX:[2,"resolution-x"],resolutionY:[2,"resolution-y"],capture:[1],status:[1537],alt:[1],currentSrc:[32],read:[64]}]]],["p-9404f926.system",[[1,"ku4-tab",{selected:[1540],panel:[32],select:[64],deselect:[64],connect:[64]},[[0,"click","handleClick"],[0,"keyup","handleKeyUp"]]]]],["p-90553d69.system",[[1,"ku4-tab-list",{open:[64]},[[0,"ku4TabClick","handleTabClick"],[0,"ku4TabKeyup","handleTabKeyUp"]]]]],["p-6fc54c2b.system",[[1,"ku4-tab-panel",{selected:[1540],maxHeight:[32],tab:[32],select:[64],deselect:[64],connect:[64]},[[0,"transitionend","handleTransitionEnd"]]]]],["p-2df06b36.system",[[4,"ku4-table",{stackXs:[1537,"stack-xs"],stackSm:[1537,"stack-sm"]}]]],["p-22afbc6b.system",[[1,"ku4-tooltip",{element:[1],top:[4],left:[4],bottom:[4],right:[4],debug:[4],show:[64],hide:[64]}]]],["p-43d724df.system",[[1,"ku4-validation",{for:[513],element:[513],pattern:[1],flags:[1],values:[1],checked:[4],method:[1],invalid:[1540],disabled:[1540],hidden:[1540],isValid:[32],validate:[64]}]]]],e)}))}}}));
|
@@ -0,0 +1 @@
|
|
1
|
+
import{r as i,c as t,h as s,H as h,g as a}from"./p-0943c493.js";import{t as e,h as n,Y as r,R as l}from"./p-0af98743.js";const o=class{constructor(s){i(this,s),this.didValidate=t(this,"validate",7),this.pattern=".*",this.flags="",this.method="";const h=this.pattern.split(" "),a=this.flags.split(" "),n=e.isString(this.method)?this.method.trim():this.method;this.regex=h.map(((i,t)=>new RegExp(i,a[t]))),this.validationMethod=e.isNullOrEmpty(n)?()=>!0:e.isString(n)?new Function("value, values",/^return/.test(n)?n:`return ${n}`):e.isFunction(n)?n:()=>!0,this.handleInput=this.handleInput.bind(this),this.handleChange=this.handleChange.bind(this),this.handleBlur=this.handleBlur.bind(this),this.handleReset=this.handleReset.bind(this)}async validate(){return await this.assert()}async handleInput({target:i}){("file"===i.type||e.isFalse(this.isValid))&&await this.assert()}async handleChange({target:i}){("file"===i.type||e.isFalse(this.isValid))&&await this.assert()}async handleBlur(){await this.assert()}handleReset(){this.isValid=!0,this.invalid=!this.isValid,this.input&&this.input.setAttribute("aria-invalid",this.invalid)}async assert(){const{ele:i,validOptions:t,inputs:s,input:h,regex:a,checked:r}=this,l=this.isValid,o=await n.async((async()=>await this.ku4Form.read()),{});if(this.disabled)this.isValid=!0;else{const n=async s=>{if("file"===s.type&&e.isNullOrEmpty(s.value))return!0;const h=e.isBool(r)?s.checked===r:(n=a,l=s.value,c=i,((d=t)?d.some((i=>i===l))&&(n||[]).every((i=>i.test(l))):c?c.value===l&&(n||[]).every((i=>i.test(l))):(n||[]).every((i=>i.test(l))))&&await this.validationMethod(s.value,o));var n,l,d,c;return s.setAttribute("aria-invalid",!h),h};this.isValid=s?!(await Promise.all(s.map((i=>n(i))))).some((i=>!i)):!h||await n(h)}return e.isFalse(l)&&this.isValid&&this.didValidate.emit(this.isValid),this.invalid=!this.isValid,this.isValid}componentWillLoad(){const i=this.for.replace(/\s/g,"").replace(/,/g,",#");if(this.inputs=/,/.test(this.for)&&Array.from(document.querySelectorAll(`#${i}`)),this.input=!/,/.test(this.for)&&document.getElementById(this.for),this.ele=document.getElementById(this.element)||document.querySelector(this.element),this.validOptions=e.exists(this.values)?this.values.split(","):this.ele&&"DATALIST"===this.ele.nodeName&&[].slice.call(this.ele.querySelectorAll("option")).map((i=>i.value)),e.isFunction(this.host.closest)&&(this.ku4Form=this.host.closest("ku4-form"),this.form=this.host.closest("form"),this.form&&this.form.addEventListener&&this.form.addEventListener("reset",this.handleReset)),this.inputs)r(0).then((()=>{this.inputs.forEach((i=>{i.addEventListener("input",this.handleInput),i.addEventListener("change",this.handleChange),i.addEventListener("blur",this.handleBlur)}))}));else if(this.input){const i=this.input.getAttribute("aria-describedby"),t=this.host.getAttribute("id")||l.uid();this.host.setAttribute("id",t),e.isNullOrEmpty(i)&&this.input.setAttribute("aria-describedby",t),r(0).then((()=>{this.input.addEventListener("input",this.handleInput),this.input.addEventListener("change",this.handleChange),this.input.addEventListener("blur",this.handleBlur)}))}else console.error("ku4-validation must have a valid `for` referencing target field `id`.")}disconnectedCallback(){this.inputs&&this.inputs.forEach((i=>{i&&i.removeEventListener&&(i.removeEventListener("input",this.handleInput),i.removeEventListener("change",this.handleChange),i.removeEventListener("blur",this.handleBlur))})),this.input&&this.input.removeEventListener&&(this.input.removeEventListener("input",this.handleInput),this.input.removeEventListener("change",this.handleChange),this.input.removeEventListener("blur",this.handleBlur)),this.form&&this.form.removeEventListener&&this.form.removeEventListener("reset",this.handleReset)}render(){return s(h,{role:"alert","aria-live":"assertive"},s("slot",null))}get host(){return a(this)}};o.style=":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}";export{o as ku4_validation}
|
@@ -5,6 +5,7 @@ import { EventEmitter } from '../../stencil-public-runtime';
|
|
5
5
|
export declare class Ku4Validation {
|
6
6
|
private ku4Form;
|
7
7
|
private form;
|
8
|
+
private inputs;
|
8
9
|
private input;
|
9
10
|
private regex;
|
10
11
|
private ele;
|
@@ -14,7 +15,9 @@ export declare class Ku4Validation {
|
|
14
15
|
private host;
|
15
16
|
/**
|
16
17
|
* The value of the id attribute of the field that this
|
17
|
-
* is the validation for.
|
18
|
+
* is the validation for. A comma delimited list of id
|
19
|
+
* attribute values can also be passed for fields that
|
20
|
+
* should be validated together.
|
18
21
|
*/
|
19
22
|
readonly for: string;
|
20
23
|
/**
|
@@ -528,7 +528,7 @@ export namespace Components {
|
|
528
528
|
*/
|
529
529
|
"flags": string;
|
530
530
|
/**
|
531
|
-
* The value of the id attribute of the field that this is the validation for.
|
531
|
+
* The value of the id attribute of the field that this is the validation for. A comma delimited list of id attribute values can also be passed for fields that should be validated together.
|
532
532
|
*/
|
533
533
|
"for": string;
|
534
534
|
/**
|
@@ -1131,7 +1131,7 @@ declare namespace LocalJSX {
|
|
1131
1131
|
*/
|
1132
1132
|
"flags"?: string;
|
1133
1133
|
/**
|
1134
|
-
* The value of the id attribute of the field that this is the validation for.
|
1134
|
+
* The value of the id attribute of the field that this is the validation for. A comma delimited list of id attribute values can also be passed for fields that should be validated together.
|
1135
1135
|
*/
|
1136
1136
|
"for"?: string;
|
1137
1137
|
/**
|
package/package.json
CHANGED
@@ -1 +0,0 @@
|
|
1
|
-
import{r as i,c as t,h as s,H as h,g as a}from"./p-0943c493.js";import{t as e,h as n,R as r,Y as l}from"./p-0af98743.js";const d=class{constructor(s){i(this,s),this.didValidate=t(this,"validate",7),this.pattern=".*",this.flags="",this.method="";const h=this.pattern.split(" "),a=this.flags.split(" "),n=e.isString(this.method)?this.method.trim():this.method;this.regex=h.map(((i,t)=>new RegExp(i,a[t]))),this.validationMethod=e.isNullOrEmpty(n)?()=>!0:e.isString(n)?new Function("value, values",/^return/.test(n)?n:`return ${n}`):e.isFunction(n)?n:()=>!0,this.handleInput=this.handleInput.bind(this),this.handleChange=this.handleChange.bind(this),this.handleBlur=this.handleBlur.bind(this),this.handleReset=this.handleReset.bind(this)}async validate(){return await this.assert()}async handleInput(){("file"===this.input.type||e.isFalse(this.isValid))&&await this.assert()}async handleChange(){("file"===this.input.type||e.isFalse(this.isValid))&&await this.assert()}async handleBlur(){await this.assert()}handleReset(){this.isValid=!0,this.invalid=!this.isValid,this.input.setAttribute("aria-invalid",this.invalid)}async assert(){const{ele:i,validOptions:t,input:s,regex:h,checked:a}=this,r=await n.async((async()=>await this.ku4Form.read()),{});if("file"===s.type&&e.isNullOrEmpty(s.value))return;const l=this.isValid;var d,o,c,u;return this.isValid=!!this.disabled||(e.isBool(a)?s.checked===a:(d=h,o=s.value,u=i,((c=t)?c.some((i=>i===o))&&(d||[]).every((i=>i.test(o))):u?u.value===o&&(d||[]).every((i=>i.test(o))):(d||[]).every((i=>i.test(o))))&&await this.validationMethod(s.value,r))),this.invalid=!this.isValid,s.setAttribute("aria-invalid",this.invalid),e.isFalse(l)&&this.isValid&&this.didValidate.emit(this.isValid),this.isValid}componentWillLoad(){if(this.input=document.getElementById(this.for),e.exists(this.input)){this.ele=document.getElementById(this.element)||document.querySelector(this.element),this.validOptions=e.exists(this.values)?this.values.split(","):this.ele&&"DATALIST"===this.ele.nodeName&&[].slice.call(this.ele.querySelectorAll("option")).map((i=>i.value));const i=this.input.getAttribute("aria-describedby"),t=this.host.getAttribute("id")||r.uid();this.host.setAttribute("id",t),e.isNullOrEmpty(i)&&this.input.setAttribute("aria-describedby",t),l(0).then((()=>{this.input.addEventListener("input",this.handleInput),this.input.addEventListener("change",this.handleChange),this.input.addEventListener("blur",this.handleBlur)})),e.isFunction(this.host.closest)&&(this.ku4Form=this.host.closest("ku4-form"),this.form=this.host.closest("form"),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`.")}disconnectedCallback(){this.input&&this.input.removeEventListener&&(this.input.removeEventListener("input",this.handleInput),this.input.removeEventListener("change",this.handleChange),this.input.removeEventListener("blur",this.handleBlur)),this.form&&this.form.removeEventListener&&this.form.removeEventListener("reset",this.handleReset)}render(){return s(h,{role:"alert","aria-live":"assertive"},s("slot",null))}get host(){return a(this)}};d.style=":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}";export{d as ku4_validation}
|
@@ -1 +0,0 @@
|
|
1
|
-
var __awaiter=this&&this.__awaiter||function(t,e,i,n){function r(t){return t instanceof i?t:new i((function(e){e(t)}))}return new(i||(i=Promise))((function(i,s){function a(t){try{u(n.next(t))}catch(e){s(e)}}function o(t){try{u(n["throw"](t))}catch(e){s(e)}}function u(t){t.done?i(t.value):r(t.value).then(a,o)}u((n=n.apply(t,e||[])).next())}))};var __generator=this&&this.__generator||function(t,e){var i={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,r,s,a;return a={next:o(0),throw:o(1),return:o(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function o(t){return function(e){return u([t,e])}}function u(a){if(n)throw new TypeError("Generator is already executing.");while(i)try{if(n=1,r&&(s=a[0]&2?r["return"]:a[0]?r["throw"]||((s=r["return"])&&s.call(r),0):r.next)&&!(s=s.call(r,a[1])).done)return s;if(r=0,s)a=[a[0]&2,s.value];switch(a[0]){case 0:case 1:s=a;break;case 4:i.label++;return{value:a[1],done:false};case 5:i.label++;r=a[1];a=[0];continue;case 7:a=i.ops.pop();i.trys.pop();continue;default:if(!(s=i.trys,s=s.length>0&&s[s.length-1])&&(a[0]===6||a[0]===2)){i=0;continue}if(a[0]===3&&(!s||a[1]>s[0]&&a[1]<s[3])){i.label=a[1];break}if(a[0]===6&&i.label<s[1]){i.label=s[1];s=a;break}if(s&&i.label<s[2]){i.label=s[2];i.ops.push(a);break}if(s[2])i.ops.pop();i.trys.pop();continue}a=e.call(t,i)}catch(o){a=[6,o];r=0}finally{n=s=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};System.register(["./p-55f5c91c.system.js","./p-e11b977e.system.js"],(function(t){"use strict";var e,i,n,r,s,a,o,u,l;return{setters:[function(t){e=t.r;i=t.c;n=t.h;r=t.H;s=t.g},function(t){a=t.t;o=t.h;u=t.R;l=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 c=":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 r=this.flags.split(" ");var s=a.isString(this.method)?this.method.trim():this.method;this.regex=n.map((function(t,e){return new RegExp(t,r[e])}));this.validationMethod=a.isNullOrEmpty(s)?function(){return true}:a.isString(s)?new Function("value, values",/^return/.test(s)?s:"return ".concat(s)):a.isFunction(s)?s:function(){return true};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){switch(t.label){case 0:return[4,this.assert()];case 1:return[2,t.sent()]}}))}))};t.prototype.handleInput=function(){return __awaiter(this,void 0,void 0,(function(){var t;return __generator(this,(function(e){switch(e.label){case 0:t=this.input.type==="file"||a.isFalse(this.isValid);if(!t)return[3,2];return[4,this.assert()];case 1:t=e.sent();e.label=2;case 2:t;return[2]}}))}))};t.prototype.handleChange=function(){return __awaiter(this,void 0,void 0,(function(){var t;return __generator(this,(function(e){switch(e.label){case 0:t=this.input.type==="file"||a.isFalse(this.isValid);if(!t)return[3,2];return[4,this.assert()];case 1:t=e.sent();e.label=2;case 2:t;return[2]}}))}))};t.prototype.handleBlur=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){switch(t.label){case 0:return[4,this.assert()];case 1:t.sent();return[2]}}))}))};t.prototype.handleReset=function(){this.isValid=true;this.invalid=!this.isValid;this.input.setAttribute("aria-invalid",this.invalid)};t.prototype.assert=function(){return __awaiter(this,void 0,void 0,(function(){var t,e,i,n,r,s,u,l,c,d,f,v;var p=this;return __generator(this,(function(b){switch(b.label){case 0:t=this,e=t.ele,i=t.validOptions,n=t.input,r=t.regex,s=t.checked;return[4,o.async((function(){return __awaiter(p,void 0,void 0,(function(){return __generator(this,(function(t){switch(t.label){case 0:return[4,this.ku4Form.read()];case 1:return[2,t.sent()]}}))}))}),{})];case 1:u=b.sent();if(n.type==="file"&&a.isNullOrEmpty(n.value)){return[2]}l=this.isValid;c=this;if(!this.disabled)return[3,2];d=true;return[3,7];case 2:if(!a.isBool(s))return[3,3];f=n.checked===s;return[3,6];case 3:v=h(r,n.value,i,e);if(!v)return[3,5];return[4,this.validationMethod(n.value,u)];case 4:v=b.sent();b.label=5;case 5:f=v;b.label=6;case 6:d=f;b.label=7;case 7:c.isValid=d;this.invalid=!this.isValid;n.setAttribute("aria-invalid",this.invalid);if(a.isFalse(l)&&this.isValid){this.didValidate.emit(this.isValid)}return[2,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")||u.uid();this.host.setAttribute("id",i);if(a.isNullOrEmpty(e)){this.input.setAttribute("aria-describedby",i)}l(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.ku4Form=this.host.closest("ku4-form");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(r,{role:"alert","aria-live":"assertive"},n("slot",null))};Object.defineProperty(t.prototype,"host",{get:function(){return s(this)},enumerable:false,configurable:true});return t}());d.style=c}}}));
|