@pivotfinancialtechnologies/admin-frontend-blueprint-template 0.0.2-dev.9 → 0.0.3-dev.10

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 (81) hide show
  1. package/README.md +56 -60
  2. package/dist/PermissionVisibility-CXHamZv5.cjs +1 -0
  3. package/dist/PermissionVisibility-DhDN-Z93.js +24 -0
  4. package/dist/SettingsSectionBase-CfT9p06Q.js +475 -0
  5. package/dist/SettingsSectionBase-PZs1Wgw1.cjs +1 -0
  6. package/dist/TopBarNavLayout-C0qRr2Lo.js +62 -0
  7. package/dist/TopBarNavLayout-CVxxYLc9.cjs +1 -0
  8. package/dist/{index.css → admin-frontend-blueprint-template.css} +1 -1
  9. package/dist/api-CzCTYMlh.js +81 -0
  10. package/dist/api-nTm6UPd6.cjs +1 -0
  11. package/dist/{utils → clipboard}/copy.d.ts +1 -1
  12. package/dist/clipboard/index.d.ts +1 -0
  13. package/dist/components/Data/BooleanTag/BooleanTag.d.ts +1 -1
  14. package/dist/components/Data/Datatable/Datatable.d.ts +1 -1
  15. package/dist/components/index.d.ts +2 -4
  16. package/dist/components.cjs +1 -0
  17. package/dist/components.d.ts +2 -0
  18. package/dist/components.js +14 -0
  19. package/dist/date-1EP6oPlF.cjs +1 -0
  20. package/dist/date-BEtsfEKV.js +389 -0
  21. package/dist/feedback/index.d.ts +1 -0
  22. package/dist/formatters/duration.d.ts +1 -0
  23. package/dist/formatters/index.d.ts +4 -0
  24. package/dist/formatters/money.d.ts +3 -0
  25. package/dist/formatters/phone.d.ts +1 -0
  26. package/dist/formatters.cjs +1 -0
  27. package/dist/formatters.d.ts +2 -0
  28. package/dist/formatters.js +12 -0
  29. package/dist/hooks/index.d.ts +2 -0
  30. package/dist/hooks/useSize.d.ts +5 -0
  31. package/dist/hooks/useUrlForm.d.ts +5 -0
  32. package/dist/hooks.cjs +1 -0
  33. package/dist/hooks.d.ts +2 -0
  34. package/dist/hooks.js +6 -0
  35. package/dist/http/api.d.ts +49 -0
  36. package/dist/http/index.d.ts +2 -0
  37. package/dist/http/query.d.ts +5 -0
  38. package/dist/http.cjs +1 -0
  39. package/dist/http.d.ts +2 -0
  40. package/dist/http.js +11 -0
  41. package/dist/index.cjs +1 -0
  42. package/dist/index.d.ts +8 -2
  43. package/dist/index.js +49 -4535
  44. package/dist/jsx-runtime-DMhOxOJN.cjs +14 -0
  45. package/dist/jsx-runtime-gfdvceKf.js +615 -0
  46. package/dist/layout/index.d.ts +4 -0
  47. package/dist/layout.cjs +1 -0
  48. package/dist/layout.d.ts +2 -0
  49. package/dist/layout.js +7 -0
  50. package/dist/phone-DmQ5SK-X.cjs +1 -0
  51. package/dist/phone-DtDgQ5qk.js +27 -0
  52. package/dist/query-Br3l_kxt.cjs +1 -0
  53. package/dist/query-CherHJOV.js +17 -0
  54. package/dist/{components/Security → security}/PermissionVisibility.d.ts +4 -2
  55. package/dist/security/index.d.ts +3 -0
  56. package/dist/security.cjs +1 -0
  57. package/dist/security.d.ts +2 -0
  58. package/dist/security.js +6 -0
  59. package/dist/toast-B3QUItIK.js +10 -0
  60. package/dist/toast-CCrs9yfw.cjs +1 -0
  61. package/dist/types/index.d.ts +1 -0
  62. package/dist/{components/Data/Pagination.d.ts → types/pagination.d.ts} +2 -2
  63. package/dist/useSize-Ci0PbN9W.js +15 -0
  64. package/dist/useSize-Dk1SOOLH.cjs +1 -0
  65. package/dist/useUrlForm-BYTOPBsx.js +26 -0
  66. package/dist/useUrlForm-KA9CehKJ.cjs +1 -0
  67. package/package.json +60 -8
  68. package/dist/components/Data/utils.d.ts +0 -5
  69. package/dist/index.umd.cjs +0 -14
  70. package/dist/layouts/index.d.ts +0 -3
  71. package/dist/utils/http.d.ts +0 -4
  72. package/dist/utils/index.d.ts +0 -6
  73. package/dist/utils/useUrlForm.d.ts +0 -4
  74. /package/dist/{utils → feedback}/toast.d.ts +0 -0
  75. /package/dist/{utils/formatters.d.ts → formatters/date.d.ts} +0 -0
  76. /package/dist/{layouts → layout}/ThemeSwitch/ThemeSwitch.d.ts +0 -0
  77. /package/dist/{layouts → layout}/TopBarNavLayout/TopBarNavLayout.d.ts +0 -0
  78. /package/dist/{layouts → layout}/Topbar/Topbar.d.ts +0 -0
  79. /package/dist/{utils → layout}/theme.d.ts +0 -0
  80. /package/dist/{components/Security → security}/AuthRoute.d.ts +0 -0
  81. /package/dist/{components/Security → security}/UnAuthRoute.d.ts +0 -0
package/README.md CHANGED
@@ -1,73 +1,69 @@
1
- # React + TypeScript + Vite
1
+ # Admin Frontend Blueprint Template
2
2
 
3
- This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
3
+ A reusable React component and utility library for admin frontends built with Blueprint.js 6.
4
4
 
5
- Currently, two official plugins are available:
5
+ ## Requirements
6
6
 
7
- - [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Oxc](https://oxc.rs)
8
- - [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/)
7
+ Consumers must provide React 18 and the Blueprint packages listed as peer dependencies: `@blueprintjs/core`, `@blueprintjs/icons`, `@blueprintjs/select`, and `@blueprintjs/table`, plus `react-router-dom` when using the security route components. The package includes `date-fns`, `date-fns-tz`, `@react-hook/resize-observer`, and `use-debounce` as runtime dependencies.
9
8
 
10
- ## React Compiler
9
+ Several components use Tailwind utility classes. Use Tailwind CSS 4 and ensure the package is included in source detection so its classes are generated. For example, in the host app's CSS entry (adjust the path relative to that file):
11
10
 
12
- The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation).
11
+ ```css
12
+ @import "tailwindcss";
13
+ @source "../node_modules/@pivotfinancialtechnologies/admin-frontend-blueprint-template";
14
+ ```
13
15
 
14
- ## Expanding the ESLint configuration
16
+ ## Install and use
15
17
 
