@jetbrains/ring-ui-built 7.0.72 → 7.0.73

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 (287) hide show
  1. package/components/_helpers/anchor.js +55 -13
  2. package/components/_helpers/avatar-info.js +44 -11
  3. package/components/_helpers/caption.js +2 -2
  4. package/components/_helpers/card.js +21 -21
  5. package/components/_helpers/icon-svg.js +75 -17
  6. package/components/_helpers/input.js +13 -13
  7. package/components/_helpers/query-assist-suggestions.js +5 -5
  8. package/components/_helpers/select-filter.js +5 -5
  9. package/components/_helpers/services-link.js +5 -5
  10. package/components/_helpers/sidebar.js +6 -6
  11. package/components/_helpers/tab-link.js +69 -17
  12. package/components/_helpers/theme.js +231 -54
  13. package/components/_helpers/title.js +5 -5
  14. package/components/alert/alert.d.ts +1 -1
  15. package/components/alert/alert.js +12 -10
  16. package/components/alert/container.js +4 -4
  17. package/components/alert-service/alert-service.d.ts +1 -1
  18. package/components/alert-service/alert-service.js +5 -4
  19. package/components/auth/auth-core.js +8 -8
  20. package/components/auth/auth.js +3 -2
  21. package/components/auth/down-notification.js +61 -17
  22. package/components/auth/iframe-flow.js +7 -6
  23. package/components/auth/storage.js +3 -2
  24. package/components/auth/token-validator.js +1 -1
  25. package/components/auth/window-flow.js +2 -2
  26. package/components/auth-dialog/auth-dialog.d.ts +1 -1
  27. package/components/auth-dialog/auth-dialog.js +15 -14
  28. package/components/auth-dialog-service/auth-dialog-service.js +4 -6
  29. package/components/avatar/avatar-info.d.ts +1 -1
  30. package/components/avatar/avatar-info.js +3 -2
  31. package/components/avatar/avatar.d.ts +1 -1
  32. package/components/avatar/avatar.js +16 -15
  33. package/components/avatar/fallback-avatar.d.ts +1 -1
  34. package/components/avatar/fallback-avatar.js +183 -59
  35. package/components/avatar-stack/avatar-stack.d.ts +1 -1
  36. package/components/avatar-stack/avatar-stack.js +115 -29
  37. package/components/banner/banner.d.ts +1 -1
  38. package/components/banner/banner.js +11 -10
  39. package/components/breadcrumbs/breadcrumbs.d.ts +1 -1
  40. package/components/breadcrumbs/breadcrumbs.js +3 -2
  41. package/components/button/button.d.ts +1 -1
  42. package/components/button/button.js +11 -10
  43. package/components/button-group/button-group.d.ts +1 -1
  44. package/components/button-group/button-group.js +6 -8
  45. package/components/button-group/caption.d.ts +1 -1
  46. package/components/button-group/caption.js +1 -1
  47. package/components/button-set/button-set.d.ts +1 -1
  48. package/components/button-set/button-set.js +2 -5
  49. package/components/button-toolbar/button-toolbar.d.ts +1 -1
  50. package/components/button-toolbar/button-toolbar.js +2 -5
  51. package/components/checkbox/checkbox.d.ts +1 -1
  52. package/components/checkbox/checkbox.js +12 -17
  53. package/components/clipboard/clipboard.js +2 -1
  54. package/components/code/code.d.ts +1 -1
  55. package/components/code/code.js +5 -5
  56. package/components/collapse/collapse-content.js +161 -77
  57. package/components/collapse/collapse-control.js +69 -22
  58. package/components/collapse/collapse.js +83 -31
  59. package/components/confirm/confirm.d.ts +1 -1
  60. package/components/confirm/confirm.js +11 -13
  61. package/components/confirm-service/confirm-service.js +4 -3
  62. package/components/content-layout/content-layout.d.ts +1 -1
  63. package/components/content-layout/content-layout.js +4 -7
  64. package/components/content-layout/sidebar.d.ts +1 -1
  65. package/components/content-layout/sidebar.js +1 -1
  66. package/components/contenteditable/contenteditable.d.ts +2 -2
  67. package/components/contenteditable/contenteditable.js +50 -14
  68. package/components/control-help/control-help.d.ts +1 -1
  69. package/components/control-help/control-help.js +45 -9
  70. package/components/control-label/control-label.js +62 -13
  71. package/components/data-list/data-list.d.ts +1 -1
  72. package/components/data-list/data-list.js +10 -9
  73. package/components/data-list/data-list.mock.d.ts +1 -1
  74. package/components/data-list/data-list.mock.js +79 -78
  75. package/components/data-list/item.d.ts +2 -2
  76. package/components/data-list/item.js +18 -17
  77. package/components/data-list/title.d.ts +1 -1
  78. package/components/data-list/title.js +2 -1
  79. package/components/date-picker/consts.js +1 -1
  80. package/components/date-picker/date-input.d.ts +1 -1
  81. package/components/date-picker/date-input.js +4 -3
  82. package/components/date-picker/date-picker.d.ts +1 -1
  83. package/components/date-picker/date-picker.js +97 -31
  84. package/components/date-picker/date-popup.d.ts +1 -1
  85. package/components/date-picker/date-popup.js +11 -10
  86. package/components/date-picker/day.d.ts +1 -1
  87. package/components/date-picker/day.js +4 -3
  88. package/components/date-picker/month-names.d.ts +1 -1
  89. package/components/date-picker/month-names.js +98 -22
  90. package/components/date-picker/month-slider.d.ts +1 -1
  91. package/components/date-picker/month-slider.js +4 -4
  92. package/components/date-picker/month.d.ts +1 -1
  93. package/components/date-picker/month.js +79 -18
  94. package/components/date-picker/months.d.ts +1 -1
  95. package/components/date-picker/months.js +163 -53
  96. package/components/date-picker/weekdays.d.ts +1 -1
  97. package/components/date-picker/weekdays.js +56 -16
  98. package/components/date-picker/years.d.ts +1 -1
  99. package/components/date-picker/years.js +5 -5
  100. package/components/dialog/dialog.d.ts +1 -1
  101. package/components/dialog/dialog.js +21 -23
  102. package/components/dropdown/anchor.d.ts +1 -1
  103. package/components/dropdown/anchor.js +2 -1
  104. package/components/dropdown/dropdown.d.ts +1 -1
  105. package/components/dropdown/dropdown.js +7 -8
  106. package/components/dropdown-menu/dropdown-menu.js +299 -83
  107. package/components/editable-heading/editable-heading.d.ts +2 -2
  108. package/components/editable-heading/editable-heading.js +523 -174
  109. package/components/error-bubble/error-bubble.d.ts +1 -1
  110. package/components/error-bubble/error-bubble.js +7 -9
  111. package/components/error-message/error-message.d.ts +1 -1
  112. package/components/error-message/error-message.js +8 -10
  113. package/components/footer/footer.js +205 -61
  114. package/components/global/create-stateful-context.d.ts +1 -1
  115. package/components/global/create-stateful-context.js +73 -18
  116. package/components/global/focus-sensor-hoc.js +2 -2
  117. package/components/global/get-uid.js +1 -1
  118. package/components/global/react-dom-renderer.d.ts +1 -1
  119. package/components/global/react-dom-renderer.js +2 -2
  120. package/components/global/rerender-hoc.js +23 -6
  121. package/components/global/theme.js +3 -2
  122. package/components/global/use-event-callback.js +37 -13
  123. package/components/grid/col.d.ts +1 -1
  124. package/components/grid/col.js +3 -3
  125. package/components/grid/grid.d.ts +1 -1
  126. package/components/grid/grid.js +3 -6
  127. package/components/grid/row.d.ts +1 -1
  128. package/components/grid/row.js +3 -3
  129. package/components/group/group.d.ts +1 -1
  130. package/components/group/group.js +3 -6
  131. package/components/header/header-icon.d.ts +1 -1
  132. package/components/header/header-icon.js +3 -2
  133. package/components/header/header.d.ts +1 -1
  134. package/components/header/header.js +7 -12
  135. package/components/header/links.d.ts +1 -1
  136. package/components/header/links.js +45 -10
  137. package/components/header/logo.d.ts +1 -1
  138. package/components/header/logo.js +4 -3
  139. package/components/header/profile.js +17 -16
  140. package/components/header/services-link.d.ts +1 -1
  141. package/components/header/services-link.js +1 -1
  142. package/components/header/services.d.ts +1 -1
  143. package/components/header/services.js +35 -16
  144. package/components/header/smart-profile.d.ts +1 -1
  145. package/components/header/smart-profile.js +6 -5
  146. package/components/header/smart-services.d.ts +1 -1
  147. package/components/header/smart-services.js +3 -2
  148. package/components/header/tray.d.ts +1 -1
  149. package/components/header/tray.js +3 -3
  150. package/components/heading/heading.js +188 -44
  151. package/components/i18n/i18n-context.js +51 -13
  152. package/components/icon/icon-svg.d.ts +1 -1
  153. package/components/icon/icon-svg.js +2 -1
  154. package/components/icon/icon.d.ts +1 -1
  155. package/components/icon/icon.js +6 -5
  156. package/components/icon/index.js +2 -1
  157. package/components/input/input.d.ts +1 -1
  158. package/components/input/input.js +2 -1
  159. package/components/island/adaptive-island-hoc.js +4 -4
  160. package/components/island/content.d.ts +1 -1
  161. package/components/island/content.js +36 -17
  162. package/components/island/header.d.ts +1 -1
  163. package/components/island/header.js +32 -14
  164. package/components/island/island.d.ts +1 -1
  165. package/components/island/island.js +3 -5
  166. package/components/link/clickable-link.d.ts +1 -1
  167. package/components/link/clickable-link.js +2 -2
  168. package/components/link/link.js +4 -4
  169. package/components/list/list-custom.d.ts +1 -1
  170. package/components/list/list-custom.js +2 -2
  171. package/components/list/list-hint.d.ts +1 -1
  172. package/components/list/list-hint.js +3 -7
  173. package/components/list/list-item.d.ts +1 -1
  174. package/components/list/list-item.js +23 -26
  175. package/components/list/list-separator.d.ts +1 -1
  176. package/components/list/list-separator.js +3 -3
  177. package/components/list/list-title.d.ts +1 -1
  178. package/components/list/list-title.js +7 -7
  179. package/components/list/list-users-groups-source.js +6 -5
  180. package/components/list/list.d.ts +6 -6
  181. package/components/list/list.js +33 -31
  182. package/components/loader/loader.d.ts +1 -1
  183. package/components/loader/loader.js +8 -14
  184. package/components/loader-inline/loader-inline.d.ts +1 -1
  185. package/components/loader-inline/loader-inline.js +4 -7
  186. package/components/loader-screen/loader-screen.d.ts +1 -1
  187. package/components/loader-screen/loader-screen.js +3 -6
  188. package/components/login-dialog/login-dialog.d.ts +1 -1
  189. package/components/login-dialog/login-dialog.js +10 -9
  190. package/components/login-dialog/service.js +4 -3
  191. package/components/markdown/markdown.d.ts +1 -1
  192. package/components/markdown/markdown.js +3 -6
  193. package/components/message/message.d.ts +1 -1
  194. package/components/message/message.js +13 -15
  195. package/components/old-browsers-message/white-list.js +2 -2
  196. package/components/pager/pager.d.ts +5 -5
  197. package/components/pager/pager.js +28 -27
  198. package/components/panel/panel.d.ts +1 -1
  199. package/components/panel/panel.js +3 -6
  200. package/components/popup/popup.d.ts +2 -2
  201. package/components/popup/popup.js +14 -11
  202. package/components/popup/popup.target.js +68 -16
  203. package/components/popup-menu/popup-menu.d.ts +1 -1
  204. package/components/popup-menu/popup-menu.js +7 -9
  205. package/components/progress-bar/progress-bar.d.ts +1 -1
  206. package/components/progress-bar/progress-bar.js +4 -7
  207. package/components/query-assist/query-assist-suggestions.d.ts +1 -1
  208. package/components/query-assist/query-assist-suggestions.js +5 -4
  209. package/components/query-assist/query-assist.d.ts +2 -2
  210. package/components/query-assist/query-assist.js +37 -34
  211. package/components/radio/radio-item.d.ts +1 -1
  212. package/components/radio/radio-item.js +40 -20
  213. package/components/radio/radio.d.ts +1 -1
  214. package/components/radio/radio.js +3 -5
  215. package/components/scrollable-section/scrollable-section.d.ts +1 -1
  216. package/components/scrollable-section/scrollable-section.js +100 -38
  217. package/components/select/select-filter.d.ts +1 -1
  218. package/components/select/select-filter.js +5 -4
  219. package/components/select/select-popup.d.ts +7 -7
  220. package/components/select/select-popup.js +26 -25
  221. package/components/select/select.d.ts +3 -3
  222. package/components/select/select.js +52 -52
  223. package/components/shortcuts/shortcuts-hoc.js +3 -3
  224. package/components/slider/slider.js +591 -196
  225. package/components/storage/storage-local.js +2 -1
  226. package/components/storage/storage.js +2 -1
  227. package/components/style.css +1 -1
  228. package/components/tab-trap/tab-trap.js +247 -102
  229. package/components/table/cell.d.ts +1 -1
  230. package/components/table/cell.js +2 -2
  231. package/components/table/disable-hover-hoc.js +3 -3
  232. package/components/table/header-cell.d.ts +1 -1
  233. package/components/table/header-cell.js +7 -6
  234. package/components/table/header.d.ts +2 -2
  235. package/components/table/header.js +14 -13
  236. package/components/table/multitable.d.ts +1 -1
  237. package/components/table/multitable.js +3 -3
  238. package/components/table/row-with-focus-sensor.d.ts +1 -1
  239. package/components/table/row-with-focus-sensor.js +3 -2
  240. package/components/table/row.d.ts +1 -1
  241. package/components/table/row.js +51 -24
  242. package/components/table/selection-shortcuts-hoc.js +2 -2
  243. package/components/table/simple-table.d.ts +1 -1
  244. package/components/table/simple-table.js +4 -3
  245. package/components/table/smart-table.d.ts +1 -1
  246. package/components/table/smart-table.js +4 -3
  247. package/components/table/table.d.ts +2 -2
  248. package/components/table/table.js +21 -23
  249. package/components/tabs/collapsible-more.d.ts +3 -3
  250. package/components/tabs/collapsible-more.js +253 -83
  251. package/components/tabs/collapsible-tab.d.ts +1 -1
  252. package/components/tabs/collapsible-tab.js +4 -3
  253. package/components/tabs/collapsible-tabs.d.ts +2 -2
  254. package/components/tabs/collapsible-tabs.js +450 -188
  255. package/components/tabs/dumb-tabs.d.ts +2 -2
  256. package/components/tabs/dumb-tabs.js +10 -9
  257. package/components/tabs/smart-tabs.d.ts +1 -1
  258. package/components/tabs/smart-tabs.js +6 -5
  259. package/components/tabs/tab-link.d.ts +1 -1
  260. package/components/tabs/tab-link.js +2 -1
  261. package/components/tabs/tab.d.ts +1 -1
  262. package/components/tabs/tab.js +2 -2
  263. package/components/tabs/tabs.js +5 -4
  264. package/components/tag/tag.d.ts +5 -5
  265. package/components/tag/tag.js +14 -13
  266. package/components/tags-input/tags-input.d.ts +1 -1
  267. package/components/tags-input/tags-input.js +10 -9
  268. package/components/tags-list/tags-list.d.ts +2 -2
  269. package/components/tags-list/tags-list.js +4 -3
  270. package/components/text/text.d.ts +1 -1
  271. package/components/text/text.js +2 -2
  272. package/components/toggle/toggle.d.ts +1 -1
  273. package/components/toggle/toggle.js +12 -11
  274. package/components/tooltip/tooltip.d.ts +1 -1
  275. package/components/tooltip/tooltip.js +7 -6
  276. package/components/upload/upload.js +10 -9
  277. package/components/user-agreement/service.js +11 -10
  278. package/components/user-agreement/user-agreement.d.ts +1 -1
  279. package/components/user-agreement/user-agreement.js +19 -18
  280. package/components/user-card/card.d.ts +1 -1
  281. package/components/user-card/card.js +3 -2
  282. package/components/user-card/smart-user-card-tooltip.d.ts +2 -2
  283. package/components/user-card/smart-user-card-tooltip.js +7 -6
  284. package/components/user-card/tooltip.d.ts +2 -2
  285. package/components/user-card/tooltip.js +7 -6
  286. package/components/user-card/user-card.js +4 -3
  287. package/package.json +3 -9
