@pega/cosmos-react-demos 4.0.0-dev.18.0 → 4.0.0-dev.18.2

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.
Files changed (123) hide show
  1. package/jsx/core/AIButton/AIButton.stories.d.ts +5 -1
  2. package/jsx/core/AIButton/AIButton.stories.d.ts.map +1 -1
  3. package/jsx/core/AIButton/AIButton.stories.jsx +55 -28
  4. package/jsx/core/AIButton/AIButton.stories.jsx.map +1 -1
  5. package/jsx/core/AppShell/AppShell.stories.d.ts.map +1 -1
  6. package/jsx/core/AppShell/AppShell.stories.jsx +8 -54
  7. package/jsx/core/AppShell/AppShell.stories.jsx.map +1 -1
  8. package/jsx/core/Banner/Banner.stories.d.ts.map +1 -1
  9. package/jsx/core/Banner/Banner.stories.jsx +17 -11
  10. package/jsx/core/Banner/Banner.stories.jsx.map +1 -1
  11. package/jsx/core/Dialog/FormDialog.mocks.d.ts.map +1 -1
  12. package/jsx/core/Dialog/FormDialog.mocks.jsx +4 -2
  13. package/jsx/core/Dialog/FormDialog.mocks.jsx.map +1 -1
  14. package/jsx/core/Dialog/InfoDialog.mocks.d.ts.map +1 -1
  15. package/jsx/core/Dialog/InfoDialog.mocks.jsx +2 -1
  16. package/jsx/core/Dialog/InfoDialog.mocks.jsx.map +1 -1
  17. package/jsx/core/Modal/Modal.stories.d.ts.map +1 -1
  18. package/jsx/core/Modal/Modal.stories.jsx +2 -1
  19. package/jsx/core/Modal/Modal.stories.jsx.map +1 -1
  20. package/jsx/core/MultiStepForm/MultiStepForm.mocks.d.ts +36 -3
  21. package/jsx/core/MultiStepForm/MultiStepForm.mocks.d.ts.map +1 -1
  22. package/jsx/core/MultiStepForm/MultiStepForm.mocks.jsx +294 -39
  23. package/jsx/core/MultiStepForm/MultiStepForm.mocks.jsx.map +1 -1
  24. package/jsx/core/MultiStepForm/MultiStepForm.stories.d.ts +2 -5
  25. package/jsx/core/MultiStepForm/MultiStepForm.stories.d.ts.map +1 -1
  26. package/jsx/core/MultiStepForm/MultiStepForm.stories.jsx +59 -172
  27. package/jsx/core/MultiStepForm/MultiStepForm.stories.jsx.map +1 -1
  28. package/jsx/core/Progress/Progress.mocks.d.ts +2 -0
  29. package/jsx/core/Progress/Progress.mocks.d.ts.map +1 -0
  30. package/jsx/core/Progress/Progress.mocks.js +2 -0
  31. package/jsx/core/Progress/Progress.mocks.js.map +1 -0
  32. package/jsx/core/Progress/Progress.stories.d.ts.map +1 -1
  33. package/jsx/core/Progress/Progress.stories.jsx +2 -2
  34. package/jsx/core/Progress/Progress.stories.jsx.map +1 -1
  35. package/jsx/core/Tooltip/Tooltip.stories.d.ts +1 -0
  36. package/jsx/core/Tooltip/Tooltip.stories.d.ts.map +1 -1
  37. package/jsx/core/Tooltip/Tooltip.stories.jsx +21 -1
  38. package/jsx/core/Tooltip/Tooltip.stories.jsx.map +1 -1
  39. package/jsx/core/Tooltip/Tooltip.styles.d.ts +2 -0
  40. package/jsx/core/Tooltip/Tooltip.styles.d.ts.map +1 -0
  41. package/jsx/core/Tooltip/Tooltip.styles.js +23 -0
  42. package/jsx/core/Tooltip/Tooltip.styles.js.map +1 -0
  43. package/jsx/work/Assignments/Assignments.stories.d.ts.map +1 -1
  44. package/jsx/work/Assignments/Assignments.stories.jsx +3 -29
  45. package/jsx/work/Assignments/Assignments.stories.jsx.map +1 -1
  46. package/jsx/work/CaseView/Attachments.mocks.d.ts.map +1 -1
  47. package/jsx/work/CaseView/Attachments.mocks.jsx +62 -60
  48. package/jsx/work/CaseView/Attachments.mocks.jsx.map +1 -1
  49. package/jsx/work/CaseView/CaseView.mocks.d.ts.map +1 -1
  50. package/jsx/work/CaseView/CaseView.mocks.jsx +97 -9
  51. package/jsx/work/CaseView/CaseView.mocks.jsx.map +1 -1
  52. package/jsx/work/CaseView/CaseView.stories.d.ts +2 -2
  53. package/jsx/work/CaseView/CaseView.stories.d.ts.map +1 -1
  54. package/jsx/work/CaseView/CaseView.stories.jsx +2 -2
  55. package/jsx/work/CaseView/CaseView.stories.jsx.map +1 -1
  56. package/jsx/work/CaseView/FileService.mock.d.ts.map +1 -1
  57. package/jsx/work/CaseView/FileService.mock.jsx +2 -6
  58. package/jsx/work/CaseView/FileService.mock.jsx.map +1 -1
  59. package/jsx/work/Tasks/Tasks.stories.d.ts.map +1 -1
  60. package/jsx/work/Tasks/Tasks.stories.jsx +3 -29
  61. package/jsx/work/Tasks/Tasks.stories.jsx.map +1 -1
  62. package/lib/core/AIButton/AIButton.stories.d.ts +5 -1
  63. package/lib/core/AIButton/AIButton.stories.d.ts.map +1 -1
  64. package/lib/core/AIButton/AIButton.stories.js +57 -29
  65. package/lib/core/AIButton/AIButton.stories.js.map +1 -1
  66. package/lib/core/AppShell/AppShell.stories.d.ts.map +1 -1
  67. package/lib/core/AppShell/AppShell.stories.js +9 -21
  68. package/lib/core/AppShell/AppShell.stories.js.map +1 -1
  69. package/lib/core/Banner/Banner.stories.d.ts.map +1 -1
  70. package/lib/core/Banner/Banner.stories.js +17 -11
  71. package/lib/core/Banner/Banner.stories.js.map +1 -1
  72. package/lib/core/Dialog/FormDialog.mocks.d.ts.map +1 -1
  73. package/lib/core/Dialog/FormDialog.mocks.js +4 -2
  74. package/lib/core/Dialog/FormDialog.mocks.js.map +1 -1
  75. package/lib/core/Dialog/InfoDialog.mocks.d.ts.map +1 -1
  76. package/lib/core/Dialog/InfoDialog.mocks.js +2 -1
  77. package/lib/core/Dialog/InfoDialog.mocks.js.map +1 -1
  78. package/lib/core/Modal/Modal.stories.d.ts.map +1 -1
  79. package/lib/core/Modal/Modal.stories.js +2 -1
  80. package/lib/core/Modal/Modal.stories.js.map +1 -1
  81. package/lib/core/MultiStepForm/MultiStepForm.mocks.d.ts +36 -3
  82. package/lib/core/MultiStepForm/MultiStepForm.mocks.d.ts.map +1 -1
  83. package/lib/core/MultiStepForm/MultiStepForm.mocks.js +269 -31
  84. package/lib/core/MultiStepForm/MultiStepForm.mocks.js.map +1 -1
  85. package/lib/core/MultiStepForm/MultiStepForm.stories.d.ts +2 -5
  86. package/lib/core/MultiStepForm/MultiStepForm.stories.d.ts.map +1 -1
  87. package/lib/core/MultiStepForm/MultiStepForm.stories.js +54 -170
  88. package/lib/core/MultiStepForm/MultiStepForm.stories.js.map +1 -1
  89. package/lib/core/Progress/Progress.mocks.d.ts +2 -0
  90. package/lib/core/Progress/Progress.mocks.d.ts.map +1 -0
  91. package/lib/core/Progress/Progress.mocks.js +2 -0
  92. package/lib/core/Progress/Progress.mocks.js.map +1 -0
  93. package/lib/core/Progress/Progress.stories.d.ts.map +1 -1
  94. package/lib/core/Progress/Progress.stories.js +2 -2
  95. package/lib/core/Progress/Progress.stories.js.map +1 -1
  96. package/lib/core/Tooltip/Tooltip.stories.d.ts +1 -0
  97. package/lib/core/Tooltip/Tooltip.stories.d.ts.map +1 -1
  98. package/lib/core/Tooltip/Tooltip.stories.js +9 -1
  99. package/lib/core/Tooltip/Tooltip.stories.js.map +1 -1
  100. package/lib/core/Tooltip/Tooltip.styles.d.ts +2 -0
  101. package/lib/core/Tooltip/Tooltip.styles.d.ts.map +1 -0
  102. package/lib/core/Tooltip/Tooltip.styles.js +23 -0
  103. package/lib/core/Tooltip/Tooltip.styles.js.map +1 -0
  104. package/lib/work/Assignments/Assignments.stories.d.ts.map +1 -1
  105. package/lib/work/Assignments/Assignments.stories.js +4 -10
  106. package/lib/work/Assignments/Assignments.stories.js.map +1 -1
  107. package/lib/work/CaseView/Attachments.mocks.d.ts.map +1 -1
  108. package/lib/work/CaseView/Attachments.mocks.js +77 -70
  109. package/lib/work/CaseView/Attachments.mocks.js.map +1 -1
  110. package/lib/work/CaseView/CaseView.mocks.d.ts.map +1 -1
  111. package/lib/work/CaseView/CaseView.mocks.js +61 -9
  112. package/lib/work/CaseView/CaseView.mocks.js.map +1 -1
  113. package/lib/work/CaseView/CaseView.stories.d.ts +2 -2
  114. package/lib/work/CaseView/CaseView.stories.d.ts.map +1 -1
  115. package/lib/work/CaseView/CaseView.stories.js +2 -2
  116. package/lib/work/CaseView/CaseView.stories.js.map +1 -1
  117. package/lib/work/CaseView/FileService.mock.d.ts.map +1 -1
  118. package/lib/work/CaseView/FileService.mock.js +2 -6
  119. package/lib/work/CaseView/FileService.mock.js.map +1 -1
  120. package/lib/work/Tasks/Tasks.stories.d.ts.map +1 -1
  121. package/lib/work/Tasks/Tasks.stories.js +4 -10
  122. package/lib/work/Tasks/Tasks.stories.js.map +1 -1
  123. package/package.json +9 -9
