@dr.pogodin/react-utils 1.30.2 → 1.31.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (140) 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 +8 -1
  5. package/build/development/index.js.map +1 -1
  6. package/build/development/server/index.js +1 -1
  7. package/build/development/server/index.js.map +1 -1
  8. package/build/development/server/utils/index.js +1 -1
  9. package/build/development/shared/components/Checkbox/index.js +2 -2
  10. package/build/development/shared/components/Checkbox/index.js.map +1 -1
  11. package/build/development/shared/components/Input/index.js +2 -2
  12. package/build/development/shared/components/Input/index.js.map +1 -1
  13. package/build/development/shared/components/Modal/index.js +40 -5
  14. package/build/development/shared/components/Modal/index.js.map +1 -1
  15. package/build/development/shared/components/TextArea/index.js +5 -0
  16. package/build/development/shared/components/TextArea/index.js.map +1 -1
  17. package/build/development/shared/components/WithTooltip/index.js +1 -1
  18. package/build/development/shared/components/WithTooltip/index.js.map +1 -1
  19. package/build/development/shared/components/YouTubeVideo/index.js +1 -3
  20. package/build/development/shared/components/YouTubeVideo/index.js.map +1 -1
  21. package/build/development/shared/components/index.js +28 -15
  22. package/build/development/shared/components/index.js.map +1 -1
  23. package/build/development/shared/components/selectors/CustomDropdown/Options/index.js +85 -0
  24. package/build/development/shared/components/selectors/CustomDropdown/Options/index.js.map +1 -0
  25. package/build/development/shared/components/selectors/CustomDropdown/index.js +105 -0
  26. package/build/development/shared/components/selectors/CustomDropdown/index.js.map +1 -0
  27. package/build/development/shared/components/{Dropdown → selectors/NativeDropdown}/index.js +25 -34
  28. package/build/development/shared/components/selectors/NativeDropdown/index.js.map +1 -0
  29. package/build/development/shared/components/selectors/Switch/index.js +76 -0
  30. package/build/development/shared/components/selectors/Switch/index.js.map +1 -0
  31. package/build/development/shared/components/selectors/common.js +24 -0
  32. package/build/development/shared/components/selectors/common.js.map +1 -0
  33. package/build/development/shared/components/selectors/index.js +28 -0
  34. package/build/development/shared/components/selectors/index.js.map +1 -0
  35. package/build/development/shared/utils/index.js +1 -1
  36. package/build/development/shared/utils/index.js.map +1 -1
  37. package/build/development/shared/utils/jest/E2eSsrEnv.js +3 -0
  38. package/build/development/shared/utils/jest/E2eSsrEnv.js.map +1 -1
  39. package/build/development/shared/utils/jest/index.js +1 -1
  40. package/build/development/shared/utils/jest/index.js.map +1 -1
  41. package/build/development/style.css +387 -225
  42. package/build/development/web.bundle.js +113 -53
  43. package/build/production/client/index.js +1 -1
  44. package/build/production/client/index.js.map +1 -1
  45. package/build/production/index.js +1 -1
  46. package/build/production/index.js.map +1 -1
  47. package/build/production/server/index.js +1 -1
  48. package/build/production/server/index.js.map +1 -1
  49. package/build/production/server/utils/index.js +1 -1
  50. package/build/production/shared/components/Checkbox/index.js +2 -2
  51. package/build/production/shared/components/Checkbox/index.js.map +1 -1
  52. package/build/production/shared/components/Input/index.js +1 -1
  53. package/build/production/shared/components/Input/index.js.map +1 -1
  54. package/build/production/shared/components/Modal/index.js +4 -2
  55. package/build/production/shared/components/Modal/index.js.map +1 -1
  56. package/build/production/shared/components/TextArea/index.js +3 -3
  57. package/build/production/shared/components/TextArea/index.js.map +1 -1
  58. package/build/production/shared/components/WithTooltip/index.js +1 -1
  59. package/build/production/shared/components/WithTooltip/index.js.map +1 -1
  60. package/build/production/shared/components/YouTubeVideo/index.js +2 -2
  61. package/build/production/shared/components/YouTubeVideo/index.js.map +1 -1
  62. package/build/production/shared/components/index.js +1 -1
  63. package/build/production/shared/components/index.js.map +1 -1
  64. package/build/production/shared/components/selectors/CustomDropdown/Options/index.js +7 -0
  65. package/build/production/shared/components/selectors/CustomDropdown/Options/index.js.map +1 -0
  66. package/build/production/shared/components/selectors/CustomDropdown/index.js +4 -0
  67. package/build/production/shared/components/selectors/CustomDropdown/index.js.map +1 -0
  68. package/build/production/shared/components/selectors/NativeDropdown/index.js +25 -0
  69. package/build/production/shared/components/selectors/NativeDropdown/index.js.map +1 -0
  70. package/build/production/shared/components/selectors/Switch/index.js +2 -0
  71. package/build/production/shared/components/selectors/Switch/index.js.map +1 -0
  72. package/build/production/shared/components/selectors/common.js +3 -0
  73. package/build/production/shared/components/selectors/common.js.map +1 -0
  74. package/build/production/shared/components/selectors/index.js +2 -0
  75. package/build/production/shared/components/selectors/index.js.map +1 -0
  76. package/build/production/shared/utils/index.js +1 -1
  77. package/build/production/shared/utils/index.js.map +1 -1
  78. package/build/production/shared/utils/jest/E2eSsrEnv.js +3 -1
  79. package/build/production/shared/utils/jest/E2eSsrEnv.js.map +1 -1
  80. package/build/production/shared/utils/jest/index.js +1 -1
  81. package/build/production/shared/utils/jest/index.js.map +1 -1
  82. package/build/production/style.css +1 -1
  83. package/build/production/style.css.map +1 -1
  84. package/build/production/web.bundle.js +1 -1
  85. package/build/production/web.bundle.js.map +1 -1
  86. package/build/types-code/client/index.d.ts +1 -0
  87. package/build/types-code/index.d.ts +1 -1
  88. package/build/types-code/shared/components/Checkbox/index.d.ts +1 -1
  89. package/build/types-code/shared/components/Input/index.d.ts +1 -1
  90. package/build/types-code/shared/components/Modal/index.d.ts +3 -1
  91. package/build/types-code/shared/components/TextArea/index.d.ts +1 -0
  92. package/build/types-code/shared/components/index.d.ts +1 -2
  93. package/build/types-code/shared/components/selectors/CustomDropdown/Options/index.d.ts +17 -0
  94. package/build/types-code/shared/components/selectors/CustomDropdown/index.d.ts +4 -0
  95. package/build/types-code/shared/components/selectors/NativeDropdown/index.d.ts +3 -0
  96. package/build/types-code/shared/components/selectors/Switch/index.d.ts +13 -0
  97. package/build/types-code/shared/components/selectors/common.d.ts +27 -0
  98. package/build/types-code/shared/components/selectors/index.d.ts +3 -0
  99. package/build/types-scss/src/shared/components/Modal/styles.scss.d.ts +1 -0
  100. package/build/types-scss/src/shared/components/selectors/CustomDropdown/Options/style.scss.d.ts +1 -0
  101. package/build/types-scss/src/shared/components/selectors/CustomDropdown/theme.scss.d.ts +10 -0
  102. package/build/types-scss/src/shared/components/{Dropdown → selectors/NativeDropdown}/theme.scss.d.ts +1 -0
  103. package/build/types-scss/src/shared/components/selectors/Switch/theme.scss.d.ts +6 -0
  104. package/package.json +30 -30
  105. package/src/client/index.tsx +2 -1
  106. package/src/index.ts +1 -0
  107. package/src/shared/components/Button/style.scss +1 -0
  108. package/src/shared/components/Checkbox/index.tsx +3 -3
  109. package/src/shared/components/Input/index.tsx +3 -3
  110. package/src/shared/components/Modal/base-theme.scss +1 -1
  111. package/src/shared/components/Modal/index.tsx +40 -5
  112. package/src/shared/components/Modal/styles.scss +2 -4
  113. package/src/shared/components/TextArea/index.tsx +5 -0
  114. package/src/shared/components/TextArea/style.scss +8 -0
  115. package/src/shared/components/YouTubeVideo/base.scss +3 -1
  116. package/src/shared/components/YouTubeVideo/index.tsx +2 -3
  117. package/src/shared/components/index.ts +2 -2
  118. package/src/shared/components/selectors/CustomDropdown/Options/index.tsx +107 -0
  119. package/src/shared/components/selectors/CustomDropdown/Options/style.scss +6 -0
  120. package/src/shared/components/selectors/CustomDropdown/index.tsx +115 -0
  121. package/src/shared/components/selectors/CustomDropdown/theme.scss +90 -0
  122. package/src/shared/components/{Dropdown → selectors/NativeDropdown}/index.tsx +21 -50
  123. package/src/shared/components/{Dropdown → selectors/NativeDropdown}/theme.scss +5 -0
  124. package/src/shared/components/selectors/Switch/index.tsx +94 -0
  125. package/src/shared/components/selectors/Switch/theme.scss +39 -0
  126. package/src/shared/components/selectors/common.ts +54 -0
  127. package/src/shared/components/selectors/index.ts +3 -0
  128. package/src/shared/utils/jest/E2eSsrEnv.ts +5 -1
  129. package/build/development/shared/components/Dropdown/index.js.map +0 -1
  130. package/build/development/shared/components/ScalableRect/index.js +0 -80
  131. package/build/development/shared/components/ScalableRect/index.js.map +0 -1
  132. package/build/production/shared/components/Dropdown/index.js +0 -24
  133. package/build/production/shared/components/Dropdown/index.js.map +0 -1
  134. package/build/production/shared/components/ScalableRect/index.js +0 -21
  135. package/build/production/shared/components/ScalableRect/index.js.map +0 -1
  136. package/build/types-code/shared/components/Dropdown/index.d.ts +0 -17
  137. package/build/types-code/shared/components/ScalableRect/index.d.ts +0 -19
  138. package/build/types-scss/src/shared/components/ScalableRect/style.scss.d.ts +0 -2
  139. package/src/shared/components/ScalableRect/index.tsx +0 -84
  140. package/src/shared/components/ScalableRect/style.scss +0 -10
