@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,10 +1,11 @@
1
- import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { useRef, useState, useMemo, useCallback, useEffect, Fragment } from 'react';
1
+ import { c } from 'react-compiler-runtime';
2
+ import { useRef, useState, useEffect, Fragment } from 'react';
3
3
  import classNames from 'classnames';
4
4
  import { isArray } from '../global/typescript-utils.js';
5
5
  import Shortcuts from '../shortcuts/shortcuts.js';
6
6
  import getUID from '../global/get-uid.js';
7
- import { toRange, HUNDRED, validateValue, calculateMarks, toPercent, calculateValue, adjustValues } from './slider.utils.js';
7
+ import { toRange, HUNDRED, calculateMarks, toPercent, validateValue, calculateValue, adjustValues } from './slider.utils.js';
8
+ import { jsx, jsxs } from 'react/jsx-runtime';
8
9
  import '../shortcuts/core.js';
9
10
  import 'combokeys';
10
11
  import '../global/sniffer.js';
@@ -12,239 +13,633 @@ import 'sniffr';
12
13
 
13
14
  var styles = {"slider":"ring-slider-slider","disabled":"ring-slider-disabled","marked":"ring-slider-marked","rail":"ring-slider-rail","rounded":"ring-slider-rounded","track":"ring-slider-track","thumb":"ring-slider-thumb ring-global-resetButton","dragged":"ring-slider-dragged","tick":"ring-slider-tick","active":"ring-slider-active","markValue":"ring-slider-markValue","tag":"ring-slider-tag"};
14
15
 
