@dr.pogodin/react-utils 1.53.0 → 1.54.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (141) hide show
  1. package/build/development/client/index.js +2 -0
  2. package/build/development/client/index.js.map +1 -1
  3. package/build/development/index.js +2 -2
  4. package/build/development/index.js.map +1 -1
  5. package/build/development/shared/components/Button/index.js +149 -71
  6. package/build/development/shared/components/Button/index.js.map +1 -1
  7. package/build/development/shared/components/Checkbox/index.js +77 -24
  8. package/build/development/shared/components/Checkbox/index.js.map +1 -1
  9. package/build/development/shared/components/GenericLink/index.js +133 -54
  10. package/build/development/shared/components/GenericLink/index.js.map +1 -1
  11. package/build/development/shared/components/Input/index.js +168 -45
  12. package/build/development/shared/components/Input/index.js.map +1 -1
  13. package/build/development/shared/components/Link.js +23 -13
  14. package/build/development/shared/components/Link.js.map +1 -1
  15. package/build/development/shared/components/Modal/index.js +203 -87
  16. package/build/development/shared/components/Modal/index.js.map +1 -1
  17. package/build/development/shared/components/NavLink.js +16 -7
  18. package/build/development/shared/components/NavLink.js.map +1 -1
  19. package/build/development/shared/components/PageLayout/index.js +77 -15
  20. package/build/development/shared/components/PageLayout/index.js.map +1 -1
  21. package/build/development/shared/components/TextArea/index.js +169 -68
  22. package/build/development/shared/components/TextArea/index.js.map +1 -1
  23. package/build/development/shared/components/Throbber/index.js +51 -13
  24. package/build/development/shared/components/Throbber/index.js.map +1 -1
  25. package/build/development/shared/components/WithTooltip/Tooltip.js +73 -34
  26. package/build/development/shared/components/WithTooltip/Tooltip.js.map +1 -1
  27. package/build/development/shared/components/WithTooltip/index.js +19 -19
  28. package/build/development/shared/components/WithTooltip/index.js.map +1 -1
  29. package/build/development/shared/components/YouTubeVideo/index.js +66 -23
  30. package/build/development/shared/components/YouTubeVideo/index.js.map +1 -1
  31. package/build/development/shared/components/selectors/CustomDropdown/Options/index.js +104 -56
  32. package/build/development/shared/components/selectors/CustomDropdown/Options/index.js.map +1 -1
  33. package/build/development/shared/components/selectors/CustomDropdown/index.js +173 -75
  34. package/build/development/shared/components/selectors/CustomDropdown/index.js.map +1 -1
  35. package/build/development/shared/components/selectors/Switch/index.js +86 -36
  36. package/build/development/shared/components/selectors/Switch/index.js.map +1 -1
  37. package/build/development/shared/utils/globalState.js +2 -2
  38. package/build/development/shared/utils/globalState.js.map +1 -1
  39. package/build/development/shared/utils/index.js +1 -1
  40. package/build/development/shared/utils/index.js.map +1 -1
  41. package/build/development/shared/utils/splitComponent.js +125 -55
  42. package/build/development/shared/utils/splitComponent.js.map +1 -1
  43. package/build/development/shared/utils/time.js +55 -20
  44. package/build/development/shared/utils/time.js.map +1 -1
  45. package/build/production/client/index.js +2 -2
  46. package/build/production/client/index.js.map +1 -1
  47. package/build/production/index.js +1 -1
  48. package/build/production/index.js.map +1 -1
  49. package/build/production/shared/components/Button/index.js +2 -13
  50. package/build/production/shared/components/Button/index.js.map +1 -1
  51. package/build/production/shared/components/Checkbox/index.js +1 -1
  52. package/build/production/shared/components/Checkbox/index.js.map +1 -1
  53. package/build/production/shared/components/GenericLink/index.js +2 -15
  54. package/build/production/shared/components/GenericLink/index.js.map +1 -1
  55. package/build/production/shared/components/Input/index.js +2 -11
  56. package/build/production/shared/components/Input/index.js.map +1 -1
  57. package/build/production/shared/components/Link.js +2 -4
  58. package/build/production/shared/components/Link.js.map +1 -1
  59. package/build/production/shared/components/Modal/index.js +2 -10
  60. package/build/production/shared/components/Modal/index.js.map +1 -1
  61. package/build/production/shared/components/NavLink.js +1 -4
  62. package/build/production/shared/components/NavLink.js.map +1 -1
  63. package/build/production/shared/components/PageLayout/index.js +2 -2
  64. package/build/production/shared/components/PageLayout/index.js.map +1 -1
  65. package/build/production/shared/components/TextArea/index.js +1 -21
  66. package/build/production/shared/components/TextArea/index.js.map +1 -1
  67. package/build/production/shared/components/Throbber/index.js +2 -2
  68. package/build/production/shared/components/Throbber/index.js.map +1 -1
  69. package/build/production/shared/components/WithTooltip/Tooltip.js +2 -7
  70. package/build/production/shared/components/WithTooltip/Tooltip.js.map +1 -1
  71. package/build/production/shared/components/WithTooltip/index.js +3 -3
  72. package/build/production/shared/components/WithTooltip/index.js.map +1 -1
  73. package/build/production/shared/components/YouTubeVideo/index.js +2 -5
  74. package/build/production/shared/components/YouTubeVideo/index.js.map +1 -1
  75. package/build/production/shared/components/selectors/CustomDropdown/Options/index.js +1 -6
  76. package/build/production/shared/components/selectors/CustomDropdown/Options/index.js.map +1 -1
  77. package/build/production/shared/components/selectors/CustomDropdown/index.js +1 -7
  78. package/build/production/shared/components/selectors/CustomDropdown/index.js.map +1 -1
  79. package/build/production/shared/components/selectors/Switch/index.js +1 -1
  80. package/build/production/shared/components/selectors/Switch/index.js.map +1 -1
  81. package/build/production/shared/utils/globalState.js +1 -1
  82. package/build/production/shared/utils/globalState.js.map +1 -1
  83. package/build/production/shared/utils/index.js +1 -1
  84. package/build/production/shared/utils/index.js.map +1 -1
  85. package/build/production/shared/utils/splitComponent.js +3 -10
  86. package/build/production/shared/utils/splitComponent.js.map +1 -1
  87. package/build/production/shared/utils/time.js +2 -2
  88. package/build/production/shared/utils/time.js.map +1 -1
  89. package/build/types-code/index.d.ts +2 -2
  90. package/build/types-code/shared/utils/globalState.d.ts +2 -2
  91. package/build/types-code/shared/utils/index.d.ts +1 -1
  92. package/build/types-code/shared/utils/splitComponent.d.ts +1 -0
  93. package/build/web/client/index.js +2 -2
  94. package/build/web/client/index.js.map +1 -1
  95. package/build/web/index.js +1 -1
  96. package/build/web/index.js.map +1 -1
  97. package/build/web/shared/components/Button/index.js +2 -13
  98. package/build/web/shared/components/Button/index.js.map +1 -1
  99. package/build/web/shared/components/Checkbox/index.js +1 -1
  100. package/build/web/shared/components/Checkbox/index.js.map +1 -1
  101. package/build/web/shared/components/GenericLink/index.js +2 -15
  102. package/build/web/shared/components/GenericLink/index.js.map +1 -1
  103. package/build/web/shared/components/Input/index.js +2 -11
  104. package/build/web/shared/components/Input/index.js.map +1 -1
  105. package/build/web/shared/components/Link.js +2 -4
  106. package/build/web/shared/components/Link.js.map +1 -1
  107. package/build/web/shared/components/Modal/index.js +2 -10
  108. package/build/web/shared/components/Modal/index.js.map +1 -1
  109. package/build/web/shared/components/NavLink.js +1 -4
  110. package/build/web/shared/components/NavLink.js.map +1 -1
  111. package/build/web/shared/components/PageLayout/index.js +2 -2
  112. package/build/web/shared/components/PageLayout/index.js.map +1 -1
  113. package/build/web/shared/components/TextArea/index.js +1 -21
  114. package/build/web/shared/components/TextArea/index.js.map +1 -1
  115. package/build/web/shared/components/Throbber/index.js +2 -2
  116. package/build/web/shared/components/Throbber/index.js.map +1 -1
  117. package/build/web/shared/components/WithTooltip/Tooltip.js +2 -7
  118. package/build/web/shared/components/WithTooltip/Tooltip.js.map +1 -1
  119. package/build/web/shared/components/WithTooltip/index.js +3 -3
  120. package/build/web/shared/components/WithTooltip/index.js.map +1 -1
  121. package/build/web/shared/components/YouTubeVideo/index.js +2 -5
  122. package/build/web/shared/components/YouTubeVideo/index.js.map +1 -1
  123. package/build/web/shared/components/selectors/CustomDropdown/Options/index.js +1 -6
  124. package/build/web/shared/components/selectors/CustomDropdown/Options/index.js.map +1 -1
  125. package/build/web/shared/components/selectors/CustomDropdown/index.js +1 -7
  126. package/build/web/shared/components/selectors/CustomDropdown/index.js.map +1 -1
  127. package/build/web/shared/components/selectors/Switch/index.js +1 -1
  128. package/build/web/shared/components/selectors/Switch/index.js.map +1 -1
  129. package/build/web/shared/utils/globalState.js +1 -1
  130. package/build/web/shared/utils/globalState.js.map +1 -1
  131. package/build/web/shared/utils/index.js +1 -1
  132. package/build/web/shared/utils/index.js.map +1 -1
  133. package/build/web/shared/utils/splitComponent.js +3 -10
  134. package/build/web/shared/utils/splitComponent.js.map +1 -1
  135. package/build/web/shared/utils/time.js +2 -2
  136. package/build/web/shared/utils/time.js.map +1 -1
  137. package/config/babel/webpack.d.ts +1 -0
  138. package/config/babel/webpack.js +10 -12
  139. package/package.json +10 -8
  140. package/tsconfig.json +1 -1
  141. package/tsconfig.types.json +1 -1
