@dr.pogodin/react-utils 1.33.0 → 1.33.2

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 (38) hide show
  1. package/build/development/shared/components/Checkbox/index.js +1 -0
  2. package/build/development/shared/components/Checkbox/index.js.map +1 -1
  3. package/build/development/shared/components/Modal/index.js +11 -2
  4. package/build/development/shared/components/Modal/index.js.map +1 -1
  5. package/build/development/shared/components/selectors/NativeDropdown/index.js +1 -1
  6. package/build/development/shared/components/selectors/NativeDropdown/index.js.map +1 -1
  7. package/build/development/shared/components/selectors/Switch/index.js +3 -3
  8. package/build/development/shared/components/selectors/Switch/index.js.map +1 -1
  9. package/build/development/shared/components/selectors/common.js +7 -2
  10. package/build/development/shared/components/selectors/common.js.map +1 -1
  11. package/build/development/style.css +3 -3
  12. package/build/development/web.bundle.js +6 -6
  13. package/build/production/shared/components/Checkbox/index.js +1 -1
  14. package/build/production/shared/components/Checkbox/index.js.map +1 -1
  15. package/build/production/shared/components/Modal/index.js +1 -1
  16. package/build/production/shared/components/Modal/index.js.map +1 -1
  17. package/build/production/shared/components/selectors/NativeDropdown/index.js +1 -1
  18. package/build/production/shared/components/selectors/NativeDropdown/index.js.map +1 -1
  19. package/build/production/shared/components/selectors/Switch/index.js +1 -1
  20. package/build/production/shared/components/selectors/Switch/index.js.map +1 -1
  21. package/build/production/shared/components/selectors/common.js +2 -2
  22. package/build/production/shared/components/selectors/common.js.map +1 -1
  23. package/build/production/style.css +1 -1
  24. package/build/production/style.css.map +1 -1
  25. package/build/production/web.bundle.js +1 -1
  26. package/build/production/web.bundle.js.map +1 -1
  27. package/build/types-code/shared/components/selectors/Switch/index.d.ts +1 -1
  28. package/build/types-code/shared/components/selectors/common.d.ts +4 -8
  29. package/build/types-scss/src/shared/components/selectors/Switch/theme.scss.d.ts +1 -0
  30. package/config/webpack/app-base.js +4 -7
  31. package/config/webpack/lib-base.js +4 -7
  32. package/package.json +3 -3
  33. package/src/shared/components/Checkbox/index.tsx +1 -0
  34. package/src/shared/components/Modal/index.tsx +26 -2
  35. package/src/shared/components/selectors/NativeDropdown/index.tsx +2 -2
  36. package/src/shared/components/selectors/Switch/index.tsx +2 -2
  37. package/src/shared/components/selectors/Switch/theme.scss +1 -1
  38. package/src/shared/components/selectors/common.ts +14 -2
@@ -31,6 +31,7 @@ const Checkbox = ({
31
31
  checked: checked,
32
32
  className: theme.checkbox,
33
33
  onChange: onChange,
34
+ onClick: e => e.stopPropagation(),
34
35
  type: "checkbox"
35
36
  })]
36
37
  });