@@ -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,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;AAEDG,YAAY,CAAC4B,SAAS,GAAG;EACvB3B,QAAQ,EAAE4B,kBAAE,CAACC,IAAI;EACjB5B,GAAG,EAAE2B,kBAAE,CAACE,MAAM,CAACC,UAAU;EACzB7B,KAAK,EAAEuB,kBAAkB,CAACO,SAAS,CAACD,UAAU;EAC9C5B,KAAK,EAAEyB,kBAAE,CAACE;AACZ,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;A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;AAEDG,YAAY,CAAC2B,SAAS,GAAG;EACvB1B,QAAQ,EAAE2B,kBAAE,CAACC,IAAI;EACjB3B,GAAG,EAAE0B,kBAAE,CAACE,MAAM,CAACC,UAAU;EACzB5B,KAAK,EAAEsB,kBAAkB,CAACO,SAAS,CAACD,UAAU;EAC9C3B,KAAK,EAAEwB,kBAAE,CAACE;AACZ,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,20 +97,30 @@ 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"));
110
123
  var _TextArea = _interopRequireDefault(require("./TextArea"));
111
124
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
112
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
125
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
113
126
  //# sourceMappingURL=index.js.map
@@ -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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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C,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/With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C,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,SAAAP,wBAAAO,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,CAAAnB,GAAA,CAAAgB,CAAA,OAAAO,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAApC,MAAA,CAAAS,cAAA,IAAAT,MAAA,CAAAqC,wBAAA,WAAAC,CAAA,IAAAX,CAAA,oBAAAW,CAAA,OAAAjC,cAAA,CAAAC,IAAA,CAAAqB,CAAA,EAAAW,CAAA,SAAAC,CAAA,GAAAH,CAAA,GAAApC,MAAA,CAAAqC,wBAAA,CAAAV,CAAA,EAAAW,CAAA,UAAAC,CAAA,KAAAA,CAAA,CAAA5B,GAAA,IAAA4B,CAAA,CAAAC,GAAA,IAAAxC,MAAA,CAAAS,cAAA,CAAAyB,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","ignoreList":[]}
@@ -0,0 +1,85 @@
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 _Modal = require("../../../Modal");
10
+ var _common = require("../../common");
11
+ var _jsxRuntime = require("react/jsx-runtime");
12
+ const S = {
13
+ "overlay": "-dr-pogodin-react-utils___src-shared-components-selectors-CustomDropdown-Options-style___overlay___jKsMKG"
14
+ };
15
+ const Options = ({
16
+ anchorRect,
17
+ containerClass,
18
+ filter,
19
+ onCancel,
20
+ onChange,
21
+ optionClass,
22
+ options
23
+ }) => {
24
+ const optionNodes = [];
25
+ for (let i = 0; i < options.length; ++i) {
26
+ const option = options[i];
27
+ if (!filter || filter(option)) {
28
+ const [iValue, iName] = (0, _common.optionValueName)(option);
29
+ optionNodes.push( /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
30
+ className: optionClass,
31
+ onClick: () => onChange(iValue),
32
+ onKeyDown: e => {
33
+ if (e.key === 'Enter') {
34
+ onChange(iValue);
35
+ }
36
+ },
37
+ role: "button",
38
+ tabIndex: 0,
39
+ children: iName
40
+ }, iValue));
41
+ }
42
+ }
43
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Modal.BaseModal
44
+ // Closes the dropdown (cancels the selection) on any page scrolling attempt.
45
+ // This is the same native <select> elements do on scrolling, and at least for
46
+ // now we have no reason to deal with complications needed to support open
47
+ // dropdowns during the scrolling (that would need to re-position it in
48
+ // response to the position changes of the root dropdown element).
49
+ , {
50
+ cancelOnScrolling: true,
51
+ containerStyle: {
52
+ left: anchorRect.left,
53
+ top: anchorRect.bottom,
54
+ width: anchorRect.width
55
+ },
56
+ dontDisableScrolling: true,
57
+ onCancel: onCancel,
58
+ theme: {
59
+ ad: '',
60
+ hoc: '',
61
+ container: containerClass,
62
+ context: '',
63
+ overlay: S.overlay
64
+ },
65
+ children: optionNodes
66
+ });
67
+ };
68
+ Options.propTypes = {
69
+ anchorRect: _propTypes.default.shape({
70
+ bottom: _propTypes.default.number.isRequired,
71
+ left: _propTypes.default.number.isRequired,
72
+ width: _propTypes.default.number.isRequired
73
+ }).isRequired,
74
+ containerClass: _propTypes.default.string.isRequired,
75
+ filter: _propTypes.default.func,
76
+ onCancel: _propTypes.default.func.isRequired,
77
+ onChange: _propTypes.default.func.isRequired,
78
+ optionClass: _propTypes.default.string.isRequired,
79
+ options: _common.optionsValidator.isRequired
80
+ };
81
+ Options.defaultProps = {
82
+ filter: undefined
83
+ };
84
+ var _default = exports.default = Options;
85
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["_propTypes","_interopRequireDefault","require","_Modal","_common","_jsxRuntime","S","Options","anchorRect","containerClass","filter","onCancel","onChange","optionClass","options","optionNodes","i","length","option","iValue","iName","optionValueName","push","jsx","className","onClick","onKeyDown","e","key","role","tabIndex","children","BaseModal","cancelOnScrolling","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';\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 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 // 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 cancelOnScrolling\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;AAEA,IAAAC,MAAA,GAAAD,OAAA;AAIA,IAAAE,OAAA,GAAAF,OAAA;AAKsB,IAAAG,WAAA,GAAAH,OAAA;AAAA,MAAAI,CAAA;EAAA;AAAA;AAgBtB,MAAMC,OAAwC,GAAGA,CAAC;EAChDC,UAAU;EACVC,cAAc;EACdC,MAAM;EACNC,QAAQ;EACRC,QAAQ;EACRC,WAAW;EACXC;AACF,CAAC,KAAK;EACJ,MAAMC,WAA8B,GAAG,EAAE;EACzC,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGF,OAAO,CAACG,MAAM,EAAE,EAAED,CAAC,EAAE;IACvC,MAAME,MAAM,GAAGJ,OAAO,CAACE,CAAC,CAAC;IACzB,IAAI,CAACN,MAAM,IAAIA,MAAM,CAACQ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AM,CAACC;EACnB,CAAC,CAAC,CAACA,UAAU;EACbzC,cAAc,EAAEsC,kBAAE,CAACI,MAAM,CAACD,UAAU;EACpCxC,MAAM,EAAEqC,kBAAE,CAACK,IAAI;EACfzC,QAAQ,EAAEoC,kBAAE,CAACK,IAAI,CAACF,UAAU;EAC5BtC,QAAQ,EAAEmC,kBAAE,CAACK,IAAI,CAACF,UAAU;EAC5BrC,WAAW,EAAEkC,kBAAE,CAACI,MAAM,CAACD,UAAU;EACjCpC,OAAO,EAAEuC,wBAAgB,CAACH;AAC5B,CAAC;AAED3C,OAAO,CAAC+C,YAAY,GAAG;EACrB5C,MAAM,EAAE6C;AACV,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEanD,OAAO","ignoreList":[]}
@@ -0,0 +1,105 @@
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 _reactThemes = _interopRequireDefault(require("@dr.pogodin/react-themes"));
11
+ var _Options = _interopRequireDefault(require("./Options"));
12
+ var _common = require("../common");
13
+ var _jsxRuntime = require("react/jsx-runtime");
14
+ const defaultTheme = {
15
+ "context": "-dr-pogodin-react-utils___src-shared-components-selectors-CustomDropdown-theme___context___9Tod5r",
16
+ "ad": "-dr-pogodin-react-utils___src-shared-components-selectors-CustomDropdown-theme___ad___R58zIg",
17
+ "hoc": "-dr-pogodin-react-utils___src-shared-components-selectors-CustomDropdown-theme___hoc___O-Tp1i",
18
+ "container": "-dr-pogodin-react-utils___src-shared-components-selectors-CustomDropdown-theme___container___oQKv0Y",
19
+ "label": "-dr-pogodin-react-utils___src-shared-components-selectors-CustomDropdown-theme___label___YUPUNs",
20
+ "dropdown": "-dr-pogodin-react-utils___src-shared-components-selectors-CustomDropdown-theme___dropdown___pNEyAA",
21
+ "option": "-dr-pogodin-react-utils___src-shared-components-selectors-CustomDropdown-theme___option___LD2Kzy",
22
+ "select": "-dr-pogodin-react-utils___src-shared-components-selectors-CustomDropdown-theme___select___LP5azC",
23
+ "arrow": "-dr-pogodin-react-utils___src-shared-components-selectors-CustomDropdown-theme___arrow___-wscve",
24
+ "active": "-dr-pogodin-react-utils___src-shared-components-selectors-CustomDropdown-theme___active___k2UDsV"
25
+ };
26
+ const BaseCustomDropdown = ({
27
+ filter,
28
+ label,
29
+ onChange,
30
+ options,
31
+ theme,
32
+ value
33
+ }) => {
34
+ if (!options) throw Error('Internal error');
35
+ const dropdownRef = (0, _react.useRef)(null);
36
+
37
+ // If "null" the dropdown is closed, otherwise it is displayed
38
+ // at the specified coordinates.
39
+ const [anchor, setAnchor] = (0, _react.useState)(null);
40
+ const openList = () => {
41
+ setAnchor(dropdownRef.current.getBoundingClientRect());
42
+ };
43
+ let selected = /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
44
+ children: "\u200C"
45
+ });
46
+ for (let i = 0; i < options.length; ++i) {
47
+ const option = options[i];
48
+ if (!filter || filter(option)) {
49
+ const [iValue, iName] = (0, _common.optionValueName)(option);
50
+ if (iValue === value) {
51
+ selected = iName;
52
+ break;
53
+ }
54
+ }
55
+ }
56
+ let containerClassName = theme.container;
57
+ if (anchor) containerClassName += ` ${theme.active}`;
58
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
59
+ className: containerClassName,
60
+ children: [label === undefined ? null : /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
61
+ className: theme.label,
62
+ children: label
63
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
64
+ className: theme.dropdown,
65
+ onClick: openList,
66
+ onKeyDown: e => {
67
+ if (e.key === 'Enter') openList();
68
+ },
69
+ ref: dropdownRef,
70
+ role: "listbox",
71
+ tabIndex: 0,
72
+ children: [selected, /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
73
+ className: theme.arrow
74
+ })]
75
+ }), anchor ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Options.default, {
76
+ anchorRect: anchor,
77
+ containerClass: theme.select || '',
78
+ onCancel: () => setAnchor(null),
79
+ onChange: newValue => {
80
+ setAnchor(null);
81
+ if (onChange) onChange(newValue);
82
+ },
83
+ optionClass: theme.option || '',
84
+ options: options
85
+ }) : null]
86
+ });
87
+ };
88
+ const ThemedCustomDropdown = (0, _reactThemes.default)(BaseCustomDropdown, 'CustomDropdown', _common.validThemeKeys, defaultTheme);
89
+ BaseCustomDropdown.propTypes = {
90
+ filter: _propTypes.default.func,
91
+ label: _propTypes.default.node,
92
+ onChange: _propTypes.default.func,
93
+ options: _propTypes.default.arrayOf(_common.optionValidator.isRequired),
94
+ theme: ThemedCustomDropdown.themeType.isRequired,
95
+ value: _propTypes.default.string
96
+ };
97
+ BaseCustomDropdown.defaultProps = {
98
+ filter: undefined,
99
+ label: undefined,
100
+ onChange: undefined,
101
+ options: [],
102
+ value: undefined
103
+ };
104
+ var _default = exports.default = ThemedCustomDropdown;
105
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["_propTypes","_interopRequireDefault","require","_react","_reactThemes","_Options","_common","_jsxRuntime","defaultTheme","BaseCustomDropdown","filter","label","onChange","options","theme","value","Error","dropdownRef","useRef","anchor","setAnchor","useState","openList","current","getBoundingClientRect","selected","jsx","Fragment","children","i","length","option","iValue","iName","optionValueName","containerClassName","container","active","jsxs","className","undefined","dropdown","onClick","onKeyDown","e","key","ref","role","tabIndex","arrow","default","anchorRect","containerClass","select","onCancel","newValue","optionClass","ThemedCustomDropdown","themed","validThemeKeys","propTypes","PT","func","node","arrayOf","optionValidator","isRequired","themeType","string","defaultProps","_default","exports"],"sources":["../../../../../../src/shared/components/selectors/CustomDropdown/index.tsx"],"sourcesContent":["import PT from 'prop-types';\nimport { useRef, useState } from 'react';\n\nimport themed from '@dr.pogodin/react-themes';\n\nimport Options from './Options';\n\nimport defaultTheme from './theme.scss';\n\nimport {\n type PropsT,\n optionValidator,\n optionValueName,\n validThemeKeys,\n} from '../common';\n\nconst BaseCustomDropdown: React.FunctionComponent<\nPropsT<React.ReactNode, (value: string) => void>\n> = ({\n filter,\n label,\n onChange,\n options,\n theme,\n value,\n}) => {\n if (!options) throw Error('Internal error');\n\n const dropdownRef = useRef<HTMLDivElement>(null);\n\n // If \"null\" the dropdown is closed, otherwise it is displayed\n // at the specified coordinates.\n const [anchor, setAnchor] = useState<DOMRect | null>(null);\n\n const openList = () => {\n setAnchor(dropdownRef.current!.getBoundingClientRect());\n };\n\n let selected: React.ReactNode = <>&zwnj;</>;\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 if (iValue === value) {\n selected = iName;\n break;\n }\n }\n }\n\n let containerClassName = theme.container;\n if (anchor) containerClassName += ` ${theme.active}`;\n\n return (\n <div className={containerClassName}>\n {label === undefined ? null : (\n <div className={theme.label}>{label}</div>\n )}\n <div\n className={theme.dropdown}\n onClick={openList}\n onKeyDown={(e) => {\n if (e.key === 'Enter') openList();\n }}\n ref={dropdownRef}\n role=\"listbox\"\n tabIndex={0}\n >\n {selected}\n <div className={theme.arrow} />\n </div>\n {\n anchor ? (\n <Options\n anchorRect={anchor}\n containerClass={theme.select || ''}\n onCancel={() => setAnchor(null)}\n onChange={(newValue) => {\n setAnchor(null);\n if (onChange) onChange(newValue);\n }}\n optionClass={theme.option || ''}\n options={options}\n />\n ) : null\n }\n </div>\n );\n};\n\nconst ThemedCustomDropdown = themed(\n BaseCustomDropdown,\n 'CustomDropdown',\n validThemeKeys,\n defaultTheme,\n);\n\nBaseCustomDropdown.propTypes = {\n filter: PT.func,\n label: PT.node,\n onChange: PT.func,\n options: PT.arrayOf(optionValidator.isRequired),\n theme: ThemedCustomDropdown.themeType.isRequired,\n value: PT.string,\n};\n\nBaseCustomDropdown.defaultProps = {\n filter: undefined,\n label: undefined,\n onChange: undefined,\n options: [],\n value: undefined,\n};\n\nexport default ThemedCustomDropdown;\n"],"mappings":";;;;;;;AAAA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAEA,IAAAE,YAAA,GAAAH,sBAAA,CAAAC,OAAA;AAEA,IAAAG,QAAA,GAAAJ,sBAAA,CAAAC,OAAA;AAIA,IAAAI,OAAA,GAAAJ,OAAA;AAKmB,IAAAK,WAAA,GAAAL,OAAA;AAAA,MAAAM,YAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAEnB,MAAMC,kBAEL,GAAGA,CAAC;EACHC,MAAM;EACNC,KAAK;EACLC,QAAQ;EACRC,OAAO;EACPC,KAAK;EACLC;AACF,CAAC,KAAK;EACJ,IAAI,CAACF,OAAO,EAAE,MAAMG,KAAK,CAAC,gBAAgB,CAAC;EAE3C,MAAMC,WAAW,GAAG,IAAAC,aAAM,EAAiB,IAAI,CAAC;;EAEhD;EACA;EACA,MAAM,CAACC,MAAM,EAAEC,SAAS,CAAC,GAAG,IAAAC,eAAQ,EAAiB,IAAI,CAAC;EAE1D,MAAMC,QAAQ,GAAGA,CAAA,KAAM;IACrBF,SAAS,CAACH,WAAW,CAACM,OAAO,CAAEC,qBAAqB,CAAC,CAAC,CAAC;EACzD,CAAC;EAED,IAAIC,QAAyB,gBAAG,IAAAlB,WAAA,CAAAmB,GAAA,EAAAnB,WAAA,CAAAoB,QAAA;IAAAC,QAAA,EAAE;EAAM,CAAE,CAAC;EAC3C,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGhB,OAAO,CAACiB,MAAM,EAAE,EAAED,CAAC,EAAE;IACvC,MAAME,MAAM,GAAGlB,OAAO,CAACgB,CAAC,CAAC;IACzB,IAAI,CAACnB,MAAM,IAAIA,MAAM,CAACqB,MAAM,CAAC,EAAE;MAC7B,MAAM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AS,CAAC,IAAI,CAAC;QACf,IAAIR,QAAQ,EAAEA,QAAQ,CAAC2C,QAAQ,CAAC;MAClC,CAAE;MACFC,WAAW,EAAE1C,KAAK,CAACiB,MAAM,IAAI,EAAG;MAChClB,OAAO,EAAEA;IAAQ,CAClB,CAAC,GACA,IAAI;EAAA,CAEP,CAAC;AAEV,CAAC;AAED,MAAM4C,oBAAoB,GAAG,IAAAC,oBAAM,EACjCjD,kBAAkB,EAClB,gBAAgB,EAChBkD,sBAAc,EACdnD,YACF,CAAC;AAEDC,kBAAkB,CAACmD,SAAS,GAAG;EAC7BlD,MAAM,EAAEmD,kBAAE,CAACC,IAAI;EACfnD,KAAK,EAAEkD,kBAAE,CAACE,IAAI;EACdnD,QAAQ,EAAEiD,kBAAE,CAACC,IAAI;EACjBjD,OAAO,EAAEgD,kBAAE,CAACG,OAAO,CAACC,uBAAe,CAACC,UAAU,CAAC;EAC/CpD,KAAK,EAAE2C,oBAAoB,CAACU,SAAS,CAACD,UAAU;EAChDnD,KAAK,EAAE8C,kBAAE,CAACO;AACZ,CAAC;AAED3D,kBAAkB,CAAC4D,YAAY,GAAG;EAChC3D,MAAM,EAAE8B,SAAS;EACjB7B,KAAK,EAAE6B,SAAS;EAChB5B,QAAQ,EAAE4B,SAAS;EACnB3B,OAAO,EAAE,EAAE;EACXE,KAAK,EAAEyB;AACT,CAAC;AAAC,IAAA8B,QAAA,GAAAC,OAAA,CAAArB,OAAA,GAEaO,oBAAoB","ignoreList":[]}
@@ -7,20 +7,22 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.default = void 0;
8
8
  var _propTypes = _interopRequireDefault(require("prop-types"));
