@tesouro/embedded-components-react 0.9.41 → 0.9.43

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 (19) hide show
  1. package/dist/experimental/ApprovalRequests.d.ts +15 -1
  2. package/dist/experimental/index.d.ts +15 -1
  3. package/dist/libs/tesouro-embedded-components-react/approval-requests-widget/data-access/dist/index.js +5 -5
  4. package/dist/libs/tesouro-embedded-components-react/approval-requests-widget/data-access/dist/index2.js +9 -0
  5. package/dist/libs/tesouro-embedded-components-react/approval-requests-widget/data-access/dist/index4.js +29 -2
  6. package/dist/libs/tesouro-embedded-components-react/approval-requests-widget/data-access/dist/index5.js +30 -2
  7. package/dist/libs/tesouro-embedded-components-react/approval-requests-widget/feature/dist/lib/ApprovalRequestsWidget/ApprovalRequestsWidget.js +45 -35
  8. package/dist/libs/tesouro-embedded-components-react/approval-requests-widget/feature/dist/lib/ApprovalRequestsWidget/buildApprovalRequestRows.js +17 -14
  9. package/dist/libs/tesouro-embedded-components-react/approval-requests-widget/feature/dist/lib/ApprovalRequestsWidget/canDecideApprovalRequest.js +8 -0
  10. package/dist/libs/tesouro-embedded-components-react/approval-requests-widget/feature/dist/lib/ApprovalRequestsWidget/useApprovalRequestDecisions.js +76 -0
  11. package/dist/libs/tesouro-embedded-components-react/approval-requests-widget/feature/dist/lib/ApprovalRequestsWidget/useApprovalRequestsFilters.js +4 -4
  12. package/dist/libs/tesouro-embedded-components-react/approval-requests-widget/feature/dist/lib/ApprovalRequestsWidget/useApprovalRequestsTable.js +53 -44
  13. package/dist/libs/tesouro-embedded-components-react/approval-requests-widget/ui/dist/index.js +2 -1
  14. package/dist/libs/tesouro-embedded-components-react/approval-requests-widget/ui/dist/index2.js +13 -1
  15. package/dist/libs/tesouro-embedded-components-react/approval-requests-widget/ui/dist/index4.js +91 -58
  16. package/dist/libs/tesouro-embedded-components-react/approval-requests-widget/ui/dist/index5.js +44 -0
  17. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  18. package/dist/packages/shared-ui-shadcn/dist/index.js +3432 -3332
  19. package/package.json +1 -1
@@ -1,104 +1,137 @@
1
- import { Badge as e, DataTable as t, Skeleton as n } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
2
- import { EmptyState as r } from "../../../shared/ui/dist/lib/EmptyState/EmptyState.js";
3
- import { ErrorState as i } from "../../../shared/ui/dist/lib/ErrorState/ErrorState.js";
1
+ import { Badge as e, ContextMenuItem as t, DataTable as n, DataTableRowActions as r, DropdownMenuItem as i, Skeleton as a } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
2
+ import { EmptyState as o } from "../../../shared/ui/dist/lib/EmptyState/EmptyState.js";
3
+ import { ErrorState as s } from "../../../shared/ui/dist/lib/ErrorState/ErrorState.js";
4
4
  import "../../../shared/ui/dist/index.js";
5
- import { APPROVAL_REQUESTS_SCREEN_LABELS_EN as a } from "./index2.js";
6
- import { ApprovalRequestsFilterBar as o } from "./index3.js";
7
- import { Fragment as s, jsx as c, jsxs as l } from "react/jsx-runtime";
5
+ import { APPROVAL_REQUESTS_SCREEN_LABELS_EN as c } from "./index2.js";
6
+ import { ApprovalRequestsFilterBar as l } from "./index3.js";
7
+ import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
8
8
  //#region ../../libs/tesouro-embedded-components-react/approval-requests-widget/ui/dist/index4.js
9
- var u = [], d = () => void 0;
10
- function f({ name: e, loadingLabel: t }) {
11
- return e === void 0 ? /* @__PURE__ */ l(s, { children: [/* @__PURE__ */ c(n, {
9
+ var p = [], m = () => void 0;
10
+ function h({ name: e, loadingLabel: t }) {
11
+ return e === void 0 ? /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d(a, {
12
12
  className: "ttw:h-4 ttw:w-32",
13
13
  "aria-hidden": !0
14
- }), /* @__PURE__ */ c("span", {
14
+ }), /* @__PURE__ */ d("span", {
15
15
  className: "ttw:sr-only",
16
16
  children: t
17
- })] }) : /* @__PURE__ */ c(s, { children: e });
17
+ })] }) : /* @__PURE__ */ d(u, { children: e });
18
18
  }
