@dr.pogodin/react-utils 1.17.5 → 1.17.8

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 (72) hide show
  1. package/build/development/client/index.js.map +1 -1
  2. package/build/development/client/init.js.map +1 -1
  3. package/build/development/index.js.map +1 -1
  4. package/build/development/server/index.js +6 -31
  5. package/build/development/server/index.js.map +1 -1
  6. package/build/development/server/renderer.js +66 -4
  7. package/build/development/server/renderer.js.map +1 -1
  8. package/build/development/server/server.js +1 -1
  9. package/build/development/server/server.js.map +1 -1
  10. package/build/development/server/utils/errors.js.map +1 -1
  11. package/build/development/shared/components/Button/index.js.map +1 -1
  12. package/build/development/shared/components/Checkbox/index.js.map +1 -1
  13. package/build/development/shared/components/CodeSplit/index.js.map +1 -1
  14. package/build/development/shared/components/Dropdown/index.js.map +1 -1
  15. package/build/development/shared/components/GenericLink/index.js.map +1 -1
  16. package/build/development/shared/components/Input/index.js.map +1 -1
  17. package/build/development/shared/components/MetaTags.js.map +1 -1
  18. package/build/development/shared/components/Modal/index.js.map +1 -1
  19. package/build/development/shared/components/PageLayout/index.js.map +1 -1
  20. package/build/development/shared/components/ScalableRect/index.js.map +1 -1
  21. package/build/development/shared/components/Throbber/index.js.map +1 -1
  22. package/build/development/shared/components/WithTooltip/Tooltip.js.map +1 -1
  23. package/build/development/shared/components/WithTooltip/index.js.map +1 -1
  24. package/build/development/shared/components/YouTubeVideo/index.js.map +1 -1
  25. package/build/development/shared/utils/Semaphore.js.map +1 -1
  26. package/build/development/shared/utils/config.js.map +1 -1
  27. package/build/development/shared/utils/index.js.map +1 -1
  28. package/build/development/shared/utils/jest/E2eSsrEnv.js +11 -1
  29. package/build/development/shared/utils/jest/E2eSsrEnv.js.map +1 -1
  30. package/build/development/shared/utils/jest/index.js.map +1 -1
  31. package/build/development/shared/utils/splitComponent.js.map +1 -1
  32. package/build/development/shared/utils/time.js.map +1 -1
  33. package/build/production/client/index.js.map +1 -1
  34. package/build/production/client/init.js.map +1 -1
  35. package/build/production/index.js.map +1 -1
  36. package/build/production/server/Cache.js.map +1 -1
  37. package/build/production/server/index.js +3 -3
  38. package/build/production/server/index.js.map +1 -1
  39. package/build/production/server/renderer.js +15 -4
  40. package/build/production/server/renderer.js.map +1 -1
  41. package/build/production/server/server.js +1 -1
  42. package/build/production/server/server.js.map +1 -1
  43. package/build/production/server/utils/errors.js.map +1 -1
  44. package/build/production/shared/components/Button/index.js.map +1 -1
  45. package/build/production/shared/components/Checkbox/index.js.map +1 -1
  46. package/build/production/shared/components/CodeSplit/index.js.map +1 -1
  47. package/build/production/shared/components/Dropdown/index.js.map +1 -1
  48. package/build/production/shared/components/GenericLink/index.js.map +1 -1
  49. package/build/production/shared/components/Input/index.js.map +1 -1
  50. package/build/production/shared/components/Link.js.map +1 -1
  51. package/build/production/shared/components/MetaTags.js.map +1 -1
  52. package/build/production/shared/components/Modal/index.js.map +1 -1
  53. package/build/production/shared/components/NavLink.js.map +1 -1
  54. package/build/production/shared/components/PageLayout/index.js.map +1 -1
  55. package/build/production/shared/components/ScalableRect/index.js.map +1 -1
  56. package/build/production/shared/components/Throbber/index.js.map +1 -1
  57. package/build/production/shared/components/WithTooltip/Tooltip.js.map +1 -1
  58. package/build/production/shared/components/WithTooltip/index.js.map +1 -1
  59. package/build/production/shared/components/YouTubeVideo/index.js.map +1 -1
  60. package/build/production/shared/utils/Barrier.js.map +1 -1
  61. package/build/production/shared/utils/Emitter.js.map +1 -1
  62. package/build/production/shared/utils/Semaphore.js.map +1 -1
  63. package/build/production/shared/utils/config.js.map +1 -1
  64. package/build/production/shared/utils/index.js.map +1 -1
  65. package/build/production/shared/utils/isomorphy.js.map +1 -1
  66. package/build/production/shared/utils/jest/E2eSsrEnv.js +2 -1
  67. package/build/production/shared/utils/jest/E2eSsrEnv.js.map +1 -1
  68. package/build/production/shared/utils/jest/index.js.map +1 -1
  69. package/build/production/shared/utils/splitComponent.js.map +1 -1
  70. package/build/production/shared/utils/time.js.map +1 -1
  71. package/build/production/shared/utils/webpack.js.map +1 -1
  72. package/package.json +21 -21
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["Checkbox","checked","label","onChange","theme","container","undefined","checkbox","ThemedCheckbox","defaultTheme","propTypes","PT","bool","string","func","themeType","isRequired","defaultProps"],"sources":["../../../../../src/shared/components/Checkbox/index.jsx"],"sourcesContent":["import PT from 'prop-types';\n\nimport { themed } from 'utils';\n\nimport defaultTheme from './theme.scss';\n\nfunction Checkbox({\n checked,\n label,\n onChange,\n theme,\n}) {\n return (\n <div className={theme.container}>\n { label === undefined ? null : <p className={theme.label}>{label}</p> }\n <input\n checked={checked}\n className={theme.checkbox}\n onChange={onChange}\n type=\"checkbox\"\n />\n </div>\n );\n}\n\n/**\n * Checkbox component theme: a map of\n * CSS classes to append to its elements:\n * @prop {string} [checkbox] to the underlying checkbox `<input>` element.\n * @prop {string} [container] to the root checkbox element.\n * @prop {string} [label] to the checkbox label element.\n */\nconst ThemedCheckbox = themed('Checkbox', [\n 'checkbox',\n 'container',\n 'label',\n], defaultTheme)(Checkbox);\n\n/**\n * The `<Checkbox>` component implements themeable checkboxes.\n * @param {object} [props] Component properties.\n * @param {boolean} [props.checked] Checkbox value.\n * @param {string} [props.label] Checkbox label.\n * @param {function} [props.onChange] State change handler.\n * @param {CheckboxTheme} [props.theme] _Ad hoc_ theme.\n * @param {...any} [props....]\n * [Other properties of themeable components](https://www.npmjs.com/package/@dr.pogodin/react-themes#themed-component-properties).\n */\nCheckbox.propTypes = {\n checked: PT.bool,\n label: PT.string,\n onChange: PT.func,\n theme: ThemedCheckbox.themeType.isRequired,\n};\n\nCheckbox.defaultProps = {\n checked: undefined,\n label: undefined,\n onChange: undefined,\n};\n\nexport default ThemedCheckbox;\n"],"mappings":";;;;;;;;;AAAA;;AAEA;;;;;;;;;;;;;AAIA,SAASA,QAAT,CAAkB;EAChBC,OADgB;EAEhBC,KAFgB;EAGhBC,QAHgB;EAIhBC;AAJgB,CAAlB,EAKG;EACD,oBACE;IAAK,SAAS,EAAEA,KAAK,CAACC,SAAtB;IAAA,WACIH,KAAK,KAAKI,SAAV,GAAsB,IAAtB,gBAA6B;MAAG,SAAS,EAAEF,KAAK,CAACF,KAApB;MAAA,UAA4BA;IAA5B,EADjC,eAEE;MACE,OAAO,EAAED,OADX;MAEE,SAAS,EAAEG,KAAK,CAACG,QAFnB;MAGE,QAAQ,EAAEJ,QAHZ;MAIE,IAAI,EAAC;IAJP,EAFF;EAAA,EADF;AAWD;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,MAAMK,cAAc,GAAG,mBAAO,UAAP,EAAmB,CACxC,UADwC,EAExC,WAFwC,EAGxC,OAHwC,CAAnB,EAIpBC,YAJoB,EAINT,QAJM,CAAvB;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACAA,QAAQ,CAACU,SAAT,GAAqB;EACnBT,OAAO,EAAEU,mBAAGC,IADO;EAEnBV,KAAK,EAAES,mBAAGE,MAFS;EAGnBV,QAAQ,EAAEQ,mBAAGG,IAHM;EAInBV,KAAK,EAAEI,cAAc,CAACO,SAAf,CAAyBC;AAJb,CAArB;AAOAhB,QAAQ,CAACiB,YAAT,GAAwB;EACtBhB,OAAO,EAAEK,SADa;EAEtBJ,KAAK,EAAEI,SAFe;EAGtBH,QAAQ,EAAEG;AAHY,CAAxB;eAMeE,c"}
1
+ {"version":3,"file":"index.js","names":["Checkbox","checked","label","onChange","theme","container","undefined","checkbox","ThemedCheckbox","themed","defaultTheme","propTypes","PT","bool","string","func","themeType","isRequired","defaultProps"],"sources":["../../../../../src/shared/components/Checkbox/index.jsx"],"sourcesContent":["import PT from 'prop-types';\n\nimport { themed } from 'utils';\n\nimport defaultTheme from './theme.scss';\n\nfunction Checkbox({\n checked,\n label,\n onChange,\n theme,\n}) {\n return (\n <div className={theme.container}>\n { label === undefined ? null : <p className={theme.label}>{label}</p> }\n <input\n checked={checked}\n className={theme.checkbox}\n onChange={onChange}\n type=\"checkbox\"\n />\n </div>\n );\n}\n\n/**\n * Checkbox component theme: a map of\n * CSS classes to append to its elements:\n * @prop {string} [checkbox] to the underlying checkbox `<input>` element.\n * @prop {string} [container] to the root checkbox element.\n * @prop {string} [label] to the checkbox label element.\n */\nconst ThemedCheckbox = themed('Checkbox', [\n 'checkbox',\n 'container',\n 'label',\n], defaultTheme)(Checkbox);\n\n/**\n * The `<Checkbox>` component implements themeable checkboxes.\n * @param {object} [props] Component properties.\n * @param {boolean} [props.checked] Checkbox value.\n * @param {string} [props.label] Checkbox label.\n * @param {function} [props.onChange] State change handler.\n * @param {CheckboxTheme} [props.theme] _Ad hoc_ theme.\n * @param {...any} [props....]\n * [Other properties of themeable components](https://www.npmjs.com/package/@dr.pogodin/react-themes#themed-component-properties).\n */\nCheckbox.propTypes = {\n checked: PT.bool,\n label: PT.string,\n onChange: PT.func,\n theme: ThemedCheckbox.themeType.isRequired,\n};\n\nCheckbox.defaultProps = {\n checked: undefined,\n label: undefined,\n onChange: undefined,\n};\n\nexport default ThemedCheckbox;\n"],"mappings":";;;;;;;;;AAAA;;AAEA;;;;;;;;;;;;;AAIA,SAASA,QAAT,CAAkB;EAChBC,OADgB;EAEhBC,KAFgB;EAGhBC,QAHgB;EAIhBC;AAJgB,CAAlB,EAKG;EACD,oBACE;IAAK,SAAS,EAAEA,KAAK,CAACC,SAAtB;IAAA,WACIH,KAAK,KAAKI,SAAV,GAAsB,IAAtB,gBAA6B;MAAG,SAAS,EAAEF,KAAK,CAACF,KAApB;MAAA,UAA4BA;IAA5B,EADjC,eAEE;MACE,OAAO,EAAED,OADX;MAEE,SAAS,EAAEG,KAAK,CAACG,QAFnB;MAGE,QAAQ,EAAEJ,QAHZ;MAIE,IAAI,EAAC;IAJP,EAFF;EAAA,EADF;AAWD;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,MAAMK,cAAc,GAAG,IAAAC,aAAA,EAAO,UAAP,EAAmB,CACxC,UADwC,EAExC,WAFwC,EAGxC,OAHwC,CAAnB,EAIpBC,YAJoB,EAINV,QAJM,CAAvB;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACAA,QAAQ,CAACW,SAAT,GAAqB;EACnBV,OAAO,EAAEW,kBAAA,CAAGC,IADO;EAEnBX,KAAK,EAAEU,kBAAA,CAAGE,MAFS;EAGnBX,QAAQ,EAAES,kBAAA,CAAGG,IAHM;EAInBX,KAAK,EAAEI,cAAc,CAACQ,SAAf,CAAyBC;AAJb,CAArB;AAOAjB,QAAQ,CAACkB,YAAT,GAAwB;EACtBjB,OAAO,EAAEK,SADa;EAEtBJ,KAAK,EAAEI,SAFe;EAGtBH,QAAQ,EAAEG;AAHY,CAAxB;eAMeE,c"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["CodeSplit","children","chunkName","getComponent","placeholder","props","current","heap","mounted","pendingStyles","publicPath","LazyComponent","res","length","Promise","all","default","IS_SERVER_SIDE","chunks","ssrContext","includes","Error","push","window","CHUNK_GROUPS","forEach","asset","endsWith","path","link","document","querySelector","createElement","setAttribute","barrier","onload","resolve","onerror","head","appendChild","STYLESHEET_USAGE_COUNTERS","item","removeChild","propTypes","PT","node","string","isRequired","func","defaultProps","undefined"],"sources":["../../../../../src/shared/components/CodeSplit/index.jsx"],"sourcesContent":["/* eslint-disable react/jsx-props-no-spreading */\n/* global document, window */\n\nimport PT from 'prop-types';\n\nimport {\n lazy,\n Suspense,\n useEffect,\n useRef,\n} from 'react';\n\nimport { getGlobalState } from '@dr.pogodin/react-global-state';\nimport { newBarrier } from 'utils/Barrier';\nimport { getBuildInfo, IS_SERVER_SIDE } from 'utils/isomorphy';\n\nexport default function CodeSplit({\n children,\n chunkName,\n getComponent,\n placeholder,\n ...props\n}) {\n const { current: heap } = useRef({\n mounted: false,\n pendingStyles: [],\n });\n const { publicPath } = getBuildInfo();\n\n // TODO: Not sure whether it is fine for the inner React.lazy() mechanics\n // if we dynamically create the lazy component inside a render of another\n // component, or does it expect we only create it once on outside of any\n // component.\n const LazyComponent = lazy(async () => {\n const res = await getComponent();\n if (heap.pendingStyles.length) await Promise.all(heap.pendingStyles);\n return res.default ? res : { default: res };\n });\n\n if (IS_SERVER_SIDE) {\n const { chunks } = getGlobalState().ssrContext;\n if (chunks.includes(chunkName)) {\n throw Error(`Chunk name clash for \"${chunkName}\"`);\n } else chunks.push(chunkName);\n } else if (!heap.mounted) {\n heap.mounted = true;\n\n window.CHUNK_GROUPS[chunkName].forEach((asset) => {\n if (!asset.endsWith('.css')) return;\n const path = `${publicPath}/${asset}`;\n let link = document.querySelector(`link[href=\"${path}\"]`);\n if (!link) {\n link = document.createElement('link');\n link.setAttribute('href', path);\n link.setAttribute('rel', 'stylesheet');\n\n const barrier = newBarrier();\n link.onload = barrier.resolve;\n\n // Even if the style load failed, still allow to mount the component,\n // abeit with broken styling.\n link.onerror = barrier.resolve;\n\n heap.pendingStyles.push(barrier);\n\n const head = document.querySelector('head');\n head.appendChild(link);\n }\n window.STYLESHEET_USAGE_COUNTERS ||= {};\n window.STYLESHEET_USAGE_COUNTERS[path] ||= 0;\n ++window.STYLESHEET_USAGE_COUNTERS[path];\n });\n }\n\n // This effectively fires only once, just before the component unmounts.\n useEffect(() => () => {\n heap.mounted = false;\n window.CHUNK_GROUPS[chunkName].forEach((item) => {\n if (!item.endsWith('.css')) return;\n const path = `${publicPath}/${item}`;\n if (--window.STYLESHEET_USAGE_COUNTERS[path] <= 0) {\n const link = document.querySelector(`link[href=\"${path}\"]`);\n const head = document.querySelector('head');\n head.removeChild(link);\n }\n });\n }, [chunkName, heap, publicPath]);\n\n return (\n <Suspense fallback={placeholder}>\n <LazyComponent {...props}>\n {children}\n </LazyComponent>\n </Suspense>\n );\n}\n\nCodeSplit.propTypes = {\n children: PT.node,\n chunkName: PT.string.isRequired,\n getComponent: PT.func.isRequired,\n placeholder: PT.node,\n};\n\nCodeSplit.defaultProps = {\n children: undefined,\n placeholder: undefined,\n};\n"],"mappings":";;;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AAuB,MAAvB,CAAb;QACAO,IAAI,CAACI,WAAL,CAAiBb,IAAjB;MACD;IACF,CARD;EASD,CAXD,EAWG,CAAC3B,SAAD,EAAYK,IAAZ,EAAkBG,UAAlB,CAXH;EAaA,oBACE,qBAAC,eAAD;IAAU,QAAQ,EAAEN,WAApB;IAAA,uBACE,qBAAC,aAAD,OAAmBC,KAAnB;MAAA,UACGJ;IADH;EADF,EADF;AAOD;;AAEDD,SAAS,CAAC2C,SAAV,GAAsB;EACpB1C,QAAQ,EAAE2C,mBAAGC,IADO;EAEpB3C,SAAS,EAAE0C,mBAAGE,MAAH,CAAUC,UAFD;EAGpB5C,YAAY,EAAEyC,mBAAGI,IAAH,CAAQD,UAHF;EAIpB3C,WAAW,EAAEwC,mBAAGC;AAJI,CAAtB;AAOA7C,SAAS,CAACiD,YAAV,GAAyB;EACvBhD,QAAQ,EAAEiD,SADa;EAEvB9C,WAAW,EAAE8C;AAFU,CAAzB"}
1
+ {"version":3,"file":"index.js","names":["CodeSplit","children","chunkName","getComponent","placeholder","props","current","heap","useRef","mounted","pendingStyles","publicPath","getBuildInfo","LazyComponent","lazy","res","length","Promise","all","default","IS_SERVER_SIDE","chunks","getGlobalState","ssrContext","includes","Error","push","window","CHUNK_GROUPS","forEach","asset","endsWith","path","link","document","querySelector","createElement","setAttribute","barrier","newBarrier","onload","resolve","onerror","head","appendChild","STYLESHEET_USAGE_COUNTERS","useEffect","item","removeChild","propTypes","PT","node","string","isRequired","func","defaultProps","undefined"],"sources":["../../../../../src/shared/components/CodeSplit/index.jsx"],"sourcesContent":["/* eslint-disable react/jsx-props-no-spreading */\n/* global document, window */\n\nimport PT from 'prop-types';\n\nimport {\n lazy,\n Suspense,\n useEffect,\n useRef,\n} from 'react';\n\nimport { getGlobalState } from '@dr.pogodin/react-global-state';\nimport { newBarrier } from 'utils/Barrier';\nimport { getBuildInfo, IS_SERVER_SIDE } from 'utils/isomorphy';\n\nexport default function CodeSplit({\n children,\n chunkName,\n getComponent,\n placeholder,\n ...props\n}) {\n const { current: heap } = useRef({\n mounted: false,\n pendingStyles: [],\n });\n const { publicPath } = getBuildInfo();\n\n // TODO: Not sure whether it is fine for the inner React.lazy() mechanics\n // if we dynamically create the lazy component inside a render of another\n // component, or does it expect we only create it once on outside of any\n // component.\n const LazyComponent = lazy(async () => {\n const res = await getComponent();\n if (heap.pendingStyles.length) await Promise.all(heap.pendingStyles);\n return res.default ? res : { default: res };\n });\n\n if (IS_SERVER_SIDE) {\n const { chunks } = getGlobalState().ssrContext;\n if (chunks.includes(chunkName)) {\n throw Error(`Chunk name clash for \"${chunkName}\"`);\n } else chunks.push(chunkName);\n } else if (!heap.mounted) {\n heap.mounted = true;\n\n window.CHUNK_GROUPS[chunkName].forEach((asset) => {\n if (!asset.endsWith('.css')) return;\n const path = `${publicPath}/${asset}`;\n let link = document.querySelector(`link[href=\"${path}\"]`);\n if (!link) {\n link = document.createElement('link');\n link.setAttribute('href', path);\n link.setAttribute('rel', 'stylesheet');\n\n const barrier = newBarrier();\n link.onload = barrier.resolve;\n\n // Even if the style load failed, still allow to mount the component,\n // abeit with broken styling.\n link.onerror = barrier.resolve;\n\n heap.pendingStyles.push(barrier);\n\n const head = document.querySelector('head');\n head.appendChild(link);\n }\n window.STYLESHEET_USAGE_COUNTERS ||= {};\n window.STYLESHEET_USAGE_COUNTERS[path] ||= 0;\n ++window.STYLESHEET_USAGE_COUNTERS[path];\n });\n }\n\n // This effectively fires only once, just before the component unmounts.\n useEffect(() => () => {\n heap.mounted = false;\n window.CHUNK_GROUPS[chunkName].forEach((item) => {\n if (!item.endsWith('.css')) return;\n const path = `${publicPath}/${item}`;\n if (--window.STYLESHEET_USAGE_COUNTERS[path] <= 0) {\n const link = document.querySelector(`link[href=\"${path}\"]`);\n const head = document.querySelector('head');\n head.removeChild(link);\n }\n });\n }, [chunkName, heap, publicPath]);\n\n return (\n <Suspense fallback={placeholder}>\n <LazyComponent {...props}>\n {children}\n </LazyComponent>\n </Suspense>\n );\n}\n\nCodeSplit.propTypes = {\n children: PT.node,\n chunkName: PT.string.isRequired,\n getComponent: PT.func.isRequired,\n placeholder: PT.node,\n};\n\nCodeSplit.defaultProps = {\n children: undefined,\n placeholder: undefined,\n};\n"],"mappings":";;;;;;;;;AAGA;;AAEA;;AAOA;;AACA;;AACA;;;;AAdA;;AACA;AAee,SAASA,SAAT,CAAmB;EAChCC,QADgC;EAEhCC,SAFgC;EAGhCC,YAHgC;EAIhCC,WAJgC;EAKhC,GAAGC;AAL6B,CAAnB,EAMZ;EACD,MAAM;IAAEC,OAAO,EAAEC;EAAX,IAAoB,IAAAC,aAAA,EAAO;IAC/BC,OAAO,EAAE,KADsB;IAE/BC,aAAa,EAAE;EAFgB,CAAP,CAA1B;EAIA,MAAM;IAAEC;EAAF,IAAiB,IAAAC,uBAAA,GAAvB,CALC,CAOD;EACA;EACA;EACA;;EACA,MAAMC,aAAa,gBAAG,IAAAC,WAAA,EAAK,YAAY;IACrC,MAAMC,GAAG,GAAG,MAAMZ,YAAY,EAA9B;IACA,IAAII,IAAI,CAACG,aAAL,CAAmBM,MAAvB,EAA+B,MAAMC,OAAO,CAACC,GAAR,CAAYX,IAAI,CAACG,aAAjB,CAAN;IAC/B,OAAOK,GAAG,CAACI,OAAJ,GAAcJ,GAAd,GAAoB;MAAEI,OAAO,EAAEJ;IAAX,CAA3B;EACD,CAJqB,CAAtB;;EAMA,IAAIK,yBAAJ,EAAoB;IAClB,MAAM;MAAEC;IAAF,IAAa,IAAAC,gCAAA,IAAiBC,UAApC;;IACA,IAAIF,MAAM,CAACG,QAAP,CAAgBtB,SAAhB,CAAJ,EAAgC;MAC9B,MAAMuB,KAAK,CAAE,yBAAwBvB,SAAU,GAApC,CAAX;IACD,CAFD,MAEOmB,MAAM,CAACK,IAAP,CAAYxB,SAAZ;EACR,CALD,MAKO,IAAI,CAACK,IAAI,CAACE,OAAV,EAAmB;IACxBF,IAAI,CAACE,OAAL,GAAe,IAAf;IAEAkB,MAAM,CAACC,YA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AAW,IAAGoC,IAAK,EAAnC;;MACA,IAAI,EAAEpB,MAAM,CAACkB,yBAAP,CAAiCb,IAAjC,CAAF,IAA4C,CAAhD,EAAmD;QACjD,MAAMC,IAAI,GAAGC,QAAQ,CAACC,aAAT,CAAwB,cAAaH,IAAK,IAA1C,CAAb;QACA,MAAMW,IAAI,GAAGT,QAAQ,CAACC,aAAT,CAAuB,MAAvB,CAAb;QACAQ,IAAI,CAACK,WAAL,CAAiBf,IAAjB;MACD;IACF,CARD;EASD,CAXD,EAWG,CAAC/B,SAAD,EAAYK,IAAZ,EAAkBI,UAAlB,CAXH;EAaA,oBACE,qBAAC,eAAD;IAAU,QAAQ,EAAEP,WAApB;IAAA,uBACE,qBAAC,aAAD,OAAmBC,KAAnB;MAAA,UACGJ;IADH;EADF,EADF;AAOD;;AAEDD,SAAS,CAACiD,SAAV,GAAsB;EACpBhD,QAAQ,EAAEiD,kBAAA,CAAGC,IADO;EAEpBjD,SAAS,EAAEgD,kBAAA,CAAGE,MAAH,CAAUC,UAFD;EAGpBlD,YAAY,EAAE+C,kBAAA,CAAGI,IAAH,CAAQD,UAHF;EAIpBjD,WAAW,EAAE8C,kBAAA,CAAGC;AAJI,CAAtB;AAOAnD,SAAS,CAACuD,YAAV,GAAyB;EACvBtD,QAAQ,EAAEuD,SADa;EAEvBpD,WAAW,EAAEoD;AAFU,CAAzB"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["Dropdown","filter","label","onChange","options","theme","value","optionArray","hiddenOption","i","length","op","push","option","name","undefined","container","select","arrow","ThemedDropdown","defaultTheme","propTypes","PT","func","string","arrayOf","oneOfType","shape","node","isRequired","themeType","defaultProps"],"sources":["../../../../../src/shared/components/Dropdown/index.jsx"],"sourcesContent":["import { isString } from 'lodash';\nimport PT from 'prop-types';\n\nimport { themed } from 'utils';\n\nimport defaultTheme from './theme.scss';\n\n/**\n * Implements a themeable dropdown list. Internally it is rendered with help of\n * the standard HTML `<select>` element, thus the styling support is somewhat\n * limited.\n * @param {object} [props] Component properties.\n * @param {function} [props.filter] Options filter function. If provided, only\n * those elements of `options` list will be used by the dropdown, for which this\n * filter returns `true`.\n * @param {string} [props.label] Dropdown label.\n * @param {string} [props.onChange] Selection event handler.\n * @param {DropdownOption[]|string[]} [props.options=[]] Array of dropdown\n * options. For string elements the option value and name will be the same.\n * It is allowed to mix DropdownOption and string elements in the same option\n * list.\n * @param {DropdownTheme} [props.theme] _Ad hoc_ theme.\n * @param {string} [props.value] Currently selected value.\n * @param {...any} [props....]\n * [Other theming properties](https://www.npmjs.com/package/@dr.pogodin/react-themes#themed-component-properties)\n */\nfunction Dropdown({\n filter,\n label,\n onChange,\n options,\n theme,\n value,\n}) {\n const optionArray = [(\n <option\n className={theme.hiddenOption}\n key=\"__reactUtilsHiddenOption\"\n >\n &zwnj;\n </option>\n )];\n for (let i = 0; i < options.length; ++i) {\n let op = options[i];\n if (!filter || filter(op)) {\n if (isString(op)) op = { value: op };\n optionArray.push((\n <option className={theme.option} key={op.value} value={op.value}>\n {op.name === undefined ? op.value : op.name }\n </option>\n ));\n }\n }\n return (\n <div className={theme.container}>\n { label === undefined ? null : <p className={theme.label}>{label}</p> }\n <select\n className={theme.select}\n onChange={onChange}\n value={value}\n >\n {optionArray}\n </select>\n <div className={theme.arrow}>▼</div>\n </div>\n );\n}\n\nconst ThemedDropdown = themed('Dropdown', [\n 'arrow',\n 'container',\n 'hiddenOption',\n 'label',\n 'option',\n 'select',\n], defaultTheme)(Dropdown);\n\nDropdown.propTypes = {\n filter: PT.func,\n label: PT.string,\n onChange: PT.func,\n options: PT.arrayOf(\n PT.oneOfType([\n PT.shape({\n name: PT.node,\n value: PT.string.isRequired,\n }),\n PT.string,\n ]).isRequired,\n ),\n theme: ThemedDropdown.themeType.isRequired,\n value: PT.string,\n};\n\nDropdown.defaultProps = {\n filter: undefined,\n label: undefined,\n onChange: undefined,\n options: [],\n value: undefined,\n};\n\nexport default ThemedDropdown;\n"],"mappings":";;;;;;;;;AAAA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K,CAACa,KAAtB;MAAA;IAAA,EATF;EAAA,EADF;AAaD;;AAED,MAAMC,cAAc,GAAG,mBAAO,UAAP,EAAmB,CACxC,OADwC,EAExC,WAFwC,EAGxC,cAHwC,EAIxC,OAJwC,EAKxC,QALwC,EAMxC,QANwC,CAAnB,EAOpBC,YAPoB,EAONpB,QAPM,CAAvB;AASAA,QAAQ,CAACqB,SAAT,GAAqB;EACnBpB,MAAM,EAAEqB,mBAAGC,IADQ;EAEnBrB,KAAK,EAAEoB,mBAAGE,MAFS;EAGnBrB,QAAQ,EAAEmB,mBAAGC,IAHM;EAInBnB,OAAO,EAAEkB,mBAAGG,OAAH,CACPH,mBAAGI,SAAH,CAAa,CACXJ,mBAAGK,KAAH,CAAS;IACPb,IAAI,EAAEQ,mBAAGM,IADF;IAEPtB,KAAK,EAAEgB,mBAAGE,MAAH,CAAUK;EAFV,CAAT,CADW,EAKXP,mBAAGE,MALQ,CAAb,EAMGK,UAPI,CAJU;EAanBxB,KAAK,EAAEc,cAAc,CAACW,SAAf,CAAyBD,UAbb;EAcnBvB,KAAK,EAAEgB,mBAAGE;AAdS,CAArB;AAiBAxB,QAAQ,CAAC+B,YAAT,GAAwB;EACtB9B,MAAM,EAAEc,SADc;EAEtBb,KAAK,EAAEa,SAFe;EAGtBZ,QAAQ,EAAEY,SAHY;EAItBX,OAAO,EAAE,EAJa;EAKtBE,KAAK,EAAES;AALe,CAAxB;eAQeI,c"}
1
+ {"version":3,"file":"index.js","names":["Dropdown","filter","label","onChange","options","theme","value","optionArray","hiddenOption","i","length","op","isString","push","option","name","undefined","container","select","arrow","ThemedDropdown","themed","defaultTheme","propTypes","PT","func","string","arrayOf","oneOfType","shape","node","isRequired","themeType","defaultProps"],"sources":["../../../../../src/shared/components/Dropdown/index.jsx"],"sourcesContent":["import { isString } from 'lodash';\nimport PT from 'prop-types';\n\nimport { themed } from 'utils';\n\nimport defaultTheme from './theme.scss';\n\n/**\n * Implements a themeable dropdown list. Internally it is rendered with help of\n * the standard HTML `<select>` element, thus the styling support is somewhat\n * limited.\n * @param {object} [props] Component properties.\n * @param {function} [props.filter] Options filter function. If provided, only\n * those elements of `options` list will be used by the dropdown, for which this\n * filter returns `true`.\n * @param {string} [props.label] Dropdown label.\n * @param {string} [props.onChange] Selection event handler.\n * @param {DropdownOption[]|string[]} [props.options=[]] Array of dropdown\n * options. For string elements the option value and name will be the same.\n * It is allowed to mix DropdownOption and string elements in the same option\n * list.\n * @param {DropdownTheme} [props.theme] _Ad hoc_ theme.\n * @param {string} [props.value] Currently selected value.\n * @param {...any} [props....]\n * [Other theming properties](https://www.npmjs.com/package/@dr.pogodin/react-themes#themed-component-properties)\n */\nfunction Dropdown({\n filter,\n label,\n onChange,\n options,\n theme,\n value,\n}) {\n const optionArray = [(\n <option\n className={theme.hiddenOption}\n key=\"__reactUtilsHiddenOption\"\n >\n &zwnj;\n </option>\n )];\n for (let i = 0; i < options.length; ++i) {\n let op = options[i];\n if (!filter || filter(op)) {\n if (isString(op)) op = { value: op };\n optionArray.push((\n <option className={theme.option} key={op.value} value={op.value}>\n {op.name === undefined ? op.value : op.name }\n </option>\n ));\n }\n }\n return (\n <div className={theme.container}>\n { label === undefined ? null : <p className={theme.label}>{label}</p> }\n <select\n className={theme.select}\n onChange={onChange}\n value={value}\n >\n {optionArray}\n </select>\n <div className={theme.arrow}>▼</div>\n </div>\n );\n}\n\nconst ThemedDropdown = themed('Dropdown', [\n 'arrow',\n 'container',\n 'hiddenOption',\n 'label',\n 'option',\n 'select',\n], defaultTheme)(Dropdown);\n\nDropdown.propTypes = {\n filter: PT.func,\n label: PT.string,\n onChange: PT.func,\n options: PT.arrayOf(\n PT.oneOfType([\n PT.shape({\n name: PT.node,\n value: PT.string.isRequired,\n }),\n PT.string,\n ]).isRequired,\n ),\n theme: ThemedDropdown.themeType.isRequired,\n value: PT.string,\n};\n\nDropdown.defaultProps = {\n filter: undefined,\n label: undefined,\n onChange: undefined,\n options: [],\n value: undefined,\n};\n\nexport default Them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UAKGC;IALH,EAFF,eASE;MAAK,SAAS,EAAEF,KAAK,CAACc,KAAtB;MAAA;IAAA,EATF;EAAA,EADF;AAaD;;AAED,MAAMC,cAAc,GAAG,IAAAC,aAAA,EAAO,UAAP,EAAmB,CACxC,OADwC,EAExC,WAFwC,EAGxC,cAHwC,EAIxC,OAJwC,EAKxC,QALwC,EAMxC,QANwC,CAAnB,EAOpBC,YAPoB,EAONtB,QAPM,CAAvB;AASAA,QAAQ,CAACuB,SAAT,GAAqB;EACnBtB,MAAM,EAAEuB,kBAAA,CAAGC,IADQ;EAEnBvB,KAAK,EAAEsB,kBAAA,CAAGE,MAFS;EAGnBvB,QAAQ,EAAEqB,kBAAA,CAAGC,IAHM;EAInBrB,OAAO,EAAEoB,kBAAA,CAAGG,OAAH,CACPH,kBAAA,CAAGI,SAAH,CAAa,CACXJ,kBAAA,CAAGK,KAAH,CAAS;IACPd,IAAI,EAAES,kBAAA,CAAGM,IADF;IAEPxB,KAAK,EAAEkB,kBAAA,CAAGE,MAAH,CAAUK;EAFV,CAAT,CADW,EAKXP,kBAAA,CAAGE,MALQ,CAAb,EAMGK,UAPI,CAJU;EAanB1B,KAAK,EAAEe,cAAc,CAACY,SAAf,CAAyBD,UAbb;EAcnBzB,KAAK,EAAEkB,kBAAA,CAAGE;AAdS,CAArB;AAiBA1B,QAAQ,CAACiC,YAAT,GAAwB;EACtBhC,MAAM,EAAEe,SADc;EAEtBd,KAAK,EAAEc,SAFe;EAGtBb,QAAQ,EAAEa,SAHY;EAItBZ,OAAO,EAAE,EAJa;EAKtBE,KAAK,EAAEU;AALe,CAAxB;eAQeI,c"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["GenericLink","children","className","disabled","enforceA","keepScrollPosition","onClick","onMouseDown","openNewTab","replace","routerLinkType","to","rest","match","e","preventDefault","window","scroll","defaultProps","propTypes","PT","node","string","bool","func","elementType","isRequired","oneOfType","object"],"sources":["../../../../../src/shared/components/GenericLink/index.jsx"],"sourcesContent":["/* global window */\n\nimport PT from 'prop-types';\nimport { createElement } from 'react';\n\nimport './style.scss';\n\n/**\n * The `<Link>` component, and almost identical `<NavLink>` component, are\n * auxiliary wrappers around\n * [React Router](https://github.com/ReactTraining/react-router)'s\n * `<Link>` and `<NavLink>` components; they help to handle external and\n * internal links in uniform manner.\n *\n * @param {object} [props] Component properties.\n * @param {string} [props.className] CSS classes to apply to the link.\n * @param {boolean} [props.disabled] Disables the link.\n * @param {boolean} [props.enforceA] `true` enforces rendering of the link as\n * a simple `<a>` element.\n * @param {boolean} [props.keepScrollPosition] If `true`, and the link is\n * rendered as a React Router's component, it won't reset the viewport scrolling\n * position to the origin when clicked.\n * @param {function} [props.onClick] Event handler to trigger upon click.\n * @param {function} [props.onMouseDown] Event handler to trigger on MouseDown\n * event.\n * @param {boolean} [props.openNewTab] If `true` the link opens in a new tab.\n * @param {boolean} [props.replace] When `true`, the link will replace current\n * entry in the history stack instead of adding a new one.\n * @param {string} [props.to] Link URL.\n * @param {string} [props.activeClassName] **`<NavLink>`** only: CSS class(es)\n * to apply to rendered link when it is active.\n * @param {string} [props.activeStyle] **`<NavLink>`** only: CSS styles\n * to apply to the rendered link when it is active.\n * @param {boolean} [props.exact] **`<NavLink>`** only: if `true`, the active\n * class/style will only be applied if the location is matched exactly.\n * @param {function} [props.isActive] **`<NavLink>`** only: Add extra\n * logic for determining whether the link is active. This should be used if you\n * want to do more than verify that the link’s pathname matches the current URL\n * pathname.\n * @param {object} [props.location] **`<NavLink>`** only: `isActive` compares\n * current history location (usually the current browser URL). To compare to\n * a different location, a custom `location` can be passed.\n * @param {boolean} [props.strict] **`<NavLink>`** only: . When `true`, trailing\n * slash on a location’s pathname will be taken into consideration when\n * determining if the location matches the current URL. See the `<Route strict>`\n * documentation for more information.\n */\nexport default function GenericLink({\n children,\n className,\n disabled,\n enforceA,\n keepScrollPosition,\n onClick,\n onMouseDown,\n openNewTab,\n replace,\n routerLinkType,\n to,\n ...rest\n}) {\n /* Renders Link as <a> element if:\n * - It is opted explicitely by `enforceA` prop;\n * - It should be opened in a new tab;\n * - It is an absolte URL (starts with http:// or https://);\n * - It is anchor link (starts with #). */\n if (disabled || enforceA || openNewTab || to.match(/^(#|(https?|mailto):)/)) {\n return (\n <a\n className={className}\n disabled={disabled}\n href={to}\n onClick={disabled ? (e) => e.preventDefault() : onClick}\n onMouseDown={disabled ? (e) => e.preventDefault() : onMouseDown}\n rel=\"noopener noreferrer\"\n styleName=\"link\"\n target={openNewTab ? '_blank' : ''}\n >\n {children}\n </a>\n );\n }\n\n /* Otherwise we render the link as React Router's Link or NavLink element. */\n return createElement(routerLinkType, {\n className,\n disabled,\n onMouseDown,\n replace,\n to,\n onClick: (e) => {\n // Executes the user-provided event handler, if any.\n if (onClick) onClick(e);\n\n // By default, clicking the link scrolls the page to beginning.\n if (!keepScrollPosition) window.scroll(0, 0);\n },\n ...rest,\n }, children);\n}\n\nGenericLink.defaultProps = {\n children: null,\n className: null,\n disabled: false,\n enforceA: false,\n keepScrollPosition: false,\n onClick: null,\n onMouseDown: null,\n openNewTab: false,\n replace: false,\n to: '',\n};\n\nGenericLink.propTypes = {\n children: PT.node,\n className: PT.string,\n disabled: PT.bool,\n enforceA: PT.bool,\n keepScrollPosition: PT.bool,\n onClick: PT.func,\n onMouseDown: PT.func,\n openNewTab: PT.bool,\n replace: PT.bool,\n routerLinkType: PT.elementType.isRequired,\n to: PT.oneOfType([PT.object, PT.string]),\n};\n"],"mappings":";;;;;;;;;AAEA;;AACA;;;;AAHA;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,WAAT,CAAqB;EAClCC,QADkC;EAElCC,SAFkC;EAGlCC,QAHkC;EAIlCC,QAJkC;EAKlCC,kBALkC;EA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AU,EAAE,KARa;EASzBC,OAAO,EAAE,KATgB;EAUzBE,EAAE,EAAE;AAVqB,CAA3B;AAaAX,WAAW,CAACmB,SAAZ,GAAwB;EACtBlB,QAAQ,EAAEmB,mBAAGC,IADS;EAEtBnB,SAAS,EAAEkB,mBAAGE,MAFQ;EAGtBnB,QAAQ,EAAEiB,mBAAGG,IAHS;EAItBnB,QAAQ,EAAEgB,mBAAGG,IAJS;EAKtBlB,kBAAkB,EAAEe,mBAAGG,IALD;EAMtBjB,OAAO,EAAEc,mBAAGI,IANU;EAOtBjB,WAAW,EAAEa,mBAAGI,IAPM;EAQtBhB,UAAU,EAAEY,mBAAGG,IARO;EAStBd,OAAO,EAAEW,mBAAGG,IATU;EAUtBb,cAAc,EAAEU,mBAAGK,WAAH,CAAeC,UAVT;EAWtBf,EAAE,EAAES,mBAAGO,SAAH,CAAa,CAACP,mBAAGQ,MAAJ,EAAYR,mBAAGE,MAAf,CAAb;AAXkB,CAAxB"}
1
+ {"version":3,"file":"index.js","names":["GenericLink","children","className","disabled","enforceA","keepScrollPosition","onClick","onMouseDown","openNewTab","replace","routerLinkType","to","rest","match","e","preventDefault","createElement","window","scroll","defaultProps","propTypes","PT","node","string","bool","func","elementType","isRequired","oneOfType","object"],"sources":["../../../../../src/shared/components/GenericLink/index.jsx"],"sourcesContent":["/* global window */\n\nimport PT from 'prop-types';\nimport { createElement } from 'react';\n\nimport './style.scss';\n\n/**\n * The `<Link>` component, and almost identical `<NavLink>` component, are\n * auxiliary wrappers around\n * [React Router](https://github.com/ReactTraining/react-router)'s\n * `<Link>` and `<NavLink>` components; they help to handle external and\n * internal links in uniform manner.\n *\n * @param {object} [props] Component properties.\n * @param {string} [props.className] CSS classes to apply to the link.\n * @param {boolean} [props.disabled] Disables the link.\n * @param {boolean} [props.enforceA] `true` enforces rendering of the link as\n * a simple `<a>` element.\n * @param {boolean} [props.keepScrollPosition] If `true`, and the link is\n * rendered as a React Router's component, it won't reset the viewport scrolling\n * position to the origin when clicked.\n * @param {function} [props.onClick] Event handler to trigger upon click.\n * @param {function} [props.onMouseDown] Event handler to trigger on MouseDown\n * event.\n * @param {boolean} [props.openNewTab] If `true` the link opens in a new tab.\n * @param {boolean} [props.replace] When `true`, the link will replace current\n * entry in the history stack instead of adding a new one.\n * @param {string} [props.to] Link URL.\n * @param {string} [props.activeClassName] **`<NavLink>`** only: CSS class(es)\n * to apply to rendered link when it is active.\n * @param {string} [props.activeStyle] **`<NavLink>`** only: CSS styles\n * to apply to the rendered link when it is active.\n * @param {boolean} [props.exact] **`<NavLink>`** only: if `true`, the active\n * class/style will only be applied if the location is matched exactly.\n * @param {function} [props.isActive] **`<NavLink>`** only: Add extra\n * logic for determining whether the link is active. This should be used if you\n * want to do more than verify that the link’s pathname matches the current URL\n * pathname.\n * @param {object} [props.location] **`<NavLink>`** only: `isActive` compares\n * current history location (usually the current browser URL). To compare to\n * a different location, a custom `location` can be passed.\n * @param {boolean} [props.strict] **`<NavLink>`** only: . When `true`, trailing\n * slash on a location’s pathname will be taken into consideration when\n * determining if the location matches the current URL. See the `<Route strict>`\n * documentation for more information.\n */\nexport default function GenericLink({\n children,\n className,\n disabled,\n enforceA,\n keepScrollPosition,\n onClick,\n onMouseDown,\n openNewTab,\n replace,\n routerLinkType,\n to,\n ...rest\n}) {\n /* Renders Link as <a> element if:\n * - It is opted explicitely by `enforceA` prop;\n * - It should be opened in a new tab;\n * - It is an absolte URL (starts with http:// or https://);\n * - It is anchor link (starts with #). */\n if (disabled || enforceA || openNewTab || to.match(/^(#|(https?|mailto):)/)) {\n return (\n <a\n className={className}\n disabled={disabled}\n href={to}\n onClick={disabled ? (e) => e.preventDefault() : onClick}\n onMouseDown={disabled ? (e) => e.preventDefault() : onMouseDown}\n rel=\"noopener noreferrer\"\n styleName=\"link\"\n target={openNewTab ? '_blank' : ''}\n >\n {children}\n </a>\n );\n }\n\n /* Otherwise we render the link as React Router's Link or NavLink element. */\n return createElement(routerLinkType, {\n className,\n disabled,\n onMouseDown,\n replace,\n to,\n onClick: (e) => {\n // Executes the user-provided event handler, if any.\n if (onClick) onClick(e);\n\n // By default, clicking the link scrolls the page to beginning.\n if (!keepScrollPosition) window.scroll(0, 0);\n },\n ...rest,\n }, children);\n}\n\nGenericLink.defaultProps = {\n children: null,\n className: null,\n disabled: false,\n enforceA: false,\n keepScrollPosition: false,\n onClick: null,\n onMouseDown: null,\n openNewTab: false,\n replace: false,\n to: '',\n};\n\nGenericLink.propTypes = {\n children: PT.node,\n className: PT.string,\n disabled: PT.bool,\n enforceA: PT.bool,\n keepScrollPosition: PT.bool,\n onClick: PT.func,\n onMouseDown: PT.func,\n openNewTab: PT.bool,\n replace: PT.bool,\n routerLinkType: PT.elementType.isRequired,\n to: PT.oneOfType([PT.object, PT.string]),\n};\n"],"mappings":";;;;;;;;;AAEA;;AACA;;;;AAHA;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,WAAT,CAAqB;EAClCC,QADkC;EAElCC,SAFkC;EAGlCC,QAHkC;EAIlCC,QAJkC;EAKlCC,kBALkC;EAMlCC,OANkC;EAOlCC,WAPkC;EAQlCC,UARkC;EASlCC,OATkC;EAUlCC,cAVkC;EAWlCC,EAXkC;EAYlC,GAAGC;AAZ+B,CAArB,EAaZ;EACD;AACF;AACA;AACA;AACA;EACE,IAAIT,QAAQ,IAAIC,QAAZ,IAAwBI,UAAxB,IAAsCG,EAAE,CAACE,KAAH,CAAS,uBAAT,CAA1C,EAA6E;IAC3E,oBACE;MACE,SAAS,GAAEX,SAAF,GAAEA,SAAF,kGADX;MAEE,QAAQ,EAAEC,QAFZ;MAGE,IAAI,EAAEQ,EAHR;MAIE,OAAO,EAAER,QAAQ,GAAIW,CAAD,IAAOA,CAAC,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kBAAA,CAAGI,IAPM;EAQtBjB,UAAU,EAAEa,kBAAA,CAAGG,IARO;EAStBf,OAAO,EAAEY,kBAAA,CAAGG,IATU;EAUtBd,cAAc,EAAEW,kBAAA,CAAGK,WAAH,CAAeC,UAVT;EAWtBhB,EAAE,EAAEU,kBAAA,CAAGO,SAAH,CAAa,CAACP,kBAAA,CAAGQ,MAAJ,EAAYR,kBAAA,CAAGE,MAAf,CAAb;AAXkB,CAAxB"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["Input","label","theme","rest","container","undefined","input","ThemedInput","defaultTheme","propTypes","PT","string","themeType","isRequired","defaultProps"],"sources":["../../../../../src/shared/components/Input/index.jsx"],"sourcesContent":["import PT from 'prop-types';\n\nimport { themed } from 'utils';\n\nimport defaultTheme from './theme.scss';\n\n/**\n * Themeable input field, based on the standard HTML `<input>` element.\n * @param {object} [props]\n * @param {string} [props.label] Input label.\n * @param {InputTheme} [props.theme] _Ad hoc_ theme.\n * @param {...any} [props....] [Other theming properties](https://www.npmjs.com/package/@dr.pogodin/react-themes#themed-component-properties)\n * @param {...any} [props....] Any other properties are passed to the underlying\n * `<input>` element.\n */\nfunction Input({\n label,\n theme,\n ...rest\n}) {\n return (\n <div className={theme.container}>\n { label === undefined ? null : <p className={theme.label}>{label}</p> }\n <input\n className={theme.input}\n {...rest} // eslint-disable-line react/jsx-props-no-spreading\n />\n </div>\n );\n}\n\nconst ThemedInput = themed('Input', [\n 'container',\n 'input',\n 'label',\n], defaultTheme)(Input);\n\nInput.propTypes = {\n label: PT.string,\n theme: ThemedInput.themeType.isRequired,\n};\n\nInput.defaultProps = {\n label: undefined,\n};\n\nexport default ThemedInput;\n"],"mappings":";;;;;;;;;AAAA;;AAEA;;;;;;;;;;;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASA,KAAT,CAAe;EACbC,KADa;EAEbC,KAFa;EAGb,GAAGC;AAHU,CAAf,EAIG;EACD,oBACE;IAAK,SAAS,EAAED,KAAK,CAACE,SAAtB;IAAA,WACIH,KAAK,KAAKI,SAAV,GAAsB,IAAtB,gBAA6B;MAAG,SAAS,EAAEH,KAAK,CAACD,KAApB;MAAA,UAA4BA;IAA5B,EADjC,eAEE;MACE,SAAS,EAAEC,KAAK,CAACI,KADnB;MAAA,GAEMH;IAFN,EAFF;EAAA,EADF;AASD;;AAED,MAAMI,WAAW,GAAG,mBAAO,OAAP,EAAgB,CAClC,WADkC,EAElC,OAFkC,EAGlC,OAHkC,CAAhB,EAIjBC,YAJiB,EAIHR,KAJG,CAApB;AAMAA,KAAK,CAACS,SAAN,GAAkB;EAChBR,KAAK,EAAES,mBAAGC,MADM;EAEhBT,KAAK,EAAEK,WAAW,CAACK,SAAZ,CAAsBC;AAFb,CAAlB;AAKAb,KAAK,CAACc,YAAN,GAAqB;EACnBb,KAAK,EAAEI;AADY,CAArB;eAIeE,W"}
1
+ {"version":3,"file":"index.js","names":["Input","label","theme","rest","container","undefined","input","ThemedInput","themed","defaultTheme","propTypes","PT","string","themeType","isRequired","defaultProps"],"sources":["../../../../../src/shared/components/Input/index.jsx"],"sourcesContent":["import PT from 'prop-types';\n\nimport { themed } from 'utils';\n\nimport defaultTheme from './theme.scss';\n\n/**\n * Themeable input field, based on the standard HTML `<input>` element.\n * @param {object} [props]\n * @param {string} [props.label] Input label.\n * @param {InputTheme} [props.theme] _Ad hoc_ theme.\n * @param {...any} [props....] [Other theming properties](https://www.npmjs.com/package/@dr.pogodin/react-themes#themed-component-properties)\n * @param {...any} [props....] Any other properties are passed to the underlying\n * `<input>` element.\n */\nfunction Input({\n label,\n theme,\n ...rest\n}) {\n return (\n <div className={theme.container}>\n { label === undefined ? null : <p className={theme.label}>{label}</p> }\n <input\n className={theme.input}\n {...rest} // eslint-disable-line react/jsx-props-no-spreading\n />\n </div>\n );\n}\n\nconst ThemedInput = themed('Input', [\n 'container',\n 'input',\n 'label',\n], defaultTheme)(Input);\n\nInput.propTypes = {\n label: PT.string,\n theme: ThemedInput.themeType.isRequired,\n};\n\nInput.defaultProps = {\n label: undefined,\n};\n\nexport default ThemedInput;\n"],"mappings":";;;;;;;;;AAAA;;AAEA;;;;;;;;;;;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASA,KAAT,CAAe;EACbC,KADa;EAEbC,KAFa;EAGb,GAAGC;AAHU,CAAf,EAIG;EACD,oBACE;IAAK,SAAS,EAAED,KAAK,CAACE,SAAtB;IAAA,WACIH,KAAK,KAAKI,SAAV,GAAsB,IAAtB,gBAA6B;MAAG,SAAS,EAAEH,KAAK,CAACD,KAApB;MAAA,UAA4BA;IAA5B,EADjC,eAEE;MACE,SAAS,EAAEC,KAAK,CAACI,KADnB;MAAA,GAEMH;IAFN,EAFF;EAAA,EADF;AASD;;AAED,MAAMI,WAAW,GAAG,IAAAC,aAAA,EAAO,OAAP,EAAgB,CAClC,WADkC,EAElC,OAFkC,EAGlC,OAHkC,CAAhB,EAIjBC,YAJiB,EAIHT,KAJG,CAApB;AAMAA,KAAK,CAACU,SAAN,GAAkB;EAChBT,KAAK,EAAEU,kBAAA,CAAGC,MADM;EAEhBV,KAAK,EAAEK,WAAW,CAACM,SAAZ,CAAsBC;AAFb,CAAlB;AAKAd,KAAK,CAACe,YAAN,GAAqB;EACnBd,KAAK,EAAEI;AADY,CAArB;eAIeE,W"}
@@ -1 +1 @@
1
- {"version":3,"file":"MetaTags.js","names":["Context","MetaTags","children","description","image","siteName","socialDescription","socialTitle","title","url","socTitle","socDesc","context","defaultProps","propTypes","PT","node","string","isRequired"],"sources":["../../../../src/shared/components/MetaTags.jsx"],"sourcesContent":["import PT from 'prop-types';\nimport { createContext, useMemo } from 'react';\nimport { Helmet } from 'react-helmet';\n\nconst Context = createContext();\n\n/**\n * The `<MetaTags>` component is an auxiliary wrapper around `react-helmet`,\n * which helps to inject meta tags (page title, a brief content description,\n * and social media thumbnails) into generated pages.\n *\n * When `<MetaTags>` are nested within the app's component tree, meta tags\n * content injected by components encountered down the tree overrides tags\n * injected by previously encountered `<MetaTags>` components.\n *\n * **Children:** `<MetaTags>` children, if any, are rendered at the component's\n * location. The context passes down all meta tag properties of parent\n * `<MetaTag>` instances. These properties can fetched within children\n * hierarchy in the following way, thus facilitating tags modification by\n * children:\n * ```jsx\n * import { useContext } from 'react';\n * import { MetaTags } from '@dr.pogodin/react-utils';\n * export default function SampleComponent() {\n * const { title, description, ...rest } = useContext(MetaTags.Context);\n * // Do something with these props here, e.g. prefix the page title with\n * // the component name:\n * return (\n * <MetaTags title={`Sample component - ${title}`} />\n * );\n * }\n * ```\n * @param {object} [props]\n * @param {string} [props.description] Page description to use in\n * the `description` meta tag, and as a default description of Open Graph Tags.\n * @param {string} [props.image] The absolute URL of thumbnail image to use\n * in Open Graph Tags (`twitter:image`, and `og:image`). By default these tags\n * are not injected.\n *\n * **BEWARE:** It must be a complete, absolute URL, including the correct\n * website domain and HTTP schema.\n *\n * @param {string} [props.siteName]: The site name to use in `twitter:site`,\n * and `og:sitename` tags. By default these tags are not injected.\n *\n * @param {string} [props.socialDescription] The site description to use in\n * `twitter:description` and `og:description` meta tags. By default the value of\n * `description` prop is used.\n * @param {string} [props.socialTitle] The page title to use in\n * `twitter:title`, `og:title`, and `og:image:alt` tags. By default the value of\n * `title` prop is used. Also the `og:image:alt` tag is only injected if `image`\n * prop is present.\n *\n * @param {string} props.title: The page name to use in the `<title>` tag.\n * It is also used as the default value of `socialTitle` prop.\n *\n * @param {string} [props.url] The page URL to use in `og:url` tag.\n * By default the tag is not injected.\n */\nexport default function MetaTags({\n children,\n description,\n image,\n siteName,\n socialDescription,\n socialTitle,\n title,\n url,\n}) {\n const socTitle = socialTitle || title;\n const socDesc = socialDescription || description;\n\n const context = useMemo(() => ({\n description,\n image,\n siteName,\n socialDescription,\n socialTitle,\n title,\n url,\n }), [\n description,\n image,\n siteName,\n socialDescription,\n socialTitle,\n title,\n url,\n ]);\n\n return (\n <>\n <Helmet>\n {/* General tags. */}\n <title>\n {title}\n </title>\n <meta name=\"description\" content={description} />\n\n {/* Twitter cards. */}\n <meta name=\"twitter:card\" content=\"summary_large_image\" />\n <meta name=\"twitter:title\" content={socTitle} />\n <meta name=\"twitter:description\" content={socDesc} />\n { image ? <meta name=\"twitter:image\" content={image} /> : null }\n {\n siteName ? (\n <meta name=\"twitter:site\" content={`@${siteName}`} />\n ) : null\n }\n\n {/* Open Graph data. */}\n <meta name=\"og:title\" content={socTitle} />\n { image ? <meta name=\"og:image\" content={image} /> : null }\n { image ? <meta name=\"og:image:alt\" content={socTitle} /> : null }\n <meta name=\"og:description\" content={socDesc} />\n {\n siteName ? (<meta name=\"og:sitename\" content={siteName} />) : null\n }\n { url ? (<meta name=\"og:url\" content={url} />) : null }\n </Helmet>\n {\n children ? (\n <Context.Provider value={context}>\n {children}\n </Context.Provider>\n ) : null\n }\n </>\n );\n}\n\nMetaTags.Context = Context;\n\nMetaTags.defaultProps = {\n children: null,\n image: null,\n siteName: null,\n socialDescription: null,\n socialTitle: null,\n url: null,\n};\n\nMetaTags.propTypes = {\n children: PT.node,\n description: PT.string.isRequired,\n image: PT.string,\n siteName: PT.string,\n socialDescription: PT.string,\n socialTitle: PT.string,\n title: PT.string.isRequired,\n url: PT.string,\n};\n"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;;;AAEA,MAAMA,OAAO,gBAAG,2BAAhB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACe,SAASC,QAAT,CAAkB;EAC/BC,QAD+B;EAE/BC,WAF+B;EAG/BC,KAH+B;EAI/BC,QAJ+B;EAK/BC,iBAL+B;EAM/BC,WAN+B;EAO/BC,KAP+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tBF,EAwBIN,QAAQ,gBAAI;QAAM,IAAI,EAAC,aAAX;QAAyB,OAAO,EAAEA;MAAlC,EAAJ,GAAsD,IAxBlE,EA0BII,GAAG,gBAAI;QAAM,IAAI,EAAC,QAAX;QAAoB,OAAO,EAAEA;MAA7B,EAAJ,GAA4C,IA1BnD;IAAA,EADF,EA8BIP,QAAQ,gBACN,qBAAC,OAAD,CAAS,QAAT;MAAkB,KAAK,EAAEU,OAAzB;MAAA,UACGV;IADH,EADM,GAIJ,IAlCR;EAAA,EADF;AAuCD;;AAEDD,QAAQ,CAACD,OAAT,GAAmBA,OAAnB;AAEAC,QAAQ,CAACY,YAAT,GAAwB;EACtBX,QAAQ,EAAE,IADY;EAEtBE,KAAK,EAAE,IAFe;EAGtBC,QAAQ,EAAE,IAHY;EAItBC,iBAAiB,EAAE,IAJG;EAKtBC,WAAW,EAAE,IALS;EAMtBE,GAAG,EAAE;AANiB,CAAxB;AASAR,QAAQ,CAACa,SAAT,GAAqB;EACnBZ,QAAQ,EAAEa,mBAAGC,IADM;EAEnBb,WAAW,EAAEY,mBAAGE,MAAH,CAAUC,UAFJ;EAGnBd,KAAK,EAAEW,mBAAGE,MAHS;EAInBZ,QAAQ,EAAEU,mBAAGE,MAJM;EAKnBX,iBAAiB,EAAES,mBAAGE,MALH;EAMnBV,WAAW,EAAEQ,mBAAGE,MANG;EAOnBT,KAAK,EAAEO,mBAAGE,MAAH,CAAUC,UAPE;EAQnBT,GAAG,EAAEM,mBAAGE;AARW,CAArB"}
1
+ {"version":3,"file":"MetaTags.js","names":["Context","createContext","MetaTags","children","description","image","siteName","socialDescription","socialTitle","title","url","socTitle","socDesc","context","useMemo","defaultProps","propTypes","PT","node","string","isRequired"],"sources":["../../../../src/shared/components/MetaTags.jsx"],"sourcesContent":["import PT from 'prop-types';\nimport { createContext, useMemo } from 'react';\nimport { Helmet } from 'react-helmet';\n\nconst Context = createContext();\n\n/**\n * The `<MetaTags>` component is an auxiliary wrapper around `react-helmet`,\n * which helps to inject meta tags (page title, a brief content description,\n * and social media thumbnails) into generated pages.\n *\n * When `<MetaTags>` are nested within the app's component tree, meta tags\n * content injected by components encountered down the tree overrides tags\n * injected by previously encountered `<MetaTags>` components.\n *\n * **Children:** `<MetaTags>` children, if any, are rendered at the component's\n * location. The context passes down all meta tag properties of parent\n * `<MetaTag>` instances. These properties can fetched within children\n * hierarchy in the following way, thus facilitating tags modification by\n * children:\n * ```jsx\n * import { useContext } from 'react';\n * import { MetaTags } from '@dr.pogodin/react-utils';\n * export default function SampleComponent() {\n * const { title, description, ...rest } = useContext(MetaTags.Context);\n * // Do something with these props here, e.g. prefix the page title with\n * // the component name:\n * return (\n * <MetaTags title={`Sample component - ${title}`} />\n * );\n * }\n * ```\n * @param {object} [props]\n * @param {string} [props.description] Page description to use in\n * the `description` meta tag, and as a default description of Open Graph Tags.\n * @param {string} [props.image] The absolute URL of thumbnail image to use\n * in Open Graph Tags (`twitter:image`, and `og:image`). By default these tags\n * are not injected.\n *\n * **BEWARE:** It must be a complete, absolute URL, including the correct\n * website domain and HTTP schema.\n *\n * @param {string} [props.siteName]: The site name to use in `twitter:site`,\n * and `og:sitename` tags. By default these tags are not injected.\n *\n * @param {string} [props.socialDescription] The site description to use in\n * `twitter:description` and `og:description` meta tags. By default the value of\n * `description` prop is used.\n * @param {string} [props.socialTitle] The page title to use in\n * `twitter:title`, `og:title`, and `og:image:alt` tags. By default the value of\n * `title` prop is used. Also the `og:image:alt` tag is only injected if `image`\n * prop is present.\n *\n * @param {string} props.title: The page name to use in the `<title>` tag.\n * It is also used as the default value of `socialTitle` prop.\n *\n * @param {string} [props.url] The page URL to use in `og:url` tag.\n * By default the tag is not injected.\n */\nexport default function MetaTags({\n children,\n description,\n image,\n siteName,\n socialDescription,\n socialTitle,\n title,\n url,\n}) {\n const socTitle = socialTitle || title;\n const socDesc = socialDescription || description;\n\n const context = useMemo(() => ({\n description,\n image,\n siteName,\n socialDescription,\n socialTitle,\n title,\n url,\n }), [\n description,\n image,\n siteName,\n socialDescription,\n socialTitle,\n title,\n url,\n ]);\n\n return (\n <>\n <Helmet>\n {/* General tags. */}\n <title>\n {title}\n </title>\n <meta name=\"description\" content={description} />\n\n {/* Twitter cards. */}\n <meta name=\"twitter:card\" content=\"summary_large_image\" />\n <meta name=\"twitter:title\" content={socTitle} />\n <meta name=\"twitter:description\" content={socDesc} />\n { image ? <meta name=\"twitter:image\" content={image} /> : null }\n {\n siteName ? (\n <meta name=\"twitter:site\" content={`@${siteName}`} />\n ) : null\n }\n\n {/* Open Graph data. */}\n <meta name=\"og:title\" content={socTitle} />\n { image ? <meta name=\"og:image\" content={image} /> : null }\n { image ? <meta name=\"og:image:alt\" content={socTitle} /> : null }\n <meta name=\"og:description\" content={socDesc} />\n {\n siteName ? (<meta name=\"og:sitename\" content={siteName} />) : null\n }\n { url ? (<meta name=\"og:url\" content={url} />) : null }\n </Helmet>\n {\n children ? (\n <Context.Provider value={context}>\n {children}\n </Context.Provider>\n ) : null\n }\n </>\n );\n}\n\nMetaTags.Context = Context;\n\nMetaTags.defaultProps = {\n children: null,\n image: null,\n siteName: null,\n socialDescription: null,\n socialTitle: null,\n url: null,\n};\n\nMetaTags.propTypes = {\n children: PT.node,\n description: PT.string.isRequired,\n image: PT.string,\n siteName: PT.string,\n socialDescription: PT.string,\n socialTitle: PT.string,\n title: PT.string.isRequired,\n url: PT.string,\n};\n"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;;;AAEA,MAAMA,OAAO,gBAAG,IAAAC,oBAAA,GAAhB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACe,SAASC,QAAT,CAAkB;E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AAC,cAAX;QAA0B,OAAO,EAAEM;MAAnC,EAAH,GAAqD,IArB9D,eAsBE;QAAM,IAAI,EAAC,gBAAX;QAA4B,OAAO,EAAEC;MAArC,EAtBF,EAwBIN,QAAQ,gBAAI;QAAM,IAAI,EAAC,aAAX;QAAyB,OAAO,EAAEA;MAAlC,EAAJ,GAAsD,IAxBlE,EA0BII,GAAG,gBAAI;QAAM,IAAI,EAAC,QAAX;QAAoB,OAAO,EAAEA;MAA7B,EAAJ,GAA4C,IA1BnD;IAAA,EADF,EA8BIP,QAAQ,gBACN,qBAAC,OAAD,CAAS,QAAT;MAAkB,KAAK,EAAEU,OAAzB;MAAA,UACGV;IADH,EADM,GAIJ,IAlCR;EAAA,EADF;AAuCD;;AAEDD,QAAQ,CAACF,OAAT,GAAmBA,OAAnB;AAEAE,QAAQ,CAACa,YAAT,GAAwB;EACtBZ,QAAQ,EAAE,IADY;EAEtBE,KAAK,EAAE,IAFe;EAGtBC,QAAQ,EAAE,IAHY;EAItBC,iBAAiB,EAAE,IAJG;EAKtBC,WAAW,EAAE,IALS;EAMtBE,GAAG,EAAE;AANiB,CAAxB;AASAR,QAAQ,CAACc,SAAT,GAAqB;EACnBb,QAAQ,EAAEc,kBAAA,CAAGC,IADM;EAEnBd,WAAW,EAAEa,kBAAA,CAAGE,MAAH,CAAUC,UAFJ;EAGnBf,KAAK,EAAEY,kBAAA,CAAGE,MAHS;EAInBb,QAAQ,EAAEW,kBAAA,CAAGE,MAJM;EAKnBZ,iBAAiB,EAAEU,kBAAA,CAAGE,MALH;EAMnBX,WAAW,EAAES,kBAAA,CAAGE,MANG;EAOnBV,KAAK,EAAEQ,kBAAA,CAAGE,MAAH,CAAUC,UAPE;EAQnBV,GAAG,EAAEO,kBAAA,CAAGE;AARW,CAArB"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["BaseModal","children","onCancel","theme","containerRef","overlayRef","portal","setPortal","p","document","createElement","body","classList","add","appendChild","remove","removeChild","focusLast","elems","current","querySelectorAll","i","length","focus","activeElement","ReactDom","createPortal","overlay","e","key","node","container","event","stopPropagation","ThemedModal","baseTheme","propTypes","PT","func","themeType","isRequired","defaultProps","noop"],"sources":["../../../../../src/shared/components/Modal/index.jsx"],"sourcesContent":["/* global document */\n\nimport { noop } from 'lodash';\nimport {\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport ReactDom from 'react-dom';\nimport PT from 'prop-types';\nimport themed from '@dr.pogodin/react-themes';\n\nimport baseTheme from './base-theme.scss';\nimport './styles.scss';\n\n/**\n * The `<Modal>` component implements a simple themeable modal window, wrapped\n * into the default theme. `<BaseModal>` exposes the base non-themed component.\n * **Children:** Component children are rendered as the modal content.\n * @param {object} props Component properties. Beside props documented below,\n * [Other theming properties](https://www.npmjs.com/package/@dr.pogodin/react-themes#themed-component-properties) are supported as well.\n * @param {function} [props.onCancel] The callback to trigger when user\n * clicks outside the modal, or presses Escape. It is expected to hide the\n * modal.\n * @param {ModalTheme} [props.theme] _Ad hoc_ theme.\n */\nfunction BaseModal({\n children,\n onCancel,\n theme,\n}) {\n const containerRef = useRef();\n const overlayRef = useRef();\n const [portal, setPortal] = useState();\n\n useEffect(() => {\n const p = document.createElement('div');\n document.body.classList.add('scrolling-disabled-by-modal');\n document.body.appendChild(p);\n setPortal(p);\n return () => {\n document.body.classList.remove('scrolling-disabled-by-modal');\n document.body.removeChild(p);\n };\n }, []);\n\n const focusLast = useMemo(() => (\n <div\n onFocus={() => {\n const elems = containerRef.current.querySelectorAll('*');\n for (let i = elems.length - 1; i >= 0; --i) {\n elems[i].focus();\n if (document.activeElement === elems[i]) return;\n }\n overlayRef.current.focus();\n }}\n /* eslint-disable jsx-a11y/no-noninteractive-tabindex */\n tabIndex=\"0\"\n /* eslint-enable jsx-a11y/no-noninteractive-tabindex */\n />\n ), []);\n\n return portal ? ReactDom.createPortal(\n (\n <>\n {focusLast}\n <div\n aria-label=\"Cancel\"\n className={theme.overlay}\n onClick={() => onCancel()}\n onKeyDown={(e) => {\n if (e.key === 'Escape') onCancel();\n }}\n ref={(node) => {\n if (node && node !== overlayRef.current) {\n overlayRef.current = node;\n node.focus();\n }\n }}\n role=\"button\"\n tabIndex=\"0\"\n />\n <div\n aria-modal=\"true\"\n className={theme.container}\n onWheel={(event) => event.stopPropagation()}\n ref={containerRef}\n role=\"dialog\"\n >\n {children}\n </div>\n <div\n onFocus={() => {\n overlayRef.current.focus();\n }}\n /* eslint-disable jsx-a11y/no-noninteractive-tabindex */\n tabIndex=\"0\"\n /* eslint-enable jsx-a11y/no-noninteractive-tabindex */\n />\n {focusLast}\n </>\n ),\n portal,\n ) : null;\n}\n\nconst ThemedModal = themed(\n 'Modal',\n [\n 'container',\n 'overlay',\n ],\n baseTheme,\n)(BaseModal);\n\nBaseModal.propTypes = {\n onCancel: PT.func,\n children: PT.node,\n theme: ThemedModal.themeType.isRequired,\n};\n\nBaseModal.defaultProps = {\n onCancel: noop,\n children: null,\n};\n\nexport default ThemedModal;\n\n/* Non-themed version of the Modal. */\nexport { BaseModal };\n"],"mappings":";;;;;;;;;;AAEA;;AACA;;AAMA;;AACA;;AACA;;;;AAXA;;;;;;;;;AAgBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,SAAT,CAAmB;EACjBC,QADiB;EAEjBC,QAFiB;EAGjBC;AAHiB,CAAnB,EAIG;EACD,MAAMC,YAAY,GAAG,oBAArB;EACA,MAAMC,UAAU,GAAG,oBAAnB;EACA,MAAM,CAACC,MAAD,EAASC,SAAT,IAAsB,sBAA5B;EAEA,sBAAU,MAAM;IACd,MAAMC,CAAC,GAAGC,QAAQ,CAACC,aAAT,CAAuB,KAAvB,CAAV;IACAD,QAAQ,CAACE,IAAT,CAAcC,SAAd,CAAwBC,GAAxB,CAA4B,6BAA5B;IACAJ,QAAQ,CAACE,IAAT,CAAcG,WAAd,CAA0BN,CAA1B;IACAD,SAAS,CAACC,CAAD,CAAT;IACA,OAAO,MAAM;MACXC,QA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,KAAD,IAAWA,KAAK,CAACC,eAAN,EAHtB;MAIE,GAAG,EAAE7B,YAJP;MAKE,IAAI,EAAC,QALP;MAAA,UAOGH;IAPH,EAlBF,eA2BE;MACE,OAAO,EAAE,MAAM;QACbI,UAAU,CAACc,OAAX,CAAmBI,KAAnB;MACD;MACD;MAJF;MAKE,QAAQ,EAAC;MACT;;IANF,EA3BF,EAmCGN,SAnCH;EAAA,EAFY,EAwCdX,MAxCc,CAAH,GAyCT,IAzCJ;AA0CD;;AAED,MAAM4B,WAAW,GAAG,0BAClB,OADkB,EAElB,CACE,WADF,EAEE,SAFF,CAFkB,EAMlBC,SANkB,EAOlBnC,SAPkB,CAApB;AASAA,SAAS,CAACoC,SAAV,GAAsB;EACpBlC,QAAQ,EAAEmC,mBAAGC,IADO;EAEpBrC,QAAQ,EAAEoC,mBAAGP,IAFO;EAGpB3B,KAAK,EAAE+B,WAAW,CAACK,SAAZ,CAAsBC;AAHT,CAAtB;AAMAxC,SAAS,CAACyC,YAAV,GAAyB;EACvBvC,QAAQ,EAAEwC,YADa;EAEvBzC,QAAQ,EAAE;AAFa,CAAzB;eAKeiC,W;AAEf"}
1
+ {"version":3,"file":"index.js","names":["BaseModal","children","onCancel","theme","containerRef","useRef","overlayRef","portal","setPortal","useState","useEffect","p","document","createElement","body","classList","add","appendChild","remove","removeChild","focusLast","useMemo","elems","current","querySelectorAll","i","length","focus","activeElement","ReactDom","createPortal","overlay","e","key","node","container","event","stopPropagation","ThemedModal","themed","baseTheme","propTypes","PT","func","themeType","isRequired","defaultProps","noop"],"sources":["../../../../../src/shared/components/Modal/index.jsx"],"sourcesContent":["/* global document */\n\nimport { noop } from 'lodash';\nimport {\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport ReactDom from 'react-dom';\nimport PT from 'prop-types';\nimport themed from '@dr.pogodin/react-themes';\n\nimport baseTheme from './base-theme.scss';\nimport './styles.scss';\n\n/**\n * The `<Modal>` component implements a simple themeable modal window, wrapped\n * into the default theme. `<BaseModal>` exposes the base non-themed component.\n * **Children:** Component children are rendered as the modal content.\n * @param {object} props Component properties. Beside props documented below,\n * [Other theming properties](https://www.npmjs.com/package/@dr.pogodin/react-themes#themed-component-properties) are supported as well.\n * @param {function} [props.onCancel] The callback to trigger when user\n * clicks outside the modal, or presses Escape. It is expected to hide the\n * modal.\n * @param {ModalTheme} [props.theme] _Ad hoc_ theme.\n */\nfunction BaseModal({\n children,\n onCancel,\n theme,\n}) {\n const containerRef = useRef();\n const overlayRef = useRef();\n const [portal, setPortal] = useState();\n\n useEffect(() => {\n const p = document.createElement('div');\n document.body.classList.add('scrolling-disabled-by-modal');\n document.body.appendChild(p);\n setPortal(p);\n return () => {\n document.body.classList.remove('scrolling-disabled-by-modal');\n document.body.removeChild(p);\n };\n }, []);\n\n const focusLast = useMemo(() => (\n <div\n onFocus={() => {\n const elems = containerRef.current.querySelectorAll('*');\n for (let i = elems.length - 1; i >= 0; --i) {\n elems[i].focus();\n if (document.activeElement === elems[i]) return;\n }\n overlayRef.current.focus();\n }}\n /* eslint-disable jsx-a11y/no-noninteractive-tabindex */\n tabIndex=\"0\"\n /* eslint-enable jsx-a11y/no-noninteractive-tabindex */\n />\n ), []);\n\n return portal ? ReactDom.createPortal(\n (\n <>\n {focusLast}\n <div\n aria-label=\"Cancel\"\n className={theme.overlay}\n onClick={() => onCancel()}\n onKeyDown={(e) => {\n if (e.key === 'Escape') onCancel();\n }}\n ref={(node) => {\n if (node && node !== overlayRef.current) {\n overlayRef.current = node;\n node.focus();\n }\n }}\n role=\"button\"\n tabIndex=\"0\"\n />\n <div\n aria-modal=\"true\"\n className={theme.container}\n onWheel={(event) => event.stopPropagation()}\n ref={containerRef}\n role=\"dialog\"\n >\n {children}\n </div>\n <div\n onFocus={() => {\n overlayRef.current.focus();\n }}\n /* eslint-disable jsx-a11y/no-noninteractive-tabindex */\n tabIndex=\"0\"\n /* eslint-enable jsx-a11y/no-noninteractive-tabindex */\n />\n {focusLast}\n </>\n ),\n portal,\n ) : null;\n}\n\nconst ThemedModal = themed(\n 'Modal',\n [\n 'container',\n 'overlay',\n ],\n baseTheme,\n)(BaseModal);\n\nBaseModal.propTypes = {\n onCancel: PT.func,\n children: PT.node,\n theme: ThemedModal.themeType.isRequired,\n};\n\nBaseModal.defaultProps = {\n onCancel: noop,\n children: null,\n};\n\nexport default ThemedModal;\n\n/* Non-themed version of the Modal. */\nexport { BaseModal };\n"],"mappings":";;;;;;;;;;AAEA;;AACA;;AAMA;;AACA;;AACA;;;;AAXA;;;;;;;;;AAgBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,SAAT,CAAmB;EACjBC,QADiB;EAEjBC,QAFiB;EAGjBC;AAHiB,CAAnB,EAIG;EACD,MAAMC,YAAY,GAAG,IAAAC,aAAA,GAArB;EACA,MAAMC,UAAU,GAAG,IAAAD,aAAA,GAAnB;EACA,MAAM,CAACE,MAAD,EAASC,SAAT,IAAsB,IAAAC,eAAA,GAA5B;EAEA,IAAAC,gBAAA,EAAU,MAAM;IACd,MAAMC,CAAC,GAAGC,QAAQ,CAACC,aAAT,CAAuB,KAAvB,CAAV;IACAD,QAAQ,CAACE,IAAT,CAAcC,SAAd,CAAwBC,GAAxB,CAA4B,6BAA5B;IACAJ,QAAQ,CAACE,IAAT,CAAcG,WAAd,CAA0BN,CAA1B;IACAH,SAAS,CAACG,CAAD,CAAT;IACA,OAAO,MAAM;MACXC,QAAQ,CAACE,IAAT,CAAcC,SAAd,CAAwBG,MAAxB,CAA+B,6BAA/B;MACAN,QAAQ,CAACE,IAAT,CAAcK,WAAd,CAA0BR,CAA1B;IACD,CAHD;EAID,CATD,EASG,EATH;EAWA,MAAMS,SAAS,GAAG,IAAAC,cAAA,EAAQ,mBACxB;IACE,OAAO,EAAE,MAAM;MACb,MAAMC,KAAK,GAAGlB,YAAY,CAACmB,OAAb,CAAqBC,gBAArB,CAAsC,GAAtC,CAAd;;MACA,KAAK,IAAIC,CAAC,G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;AA0CD;;AAED,MAAM+B,WAAW,GAAG,IAAAC,oBAAA,EAClB,OADkB,EAElB,CACE,WADF,EAEE,SAFF,CAFkB,EAMlBC,SANkB,EAOlBxC,SAPkB,CAApB;AASAA,SAAS,CAACyC,SAAV,GAAsB;EACpBvC,QAAQ,EAAEwC,kBAAA,CAAGC,IADO;EAEpB1C,QAAQ,EAAEyC,kBAAA,CAAGR,IAFO;EAGpB/B,KAAK,EAAEmC,WAAW,CAACM,SAAZ,CAAsBC;AAHT,CAAtB;AAMA7C,SAAS,CAAC8C,YAAV,GAAyB;EACvB5C,QAAQ,EAAE6C,YADa;EAEvB9C,QAAQ,EAAE;AAFa,CAAzB;eAKeqC,W;AAEf"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["PageLayout","children","leftSidePanelContent","rightSidePanelContent","theme","container","sidePanel","leftSidePanel","join","mainPanel","rightSidePanel","ThemedPageLayout","baseTheme","propTypes","PT","node","themeType","isRequired","defaultProps"],"sources":["../../../../../src/shared/components/PageLayout/index.jsx"],"sourcesContent":["import PT from 'prop-types';\n\nimport { themed } from 'utils';\n\nimport baseTheme from './base-theme.scss';\n\n/**\n * Simple and themeable page layout. It keeps the main content centered in\n * a column of limited width, which fills entire viewport on small screens\n * (under `$screen-md = 1024px` size). At larger screens the column keeps\n * `$screen-md` size, and it is centered at the page, surrounded by side\n * panels, where additional content can be displayed.\n *\n * **Children:** Component children are rendered as the content of main panel.\n * @param {object} [props] Component properties.\n * @param {Node} [props.leftSidePanelContent] The content for left side panel.\n * @param {Node} [props.rightSidePanelContent] The content for right side panel.\n * @param {PageLayoutTheme} [props.theme] _Ad hoc_ theme.\n * @param {...any} [props....]\n * [Other theming properties](https://www.npmjs.com/package/@dr.pogodin/react-themes#themed-component-properties)\n */\nfunction PageLayout({\n children,\n leftSidePanelContent,\n rightSidePanelContent,\n theme,\n}) {\n return (\n <div className={theme.container}>\n <div className={[theme.sidePanel, theme.leftSidePanel].join(' ')}>\n {leftSidePanelContent}\n </div>\n <div className={theme.mainPanel}>\n {children}\n </div>\n <div className={[theme.sidePanel, theme.rightSidePanel].join(' ')}>\n {rightSidePanelContent}\n </div>\n </div>\n );\n}\n\nconst ThemedPageLayout = themed('PageLayout', [\n 'container',\n 'leftSidePanel',\n 'mainPanel',\n 'rightSidePanel',\n 'sidePanel',\n], baseTheme)(PageLayout);\n\nPageLayout.propTypes = {\n children: PT.node,\n leftSidePanelContent: PT.node,\n rightSidePanelContent: PT.node,\n theme: ThemedPageLayout.themeType.isRequired,\n};\n\nPageLayout.defaultProps = {\n children: null,\n leftSidePanelContent: null,\n rightSidePanelContent: null,\n};\n\nexport default ThemedPageLayout;\n"],"mappings":";;;;;;;;;AAAA;;AAEA;;;;;;;;;;;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASA,UAAT,CAAoB;EAClBC,QADkB;EAElBC,oBAFkB;EAGlBC,qBAHkB;EAIlBC;AAJkB,CAApB,EAKG;EACD,oBACE;IAAK,SAAS,EAAEA,KAAK,CAACC,SAAtB;IAAA,wBACE;MAAK,SAAS,EAAE,CAACD,KAAK,CAACE,SAAP,EAAkBF,KAAK,CAACG,aAAxB,EAAuCC,IAAvC,CAA4C,GAA5C,CAAhB;MAAA,UACGN;IADH,EADF,eAIE;MAAK,SAAS,EAAEE,KAAK,CAACK,SAAtB;MAAA,UACGR;IADH,EAJF,eAOE;MAAK,SAAS,EAAE,CAACG,KAAK,CAACE,SAAP,EAAkBF,KAAK,CAACM,cAAxB,EAAwCF,IAAxC,CAA6C,GAA7C,CAAhB;MAAA,UACGL;IADH,EAPF;EAAA,EADF;AAaD;;AAED,MAAMQ,gBAAgB,GAAG,mBAAO,YAAP,EAAqB,CAC5C,WAD4C,EAE5C,eAF4C,EAG5C,WAH4C,EAI5C,gBAJ4C,EAK5C,WAL4C,CAArB,EAMtBC,SANsB,EAMXZ,UANW,CAAzB;AAQAA,UAAU,CAACa,SAAX,GAAuB;EACrBZ,QAAQ,EAAEa,mBAAGC,IADQ;EAErBb,oBAAoB,EAAEY,mBAAGC,IAFJ;EAGrBZ,qBAAqB,EAAEW,mBAAGC,IAHL;EAIrBX,KAAK,EAAEO,gBAAgB,CAACK,SAAjB,CAA2BC;AAJb,CAAvB;AAOAjB,UAAU,CAACkB,YAAX,GAA0B;EACxBjB,QAAQ,EAAE,IADc;EAExBC,oBAAoB,EAAE,IAFE;EAGxBC,qBAAqB,EAAE;AAHC,CAA1B;eAMeQ,gB"}
1
+ {"version":3,"file":"index.js","names":["PageLayout","children","leftSidePanelContent","rightSidePanelContent","theme","container","sidePanel","leftSidePanel","join","mainPanel","rightSidePanel","ThemedPageLayout","themed","baseTheme","propTypes","PT","node","themeType","isRequired","defaultProps"],"sources":["../../../../../src/shared/components/PageLayout/index.jsx"],"sourcesContent":["import PT from 'prop-types';\n\nimport { themed } from 'utils';\n\nimport baseTheme from './base-theme.scss';\n\n/**\n * Simple and themeable page layout. It keeps the main content centered in\n * a column of limited width, which fills entire viewport on small screens\n * (under `$screen-md = 1024px` size). At larger screens the column keeps\n * `$screen-md` size, and it is centered at the page, surrounded by side\n * panels, where additional content can be displayed.\n *\n * **Children:** Component children are rendered as the content of main panel.\n * @param {object} [props] Component properties.\n * @param {Node} [props.leftSidePanelContent] The content for left side panel.\n * @param {Node} [props.rightSidePanelContent] The content for right side panel.\n * @param {PageLayoutTheme} [props.theme] _Ad hoc_ theme.\n * @param {...any} [props....]\n * [Other theming properties](https://www.npmjs.com/package/@dr.pogodin/react-themes#themed-component-properties)\n */\nfunction PageLayout({\n children,\n leftSidePanelContent,\n rightSidePanelContent,\n theme,\n}) {\n return (\n <div className={theme.container}>\n <div className={[theme.sidePanel, theme.leftSidePanel].join(' ')}>\n {leftSidePanelContent}\n </div>\n <div className={theme.mainPanel}>\n {children}\n </div>\n <div className={[theme.sidePanel, theme.rightSidePanel].join(' ')}>\n {rightSidePanelContent}\n </div>\n </div>\n );\n}\n\nconst ThemedPageLayout = themed('PageLayout', [\n 'container',\n 'leftSidePanel',\n 'mainPanel',\n 'rightSidePanel',\n 'sidePanel',\n], baseTheme)(PageLayout);\n\nPageLayout.propTypes = {\n children: PT.node,\n leftSidePanelContent: PT.node,\n rightSidePanelContent: PT.node,\n theme: ThemedPageLayout.themeType.isRequired,\n};\n\nPageLayout.defaultProps = {\n children: null,\n leftSidePanelContent: null,\n rightSidePanelContent: null,\n};\n\nexport default ThemedPageLayout;\n"],"mappings":";;;;;;;;;AAAA;;AAEA;;;;;;;;;;;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASA,UAAT,CAAoB;EAClBC,QADkB;EAElBC,oBAFkB;EAGlBC,qBAHkB;EAIlBC;AAJkB,CAApB,EAKG;EACD,oBACE;IAAK,SAAS,EAAEA,KAAK,CAACC,SAAtB;IAAA,wBACE;MAAK,SAAS,EAAE,CAACD,KAAK,CAACE,SAAP,EAAkBF,KAAK,CAACG,aAAxB,EAAuCC,IAAvC,CAA4C,GAA5C,CAAhB;MAAA,UACGN;IADH,EADF,eAIE;MAAK,SAAS,EAAEE,KAAK,CAACK,SAAtB;MAAA,UACGR;IADH,EAJF,eAOE;MAAK,SAAS,EAAE,CAACG,KAAK,CAACE,SAAP,EAAkBF,KAAK,CAACM,cAAxB,EAAwCF,IAAxC,CAA6C,GAA7C,CAAhB;MAAA,UACGL;IADH,EAPF;EAAA,EADF;AAaD;;AAED,MAAMQ,gBAAgB,GAAG,IAAAC,aAAA,EAAO,YAAP,EAAqB,CAC5C,WAD4C,EAE5C,eAF4C,EAG5C,WAH4C,EAI5C,gBAJ4C,EAK5C,WAL4C,CAArB,EAMtBC,SANsB,EAMXb,UANW,CAAzB;AAQAA,UAAU,CAACc,SAAX,GAAuB;EACrBb,QAAQ,EAAEc,kBAAA,CAAGC,IADQ;EAErBd,oBAAoB,EAAEa,kBAAA,CAAGC,IAFJ;EAGrBb,qBAAqB,EAAEY,kBAAA,CAAGC,IAHL;EAIrBZ,KAAK,EAAEO,gBAAgB,CAACM,SAAjB,CAA2BC;AAJb,CAAvB;AAOAlB,UAAU,CAACmB,YAAX,GAA0B;EACxBlB,QAAQ,EAAE,IADc;EAExBC,oBAAoB,EAAE,IAFE;EAGxBC,qBAAqB,EAAE;AAHC,CAA1B;eAMeQ,gB"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["ScalableRect","children","className","ratio","aux","split","paddingBottom","rect","defaultProps","propTypes","PT","node","string"],"sources":["../../../../../src/shared/components/ScalableRect/index.jsx"],"sourcesContent":["import PT from 'prop-types';\n\nimport './style.scss';\n\n/**\n * The `<ScalableRect>` component implements container keeping given aspect\n * ratio, while its width is altered.\n *\n * **Children:** Component children are rendered as the component's content.\n * @param {object} props\n * @param {string} [props.className] CSS class for component container.\n * @param {string} [props.ratio=1:1] Ratio of the rendered rectangle sides,\n * in `W:H` form.\n */\nexport default function ScalableRect({ children, className, ratio }) {\n const aux = ratio.split(':');\n const paddingBottom = `${(100 * aux[1]) / aux[0]}%`;\n\n /* NOTE: In case the following code looks strange to you, mind that we want to\n * allow the user to set custom styles on this component. If user passes in a\n * \"className\" prop (possibly \"styleName\", but that one is converted to\n * \"className\" by Babel just before being passed into this component), it\n * should not interfere with the sizing behavior, thus we need an extra <div>\n * level in this component; however, if user does not need a custom styling,\n * we can save one level of HTML code, so we do it. */\n const rect = (\n <div\n style={{ paddingBottom }}\n styleName=\"container\"\n >\n <div styleName=\"wrapper\">\n {children}\n </div>\n </div>\n );\n return className ? (\n <div className={className}>\n {rect}\n </div>\n ) : rect;\n}\n\nScalableRect.defaultProps = {\n children: null,\n className: null,\n ratio: '1:1',\n};\n\nScalableRect.propTypes = {\n children: PT.node,\n className: PT.string,\n ratio: PT.string,\n};\n"],"mappings":";;;;;;;;;AAAA;;;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,YAAT,CAAsB;EAAEC,QAAF;EAAYC,SAAZ;EAAuBC;AAAvB,CAAtB,EAAsD;EACnE,MAAMC,GAAG,GAAGD,KAAK,CAACE,KAAN,CAAY,GAAZ,CAAZ;EACA,MAAMC,aAAa,GAAI,GAAG,MAAMF,GAAG,CAAC,CAAD,CAAV,GAAiBA,GAAG,CAAC,CAAD,CAAI,GAAjD;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;;EACE,MAAMG,IAAI,gBACR;IACE,KAAK,EAAE;MAAED;IAAF,CADT;IAEE,SAAS,EAAC,yFAFZ;IAAA,uBAIE;MAAK,SAAS,EAAC,uFAAf;MAAA,UACGL;IADH;EAJF,EADF;EAUA,OAAOC,SAAS,gBACd;IAAK,SAAS,EAAEA,SAAhB;IAAA,UACGK;EADH,EADc,GAIZA,IAJJ;AAKD;;AAEDP,YAAY,CAACQ,YAAb,GAA4B;EAC1BP,QAAQ,EAAE,IADgB;EAE1BC,SAAS,EAAE,IAFe;EAG1BC,KAAK,EAAE;AAHmB,CAA5B;AAMAH,YAAY,CAACS,SAAb,GAAyB;EACvBR,QAAQ,EAAES,mBAAGC,IADU;EAEvBT,SAAS,EAAEQ,mBAAGE,MAFS;EAGvBT,KAAK,EAAEO,mBAAGE;AAHa,CAAzB"}
1
+ {"version":3,"file":"index.js","names":["ScalableRect","children","className","ratio","aux","split","paddingBottom","rect","defaultProps","propTypes","PT","node","string"],"sources":["../../../../../src/shared/components/ScalableRect/index.jsx"],"sourcesContent":["import PT from 'prop-types';\n\nimport './style.scss';\n\n/**\n * The `<ScalableRect>` component implements container keeping given aspect\n * ratio, while its width is altered.\n *\n * **Children:** Component children are rendered as the component's content.\n * @param {object} props\n * @param {string} [props.className] CSS class for component container.\n * @param {string} [props.ratio=1:1] Ratio of the rendered rectangle sides,\n * in `W:H` form.\n */\nexport default function ScalableRect({ children, className, ratio }) {\n const aux = ratio.split(':');\n const paddingBottom = `${(100 * aux[1]) / aux[0]}%`;\n\n /* NOTE: In case the following code looks strange to you, mind that we want to\n * allow the user to set custom styles on this component. If user passes in a\n * \"className\" prop (possibly \"styleName\", but that one is converted to\n * \"className\" by Babel just before being passed into this component), it\n * should not interfere with the sizing behavior, thus we need an extra <div>\n * level in this component; however, if user does not need a custom styling,\n * we can save one level of HTML code, so we do it. */\n const rect = (\n <div\n style={{ paddingBottom }}\n styleName=\"container\"\n >\n <div styleName=\"wrapper\">\n {children}\n </div>\n </div>\n );\n return className ? (\n <div className={className}>\n {rect}\n </div>\n ) : rect;\n}\n\nScalableRect.defaultProps = {\n children: null,\n className: null,\n ratio: '1:1',\n};\n\nScalableRect.propTypes = {\n children: PT.node,\n className: PT.string,\n ratio: PT.string,\n};\n"],"mappings":";;;;;;;;;AAAA;;;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,YAAT,CAAsB;EAAEC,QAAF;EAAYC,SAAZ;EAAuBC;AAAvB,CAAtB,EAAsD;EACnE,MAAMC,GAAG,GAAGD,KAAK,CAACE,KAAN,CAAY,GAAZ,CAAZ;EACA,MAAMC,aAAa,GAAI,GAAG,MAAMF,GAAG,CAAC,CAAD,CAAV,GAAiBA,GAAG,CAAC,CAAD,CAAI,GAAjD;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;;EACE,MAAMG,IAAI,gBACR;IACE,KAAK,EAAE;MAAED;IAAF,CADT;IAEE,SAAS,EAAC,yFAFZ;IAAA,uBAIE;MAAK,SAAS,EAAC,uFAAf;MAAA,UACGL;IADH;EAJF,EADF;EAUA,OAAOC,SAAS,gBACd;IAAK,SAAS,EAAEA,SAAhB;IAAA,UACGK;EADH,EADc,GAIZA,IAJJ;AAKD;;AAEDP,YAAY,CAACQ,YAAb,GAA4B;EAC1BP,QAAQ,EAAE,IADgB;EAE1BC,SAAS,EAAE,IAFe;EAG1BC,KAAK,EAAE;AAHmB,CAA5B;AAMAH,YAAY,CAACS,SAAb,GAAyB;EACvBR,QAAQ,EAAES,kBAAA,CAAGC,IADU;EAEvBT,SAAS,EAAEQ,kBAAA,CAAGE,MAFS;EAGvBT,KAAK,EAAEO,kBAAA,CAAGE;AAHa,CAAzB"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["Throbber","theme","container","circle","defaultProps","propTypes","PT","shape","string","defaultTheme"],"sources":["../../../../../src/shared/components/Throbber/index.jsx"],"sourcesContent":["import PT from 'prop-types';\nimport themed from '@dr.pogodin/react-themes';\n\nimport defaultTheme from './theme.scss';\n\n/**\n * Throbber is an \"action in progress\" indicator, which renders\n * three bouncing circles as a simple pending activity indicator,\n * and can be further themed to a certain degree.\n * @param {object} [props] Component properties.\n * @param {ThrobberTheme} [props.theme] _Ad hoc_ theme.\n * @param {...any} [props....]\n * [Other theming properties](https://www.npmjs.com/package/@dr.pogodin/react-themes#themed-component-properties)\n */\nfunction Throbber({\n theme,\n}) {\n return (\n <div className={theme.container} styleName=\"container\">\n <div className={theme.circle} styleName=\"circle\" />\n <div className={theme.circle} styleName=\"circle\" />\n <div className={theme.circle} styleName=\"circle\" />\n </div>\n );\n}\n\nThrobber.defaultProps = {\n theme: {},\n};\n\nThrobber.propTypes = {\n theme: PT.shape({\n container: PT.string,\n circle: PT.string,\n }),\n};\n\nexport default themed('Throbber', [\n 'circle',\n 'container',\n], defaultTheme)(Throbber);\n"],"mappings":";;;;;;;;;AAAA;;AACA;;;;;;;;;;;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASA,QAAT,CAAkB;EAChBC;AADgB,CAAlB,EAEG;EACD,oBACE;IAAK,SAAS,GAAEA,KAAK,CAACC,SAAR,GAAED,KAAK,CAACC,SAAR,oGAAd;IAAA,wBACE;MAAK,SAAS,GAAED,KAAK,CAACE,MAAR,GAAEF,KAAK,CAACE,MAAR;IAAd,EADF,eAEE;MAAK,SAAS,GAAEF,KAAK,CAACE,MAAR,GAAEF,KAAK,CAACE,MAAR;IAAd,EAFF,eAGE;MAAK,SAAS,GAAEF,KAAK,CAACE,MAAR,GAAEF,KAAK,CAACE,MAAR;IAAd,EAHF;EAAA,EADF;AAOD;;AAEDH,QAAQ,CAACI,YAAT,GAAwB;EACtBH,KAAK,EAAE;AADe,CAAxB;AAIAD,QAAQ,CAACK,SAAT,GAAqB;EACnBJ,KAAK,EAAEK,mBAAGC,KAAH,CAAS;IACdL,SAAS,EAAEI,mBAAGE,MADA;IAEdL,MAAM,EAAEG,mBAAGE;EAFG,CAAT;AADY,CAArB;;eAOe,0BAAO,UAAP,EAAmB,CAChC,QADgC,EAEhC,WAFgC,CAAnB,EAGZC,YAHY,EAGET,QAHF,C"}
1
+ {"version":3,"file":"index.js","names":["Throbber","theme","container","circle","defaultProps","propTypes","PT","shape","string","themed","defaultTheme"],"sources":["../../../../../src/shared/components/Throbber/index.jsx"],"sourcesContent":["import PT from 'prop-types';\nimport themed from '@dr.pogodin/react-themes';\n\nimport defaultTheme from './theme.scss';\n\n/**\n * Throbber is an \"action in progress\" indicator, which renders\n * three bouncing circles as a simple pending activity indicator,\n * and can be further themed to a certain degree.\n * @param {object} [props] Component properties.\n * @param {ThrobberTheme} [props.theme] _Ad hoc_ theme.\n * @param {...any} [props....]\n * [Other theming properties](https://www.npmjs.com/package/@dr.pogodin/react-themes#themed-component-properties)\n */\nfunction Throbber({\n theme,\n}) {\n return (\n <div className={theme.container} styleName=\"container\">\n <div className={theme.circle} styleName=\"circle\" />\n <div className={theme.circle} styleName=\"circle\" />\n <div className={theme.circle} styleName=\"circle\" />\n </div>\n );\n}\n\nThrobber.defaultProps = {\n theme: {},\n};\n\nThrobber.propTypes = {\n theme: PT.shape({\n container: PT.string,\n circle: PT.string,\n }),\n};\n\nexport default themed('Throbber', [\n 'circle',\n 'container',\n], defaultTheme)(Throbber);\n"],"mappings":";;;;;;;;;AAAA;;AACA;;;;;;;;;;;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASA,QAAT,CAAkB;EAChBC;AADgB,CAAlB,EAEG;EACD,oBACE;IAAK,SAAS,GAAEA,KAAK,CAACC,SAAR,GAAED,KAAK,CAACC,SAAR,oGAAd;IAAA,wBACE;MAAK,SAAS,GAAED,KAAK,CAACE,MAAR,GAAEF,KAAK,CAACE,MAAR;IAAd,EADF,eAEE;MAAK,SAAS,GAAEF,KAAK,CAACE,MAAR,GAAEF,KAAK,CAACE,MAAR;IAAd,EAFF,eAGE;MAAK,SAAS,GAAEF,KAAK,CAACE,MAAR,GAAEF,KAAK,CAACE,MAAR;IAAd,EAHF;EAAA,EADF;AAOD;;AAEDH,QAAQ,CAACI,YAAT,GAAwB;EACtBH,KAAK,EAAE;AADe,CAAxB;AAIAD,QAAQ,CAACK,SAAT,GAAqB;EACnBJ,KAAK,EAAEK,kBAAA,CAAGC,KAAH,CAAS;IACdL,SAAS,EAAEI,kBAAA,CAAGE,MADA;IAEdL,MAAM,EAAEG,kBAAA,CAAGE;EAFG,CAAT;AADY,CAArB;;eAOe,IAAAC,oBAAA,EAAO,UAAP,EAAmB,CAChC,QADgC,EAEhC,WAFgC,CAAnB,EAGZC,YAHY,EAGEV,QAHF,C"}
@@ -1 +1 @@
1
- {"version":3,"file":"Tooltip.js","names":["PLACEMENTS","ABOVE_CURSOR","ABOVE_ELEMENT","BELOW_CURSOR","BELOW_ELEMENT","ARROW_STYLE_DOWN","join","ARROW_STYLE_UP","createTooltipComponents","theme","arrow","document","createElement","setAttribute","content","container","appendChild","body","calcTooltipRects","tooltip","getBoundingClientRect","calcViewportRect","pageXOffset","pageYOffset","window","documentElement","clientHeight","clientWidth","left","right","top","bottom","calcPositionAboveXY","x","y","tooltipRects","arrowX","width","arrowY","height","containerX","containerY","baseArrowStyle","setComponentPositions","pageX","pageY","placement","element","viewportRect","pos","Math","max","maxX","min","containerStyle","arrowStyle","Tooltip","children","ref","components","setComponents","pointTo","removeChild","propTypes","PT","node","shape","isRequired","defaultProps"],"sources":["../../../../../src/shared/components/WithTooltip/Tooltip.jsx"],"sourcesContent":["/**\n * The actual tooltip component. It is rendered outside the regular document\n * hierarchy, and with sub-components managed without React to achieve the best\n * performance during animation.\n */\n/* global document, window */\n\nimport {\n forwardRef,\n useEffect,\n useImperativeHandle,\n useState,\n} from 'react';\nimport { createPortal } from 'react-dom';\n\nimport PT from 'prop-types';\n\n/* Valid placements of the rendered tooltip. They will be overriden when\n * necessary to fit the tooltip within the viewport. */\nexport const PLACEMENTS = {\n ABOVE_CURSOR: 'ABOVE_CURSOR',\n ABOVE_ELEMENT: 'ABOVE_ELEMENT',\n BELOW_CURSOR: 'BELOW_CURSOR',\n BELOW_ELEMENT: 'BELOW_ELEMENT',\n};\n\nconst ARROW_STYLE_DOWN = [\n 'border-bottom-color:transparent',\n 'border-left-color:transparent',\n 'border-right-color:transparent',\n].join(';');\n\nconst ARROW_STYLE_UP = [\n 'border-top-color:transparent',\n 'border-left-color:transparent',\n 'border-right-color:transparent',\n].join(';');\n\n/**\n * Creates tooltip components.\n * @ignore\n * @param {object} theme Themes to use for tooltip container, arrow,\n * and content.\n * @return {object} Object with DOM references to the container components:\n * container, arrow, content.\n */\nfunction createTooltipComponents(theme) {\n const arrow = document.createElement('div');\n if (theme.arrow) arrow.setAttribute('class', theme.arrow);\n\n const content = document.createElement('div');\n if (theme.content) content.setAttribute('class', theme.content);\n\n const container = document.createElement('div');\n if (theme.container) container.setAttribute('class', theme.container);\n\n container.appendChild(arrow);\n container.appendChild(content);\n document.body.appendChild(container);\n\n return { container, arrow, content };\n}\n\n/**\n * Generates bounding client rectangles for tooltip components.\n * @ignore\n * @param {object} tooltip DOM references to the tooltip components.\n * @param {object} tooltip.arrow\n * @param {object} tooltip.container\n * @return {{ arrow: object, container}} Object holding tooltip rectangles in\n * two fields.\n */\nfunction calcTooltipRects(tooltip) {\n return {\n arrow: tooltip.arrow.getBoundingClientRect(),\n container: tooltip.container.getBoundingClientRect(),\n };\n}\n\n/**\n * Calculates the document viewport size.\n * @ignore\n * @return {{x, y, width, height}}\n */\nfunction calcViewportRect() {\n const { pageXOffset, pageYOffset } = window;\n const { documentElement: { clientHeight, clientWidth } } = document;\n return {\n left: pageXOffset,\n right: pageXOffset + clientWidth,\n top: pageYOffset,\n bottom: pageYOffset + clientHeight,\n };\n}\n\n/**\n * Calculates tooltip and arrow positions for the placement just above\n * the cursor.\n * @ignore\n * @param {number} x Cursor page-x position.\n * @param {number} y Cursor page-y position.\n * @param {object} tooltipRects Bounding client rectangles of tooltip parts.\n * @param {object} tooltipRects.arrow\n * @param {object} tooltipRects.container\n * @return {object} Contains the following fields:\n * - {number} arrowX\n * - {number} arrowY\n * - {number} containerX\n * - {number} containerY\n * - {string} baseArrowStyle\n */\nfunction calcPositionAboveXY(x, y, tooltipRects) {\n const { arrow, container } = tooltipRects;\n return {\n arrowX: 0.5 * (container.width - arrow.width),\n arrowY: container.height,\n containerX: x - container.width / 2,\n containerY: y - container.height - arrow.height / 1.5,\n\n // TODO: Instead of already setting the base style here, we should\n // introduce a set of constants for arrow directions, which will help\n // to do checks dependant on the arrow direction.\n baseArrowStyle: ARROW_STYLE_DOWN,\n };\n}\n\n/*\nconst HIT = {\n NONE: false,\n LEFT: 'LEFT',\n RIGHT: 'RIGHT',\n TOP: 'TOP',\n BOTTOM: 'BOTTOM',\n};\n*/\n\n/**\n * Checks whether\n * @param {object} pos\n * @param {object} tooltipRects\n * @param {object} viewportRect\n * @return {HIT}\n */\n/*\nfunction checkViewportFit(pos, tooltipRects, viewportRect) {\n const { containerX, containerY } = pos;\n if (containerX < viewportRect.left + 6) return HIT.LEFT;\n if (containerX > viewportRect.right - 6) return HIT.RIGHT;\n return HIT.NONE;\n}\n*/\n\n/**\n * Shifts tooltip horizontally to fit into the viewport, while keeping\n * the arrow pointed to the XY point.\n * @param {number} x\n * @param {number} y\n * @param {object} pos\n * @param {number} pageXOffset\n * @param {number} pageXWidth\n */\n/*\nfunction xPageFitCorrection(x, y, pos, pageXOffset, pageXWidth) {\n if (pos.containerX < pageXOffset + 6) {\n pos.containerX = pageXOffset + 6;\n pos.arrowX = Math.max(6, pageX - containerX - arrowRect.width / 2);\n } else {\n const maxX = pageXOffset + docRect.width - containerRect.width - 6;\n if (containerX > maxX) {\n containerX = maxX;\n arrowX = Math.min(\n containerRect.width - 6,\n pageX - containerX - arrowRect.width / 2,\n );\n }\n }\n}\n*/\n\n/**\n * Sets positions of tooltip components to point the tooltip to the specified\n * page point.\n * @ignore\n * @param {number} pageX\n * @param {number} pageY\n * @param {PLACEMENTS} placement\n * @param {object} element DOM reference to the element wrapped by the tooltip.\n * @param {object} tooltip\n * @param {object} tooltip.arrow DOM reference to the tooltip arrow.\n * @param {object} tooltip.container DOM reference to the tooltip container.\n */\nfunction setComponentPositions(\n pageX,\n pageY,\n placement,\n element,\n tooltip,\n) {\n const tooltipRects = calcTooltipRects(tooltip);\n const viewportRect = calcViewportRect();\n\n /* Default container coords: tooltip at the top. */\n const pos = calcPositionAboveXY(pageX, pageY, tooltipRects);\n\n if (pos.containerX < viewportRect.left + 6) {\n pos.containerX = viewportRect.left + 6;\n pos.arrowX = Math.max(\n 6,\n pageX - pos.containerX - tooltipRects.arrow.width / 2,\n );\n } else {\n const maxX = viewportRect.right - 6 - tooltipRects.container.width;\n if (pos.containerX > maxX) {\n pos.containerX = maxX;\n pos.arrowX = Math.min(\n tooltipRects.container.width - 6,\n pageX - pos.containerX - tooltipRects.arrow.width / 2,\n );\n }\n }\n\n /* If tooltip has not enough space on top - make it bottom tooltip. */\n if (pos.containerY < viewportRect.top + 6) {\n pos.containerY += tooltipRects.container.height\n + 2 * tooltipRects.arrow.height;\n pos.arrowY -= tooltipRects.container.height\n + tooltipRects.arrow.height;\n pos.baseArrowStyle = ARROW_STYLE_UP;\n }\n\n const containerStyle = `left:${pos.containerX}px;top:${pos.containerY}px`;\n tooltip.container.setAttribute('style', containerStyle);\n\n const arrowStyle = `${pos.baseArrowStyle};left:${pos.arrowX}px;top:${pos.arrowY}px`;\n tooltip.arrow.setAttribute('style', arrowStyle);\n}\n\n/* The Tooltip component itself. */\nconst Tooltip = forwardRef(({ children, theme }, ref) => {\n const [components, setComponents] = useState(null);\n\n const pointTo = (pageX, pageY, placement, element) => components\n && setComponentPositions(pageX, pageY, placement, element, components);\n useImperativeHandle(ref, () => ({ pointTo }));\n\n /* Inits and destroys tooltip components. */\n useEffect(() => {\n const x = createTooltipComponents(theme);\n setComponents(x);\n return () => {\n document.body.removeChild(x.container);\n setComponents(null);\n };\n }, [theme]);\n\n return components ? createPortal(children, components.content) : null;\n});\n\nTooltip.propTypes = {\n children: PT.node,\n theme: PT.shape().isRequired,\n};\n\nTooltip.defaultProps = {\n children: null,\n};\n\nexport default Tooltip;\n"],"mappings":";;;;;;;;;AAOA;;AAMA;;AAEA;;AAfA;AACA;AACA;AACA;AACA;;AACA;;AAYA;AACA;AACO,MAAMA,UAAU,GAAG;EACxBC,YAAY,EAAE,cADU;EAExBC,aAAa,EAAE,eAFS;EAGxBC,YAAY,EAAE,cAHU;EAIxBC,aAAa,EAAE;AAJS,CAAnB;;AAOP,MAAMC,gBAAgB,GAAG,CACvB,iCADuB,EAEvB,+BAFuB,EAGvB,gCAHuB,EAIvBC,IAJuB,CAIlB,GAJkB,CAAzB;AAMA,MAAMC,cAAc,GAAG,CACrB,8BADqB,EAErB,+BAFqB,EAGrB,gCAHqB,EAIrBD,IAJqB,CAIhB,GAJgB,CAAvB;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASE,uBAAT,CAAiCC,KAAjC,EAAwC;EACtC,MAAMC,KAAK,GAAGC,QAAQ,CAACC,aAAT,CAAuB,KAAvB,CAAd;EACA,IAAIH,KAAK,CAACC,KAAV,EAAiBA,KAAK,CAACG,YAAN,CAAmB,OAAnB,EAA4BJ,KAAK,CAACC,KAAlC;EAEjB,MAAMI,OAAO,GAAGH,QAAQ,CAACC,aAAT,CAAuB,KAAvB,CAAhB;EACA,IAAIH,KAAK,CAACK,OAAV,EAAmBA,OAAO,CAACD,YAAR,CAAqB,OAArB,EAA8BJ,KAAK,CAACK,OAApC;EAEnB,MAAMC,SAAS,GAAGJ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AO,GAAG,CAACjB,KAAD,EAAQC,KAAR,EAAeC,SAAf,EAA0BC,OAA1B,KAAsCY,UAAU,IAC3DhB,qBAAqB,CAACC,KAAD,EAAQC,KAAR,EAAeC,SAAf,EAA0BC,OAA1B,EAAmCY,UAAnC,CAD1B;;EAEA,gCAAoBD,GAApB,EAAyB,OAAO;IAAEG;EAAF,CAAP,CAAzB;EAEA;;EACA,sBAAU,MAAM;IACd,MAAM5B,CAAC,GAAGzB,uBAAuB,CAACC,KAAD,CAAjC;IACAmD,aAAa,CAAC3B,CAAD,CAAb;IACA,OAAO,MAAM;MACXtB,QAAQ,CAACM,IAAT,CAAc6C,WAAd,CAA0B7B,CAAC,CAAClB,SAA5B;MACA6C,aAAa,CAAC,IAAD,CAAb;IACD,CAHD;EAID,CAPD,EAOG,CAACnD,KAAD,CAPH;EASA,OAAOkD,UAAU,gBAAG,4BAAaF,QAAb,EAAuBE,UAAU,CAAC7C,OAAlC,CAAH,GAAgD,IAAjE;AACD,CAlBe,CAAhB;AAoBA0C,OAAO,CAACO,SAAR,GAAoB;EAClBN,QAAQ,EAAEO,mBAAGC,IADK;EAElBxD,KAAK,EAAEuD,mBAAGE,KAAH,GAAWC;AAFA,CAApB;AAKAX,OAAO,CAACY,YAAR,GAAuB;EACrBX,QAAQ,EAAE;AADW,CAAvB;eAIeD,O"}
1
+ {"version":3,"file":"Tooltip.js","names":["PLACEMENTS","ABOVE_CURSOR","ABOVE_ELEMENT","BELOW_CURSOR","BELOW_ELEMENT","ARROW_STYLE_DOWN","join","ARROW_STYLE_UP","createTooltipComponents","theme","arrow","document","createElement","setAttribute","content","container","appendChild","body","calcTooltipRects","tooltip","getBoundingClientRect","calcViewportRect","pageXOffset","pageYOffset","window","documentElement","clientHeight","clientWidth","left","right","top","bottom","calcPositionAboveXY","x","y","tooltipRects","arrowX","width","arrowY","height","containerX","containerY","baseArrowStyle","setComponentPositions","pageX","pageY","placement","element","viewportRect","pos","Math","max","maxX","min","containerStyle","arrowStyle","Tooltip","forwardRef","children","ref","components","setComponents","useState","pointTo","useImperativeHandle","useEffect","removeChild","createPortal","propTypes","PT","node","shape","isRequired","defaultProps"],"sources":["../../../../../src/shared/components/WithTooltip/Tooltip.jsx"],"sourcesContent":["/**\n * The actual tooltip component. It is rendered outside the regular document\n * hierarchy, and with sub-components managed without React to achieve the best\n * performance during animation.\n */\n/* global document, window */\n\nimport {\n forwardRef,\n useEffect,\n useImperativeHandle,\n useState,\n} from 'react';\nimport { createPortal } from 'react-dom';\n\nimport PT from 'prop-types';\n\n/* Valid placements of the rendered tooltip. They will be overriden when\n * necessary to fit the tooltip within the viewport. */\nexport const PLACEMENTS = {\n ABOVE_CURSOR: 'ABOVE_CURSOR',\n ABOVE_ELEMENT: 'ABOVE_ELEMENT',\n BELOW_CURSOR: 'BELOW_CURSOR',\n BELOW_ELEMENT: 'BELOW_ELEMENT',\n};\n\nconst ARROW_STYLE_DOWN = [\n 'border-bottom-color:transparent',\n 'border-left-color:transparent',\n 'border-right-color:transparent',\n].join(';');\n\nconst ARROW_STYLE_UP = [\n 'border-top-color:transparent',\n 'border-left-color:transparent',\n 'border-right-color:transparent',\n].join(';');\n\n/**\n * Creates tooltip components.\n * @ignore\n * @param {object} theme Themes to use for tooltip container, arrow,\n * and content.\n * @return {object} Object with DOM references to the container components:\n * container, arrow, content.\n */\nfunction createTooltipComponents(theme) {\n const arrow = document.createElement('div');\n if (theme.arrow) arrow.setAttribute('class', theme.arrow);\n\n const content = document.createElement('div');\n if (theme.content) content.setAttribute('class', theme.content);\n\n const container = document.createElement('div');\n if (theme.container) container.setAttribute('class', theme.container);\n\n container.appendChild(arrow);\n container.appendChild(content);\n document.body.appendChild(container);\n\n return { container, arrow, content };\n}\n\n/**\n * Generates bounding client rectangles for tooltip components.\n * @ignore\n * @param {object} tooltip DOM references to the tooltip components.\n * @param {object} tooltip.arrow\n * @param {object} tooltip.container\n * @return {{ arrow: object, container}} Object holding tooltip rectangles in\n * two fields.\n */\nfunction calcTooltipRects(tooltip) {\n return {\n arrow: tooltip.arrow.getBoundingClientRect(),\n container: tooltip.container.getBoundingClientRect(),\n };\n}\n\n/**\n * Calculates the document viewport size.\n * @ignore\n * @return {{x, y, width, height}}\n */\nfunction calcViewportRect() {\n const { pageXOffset, pageYOffset } = window;\n const { documentElement: { clientHeight, clientWidth } } = document;\n return {\n left: pageXOffset,\n right: pageXOffset + clientWidth,\n top: pageYOffset,\n bottom: pageYOffset + clientHeight,\n };\n}\n\n/**\n * Calculates tooltip and arrow positions for the placement just above\n * the cursor.\n * @ignore\n * @param {number} x Cursor page-x position.\n * @param {number} y Cursor page-y position.\n * @param {object} tooltipRects Bounding client rectangles of tooltip parts.\n * @param {object} tooltipRects.arrow\n * @param {object} tooltipRects.container\n * @return {object} Contains the following fields:\n * - {number} arrowX\n * - {number} arrowY\n * - {number} containerX\n * - {number} containerY\n * - {string} baseArrowStyle\n */\nfunction calcPositionAboveXY(x, y, tooltipRects) {\n const { arrow, container } = tooltipRects;\n return {\n arrowX: 0.5 * (container.width - arrow.width),\n arrowY: container.height,\n containerX: x - container.width / 2,\n containerY: y - container.height - arrow.height / 1.5,\n\n // TODO: Instead of already setting the base style here, we should\n // introduce a set of constants for arrow directions, which will help\n // to do checks dependant on the arrow direction.\n baseArrowStyle: ARROW_STYLE_DOWN,\n };\n}\n\n/*\nconst HIT = {\n NONE: false,\n LEFT: 'LEFT',\n RIGHT: 'RIGHT',\n TOP: 'TOP',\n BOTTOM: 'BOTTOM',\n};\n*/\n\n/**\n * Checks whether\n * @param {object} pos\n * @param {object} tooltipRects\n * @param {object} viewportRect\n * @return {HIT}\n */\n/*\nfunction checkViewportFit(pos, tooltipRects, viewportRect) {\n const { containerX, containerY } = pos;\n if (containerX < viewportRect.left + 6) return HIT.LEFT;\n if (containerX > viewportRect.right - 6) return HIT.RIGHT;\n return HIT.NONE;\n}\n*/\n\n/**\n * Shifts tooltip horizontally to fit into the viewport, while keeping\n * the arrow pointed to the XY point.\n * @param {number} x\n * @param {number} y\n * @param {object} pos\n * @param {number} pageXOffset\n * @param {number} pageXWidth\n */\n/*\nfunction xPageFitCorrection(x, y, pos, pageXOffset, pageXWidth) {\n if (pos.containerX < pageXOffset + 6) {\n pos.containerX = pageXOffset + 6;\n pos.arrowX = Math.max(6, pageX - containerX - arrowRect.width / 2);\n } else {\n const maxX = pageXOffset + docRect.width - containerRect.width - 6;\n if (containerX > maxX) {\n containerX = maxX;\n arrowX = Math.min(\n containerRect.width - 6,\n pageX - containerX - arrowRect.width / 2,\n );\n }\n }\n}\n*/\n\n/**\n * Sets positions of tooltip components to point the tooltip to the specified\n * page point.\n * @ignore\n * @param {number} pageX\n * @param {number} pageY\n * @param {PLACEMENTS} placement\n * @param {object} element DOM reference to the element wrapped by the tooltip.\n * @param {object} tooltip\n * @param {object} tooltip.arrow DOM reference to the tooltip arrow.\n * @param {object} tooltip.container DOM reference to the tooltip container.\n */\nfunction setComponentPositions(\n pageX,\n pageY,\n placement,\n element,\n tooltip,\n) {\n const tooltipRects = calcTooltipRects(tooltip);\n const viewportRect = calcViewportRect();\n\n /* Default container coords: tooltip at the top. */\n const pos = calcPositionAboveXY(pageX, pageY, tooltipRects);\n\n if (pos.containerX < viewportRect.left + 6) {\n pos.containerX = viewportRect.left + 6;\n pos.arrowX = Math.max(\n 6,\n pageX - pos.containerX - tooltipRects.arrow.width / 2,\n );\n } else {\n const maxX = viewportRect.right - 6 - tooltipRects.container.width;\n if (pos.containerX > maxX) {\n pos.containerX = maxX;\n pos.arrowX = Math.min(\n tooltipRects.container.width - 6,\n pageX - pos.containerX - tooltipRects.arrow.width / 2,\n );\n }\n }\n\n /* If tooltip has not enough space on top - make it bottom tooltip. */\n if (pos.containerY < viewportRect.top + 6) {\n pos.containerY += tooltipRects.container.height\n + 2 * tooltipRects.arrow.height;\n pos.arrowY -= tooltipRects.container.height\n + tooltipRects.arrow.height;\n pos.baseArrowStyle = ARROW_STYLE_UP;\n }\n\n const containerStyle = `left:${pos.containerX}px;top:${pos.containerY}px`;\n tooltip.container.setAttribute('style', containerStyle);\n\n const arrowStyle = `${pos.baseArrowStyle};left:${pos.arrowX}px;top:${pos.arrowY}px`;\n tooltip.arrow.setAttribute('style', arrowStyle);\n}\n\n/* The Tooltip component itself. */\nconst Tooltip = forwardRef(({ children, theme }, ref) => {\n const [components, setComponents] = useState(null);\n\n const pointTo = (pageX, pageY, placement, element) => components\n && setComponentPositions(pageX, pageY, placement, element, components);\n useImperativeHandle(ref, () => ({ pointTo }));\n\n /* Inits and destroys tooltip components. */\n useEffect(() => {\n const x = createTooltipComponents(theme);\n setComponents(x);\n return () => {\n document.body.removeChild(x.container);\n setComponents(null);\n };\n }, [theme]);\n\n return components ? createPortal(children, components.content) : null;\n});\n\nTooltip.propTypes = {\n children: PT.node,\n theme: PT.shape().isRequired,\n};\n\nTooltip.defaultProps = {\n children: null,\n};\n\nexport default Tooltip;\n"],"mappings":";;;;;;;;;AAOA;;AAMA;;AAEA;;AAfA;AACA;AACA;AACA;AACA;;AACA;;AAYA;AACA;AACO,MAAMA,UAAU,GAAG;EACxBC,YAAY,EAAE,cADU;EAExBC,aAAa,EAAE,eAFS;EAGxBC,YAAY,EAAE,cAHU;EAIxBC,aAAa,EAAE;AAJS,CAAnB;;AAOP,MAAMC,gBAAgB,GAAG,CACvB,iCADuB,EAEvB,+BAFuB,EAGvB,gCAHuB,EAIvBC,IAJuB,CAIlB,GAJkB,CAAzB;AAMA,MAAMC,cAAc,GAAG,CACrB,8BADqB,EAErB,+BAFqB,EAGrB,gCAHqB,EAIrBD,IAJqB,CAIhB,GAJgB,CAAvB;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASE,uBAAT,CAAiCC,KAAjC,EAAwC;EACtC,MAAMC,KAAK,GAAGC,QAAQ,CAACC,aAAT,CAAuB,KAAvB,CAAd;EACA,IAAIH,KAAK,CAACC,KAAV,EAAiBA,KAAK,CAACG,YAAN,CAAmB,OAAnB,EAA4BJ,KAAK,CAACC,KAAl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UAApC;AACD;AAED;;;AACA,MAAMC,OAAO,gBAAG,IAAAC,iBAAA,EAAW,CAAC;EAAEC,QAAF;EAAYjD;AAAZ,CAAD,EAAsBkD,GAAtB,KAA8B;EACvD,MAAM,CAACC,UAAD,EAAaC,aAAb,IAA8B,IAAAC,eAAA,EAAS,IAAT,CAApC;;EAEA,MAAMC,OAAO,GAAG,CAACnB,KAAD,EAAQC,KAAR,EAAeC,SAAf,EAA0BC,OAA1B,KAAsCa,UAAU,IAC3DjB,qBAAqB,CAACC,KAAD,EAAQC,KAAR,EAAeC,SAAf,EAA0BC,OAA1B,EAAmCa,UAAnC,CAD1B;;EAEA,IAAAI,0BAAA,EAAoBL,GAApB,EAAyB,OAAO;IAAEI;EAAF,CAAP,CAAzB;EAEA;;EACA,IAAAE,gBAAA,EAAU,MAAM;IACd,MAAMhC,CAAC,GAAGzB,uBAAuB,CAACC,KAAD,CAAjC;IACAoD,aAAa,CAAC5B,CAAD,CAAb;IACA,OAAO,MAAM;MACXtB,QAAQ,CAACM,IAAT,CAAciD,WAAd,CAA0BjC,CAAC,CAAClB,SAA5B;MACA8C,aAAa,CAAC,IAAD,CAAb;IACD,CAHD;EAID,CAPD,EAOG,CAACpD,KAAD,CAPH;EASA,OAAOmD,UAAU,gBAAG,IAAAO,sBAAA,EAAaT,QAAb,EAAuBE,UAAU,CAAC9C,OAAlC,CAAH,GAAgD,IAAjE;AACD,CAlBe,CAAhB;AAoBA0C,OAAO,CAACY,SAAR,GAAoB;EAClBV,QAAQ,EAAEW,kBAAA,CAAGC,IADK;EAElB7D,KAAK,EAAE4D,kBAAA,CAAGE,KAAH,GAAWC;AAFA,CAApB;AAKAhB,OAAO,CAACiB,YAAR,GAAuB;EACrBf,QAAQ,EAAE;AADW,CAAvB;eAIeF,O"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["Wrapper","children","placement","tip","theme","tooltipRef","wrapperRef","showTooltip","setShowTooltip","updatePortalPosition","cursorX","cursorY","wrapperRect","current","getBoundingClientRect","left","right","top","bottom","pointTo","window","pageXOffset","pageYOffset","listener","addEventListener","removeEventListener","undefined","wrapper","e","clientX","clientY","ThemedWrapper","defaultTheme","PLACEMENTS","propTypes","PT","node","oneOf","Object","values","themeType","isRequired","defaultProps","ABOVE_CURSOR"],"sources":["../../../../../src/shared/components/WithTooltip/index.jsx"],"sourcesContent":["/* global window */\n\nimport PT from 'prop-types';\nimport { useEffect, useRef, useState } from 'react';\n\nimport { themed } from 'utils';\n\nimport Tooltip, { PLACEMENTS } from './Tooltip';\n\nimport defaultTheme from './default-theme.scss';\n\n/**\n * Implements a simple to use and themeable tooltip component, _e.g._\n * ```js\n * <WithTooltip tip=\"This is example tooltip.\">\n * <p>Hover to see the tooltip.</p>\n * </WithTooltip>\n * ```\n * **Children:** Children are rendered in the place of `<WithTooltip>`,\n * and when hovered the tooltip is shown. By default the wrapper itself is\n * `<div>` block with `display: inline-block`.\n * @param {object} props Component properties.\n * @param {React.node} props.tip &ndash; Anything React is able to render,\n * _e.g._ a tooltip text. This will be the tooltip content.\n * @param {WithTooltipTheme} props.theme _Ad hoc_ theme.\n */\nfunction Wrapper({\n children,\n placement,\n tip,\n theme,\n}) {\n const tooltipRef = useRef();\n const wrapperRef = useRef();\n const [showTooltip, setShowTooltip] = useState(false);\n\n const updatePortalPosition = (cursorX, cursorY) => {\n if (!showTooltip) setShowTooltip(true);\n else {\n const wrapperRect = wrapperRef.current.getBoundingClientRect();\n if (\n cursorX < wrapperRect.left\n || cursorX > wrapperRect.right\n || cursorY < wrapperRect.top\n || cursorY > wrapperRect.bottom\n ) {\n setShowTooltip(false);\n } else if (tooltipRef.current) {\n tooltipRef.current.pointTo(\n cursorX + window.pageXOffset,\n cursorY + window.pageYOffset,\n placement,\n wrapperRef.current,\n );\n }\n }\n };\n\n useEffect(() => {\n if (showTooltip && tip !== null) {\n const listener = () => setShowTooltip(false);\n window.addEventListener('scroll', listener);\n return () => window.removeEventListener('scroll', listener);\n }\n return undefined;\n }, [showTooltip, tip]);\n\n return (\n <div\n className={theme.wrapper}\n onMouseLeave={() => setShowTooltip(false)}\n onMouseMove={(e) => updatePortalPosition(e.clientX, e.clientY)}\n ref={wrapperRef}\n >\n {\n showTooltip && tip !== null ? (\n <Tooltip ref={tooltipRef} theme={theme}>{tip}</Tooltip>\n ) : null\n }\n {children}\n </div>\n );\n}\n\nconst ThemedWrapper = themed(\n 'WithTooltip',\n [\n 'appearance',\n 'arrow',\n 'container',\n 'content',\n 'wrapper',\n ],\n defaultTheme,\n)(Wrapper);\n\nThemedWrapper.PLACEMENTS = PLACEMENTS;\n\nWrapper.propTypes = {\n children: PT.node,\n placement: PT.oneOf(Object.values(PLACEMENTS)),\n theme: ThemedWrapper.themeType.isRequired,\n tip: PT.node,\n};\n\nWrapper.defaultProps = {\n children: null,\n placement: PLACEMENTS.ABOVE_CURSOR,\n tip: null,\n};\n\nexport default ThemedWrapper;\n"],"mappings":";;;;;;;;;AAEA;;AACA;;AAEA;;AAEA;;;;;;;;AAPA;;;;;;;;;;AAWA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASA,OAAT,CAAiB;EACfC,QADe;EAEfC,SAFe;EAGfC,GAHe;EAIfC;AAJe,CAAjB,EAKG;EACD,MAAMC,UAAU,GAAG,oBAAnB;EACA,MAAMC,UAAU,GAAG,oBAAnB;EACA,MAAM,CAACC,WAAD,EAAcC,cAAd,IAAgC,qBAAS,KAAT,CAAtC;;EAEA,MAAMC,oBAAoB,GAAG,CAACC,OAAD,EAAUC,OAAV,KAAsB;IACjD,IAAI,CAACJ,WAAL,EAAkBC,cAAc,CAAC,IAAD,CAAd,CAAlB,KACK;MACH,MAAMI,WAAW,GAAGN,UAAU,CAACO,OAAX,CAAmBC,qBAAnB,EAApB;;MACA,IACEJ,OAAO,GAAGE,WAAW,CAACG,IAAtB,IACGL,OAAO,GAAGE,WAAW,CAACI,KADzB,IAEGL,OAAO,GAAGC,WAA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AAa,CAACE,UAAd,GAA2BA,mBAA3B;AAEAjC,OAAO,CAACkC,SAAR,GAAoB;EAClBjC,QAAQ,EAAEkC,mBAAGC,IADK;EAElBlC,SAAS,EAAEiC,mBAAGE,KAAH,CAASC,MAAM,CAACC,MAAP,CAAcN,mBAAd,CAAT,CAFO;EAGlB7B,KAAK,EAAE2B,aAAa,CAACS,SAAd,CAAwBC,UAHb;EAIlBtC,GAAG,EAAEgC,mBAAGC;AAJU,CAApB;AAOApC,OAAO,CAAC0C,YAAR,GAAuB;EACrBzC,QAAQ,EAAE,IADW;EAErBC,SAAS,EAAE+B,oBAAWU,YAFD;EAGrBxC,GAAG,EAAE;AAHgB,CAAvB;eAMe4B,a"}
1
+ {"version":3,"file":"index.js","names":["Wrapper","children","placement","tip","theme","tooltipRef","useRef","wrapperRef","showTooltip","setShowTooltip","useState","updatePortalPosition","cursorX","cursorY","wrapperRect","current","getBoundingClientRect","left","right","top","bottom","pointTo","window","pageXOffset","pageYOffset","useEffect","listener","addEventListener","removeEventListener","undefined","wrapper","e","clientX","clientY","ThemedWrapper","themed","defaultTheme","PLACEMENTS","propTypes","PT","node","oneOf","Object","values","themeType","isRequired","defaultProps","ABOVE_CURSOR"],"sources":["../../../../../src/shared/components/WithTooltip/index.jsx"],"sourcesContent":["/* global window */\n\nimport PT from 'prop-types';\nimport { useEffect, useRef, useState } from 'react';\n\nimport { themed } from 'utils';\n\nimport Tooltip, { PLACEMENTS } from './Tooltip';\n\nimport defaultTheme from './default-theme.scss';\n\n/**\n * Implements a simple to use and themeable tooltip component, _e.g._\n * ```js\n * <WithTooltip tip=\"This is example tooltip.\">\n * <p>Hover to see the tooltip.</p>\n * </WithTooltip>\n * ```\n * **Children:** Children are rendered in the place of `<WithTooltip>`,\n * and when hovered the tooltip is shown. By default the wrapper itself is\n * `<div>` block with `display: inline-block`.\n * @param {object} props Component properties.\n * @param {React.node} props.tip &ndash; Anything React is able to render,\n * _e.g._ a tooltip text. This will be the tooltip content.\n * @param {WithTooltipTheme} props.theme _Ad hoc_ theme.\n */\nfunction Wrapper({\n children,\n placement,\n tip,\n theme,\n}) {\n const tooltipRef = useRef();\n const wrapperRef = useRef();\n const [showTooltip, setShowTooltip] = useState(false);\n\n const updatePortalPosition = (cursorX, cursorY) => {\n if (!showTooltip) setShowTooltip(true);\n else {\n const wrapperRect = wrapperRef.current.getBoundingClientRect();\n if (\n cursorX < wrapperRect.left\n || cursorX > wrapperRect.right\n || cursorY < wrapperRect.top\n || cursorY > wrapperRect.bottom\n ) {\n setShowTooltip(false);\n } else if (tooltipRef.current) {\n tooltipRef.current.pointTo(\n cursorX + window.pageXOffset,\n cursorY + window.pageYOffset,\n placement,\n wrapperRef.current,\n );\n }\n }\n };\n\n useEffect(() => {\n if (showTooltip && tip !== null) {\n const listener = () => setShowTooltip(false);\n window.addEventListener('scroll', listener);\n return () => window.removeEventListener('scroll', listener);\n }\n return undefined;\n }, [showTooltip, tip]);\n\n return (\n <div\n className={theme.wrapper}\n onMouseLeave={() => setShowTooltip(false)}\n onMouseMove={(e) => updatePortalPosition(e.clientX, e.clientY)}\n ref={wrapperRef}\n >\n {\n showTooltip && tip !== null ? (\n <Tooltip ref={tooltipRef} theme={theme}>{tip}</Tooltip>\n ) : null\n }\n {children}\n </div>\n );\n}\n\nconst ThemedWrapper = themed(\n 'WithTooltip',\n [\n 'appearance',\n 'arrow',\n 'container',\n 'content',\n 'wrapper',\n ],\n defaultTheme,\n)(Wrapper);\n\nThemedWrapper.PLACEMENTS = PLACEMENTS;\n\nWrapper.propTypes = {\n children: PT.node,\n placement: PT.oneOf(Object.values(PLACEMENTS)),\n theme: ThemedWrapper.themeType.isRequired,\n tip: PT.node,\n};\n\nWrapper.defaultProps = {\n children: null,\n placement: PLACEMENTS.ABOVE_CURSOR,\n tip: null,\n};\n\nexport default ThemedWrapper;\n"],"mappings":";;;;;;;;;AAEA;;AACA;;AAEA;;AAEA;;;;;;;;AAPA;;;;;;;;;;AAWA;AACA;AACA;AACA;AAC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AP;EACD,CAPD,EAOG,CAACrB,WAAD,EAAcL,GAAd,CAPH;EASA,oBACE;IACE,SAAS,EAAEC,KAAK,CAAC0B,OADnB;IAEE,YAAY,EAAE,MAAMrB,cAAc,CAAC,KAAD,CAFpC;IAGE,WAAW,EAAGsB,CAAD,IAAOpB,oBAAoB,CAACoB,CAAC,CAACC,OAAH,EAAYD,CAAC,CAACE,OAAd,CAH1C;IAIE,GAAG,EAAE1B,UAJP;IAAA,WAOIC,WAAW,IAAIL,GAAG,KAAK,IAAvB,gBACE,qBAAC,gBAAD;MAAS,GAAG,EAAEE,UAAd;MAA0B,KAAK,EAAED,KAAjC;MAAA,UAAyCD;IAAzC,EADF,GAEI,IATR,EAWGF,QAXH;EAAA,EADF;AAeD;;AAED,MAAMiC,aAAa,GAAG,IAAAC,aAAA,EACpB,aADoB,EAEpB,CACE,YADF,EAEE,OAFF,EAGE,WAHF,EAIE,SAJF,EAKE,SALF,CAFoB,EASpBC,YAToB,EAUpBpC,OAVoB,CAAtB;AAYAkC,aAAa,CAACG,UAAd,GAA2BA,mBAA3B;AAEArC,OAAO,CAACsC,SAAR,GAAoB;EAClBrC,QAAQ,EAAEsC,kBAAA,CAAGC,IADK;EAElBtC,SAAS,EAAEqC,kBAAA,CAAGE,KAAH,CAASC,MAAM,CAACC,MAAP,CAAcN,mBAAd,CAAT,CAFO;EAGlBjC,KAAK,EAAE8B,aAAa,CAACU,SAAd,CAAwBC,UAHb;EAIlB1C,GAAG,EAAEoC,kBAAA,CAAGC;AAJU,CAApB;AAOAxC,OAAO,CAAC8C,YAAR,GAAuB;EACrB7C,QAAQ,EAAE,IADW;EAErBC,SAAS,EAAEmC,mBAAA,CAAWU,YAFD;EAGrB5C,GAAG,EAAE;AAHgB,CAAvB;eAMe+B,a"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["YouTubeVideo","autoplay","src","theme","title","url","query","split","qs","parse","videoId","v","match","stringify","container","throbberTheme","video","ThemedYouTubeVideo","baseTheme","propTypes","PT","bool","string","isRequired","themeType","defaultProps"],"sources":["../../../../../src/shared/components/YouTubeVideo/index.jsx"],"sourcesContent":["import PT from 'prop-types';\nimport qs from 'qs';\nimport ScalableRect from 'components/ScalableRect';\nimport themed from '@dr.pogodin/react-themes';\nimport Throbber from 'components/Throbber';\n\nimport baseTheme from './base.scss';\nimport throbberTheme from './throbber.scss';\n\n/**\n * A component for embeding a YouTube video.\n * @param {object} [props] Component properties.\n * @param {boolean} [props.autoplay] If `true` the video will start to play\n * automatically once loaded.\n * @param {string} [props.src] URL of the video to play. Can be in any of\n * the following formats, and keeps any additional query parameters understood\n * by the YouTube IFrame player:\n * - `https://www.youtube.com/watch?v=NdF6Rmt6Ado`\n * - `https://youtu.be/NdF6Rmt6Ado`\n * - `https://www.youtube.com/embed/NdF6Rmt6Ado`\n * @param {YouTubeVideoTheme} [props.theme] _Ad hoc_ theme.\n * @param {string} [props.title] The `title` attribute to add to the player\n * IFrame.\n */\nfunction YouTubeVideo({\n autoplay,\n src,\n theme,\n title,\n}) {\n let [url, query] = src.split('?');\n query = query ? qs.parse(query) : {};\n\n const videoId = query.v || url.match(/\\/([a-zA-Z0-9-_]*)$/)[1];\n url = `https://www.youtube.com/embed/${videoId}`;\n\n delete query.v;\n query.autoplay = autoplay ? 1 : 0;\n url += `?${qs.stringify(query)}`;\n\n // TODO: https://developers.google.com/youtube/player_parameters\n // More query parameters can be exposed via the component props.\n\n return (\n <ScalableRect className={theme.container} ratio=\"16:9\">\n <Throbber theme={throbberTheme} />\n <iframe\n allow=\"autoplay\"\n allowFullScreen\n className={theme.video}\n src={url}\n title={title}\n />\n </ScalableRect>\n );\n}\n\nconst ThemedYouTubeVideo = themed(\n 'YouTubeVideo',\n [\n 'container',\n 'video',\n ],\n baseTheme,\n)(YouTubeVideo);\n\nYouTubeVideo.propTypes = {\n autoplay: PT.bool,\n src: PT.string.isRequired,\n theme: ThemedYouTubeVideo.themeType.isRequired,\n title: PT.string,\n};\n\nYouTubeVideo.defa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,GAAyB;EACvBlB,QAAQ,EAAEmB,mBAAGC,IADU;EAEvBnB,GAAG,EAAEkB,mBAAGE,MAAH,CAAUC,UAFQ;EAGvBpB,KAAK,EAAEc,kBAAkB,CAACO,SAAnB,CAA6BD,UAHb;EAIvBnB,KAAK,EAAEgB,mBAAGE;AAJa,CAAzB;AAOAtB,YAAY,CAACyB,YAAb,GAA4B;EAC1BxB,QAAQ,EAAE,KADgB;EAE1BG,KAAK,EAAE;AAFmB,CAA5B;eAKea,kB"}
1
+ {"version":3,"file":"index.js","names":["YouTubeVideo","autoplay","src","theme","title","url","query","split","qs","parse","videoId","v","match","stringify","container","throbberTheme","video","ThemedYouTubeVideo","themed","baseTheme","propTypes","PT","bool","string","isRequired","themeType","defaultProps"],"sources":["../../../../../src/shared/components/YouTubeVideo/index.jsx"],"sourcesContent":["import PT from 'prop-types';\nimport qs from 'qs';\nimport ScalableRect from 'components/ScalableRect';\nimport themed from '@dr.pogodin/react-themes';\nimport Throbber from 'components/Throbber';\n\nimport baseTheme from './base.scss';\nimport throbberTheme from './throbber.scss';\n\n/**\n * A component for embeding a YouTube video.\n * @param {object} [props] Component properties.\n * @param {boolean} [props.autoplay] If `true` the video will start to play\n * automatically once loaded.\n * @param {string} [props.src] URL of the video to play. Can be in any of\n * the following formats, and keeps any additional query parameters understood\n * by the YouTube IFrame player:\n * - `https://www.youtube.com/watch?v=NdF6Rmt6Ado`\n * - `https://youtu.be/NdF6Rmt6Ado`\n * - `https://www.youtube.com/embed/NdF6Rmt6Ado`\n * @param {YouTubeVideoTheme} [props.theme] _Ad hoc_ theme.\n * @param {string} [props.title] The `title` attribute to add to the player\n * IFrame.\n */\nfunction YouTubeVideo({\n autoplay,\n src,\n theme,\n title,\n}) {\n let [url, query] = src.split('?');\n query = query ? qs.parse(query) : {};\n\n const videoId = query.v || url.match(/\\/([a-zA-Z0-9-_]*)$/)[1];\n url = `https://www.youtube.com/embed/${videoId}`;\n\n delete query.v;\n query.autoplay = autoplay ? 1 : 0;\n url += `?${qs.stringify(query)}`;\n\n // TODO: https://developers.google.com/youtube/player_parameters\n // More query parameters can be exposed via the component props.\n\n return (\n <ScalableRect className={theme.container} ratio=\"16:9\">\n <Throbber theme={throbberTheme} />\n <iframe\n allow=\"autoplay\"\n allowFullScreen\n className={theme.video}\n src={url}\n title={title}\n />\n </ScalableRect>\n );\n}\n\nconst ThemedYouTubeVideo = themed(\n 'YouTubeVideo',\n [\n 'container',\n 'video',\n ],\n baseTheme,\n)(YouTubeVideo);\n\nYouTubeVideo.propTypes = {\n autoplay: PT.bool,\n src: PT.string.isRequired,\n theme: ThemedYouTubeVideo.themeType.isRequired,\n title: PT.string,\n};\n\nYouTubeVideo.defaultProps = {\n autoplay: false,\n title: '',\n};\n\nexport default ThemedYouTubeVideo;\n"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASA,YAAT,CAAsB;EACpBC,QADoB;EAEpBC,GAFoB;EAGpBC,KAHoB;EAIpBC;AAJoB,CAAtB,EAKG;EACD,IAAI,CAACC,GAAD,EAAMC,KAAN,IAAeJ,GAAG,CAACK,KAAJ,CAAU,GAAV,CAAnB;EACAD,KAAK,GAAGA,KAAK,GAAGE,WAAA,CAAGC,KAAH,CAASH,KAAT,CAAH,GAAqB,EAAlC;EAEA,MAAMI,OAAO,GAAGJ,KAAK,CAACK,CAAN,IAAWN,GAAG,CAACO,KAAJ,CAAU,qBAAV,EAAiC,CAAjC,CAA3B;EACAP,GAAG,GAAI,iCAAgCK,OAAQ,EAA/C;EAEA,OAAOJ,KAAK,CAACK,CAAb;EACAL,KAAK,CAACL,QAAN,GAAiBA,QAAQ,GAAG,CAAH,GAAO,CAAhC;EACAI,GAAG,IAAK,IAAGG,WAAA,CAAGK,SAAH,CAAaP,KAAb,CAAoB,EAA/B,CATC,CAWD;EACA;;EAEA,oBACE,sBAAC,qBAAD;IAAc,SAAS,EAAEH,KAAK,CAACW,SAA/B;IAA0C,KAAK,EAAC,MAAhD;IAAA,wBACE,qBAAC,iBAAD;MAAU,KAAK,EAAEC;IAAjB,EADF,eAEE;MACE,KAAK,EAAC,UADR;MAEE,eAAe,MAFjB;MAGE,SAAS,EAAEZ,KAAK,CAACa,KAHnB;MAIE,GAAG,EAAEX,GAJP;MAKE,KAAK,EAAED;IALT,EAFF;EAAA,EADF;AAYD;;AAED,MAAMa,kBAAkB,GAAG,IAAAC,oBAAA,EACzB,cADyB,EAEzB,CACE,WADF,EAEE,OAFF,CAFyB,EAMzBC,SANyB,EAOzBnB,YAPyB,CAA3B;AASAA,YAAY,CAACoB,SAAb,GAAyB;EACvBnB,QAAQ,EAAEoB,kBAAA,CAAGC,IADU;EAEvBpB,GAAG,EAAEmB,kBAAA,CAAGE,MAAH,CAAUC,UAFQ;EAGvBrB,KAAK,EAAEc,kBAAkB,CAACQ,SAAnB,CAA6BD,UAHb;EAIvBpB,KAAK,EAAEiB,kBAAA,CAAGE;AAJa,CAAzB;AAOAvB,YAAY,CAAC0B,YAAb,GAA4B;EAC1BzB,QAAQ,EAAE,KADgB;EAE1BG,KAAK,EAAE;AAFmB,CAA5B;eAKea,kB"}
@@ -1 +1 @@
1
- {"version":3,"file":"Semaphore.js","names":["Semaphore","constructor","ready","setReady","bool","draining","drainQueue","seize","waitReady","queue","length","barrier","push","next","shift","resolve","setTimeout","bind"],"sources":["../../../../src/shared/utils/Semaphore.js"],"sourcesContent":["import { newBarrier } from './Barrier';\n\n/**\n * Implements a simple semaphore for async code logic.\n */\nexport default class Semaphore {\n constructor(ready) {\n this.#ready = !!ready;\n }\n\n get ready() { return this.#ready; }\n\n setReady(ready) {\n const bool = !!ready;\n if (this.#ready !== bool) {\n this.#ready = bool;\n if (bool && !this.#draining) this.#drainQueue();\n }\n }\n\n /**\n * Waits until the semaphore is ready, and marks it as non-ready (seizes it).\n * @return {Promise}\n */\n async seize() {\n await this.waitReady();\n this.setReady(false);\n }\n\n async waitReady() {\n if (!this.#ready || this.#queue.length) {\n const barrier = newBarrier();\n this.#queue.push(barrier);\n await barrier;\n }\n }\n\n // Private members below this point.\n\n /**\n * If semaphore is ready, it releases the next barrier in the queue, if any,\n * and reschedules itself for a call in the next event loop iteration.\n * Otherwise, it breaks the queue draining loop, which will be restarted\n * the next time the semaphore is set ready.\n */\n #drainQueue() {\n if (this.#ready && this.#queue.length) {\n const next = this.#queue.shift();\n next.resolve();\n\n // Re-schedules itself for the next event loop iteration.\n if (this.#queue.length) {\n setTimeout(this.#drainQueue.bind(this));\n this.#draining = true;\n return; // Exit here to avoid the drain loop termination below.\n }\n }\n\n // Cleans up for the drain loop termination.\n this.#draining = false;\n }\n\n // \"true\" when the drain queue process is running (and thus no need to start\n // a new one).\n #draining = false;\n\n // The array of barriers set for each async code flow awaiting for\n // the Semaphore to become ready.\n #queue = [];\n\n #ready;\n}\n"],"mappings":";;;;;;;AAAA;;AAEA;AACA;AACA;AACe,MAAMA,SAAN,CAAgB;EAC7BC,WAAW,CAACC,KAAD,EAAQ;IACjB,KAAK,CAACA,KAAN,GAAc,CAAC,CAACA,KAAhB;EACD;;EAEQ,IAALA,KAAK,GAAG;IAAE,OAAO,KAAK,CAACA,KAAb;EAAqB;;EAEnCC,QAAQ,CAACD,KAAD,EAAQ;IACd,MAAME,IAAI,GAAG,CAAC,CAACF,KAAf;;IACA,IAAI,KAAK,CAACA,KAAN,KAAgBE,IAApB,EAA0B;MACxB,KAAK,CAACF,KAAN,GAAcE,IAAd;MACA,IAAIA,IAAI,IAAI,CAAC,KAAK,CAACC,QAAnB,EAA6B,KAAK,CAACC,UAAN;IAC9B;EACF;EAED;AACF;AACA;AACA;;;EACa,MAALC,KAAK,GAAG;IACZ,MAAM,KAAKC,SAAL,EAAN;IACA,KAAKL,QAAL,CAAc,KAAd;EACD;;EAEc,MAATK,SAAS,GAAG;IAChB,IAAI,CAAC,KAAK,CAACN,KAAP,IAAgB,KAAK,CAACO,KAAN,CAAYC,MAAhC,EAAwC;MACtC,MAAMC,OAAO,GAAG,0BAAhB;MACA,KAAK,CAACF,KAAN,CAAYG,IAAZ,CAAiBD,OAAjB;MACA,MAAMA,OAAN;IACD;EACF,CA9B4B,CAgC7B;;EAEA;AACF;AACA;AACA;AACA;AACA;;;EACE,CAACL,UAAU,GAAG;IACZ,IAAI,KAAK,CAACJ,KAAN,IAAe,KAAK,CAACO,KAAN,CAAYC,MAA/B,EAAuC;MACrC,MAAMG,IAAI,GAAG,KAAK,CAACJ,KAAN,CAAYK,KAAZ,EAAb;MACAD,IAAI,CAACE,OAAL,GAFqC,CAIrC;;MACA,IAAI,KAAK,CAACN,KAAN,CAAYC,MAAhB,EAAwB;QACtBM,UAAU,CAAC,KAAK,CAACV,UAAN,CAAiBW,IAAjB,CAAsB,IAAtB,CAAD,CAAV;QACA,KAAK,CAACZ,QAAN,GAAiB,IAAjB;QACA,OAHsB,CAGd;MACT;IACF,CAXW,CAaZ;;;IACA,KAAK,CAACA,QAAN,GAAiB,KAAjB;EACD,CAvD4B,CAyD7B;EACA;;;EACA,CAACA,QAAD,GAAY,KAAZ,CA3D6B,CA6D7B;EACA;;EACA,CAACI,KAAD,GAAS,EAAT;EAEA,CAACP,KAAD;AAjE6B"}
1
+ {"version":3,"file":"Semaphore.js","names":["Semaphore","constructor","ready","setReady","bool","draining","drainQueue","seize","waitReady","queue","length","barrier","newBarrier","push","next","shift","resolve","setTimeout","bind"],"sources":["../../../../src/shared/utils/Semaphore.js"],"sourcesContent":["import { newBarrier } from './Barrier';\n\n/**\n * Implements a simple semaphore for async code logic.\n */\nexport default class Semaphore {\n constructor(ready) {\n this.#ready = !!ready;\n }\n\n get ready() { return this.#ready; }\n\n setReady(ready) {\n const bool = !!ready;\n if (this.#ready !== bool) {\n this.#ready = bool;\n if (bool && !this.#draining) this.#drainQueue();\n }\n }\n\n /**\n * Waits until the semaphore is ready, and marks it as non-ready (seizes it).\n * @return {Promise}\n */\n async seize() {\n await this.waitReady();\n this.setReady(false);\n }\n\n async waitReady() {\n if (!this.#ready || this.#queue.length) {\n const barrier = newBarrier();\n this.#queue.push(barrier);\n await barrier;\n }\n }\n\n // Private members below this point.\n\n /**\n * If semaphore is ready, it releases the next barrier in the queue, if any,\n * and reschedules itself for a call in the next event loop iteration.\n * Otherwise, it breaks the queue draining loop, which will be restarted\n * the next time the semaphore is set ready.\n */\n #drainQueue() {\n if (this.#ready && this.#queue.length) {\n const next = this.#queue.shift();\n next.resolve();\n\n // Re-schedules itself for the next event loop iteration.\n if (this.#queue.length) {\n setTimeout(this.#drainQueue.bind(this));\n this.#draining = true;\n return; // Exit here to avoid the drain loop termination below.\n }\n }\n\n // Cleans up for the drain loop termination.\n this.#draining = false;\n }\n\n // \"true\" when the drain queue process is running (and thus no need to start\n // a new one).\n #draining = false;\n\n // The array of barriers set for each async code flow awaiting for\n // the Semaphore to become ready.\n #queue = [];\n\n #ready;\n}\n"],"mappings":";;;;;;;AAAA;;AAEA;AACA;AACA;AACe,MAAMA,SAAN,CAAgB;EAC7BC,WAAW,CAACC,KAAD,EAAQ;IACjB,KAAK,CAACA,KAAN,GAAc,CAAC,CAACA,KAAhB;EACD;;EAEQ,IAALA,KAAK,GAAG;IAAE,OAAO,KAAK,CAACA,KAAb;EAAqB;;EAEnCC,QAAQ,CAACD,KAAD,EAAQ;IACd,MAAME,IAAI,GAAG,CAAC,CAACF,KAAf;;IACA,IAAI,KAAK,CAACA,KAAN,KAAgBE,IAApB,EAA0B;MACxB,KAAK,CAACF,KAAN,GAAcE,IAAd;MACA,IAAIA,IAAI,IAAI,CAAC,KAAK,CAACC,QAAnB,EAA6B,KAAK,CAACC,UAAN;IAC9B;EACF;EAED;AACF;AACA;AACA;;;EACa,MAALC,KAAK,GAAG;IACZ,MAAM,KAAKC,SAAL,EAAN;IACA,KAAKL,QAAL,CAAc,KAAd;EACD;;EAEc,MAATK,SAAS,GAAG;IAChB,IAAI,CAAC,KAAK,CAACN,KAAP,IAAgB,KAAK,CAACO,KAAN,CAAYC,MAAhC,EAAwC;MACtC,MAAMC,OAAO,GAAG,IAAAC,mBAAA,GAAhB;MACA,KAAK,CAACH,KAAN,CAAYI,IAAZ,CAAiBF,OAAjB;MACA,MAAMA,OAAN;IACD;EACF,CA9B4B,CAgC7B;;EAEA;AACF;AACA;AACA;AACA;AACA;;;EACE,CAACL,UAAU,GAAG;IACZ,IAAI,KAAK,CAACJ,KAAN,IAAe,KAAK,CAACO,KAAN,CAAYC,MAA/B,EAAuC;MACrC,MAAMI,IAAI,GAAG,KAAK,CAACL,KAAN,CAAYM,KAAZ,EAAb;MACAD,IAAI,CAACE,OAAL,GAFqC,CAIrC;;MACA,IAAI,KAAK,CAACP,KAAN,CAAYC,MAAhB,EAAwB;QACtBO,UAAU,CAAC,KAAK,CAACX,UAAN,CAAiBY,IAAjB,CAAsB,IAAtB,CAAD,CAAV;QACA,KAAK,CAACb,QAAN,GAAiB,IAAjB;QACA,OAHsB,CAGd;MACT;IACF,CAXW,CAaZ;;;IACA,KAAK,CAACA,QAAN,GAAiB,KAAjB;EACD,CAvD4B,CAyD7B;EACA;;;EACA,CAACA,QAAD,GAAY,KAAZ,CA3D6B,CA6D7B;EACA;;EACA,CAACI,KAAD,GAAS,EAAT;EAEA,CAACP,KAAD;AAjE6B"}
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","names":["window","CONFIG"],"sources":["../../../../src/shared/utils/config.js"],"sourcesContent":["/* global window */\n\nimport { requireWeak } from './webpack';\n\n/* eslint-disable global-require */\nexport default requireWeak('config') || window.CONFIG || {};\n/* eslint-enable global-require */\n"],"mappings":";;;;;;;AAEA;;AAFA;;AAIA;eACe,0BAAY,QAAZ,KAAyBA,MAAM,CAACC,MAAhC,IAA0C,E;AACzD"}
1
+ {"version":3,"file":"config.js","names":["requireWeak","window","CONFIG"],"sources":["../../../../src/shared/utils/config.js"],"sourcesContent":["/* global window */\n\nimport { requireWeak } from './webpack';\n\n/* eslint-disable global-require */\nexport default requireWeak('config') || window.CONFIG || {};\n/* eslint-enable global-require */\n"],"mappings":";;;;;;;AAEA;;AAFA;;AAIA;eACe,IAAAA,oBAAA,EAAY,QAAZ,KAAyBC,MAAM,CAACC,MAAhC,IAA0C,E;AACzD"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["themed","COMPOSE","PRIORITY","NODE_CONFIG_ENV","process","env","NODE_ENV","JU","webpack","requireWeak","__dirname","withRetries","action","maxRetries","interval","n","error","time","timer"],"sources":["../../../../src/shared/utils/index.js"],"sourcesContent":["import themed, {\n COMPOSE,\n PRIORITY,\n ThemeProvider,\n} from '@dr.pogodin/react-themes';\n\nimport config from './config';\nimport * as isomorphy from './isomorphy';\nimport time from './time';\nimport * as webpack from './webpack';\n\nexport * from './Barrier';\nexport { default as Emitter } from './Emitter';\nexport { default as Semaphore } from './Semaphore';\nexport { default as splitComponent } from './splitComponent';\n\nthemed.COMPOSE = COMPOSE;\nthemed.PRIORITY = PRIORITY;\n\n// Note: it should be done this way, as in some environments\n// \"process\" might not exist, and process.env.NODE_CONFIG_ENV\n// not injected by Webpack.\nlet NODE_CONFIG_ENV;\ntry {\n NODE_CONFIG_ENV = process.env.NODE_CONFIG_ENV;\n} catch { /* noop */ }\n\nconst env = NODE_CONFIG_ENV || process.env.NODE_ENV;\nconst JU = env !== 'production' && webpack.requireWeak('./jest', __dirname);\n\n/**\n * @category Utilities\n * @global\n * @func withRetries\n * @desc\n * ```js\n * import { withRetries } from '@dr.pogodin/react-utils';\n * ```\n * Attempts to perform given asynchronous `action` up to `maxRetries` times,\n * with the given `interval` between attempts. If any attempt is successful,\n * the result is returned immediately, with no further attempts done;\n * otherwise, if all attempts fail, the result Promise rejects after the last\n * attempt.\n * @param {function} action\n * @param {number} [maxRetries=5] Optional. Maximum number of retries. Defaults\n * to 5 attempts.\n * @param {number} [interval=1000] Optional. Interval between retries [ms].\n * Defaults to 1 second.\n * @return {Promise} Resolves to the result of successful operation, or\n * rejects with the error from the latst failed attempt.\n * @example\n * import { withRetries } from '@dr.pogodin/react-utils';\n *\n * let firstCall = true;\n *\n * function sampleAction() {\n * if (!firstCall) return 'success';\n * firstCall = false;\n * throw Error('The first call to this method fails');\n * }\n *\n * withRetries(sampleAction).then(console.log);\n * // It will print 'success' after one second, once the second attempt\n * // is performed.\n */\nexport async function withRetries(action, maxRetries = 5, interval = 1000) {\n /* eslint-disable no-await-in-loop */\n for (let n = 1; ; ++n) {\n try {\n return await action();\n } catch (error) {\n if (n < maxRetries) await time.timer(interval);\n else throw error;\n }\n }\n /* eslint-enable no-await-in-loop */\n}\n\nexport {\n config,\n isomorphy,\n JU,\n themed,\n ThemeProvider,\n time,\n webpack,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAMA;;AACA;;;;AACA;;AACA;;;;AAEA;;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AACA;;AACA;;;;;;AAEAA,qBAAOC,OAAP,GAAiBA,oBAAjB;AACAD,qBAAOE,QAAP,GAAkBA,qBAAlB,C,CAEA;AACA;AACA;;AACA,IAAIC,eAAJ;;AACA,IAAI;EACFA,eAAe,GAAGC,OAAO,CAACC,GAAR,CAAYF,eAA9B;AACD,CAFD,CAEE,MAAM;EAAE;AAAY;;AAEtB,MAAME,GAAG,GAAGF,eAAe,IAAIC,OAAO,CAACC,GAAR,CAAYC,QAA3C;AACA,MAAMC,EAAE,GAAGF,GAAG,KAAK,YAAR,IAAwBG,OAAO,CAACC,WAAR,WAA8BC,SAA9B,CAAnC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AACO,eAAeC,WAAf,CAA2BC,MAA3B,EAAmCC,UAAU,GAAG,CAAhD,EAAmDC,QAAQ,GAAG,IAA9D,EAAoE;EACzE;EACA,KAAK,IAAIC,CAAC,GAAG,CAAb,GAAkB,EAAEA,CAApB,EAAuB;IACrB,IAAI;MACF,OAAO,MAAMH,MAAM,EAAnB;IACD,CAFD,CAEE,OAAOI,KAAP,EAAc;MACd,IAAID,CAAC,GAAGF,UAAR,EAAoB,MAAMI,cAAKC,KAAL,CAAWJ,QAAX,CAAN,CAApB,KACK,MAAME,KAAN;IACN;EACF;EACD;;AACD"}
1
+ {"version":3,"file":"index.js","names":["themed","COMPOSE","PRIORITY","NODE_CONFIG_ENV","process","env","NODE_ENV","JU","webpack","requireWeak","__dirname","withRetries","action","maxRetries","interval","n","error","time","timer"],"sources":["../../../../src/shared/utils/index.js"],"sourcesContent":["import themed, {\n COMPOSE,\n PRIORITY,\n ThemeProvider,\n} from '@dr.pogodin/react-themes';\n\nimport config from './config';\nimport * as isomorphy from './isomorphy';\nimport time from './time';\nimport * as webpack from './webpack';\n\nexport * from './Barrier';\nexport { default as Emitter } from './Emitter';\nexport { default as Semaphore } from './Semaphore';\nexport { default as splitComponent } from './splitComponent';\n\nthemed.COMPOSE = COMPOSE;\nthemed.PRIORITY = PRIORITY;\n\n// Note: it should be done this way, as in some environments\n// \"process\" might not exist, and process.env.NODE_CONFIG_ENV\n// not injected by Webpack.\nlet NODE_CONFIG_ENV;\ntry {\n NODE_CONFIG_ENV = process.env.NODE_CONFIG_ENV;\n} catch { /* noop */ }\n\nconst env = NODE_CONFIG_ENV || process.env.NODE_ENV;\nconst JU = env !== 'production' && webpack.requireWeak('./jest', __dirname);\n\n/**\n * @category Utilities\n * @global\n * @func withRetries\n * @desc\n * ```js\n * import { withRetries } from '@dr.pogodin/react-utils';\n * ```\n * Attempts to perform given asynchronous `action` up to `maxRetries` times,\n * with the given `interval` between attempts. If any attempt is successful,\n * the result is returned immediately, with no further attempts done;\n * otherwise, if all attempts fail, the result Promise rejects after the last\n * attempt.\n * @param {function} action\n * @param {number} [maxRetries=5] Optional. Maximum number of retries. Defaults\n * to 5 attempts.\n * @param {number} [interval=1000] Optional. Interval between retries [ms].\n * Defaults to 1 second.\n * @return {Promise} Resolves to the result of successful operation, or\n * rejects with the error from the latst failed attempt.\n * @example\n * import { withRetries } from '@dr.pogodin/react-utils';\n *\n * let firstCall = true;\n *\n * function sampleAction() {\n * if (!firstCall) return 'success';\n * firstCall = false;\n * throw Error('The first call to this method fails');\n * }\n *\n * withRetries(sampleAction).then(console.log);\n * // It will print 'success' after one second, once the second attempt\n * // is performed.\n */\nexport async function withRetries(action, maxRetries = 5, interval = 1000) {\n /* eslint-disable no-await-in-loop */\n for (let n = 1; ; ++n) {\n try {\n return await action();\n } catch (error) {\n if (n < maxRetries) await time.timer(interval);\n else throw error;\n }\n }\n /* eslint-enable no-await-in-loop */\n}\n\nexport {\n config,\n isomorphy,\n JU,\n themed,\n ThemeProvider,\n time,\n webpack,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAMA;;AACA;;;;AACA;;AACA;;;;AAEA;;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AACA;;AACA;;;;;;AAEAA,oBAAA,CAAOC,OAAP,GAAiBA,oBAAjB;AACAD,oBAAA,CAAOE,QAAP,GAAkBA,qBAAlB,C,CAEA;AACA;AACA;;AACA,IAAIC,eAAJ;;AACA,IAAI;EACFA,eAAe,GAAGC,OAAO,CAACC,GAAR,CAAYF,eAA9B;AACD,CAFD,CAEE,MAAM;EAAE;AAAY;;AAEtB,MAAME,GAAG,GAAGF,eAAe,IAAIC,OAAO,CAACC,GAAR,CAAYC,QAA3C;AACA,MAAMC,EAAE,GAAGF,GAAG,KAAK,YAAR,IAAwBG,OAAO,CAACC,WAAR,WAA8BC,SAA9B,CAAnC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AACO,eAAeC,WAAf,CAA2BC,MAA3B,EAAmCC,UAAU,GAAG,CAAhD,EAAmDC,QAAQ,GAAG,IAA9D,EAAoE;EACzE;EACA,KAAK,IAAIC,CAAC,GAAG,CAAb,GAAkB,EAAEA,CAApB,EAAuB;IACrB,IAAI;MACF,OAAO,MAAMH,MAAM,EAAnB;IACD,CAFD,CAEE,OAAOI,KAAP,EAAc;MACd,IAAID,CAAC,GAAGF,UAAR,EAAoB,MAAMI,aAAA,CAAKC,KAAL,CAAWJ,QAAX,CAAN,CAApB,KACK,MAAME,KAAN;IACN;EACF;EACD;;AACD"}
@@ -91,7 +91,17 @@ class E2eSsrEnv extends _jestEnvironmentJsdom.default {
91
91
 
92
92
  async runSsr() {
93
93
  let options = this.pragmas['ssr-options'];
94
- options = options ? JSON.parse(options) : {};
94
+ options = options ? JSON.parse(options) : {}; // TODO: This is temporary to shortcut the logging added to SSR.
95
+
96
+ if (options.logger === undefined) {
97
+ options.logger = {
98
+ debug: _lodash.noop,
99
+ info: _lodash.noop,
100
+ log: _lodash.noop,
101
+ warn: _lodash.noop
102
+ };
103
+ }
104
+
95
105
  let root;
96
106
 
97
107
  switch (options.root) {
@@ -1 +1 @@
1
- {"version":3,"file":"E2eSsrEnv.js","names":["E2eSsrEnv","JsdomEnv","loadWebpackConfig","options","pragmas","JSON","parse","context","testFolder","fs","global","webpackOutputFs","factory","require","path","resolve","rootDir","webpackConfig","buildInfo","existsSync","readFileSync","runWebpack","compiler","outputFileSystem","Promise","done","fail","run","err","stats","webpackStats","toJson","runSsr","root","process","cwd","envName","babelEnv","extensions","entry","p","Application","entryExportName","renderer","status","markup","ssrRequest","send","set","noop","value","locals","webpack","devMiddleware","error","ssrMarkup","ssrOptions","ssrStatus","constructor","config","docblockPragmas","request","url","projectConfig","dom","Volume","dirname","testPath","withSsr","setup","REACT_UTILS_FORCE_CLIENT_SIDE","teardown","Object","keys","cache","forEach","key","register","revert"],"sources":["../../../../../src/shared/utils/jest/E2eSsrEnv.js"],"sourcesContent":["/**\n * Jest environment for end-to-end SSR and client-side testing. It relies on\n * the standard react-utils mechanics to execute SSR of given scene, and also\n * Webpack build of the code for client-side execution, it further exposes\n * Jsdom environment for the client-side testing of the outcomes.\n */\n/* eslint-disable global-require, import/no-dynamic-require */\n\n// BEWARE: The module is not imported into the JU module / the main assembly of\n// the library, because doing so easily breaks stuff:\n// 1) This module depends on Node-specific modules, which would make JU\n// incompatible with JsDom if included into JU.\n// 2) If this module is weakly imported from somewhere else in the lib,\n// it seems to randomly break tests using it for a different reason,\n// probably some sort of a require-loop, or some issues with weak\n// require in that scenario.\n\nimport path from 'path';\nimport ssrFactory from 'server/renderer';\n\nimport { defaults, noop, set } from 'lodash';\n\n// As this environment is a part of the Jest testing utils,\n// we assume development dependencies are available when it is used.\n/* eslint-disable import/no-extraneous-dependencies */\nimport register from '@babel/register';\nimport JsdomEnv from 'jest-environment-jsdom';\nimport { createFsFromVolume, Volume } from 'memfs';\nimport webpack from 'webpack';\n/* eslint-enable import/no-extraneous-dependencies */\n\nexport default class E2eSsrEnv extends JsdomEnv {\n /**\n * Loads Webpack config, and exposes it to the environment via global\n * webpackConfig object.\n */\n loadWebpackConfig() {\n let options = this.pragmas['webpack-config-options'];\n options = options ? JSON.parse(options) : {};\n defaults(options, {\n context: this.testFolder,\n fs: this.global.webpackOutputFs,\n });\n\n let factory = this.pragmas['webpack-config-factory'] || '';\n factory = require(path.resolve(this.rootDir, factory));\n this.global.webpackConfig = factory(options);\n\n const fs = this.global.webpackOutputFs;\n let buildInfo = `${options.context}/.build-info`;\n if (fs.existsSync(buildInfo)) {\n buildInfo = fs.readFileSync(buildInfo, 'utf8');\n this.global.buildInfo = JSON.parse(buildInfo);\n }\n }\n\n /**\n * Executes Webpack build.\n * @return {Promise}\n */\n async runWebpack() {\n this.loadWebpackConfig();\n\n const compiler = webpack(this.global.webpackConfig);\n compiler.outputFileSystem = this.global.webpackOutputFs;\n return new Promise((done, fail) => {\n compiler.run((err, stats) => {\n if (err) fail(err);\n\n this.global.webpackStats = stats.toJson();\n\n // Keeps reference to the raw Webpack stats object, which should be\n // explicitly passed to the server-side renderer alongside the request,\n // so that it can to pick up asset paths for different named chunks.\n this.webpackStats = stats;\n\n done();\n });\n });\n }\n\n async runSsr() {\n let options = this.pragmas['ssr-options'];\n options = options ? JSON.parse(options) : {};\n\n let root;\n switch (options.root) {\n case 'TEST': root = this.testFolder; break;\n default: root = process.cwd();\n }\n\n // Note: This enables Babel transformation for the code dynamically loaded\n // below, as the usual Jest Babel setup does not seem to apply to\n // the environment code, and imports from it.\n register({\n envName: options.babelEnv,\n extensions: ['.js', '.jsx', '.svg'],\n root,\n });\n\n if (!options.buildInfo) options.buildInfo = this.global.buildInfo;\n\n if (options.entry) {\n const p = path.resolve(this.testFolder, options.entry);\n options.Application = require(p)[options.entryExportName || 'default'];\n }\n\n const renderer = ssrFactory(this.global.webpackConfig, options);\n let status = 200; // OK\n const markup = await new Promise((done, fail) => {\n renderer(\n this.ssrRequest,\n\n // TODO: This will do for now, with the current implementation of\n // the renderer, but it will require a rework once the renderer is\n // updated to do streaming.\n {\n send: done,\n set: noop,\n status: (value) => {\n status = value;\n },\n\n // This is how up-to-date Webpack stats are passed to the server in\n // development mode, and we use this here always, instead of having\n // to pass some information via filesystem.\n locals: {\n webpack: {\n devMiddleware: {\n stats: this.webpackStats,\n },\n },\n },\n },\n\n (error) => {\n if (error) fail(error);\n else done('');\n },\n );\n });\n\n this.global.ssrMarkup = markup;\n this.global.ssrOptions = options;\n this.global.ssrStatus = status;\n }\n\n constructor(config, context) {\n const pragmas = context.docblockPragmas;\n let request = pragmas['ssr-request'];\n request = request ? JSON.parse(request) : {};\n if (!request.url) request.url = '/';\n\n // This ensures the initial JsDom URL matches the value we use for SSR.\n set(\n config.projectConfig,\n 'testEnvironmentOptions.url',\n `http://localhost${request.url}`,\n );\n\n super(config, context);\n\n this.global.dom = this.dom;\n this.global.webpackOutputFs = createFsFromVolume(new Volume());\n\n // Extracts necessary settings from config and context.\n const { projectConfig } = config;\n this.rootDir = projectConfig.rootDir;\n this.testFolder = path.dirname(context.testPath);\n this.withSsr = !pragmas['no-ssr'];\n this.ssrRequest = request;\n this.pragmas = pragmas;\n }\n\n async setup() {\n await super.setup();\n await this.runWebpack();\n if (this.withSsr) await this.runSsr();\n this.global.REACT_UTILS_FORCE_CLIENT_SIDE = true;\n }\n\n async teardown() {\n delete this.global.REACT_UTILS_FORCE_CLIENT_SIDE;\n\n // Resets module cache and @babel/register. Effectively this ensures that\n // the next time an instance of this environment is set up, all modules are\n // transformed by Babel from scratch, thus taking into account the latest\n // Babel config (which may change between different environment instances,\n // which does not seem to be taken into account by Babel / Node caches\n // automatically).\n Object.keys(require.cache).forEach((key) => {\n delete require.cache[key];\n });\n register.revert();\n super.teardown();\n }\n}\n"],"mappings":";;;;;;;;;AAiBA;;AACA;;AAEA;;AAKA;;AACA;;AACA;;AACA;;AA5BA;AACA;AACA;AACA;AACA;AACA;;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAOA;AACA;;AACA;;AAKA;AAEe,MAAMA,SAAN,SAAwBC,6BAAxB,CAAiC;EAC9C;AACF;AACA;AACA;EACEC,iBAAiB,GAAG;IAClB,IAAIC,OAAO,GAAG,KAAKC,OAAL,CAAa,wBAAb,CAAd;IACAD,OAAO,GAAGA,OAAO,GAAGE,IAAI,CAACC,KAAL,CAAWH,OAAX,CAAH,GAAyB,EAA1C;IACA,sBAASA,OAAT,EAAkB;MAChBI,OAAO,EAAE,KAAKC,UADE;MAEhBC,EAAE,EAAE,KAAKC,MAAL,CAAYC;IAFA,CAAlB;IAKA,IAAIC,OAAO,GAAG,KAAKR,OAAL,CAAa,wBAAb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,EAAN;IACA,MAAM,KAAKhD,UAAL,EAAN;IACA,IAAI,KAAK+C,OAAT,EAAkB,MAAM,KAAKpC,MAAL,EAAN;IAClB,KAAKtB,MAAL,CAAY4D,6BAAZ,GAA4C,IAA5C;EACD;;EAEa,MAARC,QAAQ,GAAG;IACf,OAAO,KAAK7D,MAAL,CAAY4D,6BAAnB,CADe,CAGf;IACA;IACA;IACA;IACA;IACA;;IACAE,MAAM,CAACC,IAAP,CAAY5D,OAAO,CAAC6D,KAApB,EAA2BC,OAA3B,CAAoCC,GAAD,IAAS;MAC1C,OAAO/D,OAAO,CAAC6D,KAAR,CAAcE,GAAd,CAAP;IACD,CAFD;;IAGAC,kBAASC,MAAT;;IACA,MAAMP,QAAN;EACD;;AApK6C"}
1
+ {"version":3,"file":"E2eSsrEnv.js","names":["E2eSsrEnv","JsdomEnv","loadWebpackConfig","options","pragmas","JSON","parse","defaults","context","testFolder","fs","global","webpackOutputFs","factory","require","path","resolve","rootDir","webpackConfig","buildInfo","existsSync","readFileSync","runWebpack","compiler","webpack","outputFileSystem","Promise","done","fail","run","err","stats","webpackStats","toJson","runSsr","logger","undefined","debug","noop","info","log","warn","root","process","cwd","register","envName","babelEnv","extensions","entry","p","Application","entryExportName","renderer","ssrFactory","status","markup","ssrRequest","send","set","value","locals","devMiddleware","error","ssrMarkup","ssrOptions","ssrStatus","constructor","config","docblockPragmas","request","url","projectConfig","dom","createFsFromVolume","Volume","dirname","testPath","withSsr","setup","REACT_UTILS_FORCE_CLIENT_SIDE","teardown","Object","keys","cache","forEach","key","revert"],"sources":["../../../../../src/shared/utils/jest/E2eSsrEnv.js"],"sourcesContent":["/**\n * Jest environment for end-to-end SSR and client-side testing. It relies on\n * the standard react-utils mechanics to execute SSR of given scene, and also\n * Webpack build of the code for client-side execution, it further exposes\n * Jsdom environment for the client-side testing of the outcomes.\n */\n/* eslint-disable global-require, import/no-dynamic-require */\n\n// BEWARE: The module is not imported into the JU module / the main assembly of\n// the library, because doing so easily breaks stuff:\n// 1) This module depends on Node-specific modules, which would make JU\n// incompatible with JsDom if included into JU.\n// 2) If this module is weakly imported from somewhere else in the lib,\n// it seems to randomly break tests using it for a different reason,\n// probably some sort of a require-loop, or some issues with weak\n// require in that scenario.\n\nimport path from 'path';\nimport ssrFactory from 'server/renderer';\n\nimport { defaults, noop, set } from 'lodash';\n\n// As this environment is a part of the Jest testing utils,\n// we assume development dependencies are available when it is used.\n/* eslint-disable import/no-extraneous-dependencies */\nimport register from '@babel/register';\nimport JsdomEnv from 'jest-environment-jsdom';\nimport { createFsFromVolume, Volume } from 'memfs';\nimport webpack from 'webpack';\n/* eslint-enable import/no-extraneous-dependencies */\n\nexport default class E2eSsrEnv extends JsdomEnv {\n /**\n * Loads Webpack config, and exposes it to the environment via global\n * webpackConfig object.\n */\n loadWebpackConfig() {\n let options = this.pragmas['webpack-config-options'];\n options = options ? JSON.parse(options) : {};\n defaults(options, {\n context: this.testFolder,\n fs: this.global.webpackOutputFs,\n });\n\n let factory = this.pragmas['webpack-config-factory'] || '';\n factory = require(path.resolve(this.rootDir, factory));\n this.global.webpackConfig = factory(options);\n\n const fs = this.global.webpackOutputFs;\n let buildInfo = `${options.context}/.build-info`;\n if (fs.existsSync(buildInfo)) {\n buildInfo = fs.readFileSync(buildInfo, 'utf8');\n this.global.buildInfo = JSON.parse(buildInfo);\n }\n }\n\n /**\n * Executes Webpack build.\n * @return {Promise}\n */\n async runWebpack() {\n this.loadWebpackConfig();\n\n const compiler = webpack(this.global.webpackConfig);\n compiler.outputFileSystem = this.global.webpackOutputFs;\n return new Promise((done, fail) => {\n compiler.run((err, stats) => {\n if (err) fail(err);\n\n this.global.webpackStats = stats.toJson();\n\n // Keeps reference to the raw Webpack stats object, which should be\n // explicitly passed to the server-side renderer alongside the request,\n // so that it can to pick up asset paths for different named chunks.\n this.webpackStats = stats;\n\n done();\n });\n });\n }\n\n async runSsr() {\n let options = this.pragmas['ssr-options'];\n options = options ? JSON.parse(options) : {};\n\n // TODO: This is temporary to shortcut the logging added to SSR.\n if (options.logger === undefined) {\n options.logger = {\n debug: noop,\n info: noop,\n log: noop,\n warn: noop,\n };\n }\n\n let root;\n switch (options.root) {\n case 'TEST': root = this.testFolder; break;\n default: root = process.cwd();\n }\n\n // Note: This enables Babel transformation for the code dynamically loaded\n // below, as the usual Jest Babel setup does not seem to apply to\n // the environment code, and imports from it.\n register({\n envName: options.babelEnv,\n extensions: ['.js', '.jsx', '.svg'],\n root,\n });\n\n if (!options.buildInfo) options.buildInfo = this.global.buildInfo;\n\n if (options.entry) {\n const p = path.resolve(this.testFolder, options.entry);\n options.Application = require(p)[options.entryExportName || 'default'];\n }\n\n const renderer = ssrFactory(this.global.webpackConfig, options);\n let status = 200; // OK\n const markup = await new Promise((done, fail) => {\n renderer(\n this.ssrRequest,\n\n // TODO: This will do for now, with the current implementation of\n // the renderer, but it will require a rework once the renderer is\n // updated to do streaming.\n {\n send: done,\n set: noop,\n status: (value) => {\n status = value;\n },\n\n // This is how up-to-date Webpack stats are passed to the server in\n // development mode, and we use this here always, instead of having\n // to pass some information via filesystem.\n locals: {\n webpack: {\n devMiddleware: {\n stats: this.webpackStats,\n },\n },\n },\n },\n\n (error) => {\n if (error) fail(error);\n else done('');\n },\n );\n });\n\n this.global.ssrMarkup = markup;\n this.global.ssrOptions = options;\n this.global.ssrStatus = status;\n }\n\n constructor(config, context) {\n const pragmas = context.docblockPragmas;\n let request = pragmas['ssr-request'];\n request = request ? JSON.parse(request) : {};\n if (!request.url) request.url = '/';\n\n // This ensures the initial JsDom URL matches the value we use for SSR.\n set(\n config.projectConfig,\n 'testEnvironmentOptions.url',\n `http://localhost${request.url}`,\n );\n\n super(config, context);\n\n this.global.dom = this.dom;\n this.global.webpackOutputFs = createFsFromVolume(new Volume());\n\n // Extracts necessary settings from config and context.\n const { projectConfig } = config;\n this.rootDir = projectConfig.rootDir;\n this.testFolder = path.dirname(context.testPath);\n this.withSsr = !pragmas['no-ssr'];\n this.ssrRequest = request;\n this.pragmas = pragmas;\n }\n\n async setup() {\n await super.setup();\n await this.runWebpack();\n if (this.withSsr) await this.runSsr();\n this.global.REACT_UTILS_FORCE_CLIENT_SIDE = true;\n }\n\n async teardown() {\n delete this.global.REACT_UTILS_FORCE_CLIENT_SIDE;\n\n // Resets module cache and @babel/register. Effectively this ensures that\n // the next time an instance of this environment is set up, all modules are\n // transformed by Babel from scratch, thus taking into account the latest\n // Babel config (which may change between different environment instances,\n // which does not seem to be taken into account by Babel / Node caches\n // automatically).\n Object.keys(require.cache).forEach((key) => {\n delete require.cache[key];\n });\n register.revert();\n super.teardown();\n }\n}\n"],"mappings":";;;;;;;;;AAiBA;;AACA;;AAEA;;AAKA;;AACA;;AACA;;AACA;;AA5BA;AACA;AACA;AACA;AACA;AACA;;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAOA;AACA;;AACA;;AAKA;AAEe,MAAMA,SAAN,SAAwBC,6BAAxB,CAAiC;EAC9C;AACF;AACA;AACA;EACEC,iBAAiB,GAAG;IAClB,IAAIC,OAAO,GAAG,KAAKC,OAAL,CAAa,wBAAb,CAAd;IACAD,OAAO,GAAGA,OAAO,GAAGE,IAAI,CAACC,KAAL,CAAWH,OAAX,CAAH,GAAyB,EAA1C;IACA,IAAAI,gBAAA,EAASJ,OAAT,EAAkB;MAChBK,OAAO,EAAE,KAAKC,UADE;MAEhBC,EAAE,EAAE,KAAKC,MAAL,CAAYC;IAFA,CAAlB;IAKA,IAAIC,OAAO,GAAG,KAAKT,OAAL,CAAa,wBAAb,KAA0C,EAAxD;IACAS,OAAO,GAAGC,OAAO,CAACC,aAAA,CAAKC,OAAL,CAAa,KAAKC,OAAlB,EAA2BJ,OAA3B,CAAD,CAAjB;IACA,KAAKF,MAAL,CAAYO,aAAZ,GAA4BL,OAAO,CAACV,OAAD,CAAnC;IAEA,MAAMO,EAAE,GAAG,KAAKC,MAAL,CAAYC,eAAvB;IACA,IAAIO,SAAS,GAAI,GAAEhB,OAAO,CAACK,OAA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