@dr.pogodin/react-utils 1.25.6 → 1.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/babel.config.js +3 -1
- package/bin/build.js +18 -4
- package/build/development/client/getInj.js +9 -8
- package/build/development/client/getInj.js.map +1 -1
- package/build/development/client/index.js +6 -3
- package/build/development/client/index.js.map +1 -1
- package/build/development/client/init.js +4 -0
- package/build/development/client/init.js.map +1 -1
- package/build/development/index.js +166 -38
- package/build/development/index.js.map +1 -1
- package/build/development/server/Cache.js +13 -13
- package/build/development/server/Cache.js.map +1 -1
- package/build/development/server/index.js +16 -23
- package/build/development/server/index.js.map +1 -1
- package/build/development/server/renderer.js +56 -43
- package/build/development/server/renderer.js.map +1 -1
- package/build/development/server/server.js +9 -5
- package/build/development/server/server.js.map +1 -1
- package/build/development/server/utils/errors.js +12 -9
- package/build/development/server/utils/errors.js.map +1 -1
- package/build/development/server/utils/index.js +2 -2
- package/build/development/server/utils/index.js.map +1 -1
- package/build/development/shared/components/Button/index.js +7 -5
- package/build/development/shared/components/Button/index.js.map +1 -1
- package/build/development/shared/components/Checkbox/index.js +24 -26
- package/build/development/shared/components/Checkbox/index.js.map +1 -1
- package/build/development/shared/components/Dropdown/index.js +24 -17
- package/build/development/shared/components/Dropdown/index.js.map +1 -1
- package/build/development/shared/components/GenericLink/index.js +44 -37
- package/build/development/shared/components/GenericLink/index.js.map +1 -1
- package/build/development/shared/components/Input/index.js +7 -7
- package/build/development/shared/components/Input/index.js.map +1 -1
- package/build/development/shared/components/Link.js +10 -9
- package/build/development/shared/components/Link.js.map +1 -1
- package/build/development/shared/components/MetaTags.js +22 -18
- package/build/development/shared/components/MetaTags.js.map +1 -1
- package/build/development/shared/components/Modal/index.js +16 -16
- package/build/development/shared/components/Modal/index.js.map +1 -1
- package/build/development/shared/components/NavLink.js +10 -9
- package/build/development/shared/components/NavLink.js.map +1 -1
- package/build/development/shared/components/PageLayout/index.js +16 -18
- package/build/development/shared/components/PageLayout/index.js.map +1 -1
- package/build/development/shared/components/ScalableRect/index.js +27 -7
- package/build/development/shared/components/ScalableRect/index.js.map +1 -1
- package/build/development/shared/components/Throbber/index.js +14 -22
- package/build/development/shared/components/Throbber/index.js.map +1 -1
- package/build/development/shared/components/WithTooltip/Tooltip.js +19 -21
- package/build/development/shared/components/WithTooltip/Tooltip.js.map +1 -1
- package/build/development/shared/components/WithTooltip/index.js +11 -10
- package/build/development/shared/components/WithTooltip/index.js.map +1 -1
- package/build/development/shared/components/YouTubeVideo/index.js +15 -13
- package/build/development/shared/components/YouTubeVideo/index.js.map +1 -1
- package/build/development/shared/components/index.js +2 -2
- package/build/development/shared/components/index.js.map +1 -1
- package/build/development/shared/utils/config.js.map +1 -1
- package/build/development/shared/utils/globalState.js +15 -0
- package/build/development/shared/utils/globalState.js.map +1 -0
- package/build/development/shared/utils/index.js +13 -10
- package/build/development/shared/utils/index.js.map +1 -1
- package/build/development/shared/utils/isomorphy/buildInfo.js +7 -3
- package/build/development/shared/utils/isomorphy/buildInfo.js.map +1 -1
- package/build/development/shared/utils/isomorphy/environment-check.js.map +1 -1
- package/build/development/shared/utils/isomorphy/index.js.map +1 -1
- package/build/development/shared/utils/jest/E2eSsrEnv.js +35 -28
- package/build/development/shared/utils/jest/E2eSsrEnv.js.map +1 -1
- package/build/development/shared/utils/jest/global.js +17 -0
- package/build/development/shared/utils/jest/global.js.map +1 -0
- package/build/development/shared/utils/jest/index.js +17 -9
- package/build/development/shared/utils/jest/index.js.map +1 -1
- package/build/development/shared/utils/splitComponent.js +25 -34
- package/build/development/shared/utils/splitComponent.js.map +1 -1
- package/build/development/shared/utils/time.js +16 -12
- package/build/development/shared/utils/time.js.map +1 -1
- package/build/development/shared/utils/webpack.js +3 -3
- package/build/development/shared/utils/webpack.js.map +1 -1
- package/build/development/web.bundle.js +92 -82
- package/build/production/client/getInj.js +1 -1
- package/build/production/client/getInj.js.map +1 -1
- package/build/production/client/index.js +4 -4
- package/build/production/client/index.js.map +1 -1
- package/build/production/client/init.js +3 -1
- package/build/production/client/init.js.map +1 -1
- package/build/production/index.js +1 -1
- package/build/production/index.js.map +1 -1
- package/build/production/server/Cache.js +7 -8
- package/build/production/server/Cache.js.map +1 -1
- package/build/production/server/index.js +5 -4
- package/build/production/server/index.js.map +1 -1
- package/build/production/server/renderer.js +32 -30
- package/build/production/server/renderer.js.map +1 -1
- package/build/production/server/server.js +7 -5
- package/build/production/server/server.js.map +1 -1
- package/build/production/server/utils/errors.js +9 -10
- package/build/production/server/utils/errors.js.map +1 -1
- package/build/production/server/utils/index.js +1 -1
- package/build/production/server/utils/index.js.map +1 -1
- package/build/production/shared/components/Button/index.js +3 -3
- package/build/production/shared/components/Button/index.js.map +1 -1
- package/build/production/shared/components/Checkbox/index.js +11 -11
- package/build/production/shared/components/Checkbox/index.js.map +1 -1
- package/build/production/shared/components/Dropdown/index.js +11 -11
- package/build/production/shared/components/Dropdown/index.js.map +1 -1
- package/build/production/shared/components/GenericLink/index.js +25 -20
- package/build/production/shared/components/GenericLink/index.js.map +1 -1
- package/build/production/shared/components/Input/index.js +7 -7
- package/build/production/shared/components/Input/index.js.map +1 -1
- package/build/production/shared/components/Link.js +2 -2
- package/build/production/shared/components/Link.js.map +1 -1
- package/build/production/shared/components/MetaTags.js +10 -10
- package/build/production/shared/components/MetaTags.js.map +1 -1
- package/build/production/shared/components/Modal/index.js +2 -2
- package/build/production/shared/components/Modal/index.js.map +1 -1
- package/build/production/shared/components/NavLink.js +1 -1
- package/build/production/shared/components/NavLink.js.map +1 -1
- package/build/production/shared/components/PageLayout/index.js +2 -2
- package/build/production/shared/components/PageLayout/index.js.map +1 -1
- package/build/production/shared/components/ScalableRect/index.js +7 -3
- package/build/production/shared/components/ScalableRect/index.js.map +1 -1
- package/build/production/shared/components/Throbber/index.js +2 -2
- package/build/production/shared/components/Throbber/index.js.map +1 -1
- package/build/production/shared/components/WithTooltip/Tooltip.js +13 -13
- package/build/production/shared/components/WithTooltip/Tooltip.js.map +1 -1
- package/build/production/shared/components/WithTooltip/index.js +3 -3
- package/build/production/shared/components/WithTooltip/index.js.map +1 -1
- package/build/production/shared/components/YouTubeVideo/index.js +7 -7
- package/build/production/shared/components/YouTubeVideo/index.js.map +1 -1
- package/build/production/shared/components/index.js +1 -1
- package/build/production/shared/components/index.js.map +1 -1
- package/build/production/shared/utils/config.js.map +1 -1
- package/build/production/shared/utils/globalState.js +3 -0
- package/build/production/shared/utils/globalState.js.map +1 -0
- package/build/production/shared/utils/index.js +2 -2
- package/build/production/shared/utils/index.js.map +1 -1
- package/build/production/shared/utils/isomorphy/buildInfo.js +7 -4
- package/build/production/shared/utils/isomorphy/buildInfo.js.map +1 -1
- package/build/production/shared/utils/isomorphy/environment-check.js.map +1 -1
- package/build/production/shared/utils/isomorphy/index.js.map +1 -1
- package/build/production/shared/utils/jest/E2eSsrEnv.js +9 -9
- package/build/production/shared/utils/jest/E2eSsrEnv.js.map +1 -1
- package/build/production/shared/utils/jest/global.js +2 -0
- package/build/production/shared/utils/jest/global.js.map +1 -0
- package/build/production/shared/utils/jest/index.js +5 -5
- package/build/production/shared/utils/jest/index.js.map +1 -1
- package/build/production/shared/utils/splitComponent.js +16 -16
- package/build/production/shared/utils/splitComponent.js.map +1 -1
- package/build/production/shared/utils/time.js +12 -8
- package/build/production/shared/utils/time.js.map +1 -1
- package/build/production/shared/utils/webpack.js +3 -3
- package/build/production/shared/utils/webpack.js.map +1 -1
- package/build/production/web.bundle.js +1 -1
- package/build/production/web.bundle.js.map +1 -1
- package/build/types-code/client/getInj.d.ts +3 -0
- package/build/types-code/client/index.d.ts +11 -0
- package/build/types-code/client/init.d.ts +9 -0
- package/build/types-code/index.d.ts +10 -0
- package/build/types-code/server/Cache.d.ts +37 -0
- package/build/types-code/server/index.d.ts +145 -0
- package/build/types-code/server/renderer.d.ts +106 -0
- package/build/types-code/server/server.d.ts +41 -0
- package/build/types-code/server/utils/errors.d.ts +104 -0
- package/build/types-code/server/utils/index.d.ts +1 -0
- package/build/types-code/shared/components/Button/index.d.ts +27 -0
- package/build/types-code/shared/components/Checkbox/index.d.ts +21 -0
- package/build/types-code/shared/components/Dropdown/index.d.ts +23 -0
- package/build/types-code/shared/components/GenericLink/index.d.ts +61 -0
- package/build/types-code/shared/components/Input/index.d.ts +11 -0
- package/build/types-code/shared/components/Link.d.ts +12 -0
- package/build/types-code/shared/components/MetaTags.d.ts +68 -0
- package/build/types-code/shared/components/Modal/index.d.ts +26 -0
- package/build/types-code/shared/components/NavLink.d.ts +5 -0
- package/build/types-code/shared/components/PageLayout/index.d.ts +16 -0
- package/build/types-code/shared/components/ScalableRect/index.d.ts +19 -0
- package/build/types-code/shared/components/Throbber/index.d.ts +9 -0
- package/build/types-code/shared/components/WithTooltip/Tooltip.d.ts +23 -0
- package/build/types-code/shared/components/WithTooltip/index.d.ts +17 -0
- package/build/types-code/shared/components/YouTubeVideo/index.d.ts +13 -0
- package/build/types-code/shared/components/index.d.ts +16 -0
- package/build/types-code/shared/utils/config.d.ts +2 -0
- package/build/types-code/shared/utils/globalState.d.ts +20 -0
- package/build/types-code/shared/utils/index.d.ts +52 -0
- package/build/types-code/shared/utils/isomorphy/buildInfo.d.ts +23 -0
- package/build/types-code/shared/utils/isomorphy/environment-check.d.ts +11 -0
- package/build/types-code/shared/utils/isomorphy/index.d.ts +20 -0
- package/build/types-code/shared/utils/jest/E2eSsrEnv.d.ts +31 -0
- package/build/types-code/shared/utils/jest/global.d.ts +12 -0
- package/build/types-code/shared/utils/jest/index.d.ts +85 -0
- package/build/types-code/shared/utils/splitComponent.d.ts +41 -0
- package/build/types-code/shared/utils/time.d.ts +62 -0
- package/build/types-code/shared/utils/webpack.d.ts +18 -0
- package/build/types-scss/__tests__/js/config/publicPath support/__assets__/style.scss.d.ts +1 -0
- package/build/types-scss/__tests__/js/config/stylename-generation/__assets__/MockPackageA/TestComponent/style.scss.d.ts +1 -0
- package/build/types-scss/__tests__/js/config/stylename-generation/__assets__/MockPackageB/TestComponent/style.scss.d.ts +1 -0
- package/build/types-scss/__tests__/js/config/stylename-generation/__assets__/style.scss.d.ts +1 -0
- package/build/types-scss/__tests__/js/shared/components/NavLink/styles.scss.d.ts +1 -0
- package/build/types-scss/__tests__/js/shared/utils/splitComponent/__assets__/SampleScene/ComponentA/style.scss.d.ts +1 -0
- package/build/types-scss/__tests__/js/shared/utils/splitComponent/__assets__/SampleScene/ComponentB/style.scss.d.ts +1 -0
- package/build/types-scss/__tests__/js/shared/utils/splitComponent/__assets__/SampleScene/ComponentC/style.scss.d.ts +1 -0
- package/build/types-scss/__tests__/js/shared/utils/splitComponent/__assets__/SampleScene/style.scss.d.ts +1 -0
- package/build/types-scss/__tests__/ts/config/publicPath support/__assets__/style.scss.d.ts +1 -0
- package/build/types-scss/__tests__/ts/config/stylename-generation/__assets__/MockPackageA/TestComponent/style.scss.d.ts +1 -0
- package/build/types-scss/__tests__/ts/config/stylename-generation/__assets__/MockPackageB/TestComponent/style.scss.d.ts +1 -0
- package/build/types-scss/__tests__/ts/config/stylename-generation/__assets__/style.scss.d.ts +1 -0
- package/build/types-scss/__tests__/ts/shared/components/NavLink/styles.scss.d.ts +1 -0
- package/build/types-scss/__tests__/ts/shared/utils/splitComponent/__assets__/SampleScene/ComponentA/style.scss.d.ts +1 -0
- package/build/types-scss/__tests__/ts/shared/utils/splitComponent/__assets__/SampleScene/ComponentB/style.scss.d.ts +1 -0
- package/build/types-scss/__tests__/ts/shared/utils/splitComponent/__assets__/SampleScene/ComponentC/style.scss.d.ts +1 -0
- package/build/types-scss/__tests__/ts/shared/utils/splitComponent/__assets__/SampleScene/style.scss.d.ts +1 -0
- package/build/types-scss/src/shared/components/Button/style.scss.d.ts +6 -0
- package/build/types-scss/src/shared/components/Checkbox/theme.scss.d.ts +6 -0
- package/build/types-scss/src/shared/components/Dropdown/theme.scss.d.ts +9 -0
- package/build/types-scss/src/shared/components/GenericLink/style.scss.d.ts +1 -0
- package/build/types-scss/src/shared/components/Input/theme.scss.d.ts +6 -0
- package/build/types-scss/src/shared/components/Modal/base-theme.scss.d.ts +5 -0
- package/build/types-scss/src/shared/components/PageLayout/base-theme.scss.d.ts +6 -0
- package/build/types-scss/src/shared/components/ScalableRect/style.scss.d.ts +2 -0
- package/build/types-scss/src/shared/components/Throbber/theme.scss.d.ts +6 -0
- package/build/types-scss/src/shared/components/WithTooltip/default-theme.scss.d.ts +7 -0
- package/build/types-scss/src/shared/components/YouTubeVideo/base.scss.d.ts +5 -0
- package/build/types-scss/src/shared/components/YouTubeVideo/throbber.scss.d.ts +4 -0
- package/config/eslint/jest.json +3 -2
- package/config/eslint/typescript.js +34 -0
- package/config/jest/default.js +3 -3
- package/package.json +74 -32
- package/src/client/getInj.ts +43 -0
- package/src/client/index.tsx +40 -0
- package/src/client/init.ts +47 -0
- package/src/index.ts +58 -0
- package/src/server/Cache.ts +68 -0
- package/src/server/index.ts +230 -0
- package/src/server/renderer.tsx +604 -0
- package/src/server/server.ts +309 -0
- package/src/server/utils/errors.ts +135 -0
- package/src/server/utils/index.ts +3 -0
- package/src/shared/components/Button/index.tsx +146 -0
- package/src/shared/components/Button/style.scss +53 -0
- package/src/shared/components/Checkbox/index.tsx +71 -0
- package/src/shared/components/Checkbox/theme.scss +43 -0
- package/src/shared/components/Dropdown/index.tsx +144 -0
- package/src/shared/components/Dropdown/theme.scss +63 -0
- package/src/shared/components/GenericLink/index.tsx +157 -0
- package/src/shared/components/GenericLink/style.scss +3 -0
- package/src/shared/components/Input/index.tsx +59 -0
- package/src/shared/components/Input/theme.scss +27 -0
- package/src/shared/components/Link.tsx +21 -0
- package/src/shared/components/MetaTags.tsx +170 -0
- package/src/shared/components/Modal/base-theme.scss +38 -0
- package/src/shared/components/Modal/index.tsx +144 -0
- package/src/shared/components/Modal/styles.scss +5 -0
- package/src/shared/components/NavLink.tsx +13 -0
- package/src/shared/components/PageLayout/base-theme.scss +30 -0
- package/src/shared/components/PageLayout/index.tsx +76 -0
- package/src/shared/components/ScalableRect/index.tsx +84 -0
- package/src/shared/components/ScalableRect/style.scss +10 -0
- package/src/shared/components/Throbber/index.tsx +43 -0
- package/src/shared/components/Throbber/theme.scss +26 -0
- package/src/shared/components/WithTooltip/Tooltip.tsx +353 -0
- package/src/shared/components/WithTooltip/default-theme.scss +36 -0
- package/src/shared/components/WithTooltip/index.tsx +204 -0
- package/src/shared/components/YouTubeVideo/base.scss +13 -0
- package/src/shared/components/YouTubeVideo/index.tsx +96 -0
- package/src/shared/components/YouTubeVideo/throbber.scss +11 -0
- package/src/shared/components/index.ts +17 -0
- package/src/shared/utils/config.ts +21 -0
- package/src/shared/utils/globalState.ts +29 -0
- package/src/shared/utils/index.ts +105 -0
- package/src/shared/utils/isomorphy/buildInfo.ts +54 -0
- package/src/shared/utils/isomorphy/environment-check.ts +18 -0
- package/src/shared/utils/isomorphy/index.ts +38 -0
- package/src/shared/utils/jest/E2eSsrEnv.ts +250 -0
- package/src/shared/utils/jest/global.ts +19 -0
- package/src/shared/utils/jest/index.tsx +157 -0
- package/src/shared/utils/splitComponent.tsx +255 -0
- package/src/shared/utils/time.ts +118 -0
- package/src/shared/utils/webpack.ts +45 -0
- package/src/styles/_global/reset.css +52 -0
- package/src/styles/global.scss +11 -0
- package/tsconfig.configs.json +18 -0
- package/tsconfig.json +27 -0
- package/tsconfig.types.json +53 -0
- package/typed-scss-modules.config.ts +9 -0
- package/types.d.ts +37 -0
- package/{webpack.config.js → webpack.config.ts} +7 -3
- package/config/babel/node-ssr.js +0 -85
- package/config/babel/webpack.js +0 -123
- package/config/webpack/app-base.js +0 -330
- package/config/webpack/app-development.js +0 -80
- package/config/webpack/app-production.js +0 -60
- package/config/webpack/lib-base.js +0 -155
- package/config/webpack/lib-development.js +0 -45
- package/config/webpack/lib-production.js +0 -44
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_propTypes","_interopRequireDefault","require","
|
|
1
|
+
{"version":3,"file":"index.js","names":["_propTypes","_interopRequireDefault","require","_reactThemes","_jsxRuntime","defaultTheme","Dropdown","filter","label","onChange","options","theme","value","isValidValue","optionElements","i","length","option","optionValue","optionName","name","push","jsx","className","children","hiddenOption","disabled","jsxs","container","undefined","select","arrow","ThemedDropdown","themed","propTypes","PT","func","string","arrayOf","oneOfType","shape","isRequired","themeType","defaultProps","_default","exports","default"],"sources":["../../../../../src/shared/components/Dropdown/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\ntype DropdownOptionT = {\n name?: string | null;\n value: string;\n};\n\ntype PropsT = {\n filter?: (item: DropdownOptionT | string) => boolean;\n label?: string;\n onChange?: React.ChangeEventHandler<HTMLSelectElement>;\n options?: Array<DropdownOptionT | string>;\n theme: Theme & {\n arrow?: string;\n container?: string;\n hiddenOption?: string;\n label?: string;\n option?: string;\n select?: string;\n };\n value?: string;\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 */\nconst Dropdown: React.FunctionComponent<PropsT> = ({\n filter,\n label,\n onChange,\n options = [],\n theme,\n value,\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 let optionValue: string;\n let optionName: string;\n if (typeof option === 'string') {\n optionName = option;\n optionValue = option;\n } else {\n optionName = option.name || option.value;\n optionValue = option.value;\n }\n isValidValue ||= optionValue === value;\n optionElements.push(\n <option className={theme.option} key={optionValue} value={optionValue}>\n {optionName}\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 : <p className={theme.label}>{label}</p> }\n <select\n className={theme.select}\n onChange={onChange}\n value={value}\n >\n {hiddenOption}\n {optionElements}\n </select>\n <div className={theme.arrow}>▼</div>\n </div>\n );\n};\n\nconst ThemedDropdown = themed(Dropdown, 'Dropdown', [\n 'arrow',\n 'container',\n 'hiddenOption',\n 'label',\n 'option',\n 'select',\n], defaultTheme);\n\nDropdown.propTypes = {\n filter: PT.func,\n label: PT.string,\n onChange: PT.func,\n options: PT.arrayOf(\n PT.oneOfType([\n PT.shape({\n name: PT.string,\n value: PT.string.isRequired,\n }),\n PT.string,\n ]).isRequired,\n ),\n theme: ThemedDropdown.themeType.isRequired,\n value: PT.string,\n};\n\nDropdown.defaultProps = {\n filter: undefined,\n label: undefined,\n onChange: undefined,\n options: [],\n value: '',\n};\n\nexport default ThemedDropdown;\n"],"mappings":"gLAAA,IAAAA,UAAA,CAAAC,sBAAA,CAAAC,OAAA,gBAEA,IAAAC,YAAA,CAAAF,sBAAA,CAAAC,OAAA,8BAA8D,IAAAE,WAAA,CAAAF,OAAA,4BAAAG,YAAA,uKAyB9D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACA,KAAM,CAAAC,QAAyC,CAAGA,CAAC,CACjDC,MAAM,CACNC,KAAK,CACLC,QAAQ,CACRC,OAAO,CAAG,EAAE,CACZC,KAAK,CACLC,KACF,CAAC,GA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CAAC,IAAAgC,QAAA,CAAAC,OAAA,CAAAC,OAAA,CAEad,cAAc"}
|
|
@@ -1,47 +1,52 @@
|
|
|
1
|
-
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=
|
|
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"));require("react");require("react-router-dom");var _jsxRuntime=require("react/jsx-runtime");/* global window */ /**
|
|
2
2
|
* The `<Link>` component, and almost identical `<NavLink>` component, are
|
|
3
3
|
* auxiliary wrappers around
|
|
4
4
|
* [React Router](https://github.com/ReactTraining/react-router)'s
|
|
5
5
|
* `<Link>` and `<NavLink>` components; they help to handle external and
|
|
6
6
|
* internal links in uniform manner.
|
|
7
7
|
*
|
|
8
|
-
* @param
|
|
9
|
-
* @param
|
|
10
|
-
* @param
|
|
11
|
-
* @param
|
|
8
|
+
* @param [props] Component properties.
|
|
9
|
+
* @param [props.className] CSS classes to apply to the link.
|
|
10
|
+
* @param [props.disabled] Disables the link.
|
|
11
|
+
* @param [props.enforceA] `true` enforces rendering of the link as
|
|
12
12
|
* a simple `<a>` element.
|
|
13
|
-
* @param
|
|
13
|
+
* @param [props.keepScrollPosition] If `true`, and the link is
|
|
14
14
|
* rendered as a React Router's component, it won't reset the viewport scrolling
|
|
15
15
|
* position to the origin when clicked.
|
|
16
|
-
* @param
|
|
17
|
-
* @param
|
|
16
|
+
* @param [props.onClick] Event handler to trigger upon click.
|
|
17
|
+
* @param [props.onMouseDown] Event handler to trigger on MouseDown
|
|
18
18
|
* event.
|
|
19
|
-
* @param
|
|
20
|
-
* @param
|
|
19
|
+
* @param [props.openNewTab] If `true` the link opens in a new tab.
|
|
20
|
+
* @param [props.replace] When `true`, the link will replace current
|
|
21
21
|
* entry in the history stack instead of adding a new one.
|
|
22
|
-
* @param
|
|
23
|
-
* @param
|
|
22
|
+
* @param [props.to] Link URL.
|
|
23
|
+
* @param [props.activeClassName] **`<NavLink>`** only: CSS class(es)
|
|
24
24
|
* to apply to rendered link when it is active.
|
|
25
|
-
* @param
|
|
25
|
+
* @param [props.activeStyle] **`<NavLink>`** only: CSS styles
|
|
26
26
|
* to apply to the rendered link when it is active.
|
|
27
|
-
* @param
|
|
27
|
+
* @param [props.exact] **`<NavLink>`** only: if `true`, the active
|
|
28
28
|
* class/style will only be applied if the location is matched exactly.
|
|
29
|
-
* @param
|
|
29
|
+
* @param [props.isActive] **`<NavLink>`** only: Add extra
|
|
30
30
|
* logic for determining whether the link is active. This should be used if you
|
|
31
31
|
* want to do more than verify that the link’s pathname matches the current URL
|
|
32
32
|
* pathname.
|
|
33
|
-
* @param
|
|
33
|
+
* @param [props.location] **`<NavLink>`** only: `isActive` compares
|
|
34
34
|
* current history location (usually the current browser URL). To compare to
|
|
35
35
|
* a different location, a custom `location` can be passed.
|
|
36
|
-
* @param
|
|
36
|
+
* @param [props.strict] **`<NavLink>`** only: . When `true`, trailing
|
|
37
37
|
* slash on a location’s pathname will be taken into consideration when
|
|
38
38
|
* determining if the location matches the current URL. See the `<Route strict>`
|
|
39
39
|
* documentation for more information.
|
|
40
|
-
*/
|
|
40
|
+
*/const GenericLink=({children,className,disabled,enforceA,keepScrollPosition,onClick,onMouseDown,openNewTab,replace,routerLinkType,to,...rest})=>{/* Renders Link as <a> element if:
|
|
41
41
|
* - It is opted explicitely by `enforceA` prop;
|
|
42
42
|
* - It should be opened in a new tab;
|
|
43
43
|
* - It is an absolte URL (starts with http:// or https://);
|
|
44
|
-
* - It is anchor link (starts with #). */if(disabled||enforceA||openNewTab||to
|
|
44
|
+
* - It is anchor link (starts with #). */if(disabled||enforceA||openNewTab||to?.match(/^(#|(https?|mailto):)/)){return/*#__PURE__*/(0,_jsxRuntime.jsx)("a",{className:(className?className+" ":"")+"zH52sA"// TODO: This requires a fix: disabled is not really an attribute of <a>
|
|
45
|
+
// tag, thus for disabled option we rather should render a plain text
|
|
46
|
+
// styled as a link.
|
|
47
|
+
// disabled={disabled}
|
|
48
|
+
,href:to,onClick:disabled?e=>e.preventDefault():onClick,onMouseDown:disabled?e=>e.preventDefault():onMouseDown,rel:"noopener noreferrer",target:openNewTab?"_blank":"",children:children})}const L=routerLinkType;return/*#__PURE__*/(0,_jsxRuntime.jsx)(L,{className:className// disabled
|
|
49
|
+
,onMouseDown:onMouseDown,replace:replace,to:to,onClick:e=>{// Executes the user-provided event handler, if any.
|
|
45
50
|
if(onClick)onClick(e);// By default, clicking the link scrolls the page to beginning.
|
|
46
|
-
if(!keepScrollPosition)window.scroll(0,0)},...rest
|
|
51
|
+
if(!keepScrollPosition)window.scroll(0,0)},...rest,children:children})};GenericLink.defaultProps={children:null,className:"",disabled:false,enforceA:false,keepScrollPosition:false,onClick:undefined,onMouseDown:undefined,openNewTab:false,replace:false,to:""};GenericLink.propTypes={children:_propTypes.default.node,className:_propTypes.default.string,disabled:_propTypes.default.bool,enforceA:_propTypes.default.bool,keepScrollPosition:_propTypes.default.bool,onClick:_propTypes.default.func,onMouseDown:_propTypes.default.func,openNewTab:_propTypes.default.bool,replace:_propTypes.default.bool,routerLinkType:_propTypes.default.elementType.isRequired,to:_propTypes.default.oneOfType([_propTypes.default.object,_propTypes.default.string])};var _default=exports.default=GenericLink;
|
|
47
52
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_propTypes","_interopRequireDefault","require","
|
|
1
|
+
{"version":3,"file":"index.js","names":["_propTypes","_interopRequireDefault","require","_jsxRuntime","GenericLink","children","className","disabled","enforceA","keepScrollPosition","onClick","onMouseDown","openNewTab","replace","routerLinkType","to","rest","match","jsx","href","e","preventDefault","rel","target","L","window","scroll","defaultProps","undefined","propTypes","PT","node","string","bool","func","elementType","isRequired","oneOfType","object","_default","exports","default"],"sources":["../../../../../src/shared/components/GenericLink/index.tsx"],"sourcesContent":["/* global window */\n\nimport PT from 'prop-types';\nimport { type ReactNode } from 'react';\n\nimport { type Link, type NavLink } from 'react-router-dom';\n\nimport './style.scss';\n\ntype ToT = Parameters<typeof Link>[0]['to'];\n\ninterface LinkI {}\n\nexport type PropsT = {\n children?: ReactNode;\n className?: string;\n disabled?: boolean;\n enforceA?: boolean;\n keepScrollPosition?: boolean;\n onClick?: React.MouseEventHandler<HTMLAnchorElement>;\n onMouseDown?: React.MouseEventHandler<HTMLAnchorElement>;\n openNewTab?: boolean;\n replace?: boolean;\n routerLinkType: LinkI;\n to?: ToT;\n};\n\n/**\n * The `<Link>` component, and almost identical `<NavLink>` component, are\n * auxiliary wrappers around\n * [React Router](https://github.com/ReactTraining/react-router)'s\n * `<Link>` and `<NavLink>` components; they help to handle external and\n * internal links in uniform manner.\n *\n * @param [props] Component properties.\n * @param [props.className] CSS classes to apply to the link.\n * @param [props.disabled] Disables the link.\n * @param [props.enforceA] `true` enforces rendering of the link as\n * a simple `<a>` element.\n * @param [props.keepScrollPosition] If `true`, and the link is\n * rendered as a React Router's component, it won't reset the viewport scrolling\n * position to the origin when clicked.\n * @param [props.onClick] Event handler to trigger upon click.\n * @param [props.onMouseDown] Event handler to trigger on MouseDown\n * event.\n * @param [props.openNewTab] If `true` the link opens in a new tab.\n * @param [props.replace] When `true`, the link will replace current\n * entry in the history stack instead of adding a new one.\n * @param [props.to] Link URL.\n * @param [props.activeClassName] **`<NavLink>`** only: CSS class(es)\n * to apply to rendered link when it is active.\n * @param [props.activeStyle] **`<NavLink>`** only: CSS styles\n * to apply to the rendered link when it is active.\n * @param [props.exact] **`<NavLink>`** only: if `true`, the active\n * class/style will only be applied if the location is matched exactly.\n * @param [props.isActive] **`<NavLink>`** only: Add extra\n * logic for determining whether the link is active. This should be used if you\n * want to do more than verify that the link’s pathname matches the current URL\n * pathname.\n * @param [props.location] **`<NavLink>`** only: `isActive` compares\n * current history location (usually the current browser URL). To compare to\n * a different location, a custom `location` can be passed.\n * @param [props.strict] **`<NavLink>`** only: . When `true`, trailing\n * slash on a location’s pathname will be taken into consideration when\n * determining if the location matches the current URL. See the `<Route strict>`\n * documentation for more information.\n */\nconst GenericLink: React.FunctionComponent<PropsT> = ({\n children,\n className,\n disabled,\n enforceA,\n keepScrollPosition,\n onClick,\n onMouseDown,\n openNewTab,\n replace,\n routerLinkType,\n to,\n ...rest\n}) => {\n /* Renders Link as <a> element if:\n * - It is opted explicitely by `enforceA` prop;\n * - It should be opened in a new tab;\n * - It is an absolte URL (starts with http:// or https://);\n * - It is anchor link (starts with #). */\n if (disabled || enforceA || openNewTab || (to as string)?.match(/^(#|(https?|mailto):)/)) {\n return (\n <a\n className={className}\n // TODO: This requires a fix: disabled is not really an attribute of <a>\n // tag, thus for disabled option we rather should render a plain text\n // styled as a link.\n // disabled={disabled}\n href={to as string}\n onClick={disabled ? (e) => e.preventDefault() : onClick}\n onMouseDown={disabled ? (e) => e.preventDefault() : onMouseDown}\n rel=\"noopener noreferrer\"\n styleName=\"link\"\n target={openNewTab ? '_blank' : ''}\n >\n {children}\n </a>\n );\n }\n\n const L = routerLinkType as typeof NavLink;\n\n return (\n <L\n className={className}\n // disabled\n onMouseDown={onMouseDown}\n replace={replace}\n to={to!}\n onClick={(e: React.MouseEvent<HTMLAnchorElement>) => {\n // Executes the user-provided event handler, if any.\n if (onClick) onClick(e);\n\n // By default, clicking the link scrolls the page to beginning.\n if (!keepScrollPosition) window.scroll(0, 0);\n }}\n {...rest} // eslint-disable-line react/jsx-props-no-spreading\n >\n {children}\n </L>\n );\n};\n\nGenericLink.defaultProps = {\n children: null,\n className: '',\n disabled: false,\n enforceA: false,\n keepScrollPosition: false,\n onClick: undefined,\n onMouseDown: undefined,\n openNewTab: false,\n replace: false,\n to: '',\n};\n\nGenericLink.propTypes = {\n children: PT.node,\n className: PT.string,\n disabled: PT.bool,\n enforceA: PT.bool,\n keepScrollPosition: PT.bool,\n onClick: PT.func,\n onMouseDown: PT.func,\n openNewTab: PT.bool,\n replace: PT.bool,\n routerLinkType: PT.elementType.isRequired,\n to: PT.oneOfType([PT.object, PT.string]),\n};\n\nexport default GenericLink;\n"],"mappings":"gLAEA,IAAAA,UAAA,CAAAC,sBAAA,CAAAC,OAAA,gBACAA,OAAA,UAEAA,OAAA,qBAA2D,IAAAC,WAAA,CAAAD,OAAA,sBAL3D,oBA2BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACA,KAAM,CAAAE,WAA4C,CAAGA,CAAC,CACpDC,QAAQ,CACRC,SAAS,CACTC,QAAQ,CACRC,QAAQ,CACRC,kBAAkB,CAClBC,OAAO,CACPC,WAAW,CACXC,UAAU,CACVC,OAAO,CACPC,cAAc,CACdC,EAAE,CACF,GAAGC,IACL,CAAC,GAAK,CACJ;AACF;AACA;AACA;AACA,4CACE,GAAIT,QAAQ,EAAIC,QAAQ,EAAII,UAAU,EAAKG,EAAE,EAAaE,KAAK,CAAC,uBAAuB,CAAC,CAAE,CACxF,mBACE,GAAAd,WAAA,CAAAe,GAAA,OACEZ,SAAS,EAAEA,SAAS,CAATA,SAAS,iBACpB;AACA;AACA;AACA;AAAA,CACAa,IAAI,CAAEJ,EAAa,CACnBL,OAAO,CAAEH,QAAQ,CAAIa,CAAC,EAAKA,CAAC,CAACC,cAAc,CAAC,CAAC,CAAGX,OAAQ,CACxDC,WAAW,CAAEJ,QAAQ,CAAIa,CAAC,EAAKA,CAAC,CAACC,cAAc,CAAC,CAAC,CAAGV,WAAY,CAChEW,GAAG,CAAC,qBAAqB,CAEzBC,MAAM,CAAEX,UAAU,CAAG,QAAQ,CAAG,EAAG,CAAAP,QAAA,CAElCA,QAAQ,CACR,CAEP,CAEA,KAAM,CAAAmB,CAAC,CAAGV,cAAgC,CAE1C,mBACE,GAAAX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ER,kBAAE,CAACE,MAAM,CAAC,CACzC,CAAC,CAAC,IAAAO,QAAA,CAAAC,OAAA,CAAAC,OAAA,CAEarC,WAAW"}
|
|
@@ -1,10 +1,10 @@
|
|
|
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 _react=require("react");var
|
|
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 _react=require("react");var _reactThemes=_interopRequireDefault(require("@dr.pogodin/react-themes"));var _jsxRuntime=require("react/jsx-runtime");const defaultTheme={"context":"X5WszA","ad":"_8s7GCr","hoc":"TVlBYc","container":"Cxx397","input":"M07d4s","label":"gfbdq-"};/**
|
|
2
2
|
* Themeable input field, based on the standard HTML `<input>` element.
|
|
3
|
-
* @param
|
|
4
|
-
* @param
|
|
5
|
-
* @param
|
|
6
|
-
* @param
|
|
7
|
-
* @param
|
|
3
|
+
* @param [props]
|
|
4
|
+
* @param [props.label] Input label.
|
|
5
|
+
* @param [props.theme] _Ad hoc_ theme.
|
|
6
|
+
* @param [props...] [Other theming properties](https://www.npmjs.com/package/@dr.pogodin/react-themes#themed-component-properties)
|
|
7
|
+
* @param [props...] Any other properties are passed to the underlying
|
|
8
8
|
* `<input>` element.
|
|
9
|
-
*/const Input=/*#__PURE__*/(0,_react.forwardRef)(({label,theme,...rest},ref)=>/*#__PURE__*/(0,_jsxRuntime.jsxs)("span",{className:theme.container,children:[label===undefined?null:/*#__PURE__*/(0,_jsxRuntime.jsx)("p",{className:theme.label,children:label}),/*#__PURE__*/(0,_jsxRuntime.jsx)("input",{className:theme.input,ref:ref,...rest})]}));const ThemedInput=(0,
|
|
9
|
+
*/const Input=/*#__PURE__*/(0,_react.forwardRef)(({label,theme,...rest},ref)=>/*#__PURE__*/(0,_jsxRuntime.jsxs)("span",{className:theme.container,children:[label===undefined?null:/*#__PURE__*/(0,_jsxRuntime.jsx)("p",{className:theme.label,children:label}),/*#__PURE__*/(0,_jsxRuntime.jsx)("input",{className:theme.input,ref:ref,...rest})]}));const ThemedInput=(0,_reactThemes.default)(Input,"Input",["container","input","label"],defaultTheme);Input.propTypes={label:_propTypes.default.string,theme:ThemedInput.themeType.isRequired};Input.defaultProps={label:undefined};var _default=exports.default=ThemedInput;
|
|
10
10
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_propTypes","_interopRequireDefault","require","_react","
|
|
1
|
+
{"version":3,"file":"index.js","names":["_propTypes","_interopRequireDefault","require","_react","_reactThemes","_jsxRuntime","defaultTheme","Input","forwardRef","label","theme","rest","ref","jsxs","className","container","children","undefined","jsx","input","ThemedInput","themed","propTypes","PT","string","themeType","isRequired","defaultProps","_default","exports","default"],"sources":["../../../../../src/shared/components/Input/index.tsx"],"sourcesContent":["import PT from 'prop-types';\nimport { forwardRef } from 'react';\n\nimport themed, { type Theme } from '@dr.pogodin/react-themes';\n\nimport defaultTheme from './theme.scss';\n\ntype PropsT = React.InputHTMLAttributes<HTMLInputElement> & {\n label?: string;\n theme: Theme & {\n container?: string;\n input?: string;\n label?: string;\n };\n};\n\n/**\n * Themeable input field, based on the standard HTML `<input>` element.\n * @param [props]\n * @param [props.label] Input label.\n * @param [props.theme] _Ad hoc_ theme.\n * @param [props...] [Other theming properties](https://www.npmjs.com/package/@dr.pogodin/react-themes#themed-component-properties)\n * @param [props...] Any other properties are passed to the underlying\n * `<input>` element.\n */\nconst Input = forwardRef<HTMLInputElement, PropsT>((\n {\n label,\n theme,\n ...rest\n }: PropsT,\n ref,\n) => (\n <span className={theme.container}>\n { label === undefined ? null : <p className={theme.label}>{label}</p> }\n <input\n className={theme.input}\n ref={ref}\n {...rest} // eslint-disable-line react/jsx-props-no-spreading\n />\n </span>\n));\n\nconst ThemedInput = themed(Input, 'Input', [\n 'container',\n 'input',\n 'label',\n], defaultTheme);\n\nInput.propTypes = {\n label: PT.string,\n theme: ThemedInput.themeType.isRequired,\n};\n\nInput.defaultProps = {\n label: undefined,\n};\n\nexport default ThemedInput;\n"],"mappings":"gLAAA,IAAAA,UAAA,CAAAC,sBAAA,CAAAC,OAAA,gBACA,IAAAC,MAAA,CAAAD,OAAA,UAEA,IAAAE,YAAA,CAAAH,sBAAA,CAAAC,OAAA,8BAA8D,IAAAG,WAAA,CAAAH,OAAA,4BAAAI,YAAA,2GAa9D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACA,KAAM,CAAAC,KAAK,cAAG,GAAAC,iBAAU,EAA2B,CACjD,CACEC,KAAK,CACLC,KAAK,CACL,GAAGC,IACG,CAAC,CACTC,GAAG,gBAEH,GAAAP,WAAA,CAAAQ,IAAA,UAAMC,SAAS,CAAEJ,KAAK,CAACK,SAAU,CAAAC,QAAA,EAC7BP,KAAK,GAAKQ,SAAS,CAAG,IAAI,cAAG,GAAAZ,WAAA,CAAAa,GAAA,OAAGJ,SAAS,CAAEJ,KAAK,CAACD,KAAM,CAAAO,QAAA,CAAEP,KAAK,CAAI,CAAC,cACrE,GAAAJ,WAAA,CAAAa,GAAA,WACEJ,SAAS,CAAEJ,KAAK,CAACS,KAAM,CACvBP,GAAG,CAAEA,GAAI,IACLD,IAAI,CACT,CAAC,EACE,CACP,CAAC,CAEF,KAAM,CAAAS,WAAW,CAAG,GAAAC,oBAAM,EAACd,KAAK,CAAE,OAAO,CAAE,CACzC,WAAW,CACX,OAAO,CACP,OAAO,CACR,CAAED,YAAY,CAAC,CAEhBC,KAAK,CAACe,SAAS,CAAG,CAChBb,KAAK,CAAEc,kBAAE,CAACC,MAAM,CAChBd,KAAK,CAAEU,WAAW,CAACK,SAAS,CAACC,UAC/B,CAAC,CAEDnB,KAAK,CAACoB,YAAY,CAAG,CACnBlB,KAAK,CAAEQ,SACT,CAAC,CAAC,IAAAW,QAAA,CAAAC,OAAA,CAAAC,OAAA,CAEaV,WAAW"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=
|
|
1
|
+
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _reactRouterDom=require("react-router-dom");var _GenericLink=_interopRequireDefault(require("./GenericLink"));var _jsxRuntime=require("react/jsx-runtime");/**
|
|
2
2
|
* The Link wraps around React Router's Link component, to automatically replace
|
|
3
3
|
* it by the regular <a> element when:
|
|
4
4
|
* - The target reference points to another domain;
|
|
5
5
|
* - User opts to open the reference in a new tab;
|
|
6
6
|
* - User explicitely opts to use <a>.
|
|
7
|
-
*/
|
|
7
|
+
*/const Link=props=>/*#__PURE__*/ /* eslint-disable react/jsx-props-no-spreading */(0,_jsxRuntime.jsx)(_GenericLink.default,{...props,routerLinkType:_reactRouterDom.Link})/* eslint-enable react/jsx-props-no-spreading */;var _default=exports.default=Link;
|
|
8
8
|
//# sourceMappingURL=Link.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Link.js","names":["_reactRouterDom","require","_GenericLink","_interopRequireDefault","_jsxRuntime","Link","props","jsx","default","routerLinkType","RrLink"],"sources":["../../../../src/shared/components/Link.
|
|
1
|
+
{"version":3,"file":"Link.js","names":["_reactRouterDom","require","_GenericLink","_interopRequireDefault","_jsxRuntime","Link","props","jsx","default","routerLinkType","RrLink","_default","exports"],"sources":["../../../../src/shared/components/Link.tsx"],"sourcesContent":["/**\n * The Link wraps around React Router's Link component, to automatically replace\n * it by the regular <a> element when:\n * - The target reference points to another domain;\n * - User opts to open the reference in a new tab;\n * - User explicitely opts to use <a>.\n */\n\nimport { Link as RrLink } from 'react-router-dom';\n\nimport GenericLink, { type PropsT as GenericLinkPropsT } from './GenericLink';\n\ntype PropsT = Omit<GenericLinkPropsT, 'routerLinkType'>;\n\nconst Link: React.FunctionComponent<PropsT> = (props) => (\n /* eslint-disable react/jsx-props-no-spreading */\n <GenericLink {...props} routerLinkType={RrLink} />\n /* eslint-enable react/jsx-props-no-spreading */\n);\n\nexport default Link;\n"],"mappings":"gLAQA,IAAAA,eAAA,CAAAC,OAAA,qBAEA,IAAAC,YAAA,CAAAC,sBAAA,CAAAF,OAAA,mBAA8E,IAAAG,WAAA,CAAAH,OAAA,sBAV9E;AACA;AACA;AACA;AACA;AACA;AACA,GAQA,KAAM,CAAAI,IAAqC,CAAIC,KAAK,gBAClD,iDACA,GAAAF,WAAA,CAAAG,GAAA,EAACL,YAAA,CAAAM,OAAW,KAAKF,KAAK,CAAEG,cAAc,CAAEC,oBAAO,CAAE,CACjD,gDACD,CAAC,IAAAC,QAAA,CAAAC,OAAA,CAAAJ,OAAA,CAEaH,IAAI"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=
|
|
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 _react=require("react");var _reactHelmet=require("react-helmet");var _jsxRuntime=require("react/jsx-runtime");const Context=/*#__PURE__*/(0,_react.createContext)({description:"",title:""});/**
|
|
2
2
|
* The `<MetaTags>` component is an auxiliary wrapper around `react-helmet`,
|
|
3
3
|
* which helps to inject meta tags (page title, a brief content description,
|
|
4
4
|
* and social media thumbnails) into generated pages.
|
|
@@ -24,31 +24,31 @@
|
|
|
24
24
|
* );
|
|
25
25
|
* }
|
|
26
26
|
* ```
|
|
27
|
-
* @param
|
|
28
|
-
* @param
|
|
27
|
+
* @param [props]
|
|
28
|
+
* @param [props.description] Page description to use in
|
|
29
29
|
* the `description` meta tag, and as a default description of Open Graph Tags.
|
|
30
|
-
* @param
|
|
30
|
+
* @param [props.image] The absolute URL of thumbnail image to use
|
|
31
31
|
* in Open Graph Tags (`twitter:image`, and `og:image`). By default these tags
|
|
32
32
|
* are not injected.
|
|
33
33
|
*
|
|
34
34
|
* **BEWARE:** It must be a complete, absolute URL, including the correct
|
|
35
35
|
* website domain and HTTP schema.
|
|
36
36
|
*
|
|
37
|
-
* @param
|
|
37
|
+
* @param [props.siteName]: The site name to use in `twitter:site`,
|
|
38
38
|
* and `og:sitename` tags. By default these tags are not injected.
|
|
39
39
|
*
|
|
40
|
-
* @param
|
|
40
|
+
* @param [props.socialDescription] The site description to use in
|
|
41
41
|
* `twitter:description` and `og:description` meta tags. By default the value of
|
|
42
42
|
* `description` prop is used.
|
|
43
|
-
* @param
|
|
43
|
+
* @param [props.socialTitle] The page title to use in
|
|
44
44
|
* `twitter:title`, `og:title`, and `og:image:alt` tags. By default the value of
|
|
45
45
|
* `title` prop is used. Also the `og:image:alt` tag is only injected if `image`
|
|
46
46
|
* prop is present.
|
|
47
47
|
*
|
|
48
|
-
* @param
|
|
48
|
+
* @param props.title: The page name to use in the `<title>` tag.
|
|
49
49
|
* It is also used as the default value of `socialTitle` prop.
|
|
50
50
|
*
|
|
51
|
-
* @param
|
|
51
|
+
* @param [props.url] The page URL to use in `og:url` tag.
|
|
52
52
|
* By default the tag is not injected.
|
|
53
|
-
*/
|
|
53
|
+
*/const MetaTags=({children,description,image,siteName,socialDescription,socialTitle,title,url})=>{const socTitle=socialTitle||title;const socDesc=socialDescription||description;const context=(0,_react.useMemo)(()=>({description,image,siteName,socialDescription,socialTitle,title,url}),[description,image,siteName,socialDescription,socialTitle,title,url]);return/*#__PURE__*/(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[/*#__PURE__*/(0,_jsxRuntime.jsxs)(_reactHelmet.Helmet,{children:[/*#__PURE__*/(0,_jsxRuntime.jsx)("title",{children:title}),/*#__PURE__*/(0,_jsxRuntime.jsx)("meta",{name:"description",content:description}),/*#__PURE__*/(0,_jsxRuntime.jsx)("meta",{name:"twitter:card",content:"summary_large_image"}),/*#__PURE__*/(0,_jsxRuntime.jsx)("meta",{name:"twitter:title",content:socTitle}),/*#__PURE__*/(0,_jsxRuntime.jsx)("meta",{name:"twitter:description",content:socDesc}),image?/*#__PURE__*/(0,_jsxRuntime.jsx)("meta",{name:"twitter:image",content:image}):null,siteName?/*#__PURE__*/(0,_jsxRuntime.jsx)("meta",{name:"twitter:site",content:`@${siteName}`}):null,/*#__PURE__*/(0,_jsxRuntime.jsx)("meta",{name:"og:title",content:socTitle}),image?/*#__PURE__*/(0,_jsxRuntime.jsx)("meta",{name:"og:image",content:image}):null,image?/*#__PURE__*/(0,_jsxRuntime.jsx)("meta",{name:"og:image:alt",content:socTitle}):null,/*#__PURE__*/(0,_jsxRuntime.jsx)("meta",{name:"og:description",content:socDesc}),siteName?/*#__PURE__*/(0,_jsxRuntime.jsx)("meta",{name:"og:sitename",content:siteName}):null,url?/*#__PURE__*/(0,_jsxRuntime.jsx)("meta",{name:"og:url",content:url}):null]}),children?/*#__PURE__*/(0,_jsxRuntime.jsx)(Context.Provider,{value:context,children:children}):null]})};MetaTags.Context=Context;MetaTags.defaultProps={children:null,image:"",siteName:"",socialDescription:"",socialTitle:"",url:""};MetaTags.propTypes={children:_propTypes.default.node,description:_propTypes.default.string.isRequired,image:_propTypes.default.string,siteName:_propTypes.default.string,socialDescription:_propTypes.default.string,socialTitle:_propTypes.default.string,title:_propTypes.default.string.isRequired,url:_propTypes.default.string};var _default=exports.default=MetaTags;
|
|
54
54
|
//# sourceMappingURL=MetaTags.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MetaTags.js","names":["_propTypes","_interopRequireDefault","require","_react","_reactHelmet","_jsxRuntime","Context","createContext","
|
|
1
|
+
{"version":3,"file":"MetaTags.js","names":["_propTypes","_interopRequireDefault","require","_react","_reactHelmet","_jsxRuntime","Context","createContext","description","title","MetaTags","children","image","siteName","socialDescription","socialTitle","url","socTitle","socDesc","context","useMemo","jsxs","Fragment","Helmet","jsx","name","content","Provider","value","defaultProps","propTypes","PT","node","string","isRequired","_default","exports","default"],"sources":["../../../../src/shared/components/MetaTags.tsx"],"sourcesContent":["import PT from 'prop-types';\nimport { type ReactNode, createContext, useMemo } from 'react';\nimport { Helmet } from 'react-helmet';\n\ntype PropsT = {\n children?: ReactNode;\n description: string;\n image?: string;\n siteName?: string;\n socialDescription?: string;\n socialTitle?: string;\n title: string;\n url?: string;\n};\n\nconst Context = createContext<PropsT>({\n description: '',\n title: '',\n});\n\n/**\n * The `<MetaTags>` component is an auxiliary wrapper around `react-helmet`,\n * which helps to inject meta tags (page title, a brief content description,\n * and social media thumbnails) into generated pages.\n *\n * When `<MetaTags>` are nested within the app's component tree, meta tags\n * content injected by components encountered down the tree overrides tags\n * injected by previously encountered `<MetaTags>` components.\n *\n * **Children:** `<MetaTags>` children, if any, are rendered at the component's\n * location. The context passes down all meta tag properties of parent\n * `<MetaTag>` instances. These properties can fetched within children\n * hierarchy in the following way, thus facilitating tags modification by\n * children:\n * ```jsx\n * import { useContext } from 'react';\n * import { MetaTags } from '@dr.pogodin/react-utils';\n * export default function SampleComponent() {\n * const { title, description, ...rest } = useContext(MetaTags.Context);\n * // Do something with these props here, e.g. prefix the page title with\n * // the component name:\n * return (\n * <MetaTags title={`Sample component - ${title}`} />\n * );\n * }\n * ```\n * @param [props]\n * @param [props.description] Page description to use in\n * the `description` meta tag, and as a default description of Open Graph Tags.\n * @param [props.image] The absolute URL of thumbnail image to use\n * in Open Graph Tags (`twitter:image`, and `og:image`). By default these tags\n * are not injected.\n *\n * **BEWARE:** It must be a complete, absolute URL, including the correct\n * website domain and HTTP schema.\n *\n * @param [props.siteName]: The site name to use in `twitter:site`,\n * and `og:sitename` tags. By default these tags are not injected.\n *\n * @param [props.socialDescription] The site description to use in\n * `twitter:description` and `og:description` meta tags. By default the value of\n * `description` prop is used.\n * @param [props.socialTitle] The page title to use in\n * `twitter:title`, `og:title`, and `og:image:alt` tags. By default the value of\n * `title` prop is used. Also the `og:image:alt` tag is only injected if `image`\n * prop is present.\n *\n * @param props.title: The page name to use in the `<title>` tag.\n * It is also used as the default value of `socialTitle` prop.\n *\n * @param [props.url] The page URL to use in `og:url` tag.\n * By default the tag is not injected.\n */\nconst MetaTags: React.FunctionComponent<PropsT> & {\n Context: React.Context<PropsT>;\n} = ({\n children,\n description,\n image,\n siteName,\n socialDescription,\n socialTitle,\n title,\n url,\n}) => {\n const socTitle = socialTitle || title;\n const socDesc = socialDescription || description;\n\n const context = useMemo(() => ({\n description,\n image,\n siteName,\n socialDescription,\n socialTitle,\n title,\n url,\n }), [\n description,\n image,\n siteName,\n socialDescription,\n socialTitle,\n title,\n url,\n ]);\n\n return (\n <>\n <Helmet>\n {/* General tags. */}\n <title>\n {title}\n </title>\n <meta name=\"description\" content={description} />\n\n {/* Twitter cards. */}\n <meta name=\"twitter:card\" content=\"summary_large_image\" />\n <meta name=\"twitter:title\" content={socTitle} />\n <meta name=\"twitter:description\" content={socDesc} />\n { image ? <meta name=\"twitter:image\" content={image} /> : null }\n {\n siteName ? (\n <meta name=\"twitter:site\" content={`@${siteName}`} />\n ) : null\n }\n\n {/* Open Graph data. */}\n <meta name=\"og:title\" content={socTitle} />\n { image ? <meta name=\"og:image\" content={image} /> : null }\n { image ? <meta name=\"og:image:alt\" content={socTitle} /> : null }\n <meta name=\"og:description\" content={socDesc} />\n {\n siteName ? (<meta name=\"og:sitename\" content={siteName} />) : null\n }\n { url ? (<meta name=\"og:url\" content={url} />) : null }\n </Helmet>\n {\n children ? (\n <Context.Provider value={context}>\n {children}\n </Context.Provider>\n ) : null\n }\n </>\n );\n};\n\nMetaTags.Context = Context;\n\nMetaTags.defaultProps = {\n children: null,\n image: '',\n siteName: '',\n socialDescription: '',\n socialTitle: '',\n url: '',\n};\n\nMetaTags.propTypes = {\n children: PT.node,\n description: PT.string.isRequired,\n image: PT.string,\n siteName: PT.string,\n socialDescription: PT.string,\n socialTitle: PT.string,\n title: PT.string.isRequired,\n url: PT.string,\n};\n\nexport default MetaTags;\n"],"mappings":"gLAAA,IAAAA,UAAA,CAAAC,sBAAA,CAAAC,OAAA,gBACA,IAAAC,MAAA,CAAAD,OAAA,UACA,IAAAE,YAAA,CAAAF,OAAA,iBAAsC,IAAAG,WAAA,CAAAH,OAAA,sBAatC,KAAM,CAAAI,OAAO,cAAG,GAAAC,oBAAa,EAAS,CACpCC,WAAW,CAAE,EAAE,CACfC,KAAK,CAAE,EACT,CAAC,CAAC,CAEF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACA,KAAM,CAAAC,QAEL,CAAGA,CAAC,CACHC,QAAQ,CACRH,WAAW,CACXI,KAAK,CACLC,QAAQ,CACRC,iBAAiB,CACjBC,WAAW,CACXN,KAAK,CACLO,GACF,CAAC,GAAK,CACJ,KAAM,CAAAC,QAAQ,CAAGF,WAAW,EAAIN,KAAK,CACrC,KAAM,CAAAS,OAAO,CAAGJ,iBAAiB,EAAIN,WAAW,CAEhD,KAAM,CAAAW,OAAO,CAAG,GAAAC,cAAO,EAAC,KAAO,CAC7BZ,WAAW,CACXI,KAAK,CACLC,QAAQ,CACRC,iBAAiB,CACjBC,WAAW,CACXN,KAAK,CACLO,GACF,CAAC,CAAC,CAAE,CACFR,WAAW,CACXI,KAAK,CACLC,QAAQ,CACRC,iBAAiB,CACjBC,WAAW,CACXN,KAAK,CACLO,GAAG,CACJ,CAAC,CAEF,mBACE,GAAAX,WAAA,CAAAgB,IAAA,EAAAhB,WAAA,CAAAiB,QAAA,EAAAX,QAAA,eACE,GAAAN,WAAA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,GAAAR,WAAA,CAAAmB,GAAA,UAAMC,IAAI,CAAC,aAAa,CAACC,OAAO,CAAEb,QAAS,CAAE,CAAC,CAAI,IAAI,CAElEG,GAAG,cAAI,GAAAX,WAAA,CAAAmB,GAAA,UAAMC,IAAI,CAAC,QAAQ,CAACC,OAAO,CAAEV,GAAI,CAAE,CAAC,CAAI,IAAI,EAC/C,CAAC,CAEPL,QAAQ,cACN,GAAAN,WAAA,CAAAmB,GAAA,EAAClB,OAAO,CAACqB,QAAQ,EAACC,KAAK,CAAET,OAAQ,CAAAR,QAAA,CAC9BA,QAAQ,CACO,CAAC,CACjB,IAAI,EAEV,CAEN,CAAC,CAEDD,QAAQ,CAACJ,OAAO,CAAGA,OAAO,CAE1BI,QAAQ,CAACmB,YAAY,CAAG,CACtBlB,QAAQ,CAAE,IAAI,CACdC,KAAK,CAAE,EAAE,CACTC,QAAQ,CAAE,EAAE,CACZC,iBAAiB,CAAE,EAAE,CACrBC,WAAW,CAAE,EAAE,CACfC,GAAG,CAAE,EACP,CAAC,CAEDN,QAAQ,CAACoB,SAAS,CAAG,CACnBnB,QAAQ,CAAEoB,kBAAE,CAACC,IAAI,CACjBxB,WAAW,CAAEuB,kBAAE,CAACE,MAAM,CAACC,UAAU,CACjCtB,KAAK,CAAEmB,kBAAE,CAACE,MAAM,CAChBpB,QAAQ,CAAEkB,kBAAE,CAACE,MAAM,CACnBnB,iBAAiB,CAAEiB,kBAAE,CAACE,MAAM,CAC5BlB,WAAW,CAAEgB,kBAAE,CAACE,MAAM,CACtBxB,KAAK,CAAEsB,kBAAE,CAACE,MAAM,CAACC,UAAU,CAC3BlB,GAAG,CAAEe,kBAAE,CAACE,MACV,CAAC,CAAC,IAAAE,QAAA,CAAAC,OAAA,CAAAC,OAAA,CAEa3B,QAAQ"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.
|
|
1
|
+
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=exports.BaseModal=void 0;var _lodash=require("lodash");var _react=require("react");var _reactDom=_interopRequireDefault(require("react-dom"));var _propTypes=_interopRequireDefault(require("prop-types"));var _reactThemes=_interopRequireDefault(require("@dr.pogodin/react-themes"));var _jsxRuntime=require("react/jsx-runtime");/* global document */const baseTheme={"context":"Szmbbz","ad":"Ah-Nsc","hoc":"Wki41G","overlay":"ye2BZo","container":"gyZ4rc"};/**
|
|
2
2
|
* The `<Modal>` component implements a simple themeable modal window, wrapped
|
|
3
3
|
* into the default theme. `<BaseModal>` exposes the base non-themed component.
|
|
4
4
|
* **Children:** Component children are rendered as the modal content.
|
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
* clicks outside the modal, or presses Escape. It is expected to hide the
|
|
9
9
|
* modal.
|
|
10
10
|
* @param {ModalTheme} [props.theme] _Ad hoc_ theme.
|
|
11
|
-
*/
|
|
11
|
+
*/const BaseModal=({children,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.classList.add("scrolling-disabled-by-modal");document.body.appendChild(p);setPortal(p);return()=>{document.body.classList.remove("scrolling-disabled-by-modal");document.body.removeChild(p)}},[]);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",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",["container","overlay"],baseTheme);BaseModal.propTypes={onCancel:_propTypes.default.func,children:_propTypes.default.node,theme:ThemedModal.themeType.isRequired};BaseModal.defaultProps={onCancel:_lodash.noop,children:null};var _default=exports.default=ThemedModal;/* Non-themed version of the Modal. */
|
|
12
12
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_lodash","require","_react","_reactDom","_interopRequireDefault","_propTypes","_reactThemes","_jsxRuntime","baseTheme","BaseModal","children","onCancel","theme","containerRef","useRef","overlayRef","portal","setPortal","useState","useEffect","p","document","createElement","body","classList","add","appendChild","remove","removeChild","focusLast","useMemo","jsx","onFocus","elems","current","querySelectorAll","i","length","focus","activeElement","tabIndex","ReactDom","createPortal","jsxs","Fragment","className","overlay","onClick","onKeyDown","e","key","ref","node","role","container","onWheel","event","stopPropagation","ThemedModal","themed","propTypes","PT","func","themeType","isRequired","defaultProps","noop","_default","
|
|
1
|
+
{"version":3,"file":"index.js","names":["_lodash","require","_react","_reactDom","_interopRequireDefault","_propTypes","_reactThemes","_jsxRuntime","baseTheme","BaseModal","children","onCancel","theme","containerRef","useRef","overlayRef","portal","setPortal","useState","useEffect","p","document","createElement","body","classList","add","appendChild","remove","removeChild","focusLast","useMemo","jsx","onFocus","elems","current","querySelectorAll","i","length","focus","activeElement","tabIndex","ReactDom","createPortal","jsxs","Fragment","className","overlay","onClick","onKeyDown","e","key","ref","node","role","container","onWheel","event","stopPropagation","exports","ThemedModal","themed","propTypes","PT","func","themeType","isRequired","defaultProps","noop","_default","default"],"sources":["../../../../../src/shared/components/Modal/index.tsx"],"sourcesContent":["/* global document */\n\nimport { noop } from 'lodash';\n\nimport {\n type ReactNode,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\n\nimport ReactDom from 'react-dom';\nimport PT from 'prop-types';\nimport themed, { type Theme } from '@dr.pogodin/react-themes';\n\nimport baseTheme from './base-theme.scss';\nimport './styles.scss';\n\ntype PropsT = {\n children?: ReactNode;\n onCancel?: () => void;\n theme: Theme & {\n container?: string;\n overlay?: string;\n };\n};\n\n/**\n * The `<Modal>` component implements a simple themeable modal window, wrapped\n * into the default theme. `<BaseModal>` exposes the base non-themed component.\n * **Children:** Component children are rendered as the modal content.\n * @param {object} props Component properties. Beside props documented below,\n * [Other theming properties](https://www.npmjs.com/package/@dr.pogodin/react-themes#themed-component-properties) are supported as well.\n * @param {function} [props.onCancel] The callback to trigger when user\n * clicks outside the modal, or presses Escape. It is expected to hide the\n * modal.\n * @param {ModalTheme} [props.theme] _Ad hoc_ theme.\n */\nconst BaseModal: React.FunctionComponent<PropsT> = ({\n children,\n onCancel,\n theme,\n}) => {\n const containerRef = useRef<HTMLDivElement | null>(null);\n const overlayRef = useRef<HTMLDivElement | null>(null);\n const [portal, setPortal] = useState<HTMLDivElement>();\n\n useEffect(() => {\n const p = document.createElement('div');\n document.body.classList.add('scrolling-disabled-by-modal');\n document.body.appendChild(p);\n setPortal(p);\n return () => {\n document.body.classList.remove('scrolling-disabled-by-modal');\n document.body.removeChild(p);\n };\n }, []);\n\n const focusLast = useMemo(() => (\n <div\n onFocus={() => {\n const elems = containerRef.current?.querySelectorAll('*') as NodeListOf<HTMLElement>;\n for (let i = elems.length - 1; i >= 0; --i) {\n elems[i].focus();\n if (document.activeElement === elems[i]) return;\n }\n overlayRef.current?.focus();\n }}\n /* eslint-disable jsx-a11y/no-noninteractive-tabindex */\n tabIndex={0}\n /* eslint-enable jsx-a11y/no-noninteractive-tabindex */\n />\n ), []);\n\n return portal ? ReactDom.createPortal(\n (\n <>\n {focusLast}\n <div\n aria-label=\"Cancel\"\n className={theme.overlay}\n onClick={() => onCancel && onCancel()}\n onKeyDown={(e) => {\n if (e.key === 'Escape' && onCancel) onCancel();\n }}\n ref={(node) => {\n if (node && node !== overlayRef.current) {\n overlayRef.current = node;\n node.focus();\n }\n }}\n role=\"button\"\n tabIndex={0}\n />\n <div\n aria-modal=\"true\"\n className={theme.container}\n onWheel={(event) => event.stopPropagation()}\n ref={containerRef}\n role=\"dialog\"\n >\n {children}\n </div>\n <div\n onFocus={() => {\n overlayRef.current?.focus();\n }}\n /* eslint-disable jsx-a11y/no-noninteractive-tabindex */\n tabIndex={0}\n /* eslint-enable jsx-a11y/no-noninteractive-tabindex */\n />\n {focusLast}\n </>\n ),\n portal,\n ) : null;\n};\n\nconst ThemedModal = themed(\n BaseModal,\n 'Modal',\n [\n 'container',\n 'overlay',\n ],\n baseTheme,\n);\n\nBaseModal.propTypes = {\n onCancel: PT.func,\n children: PT.node,\n theme: ThemedModal.themeType.isRequired,\n};\n\nBaseModal.defaultProps = {\n onCancel: noop,\n children: null,\n};\n\nexport default ThemedModal;\n\n/* Non-themed version of the Modal. */\nexport { BaseModal };\n"],"mappings":"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,2BAAA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,CACDX,SAAS,EACV,CAAC,CAELb,MACF,CAAC,CAAG,IACN,CAAC,CAAC0C,OAAA,CAAAjD,SAAA,CAAAA,SAAA,CAEF,KAAM,CAAAkD,WAAW,CAAG,GAAAC,oBAAM,EACxBnD,SAAS,CACT,OAAO,CACP,CACE,WAAW,CACX,SAAS,CACV,CACDD,SACF,CAAC,CAEDC,SAAS,CAACoD,SAAS,CAAG,CACpBlD,QAAQ,CAAEmD,kBAAE,CAACC,IAAI,CACjBrD,QAAQ,CAAEoD,kBAAE,CAACV,IAAI,CACjBxC,KAAK,CAAE+C,WAAW,CAACK,SAAS,CAACC,UAC/B,CAAC,CAEDxD,SAAS,CAACyD,YAAY,CAAG,CACvBvD,QAAQ,CAAEwD,YAAI,CACdzD,QAAQ,CAAE,IACZ,CAAC,CAAC,IAAA0D,QAAA,CAAAV,OAAA,CAAAW,OAAA,CAEaV,WAAW,CAE1B"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=
|
|
1
|
+
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _reactRouterDom=require("react-router-dom");var _GenericLink=_interopRequireDefault(require("./GenericLink"));var _jsxRuntime=require("react/jsx-runtime");const NavLink=props=>/*#__PURE__*/ /* eslint-disable react/jsx-props-no-spreading */(0,_jsxRuntime.jsx)(_GenericLink.default,{...props,routerLinkType:_reactRouterDom.NavLink})/* eslint-enable react/jsx-props-no-spreading */;var _default=exports.default=NavLink;
|
|
2
2
|
//# sourceMappingURL=NavLink.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NavLink.js","names":["_reactRouterDom","require","_GenericLink","_interopRequireDefault","_jsxRuntime","NavLink","props","jsx","default","routerLinkType","RrNavLink"],"sources":["../../../../src/shared/components/NavLink.
|
|
1
|
+
{"version":3,"file":"NavLink.js","names":["_reactRouterDom","require","_GenericLink","_interopRequireDefault","_jsxRuntime","NavLink","props","jsx","default","routerLinkType","RrNavLink","_default","exports"],"sources":["../../../../src/shared/components/NavLink.tsx"],"sourcesContent":["import { NavLink as RrNavLink } from 'react-router-dom';\n\nimport GenericLink, { type PropsT as GenericLinkPropsT } from './GenericLink';\n\ntype PropsT = Omit<GenericLinkPropsT, 'routerLinkType'>;\n\nconst NavLink: React.FunctionComponent<PropsT> = (props) => (\n /* eslint-disable react/jsx-props-no-spreading */\n <GenericLink {...props} routerLinkType={RrNavLink} />\n /* eslint-enable react/jsx-props-no-spreading */\n);\n\nexport default NavLink;\n"],"mappings":"gLAAA,IAAAA,eAAA,CAAAC,OAAA,qBAEA,IAAAC,YAAA,CAAAC,sBAAA,CAAAF,OAAA,mBAA8E,IAAAG,WAAA,CAAAH,OAAA,sBAI9E,KAAM,CAAAI,OAAwC,CAAIC,KAAK,gBACrD,iDACA,GAAAF,WAAA,CAAAG,GAAA,EAACL,YAAA,CAAAM,OAAW,KAAKF,KAAK,CAAEG,cAAc,CAAEC,uBAAU,CAAE,CACpD,gDACD,CAAC,IAAAC,QAAA,CAAAC,OAAA,CAAAJ,OAAA,CAEaH,OAAO"}
|
|
@@ -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
|
|
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 baseTheme={"context":"m4mL-M","ad":"m3-mdC","hoc":"J15Z4H","container":"T3cuHB","mainPanel":"pPlQO2","sidePanel":"lqNh4h"};/**
|
|
2
2
|
* Simple and themeable page layout. It keeps the main content centered in
|
|
3
3
|
* a column of limited width, which fills entire viewport on small screens
|
|
4
4
|
* (under `$screen-md = 1024px` size). At larger screens the column keeps
|
|
@@ -12,5 +12,5 @@
|
|
|
12
12
|
* @param {PageLayoutTheme} [props.theme] _Ad hoc_ theme.
|
|
13
13
|
* @param {...any} [props....]
|
|
14
14
|
* [Other theming properties](https://www.npmjs.com/package/@dr.pogodin/react-themes#themed-component-properties)
|
|
15
|
-
*/
|
|
15
|
+
*/const PageLayout=({children,leftSidePanelContent,rightSidePanelContent,theme})=>/*#__PURE__*/(0,_jsxRuntime.jsxs)("div",{className:theme.container,children:[/*#__PURE__*/(0,_jsxRuntime.jsx)("div",{className:[theme.sidePanel,theme.leftSidePanel].join(" "),children:leftSidePanelContent}),/*#__PURE__*/(0,_jsxRuntime.jsx)("div",{className:theme.mainPanel,children:children}),/*#__PURE__*/(0,_jsxRuntime.jsx)("div",{className:[theme.sidePanel,theme.rightSidePanel].join(" "),children:rightSidePanelContent})]});const ThemedPageLayout=(0,_reactThemes.default)(PageLayout,"PageLayout",["container","leftSidePanel","mainPanel","rightSidePanel","sidePanel"],baseTheme);PageLayout.propTypes={children:_propTypes.default.node,leftSidePanelContent:_propTypes.default.node,rightSidePanelContent:_propTypes.default.node,theme:ThemedPageLayout.themeType.isRequired};PageLayout.defaultProps={children:null,leftSidePanelContent:null,rightSidePanelContent:null};var _default=exports.default=ThemedPageLayout;
|
|
16
16
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_propTypes","_interopRequireDefault","require","
|
|
1
|
+
{"version":3,"file":"index.js","names":["_propTypes","_interopRequireDefault","require","_reactThemes","_jsxRuntime","baseTheme","PageLayout","children","leftSidePanelContent","rightSidePanelContent","theme","jsxs","className","container","jsx","sidePanel","leftSidePanel","join","mainPanel","rightSidePanel","ThemedPageLayout","themed","propTypes","PT","node","themeType","isRequired","defaultProps","_default","exports","default"],"sources":["../../../../../src/shared/components/PageLayout/index.tsx"],"sourcesContent":["import PT from 'prop-types';\nimport type { ReactNode } from 'react';\n\nimport themed, { type Theme } from '@dr.pogodin/react-themes';\n\nimport baseTheme from './base-theme.scss';\n\ntype PropsT = {\n children?: ReactNode;\n leftSidePanelContent?: ReactNode;\n rightSidePanelContent?: ReactNode;\n theme: Theme & {\n container?: string;\n mainPanel?: string;\n sidePanel?: string;\n leftSidePanel?: string;\n rightSidePanel?: string;\n };\n};\n\n/**\n * Simple and themeable page layout. It keeps the main content centered in\n * a column of limited width, which fills entire viewport on small screens\n * (under `$screen-md = 1024px` size). At larger screens the column keeps\n * `$screen-md` size, and it is centered at the page, surrounded by side\n * panels, where additional content can be displayed.\n *\n * **Children:** Component children are rendered as the content of main panel.\n * @param {object} [props] Component properties.\n * @param {Node} [props.leftSidePanelContent] The content for left side panel.\n * @param {Node} [props.rightSidePanelContent] The content for right side panel.\n * @param {PageLayoutTheme} [props.theme] _Ad hoc_ theme.\n * @param {...any} [props....]\n * [Other theming properties](https://www.npmjs.com/package/@dr.pogodin/react-themes#themed-component-properties)\n */\nconst PageLayout: React.FunctionComponent<PropsT> = ({\n children,\n leftSidePanelContent,\n rightSidePanelContent,\n theme,\n}) => (\n <div className={theme.container}>\n <div className={[theme.sidePanel, theme.leftSidePanel].join(' ')}>\n {leftSidePanelContent}\n </div>\n <div className={theme.mainPanel}>\n {children}\n </div>\n <div className={[theme.sidePanel, theme.rightSidePanel].join(' ')}>\n {rightSidePanelContent}\n </div>\n </div>\n);\n\nconst ThemedPageLayout = themed(PageLayout, 'PageLayout', [\n 'container',\n 'leftSidePanel',\n 'mainPanel',\n 'rightSidePanel',\n 'sidePanel',\n], baseTheme);\n\nPageLayout.propTypes = {\n children: PT.node,\n leftSidePanelContent: PT.node,\n rightSidePanelContent: PT.node,\n theme: ThemedPageLayout.themeType.isRequired,\n};\n\nPageLayout.defaultProps = {\n children: null,\n leftSidePanelContent: null,\n rightSidePanelContent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BAAE,CAACC,IAAI,CAC9Bd,KAAK,CAAEU,gBAAgB,CAACK,SAAS,CAACC,UACpC,CAAC,CAEDpB,UAAU,CAACqB,YAAY,CAAG,CACxBpB,QAAQ,CAAE,IAAI,CACdC,oBAAoB,CAAE,IAAI,CAC1BC,qBAAqB,CAAE,IACzB,CAAC,CAAC,IAAAmB,QAAA,CAAAC,OAAA,CAAAC,OAAA,CAEaV,gBAAgB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=
|
|
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"));require("react");var _jsxRuntime=require("react/jsx-runtime");/**
|
|
2
2
|
* The `<ScalableRect>` component implements container keeping given aspect
|
|
3
3
|
* ratio, while its width is altered.
|
|
4
4
|
*
|
|
@@ -7,11 +7,15 @@
|
|
|
7
7
|
* @param {string} [props.className] CSS class for component container.
|
|
8
8
|
* @param {string} [props.ratio=1:1] Ratio of the rendered rectangle sides,
|
|
9
9
|
* in `W:H` form.
|
|
10
|
-
*/
|
|
10
|
+
*/const ScalableRect=({children,className,ratio})=>{const aux=ratio.split(":");const paddingBottom=`${100*parseFloat(aux[1])/parseFloat(aux[0])}%`;/* NOTE: In case the following code looks strange to you, mind that we want to
|
|
11
11
|
* allow the user to set custom styles on this component. If user passes in a
|
|
12
12
|
* "className" prop (possibly "styleName", but that one is converted to
|
|
13
13
|
* "className" by Babel just before being passed into this component), it
|
|
14
14
|
* should not interfere with the sizing behavior, thus we need an extra <div>
|
|
15
15
|
* level in this component; however, if user does not need a custom styling,
|
|
16
|
-
* we can save one level of HTML code, so we do it. */const rect=/*#__PURE__*/(0,_jsxRuntime.jsx)("div",{style:{paddingBottom},className:"EznFz3",children:/*#__PURE__*/(0,_jsxRuntime.jsx)("div",{className:"_0vb7tq",children:children})});return className?/*#__PURE__*/(0,_jsxRuntime.jsx)("div",{className:className,children:rect}):rect}ScalableRect.defaultProps={children:null,className:
|
|
16
|
+
* we can save one level of HTML code, so we do it. */const rect=/*#__PURE__*/(0,_jsxRuntime.jsx)("div",{style:{paddingBottom},className:"EznFz3",children:/*#__PURE__*/(0,_jsxRuntime.jsx)("div",{className:"_0vb7tq",children:children})});return className?/*#__PURE__*/(0,_jsxRuntime.jsx)("div",{className:className,children:rect}):rect};ScalableRect.defaultProps={children:null,className:undefined,ratio:"1:1"};ScalableRect.propTypes={children:_propTypes.default.node,className:_propTypes.default.string,ratio:(props,name)=>{const ratio=props[name];// "ratio" prop is not required (defaults "1:1").
|
|
17
|
+
if(ratio===undefined)return null;// If given, "ratio" must be a string.
|
|
18
|
+
if(typeof ratio!=="string"){return Error("\"ratio\" prop must be a string")}// If given, "ratio" must have "H:W" format.
|
|
19
|
+
if(!ratio.match(/\d\.\d+/)){return Error("\"ratio\" prop must have \"H:W\" format")}// Everything looks right.
|
|
20
|
+
return null}};var _default=exports.default=ScalableRect;
|
|
17
21
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_propTypes","_interopRequireDefault","require","_jsxRuntime","ScalableRect","children","className","ratio","aux","split","paddingBottom","rect","jsx","style","defaultProps","propTypes","PT","node","string"],"sources":["../../../../../src/shared/components/ScalableRect/index.
|
|
1
|
+
{"version":3,"file":"index.js","names":["_propTypes","_interopRequireDefault","require","_jsxRuntime","ScalableRect","children","className","ratio","aux","split","paddingBottom","parseFloat","rect","jsx","style","defaultProps","undefined","propTypes","PT","node","string","props","name","Error","match","_default","exports","default"],"sources":["../../../../../src/shared/components/ScalableRect/index.tsx"],"sourcesContent":["import PT from 'prop-types';\nimport { type ReactNode } from 'react';\n\nimport './style.scss';\n\ntype PropsT = {\n children?: ReactNode;\n className?: string;\n ratio?: `${number}:${number}`,\n};\n\n/**\n * The `<ScalableRect>` component implements container keeping given aspect\n * ratio, while its width is altered.\n *\n * **Children:** Component children are rendered as the component's content.\n * @param {object} props\n * @param {string} [props.className] CSS class for component container.\n * @param {string} [props.ratio=1:1] Ratio of the rendered rectangle sides,\n * in `W:H` form.\n */\nconst ScalableRect: React.FunctionComponent<PropsT> = ({\n children,\n className,\n ratio,\n}) => {\n const aux = ratio!.split(':');\n const paddingBottom = `${(100 * parseFloat(aux[1])) / parseFloat(aux[0])}%`;\n\n /* NOTE: In case the following code looks strange to you, mind that we want to\n * allow the user to set custom styles on this component. If user passes in a\n * \"className\" prop (possibly \"styleName\", but that one is converted to\n * \"className\" by Babel just before being passed into this component), it\n * should not interfere with the sizing behavior, thus we need an extra <div>\n * level in this component; however, if user does not need a custom styling,\n * we can save one level of HTML code, so we do it. */\n const rect = (\n <div\n style={{ paddingBottom }}\n styleName=\"container\"\n >\n <div styleName=\"wrapper\">\n {children}\n </div>\n </div>\n );\n return className ? (\n <div className={className}>\n {rect}\n </div>\n ) : rect;\n};\n\nScalableRect.defaultProps = {\n children: null,\n className: undefined,\n ratio: '1:1',\n};\n\nScalableRect.propTypes = {\n children: PT.node,\n className: PT.string,\n ratio: (props, name) => {\n const ratio = props[name];\n\n // \"ratio\" prop is not required (defaults \"1:1\").\n if (ratio === undefined) return null;\n\n // If given, \"ratio\" must be a string.\n if (typeof ratio !== 'string') {\n return Error('\"ratio\" prop must be a string');\n }\n\n // If given, \"ratio\" must have \"H:W\" format.\n if (!ratio.match(/\\d\\.\\d+/)) {\n return Error('\"ratio\" prop must have \"H:W\" format');\n }\n\n // Everything looks right.\n return null;\n },\n};\n\nexport default ScalableRect;\n"],"mappings":"gLAAA,IAAAA,UAAA,CAAAC,sBAAA,CAAAC,OAAA,gBACAA,OAAA,UAAuC,IAAAC,WAAA,CAAAD,OAAA,sBAUvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACA,KAAM,CAAAE,YAA6C,CAAGA,CAAC,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S,CAAC,CAAE,CAC3B,MAAO,CAAAD,KAAK,CAAC,yCAAqC,CACpD,CAEA;AACA,MAAO,KACT,CACF,CAAC,CAAC,IAAAE,QAAA,CAAAC,OAAA,CAAAC,OAAA,CAEavB,YAAY"}
|
|
@@ -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
|
|
1
|
+
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _reactThemes=_interopRequireDefault(require("@dr.pogodin/react-themes"));var _jsxRuntime=require("react/jsx-runtime");const defaultTheme={"context":"uIObt7","ad":"XIxe9o","hoc":"YOyORH","bouncing":"TJe-6j","container":"_7zdld4","circle":"dBrB4g"};/**
|
|
2
2
|
* Throbber is an "action in progress" indicator, which renders
|
|
3
3
|
* three bouncing circles as a simple pending activity indicator,
|
|
4
4
|
* and can be further themed to a certain degree.
|
|
@@ -6,5 +6,5 @@
|
|
|
6
6
|
* @param {ThrobberTheme} [props.theme] _Ad hoc_ theme.
|
|
7
7
|
* @param {...any} [props....]
|
|
8
8
|
* [Other theming properties](https://www.npmjs.com/package/@dr.pogodin/react-themes#themed-component-properties)
|
|
9
|
-
*/
|
|
9
|
+
*/const Throbber=({theme})=>/*#__PURE__*/(0,_jsxRuntime.jsxs)("span",{className:(theme.container?theme.container+" ":"")+"_7zdld4",children:[/*#__PURE__*/(0,_jsxRuntime.jsx)("span",{className:(theme.circle?theme.circle+" ":"")+"dBrB4g"}),/*#__PURE__*/(0,_jsxRuntime.jsx)("span",{className:(theme.circle?theme.circle+" ":"")+"dBrB4g"}),/*#__PURE__*/(0,_jsxRuntime.jsx)("span",{className:(theme.circle?theme.circle+" ":"")+"dBrB4g"})]});const ThemedThrobber=(0,_reactThemes.default)(Throbber,"Throbber",["circle","container"],defaultTheme);Throbber.propTypes={theme:ThemedThrobber.themeType.isRequired};var _default=exports.default=ThemedThrobber;
|
|
10
10
|
//# sourceMappingURL=index.js.map
|