@tesouro/embedded-components-react 0.7.45 → 0.7.47

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