@jetbrains/ring-ui 7.0.124 → 8.0.0-beta.10

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 (191) hide show
  1. package/babel.config.js +1 -9
  2. package/components/auth-dialog-service/auth-dialog-service.js +2 -2
  3. package/components/avatar/avatar-info.js +0 -2
  4. package/components/avatar/avatar-size.d.ts +0 -4
  5. package/components/avatar/avatar-size.js +0 -4
  6. package/components/avatar/avatar.js +0 -6
  7. package/components/avatar/fallback-avatar.js +0 -28
  8. package/components/avatar-stack/avatar-stack.js +1 -1
  9. package/components/button/button.css +4 -4
  10. package/components/button/button.d.ts +0 -4
  11. package/components/button/button.js +2 -7
  12. package/components/button-group/button-group.css +23 -23
  13. package/components/button-toolbar/button-toolbar.css +2 -2
  14. package/components/checkbox/checkbox.d.ts +1 -1
  15. package/components/collapse/collapse-content.js +7 -16
  16. package/components/collapse/collapse-context.d.ts +1 -0
  17. package/components/collapse/collapse-context.js +1 -0
  18. package/components/collapse/collapse-control.js +2 -2
  19. package/components/collapse/collapse.css +8 -2
  20. package/components/collapse/collapse.js +10 -2
  21. package/components/collapsible-group/collapsible-group.css +1 -1
  22. package/components/collapsible-group/collapsible-group.d.ts +5 -1
  23. package/components/collapsible-group/collapsible-group.js +13 -22
  24. package/components/confirm-service/confirm-service.js +2 -2
  25. package/components/contenteditable/contenteditable.js +1 -2
  26. package/components/data-list/data-list.d.ts +4 -4
  27. package/components/data-list/data-list.js +2 -2
  28. package/components/data-list/data-list.mock.d.ts +1 -1
  29. package/components/data-list/item.d.ts +1 -1
  30. package/components/data-list/selection.d.ts +1 -1
  31. package/components/data-list/selection.js +1 -1
  32. package/components/date-picker/month.d.ts +0 -2
  33. package/components/date-picker/month.js +5 -5
  34. package/components/date-picker/months.js +8 -7
  35. package/components/date-picker/use-scroll-behavior.js +5 -6
  36. package/components/date-picker/years.js +11 -10
  37. package/components/dialog/dialog.d.ts +2 -2
  38. package/components/dialog/dialog.js +2 -2
  39. package/components/dropdown-menu/dropdown-menu.d.ts +4 -4
  40. package/components/dropdown-menu/dropdown-menu.js +4 -4
  41. package/components/editable-heading/editable-heading.d.ts +1 -2
  42. package/components/editable-heading/editable-heading.js +5 -6
  43. package/components/global/compose-refs.d.ts +2 -1
  44. package/components/global/compose-refs.js +24 -8
  45. package/components/global/configuration.d.ts +0 -5
  46. package/components/global/configuration.js +0 -7
  47. package/components/global/create-stateful-context.js +5 -5
  48. package/components/global/focus-with-temporary-tabindex.d.ts +11 -0
  49. package/components/global/focus-with-temporary-tabindex.js +21 -0
  50. package/components/global/intersection-observer-context.d.ts +46 -0
  51. package/components/global/intersection-observer-context.js +91 -0
  52. package/components/global/is-within-interactive-element.d.ts +6 -0
  53. package/components/global/is-within-interactive-element.js +26 -0
  54. package/components/global/is-within-navigable-element.d.ts +6 -0
  55. package/components/global/is-within-navigable-element.js +27 -0
  56. package/components/global/parse-css-duration.d.ts +5 -0
  57. package/components/global/parse-css-duration.js +13 -0
  58. package/components/global/rerender-hoc.d.ts +4 -2
  59. package/components/global/rerender-hoc.js +4 -4
  60. package/components/global/schedule-with-cleanup.d.ts +12 -0
  61. package/components/global/schedule-with-cleanup.js +34 -0
  62. package/components/{table/selection.d.ts → global/table-selection.d.ts} +15 -15
  63. package/components/{table/selection.js → global/table-selection.js} +3 -3
  64. package/components/global/theme.d.ts +4 -3
  65. package/components/global/theme.js +8 -8
  66. package/components/global/variables.css +0 -10
  67. package/components/global/variables.interface.d.ts +0 -4
  68. package/components/global/variables_dark.css +0 -7
  69. package/components/i18n/i18n-context.js +1 -1
  70. package/components/icon/icon-svg.js +2 -3
  71. package/components/icon/icon.css +0 -27
  72. package/components/icon/icon.d.ts +0 -1
  73. package/components/icon/icon.js +2 -4
  74. package/components/input/input.d.ts +1 -1
  75. package/components/island/adaptive-island-hoc.js +4 -4
  76. package/components/island/content.d.ts +7 -2
  77. package/components/island/content.js +5 -5
  78. package/components/{table → legacy-table}/cell.js +1 -1
  79. package/components/{table → legacy-table}/header-cell.js +1 -1
  80. package/components/{table → legacy-table}/header.js +1 -1
  81. package/components/legacy-table/legacy-table.css +260 -0
  82. package/components/{table → legacy-table}/multitable.d.ts +1 -1
  83. package/components/{table → legacy-table}/row.d.ts +1 -1
  84. package/components/{table → legacy-table}/row.js +1 -1
  85. package/components/legacy-table/selection-adapter.d.ts +6 -0
  86. package/components/{table → legacy-table}/selection-shortcuts-hoc.d.ts +5 -5
  87. package/components/{table → legacy-table}/simple-table.d.ts +2 -2
  88. package/components/{table → legacy-table}/simple-table.js +3 -3
  89. package/components/{table → legacy-table}/smart-table.d.ts +5 -5
  90. package/components/{table → legacy-table}/smart-table.js +3 -3
  91. package/components/legacy-table/table.d.ts +109 -0
  92. package/components/legacy-table/table.js +191 -0
  93. package/components/list/consts.d.ts +0 -1
  94. package/components/list/consts.js +0 -1
  95. package/components/list/list.d.ts +0 -4
  96. package/components/login-dialog/service.js +2 -2
  97. package/components/popup/popup.target.d.ts +3 -2
  98. package/components/popup/popup.target.js +4 -6
  99. package/components/query-assist/query-assist.d.ts +3 -1
  100. package/components/query-assist/query-assist.js +2 -2
  101. package/components/radio/radio-item.d.ts +3 -3
  102. package/components/radio/radio-item.js +3 -4
  103. package/components/radio/radio.d.ts +2 -2
  104. package/components/radio/radio.js +1 -1
  105. package/components/select/select-popup.d.ts +3 -2
  106. package/components/select/select-popup.js +3 -3
  107. package/components/select/select.d.ts +6 -2
  108. package/components/select/select.js +2 -4
  109. package/components/selection-toolbar/selection-toolbar.css +86 -0
  110. package/components/selection-toolbar/selection-toolbar.d.ts +11 -0
  111. package/components/selection-toolbar/selection-toolbar.js +23 -0
  112. package/components/slider/slider.js +4 -5
  113. package/components/tab-trap/tab-trap.d.ts +3 -3
  114. package/components/tab-trap/tab-trap.js +3 -5
  115. package/components/table/default-item-renderer.d.ts +55 -0
  116. package/components/table/default-item-renderer.js +77 -0
  117. package/components/table/internal/reorder-animation-context.d.ts +21 -0
  118. package/components/table/internal/reorder-animation-context.js +60 -0
  119. package/components/table/internal/reorder-handle.d.ts +9 -0
  120. package/components/table/internal/reorder-handle.js +334 -0
  121. package/components/table/internal/reorder-layout-context.d.ts +16 -0
  122. package/components/table/internal/reorder-layout-context.js +69 -0
  123. package/components/table/internal/table-header.d.ts +1 -0
  124. package/components/table/internal/table-header.js +143 -0
  125. package/components/table/internal/virtualization.d.ts +41 -0
  126. package/components/table/internal/virtualization.js +186 -0
  127. package/components/table/item-virtualization.d.ts +37 -0
  128. package/components/table/item-virtualization.js +26 -0
  129. package/components/table/reorder-animation.d.ts +37 -0
  130. package/components/table/reorder-animation.js +11 -0
  131. package/components/table/reorder-item-layout.d.ts +32 -0
  132. package/components/table/reorder-item-layout.js +23 -0
  133. package/components/table/table-const.d.ts +10 -0
  134. package/components/table/table-const.js +10 -0
  135. package/components/table/table-primitives.d.ts +64 -0
  136. package/components/table/table-primitives.js +34 -0
  137. package/components/table/table-props.d.ts +304 -0
  138. package/components/table/table-props.js +1 -0
  139. package/components/table/table.css +156 -167
  140. package/components/table/table.d.ts +231 -107
  141. package/components/table/table.js +319 -183
  142. package/components/tags-input/tags-input.d.ts +3 -1
  143. package/components/tooltip/tooltip.d.ts +2 -1
  144. package/components/tooltip/tooltip.js +6 -5
  145. package/components/upload/upload.d.ts +4 -3
  146. package/components/upload/upload.js +3 -7
  147. package/components/user-agreement/service.js +2 -2
  148. package/components/util-stories.d.ts +26 -0
  149. package/components/util-stories.js +61 -0
  150. package/package.json +45 -48
  151. package/components/content-layout/content-layout.css +0 -109
  152. package/components/content-layout/content-layout.d.ts +0 -20
  153. package/components/content-layout/content-layout.js +0 -40
  154. package/components/content-layout/sidebar.d.ts +0 -26
  155. package/components/content-layout/sidebar.js +0 -71
  156. package/components/date-picker/use-intersection-observer.d.ts +0 -6
  157. package/components/date-picker/use-intersection-observer.js +0 -48
  158. package/components/expand/collapsible-group.css +0 -76
  159. package/components/expand/collapsible-group.d.ts +0 -8
  160. package/components/expand/collapsible-group.js +0 -14
  161. package/components/global/composeRefs.d.ts +0 -6
  162. package/components/global/composeRefs.js +0 -7
  163. package/components/global/use-event-callback.d.ts +0 -4
  164. package/components/global/use-event-callback.js +0 -20
  165. package/components/grid/col.d.ts +0 -16
  166. package/components/grid/col.js +0 -35
  167. package/components/grid/grid.css +0 -920
  168. package/components/grid/grid.d.ts +0 -13
  169. package/components/grid/grid.js +0 -19
  170. package/components/grid/row.d.ts +0 -21
  171. package/components/grid/row.js +0 -41
  172. package/components/old-browsers-message/__mocks__/old-browsers-message.js +0 -1
  173. package/components/old-browsers-message/old-browsers-message-stop.d.ts +0 -1
  174. package/components/old-browsers-message/old-browsers-message-stop.js +0 -2
  175. package/components/old-browsers-message/old-browsers-message.css +0 -26
  176. package/components/old-browsers-message/old-browsers-message.d.ts +0 -5
  177. package/components/old-browsers-message/old-browsers-message.js +0 -86
  178. package/components/old-browsers-message/white-list.d.ts +0 -2
  179. package/components/old-browsers-message/white-list.js +0 -24
  180. package/components/table/selection-adapter.d.ts +0 -6
  181. /package/components/{table → legacy-table}/cell.d.ts +0 -0
  182. /package/components/{table → legacy-table}/disable-hover-hoc.d.ts +0 -0
  183. /package/components/{table → legacy-table}/disable-hover-hoc.js +0 -0
  184. /package/components/{table → legacy-table}/header-cell.d.ts +0 -0
  185. /package/components/{table → legacy-table}/header.d.ts +0 -0
  186. /package/components/{table → legacy-table}/multitable.js +0 -0
  187. /package/components/{table → legacy-table}/row-with-focus-sensor.d.ts +0 -0
  188. /package/components/{table → legacy-table}/row-with-focus-sensor.js +0 -0
  189. /package/components/{table → legacy-table}/selection-adapter.js +0 -0
  190. /package/components/{table → legacy-table}/selection-shortcuts-hoc.js +0 -0
  191. /package/components/{table → legacy-table}/table.examples2.json +0 -0
