@dr.pogodin/react-utils 1.30.2 → 1.31.0

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 (117) hide show
  1. package/bin/build.js +5 -0
  2. package/build/development/client/index.js +1 -1
  3. package/build/development/client/index.js.map +1 -1
  4. package/build/development/index.js +7 -0
  5. package/build/development/index.js.map +1 -1
  6. package/build/development/shared/components/Checkbox/index.js +2 -2
  7. package/build/development/shared/components/Checkbox/index.js.map +1 -1
  8. package/build/development/shared/components/Input/index.js +2 -2
  9. package/build/development/shared/components/Input/index.js.map +1 -1
  10. package/build/development/shared/components/Modal/index.js +25 -5
  11. package/build/development/shared/components/Modal/index.js.map +1 -1
  12. package/build/development/shared/components/TextArea/index.js +5 -0
  13. package/build/development/shared/components/TextArea/index.js.map +1 -1
  14. package/build/development/shared/components/YouTubeVideo/index.js +1 -3
  15. package/build/development/shared/components/YouTubeVideo/index.js.map +1 -1
  16. package/build/development/shared/components/index.js +27 -14
  17. package/build/development/shared/components/index.js.map +1 -1
  18. package/build/development/shared/components/selectors/CustomDropdown/Options/index.js +93 -0
  19. package/build/development/shared/components/selectors/CustomDropdown/Options/index.js.map +1 -0
  20. package/build/development/shared/components/selectors/CustomDropdown/index.js +105 -0
  21. package/build/development/shared/components/selectors/CustomDropdown/index.js.map +1 -0
  22. package/build/development/shared/components/{Dropdown → selectors/NativeDropdown}/index.js +25 -34
  23. package/build/development/shared/components/selectors/NativeDropdown/index.js.map +1 -0
  24. package/build/development/shared/components/selectors/Switch/index.js +76 -0
  25. package/build/development/shared/components/selectors/Switch/index.js.map +1 -0
  26. package/build/development/shared/components/selectors/common.js +24 -0
  27. package/build/development/shared/components/selectors/common.js.map +1 -0
  28. package/build/development/shared/components/selectors/index.js +28 -0
  29. package/build/development/shared/components/selectors/index.js.map +1 -0
  30. package/build/development/style.css +387 -225
  31. package/build/development/web.bundle.js +109 -49
  32. package/build/production/client/index.js +1 -1
  33. package/build/production/client/index.js.map +1 -1
  34. package/build/production/index.js +1 -1
  35. package/build/production/index.js.map +1 -1
  36. package/build/production/shared/components/Checkbox/index.js +2 -2
  37. package/build/production/shared/components/Checkbox/index.js.map +1 -1
  38. package/build/production/shared/components/Input/index.js +1 -1
  39. package/build/production/shared/components/Input/index.js.map +1 -1
  40. package/build/production/shared/components/Modal/index.js +3 -2
  41. package/build/production/shared/components/Modal/index.js.map +1 -1
  42. package/build/production/shared/components/TextArea/index.js +3 -3
  43. package/build/production/shared/components/TextArea/index.js.map +1 -1
  44. package/build/production/shared/components/YouTubeVideo/index.js +2 -2
  45. package/build/production/shared/components/YouTubeVideo/index.js.map +1 -1
  46. package/build/production/shared/components/index.js +1 -1
  47. package/build/production/shared/components/index.js.map +1 -1
  48. package/build/production/shared/components/selectors/CustomDropdown/Options/index.js +7 -0
  49. package/build/production/shared/components/selectors/CustomDropdown/Options/index.js.map +1 -0
  50. package/build/production/shared/components/selectors/CustomDropdown/index.js +4 -0
  51. package/build/production/shared/components/selectors/CustomDropdown/index.js.map +1 -0
  52. package/build/production/shared/components/selectors/NativeDropdown/index.js +25 -0
  53. package/build/production/shared/components/selectors/NativeDropdown/index.js.map +1 -0
  54. package/build/production/shared/components/selectors/Switch/index.js +2 -0
  55. package/build/production/shared/components/selectors/Switch/index.js.map +1 -0
  56. package/build/production/shared/components/selectors/common.js +3 -0
  57. package/build/production/shared/components/selectors/common.js.map +1 -0
  58. package/build/production/shared/components/selectors/index.js +2 -0
  59. package/build/production/shared/components/selectors/index.js.map +1 -0
  60. package/build/production/style.css +1 -1
  61. package/build/production/style.css.map +1 -1
  62. package/build/production/web.bundle.js +1 -1
  63. package/build/production/web.bundle.js.map +1 -1
  64. package/build/types-code/client/index.d.ts +1 -0
  65. package/build/types-code/index.d.ts +1 -1
  66. package/build/types-code/shared/components/Checkbox/index.d.ts +1 -1
  67. package/build/types-code/shared/components/Input/index.d.ts +1 -1
  68. package/build/types-code/shared/components/Modal/index.d.ts +2 -1
  69. package/build/types-code/shared/components/TextArea/index.d.ts +1 -0
  70. package/build/types-code/shared/components/index.d.ts +1 -2
  71. package/build/types-code/shared/components/selectors/CustomDropdown/Options/index.d.ts +17 -0
  72. package/build/types-code/shared/components/selectors/CustomDropdown/index.d.ts +4 -0
  73. package/build/types-code/shared/components/selectors/NativeDropdown/index.d.ts +3 -0
  74. package/build/types-code/shared/components/selectors/Switch/index.d.ts +13 -0
  75. package/build/types-code/shared/components/selectors/common.d.ts +27 -0
  76. package/build/types-code/shared/components/selectors/index.d.ts +3 -0
  77. package/build/types-scss/src/shared/components/Modal/styles.scss.d.ts +1 -0
  78. package/build/types-scss/src/shared/components/selectors/CustomDropdown/Options/style.scss.d.ts +1 -0
  79. package/build/types-scss/src/shared/components/selectors/CustomDropdown/theme.scss.d.ts +10 -0
  80. package/build/types-scss/src/shared/components/{Dropdown → selectors/NativeDropdown}/theme.scss.d.ts +1 -0
  81. package/build/types-scss/src/shared/components/selectors/Switch/theme.scss.d.ts +6 -0
  82. package/package.json +6 -6
  83. package/src/client/index.tsx +2 -1
  84. package/src/index.ts +1 -0
  85. package/src/shared/components/Button/style.scss +1 -0
  86. package/src/shared/components/Checkbox/index.tsx +3 -3
  87. package/src/shared/components/Input/index.tsx +3 -3
  88. package/src/shared/components/Modal/base-theme.scss +1 -1
  89. package/src/shared/components/Modal/index.tsx +24 -5
  90. package/src/shared/components/Modal/styles.scss +2 -4
  91. package/src/shared/components/TextArea/index.tsx +5 -0
  92. package/src/shared/components/TextArea/style.scss +8 -0
  93. package/src/shared/components/YouTubeVideo/base.scss +3 -1
  94. package/src/shared/components/YouTubeVideo/index.tsx +2 -3
  95. package/src/shared/components/index.ts +2 -2
  96. package/src/shared/components/selectors/CustomDropdown/Options/index.tsx +117 -0
  97. package/src/shared/components/selectors/CustomDropdown/Options/style.scss +6 -0
  98. package/src/shared/components/selectors/CustomDropdown/index.tsx +115 -0
  99. package/src/shared/components/selectors/CustomDropdown/theme.scss +90 -0
  100. package/src/shared/components/{Dropdown → selectors/NativeDropdown}/index.tsx +21 -50
  101. package/src/shared/components/{Dropdown → selectors/NativeDropdown}/theme.scss +5 -0
  102. package/src/shared/components/selectors/Switch/index.tsx +94 -0
  103. package/src/shared/components/selectors/Switch/theme.scss +39 -0
  104. package/src/shared/components/selectors/common.ts +54 -0
  105. package/src/shared/components/selectors/index.ts +3 -0
  106. package/build/development/shared/components/Dropdown/index.js.map +0 -1
  107. package/build/development/shared/components/ScalableRect/index.js +0 -80
  108. package/build/development/shared/components/ScalableRect/index.js.map +0 -1
  109. package/build/production/shared/components/Dropdown/index.js +0 -24
  110. package/build/production/shared/components/Dropdown/index.js.map +0 -1
  111. package/build/production/shared/components/ScalableRect/index.js +0 -21
  112. package/build/production/shared/components/ScalableRect/index.js.map +0 -1
  113. package/build/types-code/shared/components/Dropdown/index.d.ts +0 -17
  114. package/build/types-code/shared/components/ScalableRect/index.d.ts +0 -19
  115. package/build/types-scss/src/shared/components/ScalableRect/style.scss.d.ts +0 -2
  116. package/src/shared/components/ScalableRect/index.tsx +0 -84
  117. package/src/shared/components/ScalableRect/style.scss +0 -10
package/bin/build.js CHANGED
@@ -75,6 +75,11 @@ const cmdLineArgs = program.opts();
75
75
 
76
76
  const { buildType } = cmdLineArgs;
77
77
 
78
+ if (program.args.length) {
79
+ const details = program.args.map((x) => `\t${x}`).join('\n');
80
+ program.error(`Unrecognized arguments:\n${details}`);
81
+ }
82
+
78
83
  /* Validates the build type argument, */
