@jetbrains/ring-ui-built 7.0.106 → 7.0.108

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 (104) hide show
  1. package/components/_helpers/date-picker.js +1 -1
  2. package/components/_helpers/theme.js +15 -14
  3. package/components/alert-service/alert-service.d.ts +2 -2
  4. package/components/alert-service/alert-service.js +2 -2
  5. package/components/auth/auth-core.js +1 -0
  6. package/components/auth/auth.js +1 -0
  7. package/components/auth/iframe-flow.js +1 -0
  8. package/components/auth/token-validator.js +1 -0
  9. package/components/auth-dialog/auth-dialog.js +1 -0
  10. package/components/auth-dialog-service/auth-dialog-service.js +1 -0
  11. package/components/avatar/avatar.js +1 -0
  12. package/components/avatar-stack/avatar-stack.js +1 -0
  13. package/components/banner/banner.js +1 -0
  14. package/components/button-group/button-group.js +18 -1
  15. package/components/components/util-stories.js +3 -0
  16. package/components/confirm/confirm.js +1 -0
  17. package/components/confirm-service/confirm-service.js +1 -0
  18. package/components/data-list/data-list.js +1 -0
  19. package/components/data-list/selection.js +1 -0
  20. package/components/date-picker/animate-date.d.ts +1 -0
  21. package/components/date-picker/animate-date.js +39 -0
  22. package/components/date-picker/consts.d.ts +21 -4
  23. package/components/date-picker/consts.js +18 -1
  24. package/components/date-picker/date-picker.d.ts +48 -1
  25. package/components/date-picker/date-picker.js +44 -17
  26. package/components/date-picker/date-popup.d.ts +3 -9
  27. package/components/date-picker/date-popup.js +59 -72
  28. package/components/date-picker/day.js +24 -15
  29. package/components/date-picker/month-names.js +76 -72
  30. package/components/date-picker/month-slider.d.ts +5 -20
  31. package/components/date-picker/month-slider.js +129 -47
  32. package/components/date-picker/month.d.ts +4 -0
  33. package/components/date-picker/month.js +81 -76
  34. package/components/date-picker/months.js +75 -191
  35. package/components/date-picker/scroll-arith.d.ts +35 -0
  36. package/components/date-picker/scroll-arith.js +74 -0
  37. package/components/date-picker/use-intersection-observer.d.ts +6 -0
  38. package/components/date-picker/use-intersection-observer.js +93 -0
  39. package/components/date-picker/use-scroll-behavior.d.ts +8 -0
  40. package/components/date-picker/use-scroll-behavior.js +223 -0
  41. package/components/date-picker/weekdays.js +3 -0
  42. package/components/date-picker/years.d.ts +1 -18
  43. package/components/date-picker/years.js +259 -78
  44. package/components/dialog/dialog.js +1 -0
  45. package/components/dropdown-menu/dropdown-menu.js +1 -0
  46. package/components/editable-heading/editable-heading.js +1 -0
  47. package/components/error-bubble/error-bubble.js +1 -0
  48. package/components/footer/footer.d.ts +1 -1
  49. package/components/global/dom.d.ts +1 -1
  50. package/components/global/dom.js +1 -1
  51. package/components/header/header.js +1 -0
  52. package/components/header/profile.js +1 -0
  53. package/components/header/services.js +1 -0
  54. package/components/header/smart-profile.js +1 -0
  55. package/components/header/smart-services.js +1 -0
  56. package/components/heading/heading.d.ts +4 -4
  57. package/components/list/list-item.js +1 -0
  58. package/components/list/list-users-groups-source.js +1 -0
  59. package/components/list/list.js +1 -0
  60. package/components/login-dialog/login-dialog.js +1 -0
  61. package/components/login-dialog/service.js +1 -0
  62. package/components/message/message.js +1 -0
  63. package/components/old-browsers-message/old-browsers-message-stop.js +1 -0
  64. package/components/old-browsers-message/old-browsers-message.js +1 -0
  65. package/components/old-browsers-message/white-list.js +3 -2
  66. package/components/pager/pager.js +1 -0
  67. package/components/popup/popup.js +1 -0
  68. package/components/popup/position-css.js +1 -0
  69. package/components/popup/position.js +1 -0
  70. package/components/popup-menu/popup-menu.js +1 -0
  71. package/components/query-assist/query-assist-suggestions.js +1 -0
  72. package/components/query-assist/query-assist.js +1 -0
  73. package/components/select/select-filter.js +1 -0
  74. package/components/select/select-popup.js +1 -0
  75. package/components/select/select.js +1 -0
  76. package/components/shortcuts/core.js +1 -0
  77. package/components/shortcuts/shortcuts-hoc.js +1 -0
  78. package/components/shortcuts/shortcuts.js +1 -0
  79. package/components/slider/slider.js +1 -0
  80. package/components/style.css +1 -1
  81. package/components/table/disable-hover-hoc.js +1 -0
  82. package/components/table/multitable.js +1 -0
  83. package/components/table/row-with-focus-sensor.js +1 -0
  84. package/components/table/row.js +1 -0
  85. package/components/table/simple-table.js +1 -0
  86. package/components/table/smart-table.js +1 -0
  87. package/components/table/table.js +1 -0
  88. package/components/tabs/collapsible-more.js +1 -0
  89. package/components/tabs/collapsible-tabs.js +1 -0
  90. package/components/tabs/dumb-tabs.d.ts +1 -0
  91. package/components/tabs/dumb-tabs.js +3 -1
  92. package/components/tabs/smart-tabs.js +1 -0
  93. package/components/tabs/tabs.js +1 -0
  94. package/components/tags-input/tags-input.js +1 -0
  95. package/components/tooltip/tooltip.js +1 -0
  96. package/components/user-agreement/service.js +1 -0
  97. package/components/user-agreement/user-agreement.js +1 -0
  98. package/components/user-card/card.js +1 -0
  99. package/components/user-card/smart-user-card-tooltip.js +1 -0
  100. package/components/user-card/tooltip.js +1 -0
  101. package/components/user-card/user-card.js +1 -0
  102. package/components/util-stories.d.ts +1 -0
  103. package/package.json +3 -3
  104. package/typings.d.ts +5 -0
