@dxos/react-ui 0.3.9-main.b7e6a67 → 0.3.9-main.c414ce0

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 (141) hide show
  1. package/dist/lib/browser/index.mjs +270 -385
  2. package/dist/lib/browser/index.mjs.map +4 -4
  3. package/dist/lib/browser/meta.json +1 -1
  4. package/dist/types/src/components/AnchoredOverflow/AnchoredOverflow.d.ts.map +1 -1
  5. package/dist/types/src/components/Avatars/Avatar.stories.d.ts +1 -0
  6. package/dist/types/src/components/Avatars/Avatar.stories.d.ts.map +1 -1
  7. package/dist/types/src/components/Avatars/AvatarGroup.stories.d.ts +1 -0
  8. package/dist/types/src/components/Avatars/AvatarGroup.stories.d.ts.map +1 -1
  9. package/dist/types/src/components/Breadcrumb/Breadcrumb.d.ts.map +1 -1
  10. package/dist/types/src/components/Breadcrumb/Breadcrumb.stories.d.ts +1 -0
  11. package/dist/types/src/components/Breadcrumb/Breadcrumb.stories.d.ts.map +1 -1
  12. package/dist/types/src/components/Buttons/Button.stories.d.ts +1 -0
  13. package/dist/types/src/components/Buttons/Button.stories.d.ts.map +1 -1
  14. package/dist/types/src/components/Buttons/Toggle.stories.d.ts +1 -0
  15. package/dist/types/src/components/Buttons/Toggle.stories.d.ts.map +1 -1
  16. package/dist/types/src/components/Buttons/ToggleGroup.stories.d.ts +1 -0
  17. package/dist/types/src/components/Buttons/ToggleGroup.stories.d.ts.map +1 -1
  18. package/dist/types/src/components/Dialogs/AlertDialog.stories.d.ts +1 -0
  19. package/dist/types/src/components/Dialogs/AlertDialog.stories.d.ts.map +1 -1
  20. package/dist/types/src/components/Dialogs/Dialog.stories.d.ts +1 -0
  21. package/dist/types/src/components/Dialogs/Dialog.stories.d.ts.map +1 -1
  22. package/dist/types/src/components/DropdownMenu/DropdownMenu.stories.d.ts +1 -0
  23. package/dist/types/src/components/DropdownMenu/DropdownMenu.stories.d.ts.map +1 -1
  24. package/dist/types/src/components/Input/Input.d.ts +2 -2
  25. package/dist/types/src/components/Input/Input.d.ts.map +1 -1
  26. package/dist/types/src/components/Input/Input.stories.d.ts +2 -1
  27. package/dist/types/src/components/Input/Input.stories.d.ts.map +1 -1
  28. package/dist/types/src/components/Link/Link.stories.d.ts.map +1 -1
  29. package/dist/types/src/components/Lists/List.d.ts.map +1 -0
  30. package/dist/types/src/components/{List → Lists}/List.stories.d.ts +1 -0
  31. package/dist/types/src/components/Lists/List.stories.d.ts.map +1 -0
  32. package/dist/types/src/components/Lists/Tree.d.ts.map +1 -0
  33. package/dist/types/src/components/{List → Lists}/Tree.stories.d.ts +1 -0
  34. package/dist/types/src/components/Lists/Tree.stories.d.ts.map +1 -0
  35. package/dist/types/src/components/Lists/index.d.ts.map +1 -0
  36. package/dist/types/src/components/Main/Main.d.ts +2 -2
  37. package/dist/types/src/components/Main/Main.stories.d.ts +1 -0
  38. package/dist/types/src/components/Main/Main.stories.d.ts.map +1 -1
  39. package/dist/types/src/components/Message/Message.stories.d.ts +1 -0
  40. package/dist/types/src/components/Message/Message.stories.d.ts.map +1 -1
  41. package/dist/types/src/components/Popover/Popover.stories.d.ts +6 -0
  42. package/dist/types/src/components/Popover/Popover.stories.d.ts.map +1 -1
  43. package/dist/types/src/components/ScrollArea/ScrollArea.stories.d.ts +6 -0
  44. package/dist/types/src/components/ScrollArea/ScrollArea.stories.d.ts.map +1 -1
  45. package/dist/types/src/components/Select/Select.stories.d.ts +6 -0
  46. package/dist/types/src/components/Select/Select.stories.d.ts.map +1 -1
  47. package/dist/types/src/components/Status/Status.d.ts +10 -0
  48. package/dist/types/src/components/Status/Status.d.ts.map +1 -0
  49. package/dist/types/src/components/Status/Status.stories.d.ts +18 -0
  50. package/dist/types/src/components/Status/Status.stories.d.ts.map +1 -0
  51. package/dist/types/src/components/Status/index.d.ts +2 -0
  52. package/dist/types/src/components/Status/index.d.ts.map +1 -0
  53. package/dist/types/src/components/Tag/Tag.stories.d.ts.map +1 -1
  54. package/dist/types/src/components/Toast/Toast.stories.d.ts +6 -0
  55. package/dist/types/src/components/Toast/Toast.stories.d.ts.map +1 -1
  56. package/dist/types/src/components/Toolbar/Toolbar.stories.d.ts +6 -0
  57. package/dist/types/src/components/Toolbar/Toolbar.stories.d.ts.map +1 -1
  58. package/dist/types/src/components/Tooltip/Tooltip.stories.d.ts +6 -0
  59. package/dist/types/src/components/Tooltip/Tooltip.stories.d.ts.map +1 -1
  60. package/dist/types/src/components/index.d.ts +2 -4
  61. package/dist/types/src/components/index.d.ts.map +1 -1
  62. package/dist/types/src/playground/Controls.stories.d.ts +6 -0
  63. package/dist/types/src/playground/Controls.stories.d.ts.map +1 -1
  64. package/dist/types/src/playground/Surfaces.stories.d.ts +6 -0
  65. package/dist/types/src/playground/Surfaces.stories.d.ts.map +1 -1
  66. package/dist/types/src/testing/decorators/index.d.ts +2 -0
  67. package/dist/types/src/testing/decorators/index.d.ts.map +1 -0
  68. package/dist/types/src/testing/decorators/with-theme.d.ts +3 -0
  69. package/dist/types/src/testing/decorators/with-theme.d.ts.map +1 -0
  70. package/dist/types/src/testing/index.d.ts +2 -0
  71. package/dist/types/src/testing/index.d.ts.map +1 -0
  72. package/package.json +8 -14
  73. package/src/components/AnchoredOverflow/AnchoredOverflow.tsx +12 -2
  74. package/src/components/Avatars/Avatar.stories.tsx +2 -0
  75. package/src/components/Avatars/AvatarGroup.stories.tsx +2 -0
  76. package/src/components/Breadcrumb/Breadcrumb.stories.tsx +2 -0
  77. package/src/components/Breadcrumb/Breadcrumb.tsx +9 -1
  78. package/src/components/Buttons/Button.stories.tsx +2 -0
  79. package/src/components/Buttons/Toggle.stories.tsx +2 -0
  80. package/src/components/Buttons/ToggleGroup.stories.tsx +2 -0
  81. package/src/components/Dialogs/AlertDialog.stories.tsx +2 -0
  82. package/src/components/Dialogs/Dialog.stories.tsx +2 -0
  83. package/src/components/DropdownMenu/DropdownMenu.stories.tsx +2 -0
  84. package/src/components/Input/Input.stories.tsx +21 -2
  85. package/src/components/Input/Input.tsx +3 -1
  86. package/src/components/Link/Link.stories.tsx +2 -0
  87. package/src/components/{List → Lists}/List.stories.tsx +2 -0
  88. package/src/components/{List → Lists}/Tree.stories.tsx +2 -0
  89. package/src/components/Main/Main.stories.tsx +5 -1
  90. package/src/components/Message/Message.stories.tsx +2 -0
  91. package/src/components/Popover/Popover.stories.tsx +3 -0
  92. package/src/components/ScrollArea/ScrollArea.stories.tsx +3 -0
  93. package/src/components/Select/Select.stories.tsx +3 -0
  94. package/src/components/Status/Status.stories.tsx +36 -0
  95. package/src/components/Status/Status.tsx +38 -0
  96. package/src/components/{Card → Status}/index.ts +1 -1
  97. package/src/components/Tag/Tag.stories.tsx +3 -0
  98. package/src/components/Toast/Toast.stories.tsx +3 -0
  99. package/src/components/Toolbar/Toolbar.stories.tsx +3 -0
  100. package/src/components/Tooltip/Tooltip.stories.tsx +3 -0
  101. package/src/components/index.ts +2 -4
  102. package/src/playground/Controls.stories.tsx +3 -0
  103. package/src/playground/Surfaces.stories.tsx +4 -0
  104. package/src/{components/Center → testing/decorators}/index.ts +1 -1
  105. package/src/testing/decorators/with-theme.ts +22 -0
  106. package/src/{components/ProgressBar → testing}/index.ts +1 -1
  107. package/dist/types/src/components/Card/Card.d.ts +0 -52
  108. package/dist/types/src/components/Card/Card.d.ts.map +0 -1
  109. package/dist/types/src/components/Card/Card.stories.d.ts +0 -56
  110. package/dist/types/src/components/Card/Card.stories.d.ts.map +0 -1
  111. package/dist/types/src/components/Card/index.d.ts +0 -2
  112. package/dist/types/src/components/Card/index.d.ts.map +0 -1
  113. package/dist/types/src/components/Center/Center.d.ts +0 -4
  114. package/dist/types/src/components/Center/Center.d.ts.map +0 -1
  115. package/dist/types/src/components/Center/Center.stories.d.ts +0 -11
  116. package/dist/types/src/components/Center/Center.stories.d.ts.map +0 -1
  117. package/dist/types/src/components/Center/index.d.ts +0 -2
  118. package/dist/types/src/components/Center/index.d.ts.map +0 -1
  119. package/dist/types/src/components/List/List.d.ts.map +0 -1
  120. package/dist/types/src/components/List/List.stories.d.ts.map +0 -1
  121. package/dist/types/src/components/List/Tree.d.ts.map +0 -1
  122. package/dist/types/src/components/List/Tree.stories.d.ts.map +0 -1
  123. package/dist/types/src/components/List/index.d.ts.map +0 -1
  124. package/dist/types/src/components/ProgressBar/ProgressBar.d.ts +0 -7
  125. package/dist/types/src/components/ProgressBar/ProgressBar.d.ts.map +0 -1
  126. package/dist/types/src/components/ProgressBar/ProgressBar.stories.d.ts +0 -12
  127. package/dist/types/src/components/ProgressBar/ProgressBar.stories.d.ts.map +0 -1
  128. package/dist/types/src/components/ProgressBar/index.d.ts +0 -2
  129. package/dist/types/src/components/ProgressBar/index.d.ts.map +0 -1
  130. package/src/components/Card/Card.stories.tsx +0 -220
  131. package/src/components/Card/Card.tsx +0 -147
  132. package/src/components/Center/Center.stories.tsx +0 -18
  133. package/src/components/Center/Center.tsx +0 -16
  134. package/src/components/ProgressBar/ProgressBar.stories.tsx +0 -33
  135. package/src/components/ProgressBar/ProgressBar.tsx +0 -29
  136. /package/dist/types/src/components/{List → Lists}/List.d.ts +0 -0
  137. /package/dist/types/src/components/{List → Lists}/Tree.d.ts +0 -0
  138. /package/dist/types/src/components/{List → Lists}/index.d.ts +0 -0
  139. /package/src/components/{List → Lists}/List.tsx +0 -0
  140. /package/src/components/{List → Lists}/Tree.tsx +0 -0
  141. /package/src/components/{List → Lists}/index.ts +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"Surfaces.stories.d.ts","sourceRoot":"","sources":["../../../../src/playground/Surfaces.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,YAAY,CAAC;;;;AAqDpB,wBAEE;AAEF,eAAO,MAAM,OAAO;;CAEnB,CAAC"}
