@dr.pogodin/react-utils 1.47.5 → 1.48.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/development/index.js +1 -1
- package/build/development/index.js.map +1 -1
- package/build/development/server/server.js +0 -1
- package/build/development/server/server.js.map +1 -1
- package/build/development/shared/components/Button/index.js +13 -9
- package/build/development/shared/components/Button/index.js.map +1 -1
- package/build/development/shared/components/Checkbox/index.js +8 -7
- package/build/development/shared/components/Checkbox/index.js.map +1 -1
- package/build/development/shared/components/Input/index.js +14 -12
- package/build/development/shared/components/Input/index.js.map +1 -1
- package/build/development/shared/components/Modal/index.js +15 -3
- package/build/development/shared/components/Modal/index.js.map +1 -1
- package/build/development/shared/components/PageLayout/index.js +18 -15
- package/build/development/shared/components/PageLayout/index.js.map +1 -1
- package/build/development/shared/components/TextArea/index.js +9 -8
- package/build/development/shared/components/TextArea/index.js.map +1 -1
- package/build/development/shared/components/Throbber/index.js +15 -12
- package/build/development/shared/components/Throbber/index.js.map +1 -1
- package/build/development/shared/components/WithTooltip/index.js +6 -6
- package/build/development/shared/components/WithTooltip/index.js.map +1 -1
- package/build/development/shared/components/YouTubeVideo/index.js +6 -5
- package/build/development/shared/components/YouTubeVideo/index.js.map +1 -1
- package/build/development/shared/components/selectors/CustomDropdown/index.js +13 -12
- package/build/development/shared/components/selectors/CustomDropdown/index.js.map +1 -1
- package/build/development/shared/components/selectors/NativeDropdown/index.js +11 -10
- package/build/development/shared/components/selectors/NativeDropdown/index.js.map +1 -1
- package/build/development/shared/components/selectors/Switch/index.js +9 -9
- package/build/development/shared/components/selectors/Switch/index.js.map +1 -1
- package/build/development/shared/components/selectors/common.js.map +1 -1
- package/build/development/shared/components/selectors/index.js +1 -1
- package/build/development/shared/components/selectors/index.js.map +1 -1
- package/build/development/shared/utils/index.js +2 -5
- package/build/development/shared/utils/index.js.map +1 -1
- package/build/development/shared/utils/jest/E2eSsrEnv.js +0 -1
- package/build/development/shared/utils/jest/E2eSsrEnv.js.map +1 -1
- package/build/production/index.js +1 -1
- package/build/production/index.js.map +1 -1
- package/build/production/server/server.js +1 -1
- package/build/production/server/server.js.map +1 -1
- package/build/production/shared/components/Button/index.js +3 -8
- package/build/production/shared/components/Button/index.js.map +1 -1
- package/build/production/shared/components/Checkbox/index.js +1 -1
- package/build/production/shared/components/Checkbox/index.js.map +1 -1
- package/build/production/shared/components/Input/index.js +6 -6
- package/build/production/shared/components/Input/index.js.map +1 -1
- package/build/production/shared/components/Modal/index.js +3 -2
- package/build/production/shared/components/Modal/index.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/TextArea/index.js +4 -4
- package/build/production/shared/components/TextArea/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/index.js +3 -3
- package/build/production/shared/components/WithTooltip/index.js.map +1 -1
- package/build/production/shared/components/YouTubeVideo/index.js +4 -4
- package/build/production/shared/components/YouTubeVideo/index.js.map +1 -1
- package/build/production/shared/components/selectors/CustomDropdown/index.js +2 -2
- package/build/production/shared/components/selectors/CustomDropdown/index.js.map +1 -1
- package/build/production/shared/components/selectors/NativeDropdown/index.js +3 -3
- package/build/production/shared/components/selectors/NativeDropdown/index.js.map +1 -1
- package/build/production/shared/components/selectors/Switch/index.js +1 -1
- package/build/production/shared/components/selectors/Switch/index.js.map +1 -1
- package/build/production/shared/components/selectors/common.js.map +1 -1
- package/build/production/shared/components/selectors/index.js +1 -1
- package/build/production/shared/components/selectors/index.js.map +1 -1
- package/build/production/shared/utils/index.js +1 -1
- package/build/production/shared/utils/index.js.map +1 -1
- package/build/production/shared/utils/jest/E2eSsrEnv.js +1 -1
- package/build/production/shared/utils/jest/E2eSsrEnv.js.map +1 -1
- package/build/types-code/index.d.ts +1 -1
- package/build/types-code/shared/components/Button/index.d.ts +6 -10
- package/build/types-code/shared/components/Checkbox/index.d.ts +4 -3
- package/build/types-code/shared/components/Input/index.d.ts +12 -4
- package/build/types-code/shared/components/Modal/index.d.ts +6 -3
- package/build/types-code/shared/components/PageLayout/index.d.ts +19 -4
- package/build/types-code/shared/components/TextArea/index.d.ts +4 -4
- package/build/types-code/shared/components/Throbber/index.d.ts +13 -3
- package/build/types-code/shared/components/WithTooltip/index.d.ts +18 -4
- package/build/types-code/shared/components/YouTubeVideo/index.d.ts +20 -4
- package/build/types-code/shared/components/selectors/CustomDropdown/index.d.ts +3 -2
- package/build/types-code/shared/components/selectors/NativeDropdown/index.d.ts +22 -2
- package/build/types-code/shared/components/selectors/Switch/index.d.ts +7 -6
- package/build/types-code/shared/components/selectors/common.d.ts +2 -3
- package/build/types-code/shared/components/selectors/index.d.ts +2 -2
- package/build/types-code/shared/utils/index.d.ts +2 -7
- package/build/web/index.js +1 -1
- package/build/web/index.js.map +1 -1
- package/build/web/server/server.js +0 -1
- package/build/web/server/server.js.map +1 -1
- package/build/web/shared/components/Button/index.js +13 -9
- package/build/web/shared/components/Button/index.js.map +1 -1
- package/build/web/shared/components/Checkbox/index.js +8 -7
- package/build/web/shared/components/Checkbox/index.js.map +1 -1
- package/build/web/shared/components/Input/index.js +14 -12
- package/build/web/shared/components/Input/index.js.map +1 -1
- package/build/web/shared/components/Modal/index.js +15 -3
- package/build/web/shared/components/Modal/index.js.map +1 -1
- package/build/web/shared/components/PageLayout/index.js +18 -15
- package/build/web/shared/components/PageLayout/index.js.map +1 -1
- package/build/web/shared/components/TextArea/index.js +9 -8
- package/build/web/shared/components/TextArea/index.js.map +1 -1
- package/build/web/shared/components/Throbber/index.js +15 -12
- package/build/web/shared/components/Throbber/index.js.map +1 -1
- package/build/web/shared/components/WithTooltip/index.js +6 -6
- package/build/web/shared/components/WithTooltip/index.js.map +1 -1
- package/build/web/shared/components/YouTubeVideo/index.js +6 -5
- package/build/web/shared/components/YouTubeVideo/index.js.map +1 -1
- package/build/web/shared/components/selectors/CustomDropdown/index.js +13 -12
- package/build/web/shared/components/selectors/CustomDropdown/index.js.map +1 -1
- package/build/web/shared/components/selectors/NativeDropdown/index.js +11 -10
- package/build/web/shared/components/selectors/NativeDropdown/index.js.map +1 -1
- package/build/web/shared/components/selectors/Switch/index.js +9 -9
- package/build/web/shared/components/selectors/Switch/index.js.map +1 -1
- package/build/web/shared/components/selectors/common.js.map +1 -1
- package/build/web/shared/components/selectors/index.js +1 -1
- package/build/web/shared/components/selectors/index.js.map +1 -1
- package/build/web/shared/utils/index.js +2 -5
- package/build/web/shared/utils/index.js.map +1 -1
- package/build/web/shared/utils/jest/E2eSsrEnv.js +0 -1
- package/build/web/shared/utils/jest/E2eSsrEnv.js.map +1 -1
- package/config/babel/webpack.js +1 -1
- package/package.json +15 -15
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["
|
|
1
|
+
{"version":3,"file":"index.js","names":["useTheme","Link","defaultTheme","jsx","_jsx","BaseButton","active","children","disabled","enforceA","onClick","onKeyDown","onKeyDownProp","onKeyUp","onMouseDown","onMouseUp","onPointerDown","onPointerUp","openNewTab","replace","testId","theme","to","className","button","process","env","NODE_ENV","undefined","e","key","role","tabIndex","Button","rest","composed"],"sources":["../../../../../src/shared/components/Button/index.tsx"],"sourcesContent":["// The <Button> component implements a standard button / button-like link.\n\nimport type {\n FunctionComponent,\n KeyboardEventHandler,\n MouseEventHandler,\n PointerEventHandler,\n ReactNode,\n} from 'react';\n\nimport { type Theme, useTheme } from '@dr.pogodin/react-themes';\n\nimport Link from 'components/Link';\n\nimport defaultTheme from './style.scss';\n\ntype ThemeT = Theme<'active' | 'button' | 'disabled'>;\n\ntype PropsT = {\n active?: boolean;\n children?: ReactNode;\n disabled?: boolean;\n enforceA?: boolean;\n onClick?: MouseEventHandler & KeyboardEventHandler;\n onKeyDown?: KeyboardEventHandler;\n onKeyUp?: KeyboardEventHandler;\n onMouseDown?: MouseEventHandler;\n onMouseUp?: MouseEventHandler;\n onPointerDown?: PointerEventHandler;\n onPointerUp?: PointerEventHandler;\n openNewTab?: boolean;\n replace?: boolean;\n testId?: string;\n theme: ThemeT;\n\n // TODO: It needs a more precise typing of the object option.\n to?: object | string;\n};\n\nexport const BaseButton: FunctionComponent<PropsT> = ({\n active,\n children,\n disabled,\n enforceA,\n onClick,\n onKeyDown: onKeyDownProp,\n onKeyUp,\n onMouseDown,\n onMouseUp,\n onPointerDown,\n onPointerUp,\n openNewTab,\n replace,\n testId,\n theme,\n to,\n}) => {\n let className = theme.button;\n if (active && theme.active) className += ` ${theme.active}`;\n if (disabled) {\n if (theme.disabled) className += ` ${theme.disabled}`;\n return (\n <div\n className={className}\n data-testid={process.env.NODE_ENV === 'production' ? undefined : testId}\n >\n {children}\n </div>\n );\n }\n\n let onKeyDown = onKeyDownProp;\n if (!onKeyDown && onClick) {\n onKeyDown = (e) => {\n if (e.key === 'Enter') onClick(e);\n };\n }\n\n if (to) {\n return (\n <Link\n className={className}\n data-testid={process.env.NODE_ENV === 'production' ? undefined : testId}\n enforceA={enforceA}\n onClick={onClick}\n\n // TODO: For now, the `onKeyDown` handler is not passed to the <Link>,\n // as <Link> component does not call it anyway, presumably due to\n // the inner implementation details. We should look into supporting it:\n // https://github.com/birdofpreyru/react-utils/issues/444\n // onKeyDown={onKeyDown}\n\n onKeyUp={onKeyUp}\n onMouseDown={onMouseDown}\n onMouseUp={onMouseUp}\n onPointerDown={onPointerDown}\n onPointerUp={onPointerUp}\n openNewTab={openNewTab}\n replace={replace}\n to={to}\n >\n {children}\n </Link>\n );\n }\n\n return (\n <div\n className={className}\n data-testid={process.env.NODE_ENV === 'production' ? undefined : testId}\n onClick={onClick}\n onKeyDown={onKeyDown}\n onKeyUp={onKeyUp}\n onMouseDown={onMouseDown}\n onMouseUp={onMouseUp}\n onPointerDown={onPointerDown}\n onPointerUp={onPointerUp}\n role=\"button\"\n tabIndex={0}\n >\n {children}\n </div>\n );\n};\n\nconst Button: FunctionComponent<\n Omit<PropsT, 'theme'> & { theme?: ThemeT }\n> = ({ theme, ...rest }) => {\n const composed = useTheme('Button', defaultTheme, theme);\n\n // eslint-disable-next-line react/jsx-props-no-spreading\n return <BaseButton {...rest} theme={composed} />;\n};\n\nexport default Button;\n"],"mappings":"AAAA;;AAUA,SAAqBA,QAAQ,QAAQ,0BAA0B;AAE/D,OAAOC,IAAI;AAEX,OAAOC,YAAY;AAAqB,SAAAC,GAAA,IAAAC,IAAA;AAyBxC,OAAO,MAAMC,UAAqC,GAAGA,CAAC;EACpDC,MAAM;EACNC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,OAAO;EACPC,SAAS,EAAEC,aAAa;EACxBC,OAAO;EACPC,WAAW;EACXC,SAAS;EACTC,aAAa;EACbC,WAAW;EACXC,UAAU;EACVC,OAAO;EACPC,MAAM;EACNC,KAAK;EACLC;AACF,CAAC,KAAK;EACJ,IAAIC,SAAS,GAAGF,KAAK,CAACG,MAAM;EAC5B,IAAIlB,MAAM,IAAIe,KAAK,CAACf,MAAM,EAAEiB,SAAS,IAAI,IAAIF,KAAK,CAACf,MAAM,EAAE;EAC3D,IAAIE,QAAQ,EAAE;IACZ,IAAIa,KAAK,CAACb,QAAQ,EAAEe,SAAS,IAAI,IAAIF,KAAK,CAACb,QAAQ,EAAE;IACrD,oBACEJ,IAAA;MACEmB,SAAS,EAAEA,SAAU;MACrB,eAAaE,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,GAAGC,SAAS,GAAGR,MAAO;MAAAb,QAAA,EAEvEA;IAAQ,CACN,CAAC;EAEV;EAEA,IAAII,SAAS,GAAGC,aAAa;EAC7B,IAAI,CAACD,SAAS,IAAID,OAAO,EAAE;IACzBC,SAAS,GAAIkB,CAAC,IAAK;MACjB,IAAIA,CAAC,CAACC,GAAG,KAAK,OAAO,EAAEpB,OAAO,CAACmB,CAAC,CAAC;IACnC,CAAC;EACH;EAEA,IAAIP,EAAE,EAAE;IACN,oBACElB,IAAA,CAAC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+
import { useTheme } from '@dr.pogodin/react-themes';
|
|
2
2
|
import defaultTheme from "./theme.scss";
|
|
3
3
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
4
4
|
const Checkbox = ({
|
|
@@ -9,14 +9,15 @@ const Checkbox = ({
|
|
|
9
9
|
testId,
|
|
10
10
|
theme
|
|
11
11
|
}) => {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
const composed = useTheme('Checkbox', defaultTheme, theme);
|
|
13
|
+
let containerClassName = composed.container;
|
|
14
|
+
if (disabled) containerClassName += ` ${composed.disabled}`;
|
|
15
|
+
let checkboxClassName = composed.checkbox;
|
|
16
|
+
if (checked === 'indeterminate') checkboxClassName += ` ${composed.indeterminate}`;
|
|
16
17
|
return /*#__PURE__*/_jsxs("div", {
|
|
17
18
|
className: containerClassName,
|
|
18
19
|
children: [label === undefined ? null : /*#__PURE__*/_jsx("div", {
|
|
19
|
-
className:
|
|
20
|
+
className: composed.label,
|
|
20
21
|
children: label
|
|
21
22
|
}), /*#__PURE__*/_jsx("input", {
|
|
22
23
|
checked: checked === undefined ? undefined : checked === true,
|
|
@@ -31,5 +32,5 @@ const Checkbox = ({
|
|
|
31
32
|
})]
|
|
32
33
|
});
|
|
33
34
|
};
|
|
34
|
-
export default
|
|
35
|
+
export default Checkbox;
|
|
35
36
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["
|
|
1
|
+
{"version":3,"file":"index.js","names":["useTheme","defaultTheme","jsx","_jsx","jsxs","_jsxs","Checkbox","checked","disabled","label","onChange","testId","theme","composed","containerClassName","container","checkboxClassName","checkbox","indeterminate","className","children","undefined","process","env","NODE_ENV","onClick","e","stopPropagation","type"],"sources":["../../../../../src/shared/components/Checkbox/index.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\n\nimport { type Theme, useTheme } from '@dr.pogodin/react-themes';\n\nimport defaultTheme from './theme.scss';\n\ntype PropT<ValueT> = {\n checked?: ValueT;\n disabled?: boolean;\n label?: React.ReactNode;\n onChange?: React.ChangeEventHandler<HTMLInputElement>;\n testId?: string;\n theme?: Theme<\n | 'checkbox'\n | 'container'\n | 'disabled'\n | 'indeterminate'\n | 'label'\n >;\n};\n\nconst Checkbox = <ValueT extends boolean | 'indeterminate' = boolean>({\n checked,\n disabled,\n label,\n onChange,\n testId,\n theme,\n}: PropT<ValueT>): ReactNode => {\n const composed = useTheme('Checkbox', defaultTheme, theme);\n\n let containerClassName = composed.container;\n if (disabled) containerClassName += ` ${composed.disabled}`;\n\n let checkboxClassName = composed.checkbox;\n if (checked === 'indeterminate') checkboxClassName += ` ${composed.indeterminate}`;\n\n return (\n <div className={containerClassName}>\n { label === undefined\n ? null : <div className={composed.label}>{label}</div> }\n <input\n checked={checked === undefined ? undefined : checked === true}\n className={checkboxClassName}\n data-testid={process.env.NODE_ENV === 'production' ? undefined : testId}\n disabled={disabled}\n onChange={onChange}\n onClick={(e) => {\n e.stopPropagation();\n }}\n type=\"checkbox\"\n />\n </div>\n );\n};\n\nexport default Checkbox;\n"],"mappings":"AAEA,SAAqBA,QAAQ,QAAQ,0BAA0B;AAE/D,OAAOC,YAAY;AAAqB,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAiBxC,MAAMC,QAAQ,GAAGA,CAAqD;EACpEC,OAAO;EACPC,QAAQ;EACRC,KAAK;EACLC,QAAQ;EACRC,MAAM;EACNC;AACa,CAAC,KAAgB;EAC9B,MAAMC,QAAQ,GAAGb,QAAQ,CAAC,UAAU,EAAEC,YAAY,EAAEW,KAAK,CAAC;EAE1D,IAAIE,kBAAkB,GAAGD,QAAQ,CAACE,SAAS;EAC3C,IAAIP,QAAQ,EAAEM,kBAAkB,IAAI,IAAID,QAAQ,CAACL,QAAQ,EAAE;EAE3D,IAAIQ,iBAAiB,GAAGH,QAAQ,CAACI,QAAQ;EACzC,IAAIV,OAAO,KAAK,eAAe,EAAES,iBAAiB,IAAI,IAAIH,QAAQ,CAACK,aAAa,EAAE;EAElF,oBACEb,KAAA;IAAKc,SAAS,EAAEL,kBAAmB;IAAAM,QAAA,GAC/BX,KAAK,KAAKY,SAAS,GACjB,IAAI,gBAAGlB,IAAA;MAAKgB,SAAS,EAAEN,QAAQ,CAACJ,KAAM;MAAAW,QAAA,EAAEX;IAAK,CAAM,CAAC,eACxDN,IAAA;MACEI,OAAO,EAAEA,OAAO,KAAKc,SAAS,GAAGA,SAAS,GAAGd,OAAO,KAAK,IAAK;MAC9DY,SAAS,EAAEH,iBAAkB;MAC7B,eAAaM,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,GAAGH,SAAS,GAAGV,MAAO;MACxEH,QAAQ,EAAEA,QAAS;MACnBE,QAAQ,EAAEA,QAAS;MACnBe,OAAO,EAAGC,CAAC,IAAK;QACdA,CAAC,CAACC,eAAe,CAAC,CAAC;MACrB,CAAE;MACFC,IAAI,EAAC;IAAU,CAChB,CAAC;EAAA,CACC,CAAC;AAEV,CAAC;AAED,eAAetB,QAAQ","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useRef, useState } from 'react';
|
|
2
|
-
import
|
|
2
|
+
import { useTheme } from '@dr.pogodin/react-themes';
|
|
3
3
|
import defaultTheme from "./theme.scss";
|
|
4
4
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
5
5
|
/**
|
|
@@ -19,17 +19,19 @@ const Input = ({
|
|
|
19
19
|
theme,
|
|
20
20
|
...rest
|
|
21
21
|
}) => {
|
|
22
|
+
const composed = useTheme('Input', defaultTheme, theme);
|
|
23
|
+
|
|
22
24
|
// NOTE: As of now, it is only updated when "theme.focused" is defined,
|
|
23
25
|
// as otherwise its value is not used.
|
|
24
26
|
const [focused, setFocused] = useState(false);
|
|
25
27
|
const localRef = useRef(null);
|
|
26
|
-
let containerClassName =
|
|
28
|
+
let containerClassName = composed.container;
|
|
27
29
|
|
|
28
30
|
// NOTE: As of now, "focused" can be true only when "theme.focused"
|
|
29
31
|
// is provided.
|
|
30
|
-
if (focused /* && theme.focused */) containerClassName += ` ${
|
|
31
|
-
if (!rest.value &&
|
|
32
|
-
if (error) containerClassName += ` ${
|
|
32
|
+
if (focused /* && theme.focused */) containerClassName += ` ${composed.focused}`;
|
|
33
|
+
if (!rest.value && composed.empty) containerClassName += ` ${composed.empty}`;
|
|
34
|
+
if (error) containerClassName += ` ${composed.error}`;
|
|
33
35
|
return /*#__PURE__*/_jsxs("div", {
|
|
34
36
|
className: containerClassName,
|
|
35
37
|
onFocus: () => {
|
|
@@ -39,10 +41,10 @@ const Input = ({
|
|
|
39
41
|
if (typeof ref === 'object') ref?.current?.focus();else localRef.current?.focus();
|
|
40
42
|
},
|
|
41
43
|
children: [label === undefined ? null : /*#__PURE__*/_jsx("div", {
|
|
42
|
-
className:
|
|
44
|
+
className: composed.label,
|
|
43
45
|
children: label
|
|
44
46
|
}), /*#__PURE__*/_jsx("input", {
|
|
45
|
-
className:
|
|
47
|
+
className: composed.input,
|
|
46
48
|
"data-testid": process.env.NODE_ENV === 'production' ? undefined : testId,
|
|
47
49
|
ref: ref ?? localRef
|
|
48
50
|
|
|
@@ -50,22 +52,22 @@ const Input = ({
|
|
|
50
52
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
51
53
|
,
|
|
52
54
|
...rest,
|
|
53
|
-
onBlur:
|
|
55
|
+
onBlur: composed.focused ? e => {
|
|
54
56
|
setFocused(false);
|
|
55
57
|
rest.onBlur?.(e);
|
|
56
58
|
} : rest.onBlur,
|
|
57
|
-
onFocus:
|
|
59
|
+
onFocus: composed.focused ? e => {
|
|
58
60
|
setFocused(true);
|
|
59
61
|
rest.onFocus?.(e);
|
|
60
62
|
} : rest.onFocus
|
|
61
63
|
}), error && error !== true ? /*#__PURE__*/_jsx("div", {
|
|
62
|
-
className:
|
|
64
|
+
className: composed.errorMessage,
|
|
63
65
|
children: error
|
|
64
66
|
}) : null, children ? /*#__PURE__*/_jsx("div", {
|
|
65
|
-
className:
|
|
67
|
+
className: composed.children,
|
|
66
68
|
children: children
|
|
67
69
|
}) : null]
|
|
68
70
|
});
|
|
69
71
|
};
|
|
70
|
-
export default
|
|
72
|
+
export default Input;
|
|
71
73
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["useRef","useState","
|
|
1
|
+
{"version":3,"file":"index.js","names":["useRef","useState","useTheme","defaultTheme","jsx","_jsx","jsxs","_jsxs","Input","children","error","label","ref","testId","theme","rest","composed","focused","setFocused","localRef","containerClassName","container","value","empty","className","onFocus","current","focus","undefined","input","process","env","NODE_ENV","onBlur","e","errorMessage"],"sources":["../../../../../src/shared/components/Input/index.tsx"],"sourcesContent":["import {\n type FunctionComponent,\n type ReactNode,\n type Ref,\n useRef,\n useState,\n} from 'react';\n\nimport { type Theme, useTheme } from '@dr.pogodin/react-themes';\n\nimport defaultTheme from './theme.scss';\n\ntype ThemeKeyT = 'children' | 'container' | 'empty' | 'error' | 'errorMessage'\n | 'focused' | 'input' | 'label';\n\ntype PropsT = React.InputHTMLAttributes<HTMLInputElement> & {\n children?: ReactNode;\n error?: ReactNode;\n label?: React.ReactNode;\n ref?: Ref<HTMLInputElement>;\n testId?: string;\n theme?: Theme<ThemeKeyT>;\n};\n\n/**\n * Themeable input field, based on the standard HTML `<input>` element.\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: FunctionComponent<PropsT> = ({\n children,\n error,\n label,\n ref,\n testId,\n theme,\n ...rest\n}) => {\n const composed = useTheme('Input', defaultTheme, theme);\n\n // NOTE: As of now, it is only updated when \"theme.focused\" is defined,\n // as otherwise its value is not used.\n const [focused, setFocused] = useState(false);\n\n const localRef = useRef<HTMLInputElement>(null);\n\n let containerClassName = composed.container;\n\n // NOTE: As of now, \"focused\" can be true only when \"theme.focused\"\n // is provided.\n if (focused /* && theme.focused */) containerClassName += ` ${composed.focused}`;\n\n if (!rest.value && composed.empty) containerClassName += ` ${composed.empty}`;\n\n if (error) containerClassName += ` ${composed.error}`;\n\n return (\n <div\n className={containerClassName}\n onFocus={() => {\n // TODO: It does not really work if a callback-style `ref` is passed in,\n // we need a more complex logic to cover that case, but for now this serves\n // the case we need it for.\n if (typeof ref === 'object') ref?.current?.focus();\n else localRef.current?.focus();\n }}\n >\n {label === undefined\n ? null : <div className={composed.label}>{label}</div>}\n <input\n className={composed.input}\n data-testid={process.env.NODE_ENV === 'production' ? undefined : testId}\n ref={ref ?? localRef}\n\n // TODO: Avoid the spreading later.\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...rest}\n\n onBlur={composed.focused ? (e) => {\n setFocused(false);\n rest.onBlur?.(e);\n } : rest.onBlur}\n onFocus={composed.focused ? (e) => {\n setFocused(true);\n rest.onFocus?.(e);\n } : rest.onFocus}\n />\n {error && error !== true\n ? <div className={composed.errorMessage}>{error}</div>\n : null}\n {children ? <div className={composed.children}>{children}</div> : null}\n </div>\n );\n};\n\nexport default Input;\n"],"mappings":"AAAA,SAIEA,MAAM,EACNC,QAAQ,QACH,OAAO;AAEd,SAAqBC,QAAQ,QAAQ,0BAA0B;AAE/D,OAAOC,YAAY;AAAqB,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAcxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,KAAgC,GAAGA,CAAC;EACxCC,QAAQ;EACRC,KAAK;EACLC,KAAK;EACLC,GAAG;EACHC,MAAM;EACNC,KAAK;EACL,GAAGC;AACL,CAAC,KAAK;EACJ,MAAMC,QAAQ,GAAGd,QAAQ,CAAC,OAAO,EAAEC,YAAY,EAAEW,KAAK,CAAC;;EAEvD;EACA;EACA,MAAM,CAACG,OAA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,CAACkB,MAAO;MAChBR,OAAO,EAAET,QAAQ,CAACC,OAAO,GAAIiB,CAAC,IAAK;QACjChB,UAAU,CAAC,IAAI,CAAC;QAChBH,IAAI,CAACU,OAAO,GAAGS,CAAC,CAAC;MACnB,CAAC,GAAGnB,IAAI,CAACU;IAAQ,CAClB,CAAC,EACDf,KAAK,IAAIA,KAAK,KAAK,IAAI,gBACpBL,IAAA;MAAKmB,SAAS,EAAER,QAAQ,CAACmB,YAAa;MAAA1B,QAAA,EAAEC;IAAK,CAAM,CAAC,GACpD,IAAI,EACPD,QAAQ,gBAAGJ,IAAA;MAAKmB,SAAS,EAAER,QAAQ,CAACP,QAAS;MAAAA,QAAA,EAAEA;IAAQ,CAAM,CAAC,GAAG,IAAI;EAAA,CACnE,CAAC;AAEV,CAAC;AAED,eAAeD,KAAK","ignoreList":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useEffect, useMemo, useRef } from 'react';
|
|
2
2
|
import { createPortal } from 'react-dom';
|
|
3
|
-
import
|
|
4
|
-
import
|
|
3
|
+
import { useTheme } from '@dr.pogodin/react-themes';
|
|
4
|
+
import defaultTheme from "./base-theme.scss";
|
|
5
5
|
import S from "./styles.scss";
|
|
6
6
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
7
|
/**
|
|
@@ -121,8 +121,20 @@ const BaseModal = ({
|
|
|
121
121
|
}), focusLast]
|
|
122
122
|
}), document.body);
|
|
123
123
|
};
|
|
124
|
-
export default /* #__PURE__ */themed(BaseModal, 'Modal', baseTheme);
|
|
125
124
|
|
|
126
125
|
/* Non-themed version of the Modal. */
|
|
127
126
|
export { BaseModal };
|
|
127
|
+
const Modal = ({
|
|
128
|
+
theme,
|
|
129
|
+
...rest
|
|
130
|
+
}) => {
|
|
131
|
+
const composed = useTheme('Modal', defaultTheme, theme);
|
|
132
|
+
|
|
133
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
134
|
+
return /*#__PURE__*/_jsx(BaseModal, {
|
|
135
|
+
...rest,
|
|
136
|
+
theme: composed
|
|
137
|
+
});
|
|
138
|
+
};
|
|
139
|
+
export default Modal;
|
|
128
140
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["useEffect","useMemo","useRef","createPortal","themed","baseTheme","S","jsx","_jsx","jsxs","_jsxs","BaseModal","cancelOnScrolling","children","containerStyle","dontDisableScrolling","onCancel","overlayStyle","style","testId","testIdForOverlay","theme","containerRef","overlayRef","window","addEventListener","removeEventListener","document","body","classList","add","scrollingDisabledByModal","remove","focusLast","onFocus","elems","current","querySelectorAll","i","length","focus","activeElement","tabIndex","className","overlay","process","env","NODE_ENV","undefined","onClick","e","stopPropagation","onKeyDown","key","ref","node","role","container","onWheel","event"],"sources":["../../../../../src/shared/components/Modal/index.tsx"],"sourcesContent":["import {\n type CSSProperties,\n type FunctionComponent,\n type ReactNode,\n useEffect,\n useMemo,\n useRef,\n} from 'react';\n\nimport { createPortal } from 'react-dom';\nimport themed, { type Theme } from '@dr.pogodin/react-themes';\n\nimport baseTheme from './base-theme.scss';\nimport S from './styles.scss';\n\ntype PropsT = {\n cancelOnScrolling?: boolean;\n children?: ReactNode;\n dontDisableScrolling?: boolean;\n onCancel?: () => void;\n overlayStyle?: CSSProperties;\n style?: CSSProperties;\n testId?: string;\n testIdForOverlay?: string;\n theme: Theme<'container' | 'overlay'>;\n\n /** @deprecated */\n containerStyle?: CSSProperties;\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: FunctionComponent<PropsT> = ({\n cancelOnScrolling,\n children,\n containerStyle,\n dontDisableScrolling,\n onCancel,\n overlayStyle,\n style,\n testId,\n testIdForOverlay,\n theme,\n}) => {\n const containerRef = useRef<HTMLDivElement | null>(null);\n const overlayRef = useRef<HTMLDivElement | null>(null);\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('*');\n for (let i = elems.length - 1; i >= 0; --i) {\n (elems[i] as HTMLElement).focus();\n if (document.activeElement === elems[i]) return;\n }\n overlayRef.current?.focus();\n }}\n // TODO: Have a look at this later.\n // eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex\n tabIndex={0}\n />\n ), []);\n\n return createPortal(\n (\n <div>\n {focusLast}\n <div\n aria-label=\"Cancel\"\n className={theme.overlay}\n data-testid={\n process.env.NODE_ENV === 'production'\n ? undefined : testIdForOverlay\n }\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 style={overlayStyle}\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 }\n <div // eslint-disable-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions\n aria-modal=\"true\"\n className={theme.container}\n data-testid={process.env.NODE_ENV === 'production' ? undefined : testId}\n onClick={(e) => {\n e.stopPropagation();\n }}\n onWheel={(event) => {\n event.stopPropagation();\n }}\n ref={containerRef}\n role=\"dialog\"\n style={style ?? containerStyle}\n >\n {children}\n </div>\n <div\n onFocus={() => {\n overlayRef.current?.focus();\n }}\n // TODO: Have a look at this later.\n // eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex\n tabIndex={0}\n />\n {focusLast}\n </div>\n ),\n document.body,\n );\n};\n\nexport default /* #__PURE__ */ themed(BaseModal, 'Modal', baseTheme);\n\n/* Non-themed version of the Modal. */\nexport { BaseModal };\n"],"mappings":"AAAA,SAIEA,SAAS,EACTC,OAAO,EACPC,MAAM,QACD,OAAO;AAEd,SAASC,YAAY,QAAQ,WAAW;AACxC,OAAOC,MAAM,MAAsB,0BAA0B;AAE7D,OAAOC,SAAS;AAChB,OAAOC,CAAC;AAAsB,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAiB9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,SAAoC,GAAGA,CAAC;EAC5CC,iBAAiB;EACjBC,QAAQ;EACRC,cAAc;EACdC,oBAAoB;EACpBC,QAAQ;EACRC,YAAY;EACZC,KAAK;EACLC,MAAM;EACNC,gBAAgB;EAChBC;AACF,CAAC,KAAK;EACJ,MAAMC,YAAY,GAAGpB,MAAM,CAAwB,IAAI,CAAC;EACxD,MAAMqB,UAAU,GAAGrB,MA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IAAK;QAClBA,KAAK,CAACR,eAAe,CAAC,CAAC;MACzB,CAAE;MACFG,GAAG,EAAEhC,YAAa;MAClBkC,IAAI,EAAC,QAAQ;MACbtC,KAAK,EAAEA,KAAK,IAAIJ,cAAe;MAAAD,QAAA,EAE9BA;IAAQ,CACN,CAAC,eACNL,IAAA;MACE0B,OAAO,EAAEA,CAAA,KAAM;QACbX,UAAU,CAACa,OAAO,EAAEI,KAAK,CAAC,CAAC;MAC7B;MACA;MACA;MAAA;MACAE,QAAQ,EAAE;IAAE,CACb,CAAC,EACDT,SAAS;EAAA,CACP,CAAC,EAERN,QAAQ,CAACC,IACX,CAAC;AACH,CAAC;AAED,eAAe,eAAgBxB,MAAM,CAACO,SAAS,EAAE,OAAO,EAAEN,SAAS,CAAC;;AAEpE;AACA,SAASM,SAAS","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":["useEffect","useMemo","useRef","createPortal","useTheme","defaultTheme","S","jsx","_jsx","jsxs","_jsxs","BaseModal","cancelOnScrolling","children","containerStyle","dontDisableScrolling","onCancel","overlayStyle","style","testId","testIdForOverlay","theme","containerRef","overlayRef","window","addEventListener","removeEventListener","document","body","classList","add","scrollingDisabledByModal","remove","focusLast","onFocus","elems","current","querySelectorAll","i","length","focus","activeElement","tabIndex","className","overlay","process","env","NODE_ENV","undefined","onClick","e","stopPropagation","onKeyDown","key","ref","node","role","container","onWheel","event","Modal","rest","composed"],"sources":["../../../../../src/shared/components/Modal/index.tsx"],"sourcesContent":["import {\n type CSSProperties,\n type FunctionComponent,\n type ReactNode,\n useEffect,\n useMemo,\n useRef,\n} from 'react';\n\nimport { createPortal } from 'react-dom';\nimport { type Theme, useTheme } from '@dr.pogodin/react-themes';\n\nimport defaultTheme from './base-theme.scss';\nimport S from './styles.scss';\n\ntype ThemeT = Theme<'container' | 'overlay'>;\n\ntype PropsT = {\n cancelOnScrolling?: boolean;\n children?: ReactNode;\n dontDisableScrolling?: boolean;\n onCancel?: () => void;\n overlayStyle?: CSSProperties;\n style?: CSSProperties;\n testId?: string;\n testIdForOverlay?: string;\n theme: ThemeT;\n\n /** @deprecated */\n containerStyle?: CSSProperties;\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: FunctionComponent<PropsT> = ({\n cancelOnScrolling,\n children,\n containerStyle,\n dontDisableScrolling,\n onCancel,\n overlayStyle,\n style,\n testId,\n testIdForOverlay,\n theme,\n}) => {\n const containerRef = useRef<HTMLDivElement | null>(null);\n const overlayRef = useRef<HTMLDivElement | null>(null);\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('*');\n for (let i = elems.length - 1; i >= 0; --i) {\n (elems[i] as HTMLElement).focus();\n if (document.activeElement === elems[i]) return;\n }\n overlayRef.current?.focus();\n }}\n // TODO: Have a look at this later.\n // eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex\n tabIndex={0}\n />\n ), []);\n\n return createPortal(\n (\n <div>\n {focusLast}\n <div\n aria-label=\"Cancel\"\n className={theme.overlay}\n data-testid={\n process.env.NODE_ENV === 'production'\n ? undefined : testIdForOverlay\n }\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 style={overlayStyle}\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 }\n <div // eslint-disable-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions\n aria-modal=\"true\"\n className={theme.container}\n data-testid={process.env.NODE_ENV === 'production' ? undefined : testId}\n onClick={(e) => {\n e.stopPropagation();\n }}\n onWheel={(event) => {\n event.stopPropagation();\n }}\n ref={containerRef}\n role=\"dialog\"\n style={style ?? containerStyle}\n >\n {children}\n </div>\n <div\n onFocus={() => {\n overlayRef.current?.focus();\n }}\n // TODO: Have a look at this later.\n // eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex\n tabIndex={0}\n />\n {focusLast}\n </div>\n ),\n document.body,\n );\n};\n\n/* Non-themed version of the Modal. */\nexport { BaseModal };\n\nconst Modal: FunctionComponent<\n Omit<PropsT, 'theme'> & { theme?: ThemeT }\n> = ({ theme, ...rest }) => {\n const composed = useTheme('Modal', defaultTheme, theme);\n\n // eslint-disable-next-line react/jsx-props-no-spreading\n return <BaseModal {...rest} theme={composed} />;\n};\n\nexport default Modal;\n"],"mapp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S,CAAE,CAAC;AACjD,CAAC;AAED,eAAeF,KAAK","ignoreList":[]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { useTheme } from '@dr.pogodin/react-themes';
|
|
2
2
|
import baseTheme from "./base-theme.scss";
|
|
3
3
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
4
4
|
/**
|
|
@@ -21,18 +21,21 @@ const PageLayout = ({
|
|
|
21
21
|
leftSidePanelContent,
|
|
22
22
|
rightSidePanelContent,
|
|
23
23
|
theme
|
|
24
|
-
}) =>
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
className:
|
|
28
|
-
children:
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
24
|
+
}) => {
|
|
25
|
+
const composed = useTheme('PageLayout', baseTheme, theme);
|
|
26
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
27
|
+
className: composed.container,
|
|
28
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
29
|
+
className: [composed.sidePanel, composed.leftSidePanel].join(' '),
|
|
30
|
+
children: leftSidePanelContent
|
|
31
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
32
|
+
className: composed.mainPanel,
|
|
33
|
+
children: children
|
|
34
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
35
|
+
className: [composed.sidePanel, composed.rightSidePanel].join(' '),
|
|
36
|
+
children: rightSidePanelContent
|
|
37
|
+
})]
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
export default PageLayout;
|
|
38
41
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["
|
|
1
|
+
{"version":3,"file":"index.js","names":["useTheme","baseTheme","jsx","_jsx","jsxs","_jsxs","PageLayout","children","leftSidePanelContent","rightSidePanelContent","theme","composed","className","container","sidePanel","leftSidePanel","join","mainPanel","rightSidePanel"],"sources":["../../../../../src/shared/components/PageLayout/index.tsx"],"sourcesContent":["import type { FunctionComponent, ReactNode } from 'react';\n\nimport { type Theme, useTheme } from '@dr.pogodin/react-themes';\n\nimport baseTheme from './base-theme.scss';\n\ntype ThemeKeyT = 'container' | 'leftSidePanel' | 'mainPanel' | 'rightSidePanel'\n | 'sidePanel';\n\ntype PropsT = {\n children?: ReactNode;\n leftSidePanelContent?: ReactNode;\n rightSidePanelContent?: ReactNode;\n theme?: Theme<ThemeKeyT>;\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: FunctionComponent<PropsT> = ({\n children,\n leftSidePanelContent,\n rightSidePanelContent,\n theme,\n}) => {\n const composed = useTheme('PageLayout', baseTheme, theme);\n return (\n <div className={composed.container}>\n <div className={[composed.sidePanel, composed.leftSidePanel].join(' ')}>\n {leftSidePanelContent}\n </div>\n <div className={composed.mainPanel}>\n {children}\n </div>\n <div className={[composed.sidePanel, composed.rightSidePanel].join(' ')}>\n {rightSidePanelContent}\n </div>\n </div>\n );\n};\n\nexport default PageLayout;\n"],"mappings":"AAEA,SAAqBA,QAAQ,QAAQ,0BAA0B;AAE/D,OAAOC,SAAS;AAA0B,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAY1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,UAAqC,GAAGA,CAAC;EAC7CC,QAAQ;EACRC,oBAAoB;EACpBC,qBAAqB;EACrBC;AACF,CAAC,KAAK;EACJ,MAAMC,QAAQ,GAAGX,QAAQ,CAAC,YAAY,EAAEC,SAAS,EAAES,KAAK,CAAC;EACzD,oBACEL,KAAA;IAAKO,SAAS,EAAED,QAAQ,CAACE,SAAU;IAAAN,QAAA,gBACjCJ,IAAA;MAAKS,SAAS,EAAE,CAACD,QAAQ,CAACG,SAAS,EAAEH,QAAQ,CAACI,aAAa,CAAC,CAACC,IAAI,CAAC,GAAG,CAAE;MAAAT,QAAA,EACpEC;IAAoB,CAClB,CAAC,eACNL,IAAA;MAAKS,SAAS,EAAED,QAAQ,CAACM,SAAU;MAAAV,QAAA,EAChCA;IAAQ,CACN,CAAC,eACNJ,IAAA;MAAKS,SAAS,EAAE,CAACD,QAAQ,CAACG,SAAS,EAAEH,QAAQ,CAACO,cAAc,CAAC,CAACF,IAAI,CAAC,GAAG,CAAE;MAAAT,QAAA,EACrEE;IAAqB,CACnB,CAAC;EAAA,CACH,CAAC;AAEV,CAAC;AAED,eAAeH,UAAU","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useEffect, useLayoutEffect, useRef, useState } from 'react';
|
|
2
|
-
import
|
|
2
|
+
import { useTheme } from '@dr.pogodin/react-themes';
|
|
3
3
|
import defaultTheme from "./style.scss";
|
|
4
4
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
5
5
|
const TextArea = ({
|
|
@@ -14,6 +14,7 @@ const TextArea = ({
|
|
|
14
14
|
theme,
|
|
15
15
|
value
|
|
16
16
|
}) => {
|
|
17
|
+
const custom = useTheme('TextArea', defaultTheme, theme);
|
|
17
18
|
const hiddenAreaRef = useRef(null);
|
|
18
19
|
const [height, setHeight] = useState();
|
|
19
20
|
const textAreaRef = useRef(null);
|
|
@@ -45,18 +46,18 @@ const TextArea = ({
|
|
|
45
46
|
const el = hiddenAreaRef.current;
|
|
46
47
|
if (el) setHeight(el.scrollHeight);
|
|
47
48
|
}, [localValue]);
|
|
48
|
-
let containerClassName =
|
|
49
|
-
if (error) containerClassName += ` ${
|
|
49
|
+
let containerClassName = custom.container;
|
|
50
|
+
if (error) containerClassName += ` ${custom.error}`;
|
|
50
51
|
return /*#__PURE__*/_jsxs("div", {
|
|
51
52
|
className: containerClassName,
|
|
52
53
|
onFocus: () => {
|
|
53
54
|
textAreaRef.current?.focus();
|
|
54
55
|
},
|
|
55
56
|
children: [label === undefined ? null : /*#__PURE__*/_jsx("div", {
|
|
56
|
-
className:
|
|
57
|
+
className: custom.label,
|
|
57
58
|
children: label
|
|
58
59
|
}), /*#__PURE__*/_jsx("textarea", {
|
|
59
|
-
className: `${
|
|
60
|
+
className: `${custom.textarea} ${custom.hidden}`
|
|
60
61
|
|
|
61
62
|
// This text area is hidden underneath the primary one below,
|
|
62
63
|
// and it is used for text measurements, to implement auto-scaling
|
|
@@ -77,7 +78,7 @@ const TextArea = ({
|
|
|
77
78
|
,
|
|
78
79
|
value: localValue || ' '
|
|
79
80
|
}), /*#__PURE__*/_jsx("textarea", {
|
|
80
|
-
className:
|
|
81
|
+
className: custom.textarea,
|
|
81
82
|
"data-testid": process.env.NODE_ENV === 'production' ? undefined : testId,
|
|
82
83
|
disabled: disabled,
|
|
83
84
|
onBlur: onBlur
|
|
@@ -97,10 +98,10 @@ const TextArea = ({
|
|
|
97
98
|
},
|
|
98
99
|
value: localValue
|
|
99
100
|
}), error && error !== true ? /*#__PURE__*/_jsx("div", {
|
|
100
|
-
className:
|
|
101
|
+
className: custom.errorMessage,
|
|
101
102
|
children: error
|
|
102
103
|
}) : null]
|
|
103
104
|
});
|
|
104
105
|
};
|
|
105
|
-
export default
|
|
106
|
+
export default TextArea;
|
|
106
107
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["useEffect","useLayoutEffect","useRef","useState","
|
|
1
|
+
{"version":3,"file":"index.js","names":["useEffect","useLayoutEffect","useRef","useState","useTheme","defaultTheme","jsx","_jsx","jsxs","_jsxs","TextArea","disabled","error","label","onBlur","onChange","onKeyDown","placeholder","testId","theme","value","custom","hiddenAreaRef","height","setHeight","textAreaRef","localValue","setLocalValue","undefined","el","current","cb","scrollHeight","observer","ResizeObserver","observe","disconnect","containerClassName","container","className","onFocus","focus","children","textarea","hidden","readOnly","ref","tabIndex","process","env","NODE_ENV","e","target","style","errorMessage"],"sources":["../../../../../src/shared/components/TextArea/index.tsx"],"sourcesContent":["import {\n type ChangeEventHandler,\n type FocusEventHandler,\n type FunctionComponent,\n type KeyboardEventHandler,\n type ReactNode,\n useEffect,\n useLayoutEffect,\n useRef,\n useState,\n} from 'react';\n\nimport { type Theme, useTheme } from '@dr.pogodin/react-themes';\n\nimport defaultTheme from './style.scss';\n\ntype ThemeKeyT = 'container' | 'error' | 'errorMessage' | 'hidden' | 'label'\n | 'textarea';\n\ntype Props = {\n disabled?: boolean;\n error?: ReactNode;\n label?: string;\n onBlur?: FocusEventHandler<HTMLTextAreaElement>;\n onChange?: ChangeEventHandler<HTMLTextAreaElement>;\n onKeyDown?: KeyboardEventHandler<HTMLTextAreaElement>;\n placeholder?: string;\n testId?: string;\n theme?: Theme<ThemeKeyT>;\n value?: string;\n};\n\nconst TextArea: FunctionComponent<Props> = ({\n disabled,\n error,\n label,\n onBlur,\n onChange,\n onKeyDown,\n placeholder,\n testId,\n theme,\n value,\n}) => {\n const custom = useTheme('TextArea', defaultTheme, theme);\n\n const hiddenAreaRef = useRef<HTMLTextAreaElement>(null);\n const [height, setHeight] = useState<number | undefined>();\n\n const textAreaRef = useRef<HTMLTextAreaElement>(null);\n\n const [localValue, setLocalValue] = useState(value ?? '');\n if (value !== undefined && localValue !== value) setLocalValue(value);\n\n // This resizes text area's height when its width is changed for any reason.\n useEffect(() => {\n const el = hiddenAreaRef.current;\n if (!el) return undefined;\n\n const cb = () => {\n setHeight(el.scrollHeight);\n };\n const observer = new ResizeObserver(cb);\n observer.observe(el);\n\n return () => {\n observer.disconnect();\n };\n }, []);\n\n // Resizes the text area when its content is modified.\n //\n // NOTE: useLayoutEffect() instead of useEffect() makes difference here,\n // as it helps to avoid visible \"content/height\" jumps (i.e. with just\n // useEffect() it becomes visible how the content is modified first,\n // and then input height is incremented, if necessary).\n // See: https://github.com/birdofpreyru/react-utils/issues/313\n useLayoutEffect(() => {\n const el = hiddenAreaRef.current;\n if (el) setHeight(el.scrollHeight);\n }, [localValue]);\n\n let containerClassName = custom.container;\n if (error) containerClassName += ` ${custom.error}`;\n\n return (\n <div\n className={containerClassName}\n onFocus={() => {\n textAreaRef.current?.focus();\n }}\n >\n {label === undefined ? null : <div className={custom.label}>{label}</div>}\n <textarea\n className={`${custom.textarea} ${custom.hidden}`}\n\n // This text area is hidden underneath the primary one below,\n // and it is used for text measurements, to implement auto-scaling\n // of the primary textarea's height.\n readOnly\n ref={hiddenAreaRef}\n\n // The \"-1\" value of \"tabIndex\" removes this hidden text area from\n // the tab-focus-chain.\n tabIndex={-1}\n\n // NOTE: With empty string value (\"\") the scrolling height of this text\n // area is zero, thus collapsing <TextArea> height below the single line\n // input height. To avoid it we fallback to whitespace (\" \") character\n // here.\n value={localValue || ' '}\n />\n <textarea\n className={custom.textarea}\n data-testid={process.env.NODE_ENV === 'production' ? undefined : testId}\n disabled={disabled}\n onBlur={onBlur}\n\n // When value is \"undefined\" the text area is not-managed, and we should\n // manage it internally for the measurement / resizing functionality\n // to work.\n onChange={\n value === undefined\n ? (e) => {\n setLocalValue(e.target.value);\n } : onChange\n }\n onKeyDown={onKeyDown}\n placeholder={placeholder}\n ref={textAreaRef}\n style={{ height }}\n value={localValue}\n />\n {error && error !== true\n ? <div className={custom.errorMessage}>{error}</div>\n : null}\n </div>\n );\n};\n\nexport default TextArea;\n"],"mappings":"AAAA,SAMEA,SAAS,EACTC,eAAe,EACfC,MAAM,EACNC,QAAQ,QACH,OA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G,EAAErB,WAAY;MACjB4B,KAAK,EAAE;QAAE9B;MAAO,CAAE;MAClBH,KAAK,EAAEM;IAAW,CACnB,CAAC,EACDd,KAAK,IAAIA,KAAK,KAAK,IAAI,gBACpBL,IAAA;MAAKgC,SAAS,EAAElB,MAAM,CAACiC,YAAa;MAAAZ,QAAA,EAAE9B;IAAK,CAAM,CAAC,GAClD,IAAI;EAAA,CACL,CAAC;AAEV,CAAC;AAED,eAAeF,QAAQ","ignoreList":[]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { useTheme } from '@dr.pogodin/react-themes';
|
|
2
2
|
import defaultTheme from "./theme.scss";
|
|
3
3
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
4
4
|
/**
|
|
@@ -12,15 +12,18 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
12
12
|
*/
|
|
13
13
|
const Throbber = ({
|
|
14
14
|
theme
|
|
15
|
-
}) =>
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
className:
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
15
|
+
}) => {
|
|
16
|
+
const custom = useTheme('Throbber', defaultTheme, theme);
|
|
17
|
+
return /*#__PURE__*/_jsxs("span", {
|
|
18
|
+
className: custom.container,
|
|
19
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
20
|
+
className: custom.circle
|
|
21
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
22
|
+
className: custom.circle
|
|
23
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
24
|
+
className: custom.circle
|
|
25
|
+
})]
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
export default Throbber;
|
|
26
29
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["
|
|
1
|
+
{"version":3,"file":"index.js","names":["useTheme","defaultTheme","jsx","_jsx","jsxs","_jsxs","Throbber","theme","custom","className","container","children","circle"],"sources":["../../../../../src/shared/components/Throbber/index.tsx"],"sourcesContent":["import type { FunctionComponent } from 'react';\n\nimport { type Theme, useTheme } from '@dr.pogodin/react-themes';\n\nimport defaultTheme from './theme.scss';\n\ntype ThemeKeyT = 'bouncing' | 'circle' | 'container';\n\ntype PropsT = {\n theme?: Theme<ThemeKeyT>;\n};\n\n/**\n * Throbber is an \"action in progress\" indicator, which renders\n * three bouncing circles as a simple pending activity indicator,\n * and can be further themed to a certain degree.\n * @param {object} [props] Component properties.\n * @param {ThrobberTheme} [props.theme] _Ad hoc_ theme.\n * @param {...any} [props....]\n * [Other theming properties](https://www.npmjs.com/package/@dr.pogodin/react-themes#themed-component-properties)\n */\nconst Throbber: FunctionComponent<PropsT> = ({ theme }) => {\n const custom = useTheme('Throbber', defaultTheme, theme);\n\n return (\n <span className={custom.container}>\n <span className={custom.circle} />\n <span className={custom.circle} />\n <span className={custom.circle} />\n </span>\n );\n};\n\nexport default Throbber;\n"],"mappings":"AAEA,SAAqBA,QAAQ,QAAQ,0BAA0B;AAE/D,OAAOC,YAAY;AAAqB,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAQxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,QAAmC,GAAGA,CAAC;EAAEC;AAAM,CAAC,KAAK;EACzD,MAAMC,MAAM,GAAGR,QAAQ,CAAC,UAAU,EAAEC,YAAY,EAAEM,KAAK,CAAC;EAExD,oBACEF,KAAA;IAAMI,SAAS,EAAED,MAAM,CAACE,SAAU;IAAAC,QAAA,gBAChCR,IAAA;MAAMM,SAAS,EAAED,MAAM,CAACI;IAAO,CAAE,CAAC,eAClCT,IAAA;MAAMM,SAAS,EAAED,MAAM,CAACI;IAAO,CAAE,CAAC,eAClCT,IAAA;MAAMM,SAAS,EAAED,MAAM,CAACI;IAAO,CAAE,CAAC;EAAA,CAC9B,CAAC;AAEX,CAAC;AAED,eAAeN,QAAQ","ignoreList":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* global window */
|
|
2
2
|
|
|
3
3
|
import { useEffect, useRef, useState } from 'react';
|
|
4
|
-
import
|
|
4
|
+
import { useTheme } from '@dr.pogodin/react-themes';
|
|
5
5
|
import Tooltip, { PLACEMENTS } from "./Tooltip";
|
|
6
6
|
import defaultTheme from "./default-theme.scss";
|
|
7
7
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -19,12 +19,13 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
19
19
|
* _e.g._ a tooltip text. This will be the tooltip content.
|
|
20
20
|
* @param {WithTooltipTheme} props.theme _Ad hoc_ theme.
|
|
21
21
|
*/
|
|
22
|
-
const
|
|
22
|
+
const WithTooltip = ({
|
|
23
23
|
children,
|
|
24
24
|
placement = PLACEMENTS.ABOVE_CURSOR,
|
|
25
25
|
tip,
|
|
26
26
|
theme
|
|
27
27
|
}) => {
|
|
28
|
+
const custom = useTheme('WithTooltip', defaultTheme, theme);
|
|
28
29
|
const {
|
|
29
30
|
current: heap
|
|
30
31
|
} = useRef({
|
|
@@ -84,7 +85,7 @@ const Wrapper = ({
|
|
|
84
85
|
return undefined;
|
|
85
86
|
}, [heap.lastCursorX, heap.lastCursorY, placement, showTooltip, tip]);
|
|
86
87
|
return /*#__PURE__*/_jsxs("div", {
|
|
87
|
-
className:
|
|
88
|
+
className: custom.wrapper,
|
|
88
89
|
onClick: () => {
|
|
89
90
|
if (heap.timerId) {
|
|
90
91
|
clearTimeout(heap.timerId);
|
|
@@ -105,13 +106,12 @@ const Wrapper = ({
|
|
|
105
106
|
role: "presentation",
|
|
106
107
|
children: [showTooltip && tip !== null ? /*#__PURE__*/_jsx(Tooltip, {
|
|
107
108
|
ref: tooltipRef,
|
|
108
|
-
theme:
|
|
109
|
+
theme: custom,
|
|
109
110
|
children: tip
|
|
110
111
|
}) : null, children]
|
|
111
112
|
});
|
|
112
113
|
};
|
|
113
|
-
const
|
|
114
|
-
const e = ThemedWrapper;
|
|
114
|
+
const e = WithTooltip;
|
|
115
115
|
e.PLACEMENTS = PLACEMENTS;
|
|
116
116
|
export default e;
|
|
117
117
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["useEffect","useRef","useState","
|
|
1
|
+
{"version":3,"file":"index.js","names":["useEffect","useRef","useState","useTheme","Tooltip","PLACEMENTS","defaultTheme","jsx","_jsx","jsxs","_jsxs","WithTooltip","children","placement","ABOVE_CURSOR","tip","theme","custom","current","heap","lastCursorX","lastCursorY","timerId","undefined","triggeredByTouch","tooltipRef","wrapperRef","showTooltip","setShowTooltip","updatePortalPosition","cursorX","cursorY","wrapperRect","getBoundingClientRect","left","right","top","bottom","pointTo","window","scrollX","scrollY","setTimeout","listener","addEventListener","removeEventListener","className","wrapper","onClick","clearTimeout","onMouseLeave","onMouseMove","e","clientX","clientY","onTouchStart","ref","role"],"sources":["../../../../../src/shared/components/WithTooltip/index.tsx"],"sourcesContent":["/* global window */\n\nimport {\n type FunctionComponent,\n type ReactNode,\n useEffect,\n useRef,\n useState,\n} from 'react';\n\nimport { type Theme, useTheme } from '@dr.pogodin/react-themes';\n\nimport Tooltip, {\n type ThemeKeysT as TooltipThemeKeysT,\n PLACEMENTS,\n} from './Tooltip';\n\nimport defaultTheme from './default-theme.scss';\n\ntype PropsT = {\n children?: ReactNode;\n placement?: PLACEMENTS;\n tip?: ReactNode;\n theme?: Theme<'wrapper' | TooltipThemeKeysT>;\n};\n\ntype TooltipRefT = {\n pointTo: (\n x: number,\n y: number,\n placement: PLACEMENTS,\n wrapperRef: HTMLDivElement,\n ) => void;\n};\n\ntype HeapT = {\n lastCursorX: number;\n lastCursorY: number;\n triggeredByTouch: boolean;\n timerId?: NodeJS.Timeout;\n};\n\n/**\n * Implements a simple to use and themeable tooltip component, _e.g._\n * ```js\n * <WithTooltip tip=\"This is example tooltip.\">\n * <p>Hover to see the tooltip.</p>\n * </WithTooltip>\n * ```\n * **Children:** Children are rendered in the place of `<WithTooltip>`,\n * and when hovered the tooltip is shown. By default the wrapper itself is\n * `<div>` block with `display: inline-block`.\n * @param tip – Anything React is able to render,\n * _e.g._ a tooltip text. This will be the tooltip content.\n * @param {WithTooltipTheme} props.theme _Ad hoc_ theme.\n */\nconst WithTooltip: FunctionComponent<PropsT> = ({\n children,\n placement = PLACEMENTS.ABOVE_CURSOR,\n tip,\n theme,\n}) => {\n const custom = useTheme('WithTooltip', defaultTheme, theme);\n\n const { current: heap } = useRef<HeapT>({\n lastCursorX: 0,\n lastCursorY: 0,\n timerId: undefined,\n triggeredByTouch: false,\n });\n const tooltipRef = useRef<TooltipRefT>(null);\n const wrapperRef = useRef<HTMLDivElement>(null);\n const [showTooltip, setShowTooltip] = useState(false);\n\n const updatePortalPosition = (cursorX: number, cursorY: number) => {\n if (showTooltip) {\n const wrapperRect = wrapperRef.current!.getBoundingClientRect();\n if (\n cursorX < wrapperRect.left\n || cursorX > wrapperRect.right\n || cursorY < wrapperRect.top\n || cursorY > wrapperRect.bottom\n ) {\n setShowTooltip(false);\n } else if (tooltipRef.current) {\n tooltipRef.current.pointTo(\n cursorX + window.scrollX,\n cursorY + window.scrollY,\n placement,\n wrapperRef.current!,\n );\n }\n } else {\n heap.lastCursorX = cursorX;\n heap.lastCursorY = cursorY;\n\n // If tooltip was triggered by a touch, we delay its opening by a bit,\n // to ensure it was not a touch-click - in the case of touch click we\n // want to do the click, rather than show the tooltip, and the delay\n // gives click handler a chance to abort the tooltip openning.\n if (heap.triggeredByTouch) {\n heap.timerId ??= setTimeout(() => {\n heap.triggeredByTouch = false;\n heap.timerId = undefined;\n setShowTooltip(true);\n }, 300);\n\n // Otherwise we can just open the tooltip right away.\n } else setShowTooltip(true);\n }\n };\n\n useEffect(() => {\n if (showTooltip && tip !== null) {\n // This is necessary to ensure that even when a single mouse event\n // arrives to a tool-tipped component, the tooltip is correctly positioned\n // once opened (because similar call above does not have effect until\n // the tooltip is fully mounted, and that is delayed to future rendering\n // cycle due to the implementation).\n if (tooltipRef.current) {\n tooltipRef.current.pointTo(\n heap.lastCursorX + window.scrollX,\n heap.lastCursorY + window.scrollY,\n placement,\n wrapperRef.current!,\n );\n }\n\n const listener = () => {\n setShowTooltip(false);\n };\n window.addEventListener('scroll', listener);\n return () => {\n window.removeEventListener('scroll', listener);\n };\n }\n return undefined;\n }, [\n heap.lastCursorX,\n heap.lastCursorY,\n placement,\n showTooltip,\n tip,\n ]);\n\n return (\n <div\n className={custom.wrapper}\n onClick={() => {\n if (heap.timerId) {\n clearTimeout(heap.timerId);\n heap.timerId = undefined;\n heap.triggeredByTouch = false;\n }\n }}\n onMouseLeave={() => {\n setShowTooltip(false);\n }}\n onMouseMove={(e) => {\n updatePortalPosition(e.clientX, e.clientY);\n }}\n onTouchStart={() => {\n heap.triggeredByTouch = true;\n }}\n ref={wrapperRef}\n role=\"presentation\"\n >\n {\n showTooltip && tip !== null\n ? <Tooltip ref={tooltipRef} theme={custom}>{tip}</Tooltip>\n : null\n }\n {children}\n </div>\n );\n};\n\ntype ExportT = typeof WithTooltip & {\n PLACEMENTS: typeof PLACEMENTS;\n};\n\nconst e: ExportT = WithTooltip as ExportT;\n\ne.PLACEMENTS = PLACEMENTS;\n\nexport default e;\n"],"mappings":"AAAA;;AAEA,SAGEA,SAAS,EACTC,MAAM,EACNC,QAAQ,QACH,OAAO;AAEd,SAAqBC,QAAQ,QAAQ,0BAA0B;AAE/D,OAAOC,OAAO,IAEZC,UAAU;AAGZ,OAAOC,YAAY;AAA6B,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAyBhD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,WAAsC,GAAGA,CAAC;EAC9CC,QAAQ;EACRC,SAAS,GAAGR,UAAU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