15
- const Slider = ({
16
- defaultValue,
17
- value,
18
- min = 0,
19
- max = HUNDRED,
20
- step = 1,
21
- disabled,
22
- marks,
23
- showTicks,
24
- showTag,
25
- className,
26
- renderTag,
27
- onChange
28
- }) => {
16
+ const Slider = t0 => {
17
+ const $ = c(154);
18
+ if ($[0] !== "7c00c25355ca34476232faa4b0d729160f0b7ed5ed726089246ce3288d3c8d5e") {
19
+ for (let $i = 0; $i < 154; $i += 1) {
20
+ $[$i] = Symbol.for("react.memo_cache_sentinel");
21
+ }
22
+ $[0] = "7c00c25355ca34476232faa4b0d729160f0b7ed5ed726089246ce3288d3c8d5e";
23
+ }
24
+ const {
25
+ defaultValue,
26
+ value,
27
+ min: t1,
28
+ max: t2,
29
+ step: t3,
30
+ disabled,
31
+ marks,
32
+ showTicks,
33
+ showTag,
34
+ className,
35
+ renderTag,
36
+ onChange
37
+ } = t0;
38
+ const min = t1 === undefined ? 0 : t1;
39
+ const max = t2 === undefined ? HUNDRED : t2;
40
+ const step = t3 === undefined ? 1 : t3;
29
41
  const ref = useRef(null);
30
42
  const previouslyDragged = useRef(false);
31
43
  const [values, setValues] = useState(defaultValue !== null && defaultValue !== void 0 ? defaultValue : min);
32
- const validValues = useMemo(() => toRange(value !== null && value !== void 0 ? value : values, min, max), [max, min, value, values]);
44
+ const t4 = value !== null && value !== void 0 ? value : values;
45
+ let t5;
46
+ if ($[1] !== max || $[2] !== min || $[3] !== t4) {
47
+ t5 = toRange(t4, min, max);
48
+ $[1] = max;
49
+ $[2] = min;
50
+ $[3] = t4;
51
+ $[4] = t5;
52
+ } else {
53
+ t5 = $[4];
54
+ }
55
+ const validValues = t5;
33
56
  const validStep = step < 0 ? 0 : step;
34
- const isRange = isArray(defaultValue !== null && defaultValue !== void 0 ? defaultValue : value);
57
+ const t6 = defaultValue !== null && defaultValue !== void 0 ? defaultValue : value;
58
+ let t7;
59
+ if ($[5] !== t6) {
60
+ t7 = isArray(t6);
61
+ $[5] = t6;
62
+ $[6] = t7;
63
+ } else {
64
+ t7 = $[6];
65
+ }
66
+ const isRange = t7;
35
67
  const [isDragging, setIsDragging] = useState(false);
36
68
  const [draggedIndex, setDraggedIndex] = useState(-1);
37
- const [shortcutsScope] = useState(getUID('ring-slider-'));
38
- const markValues = useMemo(() => {
69
+ let t8;
70
+ if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
71
+ t8 = getUID("ring-slider-");
72
+ $[7] = t8;
73
+ } else {
74
+ t8 = $[7];
75
+ }
76
+ const [shortcutsScope] = useState(t8);
77
+ let t9;
78
+ bb0: {
39
79
  if (isArray(marks)) {
40
- return marks.map(mark => ({
41
- ...mark,
42
- value: validateValue(mark.value, min, max)
43
- }));
80
+ let t10;
81
+ if ($[8] !== marks || $[9] !== max || $[10] !== min) {
82
+ let t11;
83
+ if ($[12] !== max || $[13] !== min) {
84
+ t11 = mark => ({
85
+ ...mark,
86
+ value: validateValue(mark.value, min, max)
87
+ });
88
+ $[12] = max;
89
+ $[13] = min;
90
+ $[14] = t11;
91
+ } else {
92
+ t11 = $[14];
93
+ }
94
+ t10 = marks.map(t11);
95
+ $[8] = marks;
96
+ $[9] = max;
97
+ $[10] = min;
98
+ $[11] = t10;
99
+ } else {
100
+ t10 = $[11];
101
+ }
102
+ t9 = t10;
103
+ break bb0;
44
104
  }
45
105
  if (marks) {
46
- return calculateMarks(min, max, validStep);
106
+ let t10;
107
+ if ($[15] !== max || $[16] !== min || $[17] !== validStep) {
108
+ t10 = calculateMarks(min, max, validStep);
109
+ $[15] = max;
110
+ $[16] = min;
111
+ $[17] = validStep;
112
+ $[18] = t10;
113
+ } else {
114
+ t10 = $[18];
115
+ }
116
+ t9 = t10;
117
+ break bb0;
118
+ }
119
+ let t10;
120
+ if ($[19] === Symbol.for("react.memo_cache_sentinel")) {
121
+ t10 = [];
122
+ $[19] = t10;
123
+ } else {
124
+ t10 = $[19];
47
125
  }
48
- return [];
49
- }, [marks, max, min, validStep]);
50
- const tickMarks = useMemo(() => {
126
+ t9 = t10;
127
+ }
128
+ const markValues = t9;
129
+ let t10;
130
+ bb1: {
51
131
  if (showTicks) {
52
- return markValues.length ? markValues : calculateMarks(min, max, validStep);
132
+ let t11;
133
+ if ($[20] !== markValues || $[21] !== max || $[22] !== min || $[23] !== validStep) {
134
+ t11 = markValues.length ? markValues : calculateMarks(min, max, validStep);
135
+ $[20] = markValues;
136
+ $[21] = max;
137
+ $[22] = min;
138
+ $[23] = validStep;
139
+ $[24] = t11;
140
+ } else {
141
+ t11 = $[24];
142
+ }
143
+ t10 = t11;
144
+ break bb1;
145
+ }
146
+ let t11;
147
+ if ($[25] === Symbol.for("react.memo_cache_sentinel")) {
148
+ t11 = [];
149
+ $[25] = t11;
150
+ } else {
151
+ t11 = $[25];
53
152
  }
54
- return [];
55
- }, [max, min, markValues, showTicks, validStep]);
56
- const trackStart = useMemo(() => toPercent(isRange ? Math.min(...validValues) : min, min, max), [isRange, max, min, validValues]);
57
- const trackLength = useMemo(() => toPercent(Math.max(...validValues), min, max) - trackStart, [max, min, trackStart, validValues]);
58
- const handleValueChange = useCallback(nextValues => {
59
- setValues(nextValues);
60
- onChange?.(isRange ? nextValues : nextValues[0]);
61
- }, [isRange, onChange]);
62
- const shortcutsMap = useMemo(() => {
63
- const setValueAndSwap = (nextValue, index) => {
64
- const nextValues = [...validValues];
65
- nextValues[index] = nextValue;
66
- if (nextValues[0] > nextValues[1]) {
67
- const previousValue = nextValues[index];
68
- nextValues.reverse();
69
- const thumb = ref.current?.querySelector(`[role="slider"][data-index="${nextValues.indexOf(previousValue)}"]`);
153
+ t10 = t11;
154
+ }
155
+ const tickMarks = t10;
156
+ const trackStart = toPercent(isRange ? Math.min(...validValues) : min, min, max);
157
+ const trackLength = toPercent(Math.max(...validValues), min, max) - trackStart;
158
+ let t11;
159
+ if ($[26] !== isRange || $[27] !== onChange) {
160
+ t11 = nextValues => {
161
+ setValues(nextValues);
162
+ onChange?.(isRange ? nextValues : nextValues[0]);
163
+ };
164
+ $[26] = isRange;
165
+ $[27] = onChange;
166
+ $[28] = t11;
167
+ } else {
168
+ t11 = $[28];
169
+ }
170
+ const handleValueChange = t11;
171
+ let t12;
172
+ if ($[29] !== handleValueChange || $[30] !== validValues) {
173
+ t12 = (nextValue, index) => {
174
+ const nextValues_0 = [...validValues];
175
+ nextValues_0[index] = nextValue;
176
+ if (nextValues_0[0] > nextValues_0[1]) {
177
+ const previousValue = nextValues_0[index];
178
+ nextValues_0.reverse();
179
+ const thumb = ref.current?.querySelector(`[role="slider"][data-index="${nextValues_0.indexOf(previousValue)}"]`);
70
180
  thumb?.focus();
71
181
  }
72
- handleValueChange(nextValues);
182
+ handleValueChange(nextValues_0);
73
183
  };
74
- const getIndex = target => Number(target?.getAttribute('data-index'));
75
- const map = {};
184
+ $[29] = handleValueChange;
185
+ $[30] = validValues;
186
+ $[31] = t12;
187
+ } else {
188
+ t12 = $[31];
189
+ }
190
+ const setValueAndSwap = t12;
191
+ const getIndex = _temp;
192
+ let map;
193
+ if ($[32] !== disabled || $[33] !== max || $[34] !== min || $[35] !== setValueAndSwap || $[36] !== validStep || $[37] !== validValues) {
194
+ map = {};
76
195
  if (!disabled) {
77
- map.left = map.down = ({
78
- target
79
- }) => {
80
- const index = getIndex(target);
81
- setValueAndSwap(Math.max(min, validValues[index] - validStep), index);
82
- };
83
- map.right = map.up = ({
84
- target
85
- }) => {
86
- const index = getIndex(target);
87
- setValueAndSwap(Math.min(max, validValues[index] + validStep), index);
88
- };
89
- map.home = ({
90
- target
91
- }) => {
92
- const index = getIndex(target);
93
- setValueAndSwap(min, index);
94
- };
95
- map.end = ({
96
- target
97
- }) => {
98
- const index = getIndex(target);
99
- setValueAndSwap(max, index);
100
- };
101
- }
102
- return map;
103
- }, [disabled, handleValueChange, max, min, validStep, validValues]);
104
- const handleMouseDown = useCallback(e => {
105
- e.stopPropagation();
106
- if (disabled) {
107
- return;
108
- }
109
- const index = e.currentTarget.getAttribute('data-index');
110
- const nextValue = calculateValue(ref, e.pageX, min, max, validStep);
111
- if (nextValue !== null && !isNaN(nextValue) && !index) {
112
- const rangeIndex = Number(Math.abs(validValues[0] - nextValue) > Math.abs(validValues[1] - nextValue));
113
- setDraggedIndex(isRange ? rangeIndex : 0);
114
- } else {
115
- setDraggedIndex(Number(index));
116
- }
117
- setIsDragging(true);
118
- previouslyDragged.current = false;
119
- }, [disabled, isRange, max, min, validStep, validValues]);
120
- const handleMouseUp = useCallback(({
121
- pageX
122
- }) => {
123
- const nextValues = adjustValues(validValues, ref, draggedIndex, pageX, max, min, validStep);
124
- if (nextValues[0] > nextValues[1]) {
125
- nextValues.reverse();
126
- }
127
- handleValueChange(nextValues);
128
- setDraggedIndex(-1);
129
- setIsDragging(false);
130
- previouslyDragged.current = true;
131
- }, [validValues, draggedIndex, handleValueChange, max, min, validStep]);
132
- const handleMouseMove = useCallback(({
133
- pageX
134
- }) => {
135
- const nextValues = adjustValues(validValues, ref, draggedIndex, pageX, max, min, validStep);
136
- if (nextValues[0] > nextValues[1]) {
137
- nextValues.reverse();
138
- setDraggedIndex(prevState => prevState === 0 ? 1 : 0);
139
- }
140
- handleValueChange(nextValues);
141
- }, [validValues, draggedIndex, max, min, validStep, handleValueChange]);
142
- useEffect(() => {
143
- if (disabled) {
144
- return undefined;
145
- }
146
- if (isDragging && !previouslyDragged.current) {
147
- window.addEventListener('mousemove', handleMouseMove);
148
- window.addEventListener('mouseup', handleMouseUp);
149
- } else if (!isDragging && previouslyDragged.current) {
150
- window.removeEventListener('mousemove', handleMouseMove);
151
- window.removeEventListener('mouseup', handleMouseUp);
196
+ let t13;
197
+ if ($[39] !== min || $[40] !== setValueAndSwap || $[41] !== validStep || $[42] !== validValues) {
198
+ t13 = t14 => {
199
+ const {
200
+ target: target_0
201
+ } = t14;
202
+ const index_0 = getIndex(target_0);
203
+ setValueAndSwap(Math.max(min, validValues[index_0] - validStep), index_0);
204
+ };
205
+ $[39] = min;
206
+ $[40] = setValueAndSwap;
207
+ $[41] = validStep;
208
+ $[42] = validValues;
209
+ $[43] = t13;
210
+ } else {
211
+ t13 = $[43];
212
+ }
213
+ map.left = map.down = t13;
214
+ let t14;
215
+ if ($[44] !== max || $[45] !== setValueAndSwap || $[46] !== validStep || $[47] !== validValues) {
216
+ t14 = t15 => {
217
+ const {
218
+ target: target_1
219
+ } = t15;
220
+ const index_1 = getIndex(target_1);
221
+ setValueAndSwap(Math.min(max, validValues[index_1] + validStep), index_1);
222
+ };
223
+ $[44] = max;
224
+ $[45] = setValueAndSwap;
225
+ $[46] = validStep;
226
+ $[47] = validValues;
227
+ $[48] = t14;
228
+ } else {
229
+ t14 = $[48];
230
+ }
231
+ map.right = map.up = t14;
232
+ let t15;
233
+ if ($[49] !== min || $[50] !== setValueAndSwap) {
234
+ t15 = t16 => {
235
+ const {
236
+ target: target_2
237
+ } = t16;
238
+ const index_2 = getIndex(target_2);
239
+ setValueAndSwap(min, index_2);
240
+ };
241
+ $[49] = min;
242
+ $[50] = setValueAndSwap;
243
+ $[51] = t15;
244
+ } else {
245
+ t15 = $[51];
246
+ }
247
+ map.home = t15;
248
+ let t16;
249
+ if ($[52] !== max || $[53] !== setValueAndSwap) {
250
+ t16 = t17 => {
251
+ const {
252
+ target: target_3
253
+ } = t17;
254
+ const index_3 = getIndex(target_3);
255
+ setValueAndSwap(max, index_3);
256
+ };
257
+ $[52] = max;
258
+ $[53] = setValueAndSwap;
259
+ $[54] = t16;
260
+ } else {
261
+ t16 = $[54];
262
+ }
263
+ map.end = t16;
152
264
  }
153
- return () => {
154
- window.removeEventListener('mousemove', handleMouseMove);
155
- window.removeEventListener('mouseup', handleMouseUp);
265
+ $[32] = disabled;
266
+ $[33] = max;
267
+ $[34] = min;
268
+ $[35] = setValueAndSwap;
269
+ $[36] = validStep;
270
+ $[37] = validValues;
271
+ $[38] = map;
272
+ } else {
273
+ map = $[38];
274
+ }
275
+ const shortcutsMap = map;
276
+ let t13;
277
+ if ($[55] !== disabled || $[56] !== isRange || $[57] !== max || $[58] !== min || $[59] !== validStep || $[60] !== validValues[0] || $[61] !== validValues[1]) {
278
+ t13 = e => {
279
+ e.stopPropagation();
280
+ if (disabled) {
281
+ return;
282
+ }
283
+ const index_4 = e.currentTarget.getAttribute("data-index");
284
+ const nextValue_0 = calculateValue(ref, e.pageX, min, max, validStep);
285
+ if (nextValue_0 !== null && !isNaN(nextValue_0) && !index_4) {
286
+ const rangeIndex = Number(Math.abs(validValues[0] - nextValue_0) > Math.abs(validValues[1] - nextValue_0));
287
+ setDraggedIndex(isRange ? rangeIndex : 0);
288
+ } else {
289
+ setDraggedIndex(Number(index_4));
290
+ }
291
+ setIsDragging(true);
292
+ previouslyDragged.current = false;
293
+ };
294
+ $[55] = disabled;
295
+ $[56] = isRange;
296
+ $[57] = max;
297
+ $[58] = min;
298
+ $[59] = validStep;
299
+ $[60] = validValues[0];
300
+ $[61] = validValues[1];
301
+ $[62] = t13;
302
+ } else {
303
+ t13 = $[62];
304
+ }
305
+ const handleMouseDown = t13;
306
+ let t14;
307
+ if ($[63] !== draggedIndex || $[64] !== handleValueChange || $[65] !== max || $[66] !== min || $[67] !== validStep || $[68] !== validValues) {
308
+ t14 = t15 => {
309
+ const {
310
+ pageX
311
+ } = t15;
312
+ const nextValues_1 = adjustValues(validValues, ref, draggedIndex, pageX, max, min, validStep);
313
+ if (nextValues_1[0] > nextValues_1[1]) {
314
+ nextValues_1.reverse();
315
+ }
316
+ handleValueChange(nextValues_1);
317
+ setDraggedIndex(-1);
318
+ setIsDragging(false);
319
+ previouslyDragged.current = true;
320
+ };
321
+ $[63] = draggedIndex;
322
+ $[64] = handleValueChange;
323
+ $[65] = max;
324
+ $[66] = min;
325
+ $[67] = validStep;
326
+ $[68] = validValues;
327
+ $[69] = t14;
328
+ } else {
329
+ t14 = $[69];
330
+ }
331
+ const handleMouseUp = t14;
332
+ let t15;
333
+ if ($[70] !== draggedIndex || $[71] !== handleValueChange || $[72] !== max || $[73] !== min || $[74] !== validStep || $[75] !== validValues) {
334
+ t15 = t16 => {
335
+ const {
336
+ pageX: pageX_0
337
+ } = t16;
338
+ const nextValues_2 = adjustValues(validValues, ref, draggedIndex, pageX_0, max, min, validStep);
339
+ if (nextValues_2[0] > nextValues_2[1]) {
340
+ nextValues_2.reverse();
341
+ setDraggedIndex(_temp2);
342
+ }
343
+ handleValueChange(nextValues_2);
344
+ };
345
+ $[70] = draggedIndex;
346
+ $[71] = handleValueChange;
347
+ $[72] = max;
348
+ $[73] = min;
349
+ $[74] = validStep;
350
+ $[75] = validValues;
351
+ $[76] = t15;
352
+ } else {
353
+ t15 = $[76];
354
+ }
355
+ const handleMouseMove = t15;
356
+ let t16;
357
+ let t17;
358
+ if ($[77] !== disabled || $[78] !== handleMouseMove || $[79] !== handleMouseUp || $[80] !== isDragging) {
359
+ t16 = () => {
360
+ if (disabled) {
361
+ return;
362
+ }
363
+ if (isDragging && !previouslyDragged.current) {
364
+ window.addEventListener("mousemove", handleMouseMove);
365
+ window.addEventListener("mouseup", handleMouseUp);
366
+ } else {
367
+ if (!isDragging && previouslyDragged.current) {
368
+ window.removeEventListener("mousemove", handleMouseMove);
369
+ window.removeEventListener("mouseup", handleMouseUp);
370
+ }
371
+ }
372
+ return () => {
373
+ window.removeEventListener("mousemove", handleMouseMove);
374
+ window.removeEventListener("mouseup", handleMouseUp);
375
+ };
156
376
  };
157
- }, [isDragging, handleMouseMove, handleMouseUp, disabled]);
158
- return jsxs("div", {
159
- ref: ref,
160
- role: 'presentation' // contains interactive elements
161
- ,
162
- className: classNames(styles.slider, className, {
377
+ t17 = [isDragging, handleMouseMove, handleMouseUp, disabled];
378
+ $[77] = disabled;
379
+ $[78] = handleMouseMove;
380
+ $[79] = handleMouseUp;
381
+ $[80] = isDragging;
382
+ $[81] = t16;
383
+ $[82] = t17;
384
+ } else {
385
+ t16 = $[81];
386
+ t17 = $[82];
387
+ }
388
+ useEffect(t16, t17);
389
+ const t18 = !!marks || showTag;
390
+ let t19;
391
+ if ($[83] !== className || $[84] !== disabled || $[85] !== t18) {
392
+ t19 = classNames(styles.slider, className, {
163
393
  [styles.disabled]: disabled,
164
- [styles.marked]: !!marks || showTag
165
- }),
166
- tabIndex: -1,
167
- onMouseDown: handleMouseDown,
168
- children: [jsx(Shortcuts, {
394
+ [styles.marked]: t18
395
+ });
396
+ $[83] = className;
397
+ $[84] = disabled;
398
+ $[85] = t18;
399
+ $[86] = t19;
400
+ } else {
401
+ t19 = $[86];
402
+ }
403
+ let t20;
404
+ if ($[87] !== shortcutsMap || $[88] !== shortcutsScope) {
405
+ t20 = /*#__PURE__*/jsx(Shortcuts, {
169
406
  map: shortcutsMap,
170
407
  scope: shortcutsScope
171
- }), jsx("div", {
172
- className: classNames(styles.rail, {
173
- [styles.rounded]: !showTicks,
174
- [styles.disabled]: disabled
175
- })
176
- }), jsx("div", {
177
- style: {
178
- left: `${trackStart}%`,
179
- width: `${trackLength}%`
180
- },
181
- className: classNames(styles.track, {
182
- [styles.rounded]: !showTicks,
183
- [styles.disabled]: disabled
184
- })
185
- }), validValues.map((numValue, index) => {
186
- const percent = toPercent(numValue, min, max);
187
- return (
188
- // eslint-disable-next-line react/no-array-index-key
189
- jsxs(Fragment, {
190
- children: [jsx("div", {
408
+ });
409
+ $[87] = shortcutsMap;
410
+ $[88] = shortcutsScope;
411
+ $[89] = t20;
412
+ } else {
413
+ t20 = $[89];
414
+ }
415
+ const t21 = !showTicks;
416
+ let t22;
417
+ if ($[90] !== disabled || $[91] !== t21) {
418
+ t22 = classNames(styles.rail, {
419
+ [styles.rounded]: t21,
420
+ [styles.disabled]: disabled
421
+ });
422
+ $[90] = disabled;
423
+ $[91] = t21;
424
+ $[92] = t22;
425
+ } else {
426
+ t22 = $[92];
427
+ }
428
+ let t23;
429
+ if ($[93] !== t22) {
430
+ t23 = /*#__PURE__*/jsx("div", {
431
+ className: t22
432
+ });
433
+ $[93] = t22;
434
+ $[94] = t23;
435
+ } else {
436
+ t23 = $[94];
437
+ }
438
+ const t24 = `${trackStart}%`;
439
+ const t25 = `${trackLength}%`;
440
+ let t26;
441
+ if ($[95] !== t24 || $[96] !== t25) {
442
+ t26 = {
443
+ left: t24,
444
+ width: t25
445
+ };
446
+ $[95] = t24;
447
+ $[96] = t25;
448
+ $[97] = t26;
449
+ } else {
450
+ t26 = $[97];
451
+ }
452
+ const t27 = !showTicks;
453
+ let t28;
454
+ if ($[98] !== disabled || $[99] !== t27) {
455
+ t28 = classNames(styles.track, {
456
+ [styles.rounded]: t27,
457
+ [styles.disabled]: disabled
458
+ });
459
+ $[98] = disabled;
460
+ $[99] = t27;
461
+ $[100] = t28;
462
+ } else {
463
+ t28 = $[100];
464
+ }
465
+ let t29;
466
+ if ($[101] !== t26 || $[102] !== t28) {
467
+ t29 = /*#__PURE__*/jsx("div", {
468
+ style: t26,
469
+ className: t28
470
+ });
471
+ $[101] = t26;
472
+ $[102] = t28;
473
+ $[103] = t29;
474
+ } else {
475
+ t29 = $[103];
476
+ }
477
+ let t30;
478
+ if ($[104] !== disabled || $[105] !== draggedIndex || $[106] !== handleMouseDown || $[107] !== isDragging || $[108] !== max || $[109] !== min || $[110] !== renderTag || $[111] !== showTag || $[112] !== validValues) {
479
+ let t31;
480
+ if ($[114] !== disabled || $[115] !== draggedIndex || $[116] !== handleMouseDown || $[117] !== isDragging || $[118] !== max || $[119] !== min || $[120] !== renderTag || $[121] !== showTag) {
481
+ t31 = (numValue, index_5) => {
482
+ const percent = toPercent(numValue, min, max);
483
+ return /*#__PURE__*/jsxs(Fragment, {
484
+ children: [/*#__PURE__*/jsx("div", {
191
485
  tabIndex: 0,
192
- "aria-label": 'Pick value',
193
- role: 'slider',
486
+ "aria-label": "Pick value",
487
+ role: "slider",
194
488
  "aria-valuemin": min,
195
489
  "aria-valuemax": max,
196
490
  "aria-valuenow": numValue,
197
- "data-index": index,
491
+ "data-index": index_5,
198
492
  style: {
199
493
  left: `${percent}%`
200
494
  },
201
495
  className: classNames(styles.thumb, {
202
496
  [styles.disabled]: disabled,
203
- [styles.dragged]: isDragging && draggedIndex === index
497
+ [styles.dragged]: isDragging && draggedIndex === index_5
204
498
  }),
205
499
  onMouseDown: handleMouseDown
206
- }), showTag && jsx("div", {
500
+ }), showTag && /*#__PURE__*/jsx("div", {
207
501
  style: {
208
502
  left: `${percent}%`
209
503
  },
210
504
  className: classNames(styles.tag, {
211
505
  [styles.disabled]: disabled
212
506
  }),
213
- role: 'tooltip',
507
+ role: "tooltip",
214
508
  children: renderTag ? renderTag(numValue) : numValue
215
509
  })]
216
- }, index)
217
- );
218
- }), markValues.map(({
219
- value: markValue,
220
- label
221
- }, index) => {
222
- const percent = toPercent(markValue, min, max);
223
- return jsx("div", {
224
- style: {
225
- left: `${percent}%`
226
- },
227
- className: classNames(styles.markValue, {
228
- [styles.disabled]: disabled
229
- }),
230
- children: label !== null && label !== void 0 ? label : markValue
231
- }, index);
232
- }), tickMarks.map(({
233
- value: tickValue
234
- }, index) => {
235
- const percent = toPercent(tickValue, min, max);
236
- const isActive = isRange ? tickValue >= validValues[0] && tickValue <= validValues[validValues.length - 1] : tickValue <= validValues[0];
237
- return jsx("div", {
238
- className: classNames(styles.tick, {
239
- [styles.active]: isActive,
240
- [styles.disabled]: disabled
241
- }),
242
- style: {
243
- left: `${percent}%`
244
- }
245
- }, index);
246
- })]
247
- });
510
+ }, index_5);
511
+ };
512
+ $[114] = disabled;
513
+ $[115] = draggedIndex;
514
+ $[116] = handleMouseDown;
515
+ $[117] = isDragging;
516
+ $[118] = max;
517
+ $[119] = min;
518
+ $[120] = renderTag;
519
+ $[121] = showTag;
520
+ $[122] = t31;
521
+ } else {
522
+ t31 = $[122];
523
+ }
524
+ t30 = validValues.map(t31);
525
+ $[104] = disabled;
526
+ $[105] = draggedIndex;
527
+ $[106] = handleMouseDown;
528
+ $[107] = isDragging;
529
+ $[108] = max;
530
+ $[109] = min;
531
+ $[110] = renderTag;
532
+ $[111] = showTag;
533
+ $[112] = validValues;
534
+ $[113] = t30;
535
+ } else {
536
+ t30 = $[113];
537
+ }
538
+ let t31;
539
+ if ($[123] !== disabled || $[124] !== markValues || $[125] !== max || $[126] !== min) {
540
+ let t32;
541
+ if ($[128] !== disabled || $[129] !== max || $[130] !== min) {
542
+ t32 = (t33, index_6) => {
543
+ const {
544
+ value: markValue,
545
+ label
546
+ } = t33;
547
+ const percent_0 = toPercent(markValue, min, max);
548
+ return /*#__PURE__*/jsx("div", {
549
+ style: {
550
+ left: `${percent_0}%`
551
+ },
552
+ className: classNames(styles.markValue, {
553
+ [styles.disabled]: disabled
554
+ }),
555
+ children: label !== null && label !== void 0 ? label : markValue
556
+ }, index_6);
557
+ };
558
+ $[128] = disabled;
559
+ $[129] = max;
560
+ $[130] = min;
561
+ $[131] = t32;
562
+ } else {
563
+ t32 = $[131];
564
+ }
565
+ t31 = markValues.map(t32);
566
+ $[123] = disabled;
567
+ $[124] = markValues;
568
+ $[125] = max;
569
+ $[126] = min;
570
+ $[127] = t31;
571
+ } else {
572
+ t31 = $[127];
573
+ }
574
+ let t32;
575
+ if ($[132] !== disabled || $[133] !== isRange || $[134] !== max || $[135] !== min || $[136] !== tickMarks || $[137] !== validValues) {
576
+ let t33;
577
+ if ($[139] !== disabled || $[140] !== isRange || $[141] !== max || $[142] !== min || $[143] !== validValues) {
578
+ t33 = (t34, index_7) => {
579
+ const {
580
+ value: tickValue
581
+ } = t34;
582
+ const percent_1 = toPercent(tickValue, min, max);
583
+ const isActive = isRange ? tickValue >= validValues[0] && tickValue <= validValues[validValues.length - 1] : tickValue <= validValues[0];
584
+ return /*#__PURE__*/jsx("div", {
585
+ className: classNames(styles.tick, {
586
+ [styles.active]: isActive,
587
+ [styles.disabled]: disabled
588
+ }),
589
+ style: {
590
+ left: `${percent_1}%`
591
+ }
592
+ }, index_7);
593
+ };
594
+ $[139] = disabled;
595
+ $[140] = isRange;
596
+ $[141] = max;
597
+ $[142] = min;
598
+ $[143] = validValues;
599
+ $[144] = t33;
600
+ } else {
601
+ t33 = $[144];
602
+ }
603
+ t32 = tickMarks.map(t33);
604
+ $[132] = disabled;
605
+ $[133] = isRange;
606
+ $[134] = max;
607
+ $[135] = min;
608
+ $[136] = tickMarks;
609
+ $[137] = validValues;
610
+ $[138] = t32;
611
+ } else {
612
+ t32 = $[138];
613
+ }
614
+ let t33;
615
+ if ($[145] !== handleMouseDown || $[146] !== t19 || $[147] !== t20 || $[148] !== t23 || $[149] !== t29 || $[150] !== t30 || $[151] !== t31 || $[152] !== t32) {
616
+ t33 = /*#__PURE__*/jsxs("div", {
617
+ ref: ref,
618
+ role: "presentation",
619
+ className: t19,
620
+ tabIndex: -1,
621
+ onMouseDown: handleMouseDown,
622
+ children: [t20, t23, t29, t30, t31, t32]
623
+ });
624
+ $[145] = handleMouseDown;
625
+ $[146] = t19;
626
+ $[147] = t20;
627
+ $[148] = t23;
628
+ $[149] = t29;
629
+ $[150] = t30;
630
+ $[151] = t31;
631
+ $[152] = t32;
632
+ $[153] = t33;
633
+ } else {
634
+ t33 = $[153];
635
+ }
636
+ return t33;
248
637
  };
638
+ function _temp(target) {
639
+ return Number(target?.getAttribute("data-index"));
640
+ }
641
+ function _temp2(prevState) {
642
+ return prevState === 0 ? 1 : 0;
643
+ }
249
644
 
250
645
  export { Slider };