@tesouro/embedded-components-react 0.11.71 → 0.11.72

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 (88) hide show
  1. package/README.md +1 -0
  2. package/dist/index.css +35 -192
  3. package/dist/index.d.ts +75 -71
  4. package/dist/lib/SettingsWidget.d.ts +5 -1
  5. package/dist/lib/WidgetSuite.d.ts +4 -0
  6. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/feature/dist/index3.js +8 -7
  7. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/feature/dist/index4.js +4 -1
  8. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/feature/dist/index6.js +196 -131
  9. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/ui/dist/index.js +4 -4
  10. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/ui/dist/index3.js +11 -1
  11. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/ui/dist/index4.js +5 -3
  12. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/ui/dist/index5.js +38 -32
  13. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/ui/dist/index6.js +103 -75
  14. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/ui/dist/index7.js +140 -168
  15. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/ui/dist/index8.js +97 -87
  16. package/dist/libs/tesouro-embedded-components-react/settings-widget/chart-of-accounts/feature/dist/index7.js +11 -7
  17. package/dist/libs/tesouro-embedded-components-react/settings-widget/chart-of-accounts/feature/dist/index8.js +0 -1
  18. package/dist/libs/tesouro-embedded-components-react/settings-widget/chart-of-accounts/ui/dist/index2.js +3 -1
  19. package/dist/libs/tesouro-embedded-components-react/settings-widget/chart-of-accounts/ui/dist/index3.js +134 -177
  20. package/dist/libs/tesouro-embedded-components-react/settings-widget/chart-of-accounts/ui/dist/index4.js +110 -176
  21. package/dist/libs/tesouro-embedded-components-react/settings-widget/chart-of-accounts/ui/dist/index5.js +28 -38
  22. package/dist/libs/tesouro-embedded-components-react/settings-widget/feature/dist/lib/ExpenseSettingsTabs/ExpenseSettingsTabs.js +13 -10
  23. package/dist/libs/tesouro-embedded-components-react/settings-widget/feature/dist/lib/SettingsWidget/SettingsWidget.js +28 -24
  24. package/dist/libs/tesouro-embedded-components-react/settings-widget/help/ui/shadcn/dist/index3.js +35 -31
  25. package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/feature/dist/index10.js +2 -0
  26. package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/feature/dist/index7.js +1 -5
  27. package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/feature/dist/index8.js +3 -0
  28. package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index11.js +2 -1
  29. package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index12.js +22 -36
  30. package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index16.js +1 -1
  31. package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index17.js +54 -60
  32. package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index20.js +75 -60
  33. package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index3.js +42 -27
  34. package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index6.js +89 -82
  35. package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index9.js +39 -38
  36. package/dist/libs/tesouro-embedded-components-react/settings-widget/profile/feature/dist/index4.js +32 -32
  37. package/dist/libs/tesouro-embedded-components-react/settings-widget/profile/ui/dist/index2.js +1 -1
  38. package/dist/libs/tesouro-embedded-components-react/settings-widget/profile/ui/dist/index3.js +56 -71
  39. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/data-access/dist/index10.js +3 -0
  40. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/feature/dist/index12.js +86 -66
  41. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/feature/dist/index13.js +51 -51
  42. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/feature/dist/index15.js +146 -132
  43. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/feature/dist/index17.js +95 -99
  44. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/feature/dist/index3.js +1 -0
  45. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/feature/dist/index4.js +8 -27
  46. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/feature/dist/index5.js +69 -72
  47. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/feature/dist/index6.js +51 -51
  48. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index.js +9 -11
  49. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index10.js +83 -298
  50. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index11.js +13 -13
  51. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index12.js +122 -75
  52. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index13.js +41 -15
  53. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index14.js +7 -131
  54. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index15.js +147 -48
  55. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index16.js +240 -11
  56. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index17.js +15 -173
  57. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index2.js +38 -10
  58. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index3.js +5 -46
  59. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index4.js +52 -45
  60. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index5.js +101 -25
  61. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index6.js +40 -98
  62. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index7.js +415 -40
  63. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index8.js +261 -332
  64. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index9.js +15 -8
  65. package/dist/libs/tesouro-embedded-components-react/settings-widget/ui/dist/lib/SettingsWidgetUi/SettingsWidgetUi.js +2 -2
  66. package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/feature/dist/lib/ApprovalPoliciesSettings.js +9 -8
  67. package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/feature/dist/lib/useApprovalPolicyRules.js +136 -122
  68. package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index.js +9 -8
  69. package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index11.js +16 -17
  70. package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index12.js +99 -100
  71. package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index16.js +1 -1
  72. package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index17.js +8 -8
  73. package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index18.js +10 -55
  74. package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index19.js +34 -8
  75. package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index20.js +8 -84
  76. package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index21.js +86 -0
  77. package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index3.js +13 -13
  78. package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index5.js +17 -18
  79. package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index7.js +33 -42
  80. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  81. package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/index.js +24 -24
  82. package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/lib/FileDropZone/FileDropZone.js +62 -0
  83. package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/lib/LoadingRegion/LoadingRegion.js +1 -0
  84. package/dist/packages/shared-ui-shadcn/dist/index.js +2301 -2283
  85. package/package.json +1 -1
  86. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index18.js +0 -291
  87. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index19.js +0 -22
  88. package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/lib/avatarSwatch.js +0 -26