16
- If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
18
+ Install this package and its peer dependencies in the consuming app, then import the public API from the package root:
17
19
 
18
- ```js
19
- export default defineConfig([
20
- globalIgnores(['dist']),
21
- {
22
- files: ['**/*.{ts,tsx}'],
23
- extends: [
24
- // Other configs...
20
+ ```tsx
21
+ import {
22
+ AuthRoute,
23
+ Datatable,
24
+ Topbar,
25
+ formatDateTime,
26
+ } from "@pivotfinancialtechnologies/admin-frontend-blueprint-template";
27
+ ```
25
28
 
26
- // Remove tseslint.configs.recommended and replace with this
27
- tseslint.configs.recommendedTypeChecked,
28
- // Alternatively, use this for stricter rules
29
- tseslint.configs.strictTypeChecked,
30
- // Optionally, add this for stylistic rules
31
- tseslint.configs.stylisticTypeChecked,
29
+ Import by domain when you want a smaller public surface:
32
30
 
33
- // Other configs...
34
- ],
35
- languageOptions: {
36
- parserOptions: {
37
- project: ['./tsconfig.node.json', './tsconfig.app.json'],
38
- tsconfigRootDir: import.meta.dirname,
39
- },
40
- // other options...
41
- },
42
- },
43
- ])
31
+ ```ts
32
+ import { createHttpQueryParams, createApiBaseQuery } from "@pivotfinancialtechnologies/admin-frontend-blueprint-template/http";
33
+ import { formatDateTime, formatCurrency, formatPhone, formatDateDuration } from "@pivotfinancialtechnologies/admin-frontend-blueprint-template/formatters";
34
+ import { Datatable } from "@pivotfinancialtechnologies/admin-frontend-blueprint-template/components";
35
+ import { AuthRoute } from "@pivotfinancialtechnologies/admin-frontend-blueprint-template/security";
36
+ import { Topbar } from "@pivotfinancialtechnologies/admin-frontend-blueprint-template/layout";
37
+ import { useUrlForm } from "@pivotfinancialtechnologies/admin-frontend-blueprint-template/hooks";
44
38
  ```
45
39
 
46
- You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:
47
-
48
- ```js
49
- // eslint.config.js
50
- import reactX from 'eslint-plugin-react-x'
51
- import reactDom from 'eslint-plugin-react-dom'
52
-
53
- export default defineConfig([
54
- globalIgnores(['dist']),
55
- {
56
- files: ['**/*.{ts,tsx}'],
57
- extends: [
58
- // Other configs...
59
- // Enable lint rules for React
60
- reactX.configs['recommended-typescript'],
61
- // Enable lint rules for React DOM
62
- reactDom.configs.recommended,
63
- ],
64
- languageOptions: {
65
- parserOptions: {
66
- project: ['./tsconfig.node.json', './tsconfig.app.json'],
67
- tsconfigRootDir: import.meta.dirname,
68
- },
69
- // other options...
70
- },
71
- },
72
- ])
40
+ URL-synced forms and table sizing hooks live under `./hooks`. Toasts reuse a single OverlayToaster instance.
41
+
42
+ `createApiBaseQuery` is a fetch helper compatible with RTK Query `baseQuery`. Pass `getBaseUrl` and `onUnauthorized` from the host app instead of baking in env vars or auth slices:
43
+
44
+ ```ts
45
+ const baseQuery = createApiBaseQuery({
46
+ getBaseUrl: () => import.meta.env.VITE_API_URL ?? "",
47
+ onUnauthorized: () => store.dispatch(logOut()),
48
+ });
73
49
  ```
