@dxos/react-ui 0.3.9-main.b7e6a67 → 0.3.9-main.c7cd0ec
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 +270 -385
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/types/src/components/AnchoredOverflow/AnchoredOverflow.d.ts.map +1 -1
- package/dist/types/src/components/Avatars/Avatar.stories.d.ts +1 -0
- package/dist/types/src/components/Avatars/Avatar.stories.d.ts.map +1 -1
- package/dist/types/src/components/Avatars/AvatarGroup.stories.d.ts +1 -0
- package/dist/types/src/components/Avatars/AvatarGroup.stories.d.ts.map +1 -1
- package/dist/types/src/components/Breadcrumb/Breadcrumb.d.ts.map +1 -1
- package/dist/types/src/components/Breadcrumb/Breadcrumb.stories.d.ts +1 -0
- package/dist/types/src/components/Breadcrumb/Breadcrumb.stories.d.ts.map +1 -1
- package/dist/types/src/components/Buttons/Button.stories.d.ts +1 -0
- package/dist/types/src/components/Buttons/Button.stories.d.ts.map +1 -1
- package/dist/types/src/components/Buttons/Toggle.stories.d.ts +1 -0
- package/dist/types/src/components/Buttons/Toggle.stories.d.ts.map +1 -1
- package/dist/types/src/components/Buttons/ToggleGroup.stories.d.ts +1 -0
- package/dist/types/src/components/Buttons/ToggleGroup.stories.d.ts.map +1 -1
- package/dist/types/src/components/Dialogs/AlertDialog.stories.d.ts +1 -0
- package/dist/types/src/components/Dialogs/AlertDialog.stories.d.ts.map +1 -1
- package/dist/types/src/components/Dialogs/Dialog.stories.d.ts +1 -0
- package/dist/types/src/components/Dialogs/Dialog.stories.d.ts.map +1 -1
- package/dist/types/src/components/DropdownMenu/DropdownMenu.stories.d.ts +1 -0
- package/dist/types/src/components/DropdownMenu/DropdownMenu.stories.d.ts.map +1 -1
- package/dist/types/src/components/Input/Input.d.ts +2 -2
- package/dist/types/src/components/Input/Input.d.ts.map +1 -1
- package/dist/types/src/components/Input/Input.stories.d.ts +2 -1
- package/dist/types/src/components/Input/Input.stories.d.ts.map +1 -1
- package/dist/types/src/components/Link/Link.stories.d.ts.map +1 -1
- package/dist/types/src/components/Lists/List.d.ts.map +1 -0
- package/dist/types/src/components/{List → Lists}/List.stories.d.ts +1 -0
- package/dist/types/src/components/Lists/List.stories.d.ts.map +1 -0
- package/dist/types/src/components/Lists/Tree.d.ts.map +1 -0
- package/dist/types/src/components/{List → Lists}/Tree.stories.d.ts +1 -0
- package/dist/types/src/components/Lists/Tree.stories.d.ts.map +1 -0
- package/dist/types/src/components/Lists/index.d.ts.map +1 -0
- package/dist/types/src/components/Main/Main.d.ts +2 -2
- package/dist/types/src/components/Main/Main.stories.d.ts +1 -0
- package/dist/types/src/components/Main/Main.stories.d.ts.map +1 -1
- package/dist/types/src/components/Message/Message.stories.d.ts +1 -0
- package/dist/types/src/components/Message/Message.stories.d.ts.map +1 -1
- package/dist/types/src/components/Popover/Popover.stories.d.ts +6 -0
- package/dist/types/src/components/Popover/Popover.stories.d.ts.map +1 -1
- package/dist/types/src/components/ScrollArea/ScrollArea.stories.d.ts +6 -0
- package/dist/types/src/components/ScrollArea/ScrollArea.stories.d.ts.map +1 -1
- package/dist/types/src/components/Select/Select.stories.d.ts +6 -0
- package/dist/types/src/components/Select/Select.stories.d.ts.map +1 -1
- package/dist/types/src/components/Status/Status.d.ts +10 -0
- package/dist/types/src/components/Status/Status.d.ts.map +1 -0
- package/dist/types/src/components/Status/Status.stories.d.ts +18 -0
- package/dist/types/src/components/Status/Status.stories.d.ts.map +1 -0
- package/dist/types/src/components/Status/index.d.ts +2 -0
- package/dist/types/src/components/Status/index.d.ts.map +1 -0
- package/dist/types/src/components/Tag/Tag.stories.d.ts.map +1 -1
- package/dist/types/src/components/Toast/Toast.stories.d.ts +6 -0
- package/dist/types/src/components/Toast/Toast.stories.d.ts.map +1 -1
- package/dist/types/src/components/Toolbar/Toolbar.stories.d.ts +6 -0
- package/dist/types/src/components/Toolbar/Toolbar.stories.d.ts.map +1 -1
- package/dist/types/src/components/Tooltip/Tooltip.stories.d.ts +6 -0
- package/dist/types/src/components/Tooltip/Tooltip.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +2 -4
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/playground/Controls.stories.d.ts +6 -0
- package/dist/types/src/playground/Controls.stories.d.ts.map +1 -1
- package/dist/types/src/playground/Surfaces.stories.d.ts +6 -0
- package/dist/types/src/playground/Surfaces.stories.d.ts.map +1 -1
- package/dist/types/src/testing/decorators/index.d.ts +2 -0
- package/dist/types/src/testing/decorators/index.d.ts.map +1 -0
- package/dist/types/src/testing/decorators/with-theme.d.ts +3 -0
- package/dist/types/src/testing/decorators/with-theme.d.ts.map +1 -0
- package/dist/types/src/testing/index.d.ts +2 -0
- package/dist/types/src/testing/index.d.ts.map +1 -0
- package/package.json +8 -14
- package/src/components/AnchoredOverflow/AnchoredOverflow.tsx +12 -2
- package/src/components/Avatars/Avatar.stories.tsx +2 -0
- package/src/components/Avatars/AvatarGroup.stories.tsx +2 -0
- package/src/components/Breadcrumb/Breadcrumb.stories.tsx +2 -0
- package/src/components/Breadcrumb/Breadcrumb.tsx +9 -1
- package/src/components/Buttons/Button.stories.tsx +2 -0
- package/src/components/Buttons/Toggle.stories.tsx +2 -0
- package/src/components/Buttons/ToggleGroup.stories.tsx +2 -0
- package/src/components/Dialogs/AlertDialog.stories.tsx +2 -0
- package/src/components/Dialogs/Dialog.stories.tsx +2 -0
- package/src/components/DropdownMenu/DropdownMenu.stories.tsx +2 -0
- package/src/components/Input/Input.stories.tsx +21 -2
- package/src/components/Input/Input.tsx +3 -1
- package/src/components/Link/Link.stories.tsx +2 -0
- package/src/components/{List → Lists}/List.stories.tsx +2 -0
- package/src/components/{List → Lists}/Tree.stories.tsx +2 -0
- package/src/components/Main/Main.stories.tsx +5 -1
- package/src/components/Message/Message.stories.tsx +2 -0
- package/src/components/Popover/Popover.stories.tsx +3 -0
- package/src/components/ScrollArea/ScrollArea.stories.tsx +3 -0
- package/src/components/Select/Select.stories.tsx +3 -0
- package/src/components/Status/Status.stories.tsx +36 -0
- package/src/components/Status/Status.tsx +38 -0
- package/src/components/{Card → Status}/index.ts +1 -1
- package/src/components/Tag/Tag.stories.tsx +3 -0
- package/src/components/Toast/Toast.stories.tsx +3 -0
- package/src/components/Toolbar/Toolbar.stories.tsx +3 -0
- package/src/components/Tooltip/Tooltip.stories.tsx +3 -0
- package/src/components/index.ts +2 -4
- package/src/playground/Controls.stories.tsx +3 -0
- package/src/playground/Surfaces.stories.tsx +4 -0
- package/src/{components/Center → testing/decorators}/index.ts +1 -1
- package/src/testing/decorators/with-theme.ts +22 -0
- package/src/{components/ProgressBar → testing}/index.ts +1 -1
- package/dist/types/src/components/Card/Card.d.ts +0 -52
- package/dist/types/src/components/Card/Card.d.ts.map +0 -1
- package/dist/types/src/components/Card/Card.stories.d.ts +0 -56
- package/dist/types/src/components/Card/Card.stories.d.ts.map +0 -1
- package/dist/types/src/components/Card/index.d.ts +0 -2
- package/dist/types/src/components/Card/index.d.ts.map +0 -1
- package/dist/types/src/components/Center/Center.d.ts +0 -4
- package/dist/types/src/components/Center/Center.d.ts.map +0 -1
- package/dist/types/src/components/Center/Center.stories.d.ts +0 -11
- package/dist/types/src/components/Center/Center.stories.d.ts.map +0 -1
- package/dist/types/src/components/Center/index.d.ts +0 -2
- package/dist/types/src/components/Center/index.d.ts.map +0 -1
- package/dist/types/src/components/List/List.d.ts.map +0 -1
- package/dist/types/src/components/List/List.stories.d.ts.map +0 -1
- package/dist/types/src/components/List/Tree.d.ts.map +0 -1
- package/dist/types/src/components/List/Tree.stories.d.ts.map +0 -1
- package/dist/types/src/components/List/index.d.ts.map +0 -1
- package/dist/types/src/components/ProgressBar/ProgressBar.d.ts +0 -7
- package/dist/types/src/components/ProgressBar/ProgressBar.d.ts.map +0 -1
- package/dist/types/src/components/ProgressBar/ProgressBar.stories.d.ts +0 -12
- package/dist/types/src/components/ProgressBar/ProgressBar.stories.d.ts.map +0 -1
- package/dist/types/src/components/ProgressBar/index.d.ts +0 -2
- package/dist/types/src/components/ProgressBar/index.d.ts.map +0 -1
- package/src/components/Card/Card.stories.tsx +0 -220
- package/src/components/Card/Card.tsx +0 -147
- package/src/components/Center/Center.stories.tsx +0 -18
- package/src/components/Center/Center.tsx +0 -16
- package/src/components/ProgressBar/ProgressBar.stories.tsx +0 -33
- package/src/components/ProgressBar/ProgressBar.tsx +0 -29
- /package/dist/types/src/components/{List → Lists}/List.d.ts +0 -0
- /package/dist/types/src/components/{List → Lists}/Tree.d.ts +0 -0
- /package/dist/types/src/components/{List → Lists}/index.d.ts +0 -0
- /package/src/components/{List → Lists}/List.tsx +0 -0
- /package/src/components/{List → Lists}/Tree.tsx +0 -0
- /package/src/components/{List → Lists}/index.ts +0 -0
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { DotsSixVertical, DotsThreeVertical, type Icon } from '@phosphor-icons/react';
|
|
6
|
-
import { type Primitive } from '@radix-ui/react-primitive';
|
|
7
|
-
import React, {
|
|
8
|
-
type ComponentPropsWithoutRef,
|
|
9
|
-
type ComponentPropsWithRef,
|
|
10
|
-
type FC,
|
|
11
|
-
forwardRef,
|
|
12
|
-
type PropsWithChildren,
|
|
13
|
-
} from 'react';
|
|
14
|
-
|
|
15
|
-
import { useDensityContext, useThemeContext } from '../../hooks';
|
|
16
|
-
import { type ThemedClassName } from '../../util';
|
|
17
|
-
import { DropdownMenu } from '../DropdownMenu';
|
|
18
|
-
|
|
19
|
-
type CardRootProps = ThemedClassName<ComponentPropsWithRef<typeof Primitive.div>> & {
|
|
20
|
-
grow?: boolean;
|
|
21
|
-
square?: boolean;
|
|
22
|
-
noPadding?: boolean;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
// TODO(burdon): Forward refs for all components?
|
|
26
|
-
const CardRoot = forwardRef<HTMLDivElement, CardRootProps>(
|
|
27
|
-
({ grow, square, noPadding, classNames, children, ...props }, forwardedRef) => {
|
|
28
|
-
const { tx } = useThemeContext();
|
|
29
|
-
return (
|
|
30
|
-
<div {...props} ref={forwardedRef} className={tx('card.root', 'card', { grow, square, noPadding }, classNames)}>
|
|
31
|
-
{children}
|
|
32
|
-
</div>
|
|
33
|
-
);
|
|
34
|
-
},
|
|
35
|
-
);
|
|
36
|
-
|
|
37
|
-
type CardHeaderProps = ThemedClassName<ComponentPropsWithoutRef<'div'>> & { floating?: boolean };
|
|
38
|
-
|
|
39
|
-
export const CardHeader: FC<CardHeaderProps> = ({ floating, classNames, children, ...props }) => {
|
|
40
|
-
const { tx } = useThemeContext();
|
|
41
|
-
return (
|
|
42
|
-
<div {...props} className={tx('card.header', 'card', { floating }, classNames)}>
|
|
43
|
-
{children}
|
|
44
|
-
</div>
|
|
45
|
-
);
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
type CardTitleProps = ThemedClassName<ComponentPropsWithoutRef<'div'>> & {
|
|
49
|
-
center?: boolean;
|
|
50
|
-
title?: string;
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
export const CardTitle: FC<CardTitleProps> = ({ center, title, classNames, ...props }) => {
|
|
54
|
-
const { tx } = useThemeContext();
|
|
55
|
-
return (
|
|
56
|
-
<div {...props} className={tx('card.title', 'card', { center }, classNames)}>
|
|
57
|
-
{title}
|
|
58
|
-
</div>
|
|
59
|
-
);
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
// TODO(burdon): Reuse ListItemEndcap?
|
|
63
|
-
type CardDragHandleProps = ThemedClassName<ComponentPropsWithoutRef<'div'>> & { position?: 'left' | 'right' };
|
|
64
|
-
|
|
65
|
-
const CardDragHandle: FC<CardDragHandleProps> = ({ position, classNames, ...props }) => {
|
|
66
|
-
const { tx } = useThemeContext();
|
|
67
|
-
const density = useDensityContext();
|
|
68
|
-
return (
|
|
69
|
-
<div {...props} className={tx('card.dragHandle', 'card', { density, position }, classNames)}>
|
|
70
|
-
<DotsSixVertical className={tx('card.dragHandleIcon', 'card')} />
|
|
71
|
-
</div>
|
|
72
|
-
);
|
|
73
|
-
};
|
|
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
|
-
|
|
87
|
-
type CardMenuProps = PropsWithChildren<
|
|
88
|
-
ThemedClassName<ComponentPropsWithoutRef<'div'>> & { position?: 'left' | 'right' }
|
|
89
|
-
>;
|
|
90
|
-
|
|
91
|
-
// TODO(burdon): Reconcile with Endcap (remove dropdown from here). See ListItem.Endcap (style icon/size?)
|
|
92
|
-
const CardMenu = forwardRef<HTMLDivElement, CardMenuProps>(
|
|
93
|
-
({ children, position, classNames, ...props }, forwardRef) => {
|
|
94
|
-
const { tx } = useThemeContext();
|
|
95
|
-
const density = useDensityContext();
|
|
96
|
-
return (
|
|
97
|
-
<div {...props} className={tx('card.menu', 'card', { density, position }, classNames)} ref={forwardRef}>
|
|
98
|
-
<DropdownMenu.Root>
|
|
99
|
-
<DropdownMenu.Trigger asChild>
|
|
100
|
-
<DotsThreeVertical className={tx('card.menuIcon', 'card', {})} />
|
|
101
|
-
</DropdownMenu.Trigger>
|
|
102
|
-
{/* TODO(burdon): Position to the left of the menu button. */}
|
|
103
|
-
<DropdownMenu.Content>
|
|
104
|
-
<DropdownMenu.Viewport>{children}</DropdownMenu.Viewport>
|
|
105
|
-
</DropdownMenu.Content>
|
|
106
|
-
</DropdownMenu.Root>
|
|
107
|
-
</div>
|
|
108
|
-
);
|
|
109
|
-
},
|
|
110
|
-
);
|
|
111
|
-
|
|
112
|
-
type CardBodyProps = ThemedClassName<ComponentPropsWithoutRef<'div'>> & { gutter?: boolean };
|
|
113
|
-
|
|
114
|
-
export const CardBody: FC<CardBodyProps> = ({ gutter, classNames, children, ...props }) => {
|
|
115
|
-
const { tx } = useThemeContext();
|
|
116
|
-
const density = useDensityContext();
|
|
117
|
-
return (
|
|
118
|
-
<div {...props} className={tx('card.body', 'card', { density, gutter }, classNames)}>
|
|
119
|
-
{children}
|
|
120
|
-
</div>
|
|
121
|
-
);
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
type CardMediaProps = ThemedClassName<ComponentPropsWithoutRef<'div'>> & { src?: string; contain?: boolean };
|
|
125
|
-
|
|
126
|
-
// TODO(burdon): Option to set to 50% of height of card.
|
|
127
|
-
export const CardMedia: FC<CardMediaProps> = ({ src, contain, classNames, ...props }) => {
|
|
128
|
-
const { tx } = useThemeContext();
|
|
129
|
-
return (
|
|
130
|
-
<div className='flex grow overflow-hidden'>
|
|
131
|
-
<img {...props} className={tx('card.media', 'card', { contain }, classNames)} src={src} />
|
|
132
|
-
</div>
|
|
133
|
-
);
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
export const Card = {
|
|
137
|
-
Root: CardRoot,
|
|
138
|
-
Header: CardHeader,
|
|
139
|
-
DragHandle: CardDragHandle,
|
|
140
|
-
Endcap: CardEndcap,
|
|
141
|
-
Menu: CardMenu,
|
|
142
|
-
Title: CardTitle,
|
|
143
|
-
Body: CardBody,
|
|
144
|
-
Media: CardMedia,
|
|
145
|
-
};
|
|
146
|
-
|
|
147
|
-
export type { CardRootProps };
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import '@dxosTheme';
|
|
6
|
-
|
|
7
|
-
import React from 'react';
|
|
8
|
-
|
|
9
|
-
import { Center } from './Center';
|
|
10
|
-
|
|
11
|
-
export default {
|
|
12
|
-
component: Center,
|
|
13
|
-
actions: { argTypesRegex: '^on.*' },
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export const Normal = (props: any) => {
|
|
17
|
-
return <Center {...props}>✨</Center>;
|
|
18
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React, { type DetailedHTMLProps, type PropsWithChildren, type HTMLAttributes } from 'react';
|
|
6
|
-
|
|
7
|
-
export type CenterProps = PropsWithChildren<DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>>;
|
|
8
|
-
|
|
9
|
-
export const Center = (props: CenterProps) => {
|
|
10
|
-
const { children, className, ...rest } = props;
|
|
11
|
-
return (
|
|
12
|
-
<div className={'h-full flex items-center justify-center ' + className} {...rest}>
|
|
13
|
-
{children}
|
|
14
|
-
</div>
|
|
15
|
-
);
|
|
16
|
-
};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import '@dxosTheme';
|
|
6
|
-
|
|
7
|
-
import React from 'react';
|
|
8
|
-
|
|
9
|
-
import { ProgressBar } from './ProgressBar';
|
|
10
|
-
|
|
11
|
-
export default {
|
|
12
|
-
component: ProgressBar,
|
|
13
|
-
actions: { argTypesRegex: '^on.*' },
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export const Normal = (props: any) => {
|
|
17
|
-
return (
|
|
18
|
-
<div className='flex flex-col gap-5'>
|
|
19
|
-
<ProgressBar progress={0} {...props} />
|
|
20
|
-
<ProgressBar progress={0.3} {...props} />
|
|
21
|
-
<ProgressBar progress={0.7} {...props} />
|
|
22
|
-
<ProgressBar progress={1} {...props} />
|
|
23
|
-
</div>
|
|
24
|
-
);
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
export const Indeterminate = (props: any) => {
|
|
28
|
-
return (
|
|
29
|
-
<>
|
|
30
|
-
<ProgressBar className='m-4' indeterminate {...props} />
|
|
31
|
-
</>
|
|
32
|
-
);
|
|
33
|
-
};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React from 'react';
|
|
6
|
-
|
|
7
|
-
export type ProgressBarProps = {
|
|
8
|
-
indeterminate?: boolean;
|
|
9
|
-
progress?: number;
|
|
10
|
-
className?: string;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export const ProgressBar = (props: ProgressBarProps) => {
|
|
14
|
-
const { className, indeterminate = false, progress = 0 } = props;
|
|
15
|
-
return (
|
|
16
|
-
<span
|
|
17
|
-
role='none'
|
|
18
|
-
className={'w-20 h-1 inline-block relative bg-neutral-400/25 rounded-full' + (className ? ' ' + className : '')}
|
|
19
|
-
>
|
|
20
|
-
<span
|
|
21
|
-
className={
|
|
22
|
-
'absolute left-0 top-0 bottom-0 inline-block bg-neutral-400 rounded-full' +
|
|
23
|
-
(indeterminate ? ' animate-progress-indeterminate' : '')
|
|
24
|
-
}
|
|
25
|
-
{...(indeterminate ? {} : { style: { width: `${(progress * 100).toFixed(0)}%` } })}
|
|
26
|
-
/>
|
|
27
|
-
</span>
|
|
28
|
-
);
|
|
29
|
-
};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|