@openedx/paragon 21.11.4 → 21.12.1

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 (103) hide show
  1. package/dist/Container/index.js +6 -2
  2. package/dist/Container/index.js.map +1 -1
  3. package/dist/DataTable/index.js +1 -0
  4. package/dist/DataTable/index.js.map +1 -1
  5. package/dist/DataTable/selection/BaseSelectionStatus.js +3 -2
  6. package/dist/DataTable/selection/BaseSelectionStatus.js.map +1 -1
  7. package/dist/Dropdown/index.js.map +1 -1
  8. package/dist/Form/FormSwitch.js +3 -0
  9. package/dist/Form/FormSwitch.js.map +1 -1
  10. package/dist/Hyperlink/index.js +7 -6
  11. package/dist/Hyperlink/index.js.map +1 -1
  12. package/dist/Icon/index.js +17 -10
  13. package/dist/Icon/index.js.map +1 -1
  14. package/dist/IconButton/index.js +1 -1
  15. package/dist/IconButton/index.js.map +1 -1
  16. package/dist/Layout/index.js.map +1 -1
  17. package/dist/Modal/ModalDialog.js +3 -0
  18. package/dist/Modal/ModalDialog.js.map +1 -1
  19. package/dist/Modal/index.js +11 -6
  20. package/dist/Modal/index.js.map +1 -1
  21. package/dist/Popover/index.js +8 -8
  22. package/dist/Popover/index.js.map +1 -1
  23. package/dist/ProductTour/Checkpoint.js +10 -8
  24. package/dist/ProductTour/Checkpoint.js.map +1 -1
  25. package/dist/ProductTour/messages.js +16 -0
  26. package/dist/SearchField/SearchFieldAdvanced.js +12 -7
  27. package/dist/SearchField/SearchFieldAdvanced.js.map +1 -1
  28. package/dist/SearchField/SearchFieldLabel.js +3 -3
  29. package/dist/SearchField/SearchFieldLabel.js.map +1 -1
  30. package/dist/SearchField/index.js +0 -1
  31. package/dist/SearchField/index.js.map +1 -1
  32. package/dist/Tabs/index.js +13 -13
  33. package/dist/Tabs/index.js.map +1 -1
  34. package/dist/hooks/useIndexOfLastVisibleChild.js +33 -38
  35. package/dist/hooks/useIndexOfLastVisibleChild.js.map +1 -1
  36. package/dist/i18n/messages/ar.json +2 -1
  37. package/dist/i18n/messages/ca.json +2 -1
  38. package/dist/i18n/messages/es_419.json +2 -1
  39. package/dist/i18n/messages/es_AR.json +2 -1
  40. package/dist/i18n/messages/es_ES.json +2 -1
  41. package/dist/i18n/messages/fr.json +2 -1
  42. package/dist/i18n/messages/he.json +2 -1
  43. package/dist/i18n/messages/id.json +2 -1
  44. package/dist/i18n/messages/it_IT.json +2 -1
  45. package/dist/i18n/messages/ko_KR.json +2 -1
  46. package/dist/i18n/messages/pl.json +2 -1
  47. package/dist/i18n/messages/pt_BR.json +2 -1
  48. package/dist/i18n/messages/pt_PT.json +2 -1
  49. package/dist/i18n/messages/ru.json +2 -1
  50. package/dist/i18n/messages/th.json +2 -1
  51. package/dist/i18n/messages/tr_TR.json +2 -1
  52. package/dist/i18n/messages/uk.json +2 -1
  53. package/dist/i18n/messages/zh_CN.json +2 -1
  54. package/icons/es5/RightSidebarFilled.js +15 -0
  55. package/icons/es5/RightSidebarOutlined.js +15 -0
  56. package/icons/es5/index.js +2 -0
  57. package/icons/jsx/RightSidebarFilled.jsx +19 -0
  58. package/icons/jsx/RightSidebarOutlined.jsx +19 -0
  59. package/icons/jsx/index.jsx +2 -0
  60. package/icons/svg/right_sidebar_filled.svg +3 -0
  61. package/icons/svg/right_sidebar_outlined.svg +3 -0
  62. package/package.json +1 -1
  63. package/src/Container/index.jsx +4 -0
  64. package/src/DataTable/index.jsx +1 -0
  65. package/src/DataTable/selection/BaseSelectionStatus.jsx +2 -2
  66. package/src/DataTable/tests/DataTable.test.jsx +31 -0
  67. package/src/Dropdown/index.jsx +4 -0
  68. package/src/Form/FormSwitch.jsx +3 -0
  69. package/src/Hyperlink/index.jsx +7 -6
  70. package/src/Icon/index.jsx +17 -10
  71. package/src/IconButton/index.jsx +1 -1
  72. package/src/Layout/index.jsx +1 -4
  73. package/src/Modal/ModalDialog.jsx +3 -0
  74. package/src/Modal/index.jsx +11 -6
  75. package/src/Popover/README.md +0 -1
  76. package/src/Popover/index.jsx +11 -11
  77. package/src/ProductTour/Checkpoint.jsx +9 -6
  78. package/src/ProductTour/messages.js +16 -0
  79. package/src/SearchField/SearchFieldAdvanced.jsx +12 -7
  80. package/src/SearchField/SearchFieldLabel.jsx +3 -3
  81. package/src/SearchField/index.jsx +0 -1
  82. package/src/Tabs/index.jsx +19 -13
  83. package/src/hooks/tests/useIndexOfLastVisibleChild.test.jsx +3 -3
  84. package/src/hooks/useIndexOfLastVisibleChild.jsx +36 -38
  85. package/src/hooks/useIndexOfLastVisibleChild.mdx +3 -3
  86. package/src/i18n/messages/ar.json +2 -1
  87. package/src/i18n/messages/ca.json +2 -1
  88. package/src/i18n/messages/es_419.json +2 -1
  89. package/src/i18n/messages/es_AR.json +2 -1
  90. package/src/i18n/messages/es_ES.json +2 -1
  91. package/src/i18n/messages/fr.json +2 -1
  92. package/src/i18n/messages/he.json +2 -1
  93. package/src/i18n/messages/id.json +2 -1
  94. package/src/i18n/messages/it_IT.json +2 -1
  95. package/src/i18n/messages/ko_KR.json +2 -1
  96. package/src/i18n/messages/pl.json +2 -1
  97. package/src/i18n/messages/pt_BR.json +2 -1
  98. package/src/i18n/messages/pt_PT.json +2 -1
  99. package/src/i18n/messages/ru.json +2 -1
  100. package/src/i18n/messages/th.json +2 -1
  101. package/src/i18n/messages/tr_TR.json +2 -1
  102. package/src/i18n/messages/uk.json +2 -1
  103. package/src/i18n/messages/zh_CN.json +2 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["React","PropTypes","classNames","FontAwesomeIcon","OverlayTrigger","Tooltip","IconButton","forwardRef","_ref","ref","className","alt","invertColors","icon","src","iconClassNames","onClick","size","variant","iconAs","isActive","attrs","_objectWithoutProperties","_excluded","invert","activeStyle","process","env","NODE_ENV","console","msg","warn","IconComponent","createElement","_extends","type","defaultProps","undefined","propTypes","string","elementType","oneOfType","element","func","isRequired","bool","shape","prefix","iconName","array","oneOf","IconButtonWithTooltip","_ref2","tooltipPlacement","tooltipContent","props","_excluded2","placement","overlay","id","node"],"sources":["../../src/IconButton/index.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\n\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { OverlayTrigger } from '../Overlay';\nimport Tooltip from '../Tooltip';\n\nconst IconButton = React.forwardRef(({\n className,\n alt,\n invertColors,\n icon,\n src,\n iconClassNames,\n onClick,\n size,\n variant,\n iconAs,\n isActive,\n ...attrs\n}, ref) => {\n const invert = invertColors ? 'inverse-' : '';\n const activeStyle = isActive ? `${variant}-` : '';\n if (!iconAs && process.env.NODE_ENV === 'development' && console) {\n const msg = '[Deprecated] IconButton: you have not provided a value for iconAs prop and '\n + 'are using a default one - FontAwesomeIcon, the default value is going to be changed soon '\n + 'as Paragon is moving away from FontAwesome, please use Paragon\\'s icons instead.';\n // eslint-disable-next-line no-console\n console.warn(msg);\n }\n const IconComponent = iconAs || FontAwesomeIcon;\n return (\n <button\n aria-label={alt}\n className={classNames(\n 'btn-icon',\n `btn-icon-${invert}${variant}`,\n `btn-icon-${size}`,\n {\n [`btn-icon-${invert}${activeStyle}active`]: isActive,\n },\n className,\n )}\n onClick={onClick}\n type=\"button\"\n ref={ref}\n {...attrs}\n >\n <span className=\"btn-icon__icon-container\">\n <IconComponent\n className={classNames('btn-icon__icon', iconClassNames)}\n icon={icon}\n src={src}\n />\n </span>\n </button>\n );\n});\n\nIconButton.defaultProps = {\n iconAs: undefined,\n src: null,\n icon: undefined,\n iconClassNames: undefined,\n className: undefined,\n invertColors: false,\n variant: 'primary',\n size: 'md',\n onClick: () => {},\n isActive: false,\n};\n\nIconButton.propTypes = {\n /** A custom class name. */\n className: PropTypes.string,\n /** Component that renders the icon, currently defaults to `FontAwesomeIcon`,\n * but is going to be deprecated soon, please use Paragon's icons instead. */\n iconAs: PropTypes.elementType,\n /** An icon component to render. Example import of a Paragon icon component:\n * `import { Check } from '@edx/paragon/dist/icon';`\n * */\n src: PropTypes.oneOfType([PropTypes.element, PropTypes.func]),\n /** Alt text for your icon. For best practice, avoid using alt text to describe\n * the image in the `IconButton`. Instead, we recommend describing the function\n * of the button. */\n alt: PropTypes.string.isRequired,\n /** Changes icon styles for dark background */\n invertColors: PropTypes.bool,\n /** Accepts a React fontawesome icon. https://fontawesome.com/how-to-use/on-the-web/using-with/react */\n icon: PropTypes.shape({\n prefix: PropTypes.string,\n iconName: PropTypes.string,\n // eslint-disable-next-line react/forbid-prop-types\n icon: PropTypes.array,\n }),\n /** Extra class names that will be added to the icon */\n iconClassNames: PropTypes.string,\n /** Click handler for the button */\n onClick: PropTypes.func,\n /** Type of button (uses Bootstrap options) */\n variant: PropTypes.oneOf(['primary', 'secondary', 'success', 'warning', 'danger', 'light', 'dark', 'black', 'brand']),\n /** size of button to render */\n size: PropTypes.oneOf(['sm', 'md', 'inline']),\n /** whether to show the `IconButton` in an active state, whose styling is distinct from default state */\n isActive: PropTypes.bool,\n};\n\n/**\n *\n * @param { object } args Arguments\n * @param { string } args.tooltipPlacement choose from https://popper.js.org/docs/v2/constructors/#options\n * @param { React.Component } args.tooltipContent any content to pass to tooltip content area\n * @returns { IconButton } a button wrapped in overlaytrigger\n */\nfunction IconButtonWithTooltip({\n tooltipPlacement, tooltipContent, variant, invertColors, ...props\n}) {\n const invert = invertColors ? 'inverse-' : '';\n return (\n <OverlayTrigger\n placement={tooltipPlacement}\n overlay={(\n <Tooltip\n id={`iconbutton-tooltip-${tooltipPlacement}`}\n variant={invert ? 'light' : ''}\n >\n {tooltipContent}\n </Tooltip>\n )}\n >\n <IconButton variant={variant} invertColors={invertColors} {...props} />\n </OverlayTrigger>\n );\n}\n\nIconButtonWithTooltip.defaultProps = {\n tooltipPlacement: 'top',\n variant: 'primary',\n invertColors: false,\n};\n\nIconButtonWithTooltip.propTypes = {\n /** tooltip placement can be top, left, right etc, per https://popper.js.org/docs/v2/constructors/#options */\n tooltipPlacement: PropTypes.string,\n /** any valid JSX or text to be rendered as tooltip contents */\n tooltipContent: PropTypes.node.isRequired,\n /** Type of button (uses Bootstrap options) */\n variant: PropTypes.oneOf(['primary', 'secondary', 'success', 'warning', 'danger', 'light', 'dark', 'black', 'brand']),\n /** Changes icon styles for dark background */\n invertColors: PropTypes.bool,\n};\n\nIconButton.IconButtonWithTooltip = IconButtonWithTooltip;\n\nexport default IconButton;\nexport { IconButtonWithTooltip };\n"],"mappings":";;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,UAAU,MAAM,YAAY;AAEnC,SAASC,eAAe,QAAQ,gCAAgC;AAChE,SAASC,cAAc,QAAQ,YAAY;AAC3C,OAAOC,OAAO,MAAM,YAAY;AAEhC,MAAMC,UAAU,gBAAGN,KAAK,CAACO,UAAU,CAAC,CAAAC,IAAA,EAajCC,GAAG,KAAK;EAAA,IAb0B;MACnCC,SAAS;MACTC,GAAG;MACHC,YAAY;MACZC,IAAI;MACJC,GAAG;MACHC,cAAc;MACdC,OAAO;MACPC,IAAI;MACJC,OAAO;MACPC,MAAM;MACNC;IAEF,CAAC,GAAAZ,IAAA;IADIa,KAAK,GAAAC,wBAAA,CAAAd,IAAA,EAAAe,SAAA;EAER,MAAMC,MAAM,GAAGZ,YAAY,GAAG,UAAU,GAAG,EAAE;EAC7C,MAAMa,WAAW,GAAGL,QAAQ,GAAI,GAAEF,OAAQ,GAAE,GAAG,EAAE;EACjD,IAAI,CAACC,MAAM,IAAIO,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,aAAa,IAAIC,OAAO,EAAE;IAChE,MAAMC,GAAG,GAAG,6EAA6E,GACrF,2FAA2F,GAC3F,kFAAkF;IACtF;IACAD,OAAO,CAACE,IAAI,CAACD,GAAG,CAAC;EACnB;EACA,MAAME,aAAa,GAAGb,MAAM,IAAIhB,eAAe;EAC/C,oBACEH,KAAA,CAAAiC,aAAA,WAAAC,QAAA;IACE,cAAYvB,GAAI;IAChBD,SAAS,EAAER,UAAU,CACnB,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EAAa,GAAK2C,KAAK,CAAG,CACxD,CAAC;AAErB;AAEAJ,qBAAqB,CAACf,YAAY,GAAG;EACnCiB,gBAAgB,EAAE,KAAK;EACvBnC,OAAO,EAAE,SAAS;EAClBN,YAAY,EAAE;AAChB,CAAC;AAEDuC,qBAAqB,CAACb,SAAS,GAAG;EAChC;EACAe,gBAAgB,EAAEpD,SAAS,CAACsC,MAAM;EAClC;EACAe,cAAc,EAAErD,SAAS,CAAC2D,IAAI,CAAChB,UAAU;EACzC;EACA1B,OAAO,EAAEjB,SAAS,CAACiD,KAAK,CAAC,CAAC,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;EACrH;EACAtC,YAAY,EAAEX,SAAS,CAAC4C;AAC1B,CAAC;AAEDvC,UAAU,CAAC6C,qBAAqB,GAAGA,qBAAqB;AAExD,eAAe7C,UAAU;AACzB,SAAS6C,qBAAqB"}