@@ -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","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":";;;;;;;AAAA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,YAAA,GAAAF,sBAAA,CAAAC,OAAA;AAA8D,IAAAE,WAAA,GAAAF,OAAA;AAAA,MAAAG,YAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAI9D,MAAMC,cAAc,GAAG,CAAC,UAAU,EAAE,WAAW,EAAE,OAAO,CAAU;AASlE,MAAMC,QAAwC,GAAGA,CAAC;EAChDC,OAAO;EACPC,KAAK;EACLC,QAAQ;EACRC;AACF,CAAC,kBACC,IAAAP,WAAA,CAAAQ,IAAA;EAAKC,SAAS,EAAEF,KAAK,CAACG,SAAU;EAAAC,QAAA,GAC5BN,KAAK,KAAKO,SAAS,GAAG,IAAI,gBAAG,IAAAZ,WAAA,CAAAa,GAAA;IAAKJ,SAAS,EAAEF,KAAK,CAACF,KAAM;IAAAM,QAAA,EAAEN;EAAK,CAAM,CAAC,eACzE,IAAAL,WAAA,CAAAa,GAAA;IACET,OAAO,EAAEA,OAAQ;IACjBK,SAAS,EAAEF,KAAK,CAACO,QAAS;IAC1BR,QAAQ,EAAEA,QAAS;IACnBS,IAAI,EAAC;EAAU,CAChB,CAAC;AAAA,CACC,CACN;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,cAAc,GAAG,IAAAC,oBAAM,EAC3Bd,QAAQ,EACR,UAAU,EACVD,cAAc,EACdD,YACF,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACAE,QAAQ,CAACe,SAAS,GAAG;EACnBd,OAAO,EAAEe,kBAAE,CAACC,IAAI;EAChBf,KAAK,EAAEc,kBAAE,CAACE,IAAI;EACdf,QAAQ,EAAEa,kBAAE,CAACG,IAAI;EACjBf,KAAK,EAAES,cAAc,CAACO,SAAS,CAACC;AAClC,CAAC;AAEDrB,QAAQ,CAACsB,YAAY,GAAG;EACtBrB,OAAO,EAAEQ,SAAS;EAClBP,KAAK,EAAEO,SAAS;EAChBN,QAAQ,EAAEM;AACZ,CAAC;AAAC,IAAAc,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEaZ,cAAc","ignoreList":[]}
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","onClick","e","stopPropagation","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 onClick={(e) => e.stopPropagation()}\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":";;;;;;;AAAA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,YAAA,GAAAF,sBAAA,CAAAC,OAAA;AAA8D,IAAAE,WAAA,GAAAF,OAAA;AAAA,MAAAG,YAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAI9D,MAAMC,cAAc,GAAG,CAAC,UAAU,EAAE,WAAW,EAAE,OAAO,CAAU;AASlE,MAAMC,QAAwC,GAAGA,CAAC;EAChDC,OAAO;EACPC,KAAK;EACLC,QAAQ;EACRC;AACF,CAAC,kBACC,IAAAP,WAAA,CAAAQ,IAAA;EAAKC,SAAS,EAAEF,KAAK,CAACG,SAAU;EAAAC,QAAA,GAC5BN,KAAK,KAAKO,SAAS,GAAG,IAAI,gBAAG,IAAAZ,WAAA,CAAAa,GAAA;IAAKJ,SAAS,EAAEF,KAAK,CAACF,KAAM;IAAAM,QAAA,EAAEN;EAAK,CAAM,CAAC,eACzE,IAAAL,WAAA,CAAAa,GAAA;IACET,OAAO,EAAEA,OAAQ;IACjBK,SAAS,EAAEF,KAAK,CAACO,QAAS;IAC1BR,QAAQ,EAAEA,QAAS;IACnBS,OAAO,EAAGC,CAAC,IAAKA,CAAC,CAACC,eAAe,CAAC,CAAE;IACpCC,IAAI,EAAC;EAAU,CAChB,CAAC;AAAA,CACC,CACN;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,cAAc,GAAG,IAAAC,oBAAM,EAC3BjB,QAAQ,EACR,UAAU,EACVD,cAAc,EACdD,YACF,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACAE,QAAQ,CAACkB,SAAS,GAAG;EACnBjB,OAAO,EAAEkB,kBAAE,CAACC,IAAI;EAChBlB,KAAK,EAAEiB,kBAAE,CAACE,IAAI;EACdlB,QAAQ,EAAEgB,kBAAE,CAACG,IAAI;EACjBlB,KAAK,EAAEY,cAAc,CAACO,SAAS,CAACC;AAClC,CAAC;AAEDxB,QAAQ,CAACyB,YAAY,GAAG;EACtBxB,OAAO,EAAEQ,SAAS;EAClBP,KAAK,EAAEO,SAAS;EAChBN,QAAQ,EAAEM;AACZ,CAAC;AAAC,IAAAiB,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEaZ,cAAc","ignoreList":[]}
@@ -96,9 +96,17 @@ const BaseModal = ({
96
96
  children: [focusLast, /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
97
97
  "aria-label": "Cancel",
98
98
  className: theme.overlay,
99
- onClick: () => onCancel && onCancel(),
99
+ onClick: e => {
100
+ if (onCancel) {
101
+ onCancel();
102
+ e.stopPropagation();
103
+ }
104
+ },
100
105
  onKeyDown: e => {
101
- if (e.key === 'Escape' && onCancel) onCancel();
106
+ if (e.key === 'Escape' && onCancel) {
107
+ onCancel();
108
+ e.stopPropagation();
109
+ }
102
110
  },
103
111
  ref: node => {
104
112
  if (node && node !== overlayRef.current) {
@@ -111,6 +119,7 @@ const BaseModal = ({
111
119
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
112
120
  "aria-modal": "true",
113
121
  className: theme.container,
122
+ onClick: e => e.stopPropagation(),
114
123
  onWheel: event => event.stopPropagation(),
115
124
  ref: containerRef,
116
125
  role: "dialog",
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_lodash","require","_react","_reactDom","_interopRequireDefault","_propTypes","_reactThemes","_jsxRuntime","baseTheme","S","validThemeKeys","BaseModal","cancelOnScrolling","children","containerStyle","dontDisableScrolling","onCancel","theme","containerRef","useRef","overlayRef","portal","setPortal","useState","useEffect","p","document","createElement","body","appendChild","removeChild","window","addEventListener","removeEventListener","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","bool","shape","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 cancelOnScrolling?: boolean;\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 cancelOnScrolling,\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 // Sets up modal cancellation of scrolling, if opted-in.\n useEffect(() => {\n if (cancelOnScrolling && onCancel) {\n window.addEventListener('scroll', onCancel);\n window.addEventListener('wheel', onCancel);\n }\n return () => {\n if (cancelOnScrolling && onCancel) {\n window.removeEventListener('scroll', onCancel);\n window.removeEventListener('wheel', onCancel);\n }\n };\n }, [cancelOnScrolling, onCancel]);\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 cancelOnScrolling: PT.bool,\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 cancelOnScrolling: false,\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;AAWxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,SAA0C,GAAGA,CAAC;EAClDC,iBAAiB;EACjBC,QAAQ;EACRC,cAAc;EACdC,oBAAoB;EACpBC,QAAQ;EACRC;AACF,CAAC,KAAK;EACJ,MAAM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AAoB,EAAE,KAAK;EAC3BC,QAAQ,EAAEgE;AACZ,CAAC;AAAC,IAAAC,QAAA,GAAAb,OAAA,CAAAc,OAAA,GAEab,WAAW;AAE1B","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["_lodash","require","_react","_reactDom","_interopRequireDefault","_propTypes","_reactThemes","_jsxRuntime","baseTheme","S","validThemeKeys","BaseModal","cancelOnScrolling","children","containerStyle","dontDisableScrolling","onCancel","theme","containerRef","useRef","overlayRef","portal","setPortal","useState","useEffect","p","document","createElement","body","appendChild","removeChild","window","addEventListener","removeEventListener","classList","add","scrollingDisabledByModal","remove","focusLast","useMemo","jsx","onFocus","elems","current","querySelectorAll","i","length","focus","activeElement","tabIndex","ReactDom","createPortal","jsxs","Fragment","className","overlay","onClick","e","stopPropagation","onKeyDown","key","ref","node","role","container","onWheel","event","style","exports","ThemedModal","themed","propTypes","PT","bool","shape","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 cancelOnScrolling?: boolean;\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 cancelOnScrolling,\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 // Sets up modal cancellation of scrolling, if opted-in.\n useEffect(() => {\n if (cancelOnScrolling && onCancel) {\n window.addEventListener('scroll', onCancel);\n window.addEventListener('wheel', onCancel);\n }\n return () => {\n if (cancelOnScrolling && onCancel) {\n window.removeEventListener('scroll', onCancel);\n window.removeEventListener('wheel', onCancel);\n }\n };\n }, [cancelOnScrolling, onCancel]);\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={(e) => {\n if (onCancel) {\n onCancel();\n e.stopPropagation();\n }\n }}\n onKeyDown={(e) => {\n if (e.key === 'Escape' && onCancel) {\n onCancel();\n e.stopPropagation();\n }\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 {\n // NOTE: These rules are disabled because our intention is to keep\n // the element non-interactive (thus not on the keyboard focus chain),\n // and it has `onClick` handler merely to stop propagation of click\n // events to its parent container. This is needed because, for example\n // when the modal is wrapped into an interactive element we don't want\n // any clicks inside the modal to bubble-up to that parent element\n // (because visually and logically the modal dialog does not belong\n // to its parent container, where it technically belongs from\n // the HTML mark-up perpective).\n /* eslint-disable jsx-a11y/click-events-have-key-events,\n jsx-a11y/no-noninteractive-element-interactions */\n }\n <div\n aria-modal=\"true\"\n className={theme.container}\n onClick={(e) => e.stopPropagation()}\n onWheel={(event) => event.stopPropagation()}\n ref={containerRef}\n role=\"dialog\"\n style={containerStyle}\n >\n {children}\n </div>\n {/* eslint-enable jsx-a11y/click-events-have-key-events,\n jsx-a11y/no-noninteractive-element-interactions */}\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 cancelOnScrolling: PT.bool,\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 cancelOnScrolling: false,\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,CAA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AAA,CACV,CAAC,EAELjB,MACF,CAAC,GAAG,IAAI;AACV,CAAC;AAAC+C,OAAA,CAAAzD,SAAA,GAAAA,SAAA;AAEF,MAAM0D,WAAW,GAAG,IAAAC,oBAAM,EACxB3D,SAAS,EACT,OAAO,EACPD,cAAc,EACdF,SACF,CAAC;AAEDG,SAAS,CAAC4D,SAAS,GAAG;EACpB3D,iBAAiB,EAAE4D,kBAAE,CAACC,IAAI;EAC1B5D,QAAQ,EAAE2D,kBAAE,CAACV,IAAI;EACjBhD,cAAc,EAAE0D,kBAAE,CAACE,KAAK,CAAC,CAAC,CAAC,CAAC;EAC5B3D,oBAAoB,EAAEyD,kBAAE,CAACC,IAAI;EAC7BzD,QAAQ,EAAEwD,kBAAE,CAACG,IAAI;EACjB1D,KAAK,EAAEoD,WAAW,CAACO,SAAS,CAACC;AAC/B,CAAC;AAEDlE,SAAS,CAACmE,YAAY,GAAG;EACvBlE,iBAAiB,EAAE,KAAK;EACxBC,QAAQ,EAAE,IAAI;EACdC,cAAc,EAAEiE,SAAS;EACzBhE,oBAAoB,EAAE,KAAK;EAC3BC,QAAQ,EAAEgE;AACZ,CAAC;AAAC,IAAAC,QAAA,GAAAb,OAAA,CAAAc,OAAA,GAEab,WAAW;AAE1B","ignoreList":[]}
@@ -99,7 +99,7 @@ Dropdown.propTypes = {
99
99
  filter: _propTypes.default.func,
100
100
  label: _propTypes.default.node,
101
101
  onChange: _propTypes.default.func,
102
- options: _common.optionsValidator,
102
+ options: _common.stringOptionsValidator,
103
103
  theme: ThemedDropdown.themeType.isRequired,
104
104
  value: _propTypes.default.string
105
105
  };
@@ -1 +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,IAAAC,YAAA,GAAAF,sBAAA,CAAAC,OAAA;AAIA,IAAAE,OAAA,GAAAF,OAAA;AAKmB,IAAAG,WAAA,GAAAH,OAAA;AAbnB;AAAA,MAAAI,YAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAeA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,QAAiD,GAAGA,CAAC;EACzDC,MAAM;EACNC,KAAK;EACLC,QAAQ;EACRC,OAAO;EACPC,KAAK;EACLC;AACF,CAAC,KAAK;EACJ,IAAI,CAACF,OAAO,EAAE,MAAMG,KAAK,CAAC,gBAAgB,CAAC;EAE3C,IAAIC,YAAY,GAAG,KAAK;EACxB,MAAMC,cAAc,GAAG,EAAE;EAEzB,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGN,OAAO,CAACO,MAAM,EAAE,EAAED,CAAC,EAAE;IACvC,MAAME,MAAM,GAAGR,OAAO,CAACM,CAAC,CAAC;IACzB,IAAI,CAACT,MAAM,IAAIA,MAAM,CAACW,MAAM,CAAC,EAAE;MAC7B,MAAM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,QAAQ,EACR,UAAU,EACV8B,sBAAc,EACd/B,YACF,CAAC;AAEDC,QAAQ,CAAC+B,SAAS,GAAG;EACnB9B,MAAM,EAAE+B,kBAAE,CAACC,IAAI;EACf/B,KAAK,EAAE8B,kBAAE,CAACE,IAAI;EACd/B,QAAQ,EAAE6B,kBAAE,CAACC,IAAI;EACjB7B,OAAO,EAAE+B,wBAAgB;EACzB9B,KAAK,EAAEuB,cAAc,CAACQ,SAAS,CAACC,UAAU;EAC1C/B,KAAK,EAAE0B,kBAAE,CAACM;AACZ,CAAC;AAEDtC,QAAQ,CAACuC,YAAY,GAAG;EACtBtC,MAAM,EAAEuB,SAAS;EACjBtB,KAAK,EAAEsB,SAAS;EAChBrB,QAAQ,EAAEqB,SAAS;EACnBpB,OAAO,EAAE,EAAE;EACXE,KAAK,EAAE;AACT,CAAC;AAAC,IAAAkC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEad,cAAc","ignoreList":[]}
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","stringOptionsValidator","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 optionValueName,\n stringOptionsValidator,\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: stringOptionsValidator,\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":";;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SAAS;EACjBtB,KAAK,EAAEsB,SAAS;EAChBrB,QAAQ,EAAEqB,SAAS;EACnBpB,OAAO,EAAE,EAAE;EACXE,KAAK,EAAE;AACT,CAAC;AAAC,IAAAkC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEad,cAAc","ignoreList":[]}
@@ -16,9 +16,9 @@ const defaultTheme = {
16
16
  "container": "-dr-pogodin-react-utils___src-shared-components-selectors-Switch-theme___container___AWNvRj",
17
17
  "option": "-dr-pogodin-react-utils___src-shared-components-selectors-Switch-theme___option___fUfIAd",
18
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"
19
+ "options": "-dr-pogodin-react-utils___src-shared-components-selectors-Switch-theme___options___CZYtcC"
20
20
  };
21
- const validThemeKeys = ['container', 'label', 'option', 'selected', 'switch'];
21
+ const validThemeKeys = ['container', 'label', 'option', 'options', 'selected'];
22
22
  const BaseSwitch = ({
23
23
  label,
24
24
  onChange,
@@ -53,7 +53,7 @@ const BaseSwitch = ({
53
53
  className: theme.label,
54
54
  children: label
55
55
  }) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
56
- className: theme.switch,
56
+ className: theme.options,
57
57
  children: optionNodes
58
58
  })]
59
59
  });
@@ -1 +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,GAA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,SAAS,EAAEA,SAAU;MAAAW,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":[]}
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","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 'options',\n 'selected',\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.options}>\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;\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Module", {
6
6
  });
7
7
  exports.optionValidator = void 0;
8
8
  exports.optionValueName = optionValueName;
9
- exports.validThemeKeys = exports.optionsValidator = void 0;
9
+ exports.validThemeKeys = exports.stringOptionsValidator = exports.stringOptionValidator = exports.optionsValidator = void 0;
10
10
  var _propTypes = _interopRequireDefault(require("prop-types"));
11
11
  // The stuff common between different dropdown implementations.
12
12
 
@@ -15,10 +15,15 @@ const validThemeKeys = exports.validThemeKeys = ['active', 'arrow', 'container',
15
15
  // into a separate theme spec for that component.
16
16
  'upward'];
17
17
  const optionValidator = exports.optionValidator = _propTypes.default.oneOfType([_propTypes.default.shape({
18
- name: _propTypes.default.string,
18
+ name: _propTypes.default.node,
19
19
  value: _propTypes.default.string.isRequired
20
20
  }).isRequired, _propTypes.default.string.isRequired]);
21
21
  const optionsValidator = exports.optionsValidator = _propTypes.default.arrayOf(optionValidator.isRequired);
22
+ const stringOptionValidator = exports.stringOptionValidator = _propTypes.default.oneOfType([_propTypes.default.shape({
23
+ name: _propTypes.default.string,
24
+ value: _propTypes.default.string.isRequired
25
+ }).isRequired, _propTypes.default.string.isRequired]);
26
+ const stringOptionsValidator = exports.stringOptionsValidator = _propTypes.default.arrayOf(stringOptionValidator.isRequired);
22
27
 
23
28
  /** Returns option value and name as a tuple. */
24
29
  function optionValueName(option) {
@@ -1 +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\n // TODO: This is only valid for <CustomDropdown>, thus we need to re-factor it\n // into a separate theme spec for that component.\n 'upward',\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;AAER;AACA;AACA,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":[]}
1
+ {"version":3,"file":"common.js","names":["_propTypes","_interopRequireDefault","require","validThemeKeys","exports","optionValidator","PT","oneOfType","shape","name","node","value","string","isRequired","optionsValidator","arrayOf","stringOptionValidator","stringOptionsValidator","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\n // TODO: This is only valid for <CustomDropdown>, thus we need to re-factor it\n // into a separate theme spec for that component.\n 'upward',\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:\nPT.Requireable<OptionT<React.ReactNode> | string> = PT.oneOfType([\n PT.shape({\n name: PT.node,\n value: PT.string.isRequired,\n }).isRequired,\n PT.string.isRequired,\n]);\n\nexport const optionsValidator = PT.arrayOf(optionValidator.isRequired);\n\nexport const stringOptionValidator:\nPT.Requireable<OptionT<string> | string> = PT.oneOfType([\n PT.shape({\n name: PT.string,\n value: PT.string.isRequired,\n }).isRequired,\n PT.string.isRequired,\n]);\n\nexport const stringOptionsValidator = PT.arrayOf(stringOptionValidator.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;AAER;AACA;AACA,QAAQ,CACA;AAqBH,MAAME,eACoC,GAAAD,OAAA,CAAAC,eAAA,GAAGC,kBAAE,CAACC,SAAS,CAAC,CAC/DD,kBAAE,CAACE,KAAK,CAAC;EACPC,IAAI,EAAEH,kBAAE,CAACI,IAAI;EACbC,KAAK,EAAEL,kBAAE,CAACM,MAAM,CAACC;AACnB,CAAC,CAAC,CAACA,UAAU,EACbP,kBAAE,CAACM,MAAM,CAACC,UAAU,CACrB,CAAC;AAEK,MAAMC,gBAAgB,GAAAV,OAAA,CAAAU,gBAAA,GAAGR,kBAAE,CAACS,OAAO,CAACV,eAAe,CAACQ,UAAU,CAAC;AAE/D,MAAMG,qBAC2B,GAAAZ,OAAA,CAAAY,qBAAA,GAAGV,kBAAE,CAACC,SAAS,CAAC,CACtDD,kBAAE,CAACE,KAAK,CAAC;EACPC,IAAI,EAAEH,kBAAE,CAACM,MAAM;EACfD,KAAK,EAAEL,kBAAE,CAACM,MAAM,CAACC;AACnB,CAAC,CAAC,CAACA,UAAU,EACbP,kBAAE,CAACM,MAAM,CAACC,UAAU,CACrB,CAAC;AAEK,MAAMI,sBAAsB,GAAAb,OAAA,CAAAa,sBAAA,GAAGX,kBAAE,CAACS,OAAO,CAACC,qBAAqB,CAACH,UAAU,CAAC;;AAElF;AACO,SAASK,eAAeA,CAC7BC,MAA+B,EACL;EAC1B,OAAO,OAAOA,MAAM,KAAK,QAAQ,GAC7B,CAACA,MAAM,EAAEA,MAAM,CAAC,GAChB,CAACA,MAAM,CAACR,KAAK,EAAEQ,MAAM,CAACV,IAAI,IAAIU,MAAM,CAACR,KAAK,CAAC;AACjD","ignoreList":[]}
@@ -433,9 +433,9 @@ body {
433
433
  background: white;
434
434
  cursor: default;
435
435
  }
436
- *.-dr-pogodin-react-utils___src-shared-components-selectors-Switch-theme___switch___HR5LN5,
437
- .-dr-pogodin-react-utils___src-shared-components-selectors-Switch-theme___context___VMHfnP.-dr-pogodin-react-utils___src-shared-components-selectors-Switch-theme___switch___HR5LN5,
438
- .-dr-pogodin-react-utils___src-shared-components-selectors-Switch-theme___ad___HNliRC.-dr-pogodin-react-utils___src-shared-components-selectors-Switch-theme___hoc___2Ue-db.-dr-pogodin-react-utils___src-shared-components-selectors-Switch-theme___switch___HR5LN5 {
436
+ *.-dr-pogodin-react-utils___src-shared-components-selectors-Switch-theme___options___CZYtcC,
437
+ .-dr-pogodin-react-utils___src-shared-components-selectors-Switch-theme___context___VMHfnP.-dr-pogodin-react-utils___src-shared-components-selectors-Switch-theme___options___CZYtcC,
438
+ .-dr-pogodin-react-utils___src-shared-components-selectors-Switch-theme___ad___HNliRC.-dr-pogodin-react-utils___src-shared-components-selectors-Switch-theme___hoc___2Ue-db.-dr-pogodin-react-utils___src-shared-components-selectors-Switch-theme___options___CZYtcC {
439
439
  align-items: center;
440
440
  background: whitesmoke;
441
441
  border: 1px solid gray;
@@ -66,7 +66,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var prop
66
66
  \**************************************************/
67
67
  /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
68
68
 
69
- eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! prop-types */ \"prop-types\");\n/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _dr_pogodin_react_themes__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @dr.pogodin/react-themes */ \"@dr.pogodin/react-themes\");\n/* harmony import */ var _dr_pogodin_react_themes__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_dr_pogodin_react_themes__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _theme_scss__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./theme.scss */ \"./src/shared/components/Checkbox/theme.scss\");\n/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react/jsx-runtime */ \"./node_modules/react/jsx-runtime.js\");\n\n\n\n\nconst validThemeKeys = ['checkbox', 'container', 'label'];\nconst Checkbox = _ref => {\n let {\n checked,\n label,\n onChange,\n theme\n } = _ref;\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(\"div\", {\n className: theme.container,\n children: [label === undefined ? null : /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(\"div\", {\n className: theme.label,\n children: label\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(\"input\", {\n checked: checked,\n className: theme.checkbox,\n onChange: onChange,\n type: \"checkbox\"\n })]\n });\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 = _dr_pogodin_react_themes__WEBPACK_IMPORTED_MODULE_1___default()(Checkbox, 'Checkbox', validThemeKeys, _theme_scss__WEBPACK_IMPORTED_MODULE_2__[\"default\"]);\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: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().bool),\n label: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().node),\n onChange: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().func),\n theme: ThemedCheckbox.themeType.isRequired\n};\nCheckbox.defaultProps = {\n checked: undefined,\n label: undefined,\n onChange: undefined\n};\n/* harmony default export */ __webpack_exports__[\"default\"] = (ThemedCheckbox);\n\n//# sourceURL=webpack://@dr.pogodin/react-utils/./src/shared/components/Checkbox/index.tsx?");
69
+ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! prop-types */ \"prop-types\");\n/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _dr_pogodin_react_themes__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @dr.pogodin/react-themes */ \"@dr.pogodin/react-themes\");\n/* harmony import */ var _dr_pogodin_react_themes__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_dr_pogodin_react_themes__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _theme_scss__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./theme.scss */ \"./src/shared/components/Checkbox/theme.scss\");\n/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react/jsx-runtime */ \"./node_modules/react/jsx-runtime.js\");\n\n\n\n\nconst validThemeKeys = ['checkbox', 'container', 'label'];\nconst Checkbox = _ref => {\n let {\n checked,\n label,\n onChange,\n theme\n } = _ref;\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(\"div\", {\n className: theme.container,\n children: [label === undefined ? null : /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(\"div\", {\n className: theme.label,\n children: label\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(\"input\", {\n checked: checked,\n className: theme.checkbox,\n onChange: onChange,\n onClick: e => e.stopPropagation(),\n type: \"checkbox\"\n })]\n });\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 = _dr_pogodin_react_themes__WEBPACK_IMPORTED_MODULE_1___default()(Checkbox, 'Checkbox', validThemeKeys, _theme_scss__WEBPACK_IMPORTED_MODULE_2__[\"default\"]);\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: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().bool),\n label: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().node),\n onChange: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().func),\n theme: ThemedCheckbox.themeType.isRequired\n};\nCheckbox.defaultProps = {\n checked: undefined,\n label: undefined,\n onChange: undefined\n};\n/* harmony default export */ __webpack_exports__[\"default\"] = (ThemedCheckbox);\n\n//# sourceURL=webpack://@dr.pogodin/react-utils/./src/shared/components/Checkbox/index.tsx?");
70
70
 
71
71
  /***/ }),
72
72
 
@@ -116,7 +116,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var prop
116
116
  \***********************************************/
117
117
  /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
118
118
 
119
- eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ BaseModal: function() { return /* binding */ BaseModal; }\n/* harmony export */ });\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lodash */ \"lodash\");\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react-dom */ \"react-dom\");\n/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react_dom__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! prop-types */ \"prop-types\");\n/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var _dr_pogodin_react_themes__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @dr.pogodin/react-themes */ \"@dr.pogodin/react-themes\");\n/* harmony import */ var _dr_pogodin_react_themes__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_dr_pogodin_react_themes__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var _base_theme_scss__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./base-theme.scss */ \"./src/shared/components/Modal/base-theme.scss\");\n/* harmony import */ var _styles_scss__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./styles.scss */ \"./src/shared/components/Modal/styles.scss\");\n/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! react/jsx-runtime */ \"./node_modules/react/jsx-runtime.js\");\n/* global document */\n\n\n\n\n\n\n\n\n\nconst validThemeKeys = ['container', 'overlay'];\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 = _ref => {\n let {\n cancelOnScrolling,\n children,\n containerStyle,\n dontDisableScrolling,\n onCancel,\n theme\n } = _ref;\n const containerRef = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(null);\n const overlayRef = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(null);\n const [portal, setPortal] = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)();\n (0,react__WEBPACK_IMPORTED_MODULE_1__.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 // Sets up modal cancellation of scrolling, if opted-in.\n (0,react__WEBPACK_IMPORTED_MODULE_1__.useEffect)(() => {\n if (cancelOnScrolling && onCancel) {\n window.addEventListener('scroll', onCancel);\n window.addEventListener('wheel', onCancel);\n }\n return () => {\n if (cancelOnScrolling && onCancel) {\n window.removeEventListener('scroll', onCancel);\n window.removeEventListener('wheel', onCancel);\n }\n };\n }, [cancelOnScrolling, onCancel]);\n\n // Disables window scrolling, if it is not opted-out.\n (0,react__WEBPACK_IMPORTED_MODULE_1__.useEffect)(() => {\n if (!dontDisableScrolling) {\n document.body.classList.add(_styles_scss__WEBPACK_IMPORTED_MODULE_6__[\"default\"].scrollingDisabledByModal);\n }\n return () => {\n if (!dontDisableScrolling) {\n document.body.classList.remove(_styles_scss__WEBPACK_IMPORTED_MODULE_6__[\"default\"].scrollingDisabledByModal);\n }\n };\n }, [dontDisableScrolling]);\n const focusLast = (0,react__WEBPACK_IMPORTED_MODULE_1__.useMemo)(() => /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(\"div\", {\n onFocus: () => {\n var _containerRef$current, _overlayRef$current;\n const elems = (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.querySelectorAll('*');\n for (let i = elems.length - 1; i >= 0; --i) {\n elems[i].focus();\n if (document.activeElement === elems[i]) return;\n }\n (_overlayRef$current = overlayRef.current) === null || _overlayRef$current === void 0 || _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 return portal ? /*#__PURE__*/react_dom__WEBPACK_IMPORTED_MODULE_2___default().createPortal( /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.Fragment, {\n children: [focusLast, /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(\"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 }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(\"div\", {\n \"aria-modal\": \"true\",\n className: theme.container,\n onWheel: event => event.stopPropagation(),\n ref: containerRef,\n role: \"dialog\",\n style: containerStyle,\n children: children\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(\"div\", {\n onFocus: () => {\n var _overlayRef$current2;\n (_overlayRef$current2 = overlayRef.current) === null || _overlayRef$current2 === void 0 || _overlayRef$current2.focus();\n }\n /* eslint-disable jsx-a11y/no-noninteractive-tabindex */,\n tabIndex: 0\n /* eslint-enable jsx-a11y/no-noninteractive-tabindex */\n }), focusLast]\n }), portal) : null;\n};\nconst ThemedModal = _dr_pogodin_react_themes__WEBPACK_IMPORTED_MODULE_4___default()(BaseModal, 'Modal', validThemeKeys, _base_theme_scss__WEBPACK_IMPORTED_MODULE_5__[\"default\"]);\nBaseModal.propTypes = {\n cancelOnScrolling: (prop_types__WEBPACK_IMPORTED_MODULE_3___default().bool),\n children: (prop_types__WEBPACK_IMPORTED_MODULE_3___default().node),\n containerStyle: prop_types__WEBPACK_IMPORTED_MODULE_3___default().shape({}),\n dontDisableScrolling: (prop_types__WEBPACK_IMPORTED_MODULE_3___default().bool),\n onCancel: (prop_types__WEBPACK_IMPORTED_MODULE_3___default().func),\n theme: ThemedModal.themeType.isRequired\n};\nBaseModal.defaultProps = {\n cancelOnScrolling: false,\n children: null,\n containerStyle: undefined,\n dontDisableScrolling: false,\n onCancel: lodash__WEBPACK_IMPORTED_MODULE_0__.noop\n};\n/* harmony default export */ __webpack_exports__[\"default\"] = (ThemedModal);\n\n/* Non-themed version of the Modal. */\n\n\n//# sourceURL=webpack://@dr.pogodin/react-utils/./src/shared/components/Modal/index.tsx?");
119
+ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ BaseModal: function() { return /* binding */ BaseModal; }\n/* harmony export */ });\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lodash */ \"lodash\");\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react-dom */ \"react-dom\");\n/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react_dom__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! prop-types */ \"prop-types\");\n/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var _dr_pogodin_react_themes__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @dr.pogodin/react-themes */ \"@dr.pogodin/react-themes\");\n/* harmony import */ var _dr_pogodin_react_themes__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_dr_pogodin_react_themes__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var _base_theme_scss__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./base-theme.scss */ \"./src/shared/components/Modal/base-theme.scss\");\n/* harmony import */ var _styles_scss__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./styles.scss */ \"./src/shared/components/Modal/styles.scss\");\n/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! react/jsx-runtime */ \"./node_modules/react/jsx-runtime.js\");\n/* global document */\n\n\n\n\n\n\n\n\n\nconst validThemeKeys = ['container', 'overlay'];\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 = _ref => {\n let {\n cancelOnScrolling,\n children,\n containerStyle,\n dontDisableScrolling,\n onCancel,\n theme\n } = _ref;\n const containerRef = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(null);\n const overlayRef = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(null);\n const [portal, setPortal] = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)();\n (0,react__WEBPACK_IMPORTED_MODULE_1__.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 // Sets up modal cancellation of scrolling, if opted-in.\n (0,react__WEBPACK_IMPORTED_MODULE_1__.useEffect)(() => {\n if (cancelOnScrolling && onCancel) {\n window.addEventListener('scroll', onCancel);\n window.addEventListener('wheel', onCancel);\n }\n return () => {\n if (cancelOnScrolling && onCancel) {\n window.removeEventListener('scroll', onCancel);\n window.removeEventListener('wheel', onCancel);\n }\n };\n }, [cancelOnScrolling, onCancel]);\n\n // Disables window scrolling, if it is not opted-out.\n (0,react__WEBPACK_IMPORTED_MODULE_1__.useEffect)(() => {\n if (!dontDisableScrolling) {\n document.body.classList.add(_styles_scss__WEBPACK_IMPORTED_MODULE_6__[\"default\"].scrollingDisabledByModal);\n }\n return () => {\n if (!dontDisableScrolling) {\n document.body.classList.remove(_styles_scss__WEBPACK_IMPORTED_MODULE_6__[\"default\"].scrollingDisabledByModal);\n }\n };\n }, [dontDisableScrolling]);\n const focusLast = (0,react__WEBPACK_IMPORTED_MODULE_1__.useMemo)(() => /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(\"div\", {\n onFocus: () => {\n var _containerRef$current, _overlayRef$current;\n const elems = (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.querySelectorAll('*');\n for (let i = elems.length - 1; i >= 0; --i) {\n elems[i].focus();\n if (document.activeElement === elems[i]) return;\n }\n (_overlayRef$current = overlayRef.current) === null || _overlayRef$current === void 0 || _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 return portal ? /*#__PURE__*/react_dom__WEBPACK_IMPORTED_MODULE_2___default().createPortal( /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.Fragment, {\n children: [focusLast, /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(\"div\", {\n \"aria-label\": \"Cancel\",\n className: theme.overlay,\n onClick: e => {\n if (onCancel) {\n onCancel();\n e.stopPropagation();\n }\n },\n onKeyDown: e => {\n if (e.key === 'Escape' && onCancel) {\n onCancel();\n e.stopPropagation();\n }\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 }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(\"div\", {\n \"aria-modal\": \"true\",\n className: theme.container,\n onClick: e => e.stopPropagation(),\n onWheel: event => event.stopPropagation(),\n ref: containerRef,\n role: \"dialog\",\n style: containerStyle,\n children: children\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(\"div\", {\n onFocus: () => {\n var _overlayRef$current2;\n (_overlayRef$current2 = overlayRef.current) === null || _overlayRef$current2 === void 0 || _overlayRef$current2.focus();\n }\n /* eslint-disable jsx-a11y/no-noninteractive-tabindex */,\n tabIndex: 0\n /* eslint-enable jsx-a11y/no-noninteractive-tabindex */\n }), focusLast]\n }), portal) : null;\n};\nconst ThemedModal = _dr_pogodin_react_themes__WEBPACK_IMPORTED_MODULE_4___default()(BaseModal, 'Modal', validThemeKeys, _base_theme_scss__WEBPACK_IMPORTED_MODULE_5__[\"default\"]);\nBaseModal.propTypes = {\n cancelOnScrolling: (prop_types__WEBPACK_IMPORTED_MODULE_3___default().bool),\n children: (prop_types__WEBPACK_IMPORTED_MODULE_3___default().node),\n containerStyle: prop_types__WEBPACK_IMPORTED_MODULE_3___default().shape({}),\n dontDisableScrolling: (prop_types__WEBPACK_IMPORTED_MODULE_3___default().bool),\n onCancel: (prop_types__WEBPACK_IMPORTED_MODULE_3___default().func),\n theme: ThemedModal.themeType.isRequired\n};\nBaseModal.defaultProps = {\n cancelOnScrolling: false,\n children: null,\n containerStyle: undefined,\n dontDisableScrolling: false,\n onCancel: lodash__WEBPACK_IMPORTED_MODULE_0__.noop\n};\n/* harmony default export */ __webpack_exports__[\"default\"] = (ThemedModal);\n\n/* Non-themed version of the Modal. */\n\n\n//# sourceURL=webpack://@dr.pogodin/react-utils/./src/shared/components/Modal/index.tsx?");
120
120
 