1
+ {"version":3,"file":"Surfaces.stories.d.ts","sourceRoot":"","sources":["../../../../src/playground/Surfaces.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,YAAY,CAAC;;;;;;;;;;AAuDpB,wBAIE;AAEF,eAAO,MAAM,OAAO;;CAEnB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './with-theme';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/testing/decorators/index.ts"],"names":[],"mappings":"AAIA,cAAc,cAAc,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { type Decorator } from '@storybook/react';
2
+ export declare const withTheme: Decorator;
3
+ //# sourceMappingURL=with-theme.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"with-theme.d.ts","sourceRoot":"","sources":["../../../../../src/testing/decorators/with-theme.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAOlD,eAAO,MAAM,SAAS,EAAE,SAUvB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './decorators';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/testing/index.ts"],"names":[],"mappings":"AAIA,cAAc,cAAc,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dxos/react-ui",
3
- "version": "0.3.9-main.b7e6a67",
4
- "description": "Opinionated, styled, low-level React components for DXOS.",
3
+ "version": "0.3.9-main.c414ce0",
4
+ "description": "Low-level React components for DXOS, applying a theme to a core group of primitives",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
7
7
  "license": "MIT",
@@ -10,9 +10,7 @@
10
10
  "types": "dist/types/src/index.d.ts",
11
11
  "files": [
12
12
  "dist",
13
- "src",
14
- "plugin.js",
15
- "plugin.d.ts"
13
+ "src"
16
14
  ],
17
15
  "dependencies": {
18
16
  "@radix-ui/react-alert-dialog": "^1.0.3",
@@ -39,10 +37,10 @@
39
37
  "jdenticon": "^3.2.0",
40
38
  "keyborg": "^2.0.0",
41
39
  "react-i18next": "^11.18.6",
42
- "@dxos/react-hooks": "0.3.9-main.b7e6a67",
43
- "@dxos/react-input": "0.3.9-main.b7e6a67",
44
- "@dxos/react-list": "0.3.9-main.b7e6a67",
45
- "@dxos/react-ui-types": "0.3.9-main.b7e6a67"
40
+ "@dxos/react-hooks": "0.3.9-main.c414ce0",
41
+ "@dxos/react-input": "0.3.9-main.c414ce0",
42
+ "@dxos/react-ui-types": "0.3.9-main.c414ce0",
43
+ "@dxos/react-list": "0.3.9-main.c414ce0"
46
44
  },
47
45
  "devDependencies": {
48
46
  "@dnd-kit/core": "^6.0.5",
@@ -52,12 +50,11 @@
52
50
  "@phosphor-icons/react": "^2.0.5",
53
51
  "@types/react": "^18.0.21",
54
52
  "@types/react-dom": "^18.0.6",
55
- "chromatic": "^7.5.0",
56
53
  "react": "^18.2.0",
57
54
  "react-dom": "^18.2.0",
58
55
  "vite": "^4.3.9",
59
56
  "vite-plugin-turbosnap": "^1.0.2",
60
- "@dxos/react-ui-theme": "0.3.9-main.b7e6a67"
57
+ "@dxos/react-ui-theme": "0.3.9-main.c414ce0"
61
58
  },
62
59
  "peerDependencies": {
63
60
  "@phosphor-icons/react": "^2.0.5",
@@ -66,8 +63,5 @@
66
63
  },
67
64
  "publishConfig": {
68
65
  "access": "public"
69
- },
70
- "scripts": {
71
- "chromatic": "chromatic --only-changed --project-token=\"44ade288043a\" --storybook-build-dir out/react-ui --exit-zero-on-changes"
72
66
  }
73
67
  }
