@dxos/react-ui 0.3.9-main.604ae36 → 0.3.9-main.622f05b

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.
Files changed (88) hide show
  1. package/dist/lib/browser/index.mjs +2 -1
  2. package/dist/lib/browser/index.mjs.map +3 -3
  3. package/dist/lib/browser/meta.json +1 -1
  4. package/dist/types/src/components/Avatars/Avatar.stories.d.ts +7 -0
  5. package/dist/types/src/components/Avatars/Avatar.stories.d.ts.map +1 -1
  6. package/dist/types/src/components/Avatars/AvatarGroup.stories.d.ts +7 -0
  7. package/dist/types/src/components/Avatars/AvatarGroup.stories.d.ts.map +1 -1
  8. package/dist/types/src/components/Breadcrumb/Breadcrumb.stories.d.ts +7 -0
  9. package/dist/types/src/components/Breadcrumb/Breadcrumb.stories.d.ts.map +1 -1
  10. package/dist/types/src/components/Buttons/Button.stories.d.ts +7 -0
  11. package/dist/types/src/components/Buttons/Button.stories.d.ts.map +1 -1
  12. package/dist/types/src/components/Buttons/Toggle.stories.d.ts +7 -0
  13. package/dist/types/src/components/Buttons/Toggle.stories.d.ts.map +1 -1
  14. package/dist/types/src/components/Buttons/ToggleGroup.stories.d.ts +7 -0
  15. package/dist/types/src/components/Buttons/ToggleGroup.stories.d.ts.map +1 -1
  16. package/dist/types/src/components/Dialogs/AlertDialog.stories.d.ts +7 -0
  17. package/dist/types/src/components/Dialogs/AlertDialog.stories.d.ts.map +1 -1
  18. package/dist/types/src/components/Dialogs/Dialog.stories.d.ts +7 -0
  19. package/dist/types/src/components/Dialogs/Dialog.stories.d.ts.map +1 -1
  20. package/dist/types/src/components/DropdownMenu/DropdownMenu.stories.d.ts +7 -0
  21. package/dist/types/src/components/DropdownMenu/DropdownMenu.stories.d.ts.map +1 -1
  22. package/dist/types/src/components/Input/Input.d.ts.map +1 -1
  23. package/dist/types/src/components/Input/Input.stories.d.ts +7 -0
  24. package/dist/types/src/components/Input/Input.stories.d.ts.map +1 -1
  25. package/dist/types/src/components/Link/Link.stories.d.ts.map +1 -1
  26. package/dist/types/src/components/Lists/List.stories.d.ts +7 -0
  27. package/dist/types/src/components/Lists/List.stories.d.ts.map +1 -1
  28. package/dist/types/src/components/Lists/Tree.stories.d.ts +7 -0
  29. package/dist/types/src/components/Lists/Tree.stories.d.ts.map +1 -1
  30. package/dist/types/src/components/Main/Main.stories.d.ts +7 -0
  31. package/dist/types/src/components/Main/Main.stories.d.ts.map +1 -1
  32. package/dist/types/src/components/Message/Message.stories.d.ts +7 -0
  33. package/dist/types/src/components/Message/Message.stories.d.ts.map +1 -1
  34. package/dist/types/src/components/Popover/Popover.stories.d.ts +7 -0
  35. package/dist/types/src/components/Popover/Popover.stories.d.ts.map +1 -1
  36. package/dist/types/src/components/ScrollArea/ScrollArea.stories.d.ts +7 -0
  37. package/dist/types/src/components/ScrollArea/ScrollArea.stories.d.ts.map +1 -1
  38. package/dist/types/src/components/Select/Select.stories.d.ts +7 -0
  39. package/dist/types/src/components/Select/Select.stories.d.ts.map +1 -1
  40. package/dist/types/src/components/Status/Status.stories.d.ts +7 -0
  41. package/dist/types/src/components/Status/Status.stories.d.ts.map +1 -1
  42. package/dist/types/src/components/Tag/Tag.stories.d.ts.map +1 -1
  43. package/dist/types/src/components/Toast/Toast.stories.d.ts +7 -0
  44. package/dist/types/src/components/Toast/Toast.stories.d.ts.map +1 -1
  45. package/dist/types/src/components/Toolbar/Toolbar.stories.d.ts +7 -0
  46. package/dist/types/src/components/Toolbar/Toolbar.stories.d.ts.map +1 -1
  47. package/dist/types/src/components/Tooltip/Tooltip.stories.d.ts +7 -0
  48. package/dist/types/src/components/Tooltip/Tooltip.stories.d.ts.map +1 -1
  49. package/dist/types/src/playground/Controls.stories.d.ts +7 -0
  50. package/dist/types/src/playground/Controls.stories.d.ts.map +1 -1
  51. package/dist/types/src/playground/Surfaces.stories.d.ts +7 -0
  52. package/dist/types/src/playground/Surfaces.stories.d.ts.map +1 -1
  53. package/dist/types/src/testing/decorators/index.d.ts +2 -0
  54. package/dist/types/src/testing/decorators/index.d.ts.map +1 -0
  55. package/dist/types/src/testing/decorators/with-theme.d.ts +3 -0
  56. package/dist/types/src/testing/decorators/with-theme.d.ts.map +1 -0
  57. package/dist/types/src/testing/index.d.ts +2 -0
  58. package/dist/types/src/testing/index.d.ts.map +1 -0
  59. package/package.json +8 -14
  60. package/src/components/Avatars/Avatar.stories.tsx +4 -0
  61. package/src/components/Avatars/AvatarGroup.stories.tsx +4 -0
  62. package/src/components/Breadcrumb/Breadcrumb.stories.tsx +4 -0
  63. package/src/components/Buttons/Button.stories.tsx +4 -0
  64. package/src/components/Buttons/Toggle.stories.tsx +4 -0
  65. package/src/components/Buttons/ToggleGroup.stories.tsx +4 -0
  66. package/src/components/Dialogs/AlertDialog.stories.tsx +4 -0
  67. package/src/components/Dialogs/Dialog.stories.tsx +4 -0
  68. package/src/components/DropdownMenu/DropdownMenu.stories.tsx +4 -0
  69. package/src/components/Input/Input.stories.tsx +4 -0
  70. package/src/components/Input/Input.tsx +3 -1
  71. package/src/components/Link/Link.stories.tsx +4 -0
  72. package/src/components/Lists/List.stories.tsx +4 -0
  73. package/src/components/Lists/Tree.stories.tsx +4 -0
  74. package/src/components/Main/Main.stories.tsx +7 -1
  75. package/src/components/Message/Message.stories.tsx +4 -0
  76. package/src/components/Popover/Popover.stories.tsx +4 -0
  77. package/src/components/ScrollArea/ScrollArea.stories.tsx +4 -0
  78. package/src/components/Select/Select.stories.tsx +4 -0
  79. package/src/components/Status/Status.stories.tsx +4 -0
  80. package/src/components/Tag/Tag.stories.tsx +4 -0
  81. package/src/components/Toast/Toast.stories.tsx +4 -0
  82. package/src/components/Toolbar/Toolbar.stories.tsx +4 -0
  83. package/src/components/Tooltip/Tooltip.stories.tsx +4 -0
  84. package/src/playground/Controls.stories.tsx +4 -0
  85. package/src/playground/Surfaces.stories.tsx +5 -0
  86. package/src/testing/decorators/index.ts +5 -0
  87. package/src/testing/decorators/with-theme.ts +22 -0
  88. package/src/testing/index.ts +5 -0
