bhl-forms 0.0.14 → 0.0.17
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/dist/bhl-forms.es.js +174 -102
- package/dist/bhl-forms.iife.js +10 -10
- package/dist/bhl-forms.umd.js +10 -10
- package/dist/forms/childAndFamily.es.js +133 -66
- package/dist/forms/childAndFamily.iife.js +1 -602
- package/dist/forms/childAndFamily.json +1 -1
- package/dist/forms/testForm.es.js +92 -55
- package/dist/forms/testForm.iife.js +1 -361
- package/dist/forms/testForm.json +1 -1
- package/dist/main.css +1 -1
- package/package.json +5 -3
package/dist/bhl-forms.es.js
CHANGED
|
@@ -4489,7 +4489,7 @@ function cloneAny$1(obj) {
|
|
|
4489
4489
|
function undefine$1(value) {
|
|
4490
4490
|
return value !== void 0 && value !== "false" && value !== false ? true : void 0;
|
|
4491
4491
|
}
|
|
4492
|
-
function init$
|
|
4492
|
+
function init$2(obj) {
|
|
4493
4493
|
return !Object.isFrozen(obj) ? Object.defineProperty(obj, "__init", {
|
|
4494
4494
|
enumerable: false,
|
|
4495
4495
|
value: true
|
|
@@ -4728,7 +4728,7 @@ function reset$1(id, resetTo) {
|
|
|
4728
4728
|
node.input(cloneAny$1(resetTo) || initial(node), false);
|
|
4729
4729
|
node.walk((child) => child.input(initial(child), false));
|
|
4730
4730
|
const finalInit = initial(node);
|
|
4731
|
-
node.input(typeof finalInit === "object" ? cloneAny$1(resetTo) || init$
|
|
4731
|
+
node.input(typeof finalInit === "object" ? cloneAny$1(resetTo) || init$2(finalInit) : finalInit, false);
|
|
4732
4732
|
node._e.play(node);
|
|
4733
4733
|
clearState$1(node);
|
|
4734
4734
|
node.emit("reset", node);
|
|
@@ -4798,9 +4798,9 @@ function trap$1(getter, setter, curryGetter = true) {
|
|
|
4798
4798
|
}
|
|
4799
4799
|
function createValue$1(options2) {
|
|
4800
4800
|
if (options2.type === "group") {
|
|
4801
|
-
return init$
|
|
4801
|
+
return init$2(options2.value && typeof options2.value === "object" && !Array.isArray(options2.value) ? options2.value : {});
|
|
4802
4802
|
} else if (options2.type === "list") {
|
|
4803
|
-
return init$
|
|
4803
|
+
return init$2(Array.isArray(options2.value) ? options2.value : []);
|
|
4804
4804
|
}
|
|
4805
4805
|
return options2.value === null ? "" : options2.value;
|
|
4806
4806
|
}
|
|
@@ -4861,7 +4861,7 @@ function hydrate$1(node, context) {
|
|
|
4861
4861
|
if (typeof _value !== "object")
|
|
4862
4862
|
return;
|
|
4863
4863
|
if (child.name in _value) {
|
|
4864
|
-
const childValue = child.type !== "input" || _value[child.name] && typeof _value[child.name] === "object" ? init$
|
|
4864
|
+
const childValue = child.type !== "input" || _value[child.name] && typeof _value[child.name] === "object" ? init$2(_value[child.name]) : _value[child.name];
|
|
4865
4865
|
child.input(childValue, false);
|
|
4866
4866
|
} else {
|
|
4867
4867
|
if (node.type !== "list" || typeof child.name === "number") {
|
|
@@ -4948,7 +4948,7 @@ function addProps$1(node, context, props2) {
|
|
|
4948
4948
|
}
|
|
4949
4949
|
}
|
|
4950
4950
|
const initial = cloneAny$1(context._value);
|
|
4951
|
-
node.props.initial = node.type !== "input" ? init$
|
|
4951
|
+
node.props.initial = node.type !== "input" ? init$2(initial) : initial;
|
|
4952
4952
|
node.props._emit = true;
|
|
4953
4953
|
node.props.attrs = attrs;
|
|
4954
4954
|
if (node.props.definition) {
|
|
@@ -5400,7 +5400,7 @@ function useSteps() {
|
|
|
5400
5400
|
}));
|
|
5401
5401
|
});
|
|
5402
5402
|
if (!node.context.state.valid) {
|
|
5403
|
-
return;
|
|
5403
|
+
return false;
|
|
5404
5404
|
}
|
|
5405
5405
|
}
|
|
5406
5406
|
if (node.props.attrs.nextStepMap) {
|
|
@@ -5414,12 +5414,21 @@ function useSteps() {
|
|
|
5414
5414
|
} else {
|
|
5415
5415
|
throw Error("Unexpected value for nextStep: " + nextStep);
|
|
5416
5416
|
}
|
|
5417
|
+
return true;
|
|
5417
5418
|
};
|
|
5418
|
-
const setNextStep2 = () => {
|
|
5419
|
-
setStep2({ nextStep: 1 });
|
|
5419
|
+
const setNextStep2 = (callback) => {
|
|
5420
|
+
const res = setStep2({ nextStep: 1 });
|
|
5421
|
+
if (callback) {
|
|
5422
|
+
callback(res, stepHistory2, stepQueue2);
|
|
5423
|
+
}
|
|
5424
|
+
return res;
|
|
5420
5425
|
};
|
|
5421
|
-
const setPreviousStep2 = () => {
|
|
5422
|
-
setStep2({ nextStep: -1, validate: false });
|
|
5426
|
+
const setPreviousStep2 = (callback) => {
|
|
5427
|
+
const res = setStep2({ nextStep: -1, validate: false });
|
|
5428
|
+
if (callback) {
|
|
5429
|
+
callback(res, stepHistory2, stepQueue2);
|
|
5430
|
+
}
|
|
5431
|
+
return res;
|
|
5423
5432
|
};
|
|
5424
5433
|
const stepPlugin2 = (node) => {
|
|
5425
5434
|
if (node.props.type == "form") {
|
|
@@ -5459,7 +5468,7 @@ function useSteps() {
|
|
|
5459
5468
|
}
|
|
5460
5469
|
let { prepopPlugin } = usePrepop();
|
|
5461
5470
|
let { stepPlugin, steps, stepHistory, stepQueue, enabledSteps, defaultOrder, activeStep, firstStep, lastStep, setStep, setNextStep, setPreviousStep } = useSteps();
|
|
5462
|
-
const urlParams = new URLSearchParams(window.location.search);
|
|
5471
|
+
const urlParams$1 = new URLSearchParams(window.location.search);
|
|
5463
5472
|
const dataDefaults = {
|
|
5464
5473
|
steps,
|
|
5465
5474
|
activeStep,
|
|
@@ -5470,7 +5479,7 @@ const dataDefaults = {
|
|
|
5470
5479
|
prepopPlugin
|
|
5471
5480
|
],
|
|
5472
5481
|
urlParam: (name, backup = null) => {
|
|
5473
|
-
return urlParams.get(name) || backup;
|
|
5482
|
+
return urlParams$1.get(name) || backup;
|
|
5474
5483
|
},
|
|
5475
5484
|
firstStep: () => {
|
|
5476
5485
|
return firstStep();
|
|
@@ -5478,14 +5487,14 @@ const dataDefaults = {
|
|
|
5478
5487
|
lastStep: () => {
|
|
5479
5488
|
return lastStep();
|
|
5480
5489
|
},
|
|
5481
|
-
setNextStep: (
|
|
5482
|
-
setNextStep();
|
|
5490
|
+
setNextStep: (callback) => () => {
|
|
5491
|
+
return setNextStep(callback);
|
|
5483
5492
|
},
|
|
5484
|
-
setPreviousStep: (
|
|
5485
|
-
setPreviousStep();
|
|
5493
|
+
setPreviousStep: (callback) => () => {
|
|
5494
|
+
return setPreviousStep(callback);
|
|
5486
5495
|
},
|
|
5487
5496
|
setStep: (nextStep, validate2) => () => {
|
|
5488
|
-
setStep({ nextStep, validate: validate2 });
|
|
5497
|
+
return setStep({ nextStep, validate: validate2 });
|
|
5489
5498
|
},
|
|
5490
5499
|
stepIsValid: (stepName) => {
|
|
5491
5500
|
return steps[stepName].valid && steps[stepName].errorCount === 0;
|
|
@@ -5526,7 +5535,7 @@ const dataDefaults = {
|
|
|
5526
5535
|
abort = handleSubmitError(err, node);
|
|
5527
5536
|
}
|
|
5528
5537
|
if (abort) {
|
|
5529
|
-
return;
|
|
5538
|
+
return false;
|
|
5530
5539
|
}
|
|
5531
5540
|
if (redirectUrl instanceof Function) {
|
|
5532
5541
|
redirectUrl = redirectUrl(formData, node);
|
|
@@ -5537,6 +5546,7 @@ const dataDefaults = {
|
|
|
5537
5546
|
}
|
|
5538
5547
|
redirect(redirectUrl);
|
|
5539
5548
|
}
|
|
5549
|
+
return true;
|
|
5540
5550
|
},
|
|
5541
5551
|
stringify: (value) => JSON.stringify(value, null, 2)
|
|
5542
5552
|
};
|
|
@@ -5846,7 +5856,7 @@ function getAt(obj, addr) {
|
|
|
5846
5856
|
function undefine(value) {
|
|
5847
5857
|
return value !== void 0 && value !== "false" && value !== false ? true : void 0;
|
|
5848
5858
|
}
|
|
5849
|
-
function init(obj) {
|
|
5859
|
+
function init$1(obj) {
|
|
5850
5860
|
return !Object.isFrozen(obj) ? Object.defineProperty(obj, "__init", {
|
|
5851
5861
|
enumerable: false,
|
|
5852
5862
|
value: true
|
|
@@ -6366,7 +6376,7 @@ function reset(id, resetTo) {
|
|
|
6366
6376
|
node.input(cloneAny(resetTo) || initial(node), false);
|
|
6367
6377
|
node.walk((child) => child.input(initial(child), false));
|
|
6368
6378
|
const finalInit = initial(node);
|
|
6369
|
-
node.input(typeof finalInit === "object" ? cloneAny(resetTo) || init(finalInit) : finalInit, false);
|
|
6379
|
+
node.input(typeof finalInit === "object" ? cloneAny(resetTo) || init$1(finalInit) : finalInit, false);
|
|
6370
6380
|
node._e.play(node);
|
|
6371
6381
|
clearState(node);
|
|
6372
6382
|
node.emit("reset", node);
|
|
@@ -6458,9 +6468,9 @@ function createName(options2) {
|
|
|
6458
6468
|
}
|
|
6459
6469
|
function createValue(options2) {
|
|
6460
6470
|
if (options2.type === "group") {
|
|
6461
|
-
return init(options2.value && typeof options2.value === "object" && !Array.isArray(options2.value) ? options2.value : {});
|
|
6471
|
+
return init$1(options2.value && typeof options2.value === "object" && !Array.isArray(options2.value) ? options2.value : {});
|
|
6462
6472
|
} else if (options2.type === "list") {
|
|
6463
|
-
return init(Array.isArray(options2.value) ? options2.value : []);
|
|
6473
|
+
return init$1(Array.isArray(options2.value) ? options2.value : []);
|
|
6464
6474
|
}
|
|
6465
6475
|
return options2.value === null ? "" : options2.value;
|
|
6466
6476
|
}
|
|
@@ -6521,7 +6531,7 @@ function hydrate(node, context) {
|
|
|
6521
6531
|
if (typeof _value !== "object")
|
|
6522
6532
|
return;
|
|
6523
6533
|
if (child.name in _value) {
|
|
6524
|
-
const childValue = child.type !== "input" || _value[child.name] && typeof _value[child.name] === "object" ? init(_value[child.name]) : _value[child.name];
|
|
6534
|
+
const childValue = child.type !== "input" || _value[child.name] && typeof _value[child.name] === "object" ? init$1(_value[child.name]) : _value[child.name];
|
|
6525
6535
|
child.input(childValue, false);
|
|
6526
6536
|
} else {
|
|
6527
6537
|
if (node.type !== "list" || typeof child.name === "number") {
|
|
@@ -6608,7 +6618,7 @@ function addProps(node, context, props2) {
|
|
|
6608
6618
|
}
|
|
6609
6619
|
}
|
|
6610
6620
|
const initial = cloneAny(context._value);
|
|
6611
|
-
node.props.initial = node.type !== "input" ? init(initial) : initial;
|
|
6621
|
+
node.props.initial = node.type !== "input" ? init$1(initial) : initial;
|
|
6612
6622
|
node.props._emit = true;
|
|
6613
6623
|
node.props.attrs = attrs;
|
|
6614
6624
|
if (node.props.definition) {
|
|
@@ -10118,7 +10128,7 @@ const vueBindings = function vueBindings2(node) {
|
|
|
10118
10128
|
return messages3;
|
|
10119
10129
|
}, {}));
|
|
10120
10130
|
const cachedClasses = reactive({});
|
|
10121
|
-
const
|
|
10131
|
+
const classes = new Proxy(cachedClasses, {
|
|
10122
10132
|
get(...args) {
|
|
10123
10133
|
const [target, property] = args;
|
|
10124
10134
|
let className = Reflect.get(...args);
|
|
@@ -10192,7 +10202,7 @@ const vueBindings = function vueBindings2(node) {
|
|
|
10192
10202
|
type: node.props.type,
|
|
10193
10203
|
ui,
|
|
10194
10204
|
value,
|
|
10195
|
-
classes
|
|
10205
|
+
classes
|
|
10196
10206
|
});
|
|
10197
10207
|
node.on("created", () => {
|
|
10198
10208
|
if (!eq(context.value, node.value)) {
|
|
@@ -10337,16 +10347,16 @@ var _default = _createPlugin.default;
|
|
|
10337
10347
|
createPlugin$3.default = _default;
|
|
10338
10348
|
let createPlugin = createPlugin$3;
|
|
10339
10349
|
var plugin = (createPlugin.__esModule ? createPlugin : { default: createPlugin }).default;
|
|
10340
|
-
function generateClasses(
|
|
10350
|
+
function generateClasses(classes) {
|
|
10341
10351
|
const classesBySectionKey = {};
|
|
10342
|
-
Object.keys(
|
|
10343
|
-
Object.keys(
|
|
10352
|
+
Object.keys(classes).forEach((type) => {
|
|
10353
|
+
Object.keys(classes[type]).forEach((sectionKey) => {
|
|
10344
10354
|
if (!classesBySectionKey[sectionKey]) {
|
|
10345
10355
|
classesBySectionKey[sectionKey] = {
|
|
10346
|
-
[type]:
|
|
10356
|
+
[type]: classes[type][sectionKey]
|
|
10347
10357
|
};
|
|
10348
10358
|
} else {
|
|
10349
|
-
classesBySectionKey[sectionKey][type] =
|
|
10359
|
+
classesBySectionKey[sectionKey][type] = classes[type][sectionKey];
|
|
10350
10360
|
}
|
|
10351
10361
|
});
|
|
10352
10362
|
});
|
|
@@ -10621,6 +10631,22 @@ function F(t2, o2, e2) {
|
|
|
10621
10631
|
return { location: t2, current: o2, previous: e2 };
|
|
10622
10632
|
}
|
|
10623
10633
|
const EXPERIMENT_KEY = "__form_experiments";
|
|
10634
|
+
const urlParams = new URLSearchParams(window.location.search);
|
|
10635
|
+
const DEBUG = urlParams.get("fdbg");
|
|
10636
|
+
function dbg() {
|
|
10637
|
+
if (DEBUG != 1)
|
|
10638
|
+
return;
|
|
10639
|
+
console.debug(...arguments);
|
|
10640
|
+
}
|
|
10641
|
+
function rollbar(type, msg) {
|
|
10642
|
+
if (window.Rollbar) {
|
|
10643
|
+
try {
|
|
10644
|
+
window.Rollbar[type](msg);
|
|
10645
|
+
} catch (err) {
|
|
10646
|
+
console.warn("error calling rollbar:", err);
|
|
10647
|
+
}
|
|
10648
|
+
}
|
|
10649
|
+
}
|
|
10624
10650
|
function chooseVariant(exp) {
|
|
10625
10651
|
let variant = null, active = {}, fromCache = false;
|
|
10626
10652
|
active = C(EXPERIMENT_KEY) || {};
|
|
@@ -10633,14 +10659,14 @@ function chooseVariant(exp) {
|
|
|
10633
10659
|
active[exp.name] = variant;
|
|
10634
10660
|
L(EXPERIMENT_KEY, active);
|
|
10635
10661
|
}
|
|
10636
|
-
|
|
10662
|
+
dbg("Chose variant:", variant, "fromCache:", fromCache);
|
|
10637
10663
|
return { variant, fromCache };
|
|
10638
10664
|
}
|
|
10639
10665
|
async function schemaFromUrl(url3) {
|
|
10640
|
-
|
|
10666
|
+
dbg("Fetching:", url3);
|
|
10641
10667
|
const res = await fetch(url3);
|
|
10642
10668
|
const schemaObj = await res.json();
|
|
10643
|
-
|
|
10669
|
+
dbg("Got schema:", schemaObj);
|
|
10644
10670
|
return schemaObj;
|
|
10645
10671
|
}
|
|
10646
10672
|
const flattenObj = (obj) => {
|
|
@@ -10672,65 +10698,94 @@ function prepData(formData) {
|
|
|
10672
10698
|
};
|
|
10673
10699
|
return data;
|
|
10674
10700
|
}
|
|
10701
|
+
const fireStepEvent = (formNode) => (stepResult, stepHistory2, stepQueue2) => {
|
|
10702
|
+
if (!stepResult) {
|
|
10703
|
+
return;
|
|
10704
|
+
}
|
|
10705
|
+
if (formNode.id) {
|
|
10706
|
+
const form2 = document.getElementById(formNode.id);
|
|
10707
|
+
if (form2)
|
|
10708
|
+
form2.scrollIntoView();
|
|
10709
|
+
}
|
|
10710
|
+
const form_id = formNode.attrs.formId || window.location.hostname + "-" + formNode.id;
|
|
10711
|
+
if (typeof window._analytics !== "undefined") {
|
|
10712
|
+
try {
|
|
10713
|
+
window._analytics.track("form-step", {
|
|
10714
|
+
"form_source": "formkit",
|
|
10715
|
+
"form_id": form_id,
|
|
10716
|
+
"step_name": stepHistory2[stepHistory2.length - 1],
|
|
10717
|
+
"step_count": stepHistory2.length
|
|
10718
|
+
}, {
|
|
10719
|
+
plugins: {
|
|
10720
|
+
"google-tag-manager": false
|
|
10721
|
+
}
|
|
10722
|
+
});
|
|
10723
|
+
} catch (err) {
|
|
10724
|
+
const msg = "failed to fire step event: " + err.toString();
|
|
10725
|
+
console.warn(msg);
|
|
10726
|
+
rollbar("warning", msg);
|
|
10727
|
+
}
|
|
10728
|
+
}
|
|
10729
|
+
};
|
|
10675
10730
|
const textClassification = {
|
|
10676
|
-
label: "block mb-1 font-bold text-sm formkit-invalid:text-red-500",
|
|
10731
|
+
label: "t-block t-mb-1 t-font-bold t-text-sm formkit-invalid:t-text-red-500",
|
|
10677
10732
|
inner: `
|
|
10678
|
-
max-w-lg
|
|
10679
|
-
border
|
|
10680
|
-
border-gray-400
|
|
10681
|
-
formkit-invalid:border-red-500
|
|
10682
|
-
rounded-lg mb-1
|
|
10683
|
-
overflow-hidden
|
|
10684
|
-
focus-within:border-blue-500
|
|
10733
|
+
t-max-w-lg
|
|
10734
|
+
t-border
|
|
10735
|
+
t-border-gray-400
|
|
10736
|
+
formkit-invalid:t-border-red-500
|
|
10737
|
+
t-rounded-lg t-mb-1
|
|
10738
|
+
t-overflow-hidden
|
|
10739
|
+
focus-within:t-border-blue-500
|
|
10685
10740
|
`,
|
|
10686
|
-
input: "w-full h-10 px-3 border-none text-base text-gray-700 placeholder-gray-400"
|
|
10741
|
+
input: "t-w-full t-h-10 t-px-3 t-border-none t-text-base t-text-gray-700 t-placeholder-gray-400"
|
|
10687
10742
|
};
|
|
10688
10743
|
const boxClassification = {
|
|
10689
|
-
fieldset: "max-w-md border border-gray-400 rounded-md px-2 pb-1",
|
|
10690
|
-
legend: "font-bold text-sm",
|
|
10691
|
-
wrapper: "flex items-center mb-1 cursor-pointer",
|
|
10692
|
-
help: "mb-2",
|
|
10693
|
-
input: "form-check-input appearance-none h-5 w-5 mr-2 border border-gray-500 rounded-sm bg-white checked:bg-blue-500 focus:outline-none focus:ring-0 transition duration-100",
|
|
10694
|
-
label: "text-sm text-gray-700"
|
|
10744
|
+
fieldset: "t-max-w-md t-border t-border-gray-400 t-rounded-md t-px-2 t-pb-1",
|
|
10745
|
+
legend: "t-font-bold t-text-sm",
|
|
10746
|
+
wrapper: "t-flex t-items-center t-mb-1 t-cursor-pointer",
|
|
10747
|
+
help: "t-mb-2",
|
|
10748
|
+
input: "t-form-check-input t-appearance-none t-h-5 t-w-5 t-mr-2 t-border t-border-gray-500 t-rounded-sm t-bg-white checked:t-bg-blue-500 focus:t-outline-none focus:t-ring-0 t-transition t-duration-100",
|
|
10749
|
+
label: "t-text-sm t-text-gray-700"
|
|
10695
10750
|
};
|
|
10696
10751
|
const buttonClassification = {
|
|
10697
|
-
wrapper: "mb-1",
|
|
10698
|
-
input: "bg-red-500 hover:bg-
|
|
10699
|
-
outer: "mb-0"
|
|
10752
|
+
wrapper: "t-mb-1",
|
|
10753
|
+
input: "t-bg-red-500 hover:t-bg-red-600 t-text-white t-text-lg t-font-normal t-py-4 t-px-7 sm:t-px-10 t-rounded",
|
|
10754
|
+
outer: "t-mb-0"
|
|
10700
10755
|
};
|
|
10701
10756
|
var theme = {
|
|
10702
10757
|
global: {
|
|
10703
|
-
outer: "mb-5 formkit-disabled:opacity-50",
|
|
10704
|
-
help: "text-xs text-gray-500",
|
|
10705
|
-
messages: "list-none p-0 mt-1 mb-0",
|
|
10706
|
-
message: "text-red-500 mb-1 text-xs"
|
|
10758
|
+
outer: "t-mb-5 formkit-disabled:t-opacity-50",
|
|
10759
|
+
help: "t-text-xs t-text-gray-500",
|
|
10760
|
+
messages: "t-list-none t-p-0 t-mt-1 t-mb-0",
|
|
10761
|
+
message: "t-text-red-500 t-mb-1 t-text-xs"
|
|
10707
10762
|
},
|
|
10708
10763
|
button: buttonClassification,
|
|
10709
10764
|
color: {
|
|
10710
|
-
label: "block mb-1 font-bold text-sm",
|
|
10711
|
-
input: "w-16 h-8 appearance-none cursor-pointer border border-gray-300 rounded-md mb-2 p-1"
|
|
10765
|
+
label: "t-block t-mb-1 t-font-bold t-text-sm",
|
|
10766
|
+
input: "t-w-16 t-h-8 t-appearance-none t-cursor-pointer t-border t-border-gray-300 t-rounded-md t-mb-2 t-p-1"
|
|
10712
10767
|
},
|
|
10713
10768
|
date: textClassification,
|
|
10714
10769
|
"datetime-local": textClassification,
|
|
10715
10770
|
checkbox: boxClassification,
|
|
10716
10771
|
email: textClassification,
|
|
10717
10772
|
file: {
|
|
10718
|
-
label: "block mb-1 font-bold text-sm",
|
|
10719
|
-
inner: "max-w-md cursor-pointer",
|
|
10720
|
-
input: "text-gray-600 text-sm mb-1 file:mr-4 file:py-2 file:px-4 file:rounded-full file:border-0 file:text-sm file:bg-blue-500 file:text-white hover:file:bg-blue-600",
|
|
10721
|
-
noFiles: "block text-gray-800 text-sm mb-1",
|
|
10722
|
-
fileItem: "block flex text-gray-800 text-sm mb-1",
|
|
10723
|
-
removeFiles: "ml-auto text-blue-500 text-sm"
|
|
10773
|
+
label: "t-block t-mb-1 t-font-bold t-text-sm",
|
|
10774
|
+
inner: "t-max-w-md t-cursor-pointer",
|
|
10775
|
+
input: "t-text-gray-600 t-text-sm t-mb-1 file:t-mr-4 file:t-py-2 file:t-px-4 file:t-rounded-full file:t-border-0 file:t-text-sm file:t-bg-blue-500 file:t-text-white hover:file:t-bg-blue-600",
|
|
10776
|
+
noFiles: "t-block t-text-gray-800 t-text-sm t-mb-1",
|
|
10777
|
+
fileItem: "t-block t-flex t-text-gray-800 t-text-sm mb-1",
|
|
10778
|
+
removeFiles: "t-ml-auto t-text-blue-500 t-text-sm"
|
|
10724
10779
|
},
|
|
10725
10780
|
month: textClassification,
|
|
10726
10781
|
number: textClassification,
|
|
10727
10782
|
password: textClassification,
|
|
10728
10783
|
radio: __spreadProps(__spreadValues({}, boxClassification), {
|
|
10729
|
-
input: boxClassification.input.replace("rounded-sm", "rounded-full")
|
|
10784
|
+
input: boxClassification.input.replace("t-rounded-sm", "t-rounded-full")
|
|
10730
10785
|
}),
|
|
10731
10786
|
range: {
|
|
10732
|
-
inner: "max-w-md",
|
|
10733
|
-
input: "form-range appearance-none w-full h-2 p-0 bg-gray-200 rounded-full focus:outline-none focus:ring-0 focus:shadow-none"
|
|
10787
|
+
inner: "t-max-w-md",
|
|
10788
|
+
input: "t-form-range t-appearance-none t-w-full t-h-2 t-p-0 t-bg-gray-200 t-rounded-full focus:t-outline-none focus:t-ring-0 focus:t-shadow-none"
|
|
10734
10789
|
},
|
|
10735
10790
|
search: textClassification,
|
|
10736
10791
|
select: textClassification,
|
|
@@ -10738,44 +10793,61 @@ var theme = {
|
|
|
10738
10793
|
tel: textClassification,
|
|
10739
10794
|
text: textClassification,
|
|
10740
10795
|
textarea: __spreadProps(__spreadValues({}, textClassification), {
|
|
10741
|
-
input: "block w-full h-32 px-3 pt-1 border-none text-base text-gray-700 placeholder-gray-400 placeholder:text-sm focus:shadow-outline"
|
|
10796
|
+
input: "t-block t-w-full t-h-32 t-px-3 t-pt-1 t-border-none t-text-base t-text-gray-700 t-placeholder-gray-400 placeholder:t-text-sm focus:t-shadow-outline"
|
|
10742
10797
|
}),
|
|
10743
10798
|
time: textClassification,
|
|
10744
10799
|
url: textClassification,
|
|
10745
10800
|
week: textClassification
|
|
10746
10801
|
};
|
|
10747
10802
|
var index = "";
|
|
10748
|
-
const classes = generateClasses(theme);
|
|
10749
|
-
const forms = window.bhlFormDefs || [];
|
|
10750
10803
|
const apps = {};
|
|
10751
|
-
|
|
10752
|
-
|
|
10753
|
-
|
|
10754
|
-
|
|
10755
|
-
|
|
10756
|
-
|
|
10757
|
-
|
|
10758
|
-
|
|
10759
|
-
|
|
10760
|
-
|
|
10761
|
-
|
|
10762
|
-
if (form2.
|
|
10763
|
-
|
|
10764
|
-
|
|
10765
|
-
|
|
10766
|
-
|
|
10767
|
-
|
|
10768
|
-
|
|
10769
|
-
|
|
10770
|
-
|
|
10771
|
-
|
|
10772
|
-
|
|
10773
|
-
|
|
10774
|
-
|
|
10775
|
-
|
|
10776
|
-
|
|
10777
|
-
|
|
10778
|
-
|
|
10779
|
-
}
|
|
10780
|
-
|
|
10781
|
-
|
|
10804
|
+
const init = () => {
|
|
10805
|
+
const classes = generateClasses(theme);
|
|
10806
|
+
const forms = window.bhlFormDefs || [];
|
|
10807
|
+
forms.forEach(async function(form2) {
|
|
10808
|
+
dbg("Mounting form:", form2);
|
|
10809
|
+
if (form2.schema && form2.experiment) {
|
|
10810
|
+
throw Error("Only one of schema and experiment allowed");
|
|
10811
|
+
}
|
|
10812
|
+
let schema;
|
|
10813
|
+
if (form2.schema) {
|
|
10814
|
+
schema = form2.schema;
|
|
10815
|
+
} else if (form2.experiment) {
|
|
10816
|
+
const res = chooseVariant(form2.experiment);
|
|
10817
|
+
schema = res.variant.schema;
|
|
10818
|
+
if (form2.experimentCallback) {
|
|
10819
|
+
experimentCallback(form2, res.variant, res.fromCache);
|
|
10820
|
+
}
|
|
10821
|
+
}
|
|
10822
|
+
let schemaObj = schema;
|
|
10823
|
+
if (typeof schema === "string") {
|
|
10824
|
+
schemaObj = await schemaFromUrl(schema);
|
|
10825
|
+
}
|
|
10826
|
+
const data = form2.data || {};
|
|
10827
|
+
data.prepData = data.prepData || prepData;
|
|
10828
|
+
data.fireStepEvent = data.fireStepEvent || fireStepEvent;
|
|
10829
|
+
const app = createApp(_sfc_main, { schema: schemaObj, data }).use(plugin$1, defaultConfig({
|
|
10830
|
+
config: {
|
|
10831
|
+
classes
|
|
10832
|
+
}
|
|
10833
|
+
}));
|
|
10834
|
+
app.mount("#" + form2.target);
|
|
10835
|
+
apps[form2.target] = app;
|
|
10836
|
+
});
|
|
10837
|
+
dbg("Apps:", apps);
|
|
10838
|
+
};
|
|
10839
|
+
const initStrategy = window.bhlFormsInitStrategy || "immediate";
|
|
10840
|
+
if (!initStrategy || initStrategy === "immediate") {
|
|
10841
|
+
dbg("immediate bhlForms init()");
|
|
10842
|
+
init();
|
|
10843
|
+
} else if (initStrategy === "DOMContentLoaded") {
|
|
10844
|
+
window.addEventListener("DOMContentLoaded", function(event) {
|
|
10845
|
+
dbg("DOMContentLoaded bhlForms init()");
|
|
10846
|
+
init();
|
|
10847
|
+
});
|
|
10848
|
+
} else if (initStrategy === "manual") {
|
|
10849
|
+
dbg("manual bhlForms init()");
|
|
10850
|
+
} else {
|
|
10851
|
+
throw Error("Invalid bhlFormsInitStrategy: " + initStrategy);
|
|
10852
|
+
}
|
|
10853
|
+
export { apps as bhlForms, init as bhlFormsInit };
|