@@ -18,7 +18,12 @@ const AnchoredOverflowRoot = forwardRef<HTMLDivElement, AnchoredOverflowRootProp
18
18
  const { tx } = useThemeContext();
19
19
  const Root = asChild ? Slot : Primitive.div;
20
20
  return (
21
- <Root {...props} className={tx('anchoredOverflow.root', 'overflow-anchored', {}, classNames)} ref={forwardedRef}>
21
+ <Root
22
+ role='none'
23
+ {...props}
24
+ className={tx('anchoredOverflow.root', 'overflow-anchored', {}, classNames)}
25
+ ref={forwardedRef}
26
+ >
22
27
  {children}
23
28
  </Root>
24
29
  );
@@ -34,7 +39,12 @@ const AnchoredOverflowAnchor = forwardRef<HTMLDivElement, AnchoredOverflowAnchor
34
39
  const { tx } = useThemeContext();
35
40
  const Root = asChild ? Slot : Primitive.div;
36
41
  return (
37
- <Root {...props} className={tx('anchoredOverflow.anchor', 'overflow-anchor', {}, classNames)} ref={forwardedRef}>
42
+ <Root
43
+ role='none'
44
+ {...props}
45
+ className={tx('anchoredOverflow.anchor', 'overflow-anchor', {}, classNames)}
46
+ ref={forwardedRef}
47
+ >
38
48
  {children}
39
49
  </Root>
40
50
  );
