@tesouro/embedded-components-react 0.5.279 → 0.5.280

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 (104) hide show
  1. package/dist/index.d.ts +21 -6
  2. package/dist/lib/ReceivablesWidget.d.ts +21 -6
  3. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index.js +14 -13
  4. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index10.js +24 -168
  5. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index11.js +173 -44
  6. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index12.js +42 -94
  7. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index13.js +91 -76
  8. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index14.js +67 -173
  9. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index15.js +186 -17
  10. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index16.js +27 -0
  11. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index3.js +11 -13
  12. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index4.js +42 -27
  13. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index5.js +28 -132
  14. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index6.js +137 -16
  15. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index7.js +16 -62
  16. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index8.js +66 -28
  17. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index9.js +28 -34
  18. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/ReceivableAttachmentsSection.js +1 -1
  19. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/ReceivableCustomerSection.js +38 -0
  20. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/ReceivablesWidget.js +304 -287
  21. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/auditHistory/labels.js +1 -1
  22. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/customer.js +58 -0
  23. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/helpers.js +15 -15
  24. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/labels.js +14 -6
  25. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/paymentTerms.js +1 -1
  26. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/permissions.js +2 -1
  27. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/preview.js +62 -62
  28. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/recurrence.js +41 -35
  29. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/reminders.js +1 -1
  30. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/totals.js +21 -13
  31. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableActions.js +124 -124
  32. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableActionsModal.js +11 -11
  33. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableAttachmentUploads.js +13 -13
  34. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableBankAccount.js +1 -1
  35. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableCustomerPicker.js +109 -0
  36. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableDetails.js +6 -6
  37. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableForm.js +520 -476
  38. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableIssuePreflight.js +10 -10
  39. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivablePaymentRecord.js +6 -6
  40. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivablePaymentTerms.js +1 -1
  41. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivablePreview.js +1 -1
  42. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableRecurrence.js +92 -77
  43. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableReminders.js +11 -11
  44. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableStatusCards.js +1 -1
  45. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivablesTable.js +4 -4
  46. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivablesWidget.js +79 -75
  47. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useSendReceivableWithPaymentLink.js +3 -3
  48. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index.js +26 -23
  49. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index12.js +9 -25
  50. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index13.js +26 -228
  51. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index14.js +227 -52
  52. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index15.js +50 -212
  53. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index16.js +193 -138
  54. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index17.js +157 -12
  55. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index18.js +10 -19
  56. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index19.js +23 -2
  57. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index20.js +2 -116
  58. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index21.js +118 -3
  59. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index22.js +3 -39
  60. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index23.js +209 -53
  61. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index24.js +2 -23
  62. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index25.js +36 -7
  63. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index26.js +53 -77
  64. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index27.js +17 -35
  65. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index28.js +8 -18
  66. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index29.js +73 -37
  67. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index30.js +36 -26
  68. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index31.js +17 -19
  69. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index32.js +39 -8
  70. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index33.js +26 -33
  71. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index34.js +20 -14
  72. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index35.js +8 -24
  73. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index36.js +34 -84
  74. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index37.js +14 -492
  75. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index38.js +28 -2
  76. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index39.js +79 -39
  77. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index40.js +490 -68
  78. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index41.js +2 -487
  79. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index42.js +41 -217
  80. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index43.js +70 -21
  81. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index44.js +440 -5
  82. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index45.js +224 -0
  83. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index46.js +21 -263
  84. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index47.js +8 -2
  85. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index49.js +261 -24
  86. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index50.js +2 -237
  87. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index51.js +100 -3
  88. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index52.js +21 -242
  89. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index53.js +226 -82
  90. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index54.js +3 -60
  91. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index55.js +233 -178
  92. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index56.js +85 -37
  93. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index57.js +60 -0
  94. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index58.js +194 -0
  95. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index59.js +45 -0
  96. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/index.js +9 -9
  97. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/CounterpartSelector.js +2 -23
  98. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/useCounterpartSelector.js +2 -51
  99. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index.js +8 -8
  100. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index15.js +4 -80
  101. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index2.js +10 -22
  102. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  103. package/package.json +1 -1
  104. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index48.js +0 -100