1
+ {"version":3,"file":"index.js","names":["React","PropTypes","classNames","FontAwesomeIcon","OverlayTrigger","Tooltip","IconButton","forwardRef","_ref","ref","className","alt","invertColors","icon","src","iconClassNames","onClick","size","variant","iconAs","isActive","attrs","_objectWithoutProperties","_excluded","invert","activeStyle","process","env","NODE_ENV","console","msg","warn","IconComponent","createElement","_extends","type","defaultProps","undefined","propTypes","string","elementType","oneOfType","element","func","isRequired","bool","shape","prefix","iconName","array","oneOf","IconButtonWithTooltip","_ref2","tooltipPlacement","tooltipContent","props","_excluded2","placement","overlay","id","node"],"sources":["../../src/IconButton/index.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\n\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { OverlayTrigger } from '../Overlay';\nimport Tooltip from '../Tooltip';\n\nconst IconButton = React.forwardRef(({\n className,\n alt,\n invertColors,\n icon,\n src,\n iconClassNames,\n onClick,\n size,\n variant,\n iconAs,\n isActive,\n ...attrs\n}, ref) => {\n const invert = invertColors ? 'inverse-' : '';\n const activeStyle = isActive ? `${variant}-` : '';\n if (!iconAs && process.env.NODE_ENV === 'development' && console) {\n const msg = '[Deprecated] IconButton: you have not provided a value for iconAs prop and '\n + 'are using a default one - FontAwesomeIcon, the default value is going to be changed soon '\n + 'as Paragon is moving away from FontAwesome, please use Paragon\\'s icons instead.';\n // eslint-disable-next-line no-console\n console.warn(msg);\n }\n const IconComponent = iconAs || FontAwesomeIcon;\n return (\n <button\n aria-label={alt}\n className={classNames(\n 'btn-icon',\n `btn-icon-${invert}${variant}`,\n `btn-icon-${size}`,\n {\n [`btn-icon-${invert}${activeStyle}active`]: isActive,\n },\n className,\n )}\n onClick={onClick}\n type=\"button\"\n ref={ref}\n {...attrs}\n >\n <span className=\"btn-icon__icon-container\">\n <IconComponent\n className={classNames('btn-icon__icon', iconClassNames)}\n icon={icon}\n src={src}\n />\n </span>\n </button>\n );\n});\n\nIconButton.defaultProps = {\n iconAs: undefined,\n src: null,\n icon: undefined,\n iconClassNames: undefined,\n className: undefined,\n invertColors: false,\n variant: 'primary',\n size: 'md',\n onClick: () => {},\n isActive: false,\n};\n\nIconButton.propTypes = {\n /** A custom class name. */\n className: PropTypes.string,\n /** Component that renders the icon, currently defaults to `FontAwesomeIcon`,\n * but is going to be deprecated soon, please use Paragon's icons instead. */\n iconAs: PropTypes.elementType,\n /** An icon component to render. Example import of a Paragon icon component:\n * `import { Check } from '@edx/paragon/dist/icon';`\n * */\n src: PropTypes.oneOfType([PropTypes.element, PropTypes.func]),\n /** Alt text for your icon. For best practice, avoid using alt text to describe\n * the image in the `IconButton`. Instead, we recommend describing the function\n * of the button. */\n alt: PropTypes.string.isRequired,\n /** Changes icon styles for dark background */\n invertColors: PropTypes.bool,\n /** Accepts a React fontawesome icon. */\n icon: PropTypes.shape({\n prefix: PropTypes.string,\n iconName: PropTypes.string,\n // eslint-disable-next-line react/forbid-prop-types\n icon: PropTypes.array,\n }),\n /** Extra class names that will be added to the icon */\n iconClassNames: PropTypes.string,\n /** Click handler for the button */\n onClick: PropTypes.func,\n /** Type of button (uses Bootstrap options) */\n variant: PropTypes.oneOf(['primary', 'secondary', 'success', 'warning', 'danger', 'light', 'dark', 'black', 'brand']),\n /** size of button to render */\n size: PropTypes.oneOf(['sm', 'md', 'inline']),\n /** whether to show the `IconButton` in an active state, whose styling is distinct from default state */\n isActive: PropTypes.bool,\n};\n\n/**\n *\n * @param { object } args Arguments\n * @param { string } args.tooltipPlacement choose from https://popper.js.org/docs/v2/constructors/#options\n * @param { React.Component } args.tooltipContent any content to pass to tooltip content area\n * @returns { IconButton } a button wrapped in overlaytrigger\n */\nfunction IconButtonWithTooltip({\n tooltipPlacement, tooltipContent, variant, invertColors, ...props\n}) {\n const invert = invertColors ? 'inverse-' : '';\n return (\n <OverlayTrigger\n placement={tooltipPlacement}\n overlay={(\n <Tooltip\n id={`iconbutton-tooltip-${tooltipPlacement}`}\n variant={invert ? 'light' : ''}\n >\n {tooltipContent}\n </Tooltip>\n )}\n >\n <IconButton variant={variant} invertColors={invertColors} {...props} />\n </OverlayTrigger>\n );\n}\n\nIconButtonWithTooltip.defaultProps = {\n tooltipPlacement: 'top',\n variant: 'primary',\n invertColors: false,\n};\n\nIconButtonWithTooltip.propTypes = {\n /** tooltip placement can be top, left, right etc, per https://popper.js.org/docs/v2/constructors/#options */\n tooltipPlacement: PropTypes.string,\n /** any valid JSX or text to be rendered as tooltip contents */\n tooltipContent: PropTypes.node.isRequired,\n /** Type of button (uses Bootstrap options) */\n variant: PropTypes.oneOf(['primary', 'secondary', 'success', 'warning', 'danger', 'light', 'dark', 'black', 'brand']),\n /** Changes icon styles for dark background */\n invertColors: PropTypes.bool,\n};\n\nIconButton.IconButtonWithTooltip = IconButtonWithTooltip;\n\nexport default IconButton;\nexport { IconButtonWithTooltip };\n"],"mappings":";;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM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AU;EACzC;EACA1B,OAAO,EAAEjB,SAAS,CAACiD,KAAK,CAAC,CAAC,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;EACrH;EACAtC,YAAY,EAAEX,SAAS,CAAC4C;AAC1B,CAAC;AAEDvC,UAAU,CAAC6C,qBAAqB,GAAGA,qBAAqB;AAExD,eAAe7C,UAAU;AACzB,SAAS6C,qBAAqB"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["React","Col","Row","PropTypes","COL_VALUES","SIZES","LayoutElement","forwardRef","props","ref","createElement","_extends","Layout","_ref","children","_objectWithoutProperties","_excluded","childrenLength","length","isValidDimensions","dataList","validLength","errors","layout","Children","map","child","index","newProps","_objectSpread","forEach","size","sizeProps","span","offset","undefined","Object","keys","breakpoint","console","error","defaultProps","xs","sm","md","lg","xl","propTypes","node","isRequired","arrayOf","shape","oneOf","sizeDefaultProps","Element"],"sources":["../../src/Layout/index.jsx"],"sourcesContent":["import React from 'react';\nimport Col from 'react-bootstrap/Col';\nimport Row from 'react-bootstrap/Row';\nimport PropTypes from 'prop-types';\n\nconst COL_VALUES = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 'auto'];\nconst SIZES = ['xs', 'sm', 'md', 'lg', 'xl'];\n\nconst LayoutElement = React.forwardRef((props, ref) => <div ref={ref} {...props} />);\n\nconst Layout = React.forwardRef(({ children, ...props }, ref) => {\n const childrenLength = children.length;\n\n const isValidDimensions = (dataList, validLength) => !dataList || dataList.length === validLength;\n const errors = {};\n\n const layout = React.Children.map(children, (child, index) => {\n const newProps = { ...child.props };\n SIZES.forEach(size => {\n const sizeProps = props[size];\n const { span = 0, offset = 0 } = (sizeProps && sizeProps[index]) || {};\n if (errors[size] === undefined) {\n errors[size] = false;\n if (!isValidDimensions(sizeProps, childrenLength)) {\n errors[size] = `${size} prop accepts array which length must be equal to the number of children.`;\n }\n }\n newProps[size] = { span, offset };\n });\n newProps.ref = child.ref;\n return React.createElement(Col, newProps, child.props.children);\n });\n\n Object.keys(errors).forEach(breakpoint => {\n if (errors[breakpoint]) {\n // eslint-disable-next-line no-console\n console.error(errors[breakpoint]);\n }\n });\n\n return (\n <Row ref={ref}>\n {layout}\n </Row>\n );\n});\n\nLayout.defaultProps = {\n xs: undefined,\n sm: undefined,\n md: undefined,\n lg: undefined,\n xl: undefined,\n};\n\nLayout.propTypes = {\n children: PropTypes.node.isRequired,\n xs: PropTypes.arrayOf(PropTypes.shape({\n span: PropTypes.oneOf(COL_VALUES).isRequired,\n offset: PropTypes.oneOf(COL_VALUES),\n })),\n sm: PropTypes.arrayOf(PropTypes.shape({\n span: PropTypes.oneOf(COL_VALUES).isRequired,\n offset: PropTypes.oneOf(COL_VALUES),\n })),\n md: PropTypes.arrayOf(PropTypes.shape({\n span: PropTypes.oneOf(COL_VALUES).isRequired,\n offset: PropTypes.oneOf(COL_VALUES),\n })),\n lg: PropTypes.arrayOf(PropTypes.shape({\n span: PropTypes.oneOf(COL_VALUES).isRequired,\n offset: PropTypes.oneOf(COL_VALUES),\n })),\n xl: PropTypes.arrayOf(PropTypes.shape({\n span: PropTypes.oneOf(COL_VALUES).isRequired,\n offset: PropTypes.oneOf(COL_VALUES),\n })),\n};\n\nconst sizeDefaultProps = { span: [], offset: [] };\n\nSIZES.forEach(size => {\n // eslint-disable-next-line react/default-props-match-prop-types\n Layout.defaultProps[size] = sizeDefaultProps;\n});\n\nexport {\n Col,\n Row,\n};\nLayout.Element = LayoutElement;\nexport default Layout;\n"],"mappings":";;;;;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,GAAG,MAAM,qBAAqB;AACrC,OAAOC,GAAG,MAAM,qBAAqB;AACrC,OAAOC,SAAS,MAAM,YAAY;AAElC,MAAMC,UAAU,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAA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,GAAGhD,aAAa;AAC9B,eAAeM,MAAM"}
1
+ {"version":3,"file":"index.js","names":["React","Col","Row","PropTypes","COL_VALUES","SIZES","LayoutElement","forwardRef","props","ref","createElement","_extends","Layout","_ref","children","_objectWithoutProperties","_excluded","childrenLength","length","isValidDimensions","dataList","validLength","errors","layout","Children","map","child","index","newProps","_objectSpread","forEach","size","sizeProps","span","offset","undefined","Object","keys","breakpoint","console","error","defaultProps","xs","sm","md","lg","xl","propTypes","node","isRequired","arrayOf","shape","oneOf","sizeDefaultProps","Element"],"sources":["../../src/Layout/index.jsx"],"sourcesContent":["import React from 'react';\nimport Col from 'react-bootstrap/Col';\nimport Row from 'react-bootstrap/Row';\nimport PropTypes from 'prop-types';\n\nconst COL_VALUES = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 'auto'];\nconst SIZES = ['xs', 'sm', 'md', 'lg', 'xl'];\n\nconst LayoutElement = React.forwardRef((props, ref) => <div ref={ref} {...props} />);\n\nconst Layout = React.forwardRef(({ children, ...props }, ref) => {\n const childrenLength = children.length;\n\n const isValidDimensions = (dataList, validLength) => !dataList || dataList.length === validLength;\n const errors = {};\n\n const layout = React.Children.map(children, (child, index) => {\n const newProps = { ...child.props };\n SIZES.forEach(size => {\n const sizeProps = props[size];\n const { span = 0, offset = 0 } = (sizeProps && sizeProps[index]) || {};\n if (errors[size] === undefined) {\n errors[size] = false;\n if (!isValidDimensions(sizeProps, childrenLength)) {\n errors[size] = `${size} prop accepts array which length must be equal to the number of children.`;\n }\n }\n newProps[size] = { span, offset };\n });\n newProps.ref = child.ref;\n return React.createElement(Col, newProps, child.props.children);\n });\n\n Object.keys(errors).forEach(breakpoint => {\n if (errors[breakpoint]) {\n // eslint-disable-next-line no-console\n console.error(errors[breakpoint]);\n }\n });\n\n return (\n <Row ref={ref}>\n {layout}\n </Row>\n );\n});\n\nLayout.defaultProps = {\n xs: undefined,\n sm: undefined,\n md: undefined,\n lg: undefined,\n xl: undefined,\n};\n\nLayout.propTypes = {\n children: PropTypes.node.isRequired,\n xs: PropTypes.arrayOf(PropTypes.shape({\n span: PropTypes.oneOf(COL_VALUES).isRequired,\n offset: PropTypes.oneOf(COL_VALUES),\n })),\n sm: PropTypes.arrayOf(PropTypes.shape({\n span: PropTypes.oneOf(COL_VALUES).isRequired,\n offset: PropTypes.oneOf(COL_VALUES),\n })),\n md: PropTypes.arrayOf(PropTypes.shape({\n span: PropTypes.oneOf(COL_VALUES).isRequired,\n offset: PropTypes.oneOf(COL_VALUES),\n })),\n lg: PropTypes.arrayOf(PropTypes.shape({\n span: PropTypes.oneOf(COL_VALUES).isRequired,\n offset: PropTypes.oneOf(COL_VALUES),\n })),\n xl: PropTypes.arrayOf(PropTypes.shape({\n span: PropTypes.oneOf(COL_VALUES).isRequired,\n offset: PropTypes.oneOf(COL_VALUES),\n })),\n};\n\nconst sizeDefaultProps = { span: [], offset: [] };\n\nSIZES.forEach(size => {\n // eslint-disable-next-line react/default-props-match-prop-types\n Layout.defaultProps[size] = sizeDefaultProps;\n});\n\nexport { Col, Row };\nLayout.Element = LayoutElement;\nexport default Layout;\n"],"mappings":";;;;;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,GAAG,MAAM,qBAAqB;AACrC,OAAOC,GAAG,MAAM,qBAAqB;AACrC,OAAOC,SAAS,MAAM,YAAY;AAElC,MAAMC,UAAU,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC;AACrE,MAAMC,KAAK,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;AAE5C,MAAMC,aAAa,gBAAGN,KAAK,CAACO,UAAU,CAAC,CAACC,KAAK,EAAEC,GAAG,kBAAKT,KAAA,CAAAU,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AAS,CAACgD,KAAK,CAAC;IACpClB,IAAI,EAAE9B,SAAS,CAACiD,KAAK,CAAChD,UAAU,CAAC,CAAC6C,UAAU;IAC5Cf,MAAM,EAAE/B,SAAS,CAACiD,KAAK,CAAChD,UAAU;EACpC,CAAC,CAAC,CAAC;EACHyC,EAAE,EAAE1C,SAAS,CAAC+C,OAAO,CAAC/C,SAAS,CAACgD,KAAK,CAAC;IACpClB,IAAI,EAAE9B,SAAS,CAACiD,KAAK,CAAChD,UAAU,CAAC,CAAC6C,UAAU;IAC5Cf,MAAM,EAAE/B,SAAS,CAACiD,KAAK,CAAChD,UAAU;EACpC,CAAC,CAAC,CAAC;EACH0C,EAAE,EAAE3C,SAAS,CAAC+C,OAAO,CAAC/C,SAAS,CAACgD,KAAK,CAAC;IACpClB,IAAI,EAAE9B,SAAS,CAACiD,KAAK,CAAChD,UAAU,CAAC,CAAC6C,UAAU;IAC5Cf,MAAM,EAAE/B,SAAS,CAACiD,KAAK,CAAChD,UAAU;EACpC,CAAC,CAAC;AACJ,CAAC;AAED,MAAMiD,gBAAgB,GAAG;EAAEpB,IAAI,EAAE,EAAE;EAAEC,MAAM,EAAE;AAAG,CAAC;AAEjD7B,KAAK,CAACyB,OAAO,CAACC,IAAI,IAAI;EACpB;EACAnB,MAAM,CAAC6B,YAAY,CAACV,IAAI,CAAC,GAAGsB,gBAAgB;AAC9C,CAAC,CAAC;AAEF,SAASpD,GAAG,EAAEC,GAAG;AACjBU,MAAM,CAAC0C,OAAO,GAAGhD,aAAa;AAC9B,eAAeM,MAAM"}
@@ -107,6 +107,9 @@ ModalDialog.propTypes = {
107
107
  * Prevent clicking on the backdrop to close the modal
108
108
  */
109
109
  isBlocking: PropTypes.bool,
110
+ /**
111
+ * Specifies the z-index of the modal
112
+ */
110
113
  zIndex: PropTypes.number
111
114
  };
