@dxos/react-ui 0.3.3-main.72cb938 → 0.3.3-main.86c283d

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.
@@ -2,7 +2,7 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import { DotsSixVertical, DotsThreeVertical } from '@phosphor-icons/react';
5
+ import { DotsSixVertical, DotsThreeVertical, type Icon } from '@phosphor-icons/react';
6
6
  import { type Primitive } from '@radix-ui/react-primitive';
7
7
  import React, {
8
8
  type ComponentPropsWithoutRef,
@@ -72,10 +72,23 @@ const CardDragHandle: FC<CardDragHandleProps> = ({ position, classNames, ...prop
72
72
  );
73
73
  };
74
74
 
75
+ type CardEndcapProps = ThemedClassName<ComponentPropsWithoutRef<'div'>> & { Icon: Icon; position?: 'left' | 'right' };
76
+
77
+ const CardEndcap: FC<CardEndcapProps> = ({ Icon, position, classNames, ...props }) => {
78
+ const { tx } = useThemeContext();
79
+ const density = useDensityContext();
80
+ return (
81
+ <div {...props} className={tx('card.menu', 'card', { density, position }, classNames)}>
82
+ <Icon className={tx('card.menuIcon', 'card')} />
83
+ </div>
84
+ );
85
+ };
86
+
75
87
  type CardMenuProps = PropsWithChildren<
76
88
  ThemedClassName<ComponentPropsWithoutRef<'div'>> & { position?: 'left' | 'right' }
77
89
  >;
78
90
 
91
+ // TODO(burdon): Reconcile with Endcap (remove dropdown from here). See ListItem.Endcap (style icon/size?)
79
92
  const CardMenu = forwardRef<HTMLDivElement, CardMenuProps>(
80
93
  ({ children, position, classNames, ...props }, forwardRef) => {
81
94
  const { tx } = useThemeContext();
@@ -124,6 +137,7 @@ export const Card = {
124
137
  Root: CardRoot,
125
138
  Header: CardHeader,
126
139
  DragHandle: CardDragHandle,
140
+ Endcap: CardEndcap,
127
141
  Menu: CardMenu,
128
142
  Title: CardTitle,
129
143
  Body: CardBody,
@@ -131,8 +131,6 @@ type MainSidebarProps = ThemedClassName<ComponentPropsWithRef<typeof DialogConte
131
131
  side: 'inline-start' | 'inline-end';
132
132
  };
133
133
 
134
- // TODO(burdon): Factor out Sidebar?
135
- // TODO(burdon): Style left/right sidebar differently.
136
134
  const MainSidebar = forwardRef<HTMLDivElement, MainSidebarProps>(
137
135
  ({ classNames, children, swipeToDismiss, onOpenAutoFocus, open, setOpen, side, ...props }, forwardedRef) => {
138
136
  const [isLg] = useMediaQuery('lg', { ssr: false });
@@ -259,9 +257,9 @@ const MainOverlay = forwardRef<HTMLDivElement, MainOverlayProps>(({ classNames,
259
257
  });
260
258
 
261
259
  export const Main = {
260
+ Root: MainRoot,
262
261
  Content: MainContent,
263
262
  Overlay: MainOverlay,
264
- Root: MainRoot,
265
263
  NavigationSidebar: MainNavigationSidebar,
266
264
  ComplementarySidebar: MainComplementarySidebar,
267
265
  };