@forms.expert/sdk 0.4.0 → 0.4.2
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/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +4 -3
- package/dist/core/index.d.ts +4 -3
- package/dist/core/index.js.map +1 -1
- package/dist/react/index.cjs +15 -12
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +4 -3
- package/dist/react/index.d.ts +4 -3
- package/dist/react/index.js +15 -12
- package/dist/react/index.js.map +1 -1
- package/dist/vanilla/index.cjs +21 -19
- package/dist/vanilla/index.cjs.map +1 -1
- package/dist/vanilla/index.d.cts +4 -3
- package/dist/vanilla/index.d.ts +4 -3
- package/dist/vanilla/index.global.js +21 -19
- package/dist/vanilla/index.global.js.map +1 -1
- package/dist/vanilla/index.js +19 -17
- package/dist/vanilla/index.js.map +1 -1
- package/dist/vue/index.cjs.map +1 -1
- package/dist/vue/index.d.cts +4 -3
- package/dist/vue/index.d.ts +4 -3
- package/dist/vue/index.js.map +1 -1
- package/package.json +1 -1
package/dist/react/index.d.cts
CHANGED
|
@@ -42,6 +42,7 @@ interface FormField {
|
|
|
42
42
|
paragraphFontSize?: number;
|
|
43
43
|
consentText?: string;
|
|
44
44
|
consentUrl?: string;
|
|
45
|
+
consentFontSize?: number;
|
|
45
46
|
maxLength?: number;
|
|
46
47
|
stepId?: string;
|
|
47
48
|
visibleWhen?: {
|
|
@@ -75,15 +76,15 @@ interface SecondaryButton {
|
|
|
75
76
|
* Form styling configuration
|
|
76
77
|
*/
|
|
77
78
|
interface FormStyling {
|
|
78
|
-
theme: 'light' | 'dark' | 'system';
|
|
79
|
+
theme: 'light' | 'dark' | 'system' | 'custom';
|
|
79
80
|
primaryColor: string;
|
|
80
81
|
backgroundColor: string;
|
|
81
82
|
textColor: string;
|
|
82
83
|
errorColor?: string;
|
|
83
84
|
successColor?: string;
|
|
84
85
|
borderRadius: 'none' | 'sm' | 'md' | 'lg';
|
|
85
|
-
fontSize: 'sm' | 'md' | 'lg';
|
|
86
|
-
buttonStyle: 'filled' | 'outline';
|
|
86
|
+
fontSize: 'sm' | 'md' | 'lg' | 'small' | 'medium' | 'large';
|
|
87
|
+
buttonStyle: 'filled' | 'outline' | 'outlined' | 'minimal';
|
|
87
88
|
labelPosition: 'top' | 'left' | 'floating';
|
|
88
89
|
labelClassName?: string;
|
|
89
90
|
fieldClassName?: string;
|
package/dist/react/index.d.ts
CHANGED
|
@@ -42,6 +42,7 @@ interface FormField {
|
|
|
42
42
|
paragraphFontSize?: number;
|
|
43
43
|
consentText?: string;
|
|
44
44
|
consentUrl?: string;
|
|
45
|
+
consentFontSize?: number;
|
|
45
46
|
maxLength?: number;
|
|
46
47
|
stepId?: string;
|
|
47
48
|
visibleWhen?: {
|
|
@@ -75,15 +76,15 @@ interface SecondaryButton {
|
|
|
75
76
|
* Form styling configuration
|
|
76
77
|
*/
|
|
77
78
|
interface FormStyling {
|
|
78
|
-
theme: 'light' | 'dark' | 'system';
|
|
79
|
+
theme: 'light' | 'dark' | 'system' | 'custom';
|
|
79
80
|
primaryColor: string;
|
|
80
81
|
backgroundColor: string;
|
|
81
82
|
textColor: string;
|
|
82
83
|
errorColor?: string;
|
|
83
84
|
successColor?: string;
|
|
84
85
|
borderRadius: 'none' | 'sm' | 'md' | 'lg';
|
|
85
|
-
fontSize: 'sm' | 'md' | 'lg';
|
|
86
|
-
buttonStyle: 'filled' | 'outline';
|
|
86
|
+
fontSize: 'sm' | 'md' | 'lg' | 'small' | 'medium' | 'large';
|
|
87
|
+
buttonStyle: 'filled' | 'outline' | 'outlined' | 'minimal';
|
|
87
88
|
labelPosition: 'top' | 'left' | 'floating';
|
|
88
89
|
labelClassName?: string;
|
|
89
90
|
fieldClassName?: string;
|
package/dist/react/index.js
CHANGED
|
@@ -633,10 +633,13 @@ function getButtonRadius(radius) {
|
|
|
633
633
|
function getFontSize(size) {
|
|
634
634
|
switch (size) {
|
|
635
635
|
case "sm":
|
|
636
|
+
case "small":
|
|
636
637
|
return "0.875rem";
|
|
637
638
|
case "md":
|
|
639
|
+
case "medium":
|
|
638
640
|
return "1rem";
|
|
639
641
|
case "lg":
|
|
642
|
+
case "large":
|
|
640
643
|
return "1.125rem";
|
|
641
644
|
default:
|
|
642
645
|
return "1rem";
|
|
@@ -1106,7 +1109,7 @@ function FormsExpertForm({
|
|
|
1106
1109
|
group.field.name
|
|
1107
1110
|
);
|
|
1108
1111
|
}
|
|
1109
|
-
return /* @__PURE__ */ jsx2("div", { style: { display: "flex", gap: "0.75rem", flexWrap: "wrap", marginBottom: fieldSpacing }, children: group.fields.map((f) => /* @__PURE__ */ jsx2("div", { style: { flex: getWidthPercent(f.width) ? `0 0 calc(${getWidthPercent(f.width)} - 0.75rem)` : "1 1 0", minWidth: "
|
|
1112
|
+
return /* @__PURE__ */ jsx2("div", { style: { display: "flex", gap: "0.75rem", flexWrap: "wrap", marginBottom: fieldSpacing }, children: group.fields.map((f) => /* @__PURE__ */ jsx2("div", { style: { flex: getWidthPercent(f.width) ? `0 0 calc(${getWidthPercent(f.width)} - 0.75rem)` : "1 1 0", minWidth: "180px" }, children: /* @__PURE__ */ jsx2(
|
|
1110
1113
|
FormFieldInput,
|
|
1111
1114
|
{
|
|
1112
1115
|
field: f,
|
|
@@ -1320,7 +1323,8 @@ function FormFieldInput({
|
|
|
1320
1323
|
return /* @__PURE__ */ jsx2("input", { type: "hidden", name: field.name, value: String(value || field.defaultValue || "") });
|
|
1321
1324
|
}
|
|
1322
1325
|
if (field.type === "checkbox" || field.type === "toggle" || field.type === "consent") {
|
|
1323
|
-
|
|
1326
|
+
const consentSize = field.type === "consent" && field.consentFontSize ? `${field.consentFontSize}px` : void 0;
|
|
1327
|
+
return /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "flex-start", gap: "0.5rem", marginBottom: fieldSpacing }, children: [
|
|
1324
1328
|
/* @__PURE__ */ jsx2(
|
|
1325
1329
|
"input",
|
|
1326
1330
|
{
|
|
@@ -1330,18 +1334,17 @@ function FormFieldInput({
|
|
|
1330
1334
|
checked: Boolean(value),
|
|
1331
1335
|
onChange,
|
|
1332
1336
|
required: field.required,
|
|
1333
|
-
style: { width: "1rem", height: "1rem", accentColor: styling.primaryColor }
|
|
1337
|
+
style: { width: "1rem", height: "1rem", accentColor: styling.primaryColor, marginTop: "0.125rem", flexShrink: 0 }
|
|
1334
1338
|
}
|
|
1335
1339
|
),
|
|
1336
|
-
|
|
1337
|
-
field.type === "consent" && field.consentText
|
|
1338
|
-
field.consentText,
|
|
1339
|
-
" ",
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
] })
|
|
1344
|
-
error && /* @__PURE__ */ jsx2("span", { style: { color: styling.errorColor || "#ef4444", fontSize: "0.875rem", marginLeft: "0.5rem" }, children: error })
|
|
1340
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
1341
|
+
(field.label || field.type === "consent" && field.consentText) && /* @__PURE__ */ jsxs("label", { htmlFor: field.name, className: styling.labelClassName, style: { cursor: "pointer", ...consentSize ? { fontSize: consentSize } : {} }, children: [
|
|
1342
|
+
field.type === "consent" && field.consentText ? field.consentText : field.label,
|
|
1343
|
+
field.required && !styling.hideRequiredAsterisk && /* @__PURE__ */ jsx2("span", { style: { color: "#ef4444", marginLeft: "0.25rem" }, children: "*" })
|
|
1344
|
+
] }),
|
|
1345
|
+
field.type === "consent" && field.consentUrl && /* @__PURE__ */ jsx2("a", { href: field.consentUrl, target: "_blank", rel: "noopener noreferrer", style: { color: styling.primaryColor, fontSize: "0.75rem", marginTop: "0.125rem", display: "inline-block" }, children: "View policy" }),
|
|
1346
|
+
error && /* @__PURE__ */ jsx2("div", { style: { color: styling.errorColor || "#ef4444", fontSize: "0.875rem", marginTop: "0.25rem" }, children: error })
|
|
1347
|
+
] })
|
|
1345
1348
|
] });
|
|
1346
1349
|
}
|
|
1347
1350
|
const labelEl = field.label ? /* @__PURE__ */ jsxs(
|