@dxos/brand 0.8.3 → 0.8.4-main.1da679c

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/brand",
3
- "version": "0.8.3",
3
+ "version": "0.8.4-main.1da679c",
4
4
  "description": "DXOS brand assets.",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -10,6 +10,7 @@
10
10
  "type": "module",
11
11
  "exports": {
12
12
  ".": {
13
+ "source": "./src/index.ts",
13
14
  "types": "./dist/types/src/index.d.ts",
14
15
  "browser": "./dist/lib/browser/index.mjs"
15
16
  }
@@ -33,15 +34,15 @@
33
34
  "@types/d3": "^7.4.3",
34
35
  "react": "~18.2.0",
35
36
  "react-dom": "~18.2.0",
36
- "@dxos/react-ui": "0.8.3",
37
- "@dxos/react-ui-theme": "0.8.3",
38
- "@dxos/storybook-utils": "0.8.3"
37
+ "@dxos/react-ui": "0.8.4-main.1da679c",
38
+ "@dxos/react-ui-theme": "0.8.4-main.1da679c",
39
+ "@dxos/storybook-utils": "0.8.4-main.1da679c"
39
40
  },
40
41
  "peerDependencies": {
41
42
  "@phosphor-icons/react": "^2.1.5",
42
43
  "react": "~18.2.0",
43
44
  "react-dom": "~18.2.0",
44
- "@dxos/react-ui": "0.8.3",
45
- "@dxos/react-ui-theme": "0.8.3"
45
+ "@dxos/react-ui": "0.8.4-main.1da679c",
46
+ "@dxos/react-ui-theme": "0.8.4-main.1da679c"
46
47
  }
47
48
  }
@@ -4,22 +4,27 @@
4
4
 
5
5
  import '@dxos-theme';
6
6
 
7
+ import { type Meta, type StoryObj } from '@storybook/react-vite';
7
8
  import React from 'react';
8
9
 
9
10
  import { mx } from '@dxos/react-ui-theme';
10
11
  import { withTheme } from '@dxos/storybook-utils';
11
12
 
12
- import { DXNS, DXOS, ECHO, HALO, KUBE, MESH, Composer } from './icons';
13
+ import { Composer, DXNS, DXOS, ECHO, HALO, KUBE, MESH } from './icons';
13
14
 
14
15
  const Icon = () => null;
15
16
 
16
- export default {
17
+ const meta = {
17
18
  title: 'ui/brand/Icons',
18
19
  component: Icon,
19
20
  decorators: [withTheme],
20
- };
21
+ } satisfies Meta<typeof Icon>;
22
+
23
+ export default meta;
24
+
25
+ type Story = StoryObj<typeof meta>;
21
26
 
