@nestledjs/data-browser 0.1.17 → 0.1.20
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/lib/components/RelationFieldWrapper.js +35 -22
- package/lib/components/filters/DateRangeFilter.js +39 -48
- package/lib/components/filters/NumberRangeFilter.js +43 -48
- package/lib/components/filters/RelationComponents.js +96 -102
- package/lib/components/filters/RelationFilterField.js +50 -47
- package/lib/components/shared/AdminBreadcrumbs.js +41 -45
- package/lib/components/shared/AdminErrorStates.js +47 -93
- package/lib/components/shared/AdminStatusDisplay.js +29 -36
- package/lib/context/AdminDataContext.js +10 -14
- package/lib/layouts/AdminDataLayout.js +90 -177
- package/lib/pages/AdminDataCreatePage.js +141 -267
- package/lib/pages/AdminDataEditPage.js +258 -460
- package/lib/pages/AdminDataIndexPage.js +31 -55
- package/lib/pages/AdminDataListPage.js +583 -597
- package/package.json +3 -3
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
1
2
|
import { useState, useRef, useCallback, useMemo } from "react";
|
|
2
3
|
import { useClickOutside } from "../../hooks/useClickOutside.js";
|
|
3
4
|
import { useRelationData } from "../../hooks/useRelationData.js";
|
|
4
5
|
import { formatFieldName } from "../../utils/string-utils.js";
|
|
5
6
|
import { RelationDropdownButton, RelationDropdownContent } from "./RelationComponents.js";
|
|
6
|
-
var _jsxFileName = "/Users/justinhandley/IdeaProjects/nestled_template/libs/data-browser/src/lib/components/filters/RelationFilterField.tsx";
|
|
7
7
|
function RelationFilterField({
|
|
8
8
|
fieldName,
|
|
9
9
|
relatedModelName,
|
|
@@ -17,23 +17,19 @@ function RelationFilterField({
|
|
|
17
17
|
setIsOpen(false);
|
|
18
18
|
}, []);
|
|
19
19
|
useClickOutside(dropdownRef, handleCloseDropdown, isOpen);
|
|
20
|
-
const {
|
|
21
|
-
relatedItems,
|
|
22
|
-
loading,
|
|
23
|
-
error: relationError,
|
|
24
|
-
hasDocument
|
|
25
|
-
} = useRelationData(
|
|
20
|
+
const { relatedItems, loading, error: relationError, hasDocument } = useRelationData(
|
|
26
21
|
relatedModelName,
|
|
27
22
|
searchTerm,
|
|
28
23
|
isOpen,
|
|
29
24
|
currentValue == null ? void 0 : currentValue.id
|
|
30
25
|
// Pass current value ID so it can be loaded even when dropdown is closed
|
|
31
26
|
);
|
|
32
|
-
const currentItem = useMemo(
|
|
27
|
+
const currentItem = useMemo(
|
|
28
|
+
() => (currentValue == null ? void 0 : currentValue.id) ? relatedItems.find((item) => item.id === currentValue.id) : null,
|
|
29
|
+
[currentValue == null ? void 0 : currentValue.id, relatedItems]
|
|
30
|
+
);
|
|
33
31
|
const handleSelect = useCallback((item) => {
|
|
34
|
-
onChange({
|
|
35
|
-
id: item.id
|
|
36
|
-
});
|
|
32
|
+
onChange({ id: item.id });
|
|
37
33
|
setIsOpen(false);
|
|
38
34
|
setSearchTerm("");
|
|
39
35
|
}, [onChange]);
|
|
@@ -49,43 +45,50 @@ function RelationFilterField({
|
|
|
49
45
|
}
|
|
50
46
|
}, [isOpen]);
|
|
51
47
|
if (!hasDocument) {
|
|
52
|
-
return /* @__PURE__ */
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
48
|
+
return /* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
49
|
+
/* @__PURE__ */ jsxs("label", { className: "block text-sm font-medium text-gray-700", children: [
|
|
50
|
+
formatFieldName(fieldName),
|
|
51
|
+
" ID"
|
|
52
|
+
] }),
|
|
53
|
+
/* @__PURE__ */ jsx(
|
|
54
|
+
"input",
|
|
55
|
+
{
|
|
56
|
+
type: "text",
|
|
57
|
+
value: (currentValue == null ? void 0 : currentValue.id) || "",
|
|
58
|
+
onChange: (e) => onChange(e.target.value ? { id: e.target.value } : void 0),
|
|
59
|
+
placeholder: "Enter ID...",
|
|
60
|
+
className: "w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-green-web focus:border-green-web text-sm"
|
|
61
|
+
}
|
|
62
|
+
)
|
|
63
|
+
] });
|
|
67
64
|
}
|
|
68
|
-
return /* @__PURE__ */
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
65
|
+
return /* @__PURE__ */ jsxs("div", { className: "space-y-1", ref: dropdownRef, children: [
|
|
66
|
+
/* @__PURE__ */ jsx("label", { className: "block text-sm font-medium text-gray-700", children: formatFieldName(fieldName) }),
|
|
67
|
+
/* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
68
|
+
/* @__PURE__ */ jsx(
|
|
69
|
+
RelationDropdownButton,
|
|
70
|
+
{
|
|
71
|
+
currentItem,
|
|
72
|
+
relatedModelName,
|
|
73
|
+
isOpen,
|
|
74
|
+
onClick: handleToggleOpen
|
|
75
|
+
}
|
|
76
|
+
),
|
|
77
|
+
isOpen && /* @__PURE__ */ jsx(
|
|
78
|
+
RelationDropdownContent,
|
|
79
|
+
{
|
|
80
|
+
searchTerm,
|
|
81
|
+
onSearchChange: setSearchTerm,
|
|
82
|
+
relatedModelName,
|
|
83
|
+
items: relatedItems,
|
|
84
|
+
loading,
|
|
85
|
+
error: relationError,
|
|
86
|
+
onSelect: handleSelect,
|
|
87
|
+
onClear: handleClear
|
|
88
|
+
}
|
|
89
|
+
)
|
|
90
|
+
] })
|
|
91
|
+
] });
|
|
89
92
|
}
|
|
90
93
|
export {
|
|
91
94
|
RelationFilterField
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Link } from "react-router";
|
|
3
3
|
import { HomeIcon, ChevronRightIcon } from "@heroicons/react/24/outline";
|
|
4
|
-
var _jsxFileName = "/Users/justinhandley/IdeaProjects/nestled_template/libs/data-browser/src/lib/components/shared/AdminBreadcrumbs.tsx";
|
|
5
4
|
function AdminBreadcrumbs({
|
|
6
5
|
items,
|
|
7
6
|
showHome = true,
|
|
@@ -10,52 +9,49 @@ function AdminBreadcrumbs({
|
|
|
10
9
|
}) {
|
|
11
10
|
const renderHomeLink = () => {
|
|
12
11
|
if (!showHome) return null;
|
|
13
|
-
return /* @__PURE__ */
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
fileName: _jsxFileName,
|
|
23
|
-
lineNumber: 36,
|
|
24
|
-
columnNumber: 11
|
|
25
|
-
} })));
|
|
12
|
+
return /* @__PURE__ */ jsx("li", { className: "flex items-center", children: /* @__PURE__ */ jsx(
|
|
13
|
+
Link,
|
|
14
|
+
{
|
|
15
|
+
to: homeHref,
|
|
16
|
+
className: "text-gray-400 hover:text-gray-500",
|
|
17
|
+
"aria-label": "Home",
|
|
18
|
+
children: /* @__PURE__ */ jsx(HomeIcon, { className: "h-5 w-5 flex-shrink-0" })
|
|
19
|
+
}
|
|
20
|
+
) }, "home");
|
|
26
21
|
};
|
|
27
22
|
const renderBreadcrumbItem = (item, index, isLast) => {
|
|
28
|
-
const content = item.href && !item.isActive ? /* @__PURE__ */
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
23
|
+
const content = item.href && !item.isActive ? /* @__PURE__ */ jsx(
|
|
24
|
+
Link,
|
|
25
|
+
{
|
|
26
|
+
to: item.href,
|
|
27
|
+
className: "text-sm font-medium text-gray-500 hover:text-gray-700",
|
|
28
|
+
children: item.label
|
|
29
|
+
}
|
|
30
|
+
) : /* @__PURE__ */ jsx(
|
|
31
|
+
"span",
|
|
32
|
+
{
|
|
33
|
+
className: `text-sm font-medium ${item.isActive ? "text-gray-900" : "text-gray-500"}`,
|
|
34
|
+
children: item.label
|
|
35
|
+
}
|
|
36
|
+
);
|
|
37
|
+
return /* @__PURE__ */ jsxs("li", { className: "flex items-center", children: [
|
|
38
|
+
(showHome || index > 0) && /* @__PURE__ */ jsx(
|
|
39
|
+
ChevronRightIcon,
|
|
40
|
+
{
|
|
41
|
+
className: "h-5 w-5 flex-shrink-0 text-gray-400 mr-4",
|
|
42
|
+
"aria-hidden": "true"
|
|
43
|
+
}
|
|
44
|
+
),
|
|
45
|
+
content
|
|
46
|
+
] }, item.id);
|
|
46
47
|
};
|
|
47
|
-
return /* @__PURE__ */
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
columnNumber: 7
|
|
55
|
-
} }, renderHomeLink(), items.map((item, index) => {
|
|
56
|
-
index === items.length - 1;
|
|
57
|
-
return renderBreadcrumbItem(item, index);
|
|
58
|
-
})));
|
|
48
|
+
return /* @__PURE__ */ jsx("nav", { className: `flex ${className}`, "aria-label": "Breadcrumb", children: /* @__PURE__ */ jsxs("ol", { className: "flex items-center space-x-4", children: [
|
|
49
|
+
renderHomeLink(),
|
|
50
|
+
items.map((item, index) => {
|
|
51
|
+
index === items.length - 1;
|
|
52
|
+
return renderBreadcrumbItem(item, index);
|
|
53
|
+
})
|
|
54
|
+
] }) });
|
|
59
55
|
}
|
|
60
56
|
export {
|
|
61
57
|
AdminBreadcrumbs
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { XCircleIcon, ExclamationCircleIcon, ExclamationTriangleIcon } from "@heroicons/react/24/outline";
|
|
3
|
-
var _jsxFileName = "/Users/justinhandley/IdeaProjects/nestled_template/libs/data-browser/src/lib/components/shared/AdminErrorStates.tsx";
|
|
4
3
|
const getSeverityConfig = (severity) => {
|
|
5
4
|
const configs = {
|
|
6
5
|
warning: {
|
|
@@ -44,55 +43,33 @@ function AdminErrorState({
|
|
|
44
43
|
}) {
|
|
45
44
|
const config = getSeverityConfig(severity);
|
|
46
45
|
const IconComponent = config.icon;
|
|
47
|
-
return /* @__PURE__ */
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
columnNumber: 13
|
|
75
|
-
} }, /* @__PURE__ */ React.createElement("p", { __self: this, __source: {
|
|
76
|
-
fileName: _jsxFileName,
|
|
77
|
-
lineNumber: 91,
|
|
78
|
-
columnNumber: 15
|
|
79
|
-
} }, message)), (onRetry || onDismiss) && /* @__PURE__ */ React.createElement("div", { className: "mt-4", __self: this, __source: {
|
|
80
|
-
fileName: _jsxFileName,
|
|
81
|
-
lineNumber: 95,
|
|
82
|
-
columnNumber: 13
|
|
83
|
-
} }, /* @__PURE__ */ React.createElement("div", { className: "-mx-2 -my-1.5 flex", __self: this, __source: {
|
|
84
|
-
fileName: _jsxFileName,
|
|
85
|
-
lineNumber: 96,
|
|
86
|
-
columnNumber: 15
|
|
87
|
-
} }, onRetry && /* @__PURE__ */ React.createElement("button", { type: "button", onClick: onRetry, className: `rounded-md px-2 py-1.5 text-sm font-medium ${config.buttonColor} focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500`, __self: this, __source: {
|
|
88
|
-
fileName: _jsxFileName,
|
|
89
|
-
lineNumber: 98,
|
|
90
|
-
columnNumber: 19
|
|
91
|
-
} }, "Try Again"), onDismiss && /* @__PURE__ */ React.createElement("button", { type: "button", onClick: onDismiss, className: `ml-3 rounded-md px-2 py-1.5 text-sm font-medium ${config.buttonColor} focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500`, __self: this, __source: {
|
|
92
|
-
fileName: _jsxFileName,
|
|
93
|
-
lineNumber: 107,
|
|
94
|
-
columnNumber: 19
|
|
95
|
-
} }, "Dismiss"))))));
|
|
46
|
+
return /* @__PURE__ */ jsx("div", { className: `rounded-md border p-4 ${config.bgColor} ${config.borderColor} ${className}`, children: /* @__PURE__ */ jsxs("div", { className: "flex", children: [
|
|
47
|
+
showIcon && /* @__PURE__ */ jsx("div", { className: "flex-shrink-0", children: /* @__PURE__ */ jsx(IconComponent, { className: `h-5 w-5 ${config.iconColor}`, "aria-hidden": "true" }) }),
|
|
48
|
+
/* @__PURE__ */ jsxs("div", { className: showIcon ? "ml-3" : "", children: [
|
|
49
|
+
/* @__PURE__ */ jsx("h3", { className: `text-sm font-medium ${config.titleColor}`, children: title }),
|
|
50
|
+
message && /* @__PURE__ */ jsx("div", { className: `mt-2 text-sm ${config.messageColor}`, children: /* @__PURE__ */ jsx("p", { children: message }) }),
|
|
51
|
+
(onRetry || onDismiss) && /* @__PURE__ */ jsx("div", { className: "mt-4", children: /* @__PURE__ */ jsxs("div", { className: "-mx-2 -my-1.5 flex", children: [
|
|
52
|
+
onRetry && /* @__PURE__ */ jsx(
|
|
53
|
+
"button",
|
|
54
|
+
{
|
|
55
|
+
type: "button",
|
|
56
|
+
onClick: onRetry,
|
|
57
|
+
className: `rounded-md px-2 py-1.5 text-sm font-medium ${config.buttonColor} focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500`,
|
|
58
|
+
children: "Try Again"
|
|
59
|
+
}
|
|
60
|
+
),
|
|
61
|
+
onDismiss && /* @__PURE__ */ jsx(
|
|
62
|
+
"button",
|
|
63
|
+
{
|
|
64
|
+
type: "button",
|
|
65
|
+
onClick: onDismiss,
|
|
66
|
+
className: `ml-3 rounded-md px-2 py-1.5 text-sm font-medium ${config.buttonColor} focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500`,
|
|
67
|
+
children: "Dismiss"
|
|
68
|
+
}
|
|
69
|
+
)
|
|
70
|
+
] }) })
|
|
71
|
+
] })
|
|
72
|
+
] }) });
|
|
96
73
|
}
|
|
97
74
|
function AdminEmptyState({
|
|
98
75
|
title,
|
|
@@ -102,31 +79,20 @@ function AdminEmptyState({
|
|
|
102
79
|
className = "",
|
|
103
80
|
icon: IconComponent
|
|
104
81
|
}) {
|
|
105
|
-
return /* @__PURE__ */
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
lineNumber: 139,
|
|
120
|
-
columnNumber: 9
|
|
121
|
-
} }, message), actionLabel && onAction && /* @__PURE__ */ React.createElement("div", { className: "mt-6", __self: this, __source: {
|
|
122
|
-
fileName: _jsxFileName,
|
|
123
|
-
lineNumber: 142,
|
|
124
|
-
columnNumber: 9
|
|
125
|
-
} }, /* @__PURE__ */ React.createElement("button", { type: "button", onClick: onAction, className: "inline-flex items-center rounded-md bg-green-web px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-green-web-800 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-green-web", __self: this, __source: {
|
|
126
|
-
fileName: _jsxFileName,
|
|
127
|
-
lineNumber: 143,
|
|
128
|
-
columnNumber: 11
|
|
129
|
-
} }, actionLabel)));
|
|
82
|
+
return /* @__PURE__ */ jsxs("div", { className: `text-center ${className}`, children: [
|
|
83
|
+
IconComponent && /* @__PURE__ */ jsx(IconComponent, { className: "mx-auto h-12 w-12 text-gray-400" }),
|
|
84
|
+
/* @__PURE__ */ jsx("h3", { className: "mt-2 text-sm font-medium text-gray-900", children: title }),
|
|
85
|
+
message && /* @__PURE__ */ jsx("p", { className: "mt-1 text-sm text-gray-500", children: message }),
|
|
86
|
+
actionLabel && onAction && /* @__PURE__ */ jsx("div", { className: "mt-6", children: /* @__PURE__ */ jsx(
|
|
87
|
+
"button",
|
|
88
|
+
{
|
|
89
|
+
type: "button",
|
|
90
|
+
onClick: onAction,
|
|
91
|
+
className: "inline-flex items-center rounded-md bg-green-web px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-green-web-800 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-green-web",
|
|
92
|
+
children: actionLabel
|
|
93
|
+
}
|
|
94
|
+
) })
|
|
95
|
+
] });
|
|
130
96
|
}
|
|
131
97
|
function AdminLoadingState({
|
|
132
98
|
title = "Loading...",
|
|
@@ -142,23 +108,11 @@ function AdminLoadingState({
|
|
|
142
108
|
};
|
|
143
109
|
return sizes[size];
|
|
144
110
|
};
|
|
145
|
-
return /* @__PURE__ */
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
fileName: _jsxFileName,
|
|
151
|
-
lineNumber: 173,
|
|
152
|
-
columnNumber: 7
|
|
153
|
-
} }), /* @__PURE__ */ React.createElement("h3", { className: "mt-4 text-sm font-medium text-gray-900", __self: this, __source: {
|
|
154
|
-
fileName: _jsxFileName,
|
|
155
|
-
lineNumber: 174,
|
|
156
|
-
columnNumber: 7
|
|
157
|
-
} }, title), message && /* @__PURE__ */ React.createElement("p", { className: "mt-1 text-sm text-gray-500", __self: this, __source: {
|
|
158
|
-
fileName: _jsxFileName,
|
|
159
|
-
lineNumber: 176,
|
|
160
|
-
columnNumber: 9
|
|
161
|
-
} }, message));
|
|
111
|
+
return /* @__PURE__ */ jsxs("div", { className: `flex flex-col items-center justify-center p-8 ${className}`, children: [
|
|
112
|
+
/* @__PURE__ */ jsx("div", { className: `animate-spin rounded-full border-b-2 border-green-web ${getSizeClasses()}` }),
|
|
113
|
+
/* @__PURE__ */ jsx("h3", { className: "mt-4 text-sm font-medium text-gray-900", children: title }),
|
|
114
|
+
message && /* @__PURE__ */ jsx("p", { className: "mt-1 text-sm text-gray-500", children: message })
|
|
115
|
+
] });
|
|
162
116
|
}
|
|
163
117
|
export {
|
|
164
118
|
AdminEmptyState,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { QuestionMarkCircleIcon, PauseCircleIcon, CheckCircleIcon, XCircleIcon, ExclamationTriangleIcon, ClockIcon } from "@heroicons/react/24/solid";
|
|
3
|
-
var _jsxFileName = "/Users/justinhandley/IdeaProjects/nestled_template/libs/data-browser/src/lib/components/shared/AdminStatusDisplay.tsx";
|
|
4
3
|
const getStatusConfig = (status) => {
|
|
5
4
|
const configs = {
|
|
6
5
|
active: {
|
|
@@ -152,38 +151,35 @@ function AdminStatusDisplay({
|
|
|
152
151
|
const finalClasses = `${baseClasses} ${interactiveClasses} ${className}`.trim();
|
|
153
152
|
const renderDot = () => {
|
|
154
153
|
if (!shouldShowDot) return null;
|
|
155
|
-
return /* @__PURE__ */
|
|
156
|
-
fileName: _jsxFileName,
|
|
157
|
-
lineNumber: 221,
|
|
158
|
-
columnNumber: 7
|
|
159
|
-
} });
|
|
154
|
+
return /* @__PURE__ */ jsx("span", { className: `inline-block rounded-full mr-2 ${config.bgColor.replace("bg-", "bg-").replace("-100", "-400")} ${sizeClasses.dot}` });
|
|
160
155
|
};
|
|
161
156
|
const renderIcon = () => {
|
|
162
157
|
if (!shouldShowIcon) return null;
|
|
163
|
-
return /* @__PURE__ */
|
|
164
|
-
fileName: _jsxFileName,
|
|
165
|
-
lineNumber: 229,
|
|
166
|
-
columnNumber: 7
|
|
167
|
-
} });
|
|
158
|
+
return /* @__PURE__ */ jsx(IconComponent, { className: `${sizeClasses.icon} ${displayLabel ? "mr-1.5" : ""}` });
|
|
168
159
|
};
|
|
169
|
-
const content = /* @__PURE__ */
|
|
160
|
+
const content = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
161
|
+
renderDot(),
|
|
162
|
+
renderIcon(),
|
|
163
|
+
displayLabel
|
|
164
|
+
] });
|
|
170
165
|
const handleClick = () => {
|
|
171
166
|
if (onClick) {
|
|
172
167
|
onClick();
|
|
173
168
|
}
|
|
174
169
|
};
|
|
175
170
|
if (isClickable) {
|
|
176
|
-
return /* @__PURE__ */
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
171
|
+
return /* @__PURE__ */ jsx(
|
|
172
|
+
"button",
|
|
173
|
+
{
|
|
174
|
+
type: "button",
|
|
175
|
+
onClick: handleClick,
|
|
176
|
+
className: finalClasses,
|
|
177
|
+
title: tooltip,
|
|
178
|
+
children: content
|
|
179
|
+
}
|
|
180
|
+
);
|
|
181
181
|
}
|
|
182
|
-
return /* @__PURE__ */
|
|
183
|
-
fileName: _jsxFileName,
|
|
184
|
-
lineNumber: 261,
|
|
185
|
-
columnNumber: 5
|
|
186
|
-
} }, content);
|
|
182
|
+
return /* @__PURE__ */ jsx("span", { className: finalClasses, title: tooltip, children: content });
|
|
187
183
|
}
|
|
188
184
|
function AdminUserStatus({
|
|
189
185
|
status,
|
|
@@ -195,19 +191,16 @@ function AdminUserStatus({
|
|
|
195
191
|
const sizeClasses = getSizeClasses(size);
|
|
196
192
|
const dotSizeClass = sizeClasses.dot;
|
|
197
193
|
const textSizeClass = showLabel ? sizeClasses.text : "";
|
|
198
|
-
return /* @__PURE__ */
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
lineNumber: 286,
|
|
209
|
-
columnNumber: 9
|
|
210
|
-
} }, config.label));
|
|
194
|
+
return /* @__PURE__ */ jsxs("div", { className: `inline-flex items-center ${className}`, children: [
|
|
195
|
+
/* @__PURE__ */ jsx(
|
|
196
|
+
"span",
|
|
197
|
+
{
|
|
198
|
+
className: `inline-block rounded-full ${config.color} ${dotSizeClass}`,
|
|
199
|
+
"aria-label": config.label
|
|
200
|
+
}
|
|
201
|
+
),
|
|
202
|
+
showLabel && /* @__PURE__ */ jsx("span", { className: `ml-2 text-gray-700 ${textSizeClass}`, children: config.label })
|
|
203
|
+
] });
|
|
211
204
|
}
|
|
212
205
|
export {
|
|
213
206
|
AdminStatusDisplay,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useMemo, useContext } from "react";
|
|
3
3
|
const AdminDataContext = createContext(null);
|
|
4
4
|
function AdminDataProvider({
|
|
5
5
|
children,
|
|
@@ -8,22 +8,18 @@ function AdminDataProvider({
|
|
|
8
8
|
basePath = "/admin/data",
|
|
9
9
|
formTheme
|
|
10
10
|
}) {
|
|
11
|
-
const value = useMemo(
|
|
12
|
-
sdk,
|
|
13
|
-
databaseModels,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}), [sdk, databaseModels, basePath, formTheme]);
|
|
17
|
-
return /* @__PURE__ */ React.createElement(AdminDataContext.Provider, { value, __self: this, __source: {
|
|
18
|
-
fileName: _jsxFileName,
|
|
19
|
-
lineNumber: 60,
|
|
20
|
-
columnNumber: 5
|
|
21
|
-
} }, children);
|
|
11
|
+
const value = useMemo(
|
|
12
|
+
() => ({ sdk, databaseModels, basePath, formTheme }),
|
|
13
|
+
[sdk, databaseModels, basePath, formTheme]
|
|
14
|
+
);
|
|
15
|
+
return /* @__PURE__ */ jsx(AdminDataContext.Provider, { value, children });
|
|
22
16
|
}
|
|
23
17
|
function useAdminDataContext() {
|
|
24
18
|
const context = useContext(AdminDataContext);
|
|
25
19
|
if (!context) {
|
|
26
|
-
throw new Error(
|
|
20
|
+
throw new Error(
|
|
21
|
+
"useAdminDataContext must be used within AdminDataProvider. Make sure to wrap your admin data routes with <AdminDataProvider>."
|
|
22
|
+
);
|
|
27
23
|
}
|
|
28
24
|
return context;
|
|
29
25
|
}
|