@openedx/paragon 21.11.4 → 21.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. package/dist/Container/index.js +6 -2
  2. package/dist/Container/index.js.map +1 -1
  3. package/dist/DataTable/index.js +1 -0
  4. package/dist/DataTable/index.js.map +1 -1
  5. package/dist/DataTable/selection/BaseSelectionStatus.js +3 -2
  6. package/dist/DataTable/selection/BaseSelectionStatus.js.map +1 -1
  7. package/dist/Dropdown/index.js.map +1 -1
  8. package/dist/Form/FormSwitch.js +3 -0
  9. package/dist/Form/FormSwitch.js.map +1 -1
  10. package/dist/Hyperlink/index.js +7 -6
  11. package/dist/Hyperlink/index.js.map +1 -1
  12. package/dist/Icon/index.js +17 -10
  13. package/dist/Icon/index.js.map +1 -1
  14. package/dist/IconButton/index.js +1 -1
  15. package/dist/IconButton/index.js.map +1 -1
  16. package/dist/Layout/index.js.map +1 -1
  17. package/dist/Modal/ModalDialog.js +3 -0
  18. package/dist/Modal/ModalDialog.js.map +1 -1
  19. package/dist/Modal/index.js +11 -6
  20. package/dist/Modal/index.js.map +1 -1
  21. package/dist/Popover/index.js +8 -8
  22. package/dist/Popover/index.js.map +1 -1
  23. package/dist/ProductTour/Checkpoint.js +10 -8
  24. package/dist/ProductTour/Checkpoint.js.map +1 -1
  25. package/dist/ProductTour/messages.js +16 -0
  26. package/dist/SearchField/SearchFieldAdvanced.js +12 -7
  27. package/dist/SearchField/SearchFieldAdvanced.js.map +1 -1
  28. package/dist/SearchField/SearchFieldLabel.js +3 -3
  29. package/dist/SearchField/SearchFieldLabel.js.map +1 -1
  30. package/dist/SearchField/index.js +0 -1
  31. package/dist/SearchField/index.js.map +1 -1
  32. package/dist/Tabs/index.js +13 -13
  33. package/dist/Tabs/index.js.map +1 -1
  34. package/dist/hooks/useIndexOfLastVisibleChild.js +33 -38
  35. package/dist/hooks/useIndexOfLastVisibleChild.js.map +1 -1
  36. package/dist/i18n/messages/ar.json +2 -1
  37. package/dist/i18n/messages/ca.json +2 -1
  38. package/dist/i18n/messages/es_419.json +2 -1
  39. package/dist/i18n/messages/es_AR.json +2 -1
  40. package/dist/i18n/messages/es_ES.json +2 -1
  41. package/dist/i18n/messages/fr.json +2 -1
  42. package/dist/i18n/messages/he.json +2 -1
  43. package/dist/i18n/messages/id.json +2 -1
  44. package/dist/i18n/messages/it_IT.json +2 -1
  45. package/dist/i18n/messages/ko_KR.json +2 -1
  46. package/dist/i18n/messages/pl.json +2 -1
  47. package/dist/i18n/messages/pt_BR.json +2 -1
  48. package/dist/i18n/messages/pt_PT.json +2 -1
  49. package/dist/i18n/messages/ru.json +2 -1
  50. package/dist/i18n/messages/th.json +2 -1
  51. package/dist/i18n/messages/tr_TR.json +2 -1
  52. package/dist/i18n/messages/uk.json +2 -1
  53. package/dist/i18n/messages/zh_CN.json +2 -1
  54. package/icons/es5/RightSidebarFilled.js +15 -0
  55. package/icons/es5/RightSidebarOutlined.js +15 -0
  56. package/icons/es5/index.js +2 -0
  57. package/icons/jsx/RightSidebarFilled.jsx +19 -0
  58. package/icons/jsx/RightSidebarOutlined.jsx +19 -0
  59. package/icons/jsx/index.jsx +2 -0
  60. package/icons/svg/right_sidebar_filled.svg +3 -0
  61. package/icons/svg/right_sidebar_outlined.svg +3 -0
  62. package/package.json +1 -1
  63. package/src/Container/index.jsx +4 -0
  64. package/src/DataTable/index.jsx +1 -0
  65. package/src/DataTable/selection/BaseSelectionStatus.jsx +2 -2
  66. package/src/DataTable/tests/DataTable.test.jsx +31 -0
  67. package/src/Dropdown/index.jsx +4 -0
  68. package/src/Form/FormSwitch.jsx +3 -0
  69. package/src/Hyperlink/index.jsx +7 -6
  70. package/src/Icon/index.jsx +17 -10
  71. package/src/IconButton/index.jsx +1 -1
  72. package/src/Layout/index.jsx +1 -4
  73. package/src/Modal/ModalDialog.jsx +3 -0
  74. package/src/Modal/index.jsx +11 -6
  75. package/src/Popover/README.md +0 -1
  76. package/src/Popover/index.jsx +11 -11
  77. package/src/ProductTour/Checkpoint.jsx +9 -6
  78. package/src/ProductTour/messages.js +16 -0
  79. package/src/SearchField/SearchFieldAdvanced.jsx +12 -7
  80. package/src/SearchField/SearchFieldLabel.jsx +3 -3
  81. package/src/SearchField/index.jsx +0 -1
  82. package/src/Tabs/index.jsx +19 -13
  83. package/src/hooks/tests/useIndexOfLastVisibleChild.test.jsx +3 -3
  84. package/src/hooks/useIndexOfLastVisibleChild.jsx +36 -38
  85. package/src/hooks/useIndexOfLastVisibleChild.mdx +3 -3
  86. package/src/i18n/messages/ar.json +2 -1
  87. package/src/i18n/messages/ca.json +2 -1
  88. package/src/i18n/messages/es_419.json +2 -1
  89. package/src/i18n/messages/es_AR.json +2 -1
  90. package/src/i18n/messages/es_ES.json +2 -1
  91. package/src/i18n/messages/fr.json +2 -1
  92. package/src/i18n/messages/he.json +2 -1
  93. package/src/i18n/messages/id.json +2 -1
  94. package/src/i18n/messages/it_IT.json +2 -1
  95. package/src/i18n/messages/ko_KR.json +2 -1
  96. package/src/i18n/messages/pl.json +2 -1
  97. package/src/i18n/messages/pt_BR.json +2 -1
  98. package/src/i18n/messages/pt_PT.json +2 -1
  99. package/src/i18n/messages/ru.json +2 -1
  100. package/src/i18n/messages/th.json +2 -1
  101. package/src/i18n/messages/tr_TR.json +2 -1
  102. package/src/i18n/messages/uk.json +2 -1
  103. package/src/i18n/messages/zh_CN.json +2 -1