50
+
51
+ `PermissionVisibility` matches any required permission by default; set `matchMode="all"` to require every listed permission. An empty required-permission list or missing granted permissions renders the fallback.
52
+
53
+ ## Styles
54
+
55
+ Import Blueprint's styles and the stylesheet emitted by this package's library build once in the consuming app:
56
+
57
+ ```ts
58
+ import "@blueprintjs/core/lib/css/blueprint.css";
59
+ import "@blueprintjs/icons/lib/css/blueprint-icons.css";
60
+ import "@blueprintjs/select/lib/css/blueprint-select.css";
61
+ import "@blueprintjs/table/lib/css/table.css";
62
+ import "@pivotfinancialtechnologies/admin-frontend-blueprint-template/styles.css";
63
+ ```
64
+
65
+ ## Development
66
+
67
+ - `npm run build` type-checks and builds the library.
68
+ - `npm run lint` runs ESLint.
69
+ - `npm pack` creates the package archive for local inspection.
@@ -0,0 +1 @@
1
+ "use strict";const e=require("./jsx-runtime-DMhOxOJN.cjs"),o=require("react"),i=require("react-router-dom"),c=({isAuthenticated:t,loginUrl:r,onBeforeNavigateLogin:u})=>{const n=i.useNavigate(),s=o.useRef(!1);return o.useEffect(()=>{if(t){s.current=!1;return}s.current||(s.current=!0,u?.(),n(r,{replace:!0}))},[t,r,n,u]),t?e.jsxRuntimeExports.jsx(i.Outlet,{}):null},R=({isAuthenticated:t,homeUrl:r})=>t?e.jsxRuntimeExports.jsx(i.Navigate,{to:r}):e.jsxRuntimeExports.jsx(i.Outlet,{}),j=({requiredPermissions:t,gainPermissions:r,matchMode:u="any",children:n,fallback:s=null})=>!t.length||!r?.length?e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:s}):(u==="all"?t.every(x=>r.includes(x)):t.some(x=>r.includes(x)))?e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:n}):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:s});exports.AuthRoute=c;exports.PermissionVisibility=j;exports.UnAuthRoute=R;
@@ -0,0 +1,24 @@
1
+ import { j as e } from "./jsx-runtime-gfdvceKf.js";
2
+ import { useRef as l, useEffect as o } from "react";
3
+ import { useNavigate as m, Outlet as c, Navigate as f } from "react-router-dom";
4
+ const p = ({ isAuthenticated: t, loginUrl: r, onBeforeNavigateLogin: n }) => {
5
+ const u = m(), s = l(!1);
6
+ return o(() => {
7
+ if (t) {
8
+ s.current = !1;
9
+ return;
10
+ }
11
+ s.current || (s.current = !0, n?.(), u(r, { replace: !0 }));
12
+ }, [t, r, u, n]), t ? /* @__PURE__ */ e.jsx(c, {}) : null;
13
+ }, R = ({ isAuthenticated: t, homeUrl: r }) => t ? /* @__PURE__ */ e.jsx(f, { to: r }) : /* @__PURE__ */ e.jsx(c, {}), d = ({
14
+ requiredPermissions: t,
15
+ gainPermissions: r,
16
+ matchMode: n = "any",
17
+ children: u,
18
+ fallback: s = null
19
+ }) => !t.length || !r?.length ? /* @__PURE__ */ e.jsx(e.Fragment, { children: s }) : (n === "all" ? t.every((a) => r.includes(a)) : t.some((a) => r.includes(a))) ? /* @__PURE__ */ e.jsx(e.Fragment, { children: u }) : /* @__PURE__ */ e.jsx(e.Fragment, { children: s });
20
+ export {
21
+ p as A,
22
+ d as P,
23
+ R as U
24
+ };
@@ -0,0 +1,475 @@
1
+ import { j as e } from "./jsx-runtime-gfdvceKf.js";
2
+ import { Tag as B, Menu as F, MenuItem as j, Divider as ne, PopoverNext as se, Button as R, Intent as E, Spinner as le, Alert as re, FormGroup as ie, H6 as oe, Section as ae } from "@blueprintjs/core";
3
+ import ce, { useState as k, useRef as L, useMemo as M, useEffect as Y, useCallback as $ } from "react";
4
+ import { Select as V, MultiSelect as de } from "@blueprintjs/select";
5
+ import { Table as J, TableLoadingOption as K, FocusMode as Q, SelectionModes as X, Column as Z, ColumnHeaderCell as ue, Cell as D } from "@blueprintjs/table";
6
+ import { u as q } from "./useSize-Ci0PbN9W.js";
7
+ import { a as H } from "./date-BEtsfEKV.js";
8
+ import { parseISO as xe, isValid as me } from "date-fns";
9
+ import { s as U } from "./toast-B3QUItIK.js";
10
+ const ke = ({ value: n, trueLabel: t = "Yes", falseLabel: s = "No" }) => {
11
+ if (n == null) return null;
12
+ const r = n === !0;
13
+ return /* @__PURE__ */ e.jsx(B, { intent: r ? "success" : "danger", children: r ? t : s });
14
+ }, O = (n = 0, t = 10, s) => ({
15
+ sort: s,
16
+ page: n,
17
+ pageSize: t
18
+ }), G = (n) => {
19
+ if (n == null)
20
+ return "";
21
+ if (n instanceof Date)
22
+ return H(n);
23
+ const t = String(n);
24
+ if (/^\d{4}-\d{2}-\d{2}/.test(t)) {
25
+ const s = xe(t);
26
+ if (me(s))
27
+ return H(s);
28
+ }
29
+ return t;
30
+ }, pe = (n) => {
31
+ const t = document.createElement("textarea");
32
+ t.value = n, t.style.position = "fixed", t.style.top = "0", t.style.left = "0", t.style.opacity = "0", document.body.appendChild(t), t.select();
33
+ try {
34
+ return document.execCommand("copy");
35
+ } catch (s) {
36
+ return console.error("Fallback copy failed", s), !1;
37
+ } finally {
38
+ document.body.removeChild(t);
39
+ }
40
+ }, W = async (n) => {
41
+ if (!navigator.clipboard) {
42
+ pe(n);
43
+ return;
44
+ }
45
+ await navigator.clipboard.writeText(n);
46
+ }, ee = (n, t, s, r) => {
47
+ const o = n.getTarget(), a = o.rows?.[0] ?? -1, c = o.cols?.[0] ?? -1, d = t[c]?.name, f = s?.[a], x = f?.[t[c].key], g = a > -1 && c > -1 ? G(x) : "";
48
+ return /* @__PURE__ */ e.jsxs(F, { children: [
49
+ /* @__PURE__ */ e.jsx(
50
+ j,
51
+ {
52
+ text: d ? `Copy ${d} (Ctrl+C)` : "Copy (Ctrl+C)",
53
+ onClick: async () => {
54
+ a > -1 && c > -1 && (await W(g), U({ message: d ? `${d} Copied` : "Text Copied", intent: "success" }));
55
+ }
56
+ },
57
+ -1
58
+ ),
59
+ r?.map((b, C) => /* @__PURE__ */ e.jsx(
60
+ j,
61
+ {
62
+ text: `Copy ${b.label}`,
63
+ onClick: async () => {
64
+ await W(b.copyContent(f)), U({ message: `${b.label} copied`, intent: "success" });
65
+ }
66
+ },
67
+ C
68
+ ))
69
+ ] });
70
+ }, he = [5, 15, 25, 50, 100], Te = ({
71
+ columns: n,
72
+ request: t,
73
+ data: s,
74
+ isLoading: r,
75
+ onRequestChange: o,
76
+ actionButtons: a,
77
+ getIntent: c,
78
+ onDoubleClick: d,
79
+ resetKey: f
80
+ }) => {
81
+ const [x, g] = k(n), b = L(null), { width: C } = q(b), h = s?.content ?? [], u = (l) => {
82
+ o(O(0, t.pageSize, l));
83
+ }, v = () => {
84
+ s && !s.last && o(O(t.page + 1, t.pageSize, t.sort));
85
+ }, I = () => {
86
+ s && !s.first && o(O(t.page - 1, t.pageSize, t.sort));
87
+ }, z = (l) => {
88
+ o(O(0, l, t.sort));
89
+ }, _ = (l) => /* @__PURE__ */ e.jsxs(F, { children: [
90
+ /* @__PURE__ */ e.jsx(j, { text: "Sort Ascending", icon: "sort-asc", onClick: () => u([{ field: l, direction: "asc" }]) }),
91
+ /* @__PURE__ */ e.jsx(j, { text: "Sort Descending", icon: "sort-desc", onClick: () => u([{ field: l, direction: "desc" }]) }),
92
+ /* @__PURE__ */ e.jsx(j, { text: "Unsort", onClick: () => u(void 0) })
93
+ ] }), P = (l, m, p) => l.customCellRenderer ? l.customCellRenderer(m) : /* @__PURE__ */ e.jsx(e.Fragment, { children: p }), A = async (l, m) => {
94
+ const y = h[l]?.[n[m].key], w = G(y);
95
+ return navigator.clipboard || await W(w), w;
96
+ }, i = M(() => x.filter((l) => l.visible), [x]), N = (l) => {
97
+ const m = i.reduce((T, te) => T + (te.width ?? 0), 0), p = i.filter((T) => T.width !== void 0).length;
98
+ let w = (l - m - 38) / (i.length - p);
99
+ return w < 100 && (w = 100), i.map((T) => T.width ?? w);
100
+ }, S = M(() => N(C), [C, i]);
101
+ return Y(() => {
102
+ f && t.page !== 0 && o(O(0, t.pageSize, t.sort));
103
+ }, [f]), /* @__PURE__ */ e.jsxs("div", { children: [
104
+ /* @__PURE__ */ e.jsxs("div", { className: "table-form-actions", children: [
105
+ /* @__PURE__ */ e.jsx("div", { className: "table-form" }),
106
+ /* @__PURE__ */ e.jsxs("div", { className: "table-actions", children: [
107
+ a && a,
108
+ a && /* @__PURE__ */ e.jsx(ne, { style: { height: "20px" } }),
109
+ /* @__PURE__ */ e.jsx(
110
+ se,
111
+ {
112
+ placement: "bottom-start",
113
+ content: /* @__PURE__ */ e.jsx(F, { children: x.map((l) => /* @__PURE__ */ e.jsx(
114
+ j,
115
+ {
116
+ shouldDismissPopover: !1,
117
+ onClick: (m) => {
118
+ m.preventDefault(), g(
119
+ (p) => p.map((y) => y.key === l.key ? { ...y, visible: !y.visible } : y)
120
+ );
121
+ },
122
+ text: /* @__PURE__ */ e.jsxs("div", { className: "columns-visibility-menu", children: [
123
+ /* @__PURE__ */ e.jsx("input", { type: "checkbox", checked: l.visible, readOnly: !0, style: { pointerEvents: "none" } }),
124
+ l.name
125
+ ] })
126
+ },
127
+ l.name
128
+ )) }),
129
+ renderTarget: ({ isOpen: l, ...m }) => /* @__PURE__ */ e.jsx(R, { ...m, text: "Columns Visibility", endIcon: "double-caret-vertical" })
130
+ }
131
+ )
132
+ ] })
133
+ ] }),
134
+ /* @__PURE__ */ e.jsx("div", { ref: b, children: /* @__PURE__ */ e.jsx(
135
+ J,
136
+ {
137
+ cellRendererDependencies: [t, s, S],
138
+ columnWidths: S,
139
+ numRows: h?.length ?? 0,
140
+ getCellClipboardData: A,
141
+ defaultRowHeight: 25,
142
+ enableColumnResizing: !1,
143
+ enableRowResizing: !1,
144
+ enableMultipleSelection: !1,
145
+ selectionModes: X.ROWS_AND_CELLS,
146
+ focusMode: Q.ROW,
147
+ loadingOptions: r ? [K.COLUMN_HEADERS] : [],
148
+ bodyContextMenuRenderer: (l) => ee(l, n, h ?? []),
149
+ children: i.map((l) => /* @__PURE__ */ e.jsx(
150
+ Z,
151
+ {
152
+ name: l.name,
153
+ cellRenderer: (m) => {
154
+ if (!h)
155
+ return /* @__PURE__ */ e.jsx(D, {});
156
+ const p = h[m], y = c ? c(p) : E.NONE;
157
+ return /* @__PURE__ */ e.jsx(D, { intent: y, interactive: !0, className: "h-full", children: /* @__PURE__ */ e.jsx(
158
+ "div",
159
+ {
160
+ className: "absolute inset-0 px-2 py-1 flex items-center",
161
+ onDoubleClick: () => {
162
+ d && d(p);
163
+ },
164
+ children: P(l, p, p[l.key])
165
+ }
166
+ ) });
167
+ },
168
+ columnHeaderCellRenderer: () => /* @__PURE__ */ e.jsx(ue, { name: l.name, menuRenderer: () => _(l.sortKey ?? l.key) })
169
+ },
170
+ l.key
171
+ ))
172
+ }
173
+ ) }),
174
+ /* @__PURE__ */ e.jsxs("div", { className: "table-pagination", children: [
175
+ /* @__PURE__ */ e.jsxs("div", { className: "rows-select-container", children: [
176
+ /* @__PURE__ */ e.jsx("span", { children: "Rows per page: " }),
177
+ /* @__PURE__ */ e.jsx(
178
+ V,
179
+ {
180
+ items: he,
181
+ itemRenderer: (l, { handleClick: m }) => /* @__PURE__ */ e.jsx(j, { text: l, onClick: m }, l),
182
+ onItemSelect: z,
183
+ filterable: !1,
184
+ disabled: r,
185
+ children: /* @__PURE__ */ e.jsx(R, { text: t.pageSize, endIcon: "double-caret-vertical" })
186
+ }
187
+ )
188
+ ] }),
189
+ /* @__PURE__ */ e.jsxs("div", { className: "flex flex-row items-center", children: [
190
+ r && /* @__PURE__ */ e.jsx(le, { size: 20 }),
191
+ /* @__PURE__ */ e.jsx(R, { onClick: I, disabled: r || (s ? s.first : !0), children: "Previous" }),
192
+ /* @__PURE__ */ e.jsxs("span", { className: "pagination-page-info", children: [
193
+ "Page ",
194
+ s ? s.number + 1 : 1,
195
+ " of ",
196
+ s ? s.totalPages : 1
197
+ ] }),
198
+ /* @__PURE__ */ e.jsx(R, { onClick: v, disabled: r || (s ? s.last : r), children: "Next" })
199
+ ] })
200
+ ] })
201
+ ] });
202
+ }, Oe = ({
203
+ value: n,
204
+ trueText: t = "Yes",
205
+ falseText: s = "No",
206
+ trueIntent: r,
207
+ falseIntent: o,
208
+ round: a = !0,
209
+ minimal: c = !0
210
+ }) => n == null ? null : /* @__PURE__ */ e.jsx(B, { intent: n ? r : o, round: a, minimal: c, children: n ? t : s }), fe = [5, 15, 25, 50, 100, 200], Me = ({
211
+ columns: n,
212
+ data: t,
213
+ actionButtons: s,
214
+ isLoading: r,
215
+ getIntent: o,
216
+ pageSize: a,
217
+ extraCopyMenus: c
218
+ }) => {
219
+ const [d, f] = k(a), [x, g] = k(0), b = L(null), { width: C } = q(b), h = d != null, u = M(() => !h || !t ? 1 : Math.ceil(t.length / d) || 1, [t, d, h]), v = M(() => {
220
+ if (!t) return [];
221
+ if (!h) return t;
222
+ const i = x * d;
223
+ return t.slice(i, i + d);
224
+ }, [t, x, d, h]), I = (t?.length ?? 0) > 23 && !h, z = (i) => {
225
+ f(i), g(0);
226
+ }, _ = (i) => {
227
+ const N = n.reduce((p, y) => p + (y.width ?? 0), 0), S = n.filter((p) => p.width !== void 0).length;
228
+ let m = (i - N - 38) / (n.length - S);
229
+ return m < 150 && (m = 150), n.map((p) => p.width ?? m);
230
+ }, P = M(() => _(C), [C, n]), A = async (i, N) => {
231
+ const l = t?.[i]?.[n[N].key], m = G(l);
232
+ return navigator.clipboard || await W(m), m;
233
+ };
234
+ return ce.useEffect(() => {
235
+ g(0);
236
+ }, [t]), /* @__PURE__ */ e.jsxs(
237
+ "div",
238
+ {
239
+ className: "simple-datatable",
240
+ style: I ? { height: "70vh", overflow: "auto" } : void 0,
241
+ ref: b,
242
+ children: [
243
+ s && /* @__PURE__ */ e.jsx("div", { className: "flex justify-end mb-2", children: s }),
244
+ /* @__PURE__ */ e.jsx(
245
+ J,
246
+ {
247
+ loadingOptions: r ? [K.COLUMN_HEADERS] : [],
248
+ getCellClipboardData: A,
249
+ cellRendererDependencies: [v, n, P, x],
250
+ numRows: v.length,
251
+ defaultRowHeight: 25,
252
+ enableColumnResizing: !1,
253
+ enableRowResizing: !1,
254
+ enableMultipleSelection: !1,
255
+ selectionModes: X.ROWS_AND_CELLS,
256
+ columnWidths: P,
257
+ focusMode: Q.ROW,
258
+ bodyContextMenuRenderer: (i) => ee(i, n, v, c),
259
+ children: n.map((i) => /* @__PURE__ */ e.jsx(
260
+ Z,
261
+ {
262
+ name: i.name,
263
+ cellRenderer: (N) => {
264
+ const S = v[N], l = o ? o(S) : E.NONE;
265
+ return S ? /* @__PURE__ */ e.jsx(D, { intent: l, children: i.customCellRenderer ? i.customCellRenderer(S) : /* @__PURE__ */ e.jsx(e.Fragment, { children: S[i.key] }) }) : /* @__PURE__ */ e.jsx(D, { intent: l });
266
+ }
267
+ },
268
+ i.key
269
+ ))
270
+ },
271
+ `table-page-${x}-${d ?? "all"}`
272
+ ),
273
+ h && /* @__PURE__ */ e.jsxs("div", { className: "table-pagination flex items-center justify-between mt-2", children: [
274
+ /* @__PURE__ */ e.jsxs("div", { className: "rows-select-container flex items-center gap-2", children: [
275
+ /* @__PURE__ */ e.jsx("span", { children: "Rows per page: " }),
276
+ /* @__PURE__ */ e.jsx(
277
+ V,
278
+ {
279
+ items: fe,
280
+ itemRenderer: (i, { handleClick: N }) => /* @__PURE__ */ e.jsx(j, { text: i, onClick: N }, i),
281
+ onItemSelect: z,
282
+ filterable: !1,
283
+ children: /* @__PURE__ */ e.jsx(R, { text: d, endIcon: "double-caret-vertical" })
284
+ }
285
+ )
286
+ ] }),
287
+ /* @__PURE__ */ e.jsxs("div", { className: "flex flex-row items-center gap-2", children: [
288
+ /* @__PURE__ */ e.jsx(R, { onClick: () => g((i) => Math.max(0, i - 1)), disabled: x === 0, children: "Previous" }),
289
+ /* @__PURE__ */ e.jsxs("span", { className: "pagination-page-info px-2", children: [
290
+ "Page ",
291
+ x + 1,
292
+ " of ",
293
+ u
294
+ ] }),
295
+ /* @__PURE__ */ e.jsx(
296
+ R,
297
+ {
298
+ onClick: () => g((i) => Math.min(u - 1, i + 1)),
299
+ disabled: x >= u - 1,
300
+ children: "Next"
301
+ }
302
+ )
303
+ ] })
304
+ ] })
305
+ ]
306
+ }
307
+ );
308
+ }, Pe = ({ columns: n, data: t, getIntent: s }) => /* @__PURE__ */ e.jsxs("table", { className: "bp6-html-table simple-html-datatable w-full", children: [
309
+ /* @__PURE__ */ e.jsx("thead", { children: /* @__PURE__ */ e.jsx("tr", { children: n.map((r, o) => /* @__PURE__ */ e.jsx("th", { style: { width: r.width }, children: r.name }, o)) }) }),
310
+ /* @__PURE__ */ e.jsx("tbody", { children: (t ?? []).map((r, o) => {
311
+ const a = s ? s(r) : E.NONE;
312
+ return /* @__PURE__ */ e.jsx("tr", { className: a !== E.NONE ? `bp6-intent-${a}` : "", children: n.map((c, d) => /* @__PURE__ */ e.jsx("td", { children: c.customCellRenderer ? c.customCellRenderer(r) : r[c.key] }, d)) }, o);
313
+ }) })
314
+ ] }), Ee = () => {
315
+ const [n, t] = k(!1), [s, r] = k(null), [o, a] = k(null);
316
+ return [$((f) => (r(f), t(!0), new Promise((x) => {
317
+ a(() => x);
318
+ })), []), /* @__PURE__ */ e.jsx(
319
+ re,
320
+ {
321
+ isOpen: n,
322
+ intent: "primary",
323
+ confirmButtonText: "Yes",
324
+ cancelButtonText: "No",
325
+ onConfirm: () => {
326
+ t(!1), o?.(!0), a(null);
327
+ },
328
+ onClose: () => {
329
+ t(!1), o?.(!1), a(null);
330
+ },
331
+ children: s
332
+ }
333
+ )];
334
+ }, De = ({
335
+ selectedValue: n,
336
+ items: t = [],
337
+ required: s = !1,
338
+ disabled: r,
339
+ onSelect: o,
340
+ renderSelected: a,
341
+ renderMenuText: c,
342
+ getValueByItem: d,
343
+ getItemByValue: f,
344
+ renderMenuLabel: x,
345
+ onBlur: g,
346
+ intent: b = "none"
347
+ }) => {
348
+ const C = s ? t : [null, ...t], h = n === void 0 ? void 0 : f(n);
349
+ return /* @__PURE__ */ e.jsx(
350
+ V,
351
+ {
352
+ items: C,
353
+ disabled: r,
354
+ onItemSelect: (u) => {
355
+ o(u ?? void 0);
356
+ },
357
+ filterable: !1,
358
+ popoverProps: {
359
+ onClose: () => {
360
+ g?.();
361
+ }
362
+ },
363
+ itemRenderer: (u, { handleClick: v }) => u ? /* @__PURE__ */ e.jsx(
364
+ j,
365
+ {
366
+ text: c(u),
367
+ onClick: v,
368
+ labelElement: x?.(u)
369
+ },
370
+ String(d(u))
371
+ ) : /* @__PURE__ */ e.jsx(j, { text: "— None —", onClick: v }, "__none"),
372
+ noResults: /* @__PURE__ */ e.jsx(j, { disabled: !0, text: "No records." }),
373
+ children: /* @__PURE__ */ e.jsx(
374
+ R,
375
+ {
376
+ text: a(h) ?? "Select Value",
377
+ intent: b,
378
+ endIcon: "double-caret-vertical"
379
+ }
380
+ )
381
+ }
382
+ );
383
+ }, We = ({
384
+ items: n = [],
385
+ selectedValues: t = [],
386
+ required: s = !1,
387
+ disabled: r,
388
+ getValueByItem: o,
389
+ getItemByValue: a,
390
+ renderSelected: c,
391
+ renderMenuText: d,
392
+ renderMenuLabel: f,
393
+ onBlur: x,
394
+ onSelect: g,
395
+ onRemove: b
396
+ }) => {
397
+ const C = t.map((u) => a(u)), h = (u) => {
398
+ s && C.length <= 1 || b(u);
399
+ };
400
+ return /* @__PURE__ */ e.jsx(
401
+ de,
402
+ {
403
+ disabled: r,
404
+ items: n,
405
+ selectedItems: C,
406
+ onItemSelect: g,
407
+ onRemove: h,
408
+ popoverProps: {
409
+ onClose: () => {
410
+ x?.();
411
+ }
412
+ },
413
+ itemRenderer: (u, { handleClick: v }) => /* @__PURE__ */ e.jsx(
414
+ j,
415
+ {
416
+ text: d(u),
417
+ labelElement: f?.(u),
418
+ onClick: v
419
+ },
420
+ String(o(u))
421
+ ),
422
+ noResults: /* @__PURE__ */ e.jsx(j, { disabled: !0, text: "No records." }),
423
+ tagRenderer: (u) => c(u)
424
+ }
425
+ );
426
+ }, Ie = ({ label: n, helpText: t, children: s }) => /* @__PURE__ */ e.jsx(
427
+ ie,
428
+ {
429
+ label: /* @__PURE__ */ e.jsx("div", { className: "flex flex-col items-start gap-1", children: /* @__PURE__ */ e.jsx(oe, { className: "m-0 whitespace-nowrap w-30", children: n }) }),
430
+ helperText: t,
431
+ inline: !0,
432
+ contentClassName: "w-full",
433
+ children: s
434
+ }
435
+ ), ge = (n) => {
436
+ const [t, s] = k(n);
437
+ Y(() => {
438
+ s(n);
439
+ }, [n]);
440
+ const r = $((a, c) => JSON.stringify(a) !== JSON.stringify(c), []), o = $(
441
+ (a, c) => s((d) => ({ ...d, [a]: c })),
442
+ []
443
+ );
444
+ return { value: t, setField: o, setValue: s, hasChanges: r };
445
+ }, ze = (n) => {
446
+ const { title: t, updatedAt: s, onChange: r, settings: o, getContent: a } = n, { value: c, setField: d, setValue: f, hasChanges: x } = ge(o), g = x(o, c);
447
+ return /* @__PURE__ */ e.jsx(
448
+ ae,
449
+ {
450
+ title: t,
451
+ rightElement: /* @__PURE__ */ e.jsx(R, { type: "button", intent: "primary", disabled: !g, onClick: () => r(c), children: "Save" }),
452
+ subtitle: /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
453
+ "Updated At: ",
454
+ H(s)
455
+ ] }),
456
+ children: /* @__PURE__ */ e.jsx("div", { className: "m-4", children: a ? a(c, d, f) : null })
457
+ }
458
+ );
459
+ };
460
+ export {
461
+ ke as B,
462
+ Te as D,
463
+ De as S,
464
+ Oe as T,
465
+ We as a,
466
+ Ie as b,
467
+ ze as c,
468
+ Me as d,
469
+ Pe as e,
470
+ ee as f,
471
+ W as g,
472
+ G as h,
473
+ O as i,
474
+ Ee as u
475
+ };
@@ -0,0 +1 @@
1
+ "use strict";const e=require("./jsx-runtime-DMhOxOJN.cjs"),r=require("@blueprintjs/core"),j=require("react"),D=require("@blueprintjs/select"),f=require("@blueprintjs/table"),H=require("./useSize-Dk1SOOLH.cjs"),B=require("./date-1EP6oPlF.cjs"),$=require("date-fns"),A=require("./toast-CCrs9yfw.cjs"),G=({value:s,trueLabel:t="Yes",falseLabel:n="No"})=>{if(s==null)return null;const o=s===!0;return e.jsxRuntimeExports.jsx(r.Tag,{intent:o?"success":"danger",children:o?t:n})},w=(s=0,t=10,n)=>({sort:n,page:s,pageSize:t}),O=s=>{if(s==null)return"";if(s instanceof Date)return B.formatDateTime(s);const t=String(s);if(/^\d{4}-\d{2}-\d{2}/.test(t)){const n=$.parseISO(t);if($.isValid(n))return B.formatDateTime(n)}return t},L=s=>{const t=document.createElement("textarea");t.value=s,t.style.position="fixed",t.style.top="0",t.style.left="0",t.style.opacity="0",document.body.appendChild(t),t.select();try{return document.execCommand("copy")}catch(n){return console.error("Fallback copy failed",n),!1}finally{document.body.removeChild(t)}},I=async s=>{if(!navigator.clipboard){L(s);return}await navigator.clipboard.writeText(s)},F=(s,t,n,o)=>{const a=s.getTarget(),c=a.rows?.[0]??-1,x=a.cols?.[0]??-1,u=t[x]?.name,E=n?.[c],m=E?.[t[x].key],b=c>-1&&x>-1?O(m):"";return e.jsxRuntimeExports.jsxs(r.Menu,{children:[e.jsxRuntimeExports.jsx(r.MenuItem,{text:u?`Copy ${u} (Ctrl+C)`:"Copy (Ctrl+C)",onClick:async()=>{c>-1&&x>-1&&(await I(b),A.showToast({message:u?`${u} Copied`:"Text Copied",intent:"success"}))}},-1),o?.map((C,g)=>e.jsxRuntimeExports.jsx(r.MenuItem,{text:`Copy ${C.label}`,onClick:async()=>{await I(C.copyContent(E)),A.showToast({message:`${C.label} copied`,intent:"success"})}},g))]})},U=[5,15,25,50,100],Y=({columns:s,request:t,data:n,isLoading:o,onRequestChange:a,actionButtons:c,getIntent:x,onDoubleClick:u,resetKey:E})=>{const[m,b]=j.useState(s),C=j.useRef(null),{width:g}=H.useSize(C),h=n?.content??[],d=i=>{a(w(0,t.pageSize,i))},S=()=>{n&&!n.last&&a(w(t.page+1,t.pageSize,t.sort))},P=()=>{n&&!n.first&&a(w(t.page-1,t.pageSize,t.sort))},W=i=>{a(w(0,i,t.sort))},z=i=>e.jsxRuntimeExports.jsxs(r.Menu,{children:[e.jsxRuntimeExports.jsx(r.MenuItem,{text:"Sort Ascending",icon:"sort-asc",onClick:()=>d([{field:i,direction:"asc"}])}),e.jsxRuntimeExports.jsx(r.MenuItem,{text:"Sort Descending",icon:"sort-desc",onClick:()=>d([{field:i,direction:"desc"}])}),e.jsxRuntimeExports.jsx(r.MenuItem,{text:"Unsort",onClick:()=>d(void 0)})]}),k=(i,p,R)=>i.customCellRenderer?i.customCellRenderer(p):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:R}),_=async(i,p)=>{const y=h[i]?.[s[p].key],M=O(y);return navigator.clipboard||await I(M),M},l=j.useMemo(()=>m.filter(i=>i.visible),[m]),N=i=>{const p=l.reduce((T,V)=>T+(V.width??0),0),R=l.filter(T=>T.width!==void 0).length;let M=(i-p-38)/(l.length-R);return M<100&&(M=100),l.map(T=>T.width??M)},v=j.useMemo(()=>N(g),[g,l]);return j.useEffect(()=>{E&&t.page!==0&&a(w(0,t.pageSize,t.sort))},[E]),e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsxs("div",{className:"table-form-actions",children:[e.jsxRuntimeExports.jsx("div",{className:"table-form"}),e.jsxRuntimeExports.jsxs("div",{className:"table-actions",children:[c&&c,c&&e.jsxRuntimeExports.jsx(r.Divider,{style:{height:"20px"}}),e.jsxRuntimeExports.jsx(r.PopoverNext,{placement:"bottom-start",content:e.jsxRuntimeExports.jsx(r.Menu,{children:m.map(i=>e.jsxRuntimeExports.jsx(r.MenuItem,{shouldDismissPopover:!1,onClick:p=>{p.preventDefault(),b(R=>R.map(y=>y.key===i.key?{...y,visible:!y.visible}:y))},text:e.jsxRuntimeExports.jsxs("div",{className:"columns-visibility-menu",children:[e.jsxRuntimeExports.jsx("input",{type:"checkbox",checked:i.visible,readOnly:!0,style:{pointerEvents:"none"}}),i.name]})},i.name))}),renderTarget:({isOpen:i,...p})=>e.jsxRuntimeExports.jsx(r.Button,{...p,text:"Columns Visibility",endIcon:"double-caret-vertical"})})]})]}),e.jsxRuntimeExports.jsx("div",{ref:C,children:e.jsxRuntimeExports.jsx(f.Table,{cellRendererDependencies:[t,n,v],columnWidths:v,numRows:h?.length??0,getCellClipboardData:_,defaultRowHeight:25,enableColumnResizing:!1,enableRowResizing:!1,enableMultipleSelection:!1,selectionModes:f.SelectionModes.ROWS_AND_CELLS,focusMode:f.FocusMode.ROW,loadingOptions:o?[f.TableLoadingOption.COLUMN_HEADERS]:[],bodyContextMenuRenderer:i=>F(i,s,h??[]),children:l.map(i=>e.jsxRuntimeExports.jsx(f.Column,{name:i.name,cellRenderer:p=>{if(!h)return e.jsxRuntimeExports.jsx(f.Cell,{});const R=h[p],y=x?x(R):r.Intent.NONE;return e.jsxRuntimeExports.jsx(f.Cell,{intent:y,interactive:!0,className:"h-full",children:e.jsxRuntimeExports.jsx("div",{className:"absolute inset-0 px-2 py-1 flex items-center",onDoubleClick:()=>{u&&u(R)},children:k(i,R,R[i.key])})})},columnHeaderCellRenderer:()=>e.jsxRuntimeExports.jsx(f.ColumnHeaderCell,{name:i.name,menuRenderer:()=>z(i.sortKey??i.key)})},i.key))})}),e.jsxRuntimeExports.jsxs("div",{className:"table-pagination",children:[e.jsxRuntimeExports.jsxs("div",{className:"rows-select-container",children:[e.jsxRuntimeExports.jsx("span",{children:"Rows per page: "}),e.jsxRuntimeExports.jsx(D.Select,{items:U,itemRenderer:(i,{handleClick:p})=>e.jsxRuntimeExports.jsx(r.MenuItem,{text:i,onClick:p},i),onItemSelect:W,filterable:!1,disabled:o,children:e.jsxRuntimeExports.jsx(r.Button,{text:t.pageSize,endIcon:"double-caret-vertical"})})]}),e.jsxRuntimeExports.jsxs("div",{className:"flex flex-row items-center",children:[o&&e.jsxRuntimeExports.jsx(r.Spinner,{size:20}),e.jsxRuntimeExports.jsx(r.Button,{onClick:P,disabled:o||(n?n.first:!0),children:"Previous"}),e.jsxRuntimeExports.jsxs("span",{className:"pagination-page-info",children:["Page ",n?n.number+1:1," of ",n?n.totalPages:1]}),e.jsxRuntimeExports.jsx(r.Button,{onClick:S,disabled:o||(n?n.last:o),children:"Next"})]})]})]})},J=({value:s,trueText:t="Yes",falseText:n="No",trueIntent:o,falseIntent:a,round:c=!0,minimal:x=!0})=>s==null?null:e.jsxRuntimeExports.jsx(r.Tag,{intent:s?o:a,round:c,minimal:x,children:s?t:n}),K=[5,15,25,50,100,200],Q=({columns:s,data:t,actionButtons:n,isLoading:o,getIntent:a,pageSize:c,extraCopyMenus:x})=>{const[u,E]=j.useState(c),[m,b]=j.useState(0),C=j.useRef(null),{width:g}=H.useSize(C),h=u!=null,d=j.useMemo(()=>!h||!t?1:Math.ceil(t.length/u)||1,[t,u,h]),S=j.useMemo(()=>{if(!t)return[];if(!h)return t;const l=m*u;return t.slice(l,l+u)},[t,m,u,h]),P=(t?.length??0)>23&&!h,W=l=>{E(l),b(0)},z=l=>{const N=s.reduce((R,y)=>R+(y.width??0),0),v=s.filter(R=>R.width!==void 0).length;let p=(l-N-38)/(s.length-v);return p<150&&(p=150),s.map(R=>R.width??p)},k=j.useMemo(()=>z(g),[g,s]),_=async(l,N)=>{const i=t?.[l]?.[s[N].key],p=O(i);return navigator.clipboard||await I(p),p};return j.useEffect(()=>{b(0)},[t]),e.jsxRuntimeExports.jsxs("div",{className:"simple-datatable",style:P?{height:"70vh",overflow:"auto"}:void 0,ref:C,children:[n&&e.jsxRuntimeExports.jsx("div",{className:"flex justify-end mb-2",children:n}),e.jsxRuntimeExports.jsx(f.Table,{loadingOptions:o?[f.TableLoadingOption.COLUMN_HEADERS]:[],getCellClipboardData:_,cellRendererDependencies:[S,s,k,m],numRows:S.length,defaultRowHeight:25,enableColumnResizing:!1,enableRowResizing:!1,enableMultipleSelection:!1,selectionModes:f.SelectionModes.ROWS_AND_CELLS,columnWidths:k,focusMode:f.FocusMode.ROW,bodyContextMenuRenderer:l=>F(l,s,S,x),children:s.map(l=>e.jsxRuntimeExports.jsx(f.Column,{name:l.name,cellRenderer:N=>{const v=S[N],i=a?a(v):r.Intent.NONE;return v?e.jsxRuntimeExports.jsx(f.Cell,{intent:i,children:l.customCellRenderer?l.customCellRenderer(v):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:v[l.key]})}):e.jsxRuntimeExports.jsx(f.Cell,{intent:i})}},l.key))},`table-page-${m}-${u??"all"}`),h&&e.jsxRuntimeExports.jsxs("div",{className:"table-pagination flex items-center justify-between mt-2",children:[e.jsxRuntimeExports.jsxs("div",{className:"rows-select-container flex items-center gap-2",children:[e.jsxRuntimeExports.jsx("span",{children:"Rows per page: "}),e.jsxRuntimeExports.jsx(D.Select,{items:K,itemRenderer:(l,{handleClick:N})=>e.jsxRuntimeExports.jsx(r.MenuItem,{text:l,onClick:N},l),onItemSelect:W,filterable:!1,children:e.jsxRuntimeExports.jsx(r.Button,{text:u,endIcon:"double-caret-vertical"})})]}),e.jsxRuntimeExports.jsxs("div",{className:"flex flex-row items-center gap-2",children:[e.jsxRuntimeExports.jsx(r.Button,{onClick:()=>b(l=>Math.max(0,l-1)),disabled:m===0,children:"Previous"}),e.jsxRuntimeExports.jsxs("span",{className:"pagination-page-info px-2",children:["Page ",m+1," of ",d]}),e.jsxRuntimeExports.jsx(r.Button,{onClick:()=>b(l=>Math.min(d-1,l+1)),disabled:m>=d-1,children:"Next"})]})]})]})},X=({columns:s,data:t,getIntent:n})=>e.jsxRuntimeExports.jsxs("table",{className:"bp6-html-table simple-html-datatable w-full",children:[e.jsxRuntimeExports.jsx("thead",{children:e.jsxRuntimeExports.jsx("tr",{children:s.map((o,a)=>e.jsxRuntimeExports.jsx("th",{style:{width:o.width},children:o.name},a))})}),e.jsxRuntimeExports.jsx("tbody",{children:(t??[]).map((o,a)=>{const c=n?n(o):r.Intent.NONE;return e.jsxRuntimeExports.jsx("tr",{className:c!==r.Intent.NONE?`bp6-intent-${c}`:"",children:s.map((x,u)=>e.jsxRuntimeExports.jsx("td",{children:x.customCellRenderer?x.customCellRenderer(o):o[x.key]},u))},a)})})]}),Z=()=>{const[s,t]=j.useState(!1),[n,o]=j.useState(null),[a,c]=j.useState(null),x=j.useCallback(E=>(o(E),t(!0),new Promise(m=>{c(()=>m)})),[]),u=e.jsxRuntimeExports.jsx(r.Alert,{isOpen:s,intent:"primary",confirmButtonText:"Yes",cancelButtonText:"No",onConfirm:()=>{t(!1),a?.(!0),c(null)},onClose:()=>{t(!1),a?.(!1),c(null)},children:n});return[x,u]},q=({selectedValue:s,items:t=[],required:n=!1,disabled:o,onSelect:a,renderSelected:c,renderMenuText:x,getValueByItem:u,getItemByValue:E,renderMenuLabel:m,onBlur:b,intent:C="none"})=>{const g=n?t:[null,...t],h=s===void 0?void 0:E(s);return e.jsxRuntimeExports.jsx(D.Select,{items:g,disabled:o,onItemSelect:d=>{a(d??void 0)},filterable:!1,popoverProps:{onClose:()=>{b?.()}},itemRenderer:(d,{handleClick:S})=>d?e.jsxRuntimeExports.jsx(r.MenuItem,{text:x(d),onClick:S,labelElement:m?.(d)},String(u(d))):e.jsxRuntimeExports.jsx(r.MenuItem,{text:"— None —",onClick:S},"__none"),noResults:e.jsxRuntimeExports.jsx(r.MenuItem,{disabled:!0,text:"No records."}),children:e.jsxRuntimeExports.jsx(r.Button,{text:c(h)??"Select Value",intent:C,endIcon:"double-caret-vertical"})})},ee=({items:s=[],selectedValues:t=[],required:n=!1,disabled:o,getValueByItem:a,getItemByValue:c,renderSelected:x,renderMenuText:u,renderMenuLabel:E,onBlur:m,onSelect:b,onRemove:C})=>{const g=t.map(d=>c(d)),h=d=>{n&&g.length<=1||C(d)};return e.jsxRuntimeExports.jsx(D.MultiSelect,{disabled:o,items:s,selectedItems:g,onItemSelect:b,onRemove:h,popoverProps:{onClose:()=>{m?.()}},itemRenderer:(d,{handleClick:S})=>e.jsxRuntimeExports.jsx(r.MenuItem,{text:u(d),labelElement:E?.(d),onClick:S},String(a(d))),noResults:e.jsxRuntimeExports.jsx(r.MenuItem,{disabled:!0,text:"No records."}),tagRenderer:d=>x(d)})},te=({label:s,helpText:t,children:n})=>e.jsxRuntimeExports.jsx(r.FormGroup,{label:e.jsxRuntimeExports.jsx("div",{className:"flex flex-col items-start gap-1",children:e.jsxRuntimeExports.jsx(r.H6,{className:"m-0 whitespace-nowrap w-30",children:s})}),helperText:t,inline:!0,contentClassName:"w-full",children:n}),se=s=>{const[t,n]=j.useState(s);j.useEffect(()=>{n(s)},[s]);const o=j.useCallback((c,x)=>JSON.stringify(c)!==JSON.stringify(x),[]),a=j.useCallback((c,x)=>n(u=>({...u,[c]:x})),[]);return{value:t,setField:a,setValue:n,hasChanges:o}},ne=s=>{const{title:t,updatedAt:n,onChange:o,settings:a,getContent:c}=s,{value:x,setField:u,setValue:E,hasChanges:m}=se(a),b=m(a,x);return e.jsxRuntimeExports.jsx(r.Section,{title:t,rightElement:e.jsxRuntimeExports.jsx(r.Button,{type:"button",intent:"primary",disabled:!b,onClick:()=>o(x),children:"Save"}),subtitle:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:["Updated At: ",B.formatDateTime(n)]}),children:e.jsxRuntimeExports.jsx("div",{className:"m-4",children:c?c(x,u,E):null})})};exports.BooleanTag=G;exports.Datatable=Y;exports.SelectItem=q;exports.SelectMultipleItems=ee;exports.SettingGroup=te;exports.SettingsSectionBase=ne;exports.SimpleDatatable=Q;exports.SimpleHTMLDatatable=X;exports.TableCellTag=J;exports.copyTextToClipboard=I;exports.createCopyableText=O;exports.createPageRequest=w;exports.createTableCopyMenu=F;exports.useConfirmDialog=Z;