@greatapps/greatauth-ui 0.3.16 → 0.3.18
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/dist/index.js +38 -32
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/app-sidebar.tsx +9 -1
package/dist/index.js
CHANGED
|
@@ -779,6 +779,7 @@ function SidebarMenuButton({
|
|
|
779
779
|
}
|
|
780
780
|
|
|
781
781
|
// src/components/app-sidebar.tsx
|
|
782
|
+
import { useState as useState3, useEffect as useEffect3 } from "react";
|
|
782
783
|
import { usePathname, useRouter } from "next/navigation";
|
|
783
784
|
import Link from "next/link";
|
|
784
785
|
import { ChevronsUpDown, ChevronRight as ChevronRight2, LogOut } from "lucide-react";
|
|
@@ -1024,7 +1025,12 @@ function CollapsibleMenuItem({ item, pathname }) {
|
|
|
1024
1025
|
const isChildActive = item.children?.some(
|
|
1025
1026
|
(child) => child.isActive !== void 0 ? child.isActive : pathname.startsWith(child.href)
|
|
1026
1027
|
) ?? false;
|
|
1027
|
-
|
|
1028
|
+
const isActive = isParentActive || isChildActive;
|
|
1029
|
+
const [open, setOpen] = useState3(isActive);
|
|
1030
|
+
useEffect3(() => {
|
|
1031
|
+
setOpen(isActive);
|
|
1032
|
+
}, [isActive]);
|
|
1033
|
+
return /* @__PURE__ */ jsx12(Collapsible, { open, onOpenChange: setOpen, className: "group/collapsible", children: /* @__PURE__ */ jsxs5(SidebarMenuItem, { children: [
|
|
1028
1034
|
/* @__PURE__ */ jsx12(SidebarMenuButton, { asChild: true, isActive: isParentActive, tooltip: item.label, children: /* @__PURE__ */ jsxs5(Link, { href: item.href, onClick: item.onClick, children: [
|
|
1029
1035
|
/* @__PURE__ */ jsx12(Icon, { className: "size-4" }),
|
|
1030
1036
|
/* @__PURE__ */ jsx12("span", { children: item.label })
|
|
@@ -1294,7 +1300,7 @@ function AppShell({ config, children, renderAbove }) {
|
|
|
1294
1300
|
}
|
|
1295
1301
|
|
|
1296
1302
|
// src/components/login-form.tsx
|
|
1297
|
-
import { useState as
|
|
1303
|
+
import { useState as useState4 } from "react";
|
|
1298
1304
|
import { useRouter as useRouter2, useSearchParams } from "next/navigation";
|
|
1299
1305
|
import { Loader2, Mail, Lock, AlertCircle, Eye, EyeOff } from "lucide-react";
|
|
1300
1306
|
|
|
@@ -1324,11 +1330,11 @@ function LoginForm({ config }) {
|
|
|
1324
1330
|
const router = useRouter2();
|
|
1325
1331
|
const searchParams = useSearchParams();
|
|
1326
1332
|
const callbackUrl = searchParams.get("callbackUrl") || config.callbackUrlDefault;
|
|
1327
|
-
const [email, setEmail] =
|
|
1328
|
-
const [password, setPassword] =
|
|
1329
|
-
const [loading, setLoading] =
|
|
1330
|
-
const [error, setError] =
|
|
1331
|
-
const [showPassword, setShowPassword] =
|
|
1333
|
+
const [email, setEmail] = useState4("");
|
|
1334
|
+
const [password, setPassword] = useState4("");
|
|
1335
|
+
const [loading, setLoading] = useState4(false);
|
|
1336
|
+
const [error, setError] = useState4("");
|
|
1337
|
+
const [showPassword, setShowPassword] = useState4(false);
|
|
1332
1338
|
const handleSubmit = async (e) => {
|
|
1333
1339
|
e.preventDefault();
|
|
1334
1340
|
if (loading) return;
|
|
@@ -1523,7 +1529,7 @@ function EntityAvatar({
|
|
|
1523
1529
|
}
|
|
1524
1530
|
|
|
1525
1531
|
// src/components/image-crop-upload.tsx
|
|
1526
|
-
import { useCallback as useCallback3, useRef, useState as
|
|
1532
|
+
import { useCallback as useCallback3, useRef, useState as useState5 } from "react";
|
|
1527
1533
|
import Cropper from "react-easy-crop";
|
|
1528
1534
|
|
|
1529
1535
|
// src/components/ui/dialog.tsx
|
|
@@ -1782,12 +1788,12 @@ function ImageCropUpload({
|
|
|
1782
1788
|
name,
|
|
1783
1789
|
disabled = false
|
|
1784
1790
|
}) {
|
|
1785
|
-
const [imageSrc, setImageSrc] =
|
|
1786
|
-
const [crop, setCrop] =
|
|
1787
|
-
const [zoom, setZoom] =
|
|
1788
|
-
const [croppedArea, setCroppedArea] =
|
|
1789
|
-
const [isOpen, setIsOpen] =
|
|
1790
|
-
const [isUploading, setIsUploading] =
|
|
1791
|
+
const [imageSrc, setImageSrc] = useState5(null);
|
|
1792
|
+
const [crop, setCrop] = useState5({ x: 0, y: 0 });
|
|
1793
|
+
const [zoom, setZoom] = useState5(1);
|
|
1794
|
+
const [croppedArea, setCroppedArea] = useState5(null);
|
|
1795
|
+
const [isOpen, setIsOpen] = useState5(false);
|
|
1796
|
+
const [isUploading, setIsUploading] = useState5(false);
|
|
1791
1797
|
const inputRef = useRef(null);
|
|
1792
1798
|
const onCropComplete = useCallback3((_, croppedAreaPixels) => {
|
|
1793
1799
|
setCroppedArea(croppedAreaPixels);
|
|
@@ -2029,10 +2035,10 @@ function useResetPassword(config) {
|
|
|
2029
2035
|
}
|
|
2030
2036
|
|
|
2031
2037
|
// src/components/users/users-page.tsx
|
|
2032
|
-
import { useMemo as useMemo4, useState as
|
|
2038
|
+
import { useMemo as useMemo4, useState as useState8 } from "react";
|
|
2033
2039
|
|
|
2034
2040
|
// src/components/users/user-form-dialog.tsx
|
|
2035
|
-
import { useEffect as
|
|
2041
|
+
import { useEffect as useEffect4, useState as useState6 } from "react";
|
|
2036
2042
|
|
|
2037
2043
|
// src/components/ui/select.tsx
|
|
2038
2044
|
import { Select as SelectPrimitive } from "radix-ui";
|
|
@@ -2176,13 +2182,13 @@ function UserFormDialog({
|
|
|
2176
2182
|
const isEditing = !!user;
|
|
2177
2183
|
const createUser = useCreateUser(config);
|
|
2178
2184
|
const updateUser = useUpdateUser(config);
|
|
2179
|
-
const [name, setName] =
|
|
2180
|
-
const [lastName, setLastName] =
|
|
2181
|
-
const [email, setEmail] =
|
|
2182
|
-
const [profile, setProfile] =
|
|
2183
|
-
const [password, setPassword] =
|
|
2184
|
-
const [photo, setPhoto] =
|
|
2185
|
-
|
|
2185
|
+
const [name, setName] = useState6("");
|
|
2186
|
+
const [lastName, setLastName] = useState6("");
|
|
2187
|
+
const [email, setEmail] = useState6("");
|
|
2188
|
+
const [profile, setProfile] = useState6("collaborator");
|
|
2189
|
+
const [password, setPassword] = useState6("");
|
|
2190
|
+
const [photo, setPhoto] = useState6("");
|
|
2191
|
+
useEffect4(() => {
|
|
2186
2192
|
if (user) {
|
|
2187
2193
|
setName(user.name || "");
|
|
2188
2194
|
setLastName(user.last_name || "");
|
|
@@ -2311,7 +2317,7 @@ import {
|
|
|
2311
2317
|
getSortedRowModel,
|
|
2312
2318
|
useReactTable
|
|
2313
2319
|
} from "@tanstack/react-table";
|
|
2314
|
-
import { useState as
|
|
2320
|
+
import { useState as useState7 } from "react";
|
|
2315
2321
|
|
|
2316
2322
|
// src/components/ui/table.tsx
|
|
2317
2323
|
import { jsx as jsx26 } from "react/jsx-runtime";
|
|
@@ -2393,7 +2399,7 @@ function DataTable({
|
|
|
2393
2399
|
getRowId,
|
|
2394
2400
|
compact
|
|
2395
2401
|
}) {
|
|
2396
|
-
const [sorting, setSorting] =
|
|
2402
|
+
const [sorting, setSorting] = useState7([]);
|
|
2397
2403
|
const table = useReactTable({
|
|
2398
2404
|
data,
|
|
2399
2405
|
columns,
|
|
@@ -2716,9 +2722,9 @@ function useColumns(onEdit, onDelete, onResetPassword) {
|
|
|
2716
2722
|
];
|
|
2717
2723
|
}
|
|
2718
2724
|
function UsersPage({ config, renderPhones }) {
|
|
2719
|
-
const [search, setSearch] =
|
|
2720
|
-
const [profileFilter, setProfileFilter] =
|
|
2721
|
-
const [page, setPage] =
|
|
2725
|
+
const [search, setSearch] = useState8("");
|
|
2726
|
+
const [profileFilter, setProfileFilter] = useState8("all");
|
|
2727
|
+
const [page, setPage] = useState8(1);
|
|
2722
2728
|
const queryParams = useMemo4(() => {
|
|
2723
2729
|
const params = {
|
|
2724
2730
|
limit: String(PAGE_SIZE),
|
|
@@ -2730,10 +2736,10 @@ function UsersPage({ config, renderPhones }) {
|
|
|
2730
2736
|
const { data, isLoading } = useUsers(config, queryParams);
|
|
2731
2737
|
const deleteUser = useDeleteUser(config);
|
|
2732
2738
|
const resetPassword = useResetPassword(config);
|
|
2733
|
-
const [editUser, setEditUser] =
|
|
2734
|
-
const [formOpen, setFormOpen] =
|
|
2735
|
-
const [deleteId, setDeleteId] =
|
|
2736
|
-
const [resetUser, setResetUser] =
|
|
2739
|
+
const [editUser, setEditUser] = useState8(null);
|
|
2740
|
+
const [formOpen, setFormOpen] = useState8(false);
|
|
2741
|
+
const [deleteId, setDeleteId] = useState8(null);
|
|
2742
|
+
const [resetUser, setResetUser] = useState8(null);
|
|
2737
2743
|
const users = data?.data || [];
|
|
2738
2744
|
const total = data?.total || 0;
|
|
2739
2745
|
const filtered = useMemo4(() => {
|