@tesouro/embedded-components-react 0.7.17 → 0.7.19

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 (28) hide show
  1. package/README.md +14 -14
  2. package/dist/index.css +3 -0
  3. package/dist/index.d.ts +50 -7
  4. package/dist/lib/CounterpartsWidget.d.ts +49 -6
  5. package/dist/lib/CounterpartsWidgetPublic.d.ts +49 -6
  6. package/dist/lib/CustomersWidget.d.ts +49 -6
  7. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/data-access/dist/index3.js +2 -1
  8. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/CounterpartDetailsContainer.js +18 -13
  9. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/CounterpartsWidget.js +146 -137
  10. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/useCounterpartDetailsSheetView.js +56 -55
  11. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/useCounterpartsWidget.js +108 -77
  12. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/viewModels.js +181 -25
  13. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index.js +1 -1
  14. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index2.js +50 -7
  15. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index4.js +127 -596
  16. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index5.js +66 -0
  17. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index6.js +210 -0
  18. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index7.js +520 -0
  19. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/ReceivablesWidget.js +2 -1
  20. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useInvoicesFilter.js +10 -7
  21. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableActionsModal.js +1 -1
  22. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivablesTable.js +1 -0
  23. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivablesWidget.js +141 -125
  24. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/index.js +11 -11
  25. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index.js +7 -7
  26. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index2.js +1 -8
  27. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  28. package/package.json +1 -1
