@openedx/paragon 21.12.0 → 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 (88) hide show
  1. package/dist/Container/index.js +6 -2
  2. package/dist/Container/index.js.map +1 -1
  3. package/dist/Dropdown/index.js.map +1 -1
  4. package/dist/Form/FormSwitch.js +3 -0
  5. package/dist/Form/FormSwitch.js.map +1 -1
  6. package/dist/Hyperlink/index.js +7 -6
  7. package/dist/Hyperlink/index.js.map +1 -1
  8. package/dist/Icon/index.js +17 -10
  9. package/dist/Icon/index.js.map +1 -1
  10. package/dist/IconButton/index.js +1 -1
  11. package/dist/IconButton/index.js.map +1 -1
  12. package/dist/Layout/index.js.map +1 -1
  13. package/dist/Modal/ModalDialog.js +3 -0
  14. package/dist/Modal/ModalDialog.js.map +1 -1
  15. package/dist/Modal/index.js +11 -6
  16. package/dist/Modal/index.js.map +1 -1
  17. package/dist/Popover/index.js +8 -8
  18. package/dist/Popover/index.js.map +1 -1
  19. package/dist/ProductTour/Checkpoint.js +10 -8
  20. package/dist/ProductTour/Checkpoint.js.map +1 -1
  21. package/dist/ProductTour/messages.js +16 -0
  22. package/dist/SearchField/SearchFieldAdvanced.js +12 -7
  23. package/dist/SearchField/SearchFieldAdvanced.js.map +1 -1
  24. package/dist/SearchField/SearchFieldLabel.js +3 -3
  25. package/dist/SearchField/SearchFieldLabel.js.map +1 -1
  26. package/dist/SearchField/index.js +0 -1
  27. package/dist/SearchField/index.js.map +1 -1
  28. package/dist/Tabs/index.js +13 -13
  29. package/dist/Tabs/index.js.map +1 -1
  30. package/dist/hooks/useIndexOfLastVisibleChild.js +33 -38
  31. package/dist/hooks/useIndexOfLastVisibleChild.js.map +1 -1
  32. package/dist/i18n/messages/ar.json +2 -1
  33. package/dist/i18n/messages/ca.json +2 -1
  34. package/dist/i18n/messages/es_419.json +2 -1
  35. package/dist/i18n/messages/es_AR.json +2 -1
  36. package/dist/i18n/messages/es_ES.json +2 -1
  37. package/dist/i18n/messages/fr.json +2 -1
  38. package/dist/i18n/messages/he.json +2 -1
  39. package/dist/i18n/messages/id.json +2 -1
  40. package/dist/i18n/messages/it_IT.json +2 -1
  41. package/dist/i18n/messages/ko_KR.json +2 -1
  42. package/dist/i18n/messages/pl.json +2 -1
  43. package/dist/i18n/messages/pt_BR.json +2 -1
  44. package/dist/i18n/messages/pt_PT.json +2 -1
  45. package/dist/i18n/messages/ru.json +2 -1
  46. package/dist/i18n/messages/th.json +2 -1
  47. package/dist/i18n/messages/tr_TR.json +2 -1
  48. package/dist/i18n/messages/uk.json +2 -1
  49. package/dist/i18n/messages/zh_CN.json +2 -1
  50. package/package.json +1 -1
  51. package/src/Container/index.jsx +4 -0
  52. package/src/Dropdown/index.jsx +4 -0
  53. package/src/Form/FormSwitch.jsx +3 -0
  54. package/src/Hyperlink/index.jsx +7 -6
  55. package/src/Icon/index.jsx +17 -10
  56. package/src/IconButton/index.jsx +1 -1
  57. package/src/Layout/index.jsx +1 -4
  58. package/src/Modal/ModalDialog.jsx +3 -0
  59. package/src/Modal/index.jsx +11 -6
  60. package/src/Popover/README.md +0 -1
  61. package/src/Popover/index.jsx +11 -11
  62. package/src/ProductTour/Checkpoint.jsx +9 -6
  63. package/src/ProductTour/messages.js +16 -0
  64. package/src/SearchField/SearchFieldAdvanced.jsx +12 -7
  65. package/src/SearchField/SearchFieldLabel.jsx +3 -3
  66. package/src/SearchField/index.jsx +0 -1
  67. package/src/Tabs/index.jsx +19 -13
  68. package/src/hooks/tests/useIndexOfLastVisibleChild.test.jsx +3 -3
  69. package/src/hooks/useIndexOfLastVisibleChild.jsx +36 -38
  70. package/src/hooks/useIndexOfLastVisibleChild.mdx +3 -3
  71. package/src/i18n/messages/ar.json +2 -1
  72. package/src/i18n/messages/ca.json +2 -1
  73. package/src/i18n/messages/es_419.json +2 -1
  74. package/src/i18n/messages/es_AR.json +2 -1
  75. package/src/i18n/messages/es_ES.json +2 -1
  76. package/src/i18n/messages/fr.json +2 -1
  77. package/src/i18n/messages/he.json +2 -1
  78. package/src/i18n/messages/id.json +2 -1
  79. package/src/i18n/messages/it_IT.json +2 -1
  80. package/src/i18n/messages/ko_KR.json +2 -1
  81. package/src/i18n/messages/pl.json +2 -1
  82. package/src/i18n/messages/pt_BR.json +2 -1
  83. package/src/i18n/messages/pt_PT.json +2 -1
  84. package/src/i18n/messages/ru.json +2 -1
  85. package/src/i18n/messages/th.json +2 -1
  86. package/src/i18n/messages/tr_TR.json +2 -1
  87. package/src/i18n/messages/uk.json +2 -1
  88. package/src/i18n/messages/zh_CN.json +2 -1
