@dr.pogodin/react-utils 1.53.1 → 1.54.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (145) 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 +2 -2
  40. package/build/development/shared/utils/index.js.map +1 -1
  41. package/build/development/shared/utils/jest/index.js +19 -7
  42. package/build/development/shared/utils/jest/index.js.map +1 -1
  43. package/build/development/shared/utils/splitComponent.js +125 -55
  44. package/build/development/shared/utils/splitComponent.js.map +1 -1
  45. package/build/development/shared/utils/time.js +55 -20
  46. package/build/development/shared/utils/time.js.map +1 -1
  47. package/build/production/client/index.js +2 -2
  48. package/build/production/client/index.js.map +1 -1
  49. package/build/production/index.js +1 -1
  50. package/build/production/index.js.map +1 -1
  51. package/build/production/shared/components/Button/index.js +2 -13
  52. package/build/production/shared/components/Button/index.js.map +1 -1
  53. package/build/production/shared/components/Checkbox/index.js +1 -1
  54. package/build/production/shared/components/Checkbox/index.js.map +1 -1
  55. package/build/production/shared/components/GenericLink/index.js +2 -15
  56. package/build/production/shared/components/GenericLink/index.js.map +1 -1
  57. package/build/production/shared/components/Input/index.js +2 -11
  58. package/build/production/shared/components/Input/index.js.map +1 -1
  59. package/build/production/shared/components/Link.js +2 -4
  60. package/build/production/shared/components/Link.js.map +1 -1
  61. package/build/production/shared/components/Modal/index.js +2 -10
  62. package/build/production/shared/components/Modal/index.js.map +1 -1
  63. package/build/production/shared/components/NavLink.js +1 -4
  64. package/build/production/shared/components/NavLink.js.map +1 -1
  65. package/build/production/shared/components/PageLayout/index.js +2 -2
  66. package/build/production/shared/components/PageLayout/index.js.map +1 -1
  67. package/build/production/shared/components/TextArea/index.js +1 -21
  68. package/build/production/shared/components/TextArea/index.js.map +1 -1
  69. package/build/production/shared/components/Throbber/index.js +2 -2
  70. package/build/production/shared/components/Throbber/index.js.map +1 -1
  71. package/build/production/shared/components/WithTooltip/Tooltip.js +2 -7
  72. package/build/production/shared/components/WithTooltip/Tooltip.js.map +1 -1
  73. package/build/production/shared/components/WithTooltip/index.js +3 -3
  74. package/build/production/shared/components/WithTooltip/index.js.map +1 -1
  75. package/build/production/shared/components/YouTubeVideo/index.js +2 -5
  76. package/build/production/shared/components/YouTubeVideo/index.js.map +1 -1
  77. package/build/production/shared/components/selectors/CustomDropdown/Options/index.js +1 -6
  78. package/build/production/shared/components/selectors/CustomDropdown/Options/index.js.map +1 -1
  79. package/build/production/shared/components/selectors/CustomDropdown/index.js +1 -7
  80. package/build/production/shared/components/selectors/CustomDropdown/index.js.map +1 -1
  81. package/build/production/shared/components/selectors/Switch/index.js +1 -1
  82. package/build/production/shared/components/selectors/Switch/index.js.map +1 -1
  83. package/build/production/shared/utils/globalState.js +1 -1
  84. package/build/production/shared/utils/globalState.js.map +1 -1
  85. package/build/production/shared/utils/index.js +1 -1
  86. package/build/production/shared/utils/index.js.map +1 -1
  87. package/build/production/shared/utils/jest/index.js +10 -3
  88. package/build/production/shared/utils/jest/index.js.map +1 -1
  89. package/build/production/shared/utils/splitComponent.js +3 -10
  90. package/build/production/shared/utils/splitComponent.js.map +1 -1
  91. package/build/production/shared/utils/time.js +2 -2
  92. package/build/production/shared/utils/time.js.map +1 -1
  93. package/build/types-code/index.d.ts +2 -2
  94. package/build/types-code/shared/utils/globalState.d.ts +2 -2
  95. package/build/types-code/shared/utils/index.d.ts +2 -2
  96. package/build/types-code/shared/utils/splitComponent.d.ts +1 -0
  97. package/build/web/client/index.js +2 -2
  98. package/build/web/client/index.js.map +1 -1
  99. package/build/web/index.js +1 -1
  100. package/build/web/index.js.map +1 -1
  101. package/build/web/shared/components/Button/index.js +2 -13
  102. package/build/web/shared/components/Button/index.js.map +1 -1
  103. package/build/web/shared/components/Checkbox/index.js +1 -1
  104. package/build/web/shared/components/Checkbox/index.js.map +1 -1
  105. package/build/web/shared/components/GenericLink/index.js +2 -15
  106. package/build/web/shared/components/GenericLink/index.js.map +1 -1
  107. package/build/web/shared/components/Input/index.js +2 -11
  108. package/build/web/shared/components/Input/index.js.map +1 -1
  109. package/build/web/shared/components/Link.js +2 -4
  110. package/build/web/shared/components/Link.js.map +1 -1
  111. package/build/web/shared/components/Modal/index.js +2 -10
  112. package/build/web/shared/components/Modal/index.js.map +1 -1
  113. package/build/web/shared/components/NavLink.js +1 -4
  114. package/build/web/shared/components/NavLink.js.map +1 -1
  115. package/build/web/shared/components/PageLayout/index.js +2 -2
  116. package/build/web/shared/components/PageLayout/index.js.map +1 -1
  117. package/build/web/shared/components/TextArea/index.js +1 -21
  118. package/build/web/shared/components/TextArea/index.js.map +1 -1
  119. package/build/web/shared/components/Throbber/index.js +2 -2
  120. package/build/web/shared/components/Throbber/index.js.map +1 -1
  121. package/build/web/shared/components/WithTooltip/Tooltip.js +2 -7
  122. package/build/web/shared/components/WithTooltip/Tooltip.js.map +1 -1
  123. package/build/web/shared/components/WithTooltip/index.js +3 -3
  124. package/build/web/shared/components/WithTooltip/index.js.map +1 -1
  125. package/build/web/shared/components/YouTubeVideo/index.js +2 -5
  126. package/build/web/shared/components/YouTubeVideo/index.js.map +1 -1
  127. package/build/web/shared/components/selectors/CustomDropdown/Options/index.js +1 -6
  128. package/build/web/shared/components/selectors/CustomDropdown/Options/index.js.map +1 -1
  129. package/build/web/shared/components/selectors/CustomDropdown/index.js +1 -7
  130. package/build/web/shared/components/selectors/CustomDropdown/index.js.map +1 -1
  131. package/build/web/shared/components/selectors/Switch/index.js +1 -1
  132. package/build/web/shared/components/selectors/Switch/index.js.map +1 -1
  133. package/build/web/shared/utils/globalState.js +1 -1
  134. package/build/web/shared/utils/globalState.js.map +1 -1
  135. package/build/web/shared/utils/index.js +1 -1
  136. package/build/web/shared/utils/index.js.map +1 -1
  137. package/build/web/shared/utils/jest/index.js +10 -3
  138. package/build/web/shared/utils/jest/index.js.map +1 -1
  139. package/build/web/shared/utils/splitComponent.js +3 -10
  140. package/build/web/shared/utils/splitComponent.js.map +1 -1
  141. package/build/web/shared/utils/time.js +2 -2
  142. package/build/web/shared/utils/time.js.map +1 -1
  143. package/config/babel/webpack.d.ts +1 -0
  144. package/config/babel/webpack.js +10 -12
  145. package/package.json +6 -4