9
9
  var _reactThemes = _interopRequireDefault(require("@dr.pogodin/react-themes"));
10
+ var _common = require("../common");
10
11
  var _jsxRuntime = require("react/jsx-runtime");
12
+ // Implements dropdown based on the native HTML <select> element.
11
13
  const defaultTheme = {
12
- "context": "-dr-pogodin-react-utils___src-shared-components-Dropdown-theme___context___haRIry",
13
- "ad": "-dr-pogodin-react-utils___src-shared-components-Dropdown-theme___ad___D4XHG2",
14
- "hoc": "-dr-pogodin-react-utils___src-shared-components-Dropdown-theme___hoc___N3nd34",
15
- "dropdown": "-dr-pogodin-react-utils___src-shared-components-Dropdown-theme___dropdown___-LiQj8",
16
- "arrow": "-dr-pogodin-react-utils___src-shared-components-Dropdown-theme___arrow___-zPK7Y",
17
- "container": "-dr-pogodin-react-utils___src-shared-components-Dropdown-theme___container___9CQpeA",
18
- "label": "-dr-pogodin-react-utils___src-shared-components-Dropdown-theme___label___Gv0kyu",
19
- "option": "-dr-pogodin-react-utils___src-shared-components-Dropdown-theme___option___xmsujA",
20
- "hiddenOption": "-dr-pogodin-react-utils___src-shared-components-Dropdown-theme___hiddenOption___RdW3yR",
21
- "select": "-dr-pogodin-react-utils___src-shared-components-Dropdown-theme___select___JXK1uw"
14
+ "context": "-dr-pogodin-react-utils___src-shared-components-selectors-NativeDropdown-theme___context___xHyZo4",
15
+ "ad": "-dr-pogodin-react-utils___src-shared-components-selectors-NativeDropdown-theme___ad___ADu59e",
16
+ "hoc": "-dr-pogodin-react-utils___src-shared-components-selectors-NativeDropdown-theme___hoc___FTP2bb",
17
+ "dropdown": "-dr-pogodin-react-utils___src-shared-components-selectors-NativeDropdown-theme___dropdown___kI9A9U",
18
+ "arrow": "-dr-pogodin-react-utils___src-shared-components-selectors-NativeDropdown-theme___arrow___DubGkT",
19
+ "container": "-dr-pogodin-react-utils___src-shared-components-selectors-NativeDropdown-theme___container___WtSZPd",
20
+ "active": "-dr-pogodin-react-utils___src-shared-components-selectors-NativeDropdown-theme___active___ayMn7O",
21
+ "label": "-dr-pogodin-react-utils___src-shared-components-selectors-NativeDropdown-theme___label___K7JYKw",
22
+ "option": "-dr-pogodin-react-utils___src-shared-components-selectors-NativeDropdown-theme___option___27pZ6W",
23
+ "hiddenOption": "-dr-pogodin-react-utils___src-shared-components-selectors-NativeDropdown-theme___hiddenOption___clAKFJ",
24
+ "select": "-dr-pogodin-react-utils___src-shared-components-selectors-NativeDropdown-theme___select___N0Fc14"
22
25
  };