@@ -32,17 +32,21 @@ const Container = /*#__PURE__*/forwardRef((_ref, ref) => {
32
32
  Container.propTypes = _objectSpread(_objectSpread({}, RBContainer.propTypes), {}, {
33
33
  /** Override the base element */
34
34
  as: PropTypes.elementType,
35
+ /** Specifies the contents of the container */
35
36
  children: PropTypes.node,
36
37
  /** Fill all available space at any breakpoint */
37
38
  fluid: PropTypes.bool,
38
39
  /** Set the maximum width for the container */
39
- size: PropTypes.oneOf(Object.keys(SIZE_CLASS_NAMES))
40
+ size: PropTypes.oneOf(Object.keys(SIZE_CLASS_NAMES)),
41
+ /** Overrides underlying component base CSS class name */
42
+ bsPrefix: PropTypes.string
40
43
  });
41
44
  Container.defaultProps = {
42
45
  as: 'div',
43
46
  children: undefined,
44
47
  fluid: true,
45
- size: undefined
48
+ size: undefined,
49
+ bsPrefix: 'container'
46
50
  };
47
51
  export default Container;
48
52
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["React","forwardRef","classNames","RBContainer","PropTypes","SIZE_CLASS_NAMES","xs","sm","md","lg","xl","Container","_ref","ref","size","children","props","_objectWithoutProperties","_excluded","createElement","_extends","className","propTypes","_objectSpread","as","elementType","node","fluid","bool","oneOf","Object","keys","defaultProps","undefined"],"sources":["../../src/Container/index.jsx"],"sourcesContent":["import React, { forwardRef } from 'react';\nimport classNames from 'classnames';\nimport RBContainer from 'react-bootstrap/Container';\nimport PropTypes from 'prop-types';\n\nconst SIZE_CLASS_NAMES = {\n xs: 'container-mw-xs',\n sm: 'container-mw-sm',\n md: 'container-mw-md',\n lg: 'container-mw-lg',\n xl: 'container-mw-xl',\n};\n\nconst Container = forwardRef(({ size, children, ...props }, ref) => (\n <RBContainer\n {...props}\n ref={ref}\n className={classNames(\n props.className,\n SIZE_CLASS_NAMES[size],\n )}\n >\n {children}\n </RBContainer>\n));\n\nContainer.propTypes = {\n ...RBContainer.propTypes,\n /** Override the base element */\n as: PropTypes.elementType,\n children: PropTypes.node,\n /** Fill all available space at any breakpoint */\n fluid: PropTypes.bool,\n /** Set the maximum width for the container */\n size: PropTypes.oneOf(Object.keys(SIZE_CLASS_NAMES)),\n};\n\nContainer.defaultProps = {\n as: 'div',\n children: undefined,\n fluid: true,\n size: undefined,\n};\n\nexport default Container;\n"],"mappings":";;;;;;;;;AAAA,OAAOA,KAAK,IAAIC,UAAU,QAAQ,OAAO;AACzC,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,WAAW,MAAM,2BAA2B;AACnD,OAAOC,SAAS,MAAM,YAAY;AAElC,MAAMC,gBAAgB,GAAG;EACvBC,EAAE,EAAE,iBAAiB;EACrBC,EAAE,EAAE,iBAAiB;EACrBC,EAAE,EAAE,iBAAiB;EACrBC,EAAE,EAAE,iBAAiB;EACrBC,EAAE,EAAE;AACN,CAAC;AAED,MAAMC,SAAS,gBAAGV,UAAU,CAAC,CAAAW,IAAA,EAA+BC,GAAG;EAAA,IAAjC;MAAEC,IAAI;MAAEC;IAAmB,CAAC,GAAAH,IAAA;IAAPI,KAAK,GAAAC,wBAAA,CAAAL,IAAA,EAAAM,SAAA;EAAA,oBACtDlB,KAAA,CAAAmB,aAAA,CAAChB,WAAW,EAAAiB,QAAA,KACNJ,KAAK;IACTH,GAAG,EAAEA,GAAI;IACTQ,SAAS,EAAEnB,UAAU,CACnBc,KAAK,CAACK,SAAS,EACfhB,gBAAgB,CAACS,IAAI,CACvB;EAAE,IAEDC,QACU,CAAC;AAAA,CACf,CAAC;AAEFJ,SAAS,CAACW,SAAS,GAAAC,aAAA,CAAAA,aAAA,KACdpB,WAAW,CAACmB,SAAS;EACxB;EACAE,EAAE,EAAEpB,SAAS,CAACqB,WAAW;EACzBV,QAAQ,EAAEX,SAAS,CAACsB,IAAI;EACxB;EACAC,KAAK,EAAEvB,SAAS,CAACwB,IAAI;EACrB;EACAd,IAAI,EAAEV,SAAS,CAACyB,KAAK,CAACC,MAAM,CAACC,IAAI,CAAC1B,gBAAgB,CAAC;AAAC,EACrD;AAEDM,SAAS,CAACqB,YAAY,GAAG;EACvBR,EAAE,EAAE,KAAK;EACTT,QAAQ,EAAEkB,SAAS;EACnBN,KAAK,EAAE,IAAI;EACXb,IAAI,EAAEmB;AACR,CAAC;AAED,eAAetB,SAAS"}
1
+ {"version":3,"file":"index.js","names":["React","forwardRef","classNames","RBContainer","PropTypes","SIZE_CLASS_NAMES","xs","sm","md","lg","xl","Container","_ref","ref","size","children","props","_objectWithoutProperties","_excluded","createElement","_extends","className","propTypes","_objectSpread","as","elementType","node","fluid","bool","oneOf","Object","keys","bsPrefix","string","defaultProps","undefined"],"sources":["../../src/Container/index.jsx"],"sourcesContent":["import React, { forwardRef } from 'react';\nimport classNames from 'classnames';\nimport RBContainer from 'react-bootstrap/Container';\nimport PropTypes from 'prop-types';\n\nconst SIZE_CLASS_NAMES = {\n xs: 'container-mw-xs',\n sm: 'container-mw-sm',\n md: 'container-mw-md',\n lg: 'container-mw-lg',\n xl: 'container-mw-xl',\n};\n\nconst Container = forwardRef(({ size, children, ...props }, ref) => (\n <RBContainer\n {...props}\n ref={ref}\n className={classNames(\n props.className,\n SIZE_CLASS_NAMES[size],\n )}\n >\n {children}\n </RBContainer>\n));\n\nContainer.propTypes = {\n ...RBContainer.propTypes,\n /** Override the base element */\n as: PropTypes.elementType,\n /** Specifies the contents of the container */\n children: PropTypes.node,\n /** Fill all available space at any breakpoint */\n fluid: PropTypes.bool,\n /** Set the maximum width for the container */\n size: PropTypes.oneOf(Object.keys(SIZE_CLASS_NAMES)),\n /** Overrides underlying component base CSS class name */\n bsPrefix: PropTypes.string,\n};\n\nContainer.defaultProps = {\n as: 'div',\n children: undefined,\n fluid: true,\n size: undefined,\n bsPrefix: 'container',\n};\n\nexport default Container;\n"],"mappings":";;;;;;;;;AAAA,OAAOA,KAAK,IAAIC,UAAU,QAAQ,OAAO;AACzC,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,WAAW,MAAM,2BAA2B;AACnD,OAAOC,SAAS,MAAM,YAAY;AAElC,MAAMC,gBAAgB,GAAG;EACvBC,EAAE,EAAE,iBAAiB;EACrBC,EAAE,EAAE,iBAAiB;EACrBC,EAAE,EAAE,iBAAiB;EACrBC,EAAE,EAAE,iBAAiB;EACrBC,EAAE,EAAE;AACN,CAAC;AAED,MAAMC,SAAS,gBAAGV,UAAU,CAAC,CAAAW,IAAA,EAA+BC,GAAG;EAAA,IAAjC;MAAEC,IAAI;MAAEC;IAAmB,CAAC,GAAAH,IAAA;IAAPI,KAAK,GAAAC,wBAAA,CAAAL,IAAA,EAAAM,SAAA;EAAA,oBACtDlB,KAAA,CAAAmB,aAAA,CAAChB,WAAW,EAAAiB,QAAA,KACNJ,KAAK;IACTH,GAAG,EAAEA,GAAI;IACTQ,SAAS,EAAEnB,UAAU,CACnBc,KAAK,CAACK,SAAS,EACfhB,gBAAgB,CAACS,IAAI,CACvB;EAAE,IAEDC,QACU,CAAC;AAAA,CACf,CAAC;AAEFJ,SAAS,CAACW,SAAS,GAAAC,aAAA,CAAAA,aAAA,KACdpB,WAAW,CAACmB,SAAS;EACxB;EACAE,EAAE,EAAEpB,SAAS,CAACqB,WAAW;EACzB;EACAV,QAAQ,EAAEX,SAAS,CAACsB,IAAI;EACxB;EACAC,KAAK,EAAEvB,SAAS,CAACwB,IAAI;EACrB;EACAd,IAAI,EAAEV,SAAS,CAACyB,KAAK,CAACC,MAAM,CAACC,IAAI,CAAC1B,gBAAgB,CAAC,CAAC;EACpD;EACA2B,QAAQ,EAAE5B,SAAS,CAAC6B;AAAM,EAC3B;AAEDtB,SAAS,CAACuB,YAAY,GAAG;EACvBV,EAAE,EAAE,KAAK;EACTT,QAAQ,EAAEoB,SAAS;EACnBR,KAAK,EAAE,IAAI;EACXb,IAAI,EAAEqB,SAAS;EACfH,QAAQ,EAAE;AACZ,CAAC;AAED,eAAerB,SAAS"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["React","classNames","PropTypes","BaseDropdown","DropdownMenu","BaseDropdownItem","BaseDropdownToggle","DropdownDeprecated","Button","IconButton","Dropdown","forwardRef","_ref","ref","show","autoClose","onToggle","variant","className","rest","_objectWithoutProperties","_excluded","internalShow","setInternalShow","useState","isClosingPermitted","source","handleToggle","isOpen","event","metadata","_objectSpread","currentTarget","document","key","createElement","_extends","propTypes","oneOfType","string","bool","func","oneOf","defaultProps","undefined","DropdownToggle","_ref2","as","bsPrefix","otherProps","_excluded2","prefix","elementType","id","number","isRequired","Item","DropdownItem","_ref3","_excluded3","Deprecated","Toggle","Menu","Header","Divider","default","DropdownButton","SplitButton"],"sources":["../../src/Dropdown/index.jsx"],"sourcesContent":["import React from 'react';\nimport classNames from 'classnames';\nimport PropTypes from 'prop-types';\nimport BaseDropdown from 'react-bootstrap/Dropdown';\nimport DropdownMenu from 'react-bootstrap/DropdownMenu';\nimport BaseDropdownItem from 'react-bootstrap/DropdownItem';\nimport BaseDropdownToggle from 'react-bootstrap/DropdownToggle';\nimport DropdownDeprecated from './deprecated';\nimport Button from '../Button';\nimport IconButton from '../IconButton';\n\nconst Dropdown = React.forwardRef(\n // eslint-disable-next-line prefer-arrow-callback\n function Dropdown({\n show,\n autoClose,\n onToggle,\n variant,\n className,\n ...rest\n }, ref) {\n const [internalShow, setInternalShow] = React.useState(show);\n const isClosingPermitted = (source) => {\n // autoClose=false only permits close on button click\n if (autoClose === false) {\n return source === 'click';\n }\n // autoClose=inside doesn't permit close on rootClose\n if (autoClose === 'inside') {\n return source !== 'rootClose';\n }\n // autoClose=outside doesn't permit close on select\n if (autoClose === 'outside') {\n return source !== 'select';\n }\n return true;\n };\n\n const handleToggle = (isOpen, event, metadata) => {\n if (isOpen) {\n setInternalShow(true);\n onToggle?.(isOpen, event, metadata);\n return;\n }\n let { source } = { ...metadata };\n\n if (event.currentTarget === document && (source !== 'keydown' || event.key === 'Escape')) {\n source = 'rootClose';\n }\n if (isClosingPermitted(source)) {\n setInternalShow(false);\n onToggle?.(isOpen, event, metadata);\n }\n };\n\n return (\n <BaseDropdown\n className={classNames(\n 'pgn__dropdown',\n `pgn__dropdown-${variant}`,\n className,\n )}\n data-testid=\"dropdown\"\n onToggle={handleToggle}\n ref={ref}\n show={internalShow}\n {...rest}\n />\n );\n },\n);\nDropdown.propTypes = {\n autoClose: PropTypes.oneOfType([\n PropTypes.string,\n PropTypes.bool,\n ]),\n className: PropTypes.string,\n onToggle: PropTypes.func,\n show: PropTypes.bool,\n variant: PropTypes.oneOf(['light', 'dark']),\n};\nDropdown.defaultProps = {\n autoClose: true,\n className: '',\n onToggle: undefined,\n show: false,\n variant: 'light',\n};\n\nconst DropdownToggle = React.forwardRef(\n // eslint-disable-next-line prefer-arrow-callback\n function DropdownToggle({\n as,\n bsPrefix,\n ...otherProps\n }, ref) {\n // hide arrow from the toggle if it is rendered as IconButton\n // because it hinders the positioning of IconButton\n const prefix = as === IconButton ? 'pgn__dropdown-toggle-iconbutton' : bsPrefix;\n return <BaseDropdownToggle {...otherProps} as={as} bsPrefix={prefix} ref={ref} />;\n },\n);\n\nDropdownToggle.propTypes = {\n /** Specifies the base element. */\n as: PropTypes.elementType,\n /** Overrides underlying component base CSS class name. */\n bsPrefix: PropTypes.string,\n /** An html id attribute, necessary for assistive technologies, such as screen readers. */\n id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,\n};\n\nDropdownToggle.defaultProps = {\n as: Button,\n bsPrefix: 'dropdown-toggle',\n};\n\nDropdown.Item = React.forwardRef(\n // eslint-disable-next-line prefer-arrow-callback\n function DropdownItem({ className, ...otherProps }, ref) {\n return (\n <BaseDropdownItem\n className={classNames(className, 'pgn__dropdown-item')}\n ref={ref}\n {...otherProps}\n />\n );\n },\n);\nDropdown.Item.propTypes = {\n className: PropTypes.string,\n};\nDropdown.Item.defaultProps = {\n className: undefined,\n};\n\nDropdown.Deprecated = DropdownDeprecated;\nDropdown.Toggle = DropdownToggle;\nDropdown.Menu = DropdownMenu;\nDropdown.Header = BaseDropdown.Header;\nDropdown.Divider = BaseDropdown.Divider;\n\nexport default Dropdown;\nexport { DropdownToggle };\nexport { default as DropdownButton } from 'react-bootstrap/DropdownButton';\nexport { default as SplitButton } from 'react-bootstrap/SplitButton';\n"],"mappings":";;;;;;;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,YAAY,MAAM,0BAA0B;AACnD,OAAOC,YAAY,MAAM,8BAA8B;AACvD,OAAOC,gBAAgB,MAAM,8BAA8B;AAC3D,OAAOC,kBAAkB,MAAM,gCAAgC;AAC/D,OAAOC,kBAAkB,MAAM,cAAc;AAC7C,OAAOC,MAAM,MAAM,WAAW;AAC9B,OAAOC,UAAU,MAAM,eAAe;AAEtC,MAAMC,QAAQ,gBAAGV,KAAK,CAACW,UAAU;AAC/B;AACA,SAASD,QAAQA,CAAAE,IAAA,EAOdC,GAAG,EAAE;EAAA,IAPU;MAChBC,IAAI;MACJC,SAAS;MACTC,QAAQ;MACRC,OAAO;MACPC;IAEF,CAAC,GAAAN,IAAA;IADIO,IAAI,GAAAC,wBAAA,CAAAR,IAAA,EAAAS,SAAA;EAEP,MAAM,CAACC,YAAY,EAAEC,eAAe,CAAC,GAAGvB,KAAK,CAACwB,QAAQ,CAACV,IAAI,CAAC;EAC5D,MAAMW,kBAAkB,GAAIC,MAAM,IAAK;IACrC;IACA,IAAIX,SA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VwC,QAAQ,EAAE;AACZ,CAAC;AAEDtC,QAAQ,CAAC8C,IAAI,gBAAGxD,KAAK,CAACW,UAAU;AAC9B;AACA,SAAS8C,YAAYA,CAAAC,KAAA,EAA+B7C,GAAG,EAAE;EAAA,IAAnC;MAAEK;IAAyB,CAAC,GAAAwC,KAAA;IAAZT,UAAU,GAAA7B,wBAAA,CAAAsC,KAAA,EAAAC,UAAA;EAC9C,oBACE3D,KAAA,CAAAmC,aAAA,CAAC9B,gBAAgB,EAAA+B,QAAA;IACflB,SAAS,EAAEjB,UAAU,CAACiB,SAAS,EAAE,oBAAoB,CAAE;IACvDL,GAAG,EAAEA;EAAI,GACLoC,UAAU,CACf,CAAC;AAEN,CACF,CAAC;AACDvC,QAAQ,CAAC8C,IAAI,CAACnB,SAAS,GAAG;EACxBnB,SAAS,EAAEhB,SAAS,CAACqC;AACvB,CAAC;AACD7B,QAAQ,CAAC8C,IAAI,CAACb,YAAY,GAAG;EAC3BzB,SAAS,EAAE0B;AACb,CAAC;AAEDlC,QAAQ,CAACkD,UAAU,GAAGrD,kBAAkB;AACxCG,QAAQ,CAACmD,MAAM,GAAGhB,cAAc;AAChCnC,QAAQ,CAACoD,IAAI,GAAG1D,YAAY;AAC5BM,QAAQ,CAACqD,MAAM,GAAG5D,YAAY,CAAC4D,MAAM;AACrCrD,QAAQ,CAACsD,OAAO,GAAG7D,YAAY,CAAC6D,OAAO;AAEvC,eAAetD,QAAQ;AACvB,SAASmC,cAAc;AACvB,SAASoB,OAAO,IAAIC,cAAc,QAAQ,gCAAgC;AAC1E,SAASD,OAAO,IAAIE,WAAW,QAAQ,6BAA6B"}
1
+ {"version":3,"file":"index.js","names":["React","classNames","PropTypes","BaseDropdown","DropdownMenu","BaseDropdownItem","BaseDropdownToggle","DropdownDeprecated","Button","IconButton","Dropdown","forwardRef","_ref","ref","show","autoClose","onToggle","variant","className","rest","_objectWithoutProperties","_excluded","internalShow","setInternalShow","useState","isClosingPermitted","source","handleToggle","isOpen","event","metadata","_objectSpread","currentTarget","document","key","createElement","_extends","propTypes","oneOfType","string","bool","func","oneOf","defaultProps","undefined","DropdownToggle","_ref2","as","bsPrefix","otherProps","_excluded2","prefix","elementType","id","number","isRequired","Item","DropdownItem","_ref3","_excluded3","Deprecated","Toggle","Menu","Header","Divider","default","DropdownButton","SplitButton"],"sources":["../../src/Dropdown/index.jsx"],"sourcesContent":["import React from 'react';\nimport classNames from 'classnames';\nimport PropTypes from 'prop-types';\nimport BaseDropdown from 'react-bootstrap/Dropdown';\nimport DropdownMenu from 'react-bootstrap/DropdownMenu';\nimport BaseDropdownItem from 'react-bootstrap/DropdownItem';\nimport BaseDropdownToggle from 'react-bootstrap/DropdownToggle';\nimport DropdownDeprecated from './deprecated';\nimport Button from '../Button';\nimport IconButton from '../IconButton';\n\nconst Dropdown = React.forwardRef(\n // eslint-disable-next-line prefer-arrow-callback\n function Dropdown({\n show,\n autoClose,\n onToggle,\n variant,\n className,\n ...rest\n }, ref) {\n const [internalShow, setInternalShow] = React.useState(show);\n const isClosingPermitted = (source) => {\n // autoClose=false only permits close on button click\n if (autoClose === false) {\n return source === 'click';\n }\n // autoClose=inside doesn't permit close on rootClose\n if (autoClose === 'inside') {\n return source !== 'rootClose';\n }\n // autoClose=outside doesn't permit close on select\n if (autoClose === 'outside') {\n return source !== 'select';\n }\n return true;\n };\n\n const handleToggle = (isOpen, event, metadata) => {\n if (isOpen) {\n setInternalShow(true);\n onToggle?.(isOpen, event, metadata);\n return;\n }\n let { source } = { ...metadata };\n\n if (event.currentTarget === document && (source !== 'keydown' || event.key === 'Escape')) {\n source = 'rootClose';\n }\n if (isClosingPermitted(source)) {\n setInternalShow(false);\n onToggle?.(isOpen, event, metadata);\n }\n };\n\n return (\n <BaseDropdown\n className={classNames(\n 'pgn__dropdown',\n `pgn__dropdown-${variant}`,\n className,\n )}\n data-testid=\"dropdown\"\n onToggle={handleToggle}\n ref={ref}\n show={internalShow}\n {...rest}\n />\n );\n },\n);\n\nDropdown.propTypes = {\n autoClose: PropTypes.oneOfType([\n PropTypes.string,\n PropTypes.bool,\n ]),\n className: PropTypes.string,\n onToggle: PropTypes.func,\n show: PropTypes.bool,\n variant: PropTypes.oneOf(['light', 'dark']),\n};\n\nDropdown.defaultProps = {\n autoClose: true,\n className: '',\n onToggle: undefined,\n show: false,\n variant: 'light',\n};\n\nconst DropdownToggle = React.forwardRef(\n // eslint-disable-next-line prefer-arrow-callback\n function DropdownToggle({\n as,\n bsPrefix,\n ...otherProps\n }, ref) {\n // hide arrow from the toggle if it is rendered as IconButton\n // because it hinders the positioning of IconButton\n const prefix = as === IconButton ? 'pgn__dropdown-toggle-iconbutton' : bsPrefix;\n return <BaseDropdownToggle {...otherProps} as={as} bsPrefix={prefix} ref={ref} />;\n },\n);\n\nDropdownToggle.propTypes = {\n /** Specifies the base element. */\n as: PropTypes.elementType,\n /** Overrides underlying component base CSS class name. */\n bsPrefix: PropTypes.string,\n /** An html id attribute, necessary for assistive technologies, such as screen readers. */\n id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,\n};\n\nDropdownToggle.defaultProps = {\n as: Button,\n bsPrefix: 'dropdown-toggle',\n};\n\nDropdown.Item = React.forwardRef(\n // eslint-disable-next-line prefer-arrow-callback\n function DropdownItem({ className, ...otherProps }, ref) {\n return (\n <BaseDropdownItem\n className={classNames(className, 'pgn__dropdown-item')}\n ref={ref}\n {...otherProps}\n />\n );\n },\n);\n\nDropdown.Item.propTypes = {\n className: PropTypes.string,\n};\n\nDropdown.Item.defaultProps = {\n className: undefined,\n};\n\nDropdown.Deprecated = DropdownDeprecated;\nDropdown.Toggle = DropdownToggle;\nDropdown.Menu = DropdownMenu;\nDropdown.Header = BaseDropdown.Header;\nDropdown.Divider = BaseDropdown.Divider;\n\nexport default Dropdown;\nexport { DropdownToggle };\nexport { default as DropdownButton } from 'react-bootstrap/DropdownButton';\nexport { default as SplitButton } from 'react-bootstrap/SplitButton';\n"],"mappings":";;;;;;;;;;;AAAA,OAA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EACxBnB,SAAS,EAAEhB,SAAS,CAACqC;AACvB,CAAC;AAED7B,QAAQ,CAAC8C,IAAI,CAACb,YAAY,GAAG;EAC3BzB,SAAS,EAAE0B;AACb,CAAC;AAEDlC,QAAQ,CAACkD,UAAU,GAAGrD,kBAAkB;AACxCG,QAAQ,CAACmD,MAAM,GAAGhB,cAAc;AAChCnC,QAAQ,CAACoD,IAAI,GAAG1D,YAAY;AAC5BM,QAAQ,CAACqD,MAAM,GAAG5D,YAAY,CAAC4D,MAAM;AACrCrD,QAAQ,CAACsD,OAAO,GAAG7D,YAAY,CAAC6D,OAAO;AAEvC,eAAetD,QAAQ;AACvB,SAASmC,cAAc;AACvB,SAASoB,OAAO,IAAIC,cAAc,QAAQ,gCAAgC;AAC1E,SAASD,OAAO,IAAIE,WAAW,QAAQ,6BAA6B"}
@@ -77,8 +77,11 @@ FormSwitch.propTypes = {
77
77
  children: PropTypes.node.isRequired,
78
78
  /** Specifies class name to append to the base element. */
79
79
  className: PropTypes.string,
80
+ /** Specifies class name to append to the label element. */
80
81
  labelClassName: PropTypes.string,
82
+ /** Specifies helper text to display below the switch. */
81
83
  helperText: PropTypes.node,
84
+ /** Determines whether the label should float to the left when the switch is active. */
82
85
  floatLabelLeft: PropTypes.bool
83
86
  };
84
87
  FormSwitch.defaultProps = {
@@ -1 +1 @@
1
- {"version":3,"file":"FormSwitch.js","names":["React","PropTypes","classNames","FormCheckbox","useFormGroupContext","SwitchControl","forwardRef","_ref","ref","isIndeterminate","props","_objectWithoutProperties","_excluded","defaultRef","useRef","resolvedRef","getControlProps","checkboxProps","_objectSpread","className","useEffect","current","indeterminate","createElement","_extends","type","propTypes","bool","string","defaultProps","undefined","FormSwitch","_ref2","children","helperText","_excluded2","role","controlAs","isValid","isInvalid","description","node","isRequired","labelClassName","floatLabelLeft"],"sources":["../../src/Form/FormSwitch.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport FormCheckbox from './FormCheckbox';\nimport { useFormGroupContext } from './FormGroupContext';\n\nconst SwitchControl = React.forwardRef(\n ({ isIndeterminate, ...props }, ref) => {\n const defaultRef = React.useRef();\n const resolvedRef = ref || defaultRef;\n const { getControlProps } = useFormGroupContext();\n const checkboxProps = getControlProps({\n ...props,\n className: classNames(\n 'pgn__form-switch-input',\n props.className,\n ),\n });\n\n React.useEffect(() => {\n // this if(resolvedRef.current) prevents console errors in testing\n if (resolvedRef.current) {\n resolvedRef.current.indeterminate = isIndeterminate;\n }\n }, [resolvedRef, isIndeterminate]);\n\n return (\n <input\n type=\"checkbox\"\n {...checkboxProps}\n ref={resolvedRef}\n />\n );\n },\n);\n\nSwitchControl.propTypes = {\n /** Specifies whether input should be rendered in indeterminate state. */\n isIndeterminate: PropTypes.bool,\n /** Specifies class name to append to the base element. */\n className: PropTypes.string,\n};\n\nSwitchControl.defaultProps = {\n isIndeterminate: false,\n className: undefined,\n};\n\nconst FormSwitch = React.forwardRef(({\n children,\n className,\n helperText,\n ...props\n}, ref) => (\n <div className=\"d-inline-flex flex-column\">\n <FormCheckbox\n className={classNames('pgn__form-switch', className)}\n {...props}\n role=\"switch\"\n ref={ref}\n controlAs={SwitchControl}\n // ignore the following props for form switch\n isValid={null}\n isInvalid={null}\n description={null}\n >\n {children}\n </FormCheckbox>\n {helperText && (\n <div className=\"pgn__form-switch-helper-text\">\n {helperText}\n </div>\n )}\n </div>\n));\n\nFormSwitch.propTypes = {\n /** Specifies contents of the component. */\n children: PropTypes.node.isRequired,\n /** Specifies class name to append to the base element. */\n className: PropTypes.string,\n labelClassName: PropTypes.string,\n helperText: PropTypes.node,\n floatLabelLeft: PropTypes.bool,\n};\n\nFormSwitch.defaultProps = {\n className: undefined,\n labelClassName: undefined,\n helperText: undefined,\n floatLabelLeft: false,\n};\n\nexport { SwitchControl };\nexport default FormSwitch;\n"],"mappings":";;;;;;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC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,GAAG;EAAA,IAL+B;MACnCyB,QAAQ;MACRd,SAAS;MACTe;IAEF,CAAC,GAAAF,KAAA;IADItB,KAAK,GAAAC,wBAAA,CAAAqB,KAAA,EAAAG,UAAA;EAAA,oBAERnC,KAAA,CAAAuB,aAAA;IAAKJ,SAAS,EAAC;EAA2B,gBACxCnB,KAAA,CAAAuB,aAAA,CAACpB,YAAY,EAAAqB,QAAA;IACXL,SAAS,EAAEjB,UAAU,CAAC,kBAAkB,EAAEiB,SAAS;EAAE,GACjDT,KAAK;IACT0B,IAAI,EAAC,QAAQ;IACb5B,GAAG,EAAEA,GAAI;IACT6B,SAAS,EAAEhC;IACX;IAAA;IACAiC,OAAO,EAAE,IAAK;IACdC,SAAS,EAAE,IAAK;IAChBC,WAAW,EAAE;EAAK,IAEjBP,QACW,CAAC,EACdC,UAAU,iBACTlC,KAAA,CAAAuB,aAAA;IAAKJ,SAAS,EAAC;EAA8B,GAC1Ce,UACE,CAEJ,CAAC;AAAA,CACP,CAAC;AAEFH,UAAU,CAACL,SAAS,GAAG;EACrB;EACAO,QAAQ,EAAEhC,SAAS,CAACwC,IAAI,CAACC,UAAU;EACnC;EACAvB,SAAS,EAAElB,SAAS,CAAC2B,MAAM;EAC3Be,cAAc,EAAE1C,SAAS,CAAC2B,MAAM;EAChCM,UAAU,EAAEjC,SAAS,CAACwC,IAAI;EAC1BG,cAAc,EAAE3C,SAAS,CAAC0B;AAC5B,CAAC;AAEDI,UAAU,CAACF,YAAY,GAAG;EACxBV,SAAS,EAAEW,SAAS;EACpBa,cAAc,EAAEb,SAAS;EACzBI,UAAU,EAAEJ,SAAS;EACrBc,cAAc,EAAE;AAClB,CAAC;AAED,SAASvC,aAAa;AACtB,eAAe0B,UAAU"}
1
+ {"version":3,"file":"FormSwitch.js","names":["React","PropTypes","classNames","FormCheckbox","useFormGroupContext","SwitchControl","forwardRef","_ref","ref","isIndeterminate","props","_objectWithoutProperties","_excluded","defaultRef","useRef","resolvedRef","getControlProps","checkboxProps","_objectSpread","className","useEffect","current","indeterminate","createElement","_extends","type","propTypes","bool","string","defaultProps","undefined","FormSwitch","_ref2","children","helperText","_excluded2","role","controlAs","isValid","isInvalid","description","node","isRequired","labelClassName","floatLabelLeft"],"sources":["../../src/Form/FormSwitch.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport FormCheckbox from './FormCheckbox';\nimport { useFormGroupContext } from './FormGroupContext';\n\nconst SwitchControl = React.forwardRef(\n ({ isIndeterminate, ...props }, ref) => {\n const defaultRef = React.useRef();\n const resolvedRef = ref || defaultRef;\n const { getControlProps } = useFormGroupContext();\n const checkboxProps = getControlProps({\n ...props,\n className: classNames(\n 'pgn__form-switch-input',\n props.className,\n ),\n });\n\n React.useEffect(() => {\n // this if(resolvedRef.current) prevents console errors in testing\n if (resolvedRef.current) {\n resolvedRef.current.indeterminate = isIndeterminate;\n }\n }, [resolvedRef, isIndeterminate]);\n\n return (\n <input\n type=\"checkbox\"\n {...checkboxProps}\n ref={resolvedRef}\n />\n );\n },\n);\n\nSwitchControl.propTypes = {\n /** Specifies whether input should be rendered in indeterminate state. */\n isIndeterminate: PropTypes.bool,\n /** Specifies class name to append to the base element. */\n className: PropTypes.string,\n};\n\nSwitchControl.defaultProps = {\n isIndeterminate: false,\n className: undefined,\n};\n\nconst FormSwitch = React.forwardRef(({\n children,\n className,\n helperText,\n ...props\n}, ref) => (\n <div className=\"d-inline-flex flex-column\">\n <FormCheckbox\n className={classNames('pgn__form-switch', className)}\n {...props}\n role=\"switch\"\n ref={ref}\n controlAs={SwitchControl}\n // ignore the following props for form switch\n isValid={null}\n isInvalid={null}\n description={null}\n >\n {children}\n </FormCheckbox>\n {helperText && (\n <div className=\"pgn__form-switch-helper-text\">\n {helperText}\n </div>\n )}\n </div>\n));\n\nFormSwitch.propTypes = {\n /** Specifies contents of the component. */\n children: PropTypes.node.isRequired,\n /** Specifies class name to append to the base element. */\n className: PropTypes.string,\n /** Specifies class name to append to the label element. */\n labelClassName: PropTypes.string,\n /** Specifies helper text to display below the switch. */\n helperText: PropTypes.node,\n /** Determines whether the label should float to the left when the switch is active. */\n floatLabelLeft: PropTypes.bool,\n};\n\nFormSwitch.defaultProps = {\n className: undefined,\n labelClassName: undefined,\n helperText: undefined,\n floatLabelLeft: false,\n};\n\nexport { SwitchControl };\nexport default FormSwitch;\n"],"mappings":";;;;;;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,YAAY,MAAM,gBAAgB;AACzC,SAASC,mBAAmB,QAAQ,oBAAoB;AAExD,MAAMC,aAAa,gBAAGL,KAAK,CAACM,UAAU,CACpC,CAAAC,IAAA,EAAgCC,GAAG,KAAK;EAAA,IAAvC;MAAEC;IAA0B,CAAC,GAAAF,IAAA;IAAPG,KAAK,GAAAC,wBAAA,CAAAJ,IAAA,EAAAK,SAAA;EAC1B,MAAMC,UAAU,GAAGb,KAAK,CAACc,MAAM,CAAC,CAAC;EACjC,MAAMC,WAAW,GAAGP,GAAG,IAAIK,UAAU;EACrC,MAAM;IAAEG;EAAgB,CAAC,GAAGZ,mBAAmB,CAAC,CAAC;EACjD,MAAMa,aAAa,GAAGD,eAAe,CAAAE,aAAA,CAAAA,aAAA,KAChCR,KAAK;IACRS,SAAS,EAAEjB,UAAU,CACnB,wBAAwB,EACxBQ,KAAK,CAACS,SACR;EAAC,EACF,CAAC;EAEFnB,KAAK,CAACoB,SAAS,CAAC,MAAM;IACpB;IACA,IAAIL,WAAW,CAACM,OAAO,EAAE;MACvBN,WAAW,CAACM,OAAO,CAACC,aAAa,GAAGb,eAAe;IACrD;EACF,CAAC,EAAE,CAACM,WAAW,EAAEN,eAAe,CAAC,CAAC;EAElC,oBACET,KAAA,CAAAuB,aAAA,UAAAC,QAAA;IACEC,IAAI,EAAC;EAAU,GACXR,aAAa;IACjBT,GAAG,EAAEO;EAAY,EACl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AEDI,UAAU,CAACF,YAAY,GAAG;EACxBV,SAAS,EAAEW,SAAS;EACpBa,cAAc,EAAEb,SAAS;EACzBI,UAAU,EAAEJ,SAAS;EACrBc,cAAc,EAAE;AAClB,CAAC;AAED,SAASvC,aAAa;AACtB,eAAe0B,UAAU"}
@@ -88,22 +88,23 @@ Hyperlink.propTypes = {
88
88
  children: PropTypes.node.isRequired,
89
89
  /** Custom class names for the hyperlink */
90
90
  className: PropTypes.string,
91
- /** specifies where the link should open. The default behavior is `_self`, which means that the URL will be loaded into the same browsing context as the current one. If the target is `_blank` (opening a new window) `rel='noopener'` will be added to the anchor tag to prevent any potential [reverse tabnabbing attack](https://www.owasp.org/index.php/Reverse_Tabnabbing).
92
- */
91
+ /** specifies where the link should open. The default behavior is `_self`, which means that the URL will be
92
+ * loaded into the same browsing context as the current one.
93
+ * If the target is `_blank` (opening a new window) `rel='noopener'` will be added to the anchor tag to prevent
94
+ * any potential [reverse tabnabbing attack](https://www.owasp.org/index.php/Reverse_Tabnabbing).
95
+ */
93
96
  target: PropTypes.string,
94
97
  /** specifies the callback function when the link is clicked */
95
98
  onClick: PropTypes.func,
96
- // eslint-disable-next-line max-len
97
99
  /** specifies the text for links with a `_blank` target (which loads the URL in a new browsing context). */
98
100
  externalLinkAlternativeText: isRequiredIf(PropTypes.string, props => props.target === '_blank'),
99
- // eslint-disable-next-line max-len
100
101
  /** specifies the title for links with a `_blank` target (which loads the URL in a new browsing context). */
101
102
  externalLinkTitle: isRequiredIf(PropTypes.string, props => props.target === '_blank'),
102
103
  /** type of hyperlink */
103
104
  variant: PropTypes.oneOf(['default', 'muted', 'brand']),
104
- /** specify the link style. By default it will be underlined. */
105
+ /** specify the link style. By default, it will be underlined. */
105
106
  isInline: PropTypes.bool,
106
- /** specify if we need to show launch Icon. By default it will be visible. */
107
+ /** specify if we need to show launch Icon. By default, it will be visible. */
107
108
  showLaunchIcon: PropTypes.bool
108
109
  };
109
110
  export default withDeprecatedProps(Hyperlink, 'Hyperlink', {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["React","PropTypes","classNames","isRequiredIf","Launch","Icon","withDeprecatedProps","DeprTypes","HYPER_LINK_EXTERNAL_LINK_ALT_TEXT","HYPER_LINK_EXTERNAL_LINK_TITLE","Hyperlink","forwardRef","props","ref","className","destination","children","target","onClick","externalLinkAlternativeText","externalLinkTitle","variant","isInline","showLaunchIcon","attrs","_objectWithoutProperties","_excluded","externalLinkIcon","generateRel","rel","includes","createElement","title","src","screenReaderText","style","height","width","_extends","href","defaultProps","undefined","propTypes","string","isRequired","node","func","oneOf","bool","content","deprType","MOVED","newName"],"sources":["../../src/Hyperlink/index.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport isRequiredIf from 'react-proptype-conditional-require';\nimport { Launch } from '../../icons';\nimport Icon from '../Icon';\n\nimport withDeprecatedProps, { DeprTypes } from '../withDeprecatedProps';\n\nexport const HYPER_LINK_EXTERNAL_LINK_ALT_TEXT = 'in a new tab';\nexport const HYPER_LINK_EXTERNAL_LINK_TITLE = 'Opens in a new tab';\n\nconst Hyperlink = React.forwardRef((props, ref) => {\n const {\n className,\n destination,\n children,\n target,\n onClick,\n externalLinkAlternativeText,\n externalLinkTitle,\n variant,\n isInline,\n showLaunchIcon,\n ...attrs\n } = props;\n let externalLinkIcon;\n\n if (target === '_blank') {\n const generateRel = () => {\n let { rel } = attrs;\n if (!rel) {\n return 'noopener noreferrer';\n }\n if (!rel.includes('noopener')) {\n rel += ' noopener';\n }\n if (!rel.includes('noreferrer')) {\n rel += ' noreferrer';\n }\n return rel;\n };\n\n // Add this rel attribute to prevent Reverse Tabnabbing\n attrs.rel = generateRel();\n if (showLaunchIcon) {\n externalLinkIcon = (\n <span\n className=\"pgn__hyperlink__external-icon\"\n title={externalLinkTitle}\n >\n <Icon\n src={Launch}\n screenReaderText={externalLinkAlternativeText}\n style={{ height: '1em', width: '1em' }}\n data-testid=\"hyperlink-icon\"\n />\n </span>\n );\n }\n }\n\n return (\n <a\n ref={ref}\n className={classNames(\n 'pgn__hyperlink',\n `${variant}-link`,\n {\n 'standalone-link': !isInline,\n 'inline-link': isInline,\n },\n className,\n )}\n href={destination}\n target={target}\n onClick={onClick}\n {...attrs}\n >\n {children}\n {externalLinkIcon}\n </a>\n );\n});\n\nHyperlink.defaultProps = {\n className: undefined,\n target: '_self',\n onClick: () => {},\n externalLinkAlternativeText: HYPER_LINK_EXTERNAL_LINK_ALT_TEXT,\n externalLinkTitle: HYPER_LINK_EXTERNAL_LINK_TITLE,\n variant: 'default',\n isInline: false,\n showLaunchIcon: true,\n};\n\nHyperlink.propTypes = {\n /** specifies the URL */\n destination: PropTypes.string.isRequired,\n /** Content of the hyperlink */\n children: PropTypes.node.isRequired,\n /** Custom class names for the hyperlink */\n className: PropTypes.string,\n /** specifies where the link should open. The default behavior is `_self`, which means that the URL will be loaded into the same browsing context as the current one. If the target is `_blank` (opening a new window) `rel='noopener'` will be added to the anchor tag to prevent any potential [reverse tabnabbing attack](https://www.owasp.org/index.php/Reverse_Tabnabbing).\n */\n target: PropTypes.string,\n /** specifies the callback function when the link is clicked */\n onClick: PropTypes.func,\n // eslint-disable-next-line max-len\n /** specifies the text for links with a `_blank` target (which loads the URL in a new browsing context). */\n externalLinkAlternativeText: isRequiredIf(\n PropTypes.string,\n props => props.target === '_blank',\n ),\n // eslint-disable-next-line max-len\n /** specifies the title for links with a `_blank` target (which loads the URL in a new browsing context). */\n externalLinkTitle: isRequiredIf(\n PropTypes.string,\n props => props.target === '_blank',\n ),\n /** type of hyperlink */\n variant: PropTypes.oneOf(['default', 'muted', 'brand']),\n /** specify the link style. By default it will be underlined. */\n isInline: PropTypes.bool,\n /** specify if we need to show launch Icon. By default it will be visible. */\n showLaunchIcon: PropTypes.bool,\n};\n\nexport default withDeprecatedProps(Hyperlink, 'Hyperlink', {\n /** specifies the text or element that a URL should be associated with */\n content: {\n deprType: DeprTypes.MOVED,\n newName: 'children',\n },\n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,SAAS,CAAC0C,MAAM,EAChB/B,KAAK,IAAIA,KAAK,CAACK,MAAM,KAAK,QAC5B,CAAC;EACD;EACA;EACAG,iBAAiB,EAAEjB,YAAY,CAC7BF,SAAS,CAAC0C,MAAM,EAChB/B,KAAK,IAAIA,KAAK,CAACK,MAAM,KAAK,QAC5B,CAAC;EACD;EACAI,OAAO,EAAEpB,SAAS,CAAC8C,KAAK,CAAC,CAAC,SAAS,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;EACvD;EACAzB,QAAQ,EAAErB,SAAS,CAAC+C,IAAI;EACxB;EACAzB,cAAc,EAAEtB,SAAS,CAAC+C;AAC5B,CAAC;AAED,eAAe1C,mBAAmB,CAACI,SAAS,EAAE,WAAW,EAAE;EACzD;EACAuC,OAAO,EAAE;IACPC,QAAQ,EAAE3C,SAAS,CAAC4C,KAAK;IACzBC,OAAO,EAAE;EACX;AACF,CAAC,CAAC"}
1
+ {"version":3,"file":"index.js","names":["React","PropTypes","classNames","isRequiredIf","Launch","Icon","withDeprecatedProps","DeprTypes","HYPER_LINK_EXTERNAL_LINK_ALT_TEXT","HYPER_LINK_EXTERNAL_LINK_TITLE","Hyperlink","forwardRef","props","ref","className","destination","children","target","onClick","externalLinkAlternativeText","externalLinkTitle","variant","isInline","showLaunchIcon","attrs","_objectWithoutProperties","_excluded","externalLinkIcon","generateRel","rel","includes","createElement","title","src","screenReaderText","style","height","width","_extends","href","defaultProps","undefined","propTypes","string","isRequired","node","func","oneOf","bool","content","deprType","MOVED","newName"],"sources":["../../src/Hyperlink/index.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport isRequiredIf from 'react-proptype-conditional-require';\nimport { Launch } from '../../icons';\nimport Icon from '../Icon';\n\nimport withDeprecatedProps, { DeprTypes } from '../withDeprecatedProps';\n\nexport const HYPER_LINK_EXTERNAL_LINK_ALT_TEXT = 'in a new tab';\nexport const HYPER_LINK_EXTERNAL_LINK_TITLE = 'Opens in a new tab';\n\nconst Hyperlink = React.forwardRef((props, ref) => {\n const {\n className,\n destination,\n children,\n target,\n onClick,\n externalLinkAlternativeText,\n externalLinkTitle,\n variant,\n isInline,\n showLaunchIcon,\n ...attrs\n } = props;\n let externalLinkIcon;\n\n if (target === '_blank') {\n const generateRel = () => {\n let { rel } = attrs;\n if (!rel) {\n return 'noopener noreferrer';\n }\n if (!rel.includes('noopener')) {\n rel += ' noopener';\n }\n if (!rel.includes('noreferrer')) {\n rel += ' noreferrer';\n }\n return rel;\n };\n\n // Add this rel attribute to prevent Reverse Tabnabbing\n attrs.rel = generateRel();\n if (showLaunchIcon) {\n externalLinkIcon = (\n <span\n className=\"pgn__hyperlink__external-icon\"\n title={externalLinkTitle}\n >\n <Icon\n src={Launch}\n screenReaderText={externalLinkAlternativeText}\n style={{ height: '1em', width: '1em' }}\n data-testid=\"hyperlink-icon\"\n />\n </span>\n );\n }\n }\n\n return (\n <a\n ref={ref}\n className={classNames(\n 'pgn__hyperlink',\n `${variant}-link`,\n {\n 'standalone-link': !isInline,\n 'inline-link': isInline,\n },\n className,\n )}\n href={destination}\n target={target}\n onClick={onClick}\n {...attrs}\n >\n {children}\n {externalLinkIcon}\n </a>\n );\n});\n\nHyperlink.defaultProps = {\n className: undefined,\n target: '_self',\n onClick: () => {},\n externalLinkAlternativeText: HYPER_LINK_EXTERNAL_LINK_ALT_TEXT,\n externalLinkTitle: HYPER_LINK_EXTERNAL_LINK_TITLE,\n variant: 'default',\n isInline: false,\n showLaunchIcon: true,\n};\n\nHyperlink.propTypes = {\n /** specifies the URL */\n destination: PropTypes.string.isRequired,\n /** Content of the hyperlink */\n children: PropTypes.node.isRequired,\n /** Custom class names for the hyperlink */\n className: PropTypes.string,\n /** specifies where the link should open. The default behavior is `_self`, which means that the URL will be\n * loaded into the same browsing context as the current one.\n * If the target is `_blank` (opening a new window) `rel='noopener'` will be added to the anchor tag to prevent\n * any potential [reverse tabnabbing attack](https://www.owasp.org/index.php/Reverse_Tabnabbing).\n */\n target: PropTypes.string,\n /** specifies the callback function when the link is clicked */\n onClick: PropTypes.func,\n /** specifies the text for links with a `_blank` target (which loads the URL in a new browsing context). */\n externalLinkAlternativeText: isRequiredIf(\n PropTypes.string,\n props => props.target === '_blank',\n ),\n /** specifies the title for links with a `_blank` target (which loads the URL in a new browsing context). */\n externalLinkTitle: isRequiredIf(\n PropTypes.string,\n props => props.target === '_blank',\n ),\n /** type of hyperlink */\n variant: PropTypes.oneOf(['default', 'muted', 'brand']),\n /** specify the link style. By default, it will be underlined. */\n isInline: PropTypes.bool,\n /** specify if we need to show launch Icon. By default, it will be visible. */\n showLaunchIcon: PropTypes.bool,\n};\n\nexport default withDeprecatedProps(Hyperlink, 'Hyperlink', {\n /** specifies the text or element that a URL should be associated with */\n content: {\n deprType: DeprTypes.MOVED,\n newName: 'children',\n },\n});\n"],"mappings":";;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,YAAY,MAAM,oCAAoC;AAC7D,SAASC,MAAM,QAAQ,aAAa;AACpC,OAAOC,IAAI,MAAM,SAAS;AAE1B,OAAOC,mBAAmB,IAAIC,SAAS,QAAQ,wBAAwB;AAEvE,OAAO,MAAMC,iCAAiC,GAAG,cAAc;AAC/D,OAAO,MAAMC,8BAA8B,GAAG,oBAAoB;AAElE,MAAMC,SAAS,gBAAGV,KAAK,CAACW,UAAU,CAAC,CAACC,KAAK,EAAEC,GAAG,KAAK;EACjD,MAAM;MACJC,SAAS;MACTC,WAAW;MACXC,QAAQ;MACRC,MAAM;MACNC,OAAO;MACPC,2BAA2B;MAC3BC,iBAAiB;MACjBC,OAAO;MACPC,QAAQ;MACRC;IAEF,CAAC,GAAGX,KAAK;IADJY,KAAK,GAAAC,wBAAA,CACNb,KAAK,EAAAc,SAAA;EACT,IAAIC,gBAAgB;EAEpB,IAAIV,MAAM,KAAK,QAAQ,EAAE;IACv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O,EAAEA,CAAA,KAAM,CAAC,CAAC;EACjBC,2BAA2B,EAAEX,iCAAiC;EAC9DY,iBAAiB,EAAEX,8BAA8B;EACjDY,OAAO,EAAE,SAAS;EAClBC,QAAQ,EAAE,KAAK;EACfC,cAAc,EAAE;AAClB,CAAC;AAEDb,SAAS,CAACgC,SAAS,GAAG;EACpB;EACA3B,WAAW,EAAEd,SAAS,CAAC0C,MAAM,CAACC,UAAU;EACxC;EACA5B,QAAQ,EAAEf,SAAS,CAAC4C,IAAI,CAACD,UAAU;EACnC;EACA9B,SAAS,EAAEb,SAAS,CAAC0C,MAAM;EAC3B;AACF;AACA;AACA;AACA;EACE1B,MAAM,EAAEhB,SAAS,CAAC0C,MAAM;EACxB;EACAzB,OAAO,EAAEjB,SAAS,CAAC6C,IAAI;EACvB;EACA3B,2BAA2B,EAAEhB,YAAY,CACvCF,SAAS,CAAC0C,MAAM,EAChB/B,KAAK,IAAIA,KAAK,CAACK,MAAM,KAAK,QAC5B,CAAC;EACD;EACAG,iBAAiB,EAAEjB,YAAY,CAC7BF,SAAS,CAAC0C,MAAM,EAChB/B,KAAK,IAAIA,KAAK,CAACK,MAAM,KAAK,QAC5B,CAAC;EACD;EACAI,OAAO,EAAEpB,SAAS,CAAC8C,KAAK,CAAC,CAAC,SAAS,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;EACvD;EACAzB,QAAQ,EAAErB,SAAS,CAAC+C,IAAI;EACxB;EACAzB,cAAc,EAAEtB,SAAS,CAAC+C;AAC5B,CAAC;AAED,eAAe1C,mBAAmB,CAACI,SAAS,EAAE,WAAW,EAAE;EACzD;EACAuC,OAAO,EAAE;IACPC,QAAQ,EAAE3C,SAAS,CAAC4C,KAAK;IACzBC,OAAO,EAAE;EACX;AACF,CAAC,CAAC"}
@@ -60,28 +60,35 @@ function Icon(_ref) {
60
60
  }, screenReaderText));
61
61
  }
62
62
  Icon.propTypes = {
63
- // eslint-disable-next-line max-len
64
- /** An icon component to render. Example import of a Paragon icon component: `import { Check } from '@edx/paragon/dist/icon';` */
63
+ /**
64
+ * An icon component to render.
65
+ * Example import of a Paragon icon component: `import { Check } from '@edx/paragon/icons';`
66
+ */
65
67
  src: PropTypes.oneOfType([PropTypes.element, PropTypes.func]),
66
68
  /** HTML element attributes to pass through to the underlying svg element */
67
69
  svgAttrs: PropTypes.shape({
68
70
  'aria-label': PropTypes.string,
69
71
  'aria-labelledby': PropTypes.string
70
72
  }),
71
- // eslint-disable-next-line max-len
72
- /** the `id` property of the Icon element, by default this value is generated with the `newId` function with the `prefix` of `Icon`. */
73
+ /**
74
+ * the `id` property of the Icon element, by default this value is generated
75
+ * with the `newId` function with the `prefix` of `Icon`.
76
+ */
73
77
  id: PropTypes.string,
74
- // eslint-disable-next-line max-len
75
78
  /** The size of the icon. */
76
79
  size: PropTypes.oneOf(['xs', 'sm', 'md', 'lg']),
77
- // eslint-disable-next-line max-len
78
80
  /** A class name that will define what the Icon looks like. */
79
81
  className: PropTypes.string,
80
- // eslint-disable-next-line max-len
81
- /** a boolean that determines the value of `aria-hidden` attribute on the Icon span, this value is `true` by default. */
82
+ /**
83
+ * a boolean that determines the value of `aria-hidden` attribute on the Icon span,
84
+ * this value is `true` by default.
85
+ */
82
86
  hidden: PropTypes.bool,
83
- // eslint-disable-next-line max-len
84
- /** a string or an element that will be used on a secondary span leveraging the `sr-only` style for screenreader only text, this value is `undefined` by default. This value is recommended for use unless the Icon is being used in a way that is purely decorative or provides no additional context for screen reader users. This field should be thought of the same way an `alt` attribute would be used for `image` tags.
87
+ /**
88
+ * a string or an element that will be used on a secondary span leveraging the `sr-only` style
89
+ * for screenreader only text, this value is `undefined` by default. This value is recommended for use unless
90
+ * the Icon is being used in a way that is purely decorative or provides no additional context for screen
91
+ * reader users. This field should be thought of the same way an `alt` attribute would be used for `image` tags.
85
92
  */
86
93
  screenReaderText: PropTypes.oneOfType([PropTypes.string, PropTypes.element])
87
94
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["React","PropTypes","classNames","newId","withDeprecatedProps","DeprTypes","Icon","_ref","src","Component","id","className","hidden","screenReaderText","svgAttrs","size","attrs","_objectWithoutProperties","_excluded","hasAriaLabel","mergedSvgProps","_objectSpread","undefined","createElement","_extends","role","focusable","Fragment","propTypes","oneOfType","element","func","shape","string","oneOf","bool","defaultProps","deprType","FORMAT","expect","value","transform","Array","isArray","join","message"],"sources":["../../src/Icon/index.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\n\nimport newId from '../utils/newId';\nimport withDeprecatedProps, { DeprTypes } from '../withDeprecatedProps';\n\n/**\n * An svg with an \"img\" role must satisfy the following a11y requirements\n * - It needs a text alternative in the form of aria-label, aria-labelledby, or screen-reader only text.\n * - If no label is desired, aria-label will be set to an empty string and aria-hidden to \"true\".\n * - focusable is set to false on the svg in all cases as a workaround for an ie11 bug\n */\n\nfunction Icon({\n src: Component,\n id,\n className,\n hidden,\n screenReaderText,\n svgAttrs,\n size,\n ...attrs\n}) {\n if (Component) {\n // If no aria label is specified, hide this icon from screenreaders\n const hasAriaLabel = svgAttrs['aria-label'] || svgAttrs['aria-labelledby'];\n\n const mergedSvgProps = { ...svgAttrs };\n\n if (!hasAriaLabel) {\n mergedSvgProps['aria-label'] = undefined;\n mergedSvgProps['aria-hidden'] = true;\n }\n\n return (\n <span\n className={classNames('pgn__icon', { [`pgn__icon__${size}`]: !!size }, className)}\n id={id}\n {...attrs}\n >\n <Component\n role=\"img\"\n focusable={false}\n {...mergedSvgProps}\n />\n {screenReaderText && (\n <span className=\"sr-only\">\n {screenReaderText}\n </span>\n )}\n </span>\n );\n }\n\n return (\n <>\n <span\n id={id || newId('Icon')}\n className={className}\n aria-hidden={hidden}\n />\n {screenReaderText && (\n <span className=\"sr-only\">\n {screenReaderText}\n </span>\n )}\n </>\n );\n}\n\nIcon.propTypes = {\n // eslint-disable-next-line max-len\n /** An icon component to render. Example import of a Paragon icon component: `import { Check } from '@edx/paragon/dist/icon';` */\n src: PropTypes.oneOfType([PropTypes.element, PropTypes.func]),\n /** HTML element attributes to pass through to the underlying svg element */\n svgAttrs: PropTypes.shape({\n 'aria-label': PropTypes.string,\n 'aria-labelledby': PropTypes.string,\n }),\n // eslint-disable-next-line max-len\n /** the `id` property of the Icon element, by default this value is generated with the `newId` function with the `prefix` of `Icon`. */\n id: PropTypes.string,\n // eslint-disable-next-line max-len\n /** The size of the icon. */\n size: PropTypes.oneOf(['xs', 'sm', 'md', 'lg']),\n // eslint-disable-next-line max-len\n /** A class name that will define what the Icon looks like. */\n className: PropTypes.string,\n // eslint-disable-next-line max-len\n /** a boolean that determines the value of `aria-hidden` attribute on the Icon span, this value is `true` by default. */\n hidden: PropTypes.bool,\n // eslint-disable-next-line max-len\n /** a string or an element that will be used on a secondary span leveraging the `sr-only` style for screenreader only text, this value is `undefined` by default. This value is recommended for use unless the Icon is being used in a way that is purely decorative or provides no additional context for screen reader users. This field should be thought of the same way an `alt` attribute would be used for `image` tags.\n */\n screenReaderText: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),\n};\n\nIcon.defaultProps = {\n src: null,\n svgAttrs: {},\n id: undefined,\n hidden: true,\n screenReaderText: undefined,\n size: undefined,\n className: undefined,\n};\n\nexport default withDeprecatedProps(Icon, 'Icon', {\n className: {\n deprType: DeprTypes.FORMAT,\n expect: value => typeof value === 'string',\n transform: value => (Array.isArray(value) ? value.join(' ') : value),\n message: 'It should be a string.',\n },\n});\n"],"mappings":";;;;;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,UAAU,MAAM,YAAY;AAEnC,OAAOC,KAAK,MAAM,gBAAgB;AAClC,OAAOC,mBAAmB,IAAIC,SAAS,QAAQ,wBAAwB;;AAEvE;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASC,IAAIA,CAAAC,IAAA,EASV;EAAA,IATW;MACZC,GAAG,EAAEC,SAAS;MACdC,EAAE;MACFC,SAAS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,"file":"index.js","names":["React","PropTypes","classNames","newId","withDeprecatedProps","DeprTypes","Icon","_ref","src","Component","id","className","hidden","screenReaderText","svgAttrs","size","attrs","_objectWithoutProperties","_excluded","hasAriaLabel","mergedSvgProps","_objectSpread","undefined","createElement","_extends","role","focusable","Fragment","propTypes","oneOfType","element","func","shape","string","oneOf","bool","defaultProps","deprType","FORMAT","expect","value","transform","Array","isArray","join","message"],"sources":["../../src/Icon/index.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\n\nimport newId from '../utils/newId';\nimport withDeprecatedProps, { DeprTypes } from '../withDeprecatedProps';\n\n/**\n * An svg with an \"img\" role must satisfy the following a11y requirements\n * - It needs a text alternative in the form of aria-label, aria-labelledby, or screen-reader only text.\n * - If no label is desired, aria-label will be set to an empty string and aria-hidden to \"true\".\n * - focusable is set to false on the svg in all cases as a workaround for an ie11 bug\n */\n\nfunction Icon({\n src: Component,\n id,\n className,\n hidden,\n screenReaderText,\n svgAttrs,\n size,\n ...attrs\n}) {\n if (Component) {\n // If no aria label is specified, hide this icon from screenreaders\n const hasAriaLabel = svgAttrs['aria-label'] || svgAttrs['aria-labelledby'];\n\n const mergedSvgProps = { ...svgAttrs };\n\n if (!hasAriaLabel) {\n mergedSvgProps['aria-label'] = undefined;\n mergedSvgProps['aria-hidden'] = true;\n }\n\n return (\n <span\n className={classNames('pgn__icon', { [`pgn__icon__${size}`]: !!size }, className)}\n id={id}\n {...attrs}\n >\n <Component\n role=\"img\"\n focusable={false}\n {...mergedSvgProps}\n />\n {screenReaderText && (\n <span className=\"sr-only\">\n {screenReaderText}\n </span>\n )}\n </span>\n );\n }\n\n return (\n <>\n <span\n id={id || newId('Icon')}\n className={className}\n aria-hidden={hidden}\n />\n {screenReaderText && (\n <span className=\"sr-only\">\n {screenReaderText}\n </span>\n )}\n </>\n );\n}\n\nIcon.propTypes = {\n /**\n * An icon component to render.\n * Example import of a Paragon icon component: `import { Check } from '@edx/paragon/icons';`\n */\n src: PropTypes.oneOfType([PropTypes.element, PropTypes.func]),\n /** HTML element attributes to pass through to the underlying svg element */\n svgAttrs: PropTypes.shape({\n 'aria-label': PropTypes.string,\n 'aria-labelledby': PropTypes.string,\n }),\n /**\n * the `id` property of the Icon element, by default this value is generated\n * with the `newId` function with the `prefix` of `Icon`.\n */\n id: PropTypes.string,\n /** The size of the icon. */\n size: PropTypes.oneOf(['xs', 'sm', 'md', 'lg']),\n /** A class name that will define what the Icon looks like. */\n className: PropTypes.string,\n /**\n * a boolean that determines the value of `aria-hidden` attribute on the Icon span,\n * this value is `true` by default.\n */\n hidden: PropTypes.bool,\n /**\n * a string or an element that will be used on a secondary span leveraging the `sr-only` style\n * for screenreader only text, this value is `undefined` by default. This value is recommended for use unless\n * the Icon is being used in a way that is purely decorative or provides no additional context for screen\n * reader users. This field should be thought of the same way an `alt` attribute would be used for `image` tags.\n */\n screenReaderText: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),\n};\n\nIcon.defaultProps = {\n src: null,\n svgAttrs: {},\n id: undefined,\n hidden: true,\n screenReaderText: undefined,\n size: undefined,\n className: undefined,\n};\n\nexport default withDeprecatedProps(Icon, 'Icon', {\n className: {\n deprType: DeprTypes.FORMAT,\n expect: value => typeof value === 'string',\n transform: value => (Array.isArray(value) ? value.join(' ') : value),\n message: 'It should be a string.',\n },\n});\n"],"mappings":";;;;;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,UAAU,MAAM,YAAY;AAEnC,OAAOC,KAAK,MAAM,gBAAgB;AAClC,OAAOC,mBAAmB,IAAIC,SAAS,QAAQ,wBAAwB;;AAEvE;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASC,IAAIA,CAAAC,IAAA,EASV;EAAA,IATW;MACZC,GAAG,EAAEC,SAAS;MACdC,EAAE;MACFC,SAAS;MACTC,MAAM;MACNC,gBAAgB;MAChBC,QAAQ;MACRC;IAEF,CA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
76
76
  alt: PropTypes.string.isRequired,
77
77
  /** Changes icon styles for dark background */
78
78
  invertColors: PropTypes.bool,
79
- /** Accepts a React fontawesome icon. https://fontawesome.com/how-to-use/on-the-web/using-with/react */
79
+ /** Accepts a React fontawesome icon. */
80
80
  icon: PropTypes.shape({
81
81
  prefix: PropTypes.string,
82
82
  iconName: PropTypes.string,
@@ -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;M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","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,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,EA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,eACL1D,KAAA,CAAAiC,aAAA,CAAC5B,OAAO;MACNsD,EAAE,EAAG,sBAAqBN,gBAAiB,EAAE;MAC7CnC,OAAO,EAAEM,MAAM,GAAG,OAAO,GAAG;IAAG,GAE9B8B,cACM;EACT,gBAEFtD,KAAA,CAAAiC,aAAA,CAAC3B,UAAU,EAAA4B,QAAA;IAAChB,OAAO,EAAEA,OAAQ;IAACN,YAAY,EAAEA;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 +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,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,aAAA,QAAAC,QAAA;EAAKF,GAAG,EAAEA;AAAI,GAAKD,KAAK,CAAG,CAAC,CAAC;AAEpF,MAAMI,MAAM,gBAAGZ,KAAK,CAACO,UAAU,CAAC,CAAAM,IAAA,EAAyBJ,GAAG,KAAK;EAAA,IAAhC;MAAEK;IAAmB,CAAC,GAAAD,IAAA;IAAPL,KAAK,GAAAO,wBAAA,CAAAF,IAAA,EAAAG,SAAA;EACnD,MAAMC,cAAc,GAAGH,QAAQ,CAACI,MAAM;EAEtC,MAAMC,iBAAiB,GAAGA,CAACC,QAAQ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AAS,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,SACEpD,GAAG,EACHC,GAAG;AAELU,MAAM,CAAC0C,OAAO,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 };\nL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AAgB,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"],"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;AAC1B,OAAOC,UAAU,MAAM,eAAe;AACtC,SAASC,KAAK,QAAQ,aAAa;AAEnC,OAAO,MAAMC,wBAAwB,GAAG,OAAO;AAE/C,SAASC,WAAWA,CAAAC,IAAA,EAcjB;EAAA,IAdkB;IACnBC,QAAQ;IACRC,KAAK;IACLC,MAAM;IACNC,OAAO;IACPC,IAAI;IACJC,OAAO;IACPC,cAAc;IACdC,UAA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AAe;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;AAC1B,OAAOC,UAAU,MAAM,eAAe;AACtC,SAASC,KAAK,QAAQ,aAAa;AAEnC,OAAO,MAAMC,wBAAwB,GAAG,OAAO;AAE/C,SAASC,WAAWA,CAAAC,IAAA,EAcjB;EAAA,IAdkB;IACnBC,QAAQ;IACRC,KAAK;IACLC,MAAM;IACNC,OAAO;IACPC,IAAI;IACJC,OAAO;IACPC,cAAc;IACdC,UAAU;IACVC,kBAAkB;IAClBC,SAAS;IACTC,oBAAoB;IACpBC,UAAU;IACVC;EACF,CAAC,GAAAb,IAAA;EACC,MAAMc,QAAQ,GAAG3B,aAAa,CAAC;IAAE4B,KAAK,EAAE;EAAwB,CAAC,CAAC;EAClE,MAAMC,cAAc,GAAIL,oBAAoB,IAAIG,QAAS;EACzD,oBACE9B,KAAA,CAAAiC,aAAA,CAAC7B,UAAU;IAACe,MAAM,EAAEA,MAAO;IAACC,OAAO,EAAEA,OAAQ;IAACQ,UAAU,EAAEA,UAAW;IAACC,MAAM,EAAEA;EAAO,gBACnF7B,KAAA,CAAAiC,aAAA;IACEC,IAAI,EA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MAAM;EAC5B;AACF;AACA;EACEjB,SAAS,EAAEzB,SAAS,CAAC0C,MAAM;EAC3B;AACF;AACA;AACA;AACA;EACElB,kBAAkB,EAAExB,SAAS,CAAC4C,IAAI;EAClC;AACF;AACA;EACElB,oBAAoB,EAAE1B,SAAS,CAAC4C,IAAI;EACpC;AACF;AACA;EACEjB,UAAU,EAAE3B,SAAS,CAAC4C,IAAI;EAC1B;AACF;AACA;EACEhB,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"}
@@ -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
  };