@@ -1 +1 @@
1
- {"version":3,"file":"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,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;MACRC,OAAO;MACPC,QAAQ;MACRC,MAAM;MACNC,OAAO;MACPC,KAAK,EAAEC,YAAY;MACnBC,aAAa;MACbC,QAAQ;MACRC;IAEF,CAAC,GAAGd,KAAK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AAe;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;MACRC,OAAO;MACPC,QAAQ;MACRC,MAAM;MACNC,OAAO;MACPC,KAAK,EAAEC,YAAY;MACnBC,aAAa;MACbC,QAAQ;MACRC;IAEF,CAAC,GAAGd,KAAK;IADJe,IAAI,GAAAC,wBAAA,CACLhB,KAAK,EAAAiB,SAAA;EAET,MAAM,CAACC,QAAQ,EAAEC,WAAW,CAAC,GAAG9B,QAAQ,CAAC,KAAK,CAAC;EAC/C,MAAM,CAACqB,KAAK,EAAEU,QAAQ,CAAC,GAAG/B,QAAQ,CAACsB,YAAY,CAAC;EAEhD,MAAMU,cAAc,GAAGlC,MAAM,CAAC,IAAI,CAAC;EACnC,MAAMmC,OAAO,GAAGnC,MAAM,CAAE,GAAEQ,KAAK,CAAC,wBAAwB,CAAE,EAAC,CAAC;EAC5D,MAAM4B,QAAQ,GAAGpC,M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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). Note: if `children` is not provided,
31
- * a screenreader-only label will be used in its placed based on the `screenReaderText.label` prop for `SearchField.Advanced`.
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":["/* eslint-disable max-len */\nimport 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). Note: if `children` is not provided,\n * a screenreader-only label will be used in 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;AACA,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;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"}
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;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,OAAOC,gBAAgB,MAAM,oBAAoB;AACjD,OAAOC,sBAAsB,MAAM,0BAA0B;AAC7D,OAAOC,uBAAuB,MAAM,2BAA2B;AAE/D,OAAOC,IAAI,MAAM,SAAS;AAE1B,OAAO,MAAMC,qCAAqC,GAAG,QAAQ;AAC7D,OAAO,MAAMC,6CAA6C,GAAG,eAAe;AAC5E,OAAO,MAAMC,4CAA4C,GAA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AAE,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,OAAOC,gBAAgB,MAAM,oBAAoB;AACjD,OAAOC,sBAAsB,MAAM,0BAA0B;AAC7D,OAAOC,uBAAuB,MAAM,2BAA2B;AAE/D,OAAOC,IAAI,MAAM,SAAS;AAE1B,OAAO,MAAMC,qCAAqC,GAAG,QAAQ;AAC7D,OAAO,MAAMC,6CAA6C,GAAG,eAAe;AAC5E,OAAO,MAAMC,4CAA4C,GAAG,cAAc;AAC1E,OAAO,MAAMC,wBAAwB,GAAG,QAAQ;AAEhD,MAAMC,cAAc,GAAG,CACrB,OAAO,EACP,MAAM,CACP;AAED,MAAMC,wBAAwB,GAAG,CAC/B,UAAU,EACV,UAAU,CACX;AAED,SAASC,WAAWA,CA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KAAK,GAAG7B,gBAAgB;AACpCU,WAAW,CAACoB,WAAW,GAAG7B,sBAAsB;AAChDS,WAAW,CAACqB,YAAY,GAAG7B,uBAAuB;AAClDQ,WAAW,CAACgD,OAAO,GAAG5D,kBAAkB;AAExC,eAAeY,WAAW"}
@@ -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';
@@ -27,11 +27,11 @@ function Tabs(_ref) {
27
27
  activeKey
28
28
  } = _ref,
29
29
  props = _objectWithoutProperties(_ref, _excluded);
30
- const containerElementRef = useRef(null);
30
+ const [containerElementRef, setContainerElementRef] = useState(null);
31
31
  const overflowElementRef = useRef(null);