@@ -1,3 +1,4 @@
1
+ import { c as _c } from "react/compiler-runtime";
1
2
  const S = {
2
3
  "link": "-dr-pogodin-react-utils___build-web-shared-components-GenericLink-style___link___hXmkf-"
3
4
  };
@@ -41,65 +42,143 @@ import { jsx as _jsx } from "react/jsx-runtime"; /**
41
42
  * determining if the location matches the current URL. See the `<Route strict>`
42
43
  * documentation for more information.
43
44
  */
44
- const GenericLink = ({
45
- children,
46
- className,
47
- disabled,
48
- enforceA,
49
- keepScrollPosition,
50
- onClick,
51
- onMouseDown,
52
- openNewTab,
53
- replace,
54
- routerLinkType,
55
- to,
56
- ...rest
57
- }) => {
58
- /* Renders Link as <a> element if:
59
- * - It is opted explicitely by `enforceA` prop;
60
- * - It should be opened in a new tab;
61
- * - It is an absolte URL (starts with http:// or https://);
62
- * - It is anchor link (starts with #). */
45
+ const GenericLink = t0 => {
46
+ const $ = _c(32);
47
+ let children;
48
+ let className;
49
+ let disabled;
50
+ let enforceA;
51
+ let keepScrollPosition;
52
+ let onClick;
53
+ let onMouseDown;
54
+ let openNewTab;
55
+ let replace;
56
+ let rest;
57
+ let routerLinkType;
58
+ let to;
59
+ if ($[0] !== t0) {
60
+ ({
61
+ children,
62
+ className,
63
+ disabled,
64
+ enforceA,
65
+ keepScrollPosition,
66
+ onClick,
67
+ onMouseDown,
68
+ openNewTab,
69
+ replace,
70
+ routerLinkType,
71
+ to,
72
+ ...rest
73
+ } = t0);
74
+ $[0] = t0;
75
+ $[1] = children;
76
+ $[2] = className;
77
+ $[3] = disabled;
78
+ $[4] = enforceA;
79
+ $[5] = keepScrollPosition;
80
+ $[6] = onClick;
81
+ $[7] = onMouseDown;
82
+ $[8] = openNewTab;
83
+ $[9] = replace;
84
+ $[10] = rest;
85
+ $[11] = routerLinkType;
86
+ $[12] = to;
87
+ } else {
88
+ children = $[1];
89
+ className = $[2];
90
+ disabled = $[3];
91
+ enforceA = $[4];
92
+ keepScrollPosition = $[5];
93
+ onClick = $[6];
94
+ onMouseDown = $[7];
95
+ openNewTab = $[8];
96
+ replace = $[9];
97
+ rest = $[10];
98
+ routerLinkType = $[11];
99
+ to = $[12];
100
+ }
63
101
  if (disabled || enforceA || openNewTab || to.match(/^(#|(https?|mailto):)/)) {
64
102
  let aClassName = S.link;
65
- if (className) aClassName += ` ${className}`;
66
- return /*#__PURE__*/_jsx("a", {
67
- className: aClassName // TODO: This requires a fix: disabled is not really an attribute of <a>
68
- // tag, thus for disabled option we rather should render a plain text
69
- // styled as a link.
70
- // disabled={disabled}
71
- ,
72
- href: to,
73
- onClick: disabled ? e => {
74
- e.preventDefault();
75
- } : onClick,
76
- onMouseDown: disabled ? e => {
77
- e.preventDefault();
78
- } : onMouseDown,
79
- rel: "noopener noreferrer",
80
- styleName: "link",
81
- target: openNewTab ? "_blank" : "",
103
+ if (className) {
104
+ aClassName = aClassName + ` ${className}`;
105
+ }
106
+ const t1 = to;
107
+ const t2 = disabled ? _temp : onClick;
108
+ const t3 = disabled ? _temp2 : onMouseDown;
109
+ const t4 = openNewTab ? "_blank" : "";
110
+ let t5;
111
+ if ($[13] !== aClassName || $[14] !== children || $[15] !== t1 || $[16] !== t2 || $[17] !== t3 || $[18] !== t4) {
112
+ t5 = /*#__PURE__*/_jsx("a", {
113
+ className: aClassName,
114
+ href: t1,
115
+ onClick: t2,
116
+ onMouseDown: t3,
117
+ rel: "noopener noreferrer",
118
+ styleName: "link",
119
+ target: t4,
120
+ children: children
121
+ });
122
+ $[13] = aClassName;
123
+ $[14] = children;
124
+ $[15] = t1;
125
+ $[16] = t2;
126
+ $[17] = t3;
127
+ $[18] = t4;
128
+ $[19] = t5;
129
+ } else {
130
+ t5 = $[19];
131
+ }
132
+ return t5;
133
+ }
134
+ const L = routerLinkType;
135
+ let t1;
136
+ if ($[20] !== keepScrollPosition || $[21] !== onClick) {
137
+ t1 = e_1 => {
138
+ if (onClick) {
139
+ onClick(e_1);
140
+ }
141
+ if (!keepScrollPosition) {
142
+ window.scroll(0, 0);
143
+ }
144
+ };
145
+ $[20] = keepScrollPosition;
146
+ $[21] = onClick;
147
+ $[22] = t1;
148
+ } else {
149
+ t1 = $[22];
150
+ }
151
+ let t2;
152
+ if ($[23] !== L || $[24] !== children || $[25] !== className || $[26] !== onMouseDown || $[27] !== replace || $[28] !== rest || $[29] !== t1 || $[30] !== to) {
153
+ t2 = /*#__PURE__*/_jsx(L, {
154
+ className: className,
155
+ discover: "none",
156
+ onClick: t1,
157
+ onMouseDown: onMouseDown,
158
+ replace: replace,
159
+ to: to,
160
+ ...rest,
82
161
  children: children
83
162
  });
163
+ $[23] = L;
164
+ $[24] = children;
165
+ $[25] = className;
166
+ $[26] = onMouseDown;
167
+ $[27] = replace;
168
+ $[28] = rest;
169
+ $[29] = t1;
170
+ $[30] = to;
171
+ $[31] = t2;
172
+ } else {
173
+ t2 = $[31];
84
174
  }
85
- const L = routerLinkType;
86
- return /*#__PURE__*/_jsx(L, {
87
- className: className,
88
- discover: "none" // disabled
89
- ,
90
- onClick: e => {
91
- // Executes the user-provided event handler, if any.
92
- if (onClick) onClick(e); // By default, clicking the link scrolls the page to beginning.
93
- if (!keepScrollPosition) window.scroll(0, 0);
94
- },
95
- onMouseDown: onMouseDown,
96
- replace: replace,
97
- to: to // TODO: Refactor it later.
98
- // eslint-disable-next-line react/jsx-props-no-spreading
99
- ,
100
- ...rest,
101
- children: children
102
- });
175
+ return t2;
103
176
  };
104
177
  export default GenericLink;
178
+ function _temp(e) {
179
+ e.preventDefault();
180
+ }
181
+ function _temp2(e_0) {
182
+ e_0.preventDefault();
183
+ }
105
184
  //# 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":";;;AAS6B,SAAAA,GAAA,IAAAC,IAAA,4BAqB7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,WAAW,GAAGA,CAAC;EACnBC,QAAQ;EACRC,SAAS;EACTC,QAAQ;EACRC,QAAQ;EACRC,kBAAkB;EAClBC,OAAO;EACPC,WAAW;EACXC,UAAU;EACVC,OAAO;EACPC,cAAc;EACdC,EAAE;EACF,GAAGC;AACgC,CAAC,KAAgB;EACpD;AACF;AACA;AACA;AACA;EACE,IAAIT,QAAQ,IAAIC,QAAQ,IAAII,UAAU,IAChCG,EAAE,CAAYE,KAAK,CAAC,uBAAuB,CAAC,EAAE;IAClD,IAAIC,UAAkB,GAAGC,CAAC,CAACC,IAAI;IAC/B,IAAId,SAAS,EAAEY,UAAU,IAAI,IAAIZ,SAAS,EAAE;IAE5C,oBACEH,IAAA;MACEG,SAAS,EAAEY,UACX;MACA;MACA;MACA;MAAA;MACAG,IAAI,EAAEN,EAAa;MACnBL,OAAO,EAAEH,QAAQ,GAAIe,CAAC,IAAK;QACzBA,CAAC,CAACC,cAAc,CAAC,CAAC;MACpB,CAAC,GAAGb,OAAQ;MACZC,WAAW,EAAEJ,QAAQ,GAAIe,CAAC,IAAK;QAC7BA,CAAC,CAACC,cAAc,CAAC,CAAC;MACpB,CAAC,GAAGZ,WAAY;MAChBa,GAAG,EAAC,qBAAqB;MACzBC,SAAS,EAAC,MAAM;MAChBC,MAAM,EAAEd,UAAU,GAAG,QAAQ,GAAG,EAAG;MAAAP,QAAA,EAElCA;IAAQ,CACR,CAAC;EAER;EAEA,MAAMsB,CAAC,GAAGb,cAAc;EAExB,oBACEX,IAAA,CAACwB,CAAC;IACArB,SAAS,EAAEA,SAAU;IACrBsB,QAAQ,EAAC,MACT;IAAA;IACAlB,OAAO,EAAGY,CAAsC,IAAK;MACnD;MACA,IAAIZ,OAAO,EAAEA,OAAO,CAACY,CAAC,CAAC,CAEvB;MACA,IAAI,CAACb,kBAAkB,EAAEoB,MAAM,CAACC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC;IAC9C,CAAE;IACFnB,WAAW,EAAEA,WAAY;IACzBE,OAAO,EAAEA,OAAQ;IACjBE,EAAE,EAAEA,EACJ;IACA;IAAA;IAAA,GACIC,IAAI;IAAAX,QAAA,EAEPA;EAAQ,CACR,CAAC;AAER,CAAC;AAED,eAAeD,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":";AASA,MAAAA,CAAA;EAAA;AAAA;AAA6B,SAAAC,GAAA,IAAAC,IAAA,4BAqB7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,WAAW,GAAGC,EAAA;EAAA,MAAAC,CAAA,GAAAC,EAAA;EAAA,IAAAC,QAAA;EAAA,IAAAC,SAAA;EAAA,IAAAC,QAAA;EAAA,IAAAC,QAAA;EAAA,IAAAC,kBAAA;EAAA,IAAAC,OAAA;EAAA,IAAAC,WAAA;EAAA,IAAAC,UAAA;EAAA,IAAAC,OAAA;EAAA,IAAAC,IAAA;EAAA,IAAAC,cAAA;EAAA,IAAAC,EAAA;EAAA,IAAAb,CAAA,QAAAD,EAAA;IAAC;MAAAG,QAAA;MAAAC,SAAA;MAAAC,QAAA;MAAAC,QAAA;MAAAC,kBAAA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F,CAAA,SAAAG,SAAA,IAAAH,CAAA,SAAAQ,WAAA,IAAAR,CAAA,SAAAU,OAAA,IAAAV,CAAA,SAAAW,IAAA,IAAAX,CAAA,SAAAiB,EAAA,IAAAjB,CAAA,SAAAa,EAAA;IAVHK,EAAA,gBAAArB,IAAA,CAAC+B,CAAC;MACWzB,SAAS,EAATA,SAAS;MACX6B,QAAM,EAAN,MAAM;MAENzB,OAMR,EANQU,EAMR;MACYT,WAAW,EAAXA,WAAW;MACfE,OAAO,EAAPA,OAAO;MACZG,EAAE,EAAFA,EAAE;MAAA,GAGFF,IAAI;MAAAT,QAAA,EAEPA;IAAQ,CACR,CAAC;IAAAF,CAAA,OAAA4B,CAAA;IAAA5B,CAAA,OAAAE,QAAA;IAAAF,CAAA,OAAAG,SAAA;IAAAH,CAAA,OAAAQ,WAAA;IAAAR,CAAA,OAAAU,OAAA;IAAAV,CAAA,OAAAW,IAAA;IAAAX,CAAA,OAAAiB,EAAA;IAAAjB,CAAA,OAAAa,EAAA;IAAAb,CAAA,OAAAkB,EAAA;EAAA;IAAAA,EAAA,GAAAlB,CAAA;EAAA;EAAA,OAnBJkB,EAmBI;AAAA,CAEP;AAED,eAAepB,WAAW;AAzEN,SAAAqB,MAAAc,CAAA;EAiCVA,CAAC,CAAAC,cAAe,CAAC,CAAC;AAAA;AAjCR,SAAAb,OAAAc,GAAA;EAoCVA,GAAC,CAAAD,cAAe,CAAC,CAAC;AAAA","ignoreList":[]}
@@ -1,3 +1,4 @@
1
+ import { c as _c } from "react/compiler-runtime";
1
2
  import { useRef, useState } from "react";
2
3
  import { useTheme } from "@dr.pogodin/react-themes";
3
4
  const defaultTheme = {
@@ -19,61 +20,183 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; /**
19
20
  * @param [props...] Any other properties are passed to the underlying
20
21
  * `<input>` element.
21
22
  */
22
- const Input = ({
23
- children,
24
- composeAdhocTheme,
25
- error,
26
- label,
27
- ref,
28
- testId,
29
- theme,
30
- ...rest
31
- }) => {
32
- const composed = useTheme("Input", defaultTheme, theme, {
33
- composeAdhocTheme
34
- }); // NOTE: As of now, it is only updated when "theme.focused" is defined,
35
- // as otherwise its value is not used.
23
+ const Input = t0 => {
24
+ const $ = _c(42);
25
+ let children;
26
+ let composeAdhocTheme;
27
+ let error;
28
+ let label;
29
+ let ref;
30
+ let rest;
31
+ let testId;
32
+ let theme;
33
+ if ($[0] !== t0) {
34
+ ({
35
+ children,
36
+ composeAdhocTheme,
37
+ error,
38
+ label,
39
+ ref,
40
+ testId,
41
+ theme,
42
+ ...rest
43
+ } = t0);
44
+ $[0] = t0;
45
+ $[1] = children;
46
+ $[2] = composeAdhocTheme;
47
+ $[3] = error;
48
+ $[4] = label;
49
+ $[5] = ref;
50
+ $[6] = rest;
51
+ $[7] = testId;
52
+ $[8] = theme;
53
+ } else {
54
+ children = $[1];
55
+ composeAdhocTheme = $[2];
56
+ error = $[3];
57
+ label = $[4];
58
+ ref = $[5];
59
+ rest = $[6];
60
+ testId = $[7];
61
+ theme = $[8];
62
+ }
63
+ let t1;
64
+ if ($[9] !== composeAdhocTheme) {
65
+ t1 = {
66
+ composeAdhocTheme
67
+ };
68
+ $[9] = composeAdhocTheme;
69
+ $[10] = t1;
70
+ } else {
71
+ t1 = $[10];
72
+ }
73
+ const composed = useTheme("Input", defaultTheme, theme, t1);
36
74
  const [focused, setFocused] = useState(false);
37
75
  const localRef = useRef(null);
38
- let containerClassName = composed.container; // NOTE: As of now, "focused" can be true only when "theme.focused"
39
- // is provided.
40
- if (focused /* && theme.focused */) containerClassName += ` ${composed.focused}`;
41
- if (!rest.value && composed.empty) containerClassName += ` ${composed.empty}`;
42
- if (error) containerClassName += ` ${composed.error}`;
43
- return /*#__PURE__*/_jsxs("div", {
44
- className: containerClassName,
45
- onFocus: () => {
46
- // TODO: It does not really work if a callback-style `ref` is passed in,
47
- // we need a more complex logic to cover that case, but for now this serves
48
- // the case we need it for.
49
- if (typeof ref === "object") ref?.current?.focus();else localRef.current?.focus();
50
- },
51
- children: [label === undefined ? null : /*#__PURE__*/_jsx("div", {
76
+ let containerClassName = composed.container;
77
+ if (focused) {
78
+ containerClassName = containerClassName + ` ${composed.focused}`;
79
+ }
80
+ if (!rest.value && composed.empty) {
81
+ containerClassName = containerClassName + ` ${composed.empty}`;
82
+ }
83
+ if (error) {
84
+ containerClassName = containerClassName + ` ${composed.error}`;
85
+ }
86
+ let t2;
87
+ if ($[11] !== ref) {
88
+ t2 = () => {
89
+ if (typeof ref === "object") {
90
+ ref?.current?.focus();
91
+ } else {
92
+ localRef.current?.focus();
93
+ }
94
+ };
95
+ $[11] = ref;
96
+ $[12] = t2;
97
+ } else {
98
+ t2 = $[12];
99
+ }
100
+ let t3;
101
+ if ($[13] !== composed.label || $[14] !== label) {
102
+ t3 = label === undefined ? null : /*#__PURE__*/_jsx("div", {
52
103
  className: composed.label,
53
104
  children: label
54
- }), /*#__PURE__*/_jsx("input", {
105
+ });
106
+ $[13] = composed.label;
107
+ $[14] = label;
108
+ $[15] = t3;
109
+ } else {
110
+ t3 = $[15];
111
+ }
112
+ const t4 = process.env.NODE_ENV === "production" ? undefined : testId;
113
+ const t5 = ref ?? localRef;
114
+ let t6;
115
+ if ($[16] !== composed.focused || $[17] !== rest) {
116
+ t6 = composed.focused ? e => {
117
+ setFocused(false);
118
+ rest.onBlur?.(e);
119
+ } : rest.onBlur;
120
+ $[16] = composed.focused;
121
+ $[17] = rest;
122
+ $[18] = t6;
123
+ } else {
124
+ t6 = $[18];
125
+ }
126
+ let t7;
127
+ if ($[19] !== composed.focused || $[20] !== rest) {
128
+ t7 = composed.focused ? e_0 => {
129
+ setFocused(true);
130
+ rest.onFocus?.(e_0);
131
+ } : rest.onFocus;
132
+ $[19] = composed.focused;
133
+ $[20] = rest;
134
+ $[21] = t7;
135
+ } else {
136
+ t7 = $[21];
137
+ }
138
+ let t8;
139
+ if ($[22] !== composed.input || $[23] !== rest || $[24] !== t4 || $[25] !== t5 || $[26] !== t6 || $[27] !== t7) {
140
+ t8 = /*#__PURE__*/_jsx("input", {
55
141
  className: composed.input,
56
- "data-testid": process.env.NODE_ENV === "production" ? undefined : testId,
57
- ref: ref ?? localRef // TODO: Avoid the spreading later.
58
- // eslint-disable-next-line react/jsx-props-no-spreading
59
- ,
142
+ "data-testid": t4,
143
+ ref: t5,
60
144
  ...rest,
61
- onBlur: composed.focused ? e => {
62
- setFocused(false);
63
- rest.onBlur?.(e);
64
- } : rest.onBlur,
65
- onFocus: composed.focused ? e => {
66
- setFocused(true);
67
- rest.onFocus?.(e);
68
- } : rest.onFocus
69
- }), error && error !== true ? /*#__PURE__*/_jsx("div", {
145
+ onBlur: t6,
146
+ onFocus: t7
147
+ });
148
+ $[22] = composed.input;
149
+ $[23] = rest;
150
+ $[24] = t4;
151
+ $[25] = t5;
152
+ $[26] = t6;
153
+ $[27] = t7;
154
+ $[28] = t8;
155
+ } else {
156
+ t8 = $[28];
157
+ }
158
+ let t9;
159
+ if ($[29] !== composed.errorMessage || $[30] !== error) {
160
+ t9 = error && error !== true ? /*#__PURE__*/_jsx("div", {
70
161
  className: composed.errorMessage,
71
162
  children: error
72
- }) : null, children ? /*#__PURE__*/_jsx("div", {
163
+ }) : null;
164
+ $[29] = composed.errorMessage;
165
+ $[30] = error;
166
+ $[31] = t9;
167
+ } else {
168
+ t9 = $[31];
169
+ }
170
+ let t10;
171
+ if ($[32] !== children || $[33] !== composed.children) {
172
+ t10 = children ? /*#__PURE__*/_jsx("div", {
73
173
  className: composed.children,
74
174
  children: children
75
- }) : null]
76
- });
175
+ }) : null;
176
+ $[32] = children;
177
+ $[33] = composed.children;
178
+ $[34] = t10;
179
+ } else {
180
+ t10 = $[34];
181
+ }
182
+ let t11;
183
+ if ($[35] !== containerClassName || $[36] !== t10 || $[37] !== t2 || $[38] !== t3 || $[39] !== t8 || $[40] !== t9) {
184
+ t11 = /*#__PURE__*/_jsxs("div", {
185
+ className: containerClassName,
186
+ onFocus: t2,
187
+ children: [t3, t8, t9, t10]
188
+ });
189
+ $[35] = containerClassName;
190
+ $[36] = t10;
191
+ $[37] = t2;
192
+ $[38] = t3;
193
+ $[39] = t8;
194
+ $[40] = t9;
195
+ $[41] = t11;
196
+ } else {
197
+ t11 = $[41];
198
+ }
199
+ return t11;
77
200
  };
78
201
  export default Input;
79
202
  //# 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}>{children}</div> : null}\n </div>\n );\n};\n\nexport default Input;\n"],"mappings":"AAAA,SAIEA,MAAM,EACNC,QAAQ,QACH,OAAO;AAEd,SAAmCC,QAAQ,QAAQ,0BAA0B;AAE7E,MAAAC,YAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAAwC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA,4BAexC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,KAAgC,GAAGA,CAAC;EACxCC,QAAQ;EACRC,iBAAiB;EACjBC,KAAK;EACLC,KAAK;EACLC,GAAG;EACHC,MAAM;EACNC,KAAK;EACL,GAAGC;AACL,CAAC,KAAK;EACJ,MA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AAIiB,CAAC,IAAK;QAChChB,UAAU,CAAC,KAAK,CAAC;QACjBH,IAAI,CAACkB,MAAM,GAAGC,CAAC,CAAC;MAClB,CAAC,GAAGnB,IAAI,CAACkB,MAAO;MAChBR,OAAO,EAAET,QAAQ,CAACC,OAAO,GAAIiB,CAAC,IAAK;QACjChB,UAAU,CAAC,IAAI,CAAC;QAChBH,IAAI,CAACU,OAAO,GAAGS,CAAC,CAAC;MACnB,CAAC,GAAGnB,IAAI,CAACU;IAAQ,CAClB,CAAC,EACDf,KAAK,IAAIA,KAAK,KAAK,IAAI,gBACpBN,IAAA;MAAKoB,SAAS,EAAER,QAAQ,CAACmB,YAAa;MAAA3B,QAAA,EAAEE;IAAK,CAAM,CAAC,GACpD,IAAI,EACPF,QAAQ,gBAAGJ,IAAA;MAAKoB,SAAS,EAAER,QAAQ,CAACR,QAAS;MAAAA,QAAA,EAAEA;IAAQ,CAAM,CAAC,GAAG,IAAI;EAAA,CACnE,CAAC;AAEV,CAAC;AAED,eAAeD,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}>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Q,CAAa,CAAC,GAArE,IAAqE;IAAAF,CAAA,OAAAE,QAAA;IAAAF,CAAA,OAAAW,QAAA,CAAAT,QAAA;IAAAF,CAAA,OAAAwC,GAAA;EAAA;IAAAA,GAAA,GAAAxC,CAAA;EAAA;EAAA,IAAAyC,GAAA;EAAA,IAAAzC,CAAA,SAAAe,kBAAA,IAAAf,CAAA,SAAAwC,GAAA,IAAAxC,CAAA,SAAAmB,EAAA,IAAAnB,CAAA,SAAAsB,EAAA,IAAAtB,CAAA,SAAAoC,EAAA,IAAApC,CAAA,SAAAsC,EAAA;IAjCxEG,GAAA,gBAAA5C,KAAA;MACa2B,SAAkB,EAAlBT,kBAAkB;MACpBoB,OAMR,EANQhB,EAMR;MAAAjB,QAAA,GAEAoB,EACuD,EACxDc,EAiBE,EACDE,EAEO,EACPE,GAAqE;IAAA,CACnE,CAAC;IAAAxC,CAAA,OAAAe,kBAAA;IAAAf,CAAA,OAAAwC,GAAA;IAAAxC,CAAA,OAAAmB,EAAA;IAAAnB,CAAA,OAAAsB,EAAA;IAAAtB,CAAA,OAAAoC,EAAA;IAAApC,CAAA,OAAAsC,EAAA;IAAAtC,CAAA,OAAAyC,GAAA;EAAA;IAAAA,GAAA,GAAAzC,CAAA;EAAA;EAAA,OAlCNyC,GAkCM;AAAA,CAET;AAED,eAAe3C,KAAK","ignoreList":[]}
@@ -1,17 +1,27 @@
1
- /**
2
- * The Link wraps around React Router's Link component, to automatically replace
3
- * it by the regular <a> element when:
4
- * - The target reference points to another domain;
5
- * - User opts to open the reference in a new tab;
6
- * - User explicitely opts to use <a>.
7
- */import { Link as RrLink } from "react-router";
1
+ import { c as _c } from "react/compiler-runtime"; /**
2
+ * The Link wraps around React Router's Link component, to automatically replace
3
+ * it by the regular <a> element when:
4
+ * - The target reference points to another domain;
5
+ * - User opts to open the reference in a new tab;
6
+ * - User explicitely opts to use <a>.
7
+ */
8
+ import { Link as RrLink } from "react-router";
8
9
  import GenericLink from "./GenericLink/index.js";
9
10
  import { jsx as _jsx } from "react/jsx-runtime";
10
- const Link = props => /*#__PURE__*/_jsx(GenericLink // TODO: Avoid the spreading later.
11
- // eslint-disable-next-line react/jsx-props-no-spreading
12
- , {
13
- ...props,
14
- routerLinkType: RrLink
15
- });
11
+ const Link = props => {
12
+ const $ = _c(2);
13
+ let t0;
14
+ if ($[0] !== props) {
15
+ t0 = /*#__PURE__*/_jsx(GenericLink, {
16
+ ...props,
17
+ routerLinkType: RrLink
18
+ });
19
+ $[0] = props;
20
+ $[1] = t0;
21
+ } else {
22
+ t0 = $[1];
23
+ }
24
+ return t0;
25
+ };
16
26
  export default Link;
17
27
  //# 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,SAAyBA,IAAI,IAAIC,MAAM,QAAQ,cAAc;AAE7D,OAAOC,WAAW;AAA4D,SAAAC,GAAA,IAAAC,IAAA;AAI9E,MAAMJ,IAAqC,GACtCK,KAAK,iBACND,IAAA,CAACF,WACC;AACA;AAAA;EAAA,GACIG,KAAK;EACTC,cAAc,EAAEL;AAAO,CACxB,CACF;AAEH,eAAeD,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":"iDAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,SAAyBA,IAAI,IAAIC,MAAM,QAAQ,cAAc;AAE7D,OAAOC,WAAW;AAA4D,SAAAC,GAAA,IAAAC,IAAA;AAI9E,MAAMJ,IAAqC,GACvCK,KAAA;EAAA,MAAAC,CAAA,GAAAC,EAAA;EAAA,IAAAC,EAAA;EAAA,IAAAF,CAAA,QAAAD,KAAA;IACAG,EAAA,gBAAAJ,IAAA,CAACF,WAAW;MAAA,GAGNG,KAAK;MACOI,cAAM,EAANR;IAAM,CACvB,CAAC;IAAAK,CAAA,MAAAD,KAAA;IAAAC,CAAA,MAAAE,EAAA;EAAA;IAAAA,EAAA,GAAAF,CAAA;EAAA;EAAA,OALFE,EAKE;AAAA,CACH;AAEH,eAAeR,IAAI","ignoreList":[]}