@ohhwells/bridge 0.1.67-next.194 → 0.1.67-next.195

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.cjs CHANGED
@@ -7181,6 +7181,7 @@ function applyFieldType(wrapper, type) {
7181
7181
  if (inputType) input.type = inputType;
7182
7182
  shedSize(input);
7183
7183
  applyDefaults(input);
7184
+ requireIfEmail(wrapper, type);
7184
7185
  return;
7185
7186
  }
7186
7187
  const next = document.createElement(tag);
@@ -7193,6 +7194,11 @@ function applyFieldType(wrapper, type) {
7193
7194
  if (type === "long-text") next.setAttribute("rows", "4");
7194
7195
  input.replaceWith(next);
7195
7196
  applyDefaults(next);
7197
+ requireIfEmail(wrapper, type);
7198
+ }
7199
+ function requireIfEmail(wrapper, type) {
7200
+ if (type !== "email") return;
7201
+ setFieldRequired(wrapper, true);
7196
7202
  }
7197
7203
  var REQUIRED_MARK_ATTR = "data-ohw-field-required";
7198
7204
  function fieldLabelText(label) {
@@ -7275,6 +7281,7 @@ function insertField(form, type) {
7275
7281
  const label = ensureFieldLabel(wrapper, key);
7276
7282
  label.textContent = defaults.label;
7277
7283
  label.setAttribute("data-ohw-key", `${key}-label`);
7284
+ requireIfEmail(wrapper, type);
7278
7285
  return wrapper;
7279
7286
  }
7280
7287
  function duplicateField(form, wrapper) {
@@ -7416,7 +7423,7 @@ function FormFieldToolbar({
7416
7423
  "aria-pressed": required,
7417
7424
  onClick: onRequiredToggle,
7418
7425
  className: "flex h-7 items-center gap-1.5 whitespace-nowrap rounded-md px-2 text-[13px] font-medium transition-colors " + (required ? "bg-primary/10 text-primary" : "text-foreground hover:bg-muted/70"),
7419
- "data-ohw-field-required": "",
7426
+ "data-ohw-field-required-toggle": "",
7420
7427
  children: [
7421
7428
  /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react4.Asterisk, { size: 14, strokeWidth: 2, "aria-hidden": true }),
7422
7429
  "Required"
@@ -20820,14 +20827,20 @@ function OhhwellsBridge() {
20820
20827
  },
20821
20828
  `field-drop-${i}`
20822
20829
  )) : null,
20823
- fieldTypePickerOpen && formPickRect && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
20824
- "div",
20825
- {
20826
- className: "pointer-events-none fixed z-[2147483645]",
20827
- style: { top: formPickRect.top + 16, left: formPickRect.left + 24 },
20828
- children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(FieldTypePicker, { onPick: handleAddField })
20829
- }
20830
- ),
20830
+ fieldTypePickerOpen && formPickRect ? (() => {
20831
+ const toolbar = document.querySelector("[data-ohw-form-toolbar]")?.getBoundingClientRect();
20832
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
20833
+ "div",
20834
+ {
20835
+ className: "pointer-events-none fixed z-[2147483645]",
20836
+ style: {
20837
+ top: toolbar ? toolbar.bottom + 6 : formPickRect.top + 16,
20838
+ left: toolbar ? toolbar.left : formPickRect.left + 24
20839
+ },
20840
+ children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(FieldTypePicker, { onPick: handleAddField })
20841
+ }
20842
+ );
20843
+ })() : null,
20831
20844
  toolbarVariant === "select-frame" && toolbarRect && !linkPopover && !isItemDragging && !isFooterFrameSelection && selectedElRef.current && isNavbarLinksContainer2(selectedElRef.current) && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(NavbarContainerChrome, { rect: toolbarRect, onAdd: handleAddTopLevelNavItem }),
20832
20845
  toolbarVariant === "select-frame" && toolbarRect && !linkPopover && !isItemDragging && !isFooterFrameSelection && selectedElRef.current && isFooterLinksContainer(selectedElRef.current) && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
20833
20846
  FooterContainerChrome,