32
- const indexOfLastVisibleChild = useIndexOfLastVisibleChild(containerElementRef.current?.children[0], overflowElementRef.current?.parentNode);
32
+ const indexOfLastVisibleChild = useIndexOfLastVisibleChild(containerElementRef?.firstChild, overflowElementRef.current?.parentNode);
33
33
  useEffect(() => {
34
- if (containerElementRef.current) {
34
+ if (containerElementRef) {
35
35
  const observer = new MutationObserver(mutations => {
36
36
  mutations.forEach(mutation => {
37
37
  // React-Bootstrap attribute 'data-rb-event-key' is responsible for the tab identification
@@ -40,8 +40,8 @@ function Tabs(_ref) {
40
40
  const isActive = mutation.target.getAttribute('aria-selected') === 'true';
41
41
  // datakey attribute is added manually to the dropdown
42
42
  // elements so that they correspond to the native tabs' eventKey
43
- const element = containerElementRef.current.querySelector(`[datakey='${eventKey}']`);
44
- const moreTab = containerElementRef.current.querySelector('.pgn__tab_more');
43
+ const element = containerElementRef.querySelector(`[datakey='${eventKey}']`);
44
+ const moreTab = containerElementRef.querySelector('.pgn__tab_more');
45
45
  if (isActive) {
46
46
  element?.classList.add('active');
47
47
  // Here we add active class to the 'More Tab' if element exists in the dropdown
@@ -55,7 +55,7 @@ function Tabs(_ref) {
55
55
  }
56
56
  });
57
57
  });
58
- observer.observe(containerElementRef.current, {
58
+ observer.observe(containerElementRef, {
59
59
  attributes: true,
60
60
  subtree: true,
61
61
  attributeFilter: ['aria-selected']
@@ -63,16 +63,16 @@ function Tabs(_ref) {
63
63
  return () => observer.disconnect();
64
64
  }
65
65
  return undefined;
66
- }, []);
66
+ }, [containerElementRef]);
67
67
  useEffect(() => {
68
68
  if (overflowElementRef.current?.parentNode) {
69
69
  overflowElementRef.current.parentNode.tabIndex = -1;
70
70
  }
71
71
  }, [overflowElementRef.current?.parentNode]);
72
- const handleDropdownTabClick = eventKey => {
73
- const hiddenTab = containerElementRef.current.querySelector(`[data-rb-event-key='${eventKey}']`);
72
+ const handleDropdownTabClick = useCallback(eventKey => {
73
+ const hiddenTab = containerElementRef.querySelector(`[data-rb-event-key='${eventKey}']`);
74
74
  hiddenTab.click();
75
- };
75
+ }, [containerElementRef]);
76
76
  const tabsChildren = useMemo(() => {
77
77
  const indexOfOverflowStart = indexOfLastVisibleChild + 1;
78
78
  const handleDropdownKeyPress = (e, eventKey) => {
@@ -151,9 +151,9 @@ function Tabs(_ref) {
151
151
  }, overflowChildren))
152
152
  }));
153
153
  return childrenList;
154
- }, [activeKey, children, defaultActiveKey, indexOfLastVisibleChild, moreTabText]);
154
+ }, [activeKey, children, defaultActiveKey, indexOfLastVisibleChild, moreTabText, handleDropdownTabClick]);
155
155
  return /*#__PURE__*/React.createElement("div", {
156
- ref: containerElementRef
156
+ ref: setContainerElementRef
157
157
  }, /*#__PURE__*/React.createElement(BaseTabs, _extends({
158
158
  defaultActiveKey: defaultActiveKey,
159
159
  activeKey: activeKey
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["React","useEffect","useMemo","useRef","classNames","PropTypes","BaseTabs","TabsDeprecated","Bubble","Dropdown","useIndexOfLastVisibleChild","Tab","MORE_TAB_TEXT","Tabs","_ref","children","className","moreTabText","defaultActiveKey","activeKey","props","_objectWithoutProperties","_excluded","containerElementRef","overflowElementRef","indexOfLastVisibleChild","current","parentNode","observer","MutationObserver","mutations","forEach","mutation","eventKey","target","getAttribute","isActive","element","querySelector","moreTab","classList","add","remove","observe","attributes","subtree","attributeFilter","disconnect","undefined","tabIndex","handleDropdownTabClick","hiddenTab","click","tabsChildren","indexOfOverflowStart","handleDropdownKeyPress","e","key","childrenList","Children","map","child","index","type","name","process","env","NODE_ENV","console","error","isValidElement","_child$props","title","notification","tabClassName","rest","_excluded2","newTitle","createElement","Fragment","variant","role","expandable","tabClass","modifiedTab","cloneElement","_objectSpread","moreTabHasNotification","overflowChildren","slice","overflowChild","Item","as","onClick","onKeyPress","disabled","datakey","active","splice","length","ref","Toggle","id","Menu","_extends","propTypes","oneOf","node","isRequired","string","defaultProps","Deprecated","default","TabContainer","TabContent","TabPane"],"sources":["../../src/Tabs/index.jsx"],"sourcesContent":["import React, { useEffect, useMemo, useRef } from 'react';\nimport classNames from 'classnames';\nimport PropTypes from 'prop-types';\nimport BaseTabs from 'react-bootstrap/Tabs';\nimport TabsDeprecated from './deprecated';\nimport Bubble from '../Bubble';\nimport Dropdown from '../Dropdown';\nimport useIndexOfLastVisibleChild from '../hooks/useIndexOfLastVisibleChild';\nimport Tab from './Tab';\n\nexport const MORE_TAB_TEXT = 'More...';\n\nfunction Tabs({\n children,\n className,\n moreTabText = MORE_TAB_TEXT,\n defaultActiveKey,\n activeKey,\n ...props\n}) {\n const containerElementRef = useRef(null);\n const overflowElementRef = useRef(null);\n const indexOfLastVisibleChild = useIndexOfLastVisibleChild(\n containerElementRef.current?.children[0],\n overflowElementRef.current?.parentNode,\n );\n\n useEffect(() => {\n if (containerElementRef.current) {\n const observer = new MutationObserver((mutations => {\n mutations.forEach(mutation => {\n // React-Bootstrap attribute 'data-rb-event-key' is responsible for the tab identification\n const eventKey = mutation.target.getAttribute('data-rb-event-key');\n // React-Bootstrap attribute 'aria-selected' is responsible for selected/unselected state\n const isActive = mutation.target.getAttribute('aria-selected') === 'true';\n // datakey attribute is added manually to the dropdown\n // elements so that they correspond to the native tabs' eventKey\n const element = containerElementRef.current.querySelector(`[datakey='${eventKey}']`);\n const moreTab = containerElementRef.current.querySelector('.pgn__tab_more');\n if (isActive) {\n element?.classList.add('active');\n // Here we add active class to the 'More Tab' if element exists in the dropdown\n if (element) {\n moreTab.classList.add('active');\n } else {\n moreTab.classList.remove('active');\n }\n } else {\n element?.classList.remove('active');\n }\n });\n }));\n observer.observe(containerElementRef.current, {\n attributes: true, subtree: true, attributeFilter: ['aria-selected'],\n });\n return () => observer.disconnect();\n }\n return undefined;\n }, []);\n\n useEffect(() => {\n if (overflowElementRef.current?.parentNode) {\n overflowElementRef.current.parentNode.tabIndex = -1;\n }\n }, [overflowElementRef.current?.parentNode]);\n\n const handleDropdownTabClick = (eventKey) => {\n const hiddenTab = containerElementRef.current.querySelector(`[data-rb-event-key='${eventKey}']`);\n hiddenTab.click();\n };\n\n const tabsChildren = useMemo(() => {\n const indexOfOverflowStart = indexOfLastVisibleChild + 1;\n const handleDropdownKeyPress = (e, eventKey) => {\n if (e.key === 'Enter') {\n handleDropdownTabClick(eventKey);\n }\n };\n const childrenList = React.Children.map(children, (child, index) => {\n if (child?.type?.name !== 'Tab' && process.env.NODE_ENV === 'development') {\n // eslint-disable-next-line no-console\n console.error(\n `Tabs children can only be of type Tab. ${children[index]} was passed instead.`,\n );\n }\n if (!React.isValidElement(child)) {\n return child;\n }\n const {\n title, notification, tabClassName, ...rest\n } = child.props;\n let newTitle;\n if (notification) {\n newTitle = (\n <>\n {title}\n <Bubble\n variant=\"error\"\n role=\"status\"\n className=\"pgn__tab-notification\"\n aria-live=\"polite\"\n expandable\n >\n {notification}\n </Bubble>\n </>\n );\n } else {\n newTitle = title;\n }\n const tabClass = index > indexOfLastVisibleChild ? 'pgn__tab_invisible' : '';\n const modifiedTab = React.cloneElement(child, {\n ...rest,\n title: newTitle,\n tabClassName: classNames(tabClass, tabClassName),\n });\n return modifiedTab;\n });\n let moreTabHasNotification = false;\n const overflowChildren = childrenList.slice(indexOfOverflowStart)\n .map(overflowChild => {\n if (!moreTabHasNotification && overflowChild.props.notification) {\n moreTabHasNotification = true;\n }\n return (\n <Dropdown.Item\n as=\"li\"\n tabIndex=\"0\"\n key={`${overflowChild.props.eventKey}overflow`}\n onClick={() => handleDropdownTabClick(overflowChild.props.eventKey)}\n onKeyPress={(e) => handleDropdownKeyPress(e, overflowChild.props.eventKey)}\n disabled={overflowChild.props.disabled}\n datakey={overflowChild.props.eventKey}\n className={classNames({\n active: overflowChild.props.eventKey === defaultActiveKey || overflowChild.props.eventKey === activeKey,\n }, 'pgn__tabs__dropdown-item')}\n >\n {overflowChild.props.title}\n </Dropdown.Item>\n );\n });\n\n childrenList.splice(indexOfOverflowStart, 0, (<Tab\n key=\"moreTabKey\"\n tabClassName={classNames(!overflowChildren.length && 'pgn__tab_invisible', 'pgn__tab_more')}\n title={(\n <Dropdown ref={overflowElementRef}>\n <Dropdown.Toggle\n variant=\"link\"\n className=\"nav-link\"\n id=\"pgn__tab-toggle\"\n >\n {moreTabText}\n {moreTabHasNotification && (\n <Bubble\n variant=\"error\"\n role=\"status\"\n className=\"pgn__tab-notification\"\n />\n )}\n </Dropdown.Toggle>\n <Dropdown.Menu as=\"ul\" className=\"dropdown-menu-right\">{overflowChildren}</Dropdown.Menu>\n </Dropdown>\n )}\n />\n ));\n return childrenList;\n }, [activeKey, children, defaultActiveKey, indexOfLastVisibleChild, moreTabText]);\n\n return (\n <div ref={containerElementRef}>\n <BaseTabs\n defaultActiveKey={defaultActiveKey}\n activeKey={activeKey}\n {...props}\n className={classNames(className, 'pgn__tabs')}\n >\n {tabsChildren}\n </BaseTabs>\n </div>\n );\n}\n\nTabs.propTypes = {\n /** Specifies variant to use. */\n variant: PropTypes.oneOf(['tabs', 'pills', 'inverse-tabs', 'inverse-pills', 'button-group']),\n /** Specifies elements that is processed to create tabs. */\n children: PropTypes.node.isRequired,\n /** Specifies class name to append to the base element. */\n className: PropTypes.string,\n /** Specifies text for the 'More' tab. */\n moreTabText: PropTypes.string,\n /** Specifies default active tab (uncontrolled usage). */\n defaultActiveKey: PropTypes.string,\n /** Specifies active tab (controlled usage). */\n activeKey: PropTypes.string,\n};\n\nTabs.defaultProps = {\n variant: 'tabs',\n className: undefined,\n moreTabText: MORE_TAB_TEXT,\n defaultActiveKey: undefined,\n activeKey: undefined,\n};\n\nTabs.Deprecated = TabsDeprecated;\n\nexport default Tabs;\nexport { Tab };\nexport { default as TabContainer } from 'react-bootstrap/TabContainer';\nexport { default as TabContent } from 'react-bootstrap/TabContent';\nexport { default as TabPane } from 'react-bootstrap/TabPane';\n"],"mappings":";;;;;;;;;;AAAA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,OAAO,EAAEC,MAAM,QAAQ,OAAO;AACzD,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,QAAQ,MAAM,sBAAsB;AAC3C,OA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AS,CAACwG,MAAM;EAC3B;EACA5F,WAAW,EAAEZ,SAAS,CAACwG,MAAM;EAC7B;EACA3F,gBAAgB,EAAEb,SAAS,CAACwG,MAAM;EAClC;EACA1F,SAAS,EAAEd,SAAS,CAACwG;AACvB,CAAC;AAEDhG,IAAI,CAACiG,YAAY,GAAG;EAClB9B,OAAO,EAAE,MAAM;EACfhE,SAAS,EAAEgC,SAAS;EACpB/B,WAAW,EAAEL,aAAa;EAC1BM,gBAAgB,EAAE8B,SAAS;EAC3B7B,SAAS,EAAE6B;AACb,CAAC;AAEDnC,IAAI,CAACkG,UAAU,GAAGxG,cAAc;AAEhC,eAAeM,IAAI;AACnB,SAASF,GAAG;AACZ,SAASqG,OAAO,IAAIC,YAAY,QAAQ,8BAA8B;AACtE,SAASD,OAAO,IAAIE,UAAU,QAAQ,4BAA4B;AAClE,SAASF,OAAO,IAAIG,OAAO,QAAQ,yBAAyB"}
1
+ {"version":3,"file":"index.js","names":["React","useEffect","useMemo","useRef","useState","useCallback","classNames","PropTypes","BaseTabs","TabsDeprecated","Bubble","Dropdown","useIndexOfLastVisibleChild","Tab","MORE_TAB_TEXT","Tabs","_ref","children","className","moreTabText","defaultActiveKey","activeKey","props","_objectWithoutProperties","_excluded","containerElementRef","setContainerElementRef","overflowElementRef","indexOfLastVisibleChild","firstChild","current","parentNode","observer","MutationObserver","mutations","forEach","mutation","eventKey","target","getAttribute","isActive","element","querySelector","moreTab","classList","add","remove","observe","attributes","subtree","attributeFilter","disconnect","undefined","tabIndex","handleDropdownTabClick","hiddenTab","click","tabsChildren","indexOfOverflowStart","handleDropdownKeyPress","e","key","childrenList","Children","map","child","index","type","name","process","env","NODE_ENV","console","error","isValidElement","_child$props","title","notification","tabClassName","rest","_excluded2","newTitle","createElement","Fragment","variant","role","expandable","tabClass","modifiedTab","cloneElement","_objectSpread","moreTabHasNotification","overflowChildren","slice","overflowChild","Item","as","onClick","onKeyPress","disabled","datakey","active","splice","length","ref","Toggle","id","Menu","_extends","propTypes","oneOf","node","isRequired","string","defaultProps","Deprecated","default","TabContainer","TabContent","TabPane"],"sources":["../../src/Tabs/index.jsx"],"sourcesContent":["import React, {\n useEffect,\n useMemo,\n useRef,\n useState,\n useCallback,\n} from 'react';\nimport classNames from 'classnames';\nimport PropTypes from 'prop-types';\nimport BaseTabs from 'react-bootstrap/Tabs';\nimport TabsDeprecated from './deprecated';\nimport Bubble from '../Bubble';\nimport Dropdown from '../Dropdown';\nimport useIndexOfLastVisibleChild from '../hooks/useIndexOfLastVisibleChild';\nimport Tab from './Tab';\n\nexport const MORE_TAB_TEXT = 'More...';\n\nfunction Tabs({\n children,\n className,\n moreTabText = MORE_TAB_TEXT,\n defaultActiveKey,\n activeKey,\n ...props\n}) {\n const [containerElementRef, setContainerElementRef] = useState(null);\n const overflowElementRef = useRef(null);\n const indexOfLastVisibleChild = useIndexOfLastVisibleChild(\n containerElementRef?.firstChild,\n overflowElementRef.current?.parentNode,\n );\n\n useEffect(() => {\n if (containerElementRef) {\n const observer = new MutationObserver((mutations => {\n mutations.forEach(mutation => {\n // React-Bootstrap attribute 'data-rb-event-key' is responsible for the tab identification\n const eventKey = mutation.target.getAttribute('data-rb-event-key');\n // React-Bootstrap attribute 'aria-selected' is responsible for selected/unselected state\n const isActive = mutation.target.getAttribute('aria-selected') === 'true';\n // datakey attribute is added manually to the dropdown\n // elements so that they correspond to the native tabs' eventKey\n const element = containerElementRef.querySelector(`[datakey='${eventKey}']`);\n const moreTab = containerElementRef.querySelector('.pgn__tab_more');\n if (isActive) {\n element?.classList.add('active');\n // Here we add active class to the 'More Tab' if element exists in the dropdown\n if (element) {\n moreTab.classList.add('active');\n } else {\n moreTab.classList.remove('active');\n }\n } else {\n element?.classList.remove('active');\n }\n });\n }));\n observer.observe(containerElementRef, {\n attributes: true, subtree: true, attributeFilter: ['aria-selected'],\n });\n return () => observer.disconnect();\n }\n return undefined;\n }, [containerElementRef]);\n\n useEffect(() => {\n if (overflowElementRef.current?.parentNode) {\n overflowElementRef.current.parentNode.tabIndex = -1;\n }\n }, [overflowElementRef.current?.parentNode]);\n\n const handleDropdownTabClick = useCallback((eventKey) => {\n const hiddenTab = containerElementRef.querySelector(`[data-rb-event-key='${eventKey}']`);\n hiddenTab.click();\n }, [containerElementRef]);\n\n const tabsChildren = useMemo(() => {\n const indexOfOverflowStart = indexOfLastVisibleChild + 1;\n const handleDropdownKeyPress = (e, eventKey) => {\n if (e.key === 'Enter') {\n handleDropdownTabClick(eventKey);\n }\n };\n const childrenList = React.Children.map(children, (child, index) => {\n if (child?.type?.name !== 'Tab' && process.env.NODE_ENV === 'development') {\n // eslint-disable-next-line no-console\n console.error(\n `Tabs children can only be of type Tab. ${children[index]} was passed instead.`,\n );\n }\n if (!React.isValidElement(child)) {\n return child;\n }\n const {\n title, notification, tabClassName, ...rest\n } = child.props;\n let newTitle;\n if (notification) {\n newTitle = (\n <>\n {title}\n <Bubble\n variant=\"error\"\n role=\"status\"\n className=\"pgn__tab-notification\"\n aria-live=\"polite\"\n expandable\n >\n {notification}\n </Bubble>\n </>\n );\n } else {\n newTitle = title;\n }\n const tabClass = index > indexOfLastVisibleChild ? 'pgn__tab_invisible' : '';\n const modifiedTab = React.cloneElement(child, {\n ...rest,\n title: newTitle,\n tabClassName: classNames(tabClass, tabClassName),\n });\n return modifiedTab;\n });\n let moreTabHasNotification = false;\n const overflowChildren = childrenList.slice(indexOfOverflowStart)\n .map(overflowChild => {\n if (!moreTabHasNotification && overflowChild.props.notification) {\n moreTabHasNotification = true;\n }\n return (\n <Dropdown.Item\n as=\"li\"\n tabIndex=\"0\"\n key={`${overflowChild.props.eventKey}overflow`}\n onClick={() => handleDropdownTabClick(overflowChild.props.eventKey)}\n onKeyPress={(e) => handleDropdownKeyPress(e, overflowChild.props.eventKey)}\n disabled={overflowChild.props.disabled}\n datakey={overflowChild.props.eventKey}\n className={classNames({\n active: overflowChild.props.eventKey === defaultActiveKey || overflowChild.props.eventKey === activeKey,\n }, 'pgn__tabs__dropdown-item')}\n >\n {overflowChild.props.title}\n </Dropdown.Item>\n );\n });\n\n childrenList.splice(indexOfOverflowStart, 0, (<Tab\n key=\"moreTabKey\"\n tabClassName={classNames(!overflowChildren.length && 'pgn__tab_invisible', 'pgn__tab_more')}\n title={(\n <Dropdown ref={overflowElementRef}>\n <Dropdown.Toggle\n variant=\"link\"\n className=\"nav-link\"\n id=\"pgn__tab-toggle\"\n >\n {moreTabText}\n {moreTabHasNotification && (\n <Bubble\n variant=\"error\"\n role=\"status\"\n className=\"pgn__tab-notification\"\n />\n )}\n </Dropdown.Toggle>\n <Dropdown.Menu as=\"ul\" className=\"dropdown-menu-right\">{overflowChildren}</Dropdown.Menu>\n </Dropdown>\n )}\n />\n ));\n return childrenList;\n }, [activeKey, children, defaultActiveKey, indexOfLastVisibleChild, moreTabText, handleDropdownTabClick]);\n\n return (\n <div ref={setContainerElementRef}>\n <BaseTabs\n defaultActiveKey={defaultActiveKey}\n activeKey={activeKey}\n {...props}\n className={classNames(className, 'pgn__tabs')}\n >\n {tabsChildren}\n </BaseTabs>\n </div>\n );\n}\n\nTabs.propTypes = {\n /** Specifies variant to use. */\n variant: PropTypes.oneOf(['tabs', 'pills', 'inverse-tabs', 'inverse-pills', 'button-group']),\n /** Specifies elements that is processed to create tabs. */\n children: PropTypes.node.isRequired,\n /** Specifies class name to append to the base element. */\n className: PropTypes.string,\n /** Specifies text for the 'More' tab. */\n moreTabText: PropTypes.string,\n /** Specifies default active tab (uncontrolled usage). */\n defaultActiveKey: PropTypes.string,\n /** Specifies active tab (controlled usage). */\n activeKey: PropTypes.string,\n};\n\nTabs.defaultProps = {\n variant: 'tabs',\n className: undefined,\n moreTabText: MORE_TAB_TEXT,\n defaultActiveKey: undefined,\n activeKey: undefined,\n};\n\nTabs.Deprecated = TabsDeprecated;\n\nexport default Tabs;\nexport { Tab };\nexport { default as TabContainer } from 'react-bootstrap/TabContainer';\nexport { default as TabContent } from 'react-bootstrap/TabContent';\nexport { default as TabPane } from 'react-bootstr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AAC;AAEV;AAEA1C,IAAI,CAAC8F,SAAS,GAAG;EACf;EACAzB,OAAO,EAAE7E,SAAS,CAACuG,KAAK,CAAC,CAAC,MAAM,EAAE,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,cAAc,CAAC,CAAC;EAC5F;EACA7F,QAAQ,EAAEV,SAAS,CAACwG,IAAI,CAACC,UAAU;EACnC;EACA9F,SAAS,EAAEX,SAAS,CAAC0G,MAAM;EAC3B;EACA9F,WAAW,EAAEZ,SAAS,CAAC0G,MAAM;EAC7B;EACA7F,gBAAgB,EAAEb,SAAS,CAAC0G,MAAM;EAClC;EACA5F,SAAS,EAAEd,SAAS,CAAC0G;AACvB,CAAC;AAEDlG,IAAI,CAACmG,YAAY,GAAG;EAClB9B,OAAO,EAAE,MAAM;EACflE,SAAS,EAAEkC,SAAS;EACpBjC,WAAW,EAAEL,aAAa;EAC1BM,gBAAgB,EAAEgC,SAAS;EAC3B/B,SAAS,EAAE+B;AACb,CAAC;AAEDrC,IAAI,CAACoG,UAAU,GAAG1G,cAAc;AAEhC,eAAeM,IAAI;AACnB,SAASF,GAAG;AACZ,SAASuG,OAAO,IAAIC,YAAY,QAAQ,8BAA8B;AACtE,SAASD,OAAO,IAAIE,UAAU,QAAQ,4BAA4B;AAClE,SAASF,OAAO,IAAIG,OAAO,QAAQ,yBAAyB"}
@@ -1,5 +1,4 @@
1
1
  import { useLayoutEffect, useState } from 'react';
2
- import useWindowSize from './useWindowSize';
3
2
 
4
3
  /**
5
4
  * This hook will find the index of the last child of a containing element
@@ -9,48 +8,44 @@ import useWindowSize from './useWindowSize';
9
8
  * @param {Element} containerElementRef - container element
10
9
  * @param {Element} overflowElementRef - overflow element
11
10
  *
12
- * The hook returns an array containing:
13
- * [indexOfLastVisibleChild, containerElementRef, overflowElementRef]
14
- *
15
- * indexOfLastVisibleChild - the index of the last visible child
16
- * containerElementRef - a ref to be added to the containing html node
17
- * overflowElementRef - a ref to be added to an html node inside the container
18
- * that is likely to be used to contain a "More" type dropdown or other
19
- * mechanism to reveal hidden children. The width of this element is always
20
- * included when determining which children will fit or not. Usage of this ref
21
- * is optional.
11
+ * The hook returns the index of the last visible child.
22
12
  */
23
13
  const useIndexOfLastVisibleChild = (containerElementRef, overflowElementRef) => {
24
14
  const [indexOfLastVisibleChild, setIndexOfLastVisibleChild] = useState(-1);
25
- const windowSize = useWindowSize();
26
15
  useLayoutEffect(() => {
27
- if (!containerElementRef) {
28
- return;
16
+ function updateLastVisibleChildIndex() {
17
+ // Get array of child nodes from NodeList form
18
+ const childNodesArr = Array.prototype.slice.call(containerElementRef.children);
19
+ const {
20
+ nextIndexOfLastVisibleChild
21
+ } = childNodesArr
22
+ // filter out the overflow element
23
+ .filter(childNode => childNode !== overflowElementRef)
24
+ // sum the widths to find the last visible element's index
25
+ .reduce((acc, childNode, index) => {
26
+ acc.sumWidth += childNode.getBoundingClientRect().width;
27
+ if (acc.sumWidth <= containerElementRef.getBoundingClientRect().width) {
28
+ acc.nextIndexOfLastVisibleChild = index;
29
+ }
30
+ return acc;
31
+ }, {
32
+ // Include the overflow element's width to begin with. Doing this means
33
+ // sometimes we'll show a dropdown with one item in it when it would fit,
34
+ // but allowing this case dramatically simplifies the calculations we need
35
+ // to do above.
36
+ sumWidth: overflowElementRef ? overflowElementRef.getBoundingClientRect().width : 0,
37
+ nextIndexOfLastVisibleChild: -1
38
+ });
39
+ setIndexOfLastVisibleChild(nextIndexOfLastVisibleChild);
40
+ }
41
+ if (containerElementRef) {
42
+ updateLastVisibleChildIndex();
43
+ const resizeObserver = new ResizeObserver(() => updateLastVisibleChildIndex());
44
+ resizeObserver.observe(containerElementRef);
45
+ return () => resizeObserver.disconnect();
29
46
  }
30
- // Get array of child nodes from NodeList form
31
- const childNodesArr = Array.prototype.slice.call(containerElementRef.children);
32
- const {
33
- nextIndexOfLastVisibleChild
34
- } = childNodesArr
35
- // filter out the overflow element
36
- .filter(childNode => childNode !== overflowElementRef)
37
- // sum the widths to find the last visible element's index
38
- .reduce((acc, childNode, index) => {
39
- acc.sumWidth += childNode.getBoundingClientRect().width;
40
- if (acc.sumWidth <= containerElementRef.getBoundingClientRect().width) {
41
- acc.nextIndexOfLastVisibleChild = index;
42
- }
43
- return acc;
44
- }, {
45
- // Include the overflow element's width to begin with. Doing this means
46
- // sometimes we'll show a dropdown with one item in it when it would fit,
47
- // but allowing this case dramatically simplifies the calculations we need
48
- // to do above.
49
- sumWidth: overflowElementRef ? overflowElementRef.getBoundingClientRect().width : 0,
50
- nextIndexOfLastVisibleChild: -1
51
- });
52
- setIndexOfLastVisibleChild(nextIndexOfLastVisibleChild);
53
- }, [windowSize, containerElementRef, overflowElementRef]);
47
+ return undefined;
48
+ }, [containerElementRef, overflowElementRef]);
54
49
  return indexOfLastVisibleChild;
55
50
  };
56
51
  export default useIndexOfLastVisibleChild;
@@ -1 +1 @@
1
- {"version":3,"file":"useIndexOfLastVisibleChild.js","names":["useLayoutEffect","useState","useWindowSize","useIndexOfLastVisibleChild","containerElementRef","overflowElementRef","indexOfLastVisibleChild","setIndexOfLastVisibleChild","windowSize","childNodesArr","Array","prototype","slice","call","children","nextIndexOfLastVisibleChild","filter","childNode","reduce","acc","index","sumWidth","getBoundingClientRect","width"],"sources":["../../src/hooks/useIndexOfLastVisibleChild.jsx"],"sourcesContent":["import { useLayoutEffect, useState } from 'react';\n\nimport useWindowSize from './useWindowSize';\n\n/**\n * This hook will find the index of the last child of a containing element\n * that fits within its bounding rectangle. This is done by summing the widths\n * of the children until they exceed the width of the container.\n *\n * @param {Element} containerElementRef - container element\n * @param {Element} overflowElementRef - overflow element\n *\n * The hook returns an array containing:\n * [indexOfLastVisibleChild, containerElementRef, overflowElementRef]\n *\n * indexOfLastVisibleChild - the index of the last visible child\n * containerElementRef - a ref to be added to the containing html node\n * overflowElementRef - a ref to be added to an html node inside the container\n * that is likely to be used to contain a \"More\" type dropdown or other\n * mechanism to reveal hidden children. The width of this element is always\n * included when determining which children will fit or not. Usage of this ref\n * is optional.\n */\nconst useIndexOfLastVisibleChild = (containerElementRef, overflowElementRef) => {\n const [indexOfLastVisibleChild, setIndexOfLastVisibleChild] = useState(-1);\n const windowSize = useWindowSize();\n\n useLayoutEffect(() => {\n if (!containerElementRef) {\n return;\n }\n // Get array of child nodes from NodeList form\n const childNodesArr = Array.prototype.slice.call(containerElementRef.children);\n const { nextIndexOfLastVisibleChild } = childNodesArr\n // filter out the overflow element\n .filter(childNode => childNode !== overflowElementRef)\n // sum the widths to find the last visible element's index\n .reduce((acc, childNode, index) => {\n acc.sumWidth += childNode.getBoundingClientRect().width;\n if (acc.sumWidth <= containerElementRef.getBoundingClientRect().width) {\n acc.nextIndexOfLastVisibleChild = index;\n }\n return acc;\n }, {\n // Include the overflow element's width to begin with. Doing this means\n // sometimes we'll show a dropdown with one item in it when it would fit,\n // but allowing this case dramatically simplifies the calculations we need\n // to do above.\n sumWidth: overflowElementRef ? overflowElementRef.getBoundingClientRect().width : 0,\n nextIndexOfLastVisibleChild: -1,\n });\n\n setIndexOfLastVisibleChild(nextIndexOfLastVisibleChild);\n }, [windowSize, containerElementRef, overflowElementRef]);\n\n return indexOfLastVisibleChild;\n};\n\nexport default useIndexOfLastVisibleChild;\n"],"mappings":"AAAA,SAASA,eAAe,EAAEC,QAAQ,QAAQ,OAAO;AAEjD,OAAOC,aAAa,MAAM,iBAAiB;;AAE3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,0BAA0B,GAAGA,CAACC,mBAAmB,EAAEC,kBAAkB,KAAK;EAC9E,MAAM,CAACC,uBAAuB,EAAEC,0BAA0B,CAAC,GAAGN,QAAQ,CAAC,CAAC,CAAC,CAAC;EAC1E,MAAMO,UAAU,GAAGN,aAAa,CAAC,CAAC;EAElCF,eAAe,CAAC,MAAM;IACpB,IAAI,CAACI,mBAAmB,EAAE;MACxB;IACF;IACA;IACA,MAAMK,aAAa,GAAGC,KAAK,CAACC,SAAS,CAACC,KAAK,CAACC,IAAI,CAACT,mBAAmB,CAACU,QAAQ,CAAC;IAC9E,MAAM;MAAEC;IAA4B,CAAC,GAAGN;IACtC;IAAA,CACCO,MAAM,CAACC,SAAS,IAAIA,SAAS,KAAKZ,kBAAkB;IACrD;IAAA,CACCa,MAAM,CAAC,CAACC,GAAG,EAAEF,SAAS,EAAEG,KAAK,KAAK;MACjCD,GAAG,CAACE,QAAQ,IAAIJ,SAAS,CAACK,qBAAqB,CAAC,CAAC,CAACC,KAAK;MACvD,IAAIJ,GAAG,CAACE,QAAQ,IAAIjB,mBAAmB,CAACkB,qBAAqB,CAAC,CAAC,CAACC,KAAK,EAAE;QACrEJ,GAAG,CAACJ,2BAA2B,GAAGK,KAAK;MACzC;MACA,OAAOD,GAAG;IACZ,CAAC,EAAE;MACD;MACA;MACA;MACA;MACAE,QAAQ,EAAEhB,kBAAkB,GAAGA,kBAAkB,CAACiB,qBAAqB,CAAC,CAAC,CAACC,KAAK,GAAG,CAAC;MACnFR,2BAA2B,EAAE,CAAC;IAChC,CAAC,CAAC;IAEJR,0BAA0B,CAACQ,2BAA2B,CAAC;EACzD,CAAC,EAAE,CAACP,UAAU,EAAEJ,mBAAmB,EAAEC,kBAAkB,CAAC,CAAC;EAEzD,OAAOC,uBAAuB;AAChC,CAAC;AAED,eAAeH,0BAA0B"}
1
+ {"version":3,"file":"useIndexOfLastVisibleChild.js","names":["useLayoutEffect","useState","useIndexOfLastVisibleChild","containerElementRef","overflowElementRef","indexOfLastVisibleChild","setIndexOfLastVisibleChild","updateLastVisibleChildIndex","childNodesArr","Array","prototype","slice","call","children","nextIndexOfLastVisibleChild","filter","childNode","reduce","acc","index","sumWidth","getBoundingClientRect","width","resizeObserver","ResizeObserver","observe","disconnect","undefined"],"sources":["../../src/hooks/useIndexOfLastVisibleChild.jsx"],"sourcesContent":["import { useLayoutEffect, useState } from 'react';\n\n/**\n * This hook will find the index of the last child of a containing element\n * that fits within its bounding rectangle. This is done by summing the widths\n * of the children until they exceed the width of the container.\n *\n * @param {Element} containerElementRef - container element\n * @param {Element} overflowElementRef - overflow element\n *\n * The hook returns the index of the last visible child.\n */\nconst useIndexOfLastVisibleChild = (containerElementRef, overflowElementRef) => {\n const [indexOfLastVisibleChild, setIndexOfLastVisibleChild] = useState(-1);\n\n useLayoutEffect(() => {\n function updateLastVisibleChildIndex() {\n // Get array of child nodes from NodeList form\n const childNodesArr = Array.prototype.slice.call(containerElementRef.children);\n const { nextIndexOfLastVisibleChild } = childNodesArr\n // filter out the overflow element\n .filter(childNode => childNode !== overflowElementRef)\n // sum the widths to find the last visible element's index\n .reduce((acc, childNode, index) => {\n acc.sumWidth += childNode.getBoundingClientRect().width;\n if (acc.sumWidth <= containerElementRef.getBoundingClientRect().width) {\n acc.nextIndexOfLastVisibleChild = index;\n }\n return acc;\n }, {\n // Include the overflow element's width to begin with. Doing this means\n // sometimes we'll show a dropdown with one item in it when it would fit,\n // but allowing this case dramatically simplifies the calculations we need\n // to do above.\n sumWidth: overflowElementRef ? overflowElementRef.getBoundingClientRect().width : 0,\n nextIndexOfLastVisibleChild: -1,\n });\n\n setIndexOfLastVisibleChild(nextIndexOfLastVisibleChild);\n }\n\n if (containerElementRef) {\n updateLastVisibleChildIndex();\n\n const resizeObserver = new ResizeObserver(() => updateLastVisibleChildIndex());\n resizeObserver.observe(containerElementRef);\n\n return () => resizeObserver.disconnect();\n }\n\n return undefined;\n }, [containerElementRef, overflowElementRef]);\n\n return indexOfLastVisibleChild;\n};\n\nexport default useIndexOfLastVisibleChild;\n"],"mappings":"AAAA,SAASA,eAAe,EAAEC,QAAQ,QAAQ,OAAO;;AAEjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,0BAA0B,GAAGA,CAACC,mBAAmB,EAAEC,kBAAkB,KAAK;EAC9E,MAAM,CAACC,uBAAuB,EAAEC,0BAA0B,CAAC,GAAGL,QAAQ,CAAC,CAAC,CAAC,CAAC;EAE1ED,e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iconButtonClosed": "إغلاق قائمة الخيارات",
29
29
  "pgn.FormAutosuggest.iconButtonOpened": "فتح قائمة الخيارات",
30
30
  "pgn.Toast.closeLabel": "إغلاق ",
31
- "pgn.ProductTour.Checkpoint.position-text": "Top of step {step}"
31
+ "pgn.ProductTour.Checkpoint.top-position-text": "Top of step {step}",
32
+ "pgn.ProductTour.Checkpoint.bottom-position-text": "Bottom of step {step}"
32
33
  }
@@ -28,5 +28,6 @@
28
28
  "pgn.FormAutosuggest.iconButtonClosed": "Close the options menu",
29
29
  "pgn.FormAutosuggest.iconButtonOpened": "Open the options menu",
30
30
  "pgn.Toast.closeLabel": "Close",
31
- "pgn.ProductTour.Checkpoint.position-text": "Top of step {step}"
31
+ "pgn.ProductTour.Checkpoint.top-position-text": "Top of step {step}",
32
+ "pgn.ProductTour.Checkpoint.bottom-position-text": "Bottom of step {step}"
32
33
  }
@@ -28,5 +28,6 @@
28
28
  "pgn.FormAutosuggest.iconButtonClosed": "Cerrar el menú de opciones",
29
29
  "pgn.FormAutosuggest.iconButtonOpened": "Abre el menú de opciones",
30
30
  "pgn.Toast.closeLabel": "Cerrar",
31
- "pgn.ProductTour.Checkpoint.position-text": "Top of step {step}"
31
+ "pgn.ProductTour.Checkpoint.top-position-text": "Top of step {step}",
32
+ "pgn.ProductTour.Checkpoint.bottom-position-text": "Bottom of step {step}"
32
33
  }
@@ -28,5 +28,6 @@
28
28
  "pgn.FormAutosuggest.iconButtonClosed": "Cerrar el menú de opciones",
29
29
  "pgn.FormAutosuggest.iconButtonOpened": "Abre el menú de opciones",
30
30
  "pgn.Toast.closeLabel": "Cerrar",
31
- "pgn.ProductTour.Checkpoint.position-text": "Top of step {step}"
31
+ "pgn.ProductTour.Checkpoint.top-position-text": "Top of step {step}",
32
+ "pgn.ProductTour.Checkpoint.bottom-position-text": "Bottom of step {step}"
32
33
  }