23
- const validThemeKeys = ['arrow', 'container', 'dropdown', 'hiddenOption', 'label', 'option', 'select'];
24
26
  /**
25
27
  * Implements a themeable dropdown list. Internally it is rendered with help of
26
28
  * the standard HTML `<select>` element, thus the styling support is somewhat
@@ -44,30 +46,23 @@ const Dropdown = ({
44
46
  filter,
45
47
  label,
46
48
  onChange,
47
- options = [],
49
+ options,
48
50
  theme,
49
51
  value
50
52
  }) => {
53
+ if (!options) throw Error('Internal error');
51
54
  let isValidValue = false;
52
55
  const optionElements = [];
53
56
  for (let i = 0; i < options.length; ++i) {
54
57
  const option = options[i];
55
58
  if (!filter || filter(option)) {
56
- let optionValue;
57
- let optionName;
58
- if (typeof option === 'string') {
59
- optionName = option;
60
- optionValue = option;
61
- } else {
62
- optionName = option.name || option.value;
63
- optionValue = option.value;
64
- }
65
- isValidValue ||= optionValue === value;
59
+ const [iValue, iName] = (0, _common.optionValueName)(option);
60
+ isValidValue ||= iValue === value;
66
61
  optionElements.push( /*#__PURE__*/(0, _jsxRuntime.jsx)("option", {
67
62
  className: theme.option,
68
- value: optionValue,
69
- children: optionName
70
- }, optionValue));
63
+ value: iValue,
64
+ children: iName
65
+ }, iValue));
71
66
  }
