@pega/cosmos-react-core 4.0.0-dev.14.0 → 4.0.0-dev.14.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 (215) hide show
  1. package/lib/components/AppShell/AppHeader.styles.d.ts.map +1 -1
  2. package/lib/components/AppShell/AppHeader.styles.js +0 -2
  3. package/lib/components/AppShell/AppHeader.styles.js.map +1 -1
  4. package/lib/components/AppShell/AppShell.styles.d.ts.map +1 -1
  5. package/lib/components/AppShell/AppShell.styles.js +0 -4
  6. package/lib/components/AppShell/AppShell.styles.js.map +1 -1
  7. package/lib/components/AppShell/AppShell.types.d.ts +6 -5
  8. package/lib/components/AppShell/AppShell.types.d.ts.map +1 -1
  9. package/lib/components/AppShell/AppShell.types.js.map +1 -1
  10. package/lib/components/AppShell/AppShellList.d.ts +1 -1
  11. package/lib/components/AppShell/AppShellList.d.ts.map +1 -1
  12. package/lib/components/AppShell/AppShellList.js.map +1 -1
  13. package/lib/components/AppShell/AppShellList.styles.d.ts.map +1 -1
  14. package/lib/components/AppShell/AppShellList.styles.js +0 -1
  15. package/lib/components/AppShell/AppShellList.styles.js.map +1 -1
  16. package/lib/components/AppShell/NavigationList.d.ts.map +1 -1
  17. package/lib/components/AppShell/NavigationList.js.map +1 -1
  18. package/lib/components/AppShell/NavigationListItemWrapper.d.ts.map +1 -1
  19. package/lib/components/AppShell/NavigationListItemWrapper.js +31 -11
  20. package/lib/components/AppShell/NavigationListItemWrapper.js.map +1 -1
  21. package/lib/components/AppShell/Operator.d.ts.map +1 -1
  22. package/lib/components/AppShell/Operator.js +1 -3
  23. package/lib/components/AppShell/Operator.js.map +1 -1
  24. package/lib/components/Avatar/Avatar.d.ts +2 -2
  25. package/lib/components/Avatar/Avatar.js.map +1 -1
  26. package/lib/components/Backdrop/Backdrop.d.ts +9 -21
  27. package/lib/components/Backdrop/Backdrop.d.ts.map +1 -1
  28. package/lib/components/Backdrop/Backdrop.js +0 -2
  29. package/lib/components/Backdrop/Backdrop.js.map +1 -1
  30. package/lib/components/Badges/Count.d.ts +1 -1
  31. package/lib/components/Badges/Count.js.map +1 -1
  32. package/lib/components/Banner/Banner.d.ts +1 -1
  33. package/lib/components/Banner/Banner.js.map +1 -1
  34. package/lib/components/Boolean/BooleanDisplay.d.ts +2 -2
  35. package/lib/components/Boolean/BooleanDisplay.js.map +1 -1
  36. package/lib/components/Button/BareButton.d.ts +1 -1
  37. package/lib/components/Button/BareButton.js.map +1 -1
  38. package/lib/components/Button/Button.d.ts +4 -8
  39. package/lib/components/Button/Button.d.ts.map +1 -1
  40. package/lib/components/Button/Button.js.map +1 -1
  41. package/lib/components/ColorPicker/ColorPicker.d.ts +1 -1
  42. package/lib/components/ColorPicker/ColorPicker.js.map +1 -1
  43. package/lib/components/CompositeInput/CompositeInput.types.d.ts +2 -6
  44. package/lib/components/CompositeInput/CompositeInput.types.d.ts.map +1 -1
  45. package/lib/components/CompositeInput/CompositeInput.types.js.map +1 -1
  46. package/lib/components/Configuration/Configuration.d.ts +9 -27
  47. package/lib/components/Configuration/Configuration.d.ts.map +1 -1
  48. package/lib/components/Configuration/Configuration.js.map +1 -1
  49. package/lib/components/CreditCard/utils.d.ts +1 -1
  50. package/lib/components/CreditCard/utils.d.ts.map +1 -1
  51. package/lib/components/CreditCard/utils.js +1 -1
  52. package/lib/components/CreditCard/utils.js.map +1 -1
  53. package/lib/components/Currency/CurrencyInput.types.d.ts +3 -7
  54. package/lib/components/Currency/CurrencyInput.types.d.ts.map +1 -1
  55. package/lib/components/Currency/CurrencyInput.types.js.map +1 -1
  56. package/lib/components/DateTime/DateTimeDisplay.d.ts +4 -10
  57. package/lib/components/DateTime/DateTimeDisplay.d.ts.map +1 -1
  58. package/lib/components/DateTime/DateTimeDisplay.js.map +1 -1
  59. package/lib/components/DateTime/Input/DateTimeInput.d.ts +1 -3
  60. package/lib/components/DateTime/Input/DateTimeInput.d.ts.map +1 -1
  61. package/lib/components/DateTime/Input/DateTimeInput.js.map +1 -1
  62. package/lib/components/DateTime/Input/TimeInput.d.ts +1 -3
  63. package/lib/components/DateTime/Input/TimeInput.d.ts.map +1 -1
  64. package/lib/components/DateTime/Input/TimeInput.js.map +1 -1
  65. package/lib/components/DateTime/Input/TimeRangeInput.d.ts +1 -3
  66. package/lib/components/DateTime/Input/TimeRangeInput.d.ts.map +1 -1
  67. package/lib/components/DateTime/Input/TimeRangeInput.js.map +1 -1
  68. package/lib/components/DateTime/Input/usePickerButton.js +3 -3
  69. package/lib/components/DateTime/Input/usePickerButton.js.map +1 -1
  70. package/lib/components/DateTime/Picker/Calendar.d.ts +4 -6
  71. package/lib/components/DateTime/Picker/Calendar.d.ts.map +1 -1
  72. package/lib/components/DateTime/Picker/Calendar.js.map +1 -1
  73. package/lib/components/DateTime/Picker/DatePicker.types.d.ts +2 -4
  74. package/lib/components/DateTime/Picker/DatePicker.types.d.ts.map +1 -1
  75. package/lib/components/DateTime/Picker/DatePicker.types.js.map +1 -1
  76. package/lib/components/DateTime/Picker/TimePicker.d.ts +1 -3
  77. package/lib/components/DateTime/Picker/TimePicker.d.ts.map +1 -1
  78. package/lib/components/DateTime/Picker/TimePicker.js.map +1 -1
  79. package/lib/components/DateTime/Picker/Weeks.d.ts +1 -3
  80. package/lib/components/DateTime/Picker/Weeks.d.ts.map +1 -1
  81. package/lib/components/DateTime/Picker/Weeks.js.map +1 -1
  82. package/lib/components/DateTime/Picker/utils.js +1 -1
  83. package/lib/components/DateTime/Picker/utils.js.map +1 -1
  84. package/lib/components/Dialog/Dialog.types.d.ts +11 -33
  85. package/lib/components/Dialog/Dialog.types.d.ts.map +1 -1
  86. package/lib/components/Dialog/Dialog.types.js.map +1 -1
  87. package/lib/components/Dialog/InfoDialog.js +1 -1
  88. package/lib/components/Dialog/InfoDialog.js.map +1 -1
  89. package/lib/components/Drawer/Drawer.d.ts +9 -9
  90. package/lib/components/Drawer/Drawer.d.ts.map +1 -1
  91. package/lib/components/Drawer/Drawer.js.map +1 -1
  92. package/lib/components/Email/EmailDisplay.d.ts +1 -1
  93. package/lib/components/Email/EmailDisplay.js.map +1 -1
  94. package/lib/components/EmojiPicker/EmojiPicker.styles.d.ts.map +1 -1
  95. package/lib/components/EmojiPicker/EmojiPicker.styles.js +1 -6
  96. package/lib/components/EmojiPicker/EmojiPicker.styles.js.map +1 -1
  97. package/lib/components/ExpandCollapse/ExpandCollapse.d.ts +6 -6
  98. package/lib/components/ExpandCollapse/ExpandCollapse.d.ts.map +1 -1
  99. package/lib/components/ExpandCollapse/ExpandCollapse.js.map +1 -1
  100. package/lib/components/FieldGroup/FieldGroup.d.ts +1 -3
  101. package/lib/components/FieldGroup/FieldGroup.d.ts.map +1 -1
  102. package/lib/components/FieldGroup/FieldGroup.js.map +1 -1
  103. package/lib/components/FieldValueList/FieldValueList.d.ts +1 -1
  104. package/lib/components/FieldValueList/FieldValueList.js.map +1 -1
  105. package/lib/components/File/FileDisplay.d.ts +2 -2
  106. package/lib/components/File/FileDisplay.d.ts.map +1 -1
  107. package/lib/components/File/FileDisplay.js.map +1 -1
  108. package/lib/components/File/FileInput.d.ts +1 -3
  109. package/lib/components/File/FileInput.d.ts.map +1 -1
  110. package/lib/components/File/FileInput.js.map +1 -1
  111. package/lib/components/FormControl/FormControl.d.ts +3 -2
  112. package/lib/components/FormControl/FormControl.d.ts.map +1 -1
  113. package/lib/components/FormControl/FormControl.js.map +1 -1
  114. package/lib/components/FormField/FormField.d.ts +2 -2
  115. package/lib/components/FormField/FormField.d.ts.map +1 -1
  116. package/lib/components/FormField/FormField.js +10 -14
  117. package/lib/components/FormField/FormField.js.map +1 -1
  118. package/lib/components/Grid/Grid.d.ts.map +1 -1
  119. package/lib/components/Grid/Grid.js +0 -3
  120. package/lib/components/Grid/Grid.js.map +1 -1
  121. package/lib/components/Grid/Grid.types.d.ts +6 -6
  122. package/lib/components/Grid/Grid.types.js.map +1 -1
  123. package/lib/components/Input/Input.d.ts +1 -1
  124. package/lib/components/Input/Input.js.map +1 -1
  125. package/lib/components/Label/Label.d.ts +1 -1
  126. package/lib/components/Label/Label.js.map +1 -1
  127. package/lib/components/Lightbox/Lightbox.types.d.ts +1 -1
  128. package/lib/components/Lightbox/Lightbox.types.d.ts.map +1 -1
  129. package/lib/components/Lightbox/Lightbox.types.js.map +1 -1
  130. package/lib/components/Link/Link.d.ts +1 -1
  131. package/lib/components/Link/Link.js.map +1 -1
  132. package/lib/components/ListToolbar/ListToolbar.types.d.ts +2 -2
  133. package/lib/components/ListToolbar/ListToolbar.types.d.ts.map +1 -1
  134. package/lib/components/ListToolbar/ListToolbar.types.js.map +1 -1
  135. package/lib/components/Location/LocationDisplay.d.ts +1 -1
  136. package/lib/components/Location/LocationDisplay.js.map +1 -1
  137. package/lib/components/Location/utils.d.ts +1 -1
  138. package/lib/components/Location/utils.d.ts.map +1 -1
  139. package/lib/components/Location/utils.js +1 -1
  140. package/lib/components/Location/utils.js.map +1 -1
  141. package/lib/components/Menu/Menu.types.d.ts +6 -12
  142. package/lib/components/Menu/Menu.types.d.ts.map +1 -1
  143. package/lib/components/Menu/Menu.types.js.map +1 -1
  144. package/lib/components/MenuButton/MenuButton.d.ts +1 -1
  145. package/lib/components/MenuButton/MenuButton.js.map +1 -1
  146. package/lib/components/Modal/Modal.d.ts.map +1 -1
  147. package/lib/components/Modal/Modal.js +3 -5
  148. package/lib/components/Modal/Modal.js.map +1 -1
  149. package/lib/components/Modal/Modal.types.d.ts +25 -71
  150. package/lib/components/Modal/Modal.types.d.ts.map +1 -1
  151. package/lib/components/Modal/Modal.types.js.map +1 -1
  152. package/lib/components/MultiStepForm/HorizontalFormProgress.d.ts.map +1 -1
  153. package/lib/components/MultiStepForm/HorizontalFormProgress.js +4 -0
  154. package/lib/components/MultiStepForm/HorizontalFormProgress.js.map +1 -1
  155. package/lib/components/MultiStepForm/MultiStepForm.d.ts.map +1 -1
  156. package/lib/components/MultiStepForm/MultiStepForm.js +1 -1
  157. package/lib/components/MultiStepForm/MultiStepForm.js.map +1 -1
  158. package/lib/components/MultiStepForm/MultiStepForm.types.d.ts +1 -1
  159. package/lib/components/MultiStepForm/MultiStepForm.types.js.map +1 -1
  160. package/lib/components/Phone/PhoneDisplay.d.ts +1 -1
  161. package/lib/components/Phone/PhoneDisplay.js.map +1 -1
  162. package/lib/components/Popover/Popover.d.ts +4 -4
  163. package/lib/components/Popover/Popover.d.ts.map +1 -1
  164. package/lib/components/Popover/Popover.js +16 -1
  165. package/lib/components/Popover/Popover.js.map +1 -1
  166. package/lib/components/Popover/modifiers.d.ts.map +1 -1
  167. package/lib/components/Popover/modifiers.js +25 -6
  168. package/lib/components/Popover/modifiers.js.map +1 -1
  169. package/lib/components/Progress/Progress.types.d.ts +2 -2
  170. package/lib/components/Progress/Progress.types.js.map +1 -1
  171. package/lib/components/SearchInput/SearchInput.d.ts +1 -1
  172. package/lib/components/SearchInput/SearchInput.js.map +1 -1
  173. package/lib/components/Skeleton/LineSkeleton.d.ts +2 -2
  174. package/lib/components/Skeleton/LineSkeleton.js.map +1 -1
  175. package/lib/components/Skeleton/RectangleSkeleton.d.ts +3 -3
  176. package/lib/components/Skeleton/RectangleSkeleton.js.map +1 -1
  177. package/lib/components/Slider/Slider.types.d.ts +3 -9
  178. package/lib/components/Slider/Slider.types.d.ts.map +1 -1
  179. package/lib/components/Slider/Slider.types.js.map +1 -1
  180. package/lib/components/SummaryItem/SummaryItem.d.ts +2 -1
  181. package/lib/components/SummaryItem/SummaryItem.d.ts.map +1 -1
  182. package/lib/components/SummaryItem/SummaryItem.js.map +1 -1
  183. package/lib/components/SummaryList/SummaryList.d.ts +2 -2
  184. package/lib/components/SummaryList/SummaryList.d.ts.map +1 -1
  185. package/lib/components/SummaryList/SummaryList.js.map +1 -1
  186. package/lib/components/Table/Table.d.ts +1 -1
  187. package/lib/components/Table/Table.js.map +1 -1
  188. package/lib/components/Tabs/TabPanel.d.ts +1 -1
  189. package/lib/components/Tabs/TabPanel.d.ts.map +1 -1
  190. package/lib/components/Tabs/TabPanel.js.map +1 -1
  191. package/lib/components/Tabs/Tabs.types.d.ts +1 -1
  192. package/lib/components/Tabs/Tabs.types.js.map +1 -1
  193. package/lib/components/Text/Text.d.ts +2 -4
  194. package/lib/components/Text/Text.d.ts.map +1 -1
  195. package/lib/components/Text/Text.js.map +1 -1
  196. package/lib/components/Toaster/Toaster.types.d.ts +1 -1
  197. package/lib/components/Toaster/Toaster.types.d.ts.map +1 -1
  198. package/lib/components/Toaster/Toaster.types.js.map +1 -1
  199. package/lib/components/Tooltip/Tooltip.d.ts +3 -3
  200. package/lib/components/Tooltip/Tooltip.js.map +1 -1
  201. package/lib/components/URL/URLDisplay.d.ts +1 -1
  202. package/lib/components/URL/URLDisplay.js +2 -2
  203. package/lib/components/URL/URLDisplay.js.map +1 -1
  204. package/lib/hooks/useArrows.js +1 -1
  205. package/lib/hooks/useArrows.js.map +1 -1
  206. package/lib/i18n/translate.d.ts +2 -6
  207. package/lib/i18n/translate.d.ts.map +1 -1
  208. package/lib/i18n/translate.js.map +1 -1
  209. package/lib/types/types.d.ts.map +1 -1
  210. package/lib/types/types.js.map +1 -1
  211. package/lib/utils/kebabToCamel.d.ts +1 -3
  212. package/lib/utils/kebabToCamel.d.ts.map +1 -1
  213. package/lib/utils/kebabToCamel.js +1 -3
  214. package/lib/utils/kebabToCamel.js.map +1 -1
  215. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"Modal.js","sourceRoot":"","sources":["../../../src/components/Modal/Modal.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EAIV,SAAS,EAET,MAAM,EACN,WAAW,EAEZ,MAAM,OAAO,CAAC;AAEf,OAAO,QAAQ,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,QAAQ,MAAM,aAAa,CAAC;AACnC,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,MAAM,MAAM,WAAW,CAAC;AAE/B,OAAO,EACL,kBAAkB,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EAC/C,oBAAoB,EAAE,YAAY,EAClC,mBAAmB,EAAE,WAAW,EAChC,qBAAqB,EAAE,aAAa,EACpC,oBAAoB,EAAE,GAAG,EAAE;YACzB,OAAO,EAAE,CAAC;YACV,YAAY,EAAE,EAAE,CAAC;QACnB,CAAC,YAEA,KAAK,GACG,CACZ,CAAC;IAEJ,OAAO,KAAK,KAAK,WAAW,CAAC,CAAC,CAAC,KAAC,cAAc,OAAK,KAAK,KAAM,SAAS,GAAI,CAAC,CAAC,CAAC,WAAW,CAAC;AAC5F,CAAC,CACF,CAAC;AAEF,eAAe,KAAK,CAAC","sourcesContent":["import {\n forwardRef,\n FunctionComponent,\n PropsWithoutRef,\n Ref,\n useEffect,\n MouseEvent,\n useRef,\n useCallback,\n KeyboardEvent as ReactKeyboardEvent\n} from 'react';\n\nimport Progress from '../Progress';\nimport { getFocusables } from '../../utils';\nimport Backdrop from '../Backdrop';\nimport Flex from '../Flex';\nimport Button from '../Button';\nimport { ForwardProps } from '../../types';\nimport {\n useConsolidatedRef,\n useI18n,\n useOuterEvent,\n useUID,\n useFocusTrap,\n usePrevious,\n useModalContext\n} from '../../hooks';\nimport Icon, { registerIcon } from '../Icon';\nimport * as timesIcon from '../Icon/icons/times.icon';\nimport * as minusIcon from '../Icon/icons/minus.icon';\nimport * as dockIcon from '../Icon/icons/dock.icon';\nimport * as undockIcon from '../Icon/icons/undock.icon';\nimport Text from '../Text';\nimport { Count } from '../Badges';\n\nimport MinimizedModal from './MinimizedModal';\nimport type { ModalProps } from './Modal.types';\nimport {\n StyledModal,\n StyledModalHeader,\n StyledModalContent,\n StyledModalActions,\n StyledModalChildrenWrap\n} from './Modal.styles';\n\nregisterIcon(timesIcon, minusIcon, dockIcon, undockIcon);\n\nconst Modal: FunctionComponent<ModalProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<ModalProps>, ref: Ref<HTMLElement>) => {\n const {\n as,\n progress = false,\n heading,\n count,\n children,\n actions,\n stretch = false,\n center = false,\n defaultFocus,\n onBeforeOpen,\n onAfterOpen,\n onBeforeClose,\n onAfterClose,\n onRequestDismiss,\n onRequestMinimize,\n onRequestMaximize,\n onRequestDock,\n onRequestActivate,\n ...restProps\n } = props;\n\n const {\n alert,\n dismissible,\n minimizable,\n maximizable,\n dockable,\n state,\n dismiss,\n minimize,\n maximize,\n dock,\n unmount,\n top\n } = useModalContext();\n\n const modalRef = useConsolidatedRef(ref);\n const modalContentRef = useRef<HTMLDivElement>(null);\n const backdropRef = useRef<HTMLDivElement>(null);\n const closeButtonRef = useRef<HTMLButtonElement>(null);\n const previousState = usePrevious(state);\n const id = useUID();\n const t = useI18n();\n\n const tryDismiss = () => {\n if (onRequestDismiss?.() !== false) {\n dismiss();\n }\n };\n\n const setFocus = () => {\n if (progress) return;\n\n const focusables = getFocusables(modalRef);\n\n if (defaultFocus?.current) {\n defaultFocus.current.focus();\n } else {\n const focusable =\n focusables.find(el => {\n return modalContentRef.current?.contains(el);\n }) ??\n closeButtonRef.current ??\n focusables[0];\n\n focusable?.focus();\n }\n };\n\n useFocusTrap(modalRef);\n\n useOuterEvent('mousedown', [modalRef], e => {\n if (['minimized', 'docked', 'closed'].includes(state)) return;\n\n if (dismissible) {\n if (e.target === backdropRef.current) {\n tryDismiss();\n }\n } else {\n modalRef.current?.focus();\n }\n });\n\n useEffect(() => {\n if (state === 'minimized') return;\n if (state === 'open' || state === 'maximized' || state === 'docked') setFocus();\n\n // This won't actually run until potential changes to docked modal handling.\n if (state === 'closed' && previousState === 'docked') {\n onBeforeClose?.();\n unmount();\n onAfterClose?.();\n }\n }, [state]);\n\n useEffect(() => {\n /*\n * If a modal is already in a closed state on initial mount, unmount it.\n * This only happens when a docked modal closes since the ModalManager\n * remounts it outside of the DockedModals container if state !== 'docked'.\n */\n if (state === 'closed') {\n onBeforeClose?.();\n unmount();\n onAfterClose?.();\n }\n }, []);\n\n // Dismiss on Escape needs to be handled using React event handling to be cancelable using SyntheticEvent.stopPropagation.\n const onModalKeyDown = useCallback(\n (e: ReactKeyboardEvent) => {\n if (\n dismissible &&\n (state === 'open' || state === 'maximized') &&\n e.key === 'Escape' &&\n top\n ) {\n tryDismiss();\n }\n },\n [dismissible, state, top, tryDismiss]\n );\n\n const onHeaderActionKeyDown = useCallback((e: ReactKeyboardEvent<HTMLButtonElement>) => {\n if (e.repeat && (e.key === 'Enter' || e.key === ' ')) e.preventDefault();\n }, []);\n\n useEffect(() => {\n if (!progress) {\n setFocus();\n }\n }, [progress]);\n\n const maximized = stretch || state === 'maximized';\n\n const modal = (\n <Flex\n {...restProps}\n container={{ direction: 'column' }}\n ref={modalRef}\n as={StyledModal}\n forwardedAs={as}\n onClick={(e: MouseEvent) => e.stopPropagation()}\n onKeyDown={onModalKeyDown}\n alert={alert}\n role={alert ? 'alertdialog' : 'dialog'}\n stretch={maximized}\n center={center}\n aria-labelledby={`${id}-heading`}\n aria-modal={state === 'docked' ? 'false' : 'true'}\n state={state}\n aria-live='polite'\n aria-busy={progress ? 'true' : 'false'}\n >\n <Flex\n container={{ justify: 'between', alignItems: 'center', gap: 1 }}\n item={{ shrink: 0 }}\n as={StyledModalHeader}\n hasAction={minimizable || dismissible}\n >\n <Flex\n container={{ alignItems: 'center', gap: 1 }}\n as={Text}\n variant='h2'\n id={`${id}-heading`}\n >\n <span>{heading}</span>\n {typeof count === 'number' && <Count>{count}</Count>}\n </Flex>\n\n <Flex container>\n {maximizable && !alert && state !== 'maximized' && (\n <Button\n icon\n variant='simple'\n label={t('modal_maximize')}\n onKeyDown={onHeaderActionKeyDown}\n onClick={() => {\n if (onRequestMaximize?.() !== false) {\n maximize();\n }\n }}\n >\n <Icon name='undock' />\n </Button>\n )}\n {dockable && !alert && state !== 'docked' && (\n <Button\n icon\n variant='simple'\n label={t('modal_dock')}\n onKeyDown={onHeaderActionKeyDown}\n onClick={() => {\n if (onRequestDock?.() !== false) {\n dock();\n }\n }}\n >\n <Icon name='dock' />\n </Button>\n )}\n {minimizable && !alert && (\n <Button\n icon\n variant='simple'\n label={t('modal_minimize')}\n onKeyDown={onHeaderActionKeyDown}\n onClick={() => {\n if (onRequestMinimize?.() !== false) {\n minimize();\n }\n }}\n >\n <Icon name='minus' />\n </Button>\n )}\n {dismissible && !alert && (\n <Button\n icon\n variant='simple'\n label={t('modal_close')}\n onKeyDown={onHeaderActionKeyDown}\n onClick={tryDismiss}\n ref={closeButtonRef}\n >\n <Icon name='times' />\n </Button>\n )}\n </Flex>\n </Flex>\n\n <Flex item={{ grow: 1 }} as={StyledModalContent} ref={modalContentRef}>\n {children && <StyledModalChildrenWrap>{children}</StyledModalChildrenWrap>}\n\n <Progress\n visible={!!progress}\n focusOnVisible\n placement='local'\n message={typeof progress === 'object' ? progress.message : t('loading')}\n />\n </Flex>\n\n {actions && (\n <Flex container={{ justify: 'between' }} item={{ shrink: 0 }} as={StyledModalActions}>\n {actions}\n </Flex>\n )}\n </Flex>\n );\n\n const renderModal =\n state === 'docked' ? (\n modal\n ) : (\n <Backdrop\n ref={backdropRef}\n container={{\n alignItems: center || maximized ? 'center' : 'start'\n }}\n transitionSpeed='slow'\n open={state === 'open' || state === 'maximized'}\n onBeforeTransitionIn={onBeforeOpen}\n onAfterTransitionIn={onAfterOpen}\n onBeforeTransitionOut={onBeforeClose}\n onAfterTransitionOut={() => {\n unmount();\n onAfterClose?.();\n }}\n >\n {modal}\n </Backdrop>\n );\n\n return state === 'minimized' ? <MinimizedModal {...props} {...restProps} /> : renderModal;\n }\n);\n\nexport default Modal;\n"]}