@@ -1,8 +1,443 @@
1
- import { Fragment as e } from "react";
2
- import { jsx as t, jsxs as n } 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 "./index14.js";
3
+ import { ReceivableFormTotals as te } from "./index42.js";
4
+ import { ReceivableNotesSection as T } from "./index43.js";
5
+ import { useId as ne } from "react";
6
+ import { jsx as E, jsxs as D } from "react/jsx-runtime";
7
+ import { MinusIcon as O, PlusIcon as k, Trash2Icon as A, XIcon as j } from "lucide-react";
3
8
  //#region ../../libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index44.js
4
- function r({ lines: r }) {
5
- return r.map((r, i) => /* @__PURE__ */ n(e, { children: [i > 0 && /* @__PURE__ */ t("br", {}), r] }, `${i}-${r}`));
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-[calc(var(--radius)-5px)] 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 R({ message: e }) {
11
+ return e ? /* @__PURE__ */ E("p", {
12
+ className: "ttw:text-sm ttw:text-destructive",
13
+ children: e
14
+ }) : null;
15
+ }
16
+ function re({ 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",
20
+ children: [
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(P, "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: L,
37
+ onClick: () => m(-1),
38
+ children: /* @__PURE__ */ E(O, { 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: L,
56
+ onClick: () => m(1),
57
+ children: /* @__PURE__ */ E(k, { className: "ttw:size-3.5" })
58
+ })
59
+ ]
60
+ }),
61
+ /* @__PURE__ */ D(g, {
62
+ value: t.unit || M,
63
+ onValueChange: (e) => {
64
+ if (e === N) {
65
+ h?.();
66
+ return;
67
+ }
68
+ f({ unit: e === M ? "" : e });
69
+ },
70
+ children: [/* @__PURE__ */ E(y, {
71
+ id: `${S}-unit`,
72
+ "aria-label": u.unitLabel,
73
+ "aria-invalid": !!i?.measureUnit || void 0,
74
+ className: "ttw:w-22",
75
+ children: /* @__PURE__ */ E(b, {
76
+ className: "ttw:truncate",
77
+ placeholder: u.unitPlaceholder
78
+ })
79
+ }), /* @__PURE__ */ D(_, { children: [
80
+ h && /* @__PURE__ */ D(v, {
81
+ value: N,
82
+ className: "ttw:font-semibold ttw:text-primary ttw:hover:text-primary ttw:focus:text-primary",
83
+ children: [/* @__PURE__ */ E(k, { className: "ttw:text-primary" }), u.manageUnitsOption]
84
+ }),
85
+ /* @__PURE__ */ E(v, {
86
+ value: M,
87
+ children: u.unitNone
88
+ }),
89
+ c.map((e) => /* @__PURE__ */ E(v, {
90
+ value: e.value,
91
+ children: e.label
92
+ }, e.value))
93
+ ] })]
94
+ }),
95
+ /* @__PURE__ */ D("div", {
96
+ className: w(P, "ttw:w-full ttw:max-w-41 ttw:min-w-29"),
97
+ children: [/* @__PURE__ */ E("span", {
98
+ className: w(I, "ttw:pl-3"),
99
+ children: l
100
+ }), /* @__PURE__ */ E("input", {
101
+ id: `${S}-price`,
102
+ "aria-label": u.priceLabel,
103
+ "aria-invalid": !!i?.price || void 0,
104
+ type: "text",
105
+ inputMode: "decimal",
106
+ className: w(F, "ttw:pr-3 ttw:pl-2"),
107
+ value: t.price,
108
+ onChange: (e) => f({ price: e.target.value }),
109
+ onBlur: () => p("price")
110
+ })]
111
+ }),
112
+ /* @__PURE__ */ E("div", {
113
+ className: "ttw:flex ttw:w-12 ttw:min-w-12 ttw:items-center ttw:justify-center",
114
+ children: /* @__PURE__ */ E(r, {
115
+ id: `${S}-taxable`,
116
+ "aria-label": u.taxableLabel,
117
+ checked: t.taxable,
118
+ onCheckedChange: (e) => f({ taxable: e === !0 })
119
+ })
120
+ }),
121
+ s && /* @__PURE__ */ E(n, {
122
+ type: "button",
123
+ variant: "ghost",
124
+ size: "sm",
125
+ "aria-label": u.removeLineItemButton,
126
+ 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",
127
+ onClick: x,
128
+ children: /* @__PURE__ */ E(A, {})
129
+ })
130
+ ]
131
+ });
132
+ }
133
+ function z({ inputId: e, discountType: t, value: n, error: r, currencySymbol: i, disabled: a, labels: o, onChange: s, onTypeChange: c, onFocus: l, onBlur: m }) {
134
+ let h = `${e}-error`, g = [{
135
+ type: "amount",
136
+ label: i,
137
+ ariaLabel: o.discountAmountOptionAriaLabel
138
+ }, {
139
+ type: "percentage",
140
+ label: o.discountPercentageOption,
141
+ ariaLabel: o.discountPercentageOptionAriaLabel
142
+ }];
143
+ return /* @__PURE__ */ D(u, {
144
+ className: "ttw:flex-col",
145
+ children: [/* @__PURE__ */ D(d, {
146
+ className: "ttw:flex-row ttw:items-center ttw:justify-end",
147
+ children: [/* @__PURE__ */ E(p, {
148
+ htmlFor: e,
149
+ className: w(r && "ttw:text-destructive"),
150
+ children: o.discountLabel
151
+ }), /* @__PURE__ */ D("div", {
152
+ className: w(P, "ttw:w-40 ttw:overflow-hidden"),
153
+ children: [/* @__PURE__ */ E("div", {
154
+ className: w(I, "ttw:items-stretch ttw:self-stretch"),
155
+ children: g.map((e) => /* @__PURE__ */ E("button", {
156
+ type: "button",
157
+ "aria-label": e.ariaLabel,
158
+ "aria-pressed": t === e.type,
159
+ disabled: a,
160
+ 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"),
161
+ onClick: () => c(e.type),
162
+ children: e.label
163
+ }, e.type))
164
+ }), /* @__PURE__ */ E("input", {
165
+ id: e,
166
+ type: "text",
167
+ inputMode: "decimal",
168
+ className: w(F, "ttw:pr-3 ttw:pl-2"),
169
+ "aria-invalid": !!r || void 0,
170
+ "aria-describedby": r ? h : void 0,
171
+ disabled: a,
172
+ value: n,
173
+ onChange: (e) => s(e.target.value),
174
+ onFocus: l,
175
+ onBlur: m
176
+ })]
177
+ })]
178
+ }), r && /* @__PURE__ */ E(f, {
179
+ id: h,
180
+ className: "ttw:text-right",
181
+ children: r
182
+ })]
183
+ });
184
+ }
185
+ function B({ open: r, onRequestClose: g, mode: _ = "create", values: v, errors: y, unitOptions: b, currencySymbol: O, lineItemControls: A, autoFocusLineItemId: M, lineItemsLoading: N, inProgress: L, customerSection: B, renderProductSelector: V, onChange: H, onLineItemChange: U, onLineItemCommit: W, onLineItemQuantityStep: G, onTaxRateCommit: K, onDiscountFocus: q, onDiscountCommit: J, totals: Y, onManageUnits: X, onAddLineItem: ie, onRemoveLineItem: ae, showDueDateField: oe, billingSection: se, bankAccountSection: ce, attachmentsSection: le, preview: ue, closeDisabled: de, cancelDisabled: fe, draftButtonLabel: Z, draftDisabled: pe, draftLoading: me, primaryButtonLabel: he, primaryDisabled: ge, primaryLoading: _e, scrollContainerRef: ve, onSubmit: ye, onDraftClick: be, onPrimaryClick: xe, labels: Se }) {
186
+ let Q = {
187
+ ...ee,
188
+ ...Se
189
+ }, $ = ne();
190
+ return /* @__PURE__ */ E(i, {
191
+ open: r,
192
+ onOpenChange: (e) => {
193
+ e || g();
194
+ },
195
+ modal: !1,
196
+ children: /* @__PURE__ */ D(a, {
197
+ fullScreen: !0,
198
+ className: "ttw:flex ttw:flex-col ttw:gap-0 ttw:overflow-hidden ttw:p-0",
199
+ onInteractOutside: (e) => e.preventDefault(),
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-3xl ttw:tracking-normal",
206
+ children: _ === "edit" ? Q.editTitle : 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: de,
217
+ onClick: g,
218
+ children: /* @__PURE__ */ E(j, { 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: ve,
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(), ye();
231
+ },
232
+ children: [/* @__PURE__ */ E("button", {
233
+ type: "submit",
234
+ className: "ttw:sr-only",
235
+ tabIndex: -1,
236
+ "aria-hidden": "true"
237
+ }), /* @__PURE__ */ D("div", {
238
+ className: "ttw:flex ttw:flex-col ttw:gap-8",
239
+ children: [
240
+ B,
241
+ oe && /* @__PURE__ */ E("div", {
242
+ className: "ttw:grid ttw:grid-cols-2 ttw:gap-4",
243
+ children: /* @__PURE__ */ D("div", {
244
+ className: "ttw:flex ttw:flex-col ttw:gap-1.5",
245
+ children: [
246
+ /* @__PURE__ */ E(h, {
247
+ htmlFor: `${$}-due-date`,
248
+ children: Q.dueDateLabel
249
+ }),
250
+ /* @__PURE__ */ E(m, {
251
+ id: `${$}-due-date`,
252
+ type: "date",
253
+ value: v.dueDate,
254
+ onChange: (e) => H({ dueDate: e.target.value })
255
+ }),
256
+ /* @__PURE__ */ E(R, { message: y?.dueDate })
257
+ ]
258
+ })
259
+ }),
260
+ se,
261
+ /* @__PURE__ */ D("div", {
262
+ className: "ttw:flex ttw:flex-col ttw:gap-2.5 ttw:rounded-xl ttw:border ttw:border-border ttw:p-6",
263
+ children: [
264
+ /* @__PURE__ */ D("div", {
265
+ className: "ttw:flex ttw:flex-col ttw:gap-2.5 ttw:pb-4",
266
+ children: [/* @__PURE__ */ E(C, {
267
+ variant: "h4",
268
+ children: Q.lineItemsHeading
269
+ }), /* @__PURE__ */ E(C, {
270
+ variant: "body2",
271
+ color: "muted",
272
+ className: "ttw:font-medium",
273
+ children: Q.lineItemsDescription
274
+ })]
275
+ }),
276
+ y?.lineItemsSummary?.length ? /* @__PURE__ */ E(e, {
277
+ variant: "destructive",
278
+ className: "ttw:mb-2",
279
+ children: /* @__PURE__ */ E(t, { children: /* @__PURE__ */ E("ul", { children: y.lineItemsSummary.map((e) => /* @__PURE__ */ E("li", { children: e }, e)) }) })
280
+ }) : null,
281
+ /* @__PURE__ */ D("ul", {
282
+ className: "ttw:flex ttw:flex-col ttw:gap-2.5",
283
+ children: [/* @__PURE__ */ D("li", {
284
+ "aria-hidden": !0,
285
+ className: "ttw:flex ttw:h-5 ttw:items-center ttw:gap-2.5 ttw:text-sm ttw:leading-5 ttw:font-medium",
286
+ children: [
287
+ /* @__PURE__ */ E("span", {
288
+ className: "ttw:inline-flex ttw:min-w-30 ttw:flex-1 ttw:whitespace-nowrap",
289
+ children: Q.productLabel
290
+ }),
291
+ /* @__PURE__ */ E("span", {
292
+ className: "ttw:w-24 ttw:min-w-24",
293
+ children: Q.quantityLabel
294
+ }),
295
+ /* @__PURE__ */ E("span", {
296
+ className: "ttw:w-20.5 ttw:min-w-20.5",
297
+ children: Q.unitLabel
298
+ }),
299
+ /* @__PURE__ */ E("span", {
300
+ className: "ttw:w-full ttw:max-w-41 ttw:min-w-29",
301
+ children: Q.priceLabel
302
+ }),
303
+ /* @__PURE__ */ E("span", {
304
+ className: "ttw:w-12 ttw:min-w-12",
305
+ children: Q.taxableLabel
306
+ }),
307
+ v.lineItems.length > 1 && /* @__PURE__ */ E("span", { className: "ttw:w-10 ttw:min-w-10" })
308
+ ]
309
+ }), N ? /* @__PURE__ */ E("li", {
310
+ className: "ttw:flex ttw:h-9 ttw:items-center ttw:justify-center",
311
+ children: /* @__PURE__ */ E(S, { className: "ttw:size-5" })
312
+ }) : v.lineItems.map((e) => /* @__PURE__ */ E(re, {
313
+ formId: $,
314
+ lineItem: e,
315
+ errors: y?.lineItems?.[e.id],
316
+ controls: A?.[e.id],
317
+ focusOnMount: e.id === M,
318
+ canRemove: v.lineItems.length > 1,
319
+ unitOptions: b,
320
+ currencySymbol: O,
321
+ labels: Q,
322
+ renderProductSelector: V,
323
+ onChange: (t) => U(e.id, t),
324
+ onCommit: (t) => W(e.id, t),
325
+ onQuantityStep: (t) => G(e.id, t),
326
+ onManageUnits: X,
327
+ onRemove: () => ae(e.id)
328
+ }, e.id))]
329
+ }),
330
+ /* @__PURE__ */ D(n, {
331
+ type: "button",
332
+ variant: "ghost",
333
+ className: "ttw:w-fit ttw:text-primary ttw:hover:text-primary",
334
+ onClick: ie,
335
+ children: [/* @__PURE__ */ E(k, { className: "ttw:size-5 ttw:text-primary" }), Q.addLineItemButton]
336
+ }),
337
+ /* @__PURE__ */ E(z, {
338
+ inputId: `${$}-discount`,
339
+ discountType: v.discountType,
340
+ value: v.discount,
341
+ error: y?.discount,
342
+ currencySymbol: O,
343
+ disabled: L,
344
+ labels: Q,
345
+ onChange: (e) => H({ discount: e }),
346
+ onTypeChange: (e) => H({ discountType: e }),
347
+ onFocus: q,
348
+ onBlur: J
349
+ }),
350
+ /* @__PURE__ */ D(u, {
351
+ className: "ttw:flex-col",
352
+ children: [/* @__PURE__ */ D(d, {
353
+ className: "ttw:flex-row ttw:justify-end",
354
+ children: [/* @__PURE__ */ E(p, {
355
+ htmlFor: `${$}-tax-rate`,
356
+ className: w(y?.taxRate && "ttw:text-destructive"),
357
+ children: Q.taxRateLabel
358
+ }), /* @__PURE__ */ D("div", {
359
+ className: w(P, "ttw:w-40"),
360
+ children: [/* @__PURE__ */ E("input", {
361
+ id: `${$}-tax-rate`,
362
+ className: w(F, "ttw:pl-3"),
363
+ placeholder: Q.taxRatePlaceholder,
364
+ type: "text",
365
+ inputMode: "decimal",
366
+ "aria-invalid": !!y?.taxRate || void 0,
367
+ "aria-describedby": y?.taxRate ? `${$}-tax-rate-error` : void 0,
368
+ value: v.taxRate,
369
+ onChange: (e) => H({ taxRate: e.target.value }),
370
+ onBlur: K
371
+ }), /* @__PURE__ */ E("span", {
372
+ className: w(I, "ttw:pr-3"),
373
+ children: Q.taxRateSuffix
374
+ })]
375
+ })]
376
+ }), y?.taxRate && /* @__PURE__ */ E(f, {
377
+ id: `${$}-tax-rate-error`,
378
+ className: "ttw:text-right",
379
+ children: y.taxRate
380
+ })]
381
+ }),
382
+ /* @__PURE__ */ E(x, {}),
383
+ /* @__PURE__ */ E(te, {
384
+ totals: Y,
385
+ labels: Q
386
+ })
387
+ ]
388
+ }),
389
+ ce,
390
+ /* @__PURE__ */ E(T, {
391
+ idPrefix: $,
392
+ openingNote: v.openingNote,
393
+ closingNote: v.closingNote,
394
+ openingNoteError: y?.openingNote,
395
+ closingNoteError: y?.closingNote,
396
+ disabled: L,
397
+ onOpeningNoteChange: (e) => H({ openingNote: e }),
398
+ onClosingNoteChange: (e) => H({ closingNote: e }),
399
+ labels: Q
400
+ }),
401
+ le
402
+ ]
403
+ })]
404
+ }), /* @__PURE__ */ D(s, {
405
+ 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",
406
+ children: [
407
+ /* @__PURE__ */ E(n, {
408
+ type: "button",
409
+ variant: "outline",
410
+ className: "ttw:border-border",
411
+ disabled: fe,
412
+ onClick: g,
413
+ children: Q.cancelButton
414
+ }),
415
+ Z && /* @__PURE__ */ E(n, {
416
+ type: "submit",
417
+ form: $,
418
+ variant: "secondary",
419
+ loading: me,
420
+ disabled: pe,
421
+ onClick: be,
422
+ children: Z
423
+ }),
424
+ /* @__PURE__ */ E(n, {
425
+ type: "submit",
426
+ form: $,
427
+ loading: _e,
428
+ disabled: ge,
429
+ onClick: xe,
430
+ children: he
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-linear-to-b ttw:from-[#F6F6F6] ttw:to-[#E4E4FF]",
436
+ children: ue
437
+ })]
438
+ })]
439
+ })
440
+ });
6
441
  }
