@businessdash/sdk 0.9.80 → 0.9.90
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/README.md +133 -949
- package/assets/{biab-sw.js → bd-sw.js} +2 -2
- package/dist/account-core/index.d.ts +1 -1
- package/dist/account-core/index.d.ts.map +1 -1
- package/dist/adapters-revalidate.d.ts +2 -2
- package/dist/adapters-revalidate.js +2 -2
- package/dist/adapters-revalidate.js.map +1 -1
- package/dist/analytics-core.d.ts +6 -6
- package/dist/analytics-core.d.ts.map +1 -1
- package/dist/analytics-core.js +4 -4
- package/dist/analytics-core.js.map +1 -1
- package/dist/analytics-server.d.ts +6 -6
- package/dist/analytics-server.d.ts.map +1 -1
- package/dist/analytics-server.js +5 -5
- package/dist/auth-handler.d.ts +14 -14
- package/dist/auth-handler.d.ts.map +1 -1
- package/dist/auth-handler.js +16 -16
- package/dist/auth-handler.js.map +1 -1
- package/dist/auth-links.d.ts +2 -2
- package/dist/auth-links.d.ts.map +1 -1
- package/dist/auth-links.js +2 -2
- package/dist/auth-links.js.map +1 -1
- package/dist/{biab-forms.css → bd-forms.css} +158 -158
- package/dist/cli.d.ts +4 -4
- package/dist/cli.js +78 -78
- package/dist/cli.js.map +1 -1
- package/dist/client.d.ts +158 -147
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +156 -137
- package/dist/client.js.map +1 -1
- package/dist/consent-core/index.cjs +2 -2
- package/dist/consent-core/index.d.ts +2 -2
- package/dist/consent-core/index.d.ts.map +1 -1
- package/dist/consent-core/index.js +10 -8
- package/dist/consent-core/index.js.map +1 -1
- package/dist/contracts.d.ts +411 -52
- package/dist/contracts.d.ts.map +1 -1
- package/dist/contracts.js +89 -15
- package/dist/contracts.js.map +1 -1
- package/dist/data-model-schema.d.ts +15 -15
- package/dist/data-model-schema.d.ts.map +1 -1
- package/dist/data-model-schema.js +19 -17
- package/dist/data-model-schema.js.map +1 -1
- package/dist/distribution.d.ts +5 -5
- package/dist/distribution.d.ts.map +1 -1
- package/dist/distribution.js +4 -4
- package/dist/element.d.ts +36 -36
- package/dist/element.d.ts.map +1 -1
- package/dist/element.js +43 -43
- package/dist/element.js.map +1 -1
- package/dist/embed-protocol.d.ts +11 -11
- package/dist/embed-protocol.d.ts.map +1 -1
- package/dist/embed-protocol.js +1 -1
- package/dist/embed-protocol.js.map +1 -1
- package/dist/errors.d.ts +15 -15
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +18 -18
- package/dist/errors.js.map +1 -1
- package/dist/forms-core/autocomplete.d.ts +3 -3
- package/dist/forms-core/autocomplete.d.ts.map +1 -1
- package/dist/forms-core/autocomplete.js +2 -2
- package/dist/forms-core/controller.d.ts +10 -10
- package/dist/forms-core/controller.d.ts.map +1 -1
- package/dist/forms-core/controller.js +4 -4
- package/dist/forms-core/controller.js.map +1 -1
- package/dist/forms-core/elements.d.ts +4 -4
- package/dist/forms-core/elements.d.ts.map +1 -1
- package/dist/forms-core/elements.js +7 -7
- package/dist/forms-core/elements.js.map +1 -1
- package/dist/forms-core/formula.d.ts +1 -1
- package/dist/forms-core/formula.js +1 -1
- package/dist/forms-core/index.d.ts +6 -6
- package/dist/forms-core/index.d.ts.map +1 -1
- package/dist/forms-core/index.js +5 -5
- package/dist/forms-core/index.js.map +1 -1
- package/dist/forms-core/units.d.ts +1 -1
- package/dist/forms-core/units.js +1 -1
- package/dist/forms-core/us-states.d.ts +1 -1
- package/dist/forms-core/us-states.js +1 -1
- package/dist/forms-core/validation.d.ts +12 -3
- package/dist/forms-core/validation.d.ts.map +1 -1
- package/dist/forms-core/validation.js +152 -17
- package/dist/forms-core/validation.js.map +1 -1
- package/dist/forms.d.ts +2 -2
- package/dist/forms.d.ts.map +1 -1
- package/dist/forms.js +2 -2
- package/dist/forms.js.map +1 -1
- package/dist/framework-support.js +1 -1
- package/dist/framework-support.js.map +1 -1
- package/dist/gallery-types.d.ts +1 -1
- package/dist/graphql.d.ts +3 -3
- package/dist/graphql.d.ts.map +1 -1
- package/dist/graphql.js +3 -3
- package/dist/graphql.js.map +1 -1
- package/dist/index.cjs +351 -272
- package/dist/index.d.cts +5 -5
- package/dist/index.d.mts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/dist/legal-core/index.cjs +8 -8
- package/dist/legal-core/index.d.ts +3 -3
- package/dist/legal-core/index.d.ts.map +1 -1
- package/dist/legal-core/index.js +11 -11
- package/dist/legal-core/index.js.map +1 -1
- package/dist/marketing-core/index.d.ts +51 -1
- package/dist/marketing-core/index.d.ts.map +1 -1
- package/dist/marketing-core/index.js +35 -0
- package/dist/marketing-core/index.js.map +1 -1
- package/dist/marketing-schema.d.ts +9 -9
- package/dist/marketing-schema.d.ts.map +1 -1
- package/dist/marketing-schema.js +1 -1
- package/dist/mcp.d.ts +4 -4
- package/dist/mcp.js +4 -4
- package/dist/native.d.ts +6 -6
- package/dist/native.d.ts.map +1 -1
- package/dist/native.js +4 -4
- package/dist/native.js.map +1 -1
- package/dist/next-revalidate.d.ts +8 -8
- package/dist/next-revalidate.d.ts.map +1 -1
- package/dist/next-revalidate.js +7 -7
- package/dist/next-revalidate.js.map +1 -1
- package/dist/notifications-core/index.d.ts +1 -1
- package/dist/notifications-core/index.js +1 -1
- package/dist/parallel-pages.d.ts +4 -4
- package/dist/parallel-pages.d.ts.map +1 -1
- package/dist/parallel-pages.js +5 -5
- package/dist/parallel-pages.js.map +1 -1
- package/dist/portal-core/index.d.ts +1 -1
- package/dist/portal-core/index.js +1 -1
- package/dist/proxy.d.ts +18 -18
- package/dist/proxy.d.ts.map +1 -1
- package/dist/proxy.js +10 -10
- package/dist/proxy.js.map +1 -1
- package/dist/push-core/index.cjs +6 -2
- package/dist/push-core/index.d.ts +1 -1
- package/dist/push-core/index.d.ts.map +1 -1
- package/dist/push-core/index.js +6 -2
- package/dist/push-core/index.js.map +1 -1
- package/dist/react-analytics.d.ts +14 -14
- package/dist/react-analytics.d.ts.map +1 -1
- package/dist/react-analytics.js +15 -15
- package/dist/react-analytics.js.map +1 -1
- package/dist/react-attribution.d.ts +2 -2
- package/dist/react-attribution.d.ts.map +1 -1
- package/dist/react-attribution.js +1 -1
- package/dist/react-marketing.js +5 -5
- package/dist/react-marketing.js.map +1 -1
- package/dist/react.d.ts +38 -61
- package/dist/react.d.ts.map +1 -1
- package/dist/react.js +247 -261
- package/dist/react.js.map +1 -1
- package/dist/reserved-paths.d.ts +2 -2
- package/dist/reserved-paths.js +3 -3
- package/dist/reserved-paths.js.map +1 -1
- package/dist/revalidate-verify.d.ts +3 -3
- package/dist/revalidate-verify.d.ts.map +1 -1
- package/dist/revalidate-verify.js +1 -1
- package/dist/revalidate-verify.js.map +1 -1
- package/dist/sdk.d.ts +51 -45
- package/dist/sdk.d.ts.map +1 -1
- package/dist/sdk.js +48 -50
- package/dist/sdk.js.map +1 -1
- package/dist/seed-core/index.js +8 -8
- package/dist/seed-core/index.js.map +1 -1
- package/dist/seo-core/blog.d.ts +1 -1
- package/dist/seo-core/blog.js +1 -1
- package/dist/seo-core/blog.js.map +1 -1
- package/dist/seo-core/index.cjs +2 -2
- package/dist/seo-core/index.js +1 -1
- package/dist/seo-core/index.js.map +1 -1
- package/dist/seo.d.ts +1 -1
- package/dist/seo.d.ts.map +1 -1
- package/dist/seo.js +1 -1
- package/dist/seo.js.map +1 -1
- package/dist/sitemap-core/index.cjs +5 -5
- package/dist/sitemap-core/index.d.ts +13 -5
- package/dist/sitemap-core/index.d.ts.map +1 -1
- package/dist/sitemap-core/index.js +4 -4
- package/dist/sitemap-core/index.js.map +1 -1
- package/dist/socials.d.ts +6 -6
- package/dist/socials.d.ts.map +1 -1
- package/dist/socials.js +5 -5
- package/dist/socials.js.map +1 -1
- package/dist/solid-compat.d.ts +1 -1
- package/dist/solid-compat.js +4 -4
- package/dist/solid-compat.js.map +1 -1
- package/dist/store-core/index.d.ts +1 -1
- package/dist/vanilla.d.ts +12 -12
- package/dist/vanilla.d.ts.map +1 -1
- package/dist/vanilla.js +192 -145
- package/dist/vanilla.js.map +1 -1
- package/openapi.json +264 -1
- package/package.json +8 -8
- package/src/account-core/index.ts +1 -1
- package/src/adapters-revalidate.ts +3 -3
- package/src/analytics-core.ts +8 -8
- package/src/analytics-server.ts +6 -6
- package/src/angular/{biab-form.component.ts → bd-form.component.ts} +269 -161
- package/src/angular/headless.ts +12 -12
- package/src/angular/index.ts +9 -9
- package/src/auth-handler.ts +22 -22
- package/src/auth-links.ts +2 -2
- package/src/cli.ts +81 -81
- package/src/client.ts +218 -193
- package/src/consent-core/index.ts +10 -8
- package/src/contracts.ts +99 -15
- package/src/data-model-schema.ts +29 -26
- package/src/distribution.ts +5 -5
- package/src/element.ts +54 -54
- package/src/embed-protocol.ts +14 -14
- package/src/errors.ts +27 -27
- package/src/forms-core/autocomplete.ts +3 -3
- package/src/forms-core/controller.ts +12 -12
- package/src/forms-core/elements.ts +7 -7
- package/src/forms-core/formula.ts +1 -1
- package/src/forms-core/index.ts +8 -8
- package/src/forms-core/units.ts +1 -1
- package/src/forms-core/us-states.ts +1 -1
- package/src/forms-core/validation.ts +158 -14
- package/src/forms.ts +2 -2
- package/src/framework-support.ts +1 -1
- package/src/gallery-types.ts +1 -1
- package/src/graphql.ts +4 -4
- package/src/index.ts +38 -38
- package/src/legal-core/index.ts +12 -12
- package/src/marketing-core/index.ts +62 -0
- package/src/marketing-schema.ts +9 -9
- package/src/mcp.ts +4 -4
- package/src/native.ts +14 -14
- package/src/next-revalidate.ts +10 -10
- package/src/notifications-core/index.ts +1 -1
- package/src/parallel-pages.ts +6 -6
- package/src/portal-core/index.ts +1 -1
- package/src/proxy.ts +28 -28
- package/src/push-core/index.ts +11 -5
- package/src/qwik.tsx +262 -166
- package/src/react-analytics.tsx +17 -17
- package/src/react-attribution.tsx +2 -2
- package/src/react-marketing.tsx +5 -5
- package/src/react.tsx +541 -500
- package/src/reserved-paths.ts +3 -3
- package/src/revalidate-verify.ts +5 -5
- package/src/sdk.ts +131 -101
- package/src/seed-core/index.ts +8 -8
- package/src/seo-core/blog.ts +2 -2
- package/src/seo-core/index.ts +1 -1
- package/src/seo.ts +1 -1
- package/src/sitemap-core/index.ts +17 -9
- package/src/socials.ts +6 -6
- package/src/solid-compat.tsx +5 -5
- package/src/solid-surfaces.tsx +28 -28
- package/src/solid.tsx +264 -175
- package/src/store-core/index.ts +1 -1
- package/src/styles/{biab-forms.css → bd-forms.css} +158 -158
- package/src/svelte/{BiabForm.svelte → BdForm.svelte} +240 -173
- package/src/svelte/context.ts +16 -16
- package/src/svelte/headless.ts +10 -10
- package/src/svelte/index.ts +16 -16
- package/src/vanilla.ts +250 -169
- package/src/vue/{BiabForm.vue → BdForm.vue} +270 -157
- package/src/vue/headless.ts +11 -11
- package/src/vue/index.ts +26 -26
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
/**
|
|
3
|
-
* <
|
|
3
|
+
* <BdForm> — Vue 3 drop-in binding for the headless `@businessdash/sdk/forms`
|
|
4
4
|
* core. Ship mode: SOURCE (.vue). The consumer's Vite/Nuxt toolchain compiles
|
|
5
|
-
* this single-file component;
|
|
5
|
+
* this single-file component; bd does NOT pre-build it.
|
|
6
6
|
*
|
|
7
7
|
* It is a faithful port of the dashboard renderer (`FormPreview.tsx`): the same
|
|
8
8
|
* per-field rendering by `type`, the same `condition_block` / `or_condition`
|
|
9
9
|
* evaluation, the same multi-step ("consecutive") nav + progress bar/steps, the
|
|
10
10
|
* same concurrent-reveal gating, default seeding, and form-settings application
|
|
11
11
|
* (animation, showProgress/progressStyle, showOrgIcon + org icon). Everything
|
|
12
|
-
* renders into LIGHT DOM (no shadow root) using the `
|
|
13
|
-
* `data-
|
|
12
|
+
* renders into LIGHT DOM (no shadow root) using the `bd-*` CSS class +
|
|
13
|
+
* `data-bd-*` attribute conventions, so a consumer's own CSS cascades 1:1
|
|
14
14
|
* with the dashboard preview.
|
|
15
15
|
*
|
|
16
16
|
* All runtime state + behaviour lives in `createFormController` (values,
|
|
@@ -27,12 +27,12 @@
|
|
|
27
27
|
* client). `onSuccess` / `onError` still fire.
|
|
28
28
|
*
|
|
29
29
|
* The recursive field-tree renderer is declared as a local render-function
|
|
30
|
-
* component (`
|
|
30
|
+
* component (`BdFieldTree`) right here in `<script setup>` so the whole
|
|
31
31
|
* binding stays ONE self-contained `.vue` file (the SOURCE ship-mode contract)
|
|
32
32
|
* while still supporting self-reference for nested groups / conditions.
|
|
33
33
|
*/
|
|
34
34
|
|
|
35
|
-
import type {
|
|
35
|
+
import type { BdClient } from "@businessdash/sdk";
|
|
36
36
|
import {
|
|
37
37
|
concurrentRevealCount,
|
|
38
38
|
createFormController,
|
|
@@ -68,7 +68,7 @@ import {
|
|
|
68
68
|
watch,
|
|
69
69
|
} from "vue";
|
|
70
70
|
|
|
71
|
-
import {
|
|
71
|
+
import { BD_CLIENT_KEY } from "./index";
|
|
72
72
|
|
|
73
73
|
// ─── Props / emits ────────────────────────────────────────────────────────────
|
|
74
74
|
|
|
@@ -84,10 +84,10 @@ const props = withDefaults(
|
|
|
84
84
|
* given without a `client`, pair it with `onSubmit` to post the payload
|
|
85
85
|
* through your own server proxy. */
|
|
86
86
|
schema?: FormSchema;
|
|
87
|
-
/** SDK client. Optional — falls back to a `provide(
|
|
88
|
-
* `<
|
|
87
|
+
/** SDK client. Optional — falls back to a `provide(BD_CLIENT_KEY, …)` /
|
|
88
|
+
* `<BdProvider>` ancestor. Browser-only: never pass a server-bound key in
|
|
89
89
|
* a client-rendered tree (use `schema` + `onSubmit` instead). */
|
|
90
|
-
client?:
|
|
90
|
+
client?: BdClient;
|
|
91
91
|
/** Submit-options merged into every submit (the call's own options win). */
|
|
92
92
|
submitOptions?: FormSubmitOptions;
|
|
93
93
|
/** Validate on the server, store nothing (no side effects). */
|
|
@@ -108,7 +108,7 @@ const props = withDefaults(
|
|
|
108
108
|
payload: FormData,
|
|
109
109
|
opts: FormSubmitOptions,
|
|
110
110
|
) => void | FormSubmitResult | Promise<void | FormSubmitResult>;
|
|
111
|
-
/** Class(es) merged onto the root `.
|
|
111
|
+
/** Class(es) merged onto the root `.bd-form` element. */
|
|
112
112
|
class?: unknown;
|
|
113
113
|
/** Alias for `class` (cross-framework parity). */
|
|
114
114
|
className?: string;
|
|
@@ -141,8 +141,8 @@ const emit = defineEmits<{
|
|
|
141
141
|
|
|
142
142
|
// ─── Resolve the client (prop → injected provider) ──────────────────────────────
|
|
143
143
|
|
|
144
|
-
const injectedClient = inject(
|
|
145
|
-
const resolvedClient = computed<
|
|
144
|
+
const injectedClient = inject(BD_CLIENT_KEY, null);
|
|
145
|
+
const resolvedClient = computed<BdClient | undefined>(
|
|
146
146
|
() => props.client ?? injectedClient ?? undefined,
|
|
147
147
|
);
|
|
148
148
|
|
|
@@ -378,13 +378,13 @@ const entranceClass = computed(() => {
|
|
|
378
378
|
const fwd = snap.value.forward;
|
|
379
379
|
switch (a) {
|
|
380
380
|
case "fade":
|
|
381
|
-
return "
|
|
381
|
+
return "bd-anim bd-anim--fade";
|
|
382
382
|
case "scale":
|
|
383
|
-
return "
|
|
383
|
+
return "bd-anim bd-anim--scale";
|
|
384
384
|
case "slide":
|
|
385
385
|
return fwd
|
|
386
|
-
? "
|
|
387
|
-
: "
|
|
386
|
+
? "bd-anim bd-anim--slide-fwd"
|
|
387
|
+
: "bd-anim bd-anim--slide-back";
|
|
388
388
|
default:
|
|
389
389
|
return "";
|
|
390
390
|
}
|
|
@@ -399,7 +399,7 @@ function stepTitle(step: FormCoreField[], i: number): string {
|
|
|
399
399
|
);
|
|
400
400
|
}
|
|
401
401
|
|
|
402
|
-
const rootClass = computed(() => ["
|
|
402
|
+
const rootClass = computed(() => ["bd-form", props.className, props.class]);
|
|
403
403
|
const submitDisabled = computed(
|
|
404
404
|
() => snap.value.submitting || snap.value.uploading,
|
|
405
405
|
);
|
|
@@ -453,7 +453,7 @@ async function loadIconIndex(): Promise<void> {
|
|
|
453
453
|
/** Which side of an `image_input` the visitor is on, per field id. */
|
|
454
454
|
const imageModes = ref<Record<string, "upload" | "url">>({});
|
|
455
455
|
|
|
456
|
-
// ───
|
|
456
|
+
// ─── BdFieldTree — recursive render-function component (FormPreview port) ──────
|
|
457
457
|
|
|
458
458
|
const STATIC_NO_LABEL = new Set(["title", "subtitle", "separator", "richtext"]);
|
|
459
459
|
|
|
@@ -462,8 +462,8 @@ function cssKey(f: FormCoreField): string {
|
|
|
462
462
|
return explicit || f.key || f.id;
|
|
463
463
|
}
|
|
464
464
|
|
|
465
|
-
const
|
|
466
|
-
name: "
|
|
465
|
+
const BdFieldTree = defineComponent({
|
|
466
|
+
name: "BdFieldTree",
|
|
467
467
|
props: {
|
|
468
468
|
nodes: { type: Array as PropType<FormCoreField[]>, required: true },
|
|
469
469
|
flat: { type: Boolean, default: false },
|
|
@@ -481,15 +481,15 @@ const BiabFieldTree = defineComponent({
|
|
|
481
481
|
|
|
482
482
|
switch (f.type) {
|
|
483
483
|
case "title":
|
|
484
|
-
return h("h2", { class: "
|
|
484
|
+
return h("h2", { class: "bd-field__title" }, f.label || "");
|
|
485
485
|
case "subtitle":
|
|
486
|
-
return h("h3", { class: "
|
|
486
|
+
return h("h3", { class: "bd-field__subtitle" }, f.label || "");
|
|
487
487
|
case "separator":
|
|
488
|
-
return h("hr", { class: "
|
|
488
|
+
return h("hr", { class: "bd-field__separator" });
|
|
489
489
|
case "richtext":
|
|
490
490
|
return f.content
|
|
491
491
|
? h("div", {
|
|
492
|
-
class: "
|
|
492
|
+
class: "bd-field__richtext",
|
|
493
493
|
innerHTML: String(f.content),
|
|
494
494
|
})
|
|
495
495
|
: null;
|
|
@@ -505,7 +505,7 @@ const BiabFieldTree = defineComponent({
|
|
|
505
505
|
| undefined) ?? {};
|
|
506
506
|
return cfg.src
|
|
507
507
|
? h("img", {
|
|
508
|
-
class: "
|
|
508
|
+
class: "bd-field__image",
|
|
509
509
|
src: cfg.src,
|
|
510
510
|
alt: cfg.alt || "",
|
|
511
511
|
style: {
|
|
@@ -523,7 +523,7 @@ const BiabFieldTree = defineComponent({
|
|
|
523
523
|
| undefined) ?? {};
|
|
524
524
|
return h("textarea", {
|
|
525
525
|
autocomplete,
|
|
526
|
-
class: "
|
|
526
|
+
class: "bd-textarea bd-field__control",
|
|
527
527
|
value: typeof value === "string" ? value : "",
|
|
528
528
|
placeholder: f.placeholder || "",
|
|
529
529
|
rows: cfg.rows ?? 4,
|
|
@@ -543,12 +543,12 @@ const BiabFieldTree = defineComponent({
|
|
|
543
543
|
(f as { display?: string }).display,
|
|
544
544
|
)
|
|
545
545
|
) {
|
|
546
|
-
const listId = `
|
|
546
|
+
const listId = `bd-list-${f.id}`;
|
|
547
547
|
// A wrapper rather than a fragment: `renderInput` is typed to one
|
|
548
548
|
// VNode, and `<datalist>` renders nothing visually anyway.
|
|
549
|
-
return h("div", { class: "
|
|
549
|
+
return h("div", { class: "bd-combobox-wrap" }, [
|
|
550
550
|
h("input", {
|
|
551
|
-
class: "
|
|
551
|
+
class: "bd-input bd-combobox bd-field__control",
|
|
552
552
|
type: "text",
|
|
553
553
|
list: listId,
|
|
554
554
|
placeholder: f.placeholder || "Search…",
|
|
@@ -566,7 +566,7 @@ const BiabFieldTree = defineComponent({
|
|
|
566
566
|
return h(
|
|
567
567
|
"select",
|
|
568
568
|
{
|
|
569
|
-
class: "
|
|
569
|
+
class: "bd-input bd-field__control",
|
|
570
570
|
value: typeof value === "string" ? value : "",
|
|
571
571
|
onChange: (e: Event) =>
|
|
572
572
|
set((e.target as HTMLSelectElement).value),
|
|
@@ -592,9 +592,9 @@ const BiabFieldTree = defineComponent({
|
|
|
592
592
|
void loadIconIndex();
|
|
593
593
|
}
|
|
594
594
|
const selected = typeof value === "string" ? value : "";
|
|
595
|
-
return h("div", { class: "
|
|
595
|
+
return h("div", { class: "bd-iconselect" }, [
|
|
596
596
|
h("input", {
|
|
597
|
-
class: "
|
|
597
|
+
class: "bd-input bd-iconselect__search",
|
|
598
598
|
type: "text",
|
|
599
599
|
placeholder: f.placeholder || "Search icons…",
|
|
600
600
|
value: iconQuery.value,
|
|
@@ -603,7 +603,7 @@ const BiabFieldTree = defineComponent({
|
|
|
603
603
|
},
|
|
604
604
|
}),
|
|
605
605
|
selected
|
|
606
|
-
? h("span", { class: "
|
|
606
|
+
? h("span", { class: "bd-iconselect__current" }, [
|
|
607
607
|
h("img", {
|
|
608
608
|
src: iconUrl(selected),
|
|
609
609
|
alt: selected,
|
|
@@ -614,7 +614,7 @@ const BiabFieldTree = defineComponent({
|
|
|
614
614
|
"button",
|
|
615
615
|
{
|
|
616
616
|
type: "button",
|
|
617
|
-
class: "
|
|
617
|
+
class: "bd-iconselect__clear",
|
|
618
618
|
onClick: () => set(""),
|
|
619
619
|
},
|
|
620
620
|
"×",
|
|
@@ -623,14 +623,14 @@ const BiabFieldTree = defineComponent({
|
|
|
623
623
|
: null,
|
|
624
624
|
h(
|
|
625
625
|
"div",
|
|
626
|
-
{ class: "
|
|
626
|
+
{ class: "bd-iconselect__grid" },
|
|
627
627
|
filterIconNames(names, iconQuery.value).map((name) =>
|
|
628
628
|
h(
|
|
629
629
|
"button",
|
|
630
630
|
{
|
|
631
631
|
key: name,
|
|
632
632
|
type: "button",
|
|
633
|
-
class: `
|
|
633
|
+
class: `bd-iconselect__item${
|
|
634
634
|
selected === name ? " is-selected" : ""
|
|
635
635
|
}`,
|
|
636
636
|
title: name,
|
|
@@ -667,18 +667,18 @@ const BiabFieldTree = defineComponent({
|
|
|
667
667
|
const sources = cfg.sources ?? "both";
|
|
668
668
|
const url = typeof value === "string" ? value : "";
|
|
669
669
|
const mode = imageModes.value[f.id] ?? "upload";
|
|
670
|
-
return h("div", { class: "
|
|
670
|
+
return h("div", { class: "bd-imageinput" }, [
|
|
671
671
|
sources === "both"
|
|
672
672
|
? h(
|
|
673
673
|
"div",
|
|
674
|
-
{ class: "
|
|
674
|
+
{ class: "bd-imageinput__modes" },
|
|
675
675
|
(["upload", "url"] as const).map((m) =>
|
|
676
676
|
h(
|
|
677
677
|
"button",
|
|
678
678
|
{
|
|
679
679
|
key: m,
|
|
680
680
|
type: "button",
|
|
681
|
-
class: `
|
|
681
|
+
class: `bd-imageinput__mode${
|
|
682
682
|
mode === m ? " is-active" : ""
|
|
683
683
|
}`,
|
|
684
684
|
"aria-pressed": mode === m,
|
|
@@ -696,7 +696,7 @@ const BiabFieldTree = defineComponent({
|
|
|
696
696
|
: null,
|
|
697
697
|
mode === "upload" && sources !== "url"
|
|
698
698
|
? h("input", {
|
|
699
|
-
class: "
|
|
699
|
+
class: "bd-input bd-imageinput__file",
|
|
700
700
|
type: "file",
|
|
701
701
|
accept: (cfg.allowedTypes ?? ["image/*"]).join(","),
|
|
702
702
|
onChange: (e: Event) => {
|
|
@@ -713,7 +713,7 @@ const BiabFieldTree = defineComponent({
|
|
|
713
713
|
},
|
|
714
714
|
})
|
|
715
715
|
: h("input", {
|
|
716
|
-
class: "
|
|
716
|
+
class: "bd-input bd-imageinput__url",
|
|
717
717
|
type: "url",
|
|
718
718
|
placeholder:
|
|
719
719
|
f.placeholder || "https://example.com/image.png",
|
|
@@ -723,7 +723,7 @@ const BiabFieldTree = defineComponent({
|
|
|
723
723
|
}),
|
|
724
724
|
cfg.showPreview !== false && url
|
|
725
725
|
? h("img", {
|
|
726
|
-
class: "
|
|
726
|
+
class: "bd-imageinput__preview",
|
|
727
727
|
src: url,
|
|
728
728
|
alt: "",
|
|
729
729
|
})
|
|
@@ -733,9 +733,9 @@ const BiabFieldTree = defineComponent({
|
|
|
733
733
|
case "radio":
|
|
734
734
|
return h(
|
|
735
735
|
"div",
|
|
736
|
-
{ class: "
|
|
736
|
+
{ class: "bd-field__radio-group" },
|
|
737
737
|
(f.options ?? []).map((opt) =>
|
|
738
|
-
h("label", { key: opt, class: "
|
|
738
|
+
h("label", { key: opt, class: "bd-field__radio" }, [
|
|
739
739
|
h("input", {
|
|
740
740
|
type: "radio",
|
|
741
741
|
name: id,
|
|
@@ -751,9 +751,9 @@ const BiabFieldTree = defineComponent({
|
|
|
751
751
|
const arr = Array.isArray(value) ? (value as string[]) : [];
|
|
752
752
|
return h(
|
|
753
753
|
"div",
|
|
754
|
-
{ class: "
|
|
754
|
+
{ class: "bd-field__checkbox-group" },
|
|
755
755
|
(f.options ?? []).map((opt) =>
|
|
756
|
-
h("label", { key: opt, class: "
|
|
756
|
+
h("label", { key: opt, class: "bd-field__checkbox" }, [
|
|
757
757
|
h("input", {
|
|
758
758
|
type: "checkbox",
|
|
759
759
|
checked: arr.includes(opt),
|
|
@@ -770,7 +770,7 @@ const BiabFieldTree = defineComponent({
|
|
|
770
770
|
);
|
|
771
771
|
}
|
|
772
772
|
case "boolean":
|
|
773
|
-
return h("label", { class: "
|
|
773
|
+
return h("label", { class: "bd-field__switch" }, [
|
|
774
774
|
h("input", {
|
|
775
775
|
type: "checkbox",
|
|
776
776
|
checked: Boolean(value),
|
|
@@ -782,7 +782,7 @@ const BiabFieldTree = defineComponent({
|
|
|
782
782
|
case "date":
|
|
783
783
|
return h("input", {
|
|
784
784
|
type: "date",
|
|
785
|
-
class: "
|
|
785
|
+
class: "bd-input bd-field__control",
|
|
786
786
|
value: typeof value === "string" ? value : "",
|
|
787
787
|
onInput: (e: Event) =>
|
|
788
788
|
set((e.target as HTMLInputElement).value),
|
|
@@ -810,7 +810,7 @@ const BiabFieldTree = defineComponent({
|
|
|
810
810
|
return h(
|
|
811
811
|
"select",
|
|
812
812
|
{
|
|
813
|
-
class: "
|
|
813
|
+
class: "bd-input bd-field__control",
|
|
814
814
|
value: typeof value === "string" ? value : "",
|
|
815
815
|
onChange: (e: Event) =>
|
|
816
816
|
set((e.target as HTMLSelectElement).value),
|
|
@@ -830,16 +830,16 @@ const BiabFieldTree = defineComponent({
|
|
|
830
830
|
const partA = mode === "time_block" ? "start" : "date";
|
|
831
831
|
const partB = mode === "time_block" ? "end" : "time";
|
|
832
832
|
const typeA = mode === "time_block" ? "time" : "date";
|
|
833
|
-
return h("div", { class: "
|
|
833
|
+
return h("div", { class: "bd-field__grid-2" }, [
|
|
834
834
|
h("div", {}, [
|
|
835
835
|
h(
|
|
836
836
|
"label",
|
|
837
|
-
{ class: "
|
|
837
|
+
{ class: "bd-field__sublabel" },
|
|
838
838
|
mode === "time_block" ? "Start" : "Date",
|
|
839
839
|
),
|
|
840
840
|
h("input", {
|
|
841
841
|
type: typeA,
|
|
842
|
-
class: "
|
|
842
|
+
class: "bd-input",
|
|
843
843
|
value: struct[partA] ?? "",
|
|
844
844
|
onInput: (e: Event) =>
|
|
845
845
|
set({
|
|
@@ -851,12 +851,12 @@ const BiabFieldTree = defineComponent({
|
|
|
851
851
|
h("div", {}, [
|
|
852
852
|
h(
|
|
853
853
|
"label",
|
|
854
|
-
{ class: "
|
|
854
|
+
{ class: "bd-field__sublabel" },
|
|
855
855
|
mode === "time_block" ? "End" : "Time",
|
|
856
856
|
),
|
|
857
857
|
h("input", {
|
|
858
858
|
type: "time",
|
|
859
|
-
class: "
|
|
859
|
+
class: "bd-input",
|
|
860
860
|
value: struct[partB] ?? "",
|
|
861
861
|
onInput: (e: Event) =>
|
|
862
862
|
set({
|
|
@@ -872,12 +872,12 @@ const BiabFieldTree = defineComponent({
|
|
|
872
872
|
value && typeof value === "object" && !Array.isArray(value)
|
|
873
873
|
? (value as Record<string, string>)
|
|
874
874
|
: {};
|
|
875
|
-
return h("div", { class: "
|
|
875
|
+
return h("div", { class: "bd-field__grid-2" }, [
|
|
876
876
|
h("div", {}, [
|
|
877
|
-
h("label", { class: "
|
|
877
|
+
h("label", { class: "bd-field__sublabel" }, "Start"),
|
|
878
878
|
h("input", {
|
|
879
879
|
type: "date",
|
|
880
|
-
class: "
|
|
880
|
+
class: "bd-input",
|
|
881
881
|
value: struct.start ?? "",
|
|
882
882
|
onInput: (e: Event) =>
|
|
883
883
|
set({
|
|
@@ -887,10 +887,10 @@ const BiabFieldTree = defineComponent({
|
|
|
887
887
|
}),
|
|
888
888
|
]),
|
|
889
889
|
h("div", {}, [
|
|
890
|
-
h("label", { class: "
|
|
890
|
+
h("label", { class: "bd-field__sublabel" }, "End"),
|
|
891
891
|
h("input", {
|
|
892
892
|
type: "date",
|
|
893
|
-
class: "
|
|
893
|
+
class: "bd-input",
|
|
894
894
|
value: struct.end ?? "",
|
|
895
895
|
onInput: (e: Event) =>
|
|
896
896
|
set({
|
|
@@ -913,15 +913,15 @@ const BiabFieldTree = defineComponent({
|
|
|
913
913
|
? `${n}%`
|
|
914
914
|
: `${n}`;
|
|
915
915
|
const v = typeof value === "number" ? value : min;
|
|
916
|
-
return h("div", { class: "
|
|
917
|
-
h("div", { class: "
|
|
916
|
+
return h("div", { class: "bd-field__slider" }, [
|
|
917
|
+
h("div", { class: "bd-field__slider-scale" }, [
|
|
918
918
|
h("span", fmt(min)),
|
|
919
|
-
h("span", { class: "
|
|
919
|
+
h("span", { class: "bd-field__slider-value" }, fmt(v)),
|
|
920
920
|
h("span", fmt(max)),
|
|
921
921
|
]),
|
|
922
922
|
h("input", {
|
|
923
923
|
type: "range",
|
|
924
|
-
class: "
|
|
924
|
+
class: "bd-field__slider-input",
|
|
925
925
|
min,
|
|
926
926
|
max,
|
|
927
927
|
step: stepv,
|
|
@@ -936,14 +936,14 @@ const BiabFieldTree = defineComponent({
|
|
|
936
936
|
const v = typeof value === "number" ? value : 0;
|
|
937
937
|
return h(
|
|
938
938
|
"div",
|
|
939
|
-
{ class: "
|
|
939
|
+
{ class: "bd-field__stars" },
|
|
940
940
|
Array.from({ length: max }).map((_, i) =>
|
|
941
941
|
h(
|
|
942
942
|
"button",
|
|
943
943
|
{
|
|
944
944
|
key: i,
|
|
945
945
|
type: "button",
|
|
946
|
-
class: ["
|
|
946
|
+
class: ["bd-field__star", i < v ? "is-on" : ""],
|
|
947
947
|
onClick: () => set(i + 1),
|
|
948
948
|
},
|
|
949
949
|
"★",
|
|
@@ -955,14 +955,14 @@ const BiabFieldTree = defineComponent({
|
|
|
955
955
|
const v = typeof value === "number" ? value : -1;
|
|
956
956
|
return h(
|
|
957
957
|
"div",
|
|
958
|
-
{ class: "
|
|
958
|
+
{ class: "bd-field__happiness" },
|
|
959
959
|
["😞", "😕", "😐", "🙂", "😄"].map((emoji, i) =>
|
|
960
960
|
h(
|
|
961
961
|
"button",
|
|
962
962
|
{
|
|
963
963
|
key: emoji,
|
|
964
964
|
type: "button",
|
|
965
|
-
class: ["
|
|
965
|
+
class: ["bd-field__happy", i === v ? "is-on" : ""],
|
|
966
966
|
onClick: () => set(i),
|
|
967
967
|
},
|
|
968
968
|
emoji,
|
|
@@ -972,32 +972,145 @@ const BiabFieldTree = defineComponent({
|
|
|
972
972
|
}
|
|
973
973
|
case "stepper": {
|
|
974
974
|
const v = typeof value === "number" ? value : 0;
|
|
975
|
-
return h("div", { class: "
|
|
975
|
+
return h("div", { class: "bd-field__stepper" }, [
|
|
976
976
|
h(
|
|
977
977
|
"button",
|
|
978
978
|
{
|
|
979
979
|
type: "button",
|
|
980
|
-
class: "
|
|
980
|
+
class: "bd-btn bd-btn--ghost bd-field__stepper-btn",
|
|
981
981
|
onClick: () => set(v - 1),
|
|
982
982
|
},
|
|
983
983
|
"−",
|
|
984
984
|
),
|
|
985
985
|
h(
|
|
986
986
|
"span",
|
|
987
|
-
{ class: "
|
|
987
|
+
{ class: "bd-field__stepper-value" },
|
|
988
988
|
String(v),
|
|
989
989
|
),
|
|
990
990
|
h(
|
|
991
991
|
"button",
|
|
992
992
|
{
|
|
993
993
|
type: "button",
|
|
994
|
-
class: "
|
|
994
|
+
class: "bd-btn bd-btn--ghost bd-field__stepper-btn",
|
|
995
995
|
onClick: () => set(v + 1),
|
|
996
996
|
},
|
|
997
997
|
"+",
|
|
998
998
|
),
|
|
999
999
|
]);
|
|
1000
1000
|
}
|
|
1001
|
+
case "name": {
|
|
1002
|
+
const a = (
|
|
1003
|
+
value && typeof value === "object" && !Array.isArray(value)
|
|
1004
|
+
? value
|
|
1005
|
+
: {}
|
|
1006
|
+
) as {
|
|
1007
|
+
prefix?: string;
|
|
1008
|
+
first?: string;
|
|
1009
|
+
middle?: string;
|
|
1010
|
+
last?: string;
|
|
1011
|
+
suffix?: string;
|
|
1012
|
+
nicknames?: string[] | string;
|
|
1013
|
+
};
|
|
1014
|
+
const cfg = f.nameConfig ?? {};
|
|
1015
|
+
// Fixed per-part autofill tokens, suppressed to "off" when autofill
|
|
1016
|
+
// is off for this field (global switch or per-field override).
|
|
1017
|
+
const acOff = autocomplete === "off";
|
|
1018
|
+
const part = (
|
|
1019
|
+
k: "prefix" | "first" | "middle" | "last" | "suffix",
|
|
1020
|
+
label: string,
|
|
1021
|
+
ac: string,
|
|
1022
|
+
placeholder: string,
|
|
1023
|
+
full = false,
|
|
1024
|
+
) =>
|
|
1025
|
+
h(
|
|
1026
|
+
"div",
|
|
1027
|
+
{
|
|
1028
|
+
class: full
|
|
1029
|
+
? "bd-field__name-full"
|
|
1030
|
+
: "bd-field__name-half",
|
|
1031
|
+
},
|
|
1032
|
+
[
|
|
1033
|
+
h("label", { class: "bd-field__sublabel" }, label),
|
|
1034
|
+
h("input", {
|
|
1035
|
+
autocomplete: acOff ? "off" : ac,
|
|
1036
|
+
class: "bd-input",
|
|
1037
|
+
placeholder,
|
|
1038
|
+
value: a[k] ?? "",
|
|
1039
|
+
onInput: (e: Event) =>
|
|
1040
|
+
set({
|
|
1041
|
+
...a,
|
|
1042
|
+
[k]: (e.target as HTMLInputElement).value,
|
|
1043
|
+
}),
|
|
1044
|
+
}),
|
|
1045
|
+
],
|
|
1046
|
+
);
|
|
1047
|
+
// The nicknames input keeps the raw comma-separated string while
|
|
1048
|
+
// the visitor types; submit normalizes it into a string[] (and
|
|
1049
|
+
// the server re-normalizes authoritatively).
|
|
1050
|
+
const nicknamesText = Array.isArray(a.nicknames)
|
|
1051
|
+
? a.nicknames.join(", ")
|
|
1052
|
+
: typeof a.nicknames === "string"
|
|
1053
|
+
? a.nicknames
|
|
1054
|
+
: "";
|
|
1055
|
+
return h("div", { class: "bd-field__name" }, [
|
|
1056
|
+
...(cfg.prefix
|
|
1057
|
+
? [part("prefix", "Title", "honorific-prefix", "Dr.", true)]
|
|
1058
|
+
: []),
|
|
1059
|
+
part("first", "First name", "given-name", "Jane"),
|
|
1060
|
+
...(cfg.middle
|
|
1061
|
+
? [
|
|
1062
|
+
part(
|
|
1063
|
+
"middle",
|
|
1064
|
+
"Middle name",
|
|
1065
|
+
"additional-name",
|
|
1066
|
+
"Quinn",
|
|
1067
|
+
),
|
|
1068
|
+
]
|
|
1069
|
+
: []),
|
|
1070
|
+
part(
|
|
1071
|
+
"last",
|
|
1072
|
+
"Last name",
|
|
1073
|
+
"family-name",
|
|
1074
|
+
"Doe",
|
|
1075
|
+
cfg.middle === true && cfg.suffix !== true,
|
|
1076
|
+
),
|
|
1077
|
+
...(cfg.suffix
|
|
1078
|
+
? [
|
|
1079
|
+
part(
|
|
1080
|
+
"suffix",
|
|
1081
|
+
"Suffix",
|
|
1082
|
+
"honorific-suffix",
|
|
1083
|
+
"Jr.",
|
|
1084
|
+
cfg.middle !== true,
|
|
1085
|
+
),
|
|
1086
|
+
]
|
|
1087
|
+
: []),
|
|
1088
|
+
...(cfg.nicknames
|
|
1089
|
+
? [
|
|
1090
|
+
h("div", { class: "bd-field__name-full" }, [
|
|
1091
|
+
h(
|
|
1092
|
+
"label",
|
|
1093
|
+
{ class: "bd-field__sublabel" },
|
|
1094
|
+
"Nicknames",
|
|
1095
|
+
),
|
|
1096
|
+
h("input", {
|
|
1097
|
+
class: "bd-input",
|
|
1098
|
+
placeholder:
|
|
1099
|
+
"Johnny, JM — separate with commas",
|
|
1100
|
+
value: nicknamesText,
|
|
1101
|
+
onInput: (e: Event) =>
|
|
1102
|
+
set({
|
|
1103
|
+
...a,
|
|
1104
|
+
nicknames: (
|
|
1105
|
+
e.target as HTMLInputElement
|
|
1106
|
+
).value,
|
|
1107
|
+
}),
|
|
1108
|
+
}),
|
|
1109
|
+
]),
|
|
1110
|
+
]
|
|
1111
|
+
: []),
|
|
1112
|
+
]);
|
|
1113
|
+
}
|
|
1001
1114
|
case "address": {
|
|
1002
1115
|
const a =
|
|
1003
1116
|
value && typeof value === "object" && !Array.isArray(value)
|
|
@@ -1016,14 +1129,14 @@ const BiabFieldTree = defineComponent({
|
|
|
1016
1129
|
"div",
|
|
1017
1130
|
{
|
|
1018
1131
|
class: full
|
|
1019
|
-
? "
|
|
1020
|
-
: "
|
|
1132
|
+
? "bd-field__addr-full"
|
|
1133
|
+
: "bd-field__addr-half",
|
|
1021
1134
|
},
|
|
1022
1135
|
[
|
|
1023
|
-
h("label", { class: "
|
|
1136
|
+
h("label", { class: "bd-field__sublabel" }, label),
|
|
1024
1137
|
h("input", {
|
|
1025
1138
|
autocomplete: acOff ? "off" : ac,
|
|
1026
|
-
class: "
|
|
1139
|
+
class: "bd-input",
|
|
1027
1140
|
value: a[k] ?? "",
|
|
1028
1141
|
onInput: (e: Event) =>
|
|
1029
1142
|
set({
|
|
@@ -1033,7 +1146,7 @@ const BiabFieldTree = defineComponent({
|
|
|
1033
1146
|
}),
|
|
1034
1147
|
],
|
|
1035
1148
|
);
|
|
1036
|
-
return h("div", { class: "
|
|
1149
|
+
return h("div", { class: "bd-field__address" }, [
|
|
1037
1150
|
part("line1", "Address Line 1", "street-address", true),
|
|
1038
1151
|
part("line2", "Address Line 2", "address-line2", true),
|
|
1039
1152
|
part("city", "City", "address-level2"),
|
|
@@ -1045,12 +1158,12 @@ const BiabFieldTree = defineComponent({
|
|
|
1045
1158
|
const v = typeof value === "string" ? value : "";
|
|
1046
1159
|
return h(
|
|
1047
1160
|
"div",
|
|
1048
|
-
{ class: "
|
|
1161
|
+
{ class: "bd-field__colors" },
|
|
1049
1162
|
(f.options ?? []).map((color) =>
|
|
1050
1163
|
h("button", {
|
|
1051
1164
|
key: color,
|
|
1052
1165
|
type: "button",
|
|
1053
|
-
class: ["
|
|
1166
|
+
class: ["bd-field__color", v === color ? "is-on" : ""],
|
|
1054
1167
|
style: { backgroundColor: color },
|
|
1055
1168
|
title: color,
|
|
1056
1169
|
onClick: () => set(color),
|
|
@@ -1065,10 +1178,10 @@ const BiabFieldTree = defineComponent({
|
|
|
1065
1178
|
const maxFiles = f.fileConfig?.maxFiles ?? 1;
|
|
1066
1179
|
const allowed = f.fileConfig?.allowedTypes;
|
|
1067
1180
|
const remaining = Math.max(maxFiles - files.length, 0);
|
|
1068
|
-
return h("div", { class: "
|
|
1181
|
+
return h("div", { class: "bd-field__file" }, [
|
|
1069
1182
|
h("input", {
|
|
1070
1183
|
type: "file",
|
|
1071
|
-
class: "
|
|
1184
|
+
class: "bd-field__file-input",
|
|
1072
1185
|
multiple: maxFiles > 1,
|
|
1073
1186
|
accept:
|
|
1074
1187
|
allowed && allowed.length
|
|
@@ -1080,27 +1193,27 @@ const BiabFieldTree = defineComponent({
|
|
|
1080
1193
|
files.length
|
|
1081
1194
|
? h(
|
|
1082
1195
|
"ul",
|
|
1083
|
-
{ class: "
|
|
1196
|
+
{ class: "bd-field__file-list" },
|
|
1084
1197
|
files.map((file, idx) =>
|
|
1085
1198
|
h(
|
|
1086
1199
|
"li",
|
|
1087
|
-
{ key: idx, class: "
|
|
1200
|
+
{ key: idx, class: "bd-field__file-item" },
|
|
1088
1201
|
[
|
|
1089
1202
|
h(
|
|
1090
1203
|
"span",
|
|
1091
|
-
{ class: "
|
|
1204
|
+
{ class: "bd-field__file-name" },
|
|
1092
1205
|
file.name,
|
|
1093
1206
|
),
|
|
1094
1207
|
h(
|
|
1095
1208
|
"span",
|
|
1096
|
-
{ class: "
|
|
1209
|
+
{ class: "bd-field__file-size" },
|
|
1097
1210
|
`${Math.round(file.size / 1024)} KB`,
|
|
1098
1211
|
),
|
|
1099
1212
|
h(
|
|
1100
1213
|
"button",
|
|
1101
1214
|
{
|
|
1102
1215
|
type: "button",
|
|
1103
|
-
class: "
|
|
1216
|
+
class: "bd-field__file-remove",
|
|
1104
1217
|
"aria-label": "Remove file",
|
|
1105
1218
|
onClick: () => p.ctx.removeFile(id, idx),
|
|
1106
1219
|
},
|
|
@@ -1117,7 +1230,7 @@ const BiabFieldTree = defineComponent({
|
|
|
1117
1230
|
return h("input", {
|
|
1118
1231
|
autocomplete,
|
|
1119
1232
|
type: "tel",
|
|
1120
|
-
class: "
|
|
1233
|
+
class: "bd-input bd-field__control",
|
|
1121
1234
|
value: typeof value === "string" ? value : "",
|
|
1122
1235
|
placeholder:
|
|
1123
1236
|
f.placeholder ||
|
|
@@ -1131,7 +1244,7 @@ const BiabFieldTree = defineComponent({
|
|
|
1131
1244
|
return h("input", {
|
|
1132
1245
|
autocomplete,
|
|
1133
1246
|
type: "email",
|
|
1134
|
-
class: "
|
|
1247
|
+
class: "bd-input bd-field__control",
|
|
1135
1248
|
value: typeof value === "string" ? value : "",
|
|
1136
1249
|
placeholder: f.placeholder || "you@example.com",
|
|
1137
1250
|
onInput: (e: Event) =>
|
|
@@ -1140,7 +1253,7 @@ const BiabFieldTree = defineComponent({
|
|
|
1140
1253
|
case "number":
|
|
1141
1254
|
return h("input", {
|
|
1142
1255
|
type: "number",
|
|
1143
|
-
class: "
|
|
1256
|
+
class: "bd-input bd-field__control",
|
|
1144
1257
|
value:
|
|
1145
1258
|
typeof value === "number"
|
|
1146
1259
|
? value
|
|
@@ -1156,7 +1269,7 @@ const BiabFieldTree = defineComponent({
|
|
|
1156
1269
|
default:
|
|
1157
1270
|
return h("input", {
|
|
1158
1271
|
autocomplete,
|
|
1159
|
-
class: "
|
|
1272
|
+
class: "bd-input bd-field__control",
|
|
1160
1273
|
value: typeof value === "string" ? value : "",
|
|
1161
1274
|
placeholder: f.placeholder || "",
|
|
1162
1275
|
onInput: (e: Event) =>
|
|
@@ -1172,21 +1285,21 @@ const BiabFieldTree = defineComponent({
|
|
|
1172
1285
|
"div",
|
|
1173
1286
|
{
|
|
1174
1287
|
"data-field-id": f.id,
|
|
1175
|
-
"data-
|
|
1176
|
-
"data-
|
|
1288
|
+
"data-bd-field": cssKey(f),
|
|
1289
|
+
"data-bd-type": f.type,
|
|
1177
1290
|
class: [
|
|
1178
|
-
"
|
|
1179
|
-
`
|
|
1180
|
-
f.required ? "
|
|
1181
|
-
errored ? "
|
|
1291
|
+
"bd-field",
|
|
1292
|
+
`bd-field--${f.type}`,
|
|
1293
|
+
f.required ? "bd-field--required" : "",
|
|
1294
|
+
errored ? "bd-field--error" : "",
|
|
1182
1295
|
],
|
|
1183
1296
|
},
|
|
1184
1297
|
[
|
|
1185
1298
|
showLabel
|
|
1186
|
-
? h("label", { class: "
|
|
1299
|
+
? h("label", { class: "bd-field__label bd-label" }, [
|
|
1187
1300
|
f.label || "",
|
|
1188
1301
|
f.required
|
|
1189
|
-
? h("span", { class: "
|
|
1302
|
+
? h("span", { class: "bd-field__required" }, " *")
|
|
1190
1303
|
: null,
|
|
1191
1304
|
])
|
|
1192
1305
|
: null,
|
|
@@ -1194,12 +1307,12 @@ const BiabFieldTree = defineComponent({
|
|
|
1194
1307
|
errored
|
|
1195
1308
|
? h(
|
|
1196
1309
|
"p",
|
|
1197
|
-
{ class: "
|
|
1310
|
+
{ class: "bd-field__error" },
|
|
1198
1311
|
p.ctx.errors[f.id]?.message ?? "This field is required.",
|
|
1199
1312
|
)
|
|
1200
1313
|
: null,
|
|
1201
1314
|
f.helpText
|
|
1202
|
-
? h("p", { class: "
|
|
1315
|
+
? h("p", { class: "bd-field__help" }, f.helpText)
|
|
1203
1316
|
: null,
|
|
1204
1317
|
],
|
|
1205
1318
|
);
|
|
@@ -1218,14 +1331,14 @@ const BiabFieldTree = defineComponent({
|
|
|
1218
1331
|
"div",
|
|
1219
1332
|
{
|
|
1220
1333
|
key: f.id,
|
|
1221
|
-
"data-
|
|
1222
|
-
class: ["
|
|
1334
|
+
"data-bd-group": cssKey(f),
|
|
1335
|
+
class: ["bd-group", p.flat ? "bd-group--flat" : ""],
|
|
1223
1336
|
},
|
|
1224
1337
|
[
|
|
1225
1338
|
f.label && f.showGroupLabel === true
|
|
1226
|
-
? h("div", { class: "
|
|
1339
|
+
? h("div", { class: "bd-group__label" }, f.label)
|
|
1227
1340
|
: null,
|
|
1228
|
-
h(
|
|
1341
|
+
h(BdFieldTree, {
|
|
1229
1342
|
nodes: shown,
|
|
1230
1343
|
flat: p.flat,
|
|
1231
1344
|
ctx: p.ctx,
|
|
@@ -1236,7 +1349,7 @@ const BiabFieldTree = defineComponent({
|
|
|
1236
1349
|
// condition_block
|
|
1237
1350
|
if (f.type === "condition_block") {
|
|
1238
1351
|
if (!evalCondition(f.conditionRule, p.ctx.values)) return null;
|
|
1239
|
-
return h(
|
|
1352
|
+
return h(BdFieldTree, {
|
|
1240
1353
|
key: f.id,
|
|
1241
1354
|
nodes: (f.children ?? []) as FormCoreField[],
|
|
1242
1355
|
flat: p.flat,
|
|
@@ -1256,29 +1369,29 @@ const BiabFieldTree = defineComponent({
|
|
|
1256
1369
|
"div",
|
|
1257
1370
|
{
|
|
1258
1371
|
key: f.id,
|
|
1259
|
-
class: ["
|
|
1260
|
-
"data-
|
|
1372
|
+
class: ["bd-or", errored ? "bd-or--error" : ""],
|
|
1373
|
+
"data-bd-field": cssKey(f),
|
|
1261
1374
|
},
|
|
1262
1375
|
[
|
|
1263
1376
|
f.label
|
|
1264
|
-
? h("div", { class: "
|
|
1377
|
+
? h("div", { class: "bd-or__label" }, [
|
|
1265
1378
|
f.label,
|
|
1266
1379
|
h(
|
|
1267
1380
|
"span",
|
|
1268
|
-
{ class: "
|
|
1381
|
+
{ class: "bd-or__hint" },
|
|
1269
1382
|
" Fill at least one side",
|
|
1270
1383
|
),
|
|
1271
1384
|
])
|
|
1272
1385
|
: null,
|
|
1273
|
-
h("div", { class: "
|
|
1274
|
-
h("div", { class: "
|
|
1386
|
+
h("div", { class: "bd-or__grid" }, [
|
|
1387
|
+
h("div", { class: "bd-or__side" }, [
|
|
1275
1388
|
h(
|
|
1276
1389
|
"div",
|
|
1277
|
-
{ class: "
|
|
1390
|
+
{ class: "bd-or__side-label" },
|
|
1278
1391
|
cfg.leftLabel || "Option A",
|
|
1279
1392
|
),
|
|
1280
1393
|
left
|
|
1281
|
-
? h(
|
|
1394
|
+
? h(BdFieldTree, {
|
|
1282
1395
|
nodes: [left],
|
|
1283
1396
|
flat: p.flat,
|
|
1284
1397
|
ctx: p.ctx,
|
|
@@ -1287,17 +1400,17 @@ const BiabFieldTree = defineComponent({
|
|
|
1287
1400
|
]),
|
|
1288
1401
|
h(
|
|
1289
1402
|
"div",
|
|
1290
|
-
{ class: "
|
|
1403
|
+
{ class: "bd-or__divider" },
|
|
1291
1404
|
h("span", "OR"),
|
|
1292
1405
|
),
|
|
1293
|
-
h("div", { class: "
|
|
1406
|
+
h("div", { class: "bd-or__side" }, [
|
|
1294
1407
|
h(
|
|
1295
1408
|
"div",
|
|
1296
|
-
{ class: "
|
|
1409
|
+
{ class: "bd-or__side-label" },
|
|
1297
1410
|
cfg.rightLabel || "Option B",
|
|
1298
1411
|
),
|
|
1299
1412
|
right
|
|
1300
|
-
? h(
|
|
1413
|
+
? h(BdFieldTree, {
|
|
1301
1414
|
nodes: [right],
|
|
1302
1415
|
flat: p.flat,
|
|
1303
1416
|
ctx: p.ctx,
|
|
@@ -1308,7 +1421,7 @@ const BiabFieldTree = defineComponent({
|
|
|
1308
1421
|
errored
|
|
1309
1422
|
? h(
|
|
1310
1423
|
"p",
|
|
1311
|
-
{ class: "
|
|
1424
|
+
{ class: "bd-or__error" },
|
|
1312
1425
|
"Fill in at least one side to continue.",
|
|
1313
1426
|
)
|
|
1314
1427
|
: null,
|
|
@@ -1328,16 +1441,16 @@ const BiabFieldTree = defineComponent({
|
|
|
1328
1441
|
{
|
|
1329
1442
|
key: f.id,
|
|
1330
1443
|
class: [
|
|
1331
|
-
"
|
|
1332
|
-
`
|
|
1333
|
-
`
|
|
1444
|
+
"bd-flex-row",
|
|
1445
|
+
`bd-flex-row--justify-${justify}`,
|
|
1446
|
+
`bd-flex-row--align-${align}`,
|
|
1334
1447
|
],
|
|
1335
1448
|
style: { gap: `${cfg.gap ?? 12}px` },
|
|
1336
1449
|
},
|
|
1337
1450
|
(f.children ?? []).map((child) =>
|
|
1338
1451
|
h(
|
|
1339
1452
|
"div",
|
|
1340
|
-
{ key: child.id, class: "
|
|
1453
|
+
{ key: child.id, class: "bd-flex-row__item" },
|
|
1341
1454
|
renderFieldRow(child as FormCoreField),
|
|
1342
1455
|
),
|
|
1343
1456
|
),
|
|
@@ -1350,7 +1463,7 @@ const BiabFieldTree = defineComponent({
|
|
|
1350
1463
|
return () =>
|
|
1351
1464
|
h(
|
|
1352
1465
|
"div",
|
|
1353
|
-
{ class: "
|
|
1466
|
+
{ class: "bd-tree" },
|
|
1354
1467
|
p.nodes.map((n) => renderNode(n)),
|
|
1355
1468
|
);
|
|
1356
1469
|
},
|
|
@@ -1361,17 +1474,17 @@ const BiabFieldTree = defineComponent({
|
|
|
1361
1474
|
<!-- Loading / idle gate -->
|
|
1362
1475
|
<div
|
|
1363
1476
|
v-if="snap.status === 'loading' || snap.status === 'idle'"
|
|
1364
|
-
class="
|
|
1477
|
+
class="bd-form bd-form--loading"
|
|
1365
1478
|
>
|
|
1366
1479
|
<slot name="loading">
|
|
1367
|
-
<p class="
|
|
1480
|
+
<p class="bd-form__loading">Loading form…</p>
|
|
1368
1481
|
</slot>
|
|
1369
1482
|
</div>
|
|
1370
1483
|
|
|
1371
1484
|
<!-- Schema-load error gate -->
|
|
1372
|
-
<div v-else-if="snap.status === 'error'" class="
|
|
1485
|
+
<div v-else-if="snap.status === 'error'" class="bd-form bd-form--error">
|
|
1373
1486
|
<slot name="error" :message="snap.loadError">
|
|
1374
|
-
<p class="
|
|
1487
|
+
<p class="bd-form__load-error">
|
|
1375
1488
|
{{ snap.loadError ?? "This form could not be loaded." }}
|
|
1376
1489
|
</p>
|
|
1377
1490
|
</slot>
|
|
@@ -1381,14 +1494,14 @@ const BiabFieldTree = defineComponent({
|
|
|
1381
1494
|
<div
|
|
1382
1495
|
v-else-if="effectiveSubmitted && !hideSuccess"
|
|
1383
1496
|
:class="rootClass"
|
|
1384
|
-
data-
|
|
1497
|
+
data-bd-state="submitted"
|
|
1385
1498
|
>
|
|
1386
1499
|
<slot name="success" :result="effectiveResult">
|
|
1387
|
-
<div class="
|
|
1388
|
-
<h2 class="
|
|
1500
|
+
<div class="bd-form__success">
|
|
1501
|
+
<h2 class="bd-form__success-title">
|
|
1389
1502
|
{{ snap.title ?? "Thank you" }}
|
|
1390
1503
|
</h2>
|
|
1391
|
-
<p class="
|
|
1504
|
+
<p class="bd-form__success-body">Your submission was received.</p>
|
|
1392
1505
|
</div>
|
|
1393
1506
|
</slot>
|
|
1394
1507
|
</div>
|
|
@@ -1400,31 +1513,31 @@ const BiabFieldTree = defineComponent({
|
|
|
1400
1513
|
v-if="snap.orgIcon"
|
|
1401
1514
|
:src="snap.orgIcon"
|
|
1402
1515
|
alt=""
|
|
1403
|
-
class="
|
|
1516
|
+
class="bd-form__org-icon"
|
|
1404
1517
|
style="position: absolute; right: 0; top: 0"
|
|
1405
1518
|
/>
|
|
1406
1519
|
|
|
1407
1520
|
<!-- Title / description -->
|
|
1408
|
-
<div v-if="snap.title || snap.description" class="
|
|
1409
|
-
<h2 v-if="snap.title" class="
|
|
1410
|
-
<p v-if="snap.description" class="
|
|
1521
|
+
<div v-if="snap.title || snap.description" class="bd-form__header">
|
|
1522
|
+
<h2 v-if="snap.title" class="bd-form__title">{{ snap.title }}</h2>
|
|
1523
|
+
<p v-if="snap.description" class="bd-form__description">
|
|
1411
1524
|
{{ snap.description }}
|
|
1412
1525
|
</p>
|
|
1413
1526
|
</div>
|
|
1414
1527
|
|
|
1415
1528
|
<!-- Progress: labeled steps -->
|
|
1416
|
-
<div v-if="showStepsProgress" class="
|
|
1417
|
-
<div class="
|
|
1418
|
-
<div class="
|
|
1529
|
+
<div v-if="showStepsProgress" class="bd-progress bd-progress--steps">
|
|
1530
|
+
<div class="bd-progress__heading">Form Progress</div>
|
|
1531
|
+
<div class="bd-progress__track">
|
|
1419
1532
|
<template v-for="(s, i) in snap.steps" :key="`progress-${i}`">
|
|
1420
1533
|
<div
|
|
1421
1534
|
v-if="i > 0"
|
|
1422
|
-
class="
|
|
1535
|
+
class="bd-progress__connector"
|
|
1423
1536
|
:class="{ 'is-done': i <= snap.step }"
|
|
1424
1537
|
/>
|
|
1425
|
-
<div class="
|
|
1538
|
+
<div class="bd-progress__step">
|
|
1426
1539
|
<span
|
|
1427
|
-
class="
|
|
1540
|
+
class="bd-progress__dot"
|
|
1428
1541
|
:class="{
|
|
1429
1542
|
'is-current': i === snap.step,
|
|
1430
1543
|
'is-done': i < snap.step,
|
|
@@ -1434,7 +1547,7 @@ const BiabFieldTree = defineComponent({
|
|
|
1434
1547
|
<span v-else>{{ i + 1 }}</span>
|
|
1435
1548
|
</span>
|
|
1436
1549
|
<span
|
|
1437
|
-
class="
|
|
1550
|
+
class="bd-progress__label"
|
|
1438
1551
|
:class="{ 'is-current': i === snap.step }"
|
|
1439
1552
|
>{{ stepTitle(s, i) }}</span
|
|
1440
1553
|
>
|
|
@@ -1444,13 +1557,13 @@ const BiabFieldTree = defineComponent({
|
|
|
1444
1557
|
</div>
|
|
1445
1558
|
|
|
1446
1559
|
<!-- Progress: thin bar -->
|
|
1447
|
-
<div v-if="showBarProgress" class="
|
|
1448
|
-
<span class="
|
|
1560
|
+
<div v-if="showBarProgress" class="bd-progress bd-progress--bar">
|
|
1561
|
+
<span class="bd-progress__count"
|
|
1449
1562
|
>{{ snap.step + 1 }} / {{ snap.stepCount }}</span
|
|
1450
1563
|
>
|
|
1451
|
-
<div class="
|
|
1564
|
+
<div class="bd-progress__bar-track">
|
|
1452
1565
|
<div
|
|
1453
|
-
class="
|
|
1566
|
+
class="bd-progress__bar-fill"
|
|
1454
1567
|
:style="{ width: `${snap.progressPercent}%` }"
|
|
1455
1568
|
/>
|
|
1456
1569
|
</div>
|
|
@@ -1459,22 +1572,22 @@ const BiabFieldTree = defineComponent({
|
|
|
1459
1572
|
<!-- Form-level error summary -->
|
|
1460
1573
|
<div
|
|
1461
1574
|
v-if="snap.errorList.length > 0"
|
|
1462
|
-
class="
|
|
1575
|
+
class="bd-form__errors"
|
|
1463
1576
|
role="alert"
|
|
1464
1577
|
>
|
|
1465
|
-
<div class="
|
|
1578
|
+
<div class="bd-form__errors-title">
|
|
1466
1579
|
Please complete the highlighted required field{{
|
|
1467
1580
|
snap.errorList.length === 1 ? "" : "s"
|
|
1468
1581
|
}}.
|
|
1469
1582
|
</div>
|
|
1470
|
-
<div class="
|
|
1583
|
+
<div class="bd-form__errors-list">
|
|
1471
1584
|
{{ snap.errorList.map((er) => er.label).join(", ") }}
|
|
1472
1585
|
</div>
|
|
1473
1586
|
</div>
|
|
1474
1587
|
|
|
1475
1588
|
<!-- Field tree for the active step (single-page = all fields) -->
|
|
1476
1589
|
<div :key="`step-${snap.step}`" :class="entranceClass">
|
|
1477
|
-
<
|
|
1590
|
+
<BdFieldTree
|
|
1478
1591
|
:nodes="snap.visibleFields"
|
|
1479
1592
|
:flat="isConsecutive"
|
|
1480
1593
|
:ctx="fieldCtx"
|
|
@@ -1482,10 +1595,10 @@ const BiabFieldTree = defineComponent({
|
|
|
1482
1595
|
</div>
|
|
1483
1596
|
|
|
1484
1597
|
<!-- Navigation -->
|
|
1485
|
-
<div v-if="isMultiStep" class="
|
|
1598
|
+
<div v-if="isMultiStep" class="bd-nav">
|
|
1486
1599
|
<button
|
|
1487
1600
|
type="button"
|
|
1488
|
-
class="
|
|
1601
|
+
class="bd-btn bd-btn--back"
|
|
1489
1602
|
:disabled="snap.isFirstStep"
|
|
1490
1603
|
@click="controller.back()"
|
|
1491
1604
|
>
|
|
@@ -1494,7 +1607,7 @@ const BiabFieldTree = defineComponent({
|
|
|
1494
1607
|
<button
|
|
1495
1608
|
v-if="!snap.isLastStep"
|
|
1496
1609
|
type="button"
|
|
1497
|
-
class="
|
|
1610
|
+
class="bd-btn bd-btn--next"
|
|
1498
1611
|
:disabled="!snap.canAdvance"
|
|
1499
1612
|
@click="controller.next()"
|
|
1500
1613
|
>
|
|
@@ -1503,7 +1616,7 @@ const BiabFieldTree = defineComponent({
|
|
|
1503
1616
|
<button
|
|
1504
1617
|
v-else
|
|
1505
1618
|
type="button"
|
|
1506
|
-
class="
|
|
1619
|
+
class="bd-btn bd-btn--submit"
|
|
1507
1620
|
:disabled="submitDisabled"
|
|
1508
1621
|
@click="handleSubmit()"
|
|
1509
1622
|
>
|
|
@@ -1511,10 +1624,10 @@ const BiabFieldTree = defineComponent({
|
|
|
1511
1624
|
</button>
|
|
1512
1625
|
</div>
|
|
1513
1626
|
|
|
1514
|
-
<div v-else class="
|
|
1627
|
+
<div v-else class="bd-nav">
|
|
1515
1628
|
<button
|
|
1516
1629
|
type="button"
|
|
1517
|
-
class="
|
|
1630
|
+
class="bd-btn bd-btn--submit"
|
|
1518
1631
|
:disabled="submitDisabled"
|
|
1519
1632
|
@click="handleSubmit()"
|
|
1520
1633
|
>
|
|
@@ -1529,7 +1642,7 @@ const BiabFieldTree = defineComponent({
|
|
|
1529
1642
|
!effectiveResult.ok &&
|
|
1530
1643
|
snap.errorList.length === 0
|
|
1531
1644
|
"
|
|
1532
|
-
class="
|
|
1645
|
+
class="bd-form__submit-error"
|
|
1533
1646
|
role="alert"
|
|
1534
1647
|
>
|
|
1535
1648
|
{{ effectiveResult.message }}
|