@tesouro/embedded-components-react 0.9.59 → 0.10.2

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 (68) hide show
  1. package/README.md +0 -13
  2. package/dist/{lib/AccountsQuickViewWidget.d.ts → experimental/QuickViewWidget.d.ts} +112 -15
  3. package/dist/experimental/QuickViewWidget.js +4 -0
  4. package/dist/experimental/index.d.ts +137 -96
  5. package/dist/experimental/index.js +4 -3
  6. package/dist/index.d.ts +3 -53
  7. package/dist/index.js +7 -9
  8. package/dist/libs/tesouro-embedded-components-react/quick-view-widget/accounts/data-access/dist/index2.js +20 -0
  9. package/dist/libs/tesouro-embedded-components-react/{accounts-quick-view-widget → quick-view-widget/accounts}/feature/dist/lib/AccountsQuickViewWidget/AccountsQuickViewWidgetFeature.js +15 -15
  10. package/dist/libs/tesouro-embedded-components-react/{accounts-quick-view-widget → quick-view-widget/accounts}/feature/dist/lib/AccountsQuickViewWidget/labels.js +1 -1
  11. package/dist/libs/tesouro-embedded-components-react/{accounts-quick-view-widget → quick-view-widget/accounts}/feature/dist/lib/AccountsQuickViewWidget/testIds.js +1 -1
  12. package/dist/libs/tesouro-embedded-components-react/{accounts-quick-view-widget → quick-view-widget/accounts}/feature/dist/lib/accountsBalanceSummary/summarizeAccountBalances.js +3 -3
  13. package/dist/libs/tesouro-embedded-components-react/{accounts-quick-view-widget → quick-view-widget/accounts}/feature/dist/lib/accountsBalanceSummary/useAccountsBalanceSummary.js +1 -1
  14. package/dist/libs/tesouro-embedded-components-react/quick-view-widget/accounts/feature/dist/lib/analytics/events.js +4 -0
  15. package/dist/libs/tesouro-embedded-components-react/{accounts-quick-view-widget → quick-view-widget/accounts}/ui/dist/index2.js +1 -1
  16. package/dist/libs/tesouro-embedded-components-react/{accounts-quick-view-widget → quick-view-widget/accounts}/ui/dist/index3.js +3 -3
  17. package/dist/libs/tesouro-embedded-components-react/quick-view-widget/feature/dist/index.js +3 -0
  18. package/dist/libs/tesouro-embedded-components-react/quick-view-widget/feature/dist/lib/QuickViewWidget/QuickViewWidget.js +56 -0
  19. package/dist/libs/tesouro-embedded-components-react/quick-view-widget/feature/dist/lib/QuickViewWidget/labels.js +10 -0
  20. package/dist/libs/tesouro-embedded-components-react/quick-view-widget/invoices/data-access/dist/index.js +1 -0
  21. package/dist/libs/tesouro-embedded-components-react/quick-view-widget/invoices/data-access/dist/index2.js +118 -0
  22. package/dist/libs/tesouro-embedded-components-react/quick-view-widget/invoices/feature/dist/index.js +3 -0
  23. package/dist/libs/tesouro-embedded-components-react/quick-view-widget/invoices/feature/dist/lib/InvoicesQuickViewWidget/InvoicesQuickViewWidgetFeature.js +106 -0
  24. package/dist/libs/tesouro-embedded-components-react/quick-view-widget/invoices/feature/dist/lib/InvoicesQuickViewWidget/labels.js +16 -0
  25. package/dist/libs/tesouro-embedded-components-react/quick-view-widget/invoices/feature/dist/lib/InvoicesQuickViewWidget/summarizeOpenInvoices.js +19 -0
  26. package/dist/libs/tesouro-embedded-components-react/quick-view-widget/invoices/feature/dist/lib/InvoicesQuickViewWidget/testIds.js +7 -0
  27. package/dist/libs/tesouro-embedded-components-react/quick-view-widget/invoices/feature/dist/lib/InvoicesQuickViewWidget/useOpenInvoicesSummary.js +25 -0
  28. package/dist/libs/tesouro-embedded-components-react/quick-view-widget/invoices/feature/dist/lib/analytics/events.js +4 -0
  29. package/dist/libs/tesouro-embedded-components-react/quick-view-widget/invoices/ui/dist/index.js +3 -0
  30. package/dist/libs/tesouro-embedded-components-react/quick-view-widget/invoices/ui/dist/index2.js +8 -0
  31. package/dist/libs/tesouro-embedded-components-react/quick-view-widget/invoices/ui/dist/index3.js +32 -0
  32. package/dist/libs/tesouro-embedded-components-react/quick-view-widget/shared/util/dist/lib/widgetName.js +3 -0
  33. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  34. package/dist/libs/tesouro-embedded-components-react/shared/quick-view/ui/dist/index3.js +38 -37
  35. package/dist/packages/shared-ui-shadcn/dist/index.js +3374 -3474
  36. package/package.json +1 -1
  37. package/dist/experimental/ApprovalRequests.d.ts +0 -706
  38. package/dist/experimental/ApprovalRequests.js +0 -2
  39. package/dist/lib/AccountsQuickViewWidget.js +0 -4
  40. package/dist/libs/tesouro-embedded-components-react/accounts-quick-view-widget/data-access/dist/index2.js +0 -20
  41. package/dist/libs/tesouro-embedded-components-react/accounts-quick-view-widget/feature/dist/lib/analytics/events.js +0 -3
  42. package/dist/libs/tesouro-embedded-components-react/approval-requests-widget/data-access/dist/index.js +0 -9
  43. package/dist/libs/tesouro-embedded-components-react/approval-requests-widget/data-access/dist/index2.js +0 -9
  44. package/dist/libs/tesouro-embedded-components-react/approval-requests-widget/data-access/dist/index3.js +0 -71
  45. package/dist/libs/tesouro-embedded-components-react/approval-requests-widget/data-access/dist/index4.js +0 -33
  46. package/dist/libs/tesouro-embedded-components-react/approval-requests-widget/data-access/dist/index5.js +0 -34
  47. package/dist/libs/tesouro-embedded-components-react/approval-requests-widget/data-access/dist/index6.js +0 -26
  48. package/dist/libs/tesouro-embedded-components-react/approval-requests-widget/data-access/dist/index7.js +0 -30
  49. package/dist/libs/tesouro-embedded-components-react/approval-requests-widget/feature/dist/index.js +0 -1
  50. package/dist/libs/tesouro-embedded-components-react/approval-requests-widget/feature/dist/lib/ApprovalRequestsWidget/ApprovalRequestsWidget.js +0 -89
  51. package/dist/libs/tesouro-embedded-components-react/approval-requests-widget/feature/dist/lib/ApprovalRequestsWidget/buildApprovalRequestRows.js +0 -44
  52. package/dist/libs/tesouro-embedded-components-react/approval-requests-widget/feature/dist/lib/ApprovalRequestsWidget/canDecideApprovalRequest.js +0 -7
  53. package/dist/libs/tesouro-embedded-components-react/approval-requests-widget/feature/dist/lib/ApprovalRequestsWidget/constants.js +0 -18
  54. package/dist/libs/tesouro-embedded-components-react/approval-requests-widget/feature/dist/lib/ApprovalRequestsWidget/labels.js +0 -28
  55. package/dist/libs/tesouro-embedded-components-react/approval-requests-widget/feature/dist/lib/ApprovalRequestsWidget/permissions.js +0 -8
  56. package/dist/libs/tesouro-embedded-components-react/approval-requests-widget/feature/dist/lib/ApprovalRequestsWidget/useApprovalRequestDecisions.js +0 -93
  57. package/dist/libs/tesouro-embedded-components-react/approval-requests-widget/feature/dist/lib/ApprovalRequestsWidget/useApprovalRequestNames.js +0 -65
  58. package/dist/libs/tesouro-embedded-components-react/approval-requests-widget/feature/dist/lib/ApprovalRequestsWidget/useApprovalRequestsFilters.js +0 -148
  59. package/dist/libs/tesouro-embedded-components-react/approval-requests-widget/feature/dist/lib/ApprovalRequestsWidget/useApprovalRequestsTable.js +0 -73
  60. package/dist/libs/tesouro-embedded-components-react/approval-requests-widget/feature/dist/lib/analytics/events.js +0 -3
  61. package/dist/libs/tesouro-embedded-components-react/approval-requests-widget/ui/dist/index.js +0 -5
  62. package/dist/libs/tesouro-embedded-components-react/approval-requests-widget/ui/dist/index2.js +0 -47
  63. package/dist/libs/tesouro-embedded-components-react/approval-requests-widget/ui/dist/index3.js +0 -142
  64. package/dist/libs/tesouro-embedded-components-react/approval-requests-widget/ui/dist/index4.js +0 -136
  65. package/dist/libs/tesouro-embedded-components-react/approval-requests-widget/ui/dist/index5.js +0 -43
  66. /package/dist/libs/tesouro-embedded-components-react/{accounts-quick-view-widget → quick-view-widget/accounts}/data-access/dist/index.js +0 -0
  67. /package/dist/libs/tesouro-embedded-components-react/{accounts-quick-view-widget → quick-view-widget/accounts}/feature/dist/index.js +0 -0
  68. /package/dist/libs/tesouro-embedded-components-react/{accounts-quick-view-widget → quick-view-widget/accounts}/ui/dist/index.js +0 -0
