@drawbridge/components 0.1.15 → 0.1.17

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.
Files changed (49) hide show
  1. package/dist/bridge/form-subdomain-missions.js +43 -34
  2. package/dist/bridge/form-subdomain-missions.mjs +43 -34
  3. package/dist/bridge/lib/url.js +3 -3
  4. package/dist/bridge/lib/url.mjs +3 -3
  5. package/dist/bridge/share-button.js +12 -2
  6. package/dist/bridge/share-button.mjs +12 -2
  7. package/dist/bridge/template-layout.js +1 -1
  8. package/dist/bridge/template-layout.mjs +1 -1
  9. package/dist/dashboard/answer-rows.js +77 -0
  10. package/dist/dashboard/answer-rows.mjs +41 -0
  11. package/dist/dashboard/card-order.js +186 -243
  12. package/dist/dashboard/card-order.mjs +186 -243
  13. package/dist/dashboard/form-organization-campaign-agreement.js +2 -2
  14. package/dist/dashboard/form-organization-campaign-agreement.mjs +2 -2
  15. package/dist/dashboard/form-organization-campaign-field-list.js +8 -49
  16. package/dist/dashboard/form-organization-campaign-field-list.mjs +8 -49
  17. package/dist/dashboard/form-organization-workflow.js +588 -157
  18. package/dist/dashboard/form-organization-workflow.mjs +578 -157
  19. package/dist/dashboard/form-otc.js +7 -4
  20. package/dist/dashboard/form-otc.mjs +8 -5
  21. package/dist/dashboard/input-editor.js +46 -10
  22. package/dist/dashboard/input-editor.mjs +44 -9
  23. package/dist/dashboard/item-row.js +92 -0
  24. package/dist/dashboard/item-row.mjs +63 -0
  25. package/dist/dashboard/lib/sms.js +3 -0
  26. package/dist/dashboard/lib/sms.mjs +2 -0
  27. package/dist/dashboard/order-sections.js +231 -0
  28. package/dist/dashboard/order-sections.mjs +196 -0
  29. package/dist/dashboard/preview.js +29 -2
  30. package/dist/dashboard/preview.mjs +28 -2
  31. package/dist/dashboard/steps.js +5 -0
  32. package/dist/dashboard/steps.mjs +5 -0
  33. package/dist/dashboard/template-socket.js +6 -0
  34. package/dist/dashboard/template-socket.mjs +6 -0
  35. package/dist/input-code.js +2 -8
  36. package/dist/input-code.mjs +2 -8
  37. package/dist/shared/lib/helpers.js +7 -0
  38. package/dist/shared/lib/helpers.mjs +7 -0
  39. package/package.json +19 -4
  40. package/types/bridge/lib/url.d.ts +5 -4
  41. package/types/dashboard/answer-rows.d.ts +30 -0
  42. package/types/dashboard/card-order.d.ts +16 -14
  43. package/types/dashboard/form-organization-workflow.d.ts +46 -0
  44. package/types/dashboard/input-editor.d.ts +7 -1
  45. package/types/dashboard/item-row.d.ts +25 -0
  46. package/types/dashboard/order-sections.d.ts +36 -0
  47. package/types/dashboard/steps.d.ts +2 -0
  48. package/types/input-code.d.ts +0 -2
  49. package/types/shared/lib/helpers.d.ts +1 -1
@@ -43,10 +43,10 @@ var import_missions = require("@drawbridge/drawbridge-utils/missions");
43
43
  var import_button = __toESM(require("../shared/button"));
44
44
  var import_copy_to_clipboard = __toESM(require("../shared/copy-to-clipboard"));
45
45
  var import_error = __toESM(require("../shared/error"));
46
+ var import_form = __toESM(require("../shared/form"));
46
47
  var import_check = __toESM(require("../icons/check"));
47
48
  var import_chevron_left = __toESM(require("../icons/chevron-left"));
48
49
  var import_chevron_right = __toESM(require("../icons/chevron-right"));
49
- var import_loader = __toESM(require("../icons/loader"));
50
50
  var import_input_group = __toESM(require("../input-group"));
51
51
  var import_input_code = __toESM(require("../input-code"));