@@ -10,6 +10,7 @@ import { getColorForValue } from '@dxos/react-ui-theme';
10
10
  import { type Size } from '@dxos/react-ui-types';
11
11
 
12
12
  import { Avatar, useJdenticonHref, type AvatarVariant, type AvatarStatus, type AvatarAnimation } from './Avatar';
13
+ import { withTheme } from '../../testing';
13
14
 
14
15
  const randomColor = () => getColorForValue({ value: Math.random().toString(16), type: 'color' });
15
16
 
@@ -62,6 +63,7 @@ const StorybookAvatar = (props: PropsWithChildren<StorybookAvatarProps>) => {
62
63
 
63
64
  export default {
64
65
  component: StorybookAvatar,
66
+ decorators: [withTheme],
65
67
  };
66
68
 
67
69
  const sampleImage =
@@ -8,6 +8,7 @@ import React from 'react';
8
8
 
9
9
  import { Avatar, useJdenticonHref } from './Avatar';
10
10
  import { AvatarGroup, AvatarGroupItem } from './AvatarGroup';
11
+ import { withTheme } from '../../testing';
11
12
 
12
13
  const items = [
13
14
  '[&_.avatarFrameFill]:fill-lime-500',
@@ -42,6 +43,7 @@ const StorybookAvatarGroup = () => {
42
43
 
43
44
  export default {
44
45
  component: StorybookAvatarGroup,
46
+ decorators: [withTheme],
45
47
  };
46
48
 
47
49
  export const Default = {
@@ -7,6 +7,7 @@ import '@dxosTheme';
7
7
  import React from 'react';
8
8
 
9
9
  import { Breadcrumb } from './Breadcrumb';
10
+ import { withTheme } from '../../testing';
10
11
  import { Button } from '../Buttons';
11
12
 
12
13
  const StorybookBreadcrumb = () => {
@@ -39,6 +40,7 @@ const StorybookBreadcrumb = () => {
39
40
 
40
41
  export default {
41
42
  component: StorybookBreadcrumb,
43
+ decorators: [withTheme],
42
44
  };
43
45
 
44
46
  export const Default = {
@@ -37,7 +37,14 @@ const BreadcrumbList = forwardRef<HTMLOListElement, BreadcrumbListProps>(
37
37
  ({ asChild, classNames, ...props }, forwardedRef) => {
38
38
  const { tx } = useThemeContext();
39
39
  const Root = asChild ? Slot : Primitive.ol;
40
- return <Root {...props} className={tx('breadcrumb.list', 'breadcrumb__list', {}, classNames)} ref={forwardedRef} />;
40
+ return (
41
+ <Root
42
+ role='list'
43
+ {...props}
44
+ className={tx('breadcrumb.list', 'breadcrumb__list', {}, classNames)}
45
+ ref={forwardedRef}
46
+ />
47
+ );
41
48
  },
42
49
  );
43
50
 
@@ -49,6 +56,7 @@ const BreadcrumbListItem = forwardRef<HTMLLIElement, BreadcrumbListItemProps>(
49
56
  const Root = asChild ? Slot : Primitive.li;
50
57
  return (
51
58
  <Root
59
+ role='listitem'
52
60
  {...props}
53
61
  className={tx('breadcrumb.listItem', 'breadcrumb__list__item', {}, classNames)}
54
62
  ref={forwardedRef}
@@ -10,11 +10,13 @@ import React, { type PropsWithChildren } from 'react';
10
10
  import { chromeSurface, groupSurface, mx, surfaceElevation } from '@dxos/react-ui-theme';
11
11
 
12
12
  import { Button, ButtonGroup, type ButtonProps } from './Button';
13
+ import { withTheme } from '../../testing';
13
14
  import { DensityProvider } from '../DensityProvider';
14
15
  import { ElevationProvider } from '../ElevationProvider';
15
16
 
16
17
  export default {
17
18
  component: Button,
19
+ decorators: [withTheme],
18
20
  };
19
21
 
20
22
  const Container = ({ children }: PropsWithChildren<{}>) => (
@@ -8,6 +8,7 @@ import { TextB } from '@phosphor-icons/react';
8
8
  import React from 'react';
9
9
 
10
10
  import { Toggle } from './Toggle';
11
+ import { withTheme } from '../../testing';
11
12
 
12
13
  type StorybookToggleProps = {};
13
14
 
@@ -21,6 +22,7 @@ const StorybookToggle = (props: StorybookToggleProps) => {
21
22
 
22
23
  export default {
23
24
  component: StorybookToggle,
25
+ decorators: [withTheme],
24
26
  };
25
27
 
26
28
  export const Default = {
@@ -8,6 +8,7 @@ import { TextB, TextItalic } from '@phosphor-icons/react';
8
8
  import React from 'react';
9
9
 
10
10
  import { ToggleGroup, ToggleGroupItem, type ToggleGroupProps } from './ToggleGroup';
11
+ import { withTheme } from '../../testing';
11
12
 
12
13
  type StorybookToggleGroupProps = {
13
14
  type: ToggleGroupProps['type'];
@@ -29,6 +30,7 @@ const StorybookToggleGroup = (props: StorybookToggleGroupProps) => {
29
30
 
30
31
  export default {
31
32
  component: StorybookToggleGroup,
33
+ decorators: [withTheme],
32
34
  };
33
35
 
34
36
  export const Default = {
@@ -7,6 +7,7 @@ import '@dxosTheme';
7
7
  import React from 'react';
8
8
 
9
9
  import { AlertDialog } from './AlertDialog';
10
+ import { withTheme } from '../../testing';
10
11
  import { Button } from '../Buttons';
11
12
  import { Toolbar } from '../Toolbar';
12
13
 
@@ -54,6 +55,7 @@ const StorybookAlertDialog = ({
54
55
 
55
56
  export default {
56
57
  component: StorybookAlertDialog,
58
+ decorators: [withTheme],
57
59
  };
58
60
 
59
61
  export const Default = {
@@ -7,6 +7,7 @@ import '@dxosTheme';
7
7
  import React from 'react';
8
8
 
9
9
  import { Dialog } from './Dialog';
10
+ import { withTheme } from '../../testing';
10
11
  import { Button } from '../Buttons';
11
12
 
12
13
  type StorybookDialogProps = Partial<{
@@ -39,6 +40,7 @@ const StorybookDialog = ({ title, openTrigger, description, body, closeTrigger }
39
40
 
40
41
  export default {
41
42
  component: StorybookDialog,
43
+ decorators: [withTheme],
42
44
  };
43
45
 
44
46
  export const Default = {
@@ -7,6 +7,7 @@ import '@dxosTheme';
7
7
  import React from 'react';
8
8
 
9
9
  import { DropdownMenu } from './DropdownMenu';
10
+ import { withTheme } from '../../testing';
10
11
  import { Button } from '../Buttons';
11
12
 
12
13
  const StorybookDropdownMenu = () => {
@@ -92,6 +93,7 @@ const StorybookDropdownMenu = () => {
92
93
 
93
94
  export default {
94
95
  component: StorybookDropdownMenu,
96
+ decorators: [withTheme],
95
97
  };
96
98
 
97
99
  export const Default = {
@@ -6,9 +6,11 @@ import '@dxosTheme';
6
6
 
7
7
  import React from 'react';
8
8
 
9
+ import { baseSurface, chromeSurface, groupSurface, mx, surfaceElevation } from '@dxos/react-ui-theme';
9
10
  import { type MessageValence } from '@dxos/react-ui-types';
10
11
 
11
12
  import { Input } from './Input';
13
+ import { withTheme } from '../../testing';
12
14
 
13
15
  type StoryInputProps = Partial<{
14
16
  label: string;
@@ -22,7 +24,7 @@ type StoryInputProps = Partial<{
22
24
  validationValence: MessageValence;
23
25
  }>;
24
26
 
25
- const StoryInput = ({
27
+ const StoryInputContent = ({
26
28
  type = 'default',
27
29
  label,
28
30
  description,
@@ -32,7 +34,6 @@ const StoryInput = ({
32
34
  validationMessage,
33
35
  ...props
34
36
  }: StoryInputProps) => {
35
- // TODO(thure): Implement
36
37
  return (
37
38
  <Input.Root {...{ validationValence }}>
38
39
  <Input.Label srOnly={labelVisuallyHidden}>{label}</Input.Label>
@@ -53,6 +54,23 @@ const StoryInput = ({
53
54
  );
54
55
  };
55
56
 
57
+ const StoryInput = (props: StoryInputProps) => {
58
+ // TODO(thure): Implement
59
+ return (
60
+ <div className='space-b-4'>
61
+ <div className={mx(baseSurface, 'p-4')}>
62
+ <StoryInputContent {...props} />
63
+ </div>
64
+ <div className={mx(groupSurface, 'p-4 rounded-lg', surfaceElevation({ elevation: 'group' }))}>
65
+ <StoryInputContent {...props} />
66
+ </div>
67
+ <div className={mx(chromeSurface, 'p-4 rounded-lg', surfaceElevation({ elevation: 'chrome' }))}>
68
+ <StoryInputContent {...props} />
69
+ </div>
70
+ </div>
71
+ );
72
+ };
73
+
56
74
  export default {
57
75
  component: StoryInput,
58
76
  // TODO(thure): Refactor
@@ -69,6 +87,7 @@ export default {
69
87
  options: ['default', 'textarea', 'pin'],
70
88
  },
71
89
  },
90
+ decorators: [withTheme],
72
91
  };
73
92
 
74
93
  export const Default = {
@@ -175,11 +175,13 @@ type TextInputProps = InputSharedProps & ThemedClassName<TextInputPrimitiveProps
175
175
  const TextInput = forwardRef<HTMLInputElement, InputScopedProps<TextInputProps>>(
176
176
  ({ __inputScope, classNames, density: propsDensity, elevation: propsElevation, variant, ...props }, forwardedRef) => {
177
177
  const { hasIosKeyboard } = useThemeContext();
178
- const { tx } = useThemeContext();
178
+ const themeContextValue = useThemeContext();
179
179
  const density = useDensityContext(propsDensity);
180
180
  const elevation = useElevationContext(propsElevation);
181
181
  const { validationValence } = useInputContext(INPUT_NAME, __inputScope);
182
182
 
183
+ const { tx } = themeContextValue;
184
+
183
185
  return (
184
186
  <TextInputPrimitive
185
187
  {...props}
@@ -5,9 +5,11 @@
5
5
  import '@dxosTheme';
6
6
 
7
7
  import { Link } from './Link';
8
+ import { withTheme } from '../../testing';
8
9
 
9
10
  export default {
10
11
  component: Link,
12
+ decorators: [withTheme],
11
13
  } as any;
12
14
 
13
15
  export const Default = { args: { children: 'Hello', href: '#' } };
@@ -13,9 +13,11 @@ import React, { type FC, type ReactNode, useState } from 'react';
13
13
  import { getSize, mx, surfaceElevation } from '@dxos/react-ui-theme';
14
14
 
15
15
  import { List, ListItem, type ListProps, type ListScopedProps } from './List';
16
+ import { withTheme } from '../../testing';
16
17
 
17
18
  export default {
18
19
  component: List as FC<ListProps>,
20
+ decorators: [withTheme],
19
21
  };
20
22
 
21
23
  const UniformListItem = ({ id, text }: { id: string; text: string }) => {
@@ -7,6 +7,7 @@ import '@dxosTheme';
7
7
  import React from 'react';
8
8
 
9
9
  import { Tree, TreeItem } from './Tree';
10
+ import { withTheme } from '../../testing';
10
11
 
11
12
  type StorybookTreeProps = {
12
13
  data: any;
@@ -56,6 +57,7 @@ const StorybookTree = ({ data }: StorybookTreeProps) => {
56
57
 
57
58
  export default {
58
59
  component: StorybookTree,
60
+ decorators: [withTheme],
59
61
  };
60
62
 
61
63
  export const Default = {
@@ -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,10 @@ const StoryMain = (_args: StoryMainArgs) => {
44
45
  );
45
46
  };
46
47
 
47
- export default { component: StoryMain };
48
+ export default {
49
+ component: StoryMain,
50
+ decorators: [withTheme],
51
+ };
48
52
 
49
53
  export const Default = {
50
54
  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;
@@ -28,6 +29,7 @@ const StoryMessage = ({ valence, title, body }: StoryMessageProps) => (
28
29
 
29
30
  export default {
30
31
  component: StoryMessage,
32
+ decorators: [withTheme],
31
33
  };
32
34
 
33
35
  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);
@@ -28,6 +29,8 @@ const StorybookPopover = ({ openTrigger, children }: PropsWithChildren<{ openTri
28
29
 
29
30
  export default {
30
31
  component: StorybookPopover,
32
+ decorators: [withTheme],
33
+ parameters: { chromatic: { disableSnapshot: false } },
31
34
  };
32
35
 
33
36
  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
 
@@ -34,6 +35,8 @@ const StorybookScrollArea = ({ children }: PropsWithChildren<{}>) => {
34
35
 
35
36
  export default {
36
37
  component: StorybookScrollArea,
38
+ decorators: [withTheme],
39
+ parameters: { chromatic: { disableSnapshot: false } },
37
40
  };
38
41
 
39
42
  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);
@@ -59,6 +60,8 @@ const StorybookSelect = ({ items = [] }: PropsWithChildren<{ items: ItemProps[]
59
60
 
60
61
  export default {
61
62
  component: createDensityTest(StorybookSelect),
63
+ decorators: [withTheme],
64
+ parameters: { chromatic: { disableSnapshot: false } },
62
65
  };
63
66
 
64
67
  export const Default = {
@@ -0,0 +1,36 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ import '@dxosTheme';
6
+
7
+ import React from 'react';
8
+
9
+ import { Status } from './Status';
10
+ import { withTheme } from '../../testing';
11
+
12
+ export default {
13
+ component: Status,
14
+ actions: { argTypesRegex: '^on.*' },
15
+ decorators: [withTheme],
16
+ parameters: { chromatic: { disableSnapshot: false } },
17
+ };
18
+
19
+ export const Normal = (props: any) => {
20
+ return (
21
+ <div className='m-5 space-b-5'>
22
+ <Status classNames='block' progress={0} {...props} />
23
+ <Status classNames='block' progress={0.3} {...props} />
24
+ <Status classNames='block' progress={0.7} {...props} />
25
+ <Status classNames='block' progress={1} {...props} />
26
+ </div>
27
+ );
28
+ };
29
+
30
+ export const Indeterminate = (props: any) => {
31
+ return (
32
+ <div className='m-5'>
33
+ <Status classNames='block' indeterminate {...props} />
34
+ </div>
35
+ );
36
+ };
@@ -0,0 +1,38 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ import React, { type ComponentPropsWithRef, forwardRef } from 'react';
6
+
7
+ import { useThemeContext } from '../../hooks';
8
+ import { type ThemedClassName } from '../../util';
9
+
10
+ type StatusProps = ThemedClassName<ComponentPropsWithRef<'span'>> & {
11
+ indeterminate?: boolean;
12
+ progress?: number;
13
+ };
14
+
15
+ const Status = forwardRef<HTMLSpanElement, StatusProps>(
16
+ ({ classNames, children, progress = 0, indeterminate, ...props }, forwardedRef) => {
17
+ const { tx } = useThemeContext();
18
+ return (
19
+ <span
20
+ role='status'
21
+ {...props}
22
+ className={tx('status.root', 'status', { indeterminate }, classNames)}
23
+ ref={forwardedRef}
24
+ >
25
+ <span
26
+ role='none'
27
+ className={tx('status.bar', 'status__bar', { indeterminate }, classNames)}
28
+ {...(!indeterminate && { style: { width: `${Math.round(progress * 100)}%` } })}
29
+ />
30
+ {children}
31
+ </span>
32
+ );
33
+ },
34
+ );
35
+
36
+ export { Status };
37
+
38
+ export type { StatusProps };
@@ -2,4 +2,4 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- export * from './Card';
5
+ export * from './Status';
@@ -5,9 +5,12 @@
5
5
  import '@dxosTheme';
6
6
 
7
7
  import { Tag } from './Tag';
8
+ import { withTheme } from '../../testing';
8
9
 
9
10
  export default {
10
11
  component: Tag,
12
+ decorators: [withTheme],
13
+ parameters: { chromatic: { disableSnapshot: false } },
11
14
  argTypes: {
12
15
  palette: {
13
16
  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 };
@@ -45,6 +46,8 @@ const StorybookToast = (props: StorybookToastProps) => {
45
46
 
46
47
  export default {
47
48
  component: StorybookToast,
49
+ decorators: [withTheme],
50
+ parameters: { chromatic: { disableSnapshot: false } },
48
51
  };
49
52
 
50
53
  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
 
@@ -70,6 +71,8 @@ const StorybookToolbar = (props: StorybookToolbarProps) => {
70
71
 
71
72
  export default {
72
73
  component: StorybookToolbar,
74
+ decorators: [withTheme],
75
+ parameters: { chromatic: { disableSnapshot: false } },
73
76
  };
74
77
 
75
78
  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 = {
@@ -29,6 +30,8 @@ const StoryTooltip = ({ content }: StoryTooltipProps) => (
29
30
 
30
31
  export default {
31
32
  component: StoryTooltip,
33
+ decorators: [withTheme],
34
+ parameters: { chromatic: { disableSnapshot: false } },
32
35
  };
33
36
 
34
37
  export const Default = {