121
121
  /***/ }),
122
122
 
@@ -226,7 +226,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var prop
226
226
  \******************************************************************/
227
227
  /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
228
228
 
229
- eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! prop-types */ \"prop-types\");\n/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _dr_pogodin_react_themes__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @dr.pogodin/react-themes */ \"@dr.pogodin/react-themes\");\n/* harmony import */ var _dr_pogodin_react_themes__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_dr_pogodin_react_themes__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _theme_scss__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./theme.scss */ \"./src/shared/components/selectors/NativeDropdown/theme.scss\");\n/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../common */ \"./src/shared/components/selectors/common.ts\");\n/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react/jsx-runtime */ \"./node_modules/react/jsx-runtime.js\");\n// Implements dropdown based on the native HTML <select> element.\n\n\n\n\n\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 */\n\nconst Dropdown = _ref => {\n let {\n filter,\n label,\n onChange,\n options,\n theme,\n value\n } = _ref;\n if (!options) throw Error('Internal error');\n let isValidValue = false;\n const optionElements = [];\n for (let i = 0; i < options.length; ++i) {\n const option = options[i];\n if (!filter || filter(option)) {\n const [iValue, iName] = (0,_common__WEBPACK_IMPORTED_MODULE_3__.optionValueName)(option);\n isValidValue || (isValidValue = iValue === value);\n optionElements.push( /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"option\", {\n className: theme.option,\n value: iValue,\n children: iName\n }, iValue));\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 : /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"option\", {\n disabled: true,\n className: theme.hiddenOption,\n value: value,\n children: value\n }, \"__reactUtilsHiddenOption\");\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)(\"div\", {\n className: theme.container,\n children: [label === undefined ? null : /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"div\", {\n className: theme.label,\n children: label\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)(\"div\", {\n className: theme.dropdown,\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)(\"select\", {\n className: theme.select,\n onChange: onChange,\n value: value,\n children: [hiddenOption, optionElements]\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"div\", {\n className: theme.arrow\n })]\n })]\n });\n};\nconst ThemedDropdown = _dr_pogodin_react_themes__WEBPACK_IMPORTED_MODULE_1___default()(Dropdown, 'Dropdown', _common__WEBPACK_IMPORTED_MODULE_3__.validThemeKeys, _theme_scss__WEBPACK_IMPORTED_MODULE_2__[\"default\"]);\nDropdown.propTypes = {\n filter: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().func),\n label: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().node),\n onChange: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().func),\n options: _common__WEBPACK_IMPORTED_MODULE_3__.optionsValidator,\n theme: ThemedDropdown.themeType.isRequired,\n value: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().string)\n};\nDropdown.defaultProps = {\n filter: undefined,\n label: undefined,\n onChange: undefined,\n options: [],\n value: ''\n};\n/* harmony default export */ __webpack_exports__[\"default\"] = (ThemedDropdown);\n\n//# sourceURL=webpack://@dr.pogodin/react-utils/./src/shared/components/selectors/NativeDropdown/index.tsx?");
229
+ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! prop-types */ \"prop-types\");\n/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _dr_pogodin_react_themes__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @dr.pogodin/react-themes */ \"@dr.pogodin/react-themes\");\n/* harmony import */ var _dr_pogodin_react_themes__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_dr_pogodin_react_themes__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _theme_scss__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./theme.scss */ \"./src/shared/components/selectors/NativeDropdown/theme.scss\");\n/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../common */ \"./src/shared/components/selectors/common.ts\");\n/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react/jsx-runtime */ \"./node_modules/react/jsx-runtime.js\");\n// Implements dropdown based on the native HTML <select> element.\n\n\n\n\n\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 */\n\nconst Dropdown = _ref => {\n let {\n filter,\n label,\n onChange,\n options,\n theme,\n value\n } = _ref;\n if (!options) throw Error('Internal error');\n let isValidValue = false;\n const optionElements = [];\n for (let i = 0; i < options.length; ++i) {\n const option = options[i];\n if (!filter || filter(option)) {\n const [iValue, iName] = (0,_common__WEBPACK_IMPORTED_MODULE_3__.optionValueName)(option);\n isValidValue || (isValidValue = iValue === value);\n optionElements.push( /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"option\", {\n className: theme.option,\n value: iValue,\n children: iName\n }, iValue));\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 : /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"option\", {\n disabled: true,\n className: theme.hiddenOption,\n value: value,\n children: value\n }, \"__reactUtilsHiddenOption\");\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)(\"div\", {\n className: theme.container,\n children: [label === undefined ? null : /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"div\", {\n className: theme.label,\n children: label\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)(\"div\", {\n className: theme.dropdown,\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)(\"select\", {\n className: theme.select,\n onChange: onChange,\n value: value,\n children: [hiddenOption, optionElements]\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"div\", {\n className: theme.arrow\n })]\n })]\n });\n};\nconst ThemedDropdown = _dr_pogodin_react_themes__WEBPACK_IMPORTED_MODULE_1___default()(Dropdown, 'Dropdown', _common__WEBPACK_IMPORTED_MODULE_3__.validThemeKeys, _theme_scss__WEBPACK_IMPORTED_MODULE_2__[\"default\"]);\nDropdown.propTypes = {\n filter: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().func),\n label: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().node),\n onChange: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().func),\n options: _common__WEBPACK_IMPORTED_MODULE_3__.stringOptionsValidator,\n theme: ThemedDropdown.themeType.isRequired,\n value: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().string)\n};\nDropdown.defaultProps = {\n filter: undefined,\n label: undefined,\n onChange: undefined,\n options: [],\n value: ''\n};\n/* harmony default export */ __webpack_exports__[\"default\"] = (ThemedDropdown);\n\n//# sourceURL=webpack://@dr.pogodin/react-utils/./src/shared/components/selectors/NativeDropdown/index.tsx?");
230
230
 
