@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 CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
 
3
3
  declare function generateId(): string;
4
- type FieldType = 'text' | 'signature' | 'signed-date' | 'checkbox' | 'initials' | 'blackout' | 'whiteout';
4
+ type FieldType = 'text' | 'dropdown' | 'signature' | 'signed-date' | 'checkbox' | 'initials' | 'blackout' | 'whiteout';
5
5
  type TextSubtype = 'freeform' | 'number' | 'date' | 'email' | 'phone';
6
6
  interface FormField {
7
7
  id: string;
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
 
3
3
  declare function generateId(): string;
4
- type FieldType = 'text' | 'signature' | 'signed-date' | 'checkbox' | 'initials' | 'blackout' | 'whiteout';
4
+ type FieldType = 'text' | 'dropdown' | 'signature' | 'signed-date' | 'checkbox' | 'initials' | 'blackout' | 'whiteout';
5
5
  type TextSubtype = 'freeform' | 'number' | 'date' | 'email' | 'phone';
6
6
  interface FormField {
7
7
  id: string;
package/dist/index.js CHANGED
@@ -95,6 +95,12 @@ var FIELD_DEFAULTS = {
95
95
  placeholder: "Enter text",
96
96
  textSubtype: "freeform"
97
97
  },
98
+ dropdown: {
99
+ width: 20,
100
+ height: 3,
101
+ fontSize: 12,
102
+ placeholder: "Select..."
103
+ },
98
104
  signature: {
99
105
  width: 20,
100
106
  height: 6,
@@ -134,6 +140,7 @@ var FIELD_DEFAULTS = {
134
140
  };
135
141
  var TYPE_LABELS = {
136
142
  text: "Text Field",
143
+ dropdown: "Dropdown",
137
144
  signature: "Signature",
138
145
  "signed-date": "Signed Date",
139
146
  checkbox: "Checkbox",
@@ -407,8 +414,8 @@ var INK_COLORS = [
407
414
  function FieldPropertyPanel({ field, signerRoles, onUpdate, onDelete }) {
408
415
  const color = getSignerColor(field.assignee);
409
416
  const isRedactField = field.type === "blackout" || field.type === "whiteout";
410
- const isTextField = field.type === "text" || field.type === "signed-date";
411
- const showInkColor = field.type === "text" || field.type === "signature" || field.type === "initials" || field.type === "signed-date";
417
+ const isTextField = field.type === "text" || field.type === "signed-date" || field.type === "dropdown";
418
+ const showInkColor = field.type === "text" || field.type === "dropdown" || field.type === "signature" || field.type === "initials" || field.type === "signed-date";
412
419
  const [newOption, setNewOption] = (0, import_react2.useState)("");
413
420
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "field-property-panel", children: [
414
421
  /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "panel-header", children: [
@@ -435,6 +442,7 @@ function FieldPropertyPanel({ field, signerRoles, onUpdate, onDelete }) {
435
442
  onChange: (e) => onUpdate(field.id, { type: e.target.value }),
436
443
  children: [
437
444
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "text", children: "Text" }),
445
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "dropdown", children: "Dropdown" }),
438
446
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "signature", children: "Signature" }),
439
447
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "signed-date", children: "Signed Date" }),
440
448
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "checkbox", children: "Checkbox" }),
@@ -586,8 +594,8 @@ function FieldPropertyPanel({ field, signerRoles, onUpdate, onDelete }) {
586
594
  c.value
587
595
  )) })
588
596
  ] }),
589
- field.type === "text" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "panel-field", children: [
590
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("label", { children: "Predefined Options" }),
597
+ (field.type === "text" || field.type === "dropdown") && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "panel-field", children: [
598
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("label", { children: field.type === "dropdown" ? "Options" : "Predefined Options" }),
591
599
  /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "panel-options-list", children: [
592
600
  (field.options || []).map((opt, i) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "panel-option-item", children: [
593
601
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: opt }),
@@ -633,7 +641,8 @@ function FieldPropertyPanel({ field, signerRoles, onUpdate, onDelete }) {
633
641
  )
634
642
  ] })
635
643
  ] }),
