@forms.expert/sdk 0.4.6 → 0.4.8

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.
@@ -1113,140 +1113,142 @@ function FormsExpertForm({
1113
1113
  marginBottom: "0.5rem",
1114
1114
  color: styling.textColor
1115
1115
  }, children: form.config.hostedConfig?.pageTitle || form.config.name }),
1116
- groupFieldsIntoRows(fields).map((group, idx) => {
1117
- if (group.type === "single") {
1118
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1116
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: styling.buttonAlign === "inline" ? { display: "flex", alignItems: "flex-end", gap: "0.75rem", flexWrap: "wrap" } : void 0, children: [
1117
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { style: styling.buttonAlign === "inline" ? { flex: "1 1 0", minWidth: "180px" } : void 0, children: groupFieldsIntoRows(fields).map((group, idx) => {
1118
+ if (group.type === "single") {
1119
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1120
+ FormFieldInput,
1121
+ {
1122
+ field: group.field,
1123
+ value: form.values[group.field.name],
1124
+ error: form.errors[group.field.name],
1125
+ onChange: handleChange,
1126
+ onValueChange: (name, val) => form.setValue(name, val),
1127
+ styling,
1128
+ fieldSpacing,
1129
+ labelSpacing,
1130
+ phFontSize
1131
+ },
1132
+ group.field.name
1133
+ );
1134
+ }
1135
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { style: { display: "flex", gap: "0.75rem", flexWrap: "wrap", marginBottom: fieldSpacing }, children: group.fields.map((f) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { style: { flex: getWidthPercent(f.width) ? `0 0 calc(${getWidthPercent(f.width)} - 0.75rem)` : "1 1 0", minWidth: "180px" }, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1119
1136
  FormFieldInput,
1120
1137
  {
1121
- field: group.field,
1122
- value: form.values[group.field.name],
1123
- error: form.errors[group.field.name],
1138
+ field: f,
1139
+ value: form.values[f.name],
1140
+ error: form.errors[f.name],
1124
1141
  onChange: handleChange,
1125
1142
  onValueChange: (name, val) => form.setValue(name, val),
1126
1143
  styling,
1127
- fieldSpacing,
1144
+ fieldSpacing: "0",
1128
1145
  labelSpacing,
1129
1146
  phFontSize
1130
- },
1131
- group.field.name
1132
- );
1133
- }
1134
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { style: { display: "flex", gap: "0.75rem", flexWrap: "wrap", marginBottom: fieldSpacing }, children: group.fields.map((f) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { style: { flex: getWidthPercent(f.width) ? `0 0 calc(${getWidthPercent(f.width)} - 0.75rem)` : "1 1 0", minWidth: "180px" }, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1135
- FormFieldInput,
1136
- {
1137
- field: f,
1138
- value: form.values[f.name],
1139
- error: form.errors[f.name],
1140
- onChange: handleChange,
1141
- onValueChange: (name, val) => form.setValue(name, val),
1142
- styling,
1143
- fieldSpacing: "0",
1144
- labelSpacing,
1145
- phFontSize
1146
- }
1147
- ) }, f.name)) }, `row-${idx}`);
1148
- }),
1149
- form.honeypotEnabled && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { style: { position: "absolute", left: "-9999px", opacity: 0, height: 0, overflow: "hidden" }, "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("input", { type: "text", name: "_hp", tabIndex: -1, autoComplete: "off" }) }),
1150
- form.requiresCaptcha && form.captchaProvider !== "recaptcha" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { ref: captchaContainerRef, style: { marginTop: "1rem" } }),
1151
- (() => {
1152
- const btnSizeMap = {
1153
- small: { px: "0.75rem", py: "0.375rem", fs: "0.875rem" },
1154
- medium: { px: "1.25rem", py: "0.625rem", fs: "1rem" },
1155
- large: { px: "1.75rem", py: "0.875rem", fs: "1.125rem" }
1156
- };
1157
- const btnSize = btnSizeMap[styling.buttonSize || "medium"];
1158
- const btnPx = styling.buttonPaddingX != null ? `${styling.buttonPaddingX}px` : btnSize.px;
1159
- const btnPy = styling.buttonPaddingY != null ? `${styling.buttonPaddingY}px` : btnSize.py;
1160
- const btnFs = styling.buttonFontSize != null ? `${styling.buttonFontSize}px` : btnSize.fs;
1161
- const btnBg = styling.buttonGradient || (styling.buttonStyle === "filled" ? btnBgColor : "transparent");
1162
- const sec = styling.secondaryButton;
1163
- const secColor = sec?.color || btnBgColor;
1164
- const secStyle = sec?.enabled ? {
1165
- display: "inline-flex",
1166
- alignItems: "center",
1167
- justifyContent: "center",
1168
- padding: `${btnPy} ${btnPx}`,
1169
- fontWeight: 500,
1170
- fontSize: sec.fontSize != null ? `${sec.fontSize}px` : btnFs,
1171
- fontFamily: "inherit",
1172
- borderRadius: btnRadius,
1173
- cursor: "pointer",
1174
- textDecoration: sec.style === "link" ? "underline" : "none",
1175
- background: sec.style === "filled" ? secColor : "transparent",
1176
- color: sec.textColor || (sec.style === "filled" ? "#ffffff" : secColor),
1177
- border: sec.style === "outlined" ? `2px solid ${secColor}` : "none",
1178
- marginTop: sec.marginTop != null ? `${sec.marginTop}px` : void 0,
1179
- marginBottom: sec.marginBottom != null ? `${sec.marginBottom}px` : void 0,
1180
- maxWidth: "100%",
1181
- boxSizing: "border-box",
1182
- flexShrink: 1,
1183
- minWidth: 0,
1184
- whiteSpace: "nowrap",
1185
- overflow: "hidden",
1186
- textOverflow: "ellipsis"
1187
- } : void 0;
1188
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
1189
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: { display: "flex", justifyContent: btnAlign, marginTop: "1rem", gap: "0.5rem", flexWrap: "wrap" }, children: [
1190
- sec?.enabled && secStyle && sec.position === "left" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("a", { href: sec.href || "#", target: sec.openInNewTab ? "_blank" : void 0, rel: sec.openInNewTab ? "noopener noreferrer" : void 0, style: { ...secStyle, display: "inline-flex", alignItems: "center", gap: "0.5rem" }, children: [
1191
- sec.icon && sec.iconPosition !== "right" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { style: { display: "inline-flex", flexShrink: 0 }, dangerouslySetInnerHTML: { __html: sec.icon } }),
1192
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: sec.text || "Learn More" }),
1193
- sec.icon && sec.iconPosition === "right" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { style: { display: "inline-flex", flexShrink: 0 }, dangerouslySetInnerHTML: { __html: sec.icon } })
1147
+ }
1148
+ ) }, f.name)) }, `row-${idx}`);
1149
+ }) }),
1150
+ form.honeypotEnabled && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { style: { position: "absolute", left: "-9999px", opacity: 0, height: 0, overflow: "hidden" }, "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("input", { type: "text", name: "_hp", tabIndex: -1, autoComplete: "off" }) }),
1151
+ form.requiresCaptcha && form.captchaProvider !== "recaptcha" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { ref: captchaContainerRef, style: { marginTop: "1rem" } }),
1152
+ (() => {
1153
+ const btnSizeMap = {
1154
+ small: { px: "0.75rem", py: "0.375rem", fs: "0.875rem" },
1155
+ medium: { px: "1.25rem", py: "0.625rem", fs: "1rem" },
1156
+ large: { px: "1.75rem", py: "0.875rem", fs: "1.125rem" }
1157
+ };
1158
+ const btnSize = btnSizeMap[styling.buttonSize || "medium"];
1159
+ const btnPx = styling.buttonPaddingX != null ? `${styling.buttonPaddingX}px` : btnSize.px;
1160
+ const btnPy = styling.buttonPaddingY != null ? `${styling.buttonPaddingY}px` : btnSize.py;
1161
+ const btnFs = styling.buttonFontSize != null ? `${styling.buttonFontSize}px` : btnSize.fs;
1162
+ const btnBg = styling.buttonGradient || (styling.buttonStyle === "filled" ? btnBgColor : "transparent");
1163
+ const sec = styling.secondaryButton;
1164
+ const secColor = sec?.color || btnBgColor;
1165
+ const secStyle = sec?.enabled ? {
1166
+ display: "inline-flex",
1167
+ alignItems: "center",
1168
+ justifyContent: "center",
1169
+ padding: `${btnPy} ${btnPx}`,
1170
+ fontWeight: 500,
1171
+ fontSize: sec.fontSize != null ? `${sec.fontSize}px` : btnFs,
1172
+ fontFamily: "inherit",
1173
+ borderRadius: btnRadius,
1174
+ cursor: "pointer",
1175
+ textDecoration: sec.style === "link" ? "underline" : "none",
1176
+ background: sec.style === "filled" ? secColor : "transparent",
1177
+ color: sec.textColor || (sec.style === "filled" ? "#ffffff" : secColor),
1178
+ border: sec.style === "outlined" ? `2px solid ${secColor}` : "none",
1179
+ marginTop: sec.marginTop != null ? `${sec.marginTop}px` : void 0,
1180
+ marginBottom: sec.marginBottom != null ? `${sec.marginBottom}px` : void 0,
1181
+ maxWidth: "100%",
1182
+ boxSizing: "border-box",
1183
+ flexShrink: 1,
1184
+ minWidth: 0,
1185
+ whiteSpace: "nowrap",
1186
+ overflow: "hidden",
1187
+ textOverflow: "ellipsis"
1188
+ } : void 0;
1189
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
1190
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: { display: "flex", justifyContent: btnAlign, marginTop: styling.buttonAlign === "inline" ? void 0 : "1rem", gap: "0.5rem", flexWrap: "wrap" }, children: [
1191
+ sec?.enabled && secStyle && sec.position === "left" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("a", { href: sec.href || "#", target: sec.openInNewTab ? "_blank" : void 0, rel: sec.openInNewTab ? "noopener noreferrer" : void 0, style: { ...secStyle, display: "inline-flex", alignItems: "center", gap: "0.5rem" }, children: [
1192
+ sec.icon && sec.iconPosition !== "right" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { style: { display: "inline-flex", flexShrink: 0 }, dangerouslySetInnerHTML: { __html: sec.icon } }),
1193
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: sec.text || "Learn More" }),
1194
+ sec.icon && sec.iconPosition === "right" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { style: { display: "inline-flex", flexShrink: 0 }, dangerouslySetInnerHTML: { __html: sec.icon } })
1195
+ ] }),
1196
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
1197
+ "button",
1198
+ {
1199
+ type: "submit",
1200
+ disabled: form.isLoading,
1201
+ className: styling.buttonClassName,
1202
+ style: {
1203
+ ...styling.buttonFullWidth ? { width: "100%" } : styling.buttonAlign ? {} : { width: "100%" },
1204
+ padding: `${btnPy} ${btnPx}`,
1205
+ fontWeight: 500,
1206
+ fontSize: btnFs,
1207
+ fontFamily: "inherit",
1208
+ borderRadius: btnRadius,
1209
+ cursor: form.isLoading ? "not-allowed" : "pointer",
1210
+ opacity: form.isLoading ? 0.5 : 1,
1211
+ background: btnBg,
1212
+ color: styling.buttonStyle === "filled" ? btnTextColor || "white" : btnBgColor,
1213
+ border: styling.buttonStyle === "filled" ? "none" : `2px solid ${btnBgColor}`,
1214
+ maxWidth: "100%",
1215
+ boxSizing: "border-box",
1216
+ flexShrink: 1,
1217
+ minWidth: 0,
1218
+ whiteSpace: "nowrap",
1219
+ overflow: "hidden",
1220
+ textOverflow: "ellipsis",
1221
+ display: "inline-flex",
1222
+ alignItems: "center",
1223
+ justifyContent: "center",
1224
+ gap: "0.5rem"
1225
+ },
1226
+ children: [
1227
+ !form.isLoading && styling.buttonIcon && styling.buttonIconPosition !== "right" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { style: { display: "inline-flex", flexShrink: 0 }, dangerouslySetInnerHTML: { __html: styling.buttonIcon } }),
1228
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: form.isLoading ? "Submitting..." : resolvedButtonText }),
1229
+ !form.isLoading && styling.buttonIcon && styling.buttonIconPosition === "right" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { style: { display: "inline-flex", flexShrink: 0 }, dangerouslySetInnerHTML: { __html: styling.buttonIcon } })
1230
+ ]
1231
+ }
1232
+ ),
1233
+ sec?.enabled && secStyle && sec.position !== "left" && sec.position !== "below" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("a", { href: sec.href || "#", target: sec.openInNewTab ? "_blank" : void 0, rel: sec.openInNewTab ? "noopener noreferrer" : void 0, style: { ...secStyle, display: "inline-flex", alignItems: "center", gap: "0.5rem", marginLeft: "auto" }, children: [
1234
+ sec.icon && sec.iconPosition !== "right" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { style: { display: "inline-flex", flexShrink: 0 }, dangerouslySetInnerHTML: { __html: sec.icon } }),
1235
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: sec.text || "Learn More" }),
1236
+ sec.icon && sec.iconPosition === "right" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { style: { display: "inline-flex", flexShrink: 0 }, dangerouslySetInnerHTML: { __html: sec.icon } })
1237
+ ] })
1194
1238
  ] }),
