@tesouro/embedded-components-react 0.11.70 → 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.
- package/README.md +1 -0
- package/dist/index.css +41 -192
- package/dist/index.d.ts +93 -73
- package/dist/lib/SettingsWidget.d.ts +5 -1
- package/dist/lib/WidgetSuite.d.ts +22 -2
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/feature/dist/index3.js +8 -7
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/feature/dist/index4.js +4 -1
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/feature/dist/index6.js +196 -131
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/ui/dist/index.js +4 -4
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/ui/dist/index3.js +11 -1
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/ui/dist/index4.js +5 -3
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/ui/dist/index5.js +38 -32
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/ui/dist/index6.js +103 -75
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/ui/dist/index7.js +140 -168
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/ui/dist/index8.js +97 -87
- package/dist/libs/tesouro-embedded-components-react/settings-widget/chart-of-accounts/feature/dist/index7.js +11 -7
- package/dist/libs/tesouro-embedded-components-react/settings-widget/chart-of-accounts/feature/dist/index8.js +0 -1
- package/dist/libs/tesouro-embedded-components-react/settings-widget/chart-of-accounts/ui/dist/index2.js +3 -1
- package/dist/libs/tesouro-embedded-components-react/settings-widget/chart-of-accounts/ui/dist/index3.js +134 -177
- package/dist/libs/tesouro-embedded-components-react/settings-widget/chart-of-accounts/ui/dist/index4.js +110 -176
- package/dist/libs/tesouro-embedded-components-react/settings-widget/chart-of-accounts/ui/dist/index5.js +28 -38
- package/dist/libs/tesouro-embedded-components-react/settings-widget/feature/dist/lib/ExpenseSettingsTabs/ExpenseSettingsTabs.js +13 -10
- package/dist/libs/tesouro-embedded-components-react/settings-widget/feature/dist/lib/SettingsWidget/SettingsWidget.js +28 -24
- package/dist/libs/tesouro-embedded-components-react/settings-widget/help/ui/shadcn/dist/index3.js +35 -31
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/feature/dist/index10.js +2 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/feature/dist/index7.js +1 -5
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/feature/dist/index8.js +3 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index11.js +2 -1
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index12.js +22 -36
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index16.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index17.js +54 -60
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index20.js +75 -60
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index3.js +42 -27
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index6.js +89 -82
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index9.js +39 -38
- package/dist/libs/tesouro-embedded-components-react/settings-widget/profile/feature/dist/index4.js +32 -32
- package/dist/libs/tesouro-embedded-components-react/settings-widget/profile/ui/dist/index2.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/settings-widget/profile/ui/dist/index3.js +56 -71
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/data-access/dist/index10.js +3 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/feature/dist/index12.js +86 -66
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/feature/dist/index13.js +51 -51
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/feature/dist/index15.js +146 -132
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/feature/dist/index17.js +95 -99
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/feature/dist/index3.js +1 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/feature/dist/index4.js +8 -27
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/feature/dist/index5.js +69 -72
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/feature/dist/index6.js +51 -51
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index.js +9 -11
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index10.js +83 -298
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index11.js +13 -13
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index12.js +122 -75
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index13.js +41 -15
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index14.js +7 -131
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index15.js +147 -48
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index16.js +240 -11
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index17.js +15 -173
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index2.js +38 -10
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index3.js +5 -46
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index4.js +52 -45
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index5.js +101 -25
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index6.js +40 -98
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index7.js +415 -40
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index8.js +261 -332
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index9.js +15 -8
- package/dist/libs/tesouro-embedded-components-react/settings-widget/ui/dist/lib/SettingsWidgetUi/SettingsWidgetUi.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/feature/dist/lib/ApprovalPoliciesSettings.js +9 -8
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/feature/dist/lib/useApprovalPolicyRules.js +136 -122
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index.js +9 -8
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index11.js +16 -17
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index12.js +99 -100
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index16.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index17.js +8 -8
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index18.js +10 -55
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index19.js +34 -8
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index20.js +8 -84
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index21.js +86 -0
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index3.js +13 -13
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index5.js +17 -18
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index7.js +33 -42
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/index.js +24 -24
- package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/lib/FileDropZone/FileDropZone.js +62 -0
- package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/lib/LoadingRegion/LoadingRegion.js +1 -0
- package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/lib/WidgetSuite/WidgetSuiteProvider.js +12 -4
- package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/lib/WidgetSuite/labels.js +9 -0
- package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/lib/WidgetSuite/sections/BillPaySection.js +12 -9
- package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/lib/WidgetSuite/sections/CardsSection.js +25 -23
- package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/lib/WidgetSuite/sections/DashboardQuickActions.js +74 -0
- package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/lib/WidgetSuite/sections/DashboardSection.js +20 -16
- package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/lib/WidgetSuite/sections/InvoicingSection.js +15 -9
- package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/lib/WidgetSuite/sections/SettingsSection.js +15 -8
- package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/lib/WidgetSuite/sections/TransfersSection.js +23 -21
- package/dist/packages/shared-ui-shadcn/dist/index.js +2336 -2274
- package/package.json +1 -1
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index18.js +0 -291
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index19.js +0 -22
- package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/lib/avatarSwatch.js +0 -26
|
@@ -1,88 +1,116 @@
|
|
|
1
|
-
import { Badge as e, Button as t } from "../../../../../../packages/shared-ui-shadcn/dist/index.js";
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { Badge as e, Button as t, Tooltip as n, TooltipContent as r, TooltipProvider as i, TooltipTrigger as a } from "../../../../../../packages/shared-ui-shadcn/dist/index.js";
|
|
2
|
+
import { PolicyCardFrame as o } from "../../../../shared/approval-policy/ui/dist/index17.js";
|
|
3
|
+
import "../../../../shared/approval-policy/ui/dist/index.js";
|
|
4
|
+
import { AmountConditionType as s, ApprovalOutcomeType as c } from "./index2.js";
|
|
5
|
+
import { ApprovalRuleCardLabels as l } from "./index3.js";
|
|
6
|
+
import { formatAmount as u } from "./index4.js";
|
|
7
|
+
import { Fragment as d, jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
8
|
+
import { Trash2 as m } from "lucide-react";
|
|
7
9
|
// ../../libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/ui/dist/index6.js
|
|
8
|
-
function
|
|
9
|
-
let i = (e) => /* @__PURE__ */
|
|
10
|
+
function h({ conditionType: e, minAmount: t, maxAmount: n, labels: r }) {
|
|
11
|
+
let i = (e) => /* @__PURE__ */ f("strong", { children: u(e) });
|
|
10
12
|
switch (e) {
|
|
11
|
-
case
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
case s.LessThan: return /* @__PURE__ */ p(d, { children: [
|
|
14
|
+
r.For,
|
|
15
|
+
" ",
|
|
16
|
+
/* @__PURE__ */ f("strong", { children: r.Expenses }),
|
|
17
|
+
" ",
|
|
18
|
+
r.LessThan,
|
|
19
|
+
" ",
|
|
20
|
+
i(n ?? 0)
|
|
16
21
|
] });
|
|
17
|
-
case
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
"
|
|
22
|
+
case s.InRange: return /* @__PURE__ */ p(d, { children: [
|
|
23
|
+
r.For,
|
|
24
|
+
" ",
|
|
25
|
+
/* @__PURE__ */ f("strong", { children: r.Expenses }),
|
|
26
|
+
" ",
|
|
27
|
+
r.GreaterThanOrEqual,
|
|
21
28
|
" ",
|
|
22
29
|
i(t ?? 0),
|
|
23
|
-
"
|
|
24
|
-
|
|
30
|
+
" ",
|
|
31
|
+
r.AndLessThan,
|
|
32
|
+
" ",
|
|
33
|
+
i(n ?? 0)
|
|
25
34
|
] });
|
|
26
|
-
case
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
"
|
|
35
|
+
case s.GreaterThanOrEqual: return /* @__PURE__ */ p(d, { children: [
|
|
36
|
+
r.For,
|
|
37
|
+
" ",
|
|
38
|
+
/* @__PURE__ */ f("strong", { children: r.Expenses }),
|
|
39
|
+
" ",
|
|
40
|
+
r.GreaterThanOrEqual,
|
|
30
41
|
" ",
|
|
31
42
|
i(t ?? 0)
|
|
32
43
|
] });
|
|
33
|
-
default: return /* @__PURE__ */
|
|
44
|
+
default: return /* @__PURE__ */ p(d, { children: [
|
|
45
|
+
r.For,
|
|
46
|
+
" ",
|
|
47
|
+
r.All,
|
|
48
|
+
" ",
|
|
49
|
+
/* @__PURE__ */ f("strong", { children: r.Expenses })
|
|
50
|
+
] });
|
|
34
51
|
}
|
|
35
52
|
}
|
|
36
|
-
var
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
"
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
53
|
+
var g = ({ rule: s, labels: u, onEdit: d, onDelete: g, disabled: _, testIds: v }) => {
|
|
54
|
+
let y = {
|
|
55
|
+
...l,
|
|
56
|
+
...u
|
|
57
|
+
};
|
|
58
|
+
return /* @__PURE__ */ p(o, {
|
|
59
|
+
"data-testid": v?.root,
|
|
60
|
+
children: [/* @__PURE__ */ p("div", {
|
|
61
|
+
className: "ttw:flex ttw:items-center ttw:justify-between",
|
|
62
|
+
children: [/* @__PURE__ */ f("span", {
|
|
63
|
+
className: "ttw:text-sm",
|
|
64
|
+
children: /* @__PURE__ */ f(h, {
|
|
65
|
+
labels: y,
|
|
66
|
+
conditionType: s.conditionType,
|
|
67
|
+
minAmount: s.minAmount,
|
|
68
|
+
maxAmount: s.maxAmount
|
|
69
|
+
})
|
|
70
|
+
}), /* @__PURE__ */ p("div", {
|
|
71
|
+
className: "ttw:flex ttw:gap-1",
|
|
72
|
+
children: [/* @__PURE__ */ f(i, { children: /* @__PURE__ */ p(n, { children: [/* @__PURE__ */ f(a, {
|
|
73
|
+
asChild: !0,
|
|
74
|
+
children: /* @__PURE__ */ f(t, {
|
|
75
|
+
variant: "ghost",
|
|
76
|
+
size: "icon-sm",
|
|
77
|
+
onClick: () => g(s.id),
|
|
78
|
+
"aria-label": y.DeleteRuleAriaLabel,
|
|
79
|
+
className: "ttw:text-destructive ttw:hover:text-destructive",
|
|
80
|
+
disabled: _,
|
|
81
|
+
children: /* @__PURE__ */ f(m, {})
|
|
82
|
+
})
|
|
83
|
+
}), /* @__PURE__ */ f(r, { children: y.DeleteRuleAriaLabel })] }) }), /* @__PURE__ */ f(t, {
|
|
84
|
+
variant: "ghost",
|
|
85
|
+
onClick: () => d(s.id),
|
|
86
|
+
className: "ttw:text-muted-foreground ttw:hover:text-foreground",
|
|
87
|
+
disabled: _,
|
|
88
|
+
children: y.EditRuleAriaLabel
|
|
89
|
+
})]
|
|
90
|
+
})]
|
|
91
|
+
}), s.outcome === c.AutoApprove ? /* @__PURE__ */ f(e, {
|
|
92
|
+
tone: "success",
|
|
93
|
+
className: "ttw:self-start",
|
|
94
|
+
children: y.AutoApprove
|
|
95
|
+
}) : /* @__PURE__ */ p("div", {
|
|
96
|
+
className: "ttw:flex ttw:items-center ttw:gap-1",
|
|
97
|
+
children: [/* @__PURE__ */ f("span", {
|
|
98
|
+
className: "ttw:text-sm ttw:text-muted-foreground",
|
|
99
|
+
children: y.RequireApprovalFrom
|
|
100
|
+
}), /* @__PURE__ */ f("div", {
|
|
101
|
+
className: "ttw:flex ttw:flex-wrap ttw:items-center ttw:gap-1",
|
|
102
|
+
children: s.approvers.map((t, n) => /* @__PURE__ */ p("div", {
|
|
103
|
+
className: "ttw:flex ttw:items-center ttw:gap-1",
|
|
104
|
+
children: [n > 0 ? /* @__PURE__ */ f("span", {
|
|
105
|
+
className: "ttw:text-sm ttw:text-muted-foreground",
|
|
106
|
+
children: y.ApproverSeparator
|
|
107
|
+
}) : null, /* @__PURE__ */ f(e, {
|
|
108
|
+
variant: "secondary",
|
|
109
|
+
children: t.label
|
|
110
|
+
})]
|
|
111
|
+
}, t.id))
|
|
66
112
|
})]
|
|
67
113
|
})]
|
|
68
|
-
})
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}) : /* @__PURE__ */ c("div", {
|
|
72
|
-
className: "ttw:flex ttw:items-center ttw:gap-1",
|
|
73
|
-
children: [/* @__PURE__ */ s("span", {
|
|
74
|
-
className: "ttw:text-sm ttw:text-muted-foreground",
|
|
75
|
-
children: i.RequireApprovalFrom
|
|
76
|
-
}), /* @__PURE__ */ s("div", {
|
|
77
|
-
className: "ttw:flex ttw:flex-wrap ttw:items-center ttw:gap-1",
|
|
78
|
-
children: n.approvers.map((t, n) => /* @__PURE__ */ c("div", {
|
|
79
|
-
className: "ttw:flex ttw:items-center ttw:gap-1",
|
|
80
|
-
children: [n > 0 ? /* @__PURE__ */ s("span", {
|
|
81
|
-
className: "ttw:text-sm ttw:text-muted-foreground",
|
|
82
|
-
children: "or"
|
|
83
|
-
}) : null, /* @__PURE__ */ s(e, { children: t.label })]
|
|
84
|
-
}, t.id))
|
|
85
|
-
})]
|
|
86
|
-
})]
|
|
87
|
-
});
|
|
88
|
-
export { p as ApprovalRuleCard };
|
|
114
|
+
});
|
|
115
|
+
};
|
|
116
|
+
export { g as ApprovalRuleCard };
|
|
@@ -1,206 +1,178 @@
|
|
|
1
|
-
import { Button as e, Combobox as t,
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { Button as e, Combobox as t, FieldError as n, Label as r, RadioGroup as i, RadioGroupItem as a } from "../../../../../../packages/shared-ui-shadcn/dist/index.js";
|
|
2
|
+
import { AmountConditionBuilder as o } from "../../../../shared/approval-policy/ui/dist/index3.js";
|
|
3
|
+
import "../../../../shared/approval-policy/ui/dist/index.js";
|
|
4
|
+
import { ApprovalOutcomeType as s } from "./index2.js";
|
|
5
|
+
import { ApprovalRuleFormLabels as c } from "./index3.js";
|
|
6
|
+
import { useEffect as l, useId as u, useRef as d, useState as f } from "react";
|
|
7
|
+
import { jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
8
|
+
import { FilePenLine as h, RefreshCw as g, Trash2 as _ } from "lucide-react";
|
|
7
9
|
// ../../libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/ui/dist/index7.js
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
children: "$"
|
|
15
|
-
}),
|
|
16
|
-
/* @__PURE__ */ f(n, {
|
|
17
|
-
value: e,
|
|
18
|
-
onChange: (e) => t(e.target.value),
|
|
19
|
-
onBlur: a,
|
|
20
|
-
"aria-invalid": !!c,
|
|
21
|
-
placeholder: s,
|
|
22
|
-
inputMode: "decimal",
|
|
23
|
-
disabled: l,
|
|
24
|
-
"data-testid": u,
|
|
25
|
-
className: `ttw:pl-6${c ? " ttw:pr-8" : ""}`
|
|
26
|
-
}),
|
|
27
|
-
c ? /* @__PURE__ */ p(r, { children: [/* @__PURE__ */ f(o, {
|
|
28
|
-
asChild: !0,
|
|
29
|
-
children: /* @__PURE__ */ f(m, { className: "ttw:absolute ttw:right-2.5 ttw:top-1/2 ttw:-translate-y-1/2 ttw:size-4 ttw:text-destructive ttw:cursor-default" })
|
|
30
|
-
}), /* @__PURE__ */ f(i, {
|
|
31
|
-
side: "top",
|
|
32
|
-
children: c
|
|
33
|
-
})] }) : null
|
|
34
|
-
]
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
var y = ({ values: n, approverOptions: r, validationErrors: i, isEditing: o, disabled: m, isSaveDisabled: y, onValuesChange: b, onSave: x, onCancel: S, onDelete: C, testIds: w }) => {
|
|
38
|
-
let T = (e) => b({
|
|
39
|
-
...n,
|
|
10
|
+
var v = ({ values: v, approverOptions: y, validationErrors: b, labels: x, isEditing: S, disabled: C, onValuesChange: w, onSave: T, onCancel: E, onDelete: D, testIds: O }) => {
|
|
11
|
+
let k = {
|
|
12
|
+
...c,
|
|
13
|
+
...x
|
|
14
|
+
}, A = (e) => w({
|
|
15
|
+
...v,
|
|
40
16
|
...e
|
|
41
|
-
}),
|
|
42
|
-
|
|
43
|
-
[
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}, M = () => {
|
|
49
|
-
k(!0), !(i.minAmount || i.maxAmount || i.approvers) && x();
|
|
50
|
-
}, N = u(), P = r.map((e) => ({
|
|
17
|
+
}), j = d(null), [M, N] = f(0);
|
|
18
|
+
l(() => {
|
|
19
|
+
M && j.current?.querySelector("[aria-invalid=\"true\"]")?.focus();
|
|
20
|
+
}, [M]);
|
|
21
|
+
let P = () => {
|
|
22
|
+
T(), N((e) => e + 1);
|
|
23
|
+
}, F = u(), I = u(), L = u(), R = y.map((e) => ({
|
|
51
24
|
value: e.id,
|
|
52
25
|
label: e.label
|
|
53
|
-
})),
|
|
26
|
+
})), z = new Set(R.map((e) => e.value)), B = [...R, ...v.approvers.filter((e) => !z.has(e.id)).map((e) => ({
|
|
54
27
|
value: e.id,
|
|
55
28
|
label: e.label
|
|
56
|
-
}))],
|
|
57
|
-
return /* @__PURE__ */
|
|
58
|
-
|
|
29
|
+
}))], V = new Map([...v.approvers.map((e) => [e.id, e]), ...y.map((e) => [e.id, e])]);
|
|
30
|
+
return /* @__PURE__ */ m("div", {
|
|
31
|
+
ref: j,
|
|
32
|
+
"data-testid": O?.root,
|
|
59
33
|
className: "ttw:border ttw:border-border ttw:rounded-lg ttw:p-5 ttw:flex ttw:flex-col ttw:gap-4",
|
|
60
34
|
children: [
|
|
61
|
-
/* @__PURE__ */
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
onBlur: () => A("minAmount"),
|
|
78
|
-
placeholder: l.MinimumPlaceholder,
|
|
79
|
-
error: j.minAmount,
|
|
80
|
-
disabled: m,
|
|
81
|
-
testId: w?.minAmountInput
|
|
82
|
-
}),
|
|
83
|
-
/* @__PURE__ */ f(s, {
|
|
84
|
-
variant: "body2",
|
|
85
|
-
children: l.AndLessThan
|
|
86
|
-
}),
|
|
87
|
-
/* @__PURE__ */ f(v, {
|
|
88
|
-
value: n.maxAmount,
|
|
89
|
-
onChange: (e) => T({ maxAmount: e }),
|
|
90
|
-
onBlur: () => A("maxAmount"),
|
|
91
|
-
placeholder: l.MaximumPlaceholder,
|
|
92
|
-
error: j.maxAmount,
|
|
93
|
-
disabled: m,
|
|
94
|
-
testId: w?.maxAmountInput
|
|
95
|
-
})
|
|
96
|
-
]
|
|
97
|
-
}) }),
|
|
98
|
-
/* @__PURE__ */ p("div", {
|
|
99
|
-
className: "ttw:flex ttw:flex-col ttw:gap-2",
|
|
100
|
-
children: [/* @__PURE__ */ p("label", {
|
|
101
|
-
className: "ttw:flex ttw:items-center ttw:gap-2 ttw:cursor-pointer",
|
|
102
|
-
children: [
|
|
103
|
-
/* @__PURE__ */ f("input", {
|
|
104
|
-
type: "radio",
|
|
105
|
-
name: N,
|
|
106
|
-
value: c.AutoApprove,
|
|
107
|
-
checked: n.outcome === c.AutoApprove,
|
|
108
|
-
onChange: () => T({
|
|
109
|
-
outcome: c.AutoApprove,
|
|
110
|
-
approvers: []
|
|
111
|
-
}),
|
|
112
|
-
disabled: m,
|
|
113
|
-
className: "ttw:accent-primary"
|
|
114
|
-
}),
|
|
115
|
-
/* @__PURE__ */ f(g, { className: "ttw:text-green-600 ttw:size-4 ttw:shrink-0" }),
|
|
116
|
-
/* @__PURE__ */ f("span", {
|
|
117
|
-
className: "ttw:text-sm ttw:font-medium ttw:text-green-700",
|
|
118
|
-
children: l.AutoApprove
|
|
119
|
-
})
|
|
120
|
-
]
|
|
121
|
-
}), /* @__PURE__ */ p("label", {
|
|
122
|
-
className: "ttw:flex ttw:items-start ttw:gap-2 ttw:cursor-pointer",
|
|
35
|
+
/* @__PURE__ */ p(o, {
|
|
36
|
+
value: {
|
|
37
|
+
lower: v.minAmount,
|
|
38
|
+
upper: v.maxAmount
|
|
39
|
+
},
|
|
40
|
+
onChange: ({ lower: e, upper: t }) => A({
|
|
41
|
+
minAmount: e,
|
|
42
|
+
maxAmount: t
|
|
43
|
+
}),
|
|
44
|
+
errors: {
|
|
45
|
+
lower: b.minAmount,
|
|
46
|
+
upper: b.maxAmount
|
|
47
|
+
},
|
|
48
|
+
disabled: C,
|
|
49
|
+
lead: /* @__PURE__ */ m("span", {
|
|
50
|
+
className: "ttw:font-normal",
|
|
123
51
|
children: [
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
onChange: () => T({ outcome: c.RequireApproval }),
|
|
130
|
-
disabled: m,
|
|
131
|
-
className: "ttw:accent-primary ttw:mt-0.5"
|
|
132
|
-
}),
|
|
133
|
-
/* @__PURE__ */ f(h, { className: "ttw:size-4 ttw:shrink-0 ttw:mt-0.5" }),
|
|
134
|
-
/* @__PURE__ */ p("div", { children: [
|
|
135
|
-
/* @__PURE__ */ f("span", {
|
|
136
|
-
className: "ttw:text-sm ttw:font-medium",
|
|
137
|
-
children: l.RequireApproval
|
|
138
|
-
}),
|
|
139
|
-
/* @__PURE__ */ f("br", {}),
|
|
140
|
-
/* @__PURE__ */ f("span", {
|
|
141
|
-
className: "ttw:text-xs ttw:text-muted-foreground",
|
|
142
|
-
children: l.RequireApprovalCaption
|
|
143
|
-
})
|
|
144
|
-
] })
|
|
52
|
+
k.ForExpenses,
|
|
53
|
+
" ",
|
|
54
|
+
/* @__PURE__ */ p("strong", { children: k.ExpensesBold }),
|
|
55
|
+
" ",
|
|
56
|
+
k.GreaterThanOrEqualTo
|
|
145
57
|
]
|
|
58
|
+
}),
|
|
59
|
+
labels: {
|
|
60
|
+
IfAmountIsBetween: `${k.ForExpenses} ${k.ExpensesBold} ${k.GreaterThanOrEqualTo}`,
|
|
61
|
+
And: k.AndLessThan,
|
|
62
|
+
LowerPlaceholder: k.MinimumPlaceholder,
|
|
63
|
+
UpperPlaceholder: k.MaximumPlaceholder
|
|
64
|
+
},
|
|
65
|
+
testIds: {
|
|
66
|
+
lowerInput: O?.minAmountInput,
|
|
67
|
+
upperInput: O?.maxAmountInput
|
|
68
|
+
}
|
|
69
|
+
}),
|
|
70
|
+
/* @__PURE__ */ m(i, {
|
|
71
|
+
"aria-label": k.Outcome,
|
|
72
|
+
"aria-required": "true",
|
|
73
|
+
className: "ttw:gap-2",
|
|
74
|
+
value: v.outcome,
|
|
75
|
+
disabled: C,
|
|
76
|
+
onValueChange: (e) => {
|
|
77
|
+
e === s.AutoApprove ? A({
|
|
78
|
+
outcome: e,
|
|
79
|
+
approvers: []
|
|
80
|
+
}) : e === s.RequireApproval && A({ outcome: e });
|
|
81
|
+
},
|
|
82
|
+
children: [/* @__PURE__ */ m("div", {
|
|
83
|
+
className: "ttw:flex ttw:items-center ttw:gap-2",
|
|
84
|
+
children: [/* @__PURE__ */ p(a, {
|
|
85
|
+
id: `${F}-auto`,
|
|
86
|
+
value: s.AutoApprove
|
|
87
|
+
}), /* @__PURE__ */ m(r, {
|
|
88
|
+
htmlFor: `${F}-auto`,
|
|
89
|
+
className: "ttw:cursor-pointer ttw:text-success-foreground",
|
|
90
|
+
children: [/* @__PURE__ */ p(g, {
|
|
91
|
+
"aria-hidden": "true",
|
|
92
|
+
className: "ttw:size-4 ttw:shrink-0"
|
|
93
|
+
}), k.AutoApprove]
|
|
94
|
+
})]
|
|
95
|
+
}), /* @__PURE__ */ m("div", {
|
|
96
|
+
className: "ttw:flex ttw:items-start ttw:gap-2",
|
|
97
|
+
children: [/* @__PURE__ */ p(a, {
|
|
98
|
+
id: `${F}-required`,
|
|
99
|
+
value: s.RequireApproval,
|
|
100
|
+
className: "ttw:mt-0.5"
|
|
101
|
+
}), /* @__PURE__ */ m("div", {
|
|
102
|
+
className: "ttw:flex ttw:flex-col ttw:gap-1",
|
|
103
|
+
children: [/* @__PURE__ */ m(r, {
|
|
104
|
+
htmlFor: `${F}-required`,
|
|
105
|
+
className: "ttw:cursor-pointer",
|
|
106
|
+
children: [/* @__PURE__ */ p(h, {
|
|
107
|
+
"aria-hidden": "true",
|
|
108
|
+
className: "ttw:size-4 ttw:shrink-0"
|
|
109
|
+
}), k.RequireApproval]
|
|
110
|
+
}), /* @__PURE__ */ p("span", {
|
|
111
|
+
className: "ttw:pl-6 ttw:text-xs ttw:text-muted-foreground",
|
|
112
|
+
children: k.RequireApprovalCaption
|
|
113
|
+
})]
|
|
114
|
+
})]
|
|
146
115
|
})]
|
|
147
116
|
}),
|
|
148
|
-
|
|
117
|
+
v.outcome === s.RequireApproval ? /* @__PURE__ */ m("div", {
|
|
149
118
|
className: "ttw:flex ttw:flex-col ttw:gap-1",
|
|
150
119
|
children: [
|
|
151
|
-
/* @__PURE__ */
|
|
120
|
+
/* @__PURE__ */ p("label", {
|
|
121
|
+
htmlFor: I,
|
|
152
122
|
className: "ttw:text-xs ttw:font-medium",
|
|
153
|
-
children:
|
|
123
|
+
children: k.RequireApprovalFrom
|
|
154
124
|
}),
|
|
155
|
-
/* @__PURE__ */
|
|
156
|
-
items:
|
|
157
|
-
value:
|
|
125
|
+
/* @__PURE__ */ p(t, {
|
|
126
|
+
items: B,
|
|
127
|
+
value: v.approvers.map((e) => e.id),
|
|
158
128
|
onValueChange: (e) => {
|
|
159
|
-
|
|
160
|
-
let t =
|
|
129
|
+
A({ approvers: (Array.isArray(e) ? e : [e]).flatMap((e) => {
|
|
130
|
+
let t = V.get(e);
|
|
161
131
|
return t ? [t] : [];
|
|
162
132
|
}) });
|
|
163
133
|
},
|
|
164
134
|
multiple: !0,
|
|
165
|
-
multipleSeparator:
|
|
166
|
-
labels: { placeholder:
|
|
167
|
-
disabled:
|
|
168
|
-
|
|
169
|
-
|
|
135
|
+
multipleSeparator: k.ApproverSeparator,
|
|
136
|
+
labels: { placeholder: k.ChooseApprovers },
|
|
137
|
+
disabled: C,
|
|
138
|
+
inputId: I,
|
|
139
|
+
required: !0,
|
|
140
|
+
invalid: !!b.approvers,
|
|
141
|
+
describedBy: b.approvers ? L : void 0
|
|
170
142
|
}),
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
children:
|
|
143
|
+
b.approvers ? /* @__PURE__ */ p(n, {
|
|
144
|
+
id: L,
|
|
145
|
+
children: b.approvers
|
|
174
146
|
}) : null
|
|
175
147
|
]
|
|
176
148
|
}) : null,
|
|
177
|
-
/* @__PURE__ */
|
|
178
|
-
className: "ttw:flex ttw:items-center ttw:justify-between
|
|
179
|
-
children: [/* @__PURE__ */
|
|
149
|
+
/* @__PURE__ */ m("div", {
|
|
150
|
+
className: "ttw:mt-2 ttw:flex ttw:items-center ttw:justify-between",
|
|
151
|
+
children: [/* @__PURE__ */ p("div", { children: S && D ? /* @__PURE__ */ m(e, {
|
|
180
152
|
variant: "ghost",
|
|
181
153
|
size: "sm",
|
|
182
154
|
className: "ttw:text-destructive ttw:hover:text-destructive",
|
|
183
|
-
onClick:
|
|
184
|
-
disabled:
|
|
185
|
-
children: [/* @__PURE__ */
|
|
186
|
-
}) : null }), /* @__PURE__ */
|
|
155
|
+
onClick: D,
|
|
156
|
+
disabled: C,
|
|
157
|
+
children: [/* @__PURE__ */ p(_, {}), k.DeleteRule]
|
|
158
|
+
}) : null }), /* @__PURE__ */ m("div", {
|
|
187
159
|
className: "ttw:flex ttw:gap-2",
|
|
188
|
-
children: [/* @__PURE__ */
|
|
160
|
+
children: [/* @__PURE__ */ p(e, {
|
|
189
161
|
variant: "ghost",
|
|
190
162
|
size: "sm",
|
|
191
|
-
onClick:
|
|
192
|
-
disabled:
|
|
193
|
-
children:
|
|
194
|
-
}), /* @__PURE__ */
|
|
163
|
+
onClick: E,
|
|
164
|
+
disabled: C,
|
|
165
|
+
children: k.Cancel
|
|
166
|
+
}), /* @__PURE__ */ p(e, {
|
|
195
167
|
size: "sm",
|
|
196
|
-
onClick:
|
|
197
|
-
disabled:
|
|
198
|
-
"data-testid":
|
|
199
|
-
children:
|
|
168
|
+
onClick: P,
|
|
169
|
+
disabled: C,
|
|
170
|
+
"data-testid": O?.saveButton,
|
|
171
|
+
children: k.Save
|
|
200
172
|
})]
|
|
201
173
|
})]
|
|
202
174
|
})
|
|
203
175
|
]
|
|
204
176
|
});
|
|
205
177
|
};
|
|
206
|
-
export {
|
|
178
|
+
export { v as ApprovalRuleForm };
|