Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .changeset/mosaic-profile-component.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ To find the code to update, run:
git grep -n '<UserProfile'
```

New exported types: `ProfileProps`, `CombinedProfileProps` and `ProfileMode`.
New exported type: `ProfileProps`.
2 changes: 1 addition & 1 deletion .changeset/mosaic-switcher.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
| `<UserButton combined={false} />` | `<UserButton />` or `<Switcher mode='user' />` |
| `<UserButton triggerVariant='condensed' />` | `<Switcher triggerVariant='condensed' />` |
| Organization props on `UserButton` (`hidePersonal`, `afterSelectOrganizationUrl`, `createOrganizationUrl`, ...) | The same props on `Switcher` |
| `UserButtonProps` (combined menu) | `CombinedSwitcherProps` |
| `UserButtonProps` (combined menu) | `SwitcherProps` |
| `UserButtonProps` (user-only menu) | `UserButtonProps`, which now takes account options only |
| `.cl-user-button-*` classes on the combined menu | `.cl-switcher-*`; `UserButton` keeps `.cl-user-button-*` |

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import type { ReactElement } from 'react';
import type { OrganizationSwitcherProps } from '../switcher/switcher';
import { Switcher } from '../switcher/switcher';

export type { OrganizationSwitcherProps };

/**
* The active organization's avatar, and the menu behind it: switch organization or back to the
* personal account, join a suggested or invited one, create one, invite members, and open the
Expand Down
4 changes: 2 additions & 2 deletions packages/mosaic/src/features/profile/profile.test-d.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { describe, test } from 'vitest';

import { OrganizationProfile } from '../organization-profile/organization-profile';
import { UserProfile } from '../user-profile/user-profile';
import type { ProfileMode, ProfileProps } from './profile';
import type { ProfileProps } from './profile';
import { Profile } from './profile';

describe('Profile props', () => {
Expand Down Expand Up @@ -85,6 +85,6 @@ describe('UserProfile and OrganizationProfile props', () => {
});
});

function pickMode(): ProfileMode {
function pickMode(): NonNullable<ProfileProps['mode']> {
return 'user';
}
3 changes: 0 additions & 3 deletions packages/mosaic/src/features/profile/profile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ import { UserProfileProfilePanel } from '../user-profile/user-profile-profile-pa
import { UserProfileSecurityPanel } from '../user-profile/user-profile-security-panel';
import { useUserProfileUserModel } from '../user-profile/user-profile-user.model';

/** Which pages the profile carries: the account's and the active organization's, or one of them alone. */
export type ProfileMode = 'combined' | 'user' | 'organization';

/** Everything `<Profile />` takes in `combined` mode. */
export interface CombinedProfileProps extends UserProfileProps {
/**
Expand Down
3 changes: 1 addition & 2 deletions packages/mosaic/src/features/switcher/switcher.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ type SwitcherBaseProps = SwitcherTriggerProps &
fallback?: ReactNode;
};

/** Everything `<Switcher />` takes in `combined` mode. */
export type CombinedSwitcherProps = SwitcherBaseProps &
type CombinedSwitcherProps = SwitcherBaseProps &
SwitcherModelOptions & {
/**
* How much the labelled trigger carries: `full` badges the active organization with the account at a
Expand Down
2 changes: 2 additions & 0 deletions packages/mosaic/src/features/user-button/user-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import type { ReactElement } from 'react';
import type { UserButtonProps } from '../switcher/switcher';
import { Switcher } from '../switcher/switcher';

export type { UserButtonProps };

/**
* The signed-in user's avatar, and the account menu behind it: switch or add an account, open the
* profile, and sign out. It never lists an organization, even when one is active. It is
Expand Down
11 changes: 4 additions & 7 deletions packages/mosaic/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,17 @@

export type { OAuthConsentProps } from './features/oauth-consent/oauth-consent';
export { OAuthConsent } from './features/oauth-consent/oauth-consent';
export type {
CombinedSwitcherProps,
OrganizationSwitcherProps,
SwitcherProps,
UserButtonProps,
} from './features/switcher/switcher';
export type { SwitcherProps } from './features/switcher/switcher';
export { Switcher } from './features/switcher/switcher';
export type { UserButtonProps } from './features/user-button/user-button';
export { UserButton } from './features/user-button/user-button';
export type { UserAvatarProps } from './features/user-avatar/user-avatar';
export { UserAvatar } from './features/user-avatar/user-avatar';
export type { OrganizationSwitcherProps } from './features/organization-switcher/organization-switcher';
export { OrganizationSwitcher } from './features/organization-switcher/organization-switcher';
export type { OrganizationProfileProps } from './features/organization-profile/organization-profile';
export { OrganizationProfile } from './features/organization-profile/organization-profile';
export type { CombinedProfileProps, ProfileMode, ProfileProps } from './features/profile/profile';
export type { ProfileProps } from './features/profile/profile';
export { Profile } from './features/profile/profile';
export type { UserProfileProps } from './features/user-profile/user-profile';
export { UserProfile } from './features/user-profile/user-profile';
Expand Down
Loading