@dxos/react-ui 0.6.13 → 0.6.14-main.7bd9c89
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 +34 -29
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node/index.cjs +2395 -0
- package/dist/lib/node/index.cjs.map +7 -0
- package/dist/lib/node/meta.json +1 -0
- package/dist/lib/node-esm/index.mjs +2396 -0
- package/dist/lib/node-esm/index.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -0
- package/dist/types/src/components/Buttons/Button.stories.d.ts +12 -17
- package/dist/types/src/components/Buttons/Button.stories.d.ts.map +1 -1
- package/dist/types/src/components/DensityProvider/DensityProvider.d.ts.map +1 -1
- package/dist/types/src/components/Input/Input.d.ts.map +1 -1
- package/dist/types/src/components/Lists/Treegrid.stories.d.ts +3 -2
- package/dist/types/src/components/Lists/Treegrid.stories.d.ts.map +1 -1
- package/dist/types/src/components/Select/Select.d.ts.map +1 -1
- package/dist/types/src/components/Select/Select.stories.d.ts +10 -11
- package/dist/types/src/components/Select/Select.stories.d.ts.map +1 -1
- package/dist/types/src/components/Status/Status.stories.d.ts +0 -3
- package/dist/types/src/components/Status/Status.stories.d.ts.map +1 -1
- package/dist/types/src/components/ThemeProvider/ThemeProvider.d.ts +4 -5
- package/dist/types/src/components/ThemeProvider/ThemeProvider.d.ts.map +1 -1
- package/dist/types/src/components/ThemeProvider/TranslationsProvider.d.ts +4 -4
- package/dist/types/src/components/Toast/Toast.d.ts.map +1 -1
- package/dist/types/src/components/Toolbar/Toolbar.d.ts +4 -2
- package/dist/types/src/components/Toolbar/Toolbar.d.ts.map +1 -1
- package/dist/types/src/hooks/useThemeContext.d.ts.map +1 -1
- package/dist/types/src/playground/Controls.stories.d.ts +2 -6
- package/dist/types/src/playground/Controls.stories.d.ts.map +1 -1
- package/dist/types/src/testing/decorators/index.d.ts +1 -0
- package/dist/types/src/testing/decorators/index.d.ts.map +1 -1
- package/dist/types/src/testing/decorators/withVariants.d.ts +13 -0
- package/dist/types/src/testing/decorators/withVariants.d.ts.map +1 -0
- package/package.json +19 -14
- package/src/components/Avatars/Avatar.stories.tsx +1 -1
- package/src/components/Avatars/AvatarGroup.stories.tsx +1 -1
- package/src/components/Breadcrumb/Breadcrumb.stories.tsx +1 -1
- package/src/components/Buttons/Button.stories.tsx +34 -63
- package/src/components/Buttons/Toggle.stories.tsx +1 -1
- package/src/components/Buttons/ToggleGroup.stories.tsx +1 -1
- package/src/components/DensityProvider/DensityProvider.tsx +1 -1
- package/src/components/Dialogs/AlertDialog.stories.tsx +1 -1
- package/src/components/Dialogs/Dialog.stories.tsx +1 -1
- package/src/components/Input/Input.stories.tsx +1 -1
- package/src/components/Link/Link.stories.tsx +1 -1
- package/src/components/Lists/List.stories.tsx +1 -1
- package/src/components/Lists/Tree.stories.tsx +1 -1
- package/src/components/Lists/Treegrid.stories.tsx +7 -5
- package/src/components/Main/Main.stories.tsx +1 -1
- package/src/components/Menus/ContextMenu.stories.tsx +1 -1
- package/src/components/Menus/DropdownMenu.stories.tsx +1 -1
- package/src/components/Message/Message.stories.tsx +1 -1
- package/src/components/Popover/Popover.stories.tsx +1 -1
- package/src/components/ScrollArea/ScrollArea.stories.tsx +1 -1
- package/src/components/Select/Select.stories.tsx +14 -31
- package/src/components/Select/Select.tsx +9 -10
- package/src/components/Status/Status.stories.tsx +1 -2
- package/src/components/Tag/Tag.stories.tsx +1 -1
- package/src/components/ThemeProvider/ThemeProvider.tsx +17 -18
- package/src/components/Toast/Toast.stories.tsx +1 -1
- package/src/components/Toast/Toast.tsx +1 -4
- package/src/components/Toolbar/Toolbar.stories.tsx +1 -1
- package/src/components/Toolbar/Toolbar.tsx +21 -1
- package/src/components/Tooltip/Tooltip.stories.tsx +1 -1
- package/src/hooks/useThemeContext.ts +3 -1
- package/src/playground/Controls.stories.tsx +7 -10
- package/src/playground/Surfaces.stories.tsx +1 -1
- package/src/playground/Typography.stories.tsx +1 -1
- package/src/testing/decorators/index.ts +1 -0
- package/src/testing/decorators/withVariants.tsx +45 -0
- package/dist/types/src/playground/helpers.d.ts +0 -6
- package/dist/types/src/playground/helpers.d.ts.map +0 -1
- package/src/playground/helpers.tsx +0 -32
|
@@ -7,11 +7,10 @@ import '@dxos-theme';
|
|
|
7
7
|
import { FileTs, FileJs, ArrowClockwise, Bug, TextUnderline, TextB, TextItalic } from '@phosphor-icons/react';
|
|
8
8
|
import React, { useState } from 'react';
|
|
9
9
|
|
|
10
|
-
import { createScenarios } from './helpers';
|
|
11
10
|
import { Input, Select, Toggle, Toolbar } from '../components';
|
|
12
|
-
import { withTheme } from '../testing';
|
|
11
|
+
import { withTheme, withVariants } from '../testing';
|
|
13
12
|
|
|
14
|
-
const
|
|
13
|
+
const DefaultStory = () => {
|
|
15
14
|
const [checked, setChecked] = useState<boolean>(false);
|
|
16
15
|
const [select, setSelect] = useState<string>();
|
|
17
16
|
|
|
@@ -82,13 +81,11 @@ const Story = () => {
|
|
|
82
81
|
);
|
|
83
82
|
};
|
|
84
83
|
|
|
84
|
+
export const Default = {};
|
|
85
|
+
|
|
85
86
|
export default {
|
|
86
|
-
title: 'react-ui/
|
|
87
|
-
|
|
88
|
-
decorators: [withTheme],
|
|
87
|
+
title: 'ui/react-ui/Playground/Controls',
|
|
88
|
+
render: DefaultStory,
|
|
89
|
+
decorators: [withVariants(), withTheme],
|
|
89
90
|
parameters: { chromatic: { disableSnapshot: false } },
|
|
90
91
|
};
|
|
91
|
-
|
|
92
|
-
export const Default = {
|
|
93
|
-
render: createScenarios(Story),
|
|
94
|
-
};
|
|
@@ -44,7 +44,7 @@ const TypographyStory = () => {
|
|
|
44
44
|
};
|
|
45
45
|
|
|
46
46
|
export default {
|
|
47
|
-
title: 'react-ui/
|
|
47
|
+
title: 'ui/react-ui/Playground/Typography',
|
|
48
48
|
component: TypographyStory,
|
|
49
49
|
decorators: [withTheme],
|
|
50
50
|
parameters: { chromatic: { disableSnapshot: false } },
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import '@dxos-theme';
|
|
6
|
+
|
|
7
|
+
import { type Decorator } from '@storybook/react';
|
|
8
|
+
import React from 'react';
|
|
9
|
+
|
|
10
|
+
import { modalSurface, groupSurface, mx, surfaceElevation } from '@dxos/react-ui-theme';
|
|
11
|
+
import { type Density, type Elevation } from '@dxos/react-ui-types';
|
|
12
|
+
|
|
13
|
+
import { DensityProvider, ElevationProvider } from '../../components';
|
|
14
|
+
|
|
15
|
+
type Config = {
|
|
16
|
+
elevations?: { elevation: Elevation; surface?: string }[];
|
|
17
|
+
densities?: Density[];
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const withVariants = ({
|
|
21
|
+
elevations = [
|
|
22
|
+
{ elevation: 'base' },
|
|
23
|
+
{ elevation: 'group', surface: groupSurface },
|
|
24
|
+
{ elevation: 'chrome', surface: modalSurface },
|
|
25
|
+
],
|
|
26
|
+
densities = ['coarse', 'fine'],
|
|
27
|
+
}: Config = {}): Decorator => {
|
|
28
|
+
return (Story) => (
|
|
29
|
+
<div className='flex flex-col gap-8'>
|
|
30
|
+
{elevations.map(({ elevation, surface }) => (
|
|
31
|
+
<ElevationProvider key={elevation} elevation={elevation}>
|
|
32
|
+
<div className='flex flex-col gap-8'>
|
|
33
|
+
{densities.map((density) => (
|
|
34
|
+
<DensityProvider key={density} density={density}>
|
|
35
|
+
<div className={mx('p-4 rounded-lg', surface, surfaceElevation({ elevation }))}>
|
|
36
|
+
<Story />
|
|
37
|
+
</div>
|
|
38
|
+
</DensityProvider>
|
|
39
|
+
))}
|
|
40
|
+
</div>
|
|
41
|
+
</ElevationProvider>
|
|
42
|
+
))}
|
|
43
|
+
</div>
|
|
44
|
+
);
|
|
45
|
+
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../src/playground/helpers.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;AAErB,OAAO,KAAK,EAAE,EAAE,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAOtD,eAAO,MAAM,eAAe,cACd,iBAAiB,CAAC,GAAG,CAAC;;uBAiBjC,CAAC"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import '@dxos-theme';
|
|
6
|
-
|
|
7
|
-
import React, { type FunctionComponent } from 'react';
|
|
8
|
-
|
|
9
|
-
import { type Density } from '@dxos/react-ui-types';
|
|
10
|
-
|
|
11
|
-
import { DensityProvider, ElevationProvider } from '../components';
|
|
12
|
-
|
|
13
|
-
// TODO(burdon): Grid: density, variant (context?), elevation.
|
|
14
|
-
export const createScenarios =
|
|
15
|
-
(Component: FunctionComponent<any>) =>
|
|
16
|
-
({ ...props }) => {
|
|
17
|
-
const densities: Density[] = ['coarse', 'fine'];
|
|
18
|
-
return (
|
|
19
|
-
<div className='flex flex-col space-y-8'>
|
|
20
|
-
{densities.map((density) => (
|
|
21
|
-
<div key={density}>
|
|
22
|
-
<ElevationProvider elevation='chrome'>
|
|
23
|
-
<DensityProvider density={density}>
|
|
24
|
-
<label className='p-2 text-xs'>{density}</label>
|
|
25
|
-
<Component {...props} />
|
|
26
|
-
</DensityProvider>
|
|
27
|
-
</ElevationProvider>
|
|
28
|
-
</div>
|
|
29
|
-
))}
|
|
30
|
-
</div>
|
|
31
|
-
);
|
|
32
|
-
};
|