@@ -28,5 +28,6 @@
28
28
  "pgn.FormAutosuggest.iconButtonClosed": "Cerrar el menú de opciones",
29
29
  "pgn.FormAutosuggest.iconButtonOpened": "Abre el menú de opciones",
30
30
  "pgn.Toast.closeLabel": "Cerrar",
31
- "pgn.ProductTour.Checkpoint.position-text": "Top of step {step}"
31
+ "pgn.ProductTour.Checkpoint.top-position-text": "Top of step {step}",
32
+ "pgn.ProductTour.Checkpoint.bottom-position-text": "Bottom of step {step}"
32
33
  }
@@ -28,5 +28,6 @@
28
28
  "pgn.FormAutosuggest.iconButtonClosed": "Close the options menu",
29
29
  "pgn.FormAutosuggest.iconButtonOpened": "Open the options menu",
30
30
  "pgn.Toast.closeLabel": "Close",
31
- "pgn.ProductTour.Checkpoint.position-text": "Top of step {step}"
31
+ "pgn.ProductTour.Checkpoint.top-position-text": "Top of step {step}",
32
+ "pgn.ProductTour.Checkpoint.bottom-position-text": "Bottom of step {step}"
32
33
  }
@@ -28,5 +28,6 @@
28
28
  "pgn.FormAutosuggest.iconButtonClosed": "Close the options menu",
