Skip to content

Commit b90fcfe

Browse files
Merge branch 'main' into austin/user-profile-03-avatar-button
2 parents 0e9b173 + 1b05db4 commit b90fcfe

36 files changed

Lines changed: 1674 additions & 378 deletions
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
---
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
---
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
---
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
---

.changeset/settings-block.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
---

packages/swingset/src/components/DocsViewer.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ const docModules: Record<string, Record<string, React.ComponentType>> = {
4242
icon: dynamic(() => import('../stories/icon.mdx')),
4343
menu: dynamic(() => import('../stories/menu.component.mdx')),
4444
popover: dynamic(() => import('../stories/popover.component.mdx')),
45+
settings: dynamic(() => import('../stories/settings.mdx')),
4546
tabs: dynamic(() => import('../stories/tabs.component.mdx')),
4647
text: dynamic(() => import('../stories/text.mdx')),
4748
field: dynamic(() => import('../stories/field.component.mdx')),

packages/swingset/src/lib/registry.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,13 @@ import {
107107
ThemedScrollbar as ScrollAreaThemedScrollbar,
108108
} from '../stories/scroll-area.stories';
109109
import { meta as selectMeta } from '../stories/select.stories';
110+
import {
111+
ConnectedAccounts as SettingsConnectedAccounts,
112+
Default as SettingsDefault,
113+
Destructive as SettingsDestructive,
114+
meta as settingsMeta,
115+
MultipleEmailAndPhoneNumbers as SettingsMultipleEmailAndPhoneNumbers,
116+
} from '../stories/settings.stories';
110117
import { Default as TabsComponentDefault, meta as tabsComponentMeta } from '../stories/tabs.component.stories';
111118
import { meta as tabsMeta } from '../stories/tabs.stories';
112119
import {
@@ -127,6 +134,13 @@ import { toSlug } from './slug';
127134
import type { StoryModule } from './types';
128135

129136
const destructiveModule: StoryModule = { meta: destructiveMeta, Default: DestructiveDefault };
137+
const settingsModule: StoryModule = {
138+
meta: settingsMeta,
139+
Default: SettingsDefault,
140+
MultipleEmailAndPhoneNumbers: SettingsMultipleEmailAndPhoneNumbers,
141+
ConnectedAccounts: SettingsConnectedAccounts,
142+
Destructive: SettingsDestructive,
143+
};
130144
const organizationProfileLeaveSectionModule: StoryModule = {
131145
meta: organizationProfileLeaveSectionMeta,
132146
Default: OrganizationProfileLeaveSectionDefault,
@@ -283,6 +297,7 @@ export const registry: StoryModule[] = [
283297
iconModule,
284298
menuComponentModule,
285299
popoverComponentModule,
300+
settingsModule,
286301
tabsComponentModule,
287302
textModule,
288303
fieldModule,

packages/swingset/src/stories/card.component.stories.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,12 @@ export const meta: StoryMeta = {
2020
_variants: {
2121
alignment: { start: {}, center: {} },
2222
elevation: { card: {}, flush: {}, overlay: {} },
23+
renderBranding: { true: {}, false: {} },
2324
},
2425
_defaultVariants: {
2526
alignment: 'start',
2627
elevation: 'card',
28+
renderBranding: true,
2729
},
2830
},
2931
};

packages/swingset/src/stories/item.mdx

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as ItemStories from './item.stories';
22

33
# Item
44

5-
Item is a flexible row for lists of accounts, organizations, and settings in Mosaic. It's composed from parts via dot syntax (`Item.Root`, `Item.Media`, `Item.Content`, `Item.Title`, …). `Item.Root` renders as a `<div>` by default; pass it a `render` prop to make a row an interactive link or button, which adds hover and cursor affordances.
5+
Item is a flexible row for lists of accounts, organizations, and settings in Mosaic. It's composed from parts via dot syntax (`Item.Root`, `Item.Media`, `Item.Content`, `Item.Label`, …). `Item.Root` renders as a `<div>` by default; pass it a `render` prop to make a row an interactive link or button, which adds hover and cursor affordances.
66

77
Set `size` once on `Item.Root` and the row scales as a unit: it fixes the row's height and gap, and `Item.Media` picks the matching column width up from context rather than taking a size of its own.
88

@@ -76,7 +76,7 @@ import { Item } from '@clerk/ui/mosaic/components/item';
7676
</Avatar.Root>
7777
</Item.Media>
7878
<Item.Content>
79-
<Item.Title>Test Organization</Item.Title>
79+
<Item.Label>Test Organization</Item.Label>
8080
<Item.Description>Member</Item.Description>
8181
</Item.Content>
8282
<Item.Actions>
@@ -86,38 +86,43 @@ import { Item } from '@clerk/ui/mosaic/components/item';
8686
</Item.Group>;
8787
```
8888

89-
Media sizes itself from the row, so give it a child that fills its column — an `Avatar.Root` with `size='fit'`, or an `Icon`. An action row that has no secondary text uses `Item.Label` in place of `Item.Title`:
89+
Media sizes itself from the row, so give it a child that fills its column — an `Avatar.Root` with `size='fit'`, or an `Icon`. A row whose text _is_ the row, rather than naming a subject, uses `Item.Label` with `variant='secondary'`:
9090

9191
```tsx
9292
<Item.Root size='xs' render={({ children, ...props }) => <button type='button' {...props}>{children}</button>}>
9393
<Item.Media>
9494
<Icon name='log-out' size='sm' />
9595
</Item.Media>
9696
<Item.Content>
97-
<Item.Label>Sign out of all accounts</Item.Label>
97+
<Item.Label variant='secondary'>Sign out of all accounts</Item.Label>
9898
</Item.Content>
9999
</Item.Root>;
100100
```
101101

102102
## Parts
103103

104-
| Part | Class | Description |
105-
| ------------------ | --------------------- | -------------------------------------------------------------------------------- |
106-
| `Item.Root` | `cl-item` | Root row. Renders a `<div>`, or a custom element via `render`. |
107-
| `Item.Media` | `cl-item-media` | Square leading column: icon, image, or avatar. Sized by the root's `size`. |
108-
| `Item.Content` | `cl-item-content` | Vertical stack that grows to fill the row between media and actions. |
109-
| `Item.Title` | `cl-item-title` | Primary label. Truncates to a single line. |
110-
| `Item.Description` | `cl-item-description` | Secondary text beneath the title. Truncates to a single line. |
111-
| `Item.Label` | `cl-item-label` | Sole label on an action row, in place of a title. Inherits the row's text color. |
112-
| `Item.Actions` | `cl-item-actions` | Trailing controls (buttons, badges). |
113-
| `Item.Group` | `cl-item-group` | Vertical wrapper around a set of rows (layout only, no role). |
114-
| `Item.Separator` | `cl-item-separator` | Thin divider (`<hr>`) between rows. |
104+
| Part | Class | Description |
105+
| ------------------ | --------------------- | -------------------------------------------------------------------------- |
106+
| `Item.Root` | `cl-item` | Root row. Renders a `<div>`, or a custom element via `render`. |
107+
| `Item.Media` | `cl-item-media` | Square leading column: icon, image, or avatar. Sized by the root's `size`. |
108+
| `Item.Content` | `cl-item-content` | Vertical stack that grows to fill the row between media and actions. |
109+
| `Item.Label` | `cl-item-label` | The row's label. Truncates to a single line. |
110+
| `Item.Description` | `cl-item-description` | Secondary text beneath the label. Truncates to a single line. |
111+
| `Item.Actions` | `cl-item-actions` | Trailing controls (buttons, badges). |
112+
| `Item.Group` | `cl-item-group` | Vertical wrapper around a set of rows (layout only, no role). |
113+
| `Item.Separator` | `cl-item-separator` | Thin divider (`<hr>`) between rows. |
115114

116115
Every part accepts a `render` prop for element polymorphism and forwards a ref.
117116

118117
## Styling
119118

120-
The row carries the text color and, through `--_cl-icon-color`, the strength of any `Icon` inside it: faded at rest, full-strength while hovered. Only interactive rows promote — a static row isn't pointing at anything, so its icon and `Item.Label` hold their resting color. A `Button` in `Item.Actions` sets its own icon color and is unaffected.
119+
The row carries the text color and, through `--_cl-icon-color`, the strength of any `Icon` inside it: faded at rest, full-strength while hovered. Only interactive rows promote — a static row isn't pointing at anything, so its icon holds its resting color. A `Button` in `Item.Actions` sets its own icon color and is unaffected.
120+
121+
`Item.Label` chooses whether it joins that promotion. `variant='primary'` sets its own color and holds it, so a subject the row names reads at full strength either way. `variant='secondary'` sets none and inherits the row's, so it fades and brightens with the row:
122+
123+
| Prop | Attribute | Values | Default |
124+
| --------- | -------------- | ------------------------ | --------- |
125+
| `variant` | `data-variant` | `primary` \| `secondary` | `primary` |
121126

122127
The root reflects its state as `data-*` attributes on `.cl-item`, so consumers can scope overrides without touching StyleX's hashed atoms:
123128

packages/swingset/src/stories/item.stories.tsx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export function Default() {
3232
</Avatar.Root>
3333
</Item.Media>
3434
<Item.Content>
35-
<Item.Title>Test Organization</Item.Title>
35+
<Item.Label>Test Organization</Item.Label>
3636
<Item.Description>Member</Item.Description>
3737
</Item.Content>
3838
<Item.Actions>
@@ -68,7 +68,7 @@ export function Interactive() {
6868
</Avatar.Root>
6969
</Item.Media>
7070
<Item.Content>
71-
<Item.Title>Test Organization</Item.Title>
71+
<Item.Label>Test Organization</Item.Label>
7272
<Item.Description>Member</Item.Description>
7373
</Item.Content>
7474
</Item.Root>
@@ -92,7 +92,7 @@ export function Sizes() {
9292
</Avatar.Root>
9393
</Item.Media>
9494
<Item.Content>
95-
<Item.Title>Test Organization</Item.Title>
95+
<Item.Label>Test Organization</Item.Label>
9696
</Item.Content>
9797
</Item.Root>
9898
))}
@@ -114,7 +114,7 @@ export function Group() {
114114
</Avatar.Root>
115115
</Item.Media>
116116
<Item.Content>
117-
<Item.Title>Cameron Walker</Item.Title>
117+
<Item.Label>Cameron Walker</Item.Label>
118118
<Item.Description>cameron@clerk.com</Item.Description>
119119
</Item.Content>
120120
<Item.Actions>
@@ -158,7 +158,7 @@ export function Group() {
158158
</Avatar.Root>
159159
</Item.Media>
160160
<Item.Content>
161-
<Item.Title>Clerk</Item.Title>
161+
<Item.Label>Clerk</Item.Label>
162162
</Item.Content>
163163
<Icon
164164
name='check'
@@ -189,7 +189,7 @@ export function Group() {
189189
</Avatar.Root>
190190
</Item.Media>
191191
<Item.Content>
192-
<Item.Title>Clerk</Item.Title>
192+
<Item.Label>Clerk</Item.Label>
193193
</Item.Content>
194194
</Item.Root>
195195
</Item.Group>
@@ -215,7 +215,7 @@ export function Group() {
215215
</Avatar.Root>
216216
</Item.Media>
217217
<Item.Content>
218-
<Item.Title>DesignCloud</Item.Title>
218+
<Item.Label>DesignCloud</Item.Label>
219219
</Item.Content>
220220
</Item.Root>
221221
</Item.Group>
@@ -239,7 +239,7 @@ export function Group() {
239239
/>
240240
</Item.Media>
241241
<Item.Content>
242-
<Item.Label>Add account</Item.Label>
242+
<Item.Label variant='secondary'>Add account</Item.Label>
243243
</Item.Content>
244244
</Item.Root>
245245
<Item.Root
@@ -260,7 +260,7 @@ export function Group() {
260260
/>
261261
</Item.Media>
262262
<Item.Content>
263-
<Item.Label>Sign out of all accounts</Item.Label>
263+
<Item.Label variant='secondary'>Sign out of all accounts</Item.Label>
264264
</Item.Content>
265265
</Item.Root>
266266
</Item.Group>
@@ -324,7 +324,7 @@ export function Scrolling() {
324324
</Avatar.Root>
325325
</Item.Media>
326326
<Item.Content>
327-
<Item.Title>{name}</Item.Title>
327+
<Item.Label>{name}</Item.Label>
328328
</Item.Content>
329329
</Item.Root>
330330
))}

0 commit comments

Comments
 (0)