@clerk/react 6.15.0-snapshot.v20260828154440 → 6.15.0
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/{ClerkProvider-CfRnNXpM.cjs → ClerkProvider-CrxNp9Vs.cjs} +17 -5
- package/dist/ClerkProvider-CrxNp9Vs.cjs.map +1 -0
- package/dist/{ClerkProvider-DEMd6F9Y.mjs → ClerkProvider-uQrBRtCz.mjs} +16 -3
- package/dist/ClerkProvider-uQrBRtCz.mjs.map +1 -0
- package/dist/experimental.cjs +2 -3
- package/dist/experimental.cjs.map +1 -1
- package/dist/experimental.d.cts +1 -1
- package/dist/experimental.d.mts +1 -1
- package/dist/experimental.mjs +1 -1
- package/dist/{hooks-DDBmec72.mjs → hooks-66XwX3F0.mjs} +32 -3
- package/dist/hooks-66XwX3F0.mjs.map +1 -0
- package/dist/{hooks-DfHFYxET.cjs → hooks-ByQmbuum.cjs} +70 -3
- package/dist/hooks-ByQmbuum.cjs.map +1 -0
- package/dist/index.cjs +14 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +23 -5
- package/dist/index.d.mts +23 -5
- package/dist/index.mjs +3 -3
- package/dist/internal.cjs +2 -2
- package/dist/internal.d.cts +2 -2
- package/dist/internal.d.mts +2 -2
- package/dist/internal.mjs +2 -2
- package/dist/{types-DOCvRkP3.d.cts → types-8bkUI4Jw.d.mts} +7 -3
- package/dist/{types-DouCnLTT.d.mts → types-CJU-2SXy.d.cts} +7 -3
- package/dist/types.d.cts +1 -1
- package/dist/types.d.mts +1 -1
- package/dist/{useAuth-BIGqYRKT.d.cts → useAuth-B1VefVbj.d.mts} +3 -3
- package/dist/{useAuth-DO2sSUTl.d.mts → useAuth-szFCQqhS.d.cts} +3 -3
- package/package.json +6 -17
- package/dist/ClerkProvider-CfRnNXpM.cjs.map +0 -1
- package/dist/ClerkProvider-DEMd6F9Y.mjs.map +0 -1
- package/dist/chunk-C_NdSu1c.cjs +0 -34
- package/dist/experimental/mosaic/styles.css +0 -2294
- package/dist/experimental/mosaic.cjs +0 -10973
- package/dist/experimental/mosaic.cjs.map +0 -1
- package/dist/experimental/mosaic.d.cts +0 -239
- package/dist/experimental/mosaic.d.mts +0 -239
- package/dist/experimental/mosaic.mjs +0 -10971
- package/dist/experimental/mosaic.mjs.map +0 -1
- package/dist/hooks-DDBmec72.mjs.map +0 -1
- package/dist/hooks-DfHFYxET.cjs.map +0 -1
|
@@ -1,239 +0,0 @@
|
|
|
1
|
-
import { OrganizationResource, UserResource } from "@clerk/shared/types";
|
|
2
|
-
import { ReactElement, ReactNode } from "react";
|
|
3
|
-
|
|
4
|
-
//#region ../ui/dist-mosaic/index.d.ts
|
|
5
|
-
//#region src/mosaic/user-button/user-button.types.d.ts
|
|
6
|
-
/**
|
|
7
|
-
* Which switchers the surface carries. `combined` is both; `organization` is an organization
|
|
8
|
-
* switcher with no account rows; `user` is an account switcher that never shows an organization,
|
|
9
|
-
* even when one is active.
|
|
10
|
-
*/
|
|
11
|
-
type UserButtonMode = 'combined' | 'organization' | 'user';
|
|
12
|
-
/**
|
|
13
|
-
* Which of the two switchers a `combined` surface leads with: the one named in the trigger and
|
|
14
|
-
* headed in the popup. Both are still listed either way. The single-purpose modes have only one
|
|
15
|
-
* thing to lead with, so they ignore it.
|
|
16
|
-
*/
|
|
17
|
-
type UserButtonModePriority = 'organization' | 'user';
|
|
18
|
-
/** Which switchers the surface carries, and which one it leads with. */
|
|
19
|
-
interface UserButtonModeProps {
|
|
20
|
-
/**
|
|
21
|
-
* Which switchers the popup carries: both, organizations alone, or accounts alone.
|
|
22
|
-
*
|
|
23
|
-
* @default 'combined'
|
|
24
|
-
*/
|
|
25
|
-
mode?: UserButtonMode;
|
|
26
|
-
/**
|
|
27
|
-
* Which switcher a `combined` surface leads with in the trigger and the popup's header. The other
|
|
28
|
-
* one is still listed. Ignored by the single-purpose modes, which have only one thing to lead with.
|
|
29
|
-
*
|
|
30
|
-
* @default 'organization'
|
|
31
|
-
*/
|
|
32
|
-
modePriority?: UserButtonModePriority;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* A built-in action the foot of the popup lists as a row of its own, named by the id `menuItemOrder`
|
|
36
|
-
* knows it by. The surface's other actions live in its header or behind a `⋯`, where there is no
|
|
37
|
-
* list for an order to run in.
|
|
38
|
-
*
|
|
39
|
-
* `switchAccount` and `addAccount` share a slot: the foot carries the flyout of signed-in accounts
|
|
40
|
-
* where there is more than one, and the row it would have opened onto where there is not. Name both
|
|
41
|
-
* to place that slot whichever way it resolves.
|
|
42
|
-
*/
|
|
43
|
-
type UserButtonMenuItemId = 'switchAccount' | 'addAccount' | 'signOutAll';
|
|
44
|
-
interface UserButtonMenuItemBase {
|
|
45
|
-
/** Identifies the row, for ordering. */
|
|
46
|
-
id: string;
|
|
47
|
-
/** Names the row. */
|
|
48
|
-
label: string;
|
|
49
|
-
icon?: ReactNode;
|
|
50
|
-
}
|
|
51
|
-
/** An action of your own at the foot of the popup. */
|
|
52
|
-
interface UserButtonMenuAction extends UserButtonMenuItemBase {
|
|
53
|
-
onClick: () => void;
|
|
54
|
-
href?: never;
|
|
55
|
-
}
|
|
56
|
-
/** A row at the foot of the popup that leaves for somewhere else. */
|
|
57
|
-
interface UserButtonMenuLink extends UserButtonMenuItemBase {
|
|
58
|
-
/** Where the row goes. */
|
|
59
|
-
href: string;
|
|
60
|
-
onClick?: never;
|
|
61
|
-
}
|
|
62
|
-
type UserButtonMenuItem = UserButtonMenuAction | UserButtonMenuLink;
|
|
63
|
-
/** The app's own actions at the foot of the popup, and the order the foot's rows run in. */
|
|
64
|
-
interface UserButtonMenuProps {
|
|
65
|
-
/** Actions and links of your own, added to the foot of the popup ahead of Clerk's own rows. */
|
|
66
|
-
customMenuItems?: UserButtonMenuItem[];
|
|
67
|
-
/**
|
|
68
|
-
* The order the foot's rows run in, by id: a built-in row's id, or a custom item's `id`. Anything
|
|
69
|
-
* left out follows the rows named here. An id the surface does not carry as a row is ignored,
|
|
70
|
-
* since which rows the foot has depends on its mode.
|
|
71
|
-
*/
|
|
72
|
-
menuItemOrder?: (UserButtonMenuItemId | (string & {}))[];
|
|
73
|
-
} //#endregion
|
|
74
|
-
//#region src/mosaic/user-button/user-button.model.d.ts
|
|
75
|
-
type AfterSelectUrl<T> = ((entity: T) => string) | string;
|
|
76
|
-
/** A URL is the whole opt-in to navigation, and `modal` forbids one, so the pair cannot contradict itself. */
|
|
77
|
-
type UserProfileMode = {
|
|
78
|
-
userProfileUrl: string;
|
|
79
|
-
userProfileMode?: 'navigation';
|
|
80
|
-
} | {
|
|
81
|
-
userProfileUrl?: never;
|
|
82
|
-
userProfileMode?: 'modal';
|
|
83
|
-
};
|
|
84
|
-
type OrganizationProfileMode = {
|
|
85
|
-
organizationProfileUrl: string;
|
|
86
|
-
organizationProfileMode?: 'navigation';
|
|
87
|
-
} | {
|
|
88
|
-
organizationProfileUrl?: never;
|
|
89
|
-
organizationProfileMode?: 'modal';
|
|
90
|
-
};
|
|
91
|
-
type CreateOrganizationMode = {
|
|
92
|
-
createOrganizationUrl: string;
|
|
93
|
-
createOrganizationMode?: 'navigation';
|
|
94
|
-
} | {
|
|
95
|
-
createOrganizationUrl?: never;
|
|
96
|
-
createOrganizationMode?: 'modal';
|
|
97
|
-
};
|
|
98
|
-
type UserButtonModelOptions = UserProfileMode & OrganizationProfileMode & CreateOrganizationMode & {
|
|
99
|
-
afterSelectOrganizationUrl?: AfterSelectUrl<OrganizationResource>; /** Where selecting the personal workspace lands. Resolved against the user, not an organization. */
|
|
100
|
-
afterSelectPersonalUrl?: AfterSelectUrl<UserResource>; /** Where switching account lands. The instance URL is used when this is omitted. */
|
|
101
|
-
afterSwitchSessionUrl?: string;
|
|
102
|
-
/**
|
|
103
|
-
* Leaves the personal workspace out. An instance that forces organization selection withholds it
|
|
104
|
-
* either way, so this cannot opt back in.
|
|
105
|
-
*/
|
|
106
|
-
hidePersonal?: boolean;
|
|
107
|
-
}; //#endregion
|
|
108
|
-
//#region src/mosaic/user-button/user-button.pages.d.ts
|
|
109
|
-
/** A page the UserProfile brings itself, named by the id its navigation knows it as. */
|
|
110
|
-
type UserProfilePageId = 'account' | 'security' | 'billing' | 'apiKeys';
|
|
111
|
-
/** A page of your own inside the profile, reached from its navigation. */
|
|
112
|
-
interface CustomProfilePage {
|
|
113
|
-
/** Names the page in the profile's navigation. */
|
|
114
|
-
label: string;
|
|
115
|
-
/** Where the page lives, relative to the profile root. Absolute URLs are rejected. */
|
|
116
|
-
path: string;
|
|
117
|
-
href?: never;
|
|
118
|
-
icon?: ReactNode;
|
|
119
|
-
/** Rendered as the page itself. */
|
|
120
|
-
content: ReactNode;
|
|
121
|
-
}
|
|
122
|
-
/** A row in the profile's navigation that leaves for somewhere else. */
|
|
123
|
-
interface CustomProfileLink {
|
|
124
|
-
/** Names the row in the profile's navigation. */
|
|
125
|
-
label: string;
|
|
126
|
-
/** Identifies the row, for ordering. */
|
|
127
|
-
path: string;
|
|
128
|
-
/** Where the row goes. */
|
|
129
|
-
href: string;
|
|
130
|
-
icon?: ReactNode;
|
|
131
|
-
content?: never;
|
|
132
|
-
}
|
|
133
|
-
type CustomProfileItem = CustomProfilePage | CustomProfileLink; //#endregion
|
|
134
|
-
//#region src/mosaic/user-button/user-button.view.d.ts
|
|
135
|
-
interface UserButtonTriggerProps {
|
|
136
|
-
/**
|
|
137
|
-
* Names the active workspace beside its avatar — the organization wherever one heads the
|
|
138
|
-
* trigger, no selection when personal is hidden and none is active, the account otherwise.
|
|
139
|
-
* Turn it off for the avatar alone.
|
|
140
|
-
*
|
|
141
|
-
* @default true
|
|
142
|
-
*/
|
|
143
|
-
renderTriggerLabel?: boolean;
|
|
144
|
-
/**
|
|
145
|
-
* Carries the active organization's plan beside its name. Part of the label, so it needs
|
|
146
|
-
* `renderTriggerLabel`: a plan badge with nothing to qualify says nothing.
|
|
147
|
-
*
|
|
148
|
-
* @default true
|
|
149
|
-
*/
|
|
150
|
-
renderTriggerBadge?: boolean;
|
|
151
|
-
} //#endregion
|
|
152
|
-
//#region src/mosaic/user-button/user-button.d.ts
|
|
153
|
-
/** Configures the UserProfile this button opens. */
|
|
154
|
-
interface UserButtonUserProfileProps {
|
|
155
|
-
/** Pages and links of your own, added to the profile's navigation. */
|
|
156
|
-
customPages?: CustomProfileItem[];
|
|
157
|
-
/**
|
|
158
|
-
* The order the profile's navigation runs in, by id: a built-in page's id, or a custom entry's
|
|
159
|
-
* `path`. Anything left out follows the pages named here. The first page is the one the profile
|
|
160
|
-
* opens on, so it cannot be a link.
|
|
161
|
-
*/
|
|
162
|
-
pageOrder?: (UserProfilePageId | (string & {}))[];
|
|
163
|
-
}
|
|
164
|
-
/** Everything `<UserButton />` takes: profile routing, trigger content, the app's own menu rows, and the profile it opens. */
|
|
165
|
-
type UserButtonProps = UserButtonModelOptions & UserButtonTriggerProps & UserButtonMenuProps & UserButtonModeProps & {
|
|
166
|
-
userProfileProps?: UserButtonUserProfileProps;
|
|
167
|
-
/**
|
|
168
|
-
* Fallback while loading.
|
|
169
|
-
*
|
|
170
|
-
* Note that the UserButton renders nothing when the user is signed out, so using this on
|
|
171
|
-
* pages that are reachable while both signed-out and signed-in can result in Fallback->Nothing.
|
|
172
|
-
*/
|
|
173
|
-
fallback?: ReactNode;
|
|
174
|
-
};
|
|
175
|
-
/**
|
|
176
|
-
* The signed-in user's avatar, and the menu behind it: switch organization, switch or add an account,
|
|
177
|
-
* open the profile, and sign out. It reads the active session and organization from Clerk, so it takes
|
|
178
|
-
* no data. It renders `fallback` until Clerk answers, and nothing at all when nobody is signed in.
|
|
179
|
-
*
|
|
180
|
-
* Each action is a request: the row you click spins, the others stand down, and the menu stays open on
|
|
181
|
-
* the result. Only an action that navigates closes it.
|
|
182
|
-
*
|
|
183
|
-
* @example
|
|
184
|
-
* ```tsx
|
|
185
|
-
* import { UserButton } from '@clerk/nextjs/experimental/mosaic';
|
|
186
|
-
*
|
|
187
|
-
* <UserButton />
|
|
188
|
-
* ```
|
|
189
|
-
*
|
|
190
|
-
* @example
|
|
191
|
-
* `mode` narrows the menu to one switcher, and `modePriority` picks which one a combined menu leads
|
|
192
|
-
* with — in its header, and in the trigger beside the avatar. The other one is still listed.
|
|
193
|
-
* ```tsx
|
|
194
|
-
* <UserButton mode='organization' />
|
|
195
|
-
* <UserButton mode='user' />
|
|
196
|
-
* <UserButton modePriority='user' />
|
|
197
|
-
* ```
|
|
198
|
-
*
|
|
199
|
-
* @example
|
|
200
|
-
* Passing a URL routes to a page of your own instead of opening Clerk's modal; that is the whole
|
|
201
|
-
* opt-in. `afterSelectOrganizationUrl` is where switching organization lands, and takes a `:param`
|
|
202
|
-
* template, a plain path, or a function. `afterSwitchSessionUrl` is where switching account lands.
|
|
203
|
-
* ```tsx
|
|
204
|
-
* <UserButton
|
|
205
|
-
* userProfileUrl='/account'
|
|
206
|
-
* organizationProfileUrl='/settings/organization'
|
|
207
|
-
* afterSelectOrganizationUrl='/orgs/:slug'
|
|
208
|
-
* afterSwitchSessionUrl='/dashboard'
|
|
209
|
-
* />
|
|
210
|
-
* ```
|
|
211
|
-
*
|
|
212
|
-
* @example
|
|
213
|
-
* `fallback` holds the space while Clerk is still answering. Size it to the trigger to keep the row
|
|
214
|
-
* it sits in from moving. Nothing stands in once the answer is that nobody is signed in.
|
|
215
|
-
* ```tsx
|
|
216
|
-
* <UserButton fallback={<AvatarSkeleton />} />
|
|
217
|
-
* ```
|
|
218
|
-
*
|
|
219
|
-
* @example
|
|
220
|
-
* `customPages` adds your own pages to the profile this button opens; `customMenuItems` adds your
|
|
221
|
-
* own rows to the foot of the menu, each one either an `onClick` action or an `href` link.
|
|
222
|
-
* ```tsx
|
|
223
|
-
* <UserButton
|
|
224
|
-
* userProfileProps={{
|
|
225
|
-
* customPages: [{ path: 'usage', label: 'Usage', icon: <ChartIcon />, content: <UsagePage /> }],
|
|
226
|
-
* pageOrder: ['account', 'usage', 'security'],
|
|
227
|
-
* }}
|
|
228
|
-
* customMenuItems={[
|
|
229
|
-
* { id: 'docs', label: 'Documentation', icon: <BookIcon />, href: 'https://example.com/docs' },
|
|
230
|
-
* { id: 'support', label: 'Contact support', icon: <ChatIcon />, onClick: () => openSupportChat() },
|
|
231
|
-
* ]}
|
|
232
|
-
* menuItemOrder={['docs', 'support', 'addAccount', 'signOutAll']}
|
|
233
|
-
* />
|
|
234
|
-
* ```
|
|
235
|
-
*/
|
|
236
|
-
declare function UserButton(props?: UserButtonProps): ReactElement | null; //#endregion
|
|
237
|
-
//#endregion
|
|
238
|
-
export { UserButton, type UserButtonProps };
|
|
239
|
-
//# sourceMappingURL=mosaic.d.cts.map
|
|
@@ -1,239 +0,0 @@
|
|
|
1
|
-
import { ReactElement, ReactNode } from "react";
|
|
2
|
-
import { OrganizationResource, UserResource } from "@clerk/shared/types";
|
|
3
|
-
|
|
4
|
-
//#region ../ui/dist-mosaic/index.d.ts
|
|
5
|
-
//#region src/mosaic/user-button/user-button.types.d.ts
|
|
6
|
-
/**
|
|
7
|
-
* Which switchers the surface carries. `combined` is both; `organization` is an organization
|
|
8
|
-
* switcher with no account rows; `user` is an account switcher that never shows an organization,
|
|
9
|
-
* even when one is active.
|
|
10
|
-
*/
|
|
11
|
-
type UserButtonMode = 'combined' | 'organization' | 'user';
|
|
12
|
-
/**
|
|
13
|
-
* Which of the two switchers a `combined` surface leads with: the one named in the trigger and
|
|
14
|
-
* headed in the popup. Both are still listed either way. The single-purpose modes have only one
|
|
15
|
-
* thing to lead with, so they ignore it.
|
|
16
|
-
*/
|
|
17
|
-
type UserButtonModePriority = 'organization' | 'user';
|
|
18
|
-
/** Which switchers the surface carries, and which one it leads with. */
|
|
19
|
-
interface UserButtonModeProps {
|
|
20
|
-
/**
|
|
21
|
-
* Which switchers the popup carries: both, organizations alone, or accounts alone.
|
|
22
|
-
*
|
|
23
|
-
* @default 'combined'
|
|
24
|
-
*/
|
|
25
|
-
mode?: UserButtonMode;
|
|
26
|
-
/**
|
|
27
|
-
* Which switcher a `combined` surface leads with in the trigger and the popup's header. The other
|
|
28
|
-
* one is still listed. Ignored by the single-purpose modes, which have only one thing to lead with.
|
|
29
|
-
*
|
|
30
|
-
* @default 'organization'
|
|
31
|
-
*/
|
|
32
|
-
modePriority?: UserButtonModePriority;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* A built-in action the foot of the popup lists as a row of its own, named by the id `menuItemOrder`
|
|
36
|
-
* knows it by. The surface's other actions live in its header or behind a `⋯`, where there is no
|
|
37
|
-
* list for an order to run in.
|
|
38
|
-
*
|
|
39
|
-
* `switchAccount` and `addAccount` share a slot: the foot carries the flyout of signed-in accounts
|
|
40
|
-
* where there is more than one, and the row it would have opened onto where there is not. Name both
|
|
41
|
-
* to place that slot whichever way it resolves.
|
|
42
|
-
*/
|
|
43
|
-
type UserButtonMenuItemId = 'switchAccount' | 'addAccount' | 'signOutAll';
|
|
44
|
-
interface UserButtonMenuItemBase {
|
|
45
|
-
/** Identifies the row, for ordering. */
|
|
46
|
-
id: string;
|
|
47
|
-
/** Names the row. */
|
|
48
|
-
label: string;
|
|
49
|
-
icon?: ReactNode;
|
|
50
|
-
}
|
|
51
|
-
/** An action of your own at the foot of the popup. */
|
|
52
|
-
interface UserButtonMenuAction extends UserButtonMenuItemBase {
|
|
53
|
-
onClick: () => void;
|
|
54
|
-
href?: never;
|
|
55
|
-
}
|
|
56
|
-
/** A row at the foot of the popup that leaves for somewhere else. */
|
|
57
|
-
interface UserButtonMenuLink extends UserButtonMenuItemBase {
|
|
58
|
-
/** Where the row goes. */
|
|
59
|
-
href: string;
|
|
60
|
-
onClick?: never;
|
|
61
|
-
}
|
|
62
|
-
type UserButtonMenuItem = UserButtonMenuAction | UserButtonMenuLink;
|
|
63
|
-
/** The app's own actions at the foot of the popup, and the order the foot's rows run in. */
|
|
64
|
-
interface UserButtonMenuProps {
|
|
65
|
-
/** Actions and links of your own, added to the foot of the popup ahead of Clerk's own rows. */
|
|
66
|
-
customMenuItems?: UserButtonMenuItem[];
|
|
67
|
-
/**
|
|
68
|
-
* The order the foot's rows run in, by id: a built-in row's id, or a custom item's `id`. Anything
|
|
69
|
-
* left out follows the rows named here. An id the surface does not carry as a row is ignored,
|
|
70
|
-
* since which rows the foot has depends on its mode.
|
|
71
|
-
*/
|
|
72
|
-
menuItemOrder?: (UserButtonMenuItemId | (string & {}))[];
|
|
73
|
-
} //#endregion
|
|
74
|
-
//#region src/mosaic/user-button/user-button.model.d.ts
|
|
75
|
-
type AfterSelectUrl<T> = ((entity: T) => string) | string;
|
|
76
|
-
/** A URL is the whole opt-in to navigation, and `modal` forbids one, so the pair cannot contradict itself. */
|
|
77
|
-
type UserProfileMode = {
|
|
78
|
-
userProfileUrl: string;
|
|
79
|
-
userProfileMode?: 'navigation';
|
|
80
|
-
} | {
|
|
81
|
-
userProfileUrl?: never;
|
|
82
|
-
userProfileMode?: 'modal';
|
|
83
|
-
};
|
|
84
|
-
type OrganizationProfileMode = {
|
|
85
|
-
organizationProfileUrl: string;
|
|
86
|
-
organizationProfileMode?: 'navigation';
|
|
87
|
-
} | {
|
|
88
|
-
organizationProfileUrl?: never;
|
|
89
|
-
organizationProfileMode?: 'modal';
|
|
90
|
-
};
|
|
91
|
-
type CreateOrganizationMode = {
|
|
92
|
-
createOrganizationUrl: string;
|
|
93
|
-
createOrganizationMode?: 'navigation';
|
|
94
|
-
} | {
|
|
95
|
-
createOrganizationUrl?: never;
|
|
96
|
-
createOrganizationMode?: 'modal';
|
|
97
|
-
};
|
|
98
|
-
type UserButtonModelOptions = UserProfileMode & OrganizationProfileMode & CreateOrganizationMode & {
|
|
99
|
-
afterSelectOrganizationUrl?: AfterSelectUrl<OrganizationResource>; /** Where selecting the personal workspace lands. Resolved against the user, not an organization. */
|
|
100
|
-
afterSelectPersonalUrl?: AfterSelectUrl<UserResource>; /** Where switching account lands. The instance URL is used when this is omitted. */
|
|
101
|
-
afterSwitchSessionUrl?: string;
|
|
102
|
-
/**
|
|
103
|
-
* Leaves the personal workspace out. An instance that forces organization selection withholds it
|
|
104
|
-
* either way, so this cannot opt back in.
|
|
105
|
-
*/
|
|
106
|
-
hidePersonal?: boolean;
|
|
107
|
-
}; //#endregion
|
|
108
|
-
//#region src/mosaic/user-button/user-button.pages.d.ts
|
|
109
|
-
/** A page the UserProfile brings itself, named by the id its navigation knows it as. */
|
|
110
|
-
type UserProfilePageId = 'account' | 'security' | 'billing' | 'apiKeys';
|
|
111
|
-
/** A page of your own inside the profile, reached from its navigation. */
|
|
112
|
-
interface CustomProfilePage {
|
|
113
|
-
/** Names the page in the profile's navigation. */
|
|
114
|
-
label: string;
|
|
115
|
-
/** Where the page lives, relative to the profile root. Absolute URLs are rejected. */
|
|
116
|
-
path: string;
|
|
117
|
-
href?: never;
|
|
118
|
-
icon?: ReactNode;
|
|
119
|
-
/** Rendered as the page itself. */
|
|
120
|
-
content: ReactNode;
|
|
121
|
-
}
|
|
122
|
-
/** A row in the profile's navigation that leaves for somewhere else. */
|
|
123
|
-
interface CustomProfileLink {
|
|
124
|
-
/** Names the row in the profile's navigation. */
|
|
125
|
-
label: string;
|
|
126
|
-
/** Identifies the row, for ordering. */
|
|
127
|
-
path: string;
|
|
128
|
-
/** Where the row goes. */
|
|
129
|
-
href: string;
|
|
130
|
-
icon?: ReactNode;
|
|
131
|
-
content?: never;
|
|
132
|
-
}
|
|
133
|
-
type CustomProfileItem = CustomProfilePage | CustomProfileLink; //#endregion
|
|
134
|
-
//#region src/mosaic/user-button/user-button.view.d.ts
|
|
135
|
-
interface UserButtonTriggerProps {
|
|
136
|
-
/**
|
|
137
|
-
* Names the active workspace beside its avatar — the organization wherever one heads the
|
|
138
|
-
* trigger, no selection when personal is hidden and none is active, the account otherwise.
|
|
139
|
-
* Turn it off for the avatar alone.
|
|
140
|
-
*
|
|
141
|
-
* @default true
|
|
142
|
-
*/
|
|
143
|
-
renderTriggerLabel?: boolean;
|
|
144
|
-
/**
|
|
145
|
-
* Carries the active organization's plan beside its name. Part of the label, so it needs
|
|
146
|
-
* `renderTriggerLabel`: a plan badge with nothing to qualify says nothing.
|
|
147
|
-
*
|
|
148
|
-
* @default true
|
|
149
|
-
*/
|
|
150
|
-
renderTriggerBadge?: boolean;
|
|
151
|
-
} //#endregion
|
|
152
|
-
//#region src/mosaic/user-button/user-button.d.ts
|
|
153
|
-
/** Configures the UserProfile this button opens. */
|
|
154
|
-
interface UserButtonUserProfileProps {
|
|
155
|
-
/** Pages and links of your own, added to the profile's navigation. */
|
|
156
|
-
customPages?: CustomProfileItem[];
|
|
157
|
-
/**
|
|
158
|
-
* The order the profile's navigation runs in, by id: a built-in page's id, or a custom entry's
|
|
159
|
-
* `path`. Anything left out follows the pages named here. The first page is the one the profile
|
|
160
|
-
* opens on, so it cannot be a link.
|
|
161
|
-
*/
|
|
162
|
-
pageOrder?: (UserProfilePageId | (string & {}))[];
|
|
163
|
-
}
|
|
164
|
-
/** Everything `<UserButton />` takes: profile routing, trigger content, the app's own menu rows, and the profile it opens. */
|
|
165
|
-
type UserButtonProps = UserButtonModelOptions & UserButtonTriggerProps & UserButtonMenuProps & UserButtonModeProps & {
|
|
166
|
-
userProfileProps?: UserButtonUserProfileProps;
|
|
167
|
-
/**
|
|
168
|
-
* Fallback while loading.
|
|
169
|
-
*
|
|
170
|
-
* Note that the UserButton renders nothing when the user is signed out, so using this on
|
|
171
|
-
* pages that are reachable while both signed-out and signed-in can result in Fallback->Nothing.
|
|
172
|
-
*/
|
|
173
|
-
fallback?: ReactNode;
|
|
174
|
-
};
|
|
175
|
-
/**
|
|
176
|
-
* The signed-in user's avatar, and the menu behind it: switch organization, switch or add an account,
|
|
177
|
-
* open the profile, and sign out. It reads the active session and organization from Clerk, so it takes
|
|
178
|
-
* no data. It renders `fallback` until Clerk answers, and nothing at all when nobody is signed in.
|
|
179
|
-
*
|
|
180
|
-
* Each action is a request: the row you click spins, the others stand down, and the menu stays open on
|
|
181
|
-
* the result. Only an action that navigates closes it.
|
|
182
|
-
*
|
|
183
|
-
* @example
|
|
184
|
-
* ```tsx
|
|
185
|
-
* import { UserButton } from '@clerk/nextjs/experimental/mosaic';
|
|
186
|
-
*
|
|
187
|
-
* <UserButton />
|
|
188
|
-
* ```
|
|
189
|
-
*
|
|
190
|
-
* @example
|
|
191
|
-
* `mode` narrows the menu to one switcher, and `modePriority` picks which one a combined menu leads
|
|
192
|
-
* with — in its header, and in the trigger beside the avatar. The other one is still listed.
|
|
193
|
-
* ```tsx
|
|
194
|
-
* <UserButton mode='organization' />
|
|
195
|
-
* <UserButton mode='user' />
|
|
196
|
-
* <UserButton modePriority='user' />
|
|
197
|
-
* ```
|
|
198
|
-
*
|
|
199
|
-
* @example
|
|
200
|
-
* Passing a URL routes to a page of your own instead of opening Clerk's modal; that is the whole
|
|
201
|
-
* opt-in. `afterSelectOrganizationUrl` is where switching organization lands, and takes a `:param`
|
|
202
|
-
* template, a plain path, or a function. `afterSwitchSessionUrl` is where switching account lands.
|
|
203
|
-
* ```tsx
|
|
204
|
-
* <UserButton
|
|
205
|
-
* userProfileUrl='/account'
|
|
206
|
-
* organizationProfileUrl='/settings/organization'
|
|
207
|
-
* afterSelectOrganizationUrl='/orgs/:slug'
|
|
208
|
-
* afterSwitchSessionUrl='/dashboard'
|
|
209
|
-
* />
|
|
210
|
-
* ```
|
|
211
|
-
*
|
|
212
|
-
* @example
|
|
213
|
-
* `fallback` holds the space while Clerk is still answering. Size it to the trigger to keep the row
|
|
214
|
-
* it sits in from moving. Nothing stands in once the answer is that nobody is signed in.
|
|
215
|
-
* ```tsx
|
|
216
|
-
* <UserButton fallback={<AvatarSkeleton />} />
|
|
217
|
-
* ```
|
|
218
|
-
*
|
|
219
|
-
* @example
|
|
220
|
-
* `customPages` adds your own pages to the profile this button opens; `customMenuItems` adds your
|
|
221
|
-
* own rows to the foot of the menu, each one either an `onClick` action or an `href` link.
|
|
222
|
-
* ```tsx
|
|
223
|
-
* <UserButton
|
|
224
|
-
* userProfileProps={{
|
|
225
|
-
* customPages: [{ path: 'usage', label: 'Usage', icon: <ChartIcon />, content: <UsagePage /> }],
|
|
226
|
-
* pageOrder: ['account', 'usage', 'security'],
|
|
227
|
-
* }}
|
|
228
|
-
* customMenuItems={[
|
|
229
|
-
* { id: 'docs', label: 'Documentation', icon: <BookIcon />, href: 'https://example.com/docs' },
|
|
230
|
-
* { id: 'support', label: 'Contact support', icon: <ChatIcon />, onClick: () => openSupportChat() },
|
|
231
|
-
* ]}
|
|
232
|
-
* menuItemOrder={['docs', 'support', 'addAccount', 'signOutAll']}
|
|
233
|
-
* />
|
|
234
|
-
* ```
|
|
235
|
-
*/
|
|
236
|
-
declare function UserButton(props?: UserButtonProps): ReactElement | null; //#endregion
|
|
237
|
-
//#endregion
|
|
238
|
-
export { UserButton, type UserButtonProps };
|
|
239
|
-
//# sourceMappingURL=mosaic.d.mts.map
|