@tesouro/embedded-components-react 0.5.278 → 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 (107) 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/linked-accounts-widget/feature/dist/lib/useLinkedAccountsWidget.js +1 -1
  97. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index503.js +1 -1
  98. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/index.js +9 -9
  99. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/CounterpartSelector.js +2 -23
  100. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/useCounterpartSelector.js +2 -51
  101. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index.js +8 -8
  102. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index15.js +4 -80
  103. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index2.js +10 -22
  104. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  105. package/dist/libs/tesouro-embedded-components-react/shared/util/dist/lib/widgetDomEvents.js +1 -1
  106. package/package.json +1 -1
  107. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index48.js +0 -100
@@ -1,487 +1,2 @@
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 T } from "./index13.js";
3
- import { ReceivableFormTotals as ee } from "./index39.js";
4
- import { ReceivableNotesSection as E } from "./index40.js";
5
- import { useId as te } from "react";
6
- import { Fragment as ne, jsx as D, jsxs as O } from "react/jsx-runtime";
7
- import { MinusIcon as k, PlusIcon as A, Trash2Icon as j, XIcon as re } from "lucide-react";
8
- //#region ../../libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index41.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-[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__ */ D("p", {
12
- className: "ttw:text-sm ttw:text-destructive",
13
- children: e
14
- }) : null;
15
- }
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__ */ O("li", {
19
- className: "ttw:flex ttw:h-9 ttw:items-center ttw:gap-2.5",
20
- children: [
21
- /* @__PURE__ */ D("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__ */ O("div", {
30
- className: w(P, "ttw:w-26 ttw:min-w-26 ttw:px-[0.3rem]"),
31
- children: [
32
- /* @__PURE__ */ D("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__ */ D(k, { className: "ttw:size-3.5" })
39
- }),
40
- /* @__PURE__ */ D("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__ */ D("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__ */ D(A, { className: "ttw:size-3.5" })
58
- })
59
- ]
60
- }),
61
- /* @__PURE__ */ O(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__ */ D(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__ */ D(b, {
76
- className: "ttw:truncate",
77
- placeholder: u.unitPlaceholder
78
- })
79
- }), /* @__PURE__ */ O(_, { children: [
80
- h && /* @__PURE__ */ O(v, {
81
- value: N,
82
- className: "ttw:font-semibold ttw:text-primary ttw:hover:text-primary ttw:focus:text-primary",
83
- children: [/* @__PURE__ */ D(A, { className: "ttw:text-primary" }), u.manageUnitsOption]
84
- }),
85
- /* @__PURE__ */ D(v, {
86
- value: M,
87
- children: u.unitNone
88
- }),
89
- c.map((e) => /* @__PURE__ */ D(v, {
90
- value: e.value,
91
- children: e.label
92
- }, e.value))
93
- ] })]
94
- }),
95
- /* @__PURE__ */ O("div", {
96
- className: w(P, "ttw:w-full ttw:max-w-41 ttw:min-w-29"),
97
- children: [/* @__PURE__ */ D("span", {
98
- className: w(I, "ttw:pl-3"),
99
- children: l
100
- }), /* @__PURE__ */ D("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__ */ D("div", {
113
- className: "ttw:flex ttw:w-12 ttw:min-w-12 ttw:items-center ttw:justify-center",
114
- children: /* @__PURE__ */ D(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__ */ D(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__ */ D(j, {})
129
- })
130
- ]
131
- });
132
- }
133
- function ae({ 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__ */ O(u, {
144
- className: "ttw:flex-col",
145
- children: [/* @__PURE__ */ O(d, {
146
- className: "ttw:flex-row ttw:items-center ttw:justify-end",
147
- children: [/* @__PURE__ */ D(p, {
148
- htmlFor: e,
149
- className: w(r && "ttw:text-destructive"),
150
- children: o.discountLabel
151
- }), /* @__PURE__ */ O("div", {
152
- className: w(P, "ttw:w-40 ttw:overflow-hidden"),
153
- children: [/* @__PURE__ */ D("div", {
154
- className: w(I, "ttw:items-stretch ttw:self-stretch"),
155
- children: g.map((e) => /* @__PURE__ */ D("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__ */ D("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__ */ D(f, {
179
- id: h,
180
- className: "ttw:text-right",
181
- children: r
182
- })]
183
- });
184
- }
185
- function z({ open: r, onRequestClose: g, mode: _ = "create", values: v, errors: y, unitOptions: b, currencySymbol: k, lineItemControls: j, autoFocusLineItemId: M, lineItemsLoading: N, inProgress: L, customerSelector: 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, onAddCustomerDetailsClick: Y, billingSection: ue, bankAccountSection: de, attachmentsSection: fe, preview: pe, closeDisabled: me, cancelDisabled: he, draftButtonLabel: X, draftDisabled: ge, draftLoading: _e, primaryButtonLabel: ve, primaryDisabled: ye, primaryLoading: be, scrollContainerRef: Z, onSubmit: xe, onDraftClick: Se, onPrimaryClick: Ce, labels: we }) {
186
- let Q = {
187
- ...T,
188
- ...we
189
- }, $ = te();
190
- return /* @__PURE__ */ D(i, {
191
- open: r,
192
- onOpenChange: (e) => {
193
- e || g();
194
- },
195
- modal: !1,
196
- children: /* @__PURE__ */ O(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__ */ O(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__ */ O("div", {
203
- className: "ttw:flex ttw:flex-col ttw:gap-1.5",
204
- children: [/* @__PURE__ */ D(l, {
205
- className: "ttw:text-3xl ttw:tracking-normal",
206
- children: _ === "edit" ? Q.editTitle : Q.createTitle
207
- }), /* @__PURE__ */ D(o, {
208
- className: w(_ === "edit" && "ttw:sr-only"),
209
- children: _ === "edit" ? Q.editDescription : Q.createDescription
210
- })]
211
- }), /* @__PURE__ */ D(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__ */ D(re, { className: "ttw:size-6.5" })
219
- })]
220
- }), /* @__PURE__ */ O("div", {
221
- className: "ttw:flex ttw:min-h-0 ttw:flex-1",
222
- children: [/* @__PURE__ */ O("div", {
223
- ref: Z,
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__ */ O("form", {
226
- id: $,
227
- noValidate: !0,
228
- className: "ttw:pb-10",
229
- onSubmit: (e) => {
230
- e.preventDefault(), e.stopPropagation(), xe();
231
- },
232
- children: [/* @__PURE__ */ D("button", {
233
- type: "submit",
234
- className: "ttw:sr-only",
235
- tabIndex: -1,
236
- "aria-hidden": "true"
237
- }), /* @__PURE__ */ O("div", {
238
- className: "ttw:flex ttw:flex-col ttw:gap-8",
239
- children: [
240
- /* @__PURE__ */ O("div", {
241
- className: "ttw:flex ttw:flex-col ttw:gap-2.5 ttw:rounded-xl ttw:border ttw:border-border ttw:p-6",
242
- children: [
243
- /* @__PURE__ */ O("div", {
244
- className: "ttw:flex ttw:flex-col ttw:gap-2.5 ttw:pb-4",
245
- children: [/* @__PURE__ */ D(C, {
246
- variant: "h4",
247
- children: Q.customerHeading
248
- }), /* @__PURE__ */ D(C, {
249
- variant: "body2",
250
- color: "muted",
251
- className: "ttw:font-medium",
252
- children: Q.customerDescription
253
- })]
254
- }),
255
- z,
256
- /* @__PURE__ */ D(R, { message: y?.customerId }),
257
- !v.customerId && /* @__PURE__ */ O(ne, { children: [/* @__PURE__ */ D(u, { children: /* @__PURE__ */ O(d, { children: [
258
- /* @__PURE__ */ D(p, {
259
- htmlFor: `${$}-customer-email`,
260
- children: Q.customerEmailLabel
261
- }),
262
- /* @__PURE__ */ D(m, {
263
- id: `${$}-customer-email`,
264
- type: "email",
265
- disabled: L,
266
- "aria-invalid": !!y?.customerEmail || void 0,
267
- "aria-describedby": y?.customerEmail ? `${$}-customer-email-error` : void 0,
268
- value: v.customerEmail,
269
- onChange: (e) => V({ customerEmail: e.target.value })
270
- }),
271
- y?.customerEmail && /* @__PURE__ */ D(f, {
272
- id: `${$}-customer-email-error`,
273
- children: y.customerEmail
274
- })
275
- ] }) }), Y && /* @__PURE__ */ O(n, {
276
- type: "button",
277
- variant: "ghost",
278
- disabled: L,
279
- className: "ttw:w-fit ttw:text-primary ttw:hover:text-primary",
280
- onClick: Y,
281
- children: [/* @__PURE__ */ D(A, {}), Q.addCustomerDetailsButton]
282
- })] })
283
- ]
284
- }),
285
- le && /* @__PURE__ */ D("div", {
286
- className: "ttw:grid ttw:grid-cols-2 ttw:gap-4",
287
- children: /* @__PURE__ */ O("div", {
288
- className: "ttw:flex ttw:flex-col ttw:gap-1.5",
289
- children: [
290
- /* @__PURE__ */ D(h, {
291
- htmlFor: `${$}-due-date`,
292
- children: Q.dueDateLabel
293
- }),
294
- /* @__PURE__ */ D(m, {
295
- id: `${$}-due-date`,
296
- type: "date",
297
- value: v.dueDate,
298
- onChange: (e) => V({ dueDate: e.target.value })
299
- }),
300
- /* @__PURE__ */ D(R, { message: y?.dueDate })
301
- ]
302
- })
303
- }),
304
- ue,
305
- /* @__PURE__ */ O("div", {
306
- className: "ttw:flex ttw:flex-col ttw:gap-2.5 ttw:rounded-xl ttw:border ttw:border-border ttw:p-6",
307
- children: [
308
- /* @__PURE__ */ O("div", {
309
- className: "ttw:flex ttw:flex-col ttw:gap-2.5 ttw:pb-4",
310
- children: [/* @__PURE__ */ D(C, {
311
- variant: "h4",
312
- children: Q.lineItemsHeading
313
- }), /* @__PURE__ */ D(C, {
314
- variant: "body2",
315
- color: "muted",
316
- className: "ttw:font-medium",
317
- children: Q.lineItemsDescription
318
- })]
319
- }),
320
- y?.lineItemsSummary?.length ? /* @__PURE__ */ D(e, {
321
- variant: "destructive",
322
- className: "ttw:mb-2",
323
- children: /* @__PURE__ */ D(t, { children: /* @__PURE__ */ D("ul", { children: y.lineItemsSummary.map((e) => /* @__PURE__ */ D("li", { children: e }, e)) }) })
324
- }) : null,
325
- /* @__PURE__ */ O("ul", {
326
- className: "ttw:flex ttw:flex-col ttw:gap-2.5",
327
- children: [/* @__PURE__ */ O("li", {
328
- "aria-hidden": !0,
329
- className: "ttw:flex ttw:h-5 ttw:items-center ttw:gap-2.5 ttw:text-sm ttw:leading-5 ttw:font-medium",
330
- children: [
331
- /* @__PURE__ */ D("span", {
332
- className: "ttw:inline-flex ttw:min-w-30 ttw:flex-1 ttw:whitespace-nowrap",
333
- children: Q.productLabel
334
- }),
335
- /* @__PURE__ */ D("span", {
336
- className: "ttw:w-24 ttw:min-w-24",
337
- children: Q.quantityLabel
338
- }),
339
- /* @__PURE__ */ D("span", {
340
- className: "ttw:w-20.5 ttw:min-w-20.5",
341
- children: Q.unitLabel
342
- }),
343
- /* @__PURE__ */ D("span", {
344
- className: "ttw:w-full ttw:max-w-41 ttw:min-w-29",
345
- children: Q.priceLabel
346
- }),
347
- /* @__PURE__ */ D("span", {
348
- className: "ttw:w-12 ttw:min-w-12",
349
- children: Q.taxableLabel
350
- }),
351
- v.lineItems.length > 1 && /* @__PURE__ */ D("span", { className: "ttw:w-10 ttw:min-w-10" })
352
- ]
353
- }), N ? /* @__PURE__ */ D("li", {
354
- className: "ttw:flex ttw:h-9 ttw:items-center ttw:justify-center",
355
- children: /* @__PURE__ */ D(S, { className: "ttw:size-5" })
356
- }) : v.lineItems.map((e) => /* @__PURE__ */ D(ie, {
357
- formId: $,
358
- lineItem: e,
359
- errors: y?.lineItems?.[e.id],
360
- controls: j?.[e.id],
361
- focusOnMount: e.id === M,
362
- canRemove: v.lineItems.length > 1,
363
- unitOptions: b,
364
- currencySymbol: k,
365
- labels: Q,
366
- renderProductSelector: B,
367
- onChange: (t) => H(e.id, t),
368
- onCommit: (t) => U(e.id, t),
369
- onQuantityStep: (t) => W(e.id, t),
370
- onManageUnits: oe,
371
- onRemove: () => ce(e.id)
372
- }, e.id))]
373
- }),
374
- /* @__PURE__ */ O(n, {
375
- type: "button",
376
- variant: "ghost",
377
- className: "ttw:w-fit ttw:text-primary ttw:hover:text-primary",
378
- onClick: se,
379
- children: [/* @__PURE__ */ D(A, { className: "ttw:size-5 ttw:text-primary" }), Q.addLineItemButton]
380
- }),
381
- /* @__PURE__ */ D(ae, {
382
- inputId: `${$}-discount`,
383
- discountType: v.discountType,
384
- value: v.discount,
385
- error: y?.discount,
386
- currencySymbol: k,
387
- disabled: L,
388
- labels: Q,
389
- onChange: (e) => V({ discount: e }),
390
- onTypeChange: (e) => V({ discountType: e }),
391
- onFocus: K,
392
- onBlur: q
393
- }),
394
- /* @__PURE__ */ O(u, {
395
- className: "ttw:flex-col",
396
- children: [/* @__PURE__ */ O(d, {
397
- className: "ttw:flex-row ttw:justify-end",
398
- children: [/* @__PURE__ */ D(p, {
399
- htmlFor: `${$}-tax-rate`,
400
- className: w(y?.taxRate && "ttw:text-destructive"),
401
- children: Q.taxRateLabel
402
- }), /* @__PURE__ */ O("div", {
403
- className: w(P, "ttw:w-40"),
404
- children: [/* @__PURE__ */ D("input", {
405
- id: `${$}-tax-rate`,
406
- className: w(F, "ttw:pl-3"),
407
- placeholder: Q.taxRatePlaceholder,
408
- type: "text",
409
- inputMode: "decimal",
410
- "aria-invalid": !!y?.taxRate || void 0,
411
- "aria-describedby": y?.taxRate ? `${$}-tax-rate-error` : void 0,
412
- value: v.taxRate,
413
- onChange: (e) => V({ taxRate: e.target.value }),
414
- onBlur: G
415
- }), /* @__PURE__ */ D("span", {
416
- className: w(I, "ttw:pr-3"),
417
- children: Q.taxRateSuffix
418
- })]
419
- })]
420
- }), y?.taxRate && /* @__PURE__ */ D(f, {
421
- id: `${$}-tax-rate-error`,
422
- className: "ttw:text-right",
423
- children: y.taxRate
424
- })]
425
- }),
426
- /* @__PURE__ */ D(x, {}),
427
- /* @__PURE__ */ D(ee, {
428
- totals: J,
429
- labels: Q
430
- })
431
- ]
432
- }),
433
- de,
434
- /* @__PURE__ */ D(E, {
435
- idPrefix: $,
436
- openingNote: v.openingNote,
437
- closingNote: v.closingNote,
438
- openingNoteError: y?.openingNote,
439
- closingNoteError: y?.closingNote,
440
- disabled: L,
441
- onOpeningNoteChange: (e) => V({ openingNote: e }),
442
- onClosingNoteChange: (e) => V({ closingNote: e }),
443
- labels: Q
444
- }),
445
- fe
446
- ]
447
- })]
448
- }), /* @__PURE__ */ O(s, {
449
- 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",
450
- children: [
451
- /* @__PURE__ */ D(n, {
452
- type: "button",
453
- variant: "outline",
454
- className: "ttw:border-border",
455
- disabled: he,
456
- onClick: g,
457
- children: Q.cancelButton
458
- }),
459
- X && /* @__PURE__ */ D(n, {
460
- type: "submit",
461
- form: $,
462
- variant: "secondary",
463
- loading: _e,
464
- disabled: ge,
465
- onClick: Se,
466
- children: X
467
- }),
468
- /* @__PURE__ */ D(n, {
469
- type: "submit",
470
- form: $,
471
- loading: be,
472
- disabled: ye,
473
- onClick: Ce,
474
- children: ve
475
- })
476
- ]
477
- })]
478
- }), /* @__PURE__ */ D("div", {
479
- 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]",
480
- children: pe
481
- })]
482
- })]
483
- })
484
- });
485
- }
486
- //#endregion
487
- export { z as ReceivableFormDialog, z as default };
1
+ import "./index28.js";
2
+ import "./index40.js";