@@ -0,0 +1,66 @@
1
+ import { Button as e, LABEL_LABELS_EN as t, RequiredFieldsLegend as n, Spinner as r, Typography as i, mergeRequiredFieldsLegendLabels as a } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
2
+ import { CounterpartAddressFields as o } from "./index4.js";
3
+ import { jsx as s, jsxs as c } from "react/jsx-runtime";
4
+ //#region ../../libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index5.js
5
+ function l({ form: l, labels: u }) {
6
+ let d = {
7
+ ...t,
8
+ ...l.fieldMarkers
9
+ };
10
+ return /* @__PURE__ */ c("form", {
11
+ className: "ttw:flex ttw:flex-col ttw:gap-4 ttw:rounded-[10px] ttw:border ttw:border-border ttw:bg-muted ttw:p-4",
12
+ onSubmit: (e) => {
13
+ e.preventDefault(), l.onSubmit();
14
+ },
15
+ children: [/* @__PURE__ */ c("div", {
16
+ className: "ttw:flex ttw:flex-col ttw:gap-4",
17
+ children: [
18
+ /* @__PURE__ */ s("div", {
19
+ className: "ttw:flex ttw:items-center ttw:justify-between ttw:gap-3 ttw:border-b ttw:border-border ttw:pt-6 ttw:pb-7",
20
+ children: /* @__PURE__ */ s(i, {
21
+ variant: "body1",
22
+ className: "ttw:font-medium",
23
+ children: l.hasExistingAddress ? u.editingAddressHeading : u.addingAddressHeading
24
+ })
25
+ }),
26
+ /* @__PURE__ */ s(n, { labels: a(d, l.requiredFieldsLegend) }),
27
+ l.formError && /* @__PURE__ */ s(i, {
28
+ variant: "body2",
29
+ color: "destructive",
30
+ role: "alert",
31
+ children: l.formError
32
+ }),
33
+ /* @__PURE__ */ s(o, {
34
+ idPrefix: "counterpart-address-form",
35
+ values: l.values,
36
+ errors: l.errors,
37
+ stateOptions: l.stateOptions,
38
+ disabled: l.inProgress,
39
+ onChange: l.onChange,
40
+ fieldMarkers: {
41
+ ...d,
42
+ ...l.addressFieldMarkers
43
+ },
44
+ labels: u
45
+ })
46
+ ]
47
+ }), /* @__PURE__ */ c("div", {
48
+ className: "ttw:flex ttw:justify-end ttw:gap-4 ttw:pt-6",
49
+ children: [/* @__PURE__ */ s(e, {
50
+ type: "button",
51
+ variant: "outline",
52
+ className: "ttw:w-fit ttw:border-border",
53
+ disabled: l.inProgress,
54
+ onClick: l.onCancel,
55
+ children: u.cancelButton
56
+ }), /* @__PURE__ */ c(e, {
57
+ type: "submit",
58
+ className: "ttw:w-fit",
59
+ disabled: l.inProgress || l.submitDisabled,
60
+ children: [l.inProgress && /* @__PURE__ */ s(r, {}), u.saveButton]
61
+ })]
62
+ })]
63
+ });
64
+ }
65
+ //#endregion
66
+ export { l as CounterpartAddressForm };
@@ -0,0 +1,210 @@
1
+ import { Button as e, Checkbox as t, Field as n, FieldContent as r, FieldDescription as i, FieldError as a, FieldLabel as o, Input as s, LABEL_LABELS_EN as c, Label as l, RequiredFieldsLegend as u, Spinner as d, Typography as f, cn as p, mergeRequiredFieldsLegendLabels as m } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
2
+ import { CounterpartAddressFields as h } from "./index4.js";
3
+ import { jsx as g, jsxs as _ } from "react/jsx-runtime";
4
+ //#region ../../libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index6.js
5
+ function v(e) {
6
+ return e ? [{ message: e }] : void 0;
7
+ }
8
+ function y({ form: y, labels: b }) {
9
+ let { name: x, email: S, phone: C, taxId: w, reminders: T, address: E, inProgress: D } = y, O = {
10
+ ...b,
11
+ ...y.labels
12
+ }, k = {
13
+ ...c,
14
+ ...y.fieldMarkers
15
+ };
16
+ return /* @__PURE__ */ _("form", {
17
+ className: "ttw:flex ttw:flex-col ttw:gap-4 ttw:rounded-[10px] ttw:border ttw:border-border ttw:bg-muted ttw:p-4",
18
+ onSubmit: (e) => {
19
+ e.preventDefault(), y.onSubmit();
20
+ },
21
+ children: [/* @__PURE__ */ _("div", {
22
+ className: "ttw:flex ttw:flex-col ttw:gap-4",
23
+ children: [
24
+ /* @__PURE__ */ g("div", {
25
+ className: "ttw:flex ttw:flex-col ttw:gap-1.5 ttw:border-b ttw:border-border ttw:pt-6 ttw:pb-7",
26
+ children: /* @__PURE__ */ g(f, {
27
+ variant: "body1",
28
+ className: "ttw:font-medium",
29
+ children: y.heading
30
+ })
31
+ }),
32
+ /* @__PURE__ */ g(u, { labels: m(k, y.requiredFieldsLegend) }),
33
+ y.formError && /* @__PURE__ */ g(f, {
34
+ variant: "body2",
35
+ color: "destructive",
36
+ role: "alert",
37
+ children: y.formError
38
+ }),
39
+ x.kind === "person" ? /* @__PURE__ */ _("div", {
40
+ className: "ttw:flex ttw:gap-4",
41
+ children: [/* @__PURE__ */ g(n, { children: /* @__PURE__ */ _(r, { children: [
42
+ /* @__PURE__ */ g(o, {
43
+ htmlFor: "counterpart-edit-first-name",
44
+ requirement: "required",
45
+ labels: k,
46
+ children: O.firstNameLabel
47
+ }),
48
+ /* @__PURE__ */ g(s, {
49
+ id: "counterpart-edit-first-name",
50
+ "aria-required": !0,
51
+ className: "ttw:bg-background",
52
+ value: x.firstName.value,
53
+ disabled: D,
54
+ "aria-invalid": !!x.firstName.error || void 0,
55
+ onChange: (e) => y.onFieldChange("firstName", e.target.value)
56
+ }),
57
+ /* @__PURE__ */ g(a, { errors: v(x.firstName.error) })
58
+ ] }) }), /* @__PURE__ */ g(n, { children: /* @__PURE__ */ _(r, { children: [
59
+ /* @__PURE__ */ g(o, {
60
+ htmlFor: "counterpart-edit-last-name",
61
+ requirement: "required",
62
+ labels: k,
63
+ children: O.lastNameLabel
64
+ }),
65
+ /* @__PURE__ */ g(s, {
66
+ id: "counterpart-edit-last-name",
67
+ "aria-required": !0,
68
+ className: "ttw:bg-background",
69
+ value: x.lastName.value,
70
+ disabled: D,
71
+ "aria-invalid": !!x.lastName.error || void 0,
72
+ onChange: (e) => y.onFieldChange("lastName", e.target.value)
73
+ }),
74
+ /* @__PURE__ */ g(a, { errors: v(x.lastName.error) })
75
+ ] }) })]
76
+ }) : /* @__PURE__ */ g(n, { children: /* @__PURE__ */ _(r, { children: [
77
+ /* @__PURE__ */ g(o, {
78
+ htmlFor: "counterpart-edit-business-name",
79
+ requirement: "required",
80
+ labels: k,
81
+ children: O.businessNameLabel
82
+ }),
83
+ /* @__PURE__ */ g(s, {
84
+ id: "counterpart-edit-business-name",
85
+ "aria-required": !0,
86
+ className: "ttw:bg-background",
87
+ value: x.businessName.value,
88
+ disabled: D,
89
+ "aria-invalid": !!x.businessName.error || void 0,
90
+ onChange: (e) => y.onFieldChange("businessName", e.target.value)
91
+ }),
92
+ /* @__PURE__ */ g(a, { errors: v(x.businessName.error) })
93
+ ] }) }),
94
+ /* @__PURE__ */ _("div", {
95
+ className: p("ttw:flex ttw:gap-4", y.contactLayout === "inline" ? "ttw:flex-row" : "ttw:flex-col"),
96
+ children: [
97
+ /* @__PURE__ */ g(n, { children: /* @__PURE__ */ _(r, { children: [
98
+ /* @__PURE__ */ g(o, {
99
+ htmlFor: "counterpart-edit-email",
100
+ requirement: "required",
101
+ labels: k,
102
+ children: O.rowEmail
103
+ }),
104
+ /* @__PURE__ */ g(s, {
105
+ id: "counterpart-edit-email",
106
+ "aria-required": !0,
107
+ type: "email",
108
+ className: "ttw:bg-background",
109
+ value: S.value,
110
+ disabled: D,
111
+ "aria-invalid": !!S.error || void 0,
112
+ onChange: (e) => y.onFieldChange("email", e.target.value)
113
+ }),
114
+ /* @__PURE__ */ g(a, { errors: v(S.error) })
115
+ ] }) }),
116
+ T && /* @__PURE__ */ _(l, {
117
+ htmlFor: "counterpart-edit-reminders",
118
+ className: "ttw:flex ttw:items-start ttw:gap-3 ttw:rounded-md ttw:border ttw:border-border ttw:bg-background ttw:p-3",
119
+ children: [/* @__PURE__ */ g(t, {
120
+ id: "counterpart-edit-reminders",
121
+ checked: T.checked,
122
+ disabled: D,
123
+ onCheckedChange: (e) => y.onRemindersChange(e === !0)
124
+ }), /* @__PURE__ */ _("span", {
125
+ className: "ttw:flex ttw:flex-col ttw:gap-0.5",
126
+ children: [/* @__PURE__ */ g("span", {
127
+ className: "ttw:text-sm ttw:font-medium",
128
+ children: O.remindersCheckboxLabel
129
+ }), /* @__PURE__ */ g("span", {
130
+ className: "ttw:text-sm ttw:text-muted-foreground",
131
+ children: O.remindersCheckboxDescription
132
+ })]
133
+ })]
134
+ }),
135
+ /* @__PURE__ */ g(n, { children: /* @__PURE__ */ _(r, { children: [
136
+ /* @__PURE__ */ g(o, {
137
+ htmlFor: "counterpart-edit-phone",
138
+ requirement: "optional",
139
+ labels: k,
140
+ children: O.rowPhone
141
+ }),
142
+ /* @__PURE__ */ g(s, {
143
+ id: "counterpart-edit-phone",
144
+ type: "tel",
145
+ className: "ttw:bg-background",
146
+ value: C.value,
147
+ disabled: D,
148
+ "aria-invalid": !!C.error || void 0,
149
+ onChange: (e) => y.onFieldChange("phone", e.target.value)
150
+ }),
151
+ /* @__PURE__ */ g(a, { errors: v(C.error) })
152
+ ] }) })
153
+ ]
154
+ }),
155
+ /* @__PURE__ */ g(n, { children: /* @__PURE__ */ _(r, { children: [
156
+ /* @__PURE__ */ g(o, {
157
+ htmlFor: "counterpart-edit-tax-id",
158
+ requirement: "optional",
159
+ labels: k,
160
+ children: w.label
161
+ }),
162
+ /* @__PURE__ */ g(s, {
163
+ id: "counterpart-edit-tax-id",
164
+ className: "ttw:bg-background",
165
+ placeholder: w.placeholder,
166
+ value: w.value,
167
+ disabled: D,
168
+ "aria-invalid": !!w.error || void 0,
169
+ onChange: (e) => y.onFieldChange("taxId", e.target.value)
170
+ }),
171
+ /* @__PURE__ */ g(i, { children: w.description }),
172
+ /* @__PURE__ */ g(a, { errors: v(w.error) })
173
+ ] }) }),
174
+ E && /* @__PURE__ */ g("div", {
175
+ className: "ttw:flex ttw:flex-col ttw:gap-4",
176
+ children: /* @__PURE__ */ g(h, {
177
+ idPrefix: "counterpart-edit-address",
178
+ values: E.values,
179
+ errors: E.errors,
180
+ stateOptions: y.stateOptions,
181
+ disabled: D,
182
+ onChange: y.onAddressChange,
183
+ labels: O,
184
+ fieldMarkers: {
185
+ ...k,
186
+ ...y.addressFieldMarkers
187
+ }
188
+ })
189
+ })
190
+ ]
191
+ }), /* @__PURE__ */ _("div", {
192
+ className: "ttw:flex ttw:justify-end ttw:gap-4 ttw:pt-6",
193
+ children: [/* @__PURE__ */ g(e, {
194
+ type: "button",
195
+ variant: "outline",
196
+ className: "ttw:w-fit ttw:border-border",
197
+ disabled: D,
198
+ onClick: y.onCancel,
199
+ children: O.cancelButton
200
+ }), /* @__PURE__ */ _(e, {
201
+ type: "submit",
202
+ className: "ttw:w-fit",
203
+ disabled: D || y.submitDisabled,
204
+ children: [D && /* @__PURE__ */ g(d, {}), O.saveButton]
205
+ })]
206
+ })]
207
+ });
208
+ }
209
+ //#endregion
210
+ export { y as CounterpartEditForm };