1
+ {"version":3,"file":"Modal.js","sourceRoot":"","sources":["../../../src/components/Modal/Modal.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EAIV,SAAS,EAET,MAAM,EACN,WAAW,EAEZ,MAAM,OAAO,CAAC;AAEf,OAAO,QAAQ,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,QAAQ,MAAM,aAAa,CAAC;AACnC,OAAO,IAAI,MAAM,SAAS,CA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C,OAAO;SACrD,EACD,eAAe,EAAC,MAAM,EACtB,IAAI,EAAE,KAAK,KAAK,MAAM,IAAI,KAAK,KAAK,WAAW,EAC/C,oBAAoB,EAAE,YAAY,EAClC,mBAAmB,EAAE,WAAW,EAChC,qBAAqB,EAAE,aAAa,EACpC,oBAAoB,EAAE,GAAG,EAAE;YACzB,OAAO,EAAE,CAAC;YACV,YAAY,EAAE,EAAE,CAAC;QACnB,CAAC,YAEA,KAAK,GACG,CACZ,CAAC;IAEJ,OAAO,KAAK,KAAK,WAAW,CAAC,CAAC,CAAC,KAAC,cAAc,OAAK,KAAK,KAAM,SAAS,GAAI,CAAC,CAAC,CAAC,WAAW,CAAC;AAC5F,CAAC,CACF,CAAC;AAEF,eAAe,KAAK,CAAC","sourcesContent":["import {\n forwardRef,\n FunctionComponent,\n PropsWithoutRef,\n Ref,\n useEffect,\n MouseEvent,\n useRef,\n useCallback,\n KeyboardEvent as ReactKeyboardEvent\n} from 'react';\n\nimport Progress from '../Progress';\nimport { getFocusables } from '../../utils';\nimport Backdrop from '../Backdrop';\nimport Flex from '../Flex';\nimport Button from '../Button';\nimport { ForwardProps } from '../../types';\nimport {\n useConsolidatedRef,\n useI18n,\n useOuterEvent,\n useUID,\n useFocusTrap,\n usePrevious,\n useModalContext\n} from '../../hooks';\nimport Icon, { registerIcon } from '../Icon';\nimport * as timesIcon from '../Icon/icons/times.icon';\nimport * as minusIcon from '../Icon/icons/minus.icon';\nimport * as dockIcon from '../Icon/icons/dock.icon';\nimport * as undockIcon from '../Icon/icons/undock.icon';\nimport Text from '../Text';\nimport { Count } from '../Badges';\n\nimport MinimizedModal from './MinimizedModal';\nimport type { ModalProps } from './Modal.types';\nimport {\n StyledModal,\n StyledModalHeader,\n StyledModalContent,\n StyledModalActions,\n StyledModalChildrenWrap\n} from './Modal.styles';\n\nregisterIcon(timesIcon, minusIcon, dockIcon, undockIcon);\n\nconst Modal: FunctionComponent<ModalProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<ModalProps>, ref: Ref<HTMLElement>) => {\n const {\n as,\n progress = false,\n heading,\n count,\n children,\n actions,\n stretch = false,\n center = false,\n defaultFocus,\n onBeforeOpen,\n onAfterOpen,\n onBeforeClose,\n onAfterClose,\n onRequestDismiss,\n onRequestMinimize,\n onRequestMaximize,\n onRequestDock,\n onRequestActivate,\n ...restProps\n } = props;\n\n const {\n alert,\n dismissible,\n minimizable,\n maximizable,\n dockable,\n state,\n dismiss,\n minimize,\n maximize,\n dock,\n unmount,\n top\n } = useModalContext();\n\n const modalRef = useConsolidatedRef(ref);\n const modalContentRef = useRef<HTMLDivElement>(null);\n const backdropRef = useRef<HTMLDivElement>(null);\n const closeButtonRef = useRef<HTMLButtonElement>(null);\n const previousState = usePrevious(state);\n const id = useUID();\n const t = useI18n();\n\n const tryDismiss = () => {\n if (onRequestDismiss?.() !== false) {\n dismiss();\n }\n };\n\n const setFocus = () => {\n if (progress) return;\n\n const focusables = getFocusables(modalRef);\n\n if (defaultFocus?.current) {\n defaultFocus.current.focus();\n } else {\n const focusable =\n focusables.find(el => {\n return modalContentRef.current?.contains(el);\n }) ??\n closeButtonRef.current ??\n focusables[0];\n\n focusable?.focus();\n }\n };\n\n useFocusTrap(modalRef);\n\n useOuterEvent('mousedown', [modalRef], e => {\n if (['minimized', 'docked', 'closed'].includes(state)) return;\n\n if (dismissible) {\n if (e.target === backdropRef.current) {\n tryDismiss();\n }\n } else {\n modalRef.current?.focus();\n }\n });\n\n useEffect(() => {\n if (state === 'minimized') return;\n if (state === 'open' || state === 'maximized' || state === 'docked') setFocus();\n\n // This won't actually run until potential changes to docked modal handling.\n if (state === 'closed' && previousState === 'docked') {\n onBeforeClose?.();\n unmount();\n onAfterClose?.();\n }\n }, [state]);\n\n useEffect(() => {\n // If a modal is already in a closed state on initial mount, unmount it.\n // This only happens when a docked modal closes since the ModalManager\n // remounts it outside of the DockedModals container if state !== 'docked'.\n if (state === 'closed') {\n onBeforeClose?.();\n unmount();\n onAfterClose?.();\n }\n }, []);\n\n // Dismiss on Escape needs to be handled using React event handling to be cancelable using SyntheticEvent.stopPropagation.\n const onModalKeyDown = useCallback(\n (e: ReactKeyboardEvent) => {\n if (\n dismissible &&\n (state === 'open' || state === 'maximized') &&\n e.key === 'Escape' &&\n top\n ) {\n tryDismiss();\n }\n },\n [dismissible, state, top, tryDismiss]\n );\n\n const onHeaderActionKeyDown = useCallback((e: ReactKeyboardEvent<HTMLButtonElement>) => {\n if (e.repeat && (e.key === 'Enter' || e.key === ' ')) e.preventDefault();\n }, []);\n\n useEffect(() => {\n if (!progress) {\n setFocus();\n }\n }, [progress]);\n\n const maximized = stretch || state === 'maximized';\n\n const modal = (\n <Flex\n {...restProps}\n container={{ direction: 'column' }}\n ref={modalRef}\n as={StyledModal}\n forwardedAs={as}\n onClick={(e: MouseEvent) => e.stopPropagation()}\n onKeyDown={onModalKeyDown}\n alert={alert}\n role={alert ? 'alertdialog' : 'dialog'}\n stretch={maximized}\n center={center}\n aria-labelledby={`${id}-heading`}\n aria-modal={state === 'docked' ? 'false' : 'true'}\n state={state}\n aria-live='polite'\n aria-busy={progress ? 'true' : 'false'}\n >\n <Flex\n container={{ justify: 'between', alignItems: 'center', gap: 1 }}\n item={{ shrink: 0 }}\n as={StyledModalHeader}\n hasAction={minimizable || dismissible}\n >\n <Flex\n container={{ alignItems: 'center', gap: 1 }}\n as={Text}\n variant='h2'\n id={`${id}-heading`}\n >\n <span>{heading}</span>\n {typeof count === 'number' && <Count>{count}</Count>}\n </Flex>\n\n <Flex container>\n {maximizable && !alert && state !== 'maximized' && (\n <Button\n icon\n variant='simple'\n label={t('modal_maximize')}\n onKeyDown={onHeaderActionKeyDown}\n onClick={() => {\n if (onRequestMaximize?.() !== false) {\n maximize();\n }\n }}\n >\n <Icon name='undock' />\n </Button>\n )}\n {dockable && !alert && state !== 'docked' && (\n <Button\n icon\n variant='simple'\n label={t('modal_dock')}\n onKeyDown={onHeaderActionKeyDown}\n onClick={() => {\n if (onRequestDock?.() !== false) {\n dock();\n }\n }}\n >\n <Icon name='dock' />\n </Button>\n )}\n {minimizable && !alert && (\n <Button\n icon\n variant='simple'\n label={t('modal_minimize')}\n onKeyDown={onHeaderActionKeyDown}\n onClick={() => {\n if (onRequestMinimize?.() !== false) {\n minimize();\n }\n }}\n >\n <Icon name='minus' />\n </Button>\n )}\n {dismissible && !alert && (\n <Button\n icon\n variant='simple'\n label={t('modal_close')}\n onKeyDown={onHeaderActionKeyDown}\n onClick={tryDismiss}\n ref={closeButtonRef}\n >\n <Icon name='times' />\n </Button>\n )}\n </Flex>\n </Flex>\n\n <Flex item={{ grow: 1 }} as={StyledModalContent} ref={modalContentRef}>\n {children && <StyledModalChildrenWrap>{children}</StyledModalChildrenWrap>}\n\n <Progress\n visible={!!progress}\n focusOnVisible\n placement='local'\n message={typeof progress === 'object' ? progress.message : t('loading')}\n />\n </Flex>\n\n {actions && (\n <Flex container={{ justify: 'between' }} item={{ shrink: 0 }} as={StyledModalActions}>\n {actions}\n </Flex>\n )}\n </Flex>\n );\n\n const renderModal =\n state === 'docked' ? (\n modal\n ) : (\n <Backdrop\n ref={backdropRef}\n container={{\n alignItems: center || maximized ? 'center' : 'start'\n }}\n transitionSpeed='slow'\n open={state === 'open' || state === 'maximized'}\n onBeforeTransitionIn={onBeforeOpen}\n onAfterTransitionIn={onAfterOpen}\n onBeforeTransitionOut={onBeforeClose}\n onAfterTransitionOut={() => {\n unmount();\n onAfterClose?.();\n }}\n >\n {modal}\n </Backdrop>\n );\n\n return state === 'minimized' ? <MinimizedModal {...props} {...restProps} /> : renderModal;\n }\n);\n\nexport default Modal;\n"]}
@@ -43,52 +43,29 @@ export interface ModalOptions {
43
43
  * @default true
44
44
  */
45
45
  unmountWhenMinimized?: boolean;
46
- /**
47
- * Used to identify the modal. Will be passed back as an argument in life cycle functions.
48
- */
46
+ /** Used to identify the modal. Will be passed back as an argument in life cycle functions. */
49
47
  id?: string;
50
- /**
51
- * Life cycle function that will be run when the modal is minimized.
52
- */
48
+ /** Life cycle function that will be run when the modal is minimized. */
53
49
  onMinimize?: (id: string) => void;
54
- /**
55
- * Life cycle function that will be run when the modal is maximized.
56
- */
50
+ /** Life cycle function that will be run when the modal is maximized. */
57
51
  onMaximize?: (id: string) => void;
58
- /**
59
- * Life cycle function that will be run when the modal is maximized.
60
- */
52
+ /** Life cycle function that will be run when the modal is maximized. */
61
53
  onDock?: (id: string) => void;
62
- /**
63
- * Life cycle function that will be run when the modal is activated (un minimized).
64
- */
54
+ /** Life cycle function that will be run when the modal is activated (un minimized). */
65
55
  onActivate?: (id: string) => void;
66
- /**
67
- * Life cycle function that will be run when the modal is dismissed.
68
- */
56
+ /** Life cycle function that will be run when the modal is dismissed. */
69
57
  onDismiss?: (id: string) => void;
70
58
  }
71
59
  export interface ModalProps extends BaseProps, AsProp {
72
- /**
73
- * Place a modal into a loading state by way of a bool or an object which allows for a custom message and determinate progress.
74
- */
60
+ /** Place a modal into a loading state by way of a bool or an object which allows for a custom message and determinate progress. */
75
61
  progress?: boolean | Pick<ProgressProps, 'message' | 'minValue' | 'maxValue' | 'value'>;
76
- /**
77
- * Heading for the Modal.
78
- */
62
+ /** Heading for the Modal. */
79
63
  heading: ReactNode;
80
- /**
81
- * Count for list data presented in the Modal.
82
- */
64
+ /** Count for list data presented in the Modal. */
83
65
  count?: number;
84
- /**
85
- /**
86
- * Content for the Modal.
87
- */
66
+ /** Content for the Modal. */
88
67
  children: ReactNode;
89
- /**
90
- * Actions for the Modal.
91
- */
68
+ /** Actions for the Modal. */
92
69
  actions?: ReactNode;
93
70
  /**
94
71
  * Render the modal in full width and height.
@@ -105,25 +82,15 @@ export interface ModalProps extends BaseProps, AsProp {
105
82
  * @default false
106
83
  */
107
84
  autoWidth?: boolean;
108
- /**
109
- * Takes a React Ref of the element to be focused initially on mounting Modal.
110
- */
85
+ /** Takes a React Ref of the element to be focused initially on mounting Modal. */
111
86
  defaultFocus?: RefObject<HTMLElement>;
112
- /**
113
- * Accepts a callback function that gets invoked before opening a Modal.
114
- */
87
+ /** Accepts a callback function that gets invoked before opening a Modal. */
115
88
  onBeforeOpen?: () => void;
116
- /**
117
- * Accepts a callback function that gets invoked after opening a Modal.
118
- */
89
+ /** Accepts a callback function that gets invoked after opening a Modal. */
119
90
  onAfterOpen?: () => void;
120
- /**
121
- * Accepts a callback function that gets invoked before closing a Modal.
122
- */
91
+ /** Accepts a callback function that gets invoked before closing a Modal. */
123
92
  onBeforeClose?: () => void;
124
- /**
125
- * Accepts a callback function that gets invoked after closing a Modal.
126
- */
93
+ /** Accepts a callback function that gets invoked after closing a Modal. */
127
94
  onAfterClose?: () => void;
128
95
  /**
129
96
  * Accepts a callback function that returns a boolean before dismissing a modal.
@@ -153,38 +120,25 @@ export interface ModalProps extends BaseProps, AsProp {
153
120
  }
154
121
  export type ModalState = 'open' | 'closed' | 'minimized' | 'maximized' | 'docked';
155
122
  export interface ModalMethods<P extends object = object> {
156
- /**
157
- * Closes the referenced Modal when called.
158
- */
123
+ /** Closes the referenced Modal when called. */
159
124
  dismiss: () => void;
160
- /**
161
- * Updates the referenced Modal with a set of props.
162
- */
125
+ /** Updates the referenced Modal with a set of props. */
163
126
  update: (props: Partial<P>) => void;
164
- /**
165
- * Minimizes the referenced Modal.
166
- */
127
+ /** Minimizes the referenced Modal. */
167
128
  minimize: () => void;
168
- /**
169
- * Maximizes the referenced Modal.
170
- */
129
+ /** Maximizes the referenced Modal. */
171
130
  maximize: () => void;
172
- /**
173
- * docks the referenced Modal.
174
- */
131
+ /** Docks the referenced Modal. */
175
132
  dock: () => void;
176
- /**
177
- * Will reopen the referenced Modal if minimized, and minimize any open Modals that are minimizable.
178
- */
133
+ /** Will reopen the referenced Modal if minimized, and minimize any open Modals that are minimizable. */
179
134
  activate: () => void;
180
- /**
181
- * Removes the referenced Modal from the DOM.
182
- */
135
+ /** Removes the referenced Modal from the DOM. */
183
136
  unmount: () => void;
184
137
  }
185
138
  export interface ModalManagerContextValue {
186
139
  /**
187
- * The function that will create the Modal. This function accepts the component to render a Modal, props for that component, and options for that Modal.
140
+ * The function that will create the Modal. This function accepts the component to render a Modal,
141
+ * props for that component, and options for that Modal.
188
142
  */
189
143
  create: <P extends object>(component: ComponentType<P>, props?: DeferInfer<P>, options?: ModalOptions) => ModalMethods<P>;
190
144
  ModalContext: Context<ModalContextValue>;
@@ -1 +1 @@
1
- {"version":3,"file":"Modal.types.d.ts","sourceRoot":"","sources":["../../../src/components/Modal/Modal.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAE1E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAE7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEjE,MAAM,WAAW,iBAAiB;IAChC,2DAA2D;IAC3D,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,MAAM,WAAW,YAAY;IAC3B;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;;OAGG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,UAAU,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC;;OAEG;IACH,UAAU,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC;;OAEG;IACH,MAAM,CAAC,EAAE,C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AM,GAAG,MAAM;IACpD,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,UAAU,CAAC;IAClB,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC;IACzB,KAAK,CAAC,EAAE,CAAC,CAAC;IACV,SAAS,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;IAC5B,OAAO,EAAE,YAAY,CAAC;CACvB"}
@@ -1 +1 @@
1
- {"version":3,"file":"Modal.types.js","sourceRoot":"","sources":["../../../src/components/Modal/Modal.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ComponentType, ReactNode, RefObject, Context } from 'react';\n\nimport type { ProgressProps } from '@pega/cosmos-react-core';\n\nimport type { BaseProps, AsProp, DeferInfer } from '../../types';\n\nexport interface ModalManagerProps {\n /** Content that will be provided modal manager context. */\n children: ReactNode;\n}\n\nexport interface ModalOptions {\n /**\n * If true, the Modal will render as an alert that is not dismissible.\n * @default false\n */\n alert?: boolean;\n /**\n * Toggle Esc keypress action or clicking backdrop to dismiss Modal. Also displays dismiss button on Modal header.\n * Not valid for Modals of type alert.\n * @default alert ? false : true\n */\n dismissible?: boolean;\n /**\n * Toggle minimize button in header thereby helping in rendering minimizable/non-minimizable Modals.\n * Not valid for Modals of type alert.\n * @default false\n */\n minimizable?: boolean;\n /**\n * Toggle maximize button in header thereby helping in rendering maximizable/non-maximizable Modals.\n * Not valid for Modals of type alert.\n * @default false\n */\n maximizable?: boolean;\n /** Positions the modal in the right corner without backdrop\n * @default false\n */\n dockable?: boolean;\n /**\n * If true, the Modal will initially render in a minimized state.\n * @default false\n */\n defaultMinimized?: boolean;\n /**\n * If true, the Modal content will be removed from the DOM when in a minimized state.\n * @default true\n */\n unmountWhenMinimized?: boolean;\n /**\n * Used to identify the modal. Will be passed back as an argument in life cycle functions.\n */\n id?: string;\n /**\n * Life cycle function that will be run when the modal is minimized.\n */\n onMinimize?: (id: string) => void;\n /**\n * Life cycle function that will be run when the modal is maximized.\n */\n onMaximize?: (id: string) => void;\n /**\n * Life cycle function that will be run when the modal is maximized.\n */\n onDock?: (id: string) => void;\n /**\n * Life cycle function that will be run when the modal is activated (un minimized).\n */\n onActivate?: (id: string) => void;\n /**\n * Life cycle function that will be run when the modal is dismissed.\n */\n onDismiss?: (id: string) => void;\n}\n\nexport interface ModalProps extends BaseProps, AsProp {\n /**\n * Place a modal into a loading state by way of a bool or an object which allows for a custom message and determinate progress.\n */\n progress?: boolean | Pick<ProgressProps, 'message' | 'minValue' | 'maxValue' | 'value'>;\n /**\n * Heading for the Modal.\n */\n heading: ReactNode;\n /**\n * Count for list data presented in the Modal.\n */\n count?: number;\n /**\n /**\n * Content for the Modal.\n */\n children: ReactNode;\n /**\n * Actions for the Modal.\n */\n actions?: ReactNode;\n /**\n * Render the modal in full width and height.\n * @default false\n */\n stretch?: boolean;\n /**\n * Toggle to position the Modal vertically centered or not.\n * @default false\n */\n center?: boolean;\n /**\n * Automatically compute the width of the Modal based on the content.\n * @default false\n */\n autoWidth?: boolean;\n /**\n * Takes a React Ref of the element to be focused initially on mounting Modal.\n */\n defaultFocus?: RefObject<HTMLElement>;\n /**\n * Accepts a callback function that gets invoked before opening a Modal.\n */\n onBeforeOpen?: () => void;\n /**\n * Accepts a callback function that gets invoked after opening a Modal.\n */\n onAfterOpen?: () => void;\n /**\n * Accepts a callback function that gets invoked before closing a Modal.\n */\n onBeforeClose?: () => void;\n /**\n * Accepts a callback function that gets invoked after closing a Modal.\n */\n onAfterClose?: () => void;\n /**\n * Accepts a callback function that returns a boolean before dismissing a modal.\n * If the boolean is false, the modal will not be dismissed.\n */\n onRequestDismiss?: () => boolean | void;\n /**\n * Accepts a callback function that returns a boolean before minimizing a modal.\n * If the boolean is false, the modal will not be minimized.\n */\n onRequestMinimize?: () => boolean | void;\n /**\n * Accepts a callback function that returns a boolean before maximizing a modal.\n * If the boolean is false, the modal will not be maximized.\n */\n onRequestMaximize?: () => boolean | void;\n /**\n * Accepts a callback function that returns a boolean before docking a modal.\n * If the boolean is false, the modal will not be dockable.\n */\n onRequestDock?: () => boolean | void;\n /**\n * Accepts a callback function that returns a boolean before activating a modal.\n * If the boolean is false, the modal will not be activated.\n */\n onRequestActivate?: () => boolean | void;\n}\n\nexport type ModalState = 'open' | 'closed' | 'minimized' | 'maximized' | 'docked';\n\nexport interface ModalMethods<P extends object = object> {\n /**\n * Closes the referenced Modal when called.\n */\n dismiss: () => void;\n /**\n * Updates the referenced Modal with a set of props.\n */\n update: (props: Partial<P>) => void;\n /**\n * Minimizes the referenced Modal.\n */\n minimize: () => void;\n /**\n * Maximizes the referenced Modal.\n */\n maximize: () => void;\n /**\n * docks the referenced Modal.\n */\n dock: () => void;\n /**\n * Will reopen the referenced Modal if minimized, and minimize any open Modals that are minimizable.\n */\n activate: () => void;\n /**\n * Removes the referenced Modal from the DOM.\n */\n unmount: () => void;\n}\n\nexport interface ModalManagerContextValue {\n /**\n * The function that will create the Modal. This function accepts the component to render a Modal, props for that component, and options for that Modal.\n */\n create: <P extends object>(\n component: ComponentType<P>,\n props?: DeferInfer<P>,\n options?: ModalOptions\n ) => ModalMethods<P>;\n ModalContext: Context<ModalContextValue>;\n initialized: boolean;\n}\n\nexport interface ModalContextValue extends ModalMethods, ModalOptions {\n state: ModalState;\n top: boolean;\n /** @internal */\n initialized: boolean;\n}\n\nexport interface ModalObject<P extends object = object> {\n id: string;\n state: ModalState;\n methods: ModalMethods<P>;\n props?: P;\n Component: ComponentType<P>;\n options: ModalOptions;\n}\n"]}
1
+ {"version":3,"file":"Modal.types.js","sourceRoot":"","sources":["../../../src/components/Modal/Modal.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ComponentType, ReactNode, RefObject, Context } from 'react';\n\nimport type { ProgressProps } from '@pega/cosmos-react-core';\n\nimport type { BaseProps, AsProp, DeferInfer } from '../../types';\n\nexport interface ModalManagerProps {\n /** Content that will be provided modal manager context. */\n children: ReactNode;\n}\n\nexport interface ModalOptions {\n /**\n * If true, the Modal will render as an alert that is not dismissible.\n * @default false\n */\n alert?: boolean;\n /**\n * Toggle Esc keypress action or clicking backdrop to dismiss Modal. Also displays dismiss button on Modal header.\n * Not valid for Modals of type alert.\n * @default alert ? false : true\n */\n dismissible?: boolean;\n /**\n * Toggle minimize button in header thereby helping in rendering minimizable/non-minimizable Modals.\n * Not valid for Modals of type alert.\n * @default false\n */\n minimizable?: boolean;\n /**\n * Toggle maximize button in header thereby helping in rendering maximizable/non-maximizable Modals.\n * Not valid for Modals of type alert.\n * @default false\n */\n maximizable?: boolean;\n /** Positions the modal in the right corner without backdrop\n * @default false\n */\n dockable?: boolean;\n /**\n * If true, the Modal will initially render in a minimized state.\n * @default false\n */\n defaultMinimized?: boolean;\n /**\n * If true, the Modal content will be removed from the DOM when in a minimized state.\n * @default true\n */\n unmountWhenMinimized?: boolean;\n /** Used to identify the modal. Will be passed back as an argument in life cycle functions. */\n id?: string;\n /** Life cycle function that will be run when the modal is minimized. */\n onMinimize?: (id: string) => void;\n /** Life cycle function that will be run when the modal is maximized. */\n onMaximize?: (id: string) => void;\n /** Life cycle function that will be run when the modal is maximized. */\n onDock?: (id: string) => void;\n /** Life cycle function that will be run when the modal is activated (un minimized). */\n onActivate?: (id: string) => void;\n /** Life cycle function that will be run when the modal is dismissed. */\n onDismiss?: (id: string) => void;\n}\n\nexport interface ModalProps extends BaseProps, AsProp {\n /** Place a modal into a loading state by way of a bool or an object which allows for a custom message and determinate progress. */\n progress?: boolean | Pick<ProgressProps, 'message' | 'minValue' | 'maxValue' | 'value'>;\n /** Heading for the Modal. */\n heading: ReactNode;\n /** Count for list data presented in the Modal. */\n count?: number;\n /** Content for the Modal. */\n children: ReactNode;\n /** Actions for the Modal. */\n actions?: ReactNode;\n /**\n * Render the modal in full width and height.\n * @default false\n */\n stretch?: boolean;\n /**\n * Toggle to position the Modal vertically centered or not.\n * @default false\n */\n center?: boolean;\n /**\n * Automatically compute the width of the Modal based on the content.\n * @default false\n */\n autoWidth?: boolean;\n /** Takes a React Ref of the element to be focused initially on mounting Modal. */\n defaultFocus?: RefObject<HTMLElement>;\n /** Accepts a callback function that gets invoked before opening a Modal. */\n onBeforeOpen?: () => void;\n /** Accepts a callback function that gets invoked after opening a Modal. */\n onAfterOpen?: () => void;\n /** Accepts a callback function that gets invoked before closing a Modal. */\n onBeforeClose?: () => void;\n /** Accepts a callback function that gets invoked after closing a Modal. */\n onAfterClose?: () => void;\n /**\n * Accepts a callback function that returns a boolean before dismissing a modal.\n * If the boolean is false, the modal will not be dismissed.\n */\n onRequestDismiss?: () => boolean | void;\n /**\n * Accepts a callback function that returns a boolean before minimizing a modal.\n * If the boolean is false, the modal will not be minimized.\n */\n onRequestMinimize?: () => boolean | void;\n /**\n * Accepts a callback function that returns a boolean before maximizing a modal.\n * If the boolean is false, the modal will not be maximized.\n */\n onRequestMaximize?: () => boolean | void;\n /**\n * Accepts a callback function that returns a boolean before docking a modal.\n * If the boolean is false, the modal will not be dockable.\n */\n onRequestDock?: () => boolean | void;\n /**\n * Accepts a callback function that returns a boolean before activating a modal.\n * If the boolean is false, the modal will not be activated.\n */\n onRequestActivate?: () => boolean | void;\n}\n\nexport type ModalState = 'open' | 'closed' | 'minimized' | 'maximized' | 'docked';\n\nexport interface ModalMethods<P extends object = object> {\n /** Closes the referenced Modal when called. */\n dismiss: () => void;\n /** Updates the referenced Modal with a set of props. */\n update: (props: Partial<P>) => void;\n /** Minimizes the referenced Modal. */\n minimize: () => void;\n /** Maximizes the referenced Modal. */\n maximize: () => void;\n /** Docks the referenced Modal. */\n dock: () => void;\n /** Will reopen the referenced Modal if minimized, and minimize any open Modals that are minimizable. */\n activate: () => void;\n /** Removes the referenced Modal from the DOM. */\n unmount: () => void;\n}\n\nexport interface ModalManagerContextValue {\n /**\n * The function that will create the Modal. This function accepts the component to render a Modal,\n * props for that component, and options for that Modal.\n */\n create: <P extends object>(\n component: ComponentType<P>,\n props?: DeferInfer<P>,\n options?: ModalOptions\n ) => ModalMethods<P>;\n ModalContext: Context<ModalContextValue>;\n initialized: boolean;\n}\n\nexport interface ModalContextValue extends ModalMethods, ModalOptions {\n state: ModalState;\n top: boolean;\n /** @internal */\n initialized: boolean;\n}\n\nexport interface ModalObject<P extends object = object> {\n id: string;\n state: ModalState;\n methods: ModalMethods<P>;\n props?: P;\n Component: ComponentType<P>;\n options: ModalOptions;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"HorizontalFormProgress.d.ts","sourceRoot":"","sources":["../../../src/components/MultiStepForm/HorizontalFormProgress.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAsC,MAAM,OAAO,CAAC;AAM9E,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAO3C,OAAO,KAAK,kBAAkB,MAAM,uBAAuB,CAAC;AAE5D,UAAU,iBAAiB;IACzB,KAAK,EAAE,kBAAkB,CAAC,OAAO,CAAC,CAAC;IACnC,aAAa,EAAE,kBAAkB,CAAC,eAAe,CAAC,CAAC;CACpD;AAED,eAAO,MAAM,kBAAkB,iKAgB7B,CAAC;AAIH,QAAA,MAAM,sBAAsB,EAAE,iBAAiB,CAAC,iBAAiB,GAAG,YAAY,CAiG/E,CAAC;AAEF,eAAe,sBAAsB,CAAC"}
1
+ {"version":3,"file":"HorizontalFormProgress.d.ts","sourceRoot":"","sources":["../../../src/components/MultiStepForm/HorizontalFormProgress.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAsC,MAAM,OAAO,CAAC;AAM9E,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAO3C,OAAO,KAAK,kBAAkB,MAAM,uBAAuB,CAAC;AAE5D,UAAU,iBAAiB;IACzB,KAAK,EAAE,kBAAkB,CAAC,OAAO,CAAC,CAAC;IACnC,aAAa,EAAE,kBAAkB,CAAC,eAAe,CAAC,CAAC;CACpD;AAED,eAAO,MAAM,kBAAkB,iKAgB7B,CAAC;AAIH,QAAA,MAAM,sBAAsB,EAAE,iBAAiB,CAAC,iBAAiB,GAAG,YAAY,CAqG/E,CAAC;AAEF,eAAe,sBAAsB,CAAC"}
@@ -44,6 +44,10 @@ const HorizontalFormProgress = ({ steps, currentStepId, ...restProps }) => {
44
44
  tryCatch(() => stripUnit(remToPx(theme.base.spacing)), () => 8)
45
45
  ]
46
46
  }
47
+ },
48
+ {
49
+ name: 'placeAndContain',
50
+ enabled: false
47
51
  }
48
52
  ], children: _jsx(Text, { variant: 'h4', children: curStep.name }) }), _jsx(Flex, { container: { justify: 'between', alignItems: 'center' }, item: { grow: 1 }, children: steps.map((step, index) => {
49
53
  return (_jsx(StepMarker, { ref: (el) => {
@@ -1 +1 @@
1
- {"version":3,"file":"HorizontalFormProgress.js","sourceRoot":"","sources":["../../../src/components/MultiStepForm/HorizontalFormProgress.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAoC,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC9E,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAY,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,OAAO,MAAM,YAAY,CAAC;AAEjC,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAQ9F,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IAC3D,MAAM,EACJ,IAAI,EAAE,EAAE,OAAO,EA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AAE,CAAC,CAAC;oCACvB,OAAO,MAAM,CAAC;iCACf;gCACD,IAAI,EAAE;oCAAE,OAAO,EAAE,GAAG,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC;gCAC5C,OAAO,MAAM,CAAC;4BAChB,CAAC,CAAC,CAAC;wBACL,CAAC,gBACW,IAAI,CAAC,IAAI,sBACH,IAAI,CAAC,EAAE,EACzB,OAAO,EAAE,KAAK,KAAK,MAAM,EACzB,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,KAAK,EAAE,KAAK,GAAG,MAAM,EACrB,OAAO,EAAE,IAAI,CAAC,aAAa,YAE1B,KAAK,KAAK,MAAM,IAAI,CACnB,KAAC,OAAO,IACN,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,EACxB,SAAS,EAAC,MAAM,EAChB,SAAS,EAAC,OAAO,EACjB,MAAM,EAAE,KAAK,YAEZ,IAAI,CAAC,IAAI,GACF,CACX,IA5BI,IAAI,CAAC,EAAE,CA6BD,CACd,CAAC;gBACJ,CAAC,CAAC,GACG,EAEP,KAAC,SAAS,cACR,KAAC,UAAU,IAAC,KAAK,EAAE,EAAE,aAAa,EAAE,SAAS,EAAmB,GAAI,GAC1D,IACO,CACtB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,sBAAsB,CAAC","sourcesContent":["import { remToPx, stripUnit } from 'polished';\nimport { FunctionComponent, CSSProperties, useEffect, useState } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { useElement, useTheme } from '../../hooks';\nimport { calculateFontSize, FontSize } from '../../styles';\nimport { defaultThemeProp } from '../../theme';\nimport { ForwardProps } from '../../types';\nimport { tryCatch } from '../../utils';\nimport Flex from '../Flex';\nimport Text from '../Text';\nimport Tooltip from '../Tooltip';\n\nimport { CurrentStepPopover, StepMarker, StyledBar, StyledFill } from './FormProgress.styles';\nimport type MultiStepFormProps from './MultiStepForm.types';\n\ninterface FormProgressProps {\n steps: MultiStepFormProps['steps'];\n currentStepId: MultiStepFormProps['currentStepId'];\n}\n\nexport const StyledFormProgress = styled(Flex)(({ theme }) => {\n const {\n base: { spacing, 'font-size': fontSize, 'font-scale': fontScale },\n components: {\n text: {\n h4: { 'font-size': h4fontSize }\n }\n }\n } = theme;\n const fontSizes = calculateFontSize(fontSize, fontScale);\n\n return css`\n position: relative;\n margin-block-start: calc(-1.5 * ${spacing});\n padding-block-start: calc(${spacing} + ${fontSizes[h4fontSize as FontSize]} * 1.35);\n `;\n});\n\nStyledFormProgress.defaultProps = defaultThemeProp;\n\nconst HorizontalFormProgress: FunctionComponent<FormProgressProps & ForwardProps> = ({\n steps,\n currentStepId,\n ...restProps\n}) => {\n const curIdx = steps.findIndex(step => step.id === currentStepId);\n const curStep = steps[curIdx];\n const fillScale = curIdx / (steps.length - 1);\n\n const [currentStepEl, setCurrentStepEl] = useElement();\n const [stepEls, setStepEls] = useState<Record<string, HTMLElement>>({});\n const theme = useTheme();\n\n let popoverPlacement: 'top' | 'top-start' | 'top-end' = 'top';\n if (curIdx === 0) popoverPlacement = 'top-start';\n else if (curIdx === steps.length - 1) popoverPlacement = 'top-end';\n\n useEffect(() => {\n setCurrentStepEl(stepEls[curStep.id]);\n }, [Object.keys(stepEls), curStep]);\n\n return (\n <StyledFormProgress\n {...restProps}\n container={{ alignItems: 'center' }}\n role='progressbar'\n aria-valuenow={curIdx}\n aria-valuemin={0}\n aria-valuetext={curStep.name}\n aria-valuemax={steps.length}\n >\n <CurrentStepPopover\n show\n target={currentStepEl}\n placement={popoverPlacement}\n strategy='absolute'\n hideOnTargetHidden\n modifiers={[\n {\n name: 'offset',\n options: {\n offset: [\n 0,\n tryCatch(\n () => stripUnit(remToPx(theme.base.spacing)),\n () => 8\n )\n ]\n }\n }\n ]}\n >\n <Text variant='h4'>{curStep.name}</Text>\n </CurrentStepPopover>\n <Flex container={{ justify: 'between', alignItems: 'center' }} item={{ grow: 1 }}>\n {steps.map((step, index) => {\n return (\n <StepMarker\n key={step.id}\n ref={(el: HTMLElement | null) => {\n setStepEls(curr => {\n const newEls = { ...curr };\n if (!el && newEls[step.id]) {\n delete newEls[step.id];\n return newEls;\n }\n if (el) return { ...newEls, [step.id]: el };\n return newEls;\n });\n }}\n aria-label={step.name}\n aria-describedby={step.id}\n current={index === curIdx}\n depth={step.depth}\n prior={index < curIdx}\n onClick={step.onMarkerClick}\n >\n {index !== curIdx && (\n <Tooltip\n target={stepEls[step.id]}\n showDelay='none'\n hideDelay='short'\n portal={false}\n >\n {step.name}\n </Tooltip>\n )}\n </StepMarker>\n );\n })}\n </Flex>\n\n <StyledBar>\n <StyledFill style={{ '--fillScale': fillScale } as CSSProperties} />\n </StyledBar>\n </StyledFormProgress>\n );\n};\n\nexport default HorizontalFormProgress;\n"]}
1
+ {"version":3,"file":"HorizontalFormProgress.js","sourceRoot":"","sources":["../../../src/components/MultiStepForm/HorizontalFormProgress.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAoC,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC9E,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAY,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,OAAO,MAAM,YAAY,CAAC;AAEjC,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAQ9F,MAAM,CAAC,MAAM,kBAAkB,GA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AC,EAAE;gCAChB,MAAM,MAAM,GAAG,EAAE,GAAG,IAAI,EAAE,CAAC;gCAC3B,IAAI,CAAC,EAAE,IAAI,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE;oCAC1B,OAAO,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;oCACvB,OAAO,MAAM,CAAC;iCACf;gCACD,IAAI,EAAE;oCAAE,OAAO,EAAE,GAAG,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC;gCAC5C,OAAO,MAAM,CAAC;4BAChB,CAAC,CAAC,CAAC;wBACL,CAAC,gBACW,IAAI,CAAC,IAAI,sBACH,IAAI,CAAC,EAAE,EACzB,OAAO,EAAE,KAAK,KAAK,MAAM,EACzB,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,KAAK,EAAE,KAAK,GAAG,MAAM,EACrB,OAAO,EAAE,IAAI,CAAC,aAAa,YAE1B,KAAK,KAAK,MAAM,IAAI,CACnB,KAAC,OAAO,IACN,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,EACxB,SAAS,EAAC,MAAM,EAChB,SAAS,EAAC,OAAO,EACjB,MAAM,EAAE,KAAK,YAEZ,IAAI,CAAC,IAAI,GACF,CACX,IA5BI,IAAI,CAAC,EAAE,CA6BD,CACd,CAAC;gBACJ,CAAC,CAAC,GACG,EAEP,KAAC,SAAS,cACR,KAAC,UAAU,IAAC,KAAK,EAAE,EAAE,aAAa,EAAE,SAAS,EAAmB,GAAI,GAC1D,IACO,CACtB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,sBAAsB,CAAC","sourcesContent":["import { remToPx, stripUnit } from 'polished';\nimport { FunctionComponent, CSSProperties, useEffect, useState } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { useElement, useTheme } from '../../hooks';\nimport { calculateFontSize, FontSize } from '../../styles';\nimport { defaultThemeProp } from '../../theme';\nimport { ForwardProps } from '../../types';\nimport { tryCatch } from '../../utils';\nimport Flex from '../Flex';\nimport Text from '../Text';\nimport Tooltip from '../Tooltip';\n\nimport { CurrentStepPopover, StepMarker, StyledBar, StyledFill } from './FormProgress.styles';\nimport type MultiStepFormProps from './MultiStepForm.types';\n\ninterface FormProgressProps {\n steps: MultiStepFormProps['steps'];\n currentStepId: MultiStepFormProps['currentStepId'];\n}\n\nexport const StyledFormProgress = styled(Flex)(({ theme }) => {\n const {\n base: { spacing, 'font-size': fontSize, 'font-scale': fontScale },\n components: {\n text: {\n h4: { 'font-size': h4fontSize }\n }\n }\n } = theme;\n const fontSizes = calculateFontSize(fontSize, fontScale);\n\n return css`\n position: relative;\n margin-block-start: calc(-1.5 * ${spacing});\n padding-block-start: calc(${spacing} + ${fontSizes[h4fontSize as FontSize]} * 1.35);\n `;\n});\n\nStyledFormProgress.defaultProps = defaultThemeProp;\n\nconst HorizontalFormProgress: FunctionComponent<FormProgressProps & ForwardProps> = ({\n steps,\n currentStepId,\n ...restProps\n}) => {\n const curIdx = steps.findIndex(step => step.id === currentStepId);\n const curStep = steps[curIdx];\n const fillScale = curIdx / (steps.length - 1);\n\n const [currentStepEl, setCurrentStepEl] = useElement();\n const [stepEls, setStepEls] = useState<Record<string, HTMLElement>>({});\n const theme = useTheme();\n\n let popoverPlacement: 'top' | 'top-start' | 'top-end' = 'top';\n if (curIdx === 0) popoverPlacement = 'top-start';\n else if (curIdx === steps.length - 1) popoverPlacement = 'top-end';\n\n useEffect(() => {\n setCurrentStepEl(stepEls[curStep.id]);\n }, [Object.keys(stepEls), curStep]);\n\n return (\n <StyledFormProgress\n {...restProps}\n container={{ alignItems: 'center' }}\n role='progressbar'\n aria-valuenow={curIdx}\n aria-valuemin={0}\n aria-valuetext={curStep.name}\n aria-valuemax={steps.length}\n >\n <CurrentStepPopover\n show\n target={currentStepEl}\n placement={popoverPlacement}\n strategy='absolute'\n hideOnTargetHidden\n modifiers={[\n {\n name: 'offset',\n options: {\n offset: [\n 0,\n tryCatch(\n () => stripUnit(remToPx(theme.base.spacing)),\n () => 8\n )\n ]\n }\n },\n {\n name: 'placeAndContain',\n enabled: false\n }\n ]}\n >\n <Text variant='h4'>{curStep.name}</Text>\n </CurrentStepPopover>\n <Flex container={{ justify: 'between', alignItems: 'center' }} item={{ grow: 1 }}>\n {steps.map((step, index) => {\n return (\n <StepMarker\n key={step.id}\n ref={(el: HTMLElement | null) => {\n setStepEls(curr => {\n const newEls = { ...curr };\n if (!el && newEls[step.id]) {\n delete newEls[step.id];\n return newEls;\n }\n if (el) return { ...newEls, [step.id]: el };\n return newEls;\n });\n }}\n aria-label={step.name}\n aria-describedby={step.id}\n current={index === curIdx}\n depth={step.depth}\n prior={index < curIdx}\n onClick={step.onMarkerClick}\n >\n {index !== curIdx && (\n <Tooltip\n target={stepEls[step.id]}\n showDelay='none'\n hideDelay='short'\n portal={false}\n >\n {step.name}\n </Tooltip>\n )}\n </StepMarker>\n );\n })}\n </Flex>\n\n <StyledBar>\n <StyledFill style={{ '--fillScale': fillScale } as CSSProperties} />\n </StyledBar>\n </StyledFormProgress>\n );\n};\n\nexport default HorizontalFormProgress;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"MultiStepForm.d.ts","sourceRoot":"","sources":["../../../src/components/MultiStepForm/MultiStepForm.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,iBAAiB,EAAsC,MAAM,OAAO,CAAC;AAI1F,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAU3C,OAAO,kBAAkB,MAAM,uBAAuB,CAAC;AAIvD,eAAO,MAAM,UAAU,0GAWrB,CAAC;AAEH,eAAO,MAAM,iBAAiB,yGAAe,CAAC;AAE9C,eAAO,MAAM,yBAAyB,iKAqBpC,CAAC;AAIH,eAAO,MAAM,aAAa,EAAE,iBAAiB,CAAC,kBAAkB,GAAG,YAAY,CA2H9E,CAAC;AAEF,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"MultiStepForm.d.ts","sourceRoot":"","sources":["../../../src/components/MultiStepForm/MultiStepForm.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,iBAAiB,EAAsC,MAAM,OAAO,CAAC;AAI1F,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAU3C,OAAO,kBAAkB,MAAM,uBAAuB,CAAC;AAIvD,eAAO,MAAM,UAAU,0GAWrB,CAAC;AAEH,eAAO,MAAM,iBAAiB,yGAAe,CAAC;AAE9C,eAAO,MAAM,yBAAyB,iKAqBpC,CAAC;AAIH,eAAO,MAAM,aAAa,EAAE,iBAAiB,CAAC,kBAAkB,GAAG,YAAY,CA4H9E,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -82,7 +82,7 @@ export const MultiStepForm = forwardRef(({ currentStepId, steps, heading, stepIn
82
82
  areaDef += ' "actions"';
83
83
  }
84
84
  return (_jsxs(Grid, { ref: ref, as: StyledForm, ...restProps, container: {
85
- cols: stepIndicator === 'vertical' ? `1fr ${contentWidth.sm}` : '1fr',
85
+ cols: stepIndicator === 'vertical' ? `2fr minmax(${contentWidth.xs}, 1fr)` : 'minmax(0, 1fr)',
86
86
  areas: areaDef,
87
87
  gap: 3
88
88
  }, "aria-labelledby": heading ? headingId : undefined, "aria-describedby": currentStep.description ? descriptionId : undefined, children: [(heading || steps.length > 1) && (_jsxs(_Fragment, { children: [heading && (_jsx(Grid, { item: { area: 'heading' }, children: _jsx(Text, { id: headingId, variant: 'h3', children: heading }) })), steps.length > 1 && (_jsxs(_Fragment, { children: [stepIndicator === 'horizontal' && (_jsx(Grid, { item: { area: 'stepIndicator' }, as: HorizontalFormProgress, steps: steps, currentStepId: currentStepId })), stepIndicator === 'vertical' && (_jsx(Grid, { item: { area: 'stepIndicator' }, as: VerticalFormProgress, steps: steps, currentStepId: currentStepId })), _jsx(VisuallyHiddenText, { "aria-live": 'polite', children: previousId !== undefined && previousId !== currentStepId
@@ -1 +1 @@
1
- {"version":3,"file":"MultiStepForm.js","sourceRoot":"","sources":["../../../src/components/MultiSt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CACtB,KAAC,IAAI,IAAC,IAAI,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,YAC7B,KAAC,IAAI,IAAC,SAAS,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,YAC1D,WAAW,CAAC,OAAO,GACf,GACF,CACR,IACI,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["import { forwardRef, FunctionComponent, PropsWithoutRef, useRef, useEffect } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { useUID, useI18n, usePrevious, useBreakpoint, useTheme } from '../../hooks';\nimport { ForwardProps } from '../../types';\nimport { getFocusables } from '../../utils';\nimport { calculateFontSize } from '../../styles';\nimport Flex from '../Flex';\nimport Text from '../Text';\nimport HTML from '../HTML';\nimport VisuallyHiddenText from '../VisuallyHiddenText';\nimport Grid from '../Grid';\nimport { defaultThemeProp } from '../../theme';\n\nimport MultiStepFormProps from './MultiStepForm.types';\nimport VerticalFormProgress from './VerticalFormProgress';\nimport HorizontalFormProgress from './HorizontalFormProgress';\n\nexport const StyledForm = styled.form(({ theme }) => {\n const {\n base: { spacing }\n } = theme;\n return css`\n height: 100%;\n width: 100%;\n flex-grow: 1;\n overflow-y: auto;\n padding: ${spacing};\n `;\n});\n\nexport const StyledFormContent = styled.div``;\n\nexport const StyledRequiredFieldLegend = styled(Text)(({ theme }) => {\n const {\n base: {\n 'font-size': fontSize,\n 'font-scale': fontScale,\n palette: { urgent }\n }\n } = theme;\n const { xxs: infoFontSize } = calculateFontSize(fontSize, fontScale);\n\n return css`\n font-size: ${infoFontSize};\n font-style: italic;\n\n &::before {\n display: 'inline';\n content: '\\\\00a0*';\n vertical-align: top;\n color: ${urgent};\n }\n `;\n});\n\nStyledRequiredFieldLegend.defaultProps = defaultThemeProp;\n\nexport const MultiStepForm: FunctionComponent<MultiStepFormProps & ForwardProps> = forwardRef(\n (\n {\n currentStepId,\n steps,\n heading,\n stepIndicator: stepIndicatorProp = steps.length < 2 ? 'none' : 'horizontal',\n ...restProps\n }: PropsWithoutRef<MultiStepFormProps>,\n ref: MultiStepFormProps['ref']\n ) => {\n const multiStepContentRef = useRef(null);\n const previousId = usePrevious(currentStepId);\n const currentStep = steps.find(step => step.id === currentStepId)!;\n const headingId = useUID();\n const descriptionId = useUID();\n const t = useI18n();\n const {\n base: { 'content-width': contentWidth }\n } = useTheme();\n\n useEffect(() => {\n if (previousId === undefined) return;\n\n if (previousId !== currentStepId) {\n const focusableElements = getFocusables(multiStepContentRef);\n\n if (focusableElements.length) focusableElements[0].focus();\n }\n }, [currentStepId, previousId]);\n\n const isSmallOrAbove = useBreakpoint('sm');\n\n const stepIndicator =\n stepIndicatorProp === 'vertical' && !isSmallOrAbove ? 'horizontal' : stepIndicatorProp;\n\n let areaDef = '';\n switch (stepIndicator) {\n case 'horizontal':\n if (heading) areaDef += '\"heading\" ';\n areaDef += '\"stepIndicator\" \"content\"';\n if (currentStep.actions) areaDef += ' \"actions\"';\n break;\n case 'vertical':\n if (heading) areaDef += '\"heading stepIndicator\" ';\n areaDef += '\"content stepIndicator\"';\n if (currentStep.actions) areaDef += ' \"actions actions\"';\n break;\n default:\n if (heading) areaDef += '\"heading\" ';\n areaDef += '\"content\"';\n if (currentStep.actions) areaDef += ' \"actions\"';\n }\n\n return (\n <Grid\n ref={ref}\n as={StyledForm}\n {...restProps}\n container={{\n cols: stepIndicator === 'vertical' ? `1fr ${contentWidth.sm}` : '1fr',\n areas: areaDef,\n gap: 3\n }}\n aria-labelledby={heading ? headingId : undefined}\n aria-describedby={currentStep.description ? descriptionId : undefined}\n >\n {(heading || steps.length > 1) && (\n <>\n {heading && (\n <Grid item={{ area: 'heading' }}>\n <Text id={headingId} variant='h3'>\n {heading}\n </Text>\n </Grid>\n )}\n {steps.length > 1 && (\n <>\n {stepIndicator === 'horizontal' && (\n <Grid\n item={{ area: 'stepIndicator' }}\n as={HorizontalFormProgress}\n steps={steps}\n currentStepId={currentStepId}\n />\n )}\n {stepIndicator === 'vertical' && (\n <Grid\n item={{ area: 'stepIndicator' }}\n as={VerticalFormProgress}\n steps={steps}\n currentStepId={currentStepId}\n />\n )}\n <VisuallyHiddenText aria-live='polite'>\n {previousId !== undefined && previousId !== currentStepId\n ? t('step_changed_to_name', [currentStep.name])\n : ''}\n </VisuallyHiddenText>\n </>\n )}\n </>\n )}\n\n <Grid item={{ area: 'content' }} container={{ gap: 3 }}>\n {currentStep.banners}\n\n {currentStep.description && (\n <HTML id={descriptionId} as='p' content={currentStep.description} />\n )}\n\n <StyledFormContent ref={multiStepContentRef}>{currentStep.content}</StyledFormContent>\n </Grid>\n {currentStep.actions && (\n <Grid item={{ area: 'actions' }}>\n <Flex container={{ justify: 'between', alignItems: 'center' }}>\n {currentStep.actions}\n </Flex>\n </Grid>\n )}\n </Grid>\n );\n }\n);\n\nexport default MultiStepForm;\n"]}
1
+ {"version":3,"file":"MultiStepForm.js","sourceRoot":"","sources":["../../../src/components/MultiStepForm/MultiStepForm.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAsC,MAAM,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC1F,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEpF,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,kBAAkB,MAAM,uBAAuB,CAAC;AACvD,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAG/C,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H,EACD,KAAC,kBAAkB,iBAAW,QAAQ,YACnC,UAAU,KAAK,SAAS,IAAI,UAAU,KAAK,aAAa;oCACvD,CAAC,CAAC,CAAC,CAAC,sBAAsB,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;oCAC/C,CAAC,CAAC,EAAE,GACa,IACpB,CACJ,IACA,CACJ,EAED,MAAC,IAAI,IAAC,IAAI,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,SAAS,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,aACnD,WAAW,CAAC,OAAO,EAEnB,WAAW,CAAC,WAAW,IAAI,CAC1B,KAAC,IAAI,IAAC,EAAE,EAAE,aAAa,EAAE,EAAE,EAAC,GAAG,EAAC,OAAO,EAAE,WAAW,CAAC,WAAW,GAAI,CACrE,EAED,KAAC,iBAAiB,IAAC,GAAG,EAAE,mBAAmB,YAAG,WAAW,CAAC,OAAO,GAAqB,IACjF,EACN,WAAW,CAAC,OAAO,IAAI,CACtB,KAAC,IAAI,IAAC,IAAI,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,YAC7B,KAAC,IAAI,IAAC,SAAS,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,YAC1D,WAAW,CAAC,OAAO,GACf,GACF,CACR,IACI,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["import { forwardRef, FunctionComponent, PropsWithoutRef, useRef, useEffect } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { useUID, useI18n, usePrevious, useBreakpoint, useTheme } from '../../hooks';\nimport { ForwardProps } from '../../types';\nimport { getFocusables } from '../../utils';\nimport { calculateFontSize } from '../../styles';\nimport Flex from '../Flex';\nimport Text from '../Text';\nimport HTML from '../HTML';\nimport VisuallyHiddenText from '../VisuallyHiddenText';\nimport Grid from '../Grid';\nimport { defaultThemeProp } from '../../theme';\n\nimport MultiStepFormProps from './MultiStepForm.types';\nimport VerticalFormProgress from './VerticalFormProgress';\nimport HorizontalFormProgress from './HorizontalFormProgress';\n\nexport const StyledForm = styled.form(({ theme }) => {\n const {\n base: { spacing }\n } = theme;\n return css`\n height: 100%;\n width: 100%;\n flex-grow: 1;\n overflow-y: auto;\n padding: ${spacing};\n `;\n});\n\nexport const StyledFormContent = styled.div``;\n\nexport const StyledRequiredFieldLegend = styled(Text)(({ theme }) => {\n const {\n base: {\n 'font-size': fontSize,\n 'font-scale': fontScale,\n palette: { urgent }\n }\n } = theme;\n const { xxs: infoFontSize } = calculateFontSize(fontSize, fontScale);\n\n return css`\n font-size: ${infoFontSize};\n font-style: italic;\n\n &::before {\n display: 'inline';\n content: '\\\\00a0*';\n vertical-align: top;\n color: ${urgent};\n }\n `;\n});\n\nStyledRequiredFieldLegend.defaultProps = defaultThemeProp;\n\nexport const MultiStepForm: FunctionComponent<MultiStepFormProps & ForwardProps> = forwardRef(\n (\n {\n currentStepId,\n steps,\n heading,\n stepIndicator: stepIndicatorProp = steps.length < 2 ? 'none' : 'horizontal',\n ...restProps\n }: PropsWithoutRef<MultiStepFormProps>,\n ref: MultiStepFormProps['ref']\n ) => {\n const multiStepContentRef = useRef(null);\n const previousId = usePrevious(currentStepId);\n const currentStep = steps.find(step => step.id === currentStepId)!;\n const headingId = useUID();\n const descriptionId = useUID();\n const t = useI18n();\n const {\n base: { 'content-width': contentWidth }\n } = useTheme();\n\n useEffect(() => {\n if (previousId === undefined) return;\n\n if (previousId !== currentStepId) {\n const focusableElements = getFocusables(multiStepContentRef);\n\n if (focusableElements.length) focusableElements[0].focus();\n }\n }, [currentStepId, previousId]);\n\n const isSmallOrAbove = useBreakpoint('sm');\n\n const stepIndicator =\n stepIndicatorProp === 'vertical' && !isSmallOrAbove ? 'horizontal' : stepIndicatorProp;\n\n let areaDef = '';\n switch (stepIndicator) {\n case 'horizontal':\n if (heading) areaDef += '\"heading\" ';\n areaDef += '\"stepIndicator\" \"content\"';\n if (currentStep.actions) areaDef += ' \"actions\"';\n break;\n case 'vertical':\n if (heading) areaDef += '\"heading stepIndicator\" ';\n areaDef += '\"content stepIndicator\"';\n if (currentStep.actions) areaDef += ' \"actions actions\"';\n break;\n default:\n if (heading) areaDef += '\"heading\" ';\n areaDef += '\"content\"';\n if (currentStep.actions) areaDef += ' \"actions\"';\n }\n\n return (\n <Grid\n ref={ref}\n as={StyledForm}\n {...restProps}\n container={{\n cols:\n stepIndicator === 'vertical' ? `2fr minmax(${contentWidth.xs}, 1fr)` : 'minmax(0, 1fr)',\n areas: areaDef,\n gap: 3\n }}\n aria-labelledby={heading ? headingId : undefined}\n aria-describedby={currentStep.description ? descriptionId : undefined}\n >\n {(heading || steps.length > 1) && (\n <>\n {heading && (\n <Grid item={{ area: 'heading' }}>\n <Text id={headingId} variant='h3'>\n {heading}\n </Text>\n </Grid>\n )}\n {steps.length > 1 && (\n <>\n {stepIndicator === 'horizontal' && (\n <Grid\n item={{ area: 'stepIndicator' }}\n as={HorizontalFormProgress}\n steps={steps}\n currentStepId={currentStepId}\n />\n )}\n {stepIndicator === 'vertical' && (\n <Grid\n item={{ area: 'stepIndicator' }}\n as={VerticalFormProgress}\n steps={steps}\n currentStepId={currentStepId}\n />\n )}\n <VisuallyHiddenText aria-live='polite'>\n {previousId !== undefined && previousId !== currentStepId\n ? t('step_changed_to_name', [currentStep.name])\n : ''}\n </VisuallyHiddenText>\n </>\n )}\n </>\n )}\n\n <Grid item={{ area: 'content' }} container={{ gap: 3 }}>\n {currentStep.banners}\n\n {currentStep.description && (\n <HTML id={descriptionId} as='p' content={currentStep.description} />\n )}\n\n <StyledFormContent ref={multiStepContentRef}>{currentStep.content}</StyledFormContent>\n </Grid>\n {currentStep.actions && (\n <Grid item={{ area: 'actions' }}>\n <Flex container={{ justify: 'between', alignItems: 'center' }}>\n {currentStep.actions}\n </Flex>\n </Grid>\n )}\n </Grid>\n );\n }\n);\n\nexport default MultiStepForm;\n"]}
@@ -42,7 +42,7 @@ export default interface MultiStepFormProps {
42
42
  steps: Step[];
43
43
  /**
44
44
  * MultiStepForm step indicator.
45
- * @default "horizontal"
45
+ * @default 'horizontal'
46
46
  */
47
47
  stepIndicator?: 'horizontal' | 'vertical' | 'none';
48
48
  /** The heading of the form. */
@@ -1 +1 @@
1
- {"version":3,"file":"MultiStepForm.types.js","sourceRoot":"","sources":["../../../src/components/MultiStepForm/MultiStepForm.types.ts"],"names":[],"mappings":"","sourcesContent":["import { ReactNode, Ref, MouseEventHandler } from 'react';\n\nimport { BaseProps } from '../../types';\n\nexport interface BaseFormProps extends BaseProps {\n /** Primary content area. */\n content: ReactNode;\n /** Region for Form Actions. */\n actions?: ReactNode;\n /** Region for Banners above the Form. */\n banners?: ReactNode;\n /** A description of the form to be displayed above the controls. */\n description?: string;\n /** The heading of the form. */\n heading?: string;\n /** Ref forwarded to the form element. */\n ref?: Ref<HTMLFormElement>;\n}\n\nexport interface Step {\n /** The id that is referenced by the Multi Step currentStepId prop. */\n id: string;\n /** The displayed name of the step. */\n name: string;\n /** A set of Action Buttons to render for the step. */\n actions?: BaseFormProps['actions'];\n /** Banners to render for the step */\n banners?: BaseFormProps['banners'];\n /** Content to render for the step. */\n content?: BaseFormProps['content'];\n /**\n * Determines the size of the step indicator. Depth 0 is larger than depth 1.\n * @default 0\n */\n depth?: 0 | 1;\n /** A description of the form to be displayed above the controls. */\n description?: BaseFormProps['description'];\n /** Callback function that is called when a step marker is clicked. */\n onMarkerClick?: MouseEventHandler;\n}\n\nexport default interface MultiStepFormProps {\n /** Sets the current step. */\n currentStepId: string;\n /** Flat array of objects describing each step. */\n steps: Step[];\n /**\n * MultiStepForm step indicator.\n * @default \"horizontal\"\n */\n stepIndicator?: 'horizontal' | 'vertical' | 'none';\n /** The heading of the form. */\n heading?: BaseFormProps['heading'];\n /** Ref forwarded to the form element. */\n ref?: BaseFormProps['ref'];\n}\n"]}
1
+ {"version":3,"file":"MultiStepForm.types.js","sourceRoot":"","sources":["../../../src/components/MultiStepForm/MultiStepForm.types.ts"],"names":[],"mappings":"","sourcesContent":["import { ReactNode, Ref, MouseEventHandler } from 'react';\n\nimport { BaseProps } from '../../types';\n\nexport interface BaseFormProps extends BaseProps {\n /** Primary content area. */\n content: ReactNode;\n /** Region for Form Actions. */\n actions?: ReactNode;\n /** Region for Banners above the Form. */\n banners?: ReactNode;\n /** A description of the form to be displayed above the controls. */\n description?: string;\n /** The heading of the form. */\n heading?: string;\n /** Ref forwarded to the form element. */\n ref?: Ref<HTMLFormElement>;\n}\n\nexport interface Step {\n /** The id that is referenced by the Multi Step currentStepId prop. */\n id: string;\n /** The displayed name of the step. */\n name: string;\n /** A set of Action Buttons to render for the step. */\n actions?: BaseFormProps['actions'];\n /** Banners to render for the step */\n banners?: BaseFormProps['banners'];\n /** Content to render for the step. */\n content?: BaseFormProps['content'];\n /**\n * Determines the size of the step indicator. Depth 0 is larger than depth 1.\n * @default 0\n */\n depth?: 0 | 1;\n /** A description of the form to be displayed above the controls. */\n description?: BaseFormProps['description'];\n /** Callback function that is called when a step marker is clicked. */\n onMarkerClick?: MouseEventHandler;\n}\n\nexport default interface MultiStepFormProps {\n /** Sets the current step. */\n currentStepId: string;\n /** Flat array of objects describing each step. */\n steps: Step[];\n /**\n * MultiStepForm step indicator.\n * @default 'horizontal'\n */\n stepIndicator?: 'horizontal' | 'vertical' | 'none';\n /** The heading of the form. */\n heading?: BaseFormProps['heading'];\n /** Ref forwarded to the form element. */\n ref?: BaseFormProps['ref'];\n}\n"]}
@@ -7,7 +7,7 @@ export interface PhoneDisplayProps extends BaseProps, NoChildrenProp {
7
7
  displayText?: string;
8
8
  /**
9
9
  * Controls styling of the field.
10
- * @default "link"
10
+ * @default 'link'
11
11
  */
12
12
  variant?: 'link' | 'text';
13
13
  /** Options to define formatting. */
@@ -1 +1 @@
1
- {"version":3,"file":"PhoneDisplay.js","sourceRoot":"","sources":["../../../src/components/Phone/PhoneDisplay.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAA2C,MAAM,OAAO,CAAC;AAG5E,OAAO,IAAI,MAAM,SAAS,CAAC;AAE3B,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAwBtC,MAAM,YAAY,GAAwD,UAAU,CAClF,CACE,EACE,KAAK,EACL,WAAW,EACX,OAAO,GAAG,MAAM,EAChB,iBAAiB,EAAE,EAAE,eAAe,GAAG,IAAI,EAAE,GAAG,EAAE,EAClD,GAAG,SAAS,EACuB,EACrC,GAA6B,EAC7B,EAAE;IACF,MAAM,YAAY,GAAG,KAAK,CAAC,CAAC,CAAC,CAC3B,WAAW,IAAI,WAAW,CAAC,KAAK,IAAI,EAAE,EAAE,EAAE,cAAc,EAAE,CAAC,eAAe,EAAE,CAAC,IAAI,KAAK,CACvF,CAAC,CAAC,CAAC,CACF,8BAAkB,MAAM,6BAAsB,CAC/C,CAAC;IAEF,OAAO,OAAO,KAAK,MAAM,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CACpC,eAAM,GAAG,EAAE,GAA2B,KAAM,SAAS,YAClD,YAAY,GACR,CACR,CAAC,CAAC,CAAC,CACF,KAAC,IAAI,IAAC,GAAG,EAAE,GAA6B,KAAM,SAAS,EAAE,IAAI,EAAE,OAAO,KAAK,EAAE,YAC1E,YAAY,GACR,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,YAAY,CAAC","sourcesContent":["import { forwardRef, FunctionComponent, PropsWithoutRef, Ref } from 'react';\n\nimport type { BaseProps, ForwardProps, NoChildrenProp } from '../../types';\nimport Link from '../Link';\n\nimport { formatPhone } from './utils';\n\nexport interface PhoneDisplayProps extends BaseProps, NoChildrenProp {\n /** Phone number, no 'tel:' scheme, '+18887342669' */\n value?: string;\n /** The text to be displayed. */\n displayText?: string;\n /**\n * Controls styling of the field.\n * @default \"link\"\n */\n variant?: 'link' | 'text';\n /** Options to define formatting. */\n formattingOptions?: {\n /**\n * Display phone number with country calling code\n * @default true\n */\n showCountryCode?: boolean;\n };\n /** Ref for the wrapping element. */\n ref?: Ref<HTMLAnchorElement | HTMLSpanElement>;\n}\n\nconst PhoneDisplay: FunctionComponent<PhoneDisplayProps & ForwardProps> = forwardRef(\n (\n {\n value,\n displayText,\n variant = 'link',\n formattingOptions: { showCountryCode = true } = {},\n ...restProps\n }: PropsWithoutRef<PhoneDisplayProps>,\n ref: PhoneDisplayProps['ref']\n ) => {\n const displayValue = value ? (\n displayText || formatPhone(value || '', { nationalFormat: !showCountryCode }) || value\n ) : (\n <span aria-hidden='true'>&ndash;&ndash;</span>\n );\n\n return variant === 'text' || !value ? (\n <span ref={ref as Ref<HTMLSpanElement>} {...restProps}>\n {displayValue}\n </span>\n ) : (\n <Link ref={ref as Ref<HTMLAnchorElement>} {...restProps} href={`tel:${value}`}>\n {displayValue}\n </Link>\n );\n }\n);\n\nexport default PhoneDisplay;\n"]}
1
+ {"version":3,"file":"PhoneDisplay.js","sourceRoot":"","sources":["../../../src/components/Phone/PhoneDisplay.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAA2C,MAAM,OAAO,CAAC;AAG5E,OAAO,IAAI,MAAM,SAAS,CAAC;AAE3B,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAwBtC,MAAM,YAAY,GAAwD,UAAU,CAClF,CACE,EACE,KAAK,EACL,WAAW,EACX,OAAO,GAAG,MAAM,EAChB,iBAAiB,EAAE,EAAE,eAAe,GAAG,IAAI,EAAE,GAAG,EAAE,EAClD,GAAG,SAAS,EACuB,EACrC,GAA6B,EAC7B,EAAE;IACF,MAAM,YAAY,GAAG,KAAK,CAAC,CAAC,CAAC,CAC3B,WAAW,IAAI,WAAW,CAAC,KAAK,IAAI,EAAE,EAAE,EAAE,cAAc,EAAE,CAAC,eAAe,EAAE,CAAC,IAAI,KAAK,CACvF,CAAC,CAAC,CAAC,CACF,8BAAkB,MAAM,6BAAsB,CAC/C,CAAC;IAEF,OAAO,OAAO,KAAK,MAAM,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CACpC,eAAM,GAAG,EAAE,GAA2B,KAAM,SAAS,YAClD,YAAY,GACR,CACR,CAAC,CAAC,CAAC,CACF,KAAC,IAAI,IAAC,GAAG,EAAE,GAA6B,KAAM,SAAS,EAAE,IAAI,EAAE,OAAO,KAAK,EAAE,YAC1E,YAAY,GACR,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,YAAY,CAAC","sourcesContent":["import { forwardRef, FunctionComponent, PropsWithoutRef, Ref } from 'react';\n\nimport type { BaseProps, ForwardProps, NoChildrenProp } from '../../types';\nimport Link from '../Link';\n\nimport { formatPhone } from './utils';\n\nexport interface PhoneDisplayProps extends BaseProps, NoChildrenProp {\n /** Phone number, no 'tel:' scheme, '+18887342669' */\n value?: string;\n /** The text to be displayed. */\n displayText?: string;\n /**\n * Controls styling of the field.\n * @default 'link'\n */\n variant?: 'link' | 'text';\n /** Options to define formatting. */\n formattingOptions?: {\n /**\n * Display phone number with country calling code\n * @default true\n */\n showCountryCode?: boolean;\n };\n /** Ref for the wrapping element. */\n ref?: Ref<HTMLAnchorElement | HTMLSpanElement>;\n}\n\nconst PhoneDisplay: FunctionComponent<PhoneDisplayProps & ForwardProps> = forwardRef(\n (\n {\n value,\n displayText,\n variant = 'link',\n formattingOptions: { showCountryCode = true } = {},\n ...restProps\n }: PropsWithoutRef<PhoneDisplayProps>,\n ref: PhoneDisplayProps['ref']\n ) => {\n const displayValue = value ? (\n displayText || formatPhone(value || '', { nationalFormat: !showCountryCode }) || value\n ) : (\n <span aria-hidden='true'>&ndash;&ndash;</span>\n );\n\n return variant === 'text' || !value ? (\n <span ref={ref as Ref<HTMLSpanElement>} {...restProps}>\n {displayValue}\n </span>\n ) : (\n <Link ref={ref as Ref<HTMLAnchorElement>} {...restProps} href={`tel:${value}`}>\n {displayValue}\n </Link>\n );\n }\n);\n\nexport default PhoneDisplay;\n"]}
@@ -19,22 +19,22 @@ export interface PopoverProps<Modifiers extends string = string> extends BasePro
19
19
  portal?: boolean | ConfigurationProps['portalTarget'];
20
20
  /**
21
21
  * Delay on showing the Popover.
22
- * @default "none"
22
+ * @default 'none'
23
23
  */
24
24
  showDelay?: Delay;
25
25
  /**
26
26
  * Delay on hiding the Popover.
27
- * @default "none"
27
+ * @default 'none'
28
28
  */
29
29
  hideDelay?: Delay;
30
30
  /**
31
31
  * [React Popper Placement](https://popper.js.org/react-popper/v2/render-props/#placement)
32
- * @default "bottom"
32
+ * @default 'bottom'
33
33
  */
34
34
  placement?: PopperProps<Modifiers>['placement'];
35
35
  /**
36
36
  * [React Popper Strategy](https://popper.js.org/react-popper/v2/render-props/#strategy)
37
- * @default "absolute"
37
+ * @default 'absolute'
38
38
  */
39
39
  strategy?: PopperProps<Modifiers>['strategy'];
40
40
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"Popover.d.ts","sourceRoot":"","sources":["../../../src/components/Popover/Popover.tsx"],"names":[],"mappings":"AAAA,OAAO,EAIL,GAAG,EAEH,YAAY,EAEZ,SAAS,EAIV,MAAM,OAAO,CAAC;AAEf,OAAO,EAAa,WAAW,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAGhD,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAStD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAMtD,MAAM,MAAM,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;AAC9C,MAAM,WAAW,YAAY,CAAC,SAAS,SAAS,MAAM,GAAG,MAAM,CAAE,SAAQ,SAAS;IAChF,2IAA2I;IAC3I,MAAM,EAAE,OAAO,GAAG,cAAc,GAAG,IAAI,CAAC;IACxC;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,GAAG,kBAAkB,CAAC,cAAc,CAAC,CAAC;IACtD;;;OAGG;IACH,SAAS,CAAC,EAAE,KA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= '
18
18
  const [, setPopperEl] = useElement();
19
19
  const popperRef = useConsolidatedRef(ref, setPopperEl);
20
20
  const arrowRef = useRef(null);
21
+ const forceUpdateRef = useRef();
21
22
  const [showPopover, setShowPopover] = useState(show);
22
23
  const timeout = useRef();
23
24
  const uid = useUID();
@@ -64,11 +65,25 @@ const Popover = forwardRef(({ show = true, portal = false, target, placement = '
64
65
  ? offsetModifier?.options?.offset[1] ?? 0
65
66
  : 0;
66
67
  }, [memoedModifiers]);
67
- const { styles, attributes } = usePopper(target, popperRef.current, {
68
+ const { styles, attributes, forceUpdate } = usePopper(target, popperRef.current, {
68
69
  placement,
69
70
  strategy,
70
71
  modifiers: memoedModifiers
71
72
  });
73
+ if (forceUpdate)
74
+ forceUpdateRef.current = forceUpdate;
75
+ useEffect(() => {
76
+ const observer = new ResizeObserver(() => {
77
+ forceUpdateRef.current?.();
78
+ });
79
+ if (popperRef.current)
80
+ observer.observe(popperRef.current);
81
+ if (target instanceof Element)
82
+ observer.observe(target);
83
+ return () => {
84
+ observer.disconnect();
85
+ };
86
+ }, [forceUpdate, popperRef.current, target]);
72
87
  useEffect(() => {
73
88
  if (groupId && show)
74
89
  setActive(uid, groupId);