@ascendkit/nextjs 0.2.6 → 0.2.7
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/components/index.d.ts +1 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/user-button.d.ts +21 -2
- package/dist/components/user-button.d.ts.map +1 -1
- package/dist/components/user-button.js +26 -4
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -8,6 +8,6 @@ export { AscendKitAuthCard } from "./auth-card";
|
|
|
8
8
|
export { AuthModal } from "./auth-modal";
|
|
9
9
|
export { SignInButton } from "./sign-in-button";
|
|
10
10
|
export { SignUpButton } from "./sign-up-button";
|
|
11
|
-
export { AscendKitUserButton } from "./user-button";
|
|
11
|
+
export { AscendKitUserButton, type AscendKitUserButtonProps } from "./user-button";
|
|
12
12
|
export { BrandingBadge } from "./branding-badge";
|
|
13
13
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,KAAK,wBAAwB,EAAE,MAAM,eAAe,CAAC;AACnF,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -1,11 +1,30 @@
|
|
|
1
1
|
import { type UserButtonProps } from "@daveyplate/better-auth-ui";
|
|
2
|
+
export interface AscendKitUserButtonProps extends UserButtonProps {
|
|
3
|
+
/**
|
|
4
|
+
* When `true`, renders a compact avatar-only trigger suitable for collapsed
|
|
5
|
+
* sidebars. The dropdown opens to the right instead of above.
|
|
6
|
+
*
|
|
7
|
+
* @default false
|
|
8
|
+
* @example
|
|
9
|
+
* ```tsx
|
|
10
|
+
* <AscendKitUserButton collapsed={isSidebarCollapsed} />
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
collapsed?: boolean;
|
|
14
|
+
}
|
|
2
15
|
/**
|
|
3
16
|
* User avatar dropdown with sign-out, powered by Better Auth UI.
|
|
4
17
|
*
|
|
5
|
-
*
|
|
18
|
+
* Adapts to sidebar collapse state: when `collapsed` is true the trigger
|
|
19
|
+
* shrinks to a circular avatar with a chevron indicator and the dropdown
|
|
20
|
+
* opens to the right. When expanded (default) the full name, email and
|
|
21
|
+
* chevron are shown.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
6
24
|
* ```tsx
|
|
7
25
|
* <AscendKitUserButton />
|
|
26
|
+
* <AscendKitUserButton collapsed />
|
|
8
27
|
* ```
|
|
9
28
|
*/
|
|
10
|
-
export declare function AscendKitUserButton(props:
|
|
29
|
+
export declare function AscendKitUserButton({ collapsed, ...props }: AscendKitUserButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
11
30
|
//# sourceMappingURL=user-button.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user-button.d.ts","sourceRoot":"","sources":["../../src/components/user-button.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"user-button.d.ts","sourceRoot":"","sources":["../../src/components/user-button.tsx"],"names":[],"mappings":"AAIA,OAAO,EAIL,KAAK,eAAe,EACrB,MAAM,4BAA4B,CAAC;AAEpC,MAAM,WAAW,wBAAyB,SAAQ,eAAe;IAC/D;;;;;;;;;OASG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,SAAS,EACT,GAAG,KAAK,EACT,EAAE,wBAAwB,2CAe1B"}
|
|
@@ -1,14 +1,36 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef, useContext } from "react";
|
|
4
|
+
import { ChevronsUpDown } from "lucide-react";
|
|
5
|
+
import { AuthUIContext, UserAvatar, UserButton, } from "@daveyplate/better-auth-ui";
|
|
4
6
|
/**
|
|
5
7
|
* User avatar dropdown with sign-out, powered by Better Auth UI.
|
|
6
8
|
*
|
|
7
|
-
*
|
|
9
|
+
* Adapts to sidebar collapse state: when `collapsed` is true the trigger
|
|
10
|
+
* shrinks to a circular avatar with a chevron indicator and the dropdown
|
|
11
|
+
* opens to the right. When expanded (default) the full name, email and
|
|
12
|
+
* chevron are shown.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
8
15
|
* ```tsx
|
|
9
16
|
* <AscendKitUserButton />
|
|
17
|
+
* <AscendKitUserButton collapsed />
|
|
10
18
|
* ```
|
|
11
19
|
*/
|
|
12
|
-
export function AscendKitUserButton(props) {
|
|
20
|
+
export function AscendKitUserButton({ collapsed, ...props }) {
|
|
21
|
+
if (collapsed) {
|
|
22
|
+
return (_jsx(UserButton, { ...props, disableDefaultLinks: true, size: "icon", side: "right", align: "start", trigger: _jsx(CollapsedTrigger, {}) }));
|
|
23
|
+
}
|
|
13
24
|
return _jsx(UserButton, { ...props, disableDefaultLinks: true });
|
|
14
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* Compact trigger for collapsed sidebar: avatar circle + chevron arrows.
|
|
28
|
+
* Uses forwardRef so Radix's Slot (via DropdownMenuTrigger asChild) can
|
|
29
|
+
* attach its ref and event handlers (onClick, etc.) to the button.
|
|
30
|
+
*/
|
|
31
|
+
const CollapsedTrigger = forwardRef(function CollapsedTrigger(props, ref) {
|
|
32
|
+
const { hooks: { useSession }, } = useContext(AuthUIContext);
|
|
33
|
+
const { data: sessionData, isPending } = useSession();
|
|
34
|
+
const user = sessionData?.user;
|
|
35
|
+
return (_jsxs("button", { ref: ref, type: "button", ...props, className: `flex items-center gap-1 rounded-md p-1.5 transition hover:bg-accent/50 ${props.className ?? ""}`, children: [_jsx(UserAvatar, { user: user, isPending: isPending, className: "size-8" }), _jsx(ChevronsUpDown, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" })] }));
|
|
36
|
+
});
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { AscendKitAuth, createAscendKitAuthRuntime, createAscendKitAdapter, createAccessTokenHandler, Analytics, } from "./server";
|
|
2
2
|
export type { AscendKitAuthOptions, AscendKitSession, AscendKitUser, BrandingConfig } from "./shared/types";
|
|
3
3
|
export { AscendKitProvider, useAscendKitContext, useAscendKit, useAuthModal, useAccessToken, useSessions, useUser, useAnalytics, verifyEmail } from "./client";
|
|
4
|
-
export { Login, SignUp, EmailVerification, ForgotPassword, ResetPassword, SocialButton, AscendKitAuthCard, AuthModal, SignInButton, SignUpButton, AscendKitUserButton, BrandingBadge, } from "./components";
|
|
4
|
+
export { Login, SignUp, EmailVerification, ForgotPassword, ResetPassword, SocialButton, AscendKitAuthCard, AuthModal, SignInButton, SignUpButton, AscendKitUserButton, type AscendKitUserButtonProps, BrandingBadge, } from "./components";
|
|
5
5
|
export { SignedIn, SignedOut, AuthLoading } from "@daveyplate/better-auth-ui";
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,aAAa,EACb,0BAA0B,EAC1B,sBAAsB,EACtB,wBAAwB,EACxB,SAAS,GACV,MAAM,UAAU,CAAC;AAClB,YAAY,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAG5G,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,WAAW,EAAE,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAG/J,OAAO,EACL,KAAK,EACL,MAAM,EACN,iBAAiB,EACjB,cAAc,EACd,aAAa,EACb,YAAY,EACZ,iBAAiB,EACjB,SAAS,EACT,YAAY,EACZ,YAAY,EACZ,mBAAmB,EACnB,aAAa,GACd,MAAM,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