@tesouro/embedded-components-react 0.11.206 → 0.11.209

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 (84) hide show
  1. package/dist/index.css +13 -126
  2. package/dist/index.d.ts +6 -5
  3. package/dist/lib/ReceivablesWidget.d.ts +6 -5
  4. package/dist/lib/WidgetSuite.d.ts +6 -5
  5. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/ReceivableAttachmentsSection.js +1 -1
  6. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/ReceivableCustomerSection.js +1 -1
  7. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/ReceivablesWidget.js +16 -18
  8. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/details.js +186 -239
  9. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/helpers.js +59 -52
  10. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/labels.js +5 -4
  11. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/paymentRecord.js +5 -5
  12. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/paymentTerms.js +1 -1
  13. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/preview.js +1 -1
  14. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/recurrence.js +1 -1
  15. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/recurringSeries.js +19 -23
  16. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/reminders.js +1 -1
  17. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/statusColors.js +34 -0
  18. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableActions.js +2 -6
  19. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableActionsModal.js +5 -1
  20. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableDetails.js +16 -16
  21. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableForm.js +1 -1
  22. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivablePaymentRecord.js +1 -2
  23. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivablesTable.js +2 -0
  24. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index.js +28 -27
  25. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index11.js +18 -120
  26. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index12.js +89 -84
  27. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index13.js +91 -36
  28. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index14.js +41 -2
  29. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index15.js +2 -12
  30. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index16.js +9 -9
  31. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index17.js +9 -25
  32. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index18.js +26 -208
  33. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index19.js +209 -52
  34. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index20.js +50 -208
  35. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index21.js +186 -138
  36. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index22.js +157 -12
  37. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index23.js +10 -19
  38. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index24.js +23 -2
  39. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index25.js +2 -116
  40. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index26.js +117 -3
  41. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index27.js +3 -198
  42. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index28.js +198 -2
  43. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index29.js +2 -54
  44. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index30.js +14 -19
  45. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index31.js +22 -8
  46. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index32.js +40 -77
  47. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index33.js +17 -37
  48. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index34.js +8 -18
  49. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index35.js +61 -38
  50. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index36.js +27 -27
  51. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index37.js +26 -15
  52. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index38.js +14 -6
  53. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index39.js +19 -35
  54. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index40.js +31 -14
  55. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index41.js +67 -24
  56. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index42.js +391 -84
  57. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index43.js +2 -494
  58. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index44.js +47 -2
  59. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index45.js +62 -38
  60. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index46.js +433 -61
  61. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index47.js +176 -428
  62. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index48.js +20 -224
  63. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index49.js +6 -21
  64. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index51.js +264 -0
  65. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index52.js +2 -264
  66. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index53.js +131 -2
  67. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index54.js +22 -126
  68. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index55.js +235 -23
  69. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index56.js +3 -239
  70. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index57.js +247 -3
  71. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index58.js +26 -244
  72. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index59.js +183 -26
  73. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index60.js +21 -194
  74. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index61.js +143 -21
  75. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index62.js +2 -143
  76. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index63.js +47 -2
  77. package/dist/libs/tesouro-embedded-components-react/shared/document-status/ui/dist/index.js +2 -2
  78. package/dist/libs/tesouro-embedded-components-react/shared/document-status/ui/dist/index7.js +2 -31
  79. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  80. package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/feature/dist/lib/helpers.js +1 -1
  81. package/dist/packages/shared-ui-shadcn/dist/index.js +1554 -1544
  82. package/package.json +1 -1
  83. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index50.js +0 -7
  84. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index64.js +0 -47