29
29
  "pgn.FormAutosuggest.iconButtonOpened": "Open the options menu",
30
30
  "pgn.Toast.closeLabel": "Close",
31
- "pgn.ProductTour.Checkpoint.position-text": "Top of step {step}"
31
+ "pgn.ProductTour.Checkpoint.top-position-text": "Top of step {step}",
32
+ "pgn.ProductTour.Checkpoint.bottom-position-text": "Bottom of step {step}"
32
33
  }
@@ -28,5 +28,6 @@
28
28
  "pgn.FormAutosuggest.iconButtonClosed": "Close the options menu",
29
29
  "pgn.FormAutosuggest.iconButtonOpened": "Open the options menu",
30
30
  "pgn.Toast.closeLabel": "Close",
31
- "pgn.ProductTour.Checkpoint.position-text": "Top of step {step}"
31
+ "pgn.ProductTour.Checkpoint.top-position-text": "Top of step {step}",
32
+ "pgn.ProductTour.Checkpoint.bottom-position-text": "Bottom of step {step}"
32
33
  }
@@ -28,5 +28,6 @@
28
28
  "pgn.FormAutosuggest.iconButtonClosed": "Close the options menu",
29
29
  "pgn.FormAutosuggest.iconButtonOpened": "Open the options menu",
30
30
  "pgn.Toast.closeLabel": "Chiudi",
