@viasat/beam-shared 2.49.0 → 2.50.0
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/chunks/form.CTBHjnJb.js +167 -0
- package/chunks/form.DHQXnPEp.js +1 -0
- package/index.cjs.js +1 -1
- package/index.es.js +66 -63
- package/lib/components/form.cjs.js +1 -1
- package/lib/components/form.d.ts +16 -0
- package/lib/components/form.es.js +6 -5
- package/lib/components/index.cjs.js +1 -1
- package/lib/components/index.es.js +1 -1
- package/lib/utils/helpers.cjs.js +1 -1
- package/lib/utils/helpers.d.ts +17 -0
- package/lib/utils/helpers.es.js +38 -35
- package/lib/utils/index.cjs.js +1 -1
- package/lib/utils/index.es.js +56 -53
- package/package.json +1 -1
- package/chunks/form.CBZyQOaS.js +0 -154
- package/chunks/form.CIzlawbr.js +0 -1
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { dateToDayKey as d, toDayKey as p } from "../lib/utils/helpers.es.js";
|
|
2
|
+
const h = ["onChange", "onBlur", "onSubmit"], v = async (n, e) => (await Promise.all(
|
|
3
|
+
e.map(
|
|
4
|
+
async (r) => {
|
|
5
|
+
const { validator: t } = r;
|
|
6
|
+
return t(n);
|
|
7
|
+
}
|
|
8
|
+
)
|
|
9
|
+
)).reduce(
|
|
10
|
+
(r, t) => {
|
|
11
|
+
const { error: s, message: a } = t;
|
|
12
|
+
return s ? [...r, a] : r;
|
|
13
|
+
},
|
|
14
|
+
[]
|
|
15
|
+
), x = (n) => {
|
|
16
|
+
const { target: e, relatedTarget: o } = n || {};
|
|
17
|
+
if (!o) return { groupBlur: !!o };
|
|
18
|
+
const { name: r } = e, { name: t } = o, { control: s } = o, { name: a } = s || {};
|
|
19
|
+
return { groupBlur: r === t || r === a };
|
|
20
|
+
}, i = (n) => {
|
|
21
|
+
const { type: e, checked: o } = n, r = e === "checkbox";
|
|
22
|
+
if (r)
|
|
23
|
+
return {
|
|
24
|
+
isCheckBoxGroup: r,
|
|
25
|
+
selectedBoxes: o ? [n] : []
|
|
26
|
+
};
|
|
27
|
+
const t = Array.from(n), s = t.every((l) => {
|
|
28
|
+
const { type: u } = l;
|
|
29
|
+
return u === "checkbox";
|
|
30
|
+
}), a = !!t.length && s;
|
|
31
|
+
if (!a) return { isCheckBoxGroup: a, selectedBoxes: [] };
|
|
32
|
+
const c = t.filter(
|
|
33
|
+
({ checked: l }) => l
|
|
34
|
+
);
|
|
35
|
+
return { isCheckBoxGroup: a, selectedBoxes: c };
|
|
36
|
+
}, m = (n) => {
|
|
37
|
+
const { type: e, multiple: o, options: r } = n, t = e === "select-multiple" && o;
|
|
38
|
+
if (!t) return { isMultiSelect: t, selectedOptions: [] };
|
|
39
|
+
const s = [].filter.call(
|
|
40
|
+
r,
|
|
41
|
+
({ selected: a }) => a
|
|
42
|
+
);
|
|
43
|
+
return { isMultiSelect: t, selectedOptions: s };
|
|
44
|
+
}, f = new RegExp(
|
|
45
|
+
[
|
|
46
|
+
"(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:",
|
|
47
|
+
"\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|\"(?:",
|
|
48
|
+
"[-\b\v\f-!#-[]-]",
|
|
49
|
+
'|\\\\[- \v\f-])*")@(?:(?:',
|
|
50
|
+
"[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:",
|
|
51
|
+
"[a-z0-9-]*[a-z0-9])?|\\[(?:(?:(2(5[0-5]|",
|
|
52
|
+
"[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\\.){3}(?:",
|
|
53
|
+
"(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?",
|
|
54
|
+
"[0-9])|[a-z0-9-]*[a-z0-9]:(?:",
|
|
55
|
+
"[-\b\v\f-!-ZS-]|\\\\[-",
|
|
56
|
+
" \v\f-])+)\\])"
|
|
57
|
+
].join("")
|
|
58
|
+
), B = (n) => ({
|
|
59
|
+
name: "min",
|
|
60
|
+
validator: (e) => {
|
|
61
|
+
const { value: o, message: r } = n, { value: t } = e;
|
|
62
|
+
return { error: !!t && Number(t) < o, message: r };
|
|
63
|
+
}
|
|
64
|
+
}), y = (n) => ({
|
|
65
|
+
name: "max",
|
|
66
|
+
validator: (e) => {
|
|
67
|
+
const { value: o, message: r } = n, { value: t } = e;
|
|
68
|
+
return { error: !!t && Number(t) > o, message: r };
|
|
69
|
+
}
|
|
70
|
+
}), b = (n) => ({
|
|
71
|
+
name: "email",
|
|
72
|
+
validator: (e) => {
|
|
73
|
+
const { message: o } = n || {}, { value: r } = e;
|
|
74
|
+
return { error: !!r && !f.test(r), message: o };
|
|
75
|
+
}
|
|
76
|
+
}), N = (n) => ({
|
|
77
|
+
name: "pattern",
|
|
78
|
+
validator: (e) => {
|
|
79
|
+
const { pattern: o, message: r } = n, { value: t } = e;
|
|
80
|
+
return { error: !!t && !t.match(o), message: r };
|
|
81
|
+
}
|
|
82
|
+
}), k = (n) => ({
|
|
83
|
+
name: "required",
|
|
84
|
+
validator: (e) => {
|
|
85
|
+
const { message: o } = n || {}, { value: r } = e, {
|
|
86
|
+
isCheckBoxGroup: t,
|
|
87
|
+
selectedBoxes: { length: s }
|
|
88
|
+
} = i(e);
|
|
89
|
+
if (t) return { error: !s, message: o };
|
|
90
|
+
const {
|
|
91
|
+
isMultiSelect: a,
|
|
92
|
+
selectedOptions: { length: c }
|
|
93
|
+
} = m(e);
|
|
94
|
+
return a ? { error: !c, message: o } : { error: !r, message: o };
|
|
95
|
+
}
|
|
96
|
+
}), z = (n) => ({
|
|
97
|
+
name: "minLength",
|
|
98
|
+
validator: (e) => {
|
|
99
|
+
const { length: o, message: r } = n, { value: t } = e, s = !!t && t.length < o, {
|
|
100
|
+
isCheckBoxGroup: a,
|
|
101
|
+
selectedBoxes: { length: c }
|
|
102
|
+
} = i(e);
|
|
103
|
+
if (a)
|
|
104
|
+
return { error: !!c && c < o, message: r };
|
|
105
|
+
const {
|
|
106
|
+
isMultiSelect: l,
|
|
107
|
+
selectedOptions: { length: u }
|
|
108
|
+
} = m(e);
|
|
109
|
+
return l ? { error: !!u && u < o, message: r } : { error: s, message: r };
|
|
110
|
+
}
|
|
111
|
+
}), E = (n) => ({
|
|
112
|
+
name: "maxLength",
|
|
113
|
+
validator: (e) => {
|
|
114
|
+
const { length: o, message: r } = n, { value: t } = e, s = !!t && t.length > o, {
|
|
115
|
+
isCheckBoxGroup: a,
|
|
116
|
+
selectedBoxes: { length: c }
|
|
117
|
+
} = i(e);
|
|
118
|
+
if (a)
|
|
119
|
+
return { error: !!c && c > o, message: r };
|
|
120
|
+
const {
|
|
121
|
+
isMultiSelect: l,
|
|
122
|
+
selectedOptions: { length: u }
|
|
123
|
+
} = m(e);
|
|
124
|
+
return l ? { error: !!u && u > o, message: r } : { error: s, message: r };
|
|
125
|
+
}
|
|
126
|
+
}), L = (n) => ({
|
|
127
|
+
name: "define",
|
|
128
|
+
validator: (e) => n(e)
|
|
129
|
+
}), O = (n) => {
|
|
130
|
+
const e = /^(\d{4})-(\d{2})-(\d{2})$/.exec(n);
|
|
131
|
+
return e ? p(Number(e[1]), Number(e[2]), Number(e[3])) : null;
|
|
132
|
+
}, S = (n) => ({
|
|
133
|
+
name: "dateRange",
|
|
134
|
+
validator: (e) => {
|
|
135
|
+
const { min: o, max: r, message: t } = n, { value: s } = e, a = s ? O(s) : null;
|
|
136
|
+
if (a === null) return { error: !1, message: t };
|
|
137
|
+
const c = o && !Number.isNaN(o.getTime()) ? d(o) : null, l = r && !Number.isNaN(r.getTime()) ? d(r) : null;
|
|
138
|
+
return c !== null && l !== null && c > l ? { error: !1, message: t } : { error: c !== null && a < c || l !== null && a > l, message: t };
|
|
139
|
+
}
|
|
140
|
+
}), C = {
|
|
141
|
+
min: B,
|
|
142
|
+
max: y,
|
|
143
|
+
email: b,
|
|
144
|
+
define: L,
|
|
145
|
+
pattern: N,
|
|
146
|
+
required: k,
|
|
147
|
+
minLength: z,
|
|
148
|
+
maxLength: E,
|
|
149
|
+
dateRange: S
|
|
150
|
+
}, V = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
151
|
+
__proto__: null,
|
|
152
|
+
getCheckBoxGroupMeta: i,
|
|
153
|
+
getMultiSelectMeta: m,
|
|
154
|
+
isGroupBlurEvent: x,
|
|
155
|
+
validateFormField: v,
|
|
156
|
+
validationModes: h,
|
|
157
|
+
validators: C
|
|
158
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
159
|
+
export {
|
|
160
|
+
m as a,
|
|
161
|
+
h as b,
|
|
162
|
+
C as c,
|
|
163
|
+
V as f,
|
|
164
|
+
i as g,
|
|
165
|
+
x as i,
|
|
166
|
+
v
|
|
167
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const g=require("../lib/utils/helpers.cjs.js"),p=["onChange","onBlur","onSubmit"],h=async(n,e)=>(await Promise.all(e.map(async t=>{const{validator:r}=t;return r(n)}))).reduce((t,r)=>{const{error:s,message:a}=r;return s?[...t,a]:t},[]),v=n=>{const{target:e,relatedTarget:o}=n||{};if(!o)return{groupBlur:!!o};const{name:t}=e,{name:r}=o,{control:s}=o,{name:a}=s||{};return{groupBlur:t===r||t===a}},i=n=>{const{type:e,checked:o}=n,t=e==="checkbox";if(t)return{isCheckBoxGroup:t,selectedBoxes:o?[n]:[]};const r=Array.from(n),s=r.every(l=>{const{type:u}=l;return u==="checkbox"}),a=!!r.length&&s;if(!a)return{isCheckBoxGroup:a,selectedBoxes:[]};const c=r.filter(({checked:l})=>l);return{isCheckBoxGroup:a,selectedBoxes:c}},m=n=>{const{type:e,multiple:o,options:t}=n,r=e==="select-multiple"&&o;if(!r)return{isMultiSelect:r,selectedOptions:[]};const s=[].filter.call(t,({selected:a})=>a);return{isMultiSelect:r,selectedOptions:s}},f=new RegExp(["(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:","\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|\"(?:","[-\b\v\f-!#-[]-]",'|\\\\[- \v\f-])*")@(?:(?:',"[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:","[a-z0-9-]*[a-z0-9])?|\\[(?:(?:(2(5[0-5]|","[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\\.){3}(?:","(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?","[0-9])|[a-z0-9-]*[a-z0-9]:(?:","[-\b\v\f-!-ZS-]|\\\\[-"," \v\f-])+)\\])"].join("")),B=n=>({name:"min",validator:e=>{const{value:o,message:t}=n,{value:r}=e;return{error:!!r&&Number(r)<o,message:t}}}),y=n=>({name:"max",validator:e=>{const{value:o,message:t}=n,{value:r}=e;return{error:!!r&&Number(r)>o,message:t}}}),b=n=>({name:"email",validator:e=>{const{message:o}=n||{},{value:t}=e;return{error:!!t&&!f.test(t),message:o}}}),N=n=>({name:"pattern",validator:e=>{const{pattern:o,message:t}=n,{value:r}=e;return{error:!!r&&!r.match(o),message:t}}}),M=n=>({name:"required",validator:e=>{const{message:o}=n||{},{value:t}=e,{isCheckBoxGroup:r,selectedBoxes:{length:s}}=i(e);if(r)return{error:!s,message:o};const{isMultiSelect:a,selectedOptions:{length:c}}=m(e);return a?{error:!c,message:o}:{error:!t,message:o}}}),k=n=>({name:"minLength",validator:e=>{const{length:o,message:t}=n,{value:r}=e,s=!!r&&r.length<o,{isCheckBoxGroup:a,selectedBoxes:{length:c}}=i(e);if(a)return{error:!!c&&c<o,message:t};const{isMultiSelect:l,selectedOptions:{length:u}}=m(e);return l?{error:!!u&&u<o,message:t}:{error:s,message:t}}}),E=n=>({name:"maxLength",validator:e=>{const{length:o,message:t}=n,{value:r}=e,s=!!r&&r.length>o,{isCheckBoxGroup:a,selectedBoxes:{length:c}}=i(e);if(a)return{error:!!c&&c>o,message:t};const{isMultiSelect:l,selectedOptions:{length:u}}=m(e);return l?{error:!!u&&u>o,message:t}:{error:s,message:t}}}),z=n=>({name:"define",validator:e=>n(e)}),S=n=>{const e=/^(\d{4})-(\d{2})-(\d{2})$/.exec(n);return e?g.toDayKey(Number(e[1]),Number(e[2]),Number(e[3])):null},C=n=>({name:"dateRange",validator:e=>{const{min:o,max:t,message:r}=n,{value:s}=e,a=s?S(s):null;if(a===null)return{error:!1,message:r};const c=o&&!Number.isNaN(o.getTime())?g.dateToDayKey(o):null,l=t&&!Number.isNaN(t.getTime())?g.dateToDayKey(t):null;return c!==null&&l!==null&&c>l?{error:!1,message:r}:{error:c!==null&&a<c||l!==null&&a>l,message:r}}}),x={min:B,max:y,email:b,define:z,pattern:N,required:M,minLength:k,maxLength:E,dateRange:C},L=Object.freeze(Object.defineProperty({__proto__:null,getCheckBoxGroupMeta:i,getMultiSelectMeta:m,isGroupBlurEvent:v,validateFormField:h,validationModes:p,validators:x},Symbol.toStringTag,{value:"Module"}));exports.form=L;exports.getCheckBoxGroupMeta=i;exports.getMultiSelectMeta=m;exports.isGroupBlurEvent=v;exports.validateFormField=h;exports.validationModes=p;exports.validators=x;
|
package/index.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./chunks/accordion.C1LkPYXv.js"),s=require("./chunks/actionList.LFHBSlrg.js"),a=require("./chunks/alert.B4q5-o6H.js"),l=require("./chunks/avatar.VNzxbOMa.js"),c=require("./chunks/badge.B_k2GBe6.js"),p=require("./chunks/badgeDot.Dkqfk3zg.js"),_=require("./chunks/box.CsO__7hu.js"),m=require("./chunks/button.Bbz_mfWv.js"),u=require("./chunks/card.BRp1Xa5-.js"),d=require("./chunks/chips.DKEagIsp.js"),b=require("./chunks/closeButton.C1A3p88y.js"),E=require("./chunks/dataTable.Bah7iKkO.js"),g=require("./chunks/dateField.DhE-ZgeI.js"),S=require("./chunks/dialog.DSxBxP0V.js"),T=require("./chunks/divider.rAzhUMwO.js"),C=require("./chunks/fileUpload.C-l2YXzO.js"),q=require("./chunks/footer.DFaBRxcx.js"),h=require("./chunks/form.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./chunks/accordion.C1LkPYXv.js"),s=require("./chunks/actionList.LFHBSlrg.js"),a=require("./chunks/alert.B4q5-o6H.js"),l=require("./chunks/avatar.VNzxbOMa.js"),c=require("./chunks/badge.B_k2GBe6.js"),p=require("./chunks/badgeDot.Dkqfk3zg.js"),_=require("./chunks/box.CsO__7hu.js"),m=require("./chunks/button.Bbz_mfWv.js"),u=require("./chunks/card.BRp1Xa5-.js"),d=require("./chunks/chips.DKEagIsp.js"),b=require("./chunks/closeButton.C1A3p88y.js"),E=require("./chunks/dataTable.Bah7iKkO.js"),g=require("./chunks/dateField.DhE-ZgeI.js"),S=require("./chunks/dialog.DSxBxP0V.js"),T=require("./chunks/divider.rAzhUMwO.js"),C=require("./chunks/fileUpload.C-l2YXzO.js"),q=require("./chunks/footer.DFaBRxcx.js"),h=require("./chunks/form.DHQXnPEp.js"),A=require("./chunks/helperText.C-apoW8Z.js"),D=require("./chunks/icon.SiHuIfL8.js"),v=require("./chunks/input.BxPkmKmK.js"),f=require("./chunks/inputChoiceGroup.BSousduj.js"),y=require("./chunks/link.VyBRMFxS.js"),F=require("./chunks/list.D6NIx1OS.js"),x=require("./chunks/logo.CLQZSaVN.js"),P=require("./chunks/nativeSelect.Lz45VyQX.js"),R=require("./chunks/pageHeader.CbDGb6ot.js"),N=require("./chunks/panel.B1cO_Hpy.js"),L=require("./chunks/pagination.Br7vTt5b.js"),O=require("./chunks/progressBar.DcG-X-RY.js"),M=require("./chunks/SegmentedControl.D0l_8a7O.js"),B=require("./chunks/spinner.B6R6yphw.js"),I=require("./chunks/stepper.ByKqsxhz.js"),U=require("./chunks/switch.Dalf8ccu.js"),V=require("./chunks/tabs.CJUp7Ss0.js"),w=require("./chunks/text.CW-ftgoP.js"),K=require("./chunks/textArea.DF76BVU5.js"),Y=require("./chunks/toast.C-h1RUq_.js"),H=require("./chunks/tooltip.DZTJP5dS.js"),G=require("./lib/shared.cjs.js"),i=require("./lib/utils/classNames.cjs.js"),e=require("./lib/utils/constants.cjs.js"),t=require("./lib/utils/helpers.cjs.js"),z=require("./lib/utils/styles.cjs.js"),o=require("./lib/utils/dom.cjs.js"),W=require("./lib/utils/raf.cjs.js"),n=require("./lib/utils/overflow.cjs.js");exports.accordion=r.accordion;exports.actionList=s.actionList;exports.alert=a.alert;exports.avatar=l.avatar;exports.badge=c.badge;exports.badgeDot=p.badgeDot;exports.box=_.box;exports.button=m.button;exports.card=u.card;exports.chips=d.chips;exports.closeButton=b.closeButton;exports.dataTable=E.dataTable;exports.dateField=g.dateField;exports.dialog=S.dialog;exports.divider=T.divider;exports.fileUpload=C.fileUpload;exports.footer=q.footer;exports.form=h.form;exports.helperText=A.helperText;exports.icon=D.icon;exports.input=v.input;exports.inputChoiceGroup=f.inputChoiceGroup;exports.link=y.link;exports.list=F.list;exports.logo=x.logo;exports.nativeSelect=P.nativeSelect;exports.pageHeader=R.pageHeader;exports.panel=N.panel;exports.pagination=L.pagination;exports.progressBar=O.progressBar;exports.segmentedControl=M.SegmentedControl;exports.spinner=B.spinner;exports.stepper=I.stepper;exports.switch=U._switch;exports.tabs=V.tabs;exports.text=w.text;exports.textArea=K.textArea;exports.toast=Y.toast;exports.tooltip=H.tooltip;exports.shared=G.shared;exports.generateSpacingClasses=i.generateSpacingClasses;exports.getBEMClassNames=i.getBEMClassNames;exports.ACCENT=e.ACCENT;exports.ATTRIBUTE=e.ATTRIBUTE;exports.BASE_FONT_SIZE=e.BASE_FONT_SIZE;exports.BEAM_INVERSE=e.BEAM_INVERSE;exports.DEFAULT_ACCENT=e.DEFAULT_ACCENT;exports.DEFAULT_MODE=e.DEFAULT_MODE;exports.DEFAULT_PRODUCT_TYPE=e.DEFAULT_PRODUCT_TYPE;exports.DEFAULT_THEME=e.DEFAULT_THEME;exports.EXPRESSIVE_THEMES=e.EXPRESSIVE_THEMES;exports.FPS_1=e.FPS_1;exports.FPS_120=e.FPS_120;exports.FPS_30=e.FPS_30;exports.FPS_60=e.FPS_60;exports.PRODUCT_TYPE=e.PRODUCT_TYPE;exports.STORAGE_KEY=e.STORAGE_KEY;exports.SYSTEM_MODE_ENABLED_KEY=e.SYSTEM_MODE_ENABLED_KEY;exports.SpacingValues=e.SpacingValues;exports.SpacingValuesAsNumbers=e.SpacingValuesAsNumbers;exports.StaticAppearances=e.StaticAppearances;exports.accentThemeClassName=e.accentThemeClassName;exports.allColors=e.allColors;exports.allSizes=e.allSizes;exports.appearance=e.appearance;exports.appearances=e.appearances;exports.consumer=e.consumer;exports.emphases=e.emphases;exports.enterprise=e.enterprise;exports.expressiveThemeClassName=e.expressiveThemeClassName;exports.info=e.info;exports.infoPrimary=e.infoPrimary;exports.infoSecondary=e.infoSecondary;exports.information=e.information;exports.inverse=e.inverse;exports.lg=e.lg;exports.md=e.md;exports.negative=e.negative;exports.positive=e.positive;exports.prefix=e.prefix;exports.primary=e.primary;exports.productTypeThemeClassName=e.productTypeThemeClassName;exports.secondary=e.secondary;exports.secondaryInverse=e.secondaryInverse;exports.sizes=e.sizes;exports.sm=e.sm;exports.themeClassName=e.themeClassName;exports.themeTypeValues=e.themeTypeValues;exports.warning=e.warning;exports.xl=e.xl;exports.xs=e.xs;exports.xxs=e.xxs;exports.Directions=t.Directions;exports.attributeDecorator=t.attributeDecorator;exports.camelCaseToKebabCase=t.camelCaseToKebabCase;exports.capitalizeFirstLetter=t.capitalizeFirstLetter;exports.dateToDayKey=t.dateToDayKey;exports.debounce=t.debounce;exports.doesEventContainElement=t.doesEventContainElement;exports.doesWebComponentSlotExist=t.doesWebComponentSlotExist;exports.enrichSVGIcon=t.enrichSVGIcon;exports.findFirstFocusableElement=t.findFirstFocusableElement;exports.getDirection=t.getDirection;exports.getRandomArbitrary=t.getRandomArbitrary;exports.getRandomInt=t.getRandomInt;exports.getTypedEntries=t.getTypedEntries;exports.getTypedValues=t.getTypedValues;exports.isAPISupported=t.isAPISupported;exports.isIOS=t.isIOS;exports.isMobileDevice=t.isMobileDevice;exports.nodesHaveContent=t.nodesHaveContent;exports.partitionProps=t.partitionProps;exports.propsChanged=t.propsChanged;exports.throttle=t.throttle;exports.toDayKey=t.toDayKey;exports.generateCssVarPrefix=z.generateCssVarPrefix;exports.addScrollToRect=o.addScrollToRect;exports.compareDomOrder=o.compareDomOrder;exports.findTopLevelSlottedWrapper=o.findTopLevelSlottedWrapper;exports.getElementScrollBoundingClientRect=o.getElementScrollBoundingClientRect;exports.getSecureRelAttribute=o.getSecureRelAttribute;exports.readStringProp=o.readStringProp;exports.createRafScheduler=W.createRafScheduler;exports.computeFitCount=n.computeFitCount;exports.hasScrollOverflow=n.hasScrollOverflow;exports.isMultiLineClamped=n.isMultiLineClamped;exports.isOverFlowing=n.isOverFlowing;exports.isSingleLineClamped=n.isSingleLineClamped;exports.isTextWrapping=n.isTextWrapping;
|
package/index.es.js
CHANGED
|
@@ -11,15 +11,15 @@ import { c as u } from "./chunks/chips.PFlaOgSw.js";
|
|
|
11
11
|
import { c as _ } from "./chunks/closeButton.g8_iRoUg.js";
|
|
12
12
|
import { d as A } from "./chunks/dataTable.DP9UdwMJ.js";
|
|
13
13
|
import { d as F } from "./chunks/dateField.BIajhbDY.js";
|
|
14
|
-
import { d as
|
|
15
|
-
import { d as
|
|
14
|
+
import { d as y } from "./chunks/dialog.BuiendSV.js";
|
|
15
|
+
import { d as R } from "./chunks/divider.D2kuHop2.js";
|
|
16
16
|
import { f as L } from "./chunks/fileUpload.CzC_CuxM.js";
|
|
17
|
-
import { f as
|
|
18
|
-
import { f as
|
|
17
|
+
import { f as I } from "./chunks/footer.BFXnK5l6.js";
|
|
18
|
+
import { f as B } from "./chunks/form.CTBHjnJb.js";
|
|
19
19
|
import { h as V } from "./chunks/helperText.CS5sun4r.js";
|
|
20
|
-
import { i as
|
|
21
|
-
import { i as
|
|
22
|
-
import { i as
|
|
20
|
+
import { i as Y } from "./chunks/icon.tCAxaKQh.js";
|
|
21
|
+
import { i as H } from "./chunks/input.DG5FyEpi.js";
|
|
22
|
+
import { i as G } from "./chunks/inputChoiceGroup.DkDdA57f.js";
|
|
23
23
|
import { l as k } from "./chunks/link.D_ySgWgk.js";
|
|
24
24
|
import { l as Z } from "./chunks/list.BwnGPz2Y.js";
|
|
25
25
|
import { l as q } from "./chunks/logo.Cl29Chxj.js";
|
|
@@ -38,29 +38,29 @@ import { t as ue } from "./chunks/textArea.CmtmGm_y.js";
|
|
|
38
38
|
import { t as _e } from "./chunks/toast.d3ZjZ9JS.js";
|
|
39
39
|
import { t as Ae } from "./chunks/tooltip.D1fCHa9d.js";
|
|
40
40
|
import { shared as Fe } from "./lib/shared.es.js";
|
|
41
|
-
import { generateSpacingClasses as
|
|
42
|
-
import { ACCENT as
|
|
43
|
-
import { Directions as
|
|
44
|
-
import { generateCssVarPrefix as
|
|
45
|
-
import { addScrollToRect as
|
|
46
|
-
import { createRafScheduler as
|
|
47
|
-
import { computeFitCount as
|
|
41
|
+
import { generateSpacingClasses as ye, getBEMClassNames as Pe } from "./lib/utils/classNames.es.js";
|
|
42
|
+
import { ACCENT as Ne, ATTRIBUTE as Le, BASE_FONT_SIZE as Oe, BEAM_INVERSE as Ie, DEFAULT_ACCENT as Me, DEFAULT_MODE as Be, DEFAULT_PRODUCT_TYPE as Ue, DEFAULT_THEME as Ve, EXPRESSIVE_THEMES as Ke, FPS_1 as Ye, FPS_120 as we, FPS_30 as He, FPS_60 as ze, PRODUCT_TYPE as Ge, STORAGE_KEY as We, SYSTEM_MODE_ENABLED_KEY as ke, SpacingValues as Xe, SpacingValuesAsNumbers as Ze, StaticAppearances as je, accentThemeClassName as qe, allColors as Je, allSizes as Qe, appearance as $e, appearances as er, consumer as rr, emphases as or, enterprise as tr, expressiveThemeClassName as ar, info as sr, infoPrimary as pr, infoSecondary as ir, information as mr, inverse as nr, lg as fr, md as lr, negative as xr, positive as cr, prefix as dr, primary as Er, productTypeThemeClassName as Sr, secondary as Tr, secondaryInverse as gr, sizes as Cr, sm as ur, themeClassName as br, themeTypeValues as _r, warning as hr, xl as Ar, xs as Dr, xxs as Fr } from "./lib/utils/constants.es.js";
|
|
43
|
+
import { Directions as yr, attributeDecorator as Pr, camelCaseToKebabCase as Rr, capitalizeFirstLetter as Nr, dateToDayKey as Lr, debounce as Or, doesEventContainElement as Ir, doesWebComponentSlotExist as Mr, enrichSVGIcon as Br, findFirstFocusableElement as Ur, getDirection as Vr, getRandomArbitrary as Kr, getRandomInt as Yr, getTypedEntries as wr, getTypedValues as Hr, isAPISupported as zr, isIOS as Gr, isMobileDevice as Wr, nodesHaveContent as kr, partitionProps as Xr, propsChanged as Zr, throttle as jr, toDayKey as qr } from "./lib/utils/helpers.es.js";
|
|
44
|
+
import { generateCssVarPrefix as Qr } from "./lib/utils/styles.es.js";
|
|
45
|
+
import { addScrollToRect as eo, compareDomOrder as ro, findTopLevelSlottedWrapper as oo, getElementScrollBoundingClientRect as to, getSecureRelAttribute as ao, readStringProp as so } from "./lib/utils/dom.es.js";
|
|
46
|
+
import { createRafScheduler as io } from "./lib/utils/raf.es.js";
|
|
47
|
+
import { computeFitCount as no, hasScrollOverflow as fo, isMultiLineClamped as lo, isOverFlowing as xo, isSingleLineClamped as co, isTextWrapping as Eo } from "./lib/utils/overflow.es.js";
|
|
48
48
|
export {
|
|
49
|
-
|
|
49
|
+
Ne as ACCENT,
|
|
50
50
|
Le as ATTRIBUTE,
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
Oe as BASE_FONT_SIZE,
|
|
52
|
+
Ie as BEAM_INVERSE,
|
|
53
|
+
Me as DEFAULT_ACCENT,
|
|
54
|
+
Be as DEFAULT_MODE,
|
|
55
55
|
Ue as DEFAULT_PRODUCT_TYPE,
|
|
56
56
|
Ve as DEFAULT_THEME,
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
57
|
+
yr as Directions,
|
|
58
|
+
Ke as EXPRESSIVE_THEMES,
|
|
59
|
+
Ye as FPS_1,
|
|
60
|
+
we as FPS_120,
|
|
61
|
+
He as FPS_30,
|
|
62
|
+
ze as FPS_60,
|
|
63
|
+
Ge as PRODUCT_TYPE,
|
|
64
64
|
We as STORAGE_KEY,
|
|
65
65
|
ke as SYSTEM_MODE_ENABLED_KEY,
|
|
66
66
|
Xe as SpacingValues,
|
|
@@ -69,69 +69,71 @@ export {
|
|
|
69
69
|
qe as accentThemeClassName,
|
|
70
70
|
o as accordion,
|
|
71
71
|
a as actionList,
|
|
72
|
-
|
|
72
|
+
eo as addScrollToRect,
|
|
73
73
|
p as alert,
|
|
74
74
|
Je as allColors,
|
|
75
75
|
Qe as allSizes,
|
|
76
76
|
$e as appearance,
|
|
77
77
|
er as appearances,
|
|
78
|
-
|
|
78
|
+
Pr as attributeDecorator,
|
|
79
79
|
m as avatar,
|
|
80
80
|
f as badge,
|
|
81
81
|
x as badgeDot,
|
|
82
82
|
d as box,
|
|
83
83
|
S as button,
|
|
84
|
-
|
|
85
|
-
|
|
84
|
+
Rr as camelCaseToKebabCase,
|
|
85
|
+
Nr as capitalizeFirstLetter,
|
|
86
86
|
g as card,
|
|
87
87
|
u as chips,
|
|
88
88
|
_ as closeButton,
|
|
89
|
-
|
|
90
|
-
|
|
89
|
+
ro as compareDomOrder,
|
|
90
|
+
no as computeFitCount,
|
|
91
91
|
rr as consumer,
|
|
92
|
-
|
|
92
|
+
io as createRafScheduler,
|
|
93
93
|
A as dataTable,
|
|
94
94
|
F as dateField,
|
|
95
|
-
Lr as
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
95
|
+
Lr as dateToDayKey,
|
|
96
|
+
Or as debounce,
|
|
97
|
+
y as dialog,
|
|
98
|
+
R as divider,
|
|
99
|
+
Ir as doesEventContainElement,
|
|
100
|
+
Mr as doesWebComponentSlotExist,
|
|
100
101
|
or as emphases,
|
|
101
102
|
Br as enrichSVGIcon,
|
|
102
103
|
tr as enterprise,
|
|
103
104
|
ar as expressiveThemeClassName,
|
|
104
105
|
L as fileUpload,
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
106
|
+
Ur as findFirstFocusableElement,
|
|
107
|
+
oo as findTopLevelSlottedWrapper,
|
|
108
|
+
I as footer,
|
|
109
|
+
B as form,
|
|
110
|
+
Qr as generateCssVarPrefix,
|
|
111
|
+
ye as generateSpacingClasses,
|
|
112
|
+
Pe as getBEMClassNames,
|
|
113
|
+
Vr as getDirection,
|
|
114
|
+
to as getElementScrollBoundingClientRect,
|
|
115
|
+
Kr as getRandomArbitrary,
|
|
115
116
|
Yr as getRandomInt,
|
|
116
|
-
|
|
117
|
+
ao as getSecureRelAttribute,
|
|
117
118
|
wr as getTypedEntries,
|
|
118
119
|
Hr as getTypedValues,
|
|
119
|
-
|
|
120
|
+
fo as hasScrollOverflow,
|
|
120
121
|
V as helperText,
|
|
121
|
-
|
|
122
|
+
Y as icon,
|
|
122
123
|
sr as info,
|
|
123
124
|
pr as infoPrimary,
|
|
124
125
|
ir as infoSecondary,
|
|
125
126
|
mr as information,
|
|
126
|
-
|
|
127
|
-
|
|
127
|
+
H as input,
|
|
128
|
+
G as inputChoiceGroup,
|
|
128
129
|
nr as inverse,
|
|
129
130
|
zr as isAPISupported,
|
|
130
|
-
Gr as
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
131
|
+
Gr as isIOS,
|
|
132
|
+
Wr as isMobileDevice,
|
|
133
|
+
lo as isMultiLineClamped,
|
|
134
|
+
xo as isOverFlowing,
|
|
135
|
+
co as isSingleLineClamped,
|
|
136
|
+
Eo as isTextWrapping,
|
|
135
137
|
fr as lg,
|
|
136
138
|
k as link,
|
|
137
139
|
Z as list,
|
|
@@ -139,18 +141,18 @@ export {
|
|
|
139
141
|
lr as md,
|
|
140
142
|
Q as nativeSelect,
|
|
141
143
|
xr as negative,
|
|
142
|
-
|
|
144
|
+
kr as nodesHaveContent,
|
|
143
145
|
ee as pageHeader,
|
|
144
146
|
ae as pagination,
|
|
145
147
|
oe as panel,
|
|
146
|
-
|
|
148
|
+
Xr as partitionProps,
|
|
147
149
|
cr as positive,
|
|
148
150
|
dr as prefix,
|
|
149
151
|
Er as primary,
|
|
150
152
|
Sr as productTypeThemeClassName,
|
|
151
153
|
pe as progressBar,
|
|
152
|
-
|
|
153
|
-
|
|
154
|
+
Zr as propsChanged,
|
|
155
|
+
so as readStringProp,
|
|
154
156
|
Tr as secondary,
|
|
155
157
|
gr as secondaryInverse,
|
|
156
158
|
me as segmentedControl,
|
|
@@ -165,7 +167,8 @@ export {
|
|
|
165
167
|
ue as textArea,
|
|
166
168
|
br as themeClassName,
|
|
167
169
|
_r as themeTypeValues,
|
|
168
|
-
|
|
170
|
+
jr as throttle,
|
|
171
|
+
qr as toDayKey,
|
|
169
172
|
_e as toast,
|
|
170
173
|
Ae as tooltip,
|
|
171
174
|
hr as warning,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../chunks/form.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../utils/helpers.cjs.js");const e=require("../../chunks/form.DHQXnPEp.js");exports.getCheckBoxGroupMeta=e.getCheckBoxGroupMeta;exports.getMultiSelectMeta=e.getMultiSelectMeta;exports.isGroupBlurEvent=e.isGroupBlurEvent;exports.validateFormField=e.validateFormField;exports.validationModes=e.validationModes;exports.validators=e.validators;
|
package/lib/components/form.d.ts
CHANGED
|
@@ -56,6 +56,21 @@ declare const maxLength: (params: {
|
|
|
56
56
|
message?: string;
|
|
57
57
|
}) => FormValidator;
|
|
58
58
|
declare const define: (callback: FormValidator["validator"]) => FormValidator;
|
|
59
|
+
/**
|
|
60
|
+
* Range check for date fields whose value is a `YYYY-MM-DD` string (e.g.
|
|
61
|
+
* DateField's hidden submission input). Compares by calendar day — time and
|
|
62
|
+
* timezone are ignored — with both bounds inclusive. An empty or unparseable
|
|
63
|
+
* value passes (pair with `required` to forbid empty). `min` / `max` are each
|
|
64
|
+
* optional, so either side can be left open; an invalid `Date` bound is treated
|
|
65
|
+
* as absent. A misconfigured range (`min` after `max`) disables the rule rather
|
|
66
|
+
* than rejecting every value — mirroring DateField's own `minDate`/`maxDate`
|
|
67
|
+
* guard.
|
|
68
|
+
*/
|
|
69
|
+
declare const dateRange: (params: {
|
|
70
|
+
min?: Date;
|
|
71
|
+
max?: Date;
|
|
72
|
+
message?: string;
|
|
73
|
+
}) => FormValidator;
|
|
59
74
|
export declare const validators: {
|
|
60
75
|
min: typeof min;
|
|
61
76
|
max: typeof max;
|
|
@@ -65,5 +80,6 @@ export declare const validators: {
|
|
|
65
80
|
required: typeof required;
|
|
66
81
|
minLength: typeof minLength;
|
|
67
82
|
maxLength: typeof maxLength;
|
|
83
|
+
dateRange: typeof dateRange;
|
|
68
84
|
};
|
|
69
85
|
export {};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "../utils/helpers.es.js";
|
|
2
|
+
import { g as o, a as i, i as s, v as r, b as l, c as d } from "../../chunks/form.CTBHjnJb.js";
|
|
2
3
|
export {
|
|
3
|
-
|
|
4
|
-
|
|
4
|
+
o as getCheckBoxGroupMeta,
|
|
5
|
+
i as getMultiSelectMeta,
|
|
5
6
|
s as isGroupBlurEvent,
|
|
6
|
-
|
|
7
|
+
r as validateFormField,
|
|
7
8
|
l as validationModes,
|
|
8
|
-
|
|
9
|
+
d as validators
|
|
9
10
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../chunks/accordion.C1LkPYXv.js"),o=require("../../chunks/actionList.LFHBSlrg.js"),t=require("../../chunks/alert.B4q5-o6H.js"),n=require("../../chunks/avatar.VNzxbOMa.js"),i=require("../../chunks/badge.B_k2GBe6.js"),r=require("../../chunks/badgeDot.Dkqfk3zg.js"),s=require("../../chunks/box.CsO__7hu.js"),c=require("../../chunks/button.Bbz_mfWv.js"),l=require("../../chunks/card.BRp1Xa5-.js"),p=require("../../chunks/chips.DKEagIsp.js"),_=require("../../chunks/closeButton.C1A3p88y.js"),a=require("../../chunks/dataTable.Bah7iKkO.js"),b=require("../../chunks/dateField.DhE-ZgeI.js"),u=require("../../chunks/dialog.DSxBxP0V.js"),m=require("../../chunks/divider.rAzhUMwO.js"),d=require("../../chunks/fileUpload.C-l2YXzO.js"),q=require("../../chunks/footer.DFaBRxcx.js"),g=require("../../chunks/form.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../chunks/accordion.C1LkPYXv.js"),o=require("../../chunks/actionList.LFHBSlrg.js"),t=require("../../chunks/alert.B4q5-o6H.js"),n=require("../../chunks/avatar.VNzxbOMa.js"),i=require("../../chunks/badge.B_k2GBe6.js"),r=require("../../chunks/badgeDot.Dkqfk3zg.js"),s=require("../../chunks/box.CsO__7hu.js"),c=require("../../chunks/button.Bbz_mfWv.js"),l=require("../../chunks/card.BRp1Xa5-.js"),p=require("../../chunks/chips.DKEagIsp.js"),_=require("../../chunks/closeButton.C1A3p88y.js"),a=require("../../chunks/dataTable.Bah7iKkO.js"),b=require("../../chunks/dateField.DhE-ZgeI.js"),u=require("../../chunks/dialog.DSxBxP0V.js"),m=require("../../chunks/divider.rAzhUMwO.js"),d=require("../../chunks/fileUpload.C-l2YXzO.js"),q=require("../../chunks/footer.DFaBRxcx.js"),g=require("../../chunks/form.DHQXnPEp.js"),h=require("../../chunks/helperText.C-apoW8Z.js"),x=require("../../chunks/icon.SiHuIfL8.js"),f=require("../../chunks/input.BxPkmKmK.js"),v=require("../../chunks/inputChoiceGroup.BSousduj.js"),S=require("../../chunks/link.VyBRMFxS.js"),T=require("../../chunks/list.D6NIx1OS.js"),B=require("../../chunks/logo.CLQZSaVN.js"),C=require("../../chunks/nativeSelect.Lz45VyQX.js"),k=require("../../chunks/pageHeader.CbDGb6ot.js"),w=require("../../chunks/panel.B1cO_Hpy.js"),A=require("../../chunks/pagination.Br7vTt5b.js"),D=require("../../chunks/progressBar.DcG-X-RY.js"),F=require("../../chunks/SegmentedControl.D0l_8a7O.js"),G=require("../../chunks/spinner.B6R6yphw.js"),H=require("../../chunks/stepper.ByKqsxhz.js"),L=require("../../chunks/switch.Dalf8ccu.js"),U=require("../../chunks/tabs.CJUp7Ss0.js"),y=require("../../chunks/text.CW-ftgoP.js"),j=require("../../chunks/textArea.DF76BVU5.js"),M=require("../../chunks/toast.C-h1RUq_.js"),O=require("../../chunks/tooltip.DZTJP5dS.js");exports.accordion=e.accordion;exports.actionList=o.actionList;exports.alert=t.alert;exports.avatar=n.avatar;exports.badge=i.badge;exports.badgeDot=r.badgeDot;exports.box=s.box;exports.button=c.button;exports.card=l.card;exports.chips=p.chips;exports.closeButton=_.closeButton;exports.dataTable=a.dataTable;exports.dateField=b.dateField;exports.dialog=u.dialog;exports.divider=m.divider;exports.fileUpload=d.fileUpload;exports.footer=q.footer;exports.form=g.form;exports.helperText=h.helperText;exports.icon=x.icon;exports.input=f.input;exports.inputChoiceGroup=v.inputChoiceGroup;exports.link=S.link;exports.list=T.list;exports.logo=B.logo;exports.nativeSelect=C.nativeSelect;exports.pageHeader=k.pageHeader;exports.panel=w.panel;exports.pagination=A.pagination;exports.progressBar=D.progressBar;exports.segmentedControl=F.SegmentedControl;exports.spinner=G.spinner;exports.stepper=H.stepper;exports.switch=L._switch;exports.tabs=U.tabs;exports.text=y.text;exports.textArea=j.textArea;exports.toast=M.toast;exports.tooltip=O.tooltip;
|
|
@@ -15,7 +15,7 @@ import { d as F } from "../../chunks/dialog.BuiendSV.js";
|
|
|
15
15
|
import { d as H } from "../../chunks/divider.D2kuHop2.js";
|
|
16
16
|
import { f as U } from "../../chunks/fileUpload.CzC_CuxM.js";
|
|
17
17
|
import { f as j } from "../../chunks/footer.BFXnK5l6.js";
|
|
18
|
-
import { f as y } from "../../chunks/form.
|
|
18
|
+
import { f as y } from "../../chunks/form.CTBHjnJb.js";
|
|
19
19
|
import { h as E } from "../../chunks/helperText.CS5sun4r.js";
|
|
20
20
|
import { i as J } from "../../chunks/icon.tCAxaKQh.js";
|
|
21
21
|
import { i as M } from "../../chunks/input.DG5FyEpi.js";
|
package/lib/utils/helpers.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("./constants.cjs.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("./constants.cjs.js"),T=e=>e.charAt(0).toUpperCase()+e.slice(1),y=e=>Object.values(e),S=e=>Object.entries(e);function E(e,t=w.FPS_120){let o;const r=(...n)=>{o!==void 0&&clearTimeout(o),o=setTimeout(()=>e(...n),t)};return r.cancel=()=>{o!==void 0&&clearTimeout(o)},r}const R=e=>{var o;const t=e.target;try{return t.assignedNodes().length>0||((o=t.assignedNodes()[0].textContent)==null?void 0:o.trim())!==""}catch{return!1}},C=e=>{if(!e||e.length===0)return!1;for(const t of e)if(t.nodeType===Node.ELEMENT_NODE||t.nodeType===Node.TEXT_NODE&&t.data.trim()!=="")return!0;return!1},x=(e,t={})=>{const o=Object.entries(t).reduce((r,[n,a])=>`${r} ${n}='${a}'`,"");return e.replace("<svg",`<svg ${o}`)},D=(e,t)=>t.some(o=>e.has(o)),M=e=>({decorate:t=>{if(!e)return;Object.keys(t).forEach(r=>{e[r]=t[r]})}}),L=e=>{const o=e.querySelector('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"]), [contenteditable]:not([contenteditable="false"])');return o||null},A=(e,t)=>!!e.composedPath().find(n=>n===t),B=(e,t)=>{if(!e||Object.keys(e).length===0)return[e,e];const o={},r={};return Object.keys(e).forEach(n=>{t.includes(n)?o[n]=e[n]:r[n]=e[n]}),[o,r]},I=()=>typeof window>"u"||typeof navigator>"u"?!1:/iP(ad|hone|od)/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1,P=()=>{if(typeof window>"u")return!1;const e=(navigator==null?void 0:navigator.userAgent)||(navigator==null?void 0:navigator.vendor)||(window==null?void 0:window.opera),t=["(android|bb\\d+|meego).+mobile","avantgo|bada\\/","blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)","iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront","opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\\/","plucker|pocket|psp|series([46])0|symbian|treo|up\\.(browser|link)","vodafone|wap|windows ce|xda|xiino"].join("|"),o=["1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)","ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)","as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)","bl(ac|az)|br([ev])w|bumb|bw-([nu])|c55\\/|capi|ccwa|cdm-","cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi","dica|dmob|do([cp])o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)","esl8|ez([4-7]0|os|wa|ze)|fetc|fly([-_])|g1 u|g560|gene|gf-5|g-mo","go(\\.w|od)|gr(ad|un)|haie|hcit|hd-([mpt])|hei-|hi(pt|ta)","hp( i|ip)|hs-c|ht(c([- _agpst])|tp)|hu(aw|tc)|i-(20|go|ma)","i230|iac([ \\-\\/])"].join("|");return new RegExp(t,"i").test(e)||new RegExp(o,"i").test(e.substr(0,4))};var h=(e=>(e.TOP="top",e.LEFT="left",e.RIGHT="right",e.BOTTOM="bottom",e))(h||{});const F=(e,t=300)=>{let o,r,n;return function(){const a=this,i=arguments;o?(clearTimeout(r),r=setTimeout(()=>{Date.now()-n>=t&&(e.apply(a,i),n=Date.now())},Math.max(t-(Date.now()-n),0))):(e.apply(a,i),n=Date.now(),o=!0)}},O=(e,t,o)=>{const{innerHeight:r,innerWidth:n}=window,{top:a,left:i,right:m,bottom:b}=o;return{top:(g,d)=>{if(d){const c=r-b,u=c<e,f=a>c;return u&&f?"bottom":"top"}const s=r-b,l=a<e,p=s>e;return l&&p?"bottom":"top"},bottom:(g,d)=>{if(d){const c=r-b,u=a<e,f=c>e;return u&&f?"top":"bottom"}const s=r-b,l=s<e,p=a>s;return l&&p?"top":"bottom"},left:g=>{if(g){const p=n-m,c=t>p,u=i>t;return c&&u?"right":"left"}const d=n-m,s=i<t,l=d>t;return s&&l?"right":"left"},right:g=>{if(g){const p=n-m,c=i<t,u=p>t;return c&&u?"left":"right"}const s=n-m<t,l=i>t;return s&&l?"left":"right"}}};function N(e,t){return Math.random()*(t-e)+e}function k(e,t){return e=Math.ceil(e),t=Math.floor(t),Math.floor(Math.random()*(t-e+1))+e}function z(e){return typeof window>"u"?!1:window.HTMLElement.prototype.hasOwnProperty(e)}const K=e=>e.replace(/^([A-Z])/,t=>t.toLowerCase()).replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase(),v=(e,t,o)=>e*1e4+t*100+o,$=e=>v(e.getFullYear(),e.getMonth()+1,e.getDate());exports.Directions=h;exports.attributeDecorator=M;exports.camelCaseToKebabCase=K;exports.capitalizeFirstLetter=T;exports.dateToDayKey=$;exports.debounce=E;exports.doesEventContainElement=A;exports.doesWebComponentSlotExist=R;exports.enrichSVGIcon=x;exports.findFirstFocusableElement=L;exports.getDirection=O;exports.getRandomArbitrary=N;exports.getRandomInt=k;exports.getTypedEntries=S;exports.getTypedValues=y;exports.isAPISupported=z;exports.isIOS=I;exports.isMobileDevice=P;exports.nodesHaveContent=C;exports.partitionProps=B;exports.propsChanged=D;exports.throttle=F;exports.toDayKey=v;
|
package/lib/utils/helpers.d.ts
CHANGED
|
@@ -31,6 +31,13 @@ export declare const doesEventContainElement: (e: Event, element: HTMLElement) =
|
|
|
31
31
|
* @returns
|
|
32
32
|
*/
|
|
33
33
|
export declare const partitionProps: <T extends Record<string, unknown>, U extends keyof T>(_filteredObj: T, selectedKeys: Readonly<Array<U>>) => [Pick<T, U>, Omit<T, U>];
|
|
34
|
+
/**
|
|
35
|
+
* Checks if the device is iOS (iPhone, iPod, or iPad).
|
|
36
|
+
* SSR-safe: returns false when window/navigator are unavailable.
|
|
37
|
+
* Detects iPhone/iPod/iPad via user agent and iPadOS 13+ (desktop mode) via maxTouchPoints.
|
|
38
|
+
* @returns {boolean}
|
|
39
|
+
*/
|
|
40
|
+
export declare const isIOS: () => boolean;
|
|
34
41
|
/**
|
|
35
42
|
* Checks if the device is mobile
|
|
36
43
|
* @returns {boolean}
|
|
@@ -64,3 +71,13 @@ export declare function isAPISupported(prop: string): boolean;
|
|
|
64
71
|
* Converts a camelCase (or PascalCase) string to kebab-case
|
|
65
72
|
*/
|
|
66
73
|
export declare const camelCaseToKebabCase: (camelCaseString: string) => string;
|
|
74
|
+
/**
|
|
75
|
+
* Calendar-day sort key — `YYYYMMDD` as a number
|
|
76
|
+
* (`year * 10000 + month * 100 + day`), month 1-based. Lets two dates be
|
|
77
|
+
* compared/ordered by calendar day, ignoring time and timezone. Kept here (pure,
|
|
78
|
+
* framework-agnostic) so DateField's utils and the `dateRange` form validator
|
|
79
|
+
* share one formula instead of drifting copies.
|
|
80
|
+
*/
|
|
81
|
+
export declare const toDayKey: (year: number, month: number, day: number) => number;
|
|
82
|
+
/** `toDayKey` for a `Date`, using its local calendar day. */
|
|
83
|
+
export declare const dateToDayKey: (date: Date) => number;
|
package/lib/utils/helpers.es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FPS_120 as h } from "./constants.es.js";
|
|
2
|
-
const
|
|
3
|
-
function
|
|
2
|
+
const S = (e) => e.charAt(0).toUpperCase() + e.slice(1), y = (e) => Object.values(e), E = (e) => Object.entries(e);
|
|
3
|
+
function R(e, t = h) {
|
|
4
4
|
let o;
|
|
5
5
|
const r = (...n) => {
|
|
6
6
|
o !== void 0 && clearTimeout(o), o = setTimeout(() => e(...n), t);
|
|
@@ -9,7 +9,7 @@ function y(e, t = h) {
|
|
|
9
9
|
o !== void 0 && clearTimeout(o);
|
|
10
10
|
}, r;
|
|
11
11
|
}
|
|
12
|
-
const
|
|
12
|
+
const x = (e) => {
|
|
13
13
|
var o;
|
|
14
14
|
const t = e.target;
|
|
15
15
|
try {
|
|
@@ -17,12 +17,12 @@ const R = (e) => {
|
|
|
17
17
|
} catch {
|
|
18
18
|
return !1;
|
|
19
19
|
}
|
|
20
|
-
},
|
|
20
|
+
}, C = (e) => {
|
|
21
21
|
if (!e || e.length === 0) return !1;
|
|
22
22
|
for (const t of e)
|
|
23
23
|
if (t.nodeType === Node.ELEMENT_NODE || t.nodeType === Node.TEXT_NODE && t.data.trim() !== "") return !0;
|
|
24
24
|
return !1;
|
|
25
|
-
},
|
|
25
|
+
}, M = (e, t = {}) => {
|
|
26
26
|
const o = Object.entries(t).reduce(
|
|
27
27
|
(r, [n, a]) => `${r} ${n}='${a}'`,
|
|
28
28
|
""
|
|
@@ -35,17 +35,17 @@ const R = (e) => {
|
|
|
35
35
|
e[r] = t[r];
|
|
36
36
|
});
|
|
37
37
|
}
|
|
38
|
-
}),
|
|
38
|
+
}), A = (e) => {
|
|
39
39
|
const o = e.querySelector('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"]), [contenteditable]:not([contenteditable="false"])');
|
|
40
40
|
return o || null;
|
|
41
|
-
},
|
|
41
|
+
}, D = (e, t) => !!e.composedPath().find((n) => n === t), N = (e, t) => {
|
|
42
42
|
if (!e || Object.keys(e).length === 0)
|
|
43
43
|
return [e, e];
|
|
44
44
|
const o = {}, r = {};
|
|
45
45
|
return Object.keys(e).forEach((n) => {
|
|
46
46
|
t.includes(n) ? o[n] = e[n] : r[n] = e[n];
|
|
47
47
|
}), [o, r];
|
|
48
|
-
}, k = () => {
|
|
48
|
+
}, P = () => typeof window > "u" || typeof navigator > "u" ? !1 : /iP(ad|hone|od)/.test(navigator.userAgent) || navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1, k = () => {
|
|
49
49
|
if (typeof window > "u") return !1;
|
|
50
50
|
const e = (navigator == null ? void 0 : navigator.userAgent) || (navigator == null ? void 0 : navigator.vendor) || (window == null ? void 0 : window.opera), t = [
|
|
51
51
|
"(android|bb\\d+|meego).+mobile",
|
|
@@ -70,7 +70,7 @@ const R = (e) => {
|
|
|
70
70
|
return new RegExp(t, "i").test(e) || new RegExp(o, "i").test(e.substr(0, 4));
|
|
71
71
|
};
|
|
72
72
|
var w = /* @__PURE__ */ ((e) => (e.TOP = "top", e.LEFT = "left", e.RIGHT = "right", e.BOTTOM = "bottom", e))(w || {});
|
|
73
|
-
const
|
|
73
|
+
const F = (e, t = 300) => {
|
|
74
74
|
let o, r, n;
|
|
75
75
|
return function() {
|
|
76
76
|
const a = this, i = arguments;
|
|
@@ -78,28 +78,28 @@ const z = (e, t = 300) => {
|
|
|
78
78
|
Date.now() - n >= t && (e.apply(a, i), n = Date.now());
|
|
79
79
|
}, Math.max(t - (Date.now() - n), 0))) : (e.apply(a, i), n = Date.now(), o = !0);
|
|
80
80
|
};
|
|
81
|
-
},
|
|
81
|
+
}, I = (e, t, o) => {
|
|
82
82
|
const { innerHeight: r, innerWidth: n } = window, {
|
|
83
83
|
top: a,
|
|
84
84
|
left: i,
|
|
85
85
|
right: d,
|
|
86
|
-
bottom:
|
|
86
|
+
bottom: f
|
|
87
87
|
} = o;
|
|
88
88
|
return {
|
|
89
89
|
top: (g, m) => {
|
|
90
90
|
if (m) {
|
|
91
|
-
const c = r -
|
|
92
|
-
return u &&
|
|
91
|
+
const c = r - f, u = c < e, b = a > c;
|
|
92
|
+
return u && b ? "bottom" : "top";
|
|
93
93
|
}
|
|
94
|
-
const s = r -
|
|
94
|
+
const s = r - f, l = a < e, p = s > e;
|
|
95
95
|
return l && p ? "bottom" : "top";
|
|
96
96
|
},
|
|
97
97
|
bottom: (g, m) => {
|
|
98
98
|
if (m) {
|
|
99
|
-
const c = r -
|
|
100
|
-
return u &&
|
|
99
|
+
const c = r - f, u = a < e, b = c > e;
|
|
100
|
+
return u && b ? "top" : "bottom";
|
|
101
101
|
}
|
|
102
|
-
const s = r -
|
|
102
|
+
const s = r - f, l = s < e, p = a > s;
|
|
103
103
|
return l && p ? "top" : "bottom";
|
|
104
104
|
},
|
|
105
105
|
left: (g) => {
|
|
@@ -120,35 +120,38 @@ const z = (e, t = 300) => {
|
|
|
120
120
|
}
|
|
121
121
|
};
|
|
122
122
|
};
|
|
123
|
-
function
|
|
123
|
+
function O(e, t) {
|
|
124
124
|
return Math.random() * (t - e) + e;
|
|
125
125
|
}
|
|
126
|
-
function
|
|
126
|
+
function z(e, t) {
|
|
127
127
|
return e = Math.ceil(e), t = Math.floor(t), Math.floor(Math.random() * (t - e + 1)) + e;
|
|
128
128
|
}
|
|
129
|
-
function
|
|
129
|
+
function $(e) {
|
|
130
130
|
return typeof window > "u" ? !1 : window.HTMLElement.prototype.hasOwnProperty(e);
|
|
131
131
|
}
|
|
132
|
-
const
|
|
132
|
+
const K = (e) => e.replace(/^([A-Z])/, (t) => t.toLowerCase()).replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2").toLowerCase(), v = (e, t, o) => e * 1e4 + t * 100 + o, Z = (e) => v(e.getFullYear(), e.getMonth() + 1, e.getDate());
|
|
133
133
|
export {
|
|
134
134
|
w as Directions,
|
|
135
135
|
L as attributeDecorator,
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
M as
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
O as
|
|
136
|
+
K as camelCaseToKebabCase,
|
|
137
|
+
S as capitalizeFirstLetter,
|
|
138
|
+
Z as dateToDayKey,
|
|
139
|
+
R as debounce,
|
|
140
|
+
D as doesEventContainElement,
|
|
141
|
+
x as doesWebComponentSlotExist,
|
|
142
|
+
M as enrichSVGIcon,
|
|
143
|
+
A as findFirstFocusableElement,
|
|
144
|
+
I as getDirection,
|
|
145
|
+
O as getRandomArbitrary,
|
|
146
|
+
z as getRandomInt,
|
|
146
147
|
E as getTypedEntries,
|
|
147
|
-
|
|
148
|
-
|
|
148
|
+
y as getTypedValues,
|
|
149
|
+
$ as isAPISupported,
|
|
150
|
+
P as isIOS,
|
|
149
151
|
k as isMobileDevice,
|
|
150
|
-
|
|
152
|
+
C as nodesHaveContent,
|
|
151
153
|
N as partitionProps,
|
|
152
154
|
B as propsChanged,
|
|
153
|
-
|
|
155
|
+
F as throttle,
|
|
156
|
+
v as toDayKey
|
|
154
157
|
};
|
package/lib/utils/index.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./classNames.cjs.js"),e=require("./constants.cjs.js"),t=require("./helpers.cjs.js"),i=require("./styles.cjs.js"),s=require("./dom.cjs.js"),n=require("./raf.cjs.js"),a=require("./overflow.cjs.js");exports.generateSpacingClasses=r.generateSpacingClasses;exports.getBEMClassNames=r.getBEMClassNames;exports.ACCENT=e.ACCENT;exports.ATTRIBUTE=e.ATTRIBUTE;exports.BASE_FONT_SIZE=e.BASE_FONT_SIZE;exports.BEAM_INVERSE=e.BEAM_INVERSE;exports.DEFAULT_ACCENT=e.DEFAULT_ACCENT;exports.DEFAULT_MODE=e.DEFAULT_MODE;exports.DEFAULT_PRODUCT_TYPE=e.DEFAULT_PRODUCT_TYPE;exports.DEFAULT_THEME=e.DEFAULT_THEME;exports.EXPRESSIVE_THEMES=e.EXPRESSIVE_THEMES;exports.FPS_1=e.FPS_1;exports.FPS_120=e.FPS_120;exports.FPS_30=e.FPS_30;exports.FPS_60=e.FPS_60;exports.PRODUCT_TYPE=e.PRODUCT_TYPE;exports.STORAGE_KEY=e.STORAGE_KEY;exports.SYSTEM_MODE_ENABLED_KEY=e.SYSTEM_MODE_ENABLED_KEY;exports.SpacingValues=e.SpacingValues;exports.SpacingValuesAsNumbers=e.SpacingValuesAsNumbers;exports.StaticAppearances=e.StaticAppearances;exports.accentThemeClassName=e.accentThemeClassName;exports.allColors=e.allColors;exports.allSizes=e.allSizes;exports.appearance=e.appearance;exports.appearances=e.appearances;exports.consumer=e.consumer;exports.emphases=e.emphases;exports.enterprise=e.enterprise;exports.expressiveThemeClassName=e.expressiveThemeClassName;exports.info=e.info;exports.infoPrimary=e.infoPrimary;exports.infoSecondary=e.infoSecondary;exports.information=e.information;exports.inverse=e.inverse;exports.lg=e.lg;exports.md=e.md;exports.negative=e.negative;exports.positive=e.positive;exports.prefix=e.prefix;exports.primary=e.primary;exports.productTypeThemeClassName=e.productTypeThemeClassName;exports.secondary=e.secondary;exports.secondaryInverse=e.secondaryInverse;exports.sizes=e.sizes;exports.sm=e.sm;exports.themeClassName=e.themeClassName;exports.themeTypeValues=e.themeTypeValues;exports.warning=e.warning;exports.xl=e.xl;exports.xs=e.xs;exports.xxs=e.xxs;exports.Directions=t.Directions;exports.attributeDecorator=t.attributeDecorator;exports.camelCaseToKebabCase=t.camelCaseToKebabCase;exports.capitalizeFirstLetter=t.capitalizeFirstLetter;exports.dateToDayKey=t.dateToDayKey;exports.debounce=t.debounce;exports.doesEventContainElement=t.doesEventContainElement;exports.doesWebComponentSlotExist=t.doesWebComponentSlotExist;exports.enrichSVGIcon=t.enrichSVGIcon;exports.findFirstFocusableElement=t.findFirstFocusableElement;exports.getDirection=t.getDirection;exports.getRandomArbitrary=t.getRandomArbitrary;exports.getRandomInt=t.getRandomInt;exports.getTypedEntries=t.getTypedEntries;exports.getTypedValues=t.getTypedValues;exports.isAPISupported=t.isAPISupported;exports.isIOS=t.isIOS;exports.isMobileDevice=t.isMobileDevice;exports.nodesHaveContent=t.nodesHaveContent;exports.partitionProps=t.partitionProps;exports.propsChanged=t.propsChanged;exports.throttle=t.throttle;exports.toDayKey=t.toDayKey;exports.generateCssVarPrefix=i.generateCssVarPrefix;exports.addScrollToRect=s.addScrollToRect;exports.compareDomOrder=s.compareDomOrder;exports.findTopLevelSlottedWrapper=s.findTopLevelSlottedWrapper;exports.getElementScrollBoundingClientRect=s.getElementScrollBoundingClientRect;exports.getSecureRelAttribute=s.getSecureRelAttribute;exports.readStringProp=s.readStringProp;exports.createRafScheduler=n.createRafScheduler;exports.computeFitCount=a.computeFitCount;exports.hasScrollOverflow=a.hasScrollOverflow;exports.isMultiLineClamped=a.isMultiLineClamped;exports.isOverFlowing=a.isOverFlowing;exports.isSingleLineClamped=a.isSingleLineClamped;exports.isTextWrapping=a.isTextWrapping;
|
package/lib/utils/index.es.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { generateSpacingClasses as t, getBEMClassNames as a } from "./classNames.es.js";
|
|
2
|
-
import { ACCENT as s, ATTRIBUTE as i, BASE_FONT_SIZE as n, BEAM_INVERSE as p, DEFAULT_ACCENT as l, DEFAULT_MODE as m, DEFAULT_PRODUCT_TYPE as E, DEFAULT_THEME as c, EXPRESSIVE_THEMES as S, FPS_1 as T, FPS_120 as d, FPS_30 as C, FPS_60 as g, PRODUCT_TYPE as u, STORAGE_KEY as _, SYSTEM_MODE_ENABLED_KEY as f, SpacingValues as x, SpacingValuesAsNumbers as A, StaticAppearances as D, accentThemeClassName as
|
|
3
|
-
import { Directions as te, attributeDecorator as ae, camelCaseToKebabCase as oe, capitalizeFirstLetter as se,
|
|
4
|
-
import { generateCssVarPrefix as
|
|
5
|
-
import { addScrollToRect as
|
|
6
|
-
import { createRafScheduler as
|
|
7
|
-
import { computeFitCount as
|
|
2
|
+
import { ACCENT as s, ATTRIBUTE as i, BASE_FONT_SIZE as n, BEAM_INVERSE as p, DEFAULT_ACCENT as l, DEFAULT_MODE as m, DEFAULT_PRODUCT_TYPE as E, DEFAULT_THEME as c, EXPRESSIVE_THEMES as S, FPS_1 as T, FPS_120 as d, FPS_30 as C, FPS_60 as g, PRODUCT_TYPE as u, STORAGE_KEY as _, SYSTEM_MODE_ENABLED_KEY as f, SpacingValues as x, SpacingValuesAsNumbers as A, StaticAppearances as D, accentThemeClassName as y, allColors as F, allSizes as P, appearance as R, appearances as h, consumer as v, emphases as N, enterprise as b, expressiveThemeClassName as O, info as I, infoPrimary as L, infoSecondary as M, information as V, inverse as U, lg as B, md as K, negative as Y, positive as w, prefix as z, primary as H, productTypeThemeClassName as W, secondary as G, secondaryInverse as X, sizes as Z, sm as j, themeClassName as k, themeTypeValues as q, warning as J, xl as Q, xs as $, xxs as ee } from "./constants.es.js";
|
|
3
|
+
import { Directions as te, attributeDecorator as ae, camelCaseToKebabCase as oe, capitalizeFirstLetter as se, dateToDayKey as ie, debounce as ne, doesEventContainElement as pe, doesWebComponentSlotExist as le, enrichSVGIcon as me, findFirstFocusableElement as Ee, getDirection as ce, getRandomArbitrary as Se, getRandomInt as Te, getTypedEntries as de, getTypedValues as Ce, isAPISupported as ge, isIOS as ue, isMobileDevice as _e, nodesHaveContent as fe, partitionProps as xe, propsChanged as Ae, throttle as De, toDayKey as ye } from "./helpers.es.js";
|
|
4
|
+
import { generateCssVarPrefix as Pe } from "./styles.es.js";
|
|
5
|
+
import { addScrollToRect as he, compareDomOrder as ve, findTopLevelSlottedWrapper as Ne, getElementScrollBoundingClientRect as be, getSecureRelAttribute as Oe, readStringProp as Ie } from "./dom.es.js";
|
|
6
|
+
import { createRafScheduler as Me } from "./raf.es.js";
|
|
7
|
+
import { computeFitCount as Ue, hasScrollOverflow as Be, isMultiLineClamped as Ke, isOverFlowing as Ye, isSingleLineClamped as we, isTextWrapping as ze } from "./overflow.es.js";
|
|
8
8
|
export {
|
|
9
9
|
s as ACCENT,
|
|
10
10
|
i as ATTRIBUTE,
|
|
@@ -26,68 +26,71 @@ export {
|
|
|
26
26
|
x as SpacingValues,
|
|
27
27
|
A as SpacingValuesAsNumbers,
|
|
28
28
|
D as StaticAppearances,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
29
|
+
y as accentThemeClassName,
|
|
30
|
+
he as addScrollToRect,
|
|
31
|
+
F as allColors,
|
|
32
|
+
P as allSizes,
|
|
33
|
+
R as appearance,
|
|
34
|
+
h as appearances,
|
|
35
35
|
ae as attributeDecorator,
|
|
36
36
|
oe as camelCaseToKebabCase,
|
|
37
37
|
se as capitalizeFirstLetter,
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
ie as
|
|
43
|
-
ne as
|
|
44
|
-
pe as
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
38
|
+
ve as compareDomOrder,
|
|
39
|
+
Ue as computeFitCount,
|
|
40
|
+
v as consumer,
|
|
41
|
+
Me as createRafScheduler,
|
|
42
|
+
ie as dateToDayKey,
|
|
43
|
+
ne as debounce,
|
|
44
|
+
pe as doesEventContainElement,
|
|
45
|
+
le as doesWebComponentSlotExist,
|
|
46
|
+
N as emphases,
|
|
47
|
+
me as enrichSVGIcon,
|
|
48
|
+
b as enterprise,
|
|
49
|
+
O as expressiveThemeClassName,
|
|
50
|
+
Ee as findFirstFocusableElement,
|
|
51
|
+
Ne as findTopLevelSlottedWrapper,
|
|
52
|
+
Pe as generateCssVarPrefix,
|
|
52
53
|
t as generateSpacingClasses,
|
|
53
54
|
a as getBEMClassNames,
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
55
|
+
ce as getDirection,
|
|
56
|
+
be as getElementScrollBoundingClientRect,
|
|
57
|
+
Se as getRandomArbitrary,
|
|
58
|
+
Te as getRandomInt,
|
|
59
|
+
Oe as getSecureRelAttribute,
|
|
60
|
+
de as getTypedEntries,
|
|
61
|
+
Ce as getTypedValues,
|
|
62
|
+
Be as hasScrollOverflow,
|
|
63
|
+
I as info,
|
|
64
|
+
L as infoPrimary,
|
|
65
|
+
M as infoSecondary,
|
|
65
66
|
V as information,
|
|
66
67
|
U as inverse,
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
68
|
+
ge as isAPISupported,
|
|
69
|
+
ue as isIOS,
|
|
70
|
+
_e as isMobileDevice,
|
|
71
|
+
Ke as isMultiLineClamped,
|
|
72
|
+
Ye as isOverFlowing,
|
|
73
|
+
we as isSingleLineClamped,
|
|
74
|
+
ze as isTextWrapping,
|
|
73
75
|
B as lg,
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
76
|
+
K as md,
|
|
77
|
+
Y as negative,
|
|
78
|
+
fe as nodesHaveContent,
|
|
79
|
+
xe as partitionProps,
|
|
80
|
+
w as positive,
|
|
81
|
+
z as prefix,
|
|
82
|
+
H as primary,
|
|
81
83
|
W as productTypeThemeClassName,
|
|
82
|
-
|
|
83
|
-
|
|
84
|
+
Ae as propsChanged,
|
|
85
|
+
Ie as readStringProp,
|
|
84
86
|
G as secondary,
|
|
85
87
|
X as secondaryInverse,
|
|
86
88
|
Z as sizes,
|
|
87
89
|
j as sm,
|
|
88
90
|
k as themeClassName,
|
|
89
91
|
q as themeTypeValues,
|
|
90
|
-
|
|
92
|
+
De as throttle,
|
|
93
|
+
ye as toDayKey,
|
|
91
94
|
J as warning,
|
|
92
95
|
Q as xl,
|
|
93
96
|
$ as xs,
|
package/package.json
CHANGED
package/chunks/form.CBZyQOaS.js
DELETED
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
const d = ["onChange", "onBlur", "onSubmit"], p = async (n, r) => (await Promise.all(
|
|
2
|
-
r.map(
|
|
3
|
-
async (e) => {
|
|
4
|
-
const { validator: t } = e;
|
|
5
|
-
return t(n);
|
|
6
|
-
}
|
|
7
|
-
)
|
|
8
|
-
)).reduce(
|
|
9
|
-
(e, t) => {
|
|
10
|
-
const { error: s, message: c } = t;
|
|
11
|
-
return s ? [...e, c] : e;
|
|
12
|
-
},
|
|
13
|
-
[]
|
|
14
|
-
), h = (n) => {
|
|
15
|
-
const { target: r, relatedTarget: o } = n || {};
|
|
16
|
-
if (!o) return { groupBlur: !!o };
|
|
17
|
-
const { name: e } = r, { name: t } = o, { control: s } = o, { name: c } = s || {};
|
|
18
|
-
return { groupBlur: e === t || e === c };
|
|
19
|
-
}, i = (n) => {
|
|
20
|
-
const { type: r, checked: o } = n, e = r === "checkbox";
|
|
21
|
-
if (e)
|
|
22
|
-
return {
|
|
23
|
-
isCheckBoxGroup: e,
|
|
24
|
-
selectedBoxes: o ? [n] : []
|
|
25
|
-
};
|
|
26
|
-
const t = Array.from(n), s = t.every((l) => {
|
|
27
|
-
const { type: u } = l;
|
|
28
|
-
return u === "checkbox";
|
|
29
|
-
}), c = !!t.length && s;
|
|
30
|
-
if (!c) return { isCheckBoxGroup: c, selectedBoxes: [] };
|
|
31
|
-
const a = t.filter(
|
|
32
|
-
({ checked: l }) => l
|
|
33
|
-
);
|
|
34
|
-
return { isCheckBoxGroup: c, selectedBoxes: a };
|
|
35
|
-
}, g = (n) => {
|
|
36
|
-
const { type: r, multiple: o, options: e } = n, t = r === "select-multiple" && o;
|
|
37
|
-
if (!t) return { isMultiSelect: t, selectedOptions: [] };
|
|
38
|
-
const s = [].filter.call(
|
|
39
|
-
e,
|
|
40
|
-
({ selected: c }) => c
|
|
41
|
-
);
|
|
42
|
-
return { isMultiSelect: t, selectedOptions: s };
|
|
43
|
-
}, v = new RegExp(
|
|
44
|
-
[
|
|
45
|
-
"(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:",
|
|
46
|
-
"\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|\"(?:",
|
|
47
|
-
"[-\b\v\f-!#-[]-]",
|
|
48
|
-
'|\\\\[- \v\f-])*")@(?:(?:',
|
|
49
|
-
"[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:",
|
|
50
|
-
"[a-z0-9-]*[a-z0-9])?|\\[(?:(?:(2(5[0-5]|",
|
|
51
|
-
"[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\\.){3}(?:",
|
|
52
|
-
"(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?",
|
|
53
|
-
"[0-9])|[a-z0-9-]*[a-z0-9]:(?:",
|
|
54
|
-
"[-\b\v\f-!-ZS-]|\\\\[-",
|
|
55
|
-
" \v\f-])+)\\])"
|
|
56
|
-
].join("")
|
|
57
|
-
), x = (n) => ({
|
|
58
|
-
name: "min",
|
|
59
|
-
validator: (r) => {
|
|
60
|
-
const { value: o, message: e } = n, { value: t } = r;
|
|
61
|
-
return { error: !!t && Number(t) < o, message: e };
|
|
62
|
-
}
|
|
63
|
-
}), f = (n) => ({
|
|
64
|
-
name: "max",
|
|
65
|
-
validator: (r) => {
|
|
66
|
-
const { value: o, message: e } = n, { value: t } = r;
|
|
67
|
-
return { error: !!t && Number(t) > o, message: e };
|
|
68
|
-
}
|
|
69
|
-
}), B = (n) => ({
|
|
70
|
-
name: "email",
|
|
71
|
-
validator: (r) => {
|
|
72
|
-
const { message: o } = n || {}, { value: e } = r;
|
|
73
|
-
return { error: !!e && !v.test(e), message: o };
|
|
74
|
-
}
|
|
75
|
-
}), k = (n) => ({
|
|
76
|
-
name: "pattern",
|
|
77
|
-
validator: (r) => {
|
|
78
|
-
const { pattern: o, message: e } = n, { value: t } = r;
|
|
79
|
-
return { error: !!t && !t.match(o), message: e };
|
|
80
|
-
}
|
|
81
|
-
}), y = (n) => ({
|
|
82
|
-
name: "required",
|
|
83
|
-
validator: (r) => {
|
|
84
|
-
const { message: o } = n || {}, { value: e } = r, {
|
|
85
|
-
isCheckBoxGroup: t,
|
|
86
|
-
selectedBoxes: { length: s }
|
|
87
|
-
} = i(r);
|
|
88
|
-
if (t) return { error: !s, message: o };
|
|
89
|
-
const {
|
|
90
|
-
isMultiSelect: c,
|
|
91
|
-
selectedOptions: { length: a }
|
|
92
|
-
} = g(r);
|
|
93
|
-
return c ? { error: !a, message: o } : { error: !e, message: o };
|
|
94
|
-
}
|
|
95
|
-
}), z = (n) => ({
|
|
96
|
-
name: "minLength",
|
|
97
|
-
validator: (r) => {
|
|
98
|
-
const { length: o, message: e } = n, { value: t } = r, s = !!t && t.length < o, {
|
|
99
|
-
isCheckBoxGroup: c,
|
|
100
|
-
selectedBoxes: { length: a }
|
|
101
|
-
} = i(r);
|
|
102
|
-
if (c)
|
|
103
|
-
return { error: !!a && a < o, message: e };
|
|
104
|
-
const {
|
|
105
|
-
isMultiSelect: l,
|
|
106
|
-
selectedOptions: { length: u }
|
|
107
|
-
} = g(r);
|
|
108
|
-
return l ? { error: !!u && u < o, message: e } : { error: s, message: e };
|
|
109
|
-
}
|
|
110
|
-
}), E = (n) => ({
|
|
111
|
-
name: "maxLength",
|
|
112
|
-
validator: (r) => {
|
|
113
|
-
const { length: o, message: e } = n, { value: t } = r, s = !!t && t.length > o, {
|
|
114
|
-
isCheckBoxGroup: c,
|
|
115
|
-
selectedBoxes: { length: a }
|
|
116
|
-
} = i(r);
|
|
117
|
-
if (c)
|
|
118
|
-
return { error: !!a && a > o, message: e };
|
|
119
|
-
const {
|
|
120
|
-
isMultiSelect: l,
|
|
121
|
-
selectedOptions: { length: u }
|
|
122
|
-
} = g(r);
|
|
123
|
-
return l ? { error: !!u && u > o, message: e } : { error: s, message: e };
|
|
124
|
-
}
|
|
125
|
-
}), b = (n) => ({
|
|
126
|
-
name: "define",
|
|
127
|
-
validator: (r) => n(r)
|
|
128
|
-
}), L = {
|
|
129
|
-
min: x,
|
|
130
|
-
max: f,
|
|
131
|
-
email: B,
|
|
132
|
-
define: b,
|
|
133
|
-
pattern: k,
|
|
134
|
-
required: y,
|
|
135
|
-
minLength: z,
|
|
136
|
-
maxLength: E
|
|
137
|
-
}, O = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
138
|
-
__proto__: null,
|
|
139
|
-
getCheckBoxGroupMeta: i,
|
|
140
|
-
getMultiSelectMeta: g,
|
|
141
|
-
isGroupBlurEvent: h,
|
|
142
|
-
validateFormField: p,
|
|
143
|
-
validationModes: d,
|
|
144
|
-
validators: L
|
|
145
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
146
|
-
export {
|
|
147
|
-
g as a,
|
|
148
|
-
d as b,
|
|
149
|
-
L as c,
|
|
150
|
-
O as f,
|
|
151
|
-
i as g,
|
|
152
|
-
h as i,
|
|
153
|
-
p as v
|
|
154
|
-
};
|
package/chunks/form.CIzlawbr.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const m=["onChange","onBlur","onSubmit"],p=async(n,r)=>(await Promise.all(r.map(async e=>{const{validator:t}=e;return t(n)}))).reduce((e,t)=>{const{error:s,message:c}=t;return s?[...e,c]:e},[]),h=n=>{const{target:r,relatedTarget:o}=n||{};if(!o)return{groupBlur:!!o};const{name:e}=r,{name:t}=o,{control:s}=o,{name:c}=s||{};return{groupBlur:e===t||e===c}},i=n=>{const{type:r,checked:o}=n,e=r==="checkbox";if(e)return{isCheckBoxGroup:e,selectedBoxes:o?[n]:[]};const t=Array.from(n),s=t.every(l=>{const{type:u}=l;return u==="checkbox"}),c=!!t.length&&s;if(!c)return{isCheckBoxGroup:c,selectedBoxes:[]};const a=t.filter(({checked:l})=>l);return{isCheckBoxGroup:c,selectedBoxes:a}},g=n=>{const{type:r,multiple:o,options:e}=n,t=r==="select-multiple"&&o;if(!t)return{isMultiSelect:t,selectedOptions:[]};const s=[].filter.call(e,({selected:c})=>c);return{isMultiSelect:t,selectedOptions:s}},x=new RegExp(["(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:","\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|\"(?:","[-\b\v\f-!#-[]-]",'|\\\\[- \v\f-])*")@(?:(?:',"[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:","[a-z0-9-]*[a-z0-9])?|\\[(?:(?:(2(5[0-5]|","[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\\.){3}(?:","(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?","[0-9])|[a-z0-9-]*[a-z0-9]:(?:","[-\b\v\f-!-ZS-]|\\\\[-"," \v\f-])+)\\])"].join("")),B=n=>({name:"min",validator:r=>{const{value:o,message:e}=n,{value:t}=r;return{error:!!t&&Number(t)<o,message:e}}}),f=n=>({name:"max",validator:r=>{const{value:o,message:e}=n,{value:t}=r;return{error:!!t&&Number(t)>o,message:e}}}),M=n=>({name:"email",validator:r=>{const{message:o}=n||{},{value:e}=r;return{error:!!e&&!x.test(e),message:o}}}),k=n=>({name:"pattern",validator:r=>{const{pattern:o,message:e}=n,{value:t}=r;return{error:!!t&&!t.match(o),message:e}}}),E=n=>({name:"required",validator:r=>{const{message:o}=n||{},{value:e}=r,{isCheckBoxGroup:t,selectedBoxes:{length:s}}=i(r);if(t)return{error:!s,message:o};const{isMultiSelect:c,selectedOptions:{length:a}}=g(r);return c?{error:!a,message:o}:{error:!e,message:o}}}),y=n=>({name:"minLength",validator:r=>{const{length:o,message:e}=n,{value:t}=r,s=!!t&&t.length<o,{isCheckBoxGroup:c,selectedBoxes:{length:a}}=i(r);if(c)return{error:!!a&&a<o,message:e};const{isMultiSelect:l,selectedOptions:{length:u}}=g(r);return l?{error:!!u&&u<o,message:e}:{error:s,message:e}}}),z=n=>({name:"maxLength",validator:r=>{const{length:o,message:e}=n,{value:t}=r,s=!!t&&t.length>o,{isCheckBoxGroup:c,selectedBoxes:{length:a}}=i(r);if(c)return{error:!!a&&a>o,message:e};const{isMultiSelect:l,selectedOptions:{length:u}}=g(r);return l?{error:!!u&&u>o,message:e}:{error:s,message:e}}}),S=n=>({name:"define",validator:r=>n(r)}),v={min:B,max:f,email:M,define:S,pattern:k,required:E,minLength:y,maxLength:z},C=Object.freeze(Object.defineProperty({__proto__:null,getCheckBoxGroupMeta:i,getMultiSelectMeta:g,isGroupBlurEvent:h,validateFormField:p,validationModes:m,validators:v},Symbol.toStringTag,{value:"Module"}));exports.form=C;exports.getCheckBoxGroupMeta=i;exports.getMultiSelectMeta=g;exports.isGroupBlurEvent=h;exports.validateFormField=p;exports.validationModes=m;exports.validators=v;
|