231
231
  /***/ }),
232
232
 
@@ -236,7 +236,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var prop
236
236
  \**********************************************************/
237
237
  /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
238
238
 
239
- eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! prop-types */ \"prop-types\");\n/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _dr_pogodin_react_themes__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @dr.pogodin/react-themes */ \"@dr.pogodin/react-themes\");\n/* harmony import */ var _dr_pogodin_react_themes__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_dr_pogodin_react_themes__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common */ \"./src/shared/components/selectors/common.ts\");\n/* harmony import */ var _theme_scss__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./theme.scss */ \"./src/shared/components/selectors/Switch/theme.scss\");\n/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react/jsx-runtime */ \"./node_modules/react/jsx-runtime.js\");\n\n\n\n\n\nconst validThemeKeys = ['container', 'label', 'option', 'selected', 'switch'];\nconst BaseSwitch = _ref => {\n let {\n label,\n onChange,\n options,\n theme,\n value\n } = _ref;\n if (!options || !theme.option) throw Error('Internal error');\n const optionNodes = [];\n for (let i = 0; i < (options === null || options === void 0 ? void 0 : options.length); ++i) {\n const [iValue, iName] = (0,_common__WEBPACK_IMPORTED_MODULE_2__.optionValueName)(options[i]);\n let className = theme.option;\n let onPress;\n if (iValue === value) className += ` ${theme.selected}`;else if (onChange) onPress = () => onChange(iValue);\n optionNodes.push(onPress ? /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"div\", {\n className: className,\n onClick: onPress,\n onKeyDown: e => {\n if (onPress && e.key === 'Enter') onPress();\n },\n role: \"button\",\n tabIndex: 0,\n children: iName\n }, iValue) : /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"div\", {\n className: className,\n children: iName\n }, iValue));\n }\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)(\"div\", {\n className: theme.container,\n children: [label ? /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"div\", {\n className: theme.label,\n children: label\n }) : null, /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"div\", {\n className: theme.switch,\n children: optionNodes\n })]\n });\n};\nconst ThemedSwitch = _dr_pogodin_react_themes__WEBPACK_IMPORTED_MODULE_1___default()(BaseSwitch, 'Switch', validThemeKeys, _theme_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"]);\nBaseSwitch.propTypes = {\n label: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().node),\n onChange: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().func),\n options: _common__WEBPACK_IMPORTED_MODULE_2__.optionsValidator,\n theme: ThemedSwitch.themeType.isRequired,\n value: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().string)\n};\nBaseSwitch.defaultProps = {\n label: undefined,\n onChange: undefined,\n options: [],\n value: undefined\n};\n/* harmony default export */ __webpack_exports__[\"default\"] = (ThemedSwitch);\n\n//# sourceURL=webpack://@dr.pogodin/react-utils/./src/shared/components/selectors/Switch/index.tsx?");
239
+ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! prop-types */ \"prop-types\");\n/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _dr_pogodin_react_themes__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @dr.pogodin/react-themes */ \"@dr.pogodin/react-themes\");\n/* harmony import */ var _dr_pogodin_react_themes__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_dr_pogodin_react_themes__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common */ \"./src/shared/components/selectors/common.ts\");\n/* harmony import */ var _theme_scss__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./theme.scss */ \"./src/shared/components/selectors/Switch/theme.scss\");\n/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react/jsx-runtime */ \"./node_modules/react/jsx-runtime.js\");\n\n\n\n\n\nconst validThemeKeys = ['container', 'label', 'option', 'options', 'selected'];\nconst BaseSwitch = _ref => {\n let {\n label,\n onChange,\n options,\n theme,\n value\n } = _ref;\n if (!options || !theme.option) throw Error('Internal error');\n const optionNodes = [];\n for (let i = 0; i < (options === null || options === void 0 ? void 0 : options.length); ++i) {\n const [iValue, iName] = (0,_common__WEBPACK_IMPORTED_MODULE_2__.optionValueName)(options[i]);\n let className = theme.option;\n let onPress;\n if (iValue === value) className += ` ${theme.selected}`;else if (onChange) onPress = () => onChange(iValue);\n optionNodes.push(onPress ? /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"div\", {\n className: className,\n onClick: onPress,\n onKeyDown: e => {\n if (onPress && e.key === 'Enter') onPress();\n },\n role: \"button\",\n tabIndex: 0,\n children: iName\n }, iValue) : /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"div\", {\n className: className,\n children: iName\n }, iValue));\n }\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)(\"div\", {\n className: theme.container,\n children: [label ? /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"div\", {\n className: theme.label,\n children: label\n }) : null, /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"div\", {\n className: theme.options,\n children: optionNodes\n })]\n });\n};\nconst ThemedSwitch = _dr_pogodin_react_themes__WEBPACK_IMPORTED_MODULE_1___default()(BaseSwitch, 'Switch', validThemeKeys, _theme_scss__WEBPACK_IMPORTED_MODULE_3__[\"default\"]);\nBaseSwitch.propTypes = {\n label: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().node),\n onChange: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().func),\n options: _common__WEBPACK_IMPORTED_MODULE_2__.optionsValidator,\n theme: ThemedSwitch.themeType.isRequired,\n value: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().string)\n};\nBaseSwitch.defaultProps = {\n label: undefined,\n onChange: undefined,\n options: [],\n value: undefined\n};\n/* harmony default export */ __webpack_exports__[\"default\"] = (ThemedSwitch);\n\n//# sourceURL=webpack://@dr.pogodin/react-utils/./src/shared/components/selectors/Switch/index.tsx?");
240
240
 