19
- function p({ rows: n, isLoading: s, isError: l, isAccessRestricted: p, pageSize: m, onPageSizeChange: h, pageSizeOptions: g, hasNextPage: _, hasPrevPage: v, onNextPage: y, onPrevPage: b, emptyState: x, filters: S, onRetry: C, labels: w }) {
20
- let T = a, { filterBar: E, ...D } = w ?? {}, O = {
21
- ...T,
22
- ...D
23
- }, k = [
19
+ function g({ rows: a, isLoading: g, isError: _, isAccessRestricted: v, pageSize: y, onPageSizeChange: b, pageSizeOptions: x, hasNextPage: S, hasPrevPage: C, onNextPage: w, onPrevPage: T, emptyState: E, filters: D, onRetry: O, onApprove: k, onReject: A, labels: j }) {
20
+ let M = c, { filterBar: N, ...P } = j ?? {}, F = {
21
+ ...M,
22
+ ...P
23
+ }, I = [
24
24
  {
25
25
  accessorKey: "invoiceNumber",
26
- header: O.columnInvoiceNumber
26
+ header: F.columnInvoiceNumber
27
27
  },
28
28
  {
29
29
  accessorKey: "vendor",
30
- header: O.columnVendor,
31
- cell: ({ row: e }) => /* @__PURE__ */ c(f, {
30
+ header: F.columnVendor,
31
+ cell: ({ row: e }) => /* @__PURE__ */ d(h, {
32
32
  name: e.original.vendor,
33
- loadingLabel: O.loadingValue
33
+ loadingLabel: F.loadingValue
34
34
  })
35
35
  },
36
36
  {
37
37
  accessorKey: "issueDate",
38
- header: O.columnIssueDate
38
+ header: F.columnIssueDate
39
39
  },
40
40
  {
41
41
  accessorKey: "dueDate",
42
- header: O.columnDueDate
42
+ header: F.columnDueDate
43
43
  },
44
44
  {
45
45
  accessorKey: "statusLabel",
46
- header: O.columnStatus,
47
- cell: ({ row: t }) => /* @__PURE__ */ c(e, {
46
+ header: F.columnStatus,
47
+ cell: ({ row: t }) => /* @__PURE__ */ d(e, {
48
48
  tone: t.original.statusTone,
49
49
  children: t.original.statusLabel
50
50
  })
51
51
  },
52
52
  {
53
53
  accessorKey: "amount",
54
- header: () => /* @__PURE__ */ c("div", {
54
+ header: () => /* @__PURE__ */ d("div", {
55
55
  className: "ttw:text-right",
56
- children: O.columnAmount
56
+ children: F.columnAmount
57
57
  }),
58
- cell: ({ row: e }) => /* @__PURE__ */ c("div", {
58
+ cell: ({ row: e }) => /* @__PURE__ */ d("div", {
59
59
  className: "ttw:text-right ttw:tabular-nums",
60
60
  children: e.original.amount
61
61
  })
62
62
  },
63
63
  {
64
64
  accessorKey: "addedBy",
65
- header: O.columnAddedBy,
66
- cell: ({ row: e }) => /* @__PURE__ */ c(f, {
65
+ header: F.columnAddedBy,
66
+ cell: ({ row: e }) => /* @__PURE__ */ d(h, {
67
67
  name: e.original.addedBy,
68
- loadingLabel: O.loadingValue
68
+ loadingLabel: F.loadingValue
69
69
  })
70
+ },
71
+ {
72
+ id: "actions",
73
+ header: () => /* @__PURE__ */ d("div", {
74
+ className: "ttw:text-right",
75
+ children: F.columnActions
76
+ }),
77
+ cell: ({ row: e }) => e.original.canDecide ? /* @__PURE__ */ d("div", {
78
+ className: "ttw:flex ttw:justify-end",
79
+ children: /* @__PURE__ */ f(r, {
80
+ labels: { rowActions: F.rowActions },
81
+ children: [/* @__PURE__ */ d(i, {
82
+ disabled: e.original.isDecisionPending,
83
+ onClick: () => k(e.original.id),
84
+ children: F.approve
85
+ }), /* @__PURE__ */ d(i, {
86
+ variant: "destructive",
87
+ disabled: e.original.isDecisionPending,
88
+ onClick: () => A(e.original.id),
89
+ children: F.reject
90
+ })]
91
+ })
92
+ }) : null
70
93
  }
71
94
  ];
72
- return p ? /* @__PURE__ */ c(i, {
73
- title: O.accessRestrictedTitle,
74
- description: O.accessRestrictedDescription
75
- }) : l ? /* @__PURE__ */ c(i, {
76
- title: O.errorTitle,
77
- description: O.errorDescription,
78
- retryLabel: C ? O.errorRetry : void 0,
79
- onRetry: C
80
- }) : /* @__PURE__ */ c(t, {
81
- columns: k,
82
- data: n,
83
- isLoading: s,
84
- sorting: u,
85
- onSortingChange: d,
86
- pageSize: m,
87
- onPageSizeChange: h,
88
- pageSizeOptions: g,
89
- hasNextPage: _,
90
- hasPrevPage: v,
91
- onNextPage: y,
92
- onPrevPage: b,
93
- filterComponent: /* @__PURE__ */ c(o, {
94
- filters: S,
95
- labels: E
95
+ return v ? /* @__PURE__ */ d(s, {
96
+ title: F.accessRestrictedTitle,
97
+ description: F.accessRestrictedDescription
98
+ }) : _ ? /* @__PURE__ */ d(s, {
99
+ title: F.errorTitle,
100
+ description: F.errorDescription,
101
+ retryLabel: O ? F.errorRetry : void 0,
102
+ onRetry: O
103
+ }) : /* @__PURE__ */ d(n, {
104
+ columns: I,
105
+ data: a,
106
+ isLoading: g,
107
+ sorting: p,
108
+ onSortingChange: m,
109
+ pageSize: y,
110
+ onPageSizeChange: b,
111
+ pageSizeOptions: x,
112
+ hasNextPage: S,
113
+ hasPrevPage: C,
114
+ onNextPage: w,
115
+ onPrevPage: T,
116
+ rowContextMenu: (e) => e.canDecide ? /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d(t, {
117
+ disabled: e.isDecisionPending,
118
+ onClick: () => k(e.id),
119
+ children: F.approve
120
+ }), /* @__PURE__ */ d(t, {
121
+ variant: "destructive",
122
+ disabled: e.isDecisionPending,
123
+ onClick: () => A(e.id),
124
+ children: F.reject
125
+ })] }) : void 0,
126
+ filterComponent: /* @__PURE__ */ d(l, {
127
+ filters: D,
128
+ labels: N
96
129
  }),
97
- children: /* @__PURE__ */ c(r, {
98
- title: x.title,
99
- description: x.description
130
+ children: /* @__PURE__ */ d(o, {
131
+ title: E.title,
132
+ description: E.description
100
133
  })
101
134
  });
102
135
  }
103
136
  //#endregion
104
- export { p as ApprovalRequestsScreen, p as default };
137
+ export { g as ApprovalRequestsScreen, g as default };
@@ -0,0 +1,44 @@
1
+ import { ConfirmDialog as e, FieldRequirement as t, Label as n, Textarea as r } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
2
+ import { REJECT_APPROVAL_REQUEST_DIALOG_LABELS_EN as i } from "./index2.js";
3
+ import { useId as a } from "react";
4
+ import { jsx as o, jsxs as s } from "react/jsx-runtime";
5
+ //#region ../../libs/tesouro-embedded-components-react/approval-requests-widget/ui/dist/index5.js
6
+ function c({ open: c, reason: l, onReasonChange: u, onConfirm: d, onCancel: f, isPending: p, isConfirmDisabled: m, labels: h }) {
7
+ let g = {
8
+ ...i,
9
+ ...h
10
+ }, _ = a();
11
+ return /* @__PURE__ */ o(e, {
12
+ open: c,
13
+ onOpenChange: (e) => {
14
+ e || f();
15
+ },
16
+ title: g.title,
17
+ description: g.description,
18
+ onConfirm: d,
19
+ destructive: !0,
20
+ confirmDisabled: m,
21
+ loading: p,
22
+ labels: {
23
+ confirm: g.confirm,
24
+ cancel: g.cancel,
25
+ close: g.close
26
+ },
27
+ children: /* @__PURE__ */ s("div", {
28
+ className: "ttw:flex ttw:flex-col ttw:gap-2",
29
+ children: [/* @__PURE__ */ o(n, {
30
+ htmlFor: _,
31
+ requirement: t.Optional,
32
+ labels: { optionalNote: g.optionalNote },
33
+ children: g.reason
34
+ }), /* @__PURE__ */ o(r, {
35
+ id: _,
36
+ value: l,
37
+ onChange: (e) => u(e.target.value),
38
+ disabled: p
39
+ })]
40
+ })
41
+ });
42
+ }
43
+ //#endregion
44
+ export { c as RejectApprovalRequestDialog, c as default };
@@ -1,5 +1,5 @@
1
1
  //#region ../../libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js
2
- var e = "@tesouro/embedded-components-react", t = "0.9.41", n = "64c2e0da0918115a4ccbe3e956c8e197a3a4fc85", r = Object.freeze({
2
+ var e = "@tesouro/embedded-components-react", t = "0.9.43", n = "9668341fe5f04f3088135bcce7a51a576e5b6661", r = Object.freeze({
3
3
  library_name: e,
4
4
  library_version: t,
5
5
  library_sha: n