@dxos/storybook-utils 0.8.4-main.fffef41 → 0.9.0
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/LICENSE +102 -5
- package/README.md +1 -1
- package/dist/lib/browser/index.mjs +15 -126
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +15 -126
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/components/index.d.ts +0 -2
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/decorators/index.d.ts +1 -1
- package/dist/types/src/decorators/index.d.ts.map +1 -1
- package/dist/types/src/decorators/withRegistry.d.ts +6 -0
- package/dist/types/src/decorators/withRegistry.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +0 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/stories/test/Test.d.ts.map +1 -1
- package/dist/types/src/stories/test/Test.stories.d.ts +3 -16
- package/dist/types/src/stories/test/Test.stories.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +19 -23
- package/src/components/index.ts +0 -4
- package/src/decorators/index.ts +1 -1
- package/src/decorators/withLayout.tsx +1 -1
- package/src/decorators/withRegistry.tsx +23 -0
- package/src/index.ts +0 -6
- package/src/stories/test/Test.stories.tsx +3 -3
- package/dist/types/src/components/CardContainers/ExtrinsicCardContainer.d.ts +0 -12
- package/dist/types/src/components/CardContainers/ExtrinsicCardContainer.d.ts.map +0 -1
- package/dist/types/src/components/CardContainers/IntrinsicCardContainer.d.ts +0 -9
- package/dist/types/src/components/CardContainers/IntrinsicCardContainer.d.ts.map +0 -1
- package/dist/types/src/components/CardContainers/PopoverCardContainer.d.ts +0 -5
- package/dist/types/src/components/CardContainers/PopoverCardContainer.d.ts.map +0 -1
- package/dist/types/src/components/CardContainers/index.d.ts +0 -4
- package/dist/types/src/components/CardContainers/index.d.ts.map +0 -1
- package/dist/types/src/components/ThemeEditor.d.ts +0 -5
- package/dist/types/src/components/ThemeEditor.d.ts.map +0 -1
- package/dist/types/src/decorators/withThemeEditor.d.ts +0 -6
- package/dist/types/src/decorators/withThemeEditor.d.ts.map +0 -1
- package/dist/types/src/util.d.ts +0 -6
- package/dist/types/src/util.d.ts.map +0 -1
- package/src/components/CardContainers/ExtrinsicCardContainer.tsx +0 -72
- package/src/components/CardContainers/IntrinsicCardContainer.tsx +0 -48
- package/src/components/CardContainers/PopoverCardContainer.tsx +0 -24
- package/src/components/CardContainers/index.ts +0 -7
- package/src/components/ThemeEditor.tsx +0 -18
- package/src/decorators/withThemeEditor.tsx +0 -28
- package/src/util.tsx +0 -15
package/package.json
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/storybook-utils",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "Utilities for DXOS UI Storybooks.",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
7
|
-
"
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/dxos/dxos"
|
|
10
|
+
},
|
|
11
|
+
"license": "FSL-1.1-Apache-2.0",
|
|
8
12
|
"author": "DXOS.org",
|
|
9
13
|
"sideEffects": true,
|
|
10
14
|
"type": "module",
|
|
@@ -17,37 +21,29 @@
|
|
|
17
21
|
}
|
|
18
22
|
},
|
|
19
23
|
"types": "dist/types/src/index.d.ts",
|
|
20
|
-
"typesVersions": {
|
|
21
|
-
"*": {}
|
|
22
|
-
},
|
|
23
24
|
"files": [
|
|
24
25
|
"dist",
|
|
25
26
|
"src"
|
|
26
27
|
],
|
|
27
28
|
"dependencies": {
|
|
28
|
-
"@
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"@dxos/lit-theme-editor": "0.8.4-main.fffef41",
|
|
32
|
-
"@dxos/echo-signals": "0.8.4-main.fffef41",
|
|
33
|
-
"@dxos/lit-ui": "0.8.4-main.fffef41",
|
|
34
|
-
"@dxos/log": "0.8.4-main.fffef41",
|
|
35
|
-
"@dxos/react-ui-dnd": "0.8.4-main.fffef41"
|
|
29
|
+
"@effect-atom/atom-react": "^0.5.0",
|
|
30
|
+
"storybook": "10.2.0",
|
|
31
|
+
"@dxos/log": "0.9.0"
|
|
36
32
|
},
|
|
37
33
|
"devDependencies": {
|
|
38
34
|
"@types/lodash.defaultsdeep": "^4.6.6",
|
|
39
|
-
"@types/react": "~19.2.
|
|
40
|
-
"@types/react-dom": "~19.2.
|
|
41
|
-
"react": "~19.2.
|
|
42
|
-
"react-dom": "~19.2.
|
|
43
|
-
"@dxos/react-ui": "0.
|
|
44
|
-
"@dxos/
|
|
35
|
+
"@types/react": "~19.2.7",
|
|
36
|
+
"@types/react-dom": "~19.2.3",
|
|
37
|
+
"react": "~19.2.3",
|
|
38
|
+
"react-dom": "~19.2.3",
|
|
39
|
+
"@dxos/react-ui": "0.9.0",
|
|
40
|
+
"@dxos/ui-theme": "0.9.0"
|
|
45
41
|
},
|
|
46
42
|
"peerDependencies": {
|
|
47
|
-
"react": "
|
|
48
|
-
"react-dom": "
|
|
49
|
-
"@dxos/react-ui": "0.
|
|
50
|
-
"@dxos/
|
|
43
|
+
"react": "~19.2.3",
|
|
44
|
+
"react-dom": "~19.2.3",
|
|
45
|
+
"@dxos/react-ui": "0.9.0",
|
|
46
|
+
"@dxos/ui-theme": "0.9.0"
|
|
51
47
|
},
|
|
52
48
|
"publishConfig": {
|
|
53
49
|
"access": "public"
|
package/src/components/index.ts
CHANGED
package/src/decorators/index.ts
CHANGED
|
@@ -9,7 +9,7 @@ export const withLayout: Decorator = (Story, context) => {
|
|
|
9
9
|
switch (context.parameters.layout) {
|
|
10
10
|
case 'fullscreen':
|
|
11
11
|
return (
|
|
12
|
-
<div
|
|
12
|
+
<div className='fixed inset-0 flex flex-col overflow-hidden bg-base-surface'>
|
|
13
13
|
<Story />
|
|
14
14
|
</div>
|
|
15
15
|
);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Registry, RegistryContext } from '@effect-atom/atom-react';
|
|
6
|
+
import { type Decorator } from '@storybook/react';
|
|
7
|
+
import React, { memo, useMemo } from 'react';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Adds Effect Atom registry context for storybook.
|
|
11
|
+
*/
|
|
12
|
+
export const withRegistry: Decorator = (Story) => {
|
|
13
|
+
const registry = useMemo(() => Registry.make(), []);
|
|
14
|
+
|
|
15
|
+
// Prevent re-rendering of the story.
|
|
16
|
+
const MemoizedStory = memo(Story);
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<RegistryContext.Provider value={registry}>
|
|
20
|
+
<MemoizedStory />
|
|
21
|
+
</RegistryContext.Provider>
|
|
22
|
+
);
|
|
23
|
+
};
|
package/src/index.ts
CHANGED
|
@@ -14,13 +14,13 @@ import { TEST_ID, Test } from './Test';
|
|
|
14
14
|
/**
|
|
15
15
|
* Storybook sanity test.
|
|
16
16
|
*/
|
|
17
|
-
const meta = {
|
|
17
|
+
const meta: Meta<typeof Test> = {
|
|
18
18
|
title: 'common/storybook-utils/Test',
|
|
19
19
|
component: Test,
|
|
20
20
|
render: (args) => <Test {...{ 'data-testid': TEST_ID }} {...args} />,
|
|
21
|
-
decorators: [withTheme],
|
|
21
|
+
decorators: [withTheme()],
|
|
22
22
|
tags: ['test'],
|
|
23
|
-
}
|
|
23
|
+
};
|
|
24
24
|
|
|
25
25
|
export default meta;
|
|
26
26
|
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import React, { type PropsWithChildren } from 'react';
|
|
2
|
-
import { type Size } from '@dxos/react-ui-dnd';
|
|
3
|
-
export type ExtrinsicCardContainerProps = PropsWithChildren<{
|
|
4
|
-
defaultInlineSize?: Size;
|
|
5
|
-
inlineSize?: Size;
|
|
6
|
-
defaultBlockSize?: Size;
|
|
7
|
-
blockSize?: Size;
|
|
8
|
-
onInlineSizeChange?: (size: Size, commit?: boolean) => void;
|
|
9
|
-
onBlockSizeChange?: (size: Size, commit?: boolean) => void;
|
|
10
|
-
}>;
|
|
11
|
-
export declare const ExtrinsicCardContainer: ({ children, defaultInlineSize, inlineSize: propInlineSize, defaultBlockSize, blockSize: propBlockSize, onInlineSizeChange, onBlockSizeChange, }: ExtrinsicCardContainerProps) => React.JSX.Element;
|
|
12
|
-
//# sourceMappingURL=ExtrinsicCardContainer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ExtrinsicCardContainer.d.ts","sourceRoot":"","sources":["../../../../../src/components/CardContainers/ExtrinsicCardContainer.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,EAAE,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAEtD,OAAO,EAAgB,KAAK,IAAI,EAA+B,MAAM,oBAAoB,CAAC;AAQ1F,MAAM,MAAM,2BAA2B,GAAG,iBAAiB,CAAC;IAC1D,iBAAiB,CAAC,EAAE,IAAI,CAAC;IACzB,UAAU,CAAC,EAAE,IAAI,CAAC;IAClB,gBAAgB,CAAC,EAAE,IAAI,CAAC;IACxB,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,kBAAkB,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IAC5D,iBAAiB,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;CAC5D,CAAC,CAAC;AAEH,eAAO,MAAM,sBAAsB,GAAI,iJAQpC,2BAA2B,sBAuC7B,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import React, { type PropsWithChildren } from 'react';
|
|
2
|
-
import { type Size } from '@dxos/react-ui-dnd';
|
|
3
|
-
export type IntrinsicCardContainerProps = PropsWithChildren<{
|
|
4
|
-
defaultSize?: Size;
|
|
5
|
-
size?: Size;
|
|
6
|
-
onSizeChange?: (size: Size, commit?: boolean) => void;
|
|
7
|
-
}>;
|
|
8
|
-
export declare const IntrinsicCardContainer: ({ children, defaultSize, size: propSize, onSizeChange, }: IntrinsicCardContainerProps) => React.JSX.Element;
|
|
9
|
-
//# sourceMappingURL=IntrinsicCardContainer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IntrinsicCardContainer.d.ts","sourceRoot":"","sources":["../../../../../src/components/CardContainers/IntrinsicCardContainer.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,EAAE,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAEtD,OAAO,EAAgB,KAAK,IAAI,EAA+B,MAAM,oBAAoB,CAAC;AAM1F,MAAM,MAAM,2BAA2B,GAAG,iBAAiB,CAAC;IAC1D,WAAW,CAAC,EAAE,IAAI,CAAC;IACnB,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;CACvD,CAAC,CAAC;AAEH,eAAO,MAAM,sBAAsB,GAAI,0DAKpC,2BAA2B,sBAuB7B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PopoverCardContainer.d.ts","sourceRoot":"","sources":["../../../../../src/components/CardContainers/PopoverCardContainer.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,EAAE,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAItD,eAAO,MAAM,oBAAoB,GAAI,qBAGlC,iBAAiB,CAAC;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,sBAYrC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/CardContainers/index.ts"],"names":[],"mappings":"AAIA,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { DxThemeEditor as NaturalDxThemeEditor } from '@dxos/lit-theme-editor';
|
|
3
|
-
import '@dxos/lit-theme-editor/dx-theme-editor.pcss';
|
|
4
|
-
export declare const ThemeEditor: React.NamedExoticComponent<Omit<React.HTMLAttributes<NaturalDxThemeEditor>, "connectedCallback" | "disconnectedCallback" | "render" | "createRenderRoot" | "renderOptions" | "renderRoot" | "isUpdatePending" | "hasUpdated" | "addController" | "removeController" | "attributeChangedCallback" | "requestUpdate" | "updateComplete"> & {} & Partial<Omit<NaturalDxThemeEditor, keyof HTMLElement>> & React.RefAttributes<NaturalDxThemeEditor>>;
|
|
5
|
-
//# sourceMappingURL=ThemeEditor.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ThemeEditor.d.ts","sourceRoot":"","sources":["../../../../src/components/ThemeEditor.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAe,MAAM,OAAO,CAAC;AAEpC,OAAO,EAAE,aAAa,IAAI,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAG/E,OAAO,6CAA6C,CAAC;AAQrD,eAAO,MAAM,WAAW,mbAAsB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"withThemeEditor.d.ts","sourceRoot":"","sources":["../../../../src/decorators/withThemeEditor.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAKlD;;GAEG;AAEH,eAAO,MAAM,eAAe,EAAE,SAc7B,CAAC"}
|
package/dist/types/src/util.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../../src/util.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAEvC;;GAEG;AACH,eAAO,MAAM,MAAM,GAChB,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,MAC3C,MAAM,OAAO,sBAGb,CAAC"}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { useControllableState } from '@radix-ui/react-use-controllable-state';
|
|
6
|
-
import React, { type PropsWithChildren } from 'react';
|
|
7
|
-
|
|
8
|
-
import { ResizeHandle, type Size, resizeAttributes, sizeStyle } from '@dxos/react-ui-dnd';
|
|
9
|
-
|
|
10
|
-
// Default size in rem.
|
|
11
|
-
const DEFAULT_INLINE_SIZE = 24;
|
|
12
|
-
const MIN_INLINE_SIZE = 8;
|
|
13
|
-
const DEFAULT_BLOCK_SIZE = 24;
|
|
14
|
-
const MIN_BLOCK_SIZE = 8;
|
|
15
|
-
|
|
16
|
-
export type ExtrinsicCardContainerProps = PropsWithChildren<{
|
|
17
|
-
defaultInlineSize?: Size;
|
|
18
|
-
inlineSize?: Size;
|
|
19
|
-
defaultBlockSize?: Size;
|
|
20
|
-
blockSize?: Size;
|
|
21
|
-
onInlineSizeChange?: (size: Size, commit?: boolean) => void;
|
|
22
|
-
onBlockSizeChange?: (size: Size, commit?: boolean) => void;
|
|
23
|
-
}>;
|
|
24
|
-
|
|
25
|
-
export const ExtrinsicCardContainer = ({
|
|
26
|
-
children,
|
|
27
|
-
defaultInlineSize,
|
|
28
|
-
inlineSize: propInlineSize,
|
|
29
|
-
defaultBlockSize,
|
|
30
|
-
blockSize: propBlockSize,
|
|
31
|
-
onInlineSizeChange,
|
|
32
|
-
onBlockSizeChange,
|
|
33
|
-
}: ExtrinsicCardContainerProps) => {
|
|
34
|
-
const [inlineSize = DEFAULT_INLINE_SIZE, setInlineSize] = useControllableState<Size>({
|
|
35
|
-
prop: propInlineSize,
|
|
36
|
-
defaultProp: defaultInlineSize,
|
|
37
|
-
onChange: onInlineSizeChange,
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
const [blockSize = DEFAULT_BLOCK_SIZE, setBlockSize] = useControllableState<Size>({
|
|
41
|
-
prop: propBlockSize,
|
|
42
|
-
defaultProp: defaultBlockSize,
|
|
43
|
-
onChange: onBlockSizeChange,
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
return (
|
|
47
|
-
<div
|
|
48
|
-
className='grid relative border border-dashed border-subduedSeparator p-4 rounded-lg overflow-hidden contain-layout'
|
|
49
|
-
style={{
|
|
50
|
-
...sizeStyle(inlineSize, 'horizontal'),
|
|
51
|
-
...sizeStyle(blockSize, 'vertical'),
|
|
52
|
-
}}
|
|
53
|
-
{...resizeAttributes}
|
|
54
|
-
>
|
|
55
|
-
{children}
|
|
56
|
-
<ResizeHandle
|
|
57
|
-
side='inline-end'
|
|
58
|
-
fallbackSize={DEFAULT_INLINE_SIZE}
|
|
59
|
-
minSize={MIN_INLINE_SIZE}
|
|
60
|
-
size={inlineSize}
|
|
61
|
-
onSizeChange={setInlineSize}
|
|
62
|
-
/>
|
|
63
|
-
<ResizeHandle
|
|
64
|
-
side='block-end'
|
|
65
|
-
fallbackSize={DEFAULT_BLOCK_SIZE}
|
|
66
|
-
minSize={MIN_BLOCK_SIZE}
|
|
67
|
-
size={blockSize}
|
|
68
|
-
onSizeChange={setBlockSize}
|
|
69
|
-
/>
|
|
70
|
-
</div>
|
|
71
|
-
);
|
|
72
|
-
};
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { useControllableState } from '@radix-ui/react-use-controllable-state';
|
|
6
|
-
import React, { type PropsWithChildren } from 'react';
|
|
7
|
-
|
|
8
|
-
import { ResizeHandle, type Size, resizeAttributes, sizeStyle } from '@dxos/react-ui-dnd';
|
|
9
|
-
|
|
10
|
-
// Default size in rem
|
|
11
|
-
const DEFAULT_SIZE = 24;
|
|
12
|
-
const MIN_SIZE = 8;
|
|
13
|
-
|
|
14
|
-
export type IntrinsicCardContainerProps = PropsWithChildren<{
|
|
15
|
-
defaultSize?: Size;
|
|
16
|
-
size?: Size;
|
|
17
|
-
onSizeChange?: (size: Size, commit?: boolean) => void;
|
|
18
|
-
}>;
|
|
19
|
-
|
|
20
|
-
export const IntrinsicCardContainer = ({
|
|
21
|
-
children,
|
|
22
|
-
defaultSize,
|
|
23
|
-
size: propSize,
|
|
24
|
-
onSizeChange,
|
|
25
|
-
}: IntrinsicCardContainerProps) => {
|
|
26
|
-
const [size = DEFAULT_SIZE, setSize] = useControllableState<Size>({
|
|
27
|
-
prop: propSize,
|
|
28
|
-
defaultProp: defaultSize,
|
|
29
|
-
onChange: onSizeChange,
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
return (
|
|
33
|
-
<div
|
|
34
|
-
className='relative border border-dashed border-subduedSeparator p-4 rounded-lg'
|
|
35
|
-
style={sizeStyle(size, 'horizontal')}
|
|
36
|
-
{...resizeAttributes}
|
|
37
|
-
>
|
|
38
|
-
{children}
|
|
39
|
-
<ResizeHandle
|
|
40
|
-
side='inline-end'
|
|
41
|
-
fallbackSize={DEFAULT_SIZE}
|
|
42
|
-
minSize={MIN_SIZE}
|
|
43
|
-
size={size}
|
|
44
|
-
onSizeChange={setSize}
|
|
45
|
-
/>
|
|
46
|
-
</div>
|
|
47
|
-
);
|
|
48
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React, { type PropsWithChildren } from 'react';
|
|
6
|
-
|
|
7
|
-
import { Icon, Popover } from '@dxos/react-ui';
|
|
8
|
-
|
|
9
|
-
export const PopoverCardContainer = ({
|
|
10
|
-
children,
|
|
11
|
-
icon = 'ph--placeholder--regular',
|
|
12
|
-
}: PropsWithChildren<{ icon: string }>) => {
|
|
13
|
-
return (
|
|
14
|
-
<Popover.Root open>
|
|
15
|
-
<Popover.Content onOpenAutoFocus={(event) => event.preventDefault()}>
|
|
16
|
-
<Popover.Viewport>{children}</Popover.Viewport>
|
|
17
|
-
<Popover.Arrow />
|
|
18
|
-
</Popover.Content>
|
|
19
|
-
<Popover.Trigger>
|
|
20
|
-
<Icon icon={icon} size={5} />
|
|
21
|
-
</Popover.Trigger>
|
|
22
|
-
</Popover.Root>
|
|
23
|
-
);
|
|
24
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React, { memo } from 'react';
|
|
6
|
-
|
|
7
|
-
import { DxThemeEditor as NaturalDxThemeEditor } from '@dxos/lit-theme-editor';
|
|
8
|
-
import { createComponent } from '@dxos/lit-ui/react';
|
|
9
|
-
|
|
10
|
-
import '@dxos/lit-theme-editor/dx-theme-editor.pcss';
|
|
11
|
-
|
|
12
|
-
const DxThemeEditor = createComponent({
|
|
13
|
-
tagName: 'dx-theme-editor',
|
|
14
|
-
elementClass: NaturalDxThemeEditor,
|
|
15
|
-
react: React,
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
export const ThemeEditor = memo(DxThemeEditor);
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { type Decorator } from '@storybook/react';
|
|
6
|
-
import React, { memo } from 'react';
|
|
7
|
-
|
|
8
|
-
import { ThemeEditor } from '../components/ThemeEditor';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Show theme editor.
|
|
12
|
-
*/
|
|
13
|
-
// TODO(burdon): Ideally move to storybook-addon-theme, but this has a build issue since the addon would depend on the vite theme plugin.
|
|
14
|
-
export const withThemeEditor: Decorator = (Story, context) => {
|
|
15
|
-
// Prevent re-rendering of the story.
|
|
16
|
-
const MemoizedStory = memo(Story);
|
|
17
|
-
|
|
18
|
-
return (
|
|
19
|
-
<>
|
|
20
|
-
<MemoizedStory />
|
|
21
|
-
<div className='absolute top-4 bottom-4 right-4 z-10'>
|
|
22
|
-
<div className='bs-full is-[35rem] overflow-auto bg-baseSurface border border-separator rounded'>
|
|
23
|
-
<ThemeEditor />
|
|
24
|
-
</div>
|
|
25
|
-
</div>
|
|
26
|
-
</>
|
|
27
|
-
);
|
|
28
|
-
};
|
package/src/util.tsx
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2024 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React, { type FC } from 'react';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Story renderer wrapper.
|
|
9
|
-
*/
|
|
10
|
-
export const render =
|
|
11
|
-
<T extends Record<string, any>>(Story: FC<T>) =>
|
|
12
|
-
(args: unknown) => {
|
|
13
|
-
const result = <Story {...(args as T)} />;
|
|
14
|
-
return result ?? <div />;
|
|
15
|
-
};
|