@@ -1 +1 @@
1
- {"version":3,"file":"Modal.stories.js","sourceRoot":"","sources":["../../../src/core/Modal/Modal.stories.tsx"],"names":[],"mappings":";AACA,OAAO,EAA8B,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACzF,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAElD,OAAO,EACL,MAAM,EACN,IAAI,EACJ,KAAK,EACL,KAAK,EAGL,IAAI,EACJ,eAAe,EACf,eAAe,EACf,UAAU,EACV,GAAG,EACJ,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAgB,UAAU,EAAE,MAAM,eAAe,CAAC;AAEzD,eAAe;IACb,KAAK,EAAE,YAAY;IACnB,SAAS,EAAE,KAAK;IAChB,UAAU,EAAE;QACV,MAAM,EAAE,UAAU;KACnB;IACD,IAAI,EAAE;QACJ,SAAS,EAAE,KAAK;QAChB,OAAO,EAAE,KAAK;QACd,MAAM,EAAE,KAAK;QACb,SAAS,EAAE,MAAM,CAAC,wBAAwB,CAAC;QAC3C,UAAU,EAAE,MAAM,CAAC,yBAAyB,CAAC;QAC7C,UAAU,EAAE,MAAM,CAAC,2BAA2B,CAAC;QAC/C,gBAAgB,EAAE,MAAM,CAAC,yBAAyB,CAAC;QACnD,iBAAiB,EAAE,MAAM,CAAC,0BAA0B,CAAC;QACrD,iBAAiB,EAAE,MAAM,CAAC,0BAA0B,CAAC;QACrD,aAAa,EAAE,MAAM,CAAC,0BAA0B,C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,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;IACrC,MAAM,EAAE,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;IACpC,OAAO,EAAE;QACP,OAAO,EAAE;YACP,YAAY;YACZ,WAAW;YACX,OAAO;YACP,OAAO;YACP,iBAAiB;YACjB,iBAAiB;YACjB,iBAAiB;YACjB,QAAQ;SACT;QACD,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;KAC5B;IACD,oBAAoB,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE;CACvD,CAAC","sourcesContent":["import { Meta, Story } from '@storybook/react';\nimport { FC, ChangeEvent, ReactNode, useEffect, useMemo, useRef, useState } from 'react';\nimport { action } from '@storybook/addon-actions';\n\nimport {\n Button,\n Flex,\n Input,\n Modal,\n ModalMethods,\n ModalProps,\n Text,\n useModalManager,\n useModalContext,\n useToaster,\n cap\n} from '@pega/cosmos-react-core';\n\nimport { ContentTypes, getContent } from './Modal.mocks';\n\nexport default {\n title: 'Core/Modal',\n component: Modal,\n parameters: {\n layout: 'centered'\n },\n args: {\n autoWidth: false,\n stretch: false,\n center: false,\n onDismiss: action('Clicked dismiss button'),\n onMinimize: action('Clicked minimize button'),\n onActivate: action('Activates minimized modal'),\n onRequestDismiss: action('onRequestDismiss called'),\n onRequestMinimize: action('onRequestMinimize called'),\n onRequestActivate: action('onRequestActivate called'),\n onRequestDock: action('onRequestActivate called')\n },\n argTypes: {\n autoWidth: { control: { type: 'boolean' } },\n stretch: { control: { type: 'boolean' } },\n center: { control: { type: 'boolean' } },\n onDismiss: { table: { disable: true } },\n onMinimize: { table: { disable: true } },\n onActivate: { table: { disable: true } },\n onRequestDismiss: { table: { disable: true } },\n onRequestMinimize: { table: { disable: true } },\n onRequestActivate: { table: { disable: true } },\n onRequestDock: { table: { disable: true } }\n }\n} as Meta;\n\ninterface ModalDemoProps {\n autoWidth: ModalProps['autoWidth'];\n center: ModalProps['center'];\n stretch: ModalProps['stretch'];\n onDismiss?: (id: string) => void;\n onMinimize?: (id: string) => void;\n onActivate?: (id: string) => void;\n onRequestDismiss?: () => boolean;\n onRequestMinimize?: () => boolean;\n onRequestActivate?: () => boolean;\n onRequestDock?: () => boolean;\n}\n\ninterface AlertModalDemoProps extends ModalDemoProps {\n onKeyDown?: (e: KeyboardEvent) => void;\n}\n\nexport const ModalDemo: Story<ModalDemoProps> = (args: ModalDemoProps) => {\n const MyModal = () => {\n return (\n <Modal\n heading='This is the Modal heading'\n autoWidth={args.autoWidth}\n center={args.center}\n stretch={args.stretch}\n >\n <Text>This is the content of the Modal.</Text>\n </Modal>\n );\n };\n\n const ModalButton = () => {\n const { create } = useModalManager();\n\n return (\n <Button\n onClick={() => {\n create(MyModal);\n }}\n >\n Open Modal\n </Button>\n );\n };\n\n return <ModalButton />;\n};\n\nexport const ModalUpdates: Story<ModalDemoProps> = (args: ModalDemoProps) => {\n interface ModalUpdatesProps {\n content: string;\n disableButton: boolean;\n heading: string;\n }\n\n const MyModal: FC<ModalUpdatesProps> = props => {\n const { update } = useModalContext();\n\n const actions = (\n <Button\n variant='primary'\n disabled={props.disableButton}\n onClick={() => {\n update({\n content: 'This Modal has been updated a second time from within the Modal!'\n });\n }}\n >\n Update Modal\n </Button>\n );\n\n return (\n <Modal\n heading={props.heading}\n actions={actions}\n autoWidth={args.autoWidth}\n center={args.center}\n stretch={args.stretch}\n >\n <Text>{props.content}</Text>\n </Modal>\n );\n };\n\n const ModalButton = () => {\n const { create } = useModalManager();\n const modalMethods = useRef<ModalMethods<ModalUpdatesProps>>();\n\n const openModal = () => {\n modalMethods.current = create(MyModal, {\n heading: 'This is the Modal heading',\n content: 'This Modal will automatically update in a few seconds.',\n disableButton: true\n });\n\n setTimeout(() => {\n modalMethods.current?.update({\n heading: 'This is the updated Modal heading',\n content: 'This Modal has been updated from its parent!',\n disableButton: false\n });\n }, 2000);\n };\n\n return <Button onClick={openModal}>Open Modal</Button>;\n };\n\n return <ModalButton />;\n};\n\nexport const AlertModal: Story<AlertModalDemoProps> = (args: AlertModalDemoProps) => {\n const MyAlert = (props: { closeInitialModal: () => void }) => {\n const { dismiss } = useModalContext();\n\n const actions = useMemo(() => {\n return (\n <>\n <Button onClick={dismiss}>No</Button>\n <Button\n variant='primary'\n onClick={() => {\n dismiss();\n props.closeInitialModal();\n }}\n >\n Yes\n </Button>\n </>\n );\n }, [dismiss]);\n\n return (\n <Modal\n heading='You have unsaved changes!'\n actions={actions}\n center={args.center}\n stretch={args.stretch}\n >\n <Text>Are you sure you want to close without saving?</Text>\n </Modal>\n );\n };\n\n const MyModal = () => {\n const [name, setName] = useState('');\n const { create } = useModalManager();\n const { dismiss } = useModalContext();\n\n const actions = useMemo(() => {\n return (\n <>\n <Button\n onClick={() => {\n if (name !== '') {\n create(MyAlert, { closeInitialModal: dismiss }, { alert: true });\n } else {\n dismiss();\n }\n }}\n >\n Close\n </Button>\n <Button variant='primary' onClick={dismiss} disabled={name === ''}>\n Save\n </Button>\n </>\n );\n }, [dismiss, name]);\n\n const onNameChange = (e: ChangeEvent<HTMLInputElement>) => {\n setName(e.target.value);\n };\n\n return (\n <Modal\n actions={actions}\n heading='Close the Modal without saving any data to invoke the alert'\n autoWidth={args.autoWidth}\n center={args.center}\n stretch={args.stretch}\n onRequestDismiss={() => {\n if (name !== '') {\n create(MyAlert, { closeInitialModal: dismiss }, { alert: true });\n return false;\n }\n }}\n >\n <Input\n label='Name'\n name='name'\n onChange={onNameChange}\n onKeyDown={args.onKeyDown}\n value={name}\n required\n />\n </Modal>\n );\n };\n\n const ModalButton = () => {\n const { create } = useModalManager();\n\n return (\n <Button\n onClick={() => {\n create(MyModal, undefined, {\n onDismiss: args.onDismiss\n });\n }}\n >\n Open Modal\n </Button>\n );\n };\n\n return <ModalButton />;\n};\n\nAlertModal.args = {\n onKeyDown: action(\"Called input's onKeyDown\")\n};\n\nAlertModal.argTypes = {\n onKeyDown: { table: { disable: true } }\n};\n\nexport const ProgressState: Story = () => {\n const LoadingStateModal = () => {\n const { dismiss } = useModalContext();\n\n const [transientState, setTransientState] = useState<'loading' | 'submitting' | null>(\n 'loading'\n );\n\n const actions =\n transientState === 'loading' ? null : (\n <>\n <Button\n disabled={!!transientState}\n onClick={() => {\n if (transientState !== 'submitting') {\n dismiss();\n }\n }}\n >\n Cancel\n </Button>\n <Button\n disabled={!!transientState}\n variant='primary'\n onClick={() => {\n setTransientState('submitting');\n }}\n >\n Submit\n </Button>\n </>\n );\n\n useEffect(() => {\n let timerID: number;\n\n if (transientState === 'loading' || transientState === 'submitting') {\n timerID = window.setTimeout(() => {\n if (transientState === 'loading') {\n setTransientState(null);\n } else {\n dismiss();\n }\n }, 3000);\n }\n\n return () => {\n window.clearTimeout(timerID);\n };\n }, [transientState]);\n\n return (\n <Modal\n progress={useMemo(() => {\n if (transientState) {\n return {\n message: `${cap(transientState)}…`\n };\n }\n }, [transientState])}\n heading='Modal progress demo'\n actions={actions}\n onRequestDismiss={() => transientState !== 'submitting'}\n >\n {transientState !== 'loading' && (\n <Flex container={{ direction: 'column', gap: 2 }}>\n {Array.from({ length: 5 }, (_, i) => (\n <Input key={i} label={`Field-${i + 1}`} />\n ))}\n </Flex>\n )}\n </Modal>\n );\n };\n\n const ModalButton = () => {\n const { create } = useModalManager();\n\n return (\n <Button\n onClick={() => {\n create(LoadingStateModal);\n }}\n >\n Open Modal\n </Button>\n );\n };\n\n return <ModalButton />;\n};\n\nexport const MinimizableModal: Story<ModalDemoProps> = (args: ModalDemoProps) => {\n const [count, setCount] = useState(1);\n\n const MyModal = () => {\n return (\n <Modal\n heading={`Modal #${count}`}\n autoWidth={args.autoWidth}\n center={args.center}\n stretch={args.stretch}\n onRequestDismiss={args.onRequestDismiss}\n onRequestMinimize={args.onRequestMinimize}\n onRequestActivate={args.onRequestActivate}\n >\n <Text>This Modal can be minimized by clicking the minimize button above.</Text>\n </Modal>\n );\n };\n\n const ModalButton = () => {\n const { create } = useModalManager();\n\n return (\n <Button\n onClick={() => {\n setCount(count + 1);\n create(MyModal, undefined, {\n minimizable: true,\n id: `Modal #${count}`,\n onDismiss: args.onDismiss,\n onMinimize: args.onMinimize,\n onActivate: args.onActivate\n });\n }}\n >\n Open Modal\n </Button>\n );\n };\n\n return <ModalButton />;\n};\n\nexport const DockedModal: Story<ModalDemoProps> = (args: ModalDemoProps) => {\n const [count, setCount] = useState(1);\n\n const MyModal = () => {\n return (\n <Modal heading={`Modal #${count}`} onRequestDock={args.onRequestDock}>\n <Text>This Modal can be minimized by clicking the minimize button above.</Text>\n </Modal>\n );\n };\n\n const ModalButton = () => {\n const { create } = useModalManager();\n\n return (\n <Button\n onClick={() => {\n setCount(count + 1);\n create(MyModal, undefined, {\n minimizable: true,\n maximizable: true,\n dockable: true\n });\n }}\n >\n Open Modal\n </Button>\n );\n };\n\n return <ModalButton />;\n};\n\ninterface AutoWidthModalContentProps {\n autoWidth: boolean;\n content: ContentTypes;\n formColumnWidthFixed: boolean;\n stretch?: never;\n center?: never;\n}\n\nexport const AutoWidthModalContent: Story<AutoWidthModalContentProps> = (\n args: AutoWidthModalContentProps\n) => {\n const { push } = useToaster();\n\n const MyModal = ({ content }: { content: ReactNode }) => {\n const { dismiss } = useModalContext();\n\n return (\n <Modal\n heading={`Modal ${args.autoWidth ? 'with' : 'without'} autoWidth`}\n autoWidth={args.autoWidth}\n actions={\n args.content.includes('form') || args.content === 'random' ? (\n <>\n <Button\n name='Cancel'\n variant='secondary'\n onClick={() => {\n dismiss();\n push({ content: 'Form cancelled!' });\n }}\n >\n Cancel\n </Button>\n <Button\n name='Submit'\n variant='primary'\n onClick={() => {\n dismiss();\n push({ content: 'Form submitted!' });\n }}\n >\n Submit\n </Button>\n </>\n ) : undefined\n }\n >\n {content}\n </Modal>\n );\n };\n\n const ModalButton = () => {\n const { create } = useModalManager();\n\n return (\n <Button\n onClick={() => {\n create(MyModal, {\n content: getContent(args.content, args.formColumnWidthFixed)\n });\n }}\n >\n Open Modal\n </Button>\n );\n };\n\n return <ModalButton />;\n};\n\nAutoWidthModalContent.args = {\n autoWidth: true,\n content: 'short text',\n formColumnWidthFixed: false\n};\n\nAutoWidthModalContent.argTypes = {\n stretch: { table: { disable: true } },\n center: { table: { disable: true } },\n content: {\n options: [\n 'short text',\n 'long text',\n 'image',\n 'table',\n 'form (1 column)',\n 'form (2 column)',\n 'form (3 column)',\n 'random'\n ],\n control: { type: 'select' }\n },\n formColumnWidthFixed: { control: { type: 'boolean' } }\n};\n"]}
1
+ {"version":3,"file":"Modal.stories.js","sourceRoot":"","sources":["../../../src/core/Modal/Modal.stories.tsx"],"names":[],"mappings":";AACA,OAAO,EAA8B,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACzF,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAElD,OAAO,EACL,MAAM,EACN,IAAI,EACJ,KAAK,EACL,KAAK,EAGL,IAAI,EACJ,eAAe,EACf,eAAe,EACf,UAAU,EACV,GAAG,EACJ,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAE9D,OAAO,EAAgB,UAAU,EAAE,MAAM,eAAe,CAAC;AAEzD,eAAe;IACb,KAAK,EAAE,YAAY;IACnB,SAAS,EAAE,KAAK;IAChB,UAAU,EAAE;QACV,MAAM,EAAE,UAAU;KACnB;IACD,IAAI,EAAE;QACJ,SAAS,EAAE,KAAK;QAChB,OAAO,EAAE,KAAK;QACd,MAAM,EAAE,KAAK;QACb,SAAS,EAAE,MAAM,CAAC,wBAAwB,CAAC;QAC3C,UAAU,EAAE,MAAM,CAAC,yBAAyB,CAAC;QAC7C,UAAU,EAAE,MAAM,CAAC,2BAA2B,CAAC;QAC/C,gBAAgB,EAAE,MAAM,CAAC,yBAAyB,CAAC;QACnD,iBAAiB,EAAE,MAAM,CAAC,0BAA0B,CAAC;QACrD,iBAAiB,EAAE,MAAM,CAAC,0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,CAAC,QAAQ,GAAG;IAC/B,OAAO,EAAE,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;IACrC,MAAM,EAAE,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;IACpC,OAAO,EAAE;QACP,OAAO,EAAE;YACP,YAAY;YACZ,WAAW;YACX,OAAO;YACP,OAAO;YACP,iBAAiB;YACjB,iBAAiB;YACjB,iBAAiB;YACjB,QAAQ;SACT;QACD,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;KAC5B;IACD,oBAAoB,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE;CACvD,CAAC","sourcesContent":["import { Meta, Story } from '@storybook/react';\nimport { FC, ChangeEvent, ReactNode, useEffect, useMemo, useRef, useState } from 'react';\nimport { action } from '@storybook/addon-actions';\n\nimport {\n Button,\n Flex,\n Input,\n Modal,\n ModalMethods,\n ModalProps,\n Text,\n useModalManager,\n useModalContext,\n useToaster,\n cap\n} from '@pega/cosmos-react-core';\n\nimport { loadingTimeoutMS } from '../Progress/Progress.mocks';\n\nimport { ContentTypes, getContent } from './Modal.mocks';\n\nexport default {\n title: 'Core/Modal',\n component: Modal,\n parameters: {\n layout: 'centered'\n },\n args: {\n autoWidth: false,\n stretch: false,\n center: false,\n onDismiss: action('Clicked dismiss button'),\n onMinimize: action('Clicked minimize button'),\n onActivate: action('Activates minimized modal'),\n onRequestDismiss: action('onRequestDismiss called'),\n onRequestMinimize: action('onRequestMinimize called'),\n onRequestActivate: action('onRequestActivate called'),\n onRequestDock: action('onRequestActivate called')\n },\n argTypes: {\n autoWidth: { control: { type: 'boolean' } },\n stretch: { control: { type: 'boolean' } },\n center: { control: { type: 'boolean' } },\n onDismiss: { table: { disable: true } },\n onMinimize: { table: { disable: true } },\n onActivate: { table: { disable: true } },\n onRequestDismiss: { table: { disable: true } },\n onRequestMinimize: { table: { disable: true } },\n onRequestActivate: { table: { disable: true } },\n onRequestDock: { table: { disable: true } }\n }\n} as Meta;\n\ninterface ModalDemoProps {\n autoWidth: ModalProps['autoWidth'];\n center: ModalProps['center'];\n stretch: ModalProps['stretch'];\n onDismiss?: (id: string) => void;\n onMinimize?: (id: string) => void;\n onActivate?: (id: string) => void;\n onRequestDismiss?: () => boolean;\n onRequestMinimize?: () => boolean;\n onRequestActivate?: () => boolean;\n onRequestDock?: () => boolean;\n}\n\ninterface AlertModalDemoProps extends ModalDemoProps {\n onKeyDown?: (e: KeyboardEvent) => void;\n}\n\nexport const ModalDemo: Story<ModalDemoProps> = (args: ModalDemoProps) => {\n const MyModal = () => {\n return (\n <Modal\n heading='This is the Modal heading'\n autoWidth={args.autoWidth}\n center={args.center}\n stretch={args.stretch}\n >\n <Text>This is the content of the Modal.</Text>\n </Modal>\n );\n };\n\n const ModalButton = () => {\n const { create } = useModalManager();\n\n return (\n <Button\n onClick={() => {\n create(MyModal);\n }}\n >\n Open Modal\n </Button>\n );\n };\n\n return <ModalButton />;\n};\n\nexport const ModalUpdates: Story<ModalDemoProps> = (args: ModalDemoProps) => {\n interface ModalUpdatesProps {\n content: string;\n disableButton: boolean;\n heading: string;\n }\n\n const MyModal: FC<ModalUpdatesProps> = props => {\n const { update } = useModalContext();\n\n const actions = (\n <Button\n variant='primary'\n disabled={props.disableButton}\n onClick={() => {\n update({\n content: 'This Modal has been updated a second time from within the Modal!'\n });\n }}\n >\n Update Modal\n </Button>\n );\n\n return (\n <Modal\n heading={props.heading}\n actions={actions}\n autoWidth={args.autoWidth}\n center={args.center}\n stretch={args.stretch}\n >\n <Text>{props.content}</Text>\n </Modal>\n );\n };\n\n const ModalButton = () => {\n const { create } = useModalManager();\n const modalMethods = useRef<ModalMethods<ModalUpdatesProps>>();\n\n const openModal = () => {\n modalMethods.current = create(MyModal, {\n heading: 'This is the Modal heading',\n content: 'This Modal will automatically update in a few seconds.',\n disableButton: true\n });\n\n setTimeout(() => {\n modalMethods.current?.update({\n heading: 'This is the updated Modal heading',\n content: 'This Modal has been updated from its parent!',\n disableButton: false\n });\n }, 2000);\n };\n\n return <Button onClick={openModal}>Open Modal</Button>;\n };\n\n return <ModalButton />;\n};\n\nexport const AlertModal: Story<AlertModalDemoProps> = (args: AlertModalDemoProps) => {\n const MyAlert = (props: { closeInitialModal: () => void }) => {\n const { dismiss } = useModalContext();\n\n const actions = useMemo(() => {\n return (\n <>\n <Button onClick={dismiss}>No</Button>\n <Button\n variant='primary'\n onClick={() => {\n dismiss();\n props.closeInitialModal();\n }}\n >\n Yes\n </Button>\n </>\n );\n }, [dismiss]);\n\n return (\n <Modal\n heading='You have unsaved changes!'\n actions={actions}\n center={args.center}\n stretch={args.stretch}\n >\n <Text>Are you sure you want to close without saving?</Text>\n </Modal>\n );\n };\n\n const MyModal = () => {\n const [name, setName] = useState('');\n const { create } = useModalManager();\n const { dismiss } = useModalContext();\n\n const actions = useMemo(() => {\n return (\n <>\n <Button\n onClick={() => {\n if (name !== '') {\n create(MyAlert, { closeInitialModal: dismiss }, { alert: true });\n } else {\n dismiss();\n }\n }}\n >\n Close\n </Button>\n <Button variant='primary' onClick={dismiss} disabled={name === ''}>\n Save\n </Button>\n </>\n );\n }, [dismiss, name]);\n\n const onNameChange = (e: ChangeEvent<HTMLInputElement>) => {\n setName(e.target.value);\n };\n\n return (\n <Modal\n actions={actions}\n heading='Close the Modal without saving any data to invoke the alert'\n autoWidth={args.autoWidth}\n center={args.center}\n stretch={args.stretch}\n onRequestDismiss={() => {\n if (name !== '') {\n create(MyAlert, { closeInitialModal: dismiss }, { alert: true });\n return false;\n }\n }}\n >\n <Input\n label='Name'\n name='name'\n onChange={onNameChange}\n onKeyDown={args.onKeyDown}\n value={name}\n required\n />\n </Modal>\n );\n };\n\n const ModalButton = () => {\n const { create } = useModalManager();\n\n return (\n <Button\n onClick={() => {\n create(MyModal, undefined, {\n onDismiss: args.onDismiss\n });\n }}\n >\n Open Modal\n </Button>\n );\n };\n\n return <ModalButton />;\n};\n\nAlertModal.args = {\n onKeyDown: action(\"Called input's onKeyDown\")\n};\n\nAlertModal.argTypes = {\n onKeyDown: { table: { disable: true } }\n};\n\nexport const ProgressState: Story = () => {\n const LoadingStateModal = () => {\n const { dismiss } = useModalContext();\n\n const [transientState, setTransientState] = useState<'loading' | 'submitting' | null>(\n 'loading'\n );\n\n const actions =\n transientState === 'loading' ? null : (\n <>\n <Button\n disabled={!!transientState}\n onClick={() => {\n if (transientState !== 'submitting') {\n dismiss();\n }\n }}\n >\n Cancel\n </Button>\n <Button\n disabled={!!transientState}\n variant='primary'\n onClick={() => {\n setTransientState('submitting');\n }}\n >\n Submit\n </Button>\n </>\n );\n\n useEffect(() => {\n let timerID: number;\n\n if (transientState === 'loading' || transientState === 'submitting') {\n timerID = window.setTimeout(() => {\n if (transientState === 'loading') {\n setTransientState(null);\n } else {\n dismiss();\n }\n }, loadingTimeoutMS);\n }\n\n return () => {\n window.clearTimeout(timerID);\n };\n }, [transientState]);\n\n return (\n <Modal\n progress={useMemo(() => {\n if (transientState) {\n return {\n message: `${cap(transientState)}…`\n };\n }\n }, [transientState])}\n heading='Modal progress demo'\n actions={actions}\n onRequestDismiss={() => transientState !== 'submitting'}\n >\n {transientState !== 'loading' && (\n <Flex container={{ direction: 'column', gap: 2 }}>\n {Array.from({ length: 5 }, (_, i) => (\n <Input key={i} label={`Field-${i + 1}`} />\n ))}\n </Flex>\n )}\n </Modal>\n );\n };\n\n const ModalButton = () => {\n const { create } = useModalManager();\n\n return (\n <Button\n onClick={() => {\n create(LoadingStateModal);\n }}\n >\n Open Modal\n </Button>\n );\n };\n\n return <ModalButton />;\n};\n\nexport const MinimizableModal: Story<ModalDemoProps> = (args: ModalDemoProps) => {\n const [count, setCount] = useState(1);\n\n const MyModal = () => {\n return (\n <Modal\n heading={`Modal #${count}`}\n autoWidth={args.autoWidth}\n center={args.center}\n stretch={args.stretch}\n onRequestDismiss={args.onRequestDismiss}\n onRequestMinimize={args.onRequestMinimize}\n onRequestActivate={args.onRequestActivate}\n >\n <Text>This Modal can be minimized by clicking the minimize button above.</Text>\n </Modal>\n );\n };\n\n const ModalButton = () => {\n const { create } = useModalManager();\n\n return (\n <Button\n onClick={() => {\n setCount(count + 1);\n create(MyModal, undefined, {\n minimizable: true,\n id: `Modal #${count}`,\n onDismiss: args.onDismiss,\n onMinimize: args.onMinimize,\n onActivate: args.onActivate\n });\n }}\n >\n Open Modal\n </Button>\n );\n };\n\n return <ModalButton />;\n};\n\nexport const DockedModal: Story<ModalDemoProps> = (args: ModalDemoProps) => {\n const [count, setCount] = useState(1);\n\n const MyModal = () => {\n return (\n <Modal heading={`Modal #${count}`} onRequestDock={args.onRequestDock}>\n <Text>This Modal can be minimized by clicking the minimize button above.</Text>\n </Modal>\n );\n };\n\n const ModalButton = () => {\n const { create } = useModalManager();\n\n return (\n <Button\n onClick={() => {\n setCount(count + 1);\n create(MyModal, undefined, {\n minimizable: true,\n maximizable: true,\n dockable: true\n });\n }}\n >\n Open Modal\n </Button>\n );\n };\n\n return <ModalButton />;\n};\n\ninterface AutoWidthModalContentProps {\n autoWidth: boolean;\n content: ContentTypes;\n formColumnWidthFixed: boolean;\n stretch?: never;\n center?: never;\n}\n\nexport const AutoWidthModalContent: Story<AutoWidthModalContentProps> = (\n args: AutoWidthModalContentProps\n) => {\n const { push } = useToaster();\n\n const MyModal = ({ content }: { content: ReactNode }) => {\n const { dismiss } = useModalContext();\n\n return (\n <Modal\n heading={`Modal ${args.autoWidth ? 'with' : 'without'} autoWidth`}\n autoWidth={args.autoWidth}\n actions={\n args.content.includes('form') || args.content === 'random' ? (\n <>\n <Button\n name='Cancel'\n variant='secondary'\n onClick={() => {\n dismiss();\n push({ content: 'Form cancelled!' });\n }}\n >\n Cancel\n </Button>\n <Button\n name='Submit'\n variant='primary'\n onClick={() => {\n dismiss();\n push({ content: 'Form submitted!' });\n }}\n >\n Submit\n </Button>\n </>\n ) : undefined\n }\n >\n {content}\n </Modal>\n );\n };\n\n const ModalButton = () => {\n const { create } = useModalManager();\n\n return (\n <Button\n onClick={() => {\n create(MyModal, {\n content: getContent(args.content, args.formColumnWidthFixed)\n });\n }}\n >\n Open Modal\n </Button>\n );\n };\n\n return <ModalButton />;\n};\n\nAutoWidthModalContent.args = {\n autoWidth: true,\n content: 'short text',\n formColumnWidthFixed: false\n};\n\nAutoWidthModalContent.argTypes = {\n stretch: { table: { disable: true } },\n center: { table: { disable: true } },\n content: {\n options: [\n 'short text',\n 'long text',\n 'image',\n 'table',\n 'form (1 column)',\n 'form (2 column)',\n 'form (3 column)',\n 'random'\n ],\n control: { type: 'select' }\n },\n formColumnWidthFixed: { control: { type: 'boolean' } }\n};\n"]}
@@ -1,5 +1,23 @@
1
1
  /// <reference types="react" />
