@openedx/paragon 22.0.0-alpha.23 → 22.0.0-alpha.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/paragon-scripts.js +1 -1
- package/dist/Button/index.js +2 -2
- package/dist/Button/index.js.map +1 -1
- package/dist/Button/index.scss +3 -3
- package/dist/ColorPicker/index.js +48 -18
- package/dist/ColorPicker/index.js.map +1 -1
- package/dist/Container/index.js +6 -2
- package/dist/Container/index.js.map +1 -1
- package/dist/DataTable/index.js +2 -1
- package/dist/DataTable/index.js.map +1 -1
- package/dist/DataTable/selection/BaseSelectionStatus.js +3 -2
- package/dist/DataTable/selection/BaseSelectionStatus.js.map +1 -1
- package/dist/Dropdown/index.js.map +1 -1
- package/dist/Dropzone/index.js +2 -3
- package/dist/Dropzone/index.js.map +1 -1
- package/dist/Form/FormAutosuggest.js +9 -4
- package/dist/Form/FormAutosuggest.js.map +1 -1
- package/dist/Form/FormSwitch.js +3 -0
- package/dist/Form/FormSwitch.js.map +1 -1
- package/dist/Hyperlink/index.js +7 -6
- package/dist/Hyperlink/index.js.map +1 -1
- package/dist/Icon/index.js +18 -11
- package/dist/Icon/index.js.map +1 -1
- package/dist/IconButton/index.js +1 -1
- package/dist/IconButton/index.js.map +1 -1
- package/dist/Layout/index.js.map +1 -1
- package/dist/Menu/MenuItem.js +2 -2
- package/dist/Menu/MenuItem.js.map +1 -1
- package/dist/Modal/ModalDialog.js +3 -0
- package/dist/Modal/ModalDialog.js.map +1 -1
- package/dist/Popover/index.js +8 -8
- package/dist/Popover/index.js.map +1 -1
- package/dist/ProductTour/Checkpoint.js +10 -8
- package/dist/ProductTour/Checkpoint.js.map +1 -1
- package/dist/ProductTour/messages.js +16 -0
- package/dist/SearchField/SearchFieldAdvanced.js +12 -7
- package/dist/SearchField/SearchFieldAdvanced.js.map +1 -1
- package/dist/SearchField/SearchFieldLabel.js +3 -3
- package/dist/SearchField/SearchFieldLabel.js.map +1 -1
- package/dist/SearchField/index.js +0 -1
- package/dist/SearchField/index.js.map +1 -1
- package/dist/Tabs/index.js +13 -13
- package/dist/Tabs/index.js.map +1 -1
- package/dist/core.css +8 -6
- package/dist/core.css.map +1 -1
- package/dist/core.min.css +1 -1
- package/dist/hooks/useIndexOfLastVisibleChild.js +33 -38
- package/dist/hooks/useIndexOfLastVisibleChild.js.map +1 -1
- package/dist/i18n/messages/ar.json +2 -1
- package/dist/i18n/messages/ca.json +2 -1
- package/dist/i18n/messages/es_419.json +2 -1
- package/dist/i18n/messages/es_AR.json +2 -1
- package/dist/i18n/messages/es_ES.json +2 -1
- package/dist/i18n/messages/fr.json +2 -1
- package/dist/i18n/messages/he.json +2 -1
- package/dist/i18n/messages/id.json +2 -1
- package/dist/i18n/messages/it_IT.json +2 -1
- package/dist/i18n/messages/ko_KR.json +2 -1
- package/dist/i18n/messages/pl.json +2 -1
- package/dist/i18n/messages/pt_BR.json +2 -1
- package/dist/i18n/messages/pt_PT.json +2 -1
- package/dist/i18n/messages/ru.json +2 -1
- package/dist/i18n/messages/th.json +2 -1
- package/dist/i18n/messages/tr_TR.json +2 -1
- package/dist/i18n/messages/uk.json +2 -1
- package/dist/i18n/messages/zh_CN.json +2 -1
- package/dist/light.css +11 -11
- package/dist/light.css.map +1 -1
- package/dist/light.min.css +1 -1
- package/icons/es5/RightSidebarFilled.js +15 -0
- package/icons/es5/RightSidebarOutlined.js +15 -0
- package/icons/es5/index.js +2 -0
- package/icons/jsx/RightSidebarFilled.jsx +19 -0
- package/icons/jsx/RightSidebarOutlined.jsx +19 -0
- package/icons/jsx/index.jsx +2 -0
- package/icons/svg/right_sidebar_filled.svg +3 -0
- package/icons/svg/right_sidebar_outlined.svg +3 -0
- package/lib/utils.js +23 -2
- package/package.json +3 -3
- package/src/Button/README.md +94 -68
- package/src/Button/index.jsx +2 -2
- package/src/Button/index.scss +3 -3
- package/src/ColorPicker/ColorPicker.test.jsx +24 -2
- package/src/ColorPicker/index.jsx +56 -16
- package/src/Container/index.jsx +4 -0
- package/src/DataTable/README.md +3 -3
- package/src/DataTable/index.jsx +2 -1
- package/src/DataTable/selection/BaseSelectionStatus.jsx +2 -2
- package/src/DataTable/tablefilters.mdx +3 -3
- package/src/DataTable/tests/DataTable.test.jsx +31 -0
- package/src/Dropdown/index.jsx +4 -0
- package/src/Dropzone/index.jsx +2 -3
- package/src/Form/FormAutosuggest.jsx +11 -5
- package/src/Form/FormSwitch.jsx +3 -0
- package/src/Form/form-autosuggest.mdx +80 -72
- package/src/Form/tests/FormAutosuggest.test.jsx +21 -0
- package/src/Hyperlink/index.jsx +7 -6
- package/src/Icon/index.jsx +18 -11
- package/src/IconButton/index.jsx +1 -1
- package/src/Layout/index.jsx +1 -4
- package/src/Menu/MenuItem.jsx +2 -2
- package/src/Modal/ModalDialog.jsx +3 -0
- package/src/Overlay/README.md +1 -1
- package/src/Popover/README.md +0 -1
- package/src/Popover/index.jsx +11 -11
- package/src/ProductTour/Checkpoint.jsx +9 -6
- package/src/ProductTour/messages.js +16 -0
- package/src/SearchField/SearchFieldAdvanced.jsx +12 -7
- package/src/SearchField/SearchFieldLabel.jsx +3 -3
- package/src/SearchField/index.jsx +0 -1
- package/src/SelectableBox/tests/SelectableBoxSet.test.jsx +1 -1
- package/src/Tabs/index.jsx +19 -13
- package/src/hooks/tests/useIndexOfLastVisibleChild.test.jsx +3 -3
- package/src/hooks/useIndexOfLastVisibleChild.jsx +36 -38
- package/src/hooks/useIndexOfLastVisibleChild.mdx +3 -3
- package/src/i18n/messages/ar.json +2 -1
- package/src/i18n/messages/ca.json +2 -1
- package/src/i18n/messages/es_419.json +2 -1
- package/src/i18n/messages/es_AR.json +2 -1
- package/src/i18n/messages/es_ES.json +2 -1
- package/src/i18n/messages/fr.json +2 -1
- package/src/i18n/messages/he.json +2 -1
- package/src/i18n/messages/id.json +2 -1
- package/src/i18n/messages/it_IT.json +2 -1
- package/src/i18n/messages/ko_KR.json +2 -1
- package/src/i18n/messages/pl.json +2 -1
- package/src/i18n/messages/pt_BR.json +2 -1
- package/src/i18n/messages/pt_PT.json +2 -1
- package/src/i18n/messages/ru.json +2 -1
- package/src/i18n/messages/th.json +2 -1
- package/src/i18n/messages/tr_TR.json +2 -1
- package/src/i18n/messages/uk.json +2 -1
- package/src/i18n/messages/zh_CN.json +2 -1
- package/styles/css/core/variables.css +5 -3
- package/styles/css/themes/light/variables.css +11 -11
- package/tokens/src/core/components/Button/core.json +8 -4
- package/tokens/src/themes/light/alias/color.json +10 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MenuItem.js","names":["React","PropTypes","classNames","Icon","MenuItem","_ref","as","children","defaultSelected","iconAfter","iconBefore","props","_objectWithoutProperties","_excluded","className","createElement","_objectSpread","Fragment","src","propTypes","bool","string","node","elementType","oneOfType","element","
|
|
1
|
+
{"version":3,"file":"MenuItem.js","names":["React","PropTypes","classNames","Icon","MenuItem","_ref","as","children","defaultSelected","iconAfter","iconBefore","props","_objectWithoutProperties","_excluded","className","createElement","_objectSpread","Fragment","src","propTypes","bool","string","node","elementType","oneOfType","element","defaultProps","undefined"],"sources":["../../src/Menu/MenuItem.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport Icon from '../Icon';\n\nfunction MenuItem({\n as,\n children,\n defaultSelected,\n iconAfter,\n iconBefore,\n ...props\n}) {\n const className = classNames(props.className, 'pgn__menu-item');\n\n return React.createElement(\n as,\n {\n ...props,\n className,\n },\n (\n <>\n {iconBefore && <Icon className=\"btn-icon-before\" src={iconBefore} />}\n <span className=\"pgn__menu-item-text\">{children}</span>\n <span className=\"pgn__menu-item-content-spacer\" />\n {iconAfter && <Icon className=\"btn-icon-after\" src={iconAfter} />}\n </>\n ),\n );\n}\n\nMenuItem.propTypes = {\n /** Specifies that this ``MenuItem`` is selected inside the ``SelectMenu`` */\n defaultSelected: PropTypes.bool,\n /** Specifies class name to append to the base element */\n className: PropTypes.string,\n /** Specifies the content of the ``MenuItem`` */\n children: PropTypes.node,\n /** Specifies the base element */\n as: PropTypes.elementType,\n /** Specifies the jsx before the content of the ``MenuItem`` */\n iconBefore: PropTypes.oneOfType([PropTypes.element, PropTypes.elementType]),\n /** Specifies the jsx after the content of the ``MenuItem`` */\n iconAfter: PropTypes.oneOfType([PropTypes.element, PropTypes.elementType]),\n};\n\nMenuItem.defaultProps = {\n defaultSelected: false,\n as: 'button',\n className: undefined,\n children: null,\n iconBefore: undefined,\n iconAfter: undefined,\n};\n\nexport default MenuItem;\n"],"mappings":";;;;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,IAAI,MAAM,SAAS;AAE1B,SAASC,QAAQA,CAAAC,IAAA,EAOd;EAAA,IAPe;MAChBC,EAAE;MACFC,QAAQ;MACRC,eAAe;MACfC,SAAS;MACTC;IAEF,CAAC,GAAAL,IAAA;IADIM,KAAK,GAAAC,wBAAA,CAAAP,IAAA,EAAAQ,SAAA;EAER,MAAMC,SAAS,GAAGZ,UAAU,CAACS,KAAK,CAACG,SAAS,EAAE,gBAAgB,CAAC;EAE/D,oBAAOd,KAAK,CAACe,aAAa,CACxBT,EAAE,EAAAU,aAAA,CAAAA,aAAA,KAEGL,KAAK;IACRG;EAAS,iBAGTd,KAAA,CAAAe,aAAA,CAAAf,KAAA,CAAAiB,QAAA,QACGP,UAAU,iBAAIV,KAAA,CAAAe,aAAA,CAACZ,IAAI;IAACW,SAAS,EAAC,iBAAiB;IAACI,GAAG,EAAER;EAAW,CAAE,CAAC,eACpEV,KAAA,CAAAe,aAAA;IAAMD,SAAS,EAAC;EAAqB,GAAEP,QAAe,CAAC,eACvDP,KAAA,CAAAe,aAAA;IAAMD,SAAS,EAAC;EAA+B,CAAE,CAAC,EACjDL,SAAS,iBAAIT,KAAA,CAAAe,aAAA,CAACZ,IAAI;IAACW,SAAS,EAAC,gBAAgB;IAACI,GAAG,EAAET;EAAU,CAAE,CAChE,CAEN,CAAC;AACH;AAEAL,QAAQ,CAACe,SAAS,GAAG;EACnB;EACAX,eAAe,EAAEP,SAAS,CAACmB,IAAI;EAC/B;EACAN,SAAS,EAAEb,SAAS,CAACoB,MAAM;EAC3B;EACAd,QAAQ,EAAEN,SAAS,CAACqB,IAAI;EACxB;EACAhB,EAAE,EAAEL,SAAS,CAACsB,WAAW;EACzB;EACAb,UAAU,EAAET,SAAS,CAACuB,SAAS,CAAC,CAACvB,SAAS,CAACwB,OAAO,EAAExB,SAAS,CAACsB,WAAW,CAAC,CAAC;EAC3E;EACAd,SAAS,EAAER,SAAS,CAACuB,SAAS,CAAC,CAACvB,SAAS,CAACwB,OAAO,EAAExB,SAAS,CAACsB,WAAW,CAAC;AAC3E,CAAC;AAEDnB,QAAQ,CAACsB,YAAY,GAAG;EACtBlB,eAAe,EAAE,KAAK;EACtBF,EAAE,EAAE,QAAQ;EACZQ,SAAS,EAAEa,SAAS;EACpBpB,QAAQ,EAAE,IAAI;EACdG,UAAU,EAAEiB,SAAS;EACrBlB,SAAS,EAAEkB;AACb,CAAC;AAED,eAAevB,QAAQ"}
|
|
@@ -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,OAAO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S,GAAG;EACtB;AACF;AACA;EACEvB,QAAQ,EAAEhB,SAAS,CAACwC,IAAI,CAACC,UAAU;EACnC;AACF;AACA;EACExB,KAAK,EAAEjB,SAAS,CAAC0C,MAAM,CAACD,UAAU;EAClC;AACF;AACA;EACEtB,OAAO,EAAEnB,SAAS,CAAC2C,IAAI,CAACF,UAAU;EAClC;AACF;AACA;EACEvB,MAAM,EAAElB,SAAS,CAAC4C,IAAI;EACtB;AACF;AACA;EACEtB,cAAc,EAAEtB,SAAS,CAAC4C,IAAI;EAC9B;AACF;AACA;EACExB,IAAI,EAAEpB,SAAS,CAAC6C,KAAK,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,YAAY,CAAC,CAAC;EAC7D;AACF;AACA;EACExB,OAAO,EAAErB,SAAS,CAAC6C,KAAK,CAAC,CAAC,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;EAC7E;AACF;AACA;EACEtB,UAAU,EAAEvB,SAAS,CAAC0C,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;
|
|
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,qB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c,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"}
|
package/dist/Popover/index.js
CHANGED
|
@@ -10,17 +10,17 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
10
10
|
import React from 'react';
|
|
11
11
|
import PropTypes from 'prop-types';
|
|
12
12
|
import classNames from 'classnames';
|
|
13
|
-
import
|
|
13
|
+
import BasePopover from 'react-bootstrap/Popover';
|
|
14
14
|
import BasePopoverTitle from 'react-bootstrap/PopoverTitle';
|
|
15
15
|
import BasePopoverContent from 'react-bootstrap/PopoverContent';
|
|
16
16
|
const PLACEMENT_VARIANTS = ['auto', 'top', 'bottom', 'left', 'right'];
|
|
17
|
-
const
|
|
17
|
+
const Popover = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
18
18
|
let {
|
|
19
19
|
children,
|
|
20
20
|
variant
|
|
21
21
|
} = _ref,
|
|
22
22
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
23
|
-
return /*#__PURE__*/React.createElement(
|
|
23
|
+
return /*#__PURE__*/React.createElement(BasePopover, _extends({}, props, {
|
|
24
24
|
className: classNames({
|
|
25
25
|
[`popover-${variant}`]: !!variant
|
|
26
26
|
}, props.className),
|
|
@@ -41,7 +41,7 @@ const commonPropTypes = {
|
|
|
41
41
|
};
|
|
42
42
|
PopoverTitle.propTypes = commonPropTypes;
|
|
43
43
|
PopoverContent.propTypes = commonPropTypes;
|
|
44
|
-
|
|
44
|
+
Popover.propTypes = _objectSpread(_objectSpread({}, BasePopover.propTypes), {}, {
|
|
45
45
|
/** An html id attribute, necessary for accessibility. */
|
|
46
46
|
id: PropTypes.string.isRequired,
|
|
47
47
|
/**
|
|
@@ -82,7 +82,7 @@ WrapperPopover.propTypes = _objectSpread(_objectSpread({}, Popover.propTypes), {
|
|
|
82
82
|
/** The visual style of the `Overlay` */
|
|
83
83
|
variant: PropTypes.string
|
|
84
84
|
});
|
|
85
|
-
|
|
85
|
+
Popover.defaultProps = _objectSpread(_objectSpread({}, BasePopover.defaultProps), {}, {
|
|
86
86
|
placement: 'right',
|
|
87
87
|
title: undefined,
|
|
88
88
|
arrowProps: undefined,
|
|
@@ -101,8 +101,8 @@ PopoverContent.defaultProps = {
|
|
|
101
101
|
as: 'div',
|
|
102
102
|
bsPrefix: 'popover-body'
|
|
103
103
|
};
|
|
104
|
-
|
|
105
|
-
|
|
104
|
+
Popover.Title = PopoverTitle;
|
|
105
|
+
Popover.Content = PopoverContent;
|
|
106
106
|
export { PopoverTitle, PopoverContent };
|
|
107
|
-
export default
|
|
107
|
+
export default Popover;
|
|
108
108
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","PropTypes","classNames","
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","PropTypes","classNames","BasePopover","BasePopoverTitle","BasePopoverContent","PLACEMENT_VARIANTS","Popover","forwardRef","_ref","ref","children","variant","props","_objectWithoutProperties","_excluded","createElement","_extends","className","PopoverTitle","PopoverContent","commonPropTypes","as","elementType","bsPrefix","string","propTypes","_objectSpread","id","isRequired","placement","oneOf","title","arrowProps","shape","oneOfType","func","current","element","style","content","bool","popper","show","node","defaultProps","undefined","Title","Content"],"sources":["../../src/Popover/index.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport BasePopover from 'react-bootstrap/Popover';\nimport BasePopoverTitle from 'react-bootstrap/PopoverTitle';\nimport BasePopoverContent from 'react-bootstrap/PopoverContent';\n\nconst PLACEMENT_VARIANTS = [\n 'auto',\n 'top',\n 'bottom',\n 'left',\n 'right',\n];\n\nconst Popover = React.forwardRef(({\n children,\n variant,\n ...props\n}, ref) => (\n <BasePopover\n {...props}\n className={classNames({ [`popover-${variant}`]: !!variant }, props.className)}\n ref={ref}\n >\n {children}\n </BasePopover>\n));\n\nfunction PopoverTitle(props) {\n return <BasePopoverTitle {...props} />;\n}\nfunction PopoverContent(props) {\n return <BasePopoverContent {...props} />;\n}\n\nconst commonPropTypes = {\n /** Specifies the base element */\n as: PropTypes.elementType,\n /** Overrides underlying component base CSS class name */\n bsPrefix: PropTypes.string,\n};\n\nPopoverTitle.propTypes = commonPropTypes;\nPopoverContent.propTypes = commonPropTypes;\n\nPopover.propTypes = {\n ...BasePopover.propTypes,\n /** An html id attribute, necessary for accessibility. */\n id: PropTypes.string.isRequired,\n /**\n * Sets the direction the Popover is positioned towards.\n *\n * This is generally provided by the `Overlay` component positioning the popover.\n */\n placement: PropTypes.oneOf(PLACEMENT_VARIANTS),\n /**\n * When this prop is set, it creates a `Popover` with\n * a `Popover.Title` inside passing the children directly to it.\n */\n title: PropTypes.string,\n /**\n * An `Overlay` injected set of props for positioning the popover arrow.\n *\n * This is generally provided by the `Overlay` component positioning the popover.\n */\n arrowProps: PropTypes.shape({\n ref: PropTypes.oneOfType([\n PropTypes.func,\n PropTypes.shape({ current: PropTypes.element }),\n ]),\n style: PropTypes.shape({}),\n }),\n /**\n * When this prop is set, it creates a `Popover` with\n * a `Popover.Content` inside passing the children directly to it.\n */\n content: PropTypes.bool,\n /** A `Popper.js` config object passed to the the underlying popper instance. */\n popper: PropTypes.shape({}),\n /** Whether the `Overlay` is shown. */\n show: PropTypes.bool,\n /** Specifies the content of the `Overlay` */\n children: PropTypes.node,\n /** Specifies class name to append to the base element */\n className: PropTypes.string,\n /** The visual style of the `Overlay` */\n variant: PropTypes.string,\n};\n\nPopover.defaultProps = {\n ...BasePopover.defaultProps,\n placement: 'right',\n title: undefined,\n arrowProps: undefined,\n content: undefined,\n popper: undefined,\n show: undefined,\n children: undefined,\n className: undefined,\n variant: undefined,\n};\n\nPopoverTitle.defaultProps = {\n as: 'div',\n bsPrefix: 'popover-header',\n};\n\nPopoverContent.defaultProps = {\n as: 'div',\n bsPrefix: 'popover-body',\n};\n\nPopover.Title = PopoverTitle;\nPopover.Content = PopoverContent;\n\nexport { PopoverTitle, PopoverContent };\nexport default Popover;\n"],"mappings":";;;;;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,WAAW,MAAM,yBAAyB;AACjD,OAAOC,gBAAgB,MAAM,8BAA8B;AAC3D,OAAOC,kBAAkB,MAAM,gCAAgC;AAE/D,MAAMC,kBAAkB,GAAG,CACzB,MAAM,EACN,KAAK,EACL,QAAQ,EACR,MAAM,EACN,OAAO,CACR;AAED,MAAMC,OAAO,gBAAGP,KAAK,CAACQ,UAAU,CAAC,CAAAC,IAAA,EAI9BC,GAAG;EAAA,IAJ4B;MAChCC,QAAQ;MACRC;IAEF,CAAC,GAAAH,IAAA;IADII,KAAK,GAAAC,wBAAA,CAAAL,IAAA,EAAAM,SAAA;EAAA,oBAERf,KAAA,CAAAgB,aAAA,CAACb,WAAW,EAAAc,QAAA,KACNJ,KAAK;IACTK,SAAS,EAAEhB,UAAU,CAAC;MAAE,CAAE,WAAUU,OAAQ,EAAC,GAAG,CAAC,CAACA;IAAQ,CAAC,EAAEC,KAAK,CAACK,SAAS,CAAE;IAC9ER,GAAG,EAAEA;EAAI,IAERC,QACU,CAAC;AAAA,CACf,CAAC;AAEF,SAASQ,YAA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,SAAS,CAAC2C,IAAI;EACxB;EACA1B,SAAS,EAAEjB,SAAS,CAACwB,MAAM;EAC3B;EACAb,OAAO,EAAEX,SAAS,CAACwB;AAAM,EAC1B;AAEDlB,OAAO,CAACsC,YAAY,GAAAlB,aAAA,CAAAA,aAAA,KACfxB,WAAW,CAAC0C,YAAY;EAC3Bf,SAAS,EAAE,OAAO;EAClBE,KAAK,EAAEc,SAAS;EAChBb,UAAU,EAAEa,SAAS;EACrBN,OAAO,EAAEM,SAAS;EAClBJ,MAAM,EAAEI,SAAS;EACjBH,IAAI,EAAEG,SAAS;EACfnC,QAAQ,EAAEmC,SAAS;EACnB5B,SAAS,EAAE4B,SAAS;EACpBlC,OAAO,EAAEkC;AAAS,EACnB;AAED3B,YAAY,CAAC0B,YAAY,GAAG;EAC1BvB,EAAE,EAAE,KAAK;EACTE,QAAQ,EAAE;AACZ,CAAC;AAEDJ,cAAc,CAACyB,YAAY,GAAG;EAC5BvB,EAAE,EAAE,KAAK;EACTE,QAAQ,EAAE;AACZ,CAAC;AAEDjB,OAAO,CAACwC,KAAK,GAAG5B,YAAY;AAC5BZ,OAAO,CAACyC,OAAO,GAAG5B,cAAc;AAEhC,SAASD,YAAY,EAAEC,cAAc;AACrC,eAAeb,OAAO"}
|
|
@@ -12,6 +12,7 @@ import CheckpointActionRow from './CheckpointActionRow';
|
|
|
12
12
|
import CheckpointBody from './CheckpointBody';
|
|
13
13
|
import CheckpointBreadcrumbs from './CheckpointBreadcrumbs';
|
|
14
14
|
import CheckpointTitle from './CheckpointTitle';
|
|
15
|
+
import messages from './messages';
|
|
15
16
|
const Checkpoint = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
16
17
|
let {
|
|
17
18
|
body,
|
|
@@ -95,14 +96,11 @@ const Checkpoint = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
95
96
|
}
|
|
96
97
|
}, /*#__PURE__*/React.createElement("span", {
|
|
97
98
|
className: "sr-only"
|
|
98
|
-
}, /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
99
|
-
|
|
100
|
-
defaultMessage: "Top of step {step}",
|
|
101
|
-
value: {
|
|
99
|
+
}, /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, messages.topPositionText, {
|
|
100
|
+
values: {
|
|
102
101
|
step: index + 1
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
})), (title || !isOnlyCheckpoint) && /*#__PURE__*/React.createElement("div", {
|
|
102
|
+
}
|
|
103
|
+
}))), (title || !isOnlyCheckpoint) && /*#__PURE__*/React.createElement("div", {
|
|
106
104
|
className: "pgn__checkpoint-header"
|
|
107
105
|
}, /*#__PURE__*/React.createElement(CheckpointTitle, null, title), /*#__PURE__*/React.createElement(CheckpointBreadcrumbs, {
|
|
108
106
|
currentIndex: index,
|
|
@@ -115,7 +113,11 @@ const Checkpoint = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
115
113
|
"data-popper-arrow": true
|
|
116
114
|
}), /*#__PURE__*/React.createElement("span", {
|
|
117
115
|
className: "sr-only"
|
|
118
|
-
},
|
|
116
|
+
}, /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, messages.bottomPositionText, {
|
|
117
|
+
values: {
|
|
118
|
+
step: index + 1
|
|
119
|
+
}
|
|
120
|
+
}))));
|
|
119
121
|
});
|
|
120
122
|
Checkpoint.defaultProps = {
|
|
121
123
|
advanceButtonText: null,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkpoint.js","names":["React","useEffect","useState","useMediaQuery","PropTypes","createPopper","FormattedMessage","breakpoints","CheckpointActionRow","CheckpointBody","CheckpointBreadcrumbs","CheckpointTitle","Checkpoint","forwardRef","_ref","ref","body","index","placement","target","title","totalCheckpoints","props","_objectWithoutProperties","_excluded","checkpointVisible","setCheckpointVisible","isMobile","maxWidth","small","targetElement","document","querySelector","checkpoint","checkpointPopper","strategy","modifiers","name","options","padding","offset","tetherOffset","forceUpdate","targetOffset","getBoundingClientRect","top","bottom","global","innerHeight","includes","scrollTo","behavior","button","focus","isLastCheckpoint","isOnlyCheckpoint","createElement","id","className","role","style","visibility","pointerEvents","defaultMessage","value","step","description","currentIndex","_extends","defaultProps","advanceButtonText","dismissButtonText","endButtonText","showDismissButton","undefined","propTypes","node","number","isRequired","onAdvance","func","onDismiss","onEnd","oneOf","string","bool"],"sources":["../../src/ProductTour/Checkpoint.jsx"],"sourcesContent":["import React, { useEffect, useState } from 'react';\nimport { useMediaQuery } from 'react-responsive';\nimport PropTypes from 'prop-types';\nimport { createPopper } from '@popperjs/core';\nimport { FormattedMessage } from 'react-intl';\n\nimport breakpoints from '../utils/breakpoints';\n\nimport CheckpointActionRow from './CheckpointActionRow';\nimport CheckpointBody from './CheckpointBody';\nimport CheckpointBreadcrumbs from './CheckpointBreadcrumbs';\nimport CheckpointTitle from './CheckpointTitle';\n\nconst Checkpoint = React.forwardRef(({\n body,\n index,\n placement,\n target,\n title,\n totalCheckpoints,\n ...props\n}, ref) => {\n const [checkpointVisible, setCheckpointVisible] = useState(false);\n const isMobile = useMediaQuery({ maxWidth: breakpoints.small.maxWidth });\n\n useEffect(() => {\n const targetElement = document.querySelector(target);\n const checkpoint = document.querySelector('#pgn__checkpoint');\n if (targetElement && checkpoint) {\n // Use the Popper library to translate the Checkpoint to its target's coordinates\n const checkpointPopper = createPopper(targetElement, checkpoint, {\n placement: isMobile ? 'top' : placement,\n strategy: 'fixed',\n modifiers: [\n {\n name: 'arrow',\n options: {\n padding: 25,\n },\n },\n {\n name: 'offset',\n options: {\n offset: [0, 20],\n },\n },\n {\n name: 'preventOverflow',\n options: {\n padding: 20,\n tetherOffset: 35,\n },\n },\n ],\n });\n setCheckpointVisible(true);\n if (checkpointPopper) {\n checkpointPopper.forceUpdate();\n }\n }\n }, [target, isMobile, placement]);\n\n useEffect(() => {\n if (checkpointVisible) {\n // Scroll the Checkpoint into view once its rendered\n const targetElement = document.querySelector(target);\n let targetOffset = targetElement.getBoundingClientRect().top;\n if ((targetOffset < 0) || (targetElement.getBoundingClientRect().bottom > global.innerHeight)) {\n if (placement.includes('top')) {\n if (targetOffset < 0) {\n targetOffset *= -1;\n }\n targetOffset -= 280;\n } else {\n targetOffset -= 80;\n }\n\n global.scrollTo({\n top: targetOffset, behavior: 'smooth',\n });\n }\n\n const button = document.querySelector('.pgn__checkpoint-button_advance');\n button.focus();\n }\n }, [target, checkpointVisible, placement]);\n\n const isLastCheckpoint = index + 1 === totalCheckpoints;\n const isOnlyCheckpoint = totalCheckpoints === 1;\n\n return (\n <div\n id=\"pgn__checkpoint\"\n className=\"pgn__checkpoint\"\n aria-labelledby=\"pgn__checkpoint-title\"\n ref={ref}\n role=\"dialog\"\n style={{ visibility: checkpointVisible ? 'visible' : 'hidden', pointerEvents: checkpointVisible ? 'auto' : 'none' }}\n >\n <span className=\"sr-only\">\n <FormattedMessage\n id=\"pgn.ProductTour.Checkpoint.position-text\"\n defaultMessage=\"Top of step {step}\"\n value={{ step: index + 1 }}\n description=\"Screen-reader message to indicate the user's position in a sequence of checkpoints.\"\n />\n </span>\n {(title || !isOnlyCheckpoint) && (\n <div className=\"pgn__checkpoint-header\">\n <CheckpointTitle>{title}</CheckpointTitle>\n <CheckpointBreadcrumbs currentIndex={index} totalCheckpoints={totalCheckpoints} />\n </div>\n )}\n <CheckpointBody>{body}</CheckpointBody>\n <CheckpointActionRow\n isLastCheckpoint={isLastCheckpoint}\n index={index}\n {...props}\n />\n <div id=\"pgn__checkpoint-arrow\" data-popper-arrow />\n {/* This text is not translated due to Paragon's lack of i18n support */}\n <span className=\"sr-only\">Bottom of step {index + 1}</span>\n </div>\n );\n});\n\nCheckpoint.defaultProps = {\n advanceButtonText: null,\n body: null,\n dismissButtonText: null,\n endButtonText: null,\n placement: 'top',\n title: null,\n showDismissButton: undefined,\n};\n\nCheckpoint.propTypes = {\n /** The text displayed on the button used to advance the tour for the given Checkpoint. */\n advanceButtonText: PropTypes.node,\n /** The text displayed in the body of the Checkpoint */\n body: PropTypes.node,\n /** The text displayed on the button used to dismiss the tour for the given Checkpoint. */\n dismissButtonText: PropTypes.node,\n /** The text displayed on the button used to end the tour for the given Checkpoint. */\n endButtonText: PropTypes.node,\n /** The current index of the given Checkpoint */\n index: PropTypes.number.isRequired,\n /** A function that runs when triggering the `onClick` event of the advance\n * button for the given Checkpoint. */\n onAdvance: PropTypes.func.isRequired,\n /** A function that runs when triggering the `onClick` event of the dismiss\n * button for the given Checkpoint. */\n onDismiss: PropTypes.func.isRequired,\n /** A function that runs when triggering the `onClick` event of the advance\n * button if the given Checkpoint is the only or last Checkpoint in a tour. */\n onEnd: PropTypes.func.isRequired,\n /** A string that dictates the alignment of the Checkpoint around its target. */\n placement: PropTypes.oneOf([\n 'top', 'top-start', 'top-end', 'right-start', 'right', 'right-end',\n 'left-start', 'left', 'left-end', 'bottom', 'bottom-start', 'bottom-end',\n ]),\n /** The CSS selector for the Checkpoint's desired target. */\n target: PropTypes.string.isRequired,\n /** The text displayed in the title of the Checkpoint */\n title: PropTypes.node,\n /** The total number of Checkpoints in a tour */\n totalCheckpoints: PropTypes.number.isRequired,\n /** Enforces visibility of the dismiss button under all circumstances */\n showDismissButton: PropTypes.bool,\n};\n\nexport default Checkpoint;\n"],"mappings":";;;;AAAA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAClD,SAASC,aAAa,QAAQ,kBAAkB;AAChD,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,gBAAgB,QAAQ,YAAY;AAE7C,OAAOC,WAAW,MAAM,sBAAsB;AAE9C,OAAOC,mBAAmB,MAAM,uBAAuB;AACvD,OAAOC,cAAc,MAAM,kBAAkB;AAC7C,OAAOC,qBAAqB,MAAM,yBAAyB;AAC3D,OAAOC,eAAe,MAAM,mBAAmB;AAE/C,MAAMC,UAAU,gBAAGZ,KAAK,CAACa,UAAU,CAAC,CAAAC,IAAA,EAQjCC,GAAG,KAAK;EAAA,IAR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AAI;EACjC;EACA5D,IAAI,EAAEZ,SAAS,CAACwE,IAAI;EACpB;EACAL,iBAAiB,EAAEnE,SAAS,CAACwE,IAAI;EACjC;EACAJ,aAAa,EAAEpE,SAAS,CAACwE,IAAI;EAC7B;EACA3D,KAAK,EAAEb,SAAS,CAACyE,MAAM,CAACC,UAAU;EAClC;AACF;EACEC,SAAS,EAAE3E,SAAS,CAAC4E,IAAI,CAACF,UAAU;EACpC;AACF;EACEG,SAAS,EAAE7E,SAAS,CAAC4E,IAAI,CAACF,UAAU;EACpC;AACF;EACEI,KAAK,EAAE9E,SAAS,CAAC4E,IAAI,CAACF,UAAU;EAChC;EACA5D,SAAS,EAAEd,SAAS,CAAC+E,KAAK,CAAC,CACzB,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,aAAa,EAAE,OAAO,EAAE,WAAW,EAClE,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,cAAc,EAAE,YAAY,CACzE,CAAC;EACF;EACAhE,MAAM,EAAEf,SAAS,CAACgF,MAAM,CAACN,UAAU;EACnC;EACA1D,KAAK,EAAEhB,SAAS,CAACwE,IAAI;EACrB;EACAvD,gBAAgB,EAAEjB,SAAS,CAACyE,MAAM,CAACC,UAAU;EAC7C;EACAL,iBAAiB,EAAErE,SAAS,CAACiF;AAC/B,CAAC;AAED,eAAezE,UAAU"}
|
|
1
|
+
{"version":3,"file":"Checkpoint.js","names":["React","useEffect","useState","useMediaQuery","PropTypes","createPopper","FormattedMessage","breakpoints","CheckpointActionRow","CheckpointBody","CheckpointBreadcrumbs","CheckpointTitle","messages","Checkpoint","forwardRef","_ref","ref","body","index","placement","target","title","totalCheckpoints","props","_objectWithoutProperties","_excluded","checkpointVisible","setCheckpointVisible","isMobile","maxWidth","small","targetElement","document","querySelector","checkpoint","checkpointPopper","strategy","modifiers","name","options","padding","offset","tetherOffset","forceUpdate","targetOffset","getBoundingClientRect","top","bottom","global","innerHeight","includes","scrollTo","behavior","button","focus","isLastCheckpoint","isOnlyCheckpoint","createElement","id","className","role","style","visibility","pointerEvents","_extends","topPositionText","values","step","currentIndex","bottomPositionText","defaultProps","advanceButtonText","dismissButtonText","endButtonText","showDismissButton","undefined","propTypes","node","number","isRequired","onAdvance","func","onDismiss","onEnd","oneOf","string","bool"],"sources":["../../src/ProductTour/Checkpoint.jsx"],"sourcesContent":["import React, { useEffect, useState } from 'react';\nimport { useMediaQuery } from 'react-responsive';\nimport PropTypes from 'prop-types';\nimport { createPopper } from '@popperjs/core';\nimport { FormattedMessage } from 'react-intl';\n\nimport breakpoints from '../utils/breakpoints';\n\nimport CheckpointActionRow from './CheckpointActionRow';\nimport CheckpointBody from './CheckpointBody';\nimport CheckpointBreadcrumbs from './CheckpointBreadcrumbs';\nimport CheckpointTitle from './CheckpointTitle';\nimport messages from './messages';\n\nconst Checkpoint = React.forwardRef(({\n body,\n index,\n placement,\n target,\n title,\n totalCheckpoints,\n ...props\n}, ref) => {\n const [checkpointVisible, setCheckpointVisible] = useState(false);\n const isMobile = useMediaQuery({ maxWidth: breakpoints.small.maxWidth });\n\n useEffect(() => {\n const targetElement = document.querySelector(target);\n const checkpoint = document.querySelector('#pgn__checkpoint');\n if (targetElement && checkpoint) {\n // Use the Popper library to translate the Checkpoint to its target's coordinates\n const checkpointPopper = createPopper(targetElement, checkpoint, {\n placement: isMobile ? 'top' : placement,\n strategy: 'fixed',\n modifiers: [\n {\n name: 'arrow',\n options: {\n padding: 25,\n },\n },\n {\n name: 'offset',\n options: {\n offset: [0, 20],\n },\n },\n {\n name: 'preventOverflow',\n options: {\n padding: 20,\n tetherOffset: 35,\n },\n },\n ],\n });\n setCheckpointVisible(true);\n if (checkpointPopper) {\n checkpointPopper.forceUpdate();\n }\n }\n }, [target, isMobile, placement]);\n\n useEffect(() => {\n if (checkpointVisible) {\n // Scroll the Checkpoint into view once its rendered\n const targetElement = document.querySelector(target);\n let targetOffset = targetElement.getBoundingClientRect().top;\n if ((targetOffset < 0) || (targetElement.getBoundingClientRect().bottom > global.innerHeight)) {\n if (placement.includes('top')) {\n if (targetOffset < 0) {\n targetOffset *= -1;\n }\n targetOffset -= 280;\n } else {\n targetOffset -= 80;\n }\n\n global.scrollTo({\n top: targetOffset, behavior: 'smooth',\n });\n }\n\n const button = document.querySelector('.pgn__checkpoint-button_advance');\n button.focus();\n }\n }, [target, checkpointVisible, placement]);\n\n const isLastCheckpoint = index + 1 === totalCheckpoints;\n const isOnlyCheckpoint = totalCheckpoints === 1;\n\n return (\n <div\n id=\"pgn__checkpoint\"\n className=\"pgn__checkpoint\"\n aria-labelledby=\"pgn__checkpoint-title\"\n ref={ref}\n role=\"dialog\"\n style={{ visibility: checkpointVisible ? 'visible' : 'hidden', pointerEvents: checkpointVisible ? 'auto' : 'none' }}\n >\n <span className=\"sr-only\">\n <FormattedMessage\n {...messages.topPositionText}\n values={{ step: index + 1 }}\n />\n </span>\n {(title || !isOnlyCheckpoint) && (\n <div className=\"pgn__checkpoint-header\">\n <CheckpointTitle>{title}</CheckpointTitle>\n <CheckpointBreadcrumbs currentIndex={index} totalCheckpoints={totalCheckpoints} />\n </div>\n )}\n <CheckpointBody>{body}</CheckpointBody>\n <CheckpointActionRow\n isLastCheckpoint={isLastCheckpoint}\n index={index}\n {...props}\n />\n <div id=\"pgn__checkpoint-arrow\" data-popper-arrow />\n <span className=\"sr-only\">\n <FormattedMessage\n {...messages.bottomPositionText}\n values={{ step: index + 1 }}\n />\n </span>\n </div>\n );\n});\n\nCheckpoint.defaultProps = {\n advanceButtonText: null,\n body: null,\n dismissButtonText: null,\n endButtonText: null,\n placement: 'top',\n title: null,\n showDismissButton: undefined,\n};\n\nCheckpoint.propTypes = {\n /** The text displayed on the button used to advance the tour for the given Checkpoint. */\n advanceButtonText: PropTypes.node,\n /** The text displayed in the body of the Checkpoint */\n body: PropTypes.node,\n /** The text displayed on the button used to dismiss the tour for the given Checkpoint. */\n dismissButtonText: PropTypes.node,\n /** The text displayed on the button used to end the tour for the given Checkpoint. */\n endButtonText: PropTypes.node,\n /** The current index of the given Checkpoint */\n index: PropTypes.number.isRequired,\n /** A function that runs when triggering the `onClick` event of the advance\n * button for the given Checkpoint. */\n onAdvance: PropTypes.func.isRequired,\n /** A function that runs when triggering the `onClick` event of the dismiss\n * button for the given Checkpoint. */\n onDismiss: PropTypes.func.isRequired,\n /** A function that runs when triggering the `onClick` event of the advance\n * button if the given Checkpoint is the only or last Checkpoint in a tour. */\n onEnd: PropTypes.func.isRequired,\n /** A string that dictates the alignment of the Checkpoint around its target. */\n placement: PropTypes.oneOf([\n 'top', 'top-start', 'top-end', 'right-start', 'right', 'right-end',\n 'left-start', 'left', 'left-end', 'bottom', 'bottom-start', 'bottom-end',\n ]),\n /** The CSS selector for the Checkpoint's desired target. */\n target: PropTypes.string.isRequired,\n /** The text displayed in the title of the Checkpoint */\n title: PropTypes.node,\n /** The total number of Checkpoints in a tour */\n totalCheckpoints: PropTypes.number.isRequired,\n /** Enforces visibility of the dismiss button under all circumstances */\n showDismissButton: PropTypes.bool,\n};\n\nexport default Checkpoint;\n"],"mappings":";;;;AAAA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAClD,SAASC,aAAa,QAAQ,kBAAkB;AAChD,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,gBAAgB,QAAQ,YAAY;AAE7C,OAAOC,WAAW,MAAM,sBAAsB;AAE9C,OAAOC,mBAAmB,MAAM,uBAAuB;AACvD,OAAOC,cAAc,MAAM,kBAAkB;AAC7C,OAAOC,qBAAqB,MAAM,yBAAyB;AAC3D,OAAOC,eAAe,MAAM,mBAAmB;AAC/C,OAAOC,QAAQ,MAAM,YAAY;AAEjC,MAAMC,UAAU,gBAAGb,KAAK,CAACc,UAAU,CAAC,CAAAC,IAAA,EAQjCC,GAAG,KAAK;EAAA,IAR0B;MACnCC,IAAI;MACJC,KAAK;MACLC,SAAS;MACTC,MAAM;MACNC,KAAK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iB,EAAEnE,SAAS,CAACyE,IAAI;EACjC;EACA5D,IAAI,EAAEb,SAAS,CAACyE,IAAI;EACpB;EACAL,iBAAiB,EAAEpE,SAAS,CAACyE,IAAI;EACjC;EACAJ,aAAa,EAAErE,SAAS,CAACyE,IAAI;EAC7B;EACA3D,KAAK,EAAEd,SAAS,CAAC0E,MAAM,CAACC,UAAU;EAClC;AACF;EACEC,SAAS,EAAE5E,SAAS,CAAC6E,IAAI,CAACF,UAAU;EACpC;AACF;EACEG,SAAS,EAAE9E,SAAS,CAAC6E,IAAI,CAACF,UAAU;EACpC;AACF;EACEI,KAAK,EAAE/E,SAAS,CAAC6E,IAAI,CAACF,UAAU;EAChC;EACA5D,SAAS,EAAEf,SAAS,CAACgF,KAAK,CAAC,CACzB,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,aAAa,EAAE,OAAO,EAAE,WAAW,EAClE,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,cAAc,EAAE,YAAY,CACzE,CAAC;EACF;EACAhE,MAAM,EAAEhB,SAAS,CAACiF,MAAM,CAACN,UAAU;EACnC;EACA1D,KAAK,EAAEjB,SAAS,CAACyE,IAAI;EACrB;EACAvD,gBAAgB,EAAElB,SAAS,CAAC0E,MAAM,CAACC,UAAU;EAC7C;EACAL,iBAAiB,EAAEtE,SAAS,CAACkF;AAC/B,CAAC;AAED,eAAezE,UAAU"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { defineMessages } from 'react-intl';
|
|
2
|
+
|
|
3
|
+
const messages = defineMessages({
|
|
4
|
+
topPositionText: {
|
|
5
|
+
id: 'pgn.ProductTour.Checkpoint.top-position-text',
|
|
6
|
+
defaultMessage: 'Top of step {step}',
|
|
7
|
+
description: 'Screen-reader message to notify user that they are located at the bottom of the product tour step.',
|
|
8
|
+
},
|
|
9
|
+
bottomPositionText: {
|
|
10
|
+
id: 'pgn.ProductTour.Checkpoint.bottom-position-text',
|
|
11
|
+
defaultMessage: 'Bottom of step {step}',
|
|
12
|
+
description: 'Screen-reader message to notify user that they are located at the bottom of the product tour step.',
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export default messages;
|
|
@@ -2,7 +2,6 @@ const _excluded = ["children", "className", "screenReaderText", "icons", "onSubm
|
|
|
2
2
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
3
3
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
4
4
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
5
|
-
/* eslint-disable max-len */
|
|
6
5
|
import React, { useRef, createContext, useState, useEffect } from 'react';
|
|
7
6
|
import PropTypes from 'prop-types';
|
|
8
7
|
import classNames from 'classnames';
|
|
@@ -108,27 +107,32 @@ SearchFieldAdvanced.propTypes = {
|
|
|
108
107
|
onSubmit: PropTypes.func.isRequired,
|
|
109
108
|
/** specifies a custom class name. */
|
|
110
109
|
className: PropTypes.string,
|
|
111
|
-
/** specifies a callback function for when the user loses focus in the `SearchField` component.
|
|
110
|
+
/** specifies a callback function for when the user loses focus in the `SearchField` component.
|
|
111
|
+
* The default is an empty function. For example:
|
|
112
112
|
```jsx
|
|
113
113
|
<SearchField onBlur={event => console.log(event)} />
|
|
114
114
|
``` */
|
|
115
115
|
onBlur: PropTypes.func,
|
|
116
|
-
/** specifies a callback function for when the value in `SearchField` is changed by the user.
|
|
116
|
+
/** specifies a callback function for when the value in `SearchField` is changed by the user.
|
|
117
|
+
* The default is an empty function. For example:
|
|
117
118
|
```jsx
|
|
118
119
|
<SearchField onChange={value => console.log(value)} />
|
|
119
120
|
``` */
|
|
120
121
|
onChange: PropTypes.func,
|
|
121
|
-
/** specifies a callback function for when the value in `SearchField` is cleared by the user.
|
|
122
|
+
/** specifies a callback function for when the value in `SearchField` is cleared by the user.
|
|
123
|
+
* The default is an empty function. For example:
|
|
122
124
|
```jsx
|
|
123
125
|
<SearchField onClear={() => console.log('search cleared')} />
|
|
124
126
|
``` */
|
|
125
127
|
onClear: PropTypes.func,
|
|
126
|
-
/** specifies a callback function for when the user focuses in the `SearchField` component.
|
|
128
|
+
/** specifies a callback function for when the user focuses in the `SearchField` component.
|
|
129
|
+
* The default is an empty function. For example:
|
|
127
130
|
```jsx
|
|
128
131
|
<SearchField onFocus={event => console.log(event)} />
|
|
129
132
|
``` */
|
|
130
133
|
onFocus: PropTypes.func,
|
|
131
|
-
/** specifies the screenreader text for both the clear and submit buttons (e.g., for i18n translations).
|
|
134
|
+
/** specifies the screenreader text for both the clear and submit buttons (e.g., for i18n translations).
|
|
135
|
+
* The default is `{ label: 'search', clearButton: 'clear search', searchButton: 'submit search' }`. */
|
|
132
136
|
screenReaderText: PropTypes.shape({
|
|
133
137
|
label: PropTypes.oneOfType([PropTypes.string, PropTypes.element]).isRequired,
|
|
134
138
|
submitButton: PropTypes.oneOfType([PropTypes.string, PropTypes.element]).isRequired,
|
|
@@ -141,7 +145,8 @@ SearchFieldAdvanced.propTypes = {
|
|
|
141
145
|
submit: PropTypes.element.isRequired,
|
|
142
146
|
clear: PropTypes.element
|
|
143
147
|
}),
|
|
144
|
-
/** specifies the aria-label attribute on the form element. This is useful if you use the `SearchField` component
|
|
148
|
+
/** specifies the aria-label attribute on the form element. This is useful if you use the `SearchField` component
|
|
149
|
+
* more than once on a page. */
|
|
145
150
|
formAriaLabel: PropTypes.string,
|
|
146
151
|
/** Specifies whether the `SearchField` is disabled. */
|
|
147
152
|
disabled: PropTypes.bool,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchFieldAdvanced.js","names":["React","useRef","createContext","useState","useEffect","PropTypes","classNames","Search","Close","newId","Icon","SearchFieldContext","BUTTON_LOCATION_VARIANTS","SearchFieldAdvanced","props","children","className","screenReaderText","icons","onSubmit","onClear","onChange","onBlur","onFocus","value","initialValue","formAriaLabel","disabled","submitButtonLocation","rest","_objectWithoutProperties","_excluded","hasFocus","setHasFocus","setValue","isInitialMount","inputId","inputRef","submitButtonRef","current","handleSubmit","event","preventDefault","focus","handleClear","handleFocus","handleBlur","handleChange","target","createElement","_extends","role","onReset","Provider","refs","input","submitButton","propTypes","node","isRequired","func","string","shape","label","oneOfType","element","clearButton","submit","clear","bool","oneOf","defaultProps","undefined","src"],"sources":["../../src/SearchField/SearchFieldAdvanced.jsx"],"sourcesContent":["/* eslint-disable max-len */\nimport React, {\n useRef, createContext, useState, useEffect,\n} from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport { Search, Close } from '../../icons';\nimport newId from '../utils/newId';\n\nimport Icon from '../Icon';\n\nexport const SearchFieldContext = createContext();\n\nconst BUTTON_LOCATION_VARIANTS = [\n 'internal',\n 'external',\n];\n\nfunction SearchFieldAdvanced(props) {\n const {\n children,\n className,\n screenReaderText,\n icons,\n onSubmit,\n onClear,\n onChange,\n onBlur,\n onFocus,\n value: initialValue,\n formAriaLabel,\n disabled,\n submitButtonLocation,\n ...rest\n } = props;\n\n const [hasFocus, setHasFocus] = useState(false);\n const [value, setValue] = useState(initialValue);\n\n const isInitialMount = useRef(true);\n const inputId = useRef(`${newId('pgn-searchfield-input-')}`);\n const inputRef = useRef();\n const submitButtonRef = useRef();\n\n useEffect(() => {\n setValue(initialValue);\n }, [initialValue]);\n\n useEffect(() => {\n if (isInitialMount.current) {\n isInitialMount.current = false;\n } else {\n onChange(value);\n }\n }, [value, onChange]);\n\n const handleSubmit = (event) => {\n event.preventDefault();\n onSubmit(value);\n if (submitButtonRef && submitButtonRef.current) {\n submitButtonRef.current.focus();\n }\n };\n\n const handleClear = () => {\n setValue('');\n onClear();\n if (inputRef && inputRef.current) {\n inputRef.current.focus();\n }\n };\n\n const handleFocus = (event) => {\n setHasFocus(true);\n onFocus(event);\n };\n\n const handleBlur = (event) => {\n setHasFocus(false);\n onBlur(event);\n };\n\n const handleChange = (event) => {\n setValue(event.target.value);\n };\n\n return (\n <div\n className={classNames(\n 'pgn__searchfield',\n 'd-flex',\n {\n 'has-focus': hasFocus,\n disabled,\n 'pgn__searchfield--external': submitButtonLocation === 'external',\n },\n className,\n )}\n {...rest}\n >\n <form\n role=\"search\"\n onSubmit={handleSubmit}\n onReset={handleClear}\n className=\"pgn__searchfield-form\"\n aria-label={formAriaLabel}\n >\n <SearchFieldContext.Provider\n value={{\n inputId,\n screenReaderText,\n icons,\n value,\n disabled,\n handleFocus,\n handleBlur,\n handleChange,\n refs: {\n input: inputRef,\n submitButton: submitButtonRef,\n },\n }}\n >\n {children}\n </SearchFieldContext.Provider>\n </form>\n </div>\n );\n}\n\nSearchFieldAdvanced.propTypes = {\n /** specifies the nested child elements. At a minimum, `SearchField.Label` and `SearchField.Input` are required. */\n children: PropTypes.node.isRequired,\n /** specifies a callback function for when the `SearchField` is submitted by the user. For example:\n ```jsx\n <SearchField onSubmit={(value) => { console.log(value); } />\n ``` */\n onSubmit: PropTypes.func.isRequired,\n /** specifies a custom class name. */\n className: PropTypes.string,\n /** specifies a callback function for when the user loses focus in the `SearchField` component. The default is an empty function. For example:\n ```jsx\n <SearchField onBlur={event => console.log(event)} />\n ``` */\n onBlur: PropTypes.func,\n /** specifies a callback function for when the value in `SearchField` is changed by the user. The default is an empty function. For example:\n ```jsx\n <SearchField onChange={value => console.log(value)} />\n ``` */\n onChange: PropTypes.func,\n /** specifies a callback function for when the value in `SearchField` is cleared by the user. The default is an empty function. For example:\n ```jsx\n <SearchField onClear={() => console.log('search cleared')} />\n ``` */\n onClear: PropTypes.func,\n /** specifies a callback function for when the user focuses in the `SearchField` component. The default is an empty function. For example:\n ```jsx\n <SearchField onFocus={event => console.log(event)} />\n ``` */\n onFocus: PropTypes.func,\n /** specifies the screenreader text for both the clear and submit buttons (e.g., for i18n translations). The default is `{ label: 'search', clearButton: 'clear search', searchButton: 'submit search' }`. */\n screenReaderText: PropTypes.shape({\n label: PropTypes.oneOfType([PropTypes.string, PropTypes.element]).isRequired,\n submitButton: PropTypes.oneOfType([PropTypes.string, PropTypes.element]).isRequired,\n clearButton: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),\n }),\n /** specifies the initial value for the input. The default is an empty string. */\n value: PropTypes.string,\n /** specifies the icon element(s) to use for the clear and submit buttons. */\n icons: PropTypes.shape({\n submit: PropTypes.element.isRequired,\n clear: PropTypes.element,\n }),\n /** specifies the aria-label attribute on the form element. This is useful if you use the `SearchField` component more than once on a page. */\n formAriaLabel: PropTypes.string,\n /** Specifies whether the `SearchField` is disabled. */\n disabled: PropTypes.bool,\n /** Controls whether the search button is internal as an icon or external as a button. */\n submitButtonLocation: PropTypes.oneOf(BUTTON_LOCATION_VARIANTS),\n};\n\nSearchFieldAdvanced.defaultProps = {\n className: undefined,\n formAriaLabel: undefined,\n value: '',\n screenReaderText: {\n label: 'search',\n submitButton: 'submit search',\n clearButton: 'clear search',\n },\n icons: {\n clear: <Icon src={Close} />,\n submit: <Icon src={Search} />,\n },\n onBlur: () => {},\n onChange: () => {},\n onFocus: () => {},\n onClear: () => {},\n disabled: false,\n submitButtonLocation: 'internal',\n};\n\nexport default SearchFieldAdvanced;\n"],"mappings":";;;;AAAA;AACA,OAAOA,KAAK,IACVC,MAAM,EAAEC,aAAa,EAAEC,QAAQ,EAAEC,SAAS,QACrC,OAAO;AACd,OAAOC,SAAS,M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EACA3C,KAAK,EAAEb,SAAS,CAACyD,KAAK,CAAC;IACrBK,MAAM,EAAE9D,SAAS,CAAC4D,OAAO,CAACN,UAAU;IACpCS,KAAK,EAAE/D,SAAS,CAAC4D;EACnB,CAAC,CAAC;EACF;EACAvC,aAAa,EAAErB,SAAS,CAACwD,MAAM;EAC/B;EACAlC,QAAQ,EAAEtB,SAAS,CAACgE,IAAI;EACxB;EACAzC,oBAAoB,EAAEvB,SAAS,CAACiE,KAAK,CAAC1D,wBAAwB;AAChE,CAAC;AAEDC,mBAAmB,CAAC0D,YAAY,GAAG;EACjCvD,SAAS,EAAEwD,SAAS;EACpB9C,aAAa,EAAE8C,SAAS;EACxBhD,KAAK,EAAE,EAAE;EACTP,gBAAgB,EAAE;IAChB8C,KAAK,EAAE,QAAQ;IACfP,YAAY,EAAE,eAAe;IAC7BU,WAAW,EAAE;EACf,CAAC;EACDhD,KAAK,EAAE;IACLkD,KAAK,eAAEpE,KAAA,CAAAiD,aAAA,CAACvC,IAAI;MAAC+D,GAAG,EAAEjE;IAAM,CAAE,CAAC;IAC3B2D,MAAM,eAAEnE,KAAA,CAAAiD,aAAA,CAACvC,IAAI;MAAC+D,GAAG,EAAElE;IAAO,CAAE;EAC9B,CAAC;EACDe,MAAM,EAAEA,CAAA,KAAM,CAAC,CAAC;EAChBD,QAAQ,EAAEA,CAAA,KAAM,CAAC,CAAC;EAClBE,OAAO,EAAEA,CAAA,KAAM,CAAC,CAAC;EACjBH,OAAO,EAAEA,CAAA,KAAM,CAAC,CAAC;EACjBO,QAAQ,EAAE,KAAK;EACfC,oBAAoB,EAAE;AACxB,CAAC;AAED,eAAef,mBAAmB"}
|
|
1
|
+
{"version":3,"file":"SearchFieldAdvanced.js","names":["React","useRef","createContext","useState","useEffect","PropTypes","classNames","Search","Close","newId","Icon","SearchFieldContext","BUTTON_LOCATION_VARIANTS","SearchFieldAdvanced","props","children","className","screenReaderText","icons","onSubmit","onClear","onChange","onBlur","onFocus","value","initialValue","formAriaLabel","disabled","submitButtonLocation","rest","_objectWithoutProperties","_excluded","hasFocus","setHasFocus","setValue","isInitialMount","inputId","inputRef","submitButtonRef","current","handleSubmit","event","preventDefault","focus","handleClear","handleFocus","handleBlur","handleChange","target","createElement","_extends","role","onReset","Provider","refs","input","submitButton","propTypes","node","isRequired","func","string","shape","label","oneOfType","element","clearButton","submit","clear","bool","oneOf","defaultProps","undefined","src"],"sources":["../../src/SearchField/SearchFieldAdvanced.jsx"],"sourcesContent":["import React, {\n useRef, createContext, useState, useEffect,\n} from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport { Search, Close } from '../../icons';\nimport newId from '../utils/newId';\n\nimport Icon from '../Icon';\n\nexport const SearchFieldContext = createContext();\n\nconst BUTTON_LOCATION_VARIANTS = [\n 'internal',\n 'external',\n];\n\nfunction SearchFieldAdvanced(props) {\n const {\n children,\n className,\n screenReaderText,\n icons,\n onSubmit,\n onClear,\n onChange,\n onBlur,\n onFocus,\n value: initialValue,\n formAriaLabel,\n disabled,\n submitButtonLocation,\n ...rest\n } = props;\n\n const [hasFocus, setHasFocus] = useState(false);\n const [value, setValue] = useState(initialValue);\n\n const isInitialMount = useRef(true);\n const inputId = useRef(`${newId('pgn-searchfield-input-')}`);\n const inputRef = useRef();\n const submitButtonRef = useRef();\n\n useEffect(() => {\n setValue(initialValue);\n }, [initialValue]);\n\n useEffect(() => {\n if (isInitialMount.current) {\n isInitialMount.current = false;\n } else {\n onChange(value);\n }\n }, [value, onChange]);\n\n const handleSubmit = (event) => {\n event.preventDefault();\n onSubmit(value);\n if (submitButtonRef && submitButtonRef.current) {\n submitButtonRef.current.focus();\n }\n };\n\n const handleClear = () => {\n setValue('');\n onClear();\n if (inputRef && inputRef.current) {\n inputRef.current.focus();\n }\n };\n\n const handleFocus = (event) => {\n setHasFocus(true);\n onFocus(event);\n };\n\n const handleBlur = (event) => {\n setHasFocus(false);\n onBlur(event);\n };\n\n const handleChange = (event) => {\n setValue(event.target.value);\n };\n\n return (\n <div\n className={classNames(\n 'pgn__searchfield',\n 'd-flex',\n {\n 'has-focus': hasFocus,\n disabled,\n 'pgn__searchfield--external': submitButtonLocation === 'external',\n },\n className,\n )}\n {...rest}\n >\n <form\n role=\"search\"\n onSubmit={handleSubmit}\n onReset={handleClear}\n className=\"pgn__searchfield-form\"\n aria-label={formAriaLabel}\n >\n <SearchFieldContext.Provider\n value={{\n inputId,\n screenReaderText,\n icons,\n value,\n disabled,\n handleFocus,\n handleBlur,\n handleChange,\n refs: {\n input: inputRef,\n submitButton: submitButtonRef,\n },\n }}\n >\n {children}\n </SearchFieldContext.Provider>\n </form>\n </div>\n );\n}\n\nSearchFieldAdvanced.propTypes = {\n /** specifies the nested child elements. At a minimum, `SearchField.Label` and `SearchField.Input` are required. */\n children: PropTypes.node.isRequired,\n /** specifies a callback function for when the `SearchField` is submitted by the user. For example:\n ```jsx\n <SearchField onSubmit={(value) => { console.log(value); } />\n ``` */\n onSubmit: PropTypes.func.isRequired,\n /** specifies a custom class name. */\n className: PropTypes.string,\n /** specifies a callback function for when the user loses focus in the `SearchField` component.\n * The default is an empty function. For example:\n ```jsx\n <SearchField onBlur={event => console.log(event)} />\n ``` */\n onBlur: PropTypes.func,\n /** specifies a callback function for when the value in `SearchField` is changed by the user.\n * The default is an empty function. For example:\n ```jsx\n <SearchField onChange={value => console.log(value)} />\n ``` */\n onChange: PropTypes.func,\n /** specifies a callback function for when the value in `SearchField` is cleared by the user.\n * The default is an empty function. For example:\n ```jsx\n <SearchField onClear={() => console.log('search cleared')} />\n ``` */\n onClear: PropTypes.func,\n /** specifies a callback function for when the user focuses in the `SearchField` component.\n * The default is an empty function. For example:\n ```jsx\n <SearchField onFocus={event => console.log(event)} />\n ``` */\n onFocus: PropTypes.func,\n /** specifies the screenreader text for both the clear and submit buttons (e.g., for i18n translations).\n * The default is `{ label: 'search', clearButton: 'clear search', searchButton: 'submit search' }`. */\n screenReaderText: PropTypes.shape({\n label: PropTypes.oneOfType([PropTypes.string, PropTypes.element]).isRequired,\n submitButton: PropTypes.oneOfType([PropTypes.string, PropTypes.element]).isRequired,\n clearButton: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),\n }),\n /** specifies the initial value for the input. The default is an empty string. */\n value: PropTypes.string,\n /** specifies the icon element(s) to use for the clear and submit buttons. */\n icons: PropTypes.shape({\n submit: PropTypes.element.isRequired,\n clear: PropTypes.element,\n }),\n /** specifies the aria-label attribute on the form element. This is useful if you use the `SearchField` component\n * more than once on a page. */\n formAriaLabel: PropTypes.string,\n /** Specifies whether the `SearchField` is disabled. */\n disabled: PropTypes.bool,\n /** Controls whether the search button is internal as an icon or external as a button. */\n submitButtonLocation: PropTypes.oneOf(BUTTON_LOCATION_VARIANTS),\n};\n\nSearchFieldAdvanced.defaultProps = {\n className: undefined,\n formAriaLabel: undefined,\n value: '',\n screenReaderText: {\n label: 'search',\n submitButton: 'submit search',\n clearButton: 'clear search',\n },\n icons: {\n clear: <Icon src={Close} />,\n submit: <Icon src={Search} />,\n },\n onBlur: () => {},\n onChange: () => {},\n onFocus: () => {},\n onClear: () => {},\n disabled: false,\n submitButtonLocation: 'internal',\n};\n\nexport default SearchFieldAdvanced;\n"],"mappings":";;;;AAAA,OAAOA,KAAK,IACVC,MAAM,EAAEC,aAAa,EAAEC,QAAQ,EAAEC,SAAS,QACrC,OAAO;AACd,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,UAAU,MAAM,YAAY;AACnC,SAASC,MAAM,EAAEC,KAAK,QAAQ,aAAa;AAC3C,OAAOC,KAAK,MAAM,gBAAgB;AAElC,OAAOC,IAAI,MAAM,SAAS;AAE1B,OAAO,MAAMC,kBAAkB,gBAAGT,aAAa,CAAC,CAAC;AAEjD,MAAMU,wBAAwB,GAAG,CAC/B,UAAU,EACV,UAAU,CACX;AAED,SAASC,mBAAmBA,CAACC,KAAK,EAAE;EAClC,MAAM;MACJC,QAAQ;MACRC,SAAS;MACTC,gBAAgB;MAChBC,KAAK;MACLC,QAAQ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AAY,GAAG;EACjCvD,SAAS,EAAEwD,SAAS;EACpB9C,aAAa,EAAE8C,SAAS;EACxBhD,KAAK,EAAE,EAAE;EACTP,gBAAgB,EAAE;IAChB8C,KAAK,EAAE,QAAQ;IACfP,YAAY,EAAE,eAAe;IAC7BU,WAAW,EAAE;EACf,CAAC;EACDhD,KAAK,EAAE;IACLkD,KAAK,eAAEpE,KAAA,CAAAiD,aAAA,CAACvC,IAAI;MAAC+D,GAAG,EAAEjE;IAAM,CAAE,CAAC;IAC3B2D,MAAM,eAAEnE,KAAA,CAAAiD,aAAA,CAACvC,IAAI;MAAC+D,GAAG,EAAElE;IAAO,CAAE;EAC9B,CAAC;EACDe,MAAM,EAAEA,CAAA,KAAM,CAAC,CAAC;EAChBD,QAAQ,EAAEA,CAAA,KAAM,CAAC,CAAC;EAClBE,OAAO,EAAEA,CAAA,KAAM,CAAC,CAAC;EACjBH,OAAO,EAAEA,CAAA,KAAM,CAAC,CAAC;EACjBO,QAAQ,EAAE,KAAK;EACfC,oBAAoB,EAAE;AACxB,CAAC;AAED,eAAef,mBAAmB"}
|
|
@@ -2,7 +2,6 @@ const _excluded = ["children"];
|
|
|
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, { useContext } from 'react';
|
|
7
6
|
import PropTypes from 'prop-types';
|
|
8
7
|
import classNames from 'classnames';
|
|
@@ -27,8 +26,9 @@ function SearchFieldLabel(_ref) {
|
|
|
27
26
|
}
|
|
28
27
|
SearchFieldLabel.propTypes = {
|
|
29
28
|
/**
|
|
30
|
-
* specifies the label to use for the input field (e.g., for i18n translations).
|
|
31
|
-
* a screenreader-only label will be used in
|
|
29
|
+
* specifies the label to use for the input field (e.g., for i18n translations).
|
|
30
|
+
* Note: if `children` is not provided, a screenreader-only label will be used in
|
|
31
|
+
* its placed based on the `screenReaderText.label` prop for `SearchField.Advanced`.
|
|
32
32
|
*/
|
|
33
33
|
children: PropTypes.oneOfType([PropTypes.string, PropTypes.element])
|
|
34
34
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchFieldLabel.js","names":["React","useContext","PropTypes","classNames","SearchFieldContext","SearchFieldLabel","_ref","children","props","_objectWithoutProperties","_excluded","screenReaderText","inputId","createElement","_extends","htmlFor","current","className","label","propTypes","oneOfType","string","element","defaultProps","undefined"],"sources":["../../src/SearchField/SearchFieldLabel.jsx"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"SearchFieldLabel.js","names":["React","useContext","PropTypes","classNames","SearchFieldContext","SearchFieldLabel","_ref","children","props","_objectWithoutProperties","_excluded","screenReaderText","inputId","createElement","_extends","htmlFor","current","className","label","propTypes","oneOfType","string","element","defaultProps","undefined"],"sources":["../../src/SearchField/SearchFieldLabel.jsx"],"sourcesContent":["import React, { useContext } from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\n\nimport { SearchFieldContext } from './SearchFieldAdvanced';\n\nfunction SearchFieldLabel({ children, ...props }) {\n const { screenReaderText, inputId } = useContext(SearchFieldContext);\n\n return (\n <label\n htmlFor={inputId.current}\n className={classNames('m-0', { 'has-label-text': !!children })}\n {...props}\n >\n {children || <span className=\"sr-only\">{screenReaderText.label}</span>}\n </label>\n );\n}\n\nSearchFieldLabel.propTypes = {\n /**\n * specifies the label to use for the input field (e.g., for i18n translations).\n * Note: if `children` is not provided, a screenreader-only label will be used in\n * its placed based on the `screenReaderText.label` prop for `SearchField.Advanced`.\n */\n children: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),\n};\n\nSearchFieldLabel.defaultProps = {\n children: undefined,\n};\n\nexport default SearchFieldLabel;\n"],"mappings":";;;;AAAA,OAAOA,KAAK,IAAIC,UAAU,QAAQ,OAAO;AACzC,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,UAAU,MAAM,YAAY;AAEnC,SAASC,kBAAkB,QAAQ,uBAAuB;AAE1D,SAASC,gBAAgBA,CAAAC,IAAA,EAAyB;EAAA,IAAxB;MAAEC;IAAmB,CAAC,GAAAD,IAAA;IAAPE,KAAK,GAAAC,wBAAA,CAAAH,IAAA,EAAAI,SAAA;EAC5C,MAAM;IAAEC,gBAAgB;IAAEC;EAAQ,CAAC,GAAGX,UAAU,CAACG,kBAAkB,CAAC;EAEpE,oBACEJ,KAAA,CAAAa,aAAA,UAAAC,QAAA;IACEC,OAAO,EAAEH,OAAO,CAACI,OAAQ;IACzBC,SAAS,EAAEd,UAAU,CAAC,KAAK,EAAE;MAAE,gBAAgB,EAAE,CAAC,CAACI;IAAS,CAAC;EAAE,GAC3DC,KAAK,GAERD,QAAQ,iBAAIP,KAAA,CAAAa,aAAA;IAAMI,SAAS,EAAC;EAAS,GAAEN,gBAAgB,CAACO,KAAY,CAChE,CAAC;AAEZ;AAEAb,gBAAgB,CAACc,SAAS,GAAG;EAC3B;AACF;AACA;AACA;AACA;EACEZ,QAAQ,EAAEL,SAAS,CAACkB,SAAS,CAAC,CAAClB,SAAS,CAACmB,MAAM,EAAEnB,SAAS,CAACoB,OAAO,CAAC;AACrE,CAAC;AAEDjB,gBAAgB,CAACkB,YAAY,GAAG;EAC9BhB,QAAQ,EAAEiB;AACZ,CAAC;AAED,eAAenB,gBAAgB"}
|
|
@@ -2,7 +2,6 @@ const _excluded = ["label", "placeholder", "inputProps", "variant", "submitButto
|
|
|
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, { useCallback } from 'react';
|
|
7
6
|
import PropTypes from 'prop-types';
|
|
8
7
|
import { Search, Close } from '../../icons';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","useCallback","PropTypes","Search","Close","SearchFieldAdvanced","SearchFieldContext","SearchFieldLabel","SearchFieldInput","SearchFieldClearButton","SearchFieldSubmitButton","Icon","SEARCH_FIELD_SCREEN_READER_TEXT_LABEL","SEARCH_FIELD_SCREEN_READER_TEXT_SUBMIT_BUTTON","SEARCH_FIELD_SCREEN_READER_TEXT_CLEAR_BUTTON","SEARCH_FIELD_BUTTON_TEXT","STYLE_VARIANTS","BUTTON_LOCATION_VARIANTS","SearchField","props","label","placeholder","inputProps","variant","submitButtonLocation","buttonText","others","_objectWithoutProperties","_excluded","Wrapper","wrapperProps","createElement","className","children","Advanced","_extends","Label","Input","ClearButton","SubmitButton","propTypes","onSubmit","func","isRequired","oneOfType","string","element","onBlur","onChange","onClear","onFocus","screenReaderText","shape","submitButton","clearButton","value","icons","submit","clear","formAriaLabel","oneOf","disabled","bool","defaultProps","undefined","src","Context"],"sources":["../../src/SearchField/index.jsx"],"sourcesContent":["/* eslint-disable max-len */\nimport React, { useCallback } from 'react';\nimport PropTypes from 'prop-types';\n\nimport { Search, Close } from '../../icons';\nimport SearchFieldAdvanced, { SearchFieldContext } from './SearchFieldAdvanced';\nimport SearchFieldLabel from './SearchFieldLabel';\nimport SearchFieldInput from './SearchFieldInput';\nimport SearchFieldClearButton from './SearchFieldClearButton';\nimport SearchFieldSubmitButton from './SearchFieldSubmitButton';\n\nimport Icon from '../Icon';\n\nexport const SEARCH_FIELD_SCREEN_READER_TEXT_LABEL = 'search';\nexport const SEARCH_FIELD_SCREEN_READER_TEXT_SUBMIT_BUTTON = 'submit search';\nexport const SEARCH_FIELD_SCREEN_READER_TEXT_CLEAR_BUTTON = 'clear search';\nexport const SEARCH_FIELD_BUTTON_TEXT = 'search';\n\nconst STYLE_VARIANTS = [\n 'light',\n 'dark',\n];\n\nconst BUTTON_LOCATION_VARIANTS = [\n 'internal',\n 'external',\n];\n\nfunction SearchField(props) {\n const {\n label,\n placeholder,\n inputProps,\n variant,\n submitButtonLocation,\n buttonText,\n ...others\n } = props;\n\n const Wrapper = useCallback(\n (wrapperProps) => (submitButtonLocation === 'external'\n ? <div className=\"pgn__searchfield_wrapper\">{wrapperProps.children}</div>\n : wrapperProps.children),\n [submitButtonLocation],\n );\n\n return (\n <SearchField.Advanced {...others} submitButtonLocation={submitButtonLocation}>\n <Wrapper>\n <SearchField.Label>{label}</SearchField.Label>\n <SearchField.Input placeholder={placeholder} {...inputProps} />\n <SearchField.ClearButton />\n </Wrapper>\n <SearchField.SubmitButton\n variant={variant}\n submitButtonLocation={submitButtonLocation}\n buttonText={buttonText}\n />\n </SearchField.Advanced>\n );\n}\n\nSearchField.propTypes = {\n /**\n * Specifies a callback function for when the `SearchField` is submitted by the user. For example:\n *\n *```jsx\n * <SearchField onSubmit={(value) => { console.log(value); } />\n * ```\n */\n onSubmit: PropTypes.func.isRequired,\n /** Specifies the label to use for the input field (e.g., for i18n translations). */\n label: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),\n /** Specifies a custom class name. */\n className: PropTypes.string,\n /**\n * Specifies a callback function for when the user loses focus in the\n * `SearchField` component. The default is an empty function. For example:\n *\n * ```jsx\n * <SearchField onBlur={event => console.log(event)} />\n * ```\n */\n onBlur: PropTypes.func,\n /**\n * Specifies a callback function for when the value in `SearchField`\n * is changed by the user. The default is an empty function. For example:\n *\n * ```jsx\n * <SearchField onChange={value => console.log(value)} />\n * ```\n */\n onChange: PropTypes.func,\n /**\n * Specifies a callback function for when the value in `SearchField`\n * is cleared by the user. The default is an empty function. For example:\n *\n * ```jsx\n * <SearchField onClear={() => console.log('search cleared')} />\n * ```\n */\n onClear: PropTypes.func,\n /**\n * Specifies a callback function for when the user focuses in the `SearchField`\n * component. The default is an empty function. For example:\n *\n * ```jsx\n * <SearchField onFocus={event => console.log(event)} />\n * ```\n */\n onFocus: PropTypes.func,\n /** Specifies the placeholder text for the input. */\n placeholder: PropTypes.string,\n /**\n * Specifies the screenreader text for both the clear and submit buttons\n * (e.g., for i18n translations). The default is `{ label: 'search',\n * clearButton: 'clear search', searchButton: 'submit search' }`.\n */\n screenReaderText: PropTypes.shape({\n label: PropTypes.oneOfType([PropTypes.string, PropTypes.element]).isRequired,\n submitButton: PropTypes.oneOfType([PropTypes.string, PropTypes.element]).isRequired,\n clearButton: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),\n }),\n /** Specifies the initial value for the input. The default is an empty string. */\n value: PropTypes.string,\n /**\n * Specifies the icon element(s) to use for the clear and submit buttons.\n * The default is:\n *\n * ```jsx\n * {\n * submit: import {Search} from '@edx/paragon/icons';,\n * clear: import {Close} from '@edx/paragon/icons'.\n * }\n * ```\n */\n icons: PropTypes.shape({\n submit: PropTypes.element.isRequired,\n clear: PropTypes.element,\n }),\n /**\n * Specifies the aria-label attribute on the form element.\n * This is useful if you use the `SearchField` component more than once on a page.\n */\n formAriaLabel: PropTypes.string,\n /** Props to be passed to the form input */\n inputProps: PropTypes.shape({}),\n /** The button style variant to use. */\n variant: PropTypes.oneOf(STYLE_VARIANTS),\n /** Specifies whether the `SearchField` is disabled. */\n disabled: PropTypes.bool,\n /** Controls whether the search button is internal as an icon or external as a button. */\n submitButtonLocation: PropTypes.oneOf(BUTTON_LOCATION_VARIANTS),\n /**\n * Specifies a text that is displayed on the button.\n * The `submitButtonLocation` prop should be set to `external`.\n */\n buttonText: PropTypes.string,\n};\n\nSearchField.defaultProps = {\n label: undefined,\n placeholder: undefined,\n className: undefined,\n formAriaLabel: undefined,\n value: '',\n screenReaderText: {\n label: SEARCH_FIELD_SCREEN_READER_TEXT_LABEL,\n submitButton: SEARCH_FIELD_SCREEN_READER_TEXT_SUBMIT_BUTTON,\n clearButton: SEARCH_FIELD_SCREEN_READER_TEXT_CLEAR_BUTTON,\n },\n icons: {\n clear: <Icon src={Close} />,\n submit: <Icon src={Search} />,\n },\n onBlur: () => {},\n onChange: () => {},\n onFocus: () => {},\n onClear: () => {},\n inputProps: {},\n variant: 'light',\n disabled: false,\n submitButtonLocation: 'internal',\n buttonText: SEARCH_FIELD_BUTTON_TEXT,\n};\n\nSearchField.Advanced = SearchFieldAdvanced;\nSearchField.Label = SearchFieldLabel;\nSearchField.Input = SearchFieldInput;\nSearchField.ClearButton = SearchFieldClearButton;\nSearchField.SubmitButton = SearchFieldSubmitButton;\nSearchField.Context = SearchFieldContext;\n\nexport default SearchField;\n"],"mappings":";;;;AAAA;AACA,OAAOA,KAAK,IAAIC,WAAW,QAAQ,OAAO;AA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AAA+B,aAAA,CAACpB,IAAI;MAACsD,GAAG,EAAE7D;IAAM,CAAE,CAAC;IAC3BqD,MAAM,eAAEzD,KAAA,CAAA+B,aAAA,CAACpB,IAAI;MAACsD,GAAG,EAAE9D;IAAO,CAAE;EAC9B,CAAC;EACD4C,MAAM,EAAEA,CAAA,KAAM,CAAC,CAAC;EAChBC,QAAQ,EAAEA,CAAA,KAAM,CAAC,CAAC;EAClBE,OAAO,EAAEA,CAAA,KAAM,CAAC,CAAC;EACjBD,OAAO,EAAEA,CAAA,KAAM,CAAC,CAAC;EACjB3B,UAAU,EAAE,CAAC,CAAC;EACdC,OAAO,EAAE,OAAO;EAChBsC,QAAQ,EAAE,KAAK;EACfrC,oBAAoB,EAAE,UAAU;EAChCC,UAAU,EAAEV;AACd,CAAC;AAEDG,WAAW,CAACgB,QAAQ,GAAG7B,mBAAmB;AAC1Ca,WAAW,CAACkB,KAAK,GAAG7B,gBAAgB;AACpCW,WAAW,CAACmB,KAAK,GAAG7B,gBAAgB;AACpCU,WAAW,CAACoB,WAAW,GAAG7B,sBAAsB;AAChDS,WAAW,CAACqB,YAAY,GAAG7B,uBAAuB;AAClDQ,WAAW,CAACgD,OAAO,GAAG5D,kBAAkB;AAExC,eAAeY,WAAW"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","useCallback","PropTypes","Search","Close","SearchFieldAdvanced","SearchFieldContext","SearchFieldLabel","SearchFieldInput","SearchFieldClearButton","SearchFieldSubmitButton","Icon","SEARCH_FIELD_SCREEN_READER_TEXT_LABEL","SEARCH_FIELD_SCREEN_READER_TEXT_SUBMIT_BUTTON","SEARCH_FIELD_SCREEN_READER_TEXT_CLEAR_BUTTON","SEARCH_FIELD_BUTTON_TEXT","STYLE_VARIANTS","BUTTON_LOCATION_VARIANTS","SearchField","props","label","placeholder","inputProps","variant","submitButtonLocation","buttonText","others","_objectWithoutProperties","_excluded","Wrapper","wrapperProps","createElement","className","children","Advanced","_extends","Label","Input","ClearButton","SubmitButton","propTypes","onSubmit","func","isRequired","oneOfType","string","element","onBlur","onChange","onClear","onFocus","screenReaderText","shape","submitButton","clearButton","value","icons","submit","clear","formAriaLabel","oneOf","disabled","bool","defaultProps","undefined","src","Context"],"sources":["../../src/SearchField/index.jsx"],"sourcesContent":["import React, { useCallback } from 'react';\nimport PropTypes from 'prop-types';\n\nimport { Search, Close } from '../../icons';\nimport SearchFieldAdvanced, { SearchFieldContext } from './SearchFieldAdvanced';\nimport SearchFieldLabel from './SearchFieldLabel';\nimport SearchFieldInput from './SearchFieldInput';\nimport SearchFieldClearButton from './SearchFieldClearButton';\nimport SearchFieldSubmitButton from './SearchFieldSubmitButton';\n\nimport Icon from '../Icon';\n\nexport const SEARCH_FIELD_SCREEN_READER_TEXT_LABEL = 'search';\nexport const SEARCH_FIELD_SCREEN_READER_TEXT_SUBMIT_BUTTON = 'submit search';\nexport const SEARCH_FIELD_SCREEN_READER_TEXT_CLEAR_BUTTON = 'clear search';\nexport const SEARCH_FIELD_BUTTON_TEXT = 'search';\n\nconst STYLE_VARIANTS = [\n 'light',\n 'dark',\n];\n\nconst BUTTON_LOCATION_VARIANTS = [\n 'internal',\n 'external',\n];\n\nfunction SearchField(props) {\n const {\n label,\n placeholder,\n inputProps,\n variant,\n submitButtonLocation,\n buttonText,\n ...others\n } = props;\n\n const Wrapper = useCallback(\n (wrapperProps) => (submitButtonLocation === 'external'\n ? <div className=\"pgn__searchfield_wrapper\">{wrapperProps.children}</div>\n : wrapperProps.children),\n [submitButtonLocation],\n );\n\n return (\n <SearchField.Advanced {...others} submitButtonLocation={submitButtonLocation}>\n <Wrapper>\n <SearchField.Label>{label}</SearchField.Label>\n <SearchField.Input placeholder={placeholder} {...inputProps} />\n <SearchField.ClearButton />\n </Wrapper>\n <SearchField.SubmitButton\n variant={variant}\n submitButtonLocation={submitButtonLocation}\n buttonText={buttonText}\n />\n </SearchField.Advanced>\n );\n}\n\nSearchField.propTypes = {\n /**\n * Specifies a callback function for when the `SearchField` is submitted by the user. For example:\n *\n *```jsx\n * <SearchField onSubmit={(value) => { console.log(value); } />\n * ```\n */\n onSubmit: PropTypes.func.isRequired,\n /** Specifies the label to use for the input field (e.g., for i18n translations). */\n label: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),\n /** Specifies a custom class name. */\n className: PropTypes.string,\n /**\n * Specifies a callback function for when the user loses focus in the\n * `SearchField` component. The default is an empty function. For example:\n *\n * ```jsx\n * <SearchField onBlur={event => console.log(event)} />\n * ```\n */\n onBlur: PropTypes.func,\n /**\n * Specifies a callback function for when the value in `SearchField`\n * is changed by the user. The default is an empty function. For example:\n *\n * ```jsx\n * <SearchField onChange={value => console.log(value)} />\n * ```\n */\n onChange: PropTypes.func,\n /**\n * Specifies a callback function for when the value in `SearchField`\n * is cleared by the user. The default is an empty function. For example:\n *\n * ```jsx\n * <SearchField onClear={() => console.log('search cleared')} />\n * ```\n */\n onClear: PropTypes.func,\n /**\n * Specifies a callback function for when the user focuses in the `SearchField`\n * component. The default is an empty function. For example:\n *\n * ```jsx\n * <SearchField onFocus={event => console.log(event)} />\n * ```\n */\n onFocus: PropTypes.func,\n /** Specifies the placeholder text for the input. */\n placeholder: PropTypes.string,\n /**\n * Specifies the screenreader text for both the clear and submit buttons\n * (e.g., for i18n translations). The default is `{ label: 'search',\n * clearButton: 'clear search', searchButton: 'submit search' }`.\n */\n screenReaderText: PropTypes.shape({\n label: PropTypes.oneOfType([PropTypes.string, PropTypes.element]).isRequired,\n submitButton: PropTypes.oneOfType([PropTypes.string, PropTypes.element]).isRequired,\n clearButton: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),\n }),\n /** Specifies the initial value for the input. The default is an empty string. */\n value: PropTypes.string,\n /**\n * Specifies the icon element(s) to use for the clear and submit buttons.\n * The default is:\n *\n * ```jsx\n * {\n * submit: import {Search} from '@edx/paragon/icons';,\n * clear: import {Close} from '@edx/paragon/icons'.\n * }\n * ```\n */\n icons: PropTypes.shape({\n submit: PropTypes.element.isRequired,\n clear: PropTypes.element,\n }),\n /**\n * Specifies the aria-label attribute on the form element.\n * This is useful if you use the `SearchField` component more than once on a page.\n */\n formAriaLabel: PropTypes.string,\n /** Props to be passed to the form input */\n inputProps: PropTypes.shape({}),\n /** The button style variant to use. */\n variant: PropTypes.oneOf(STYLE_VARIANTS),\n /** Specifies whether the `SearchField` is disabled. */\n disabled: PropTypes.bool,\n /** Controls whether the search button is internal as an icon or external as a button. */\n submitButtonLocation: PropTypes.oneOf(BUTTON_LOCATION_VARIANTS),\n /**\n * Specifies a text that is displayed on the button.\n * The `submitButtonLocation` prop should be set to `external`.\n */\n buttonText: PropTypes.string,\n};\n\nSearchField.defaultProps = {\n label: undefined,\n placeholder: undefined,\n className: undefined,\n formAriaLabel: undefined,\n value: '',\n screenReaderText: {\n label: SEARCH_FIELD_SCREEN_READER_TEXT_LABEL,\n submitButton: SEARCH_FIELD_SCREEN_READER_TEXT_SUBMIT_BUTTON,\n clearButton: SEARCH_FIELD_SCREEN_READER_TEXT_CLEAR_BUTTON,\n },\n icons: {\n clear: <Icon src={Close} />,\n submit: <Icon src={Search} />,\n },\n onBlur: () => {},\n onChange: () => {},\n onFocus: () => {},\n onClear: () => {},\n inputProps: {},\n variant: 'light',\n disabled: false,\n submitButtonLocation: 'internal',\n buttonText: SEARCH_FIELD_BUTTON_TEXT,\n};\n\nSearchField.Advanced = SearchFieldAdvanced;\nSearchField.Label = SearchFieldLabel;\nSearchField.Input = SearchFieldInput;\nSearchField.ClearButton = SearchFieldClearButton;\nSearchField.SubmitButton = SearchFieldSubmitButton;\nSearchField.Context = SearchFieldContext;\n\nexport default SearchField;\n"],"mappings":";;;;AAAA,OAAOA,KAAK,IAAIC,WAAW,QAAQ,OAAO;AAC1C,OAAOC,SAAS,MAAM,YAAY;AAElC,SAASC,MAAM,EAAEC,KAAK,QAAQ,aAAa;AAC3C,OAAOC,mBAAmB,IAAIC,kBAAkB,QAAQ,uBAAuB;AAC/E,OAAOC,gBAAgB,MAAM,oBAAoB;AACjD,O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D4C,MAAM,EAAEA,CAAA,KAAM,CAAC,CAAC;EAChBC,QAAQ,EAAEA,CAAA,KAAM,CAAC,CAAC;EAClBE,OAAO,EAAEA,CAAA,KAAM,CAAC,CAAC;EACjBD,OAAO,EAAEA,CAAA,KAAM,CAAC,CAAC;EACjB3B,UAAU,EAAE,CAAC,CAAC;EACdC,OAAO,EAAE,OAAO;EAChBsC,QAAQ,EAAE,KAAK;EACfrC,oBAAoB,EAAE,UAAU;EAChCC,UAAU,EAAEV;AACd,CAAC;AAEDG,WAAW,CAACgB,QAAQ,GAAG7B,mBAAmB;AAC1Ca,WAAW,CAACkB,KAAK,GAAG7B,gBAAgB;AACpCW,WAAW,CAACmB,KAAK,GAAG7B,gBAAgB;AACpCU,WAAW,CAACoB,WAAW,GAAG7B,sBAAsB;AAChDS,WAAW,CAACqB,YAAY,GAAG7B,uBAAuB;AAClDQ,WAAW,CAACgD,OAAO,GAAG5D,kBAAkB;AAExC,eAAeY,WAAW"}
|
package/dist/Tabs/index.js
CHANGED
|
@@ -8,7 +8,7 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typ
|
|
|
8
8
|
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
9
9
|
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; }
|
|
10
10
|
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; }
|
|
11
|
-
import React, { useEffect, useMemo, useRef } from 'react';
|
|
11
|
+
import React, { useEffect, useMemo, useRef, useState, useCallback } from 'react';
|
|
12
12
|
import classNames from 'classnames';
|
|
13
13
|
import PropTypes from 'prop-types';
|
|
14
14
|
import BaseTabs from 'react-bootstrap/Tabs';
|
|
@@ -26,11 +26,11 @@ function Tabs(_ref) {
|
|
|
26
26
|
activeKey
|
|
27
27
|
} = _ref,
|
|
28
28
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
29
|
-
const containerElementRef =
|
|
29
|
+
const [containerElementRef, setContainerElementRef] = useState(null);
|
|
30
30
|
const overflowElementRef = useRef(null);
|
|
31
|
-
const indexOfLastVisibleChild = useIndexOfLastVisibleChild(containerElementRef
|
|
31
|
+
const indexOfLastVisibleChild = useIndexOfLastVisibleChild(containerElementRef?.firstChild, overflowElementRef.current?.parentNode);
|
|
32
32
|
useEffect(() => {
|
|
33
|
-
if (containerElementRef
|
|
33
|
+
if (containerElementRef) {
|
|
34
34
|
const observer = new MutationObserver(mutations => {
|
|
35
35
|
mutations.forEach(mutation => {
|
|
36
36
|
// React-Bootstrap attribute 'data-rb-event-key' is responsible for the tab identification
|
|
@@ -39,8 +39,8 @@ function Tabs(_ref) {
|
|
|
39
39
|
const isActive = mutation.target.getAttribute('aria-selected') === 'true';
|
|
40
40
|
// datakey attribute is added manually to the dropdown
|
|
41
41
|
// elements so that they correspond to the native tabs' eventKey
|
|
42
|
-
const element = containerElementRef.
|
|
43
|
-
const moreTab = containerElementRef.
|
|
42
|
+
const element = containerElementRef.querySelector(`[datakey='${eventKey}']`);
|
|
43
|
+
const moreTab = containerElementRef.querySelector('.pgn__tab_more');
|
|
44
44
|
if (isActive) {
|
|
45
45
|
element?.classList.add('active');
|
|
46
46
|
// Here we add active class to the 'More Tab' if element exists in the dropdown
|
|
@@ -54,7 +54,7 @@ function Tabs(_ref) {
|
|
|
54
54
|
}
|
|
55
55
|
});
|
|
56
56
|
});
|
|
57
|
-
observer.observe(containerElementRef
|
|
57
|
+
observer.observe(containerElementRef, {
|
|
58
58
|
attributes: true,
|
|
59
59
|
subtree: true,
|
|
60
60
|
attributeFilter: ['aria-selected']
|
|
@@ -62,16 +62,16 @@ function Tabs(_ref) {
|
|
|
62
62
|
return () => observer.disconnect();
|
|
63
63
|
}
|
|
64
64
|
return undefined;
|
|
65
|
-
}, []);
|
|
65
|
+
}, [containerElementRef]);
|
|
66
66
|
useEffect(() => {
|
|
67
67
|
if (overflowElementRef.current?.parentNode) {
|
|
68
68
|
overflowElementRef.current.parentNode.tabIndex = -1;
|
|
69
69
|
}
|
|
70
70
|
}, [overflowElementRef.current?.parentNode]);
|
|
71
|
-
const handleDropdownTabClick = eventKey => {
|
|
72
|
-
const hiddenTab = containerElementRef.
|
|
71
|
+
const handleDropdownTabClick = useCallback(eventKey => {
|
|
72
|
+
const hiddenTab = containerElementRef.querySelector(`[data-rb-event-key='${eventKey}']`);
|
|
73
73
|
hiddenTab.click();
|
|
74
|
-
};
|
|
74
|
+
}, [containerElementRef]);
|
|
75
75
|
const tabsChildren = useMemo(() => {
|
|
76
76
|
const indexOfOverflowStart = indexOfLastVisibleChild + 1;
|
|
77
77
|
const handleDropdownKeyPress = (e, eventKey) => {
|
|
@@ -150,9 +150,9 @@ function Tabs(_ref) {
|
|
|
150
150
|
}, overflowChildren))
|
|
151
151
|
}));
|
|
152
152
|
return childrenList;
|
|
153
|
-
}, [activeKey, children, defaultActiveKey, indexOfLastVisibleChild, moreTabText]);
|
|
153
|
+
}, [activeKey, children, defaultActiveKey, indexOfLastVisibleChild, moreTabText, handleDropdownTabClick]);
|
|
154
154
|
return /*#__PURE__*/React.createElement("div", {
|
|
155
|
-
ref:
|
|
155
|
+
ref: setContainerElementRef
|
|
156
156
|
}, /*#__PURE__*/React.createElement(BaseTabs, _extends({
|
|
157
157
|
defaultActiveKey: defaultActiveKey,
|
|
158
158
|
activeKey: activeKey
|