52
52
  var import_share_button = __toESM(require("./share-button"));
@@ -131,29 +131,54 @@ const Strong = ({ children, className }) => /* @__PURE__ */ (0, import_jsx_runti
131
131
  children
132
132
  }
133
133
  );
134
- const CodeStep = ({ disabled, error, onComplete, style }) => {
134
+ const CodeStep = ({ busy, error, onSubmit, style }) => {
135
135
  const [code, setCode] = (0, import_react.useState)("");
136
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
137
- import_input_group.default,
136
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
137
+ import_form.default,
138
138
  {
139
139
  ...{
140
- error,
141
- input: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
142
- import_input_code.default,
140
+ className: "space-y-6",
141
+ onSubmit: (event) => {
142
+ event.preventDefault();
143
+ onSubmit(code);
144
+ }
145
+ },
146
+ children: [
147
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
148
+ import_input_group.default,
143
149
  {
144
150
  ...{
145
- autoFocus: true,
146
- disabled,
147
- onChange: setCode,
148
- onComplete,
149
- style,
150
- value: code
151
+ error,
152
+ input: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
153
+ import_input_code.default,
154
+ {
155
+ ...{
156
+ autoFocus: true,
157
+ disabled: busy,
158
+ onChange: setCode,
159
+ style,
160
+ value: code
161
+ }
162
+ }
163
+ ),
164
+ label: "Verification code",
165
+ style
151
166
  }
152
167
  }
153
168
  ),
154
- label: "Verification code",
155
- style
156
- }
169
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
170
+ import_button.default,
171
+ {
172
+ ...{
173
+ disabled: code.length !== 6,
174
+ loading: busy,
175
+ style,
176
+ type: "submit"
177
+ },
178
+ children: "Confirm"
179
+ }
180
+ )
181
+ ]
157
182
  }
158
183
  );
159
184
  };
@@ -288,30 +313,14 @@ const FormSubdomainMissions = ({
288
313
  CodeStep,
289
314
  {
290
315
  ...{
291
- disabled: busy,
316
+ busy,
292
317
  error,
293
- onComplete: confirm,
318
+ onSubmit: confirm,
294
319
  style
295
320
  }
296
321
  },
297
322
  attempt
298
323
  ),
299
- busy && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
300
- "div",
301
- {
302
- ...{
303
- className: "flex justify-center"
304
- },
305
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
306
- import_loader.default,
307
- {
308
- ...{
309
- className: "w-5 h-5 animate-spin"
310
- }
311
- }
312
- )
313
- }
314
- ),
315
324
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
316
325
  "p",
317
326
  {
@@ -6,10 +6,10 @@ import { CODE_CHANNELS, COMPLETIONS, entriesText, missions as manifests } from "
6
6
  import Button from "../shared/button.mjs";
7
7
  import CopyToClipboard from "../shared/copy-to-clipboard.mjs";
8
8
  import Error from "../shared/error.mjs";
9
+ import Form from "../shared/form.mjs";
9
10
  import Check from "../icons/check.mjs";
10
11
  import ChevronLeft from "../icons/chevron-left.mjs";
11
12
  import ChevronRight from "../icons/chevron-right.mjs";
12
- import Loader from "../icons/loader.mjs";
13
13
  import InputGroup from "../input-group.mjs";
14
14
  import InputCode from "../input-code.mjs";
15
15
  import ShareButton from "./share-button.mjs";
@@ -94,29 +94,54 @@ const Strong = ({ children, className }) => /* @__PURE__ */ jsx(
94
94
  children
95
95
  }
96
96
  );