@@ -0,0 +1,46 @@
1
+ import { type RefObject } from 'react';
2
+ /**
3
+ * Provides access to a shared `IntersectionObserver` instance
4
+ * via the {@link IntersectionObserverContext} context.
5
+ *
6
+ * @see IntersectionObserverContext
7
+ */
8
+ export interface IntersectionObserverHandle {
9
+ /**
10
+ * Starts observing an element.
11
+ *
12
+ * Returns a cleanup function that stops observing it.
13
+ */
14
+ observe(element: Element, isIntersecting: (isIntersecting: boolean) => void): () => void;
15
+ }
16
+ /**
17
+ * Multiple components can share a single `IntersectionObserver` instance through this context.
18
+ *
19
+ * Usage:
20
+ *
21
+ * ```tsx
22
+ * <IntersectionObserverContext value={useIntersectionObserverHandle()}>
23
+ * <YourComponent />
24
+ * </IntersectionObserverContext>
25
+ *
26
+ * function YourComponent() {
27
+ * // Contains the current isIntersecting value
28
+ * const isIntersecting = useIsIntersecting(elementRef);
29
+ *
30
+ * // Or, to manually work with the IntersectionObserverHandle:
31
+ * const handle = use(IntersectionObserverContext);
32
+ * useEffect(() => {
33
+ * return handle.observe(elementRef.current, isIntersecting => { ... })
34
+ * })
35
+ * }
36
+ * ```
37
+ */
38
+ export declare const IntersectionObserverContext: import("react").Context<IntersectionObserverHandle>;
39
+ /**
40
+ * Creates an IntersectionObserverHandle suitable for {@link IntersectionObserverContext}.
41
+ */
42
+ export declare function useIntersectionObserverHandle(rootRef?: RefObject<HTMLElement | null>, rootMargin?: number, scrollMargin?: number): IntersectionObserverHandle;
43
+ /**
44
+ * Returns whether the referenced element is currently intersecting.
45
+ */
46
+ export declare function useIsIntersecting(elementRef: RefObject<Element | null>): boolean;
@@ -0,0 +1,91 @@
1
+ import { createContext, use, useEffect, useState } from 'react';
2
+ /**
3
+ * @internal
4
+ */
5
+ const noopIntersectionObserverHandle = {
6
+ observe: () => () => { },
7
+ };
8
+ /**
9
+ * Multiple components can share a single `IntersectionObserver` instance through this context.
10
+ *
11
+ * Usage:
12
+ *
13
+ * ```tsx
14
+ * <IntersectionObserverContext value={useIntersectionObserverHandle()}>
15
+ * <YourComponent />
16
+ * </IntersectionObserverContext>
17
+ *
18
+ * function YourComponent() {
19
+ * // Contains the current isIntersecting value
20
+ * const isIntersecting = useIsIntersecting(elementRef);
21
+ *
22
+ * // Or, to manually work with the IntersectionObserverHandle:
23
+ * const handle = use(IntersectionObserverContext);
24
+ * useEffect(() => {
25
+ * return handle.observe(elementRef.current, isIntersecting => { ... })
26
+ * })
27
+ * }
28
+ * ```
29
+ */
30
+ export const IntersectionObserverContext = createContext(noopIntersectionObserverHandle);
31
+ /**
32
+ * Creates an IntersectionObserverHandle suitable for {@link IntersectionObserverContext}.
33
+ */
34
+ export function useIntersectionObserverHandle(rootRef, rootMargin, scrollMargin) {
35
+ const [handle, setHandle] = useState(noopIntersectionObserverHandle);
36
+ useEffect(() => {
37
+ const root = rootRef?.current;
38
+ const callbacksByElement = new Map();
39
+ const observer = new IntersectionObserver(entries => {
40
+ for (const entry of entries) {
41
+ const callbacks = callbacksByElement.get(entry.target);
42
+ callbacks?.forEach(cb => cb(entry.isIntersecting));
43
+ }
44
+ }, {
45
+ root,
46
+ rootMargin: rootMargin != null ? `${rootMargin}px` : undefined,
47
+ scrollMargin: scrollMargin != null ? `${scrollMargin}px` : undefined,
48
+ });
49
+ setHandle({
50
+ observe(element, onChange) {
51
+ if (!callbacksByElement.has(element)) {
52
+ callbacksByElement.set(element, []);
53
+ observer.observe(element);
54
+ }
55
+ callbacksByElement.get(element).push(onChange);
56
+ return () => {
57
+ const callbacks = callbacksByElement.get(element);
58
+ if (!callbacks)
59
+ return;
60
+ const index = callbacks.indexOf(onChange);
61
+ if (index !== -1) {
62
+ callbacks.splice(index, 1);
63
+ }
64
+ if (!callbacks.length) {
65
+ callbacksByElement.delete(element);
66
+ observer.unobserve(element);
67
+ }
68
+ };
69
+ },
70
+ });
71
+ return () => {
72
+ observer.disconnect();
73
+ setHandle(noopIntersectionObserverHandle);
74
+ };
75
+ }, [rootRef, rootMargin, scrollMargin]);
76
+ return handle;
77
+ }
78
+ /**
79
+ * Returns whether the referenced element is currently intersecting.
80
+ */
81
+ export function useIsIntersecting(elementRef) {
82
+ const handle = use(IntersectionObserverContext);
83
+ const [isIntersecting, setIsIntersecting] = useState(false);
84
+ useEffect(() => {
85
+ const element = elementRef.current;
86
+ if (!element)
87
+ return;
88
+ return handle.observe(element, setIsIntersecting);
89
+ }, [handle, elementRef]);
90
+ return isIntersecting;
91
+ }
@@ -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,26 @@
1
+ const interactiveSelector = [
2
+ 'a',
3
+ 'button',
4
+ 'details',
5
+ 'input',
6
+ 'label',
7
+ 'option',
8
+ 'select',
9
+ 'summary',
10
+ 'textarea',
11
+ '[contenteditable]',
12
+ '[role="button"]',
13
+ '[role="checkbox"]',
14
+ '[role="link"]',
15
+ '[role="radio"]',
16
+ '[role="switch"]',
17
+ '[role="tab"]',
18
+ ].join();
19
+ /**
20
+ * If this function returns `false`, the event may be interpreted as a click
21
+ * or tap on a "empty space" rather than on an interactive element such as
22
+ * a button or a link.
23
+ */
24
+ export function isWithinInteractiveElement(target) {
25
+ return target instanceof Element && target.closest(interactiveSelector) != null;
26
+ }
@@ -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,27 @@
1
+ const navigableSelector = [
2
+ '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"])',
3
+ 'textarea',
4
+ 'select',
5
+ '[contenteditable]',
6
+ '[role="combobox"]',
7
+ '[role="grid"]',
8
+ '[role="listbox"]',
9
+ '[role="menu"]',
10
+ '[role="menubar"]',
11
+ '[role="radiogroup"]',
12
+ '[role="searchbox"]',
13
+ '[role="slider"]',
14
+ '[role="spinbutton"]',
15
+ '[role="tablist"]',
16
+ '[role="textbox"]',
17
+ '[role="tree"]',
18
+ '[role="treegrid"]',
19
+ ].join();
20
+ /**
21
+ * Returns whether the event target is within an element that is expected to
22
+ * handle keyboard navigation itself, so container-level keyboard shortcuts
23
+ * should generally be ignored.
24
+ */
25
+ export function isWithinNavigableElement(target) {
26
+ return target instanceof Element && target.closest(navigableSelector) != null;
27
+ }
@@ -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,13 @@
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 function parseCssDuration(duration, defaultVal = 0) {
6
+ const match = duration.match(/(\d+(\.\d+)?)(s|ms)/);
7
+ if (!match)
8
+ return defaultVal;
9
+ const value = parseFloat(match[1]);
10
+ const unit = match[3];
11
+ // eslint-disable-next-line no-magic-numbers
12
+ return unit === 's' ? value * 1000 : value;
13
+ }
@@ -1,4 +1,4 @@
1
- import { Component, type PropsWithoutRef } from 'react';
1
+ import { Component, type Ref, type PropsWithoutRef } from 'react';
2
2
  export interface RerenderableComponent<P, S> extends Component<P, S> {
3
3
  node?: HTMLElement | null;
4
4
  }
