@pega/cosmos-react-demos 4.2.6 → 4.3.1
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/jsx/core/File/FileInput.stories.d.ts +1 -0
- package/jsx/core/File/FileInput.stories.d.ts.map +1 -1
- package/jsx/core/File/FileInput.stories.jsx +25 -4
- package/jsx/core/File/FileInput.stories.jsx.map +1 -1
- package/jsx/core/ListToolbar/ListToolbar.stories.d.ts +1 -0
- package/jsx/core/ListToolbar/ListToolbar.stories.d.ts.map +1 -1
- package/jsx/core/ListToolbar/ListToolbar.stories.jsx +28 -4
- package/jsx/core/ListToolbar/ListToolbar.stories.jsx.map +1 -1
- package/jsx/core/Slider/Slider.stories.d.ts +1 -0
- package/jsx/core/Slider/Slider.stories.d.ts.map +1 -1
- package/jsx/core/Slider/Slider.stories.jsx +25 -4
- package/jsx/core/Slider/Slider.stories.jsx.map +1 -1
- package/jsx/rte/Editor/Editor.stories.d.ts +4 -1
- package/jsx/rte/Editor/Editor.stories.d.ts.map +1 -1
- package/jsx/rte/Editor/Editor.stories.jsx +28 -3
- package/jsx/rte/Editor/Editor.stories.jsx.map +1 -1
- package/jsx/work/Details/Details.stories.d.ts +2 -0
- package/jsx/work/Details/Details.stories.d.ts.map +1 -1
- package/jsx/work/Details/Details.stories.jsx +28 -5
- package/jsx/work/Details/Details.stories.jsx.map +1 -1
- package/lib/core/File/FileInput.stories.d.ts +1 -0
- package/lib/core/File/FileInput.stories.d.ts.map +1 -1
- package/lib/core/File/FileInput.stories.js +12 -5
- package/lib/core/File/FileInput.stories.js.map +1 -1
- package/lib/core/ListToolbar/ListToolbar.stories.d.ts +1 -0
- package/lib/core/ListToolbar/ListToolbar.stories.d.ts.map +1 -1
- package/lib/core/ListToolbar/ListToolbar.stories.js +15 -5
- package/lib/core/ListToolbar/ListToolbar.stories.js.map +1 -1
- package/lib/core/Slider/Slider.stories.d.ts +1 -0
- package/lib/core/Slider/Slider.stories.d.ts.map +1 -1
- package/lib/core/Slider/Slider.stories.js +12 -5
- package/lib/core/Slider/Slider.stories.js.map +1 -1
- package/lib/rte/Editor/Editor.stories.d.ts +4 -1
- package/lib/rte/Editor/Editor.stories.d.ts.map +1 -1
- package/lib/rte/Editor/Editor.stories.js +14 -3
- package/lib/rte/Editor/Editor.stories.js.map +1 -1
- package/lib/work/Details/Details.stories.d.ts +2 -0
- package/lib/work/Details/Details.stories.d.ts.map +1 -1
- package/lib/work/Details/Details.stories.js +14 -5
- package/lib/work/Details/Details.stories.js.map +1 -1
- package/package.json +9 -9
|
@@ -4,6 +4,7 @@ declare const _default: import("@storybook/types").ComponentAnnotations<import("
|
|
|
4
4
|
export default _default;
|
|
5
5
|
interface FileInputStoryProps extends FileInputProps {
|
|
6
6
|
sizeLimit?: number;
|
|
7
|
+
showAdditionalInfo?: boolean;
|
|
7
8
|
}
|
|
8
9
|
export declare const FileInputDemo: StoryFn<FileInputStoryProps>;
|
|
9
10
|
//# sourceMappingURL=FileInput.stories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileInput.stories.d.ts","sourceRoot":"","sources":["../../../src/core/File/FileInput.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAItD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;;AAI9D,wBAGU;AAEV,UAAU,mBAAoB,SAAQ,cAAc;IAClD,SAAS,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"FileInput.stories.d.ts","sourceRoot":"","sources":["../../../src/core/File/FileInput.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAItD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;;AAI9D,wBAGU;AAEV,UAAU,mBAAoB,SAAQ,cAAc;IAClD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAED,eAAO,MAAM,aAAa,EAAE,OAAO,CAAC,mBAAmB,CAuGtD,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useState, useMemo, useCallback, useRef, useContext } from 'react';
|
|
2
|
-
import { FileInput, createUID, useAfterInitialEffect } from '@pega/cosmos-react-core';
|
|
2
|
+
import { FileInput, createUID, useAfterInitialEffect, Flex, Link } from '@pega/cosmos-react-core';
|
|
3
3
|
import { FileServiceContext } from '../../work/CaseView/FileService.mock';
|
|
4
4
|
export default {
|
|
5
5
|
title: 'Core/File/Input',
|
|
@@ -55,7 +55,26 @@ export const FileInputDemo = (args) => {
|
|
|
55
55
|
}
|
|
56
56
|
};
|
|
57
57
|
return file;
|
|
58
|
-
})}
|
|
58
|
+
})} additionalInfo={args.showAdditionalInfo
|
|
59
|
+
? {
|
|
60
|
+
heading: 'Additional Info',
|
|
61
|
+
content: (<Flex container={{ direction: 'column', alignItems: 'start', gap: 2 }}>
|
|
62
|
+
<p>
|
|
63
|
+
Lorem ipsum dolor sit amet, consectetur it, sed do tempor incididunt ut labore
|
|
64
|
+
magna aliqua. Nibh praesent tristique magna sit amet. Nec tincidunt praesent
|
|
65
|
+
semper feugiat nibh sed pulvinar proin gravida.
|
|
66
|
+
</p>
|
|
67
|
+
<p>
|
|
68
|
+
Pharetra pharetra massa massa ultricies mi quis hendrerit dolor. Est velit
|
|
69
|
+
egestas dui id ornare arcu odio ut. Varius sit amet mattis vulputate enim nulla
|
|
70
|
+
aliquet porttitor lacus.
|
|
71
|
+
</p>
|
|
72
|
+
<Link href='/' target='_blank'>
|
|
73
|
+
Neque vitae
|
|
74
|
+
</Link>
|
|
75
|
+
</Flex>)
|
|
76
|
+
}
|
|
77
|
+
: undefined}/>);
|
|
59
78
|
};
|
|
60
79
|
FileInputDemo.args = {
|
|
61
80
|
multiple: true,
|
|
@@ -63,7 +82,8 @@ FileInputDemo.args = {
|
|
|
63
82
|
label: 'File input label',
|
|
64
83
|
labelHidden: false,
|
|
65
84
|
required: false,
|
|
66
|
-
disabled: false
|
|
85
|
+
disabled: false,
|
|
86
|
+
showAdditionalInfo: false
|
|
67
87
|
};
|
|
68
88
|
FileInputDemo.argTypes = {
|
|
69
89
|
multiple: { control: { type: 'boolean' } },
|
|
@@ -71,6 +91,7 @@ FileInputDemo.argTypes = {
|
|
|
71
91
|
label: { control: { type: 'text' } },
|
|
72
92
|
labelHidden: { control: { type: 'boolean' } },
|
|
73
93
|
required: { control: { type: 'boolean' } },
|
|
74
|
-
disabled: { control: { type: 'boolean' } }
|
|
94
|
+
disabled: { control: { type: 'boolean' } },
|
|
95
|
+
showAdditionalInfo: { control: { type: 'boolean' } }
|
|
75
96
|
};
|
|
76
97
|
//# sourceMappingURL=FileInput.stories.jsx.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileInput.stories.jsx","sourceRoot":"","sources":["../../../src/core/File/FileInput.stories.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAE3E,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"FileInput.stories.jsx","sourceRoot":"","sources":["../../../src/core/File/FileInput.stories.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAE3E,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,qBAAqB,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAGlG,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAE1E,eAAe;IACb,KAAK,EAAE,iBAAiB;IACxB,SAAS,EAAE,SAA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AE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE;IACpC,WAAW,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE;IAC7C,QAAQ,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE;IAC1C,QAAQ,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE;IAC1C,kBAAkB,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE;CACrD,CAAC","sourcesContent":["import type { Meta, StoryFn } from '@storybook/react';\nimport { useState, useMemo, useCallback, useRef, useContext } from 'react';\n\nimport { FileInput, createUID, useAfterInitialEffect, Flex, Link } from '@pega/cosmos-react-core';\nimport type { FileInputProps } from '@pega/cosmos-react-core';\n\nimport { FileServiceContext } from '../../work/CaseView/FileService.mock';\n\nexport default {\n title: 'Core/File/Input',\n component: FileInput\n} as Meta;\n\ninterface FileInputStoryProps extends FileInputProps {\n sizeLimit?: number;\n showAdditionalInfo?: boolean;\n}\n\nexport const FileInputDemo: StoryFn<FileInputStoryProps> = (args: FileInputStoryProps) => {\n const { files, attachFile, cancelFile, deleteFile } = useContext(FileServiceContext);\n const errCounts = useRef({ invalidType: 0, invalidSize: 0 });\n const [hasError, setHasError] = useState(false);\n\n const sizeLimit = args.sizeLimit || 100;\n\n // Fires anytime files are added to the input either through selection or drop\n const onFilesAdded = useCallback(\n (addedFiles: File[]) => {\n errCounts.current = { invalidType: 0, invalidSize: 0 };\n\n const newFiles = addedFiles.filter(f => {\n let isValidSize = true;\n\n if (f.size / 1000000 > sizeLimit) {\n errCounts.current.invalidSize += 1;\n isValidSize = false;\n }\n\n return isValidSize;\n });\n\n setHasError(newFiles.length < addedFiles.length);\n\n newFiles.forEach((File: File) => {\n const id = createUID();\n attachFile({\n id,\n thumbnail: File.type.startsWith('image') ? URL.createObjectURL(File) : undefined,\n name: File.name,\n category: '',\n File,\n onCancel: () => {\n cancelFile(id);\n }\n });\n });\n },\n [attachFile, deleteFile]\n );\n\n useAfterInitialEffect(() => {\n if (files.length === 0) setHasError(false);\n }, [files.length]);\n\n const info = useMemo(() => {\n return hasError\n ? errCounts.current.invalidSize > 0 && (\n <div>{`File size must be less than ${sizeLimit}MB`}</div>\n )\n : null;\n }, [hasError]);\n\n return (\n <FileInput\n label={args.label}\n labelHidden={args.labelHidden}\n multiple={args.multiple}\n status={hasError ? 'error' : undefined}\n info={info}\n required={args.required}\n disabled={args.disabled}\n onFilesAdded={onFilesAdded}\n files={files.map(file => {\n return {\n ...file,\n onCancel: undefined,\n onPreview: () => {},\n onDownload: () => {},\n onDelete: () => {\n deleteFile(file.id);\n }\n };\n\n return file;\n })}\n additionalInfo={\n args.showAdditionalInfo\n ? {\n heading: 'Additional Info',\n content: (\n <Flex container={{ direction: 'column', alignItems: 'start', gap: 2 }}>\n <p>\n Lorem ipsum dolor sit amet, consectetur it, sed do tempor incididunt ut labore\n magna aliqua. Nibh praesent tristique magna sit amet. Nec tincidunt praesent\n semper feugiat nibh sed pulvinar proin gravida.\n </p>\n <p>\n Pharetra pharetra massa massa ultricies mi quis hendrerit dolor. Est velit\n egestas dui id ornare arcu odio ut. Varius sit amet mattis vulputate enim nulla\n aliquet porttitor lacus.\n </p>\n <Link href='/' target='_blank'>\n Neque vitae\n </Link>\n </Flex>\n )\n }\n : undefined\n }\n />\n );\n};\n\nFileInputDemo.args = {\n multiple: true,\n sizeLimit: 100,\n label: 'File input label',\n labelHidden: false,\n required: false,\n disabled: false,\n showAdditionalInfo: false\n};\n\nFileInputDemo.argTypes = {\n multiple: { control: { type: 'boolean' } },\n sizeLimit: { control: { type: 'number' } },\n label: { control: { type: 'text' } },\n labelHidden: { control: { type: 'boolean' } },\n required: { control: { type: 'boolean' } },\n disabled: { control: { type: 'boolean' } },\n showAdditionalInfo: { control: { type: 'boolean' } }\n};\n"]}
|
|
@@ -5,6 +5,7 @@ export default _default;
|
|
|
5
5
|
interface ListToolbarStoryProps {
|
|
6
6
|
createNewLabel: string;
|
|
7
7
|
required: FormControlProps['required'];
|
|
8
|
+
showAdditionalInfo?: boolean;
|
|
8
9
|
}
|
|
9
10
|
export declare const ListToolbarDemo: StoryFn<ListToolbarStoryProps>;
|
|
10
11
|
export declare const SimpleToolbarDemo: StoryFn;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListToolbar.stories.d.ts","sourceRoot":"","sources":["../../../src/core/ListToolbar/ListToolbar.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,OAAO,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"ListToolbar.stories.d.ts","sourceRoot":"","sources":["../../../src/core/ListToolbar/ListToolbar.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAWtD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;;AAWhE,wBAGU;AAIV,UAAU,qBAAqB;IAC7B,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,gBAAgB,CAAC,UAAU,CAAC,CAAC;IACvC,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAED,eAAO,MAAM,eAAe,EAAE,OAAO,CAAC,qBAAqB,CAuH1D,CAAC;AAcF,eAAO,MAAM,iBAAiB,EAAE,OAU/B,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useMemo, useState } from 'react';
|
|
2
2
|
import { action } from '@storybook/addon-actions';
|
|
3
|
-
import { ListToolbar, MenuButton, listToolbarHelpers as helpers } from '@pega/cosmos-react-core';
|
|
3
|
+
import { Flex, Link, ListToolbar, MenuButton, listToolbarHelpers as helpers } from '@pega/cosmos-react-core';
|
|
4
4
|
import { mockViews, actions, FilterRenderer, StagedStateDispatchContext, GroupRenderer } from './ListToolbar.mocks';
|
|
5
5
|
export default {
|
|
6
6
|
title: 'Core/ListToolbar',
|
|
@@ -80,16 +80,40 @@ export const ListToolbarDemo = (args) => {
|
|
|
80
80
|
}} count={{
|
|
81
81
|
total: 1146,
|
|
82
82
|
selected: 4
|
|
83
|
-
}} filter={filterProp} sort={sortProp} group={groupProp} actions={actions} additionalActions={<MenuButton text='Edit'/>} formControlProps={{
|
|
83
|
+
}} filter={filterProp} sort={sortProp} group={groupProp} actions={actions} additionalActions={<MenuButton text='Edit'/>} formControlProps={{
|
|
84
|
+
required: args.required,
|
|
85
|
+
additionalInfo: args.showAdditionalInfo
|
|
86
|
+
? {
|
|
87
|
+
heading: 'Additional Info',
|
|
88
|
+
content: (<Flex container={{ direction: 'column', alignItems: 'start', gap: 2 }}>
|
|
89
|
+
<p>
|
|
90
|
+
Lorem ipsum dolor sit amet, consectetur it, sed do tempor incididunt ut labore
|
|
91
|
+
magna aliqua. Nibh praesent tristique magna sit amet. Nec tincidunt praesent
|
|
92
|
+
semper feugiat nibh sed pulvinar proin gravida.
|
|
93
|
+
</p>
|
|
94
|
+
<p>
|
|
95
|
+
Pharetra pharetra massa massa ultricies mi quis hendrerit dolor. Est velit
|
|
96
|
+
egestas dui id ornare arcu odio ut. Varius sit amet mattis vulputate enim
|
|
97
|
+
nulla aliquet porttitor lacus.
|
|
98
|
+
</p>
|
|
99
|
+
<Link href='/' target='_blank'>
|
|
100
|
+
Neque vitae
|
|
101
|
+
</Link>
|
|
102
|
+
</Flex>)
|
|
103
|
+
}
|
|
104
|
+
: undefined
|
|
105
|
+
}}/>
|
|
84
106
|
</StagedStateDispatchContext.Provider>);
|
|
85
107
|
};
|
|
86
108
|
ListToolbarDemo.args = {
|
|
87
109
|
createNewLabel: undefined,
|
|
88
|
-
required: false
|
|
110
|
+
required: false,
|
|
111
|
+
showAdditionalInfo: false
|
|
89
112
|
};
|
|
90
113
|
ListToolbarDemo.argTypes = {
|
|
91
114
|
createNewLabel: { control: { type: 'text' } },
|
|
92
|
-
required: { control: { type: 'boolean' } }
|
|
115
|
+
required: { control: { type: 'boolean' } },
|
|
116
|
+
showAdditionalInfo: { control: { type: 'boolean' } }
|
|
93
117
|
};
|
|
94
118
|
export const SimpleToolbarDemo = () => {
|
|
95
119
|
return (<ListToolbar name='Top accounts in California' search={{ onSearchSubmit: action('Search submit') }} count={{ total: 212, totalHasMore: true }} actions={actions} formControlProps={{ required: true }}/>);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListToolbar.stories.jsx","sourceRoot":"","sources":["../../../src/core/ListToolbar/ListToolbar.stories.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAElD,OAAO,
|
|
1
|
+
{"version":3,"file":"ListToolbar.stories.jsx","sourceRoot":"","sources":["../../../src/core/ListToolbar/ListToolbar.stories.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAElD,OAAO,EACL,IAAI,EACJ,IAAI,EACJ,WAAW,EACX,UAAU,EACV,kBAAkB,IAAI,OAAO,EAC9B,MAAM,yBAAyB,CAAC;AAIjC,OAAO,EACL,SAAS,EACT,OAAO,EACP,cAAc,EACd,0BAA0B,EAC1B,aAAa,EACd,MAAM,qBAAqB,CAAC;AAE7B,eAAe;IACb,KAAK,EAAE,kBAAkB;IACzB,SAAS,EAAE,WAAW;CACf,CAAC;AAUV,MAAM,CAAC,MAAM,eAAe,GAAmC,CAAC,IAA2B,EAAE,EAAE;IAC7F,MAAM,CAAC,sBAAsB,EAAE,yBAAyB,CAAC,GAAG,QAAQ,CAAgB,IAAI,CAAC,CAAC;IAC1F,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC;IAC9C,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AE,CAAC,CACpD,KAAK,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,CAC1C,OAAO,CAAC,CAAC,OAAO,CAAC,CACjB,gBAAgB,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,EACrC,CACH,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import type { Meta, StoryFn } from '@storybook/react';\nimport { useMemo, useState } from 'react';\nimport { action } from '@storybook/addon-actions';\n\nimport {\n Flex,\n Link,\n ListToolbar,\n MenuButton,\n listToolbarHelpers as helpers\n} from '@pega/cosmos-react-core';\nimport type { FormControlProps } from '@pega/cosmos-react-core';\nimport type { PresetMenuProps } from '@pega/cosmos-react-core/lib/components/ListToolbar/ListToolbar.types';\n\nimport {\n mockViews,\n actions,\n FilterRenderer,\n StagedStateDispatchContext,\n GroupRenderer\n} from './ListToolbar.mocks';\n\nexport default {\n title: 'Core/ListToolbar',\n component: ListToolbar\n} as Meta;\n\ntype SortString = 'asc' | 'desc';\n\ninterface ListToolbarStoryProps {\n createNewLabel: string;\n required: FormControlProps['required'];\n showAdditionalInfo?: boolean;\n}\n\nexport const ListToolbarDemo: StoryFn<ListToolbarStoryProps> = (args: ListToolbarStoryProps) => {\n const [stagedQueryOptionState, setStagedQueryOptionState] = useState<object | null>(null);\n const [views, setViews] = useState(mockViews);\n const [currentSort, setCurrentSort] = useState<SortString | null>(null);\n const [searchValue, setSearchValue] = useState('');\n\n const filterProp = useMemo(() => {\n return {\n value: stagedQueryOptionState,\n count: undefined,\n renderer: FilterRenderer,\n onCancel: () => {\n setStagedQueryOptionState(null);\n },\n onSubmit: () => {\n setStagedQueryOptionState(cur => {\n // eslint-disable-next-line no-console\n console.table(cur);\n return null;\n });\n }\n };\n }, [stagedQueryOptionState]);\n\n const sortProp: PresetMenuProps = useMemo(() => {\n return {\n mode: 'single-select',\n count: currentSort ? 1 : undefined,\n items: [\n {\n id: 'asc',\n text: 'Ascending',\n icon: 'arrow-up',\n selected: currentSort === 'asc'\n },\n {\n id: 'desc',\n text: 'Descending',\n icon: 'arrow-down',\n selected: currentSort === 'desc'\n }\n ],\n onItemClick: id => {\n setCurrentSort(cur => {\n return cur === id ? null : (id as SortString);\n });\n }\n };\n }, [currentSort]);\n\n const groupProp = useMemo(() => {\n return {\n count: undefined,\n renderer: GroupRenderer,\n onCancel: () => {},\n onSubmit: () => {}\n };\n }, []);\n\n return (\n <StagedStateDispatchContext.Provider value={setStagedQueryOptionState}>\n <ListToolbar\n name='Contacts'\n viewSelector={{\n views,\n onViewSelect: id => {\n setViews(cur => {\n return helpers.selectView(cur, id);\n });\n },\n defaultId: '1',\n appDefaultId: '2'\n }}\n createNew={{\n onClick: action('Clicked Create New'),\n label: args.createNewLabel\n }}\n search={{\n onSearchSubmit: action('Search submit'),\n value: searchValue,\n onSearchChange: setSearchValue\n }}\n count={{\n total: 1146,\n selected: 4\n }}\n filter={filterProp}\n sort={sortProp}\n group={groupProp}\n actions={actions}\n additionalActions={<MenuButton text='Edit' />}\n formControlProps={{\n required: args.required,\n additionalInfo: args.showAdditionalInfo\n ? {\n heading: 'Additional Info',\n content: (\n <Flex container={{ direction: 'column', alignItems: 'start', gap: 2 }}>\n <p>\n Lorem ipsum dolor sit amet, consectetur it, sed do tempor incididunt ut labore\n magna aliqua. Nibh praesent tristique magna sit amet. Nec tincidunt praesent\n semper feugiat nibh sed pulvinar proin gravida.\n </p>\n <p>\n Pharetra pharetra massa massa ultricies mi quis hendrerit dolor. Est velit\n egestas dui id ornare arcu odio ut. Varius sit amet mattis vulputate enim\n nulla aliquet porttitor lacus.\n </p>\n <Link href='/' target='_blank'>\n Neque vitae\n </Link>\n </Flex>\n )\n }\n : undefined\n }}\n />\n </StagedStateDispatchContext.Provider>\n );\n};\n\nListToolbarDemo.args = {\n createNewLabel: undefined,\n required: false,\n showAdditionalInfo: false\n};\n\nListToolbarDemo.argTypes = {\n createNewLabel: { control: { type: 'text' } },\n required: { control: { type: 'boolean' } },\n showAdditionalInfo: { control: { type: 'boolean' } }\n};\n\nexport const SimpleToolbarDemo: StoryFn = () => {\n return (\n <ListToolbar\n name='Top accounts in California'\n search={{ onSearchSubmit: action('Search submit') }}\n count={{ total: 212, totalHasMore: true }}\n actions={actions}\n formControlProps={{ required: true }}\n />\n );\n};\n"]}
|
|
@@ -7,6 +7,7 @@ type SliderStoryProps = OmitStrict<SliderProps, 'value' | 'onChange'> & {
|
|
|
7
7
|
max: number;
|
|
8
8
|
step: number;
|
|
9
9
|
value?: SliderProps['value'];
|
|
10
|
+
showAdditionalInfo?: boolean;
|
|
10
11
|
};
|
|
11
12
|
export declare const SliderDemo: StoryFn<SliderStoryProps>;
|
|
12
13
|
//# sourceMappingURL=Slider.stories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Slider.stories.d.ts","sourceRoot":"","sources":["../../../src/core/Slider/Slider.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAItD,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;;AAEvE,wBAGU;AAGV,KAAK,gBAAgB,GAAG,UAAU,CAAC,WAAW,EAAE,OAAO,GAAG,UAAU,CAAC,GAAG;IACtE,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;CAC9B,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,OAAO,CAAC,gBAAgB,
|
|
1
|
+
{"version":3,"file":"Slider.stories.d.ts","sourceRoot":"","sources":["../../../src/core/Slider/Slider.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAItD,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;;AAEvE,wBAGU;AAGV,KAAK,gBAAgB,GAAG,UAAU,CAAC,WAAW,EAAE,OAAO,GAAG,UAAU,CAAC,GAAG;IACtE,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;IAC7B,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,OAAO,CAAC,gBAAgB,CA4DhD,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
|
-
import { Slider } from '@pega/cosmos-react-core';
|
|
2
|
+
import { Flex, Link, Slider } from '@pega/cosmos-react-core';
|
|
3
3
|
export default {
|
|
4
4
|
title: 'Core/Slider',
|
|
5
5
|
component: Slider
|
|
@@ -17,7 +17,26 @@ export const SliderDemo = (args) => {
|
|
|
17
17
|
ticksObject[tick] = tick.toString();
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
|
-
return (<Slider orientation={args.orientation} step={args.step} min={args.min} max={args.max} ticks={ticksObject} showProgress={args.showProgress} preview={args.preview} showInput={args.showInput} label={args.label} labelHidden={args.labelHidden} info={args.info} status={args.status} required={args.required} disabled={args.disabled} readOnly={args.readOnly} value={value} onChange={(changeValue) => setValue(changeValue)}
|
|
20
|
+
return (<Slider orientation={args.orientation} step={args.step} min={args.min} max={args.max} ticks={ticksObject} showProgress={args.showProgress} preview={args.preview} showInput={args.showInput} label={args.label} labelHidden={args.labelHidden} info={args.info} status={args.status} required={args.required} disabled={args.disabled} readOnly={args.readOnly} value={value} onChange={(changeValue) => setValue(changeValue)} additionalInfo={args.showAdditionalInfo
|
|
21
|
+
? {
|
|
22
|
+
heading: 'Additional Info',
|
|
23
|
+
content: (<Flex container={{ direction: 'column', alignItems: 'start', gap: 2 }}>
|
|
24
|
+
<p>
|
|
25
|
+
Lorem ipsum dolor sit amet, consectetur it, sed do tempor incididunt ut labore
|
|
26
|
+
magna aliqua. Nibh praesent tristique magna sit amet. Nec tincidunt praesent
|
|
27
|
+
semper feugiat nibh sed pulvinar proin gravida.
|
|
28
|
+
</p>
|
|
29
|
+
<p>
|
|
30
|
+
Pharetra pharetra massa massa ultricies mi quis hendrerit dolor. Est velit
|
|
31
|
+
egestas dui id ornare arcu odio ut. Varius sit amet mattis vulputate enim nulla
|
|
32
|
+
aliquet porttitor lacus.
|
|
33
|
+
</p>
|
|
34
|
+
<Link href='/' target='_blank'>
|
|
35
|
+
Neque vitae
|
|
36
|
+
</Link>
|
|
37
|
+
</Flex>)
|
|
38
|
+
}
|
|
39
|
+
: undefined}/>);
|
|
21
40
|
};
|
|
22
41
|
SliderDemo.args = {
|
|
23
42
|
orientation: 'vertical',
|
|
@@ -35,7 +54,8 @@ SliderDemo.args = {
|
|
|
35
54
|
status: undefined,
|
|
36
55
|
required: false,
|
|
37
56
|
disabled: false,
|
|
38
|
-
readOnly: false
|
|
57
|
+
readOnly: false,
|
|
58
|
+
showAdditionalInfo: false
|
|
39
59
|
};
|
|
40
60
|
SliderDemo.argTypes = {
|
|
41
61
|
orientation: { options: ['vertical', 'horizontal'], control: { type: 'inline-radio' } },
|
|
@@ -53,6 +73,7 @@ SliderDemo.argTypes = {
|
|
|
53
73
|
status: { options: [undefined, 'success', 'warning', 'error'], control: { type: 'select' } },
|
|
54
74
|
required: { control: { type: 'boolean' } },
|
|
55
75
|
disabled: { control: { type: 'boolean' } },
|
|
56
|
-
readOnly: { control: { type: 'boolean' } }
|
|
76
|
+
readOnly: { control: { type: 'boolean' } },
|
|
77
|
+
showAdditionalInfo: { control: { type: 'boolean' } }
|
|
57
78
|
};
|
|
58
79
|
//# sourceMappingURL=Slider.stories.jsx.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Slider.stories.jsx","sourceRoot":"","sources":["../../../src/core/Slider/Slider.stories.tsx"],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,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE;IACzC,SAAS,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE;IAC3C,KAAK,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE;IACpC,WAAW,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE;IAC7C,IAAI,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,EAAE;IACzD,MAAM,EAAE,EAAE,OAAO,EAAE,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE;IAC5F,QAAQ,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE;IAC1C,QAAQ,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE;IAC1C,QAAQ,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE;IAC1C,kBAAkB,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE;CACrD,CAAC","sourcesContent":["import type { Meta, StoryFn } from '@storybook/react';\nimport { useState } from 'react';\n\nimport { Flex, Link, Slider } from '@pega/cosmos-react-core';\nimport type { SliderProps, OmitStrict } from '@pega/cosmos-react-core';\n\nexport default {\n title: 'Core/Slider',\n component: Slider\n} as Meta;\n\n// Necessary to prevent linting undefined errors since these will never be undefined in the demo\ntype SliderStoryProps = OmitStrict<SliderProps, 'value' | 'onChange'> & {\n min: number;\n max: number;\n step: number;\n value?: SliderProps['value'];\n showAdditionalInfo?: boolean;\n};\n\nexport const SliderDemo: StoryFn<SliderStoryProps> = (args: SliderStoryProps) => {\n const [value, setValue] = useState(args.value || 0);\n let ticksObject: SliderProps['ticks'] = args.ticks;\n\n if (args.max > args.min && !ticksObject) {\n ticksObject = {};\n const numTicks = Math.floor((args.max - args.min) / (args.step || 1)) + 1;\n Array(numTicks)\n .fill(0)\n .map((_, index) => args.min + index * args.step)\n .forEach(tick => {\n ticksObject![tick] = tick.toString();\n });\n }\n\n return (\n <Slider\n orientation={args.orientation}\n step={args.step}\n min={args.min}\n max={args.max}\n ticks={ticksObject}\n showProgress={args.showProgress}\n preview={args.preview}\n showInput={args.showInput}\n label={args.label}\n labelHidden={args.labelHidden}\n info={args.info}\n status={args.status}\n required={args.required}\n disabled={args.disabled}\n readOnly={args.readOnly}\n value={value}\n onChange={(changeValue: number) => setValue(changeValue)}\n additionalInfo={\n args.showAdditionalInfo\n ? {\n heading: 'Additional Info',\n content: (\n <Flex container={{ direction: 'column', alignItems: 'start', gap: 2 }}>\n <p>\n Lorem ipsum dolor sit amet, consectetur it, sed do tempor incididunt ut labore\n magna aliqua. Nibh praesent tristique magna sit amet. Nec tincidunt praesent\n semper feugiat nibh sed pulvinar proin gravida.\n </p>\n <p>\n Pharetra pharetra massa massa ultricies mi quis hendrerit dolor. Est velit\n egestas dui id ornare arcu odio ut. Varius sit amet mattis vulputate enim nulla\n aliquet porttitor lacus.\n </p>\n <Link href='/' target='_blank'>\n Neque vitae\n </Link>\n </Flex>\n )\n }\n : undefined\n }\n />\n );\n};\n\nSliderDemo.args = {\n orientation: 'vertical',\n step: 1,\n min: 0,\n max: 10,\n value: 5,\n ticks: undefined,\n showProgress: true,\n preview: false,\n showInput: true,\n label: 'Slider input',\n labelHidden: false,\n info: 'Pick a value',\n status: undefined,\n required: false,\n disabled: false,\n readOnly: false,\n showAdditionalInfo: false\n};\n\nSliderDemo.argTypes = {\n orientation: { options: ['vertical', 'horizontal'], control: { type: 'inline-radio' } },\n step: { control: { type: 'number' } },\n min: { control: { type: 'number' } },\n max: { control: { type: 'number' } },\n value: { control: { type: 'number' } },\n ticks: { control: { type: 'object' } },\n showProgress: { control: { type: 'boolean' } },\n preview: { control: { type: 'boolean' } },\n showInput: { control: { type: 'boolean' } },\n label: { control: { type: 'text' } },\n labelHidden: { control: { type: 'boolean' } },\n info: { control: { type: 'text', label: 'Helper text' } },\n status: { options: [undefined, 'success', 'warning', 'error'], control: { type: 'select' } },\n required: { control: { type: 'boolean' } },\n disabled: { control: { type: 'boolean' } },\n readOnly: { control: { type: 'boolean' } },\n showAdditionalInfo: { control: { type: 'boolean' } }\n};\n"]}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import type { StoryFn } from '@storybook/react';
|
|
2
2
|
declare const _default: import("@storybook/types").ComponentAnnotations<import("@storybook/react/dist/types-0a347bb9").R, import("@storybook/types").Args>;
|
|
3
3
|
export default _default;
|
|
4
|
-
|
|
4
|
+
type EditorStoryProps = {
|
|
5
|
+
showAdditionalInfo?: boolean;
|
|
6
|
+
};
|
|
7
|
+
export declare const EditorDemo: StoryFn<EditorStoryProps>;
|
|
5
8
|
export declare const EmptyEditorDemo: StoryFn;
|
|
6
9
|
export declare const ReadonlyFormField: StoryFn;
|
|
7
10
|
export declare const CustomComponentDemo: StoryFn;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Editor.stories.d.ts","sourceRoot":"","sources":["../../../src/rte/Editor/Editor.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,OAAO,EAAE,MAAM,kBAAkB,CAAC;;
|
|
1
|
+
{"version":3,"file":"Editor.stories.d.ts","sourceRoot":"","sources":["../../../src/rte/Editor/Editor.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,OAAO,EAAE,MAAM,kBAAkB,CAAC;;AAoBtD,wBAGU;AAEV,KAAK,gBAAgB,GAAG;IACtB,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,OAAO,CAAC,gBAAgB,CA4ChD,CAAC;AAUF,eAAO,MAAM,eAAe,EAAE,OAmB7B,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,OAc/B,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,OA6BjC,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,OAkCpC,CAAC;AAEF,eAAO,MAAM,6BAA6B,EAAE,OA8B3C,CAAC"}
|
|
@@ -1,19 +1,44 @@
|
|
|
1
1
|
import { useState, useRef } from 'react';
|
|
2
2
|
import { action } from '@storybook/addon-actions';
|
|
3
|
-
import { Button, Card, CardContent, CardFooter, Flex, Text, TextArea } from '@pega/cosmos-react-core';
|
|
3
|
+
import { Button, Card, CardContent, CardFooter, Flex, Link, Text, TextArea } from '@pega/cosmos-react-core';
|
|
4
4
|
import { Editor } from '@pega/cosmos-react-rte';
|
|
5
5
|
import { createPegaCustomElement, label } from './Editor.mocks';
|
|
6
6
|
export default {
|
|
7
7
|
title: 'RTE/Editor',
|
|
8
8
|
component: Editor
|
|
9
9
|
};
|
|
10
|
-
export const EditorDemo = () => {
|
|
10
|
+
export const EditorDemo = (args) => {
|
|
11
11
|
const editorRef = useRef(null);
|
|
12
12
|
const onImageAdded = (image, id) => {
|
|
13
13
|
const src = URL.createObjectURL(image);
|
|
14
14
|
editorRef.current?.appendImage({ src, alt: image.name }, id);
|
|
15
15
|
};
|
|
16
|
-
return (<Editor ref={editorRef} label={label} toolbar={['inline-styling', 'lists', 'indentation', 'images', 'links']} onFocus={action('Editor focused')} onBlur={action('Editor blurred')} onChange={action('Editor changed')} onImageAdded={onImageAdded} defaultValue='<body><p>Hi mom <a href="https://google.com">link</a></p><img alt="Example alt text" src="http://via.placeholder.com/640x360"/></body>'
|
|
16
|
+
return (<Editor ref={editorRef} label={label} toolbar={['inline-styling', 'lists', 'indentation', 'images', 'links']} onFocus={action('Editor focused')} onBlur={action('Editor blurred')} onChange={action('Editor changed')} onImageAdded={onImageAdded} defaultValue='<body><p>Hi mom <a href="https://google.com">link</a></p><img alt="Example alt text" src="http://via.placeholder.com/640x360"/></body>' additionalInfo={args.showAdditionalInfo
|
|
17
|
+
? {
|
|
18
|
+
heading: 'Additional Info',
|
|
19
|
+
content: (<Flex container={{ direction: 'column', alignItems: 'start', gap: 2 }}>
|
|
20
|
+
<p>
|
|
21
|
+
Lorem ipsum dolor sit amet, consectetur it, sed do tempor incididunt ut labore
|
|
22
|
+
magna aliqua. Nibh praesent tristique magna sit amet. Nec tincidunt praesent
|
|
23
|
+
semper feugiat nibh sed pulvinar proin gravida.
|
|
24
|
+
</p>
|
|
25
|
+
<p>
|
|
26
|
+
Pharetra pharetra massa massa ultricies mi quis hendrerit dolor. Est velit
|
|
27
|
+
egestas dui id ornare arcu odio ut. Varius sit amet mattis vulputate enim nulla
|
|
28
|
+
aliquet porttitor lacus.
|
|
29
|
+
</p>
|
|
30
|
+
<Link href='/' target='_blank'>
|
|
31
|
+
Neque vitae
|
|
32
|
+
</Link>
|
|
33
|
+
</Flex>)
|
|
34
|
+
}
|
|
35
|
+
: undefined}/>);
|
|
36
|
+
};
|
|
37
|
+
EditorDemo.args = {
|
|
38
|
+
showAdditionalInfo: false
|
|
39
|
+
};
|
|
40
|
+
EditorDemo.argTypes = {
|
|
41
|
+
showAdditionalInfo: { control: { type: 'boolean' } }
|
|
17
42
|
};
|
|
18
43
|
export const EmptyEditorDemo = () => {
|
|
19
44
|
const editorRef = useRef(null);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Editor.stories.jsx","sourceRoot":"","sources":["../../../src/rte/Editor/Editor.stories.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAGlD,OAAO,EACL,MAAM,EACN,IAAI,EACJ,WAAW,EACX,UAAU,EACV,IAAI,EACJ,IAAI,EACJ,QAAQ,EACT,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAGhD,OA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,GAAG,GAAG,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;QACvC,MAAM,CAAC,OAAO,EAAE,WAAW,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;IAC5D,CAAC,CAAC;IAEF,OAAO,CACL,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,CAC/C;MAAA,CAAC,IAAI,CACH;QAAA,CAAC,WAAW,CACV;UAAA,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAChE;QAAA,EAAE,WAAW,CACb;QAAA,CAAC,UAAU,CACT;UAAA,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,IAAI,CAAC,CAAC,CACnE;;UACF,EAAE,MAAM,CACV;QAAA,EAAE,UAAU,CACd;MAAA,EAAE,IAAI,CACN;MAAA,CAAC,MAAM,CACL,YAAY,CAAC,CAAC,IAAI,CAAC,CACnB,YAAY,CAAC,CAAC,YAAY,CAAC,CAC3B,GAAG,CAAC,CAAC,MAAM,CAAC,CACZ,KAAK,CAAC,CAAC,KAAK,CAAC,CACb,OAAO,CAAC,CAAC,CAAC,gBAAgB,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,aAAa,CAAC,CAAC,EAEhG;IAAA,EAAE,IAAI,CAAC,CACR,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import type { Meta, StoryFn } from '@storybook/react';\nimport { useState, useRef } from 'react';\nimport { action } from '@storybook/addon-actions';\nimport type { Editor as TinymceEditor } from 'tinymce';\n\nimport {\n Button,\n Card,\n CardContent,\n CardFooter,\n Flex,\n Text,\n TextArea\n} from '@pega/cosmos-react-core';\nimport { Editor } from '@pega/cosmos-react-rte';\nimport type { EditorState } from '@pega/cosmos-react-rte';\n\nimport { createPegaCustomElement, label } from './Editor.mocks';\n\nexport default {\n title: 'RTE/Editor',\n component: Editor\n} as Meta;\n\nexport const EditorDemo: StoryFn = () => {\n const editorRef = useRef<EditorState>(null);\n\n const onImageAdded = (image: File, id: string) => {\n const src = URL.createObjectURL(image);\n editorRef.current?.appendImage({ src, alt: image.name }, id);\n };\n\n return (\n <Editor\n ref={editorRef}\n label={label}\n toolbar={['inline-styling', 'lists', 'indentation', 'images', 'links']}\n onFocus={action('Editor focused')}\n onBlur={action('Editor blurred')}\n onChange={action('Editor changed')}\n onImageAdded={onImageAdded}\n defaultValue='<body><p>Hi mom <a href=\"https://google.com\">link</a></p><img alt=\"Example alt text\" src=\"http://via.placeholder.com/640x360\"/></body>'\n />\n );\n};\n\nexport const EmptyEditorDemo: StoryFn = () => {\n const editorRef = useRef<EditorState>(null);\n\n const onImageAdded = (image: File, id: string) => {\n const src = URL.createObjectURL(image);\n editorRef.current?.appendImage({ src, alt: image.name }, id);\n };\n\n return (\n <Editor\n ref={editorRef}\n label={label}\n toolbar={['inline-styling', 'lists', 'indentation', 'images', 'links']}\n onImageAdded={onImageAdded}\n onFocus={action('Editor has focus')}\n onBlur={action('Editor has blurred')}\n placeholder='Type some stuff in here'\n />\n );\n};\n\nexport const ReadonlyFormField: StoryFn = () => {\n return (\n <Editor\n label={label}\n readOnly\n defaultValue={`<article class=\"main-page-content\" lang=\"en-US\"><h1>HTML: HyperText Markup Language</h1><div><p><strong>HTML</strong> (HyperText Markup Language) is the most basic building block of the Web. It defines the meaning and structure of web content. Other technologies besides HTML are generally used to describe a web page's appearance/presentation (<a href=\"/en-US/docs/Web/CSS\">CSS</a>) or functionality/behavior (<a href=\"/en-US/docs/Web/JavaScript\">JavaScript</a>).</p>\n <p>\"Hypertext\" refers to links that connect web pages to one another, either within a single website or between websites. Links are a fundamental aspect of the Web. By uploading content to the Internet and linking it to pages created by other people, you become an active participant in the World Wide Web.</p>\n <p>HTML uses \"markup\" to annotate text, images, and other content for display in a Web browser. HTML markup includes special \"elements\" such as <a href=\"/en-US/docs/Web/HTML/Element/head\"><code><head></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/title\"><code><title></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/body\"><code><body></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/header\"><code><header></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/footer\"><code><footer></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/article\"><code><article></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/section\"><code><section></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/p\"><code><p></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/div\"><code><div></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/span\"><code><span></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/img\"><code><img></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/aside\"><code><aside></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/audio\"><code><audio></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/canvas\"><code><canvas></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/datalist\"><code><datalist></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/details\"><code><details></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/embed\"><code><embed></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/nav\"><code><nav></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/output\"><code><output></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/progress\"><code><progress></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/video\"><code><video></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/ul\"><code><ul></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/ol\"><code><ol></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/li\"><code><li></code></a> and many others.</p>\n <p>An HTML element is set off from other text in a document by \"tags\", which consist of the element name surrounded by \"<code><</code>\" and \"<code>></code>\". The name of an element inside a tag is case insensitive. That is, it can be written in uppercase, lowercase, or a mixture. For example, the <code><title></code> tag can be written as <code><Title></code>, <code><TITLE></code>, or in any other way.</p>\n\n <div id=\"on-github\" class=\"on-github\"><h3>Found a problem with this page?</h3><ul><li><a href=\"https://github.com/mdn/content/edit/main/files/en-us/web/html/index.md\" title=\"You're going to need to sign in to GitHub first (Opens in a new tab)\" target=\"_blank\" rel=\"noopener noreferrer\">Edit on <b>GitHub</b></a></li><li><a href=\"https://github.com/mdn/content/blob/main/files/en-us/web/html/index.md\" title=\"Folder: en-us/web/html (Opens in a new tab)\" target=\"_blank\" rel=\"noopener noreferrer\">Source on <b>GitHub</b></a></li><li><a href=\"https://github.com/mdn/content/issues/new?body=MDN+URL%3A+https%3A%2F%2Fdeveloper.mozilla.org%2Fen-US%2Fdocs%2FWeb%2FHTML%0A%0A%23%23%23%23+What+information+was+incorrect%2C+unhelpful%2C+or+incomplete%3F%0A%0A%0A%23%23%23%23+Specific+section+or+headline%3F%0A%0A%0A%23%23%23%23+What+did+you+expect+to+see%3F%0A%0A%0A%23%23%23%23+Did+you+test+this%3F+If+so%2C+how%3F%0A%0A%0A%3C%21--+Do+not+make+changes+below+this+line+--%3E%0A%3Cdetails%3E%0A%3Csummary%3EMDN+Content+page+report+details%3C%2Fsummary%3E%0A%0A*+Folder%3A+%60en-us%2Fweb%2Fhtml%60%0A*+MDN+URL%3A+https%3A%2F%2Fdeveloper.mozilla.org%2Fen-US%2Fdocs%2FWeb%2FHTML%0A*+GitHub+URL%3A+https%3A%2F%2Fgithub.com%2Fmdn%2Fcontent%2Fblob%2Fmain%2Ffiles%2Fen-us%2Fweb%2Fhtml%2Findex.md%0A*+Last+commit%3A+https%3A%2F%2Fgithub.com%2Fmdn%2Fcontent%2Fcommit%2F775662998e66813a612e3ff27e02f2ada867bc17%0A*+Document+last+modified%3A+2021-10-03T00%3A01%3A51.000Z%0A%0A%3C%2Fdetails%3E&title=Issue+with+%22HTML%3A+HyperText+Markup+Language%22%3A+%28short+summary+here+please%29&labels=needs-triage%2CContent%3AHTML\" title=\"This will take you to https://github.com/mdn/content to file a new issue\" target=\"_blank\" rel=\"noopener noreferrer\">Report a problem with this content on <b>GitHub</b></a></li><li>Want to fix the problem yourself? See <a href=\"https://github.com/mdn/content/blob/main/README.md\" target=\"_blank\" rel=\"noopener noreferrer\">our Contribution guide</a>.</li></ul></div>\n `}\n />\n );\n};\n\nexport const CustomComponentDemo: StoryFn = () => {\n const editorRef = useRef<EditorState>(null);\n const [editor, setEditor] = useState({} as TinymceEditor);\n\n const onCustomAction = () => {\n editor.insertContent('<pega-custom>Inserted from toolbar</pega-custom>');\n };\n\n return (\n <Editor\n ref={editorRef}\n label={label}\n toolbar={['inline-styling', 'lists', 'indentation', 'links', 'images']}\n defaultValue='<body><p>Hi mom <a href=\"https://google.com\">link</a></p><p>hi <pega-custom>Hello from custom element.</pega-custom></p></body>'\n customComponents={[{ createCustomElement: createPegaCustomElement, name: 'pega-custom' }]}\n customActions={[\n {\n icon: 'pega',\n text: 'Insert a custom element',\n onMouseDown: () => {\n onCustomAction();\n }\n }\n ]}\n onInit={initializedEditor => {\n setEditor(initializedEditor);\n }}\n />\n );\n};\n\nexport const RichTextEditorWithLogs: StoryFn = () => {\n const editorRef = useRef<EditorState>(null);\n const [content, setContent] = useState<string | undefined>();\n\n const onImageAdded = (image: File, id: string) => {\n const src = URL.createObjectURL(image);\n editorRef.current?.appendImage({ src, alt: image.name }, id);\n };\n\n const showContent = (type: 'html' | 'plain_text' | 'rich_text') => {\n if (type === 'html') setContent(editorRef.current?.getHtml());\n else if (type === 'plain_text') setContent(editorRef.current?.getPlainText());\n else if (type === 'rich_text') setContent(editorRef.current?.getRichText());\n };\n\n return (\n <Flex container={{ direction: 'column', gap: 2 }}>\n <Editor\n ref={editorRef}\n toolbar={['inline-styling', 'headers', 'tables', 'links', 'images', 'lists', 'indentation']}\n onImageAdded={onImageAdded}\n label='Rich text editor with logs'\n info='Click on the buttons below to show the different formatted outputs of the RTE'\n />\n\n <Flex container={{ gap: 1 }}>\n <Button onClick={() => showContent('html')}>Show HTML</Button>\n <Button onClick={() => showContent('plain_text')}>Show plain text</Button>\n <Button onClick={() => showContent('rich_text')}>Show rich text</Button>\n </Flex>\n\n <Text>{content}</Text>\n </Flex>\n );\n};\n\nexport const RichTextEditorHtmlParsingDemo: StoryFn = () => {\n const [html, setHtml] = useState('<p>Hello world!</p>');\n const rteRef = useRef<EditorState>(null);\n\n const onImageAdded = (image: File, id: string) => {\n const src = URL.createObjectURL(image);\n rteRef.current?.appendImage({ src, alt: image.name }, id);\n };\n\n return (\n <Flex container={{ direction: 'column', gap: 2 }}>\n <Card>\n <CardContent>\n <TextArea value={html} onChange={e => setHtml(e.target.value)} />\n </CardContent>\n <CardFooter>\n <Button onClick={() => rteRef.current?.insertHtml(html.trim(), true)}>\n Overwrite RTE with new HTML\n </Button>\n </CardFooter>\n </Card>\n <Editor\n defaultValue={html}\n onImageAdded={onImageAdded}\n ref={rteRef}\n label={label}\n toolbar={['inline-styling', 'headers', 'tables', 'links', 'images', 'lists', 'indentation']}\n />\n </Flex>\n );\n};\n"]}
|
|
1
|
+
{"version":3,"file":"Editor.stories.jsx","sourceRoot":"","sources":["../../../src/rte/Editor/Editor.stories.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAGlD,OAAO,EACL,MAAM,EACN,IAAI,EACJ,WAAW,EACX,UAAU,EACV,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,QAAQ,EACT,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAGhD,OA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AA,EAAE,WAAW,CACb;QAAA,CAAC,UAAU,CACT;UAAA,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,IAAI,CAAC,CAAC,CACnE;;UACF,EAAE,MAAM,CACV;QAAA,EAAE,UAAU,CACd;MAAA,EAAE,IAAI,CACN;MAAA,CAAC,MAAM,CACL,YAAY,CAAC,CAAC,IAAI,CAAC,CACnB,YAAY,CAAC,CAAC,YAAY,CAAC,CAC3B,GAAG,CAAC,CAAC,MAAM,CAAC,CACZ,KAAK,CAAC,CAAC,KAAK,CAAC,CACb,OAAO,CAAC,CAAC,CAAC,gBAAgB,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,aAAa,CAAC,CAAC,EAEhG;IAAA,EAAE,IAAI,CAAC,CACR,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import type { Meta, StoryFn } from '@storybook/react';\nimport { useState, useRef } from 'react';\nimport { action } from '@storybook/addon-actions';\nimport type { Editor as TinymceEditor } from 'tinymce';\n\nimport {\n Button,\n Card,\n CardContent,\n CardFooter,\n Flex,\n Link,\n Text,\n TextArea\n} from '@pega/cosmos-react-core';\nimport { Editor } from '@pega/cosmos-react-rte';\nimport type { EditorState } from '@pega/cosmos-react-rte';\n\nimport { createPegaCustomElement, label } from './Editor.mocks';\n\nexport default {\n title: 'RTE/Editor',\n component: Editor\n} as Meta;\n\ntype EditorStoryProps = {\n showAdditionalInfo?: boolean;\n};\n\nexport const EditorDemo: StoryFn<EditorStoryProps> = (args: EditorStoryProps) => {\n const editorRef = useRef<EditorState>(null);\n\n const onImageAdded = (image: File, id: string) => {\n const src = URL.createObjectURL(image);\n editorRef.current?.appendImage({ src, alt: image.name }, id);\n };\n\n return (\n <Editor\n ref={editorRef}\n label={label}\n toolbar={['inline-styling', 'lists', 'indentation', 'images', 'links']}\n onFocus={action('Editor focused')}\n onBlur={action('Editor blurred')}\n onChange={action('Editor changed')}\n onImageAdded={onImageAdded}\n defaultValue='<body><p>Hi mom <a href=\"https://google.com\">link</a></p><img alt=\"Example alt text\" src=\"http://via.placeholder.com/640x360\"/></body>'\n additionalInfo={\n args.showAdditionalInfo\n ? {\n heading: 'Additional Info',\n content: (\n <Flex container={{ direction: 'column', alignItems: 'start', gap: 2 }}>\n <p>\n Lorem ipsum dolor sit amet, consectetur it, sed do tempor incididunt ut labore\n magna aliqua. Nibh praesent tristique magna sit amet. Nec tincidunt praesent\n semper feugiat nibh sed pulvinar proin gravida.\n </p>\n <p>\n Pharetra pharetra massa massa ultricies mi quis hendrerit dolor. Est velit\n egestas dui id ornare arcu odio ut. Varius sit amet mattis vulputate enim nulla\n aliquet porttitor lacus.\n </p>\n <Link href='/' target='_blank'>\n Neque vitae\n </Link>\n </Flex>\n )\n }\n : undefined\n }\n />\n );\n};\n\nEditorDemo.args = {\n showAdditionalInfo: false\n};\n\nEditorDemo.argTypes = {\n showAdditionalInfo: { control: { type: 'boolean' } }\n};\n\nexport const EmptyEditorDemo: StoryFn = () => {\n const editorRef = useRef<EditorState>(null);\n\n const onImageAdded = (image: File, id: string) => {\n const src = URL.createObjectURL(image);\n editorRef.current?.appendImage({ src, alt: image.name }, id);\n };\n\n return (\n <Editor\n ref={editorRef}\n label={label}\n toolbar={['inline-styling', 'lists', 'indentation', 'images', 'links']}\n onImageAdded={onImageAdded}\n onFocus={action('Editor has focus')}\n onBlur={action('Editor has blurred')}\n placeholder='Type some stuff in here'\n />\n );\n};\n\nexport const ReadonlyFormField: StoryFn = () => {\n return (\n <Editor\n label={label}\n readOnly\n defaultValue={`<article class=\"main-page-content\" lang=\"en-US\"><h1>HTML: HyperText Markup Language</h1><div><p><strong>HTML</strong> (HyperText Markup Language) is the most basic building block of the Web. It defines the meaning and structure of web content. Other technologies besides HTML are generally used to describe a web page's appearance/presentation (<a href=\"/en-US/docs/Web/CSS\">CSS</a>) or functionality/behavior (<a href=\"/en-US/docs/Web/JavaScript\">JavaScript</a>).</p>\n <p>\"Hypertext\" refers to links that connect web pages to one another, either within a single website or between websites. Links are a fundamental aspect of the Web. By uploading content to the Internet and linking it to pages created by other people, you become an active participant in the World Wide Web.</p>\n <p>HTML uses \"markup\" to annotate text, images, and other content for display in a Web browser. HTML markup includes special \"elements\" such as <a href=\"/en-US/docs/Web/HTML/Element/head\"><code><head></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/title\"><code><title></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/body\"><code><body></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/header\"><code><header></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/footer\"><code><footer></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/article\"><code><article></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/section\"><code><section></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/p\"><code><p></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/div\"><code><div></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/span\"><code><span></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/img\"><code><img></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/aside\"><code><aside></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/audio\"><code><audio></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/canvas\"><code><canvas></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/datalist\"><code><datalist></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/details\"><code><details></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/embed\"><code><embed></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/nav\"><code><nav></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/output\"><code><output></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/progress\"><code><progress></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/video\"><code><video></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/ul\"><code><ul></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/ol\"><code><ol></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/li\"><code><li></code></a> and many others.</p>\n <p>An HTML element is set off from other text in a document by \"tags\", which consist of the element name surrounded by \"<code><</code>\" and \"<code>></code>\". The name of an element inside a tag is case insensitive. That is, it can be written in uppercase, lowercase, or a mixture. For example, the <code><title></code> tag can be written as <code><Title></code>, <code><TITLE></code>, or in any other way.</p>\n\n <div id=\"on-github\" class=\"on-github\"><h3>Found a problem with this page?</h3><ul><li><a href=\"https://github.com/mdn/content/edit/main/files/en-us/web/html/index.md\" title=\"You're going to need to sign in to GitHub first (Opens in a new tab)\" target=\"_blank\" rel=\"noopener noreferrer\">Edit on <b>GitHub</b></a></li><li><a href=\"https://github.com/mdn/content/blob/main/files/en-us/web/html/index.md\" title=\"Folder: en-us/web/html (Opens in a new tab)\" target=\"_blank\" rel=\"noopener noreferrer\">Source on <b>GitHub</b></a></li><li><a href=\"https://github.com/mdn/content/issues/new?body=MDN+URL%3A+https%3A%2F%2Fdeveloper.mozilla.org%2Fen-US%2Fdocs%2FWeb%2FHTML%0A%0A%23%23%23%23+What+information+was+incorrect%2C+unhelpful%2C+or+incomplete%3F%0A%0A%0A%23%23%23%23+Specific+section+or+headline%3F%0A%0A%0A%23%23%23%23+What+did+you+expect+to+see%3F%0A%0A%0A%23%23%23%23+Did+you+test+this%3F+If+so%2C+how%3F%0A%0A%0A%3C%21--+Do+not+make+changes+below+this+line+--%3E%0A%3Cdetails%3E%0A%3Csummary%3EMDN+Content+page+report+details%3C%2Fsummary%3E%0A%0A*+Folder%3A+%60en-us%2Fweb%2Fhtml%60%0A*+MDN+URL%3A+https%3A%2F%2Fdeveloper.mozilla.org%2Fen-US%2Fdocs%2FWeb%2FHTML%0A*+GitHub+URL%3A+https%3A%2F%2Fgithub.com%2Fmdn%2Fcontent%2Fblob%2Fmain%2Ffiles%2Fen-us%2Fweb%2Fhtml%2Findex.md%0A*+Last+commit%3A+https%3A%2F%2Fgithub.com%2Fmdn%2Fcontent%2Fcommit%2F775662998e66813a612e3ff27e02f2ada867bc17%0A*+Document+last+modified%3A+2021-10-03T00%3A01%3A51.000Z%0A%0A%3C%2Fdetails%3E&title=Issue+with+%22HTML%3A+HyperText+Markup+Language%22%3A+%28short+summary+here+please%29&labels=needs-triage%2CContent%3AHTML\" title=\"This will take you to https://github.com/mdn/content to file a new issue\" target=\"_blank\" rel=\"noopener noreferrer\">Report a problem with this content on <b>GitHub</b></a></li><li>Want to fix the problem yourself? See <a href=\"https://github.com/mdn/content/blob/main/README.md\" target=\"_blank\" rel=\"noopener noreferrer\">our Contribution guide</a>.</li></ul></div>\n `}\n />\n );\n};\n\nexport const CustomComponentDemo: StoryFn = () => {\n const editorRef = useRef<EditorState>(null);\n const [editor, setEditor] = useState({} as TinymceEditor);\n\n const onCustomAction = () => {\n editor.insertContent('<pega-custom>Inserted from toolbar</pega-custom>');\n };\n\n return (\n <Editor\n ref={editorRef}\n label={label}\n toolbar={['inline-styling', 'lists', 'indentation', 'links', 'images']}\n defaultValue='<body><p>Hi mom <a href=\"https://google.com\">link</a></p><p>hi <pega-custom>Hello from custom element.</pega-custom></p></body>'\n customComponents={[{ createCustomElement: createPegaCustomElement, name: 'pega-custom' }]}\n customActions={[\n {\n icon: 'pega',\n text: 'Insert a custom element',\n onMouseDown: () => {\n onCustomAction();\n }\n }\n ]}\n onInit={initializedEditor => {\n setEditor(initializedEditor);\n }}\n />\n );\n};\n\nexport const RichTextEditorWithLogs: StoryFn = () => {\n const editorRef = useRef<EditorState>(null);\n const [content, setContent] = useState<string | undefined>();\n\n const onImageAdded = (image: File, id: string) => {\n const src = URL.createObjectURL(image);\n editorRef.current?.appendImage({ src, alt: image.name }, id);\n };\n\n const showContent = (type: 'html' | 'plain_text' | 'rich_text') => {\n if (type === 'html') setContent(editorRef.current?.getHtml());\n else if (type === 'plain_text') setContent(editorRef.current?.getPlainText());\n else if (type === 'rich_text') setContent(editorRef.current?.getRichText());\n };\n\n return (\n <Flex container={{ direction: 'column', gap: 2 }}>\n <Editor\n ref={editorRef}\n toolbar={['inline-styling', 'headers', 'tables', 'links', 'images', 'lists', 'indentation']}\n onImageAdded={onImageAdded}\n label='Rich text editor with logs'\n info='Click on the buttons below to show the different formatted outputs of the RTE'\n />\n\n <Flex container={{ gap: 1 }}>\n <Button onClick={() => showContent('html')}>Show HTML</Button>\n <Button onClick={() => showContent('plain_text')}>Show plain text</Button>\n <Button onClick={() => showContent('rich_text')}>Show rich text</Button>\n </Flex>\n\n <Text>{content}</Text>\n </Flex>\n );\n};\n\nexport const RichTextEditorHtmlParsingDemo: StoryFn = () => {\n const [html, setHtml] = useState('<p>Hello world!</p>');\n const rteRef = useRef<EditorState>(null);\n\n const onImageAdded = (image: File, id: string) => {\n const src = URL.createObjectURL(image);\n rteRef.current?.appendImage({ src, alt: image.name }, id);\n };\n\n return (\n <Flex container={{ direction: 'column', gap: 2 }}>\n <Card>\n <CardContent>\n <TextArea value={html} onChange={e => setHtml(e.target.value)} />\n </CardContent>\n <CardFooter>\n <Button onClick={() => rteRef.current?.insertHtml(html.trim(), true)}>\n Overwrite RTE with new HTML\n </Button>\n </CardFooter>\n </Card>\n <Editor\n defaultValue={html}\n onImageAdded={onImageAdded}\n ref={rteRef}\n label={label}\n toolbar={['inline-styling', 'headers', 'tables', 'links', 'images', 'lists', 'indentation']}\n />\n </Flex>\n );\n};\n"]}
|
|
@@ -3,6 +3,8 @@ declare const _default: import("@storybook/types").ComponentAnnotations<import("
|
|
|
3
3
|
export default _default;
|
|
4
4
|
interface DetailsDemoProps {
|
|
5
5
|
description?: string;
|
|
6
|
+
collapsible?: boolean;
|
|
7
|
+
showAdditionalInfo?: boolean;
|
|
6
8
|
}
|
|
7
9
|
export declare const DetailsDemo: StoryFn<DetailsDemoProps>;
|
|
8
10
|
//# sourceMappingURL=Details.stories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Details.stories.d.ts","sourceRoot":"","sources":["../../../src/work/Details/Details.stories.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAQ,OAAO,EAAE,MAAM,kBAAkB,CAAC;;AAKtD,
|
|
1
|
+
{"version":3,"file":"Details.stories.d.ts","sourceRoot":"","sources":["../../../src/work/Details/Details.stories.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAQ,OAAO,EAAE,MAAM,kBAAkB,CAAC;;AAKtD,wBAiBU;AAEV,UAAU,gBAAgB;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAED,eAAO,MAAM,WAAW,EAAE,OAAO,CAAC,gBAAgB,CAgHjD,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
|
-
import { FieldValueItem, useBreakpoint } from '@pega/cosmos-react-core';
|
|
2
|
+
import { Flex, Link, FieldValueItem, useBreakpoint } from '@pega/cosmos-react-core';
|
|
3
3
|
import { Details, DetailsContext } from '@pega/cosmos-react-work';
|
|
4
4
|
export default {
|
|
5
5
|
title: 'Work/Details',
|
|
@@ -8,14 +8,18 @@ export default {
|
|
|
8
8
|
layout: 'centered'
|
|
9
9
|
},
|
|
10
10
|
args: {
|
|
11
|
-
description: 'Pellentesque pharetra justo augue, non maximus nulla venenatis et. Sed laoreet ultricies ullamcorper. Mauris ac nulla quis ipsum semper fringilla in eget risus. Fusce cursus sollicitudin nibh molestie volutpat.'
|
|
11
|
+
description: 'Pellentesque pharetra justo augue, non maximus nulla venenatis et. Sed laoreet ultricies ullamcorper. Mauris ac nulla quis ipsum semper fringilla in eget risus. Fusce cursus sollicitudin nibh molestie volutpat.',
|
|
12
|
+
collapsible: false,
|
|
13
|
+
showAdditionalInfo: false
|
|
12
14
|
},
|
|
13
15
|
argTypes: {
|
|
14
|
-
description: { control: { type: 'text' } }
|
|
16
|
+
description: { control: { type: 'text' } },
|
|
17
|
+
collapsible: { control: { type: 'boolean' } },
|
|
18
|
+
showAdditionalInfo: { control: { type: 'boolean' } }
|
|
15
19
|
}
|
|
16
20
|
};
|
|
17
21
|
export const DetailsDemo = (args) => {
|
|
18
|
-
const { description } = args;
|
|
22
|
+
const { description, collapsible, showAdditionalInfo } = args;
|
|
19
23
|
const isNotMobile = useBreakpoint('sm');
|
|
20
24
|
const ctx = useMemo(() => ({
|
|
21
25
|
mobileView: !isNotMobile,
|
|
@@ -27,7 +31,26 @@ export const DetailsDemo = (args) => {
|
|
|
27
31
|
<FieldValueItem variant='stacked' name='Location' value='Berlin'/>,
|
|
28
32
|
<FieldValueItem variant='stacked' name='Make' value='Ford'/>,
|
|
29
33
|
<FieldValueItem variant='stacked' name='Model' value='F150'/>
|
|
30
|
-
]} description={description}
|
|
34
|
+
]} description={description} collapsible={collapsible} additionalInfo={showAdditionalInfo
|
|
35
|
+
? {
|
|
36
|
+
heading: 'Additional Info',
|
|
37
|
+
content: (<Flex container={{ direction: 'column', alignItems: 'start', gap: 2 }}>
|
|
38
|
+
<p>
|
|
39
|
+
Lorem ipsum dolor sit amet, consectetur it, sed do tempor incididunt ut labore
|
|
40
|
+
magna aliqua. Nibh praesent tristique magna sit amet. Nec tincidunt praesent
|
|
41
|
+
semper feugiat nibh sed pulvinar proin gravida.
|
|
42
|
+
</p>
|
|
43
|
+
<p>
|
|
44
|
+
Pharetra pharetra massa massa ultricies mi quis hendrerit dolor. Est velit
|
|
45
|
+
egestas dui id ornare arcu odio ut. Varius sit amet mattis vulputate enim
|
|
46
|
+
nulla aliquet porttitor lacus.
|
|
47
|
+
</p>
|
|
48
|
+
<Link href='/' target='_blank'>
|
|
49
|
+
Neque vitae
|
|
50
|
+
</Link>
|
|
51
|
+
</Flex>)
|
|
52
|
+
}
|
|
53
|
+
: undefined}>
|
|
31
54
|
|
|
32
55
|
<Details name='Nested as flex' nested asFlex>
|
|
33
56
|
|