1195
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
1196
- "button",
1197
- {
1198
- type: "submit",
1199
- disabled: form.isLoading,
1200
- className: styling.buttonClassName,
1201
- style: {
1202
- ...styling.buttonFullWidth ? { width: "100%" } : styling.buttonAlign ? {} : { width: "100%" },
1203
- padding: `${btnPy} ${btnPx}`,
1204
- fontWeight: 500,
1205
- fontSize: btnFs,
1206
- fontFamily: "inherit",
1207
- borderRadius: btnRadius,
1208
- cursor: form.isLoading ? "not-allowed" : "pointer",
1209
- opacity: form.isLoading ? 0.5 : 1,
1210
- background: btnBg,
1211
- color: styling.buttonStyle === "filled" ? btnTextColor || "white" : btnBgColor,
1212
- border: styling.buttonStyle === "filled" ? "none" : `2px solid ${btnBgColor}`,
1213
- maxWidth: "100%",
1214
- boxSizing: "border-box",
1215
- flexShrink: 1,
1216
- minWidth: 0,
1217
- whiteSpace: "nowrap",
1218
- overflow: "hidden",
1219
- textOverflow: "ellipsis",
1220
- display: "inline-flex",
1221
- alignItems: "center",
1222
- justifyContent: "center",
1223
- gap: "0.5rem"
1224
- },
1225
- children: [
1226
- !form.isLoading && styling.buttonIcon && styling.buttonIconPosition !== "right" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { style: { display: "inline-flex", flexShrink: 0 }, dangerouslySetInnerHTML: { __html: styling.buttonIcon } }),
1227
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: form.isLoading ? "Submitting..." : resolvedButtonText }),
1228
- !form.isLoading && styling.buttonIcon && styling.buttonIconPosition === "right" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { style: { display: "inline-flex", flexShrink: 0 }, dangerouslySetInnerHTML: { __html: styling.buttonIcon } })
1229
- ]
1230
- }
1231
- ),
1232
- sec?.enabled && secStyle && sec.position !== "left" && sec.position !== "below" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("a", { href: sec.href || "#", target: sec.openInNewTab ? "_blank" : void 0, rel: sec.openInNewTab ? "noopener noreferrer" : void 0, style: { ...secStyle, display: "inline-flex", alignItems: "center", gap: "0.5rem", marginLeft: "auto" }, children: [
1239
+ sec?.enabled && secStyle && sec.position === "below" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { style: {
1240
+ display: "flex",
1241
+ justifyContent: sec.align === "center" ? "center" : sec.align === "right" ? "flex-end" : sec.align === "left" ? "flex-start" : btnAlign,
1242
+ marginTop: sec.marginTop != null ? `${sec.marginTop}px` : "0.5rem",
1243
+ marginBottom: sec.marginBottom != null ? `${sec.marginBottom}px` : void 0
1244
+ }, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("a", { href: sec.href || "#", target: sec.openInNewTab ? "_blank" : void 0, rel: sec.openInNewTab ? "noopener noreferrer" : void 0, style: { ...secStyle, display: "inline-flex", alignItems: "center", gap: "0.5rem", marginTop: 0, marginBottom: 0 }, children: [
1233
1245
  sec.icon && sec.iconPosition !== "right" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { style: { display: "inline-flex", flexShrink: 0 }, dangerouslySetInnerHTML: { __html: sec.icon } }),
1234
1246
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: sec.text || "Learn More" }),
1235
1247
  sec.icon && sec.iconPosition === "right" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { style: { display: "inline-flex", flexShrink: 0 }, dangerouslySetInnerHTML: { __html: sec.icon } })
1236
- ] })
1237
- ] }),
1238
- sec?.enabled && secStyle && sec.position === "below" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { style: {
1239
- display: "flex",
1240
- justifyContent: sec.align === "center" ? "center" : sec.align === "right" ? "flex-end" : sec.align === "left" ? "flex-start" : btnAlign,
1241
- marginTop: sec.marginTop != null ? `${sec.marginTop}px` : "0.5rem",
1242
- marginBottom: sec.marginBottom != null ? `${sec.marginBottom}px` : void 0
1243
- }, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("a", { href: sec.href || "#", target: sec.openInNewTab ? "_blank" : void 0, rel: sec.openInNewTab ? "noopener noreferrer" : void 0, style: { ...secStyle, display: "inline-flex", alignItems: "center", gap: "0.5rem", marginTop: 0, marginBottom: 0 }, children: [
1244
- sec.icon && sec.iconPosition !== "right" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { style: { display: "inline-flex", flexShrink: 0 }, dangerouslySetInnerHTML: { __html: sec.icon } }),
1245
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: sec.text || "Learn More" }),
1246
- sec.icon && sec.iconPosition === "right" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { style: { display: "inline-flex", flexShrink: 0 }, dangerouslySetInnerHTML: { __html: sec.icon } })
1247
- ] }) })
1248
- ] });
1249
- })(),
1248
+ ] }) })
1249
+ ] });
1250
+ })()
1251
+ ] }),
1250
1252
  showBranding && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1251