@@ -7,4 +7,6 @@ export interface RerenderableComponentClass<P, S> {
7
7
  }
8
8
  export default function rerenderHOC<P extends {}, C extends Component<P, unknown>>(ComposedComponent: {
9
9
  new (props: P): C;
10
- }): import("react").ForwardRefExoticComponent<PropsWithoutRef<P> & import("react").RefAttributes<C>>;
10
+ }): ({ ref, ...props }: PropsWithoutRef<P> & {
11
+ ref?: Ref<C>;
12
+ }) => import("react").JSX.Element;
@@ -1,4 +1,4 @@
1
- import { Component, forwardRef } from 'react';
1
+ import { Component } from 'react';
2
2
  import { createComposedRef } from './compose-refs';
3
3
  export default function rerenderHOC(ComposedComponent) {
4
4
  class Rerenderer extends Component {
@@ -9,7 +9,7 @@ export default function rerenderHOC(ComposedComponent) {
9
9
  return (<ComposedComponent {...this.state} ref={instance => ref(instance ? { ...instance, rerender: this.setState.bind(this) } : null)}/>);
10
10
  }
11
11
  }
12
- return forwardRef(function RerendererForwardRef(props, ref) {
13
- return <Rerenderer props={props} forwardedRef={ref}/>;
14
- });
12
+ return function RerendererForwardRef({ ref, ...props }) {
13
+ return <Rerenderer props={props} forwardedRef={ref ?? null}/>;
14
+ };
15
15
  }