72
67
  }
73
68
 
@@ -83,7 +78,7 @@ const Dropdown = ({
83
78
  }, "__reactUtilsHiddenOption");
84
79
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
85
80
  className: theme.container,
86
- children: [label === undefined ? null : /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
81
+ children: [label === undefined ? null : /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
87
82
  className: theme.label,
88
83
  children: label
89
84
  }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
@@ -94,21 +89,17 @@ const Dropdown = ({
94
89
  value: value,
95
90
  children: [hiddenOption, optionElements]
96
91
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
97
- className: theme.arrow,
98
- children: "\u25BC"
92
+ className: theme.arrow
99
93
  })]
100
94
  })]
101
95
  });
102
96
  };
103
- const ThemedDropdown = (0, _reactThemes.default)(Dropdown, 'Dropdown', validThemeKeys, defaultTheme);
97
+ const ThemedDropdown = (0, _reactThemes.default)(Dropdown, 'Dropdown', _common.validThemeKeys, defaultTheme);
104
98
  Dropdown.propTypes = {
105
99
  filter: _propTypes.default.func,
106
- label: _propTypes.default.string,
100
+ label: _propTypes.default.node,
107
101
  onChange: _propTypes.default.func,
108
- options: _propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.shape({
109
- name: _propTypes.default.string,
110
- value: _propTypes.default.string.isRequired
111
- }), _propTypes.default.string]).isRequired),
102
+ options: _common.optionsValidator,
112
103
  theme: ThemedDropdown.themeType.isRequired,
