@pega/cosmos-react-demos 3.0.0-dev.2.1 → 3.0.0-dev.3.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/DynamicContentEditor/DynamicContentEditor.stories.d.ts +6 -0
- package/jsx/build/DynamicContentEditor/DynamicContentEditor.stories.d.ts.map +1 -0
- package/jsx/build/DynamicContentEditor/DynamicContentEditor.stories.jsx +64 -0
- package/jsx/build/DynamicContentEditor/DynamicContentEditor.stories.jsx.map +1 -0
- package/jsx/build/DynamicContentEditor/FieldSelector.d.ts +11 -0
- package/jsx/build/DynamicContentEditor/FieldSelector.d.ts.map +1 -0
- package/jsx/build/DynamicContentEditor/FieldSelector.jsx +80 -0
- package/jsx/build/DynamicContentEditor/FieldSelector.jsx.map +1 -0
- package/jsx/core/AppShell/AppShell.stories.jsx +1 -1
- package/jsx/core/AppShell/AppShell.stories.jsx.map +1 -1
- package/jsx/core/Card/Card.stories.jsx +1 -1
- package/jsx/core/Card/Card.stories.jsx.map +1 -1
- package/jsx/core/Checkbox/Checkbox.stories.jsx +1 -1
- package/jsx/core/Checkbox/Checkbox.stories.jsx.map +1 -1
- package/jsx/core/Currency/Currency.stories.d.ts +5 -2
- package/jsx/core/Currency/Currency.stories.d.ts.map +1 -1
- package/jsx/core/Currency/Currency.stories.jsx +30 -12
- package/jsx/core/Currency/Currency.stories.jsx.map +1 -1
- package/jsx/core/Form/Form.stories.jsx +2 -2
- package/jsx/core/Form/Form.stories.jsx.map +1 -1
- package/jsx/core/Modal/Modal.stories.d.ts.map +1 -1
- package/jsx/core/Modal/Modal.stories.jsx +29 -43
- package/jsx/core/Modal/Modal.stories.jsx.map +1 -1
- package/jsx/core/Number/Number.stories.d.ts +3 -3
- package/jsx/core/Number/Number.stories.d.ts.map +1 -1
- package/jsx/core/Number/Number.stories.jsx +14 -10
- package/jsx/core/Number/Number.stories.jsx.map +1 -1
- package/jsx/core/PageTemplates/PageTemplates.stories.d.ts +5 -3
- package/jsx/core/PageTemplates/PageTemplates.stories.d.ts.map +1 -1
- package/jsx/core/PageTemplates/PageTemplates.stories.jsx +102 -26
- package/jsx/core/PageTemplates/PageTemplates.stories.jsx.map +1 -1
- package/jsx/core/RadioButton/RadioButton.stories.jsx +1 -1
- package/jsx/core/RadioButton/RadioButton.stories.jsx.map +1 -1
- package/jsx/core/Rating/Rating.stories.jsx +1 -1
- package/jsx/core/Rating/Rating.stories.jsx.map +1 -1
- package/jsx/core/Sentiment/Sentiment.stories.jsx +4 -4
- package/jsx/core/Sentiment/Sentiment.stories.jsx.map +1 -1
- package/jsx/core/Table/Table.mocks.d.ts +6 -0
- package/jsx/core/Table/Table.mocks.d.ts.map +1 -1
- package/jsx/core/Table/Table.mocks.jsx +134 -0
- package/jsx/core/Table/Table.mocks.jsx.map +1 -1
- package/jsx/core/Table/Table.stories.jsx +2 -2
- package/jsx/core/Table/Table.stories.jsx.map +1 -1
- package/jsx/rte/Editor/Editor.stories.jsx +1 -1
- package/jsx/rte/Editor/Editor.stories.jsx.map +1 -1
- package/jsx/social/Email/Email.mocks.d.ts +19 -2
- package/jsx/social/Email/Email.mocks.d.ts.map +1 -1
- package/jsx/social/Email/Email.mocks.js +48 -1
- package/jsx/social/Email/Email.mocks.js.map +1 -1
- package/jsx/social/Email/Email.stories.d.ts +1 -1
- package/jsx/social/Email/Email.stories.d.ts.map +1 -1
- package/jsx/social/Email/Email.stories.jsx +57 -14
- package/jsx/social/Email/Email.stories.jsx.map +1 -1
- package/jsx/work/Details/Details.stories.jsx +3 -3
- package/jsx/work/Details/Details.stories.jsx.map +1 -1
- package/jsx/work/Stakeholders/Stakeholders.mocks.jsx +1 -1
- package/jsx/work/Stakeholders/Stakeholders.mocks.jsx.map +1 -1
- package/lib/build/DynamicContentEditor/DynamicContentEditor.stories.d.ts +6 -0
- package/lib/build/DynamicContentEditor/DynamicContentEditor.stories.d.ts.map +1 -0
- package/lib/build/DynamicContentEditor/DynamicContentEditor.stories.js +48 -0
- package/lib/build/DynamicContentEditor/DynamicContentEditor.stories.js.map +1 -0
- package/lib/build/DynamicContentEditor/FieldSelector.d.ts +14 -0
- package/lib/build/DynamicContentEditor/FieldSelector.d.ts.map +1 -0
- package/lib/build/DynamicContentEditor/FieldSelector.js +81 -0
- package/lib/build/DynamicContentEditor/FieldSelector.js.map +1 -0
- package/lib/core/AppShell/AppShell.stories.js +1 -1
- package/lib/core/AppShell/AppShell.stories.js.map +1 -1
- package/lib/core/Card/Card.stories.js +1 -1
- package/lib/core/Card/Card.stories.js.map +1 -1
- package/lib/core/Checkbox/Checkbox.stories.js +1 -1
- package/lib/core/Checkbox/Checkbox.stories.js.map +1 -1
- package/lib/core/Currency/Currency.stories.d.ts +5 -2
- package/lib/core/Currency/Currency.stories.d.ts.map +1 -1
- package/lib/core/Currency/Currency.stories.js +30 -12
- package/lib/core/Currency/Currency.stories.js.map +1 -1
- package/lib/core/Form/Form.stories.js +2 -2
- package/lib/core/Form/Form.stories.js.map +1 -1
- package/lib/core/Modal/Modal.stories.d.ts.map +1 -1
- package/lib/core/Modal/Modal.stories.js +14 -14
- package/lib/core/Modal/Modal.stories.js.map +1 -1
- package/lib/core/Number/Number.stories.d.ts +3 -3
- package/lib/core/Number/Number.stories.d.ts.map +1 -1
- package/lib/core/Number/Number.stories.js +14 -10
- package/lib/core/Number/Number.stories.js.map +1 -1
- package/lib/core/PageTemplates/PageTemplates.stories.d.ts +5 -3
- package/lib/core/PageTemplates/PageTemplates.stories.d.ts.map +1 -1
- package/lib/core/PageTemplates/PageTemplates.stories.js +91 -23
- package/lib/core/PageTemplates/PageTemplates.stories.js.map +1 -1
- package/lib/core/RadioButton/RadioButton.stories.js +1 -1
- package/lib/core/RadioButton/RadioButton.stories.js.map +1 -1
- package/lib/core/Rating/Rating.stories.js +1 -1
- package/lib/core/Rating/Rating.stories.js.map +1 -1
- package/lib/core/Sentiment/Sentiment.stories.js +2 -2
- package/lib/core/Sentiment/Sentiment.stories.js.map +1 -1
- package/lib/core/Table/Table.mocks.d.ts +6 -0
- package/lib/core/Table/Table.mocks.d.ts.map +1 -1
- package/lib/core/Table/Table.mocks.js +134 -0
- package/lib/core/Table/Table.mocks.js.map +1 -1
- package/lib/core/Table/Table.stories.js +2 -2
- package/lib/core/Table/Table.stories.js.map +1 -1
- package/lib/rte/Editor/Editor.stories.js +1 -1
- package/lib/rte/Editor/Editor.stories.js.map +1 -1
- package/lib/social/Email/Email.mocks.d.ts +19 -2
- package/lib/social/Email/Email.mocks.d.ts.map +1 -1
- package/lib/social/Email/Email.mocks.js +48 -1
- package/lib/social/Email/Email.mocks.js.map +1 -1
- package/lib/social/Email/Email.stories.d.ts +1 -1
- package/lib/social/Email/Email.stories.d.ts.map +1 -1
- package/lib/social/Email/Email.stories.js +40 -14
- package/lib/social/Email/Email.stories.js.map +1 -1
- package/lib/work/Details/Details.stories.js +3 -3
- package/lib/work/Details/Details.stories.js.map +1 -1
- package/lib/work/Stakeholders/Stakeholders.mocks.js +1 -1
- package/lib/work/Stakeholders/Stakeholders.mocks.js.map +1 -1
- package/package.json +9 -9
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Meta } from '@storybook/react';
|
|
3
|
+
declare const _default: Meta<import("@storybook/react").Args>;
|
|
4
|
+
export default _default;
|
|
5
|
+
export declare const DynamicContentEditorDemo: () => JSX.Element;
|
|
6
|
+
//# sourceMappingURL=DynamicContentEditor.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DynamicContentEditor.stories.d.ts","sourceRoot":"","sources":["../../../src/build/DynamicContentEditor/DynamicContentEditor.stories.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;;AAmBxC,wBAGU;AAEV,eAAO,MAAM,wBAAwB,mBAwFpC,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { useRef, useState, useCallback } from 'react';
|
|
2
|
+
import { Button, Card, CardContent, CardFooter, Flex, TextArea, useAutoResize, useConsolidatedRef, useI18n } from '@pega/cosmos-react-core';
|
|
3
|
+
import { DynamicContentEditor } from '@pega/cosmos-react-build';
|
|
4
|
+
import FieldSelector from './FieldSelector';
|
|
5
|
+
export default {
|
|
6
|
+
title: 'Build/DynamicContentEditor',
|
|
7
|
+
component: DynamicContentEditor
|
|
8
|
+
};
|
|
9
|
+
export const DynamicContentEditorDemo = () => {
|
|
10
|
+
const [html, setHtml] = useState('<p>Hi <pega-reference role="button" contenteditable="false" data-rule-type="field" data-rule-id="CustomerName">CustomerName</pega-reference><p>please check this <a href="https://google.com">link</a></p></p>');
|
|
11
|
+
const rteRef = useRef(null);
|
|
12
|
+
const onImageAdded = (image, id) => {
|
|
13
|
+
const src = URL.createObjectURL(image);
|
|
14
|
+
rteRef.current?.appendImage({ src, alt: image.name }, id);
|
|
15
|
+
};
|
|
16
|
+
const [textAreaRef, resizeTextArea] = useAutoResize(undefined, 100);
|
|
17
|
+
const ref = useRef(null);
|
|
18
|
+
const consolidatedRef = useConsolidatedRef(textAreaRef, ref);
|
|
19
|
+
const handleShowHtml = () => {
|
|
20
|
+
resizeTextArea();
|
|
21
|
+
setHtml(rteRef.current?.getHtml() || '');
|
|
22
|
+
};
|
|
23
|
+
const t = useI18n();
|
|
24
|
+
const [selectedField, setSelectedField] = useState({
|
|
25
|
+
id: '',
|
|
26
|
+
text: ''
|
|
27
|
+
});
|
|
28
|
+
const updateSelection = (selectedItem) => {
|
|
29
|
+
setSelectedField(selectedItem);
|
|
30
|
+
};
|
|
31
|
+
const onSubmit = useCallback((insertField) => {
|
|
32
|
+
insertField(selectedField);
|
|
33
|
+
}, [selectedField]);
|
|
34
|
+
const dynamicContentPicker = (<Flex container={{
|
|
35
|
+
gap: 2,
|
|
36
|
+
direction: 'column'
|
|
37
|
+
}}>
|
|
38
|
+
<FieldSelector itemList={[
|
|
39
|
+
{ id: 'CustomerName', text: 'CustomerName' },
|
|
40
|
+
{ id: 'Address', text: 'Address' },
|
|
41
|
+
{ id: 'Locality', text: 'Locality' },
|
|
42
|
+
{ id: 'Country', text: 'Country' },
|
|
43
|
+
{ id: 'Region', text: 'Region' },
|
|
44
|
+
{ id: 'Occupation', text: 'Occupation' }
|
|
45
|
+
]} key={selectedField?.id} label='Field' updateSelection={updateSelection} placeholder={t('select')} defaultSelection={selectedField}/>
|
|
46
|
+
</Flex>);
|
|
47
|
+
return (<Flex container={{ direction: 'column', gap: 2 }}>
|
|
48
|
+
<Card>
|
|
49
|
+
<CardContent>
|
|
50
|
+
<TextArea value={html} onChange={e => setHtml(e.target.value)} autoResize ref={consolidatedRef}/>
|
|
51
|
+
</CardContent>
|
|
52
|
+
<CardFooter>
|
|
53
|
+
<Button onClick={() => rteRef.current?.insertHtml(html.trim(), true)}>
|
|
54
|
+
Overwrite RTE with new HTML
|
|
55
|
+
</Button>
|
|
56
|
+
</CardFooter>
|
|
57
|
+
</Card>
|
|
58
|
+
<DynamicContentEditor defaultValue={html} onImageAdded={onImageAdded} ref={rteRef} label='Dynamic content editor' toolbar={['inline-styling', 'lists', 'indentation', 'links', 'images']} form={{ onSubmit, dynamicContentPicker }} onActiveFieldChange={(field) => setSelectedField(field)}/>
|
|
59
|
+
<Flex container={{ gap: 1 }}>
|
|
60
|
+
<Button onClick={() => handleShowHtml()}>Show HTML</Button>
|
|
61
|
+
</Flex>
|
|
62
|
+
</Flex>);
|
|
63
|
+
};
|
|
64
|
+
//# sourceMappingURL=DynamicContentEditor.stories.jsx.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DynamicContentEditor.stories.jsx","sourceRoot":"","sources":["../../../src/build/DynamicContentEditor/DynamicContentEditor.stories.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAEtD,OAAO,EACL,MAAM,EACN,IAAI,EACJ,WAAW,EACX,UAAU,EACV,IA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\n Card,\n CardContent,\n CardFooter,\n Flex,\n TextArea,\n useAutoResize,\n useConsolidatedRef,\n useI18n\n} from '@pega/cosmos-react-core';\nimport { EditorState } from '@pega/cosmos-react-rte';\nimport { DynamicContentEditor, ItemType } from '@pega/cosmos-react-build';\n\nimport FieldSelector, { FieldSelectorProps } from './FieldSelector';\n\nexport default {\n title: 'Build/DynamicContentEditor',\n component: DynamicContentEditor\n} as Meta;\n\nexport const DynamicContentEditorDemo = () => {\n const [html, setHtml] = useState(\n '<p>Hi <pega-reference role=\"button\" contenteditable=\"false\" data-rule-type=\"field\" data-rule-id=\"CustomerName\">CustomerName</pega-reference><p>please check this <a href=\"https://google.com\">link</a></p></p>'\n );\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 const [textAreaRef, resizeTextArea] = useAutoResize<HTMLTextAreaElement>(undefined, 100);\n const ref = useRef(null);\n const consolidatedRef = useConsolidatedRef(textAreaRef, ref);\n const handleShowHtml = () => {\n resizeTextArea();\n setHtml(rteRef.current?.getHtml() || '');\n };\n const t = useI18n();\n const [selectedField, setSelectedField] = useState<ItemType>({\n id: '',\n text: ''\n });\n\n const updateSelection: FieldSelectorProps['updateSelection'] = (selectedItem: ItemType) => {\n setSelectedField(selectedItem);\n };\n const onSubmit = useCallback(\n (insertField: (selectedField: ItemType) => void) => {\n insertField(selectedField);\n },\n [selectedField]\n );\n\n const dynamicContentPicker = (\n <Flex\n container={{\n gap: 2,\n direction: 'column'\n }}\n >\n <FieldSelector\n itemList={[\n { id: 'CustomerName', text: 'CustomerName' },\n { id: 'Address', text: 'Address' },\n { id: 'Locality', text: 'Locality' },\n { id: 'Country', text: 'Country' },\n { id: 'Region', text: 'Region' },\n { id: 'Occupation', text: 'Occupation' }\n ]}\n key={selectedField?.id}\n label='Field'\n updateSelection={updateSelection}\n placeholder={t('select')}\n defaultSelection={selectedField}\n />\n </Flex>\n );\n return (\n <Flex container={{ direction: 'column', gap: 2 }}>\n <Card>\n <CardContent>\n <TextArea\n value={html}\n onChange={e => setHtml(e.target.value)}\n autoResize\n ref={consolidatedRef}\n />\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 <DynamicContentEditor\n defaultValue={html}\n onImageAdded={onImageAdded}\n ref={rteRef}\n label='Dynamic content editor'\n toolbar={['inline-styling', 'lists', 'indentation', 'links', 'images']}\n form={{ onSubmit, dynamicContentPicker }}\n onActiveFieldChange={(field: ItemType) => setSelectedField(field)}\n />\n <Flex container={{ gap: 1 }}>\n <Button onClick={() => handleShowHtml()}>Show HTML</Button>\n </Flex>\n </Flex>\n );\n};\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { FunctionComponent } from 'react';
|
|
2
|
+
import { ComboBoxProps, NoChildrenProp } from '@pega/cosmos-react-core';
|
|
3
|
+
import { ItemType } from '@pega/cosmos-react-build/lib/components/DynamicContentEditor/DynamicContentEditor.types';
|
|
4
|
+
export interface FieldSelectorProps extends NoChildrenProp {
|
|
5
|
+
itemList: ItemType[];
|
|
6
|
+
updateSelection: (selectedItem: ItemType, label: ComboBoxProps['label']) => void;
|
|
7
|
+
defaultSelection?: ItemType;
|
|
8
|
+
}
|
|
9
|
+
declare const FieldSelector: FunctionComponent<FieldSelectorProps & Pick<ComboBoxProps, 'label' | 'mode' | 'required' | 'placeholder'>>;
|
|
10
|
+
export default FieldSelector;
|
|
11
|
+
//# sourceMappingURL=FieldSelector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FieldSelector.d.ts","sourceRoot":"","sources":["../../../src/build/DynamicContentEditor/FieldSelector.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAe,iBAAiB,EAAkC,MAAM,OAAO,CAAC;AAEvF,OAAO,EAEL,aAAa,EAGb,cAAc,EAEf,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,yFAAyF,CAAC;AAEnH,MAAM,WAAW,kBAAmB,SAAQ,cAAc;IAExD,QAAQ,EAAE,QAAQ,EAAE,CAAC;IAErB,eAAe,EAAE,CAAC,YAAY,EAAE,QAAQ,EAAE,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC;IAEjF,gBAAgB,CAAC,EAAE,QAAQ,CAAC;CAC7B;AAED,QAAA,MAAM,aAAa,EAAE,iBAAiB,CACpC,kBAAkB,GAAG,IAAI,CAAC,aAAa,EAAE,OAAO,GAAG,MAAM,GAAG,UAAU,GAAG,aAAa,CAAC,CAiGxF,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { useMemo, useState, useCallback } from 'react';
|
|
2
|
+
import { ComboBox, createStringMatcher, useI18n } from '@pega/cosmos-react-core';
|
|
3
|
+
const FieldSelector = ({ itemList, label, mode = 'single-select', required = false, updateSelection, placeholder, defaultSelection }) => {
|
|
4
|
+
const t = useI18n();
|
|
5
|
+
const [filterValue, setFilterValue] = useState('');
|
|
6
|
+
const [items, setItems] = useState(() => {
|
|
7
|
+
return itemList.map(item => {
|
|
8
|
+
return {
|
|
9
|
+
id: item.id,
|
|
10
|
+
primary: item.text,
|
|
11
|
+
selected: defaultSelection ? defaultSelection.id === item.id : false
|
|
12
|
+
};
|
|
13
|
+
});
|
|
14
|
+
});
|
|
15
|
+
const filterRegex = createStringMatcher(filterValue, 'contains');
|
|
16
|
+
const itemsToRender = useMemo(() => {
|
|
17
|
+
return filterRegex ? items.filter(({ primary }) => filterRegex.test(primary)) : items;
|
|
18
|
+
}, [filterValue, items]);
|
|
19
|
+
const clearSelection = () => {
|
|
20
|
+
setItems(curr => {
|
|
21
|
+
return curr?.map(item => {
|
|
22
|
+
return {
|
|
23
|
+
...item,
|
|
24
|
+
selected: false
|
|
25
|
+
};
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
const selectItem = useCallback((id) => {
|
|
30
|
+
setFilterValue('');
|
|
31
|
+
setItems(curr => curr?.map(item => {
|
|
32
|
+
if (item.id === id) {
|
|
33
|
+
return {
|
|
34
|
+
...item,
|
|
35
|
+
selected: true
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
return { ...item, selected: false };
|
|
39
|
+
}));
|
|
40
|
+
const selectedItem = items?.find(item => item.id === id);
|
|
41
|
+
if (selectedItem?.id)
|
|
42
|
+
updateSelection({
|
|
43
|
+
id: selectedItem.id,
|
|
44
|
+
text: selectedItem.primary
|
|
45
|
+
}, label);
|
|
46
|
+
}, [filterValue, items]);
|
|
47
|
+
const selected = useMemo(() => {
|
|
48
|
+
return items?.find(item => item.selected);
|
|
49
|
+
}, [items]);
|
|
50
|
+
const comboBoxProps = {
|
|
51
|
+
label,
|
|
52
|
+
placeholder,
|
|
53
|
+
mode,
|
|
54
|
+
value: filterValue,
|
|
55
|
+
selected: selected
|
|
56
|
+
? {
|
|
57
|
+
items: {
|
|
58
|
+
id: selected.id,
|
|
59
|
+
text: selected.primary
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
: undefined,
|
|
63
|
+
onChange: (e) => {
|
|
64
|
+
if (e.target.value)
|
|
65
|
+
clearSelection();
|
|
66
|
+
setFilterValue(e.target.value);
|
|
67
|
+
},
|
|
68
|
+
onBlur: () => setFilterValue(''),
|
|
69
|
+
menu: {
|
|
70
|
+
items: itemsToRender,
|
|
71
|
+
accent: filterRegex,
|
|
72
|
+
onItemClick: selectItem,
|
|
73
|
+
emptyText: t('no_items')
|
|
74
|
+
},
|
|
75
|
+
required
|
|
76
|
+
};
|
|
77
|
+
return <ComboBox {...comboBoxProps}/>;
|
|
78
|
+
};
|
|
79
|
+
export default FieldSelector;
|
|
80
|
+
//# sourceMappingURL=FieldSelector.jsx.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"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AK;QACL,WAAW;QACX,IAAI;QACJ,KAAK,EAAE,WAAW;QAClB,QAAQ,EAAE,QAAQ;YAChB,CAAC,CAAC;gBACE,KAAK,EAAE;oBACL,EAAE,EAAE,QAAQ,CAAC,EAAE;oBACf,IAAI,EAAE,QAAQ,CAAC,OAAO;iBACvB;aACF;YACH,CAAC,CAAC,SAAS;QACb,QAAQ,EAAE,CAAC,CAAgC,EAAE,EAAE;YAC7C,IAAI,CAAC,CAAC,MAAM,CAAC,KAAK;gBAAE,cAAc,EAAE,CAAC;YACrC,cAAc,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACjC,CAAC;QACD,MAAM,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,EAAE,CAAC;QAChC,IAAI,EAAE;YACJ,KAAK,EAAE,aAAa;YACpB,MAAM,EAAE,WAAW;YACnB,WAAW,EAAE,UAAU;YACvB,SAAS,EAAE,CAAC,CAAC,UAAU,CAAC;SACzB;QACD,QAAQ;KACT,CAAC;IACF,OAAO,CAAC,QAAQ,CAAC,IAAI,aAAa,CAAC,EAAG,CAAC;AACzC,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["import { ChangeEvent, FunctionComponent, useMemo, useState, useCallback } from 'react';\n\nimport {\n ComboBox,\n ComboBoxProps,\n createStringMatcher,\n MenuItemProps,\n NoChildrenProp,\n useI18n\n} from '@pega/cosmos-react-core';\nimport { ItemType } from '@pega/cosmos-react-build/lib/components/DynamicContentEditor/DynamicContentEditor.types';\n\nexport interface FieldSelectorProps extends NoChildrenProp {\n /** Array of values for the combobox options. */\n itemList: ItemType[];\n /** Return selected item */\n updateSelection: (selectedItem: ItemType, label: ComboBoxProps['label']) => void;\n /** Default selected item */\n defaultSelection?: ItemType;\n}\n\nconst FieldSelector: FunctionComponent<\n FieldSelectorProps & Pick<ComboBoxProps, 'label' | 'mode' | 'required' | 'placeholder'>\n> = ({\n itemList,\n label,\n mode = 'single-select',\n required = false,\n updateSelection,\n placeholder,\n defaultSelection\n}) => {\n const t = useI18n();\n\n const [filterValue, setFilterValue] = useState('');\n const [items, setItems] = useState(() => {\n return itemList.map(item => {\n return {\n id: item.id,\n primary: item.text,\n selected: defaultSelection ? defaultSelection.id === item.id : false\n };\n });\n });\n\n const filterRegex = createStringMatcher(filterValue, 'contains');\n const itemsToRender = useMemo(() => {\n return filterRegex ? items.filter(({ primary }) => filterRegex.test(primary)) : items;\n }, [filterValue, items]);\n\n const clearSelection = () => {\n setItems(curr => {\n return curr?.map(item => {\n return {\n ...item,\n selected: false\n };\n });\n });\n };\n\n const selectItem = useCallback(\n (id: MenuItemProps['id']) => {\n setFilterValue('');\n setItems(curr =>\n curr?.map(item => {\n if (item.id === id) {\n return {\n ...item,\n selected: true\n };\n }\n return { ...item, selected: false };\n })\n );\n const selectedItem = items?.find(item => item.id === id);\n if (selectedItem?.id)\n updateSelection(\n {\n id: selectedItem.id,\n text: selectedItem.primary\n },\n label\n );\n },\n [filterValue, items]\n );\n\n const selected = useMemo(() => {\n return items?.find(item => item.selected);\n }, [items]);\n\n const comboBoxProps: ComboBoxProps = {\n label,\n placeholder,\n mode,\n value: filterValue,\n selected: selected\n ? {\n items: {\n id: selected.id,\n text: selected.primary\n }\n }\n : undefined,\n onChange: (e: ChangeEvent<HTMLInputElement>) => {\n if (e.target.value) clearSelection();\n setFilterValue(e.target.value);\n },\n onBlur: () => setFilterValue(''),\n menu: {\n items: itemsToRender,\n accent: filterRegex,\n onItemClick: selectItem,\n emptyText: t('no_items')\n },\n required\n };\n return <ComboBox {...comboBoxProps} />;\n};\n\nexport default FieldSelector;\n"]}
|
|
@@ -237,7 +237,7 @@ export const ConfigurableAppShell = (args) => {
|
|
|
237
237
|
};
|
|
238
238
|
ConfigurableAppShell.args = {
|
|
239
239
|
navColor: '#252c32',
|
|
240
|
-
headerColor: '#
|
|
240
|
+
headerColor: '#e2f1ff'
|
|
241
241
|
};
|
|
242
242
|
ConfigurableAppShell.argTypes = {
|
|
243
243
|
navColor: { control: { type: 'color' } },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppShell.stories.jsx","sourceRoot":"","sources":["../../../src/core/AppShell/AppShell.stories.tsx"],"names":[],"mappings":"AACA,OAAO,EAAc,UAAU,EAAa,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAErF,OAAO,EACL,QAAQ,EAER,YAAY,EAEZ,MAAM,EACN,SAAS,EACT,IAAI,EACJ,IAAI,EACJ,YAAY,EACZ,KAAK,EACL,MAAM,EACN,MAAM,EACN,KAAK,EACL,mBAAmB,EACnB,QAAQ,EACR,cAAc,EAEd,qBAAqB,EACrB,iBAAiB,EACjB,aAAa,EACd,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,aAAa,MAAM,mEAAmE,CAAC;AACnG,OAAO,KAAK,cAAc,MAAM,oEAAoE,CAAC;AAErG,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,oBAAoB,EACpB,cAAc,EACd,YAAY,EACb,MAAM,kBAAkB,CAAC;AAE1B,YAAY,CAAC,aAAa,EAAE,cAAc,CAAC,CAAC;AAE5C,eAAe;IACb,KAAK,EAAE,gBAAgB;IACvB,SAAS,EAAE,QAAQ;IACnB,EAAE,EAAE,WAAW;IACf,UAAU,EAAE;QACV,MAAM,EAAE,YAAY;KACrB;CACM,CAAC;AA+BV,MAAM,CAAC,MAAM,YAAY,GAA8B,CAAC,IAAwB,EAAE,EAAE;IAClF,MAAM,eAAe,GAAG,CAAC,EAAE,QAAQ,EAAwB,EAAE,EAAE;QAC7D,MAAM,EAAE,YAAY,EAAE,GAAG,UAAU,CAAC,mBAAmB,CAAC,CAAC;QACzD,MAAM,EAAE,OAAO,EAAE,GAAG,UAAU,CAAC,YAAY,CAAC,CAAC;QAC7C,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,GAAG,UAAU,CAAC,cAAc,CAAC,CAAC;QAEzD,OAAO,CACL,CAAC,KAAK,CACJ,EA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C,SAAS,EACzB;IAAA,EAAE,aAAa,CAAC,CACjB,CAAC;AACJ,CAAC,CAAC;AAEF,oBAAoB,CAAC,IAAI,GAAG;IAC1B,QAAQ,EAAE,SAAS;IACnB,WAAW,EAAE,SAAS;CACvB,CAAC;AAEF,oBAAoB,CAAC,QAAQ,GAAG;IAC9B,QAAQ,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE;IACxC,WAAW,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE;CAC5C,CAAC","sourcesContent":["import { Meta, Story } from '@storybook/react';\nimport { MouseEvent, useContext, FormEvent, useState, useMemo, useRef } from 'react';\n\nimport {\n AppShell,\n AppShellProps,\n AppShellList,\n DrawerItemProps,\n Button,\n DateInput,\n Grid,\n Icon,\n registerIcon,\n Input,\n Select,\n Option,\n Modal,\n ModalManagerContext,\n TextArea,\n ToasterContext,\n ForwardProps,\n useAfterInitialEffect,\n windowIsAvailable,\n Configuration\n} from '@pega/cosmos-react-core';\nimport * as bellSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/bell-solid.icon';\nimport * as clockSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/clock-solid.icon';\n\nimport {\n defaultLinks,\n defaultMainContent,\n defaultNotifications,\n defaultRecents,\n operatorData\n} from './AppShell.mocks';\n\nregisterIcon(bellSolidIcon, clockSolidIcon);\n\nexport default {\n title: 'Core/App Shell',\n component: AppShell,\n id: 'App Shell',\n parameters: {\n layout: 'fullscreen'\n }\n} as Meta;\n\ninterface AppShellStoryProps {\n /** Demo props */\n main?: AppShellProps['main'];\n appInfo?: AppShellProps['appInfo'];\n banners?: AppShellProps['banners'];\n cases?: AppShellProps['cases'];\n caseLinks?: AppShellProps['links'];\n createLinks?: any[];\n recentItems?: any[];\n utils?: AppShellProps['utils'];\n onLinkClick?: (name: string) => void;\n\n /** Storybook controls */\n appName?: AppShellProps['appInfo']['appName'];\n portalName?: AppShellProps['appInfo']['portalName'];\n href?: AppShellProps['appInfo']['href'];\n imageSrc?: AppShellProps['appInfo']['imageSrc'];\n fullImageSrc?: AppShellProps['appInfo']['fullImageSrc'];\n withSearch?: boolean;\n appHeader?: AppShellProps['appHeader'];\n environmentName?: string;\n environmentColor?: string;\n notificationsEmpty?: boolean;\n notificationsLoading?: boolean;\n recentsEmpty?: boolean;\n recentsLoading?: boolean;\n pinsLoading?: boolean;\n}\n\nexport const AppShellDemo: Story<AppShellStoryProps> = (args: AppShellStoryProps) => {\n const CreateCaseModal = ({ caseType }: { caseType: string }) => {\n const { ModalContext } = useContext(ModalManagerContext);\n const { dismiss } = useContext(ModalContext);\n const { push: pushToaster } = useContext(ToasterContext);\n\n return (\n <Modal\n as='form'\n heading={`New ${caseType}`}\n actions={\n <>\n <Button onClick={dismiss}>Cancel</Button>\n <Button\n variant='primary'\n type='submit'\n onClick={(e: FormEvent) => {\n e.preventDefault();\n dismiss();\n pushToaster({ content: `${caseType} requested` });\n }}\n >\n Request\n </Button>\n </>\n }\n >\n <Grid container={{ rowGap: 2 }}>\n <DateInput label='Date Requested' info={null} />\n <Select label='Department'>\n <Option value=''>Select…</Option>\n <Option value='Fire'>Fire</Option>\n <Option value='Facilities'>Facilities</Option>\n <Option value='Parks'>Parks</Option>\n <Option value='Sanitation'>Sanitation</Option>\n <Option value='Parking & Traffic'>Parking & Traffic</Option>\n <Option value='Police'>Police</Option>\n <Option value='Courts'>Courts</Option>\n <Option value='Healthcare'>Healthcare</Option>\n <Option value='Energy'>Energy</Option>\n <Option value='Justice department'>Justice department</Option>\n <Option value='Environmental'>Environmental</Option>\n </Select>\n <TextArea label='Purpose of Purchase' />\n <Select label='Desired Make'>\n <Option value=''>Select...</Option>\n <Option value='Ford'>Ford</Option>\n <Option value='Dodge'>Dodge</Option>\n <Option value='Toyota'>Toyota</Option>\n <Option value='Tesla'>Tesla</Option>\n </Select>\n <Input label='Desired Make' />\n <Input\n type='number'\n min='2016'\n max='2021'\n label='Year'\n info='Must be within last 5 years'\n />\n <Input\n type='number'\n min='0.01'\n step='0.01'\n max='50000'\n label='Estimated Cost'\n info='May not exceed $50,000.00'\n />\n </Grid>\n </Modal>\n );\n };\n\n const caseLinks = args.caseLinks || defaultLinks;\n const showSearch = args.withSearch !== undefined ? args.withSearch : true;\n\n const { create: createModal } = useContext(ModalManagerContext);\n const [links, setLinks] = useState<AppShellProps['links']>(caseLinks);\n const [notifications, setNotifications] =\n useState<(DrawerItemProps & ForwardProps)[]>(defaultNotifications);\n const [recents, setRecents] = useState<(DrawerItemProps & ForwardProps)[]>(\n args.recentItems || defaultRecents\n );\n const [numNewNotifications, setNumNewNotifications] = useState(\n notifications.filter(x => x.unread).length\n );\n const [searchVal, setSearchVal] = useState('');\n\n useAfterInitialEffect(() => {\n setLinks(caseLinks);\n }, [caseLinks]);\n\n const linksWithHandlers = useMemo<AppShellProps['links']>(() => {\n return (links || []).map(link => ({\n ...link,\n onClick(e: MouseEvent<HTMLAnchorElement>) {\n e.preventDefault();\n setLinks((prevLinks = []) => {\n return prevLinks.map(prevLink => {\n return { ...link, active: prevLink.name === link.name };\n });\n });\n args.onLinkClick?.(link.name);\n }\n }));\n }, [links]);\n\n const defaultCreateLinks = ['Vehicle Purchase'].map(name => ({\n name,\n onClick: () => {\n createModal(CreateCaseModal, { caseType: name });\n }\n }));\n\n const handleNotificationClick = (passedId: string) => {\n setNotifications(cur =>\n cur.map(({ id, unread, ...item }) => ({\n id,\n unread: passedId === id ? false : unread,\n ...item\n }))\n );\n };\n\n const handlePinToggle = (passedId: string) => {\n setRecents(cur =>\n cur.map(({ id, pinned, ...item }) => ({\n id,\n pinned: passedId === id ? !pinned : pinned,\n ...item\n }))\n );\n };\n\n const notificationViewItems = [\n {\n id: '234',\n items: args.notificationsEmpty ? [] : notifications,\n loading: args.notificationsLoading,\n onItemClick: handleNotificationClick,\n viewAll: {\n href: '#'\n },\n emptyText: 'No notifications'\n }\n ];\n\n const recentViewItems = [\n {\n id: '456',\n items: recents.filter(x => x.pinned),\n loading: args.pinsLoading,\n onItemPinToggle: handlePinToggle,\n viewAll: {\n href: '#'\n },\n displayPins: true,\n headingText: 'Pinned items',\n emptyText: 'No pinned items'\n },\n {\n id: '789',\n items: args.recentsEmpty ? [] : recents,\n loading: args.recentsLoading,\n onItemPinToggle: handlePinToggle,\n viewAll: {\n href: '#'\n },\n displayPins: true,\n headingText: 'Recently viewed',\n emptyText: 'No recents'\n }\n ];\n\n const newNotificationCountTimerRef = useRef(NaN);\n\n const defaultUtils = [\n {\n name: 'Notifications',\n visual: <Icon name='bell-solid' />,\n count: args.notificationsEmpty ? 0 : numNewNotifications,\n drawerView: <AppShellList listView={notificationViewItems} />,\n onDrawerOpen: () => {\n clearInterval(newNotificationCountTimerRef.current);\n setNumNewNotifications(0);\n },\n onDrawerClose: () => {\n if (windowIsAvailable) {\n // Mock new notifications arriving on a minute interval after the drawer closes.\n // Let's face it, you're popular.\n newNotificationCountTimerRef.current = window.setInterval(() => {\n setNumNewNotifications(cur => cur + 2);\n }, 60000);\n }\n }\n },\n {\n name: 'Recents',\n visual: <Icon name='clock-solid' />,\n drawerView: <AppShellList listView={recentViewItems} />\n }\n ];\n\n return (\n <AppShell\n appInfo={\n args.appInfo || {\n href: args.href || 'https://www.pega.com/',\n imageSrc:\n args.imageSrc ||\n 'https://pbs.twimg.com/profile_images/1410341211978752004/pLYjGIa8_bigger.jpg',\n fullImageSrc:\n args.fullImageSrc ||\n 'https://www.pega.com/themes/custom/pegawww_theme/images/pega-logo.svg',\n appName: args.appName || 'Cosmos AppShell',\n portalName: args.portalName || 'Demo'\n }\n }\n searchInput={\n showSearch\n ? {\n onSearchChange: (value: string) => {\n setSearchVal(value);\n },\n value: searchVal\n }\n : undefined\n }\n appHeader={args.appHeader}\n caseTypes={args.createLinks || defaultCreateLinks}\n links={linksWithHandlers}\n main={args.main || defaultMainContent}\n cases={args.cases}\n banners={args.banners}\n operator={operatorData}\n utils={args.utils || defaultUtils}\n environment={\n args.environmentName\n ? {\n name: args.environmentName,\n color: args.environmentColor\n }\n : undefined\n }\n />\n );\n};\n\nAppShellDemo.args = {\n appName: 'Cosmos AppShell',\n portalName: 'Demo',\n href: 'https://www.pega.com/',\n imageSrc: 'https://pbs.twimg.com/profile_images/1410341211978752004/pLYjGIa8_bigger.jpg',\n fullImageSrc: 'https://www.pega.com/themes/custom/pegawww_theme/images/pega-logo.svg',\n withSearch: true,\n appHeader: true,\n environmentName: 'dev',\n environmentColor: '#FFDBDE',\n notificationsEmpty: false,\n notificationsLoading: false,\n recentsEmpty: false,\n recentsLoading: false,\n pinsLoading: false\n};\n\nAppShellDemo.argTypes = {\n appName: { control: { type: 'text' } },\n portalName: { control: { type: 'text' } },\n href: { control: { type: 'text' } },\n imageSrc: { control: { type: 'text' } },\n fullImageSrc: { control: { type: 'text' } },\n withSearch: { control: { type: 'boolean' } },\n appHeader: { control: { type: 'boolean' } },\n environmentName: { control: { type: 'text' } },\n environmentColor: { control: { type: 'color' } },\n notificationsEmpty: { control: { type: 'boolean' } },\n notificationsLoading: { control: { type: 'boolean' } },\n recentsEmpty: { control: { type: 'boolean' } },\n recentsLoading: { control: { type: 'boolean' } },\n pinsLoading: { control: { type: 'boolean' } }\n};\n\ninterface ConfigurableAppShellProps {\n navColor?: string;\n headerColor?: string;\n}\n\nexport const ConfigurableAppShell: Story<ConfigurableAppShellProps> = (\n args: ConfigurableAppShellProps\n) => {\n return (\n <Configuration\n theme={{\n components: {\n 'app-shell': {\n nav: {\n 'background-color': args.navColor\n },\n header: {\n 'background-color': args.headerColor\n }\n }\n }\n }}\n >\n <AppShellDemo appHeader />\n </Configuration>\n );\n};\n\nConfigurableAppShell.args = {\n navColor: '#252c32',\n headerColor: '#ffffff'\n};\n\nConfigurableAppShell.argTypes = {\n navColor: { control: { type: 'color' } },\n headerColor: { control: { type: 'color' } }\n};\n"]}
|
|
1
|
+
{"version":3,"file":"AppShell.stories.jsx","sourceRoot":"","sources":["../../../src/core/AppShell/App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AAE,SAAS;IACnB,WAAW,EAAE,SAAS;CACvB,CAAC;AAEF,oBAAoB,CAAC,QAAQ,GAAG;IAC9B,QAAQ,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE;IACxC,WAAW,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE;CAC5C,CAAC","sourcesContent":["import { Meta, Story } from '@storybook/react';\nimport { MouseEvent, useContext, FormEvent, useState, useMemo, useRef } from 'react';\n\nimport {\n AppShell,\n AppShellProps,\n AppShellList,\n DrawerItemProps,\n Button,\n DateInput,\n Grid,\n Icon,\n registerIcon,\n Input,\n Select,\n Option,\n Modal,\n ModalManagerContext,\n TextArea,\n ToasterContext,\n ForwardProps,\n useAfterInitialEffect,\n windowIsAvailable,\n Configuration\n} from '@pega/cosmos-react-core';\nimport * as bellSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/bell-solid.icon';\nimport * as clockSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/clock-solid.icon';\n\nimport {\n defaultLinks,\n defaultMainContent,\n defaultNotifications,\n defaultRecents,\n operatorData\n} from './AppShell.mocks';\n\nregisterIcon(bellSolidIcon, clockSolidIcon);\n\nexport default {\n title: 'Core/App Shell',\n component: AppShell,\n id: 'App Shell',\n parameters: {\n layout: 'fullscreen'\n }\n} as Meta;\n\ninterface AppShellStoryProps {\n /** Demo props */\n main?: AppShellProps['main'];\n appInfo?: AppShellProps['appInfo'];\n banners?: AppShellProps['banners'];\n cases?: AppShellProps['cases'];\n caseLinks?: AppShellProps['links'];\n createLinks?: any[];\n recentItems?: any[];\n utils?: AppShellProps['utils'];\n onLinkClick?: (name: string) => void;\n\n /** Storybook controls */\n appName?: AppShellProps['appInfo']['appName'];\n portalName?: AppShellProps['appInfo']['portalName'];\n href?: AppShellProps['appInfo']['href'];\n imageSrc?: AppShellProps['appInfo']['imageSrc'];\n fullImageSrc?: AppShellProps['appInfo']['fullImageSrc'];\n withSearch?: boolean;\n appHeader?: AppShellProps['appHeader'];\n environmentName?: string;\n environmentColor?: string;\n notificationsEmpty?: boolean;\n notificationsLoading?: boolean;\n recentsEmpty?: boolean;\n recentsLoading?: boolean;\n pinsLoading?: boolean;\n}\n\nexport const AppShellDemo: Story<AppShellStoryProps> = (args: AppShellStoryProps) => {\n const CreateCaseModal = ({ caseType }: { caseType: string }) => {\n const { ModalContext } = useContext(ModalManagerContext);\n const { dismiss } = useContext(ModalContext);\n const { push: pushToaster } = useContext(ToasterContext);\n\n return (\n <Modal\n as='form'\n heading={`New ${caseType}`}\n actions={\n <>\n <Button onClick={dismiss}>Cancel</Button>\n <Button\n variant='primary'\n type='submit'\n onClick={(e: FormEvent) => {\n e.preventDefault();\n dismiss();\n pushToaster({ content: `${caseType} requested` });\n }}\n >\n Request\n </Button>\n </>\n }\n >\n <Grid container={{ rowGap: 2 }}>\n <DateInput label='Date Requested' info={null} />\n <Select label='Department'>\n <Option value=''>Select…</Option>\n <Option value='Fire'>Fire</Option>\n <Option value='Facilities'>Facilities</Option>\n <Option value='Parks'>Parks</Option>\n <Option value='Sanitation'>Sanitation</Option>\n <Option value='Parking & Traffic'>Parking & Traffic</Option>\n <Option value='Police'>Police</Option>\n <Option value='Courts'>Courts</Option>\n <Option value='Healthcare'>Healthcare</Option>\n <Option value='Energy'>Energy</Option>\n <Option value='Justice department'>Justice department</Option>\n <Option value='Environmental'>Environmental</Option>\n </Select>\n <TextArea label='Purpose of Purchase' />\n <Select label='Desired Make'>\n <Option value=''>Select...</Option>\n <Option value='Ford'>Ford</Option>\n <Option value='Dodge'>Dodge</Option>\n <Option value='Toyota'>Toyota</Option>\n <Option value='Tesla'>Tesla</Option>\n </Select>\n <Input label='Desired Make' />\n <Input\n type='number'\n min='2016'\n max='2021'\n label='Year'\n info='Must be within last 5 years'\n />\n <Input\n type='number'\n min='0.01'\n step='0.01'\n max='50000'\n label='Estimated Cost'\n info='May not exceed $50,000.00'\n />\n </Grid>\n </Modal>\n );\n };\n\n const caseLinks = args.caseLinks || defaultLinks;\n const showSearch = args.withSearch !== undefined ? args.withSearch : true;\n\n const { create: createModal } = useContext(ModalManagerContext);\n const [links, setLinks] = useState<AppShellProps['links']>(caseLinks);\n const [notifications, setNotifications] =\n useState<(DrawerItemProps & ForwardProps)[]>(defaultNotifications);\n const [recents, setRecents] = useState<(DrawerItemProps & ForwardProps)[]>(\n args.recentItems || defaultRecents\n );\n const [numNewNotifications, setNumNewNotifications] = useState(\n notifications.filter(x => x.unread).length\n );\n const [searchVal, setSearchVal] = useState('');\n\n useAfterInitialEffect(() => {\n setLinks(caseLinks);\n }, [caseLinks]);\n\n const linksWithHandlers = useMemo<AppShellProps['links']>(() => {\n return (links || []).map(link => ({\n ...link,\n onClick(e: MouseEvent<HTMLAnchorElement>) {\n e.preventDefault();\n setLinks((prevLinks = []) => {\n return prevLinks.map(prevLink => {\n return { ...link, active: prevLink.name === link.name };\n });\n });\n args.onLinkClick?.(link.name);\n }\n }));\n }, [links]);\n\n const defaultCreateLinks = ['Vehicle Purchase'].map(name => ({\n name,\n onClick: () => {\n createModal(CreateCaseModal, { caseType: name });\n }\n }));\n\n const handleNotificationClick = (passedId: string) => {\n setNotifications(cur =>\n cur.map(({ id, unread, ...item }) => ({\n id,\n unread: passedId === id ? false : unread,\n ...item\n }))\n );\n };\n\n const handlePinToggle = (passedId: string) => {\n setRecents(cur =>\n cur.map(({ id, pinned, ...item }) => ({\n id,\n pinned: passedId === id ? !pinned : pinned,\n ...item\n }))\n );\n };\n\n const notificationViewItems = [\n {\n id: '234',\n items: args.notificationsEmpty ? [] : notifications,\n loading: args.notificationsLoading,\n onItemClick: handleNotificationClick,\n viewAll: {\n href: '#'\n },\n emptyText: 'No notifications'\n }\n ];\n\n const recentViewItems = [\n {\n id: '456',\n items: recents.filter(x => x.pinned),\n loading: args.pinsLoading,\n onItemPinToggle: handlePinToggle,\n viewAll: {\n href: '#'\n },\n displayPins: true,\n headingText: 'Pinned items',\n emptyText: 'No pinned items'\n },\n {\n id: '789',\n items: args.recentsEmpty ? [] : recents,\n loading: args.recentsLoading,\n onItemPinToggle: handlePinToggle,\n viewAll: {\n href: '#'\n },\n displayPins: true,\n headingText: 'Recently viewed',\n emptyText: 'No recents'\n }\n ];\n\n const newNotificationCountTimerRef = useRef(NaN);\n\n const defaultUtils = [\n {\n name: 'Notifications',\n visual: <Icon name='bell-solid' />,\n count: args.notificationsEmpty ? 0 : numNewNotifications,\n drawerView: <AppShellList listView={notificationViewItems} />,\n onDrawerOpen: () => {\n clearInterval(newNotificationCountTimerRef.current);\n setNumNewNotifications(0);\n },\n onDrawerClose: () => {\n if (windowIsAvailable) {\n // Mock new notifications arriving on a minute interval after the drawer closes.\n // Let's face it, you're popular.\n newNotificationCountTimerRef.current = window.setInterval(() => {\n setNumNewNotifications(cur => cur + 2);\n }, 60000);\n }\n }\n },\n {\n name: 'Recents',\n visual: <Icon name='clock-solid' />,\n drawerView: <AppShellList listView={recentViewItems} />\n }\n ];\n\n return (\n <AppShell\n appInfo={\n args.appInfo || {\n href: args.href || 'https://www.pega.com/',\n imageSrc:\n args.imageSrc ||\n 'https://pbs.twimg.com/profile_images/1410341211978752004/pLYjGIa8_bigger.jpg',\n fullImageSrc:\n args.fullImageSrc ||\n 'https://www.pega.com/themes/custom/pegawww_theme/images/pega-logo.svg',\n appName: args.appName || 'Cosmos AppShell',\n portalName: args.portalName || 'Demo'\n }\n }\n searchInput={\n showSearch\n ? {\n onSearchChange: (value: string) => {\n setSearchVal(value);\n },\n value: searchVal\n }\n : undefined\n }\n appHeader={args.appHeader}\n caseTypes={args.createLinks || defaultCreateLinks}\n links={linksWithHandlers}\n main={args.main || defaultMainContent}\n cases={args.cases}\n banners={args.banners}\n operator={operatorData}\n utils={args.utils || defaultUtils}\n environment={\n args.environmentName\n ? {\n name: args.environmentName,\n color: args.environmentColor\n }\n : undefined\n }\n />\n );\n};\n\nAppShellDemo.args = {\n appName: 'Cosmos AppShell',\n portalName: 'Demo',\n href: 'https://www.pega.com/',\n imageSrc: 'https://pbs.twimg.com/profile_images/1410341211978752004/pLYjGIa8_bigger.jpg',\n fullImageSrc: 'https://www.pega.com/themes/custom/pegawww_theme/images/pega-logo.svg',\n withSearch: true,\n appHeader: true,\n environmentName: 'dev',\n environmentColor: '#FFDBDE',\n notificationsEmpty: false,\n notificationsLoading: false,\n recentsEmpty: false,\n recentsLoading: false,\n pinsLoading: false\n};\n\nAppShellDemo.argTypes = {\n appName: { control: { type: 'text' } },\n portalName: { control: { type: 'text' } },\n href: { control: { type: 'text' } },\n imageSrc: { control: { type: 'text' } },\n fullImageSrc: { control: { type: 'text' } },\n withSearch: { control: { type: 'boolean' } },\n appHeader: { control: { type: 'boolean' } },\n environmentName: { control: { type: 'text' } },\n environmentColor: { control: { type: 'color' } },\n notificationsEmpty: { control: { type: 'boolean' } },\n notificationsLoading: { control: { type: 'boolean' } },\n recentsEmpty: { control: { type: 'boolean' } },\n recentsLoading: { control: { type: 'boolean' } },\n pinsLoading: { control: { type: 'boolean' } }\n};\n\ninterface ConfigurableAppShellProps {\n navColor?: string;\n headerColor?: string;\n}\n\nexport const ConfigurableAppShell: Story<ConfigurableAppShellProps> = (\n args: ConfigurableAppShellProps\n) => {\n return (\n <Configuration\n theme={{\n components: {\n 'app-shell': {\n nav: {\n 'background-color': args.navColor\n },\n header: {\n 'background-color': args.headerColor\n }\n }\n }\n }}\n >\n <AppShellDemo appHeader />\n </Configuration>\n );\n};\n\nConfigurableAppShell.args = {\n navColor: '#252c32',\n headerColor: '#e2f1ff'\n};\n\nConfigurableAppShell.argTypes = {\n navColor: { control: { type: 'color' } },\n headerColor: { control: { type: 'color' } }\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Card.stories.jsx","sourceRoot":"","sources":["../../../src/core/Card/Card.stories.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,IAAI,EACJ,UAAU,EACV,SAAS,EACT,WAAW,EACX,UAAU,EAEV,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CAAC,CAAC;AAEF,gBAAgB,CAAC,IAAI,GAAG;IACtB,YAAY,EAAE,QAAQ;IACtB,UAAU,EAAE,SAAS;CACtB,CAAC;AAEF,gBAAgB,CAAC,QAAQ,GAAG;IAC1B,YAAY,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE;IAC3C,UAAU,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE;CAC3C,CAAC","sourcesContent":["import { Meta, Story } from '@storybook/react';\n\nimport {\n Card,\n CardHeader,\n CardMedia,\n CardContent,\n CardFooter,\n CardFooterProps,\n Image,\n MenuButton,\n Text,\n Configuration\n} from '@pega/cosmos-react-core';\n\nimport { StyledCard } from './Card.styles';\n\nexport default {\n title: 'Core/Card',\n component: Card,\n parameters: {\n layout: 'centered'\n }\n} as Meta;\n\nexport const SimpleCard = () => {\n return (\n <Card as={StyledCard}>\n <CardHeader>\n <Text variant='h2'>Simple Card</Text>\n </CardHeader>\n <CardContent>\n Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut\n labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco\n laboris nisi ut aliquip ex ea commodo consequat.\n </CardContent>\n </Card>\n );\n};\n\nexport const FullCard: Story<CardFooterProps> = (args: CardFooterProps) => {\n return (\n <Card as={StyledCard}>\n <CardMedia>\n <Image\n src='https://www.pega.com/sites/default/files/default-og.jpg'\n height='100'\n alt='Media'\n />\n </CardMedia>\n <CardHeader\n actions={\n <MenuButton\n portal\n variant='simple'\n text='Card actions'\n icon='more'\n iconOnly\n menu={{\n items: [\n { id: 'action-1', primary: 'Card action 1' },\n { id: 'action-2', primary: 'Card action 2' },\n { id: 'action-3', primary: 'Card action 3' }\n ]\n }}\n />\n }\n >\n <Text variant='h2'>Full Card</Text>\n </CardHeader>\n <CardContent>\n Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut\n labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco\n laboris nisi ut aliquip ex ea commodo consequat.\n </CardContent>\n <CardFooter justify={args.justify}>\n <Text variant='secondary'>This is the CardFooter</Text>\n </CardFooter>\n </Card>\n );\n};\n\nFullCard.args = {\n justify: 'start'\n};\n\nFullCard.argTypes = {\n justify: {\n options: ['start', 'end', 'center', 'between', 'around', 'evenly'],\n control: { type: 'select' }\n }\n};\n\ninterface ConfigurableCardProps {\n borderRadius?: string;\n background?: string;\n}\n\nexport const ConfigurableCard: Story<ConfigurableCardProps> = (args: ConfigurableCardProps) => {\n return (\n <Configuration\n theme={{\n components: {\n card: {\n 'border-radius': args.borderRadius,\n background: args.background\n }\n }\n }}\n >\n <Card as={StyledCard}>\n <CardHeader>\n <Text variant='h2'>Simple Card</Text>\n </CardHeader>\n <CardContent>\n Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt\n ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation\n ullamco laboris nisi ut aliquip ex ea commodo consequat.\n </CardContent>\n </Card>\n </Configuration>\n );\n};\n\nConfigurableCard.args = {\n borderRadius: '0.5rem',\n background: '#
|
|
1
|
+
{"version":3,"file":"Card.stories.jsx","sourceRoot":"","sources":["../../../src/core/Card/Card.stories.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,IAAI,EACJ,UAAU,EACV,SAAS,EACT,WAAW,EACX,UAAU,EAEV,KAAK,EACL,UAAU,EACV,IAAI,EACJ,aAAa,EACd,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,eAAe;IACb,KAAK,EAAE,WAAW;IAClB,SAAS,EAAE,IAAI;IACf,UAAU,EAAE;QACV,MAAM,EAAE,UAAU;KACnB;CACM,CAAC;AAEV,MAAM,CAAC,MAAM,UAAU,GAAG,GAAG,EAAE;IAC7B,OAAO,CACL,CAAC,IAAI,CAAC,EAAE,C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@storybook/react';\n\nimport {\n Card,\n CardHeader,\n CardMedia,\n CardContent,\n CardFooter,\n CardFooterProps,\n Image,\n MenuButton,\n Text,\n Configuration\n} from '@pega/cosmos-react-core';\n\nimport { StyledCard } from './Card.styles';\n\nexport default {\n title: 'Core/Card',\n component: Card,\n parameters: {\n layout: 'centered'\n }\n} as Meta;\n\nexport const SimpleCard = () => {\n return (\n <Card as={StyledCard}>\n <CardHeader>\n <Text variant='h2'>Simple Card</Text>\n </CardHeader>\n <CardContent>\n Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut\n labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco\n laboris nisi ut aliquip ex ea commodo consequat.\n </CardContent>\n </Card>\n );\n};\n\nexport const FullCard: Story<CardFooterProps> = (args: CardFooterProps) => {\n return (\n <Card as={StyledCard}>\n <CardMedia>\n <Image\n src='https://www.pega.com/sites/default/files/default-og.jpg'\n height='100'\n alt='Media'\n />\n </CardMedia>\n <CardHeader\n actions={\n <MenuButton\n portal\n variant='simple'\n text='Card actions'\n icon='more'\n iconOnly\n menu={{\n items: [\n { id: 'action-1', primary: 'Card action 1' },\n { id: 'action-2', primary: 'Card action 2' },\n { id: 'action-3', primary: 'Card action 3' }\n ]\n }}\n />\n }\n >\n <Text variant='h2'>Full Card</Text>\n </CardHeader>\n <CardContent>\n Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut\n labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco\n laboris nisi ut aliquip ex ea commodo consequat.\n </CardContent>\n <CardFooter justify={args.justify}>\n <Text variant='secondary'>This is the CardFooter</Text>\n </CardFooter>\n </Card>\n );\n};\n\nFullCard.args = {\n justify: 'start'\n};\n\nFullCard.argTypes = {\n justify: {\n options: ['start', 'end', 'center', 'between', 'around', 'evenly'],\n control: { type: 'select' }\n }\n};\n\ninterface ConfigurableCardProps {\n borderRadius?: string;\n background?: string;\n}\n\nexport const ConfigurableCard: Story<ConfigurableCardProps> = (args: ConfigurableCardProps) => {\n return (\n <Configuration\n theme={{\n components: {\n card: {\n 'border-radius': args.borderRadius,\n background: args.background\n }\n }\n }}\n >\n <Card as={StyledCard}>\n <CardHeader>\n <Text variant='h2'>Simple Card</Text>\n </CardHeader>\n <CardContent>\n Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt\n ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation\n ullamco laboris nisi ut aliquip ex ea commodo consequat.\n </CardContent>\n </Card>\n </Configuration>\n );\n};\n\nConfigurableCard.args = {\n borderRadius: '0.5rem',\n background: '#71baff'\n};\n\nConfigurableCard.argTypes = {\n borderRadius: { control: { type: 'text' } },\n background: { control: { type: 'color' } }\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.stories.jsx","sourceRoot":"","sources":["../../../src/core/Checkbox/Checkbox.stories.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAmB,MAAM,yBAAyB,CAAC;AAEnF,eAAe;IACb,KAAK,EAAE,eAAe;IACtB,SAAS,EAAE,QAAQ;IACnB,IAAI,EAAE;QACJ,MAAM,EAAE,SAAS;QACjB,KAAK,EAAE,kBAAkB;QACzB,QAAQ,EAAE,KAAK;QACf,QAAQ,EAAE,KAAK;QACf,QAAQ,EAAE,KAAK;QACf,aAAa,EAAE,KAAK;KACrB;IACD,QAAQ,EAAE;QACR,MAAM,EAAE,EAAE,OAAO,EAAE,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE;QAC5F,KAAK,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE;QACpC,QAAQ,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,EA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AE,MAAM,EAAE,EAAE;IAC3C,UAAU,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE;IAC1C,eAAe,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE;IAC9C,sBAAsB,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE;IACtD,kBAAkB,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE;IAClD,MAAM,EAAE,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;IACpC,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;IACnC,QAAQ,EAAE,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;IACtC,QAAQ,EAAE,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;IACtC,QAAQ,EAAE,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;IACtC,aAAa,EAAE,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;CAC5C,CAAC","sourcesContent":["import { Meta, Story } from '@storybook/react';\n\nimport { Checkbox, Configuration, RadioCheckProps } from '@pega/cosmos-react-core';\n\nexport default {\n title: 'Core/Checkbox',\n component: Checkbox,\n args: {\n status: undefined,\n label: 'Check me, please',\n required: false,\n disabled: false,\n readOnly: false,\n indeterminate: false\n },\n argTypes: {\n status: { options: [undefined, 'success', 'warning', 'error'], control: { type: 'select' } },\n label: { control: { type: 'text' } },\n required: { control: { type: 'boolean' } },\n disabled: { control: { type: 'boolean' } },\n readOnly: { control: { type: 'boolean' } },\n indeterminate: { control: { type: 'boolean' } }\n }\n} as Meta;\n\nexport const DefaultCheckbox: Story<RadioCheckProps> = (args: RadioCheckProps) => {\n return (\n <Checkbox\n status={args.status}\n label={args.label}\n required={args.required}\n disabled={args.disabled}\n readOnly={args.readOnly}\n indeterminate={args.indeterminate}\n />\n );\n};\n\nexport const CheckboxCard: Story<RadioCheckProps> = (args: RadioCheckProps) => {\n return (\n <Checkbox\n variant='card'\n status={args.status}\n label={args.label}\n required={args.required}\n disabled={args.disabled}\n readOnly={args.readOnly}\n indeterminate={args.indeterminate}\n />\n );\n};\n\ninterface ConfigurableCheckboxProps extends RadioCheckProps {\n size?: string;\n backgroundColor?: string;\n borderColor?: string;\n borderWidth?: string;\n borderRadius?: string;\n labelColor?: string;\n labelFontWeight?: string;\n checkedBackgroundColor?: string;\n checkedBorderColor?: string;\n}\n\nexport const ConfigurableCheckbox: Story<ConfigurableCheckboxProps> = (\n args: ConfigurableCheckboxProps\n) => {\n return (\n <Configuration\n theme={{\n components: {\n checkbox: {\n 'border-radius': args.borderRadius\n },\n 'radio-check': {\n 'border-color': args.borderColor,\n 'border-width': args.borderWidth,\n 'background-color': args.backgroundColor,\n label: {\n color: args.labelColor,\n 'font-weight': args.labelFontWeight\n },\n size: args.size,\n ':checked': {\n 'background-color': args.checkedBackgroundColor,\n 'border-color': args.checkedBorderColor\n }\n }\n }\n }}\n >\n <Checkbox label='Configurable Checkbox' />\n </Configuration>\n );\n};\n\nConfigurableCheckbox.args = {\n size: '1.25rem',\n backgroundColor: '#ffffff',\n borderColor: '#939393',\n borderWidth: '0.0625rem',\n borderRadius: '0.5',\n labelColor: '#
|
|
1
|
+
{"version":3,"file":"Checkbox.stories.jsx","sourceRoot":"","sources":["../../../src/core/Checkbox/Checkbox.stories.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAmB,MAAM,yBAAyB,CAAC;AAEnF,eAAe;IACb,KAAK,EAAE,eAAe;IACtB,SAAS,EAAE,QAAQ;IACnB,IAAI,EAAE;QACJ,MAAM,EAAE,SAAS;QACjB,KAAK,EAAE,kBAAkB;QACzB,QAAQ,EAAE,KAAK;QACf,QAAQ,EAAE,KA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AAC,QAAQ,GAAG;IAC9B,IAAI,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE;IACnC,eAAe,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE;IAC/C,WAAW,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE;IAC3C,WAAW,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE;IAC1C,YAAY,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE;IAC3C,UAAU,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE;IAC1C,eAAe,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE;IAC9C,sBAAsB,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE;IACtD,kBAAkB,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE;IAClD,MAAM,EAAE,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;IACpC,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;IACnC,QAAQ,EAAE,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;IACtC,QAAQ,EAAE,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;IACtC,QAAQ,EAAE,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;IACtC,aAAa,EAAE,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;CAC5C,CAAC","sourcesContent":["import { Meta, Story } from '@storybook/react';\n\nimport { Checkbox, Configuration, RadioCheckProps } from '@pega/cosmos-react-core';\n\nexport default {\n title: 'Core/Checkbox',\n component: Checkbox,\n args: {\n status: undefined,\n label: 'Check me, please',\n required: false,\n disabled: false,\n readOnly: false,\n indeterminate: false\n },\n argTypes: {\n status: { options: [undefined, 'success', 'warning', 'error'], control: { type: 'select' } },\n label: { control: { type: 'text' } },\n required: { control: { type: 'boolean' } },\n disabled: { control: { type: 'boolean' } },\n readOnly: { control: { type: 'boolean' } },\n indeterminate: { control: { type: 'boolean' } }\n }\n} as Meta;\n\nexport const DefaultCheckbox: Story<RadioCheckProps> = (args: RadioCheckProps) => {\n return (\n <Checkbox\n status={args.status}\n label={args.label}\n required={args.required}\n disabled={args.disabled}\n readOnly={args.readOnly}\n indeterminate={args.indeterminate}\n />\n );\n};\n\nexport const CheckboxCard: Story<RadioCheckProps> = (args: RadioCheckProps) => {\n return (\n <Checkbox\n variant='card'\n status={args.status}\n label={args.label}\n required={args.required}\n disabled={args.disabled}\n readOnly={args.readOnly}\n indeterminate={args.indeterminate}\n />\n );\n};\n\ninterface ConfigurableCheckboxProps extends RadioCheckProps {\n size?: string;\n backgroundColor?: string;\n borderColor?: string;\n borderWidth?: string;\n borderRadius?: string;\n labelColor?: string;\n labelFontWeight?: string;\n checkedBackgroundColor?: string;\n checkedBorderColor?: string;\n}\n\nexport const ConfigurableCheckbox: Story<ConfigurableCheckboxProps> = (\n args: ConfigurableCheckboxProps\n) => {\n return (\n <Configuration\n theme={{\n components: {\n checkbox: {\n 'border-radius': args.borderRadius\n },\n 'radio-check': {\n 'border-color': args.borderColor,\n 'border-width': args.borderWidth,\n 'background-color': args.backgroundColor,\n label: {\n color: args.labelColor,\n 'font-weight': args.labelFontWeight\n },\n size: args.size,\n ':checked': {\n 'background-color': args.checkedBackgroundColor,\n 'border-color': args.checkedBorderColor\n }\n }\n }\n }}\n >\n <Checkbox label='Configurable Checkbox' />\n </Configuration>\n );\n};\n\nConfigurableCheckbox.args = {\n size: '1.25rem',\n backgroundColor: '#ffffff',\n borderColor: '#939393',\n borderWidth: '0.0625rem',\n borderRadius: '0.5',\n labelColor: '#939393',\n labelFontWeight: '400',\n checkedBackgroundColor: '#076bc9',\n checkedBorderColor: '#076bc9'\n};\n\nConfigurableCheckbox.argTypes = {\n size: { control: { type: 'text' } },\n backgroundColor: { control: { type: 'color' } },\n borderColor: { control: { type: 'color' } },\n borderWidth: { control: { type: 'text' } },\n borderRadius: { control: { type: 'text' } },\n labelColor: { control: { type: 'color' } },\n labelFontWeight: { control: { type: 'text' } },\n checkedBackgroundColor: { control: { type: 'color' } },\n checkedBorderColor: { control: { type: 'color' } },\n status: { table: { disable: true } },\n label: { table: { disable: true } },\n required: { table: { disable: true } },\n disabled: { table: { disable: true } },\n readOnly: { table: { disable: true } },\n indeterminate: { table: { disable: true } }\n};\n"]}
|
|
@@ -4,8 +4,11 @@ declare const _default: Meta<import("@storybook/react").Args>;
|
|
|
4
4
|
export default _default;
|
|
5
5
|
export declare const CurrencyInputDemo: Story<CurrencyInputProps>;
|
|
6
6
|
interface CurrencyDisplayStoryProps extends CurrencyDisplayProps {
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
groupSeparators: boolean;
|
|
8
|
+
fractionDigits: number;
|
|
9
|
+
currency: 'symbol' | 'code' | 'name';
|
|
10
|
+
negative: 'minus-sign' | 'parentheses';
|
|
11
|
+
notation: 'standard' | 'compact';
|
|
9
12
|
}
|
|
10
13
|
export declare const CurrencyDisplayDemo: Story<CurrencyDisplayStoryProps>;
|
|
11
14
|
//# sourceMappingURL=Currency.stories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Currency.stories.d.ts","sourceRoot":"","sources":["../../../src/core/Currency/Currency.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAG/C,OAAO,EAEL,oBAAoB,EAEpB,kBAAkB,EACnB,MAAM,yBAAyB,CAAC;;AAEjC,wBAGU;AAEV,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,kBAAkB,CAsBvD,CAAC;AAmCF,UAAU,yBAA0B,SAAQ,oBAAoB;IAC9D,
|
|
1
|
+
{"version":3,"file":"Currency.stories.d.ts","sourceRoot":"","sources":["../../../src/core/Currency/Currency.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAG/C,OAAO,EAEL,oBAAoB,EAEpB,kBAAkB,EACnB,MAAM,yBAAyB,CAAC;;AAEjC,wBAGU;AAEV,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,kBAAkB,CAsBvD,CAAC;AAmCF,UAAU,yBAA0B,SAAQ,oBAAoB;IAC9D,eAAe,EAAE,OAAO,CAAC;IACzB,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,QAAQ,GAAG,MAAM,GAAG,MAAM,CAAC;IACrC,QAAQ,EAAE,YAAY,GAAG,aAAa,CAAC;IACvC,QAAQ,EAAE,UAAU,GAAG,SAAS,CAAC;CAClC;AAED,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,yBAAyB,CAgBhE,CAAC"}
|
|
@@ -40,26 +40,44 @@ CurrencyInputDemo.argTypes = {
|
|
|
40
40
|
readOnly: { control: { type: 'boolean' } }
|
|
41
41
|
};
|
|
42
42
|
export const CurrencyDisplayDemo = (args) => {
|
|
43
|
-
return (<CurrencyDisplay value={args.value} currencyISOCode={args.currencyISOCode}
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
return (<CurrencyDisplay value={args.value} currencyISOCode={args.currencyISOCode} formattingOptions={{
|
|
44
|
+
fractionDigits: args.fractionDigits,
|
|
45
|
+
groupSeparators: args.groupSeparators,
|
|
46
|
+
currency: args.currency,
|
|
47
|
+
negative: args.negative,
|
|
48
|
+
notation: args.notation
|
|
46
49
|
}}/>);
|
|
47
50
|
};
|
|
48
51
|
CurrencyDisplayDemo.args = {
|
|
49
|
-
value:
|
|
52
|
+
value: undefined,
|
|
50
53
|
currencyISOCode: 'USD',
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
+
groupSeparators: true,
|
|
55
|
+
fractionDigits: undefined,
|
|
56
|
+
currency: 'symbol',
|
|
57
|
+
negative: 'minus-sign',
|
|
58
|
+
notation: 'standard'
|
|
54
59
|
};
|
|
55
60
|
CurrencyDisplayDemo.argTypes = {
|
|
56
|
-
value: { control: { type: '
|
|
61
|
+
value: { control: { type: 'number' } },
|
|
57
62
|
currencyISOCode: {
|
|
58
|
-
options: ['USD', 'EUR', 'AUD', 'PLN', 'CZK', 'JPY'],
|
|
63
|
+
options: [undefined, 'USD', 'EUR', 'AUD', 'PLN', 'CZK', 'JPY'],
|
|
59
64
|
control: { type: 'select' }
|
|
60
65
|
},
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
66
|
+
groupSeparators: { control: { type: 'boolean' } },
|
|
67
|
+
fractionDigits: { control: { type: 'number', min: 0, max: 20, step: 1 } },
|
|
68
|
+
negative: {
|
|
69
|
+
control: {
|
|
70
|
+
type: 'inline-radio'
|
|
71
|
+
},
|
|
72
|
+
options: ['minus-sign', 'parentheses']
|
|
73
|
+
},
|
|
74
|
+
currency: {
|
|
75
|
+
control: { type: 'select' },
|
|
76
|
+
options: ['symbol', 'code', 'name']
|
|
77
|
+
},
|
|
78
|
+
notation: {
|
|
79
|
+
control: { type: 'inline-radio' },
|
|
80
|
+
options: ['standard', 'compact']
|
|
81
|
+
}
|
|
64
82
|
};
|
|
65
83
|
//# sourceMappingURL=Currency.stories.jsx.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Currency.stories.jsx","sourceRoot":"","sources":["../../../src/core/Currency/Currency.stories.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,OAAO,EACL,eAAe,EAEf,aAAa,EAEd,MAAM,yBAAyB,CAAC;AAEjC,eAAe;IACb,KAAK,EAAE,eAAe;IACtB,SAAS,EAAE,aAAa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,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE;IACjD,cAAc,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE;IACzE,QAAQ,EAAE;QACR,OAAO,EAAE;YACP,IAAI,EAAE,cAAc;SACrB;QACD,OAAO,EAAE,CAAC,YAAY,EAAE,aAAa,CAAC;KACvC;IACD,QAAQ,EAAE;QACR,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QAC3B,OAAO,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC;KACpC;IACD,QAAQ,EAAE;QACR,OAAO,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE;QACjC,OAAO,EAAE,CAAC,UAAU,EAAE,SAAS,CAAC;KACjC;CACF,CAAC","sourcesContent":["import { Meta, Story } from '@storybook/react';\nimport { useState } from 'react';\n\nimport {\n CurrencyDisplay,\n CurrencyDisplayProps,\n CurrencyInput,\n CurrencyInputProps\n} from '@pega/cosmos-react-core';\n\nexport default {\n title: 'Core/Currency',\n component: CurrencyInput\n} as Meta;\n\nexport const CurrencyInputDemo: Story<CurrencyInputProps> = (args: CurrencyInputProps) => {\n const [value, setValue] = useState<string>();\n\n return (\n <CurrencyInput\n value={value}\n onChange={inputValue => setValue(inputValue)}\n onBlur={inputValue => setValue(inputValue)}\n currencyISOCode={args.currencyISOCode}\n alwaysShowISOCode={args.alwaysShowISOCode}\n showDecimal={args.showDecimal}\n showGroupSeparators={args.showGroupSeparators}\n step={args.step}\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 />\n );\n};\n\nCurrencyInputDemo.args = {\n currencyISOCode: 'USD',\n alwaysShowISOCode: false,\n showDecimal: true,\n showGroupSeparators: true,\n step: 1,\n label: 'Currency input',\n labelHidden: false,\n info: 'Enter a numerical value',\n status: undefined,\n required: false,\n disabled: false,\n readOnly: false\n};\n\nCurrencyInputDemo.argTypes = {\n currencyISOCode: {\n options: ['USD', 'EUR', 'AUD', 'PLN', 'CZK', 'JPY'],\n control: { type: 'select' }\n },\n alwaysShowISOCode: { control: { type: 'boolean' } },\n showDecimal: { control: { type: 'boolean' } },\n showGroupSeparators: { control: { type: 'boolean' } },\n step: { control: { type: 'number' } },\n label: { control: { type: 'text' } },\n labelHidden: { control: { type: 'boolean' } },\n info: { control: { type: '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};\n\ninterface CurrencyDisplayStoryProps extends CurrencyDisplayProps {\n groupSeparators: boolean;\n fractionDigits: number;\n currency: 'symbol' | 'code' | 'name';\n negative: 'minus-sign' | 'parentheses';\n notation: 'standard' | 'compact';\n}\n\nexport const CurrencyDisplayDemo: Story<CurrencyDisplayStoryProps> = (\n args: CurrencyDisplayStoryProps\n) => {\n return (\n <CurrencyDisplay\n value={args.value}\n currencyISOCode={args.currencyISOCode}\n formattingOptions={{\n fractionDigits: args.fractionDigits,\n groupSeparators: args.groupSeparators,\n currency: args.currency,\n negative: args.negative,\n notation: args.notation\n }}\n />\n );\n};\n\nCurrencyDisplayDemo.args = {\n value: undefined,\n currencyISOCode: 'USD',\n groupSeparators: true,\n fractionDigits: undefined,\n currency: 'symbol',\n negative: 'minus-sign',\n notation: 'standard'\n};\n\nCurrencyDisplayDemo.argTypes = {\n value: { control: { type: 'number' } },\n currencyISOCode: {\n options: [undefined, 'USD', 'EUR', 'AUD', 'PLN', 'CZK', 'JPY'],\n control: { type: 'select' }\n },\n groupSeparators: { control: { type: 'boolean' } },\n fractionDigits: { control: { type: 'number', min: 0, max: 20, step: 1 } },\n negative: {\n control: {\n type: 'inline-radio'\n },\n options: ['minus-sign', 'parentheses']\n },\n currency: {\n control: { type: 'select' },\n options: ['symbol', 'code', 'name']\n },\n notation: {\n control: { type: 'inline-radio' },\n options: ['standard', 'compact']\n }\n};\n"]}
|
|
@@ -80,8 +80,8 @@ export const ConfigurableForm = (args) => {
|
|
|
80
80
|
</Configuration>);
|
|
81
81
|
};
|
|
82
82
|
ConfigurableForm.args = {
|
|
83
|
-
foregroundColor: '#
|
|
84
|
-
backgroundColor: '#
|
|
83
|
+
foregroundColor: '#054a8a',
|
|
84
|
+
backgroundColor: '#e2f1ff',
|
|
85
85
|
borderColor: '#939393',
|
|
86
86
|
borderWidth: '0.0625rem',
|
|
87
87
|
borderRadius: 0.5,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Form.stories.jsx","sourceRoot":"","sources":["../../../src/core/Form/Form.stories.tsx"],"names":[],"mappings":"AACA,OAAO,EAA0B,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEzD,OAAO,EACL,MAAM,EACN,MAAM,EACN,aAAa,EACb,IAAI,EACJ,IAAI,EACJ,SAAS,EACT,KAAK,EACN,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,eAAe;IACb,KAAK,EAAE,WAAW;IAClB,SAAS,EAAE,IAAI;IACf,aAAa,EAAE;QACb,SAAS;KACV;IACD,IAAI,EAAE;QACJ,OAAO,EAAE,WAAW;QACpB,WAAW,EAAE,EAAE;KAChB;IACD,QAAQ,EAAE;QACR,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE;QACtC,WAAW,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE;KAC3C;CACM,CAAC;AAMV,MAAM,CAAC,MAAM,aAAa,GAA0B,CAAC,IAAoB,EAAE,EAAE;IAC3E,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,OAAO,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AAE,OAAO,EAAE,EAAE;IAC/C,eAAe,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE;IAC/C,WAAW,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE;IAC3C,WAAW,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE;IAC1C,YAAY,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE;IAC7C,gBAAgB,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE;IAChD,gBAAgB,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE;IAChD,OAAO,EAAE,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;IACrC,WAAW,EAAE,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;CAC1C,CAAC","sourcesContent":["import { Meta, Story } from '@storybook/react';\nimport { ChangeEvent, FormEvent, useState } from 'react';\n\nimport {\n Banner,\n Button,\n Configuration,\n Flex,\n Form,\n FormField,\n Input\n} from '@pega/cosmos-react-core';\n\nimport { FormContent } from './Form.mocks';\n\nexport default {\n title: 'Core/Form',\n component: Form,\n subcomponents: {\n FormField\n },\n args: {\n heading: 'Form demo',\n description: ''\n },\n argTypes: {\n heading: { control: { type: 'text' } },\n description: { control: { type: 'text' } }\n }\n} as Meta;\ninterface FormStoryProps {\n heading?: string;\n description?: string;\n}\n\nexport const OneColumnForm: Story<FormStoryProps> = (args: FormStoryProps) => {\n return <FormContent cols={1} heading={args.heading} description={args.description} showActions />;\n};\n\nexport const TwoColumnForm: Story<FormStoryProps> = (args: FormStoryProps) => {\n return <FormContent cols={2} heading={args.heading} description={args.description} showActions />;\n};\n\nexport const ThreeColumnForm: Story<FormStoryProps> = (args: FormStoryProps) => {\n return <FormContent cols={3} heading={args.heading} description={args.description} showActions />;\n};\n\nexport const SimpleFormDemo: Story<FormStoryProps & { withBanners?: boolean }> = (\n args: FormStoryProps & { withBanners?: boolean }\n) => {\n const [inputValue, setInputValue] = useState('');\n const [success, setSuccess] = useState('');\n\n const actions = (\n <>\n <Button name='Cancel' variant='secondary' onClick={() => setInputValue('')}>\n Cancel\n </Button>\n <Button name='Submit' type='submit' variant='primary'>\n Submit\n </Button>\n </>\n );\n\n const successBanner = (\n <Banner\n id='success'\n variant='success'\n heading='Success'\n messages={['Form submitted', `Input value: ${success}`]}\n />\n );\n\n const errorBanner = (\n <Banner\n id='error'\n variant='urgent'\n heading='Error'\n messages={['All required fields in the form must be completed.']}\n />\n );\n\n const banner = success ? successBanner : errorBanner;\n\n return (\n <Form\n banners={args.withBanners ? banner : undefined}\n actions={actions}\n heading={args.heading}\n description={args.description}\n onSubmit={(e: FormEvent) => {\n e.preventDefault();\n setSuccess(inputValue);\n setInputValue('');\n }}\n >\n <Flex container={{ direction: 'column', itemGap: 2 }}>\n <Input\n label='Name'\n info='Enter your first name'\n required\n value={inputValue}\n onChange={(e: ChangeEvent<HTMLInputElement>) => {\n setSuccess('');\n setInputValue(e.target.value);\n }}\n />\n </Flex>\n </Form>\n );\n};\n\nSimpleFormDemo.args = {\n withBanners: false\n};\n\nSimpleFormDemo.argTypes = {\n withBanners: { control: { type: 'boolean' } }\n};\n\ninterface ConfigurableFormProps extends FormStoryProps {\n foregroundColor?: string;\n backgroundColor?: string;\n borderColor?: string;\n borderWidth?: string;\n borderRadius?: number;\n hoverBorderColor?: string;\n focusBorderColor?: string;\n}\n\nexport const ConfigurableForm: Story<ConfigurableFormProps> = (args: ConfigurableFormProps) => {\n return (\n <Configuration\n theme={{\n components: {\n 'form-control': {\n 'foreground-color': args.foregroundColor,\n 'background-color': args.backgroundColor,\n 'border-color': args.borderColor,\n 'border-width': args.borderWidth,\n 'border-radius': args.borderRadius,\n ':hover': {\n 'border-color': args.hoverBorderColor\n },\n ':focus': {\n 'border-color': args.focusBorderColor\n }\n }\n }\n }}\n >\n <FormContent cols={2} showActions />\n </Configuration>\n );\n};\n\nConfigurableForm.args = {\n foregroundColor: '#
|
|
1
|
+
{"version":3,"file":"Form.stories.jsx","sourceRoot":"","sources":["../../../src/core/Form/Form.stories.tsx"],"names":[],"mappings":"AACA,OAAO,EAA0B,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEzD,OAAO,EACL,MAAM,EACN,MAAM,EACN,aAAa,EACb,IAAI,EACJ,IAAI,EACJ,SAAS,EACT,KAAK,EACN,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,eAAe;IACb,KAAK,EAAE,WAAW;IAClB,SAAS,EAAE,IAAI;IACf,aAAa,EAAE;QACb,SAAS;KACV;IACD,IAAI,EAAE;QACJ,OAAO,EAAE,WAAW;QACpB,WAAW,EAAE,EAAE;KAChB;IACD,QAAQ,EAAE;QACR,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE;QACtC,WAAW,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE;KAC3C;CACM,CAAC;AAMV,MAAM,CAAC,MAAM,aAAa,GAA0B,CAAC,IAAoB,EAAE,EAAE;IAC3E,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,WAAW,EAAG,CAAC;AACpG,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAA0B,CAAC,IAAoB,EAAE,EAAE;IAC3E,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC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E;IAC7C,gBAAgB,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE;IAChD,gBAAgB,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE;IAChD,OAAO,EAAE,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;IACrC,WAAW,EAAE,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;CAC1C,CAAC","sourcesContent":["import { Meta, Story } from '@storybook/react';\nimport { ChangeEvent, FormEvent, useState } from 'react';\n\nimport {\n Banner,\n Button,\n Configuration,\n Flex,\n Form,\n FormField,\n Input\n} from '@pega/cosmos-react-core';\n\nimport { FormContent } from './Form.mocks';\n\nexport default {\n title: 'Core/Form',\n component: Form,\n subcomponents: {\n FormField\n },\n args: {\n heading: 'Form demo',\n description: ''\n },\n argTypes: {\n heading: { control: { type: 'text' } },\n description: { control: { type: 'text' } }\n }\n} as Meta;\ninterface FormStoryProps {\n heading?: string;\n description?: string;\n}\n\nexport const OneColumnForm: Story<FormStoryProps> = (args: FormStoryProps) => {\n return <FormContent cols={1} heading={args.heading} description={args.description} showActions />;\n};\n\nexport const TwoColumnForm: Story<FormStoryProps> = (args: FormStoryProps) => {\n return <FormContent cols={2} heading={args.heading} description={args.description} showActions />;\n};\n\nexport const ThreeColumnForm: Story<FormStoryProps> = (args: FormStoryProps) => {\n return <FormContent cols={3} heading={args.heading} description={args.description} showActions />;\n};\n\nexport const SimpleFormDemo: Story<FormStoryProps & { withBanners?: boolean }> = (\n args: FormStoryProps & { withBanners?: boolean }\n) => {\n const [inputValue, setInputValue] = useState('');\n const [success, setSuccess] = useState('');\n\n const actions = (\n <>\n <Button name='Cancel' variant='secondary' onClick={() => setInputValue('')}>\n Cancel\n </Button>\n <Button name='Submit' type='submit' variant='primary'>\n Submit\n </Button>\n </>\n );\n\n const successBanner = (\n <Banner\n id='success'\n variant='success'\n heading='Success'\n messages={['Form submitted', `Input value: ${success}`]}\n />\n );\n\n const errorBanner = (\n <Banner\n id='error'\n variant='urgent'\n heading='Error'\n messages={['All required fields in the form must be completed.']}\n />\n );\n\n const banner = success ? successBanner : errorBanner;\n\n return (\n <Form\n banners={args.withBanners ? banner : undefined}\n actions={actions}\n heading={args.heading}\n description={args.description}\n onSubmit={(e: FormEvent) => {\n e.preventDefault();\n setSuccess(inputValue);\n setInputValue('');\n }}\n >\n <Flex container={{ direction: 'column', itemGap: 2 }}>\n <Input\n label='Name'\n info='Enter your first name'\n required\n value={inputValue}\n onChange={(e: ChangeEvent<HTMLInputElement>) => {\n setSuccess('');\n setInputValue(e.target.value);\n }}\n />\n </Flex>\n </Form>\n );\n};\n\nSimpleFormDemo.args = {\n withBanners: false\n};\n\nSimpleFormDemo.argTypes = {\n withBanners: { control: { type: 'boolean' } }\n};\n\ninterface ConfigurableFormProps extends FormStoryProps {\n foregroundColor?: string;\n backgroundColor?: string;\n borderColor?: string;\n borderWidth?: string;\n borderRadius?: number;\n hoverBorderColor?: string;\n focusBorderColor?: string;\n}\n\nexport const ConfigurableForm: Story<ConfigurableFormProps> = (args: ConfigurableFormProps) => {\n return (\n <Configuration\n theme={{\n components: {\n 'form-control': {\n 'foreground-color': args.foregroundColor,\n 'background-color': args.backgroundColor,\n 'border-color': args.borderColor,\n 'border-width': args.borderWidth,\n 'border-radius': args.borderRadius,\n ':hover': {\n 'border-color': args.hoverBorderColor\n },\n ':focus': {\n 'border-color': args.focusBorderColor\n }\n }\n }\n }}\n >\n <FormContent cols={2} showActions />\n </Configuration>\n );\n};\n\nConfigurableForm.args = {\n foregroundColor: '#054a8a',\n backgroundColor: '#e2f1ff',\n borderColor: '#939393',\n borderWidth: '0.0625rem',\n borderRadius: 0.5,\n hoverBorderColor: '#3f3f3f',\n focusBorderColor: 'transparent'\n};\n\nConfigurableForm.argTypes = {\n foregroundColor: { control: { type: 'color' } },\n backgroundColor: { control: { type: 'color' } },\n borderColor: { control: { type: 'color' } },\n borderWidth: { control: { type: 'text' } },\n borderRadius: { control: { type: 'number' } },\n hoverBorderColor: { control: { type: 'color' } },\n focusBorderColor: { control: { type: 'color' } },\n heading: { table: { disable: true } },\n description: { table: { disable: true } }\n};\n"]}
|