7
442
  //#endregion
8
- export { r as PreviewLines };
443
+ export { B as ReceivableFormDialog, B as default };
@@ -0,0 +1,224 @@
1
+ import { Alert as e, AlertDescription as t, Button as n, DatePicker as r, Dialog as i, DialogContent as a, DialogFooter as o, DialogHeader as s, DialogTitle as c, FieldRequirement as l, InputGroup as u, InputGroupAddon as d, InputGroupInput as f, Label as p, Skeleton as m } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
2
+ import { RECEIVABLE_PAYMENT_DIALOG_LABELS_EN as h } from "./index14.js";
3
+ import { Fragment as g, jsx as _, jsxs as v } from "react/jsx-runtime";
4
+ import { NotebookPen as y } from "lucide-react";
5
+ //#region ../../libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index45.js
6
+ var b = {
7
+ amount: "receivable-payment-amount",
8
+ date: "receivable-payment-date",
9
+ time: "receivable-payment-time"
10
+ };
11
+ function x({ id: e, message: t }) {
12
+ return t ? /* @__PURE__ */ _("p", {
13
+ id: e,
14
+ className: "ttw:text-sm ttw:text-destructive",
15
+ children: t
16
+ }) : null;
17
+ }
18
+ function S({ label: e, children: t }) {
19
+ return /* @__PURE__ */ v("div", {
20
+ className: "ttw:flex ttw:items-center ttw:justify-between ttw:gap-4 ttw:px-4 ttw:py-3",
21
+ children: [/* @__PURE__ */ _("dt", {
22
+ className: "ttw:text-sm ttw:text-muted-foreground",
23
+ children: e
24
+ }), /* @__PURE__ */ _("dd", {
25
+ className: "ttw:text-sm ttw:font-medium ttw:text-right ttw:break-all",
26
+ children: t
27
+ })]
28
+ });
29
+ }
30
+ function C({ open: C, onOpenChange: w, step: T, values: E, errors: D, currencySymbol: O, amountDueLabel: k, review: A, inProgress: j, onChange: M, onFillAmountDue: N, onSave: P, onEdit: F, onConfirm: I, onCancel: L, labels: R }) {
31
+ let z = {
32
+ ...h,
33
+ ...R
34
+ };
35
+ return /* @__PURE__ */ _(i, {
36
+ open: C,
37
+ onOpenChange: w,
38
+ children: /* @__PURE__ */ _(a, {
39
+ "aria-describedby": void 0,
40
+ className: "ttw:flex ttw:flex-col ttw:gap-6",
41
+ children: T === "review" && A ? /* @__PURE__ */ v(g, { children: [
42
+ /* @__PURE__ */ v(s, {
43
+ className: "ttw:items-center ttw:text-center",
44
+ children: [
45
+ /* @__PURE__ */ _("div", {
46
+ className: "ttw:flex ttw:size-11 ttw:items-center ttw:justify-center ttw:rounded-full ttw:bg-muted",
47
+ children: /* @__PURE__ */ _(y, { className: "ttw:size-5 ttw:text-muted-foreground" })
48
+ }),
49
+ /* @__PURE__ */ _(c, {
50
+ className: "ttw:text-base ttw:font-normal",
51
+ children: z.reviewTitle
52
+ }),
53
+ /* @__PURE__ */ _("p", {
54
+ className: "ttw:text-2xl ttw:font-semibold",
55
+ children: A.amountLabel
56
+ }),
57
+ /* @__PURE__ */ _("p", {
58
+ className: "ttw:text-sm",
59
+ children: A.fromLabel
60
+ })
61
+ ]
62
+ }),
63
+ /* @__PURE__ */ v("dl", {
64
+ className: "ttw:divide-y ttw:divide-border ttw:rounded-lg ttw:border ttw:border-border",
65
+ children: [
66
+ /* @__PURE__ */ _(S, {
67
+ label: z.receivedLabel,
68
+ children: A.receivedLabel
69
+ }),
70
+ /* @__PURE__ */ _(S, {
71
+ label: z.referenceLabel,
72
+ children: A.referenceLabel
73
+ }),
74
+ /* @__PURE__ */ _(S, {
75
+ label: z.createdByLabel,
76
+ children: A.isCreatedByLoading ? /* @__PURE__ */ _(m, { className: "ttw:h-4 ttw:w-24" }) : A.createdByLabel
77
+ })
78
+ ]
79
+ }),
80
+ /* @__PURE__ */ _(e, {
81
+ className: "ttw:border-amber-200 ttw:bg-amber-50 ttw:text-amber-800",
82
+ children: /* @__PURE__ */ _(t, {
83
+ className: "ttw:text-amber-800",
84
+ children: z.reviewWarning
85
+ })
86
+ }),
87
+ /* @__PURE__ */ v(o, {
88
+ className: "ttw:sm:justify-between",
89
+ children: [/* @__PURE__ */ _(n, {
90
+ variant: "ghost",
91
+ onClick: L,
92
+ children: z.cancelButton
93
+ }), /* @__PURE__ */ v("div", {
94
+ className: "ttw:flex ttw:gap-2",
95
+ children: [/* @__PURE__ */ _(n, {
96
+ variant: "outline",
97
+ disabled: j,
98
+ onClick: F,
99
+ children: z.editRecordButton
100
+ }), /* @__PURE__ */ _(n, {
101
+ disabled: j,
102
+ onClick: I,
103
+ children: z.confirmButton
104
+ })]
105
+ })]
106
+ })
107
+ ] }) : /* @__PURE__ */ v("form", {
108
+ className: "ttw:flex ttw:flex-col ttw:gap-6",
109
+ noValidate: !0,
110
+ onSubmit: (e) => {
111
+ e.preventDefault(), P();
112
+ },
113
+ children: [
114
+ /* @__PURE__ */ _(s, { children: /* @__PURE__ */ _(c, { children: z.title }) }),
115
+ /* @__PURE__ */ v("div", {
116
+ className: "ttw:flex ttw:flex-col ttw:gap-1.5",
117
+ children: [
118
+ /* @__PURE__ */ _(p, {
119
+ htmlFor: b.amount,
120
+ requirement: l.Required,
121
+ children: z.amountLabel
122
+ }),
123
+ /* @__PURE__ */ v(u, { children: [/* @__PURE__ */ _(f, {
124
+ id: b.amount,
125
+ type: "number",
126
+ required: !0,
127
+ placeholder: z.amountPlaceholder,
128
+ "data-has-end-addon": !0,
129
+ "aria-invalid": !!D?.amount || void 0,
130
+ "aria-describedby": D?.amount ? `${b.amount}-error` : void 0,
131
+ value: E.amount,
132
+ onChange: (e) => M({ amount: e.target.value })
133
+ }), /* @__PURE__ */ _(d, {
134
+ align: "inline-end",
135
+ children: O
136
+ })] }),
137
+ /* @__PURE__ */ _(x, {
138
+ id: `${b.amount}-error`,
139
+ message: D?.amount
140
+ }),
141
+ /* @__PURE__ */ v("p", {
142
+ className: "ttw:text-sm ttw:text-muted-foreground",
143
+ children: [
144
+ z.fullAmountDuePrefix,
145
+ " ",
146
+ /* @__PURE__ */ _(n, {
147
+ type: "button",
148
+ variant: "link",
149
+ className: "ttw:h-auto ttw:p-0 ttw:underline",
150
+ onClick: N,
151
+ children: k
152
+ })
153
+ ]
154
+ })
155
+ ]
156
+ }),
157
+ /* @__PURE__ */ v("div", {
158
+ className: "ttw:grid ttw:grid-cols-2 ttw:gap-4",
159
+ children: [/* @__PURE__ */ v("div", {
160
+ className: "ttw:flex ttw:flex-col ttw:gap-1.5",
161
+ children: [
162
+ /* @__PURE__ */ _(p, {
163
+ htmlFor: b.date,
164
+ requirement: l.Required,
165
+ children: z.dateLabel
166
+ }),
167
+ /* @__PURE__ */ _(r, {
168
+ id: b.date,
169
+ value: E.paymentDate,
170
+ onChange: (e) => M({ paymentDate: e }),
171
+ placeholder: z.datePlaceholder,
172
+ "aria-invalid": !!D?.paymentDate || void 0,
173
+ "aria-describedby": D?.paymentDate ? `${b.date}-error` : void 0
174
+ }),
175
+ /* @__PURE__ */ _(x, {
176
+ id: `${b.date}-error`,
177
+ message: D?.paymentDate
178
+ })
179
+ ]
180
+ }), /* @__PURE__ */ v("div", {
181
+ className: "ttw:flex ttw:flex-col ttw:gap-1.5",
182
+ children: [
183
+ /* @__PURE__ */ _(p, {
184
+ htmlFor: b.time,
185
+ requirement: l.Required,
186
+ children: z.timeLabel
187
+ }),
188
+ /* @__PURE__ */ v(u, { children: [/* @__PURE__ */ _(f, {
189
+ id: b.time,
190
+ type: "time",
191
+ required: !0,
192
+ "data-has-end-addon": !0,
193
+ "aria-invalid": !!D?.paymentTime || void 0,
194
+ "aria-describedby": D?.paymentTime ? `${b.time}-error` : void 0,
195
+ value: E.paymentTime,
196
+ onChange: (e) => M({ paymentTime: e.target.value })
197
+ }), /* @__PURE__ */ _(d, {
198
+ align: "inline-end",
199
+ children: z.timeZoneSuffix
200
+ })] }),
201
+ /* @__PURE__ */ _(x, {
202
+ id: `${b.time}-error`,
203
+ message: D?.paymentTime
204
+ })
205
+ ]
206
+ })]
207
+ }),
208
+ /* @__PURE__ */ v(o, { children: [/* @__PURE__ */ _(n, {
209
+ type: "button",
210
+ variant: "ghost",
211
+ onClick: L,
212
+ children: z.cancelButton
213
+ }), /* @__PURE__ */ _(n, {
214
+ type: "submit",
215
+ loading: j,
216
+ children: z.saveButton
217
+ })] })
218
+ ]
219
+ })
220
+ })
221
+ });
222
+ }
223
+ //#endregion
224
+ export { C as ReceivablePaymentDialog, C as default };