31
- "pgn.ProductTour.Checkpoint.position-text": "Top of step {step}"
31
+ "pgn.ProductTour.Checkpoint.top-position-text": "Top of step {step}",
32
+ "pgn.ProductTour.Checkpoint.bottom-position-text": "Bottom of step {step}"
32
33
  }
@@ -28,5 +28,6 @@
28
28
  "pgn.FormAutosuggest.iconButtonClosed": "Close the options menu",
29
29
  "pgn.FormAutosuggest.iconButtonOpened": "Open the options menu",
30
30
  "pgn.Toast.closeLabel": "Close",
31
- "pgn.ProductTour.Checkpoint.position-text": "Top of step {step}"
31
+ "pgn.ProductTour.Checkpoint.top-position-text": "Top of step {step}",
32
+ "pgn.ProductTour.Checkpoint.bottom-position-text": "Bottom of step {step}"
32
33
  }
@@ -28,5 +28,6 @@
28
28
  "pgn.FormAutosuggest.iconButtonClosed": "Close the options menu",
29
29
  "pgn.FormAutosuggest.iconButtonOpened": "Open the options menu",
30
30
  "pgn.Toast.closeLabel": "Zamknij",
31
- "pgn.ProductTour.Checkpoint.position-text": "Top of step {step}"
31
+ "pgn.ProductTour.Checkpoint.top-position-text": "Top of step {step}",
32
+ "pgn.ProductTour.Checkpoint.bottom-position-text": "Bottom of step {step}"
32
33
  }