@@ -1,225 +1,109 @@
1
1
  import { c } from 'react-compiler-runtime';
2
- import { useRef, useEffect, createElement } from 'react';
3
2
  import { addMonths } from 'date-fns/addMonths';
4
- import { getDay } from 'date-fns/getDay';
5
- import { getDaysInMonth } from 'date-fns/getDaysInMonth';
6
3
  import { startOfMonth } from 'date-fns/startOfMonth';
7
- import { subMonths } from 'date-fns/subMonths';
8
- import { endOfMonth } from 'date-fns/endOfMonth';
4
+ import Month, { getMonthHeight } from './month.js';
5
+ import units from './consts.js';
6
+ import { ScrollArith } from './scroll-arith.js';
7
+ import { useScrollBehavior } from './use-scroll-behavior.js';
9
8
  import scheduleRAF from '../global/schedule-raf.js';
10
- import linearFunction from '../global/linear-function.js';
11
- import useEventCallback from '../global/use-event-callback.js';
12
- import Month from './month.js';
13
- import MonthNames from './month-names.js';
14
- import units, { DOUBLE, HALF, WEEK, weekdays } from './consts.js';
9
+ import { useIntersectionObserver } from './use-intersection-observer.js';
15
10
  import { s as styles } from '../_helpers/date-picker.js';
16
- import { jsx, jsxs } from 'react/jsx-runtime';
17
- import 'date-fns/addDays';
11
+ import { createElement } from 'react';
12
+ import { jsx } from 'react/jsx-runtime';
18
13
  import 'date-fns/format';
19
- import 'date-fns/setDay';
14
+ import 'date-fns/getDay';
15
+ import 'date-fns';
20
16
  import './day.js';
17
+ import 'core-js/modules/es.array.includes.js';
21
18
  import 'classnames';
19
+ import 'date-fns/addDays';
22
20
  import 'date-fns/getDate';
23
21
  import 'date-fns/isAfter';