113
104
  value: _propTypes.default.string
114
105
  };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["_propTypes","_interopRequireDefault","require","_reactThemes","_common","_jsxRuntime","defaultTheme","Dropdown","filter","label","onChange","options","theme","value","Error","isValidValue","optionElements","i","length","option","iValue","iName","optionValueName","push","jsx","className","children","hiddenOption","disabled","jsxs","container","undefined","dropdown","select","arrow","ThemedDropdown","themed","validThemeKeys","propTypes","PT","func","node","optionsValidator","themeType","isRequired","string","defaultProps","_default","exports","default"],"sources":["../../../../../../src/shared/components/selectors/NativeDropdown/index.tsx"],"sourcesContent":["// Implements dropdown based on the native HTML <select> element.\n\nimport PT from 'prop-types';\n\nimport themed from '@dr.pogodin/react-themes';\n\nimport defaultTheme from './theme.scss';\n\nimport {\n type PropsT,\n optionsValidator,\n optionValueName,\n validThemeKeys,\n} from '../common';\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 [props] Component properties.\n * @param [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 [props.label] Dropdown label.\n * @param [props.onChange] Selection event handler.\n * @param [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 [props.theme] _Ad hoc_ theme.\n * @param [props.value] Currently selected value.\n * @param [props....]\n * [Other theming properties](https://www.npmjs.com/package/@dr.pogodin/react-themes#themed-component-properties)\n */\nconst Dropdown: React.FunctionComponent<PropsT<string>> = ({\n filter,\n label,\n onChange,\n options,\n theme,\n value,\n}) => {\n if (!options) throw Error('Internal error');\n\n let isValidValue = false;\n const optionElements = [];\n\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 isValidValue ||= iValue === value;\n optionElements.push(\n <option className={theme.option} key={iValue} value={iValue}>\n {iName}\n </option>,\n );\n }\n }\n\n // NOTE: This element represents the current `value` when it does not match\n // any valid option. In Chrome, and some other browsers, we are able to hide\n // it from the opened dropdown; in others, e.g. Safari, the best we can do is\n // to show it as disabled.\n const hiddenOption = isValidValue ? null : (\n <option\n disabled\n className={theme.hiddenOption}\n key=\"__reactUtilsHiddenOption\"\n value={value}\n >\n {value}\n </option>\n );\n\n return (\n <div className={theme.container}>\n { label === undefined ? null : <div className={theme.label}>{label}</div> }\n <div className={theme.dropdown}>\n <select\n className={theme.select}\n onChange={onChange}\n value={value}\n >\n {hiddenOption}\n {optionElements}\n </select>\n <div className={theme.arrow} />\n </div>\n </div>\n );\n};\n\nconst ThemedDropdown = themed(\n Dropdown,\n 'Dropdown',\n validThemeKeys,\n defaultTheme,\n);\n\nDropdown.propTypes = {\n filter: PT.func,\n label: PT.node,\n onChange: PT.func,\n options: optionsValidator,\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: '',\n};\n\nexport default ThemedDropdown;\n"],"mappings":";;;;;;;AAEA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,I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AS;EACnBpB,OAAO,EAAE,EAAE;EACXE,KAAK,EAAE;AACT,CAAC;AAAC,IAAAkC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEad,cAAc","ignoreList":[]}
