@jetbrains/ring-ui-built 8.0.0-beta.3 → 8.0.0-beta.5

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 (120) hide show
  1. package/components/_helpers/alert.js +3 -0
  2. package/components/_helpers/caption.js +1 -1
  3. package/components/_helpers/header.js +1 -1
  4. package/components/_helpers/heading.js +2 -2
  5. package/components/_helpers/table.js +1 -1
  6. package/components/_helpers/theme.js +1 -1
  7. package/components/alert/alert-actions.d.ts +4 -0
  8. package/components/alert/alert-actions.js +51 -0
  9. package/components/alert/alert-heading.d.ts +4 -0
  10. package/components/alert/alert-heading.js +62 -0
  11. package/components/alert/alert.d.ts +14 -1
  12. package/components/alert/alert.js +44 -26
  13. package/components/alert-service/alert-service.d.ts +2 -1
  14. package/components/alert-service/alert-service.js +15 -5
  15. package/components/auth/auth-core.d.ts +5 -9
  16. package/components/auth/auth-core.js +71 -17
  17. package/components/auth/auth.js +7 -1
  18. package/components/auth/down-notification.js +7 -1
  19. package/components/auth/iframe-flow.js +1 -1
  20. package/components/auth/storage.js +7 -1
  21. package/components/checkbox/checkbox.d.ts +1 -1
  22. package/components/clipboard/clipboard.js +7 -1
  23. package/components/collapsible-group/collapsible-group.d.ts +20 -0
  24. package/components/collapsible-group/collapsible-group.js +382 -0
  25. package/components/components/util-stories.js +63 -1
  26. package/components/data-list/data-list.js +1 -1
  27. package/components/data-list/title.js +1 -1
  28. package/components/date-picker/consts.d.ts +1 -0
  29. package/components/date-picker/date-input.js +3 -2
  30. package/components/date-picker/date-popup.js +3 -3
  31. package/components/dropdown-menu/dropdown-menu.js +6 -6
  32. package/components/editable-heading/editable-heading.js +122 -109
  33. package/components/expand/collapsible-group.d.ts +8 -20
  34. package/components/expand/collapsible-group.js +34 -365
  35. package/components/global/compose-refs.d.ts +2 -1
  36. package/components/global/compose-refs.js +44 -8
  37. package/components/global/focus-sensor-hoc.js +1 -0
  38. package/components/global/focus-with-temporary-tabindex.d.ts +11 -0
  39. package/components/global/focus-with-temporary-tabindex.js +23 -0
  40. package/components/global/intersection-observer-context.d.ts +29 -9
  41. package/components/global/intersection-observer-context.js +50 -52
  42. package/components/global/is-within-interactive-element.d.ts +6 -0
  43. package/components/global/is-within-interactive-element.js +11 -0
  44. package/components/global/is-within-navigable-element.d.ts +6 -0
  45. package/components/global/is-within-navigable-element.js +11 -0
  46. package/components/global/parse-css-duration.d.ts +5 -0
  47. package/components/global/parse-css-duration.js +14 -0
  48. package/components/global/rerender-hoc.js +1 -0
  49. package/components/global/schedule-with-cleanup.d.ts +12 -0
  50. package/components/global/schedule-with-cleanup.js +36 -0
  51. package/components/global/table-selection.js +1 -1
  52. package/components/global/theme.js +1 -1
  53. package/components/header/header.js +8 -2
  54. package/components/header/smart-profile.js +7 -1
  55. package/components/heading/heading.js +3 -3
  56. package/components/http/http.d.ts +2 -2
  57. package/components/http/http.js +2 -2
  58. package/components/i18n/i18n.d.ts +1 -0
  59. package/components/i18n/i18n.js +2 -0
  60. package/components/input/input.d.ts +1 -1
  61. package/components/internal/reorder-animation-context.js +159 -0
  62. package/components/internal/reorder-handle.js +750 -0
  63. package/components/internal/reorder-layout-context.js +141 -0
  64. package/components/internal/table-header.js +685 -0
  65. package/components/{table/table-virtualize.js → internal/virtualization.js} +123 -84
  66. package/components/legacy-table/header-cell.js +2 -2
  67. package/components/legacy-table/row-with-focus-sensor.js +1 -1
  68. package/components/legacy-table/row.d.ts +1 -1
  69. package/components/legacy-table/simple-table.js +1 -1
  70. package/components/legacy-table/smart-table.js +1 -1
  71. package/components/legacy-table/table.js +1 -1
  72. package/components/markdown/markdown.js +2 -2
  73. package/components/message/message.js +1 -1
  74. package/components/old-browsers-message/white-list.js +2 -2
  75. package/components/popup/popup.d.ts +2 -0
  76. package/components/popup/popup.js +5 -1
  77. package/components/select/select-popup.d.ts +1 -1
  78. package/components/select/select.d.ts +1 -1
  79. package/components/storage/storage-local.js +7 -1
  80. package/components/storage/storage.js +7 -1
  81. package/components/style.css +1 -1
  82. package/components/table/default-item-renderer.d.ts +29 -10
  83. package/components/table/default-item-renderer.js +151 -93
  84. package/components/table/internal/reorder-animation-context.d.ts +21 -0
  85. package/components/table/internal/reorder-handle.d.ts +9 -0
  86. package/components/table/internal/reorder-layout-context.d.ts +16 -0
  87. package/components/table/internal/table-header.d.ts +1 -0
  88. package/components/table/internal/virtualization.d.ts +41 -0
  89. package/components/table/item-virtualization.d.ts +37 -0
  90. package/components/table/item-virtualization.js +73 -0
  91. package/components/table/reorder-animation.d.ts +37 -0
  92. package/components/table/reorder-animation.js +18 -0
  93. package/components/table/reorder-item-layout.d.ts +32 -0
  94. package/components/table/reorder-item-layout.js +57 -0
  95. package/components/table/table-const.d.ts +8 -6
  96. package/components/table/table-const.js +8 -6
  97. package/components/table/table-primitives.d.ts +52 -16
  98. package/components/table/table-primitives.js +64 -207
  99. package/components/table/table-props.d.ts +304 -0
  100. package/components/table/table-props.js +1 -0
  101. package/components/table/table.d.ts +231 -209
  102. package/components/table/table.js +365 -17
  103. package/components/tooltip/tooltip.js +1 -1
  104. package/components/user-agreement/service.js +13 -7
  105. package/components/user-card/card.js +7 -1
  106. package/components/user-card/smart-user-card-tooltip.d.ts +1 -1
  107. package/components/user-card/smart-user-card-tooltip.js +7 -1
  108. package/components/user-card/tooltip.js +7 -1
  109. package/components/user-card/user-card.js +7 -1
  110. package/components/util-stories.d.ts +26 -0
  111. package/package.json +3 -3
  112. package/components/date-picker/use-intersection-observer.d.ts +0 -6
  113. package/components/date-picker/use-intersection-observer.js +0 -93
  114. package/components/global/composeRefs.d.ts +0 -6
  115. package/components/global/composeRefs.js +0 -9
  116. package/components/table/table-component.d.ts +0 -80
  117. package/components/table/table-component.js +0 -290
  118. package/components/table/table-row-focus.d.ts +0 -4
  119. package/components/table/table-row-focus.js +0 -41
  120. package/components/table/table-virtualize.d.ts +0 -32
