@basictech/react 0.12.0-beta.2 → 0.12.0-beta.3
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/CHANGELOG.md +13 -0
- package/README.md +56 -9
- package/dist/index.d.mts +21 -3
- package/dist/index.d.ts +21 -3
- package/dist/index.js +53 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +53 -4
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +19 -12
- package/dist/styles.css.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @basictech/react
|
|
2
2
|
|
|
3
|
+
## 0.12.0-beta.3
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- fc5772a: Add app-owned menu actions and links with optional icons to UserAvatar, UserButton, and UserMenu.
|
|
8
|
+
Add a base background color to BasicUIProvider, derive borders and hover backgrounds from it,
|
|
9
|
+
and choose black or white text for hex accent colors. Preserve appearance in menu and modal
|
|
10
|
+
portals. Document component selection, simple theming, menu extensions, and Base UI dependencies.
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- @basictech/core@0.12.0-beta.3
|
|
15
|
+
|
|
3
16
|
## 0.12.0-beta.2
|
|
4
17
|
|
|
5
18
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -18,14 +18,19 @@ its package metadata.
|
|
|
18
18
|
|
|
19
19
|
## Install
|
|
20
20
|
|
|
21
|
-
This README describes
|
|
21
|
+
This README describes `0.12.0-beta.3`. After publication, install
|
|
22
22
|
matching versions of the React SDK and the schema package you import directly:
|
|
23
23
|
|
|
24
24
|
```bash
|
|
25
|
-
npm install @basictech/react@0.12.0-beta.
|
|
25
|
+
npm install @basictech/react@0.12.0-beta.3 @basictech/schema@0.12.0-beta.3
|
|
26
26
|
```
|
|
27
27
|
|
|
28
|
-
React
|
|
28
|
+
React and React DOM (18+) are peer dependencies and must already be installed by your application.
|
|
29
|
+
Use Node.js 24+ for development, CI, and builds to match the supported engine range.
|
|
30
|
+
`@base-ui/react` (`^1.8.0`) is installed automatically as a dependency, not a peer.
|
|
31
|
+
We import its `avatar`, `dialog`, `menu`, and `tabs` subpaths and leave them external in the SDK
|
|
32
|
+
build. Your app's bundler resolves those imports; we do not bundle the entire Base UI library
|
|
33
|
+
inside the SDK. Installing the dependency does install the Base UI package on disk.
|
|
29
34
|
|
|
30
35
|
## Auth update guide
|
|
31
36
|
|
|
@@ -33,9 +38,9 @@ Upgrade the packages you use together. npm's `latest` channel remains on `0.11.0
|
|
|
33
38
|
does not contain all of the API changes described here:
|
|
34
39
|
|
|
35
40
|
```bash
|
|
36
|
-
npm install @basictech/react@0.12.0-beta.
|
|
41
|
+
npm install @basictech/react@0.12.0-beta.3 @basictech/schema@0.12.0-beta.3
|
|
37
42
|
# If you import core directly, update that dependency too:
|
|
38
|
-
npm install @basictech/core@0.12.0-beta.
|
|
43
|
+
npm install @basictech/core@0.12.0-beta.3
|
|
39
44
|
```
|
|
40
45
|
|
|
41
46
|
Keep the public packages on matching versions. No browser storage reset or persisted-profile
|
|
@@ -334,6 +339,10 @@ Drop-in account and sharing UI uses Base UI's accessible menu, avatar, and dialo
|
|
|
334
339
|
Components use the nearest `BasicProvider` (including `basic.Provider`); they do not create a
|
|
335
340
|
second auth client. Import the optional stylesheet once. Omit it to supply your own styles.
|
|
336
341
|
|
|
342
|
+
**Which one should I use?** `UserButton` gives you the avatar, name, handle, and menu.
|
|
343
|
+
Choose `UserAvatar` for the same menu with an avatar-only trigger. `UserMenu` is the shared
|
|
344
|
+
component underneath both; you normally do not need to render it separately.
|
|
345
|
+
|
|
337
346
|
```tsx
|
|
338
347
|
import {
|
|
339
348
|
BasicUIProvider, SignInButton, UserButton, AuthStatus, SyncStatus, SharesModal,
|
|
@@ -372,10 +381,48 @@ Both modals accept `open`/`onOpenChange`, an optional button element or label as
|
|
|
372
381
|
`finalFocus` for externally controlled use. `trigger={null}` omits the trigger. Custom trigger
|
|
373
382
|
components must forward their ref and DOM props. Dialogs trap focus and close with Escape.
|
|
374
383
|
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
384
|
+
### Simple colors and custom menu items
|
|
385
|
+
|
|
386
|
+
`appearance.base`, automatic accent contrast, and `menuItems` require `0.12.0-beta.3` or newer;
|
|
387
|
+
they are not available in beta.2.
|
|
388
|
+
|
|
389
|
+
Start with `theme: 'light'` or `'dark'`. Optionally set a `base` background and an `accent`.
|
|
390
|
+
Light mode uses black text; dark mode uses white text, with muted shades for secondary text.
|
|
391
|
+
Borders and hover backgrounds follow the base color. Choose a light base for light mode and a
|
|
392
|
+
dark base for dark mode. Omit the accent for neutral black/white buttons. For an accent, use
|
|
393
|
+
`#RGB` or `#RRGGBB`: solid buttons automatically choose black or white text for contrast.
|
|
394
|
+
Other CSS accent values retain white foreground text; check their contrast yourself.
|
|
395
|
+
|
|
396
|
+
```tsx
|
|
397
|
+
import { BasicUIProvider, UserButton } from '@basictech/react'
|
|
398
|
+
import '@basictech/react/styles.css'
|
|
399
|
+
|
|
400
|
+
// Inside your existing BasicProvider. openPreferences is your app's callback.
|
|
401
|
+
<BasicUIProvider appearance={{ theme: 'dark', base: '#201d17', accent: '#d4af37' }}>
|
|
402
|
+
<UserButton menuItems={[
|
|
403
|
+
{ id: 'preferences', label: 'Preferences', onClick: openPreferences },
|
|
404
|
+
{ id: 'about', label: 'About', href: '/about' },
|
|
405
|
+
]} />
|
|
406
|
+
</BasicUIProvider>
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
`UserAvatar`, `UserButton`, and `UserMenu` all accept `menuItems`. Each item has a unique `id`,
|
|
410
|
+
`label`, either `href` or `onClick`, and optional `icon` (a React node) and `disabled`.
|
|
411
|
+
Icons are decorative, sized to 16px, and can come from your app's existing icon library:
|
|
412
|
+
`{ id: 'preferences', label: 'Preferences', icon: <SettingsIcon />, onClick: openPreferences }`.
|
|
413
|
+
Items appear after Manage account and before Sign out/Clear account. Selecting an item closes
|
|
414
|
+
the menu; async action failures use the SDK's dismissible error dialog. Use `onClick` to call
|
|
415
|
+
your router when you need client-side navigation rather than a normal link.
|
|
416
|
+
|
|
417
|
+
Nested appearance providers inherit settings, including in portaled menus and modals.
|
|
418
|
+
Pass your app's current light/dark mode to `theme`; there is no separate theme listener.
|
|
419
|
+
Existing `radius` and `density: 'comfortable' | 'compact'` options remain available.
|
|
420
|
+
Fonts inherit from the host. No icon pack or additional provider is needed.
|
|
421
|
+
|
|
422
|
+
To replace custom auth UI, keep your existing BasicProvider, import the stylesheet once,
|
|
423
|
+
and replace the old avatar/dropdown with `UserButton` or `UserAvatar`. Move app-owned actions
|
|
424
|
+
into `menuItems`; account switching and sign-out remain SDK-managed. `accountSettingsUrl`
|
|
425
|
+
only adds a link inside the built-in settings modal—it does not replace Manage account.
|
|
379
426
|
|
|
380
427
|
For controlled previews, components accept complete hook results via `auth`, `accounts`, `sync`,
|
|
381
428
|
or `shares` as appropriate. These replace rendered state **and action callbacks**; a BasicProvider
|
package/dist/index.d.mts
CHANGED
|
@@ -198,6 +198,9 @@ declare function useCollection<V extends JsonObject = JsonObject>(name: string,
|
|
|
198
198
|
|
|
199
199
|
interface BasicAppearance {
|
|
200
200
|
theme?: 'light' | 'dark';
|
|
201
|
+
/** Background color. Choose a light or dark base to match the theme. */
|
|
202
|
+
base?: string;
|
|
203
|
+
/** Hex colors get automatic black/white foreground contrast. */
|
|
201
204
|
accent?: string;
|
|
202
205
|
radius?: string;
|
|
203
206
|
density?: 'compact' | 'comfortable';
|
|
@@ -226,8 +229,9 @@ interface UserAvatarProps extends HTMLAttributes<HTMLSpanElement> {
|
|
|
226
229
|
auth?: UseAuthResult;
|
|
227
230
|
projectProfile?: UseProjectProfileResult;
|
|
228
231
|
allowAddAccount?: boolean;
|
|
232
|
+
menuItems?: UserMenuItem[];
|
|
229
233
|
}
|
|
230
|
-
declare function UserAvatar({ accounts, auth, projectProfile, allowAddAccount, ...avatarProps }: UserAvatarProps): react.JSX.Element;
|
|
234
|
+
declare function UserAvatar({ accounts, auth, projectProfile, allowAddAccount, menuItems, ...avatarProps }: UserAvatarProps): react.JSX.Element;
|
|
231
235
|
declare function AuthStatus({ auth: supplied, className, ...props }: HTMLAttributes<HTMLSpanElement> & {
|
|
232
236
|
auth?: UseAuthResult;
|
|
233
237
|
}): react.JSX.Element;
|
|
@@ -235,6 +239,19 @@ declare function SyncStatus({ sync: supplied, source, className, ...props }: HTM
|
|
|
235
239
|
sync?: UseSyncStatusResult;
|
|
236
240
|
source?: SourceRef;
|
|
237
241
|
}): react.JSX.Element | null;
|
|
242
|
+
/** App-owned items appear after Manage account and before Sign out. */
|
|
243
|
+
type UserMenuItem = {
|
|
244
|
+
id: string;
|
|
245
|
+
label: string;
|
|
246
|
+
icon?: ReactNode;
|
|
247
|
+
disabled?: boolean;
|
|
248
|
+
} & ({
|
|
249
|
+
href: string;
|
|
250
|
+
onClick?: never;
|
|
251
|
+
} | {
|
|
252
|
+
onClick: () => void | Promise<void>;
|
|
253
|
+
href?: never;
|
|
254
|
+
});
|
|
238
255
|
interface UserButtonProps {
|
|
239
256
|
accounts?: UseAccountsResult;
|
|
240
257
|
auth?: UseAuthResult;
|
|
@@ -249,13 +266,14 @@ interface UserButtonProps {
|
|
|
249
266
|
allowAddAccount?: boolean;
|
|
250
267
|
className?: string;
|
|
251
268
|
accountSettingsUrl?: string;
|
|
269
|
+
menuItems?: UserMenuItem[];
|
|
252
270
|
}
|
|
253
271
|
declare function UserButton(props: UserButtonProps): react.JSX.Element;
|
|
254
272
|
interface UserMenuProps extends UserButtonProps {
|
|
255
273
|
trigger?: 'avatar' | 'button';
|
|
256
274
|
avatarProps?: UserAvatarProps;
|
|
257
275
|
}
|
|
258
|
-
declare function UserMenu({ accounts: supplied, auth: suppliedAuth, sync, showSyncStatus, showSyncBadge, shape, trigger, avatarProps, projectProfile, allowAddAccount, className, accountSettingsUrl, }: UserMenuProps): react.JSX.Element;
|
|
276
|
+
declare function UserMenu({ accounts: supplied, auth: suppliedAuth, sync, showSyncStatus, showSyncBadge, shape, trigger, avatarProps, projectProfile, allowAddAccount, className, accountSettingsUrl, menuItems, }: UserMenuProps): react.JSX.Element;
|
|
259
277
|
interface BasicModalProps {
|
|
260
278
|
open?: boolean;
|
|
261
279
|
onOpenChange?: (open: boolean) => void;
|
|
@@ -378,4 +396,4 @@ declare class PersistenceStore implements ReplicaStoreFactory {
|
|
|
378
396
|
/** Browser multipart transport with upload progress, adapted from the Drive UI. */
|
|
379
397
|
declare const browserUploadTransport: UploadTransportAdapter;
|
|
380
398
|
|
|
381
|
-
export { type AccessTokenAdopter, AccountSettingsModal, type AccountSettingsModalProps, type AuthButtonProps, AuthStatus, type BasicAppearance, BasicButton, type BasicButtonProps, type BasicModalProps, BasicProvider, type BasicProviderProps, BasicUIProvider, type BoundBasicProviderProps, type BrowserBasicConfig, BrowserKeyValueStorage, type BrowserLockManager, type BrowserMessageChannel, BrowserTokenStore, type CreateBasicConfig, type CreatedBasic, PersistenceStore, type PersistenceStoreOptions, SharesModal, type SharesModalProps, SignInButton, SignOutButton, SyncStatus, type UseAccountsResult, type UseAuthResult, type UseBasicResult, type UseFilesResult, type UseMountsResult, type UseOutgoingSharesResult, type UseProjectProfileResult, type UseQueryResult, type UseReposResult, type UseStorageInfoResult, type UseSyncStatusResult, UserAvatar, type UserAvatarProps, UserButton, type UserButtonProps, UserMenu, type UserMenuProps, browserCurrentUrl, browserNavigate, browserReplaceUrl, browserStorage, browserUploadTransport, createBasic, createBasicClient, createBrowserAuthChannelFactory, createBrowserMessageChannel, useAccounts, useAuth, useBasic, useCollection, useDb, useFiles, useMounts, useOutgoingShares, useProjectProfile, useQuery, useRepos, useSchemaStatus, useStorageInfo, useSyncStatus };
|
|
399
|
+
export { type AccessTokenAdopter, AccountSettingsModal, type AccountSettingsModalProps, type AuthButtonProps, AuthStatus, type BasicAppearance, BasicButton, type BasicButtonProps, type BasicModalProps, BasicProvider, type BasicProviderProps, BasicUIProvider, type BoundBasicProviderProps, type BrowserBasicConfig, BrowserKeyValueStorage, type BrowserLockManager, type BrowserMessageChannel, BrowserTokenStore, type CreateBasicConfig, type CreatedBasic, PersistenceStore, type PersistenceStoreOptions, SharesModal, type SharesModalProps, SignInButton, SignOutButton, SyncStatus, type UseAccountsResult, type UseAuthResult, type UseBasicResult, type UseFilesResult, type UseMountsResult, type UseOutgoingSharesResult, type UseProjectProfileResult, type UseQueryResult, type UseReposResult, type UseStorageInfoResult, type UseSyncStatusResult, UserAvatar, type UserAvatarProps, UserButton, type UserButtonProps, UserMenu, type UserMenuItem, type UserMenuProps, browserCurrentUrl, browserNavigate, browserReplaceUrl, browserStorage, browserUploadTransport, createBasic, createBasicClient, createBrowserAuthChannelFactory, createBrowserMessageChannel, useAccounts, useAuth, useBasic, useCollection, useDb, useFiles, useMounts, useOutgoingShares, useProjectProfile, useQuery, useRepos, useSchemaStatus, useStorageInfo, useSyncStatus };
|
package/dist/index.d.ts
CHANGED
|
@@ -198,6 +198,9 @@ declare function useCollection<V extends JsonObject = JsonObject>(name: string,
|
|
|
198
198
|
|
|
199
199
|
interface BasicAppearance {
|
|
200
200
|
theme?: 'light' | 'dark';
|
|
201
|
+
/** Background color. Choose a light or dark base to match the theme. */
|
|
202
|
+
base?: string;
|
|
203
|
+
/** Hex colors get automatic black/white foreground contrast. */
|
|
201
204
|
accent?: string;
|
|
202
205
|
radius?: string;
|
|
203
206
|
density?: 'compact' | 'comfortable';
|
|
@@ -226,8 +229,9 @@ interface UserAvatarProps extends HTMLAttributes<HTMLSpanElement> {
|
|
|
226
229
|
auth?: UseAuthResult;
|
|
227
230
|
projectProfile?: UseProjectProfileResult;
|
|
228
231
|
allowAddAccount?: boolean;
|
|
232
|
+
menuItems?: UserMenuItem[];
|
|
229
233
|
}
|
|
230
|
-
declare function UserAvatar({ accounts, auth, projectProfile, allowAddAccount, ...avatarProps }: UserAvatarProps): react.JSX.Element;
|
|
234
|
+
declare function UserAvatar({ accounts, auth, projectProfile, allowAddAccount, menuItems, ...avatarProps }: UserAvatarProps): react.JSX.Element;
|
|
231
235
|
declare function AuthStatus({ auth: supplied, className, ...props }: HTMLAttributes<HTMLSpanElement> & {
|
|
232
236
|
auth?: UseAuthResult;
|
|
233
237
|
}): react.JSX.Element;
|
|
@@ -235,6 +239,19 @@ declare function SyncStatus({ sync: supplied, source, className, ...props }: HTM
|
|
|
235
239
|
sync?: UseSyncStatusResult;
|
|
236
240
|
source?: SourceRef;
|
|
237
241
|
}): react.JSX.Element | null;
|
|
242
|
+
/** App-owned items appear after Manage account and before Sign out. */
|
|
243
|
+
type UserMenuItem = {
|
|
244
|
+
id: string;
|
|
245
|
+
label: string;
|
|
246
|
+
icon?: ReactNode;
|
|
247
|
+
disabled?: boolean;
|
|
248
|
+
} & ({
|
|
249
|
+
href: string;
|
|
250
|
+
onClick?: never;
|
|
251
|
+
} | {
|
|
252
|
+
onClick: () => void | Promise<void>;
|
|
253
|
+
href?: never;
|
|
254
|
+
});
|
|
238
255
|
interface UserButtonProps {
|
|
239
256
|
accounts?: UseAccountsResult;
|
|
240
257
|
auth?: UseAuthResult;
|
|
@@ -249,13 +266,14 @@ interface UserButtonProps {
|
|
|
249
266
|
allowAddAccount?: boolean;
|
|
250
267
|
className?: string;
|
|
251
268
|
accountSettingsUrl?: string;
|
|
269
|
+
menuItems?: UserMenuItem[];
|
|
252
270
|
}
|
|
253
271
|
declare function UserButton(props: UserButtonProps): react.JSX.Element;
|
|
254
272
|
interface UserMenuProps extends UserButtonProps {
|
|
255
273
|
trigger?: 'avatar' | 'button';
|
|
256
274
|
avatarProps?: UserAvatarProps;
|
|
257
275
|
}
|
|
258
|
-
declare function UserMenu({ accounts: supplied, auth: suppliedAuth, sync, showSyncStatus, showSyncBadge, shape, trigger, avatarProps, projectProfile, allowAddAccount, className, accountSettingsUrl, }: UserMenuProps): react.JSX.Element;
|
|
276
|
+
declare function UserMenu({ accounts: supplied, auth: suppliedAuth, sync, showSyncStatus, showSyncBadge, shape, trigger, avatarProps, projectProfile, allowAddAccount, className, accountSettingsUrl, menuItems, }: UserMenuProps): react.JSX.Element;
|
|
259
277
|
interface BasicModalProps {
|
|
260
278
|
open?: boolean;
|
|
261
279
|
onOpenChange?: (open: boolean) => void;
|
|
@@ -378,4 +396,4 @@ declare class PersistenceStore implements ReplicaStoreFactory {
|
|
|
378
396
|
/** Browser multipart transport with upload progress, adapted from the Drive UI. */
|
|
379
397
|
declare const browserUploadTransport: UploadTransportAdapter;
|
|
380
398
|
|
|
381
|
-
export { type AccessTokenAdopter, AccountSettingsModal, type AccountSettingsModalProps, type AuthButtonProps, AuthStatus, type BasicAppearance, BasicButton, type BasicButtonProps, type BasicModalProps, BasicProvider, type BasicProviderProps, BasicUIProvider, type BoundBasicProviderProps, type BrowserBasicConfig, BrowserKeyValueStorage, type BrowserLockManager, type BrowserMessageChannel, BrowserTokenStore, type CreateBasicConfig, type CreatedBasic, PersistenceStore, type PersistenceStoreOptions, SharesModal, type SharesModalProps, SignInButton, SignOutButton, SyncStatus, type UseAccountsResult, type UseAuthResult, type UseBasicResult, type UseFilesResult, type UseMountsResult, type UseOutgoingSharesResult, type UseProjectProfileResult, type UseQueryResult, type UseReposResult, type UseStorageInfoResult, type UseSyncStatusResult, UserAvatar, type UserAvatarProps, UserButton, type UserButtonProps, UserMenu, type UserMenuProps, browserCurrentUrl, browserNavigate, browserReplaceUrl, browserStorage, browserUploadTransport, createBasic, createBasicClient, createBrowserAuthChannelFactory, createBrowserMessageChannel, useAccounts, useAuth, useBasic, useCollection, useDb, useFiles, useMounts, useOutgoingShares, useProjectProfile, useQuery, useRepos, useSchemaStatus, useStorageInfo, useSyncStatus };
|
|
399
|
+
export { type AccessTokenAdopter, AccountSettingsModal, type AccountSettingsModalProps, type AuthButtonProps, AuthStatus, type BasicAppearance, BasicButton, type BasicButtonProps, type BasicModalProps, BasicProvider, type BasicProviderProps, BasicUIProvider, type BoundBasicProviderProps, type BrowserBasicConfig, BrowserKeyValueStorage, type BrowserLockManager, type BrowserMessageChannel, BrowserTokenStore, type CreateBasicConfig, type CreatedBasic, PersistenceStore, type PersistenceStoreOptions, SharesModal, type SharesModalProps, SignInButton, SignOutButton, SyncStatus, type UseAccountsResult, type UseAuthResult, type UseBasicResult, type UseFilesResult, type UseMountsResult, type UseOutgoingSharesResult, type UseProjectProfileResult, type UseQueryResult, type UseReposResult, type UseStorageInfoResult, type UseSyncStatusResult, UserAvatar, type UserAvatarProps, UserButton, type UserButtonProps, UserMenu, type UserMenuItem, type UserMenuProps, browserCurrentUrl, browserNavigate, browserReplaceUrl, browserStorage, browserUploadTransport, createBasic, createBasicClient, createBrowserAuthChannelFactory, createBrowserMessageChannel, useAccounts, useAuth, useBasic, useCollection, useDb, useFiles, useMounts, useOutgoingShares, useProjectProfile, useQuery, useRepos, useSchemaStatus, useStorageInfo, useSyncStatus };
|
package/dist/index.js
CHANGED
|
@@ -1150,9 +1150,22 @@ var import_tabs = require("@base-ui/react/tabs");
|
|
|
1150
1150
|
var import_core7 = require("@basictech/core");
|
|
1151
1151
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
1152
1152
|
var AppearanceContext = (0, import_react13.createContext)({});
|
|
1153
|
+
function accentText(accent) {
|
|
1154
|
+
if (!/^#([\da-f]{3}|[\da-f]{6})$/i.test(accent)) return "#fff";
|
|
1155
|
+
const hex = accent.length === 4 ? accent.slice(1).split("").map((digit) => digit + digit).join("") : accent.slice(1);
|
|
1156
|
+
const [red, green, blue] = [0, 2, 4].map((offset) => {
|
|
1157
|
+
const channel = parseInt(hex.slice(offset, offset + 2), 16) / 255;
|
|
1158
|
+
return channel <= 0.04045 ? channel / 12.92 : ((channel + 0.055) / 1.055) ** 2.4;
|
|
1159
|
+
});
|
|
1160
|
+
return 0.2126 * red + 0.7152 * green + 0.0722 * blue > 0.179 ? "#000" : "#fff";
|
|
1161
|
+
}
|
|
1153
1162
|
function appearanceStyle(appearance) {
|
|
1154
1163
|
return {
|
|
1155
|
-
...appearance.
|
|
1164
|
+
...appearance.base ? { "--basic-surface": appearance.base } : {},
|
|
1165
|
+
...appearance.accent ? {
|
|
1166
|
+
"--basic-accent": appearance.accent,
|
|
1167
|
+
"--basic-accent-text": accentText(appearance.accent)
|
|
1168
|
+
} : {},
|
|
1156
1169
|
...appearance.radius ? { "--basic-radius": appearance.radius } : {}
|
|
1157
1170
|
};
|
|
1158
1171
|
}
|
|
@@ -1269,6 +1282,7 @@ function UserAvatar({
|
|
|
1269
1282
|
auth,
|
|
1270
1283
|
projectProfile,
|
|
1271
1284
|
allowAddAccount,
|
|
1285
|
+
menuItems,
|
|
1272
1286
|
...avatarProps
|
|
1273
1287
|
}) {
|
|
1274
1288
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
@@ -1278,6 +1292,7 @@ function UserAvatar({
|
|
|
1278
1292
|
auth,
|
|
1279
1293
|
projectProfile,
|
|
1280
1294
|
allowAddAccount,
|
|
1295
|
+
menuItems,
|
|
1281
1296
|
sync: avatarProps.sync,
|
|
1282
1297
|
showSyncBadge: avatarProps.showSyncBadge,
|
|
1283
1298
|
avatarProps
|
|
@@ -1406,7 +1421,8 @@ function UserMenu({
|
|
|
1406
1421
|
projectProfile,
|
|
1407
1422
|
allowAddAccount = true,
|
|
1408
1423
|
className = "",
|
|
1409
|
-
accountSettingsUrl
|
|
1424
|
+
accountSettingsUrl,
|
|
1425
|
+
menuItems = []
|
|
1410
1426
|
}) {
|
|
1411
1427
|
const liveAccounts = useAccounts();
|
|
1412
1428
|
const liveAuth = useAuth();
|
|
@@ -1526,6 +1542,22 @@ function UserMenu({
|
|
|
1526
1542
|
]
|
|
1527
1543
|
}
|
|
1528
1544
|
),
|
|
1545
|
+
menuItems.map((item) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
1546
|
+
import_menu.Menu.Item,
|
|
1547
|
+
{
|
|
1548
|
+
className: "basic-menu-item",
|
|
1549
|
+
render: item.href !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("a", { href: item.href }) : void 0,
|
|
1550
|
+
disabled: item.disabled || action.pending,
|
|
1551
|
+
onClick: () => {
|
|
1552
|
+
if (item.onClick) void action.run(item.onClick);
|
|
1553
|
+
},
|
|
1554
|
+
children: [
|
|
1555
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "basic-menu-icon", "aria-hidden": "true", children: item.icon }),
|
|
1556
|
+
item.label
|
|
1557
|
+
]
|
|
1558
|
+
},
|
|
1559
|
+
item.id
|
|
1560
|
+
)),
|
|
1529
1561
|
(auth.isSignedIn || expired || active?.kind === "anon") && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
1530
1562
|
import_menu.Menu.Item,
|
|
1531
1563
|
{
|
|
@@ -1582,7 +1614,7 @@ function UserMenu({
|
|
|
1582
1614
|
},
|
|
1583
1615
|
account.id
|
|
1584
1616
|
)),
|
|
1585
|
-
(allowAddAccount || !auth.isSignedIn && !expired) && /* @__PURE__ */ (0, import_jsx_runtime3.
|
|
1617
|
+
(allowAddAccount || !auth.isSignedIn && !expired) && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
1586
1618
|
import_menu.Menu.Item,
|
|
1587
1619
|
{
|
|
1588
1620
|
className: "basic-menu-item",
|
|
@@ -1590,7 +1622,24 @@ function UserMenu({
|
|
|
1590
1622
|
onClick: () => void action.run(
|
|
1591
1623
|
() => allowAddAccount ? accounts.addAccount({ signIn: true }) : auth.signIn()
|
|
1592
1624
|
),
|
|
1593
|
-
children:
|
|
1625
|
+
children: [
|
|
1626
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1627
|
+
"svg",
|
|
1628
|
+
{
|
|
1629
|
+
className: "basic-menu-icon",
|
|
1630
|
+
width: "16",
|
|
1631
|
+
height: "16",
|
|
1632
|
+
viewBox: "0 0 24 24",
|
|
1633
|
+
fill: "none",
|
|
1634
|
+
stroke: "currentColor",
|
|
1635
|
+
strokeWidth: "1.75",
|
|
1636
|
+
strokeLinecap: "round",
|
|
1637
|
+
"aria-hidden": "true",
|
|
1638
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M12 5v14M5 12h14" })
|
|
1639
|
+
}
|
|
1640
|
+
),
|
|
1641
|
+
"Add account"
|
|
1642
|
+
]
|
|
1594
1643
|
}
|
|
1595
1644
|
)
|
|
1596
1645
|
] }) }) })
|