@drawbridge/components 0.1.48 → 0.1.49

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 (125) hide show
  1. package/dist/bridge/fields.js +0 -278
  2. package/dist/bridge/fields.mjs +1 -276
  3. package/dist/bridge/form-subdomain-shop-modal.js +274 -234
  4. package/dist/bridge/form-subdomain-shop-modal.mjs +275 -233
  5. package/dist/bridge/form-subdomain.js +0 -7
  6. package/dist/bridge/form-subdomain.mjs +2 -9
  7. package/dist/bridge/lib/age-gate.js +0 -12
  8. package/dist/bridge/lib/age-gate.mjs +0 -11
  9. package/dist/bridge/lib/checkout-kit.js +32 -2
  10. package/dist/bridge/lib/checkout-kit.mjs +32 -2
  11. package/dist/bridge/lib/entry.js +0 -3
  12. package/dist/bridge/lib/entry.mjs +0 -2
  13. package/dist/bridge/product-tile.js +6 -9
  14. package/dist/bridge/product-tile.mjs +6 -9
  15. package/dist/bridge/template-layout.js +122 -237
  16. package/dist/bridge/template-layout.mjs +122 -237
  17. package/dist/bridge/template-modal.js +73 -28
  18. package/dist/bridge/template-modal.mjs +74 -29
  19. package/dist/dashboard/buttons-subscription.js +1 -1
  20. package/dist/dashboard/buttons-subscription.mjs +1 -1
  21. package/dist/dashboard/campaign-form.js +2 -7
  22. package/dist/dashboard/campaign-form.mjs +2 -7
  23. package/dist/dashboard/card-order.js +4 -22
  24. package/dist/dashboard/card-order.mjs +4 -22
  25. package/dist/dashboard/document-blocks.js +17 -4
  26. package/dist/dashboard/document-blocks.mjs +17 -4
  27. package/dist/dashboard/form-admin-provider.js +17 -71
  28. package/dist/dashboard/form-admin-provider.mjs +17 -71
  29. package/dist/dashboard/form-file-upload.js +2 -3
  30. package/dist/dashboard/form-file-upload.mjs +3 -4
  31. package/dist/dashboard/form-organization-campaign-advertisements.js +6 -47
  32. package/dist/dashboard/form-organization-campaign-advertisements.mjs +6 -47
  33. package/dist/dashboard/form-organization-campaign-agreement.js +121 -83
  34. package/dist/dashboard/form-organization-campaign-agreement.mjs +121 -83
  35. package/dist/dashboard/form-organization-campaign.js +0 -82
  36. package/dist/dashboard/form-organization-campaign.mjs +0 -81
  37. package/dist/dashboard/form-organization-connection.js +6 -48
  38. package/dist/dashboard/form-organization-connection.mjs +7 -48
  39. package/dist/dashboard/form-organization-workflow.js +1 -72
  40. package/dist/dashboard/form-organization-workflow.mjs +1 -69
  41. package/dist/dashboard/form-otc.js +5 -4
  42. package/dist/dashboard/form-otc.mjs +5 -4
  43. package/dist/dashboard/form-stripe.js +5 -12
  44. package/dist/dashboard/form-stripe.mjs +5 -12
  45. package/dist/dashboard/input-fields.js +158 -11
  46. package/dist/dashboard/input-fields.mjs +158 -11
  47. package/dist/dashboard/input-file.js +4 -21
  48. package/dist/dashboard/input-file.mjs +4 -21
  49. package/dist/dashboard/lib/connection-controls.js +2 -5
  50. package/dist/dashboard/lib/connection-controls.mjs +1 -3
  51. package/dist/dashboard/lib/form-page.js +1 -1
  52. package/dist/dashboard/lib/form-page.mjs +1 -1
  53. package/dist/dashboard/lib/uppy.js +1 -10
  54. package/dist/dashboard/lib/uppy.mjs +2 -11
  55. package/dist/dashboard/order-sections.js +6 -456
  56. package/dist/dashboard/order-sections.mjs +7 -453
  57. package/dist/dashboard/provider-ui.js +7 -9
  58. package/dist/dashboard/provider-ui.mjs +7 -9
  59. package/dist/dashboard/template-ui.js +12 -4
  60. package/dist/dashboard/template-ui.mjs +12 -4
  61. package/dist/input-checkbox.js +10 -28
  62. package/dist/input-checkbox.mjs +10 -28
  63. package/dist/product.js +24 -96
  64. package/dist/product.mjs +25 -97
  65. package/dist/shared/lib/helpers.js +6 -54
  66. package/dist/shared/lib/helpers.mjs +8 -53
  67. package/package.json +4 -74
  68. package/types/bridge/fields.d.ts +2 -14
  69. package/types/bridge/form-subdomain-shop-modal.d.ts +3 -27
  70. package/types/bridge/lib/age-gate.d.ts +0 -5
  71. package/types/bridge/lib/checkout-kit.d.ts +10 -2
  72. package/types/bridge/lib/entry.d.ts +0 -3
  73. package/types/dashboard/card-order.d.ts +0 -6
  74. package/types/dashboard/document-blocks.d.ts +3 -2
  75. package/types/dashboard/form-admin-provider.d.ts +2 -9
  76. package/types/dashboard/form-file-upload.d.ts +1 -2
  77. package/types/dashboard/form-organization-campaign-advertisements.d.ts +0 -3
  78. package/types/dashboard/form-organization-campaign-agreement.d.ts +5 -2
  79. package/types/dashboard/form-organization-campaign.d.ts +0 -3
  80. package/types/dashboard/form-organization-connection.d.ts +0 -11
  81. package/types/dashboard/form-otc.d.ts +1 -5
  82. package/types/dashboard/form-stripe.d.ts +2 -3
  83. package/types/dashboard/input-file.d.ts +0 -2
  84. package/types/dashboard/order-sections.d.ts +1 -24
  85. package/types/input-checkbox.d.ts +0 -2
  86. package/types/shared/lib/helpers.d.ts +0 -4
  87. package/dist/bridge/cart-drawer.js +0 -152
  88. package/dist/bridge/cart-drawer.mjs +0 -123
  89. package/dist/bridge/form-subdomain-checkout.js +0 -687
  90. package/dist/bridge/form-subdomain-checkout.mjs +0 -665
  91. package/dist/bridge/lib/cart.js +0 -79
  92. package/dist/bridge/lib/cart.mjs +0 -48
  93. package/dist/dashboard/embed-stripe.js +0 -145
  94. package/dist/dashboard/embed-stripe.mjs +0 -116
  95. package/dist/dashboard/form-organization-campaign-field-birthday.js +0 -193
  96. package/dist/dashboard/form-organization-campaign-field-birthday.mjs +0 -164
  97. package/dist/dashboard/form-organization-campaign-field-rating.js +0 -246
  98. package/dist/dashboard/form-organization-campaign-field-rating.mjs +0 -217
  99. package/dist/dashboard/form-organization-product.js +0 -1461
  100. package/dist/dashboard/form-organization-product.mjs +0 -1425
  101. package/dist/dashboard/input-gallery.js +0 -201
  102. package/dist/dashboard/input-gallery.mjs +0 -172
  103. package/dist/dashboard/lib/products.js +0 -169
  104. package/dist/dashboard/lib/products.mjs +0 -135
  105. package/dist/dashboard/lib/settings-paths.js +0 -35
  106. package/dist/dashboard/lib/settings-paths.mjs +0 -11
  107. package/dist/dashboard/shipping-rates.js +0 -404
  108. package/dist/dashboard/shipping-rates.mjs +0 -371
  109. package/dist/dashboard/template-buyer.js +0 -301
  110. package/dist/dashboard/template-buyer.mjs +0 -267
  111. package/dist/shared/order-summary.js +0 -139
  112. package/dist/shared/order-summary.mjs +0 -110
  113. package/types/bridge/cart-drawer.d.ts +0 -31
  114. package/types/bridge/form-subdomain-checkout.d.ts +0 -20
  115. package/types/bridge/lib/cart.d.ts +0 -44
  116. package/types/dashboard/embed-stripe.d.ts +0 -25
  117. package/types/dashboard/form-organization-campaign-field-birthday.d.ts +0 -31
  118. package/types/dashboard/form-organization-campaign-field-rating.d.ts +0 -33
  119. package/types/dashboard/form-organization-product.d.ts +0 -24
  120. package/types/dashboard/input-gallery.d.ts +0 -14
  121. package/types/dashboard/lib/products.d.ts +0 -14
  122. package/types/dashboard/lib/settings-paths.d.ts +0 -5
  123. package/types/dashboard/shipping-rates.d.ts +0 -26
  124. package/types/dashboard/template-buyer.d.ts +0 -50
  125. package/types/shared/order-summary.d.ts +0 -19