@@ -1,4 +1,4 @@
1
- const S={"link":"hXmkf-"};import{jsx as _jsx}from"react/jsx-runtime";/**
1
+ import{c as _c}from"react/compiler-runtime";const S={"link":"hXmkf-"};import{jsx as _jsx}from"react/jsx-runtime";/**
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
@@ -37,18 +37,5 @@ const S={"link":"hXmkf-"};import{jsx as _jsx}from"react/jsx-runtime";/**
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
- */const GenericLink=({children,className,disabled,enforceA,keepScrollPosition,onClick,onMouseDown,openNewTab,replace,routerLinkType,to,...rest})=>{/* Renders Link as <a> element if:
41
- * - It is opted explicitely by `enforceA` prop;
42
- * - It should be opened in a new tab;
43
- * - It is an absolte URL (starts with http:// or https://);
44
- * - It is anchor link (starts with #). */if(disabled||enforceA||openNewTab||to.match(/^(#|(https?|mailto):)/)){let aClassName=S.link;if(className)aClassName+=` ${className}`;return/*#__PURE__*/_jsx("a",{className:aClassName// 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",styleName:"link",target:openNewTab?"_blank":"",children:children});}const L=routerLinkType;return/*#__PURE__*/_jsx(L,{className:className,discover:"none"// disabled
49
- ,onClick:e=>{// Executes the user-provided event handler, if any.
50
- if(onClick)onClick(e);// By default, clicking the link scrolls the page to beginning.
51
- if(!keepScrollPosition)window.scroll(0,0);},onMouseDown:onMouseDown,replace:replace,to:to// TODO: Refactor it later.
52
- // eslint-disable-next-line react/jsx-props-no-spreading
53
- ,...rest,children:children});};export default GenericLink;
40
+ */const GenericLink=t0=>{const $=_c(32);let children;let className;let disabled;let enforceA;let keepScrollPosition;let onClick;let onMouseDown;let openNewTab;let replace;let rest;let routerLinkType;let to;if($[0]!==t0){({children,className,disabled,enforceA,keepScrollPosition,onClick,onMouseDown,openNewTab,replace,routerLinkType,to,...rest}=t0);$[0]=t0;$[1]=children;$[2]=className;$[3]=disabled;$[4]=enforceA;$[5]=keepScrollPosition;$[6]=onClick;$[7]=onMouseDown;$[8]=openNewTab;$[9]=replace;$[10]=rest;$[11]=routerLinkType;$[12]=to;}else{children=$[1];className=$[2];disabled=$[3];enforceA=$[4];keepScrollPosition=$[5];onClick=$[6];onMouseDown=$[7];openNewTab=$[8];replace=$[9];rest=$[10];routerLinkType=$[11];to=$[12];}if(disabled||enforceA||openNewTab||to.match(/^(#|(https?|mailto):)/)){let aClassName=S.link;if(className){aClassName=aClassName+` ${className}`;}const t1=to;const t2=disabled?_temp:onClick;const t3=disabled?_temp2:onMouseDown;const t4=openNewTab?"_blank":"";let t5;if($[13]!==aClassName||$[14]!==children||$[15]!==t1||$[16]!==t2||$[17]!==t3||$[18]!==t4){t5=/*#__PURE__*/_jsx("a",{className:aClassName,href:t1,onClick:t2,onMouseDown:t3,rel:"noopener noreferrer",styleName:"link",target:t4,children:children});$[13]=aClassName;$[14]=children;$[15]=t1;$[16]=t2;$[17]=t3;$[18]=t4;$[19]=t5;}else{t5=$[19];}return t5;}const L=routerLinkType;let t1;if($[20]!==keepScrollPosition||$[21]!==onClick){t1=e_1=>{if(onClick){onClick(e_1);}if(!keepScrollPosition){window.scroll(0,0);}};$[20]=keepScrollPosition;$[21]=onClick;$[22]=t1;}else{t1=$[22];}let t2;if($[23]!==L||$[24]!==children||$[25]!==className||$[26]!==onMouseDown||$[27]!==replace||$[28]!==rest||$[29]!==t1||$[30]!==to){t2=/*#__PURE__*/_jsx(L,{className:className,discover:"none",onClick:t1,onMouseDown:onMouseDown,replace:replace,to:to,...rest,children:children});$[23]=L;$[24]=children;$[25]=className;$[26]=onMouseDown;$[27]=replace;$[28]=rest;$[29]=t1;$[30]=to;$[31]=t2;}else{t2=$[31];}return t2;};export default GenericLink;function _temp(e){e.preventDefault();}function _temp2(e_0){e_0.preventDefault();}
54
41
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["jsx","_jsx","GenericLink","children","className","disabled","enforceA","keepScrollPosition","onClick","onMouseDown","openNewTab","replace","routerLinkType","to","rest","match","aClassName","S","link","href","e","preventDefault","rel","styleName","target","L","discover","window","scroll"],"sources":["../../../../../src/shared/components/GenericLink/index.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\n\nimport type {\n Link,\n LinkProps,\n NavLink,\n NavLinkProps,\n} from 'react-router';\n\nimport S from './style.scss';\n\ntype LinkT = typeof Link;\ntype NavLinkT = typeof NavLink;\n\ntype ToT = Parameters<typeof Link>[0]['to'];\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: LinkT | NavLinkT;\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 = ({\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}: (LinkProps | NavLinkProps) & PropsT): ReactNode => {\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\n || (to as string).match(/^(#|(https?|mailto):)/)) {\n let aClassName: string = S.link;\n if (className) aClassName += ` ${className}`;\n\n return (\n <a\n className={aClassName}\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) => {\n e.preventDefault();\n } : onClick}\n onMouseDown={disabled ? (e) => {\n e.preventDefault();\n } : onMouseDown}\n rel=\"noopener noreferrer\"\n styleName=\"link\"\n target={openNewTab ? '_blank' : ''}\n >\n {children}\n </a>\n );\n }\n\n const L = routerLinkType;\n\n return (\n <L\n className={className}\n discover=\"none\"\n // disabled\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 onMouseDown={onMouseDown}\n replace={replace}\n to={to}\n // TODO: Refactor it later.\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...rest}\n >\n {children}\n </L>\n );\n};\n\nexport default GenericLink;\n"],"mappings":"0BAS6B,OAAAA,GAAA,IAAAC,IAAA,yBAqB7B;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,WAAW,CAAGA,CAAC,CACnBC,QAAQ,CACRC,SAAS,CACTC,QAAQ,CACRC,QAAQ,CACRC,kBAAkB,CAClBC,OAAO,CACPC,WAAW,CACXC,UAAU,CACVC,OAAO,CACPC,cAAc,CACdC,EAAE,CACF,GAAGC,IACgC,CAAC,GAAgB,CACpD;AACF;AACA;AACA;AACA,4CACE,GAAIT,QAAQ,EAAIC,QAAQ,EAAII,UAAU,EAChCG,EAAE,CAAYE,KAAK,CAAC,uBAAuB,CAAC,CAAE,CAClD,GAAI,CAAAC,UAAkB,CAAGC,CAAC,CAACC,IAAI,CAC/B,GAAId,SAAS,CAAEY,UAAU,EAAI,IAAIZ,SAAS,EAAE,CAE5C,mBACEH,IAAA,MACEG,SAAS,CAAEY,UACX;AACA;AACA;AACA;AAAA,CACAG,IAAI,CAAEN,EAAa,CACnBL,OAAO,CAAEH,QAAQ,CAAIe,CAAC,EAAK,CACzBA,CAAC,CAACC,cAAc,CAAC,CAAC,CACpB,CAAC,CAAGb,OAAQ,CACZC,WAAW,CAAEJ,QAAQ,CAAIe,CAAC,EAAK,CAC7BA,CAAC,CAACC,cAAc,CAAC,CAAC,CACpB,CAAC,CAAGZ,WAAY,CAChBa,GAAG,CAAC,qBAAqB,CACzBC,SAAS,CAAC,MAAM,CAChBC,MAAM,CAAEd,UAAU,CAAG,QAAQ,CAAG,EAAG,CAAAP,QAAA,CAElCA,QAAQ,CACR,CAAC,CAER,CAEA,KAAM,CAAAsB,CAAC,CAAGb,cAAc,CAExB,mBACEX,IAAA,CAACwB,CAAC,EACArB,SAAS,CAAEA,SAAU,CACrBsB,QAAQ,CAAC,MACT;AAAA,CACAlB,OAAO,CAAGY,CAAsC,EAAK,CACnD;AACA,GAAIZ,OAAO,CAAEA,OAAO,CAACY,CAAC,CAAC,CAEvB;AACA,GAAI,CAACb,kBAAkB,CAAEoB,MAAM,CAACC,MAAM,CAAC,CAAC,CAAE,CAAC,CAAC,CAC9C,CAAE,CACFnB,WAAW,CAAEA,WAAY,CACzBE,OAAO,CAAEA,OAAQ,CACjBE,EAAE,CAAEA,EACJ;AACA;AAAA,IACIC,IAAI,CAAAX,QAAA,CAEPA,QAAQ,CACR,CAAC,CAER,CAAC,CAED,cAAe,CAAAD,WAAW","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["S","jsx","_jsx","GenericLink","t0","$","_c","children","className","disabled","enforceA","keepScrollPosition","onClick","onMouseDown","openNewTab","replace","rest","routerLinkType","to","match","aClassName","link","t1","t2","_temp","t3","_temp2","t4","t5","href","rel","styleName","target","L","e_1","window","scroll","discover","e","preventDefault","e_0"],"sources":["../../../../../src/shared/components/GenericLink/index.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\n\nimport type {\n Link,\n LinkProps,\n NavLink,\n NavLinkProps,\n} from 'react-router';\n\nimport S from './style.scss';\n\ntype LinkT = typeof Link;\ntype NavLinkT = typeof NavLink;\n\ntype ToT = Parameters<typeof Link>[0]['to'];\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: LinkT | NavLinkT;\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 = ({\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}: (LinkProps | NavLinkProps) & PropsT): ReactNode => {\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\n || (to as string).match(/^(#|(https?|mailto):)/)) {\n let aClassName: string = S.link;\n if (className) aClassName += ` ${className}`;\n\n return (\n <a\n className={aClassName}\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) => {\n e.preventDefault();\n } : onClick}\n onMouseDown={disabled ? (e) => {\n e.preventDefault();\n } : onMouseDown}\n rel=\"noopener noreferrer\"\n styleName=\"link\"\n target={openNewTab ? '_blank' : ''}\n >\n {children}\n </a>\n );\n }\n\n const L = routerLinkType;\n\n return (\n <L\n className={className}\n discover=\"none\"\n // disabled\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 onMouseDown={onMouseDown}\n replace={replace}\n to={to}\n // TODO: Refactor it later.\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...rest}\n >\n {children}\n </L>\n );\n};\n\nexport default GenericLink;\n"],"mappings":"4CASA,MAAAA,CAAA,mBAA6B,OAAAC,GAAA,IAAAC,IAAA,yBAqB7B;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,WAAW,CAAGC,EAAA,SAAAC,CAAA,CAAAC,EAAA,SAAAC,QAAA,KAAAC,SAAA,KAAAC,QAAA,KAAAC,QAAA,KAAAC,kBAAA,KAAAC,OAAA,KAAAC,WAAA,KAAAC,UA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AAlB,CAAA,OAAA4B,CAAA,EAAA5B,CAAA,OAAAE,QAAA,EAAAF,CAAA,OAAAG,SAAA,EAAAH,CAAA,OAAAQ,WAAA,EAAAR,CAAA,OAAAU,OAAA,EAAAV,CAAA,OAAAW,IAAA,EAAAX,CAAA,OAAAiB,EAAA,EAAAjB,CAAA,OAAAa,EAAA,EAVHK,EAAA,cAAArB,IAAA,CAAC+B,CAAC,EACWzB,SAAS,CAATA,SAAS,CACX6B,QAAM,CAAN,MAAM,CAENzB,OAMR,CANQU,EAMR,CACYT,WAAW,CAAXA,WAAW,CACfE,OAAO,CAAPA,OAAO,CACZG,EAAE,CAAFA,EAAE,IAGFF,IAAI,CAAAT,QAAA,CAEPA,QAAQ,CACR,CAAC,CAAAF,CAAA,KAAA4B,CAAA,CAAA5B,CAAA,KAAAE,QAAA,CAAAF,CAAA,KAAAG,SAAA,CAAAH,CAAA,KAAAQ,WAAA,CAAAR,CAAA,KAAAU,OAAA,CAAAV,CAAA,KAAAW,IAAA,CAAAX,CAAA,KAAAiB,EAAA,CAAAjB,CAAA,KAAAa,EAAA,CAAAb,CAAA,KAAAkB,EAAA,OAAAA,EAAA,CAAAlB,CAAA,YAnBJ,CAAAkB,EAmBI,EAEP,CAED,cAAe,CAAApB,WAAW,CAzEN,SAAAqB,MAAAc,CAAA,EAiCVA,CAAC,CAAAC,cAAe,CAAC,CAAC,EAjCR,SAAAb,OAAAc,GAAA,EAoCVA,GAAC,CAAAD,cAAe,CAAC,CAAC","ignoreList":[]}
@@ -1,18 +1,9 @@
1
- import{useRef,useState}from"react";import{useTheme}from"@dr.pogodin/react-themes";const defaultTheme={"context":"-Jj9Dp","ad":"IOZUc8","hoc":"nSzLXc","container":"wW08uK","children":"hCuQWP","input":"oYQ-Uo","label":"OTmX5n","error":"_7jrZ-X","errorMessage":"qjYbwz"};import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";/**
1
+ import{c as _c}from"react/compiler-runtime";import{useRef,useState}from"react";import{useTheme}from"@dr.pogodin/react-themes";const defaultTheme={"context":"-Jj9Dp","ad":"IOZUc8","hoc":"nSzLXc","container":"wW08uK","children":"hCuQWP","input":"oYQ-Uo","label":"OTmX5n","error":"_7jrZ-X","errorMessage":"qjYbwz"};import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";/**
2
2
  * Themeable input field, based on the standard HTML `<input>` element.
3
3
  * @param [props.label] Input label.
4
4
  * @param [props.theme] _Ad hoc_ theme.
5
5
  * @param [props...] [Other theming properties](https://www.npmjs.com/package/@dr.pogodin/react-themes#themed-component-properties)
6
6
  * @param [props...] Any other properties are passed to the underlying
7
7
  * `<input>` element.
8
- */const Input=({children,composeAdhocTheme,error,label,ref,testId,theme,...rest})=>{const composed=useTheme("Input",defaultTheme,theme,{composeAdhocTheme});// NOTE: As of now, it is only updated when "theme.focused" is defined,
9
- // as otherwise its value is not used.
10
- const[focused,setFocused]=useState(false);const localRef=useRef(null);let containerClassName=composed.container;// NOTE: As of now, "focused" can be true only when "theme.focused"
11
- // is provided.
12
- if(focused/* && theme.focused */)containerClassName+=` ${composed.focused}`;if(!rest.value&&composed.empty)containerClassName+=` ${composed.empty}`;if(error)containerClassName+=` ${composed.error}`;return/*#__PURE__*/_jsxs("div",{className:containerClassName,onFocus:()=>{// TODO: It does not really work if a callback-style `ref` is passed in,
13
- // we need a more complex logic to cover that case, but for now this serves
14
- // the case we need it for.
15
- if(typeof ref==="object")ref?.current?.focus();else localRef.current?.focus();},children:[label===undefined?null:/*#__PURE__*/_jsx("div",{className:composed.label,children:label}),/*#__PURE__*/_jsx("input",{className:composed.input,"data-testid":process.env.NODE_ENV==="production"?undefined:testId,ref:ref??localRef// TODO: Avoid the spreading later.
16
- // eslint-disable-next-line react/jsx-props-no-spreading
17
- ,...rest,onBlur:composed.focused?e=>{setFocused(false);rest.onBlur?.(e);}:rest.onBlur,onFocus:composed.focused?e=>{setFocused(true);rest.onFocus?.(e);}:rest.onFocus}),error&&error!==true?/*#__PURE__*/_jsx("div",{className:composed.errorMessage,children:error}):null,children?/*#__PURE__*/_jsx("div",{className:composed.children,children:children}):null]});};export default Input;
8
+ */const Input=t0=>{const $=_c(42);let children;let composeAdhocTheme;let error;let label;let ref;let rest;let testId;let theme;if($[0]!==t0){({children,composeAdhocTheme,error,label,ref,testId,theme,...rest}=t0);$[0]=t0;$[1]=children;$[2]=composeAdhocTheme;$[3]=error;$[4]=label;$[5]=ref;$[6]=rest;$[7]=testId;$[8]=theme;}else{children=$[1];composeAdhocTheme=$[2];error=$[3];label=$[4];ref=$[5];rest=$[6];testId=$[7];theme=$[8];}let t1;if($[9]!==composeAdhocTheme){t1={composeAdhocTheme};$[9]=composeAdhocTheme;$[10]=t1;}else{t1=$[10];}const composed=useTheme("Input",defaultTheme,theme,t1);const[focused,setFocused]=useState(false);const localRef=useRef(null);let containerClassName=composed.container;if(focused){containerClassName=containerClassName+` ${composed.focused}`;}if(!rest.value&&composed.empty){containerClassName=containerClassName+` ${composed.empty}`;}if(error){containerClassName=containerClassName+` ${composed.error}`;}let t2;if($[11]!==ref){t2=()=>{if(typeof ref==="object"){ref?.current?.focus();}else{localRef.current?.focus();}};$[11]=ref;$[12]=t2;}else{t2=$[12];}let t3;if($[13]!==composed.label||$[14]!==label){t3=label===undefined?null:/*#__PURE__*/_jsx("div",{className:composed.label,children:label});$[13]=composed.label;$[14]=label;$[15]=t3;}else{t3=$[15];}const t4=process.env.NODE_ENV==="production"?undefined:testId;const t5=ref??localRef;let t6;if($[16]!==composed.focused||$[17]!==rest){t6=composed.focused?e=>{setFocused(false);rest.onBlur?.(e);}:rest.onBlur;$[16]=composed.focused;$[17]=rest;$[18]=t6;}else{t6=$[18];}let t7;if($[19]!==composed.focused||$[20]!==rest){t7=composed.focused?e_0=>{setFocused(true);rest.onFocus?.(e_0);}:rest.onFocus;$[19]=composed.focused;$[20]=rest;$[21]=t7;}else{t7=$[21];}let t8;if($[22]!==composed.input||$[23]!==rest||$[24]!==t4||$[25]!==t5||$[26]!==t6||$[27]!==t7){t8=/*#__PURE__*/_jsx("input",{className:composed.input,"data-testid":t4,ref:t5,...rest,onBlur:t6,onFocus:t7});$[22]=composed.input;$[23]=rest;$[24]=t4;$[25]=t5;$[26]=t6;$[27]=t7;$[28]=t8;}else{t8=$[28];}let t9;if($[29]!==composed.errorMessage||$[30]!==error){t9=error&&error!==true?/*#__PURE__*/_jsx("div",{className:composed.errorMessage,children:error}):null;$[29]=composed.errorMessage;$[30]=error;$[31]=t9;}else{t9=$[31];}let t10;if($[32]!==children||$[33]!==composed.children){t10=children?/*#__PURE__*/_jsx("div",{className:composed.children,children:children}):null;$[32]=children;$[33]=composed.children;$[34]=t10;}else{t10=$[34];}let t11;if($[35]!==containerClassName||$[36]!==t10||$[37]!==t2||$[38]!==t3||$[39]!==t8||$[40]!==t9){t11=/*#__PURE__*/_jsxs("div",{className:containerClassName,onFocus:t2,children:[t3,t8,t9,t10]});$[35]=containerClassName;$[36]=t10;$[37]=t2;$[38]=t3;$[39]=t8;$[40]=t9;$[41]=t11;}else{t11=$[41];}return t11;};export default Input;
18
9
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["useRef","useState","useTheme","defaultTheme","jsx","_jsx","jsxs","_jsxs","Input","children","composeAdhocTheme","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 COMPOSE, 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 composeAdhocTheme?: COMPOSE;\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 composeAdhocTheme,\n error,\n label,\n ref,\n testId,\n theme,\n ...rest\n}) => {\n const composed = useTheme('Input', defaultTheme, theme, {\n composeAdhocTheme,\n });\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}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Q,CAACO,OAAO,EAAEC,KAAK,CAAC,CAAC,CAChC,CAAE,CAAAnB,QAAA,EAEDG,KAAK,GAAKiB,SAAS,CAChB,IAAI,cAAGxB,IAAA,QAAKoB,SAAS,CAAER,QAAQ,CAACL,KAAM,CAAAH,QAAA,CAAEG,KAAK,CAAM,CAAC,cACxDP,IAAA,UACEoB,SAAS,CAAER,QAAQ,CAACa,KAAM,CAC1B,cAAaC,OAAO,CAACC,GAAG,CAACC,QAAQ,GAAK,YAAY,CAAGJ,SAAS,CAAGf,MAAO,CACxED,GAAG,CAAEA,GAAG,EAAIO,QAEZ;AACA;AAAA,IACIJ,IAAI,CAERkB,MAAM,CAAEjB,QAAQ,CAACC,OAAO,CAAIiB,CAAC,EAAK,CAChChB,UAAU,CAAC,KAAK,CAAC,CACjBH,IAAI,CAACkB,MAAM,GAAGC,CAAC,CAAC,CAClB,CAAC,CAAGnB,IAAI,CAACkB,MAAO,CAChBR,OAAO,CAAET,QAAQ,CAACC,OAAO,CAAIiB,CAAC,EAAK,CACjChB,UAAU,CAAC,IAAI,CAAC,CAChBH,IAAI,CAACU,OAAO,GAAGS,CAAC,CAAC,CACnB,CAAC,CAAGnB,IAAI,CAACU,OAAQ,CAClB,CAAC,CACDf,KAAK,EAAIA,KAAK,GAAK,IAAI,cACpBN,IAAA,QAAKoB,SAAS,CAAER,QAAQ,CAACmB,YAAa,CAAA3B,QAAA,CAAEE,KAAK,CAAM,CAAC,CACpD,IAAI,CACPF,QAAQ,cAAGJ,IAAA,QAAKoB,SAAS,CAAER,QAAQ,CAACR,QAAS,CAAAA,QAAA,CAAEA,QAAQ,CAAM,CAAC,CAAG,IAAI,EACnE,CAAC,CAEV,CAAC,CAED,cAAe,CAAAD,KAAK","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["useRef","useState","useTheme","defaultTheme","jsx","_jsx","jsxs","_jsxs","Input","t0","$","_c","children","composeAdhocTheme","error","label","ref","rest","testId","theme","t1","composed","focused","setFocused","localRef","containerClassName","container","value","empty","t2","current","focus","t3","undefined","className","t4","process","env","NODE_ENV","t5","t6","e","onBlur","t7","e_0","onFocus","t8","input","t9","errorMessage","t10","t11"],"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 COMPOSE, 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 composeAdhocTheme?: COMPOSE;\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 composeAdhocTheme,\n error,\n label,\n ref,\n testId,\n theme,\n ...rest\n}) => {\n const composed = useTheme('Input', defaultTheme, theme, {\n composeAdhocTheme,\n });\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":"4CAAA,OAIEA,MAAM,CACNC,QAAQ,KACH,OAAO,CAEd,OAAmCC,QAAQ,KAAQ,0BAA0B,CAE7E,MAAAC,YAAA,wKAAwC,OAAAC,GAAA,IAAAC,IAAA,CAAAC,IAAA,IAAAC,KAAA,yBAexC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACA,KAAM,CAAAC,KAAgC,CAAGC,EAAA,SAAAC,CAAA,CAAAC,EAAA,SAAAC,QAAA,KAAAC,iBAAA,KAAAC,KAAA,KAAAC,KAAA,KAAAC,GAAA,KAAAC,IAAA,KAAAC,MAAA,KAAAC,KAAA,IAAAT,CAAA,MAAAD,EAAA,EAAC,EAAAG,QAAA,CAAAC,iBAAA,CAAAC,KAAA,CAAAC,KAAA,CAAAC,GAAA,CAAAE,MAAA,CAAAC,KAAA,IAAAF,IAAA,EAAAR,EASzC,EAAAC,CAAA,IAAAD,EAAA,CAAAC,CAAA,IAAAE,QAAA,CAAAF,CAAA,IAAAG,iBAAA,CAAAH,CAAA,IAAAI,KAAA,CAAAJ,CAAA,IAAAK,KAAA,CAAAL,CAAA,IAAAM,GAAA,CAAAN,CAAA,IAAAO,IAAA,CAAAP,CAAA,IAAAQ,MAAA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,QAAQ,cAARP,IAAA,QAA2B6B,SAAiB,CAAjBb,QAAQ,CAAAT,QAAS,CAAAA,QAAA,CAAGA,QAAQ,CAAa,CAAC,CAArE,IAAqE,CAAAF,CAAA,KAAAE,QAAA,CAAAF,CAAA,KAAAW,QAAA,CAAAT,QAAA,CAAAF,CAAA,KAAAwC,GAAA,OAAAA,GAAA,CAAAxC,CAAA,UAAAyC,GAAA,IAAAzC,CAAA,OAAAe,kBAAA,EAAAf,CAAA,OAAAwC,GAAA,EAAAxC,CAAA,OAAAmB,EAAA,EAAAnB,CAAA,OAAAsB,EAAA,EAAAtB,CAAA,OAAAoC,EAAA,EAAApC,CAAA,OAAAsC,EAAA,EAjCxEG,GAAA,cAAA5C,KAAA,QACa2B,SAAkB,CAAlBT,kBAAkB,CACpBoB,OAMR,CANQhB,EAMR,CAAAjB,QAAA,EAEAoB,EACuD,CACxDc,EAiBE,CACDE,EAEO,CACPE,GAAqE,EACnE,CAAC,CAAAxC,CAAA,KAAAe,kBAAA,CAAAf,CAAA,KAAAwC,GAAA,CAAAxC,CAAA,KAAAmB,EAAA,CAAAnB,CAAA,KAAAsB,EAAA,CAAAtB,CAAA,KAAAoC,EAAA,CAAApC,CAAA,KAAAsC,EAAA,CAAAtC,CAAA,KAAAyC,GAAA,OAAAA,GAAA,CAAAzC,CAAA,YAlCN,CAAAyC,GAkCM,EAET,CAED,cAAe,CAAA3C,KAAK","ignoreList":[]}
@@ -1,10 +1,8 @@
1
- /**
1
+ import{c as _c}from"react/compiler-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
- */import{Link as RrLink}from"react-router";import GenericLink from"./GenericLink/index.js";import{jsx as _jsx}from"react/jsx-runtime";const Link=props=>/*#__PURE__*/_jsx(GenericLink// TODO: Avoid the spreading later.
8
- // eslint-disable-next-line react/jsx-props-no-spreading
9
- ,{...props,routerLinkType:RrLink});export default Link;
7
+ */import{Link as RrLink}from"react-router";import GenericLink from"./GenericLink/index.js";import{jsx as _jsx}from"react/jsx-runtime";const Link=props=>{const $=_c(2);let t0;if($[0]!==props){t0=/*#__PURE__*/_jsx(GenericLink,{...props,routerLinkType:RrLink});$[0]=props;$[1]=t0;}else{t0=$[1];}return t0;};export default Link;
10
8
  //# sourceMappingURL=Link.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Link.js","names":["Link","RrLink","GenericLink","jsx","_jsx","props","routerLinkType"],"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 { type LinkProps, Link as RrLink } from 'react-router';\n\nimport GenericLink, { type PropsT as GenericLinkPropsT } from './GenericLink';\n\ntype PropsT = LinkProps & Omit<GenericLinkPropsT, 'routerLinkType'>;\n\nconst Link: React.FunctionComponent<PropsT>\n = (props) => (\n <GenericLink\n // TODO: Avoid the spreading later.\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...props}\n routerLinkType={RrLink}\n />\n );\n\nexport default Link;\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,GAEA,OAAyBA,IAAI,GAAI,CAAAC,MAAM,KAAQ,cAAc,CAE7D,MAAO,CAAAC,WAAW,8BAA4D,OAAAC,GAAA,IAAAC,IAAA,yBAI9E,KAAM,CAAAJ,IAAqC,CACtCK,KAAK,eACND,IAAA,CAACF,WACC;AACA;AAAA,KACIG,KAAK,CACTC,cAAc,CAAEL,MAAO,CACxB,CACF,CAEH,cAAe,CAAAD,IAAI","ignoreList":[]}
1
+ {"version":3,"file":"Link.js","names":["Link","RrLink","GenericLink","jsx","_jsx","props","$","_c","t0","routerLinkType"],"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 { type LinkProps, Link as RrLink } from 'react-router';\n\nimport GenericLink, { type PropsT as GenericLinkPropsT } from './GenericLink';\n\ntype PropsT = LinkProps & Omit<GenericLinkPropsT, 'routerLinkType'>;\n\nconst Link: React.FunctionComponent<PropsT>\n = (props) => (\n <GenericLink\n // TODO: Avoid the spreading later.\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...props}\n routerLinkType={RrLink}\n />\n );\n\nexport default Link;\n"],"mappings":"4CAAA;AACA;AACA;AACA;AACA;AACA;AACA,GAEA,OAAyBA,IAAI,GAAI,CAAAC,MAAM,KAAQ,cAAc,CAE7D,MAAO,CAAAC,WAAW,8BAA4D,OAAAC,GAAA,IAAAC,IAAA,yBAI9E,KAAM,CAAAJ,IAAqC,CACvCK,KAAA,SAAAC,CAAA,CAAAC,EAAA,QAAAC,EAAA,IAAAF,CAAA,MAAAD,KAAA,EACAG,EAAA,cAAAJ,IAAA,CAACF,WAAW,KAGNG,KAAK,CACOI,cAAM,CAANR,MAAM,CACvB,CAAC,CAAAK,CAAA,IAAAD,KAAA,CAAAC,CAAA,IAAAE,EAAA,OAAAA,EAAA,CAAAF,CAAA,WALF,CAAAE,EAKE,EACH,CAEH,cAAe,CAAAR,IAAI","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- import{useEffect,useMemo,useRef}from"react";import{createPortal}from"react-dom";import{useTheme}from"@dr.pogodin/react-themes";const defaultTheme={"context":"sCYXfW","ad":"e0BH-f","hoc":"vqUuSP","overlay":"uAH4as","container":"zqpc6q"};const S={"scrollingDisabledByModal":"yfvOIZ"};import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";/**
1
+ import{c as _c}from"react/compiler-runtime";import{useEffect,useMemo,useRef}from"react";import{createPortal}from"react-dom";import{useTheme}from"@dr.pogodin/react-themes";const defaultTheme={"context":"sCYXfW","ad":"e0BH-f","hoc":"vqUuSP","overlay":"uAH4as","container":"zqpc6q"};const S={"scrollingDisabledByModal":"yfvOIZ"};import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";/**
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,13 +8,5 @@ import{useEffect,useMemo,useRef}from"react";import{createPortal}from"react-dom";
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
- */const BaseModal=({cancelOnScrolling,children,containerStyle,dontDisableScrolling,onCancel,overlayStyle,style,testId,testIdForOverlay,theme})=>{const containerRef=useRef(null);const overlayRef=useRef(null);// Sets up modal cancellation of scrolling, if opted-in.
12
- useEffect(()=>{if(cancelOnScrolling&&onCancel){window.addEventListener("scroll",onCancel);window.addEventListener("wheel",onCancel);}return()=>{if(cancelOnScrolling&&onCancel){window.removeEventListener("scroll",onCancel);window.removeEventListener("wheel",onCancel);}};},[cancelOnScrolling,onCancel]);// Disables window scrolling, if it is not opted-out.
13
- useEffect(()=>{if(!dontDisableScrolling){document.body.classList.add(S.scrollingDisabledByModal);}return()=>{if(!dontDisableScrolling){document.body.classList.remove(S.scrollingDisabledByModal);}};},[dontDisableScrolling]);const focusLast=useMemo(()=>/*#__PURE__*/_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();}// TODO: Have a look at this later.
14
- // eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
15
- ,tabIndex:0}),[]);return/*#__PURE__*/createPortal(/*#__PURE__*/_jsxs("div",{children:[focusLast,/*#__PURE__*/_jsx("div",{"aria-label":"Cancel",className:theme.overlay,"data-testid":process.env.NODE_ENV==="production"?undefined:testIdForOverlay,onClick:e=>{if(onCancel){onCancel();e.stopPropagation();}},onKeyDown:e=>{if(e.key==="Escape"&&onCancel){onCancel();e.stopPropagation();}},ref:node=>{if(node&&node!==overlayRef.current){overlayRef.current=node;node.focus();}},role:"button",style:overlayStyle,tabIndex:0}),/*#__PURE__*/_jsx("div",{// eslint-disable-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
16
- "aria-modal":"true",className:theme.container,"data-testid":process.env.NODE_ENV==="production"?undefined:testId,onClick:e=>{e.stopPropagation();},onWheel:event=>{event.stopPropagation();},ref:containerRef,role:"dialog",style:style??containerStyle,children:children}),/*#__PURE__*/_jsx("div",{onFocus:()=>{overlayRef.current?.focus();}// TODO: Have a look at this later.
17
- // eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
18
- ,tabIndex:0}),focusLast]}),document.body);};/* Non-themed version of the Modal. */export{BaseModal};const Modal=({theme,...rest})=>{const composed=useTheme("Modal",defaultTheme,theme);// eslint-disable-next-line react/jsx-props-no-spreading
19
- return/*#__PURE__*/_jsx(BaseModal,{...rest,theme:composed});};export default Modal;
11
+ */const BaseModal=t0=>{const $=_c(27);const{cancelOnScrolling,children,containerStyle,dontDisableScrolling,onCancel,overlayStyle,style,testId,testIdForOverlay,theme}=t0;const containerRef=useRef(null);const overlayRef=useRef(null);let t1;let t2;if($[0]!==cancelOnScrolling||$[1]!==onCancel){t1=()=>{if(cancelOnScrolling&&onCancel){window.addEventListener("scroll",onCancel);window.addEventListener("wheel",onCancel);}return()=>{if(cancelOnScrolling&&onCancel){window.removeEventListener("scroll",onCancel);window.removeEventListener("wheel",onCancel);}};};t2=[cancelOnScrolling,onCancel];$[0]=cancelOnScrolling;$[1]=onCancel;$[2]=t1;$[3]=t2;}else{t1=$[2];t2=$[3];}useEffect(t1,t2);let t3;let t4;if($[4]!==dontDisableScrolling){t3=()=>{if(!dontDisableScrolling){document.body.classList.add(S.scrollingDisabledByModal);}return()=>{if(!dontDisableScrolling){document.body.classList.remove(S.scrollingDisabledByModal);}};};t4=[dontDisableScrolling];$[4]=dontDisableScrolling;$[5]=t3;$[6]=t4;}else{t3=$[5];t4=$[6];}useEffect(t3,t4);let t5;if($[7]===Symbol.for("react.memo_cache_sentinel")){t5=/*#__PURE__*/_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();},tabIndex:0});$[7]=t5;}else{t5=$[7];}const focusLast=t5;const t6=process.env.NODE_ENV==="production"?undefined:testIdForOverlay;let t7;let t8;if($[8]!==onCancel){t7=e=>{if(onCancel){onCancel();e.stopPropagation();}};t8=e_0=>{if(e_0.key==="Escape"&&onCancel){onCancel();e_0.stopPropagation();}};$[8]=onCancel;$[9]=t7;$[10]=t8;}else{t7=$[9];t8=$[10];}let t9;if($[11]===Symbol.for("react.memo_cache_sentinel")){t9=node=>{if(node&&node!==overlayRef.current){overlayRef.current=node;node.focus();}};$[11]=t9;}else{t9=$[11];}let t10;if($[12]!==overlayStyle||$[13]!==t6||$[14]!==t7||$[15]!==t8||$[16]!==theme.overlay){t10=/*#__PURE__*/_jsx("div",{"aria-label":"Cancel",className:theme.overlay,"data-testid":t6,onClick:t7,onKeyDown:t8,ref:t9,role:"button",style:overlayStyle,tabIndex:0});$[12]=overlayStyle;$[13]=t6;$[14]=t7;$[15]=t8;$[16]=theme.overlay;$[17]=t10;}else{t10=$[17];}const t11=process.env.NODE_ENV==="production"?undefined:testId;const t12=style??containerStyle;let t13;if($[18]!==children||$[19]!==t11||$[20]!==t12||$[21]!==theme.container){t13=/*#__PURE__*/_jsx("div",{"aria-modal":"true",className:theme.container,"data-testid":t11,onClick:_temp,onWheel:_temp2,ref:containerRef,role:"dialog",style:t12,children:children});$[18]=children;$[19]=t11;$[20]=t12;$[21]=theme.container;$[22]=t13;}else{t13=$[22];}let t14;if($[23]===Symbol.for("react.memo_cache_sentinel")){t14=/*#__PURE__*/_jsx("div",{onFocus:()=>{overlayRef.current?.focus();},tabIndex:0});$[23]=t14;}else{t14=$[23];}let t15;if($[24]!==t10||$[25]!==t13){t15=/*#__PURE__*/createPortal(/*#__PURE__*/_jsxs("div",{children:[focusLast,t10,t13,t14,focusLast]}),document.body);$[24]=t10;$[25]=t13;$[26]=t15;}else{t15=$[26];}return t15;};/* Non-themed version of the Modal. */export{BaseModal};const Modal=t0=>{const $=_c(6);let rest;let theme;if($[0]!==t0){({theme,...rest}=t0);$[0]=t0;$[1]=rest;$[2]=theme;}else{rest=$[1];theme=$[2];}const composed=useTheme("Modal",defaultTheme,theme);let t1;if($[3]!==composed||$[4]!==rest){t1=/*#__PURE__*/_jsx(BaseModal,{...rest,theme:composed});$[3]=composed;$[4]=rest;$[5]=t1;}else{t1=$[5];}return t1;};export default Modal;function _temp(e_1){e_1.stopPropagation();}function _temp2(event){event.stopPropagation();}
20
12
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
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';\n\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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AAK,CAAC,CAEvD;AACA,mBAAOb,IAAA,CAACG,SAAS,KAAKkD,IAAI,CAAExC,KAAK,CAAEyC,QAAS,CAAE,CAAC,CACjD,CAAC,CAED,cAAe,CAAAF,KAAK","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["useEffect","useMemo","useRef","createPortal","useTheme","defaultTheme","S","jsx","_jsx","jsxs","_jsxs","BaseModal","t0","$","_c","cancelOnScrolling","children","containerStyle","dontDisableScrolling","onCancel","overlayStyle","style","testId","testIdForOverlay","theme","containerRef","overlayRef","t1","t2","window","addEventListener","removeEventListener","t3","t4","document","body","classList","add","scrollingDisabledByModal","remove","t5","Symbol","for","onFocus","elems","current","querySelectorAll","i","length","focus","activeElement","tabIndex","focusLast","t6","process","env","NODE_ENV","undefined","t7","t8","e","stopPropagation","e_0","key","t9","node","t10","overlay","className","onClick","onKeyDown","ref","role","t11","t12","t13","container","_temp","onWheel","_temp2","t14","t15","Modal","rest","composed","e_1","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';\n\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"],"mappings":"4CAAA,OAIEA,SAAS,CACTC,OAAO,CACPC,MAAM,KACD,OAAO,CAEd,OAASC,YAAY,KAAQ,WAAW,CAExC,OAAqBC,QAAQ,KAAQ,0BAA0B,CAE/D,MAAAC,YAAA,iGAAAC,CAAA,uCAC8B,OAAAC,GAAA,IAAAC,IAAA,CAAAC,IAAA,IAAAC,KAAA,yBAmB9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA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js";import{jsx as _jsx}from"react/jsx-runtime";const NavLink=props=>/*#__PURE__*/_jsx(GenericLink// TODO: I guess, we better re-write it to avoid the props spreading,
2
- // but no need to spend time on it right now.
3
- // eslint-disable-next-line react/jsx-props-no-spreading
4
- ,{...props,routerLinkType:RrNavLink});export default NavLink;
1
+ import{c as _c}from"react/compiler-runtime";import{NavLink as RrNavLink}from"react-router";import GenericLink from"./GenericLink/index.js";import{jsx as _jsx}from"react/jsx-runtime";const NavLink=props=>{const $=_c(2);let t0;if($[0]!==props){t0=/*#__PURE__*/_jsx(GenericLink,{...props,routerLinkType:RrNavLink});$[0]=props;$[1]=t0;}else{t0=$[1];}return t0;};export default NavLink;
5
2
  //# sourceMappingURL=NavLink.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"NavLink.js","names":["NavLink","RrNavLink","GenericLink","jsx","_jsx","props","routerLinkType"],"sources":["../../../../src/shared/components/NavLink.tsx"],"sourcesContent":["import { type NavLinkProps, NavLink as RrNavLink } from 'react-router';\n\nimport GenericLink, { type PropsT as GenericLinkPropsT } from './GenericLink';\n\ntype PropsT = NavLinkProps & Omit<GenericLinkPropsT, 'routerLinkType'>;\n\nconst NavLink: React.FunctionComponent<PropsT>\n = (props) => (\n <GenericLink\n // TODO: I guess, we better re-write it to avoid the props spreading,\n // but no need to spend time on it right now.\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...props}\n routerLinkType={RrNavLink}\n />\n );\n\nexport default NavLink;\n"],"mappings":"AAAA,OAA4BA,OAAO,GAAI,CAAAC,SAAS,KAAQ,cAAc,CAEtE,MAAO,CAAAC,WAAW,8BAA4D,OAAAC,GAAA,IAAAC,IAAA,yBAI9E,KAAM,CAAAJ,OAAwC,CACzCK,KAAK,eACND,IAAA,CAACF,WACC;AACA;AACA;AAAA,KACIG,KAAK,CACTC,cAAc,CAAEL,SAAU,CAC3B,CACF,CAEH,cAAe,CAAAD,OAAO","ignoreList":[]}
1
+ {"version":3,"file":"NavLink.js","names":["NavLink","RrNavLink","GenericLink","jsx","_jsx","props","$","_c","t0","routerLinkType"],"sources":["../../../../src/shared/components/NavLink.tsx"],"sourcesContent":["import { type NavLinkProps, NavLink as RrNavLink } from 'react-router';\n\nimport GenericLink, { type PropsT as GenericLinkPropsT } from './GenericLink';\n\ntype PropsT = NavLinkProps & Omit<GenericLinkPropsT, 'routerLinkType'>;\n\nconst NavLink: React.FunctionComponent<PropsT>\n = (props) => (\n <GenericLink\n // TODO: I guess, we better re-write it to avoid the props spreading,\n // but no need to spend time on it right now.\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...props}\n routerLinkType={RrNavLink}\n />\n );\n\nexport default NavLink;\n"],"mappings":"4CAAA,OAA4BA,OAAO,GAAI,CAAAC,SAAS,KAAQ,cAAc,CAEtE,MAAO,CAAAC,WAAW,8BAA4D,OAAAC,GAAA,IAAAC,IAAA,yBAI9E,KAAM,CAAAJ,OAAwC,CAC1CK,KAAA,SAAAC,CAAA,CAAAC,EAAA,QAAAC,EAAA,IAAAF,CAAA,MAAAD,KAAA,EACAG,EAAA,cAAAJ,IAAA,CAACF,WAAW,KAING,KAAK,CACOI,cAAS,CAATR,SAAS,CAC1B,CAAC,CAAAK,CAAA,IAAAD,KAAA,CAAAC,CAAA,IAAAE,EAAA,OAAAA,EAAA,CAAAF,CAAA,WANF,CAAAE,EAME,EACH,CAEH,cAAe,CAAAR,OAAO","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- import{useTheme}from"@dr.pogodin/react-themes";const baseTheme={"context":"zv9tdn","ad":"yr8hbI","hoc":"_01Mz0J","container":"blPmpk","mainPanel":"zPoY0u","sidePanel":"mRD159"};import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";/**
1
+ import{c as _c}from"react/compiler-runtime";import{useTheme}from"@dr.pogodin/react-themes";const baseTheme={"context":"zv9tdn","ad":"yr8hbI","hoc":"_01Mz0J","container":"blPmpk","mainPanel":"zPoY0u","sidePanel":"mRD159"};import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";/**
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 @@ import{useTheme}from"@dr.pogodin/react-themes";const baseTheme={"context":"zv9td
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
- */const PageLayout=({children,leftSidePanelContent,rightSidePanelContent,theme})=>{const composed=useTheme("PageLayout",baseTheme,theme);return/*#__PURE__*/_jsxs("div",{className:composed.container,children:[/*#__PURE__*/_jsx("div",{className:[composed.sidePanel,composed.leftSidePanel].join(" "),children:leftSidePanelContent}),/*#__PURE__*/_jsx("div",{className:composed.mainPanel,children:children}),/*#__PURE__*/_jsx("div",{className:[composed.sidePanel,composed.rightSidePanel].join(" "),children:rightSidePanelContent})]});};export default PageLayout;
15
+ */const PageLayout=t0=>{const $=_c(20);const{children,leftSidePanelContent,rightSidePanelContent,theme}=t0;const composed=useTheme("PageLayout",baseTheme,theme);const t1=composed.container;let t2;if($[0]!==composed.leftSidePanel||$[1]!==composed.sidePanel){t2=[composed.sidePanel,composed.leftSidePanel];$[0]=composed.leftSidePanel;$[1]=composed.sidePanel;$[2]=t2;}else{t2=$[2];}const t3=t2.join(" ");let t4;if($[3]!==leftSidePanelContent||$[4]!==t3){t4=/*#__PURE__*/_jsx("div",{className:t3,children:leftSidePanelContent});$[3]=leftSidePanelContent;$[4]=t3;$[5]=t4;}else{t4=$[5];}let t5;if($[6]!==children||$[7]!==composed.mainPanel){t5=/*#__PURE__*/_jsx("div",{className:composed.mainPanel,children:children});$[6]=children;$[7]=composed.mainPanel;$[8]=t5;}else{t5=$[8];}let t6;if($[9]!==composed.rightSidePanel||$[10]!==composed.sidePanel){t6=[composed.sidePanel,composed.rightSidePanel];$[9]=composed.rightSidePanel;$[10]=composed.sidePanel;$[11]=t6;}else{t6=$[11];}const t7=t6.join(" ");let t8;if($[12]!==rightSidePanelContent||$[13]!==t7){t8=/*#__PURE__*/_jsx("div",{className:t7,children:rightSidePanelContent});$[12]=rightSidePanelContent;$[13]=t7;$[14]=t8;}else{t8=$[14];}let t9;if($[15]!==composed.container||$[16]!==t4||$[17]!==t5||$[18]!==t8){t9=/*#__PURE__*/_jsxs("div",{className:t1,children:[t4,t5,t8]});$[15]=composed.container;$[16]=t4;$[17]=t5;$[18]=t8;$[19]=t9;}else{t9=$[19];}return t9;};export default PageLayout;
16
16
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
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,OAAqBA,QAAQ,KAAQ,0BAA0B,CAE/D,MAAAC,SAAA,mHAA0C,OAAAC,GAAA,IAAAC,IAAA,CAAAC,IAAA,IAAAC,KAAA,yBAY1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACA,KAAM,CAAAC,UAAqC,CAAGA,CAAC,CAC7CC,QAAQ,CACRC,oBAAoB,CACpBC,qBAAqB,CACrBC,KACF,CAAC,GAAK,CACJ,KAAM,CAAAC,QAAQ,CAAGX,QAAQ,CAAC,YAAY,CAAEC,SAAS,CAAES,KAAK,CAAC,CACzD,mBACEL,KAAA,QAAKO,SAAS,CAAED,QAAQ,CAACE,SAAU,CAAAN,QAAA,eACjCJ,IAAA,QAAKS,SAAS,CAAE,CAACD,QAAQ,CAACG,SAAS,CAAEH,QAAQ,CAACI,aAAa,CAAC,CAACC,IAAI,CAAC,GAAG,CAAE,CAAAT,QAAA,CACpEC,oBAAoB,CAClB,CAAC,cACNL,IAAA,QAAKS,SAAS,CAAED,QAAQ,CAACM,SAAU,CAAAV,QAAA,CAChCA,QAAQ,CACN,CAAC,cACNJ,IAAA,QAAKS,SAAS,CAAE,CAACD,QAAQ,CAACG,SAAS,CAAEH,QAAQ,CAACO,cAAc,CAAC,CAACF,IAAI,CAAC,GAAG,CAAE,CAAAT,QAAA,CACrEE,qBAAqB,CACnB,CAAC,EACH,CAAC,CAEV,CAAC,CAED,cAAe,CAAAH,UAAU","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["useTheme","baseTheme","jsx","_jsx","jsxs","_jsxs","PageLayout","t0","$","_c","children","leftSidePanelContent","rightSidePanelContent","theme","composed","t1","container","t2","leftSidePanel","sidePanel","t3","join","t4","className","t5","mainPanel","t6","rightSidePanel","t7","t8","t9"],"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\nex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AAA,KAAAqB,EAAA,CAAArB,CAAA,KAAAsB,EAAA,OAAAA,EAAA,CAAAtB,CAAA,YAVN,CAAAsB,EAUM,EAET,CAED,cAAe,CAAAxB,UAAU","ignoreList":[]}
@@ -1,22 +1,2 @@
1
- import{useEffect,useLayoutEffect,useRef,useState}from"react";import{useTheme}from"@dr.pogodin/react-themes";const defaultTheme={"context":"tECG8C","ad":"epeH4O","hoc":"_2kFnSt","container":"lV5ZyX","label":"_7qDPW1","textarea":"gkaNJJ","error":"ObwtG4","errorMessage":"ikIw0x","hidden":"-UyujK"};import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";const TextArea=({disabled,error,label,onBlur,onChange,onKeyDown,placeholder,testId,theme,value})=>{const custom=useTheme("TextArea",defaultTheme,theme);const hiddenAreaRef=useRef(null);const[height,setHeight]=useState();const textAreaRef=useRef(null);const[localValue,setLocalValue]=useState(value??"");if(value!==undefined&&localValue!==value)setLocalValue(value);// This resizes text area's height when its width is changed for any reason.
2
- useEffect(()=>{const el=hiddenAreaRef.current;if(!el)return undefined;const cb=()=>{setHeight(el.scrollHeight);};const observer=new ResizeObserver(cb);observer.observe(el);return()=>{observer.disconnect();};},[]);// Resizes the text area when its content is modified.
3
- //
4
- // NOTE: useLayoutEffect() instead of useEffect() makes difference here,
5
- // as it helps to avoid visible "content/height" jumps (i.e. with just
6
- // useEffect() it becomes visible how the content is modified first,
7
- // and then input height is incremented, if necessary).
8
- // See: https://github.com/birdofpreyru/react-utils/issues/313
9
- useLayoutEffect(()=>{const el=hiddenAreaRef.current;if(el)setHeight(el.scrollHeight);},[localValue]);let containerClassName=custom.container;if(error)containerClassName+=` ${custom.error}`;return/*#__PURE__*/_jsxs("div",{className:containerClassName,onFocus:()=>{textAreaRef.current?.focus();},children:[label===undefined?null:/*#__PURE__*/_jsx("div",{className:custom.label,children:label}),/*#__PURE__*/_jsx("textarea",{className:`${custom.textarea} ${custom.hidden}`// This text area is hidden underneath the primary one below,
10
- // and it is used for text measurements, to implement auto-scaling
11
- // of the primary textarea's height.
12
- ,readOnly:true,ref:hiddenAreaRef// The "-1" value of "tabIndex" removes this hidden text area from
13
- // the tab-focus-chain.
14
- ,tabIndex:-1// NOTE: With empty string value ("") the scrolling height of this text
15
- // area is zero, thus collapsing <TextArea> height below the single line
16
- // input height. To avoid it we fallback to whitespace (" ") character
17
- // here.
18
- ,value:localValue||" "}),/*#__PURE__*/_jsx("textarea",{className:custom.textarea,"data-testid":process.env.NODE_ENV==="production"?undefined:testId,disabled:disabled,onBlur:onBlur// When value is "undefined" the text area is not-managed, and we should
19
- // manage it internally for the measurement / resizing functionality
20
- // to work.
21
- ,onChange:value===undefined?e=>{setLocalValue(e.target.value);}:onChange,onKeyDown:onKeyDown,placeholder:placeholder,ref:textAreaRef,style:{height},value:localValue}),error&&error!==true?/*#__PURE__*/_jsx("div",{className:custom.errorMessage,children:error}):null]});};export default TextArea;
1
+ import{c as _c}from"react/compiler-runtime";import{useEffect,useLayoutEffect,useRef,useState}from"react";import{useTheme}from"@dr.pogodin/react-themes";const defaultTheme={"context":"tECG8C","ad":"epeH4O","hoc":"_2kFnSt","container":"lV5ZyX","label":"_7qDPW1","textarea":"gkaNJJ","error":"ObwtG4","errorMessage":"ikIw0x","hidden":"-UyujK"};import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";const TextArea=t0=>{const $=_c(36);const{disabled,error,label,onBlur,onChange,onKeyDown,placeholder,testId,theme,value}=t0;const custom=useTheme("TextArea",defaultTheme,theme);const hiddenAreaRef=useRef(null);const[height,setHeight]=useState();const textAreaRef=useRef(null);const[localValue,setLocalValue]=useState(value??"");if(value!==undefined&&localValue!==value){setLocalValue(value);}let t1;let t2;if($[0]===Symbol.for("react.memo_cache_sentinel")){t1=()=>{const el=hiddenAreaRef.current;if(!el){return;}const cb=()=>{setHeight(el.scrollHeight);};const observer=new ResizeObserver(cb);observer.observe(el);return()=>{observer.disconnect();};};t2=[];$[0]=t1;$[1]=t2;}else{t1=$[0];t2=$[1];}useEffect(t1,t2);let t3;if($[2]===Symbol.for("react.memo_cache_sentinel")){t3=()=>{const el_0=hiddenAreaRef.current;if(el_0){setHeight(el_0.scrollHeight);}};$[2]=t3;}else{t3=$[2];}let t4;if($[3]!==localValue){t4=[localValue];$[3]=localValue;$[4]=t4;}else{t4=$[4];}useLayoutEffect(t3,t4);let containerClassName=custom.container;if(error){containerClassName=containerClassName+` ${custom.error}`;}let t5;if($[5]===Symbol.for("react.memo_cache_sentinel")){t5=()=>{textAreaRef.current?.focus();};$[5]=t5;}else{t5=$[5];}let t6;if($[6]!==custom.label||$[7]!==label){t6=label===undefined?null:/*#__PURE__*/_jsx("div",{className:custom.label,children:label});$[6]=custom.label;$[7]=label;$[8]=t6;}else{t6=$[8];}const t7=`${custom.textarea} ${custom.hidden}`;const t8=localValue||" ";let t9;if($[9]!==t7||$[10]!==t8){t9=/*#__PURE__*/_jsx("textarea",{className:t7,readOnly:true,ref:hiddenAreaRef,tabIndex:-1,value:t8});$[9]=t7;$[10]=t8;$[11]=t9;}else{t9=$[11];}const t10=process.env.NODE_ENV==="production"?undefined:testId;let t11;if($[12]!==onChange||$[13]!==value){t11=value===undefined?e=>{setLocalValue(e.target.value);}:onChange;$[12]=onChange;$[13]=value;$[14]=t11;}else{t11=$[14];}let t12;if($[15]!==height){t12={height};$[15]=height;$[16]=t12;}else{t12=$[16];}let t13;if($[17]!==custom.textarea||$[18]!==disabled||$[19]!==localValue||$[20]!==onBlur||$[21]!==onKeyDown||$[22]!==placeholder||$[23]!==t10||$[24]!==t11||$[25]!==t12){t13=/*#__PURE__*/_jsx("textarea",{className:custom.textarea,"data-testid":t10,disabled:disabled,onBlur:onBlur,onChange:t11,onKeyDown:onKeyDown,placeholder:placeholder,ref:textAreaRef,style:t12,value:localValue});$[17]=custom.textarea;$[18]=disabled;$[19]=localValue;$[20]=onBlur;$[21]=onKeyDown;$[22]=placeholder;$[23]=t10;$[24]=t11;$[25]=t12;$[26]=t13;}else{t13=$[26];}let t14;if($[27]!==custom.errorMessage||$[28]!==error){t14=error&&error!==true?/*#__PURE__*/_jsx("div",{className:custom.errorMessage,children:error}):null;$[27]=custom.errorMessage;$[28]=error;$[29]=t14;}else{t14=$[29];}let t15;if($[30]!==containerClassName||$[31]!==t13||$[32]!==t14||$[33]!==t6||$[34]!==t9){t15=/*#__PURE__*/_jsxs("div",{className:containerClassName,onFocus:t5,children:[t6,t9,t13,t14]});$[30]=containerClassName;$[31]=t13;$[32]=t14;$[33]=t6;$[34]=t9;$[35]=t15;}else{t15=$[35];}return t15;};export default TextArea;
22
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
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,OAMEA,SAAS,CACTC,eAAe,CACfC,MAAM,CACNC,QAAQ,KACH,OAAO,CAEd,OAAqBC,QAAQ,KAAQ,0BAA0B,CAE/D,MAAAC,YAAA,0KAAwC,OAAAC,GAAA,IAAAC,IAAA,CAAAC,IAAA,IAAAC,KAAA,yBAkBxC,KAAM,CAAAC,QAAkC,CAAGA,CAAC,CAC1CC,QAAQ,CACRC,KAAK,CACLC,KAAK,CACLC,MAAM,CACNC,QAAQ,CACRC,SAAS,CACTC,WAAW,CACXC,MAAM,CACNC,KAAK,CACLC,KACF,CAAC,GAAK,CACJ,KAAM,CAAAC,MAAM,CAAGjB,QAAQ,CAAC,UAAU,CAAEC,YAAY,CAAEc,KAAK,CAAC,CAExD,KAAM,CAAAG,aAAa,CAAGpB,MAAM,CAAsB,IAAI,CAAC,CACvD,KAAM,CAACqB,MAAM,CAAEC,SAAS,CAAC,CAAGrB,QAAQ,CAAqB,CAAC,CAE1D,KAAM,CAAAsB,WAAW,CAAGvB,MAAM,CAAsB,IAAI,CAAC,CAErD,KAAM,CAACwB,UAAU,CAAEC,aAAa,CAAC,CAAGxB,QAAQ,CAACiB,KAAK,EAAI,EAAE,CAAC,CACzD,GAAIA,KAAK,GAAKQ,SAAS,EAAIF,UAAU,GAAKN,KAAK,CAAEO,aAAa,CAACP,KAAK,CAAC,CAErE;AACApB,SAAS,CAAC,IAAM,CACd,KAAM,CAAA6B,EAAE,CAAGP,aAAa,CAACQ,OAAO,CAChC,G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U,EAAI,GAAI,CAC1B,CAAC,cACFnB,IAAA,aACEgC,SAAS,CAAElB,MAAM,CAACsB,QAAS,CAC3B,cAAaK,OAAO,CAACC,GAAG,CAACC,QAAQ,GAAK,YAAY,CAAGtB,SAAS,CAAGV,MAAO,CACxEP,QAAQ,CAAEA,QAAS,CACnBG,MAAM,CAAEA,MAER;AACA;AACA;AAAA,CACAC,QAAQ,CACNK,KAAK,GAAKQ,SAAS,CACduB,CAAC,EAAK,CACPxB,aAAa,CAACwB,CAAC,CAACC,MAAM,CAAChC,KAAK,CAAC,CAC/B,CAAC,CAAGL,QACP,CACDC,SAAS,CAAEA,SAAU,CACrBC,WAAW,CAAEA,WAAY,CACzB6B,GAAG,CAAErB,WAAY,CACjB4B,KAAK,CAAE,CAAE9B,MAAO,CAAE,CAClBH,KAAK,CAAEM,UAAW,CACnB,CAAC,CACDd,KAAK,EAAIA,KAAK,GAAK,IAAI,cACpBL,IAAA,QAAKgC,SAAS,CAAElB,MAAM,CAACiC,YAAa,CAAAZ,QAAA,CAAE9B,KAAK,CAAM,CAAC,CAClD,IAAI,EACL,CAAC,CAEV,CAAC,CAED,cAAe,CAAAF,QAAQ","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["useEffect","useLayoutEffect","useRef","useState","useTheme","defaultTheme","jsx","_jsx","jsxs","_jsxs","TextArea","t0","$","_c","disabled","error","label","onBlur","onChange","onKeyDown","placeholder","testId","theme","value","custom","hiddenAreaRef","height","setHeight","textAreaRef","localValue","setLocalValue","undefined","t1","t2","Symbol","for","el","current","cb","scrollHeight","observer","ResizeObserver","observe","disconnect","t3","el_0","t4","containerClassName","container","t5","focus","t6","className","children","t7","textarea","hidden","t8","t9","readOnly","ref","tabIndex","t10","process","env","NODE_ENV","t11","e","target","t12","t13","style","t14","errorMessage","t15","onFocus"],"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":"4CAAA,OAMEA,SAAS,CACTC,eAAe,CACfC,MAAM,CACNC,QAAQ,KACH,OAAO,CAEd,OAAqBC,QAAQ,KAAQ,0BAA0B,CAE/D,MAAAC,YAAA,0KAAwC,OAAAC,GAAA,IAAAC,IAAA,CAAAC,IAAA,IAAAC,KAAA,yBAkBxC,KAAM,CAAAC,QAAkC,CAAGC,EAAA,SAAAC,CAAA,CAAAC,EAAA,KAAC,MAAAC,QAAA,CAAAC,KAAA,CAAAC,KAAA,CAAAC,MAAA,CAAAC,QAAA,CAAAC,SAAA,CAAAC,WAAA,CAAAC,MAAA,CAAAC,KAAA,CAAAC,KAAA,EAAAZ,EAW3C,CACC,MAAAa,MAAA,CAAepB,QAAQ,CAAC,UAAU,CAAEC,YAAY,CAAEiB,KAAK,CAAC,CAExD,MA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,CAAA,KAAAuC,EAAA,CAAAvC,CAAA,KAAA8C,EAAA,CAAA9C,CAAA,KAAA8D,GAAA,OAAAA,GAAA,CAAA9D,CAAA,YAlDN,CAAA8D,GAkDM,EAET,CAED,cAAe,CAAAhE,QAAQ","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- import{useTheme}from"@dr.pogodin/react-themes";const defaultTheme={"context":"eVCJf-","ad":"CU2B6H","hoc":"_1V5iVx","bouncing":"h6ZYmQ","container":"VDVI-X","circle":"Y2rzbL"};import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";/**
1
+ import{c as _c}from"react/compiler-runtime";import{useTheme}from"@dr.pogodin/react-themes";const defaultTheme={"context":"eVCJf-","ad":"CU2B6H","hoc":"_1V5iVx","bouncing":"h6ZYmQ","container":"VDVI-X","circle":"Y2rzbL"};import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";/**
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 @@ import{useTheme}from"@dr.pogodin/react-themes";const defaultTheme={"context":"eV
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
- */const Throbber=({theme,themePriority})=>{const custom=useTheme("Throbber",defaultTheme,theme,{themePriority});return/*#__PURE__*/_jsxs("span",{className:custom.container,children:[/*#__PURE__*/_jsx("span",{className:custom.circle}),/*#__PURE__*/_jsx("span",{className:custom.circle}),/*#__PURE__*/_jsx("span",{className:custom.circle})]});};export default Throbber;
9
+ */const Throbber=t0=>{const $=_c(11);const{theme,themePriority}=t0;let t1;if($[0]!==themePriority){t1={themePriority};$[0]=themePriority;$[1]=t1;}else{t1=$[1];}const custom=useTheme("Throbber",defaultTheme,theme,t1);let t2;let t3;let t4;if($[2]!==custom.circle){t2=/*#__PURE__*/_jsx("span",{className:custom.circle});t3=/*#__PURE__*/_jsx("span",{className:custom.circle});t4=/*#__PURE__*/_jsx("span",{className:custom.circle});$[2]=custom.circle;$[3]=t2;$[4]=t3;$[5]=t4;}else{t2=$[3];t3=$[4];t4=$[5];}let t5;if($[6]!==custom.container||$[7]!==t2||$[8]!==t3||$[9]!==t4){t5=/*#__PURE__*/_jsxs("span",{className:custom.container,children:[t2,t3,t4]});$[6]=custom.container;$[7]=t2;$[8]=t3;$[9]=t4;$[10]=t5;}else{t5=$[10];}return t5;};export default Throbber;
10
10
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["useTheme","defaultTheme","jsx","_jsx","jsxs","_jsxs","Throbber","theme","themePriority","custom","className","container","children","circle"],"sources":["../../../../../src/shared/components/Throbber/index.tsx"],"sourcesContent":["import type { FunctionComponent } from 'react';\n\nimport { type PRIORITY, 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 themePriority?: PRIORITY;\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, themePriority }) => {\n const custom = useTheme('Throbber', defaultTheme, theme, {\n themePriority,\n });\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,OAAoCA,QAAQ,KAAQ,0BAA0B,CAE9E,MAAAC,YAAA,+GAAwC,OAAAC,GAAA,IAAAC,IAAA,CAAAC,IAAA,IAAAC,KAAA,yBASxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACA,KAAM,CAAAC,QAAmC,CAAGA,CAAC,CAAEC,KAAK,CAAEC,aAAc,CAAC,GAAK,CACxE,KAAM,CAAAC,MAAM,CAAGT,QAAQ,CAAC,UAAU,CAAEC,YAAY,CAAEM,KAAK,CAAE,CACvDC,aACF,CAAC,CAAC,CAEF,mBACEH,KAAA,SAAMK,SAAS,CAAED,MAAM,CAACE,SAAU,CAAAC,QAAA,eAChCT,IAAA,SAAMO,SAAS,CAAED,MAAM,CAACI,MAAO,CAAE,CAAC,cAClCV,IAAA,SAAMO,SAAS,CAAED,MAAM,CAACI,MAAO,CAAE,CAAC,cAClCV,IAAA,SAAMO,SAAS,CAAED,MAAM,CAACI,MAAO,CAAE,CAAC,EAC9B,CAAC,CAEX,CAAC,CAED,cAAe,CAAAP,QAAQ","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["useTheme","defaultTheme","jsx","_jsx","jsxs","_jsxs","Throbber","t0","$","_c","theme","themePriority","t1","custom","t2","t3","t4","circle","className","t5","container","children"],"sources":["../../../../../src/shared/components/Throbber/index.tsx"],"sourcesContent":["import type { FunctionComponent } from 'react';\n\nimport { type PRIORITY, 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 themePriority?: PRIORITY;\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, themePriority }) => {\n const custom = useTheme('Throbber', defaultTheme, theme, {\n themePriority,\n });\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":"4CAEA,OAAoCA,QAAQ,KAAQ,0BAA0B,CAE9E,MAAAC,YAAA,+GAAwC,OAAAC,GAAA,IAAAC,IAAA,CAAAC,IAAA,IAAAC,KAAA,yBASxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACA,KAAM,CAAAC,QAAmC,CAAGC,EAAA,SAAAC,CAAA,CAAAC,EAAA,KAAC,MAAAC,KAAA,CAAAC,aAAA,EAAAJ,EAAwB,KAAAK,EAAA,IAAAJ,CAAA,MAAAG,aAAA,EACVC,EAAA,EAAAD,aAEzD,CAAC,CAAAH,CAAA,IAAAG,aAAA,CAAAH,CAAA,IAAAI,EAAA,OAAAA,EAAA,CAAAJ,CAAA,KAFD,MAAAK,MAAA,CAAeb,QAAQ,CAAC,UAAU,CAAEC,YAAY,CAAES,KAAK,CAAEE,EAExD,CAAC,CAAC,IAAAE,EAAA,KAAAC,EAAA,KAAAC,EAAA,IAAAR,CAAA,MAAAK,MAAA,CAAAI,MAAA,EAICH,EAAA,cAAAX,IAAA,SAAiBe,SAAa,CAAbL,MAAM,CAAAI,MAAO,CAAG,CAAC,CAClCF,EAAA,cAAAZ,IAAA,SAAiBe,SAAa,CAAbL,MAAM,CAAAI,MAAO,CAAG,CAAC,CAClCD,EAAA,cAAAb,IAAA,SAAiBe,SAAa,CAAbL,MAAM,CAAAI,MAAO,CAAG,CAAC,CAAAT,CAAA,IAAAK,MAAA,CAAAI,MAAA,CAAAT,CAAA,IAAAM,EAAA,CAAAN,CAAA,IAAAO,EAAA,CAAAP,CAAA,IAAAQ,EAAA,OAAAF,EAAA,CAAAN,CAAA,IAAAO,EAAA,CAAAP,CAAA,IAAAQ,EAAA,CAAAR,CAAA,SAAAW,EAAA,IAAAX,CAAA,MAAAK,MAAA,CAAAO,SAAA,EAAAZ,CAAA,MAAAM,EAAA,EAAAN,CAAA,MAAAO,EAAA,EAAAP,CAAA,MAAAQ,EAAA,EAHpCG,EAAA,cAAAd,KAAA,SAAiBa,SAAgB,CAAhBL,MAAM,CAAAO,SAAU,CAAAC,QAAA,EAC/BP,EAAkC,CAClCC,EAAkC,CAClCC,EAAkC,EAC9B,CAAC,CAAAR,CAAA,IAAAK,MAAA,CAAAO,SAAA,CAAAZ,CAAA,IAAAM,EAAA,CAAAN,CAAA,IAAAO,EAAA,CAAAP,CAAA,IAAAQ,EAAA,CAAAR,CAAA,KAAAW,EAAA,OAAAA,EAAA,CAAAX,CAAA,YAJP,CAAAW,EAIO,EAEV,CAED,cAAe,CAAAb,QAAQ","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- /**
1
+ import{c as _c}from"react/compiler-runtime";/**
2
2
  * The actual tooltip component. It is rendered outside the regular document
3
3
  * hierarchy, and with sub-components managed without React to achieve the best
4
4
  * performance during animation.
@@ -88,10 +88,5 @@ baseArrowStyle:ARROW_STYLE_DOWN};}// const HIT = {
88
88
  * @param tooltip
89
89
  * @param tooltip.arrow DOM reference to the tooltip arrow.
90
90
  * @param tooltip.container DOM reference to the tooltip container.
91
- */function setComponentPositions(pageX,pageY,placement,element,tooltip){const tooltipRects=calcTooltipRects(tooltip);const viewportRect=calcViewportRect();/* Default container coords: tooltip at the top. */const pos=calcPositionAboveXY(pageX,pageY,tooltipRects);if(pos.containerX<viewportRect.left+6){pos.containerX=viewportRect.left+6;pos.arrowX=Math.max(6,pageX-pos.containerX-tooltipRects.arrow.width/2);}else{const maxX=viewportRect.right-6-tooltipRects.container.width;if(pos.containerX>maxX){pos.containerX=maxX;pos.arrowX=Math.min(tooltipRects.container.width-6,pageX-pos.containerX-tooltipRects.arrow.width/2);}}/* If tooltip has not enough space on top - make it bottom tooltip. */if(pos.containerY<viewportRect.top+6){pos.containerY+=tooltipRects.container.height+2*tooltipRects.arrow.height;pos.arrowY-=tooltipRects.container.height+tooltipRects.arrow.height;pos.baseArrowStyle=ARROW_STYLE_UP;}const containerStyle=`left:${pos.containerX}px;top:${pos.containerY}px`;tooltip.container.setAttribute("style",containerStyle);const arrowStyle=`${pos.baseArrowStyle};left:${pos.arrowX}px;top:${pos.arrowY}px`;tooltip.arrow.setAttribute("style",arrowStyle);}/* The Tooltip component itself. */const Tooltip=({children,ref,theme})=>{// NOTE: The way it has to be implemented, for clean mounting and unmounting
92
- // at the client side, the <Tooltip> is fully mounted into DOM in the next
93
- // rendering cycles, and only then it can be correctly measured and positioned.
94
- // Thus, when we create the <Tooltip> we have to record its target positioning
95
- // details, and then apply them when it is created.
96
- const arrowRef=useRef(null);const containerRef=useRef(null);const contentRef=useRef(null);const pointTo=(pageX,pageY,placement,element)=>{if(!arrowRef.current||!containerRef.current||!contentRef.current){throw Error("Internal error");}setComponentPositions(pageX,pageY,placement,element,{arrow:arrowRef.current,container:containerRef.current,content:contentRef.current});};useImperativeHandle(ref,()=>({pointTo}));return/*#__PURE__*/createPortal(/*#__PURE__*/_jsxs("div",{className:theme.container,ref:containerRef,children:[/*#__PURE__*/_jsx("div",{className:theme.arrow,ref:arrowRef}),/*#__PURE__*/_jsx("div",{className:theme.content,ref:contentRef,children:children})]}),document.body);};export default Tooltip;
91
+ */function setComponentPositions(pageX,pageY,placement,element,tooltip){const tooltipRects=calcTooltipRects(tooltip);const viewportRect=calcViewportRect();/* Default container coords: tooltip at the top. */const pos=calcPositionAboveXY(pageX,pageY,tooltipRects);if(pos.containerX<viewportRect.left+6){pos.containerX=viewportRect.left+6;pos.arrowX=Math.max(6,pageX-pos.containerX-tooltipRects.arrow.width/2);}else{const maxX=viewportRect.right-6-tooltipRects.container.width;if(pos.containerX>maxX){pos.containerX=maxX;pos.arrowX=Math.min(tooltipRects.container.width-6,pageX-pos.containerX-tooltipRects.arrow.width/2);}}/* If tooltip has not enough space on top - make it bottom tooltip. */if(pos.containerY<viewportRect.top+6){pos.containerY+=tooltipRects.container.height+2*tooltipRects.arrow.height;pos.arrowY-=tooltipRects.container.height+tooltipRects.arrow.height;pos.baseArrowStyle=ARROW_STYLE_UP;}const containerStyle=`left:${pos.containerX}px;top:${pos.containerY}px`;tooltip.container.setAttribute("style",containerStyle);const arrowStyle=`${pos.baseArrowStyle};left:${pos.arrowX}px;top:${pos.arrowY}px`;tooltip.arrow.setAttribute("style",arrowStyle);}/* The Tooltip component itself. */const Tooltip=t0=>{const $=_c(11);const{children,ref,theme}=t0;const arrowRef=useRef(null);const containerRef=useRef(null);const contentRef=useRef(null);let t1;if($[0]===Symbol.for("react.memo_cache_sentinel")){t1=(pageX,pageY,placement,element)=>{if(!arrowRef.current||!containerRef.current||!contentRef.current){throw Error("Internal error");}setComponentPositions(pageX,pageY,placement,element,{arrow:arrowRef.current,container:containerRef.current,content:contentRef.current});};$[0]=t1;}else{t1=$[0];}const pointTo=t1;let t2;if($[1]===Symbol.for("react.memo_cache_sentinel")){t2=()=>({pointTo});$[1]=t2;}else{t2=$[1];}useImperativeHandle(ref,t2);let t3;if($[2]!==theme.arrow){t3=/*#__PURE__*/_jsx("div",{className:theme.arrow,ref:arrowRef});$[2]=theme.arrow;$[3]=t3;}else{t3=$[3];}let t4;if($[4]!==children||$[5]!==theme.content){t4=/*#__PURE__*/_jsx("div",{className:theme.content,ref:contentRef,children:children});$[4]=children;$[5]=theme.content;$[6]=t4;}else{t4=$[6];}let t5;if($[7]!==t3||$[8]!==t4||$[9]!==theme.container){t5=/*#__PURE__*/createPortal(/*#__PURE__*/_jsxs("div",{className:theme.container,ref:containerRef,children:[t3,t4]}),document.body);$[7]=t3;$[8]=t4;$[9]=theme.container;$[10]=t5;}else{t5=$[10];}return t5;};export default Tooltip;
97
92
  //# sourceMappingURL=Tooltip.js.map