1253
  "div",
1252
1254
  {
@@ -1306,6 +1308,7 @@ function FormFieldInput({
1306
1308
  const isBottomBorder = styling.fieldBorderStyle === "bottom";
1307
1309
  const fieldPadding = styling.fieldPaddingX != null || styling.fieldPaddingY != null ? `${styling.fieldPaddingY ?? 8}px ${styling.fieldPaddingX ?? 12}px` : "0.5rem 0.75rem";
1308
1310
  const defaultBorderColor = error ? "#ef4444" : styling.fieldBorderColor || (styling.theme === "dark" ? "#4b5563" : "#d1d5db");
1311
+ const [selectOpen, setSelectOpen] = (0, import_react2.useState)(false);
1309
1312
  const inputStyle = {
1310
1313
  width: "100%",
1311
1314
  padding: fieldPadding,
@@ -1404,9 +1407,68 @@ function FormFieldInput({
1404
1407
  }
1405
1408
  );
1406
1409
  } else if (field.type === "select" || field.type === "dropdown") {
1407
- fieldEl = /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("select", { id: field.name, name: field.name, value: String(value || ""), onChange, required: field.required, style: inputStyle, className: styling.fieldClassName, children: [
1408
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "", children: "Select an option..." }),
1409
- getOpts().map((opt) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: opt.value, children: opt.label }, opt.value))
1410
+ const opts = getOpts();
1411
+ const selectedLabel = opts.find((o) => o.value === String(value || ""))?.label;
1412
+ fieldEl = /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: { position: "relative", width: "100%" }, className: styling.fieldClassName, children: [
1413
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
1414
+ "button",
1415
+ {
1416
+ type: "button",
1417
+ id: field.name,
1418
+ onClick: () => setSelectOpen((v) => !v),
1419
+ onBlur: () => setTimeout(() => setSelectOpen(false), 150),
1420
+ style: {
1421
+ ...inputStyle,
1422
+ display: "flex",
1423
+ alignItems: "center",
1424
+ justifyContent: "space-between",
1425
+ cursor: "pointer",
1426
+ textAlign: "left"
1427
+ },
1428
+ children: [
1429
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { style: !selectedLabel ? { color: styling.placeholderColor || (styling.theme === "dark" ? "#9ca3af" : "#9ca3af") } : void 0, children: selectedLabel || field.placeholder || "Select an option..." }),
1430
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", style: { flexShrink: 0, opacity: 0.5 }, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M3 4.5L6 7.5L9 4.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) })
1431
+ ]
1432
+ }
1433
+ ),
1434
+ selectOpen && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { style: {
1435
+ position: "absolute",
1436
+ top: "100%",
1437
+ left: 0,
1438
+ right: 0,
1439
+ zIndex: 50,
1440
+ marginTop: "4px",
1441
+ backgroundColor: inputStyle.backgroundColor,
1442
+ border: inputStyle.border,
1443
+ borderRadius: inputStyle.borderRadius,
1444
+ boxShadow: "0 4px 12px rgba(0,0,0,0.15)",
1445
+ maxHeight: "200px",
1446
+ overflowY: "auto"
1447
+ }, children: opts.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1448
+ "div",
1449
+ {
1450
+ onMouseDown: (e) => {
1451
+ e.preventDefault();
1452
+ onValueChange(field.name, opt.value);
1453
+ setSelectOpen(false);
1454
+ },
1455
+ style: {
1456
+ padding: inputStyle.padding,
1457
+ cursor: "pointer",
1458
+ backgroundColor: String(value || "") === opt.value ? styling.primaryColor + "20" : "transparent",
1459
+ fontSize: inputStyle.fontSize
1460
+ },
1461
+ onMouseEnter: (e) => {
1462
+ e.currentTarget.style.backgroundColor = styling.primaryColor + "15";
1463
+ },
1464
+ onMouseLeave: (e) => {
1465
+ e.currentTarget.style.backgroundColor = String(value || "") === opt.value ? styling.primaryColor + "20" : "transparent";
1466
+ },
1467
+ children: opt.label
1468
+ },
1469
+ opt.value
1470
+ )) }),
1471
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("input", { type: "hidden", name: field.name, value: String(value || ""), required: field.required })
1410
1472
  ] });
1411
1473
  } else if (field.type === "radio") {
1412
1474
  fieldEl = /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { style: {