2
- export interface DemoFormDataType {
2
+ import { BannerMessage } from '@pega/cosmos-react-core';
3
+ import MultiStepFormProps from '@pega/cosmos-react-core/lib/components/MultiStepForm/MultiStepForm.types';
4
+ export interface MultiStepFormDemoProps {
5
+ heading?: MultiStepFormProps['heading'];
6
+ stepIndicator?: MultiStepFormProps['stepIndicator'];
7
+ }
8
+ export interface ReducerAction {
9
+ type: string;
10
+ payload?: any;
11
+ }
12
+ export interface DemoMultiStepState {
13
+ formData: DemoFormDataType;
14
+ formErrors: DemoFormErrorsType;
15
+ currentStepIndex: number;
16
+ numSteps: number;
17
+ cancelled: boolean;
18
+ finished: boolean;
19
+ }
20
+ interface DemoFormDataType {
3
21
  [key: string]: string | boolean | undefined;
4
22
  firstName?: string;
5
23
  lastName?: string;
@@ -18,8 +36,8 @@ export interface DemoFormDataType {
18
36
  finalRecommendation?: string;
19
37
  recommendationComments?: string;
20
38
  }
21
- export interface DemoFormErrorsType {
22
- [field: string]: string | undefined;
39
+ interface DemoFormErrorsType {
40
+ [field: string]: BannerMessage;
23
41
  }
24
42
  interface MockFormArgs {
25
43
  formData: DemoFormDataType;
@@ -29,9 +47,24 @@ interface MockFormArgs {
29
47
  payload?: any;
30
48
  }) => void;
31
49
  }
50
+ interface FieldData {
51
+ name: string;
52
+ label: string;
53
+ }
54
+ export declare const stepFields: FieldData[][];
55
+ export declare const initialState: DemoMultiStepState;
56
+ export declare const reducer: (state: DemoMultiStepState, action: ReducerAction) => DemoMultiStepState | {
57
+ currentStepIndex: any;
58
+ formErrors: {};
59
+ formData: DemoFormDataType;
60
+ numSteps: number;
61
+ cancelled: boolean;
62
+ finished: boolean;
63
+ };
32
64
  export declare const ApplicantDetailsFields: ({ formData, formErrors, dispatch }: MockFormArgs) => JSX.Element;
33
65
  export declare const InterviewNotesFields: ({ formData, formErrors, dispatch }: MockFormArgs) => JSX.Element;
34
66
  export declare const NextInterviewFields: ({ formData, formErrors, dispatch }: MockFormArgs) => JSX.Element;
35
67
  export declare const RecommendationsFields: ({ formData, formErrors, dispatch }: MockFormArgs) => JSX.Element;
68
+ export declare const MultiStepModal: (args: MultiStepFormDemoProps) => JSX.Element;
36
69
  export {};
37
70
  //# sourceMappingURL=MultiStepForm.mocks.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"MultiStepForm.mocks.d.ts","sourceRoot":"","sources":["../../../src/core/MultiStepForm/MultiStepForm.mocks.tsx"],"names":[],"mappings":";AAeA,MAAM,WAAW,gBAAgB;IAC/B,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,eAA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,MAAM,UAAU,EAAE,SAAS,EAAE,EAwBnC,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,kBAY1B,CAAC;AA6BF,eAAO,MAAM,OAAO,UAAW,kBAAkB,UAAU,aAAa;;;cApH5D,gBAAgB;cAGhB,MAAM;eACL,OAAO;cACR,OAAO;CA8MlB,CAAC;AAEF,eAAO,MAAM,sBAAsB,uCAAwC,YAAY,gBAgGtF,CAAC;AAEF,eAAO,MAAM,oBAAoB,uCAAwC,YAAY,gBA2BpF,CAAC;AAEF,eAAO,MAAM,mBAAmB,uCAAwC,YAAY,gBAsBnF,CAAC;AAEF,eAAO,MAAM,qBAAqB,uCAAwC,YAAY,gBAiKrF,CAAC;AAEF,eAAO,MAAM,cAAc,SAAU,sBAAsB,gBA4K1D,CAAC"}
@@ -1,88 +1,326 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Input, Grid, FieldGroup, TextArea, RadioButtonGroup, RadioButton, CurrencyInput, Select, Option, Checkbox } from '@pega/cosmos-react-core';
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { useEffect, useMemo, useReducer, useRef, useState } from 'react';
3
+ import { Banner, Button, Checkbox, CurrencyInput, FieldGroup, Grid, Input, Modal, MultiStepForm, Option, RadioButton, RadioButtonGroup, Select, TextArea, useModalContext, useToaster } from '@pega/cosmos-react-core';
4
+ import { loadingTimeoutMS } from '../Progress/Progress.mocks';
5
+ export const stepFields = [
6
+ [
7
+ { name: 'firstName', label: 'First name' },
8
+ { name: 'lastName', label: 'Last name' },
9
+ { name: 'currentTitle', label: 'Current title' },
10
+ { name: 'currentCompany', label: 'Current company' },
11
+ { name: 'salaryRequested', label: 'Salary requested' },
12
+ { name: 'experienceLevel', label: 'Experience level' },
13
+ { name: 'priorityOne', label: 'First' },
14
+ { name: 'priorityTwo', label: 'Second' },
15
+ { name: 'priorityThree', label: 'Third' }
16
+ ],
17
+ [
18
+ { name: 'interviewNotes', label: 'Impressions' },
19
+ { name: 'additionalInterview', label: 'Request additional interview' }
20
+ ],
21
+ [{ name: 'nextInterviewer', label: 'Next interviewer' }],
22
+ [
23
+ { name: 'salaryRequestedReview', label: 'Salary requested' },
24
+ { name: 'salaryRequestReview', label: 'Salary request fit' },
25
+ { name: 'cultureFit', label: 'Culture fit' },
26
+ { name: 'finalRecommendation', label: 'Final recommendation' },
27
+ { name: 'recommendationComments', label: 'Comments' }
28
+ ]
29
+ ];
30
+ export const initialState = {
31
+ currentStepIndex: 0,
32
+ cancelled: false,
33
+ finished: false,
34
+ numSteps: 3,
35
+ formData: {
36
+ firstName: 'Marcus',
37
+ lastName: 'Kennedy',
38
+ currentTitle: 'Data Analyst',
39
+ currentCompany: 'Acme Co.'
40
+ },
41
+ formErrors: {}
42
+ };
43
+ const formValidation = {
44
+ salaryRequested: {
45
+ message: 'This field is required.',
46
+ validator: (value) => value?.length > 0
47
+ },
48
+ experienceLevel: {
49
+ message: 'This field is required.',
50
+ validator: (value) => value?.length > 0
51
+ },
52
+ nextInterviewer: {
53
+ message: 'This field is required.',
54
+ validator: (value) => value?.length > 0
55
+ },
56
+ salaryRequestReview: {
57
+ message: 'This field is required.',
58
+ validator: (value) => value?.length > 0
59
+ },
60
+ cultureFit: {
61
+ message: 'This field is required.',
62
+ validator: (value) => value?.length > 0
63
+ },
64
+ finalRecommendation: {
65
+ message: 'This field is required.',
66
+ validator: (value) => value?.length > 0
67
+ }
68
+ };
69
+ export const reducer = (state, action) => {
70
+ const type = action.type;
71
+ const payload = action.payload;
72
+ switch (type) {
73
+ case 'restart': {
74
+ return initialState;
75
+ }
76
+ case 'cancel': {
77
+ return {
78
+ ...state,
79
+ cancelled: true
80
+ };
81
+ }
82
+ case 'finish': {
83
+ return {
84
+ ...state,
85
+ finished: true
86
+ };
87
+ }
88
+ case 'setStep': {
89
+ return {
90
+ ...state,
91
+ currentStepIndex: payload,
92
+ formErrors: {}
93
+ };
94
+ }
95
+ case 'setFieldValue': {
96
+ const { name: field, label, value } = payload;
97
+ const formData = {
98
+ ...state.formData
99
+ };
100
+ const formErrors = {
101
+ ...state.formErrors
102
+ };
103
+ formData[field] = value;
104
+ if (formErrors[field] && Object.prototype.hasOwnProperty.call(formValidation, field)) {
105
+ const valid = formValidation[field].validator(value);
106
+ if (valid) {
107
+ delete formErrors[field];
108
+ }
109
+ else {
110
+ formErrors[field] = { label, description: formValidation[field].message };
111
+ }
112
+ }
113
+ return {
114
+ ...state,
115
+ formData,
116
+ formErrors
117
+ };
118
+ }
119
+ case 'submitCurrentStep': {
120
+ const stepIndex = state.numSteps === 4 || state.currentStepIndex <= 1
121
+ ? state.currentStepIndex
122
+ : state.currentStepIndex + 1;
123
+ const formErrors = { ...state.formErrors };
124
+ let isValid = true;
125
+ const validateFields = (fields) => {
126
+ if (!fields)
127
+ return;
128
+ fields.forEach(({ name: field, label }) => {
129
+ if (Object.prototype.hasOwnProperty.call(formValidation, field)) {
130
+ const valid = formValidation[field].validator(state.formData[field]);
131
+ if (valid) {
132
+ delete formErrors[field];
133
+ }
134
+ else {
135
+ isValid = false;
136
+ formErrors[field] = { label, description: formValidation[field].message };
137
+ }
138
+ }
139
+ });
140
+ };
141
+ validateFields(stepFields[stepIndex]);
142
+ return {
143
+ ...state,
144
+ numSteps: state.formData.additionalInterview ? 4 : 3,
145
+ currentStepIndex: isValid && state.currentStepIndex !== state.numSteps - 1
146
+ ? state.currentStepIndex + 1
147
+ : state.currentStepIndex,
148
+ finished: isValid && state.currentStepIndex === state.numSteps - 1,
149
+ formErrors
150
+ };
151
+ }
152
+ default:
153
+ return state;
154
+ }
155
+ };
3
156
  export const ApplicantDetailsFields = ({ formData, formErrors, dispatch }) => {
4
- return (_jsxs(Grid, { container: { gap: 1, cols: 'repeat(2, minmax(0, 1fr))' }, children: [_jsx(Input, { name: 'firstName', label: 'First name', value: formData.firstName, readOnly: true }), _jsx(Input, { name: 'lastName', label: 'Last name', value: formData.lastName, readOnly: true }), _jsx(Input, { name: 'currentTitle', label: 'Current title', value: formData.currentTitle, onChange: (e) => dispatch({
157
+ return (_jsxs(Grid, { container: { gap: 1, cols: 'repeat(2, minmax(0, 1fr))' }, children: [_jsx(Input, { ...stepFields[0][0], value: formData.firstName, readOnly: true }), _jsx(Input, { ...stepFields[0][1], value: formData.lastName, readOnly: true }), _jsx(Input, { ...stepFields[0][2], value: formData.currentTitle, onChange: (e) => dispatch({
5
158
  type: 'setFieldValue',
6
- payload: { field: 'currentTitle', value: e.target.value }
7
- }) }), _jsx(Input, { name: 'currentCompany', label: 'Current company', value: formData.currentCompany, onChange: (e) => dispatch({
159
+ payload: { ...stepFields[0][2], value: e.target.value }
160
+ }) }), _jsx(Input, { ...stepFields[0][3], value: formData.currentCompany, onChange: (e) => dispatch({
8
161
  type: 'setFieldValue',
9
- payload: { field: 'currentCompany', value: e.target.value }
10
- }) }), _jsx(CurrencyInput, { name: 'salaryRequested', label: 'Salary requested', value: formData.salaryRequested, currencyISOCode: 'USD', onChange: value => dispatch({
162
+ payload: { ...stepFields[0][3], value: e.target.value }
163
+ }) }), _jsx(CurrencyInput, { ...stepFields[0][4], value: formData.salaryRequested, currencyISOCode: 'USD', onChange: value => dispatch({
11
164
  type: 'setFieldValue',
12
- payload: { field: 'salaryRequested', value }
13
- }), status: formErrors.salaryRequested ? 'error' : undefined, info: formErrors.salaryRequested ? formErrors.salaryRequested : undefined, required: true }), _jsxs(Select, { id: 'experienceLevel', label: 'Weighted experience', value: formData.experienceLevel, onChange: (e) => {
165
+ payload: { ...stepFields[0][4], value }
166
+ }), status: formErrors.salaryRequested ? 'error' : undefined, info: formErrors.salaryRequested ? formErrors.salaryRequested.description : undefined, required: true }), _jsxs(Select, { ...stepFields[0][5], value: formData.experienceLevel, onChange: (e) => {
14
167
  dispatch({
15
168
  type: 'setFieldValue',
16
- payload: { field: 'experienceLevel', value: e.target.value }
169
+ payload: { ...stepFields[0][5], value: e.target.value }
17
170
  });
18
- }, status: formErrors.experienceLevel ? 'error' : undefined, info: formErrors.experienceLevel ? formErrors.experienceLevel : undefined, required: true, children: [_jsx(Option, { value: '', children: "--" }), _jsx(Option, { value: 'junior', children: "0-3 years (junior)" }), _jsx(Option, { value: 'mid-level', children: "4-6 years (mid)" }), _jsx(Option, { value: 'senior', children: "7-10 years (senior)" }), _jsx(Option, { value: 'expert', children: "10+ years (expert)" })] }), _jsx(Grid, { item: { colStart: '1', colEnd: '-1' }, children: _jsx(FieldGroup, { name: 'Work priorities', headingTag: 'h3', children: _jsxs(Grid, { container: { gap: 1, cols: 'repeat(3, minmax(0, 1fr))' }, children: [_jsx(Input, { name: 'priorityOne', label: 'First', value: formData.priorityOne, onChange: (e) => {
171
+ }, status: formErrors.experienceLevel ? 'error' : undefined, info: formErrors.experienceLevel ? formErrors.experienceLevel.description : undefined, required: true, children: [_jsx(Option, { value: '', children: "--" }), _jsx(Option, { value: 'junior', children: "0-3 years (junior)" }), _jsx(Option, { value: 'mid-level', children: "4-6 years (mid)" }), _jsx(Option, { value: 'senior', children: "7-10 years (senior)" }), _jsx(Option, { value: 'expert', children: "10+ years (expert)" })] }), _jsx(Grid, { item: { colStart: '1', colEnd: '-1' }, children: _jsx(FieldGroup, { name: 'Work priorities', headingTag: 'h3', children: _jsxs(Grid, { container: { gap: 1, cols: 'repeat(3, minmax(0, 1fr))' }, children: [_jsx(Input, { ...stepFields[0][6], value: formData.priorityOne, onChange: (e) => {
19
172
  dispatch({
20
173
  type: 'setFieldValue',
21
- payload: { field: 'priorityOne', value: e.target.value }
174
+ payload: { ...stepFields[0][6], value: e.target.value }
22
175
  });
23
- } }), _jsx(Input, { name: 'priorityTwo', label: 'Second', value: formData.priorityTwo, onChange: (e) => {
176
+ } }), _jsx(Input, { ...stepFields[0][7], value: formData.priorityTwo, onChange: (e) => {
24
177
  dispatch({
25
178
  type: 'setFieldValue',
26
- payload: { field: 'priorityTwo', value: e.target.value }
179
+ payload: { ...stepFields[0][7], value: e.target.value }
27
180
  });
28
- } }), _jsx(Input, { name: 'priorityThree', label: 'Third', value: formData.priorityThree, onChange: (e) => {
181
+ } }), _jsx(Input, { ...stepFields[0][8], value: formData.priorityThree, onChange: (e) => {
29
182
  dispatch({
30
183
  type: 'setFieldValue',
31
- payload: { field: 'priorityThree', value: e.target.value }
184
+ payload: { ...stepFields[0][8], value: e.target.value }
32
185
  });
33
186
  } })] }) }) })] }));
34
187
  };
35
188
  export const InterviewNotesFields = ({ formData, formErrors, dispatch }) => {
36
- return (_jsxs(Grid, { container: { gap: 1, cols: '1fr' }, children: [_jsx(TextArea, { name: 'impressions', label: 'Impressions', value: formData.interviewNotes, onChange: (e) => {
189
+ return (_jsxs(Grid, { container: { gap: 1, cols: '1fr' }, children: [_jsx(TextArea, { ...stepFields[1][0], value: formData.interviewNotes, onChange: (e) => {
37
190
  dispatch({
38
191
  type: 'setFieldValue',
39
- payload: { field: 'interviewNotes', value: e.target.value }
192
+ payload: { ...stepFields[1][0], value: e.target.value }
40
193
  });
41
- }, status: formErrors.impressions ? 'error' : undefined, info: formErrors.impressions ? formErrors.impressions : undefined }), _jsx(Checkbox, { name: 'additionalInterview', label: 'Request additional interview', defaultChecked: formData.additionalInterview, onChange: (e) => {
194
+ }, status: formErrors.impressions ? 'error' : undefined, info: formErrors.impressions ? formErrors.impressions.description : undefined }), _jsx(Checkbox, { ...stepFields[1][1], defaultChecked: formData.additionalInterview, onChange: (e) => {
42
195
  dispatch({
43
196
  type: 'setFieldValue',
44
- payload: { field: 'additionalInterview', value: e.target.checked }
197
+ payload: { ...stepFields[1][1], value: e.target.checked }
45
198
  });
46
199
  } })] }));
47
200
  };
48
201
  export const NextInterviewFields = ({ formData, formErrors, dispatch }) => {
49
- return (_jsxs(Select, { name: 'nextInterviewer', label: 'Next interviewer', value: formData.nextInterviewer, onChange: (e) => {
202
+ return (_jsxs(Select, { ...stepFields[2][0], value: formData.nextInterviewer, onChange: (e) => {
50
203
  dispatch({
51
204
  type: 'setFieldValue',
52
- payload: { field: 'nextInterviewer', value: e.target.value }
205
+ payload: { ...stepFields[2][0], value: e.target.value }
53
206
  });
54
- }, status: formErrors.nextInterviewer ? 'error' : undefined, info: formErrors.nextInterviewer ? formErrors.nextInterviewer : undefined, required: true, children: [_jsx(Option, { value: '', children: "Choose an option..." }), _jsx(Option, { children: "Myself" }), _jsx(Option, { children: "Cindy Turner " }), _jsx(Option, { children: "Seth DeAngelo" }), _jsx(Option, { children: "Janet Moore" })] }));
207
+ }, status: formErrors.nextInterviewer ? 'error' : undefined, info: formErrors.nextInterviewer ? formErrors.nextInterviewer.description : undefined, required: true, children: [_jsx(Option, { value: '', children: "Choose an option..." }), _jsx(Option, { children: "Myself" }), _jsx(Option, { children: "Cindy Turner " }), _jsx(Option, { children: "Seth DeAngelo" }), _jsx(Option, { children: "Janet Moore" })] }));
55
208
  };
56
209
  export const RecommendationsFields = ({ formData, formErrors, dispatch }) => {
57
- return (_jsxs(Grid, { container: { gap: 1, cols: '1fr' }, children: [_jsx(CurrencyInput, { name: 'salaryRequestedReview', label: 'Salary requested', value: formData.salaryRequested, onChange: () => { }, currencyISOCode: 'USD', readOnly: true }), _jsx("p", { children: "$99,000 is the recommended salary for this position." }), _jsxs(RadioButtonGroup, { label: 'Salary request fit', name: 'salaryRequestReview', onChange: (e) => {
210
+ return (_jsxs(Grid, { container: { gap: 1, cols: '1fr' }, children: [_jsx(CurrencyInput, { ...stepFields[3][0], value: formData.salaryRequested, onChange: () => { }, currencyISOCode: 'USD', readOnly: true }), _jsx("p", { children: "$99,000 is the recommended salary for this position." }), _jsxs(RadioButtonGroup, { ...stepFields[3][1], onChange: (e) => {
58
211
  dispatch({
59
212
  type: 'setFieldValue',
60
213
  payload: {
61
- field: 'salaryRequestReview',
214
+ ...stepFields[3][1],
62
215
  value: e.target.value
63
216
  }
64
217
  });
65
- }, status: formErrors.salaryRequestReview ? 'error' : undefined, info: formErrors.salaryRequestReview ? formErrors.salaryRequestReview : undefined, inline: true, required: true, children: [_jsx(RadioButton, { label: 'Very low', id: 'salaryTargetVeryLow', value: 'salaryTargetVeryLow', checked: formData.salaryRequestReview === 'salaryTargetVeryLow' }), _jsx(RadioButton, { label: 'Low', id: 'salaryTargetLow', value: 'salaryTargetLow', checked: formData.salaryRequestReview === 'salaryTargetLow' }), _jsx(RadioButton, { label: 'On trend', id: 'salaryTargetOnTrend', value: 'salaryTargetOnTrend', checked: formData.salaryRequestReview === 'salaryTargetOnTrend' }), _jsx(RadioButton, { label: 'High', id: 'salaryTargetHigh', value: 'salaryTargetHigh', checked: formData.salaryRequestReview === 'salaryTargetHigh' }), _jsx(RadioButton, { label: 'Very high', id: 'salaryTargetVeryHigh', value: 'salaryTargetVeryHigh', checked: formData.salaryRequestReview === 'salaryTargetVeryHigh' })] }), _jsxs(RadioButtonGroup, { label: 'Culture fit', name: 'cultureFit', onChange: (e) => {
218
+ }, status: formErrors.salaryRequestReview ? 'error' : undefined, info: formErrors.salaryRequestReview ? formErrors.salaryRequestReview.description : undefined, inline: true, required: true, children: [_jsx(RadioButton, { label: 'Very low', id: 'salaryTargetVeryLow', value: 'salaryTargetVeryLow', checked: formData.salaryRequestReview === 'salaryTargetVeryLow' }), _jsx(RadioButton, { label: 'Low', id: 'salaryTargetLow', value: 'salaryTargetLow', checked: formData.salaryRequestReview === 'salaryTargetLow' }), _jsx(RadioButton, { label: 'On trend', id: 'salaryTargetOnTrend', value: 'salaryTargetOnTrend', checked: formData.salaryRequestReview === 'salaryTargetOnTrend' }), _jsx(RadioButton, { label: 'High', id: 'salaryTargetHigh', value: 'salaryTargetHigh', checked: formData.salaryRequestReview === 'salaryTargetHigh' }), _jsx(RadioButton, { label: 'Very high', id: 'salaryTargetVeryHigh', value: 'salaryTargetVeryHigh', checked: formData.salaryRequestReview === 'salaryTargetVeryHigh' })] }), _jsxs(RadioButtonGroup, { ...stepFields[3][2], onChange: (e) => {
66
219
  dispatch({
67
220
  type: 'setFieldValue',
68
221
  payload: {
69
- field: 'cultureFit',
222
+ ...stepFields[3][2],
70
223
  value: e.target.value
71
224
  }
72
225
  });
73
- }, status: formErrors.cultureFit ? 'error' : undefined, info: formErrors.cultureFit ? formErrors.cultureFit : undefined, inline: true, required: true, children: [_jsx(RadioButton, { label: 'High risk', id: 'cultureFitHighRisk', value: 'cultureFitHighRisk', checked: formData.cultureFit === 'cultureFitHighRisk' }), _jsx(RadioButton, { label: 'Signs of risk', id: 'cultureFitSomeRisk', value: 'cultureFitSomeRisk', checked: formData.cultureFit === 'cultureFitSomeRisk' }), _jsx(RadioButton, { label: 'Indeterminate', id: 'cultureFitIndeterminate', value: 'cultureFitIndeterminate', checked: formData.cultureFit === 'cultureFitIndeterminate' }), _jsx(RadioButton, { label: 'Good', id: 'cultureFitGood', value: 'cultureFitGood', checked: formData.cultureFit === 'cultureFitGood' }), _jsx(RadioButton, { label: 'Perfect', id: 'cultureFitPerfect', value: 'cultureFitPerfect', checked: formData.cultureFit === 'cultureFitPerfect' })] }), _jsxs(RadioButtonGroup, { label: 'Final recomendation', name: 'finalRecommendation', onChange: (e) => {
226
+ }, status: formErrors.cultureFit ? 'error' : undefined, info: formErrors.cultureFit ? formErrors.cultureFit.description : undefined, inline: true, required: true, children: [_jsx(RadioButton, { label: 'High risk', id: 'cultureFitHighRisk', value: 'cultureFitHighRisk', checked: formData.cultureFit === 'cultureFitHighRisk' }), _jsx(RadioButton, { label: 'Signs of risk', id: 'cultureFitSomeRisk', value: 'cultureFitSomeRisk', checked: formData.cultureFit === 'cultureFitSomeRisk' }), _jsx(RadioButton, { label: 'Indeterminate', id: 'cultureFitIndeterminate', value: 'cultureFitIndeterminate', checked: formData.cultureFit === 'cultureFitIndeterminate' }), _jsx(RadioButton, { label: 'Good', id: 'cultureFitGood', value: 'cultureFitGood', checked: formData.cultureFit === 'cultureFitGood' }), _jsx(RadioButton, { label: 'Perfect', id: 'cultureFitPerfect', value: 'cultureFitPerfect', checked: formData.cultureFit === 'cultureFitPerfect' })] }), _jsxs(RadioButtonGroup, { ...stepFields[3][3], onChange: (e) => {
74
227
  dispatch({
75
228
  type: 'setFieldValue',
76
229
  payload: {
77
- field: 'finalRecommendation',
230
+ ...stepFields[3][3],
78
231
  value: e.target.value
79
232
  }
80
233
  });
81
- }, status: formErrors.finalRecommendation ? 'error' : undefined, info: formErrors.finalRecommendation ? formErrors.finalRecommendation : undefined, inline: true, required: true, children: [_jsx(RadioButton, { label: 'Do not recommend', id: 'doNotRecommend', value: 'doNotRecommend', checked: formData.finalRecommendation === 'doNotRecommend' }), _jsx(RadioButton, { label: 'Indeterminate', id: 'noRecommendation', value: 'noRecommendation', checked: formData.finalRecommendation === 'noRecommendation' }), _jsx(RadioButton, { label: 'Recommend', id: 'recommend', value: 'recommend', checked: formData.finalRecommendation === 'recommend' })] }), _jsx(TextArea, { name: 'comments', label: 'Comments', value: formData.recommendationComments, onChange: (e) => {
234
+ }, status: formErrors.finalRecommendation ? 'error' : undefined, info: formErrors.finalRecommendation ? formErrors.finalRecommendation.description : undefined, inline: true, required: true, children: [_jsx(RadioButton, { label: 'Do not recommend', id: 'doNotRecommend', value: 'doNotRecommend', checked: formData.finalRecommendation === 'doNotRecommend' }), _jsx(RadioButton, { label: 'Indeterminate', id: 'noRecommendation', value: 'noRecommendation', checked: formData.finalRecommendation === 'noRecommendation' }), _jsx(RadioButton, { label: 'Recommend', id: 'recommend', value: 'recommend', checked: formData.finalRecommendation === 'recommend' })] }), _jsx(TextArea, { ...stepFields[3][4], value: formData.recommendationComments, onChange: (e) => {
82
235
  dispatch({
83
236
  type: 'setFieldValue',
84
- payload: { field: 'recommendationComments', value: e.target.value }
237
+ payload: { ...stepFields[3][4], value: e.target.value }
85
238
  });
86
239
  } })] }));
87
240
  };
241
+ export const MultiStepModal = (args) => {
242
+ const { dismiss } = useModalContext();
243
+ const { push: pushToaster } = useToaster();
244
+ const [loading, setLoading] = useState(false);
245
+ const [banners, setBanners] = useState();
246
+ const bannerHandleRef = useRef(null);
247
+ const [state, dispatch] = useReducer(reducer, initialState);
248
+ const submitStep = () => {
249
+ setLoading(true);
250
+ setTimeout(() => {
251
+ dispatch({ type: 'submitCurrentStep' });
252
+ setLoading(false);
253
+ }, loadingTimeoutMS);
254
+ };
255
+ useEffect(() => {
256
+ if (banners && bannerHandleRef.current)
257
+ bannerHandleRef.current.focus();
258
+ }, [banners]);
259
+ useEffect(() => {
260
+ const bannerErrors = Object.keys(state.formErrors)
261
+ .filter(errorField => {
262
+ return stepFields[state.currentStepIndex].find(field => field.name === errorField);
263
+ })
264
+ .map(errorField => state.formErrors[errorField]);
265
+ if (bannerErrors.length) {
266
+ setBanners(_jsx(Banner, { messages: bannerErrors, variant: 'urgent', handle: bannerHandleRef }));
267
+ }
268
+ else {
269
+ setBanners(undefined);
270
+ }
271
+ }, [state.currentStepIndex, state.formErrors]);
272
+ const stepActions = useMemo(() => {
273
+ return (_jsxs(_Fragment, { children: [_jsx(Button, { onClick: () => {
274
+ dispatch({ type: 'cancel' });
275
+ dismiss();
276
+ }, disabled: loading, children: "Cancel" }), _jsxs("div", { children: [state.currentStepIndex > 0 && (_jsx(Button, { onClick: () => dispatch({ type: 'setStep', payload: state.currentStepIndex - 1 }), disabled: loading, children: "Previous" })), state.currentStepIndex !== state.numSteps - 1 && (_jsx(Button, { variant: 'primary', onClick: submitStep, disabled: loading, children: "Next" })), state.currentStepIndex === state.numSteps - 1 && (_jsx(Button, { type: 'submit', variant: 'primary', onClick: (e) => {
277
+ e.preventDefault();
278
+ submitStep();
279
+ }, disabled: loading, children: "Finish" }))] })] }));
280
+ }, [state.currentStepIndex, loading]);
281
+ const stepData = useMemo(() => {
282
+ const steps = [
283
+ {
284
+ id: 'applicant_details',
285
+ name: 'Applicant details - personal information',
286
+ description: 'This applicant has passed initial screening and has been cleared to have an interview scheduled. ' +
287
+ 'Please confirm their details and have a discussion regarding the open position and the company.',
288
+ banners,
289
+ content: (_jsx(ApplicantDetailsFields, { formData: state.formData, formErrors: state.formErrors, dispatch: dispatch }))
290
+ },
291
+ {
292
+ id: 'interview_notes',
293
+ name: 'Interview notes',
294
+ banners,
295
+ content: (_jsx(InterviewNotesFields, { formData: state.formData, formErrors: state.formErrors, dispatch: dispatch }))
296
+ },
297
+ {
298
+ id: 'recommendations',
299
+ name: 'Final recommendations',
300
+ description: 'Based on your screening call with the applicant please submit your recomendations.',
301
+ banners,
302
+ content: (_jsx(RecommendationsFields, { formData: state.formData, formErrors: state.formErrors, dispatch: dispatch }))
303
+ }
304
+ ];
305
+ if (state.numSteps === 4) {
306
+ steps.splice(2, 0, {
307
+ id: 'next_interview',
308
+ name: 'Next interview',
309
+ description: 'Please select an individual to conduct the next interview.',
310
+ banners,
311
+ content: (_jsx(NextInterviewFields, { formData: state.formData, formErrors: state.formErrors, dispatch: dispatch }))
312
+ });
313
+ }
314
+ return steps;
315
+ }, [state.formData, state.formErrors, state.currentStepIndex, banners, loading]);
316
+ useEffect(() => {
317
+ if (state.finished) {
318
+ dismiss();
319
+ pushToaster({ content: 'Interview successfully submitted!' });
320
+ }
321
+ }, [state.finished]);
322
+ return (_jsx(Modal, { heading: args.heading, progress: loading
323
+ ? { message: `Submitting ${stepData[state.currentStepIndex].name.toLowerCase()}...` }
324
+ : undefined, actions: stepActions, onRequestDismiss: () => !loading, children: _jsx(MultiStepForm, { steps: stepData, currentStepId: stepData[state.currentStepIndex].id, stepIndicator: args.stepIndicator }) }));
325
+ };
88
326
  //# sourceMappingURL=MultiStepForm.mocks.js.map