@dxos/react-ui 0.3.3-main.9766dd8 → 0.3.3-main.b1ae07a
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/dist/lib/browser/index.mjs +15 -1
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/types/src/components/Card/Card.d.ts +6 -0
- package/dist/types/src/components/Card/Card.d.ts.map +1 -1
- package/dist/types/src/components/Card/Card.stories.d.ts +6 -0
- package/dist/types/src/components/Card/Card.stories.d.ts.map +1 -1
- package/dist/types/src/components/Main/Main.d.ts +2 -2
- package/dist/types/src/components/Main/Main.d.ts.map +1 -1
- package/package.json +6 -6
- package/src/components/Card/Card.tsx +15 -1
- package/src/components/Main/Main.tsx +1 -3
|
@@ -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
|
};
|