@@ -28,5 +28,6 @@
28
28
  "pgn.FormAutosuggest.iconButtonClosed": "Close the options menu",
29
29
  "pgn.FormAutosuggest.iconButtonOpened": "Open the options menu",
30
30
  "pgn.Toast.closeLabel": "Close",
31
- "pgn.ProductTour.Checkpoint.position-text": "Top of step {step}"
31
+ "pgn.ProductTour.Checkpoint.top-position-text": "Top of step {step}",
32
+ "pgn.ProductTour.Checkpoint.bottom-position-text": "Bottom of step {step}"
32
33
  }
@@ -28,5 +28,6 @@
28
28
  "pgn.FormAutosuggest.iconButtonClosed": "Fechar o menu de opções",
29
29
  "pgn.FormAutosuggest.iconButtonOpened": "Abrir o menu de opções",
30
30
  "pgn.Toast.closeLabel": "Fechar",
31
- "pgn.ProductTour.Checkpoint.position-text": "Top of step {step}"
31
+ "pgn.ProductTour.Checkpoint.top-position-text": "Top of step {step}",
32
+ "pgn.ProductTour.Checkpoint.bottom-position-text": "Bottom of step {step}"
32
33
  }
@@ -28,5 +28,6 @@
28
28
  "pgn.FormAutosuggest.iconButtonClosed": "Close the options menu",