97
- const CodeStep = ({ disabled, error, onComplete, style }) => {
97
+ const CodeStep = ({ busy, error, onSubmit, style }) => {
98
98
  const [code, setCode] = useState("");
99
- return /* @__PURE__ */ jsx(
100
- InputGroup,
99
+ return /* @__PURE__ */ jsxs(
100
+ Form,
101
101
  {
102
102
  ...{
103
- error,
104
- input: /* @__PURE__ */ jsx(
105
- InputCode,
103
+ className: "space-y-6",
104
+ onSubmit: (event) => {
105
+ event.preventDefault();
106
+ onSubmit(code);
107
+ }
108
+ },
109
+ children: [
110
+ /* @__PURE__ */ jsx(
111
+ InputGroup,
106
112
  {
107
113
  ...{
108
- autoFocus: true,
109
- disabled,
110
- onChange: setCode,
111
- onComplete,
112
- style,
113
- value: code
114
+ error,
115
+ input: /* @__PURE__ */ jsx(
116
+ InputCode,
117
+ {
118
+ ...{
119
+ autoFocus: true,
120
+ disabled: busy,
121
+ onChange: setCode,
122
+ style,
123
+ value: code
124
+ }
125
+ }
126
+ ),
127
+ label: "Verification code",
128
+ style
114
129
  }
115
130
  }
116
131
  ),
117
- label: "Verification code",
118
- style
119
- }
132
+ /* @__PURE__ */ jsx(
133
+ Button,
134
+ {
135
+ ...{
136
+ disabled: code.length !== 6,
137
+ loading: busy,
138
+ style,
139
+ type: "submit"
140
+ },
141
+ children: "Confirm"
142
+ }
143
+ )
144
+ ]
120
145
  }
121
146
  );
122
147
  };
@@ -251,30 +276,14 @@ const FormSubdomainMissions = ({
251
276
  CodeStep,
252
277
  {
253
278
  ...{
254
- disabled: busy,
279
+ busy,
255
280
  error,
256
- onComplete: confirm,
281
+ onSubmit: confirm,
257
282
  style
258
283
  }
259
284
  },
260
285
  attempt
261
286
  ),
262
- busy && /* @__PURE__ */ jsx(
263
- "div",
264
- {
265
- ...{
266
- className: "flex justify-center"
267
- },
268
- children: /* @__PURE__ */ jsx(
269
- Loader,
270
- {
271
- ...{
272
- className: "w-5 h-5 animate-spin"
273
- }
274
- }
275
- )
276
- }
277
- ),
278
287
  /* @__PURE__ */ jsxs(
279
288
  "p",
280
289
  {
@@ -58,9 +58,9 @@ const submissionEndpoint = ({ affiliate, id, slug, subdomain, token }) => {
58
58
  const query = params.toString();
59
59
  return "/subdomain/" + subdomain + "/page/" + slug + "/submission/" + encodeURIComponent(id) + (query ? "?" + query : "");
60
60
  };
61
- const leadEndpoint = ({ lead, slug, subdomain, token }) => {
62
- if (typeof lead !== "string" || !/^[\w-]+\.[\w-]+$/.test(lead)) return null;
63
- return "/subdomain/" + subdomain + "/page/" + slug + "/lead/" + lead + (token ? "?drwbrdg_pre=" + encodeURIComponent(token) : "");
61
+ const leadEndpoint = ({ code, slug, subdomain, token }) => {
62
+ if (typeof code !== "string" || !/^[0-9a-z]{12}$/.test(code)) return null;
63
+ return "/subdomain/" + subdomain + "/page/" + slug + "/lead/" + code + (token ? "?drwbrdg_pre=" + encodeURIComponent(token) : "");
64
64
  };
65
65
  const missionEndpoint = ({ action, slug, subdomain, type }) => "/subdomain/" + subdomain + "/page/" + slug + "/mission/" + type + "/" + action;
66
66
  // Annotate the CommonJS export names for ESM import in node:
@@ -32,9 +32,9 @@ const submissionEndpoint = ({ affiliate, id, slug, subdomain, token }) => {
32
32
  const query = params.toString();
33
33
  return "/subdomain/" + subdomain + "/page/" + slug + "/submission/" + encodeURIComponent(id) + (query ? "?" + query : "");
34
34
  };
35
- const leadEndpoint = ({ lead, slug, subdomain, token }) => {
36
- if (typeof lead !== "string" || !/^[\w-]+\.[\w-]+$/.test(lead)) return null;
37
- return "/subdomain/" + subdomain + "/page/" + slug + "/lead/" + lead + (token ? "?drwbrdg_pre=" + encodeURIComponent(token) : "");
35
+ const leadEndpoint = ({ code, slug, subdomain, token }) => {
36
+ if (typeof code !== "string" || !/^[0-9a-z]{12}$/.test(code)) return null;
37
+ return "/subdomain/" + subdomain + "/page/" + slug + "/lead/" + code + (token ? "?drwbrdg_pre=" + encodeURIComponent(token) : "");
38
38
  };
39
39
  const missionEndpoint = ({ action, slug, subdomain, type }) => "/subdomain/" + subdomain + "/page/" + slug + "/mission/" + type + "/" + action;
40
40
  export {
@@ -50,15 +50,18 @@ const ShareButton = ({
50
50
  const brandButton = style && (0, import_styles.buttonStyle)(style);
51
51
  const icon = {
52
52
  bgStyle: { fill: (brandButton == null ? void 0 : brandButton.backgroundColor) || "var(--color-black)" },
53
+ className: "w-full h-auto max-w-[40px]",
53
54
  iconFillColor: (brandButton == null ? void 0 : brandButton.color) || "var(--color-white)",
54
55
  round: true,
55
56
  size: iconSize
56
57
  };
58
+ const className = "w-full justify-center";
57
59
  const icons = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.Fragment, { children: [
58
60
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
59
61
  import_react_share.FacebookShareButton,
60
62
  {
61
63
  ...{
64
+ className,
62
65
  disabled,
63
66
  onClick,
64
67
  url: values == null ? void 0 : values.url
@@ -75,6 +78,7 @@ const ShareButton = ({
75
78
  import_react_share.XShareButton,
76
79
  {
77
80
  ...{
81
+ className,
78
82
  disabled,
79
83
  onClick,
80
84
  title: values == null ? void 0 : values.headline,
@@ -92,6 +96,7 @@ const ShareButton = ({
92
96
  import_react_share.LinkedinShareButton,
93
97
  {
94
98
  ...{
99
+ className,
95
100
  disabled,
96
101
  onClick,
97
102
  summary: values == null ? void 0 : values.description,
@@ -110,6 +115,7 @@ const ShareButton = ({
110
115
  import_react_share.RedditShareButton,
111
116
  {
112
117
  ...{
118
+ className,
113
119
  disabled,
114
120
  onClick,
115
121
  title: values == null ? void 0 : values.headline,
@@ -127,6 +133,7 @@ const ShareButton = ({
127
133
  import_react_share.WhatsappShareButton,
128
134
  {
129
135
  ...{
136
+ className,
130
137
  disabled,
131
138
  onClick,
132
139
  title: values == null ? void 0 : values.headline,
@@ -144,6 +151,7 @@ const ShareButton = ({
144
151
  import_react_share.TelegramShareButton,
145
152
  {
146
153
  ...{
154
+ className,
147
155
  disabled,
148
156
  onClick,
149
157
  title: values == null ? void 0 : values.headline,
@@ -161,6 +169,7 @@ const ShareButton = ({
161
169
  import_react_share.ThreadsShareButton,
162
170
  {
163
171
  ...{
172
+ className,
164
173
  disabled,
165
174
  onClick,
166
175
  title: values == null ? void 0 : values.headline,
@@ -179,6 +188,7 @@ const ShareButton = ({
179
188
  {
180
189
  ...{
181
190
  body: values == null ? void 0 : values.description,
191
+ className,
182
192
  disabled,
183
193
  onClick,
184
194
  subject: values == null ? void 0 : values.headline,
@@ -228,8 +238,8 @@ const ShareButton = ({
228
238
  "div",
229
239
  {
230
240
  ...{
231
- // Eight 40px buttons fit a 400px panel at 11px (11.5px overflowed by half a pixel and clipped the last); narrower, the row scrolls.
232
- className: "flex items-center flex-nowrap gap-[11px] overflow-x-auto hide-scrollbar"
241
+ // Eight equal columns: 40px buttons at 11px on a 400px panel, smaller on a phone, never cut off.
242
+ className: "grid grid-cols-8 items-center gap-[11px]"
233
243
  },
234
244
  children: icons
235
245
  }
@@ -35,15 +35,18 @@ const ShareButton = ({
35
35
  const brandButton = style && buttonStyle(style);
36
36
  const icon = {
37
37
  bgStyle: { fill: (brandButton == null ? void 0 : brandButton.backgroundColor) || "var(--color-black)" },
38
+ className: "w-full h-auto max-w-[40px]",
38
39
  iconFillColor: (brandButton == null ? void 0 : brandButton.color) || "var(--color-white)",
39
40
  round: true,
40
41
  size: iconSize
41
42
  };
43
+ const className = "w-full justify-center";
42
44
  const icons = /* @__PURE__ */ jsxs(Fragment, { children: [
43
45
  /* @__PURE__ */ jsx(
44
46
  FacebookShareButton,
45
47
  {
46
48
  ...{
49
+ className,
47
50
  disabled,
48
51
  onClick,
49
52
  url: values == null ? void 0 : values.url
@@ -60,6 +63,7 @@ const ShareButton = ({
60
63
  XShareButton,
61
64
  {
62
65
  ...{
66
+ className,
63
67
  disabled,
64
68
  onClick,
65
69
  title: values == null ? void 0 : values.headline,
@@ -77,6 +81,7 @@ const ShareButton = ({
77
81
  LinkedinShareButton,
78
82
  {
79
83
  ...{
84
+ className,
80
85
  disabled,
81
86
  onClick,
82
87
  summary: values == null ? void 0 : values.description,
@@ -95,6 +100,7 @@ const ShareButton = ({
95
100
  RedditShareButton,
96
101
  {
97
102
  ...{
103
+ className,
98
104
  disabled,
99
105
  onClick,
100
106
  title: values == null ? void 0 : values.headline,
@@ -112,6 +118,7 @@ const ShareButton = ({
112
118
  WhatsappShareButton,
113
119
  {
114
120
  ...{
121
+ className,
115
122
  disabled,
116
123
  onClick,
117
124
  title: values == null ? void 0 : values.headline,
@@ -129,6 +136,7 @@ const ShareButton = ({
129
136
  TelegramShareButton,
130
137
  {
131
138
  ...{
139
+ className,
132
140
  disabled,
133
141
  onClick,
134
142
  title: values == null ? void 0 : values.headline,
@@ -146,6 +154,7 @@ const ShareButton = ({
146
154
  ThreadsShareButton,
147
155
  {
148
156
  ...{
157
+ className,
149
158
  disabled,
150
159
  onClick,
151
160
  title: values == null ? void 0 : values.headline,
@@ -164,6 +173,7 @@ const ShareButton = ({
164
173
  {
165
174
  ...{
166
175
  body: values == null ? void 0 : values.description,
176
+ className,
167
177
  disabled,
168
178
  onClick,
169
179
  subject: values == null ? void 0 : values.headline,
@@ -213,8 +223,8 @@ const ShareButton = ({
213
223
  "div",
214
224
  {
215
225
  ...{
216
- // Eight 40px buttons fit a 400px panel at 11px (11.5px overflowed by half a pixel and clipped the last); narrower, the row scrolls.
217
- className: "flex items-center flex-nowrap gap-[11px] overflow-x-auto hide-scrollbar"
226
+ // Eight equal columns: 40px buttons at 11px on a 400px panel, smaller on a phone, never cut off.
227
+ className: "grid grid-cols-8 items-center gap-[11px]"
218
228
  },
219
229
  children: icons
220
230
  }
@@ -394,7 +394,7 @@ const TemplateLayout = ({
394
394
  [affiliate, data, params, preview, style]
395
395
  );
396
396
  const leadMission = searchParams.get("mission");
397
- const leadUrl = submissionId ? null : (0, import_url.leadEndpoint)({ lead: searchParams.get("lead"), slug: params == null ? void 0 : params.slug, subdomain: params == null ? void 0 : params.subdomain, token });
397
+ const leadUrl = submissionId ? null : (0, import_url.leadEndpoint)({ code: searchParams.get("m"), slug: params == null ? void 0 : params.slug, subdomain: params == null ? void 0 : params.subdomain, token });
398
398
  (0, import_react.useEffect)(
399
399
  () => {
400
400
  if (!leadUrl) return;
@@ -362,7 +362,7 @@ const TemplateLayout = ({
362
362
  [affiliate, data, params, preview, style]
363
363
  );
364
364
  const leadMission = searchParams.get("mission");
365
- const leadUrl = submissionId ? null : leadEndpoint({ lead: searchParams.get("lead"), slug: params == null ? void 0 : params.slug, subdomain: params == null ? void 0 : params.subdomain, token });
365
+ const leadUrl = submissionId ? null : leadEndpoint({ code: searchParams.get("m"), slug: params == null ? void 0 : params.slug, subdomain: params == null ? void 0 : params.subdomain, token });
366
366
  useEffect(
367
367
  () => {
368
368
  if (!leadUrl) return;
@@ -0,0 +1,77 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+ var answer_rows_exports = {};
29
+ __export(answer_rows_exports, {
30
+ Removed: () => Removed,
31
+ answerRows: () => answerRows,
32
+ blank: () => blank,
33
+ display: () => display
34
+ });
35
+ module.exports = __toCommonJS(answer_rows_exports);
36
+ var import_jsx_runtime = require("react/jsx-runtime");
37
+ var import_badge = __toESM(require("../shared/badge"));
38
+ const blank = (value) => value === void 0 || value === null || value === "";
39
+ const display = (value) => {
40
+ if (blank(value)) return "\u2014";
41
+ if (value instanceof Object) return Object.values(value).join(", ");
42
+ return String(value);
43
+ };
44
+ const Removed = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
45
+ "span",
46
+ {
47
+ ...{
48
+ className: "flex flex-wrap items-center gap-2"
49
+ },
50
+ children: [
51
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("s", { children }),
52
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
53
+ import_badge.default,
54
+ {
55
+ ...{
56
+ size: "small"
57
+ },
58
+ children: "Removed"
59
+ }
60
+ )
61
+ ]
62
+ }
63
+ );
64
+ const answerRows = (fields = [], answers = []) => {
65
+ const values = Object.fromEntries(answers.map((item) => [item.reference, item.value]));
66
+ return (type) => fields.filter((item) => (item == null ? void 0 : item.type) === type && (!(item == null ? void 0 : item.deleted) || !blank(values[item.id]))).map((item) => ({
67
+ label: item.label,
68
+ value: (item == null ? void 0 : item.deleted) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Removed, { children: display(values[item.id]) }) : display(values[item.id])
69
+ }));
70
+ };
71
+ // Annotate the CommonJS export names for ESM import in node:
72
+ 0 && (module.exports = {
73
+ Removed,
74
+ answerRows,
75
+ blank,
76
+ display
77
+ });
@@ -0,0 +1,41 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import Badge from "../shared/badge.mjs";
3
+ const blank = (value) => value === void 0 || value === null || value === "";
4
+ const display = (value) => {
5
+ if (blank(value)) return "\u2014";
6
+ if (value instanceof Object) return Object.values(value).join(", ");
7
+ return String(value);
8
+ };
9
+ const Removed = ({ children }) => /* @__PURE__ */ jsxs(
10
+ "span",
11
+ {
12
+ ...{
13
+ className: "flex flex-wrap items-center gap-2"
14
+ },
15
+ children: [
16
+ /* @__PURE__ */ jsx("s", { children }),
17
+ /* @__PURE__ */ jsx(
18
+ Badge,
19
+ {
20
+ ...{
21
+ size: "small"
22
+ },
23
+ children: "Removed"
24
+ }
25
+ )
26
+ ]
27
+ }
28
+ );
29
+ const answerRows = (fields = [], answers = []) => {
30
+ const values = Object.fromEntries(answers.map((item) => [item.reference, item.value]));
31
+ return (type) => fields.filter((item) => (item == null ? void 0 : item.type) === type && (!(item == null ? void 0 : item.deleted) || !blank(values[item.id]))).map((item) => ({
32
+ label: item.label,
33
+ value: (item == null ? void 0 : item.deleted) ? /* @__PURE__ */ jsx(Removed, { children: display(values[item.id]) }) : display(values[item.id])
34
+ }));
35
+ };
36
+ export {
37
+ Removed,
38
+ answerRows,
39
+ blank,
40
+ display
41
+ };