@bison-lab/ui 4.25.0 → 4.30.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/dist/index.mjs CHANGED
@@ -21,6 +21,7 @@ import { Toaster as Toaster$1, toast } from "sonner";
21
21
  import { attachEdgeShade } from "@bison-lab/tokens/dom";
22
22
  import { flexRender, getCoreRowModel, getFilteredRowModel, getPaginationRowModel, getSortedRowModel, useReactTable } from "@tanstack/react-table";
23
23
  import { Command as Command$1 } from "cmdk";
24
+ import { z } from "zod";
24
25
  //#region src/lib/semantic-action-tones.ts
25
26
  /**
26
27
  * Reusable “soft” icon tiles: same border + shadow language, hue from semantic scales.
@@ -1018,14 +1019,14 @@ const OutlinedField = React.forwardRef(({ label, htmlFor, error, errorVersion =
1018
1019
  OutlinedField.displayName = "OutlinedField";
1019
1020
  //#endregion
1020
1021
  //#region src/form/form-field.tsx
1021
- function FormField({ name, label, description, required, labelLayout = "stack", as = "field", className, children }) {
1022
+ function FormField({ name, id, label, description, required, labelLayout = "stack", as = "field", className, children }) {
1022
1023
  const formCtx = useFormContext();
1023
1024
  const errorMessage = formCtx?.errors[name];
1024
1025
  const errorVersion = formCtx?.errorVersion ?? 0;
1025
1026
  const wrapRef = React.useRef(null);
1026
1027
  const { noteIds, registerNote } = useFieldNotes();
1027
1028
  const { controlId, descriptionId, errorId, labelId } = useFieldIds({
1028
- controlId: name,
1029
+ controlId: id ?? name,
1029
1030
  hasDescription: Boolean(description) && !errorMessage,
1030
1031
  hasError: Boolean(errorMessage)
1031
1032
  });
@@ -1062,7 +1063,7 @@ function FormField({ name, label, description, required, labelLayout = "stack",
1062
1063
  }, [errorVersion, errorMessage]);
1063
1064
  if (!isGroup && label && labelLayout === "outlined") return /* @__PURE__ */ jsx(OutlinedField, {
1064
1065
  label,
1065
- htmlFor: name,
1066
+ htmlFor: id ?? name,
1066
1067
  required,
1067
1068
  error: errorMessage,
1068
1069
  errorVersion,
@@ -7516,8 +7517,9 @@ const MEDIA_FRAME = {
7516
7517
  * Opening band. Sweep and dark flip the theme locally via `data-theme="dark"`
7517
7518
  * so tokens resolve to their dark values. Corners stay square.
7518
7519
  */
7519
- const HeroSweep = React.forwardRef(function HeroSweep({ eyebrow, heading, body, children, media, mediaAspect = "3:2", tone = "sweep", overlap = false, sectionClassName, containerClassName = DEFAULT_CONTAINER$2, className }, ref) {
7520
+ const HeroSweep = React.forwardRef(function HeroSweep({ eyebrow, heading, body, children, media, mediaAspect = "3:2", align = "start", tone = "sweep", overlap = false, sectionClassName, containerClassName = DEFAULT_CONTAINER$2, className }, ref) {
7520
7521
  const isLight = tone === "light";
7522
+ const centered = align === "center" && !media;
7521
7523
  const isSweep = tone === "sweep";
7522
7524
  const painted = hasSectionBackground(sectionClassName);
7523
7525
  const ownPadding = `pt-28 lg:pt-36 ${overlap ? "pb-36 lg:pb-48" : "pb-20 lg:pb-28"}`;
@@ -7544,7 +7546,8 @@ const HeroSweep = React.forwardRef(function HeroSweep({ eyebrow, heading, body,
7544
7546
  children: [/* @__PURE__ */ jsxs("div", {
7545
7547
  className: cn(containerClassName, "relative z-10", padding, media && "grid gap-10 lg:grid-cols-[minmax(0,3fr)_minmax(0,2fr)] lg:items-center"),
7546
7548
  children: [/* @__PURE__ */ jsxs("div", {
7547
- className: "max-w-3xl",
7549
+ className: cn("max-w-3xl", centered && "mx-auto text-center"),
7550
+ "data-align": centered ? "center" : void 0,
7548
7551
  children: [
7549
7552
  eyebrow ? /* @__PURE__ */ jsx("p", {
7550
7553
  className: cn("mb-4 text-sm font-semibold tracking-wide uppercase", eyebrowInk),
@@ -7555,11 +7558,11 @@ const HeroSweep = React.forwardRef(function HeroSweep({ eyebrow, heading, body,
7555
7558
  children: heading
7556
7559
  }),
7557
7560
  body ? /* @__PURE__ */ jsx("p", {
7558
- className: cn("mt-6 max-w-2xl text-lg leading-relaxed", bodyInk),
7561
+ className: cn("mt-6 max-w-2xl text-lg leading-relaxed", centered && "mx-auto", bodyInk),
7559
7562
  children: body
7560
7563
  }) : null,
7561
7564
  children ? /* @__PURE__ */ jsx("div", {
7562
- className: "mt-8 flex flex-wrap gap-3",
7565
+ className: cn("mt-8 flex flex-wrap gap-3", centered && "justify-center"),
7563
7566
  children
7564
7567
  }) : null
7565
7568
  ]
@@ -7874,6 +7877,31 @@ const FeatureHighlightsBlock = React.forwardRef(({ eyebrow, title, description,
7874
7877
  });
7875
7878
  FeatureHighlightsBlock.displayName = "FeatureHighlightsBlock";
7876
7879
  //#endregion
7880
+ //#region src/lib/inline-emphasis.tsx
7881
+ const BOLD = /\*\*(?=\S)(.+?)(?<=\S)\*\*/g;
7882
+ /**
7883
+ * A plain-text line with `**…**` runs as `<strong>`. No HTML is read: the
7884
+ * text is split, never parsed, and an unmatched `**` stays literal. Editors
7885
+ * get partial bold in a one-line text field without a rich-text editor.
7886
+ */
7887
+ function inlineEmphasis(text) {
7888
+ if (!text.includes("**")) return text;
7889
+ const parts = [];
7890
+ let last = 0;
7891
+ for (const match of text.matchAll(BOLD)) {
7892
+ const start = match.index ?? 0;
7893
+ if (start > last) parts.push(text.slice(last, start));
7894
+ parts.push(/* @__PURE__ */ jsx("strong", {
7895
+ className: "font-semibold",
7896
+ children: match[1]
7897
+ }, start));
7898
+ last = start + match[0].length;
7899
+ }
7900
+ if (parts.length === 0) return text;
7901
+ if (last < text.length) parts.push(text.slice(last));
7902
+ return parts;
7903
+ }
7904
+ //#endregion
7877
7905
  //#region src/blocks/marketing/feature-checklist-block.tsx
7878
7906
  /**
7879
7907
  * A centered heading over two checked lists. The two lists are the editor's
@@ -7942,7 +7970,7 @@ const FeatureChecklistBlock = React.forwardRef(({ badge, title, dividerLabel, le
7942
7970
  className: "mt-0.5 shrink-0 text-primary",
7943
7971
  "aria-hidden": true,
7944
7972
  children: mark
7945
- }), /* @__PURE__ */ jsx("span", { children: item.label })]
7973
+ }), /* @__PURE__ */ jsx("span", { children: typeof item.label === "string" ? inlineEmphasis(item.label) : item.label })]
7946
7974
  }, item.id))
7947
7975
  }, side))
7948
7976
  }) : null]
@@ -7951,6 +7979,443 @@ const FeatureChecklistBlock = React.forwardRef(({ badge, title, dividerLabel, le
7951
7979
  });
7952
7980
  FeatureChecklistBlock.displayName = "FeatureChecklistBlock";
7953
7981
  //#endregion
7982
+ //#region src/blocks/marketing/video-block.tsx
7983
+ const FRAME = {
7984
+ "16:9": "aspect-video",
7985
+ "4:3": "aspect-[4/3]",
7986
+ "1:1": "aspect-square",
7987
+ "9:16": "aspect-[9/16] max-h-[80vh]"
7988
+ };
7989
+ /** The provider URL a facade loads on click. No third-party request before then. */
7990
+ function videoEmbedUrl(video, autoplay = true) {
7991
+ if (video.kind === "youtube") {
7992
+ const params = new URLSearchParams({
7993
+ rel: "0",
7994
+ modestbranding: "1",
7995
+ playsinline: "1"
7996
+ });
7997
+ if (autoplay) params.set("autoplay", "1");
7998
+ if (video.start) params.set("start", String(Math.floor(video.start)));
7999
+ return `https://www.youtube-nocookie.com/embed/${encodeURIComponent(video.id)}?${params}`;
8000
+ }
8001
+ const params = new URLSearchParams({ dnt: "1" });
8002
+ if (video.hash) params.set("h", video.hash);
8003
+ if (autoplay) params.set("autoplay", "1");
8004
+ const hashTime = video.start ? `#t=${Math.floor(video.start)}s` : "";
8005
+ return `https://player.vimeo.com/video/${encodeURIComponent(video.id)}?${params}${hashTime}`;
8006
+ }
8007
+ function prefersReducedMotion() {
8008
+ return typeof window !== "undefined" && typeof window.matchMedia === "function" ? window.matchMedia("(prefers-reduced-motion: reduce)").matches : false;
8009
+ }
8010
+ function PlayGlyph() {
8011
+ return /* @__PURE__ */ jsx("span", {
8012
+ className: "flex size-16 items-center justify-center rounded-full bg-background/90 text-foreground shadow-lg transition-transform group-hover:scale-105 group-focus-visible:scale-105 motion-reduce:transition-none",
8013
+ children: /* @__PURE__ */ jsx(Play, {
8014
+ className: "ml-1 size-7",
8015
+ "aria-hidden": true
8016
+ })
8017
+ });
8018
+ }
8019
+ function EmbedPlayer({ video, poster, name, playLabel }) {
8020
+ const [playing, setPlaying] = React.useState(false);
8021
+ if (playing) return /* @__PURE__ */ jsx("iframe", {
8022
+ src: videoEmbedUrl(video),
8023
+ title: name,
8024
+ className: "absolute inset-0 size-full border-0",
8025
+ allow: "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; fullscreen",
8026
+ allowFullScreen: true,
8027
+ referrerPolicy: "strict-origin-when-cross-origin"
8028
+ });
8029
+ const still = poster ?? (video.kind === "youtube" ? /* @__PURE__ */ jsx("img", {
8030
+ src: `https://i.ytimg.com/vi/${encodeURIComponent(video.id)}/hqdefault.jpg`,
8031
+ alt: "",
8032
+ loading: "lazy",
8033
+ decoding: "async",
8034
+ className: "size-full object-cover"
8035
+ }) : null);
8036
+ return /* @__PURE__ */ jsxs("button", {
8037
+ type: "button",
8038
+ className: "group absolute inset-0 flex size-full items-center justify-center bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
8039
+ "aria-label": `${playLabel}: ${name}`,
8040
+ "data-video-facade": video.kind,
8041
+ onClick: () => setPlaying(true),
8042
+ children: [still ? /* @__PURE__ */ jsx("span", {
8043
+ className: "absolute inset-0 [&>*]:size-full",
8044
+ "aria-hidden": true,
8045
+ children: still
8046
+ }) : null, /* @__PURE__ */ jsx("span", {
8047
+ className: "relative",
8048
+ children: /* @__PURE__ */ jsx(PlayGlyph, {})
8049
+ })]
8050
+ });
8051
+ }
8052
+ function FilePlayer({ video, posterSrc, name, loop, labels }) {
8053
+ const ref = React.useRef(null);
8054
+ const [ambient, setAmbient] = React.useState(false);
8055
+ const [paused, setPaused] = React.useState(true);
8056
+ const [held, setHeld] = React.useState(false);
8057
+ React.useEffect(() => {
8058
+ setAmbient(loop && !prefersReducedMotion());
8059
+ }, [loop]);
8060
+ React.useEffect(() => {
8061
+ const node = ref.current;
8062
+ if (!ambient || !node || held) return;
8063
+ if (typeof IntersectionObserver === "undefined") {
8064
+ node.play?.()?.catch(() => void 0);
8065
+ return;
8066
+ }
8067
+ const observer = new IntersectionObserver(([entry]) => {
8068
+ if (entry?.isIntersecting) node.play?.()?.catch(() => void 0);
8069
+ else node.pause?.();
8070
+ }, { threshold: .25 });
8071
+ observer.observe(node);
8072
+ return () => observer.disconnect();
8073
+ }, [ambient, held]);
8074
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("video", {
8075
+ ref,
8076
+ className: "absolute inset-0 size-full bg-black object-cover",
8077
+ poster: posterSrc,
8078
+ preload: ambient ? "none" : "metadata",
8079
+ playsInline: true,
8080
+ "aria-label": name,
8081
+ ...ambient ? {
8082
+ muted: true,
8083
+ loop: true
8084
+ } : { controls: true },
8085
+ onPlay: () => setPaused(false),
8086
+ onPause: () => setPaused(true),
8087
+ children: [/* @__PURE__ */ jsx("source", {
8088
+ src: video.src,
8089
+ ...video.type ? { type: video.type } : {}
8090
+ }), video.captions ? /* @__PURE__ */ jsx("track", {
8091
+ kind: "captions",
8092
+ src: video.captions.src,
8093
+ srcLang: video.captions.srclang ?? "en",
8094
+ label: video.captions.label ?? "English",
8095
+ default: true
8096
+ }) : null]
8097
+ }), ambient ? /* @__PURE__ */ jsx("button", {
8098
+ type: "button",
8099
+ className: "absolute right-3 bottom-3 flex size-10 items-center justify-center rounded-full bg-background/90 text-foreground shadow focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
8100
+ "aria-label": paused ? labels.resume : labels.pause,
8101
+ onClick: () => {
8102
+ const node = ref.current;
8103
+ if (!node) return;
8104
+ if (node.paused) {
8105
+ setHeld(false);
8106
+ node.play?.()?.catch(() => void 0);
8107
+ } else {
8108
+ setHeld(true);
8109
+ node.pause();
8110
+ }
8111
+ },
8112
+ children: paused ? /* @__PURE__ */ jsx(Play, {
8113
+ className: "size-4",
8114
+ "aria-hidden": true
8115
+ }) : /* @__PURE__ */ jsx(Pause, {
8116
+ className: "size-4",
8117
+ "aria-hidden": true
8118
+ })
8119
+ }) : null] });
8120
+ }
8121
+ /**
8122
+ * A video under an optional centered heading: a YouTube or Vimeo link, or a
8123
+ * file the site serves.
8124
+ *
8125
+ * A hosted video is a facade until clicked: the poster (or YouTube's
8126
+ * thumbnail) and a play button, with no request to the provider, so the page
8127
+ * pays nothing for a video nobody plays. The click loads the privacy-enhanced
8128
+ * player and starts it. A file is a native `<video>` with controls and
8129
+ * `preload="metadata"`, or, with `loop`, a muted ambient loop that plays only
8130
+ * while on screen and has its own pause control.
8131
+ */
8132
+ const VideoBlock = React.forwardRef(({ eyebrow, title, description, headingLevel = "h2", video, poster, posterSrc, aspect = "16:9", width = "contained", caption, loop = false, videoLabel, labels, containerClassName, className, ...props }, ref) => {
8133
+ const headingId = React.useId();
8134
+ const Heading = headingLevel;
8135
+ const name = videoLabel ?? (typeof title === "string" && title ? title : "Video");
8136
+ const hasHead = Boolean(eyebrow || title || description);
8137
+ return /* @__PURE__ */ jsx("section", {
8138
+ ref,
8139
+ "aria-labelledby": hasHead && title && !props["aria-label"] ? headingId : void 0,
8140
+ className,
8141
+ ...props,
8142
+ children: /* @__PURE__ */ jsxs("div", {
8143
+ className: cn("mx-auto w-full max-w-7xl px-6 py-16 md:py-24", containerClassName),
8144
+ children: [hasHead ? /* @__PURE__ */ jsxs("div", {
8145
+ className: "mx-auto mb-10 flex max-w-3xl flex-col items-center text-center",
8146
+ children: [
8147
+ eyebrow ? /* @__PURE__ */ jsx("p", {
8148
+ className: "mb-4 text-sm font-semibold tracking-wide text-primary uppercase",
8149
+ children: eyebrow
8150
+ }) : null,
8151
+ title ? /* @__PURE__ */ jsx(Heading, {
8152
+ id: headingId,
8153
+ className: "font-heading text-3xl font-semibold tracking-tight text-balance md:text-4xl",
8154
+ children: title
8155
+ }) : null,
8156
+ description ? /* @__PURE__ */ jsx("p", {
8157
+ className: "mt-4 text-lg leading-relaxed text-muted-foreground",
8158
+ children: description
8159
+ }) : null
8160
+ ]
8161
+ }) : null, /* @__PURE__ */ jsxs("figure", {
8162
+ className: cn("mx-auto w-full", width === "wide" ? "max-w-none" : "max-w-4xl", aspect === "9:16" && "max-w-sm"),
8163
+ "data-video-aspect": aspect,
8164
+ children: [/* @__PURE__ */ jsx("div", {
8165
+ className: cn("relative mx-auto w-full overflow-hidden rounded-xl bg-muted shadow-lg", FRAME[aspect] ?? FRAME["16:9"]),
8166
+ children: video.kind === "file" ? /* @__PURE__ */ jsx(FilePlayer, {
8167
+ video,
8168
+ posterSrc,
8169
+ name,
8170
+ loop,
8171
+ labels: {
8172
+ pause: labels?.pause ?? "Pause video",
8173
+ resume: labels?.resume ?? "Play video"
8174
+ }
8175
+ }) : /* @__PURE__ */ jsx(EmbedPlayer, {
8176
+ video,
8177
+ poster,
8178
+ name,
8179
+ playLabel: labels?.play ?? "Play video"
8180
+ })
8181
+ }), caption ? /* @__PURE__ */ jsx("figcaption", {
8182
+ className: "mt-3 text-center text-sm text-muted-foreground",
8183
+ children: caption
8184
+ }) : null]
8185
+ })]
8186
+ })
8187
+ });
8188
+ });
8189
+ VideoBlock.displayName = "VideoBlock";
8190
+ //#endregion
8191
+ //#region src/form/validators.ts
8192
+ /**
8193
+ * A trimmed, non-empty string.
8194
+ *
8195
+ * Trimming happens before the emptiness check, so a field holding only spaces
8196
+ * fails rather than passing as "filled".
8197
+ */
8198
+ function requiredText({ requiredMessage = "This field is required." } = {}) {
8199
+ return z.string().trim().min(1, { message: requiredMessage });
8200
+ }
8201
+ /** An email address. Trimmed, and empty-tolerant when `optional`. */
8202
+ function emailField({ requiredMessage = "Email address is required.", message = "Enter a valid email address.", optional = false } = {}) {
8203
+ const base = z.string().trim();
8204
+ if (optional) return base.refine((value) => value === "" || z.string().email().safeParse(value).success, { message });
8205
+ return base.min(1, { message: requiredMessage }).email({ message });
8206
+ }
8207
+ /**
8208
+ * A US (NANP) phone number, counted in digits rather than matched by shape.
8209
+ *
8210
+ * Accepts anything `PhoneInput` can produce or a human can paste:
8211
+ * `(555) 123-4567`, `555-123-4567`, `5551234567`, `+1 555 123 4567`. What it
8212
+ * checks is that exactly ten digits are present, which is the only part that
8213
+ * carries meaning — `PhoneInput` already owns the presentation.
8214
+ */
8215
+ function usPhoneField({ requiredMessage = "Phone number is required.", message = "Enter a 10-digit US phone number.", required = false } = {}) {
8216
+ const base = z.string().trim();
8217
+ const hasTenDigits = (value) => parseUsPhoneDigits(value).length === 10;
8218
+ if (required) return base.min(1, { message: requiredMessage }).refine(hasTenDigits, { message });
8219
+ return base.refine((value) => value === "" || hasTenDigits(value), { message });
8220
+ }
8221
+ //#endregion
8222
+ //#region src/blocks/marketing/inquiry-form-block.tsx
8223
+ const AUTOCOMPLETE = {
8224
+ name: "name",
8225
+ email: "email",
8226
+ phone: "tel"
8227
+ };
8228
+ /** A required-or-optional string check for one field, matching what the control submits. */
8229
+ function fieldSchema(field) {
8230
+ const required = Boolean(field.required);
8231
+ switch (field.type) {
8232
+ case "email": return emailField({ optional: !required });
8233
+ case "phone": return usPhoneField({ required });
8234
+ case "select": {
8235
+ const values = (field.options ?? []).map((o) => o.value);
8236
+ return (required ? requiredText({ requiredMessage: "Choose an option." }) : z.string()).refine((v) => v === "" || values.includes(v), { message: "Choose an option." });
8237
+ }
8238
+ default: return required ? requiredText() : z.string();
8239
+ }
8240
+ }
8241
+ /** The native-mode schema: one check per field, keyed like the submission. */
8242
+ function inquiryFormSchema(fields) {
8243
+ return z.object(Object.fromEntries(fields.map((f) => [f.key, fieldSchema(f)])));
8244
+ }
8245
+ /**
8246
+ * A native `<select>`, styled as the other controls. Native rather than the
8247
+ * Radix `Select` because it posts with the form and reads well on a phone,
8248
+ * which is where most inquiries are typed.
8249
+ */
8250
+ const NativeSelect = React.forwardRef(({ className, ...props }, ref) => {
8251
+ const fieldProps = useFieldControl(props);
8252
+ return /* @__PURE__ */ jsx("select", {
8253
+ ref,
8254
+ className: cn(inputSurfaceClasses, inputSizingClasses("md"), inputFocusClasses, className),
8255
+ ...fieldProps
8256
+ });
8257
+ });
8258
+ NativeSelect.displayName = "NativeSelect";
8259
+ function Control({ field, disabled, register }) {
8260
+ const registered = register ? register(field.key, { required: Boolean(field.required) }) : { name: field.key };
8261
+ const common = {
8262
+ disabled,
8263
+ placeholder: field.placeholder,
8264
+ ...registered
8265
+ };
8266
+ switch (field.type) {
8267
+ case "message": return /* @__PURE__ */ jsx(Textarea, {
8268
+ rows: 5,
8269
+ ...common
8270
+ });
8271
+ case "email": return /* @__PURE__ */ jsx(Input, {
8272
+ type: "email",
8273
+ autoComplete: "email",
8274
+ ...common
8275
+ });
8276
+ case "phone": return register ? /* @__PURE__ */ jsx(Input, {
8277
+ type: "tel",
8278
+ inputMode: "tel",
8279
+ autoComplete: "tel",
8280
+ ...common
8281
+ }) : /* @__PURE__ */ jsx(PhoneInput, { ...common });
8282
+ case "select": return /* @__PURE__ */ jsxs(NativeSelect, {
8283
+ defaultValue: "",
8284
+ ...common,
8285
+ children: [/* @__PURE__ */ jsx("option", {
8286
+ value: "",
8287
+ disabled: Boolean(field.required),
8288
+ children: field.placeholder ?? "Choose…"
8289
+ }), (field.options ?? []).map((option) => /* @__PURE__ */ jsx("option", {
8290
+ value: option.value,
8291
+ children: option.label
8292
+ }, option.value))]
8293
+ });
8294
+ default: return /* @__PURE__ */ jsx(Input, {
8295
+ type: "text",
8296
+ autoComplete: AUTOCOMPLETE[field.type],
8297
+ ...common
8298
+ });
8299
+ }
8300
+ }
8301
+ /** Every value as a string: a field that posts nothing submits `""`. */
8302
+ function toValues(fields, data) {
8303
+ return Object.fromEntries(fields.map((f) => {
8304
+ const value = data[f.key];
8305
+ return [f.key, typeof value === "string" ? value : ""];
8306
+ }));
8307
+ }
8308
+ /**
8309
+ * An inquiry form under an optional heading: the fields an editor picked,
8310
+ * validated in the browser, then handed to `onSubmit` as `{ key: value }`.
8311
+ * Where the values go is the caller's business. `loading`, `error` and
8312
+ * `success` are the three states of a send; on success the form is replaced
8313
+ * by a status message that takes focus, so a screen reader hears the result.
8314
+ */
8315
+ const InquiryFormBlock = React.forwardRef(({ eyebrow, title, description, headingLevel = "h2", fields, submitLabel = "Send", onSubmit, loading = false, error, errors, disabled = false, success = false, successTitle = "Thanks, your message is on its way", successMessage = "We will get back to you soon.", formMode = "native", register, trigger, containerClassName, className, ...props }, ref) => {
8316
+ const headingId = React.useId();
8317
+ const formId = React.useId();
8318
+ const statusRef = React.useRef(null);
8319
+ const Heading = headingLevel;
8320
+ const hasHead = Boolean(eyebrow || title || description);
8321
+ const rhf = formMode === "rhf";
8322
+ const schema = React.useMemo(() => rhf ? void 0 : inquiryFormSchema(fields), [fields, rhf]);
8323
+ React.useEffect(() => {
8324
+ if (success) statusRef.current?.focus();
8325
+ }, [success]);
8326
+ const fieldErrors = React.useMemo(() => {
8327
+ if (!errors) return void 0;
8328
+ const out = {};
8329
+ for (const [key, value] of Object.entries(errors)) {
8330
+ const message = typeof value === "string" ? value : value?.message;
8331
+ if (typeof message === "string" && message) out[key] = message;
8332
+ }
8333
+ return out;
8334
+ }, [errors]);
8335
+ const handleSubmit = async (data) => {
8336
+ if (rhf && trigger && !await trigger(void 0, { shouldFocus: true })) return;
8337
+ await onSubmit(toValues(fields, data));
8338
+ };
8339
+ return /* @__PURE__ */ jsx("section", {
8340
+ ref,
8341
+ "aria-labelledby": title && !props["aria-label"] ? headingId : void 0,
8342
+ className,
8343
+ ...props,
8344
+ children: /* @__PURE__ */ jsxs("div", {
8345
+ className: cn("mx-auto grid w-full max-w-7xl gap-10 px-6 py-16 md:py-24", hasHead && "lg:grid-cols-[minmax(0,2fr)_minmax(0,3fr)] lg:gap-16", containerClassName),
8346
+ children: [hasHead ? /* @__PURE__ */ jsxs("div", {
8347
+ className: "flex flex-col",
8348
+ children: [
8349
+ eyebrow ? /* @__PURE__ */ jsx("p", {
8350
+ className: "mb-4 text-sm font-semibold tracking-wide text-primary uppercase",
8351
+ children: eyebrow
8352
+ }) : null,
8353
+ title ? /* @__PURE__ */ jsx(Heading, {
8354
+ id: headingId,
8355
+ className: "font-heading text-3xl font-semibold tracking-tight text-balance md:text-4xl",
8356
+ children: title
8357
+ }) : null,
8358
+ description ? /* @__PURE__ */ jsx("p", {
8359
+ className: "mt-4 text-lg leading-relaxed text-muted-foreground",
8360
+ children: description
8361
+ }) : null
8362
+ ]
8363
+ }) : null, /* @__PURE__ */ jsx("div", {
8364
+ className: "w-full rounded-xl border bg-card p-6 text-card-foreground shadow-sm md:p-8",
8365
+ children: success ? /* @__PURE__ */ jsxs("div", {
8366
+ ref: statusRef,
8367
+ role: "status",
8368
+ tabIndex: -1,
8369
+ className: "flex flex-col items-start gap-3 outline-none",
8370
+ children: [
8371
+ /* @__PURE__ */ jsx(CircleCheck, {
8372
+ "aria-hidden": "true",
8373
+ className: "h-8 w-8 text-success"
8374
+ }),
8375
+ /* @__PURE__ */ jsx("p", {
8376
+ className: "font-heading text-xl font-semibold",
8377
+ children: successTitle
8378
+ }),
8379
+ /* @__PURE__ */ jsx("p", {
8380
+ className: "text-muted-foreground",
8381
+ children: successMessage
8382
+ })
8383
+ ]
8384
+ }) : /* @__PURE__ */ jsxs(Form, {
8385
+ formMode,
8386
+ schema,
8387
+ errors: fieldErrors,
8388
+ onSubmit: handleSubmit,
8389
+ className: "flex flex-col gap-5",
8390
+ children: [
8391
+ /* @__PURE__ */ jsx(FormError, { message: error }),
8392
+ fields.map((field) => /* @__PURE__ */ jsx(FormField, {
8393
+ name: field.key,
8394
+ id: `${formId}-${field.key}`,
8395
+ label: field.label,
8396
+ required: field.required,
8397
+ description: field.description,
8398
+ children: /* @__PURE__ */ jsx(Control, {
8399
+ field,
8400
+ disabled: disabled || loading,
8401
+ register: rhf ? register : void 0
8402
+ })
8403
+ }, field.key)),
8404
+ /* @__PURE__ */ jsx(Button, {
8405
+ type: "submit",
8406
+ className: "self-start",
8407
+ loading,
8408
+ disabled: disabled || loading,
8409
+ children: submitLabel
8410
+ })
8411
+ ]
8412
+ })
8413
+ })]
8414
+ })
8415
+ });
8416
+ });
8417
+ InquiryFormBlock.displayName = "InquiryFormBlock";
8418
+ //#endregion
7954
8419
  //#region src/blocks/marketing/json-ld.tsx
7955
8420
  /**
7956
8421
  * Maps a `NapRecord` — the same object rendered by `NapBlock` — onto
@@ -10569,6 +11034,6 @@ const ContrastStrip = React.forwardRef(({ checks, mode = "both", failingOnly = f
10569
11034
  });
10570
11035
  ContrastStrip.displayName = "ContrastStrip";
10571
11036
  //#endregion
10572
- export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, AccountSettingsBlock, Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, AppSidebarBlock, AspectRatio, Avatar, AvatarFallback, AvatarImage, Badge, BisonProvider, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, CHROME_LOOK_CLASSES, Calendar, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, Checkbox, ChoiceboxGroup, ChoiceboxItem, CodeInput, Collapsible, CollapsibleContent, CollapsibleTrigger, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, ContrastStrip, CurrencyInput, DataTable, DataTableColumnHeader, DatePicker, DateRangePicker, DensityProvider, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EditableTitle, EmptyStateBlock, FAQColumnsBlock, FIELD_LABEL_SPACING, FIELD_NOTE_SPACING, FeatureChecklistBlock, FeatureHighlightsBlock, FieldGroupScope, FieldNote, FieldProvider, FilterButton, FloatingNavBlock, FooterBlock, ForgotPasswordBlock, Form, FormError, FormField, HeaderBlock, HeroCompact, HeroSimple, HeroSweep, Input, InputGroup, JsonLd, Kbd, Label, LookSurface, MaintenanceBlock, MediaCard, MegaMenuPanel, NapBlock, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, NotFoundBlock, NotificationSettingsBlock, OutlinedField, PageShell, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, PasswordInput, PhoneInput, Popover, PopoverContent, PopoverTrigger, ProcessStepsBlock, ProfileSettingsBlock, Progress, ProgressBar, RadioGroup, RadioGroupItem, Rating, ResetPasswordBlock, ResourcesBlock, ReviewsBlock, RotatingBadge, SavedPing, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectSeparator, SelectTrigger, SelectValue, Separator, ServerErrorBlock, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, ShowcasePanelsBlock, Sidebar, SidebarBlock, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, SignInBlock, SignUpBlock, Skeleton, Slider, SocialFeedBlock, SocialProviders, Spinner, StatsBandBlock, Stepper, StepperDescription, StepperIndicator, StepperItem, StepperLabel, StepperSeparator, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, TestimonialCarousel, TestimonialMasonry, TextContent, TextEditor, Textarea, ThemeProvider, ThemeScope, ThemeShowcase, TimePicker, Toaster, Tooltip, TooltipArrow, TooltipContent, TooltipDescription, TooltipMedia, TooltipProvider, TooltipShortcut, TooltipTitle, TooltipTrigger, VerifyBlock, actionNegativeToneClasses, actionNeutralIconChromeClasses, actionNeutralToneClasses, actionPositiveToneClasses, alertVariants, avatarVariants, avgFooter, badgeVariants, buttonVariants, cn, countFooter, dateRangePresets, editableTitleVariants, describedBy as fieldDescribedBy, fieldSpacing, filterChips, filterCount, formatUsPhone, megaMenuGridColumns, megaMenuToFloatingNavItems, megaMenuVariantsFromLooks, megaMenuVariantsFromTones, napRecordToJsonLd, navigationMenuTriggerStyle, newTabAttributes, outlinedFieldNestResetClasses, parseUsPhoneDigits, progressBarVariants, ratingVariants, renderPlainLink, spinnerVariants, splitFieldNotes, stepperIndicatorVariants, stepperItemVariants, stepperLabelVariants, sumFooter, switchVariants, testimonialInitials, themeShowcaseSections, toColumnFilters, toast, toggleFilter, useCarousel, useDensity, useField, useFieldControl, useFieldGroup, useFieldIds, useFieldNotes, useFormContext, useHideOnScroll, useIsMobile, useScrollReveal, useSidebar, useTheme };
11037
+ export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, AccountSettingsBlock, Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, AppSidebarBlock, AspectRatio, Avatar, AvatarFallback, AvatarImage, Badge, BisonProvider, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, CHROME_LOOK_CLASSES, Calendar, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, Checkbox, ChoiceboxGroup, ChoiceboxItem, CodeInput, Collapsible, CollapsibleContent, CollapsibleTrigger, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, ContrastStrip, CurrencyInput, DataTable, DataTableColumnHeader, DatePicker, DateRangePicker, DensityProvider, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EditableTitle, EmptyStateBlock, FAQColumnsBlock, FIELD_LABEL_SPACING, FIELD_NOTE_SPACING, FeatureChecklistBlock, FeatureHighlightsBlock, FieldGroupScope, FieldNote, FieldProvider, FilterButton, FloatingNavBlock, FooterBlock, ForgotPasswordBlock, Form, FormError, FormField, HeaderBlock, HeroCompact, HeroSimple, HeroSweep, Input, InputGroup, InquiryFormBlock, JsonLd, Kbd, Label, LookSurface, MaintenanceBlock, MediaCard, MegaMenuPanel, NapBlock, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, NotFoundBlock, NotificationSettingsBlock, OutlinedField, PageShell, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, PasswordInput, PhoneInput, Popover, PopoverContent, PopoverTrigger, ProcessStepsBlock, ProfileSettingsBlock, Progress, ProgressBar, RadioGroup, RadioGroupItem, Rating, ResetPasswordBlock, ResourcesBlock, ReviewsBlock, RotatingBadge, SavedPing, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectSeparator, SelectTrigger, SelectValue, Separator, ServerErrorBlock, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, ShowcasePanelsBlock, Sidebar, SidebarBlock, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, SignInBlock, SignUpBlock, Skeleton, Slider, SocialFeedBlock, SocialProviders, Spinner, StatsBandBlock, Stepper, StepperDescription, StepperIndicator, StepperItem, StepperLabel, StepperSeparator, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, TestimonialCarousel, TestimonialMasonry, TextContent, TextEditor, Textarea, ThemeProvider, ThemeScope, ThemeShowcase, TimePicker, Toaster, Tooltip, TooltipArrow, TooltipContent, TooltipDescription, TooltipMedia, TooltipProvider, TooltipShortcut, TooltipTitle, TooltipTrigger, VerifyBlock, VideoBlock, actionNegativeToneClasses, actionNeutralIconChromeClasses, actionNeutralToneClasses, actionPositiveToneClasses, alertVariants, avatarVariants, avgFooter, badgeVariants, buttonVariants, cn, countFooter, dateRangePresets, editableTitleVariants, describedBy as fieldDescribedBy, fieldSpacing, filterChips, filterCount, formatUsPhone, inlineEmphasis, inquiryFormSchema, megaMenuGridColumns, megaMenuToFloatingNavItems, megaMenuVariantsFromLooks, megaMenuVariantsFromTones, napRecordToJsonLd, navigationMenuTriggerStyle, newTabAttributes, outlinedFieldNestResetClasses, parseUsPhoneDigits, progressBarVariants, ratingVariants, renderPlainLink, spinnerVariants, splitFieldNotes, stepperIndicatorVariants, stepperItemVariants, stepperLabelVariants, sumFooter, switchVariants, testimonialInitials, themeShowcaseSections, toColumnFilters, toast, toggleFilter, useCarousel, useDensity, useField, useFieldControl, useFieldGroup, useFieldIds, useFieldNotes, useFormContext, useHideOnScroll, useIsMobile, useScrollReveal, useSidebar, useTheme, videoEmbedUrl };
10573
11038
 
10574
11039
  //# sourceMappingURL=index.mjs.map