29
29
  "pgn.FormAutosuggest.iconButtonOpened": "Open the options menu",
30
30
  "pgn.Toast.closeLabel": "Close",
31
- "pgn.ProductTour.Checkpoint.position-text": "Top of step {step}"
31
+ "pgn.ProductTour.Checkpoint.top-position-text": "Top of step {step}",
32
+ "pgn.ProductTour.Checkpoint.bottom-position-text": "Bottom of step {step}"
32
33
  }
@@ -28,5 +28,6 @@
28
28
  "pgn.FormAutosuggest.iconButtonClosed": "Close the options menu",
29
29
  "pgn.FormAutosuggest.iconButtonOpened": "Open the options menu",
30
30
  "pgn.Toast.closeLabel": "Close",
31
- "pgn.ProductTour.Checkpoint.position-text": "Top of step {step}"
31
+ "pgn.ProductTour.Checkpoint.top-position-text": "Top of step {step}",
32
+ "pgn.ProductTour.Checkpoint.bottom-position-text": "Bottom of step {step}"
32
33
  }
@@ -28,5 +28,6 @@
28
28
  "pgn.FormAutosuggest.iconButtonClosed": "Seçenekler menüsünü kapat",
29
29
  "pgn.FormAutosuggest.iconButtonOpened": "Seçenekler menüsünü aç",
30
30
  "pgn.Toast.closeLabel": "Kapat",
31
- "pgn.ProductTour.Checkpoint.position-text": "Top of step {step}"
31
+ "pgn.ProductTour.Checkpoint.top-position-text": "Top of step {step}",
32
+ "pgn.ProductTour.Checkpoint.bottom-position-text": "Bottom of step {step}"
32
33
  }
@@ -28,5 +28,6 @@
28
28
  "pgn.FormAutosuggest.iconButtonClosed": "Close the options menu",
29
29
  "pgn.FormAutosuggest.iconButtonOpened": "Open the options menu",
30
30
  "pgn.Toast.closeLabel": "Close",
31
- "pgn.ProductTour.Checkpoint.position-text": "Top of step {step}"
31
+ "pgn.ProductTour.Checkpoint.top-position-text": "Top of step {step}",
32
+ "pgn.ProductTour.Checkpoint.bottom-position-text": "Bottom of step {step}"
32
33
  }