@@ -1,107 +1,117 @@
1
- import { Button as e, Skeleton as t } from "../../../../../../packages/shared-ui-shadcn/dist/index.js";
2
- import { ExpenseApprovalsPageLabels as n, GapCalloutLabels as r } from "./index3.js";
3
- import { formatAmount as i } from "./index4.js";
4
- import { EmptyApprovalRules as a } from "./index5.js";
5
- import { ApprovalRuleCard as o } from "./index6.js";
6
- import { ApprovalRuleForm as s } from "./index7.js";
7
- import { Fragment as c, jsx as l, jsxs as u } from "react/jsx-runtime";
8
- import { CircleCheck as d, Info as f, PlusIcon as p } from "lucide-react";
1
+ import { Alert as e, AlertDescription as t, AlertTitle as n, Button as r, Skeleton as i } from "../../../../../../packages/shared-ui-shadcn/dist/index.js";
2
+ import { ExpenseApprovalsPageLabels as a, GapCalloutLabels as o } from "./index3.js";
3
+ import { formatAmount as s } from "./index4.js";
4
+ import { EmptyApprovalRules as c } from "./index5.js";
5
+ import { ApprovalRuleCard as l } from "./index6.js";
6
+ import { ApprovalRuleForm as u } from "./index7.js";
7
+ import { createPortal as d } from "react-dom";
8
+ import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
9
+ import { CircleCheck as h, Info as g } from "lucide-react";
9
10
  // ../../libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/ui/dist/index8.js