241
241
  /***/ }),
242
242
 
@@ -246,7 +246,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var prop
246
246
  \***************************************************/
247
247
  /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
248
248
 
249
- eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ optionValidator: function() { return /* binding */ optionValidator; },\n/* harmony export */ optionValueName: function() { return /* binding */ optionValueName; },\n/* harmony export */ optionsValidator: function() { return /* binding */ optionsValidator; },\n/* harmony export */ validThemeKeys: function() { return /* binding */ validThemeKeys; }\n/* harmony export */ });\n/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! prop-types */ \"prop-types\");\n/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_0__);\n// The stuff common between different dropdown implementations.\n\n\nconst validThemeKeys = ['active', 'arrow', 'container', 'dropdown', 'hiddenOption', 'label', 'option', 'select',\n// TODO: This is only valid for <CustomDropdown>, thus we need to re-factor it\n// into a separate theme spec for that component.\n'upward'];\nconst optionValidator = prop_types__WEBPACK_IMPORTED_MODULE_0___default().oneOfType([prop_types__WEBPACK_IMPORTED_MODULE_0___default().shape({\n name: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().string),\n value: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().string).isRequired\n}).isRequired, (prop_types__WEBPACK_IMPORTED_MODULE_0___default().string).isRequired]);\nconst optionsValidator = prop_types__WEBPACK_IMPORTED_MODULE_0___default().arrayOf(optionValidator.isRequired);\n\n/** Returns option value and name as a tuple. */\nfunction optionValueName(option) {\n var _option$name;\n return typeof option === 'string' ? [option, option] : [option.value, (_option$name = option.name) !== null && _option$name !== void 0 ? _option$name : option.value];\n}\n\n//# sourceURL=webpack://@dr.pogodin/react-utils/./src/shared/components/selectors/common.ts?");
249
+ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ optionValidator: function() { return /* binding */ optionValidator; },\n/* harmony export */ optionValueName: function() { return /* binding */ optionValueName; },\n/* harmony export */ optionsValidator: function() { return /* binding */ optionsValidator; },\n/* harmony export */ stringOptionValidator: function() { return /* binding */ stringOptionValidator; },\n/* harmony export */ stringOptionsValidator: function() { return /* binding */ stringOptionsValidator; },\n/* harmony export */ validThemeKeys: function() { return /* binding */ validThemeKeys; }\n/* harmony export */ });\n/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! prop-types */ \"prop-types\");\n/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_0__);\n// The stuff common between different dropdown implementations.\n\n\nconst validThemeKeys = ['active', 'arrow', 'container', 'dropdown', 'hiddenOption', 'label', 'option', 'select',\n// TODO: This is only valid for <CustomDropdown>, thus we need to re-factor it\n// into a separate theme spec for that component.\n'upward'];\nconst optionValidator = prop_types__WEBPACK_IMPORTED_MODULE_0___default().oneOfType([prop_types__WEBPACK_IMPORTED_MODULE_0___default().shape({\n name: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().node),\n value: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().string).isRequired\n}).isRequired, (prop_types__WEBPACK_IMPORTED_MODULE_0___default().string).isRequired]);\nconst optionsValidator = prop_types__WEBPACK_IMPORTED_MODULE_0___default().arrayOf(optionValidator.isRequired);\nconst stringOptionValidator = prop_types__WEBPACK_IMPORTED_MODULE_0___default().oneOfType([prop_types__WEBPACK_IMPORTED_MODULE_0___default().shape({\n name: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().string),\n value: (prop_types__WEBPACK_IMPORTED_MODULE_0___default().string).isRequired\n}).isRequired, (prop_types__WEBPACK_IMPORTED_MODULE_0___default().string).isRequired]);\nconst stringOptionsValidator = prop_types__WEBPACK_IMPORTED_MODULE_0___default().arrayOf(stringOptionValidator.isRequired);\n\n/** Returns option value and name as a tuple. */\nfunction optionValueName(option) {\n var _option$name;\n return typeof option === 'string' ? [option, option] : [option.value, (_option$name = option.name) !== null && _option$name !== void 0 ? _option$name : option.value];\n}\n\n//# sourceURL=webpack://@dr.pogodin/react-utils/./src/shared/components/selectors/common.ts?");
250
250
 