@@ -1,71 +1,443 @@
1
- import { Field as e, FieldContent as t, FieldDescription as n, FieldError as r, FieldLabel as i, Textarea as a, Typography as o } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
2
- import { jsx as s, jsxs as c } from "react/jsx-runtime";
1
+ import { Alert as e, AlertDescription as t, Button as n, Checkbox as r, Dialog as i, DialogContent as a, DialogDescription as o, DialogFooter as s, DialogHeader as c, DialogTitle as l, Field as u, FieldContent as d, FieldError as f, FieldLabel as p, Input as m, Label as h, Select as g, SelectContent as _, SelectItem as v, SelectTrigger as y, SelectValue as b, Separator as x, Spinner as S, Typography as C, cn as w } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
2
+ import { RECEIVABLE_FORM_DIALOG_LABELS_EN as ee } from "./index19.js";
3
+ import { ReceivableFormTotals as te } from "./index44.js";
4
+ import { ReceivableNotesSection as T } from "./index45.js";
5
+ import { useId as ne } from "react";
6
+ import { jsx as E, jsxs as D } from "react/jsx-runtime";
7
+ import { CircleAlertIcon as O, MinusIcon as k, PlusIcon as A, Trash2Icon as j, XIcon as M } from "lucide-react";
3
8
  // ../../libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index46.js
