@unlev/exeq 0.2.0 → 0.2.1
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.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +31 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +31 -13
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -38,6 +38,12 @@ var FIELD_DEFAULTS = {
|
|
|
38
38
|
placeholder: "Enter text",
|
|
39
39
|
textSubtype: "freeform"
|
|
40
40
|
},
|
|
41
|
+
dropdown: {
|
|
42
|
+
width: 20,
|
|
43
|
+
height: 3,
|
|
44
|
+
fontSize: 12,
|
|
45
|
+
placeholder: "Select..."
|
|
46
|
+
},
|
|
41
47
|
signature: {
|
|
42
48
|
width: 20,
|
|
43
49
|
height: 6,
|
|
@@ -77,6 +83,7 @@ var FIELD_DEFAULTS = {
|
|
|
77
83
|
};
|
|
78
84
|
var TYPE_LABELS = {
|
|
79
85
|
text: "Text Field",
|
|
86
|
+
dropdown: "Dropdown",
|
|
80
87
|
signature: "Signature",
|
|
81
88
|
"signed-date": "Signed Date",
|
|
82
89
|
checkbox: "Checkbox",
|
|
@@ -350,8 +357,8 @@ var INK_COLORS = [
|
|
|
350
357
|
function FieldPropertyPanel({ field, signerRoles, onUpdate, onDelete }) {
|
|
351
358
|
const color = getSignerColor(field.assignee);
|
|
352
359
|
const isRedactField = field.type === "blackout" || field.type === "whiteout";
|
|
353
|
-
const isTextField = field.type === "text" || field.type === "signed-date";
|
|
354
|
-
const showInkColor = field.type === "text" || field.type === "signature" || field.type === "initials" || field.type === "signed-date";
|
|
360
|
+
const isTextField = field.type === "text" || field.type === "signed-date" || field.type === "dropdown";
|
|
361
|
+
const showInkColor = field.type === "text" || field.type === "dropdown" || field.type === "signature" || field.type === "initials" || field.type === "signed-date";
|
|
355
362
|
const [newOption, setNewOption] = useState("");
|
|
356
363
|
return /* @__PURE__ */ jsxs2("div", { className: "field-property-panel", children: [
|
|
357
364
|
/* @__PURE__ */ jsxs2("div", { className: "panel-header", children: [
|
|
@@ -378,6 +385,7 @@ function FieldPropertyPanel({ field, signerRoles, onUpdate, onDelete }) {
|
|
|
378
385
|
onChange: (e) => onUpdate(field.id, { type: e.target.value }),
|
|
379
386
|
children: [
|
|
380
387
|
/* @__PURE__ */ jsx2("option", { value: "text", children: "Text" }),
|
|
388
|
+
/* @__PURE__ */ jsx2("option", { value: "dropdown", children: "Dropdown" }),
|
|
381
389
|
/* @__PURE__ */ jsx2("option", { value: "signature", children: "Signature" }),
|
|
382
390
|
/* @__PURE__ */ jsx2("option", { value: "signed-date", children: "Signed Date" }),
|
|
383
391
|
/* @__PURE__ */ jsx2("option", { value: "checkbox", children: "Checkbox" }),
|
|
@@ -529,8 +537,8 @@ function FieldPropertyPanel({ field, signerRoles, onUpdate, onDelete }) {
|
|
|
529
537
|
c.value
|
|
530
538
|
)) })
|
|
531
539
|
] }),
|
|
532
|
-
field.type === "text" && /* @__PURE__ */ jsxs2("div", { className: "panel-field", children: [
|
|
533
|
-
/* @__PURE__ */ jsx2("label", { children: "Predefined Options" }),
|
|
540
|
+
(field.type === "text" || field.type === "dropdown") && /* @__PURE__ */ jsxs2("div", { className: "panel-field", children: [
|
|
541
|
+
/* @__PURE__ */ jsx2("label", { children: field.type === "dropdown" ? "Options" : "Predefined Options" }),
|
|
534
542
|
/* @__PURE__ */ jsxs2("div", { className: "panel-options-list", children: [
|
|
535
543
|
(field.options || []).map((opt, i) => /* @__PURE__ */ jsxs2("div", { className: "panel-option-item", children: [
|
|
536
544
|
/* @__PURE__ */ jsx2("span", { children: opt }),
|
|
@@ -576,7 +584,8 @@ function FieldPropertyPanel({ field, signerRoles, onUpdate, onDelete }) {
|
|
|
576
584
|
)
|
|
577
585
|
] })
|
|
578
586
|
] }),
|
|
579
|
-
(field.options?.length ?? 0)
|
|
587
|
+
field.type === "dropdown" && (field.options?.length ?? 0) === 0 && /* @__PURE__ */ jsx2("span", { className: "panel-hint", style: { color: "#c44" }, children: "Add at least one option" }),
|
|
588
|
+
field.type === "text" && (field.options?.length ?? 0) > 0 && /* @__PURE__ */ jsx2("span", { className: "panel-hint", children: "Signer will choose from these options via dropdown" })
|
|
580
589
|
] })
|
|
581
590
|
] });
|
|
582
591
|
}
|
|
@@ -725,6 +734,7 @@ function isValidApiKey(key) {
|
|
|
725
734
|
import { Fragment, jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
726
735
|
var FIELD_TYPE_META = [
|
|
727
736
|
{ type: "text", label: "Text", icon: "T" },
|
|
737
|
+
{ type: "dropdown", label: "Dropdown", icon: "\u25BE" },
|
|
728
738
|
{ type: "signature", label: "Signature", icon: "\u270D" },
|
|
729
739
|
{ type: "signed-date", label: "Date", icon: "\u{1F4C5}" },
|
|
730
740
|
{ type: "checkbox", label: "Checkbox", icon: "\u2611" },
|
|
@@ -1004,15 +1014,22 @@ function DesignerView({
|
|
|
1004
1014
|
}
|
|
1005
1015
|
}
|
|
1006
1016
|
const inkColor = field.inkColor || "#000000";
|
|
1017
|
+
const cssFontFamily = field.fontFamily === "Courier" ? '"Courier New", Courier, monospace' : field.fontFamily === "TimesRoman" ? '"Times New Roman", Times, serif' : field.fontFamily === "Helvetica" ? "Helvetica, Arial, sans-serif" : void 0;
|
|
1007
1018
|
return /* @__PURE__ */ jsx4(
|
|
1008
1019
|
"div",
|
|
1009
1020
|
{
|
|
1010
1021
|
className: "field-overlay-placeholder",
|
|
1011
|
-
style: {
|
|
1022
|
+
style: {
|
|
1023
|
+
color: field.value ? inkColor : void 0,
|
|
1024
|
+
fontSize: `${field.fontSize * 0.6}px`,
|
|
1025
|
+
fontFamily: cssFontFamily,
|
|
1026
|
+
letterSpacing: field.letterSpacing ? `${field.letterSpacing * 0.6}px` : void 0,
|
|
1027
|
+
lineHeight: field.lineHeight ? `${field.lineHeight}` : void 0
|
|
1028
|
+
},
|
|
1012
1029
|
children: field.value || field.placeholder
|
|
1013
1030
|
}
|
|
1014
1031
|
);
|
|
1015
|
-
}, []);
|
|
1032
|
+
}, [fields]);
|
|
1016
1033
|
const headerButtons = pages.length > 0 ? /* @__PURE__ */ jsxs4(Fragment, { children: [
|
|
1017
1034
|
/* @__PURE__ */ jsxs4("label", { className: "header-btn header-btn-outline", children: [
|
|
1018
1035
|
"Change PDF",
|
|
@@ -1793,9 +1810,10 @@ function SignerView({
|
|
|
1793
1810
|
const fontStyle = {
|
|
1794
1811
|
fontSize: `${field.fontSize * 0.6}px`,
|
|
1795
1812
|
letterSpacing: field.letterSpacing ? `${field.letterSpacing * 0.6}px` : void 0,
|
|
1796
|
-
|
|
1813
|
+
lineHeight: field.lineHeight ? `${field.lineHeight}` : void 0,
|
|
1814
|
+
fontFamily: field.fontFamily === "Courier" ? '"Courier New", Courier, monospace' : field.fontFamily === "TimesRoman" ? '"Times New Roman", Times, serif' : field.fontFamily === "Helvetica" ? "Helvetica, Arial, sans-serif" : void 0
|
|
1797
1815
|
};
|
|
1798
|
-
if (field.options && field.options.length > 0) {
|
|
1816
|
+
if (field.type === "dropdown" || field.options && field.options.length > 0) {
|
|
1799
1817
|
return /* @__PURE__ */ jsxs6(
|
|
1800
1818
|
"select",
|
|
1801
1819
|
{
|
|
@@ -1807,7 +1825,7 @@ function SignerView({
|
|
|
1807
1825
|
style: fontStyle,
|
|
1808
1826
|
children: [
|
|
1809
1827
|
/* @__PURE__ */ jsx6("option", { value: "", children: field.placeholder || "Select..." }),
|
|
1810
|
-
field.options.map((opt) => /* @__PURE__ */ jsx6("option", { value: opt, children: opt }, opt))
|
|
1828
|
+
(field.options || []).map((opt) => /* @__PURE__ */ jsx6("option", { value: opt, children: opt }, opt))
|
|
1811
1829
|
]
|
|
1812
1830
|
}
|
|
1813
1831
|
);
|
|
@@ -1887,8 +1905,8 @@ function SignerView({
|
|
|
1887
1905
|
initialValue: selectedField.value
|
|
1888
1906
|
}
|
|
1889
1907
|
),
|
|
1890
|
-
selectedField.type === "text" && /* @__PURE__ */ jsxs6(Fragment2, { children: [
|
|
1891
|
-
selectedField.options && selectedField.options.length > 0 ? /* @__PURE__ */ jsxs6(
|
|
1908
|
+
(selectedField.type === "text" || selectedField.type === "dropdown") && /* @__PURE__ */ jsxs6(Fragment2, { children: [
|
|
1909
|
+
selectedField.type === "dropdown" || selectedField.options && selectedField.options.length > 0 ? /* @__PURE__ */ jsxs6(
|
|
1892
1910
|
"select",
|
|
1893
1911
|
{
|
|
1894
1912
|
value: selectedField.value,
|
|
@@ -1896,7 +1914,7 @@ function SignerView({
|
|
|
1896
1914
|
className: "signer-text-input",
|
|
1897
1915
|
children: [
|
|
1898
1916
|
/* @__PURE__ */ jsx6("option", { value: "", children: selectedField.placeholder || "Select..." }),
|
|
1899
|
-
selectedField.options.map((opt) => /* @__PURE__ */ jsx6("option", { value: opt, children: opt }, opt))
|
|
1917
|
+
(selectedField.options || []).map((opt) => /* @__PURE__ */ jsx6("option", { value: opt, children: opt }, opt))
|
|
1900
1918
|
]
|
|
1901
1919
|
}
|
|
1902
1920
|
) : /* @__PURE__ */ jsx6(
|