251
251
  /***/ }),
252
252
 
@@ -516,7 +516,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n// extracted by mini-css-extr
516
516
  \***********************************************************/
517
517
  /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
518
518
 
519
- eval("__webpack_require__.r(__webpack_exports__);\n// extracted by mini-css-extract-plugin\n/* harmony default export */ __webpack_exports__[\"default\"] = ({\"container\":\"-dr-pogodin-react-utils___src-shared-components-selectors-Switch-theme___container___AWNvRj\",\"context\":\"-dr-pogodin-react-utils___src-shared-components-selectors-Switch-theme___context___VMHfnP\",\"ad\":\"-dr-pogodin-react-utils___src-shared-components-selectors-Switch-theme___ad___HNliRC\",\"hoc\":\"-dr-pogodin-react-utils___src-shared-components-selectors-Switch-theme___hoc___2Ue-db\",\"option\":\"-dr-pogodin-react-utils___src-shared-components-selectors-Switch-theme___option___fUfIAd\",\"selected\":\"-dr-pogodin-react-utils___src-shared-components-selectors-Switch-theme___selected___Wco-qk\",\"switch\":\"-dr-pogodin-react-utils___src-shared-components-selectors-Switch-theme___switch___HR5LN5\"});\n\n//# sourceURL=webpack://@dr.pogodin/react-utils/./src/shared/components/selectors/Switch/theme.scss?");
519
+ eval("__webpack_require__.r(__webpack_exports__);\n// extracted by mini-css-extract-plugin\n/* harmony default export */ __webpack_exports__[\"default\"] = ({\"container\":\"-dr-pogodin-react-utils___src-shared-components-selectors-Switch-theme___container___AWNvRj\",\"context\":\"-dr-pogodin-react-utils___src-shared-components-selectors-Switch-theme___context___VMHfnP\",\"ad\":\"-dr-pogodin-react-utils___src-shared-components-selectors-Switch-theme___ad___HNliRC\",\"hoc\":\"-dr-pogodin-react-utils___src-shared-components-selectors-Switch-theme___hoc___2Ue-db\",\"option\":\"-dr-pogodin-react-utils___src-shared-components-selectors-Switch-theme___option___fUfIAd\",\"selected\":\"-dr-pogodin-react-utils___src-shared-components-selectors-Switch-theme___selected___Wco-qk\",\"options\":\"-dr-pogodin-react-utils___src-shared-components-selectors-Switch-theme___options___CZYtcC\"});\n\n//# sourceURL=webpack://@dr.pogodin/react-utils/./src/shared/components/selectors/Switch/theme.scss?");
520
520
 
521
521
  /***/ }),
522
522
 
@@ -1,4 +1,4 @@
1
- "use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _propTypes=_interopRequireDefault(require("prop-types"));var _reactThemes=_interopRequireDefault(require("@dr.pogodin/react-themes"));var _jsxRuntime=require("react/jsx-runtime");const defaultTheme={"context":"dNQcC6","ad":"earXxa","hoc":"qAPfQ6","checkbox":"A-f8qJ","container":"Kr0g3M","label":"_3dML-O"};const validThemeKeys=["checkbox","container","label"];const Checkbox=({checked,label,onChange,theme})=>/*#__PURE__*/(0,_jsxRuntime.jsxs)("div",{className:theme.container,children:[label===undefined?null:/*#__PURE__*/(0,_jsxRuntime.jsx)("div",{className:theme.label,children:label}),/*#__PURE__*/(0,_jsxRuntime.jsx)("input",{checked:checked,className:theme.checkbox,onChange:onChange,type:"checkbox"})]});/**
1
+ "use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _propTypes=_interopRequireDefault(require("prop-types"));var _reactThemes=_interopRequireDefault(require("@dr.pogodin/react-themes"));var _jsxRuntime=require("react/jsx-runtime");const defaultTheme={"context":"dNQcC6","ad":"earXxa","hoc":"qAPfQ6","checkbox":"A-f8qJ","container":"Kr0g3M","label":"_3dML-O"};const validThemeKeys=["checkbox","container","label"];const Checkbox=({checked,label,onChange,theme})=>/*#__PURE__*/(0,_jsxRuntime.jsxs)("div",{className:theme.container,children:[label===undefined?null:/*#__PURE__*/(0,_jsxRuntime.jsx)("div",{className:theme.label,children:label}),/*#__PURE__*/(0,_jsxRuntime.jsx)("input",{checked:checked,className:theme.checkbox,onChange:onChange,onClick:e=>e.stopPropagation(),type:"checkbox"})]});/**
2
2
  * Checkbox component theme: a map of
3
3
  * CSS classes to append to its elements:
4
4
  * @prop [checkbox] to the underlying checkbox `<input>` element.