@@ -0,0 +1,76 @@
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 _reactThemes = _interopRequireDefault(require("@dr.pogodin/react-themes"));
10
+ var _common = require("../common");
11
+ var _jsxRuntime = require("react/jsx-runtime");
12
+ const defaultTheme = {
13
+ "context": "-dr-pogodin-react-utils___src-shared-components-selectors-Switch-theme___context___VMHfnP",
14
+ "ad": "-dr-pogodin-react-utils___src-shared-components-selectors-Switch-theme___ad___HNliRC",
15
+ "hoc": "-dr-pogodin-react-utils___src-shared-components-selectors-Switch-theme___hoc___2Ue-db",
16
+ "container": "-dr-pogodin-react-utils___src-shared-components-selectors-Switch-theme___container___AWNvRj",
17
+ "option": "-dr-pogodin-react-utils___src-shared-components-selectors-Switch-theme___option___fUfIAd",
18
+ "selected": "-dr-pogodin-react-utils___src-shared-components-selectors-Switch-theme___selected___Wco-qk",
19
+ "switch": "-dr-pogodin-react-utils___src-shared-components-selectors-Switch-theme___switch___HR5LN5"
20
+ };
21
+ const validThemeKeys = ['container', 'label', 'option', 'selected', 'switch'];
22
+ const BaseSwitch = ({
23
+ label,
24
+ onChange,
25
+ options,
26
+ theme,
27
+ value
28
+ }) => {
29
+ if (!options || !theme.option) throw Error('Internal error');
30
+ const optionNodes = [];
31
+ for (let i = 0; i < options?.length; ++i) {
32
+ const [iValue, iName] = (0, _common.optionValueName)(options[i]);
33
+ let className = theme.option;
34
+ let onPress;
35
+ if (iValue === value) className += ` ${theme.selected}`;else if (onChange) onPress = () => onChange(iValue);
36
+ optionNodes.push(onPress ? /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
37
+ className: className,
38
+ onClick: onPress,
39
+ onKeyDown: e => {
40
+ if (onPress && e.key === 'Enter') onPress();
41
+ },
42
+ role: "button",
43
+ tabIndex: 0,
44
+ children: iName
45
+ }, iValue) : /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
46
+ className: className,
47
+ children: iName
48
+ }, iValue));
49
+ }
50
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
51
+ className: theme.container,
52
+ children: [label ? /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
53
+ className: theme.label,
54
+ children: label
55
+ }) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
56
+ className: theme.switch,
57
+ children: optionNodes
58
+ })]
59
+ });
60
+ };
61
+ const ThemedSwitch = (0, _reactThemes.default)(BaseSwitch, 'Switch', validThemeKeys, defaultTheme);
62
+ BaseSwitch.propTypes = {
63
+ label: _propTypes.default.node,
64
+ onChange: _propTypes.default.func,
65
+ options: _common.optionsValidator,
66
+ theme: ThemedSwitch.themeType.isRequired,
67
+ value: _propTypes.default.string
68
+ };
69
+ BaseSwitch.defaultProps = {
70
+ label: undefined,
71
+ onChange: undefined,
72
+ options: [],
73
+ value: undefined
74
+ };
75
+ var _default = exports.default = ThemedSwitch;
76
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["_propTypes","_interopRequireDefault","require","_reactThemes","_common","_jsxRuntime","defaultTheme","validThemeKeys","BaseSwitch","label","onChange","options","theme","value","option","Error","optionNodes","i","length","iValue","iName","optionValueName","className","onPress","selected","push","jsx","onClick","onKeyDown","e","key","role","tabIndex","children","jsxs","container","switch","ThemedSwitch","themed","propTypes","PT","node","func","optionsValidator","themeType","isRequired","string","defaultProps","undefined","_default","exports","default"],"sources":["../../../../../../src/shared/components/selectors/Switch/index.tsx"],"sourcesContent":["import PT from 'prop-types';\nimport themed, { type Theme } from '@dr.pogodin/react-themes';\n\nimport { type OptionsT, optionsValidator, optionValueName } from '../common';\n\nimport defaultTheme from './theme.scss';\n\nconst validThemeKeys = [\n 'container',\n 'label',\n 'option',\n 'selected',\n 'switch',\n] as const;\n\ntype PropsT = {\n label?: React.ReactNode;\n onChange?: (value: string) => void;\n options?: Readonly<OptionsT<React.ReactNode>>;\n theme: Theme<typeof validThemeKeys>;\n value?: string;\n};\n\nconst BaseSwitch: React.FunctionComponent<PropsT> = ({\n label,\n onChange,\n options,\n theme,\n value,\n}) => {\n if (!options || !theme.option) throw Error('Internal error');\n\n const optionNodes: React.ReactNode[] = [];\n for (let i = 0; i < options?.length; ++i) {\n const [iValue, iName] = optionValueName(options[i]);\n\n let className: string = theme.option;\n let onPress: (() => void) | undefined;\n if (iValue === value) className += ` ${theme.selected}`;\n else if (onChange) onPress = () => onChange(iValue);\n\n optionNodes.push(\n onPress ? (\n <div\n className={className}\n onClick={onPress}\n onKeyDown={(e) => {\n if (onPress && e.key === 'Enter') onPress();\n }}\n key={iValue}\n role=\"button\"\n tabIndex={0}\n >\n {iName}\n </div>\n ) : (\n <div className={className} key={iValue}>{iName}</div>\n ),\n );\n }\n\n return (\n <div className={theme.container}>\n {label ? <div className={theme.label}>{label}</div> : null}\n <div className={theme.switch}>\n {optionNodes}\n </div>\n </div>\n );\n};\n\nconst ThemedSwitch = themed(\n BaseSwitch,\n 'Switch',\n validThemeKeys,\n defaultTheme,\n);\n\nBaseSwitch.propTypes = {\n label: PT.node,\n onChange: PT.func,\n options: optionsValidator,\n theme: ThemedSwitch.themeType.isRequired,\n value: PT.string,\n};\n\nBaseSwitch.defaultProps = {\n label: undefined,\n onChange: undefined,\n options: [],\n value: undefined,\n};\n\nexport default ThemedSwitch;\n"],"mappings":";;;;;;;AAAA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAF,sBAAA,CAAAC,OAAA;AAEA,IAAAE,OAAA,GAAAF,OAAA;AAA6E,IAAAG,WAAA,GAAAH,OAAA;AAAA,MAAAI,YAA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W,QAAA,EAAeb;IAAK,GAAdD,MAAoB,CAExD,CAAC;EACH;EAEA,oBACE,IAAAd,WAAA,CAAA6B,IAAA;IAAKZ,SAAS,EAAEV,KAAK,CAACuB,SAAU;IAAAF,QAAA,GAC7BxB,KAAK,gBAAG,IAAAJ,WAAA,CAAAqB,GAAA;MAAKJ,SAAS,EAAEV,KAAK,CAACH,KAAM;MAAAwB,QAAA,EAAExB;IAAK,CAAM,CAAC,GAAG,IAAI,eAC1D,IAAAJ,WAAA,CAAAqB,GAAA;MAAKJ,SAAS,EAAEV,KAAK,CAACwB,MAAO;MAAAH,QAAA,EAC1BjB;IAAW,CACT,CAAC;EAAA,CACH,CAAC;AAEV,CAAC;AAED,MAAMqB,YAAY,GAAG,IAAAC,oBAAM,EACzB9B,UAAU,EACV,QAAQ,EACRD,cAAc,EACdD,YACF,CAAC;AAEDE,UAAU,CAAC+B,SAAS,GAAG;EACrB9B,KAAK,EAAE+B,kBAAE,CAACC,IAAI;EACd/B,QAAQ,EAAE8B,kBAAE,CAACE,IAAI;EACjB/B,OAAO,EAAEgC,wBAAgB;EACzB/B,KAAK,EAAEyB,YAAY,CAACO,SAAS,CAACC,UAAU;EACxChC,KAAK,EAAE2B,kBAAE,CAACM;AACZ,CAAC;AAEDtC,UAAU,CAACuC,YAAY,GAAG;EACxBtC,KAAK,EAAEuC,SAAS;EAChBtC,QAAQ,EAAEsC,SAAS;EACnBrC,OAAO,EAAE,EAAE;EACXE,KAAK,EAAEmC;AACT,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEad,YAAY","ignoreList":[]}
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.optionValidator = void 0;
8
+ exports.optionValueName = optionValueName;
9
+ exports.validThemeKeys = exports.optionsValidator = void 0;
10
+ var _propTypes = _interopRequireDefault(require("prop-types"));
11
+ // The stuff common between different dropdown implementations.
12
+
13
+ const validThemeKeys = exports.validThemeKeys = ['active', 'arrow', 'container', 'dropdown', 'hiddenOption', 'label', 'option', 'select'];
14
+ const optionValidator = exports.optionValidator = _propTypes.default.oneOfType([_propTypes.default.shape({
15
+ name: _propTypes.default.string,
16
+ value: _propTypes.default.string.isRequired
17
+ }).isRequired, _propTypes.default.string.isRequired]);
18
+ const optionsValidator = exports.optionsValidator = _propTypes.default.arrayOf(optionValidator.isRequired);
19
+
20
+ /** Returns option value and name as a tuple. */
21
+ function optionValueName(option) {
22
+ return typeof option === 'string' ? [option, option] : [option.value, option.name ?? option.value];
23
+ }
24
+ //# sourceMappingURL=common.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.js","names":["_propTypes","_interopRequireDefault","require","validThemeKeys","exports","optionValidator","PT","oneOfType","shape","name","string","value","isRequired","optionsValidator","arrayOf","optionValueName","option"],"sources":["../../../../../src/shared/components/selectors/common.ts"],"sourcesContent":["// The stuff common between different dropdown implementations.\n\nimport PT from 'prop-types';\n\nimport type { Theme } from '@dr.pogodin/react-themes';\n\nexport const validThemeKeys = [\n 'active',\n 'arrow',\n 'container',\n 'dropdown',\n 'hiddenOption',\n 'label',\n 'option',\n 'select',\n] as const;\n\nexport type OptionT<NameT> = {\n name?: NameT | null;\n value: string;\n};\n\nexport type OptionsT<NameT> = Array<OptionT<NameT> | string>;\n\nexport type PropsT<\n NameT,\n OnChangeT = React.ChangeEventHandler<HTMLSelectElement>,\n> = {\n filter?: (item: OptionT<NameT> | string) => boolean;\n label?: React.ReactNode;\n onChange?: OnChangeT;\n options?: OptionsT<NameT>;\n theme: Theme<typeof validThemeKeys>;\n value?: string;\n};\n\nexport const optionValidator = PT.oneOfType([\n PT.shape({\n name: PT.string,\n value: PT.string.isRequired,\n }).isRequired,\n PT.string.isRequired,\n]);\n\nexport const optionsValidator = PT.arrayOf(optionValidator.isRequired);\n\n/** Returns option value and name as a tuple. */\nexport function optionValueName<NameT>(\n option: OptionT<NameT> | string,\n): [string, NameT | string] {\n return typeof option === 'string'\n ? [option, option]\n : [option.value, option.name ?? option.value];\n}\n"],"mappings":";;;;;;;;;AAEA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AAFA;;AAMO,MAAMC,cAAc,GAAAC,OAAA,CAAAD,cAAA,GAAG,CAC5B,QAAQ,EACR,OAAO,EACP,WAAW,EACX,UAAU,EACV,cAAc,EACd,OAAO,EACP,QAAQ,EACR,QAAQ,CACA;AAqBH,MAAME,eAAe,GAAAD,OAAA,CAAAC,eAAA,GAAGC,kBAAE,CAACC,SAAS,CAAC,CAC1CD,kBAAE,CAACE,KAAK,CAAC;EACPC,IAAI,EAAEH,kBAAE,CAACI,MAAM;EACfC,KAAK,EAAEL,kBAAE,CAACI,MAAM,CAACE;AACnB,CAAC,CAAC,CAACA,UAAU,EACbN,kBAAE,CAACI,MAAM,CAACE,UAAU,CACrB,CAAC;AAEK,MAAMC,gBAAgB,GAAAT,OAAA,CAAAS,gBAAA,GAAGP,kBAAE,CAACQ,OAAO,CAACT,eAAe,CAACO,UAAU,CAAC;;AAEtE;AACO,SAASG,eAAeA,CAC7BC,MAA+B,EACL;EAC1B,OAAO,OAAOA,MAAM,KAAK,QAAQ,GAC7B,CAACA,MAAM,EAAEA,MAAM,CAAC,GAChB,CAACA,MAAM,CAACL,KAAK,EAAEK,MAAM,CAACP,IAAI,IAAIO,MAAM,CAACL,KAAK,CAAC;AACjD","ignoreList":[]}