@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 @@
|
|
|
1
|
+
{"version":3,"file":"FieldSelector.js","sourceRoot":"","sources":["../../../src/build/DynamicContentEditor/FieldSelector.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAkC,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAEvF,OAAO,EACL,QAAQ,EAER,mBAAmB,EAGnB,OAAO,EACR,MAAM,yBAAyB,CAAC;AAYjC,MAAM,aAAa,GAEf,CAAC,EACH,QAAQ,EACR,KAAK,EACL,IAAI,GAAG,eAAe,EACtB,QAAQ,GAAG,KAAK,EAChB,eAAe,EACf,WAAW,EACX,gBAAgB,EACjB,EAAE,EAAE;IACH,MAAM,CAAC,GAAG,OAAO,EAAE,CAAC;IAEpB,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;I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,EAAE,WAAW;YACnB,WAAW,EAAE,UAAU;YACvB,SAAS,EAAE,CAAC,CAAC,UAAU,CAAC;SACzB;QACD,QAAQ;KACT,CAAC;IACF,OAAO,KAAC,QAAQ,OAAK,aAAa,WAAI,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"]}
|
|
@@ -204,7 +204,7 @@ export const ConfigurableAppShell = (args) => {
|
|
|
204
204
|
};
|
|
205
205
|
ConfigurableAppShell.args = {
|
|
206
206
|
navColor: '#252c32',
|
|
207
|
-
headerColor: '#
|
|
207
|
+
headerColor: '#e2f1ff'
|
|
208
208
|
};
|
|
209
209
|
ConfigurableAppShell.argTypes = {
|
|
210
210
|
navColor: { control: { type: 'color' } },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppShell.stories.js","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,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,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.js","sourceRoot":"","sources":["../../../src/core/AppShell/AppShell.stories.tsx"],"names":[],"mappings":";AACA,OAAO,EAAc,UAAU,EAAa,QAAQ,E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,MAAM,CAAC,MAAM,oBAAoB,GAAqC,CACpE,IAA+B,EAC/B,EAAE;IACF,OAAO,CACL,KAAC,aAAa,IACZ,KAAK,EAAE;YACL,UAAU,EAAE;gBACV,WAAW,EAAE;oBACX,GAAG,EAAE;wBACH,kBAAkB,EAAE,IAAI,CAAC,QAAQ;qBAClC;oBACD,MAAM,EAAE;wBACN,kBAAkB,EAAE,IAAI,CAAC,WAAW;qBACrC;iBACF;aACF;SACF,YAED,KAAC,YAAY,IAAC,SAAS,iBAAG,WACZ,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: '#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.js","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,MAAC,IAAI,IAAC,EAAE,EAAE,UAAU,aAClB,KAAC,UAAU,cACT,KAAC,IAAI,IAAC,OAAO,EAAC,IAAI,oCAAmB,WAC1B,EACb,KAAC,WAAW,kQAIE,YACT,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,QAAQ,GAA2B,CAAC,IAAqB,EAAE,EAAE;IACxE,OAAO,CACL,MAAC,IAAI,IAAC,EAAE,EAAE,UAAU,aAClB,KAAC,SAAS,cACR,KAAC,KAAK,IACJ,GAAG,EAAC,yDAAyD,EAC7D,MAAM,EAAC,KAAK,EACZ,GAAG,EAAC,OAAO,WACX,WACQ,EACZ,KAAC,UAAU,IACT,OAAO,EACL,KAAC,UAAU,IACT,MAAM,QACN,OAAO,EAAC,QAAQ,EAChB,IAAI,EAAC,cAAc,EACnB,IAAI,EAAC,M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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.js","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,MAAC,IAAI,IAAC,EAAE,EAAE,UAAU,aAClB,KAAC,UAAU,cACT,KAAC,IAAI,IAAC,OAAO,E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MAAM,gBAAgB,GAAiC,CAAC,IAA2B,EAAE,EAAE;IAC5F,OAAO,CACL,KAAC,aAAa,IACZ,KAAK,EAAE;YACL,UAAU,EAAE;gBACV,IAAI,EAAE;oBACJ,eAAe,EAAE,IAAI,CAAC,YAAY;oBAClC,UAAU,EAAE,IAAI,CAAC,UAAU;iBAC5B;aACF;SACF,YAED,MAAC,IAAI,IAAC,EAAE,EAAE,UAAU,aAClB,KAAC,UAAU,cACT,KAAC,IAAI,IAAC,OAAO,EAAC,IAAI,oCAAmB,WAC1B,EACb,KAAC,WAAW,kQAIE,YACT,WACO,CACjB,CAAC;AACJ,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: '#71baff'\n};\n\nConfigurableCard.argTypes = {\n borderRadius: { control: { type: 'text' } },\n background: { control: { type: 'color' } }\n};\n"]}
|
|
@@ -1 +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AAE,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.js","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,EAAE;QAC1C,QAAQ,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE;QAC1C,QAAQ,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE;QAC1C,aAAa,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE;KAChD;CACM,CAAC;AAEV,MAAM,CAAC,MAAM,eAAe,GAA2B,CAAC,IAAqB,EAAE,EAAE;IAC/E,OAAO,CACL,KAAC,QAAQ,IACP,M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,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"}
|
|
@@ -41,26 +41,44 @@ CurrencyInputDemo.argTypes = {
|
|
|
41
41
|
readOnly: { control: { type: 'boolean' } }
|
|
42
42
|
};
|
|
43
43
|
export const CurrencyDisplayDemo = (args) => {
|
|
44
|
-
return (_jsx(CurrencyDisplay, { value: args.value, currencyISOCode: args.currencyISOCode,
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
return (_jsx(CurrencyDisplay, { value: args.value, currencyISOCode: args.currencyISOCode, formattingOptions: {
|
|
45
|
+
fractionDigits: args.fractionDigits,
|
|
46
|
+
groupSeparators: args.groupSeparators,
|
|
47
|
+
currency: args.currency,
|
|
48
|
+
negative: args.negative,
|
|
49
|
+
notation: args.notation
|
|
47
50
|
} }, void 0));
|
|
48
51
|
};
|
|
49
52
|
CurrencyDisplayDemo.args = {
|
|
50
|
-
value:
|
|
53
|
+
value: undefined,
|
|
51
54
|
currencyISOCode: 'USD',
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
+
groupSeparators: true,
|
|
56
|
+
fractionDigits: undefined,
|
|
57
|
+
currency: 'symbol',
|
|
58
|
+
negative: 'minus-sign',
|
|
59
|
+
notation: 'standard'
|
|
55
60
|
};
|
|
56
61
|
CurrencyDisplayDemo.argTypes = {
|
|
57
|
-
value: { control: { type: '
|
|
62
|
+
value: { control: { type: 'number' } },
|
|
58
63
|
currencyISOCode: {
|
|
59
|
-
options: ['USD', 'EUR', 'AUD', 'PLN', 'CZK', 'JPY'],
|
|
64
|
+
options: [undefined, 'USD', 'EUR', 'AUD', 'PLN', 'CZK', 'JPY'],
|
|
60
65
|
control: { type: 'select' }
|
|
61
66
|
},
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
67
|
+
groupSeparators: { control: { type: 'boolean' } },
|
|
68
|
+
fractionDigits: { control: { type: 'number', min: 0, max: 20, step: 1 } },
|
|
69
|
+
negative: {
|
|
70
|
+
control: {
|
|
71
|
+
type: 'inline-radio'
|
|
72
|
+
},
|
|
73
|
+
options: ['minus-sign', 'parentheses']
|
|
74
|
+
},
|
|
75
|
+
currency: {
|
|
76
|
+
control: { type: 'select' },
|
|
77
|
+
options: ['symbol', 'code', 'name']
|
|
78
|
+
},
|
|
79
|
+
notation: {
|
|
80
|
+
control: { type: 'inline-radio' },
|
|
81
|
+
options: ['standard', 'compact']
|
|
82
|
+
}
|
|
65
83
|
};
|
|
66
84
|
//# sourceMappingURL=Currency.stories.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Currency.stories.js","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;CACjB,CAAC;AAEV,MAAM,CAAC,MAAM,iBAAiB,GAA8B,CAAC,IAAwB,EAAE,EAAE;IACvF,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,EAAU,CAAC;IAE7C,OAAO,CACL,KAAC,aAAa,IACZ,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,UAAU,CAAC,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,EAC5C,MAAM,EAAE,UAAU,CAAC,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,EAC1C,eAAe,EAAE,IAAI,CAAC,eAAe,EACrC,iBAAiB,EAAE,IAAI,CAAC,iBAAiB,EACzC,WAAW,EAAE,IAAI,CAAC,WAAW,EAC7B,mBAAmB,EAAE,IAAI,CAAC,mBAAmB,EAC7C,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,WAAW,EAAE,IAAI,CAAC,WAAW,EAC7B,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,MAAM,EAAE,IAAI,CAAC,MAAM,EACnB,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,QAAQ,EAAE,IAAI,CAAC,QAAQ,WACvB,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,iBAAiB,CAAC,IAAI,GAAG;IACvB,eAAe,EAA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Ac,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"]}
|
|
@@ -68,8 +68,8 @@ export const ConfigurableForm = (args) => {
|
|
|
68
68
|
}, children: _jsx(FormContent, { cols: 2, showActions: true }, void 0) }, void 0));
|
|
69
69
|
};
|
|
70
70
|
ConfigurableForm.args = {
|
|
71
|
-
foregroundColor: '#
|
|
72
|
-
backgroundColor: '#
|
|
71
|
+
foregroundColor: '#054a8a',
|
|
72
|
+
backgroundColor: '#e2f1ff',
|
|
73
73
|
borderColor: '#939393',
|
|
74
74
|
borderWidth: '0.0625rem',
|
|
75
75
|
borderRadius: 0.5,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Form.stories.js","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,KAAC,WAAW,IAAC,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,WAAW,EAAE,IAAI,CAAC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,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.js","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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AAS;IAC3B,gBAAgB,EAAE,aAAa;CAChC,CAAC;AAEF,gBAAgB,CAAC,QAAQ,GAAG;IAC1B,eAAe,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,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: '#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"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Modal.stories.d.ts","sourceRoot":"","sources":["../../../src/core/Modal/Modal.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAY/C,OAAO,
|
|
1
|
+
{"version":3,"file":"Modal.stories.d.ts","sourceRoot":"","sources":["../../../src/core/Modal/Modal.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAY/C,OAAO,EAOL,UAAU,EAIX,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,YAAY,EAAc,MAAM,eAAe,CAAC;;AAEzD,wBAgBU;AAEV,eAAO,MAAM,SAAS,EAAE,KAAK,CAAC,UAAU,CA6BvC,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,UAAU,CAgE1C,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,UAAU,CA4FxC,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,UAAU,CA2F3C,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,UAAU,CAgC9C,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,KA+BzB,CAAC;AAQF,UAAU,0BAA0B;IAClC,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,YAAY,CAAC;IACtB,oBAAoB,EAAE,OAAO,CAAC;IAC9B,OAAO,CAAC,EAAE,KAAK,CAAC;IAChB,MAAM,CAAC,EAAE,KAAK,CAAC;CAChB;AAED,eAAO,MAAM,qBAAqB,EAAE,KAAK,CAAC,0BAA0B,CA8DnE,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useContext, useEffect, useMemo, useRef, useState } from 'react';
|
|
3
|
-
import { Button,
|
|
3
|
+
import { Button, Flex, Input, Modal, ModalManagerContext, Text, ToasterContext, cap } from '@pega/cosmos-react-core';
|
|
4
4
|
import { getContent } from './Modal.mocks';
|
|
5
5
|
export default {
|
|
6
6
|
title: 'Core/Modal',
|
|
@@ -21,7 +21,7 @@ export default {
|
|
|
21
21
|
};
|
|
22
22
|
export const ModalDemo = (args) => {
|
|
23
23
|
const MyModal = () => {
|
|
24
|
-
return (_jsx(
|
|
24
|
+
return (_jsx(Modal, { heading: 'This is the Modal heading', autoWidth: args.autoWidth, center: args.center, stretch: args.stretch, children: _jsx(Text, { children: "This is the content of the Modal." }, void 0) }, void 0));
|
|
25
25
|
};
|
|
26
26
|
const ModalButton = () => {
|
|
27
27
|
const { create } = useContext(ModalManagerContext);
|
|
@@ -40,7 +40,7 @@ export const ModalUpdates = (args) => {
|
|
|
40
40
|
content: 'This Modal has been updated a second time from within the Modal!'
|
|
41
41
|
});
|
|
42
42
|
}, children: "Update Modal" }, void 0) }, void 0));
|
|
43
|
-
return (_jsx(
|
|
43
|
+
return (_jsx(Modal, { heading: props.heading, actions: actions, autoWidth: args.autoWidth, center: args.center, stretch: args.stretch, children: _jsx(Text, { children: props.content }, void 0) }, void 0));
|
|
44
44
|
};
|
|
45
45
|
const ModalButton = () => {
|
|
46
46
|
const { create } = useContext(ModalManagerContext);
|
|
@@ -73,7 +73,7 @@ export const AlertModal = (args) => {
|
|
|
73
73
|
props.closeInitialModal();
|
|
74
74
|
}, children: "Yes" }, void 0)] }, void 0));
|
|
75
75
|
}, [dismiss]);
|
|
76
|
-
return (_jsx(
|
|
76
|
+
return (_jsx(Modal, { heading: 'You have unsaved changes!', actions: actions, center: args.center, stretch: args.stretch, children: _jsx(Text, { children: "Are you sure you want to close without saving?" }, void 0) }, void 0));
|
|
77
77
|
};
|
|
78
78
|
const MyModal = () => {
|
|
79
79
|
const [name, setName] = useState('');
|
|
@@ -92,7 +92,7 @@ export const AlertModal = (args) => {
|
|
|
92
92
|
const onNameChange = (e) => {
|
|
93
93
|
setName(e.target.value);
|
|
94
94
|
};
|
|
95
|
-
return (_jsx(
|
|
95
|
+
return (_jsx(Modal, { actions: actions, heading: 'Close the Modal without saving any data to invoke the alert', autoWidth: args.autoWidth, center: args.center, stretch: args.stretch, children: _jsx(Input, { label: 'Name', name: 'name', onChange: onNameChange, value: name, required: true }, void 0) }, void 0));
|
|
96
96
|
};
|
|
97
97
|
const ModalButton = () => {
|
|
98
98
|
const { create } = useContext(ModalManagerContext);
|
|
@@ -149,7 +149,7 @@ export const ProgressState = () => {
|
|
|
149
149
|
export const MinimizableModal = (args) => {
|
|
150
150
|
const [count, setCount] = useState(1);
|
|
151
151
|
const MyModal = () => {
|
|
152
|
-
return (_jsx(
|
|
152
|
+
return (_jsx(Modal, { heading: `Modal #${count}`, autoWidth: args.autoWidth, center: args.center, stretch: args.stretch, children: _jsx(Text, { children: "This Modal can be minimized by clicking the minimize button above." }, void 0) }, void 0));
|
|
153
153
|
};
|
|
154
154
|
const ModalButton = () => {
|
|
155
155
|
const { create } = useContext(ModalManagerContext);
|
|
@@ -163,7 +163,7 @@ export const MinimizableModal = (args) => {
|
|
|
163
163
|
export const DockedModal = () => {
|
|
164
164
|
const [count, setCount] = useState(1);
|
|
165
165
|
const MyModal = () => {
|
|
166
|
-
return (_jsx(
|
|
166
|
+
return (_jsx(Modal, { heading: `Modal #${count}`, children: _jsx(Text, { children: "This Modal can be minimized by clicking the minimize button above." }, void 0) }, void 0));
|
|
167
167
|
};
|
|
168
168
|
const ModalButton = () => {
|
|
169
169
|
const { create } = useContext(ModalManagerContext);
|
|
@@ -188,13 +188,13 @@ export const AutoWidthModalContent = (args) => {
|
|
|
188
188
|
const MyModal = ({ content }) => {
|
|
189
189
|
const { ModalContext } = useContext(ModalManagerContext);
|
|
190
190
|
const { dismiss } = useContext(ModalContext);
|
|
191
|
-
return (_jsx(
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
191
|
+
return (_jsx(Modal, { heading: `Modal ${args.autoWidth ? 'with' : 'without'} autoWidth`, autoWidth: args.autoWidth, actions: args.content.includes('form') || args.content === 'random' ? (_jsxs(_Fragment, { children: [_jsx(Button, { name: 'Cancel', variant: 'secondary', onClick: () => {
|
|
192
|
+
dismiss();
|
|
193
|
+
push({ content: 'Form cancelled!' });
|
|
194
|
+
}, children: "Cancel" }, void 0), _jsx(Button, { name: 'Submit', variant: 'primary', onClick: () => {
|
|
195
|
+
dismiss();
|
|
196
|
+
push({ content: 'Form submitted!' });
|
|
197
|
+
}, children: "Submit" }, void 0)] }, void 0)) : undefined, children: content }, void 0));
|
|
198
198
|
};
|
|
199
199
|
const ModalButton = () => {
|
|
200
200
|
const { create } = useContext(ModalManagerContext);
|