@pega/cosmos-react-demos 3.0.0-dev.6.0 → 3.0.0-dev.7.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/jsx/build/AppHeader/AppHeader.stories.d.ts.map +1 -1
- package/jsx/build/AppHeader/AppHeader.stories.jsx +6 -1
- package/jsx/build/AppHeader/AppHeader.stories.jsx.map +1 -1
- package/jsx/build/AppShell/AppShell.mocks.d.ts +2 -0
- package/jsx/build/AppShell/AppShell.mocks.d.ts.map +1 -1
- package/jsx/build/AppShell/{AppShell.mocks.js → AppShell.mocks.jsx} +22 -1
- package/jsx/build/AppShell/AppShell.mocks.jsx.map +1 -0
- package/jsx/build/AppShell/AppShell.stories.d.ts +2 -4
- package/jsx/build/AppShell/AppShell.stories.d.ts.map +1 -1
- package/jsx/build/AppShell/AppShell.stories.jsx +20 -30
- package/jsx/build/AppShell/AppShell.stories.jsx.map +1 -1
- package/jsx/build/ObjectPreview/ObjectPreview.mocks.d.ts +4 -0
- package/jsx/build/ObjectPreview/ObjectPreview.mocks.d.ts.map +1 -0
- package/jsx/build/ObjectPreview/ObjectPreview.mocks.jsx +9 -0
- package/jsx/build/ObjectPreview/ObjectPreview.mocks.jsx.map +1 -0
- package/jsx/build/ObjectPreview/ObjectPreview.stories.d.ts +8 -0
- package/jsx/build/ObjectPreview/ObjectPreview.stories.d.ts.map +1 -0
- package/jsx/build/ObjectPreview/ObjectPreview.stories.jsx +93 -0
- package/jsx/build/ObjectPreview/ObjectPreview.stories.jsx.map +1 -0
- package/jsx/build/ObjectPreview/ObjectPreview.styles.d.ts +3 -0
- package/jsx/build/ObjectPreview/ObjectPreview.styles.d.ts.map +1 -0
- package/jsx/build/ObjectPreview/ObjectPreview.styles.js +22 -0
- package/jsx/build/ObjectPreview/ObjectPreview.styles.js.map +1 -0
- package/jsx/build/ObjectSelect/ObjectSelect.mocks.d.ts +7 -1
- package/jsx/build/ObjectSelect/ObjectSelect.mocks.d.ts.map +1 -1
- package/jsx/build/ObjectSelect/ObjectSelect.mocks.jsx +59 -43
- package/jsx/build/ObjectSelect/ObjectSelect.mocks.jsx.map +1 -1
- package/jsx/build/ObjectSelect/ObjectSelect.stories.d.ts.map +1 -1
- package/jsx/build/ObjectSelect/ObjectSelect.stories.jsx +37 -5
- package/jsx/build/ObjectSelect/ObjectSelect.stories.jsx.map +1 -1
- package/jsx/build/PageTemplates/GalleryPage.mocks.d.ts +10 -9
- package/jsx/build/PageTemplates/GalleryPage.mocks.d.ts.map +1 -1
- package/jsx/build/PageTemplates/GalleryPage.mocks.jsx +7 -9
- package/jsx/build/PageTemplates/GalleryPage.mocks.jsx.map +1 -1
- package/jsx/build/PageTemplates/GalleryPage.stories.d.ts +0 -1
- package/jsx/build/PageTemplates/GalleryPage.stories.d.ts.map +1 -1
- package/jsx/build/PageTemplates/GalleryPage.stories.jsx +12 -14
- package/jsx/build/PageTemplates/GalleryPage.stories.jsx.map +1 -1
- package/jsx/build/PageTemplates/PageTemplates.mocks.d.ts +2 -1
- package/jsx/build/PageTemplates/PageTemplates.mocks.d.ts.map +1 -1
- package/jsx/build/PageTemplates/PageTemplates.mocks.jsx +17 -2
- package/jsx/build/PageTemplates/PageTemplates.mocks.jsx.map +1 -1
- package/jsx/build/PageTemplates/PageTemplates.stories.d.ts +2 -4
- package/jsx/build/PageTemplates/PageTemplates.stories.d.ts.map +1 -1
- package/jsx/build/PageTemplates/PageTemplates.stories.jsx +192 -128
- package/jsx/build/PageTemplates/PageTemplates.stories.jsx.map +1 -1
- package/lib/build/AppHeader/AppHeader.stories.d.ts.map +1 -1
- package/lib/build/AppHeader/AppHeader.stories.js +6 -1
- package/lib/build/AppHeader/AppHeader.stories.js.map +1 -1
- package/lib/build/AppShell/AppShell.mocks.d.ts +2 -0
- package/lib/build/AppShell/AppShell.mocks.d.ts.map +1 -1
- package/lib/build/AppShell/AppShell.mocks.js +20 -0
- package/lib/build/AppShell/AppShell.mocks.js.map +1 -1
- package/lib/build/AppShell/AppShell.stories.d.ts +2 -4
- package/lib/build/AppShell/AppShell.stories.d.ts.map +1 -1
- package/lib/build/AppShell/AppShell.stories.js +20 -28
- package/lib/build/AppShell/AppShell.stories.js.map +1 -1
- package/lib/build/ObjectPreview/ObjectPreview.mocks.d.ts +4 -0
- package/lib/build/ObjectPreview/ObjectPreview.mocks.d.ts.map +1 -0
- package/lib/build/ObjectPreview/ObjectPreview.mocks.js +8 -0
- package/lib/build/ObjectPreview/ObjectPreview.mocks.js.map +1 -0
- package/lib/build/ObjectPreview/ObjectPreview.stories.d.ts +8 -0
- package/lib/build/ObjectPreview/ObjectPreview.stories.d.ts.map +1 -0
- package/lib/build/ObjectPreview/ObjectPreview.stories.js +90 -0
- package/lib/build/ObjectPreview/ObjectPreview.stories.js.map +1 -0
- package/lib/build/ObjectPreview/ObjectPreview.styles.d.ts +3 -0
- package/lib/build/ObjectPreview/ObjectPreview.styles.d.ts.map +1 -0
- package/lib/build/ObjectPreview/ObjectPreview.styles.js +22 -0
- package/lib/build/ObjectPreview/ObjectPreview.styles.js.map +1 -0
- package/lib/build/ObjectSelect/ObjectSelect.mocks.d.ts +7 -1
- package/lib/build/ObjectSelect/ObjectSelect.mocks.d.ts.map +1 -1
- package/lib/build/ObjectSelect/ObjectSelect.mocks.js +58 -26
- package/lib/build/ObjectSelect/ObjectSelect.mocks.js.map +1 -1
- package/lib/build/ObjectSelect/ObjectSelect.stories.d.ts.map +1 -1
- package/lib/build/ObjectSelect/ObjectSelect.stories.js +32 -4
- package/lib/build/ObjectSelect/ObjectSelect.stories.js.map +1 -1
- package/lib/build/PageTemplates/GalleryPage.mocks.d.ts +10 -9
- package/lib/build/PageTemplates/GalleryPage.mocks.d.ts.map +1 -1
- package/lib/build/PageTemplates/GalleryPage.mocks.js +7 -9
- package/lib/build/PageTemplates/GalleryPage.mocks.js.map +1 -1
- package/lib/build/PageTemplates/GalleryPage.stories.d.ts +0 -1
- package/lib/build/PageTemplates/GalleryPage.stories.d.ts.map +1 -1
- package/lib/build/PageTemplates/GalleryPage.stories.js +12 -14
- package/lib/build/PageTemplates/GalleryPage.stories.js.map +1 -1
- package/lib/build/PageTemplates/PageTemplates.mocks.d.ts +2 -1
- package/lib/build/PageTemplates/PageTemplates.mocks.d.ts.map +1 -1
- package/lib/build/PageTemplates/PageTemplates.mocks.js +14 -3
- package/lib/build/PageTemplates/PageTemplates.mocks.js.map +1 -1
- package/lib/build/PageTemplates/PageTemplates.stories.d.ts +2 -4
- package/lib/build/PageTemplates/PageTemplates.stories.d.ts.map +1 -1
- package/lib/build/PageTemplates/PageTemplates.stories.js +210 -147
- package/lib/build/PageTemplates/PageTemplates.stories.js.map +1 -1
- package/package.json +9 -9
- package/jsx/build/AppShell/AppShell.mocks.js.map +0 -1
|
@@ -6,6 +6,7 @@ interface Field extends FormControlProps {
|
|
|
6
6
|
validator: (this: Field) => boolean;
|
|
7
7
|
}
|
|
8
8
|
export declare const initFields: () => Field[];
|
|
9
|
-
export declare const OneColumnForm: () => JSX.Element | null;
|
|
9
|
+
export declare const OneColumnForm: (props: any) => JSX.Element | null;
|
|
10
|
+
export declare const PreviewMainContent: () => JSX.Element;
|
|
10
11
|
export {};
|
|
11
12
|
//# sourceMappingURL=PageTemplates.mocks.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PageTemplates.mocks.d.ts","sourceRoot":"","sources":["../../../src/build/PageTemplates/PageTemplates.mocks.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"PageTemplates.mocks.d.ts","sourceRoot":"","sources":["../../../src/build/PageTemplates/PageTemplates.mocks.tsx"],"names":[],"mappings":";AAGA,OAAO,EAcL,gBAAgB,EAEjB,MAAM,yBAAyB,CAAC;AAMjC,UAAU,KAAM,SAAQ,gBAAgB;IACtC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,CAAC,IAAI,EAAE,KAAK,KAAK,OAAO,CAAC;CACrC;AAGD,eAAO,MAAM,UAAU,QAAO,KAAK,EAmClC,CAAC;AA6BF,eAAO,MAAM,aAAa,UAAW,GAAG,uBA0IvC,CAAC;AAEF,eAAO,MAAM,kBAAkB,mBAe9B,CAAC"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { useReducer, useRef, useContext } from 'react';
|
|
2
|
-
import
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import { Button, Flex, Form, Input, CheckboxGroup, RadioButtonGroup, RadioButton, Checkbox, Select, Option, TextArea, ToasterContext, Text, useTheme } from '@pega/cosmos-react-core';
|
|
3
4
|
import { RichTextEditor } from '@pega/cosmos-react-rte';
|
|
4
5
|
import { FileInputDemo } from '../../core/File/FileInput.stories';
|
|
6
|
+
import { dataPages, ObjectSelectComp } from '../ObjectSelect/ObjectSelect.mocks';
|
|
5
7
|
export const initFields = () => {
|
|
6
8
|
const common = { value: undefined, status: undefined };
|
|
7
9
|
return [
|
|
@@ -59,7 +61,7 @@ const fieldReducer = (fields, { target, type }) => {
|
|
|
59
61
|
return field;
|
|
60
62
|
});
|
|
61
63
|
};
|
|
62
|
-
export const OneColumnForm = () => {
|
|
64
|
+
export const OneColumnForm = (props) => {
|
|
63
65
|
const editorRef = useRef(null);
|
|
64
66
|
const [fields, setField] = useReducer(fieldReducer, undefined, initFields);
|
|
65
67
|
const { push } = useContext(ToasterContext);
|
|
@@ -110,6 +112,8 @@ export const OneColumnForm = () => {
|
|
|
110
112
|
<Option>Salad</Option>
|
|
111
113
|
</Select>
|
|
112
114
|
|
|
115
|
+
<ObjectSelectComp label='Date page' info='Choose a when condition from list' items={dataPages} onChange={() => { }} onPreview={() => props.previewCallback()}/>
|
|
116
|
+
|
|
113
117
|
<TextArea name='notes' required={notes.required} label='Meeting Notes' status={notes.status} info={notes.info || notes.help} onChange={(e) => setField({ ...e })} onBlur={(e) => setField({ ...e })}/>
|
|
114
118
|
<RichTextEditor label='Detailed meeting notes' info='The rich text editor can be used in forms, comments, and documents' toolbar={[
|
|
115
119
|
'inline-styling',
|
|
@@ -126,4 +130,15 @@ export const OneColumnForm = () => {
|
|
|
126
130
|
</Flex>
|
|
127
131
|
</Form>);
|
|
128
132
|
};
|
|
133
|
+
export const PreviewMainContent = () => {
|
|
134
|
+
const { base: { palette } } = useTheme();
|
|
135
|
+
const StyledRegion = styled.div `
|
|
136
|
+
min-height: 120vh;
|
|
137
|
+
border: dotted 0.1rem ${palette['border-line']};
|
|
138
|
+
background: ${palette.skeleton};
|
|
139
|
+
`;
|
|
140
|
+
return (<Flex as={StyledRegion} container={{ alignItems: 'center', justify: 'center' }}>
|
|
141
|
+
<Text>This is a react region</Text>
|
|
142
|
+
</Flex>);
|
|
143
|
+
};
|
|
129
144
|
//# sourceMappingURL=PageTemplates.mocks.jsx.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PageTemplates.mocks.jsx","sourceRoot":"","sources":["../../../src/build/PageTemplates/PageTemplates.mocks.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAsC,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAE3F,OAAO,EACL,MAAM,EACN,IAAI,EACJ,IAAI,EACJ,KAAK,EACL,aAAa,EACb,gBAAgB,EAChB,WAAW,EACX,QAAQ,EACR,MAAM,EACN,MAAM,EACN,QAAQ,EACR,cAAc,EACd,IAAI,EAEL,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,cAAc,EAAuB,MAAM,wBAAwB,CAAC;AAE7E,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AASlE,MAAM,CAAC,MAAM,UAAU,GAAG,GAAY,EAAE;IACtC,MAAM,MAAM,GAAG,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;IACvD,OAAO;QACL;YACE,GAAG,MAAM;YACT,IAAI,EAAE,MAAM;YACZ,QAAQ,EAAE,IAAI;YACd,KAAK,EAAE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KAAK,CAAC,wBAAwB,CAC9B,IAAI,CAAC,oEAAoE,CACzE,OAAO,CAAC,CAAC;YACP,gBAAgB;YAChB,SAAS;YACT,QAAQ;YACR,OAAO;YACP,QAAQ;YACR,OAAO;YACP,gBAAgB;YAChB,aAAa;SACd,CAAC,CACF,YAAY,CAAC,CAAC,YAAY,CAAC,CAC3B,GAAG,CAAC,CAAC,SAAS,CAAC,EAGjB;;QAAA,CAAC,aAAa,CAAC,AAAD,EAChB;MAAA,EAAE,IAAI,CACR;IAAA,EAAE,IAAI,CAAC,CACR,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { FormEvent, ChangeEvent, FocusEvent, useReducer, useRef, useContext } from 'react';\n\nimport {\n Button,\n Flex,\n Form,\n Input,\n CheckboxGroup,\n RadioButtonGroup,\n RadioButton,\n Checkbox,\n Select,\n Option,\n TextArea,\n ToasterContext,\n Text,\n FormControlProps\n} from '@pega/cosmos-react-core';\nimport { RichTextEditor, RichTextEditorState } from '@pega/cosmos-react-rte';\n\nimport { FileInputDemo } from '../../core/File/FileInput.stories';\n\ninterface Field extends FormControlProps {\n help?: string;\n error?: string;\n validator: (this: Field) => boolean;\n}\n\n// Get initial field properties\nexport const initFields = (): Field[] => {\n const common = { value: undefined, status: undefined };\n return [\n {\n ...common,\n name: 'name',\n required: true,\n error: 'Please enter first and last name',\n validator() {\n if (!this.value) return false;\n return /^[a-z]+\\s[a-z]+$/i.test(this.value);\n }\n },\n {\n ...common,\n name: 'email',\n required: true,\n error: 'Enter a @pega.com address',\n validator() {\n if (!this.value) return false;\n return /^\\S+@pega\\.com$/.test(this.value);\n }\n },\n {\n ...common,\n name: 'notes',\n required: true,\n help: 'See how fast you can type 20 characters go',\n error: 'You need to tell us more than 20 characters',\n validator() {\n if (!this.value) return false;\n return this.value.length >= 20;\n }\n }\n ];\n};\n\n// Handles setting of state for all fields\nconst fieldReducer = (\n fields: Field[],\n {\n target,\n type\n }:\n | ChangeEvent<HTMLInputElement | HTMLTextAreaElement>\n | FocusEvent<HTMLInputElement | HTMLTextAreaElement>\n) => {\n return fields.map(field => {\n if (field.name === target.name) {\n field.value = target.value;\n if (type === 'blur' || field.status === 'error') {\n if ((field.required || field.value) && !field.validator()) {\n field.status = 'error';\n field.info = field.error;\n } else {\n field.status = undefined;\n field.info = field.help;\n }\n }\n }\n return field;\n });\n};\n\nexport const OneColumnForm = () => {\n const editorRef = useRef<RichTextEditorState>(null);\n const [fields, setField] = useReducer(fieldReducer, undefined, initFields);\n const { push } = useContext(ToasterContext);\n\n const name = fields.find(field => field.name === 'name');\n const email = fields.find(field => field.name === 'email');\n const notes = fields.find(field => field.name === 'notes');\n\n if (!name || !email || !notes) return null;\n\n const canSubmit = fields.every(field => field.value && field.validator());\n\n const actions = (\n <>\n <Button\n name='Cancel'\n variant='secondary'\n onClick={() => {\n push({ content: 'Form cancelled!' });\n }}\n >\n Cancel\n </Button>\n <Button name='Submit' type='submit' variant='primary' disabled={!canSubmit}>\n Submit\n </Button>\n </>\n );\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 <Form\n actions={actions}\n onSubmit={(e: FormEvent) => {\n e.preventDefault();\n push({ content: 'Form submitted!' });\n }}\n style={{ maxWidth: '37.5rem' }}\n >\n <Text variant='h4' as='h4'>\n Demo Form\n </Text>\n <Flex container={{ direction: 'column', gap: 2 }} item={{ grow: 1 }}>\n <Input\n name='name'\n label='Name'\n value={name.value}\n required={name.required}\n status={name.status}\n info='some help text here'\n onChange={(e: ChangeEvent<HTMLInputElement>) => setField({ ...e })}\n onBlur={(e: FocusEvent<HTMLInputElement>) => setField({ ...e })}\n autoComplete='off'\n />\n\n <Input\n name='email'\n value={email.value}\n type='email'\n label='Email'\n required={email.required}\n status={email.status}\n info='some help text here'\n onChange={(e: ChangeEvent<HTMLInputElement>) => setField({ ...e })}\n onBlur={(e: FocusEvent<HTMLInputElement>) => setField({ ...e })}\n autoComplete='off'\n />\n\n <CheckboxGroup name='visited' label='Places you have worked'>\n {['Cambridge', 'Krakow', 'Hyderabad', 'Bangalore'].map(office => (\n <Checkbox\n key={office}\n label={office}\n onChange={(e: ChangeEvent<HTMLInputElement>) => setField({ ...e })}\n />\n ))}\n </CheckboxGroup>\n\n <RadioButtonGroup name='meetings' label='Do you enjoy early morning meetings?'>\n {['Yes', \"No...no I don't\"].map(option => (\n <RadioButton\n key={option}\n label={option}\n onChange={(e: ChangeEvent<HTMLInputElement>) => setField({ ...e })}\n />\n ))}\n </RadioButtonGroup>\n\n <Select label='What would you like to eat?' info='FYI: options are limited'>\n <Option>choose meal...</Option>\n <Option>Pizza</Option>\n <Option>Sandwich</Option>\n <Option>Salad</Option>\n </Select>\n\n <TextArea\n name='notes'\n required={notes.required}\n label='Meeting Notes'\n status={notes.status}\n info={notes.info || notes.help}\n onChange={(e: ChangeEvent<HTMLTextAreaElement>) => setField({ ...e })}\n onBlur={(e: FocusEvent<HTMLInputElement>) => setField({ ...e })}\n />\n <RichTextEditor\n label='Detailed meeting notes'\n info='The rich text editor can be used in forms, comments, and documents'\n toolbar={[\n 'inline-styling',\n 'headers',\n 'tables',\n 'links',\n 'images',\n 'lists',\n 'cut-copy-paste',\n 'indentation'\n ]}\n onImageAdded={onImageAdded}\n ref={editorRef}\n />\n\n <FileInputDemo />\n </Flex>\n </Form>\n );\n};\n"]}
|
|
1
|
+
{"version":3,"file":"PageTemplates.mocks.jsx","sourceRoot":"","sources":["../../../src/build/PageTemplates/PageTemplates.mocks.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAsC,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC3F,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,OAAO,EACL,MAAM,EACN,IAAI,EACJ,IAAI,EACJ,KAAK,EACL,aAAa,EACb,gBAAgB,EAChB,WAAW,EACX,QAAQ,EACR,MAAM,EACN,MAAM,EACN,QAAQ,EACR,cAAc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AM,CAAC,GAAG,CAAA;;4BAEL,OAAO,CAAC,aAAa,CAAC;kBAChC,OAAO,CAAC,QAAQ;GAC/B,CAAC;IAEF,OAAO,CACL,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,YAAY,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,CAC7E;MAAA,CAAC,IAAI,CAAC,sBAAsB,EAAE,IAAI,CACpC;IAAA,EAAE,IAAI,CAAC,CACR,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { FormEvent, ChangeEvent, FocusEvent, useReducer, useRef, useContext } from 'react';\nimport styled from 'styled-components';\n\nimport {\n Button,\n Flex,\n Form,\n Input,\n CheckboxGroup,\n RadioButtonGroup,\n RadioButton,\n Checkbox,\n Select,\n Option,\n TextArea,\n ToasterContext,\n Text,\n FormControlProps,\n useTheme\n} from '@pega/cosmos-react-core';\nimport { RichTextEditor, RichTextEditorState } from '@pega/cosmos-react-rte';\n\nimport { FileInputDemo } from '../../core/File/FileInput.stories';\nimport { dataPages, ObjectSelectComp } from '../ObjectSelect/ObjectSelect.mocks';\n\ninterface Field extends FormControlProps {\n help?: string;\n error?: string;\n validator: (this: Field) => boolean;\n}\n\n// Get initial field properties\nexport const initFields = (): Field[] => {\n const common = { value: undefined, status: undefined };\n return [\n {\n ...common,\n name: 'name',\n required: true,\n error: 'Please enter first and last name',\n validator() {\n if (!this.value) return false;\n return /^[a-z]+\\s[a-z]+$/i.test(this.value);\n }\n },\n {\n ...common,\n name: 'email',\n required: true,\n error: 'Enter a @pega.com address',\n validator() {\n if (!this.value) return false;\n return /^\\S+@pega\\.com$/.test(this.value);\n }\n },\n {\n ...common,\n name: 'notes',\n required: true,\n help: 'See how fast you can type 20 characters go',\n error: 'You need to tell us more than 20 characters',\n validator() {\n if (!this.value) return false;\n return this.value.length >= 20;\n }\n }\n ];\n};\n\n// Handles setting of state for all fields\nconst fieldReducer = (\n fields: Field[],\n {\n target,\n type\n }:\n | ChangeEvent<HTMLInputElement | HTMLTextAreaElement>\n | FocusEvent<HTMLInputElement | HTMLTextAreaElement>\n) => {\n return fields.map(field => {\n if (field.name === target.name) {\n field.value = target.value;\n if (type === 'blur' || field.status === 'error') {\n if ((field.required || field.value) && !field.validator()) {\n field.status = 'error';\n field.info = field.error;\n } else {\n field.status = undefined;\n field.info = field.help;\n }\n }\n }\n return field;\n });\n};\n\nexport const OneColumnForm = (props: any) => {\n const editorRef = useRef<RichTextEditorState>(null);\n const [fields, setField] = useReducer(fieldReducer, undefined, initFields);\n const { push } = useContext(ToasterContext);\n\n const name = fields.find(field => field.name === 'name');\n const email = fields.find(field => field.name === 'email');\n const notes = fields.find(field => field.name === 'notes');\n\n if (!name || !email || !notes) return null;\n\n const canSubmit = fields.every(field => field.value && field.validator());\n\n const actions = (\n <>\n <Button\n name='Cancel'\n variant='secondary'\n onClick={() => {\n push({ content: 'Form cancelled!' });\n }}\n >\n Cancel\n </Button>\n <Button name='Submit' type='submit' variant='primary' disabled={!canSubmit}>\n Submit\n </Button>\n </>\n );\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 <Form\n actions={actions}\n onSubmit={(e: FormEvent) => {\n e.preventDefault();\n push({ content: 'Form submitted!' });\n }}\n style={{ maxWidth: '37.5rem' }}\n >\n <Text variant='h4' as='h4'>\n Demo Form\n </Text>\n <Flex container={{ direction: 'column', gap: 2 }} item={{ grow: 1 }}>\n <Input\n name='name'\n label='Name'\n value={name.value}\n required={name.required}\n status={name.status}\n info='some help text here'\n onChange={(e: ChangeEvent<HTMLInputElement>) => setField({ ...e })}\n onBlur={(e: FocusEvent<HTMLInputElement>) => setField({ ...e })}\n autoComplete='off'\n />\n\n <Input\n name='email'\n value={email.value}\n type='email'\n label='Email'\n required={email.required}\n status={email.status}\n info='some help text here'\n onChange={(e: ChangeEvent<HTMLInputElement>) => setField({ ...e })}\n onBlur={(e: FocusEvent<HTMLInputElement>) => setField({ ...e })}\n autoComplete='off'\n />\n\n <CheckboxGroup name='visited' label='Places you have worked'>\n {['Cambridge', 'Krakow', 'Hyderabad', 'Bangalore'].map(office => (\n <Checkbox\n key={office}\n label={office}\n onChange={(e: ChangeEvent<HTMLInputElement>) => setField({ ...e })}\n />\n ))}\n </CheckboxGroup>\n\n <RadioButtonGroup name='meetings' label='Do you enjoy early morning meetings?'>\n {['Yes', \"No...no I don't\"].map(option => (\n <RadioButton\n key={option}\n label={option}\n onChange={(e: ChangeEvent<HTMLInputElement>) => setField({ ...e })}\n />\n ))}\n </RadioButtonGroup>\n\n <Select label='What would you like to eat?' info='FYI: options are limited'>\n <Option>choose meal...</Option>\n <Option>Pizza</Option>\n <Option>Sandwich</Option>\n <Option>Salad</Option>\n </Select>\n\n <ObjectSelectComp\n label='Date page'\n info='Choose a when condition from list'\n items={dataPages}\n onChange={() => {}}\n onPreview={() => props.previewCallback()}\n />\n\n <TextArea\n name='notes'\n required={notes.required}\n label='Meeting Notes'\n status={notes.status}\n info={notes.info || notes.help}\n onChange={(e: ChangeEvent<HTMLTextAreaElement>) => setField({ ...e })}\n onBlur={(e: FocusEvent<HTMLInputElement>) => setField({ ...e })}\n />\n <RichTextEditor\n label='Detailed meeting notes'\n info='The rich text editor can be used in forms, comments, and documents'\n toolbar={[\n 'inline-styling',\n 'headers',\n 'tables',\n 'links',\n 'images',\n 'lists',\n 'cut-copy-paste',\n 'indentation'\n ]}\n onImageAdded={onImageAdded}\n ref={editorRef}\n />\n\n <FileInputDemo />\n </Flex>\n </Form>\n );\n};\n\nexport const PreviewMainContent = () => {\n const {\n base: { palette }\n } = useTheme();\n const StyledRegion = styled.div`\n min-height: 120vh;\n border: dotted 0.1rem ${palette['border-line']};\n background: ${palette.skeleton};\n `;\n\n return (\n <Flex as={StyledRegion} container={{ alignItems: 'center', justify: 'center' }}>\n <Text>This is a react region</Text>\n </Flex>\n );\n};\n"]}
|
|
@@ -11,9 +11,8 @@ export interface PageTemplatesStoryProps extends PageTemplateProps {
|
|
|
11
11
|
showActions?: boolean;
|
|
12
12
|
showBanners?: boolean;
|
|
13
13
|
subTitle?: string;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
statusVariant?: StatusProps['variant'];
|
|
14
|
+
showStatus?: boolean;
|
|
15
|
+
statusVariant: StatusProps['variant'];
|
|
17
16
|
statusLabel: string;
|
|
18
17
|
showEditButton?: boolean;
|
|
19
18
|
onEdit?: (e: MouseEvent<HTMLButtonElement>) => void;
|
|
@@ -22,6 +21,5 @@ interface AppShellStory {
|
|
|
22
21
|
main: AppShellProps['main'];
|
|
23
22
|
hideNavigation?: boolean;
|
|
24
23
|
}
|
|
25
|
-
export declare const AppShellWithMenuNavigation: (args: AppShellStory) => JSX.Element;
|
|
26
24
|
export declare const PageTemplatesDemo: Story<PageTemplatesStoryProps & AppShellStory>;
|
|
27
25
|
//# sourceMappingURL=PageTemplates.stories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PageTemplates.stories.d.ts","sourceRoot":"","sources":["../../../src/build/PageTemplates/PageTemplates.stories.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAiC,UAAU,EAAE,MAAM,OAAO,CAAC;AAGlE,OAAO,EAaL,WAAW,EACX,iBAAiB,EAClB,MAAM,yBAAyB,CAAC;AACjC,OAAO,
|
|
1
|
+
{"version":3,"file":"PageTemplates.stories.d.ts","sourceRoot":"","sources":["../../../src/build/PageTemplates/PageTemplates.stories.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAiC,UAAU,EAAE,MAAM,OAAO,CAAC;AAGlE,OAAO,EAaL,WAAW,EACX,iBAAiB,EAClB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAEL,aAAa,EAId,MAAM,0BAA0B,CAAC;;AAalC,wBAKU;AAEV,MAAM,WAAW,uBAAwB,SAAQ,iBAAiB;IAChE,QAAQ,EACJ,YAAY,GACZ,YAAY,GACZ,cAAc,GACd,aAAa,GACb,aAAa,GACb,aAAa,GACb,kBAAkB,GAClB,kBAAkB,GAClB,oBAAoB,GACpB,QAAQ,CAAC;IACb,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,aAAa,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC;IACtC,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;CACrD;AAED,UAAU,aAAa;IACrB,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAC5B,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,uBAAuB,GAAG,aAAa,CAyY5E,CAAC"}
|
|
@@ -1,135 +1,20 @@
|
|
|
1
1
|
import { useState, useMemo, useContext } from 'react';
|
|
2
2
|
import { action } from '@storybook/addon-actions';
|
|
3
3
|
import { Button, Banner, treeHelpers, StandardTree, Configuration, Modal, ModalManagerContext, BuildTheme, Flex, Text, Actions } from '@pega/cosmos-react-core';
|
|
4
|
-
import { AppShell, TabbedPage, OneColumnPage } from '@pega/cosmos-react-build';
|
|
4
|
+
import { AppShell, TabbedPage, OneColumnPage, ObjectPreview } from '@pega/cosmos-react-build';
|
|
5
5
|
import { TableDemo } from '../../core/Table/Table.stories';
|
|
6
6
|
import { WorkbenchDemo } from '../Workbench/Workbench.stories';
|
|
7
7
|
import { appExplorerMenuList, branchesMenuList, recordMenuList, treeList } from '../AppShell/AppShell.mocks';
|
|
8
|
-
import { OneColumnForm } from './PageTemplates.mocks';
|
|
8
|
+
import { OneColumnForm, PreviewMainContent } from './PageTemplates.mocks';
|
|
9
9
|
export default {
|
|
10
10
|
title: 'Build/PageTemplates',
|
|
11
11
|
parameters: {
|
|
12
12
|
layout: 'fullscreen'
|
|
13
13
|
}
|
|
14
14
|
};
|
|
15
|
-
export const AppShellWithMenuNavigation = (args) => {
|
|
16
|
-
const [currentNodeId, setCurrentNodeId] = useState();
|
|
17
|
-
const [allNodes, setAllNodes] = useState(treeList);
|
|
18
|
-
const onNodeClick = (id) => {
|
|
19
|
-
const clickedNode = treeHelpers.getNode(allNodes, id);
|
|
20
|
-
if (!clickedNode?.nodes) {
|
|
21
|
-
setCurrentNodeId(id);
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
setAllNodes(tree => treeHelpers.mapNode(tree, id, node => {
|
|
25
|
-
return {
|
|
26
|
-
...node,
|
|
27
|
-
expanded: !node.expanded
|
|
28
|
-
};
|
|
29
|
-
}));
|
|
30
|
-
return (<StandardTree nodes={recordMenuList} onNodeClick={onNodeClick} currentNodeId={currentNodeId}/>);
|
|
31
|
-
};
|
|
32
|
-
const appHeader = {
|
|
33
|
-
brand: {
|
|
34
|
-
name: 'AppStudioX'
|
|
35
|
-
},
|
|
36
|
-
utils: {
|
|
37
|
-
avatar: { name: 'Alan' },
|
|
38
|
-
search: {
|
|
39
|
-
placeholder: 'Search anything, anywhere'
|
|
40
|
-
},
|
|
41
|
-
branchName: 'test',
|
|
42
|
-
actions: [
|
|
43
|
-
{
|
|
44
|
-
primary: 'Switch branch',
|
|
45
|
-
id: 'switchbranch',
|
|
46
|
-
onClick: action('Clicked switchbranch')
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
primary: 'Create branch',
|
|
50
|
-
id: 'createbranch',
|
|
51
|
-
onClick: action('Clicked createbranch')
|
|
52
|
-
}
|
|
53
|
-
]
|
|
54
|
-
},
|
|
55
|
-
links: [
|
|
56
|
-
{
|
|
57
|
-
id: '1',
|
|
58
|
-
name: 'Applications',
|
|
59
|
-
onClick: action('Clicked Applications')
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
id: '2',
|
|
63
|
-
name: 'Shared resources',
|
|
64
|
-
onClick: action('Clicked Shared resources')
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
id: '3',
|
|
68
|
-
name: 'Teams',
|
|
69
|
-
onClick: () => { }
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
id: '4',
|
|
73
|
-
name: 'AI & Analytics',
|
|
74
|
-
onClick: action('Clicked AI & Analytics')
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
id: '5',
|
|
78
|
-
name: 'Deploy',
|
|
79
|
-
onClick: action('Clicked Deploy')
|
|
80
|
-
}
|
|
81
|
-
]
|
|
82
|
-
};
|
|
83
|
-
return (<Configuration theme={BuildTheme}>
|
|
84
|
-
<AppShell main={args.main} appHeader={appHeader} hideNav={args.hideNavigation} appInfo={{
|
|
85
|
-
text: 'xCompass',
|
|
86
|
-
visual: {
|
|
87
|
-
icon: {
|
|
88
|
-
name: 'compass',
|
|
89
|
-
bgColor: '#20AA50'
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}} navigation={{
|
|
93
|
-
nodes: allNodes,
|
|
94
|
-
currentNodeId,
|
|
95
|
-
onNodeClick
|
|
96
|
-
}} utils={{
|
|
97
|
-
onItemClick: id => {
|
|
98
|
-
if (id === 'explorer') {
|
|
99
|
-
setAllNodes(appExplorerMenuList);
|
|
100
|
-
}
|
|
101
|
-
if (id === 'branches') {
|
|
102
|
-
setAllNodes(branchesMenuList);
|
|
103
|
-
}
|
|
104
|
-
if (id === 'records') {
|
|
105
|
-
setAllNodes(recordMenuList);
|
|
106
|
-
}
|
|
107
|
-
},
|
|
108
|
-
items: [
|
|
109
|
-
{
|
|
110
|
-
label: 'App Explorer',
|
|
111
|
-
id: 'explorer'
|
|
112
|
-
},
|
|
113
|
-
{
|
|
114
|
-
label: 'Branches',
|
|
115
|
-
id: 'branches'
|
|
116
|
-
},
|
|
117
|
-
{
|
|
118
|
-
label: 'Records',
|
|
119
|
-
id: 'records'
|
|
120
|
-
}
|
|
121
|
-
],
|
|
122
|
-
drawer: {
|
|
123
|
-
onBeforeClose: () => setAllNodes(treeList)
|
|
124
|
-
}
|
|
125
|
-
}}/>
|
|
126
|
-
</Configuration>);
|
|
127
|
-
};
|
|
128
15
|
export const PageTemplatesDemo = (args) => {
|
|
129
16
|
const [currentTabId, setCurrentTabId] = useState('accounts');
|
|
130
|
-
const [content, setContent] = useState(
|
|
131
|
-
<TableDemo />
|
|
132
|
-
</>);
|
|
17
|
+
const [content, setContent] = useState(<TableDemo />);
|
|
133
18
|
const { create } = useContext(ModalManagerContext);
|
|
134
19
|
const getPath = () => {
|
|
135
20
|
if (args.showBreadcrumbs) {
|
|
@@ -165,9 +50,122 @@ export const PageTemplatesDemo = (args) => {
|
|
|
165
50
|
<Text>This is the content of the Modal.</Text>
|
|
166
51
|
</Modal>
|
|
167
52
|
</Configuration>);
|
|
53
|
+
const AppShellWithMenuNavigation = ({ main, hideNavigation }) => {
|
|
54
|
+
const [currentNodeId, setCurrentNodeId] = useState();
|
|
55
|
+
const [allNodes, setAllNodes] = useState(treeList);
|
|
56
|
+
const onNodeClick = (id) => {
|
|
57
|
+
const clickedNode = treeHelpers.getNode(allNodes, id);
|
|
58
|
+
if (!clickedNode?.nodes) {
|
|
59
|
+
setCurrentNodeId(id);
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
setAllNodes(tree => treeHelpers.mapNode(tree, id, node => {
|
|
63
|
+
return {
|
|
64
|
+
...node,
|
|
65
|
+
expanded: !node.expanded
|
|
66
|
+
};
|
|
67
|
+
}));
|
|
68
|
+
return (<StandardTree nodes={recordMenuList} onNodeClick={onNodeClick} currentNodeId={currentNodeId}/>);
|
|
69
|
+
};
|
|
70
|
+
const appHeader = {
|
|
71
|
+
brand: {
|
|
72
|
+
name: 'AppStudioX',
|
|
73
|
+
visual: {
|
|
74
|
+
icon: 'pegasus'
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
utils: {
|
|
78
|
+
avatar: { name: 'Alan' },
|
|
79
|
+
search: {
|
|
80
|
+
placeholder: 'Search anything, anywhere'
|
|
81
|
+
},
|
|
82
|
+
branchName: 'test',
|
|
83
|
+
actions: [
|
|
84
|
+
{
|
|
85
|
+
primary: 'Switch branch',
|
|
86
|
+
id: 'switchbranch',
|
|
87
|
+
onClick: action('Clicked switchbranch')
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
primary: 'Create branch',
|
|
91
|
+
id: 'createbranch',
|
|
92
|
+
onClick: action('Clicked createbranch')
|
|
93
|
+
}
|
|
94
|
+
]
|
|
95
|
+
},
|
|
96
|
+
links: [
|
|
97
|
+
{
|
|
98
|
+
id: '1',
|
|
99
|
+
name: 'Applications',
|
|
100
|
+
onClick: action('Clicked Applications')
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
id: '2',
|
|
104
|
+
name: 'Shared resources',
|
|
105
|
+
onClick: action('Clicked Shared resources')
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
id: '3',
|
|
109
|
+
name: 'Teams',
|
|
110
|
+
onClick: () => { }
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
id: '4',
|
|
114
|
+
name: 'AI & Analytics',
|
|
115
|
+
onClick: action('Clicked AI & Analytics')
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
id: '5',
|
|
119
|
+
name: 'Deploy',
|
|
120
|
+
onClick: action('Clicked Deploy')
|
|
121
|
+
}
|
|
122
|
+
]
|
|
123
|
+
};
|
|
124
|
+
return (<Configuration theme={BuildTheme}>
|
|
125
|
+
<AppShell main={main} appHeader={appHeader} hideNav={hideNavigation} appInfo={{
|
|
126
|
+
text: 'xCompass',
|
|
127
|
+
visual: {
|
|
128
|
+
icon: 'compass',
|
|
129
|
+
backgroundColor: '#20AA50'
|
|
130
|
+
}
|
|
131
|
+
}} navigation={{
|
|
132
|
+
nodes: allNodes,
|
|
133
|
+
currentNodeId,
|
|
134
|
+
onNodeClick
|
|
135
|
+
}} utils={{
|
|
136
|
+
onItemClick: id => {
|
|
137
|
+
if (id === 'explorer') {
|
|
138
|
+
setAllNodes(appExplorerMenuList);
|
|
139
|
+
}
|
|
140
|
+
if (id === 'branches') {
|
|
141
|
+
setAllNodes(branchesMenuList);
|
|
142
|
+
}
|
|
143
|
+
if (id === 'records') {
|
|
144
|
+
setAllNodes(recordMenuList);
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
items: [
|
|
148
|
+
{
|
|
149
|
+
label: 'App Explorer',
|
|
150
|
+
id: 'explorer'
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
label: 'Branches',
|
|
154
|
+
id: 'branches'
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
label: 'Records',
|
|
158
|
+
id: 'records'
|
|
159
|
+
}
|
|
160
|
+
],
|
|
161
|
+
drawer: {
|
|
162
|
+
onBeforeClose: () => setAllNodes(treeList)
|
|
163
|
+
}
|
|
164
|
+
}}/>
|
|
165
|
+
</Configuration>);
|
|
166
|
+
};
|
|
168
167
|
const pageTemplateProps = useMemo(() => {
|
|
169
|
-
const
|
|
170
|
-
const status = args.showBranch
|
|
168
|
+
const status = args.showStatus
|
|
171
169
|
? {
|
|
172
170
|
type: args.statusVariant,
|
|
173
171
|
label: args.statusLabel
|
|
@@ -178,7 +176,6 @@ export const PageTemplatesDemo = (args) => {
|
|
|
178
176
|
actions,
|
|
179
177
|
banners,
|
|
180
178
|
path: getPath(),
|
|
181
|
-
branchName,
|
|
182
179
|
status,
|
|
183
180
|
metadata: [
|
|
184
181
|
{ id: '1', name: 'ID', value: 'InterestRate' },
|
|
@@ -230,13 +227,15 @@ export const PageTemplatesDemo = (args) => {
|
|
|
230
227
|
};
|
|
231
228
|
}, [args]);
|
|
232
229
|
let demo;
|
|
230
|
+
const [openDrawer, setOpenDrawer] = useState(false);
|
|
233
231
|
switch (args.template) {
|
|
234
232
|
case 'one column':
|
|
235
233
|
demo = <OneColumnPage a={mainContent} {...pageTemplateProps}/>;
|
|
236
234
|
break;
|
|
237
235
|
case 'tabbed':
|
|
238
236
|
default:
|
|
239
|
-
demo = (
|
|
237
|
+
demo = (<>
|
|
238
|
+
<TabbedPage a={content} tabs={{
|
|
240
239
|
tabs: [
|
|
241
240
|
{ id: 'accounts', name: 'Accounts' },
|
|
242
241
|
{ id: 'form', name: 'Form' },
|
|
@@ -248,7 +247,9 @@ export const PageTemplatesDemo = (args) => {
|
|
|
248
247
|
setCurrentTabId(id);
|
|
249
248
|
switch (id) {
|
|
250
249
|
case 'form':
|
|
251
|
-
setContent(<OneColumnForm
|
|
250
|
+
setContent(<OneColumnForm previewCallback={() => {
|
|
251
|
+
setOpenDrawer(true);
|
|
252
|
+
}}/>);
|
|
252
253
|
break;
|
|
253
254
|
case 'accounts':
|
|
254
255
|
setContent(<TableDemo />);
|
|
@@ -259,7 +260,72 @@ export const PageTemplatesDemo = (args) => {
|
|
|
259
260
|
default:
|
|
260
261
|
}
|
|
261
262
|
}
|
|
262
|
-
}} {...pageTemplateProps}/>
|
|
263
|
+
}} {...pageTemplateProps}/>
|
|
264
|
+
<ObjectPreview open={openDrawer} onDismiss={() => setOpenDrawer(false)} header={{
|
|
265
|
+
title: 'Interest rate',
|
|
266
|
+
metadata: [
|
|
267
|
+
{ id: '1', name: 'ID', value: 'InterestRate' },
|
|
268
|
+
{ id: '2', name: 'Rule type', value: 'Field' },
|
|
269
|
+
{
|
|
270
|
+
id: '3',
|
|
271
|
+
name: 'Scope',
|
|
272
|
+
value: 'O1XPTI-CCompass-Work-MortgageRequest'
|
|
273
|
+
},
|
|
274
|
+
{ id: '4', name: 'Application', value: 'XCompass' }
|
|
275
|
+
],
|
|
276
|
+
additionalInfo: {
|
|
277
|
+
title: 'Interest rate',
|
|
278
|
+
description: 'Interest rate for the savings account',
|
|
279
|
+
fields: [
|
|
280
|
+
{
|
|
281
|
+
id: '1',
|
|
282
|
+
name: 'Id',
|
|
283
|
+
value: 'InterestRate'
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
id: '2',
|
|
287
|
+
name: 'Rule type',
|
|
288
|
+
value: 'Field'
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
id: '3',
|
|
292
|
+
name: 'Scope',
|
|
293
|
+
value: 'O1XPTI-CCompass-Work-MortgageRequest'
|
|
294
|
+
},
|
|
295
|
+
{
|
|
296
|
+
id: '4',
|
|
297
|
+
name: 'Branch',
|
|
298
|
+
value: 'xCompass (Main)'
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
id: '5',
|
|
302
|
+
name: 'Application',
|
|
303
|
+
value: 'XCompass'
|
|
304
|
+
}
|
|
305
|
+
],
|
|
306
|
+
onEdit: () => { }
|
|
307
|
+
}
|
|
308
|
+
}} content={<PreviewMainContent />} primaryAction={{
|
|
309
|
+
id: 'PA',
|
|
310
|
+
text: 'Save',
|
|
311
|
+
onClick: () => { }
|
|
312
|
+
}} secondaryAction={{
|
|
313
|
+
id: 'SA',
|
|
314
|
+
text: 'Open rule',
|
|
315
|
+
onClick: () => { }
|
|
316
|
+
}} additionalActions={{
|
|
317
|
+
items: [
|
|
318
|
+
{
|
|
319
|
+
id: '1',
|
|
320
|
+
text: 'Page action 1'
|
|
321
|
+
},
|
|
322
|
+
{
|
|
323
|
+
id: '2',
|
|
324
|
+
text: 'Page action 2'
|
|
325
|
+
}
|
|
326
|
+
]
|
|
327
|
+
}}/>
|
|
328
|
+
</>);
|
|
263
329
|
break;
|
|
264
330
|
}
|
|
265
331
|
return (<AppShellWithMenuNavigation main={demo} hideNavigation={args.hideNavigation}/>);
|
|
@@ -273,10 +339,9 @@ PageTemplatesDemo.args = {
|
|
|
273
339
|
pathData: 'Home,xCompass,Fields',
|
|
274
340
|
showActions: true,
|
|
275
341
|
showBanners: false,
|
|
276
|
-
|
|
342
|
+
showStatus: true,
|
|
277
343
|
statusVariant: 'pending',
|
|
278
344
|
statusLabel: 'private change',
|
|
279
|
-
branchName: 'xCompass (Main)',
|
|
280
345
|
showEditButton: true,
|
|
281
346
|
onEdit: action('Clicked edit button in popover')
|
|
282
347
|
};
|
|
@@ -292,13 +357,12 @@ PageTemplatesDemo.argTypes = {
|
|
|
292
357
|
pathData: { control: { type: 'text' } },
|
|
293
358
|
showActions: { control: { type: 'boolean' } },
|
|
294
359
|
showBanners: { control: { type: 'boolean' } },
|
|
295
|
-
|
|
360
|
+
showStatus: { control: { type: 'boolean' } },
|
|
296
361
|
statusVariant: {
|
|
297
362
|
options: ['success', 'urgent', 'warn', 'pending', 'info'],
|
|
298
363
|
control: { type: 'select' }
|
|
299
364
|
},
|
|
300
365
|
statusLabel: { control: { type: 'text' } },
|
|
301
|
-
branchName: { control: { type: 'text' } },
|
|
302
366
|
showEditButton: { control: { type: 'boolean' } },
|
|
303
367
|
onEdit: { table: { disable: true } }
|
|
304
368
|
};
|