636
- (field.options?.length ?? 0) > 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "panel-hint", children: "Signer will choose from these options via dropdown" })
644
+ field.type === "dropdown" && (field.options?.length ?? 0) === 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "panel-hint", style: { color: "#c44" }, children: "Add at least one option" }),
645
+ field.type === "text" && (field.options?.length ?? 0) > 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "panel-hint", children: "Signer will choose from these options via dropdown" })
637
646
  ] })
638
647
  ] });
639
648
  }
@@ -782,6 +791,7 @@ function isValidApiKey(key) {
782
791
  var import_jsx_runtime4 = require("react/jsx-runtime");
783
792
  var FIELD_TYPE_META = [
784
793
  { type: "text", label: "Text", icon: "T" },
794
+ { type: "dropdown", label: "Dropdown", icon: "\u25BE" },
785
795
  { type: "signature", label: "Signature", icon: "\u270D" },
786
796
  { type: "signed-date", label: "Date", icon: "\u{1F4C5}" },
787
797
  { type: "checkbox", label: "Checkbox", icon: "\u2611" },
@@ -1061,15 +1071,22 @@ function DesignerView({
1061
1071
  }
1062
1072
  }
1063
1073
  const inkColor = field.inkColor || "#000000";
1074
+ 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;
1064
1075
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1065
1076
  "div",
1066
1077
  {
1067
1078
  className: "field-overlay-placeholder",
1068
- style: { color: field.value ? inkColor : void 0, fontSize: `${field.fontSize * 0.6}px` },
1079
+ style: {
1080
+ color: field.value ? inkColor : void 0,
1081
+ fontSize: `${field.fontSize * 0.6}px`,
1082
+ fontFamily: cssFontFamily,
1083
+ letterSpacing: field.letterSpacing ? `${field.letterSpacing * 0.6}px` : void 0,
1084
+ lineHeight: field.lineHeight ? `${field.lineHeight}` : void 0
1085
+ },
1069
1086
  children: field.value || field.placeholder
1070
1087
  }
1071
1088
  );
1072
- }, []);
1089
+ }, [fields]);
1073
1090
  const headerButtons = pages.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
1074
1091
  /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "header-btn header-btn-outline", children: [
1075
1092
  "Change PDF",
@@ -1850,9 +1867,10 @@ function SignerView({
1850
1867
  const fontStyle = {
1851
1868
  fontSize: `${field.fontSize * 0.6}px`,
1852
1869
  letterSpacing: field.letterSpacing ? `${field.letterSpacing * 0.6}px` : void 0,
1853
- fontFamily: field.fontFamily === "Courier" ? "monospace" : field.fontFamily === "TimesRoman" ? "serif" : void 0
1870
+ lineHeight: field.lineHeight ? `${field.lineHeight}` : void 0,
1871
+ 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
1854
1872
  };
1855
- if (field.options && field.options.length > 0) {
1873
+ if (field.type === "dropdown" || field.options && field.options.length > 0) {
1856
1874
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
1857
1875
  "select",
1858
1876
  {
@@ -1864,7 +1882,7 @@ function SignerView({
1864
1882
  style: fontStyle,
1865
1883
  children: [
1866
1884
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: "", children: field.placeholder || "Select..." }),
1867
- field.options.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: opt, children: opt }, opt))
1885
+ (field.options || []).map((opt) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: opt, children: opt }, opt))
1868
1886
  ]
1869
1887
  }
1870
1888
  );
@@ -1944,8 +1962,8 @@ function SignerView({
1944
1962
  initialValue: selectedField.value
1945
1963
  }
1946
1964
  ),
1947
- selectedField.type === "text" && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
1948
- selectedField.options && selectedField.options.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
1965
+ (selectedField.type === "text" || selectedField.type === "dropdown") && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
1966
+ selectedField.type === "dropdown" || selectedField.options && selectedField.options.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
1949
1967
  "select",
1950
1968
  {
1951
1969
  value: selectedField.value,
@@ -1953,7 +1971,7 @@ function SignerView({
1953
1971
  className: "signer-text-input",
1954
1972
  children: [
1955
1973
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: "", children: selectedField.placeholder || "Select..." }),
1956
- selectedField.options.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: opt, children: opt }, opt))
1974
+ (selectedField.options || []).map((opt) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: opt, children: opt }, opt))
1957
1975
  ]
1958
1976
  }
1959
1977
  ) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(