@@ -1,148 +0,0 @@
1
- "use client";
2
- "use client";
3
- "use client";
4
- "use client";
5
- import { useFilterPanel as e } from "../../../../../../../packages/shared-ui-shadcn/dist/index.js";
6
- import { useEmbedApi as t } from "../../../../../shared/data-access/dist/lib/EmbedApiContext.js";
7
- import "../../../../../shared/data-access/dist/index.js";
8
- import { useWidgetConfig as n } from "../../../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
9
- import "../../../../../shared/feature/dist/index.js";
10
- import { useEntityUsersSearchQuery as r } from "../../../../data-access/dist/index6.js";
11
- import "../../../../data-access/dist/index.js";
12
- import { APPROVAL_REQUEST_STATUSES as i } from "./constants.js";
13
- import { ApprovalRequestsFilterField as a } from "../../../../ui/dist/index3.js";
14
- import "../../../../ui/dist/index.js";
15
- import { useCallback as o, useEffect as s, useMemo as c, useState as l } from "react";
16
- import { addDays as u, format as d, formatISO as f, startOfDay as p } from "date-fns";
17
- // ../../libs/tesouro-embedded-components-react/approval-requests-widget/feature/dist/lib/ApprovalRequestsWidget/useApprovalRequestsFilters.js
18
- var m = {
19
- Status: "status",
20
- AddedBy: "addedBy",
21
- RequestedOn: "requestedOn"
22
- }, h = 300, g = "MMM d, yyyy", _ = {
23
- statuses: [],
24
- isOnlyMine: !1
25
- };
26
- function v(e) {
27
- return `${e.first_name ?? ""} ${e.last_name ?? ""}`.trim() || e.login;
28
- }
29
- function y({ labels: y, onFiltersChange: b }) {
30
- let [x, S] = l(_), [C, w] = l(""), [T, E] = l(""), D = e();
31
- s(() => {
32
- let e = setTimeout(() => E(C.trim()), h);
33
- return () => clearTimeout(e);
34
- }, [C]);
35
- let O = n().initResponse?.userId ?? void 0, [k, A] = l(O);
36
- O && O !== k && A(O);
37
- let { organizationId: j } = t(), [M, N] = l(j);
38
- j && j !== M && (N(j), M && S((e) => ({
39
- ...e,
40
- addedBy: void 0
41
- })));
42
- let P = r({
43
- search: T,
44
- enabled: D.activePanelId === a.AddedBy
45
- }), F = o((e) => {
46
- S((t) => ({
47
- ...t,
48
- ...e
49
- })), b();
50
- }, [b]), I = c(() => (P.data?.data ?? []).map((e) => ({
51
- value: e.id,
52
- label: v(e)
53
- })), [P.data?.data]), L = c(() => i.map((e) => ({
54
- value: e,
55
- label: y.status[e]
56
- })), [y.status]), R = c(() => {
57
- let e = {};
58
- x.statuses.length > 0 && (e.status__in = [...x.statuses]);
59
- let t = x.isOnlyMine ? k : x.addedBy?.value;
60
- if (t && (e.created_by = t), x.requestedFrom) {
61
- let t = p(x.requestedFrom), n = p(x.requestedTo ?? x.requestedFrom);
62
- e.created_at__gte = f(t), e.created_at__lt = f(u(n, 1));
63
- }
64
- return e;
65
- }, [x, k]), z = c(() => {
66
- let e = [], { filters: t } = y;
67
- if (x.statuses.length > 0) {
68
- let [n, ...r] = x.statuses.map((e) => y.status[e]);
69
- e.push({
70
- key: m.Status,
71
- label: t.statusChip(r.length === 0 ? n : t.moreSelected(n, r.length))
72
- });
73
- }
74
- if (x.addedBy && e.push({
75
- key: m.AddedBy,
76
- label: t.addedByChip(x.addedBy.label)
77
- }), x.requestedFrom) {
78
- let n = d(x.requestedFrom, g), r = x.requestedTo ? d(x.requestedTo, g) : n;
79
- e.push({
80
- key: m.RequestedOn,
81
- label: t.requestedOnChip(n === r ? n : t.dateRange(n, r))
82
- });
83
- }
84
- return e;
85
- }, [y, x]), B = o((e) => {
86
- switch (e) {
87
- case m.Status:
88
- F({ statuses: [] });
89
- break;
90
- case m.AddedBy:
91
- F({ addedBy: void 0 });
92
- break;
93
- case m.RequestedOn: F({
94
- requestedFrom: void 0,
95
- requestedTo: void 0
96
- });
97
- }
98
- }, [F]), V = o(() => {
99
- S(_), b();
100
- }, [b]), H = o((e) => {
101
- let t = I.find((t) => t.value === e);
102
- t && F({
103
- addedBy: t,
104
- isOnlyMine: !1
105
- });
106
- }, [F, I]), U = o((e) => F(e ? {
107
- isOnlyMine: !0,
108
- addedBy: void 0
109
- } : { isOnlyMine: !1 }), [F]), W = o(() => {
110
- D.closeMenu(), D.closePanel();
111
- }, [D]);
112
- return {
113
- filters: {
114
- isPopoverOpen: D.isMenuOpen || !!D.activePanelId,
115
- isMenuOpen: D.isMenuOpen,
116
- activePanel: D.activePanelId,
117
- onMenuToggle: D.toggleMenu,
118
- onPopoverClose: W,
119
- onFieldSelect: D.openPanel,
120
- activeFilterCount: z.length,
121
- chips: z,
122
- onRemoveChip: B,
123
- onClearAll: V,
124
- statusOptions: L,
125
- selectedStatuses: x.statuses,
126
- onStatusChange: (e) => F({ statuses: e }),
127
- userOptions: I,
128
- selectedUser: x.addedBy?.value ?? "",
129
- onUserChange: H,
130
- userSearchValue: C,
131
- onUserSearchChange: w,
132
- isUserLoading: P.isLoading,
133
- isUserError: P.isError,
134
- requestedFrom: x.requestedFrom,
135
- requestedTo: x.requestedTo,
136
- onRequestedRangeChange: ({ from: e, to: t }) => F({
137
- requestedFrom: e,
138
- requestedTo: t
139
- }),
140
- isOnlyMine: x.isOnlyMine,
141
- onOnlyMineChange: U,
142
- isOnlyMineDisabled: !k
143
- },
144
- query: R,
145
- isFiltering: z.length > 0 || x.isOnlyMine
146
- };
147
- }
148
- export { m as ApprovalRequestsFilterChipKey, y as useApprovalRequestsFilters };
@@ -1,73 +0,0 @@
1
- "use client";
2
- "use client";
3
- "use client";
4
- "use client";
5
- import { useEmbedApi as e } from "../../../../../shared/data-access/dist/lib/EmbedApiContext.js";
6
- import "../../../../../shared/data-access/dist/index.js";
7
- import { useWidgetConfig as t } from "../../../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
8
- import "../../../../../shared/feature/dist/index.js";
9
- import { useApprovalRequestsQuery as n } from "../../../../data-access/dist/index3.js";
10
- import "../../../../data-access/dist/index.js";
11
- import { PAGE_SIZE_OPTIONS as r } from "./constants.js";
12
- import { useApprovalRequestNames as i } from "./useApprovalRequestNames.js";
13
- import { buildApprovalRequestRows as a } from "./buildApprovalRequestRows.js";
14
- import { useApprovalRequestsFilters as o } from "./useApprovalRequestsFilters.js";
15
- import { useCallback as s, useMemo as c, useState as l } from "react";
16
- // ../../libs/tesouro-embedded-components-react/approval-requests-widget/feature/dist/lib/ApprovalRequestsWidget/useApprovalRequestsTable.js
17
- function u(e, t) {
18
- return e ? {
19
- title: t.filterEmptyTitle,
20
- description: t.filterEmptyDescription
21
- } : {
22
- title: t.emptyTitle,
23
- description: t.emptyDescription
24
- };
25
- }
26
- function d({ labels: d, enabled: f = !0, pendingRequestIds: p, areDecisionsPaused: m = !1 }) {
27
- let [h, g] = l(r[0]), [_, v] = l(), { organizationId: y } = e(), [b, x] = l(y);
28
- y && y !== b && (x(y), v(void 0));
29
- let S = s(() => v(void 0), []), { filters: C, query: w, isFiltering: T } = o({
30
- labels: d,
31
- onFiltersChange: S
32
- }), E = n({
33
- ...w,
34
- limit: h,
35
- pagination_token: _,
36
- enabled: f
37
- }), D = c(() => E.data?.data ?? [], [E.data]), O = i({ items: D }), k = t().initResponse?.userId ?? void 0, A = m || E.isPlaceholderData, j = c(() => a(D, O, d, {
38
- currentUserId: k,
39
- pendingRequestIds: p,
40
- areDecisionsPaused: A
41
- }), [
42
- D,
43
- O,
44
- d,
45
- k,
46
- p,
47
- A
48
- ]), M = E.isPlaceholderData ? void 0 : E.data, N = M?.next_pagination_token ?? void 0, P = M?.prev_pagination_token ?? void 0, F = s((e) => {
49
- g(e), v(void 0);
50
- }, []), I = s(() => {
51
- N && v(N);
52
- }, [N]), L = s(() => {
53
- P && v(P);
54
- }, [P]), { refetch: R } = E, z = s(() => {
55
- R();
56
- }, [R]);
57
- return {
58
- rows: j,
59
- isLoading: E.isLoading,
60
- isError: E.isError,
61
- pageSize: h,
62
- pageSizeOptions: r,
63
- onPageSizeChange: F,
64
- hasNextPage: !!N,
65
- hasPrevPage: !!P,
66
- onNextPage: I,
67
- onPrevPage: L,
68
- filters: C,
69
- emptyState: u(T, d),
70
- onRetry: z
71
- };
72
- }
73
- export { u as selectEmptyState, d as useApprovalRequestsTable };
@@ -1,3 +0,0 @@
1
- // ../../libs/tesouro-embedded-components-react/approval-requests-widget/feature/dist/lib/analytics/events.js
2
- var e = { Mounted: "approval_requests.mounted" }, t = "approval_requests";
3
- export { e as ApprovalRequestsWidgetAnalyticsEvent, t as WIDGET_NAME };
@@ -1,5 +0,0 @@
1
- import "./index2.js";
2
- import { ApprovalRequestsFilterField as e } from "./index3.js";
3
- import { ApprovalRequestsScreen as t } from "./index4.js";
4
- import { RejectApprovalRequestDialog as n } from "./index5.js";
5
- export { e as ApprovalRequestsFilterField, t as ApprovalRequestsScreen, n as RejectApprovalRequestDialog };
@@ -1,47 +0,0 @@
1
- import { FILTER_MENU_BUTTON_LABELS_EN as e, FILTER_TAG_LABELS_EN as t } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
2
- // ../../libs/tesouro-embedded-components-react/approval-requests-widget/ui/dist/index2.js
3
- var n = {
4
- fields: {
5
- status: "Status",
6
- addedBy: "Added by",
7
- requestedOn: "Requested on"
8
- },
9
- fieldMenuLabel: "Filter approval requests by",
10
- onlyMine: "Only my approvals",
11
- userSearchLabel: "Search users",
12
- userSearchPlaceholder: "Search users",
13
- userEmpty: "No users found",
14
- userLoading: "Loading users",
15
- userError: "Couldn't load users",
16
- clearAll: "Clear all",
17
- filterMenuButton: e,
18
- filterTag: t
19
- }, r = {
20
- columnInvoiceNumber: "Invoice #",
21
- columnVendor: "Vendor",
22
- columnIssueDate: "Issue date",
23
- columnDueDate: "Due date",
24
- columnStatus: "Status",
25
- columnAmount: "Amount",
26
- columnAddedBy: "Added by",
27
- columnActions: "Actions",
28
- rowActions: "Request actions",
29
- approve: "Approve request",
30
- reject: "Reject request",
31
- loadingValue: "Loading",
32
- errorTitle: "Couldn't load approval requests",
33
- errorDescription: "Try again.",
34
- errorRetry: "Try again",
35
- filterBar: n,
36
- accessRestrictedTitle: "Access restricted",
37
- accessRestrictedDescription: "You don't have permission to view approval requests."
38
- }, i = {
39
- title: "Reject this request?",
40
- description: "The bill is rejected and nobody else is asked to approve it.",
41
- reason: "Reason",
42
- optionalNote: "(optional)",
43
- confirm: "Reject request",
44
- cancel: "Cancel",
45
- close: "Close"
46
- };
47
- export { n as APPROVAL_REQUESTS_FILTER_BAR_LABELS_EN, r as APPROVAL_REQUESTS_SCREEN_LABELS_EN, i as REJECT_APPROVAL_REQUEST_DIALOG_LABELS_EN };
@@ -1,142 +0,0 @@
1
- import { DateRangePicker as e, FilterMenuButton as t, FilterTag as n, Input as r, Label as i, MultiSelectFilter as a, Popover as o, PopoverContent as s, PopoverTrigger as c, RadioGroup as l, RadioGroupItem as u, Switch as d, TableToolbar as f, cn as p } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
2
- import { APPROVAL_REQUESTS_FILTER_BAR_LABELS_EN as m } from "./index2.js";
3
- import { useId as h } from "react";
4
- import { Fragment as g, jsx as _, jsxs as v } from "react/jsx-runtime";
5
- import { ListFilter as y } from "lucide-react";
6
- // ../../libs/tesouro-embedded-components-react/approval-requests-widget/ui/dist/index3.js
7
- var b = {
8
- Status: "status",
9
- AddedBy: "addedBy",
10
- RequestedOn: "requestedOn"
11
- }, x = [
12
- b.Status,
13
- b.AddedBy,
14
- b.RequestedOn
15
- ], S = {
16
- status: "ttw:w-56",
17
- addedBy: "ttw:w-64",
18
- requestedOn: "ttw:w-auto"
19
- }, C = "ttw:flex ttw:w-full ttw:cursor-pointer ttw:items-center ttw:gap-2 ttw:rounded-md ttw:px-2 ttw:py-1.5 ttw:text-xs ttw:font-medium ttw:transition-colors ttw:hover:bg-accent";
20
- function w({ filters: w, labels: T }) {
21
- let E = m, D = {
22
- ...E,
23
- ...T,
24
- fields: {
25
- ...E.fields,
26
- ...T?.fields
27
- },
28
- filterMenuButton: {
29
- ...E.filterMenuButton,
30
- ...T?.filterMenuButton
31
- },
32
- filterTag: {
33
- ...E.filterTag,
34
- ...T?.filterTag
35
- }
36
- }, O = h(), { activePanel: k } = w, A = k && S[k] || "ttw:w-52";
37
- return /* @__PURE__ */ _(f, {
38
- className: "ttw:px-4",
39
- filters: /* @__PURE__ */ v("div", {
40
- className: "ttw:flex ttw:h-8 ttw:items-center ttw:gap-2",
41
- children: [/* @__PURE__ */ _(d, {
42
- id: O,
43
- checked: w.isOnlyMine,
44
- onCheckedChange: w.onOnlyMineChange,
45
- disabled: w.isOnlyMineDisabled
46
- }), /* @__PURE__ */ _(i, {
47
- htmlFor: O,
48
- className: "ttw:text-sm",
49
- children: D.onlyMine
50
- })]
51
- }),
52
- filterButton: /* @__PURE__ */ v(o, {
53
- open: w.isPopoverOpen,
54
- onOpenChange: (e) => {
55
- e || w.onPopoverClose();
56
- },
57
- children: [/* @__PURE__ */ _(c, {
58
- asChild: !0,
59
- children: /* @__PURE__ */ _(t, {
60
- activeCount: w.activeFilterCount,
61
- onClick: (e) => {
62
- k && e.preventDefault(), w.onMenuToggle();
63
- },
64
- labels: D.filterMenuButton
65
- })
66
- }), /* @__PURE__ */ v(s, {
67
- align: "start",
68
- className: p("ttw:p-0", A),
69
- children: [
70
- w.isMenuOpen && /* @__PURE__ */ _("div", {
71
- className: "ttw:p-1",
72
- role: "menu",
73
- "aria-label": D.fieldMenuLabel,
74
- children: x.map((e) => /* @__PURE__ */ v("button", {
75
- type: "button",
76
- role: "menuitem",
77
- className: C,
78
- onClick: () => w.onFieldSelect(e),
79
- children: [/* @__PURE__ */ _(y, {
80
- className: "ttw:size-4 ttw:shrink-0 ttw:text-muted-foreground",
81
- "aria-hidden": !0
82
- }), D.fields[e]]
83
- }, e))
84
- }),
85
- k === b.Status && /* @__PURE__ */ _(a, {
86
- options: [...w.statusOptions],
87
- selectedValues: [...w.selectedStatuses],
88
- onSelectionChange: w.onStatusChange
89
- }),
90
- k === b.AddedBy && /* @__PURE__ */ v("div", {
91
- className: "ttw:flex ttw:flex-col ttw:gap-2 ttw:p-3",
92
- children: [/* @__PURE__ */ _(r, {
93
- type: "search",
94
- className: "ttw:h-8 ttw:text-xs",
95
- "aria-label": D.userSearchLabel,
96
- placeholder: D.userSearchPlaceholder,
97
- value: w.userSearchValue,
98
- onChange: (e) => w.onUserSearchChange(e.target.value)
99
- }), w.isUserLoading ? /* @__PURE__ */ _("p", {
100
- className: "ttw:px-1 ttw:text-xs ttw:text-muted-foreground",
101
- children: D.userLoading
102
- }) : w.isUserError ? /* @__PURE__ */ _("p", {
103
- className: "ttw:px-1 ttw:text-xs ttw:text-destructive",
104
- children: D.userError
105
- }) : w.userOptions.length === 0 ? /* @__PURE__ */ _("p", {
106
- className: "ttw:px-1 ttw:text-xs ttw:text-muted-foreground",
107
- children: D.userEmpty
108
- }) : /* @__PURE__ */ _(l, {
109
- value: w.selectedUser,
110
- onValueChange: w.onUserChange,
111
- "aria-label": D.fields.addedBy,
112
- className: "ttw:flex ttw:max-h-64 ttw:flex-col ttw:gap-1 ttw:overflow-y-auto",
113
- children: w.userOptions.map((e) => /* @__PURE__ */ v("label", {
114
- className: "ttw:flex ttw:cursor-pointer ttw:items-center ttw:gap-2 ttw:rounded-md ttw:px-2 ttw:py-1.5 ttw:hover:bg-accent",
115
- children: [/* @__PURE__ */ _(u, { value: e.value }), /* @__PURE__ */ _("span", {
116
- className: "ttw:text-xs ttw:font-medium",
117
- children: e.label
118
- })]
119
- }, e.value))
120
- })]
121
- }),
122
- k === b.RequestedOn && /* @__PURE__ */ _(e, {
123
- from: w.requestedFrom,
124
- to: w.requestedTo,
125
- onRangeChange: w.onRequestedRangeChange
126
- })
127
- ]
128
- })]
129
- }),
130
- tags: /* @__PURE__ */ v(g, { children: [w.chips.map((e) => /* @__PURE__ */ _(n, {
131
- label: e.label,
132
- labels: D.filterTag,
133
- onDismiss: () => w.onRemoveChip(e.key)
134
- }, e.key)), w.chips.length > 0 && /* @__PURE__ */ _("button", {
135
- type: "button",
136
- className: "ttw:cursor-pointer ttw:whitespace-nowrap ttw:text-xs ttw:text-muted-foreground ttw:transition-colors ttw:hover:text-foreground",
137
- onClick: w.onClearAll,
138
- children: D.clearAll
139
- })] })
140
- });
141
- }
142
- export { w as ApprovalRequestsFilterBar, w as default, b as ApprovalRequestsFilterField };
@@ -1,136 +0,0 @@
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
- import "../../../shared/ui/dist/index.js";
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
- // ../../libs/tesouro-embedded-components-react/approval-requests-widget/ui/dist/index4.js
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
- className: "ttw:h-4 ttw:w-32",
13
- "aria-hidden": !0
14
- }), /* @__PURE__ */ d("span", {
15
- className: "ttw:sr-only",
16
- children: t
17
- })] }) : /* @__PURE__ */ d(u, { children: e });
18
- }
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
- {
25
- accessorKey: "invoiceNumber",
26
- header: F.columnInvoiceNumber
27
- },
28
- {
29
- accessorKey: "vendor",
30
- header: F.columnVendor,
31
- cell: ({ row: e }) => /* @__PURE__ */ d(h, {
32
- name: e.original.vendor,
33
- loadingLabel: F.loadingValue
34
- })
35
- },
36
- {
37
- accessorKey: "issueDate",
38
- header: F.columnIssueDate
39
- },
40
- {
41
- accessorKey: "dueDate",
42
- header: F.columnDueDate
43
- },
44
- {
45
- accessorKey: "statusLabel",
46
- header: F.columnStatus,
47
- cell: ({ row: t }) => /* @__PURE__ */ d(e, {
48
- tone: t.original.statusTone,
49
- children: t.original.statusLabel
50
- })
51
- },
52
- {
53
- accessorKey: "amount",
54
- header: () => /* @__PURE__ */ d("div", {
55
- className: "ttw:text-right",
56
- children: F.columnAmount
57
- }),
58
- cell: ({ row: e }) => /* @__PURE__ */ d("div", {
59
- className: "ttw:text-right ttw:tabular-nums",
60
- children: e.original.amount
61
- })
62
- },
63
- {
64
- accessorKey: "addedBy",
65
- header: F.columnAddedBy,
66
- cell: ({ row: e }) => /* @__PURE__ */ d(h, {
67
- name: e.original.addedBy,
68
- loadingLabel: F.loadingValue
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
93
- }
94
- ];
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
129
- }),
130
- children: /* @__PURE__ */ d(o, {
131
- title: E.title,
132
- description: E.description
133
- })
134
- });
135
- }
136
- export { g as ApprovalRequestsScreen, g as default };
@@ -1,43 +0,0 @@
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
- // ../../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
- export { c as RejectApprovalRequestDialog, c as default };