112
115
  ModalDialog.defaultProps = {
@@ -1 +1 @@
1
- {"version":3,"file":"ModalDialog.js","names":["React","PropTypes","classNames","useMediaQuery","ModalLayer","ModalCloseButton","ModalDialogHeader","ModalDialogTitle","ModalDialogFooter","ModalDialogBody","ModalDialogHero","Icon","IconButton","Close","MODAL_DIALOG_CLOSE_LABEL","ModalDialog","_ref","children","title","isOpen","onClose","size","variant","hasCloseButton","closeLabel","isFullscreenScroll","className","isFullscreenOnMobile","isBlocking","zIndex","isMobile","query","showFullScreen","createElement","role","as","iconAs","invertColors","src","alt","propTypes","node","isRequired","string","func","bool","oneOf","number","defaultProps","undefined","Header","Title","Footer","CloseButton","Body","Hero"],"sources":["../../src/Modal/ModalDialog.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport { useMediaQuery } from 'react-responsive';\nimport ModalLayer from './ModalLayer';\nimport ModalCloseButton from './ModalCloseButton';\nimport ModalDialogHeader from './ModalDialogHeader';\nimport ModalDialogTitle from './ModalDialogTitle';\nimport ModalDialogFooter from './ModalDialogFooter';\nimport ModalDialogBody from './ModalDialogBody';\nimport ModalDialogHero from './ModalDialogHero';\n\nimport Icon from '../Icon';\nimport IconButton from '../IconButton';\nimport { Close } from '../../icons';\n\nexport const MODAL_DIALOG_CLOSE_LABEL = 'Close';\n\nfunction ModalDialog({\n children,\n title,\n isOpen,\n onClose,\n size,\n variant,\n hasCloseButton,\n closeLabel,\n isFullscreenScroll,\n className,\n isFullscreenOnMobile,\n isBlocking,\n zIndex,\n}) {\n const isMobile = useMediaQuery({ query: '(max-width: 767.98px)' });\n const showFullScreen = (isFullscreenOnMobile && isMobile);\n return (\n <ModalLayer isOpen={isOpen} onClose={onClose} isBlocking={isBlocking} zIndex={zIndex}>\n <div\n role=\"dialog\"\n aria-label={title}\n className={classNames(\n 'pgn__modal',\n {\n [`pgn__modal-${showFullScreen ? 'fullscreen' : size}`]: size,\n [`pgn__modal-${variant}`]: variant,\n 'pgn__modal-scroll-fullscreen': isFullscreenScroll,\n },\n className,\n )}\n >\n {hasCloseButton && (\n <div className=\"pgn__modal-close-container\">\n <ModalCloseButton\n as={IconButton}\n iconAs={Icon}\n invertColors={variant === 'dark'}\n src={Close}\n alt={closeLabel}\n />\n </div>\n )}\n {children}\n </div>\n </ModalLayer>\n );\n}\n\nModalDialog.propTypes = {\n /**\n * Specifies the content of the dialog\n */\n children: PropTypes.node.isRequired,\n /**\n * The aria-label of the dialog\n */\n title: PropTypes.string.isRequired,\n /**\n * A callback to close the modal dialog\n */\n onClose: PropTypes.func.isRequired,\n /**\n * Is the modal dialog open or closed\n */\n isOpen: PropTypes.bool,\n /**\n * The close 'x' icon button in the top right of the dialog box\n */\n hasCloseButton: PropTypes.bool,\n /**\n * Sizes determine the maximum width of the dialog box\n */\n size: PropTypes.oneOf(['sm', 'md', 'lg', 'xl', 'fullscreen']),\n /**\n * The visual style of the dialog box\n */\n variant: PropTypes.oneOf(['default', 'warning', 'danger', 'success', 'dark']),\n /**\n * The label supplied to the close icon button if one is rendered\n */\n closeLabel: PropTypes.string,\n /**\n * Specifies class name to append to the base element\n */\n className: PropTypes.string,\n /**\n * Determines where a scrollbar should appear if a modal is too large for the\n * viewport. When false, the ``ModalDialog``. Body receives a scrollbar, when true\n * the browser window itself receives the scrollbar.\n */\n isFullscreenScroll: PropTypes.bool,\n /**\n * To show full screen view on mobile screens\n */\n isFullscreenOnMobile: PropTypes.bool,\n /**\n * Prevent clicking on the backdrop to close the modal\n */\n isBlocking: PropTypes.bool,\n zIndex: PropTypes.number,\n};\n\nModalDialog.defaultProps = {\n isOpen: false,\n hasCloseButton: true,\n size: 'md',\n variant: 'default',\n closeLabel: MODAL_DIALOG_CLOSE_LABEL,\n className: undefined,\n isFullscreenScroll: false,\n isFullscreenOnMobile: false,\n isBlocking: false,\n zIndex: undefined,\n};\n\nModalDialog.Header = ModalDialogHeader;\nModalDialog.Title = ModalDialogTitle;\nModalDialog.Footer = ModalDialogFooter;\nModalDialog.CloseButton = ModalCloseButton;\nModalDialog.Body = ModalDialogBody;\nModalDialog.Hero = ModalDialogHero;\n\nexport default ModalDialog;\n"],"mapp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BAAoB,EAAE1B,SAAS,CAAC4C,IAAI;EACpC;AACF;AACA;EACEjB,UAAU,EAAE3B,SAAS,CAAC4C,IAAI;EAC1BhB,MAAM,EAAE5B,SAAS,CAAC8C;AACpB,CAAC;AAEDhC,WAAW,CAACiC,YAAY,GAAG;EACzB7B,MAAM,EAAE,KAAK;EACbI,cAAc,EAAE,IAAI;EACpBF,IAAI,EAAE,IAAI;EACVC,OAAO,EAAE,SAAS;EAClBE,UAAU,EAAEV,wBAAwB;EACpCY,SAAS,EAAEuB,SAAS;EACpBxB,kBAAkB,EAAE,KAAK;EACzBE,oBAAoB,EAAE,KAAK;EAC3BC,UAAU,EAAE,KAAK;EACjBC,MAAM,EAAEoB;AACV,CAAC;AAEDlC,WAAW,CAACmC,MAAM,GAAG5C,iBAAiB;AACtCS,WAAW,CAACoC,KAAK,GAAG5C,gBAAgB;AACpCQ,WAAW,CAACqC,MAAM,GAAG5C,iBAAiB;AACtCO,WAAW,CAACsC,WAAW,GAAGhD,gBAAgB;AAC1CU,WAAW,CAACuC,IAAI,GAAG7C,eAAe;AAClCM,WAAW,CAACwC,IAAI,GAAG7C,eAAe;AAElC,eAAeK,WAAW"}
1
+ {"version":3,"file":"ModalDialog.js","names":["React","PropTypes","classNames","useMediaQuery","ModalLayer","ModalCloseButton","ModalDialogHeader","ModalDialogTitle","ModalDialogFooter","ModalDialogBody","ModalDialogHero","Icon","IconButton","Close","MODAL_DIALOG_CLOSE_LABEL","ModalDialog","_ref","children","title","isOpen","onClose","size","variant","hasCloseButton","closeLabel","isFullscreenScroll","className","isFullscreenOnMobile","isBlocking","zIndex","isMobile","query","showFullScreen","createElement","role","as","iconAs","invertColors","src","alt","propTypes","node","isRequired","string","func","bool","oneOf","number","defaultProps","undefined","Header","Title","Footer","CloseButton","Body","Hero"],"sources":["../../src/Modal/ModalDialog.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport { useMediaQuery } from 'react-responsive';\nimport ModalLayer from './ModalLayer';\nimport ModalCloseButton from './ModalCloseButton';\nimport ModalDialogHeader from './ModalDialogHeader';\nimport ModalDialogTitle from './ModalDialogTitle';\nimport ModalDialogFooter from './ModalDialogFooter';\nimport ModalDialogBody from './ModalDialogBody';\nimport ModalDialogHero from './ModalDialogHero';\n\nimport Icon from '../Icon';\nimport IconButton from '../IconButton';\nimport { Close } from '../../icons';\n\nexport const MODAL_DIALOG_CLOSE_LABEL = 'Close';\n\nfunction ModalDialog({\n children,\n title,\n isOpen,\n onClose,\n size,\n variant,\n hasCloseButton,\n closeLabel,\n isFullscreenScroll,\n className,\n isFullscreenOnMobile,\n isBlocking,\n zIndex,\n}) {\n const isMobile = useMediaQuery({ query: '(max-width: 767.98px)' });\n const showFullScreen = (isFullscreenOnMobile && isMobile);\n return (\n <ModalLayer isOpen={isOpen} onClose={onClose} isBlocking={isBlocking} zIndex={zIndex}>\n <div\n role=\"dialog\"\n aria-label={title}\n className={classNames(\n 'pgn__modal',\n {\n [`pgn__modal-${showFullScreen ? 'fullscreen' : size}`]: size,\n [`pgn__modal-${variant}`]: variant,\n 'pgn__modal-scroll-fullscreen': isFullscreenScroll,\n },\n className,\n )}\n >\n {hasCloseButton && (\n <div className=\"pgn__modal-close-container\">\n <ModalCloseButton\n as={IconButton}\n iconAs={Icon}\n invertColors={variant === 'dark'}\n src={Close}\n alt={closeLabel}\n />\n </div>\n )}\n {children}\n </div>\n </ModalLayer>\n );\n}\n\nModalDialog.propTypes = {\n /**\n * Specifies the content of the dialog\n */\n children: PropTypes.node.isRequired,\n /**\n * The aria-label of the dialog\n */\n title: PropTypes.string.isRequired,\n /**\n * A callback to close the modal dialog\n */\n onClose: PropTypes.func.isRequired,\n /**\n * Is the modal dialog open or closed\n */\n isOpen: PropTypes.bool,\n /**\n * The close 'x' icon button in the top right of the dialog box\n */\n hasCloseButton: PropTypes.bool,\n /**\n * Sizes determine the maximum width of the dialog box\n */\n size: PropTypes.oneOf(['sm', 'md', 'lg', 'xl', 'fullscreen']),\n /**\n * The visual style of the dialog box\n */\n variant: PropTypes.oneOf(['default', 'warning', 'danger', 'success', 'dark']),\n /**\n * The label supplied to the close icon button if one is rendered\n */\n closeLabel: PropTypes.string,\n /**\n * Specifies class name to append to the base element\n */\n className: PropTypes.string,\n /**\n * Determines where a scrollbar should appear if a modal is too large for the\n * viewport. When false, the ``ModalDialog``. Body receives a scrollbar, when true\n * the browser window itself receives the scrollbar.\n */\n isFullscreenScroll: PropTypes.bool,\n /**\n * To show full screen view on mobile screens\n */\n isFullscreenOnMobile: PropTypes.bool,\n /**\n * Prevent clicking on the backdrop to close the modal\n */\n isBlocking: PropTypes.bool,\n /**\n * Specifies the z-index of the modal\n */\n zIndex: PropTypes.number,\n};\n\nModalDialog.defaultProps = {\n isOpen: false,\n hasCloseButton: true,\n size: 'md',\n variant: 'default',\n closeLabel: MODAL_DIALOG_CLOSE_LABEL,\n className: undefined,\n isFullscreenScroll: false,\n isFullscreenOnMobile: false,\n isBlocking: false,\n zIndex: undefined,\n};\n\nModalDialog.Header = ModalDialogHeader;\nModalDialog.Title = ModalDialogTitle;\nModalDialog.Footer = ModalDialogFooter;\nModalDialog.CloseButton = ModalCloseButton;\nModalDialog.Body = ModalDialogBody;\nModalDialog.Hero = ModalDialogHero;\n\nexport default ModalDialog;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,UAAU,MAAM,YAAY;AACnC,SAASC,aAAa,QAAQ,kBAAkB;AAChD,OAAOC,UAAU,MAAM,cAAc;AACrC,OAAOC,gBAAgB,MAAM,oBAAoB;AACjD,OAAOC,iBAAiB,MAAM,qBAAqB;AACnD,OAAOC,gBAAgB,MAAM,oBAAoB;AACjD,OAAOC,iBAAiB,MAAM,qBAAqB;AACnD,OAAOC,eAAe,MAAM,mBAAmB;AAC/C,OAAOC,eAAe,MAAM,mBAAmB;AAE/C,OAAOC,IAAI,MAAM,SAAS;AAC1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,UAAU,EAAE,KAAK;EACjBC,MAAM,EAAEoB;AACV,CAAC;AAEDlC,WAAW,CAACmC,MAAM,GAAG5C,iBAAiB;AACtCS,WAAW,CAACoC,KAAK,GAAG5C,gBAAgB;AACpCQ,WAAW,CAACqC,MAAM,GAAG5C,iBAAiB;AACtCO,WAAW,CAACsC,WAAW,GAAGhD,gBAAgB;AAC1CU,WAAW,CAACuC,IAAI,GAAG7C,eAAe;AAClCM,WAAW,CAACwC,IAAI,GAAG7C,eAAe;AAElC,eAAeK,WAAW"}
@@ -2,7 +2,6 @@ const _excluded = ["label"];
2
2
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3
3
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
4
4
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
5
- /* eslint-disable max-len */
6
5
  import React from 'react';
7
6
  import ReactDOM from 'react-dom';
8
7
  import classNames from 'classnames';
@@ -219,20 +218,25 @@ class Modal extends React.Component {
219
218
  Modal.propTypes = {
220
219
  /** specifies whether the modal renders open or closed on the initial render. It defaults to false. */
221
220
  open: PropTypes.bool,
222
- /** is the selector for an element in the dom which the modal should be rendered under. It uses querySelector to find the first element that matches that selector, and then creates a react portal to a div underneath the parent element.
223
- */
221
+ /** is the selector for an element in the dom which the modal should be rendered under.
222
+ * It uses querySelector to find the first element that matches that selector,
223
+ * and then creates a React portal to a div underneath the parent element.
224
+ */
224
225
  parentSelector: PropTypes.string,
225
226
  /** a string or an element that is rendered inside of the modal title, above the modal body. */
226
227
  title: PropTypes.oneOfType([PropTypes.string, PropTypes.element]).isRequired,
227
228
  /** a string or an element that is rendered inside of the modal body, between the title and the footer. */
228
229
  body: PropTypes.oneOfType([PropTypes.string, PropTypes.element]).isRequired,
229
- /** an array of either elements or shapes that take the form of the buttonPropTypes. See the [buttonPropTypes](https://github.com/openedx/paragon/blob/master/src/Button/index.jsx#L40) for a list of acceptable props to pass as part of a button. */
230
+ /** an array of either elements or shapes that take the form of the buttonPropTypes.
231
+ * See the [buttonPropTypes](https://github.com/openedx/paragon/blob/master/src/Button/index.jsx#L40)
232
+ * for a list of acceptable props to pass as part of a button. */
230
233
  buttons: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.element, PropTypes.shape({}) // TODO: Only accept nodes in the future
231
234
  ])),
232
235
 
233
236
  /** specifies the display text of the default Close button. It defaults to "Close". */
234
237
  closeText: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
235
- /** a function that is called on close. It can be used to perform actions upon closing of the modal, such as restoring focus to the previous logical focusable element. */
238
+ /** a function that is called on close. It can be used to perform actions upon closing of the modal,
239
+ * such as restoring focus to the previous logical focusable element. */
236
240
  onClose: PropTypes.func.isRequired,
237
241
  variant: PropTypes.shape({
238
242
  status: PropTypes.string
@@ -242,7 +246,8 @@ Modal.propTypes = {
242
246
  /** specifies whether a close button is rendered in the modal header. It defaults to true. */
243
247
  renderHeaderCloseButton: PropTypes.bool,
244
248
  /**
245
- * Specifies optional classes to add to the element with the '.modal-dialog' class. See Bootstrap documentation for possible classes. Some options: modal-lg, modal-sm, modal-dialog-centered
249
+ * Specifies optional classes to add to the element with the '.modal-dialog' class.
250
+ * See Bootstrap documentation for possible classes. Some options: modal-lg, modal-sm, modal-dialog-centered
246
251
  */
247
252
  dialogClassName: PropTypes.string
248
253
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["React","ReactDOM","classNames","PropTypes","FocusOn","tabbable","Close","Button","Icon","newId","Variant","Modal","Component","constructor","props","close","bind","headerId","modalBodyRef","createRef","document","el","createElement","isIE11","global","MSInputMethodContext","documentMode","state","open","componentDidMount","parentSelector","parentElement","querySelector","Error","appendChild","componentDidUpdate","prevProps","prevState","setState","componentWillUnmount","unmountComponentAtNode","getVariantIconClassName","variant","variantIconClassName","status","WARNING","toLowerCase","getVariantGridBody","body","className","id","getTabbableBodyElements","current","isValidVariantStatus","Object","values","includes","e","stopPropagation","onClose","renderButtons","buttons","map","button","isValidElement","cloneElement","key","children","label","buttonProps","_objectWithoutProperties","_excluded","Deprecated","_extends","renderBody","renderModal","dialogClassName","renderDefaultCloseButton","renderHeaderCloseButton","closeText","title","hasTabbableElements","length","renderModalFooter","Fragment","show","fade","role","enabled","onClickOutside","onEscapeKey","tabIndex","onClick","src","screenReaderText","ref","render","createPortal","propTypes","bool","string","oneOfType","element","isRequired","arrayOf","shape","func","defaultProps","undefined"],"sources":["../../src/Modal/index.jsx"],"sourcesContent":["/* eslint-disable max-len */\nimport React from 'react';\nimport ReactDOM from 'react-dom';\nimport classNames from 'classnames';\nimport PropTypes from 'prop-types';\nimport { FocusOn } from 'react-focus-on';\nimport { tabbable } from 'tabbable';\n\nimport { Close } from '../../icons';\nimport Button from '../Button';\nimport Icon from '../Icon';\nimport newId from '../utils/newId';\nimport Variant from '../utils/constants';\n\nclass Modal extends React.Component {\n constructor(props) {\n super(props);\n\n this.close = this.close.bind(this);\n\n this.headerId = newId();\n this.modalBodyRef = React.createRef();\n\n if (typeof document !== 'undefined') {\n this.el = document.createElement('div');\n // Sets true for IE11, false otherwise: https://stackoverflow.com/a/22082397/6620612\n this.isIE11 = !!global.MSInputMethodContext && !!document.documentMode;\n }\n\n this.state = {\n open: props.open,\n };\n }\n\n componentDidMount() {\n const { parentSelector } = this.props;\n this.parentElement = document.querySelector(parentSelector);\n if (this.parentElement === null) {\n throw new Error(`Modal received invalid parentSelector: ${parentSelector}, no matching element found`);\n }\n this.parentElement.appendChild(this.el);\n }\n\n componentDidUpdate(prevProps, prevState) {\n const { open } = this.props;\n if (open !== prevProps.open || open !== prevState.open) {\n // eslint-disable-next-line react/no-did-update-set-state\n this.setState({ open });\n }\n }\n\n componentWillUnmount() {\n if (this.parentElement) {\n ReactDOM.unmountComponentAtNode(this.parentElement);\n }\n }\n\n getVariantIconClassName() {\n const { variant } = this.props;\n let variantIconClassName;\n\n switch (variant.status) {\n case Variant.status.WARNING:\n variantIconClassName = classNames(\n 'fa',\n 'fa-exclamation-triangle',\n 'fa-3x',\n `text-${variant.status.toLowerCase()}`,\n );\n break;\n default:\n break;\n }\n\n return variantIconClassName;\n }\n\n getVariantGridBody(body) {\n const { variant } = this.props;\n\n return (\n <div className=\"container-fluid\">\n <div className=\"row\">\n <div className=\"col-md-10\">\n <div>\n {body}\n </div>\n </div>\n <div className=\"col-md-2\" data-testid=\"modal-icon\">\n <Icon\n id={newId(`Modal-${variant.status}`)}\n className={this.getVariantIconClassName()}\n />\n </div>\n </div>\n </div>\n );\n }\n\n getTabbableBodyElements() {\n if (this.modalBodyRef?.current) {\n return tabbable(this.modalBodyRef.current);\n }\n return [];\n }\n\n isValidVariantStatus() {\n const { variant } = this.props;\n return Object.values(Variant.status).includes(variant.status);\n }\n\n close(e) {\n if (e) {\n e.stopPropagation();\n }\n\n this.setState({ open: false });\n this.props.onClose();\n }\n\n renderButtons() {\n return this.props.buttons.map((button) => {\n // button is either a React component that we want clone or a set of props\n if (React.isValidElement(button)) {\n return React.cloneElement(button, {\n key: button.props.children,\n });\n }\n\n const { label, ...buttonProps } = button;\n\n return (\n <Button.Deprecated\n {...buttonProps}\n key={label}\n >\n {label}\n </Button.Deprecated>\n );\n });\n }\n\n renderBody() {\n let { body } = this.props;\n\n if (typeof body === 'string') {\n body = <p>{body}</p>;\n }\n\n if (this.isValidVariantStatus()) {\n body = this.getVariantGridBody(body);\n }\n\n return body;\n }\n\n renderModal() {\n const { open } = this.state;\n const {\n dialogClassName,\n renderDefaultCloseButton,\n renderHeaderCloseButton,\n buttons,\n closeText,\n title,\n } = this.props;\n\n const hasTabbableElements = (\n renderDefaultCloseButton\n || renderHeaderCloseButton\n || buttons.length > 0\n || this.getTabbableBodyElements().length > 0\n );\n const renderModalFooter = renderDefaultCloseButton || buttons.length > 0;\n\n return (\n <>\n <div\n className={classNames({\n 'modal-backdrop': open,\n show: open,\n fade: !open,\n })}\n role=\"presentation\"\n data-testid=\"modal-backdrop\"\n />\n <div\n className={classNames(\n 'modal',\n {\n show: open,\n fade: !open,\n 'd-block': open,\n 'is-ie11': this.isIE11,\n },\n )}\n role=\"presentation\"\n data-testid=\"modal\"\n >\n <div\n className={classNames(\n {\n 'modal-dialog': open,\n },\n dialogClassName,\n )}\n role=\"dialog\"\n aria-modal\n aria-labelledby={this.headerId}\n >\n <FocusOn\n enabled={open}\n onClickOutside={this.close}\n onEscapeKey={this.close}\n >\n <div\n className=\"modal-content\"\n data-testid=\"modal-content\"\n // if the modal doesn't contain any tabbable elements, make this element programmatically focusable.\n {...(!hasTabbableElements ? { tabIndex: -1 } : {})}\n >\n <div className=\"modal-header\">\n <h2 className=\"modal-title\" id={this.headerId}>{title}</h2>\n {renderHeaderCloseButton && (\n <Button.Deprecated\n className=\"p-1\"\n onClick={this.close}\n data-testid=\"modal-header-btn\"\n >\n <Icon src={Close} screenReaderText={closeText} />\n </Button.Deprecated>\n )}\n </div>\n <div className=\"modal-body\" ref={this.modalBodyRef} data-testid=\"modal-body\">\n {this.renderBody()}\n </div>\n {renderModalFooter && (\n <div className=\"modal-footer\">\n {renderDefaultCloseButton && (\n <Button\n variant=\"link\"\n onClick={this.close}\n data-testid=\"modal-footer-btn\"\n >\n {closeText}\n </Button>\n )}\n {this.renderButtons()}\n </div>\n )}\n </div>\n </FocusOn>\n </div>\n </div>\n </>\n );\n }\n\n render() {\n if (!this.el) {\n return null;\n }\n\n return ReactDOM.createPortal(\n this.renderModal(),\n this.el,\n );\n }\n}\n\nModal.propTypes = {\n /** specifies whether the modal renders open or closed on the initial render. It defaults to false. */\n open: PropTypes.bool,\n /** is the selector for an element in the dom which the modal should be rendered under. It uses querySelector to find the first element that matches that selector, and then creates a react portal to a div underneath the parent element.\n */\n parentSelector: PropTypes.string,\n /** a string or an element that is rendered inside of the modal title, above the modal body. */\n title: PropTypes.oneOfType([PropTypes.string, PropTypes.element]).isRequired,\n /** a string or an element that is rendered inside of the modal body, between the title and the footer. */\n body: PropTypes.oneOfType([PropTypes.string, PropTypes.element]).isRequired,\n /** an array of either elements or shapes that take the form of the buttonPropTypes. See the [buttonPropTypes](https://github.com/openedx/paragon/blob/master/src/Button/index.jsx#L40) for a list of acceptable props to pass as part of a button. */\n buttons: PropTypes.arrayOf(PropTypes.oneOfType([\n PropTypes.element,\n PropTypes.shape({}), // TODO: Only accept nodes in the future\n ])),\n /** specifies the display text of the default Close button. It defaults to \"Close\". */\n closeText: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),\n /** a function that is called on close. It can be used to perform actions upon closing of the modal, such as restoring focus to the previous logical focusable element. */\n onClose: PropTypes.func.isRequired,\n variant: PropTypes.shape({\n status: PropTypes.string,\n }),\n /** specifies whether the default close button is rendered in the footer. It defaults to true. */\n renderDefaultCloseButton: PropTypes.bool,\n /** specifies whether a close button is rendered in the modal header. It defaults to true. */\n renderHeaderCloseButton: PropTypes.bool,\n /**\n * Specifies optional classes to add to the element with the '.modal-dialog' class. See Bootstrap documentation for possible classes. Some options: modal-lg, modal-sm, modal-dialog-centered\n */\n dialogClassName: PropTypes.string,\n};\n\nModal.defaultProps = {\n open: false,\n parentSelector: 'body',\n buttons: [],\n closeText: 'Close',\n variant: {},\n renderDefaultCloseButton: true,\n renderHeaderCloseButton: true,\n dialogClassName: undefined,\n};\n\nexport default Modal;\n"],"mappings":";;;;AAAA;A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;EACA1B,SAAS,EAAE5E,SAAS,CAACkG,SAAS,CAAC,CAAClG,SAAS,CAACiG,MAAM,EAAEjG,SAAS,CAACmG,OAAO,CAAC,CAAC;EACrE;EACA3C,OAAO,EAAExD,SAAS,CAACuG,IAAI,CAACH,UAAU;EAClC7D,OAAO,EAAEvC,SAAS,CAACsG,KAAK,CAAC;IACvB7D,MAAM,EAAEzC,SAAS,CAACiG;EACpB,CAAC,CAAC;EACF;EACAvB,wBAAwB,EAAE1E,SAAS,CAACgG,IAAI;EACxC;EACArB,uBAAuB,EAAE3E,SAAS,CAACgG,IAAI;EACvC;AACF;AACA;EACEvB,eAAe,EAAEzE,SAAS,CAACiG;AAC7B,CAAC;AAEDzF,KAAK,CAACgG,YAAY,GAAG;EACnB/E,IAAI,EAAE,KAAK;EACXE,cAAc,EAAE,MAAM;EACtB+B,OAAO,EAAE,EAAE;EACXkB,SAAS,EAAE,OAAO;EAClBrC,OAAO,EAAE,CAAC,CAAC;EACXmC,wBAAwB,EAAE,IAAI;EAC9BC,uBAAuB,EAAE,IAAI;EAC7BF,eAAe,EAAEgC;AACnB,CAAC;AAED,eAAejG,KAAK"}
1
+ {"version":3,"file":"index.js","names":["React","ReactDOM","classNames","PropTypes","FocusOn","tabbable","Close","Button","Icon","newId","Variant","Modal","Component","constructor","props","close","bind","headerId","modalBodyRef","createRef","document","el","createElement","isIE11","global","MSInputMethodContext","documentMode","state","open","componentDidMount","parentSelector","parentElement","querySelector","Error","appendChild","componentDidUpdate","prevProps","prevState","setState","componentWillUnmount","unmountComponentAtNode","getVariantIconClassName","variant","variantIconClassName","status","WARNING","toLowerCase","getVariantGridBody","body","className","id","getTabbableBodyElements","current","isValidVariantStatus","Object","values","includes","e","stopPropagation","onClose","renderButtons","buttons","map","button","isValidElement","cloneElement","key","children","label","buttonProps","_objectWithoutProperties","_excluded","Deprecated","_extends","renderBody","renderModal","dialogClassName","renderDefaultCloseButton","renderHeaderCloseButton","closeText","title","hasTabbableElements","length","renderModalFooter","Fragment","show","fade","role","enabled","onClickOutside","onEscapeKey","tabIndex","onClick","src","screenReaderText","ref","render","createPortal","propTypes","bool","string","oneOfType","element","isRequired","arrayOf","shape","func","defaultProps","undefined"],"sources":["../../src/Modal/index.jsx"],"sourcesContent":["import React from 'react';\nimport ReactDOM from 'react-dom';\nimport classNames from 'classnames';\nimport PropTypes from 'prop-types';\nimport { FocusOn } from 'react-focus-on';\nimport { tabbable } from 'tabbable';\n\nimport { Close } from '../../icons';\nimport Button from '../Button';\nimport Icon from '../Icon';\nimport newId from '../utils/newId';\nimport Variant from '../utils/constants';\n\nclass Modal extends React.Component {\n constructor(props) {\n super(props);\n\n this.close = this.close.bind(this);\n\n this.headerId = newId();\n this.modalBodyRef = React.createRef();\n\n if (typeof document !== 'undefined') {\n this.el = document.createElement('div');\n // Sets true for IE11, false otherwise: https://stackoverflow.com/a/22082397/6620612\n this.isIE11 = !!global.MSInputMethodContext && !!document.documentMode;\n }\n\n this.state = {\n open: props.open,\n };\n }\n\n componentDidMount() {\n const { parentSelector } = this.props;\n this.parentElement = document.querySelector(parentSelector);\n if (this.parentElement === null) {\n throw new Error(`Modal received invalid parentSelector: ${parentSelector}, no matching element found`);\n }\n this.parentElement.appendChild(this.el);\n }\n\n componentDidUpdate(prevProps, prevState) {\n const { open } = this.props;\n if (open !== prevProps.open || open !== prevState.open) {\n // eslint-disable-next-line react/no-did-update-set-state\n this.setState({ open });\n }\n }\n\n componentWillUnmount() {\n if (this.parentElement) {\n ReactDOM.unmountComponentAtNode(this.parentElement);\n }\n }\n\n getVariantIconClassName() {\n const { variant } = this.props;\n let variantIconClassName;\n\n switch (variant.status) {\n case Variant.status.WARNING:\n variantIconClassName = classNames(\n 'fa',\n 'fa-exclamation-triangle',\n 'fa-3x',\n `text-${variant.status.toLowerCase()}`,\n );\n break;\n default:\n break;\n }\n\n return variantIconClassName;\n }\n\n getVariantGridBody(body) {\n const { variant } = this.props;\n\n return (\n <div className=\"container-fluid\">\n <div className=\"row\">\n <div className=\"col-md-10\">\n <div>\n {body}\n </div>\n </div>\n <div className=\"col-md-2\" data-testid=\"modal-icon\">\n <Icon\n id={newId(`Modal-${variant.status}`)}\n className={this.getVariantIconClassName()}\n />\n </div>\n </div>\n </div>\n );\n }\n\n getTabbableBodyElements() {\n if (this.modalBodyRef?.current) {\n return tabbable(this.modalBodyRef.current);\n }\n return [];\n }\n\n isValidVariantStatus() {\n const { variant } = this.props;\n return Object.values(Variant.status).includes(variant.status);\n }\n\n close(e) {\n if (e) {\n e.stopPropagation();\n }\n\n this.setState({ open: false });\n this.props.onClose();\n }\n\n renderButtons() {\n return this.props.buttons.map((button) => {\n // button is either a React component that we want clone or a set of props\n if (React.isValidElement(button)) {\n return React.cloneElement(button, {\n key: button.props.children,\n });\n }\n\n const { label, ...buttonProps } = button;\n\n return (\n <Button.Deprecated\n {...buttonProps}\n key={label}\n >\n {label}\n </Button.Deprecated>\n );\n });\n }\n\n renderBody() {\n let { body } = this.props;\n\n if (typeof body === 'string') {\n body = <p>{body}</p>;\n }\n\n if (this.isValidVariantStatus()) {\n body = this.getVariantGridBody(body);\n }\n\n return body;\n }\n\n renderModal() {\n const { open } = this.state;\n const {\n dialogClassName,\n renderDefaultCloseButton,\n renderHeaderCloseButton,\n buttons,\n closeText,\n title,\n } = this.props;\n\n const hasTabbableElements = (\n renderDefaultCloseButton\n || renderHeaderCloseButton\n || buttons.length > 0\n || this.getTabbableBodyElements().length > 0\n );\n const renderModalFooter = renderDefaultCloseButton || buttons.length > 0;\n\n return (\n <>\n <div\n className={classNames({\n 'modal-backdrop': open,\n show: open,\n fade: !open,\n })}\n role=\"presentation\"\n data-testid=\"modal-backdrop\"\n />\n <div\n className={classNames(\n 'modal',\n {\n show: open,\n fade: !open,\n 'd-block': open,\n 'is-ie11': this.isIE11,\n },\n )}\n role=\"presentation\"\n data-testid=\"modal\"\n >\n <div\n className={classNames(\n {\n 'modal-dialog': open,\n },\n dialogClassName,\n )}\n role=\"dialog\"\n aria-modal\n aria-labelledby={this.headerId}\n >\n <FocusOn\n enabled={open}\n onClickOutside={this.close}\n onEscapeKey={this.close}\n >\n <div\n className=\"modal-content\"\n data-testid=\"modal-content\"\n // if the modal doesn't contain any tabbable elements, make this element programmatically focusable.\n {...(!hasTabbableElements ? { tabIndex: -1 } : {})}\n >\n <div className=\"modal-header\">\n <h2 className=\"modal-title\" id={this.headerId}>{title}</h2>\n {renderHeaderCloseButton && (\n <Button.Deprecated\n className=\"p-1\"\n onClick={this.close}\n data-testid=\"modal-header-btn\"\n >\n <Icon src={Close} screenReaderText={closeText} />\n </Button.Deprecated>\n )}\n </div>\n <div className=\"modal-body\" ref={this.modalBodyRef} data-testid=\"modal-body\">\n {this.renderBody()}\n </div>\n {renderModalFooter && (\n <div className=\"modal-footer\">\n {renderDefaultCloseButton && (\n <Button\n variant=\"link\"\n onClick={this.close}\n data-testid=\"modal-footer-btn\"\n >\n {closeText}\n </Button>\n )}\n {this.renderButtons()}\n </div>\n )}\n </div>\n </FocusOn>\n </div>\n </div>\n </>\n );\n }\n\n render() {\n if (!this.el) {\n return null;\n }\n\n return ReactDOM.createPortal(\n this.renderModal(),\n this.el,\n );\n }\n}\n\nModal.propTypes = {\n /** specifies whether the modal renders open or closed on the initial render. It defaults to false. */\n open: PropTypes.bool,\n /** is the selector for an element in the dom which the modal should be rendered under.\n * It uses querySelector to find the first element that matches that selector,\n * and then creates a React portal to a div underneath the parent element.\n */\n parentSelector: PropTypes.string,\n /** a string or an element that is rendered inside of the modal title, above the modal body. */\n title: PropTypes.oneOfType([PropTypes.string, PropTypes.element]).isRequired,\n /** a string or an element that is rendered inside of the modal body, between the title and the footer. */\n body: PropTypes.oneOfType([PropTypes.string, PropTypes.element]).isRequired,\n /** an array of either elements or shapes that take the form of the buttonPropTypes.\n * See the [buttonPropTypes](https://github.com/openedx/paragon/blob/master/src/Button/index.jsx#L40)\n * for a list of acceptable props to pass as part of a button. */\n buttons: PropTypes.arrayOf(PropTypes.oneOfType([\n PropTypes.element,\n PropTypes.shape({}), // TODO: Only accept nodes in the future\n ])),\n /** specifies the display text of the default Close button. It defaults to \"Close\". */\n closeText: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),\n /** a function that is called on close. It can be used to perform actions upon closing of the modal,\n * such as restoring focus to the previous logical focusable element. */\n onClose: PropTypes.func.isRequired,\n variant: PropTypes.shape({\n status: PropTypes.string,\n }),\n /** specifies whether the default close button is rendered in the footer. It defaults to true. */\n renderDefaultCloseButton: PropTypes.bool,\n /** specifies whether a close button is rendered in the modal header. It defaults to true. */\n renderHeaderCloseButton: PropTypes.bool,\n /**\n * Specifies optional classes to add to the element with the '.modal-dialog' class.\n * See Bootstrap documentation for possible classes. Some options: modal-lg, modal-sm, modal-dialog-centered\n */\n dialogClassName: PropTypes.string,\n};\n\nModal.defaultProps = {\n open: false,\n parentSelector: 'body',\n buttons: [],\n closeText: 'Close',\n variant: {},\n renderDefaultCloseButton: true,\n renderHeaderCloseButton: true,\n dialogClassName: undefined,\n};\n\nexport default Modal;\n"],"mappings":";;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,QAAQ,MAAM,WAAW;AAChC,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,OAAO,QAAQ,gBAAgB;AACxC,SAASC,QAAQ,QAAQ,UAAU;AAEnC,SAASC,KAAK,QAAQ,aAAa;AACnC,OAAOC,MAAM,MAAM,WAAW;AAC9B,OAAOC,IAAI,MAAM,SAAS;AAC1B,OAAOC,KAAK,MAAM,gBAAgB;AAClC,OAAOC,OAAO,MAAM,oBAAoB;AAExC,MAAMC,KAAK,SAASX,KAAK,CAACY,SAAS,CAAC;EAClCC,WAAWA,CAACC,KAAK,EAAE;IACjB,KAAK,CAACA,KAAK,CAAC;IAEZ,IAAI,CAACC,KAAK,GAAG,IAAI,CAACA,KAAK,CAACC,IAAI,CAAC,IAAI,CAAC;IAElC,IAAI,CAACC,QAAQ,GAAGR,KAAK,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S,EAAE,OAAO;EAClBrC,OAAO,EAAE,CAAC,CAAC;EACXmC,wBAAwB,EAAE,IAAI;EAC9BC,uBAAuB,EAAE,IAAI;EAC7BF,eAAe,EAAEgC;AACnB,CAAC;AAED,eAAejG,KAAK"}
@@ -10,17 +10,17 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
10
10
  import React from 'react';
11
11
  import PropTypes from 'prop-types';
12
12
  import classNames from 'classnames';
13
- import Popover from 'react-bootstrap/Popover';
13
+ import BasePopover from 'react-bootstrap/Popover';
14
14
  import BasePopoverTitle from 'react-bootstrap/PopoverTitle';
15
15
  import BasePopoverContent from 'react-bootstrap/PopoverContent';
16
16
  const PLACEMENT_VARIANTS = ['auto', 'top', 'bottom', 'left', 'right'];
17
- const WrapperPopover = /*#__PURE__*/React.forwardRef((_ref, ref) => {
17
+ const Popover = /*#__PURE__*/React.forwardRef((_ref, ref) => {
18
18
  let {
19
19
  children,
20
20
  variant
21
21
  } = _ref,
22
22
  props = _objectWithoutProperties(_ref, _excluded);
23
- return /*#__PURE__*/React.createElement(Popover, _extends({}, props, {
23
+ return /*#__PURE__*/React.createElement(BasePopover, _extends({}, props, {
24
24
  className: classNames({
25
25
  [`popover-${variant}`]: !!variant
26
26
  }, props.className),
@@ -41,7 +41,7 @@ const commonPropTypes = {
41
41
  };
42
42
  PopoverTitle.propTypes = commonPropTypes;
43
43
  PopoverContent.propTypes = commonPropTypes;
44
- WrapperPopover.propTypes = _objectSpread(_objectSpread({}, Popover.propTypes), {}, {
44
+ Popover.propTypes = _objectSpread(_objectSpread({}, BasePopover.propTypes), {}, {
45
45
  /** An html id attribute, necessary for accessibility. */
46
46
  id: PropTypes.string.isRequired,
47
47
  /**
@@ -82,7 +82,7 @@ WrapperPopover.propTypes = _objectSpread(_objectSpread({}, Popover.propTypes), {
82
82
  /** The visual style of the `Overlay` */
83
83
  variant: PropTypes.string
84
84
  });
85
- WrapperPopover.defaultProps = _objectSpread(_objectSpread({}, Popover.defaultProps), {}, {
85
+ Popover.defaultProps = _objectSpread(_objectSpread({}, BasePopover.defaultProps), {}, {
86
86
  placement: 'right',
87
87
  title: undefined,
88
88
  arrowProps: undefined,
@@ -101,8 +101,8 @@ PopoverContent.defaultProps = {
101
101
  as: 'div',
102
102
  bsPrefix: 'popover-body'
103
103
  };
104
- WrapperPopover.Title = PopoverTitle;
105
- WrapperPopover.Content = PopoverContent;
104
+ Popover.Title = PopoverTitle;
105
+ Popover.Content = PopoverContent;
106
106
  export { PopoverTitle, PopoverContent };
107
- export default WrapperPopover;
107
+ export default Popover;
108
108
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["React","PropTypes","classNames","Popover","BasePopoverTitle","BasePopoverContent","PLACEMENT_VARIANTS","WrapperPopover","forwardRef","_ref","ref","children","variant","props","_objectWithoutProperties","_excluded","createElement","_extends","className","PopoverTitle","PopoverContent","commonPropTypes","as","elementType","bsPrefix","string","propTypes","_objectSpread","id","isRequired","placement","oneOf","title","arrowProps","shape","oneOfType","func","current","element","style","content","bool","popper","show","node","defaultProps","undefined","Title","Content"],"sources":["../../src/Popover/index.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport Popover from 'react-bootstrap/Popover';\nimport BasePopoverTitle from 'react-bootstrap/PopoverTitle';\nimport BasePopoverContent from 'react-bootstrap/PopoverContent';\n\nconst PLACEMENT_VARIANTS = [\n 'auto',\n 'top',\n 'bottom',\n 'left',\n 'right',\n];\n\nconst WrapperPopover = React.forwardRef(({\n children,\n variant,\n ...props\n}, ref) => (\n <Popover\n {...props}\n className={classNames({ [`popover-${variant}`]: !!variant }, props.className)}\n ref={ref}\n >\n {children}\n </Popover>\n));\n\nfunction PopoverTitle(props) {\n return <BasePopoverTitle {...props} />;\n}\nfunction PopoverContent(props) {\n return <BasePopoverContent {...props} />;\n}\n\nconst commonPropTypes = {\n /** Specifies the base element */\n as: PropTypes.elementType,\n /** Overrides underlying component base CSS class name */\n bsPrefix: PropTypes.string,\n};\n\nPopoverTitle.propTypes = commonPropTypes;\nPopoverContent.propTypes = commonPropTypes;\n\nWrapperPopover.propTypes = {\n ...Popover.propTypes,\n /** An html id attribute, necessary for accessibility. */\n id: PropTypes.string.isRequired,\n /**\n * Sets the direction the Popover is positioned towards.\n *\n * This is generally provided by the `Overlay` component positioning the popover.\n */\n placement: PropTypes.oneOf(PLACEMENT_VARIANTS),\n /**\n * When this prop is set, it creates a `Popover` with\n * a `Popover.Title` inside passing the children directly to it.\n */\n title: PropTypes.string,\n /**\n * An `Overlay` injected set of props for positioning the popover arrow.\n *\n * This is generally provided by the `Overlay` component positioning the popover.\n */\n arrowProps: PropTypes.shape({\n ref: PropTypes.oneOfType([\n PropTypes.func,\n PropTypes.shape({ current: PropTypes.element }),\n ]),\n style: PropTypes.shape({}),\n }),\n /**\n * When this prop is set, it creates a `Popover` with\n * a `Popover.Content` inside passing the children directly to it.\n */\n content: PropTypes.bool,\n /** A `Popper.js` config object passed to the the underlying popper instance. */\n popper: PropTypes.shape({}),\n /** Whether the `Overlay` is shown. */\n show: PropTypes.bool,\n /** Specifies the content of the `Overlay` */\n children: PropTypes.node,\n /** Specifies class name to append to the base element */\n className: PropTypes.string,\n /** The visual style of the `Overlay` */\n variant: PropTypes.string,\n};\n\nWrapperPopover.defaultProps = {\n ...Popover.defaultProps,\n placement: 'right',\n title: undefined,\n arrowProps: undefined,\n content: undefined,\n popper: undefined,\n show: undefined,\n children: undefined,\n className: undefined,\n variant: undefined,\n};\n\nPopoverTitle.defaultProps = {\n as: 'div',\n bsPrefix: 'popover-header',\n};\n\nPopoverContent.defaultProps = {\n as: 'div',\n bsPrefix: 'popover-body',\n};\n\nWrapperPopover.Title = PopoverTitle;\nWrapperPopover.Content = PopoverContent;\n\nexport { PopoverTitle, PopoverContent };\nexport default WrapperPopover;\n"],"mappings":";;;;;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,M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E,QAAQ,EAAE;AACZ,CAAC;AAEDJ,cAAc,CAACyB,YAAY,GAAG;EAC5BvB,EAAE,EAAE,KAAK;EACTE,QAAQ,EAAE;AACZ,CAAC;AAEDjB,cAAc,CAACwC,KAAK,GAAG5B,YAAY;AACnCZ,cAAc,CAACyC,OAAO,GAAG5B,cAAc;AAEvC,SAASD,YAAY,EAAEC,cAAc;AACrC,eAAeb,cAAc"}
1
+ {"version":3,"file":"index.js","names":["React","PropTypes","classNames","BasePopover","BasePopoverTitle","BasePopoverContent","PLACEMENT_VARIANTS","Popover","forwardRef","_ref","ref","children","variant","props","_objectWithoutProperties","_excluded","createElement","_extends","className","PopoverTitle","PopoverContent","commonPropTypes","as","elementType","bsPrefix","string","propTypes","_objectSpread","id","isRequired","placement","oneOf","title","arrowProps","shape","oneOfType","func","current","element","style","content","bool","popper","show","node","defaultProps","undefined","Title","Content"],"sources":["../../src/Popover/index.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport BasePopover from 'react-bootstrap/Popover';\nimport BasePopoverTitle from 'react-bootstrap/PopoverTitle';\nimport BasePopoverContent from 'react-bootstrap/PopoverContent';\n\nconst PLACEMENT_VARIANTS = [\n 'auto',\n 'top',\n 'bottom',\n 'left',\n 'right',\n];\n\nconst Popover = React.forwardRef(({\n children,\n variant,\n ...props\n}, ref) => (\n <BasePopover\n {...props}\n className={classNames({ [`popover-${variant}`]: !!variant }, props.className)}\n ref={ref}\n >\n {children}\n </BasePopover>\n));\n\nfunction PopoverTitle(props) {\n return <BasePopoverTitle {...props} />;\n}\nfunction PopoverContent(props) {\n return <BasePopoverContent {...props} />;\n}\n\nconst commonPropTypes = {\n /** Specifies the base element */\n as: PropTypes.elementType,\n /** Overrides underlying component base CSS class name */\n bsPrefix: PropTypes.string,\n};\n\nPopoverTitle.propTypes = commonPropTypes;\nPopoverContent.propTypes = commonPropTypes;\n\nPopover.propTypes = {\n ...BasePopover.propTypes,\n /** An html id attribute, necessary for accessibility. */\n id: PropTypes.string.isRequired,\n /**\n * Sets the direction the Popover is positioned towards.\n *\n * This is generally provided by the `Overlay` component positioning the popover.\n */\n placement: PropTypes.oneOf(PLACEMENT_VARIANTS),\n /**\n * When this prop is set, it creates a `Popover` with\n * a `Popover.Title` inside passing the children directly to it.\n */\n title: PropTypes.string,\n /**\n * An `Overlay` injected set of props for positioning the popover arrow.\n *\n * This is generally provided by the `Overlay` component positioning the popover.\n */\n arrowProps: PropTypes.shape({\n ref: PropTypes.oneOfType([\n PropTypes.func,\n PropTypes.shape({ current: PropTypes.element }),\n ]),\n style: PropTypes.shape({}),\n }),\n /**\n * When this prop is set, it creates a `Popover` with\n * a `Popover.Content` inside passing the children directly to it.\n */\n content: PropTypes.bool,\n /** A `Popper.js` config object passed to the the underlying popper instance. */\n popper: PropTypes.shape({}),\n /** Whether the `Overlay` is shown. */\n show: PropTypes.bool,\n /** Specifies the content of the `Overlay` */\n children: PropTypes.node,\n /** Specifies class name to append to the base element */\n className: PropTypes.string,\n /** The visual style of the `Overlay` */\n variant: PropTypes.string,\n};\n\nPopover.defaultProps = {\n ...BasePopover.defaultProps,\n placement: 'right',\n title: undefined,\n arrowProps: undefined,\n content: undefined,\n popper: undefined,\n show: undefined,\n children: undefined,\n className: undefined,\n variant: undefined,\n};\n\nPopoverTitle.defaultProps = {\n as: 'div',\n bsPrefix: 'popover-header',\n};\n\nPopoverContent.defaultProps = {\n as: 'div',\n bsPrefix: 'popover-body',\n};\n\nPopover.Title = PopoverTitle;\nPopover.Content = PopoverContent;\n\nexport { PopoverTitle, PopoverContent };\nexport default Popover;\n"],"mappings":";;;;;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,WAAW,MAAM,yBAAyB;AACjD,OAAOC,gBAAgB,MAAM,8BAA8B;AAC3D,OAAOC,kBAAkB,MAAM,gCAAgC;AAE/D,M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AAY;AAC5BZ,OAAO,CAACyC,OAAO,GAAG5B,cAAc;AAEhC,SAASD,YAAY,EAAEC,cAAc;AACrC,eAAeb,OAAO"}
@@ -12,6 +12,7 @@ import CheckpointActionRow from './CheckpointActionRow';
12
12
  import CheckpointBody from './CheckpointBody';
13
13
  import CheckpointBreadcrumbs from './CheckpointBreadcrumbs';
14
14
  import CheckpointTitle from './CheckpointTitle';
15
+ import messages from './messages';
15
16
  const Checkpoint = /*#__PURE__*/React.forwardRef((_ref, ref) => {
16
17
  let {
17
18
  body,
@@ -95,14 +96,11 @@ const Checkpoint = /*#__PURE__*/React.forwardRef((_ref, ref) => {
95
96
  }
96
97
  }, /*#__PURE__*/React.createElement("span", {
97
98
  className: "sr-only"
98
- }, /*#__PURE__*/React.createElement(FormattedMessage, {
99
- id: "pgn.ProductTour.Checkpoint.position-text",
100
- defaultMessage: "Top of step {step}",
101
- value: {
99
+ }, /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, messages.topPositionText, {
100
+ values: {
102
101
  step: index + 1
103
- },
104
- description: "Screen-reader message to indicate the user's position in a sequence of checkpoints."
105
- })), (title || !isOnlyCheckpoint) && /*#__PURE__*/React.createElement("div", {
102
+ }
103
+ }))), (title || !isOnlyCheckpoint) && /*#__PURE__*/React.createElement("div", {
106
104
  className: "pgn__checkpoint-header"
107
105
  }, /*#__PURE__*/React.createElement(CheckpointTitle, null, title), /*#__PURE__*/React.createElement(CheckpointBreadcrumbs, {
108
106
  currentIndex: index,
@@ -115,7 +113,11 @@ const Checkpoint = /*#__PURE__*/React.forwardRef((_ref, ref) => {
115
113
  "data-popper-arrow": true
116
114
  }), /*#__PURE__*/React.createElement("span", {
117
115
  className: "sr-only"
118
- }, "Bottom of step ", index + 1));
116
+ }, /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, messages.bottomPositionText, {
117
+ values: {
118
+ step: index + 1
119
+ }
120
+ }))));
119
121
  });
120
122
  Checkpoint.defaultProps = {
121
123
  advanceButtonText: null,
@@ -1 +1 @@
1
- {"version":3,"file":"Checkpoint.js","names":["React","useEffect","useState","useMediaQuery","PropTypes","createPopper","FormattedMessage","breakpoints","CheckpointActionRow","CheckpointBody","CheckpointBreadcrumbs","CheckpointTitle","Checkpoint","forwardRef","_ref","ref","body","index","placement","target","title","totalCheckpoints","props","_objectWithoutProperties","_excluded","checkpointVisible","setCheckpointVisible","isMobile","maxWidth","small","targetElement","document","querySelector","checkpoint","checkpointPopper","strategy","modifiers","name","options","padding","offset","tetherOffset","forceUpdate","targetOffset","getBoundingClientRect","top","bottom","global","innerHeight","includes","scrollTo","behavior","button","focus","isLastCheckpoint","isOnlyCheckpoint","createElement","id","className","role","style","visibility","pointerEvents","defaultMessage","value","step","description","currentIndex","_extends","defaultProps","advanceButtonText","dismissButtonText","endButtonText","showDismissButton","undefined","propTypes","node","number","isRequired","onAdvance","func","onDismiss","onEnd","oneOf","string","bool"],"sources":["../../src/ProductTour/Checkpoint.jsx"],"sourcesContent":["import React, { useEffect, useState } from 'react';\nimport { useMediaQuery } from 'react-responsive';\nimport PropTypes from 'prop-types';\nimport { createPopper } from '@popperjs/core';\nimport { FormattedMessage } from 'react-intl';\n\nimport breakpoints from '../utils/breakpoints';\n\nimport CheckpointActionRow from './CheckpointActionRow';\nimport CheckpointBody from './CheckpointBody';\nimport CheckpointBreadcrumbs from './CheckpointBreadcrumbs';\nimport CheckpointTitle from './CheckpointTitle';\n\nconst Checkpoint = React.forwardRef(({\n body,\n index,\n placement,\n target,\n title,\n totalCheckpoints,\n ...props\n}, ref) => {\n const [checkpointVisible, setCheckpointVisible] = useState(false);\n const isMobile = useMediaQuery({ maxWidth: breakpoints.small.maxWidth });\n\n useEffect(() => {\n const targetElement = document.querySelector(target);\n const checkpoint = document.querySelector('#pgn__checkpoint');\n if (targetElement && checkpoint) {\n // Use the Popper library to translate the Checkpoint to its target's coordinates\n const checkpointPopper = createPopper(targetElement, checkpoint, {\n placement: isMobile ? 'top' : placement,\n strategy: 'fixed',\n modifiers: [\n {\n name: 'arrow',\n options: {\n padding: 25,\n },\n },\n {\n name: 'offset',\n options: {\n offset: [0, 20],\n },\n },\n {\n name: 'preventOverflow',\n options: {\n padding: 20,\n tetherOffset: 35,\n },\n },\n ],\n });\n setCheckpointVisible(true);\n if (checkpointPopper) {\n checkpointPopper.forceUpdate();\n }\n }\n }, [target, isMobile, placement]);\n\n useEffect(() => {\n if (checkpointVisible) {\n // Scroll the Checkpoint into view once its rendered\n const targetElement = document.querySelector(target);\n let targetOffset = targetElement.getBoundingClientRect().top;\n if ((targetOffset < 0) || (targetElement.getBoundingClientRect().bottom > global.innerHeight)) {\n if (placement.includes('top')) {\n if (targetOffset < 0) {\n targetOffset *= -1;\n }\n targetOffset -= 280;\n } else {\n targetOffset -= 80;\n }\n\n global.scrollTo({\n top: targetOffset, behavior: 'smooth',\n });\n }\n\n const button = document.querySelector('.pgn__checkpoint-button_advance');\n button.focus();\n }\n }, [target, checkpointVisible, placement]);\n\n const isLastCheckpoint = index + 1 === totalCheckpoints;\n const isOnlyCheckpoint = totalCheckpoints === 1;\n\n return (\n <div\n id=\"pgn__checkpoint\"\n className=\"pgn__checkpoint\"\n aria-labelledby=\"pgn__checkpoint-title\"\n ref={ref}\n role=\"dialog\"\n style={{ visibility: checkpointVisible ? 'visible' : 'hidden', pointerEvents: checkpointVisible ? 'auto' : 'none' }}\n >\n <span className=\"sr-only\">\n <FormattedMessage\n id=\"pgn.ProductTour.Checkpoint.position-text\"\n defaultMessage=\"Top of step {step}\"\n value={{ step: index + 1 }}\n description=\"Screen-reader message to indicate the user's position in a sequence of checkpoints.\"\n />\n </span>\n {(title || !isOnlyCheckpoint) && (\n <div className=\"pgn__checkpoint-header\">\n <CheckpointTitle>{title}</CheckpointTitle>\n <CheckpointBreadcrumbs currentIndex={index} totalCheckpoints={totalCheckpoints} />\n </div>\n )}\n <CheckpointBody>{body}</CheckpointBody>\n <CheckpointActionRow\n isLastCheckpoint={isLastCheckpoint}\n index={index}\n {...props}\n />\n <div id=\"pgn__checkpoint-arrow\" data-popper-arrow />\n {/* This text is not translated due to Paragon's lack of i18n support */}\n <span className=\"sr-only\">Bottom of step {index + 1}</span>\n </div>\n );\n});\n\nCheckpoint.defaultProps = {\n advanceButtonText: null,\n body: null,\n dismissButtonText: null,\n endButtonText: null,\n placement: 'top',\n title: null,\n showDismissButton: undefined,\n};\n\nCheckpoint.propTypes = {\n /** The text displayed on the button used to advance the tour for the given Checkpoint. */\n advanceButtonText: PropTypes.node,\n /** The text displayed in the body of the Checkpoint */\n body: PropTypes.node,\n /** The text displayed on the button used to dismiss the tour for the given Checkpoint. */\n dismissButtonText: PropTypes.node,\n /** The text displayed on the button used to end the tour for the given Checkpoint. */\n endButtonText: PropTypes.node,\n /** The current index of the given Checkpoint */\n index: PropTypes.number.isRequired,\n /** A function that runs when triggering the `onClick` event of the advance\n * button for the given Checkpoint. */\n onAdvance: PropTypes.func.isRequired,\n /** A function that runs when triggering the `onClick` event of the dismiss\n * button for the given Checkpoint. */\n onDismiss: PropTypes.func.isRequired,\n /** A function that runs when triggering the `onClick` event of the advance\n * button if the given Checkpoint is the only or last Checkpoint in a tour. */\n onEnd: PropTypes.func.isRequired,\n /** A string that dictates the alignment of the Checkpoint around its target. */\n placement: PropTypes.oneOf([\n 'top', 'top-start', 'top-end', 'right-start', 'right', 'right-end',\n 'left-start', 'left', 'left-end', 'bottom', 'bottom-start', 'bottom-end',\n ]),\n /** The CSS selector for the Checkpoint's desired target. */\n target: PropTypes.string.isRequired,\n /** The text displayed in the title of the Checkpoint */\n title: PropTypes.node,\n /** The total number of Checkpoints in a tour */\n totalCheckpoints: PropTypes.number.isRequired,\n /** Enforces visibility of the dismiss button under all circumstances */\n showDismissButton: PropTypes.bool,\n};\n\nexport default Checkpoint;\n"],"mappings":";;;;AAAA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAClD,SAASC,aAAa,QAAQ,kBAAkB;AAChD,OAAOC,SAAS,MAAM,YAAY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","useState","useMediaQuery","PropTypes","createPopper","FormattedMessage","breakpoints","CheckpointActionRow","CheckpointBody","CheckpointBreadcrumbs","CheckpointTitle","messages","Checkpoint","forwardRef","_ref","ref","body","index","placement","target","title","totalCheckpoints","props","_objectWithoutProperties","_excluded","checkpointVisible","setCheckpointVisible","isMobile","maxWidth","small","targetElement","document","querySelector","checkpoint","checkpointPopper","strategy","modifiers","name","options","padding","offset","tetherOffset","forceUpdate","targetOffset","getBoundingClientRect","top","bottom","global","innerHeight","includes","scrollTo","behavior","button","focus","isLastCheckpoint","isOnlyCheckpoint","createElement","id","className","role","style","visibility","pointerEvents","_extends","topPositionText","values","step","currentIndex","bottomPositionText","defaultProps","advanceButtonText","dismissButtonText","endButtonText","showDismissButton","undefined","propTypes","node","number","isRequired","onAdvance","func","onDismiss","onEnd","oneOf","string","bool"],"sources":["../../src/ProductTour/Checkpoint.jsx"],"sourcesContent":["import React, { useEffect, useState } from 'react';\nimport { useMediaQuery } from 'react-responsive';\nimport PropTypes from 'prop-types';\nimport { createPopper } from '@popperjs/core';\nimport { FormattedMessage } from 'react-intl';\n\nimport breakpoints from '../utils/breakpoints';\n\nimport CheckpointActionRow from './CheckpointActionRow';\nimport CheckpointBody from './CheckpointBody';\nimport CheckpointBreadcrumbs from './CheckpointBreadcrumbs';\nimport CheckpointTitle from './CheckpointTitle';\nimport messages from './messages';\n\nconst Checkpoint = React.forwardRef(({\n body,\n index,\n placement,\n target,\n title,\n totalCheckpoints,\n ...props\n}, ref) => {\n const [checkpointVisible, setCheckpointVisible] = useState(false);\n const isMobile = useMediaQuery({ maxWidth: breakpoints.small.maxWidth });\n\n useEffect(() => {\n const targetElement = document.querySelector(target);\n const checkpoint = document.querySelector('#pgn__checkpoint');\n if (targetElement && checkpoint) {\n // Use the Popper library to translate the Checkpoint to its target's coordinates\n const checkpointPopper = createPopper(targetElement, checkpoint, {\n placement: isMobile ? 'top' : placement,\n strategy: 'fixed',\n modifiers: [\n {\n name: 'arrow',\n options: {\n padding: 25,\n },\n },\n {\n name: 'offset',\n options: {\n offset: [0, 20],\n },\n },\n {\n name: 'preventOverflow',\n options: {\n padding: 20,\n tetherOffset: 35,\n },\n },\n ],\n });\n setCheckpointVisible(true);\n if (checkpointPopper) {\n checkpointPopper.forceUpdate();\n }\n }\n }, [target, isMobile, placement]);\n\n useEffect(() => {\n if (checkpointVisible) {\n // Scroll the Checkpoint into view once its rendered\n const targetElement = document.querySelector(target);\n let targetOffset = targetElement.getBoundingClientRect().top;\n if ((targetOffset < 0) || (targetElement.getBoundingClientRect().bottom > global.innerHeight)) {\n if (placement.includes('top')) {\n if (targetOffset < 0) {\n targetOffset *= -1;\n }\n targetOffset -= 280;\n } else {\n targetOffset -= 80;\n }\n\n global.scrollTo({\n top: targetOffset, behavior: 'smooth',\n });\n }\n\n const button = document.querySelector('.pgn__checkpoint-button_advance');\n button.focus();\n }\n }, [target, checkpointVisible, placement]);\n\n const isLastCheckpoint = index + 1 === totalCheckpoints;\n const isOnlyCheckpoint = totalCheckpoints === 1;\n\n return (\n <div\n id=\"pgn__checkpoint\"\n className=\"pgn__checkpoint\"\n aria-labelledby=\"pgn__checkpoint-title\"\n ref={ref}\n role=\"dialog\"\n style={{ visibility: checkpointVisible ? 'visible' : 'hidden', pointerEvents: checkpointVisible ? 'auto' : 'none' }}\n >\n <span className=\"sr-only\">\n <FormattedMessage\n {...messages.topPositionText}\n values={{ step: index + 1 }}\n />\n </span>\n {(title || !isOnlyCheckpoint) && (\n <div className=\"pgn__checkpoint-header\">\n <CheckpointTitle>{title}</CheckpointTitle>\n <CheckpointBreadcrumbs currentIndex={index} totalCheckpoints={totalCheckpoints} />\n </div>\n )}\n <CheckpointBody>{body}</CheckpointBody>\n <CheckpointActionRow\n isLastCheckpoint={isLastCheckpoint}\n index={index}\n {...props}\n />\n <div id=\"pgn__checkpoint-arrow\" data-popper-arrow />\n <span className=\"sr-only\">\n <FormattedMessage\n {...messages.bottomPositionText}\n values={{ step: index + 1 }}\n />\n </span>\n </div>\n );\n});\n\nCheckpoint.defaultProps = {\n advanceButtonText: null,\n body: null,\n dismissButtonText: null,\n endButtonText: null,\n placement: 'top',\n title: null,\n showDismissButton: undefined,\n};\n\nCheckpoint.propTypes = {\n /** The text displayed on the button used to advance the tour for the given Checkpoint. */\n advanceButtonText: PropTypes.node,\n /** The text displayed in the body of the Checkpoint */\n body: PropTypes.node,\n /** The text displayed on the button used to dismiss the tour for the given Checkpoint. */\n dismissButtonText: PropTypes.node,\n /** The text displayed on the button used to end the tour for the given Checkpoint. */\n endButtonText: PropTypes.node,\n /** The current index of the given Checkpoint */\n index: PropTypes.number.isRequired,\n /** A function that runs when triggering the `onClick` event of the advance\n * button for the given Checkpoint. */\n onAdvance: PropTypes.func.isRequired,\n /** A function that runs when triggering the `onClick` event of the dismiss\n * button for the given Checkpoint. */\n onDismiss: PropTypes.func.isRequired,\n /** A function that runs when triggering the `onClick` event of the advance\n * button if the given Checkpoint is the only or last Checkpoint in a tour. */\n onEnd: PropTypes.func.isRequired,\n /** A string that dictates the alignment of the Checkpoint around its target. */\n placement: PropTypes.oneOf([\n 'top', 'top-start', 'top-end', 'right-start', 'right', 'right-end',\n 'left-start', 'left', 'left-end', 'bottom', 'bottom-start', 'bottom-end',\n ]),\n /** The CSS selector for the Checkpoint's desired target. */\n target: PropTypes.string.isRequired,\n /** The text displayed in the title of the Checkpoint */\n title: PropTypes.node,\n /** The total number of Checkpoints in a tour */\n totalCheckpoints: PropTypes.number.isRequired,\n /** Enforces visibility of the dismiss button under all circumstances */\n showDismissButton: PropTypes.bool,\n};\n\nexport default Checkpoint;\n"],"mappings":";;;;AAAA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAClD,SAASC,aAAa,QAAQ,kBAAkB;AAChD,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,gBAAgB,QAAQ,YAAY;AAE7C,OAAOC,WAAW,MAAM,sBAAsB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1
+ import { defineMessages } from 'react-intl';
2
+
3
+ const messages = defineMessages({
4
+ topPositionText: {
5
+ id: 'pgn.ProductTour.Checkpoint.top-position-text',
6
+ defaultMessage: 'Top of step {step}',
7
+ description: 'Screen-reader message to notify user that they are located at the bottom of the product tour step.',
8
+ },
9
+ bottomPositionText: {
10
+ id: 'pgn.ProductTour.Checkpoint.bottom-position-text',
11
+ defaultMessage: 'Bottom of step {step}',
12
+ description: 'Screen-reader message to notify user that they are located at the bottom of the product tour step.',
13
+ },
14
+ });
15
+
16
+ export default messages;
@@ -2,7 +2,6 @@ const _excluded = ["children", "className", "screenReaderText", "icons", "onSubm
2
2
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3
3
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
4
4
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
5
- /* eslint-disable max-len */
6
5
  import React, { useRef, createContext, useState, useEffect } from 'react';
7
6
  import PropTypes from 'prop-types';
8
7
  import classNames from 'classnames';
@@ -108,27 +107,32 @@ SearchFieldAdvanced.propTypes = {
108
107
  onSubmit: PropTypes.func.isRequired,
109
108
  /** specifies a custom class name. */
110
109
  className: PropTypes.string,
111
- /** specifies a callback function for when the user loses focus in the `SearchField` component. The default is an empty function. For example:
110
+ /** specifies a callback function for when the user loses focus in the `SearchField` component.
111
+ * The default is an empty function. For example:
112
112
  ```jsx
113
113
  <SearchField onBlur={event => console.log(event)} />
114
114
  ``` */
115
115
  onBlur: PropTypes.func,
116
- /** specifies a callback function for when the value in `SearchField` is changed by the user. The default is an empty function. For example:
116
+ /** specifies a callback function for when the value in `SearchField` is changed by the user.
117
+ * The default is an empty function. For example:
117
118
  ```jsx
118
119
  <SearchField onChange={value => console.log(value)} />
119
120
  ``` */
120
121
  onChange: PropTypes.func,
121
- /** specifies a callback function for when the value in `SearchField` is cleared by the user. The default is an empty function. For example:
122
+ /** specifies a callback function for when the value in `SearchField` is cleared by the user.
123
+ * The default is an empty function. For example:
122
124
  ```jsx
123
125
  <SearchField onClear={() => console.log('search cleared')} />
124
126
  ``` */
125
127
  onClear: PropTypes.func,
126
- /** specifies a callback function for when the user focuses in the `SearchField` component. The default is an empty function. For example:
128
+ /** specifies a callback function for when the user focuses in the `SearchField` component.
129
+ * The default is an empty function. For example:
127
130
  ```jsx
128
131
  <SearchField onFocus={event => console.log(event)} />
129
132
  ``` */
130
133
  onFocus: PropTypes.func,
131
- /** specifies the screenreader text for both the clear and submit buttons (e.g., for i18n translations). The default is `{ label: 'search', clearButton: 'clear search', searchButton: 'submit search' }`. */
134
+ /** specifies the screenreader text for both the clear and submit buttons (e.g., for i18n translations).
135
+ * The default is `{ label: 'search', clearButton: 'clear search', searchButton: 'submit search' }`. */
132
136
  screenReaderText: PropTypes.shape({
133
137
  label: PropTypes.oneOfType([PropTypes.string, PropTypes.element]).isRequired,
134
138
  submitButton: PropTypes.oneOfType([PropTypes.string, PropTypes.element]).isRequired,
@@ -141,7 +145,8 @@ SearchFieldAdvanced.propTypes = {
141
145
  submit: PropTypes.element.isRequired,
142
146
  clear: PropTypes.element
143
147
  }),
144
- /** specifies the aria-label attribute on the form element. This is useful if you use the `SearchField` component more than once on a page. */
148
+ /** specifies the aria-label attribute on the form element. This is useful if you use the `SearchField` component
149
+ * more than once on a page. */
145
150
  formAriaLabel: PropTypes.string,
146
151
  /** Specifies whether the `SearchField` is disabled. */
147
152
  disabled: PropTypes.bool,