@tesouro/embedded-components-react 0.11.206 → 0.11.209

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