22
- export const Default = {
27
+ export const Default: Story = {
23
28
  render: () => {
24
29
  const size = 'w-[128px] h-[128px]';
25
30
  return (
@@ -4,20 +4,25 @@
4
4
 
5
5
  import '@dxos-theme';
6
6
 
7
+ import { type Meta, type StoryObj } from '@storybook/react-vite';
7
8
  import React, { type FC, type ReactNode } from 'react';
8
9
 
9
10
  import { mx } from '@dxos/react-ui-theme';
10
11
  import { withTheme } from '@dxos/storybook-utils';
11
12
 
12
- import { DXOSType, DXOSHorizontalType, DXOSVerticalType } from './logotypes';
13
+ import { DXOSHorizontalType, DXOSType, DXOSVerticalType } from './logotypes';
13
14
 
14
15
  const Icon = () => null;
15
16
 
16
- export default {
17
+ const meta = {
17
18
  title: 'ui/brand/LogoTypes',
18
19
  component: Icon,
19
20
  decorators: [withTheme],
20
- };
21
+ } satisfies Meta<typeof Icon>;
22
+
23
+ export default meta;
24
+
25
+ type Story = StoryObj<typeof meta>;
21
26
 
22
27
  const Cell: FC<{ children: ReactNode; dark?: boolean }> = ({ children, dark }) => (
23
28
  <div className={mx('flex p-4 justify-center rounded-md', dark ? 'bg-zinc-800 fill-zinc-50' : 'bg-white')}>
@@ -25,7 +30,7 @@ const Cell: FC<{ children: ReactNode; dark?: boolean }> = ({ children, dark }) =
25
30
  </div>
26
31
  );
27
32
 
28
- export const Default = {
33
+ export const Default: Story = {
29
34
  render: () => {
30
35
  return (
31
36
  <div className='absolute flex w-full h-full items-center justify-center'>
@@ -6,25 +6,30 @@ import '@dxos-theme';
6
6
 
7
7
  import '@fontsource/k2d/100-italic.css';
8
8
 
9
- import { Ghost, Square } from '@phosphor-icons/react';
9
+ import { type Meta, type StoryObj } from '@storybook/react-vite';
10
10
  import React, { useRef, useState } from 'react';
11
11
 
12
- import { Button } from '@dxos/react-ui';
12
+ import { Button, Icon } from '@dxos/react-ui';
13
13
  import { mx } from '@dxos/react-ui-theme';
14
14
  import { withTheme } from '@dxos/storybook-utils';
15
15
 
16
- import { type AnimationController, ComposerLogo, ComposerSpinner } from './ComposerLogo';
17
16
  import { DXOS } from '../../icons';
18
17
 
18
+ import { type AnimationController, ComposerLogo, ComposerSpinner } from './ComposerLogo';
19
+
19
20
  // import ident from '../../../assets/sounds/ident-1.mp3';
20
21
 
21
22
  // https://pixabay.com/sound-effects/search/logo/?pagi=2
22
23
 
23
- export default {
24
+ const meta = {
24
25
  title: 'ui/brand/Logo',
25
26
  component: ComposerLogo,
26
27
  decorators: [withTheme],
27
- };
28
+ } satisfies Meta<typeof ComposerLogo>;
29
+
30
+ export default meta;
31
+
32
+ type Story = StoryObj<typeof meta>;
28
33
 
29
34
  // TODO(burdon): Get from theme?
30
35
  const colors = {
@@ -35,7 +40,7 @@ const colors = {
35
40
  blue: '#539ACD',
36
41
  };
37
42
 
38
- export const Default = {
43
+ export const Default: Story = {
39
44
  render: () => {
40
45
  const controller = useRef<AnimationController>(null);
41
46
  const [logo, setLogo] = useState(false);
@@ -76,7 +81,7 @@ export const Default = {
76
81
  };
77
82
 
78
83
  // TODO(burdon): Camo.
79
- export const Colors = {
84
+ export const Colors: Story = {
80
85
  render: () => {
81
86
  const colors = [
82
87
  ['fill-teal-400', 'fill-teal-500', 'fill-teal-600'],
@@ -104,7 +109,7 @@ export const Colors = {
104
109
  },
105
110
  };
106
111
 
107
- export const Pacman = {
112
+ export const Pacman: Story = {
108
113
  render: () => {
109
114
  return (
110
115
  <div className='absolute inset-0 flex flex-col justify-center'>
@@ -112,13 +117,13 @@ export const Pacman = {
112
117
  <div className='flex items-center p-4'>
113
118
  <div className='flex ml-8 mr-[100px]'>
114
119
  <div>
115
- <Ghost weight='duotone' className='w-[180px] h-[180px] text-blue-500' />
120
+ <Icon icon='ph--ghost--duotone' classNames='w-[180px] h-[180px] text-blue-500' />
116
121
  </div>
117
122
  <div>
118
- <Ghost weight='duotone' className='w-[180px] h-[180px] text-purple-500' />
123
+ <Icon icon='ph--ghost--duotone' classNames='w-[180px] h-[180px] text-purple-500' />
119
124
  </div>
120
125
  <div>
121
- <Ghost weight='duotone' className='w-[180px] h-[180px] text-red-500' />
126
+ <Icon icon='ph--ghost--duotone' classNames='w-[180px] h-[180px] text-red-500' />
122
127
  </div>
123
128
  </div>
124
129
 
@@ -127,7 +132,7 @@ export const Pacman = {
127
132
  <div className='flex -ml-10'>
128
133
  {Array.from({ length: 6 }).map((_, i) => (
129
134
  <div key={i} className='p-4'>
130
- <Square weight='duotone' className='w-6 h-6 text-yellow-200' />
135
+ <Icon icon='ph--square--duotone' classNames='w-6 h-6 text-yellow-200' />
131
136
  </div>
132
137
  ))}
133
138
  </div>
@@ -179,7 +184,7 @@ const SpinnerContainer = () => {
179
184
  );
180
185
  };
181
186
 
182
- export const Spinner = {
187
+ export const Spinner: Story = {
183
188
  render: () => {
184
189
  return (
185
190
  <div className='absolute inset-0 flex items-center justify-center'>
@@ -190,7 +195,7 @@ export const Spinner = {
190
195
  };
191
196
 
192
197
  // https://github.com/grafana/grafana/blob/main/packages/grafana-ui/src/components/LoadingBar/LoadingBar.tsx
193
- export const Linear = {
198
+ export const Linear: Story = {
194
199
  render: () => {
195
200
  return (
196
201
  <div className='absolute flex flex-col inset-0 bg-black'>
@@ -2,7 +2,7 @@
2
2
  // Copyright 2022 DXOS.org
3
3
  //
4
4
 
5
- import { IconBase, type IconProps, type IconWeight } from '@phosphor-icons/react';
5
+ import { type IconWeight } from '@phosphor-icons/react';
6
6
  import { arc, interpolateString, select } from 'd3';
7
7
  import React, {
8
8
  type CSSProperties,
@@ -28,9 +28,23 @@ const weights = new Map<IconWeight, ReactElement>([
28
28
  ],
29
29
  ]);
30
30
 
31
- const Composer = forwardRef<SVGSVGElement, IconProps>((props, ref) => (
32
- <IconBase ref={ref} {...props} weights={weights} />
33
- ));
31
+ const Composer = forwardRef<SVGSVGElement, any>((props, ref) => {
32
+ const weight = props.weight || 'regular';
33
+ const size = props.size || 256;
34
+ return (
35
+ <svg
36
+ ref={ref}
37
+ {...props}
38
+ width={size}
39
+ height={size}
40
+ viewBox='0 0 256 256'
41
+ fill='currentColor'
42
+ xmlns='http://www.w3.org/2000/svg'
43
+ >
44
+ {weights.get(weight)}
45
+ </svg>
46
+ );
47
+ });
34
48
 
35
49
  export interface AnimationController {
36
50
  spin: () => void;
@@ -5,16 +5,12 @@
5
5
  import '@dxos-theme';
6
6
 
7
7
  import { type Rive, useRive } from '@rive-app/react-canvas';
8
+ import { type Meta, type StoryObj } from '@storybook/react-vite';
8
9
  import React, { useEffect } from 'react';
9
10
 
10
11
  import { useAsyncState } from '@dxos/react-ui';
11
12
  import { mx } from '@dxos/react-ui-theme';
12
- import { withLayout, withTheme } from '@dxos/storybook-utils';
13
-
14
- export default {
15
- title: 'ui/brand/Rive',
16
- decorators: [withTheme, withLayout({ fullscreen: true, classNames: ['absolute inset-0 bg-black'] })],
17
- };
13
+ import { render, withLayout, withTheme } from '@dxos/storybook-utils';
18
14
 
19
15
  const useFlash = (rive: Rive | null, name: string, delay: number, period: number) => {
20
16
  useEffect(() => {
@@ -45,7 +41,7 @@ const Component = ({ buffer }: { buffer: ArrayBuffer }) => {
45
41
  );
46
42
  };
47
43
 
48
- export const Default = () => {
44
+ const DefaultStory = () => {
49
45
  const [buffer] = useAsyncState<ArrayBuffer>(async () => {
50
46
  // CORS set via dashboard.
51
47
  const response = await fetch('https://dxos.network/dxos.riv', { mode: 'cors' });
@@ -82,3 +78,21 @@ export const Default = () => {
82
78
  </>
83
79
  );
84
80
  };
81
+
82
+ const meta = {
83
+ title: 'ui/brand/Rive',
84
+ render: render(DefaultStory),
85
+ decorators: [
86
+ withTheme,
87
+ withLayout({
88
+ fullscreen: true,
89
+ classNames: ['absolute inset-0 bg-black'],
90
+ }),
91
+ ],
92
+ } satisfies Meta<typeof DefaultStory>;
93
+
94
+ export default meta;
95
+
96
+ type Story = StoryObj<typeof meta>;
97
+
98
+ export const Default: Story = {};
@@ -2,8 +2,8 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import { IconBase, type IconProps, type IconWeight } from '@phosphor-icons/react';
6
- import React, { forwardRef, type ReactElement } from 'react';
5
+ import { type IconWeight } from '@phosphor-icons/react';
6
+ import React, { type ReactElement, forwardRef } from 'react';
7
7
 
8
8
  const weights = new Map<IconWeight, ReactElement>([
9
9
  [
@@ -36,8 +36,22 @@ const weights = new Map<IconWeight, ReactElement>([
36
36
  ],
37
37
  ]);
38
38
 
39
- export const Composer = forwardRef<SVGSVGElement, IconProps>((props, ref) => (
40
- <IconBase ref={ref} {...props} weights={weights} />
41
- ));
39
+ export const Composer = forwardRef<SVGSVGElement, any>((props, ref) => {
40
+ const weight = props.weight || 'regular';
41
+ const size = props.size || 256;
42
+ return (
43
+ <svg
44
+ ref={ref}
45
+ {...props}
46
+ width={size}
47
+ height={size}
48
+ viewBox='0 0 256 256'
49
+ fill='currentColor'
50
+ xmlns='http://www.w3.org/2000/svg'
51
+ >
52
+ {weights.get(weight)}
53
+ </svg>
54
+ );
55
+ });
42
56
 
43
57
  Composer.displayName = 'Composer';
@@ -3,7 +3,7 @@
3
3
  //
4
4
 
5
5
  import { IconBase, type IconProps, type IconWeight } from '@phosphor-icons/react';
6
- import React, { forwardRef, type ReactElement } from 'react';
6
+ import React, { type ReactElement, forwardRef } from 'react';
7
7
 
8
8
  const weights = new Map<IconWeight, ReactElement>([
9
9
  [
@@ -3,7 +3,7 @@
3
3
  //
4
4
 
5
5
  import { IconBase, type IconProps, type IconWeight } from '@phosphor-icons/react';
6
- import React, { forwardRef, type ReactElement } from 'react';
6
+ import React, { type ReactElement, forwardRef } from 'react';
7
7
 
8
8
  const weights = new Map<IconWeight, ReactElement>([
9
9
  [
@@ -3,7 +3,7 @@
3
3
  //
4
4
 
5
5
  import { IconBase, type IconProps, type IconWeight } from '@phosphor-icons/react';
6
- import React, { forwardRef, type ReactElement } from 'react';
6
+ import React, { type ReactElement, forwardRef } from 'react';
7
7
 
8
8
  const weights = new Map<IconWeight, ReactElement>([
9
9
  [
@@ -3,7 +3,7 @@
3
3
  //
4
4
 
5
5
  import { IconBase, type IconProps, type IconWeight } from '@phosphor-icons/react';
6
- import React, { forwardRef, type ReactElement } from 'react';
6
+ import React, { type ReactElement, forwardRef } from 'react';
7
7
 
8
8
  const weights = new Map<IconWeight, ReactElement>([
9
9
  [
@@ -3,7 +3,7 @@
3
3
  //
4
4
 
5
5
  import { IconBase, type IconProps, type IconWeight } from '@phosphor-icons/react';
6
- import React, { forwardRef, type ReactElement } from 'react';
6
+ import React, { type ReactElement, forwardRef } from 'react';
7
7
 
8
8
  const weights = new Map<IconWeight, ReactElement>([
9
9
  [
@@ -3,7 +3,7 @@
3
3
  //
4
4
 
5
5
  import { IconBase, type IconProps, type IconWeight } from '@phosphor-icons/react';
6
- import React, { forwardRef, type ReactElement } from 'react';
6
+ import React, { type ReactElement, forwardRef } from 'react';
7
7
 
8
8
  const weights = new Map<IconWeight, ReactElement>([
9
9
  [