@abgov/ui-components-common 1.6.0-alpha.2 → 1.6.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs +1 -1
- package/index.d.ts +2 -0
- package/index.js +96 -64
- package/lib/common.d.ts +1 -20
- package/lib/messaging/messaging.d.ts +6 -0
- package/lib/public-form-controller.d.ts +0 -6
- package/lib/temporary-notification-controller/temporary-notification-controller.d.ts +19 -0
- package/package.json +1 -1
package/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var M=Object.defineProperty;var y=r=>{throw TypeError(r)};var S=(r,t,e)=>t in r?M(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var
|
|
1
|
+
"use strict";var M=Object.defineProperty;var y=r=>{throw TypeError(r)};var S=(r,t,e)=>t in r?M(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var d=(r,t,e)=>S(r,typeof t!="symbol"?t+"":t,e),N=(r,t,e)=>t.has(r)||y("Cannot "+e);var g=(r,t,e)=>t.has(r)?y("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(r):t.set(r,e);var V=(r,t,e)=>(N(r,t,"access private method"),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class w{constructor(t){d(this,"validators");this.validators=t||{}}add(t,...e){this.validators[t]=e}validate(t){const e={};return Object.entries(this.validators).forEach(([a,i])=>{const n=i.map(s=>s(t[a])).find(s=>!!s);n&&(e[a]=n)}),e}}function D(){return[c("Day is required"),m({min:1,max:31,minMsg:"Day must be between 1 and 31",maxMsg:"Day must be between 1 and 31"})]}function E(){return[c("Month is required"),m({min:0,max:11,minMsg:"Month must be between Jan and Dec",maxMsg:"Month must be between Jan and Dec"})]}function _(){const r=new Date().getFullYear();return[c("Year is required"),m({min:1900,max:r,minMsg:"Year must be greater than 1900",maxMsg:`Year must be less than ${r}`})]}function c(r){return t=>(r=r||"Required",typeof t=="number"&&!isNaN(t)||t?"":r)}function R(r){const t=new RegExp(/^\+?[\d-() ]{10,18}$/);return h(t,r||"Invalid phone number")}function I(r){const t=new RegExp(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/);return h(t,r||"Invalid email address")}function $(){return r=>{if(!r)return"";const t="121212121".split("").map(i=>parseInt(i)),e=r.replace(/\D/g,"");return e.length!==9?"SIN must contain 9 numbers":e.split("").map(i=>parseInt(i)).map((i,n)=>{const s=i*t[n];return s<10?s:`${s}`.split("").map(u=>parseInt(u)).reduce((u,l)=>u+l,0)}).reduce((i,n)=>i+n,0)%10===0?"":"Invalid SIN"}}function x(){return h(/^[ABCEGHJ-NPRSTVXY]\d[ABCEGHJ-NPRSTV-Z][ -]?\d[ABCEGHJ-NPRSTV-Z]\d$/i,"Invalid postal code")}function h(r,t){return e=>!e||e.match(r)?"":t}function C({invalidMsg:r,minMsg:t,maxMsg:e,min:a,max:i}={}){return n=>{let s=new Date(-1);return`${n||""}`.length===0?"":(typeof n=="string"&&(s=new Date(n)),typeof n=="number"&&(s=new Date(n)),n.toDateString&&(s=n),s.getDate()===-1?r||"Invalid date":a&&s<a?t||`Must be after ${a}`:i&&s>i?e||`Must be before ${i}`:"")}}function m({invalidTypeMsg:r,minMsg:t,maxMsg:e,min:a=-Number.MAX_VALUE,max:i=Number.MAX_VALUE}={}){return n=>{let s=Number.MAX_VALUE;return`${n??""}`.length===0?"":(typeof n=="string"&&(s=parseFloat(n)),typeof n=="number"&&(s=n),isNaN(s)?r||"Must be a numeric value":s>i?e||`Must be less than or equal to ${i}`:s<a?t||`Must be greater than or equal to ${a}`:"")}}function T({invalidTypeMsg:r,minMsg:t,maxMsg:e,min:a=-Number.MAX_VALUE,max:i=Number.MAX_VALUE}){return n=>`${n||""}`.length===0?"":typeof n!="string"?r||"Invalid type":n.length>i?e||`Must be less than ${i} characters`:n.length<a?t||`Must be greater than ${a} characters`:""}function L(r,t,e,a){if(!r){console.error("dispatch element is null");return}r.dispatchEvent(new CustomEvent(t,{composed:!0,bubbles:a==null?void 0:a.bubbles,detail:e}))}function o(r,t,e,a){if(!r){console.error("dispatch element is null");return}r.dispatchEvent(new CustomEvent("msg",{composed:!0,bubbles:a==null?void 0:a.bubbles,detail:{action:t,data:e}}))}var f,q,A;class U{constructor(t){g(this,f);d(this,"state");d(this,"_formData");d(this,"_formRef");this.type=t}init(t){if(this._formRef){console.warn("init: form element has already been set");return}this._formRef=t.detail.el,this.state={uuid:crypto.randomUUID(),form:{},history:[],editting:"",status:"not-started"}}initList(t){this._formRef=t.detail.el,this.state=[]}initState(t,e){o(this._formRef,"external::init:state",t),typeof t=="string"?this.state=JSON.parse(t):Array.isArray(t)||(this.state=t),e&&setTimeout(e,200)}updateListState(t){const e=t.detail;Array.isArray(e.data)&&(this.state=e.data)}updateObjectState(t){var a,i;if(Array.isArray(this.state))return;const e=t.detail;e.type==="list"?this.state={...this.state,form:{...((a=this.state)==null?void 0:a.form)||{},[e.id]:e.data}}:this.state={...this.state,...e.data,form:{...((i=this.state)==null?void 0:i.form)||{},...e.data.form},history:e.data.history}}getStateList(){return this.state?Array.isArray(this.state)?this.state.length===0?[]:this.state.map(t=>Object.values(t.form).filter(e=>{var a;return((a=e==null?void 0:e.data)==null?void 0:a.type)==="details"}).map(e=>{var a;return e.data.type==="details"&&((a=e.data)==null?void 0:a.fieldsets)||{}}).reduce((e,a)=>{for(const[i,n]of Object.entries(a))e[i]=n.value;return e},{})):(console.warn("Utils:getStateList: unable to update the state of a non-multi form type",this.state),[]):[]}getStateValue(t,e){if(Array.isArray(this.state))return console.error("getStateValue: unable to update the state of a multi form type"),"";if(!this.state)return console.error("getStateValue: state has not yet been set"),"";const a=this.state.form[t].data;return a.type!=="details"?"":a.fieldsets[e].value}continueTo(t){if(!t){console.error("continueTo [name] is undefined");return}o(this._formRef,"external::continue",{next:t})}validate(t,e,a,i){var b;const{el:n,state:s,cancelled:u}=t.detail,l=(b=s==null?void 0:s[e])==null?void 0:b.value;if(window.scrollTo({top:0,behavior:"smooth"}),u)return[!0,l];for(const v of a){const p=v(l);if(V(this,f,A).call(this,n,e,p,i),p)return[!1,""]}return[!0,l]}validateGroup(t,e,a){let i=0;const n={};for(const s of e){const[u]=this.validate(t,s,a,{grouped:!0});u&&(n[s]=!0,i++)}return[i,n]}edit(t){o(this._formRef,"external::alter:state",{index:t,operation:"edit"})}remove(t){o(this._formRef,"external::alter:state",{index:t,operation:"remove"})}clean(t){return t.history.reduce((e,a)=>(e[a]=t.form[a],e),{})}}f=new WeakSet,q=function(t){var e;Array.isArray(t.data)&&(Array.isArray(this.state)||(this.state={...this.state,form:{...((e=this.state)==null?void 0:e.form)||{},[t.id]:t.data}}))},A=function(t,e,a,i){t.dispatchEvent(new CustomEvent("msg",{composed:!0,detail:{action:"external::set:error",data:{name:e,msg:a,grouped:i==null?void 0:i.grouped}}}))};const Y=["basic","success","failure"];function O(r,t){const e=crypto.randomUUID();return t={uuid:e,type:"basic",...t||{}},!t.duration&&t.type&&Y.includes(t.type)&&(t.duration="short"),o(document.body,"goa:temp-notification",{message:r,...t},{bubbles:!0}),e}function P(r){o(document.body,"goa:temp-notification:dismiss",r,{bubbles:!0})}function j(r,t){o(document.body,"goa:temp-notification:progress",{uuid:r,progress:t},{bubbles:!0})}const F={show:O,dismiss:P,setProgress:j};exports.FormValidator=w;exports.PublicFormController=U;exports.SINValidator=$;exports.TemporaryNotification=F;exports.birthDayValidator=D;exports.birthMonthValidator=E;exports.birthYearValidator=_;exports.dateValidator=C;exports.dispatch=L;exports.emailValidator=I;exports.lengthValidator=T;exports.numericValidator=m;exports.phoneNumberValidator=R;exports.postalCodeValidator=x;exports.regexValidator=h;exports.relay=o;exports.requiredValidator=c;
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -3,10 +3,10 @@ var y = (r) => {
|
|
|
3
3
|
throw TypeError(r);
|
|
4
4
|
};
|
|
5
5
|
var S = (r, t, e) => t in r ? M(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
|
|
6
|
-
var l = (r, t, e) => S(r, typeof t != "symbol" ? t + "" : t, e),
|
|
6
|
+
var l = (r, t, e) => S(r, typeof t != "symbol" ? t + "" : t, e), w = (r, t, e) => t.has(r) || y("Cannot " + e);
|
|
7
7
|
var g = (r, t, e) => t.has(r) ? y("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(r) : t.set(r, e);
|
|
8
|
-
var A = (r, t, e) => (
|
|
9
|
-
class
|
|
8
|
+
var A = (r, t, e) => (w(r, t, "access private method"), e);
|
|
9
|
+
class x {
|
|
10
10
|
constructor(t) {
|
|
11
11
|
l(this, "validators");
|
|
12
12
|
this.validators = t || {};
|
|
@@ -22,7 +22,7 @@ class _ {
|
|
|
22
22
|
}), e;
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
|
-
function
|
|
25
|
+
function I() {
|
|
26
26
|
return [
|
|
27
27
|
c("Day is required"),
|
|
28
28
|
m({
|
|
@@ -33,7 +33,7 @@ function D() {
|
|
|
33
33
|
})
|
|
34
34
|
];
|
|
35
35
|
}
|
|
36
|
-
function
|
|
36
|
+
function L() {
|
|
37
37
|
return [
|
|
38
38
|
c("Month is required"),
|
|
39
39
|
m({
|
|
@@ -44,7 +44,7 @@ function R() {
|
|
|
44
44
|
})
|
|
45
45
|
];
|
|
46
46
|
}
|
|
47
|
-
function
|
|
47
|
+
function U() {
|
|
48
48
|
const r = (/* @__PURE__ */ new Date()).getFullYear();
|
|
49
49
|
return [
|
|
50
50
|
c("Year is required"),
|
|
@@ -59,27 +59,27 @@ function $() {
|
|
|
59
59
|
function c(r) {
|
|
60
60
|
return (t) => (r = r || "Required", typeof t == "number" && !isNaN(t) || t ? "" : r);
|
|
61
61
|
}
|
|
62
|
-
function
|
|
62
|
+
function C(r) {
|
|
63
63
|
const t = new RegExp(/^\+?[\d-() ]{10,18}$/);
|
|
64
64
|
return h(t, r || "Invalid phone number");
|
|
65
65
|
}
|
|
66
|
-
function
|
|
66
|
+
function T(r) {
|
|
67
67
|
const t = new RegExp(
|
|
68
68
|
/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
|
|
69
69
|
);
|
|
70
70
|
return h(t, r || "Invalid email address");
|
|
71
71
|
}
|
|
72
|
-
function
|
|
72
|
+
function q() {
|
|
73
73
|
return (r) => {
|
|
74
74
|
if (!r) return "";
|
|
75
75
|
const t = "121212121".split("").map((n) => parseInt(n)), e = r.replace(/\D/g, "");
|
|
76
76
|
return e.length !== 9 ? "SIN must contain 9 numbers" : e.split("").map((n) => parseInt(n)).map((n, i) => {
|
|
77
77
|
const s = n * t[i];
|
|
78
|
-
return s < 10 ? s : `${s}`.split("").map((o) => parseInt(o)).reduce((o,
|
|
78
|
+
return s < 10 ? s : `${s}`.split("").map((o) => parseInt(o)).reduce((o, f) => o + f, 0);
|
|
79
79
|
}).reduce((n, i) => n + i, 0) % 10 === 0 ? "" : "Invalid SIN";
|
|
80
80
|
};
|
|
81
81
|
}
|
|
82
|
-
function
|
|
82
|
+
function Y() {
|
|
83
83
|
return h(
|
|
84
84
|
/^[ABCEGHJ-NPRSTVXY]\d[ABCEGHJ-NPRSTV-Z][ -]?\d[ABCEGHJ-NPRSTV-Z]\d$/i,
|
|
85
85
|
"Invalid postal code"
|
|
@@ -88,7 +88,7 @@ function C() {
|
|
|
88
88
|
function h(r, t) {
|
|
89
89
|
return (e) => !e || e.match(r) ? "" : t;
|
|
90
90
|
}
|
|
91
|
-
function
|
|
91
|
+
function J({
|
|
92
92
|
invalidMsg: r,
|
|
93
93
|
minMsg: t,
|
|
94
94
|
maxMsg: e,
|
|
@@ -112,7 +112,7 @@ function m({
|
|
|
112
112
|
return `${i ?? ""}`.length === 0 ? "" : (typeof i == "string" && (s = parseFloat(i)), typeof i == "number" && (s = i), isNaN(s) ? r || "Must be a numeric value" : s > n ? e || `Must be less than or equal to ${n}` : s < a ? t || `Must be greater than or equal to ${a}` : "");
|
|
113
113
|
};
|
|
114
114
|
}
|
|
115
|
-
function
|
|
115
|
+
function O({
|
|
116
116
|
invalidTypeMsg: r,
|
|
117
117
|
minMsg: t,
|
|
118
118
|
maxMsg: e,
|
|
@@ -121,10 +121,39 @@ function q({
|
|
|
121
121
|
}) {
|
|
122
122
|
return (i) => `${i || ""}`.length === 0 ? "" : typeof i != "string" ? r || "Invalid type" : i.length > n ? e || `Must be less than ${n} characters` : i.length < a ? t || `Must be greater than ${a} characters` : "";
|
|
123
123
|
}
|
|
124
|
-
|
|
125
|
-
|
|
124
|
+
function X(r, t, e, a) {
|
|
125
|
+
if (!r) {
|
|
126
|
+
console.error("dispatch element is null");
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
r.dispatchEvent(
|
|
130
|
+
new CustomEvent(t, {
|
|
131
|
+
composed: !0,
|
|
132
|
+
bubbles: a == null ? void 0 : a.bubbles,
|
|
133
|
+
detail: e
|
|
134
|
+
})
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
function u(r, t, e, a) {
|
|
138
|
+
if (!r) {
|
|
139
|
+
console.error("dispatch element is null");
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
r.dispatchEvent(
|
|
143
|
+
new CustomEvent("msg", {
|
|
144
|
+
composed: !0,
|
|
145
|
+
bubbles: a == null ? void 0 : a.bubbles,
|
|
146
|
+
detail: {
|
|
147
|
+
action: t,
|
|
148
|
+
data: e
|
|
149
|
+
}
|
|
150
|
+
})
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
var d, E, v;
|
|
154
|
+
class j {
|
|
126
155
|
constructor(t) {
|
|
127
|
-
g(this,
|
|
156
|
+
g(this, d);
|
|
128
157
|
l(this, "state");
|
|
129
158
|
l(this, "_formData");
|
|
130
159
|
l(this, "_formRef");
|
|
@@ -149,7 +178,7 @@ class T {
|
|
|
149
178
|
}
|
|
150
179
|
// Public method to allow for the initialization of the state
|
|
151
180
|
initState(t, e) {
|
|
152
|
-
|
|
181
|
+
u(this._formRef, "external::init:state", t), typeof t == "string" ? this.state = JSON.parse(t) : Array.isArray(t) || (this.state = t), e && setTimeout(e, 200);
|
|
153
182
|
}
|
|
154
183
|
updateListState(t) {
|
|
155
184
|
const e = t.detail;
|
|
@@ -223,20 +252,20 @@ class T {
|
|
|
223
252
|
console.error("continueTo [name] is undefined");
|
|
224
253
|
return;
|
|
225
254
|
}
|
|
226
|
-
|
|
255
|
+
u(this._formRef, "external::continue", { next: t });
|
|
227
256
|
}
|
|
228
257
|
// Public method to perform validation and send the appropriate messages to the form elements
|
|
229
258
|
validate(t, e, a, n) {
|
|
230
259
|
var b;
|
|
231
|
-
const { el: i, state: s, cancelled: o } = t.detail,
|
|
260
|
+
const { el: i, state: s, cancelled: o } = t.detail, f = (b = s == null ? void 0 : s[e]) == null ? void 0 : b.value;
|
|
232
261
|
if (window.scrollTo({ top: 0, behavior: "smooth" }), o)
|
|
233
|
-
return [!0,
|
|
262
|
+
return [!0, f];
|
|
234
263
|
for (const V of a) {
|
|
235
|
-
const p = V(
|
|
236
|
-
if (A(this,
|
|
264
|
+
const p = V(f);
|
|
265
|
+
if (A(this, d, v).call(this, i, e, p, n), p)
|
|
237
266
|
return [!1, ""];
|
|
238
267
|
}
|
|
239
|
-
return [!0,
|
|
268
|
+
return [!0, f];
|
|
240
269
|
}
|
|
241
270
|
/**
|
|
242
271
|
* Validates a group of fields ensuring that at least `minPassCount` of the items within the group
|
|
@@ -257,10 +286,10 @@ class T {
|
|
|
257
286
|
return [n, i];
|
|
258
287
|
}
|
|
259
288
|
edit(t) {
|
|
260
|
-
|
|
289
|
+
u(this._formRef, "external::alter:state", { index: t, operation: "edit" });
|
|
261
290
|
}
|
|
262
291
|
remove(t) {
|
|
263
|
-
|
|
292
|
+
u(this._formRef, "external::alter:state", {
|
|
264
293
|
index: t,
|
|
265
294
|
operation: "remove"
|
|
266
295
|
});
|
|
@@ -270,7 +299,7 @@ class T {
|
|
|
270
299
|
return t.history.reduce((e, a) => (e[a] = t.form[a], e), {});
|
|
271
300
|
}
|
|
272
301
|
}
|
|
273
|
-
|
|
302
|
+
d = new WeakSet(), E = function(t) {
|
|
274
303
|
var e;
|
|
275
304
|
Array.isArray(t.data) && (Array.isArray(this.state) || (this.state = {
|
|
276
305
|
...this.state,
|
|
@@ -295,50 +324,53 @@ v = function(t, e, a, n) {
|
|
|
295
324
|
})
|
|
296
325
|
);
|
|
297
326
|
};
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
327
|
+
const N = ["basic", "success", "failure"];
|
|
328
|
+
function D(r, t) {
|
|
329
|
+
const e = crypto.randomUUID();
|
|
330
|
+
return t = { uuid: e, type: "basic", ...t || {} }, !t.duration && t.type && N.includes(t.type) && (t.duration = "short"), u(
|
|
331
|
+
document.body,
|
|
332
|
+
"goa:temp-notification",
|
|
333
|
+
{ message: r, ...t },
|
|
334
|
+
{ bubbles: !0 }
|
|
335
|
+
), e;
|
|
336
|
+
}
|
|
337
|
+
function _(r) {
|
|
338
|
+
u(
|
|
339
|
+
document.body,
|
|
340
|
+
"goa:temp-notification:dismiss",
|
|
341
|
+
r,
|
|
342
|
+
{ bubbles: !0 }
|
|
309
343
|
);
|
|
310
344
|
}
|
|
311
|
-
function
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
new CustomEvent("msg", {
|
|
318
|
-
composed: !0,
|
|
319
|
-
bubbles: a == null ? void 0 : a.bubbles,
|
|
320
|
-
detail: {
|
|
321
|
-
action: t,
|
|
322
|
-
data: e
|
|
323
|
-
}
|
|
324
|
-
})
|
|
345
|
+
function R(r, t) {
|
|
346
|
+
u(
|
|
347
|
+
document.body,
|
|
348
|
+
"goa:temp-notification:progress",
|
|
349
|
+
{ uuid: r, progress: t },
|
|
350
|
+
{ bubbles: !0 }
|
|
325
351
|
);
|
|
326
352
|
}
|
|
353
|
+
const G = {
|
|
354
|
+
show: D,
|
|
355
|
+
dismiss: _,
|
|
356
|
+
setProgress: R
|
|
357
|
+
};
|
|
327
358
|
export {
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
U as
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
359
|
+
x as FormValidator,
|
|
360
|
+
j as PublicFormController,
|
|
361
|
+
q as SINValidator,
|
|
362
|
+
G as TemporaryNotification,
|
|
363
|
+
I as birthDayValidator,
|
|
364
|
+
L as birthMonthValidator,
|
|
365
|
+
U as birthYearValidator,
|
|
366
|
+
J as dateValidator,
|
|
367
|
+
X as dispatch,
|
|
368
|
+
T as emailValidator,
|
|
369
|
+
O as lengthValidator,
|
|
338
370
|
m as numericValidator,
|
|
339
|
-
|
|
340
|
-
|
|
371
|
+
C as phoneNumberValidator,
|
|
372
|
+
Y as postalCodeValidator,
|
|
341
373
|
h as regexValidator,
|
|
342
|
-
|
|
374
|
+
u as relay,
|
|
343
375
|
c as requiredValidator
|
|
344
376
|
};
|
package/lib/common.d.ts
CHANGED
|
@@ -278,6 +278,7 @@ export type GoabFieldsetItemState = {
|
|
|
278
278
|
label: string;
|
|
279
279
|
value: GoabFieldsetItemValue;
|
|
280
280
|
order: number;
|
|
281
|
+
valueLabel?: string;
|
|
281
282
|
};
|
|
282
283
|
export type GoabFieldsetData = {
|
|
283
284
|
type: "details";
|
|
@@ -290,13 +291,6 @@ export type GoabFieldsetSchema = {
|
|
|
290
291
|
heading?: string;
|
|
291
292
|
data?: GoabFieldsetData;
|
|
292
293
|
};
|
|
293
|
-
export interface GoabFieldsetOnChangeDetail {
|
|
294
|
-
id: string;
|
|
295
|
-
state: {
|
|
296
|
-
data: Record<string, GoabFieldsetItemState>;
|
|
297
|
-
};
|
|
298
|
-
dispatchOn: GoabFormDispatchOn;
|
|
299
|
-
}
|
|
300
294
|
export interface GoabFieldsetOnContinueDetail {
|
|
301
295
|
el: HTMLElement;
|
|
302
296
|
state: Record<string, GoabFieldsetItemState>;
|
|
@@ -305,19 +299,6 @@ export interface GoabFieldsetOnContinueDetail {
|
|
|
305
299
|
export type GoabPublicFormStatus = "initializing" | "complete";
|
|
306
300
|
export type GoabPublicFormPageStep = "step" | "summary" | "multistep";
|
|
307
301
|
export type GoabPublicFormPageButtonVisibility = "visible" | "hidden";
|
|
308
|
-
export type GoabPublicFormPageOnFieldsetChangeDetail = {
|
|
309
|
-
id: string;
|
|
310
|
-
state: {
|
|
311
|
-
heading?: string;
|
|
312
|
-
data: Record<string, GoabFieldsetItemState>;
|
|
313
|
-
};
|
|
314
|
-
dispatchOn: GoabFormDispatchOn;
|
|
315
|
-
};
|
|
316
|
-
export type GoabPublicFormPageOnCompleteDetail = {
|
|
317
|
-
el: HTMLElement;
|
|
318
|
-
state: Record<string, GoabFieldsetItemState>;
|
|
319
|
-
cancelled: boolean;
|
|
320
|
-
};
|
|
321
302
|
export type GoabPublicFormTaskStatus = "completed" | "not-started" | "cannot-start";
|
|
322
303
|
export type GoabDrawerPosition = "bottom" | "left" | "right" | undefined;
|
|
323
304
|
export type GoabDrawerSizeUnit = "px" | "rem" | "ch" | "vh" | "vw";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare function dispatch<T>(el: HTMLElement | Element | null | undefined, eventName: string, detail?: T, opts?: {
|
|
2
|
+
bubbles?: boolean;
|
|
3
|
+
}): void;
|
|
4
|
+
export declare function relay<T>(el: HTMLElement | Element | null | undefined, eventName: string, data?: T, opts?: {
|
|
5
|
+
bubbles?: boolean;
|
|
6
|
+
}): void;
|
|
@@ -55,9 +55,3 @@ export declare class PublicFormController<T> {
|
|
|
55
55
|
remove(index: number): void;
|
|
56
56
|
clean(data: AppState<T>): Record<string, unknown>;
|
|
57
57
|
}
|
|
58
|
-
export declare function dispatch<T>(el: HTMLElement | Element | null | undefined, eventName: string, detail?: T, opts?: {
|
|
59
|
-
bubbles?: boolean;
|
|
60
|
-
}): void;
|
|
61
|
-
export declare function relay<T>(el: HTMLElement | Element | null | undefined, eventName: string, data?: T, opts?: {
|
|
62
|
-
bubbles?: boolean;
|
|
63
|
-
}): void;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export type GoabTemporaryNotificationType = "basic" | "success" | "failure" | "indeterminate" | "progress";
|
|
2
|
+
export type GoabNotificationOptions = {
|
|
3
|
+
type: GoabTemporaryNotificationType;
|
|
4
|
+
uuid: string;
|
|
5
|
+
cancelUUID?: string;
|
|
6
|
+
duration?: "long" | "medium" | "short" | number;
|
|
7
|
+
actionText?: string;
|
|
8
|
+
action?: () => void;
|
|
9
|
+
visible: boolean;
|
|
10
|
+
};
|
|
11
|
+
declare function show(message: string, opts?: Partial<GoabNotificationOptions>): string;
|
|
12
|
+
declare function dismiss(uuid: string): void;
|
|
13
|
+
declare function setProgress(uuid: string, progress: number): void;
|
|
14
|
+
export declare const TemporaryNotification: {
|
|
15
|
+
show: typeof show;
|
|
16
|
+
dismiss: typeof dismiss;
|
|
17
|
+
setProgress: typeof setProgress;
|
|
18
|
+
};
|
|
19
|
+
export {};
|