24
22
  import 'date-fns/isBefore';
25
23
  import 'date-fns/isSameDay';
26
24
  import 'date-fns/isToday';
27
25
  import 'date-fns/startOfDay';
28
- import 'date-fns/isThisMonth';
29
- import 'date-fns/set';
30
- import 'date-fns/startOfYear';
31
- import './month-slider.js';
32
- import 'date-fns/addYears';
33
- import 'date-fns/subYears';
34
26
  import 'date-fns/add';
27
+ import '../global/sniffer.js';
28
+ import 'sniffr';
29
+ import '../global/use-event-callback.js';
35
30
 
36
- const {
37
- unit,
38
- cellSize,
39
- calHeight
40
- } = units;
41
- const FridayToSunday = WEEK + weekdays.SU - weekdays.FR;
42
- const FIVELINES = 31;
43
- const TALLMONTH = 6;
44
- const SHORTMONTH = 5;
45
- const PADDING = 2;
46
- const MONTHSBACK = 2;
47
- function monthHeight(date) {
48
- const monthStart = startOfMonth(date);
49
- const daysSinceLastFriday = (getDay(monthStart) + FridayToSunday) % WEEK;
50
- const monthLines = daysSinceLastFriday + getDaysInMonth(monthStart) > FIVELINES ? TALLMONTH : SHORTMONTH;
51
- return monthLines * cellSize + unit * PADDING;
52
- }
53
- // in milliseconds per pixel
54
- function scrollSpeed(date) {
55
- const monthStart = startOfMonth(date);
56
- const monthEnd = endOfMonth(date);
57
- return (Number(monthEnd) - Number(monthStart)) / monthHeight(monthStart);
31
+ function getMonthHeightWithMargin(date, locale) {
32
+ return units.unit * 2 + getMonthHeight(date, locale);
58
33
  }
59
- const scrollSchedule = scheduleRAF();
60
- let dy = 0;
34
+ const scrollArith = new ScrollArith({
35
+ itemsAround: 60,
36
+ floorToItem: startOfMonth,
37
+ shiftItems: addMonths,
38
+ getItemHeight: (item, locale) => getMonthHeightWithMargin(item, locale)
39
+ });
40
+ const scheduleScroll = scheduleRAF();
41
+ /**
42
+ * In range selection (start/end dates across different months), the gap between months
43
+ * is correctly background-filled only when both months are reported as visible.
44
+ *
45
+ * To avoid an unpainted gap at the viewport boundary, the next month must be reported
46
+ * as visible slightly before it actually enters the viewport. We achieve this by
47
+ * extending the IntersectionObserver scrollMargin.
48
+ */
49
+ const intersectionObserverScrollMargin = units.cellSize * 2;
61
50
  function Months(props) {
62
- const $ = c(30);
63
- if ($[0] !== "5d5fe78f7bda393a523d9472cfc721d7ae4d117fe8278fd6d3d9589b20c1969a") {
64
- for (let $i = 0; $i < 30; $i += 1) {
51
+ const $ = c(11);
52
+ if ($[0] !== "4aa546d8594d34e20d23ddb1ac60f352dda8d4f0089b69b199ba5199e1f35dd5") {
53
+ for (let $i = 0; $i < 11; $i += 1) {
65
54
  $[$i] = Symbol.for("react.memo_cache_sentinel");
66
55
  }
67
- $[0] = "5d5fe78f7bda393a523d9472cfc721d7ae4d117fe8278fd6d3d9589b20c1969a";
56
+ $[0] = "4aa546d8594d34e20d23ddb1ac60f352dda8d4f0089b69b199ba5199e1f35dd5";
68
57
  }
69
58
  const {
70
- scrollDate
59
+ scrollDate,
60
+ setScrollDate,
61
+ locale
71
62
  } = props;
72
- let monthStart;
73
- let months;
74
- if ($[1] !== scrollDate) {
75
- const monthDate = scrollDate instanceof Date ? scrollDate : new Date(scrollDate);
76
- monthStart = startOfMonth(monthDate);
77
- let month = subMonths(monthStart, MONTHSBACK);
78
- months = [month];
79
- for (let i = 0; i < MONTHSBACK * DOUBLE; i++) {
80
- month = addMonths(month, 1);
81
- months.push(month);
82
- }
83
- $[1] = scrollDate;
84
- $[2] = monthStart;
85
- $[3] = months;
86
- } else {
87
- monthStart = $[2];
88
- months = $[3];
89
- }
90
- let pxToDate;
63
+ const {
64
+ containerRef,
65
+ items
66
+ } = useScrollBehavior(scrollDate, setScrollDate, locale, "monthsScroll", scrollArith, scheduleScroll);
67
+ const intersectionObserverHandle = useIntersectionObserver(containerRef, intersectionObserverScrollMargin);
91
68
  let t0;
92
- if ($[4] !== monthStart || $[5] !== scrollDate) {
93
- const currentSpeed = scrollSpeed(scrollDate);
94
- pxToDate = linearFunction(0, Number(scrollDate), currentSpeed);
95
- t0 = pxToDate.x(Number(monthStart));
96
- $[4] = monthStart;
97
- $[5] = scrollDate;
98
- $[6] = pxToDate;
99
- $[7] = t0;
100
- } else {
101
- pxToDate = $[6];
102
- t0 = $[7];
103
- }
104
- const offset = t0;
105
- const bottomOffset = monthHeight(scrollDate) + offset;
106
- const componentRef = useRef(null);
107
- let t1;
108
- if ($[8] !== bottomOffset || $[9] !== months || $[10] !== offset || $[11] !== props || $[12] !== pxToDate) {
109
- t1 = e => {
110
- e.preventDefault();
111
- dy = dy + e.deltaY;
112
- scrollSchedule(() => {
113
- let date;
114
- if (dy < offset) {
115
- date = pxToDate.y(offset) + (dy - offset) * scrollSpeed(months[1]);
116
- } else {
117
- if (dy > bottomOffset) {
118
- date = pxToDate.y(bottomOffset) + (dy - bottomOffset) * scrollSpeed(months[MONTHSBACK + 1]);
119
- } else {
120
- date = pxToDate.y(dy);
121
- }
122
- }
123
- props.onScroll(date);
124
- dy = 0;
69
+ if ($[1] !== intersectionObserverHandle || $[2] !== items || $[3] !== props) {
70
+ let t1;
71
+ if ($[5] !== intersectionObserverHandle || $[6] !== props) {
72
+ t1 = month => /*#__PURE__*/createElement(Month, {
73
+ ...props,
74
+ month: month,
75
+ key: +month,
76
+ intersectionObserverHandle: intersectionObserverHandle
125
77
  });
126
- };
127
- $[8] = bottomOffset;
128
- $[9] = months;
129
- $[10] = offset;
130
- $[11] = props;
131
- $[12] = pxToDate;
132
- $[13] = t1;
133
- } else {
134
- t1 = $[13];
135
- }
136
- const handleWheel = useEventCallback(t1);
137
- let t2;
138
- let t3;
139
- if ($[14] !== handleWheel) {
140
- t2 = () => {
141
- const current = componentRef.current;
142
- if (current) {
143
- current.addEventListener("wheel", handleWheel, {
144
- passive: false
145
- });
146
- }
147
- return () => {
148
- if (current) {
149
- current.removeEventListener("wheel", handleWheel);
150
- }
151
- };
152
- };
153
- t3 = [handleWheel];
154
- $[14] = handleWheel;
155
- $[15] = t2;
156
- $[16] = t3;
157
- } else {
158
- t2 = $[15];
159
- t3 = $[16];
160
- }
161
- useEffect(t2, t3);
162
- const t4 = Math.floor(calHeight * HALF - monthHeight(months[0]) - monthHeight(months[1]) + offset);
163
- let t5;
164
- if ($[17] !== t4) {
165
- t5 = {
166
- top: t4
167
- };
168
- $[17] = t4;
169
- $[18] = t5;
170
- } else {
171
- t5 = $[18];
172
- }
173
- let t6;
174
- if ($[19] !== months || $[20] !== props) {
175
- t6 = months.map(date_0 => /*#__PURE__*/createElement(Month, {
176
- ...props,
177
- month: date_0,
178
- key: +date_0
179
- }));
180
- $[19] = months;
181
- $[20] = props;
182
- $[21] = t6;
183
- } else {
184
- t6 = $[21];
185
- }
186
- let t7;
187
- if ($[22] !== t5 || $[23] !== t6) {
188
- t7 = /*#__PURE__*/jsx("div", {
189
- style: t5,
190
- className: styles.days,
191
- children: t6
192
- });
193
- $[22] = t5;
194
- $[23] = t6;
195
- $[24] = t7;
196
- } else {
197
- t7 = $[24];
198
- }
199
- let t8;
200
- if ($[25] !== props) {
201
- t8 = /*#__PURE__*/jsx(MonthNames, {
202
- ...props
203
- });
204
- $[25] = props;
205
- $[26] = t8;
78
+ $[5] = intersectionObserverHandle;
79
+ $[6] = props;
80
+ $[7] = t1;
81
+ } else {
82
+ t1 = $[7];
83
+ }
84
+ t0 = items.map(t1);
85
+ $[1] = intersectionObserverHandle;
86
+ $[2] = items;
87
+ $[3] = props;
88
+ $[4] = t0;
206
89
  } else {
207
- t8 = $[26];
90
+ t0 = $[4];
208
91
  }
209
- let t9;
210
- if ($[27] !== t7 || $[28] !== t8) {
211
- t9 = /*#__PURE__*/jsxs("div", {
92
+ let t1;
93
+ if ($[8] !== containerRef || $[9] !== t0) {
94
+ t1 = /*#__PURE__*/jsx("div", {
212
95
  className: styles.months,
213
- ref: componentRef,
214
- children: [t7, t8]
96
+ ref: containerRef,
97
+ "data-test": "ring-date-popup--months",
98
+ children: t0
215
99
  });
216
- $[27] = t7;
217
- $[28] = t8;
218
- $[29] = t9;
100
+ $[8] = containerRef;
101
+ $[9] = t0;
102
+ $[10] = t1;
219
103
  } else {
220
- t9 = $[29];
104
+ t1 = $[10];
221
105
  }
222
- return t9;
106
+ return t1;
223
107
  }
224
108
 
225
109
  export { Months as default };
@@ -0,0 +1,35 @@
1
+ import { type Locale } from 'date-fns';
2
+ /**
3
+ * Scroll math helper for month/year scrollers.
4
+ *
5
+ * An "item" is a floor-boundary date representing the start of a visible period
6
+ * (e.g. start of a month or start of a year).
7
+ */
8
+ export declare class ScrollArith {
9
+ private itemsAround;
10
+ private floorToItem;
11
+ private shiftItem;
12
+ private getItemHeight;
13
+ constructor(params: {
14
+ itemsAround: number;
15
+ floorToItem: (date: Date) => Date;
16
+ shiftItems: (date: Date, delta: number) => Date;
17
+ getItemHeight: (item: Date, locale: Locale | undefined) => number;
18
+ });
19
+ /**
20
+ * Builds a symmetric list of items centered around the given scrollDate.
21
+ */
22
+ getItems(scrollDate: Date | number): Date[];
23
+ /**
24
+ * Computes the scroll offset which places the `scrollDate` at the vertical center.
25
+ */
26
+ getScrollTop(items: Date[], scrollDate: Date | number, locale: Locale | undefined): number;
27
+ getItemsAndScrollTop(scrollDate: Date | number, locale: Locale | undefined): {
28
+ newItems: Date[];
29
+ newScrollTop: number;
30
+ };
31
+ /**
32
+ * Returns the date currently located in the vertical center of the calendar.
33
+ */
34
+ getScrollDate(items: Date[], scrollTop: number, locale: Locale | undefined): Date;
35
+ }
@@ -0,0 +1,74 @@
1
+ import units, { HALF } from './consts.js';
2
+ import 'date-fns/add';
3
+ import '../global/sniffer.js';
4
+ import 'sniffr';
5
+
6
+ /**
7
+ * Scroll math helper for month/year scrollers.
8
+ *
9
+ * An "item" is a floor-boundary date representing the start of a visible period
10
+ * (e.g. start of a month or start of a year).
11
+ */
12
+ class ScrollArith {
13
+ itemsAround;
14
+ floorToItem;
15
+ shiftItem;
16
+ getItemHeight;
17
+ constructor(params) {
18
+ this.itemsAround = params.itemsAround;
19
+ this.floorToItem = params.floorToItem;
20
+ this.shiftItem = params.shiftItems;
21
+ this.getItemHeight = params.getItemHeight;
22
+ }
23
+ /**
24
+ * Builds a symmetric list of items centered around the given scrollDate.
25
+ */
26
+ getItems(scrollDate) {
27
+ const centerItem = this.floorToItem(new Date(scrollDate));
28
+ return Array.from({
29
+ length: 1 + this.itemsAround * 2
30
+ }, (_, index) => this.shiftItem(centerItem, index - this.itemsAround));
31
+ }
32
+ /**
33
+ * Computes the scroll offset which places the `scrollDate` at the vertical center.
34
+ */
35
+ getScrollTop(items, scrollDate, locale) {
36
+ const item = this.floorToItem(new Date(scrollDate));
37
+ const nextItem = this.shiftItem(item, 1);
38
+ let index = items.findIndex(it => Number(it) === Number(item));
39
+ if (index === -1) {
40
+ index = Number(item) < Number(items[0]) ? 0 : items.length - 1;
41
+ }
42
+ const itemFraction = (Number(scrollDate) - Number(item)) / (Number(nextItem) - Number(item));
43
+ const offsetWithinItem = itemFraction * this.getItemHeight(item, locale);
44
+ const heightBeforeItem = items.slice(0, index).reduce((totalHeight, it) => totalHeight + this.getItemHeight(it, locale), 0);
45
+ return heightBeforeItem + offsetWithinItem - units.calHeight * HALF;
46
+ }
47
+ getItemsAndScrollTop(scrollDate, locale) {
48
+ const newItems = this.getItems(scrollDate);
49
+ const newScrollTop = this.getScrollTop(newItems, scrollDate, locale);
50
+ return {
51
+ newItems,
52
+ newScrollTop
53
+ };
54
+ }
55
+ /**
56
+ * Returns the date currently located in the vertical center of the calendar.
57
+ */
58
+ getScrollDate(items, scrollTop, locale) {
59
+ let heightBeforeItem = 0;
60
+ for (const item of items) {
61
+ const itemHeight = this.getItemHeight(item, locale);
62
+ const offsetWithinItem = scrollTop - heightBeforeItem + units.calHeight * HALF;
63
+ if (offsetWithinItem < itemHeight) {
64
+ const itemFraction = offsetWithinItem / itemHeight;
65
+ const nextItem = this.shiftItem(item, 1);
66
+ return new Date(Number(item) + itemFraction * (Number(nextItem) - Number(item)));
67
+ }
68
+ heightBeforeItem += itemHeight;
69
+ }
70
+ return items[items.length - 1];
71
+ }
72
+ }
73
+
74
+ export { ScrollArith };
@@ -0,0 +1,6 @@
1
+ import { type RefObject } from 'react';
2
+ export declare function useIntersectionObserver(containerRef: RefObject<HTMLElement | null>, scrollMargin?: number): IntersectionObserverHandle | null;
3
+ export interface IntersectionObserverHandle {
4
+ observeVisibility(element: Element, setVisible: (isVisible: boolean) => void): () => void;
5
+ }
6
+ export declare function useVisibility(handle: IntersectionObserverHandle | null, elementRef: RefObject<Element | null>): boolean;
@@ -0,0 +1,93 @@
1
+ import { c } from 'react-compiler-runtime';
2
+ import { useState, useEffect } from 'react';
3
+
4
+ function useIntersectionObserver(containerRef, t0) {
5
+ const $ = c(5);
6
+ if ($[0] !== "85eea0b6bda17bfb5987776c879da3db3d1a41e1157672102d3b021b57efb05a") {
7
+ for (let $i = 0; $i < 5; $i += 1) {
8
+ $[$i] = Symbol.for("react.memo_cache_sentinel");
9
+ }
10
+ $[0] = "85eea0b6bda17bfb5987776c879da3db3d1a41e1157672102d3b021b57efb05a";
11
+ }
12
+ const scrollMargin = t0 === undefined ? 0 : t0;
13
+ const [handle, setHandle] = useState(null);
14
+ let t1;
15
+ let t2;
16
+ if ($[1] !== containerRef || $[2] !== scrollMargin) {
17
+ t1 = () => {
18
+ const container = containerRef.current;
19
+ if (!container) {
20
+ return;
21
+ }
22
+ const elementToSetVisible = new Map();
23
+ const observer = new IntersectionObserver(entries => {
24
+ for (const entry of entries) {
25
+ const setVisible = elementToSetVisible.get(entry.target);
26
+ setVisible?.(entry.isIntersecting);
27
+ }
28
+ }, {
29
+ root: container,
30
+ ...(scrollMargin ? {
31
+ scrollMargin: `${scrollMargin}px`
32
+ } : {})
33
+ });
34
+ setHandle({
35
+ observeVisibility(element, setVisible_0) {
36
+ elementToSetVisible.set(element, setVisible_0);
37
+ observer.observe(element);
38
+ return () => {
39
+ elementToSetVisible.delete(element);
40
+ observer.unobserve(element);
41
+ };
42
+ }
43
+ });
44
+ return () => {
45
+ observer.disconnect();
46
+ setHandle(null);
47
+ };
48
+ };
49
+ t2 = [containerRef, scrollMargin];
50
+ $[1] = containerRef;
51
+ $[2] = scrollMargin;
52
+ $[3] = t1;
53
+ $[4] = t2;
54
+ } else {
55
+ t1 = $[3];
56
+ t2 = $[4];
57
+ }
58
+ useEffect(t1, t2);
59
+ return handle;
60
+ }
61
+ function useVisibility(handle, elementRef) {
62
+ const $ = c(5);
63
+ if ($[0] !== "85eea0b6bda17bfb5987776c879da3db3d1a41e1157672102d3b021b57efb05a") {
64
+ for (let $i = 0; $i < 5; $i += 1) {
65
+ $[$i] = Symbol.for("react.memo_cache_sentinel");
66
+ }
67
+ $[0] = "85eea0b6bda17bfb5987776c879da3db3d1a41e1157672102d3b021b57efb05a";
68
+ }
69
+ const [isVisible, setIsVisible] = useState(false);
70
+ let t0;
71
+ let t1;
72
+ if ($[1] !== elementRef || $[2] !== handle) {
73
+ t0 = () => {
74
+ const element = elementRef.current;
75
+ if (!element || !handle) {
76
+ return;
77
+ }
78
+ return handle.observeVisibility(element, setIsVisible);
79
+ };
80
+ t1 = [handle, elementRef, setIsVisible];
81
+ $[1] = elementRef;
82
+ $[2] = handle;
83
+ $[3] = t0;
84
+ $[4] = t1;
85
+ } else {
86
+ t0 = $[3];
87
+ t1 = $[4];
88
+ }
89
+ useEffect(t0, t1);
90
+ return isVisible;
91
+ }
92
+
93
+ export { useIntersectionObserver, useVisibility };
@@ -0,0 +1,8 @@
1
+ import { type Locale } from 'date-fns';
2
+ import { type CalendarProps, type ScrollDate } from './consts';
3
+ import { type ScrollArith } from './scroll-arith';
4
+ import type scheduleRAF from '../global/schedule-raf';
5
+ export declare function useScrollBehavior(scrollDate: ScrollDate, onContainerScroll: CalendarProps['setScrollDate'], locale: Locale | undefined, selfScrollDateSource: ScrollDate['source'], arith: ScrollArith, scheduleScroll: ReturnType<typeof scheduleRAF>): {
6
+ containerRef: import("react").RefObject<HTMLDivElement | null>;
7
+ items: Date[];
8
+ };