Skip to content

Commit 89199fa

Browse files
committed
refactor(mosaic): split compound components into client leaves and namespace parts
1 parent efbd6c6 commit 89199fa

111 files changed

Lines changed: 556 additions & 335 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
---
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export {
2+
ActionBarRoot as Root,
3+
ActionBarAction as Action,
4+
ActionBarCount as Count,
5+
ActionBarSeparator as Separator,
6+
ActionBarDismiss as Dismiss,
7+
} from './action-bar';

‎packages/mosaic/src/components/action-bar/action-bar.test.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { beforeEach, describe, expect, it, vi } from 'vitest';
77
import { PortalProvider } from '../../primitives/portal';
88
import { Dialog } from '../dialog';
99
import { Menu } from '../menu';
10-
import { ActionBar } from './action-bar';
10+
import { ActionBar } from '.';
1111

1212
const testStyles = stylex.create({
1313
positioner: {

‎packages/mosaic/src/components/action-bar/action-bar.tsx‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
'use client';
2+
13
import {
24
autoUpdate,
35
FloatingFocusManager,
@@ -343,4 +345,10 @@ const Dismiss = React.forwardRef<HTMLButtonElement, ActionBarDismissProps>(funct
343345
);
344346
});
345347

346-
export const ActionBar = { Root, Action, Count, Separator, Dismiss };
348+
export {
349+
Root as ActionBarRoot,
350+
Action as ActionBarAction,
351+
Count as ActionBarCount,
352+
Separator as ActionBarSeparator,
353+
Dismiss as ActionBarDismiss,
354+
};

‎packages/mosaic/src/components/action-bar/index.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export { ActionBar } from './action-bar';
1+
export * as ActionBar from './action-bar.parts';
22
export type {
33
ActionBarActionProps,
44
ActionBarCountProps,
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { AvatarRoot as Root, AvatarImage as Image, AvatarFallback as Fallback, AvatarIcon as Icon } from './avatar';

‎packages/mosaic/src/components/avatar/avatar.test.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
77

88
import { Pen } from '../../icons/glyphs/pen';
99
import { Icon } from '../icon';
10-
import { Avatar } from './avatar';
10+
import { Avatar } from '.';
1111
import { styles } from './avatar.styles';
1212

1313
// React reads this off the global object and ships no typing for it.

‎packages/mosaic/src/components/avatar/avatar.tsx‎

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
'use client';
2+
13
import { useSafeLayoutEffect } from '@clerk/shared/react';
24
import * as stylex from '@stylexjs/stylex';
35
import React from 'react';
@@ -193,15 +195,4 @@ const AvatarIcon = React.forwardRef<HTMLSpanElement, AvatarIconProps>(function M
193195
);
194196
});
195197

196-
/**
197-
* Compound avatar. `Avatar.Root` positions and sizes the box; `Avatar.Image` renders
198-
* once its source loads; `Avatar.Fallback` holds the space until then, as a blank
199-
* placeholder that shimmers only while an image is actually on its way; `Avatar.Icon`
200-
* adds an optional corner affordance.
201-
*/
202-
export const Avatar = {
203-
Root: AvatarRoot,
204-
Image: AvatarImage,
205-
Fallback: AvatarFallback,
206-
Icon: AvatarIcon,
207-
};
198+
export { AvatarRoot, AvatarImage, AvatarFallback, AvatarIcon };
Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
'use client';
22

3-
export { Avatar } from './avatar';
3+
/**
4+
* Compound avatar. `Avatar.Root` positions and sizes the box; `Avatar.Image` renders
5+
* once its source loads; `Avatar.Fallback` holds the space until then, as a blank
6+
* placeholder that shimmers only while an image is actually on its way; `Avatar.Icon`
7+
* adds an optional corner affordance.
8+
*/
9+
export * as Avatar from './avatar.parts';
410
export type { AvatarProps, AvatarImageProps, AvatarFallbackProps, AvatarIconProps } from './avatar';
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { BannerRoot as Root, BannerLabel as Label, BannerDescription as Description } from './banner';

0 commit comments

Comments
 (0)