@tesouro/embedded-components-react 0.11.235 → 0.11.237

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