79
84
  if (!VALID_BUILD_TYPES.includes(buildType)) {
80
85
  throw new Error('Invalid build type');
@@ -24,7 +24,7 @@ function Launch(Application) {
24
24
  const container = document.getElementById('react-view');
25
25
  if (!container) throw Error('Failed to find container for React app');
26
26
  const scene = /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactGlobalState.GlobalStateProvider, {
27
- initialState: (0, _getInj.default)().ISTATE,
27
+ initialState: (0, _getInj.default)().ISTATE || options.initialState,
28
28
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactRouterDom.BrowserRouter, {
29
29
  future: {
30
30
  v7_relativeSplatPath: true
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["require","_reactGlobalState","_client","_reactRouterDom","_getInj","_interopRequireDefault","_jsxRuntime","Launch","Application","options","arguments","length","undefined","container","document","getElementById","Error","scene","jsx","GlobalStateProvider","initialState","getInj","ISTATE","children","BrowserRouter","future","v7_relativeSplatPath","dontHydrate","root","createRoot","render","hydrateRoot"],"sources":["../../../src/client/index.tsx"],"sourcesContent":["// Initialization of client-side code.\n/* global document */\n\nimport { type ComponentType } from 'react';\n\nimport { GlobalStateProvider } from '@dr.pogodin/react-global-state';\n\nimport { createRoot, hydrateRoot } from 'react-dom/client';\nimport { BrowserRouter } from 'react-router-dom';\n\nimport getInj from './getInj';\n\ntype OptionsT = {\n dontHydrate?: boolean;\n};\n\n/**\n * Prepares and launches the app at client side.\n * @param Application Root application component\n * @param [options={}] Optional. Additional settings.\n */\nexport default function Launch(\n Application: ComponentType,\n options: OptionsT = {},\n) {\n const container = document.getElementById('react-view');\n if (!container) throw Error('Failed to find container for React app');\n const scene = (\n <GlobalStateProvider initialState={getInj().ISTATE}>\n <BrowserRouter future={{ v7_relativeSplatPath: true }}>\n <Application />\n </BrowserRouter>\n </GlobalStateProvider>\n );\n\n if (options.dontHydrate) {\n const root = createRoot(container);\n root.render(scene);\n } else hydrateRoot(container, scene);\n}\n"],"mappings":";;;;;;;AAGAA,OAAA;AAEA,IAAAC,iBAAA,GAAAD,OAAA;AAEA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,eAAA,GAAAH,OAAA;AAEA,IAAAI,OAAA,GAAAC,sBAAA,CAAAL,OAAA;AAA8B,IAAAM,WAAA,GAAAN,OAAA;AAV9B;AACA;;AAeA;AACA;AACA;AACA;AACA;AACe,SAASO,MAAMA,CAC5BC,WAA0B,EAE1B;EAAA,IADAC,OAAiB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EAEtB,MAAMG,SAAS,GAAGC,QAAQ,CAACC,cAAc,CAAC,YAAY,CAAC;EACvD,IAAI,CAACF,SAAS,EAAE,MAAMG,KAAK,CAAC,wCAAwC,CAAC;EACrE,MAAMC,KAAK,gBACT,IAAAX,WAAA,CAAAY,GAAA,EAACjB,iBAAA,CAAAkB,mBAAmB;IAACC,YAAY,EAAE,IAAAC,eAAM,EAAC,CAAC,CAACC,MAAO;IAAAC,QAAA,eACjD,IAAAjB,WAAA,CAAAY,GAAA,EAACf,eAAA,CAAAqB,aAAa;MAACC,MAAM,EAAE;QAAEC,oBAAoB,EAAE;MAAK,CAAE;MAAAH,QAAA,eACpD,IAAAjB,WAAA,CAAAY,GAAA,EAACV,WAAW,IAAE;IAAC,CACF;EAAC,CACG,CACtB;EAED,IAAIC,OAAO,CAACkB,WAAW,EAAE;IACvB,MAAMC,IAAI,GAAG,IAAAC,kBAAU,EAAChB,SAAS,CAAC;IAClCe,IAAI,CAACE,MAAM,CAACb,KAAK,CAAC;EACpB,CAAC,MAAM,IAAAc,mBAAW,EAAClB,SAAS,EAAEI,KAAK,CAAC;AACtC","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["require","_reactGlobalState","_client","_reactRouterDom","_getInj","_interopRequireDefault","_jsxRuntime","Launch","Application","options","arguments","length","undefined","container","document","getElementById","Error","scene","jsx","GlobalStateProvider","initialState","getInj","ISTATE","children","BrowserRouter","future","v7_relativeSplatPath","dontHydrate","root","createRoot","render","hydrateRoot"],"sources":["../../../src/client/index.tsx"],"sourcesContent":["// Initialization of client-side code.\n/* global document */\n\nimport { type ComponentType } from 'react';\n\nimport { GlobalStateProvider } from '@dr.pogodin/react-global-state';\n\nimport { createRoot, hydrateRoot } from 'react-dom/client';\nimport { BrowserRouter } from 'react-router-dom';\n\nimport getInj from './getInj';\n\ntype OptionsT = {\n dontHydrate?: boolean;\n initialState?: any;\n};\n\n/**\n * Prepares and launches the app at client side.\n * @param Application Root application component\n * @param [options={}] Optional. Additional settings.\n */\nexport default function Launch(\n Application: ComponentType,\n options: OptionsT = {},\n) {\n const container = document.getElementById('react-view');\n if (!container) throw Error('Failed to find container for React app');\n const scene = (\n <GlobalStateProvider initialState={getInj().ISTATE || options.initialState}>\n <BrowserRouter future={{ v7_relativeSplatPath: true }}>\n <Application />\n </BrowserRouter>\n </GlobalStateProvider>\n );\n\n if (options.dontHydrate) {\n const root = createRoot(container);\n root.render(scene);\n } else hydrateRoot(container, scene);\n}\n"],"mappings":";;;;;;;AAGAA,OAAA;AAEA,IAAAC,iBAAA,GAAAD,OAAA;AAEA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,eAAA,GAAAH,OAAA;AAEA,IAAAI,OAAA,GAAAC,sBAAA,CAAAL,OAAA;AAA8B,IAAAM,WAAA,GAAAN,OAAA;AAV9B;AACA;;AAgBA;AACA;AACA;AACA;AACA;AACe,SAASO,MAAMA,CAC5BC,WAA0B,EAE1B;EAAA,IADAC,OAAiB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EAEtB,MAAMG,SAAS,GAAGC,QAAQ,CAACC,cAAc,CAAC,YAAY,CAAC;EACvD,IAAI,CAACF,SAAS,EAAE,MAAMG,KAAK,CAAC,wCAAwC,CAAC;EACrE,MAAMC,KAAK,gBACT,IAAAX,WAAA,CAAAY,GAAA,EAACjB,iBAAA,CAAAkB,mBAAmB;IAACC,YAAY,EAAE,IAAAC,eAAM,EAAC,CAAC,CAACC,MAAM,IAAIb,OAAO,CAACW,YAAa;IAAAG,QAAA,eACzE,IAAAjB,WAAA,CAAAY,GAAA,EAACf,eAAA,CAAAqB,aAAa;MAACC,MAAM,EAAE;QAAEC,oBAAoB,EAAE;MAAK,CAAE;MAAAH,QAAA,eACpD,IAAAjB,WAAA,CAAAY,GAAA,EAACV,WAAW,IAAE;IAAC,CACF;EAAC,CACG,CACtB;EAED,IAAIC,OAAO,CAACkB,WAAW,EAAE;IACvB,MAAMC,IAAI,GAAG,IAAAC,kBAAU,EAAChB,SAAS,CAAC;IAClCe,IAAI,CAACE,MAAM,CAACb,KAAK,CAAC;EACpB,CAAC,MAAM,IAAAc,mBAAW,EAAClB,SAAS,EAAEI,KAAK,CAAC;AACtC","ignoreList":[]}
@@ -24,6 +24,7 @@ var _exportNames = {
24
24
  PT: true,
25
25
  getGlobalState: true,
26
26
  GlobalStateProvider: true,
27
+ newAsyncDataEnvelope: true,
27
28
  useAsyncCollection: true,
28
29
  useAsyncData: true,
29
30
  useGlobalState: true,
@@ -97,6 +98,12 @@ Object.defineProperty(exports, "isomorphy", {
97
98
  return _utils.isomorphy;
98
99
  }
99
100
  });
101
+ Object.defineProperty(exports, "newAsyncDataEnvelope", {
102
+ enumerable: true,
103
+ get: function () {
104
+ return _reactGlobalState.newAsyncDataEnvelope;
105
+ }
106
+ });
100
107
  exports.server = void 0;
101
108
  Object.defineProperty(exports, "splitComponent", {
102
109
  enumerable: true,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_utils","require","_axios","_interopRequireDefault","_PT","_interopRequireWildcard","exports","PT","_reactGlobalState","_components","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","defineProperty","enumerable","get","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","n","__proto__","a","getOwnPropertyDescriptor","u","i","set","server","webpack","requireWeak","__dirname","client","undefined"],"sources":["../../src/index.ts"],"sourcesContent":["import 'styles/global.scss';\n\nimport { webpack } from 'utils';\n\nimport type ServerT from './server';\n\nconst server = webpack.requireWeak('./server', __dirname) as (typeof ServerT) | null;\n\nconst client = server ? undefined : require('./client').default;\n\nexport { default as api } from 'axios';\nexport * as PT from 'prop-types';\n\nexport {\n type AsyncCollectionLoaderT,\n type AsyncDataEnvelopeT,\n type AsyncDataLoaderT,\n type ForceT,\n type UseAsyncDataOptionsT,\n type UseAsyncDataResT,\n type UseGlobalStateResT,\n type ValueOrInitializerT,\n getGlobalState,\n GlobalStateProvider,\n useAsyncCollection,\n useAsyncData,\n useGlobalState,\n withGlobalStateType,\n} from '@dr.pogodin/react-global-state';\n\nexport * from 'components';\n\nexport {\n type Theme,\n config,\n Barrier,\n Emitter,\n isomorphy,\n getSsrContext,\n JU,\n Semaphore,\n splitComponent,\n themed,\n ThemeProvider,\n time,\n webpack,\n withRetries,\n} from 'utils';\n\nexport { client, server };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAAA,MAAA,GAAAC,OAAA;AAQA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AAAuC,IAAAG,GAAA,GAAAC,uBAAA,CAAAJ,OAAA;AAAAK,OAAA,CAAAC,EAAA,GAAAH,GAAA;AAGvC,IAAAI,iBAAA,GAAAP,OAAA;AAiBA,IAAAQ,WAAA,GAAAR,OAAA;AAAAS,MAAA,CAAAC,IAAA,CAAAF,WAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAP,OAAA,IAAAA,OAAA,CAAAO,GAAA,MAAAJ,WAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAQ,cAAA,CAAAZ,OAAA,EAAAO,GAAA;IAAAM,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAX,WAAA,CAAAI,GAAA;IAAA;EAAA;AAAA;AAA2B,SAAAQ,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,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.js","names":["_utils","require","_axios","_interopRequireDefault","_PT","_interopRequireWildcard","exports","PT","_reactGlobalState","_components","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","defineProperty","enumerable","get","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","n","__proto__","a","getOwnPropertyDescriptor","u","i","set","server","webpack","requireWeak","__dirname","client","undefined"],"sources":["../../src/index.ts"],"sourcesContent":["import 'styles/global.scss';\n\nimport { webpack } from 'utils';\n\nimport type ServerT from './server';\n\nconst server = webpack.requireWeak('./server', __dirname) as (typeof ServerT) | null;\n\nconst client = server ? undefined : require('./client').default;\n\nexport { default as api } from 'axios';\nexport * as PT from 'prop-types';\n\nexport {\n type AsyncCollectionLoaderT,\n type AsyncDataEnvelopeT,\n type AsyncDataLoaderT,\n type ForceT,\n type UseAsyncDataOptionsT,\n type UseAsyncDataResT,\n type UseGlobalStateResT,\n type ValueOrInitializerT,\n getGlobalState,\n GlobalStateProvider,\n newAsyncDataEnvelope,\n useAsyncCollection,\n useAsyncData,\n useGlobalState,\n withGlobalStateType,\n} from '@dr.pogodin/react-global-state';\n\nexport * from 'components';\n\nexport {\n type Theme,\n config,\n Barrier,\n Emitter,\n isomorphy,\n getSsrContext,\n JU,\n Semaphore,\n splitComponent,\n themed,\n ThemeProvider,\n time,\n webpack,\n withRetries,\n} from 'utils';\n\nexport { client, server };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAAA,MAAA,GAAAC,OAAA;AAQA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AAAuC,IAAAG,GAAA,GAAAC,uBAAA,CAAAJ,OAAA;AAAAK,OAAA,CAAAC,EAAA,GAAAH,GAAA;AAGvC,IAA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AA,CAAAsB,wBAAA,CAAAV,CAAA,EAAAW,CAAA,UAAAC,CAAA,KAAAA,CAAA,CAAAd,GAAA,IAAAc,CAAA,CAAAC,GAAA,IAAAzB,MAAA,CAAAQ,cAAA,CAAAW,CAAA,EAAAI,CAAA,EAAAC,CAAA,IAAAL,CAAA,CAAAI,CAAA,IAAAX,CAAA,CAAAW,CAAA,YAAAJ,CAAA,CAAAF,OAAA,GAAAL,CAAA,EAAAG,CAAA,IAAAA,CAAA,CAAAU,GAAA,CAAAb,CAAA,EAAAO,CAAA,GAAAA,CAAA;AAzB3B,MAAMO,MAAM,GAAA9B,OAAA,CAAA8B,MAAA,GAAGC,cAAO,CAACC,WAAW,aAAaC,SAAS,CAA4B;AAEpF,MAAMC,MAAM,GAAAlC,OAAA,CAAAkC,MAAA,GAAGJ,MAAM,GAAGK,SAAS,GAAGxC,OAAO,WAAW,CAAC,CAAC0B,OAAO","ignoreList":[]}
@@ -24,7 +24,7 @@ const Checkbox = ({
24
24
  theme
25
25
  }) => /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
26
26
  className: theme.container,
27
- children: [label === undefined ? null : /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
27
+ children: [label === undefined ? null : /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
28
28
  className: theme.label,
29
29
  children: label
30
30
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
@@ -56,7 +56,7 @@ const ThemedCheckbox = (0, _reactThemes.default)(Checkbox, 'Checkbox', validThem
56
56
  */
57
57
  Checkbox.propTypes = {
58
58
  checked: _propTypes.default.bool,
59
- label: _propTypes.default.string,
59
+ label: _propTypes.default.node,
60
60
  onChange: _propTypes.default.func,
61
61
  theme: ThemedCheckbox.themeType.isRequired
62
62
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_propTypes","_interopRequireDefault","require","_reactThemes","_jsxRuntime","defaultTheme","validThemeKeys","Checkbox","checked","label","onChange","theme","jsxs","className","container","children","undefined","jsx","checkbox","type","ThemedCheckbox","themed","propTypes","PT","bool","string","func","themeType","isRequired","defaultProps","_default","exports","default"],"sources":["../../../../../src/shared/components/Checkbox/index.tsx"],"sourcesContent":["import PT from 'prop-types';\n\nimport themed, { type Theme } from '@dr.pogodin/react-themes';\n\nimport defaultTheme from './theme.scss';\n\nconst validThemeKeys = ['checkbox', 'container', 'label'] as const;\n\ntype PropT = {\n checked?: boolean;\n label?: string;\n onChange?: React.ChangeEventHandler<HTMLInputElement>;\n theme: Theme<typeof validThemeKeys>;\n};\n\nconst Checkbox: React.FunctionComponent<PropT> = ({\n checked,\n label,\n onChange,\n theme,\n}) => (\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 * Checkbox component theme: a map of\n * CSS classes to append to its elements:\n * @prop [checkbox] to the underlying checkbox `<input>` element.\n * @prop [container] to the root checkbox element.\n * @prop [label] to the checkbox label element.\n */\nconst ThemedCheckbox = themed(\n Checkbox,\n 'Checkbox',\n validThemeKeys,\n defaultTheme,\n);\n\n/**\n * The `<Checkbox>` component implements themeable checkboxes.\n * @param [props] Component properties.\n * @param [props.checked] Checkbox value.\n * @param [props.label] Checkbox label.\n * @param [props.onChange] State change handler.\n * @param [props.theme] _Ad hoc_ theme.\n * @param [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,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,YAAA,GAAAF,sBAAA,CAAAC,OAAA;AAA8D,IAAAE,WAAA,GAAA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"version":3,"file":"index.js","names":["_propTypes","_interopRequireDefault","require","_reactThemes","_jsxRuntime","defaultTheme","validThemeKeys","Checkbox","checked","label","onChange","theme","jsxs","className","container","children","undefined","jsx","checkbox","type","ThemedCheckbox","themed","propTypes","PT","bool","node","func","themeType","isRequired","defaultProps","_default","exports","default"],"sources":["../../../../../src/shared/components/Checkbox/index.tsx"],"sourcesContent":["import PT from 'prop-types';\n\nimport themed, { type Theme } from '@dr.pogodin/react-themes';\n\nimport defaultTheme from './theme.scss';\n\nconst validThemeKeys = ['checkbox', 'container', 'label'] as const;\n\ntype PropT = {\n checked?: boolean;\n label?: React.ReactNode;\n onChange?: React.ChangeEventHandler<HTMLInputElement>;\n theme: Theme<typeof validThemeKeys>;\n};\n\nconst Checkbox: React.FunctionComponent<PropT> = ({\n checked,\n label,\n onChange,\n theme,\n}) => (\n <div className={theme.container}>\n { label === undefined ? null : <div className={theme.label}>{label}</div> }\n <input\n checked={checked}\n className={theme.checkbox}\n onChange={onChange}\n type=\"checkbox\"\n />\n </div>\n);\n\n/**\n * Checkbox component theme: a map of\n * CSS classes to append to its elements:\n * @prop [checkbox] to the underlying checkbox `<input>` element.\n * @prop [container] to the root checkbox element.\n * @prop [label] to the checkbox label element.\n */\nconst ThemedCheckbox = themed(\n Checkbox,\n 'Checkbox',\n validThemeKeys,\n defaultTheme,\n);\n\n/**\n * The `<Checkbox>` component implements themeable checkboxes.\n * @param [props] Component properties.\n * @param [props.checked] Checkbox value.\n * @param [props.label] Checkbox label.\n * @param [props.onChange] State change handler.\n * @param [props.theme] _Ad hoc_ theme.\n * @param [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.node,\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":";;;;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EO,SAAS;EAChBN,QAAQ,EAAEM;AACZ,CAAC;AAAC,IAAAc,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEaZ,cAAc","ignoreList":[]}
@@ -33,7 +33,7 @@ const Input = /*#__PURE__*/(0, _react.forwardRef)(({
33
33
  ...rest
34
34
  }, ref) => /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
35
35
  className: theme.container,
36
- children: [label === undefined ? null : /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
36
+ children: [label === undefined ? null : /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
37
37
  className: theme.label,
38
38
  children: label
39
39
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
@@ -44,7 +44,7 @@ const Input = /*#__PURE__*/(0, _react.forwardRef)(({
44
44
  }));
45
45
  const ThemedInput = (0, _reactThemes.default)(Input, 'Input', validThemeKeys, defaultTheme);
46
46
  Input.propTypes = {
47
- label: _propTypes.default.string,
47
+ label: _propTypes.default.node,
48
48
  theme: ThemedInput.themeType.isRequired
49
49
  };
50
50
  Input.defaultProps = {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_propTypes","_interopRequireDefault","require","_react","_reactThemes","_jsxRuntime","defaultTheme","validThemeKeys","Input","forwardRef","label","theme","rest","ref","jsxs","className","container","children","undefined","jsx","input","ThemedInput","themed","propTypes","PT","string","themeType","isRequired","defaultProps","_default","exports","default"],"sources":["../../../../../src/shared/components/Input/index.tsx"],"sourcesContent":["import PT from 'prop-types';\nimport { forwardRef } from 'react';\n\nimport themed, { type Theme } from '@dr.pogodin/react-themes';\n\nimport defaultTheme from './theme.scss';\n\nconst validThemeKeys = [\n 'container',\n 'input',\n 'label',\n] as const;\n\ntype PropsT = React.InputHTMLAttributes<HTMLInputElement> & {\n label?: string;\n theme: Theme<typeof validThemeKeys>;\n};\n\n/**\n * Themeable input field, based on the standard HTML `<input>` element.\n * @param [props]\n * @param [props.label] Input label.\n * @param [props.theme] _Ad hoc_ theme.\n * @param [props...] [Other theming properties](https://www.npmjs.com/package/@dr.pogodin/react-themes#themed-component-properties)\n * @param [props...] Any other properties are passed to the underlying\n * `<input>` element.\n */\nconst Input = forwardRef<HTMLInputElement, PropsT>((\n {\n label,\n theme,\n ...rest\n }: PropsT,\n ref,\n) => (\n <span className={theme.container}>\n { label === undefined ? null : <p className={theme.label}>{label}</p> }\n <input\n className={theme.input}\n ref={ref}\n {...rest} // eslint-disable-line react/jsx-props-no-spreading\n />\n </span>\n));\n\nconst ThemedInput = themed(Input, 'Input', validThemeKeys, defaultTheme);\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,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAEA,IAAAE,YAAA,GAAAH,sBAAA,CAAAC,OAAA;AAA8D,IAAAG,WAAA,GAAAH,OAAA;AAAA,MAAAI,YAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAI9D,MAAMC,cAAc,GAAG,CACrB,WAAW,EACX,OAAO,EACP,OAAO,CACC;AAOV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,KAAK,gBAAG,IAAAC,iBAAU,EAA2B,CACjD;EACEC,KAAK;EACLC,KAAK;EACL,GAAGC;AACG,CAAC,EACTC,GAAG,kBAEH,IAAAR,WAAA,CAAAS,IAAA;EAAMC,SAAS,EAAEJ,KAAK,CAACK,SAAU;EAAAC,QAAA,GAC7BP,KAAK,KAAKQ,SAAS,GAAG,IAAI,gBAAG,IAAAb,WAAA,CAAAc,GAAA;IAAGJ,SAAS,EAAEJ,KAAK,CAACD,KAAM;IAAAO,QAAA,EAAEP;EAAK,CAAI,CAAC,eACrE,IAAAL,WAAA,CAAAc,GAAA;IACEJ,SAAS,EAAEJ,KAAK,CAACS,KAAM;IACvBP,GAAG,EAAEA,GAAI;IAAA,GACLD;EAAI,CACT,CAAC;AAAA,CACE,CACP,CAAC;AAEF,MAAMS,WAAW,GAAG,IAAAC,oBAAM,EAACd,KAAK,EAAE,OAAO,EAAED,cAAc,EAAED,YAAY,CAAC;AAExEE,KAAK,CAACe,SAAS,GAAG;EAChBb,KAAK,EAAEc,kBAAE,CAACC,MAAM;EAChBd,KAAK,EAAEU,WAAW,CAACK,SAAS,CAACC;AAC/B,CAAC;AAEDnB,KAAK,CAACoB,YAAY,GAAG;EACnBlB,KAAK,EAAEQ;AACT,CAAC;AAAC,IAAAW,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEaV,WAAW","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["_propTypes","_interopRequireDefault","require","_react","_reactThemes","_jsxRuntime","defaultTheme","validThemeKeys","Input","forwardRef","label","theme","rest","ref","jsxs","className","container","children","undefined","jsx","input","ThemedInput","themed","propTypes","PT","node","themeType","isRequired","defaultProps","_default","exports","default"],"sources":["../../../../../src/shared/components/Input/index.tsx"],"sourcesContent":["import PT from 'prop-types';\nimport { forwardRef } from 'react';\n\nimport themed, { type Theme } from '@dr.pogodin/react-themes';\n\nimport defaultTheme from './theme.scss';\n\nconst validThemeKeys = [\n 'container',\n 'input',\n 'label',\n] as const;\n\ntype PropsT = React.InputHTMLAttributes<HTMLInputElement> & {\n label?: React.ReactNode;\n theme: Theme<typeof validThemeKeys>;\n};\n\n/**\n * Themeable input field, based on the standard HTML `<input>` element.\n * @param [props]\n * @param [props.label] Input label.\n * @param [props.theme] _Ad hoc_ theme.\n * @param [props...] [Other theming properties](https://www.npmjs.com/package/@dr.pogodin/react-themes#themed-component-properties)\n * @param [props...] Any other properties are passed to the underlying\n * `<input>` element.\n */\nconst Input = forwardRef<HTMLInputElement, PropsT>((\n {\n label,\n theme,\n ...rest\n }: PropsT,\n ref,\n) => (\n <span className={theme.container}>\n { label === undefined ? null : <div className={theme.label}>{label}</div> }\n <input\n className={theme.input}\n ref={ref}\n {...rest} // eslint-disable-line react/jsx-props-no-spreading\n />\n </span>\n));\n\nconst ThemedInput = themed(Input, 'Input', validThemeKeys, defaultTheme);\n\nInput.propTypes = {\n label: PT.node,\n theme: ThemedInput.themeType.isRequired,\n};\n\nInput.defaultProps = {\n label: undefined,\n};\n\nexport default ThemedInput;\n"],"mappings":";;;;;;;AAAA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAEA,IAAAE,YAAA,GAAAH,sBAAA,CAAAC,OAAA;AAA8D,IAAAG,WAAA,GAAAH,OAAA;AAAA,MAAAI,YAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAI9D,MAAMC,cAAc,GAAG,CACrB,WAAW,EACX,OAAO,EACP,OAAO,CACC;AAOV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,KAAK,gBAAG,IAAAC,iBAAU,EAA2B,CACjD;EACEC,KAAK;EACLC,KAAK;EACL,GAAGC;AACG,CAAC,EACTC,GAAG,kBAEH,IAAAR,WAAA,CAAAS,IAAA;EAAMC,SAAS,EAAEJ,KAAK,CAACK,SAAU;EAAAC,QAAA,GAC7BP,KAAK,KAAKQ,SAAS,GAAG,IAAI,gBAAG,IAAAb,WAAA,CAAAc,GAAA;IAAKJ,SAAS,EAAEJ,KAAK,CAACD,KAAM;IAAAO,QAAA,EAAEP;EAAK,CAAM,CAAC,eACzE,IAAAL,WAAA,CAAAc,GAAA;IACEJ,SAAS,EAAEJ,KAAK,CAACS,KAAM;IACvBP,GAAG,EAAEA,GAAI;IAAA,GACLD;EAAI,CACT,CAAC;AAAA,CACE,CACP,CAAC;AAEF,MAAMS,WAAW,GAAG,IAAAC,oBAAM,EAACd,KAAK,EAAE,OAAO,EAAED,cAAc,EAAED,YAAY,CAAC;AAExEE,KAAK,CAACe,SAAS,GAAG;EAChBb,KAAK,EAAEc,kBAAE,CAACC,IAAI;EACdd,KAAK,EAAEU,WAAW,CAACK,SAAS,CAACC;AAC/B,CAAC;AAEDnB,KAAK,CAACoB,YAAY,GAAG;EACnBlB,KAAK,EAAEQ;AACT,CAAC;AAAC,IAAAW,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEaV,WAAW","ignoreList":[]}
@@ -19,6 +19,9 @@ const baseTheme = {
19
19
  "overlay": "-dr-pogodin-react-utils___src-shared-components-Modal-base-theme___overlay___ye2BZo",
20
20
  "container": "-dr-pogodin-react-utils___src-shared-components-Modal-base-theme___container___gyZ4rc"
21
21
  };
22
+ const S = {
23
+ "scrollingDisabledByModal": "-dr-pogodin-react-utils___src-shared-components-Modal-styles___scrollingDisabledByModal___5fRFtF"
24
+ };
22
25
  const validThemeKeys = ['container', 'overlay'];
23
26
  /**
24
27
  * The `<Modal>` component implements a simple themeable modal window, wrapped
@@ -33,6 +36,8 @@ const validThemeKeys = ['container', 'overlay'];
33
36
  */
34
37
  const BaseModal = ({
35
38
  children,
39
+ containerStyle,
40
+ dontDisableScrolling,
36
41
  onCancel,
37
42
  theme
38
43
  }) => {
@@ -41,14 +46,24 @@ const BaseModal = ({
41
46
  const [portal, setPortal] = (0, _react.useState)();
42
47
  (0, _react.useEffect)(() => {
43
48
  const p = document.createElement('div');
44
- document.body.classList.add('scrolling-disabled-by-modal');
45
49
  document.body.appendChild(p);
46
50
  setPortal(p);
47
51
  return () => {
48
- document.body.classList.remove('scrolling-disabled-by-modal');
49
52
  document.body.removeChild(p);
50
53
  };
51
54
  }, []);
55
+
56
+ // Disables window scrolling, if it is not opted-out.
57
+ (0, _react.useEffect)(() => {
58
+ if (!dontDisableScrolling) {
59
+ document.body.classList.add(S.scrollingDisabledByModal);
60
+ }
61
+ return () => {
62
+ if (!dontDisableScrolling) {
63
+ document.body.classList.remove(S.scrollingDisabledByModal);
64
+ }
65
+ };
66
+ }, [dontDisableScrolling]);
52
67
  const focusLast = (0, _react.useMemo)(() => /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
53
68
  onFocus: () => {
54
69
  const elems = containerRef.current?.querySelectorAll('*');
@@ -84,6 +99,7 @@ const BaseModal = ({
84
99
  onWheel: event => event.stopPropagation(),
85
100
  ref: containerRef,
86
101
  role: "dialog",
102
+ style: containerStyle,
87
103
  children: children
88
104
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
89
105
  onFocus: () => {
@@ -98,13 +114,17 @@ const BaseModal = ({
98
114
  exports.BaseModal = BaseModal;
99
115
  const ThemedModal = (0, _reactThemes.default)(BaseModal, 'Modal', validThemeKeys, baseTheme);
100
116
  BaseModal.propTypes = {
101
- onCancel: _propTypes.default.func,
102
117
  children: _propTypes.default.node,
118
+ containerStyle: _propTypes.default.shape({}),
119
+ dontDisableScrolling: _propTypes.default.bool,
120
+ onCancel: _propTypes.default.func,
103
121
  theme: ThemedModal.themeType.isRequired
104
122
  };
105
123
  BaseModal.defaultProps = {
106
- onCancel: _lodash.noop,
107
- children: null
124
+ children: null,
125
+ containerStyle: undefined,
126
+ dontDisableScrolling: false,
127
+ onCancel: _lodash.noop
108
128
  };
109
129
  var _default = exports.default = ThemedModal;
110
130
  /* Non-themed version of the Modal. */
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_lodash","require","_react","_reactDom","_interopRequireDefault","_propTypes","_reactThemes","_jsxRuntime","baseTheme","validThemeKeys","BaseModal","children","onCancel","theme","containerRef","useRef","overlayRef","portal","setPortal","useState","useEffect","p","document","createElement","body","classList","add","appendChild","remove","removeChild","focusLast","useMemo","jsx","onFocus","elems","current","querySelectorAll","i","length","focus","activeElement","tabIndex","ReactDom","createPortal","jsxs","Fragment","className","overlay","onClick","onKeyDown","e","key","ref","node","role","container","onWheel","event","stopPropagation","exports","ThemedModal","themed","propTypes","PT","func","themeType","isRequired","defaultProps","noop","_default","default"],"sources":["../../../../../src/shared/components/Modal/index.tsx"],"sourcesContent":["/* global document */\n\nimport { noop } from 'lodash';\n\nimport {\n type ReactNode,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\n\nimport ReactDom from 'react-dom';\nimport PT from 'prop-types';\nimport themed, { type Theme } from '@dr.pogodin/react-themes';\n\nimport baseTheme from './base-theme.scss';\nimport './styles.scss';\n\nconst validThemeKeys = ['container', 'overlay'] as const;\n\ntype PropsT = {\n children?: ReactNode;\n onCancel?: () => void;\n theme: Theme<typeof validThemeKeys>;\n};\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 */\nconst BaseModal: React.FunctionComponent<PropsT> = ({\n children,\n onCancel,\n theme,\n}) => {\n const containerRef = useRef<HTMLDivElement | null>(null);\n const overlayRef = useRef<HTMLDivElement | null>(null);\n const [portal, setPortal] = useState<HTMLDivElement>();\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('*') as NodeListOf<HTMLElement>;\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 && onCancel()}\n onKeyDown={(e) => {\n if (e.key === 'Escape' && onCancel) 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 BaseModal,\n 'Modal',\n validThemeKeys,\n baseTheme,\n);\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,IAAAA,OAAA,GAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AAQA,IAAAE,SAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,UAAA,GAAAD,sBAAA,CAAAH,OAAA;AACA,IAAAK,YAAA,GAAAF,sBAAA,CAAAH,OAAA;AAA8D,IAAAM,WAAA,GAAAN,OAAA;AAd9D;AAAA,MAAAO,SAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAmBA,MAAMC,cAAc,GAAG,CAAC,WAAW,EAAE,SAAS,CAAU;AAQxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,SAA0C,GAAGA,CAAC;EAClDC,QAAQ;EACRC,QAAQ;EACRC;AACF,CAAC,KAAK;EACJ,MAAMC,YAAY,GAAG,IAAAC,aAAM,EAAwB,IAAI,CAAC;EACxD,MAAMC,UAAU,GAAG,IAAAD,aAA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,QAAQ,EAAEmD,kBAAE,CAACC,IAAI;EACjBrD,QAAQ,EAAEoD,kBAAE,CAACV,IAAI;EACjBxC,KAAK,EAAE+C,WAAW,CAACK,SAAS,CAACC;AAC/B,CAAC;AAEDxD,SAAS,CAACyD,YAAY,GAAG;EACvBvD,QAAQ,EAAEwD,YAAI;EACdzD,QAAQ,EAAE;AACZ,CAAC;AAAC,IAAA0D,QAAA,GAAAV,OAAA,CAAAW,OAAA,GAEaV,WAAW;AAE1B","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["_lodash","require","_react","_reactDom","_interopRequireDefault","_propTypes","_reactThemes","_jsxRuntime","baseTheme","S","validThemeKeys","BaseModal","children","containerStyle","dontDisableScrolling","onCancel","theme","containerRef","useRef","overlayRef","portal","setPortal","useState","useEffect","p","document","createElement","body","appendChild","removeChild","classList","add","scrollingDisabledByModal","remove","focusLast","useMemo","jsx","onFocus","elems","current","querySelectorAll","i","length","focus","activeElement","tabIndex","ReactDom","createPortal","jsxs","Fragment","className","overlay","onClick","onKeyDown","e","key","ref","node","role","container","onWheel","event","stopPropagation","style","exports","ThemedModal","themed","propTypes","PT","shape","bool","func","themeType","isRequired","defaultProps","undefined","noop","_default","default"],"sources":["../../../../../src/shared/components/Modal/index.tsx"],"sourcesContent":["/* global document */\n\nimport { noop } from 'lodash';\n\nimport {\n type ReactNode,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\n\nimport ReactDom from 'react-dom';\nimport PT from 'prop-types';\nimport themed, { type Theme } from '@dr.pogodin/react-themes';\n\nimport baseTheme from './base-theme.scss';\nimport S from './styles.scss';\n\nconst validThemeKeys = ['container', 'overlay'] as const;\n\ntype PropsT = {\n children?: ReactNode;\n containerStyle?: React.CSSProperties;\n dontDisableScrolling?: boolean;\n onCancel?: () => void;\n theme: Theme<typeof validThemeKeys>;\n};\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 */\nconst BaseModal: React.FunctionComponent<PropsT> = ({\n children,\n containerStyle,\n dontDisableScrolling,\n onCancel,\n theme,\n}) => {\n const containerRef = useRef<HTMLDivElement | null>(null);\n const overlayRef = useRef<HTMLDivElement | null>(null);\n const [portal, setPortal] = useState<HTMLDivElement>();\n\n useEffect(() => {\n const p = document.createElement('div');\n document.body.appendChild(p);\n setPortal(p);\n return () => {\n document.body.removeChild(p);\n };\n }, []);\n\n // Disables window scrolling, if it is not opted-out.\n useEffect(() => {\n if (!dontDisableScrolling) {\n document.body.classList.add(S.scrollingDisabledByModal);\n }\n return () => {\n if (!dontDisableScrolling) {\n document.body.classList.remove(S.scrollingDisabledByModal);\n }\n };\n }, [dontDisableScrolling]);\n\n const focusLast = useMemo(() => (\n <div\n onFocus={() => {\n const elems = containerRef.current?.querySelectorAll('*') as NodeListOf<HTMLElement>;\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 && onCancel()}\n onKeyDown={(e) => {\n if (e.key === 'Escape' && onCancel) 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 style={containerStyle}\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 BaseModal,\n 'Modal',\n validThemeKeys,\n baseTheme,\n);\n\nBaseModal.propTypes = {\n children: PT.node,\n containerStyle: PT.shape({}),\n dontDisableScrolling: PT.bool,\n onCancel: PT.func,\n theme: ThemedModal.themeType.isRequired,\n};\n\nBaseModal.defaultProps = {\n children: null,\n containerStyle: undefined,\n dontDisableScrolling: false,\n onCancel: noop,\n};\n\nexport default ThemedModal;\n\n/* Non-themed version of the Modal. */\nexport { BaseModal };\n"],"mappings":";;;;;;;AAEA,IAAAA,OAAA,GAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AAQA,IAAAE,SAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,UAAA,GAAAD,sBAAA,CAAAH,OAAA;AACA,IAAAK,YAAA,GAAAF,sBAAA,CAAAH,OAAA;AAA8D,IAAAM,WAAA,GAAAN,OAAA;AAd9D;AAAA,MAAAO,SAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAAA,MAAAC,CAAA;EAAA;AAAA;AAmBA,MAAMC,cAAc,GAAG,CAAC,WAAW,EAAE,SAAS,CAAU;AAUxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,SAA0C,GAAGA,CAAC;EAClDC,QAAQ;EACRC,cAAc;EACdC,oBAAoB;EACpBC,QAAQ;EACRC;AACF,CAAC,KAAK;EACJ,MAAMC,YAAY,GAAG,IAAAC,aAAM,EAAwB,IAAI,CAAC;EACxD,MAAMC,UAAU,GAAG,IAAAD,aAAM,EAAwB,IAAI,CAAC;EACtD,MAAM,CAACE,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AG,IAAI;AACV,CAAC;AAAC4C,OAAA,CAAArD,SAAA,GAAAA,SAAA;AAEF,MAAMsD,WAAW,GAAG,IAAAC,oBAAM,EACxBvD,SAAS,EACT,OAAO,EACPD,cAAc,EACdF,SACF,CAAC;AAEDG,SAAS,CAACwD,SAAS,GAAG;EACpBvD,QAAQ,EAAEwD,kBAAE,CAACX,IAAI;EACjB5C,cAAc,EAAEuD,kBAAE,CAACC,KAAK,CAAC,CAAC,CAAC,CAAC;EAC5BvD,oBAAoB,EAAEsD,kBAAE,CAACE,IAAI;EAC7BvD,QAAQ,EAAEqD,kBAAE,CAACG,IAAI;EACjBvD,KAAK,EAAEiD,WAAW,CAACO,SAAS,CAACC;AAC/B,CAAC;AAED9D,SAAS,CAAC+D,YAAY,GAAG;EACvB9D,QAAQ,EAAE,IAAI;EACdC,cAAc,EAAE8D,SAAS;EACzB7D,oBAAoB,EAAE,KAAK;EAC3BC,QAAQ,EAAE6D;AACZ,CAAC;AAAC,IAAAC,QAAA,GAAAb,OAAA,CAAAc,OAAA,GAEab,WAAW;AAE1B","ignoreList":[]}
@@ -19,6 +19,7 @@ const defaultTheme = {
19
19
  };
20
20
  const validThemeKeys = ['container', 'hidden', 'textarea'];
21
21
  const TextArea = ({
22
+ disabled,
22
23
  onChange,
23
24
  onKeyDown,
24
25
  placeholder,
@@ -60,9 +61,11 @@ const TextArea = ({
60
61
  className: `${theme.textarea} ${theme.hidden}`,
61
62
  value: localValue
62
63
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("textarea", {
64
+ disabled: disabled
63
65
  // When value is "undefined" the text area is not-managed, and we should
64
66
  // manage it internally for the measurement / resizing functionality
65
67
  // to work.
68
+ ,
66
69
  onChange: value === undefined ? e => {
67
70
  setLocalValue(e.target.value);
68
71
  } : onChange,
@@ -78,6 +81,7 @@ const TextArea = ({
78
81
  };
79
82
  const ThemedTextArea = (0, _reactThemes.default)(TextArea, 'TextArea', validThemeKeys, defaultTheme);
80
83
  TextArea.propTypes = {
84
+ disabled: _propTypes.default.bool,
81
85
  onChange: _propTypes.default.func,
82
86
  onKeyDown: _propTypes.default.func,
83
87
  placeholder: _propTypes.default.string,
@@ -85,6 +89,7 @@ TextArea.propTypes = {
85
89
  value: _propTypes.default.string
86
90
  };
87
91
  TextArea.defaultProps = {
92
+ disabled: false,
88
93
  onChange: undefined,
89
94
  onKeyDown: undefined,
90
95
  placeholder: '',
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_react","require","_propTypes","_interopRequireDefault","_reactThemes","_jsxRuntime","defaultTheme","validThemeKeys","TextArea","onChange","onKeyDown","placeholder","theme","value","hiddenAreaRef","useRef","height","setHeight","useState","localValue","setLocalValue","undefined","useEffect","el","current","cb","scrollHeight","observer","ResizeObserver","observe","disconnect","jsxs","className","container","children","jsx","readOnly","ref","textarea","hidden","e","target","style","ThemedTextArea","themed","propTypes","PT","func","string","themeType","isRequired","defaultProps","_default","exports","default"],"sources":["../../../../../src/shared/components/TextArea/index.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\nimport PT from 'prop-types';\n\nimport themed, { type Theme } from '@dr.pogodin/react-themes';\n\nimport defaultTheme from './style.scss';\n\nconst validThemeKeys = [\n 'container',\n 'hidden',\n 'textarea',\n] as const;\n\ntype Props = {\n onChange?: React.ChangeEventHandler<HTMLTextAreaElement>;\n onKeyDown?: React.KeyboardEventHandler<HTMLTextAreaElement>;\n placeholder?: string;\n theme: Theme<typeof validThemeKeys>;\n value?: string;\n};\n\nconst TextArea: React.FunctionComponent<Props> = ({\n onChange,\n onKeyDown,\n placeholder,\n theme,\n value,\n}) => {\n const hiddenAreaRef = useRef<HTMLTextAreaElement>(null);\n const [height, setHeight] = useState<number | undefined>();\n\n const [localValue, setLocalValue] = useState(value || '');\n if (value !== undefined && localValue !== value) setLocalValue(value);\n\n // This resizes text area's height when its width is changed for any reason.\n useEffect(() => {\n const el = hiddenAreaRef.current;\n if (!el) return undefined;\n\n const cb = () => {\n setHeight(el.scrollHeight);\n };\n const observer = new ResizeObserver(cb);\n observer.observe(el);\n\n return () => {\n observer.disconnect();\n };\n }, []);\n\n // This resizes the text area when its content is modified.\n useEffect(() => {\n const el = hiddenAreaRef.current;\n if (el) setHeight(el.scrollHeight);\n }, [localValue]);\n\n return (\n <div className={theme.container}>\n <textarea\n // This text area is hidden underneath the primary one below,\n // and it is used for text measurements, to implement auto-scaling\n // of the primary textarea's height.\n readOnly\n ref={hiddenAreaRef}\n className={`${theme.textarea} ${theme.hidden}`}\n value={localValue}\n />\n <textarea\n // When value is \"undefined\" the text area is not-managed, and we should\n // manage it internally for the measurement / resizing functionality\n // to work.\n onChange={value === undefined ? ((e) => {\n setLocalValue(e.target.value);\n }) : onChange}\n onKeyDown={onKeyDown}\n placeholder={placeholder}\n style={{ height }}\n className={theme.textarea}\n value={localValue}\n />\n </div>\n );\n};\n\nconst ThemedTextArea = themed(\n TextArea,\n 'TextArea',\n validThemeKeys,\n defaultTheme,\n);\n\nTextArea.propTypes = {\n onChange: PT.func,\n onKeyDown: PT.func,\n placeholder: PT.string,\n theme: ThemedTextArea.themeType.isRequired,\n value: PT.string,\n};\n\nTextArea.defaultProps = {\n onChange: undefined,\n onKeyDown: undefined,\n placeholder: '',\n value: undefined,\n};\n\nexport default ThemedTextArea;\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAAG,YAAA,GAAAD,sBAAA,CAAAF,OAAA;AAA8D,IAAAI,WAAA,GAAAJ,OAAA;AAAA,MAAAK,YAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAI9D,MAAMC,cAAc,GAAG,CACrB,WAAW,EACX,QAAQ,EACR,UAAU,CACF;AAUV,MAAMC,QAAwC,GAAGA,CAAC;EAChDC,QAAQ;EACRC,SAAS;EACTC,WAAW;EACXC,KAAK;EACLC;AACF,CAAC,KAAK;EACJ,MAAMC,aAAa,GAAG,I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A8B,GAAA;MACE;MACA;MACA;MACA1B,QAAQ,EAAEI,KAAK,KAAKQ,SAAS,GAAKmB,CAAC,IAAK;QACtCpB,aAAa,CAACoB,CAAC,CAACC,MAAM,CAAC5B,KAAK,CAAC;MAC/B,CAAC,GAAIJ,QAAS;MACdC,SAAS,EAAEA,SAAU;MACrBC,WAAW,EAAEA,WAAY;MACzB+B,KAAK,EAAE;QAAE1B;MAAO,CAAE;MAClBgB,SAAS,EAAEpB,KAAK,CAAC0B,QAAS;MAC1BzB,KAAK,EAAEM;IAAW,CACnB,CAAC;EAAA,CACC,CAAC;AAEV,CAAC;AAED,MAAMwB,cAAc,GAAG,IAAAC,oBAAM,EAC3BpC,QAAQ,EACR,UAAU,EACVD,cAAc,EACdD,YACF,CAAC;AAEDE,QAAQ,CAACqC,SAAS,GAAG;EACnBpC,QAAQ,EAAEqC,kBAAE,CAACC,IAAI;EACjBrC,SAAS,EAAEoC,kBAAE,CAACC,IAAI;EAClBpC,WAAW,EAAEmC,kBAAE,CAACE,MAAM;EACtBpC,KAAK,EAAE+B,cAAc,CAACM,SAAS,CAACC,UAAU;EAC1CrC,KAAK,EAAEiC,kBAAE,CAACE;AACZ,CAAC;AAEDxC,QAAQ,CAAC2C,YAAY,GAAG;EACtB1C,QAAQ,EAAEY,SAAS;EACnBX,SAAS,EAAEW,SAAS;EACpBV,WAAW,EAAE,EAAE;EACfE,KAAK,EAAEQ;AACT,CAAC;AAAC,IAAA+B,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEaX,cAAc","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["_react","require","_propTypes","_interopRequireDefault","_reactThemes","_jsxRuntime","defaultTheme","validThemeKeys","TextArea","disabled","onChange","onKeyDown","placeholder","theme","value","hiddenAreaRef","useRef","height","setHeight","useState","localValue","setLocalValue","undefined","useEffect","el","current","cb","scrollHeight","observer","ResizeObserver","observe","disconnect","jsxs","className","container","children","jsx","readOnly","ref","textarea","hidden","e","target","style","ThemedTextArea","themed","propTypes","PT","bool","func","string","themeType","isRequired","defaultProps","_default","exports","default"],"sources":["../../../../../src/shared/components/TextArea/index.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\nimport PT from 'prop-types';\n\nimport themed, { type Theme } from '@dr.pogodin/react-themes';\n\nimport defaultTheme from './style.scss';\n\nconst validThemeKeys = [\n 'container',\n 'hidden',\n 'textarea',\n] as const;\n\ntype Props = {\n disabled?: boolean;\n onChange?: React.ChangeEventHandler<HTMLTextAreaElement>;\n onKeyDown?: React.KeyboardEventHandler<HTMLTextAreaElement>;\n placeholder?: string;\n theme: Theme<typeof validThemeKeys>;\n value?: string;\n};\n\nconst TextArea: React.FunctionComponent<Props> = ({\n disabled,\n onChange,\n onKeyDown,\n placeholder,\n theme,\n value,\n}) => {\n const hiddenAreaRef = useRef<HTMLTextAreaElement>(null);\n const [height, setHeight] = useState<number | undefined>();\n\n const [localValue, setLocalValue] = useState(value || '');\n if (value !== undefined && localValue !== value) setLocalValue(value);\n\n // This resizes text area's height when its width is changed for any reason.\n useEffect(() => {\n const el = hiddenAreaRef.current;\n if (!el) return undefined;\n\n const cb = () => {\n setHeight(el.scrollHeight);\n };\n const observer = new ResizeObserver(cb);\n observer.observe(el);\n\n return () => {\n observer.disconnect();\n };\n }, []);\n\n // This resizes the text area when its content is modified.\n useEffect(() => {\n const el = hiddenAreaRef.current;\n if (el) setHeight(el.scrollHeight);\n }, [localValue]);\n\n return (\n <div className={theme.container}>\n <textarea\n // This text area is hidden underneath the primary one below,\n // and it is used for text measurements, to implement auto-scaling\n // of the primary textarea's height.\n readOnly\n ref={hiddenAreaRef}\n className={`${theme.textarea} ${theme.hidden}`}\n value={localValue}\n />\n <textarea\n disabled={disabled}\n // When value is \"undefined\" the text area is not-managed, and we should\n // manage it internally for the measurement / resizing functionality\n // to work.\n onChange={value === undefined ? ((e) => {\n setLocalValue(e.target.value);\n }) : onChange}\n onKeyDown={onKeyDown}\n placeholder={placeholder}\n style={{ height }}\n className={theme.textarea}\n value={localValue}\n />\n </div>\n );\n};\n\nconst ThemedTextArea = themed(\n TextArea,\n 'TextArea',\n validThemeKeys,\n defaultTheme,\n);\n\nTextArea.propTypes = {\n disabled: PT.bool,\n onChange: PT.func,\n onKeyDown: PT.func,\n placeholder: PT.string,\n theme: ThemedTextArea.themeType.isRequired,\n value: PT.string,\n};\n\nTextArea.defaultProps = {\n disabled: false,\n onChange: undefined,\n onKeyDown: undefined,\n placeholder: '',\n value: undefined,\n};\n\nexport default ThemedTextArea;\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAAG,YAAA,GAAAD,sBAAA,CAAAF,OAAA;AAA8D,IAAAI,WAAA,GAAAJ,OAAA;AAAA,MAAAK,YAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAI9D,MAAMC,cAAc,GAAG,CACrB,WAAW,EACX,QAAQ,EACR,UAAU,CACF;AAWV,MAAMC,QAAwC,GAAGA,CAAC;EAChDC,QAAQ;EACRC,QAAQ;EACRC,SAAS;EACTC,WAAW;EACXC,KAAK;EACLC;AACF,CAAC,KAAK;EACJ,MAAMC,aAAa,GAAG,IAAAC,aAAM,EAAsB,IAAI,CAAC;EACvD,MAAM,CAACC,MAAM,EAAEC,SAAS,CAAC,GAAG,IAAAC,eAAQ,EAAqB,CAAC;EAE1D,MAAM,CAACC,UAAU,EAAEC,aAAa,CAAC,GAAG,IAAAF,eAAQ,EAACL,KAAK,IAAI,EAAE,CAAC;EACzD,IAAIA,KAAK,KAAKQ,SAAS,IAAIF,UAAU,KAAKN,KAAK,EAAEO,aAAa,CAACP,KAAK,CAAC;;EAErE;EACA,IAAAS,gBAAS,EAAC,MAAM;IACd,MAAMC,EAAE,GAAGT,aAAa,CAACU,OAAO;IAChC,IAAI,CAACD,EAAE,EAAE,OAAOF,SAAS;IAEzB,MAAMI,EAAE,GAAGA,CAAA,KAAM;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AQ,EACR,UAAU,EACVD,cAAc,EACdD,YACF,CAAC;AAEDE,QAAQ,CAACsC,SAAS,GAAG;EACnBrC,QAAQ,EAAEsC,kBAAE,CAACC,IAAI;EACjBtC,QAAQ,EAAEqC,kBAAE,CAACE,IAAI;EACjBtC,SAAS,EAAEoC,kBAAE,CAACE,IAAI;EAClBrC,WAAW,EAAEmC,kBAAE,CAACG,MAAM;EACtBrC,KAAK,EAAE+B,cAAc,CAACO,SAAS,CAACC,UAAU;EAC1CtC,KAAK,EAAEiC,kBAAE,CAACG;AACZ,CAAC;AAED1C,QAAQ,CAAC6C,YAAY,GAAG;EACtB5C,QAAQ,EAAE,KAAK;EACfC,QAAQ,EAAEY,SAAS;EACnBX,SAAS,EAAEW,SAAS;EACpBV,WAAW,EAAE,EAAE;EACfE,KAAK,EAAEQ;AACT,CAAC;AAAC,IAAAgC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEaZ,cAAc","ignoreList":[]}
@@ -8,7 +8,6 @@ exports.default = void 0;
8
8
  var _propTypes = _interopRequireDefault(require("prop-types"));
9
9
  var _qs = _interopRequireDefault(require("qs"));
10
10
  var _reactThemes = _interopRequireDefault(require("@dr.pogodin/react-themes"));
11
- var _ScalableRect = _interopRequireDefault(require("../ScalableRect"));
12
11
  var _Throbber = _interopRequireDefault(require("../Throbber"));
13
12
  var _jsxRuntime = require("react/jsx-runtime");
14
13
  const baseTheme = {
@@ -59,9 +58,8 @@ const YouTubeVideo = ({
59
58
  // TODO: https://developers.google.com/youtube/player_parameters
60
59
  // More query parameters can be exposed via the component props.
61
60
 
62
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ScalableRect.default, {
61
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
63
62
  className: theme.container,
64
- ratio: "16:9",
65
63
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Throbber.default, {
66
64
  theme: throbberTheme
67
65
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("iframe", {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_propTypes","_interopRequireDefault","require","_qs","_reactThemes","_ScalableRect","_Throbber","_jsxRuntime","baseTheme","throbberTheme","validThemeKeys","YouTubeVideo","autoplay","src","theme","title","srcParts","split","url","queryString","query","qs","parse","videoId","v","match","stringify","jsxs","default","className","container","ratio","children","jsx","allow","allowFullScreen","video","ThemedYouTubeVideo","themed","propTypes","PT","bool","string","isRequired","themeType","defaultProps","_default","exports"],"sources":["../../../../../src/shared/components/YouTubeVideo/index.tsx"],"sourcesContent":["import PT from 'prop-types';\nimport qs from 'qs';\n\nimport themed, { type Theme } from '@dr.pogodin/react-themes';\n\nimport ScalableRect from 'components/ScalableRect';\nimport Throbber from 'components/Throbber';\n\nimport baseTheme from './base.scss';\nimport throbberTheme from './throbber.scss';\n\nconst validThemeKeys = ['container', 'video'] as const;\n\ntype ComponentThemeT = Theme<typeof validThemeKeys>;\n\ntype PropsT = {\n autoplay?: boolean;\n src: string;\n theme: ComponentThemeT,\n title?: string;\n};\n\n/**\n * A component for embeding a YouTube video.\n * @param [props] Component properties.\n * @param [props.autoplay] If `true` the video will start to play\n * automatically once loaded.\n * @param [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 [props.theme] _Ad hoc_ theme.\n * @param [props.title] The `title` attribute to add to the player\n * IFrame.\n */\nconst YouTubeVideo: React.FunctionComponent<PropsT> = ({\n autoplay,\n src,\n theme,\n title,\n}) => {\n const srcParts = src.split('?');\n let url = srcParts[0];\n const queryString = srcParts[1];\n const query = queryString ? qs.parse(queryString) : {};\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 'YouTubeVideo',\n validThemeKeys,\n baseTheme,\n);\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,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,GAAA,GAAAF,sBAAA,CAAAC,OAAA;AAEA,IAAAE,YAAA,GAAAH,sBAAA,CAAAC,OAAA;AAEA,IAAAG,aAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,SAAA,GAAAL,sBAAA,CAAAC,OAAA;AAA2C,IAAAK,WAAA,GAAAL,OAAA;AAAA,MAAAM,SAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAAA,MAAAC,aAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAK3C,MAAMC,cAAc,GAAG,CAAC,WAAW,EAAE,OAAO,CAAU;AAWtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,YAA6C,GAAGA,CAAC;EACrDC,QAAQ;EACRC,GAAG;EACHC,KAAK;EACLC;AACF,CAAC,KAAK;EACJ,MAAMC,QAAQ,GAAGH,GAAG,CAACI,KAAK,CAAC,GAAG,CAAC;EAC/B,IAAIC,GAAG,GAAGF,QAAQ,CAAC,CAAC,CAAC;EACrB,MAAMG,WAAW,GAAGH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CAAC;AAED/B,YAAY,CAACkC,YAAY,GAAG;EAC1BjC,QAAQ,EAAE,KAAK;EACfG,KAAK,EAAE;AACT,CAAC;AAAC,IAAA+B,QAAA,GAAAC,OAAA,CAAAnB,OAAA,GAEaS,kBAAkB","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["_propTypes","_interopRequireDefault","require","_qs","_reactThemes","_Throbber","_jsxRuntime","baseTheme","throbberTheme","validThemeKeys","YouTubeVideo","autoplay","src","theme","title","srcParts","split","url","queryString","query","qs","parse","videoId","v","match","stringify","jsxs","className","container","children","jsx","default","allow","allowFullScreen","video","ThemedYouTubeVideo","themed","propTypes","PT","bool","string","isRequired","themeType","defaultProps","_default","exports"],"sources":["../../../../../src/shared/components/YouTubeVideo/index.tsx"],"sourcesContent":["import PT from 'prop-types';\nimport qs from 'qs';\n\nimport themed, { type Theme } from '@dr.pogodin/react-themes';\n\nimport Throbber from 'components/Throbber';\n\nimport baseTheme from './base.scss';\nimport throbberTheme from './throbber.scss';\n\nconst validThemeKeys = ['container', 'video'] as const;\n\ntype ComponentThemeT = Theme<typeof validThemeKeys>;\n\ntype PropsT = {\n autoplay?: boolean;\n src: string;\n theme: ComponentThemeT,\n title?: string;\n};\n\n/**\n * A component for embeding a YouTube video.\n * @param [props] Component properties.\n * @param [props.autoplay] If `true` the video will start to play\n * automatically once loaded.\n * @param [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 [props.theme] _Ad hoc_ theme.\n * @param [props.title] The `title` attribute to add to the player\n * IFrame.\n */\nconst YouTubeVideo: React.FunctionComponent<PropsT> = ({\n autoplay,\n src,\n theme,\n title,\n}) => {\n const srcParts = src.split('?');\n let url = srcParts[0];\n const queryString = srcParts[1];\n const query = queryString ? qs.parse(queryString) : {};\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 <div className={theme.container}>\n <Throbber theme={throbberTheme} />\n <iframe\n allow=\"autoplay\"\n allowFullScreen\n className={theme.video}\n src={url}\n title={title}\n />\n </div>\n );\n};\n\nconst ThemedYouTubeVideo = themed(\n YouTubeVideo,\n 'YouTubeVideo',\n validThemeKeys,\n baseTheme,\n);\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,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,GAAA,GAAAF,sBAAA,CAAAC,OAAA;AAEA,IAAAE,YAAA,GAAAH,sBAAA,CAAAC,OAAA;AAEA,IAAAG,SAAA,GAAAJ,sBAAA,CAAAC,OAAA;AAA2C,IAAAI,WAAA,GAAAJ,OAAA;AAAA,MAAAK,SAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAAA,MAAAC,aAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAK3C,MAAMC,cAAc,GAAG,CAAC,WAAW,EAAE,OAAO,CAAU;AAWtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,YAA6C,GAAGA,CAAC;EACrDC,QAAQ;EACRC,GAAG;EACHC,KAAK;EACLC;AACF,CAAC,KAAK;EACJ,MAAMC,QAAQ,GAAGH,GAAG,CAACI,KAAK,CAAC,GAAG,CAAC;EAC/B,IAAIC,GAAG,GAAGF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CAAC;AAED9B,YAAY,CAACiC,YAAY,GAAG;EAC1BhC,QAAQ,EAAE,KAAK;EACfG,KAAK,EAAE;AACT,CAAC;AAAC,IAAA8B,QAAA,GAAAC,OAAA,CAAAd,OAAA,GAEaI,kBAAkB","ignoreList":[]}
@@ -4,6 +4,21 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
+ var _exportNames = {
8
+ Button: true,
9
+ Checkbox: true,
10
+ Input: true,
11
+ Link: true,
12
+ PageLayout: true,
13
+ MetaTags: true,
14
+ Modal: true,
15
+ BaseModal: true,
16
+ NavLink: true,
17
+ Throbber: true,
18
+ WithTooltip: true,
19
+ YouTubeVideo: true,
20
+ TextArea: true
21
+ };
7
22
  Object.defineProperty(exports, "BaseModal", {
8
23
  enumerable: true,
9
24
  get: function () {
@@ -22,12 +37,6 @@ Object.defineProperty(exports, "Checkbox", {
22
37
  return _Checkbox.default;
23
38
  }
24
39
  });
25
- Object.defineProperty(exports, "Dropdown", {
26
- enumerable: true,
27
- get: function () {
28
- return _Dropdown.default;
29
- }
30
- });
31
40
  Object.defineProperty(exports, "Input", {
32
41
  enumerable: true,
33
42
  get: function () {
@@ -64,12 +73,6 @@ Object.defineProperty(exports, "PageLayout", {
64
73
  return _PageLayout.default;
65
74
  }
66
75
  });
67
- Object.defineProperty(exports, "ScalableRect", {
68
- enumerable: true,
69
- get: function () {
70
- return _ScalableRect.default;
71
- }
72
- });
73
76
  Object.defineProperty(exports, "TextArea", {
74
77
  enumerable: true,
75
78
  get: function () {
@@ -94,16 +97,26 @@ Object.defineProperty(exports, "YouTubeVideo", {
94
97
  return _YouTubeVideo.default;
95
98
  }
96
99
  });
100
+ var _selectors = require("./selectors");
101
+ Object.keys(_selectors).forEach(function (key) {
102
+ if (key === "default" || key === "__esModule") return;
103
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
104
+ if (key in exports && exports[key] === _selectors[key]) return;
105
+ Object.defineProperty(exports, key, {
106
+ enumerable: true,
107
+ get: function () {
108
+ return _selectors[key];
109
+ }
110
+ });
111
+ });
97
112
  var _Button = _interopRequireDefault(require("./Button"));
98
113
  var _Checkbox = _interopRequireDefault(require("./Checkbox"));
99
- var _Dropdown = _interopRequireDefault(require("./Dropdown"));
100
114
  var _Input = _interopRequireDefault(require("./Input"));
101
115
  var _Link = _interopRequireDefault(require("./Link"));
102
116
  var _PageLayout = _interopRequireDefault(require("./PageLayout"));
103
117
  var _MetaTags = _interopRequireDefault(require("./MetaTags"));
104
118
  var _Modal = _interopRequireWildcard(require("./Modal"));
105
119
  var _NavLink = _interopRequireDefault(require("./NavLink"));
106
- var _ScalableRect = _interopRequireDefault(require("./ScalableRect"));
107
120
  var _Throbber = _interopRequireDefault(require("./Throbber"));
108
121
  var _WithTooltip = _interopRequireDefault(require("./WithTooltip"));
109
122
  var _YouTubeVideo = _interopRequireDefault(require("./YouTubeVideo"));
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_Button","_interopRequireDefault","require","_Checkbox","_Dropdown","_Input","_Link","_PageLayout","_MetaTags","_Modal","_interopRequireWildcard","_NavLink","_ScalableRect","_Throbber","_WithTooltip","_YouTubeVideo","_TextArea","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set"],"sources":["../../../../src/shared/components/index.ts"],"sourcesContent":["/**\n * Just an aggregation of all exported components into a single module.\n */\n\nexport { default as Button } from 'components/Button';\nexport { default as Checkbox } from 'components/Checkbox';\nexport { default as Dropdown } from 'components/Dropdown';\nexport { default as Input } from 'components/Input';\nexport { default as Link } from 'components/Link';\nexport { default as PageLayout } from 'components/PageLayout';\nexport { default as MetaTags } from 'components/MetaTags';\nexport { default as Modal, BaseModal } from 'components/Modal';\nexport { default as NavLink } from 'components/NavLink';\nexport { default as ScalableRect } from 'components/ScalableRect';\nexport { default as Throbber } from 'components/Throbber';\nexport { default as WithTooltip } from 'components/WithTooltip';\nexport { default as YouTubeVideo } from 'components/YouTubeVideo';\n\nexport { default as TextArea } from './TextArea';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,SAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,SAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,MAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,KAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,WAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,SAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,MAAA,GAAAC,uBAAA,CAAAR,OAAA;AACA,IAAAS,QAAA,GAAAV,sBAAA,CAAAC,OAAA;AACA,IAAAU,aAAA,GAAAX,sBAAA,CAAAC,OAAA;AACA,IAAAW,SAAA,GAAAZ,sBAAA,CAAAC,OAAA;AACA,IAAAY,YAAA,GAAAb,sBAAA,CAAAC,OAAA;AACA,IAAAa,aAAA,GAAAd,sBAAA,CAAAC,OAAA;AAEA,IAAAc,SAAA,GAAAf,sBAAA,CAAAC,OAAA;AAAiD,SAAAe,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAR,wBAAAQ,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAjB,CAAA,EAAAc,CAAA,SAAAI,CAAA,GAAAR,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAI,CAAA,KAAAA,CAAA,CAAAX,GAAA,IAAAW,CAAA,CAAAC,GAAA,IAAAR,MAAA,CAAAC,cAAA,CAAAJ,CAAA,EAAAM,CAAA,EAAAI,CAAA,IAAAV,CAAA,CAAAM,CAAA,IAAAd,CAAA,CAAAc,CAAA,YAAAN,CAAA,CAAAH,OAAA,GAAAL,CAAA,EAAAG,CAAA,IAAAA,CAAA,CAAAgB,GAAA,CAAAnB,CAAA,EAAAQ,CAAA,GAAAA,CAAA","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["_selectors","require","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_Button","_interopRequireDefault","_Checkbox","_Input","_Link","_PageLayout","_MetaTags","_Modal","_interopRequireWildcard","_NavLink","_Throbber","_WithTooltip","_YouTubeVideo","_TextArea","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","n","__proto__","a","getOwnPropertyDescriptor","u","i","set"],"sources":["../../../../src/shared/components/index.ts"],"sourcesContent":["/**\n * Just an aggregation of all exported components into a single module.\n */\n\nexport * from 'components/selectors';\n\nexport { default as Button } from 'components/Button';\nexport { default as Checkbox } from 'components/Checkbox';\nexport { default as Input } from 'components/Input';\nexport { default as Link } from 'components/Link';\nexport { default as PageLayout } from 'components/PageLayout';\nexport { default as MetaTags } from 'components/MetaTags';\nexport { default as Modal, BaseModal } from 'components/Modal';\nexport { default as NavLink } from 'components/NavLink';\nexport { default as Throbber } from 'components/Throbber';\nexport { default as WithTooltip } from 'components/WithTooltip';\nexport { default as YouTubeVideo } from 'components/YouTubeVideo';\n\nexport { default as TextArea } from './TextArea';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,IAAAA,UAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,UAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAL,UAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAb,UAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AAEA,IAAAS,OAAA,GAAAC,sBAAA,CAAAd,OAAA;AACA,IAAAe,SAAA,GAAAD,sBAAA,CAAAd,OAAA;AACA,IAAAgB,MAAA,GAAAF,sBAAA,CAAAd,OAAA;AACA,IAAAiB,KAAA,GAAAH,sBAAA,CAAAd,OAAA;AACA,IAAAkB,WAAA,GAAAJ,sBAAA,CAAAd,OAAA;AACA,IAAAmB,SAAA,GAAAL,sBAAA,CAAAd,OAAA;AACA,IAAAoB,MAAA,GAAAC,uBAAA,CAAArB,OAAA;AACA,IAAAsB,QAAA,GAAAR,sBAAA,CAAAd,OAAA;AACA,IAAAuB,SAAA,GAAAT,sBAAA,CAAAd,OA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AAAO,CAAA,GAAAA,CAAA","ignoreList":[]}
@@ -0,0 +1,93 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ var _propTypes = _interopRequireDefault(require("prop-types"));
9
+ var _react = require("react");
10
+ var _Modal = require("../../../Modal");
11
+ var _common = require("../../common");
12
+ var _jsxRuntime = require("react/jsx-runtime");
13
+ const S = {
14
+ "overlay": "-dr-pogodin-react-utils___src-shared-components-selectors-CustomDropdown-Options-style___overlay___jKsMKG"
15
+ };
16
+ const Options = ({
17
+ anchorRect,
18
+ containerClass,
19
+ filter,
20
+ onCancel,
21
+ onChange,
22
+ optionClass,
23
+ options
24
+ }) => {
25
+ // Closes the dropdown (cancels the selection) on any page scrolling attempt.
26
+ // This is the same native <select> elements do on scrolling, and at least for
27
+ // now we have no reason to deal with complications needed to support open
28
+ // dropdowns during the scrolling (that would need to re-position it in
29
+ // response to the position changes of the root dropdown element).
30
+ (0, _react.useEffect)(() => {
31
+ const listener = () => {
32
+ onCancel();
33
+ };
34
+ window.addEventListener('scroll', listener);
35
+ return () => {
36
+ window.removeEventListener('scroll', listener);
37
+ };
38
+ }, [onCancel]);
39
+ const optionNodes = [];
40
+ for (let i = 0; i < options.length; ++i) {
41
+ const option = options[i];
42
+ if (!filter || filter(option)) {
43
+ const [iValue, iName] = (0, _common.optionValueName)(option);
44
+ optionNodes.push( /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
45
+ className: optionClass,
46
+ onClick: () => onChange(iValue),
47
+ onKeyDown: e => {
48
+ if (e.key === 'Enter') {
49
+ onChange(iValue);
50
+ }
51
+ },
52
+ role: "button",
53
+ tabIndex: 0,
54
+ children: iName
55
+ }, iValue));
56
+ }
57
+ }
58
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Modal.BaseModal, {
59
+ containerStyle: {
60
+ left: anchorRect.left,
61
+ top: anchorRect.bottom,
62
+ width: anchorRect.width
63
+ },
64
+ dontDisableScrolling: true,
65
+ onCancel: onCancel,
66
+ theme: {
67
+ ad: '',
68
+ hoc: '',
69
+ container: containerClass,
70
+ context: '',
71
+ overlay: S.overlay
72
+ },
73
+ children: optionNodes
74
+ });
75
+ };
76
+ Options.propTypes = {
77
+ anchorRect: _propTypes.default.shape({
78
+ bottom: _propTypes.default.number.isRequired,
79
+ left: _propTypes.default.number.isRequired,
80
+ width: _propTypes.default.number.isRequired
81
+ }).isRequired,
82
+ containerClass: _propTypes.default.string.isRequired,
83
+ filter: _propTypes.default.func,
84
+ onCancel: _propTypes.default.func.isRequired,
85
+ onChange: _propTypes.default.func.isRequired,
86
+ optionClass: _propTypes.default.string.isRequired,
87
+ options: _common.optionsValidator.isRequired
88
+ };
89
+ Options.defaultProps = {
90
+ filter: undefined
91
+ };
92
+ var _default = exports.default = Options;
93
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["_propTypes","_interopRequireDefault","require","_react","_Modal","_common","_jsxRuntime","S","Options","anchorRect","containerClass","filter","onCancel","onChange","optionClass","options","useEffect","listener","window","addEventListener","removeEventListener","optionNodes","i","length","option","iValue","iName","optionValueName","push","jsx","className","onClick","onKeyDown","e","key","role","tabIndex","children","BaseModal","containerStyle","left","top","bottom","width","dontDisableScrolling","theme","ad","hoc","container","context","overlay","propTypes","PT","shape","number","isRequired","string","func","optionsValidator","defaultProps","undefined","_default","exports","default"],"sources":["../../../../../../../src/shared/components/selectors/CustomDropdown/Options/index.tsx"],"sourcesContent":["import PT from 'prop-types';\nimport { useEffect } from 'react';\n\nimport { BaseModal } from 'components/Modal';\n\nimport S from './style.scss';\n\nimport {\n type OptionT,\n type OptionsT,\n optionsValidator,\n optionValueName,\n} from '../../common';\n\ntype PropsT = {\n anchorRect: {\n bottom: number;\n left: number;\n width: number;\n };\n containerClass: string;\n filter?: (item: OptionT<React.ReactNode> | string) => boolean;\n optionClass: string;\n options: OptionsT<React.ReactNode>;\n onCancel: () => void;\n onChange: (value: string) => void;\n};\n\nconst Options: React.FunctionComponent<PropsT> = ({\n anchorRect,\n containerClass,\n filter,\n onCancel,\n onChange,\n optionClass,\n options,\n}) => {\n // Closes the dropdown (cancels the selection) on any page scrolling attempt.\n // This is the same native <select> elements do on scrolling, and at least for\n // now we have no reason to deal with complications needed to support open\n // dropdowns during the scrolling (that would need to re-position it in\n // response to the position changes of the root dropdown element).\n useEffect(() => {\n const listener = () => {\n onCancel();\n };\n window.addEventListener('scroll', listener);\n return () => {\n window.removeEventListener('scroll', listener);\n };\n }, [onCancel]);\n\n const optionNodes: React.ReactNode[] = [];\n for (let i = 0; i < options.length; ++i) {\n const option = options[i];\n if (!filter || filter(option)) {\n const [iValue, iName] = optionValueName(option);\n optionNodes.push(\n <div\n className={optionClass}\n onClick={() => onChange(iValue)}\n onKeyDown={(e) => {\n if (e.key === 'Enter') {\n onChange(iValue);\n }\n }}\n key={iValue}\n role=\"button\"\n tabIndex={0}\n >\n {iName}\n </div>,\n );\n }\n }\n\n return (\n <BaseModal\n containerStyle={{\n left: anchorRect.left,\n top: anchorRect.bottom,\n width: anchorRect.width,\n }}\n dontDisableScrolling\n onCancel={onCancel}\n theme={{\n ad: '',\n hoc: '',\n container: containerClass,\n context: '',\n overlay: S.overlay,\n }}\n >\n {optionNodes}\n </BaseModal>\n );\n};\n\nOptions.propTypes = {\n anchorRect: PT.shape({\n bottom: PT.number.isRequired,\n left: PT.number.isRequired,\n width: PT.number.isRequired,\n }).isRequired,\n containerClass: PT.string.isRequired,\n filter: PT.func,\n onCancel: PT.func.isRequired,\n onChange: PT.func.isRequired,\n optionClass: PT.string.isRequired,\n options: optionsValidator.isRequired,\n};\n\nOptions.defaultProps = {\n filter: undefined,\n};\n\nexport default Options;\n"],"mappings":";;;;;;;AAAA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAEA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