@@ -7,6 +7,7 @@ import '@dxosTheme';
7
7
  import React from 'react';
8
8
 
9
9
  import { Main, useSidebars } from './Main';
10
+ import { withTheme } from '../../testing';
10
11
  import { Button } from '../Buttons';
11
12
 
12
13
  type StoryMainArgs = {};
@@ -44,7 +45,12 @@ const StoryMain = (_args: StoryMainArgs) => {
44
45
  );
45
46
  };
46
47
 
47
- export default { component: StoryMain };
48
+ export default {
49
+ title: 'DXOS UI/Main',
50
+ component: StoryMain,
51
+ decorators: [withTheme],
52
+ parameters: { chromatic: { disableSnapshot: false } },
53
+ };
48
54
 
49
55
  export const Default = {
50
56
  args: {},
@@ -10,6 +10,7 @@ import React from 'react';
10
10
  import { type MessageValence } from '@dxos/react-ui-types';
11
11
 
12
12
  import { Message } from './Message';
13
+ import { withTheme } from '../../testing';
13
14
 
14
15
  type StoryMessageProps = {
15
16
  valence: MessageValence;
@@ -27,7 +28,10 @@ const StoryMessage = ({ valence, title, body }: StoryMessageProps) => (
27
28
  );
28
29
 
29
30
  export default {
31
+ title: 'DXOS UI/Message',
30
32
  component: StoryMessage,
33
+ decorators: [withTheme],
34
+ parameters: { chromatic: { disableSnapshot: false } },
31
35
  };
32
36
 
33
37
  export const Default = {
@@ -8,6 +8,7 @@ import { faker } from '@faker-js/faker';
8
8
  import React, { type PropsWithChildren, type ReactNode } from 'react';
9
9
 
10
10
  import { Popover } from './Popover';
11
+ import { withTheme } from '../../testing';
11
12
  import { Button } from '../Buttons';
12
13
 
13
14
  faker.seed(1234);
@@ -27,7 +28,10 @@ const StorybookPopover = ({ openTrigger, children }: PropsWithChildren<{ openTri
27
28
  };
28
29
 
29
30
  export default {
31
+ title: 'DXOS UI/Popover',
30
32
  component: StorybookPopover,
33
+ decorators: [withTheme],
34
+ parameters: { chromatic: { disableSnapshot: false } },
31
35
  };
32
36
 
33
37
  export const Default = {
@@ -10,6 +10,7 @@ import React, { type PropsWithChildren } from 'react';
10
10
  import { groupSurface, surfaceElevation } from '@dxos/react-ui-theme';
11
11
 
12
12
  import { ScrollArea } from './ScrollArea';
13
+ import { withTheme } from '../../testing';
13
14
 
14
15
  faker.seed(1234);
15
16
 
@@ -33,7 +34,10 @@ const StorybookScrollArea = ({ children }: PropsWithChildren<{}>) => {
33
34
  };
34
35
 
35
36
  export default {
37
+ title: 'DXOS UI/Scroll area',
36
38
  component: StorybookScrollArea,
39
+ decorators: [withTheme],
40
+ parameters: { chromatic: { disableSnapshot: false } },
37
41
  };
38
42
 
39
43
  export const Default = {
@@ -10,6 +10,7 @@ import React, { type FC, type PropsWithChildren, useState } from 'react';
10
10
  import { type Density } from '@dxos/react-ui-types';
11
11
 
12
12
  import { Select } from './Select';
13
+ import { withTheme } from '../../testing';
13
14
  import { DensityProvider } from '../DensityProvider';
14
15
 
15
16
  faker.seed(1234);
@@ -58,7 +59,10 @@ const StorybookSelect = ({ items = [] }: PropsWithChildren<{ items: ItemProps[]
58
59
  };
59
60
 
60
61
  export default {
62
+ title: 'DXOS UI/Select',
61
63
  component: createDensityTest(StorybookSelect),
64
+ decorators: [withTheme],
65
+ parameters: { chromatic: { disableSnapshot: false } },
62
66
  };
63
67
 
64
68
  export const Default = {
@@ -7,10 +7,14 @@ import '@dxosTheme';
7
7
  import React from 'react';
8
8
 
9
9
  import { Status } from './Status';
10
+ import { withTheme } from '../../testing';
10
11
 
11
12
  export default {
13
+ title: 'DXOS UI/Status',
12
14
  component: Status,
13
15
  actions: { argTypesRegex: '^on.*' },
16
+ decorators: [withTheme],
17
+ parameters: { chromatic: { disableSnapshot: false } },
14
18
  };
15
19
 
16
20
  export const Normal = (props: any) => {
@@ -5,9 +5,13 @@
5
5
  import '@dxosTheme';
6
6
 
7
7
  import { Tag } from './Tag';
8
+ import { withTheme } from '../../testing';
8
9
 
9
10
  export default {
11
+ title: 'DXOS UI/Tag',
10
12
  component: Tag,
13
+ decorators: [withTheme],
14
+ parameters: { chromatic: { disableSnapshot: false } },
11
15
  argTypes: {
12
16
  palette: {
13
17
  control: 'select',
@@ -7,6 +7,7 @@ import '@dxosTheme';
7
7
  import React, { type ReactNode, useState } from 'react';
8
8
 
9
9
  import { Toast } from './Toast';
10
+ import { withTheme } from '../../testing';
10
11
  import { Button } from '../Buttons';
11
12
 
12
13
  type ActionTriggerProps = { altText: string; trigger: ReactNode };
@@ -44,7 +45,10 @@ const StorybookToast = (props: StorybookToastProps) => {
44
45
  };
45
46
 
46
47
  export default {
48
+ title: 'DXOS UI/Toast',
47
49
  component: StorybookToast,
50
+ decorators: [withTheme],
51
+ parameters: { chromatic: { disableSnapshot: false } },
48
52
  };
49
53
 
50
54
  export const Default = {
@@ -8,6 +8,7 @@ import { ArrowClockwise, Bug, FileJs, FileTs, TextB, TextItalic, TextUnderline }
8
8
  import React from 'react';
9
9
 
10
10
  import { Toolbar } from './Toolbar';
11
+ import { withTheme } from '../../testing';
11
12
  import { Toggle } from '../Buttons';
12
13
  import { Select } from '../Select';
13
14
 
@@ -69,7 +70,10 @@ const StorybookToolbar = (props: StorybookToolbarProps) => {
69
70
  };
70
71
 
71
72
  export default {
73
+ title: 'DXOS UI/Toolbar',
72
74
  component: StorybookToolbar,
75
+ decorators: [withTheme],
76
+ parameters: { chromatic: { disableSnapshot: false } },
73
77
  };
74
78
 
75
79
  export const Default = {
@@ -7,6 +7,7 @@ import '@dxosTheme';
7
7
  import React from 'react';
8
8
 
9
9
  import { Tooltip } from './Tooltip';
10
+ import { withTheme } from '../../testing';
10
11
  import { Button } from '../Buttons';
11
12
 
12
13
  type StoryTooltipProps = {
@@ -28,7 +29,10 @@ const StoryTooltip = ({ content }: StoryTooltipProps) => (
28
29
  );
29
30
 
30
31
  export default {
32
+ title: 'DXOS UI/Tooltip',
31
33
  component: StoryTooltip,
34
+ decorators: [withTheme],
35
+ parameters: { chromatic: { disableSnapshot: false } },
32
36
  };
33
37
 
34
38
  export const Default = {
@@ -9,6 +9,7 @@ import React, { useState } from 'react';
9
9
 
10
10
  import { createScenarios } from './helpers';
11
11
  import { Input, Select, Toggle, Toolbar } from '../components';
12
+ import { withTheme } from '../testing';
12
13
 
13
14
  const Story = () => {
14
15
  const [checked, setChecked] = useState<boolean>(false);
@@ -82,7 +83,10 @@ const Story = () => {
82
83
  };
83
84
 
84
85
  export default {
86
+ title: 'DXOS UI/Scenarios/Controls',
85
87
  component: Story,
88
+ decorators: [withTheme],
89
+ parameters: { chromatic: { disableSnapshot: false } },
86
90
  };
87
91
 
88
92
  export const Default = {
@@ -17,6 +17,8 @@ import {
17
17
  inputSurface,
18
18
  } from '@dxos/react-ui-theme';
19
19
 
20
+ import { withTheme } from '../testing';
21
+
20
22
  const Surface = ({
21
23
  children,
22
24
  level,
@@ -56,7 +58,10 @@ const SurfacesStory = () => {
56
58
  };
57
59
 
58
60
  export default {
61
+ title: 'DXOS UI/Scenarios/Surfaces',
59
62
  component: SurfacesStory,
63
+ decorators: [withTheme],
64
+ parameters: { chromatic: { disableSnapshot: false } },
60
65
  };
61
66
 
62
67
  export const Default = {
@@ -0,0 +1,5 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ export * from './with-theme';
@@ -0,0 +1,22 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ import { type Decorator } from '@storybook/react';
6
+ import { useEffect, createElement } from 'react';
7
+
8
+ import { defaultTx } from '@dxos/react-ui-theme';
9
+
10
+ import { ThemeProvider } from '../../components';
11
+
12
+ export const withTheme: Decorator = (StoryFn, context) => {
13
+ const theme = context?.parameters?.theme || context?.globals?.theme;
14
+ useEffect(() => {
15
+ document.documentElement.classList[theme === 'dark' ? 'add' : 'remove']('dark');
16
+ }, [theme]);
17
+
18
+ return createElement(ThemeProvider, {
19
+ children: createElement(StoryFn),
20
+ tx: defaultTx,
21
+ });
22
+ };
@@ -0,0 +1,5 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ export * from './decorators';