@@ -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","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":"gLAAA,IAAAA,UAAA,CAAAC,sBAAA,CAAAC,OAAA,gBAEA,IAAAC,YAAA,CAAAF,sBAAA,CAAAC,OAAA,8BAA8D,IAAAE,WAAA,CAAAF,OAAA,4BAAAG,YAAA,8GAI9D,KAAM,CAAAC,cAAc,CAAG,CAAC,UAAU,CAAE,WAAW,CAAE,OAAO,CAAU,CASlE,KAAM,CAAAC,QAAwC,CAAGA,CAAC,CAChDC,OAAO,CACPC,KAAK,CACLC,QAAQ,CACRC,KACF,CAAC,gBACC,GAAAP,WAAA,CAAAQ,IAAA,SAAKC,SAAS,CAAEF,KAAK,CAACG,SAAU,CAAAC,QAAA,EAC5BN,KAAK,GAAKO,SAAS,CAAG,IAAI,cAAG,GAAAZ,WAAA,CAAAa,GAAA,SAAKJ,SAAS,CAAEF,KAAK,CAACF,KAAM,CAAAM,QAAA,CAAEN,KAAK,CAAM,CAAC,cACzE,GAAAL,WAAA,CAAAa,GAAA,WACET,OAAO,CAAEA,OAAQ,CACjBK,SAAS,CAAEF,KAAK,CAACO,QAAS,CAC1BR,QAAQ,CAAEA,QAAS,CACnBS,IAAI,CAAC,UAAU,CAChB,CAAC,EACC,CACN,CAED;AACA;AACA;AACA;AACA;AACA;AACA,GACA,KAAM,CAAAC,cAAc,CAAG,GAAAC,oBAAM,EAC3Bd,QAAQ,CACR,UAAU,CACVD,cAAc,CACdD,YACF,CAAC,CAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACAE,QAAQ,CAACe,SAAS,CAAG,CACnBd,OAAO,CAAEe,kBAAE,CAACC,IAAI,CAChBf,KAAK,CAAEc,kBAAE,CAACE,IAAI,CACdf,QAAQ,CAAEa,kBAAE,CAACG,IAAI,CACjBf,KAAK,CAAES,cAAc,CAACO,SAAS,CAACC,UAClC,CAAC,CAEDrB,QAAQ,CAACsB,YAAY,CAAG,CACtBrB,OAAO,CAAEQ,SAAS,CAClBP,KAAK,CAAEO,SAAS,CAChBN,QAAQ,CAAEM,SACZ,CAAC,CAAC,IAAAc,QAAA,CAAAC,OAAA,CAAAC,OAAA,CAEaZ,cAAc","ignoreList":[]}
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","onClick","e","stopPropagation","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 onClick={(e) => e.stopPropagation()}\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":"gLAAA,IAAAA,UAAA,CAAAC,sBAAA,CAAAC,OAAA,gBAEA,IAAAC,YAAA,CAAAF,sBAAA,CAAAC,OAAA,8BAA8D,IAAAE,WAAA,CAAAF,OAAA,4BAAAG,YAAA,8GAI9D,KAAM,CAAAC,cAAc,CAAG,CAAC,UAAU,CAAE,WAAW,CAAE,OAAO,CAAU,CASlE,KAAM,CAAAC,QAAwC,CAAGA,CAAC,CAChDC,OAAO,CACPC,KAAK,CACLC,QAAQ,CACRC,KACF,CAAC,gBACC,GAAAP,WAAA,CAAAQ,IAAA,SAAKC,SAAS,CAAEF,KAAK,CAACG,SAAU,CAAAC,QAAA,EAC5BN,KAAK,GAAKO,SAAS,CAAG,IAAI,cAAG,GAAAZ,WAAA,CAAAa,GAAA,SAAKJ,SAAS,CAAEF,KAAK,CAACF,KAAM,CAAAM,QAAA,CAAEN,KAAK,CAAM,CAAC,cACzE,GAAAL,WAAA,CAAAa,GAAA,WACET,OAAO,CAAEA,OAAQ,CACjBK,SAAS,CAAEF,KAAK,CAACO,QAAS,CAC1BR,QAAQ,CAAEA,QAAS,CACnBS,OAAO,CAAGC,CAAC,EAAKA,CAAC,CAACC,eAAe,CAAC,CAAE,CACpCC,IAAI,CAAC,UAAU,CAChB,CAAC,EACC,CACN,CAED;AACA;AACA;AACA;AACA;AACA;AACA,GACA,KAAM,CAAAC,cAAc,CAAG,GAAAC,oBAAM,EAC3BjB,QAAQ,CACR,UAAU,CACVD,cAAc,CACdD,YACF,CAAC,CAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACAE,QAAQ,CAACkB,SAAS,CAAG,CACnBjB,OAAO,CAAEkB,kBAAE,CAACC,IAAI,CAChBlB,KAAK,CAAEiB,kBAAE,CAACE,IAAI,CACdlB,QAAQ,CAAEgB,kBAAE,CAACG,IAAI,CACjBlB,KAAK,CAAEY,cAAc,CAACO,SAAS,CAACC,UAClC,CAAC,CAEDxB,QAAQ,CAACyB,YAAY,CAAG,CACtBxB,OAAO,CAAEQ,SAAS,CAClBP,KAAK,CAAEO,SAAS,CAChBN,QAAQ,CAAEM,SACZ,CAAC,CAAC,IAAAiB,QAAA,CAAAC,OAAA,CAAAC,OAAA,CAEaZ,cAAc","ignoreList":[]}
@@ -10,5 +10,5 @@
10
10
  * @param {ModalTheme} [props.theme] _Ad hoc_ theme.