4
- function l({ id: l, value: u, error: d, disabled: f, label: p, optionalSuffix: m, placeholder: h, description: g, onChange: _ }) {
5
- return /* @__PURE__ */ s(e, { children: /* @__PURE__ */ c(t, { children: [
6
- /* @__PURE__ */ c(i, {
7
- htmlFor: l,
8
- className: "ttw:text-nowrap",
9
- children: [p, /* @__PURE__ */ s(o, {
10
- variant: "body2",
11
- component: "span",
12
- color: "muted",
13
- className: "ttw:leading-snug",
14
- children: m
15
- })]
16
- }),
17
- /* @__PURE__ */ s(a, {
18
- id: l,
19
- value: u,
20
- disabled: f,
21
- placeholder: h,
22
- className: "ttw:h-26 ttw:resize-none",
23
- "aria-invalid": !!d,
24
- onChange: (e) => _(e.target.value)
25
- }),
26
- /* @__PURE__ */ s(n, { children: g }),
27
- /* @__PURE__ */ s(r, { errors: d ? [{ message: d }] : [] })
28
- ] }) });
9
+ var N = "__none__", P = "__manage__", F = "ttw:flex ttw:h-9 ttw:min-w-0 ttw:items-center ttw:rounded-md ttw:border ttw:border-input ttw:shadow-xs ttw:transition-[color,box-shadow] ttw:has-[input:focus-visible]:border-ring ttw:has-[input:focus-visible]:ring-[3px] ttw:has-[input:focus-visible]:ring-ring/50 ttw:has-[[aria-invalid=true]]:border-destructive", I = "ttw:h-full ttw:min-w-0 ttw:flex-1 ttw:bg-transparent ttw:text-right ttw:text-base ttw:outline-none ttw:placeholder:text-muted-foreground ttw:disabled:cursor-not-allowed ttw:disabled:opacity-50 ttw:md:text-sm", L = "ttw:flex ttw:items-center ttw:text-sm ttw:font-medium ttw:text-muted-foreground ttw:select-none", R = "ttw:flex ttw:size-6 ttw:shrink-0 ttw:cursor-pointer ttw:items-center ttw:justify-center ttw:rounded-sm ttw:text-muted-foreground ttw:outline-none ttw:transition-all ttw:hover:bg-accent ttw:hover:text-accent-foreground ttw:focus-visible:ring-[3px] ttw:focus-visible:ring-ring/50 ttw:disabled:pointer-events-none ttw:disabled:opacity-50";
10
+ function re({ message: e }) {
11
+ return e ? /* @__PURE__ */ E("p", {
12
+ className: "ttw:text-sm ttw:text-destructive",
13
+ children: e
14
+ }) : null;
29
15
  }
30
- function u({ idPrefix: e, openingNote: t, closingNote: n, openingNoteError: r, closingNoteError: i, disabled: a, onOpeningNoteChange: u, onClosingNoteChange: d, labels: f }) {
31
- return /* @__PURE__ */ c("div", {
32
- className: "ttw:flex ttw:flex-col ttw:gap-2.5 ttw:rounded-xl ttw:border ttw:border-border ttw:p-6",
16
+ function ie({ formId: e, lineItem: t, errors: i, controls: a, focusOnMount: o, canRemove: s, unitOptions: c, currencySymbol: l, labels: u, renderProductSelector: d, onChange: f, onCommit: p, onQuantityStep: m, onManageUnits: h, onRemove: x }) {
17
+ let S = `${e}-line-${t.id}`;
18
+ return /* @__PURE__ */ D("li", {
19
+ className: "ttw:flex ttw:h-9 ttw:items-center ttw:gap-2.5",
33
20
  children: [
34
- /* @__PURE__ */ c("div", {
35
- className: "ttw:flex ttw:flex-col ttw:gap-2.5 ttw:pb-4",
36
- children: [/* @__PURE__ */ s(o, {
37
- variant: "h4",
38
- children: f.notesHeading
39
- }), /* @__PURE__ */ s(o, {
40
- variant: "body2",
41
- color: "muted",
42
- className: "ttw:font-medium",
43
- children: f.notesDescription
21
+ /* @__PURE__ */ E("div", {
22
+ className: "ttw:min-w-30 ttw:flex-1",
23
+ children: d(t, {
24
+ inputId: `${S}-name`,
25
+ invalid: !!i?.name,
26
+ focusOnMount: o
27
+ })
28
+ }),
29
+ /* @__PURE__ */ D("div", {
30
+ className: w(F, "ttw:w-26 ttw:min-w-26 ttw:px-[0.3rem]"),
31
+ children: [
32
+ /* @__PURE__ */ E("button", {
33
+ type: "button",
34
+ "aria-label": u.decreaseQuantityButton,
35
+ disabled: a ? !a.canDecreaseQuantity : !1,
36
+ className: R,
37
+ onClick: () => m(-1),
38
+ children: /* @__PURE__ */ E(k, { className: "ttw:size-3.5" })
39
+ }),
40
+ /* @__PURE__ */ E("input", {
41
+ id: `${S}-quantity`,
42
+ "aria-label": u.quantityLabel,
43
+ "aria-invalid": !!i?.quantity || void 0,
44
+ type: "text",
45
+ inputMode: "decimal",
46
+ className: "ttw:h-full ttw:w-full ttw:min-w-0 ttw:bg-transparent ttw:px-0 ttw:text-center ttw:text-sm ttw:outline-none",
47
+ value: t.quantity,
48
+ onChange: (e) => f({ quantity: e.target.value }),
49
+ onBlur: () => p("quantity")
50
+ }),
51
+ /* @__PURE__ */ E("button", {
52
+ type: "button",
53
+ "aria-label": u.increaseQuantityButton,
54
+ disabled: a ? !a.canIncreaseQuantity : !1,
55
+ className: R,
56
+ onClick: () => m(1),
57
+ children: /* @__PURE__ */ E(A, { className: "ttw:size-3.5" })
58
+ })
59
+ ]
60
+ }),
61
+ /* @__PURE__ */ E("div", { children: /* @__PURE__ */ D(g, {
62
+ value: t.unit || N,
63
+ onValueChange: (e) => {
64
+ e === P ? h?.() : f({ unit: e === N ? "" : e });
65
+ },
66
+ children: [/* @__PURE__ */ E(y, {
67
+ id: `${S}-unit`,
68
+ "aria-label": u.unitLabel,
69
+ "aria-invalid": !!i?.measureUnit || void 0,
70
+ className: "ttw:w-22",
71
+ children: /* @__PURE__ */ E(b, {
72
+ className: "ttw:truncate",
73
+ placeholder: u.unitPlaceholder
74
+ })
75
+ }), /* @__PURE__ */ D(_, { children: [
76
+ h && /* @__PURE__ */ D(v, {
77
+ value: P,
78
+ className: "ttw:font-semibold ttw:text-primary ttw:hover:text-primary ttw:focus:text-primary",
79
+ children: [/* @__PURE__ */ E(A, { className: "ttw:text-primary" }), u.manageUnitsOption]
80
+ }),
81
+ /* @__PURE__ */ E(v, {
82
+ value: N,
83
+ children: u.unitNone
84
+ }),
85
+ c.map((e) => /* @__PURE__ */ E(v, {
86
+ value: e.value,
87
+ children: e.label
88
+ }, e.value))
89
+ ] })]
90
+ }) }),
91
+ /* @__PURE__ */ D("div", {
92
+ className: w(F, "ttw:w-full ttw:max-w-41 ttw:min-w-29"),
93
+ children: [/* @__PURE__ */ E("span", {
94
+ className: w(L, "ttw:pl-3"),
95
+ children: l
96
+ }), /* @__PURE__ */ E("input", {
97
+ id: `${S}-price`,
98
+ "aria-label": u.priceLabel,
99
+ "aria-invalid": !!i?.price || void 0,
100
+ type: "text",
101
+ inputMode: "decimal",
102
+ className: w(I, "ttw:pr-3 ttw:pl-2"),
103
+ value: t.price,
104
+ onChange: (e) => f({ price: e.target.value }),
105
+ onBlur: () => p("price")
44
106
  })]
45
107
  }),
46
- /* @__PURE__ */ s(l, {
47
- id: `${e}-opening-note`,
48
- value: t,
49
- error: r,
50
- disabled: a,
51
- label: f.openingNoteLabel,
52
- optionalSuffix: f.optionalSuffix,
53
- placeholder: f.openingNotePlaceholder,
54
- description: f.openingNoteDescription,
55
- onChange: u
108
+ /* @__PURE__ */ E("div", {
109
+ className: "ttw:flex ttw:w-12 ttw:min-w-12 ttw:items-center ttw:justify-center",
110
+ children: /* @__PURE__ */ E(r, {
111
+ id: `${S}-taxable`,
112
+ "aria-label": u.taxableLabel,
113
+ checked: t.taxable,
114
+ onCheckedChange: (e) => f({ taxable: e === !0 })
115
+ })
56
116
  }),
57
- /* @__PURE__ */ s(l, {
58
- id: `${e}-closing-note`,
59
- value: n,
60
- error: i,
61
- disabled: a,
62
- label: f.closingNoteLabel,
63
- optionalSuffix: f.optionalSuffix,
64
- placeholder: f.closingNotePlaceholder,
65
- description: f.closingNoteDescription,
66
- onChange: d
117
+ s && /* @__PURE__ */ E(n, {
118
+ type: "button",
119
+ variant: "ghost",
120
+ size: "sm",
121
+ "aria-label": u.removeLineItemButton,
122
+ className: "ttw:w-10 ttw:rounded-none ttw:border-l ttw:border-border ttw:pl-4 ttw:text-muted-foreground ttw:hover:bg-transparent ttw:hover:text-destructive ttw:has-[>svg]:pr-0",
123
+ onClick: x,
124
+ children: /* @__PURE__ */ E(j, {})
67
125
  })
68
126
  ]
69
127
  });
70
128
  }
71
- export { u as ReceivableNotesSection };
129
+ function ae({ inputId: e, discountType: t, value: n, error: r, currencySymbol: i, disabled: a, labels: o, onChange: s, onTypeChange: c, onFocus: l, onBlur: m }) {
130
+ let h = `${e}-error`, g = [{
131
+ type: "amount",
132
+ label: i,
133
+ ariaLabel: o.discountAmountOptionAriaLabel
134
+ }, {
135
+ type: "percentage",
136
+ label: o.discountPercentageOption,
137
+ ariaLabel: o.discountPercentageOptionAriaLabel
138
+ }];
139
+ return /* @__PURE__ */ D(u, {
140
+ className: "ttw:flex-col",
141
+ children: [/* @__PURE__ */ D(d, {
142
+ className: "ttw:flex-row ttw:items-center ttw:justify-end",
143
+ children: [/* @__PURE__ */ E(p, {
144
+ htmlFor: e,
145
+ className: w(r && "ttw:text-destructive"),
146
+ children: o.discountLabel
147
+ }), /* @__PURE__ */ D("div", {
148
+ className: w(F, "ttw:w-40 ttw:overflow-hidden"),
149
+ children: [/* @__PURE__ */ E("div", {
150
+ className: w(L, "ttw:items-stretch ttw:self-stretch"),
151
+ children: g.map((e) => /* @__PURE__ */ E("button", {
152
+ type: "button",
153
+ "aria-label": e.ariaLabel,
154
+ "aria-pressed": t === e.type,
155
+ disabled: a,
156
+ className: w("ttw:h-full ttw:w-9 ttw:cursor-pointer ttw:border-r ttw:border-input ttw:text-sm ttw:transition-colors ttw:disabled:pointer-events-none ttw:disabled:opacity-50", t === e.type ? "ttw:bg-primary ttw:text-primary-foreground" : "ttw:text-muted-foreground ttw:hover:bg-muted ttw:hover:text-foreground"),
157
+ onClick: () => c(e.type),
158
+ children: e.label
159
+ }, e.type))
160
+ }), /* @__PURE__ */ E("input", {
161
+ id: e,
162
+ type: "text",
163
+ inputMode: "decimal",
164
+ className: w(I, "ttw:pr-3 ttw:pl-2"),
165
+ "aria-invalid": !!r || void 0,
166
+ "aria-describedby": r ? h : void 0,
167
+ disabled: a,
168
+ value: n,
169
+ onChange: (e) => s(e.target.value),
170
+ onFocus: l,
171
+ onBlur: m
172
+ })]
173
+ })]
174
+ }), r && /* @__PURE__ */ E(f, {
175
+ id: h,
176
+ className: "ttw:text-right",
177
+ children: r
178
+ })]
179
+ });
180
+ }
181
+ function z({ open: r, onRequestClose: g, mode: _ = "create", values: v, errors: y, unitOptions: b, currencySymbol: k, lineItemControls: j, autoFocusLineItemId: N, lineItemsLoading: P, inProgress: R, customerSection: z, renderProductSelector: B, onChange: V, onLineItemChange: H, onLineItemCommit: U, onLineItemQuantityStep: W, onTaxRateCommit: G, onDiscountFocus: K, onDiscountCommit: q, totals: J, onManageUnits: oe, onAddLineItem: se, onRemoveLineItem: ce, showDueDateField: le, billingSection: ue, bankAccountSection: de, attachmentsSection: fe, preview: pe, closeDisabled: me, cancelDisabled: he, draftButtonLabel: Y, draftDisabled: X, draftLoading: ge, primaryButtonLabel: _e, primaryDisabled: ve, primaryLoading: ye, scrollContainerRef: be, onSubmit: xe, onDraftClick: Z, onPrimaryClick: Se, labels: Ce }) {
182
+ let Q = {
183
+ ...ee,
184
+ ...Ce
185
+ }, $ = ne();
186
+ return /* @__PURE__ */ E(i, {
187
+ open: r,
188
+ onOpenChange: (e) => {
189
+ e || g();
190
+ },
191
+ children: /* @__PURE__ */ D(a, {
192
+ showCloseButton: !1,
193
+ fullScreen: !0,
194
+ className: "ttw:flex ttw:flex-col ttw:gap-0 ttw:overflow-hidden ttw:p-0",
195
+ onInteractOutside: (e) => e.preventDefault(),
196
+ onEscapeKeyDown: (e) => {
197
+ let t = e.target;
198
+ t instanceof Element && t.closest("[role=\"combobox\"][aria-expanded=\"true\"]") && e.preventDefault();
199
+ },
200
+ children: [/* @__PURE__ */ D(c, {
201
+ className: "ttw:w-full ttw:flex-row ttw:items-center ttw:justify-between ttw:border-b ttw:border-border ttw:px-6 ttw:pt-6 ttw:pb-7",
202
+ children: [/* @__PURE__ */ D("div", {
203
+ className: "ttw:flex ttw:flex-col ttw:gap-1.5",
204
+ children: [/* @__PURE__ */ E(l, {
205
+ className: "ttw:text-xl",
206
+ children: _ === "edit" ? Q.editTitle : _ === "createRecurring" ? Q.createRecurringTitle : Q.createTitle
207
+ }), /* @__PURE__ */ E(o, {
208
+ className: w(_ === "edit" && "ttw:sr-only"),
209
+ children: _ === "edit" ? Q.editDescription : Q.createDescription
210
+ })]
211
+ }), /* @__PURE__ */ E(n, {
212
+ type: "button",
213
+ variant: "ghost",
214
+ className: "ttw:p-2 ttw:has-[>svg]:px-2",
215
+ "aria-label": Q.closeButton,
216
+ disabled: me,
217
+ onClick: g,
218
+ children: /* @__PURE__ */ E(M, { className: "ttw:size-6.5" })
219
+ })]
220
+ }), /* @__PURE__ */ D("div", {
221
+ className: "ttw:flex ttw:min-h-0 ttw:flex-1",
222
+ children: [/* @__PURE__ */ D("div", {
223
+ ref: be,
224
+ className: "ttw:h-full ttw:min-h-0 ttw:w-1/2 ttw:overflow-auto ttw:px-8 ttw:pt-6",
225
+ children: [/* @__PURE__ */ D("form", {
226
+ id: $,
227
+ noValidate: !0,
228
+ className: "ttw:pb-10",
229
+ onSubmit: (e) => {
230
+ e.preventDefault(), e.stopPropagation(), xe();
231
+ },
232
+ children: [/* @__PURE__ */ E("button", {
233
+ type: "submit",
234
+ className: "ttw:sr-only",
235
+ tabIndex: -1,
236
+ "aria-hidden": "true",
237
+ disabled: X,
238
+ onClick: Z
239
+ }), /* @__PURE__ */ D("div", {
240
+ className: "ttw:flex ttw:flex-col ttw:gap-8",
241
+ children: [
242
+ z,
243
+ le && /* @__PURE__ */ E("div", {
244
+ className: "ttw:grid ttw:grid-cols-2 ttw:gap-4",
245
+ children: /* @__PURE__ */ D("div", {
246
+ className: "ttw:flex ttw:flex-col ttw:gap-1.5",
247
+ children: [
248
+ /* @__PURE__ */ E(h, {
249
+ htmlFor: `${$}-due-date`,
250
+ children: Q.dueDateLabel
251
+ }),
252
+ /* @__PURE__ */ E(m, {
253
+ id: `${$}-due-date`,
254
+ type: "date",
255
+ value: v.dueDate,
256
+ onChange: (e) => V({ dueDate: e.target.value })
257
+ }),
258
+ /* @__PURE__ */ E(re, { message: y?.dueDate })
259
+ ]
260
+ })
261
+ }),
262
+ ue,
263
+ /* @__PURE__ */ D("div", {
264
+ className: "ttw:flex ttw:flex-col ttw:gap-2.5 ttw:rounded-xl ttw:border ttw:border-border ttw:p-6",
265
+ children: [
266
+ /* @__PURE__ */ D("div", {
267
+ className: "ttw:flex ttw:flex-col ttw:gap-2.5 ttw:pb-4",
268
+ children: [/* @__PURE__ */ E(C, {
269
+ variant: "h4",
270
+ children: Q.lineItemsHeading
271
+ }), /* @__PURE__ */ E(C, {
272
+ variant: "body2",
273
+ color: "muted",
274
+ className: "ttw:font-medium",
275
+ children: Q.lineItemsDescription
276
+ })]
277
+ }),
278
+ y?.lineItemsSummary?.length ? /* @__PURE__ */ D(e, {
279
+ variant: "destructive",
280
+ className: "ttw:flex ttw:mb-2",
281
+ children: [/* @__PURE__ */ E(O, {}), /* @__PURE__ */ E(t, { children: /* @__PURE__ */ E("ul", { children: y.lineItemsSummary.map((e) => /* @__PURE__ */ E("li", { children: e }, e)) }) })]
282
+ }) : null,
283
+ /* @__PURE__ */ D("ul", {
284
+ className: "ttw:flex ttw:flex-col ttw:gap-2.5",
285
+ children: [/* @__PURE__ */ D("li", {
286
+ "aria-hidden": !0,
287
+ className: "ttw:flex ttw:h-5 ttw:items-center ttw:gap-2.5 ttw:text-sm ttw:leading-5 ttw:font-medium",
288
+ children: [
289
+ /* @__PURE__ */ E("span", {
290
+ className: "ttw:inline-flex ttw:min-w-30 ttw:flex-1 ttw:whitespace-nowrap",
291
+ children: Q.productLabel
292
+ }),
293
+ /* @__PURE__ */ E("span", {
294
+ className: "ttw:w-24 ttw:min-w-24",
295
+ children: Q.quantityLabel
296
+ }),
297
+ /* @__PURE__ */ E("span", {
298
+ className: "ttw:w-20.5 ttw:min-w-20.5",
299
+ children: Q.unitLabel
300
+ }),
301
+ /* @__PURE__ */ E("span", {
302
+ className: "ttw:w-full ttw:max-w-41 ttw:min-w-29",
303
+ children: Q.priceLabel
304
+ }),
305
+ /* @__PURE__ */ E("span", {
306
+ className: "ttw:w-12 ttw:min-w-12",
307
+ children: Q.taxableLabel
308
+ }),
309
+ v.lineItems.length > 1 && /* @__PURE__ */ E("span", { className: "ttw:w-10 ttw:min-w-10" })
310
+ ]
311
+ }), P ? /* @__PURE__ */ E("li", {
312
+ className: "ttw:flex ttw:h-9 ttw:items-center ttw:justify-center",
313
+ children: /* @__PURE__ */ E(S, { className: "ttw:size-5" })
314
+ }) : v.lineItems.map((e) => /* @__PURE__ */ E(ie, {
315
+ formId: $,
316
+ lineItem: e,
317
+ errors: y?.lineItems?.[e.id],
318
+ controls: j?.[e.id],
319
+ focusOnMount: e.id === N,
320
+ canRemove: v.lineItems.length > 1,
321
+ unitOptions: b,
322
+ currencySymbol: k,
323
+ labels: Q,
324
+ renderProductSelector: B,
325
+ onChange: (t) => H(e.id, t),
326
+ onCommit: (t) => U(e.id, t),
327
+ onQuantityStep: (t) => W(e.id, t),
328
+ onManageUnits: oe,
329
+ onRemove: () => ce(e.id)
330
+ }, e.id))]
331
+ }),
332
+ /* @__PURE__ */ D(n, {
333
+ type: "button",
334
+ variant: "ghost",
335
+ className: "ttw:w-fit ttw:text-primary ttw:hover:text-primary",
336
+ onClick: se,
337
+ children: [/* @__PURE__ */ E(A, { className: "ttw:size-5 ttw:text-primary" }), Q.addLineItemButton]
338
+ }),
339
+ /* @__PURE__ */ E(ae, {
340
+ inputId: `${$}-discount`,
341
+ discountType: v.discountType,
342
+ value: v.discount,
343
+ error: y?.discount,
344
+ currencySymbol: k,
345
+ disabled: R,
346
+ labels: Q,
347
+ onChange: (e) => V({ discount: e }),
348
+ onTypeChange: (e) => V({ discountType: e }),
349
+ onFocus: K,
350
+ onBlur: q
351
+ }),
352
+ /* @__PURE__ */ D(u, {
353
+ className: "ttw:flex-col",
354
+ children: [/* @__PURE__ */ D(d, {
355
+ className: "ttw:flex-row ttw:justify-end",
356
+ children: [/* @__PURE__ */ E(p, {
357
+ htmlFor: `${$}-tax-rate`,
358
+ className: w(y?.taxRate && "ttw:text-destructive"),
359
+ children: Q.taxRateLabel
360
+ }), /* @__PURE__ */ D("div", {
361
+ className: w(F, "ttw:w-40"),
362
+ children: [/* @__PURE__ */ E("input", {
363
+ id: `${$}-tax-rate`,
364
+ className: w(I, "ttw:pl-3"),
365
+ placeholder: Q.taxRatePlaceholder,
366
+ type: "text",
367
+ inputMode: "decimal",
368
+ "aria-invalid": !!y?.taxRate || void 0,
369
+ "aria-describedby": y?.taxRate ? `${$}-tax-rate-error` : void 0,
370
+ value: v.taxRate,
371
+ onChange: (e) => V({ taxRate: e.target.value }),
372
+ onBlur: G
373
+ }), /* @__PURE__ */ E("span", {
374
+ className: w(L, "ttw:pr-3"),
375
+ children: Q.taxRateSuffix
376
+ })]
377
+ })]
378
+ }), y?.taxRate && /* @__PURE__ */ E(f, {
379
+ id: `${$}-tax-rate-error`,
380
+ className: "ttw:text-right",
381
+ children: y.taxRate
382
+ })]
383
+ }),
384
+ /* @__PURE__ */ E(x, {}),
385
+ /* @__PURE__ */ E(te, {
386
+ totals: J,
387
+ labels: Q
388
+ })
389
+ ]
390
+ }),
391
+ de,
392
+ /* @__PURE__ */ E(T, {
393
+ idPrefix: $,
394
+ openingNote: v.openingNote,
395
+ closingNote: v.closingNote,
396
+ openingNoteError: y?.openingNote,
397
+ closingNoteError: y?.closingNote,
398
+ disabled: R,
399
+ onOpeningNoteChange: (e) => V({ openingNote: e }),
400
+ onClosingNoteChange: (e) => V({ closingNote: e }),
401
+ labels: Q
402
+ }),
403
+ fe
404
+ ]
405
+ })]
406
+ }), /* @__PURE__ */ D(s, {
407
+ className: "ttw:sticky ttw:bottom-0 ttw:z-10 ttw:flex-row ttw:items-center ttw:justify-end ttw:gap-4 ttw:bg-background ttw:px-6 ttw:pt-3 ttw:pb-6",
408
+ children: [
409
+ /* @__PURE__ */ E(n, {
410
+ type: "button",
411
+ variant: "ghost",
412
+ disabled: he,
413
+ onClick: g,
414
+ children: Q.cancelButton
415
+ }),
416
+ Y && /* @__PURE__ */ E(n, {
417
+ type: "submit",
418
+ form: $,
419
+ variant: "secondary",
420
+ loading: ge,
421
+ disabled: X,
422
+ onClick: Z,
423
+ children: Y
424
+ }),
425
+ /* @__PURE__ */ E(n, {
426
+ type: "submit",
427
+ form: $,
428
+ loading: ye,
429
+ disabled: ve,
430
+ onClick: Se,
431
+ children: _e
432
+ })
433
+ ]
434
+ })]
435
+ }), /* @__PURE__ */ E("div", {
436
+ className: "ttw:h-full ttw:min-h-0 ttw:w-1/2 ttw:overflow-auto ttw:bg-muted",
437
+ children: pe
438
+ })]
439
+ })]
440
+ })
441
+ });
442
+ }
443
+ export { z as ReceivableFormDialog, z as default };