@@ -2,6 +2,14 @@ import { c } from 'react/compiler-runtime';
2
2
  import { useState, useEffect, use, createContext } from 'react';
3
3
 
4
4
  /**
5
+ * @internal
6
+ */
7
+ const noopIntersectionObserverHandle = {
8
+ observe: () => () => {}
9
+ };
10
+ /**
11
+ * Multiple components can share a single `IntersectionObserver` instance through this context.
12
+ *
5
13
  * Usage:
6
14
  *
7
15
  * ```tsx
@@ -12,33 +20,38 @@ import { useState, useEffect, use, createContext } from 'react';
12
20
  * function YourComponent() {
13
21
  * // Contains the current isIntersecting value
14
22
  * const isIntersecting = useIsIntersecting(elementRef);
15
- * // Or, to get updates instead:
16
- * useIsIntersectingListener(elementRef, newIsIntersecting => {
17
- * // ...
23
+ *
24
+ * // Or, to manually work with the IntersectionObserverHandle:
25
+ * const handle = use(IntersectionObserverContext);
26
+ * useEffect(() => {
27
+ * return handle.observe(elementRef.current, isIntersecting => { ... })
18
28
  * })
19
29
  * }
20
30
  * ```
21
31
  */
22
- const IntersectionObserverContext = /*#__PURE__*/createContext(null);
32
+ const IntersectionObserverContext = /*#__PURE__*/createContext(noopIntersectionObserverHandle);
33
+ /**
34
+ * Creates an IntersectionObserverHandle suitable for {@link IntersectionObserverContext}.
35
+ */
23
36
  function useIntersectionObserverHandle(rootRef, rootMargin, scrollMargin) {
24
37
  const $ = c(6);
25
- if ($[0] !== "dfabcb1b8108e1a7f2a2e74a1ab9f1d1069e1f7ab04eda46b950789426c929c9") {
38
+ if ($[0] !== "22e72f21c77e0579b51b95d0c9cf49c7e0027190e5186ad64aa7f2054bb7eb35") {
26
39
  for (let $i = 0; $i < 6; $i += 1) {
27
40
  $[$i] = Symbol.for("react.memo_cache_sentinel");
28
41
  }
29
- $[0] = "dfabcb1b8108e1a7f2a2e74a1ab9f1d1069e1f7ab04eda46b950789426c929c9";
42
+ $[0] = "22e72f21c77e0579b51b95d0c9cf49c7e0027190e5186ad64aa7f2054bb7eb35";
30
43
  }
31
- const [handle, setHandle] = useState(null);
44
+ const [handle, setHandle] = useState(noopIntersectionObserverHandle);
32
45
  let t0;
33
46
  let t1;
34
47
  if ($[1] !== rootMargin || $[2] !== rootRef || $[3] !== scrollMargin) {
35
48
  t0 = () => {
36
49
  const root = rootRef?.current;
37
- const elementToOnChange = new Map();
50
+ const callbacksByElement = new Map();
38
51
  const observer = new IntersectionObserver(entries => {
39
52
  for (const entry of entries) {
40
- const onChange = elementToOnChange.get(entry.target);
41
- onChange?.(entry.isIntersecting);
53
+ const callbacks = callbacksByElement.get(entry.target);
54
+ callbacks?.forEach(cb => cb(entry.isIntersecting));
42
55
  }
43
56
  }, {
44
57
  root,
@@ -46,18 +59,31 @@ function useIntersectionObserverHandle(rootRef, rootMargin, scrollMargin) {
46
59
  scrollMargin: scrollMargin != null ? `${scrollMargin}px` : undefined
47
60
  });
48
61
  setHandle({
49
- observe(element, onChange_0) {
50
- elementToOnChange.set(element, onChange_0);
51
- observer.observe(element);
62
+ observe(element, onChange) {
63
+ if (!callbacksByElement.has(element)) {
64
+ callbacksByElement.set(element, []);
65
+ observer.observe(element);
66
+ }
67
+ callbacksByElement.get(element).push(onChange);
52
68
  return () => {
53
- elementToOnChange.delete(element);
54
- observer.unobserve(element);
69
+ const callbacks_0 = callbacksByElement.get(element);
70
+ if (!callbacks_0) {
71
+ return;
72
+ }
73
+ const index = callbacks_0.indexOf(onChange);
74
+ if (index !== -1) {
75
+ callbacks_0.splice(index, 1);
76
+ }
77
+ if (!callbacks_0.length) {
78
+ callbacksByElement.delete(element);
79
+ observer.unobserve(element);
80
+ }
55
81
  };
56
82
  }
57
83
  });
58
84
  return () => {
59
85
  observer.disconnect();
60
- setHandle(null);
86
+ setHandle(noopIntersectionObserverHandle);
61
87
  };
62
88
  };
63
89
  t1 = [rootRef, rootMargin, scrollMargin];
@@ -73,13 +99,16 @@ function useIntersectionObserverHandle(rootRef, rootMargin, scrollMargin) {
73
99
  useEffect(t0, t1);
74
100
  return handle;
75
101
  }
102
+ /**
103
+ * Returns whether the referenced element is currently intersecting.
104
+ */
76
105
  function useIsIntersecting(elementRef) {
77
106
  const $ = c(5);
78
- if ($[0] !== "dfabcb1b8108e1a7f2a2e74a1ab9f1d1069e1f7ab04eda46b950789426c929c9") {
107
+ if ($[0] !== "22e72f21c77e0579b51b95d0c9cf49c7e0027190e5186ad64aa7f2054bb7eb35") {
79
108
  for (let $i = 0; $i < 5; $i += 1) {
80
109
  $[$i] = Symbol.for("react.memo_cache_sentinel");
81
110
  }
82
- $[0] = "dfabcb1b8108e1a7f2a2e74a1ab9f1d1069e1f7ab04eda46b950789426c929c9";
111
+ $[0] = "22e72f21c77e0579b51b95d0c9cf49c7e0027190e5186ad64aa7f2054bb7eb35";
83
112
  }
84
113
  const handle = use(IntersectionObserverContext);
85
114
  const [isIntersecting, setIsIntersecting] = useState(false);
@@ -88,12 +117,12 @@ function useIsIntersecting(elementRef) {
88
117
  if ($[1] !== elementRef || $[2] !== handle) {
89
118
  t0 = () => {
90
119
  const element = elementRef.current;
91
- if (!element || !handle) {
120
+ if (!element) {
92
121
  return;
93
122
  }
94
123
  return handle.observe(element, setIsIntersecting);
95
124
  };
96
- t1 = [handle, elementRef, setIsIntersecting];
125
+ t1 = [handle, elementRef];
97
126
  $[1] = elementRef;
98
127
  $[2] = handle;
99
128
  $[3] = t0;
@@ -105,36 +134,5 @@ function useIsIntersecting(elementRef) {
105
134
  useEffect(t0, t1);
106
135
  return isIntersecting;
107
136
  }
108
- function useIsIntersectingListener(elementRef, onChange) {
109
- const $ = c(6);
110
- if ($[0] !== "dfabcb1b8108e1a7f2a2e74a1ab9f1d1069e1f7ab04eda46b950789426c929c9") {
111
- for (let $i = 0; $i < 6; $i += 1) {
112
- $[$i] = Symbol.for("react.memo_cache_sentinel");
113
- }
114
- $[0] = "dfabcb1b8108e1a7f2a2e74a1ab9f1d1069e1f7ab04eda46b950789426c929c9";
115
- }
116
- const handle = use(IntersectionObserverContext);
117
- let t0;
118
- let t1;
119
- if ($[1] !== elementRef || $[2] !== handle || $[3] !== onChange) {
120
- t0 = () => {
121
- const element = elementRef.current;
122
- if (!element || !handle) {
123
- return;
124
- }
125
- return handle.observe(element, onChange);
126
- };
127
- t1 = [handle, elementRef, onChange];
128
- $[1] = elementRef;
129
- $[2] = handle;
130
- $[3] = onChange;
131
- $[4] = t0;
132
- $[5] = t1;
133
- } else {
134
- t0 = $[4];
135
- t1 = $[5];
136
- }
137
- useEffect(t0, t1);
138
- }
139
137
 
140
- export { IntersectionObserverContext, useIntersectionObserverHandle, useIsIntersecting, useIsIntersectingListener };
138
+ export { IntersectionObserverContext, useIntersectionObserverHandle, useIsIntersecting };
@@ -0,0 +1,6 @@
1
+ /**
2
+ * If this function returns `false`, the event may be interpreted as a click
3
+ * or tap on a "empty space" rather than on an interactive element such as
4
+ * a button or a link.
5
+ */
6
+ export declare function isWithinInteractiveElement(target: EventTarget | null): boolean;
@@ -0,0 +1,11 @@
1
+ const interactiveSelector = ['a', 'button', 'details', 'input', 'label', 'option', 'select', 'summary', 'textarea', '[contenteditable]', '[role="button"]', '[role="checkbox"]', '[role="link"]', '[role="radio"]', '[role="switch"]', '[role="tab"]'].join();
2
+ /**
3
+ * If this function returns `false`, the event may be interpreted as a click
4
+ * or tap on a "empty space" rather than on an interactive element such as
5
+ * a button or a link.
6
+ */
7
+ function isWithinInteractiveElement(target) {
8
+ return target instanceof Element && target.closest(interactiveSelector) != null;
9
+ }
10
+
11
+ export { isWithinInteractiveElement };
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Returns whether the event target is within an element that is expected to
3
+ * handle keyboard navigation itself, so container-level keyboard shortcuts
4
+ * should generally be ignored.
5
+ */
6
+ export declare function isWithinNavigableElement(target: EventTarget | null): boolean;
@@ -0,0 +1,11 @@
1
+ const navigableSelector = ['input:not([type="button"]):not([type="checkbox"]):not([type="color"]):not([type="file"]):not([type="hidden"]):not([type="image"]):not([type="reset"]):not([type="submit"])', 'textarea', 'select', '[contenteditable]', '[role="combobox"]', '[role="grid"]', '[role="listbox"]', '[role="menu"]', '[role="menubar"]', '[role="radiogroup"]', '[role="searchbox"]', '[role="slider"]', '[role="spinbutton"]', '[role="tablist"]', '[role="textbox"]', '[role="tree"]', '[role="treegrid"]'].join();
2
+ /**
3
+ * Returns whether the event target is within an element that is expected to
4
+ * handle keyboard navigation itself, so container-level keyboard shortcuts
5
+ * should generally be ignored.
6
+ */
7
+ function isWithinNavigableElement(target) {
8
+ return target instanceof Element && target.closest(navigableSelector) != null;
9
+ }
10
+
11
+ export { isWithinNavigableElement };
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Parses a CSS duration string (e.g., "500ms", "2s") and returns the duration in milliseconds.
3
+ * Returns the `defaultVal` if the input string is not a valid CSS duration.
4
+ */
5
+ export declare function parseCssDuration(duration: string, defaultVal?: number): number;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Parses a CSS duration string (e.g., "500ms", "2s") and returns the duration in milliseconds.
3
+ * Returns the `defaultVal` if the input string is not a valid CSS duration.
4
+ */
5
+ function parseCssDuration(duration, defaultVal = 0) {
6
+ const match = duration.match(/(\d+(\.\d+)?)(s|ms)/);
7
+ if (!match) return defaultVal;
8
+ const value = parseFloat(match[1]);
9
+ const unit = match[3];
10
+ // eslint-disable-next-line no-magic-numbers
11
+ return unit === 's' ? value * 1000 : value;
12
+ }
13
+
14
+ export { parseCssDuration };
@@ -1,6 +1,7 @@
1
1
  import { Component } from 'react';
2
2
  import { createComposedRef } from './compose-refs.js';
3
3
  import { jsx } from 'react/jsx-runtime';
4
+ import 'react/compiler-runtime';
4
5
  import 'memoize-one';
5
6
 
6
7
  function rerenderHOC(ComposedComponent) {
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Schedules a timeout and returns a function that cancels it.
3
+ *
4
+ * Useful from React effects.
5
+ */
6
+ export declare function setTimeoutWithCleanup(callback: () => void, delay?: number): () => void;
7
+ /**
8
+ * Schedules an animation frame and returns a function that cancels it.
9
+ *
10
+ * Useful from React effects.
11
+ */
12
+ export declare function requestAnimationFrameWithCleanup(callback: () => void): () => void;
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Schedules a timeout and returns a function that cancels it.
3
+ *
4
+ * Useful from React effects.
5
+ */
6
+ function setTimeoutWithCleanup(callback, delay = 0) {
7
+ let timerId = window.setTimeout(() => {
8
+ callback();
9
+ timerId = null;
10
+ }, delay);
11
+ return () => {
12
+ if (timerId != null) {
13
+ window.clearTimeout(timerId);
14
+ timerId = null;
15
+ }
16
+ };
17
+ }
18
+ /**
19
+ * Schedules an animation frame and returns a function that cancels it.
20
+ *
21
+ * Useful from React effects.
22
+ */
23
+ function requestAnimationFrameWithCleanup(callback) {
24
+ let rafId = requestAnimationFrame(() => {
25
+ callback();
26
+ rafId = null;
27
+ });
28
+ return () => {
29
+ if (rafId != null) {
30
+ cancelAnimationFrame(rafId);
31
+ rafId = null;
32
+ }
33
+ };
34
+ }
35
+
36
+ export { requestAnimationFrameWithCleanup, setTimeoutWithCleanup };
@@ -19,7 +19,7 @@ class TableSelection {
19
19
  return item.id;
20
20
  }
21
21
  // If there's no id provided on item and no getKey supplied, fail fast with a clear message
22
- throw new Error('Selection: getKey is required when items have no "id" property');
22
+ throw new Error('TableSelection: getKey is required when items have no "id" property');
23
23
  },
24
24
  getChildren = () => [],
25
25
  isItemSelectable = () => true
@@ -1,5 +1,5 @@
1
1
  import 'react/compiler-runtime';
2
2
  import 'react';
3
3
  import 'classnames';
4
- export { G as GLOBAL_DARK_CLASS_NAME, a as ThemeContext, b as ThemeProvider, W as WithThemeClasses, c as applyTheme, T as default, u as useTheme, e as useThemeClasses } from '../_helpers/theme.js';
4
+ export { G as GLOBAL_DARK_CLASS_NAME, b as ThemeContext, a as ThemeProvider, W as WithThemeClasses, c as applyTheme, T as default, u as useTheme, e as useThemeClasses } from '../_helpers/theme.js';
5
5
  import 'react/jsx-runtime';
@@ -1,6 +1,6 @@
1
1
  import { Component } from 'react';
2
2
  import classNames from 'classnames';
3
- import { T as Theme, b as ThemeProvider } from '../_helpers/theme.js';
3
+ import { T as Theme, a as ThemeProvider } from '../_helpers/theme.js';
4
4
  import { s as styles } from '../_helpers/header.js';
5
5
  import { jsx } from 'react/jsx-runtime';
6
6
  export { default as Logo } from './logo.js';
@@ -79,10 +79,16 @@ import '../alert-service/alert-service.js';
79
79
  import 'react-dom/client';
80
80
  import '../alert/alert.js';
81
81
  import '@jetbrains/icons/exception';
82
- import '@jetbrains/icons/checkmark';
82
+ import '@jetbrains/icons/success';
83
83
  import '@jetbrains/icons/warning';
84
+ import '@jetbrains/icons/info-filled';
84
85
  import '@jetbrains/icons/close';
85
86
  import '../loader-inline/loader-inline.js';
87
+ import '../alert/alert-heading.js';
88
+ import '../heading/heading.js';
89
+ import '../_helpers/heading.js';
90
+ import '../_helpers/alert.js';
91
+ import '../alert/alert-actions.js';
86
92
  import '../alert/container.js';
87
93
  import '../auth/auth.js';
88
94
  import '../auth/window-flow.js';
@@ -9,8 +9,9 @@ import '../global/get-uid.js';
9
9
  import '../alert/alert.js';
10
10
  import 'classnames';
11
11
  import '@jetbrains/icons/exception';
12
- import '@jetbrains/icons/checkmark';
12
+ import '@jetbrains/icons/success';
13
13
  import '@jetbrains/icons/warning';
14
+ import '@jetbrains/icons/info-filled';
14
15
  import '@jetbrains/icons/close';
15
16
  import '../icon/icon.js';
16
17
  import 'util-deprecate';
@@ -29,6 +30,11 @@ import '../global/controls-height.js';
29
30
  import '../global/configuration.js';
30
31
  import '../_helpers/button.classes.js';
31
32
  import '../_helpers/theme.js';
33
+ import '../alert/alert-heading.js';
34
+ import '../heading/heading.js';
35
+ import '../_helpers/heading.js';
36
+ import '../_helpers/alert.js';
37
+ import '../alert/alert-actions.js';
32
38
  import '../alert/container.js';
33
39
  import 'react-dom';
34
40
  import '../avatar/avatar.js';
@@ -2,7 +2,7 @@ import { c } from 'react/compiler-runtime';
2
2
  import { memo, useEffect } from 'react';
3
3
  import classNames from 'classnames';
4
4
  import deprecate from 'util-deprecate';
5
- import { s as styles } from '../_helpers/heading.js';
5
+ import { h as headingStyles } from '../_helpers/heading.js';
6
6
  import { jsx } from 'react/jsx-runtime';
7
7
 
8
8
  var Levels;
@@ -46,7 +46,7 @@ const HeadingMemo = /*#__PURE__*/memo(function Heading(t0) {
46
46
  const level = t1 === undefined ? Levels.H1 : t1;
47
47
  let t2;
48
48
  if ($[6] !== className) {
49
- t2 = classNames(styles.heading, className);
49
+ t2 = classNames(headingStyles.heading, className);
50
50
  $[6] = className;
51
51
  $[7] = t2;
52
52
  } else {
@@ -183,7 +183,7 @@ const H4 = /*#__PURE__*/memo(function H4(t0) {
183
183
  let t1;
184
184
  if ($[5] !== bold || $[6] !== className) {
185
185
  t1 = classNames(className, {
186
- [styles.bold]: bold
186
+ [headingStyles.bold]: bold
187
187
  });
188
188
  $[5] = bold;
189
189
  $[6] = className;
@@ -20,7 +20,7 @@ export interface RequestParams<RawBody extends boolean = true | false> extends F
20
20
  export type RequestParamsWithoutMethod<RawBody extends boolean = boolean> = Omit<RequestParams<RawBody>, 'method'>;
21
21
  export interface HTTPAuth {
22
22
  requestToken(): Promise<string | null> | string | null;
23
- forceTokenUpdate(): Promise<string | null>;
23
+ forceTokenUpdate(failedToken?: string | null): Promise<string | null>;
24
24
  }
25
25
  export default class HTTP implements Partial<HTTPAuth> {
26
26
  baseUrl: string | null | undefined;
@@ -28,7 +28,7 @@ export default class HTTP implements Partial<HTTPAuth> {
28
28
  fetchConfig: RequestInit;
29
29
  requestToken?: () => Promise<string | null> | string | null;
30
30
  shouldRefreshToken?: (error: string) => boolean;
31
- forceTokenUpdate?: () => Promise<string | null>;
31
+ forceTokenUpdate?: (failedToken?: string | null) => Promise<string | null>;
32
32
  constructor(auth?: HTTPAuth, baseUrl?: string | null | undefined, fetchConfig?: RequestInit);
33
33
  setAuth: (auth: HTTPAuth) => void;
34
34
  setBaseUrl: (baseUrl: string | null | undefined) => void;
@@ -54,7 +54,7 @@ class HTTP {
54
54
  setAuth = auth => {
55
55
  this.requestToken = () => auth.requestToken();
56
56
  this.shouldRefreshToken = auth.constructor.shouldRefreshToken;
57
- this.forceTokenUpdate = () => auth.forceTokenUpdate();
57
+ this.forceTokenUpdate = failedToken => auth.forceTokenUpdate(failedToken);
58
58
  };
59
59
  setBaseUrl = baseUrl => {
60
60
  this.baseUrl = baseUrl;
@@ -170,7 +170,7 @@ class HTTP {
170
170
  }
171
171
  const shouldRefreshToken = typeof error.data.error === 'string' ? this.shouldRefreshToken?.(error.data.error) : false;
172
172
  if (shouldRefreshToken) {
173
- token = await this.forceTokenUpdate?.();
173
+ token = await this.forceTokenUpdate?.(token);
174
174
  response = await this._performRequest(url, token, params);
175
175
  return this._processResponse(response);
176
176
  }
@@ -23,6 +23,7 @@ export declare function getTranslations(): Partial<{
23
23
  addSecondDate: string;
24
24
  addTime: string;
25
25
  selectName: string;
26
+ selectDate: string;
26
27
  setDate: string;
27
28
  setDateTime: string;
28
29
  setPeriod: string;
@@ -18,6 +18,7 @@ var addFirstDate = "Add first date";
18
18
  var addSecondDate = "Add second date";
19
19
  var addTime = "Add time";
20
20
  var selectName = "Select {{name}}";
21
+ var selectDate = "Select a date";
21
22
  var setDate = "Set a date";
22
23
  var setDateTime = "Set date and time";
23
24
  var setPeriod = "Set a period";
@@ -70,6 +71,7 @@ var defaultMessages = {
70
71
  addSecondDate: addSecondDate,
71
72
  addTime: addTime,
72
73
  selectName: selectName,
74
+ selectDate: selectDate,
73
75
  setDate: setDate,
74
76
  setDateTime: setDateTime,
75
77
  setPeriod: setPeriod,
@@ -69,7 +69,7 @@ export declare class Input extends PureComponent<InputProps> {
69
69
  stretch(el: HTMLElement | null | undefined): void;
70
70
  adapt(): void;
71
71
  inputRef: (el: HTMLInputElement | HTMLTextAreaElement | null) => void;
72
- composedInputRef: import("memoize-one").MemoizedFn<(...refs: (Ref<HTMLInputElement | HTMLTextAreaElement> | undefined)[]) => (value: T | null) => void>;
72
+ composedInputRef: import("memoize-one").MemoizedFn<(...refs: (Ref<HTMLInputElement | HTMLTextAreaElement> | undefined)[]) => (value: T | null) => () => void>;
73
73
  clear: (e: React.MouseEvent<HTMLButtonElement>) => void;
74
74
  handleInputChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
75
75
  handleTextareaChange: (e: React.ChangeEvent<HTMLTextAreaElement>) => void;
@@ -0,0 +1,159 @@
1
+ import { c } from 'react/compiler-runtime';
2
+ import { createContext, useState, useRef, useEffect } from 'react';
3
+ import { parseCssDuration } from '../global/parse-css-duration.js';
4
+ import { requestAnimationFrameWithCleanup, setTimeoutWithCleanup } from '../global/schedule-with-cleanup.js';
5
+ import { s as styles } from '../_helpers/table.js';
6
+
7
+ /** How long to wait for the data to change after {@link expectReorder} is called. */
8
+ const pendingReorderTimeoutMs = 1000;
9
+ const ReorderAnimationContext = /*#__PURE__*/createContext({
10
+ reorderAnimation: null,
11
+ expectReorder: () => {}
12
+ });
13
+ function useReorderAnimationContextValue(t0) {
14
+ const $ = c(20);
15
+ if ($[0] !== "669a1fb3f5ac9a1cdad72a7fc204b97d9b35bce2182bb3bb8f0bd0acb524b958") {
16
+ for (let $i = 0; $i < 20; $i += 1) {
17
+ $[$i] = Symbol.for("react.memo_cache_sentinel");
18
+ }
19
+ $[0] = "669a1fb3f5ac9a1cdad72a7fc204b97d9b35bce2182bb3bb8f0bd0acb524b958";
20
+ }
21
+ const {
22
+ noColumnReorderAnimation,
23
+ noItemReorderAnimation,
24
+ tableRef,
25
+ data,
26
+ columns
27
+ } = t0;
28
+ const [reorderAnimation, setReorderAnimation] = useState(null);
29
+ const pendingReorderRef = useRef(null);
30
+ let t1;
31
+ if ($[1] !== columns || $[2] !== data || $[3] !== noColumnReorderAnimation || $[4] !== noItemReorderAnimation) {
32
+ t1 = function expectReorder(reorderSpec) {
33
+ const isColumn = reorderSpec.direction === "columns";
34
+ if (isColumn && noColumnReorderAnimation || !isColumn && noItemReorderAnimation) {
35
+ return;
36
+ }
37
+ if (pendingReorderRef.current) {
38
+ window.clearTimeout(pendingReorderRef.current.timerId);
39
+ }
40
+ const timerId = window.setTimeout(() => {
41
+ pendingReorderRef.current = null;
42
+ }, pendingReorderTimeoutMs);
43
+ pendingReorderRef.current = {
44
+ ...reorderSpec,
45
+ timerId,
46
+ columns,
47
+ data
48
+ };
49
+ };
50
+ $[1] = columns;
51
+ $[2] = data;
52
+ $[3] = noColumnReorderAnimation;
53
+ $[4] = noItemReorderAnimation;
54
+ $[5] = t1;
55
+ } else {
56
+ t1 = $[5];
57
+ }
58
+ const expectReorder = t1;
59
+ let t2;
60
+ let t3;
61
+ if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
62
+ t2 = () => () => {
63
+ if (pendingReorderRef.current) {
64
+ window.clearTimeout(pendingReorderRef.current.timerId);
65
+ pendingReorderRef.current = null;
66
+ }
67
+ };
68
+ t3 = [];
69
+ $[6] = t2;
70
+ $[7] = t3;
71
+ } else {
72
+ t2 = $[6];
73
+ t3 = $[7];
74
+ }
75
+ useEffect(t2, t3);
76
+ let t4;
77
+ let t5;
78
+ if ($[8] !== columns || $[9] !== data || $[10] !== tableRef) {
79
+ t4 = () => {
80
+ const table = tableRef.current;
81
+ const pendingReorder = pendingReorderRef.current;
82
+ if (!table || !pendingReorder) {
83
+ return;
84
+ }
85
+ const {
86
+ direction,
87
+ data: pendingData,
88
+ columns: pendingColumns
89
+ } = pendingReorder;
90
+ const isColumn_0 = direction === "columns";
91
+ if (isColumn_0 && columns === pendingColumns || !isColumn_0 && data === pendingData) {
92
+ return;
93
+ }
94
+ pendingReorderRef.current = null;
95
+ const {
96
+ fromIndex,
97
+ insertionIndex
98
+ } = pendingReorder;
99
+ const index = fromIndex < insertionIndex ? insertionIndex - 1 : insertionIndex;
100
+ return requestAnimationFrameWithCleanup(() => setReorderAnimation(prev => prev == null ? {
101
+ direction,
102
+ index,
103
+ phase: "initial",
104
+ className: styles.reorderAnimationInitial
105
+ } : prev));
106
+ };
107
+ t5 = [data, columns, tableRef];
108
+ $[8] = columns;
109
+ $[9] = data;
110
+ $[10] = tableRef;
111
+ $[11] = t4;
112
+ $[12] = t5;
113
+ } else {
114
+ t4 = $[11];
115
+ t5 = $[12];
116
+ }
117
+ useEffect(t4, t5);
118
+ let t6;
119
+ let t7;
120
+ if ($[13] !== reorderAnimation || $[14] !== tableRef) {
121
+ t6 = () => {
122
+ if (reorderAnimation?.phase === "initial") {
123
+ return requestAnimationFrameWithCleanup(() => setReorderAnimation(prev_0 => prev_0 === reorderAnimation ? {
124
+ ...prev_0,
125
+ phase: "fade-out",
126
+ className: styles.reorderAnimationFadeOut
127
+ } : prev_0));
128
+ }
129
+ if (reorderAnimation?.phase === "fade-out") {
130
+ const fadeOutMs = parseCssDuration(window.getComputedStyle(tableRef.current).getPropertyValue("--reorder-animation-fade-out-duration"));
131
+ return setTimeoutWithCleanup(() => setReorderAnimation(prev_1 => prev_1 === reorderAnimation ? null : prev_1), fadeOutMs);
132
+ }
133
+ };
134
+ t7 = [reorderAnimation, tableRef];
135
+ $[13] = reorderAnimation;
136
+ $[14] = tableRef;
137
+ $[15] = t6;
138
+ $[16] = t7;
139
+ } else {
140
+ t6 = $[15];
141
+ t7 = $[16];
142
+ }
143
+ useEffect(t6, t7);
144
+ let t8;
145
+ if ($[17] !== expectReorder || $[18] !== reorderAnimation) {
146
+ t8 = {
147
+ reorderAnimation,
148
+ expectReorder
149
+ };
150
+ $[17] = expectReorder;
151
+ $[18] = reorderAnimation;
152
+ $[19] = t8;
153
+ } else {
154
+ t8 = $[19];
155
+ }
156
+ return t8;
157
+ }
158
+
159
+ export { ReorderAnimationContext, useReorderAnimationContextValue };