11
11
  */const BaseModal=({cancelOnScrolling,children,containerStyle,dontDisableScrolling,onCancel,theme})=>{const containerRef=(0,_react.useRef)(null);const overlayRef=(0,_react.useRef)(null);const[portal,setPortal]=(0,_react.useState)();(0,_react.useEffect)(()=>{const p=document.createElement("div");document.body.appendChild(p);setPortal(p);return()=>{document.body.removeChild(p)}},[]);// Sets up modal cancellation of scrolling, if opted-in.
12
12
  (0,_react.useEffect)(()=>{if(cancelOnScrolling&&onCancel){window.addEventListener("scroll",onCancel);window.addEventListener("wheel",onCancel)}return()=>{if(cancelOnScrolling&&onCancel){window.removeEventListener("scroll",onCancel);window.removeEventListener("wheel",onCancel)}}},[cancelOnScrolling,onCancel]);// Disables window scrolling, if it is not opted-out.
13
- (0,_react.useEffect)(()=>{if(!dontDisableScrolling){document.body.classList.add(S.scrollingDisabledByModal)}return()=>{if(!dontDisableScrolling){document.body.classList.remove(S.scrollingDisabledByModal)}}},[dontDisableScrolling]);const focusLast=(0,_react.useMemo)(()=>/*#__PURE__*/(0,_jsxRuntime.jsx)("div",{onFocus:()=>{const elems=containerRef.current?.querySelectorAll("*");for(let i=elems.length-1;i>=0;--i){elems[i].focus();if(document.activeElement===elems[i])return}overlayRef.current?.focus()}/* eslint-disable jsx-a11y/no-noninteractive-tabindex */,tabIndex:0/* eslint-enable jsx-a11y/no-noninteractive-tabindex */}),[]);return portal?/*#__PURE__*/_reactDom.default.createPortal(/*#__PURE__*/(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[focusLast,/*#__PURE__*/(0,_jsxRuntime.jsx)("div",{"aria-label":"Cancel",className:theme.overlay,onClick:()=>onCancel&&onCancel(),onKeyDown:e=>{if(e.key==="Escape"&&onCancel)onCancel()},ref:node=>{if(node&&node!==overlayRef.current){overlayRef.current=node;node.focus()}},role:"button",tabIndex:0}),/*#__PURE__*/(0,_jsxRuntime.jsx)("div",{"aria-modal":"true",className:theme.container,onWheel:event=>event.stopPropagation(),ref:containerRef,role:"dialog",style:containerStyle,children:children}),/*#__PURE__*/(0,_jsxRuntime.jsx)("div",{onFocus:()=>{overlayRef.current?.focus()}/* eslint-disable jsx-a11y/no-noninteractive-tabindex */,tabIndex:0/* eslint-enable jsx-a11y/no-noninteractive-tabindex */}),focusLast]}),portal):null};exports.BaseModal=BaseModal;const ThemedModal=(0,_reactThemes.default)(BaseModal,"Modal",validThemeKeys,baseTheme);BaseModal.propTypes={cancelOnScrolling:_propTypes.default.bool,children:_propTypes.default.node,containerStyle:_propTypes.default.shape({}),dontDisableScrolling:_propTypes.default.bool,onCancel:_propTypes.default.func,theme:ThemedModal.themeType.isRequired};BaseModal.defaultProps={cancelOnScrolling:false,children:null,containerStyle:undefined,dontDisableScrolling:false,onCancel:_lodash.noop};var _default=exports.default=ThemedModal;/* Non-themed version of the Modal. */
13
+ (0,_react.useEffect)(()=>{if(!dontDisableScrolling){document.body.classList.add(S.scrollingDisabledByModal)}return()=>{if(!dontDisableScrolling){document.body.classList.remove(S.scrollingDisabledByModal)}}},[dontDisableScrolling]);const focusLast=(0,_react.useMemo)(()=>/*#__PURE__*/(0,_jsxRuntime.jsx)("div",{onFocus:()=>{const elems=containerRef.current?.querySelectorAll("*");for(let i=elems.length-1;i>=0;--i){elems[i].focus();if(document.activeElement===elems[i])return}overlayRef.current?.focus()}/* eslint-disable jsx-a11y/no-noninteractive-tabindex */,tabIndex:0/* eslint-enable jsx-a11y/no-noninteractive-tabindex */}),[]);return portal?/*#__PURE__*/_reactDom.default.createPortal(/*#__PURE__*/(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[focusLast,/*#__PURE__*/(0,_jsxRuntime.jsx)("div",{"aria-label":"Cancel",className:theme.overlay,onClick:e=>{if(onCancel){onCancel();e.stopPropagation()}},onKeyDown:e=>{if(e.key==="Escape"&&onCancel){onCancel();e.stopPropagation()}},ref:node=>{if(node&&node!==overlayRef.current){overlayRef.current=node;node.focus()}},role:"button",tabIndex:0}),/*#__PURE__*/(0,_jsxRuntime.jsx)("div",{"aria-modal":"true",className:theme.container,onClick:e=>e.stopPropagation(),onWheel:event=>event.stopPropagation(),ref:containerRef,role:"dialog",style:containerStyle,children:children}),/*#__PURE__*/(0,_jsxRuntime.jsx)("div",{onFocus:()=>{overlayRef.current?.focus()}/* eslint-disable jsx-a11y/no-noninteractive-tabindex */,tabIndex:0/* eslint-enable jsx-a11y/no-noninteractive-tabindex */}),focusLast]}),portal):null};exports.BaseModal=BaseModal;const ThemedModal=(0,_reactThemes.default)(BaseModal,"Modal",validThemeKeys,baseTheme);BaseModal.propTypes={cancelOnScrolling:_propTypes.default.bool,children:_propTypes.default.node,containerStyle:_propTypes.default.shape({}),dontDisableScrolling:_propTypes.default.bool,onCancel:_propTypes.default.func,theme:ThemedModal.themeType.isRequired};BaseModal.defaultProps={cancelOnScrolling:false,children:null,containerStyle:undefined,dontDisableScrolling:false,onCancel:_lodash.noop};var _default=exports.default=ThemedModal;/* Non-themed version of the Modal. */
14
14
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_lodash","require","_react","_reactDom","_interopRequireDefault","_propTypes","_reactThemes","_jsxRuntime","baseTheme","S","validThemeKeys","BaseModal","cancelOnScrolling","children","containerStyle","dontDisableScrolling","onCancel","theme","containerRef","useRef","overlayRef","portal","setPortal","useState","useEffect","p","document","createElement","body","appendChild","removeChild","window","addEventListener","removeEventListener","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","bool","shape","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 cancelOnScrolling?: boolean;\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 cancelOnScrolling,\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 // Sets up modal cancellation of scrolling, if opted-in.\n useEffect(() => {\n if (cancelOnScrolling && onCancel) {\n window.addEventListener('scroll', onCancel);\n window.addEventListener('wheel', onCancel);\n }\n return () => {\n if (cancelOnScrolling && onCancel) {\n window.removeEventListener('scroll', onCancel);\n window.removeEventListener('wheel', onCancel);\n }\n };\n }, [cancelOnScrolling, onCancel]);\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 cancelOnScrolling: PT.bool,\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 cancelOnScrolling: false,\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":"kMAEA,IAAAA,OAAA,CAAAC,OAAA,WAEA,IAAAC,MAAA,CAAAD,OAAA,UAQA,IAAAE,SAAA,CAAAC,sBAAA,CAAAH,OAAA,eACA,IAAAI,UAAA,CAAAD,sBAAA,CAAAH,OAAA,gBACA,IAAAK,YAAA,CAAAF,sBAAA,CAAAH,OAAA,8BAA8D,IAAAM,WAAA,CAAAN,OAAA,sBAd9D,2BAAAO,SAAA,iGAAAC,CAAA,wCAmBA,KAAM,CAAAC,cAAc,CAAG,CAAC,WAAW,CAAE,SAAS,CAAU,CAWxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACA,K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ACvBlE,iBAAiB,CAAE,KAAK,CACxBC,QAAQ,CAAE,IAAI,CACdC,cAAc,CAAEiE,SAAS,CACzBhE,oBAAoB,CAAE,KAAK,CAC3BC,QAAQ,CAAEgE,YACZ,CAAC,CAAC,IAAAC,QAAA,CAAAb,OAAA,CAAAc,OAAA,CAEab,WAAW,CAE1B","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["_lodash","require","_react","_reactDom","_interopRequireDefault","_propTypes","_reactThemes","_jsxRuntime","baseTheme","S","validThemeKeys","BaseModal","cancelOnScrolling","children","containerStyle","dontDisableScrolling","onCancel","theme","containerRef","useRef","overlayRef","portal","setPortal","useState","useEffect","p","document","createElement","body","appendChild","removeChild","window","addEventListener","removeEventListener","classList","add","scrollingDisabledByModal","remove","focusLast","useMemo","jsx","onFocus","elems","current","querySelectorAll","i","length","focus","activeElement","tabIndex","ReactDom","createPortal","jsxs","Fragment","className","overlay","onClick","e","stopPropagation","onKeyDown","key","ref","node","role","container","onWheel","event","style","exports","ThemedModal","themed","propTypes","PT","bool","shape","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 cancelOnScrolling?: boolean;\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 cancelOnScrolling,\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 // Sets up modal cancellation of scrolling, if opted-in.\n useEffect(() => {\n if (cancelOnScrolling && onCancel) {\n window.addEventListener('scroll', onCancel);\n window.addEventListener('wheel', onCancel);\n }\n return () => {\n if (cancelOnScrolling && onCancel) {\n window.removeEventListener('scroll', onCancel);\n window.removeEventListener('wheel', onCancel);\n }\n };\n }, [cancelOnScrolling, onCancel]);\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={(e) => {\n if (onCancel) {\n onCancel();\n e.stopPropagation();\n }\n }}\n onKeyDown={(e) => {\n if (e.key === 'Escape' && onCancel) {\n onCancel();\n e.stopPropagation();\n }\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 {\n // NOTE: These rules are disabled because our intention is to keep\n // the element non-interactive (thus not on the keyboard focus chain),\n // and it has `onClick` handler merely to stop propagation of click\n // events to its parent container. This is needed because, for example\n // when the modal is wrapped into an interactive element we don't want\n // any clicks inside the modal to bubble-up to that parent element\n // (because visually and logically the modal dialog does not belong\n // to its parent container, where it technically belongs from\n // the HTML mark-up perpective).\n /* eslint-disable jsx-a11y/click-events-have-key-events,\n jsx-a11y/no-noninteractive-element-interactions */\n }\n <div\n aria-modal=\"true\"\n className={theme.container}\n onClick={(e) => e.stopPropagation()}\n onWheel={(event) => event.stopPropagation()}\n ref={containerRef}\n role=\"dialog\"\n style={containerStyle}\n >\n {children}\n </div>\n {/* eslint-enable jsx-a11y/click-events-have-key-events,\n jsx-a11y/no-noninteractive-element-interactions */}\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 cancelOnScrolling: PT.bool,\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 cancelOnScrolling: false,\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":"kMAEA,IAAAA,OAA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,CAAC,CAELjB,MACF,CAAC,CAAG,IACN,CAAC,CAAC+C,OAAA,CAAAzD,SAAA,CAAAA,SAAA,CAEF,KAAM,CAAA0D,WAAW,CAAG,GAAAC,oBAAM,EACxB3D,SAAS,CACT,OAAO,CACPD,cAAc,CACdF,SACF,CAAC,CAEDG,SAAS,CAAC4D,SAAS,CAAG,CACpB3D,iBAAiB,CAAE4D,kBAAE,CAACC,IAAI,CAC1B5D,QAAQ,CAAE2D,kBAAE,CAACV,IAAI,CACjBhD,cAAc,CAAE0D,kBAAE,CAACE,KAAK,CAAC,CAAC,CAAC,CAAC,CAC5B3D,oBAAoB,CAAEyD,kBAAE,CAACC,IAAI,CAC7BzD,QAAQ,CAAEwD,kBAAE,CAACG,IAAI,CACjB1D,KAAK,CAAEoD,WAAW,CAACO,SAAS,CAACC,UAC/B,CAAC,CAEDlE,SAAS,CAACmE,YAAY,CAAG,CACvBlE,iBAAiB,CAAE,KAAK,CACxBC,QAAQ,CAAE,IAAI,CACdC,cAAc,CAAEiE,SAAS,CACzBhE,oBAAoB,CAAE,KAAK,CAC3BC,QAAQ,CAAEgE,YACZ,CAAC,CAAC,IAAAC,QAAA,CAAAb,OAAA,CAAAc,OAAA,CAEab,WAAW,CAE1B","ignoreList":[]}
@@ -21,5 +21,5 @@ const defaultTheme={"context":"xHyZo4","ad":"ADu59e","hoc":"FTP2bb","dropdown":"
21
21
  // any valid option. In Chrome, and some other browsers, we are able to hide
22
22
  // it from the opened dropdown; in others, e.g. Safari, the best we can do is
23
23
  // to show it as disabled.
24
- const hiddenOption=isValidValue?null:/*#__PURE__*/(0,_jsxRuntime.jsx)("option",{disabled:true,className:theme.hiddenOption,value:value,children:value},"__reactUtilsHiddenOption");return/*#__PURE__*/(0,_jsxRuntime.jsxs)("div",{className:theme.container,children:[label===undefined?null:/*#__PURE__*/(0,_jsxRuntime.jsx)("div",{className:theme.label,children:label}),/*#__PURE__*/(0,_jsxRuntime.jsxs)("div",{className:theme.dropdown,children:[/*#__PURE__*/(0,_jsxRuntime.jsxs)("select",{className:theme.select,onChange:onChange,value:value,children:[hiddenOption,optionElements]}),/*#__PURE__*/(0,_jsxRuntime.jsx)("div",{className:theme.arrow})]})]})};const ThemedDropdown=(0,_reactThemes.default)(Dropdown,"Dropdown",_common.validThemeKeys,defaultTheme);Dropdown.propTypes={filter:_propTypes.default.func,label:_propTypes.default.node,onChange:_propTypes.default.func,options:_common.optionsValidator,theme:ThemedDropdown.themeType.isRequired,value:_propTypes.default.string};Dropdown.defaultProps={filter:undefined,label:undefined,onChange:undefined,options:[],value:""};var _default=exports.default=ThemedDropdown;
24
+ const hiddenOption=isValidValue?null:/*#__PURE__*/(0,_jsxRuntime.jsx)("option",{disabled:true,className:theme.hiddenOption,value:value,children:value},"__reactUtilsHiddenOption");return/*#__PURE__*/(0,_jsxRuntime.jsxs)("div",{className:theme.container,children:[label===undefined?null:/*#__PURE__*/(0,_jsxRuntime.jsx)("div",{className:theme.label,children:label}),/*#__PURE__*/(0,_jsxRuntime.jsxs)("div",{className:theme.dropdown,children:[/*#__PURE__*/(0,_jsxRuntime.jsxs)("select",{className:theme.select,onChange:onChange,value:value,children:[hiddenOption,optionElements]}),/*#__PURE__*/(0,_jsxRuntime.jsx)("div",{className:theme.arrow})]})]})};const ThemedDropdown=(0,_reactThemes.default)(Dropdown,"Dropdown",_common.validThemeKeys,defaultTheme);Dropdown.propTypes={filter:_propTypes.default.func,label:_propTypes.default.node,onChange:_propTypes.default.func,options:_common.stringOptionsValidator,theme:ThemedDropdown.themeType.isRequired,value:_propTypes.default.string};Dropdown.defaultProps={filter:undefined,label:undefined,onChange:undefined,options:[],value:""};var _default=exports.default=ThemedDropdown;
25
25
  //# sourceMappingURL=index.js.map