@@ -27,21 +27,15 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
27
27
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
28
  var fields_exports = {};
29
29
  __export(fields_exports, {
30
- birthdayInputs: () => birthdayInputs,
31
- birthdayValue: () => birthdayValue,
32
30
  components: () => components,
33
31
  errors: () => import_fields_validate.errors,
34
32
  starred: () => starred,
35
- tick: () => tick,
36
33
  validate: () => import_fields_validate.validators
37
34
  });
38
35
  module.exports = __toCommonJS(fields_exports);
39
36
  var import_jsx_runtime = require("react/jsx-runtime");
40
- var import_react = require("react");
41
37
  var import_input_group = __toESM(require("../input-group"));
42
38
  var import_input_answer = __toESM(require("../input-answer"));
43
- var import_input_checkbox = __toESM(require("../input-checkbox"));
44
- var import_button = __toESM(require("../shared/button"));
45
39
  var import_input_name = __toESM(require("../input-name"));
46
40
  var import_input_select = __toESM(require("../input-select"));
47
41
  var import_input_phone = __toESM(require("../input-phone"));
@@ -267,251 +261,6 @@ const FieldTextarea = ({
267
261
  }
268
262
  );
269
263
  };
270
- const birthdayValue = ({ day = "", month = "", year = "" } = {}) => !day && !month && !year ? "" : [year, month && String(month).padStart(2, "0"), day && String(day).padStart(2, "0")].join("-");
271
- const birthdayInputs = (value) => {
272
- const [year = "", month = "", day = ""] = typeof value === "string" && value ? value.split("-") : [];
273
- const typed = (part) => /^\d+$/.test(part) ? String(Number(part)) : part;
274
- return {
275
- day: typed(day),
276
- month: typed(month),
277
- year
278
- };
279
- };
280
- const FieldBirthday = ({
281
- error,
282
- field,
283
- onChange = () => {
284
- },
285
- style,
286
- value
287
- }) => {
288
- const [parts, setParts] = (0, import_react.useState)(() => birthdayInputs(value));
289
- const box = (key, label) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
290
- "div",
291
- {
292
- ...{
293
- className: "space-y-2 w-full"
294
- },
295
- children: [
296
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: label }),
297
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
298
- import_input_text.default,
299
- {
300
- ...{
301
- "aria-label": ((field == null ? void 0 : field.label) ? field.label + ", " : "") + label.toLowerCase(),
302
- inputMode: "numeric",
303
- onChange: (text) => {
304
- const next = {
305
- ...parts,
306
- [key]: text
307
- };
308
- setParts(next);
309
- onChange(birthdayValue(next));
310
- },
311
- style,
312
- value: parts[key] || ""
313
- }
314
- }
315
- )
316
- ]
317
- },
318
- key
319
- );
320
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
321
- import_input_group.default,
322
- {
323
- ...{
324
- error: error == null ? void 0 : error.message,
325
- input: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
326
- "div",
327
- {
328
- ...{
329
- className: "flex items-center space-x-4 w-full"
330
- },
331
- children: [
332
- box("month", "Month"),
333
- box("day", "Day"),
334
- box("year", "Year")
335
- ]
336
- }
337
- ),
338
- label: starred(field),
339
- style
340
- }
341
- }
342
- );
343
- };
344
- const choiceRows = ({ field, picked, pick, round, style }) => {
345
- var _a;
346
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
347
- "div",
348
- {
349
- ...{
350
- className: "space-y-3",
351
- role: round ? "radiogroup" : "group",
352
- "aria-label": field == null ? void 0 : field.label
353
- },
354
- children: (((_a = field == null ? void 0 : field.settings) == null ? void 0 : _a.options) || []).map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
355
- import_input_checkbox.default,
356
- {
357
- ...{
358
- label: item == null ? void 0 : item.option,
359
- labelId: "choice-" + ((field == null ? void 0 : field.id) || "field") + "-" + index,
360
- onChange: () => pick(item == null ? void 0 : item.option),
361
- round,
362
- style,
363
- value: picked(item == null ? void 0 : item.option)
364
- }
365
- },
366
- (item == null ? void 0 : item.id) || index
367
- ))
368
- }
369
- );
370
- };
371
- const FieldRadio = ({
372
- error,
373
- field,
374
- onChange = () => {
375
- },
376
- style,
377
- value
378
- }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
379
- import_input_group.default,
380
- {
381
- ...{
382
- error: error == null ? void 0 : error.message,
383
- input: choiceRows({
384
- field,
385
- pick: (option) => onChange(option),
386
- picked: (option) => Boolean(value) && value === option,
387
- round: true,
388
- style
389
- }),
390
- label: starred(field),
391
- style
392
- }
393
- }
394
- );
395
- const tick = (options = [], value, option) => {
396
- const ticked = Array.isArray(value) ? value : [];
397
- const next = ticked.includes(option) ? ticked.filter((item) => item !== option) : [...ticked, option];
398
- return (options || []).map((item) => item == null ? void 0 : item.option).filter((item) => next.includes(item));
399
- };
400
- const FieldCheckbox = ({
401
- error,
402
- field,
403
- onChange = () => {
404
- },
405
- style,
406
- value
407
- }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
408
- import_input_group.default,
409
- {
410
- ...{
411
- error: error == null ? void 0 : error.message,
412
- input: choiceRows({
413
- field,
414
- pick: (option) => {
415
- var _a;
416
- return onChange(tick((_a = field == null ? void 0 : field.settings) == null ? void 0 : _a.options, value, option));
417
- },
418
- picked: (option) => Array.isArray(value) && value.includes(option),
419
- round: false,
420
- style
421
- }),
422
- label: starred(field),
423
- style
424
- }
425
- }
426
- );
427
- const FieldRating = ({
428
- error,
429
- field,
430
- onChange = () => {
431
- },
432
- style,
433
- value
434
- }) => {
435
- var _a, _b, _c;
436
- const max = Number((_a = field == null ? void 0 : field.attributes) == null ? void 0 : _a.max) || 5;
437
- const low = (_b = field == null ? void 0 : field.settings) == null ? void 0 : _b.low;
438
- const high = (_c = field == null ? void 0 : field.settings) == null ? void 0 : _c.high;
439
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
440
- import_input_group.default,
441
- {
442
- ...{
443
- error: error == null ? void 0 : error.message,
444
- input: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
445
- "div",
446
- {
447
- ...{
448
- className: "space-y-2 w-full"
449
- },
450
- children: [
451
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
452
- "div",
453
- {
454
- ...{
455
- "aria-label": field == null ? void 0 : field.label,
456
- className: "grid w-full gap-1",
457
- role: "group",
458
- style: {
459
- gridTemplateColumns: "repeat(" + max + ", minmax(0, 1fr))"
460
- }
461
- },
462
- children: Array.from({ length: max }, (_, index) => index + 1).map((number) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
463
- import_button.default,
464
- {
465
- ...{
466
- "aria-pressed": Number(value) === number,
467
- onClick: () => onChange(number),
468
- variant: "link"
469
- },
470
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
471
- "span",
472
- {
473
- ...{
474
- className: "flex items-center justify-center w-full h-10 border text-sm tabular-nums",
475
- style: Number(value) === number ? (0, import_styles.buttonStyle)(style) : (0, import_styles.inputCheckboxStyle)(style)
476
- },
477
- children: number
478
- }
479
- )
480
- },
481
- number
482
- ))
483
- }
484
- ),
485
- (low || high) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
486
- "div",
487
- {
488
- ...{
489
- className: "flex justify-between gap-4 text-xs",
490
- ...style && { style: (0, import_styles.textStyle)(style) }
491
- },
492
- children: [
493
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: low }),
494
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
495
- "span",
496
- {
497
- ...{
498
- className: "text-right"
499
- },
500
- children: high
501
- }
502
- )
503
- ]
504
- }
505
- )
506
- ]
507
- }
508
- ),
509
- label: starred(field),
510
- style
511
- }
512
- }
513
- );
514
- };
515
264
  const FieldSection = ({
516
265
  field,
517
266
  style
@@ -576,18 +325,6 @@ const FieldSkill = ({
576
325
  }
577
326
  );
578
327
  const components = {
579
- birthday: (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
580
- FieldBirthday,
581
- {
582
- ...props
583
- }
584
- ),
585
- checkbox: (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
586
- FieldCheckbox,
587
- {
588
- ...props
589
- }
590
- ),
591
328
  email: (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
592
329
  FieldEmail,
593
330
  {
@@ -612,18 +349,6 @@ const components = {
612
349
  ...props
613
350
  }
614
351
  ),
615
- radio: (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
616
- FieldRadio,
617
- {
618
- ...props
619
- }
620
- ),
621
- rating: (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
622
- FieldRating,
623
- {
624
- ...props
625
- }
626
- ),
627
352
  section: (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
628
353
  FieldSection,
629
354
  {
@@ -657,11 +382,8 @@ const components = {
657
382
  };
658
383
  // Annotate the CommonJS export names for ESM import in node:
659
384
  0 && (module.exports = {
660
- birthdayInputs,
661
- birthdayValue,
662
385
  components,
663
386
  errors,
664
387
  starred,
665
- tick,
666
388
  validate
667
389
  });
@@ -1,16 +1,13 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
- import { useState } from "react";
3
2
  import InputGroup from "../input-group.mjs";
4
3
  import InputAnswer from "../input-answer.mjs";
5
- import InputCheckbox from "../input-checkbox.mjs";
6
- import Button from "../shared/button.mjs";
7
4
  import InputName from "../input-name.mjs";
8
5
  import InputSelect from "../input-select.mjs";
9
6
  import InputPhone from "../input-phone.mjs";
10
7
  import InputNumber from "../input-number.mjs";
11
8
  import InputText from "../input-text.mjs";
12
9
  import InputTextarea from "../input-textarea.mjs";
13
- import { buttonStyle, headerStyle, inputCheckboxStyle, textStyle } from "../styles.mjs";
10
+ import { headerStyle, textStyle } from "../styles.mjs";
14
11
  const starred = (field) => {
15
12
  var _a;
16
13
  return (field == null ? void 0 : field.label) && ((_a = field == null ? void 0 : field.attributes) == null ? void 0 : _a.required) !== false ? field.label + " *" : field == null ? void 0 : field.label;
@@ -228,251 +225,6 @@ const FieldTextarea = ({
228
225
  }
229
226
  );
230
227
  };
231
- const birthdayValue = ({ day = "", month = "", year = "" } = {}) => !day && !month && !year ? "" : [year, month && String(month).padStart(2, "0"), day && String(day).padStart(2, "0")].join("-");
232
- const birthdayInputs = (value) => {
233
- const [year = "", month = "", day = ""] = typeof value === "string" && value ? value.split("-") : [];
234
- const typed = (part) => /^\d+$/.test(part) ? String(Number(part)) : part;
235
- return {
236
- day: typed(day),
237
- month: typed(month),
238
- year
239
- };
240
- };
241
- const FieldBirthday = ({
242
- error,
243
- field,
244
- onChange = () => {
245
- },
246
- style,
247
- value
248
- }) => {
249
- const [parts, setParts] = useState(() => birthdayInputs(value));
250
- const box = (key, label) => /* @__PURE__ */ jsxs(
251
- "div",
252
- {
253
- ...{
254
- className: "space-y-2 w-full"
255
- },
256
- children: [
257
- /* @__PURE__ */ jsx("p", { children: label }),
258
- /* @__PURE__ */ jsx(
259
- InputText,
260
- {
261
- ...{
262
- "aria-label": ((field == null ? void 0 : field.label) ? field.label + ", " : "") + label.toLowerCase(),
263
- inputMode: "numeric",
264
- onChange: (text) => {
265
- const next = {
266
- ...parts,
267
- [key]: text
268
- };
269
- setParts(next);
270
- onChange(birthdayValue(next));
271
- },
272
- style,
273
- value: parts[key] || ""
274
- }
275
- }
276
- )
277
- ]
278
- },
279
- key
280
- );
281
- return /* @__PURE__ */ jsx(
282
- InputGroup,
283
- {
284
- ...{
285
- error: error == null ? void 0 : error.message,
286
- input: /* @__PURE__ */ jsxs(
287
- "div",
288
- {
289
- ...{
290
- className: "flex items-center space-x-4 w-full"
291
- },
292
- children: [
293
- box("month", "Month"),
294
- box("day", "Day"),
295
- box("year", "Year")
296
- ]
297
- }
298
- ),
299
- label: starred(field),
300
- style
301
- }
302
- }
303
- );
304
- };
305
- const choiceRows = ({ field, picked, pick, round, style }) => {
306
- var _a;
307
- return /* @__PURE__ */ jsx(
308
- "div",
309
- {
310
- ...{
311
- className: "space-y-3",
312
- role: round ? "radiogroup" : "group",
313
- "aria-label": field == null ? void 0 : field.label
314
- },
315
- children: (((_a = field == null ? void 0 : field.settings) == null ? void 0 : _a.options) || []).map((item, index) => /* @__PURE__ */ jsx(
316
- InputCheckbox,
317
- {
318
- ...{
319
- label: item == null ? void 0 : item.option,
320
- labelId: "choice-" + ((field == null ? void 0 : field.id) || "field") + "-" + index,
321
- onChange: () => pick(item == null ? void 0 : item.option),
322
- round,
323
- style,
324
- value: picked(item == null ? void 0 : item.option)
325
- }
326
- },
327
- (item == null ? void 0 : item.id) || index
328
- ))
329
- }
330
- );
331
- };
332
- const FieldRadio = ({
333
- error,
334
- field,
335
- onChange = () => {
336
- },
337
- style,
338
- value
339
- }) => /* @__PURE__ */ jsx(
340
- InputGroup,
341
- {
342
- ...{
343
- error: error == null ? void 0 : error.message,
344
- input: choiceRows({
345
- field,
346
- pick: (option) => onChange(option),
347
- picked: (option) => Boolean(value) && value === option,
348
- round: true,
349
- style
350
- }),
351
- label: starred(field),
352
- style
353
- }
354
- }
355
- );
356
- const tick = (options = [], value, option) => {
357
- const ticked = Array.isArray(value) ? value : [];
358
- const next = ticked.includes(option) ? ticked.filter((item) => item !== option) : [...ticked, option];
359
- return (options || []).map((item) => item == null ? void 0 : item.option).filter((item) => next.includes(item));
360
- };
361
- const FieldCheckbox = ({
362
- error,
363
- field,
364
- onChange = () => {
365
- },
366
- style,
367
- value
368
- }) => /* @__PURE__ */ jsx(
369
- InputGroup,
370
- {
371
- ...{
372
- error: error == null ? void 0 : error.message,
373
- input: choiceRows({
374
- field,
375
- pick: (option) => {
376
- var _a;
377
- return onChange(tick((_a = field == null ? void 0 : field.settings) == null ? void 0 : _a.options, value, option));
378
- },
379
- picked: (option) => Array.isArray(value) && value.includes(option),
380
- round: false,
381
- style
382
- }),
383
- label: starred(field),
384
- style
385
- }
386
- }
387
- );
388
- const FieldRating = ({
389
- error,
390
- field,
391
- onChange = () => {
392
- },
393
- style,
394
- value
395
- }) => {
396
- var _a, _b, _c;
397
- const max = Number((_a = field == null ? void 0 : field.attributes) == null ? void 0 : _a.max) || 5;
398
- const low = (_b = field == null ? void 0 : field.settings) == null ? void 0 : _b.low;
399
- const high = (_c = field == null ? void 0 : field.settings) == null ? void 0 : _c.high;
400
- return /* @__PURE__ */ jsx(
401
- InputGroup,
402
- {
403
- ...{
404
- error: error == null ? void 0 : error.message,
405
- input: /* @__PURE__ */ jsxs(
406
- "div",
407
- {
408
- ...{
409
- className: "space-y-2 w-full"
410
- },
411
- children: [
412
- /* @__PURE__ */ jsx(
413
- "div",
414
- {
415
- ...{
416
- "aria-label": field == null ? void 0 : field.label,
417
- className: "grid w-full gap-1",
418
- role: "group",
419
- style: {
420
- gridTemplateColumns: "repeat(" + max + ", minmax(0, 1fr))"
421
- }
422
- },
423
- children: Array.from({ length: max }, (_, index) => index + 1).map((number) => /* @__PURE__ */ jsx(
424
- Button,
425
- {
426
- ...{
427
- "aria-pressed": Number(value) === number,
428
- onClick: () => onChange(number),
429
- variant: "link"
430
- },
431
- children: /* @__PURE__ */ jsx(
432
- "span",
433
- {
434
- ...{
435
- className: "flex items-center justify-center w-full h-10 border text-sm tabular-nums",
436
- style: Number(value) === number ? buttonStyle(style) : inputCheckboxStyle(style)
437
- },
438
- children: number
439
- }
440
- )
441
- },
442
- number
443
- ))
444
- }
445
- ),
446
- (low || high) && /* @__PURE__ */ jsxs(
447
- "div",
448
- {
449
- ...{
450
- className: "flex justify-between gap-4 text-xs",
451
- ...style && { style: textStyle(style) }
452
- },
453
- children: [
454
- /* @__PURE__ */ jsx("span", { children: low }),
455
- /* @__PURE__ */ jsx(
456
- "span",
457
- {
458
- ...{
459
- className: "text-right"
460
- },
461
- children: high
462
- }
463
- )
464
- ]
465
- }
466
- )
467
- ]
468
- }
469
- ),
470
- label: starred(field),
471
- style
472
- }
473
- }
474
- );
475
- };
476
228
  const FieldSection = ({
477
229
  field,
478
230
  style
@@ -537,18 +289,6 @@ const FieldSkill = ({
537
289
  }
538
290
  );
539
291
  const components = {
540
- birthday: (props) => /* @__PURE__ */ jsx(
541
- FieldBirthday,
542
- {
543
- ...props
544
- }
545
- ),
546
- checkbox: (props) => /* @__PURE__ */ jsx(
547
- FieldCheckbox,
548
- {
549
- ...props
550
- }
551
- ),
552
292
  email: (props) => /* @__PURE__ */ jsx(
553
293
  FieldEmail,
554
294
  {
@@ -573,18 +313,6 @@ const components = {
573
313
  ...props
574
314
  }
575
315
  ),
576
- radio: (props) => /* @__PURE__ */ jsx(
577
- FieldRadio,
578
- {
579
- ...props
580
- }
581
- ),
582
- rating: (props) => /* @__PURE__ */ jsx(
583
- FieldRating,
584
- {
585
- ...props
586
- }
587
- ),
588
316
  section: (props) => /* @__PURE__ */ jsx(
589
317
  FieldSection,
590
318
  {
@@ -618,11 +346,8 @@ const components = {
618
346
  };
619
347
  import { errors, validators } from "@drawbridge/drawbridge-utils/fields-validate";
620
348
  export {
621
- birthdayInputs,
622
- birthdayValue,
623
349
  components,
624
350
  errors,
625
351
  starred,
626
- tick,
627
352
  validators as validate
628
353
  };