@@ -1,12 +1,13 @@
1
- import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
1
+ import { c } from 'react-compiler-runtime';
2
2
  import * as React from 'react';
3
- import { useCallback, useEffect } from 'react';
3
+ import { useEffect } from 'react';
4
4
  import classNames from 'classnames';
5
5
  import Heading, { Levels } from '../heading/heading.js';
6
6
  import { Button } from '../button/button.js';
7
7
  import { S as Size, i as inputStyles } from '../_helpers/input.js';
8
8
  import getUID from '../global/get-uid.js';
9
9
  import Shortcuts from '../shortcuts/shortcuts.js';
10
+ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
10
11
  import 'util-deprecate';
11
12
  import '../_helpers/heading.js';
12
13
  import '@jetbrains/icons/chevron-down';
@@ -36,38 +37,155 @@ var styles = {"editableHeading":"ring-editable-heading-editableHeading","fullSiz
36
37
  function noop() {}
37
38
  // eslint-disable-next-line complexity
38
39
  const EditableHeading = props => {
39
- const {
40
- level = Levels.H1,
41
- className,
42
- headingClassName,
43
- inputClassName,
44
- children,
45
- isEditing = false,
46
- isSavingPossible = false,
47
- isSaving = false,
48
- embedded = false,
49
- size = Size.L,
50
- onEdit = noop,
51
- onSave = noop,
52
- onCancel = noop,
53
- autoFocus = true,
54
- 'data-test': dataTest,
55
- error,
56
- disabled,
57
- multiline = false,
58
- renderMenu = () => null,
59
- onFocus,
60
- onBlur,
61
- onChange,
62
- onScroll,
63
- maxInputRows,
64
- translations = {
65
- save: 'Save',
66
- cancel: 'Cancel'
67
- },
68
- ...restProps
69
- } = props;
70
- const [shortcutsScope] = React.useState(getUID('ring-editable-heading-'));
40
+ const $ = c(129);
41
+ if ($[0] !== "fa5dbeebbdcff2c9ff069f75420e1602116bbe04977ffad50d824f81650995a9") {
42
+ for (let $i = 0; $i < 129; $i += 1) {
43
+ $[$i] = Symbol.for("react.memo_cache_sentinel");
44
+ }
45
+ $[0] = "fa5dbeebbdcff2c9ff069f75420e1602116bbe04977ffad50d824f81650995a9";
46
+ }
47
+ let children;
48
+ let className;
49
+ let dataTest;
50
+ let disabled;
51
+ let error;
52
+ let headingClassName;
53
+ let inputClassName;
54
+ let maxInputRows;
55
+ let onBlur;
56
+ let onChange;
57
+ let onFocus;
58
+ let onScroll;
59
+ let restProps;
60
+ let t0;
61
+ let t1;
62
+ let t10;
63
+ let t11;
64
+ let t12;
65
+ let t2;
66
+ let t3;
67
+ let t4;
68
+ let t5;
69
+ let t6;
70
+ let t7;
71
+ let t8;
72
+ let t9;
73
+ if ($[1] !== props) {
74
+ ({
75
+ level: t0,
76
+ className,
77
+ headingClassName,
78
+ inputClassName,
79
+ children,
80
+ isEditing: t1,
81
+ isSavingPossible: t2,
82
+ isSaving: t3,
83
+ embedded: t4,
84
+ size: t5,
85
+ onEdit: t6,
86
+ onSave: t7,
87
+ onCancel: t8,
88
+ autoFocus: t9,
89
+ "data-test": dataTest,
90
+ error,
91
+ disabled,
92
+ multiline: t10,
93
+ renderMenu: t11,
94
+ onFocus,
95
+ onBlur,
96
+ onChange,
97
+ onScroll,
98
+ maxInputRows,
99
+ translations: t12,
100
+ ...restProps
101
+ } = props);
102
+ $[1] = props;
103
+ $[2] = children;
104
+ $[3] = className;
105
+ $[4] = dataTest;
106
+ $[5] = disabled;
107
+ $[6] = error;
108
+ $[7] = headingClassName;
109
+ $[8] = inputClassName;
110
+ $[9] = maxInputRows;
111
+ $[10] = onBlur;
112
+ $[11] = onChange;
113
+ $[12] = onFocus;
114
+ $[13] = onScroll;
115
+ $[14] = restProps;
116
+ $[15] = t0;
117
+ $[16] = t1;
118
+ $[17] = t10;
119
+ $[18] = t11;
120
+ $[19] = t12;
121
+ $[20] = t2;
122
+ $[21] = t3;
123
+ $[22] = t4;
124
+ $[23] = t5;
125
+ $[24] = t6;
126
+ $[25] = t7;
127
+ $[26] = t8;
128
+ $[27] = t9;
129
+ } else {
130
+ children = $[2];
131
+ className = $[3];
132
+ dataTest = $[4];
133
+ disabled = $[5];
134
+ error = $[6];
135
+ headingClassName = $[7];
136
+ inputClassName = $[8];
137
+ maxInputRows = $[9];
138
+ onBlur = $[10];
139
+ onChange = $[11];
140
+ onFocus = $[12];
141
+ onScroll = $[13];
142
+ restProps = $[14];
143
+ t0 = $[15];
144
+ t1 = $[16];
145
+ t10 = $[17];
146
+ t11 = $[18];
147
+ t12 = $[19];
148
+ t2 = $[20];
149
+ t3 = $[21];
150
+ t4 = $[22];
151
+ t5 = $[23];
152
+ t6 = $[24];
153
+ t7 = $[25];
154
+ t8 = $[26];
155
+ t9 = $[27];
156
+ }
157
+ const level = t0 === undefined ? Levels.H1 : t0;
158
+ const isEditing = t1 === undefined ? false : t1;
159
+ const isSavingPossible = t2 === undefined ? false : t2;
160
+ const isSaving = t3 === undefined ? false : t3;
161
+ const embedded = t4 === undefined ? false : t4;
162
+ const size = t5 === undefined ? Size.L : t5;
163
+ const onEdit = t6 === undefined ? noop : t6;
164
+ const onSave = t7 === undefined ? noop : t7;
165
+ const onCancel = t8 === undefined ? noop : t8;
166
+ const autoFocus = t9 === undefined ? true : t9;
167
+ const multiline = t10 === undefined ? false : t10;
168
+ const renderMenu = t11 === undefined ? _temp : t11;
169
+ let t13;
170
+ if ($[28] !== t12) {
171
+ t13 = t12 === undefined ? {
172
+ save: "Save",
173
+ cancel: "Cancel"
174
+ } : t12;
175
+ $[28] = t12;
176
+ $[29] = t13;
177
+ } else {
178
+ t13 = $[29];
179
+ }
180
+ const translations = t13;
181
+ let t14;
182
+ if ($[30] === Symbol.for("react.memo_cache_sentinel")) {
183
+ t14 = getUID("ring-editable-heading-");
184
+ $[30] = t14;
185
+ } else {
186
+ t14 = $[30];
187
+ }
188
+ const [shortcutsScope] = React.useState(t14);
71
189
  const [isInFocus, setIsInFocus] = React.useState(false);
72
190
  const [isMouseDown, setIsMouseDown] = React.useState(false);
73
191
  const [isInSelectionMode, setIsInSelectionMode] = React.useState(false);
@@ -75,167 +193,398 @@ const EditableHeading = props => {
75
193
  const [isScrolledToBottom, setIsScrolledToBottom] = React.useState(false);
76
194
  const [isOverflow, setIsOverflow] = React.useState(false);
77
195
  const hasError = error !== undefined;
78
- const isSaveDisabled = !isSavingPossible || !children || children.trim() === '' || hasError || isSaving;
196
+ let t15;
197
+ if ($[31] !== children || $[32] !== hasError || $[33] !== isSaving || $[34] !== isSavingPossible) {
198
+ t15 = !isSavingPossible || !children || children.trim() === "" || hasError || isSaving;
199
+ $[31] = children;
200
+ $[32] = hasError;
201
+ $[33] = isSaving;
202
+ $[34] = isSavingPossible;
203
+ $[35] = t15;
204
+ } else {
205
+ t15 = $[35];
206
+ }
207
+ const isSaveDisabled = t15;
79
208
  const isCancelDisabled = isSaving;
80
209
  const isShortcutsDisabled = !isInFocus || isSaving;
81
- const shortcutsMap = React.useMemo(() => {
82
- const map = {};
210
+ let map;
211
+ if ($[36] !== isCancelDisabled || $[37] !== isSaveDisabled || $[38] !== onCancel || $[39] !== onSave) {
212
+ map = {};
83
213
  if (!isSaveDisabled) {
84
214
  map.enter = onSave;
85
215
  }
86
216
  if (isCancelDisabled) {
87
217
  map.esc = onCancel;
88
218
  }
89
- return map;
90
- }, [isSaveDisabled, isCancelDisabled, onSave, onCancel]);
91
- const classes = classNames(styles.editableHeading, className, {
92
- [styles.fullSize]: isEditing && size === Size.FULL,
93
- [styles.isEditing]: isEditing,
94
- [styles.error]: hasError,
95
- [styles.disabled]: disabled,
96
- [styles.multiline]: multiline,
97
- [styles.selectionMode]: isInSelectionMode
98
- });
99
- const headingClasses = classNames(styles.heading, headingClassName, styles[`size${size}`]);
100
- const inputClasses = classNames('ring-js-shortcuts', styles.input, styles.textarea, {
101
- [styles.textareaNotOverflow]: !isOverflow
102
- }, inputStyles[`size${size}`], styles[`level${level}`], inputClassName);
103
- const stretch = useCallback(el => {
104
- if (!el || !el.style) {
105
- return;
106
- }
107
- el.style.height = '0';
108
- const {
109
- paddingTop,
110
- paddingBottom
111
- } = window.getComputedStyle(el);
112
- el.style.height = `${el.scrollHeight - parseFloat(paddingTop) - parseFloat(paddingBottom)}px`;
113
- }, []);
114
- const checkValue = useCallback(el => {
115
- if (multiline && el && el.scrollHeight >= el.clientHeight) {
116
- stretch(el);
117
- }
118
- }, [stretch, multiline]);
119
- const checkOverflow = useCallback(el => {
120
- const scrollHeight = el.scrollHeight || 0;
121
- const clientHeight = el.clientHeight || 0;
122
- const scrollTop = el.scrollTop || 0;
123
- setIsScrolledToBottom(scrollHeight - clientHeight <= scrollTop);
124
- setIsOverflow(scrollHeight > clientHeight);
125
- }, [setIsScrolledToBottom]);
126
- const onHeadingMouseDown = React.useCallback(() => {
127
- setIsMouseDown(true);
128
- }, []);
129
- const onMouseMove = React.useCallback(() => {
130
- if (!isMouseDown) {
131
- return;
132
- }
133
- setIsInSelectionMode(true);
134
- }, [isMouseDown]);
135
- const onMouseUp = React.useCallback(() => {
136
- if (isMouseDown && !isInSelectionMode && !disabled) {
137
- onEdit();
138
- }
139
- setIsMouseDown(false);
140
- setIsInSelectionMode(false);
141
- }, [isMouseDown, isInSelectionMode, disabled, onEdit]);
142
- const onInputFocus = React.useCallback(e => {
143
- setIsInFocus(true);
144
- checkValue(e.target);
145
- checkOverflow(e.target);
146
- onFocus?.(e);
147
- }, [onFocus, checkOverflow, checkValue]);
148
- const onInputChange = React.useCallback(e => {
149
- checkValue(e.target);
150
- checkOverflow(e.target);
151
- onChange?.(e);
152
- }, [onChange, checkOverflow, checkValue]);
153
- const onInputScroll = React.useCallback(e => {
154
- checkOverflow(e.target);
155
- onScroll?.(e);
156
- }, [onScroll, checkOverflow]);
157
- const onInputBlur = React.useCallback(e => {
158
- setIsInFocus(false);
159
- onBlur?.(e);
160
- }, [onBlur]);
161
- useEffect(() => {
162
- window.addEventListener('mousemove', onMouseMove);
163
- window.addEventListener('mouseup', onMouseUp);
164
- return () => {
165
- window.removeEventListener('mousemove', onMouseMove);
166
- window.removeEventListener('mouseup', onMouseUp);
219
+ $[36] = isCancelDisabled;
220
+ $[37] = isSaveDisabled;
221
+ $[38] = onCancel;
222
+ $[39] = onSave;
223
+ $[40] = map;
224
+ } else {
225
+ map = $[40];
226
+ }
227
+ const shortcutsMap = map;
228
+ const t16 = isEditing && size === Size.FULL;
229
+ let t17;
230
+ if ($[41] !== className || $[42] !== disabled || $[43] !== hasError || $[44] !== isEditing || $[45] !== isInSelectionMode || $[46] !== multiline || $[47] !== t16) {
231
+ t17 = classNames(styles.editableHeading, className, {
232
+ [styles.fullSize]: t16,
233
+ [styles.isEditing]: isEditing,
234
+ [styles.error]: hasError,
235
+ [styles.disabled]: disabled,
236
+ [styles.multiline]: multiline,
237
+ [styles.selectionMode]: isInSelectionMode
238
+ });
239
+ $[41] = className;
240
+ $[42] = disabled;
241
+ $[43] = hasError;
242
+ $[44] = isEditing;
243
+ $[45] = isInSelectionMode;
244
+ $[46] = multiline;
245
+ $[47] = t16;
246
+ $[48] = t17;
247
+ } else {
248
+ t17 = $[48];
249
+ }
250
+ const classes = t17;
251
+ const t18 = styles[`size${size}`];
252
+ let t19;
253
+ if ($[49] !== headingClassName || $[50] !== t18) {
254
+ t19 = classNames(styles.heading, headingClassName, t18);
255
+ $[49] = headingClassName;
256
+ $[50] = t18;
257
+ $[51] = t19;
258
+ } else {
259
+ t19 = $[51];
260
+ }
261
+ const headingClasses = t19;
262
+ const t20 = !isOverflow;
263
+ let t21;
264
+ if ($[52] !== inputClassName || $[53] !== level || $[54] !== size || $[55] !== t20) {
265
+ t21 = classNames("ring-js-shortcuts", styles.input, styles.textarea, {
266
+ [styles.textareaNotOverflow]: t20
267
+ }, inputStyles[`size${size}`], styles[`level${level}`], inputClassName);
268
+ $[52] = inputClassName;
269
+ $[53] = level;
270
+ $[54] = size;
271
+ $[55] = t20;
272
+ $[56] = t21;
273
+ } else {
274
+ t21 = $[56];
275
+ }
276
+ const inputClasses = t21;
277
+ const stretch = _temp2;
278
+ let t22;
279
+ if ($[57] !== multiline) {
280
+ t22 = el_0 => {
281
+ if (multiline && el_0 && el_0.scrollHeight >= el_0.clientHeight) {
282
+ stretch(el_0);
283
+ }
167
284
  };
168
- }, [onMouseMove, onMouseUp]);
169
- return jsxs(Fragment, {
170
- children: [jsxs("div", {
171
- className: classes,
172
- children: [!disabled && isEditing ? jsxs(Fragment, {
173
- children: [jsx(Shortcuts, {
174
- map: shortcutsMap,
175
- scope: shortcutsScope,
176
- disabled: isShortcutsDisabled
177
- }), !multiline ? jsx("input", {
285
+ $[57] = multiline;
286
+ $[58] = t22;
287
+ } else {
288
+ t22 = $[58];
289
+ }
290
+ const checkValue = t22;
291
+ let t23;
292
+ if ($[59] === Symbol.for("react.memo_cache_sentinel")) {
293
+ t23 = el_1 => {
294
+ const scrollHeight = el_1.scrollHeight || 0;
295
+ const clientHeight = el_1.clientHeight || 0;
296
+ const scrollTop = el_1.scrollTop || 0;
297
+ setIsScrolledToBottom(scrollHeight - clientHeight <= scrollTop);
298
+ setIsOverflow(scrollHeight > clientHeight);
299
+ };
300
+ $[59] = t23;
301
+ } else {
302
+ t23 = $[59];
303
+ }
304
+ const checkOverflow = t23;
305
+ let t24;
306
+ if ($[60] === Symbol.for("react.memo_cache_sentinel")) {
307
+ t24 = () => {
308
+ setIsMouseDown(true);
309
+ };
310
+ $[60] = t24;
311
+ } else {
312
+ t24 = $[60];
313
+ }
314
+ const onHeadingMouseDown = t24;
315
+ let t25;
316
+ if ($[61] !== isMouseDown) {
317
+ t25 = () => {
318
+ if (!isMouseDown) {
319
+ return;
320
+ }
321
+ setIsInSelectionMode(true);
322
+ };
323
+ $[61] = isMouseDown;
324
+ $[62] = t25;
325
+ } else {
326
+ t25 = $[62];
327
+ }
328
+ const onMouseMove = t25;
329
+ let t26;
330
+ if ($[63] !== disabled || $[64] !== isInSelectionMode || $[65] !== isMouseDown || $[66] !== onEdit) {
331
+ t26 = () => {
332
+ if (isMouseDown && !isInSelectionMode && !disabled) {
333
+ onEdit();
334
+ }
335
+ setIsMouseDown(false);
336
+ setIsInSelectionMode(false);
337
+ };
338
+ $[63] = disabled;
339
+ $[64] = isInSelectionMode;
340
+ $[65] = isMouseDown;
341
+ $[66] = onEdit;
342
+ $[67] = t26;
343
+ } else {
344
+ t26 = $[67];
345
+ }
346
+ const onMouseUp = t26;
347
+ let t27;
348
+ if ($[68] !== checkValue || $[69] !== onFocus) {
349
+ t27 = e => {
350
+ setIsInFocus(true);
351
+ checkValue(e.target);
352
+ checkOverflow(e.target);
353
+ onFocus?.(e);
354
+ };
355
+ $[68] = checkValue;
356
+ $[69] = onFocus;
357
+ $[70] = t27;
358
+ } else {
359
+ t27 = $[70];
360
+ }
361
+ const onInputFocus = t27;
362
+ let t28;
363
+ if ($[71] !== checkValue || $[72] !== onChange) {
364
+ t28 = e_0 => {
365
+ checkValue(e_0.target);
366
+ checkOverflow(e_0.target);
367
+ onChange?.(e_0);
368
+ };
369
+ $[71] = checkValue;
370
+ $[72] = onChange;
371
+ $[73] = t28;
372
+ } else {
373
+ t28 = $[73];
374
+ }
375
+ const onInputChange = t28;
376
+ let t29;
377
+ if ($[74] !== onScroll) {
378
+ t29 = e_1 => {
379
+ checkOverflow(e_1.target);
380
+ onScroll?.(e_1);
381
+ };
382
+ $[74] = onScroll;
383
+ $[75] = t29;
384
+ } else {
385
+ t29 = $[75];
386
+ }
387
+ const onInputScroll = t29;
388
+ let t30;
389
+ if ($[76] !== onBlur) {
390
+ t30 = e_2 => {
391
+ setIsInFocus(false);
392
+ onBlur?.(e_2);
393
+ };
394
+ $[76] = onBlur;
395
+ $[77] = t30;
396
+ } else {
397
+ t30 = $[77];
398
+ }
399
+ const onInputBlur = t30;
400
+ let t31;
401
+ let t32;
402
+ if ($[78] !== onMouseMove || $[79] !== onMouseUp) {
403
+ t31 = () => {
404
+ window.addEventListener("mousemove", onMouseMove);
405
+ window.addEventListener("mouseup", onMouseUp);
406
+ return () => {
407
+ window.removeEventListener("mousemove", onMouseMove);
408
+ window.removeEventListener("mouseup", onMouseUp);
409
+ };
410
+ };
411
+ t32 = [onMouseMove, onMouseUp];
412
+ $[78] = onMouseMove;
413
+ $[79] = onMouseUp;
414
+ $[80] = t31;
415
+ $[81] = t32;
416
+ } else {
417
+ t31 = $[80];
418
+ t32 = $[81];
419
+ }
420
+ useEffect(t31, t32);
421
+ let t33;
422
+ if ($[82] !== autoFocus || $[83] !== children || $[84] !== dataTest || $[85] !== disabled || $[86] !== headingClasses || $[87] !== inputClasses || $[88] !== isEditing || $[89] !== isSaving || $[90] !== isScrolledToBottom || $[91] !== isShortcutsDisabled || $[92] !== level || $[93] !== maxInputRows || $[94] !== multiline || $[95] !== onChange || $[96] !== onInputBlur || $[97] !== onInputChange || $[98] !== onInputFocus || $[99] !== onInputScroll || $[100] !== restProps || $[101] !== shortcutsMap || $[102] !== shortcutsScope || $[103] !== size) {
423
+ t33 = !disabled && isEditing ? /*#__PURE__*/jsxs(Fragment, {
424
+ children: [/*#__PURE__*/jsx(Shortcuts, {
425
+ map: shortcutsMap,
426
+ scope: shortcutsScope,
427
+ disabled: isShortcutsDisabled
428
+ }), !multiline ? /*#__PURE__*/jsx("input", {
429
+ className: inputClasses,
430
+ value: children,
431
+ autoFocus: autoFocus,
432
+ "data-test": dataTest,
433
+ disabled: isSaving,
434
+ onChange: onChange,
435
+ ...restProps,
436
+ onFocus: onInputFocus,
437
+ onBlur: onInputBlur
438
+ }) : /*#__PURE__*/jsxs("div", {
439
+ className: classNames(styles.textareaWrapper, inputStyles[`size${size}`]),
440
+ children: [/*#__PURE__*/jsx("textarea", {
441
+ ref: textAreaRef,
178
442
  className: inputClasses,
179
443
  value: children,
180
444
  autoFocus: autoFocus,
181
445
  "data-test": dataTest,
182
446
  disabled: isSaving,
183
- onChange: onChange,
447
+ onChange: onInputChange,
184
448
  ...restProps,
185
449
  onFocus: onInputFocus,
186
- onBlur: onInputBlur
187
- }) : jsxs("div", {
188
- className: classNames(styles.textareaWrapper, inputStyles[`size${size}`]),
189
- children: [jsx("textarea", {
190
- ref: textAreaRef,
191
- className: inputClasses,
192
- value: children,
193
- autoFocus: autoFocus,
194
- "data-test": dataTest,
195
- disabled: isSaving,
196
- onChange: onInputChange,
197
- ...restProps,
198
- onFocus: onInputFocus,
199
- onBlur: onInputBlur,
200
- onScroll: onInputScroll,
201
- style: {
202
- maxHeight: maxInputRows ? `${maxInputRows}lh` : ''
203
- }
204
- }), !isScrolledToBottom && jsx("div", {
205
- className: styles.textareaFade
206
- })]
207
- })]
208
- }) : jsx("button", {
209
- type: 'button',
210
- className: styles.headingWrapperButton,
211
- onMouseDown: onHeadingMouseDown,
212
- children: jsx(Heading, {
213
- className: headingClasses,
214
- level: level,
215
- "data-test": dataTest,
216
- children: children
217
- })
218
- }), !isEditing && renderMenu(), isEditing && !embedded && jsxs(Fragment, {
219
- children: [jsx(Button, {
220
- className: styles.button,
221
- primary: true,
222
- disabled: isSaveDisabled,
223
- loader: isSaving,
224
- onClick: onSave,
225
- children: translations.save
226
- }), jsx(Button, {
227
- className: styles.button,
228
- disabled: isCancelDisabled,
229
- onClick: onCancel,
230
- children: translations.cancel
450
+ onBlur: onInputBlur,
451
+ onScroll: onInputScroll,
452
+ style: {
453
+ maxHeight: maxInputRows ? `${maxInputRows}lh` : ""
454
+ }
455
+ }), !isScrolledToBottom && /*#__PURE__*/jsx("div", {
456
+ className: styles.textareaFade
231
457
  })]
232
458
  })]
233
- }), isEditing && error && jsx("div", {
459
+ }) : /*#__PURE__*/jsx("button", {
460
+ type: "button",
461
+ className: styles.headingWrapperButton,
462
+ onMouseDown: onHeadingMouseDown,
463
+ children: /*#__PURE__*/jsx(Heading, {
464
+ className: headingClasses,
465
+ level: level,
466
+ "data-test": dataTest,
467
+ children: children
468
+ })
469
+ });
470
+ $[82] = autoFocus;
471
+ $[83] = children;
472
+ $[84] = dataTest;
473
+ $[85] = disabled;
474
+ $[86] = headingClasses;
475
+ $[87] = inputClasses;
476
+ $[88] = isEditing;
477
+ $[89] = isSaving;
478
+ $[90] = isScrolledToBottom;
479
+ $[91] = isShortcutsDisabled;
480
+ $[92] = level;
481
+ $[93] = maxInputRows;
482
+ $[94] = multiline;
483
+ $[95] = onChange;
484
+ $[96] = onInputBlur;
485
+ $[97] = onInputChange;
486
+ $[98] = onInputFocus;
487
+ $[99] = onInputScroll;
488
+ $[100] = restProps;
489
+ $[101] = shortcutsMap;
490
+ $[102] = shortcutsScope;
491
+ $[103] = size;
492
+ $[104] = t33;
493
+ } else {
494
+ t33 = $[104];
495
+ }
496
+ let t34;
497
+ if ($[105] !== isEditing || $[106] !== renderMenu) {
498
+ t34 = !isEditing && renderMenu();
499
+ $[105] = isEditing;
500
+ $[106] = renderMenu;
501
+ $[107] = t34;
502
+ } else {
503
+ t34 = $[107];
504
+ }
505
+ let t35;
506
+ if ($[108] !== embedded || $[109] !== isCancelDisabled || $[110] !== isEditing || $[111] !== isSaveDisabled || $[112] !== isSaving || $[113] !== onCancel || $[114] !== onSave || $[115] !== translations) {
507
+ t35 = isEditing && !embedded && /*#__PURE__*/jsxs(Fragment, {
508
+ children: [/*#__PURE__*/jsx(Button, {
509
+ className: styles.button,
510
+ primary: true,
511
+ disabled: isSaveDisabled,
512
+ loader: isSaving,
513
+ onClick: onSave,
514
+ children: translations.save
515
+ }), /*#__PURE__*/jsx(Button, {
516
+ className: styles.button,
517
+ disabled: isCancelDisabled,
518
+ onClick: onCancel,
519
+ children: translations.cancel
520
+ })]
521
+ });
522
+ $[108] = embedded;
523
+ $[109] = isCancelDisabled;
524
+ $[110] = isEditing;
525
+ $[111] = isSaveDisabled;
526
+ $[112] = isSaving;
527
+ $[113] = onCancel;
528
+ $[114] = onSave;
529
+ $[115] = translations;
530
+ $[116] = t35;
531
+ } else {
532
+ t35 = $[116];
533
+ }
534
+ let t36;
535
+ if ($[117] !== classes || $[118] !== t33 || $[119] !== t34 || $[120] !== t35) {
536
+ t36 = /*#__PURE__*/jsxs("div", {
537
+ className: classes,
538
+ children: [t33, t34, t35]
539
+ });
540
+ $[117] = classes;
541
+ $[118] = t33;
542
+ $[119] = t34;
543
+ $[120] = t35;
544
+ $[121] = t36;
545
+ } else {
546
+ t36 = $[121];
547
+ }
548
+ let t37;
549
+ if ($[122] !== error || $[123] !== isEditing || $[124] !== size) {
550
+ t37 = isEditing && error && /*#__PURE__*/jsx("div", {
234
551
  className: classNames(styles.errorText, inputStyles[`size${size}`]),
235
552
  children: error
236
- })]
237
- });
553
+ });
554
+ $[122] = error;
555
+ $[123] = isEditing;
556
+ $[124] = size;
557
+ $[125] = t37;
558
+ } else {
559
+ t37 = $[125];
560
+ }
561
+ let t38;
562
+ if ($[126] !== t36 || $[127] !== t37) {
563
+ t38 = /*#__PURE__*/jsxs(Fragment, {
564
+ children: [t36, t37]
565
+ });
566
+ $[126] = t36;
567
+ $[127] = t37;
568
+ $[128] = t38;
569
+ } else {
570
+ t38 = $[128];
571
+ }
572
+ return t38;
238
573
  };
239
574
  var editableHeading = /*#__PURE__*/React.memo(EditableHeading);
575
+ function _temp() {
576
+ return null;
577
+ }
578
+ function _temp2(el) {
579
+ if (!el || !el.style) {
580
+ return;
581
+ }
582
+ el.style.height = "0";
583
+ const {
584
+ paddingTop,
585
+ paddingBottom
586
+ } = window.getComputedStyle(el);
587
+ el.style.height = `${el.scrollHeight - parseFloat(paddingTop) - parseFloat(paddingBottom)}px`;
588
+ }
240
589
 
241
590
  export { EditableHeading, Levels, Size, editableHeading as default };