10
- function m(e) {
11
- return e.to === null ? `${r.Above} ${i(e.from)}` : `${i(e.from)} ${r.RangeSeparator} ${i(e.to)}`;
11
+ function _(e, t) {
12
+ return e.to === null ? `${t.Above} ${s(e.from)}` : `${s(e.from)} ${t.RangeSeparator} ${s(e.to)}`;
12
13
  }
13
- var h = ({ rules: i, isBusy: h, isLoading: g, isAddingRule: _, newRuleFormValues: v, newRuleValidationErrors: y, editingRuleId: b, editingRuleFormValues: x, editingRuleValidationErrors: S, approverOptions: C, allExpensesAreCovered: w, gapIntervals: T, onAddRuleClick: E, onCancelAddRule: D, onSaveNewRule: O, onNewRuleFormChange: k, onEditRule: A, onCancelEditRule: j, onSaveEditRule: M, onEditRuleFormChange: N, onDeleteRule: P, onLearnMore: F, testIds: I }) => {
14
- let L = i.length > 0, R = !w && !_ && !b;
15
- return /* @__PURE__ */ l("div", {
14
+ var v = ({ rules: s, labels: v, isBusy: y, isLoading: b, isAddingRule: x, newRuleFormValues: S, newRuleValidationErrors: C, editingRuleId: w, editingRuleFormValues: T, editingRuleValidationErrors: E, approverOptions: D, allExpensesAreCovered: O, gapIntervals: k, onAddRuleClick: A, headerActionContainer: j, onCancelAddRule: M, onSaveNewRule: N, onNewRuleFormChange: P, onEditRule: F, onCancelEditRule: I, onSaveEditRule: L, onEditRuleFormChange: R, onDeleteRule: z, onLearnMore: B, testIds: V }) => {
15
+ let H = {
16
+ ...a,
17
+ ...v?.page
18
+ }, U = {
19
+ ...o,
20
+ ...v?.gap
21
+ }, W = s.length > 0;
22
+ return /* @__PURE__ */ p("div", {
16
23
  className: "ttw:flex ttw:flex-col ttw:gap-3",
17
- children: g && !L && !_ && !b ? /* @__PURE__ */ u("div", {
24
+ children: b && !W && !x && !w ? /* @__PURE__ */ m("div", {
18
25
  role: "status",
19
26
  className: "ttw:flex ttw:flex-col ttw:gap-3",
20
- children: [/* @__PURE__ */ l("span", {
27
+ children: [/* @__PURE__ */ p("span", {
21
28
  className: "ttw:sr-only",
22
- children: n.LoadingRules
23
- }), Array.from({ length: 2 }).map((e, n) => /* @__PURE__ */ u("div", {
29
+ children: H.LoadingRules
30
+ }), Array.from({ length: 2 }).map((e, t) => /* @__PURE__ */ m("div", {
24
31
  className: "ttw:border ttw:border-border ttw:rounded-lg ttw:p-4 ttw:flex ttw:flex-col ttw:gap-3",
25
- children: [/* @__PURE__ */ u("div", {
32
+ children: [/* @__PURE__ */ m("div", {
26
33
  className: "ttw:flex ttw:items-center ttw:justify-between",
27
- children: [/* @__PURE__ */ l(t, { className: "ttw:h-4 ttw:w-64" }), /* @__PURE__ */ u("div", {
34
+ children: [/* @__PURE__ */ p(i, { className: "ttw:h-4 ttw:w-64" }), /* @__PURE__ */ m("div", {
28
35
  className: "ttw:flex ttw:gap-1",
29
- children: [/* @__PURE__ */ l(t, { className: "ttw:h-8 ttw:w-8" }), /* @__PURE__ */ l(t, { className: "ttw:h-8 ttw:w-8" })]
36
+ children: [/* @__PURE__ */ p(i, { className: "ttw:h-8 ttw:w-8" }), /* @__PURE__ */ p(i, { className: "ttw:h-8 ttw:w-8" })]
30
37
  })]
31
- }), /* @__PURE__ */ l(t, { className: "ttw:h-6 ttw:w-32" })]
32
- }, n))]
33
- }) : !L && !_ ? /* @__PURE__ */ l(a, {
34
- onAddRule: E,
35
- onLearnMore: F
36
- }) : /* @__PURE__ */ u(c, { children: [
37
- i.map((e) => b === e.id && x ? /* @__PURE__ */ l(s, {
38
- values: x,
39
- approverOptions: C,
40
- validationErrors: S,
38
+ }), /* @__PURE__ */ p(i, { className: "ttw:h-6 ttw:w-32" })]
39
+ }, t))]
40
+ }) : !W && !x ? /* @__PURE__ */ p(c, {
41
+ labels: v?.empty,
42
+ onAddRule: A,
43
+ onLearnMore: B
44
+ }) : /* @__PURE__ */ m(f, { children: [
45
+ !O && !x && !w && W && (j === void 0 ? /* @__PURE__ */ p("div", {
46
+ className: "ttw:flex ttw:justify-end",
47
+ children: /* @__PURE__ */ p(r, {
48
+ size: "sm",
49
+ onClick: A,
50
+ disabled: y,
51
+ children: H.AddRule
52
+ })
53
+ }) : j ? d(/* @__PURE__ */ p(r, {
54
+ size: "sm",
55
+ onClick: A,
56
+ disabled: y,
57
+ children: H.AddRule
58
+ }), j) : null),
59
+ s.map((e) => w === e.id && T ? /* @__PURE__ */ p(u, {
60
+ labels: v?.ruleForm,
61
+ values: T,
62
+ approverOptions: D,
63
+ validationErrors: E,
41
64
  isEditing: !0,
42
- disabled: h,
43
- isSaveDisabled: !!(S.minAmount || S.maxAmount),
44
- onValuesChange: N,
45
- onSave: M,
46
- onCancel: j,
47
- onDelete: () => P(e.id),
48
- testIds: I?.ruleForm
49
- }, e.id) : /* @__PURE__ */ l(o, {
65
+ disabled: y,
66
+ onValuesChange: R,
67
+ onSave: L,
68
+ onCancel: I,
69
+ onDelete: () => z(e.id),
70
+ testIds: V?.ruleForm
71
+ }, e.id) : /* @__PURE__ */ p(l, {
50
72
  rule: e,
51
- onEdit: A,
52
- onDelete: P,
53
- disabled: h,
54
- testIds: I?.ruleCard
73
+ labels: v?.ruleCard,
74
+ onEdit: F,
75
+ onDelete: z,
76
+ disabled: y,
77
+ testIds: V?.ruleCard
55
78
  }, e.id)),
56
- _ && !b && /* @__PURE__ */ l(s, {
57
- values: v,
58
- approverOptions: C,
59
- validationErrors: y,
79
+ x && !w && /* @__PURE__ */ p(u, {
80
+ labels: v?.ruleForm,
81
+ values: S,
82
+ approverOptions: D,
83
+ validationErrors: C,
60
84
  isEditing: !1,
61
- disabled: h,
62
- isSaveDisabled: !!(y.minAmount || y.maxAmount),
63
- onValuesChange: k,
64
- onSave: O,
65
- onCancel: D,
66
- testIds: I?.ruleForm
67
- }),
68
- R && /* @__PURE__ */ u("div", {
69
- className: "ttw:flex ttw:items-center ttw:justify-between ttw:border ttw:border-dashed ttw:border-border ttw:rounded-lg ttw:px-4 ttw:py-3",
70
- children: [/* @__PURE__ */ l("span", {
71
- className: "ttw:text-sm ttw:font-bold ttw:text-foreground",
72
- children: n.CreateAnotherRule
73
- }), /* @__PURE__ */ u(e, {
74
- size: "sm",
75
- onClick: E,
76
- disabled: h,
77
- children: [/* @__PURE__ */ l(p, {}), n.AddRule]
78
- })]
85
+ disabled: y,
86
+ onValuesChange: P,
87
+ onSave: N,
88
+ onCancel: M,
89
+ testIds: V?.ruleForm
79
90
  }),
80
- w && /* @__PURE__ */ u("div", {
81
- className: "ttw:flex ttw:items-start ttw:gap-2 ttw:bg-green-50 ttw:border ttw:border-green-200 ttw:rounded-lg ttw:p-3",
82
- children: [/* @__PURE__ */ l(d, { className: "ttw:size-4 ttw:text-green-600 ttw:mt-0.5 ttw:shrink-0" }), /* @__PURE__ */ u("div", { children: [/* @__PURE__ */ l("p", {
83
- className: "ttw:text-sm ttw:font-medium ttw:text-green-800",
84
- children: n.AllExpensesCoveredTitle
85
- }), /* @__PURE__ */ l("p", {
86
- className: "ttw:text-xs ttw:text-green-700 ttw:mt-0.5",
87
- children: n.AllExpensesCoveredBody
88
- })] })]
91
+ O && /* @__PURE__ */ m(e, {
92
+ variant: "success",
93
+ role: "status",
94
+ children: [
95
+ /* @__PURE__ */ p(h, { "aria-hidden": "true" }),
96
+ /* @__PURE__ */ p(n, { children: H.AllExpensesCoveredTitle }),
97
+ /* @__PURE__ */ p(t, { children: H.AllExpensesCoveredBody })
98
+ ]
89
99
  }),
90
- !w && T.length > 0 && /* @__PURE__ */ u("div", {
91
- className: "ttw:flex ttw:items-start ttw:gap-2 ttw:bg-muted ttw:border ttw:border-border ttw:rounded-lg ttw:p-3",
92
- children: [/* @__PURE__ */ l(f, { className: "ttw:size-4 ttw:text-muted-foreground ttw:mt-0.5 ttw:shrink-0" }), /* @__PURE__ */ u("p", {
93
- className: "ttw:text-sm ttw:text-foreground",
94
- children: [
95
- "The ",
96
- /* @__PURE__ */ l("strong", { children: "system default" }),
97
- " will apply to transactions",
98
- " ",
99
- /* @__PURE__ */ l("strong", { children: T.map(m).join(", ") }),
100
- r.Suffix
101
- ]
102
- })]
100
+ !O && k.length > 0 && /* @__PURE__ */ m(e, {
101
+ variant: "info",
102
+ role: "status",
103
+ children: [/* @__PURE__ */ p(g, { "aria-hidden": "true" }), /* @__PURE__ */ p(t, { children: /* @__PURE__ */ m("p", { children: [
104
+ U.Prefix,
105
+ " ",
106
+ /* @__PURE__ */ p("strong", { children: U.Default }),
107
+ " ",
108
+ U.AfterDefault,
109
+ " ",
110
+ /* @__PURE__ */ p("strong", { children: k.map((e) => _(e, U)).join(", ") }),
111
+ U.Suffix
112
+ ] }) })]
103
113
  })
104
114
  ] })
105
115
  });
106
116
  };
107
- export { h as ExpenseApprovalsPage };
117
+ export { v as ExpenseApprovalsPage };
@@ -64,7 +64,12 @@ function _({ canWrite: _ = !1, labels: v, formLabels: y, deleteLabels: b } = {})
64
64
  name: j.name.trim(),
65
65
  nominal_code: j.nominal_code.trim(),
66
66
  description: j.description.trim()
67
- }, i = R.current, a = () => R.current === i;
67
+ };
68
+ if (D === "edit" && k && r.name === k.name.trim() && r.nominal_code === k.nominal_code.trim() && r.description === (k.description ?? "").trim()) {
69
+ E(!1);
70
+ return;
71
+ }
72
+ let i = R.current, a = () => R.current === i;
68
73
  B(!0);
69
74
  try {
70
75
  D === "edit" && k ? (await w(k.id, r), e.success(g(x.accountUpdated, r.name))) : (await C(r), e.success(g(x.accountCreated, r.name))), a() && E(!1);
@@ -109,19 +114,18 @@ function _({ canWrite: _ = !1, labels: v, formLabels: y, deleteLabels: b } = {})
109
114
  V
110
115
  ]), le = d(() => {
111
116
  k && Q(k);
112
- }, [k, Q]), ue = j.name.trim().length === 0 || j.nominal_code.trim().length === 0, de = S.descriptionCounter.replace("{count}", () => String(j.description.length)).replace("{max}", () => String(a.description)), fe = D === "edit" ? k?.name ?? "" : S.createTitle, pe = D === "edit" ? S.editDescription : S.createDescription, me = g(ee.title, I?.name ?? "");
117
+ }, [k, Q]), ue = S.descriptionCounter.replace("{count}", () => String(j.description.length)).replace("{max}", () => String(a.description)), de = D === "edit" ? k?.name ?? "" : S.createTitle, fe = D === "edit" ? S.editDescription : S.createDescription, pe = g(ee.title, I?.name ?? "");
113
118
  return {
114
119
  form: {
115
120
  open: te,
116
121
  mode: D,
117
- title: fe,
118
- description: pe,
122
+ title: de,
123
+ description: fe,
119
124
  values: j,
120
125
  errors: N,
121
126
  editing: k,
122
127
  inProgress: z,
123
- submitDisabled: ue,
124
- descriptionCounterText: de,
128
+ descriptionCounterText: ue,
125
129
  onOpenChange: W,
126
130
  onNameChange: K,
127
131
  onGlCodeChange: q,
@@ -131,7 +135,7 @@ function _({ canWrite: _ = !1, labels: v, formLabels: y, deleteLabels: b } = {})
131
135
  },
132
136
  deleteDialog: {
133
137
  open: ne,
134
- title: me,
138
+ title: pe,
135
139
  error: ie,
136
140
  isDeleting: oe,
137
141
  onOpenChange: ce,
@@ -90,7 +90,6 @@ function b({ onEdit: r, onDelete: o, onAdd: b, screenLabels: x, formLabels: S, d
90
90
  values: k.form.values,
91
91
  errors: k.form.errors,
92
92
  inProgress: k.form.inProgress,
93
- submitDisabled: k.form.submitDisabled,
94
93
  descriptionCounterText: k.form.descriptionCounterText,
95
94
  onNameChange: k.form.onNameChange,
96
95
  onGlCodeChange: k.form.onGlCodeChange,
@@ -9,12 +9,14 @@ var e = {
9
9
  actionDelete: "Delete",
10
10
  sortByName: "Sort by account name",
11
11
  openActionsMenu: "Open actions menu",
12
+ editAccount: "Edit account",
13
+ loading: "Loading accounts",
12
14
  addAccount: "Add account",
13
15
  emptyTitle: "No accounts created yet",
14
16
  emptyDescription: "Add your first ledger account.",
15
17
  emptyPageTitle: "Nothing left on this page",
16
18
  emptyPageDescription: "Every account on this page has been removed. Go back to see the rest.",
17
- errorTitle: "Failed to load your chart of accounts",
19
+ errorTitle: "Couldn't load chart of accounts",
18
20
  errorDescription: "Something went wrong while fetching your accounts. Please try again.",
19
21
  paginationPrev: "Previous",
20
22
  paginationNext: "Next"
@@ -1,210 +1,167 @@
1
- import { Button as e, DataTable as t, DropdownMenu as n, DropdownMenuContent as r, DropdownMenuItem as i, DropdownMenuTrigger as a, Skeleton as o, Table as s, TableBody as c, TableCell as l, TableHead as u, TableHeader as d, TableRow as f } from "../../../../../../packages/shared-ui-shadcn/dist/index.js";
2
- import { CHART_OF_ACCOUNTS_LABELS_EN as p } from "./index2.js";
3
- import "react";
4
- import { Fragment as m, jsx as h, jsxs as g } from "react/jsx-runtime";
5
- import { AlertCircleIcon as _, ArrowDownIcon as v, ArrowUpDownIcon as y, ArrowUpIcon as b, FileTextIcon as x, MoreVerticalIcon as S, PencilIcon as C, PlusIcon as w, Trash2Icon as T } from "lucide-react";
1
+ import { Button as e, ContextMenuItem as t, ContextMenuSeparator as n, DataTable as r, DropdownMenu as i, DropdownMenuContent as a, DropdownMenuItem as o, DropdownMenuSeparator as s, DropdownMenuTrigger as c, Tooltip as l, TooltipContent as u, TooltipProvider as d, TooltipTrigger as f } from "../../../../../../packages/shared-ui-shadcn/dist/index.js";
2
+ import { EmptyState as p } from "../../../../shared/ui/dist/lib/EmptyState/EmptyState.js";
3
+ import { ErrorState as m } from "../../../../shared/ui/dist/lib/ErrorState/ErrorState.js";
4
+ import "../../../../shared/ui/dist/index.js";
5
+ import { CHART_OF_ACCOUNTS_LABELS_EN as h } from "./index2.js";
6
+ import { Fragment as g, jsx as _, jsxs as v } from "react/jsx-runtime";
7
+ import { ArrowDownIcon as y, ArrowUpDownIcon as b, ArrowUpIcon as x, MoreVerticalIcon as S, PencilIcon as C, Trash2Icon as w } from "lucide-react";
6
8
  // ../../libs/tesouro-embedded-components-react/settings-widget/chart-of-accounts/ui/dist/index3.js
7
- function E({ labels: e }) {
8
- return /* @__PURE__ */ g("div", {
9
- className: "ttw:flex ttw:flex-col ttw:items-center ttw:justify-center ttw:px-4 ttw:py-14 ttw:text-center",
10
- children: [
11
- /* @__PURE__ */ h("div", {
12
- className: "ttw:mb-4 ttw:flex ttw:h-14 ttw:w-14 ttw:items-center ttw:justify-center ttw:rounded-2xl ttw:bg-destructive/10",
13
- children: /* @__PURE__ */ h(_, { className: "ttw:h-6 ttw:w-6 ttw:text-destructive" })
14
- }),
15
- /* @__PURE__ */ h("h3", {
16
- className: "ttw:mb-2 ttw:text-lg ttw:font-bold ttw:tracking-tight ttw:text-foreground",
17
- children: e.errorTitle
18
- }),
19
- /* @__PURE__ */ h("p", {
20
- className: "ttw:max-w-sm ttw:text-sm ttw:text-muted-foreground",
21
- children: e.errorDescription
22
- })
23
- ]
24
- });
25
- }
26
- function D({ title: t, description: n, addLabel: r, onAdd: i, testId: a }) {
27
- return /* @__PURE__ */ g("div", {
28
- "data-testid": a,
29
- className: "ttw:flex ttw:flex-col ttw:items-center ttw:justify-center ttw:px-4 ttw:py-14 ttw:text-center",
30
- children: [
31
- /* @__PURE__ */ h("div", {
32
- className: "ttw:mb-4 ttw:flex ttw:h-14 ttw:w-14 ttw:items-center ttw:justify-center ttw:rounded-2xl ttw:bg-muted",
33
- children: /* @__PURE__ */ h(x, { className: "ttw:h-6 ttw:w-6 ttw:text-muted-foreground" })
34
- }),
35
- /* @__PURE__ */ h("h3", {
36
- className: "ttw:mb-2 ttw:text-lg ttw:font-bold ttw:tracking-tight ttw:text-foreground",
37
- children: t
38
- }),
39
- /* @__PURE__ */ h("p", {
40
- className: "ttw:mb-6 ttw:max-w-sm ttw:text-sm ttw:text-muted-foreground",
41
- children: n
42
- }),
43
- i && /* @__PURE__ */ g(e, {
44
- onClick: i,
45
- children: [/* @__PURE__ */ h(w, { className: "ttw:mr-1 ttw:h-4 ttw:w-4" }), r]
46
- })
47
- ]
48
- });
49
- }
50
- function O({ labels: t, hasActions: n, children: r }) {
51
- return /* @__PURE__ */ h("div", {
52
- className: "ttw:overflow-hidden ttw:rounded-xl ttw:border ttw:border-border ttw:bg-card",
53
- children: /* @__PURE__ */ g(s, { children: [/* @__PURE__ */ h(d, { children: /* @__PURE__ */ g(f, { children: [
54
- /* @__PURE__ */ h(u, { children: t.columnGlCode }),
55
- /* @__PURE__ */ h(u, { children: /* @__PURE__ */ h(e, {
56
- variant: "ghost",
57
- disabled: !0,
58
- className: "ttw:-ml-3",
59
- children: t.columnName
60
- }) }),
61
- /* @__PURE__ */ h(u, { children: t.columnDescription }),
62
- n && /* @__PURE__ */ h(u, {
63
- className: "ttw:w-16 ttw:text-right",
64
- children: t.columnActions
65
- })
66
- ] }) }), /* @__PURE__ */ h(c, { children: r })] })
67
- });
68
- }
69
- function k({ data: s, isLoading: c, isError: u, sorting: d, onSortingChange: _, pageSize: x, onPageSizeChange: k, pageSizeOptions: A, hasNextPage: j, hasPrevPage: M, onNextPage: N, onPrevPage: P, labels: F, emptyStateTestId: I, onEdit: L, onDelete: R, onAdd: z }) {
70
- let B = {
71
- ...p,
72
- ...F
73
- }, V = !!(L ?? R), H = B.subtitle ? /* @__PURE__ */ h("div", {
9
+ function T({ data: T, isLoading: E, isError: D, sorting: O, onSortingChange: k, pageSize: A, onPageSizeChange: j, pageSizeOptions: M, hasNextPage: N, hasPrevPage: P, onNextPage: F, onPrevPage: I, labels: L, emptyStateTestId: R, onEdit: z, onDelete: B, onAdd: V }) {
10
+ let H = {
11
+ ...h,
12
+ ...L
13
+ }, U = !!(z ?? B), W = H.subtitle ? /* @__PURE__ */ _("div", {
74
14
  className: "ttw:mb-4",
75
- children: /* @__PURE__ */ h("p", {
15
+ children: /* @__PURE__ */ _("p", {
76
16
  className: "ttw:text-sm ttw:text-muted-foreground",
77
- children: B.subtitle
17
+ children: H.subtitle
78
18
  })
79
- }) : null, U = s.length === 0 && !M, W = /* @__PURE__ */ g(m, { children: [H, z && !U && /* @__PURE__ */ h("div", {
19
+ }) : null, G = T.length === 0 && !P, K = /* @__PURE__ */ v(g, { children: [W, V && !G && /* @__PURE__ */ _("div", {
80
20
  className: "ttw:mb-4 ttw:flex ttw:items-center ttw:justify-end",
81
- children: /* @__PURE__ */ g(e, {
82
- onClick: z,
83
- children: [/* @__PURE__ */ h(w, { className: "ttw:mr-1 ttw:h-4 ttw:w-4" }), B.addAccount]
21
+ children: /* @__PURE__ */ _(e, {
22
+ onClick: V,
23
+ children: H.addAccount
84
24
  })
85
- })] }), G = [
25
+ })] }), q = (t) => t.is_external ? null : /* @__PURE__ */ _("div", {
26
+ className: "ttw:flex ttw:justify-end",
27
+ children: /* @__PURE__ */ v(i, { children: [/* @__PURE__ */ _(d, { children: /* @__PURE__ */ v(l, { children: [/* @__PURE__ */ _(f, {
28
+ asChild: !0,
29
+ children: /* @__PURE__ */ _(c, {
30
+ asChild: !0,
31
+ children: /* @__PURE__ */ _(e, {
32
+ variant: "ghost",
33
+ size: "icon-sm",
34
+ "aria-label": H.openActionsMenu,
35
+ onClick: (e) => e.stopPropagation(),
36
+ children: /* @__PURE__ */ _(S, { className: "ttw:h-4 ttw:w-4" })
37
+ })
38
+ })
39
+ }), /* @__PURE__ */ _(u, { children: H.openActionsMenu })] }) }), /* @__PURE__ */ v(a, {
40
+ align: "end",
41
+ onClick: (e) => e.stopPropagation(),
42
+ children: [
43
+ z && /* @__PURE__ */ v(o, {
44
+ onClick: () => z(t),
45
+ children: [/* @__PURE__ */ _(C, { className: "ttw:mr-2 ttw:h-4 ttw:w-4" }), H.actionEdit]
46
+ }),
47
+ z && B && /* @__PURE__ */ _(s, {}),
48
+ B && /* @__PURE__ */ v(o, {
49
+ variant: "destructive",
50
+ onClick: () => B(t),
51
+ children: [/* @__PURE__ */ _(w, { className: "ttw:mr-2 ttw:h-4 ttw:w-4" }), H.actionDelete]
52
+ })
53
+ ]
54
+ })] })
55
+ }), J = [
86
56
  {
87
57
  accessorKey: "nominal_code",
88
- header: B.columnGlCode
58
+ header: H.columnGlCode,
59
+ meta: { fitContent: !0 }
89
60
  },
90
61
  {
91
62
  accessorKey: "name",
92
63
  enableSorting: !0,
93
64
  header: ({ column: t }) => {
94
65
  let n = t.getIsSorted();
95
- return /* @__PURE__ */ g("div", {
66
+ return /* @__PURE__ */ v("div", {
96
67
  className: "ttw:flex ttw:items-center ttw:gap-2 ttw:text-inherit",
97
- children: [B.columnName, /* @__PURE__ */ h(e, {
68
+ children: [H.columnName, /* @__PURE__ */ _(e, {
98
69
  variant: "ghost",
99
- "aria-label": B.sortByName,
70
+ "aria-label": H.sortByName,
100
71
  onClick: () => t.toggleSorting(n === "asc"),
101
- children: h(n === "asc" ? b : n === "desc" ? v : y, { className: "ttw:size-4" })
72
+ children: _(n === "asc" ? x : n === "desc" ? y : b, { className: "ttw:size-4" })
102
73
  })]
103
74
  });
104
75
  }
105
76
  },
106
77
  {
107
78
  accessorKey: "description",
108
- header: B.columnDescription
79
+ header: H.columnDescription,
80
+ cell: ({ row: e }) => /* @__PURE__ */ _("span", {
81
+ className: "ttw:block ttw:max-w-50 ttw:truncate",
82
+ title: e.original.description,
83
+ children: e.original.description
84
+ })
109
85
  },
110
- ...V ? [{
86
+ ...U ? [{
111
87
  id: "actions",
112
- header: () => /* @__PURE__ */ h("div", {
88
+ header: () => /* @__PURE__ */ _("div", {
113
89
  className: "ttw:flex ttw:justify-end",
114
- children: B.columnActions
90
+ children: H.columnActions
115
91
  }),
116
- cell: ({ row: t }) => t.original.is_external ? null : /* @__PURE__ */ h("div", {
117
- className: "ttw:flex ttw:justify-end",
118
- children: /* @__PURE__ */ g(n, { children: [/* @__PURE__ */ h(a, {
119
- asChild: !0,
120
- children: /* @__PURE__ */ h(e, {
121
- variant: "ghost",
122
- size: "icon-sm",
123
- "aria-label": B.openActionsMenu,
124
- children: /* @__PURE__ */ h(S, { className: "ttw:h-4 ttw:w-4" })
125
- })
126
- }), /* @__PURE__ */ g(r, {
127
- align: "end",
128
- children: [L && /* @__PURE__ */ g(i, {
129
- onClick: () => L(t.original),
130
- children: [/* @__PURE__ */ h(C, { className: "ttw:mr-2 ttw:h-4 ttw:w-4" }), B.actionEdit]
131
- }), R && /* @__PURE__ */ g(i, {
132
- variant: "destructive",
133
- onClick: () => R(t.original),
134
- children: [/* @__PURE__ */ h(T, { className: "ttw:mr-2 ttw:h-4 ttw:w-4" }), B.actionDelete]
135
- })]
136
- })] })
137
- })
92
+ cell: ({ row: e }) => q(e.original),
93
+ meta: { fitContent: !0 }
138
94
  }] : []
139
- ];
140
- return u ? /* @__PURE__ */ g(m, { children: [W, /* @__PURE__ */ h(O, {
141
- labels: B,
142
- hasActions: V,
143
- children: /* @__PURE__ */ h(f, { children: /* @__PURE__ */ h(l, {
144
- colSpan: V ? 4 : 3,
145
- className: "ttw:p-0",
146
- children: /* @__PURE__ */ h(E, { labels: B })
147
- }) })
148
- })] }) : c && s.length === 0 ? /* @__PURE__ */ g(m, { children: [W, /* @__PURE__ */ h(O, {
149
- labels: B,
150
- hasActions: V,
151
- children: Array.from({ length: 5 }).map((e, t) => /* @__PURE__ */ g(f, { children: [
152
- /* @__PURE__ */ h(l, { children: /* @__PURE__ */ h(o, { className: "ttw:h-4 ttw:w-36" }) }),
153
- /* @__PURE__ */ h(l, { children: /* @__PURE__ */ h(o, { className: "ttw:h-4 ttw:w-14" }) }),
154
- /* @__PURE__ */ h(l, { children: /* @__PURE__ */ h(o, { className: "ttw:h-4 ttw:w-56" }) }),
155
- V && /* @__PURE__ */ h(l, {})
156
- ] }, t))
157
- })] }) : s.length === 0 && M ? /* @__PURE__ */ g(m, { children: [W, /* @__PURE__ */ h(t, {
158
- columns: G,
159
- data: s,
160
- sorting: d,
161
- onSortingChange: _,
162
- pageSize: x,
163
- onPageSizeChange: k,
164
- pageSizeOptions: A,
165
- hasNextPage: j,
166
- hasPrevPage: M,
167
- onNextPage: N,
168
- onPrevPage: P,
95
+ ], Y = z ? {
96
+ onRowClick: (e) => z(e),
97
+ rowAriaLabel: (e) => `${H.editAccount}: ${e.name}, ${e.nominal_code}`,
98
+ isRowActionable: (e) => !e.is_external
99
+ } : {};
100
+ return /* @__PURE__ */ v(g, { children: [K, /* @__PURE__ */ _(r, {
101
+ columns: J,
102
+ data: D ? [] : T,
103
+ sorting: O,
104
+ onSortingChange: k,
105
+ pageSize: A,
106
+ onPageSizeChange: j,
107
+ pageSizeOptions: M,
108
+ hasNextPage: N,
109
+ hasPrevPage: P,
110
+ onNextPage: F,
111
+ onPrevPage: I,
112
+ showPagination: T.length > 0 || !!P,
113
+ isLoading: !(!E || T.length !== 0 || D),
169
114
  labels: {
170
- previousPage: B.paginationPrev,
171
- nextPage: B.paginationNext
115
+ loading: H.loading,
116
+ previousPage: H.paginationPrev,
117
+ nextPage: H.paginationNext
172
118
  },
173
- children: /* @__PURE__ */ h(D, {
174
- title: B.emptyPageTitle,
175
- description: B.emptyPageDescription,
176
- addLabel: B.addAccount
177
- })
178
- })] }) : s.length === 0 ? /* @__PURE__ */ g(m, { children: [W, /* @__PURE__ */ h(O, {
179
- labels: B,
180
- hasActions: V,
181
- children: /* @__PURE__ */ h(f, { children: /* @__PURE__ */ h(l, {
182
- colSpan: V ? 4 : 3,
183
- className: "ttw:p-0",
184
- children: /* @__PURE__ */ h(D, {
185
- title: B.emptyTitle,
186
- description: B.emptyDescription,
187
- addLabel: B.addAccount,
188
- onAdd: z,
189
- testId: I
119
+ getRowId: (e) => e.id,
120
+ ...Y,
121
+ rowContextMenu: (e) => !e.is_external && (z || B) ? /* @__PURE__ */ v(g, { children: [
122
+ z && /* @__PURE__ */ _(t, {
123
+ onClick: () => z(e),
124
+ children: H.actionEdit
125
+ }),
126
+ z && B && /* @__PURE__ */ _(n, {}),
127
+ B && /* @__PURE__ */ _(t, {
128
+ variant: "destructive",
129
+ onClick: () => B(e),
130
+ children: H.actionDelete
190
131
  })
191
- }) })
192
- })] }) : /* @__PURE__ */ g(m, { children: [W, /* @__PURE__ */ h(t, {
193
- columns: G,
194
- data: s,
195
- sorting: d,
196
- onSortingChange: _,
197
- pageSize: x,
198
- onPageSizeChange: k,
199
- pageSizeOptions: A,
200
- hasNextPage: j,
201
- hasPrevPage: M,
202
- onNextPage: N,
203
- onPrevPage: P,
204
- labels: {
205
- previousPage: B.paginationPrev,
206
- nextPage: B.paginationNext
207
- }
132
+ ] }) : void 0,
133
+ renderCard: !D && T.length > 0 ? (e) => /* @__PURE__ */ v("div", {
134
+ className: "ttw:flex ttw:items-start ttw:justify-between ttw:gap-4",
135
+ children: [/* @__PURE__ */ v("div", {
136
+ className: "ttw:flex ttw:min-w-0 ttw:flex-col ttw:gap-1",
137
+ children: [
138
+ /* @__PURE__ */ _("span", {
139
+ className: "ttw:truncate ttw:font-medium",
140
+ title: e.name,
141
+ children: e.name
142
+ }),
143
+ /* @__PURE__ */ _("span", { children: e.nominal_code }),
144
+ /* @__PURE__ */ _("span", {
145
+ className: "ttw:truncate ttw:text-muted-foreground",
146
+ title: e.description,
147
+ children: e.description
148
+ })
149
+ ]
150
+ }), U && q(e)]
151
+ }) : void 0,
152
+ children: D ? /* @__PURE__ */ _(m, {
153
+ title: H.errorTitle,
154
+ description: H.errorDescription
155
+ }) : P ? /* @__PURE__ */ _(p, {
156
+ title: H.emptyPageTitle,
157
+ description: H.emptyPageDescription
158
+ }) : /* @__PURE__ */ _(p, {
159
+ title: H.emptyTitle,
160
+ description: H.emptyDescription,
161
+ actionLabel: H.addAccount,
162
+ onAction: V,
163
+ testId: R
164
+ })
208
165
  })] });
209
166
  }
210
- export { k as ChartOfAccountsTable, k as default };
167
+ export { T as ChartOfAccountsTable, T as default };