@@ -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,34 @@
1
+ /**
2
+ * Schedules a timeout and returns a function that cancels it.
3
+ *
4
+ * Useful from React effects.
5
+ */
6
+ export 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
+ export 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
+ }
@@ -4,7 +4,7 @@
4
4
  export interface SelectionItem {
5
5
  id: string | number;
6
6
  }
7
- export interface TableSelectionConfig<T extends object> {
7
+ export interface TableSelectionConfig<T> {
8
8
  data?: readonly T[] | undefined;
9
9
  selected?: Set<T> | undefined;
10
10
  focused?: T | null | undefined;
@@ -17,7 +17,7 @@ export interface CloneWithConfig<T> {
17
17
  selected?: Set<T> | readonly T[] | null | undefined;
18
18
  focused?: T | null | undefined;
19
19
  }
20
- export default class Selection<T extends object> {
20
+ export default class TableSelection<T> {
21
21
  protected _rawData: readonly T[];
22
22
  protected _getChildren: (item: T) => readonly T[];
23
23
  protected _data: Set<T>;
@@ -28,19 +28,19 @@ export default class Selection<T extends object> {
28
28
  constructor({ data, selected, focused, getKey, getChildren, isItemSelectable, }?: TableSelectionConfig<T>);
29
29
  protected _buildData(data: readonly T[] | null | undefined): Set<T>;
30
30
  protected _buildSelected(data: Set<T>, selected: Set<T>): Set<T>;
31
- cloneWith({ data, selected, focused }: CloneWithConfig<T>): Selection<T>;
32
- focus(value: T | null | undefined): Selection<T>;
33
- moveUp(): Selection<T> | undefined;
34
- moveDown(): Selection<T> | undefined;
35
- moveStart(): Selection<T> | undefined;
36
- moveEnd(): Selection<T> | undefined;
37
- select(value?: T | null): Selection<T>;
38
- deselect(value?: T | null): Selection<T>;
39
- toggleSelection(value?: T | null): Selection<T>;
40
- selectAll(): Selection<T>;
41
- resetFocus(): Selection<T>;
42
- resetSelection(): Selection<T>;
43
- reset(): Selection<T>;
31
+ cloneWith({ data, selected, focused }: CloneWithConfig<T>): TableSelection<T>;
32
+ focus(value: T | null | undefined): TableSelection<T>;
33
+ moveUp(): TableSelection<T> | undefined;
34
+ moveDown(): TableSelection<T> | undefined;
35
+ moveStart(): TableSelection<T> | undefined;
36
+ moveEnd(): TableSelection<T> | undefined;
37
+ select(value?: T | null): TableSelection<T>;
38
+ deselect(value?: T | null): TableSelection<T>;
39
+ toggleSelection(value?: T | null): TableSelection<T>;
40
+ selectAll(): TableSelection<T>;
41
+ resetFocus(): TableSelection<T>;
42
+ resetSelection(): TableSelection<T>;
43
+ reset(): TableSelection<T>;
44
44
  isFocused(value: T | null): boolean;
45
45
  isSelected(value: T | null): boolean;
46
46
  getFocused(): T | null;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @deprecated SelectionItem is deprecated. Use your own item type and provide a `getKey` function instead if there is no `id` identifier in your item type.
3
3
  */
4
- export default class Selection {
4
+ export default class TableSelection {
5
5
  _rawData;
6
6
  _getChildren;
7
7
  _data;
@@ -11,11 +11,11 @@ export default class Selection {
11
11
  _isItemSelectable;
12
12
  constructor({ data = [], selected = new Set(), focused = null, getKey = (item) => {
13
13
  // Default behavior stays backward compatible: use item's "id" if present
14
- if ('id' in item) {
14
+ if (item && typeof item === 'object' && 'id' in item) {
15
15
  return item.id;
16
16
  }
17
17
  // If there's no id provided on item and no getKey supplied, fail fast with a clear message
18
- throw new Error('Selection: getKey is required when items have no "id" property');
18
+ throw new Error('TableSelection: getKey is required when items have no "id" property');
19
19
  }, getChildren = () => [], isItemSelectable = () => true, } = {}) {
20
20
  this._rawData = data;
21
21
  this._getChildren = getChildren;
@@ -1,4 +1,4 @@
1
- import { type HTMLAttributes, type ReactElement, type FunctionComponent } from 'react';
1
+ import { type HTMLAttributes, type Ref, type ReactElement, type FunctionComponent } from 'react';
2
2
  declare enum Theme {
3
3
  AUTO = "auto",
4
4
  LIGHT = "light",
@@ -18,11 +18,12 @@ export interface WithThemeClassesProps {
18
18
  export declare function WithThemeClasses({ theme, children }: WithThemeClassesProps): ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
19
19
  export declare function applyTheme(theme: Theme.DARK | Theme.LIGHT, container: HTMLElement): void;
20
20
  type WrapperType = FunctionComponent<HTMLAttributes<HTMLElement> & React.RefAttributes<HTMLElement>>;
21
- export interface ThemeProviderProps extends HTMLAttributes<HTMLDivElement> {
21
+ export interface ThemeProviderProps extends HTMLAttributes<HTMLElement> {
22
+ ref?: Ref<HTMLElement>;
22
23
  theme?: Theme;
23
24
  passToPopups?: boolean;
24
25
  WrapperComponent?: WrapperType;
25
26
  target?: HTMLElement;
26
27
  }
27
- export declare const ThemeProvider: import("react").ForwardRefExoticComponent<ThemeProviderProps & import("react").RefAttributes<HTMLElement>>;
28
+ export declare function ThemeProvider({ ref, ...props }: ThemeProviderProps): import("react").JSX.Element;
28
29
  export default Theme;
@@ -1,4 +1,4 @@
1
- import { useState, useEffect, forwardRef, createContext, } from 'react';
1
+ import { useState, useEffect, createContext, } from 'react';
2
2
  import classNames from 'classnames';
3
3
  import defaultStyles from './variables.css';
4
4
  import styles from './variables_dark.css';
@@ -47,9 +47,9 @@ export function applyTheme(theme, container) {
47
47
  container.classList.add(defaultStyles.light);
48
48
  }
49
49
  }
50
- const DefaultWrapper = forwardRef(function Wrapper(props, ref) {
51
- return <div {...props} ref={ref}/>;
52
- });
50
+ function DefaultWrapper(props) {
51
+ return <div {...props}/>;
52
+ }
53
53
  function ThemeProviderInner({ theme = Theme.AUTO, className, passToPopups, children, WrapperComponent = DefaultWrapper, target, wrapperRef, ...restProps }) {
54
54
  const systemTheme = useTheme();
55
55
  const resolvedTheme = theme === Theme.AUTO ? systemTheme : theme;
@@ -60,13 +60,13 @@ function ThemeProviderInner({ theme = Theme.AUTO, className, passToPopups, child
60
60
  }
61
61
  }, [resolvedTheme, target]);
62
62
  const themeClasses = useThemeClasses(theme);
63
- return (<ThemeContext.Provider value={themeValue}>
63
+ return (<ThemeContext value={themeValue}>
64
64
  <WrapperComponent ref={wrapperRef} className={target ? undefined : classNames(className, themeClasses)} {...restProps}>
65
65
  {children}
66
66
  </WrapperComponent>
67
- </ThemeContext.Provider>);
67
+ </ThemeContext>);
68
68
  }
69
- export const ThemeProvider = forwardRef(function ThemeProvider(props, ref) {
69
+ export function ThemeProvider({ ref, ...props }) {
70
70
  return <ThemeProviderInner {...props} wrapperRef={ref}/>;
71
- });
71
+ }
72
72
  export default Theme;
@@ -20,8 +20,6 @@
20
20
  --ring-border-disabled-color: rgb(var(--ring-border-disabled-components)); /* #ebecf0 */
21
21
  --ring-border-selected-disabled-components: 201, 204, 214;
22
22
  --ring-border-selected-disabled-color: rgb(var(--ring-border-selected-disabled-components)); /* #c9ccd6 */
23
- --ring-border-disabled-active-components: var(--ring-border-hover-components);
24
- --ring-border-disabled-active-color: var(--ring-border-hover-color); /* TODO: remove in 8.0 in favor of --ring-border-hover-color */
25
23
  --ring-icon-disabled-components: 168, 173, 189;
26
24
  --ring-icon-disabled-color: rgb(var(--ring-icon-disabled-components)); /* #A8ADBD */
27
25
  --ring-border-hover-components: 160, 189, 248;
@@ -36,8 +34,6 @@
36
34
  --ring-icon-hover-color: rgb(var(--ring-icon-hover-components)); /* #5a5d6b */
37
35
  --ring-main-components: 51, 105, 214;
38
36
  --ring-main-color: rgb(var(--ring-main-components)); /* #3369D6 */
39
- --ring-action-link-components: var(--ring-link-components);
40
- --ring-action-link-color: var(--ring-link-color); /* #315FBD */ /* TODO: remove in 8.0 in favor of --ring-link-color */
41
37
  --ring-main-hover-components: 49, 95, 189;
42
38
  --ring-main-hover-color: rgb(var(--ring-main-hover-components)); /* #315FBD */
43
39
  --ring-main-success-components: 31, 128, 57;
@@ -94,8 +90,6 @@
94
90
  --ring-popup-shadow-color: rgba(var(--ring-popup-border-components), 0.1);
95
91
  --ring-popup-secondary-shadow-color: rgba(var(--ring-popup-border-components), 0.04);
96
92
  --ring-message-shadow-color: rgba(var(--ring-popup-border-components), 0.3);
97
- --ring-pinned-shadow-components: 108, 112, 126;
98
- --ring-pinned-shadow-color: rgb(var(--ring-pinned-shadow-components)); /* #6C707E */ /* TODO remove in 8.0 */
99
93
  --ring-button-danger-hover-components: 219, 59, 75;
100
94
  --ring-button-danger-hover-color: rgb(var(--ring-button-danger-hover-components)); /* #DB3B4B */
101
95
  --ring-button-primary-border-components: 46, 85, 163;
@@ -108,8 +102,6 @@
108
102
  /* Text */
109
103
  --ring-search-components: 112, 156, 245;
110
104
  --ring-search-color: rgb(var(--ring-search-components)); /* #709CF5 */
111
- --ring-hint-components: 46, 85, 163;
112
- --ring-hint-color: rgb(var(--ring-hint-components)); /* #2E55A3 */ /* TODO: remove in 8.0 */
113
105
  --ring-link-components: 49, 95, 189;
114
106
  --ring-link-color: rgb(var(--ring-link-components)); /* #315FBD */
115
107
  --ring-link-hover-components: 46, 85, 163;
@@ -167,8 +159,6 @@
167
159
  --ring-disabled-selected-background-components: 235, 236, 240;
168
160
  --ring-disabled-selected-background-color: rgb(var(--ring-disabled-selected-background-components)); /* #EBECF0 */
169
161
  --ring-button-danger-active-color: var(--ring-error-container-light-color); /* #FAD4D8 */
170
- --ring-button-loader-background: rgba(var(--ring-white-text-components), 0.4); /* TODO remove in 8.0 */
171
- --ring-button-primary-background-color: var(--ring-main-color); /* TODO remove in 8.0 */
172
162
  --ring-table-loader-background-color: rgba(var(--ring-content-background-components), 0.5); /* #FFFFFF50 */
173
163
  --ring-removed-subtle-background-components: 255, 235, 236;
174
164
  --ring-removed-subtle-background-color: rgb(var(--ring-removed-subtle-background-components)); /* #FFEBEC */
@@ -19,11 +19,9 @@ export interface RingCSSProperties {
19
19
  '--ring-popup-border-color'?: Property.BorderColor;
20
20
  '--ring-popup-shadow-color'?: Property.Color;
21
21
  '--ring-message-shadow-color'?: Property.Color;
22
- '--ring-pinned-shadow-color'?: Property.Color;
23
22
  '--ring-button-danger-hover-color'?: Property.Color;
24
23
  '--ring-button-primary-border-color'?: Property.Color;
25
24
  '--ring-search-color'?: Property.Color;
26
- '--ring-hint-color'?: Property.Color;
27
25
  '--ring-link-color'?: Property.Color;
28
26
  '--ring-link-hover-color'?: Property.Color;
29
27
  '--ring-error-color'?: Property.Color;
@@ -49,8 +47,6 @@ export interface RingCSSProperties {
49
47
  '--ring-disabled-background-color'?: Property.BackgroundColor;
50
48
  '--ring-disabled-selected-background-color'?: Property.BackgroundColor;
51
49
  '--ring-button-danger-active-color'?: Property.BackgroundColor;
52
- '--ring-button-loader-background'?: Property.BackgroundColor;
53
- '--ring-button-primary-background-color'?: Property.BackgroundColor;
54
50
  '--ring-code-background-color'?: Property.BackgroundColor;
55
51
  '--ring-code-color'?: Property.Color;
56
52
  '--ring-code-comment-color'?: Property.Color;
@@ -15,8 +15,6 @@
15
15
  --ring-border-disabled-color: rgb(var(--ring-border-disabled-components)); /* #4E5157 */
16
16
  --ring-border-selected-disabled-components: 90, 93, 99;
17
17
  --ring-border-selected-disabled-color: rgb(var(--ring-border-selected-disabled-components)); /* #5A5D63 */
18
- --ring-border-disabled-active-components: var(--ring-border-hover-components);
19
- --ring-border-disabled-active-color: var(--ring-border-hover-color); /* TODO: remove in 8.0 in favor of --ring-border-hover-color */
20
18
  --ring-icon-disabled-components: 111, 115, 122;
21
19
  --ring-icon-disabled-color: rgb(var(--ring-icon-disabled-components)); /* #6F737A */
22
20
  --ring-border-hover-components: 55, 95, 173;
@@ -82,8 +80,6 @@
82
80
  --ring-popup-shadow-color: rgba(0, 0, 0, 0.31);
83
81
  --ring-popup-secondary-shadow-color: rgba(0, 0, 0, 0.37);
84
82
  --ring-message-shadow-color: rgba(var(--ring-popup-border-components), 0.3);
85
- --ring-pinned-shadow-components: 0, 0, 0;
86
- --ring-pinned-shadow-color: rgb(var(--ring-pinned-shadow-components)); /* #000 */ /* TODO remove in 8.0 */
87
83
  --ring-button-danger-hover-color: var(--ring-error-color);
88
84
  --ring-button-primary-border-components: 153, 187, 255;
89
85
  --ring-button-primary-border-color: rgb(var(--ring-button-primary-border-components)); /* #99BBFF */
@@ -93,8 +89,6 @@
93
89
  --ring-dialog-shadow: 0 4px 16px var(--ring-popup-shadow-color), 0 2px 6px var(--ring-popup-secondary-shadow-color);
94
90
 
95
91
  /* Text */
96
- --ring-hint-components: 134, 138, 145;
97
- --ring-hint-color: rgb(var(--ring-hint-components)); /* #868A91 */ /* TODO: remove in 8.0 */
98
92
  --ring-link-components: 153, 187, 255;
99
93
  --ring-link-color: rgb(var(--ring-link-components)); /* #99BBFF */
100
94
  --ring-link-hover-components: 107, 155, 250;
@@ -153,7 +147,6 @@
153
147
  --ring-disabled-selected-background-components: 67, 69, 74;
154
148
  --ring-disabled-selected-background-color: rgb(var(--ring-disabled-selected-background-components)); /* #43454A */
155
149
  --ring-button-danger-active-color: var(--ring-error-container-light-color); /* #5E3838 */
156
- --ring-button-primary-background-color: var(--ring-main-color); /* TODO remove in 8.0 */
157
150
  --ring-table-loader-background-color: rgba(var(--ring-content-background-components), 0.5); /* #2B2D3050 */
158
151
  --ring-removed-subtle-background-components: 64, 41, 41;
159
152
  --ring-removed-subtle-background-color: rgb(var(--ring-removed-subtle-background-components)); /* #402929 */
@@ -9,5 +9,5 @@ export const I18nContextHolder = ({ children, messages }) => {
9
9
  useEffect(() => {
10
10
  setTranslations(messages);
11
11
  }, [messages]);
12
- return <I18nContext.Provider value={{ messages, translate }}>{children}</I18nContext.Provider>;
12
+ return <I18nContext value={{ messages, translate }}>{children}</I18nContext>;
13
13
  };
@@ -1,7 +1,6 @@
1
1
  // Inspired by https://github.com/sairion/svg-inline-react
2
2
  import { memo } from 'react';
3
3
  import classNames from 'classnames';
4
- import { getTrustedHTML } from '../global/configuration';
5
4
  import memoize from '../global/memoize';
6
5
  import styles from './icon.css';
7
6
  function convertReactSVGDOMProperty(str) {
@@ -28,7 +27,7 @@ function extractSVGProps(svgNode) {
28
27
  }
29
28
  const getSVGFromSource = memoize((src) => {
30
29
  const svgContainer = document.createElement('div');
31
- svgContainer.innerHTML = getTrustedHTML(src);
30
+ svgContainer.innerHTML = src;
32
31
  const svg = svgContainer.firstElementChild;
33
32
  if (svg.remove) {
34
33
  svg.remove();
@@ -52,7 +51,7 @@ function IconSVG({ src, className, ...rest }) {
52
51
  }, className);
53
52
  const { props, html } = getSVGFromSource(src);
54
53
  return (<svg {...props} {...rest} className={glyphClasses} dangerouslySetInnerHTML={{
55
- __html: getTrustedHTML(html),
54
+ __html: html,
56
55
  }}/>);
57
56
  }
58
57
  export default memo(IconSVG);
@@ -11,11 +11,6 @@
11
11
 
12
12
  pointer-events: none;
13
13
 
14
- /* TODO remove in 8.0 */
15
- &[width='10'] {
16
- vertical-align: -1px;
17
- }
18
-
19
14
  &[width='12'] {
20
15
  vertical-align: -1px;
21
16
  }
@@ -71,25 +66,3 @@
71
66
  .white {
72
67
  color: var(--ring-white-text-color);
73
68
  }
74
-
75
- .loading {
76
- animation-name: icon-loading;
77
- animation-duration: 1200ms;
78
- animation-iteration-count: infinite;
79
- }
80
-
81
- @keyframes icon-loading {
82
- 0% {
83
- transform: scale(1);
84
- }
85
-
86
- 50% {
87
- transform: scale(0.9);
88
-
89
- opacity: 0.5;
90
- }
91
-
92
- 100% {
93
- transform: scale(1);
94
- }
95
- }
@@ -19,7 +19,6 @@ export interface IconProps extends HTMLAttributes<HTMLElement> {
19
19
  * @deprecated Use icons with appropriate intrinsic sizes instead
20
20
  */
21
21
  width?: number | undefined;
22
- loading?: boolean | null | undefined;
23
22
  suppressSizeWarning?: boolean | null | undefined;
24
23
  }
25
24
  export default class Icon extends PureComponent<IconProps> {
@@ -43,13 +43,11 @@ export default class Icon extends PureComponent {
43
43
  return undefined;
44
44
  }
45
45
  render() {
46
- const { className, size, color, loading, glyph: Glyph, width, height, suppressSizeWarning, ...restProps } = this.props;
46
+ const { className, size, color, glyph: Glyph, width, height, suppressSizeWarning, ...restProps } = this.props;
47
47
  if (!Glyph) {
48
48
  return null;
49
49
  }
50
- const classes = classNames(styles.icon, color && styles[color], {
51
- [styles.loading]: loading,
52
- }, className);
50
+ const classes = classNames(styles.icon, color && styles[color], className);
53
51
  return (<span data-test='ring-icon' {...restProps} className={classes}>
54
52
  {typeof Glyph === 'string' ? (<IconSVG src={Glyph} style={this.getStyle()}/>) : (<Glyph className={styles.glyph} style={this.getStyle()}/>)}
55
53
  </span>);
@@ -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;