@jetbrains/ring-ui 8.0.0-beta.1 → 8.0.0-beta.11

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 (211) hide show
  1. package/babel.config.js +1 -9
  2. package/components/alert/alert-actions.d.ts +4 -0
  3. package/components/alert/alert-actions.js +5 -0
  4. package/components/alert/alert-heading.d.ts +4 -0
  5. package/components/alert/alert-heading.js +6 -0
  6. package/components/alert/alert.css +63 -22
  7. package/components/alert/alert.d.ts +14 -1
  8. package/components/alert/alert.js +34 -19
  9. package/components/alert/container.css +1 -2
  10. package/components/alert-service/alert-service.d.ts +2 -1
  11. package/components/alert-service/alert-service.js +8 -4
  12. package/components/auth/auth-core.d.ts +5 -9
  13. package/components/auth/auth-core.js +56 -15
  14. package/components/auth-dialog-service/auth-dialog-service.js +5 -2
  15. package/components/avatar/avatar-info.js +0 -2
  16. package/components/avatar/avatar-size.d.ts +0 -4
  17. package/components/avatar/avatar-size.js +0 -4
  18. package/components/avatar/avatar.js +0 -6
  19. package/components/avatar/fallback-avatar.js +0 -28
  20. package/components/avatar-stack/avatar-stack.js +1 -1
  21. package/components/banner/banner.css +3 -3
  22. package/components/button/button.css +4 -4
  23. package/components/button/button.d.ts +0 -4
  24. package/components/button/button.js +2 -7
  25. package/components/button-group/button-group.css +5 -5
  26. package/components/checkbox/checkbox.d.ts +1 -1
  27. package/components/collapse/collapse-content.d.ts +7 -0
  28. package/components/collapse/collapse-content.js +44 -11
  29. package/components/collapse/collapse-context.d.ts +2 -0
  30. package/components/collapse/collapse-context.js +2 -0
  31. package/components/collapse/collapse-control.js +2 -2
  32. package/components/collapse/collapse.css +8 -2
  33. package/components/collapse/collapse.d.ts +9 -0
  34. package/components/collapse/collapse.js +12 -3
  35. package/components/{expand → collapsible-group}/collapsible-group.css +7 -1
  36. package/components/collapsible-group/collapsible-group.d.ts +33 -0
  37. package/components/{expand → collapsible-group}/collapsible-group.js +13 -21
  38. package/components/confirm/confirm.js +12 -8
  39. package/components/confirm-service/confirm-service.js +5 -2
  40. package/components/data-list/data-list.d.ts +1 -1
  41. package/components/data-list/data-list.mock.d.ts +1 -1
  42. package/components/data-list/item.d.ts +1 -1
  43. package/components/data-list/selection.d.ts +1 -1
  44. package/components/data-list/selection.js +1 -1
  45. package/components/date-picker/consts.d.ts +1 -0
  46. package/components/date-picker/date-input.js +6 -2
  47. package/components/date-picker/months.js +2 -2
  48. package/components/date-picker/use-scroll-behavior.js +5 -6
  49. package/components/date-picker/years.js +2 -2
  50. package/components/dialog/dialog-controls.d.ts +13 -0
  51. package/components/dialog/dialog-controls.js +17 -0
  52. package/components/dialog/dialog-geometry.d.ts +31 -0
  53. package/components/dialog/dialog-geometry.js +48 -0
  54. package/components/dialog/dialog.css +166 -27
  55. package/components/dialog/dialog.d.ts +15 -7
  56. package/components/dialog/dialog.js +110 -29
  57. package/components/dropdown-menu/dropdown-menu.d.ts +4 -4
  58. package/components/dropdown-menu/dropdown-menu.js +4 -4
  59. package/components/editable-heading/editable-heading.d.ts +1 -2
  60. package/components/editable-heading/editable-heading.js +18 -19
  61. package/components/global/compose-refs.d.ts +2 -1
  62. package/components/global/compose-refs.js +24 -8
  63. package/components/global/create-stateful-context.js +5 -5
  64. package/components/global/focus-with-temporary-tabindex.d.ts +11 -0
  65. package/components/global/focus-with-temporary-tabindex.js +21 -0
  66. package/components/global/get-viewport-size.d.ts +5 -0
  67. package/components/global/get-viewport-size.js +5 -0
  68. package/components/global/intersection-observer-context.d.ts +31 -11
  69. package/components/global/intersection-observer-context.js +47 -28
  70. package/components/global/is-within-interactive-element.d.ts +6 -0
  71. package/components/global/is-within-interactive-element.js +26 -0
  72. package/components/global/is-within-navigable-element.d.ts +6 -0
  73. package/components/global/is-within-navigable-element.js +27 -0
  74. package/components/global/parse-css-duration.d.ts +5 -0
  75. package/components/global/parse-css-duration.js +13 -0
  76. package/components/global/rerender-hoc.d.ts +4 -2
  77. package/components/global/rerender-hoc.js +4 -4
  78. package/components/global/schedule-with-cleanup.d.ts +12 -0
  79. package/components/global/schedule-with-cleanup.js +34 -0
  80. package/components/{legacy-table/selection.d.ts → global/table-selection.d.ts} +14 -14
  81. package/components/{legacy-table/selection.js → global/table-selection.js} +2 -2
  82. package/components/global/theme.d.ts +4 -3
  83. package/components/global/theme.js +8 -8
  84. package/components/global/variables.css +18 -28
  85. package/components/global/variables.interface.d.ts +0 -4
  86. package/components/global/variables_dark.css +18 -25
  87. package/components/header/header.css +3 -3
  88. package/components/http/http.d.ts +2 -2
  89. package/components/http/http.js +6 -17
  90. package/components/i18n/i18n-context.js +1 -1
  91. package/components/i18n/i18n.d.ts +1 -0
  92. package/components/i18n/messages.json +1 -0
  93. package/components/icon/icon.css +0 -27
  94. package/components/icon/icon.d.ts +0 -1
  95. package/components/icon/icon.js +2 -4
  96. package/components/input/input.d.ts +1 -1
  97. package/components/island/adaptive-island-hoc.js +4 -4
  98. package/components/island/content.d.ts +7 -2
  99. package/components/island/content.js +5 -5
  100. package/components/island/header.js +1 -1
  101. package/components/legacy-table/cell.js +1 -1
  102. package/components/legacy-table/header-cell.js +1 -1
  103. package/components/legacy-table/header.js +1 -1
  104. package/components/legacy-table/multitable.d.ts +1 -1
  105. package/components/legacy-table/row.d.ts +1 -1
  106. package/components/legacy-table/row.js +1 -1
  107. package/components/legacy-table/selection-adapter.d.ts +3 -3
  108. package/components/legacy-table/selection-shortcuts-hoc.d.ts +5 -5
  109. package/components/legacy-table/simple-table.d.ts +2 -2
  110. package/components/legacy-table/simple-table.js +3 -3
  111. package/components/legacy-table/smart-table.d.ts +5 -5
  112. package/components/legacy-table/smart-table.js +3 -3
  113. package/components/legacy-table/table.js +1 -1
  114. package/components/list/consts.d.ts +0 -1
  115. package/components/list/consts.js +0 -1
  116. package/components/list/list.d.ts +0 -4
  117. package/components/login-dialog/service.js +5 -2
  118. package/components/panel/panel.css +1 -1
  119. package/components/popup/popup.d.ts +2 -0
  120. package/components/popup/popup.js +2 -2
  121. package/components/popup/popup.target.d.ts +3 -2
  122. package/components/popup/popup.target.js +4 -6
  123. package/components/query-assist/query-assist.d.ts +3 -1
  124. package/components/query-assist/query-assist.js +2 -2
  125. package/components/radio/radio-item.d.ts +3 -3
  126. package/components/radio/radio-item.js +3 -4
  127. package/components/radio/radio.d.ts +2 -2
  128. package/components/radio/radio.js +1 -1
  129. package/components/select/select-popup.d.ts +3 -2
  130. package/components/select/select-popup.js +3 -3
  131. package/components/select/select.d.ts +6 -2
  132. package/components/select/select.js +2 -4
  133. package/components/selection-toolbar/selection-toolbar.css +86 -0
  134. package/components/selection-toolbar/selection-toolbar.d.ts +11 -0
  135. package/components/selection-toolbar/selection-toolbar.js +23 -0
  136. package/components/slider/slider.js +4 -5
  137. package/components/tab-trap/tab-trap.d.ts +3 -3
  138. package/components/tab-trap/tab-trap.js +3 -5
  139. package/components/table/default-item-renderer.d.ts +41 -11
  140. package/components/table/default-item-renderer.js +60 -47
  141. package/components/table/internal/reorder-animation-context.d.ts +21 -0
  142. package/components/table/internal/reorder-animation-context.js +60 -0
  143. package/components/table/internal/reorder-handle.d.ts +9 -0
  144. package/components/table/internal/reorder-handle.js +334 -0
  145. package/components/table/internal/reorder-layout-context.d.ts +16 -0
  146. package/components/table/internal/reorder-layout-context.js +69 -0
  147. package/components/table/internal/table-header.d.ts +1 -0
  148. package/components/table/internal/table-header.js +143 -0
  149. package/components/table/internal/virtualization.d.ts +41 -0
  150. package/components/table/{table-virtualize.js → internal/virtualization.js} +82 -46
  151. package/components/table/item-virtualization.d.ts +37 -0
  152. package/components/table/item-virtualization.js +26 -0
  153. package/components/table/reorder-animation.d.ts +37 -0
  154. package/components/table/reorder-animation.js +11 -0
  155. package/components/table/reorder-item-layout.d.ts +32 -0
  156. package/components/table/reorder-item-layout.js +23 -0
  157. package/components/table/table-const.d.ts +8 -6
  158. package/components/table/table-const.js +7 -5
  159. package/components/table/table-primitives.d.ts +64 -0
  160. package/components/table/table-primitives.js +34 -0
  161. package/components/table/table-props.d.ts +304 -0
  162. package/components/table/table-props.js +1 -0
  163. package/components/table/table.css +179 -67
  164. package/components/table/table.d.ts +231 -224
  165. package/components/table/table.js +327 -2
  166. package/components/tag/tag.css +3 -3
  167. package/components/tags-input/tags-input.d.ts +3 -1
  168. package/components/tooltip/tooltip.d.ts +2 -1
  169. package/components/tooltip/tooltip.js +6 -5
  170. package/components/upload/upload.d.ts +4 -3
  171. package/components/upload/upload.js +3 -7
  172. package/components/user-agreement/service.js +5 -2
  173. package/components/user-agreement/user-agreement.css +2 -8
  174. package/components/user-agreement/user-agreement.js +8 -10
  175. package/components/user-card/smart-user-card-tooltip.d.ts +1 -1
  176. package/components/util-stories.d.ts +26 -0
  177. package/components/util-stories.js +61 -0
  178. package/package.json +47 -50
  179. package/components/content-layout/content-layout.css +0 -109
  180. package/components/content-layout/content-layout.d.ts +0 -20
  181. package/components/content-layout/content-layout.js +0 -40
  182. package/components/content-layout/sidebar.d.ts +0 -26
  183. package/components/content-layout/sidebar.js +0 -71
  184. package/components/date-picker/use-intersection-observer.d.ts +0 -6
  185. package/components/date-picker/use-intersection-observer.js +0 -48
  186. package/components/expand/collapsible-group.d.ts +0 -16
  187. package/components/global/composeRefs.d.ts +0 -6
  188. package/components/global/composeRefs.js +0 -7
  189. package/components/global/use-event-callback.d.ts +0 -1
  190. package/components/global/use-event-callback.js +0 -15
  191. package/components/grid/col.d.ts +0 -16
  192. package/components/grid/col.js +0 -35
  193. package/components/grid/grid.css +0 -920
  194. package/components/grid/grid.d.ts +0 -13
  195. package/components/grid/grid.js +0 -19
  196. package/components/grid/row.d.ts +0 -21
  197. package/components/grid/row.js +0 -41
  198. package/components/old-browsers-message/__mocks__/old-browsers-message.js +0 -1
  199. package/components/old-browsers-message/old-browsers-message-stop.d.ts +0 -1
  200. package/components/old-browsers-message/old-browsers-message-stop.js +0 -2
  201. package/components/old-browsers-message/old-browsers-message.css +0 -26
  202. package/components/old-browsers-message/old-browsers-message.d.ts +0 -5
  203. package/components/old-browsers-message/old-browsers-message.js +0 -86
  204. package/components/old-browsers-message/white-list.d.ts +0 -2
  205. package/components/old-browsers-message/white-list.js +0 -24
  206. package/components/table/table-base.d.ts +0 -24
  207. package/components/table/table-base.js +0 -79
  208. package/components/table/table-component.d.ts +0 -53
  209. package/components/table/table-component.js +0 -101
  210. package/components/table/table-virtualize.d.ts +0 -32
  211. /package/components/legacy-table/{table.css → legacy-table.css} +0 -0
@@ -45,6 +45,8 @@ export interface BasePopupProps {
45
45
  onMouseUp?: ((e: React.MouseEvent<HTMLElement>) => void) | undefined;
46
46
  onMouseOver?: ((e: React.SyntheticEvent<HTMLElement>) => void) | undefined;
47
47
  onMouseOut?: ((e: React.SyntheticEvent<HTMLElement>) => void) | undefined;
48
+ onMouseEnter?: ((e: React.MouseEvent<HTMLElement>) => void) | undefined;
49
+ onMouseLeave?: ((e: React.MouseEvent<HTMLElement>) => void) | undefined;
48
50
  onContextMenu?: ((e: React.MouseEvent<HTMLElement>) => void) | undefined;
49
51
  onDirectionChange?: ((direction: Directions) => void) | null | undefined;
50
52
  onShow?: (() => void) | null | undefined;
@@ -282,7 +282,7 @@ export default class Popup extends PureComponent {
282
282
  esc: this._onEscPress,
283
283
  };
284
284
  render() {
285
- const { className, style, hidden, attached, keepMounted, client, onMouseDown, onMouseUp, onMouseOver, onMouseOut, onContextMenu, 'data-test': dataTest, largeBorderRadius, } = this.props;
285
+ const { className, style, hidden, attached, keepMounted, client, onMouseDown, onMouseUp, onMouseOver, onMouseOut, onMouseEnter, onMouseLeave, onContextMenu, 'data-test': dataTest, largeBorderRadius, } = this.props;
286
286
  const showing = this.state.display === Display.SHOWING;
287
287
  const direction = (this.state.direction || '').toLowerCase().replace(/[_]/g, '-');
288
288
  return (<ThemeContext.Consumer>
@@ -305,7 +305,7 @@ export default class Popup extends PureComponent {
305
305
 
306
306
  {client !== false &&
307
307
  (keepMounted || !hidden) &&
308
- createPortal(<PopupTarget id={this.uid} ref={this.containerRef} onMouseOver={onMouseOver} onFocus={onMouseOver} onMouseOut={onMouseOut} onBlur={onMouseOut} onContextMenu={onContextMenu}>
308
+ createPortal(<PopupTarget id={this.uid} ref={this.containerRef} onMouseOver={onMouseOver} onFocus={onMouseOver} onMouseOut={onMouseOut} onBlur={onMouseOut} onMouseEnter={onMouseEnter} onMouseLeave={onMouseLeave} onContextMenu={onContextMenu}>
309
309
  <div data-test={dataTests('ring-popup', dataTest)} data-test-shown={!hidden && !showing} data-test-direction={direction} ref={this.popupRef} className={classes} style={style} onMouseDown={onMouseDown} onMouseUp={onMouseUp}
310
310
  // mouse handlers are used to track clicking on inner elements
311
311
  role='presentation'>
@@ -1,13 +1,14 @@
1
- import { type HTMLAttributes, type ReactNode } from 'react';
1
+ import { type HTMLAttributes, type Ref, type ReactNode } from 'react';
2
2
  interface ComplexConfig {
3
3
  target: string | Element | undefined;
4
4
  cssPositioning?: boolean;
5
5
  }
6
6
  export declare const PopupTargetContext: import("react").Context<string | Element | ComplexConfig | undefined>;
7
7
  export interface PopupTargetProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
8
+ ref?: Ref<HTMLDivElement>;
8
9
  id: string;
9
10
  children: ReactNode | ((target: ReactNode) => ReactNode);
10
11
  }
11
12
  export declare function normalizePopupTarget(value: string | Element | undefined | ComplexConfig): string | Element | undefined;
12
- export declare const PopupTarget: import("react").ForwardRefExoticComponent<PopupTargetProps & import("react").RefAttributes<HTMLDivElement>>;
13
+ export declare function PopupTarget({ ref, id, children, ...restProps }: PopupTargetProps): import("react").JSX.Element;
13
14
  export {};
@@ -1,13 +1,11 @@
1
- import { createContext, forwardRef } from 'react';
1
+ import { createContext } from 'react';
2
2
  export const PopupTargetContext = createContext(undefined);
3
3
  export function normalizePopupTarget(value) {
4
4
  return typeof value === 'string' || value instanceof Element ? value : value?.target;
5
5
  }
6
- export const PopupTarget = forwardRef(function PopupTarget({ id, children, ...restProps }, ref) {
6
+ export function PopupTarget({ ref, id, children, ...restProps }) {
7
7
  const target = (<div {...restProps} data-portaltarget={id} ref={ref}>
8
8
  {typeof children !== 'function' && children}
9
9
  </div>);
10
- return (<PopupTargetContext.Provider value={id}>
11
- {typeof children === 'function' ? children(target) : target}
12
- </PopupTargetContext.Provider>);
13
- });
10
+ return (<PopupTargetContext value={id}>{typeof children === 'function' ? children(target) : target}</PopupTargetContext>);
11
+ }
@@ -285,5 +285,7 @@ export default class QueryAssist extends Component<QueryAssistProps> {
285
285
  render(): React.JSX.Element;
286
286
  }
287
287
  export type QueryAssistAttrs = React.JSX.LibraryManagedAttributes<typeof QueryAssist, QueryAssistProps>;
288
- export declare const RerenderableQueryAssist: React.ForwardRefExoticComponent<QueryAssistProps & React.RefAttributes<QueryAssist>>;
288
+ export declare const RerenderableQueryAssist: ({ ref, ...props }: QueryAssistProps & {
289
+ ref?: React.Ref<QueryAssist> | undefined;
290
+ }) => React.JSX.Element;
289
291
  export {};
@@ -733,7 +733,7 @@ export default class QueryAssist extends Component {
733
733
  [styles.hugePlaceholder]: huge,
734
734
  [styles.withoutGlass]: !glass || (!renderLoader && huge),
735
735
  });
736
- return (<ControlsHeightContext.Provider value={ControlsHeight.M}>
736
+ return (<ControlsHeightContext value={ControlsHeight.M}>
737
737
  <I18nContext.Consumer>
738
738
  {({ translate }) => (<div data-test={dataTests('ring-query-assist', dataTest)} className={containerClasses} role='presentation' ref={this.nodeRef}>
739
739
  {this.state.shortcuts && <Shortcuts map={this.shortcutsMap} scope={this.shortcutsScope}/>}
@@ -768,7 +768,7 @@ export default class QueryAssist extends Component {
768
768
  </div>)}
769
769
  </div>)}
770
770
  </I18nContext.Consumer>
771
- </ControlsHeightContext.Provider>);
771
+ </ControlsHeightContext>);
772
772
  }
773
773
  }
774
774
  export const RerenderableQueryAssist = rerenderHOC(QueryAssist);
@@ -1,4 +1,4 @@
1
- import { Component, type InputHTMLAttributes, type ReactNode } from 'react';
1
+ import { Component, type Ref, type InputHTMLAttributes, type ReactNode } from 'react';
2
2
  export interface RadioProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'onChange'> {
3
3
  value?: string | undefined;
4
4
  onChange?: ((value: string) => void) | null | undefined;
@@ -17,7 +17,7 @@ export declare class RadioItemInner extends Component<RadioItemInnerProps> {
17
17
  render(): import("react").JSX.Element;
18
18
  }
19
19
  export interface RadioItemProps extends RadioItemInnerProps {
20
+ ref?: Ref<RadioItemInner>;
20
21
  value: string;
21
22
  }
22
- declare const RadioItem: import("react").ForwardRefExoticComponent<RadioItemProps & import("react").RefAttributes<RadioItemInner>>;
23
- export default RadioItem;
23
+ export default function RadioItem({ ref, ...props }: RadioItemProps): import("react").JSX.Element;
@@ -1,4 +1,4 @@
1
- import { Component, createContext, forwardRef } from 'react';
1
+ import { Component, createContext } from 'react';
2
2
  import classNames from 'classnames';
3
3
  import getUID from '../global/get-uid';
4
4
  import ControlHelp from '../control-help/control-help';
@@ -28,9 +28,8 @@ export class RadioItemInner extends Component {
28
28
  </label>);
29
29
  }
30
30
  }
31
- const RadioItem = forwardRef(function RadioItem(props, ref) {
31
+ export default function RadioItem({ ref, ...props }) {
32
32
  return (<RadioContext.Consumer>
33
33
  {({ value, onChange, ...restContext }) => (<RadioItemInner ref={ref} {...restContext} checked={value !== undefined ? value === props.value : undefined} onChange={onChange ? () => onChange(props.value) : undefined} {...props}/>)}
34
34
  </RadioContext.Consumer>);
35
- });
36
- export default RadioItem;
35
+ }
@@ -1,10 +1,10 @@
1
1
  import { Component } from 'react';
2
- import { type RadioProps } from './radio-item';
2
+ import RadioItem, { type RadioProps } from './radio-item';
3
3
  /**
4
4
  * @name Radio
5
5
  */
6
6
  export default class Radio extends Component<RadioProps> {
7
- static Item: import("react").ForwardRefExoticComponent<import("./radio-item").RadioItemProps & import("react").RefAttributes<import("./radio-item").RadioItemInner>>;
7
+ static Item: typeof RadioItem;
8
8
  uid: string;
9
9
  render(): import("react").JSX.Element;
10
10
  }
@@ -8,6 +8,6 @@ export default class Radio extends Component {
8
8
  static Item = RadioItem;
9
9
  uid = getUID('ring-radio-');
10
10
  render() {
11
- return <RadioContext.Provider value={{ name: this.uid, ...this.props }}>{this.props.children}</RadioContext.Provider>;
11
+ return <RadioContext value={{ name: this.uid, ...this.props }}>{this.props.children}</RadioContext>;
12
12
  }
13
13
  }
@@ -4,7 +4,7 @@
4
4
  import { type ComponentType, type CSSProperties, PureComponent, type ReactNode, type Ref, type SyntheticEvent } from 'react';
5
5
  import * as React from 'react';
6
6
  import { type IconType } from '../icon/icon';
7
- import Popup from '../popup/popup';
7
+ import Popup, { type PopupAttrs } from '../popup/popup';
8
8
  import { type Directions } from '../popup/position';
9
9
  import List, { type SelectHandlerParams } from '../list/list';
10
10
  import Caret from '../caret/caret';
@@ -60,6 +60,7 @@ export interface SelectPopupProps<T = unknown> {
60
60
  ringPopupTarget: string | null;
61
61
  onSelectAll: (isSelectAll: boolean) => void;
62
62
  onEmptyPopupEnter: (e: KeyboardEvent) => void;
63
+ popupProps?: Partial<PopupAttrs> | undefined;
63
64
  className?: string | null | undefined;
64
65
  compact?: boolean | null | undefined;
65
66
  dir?: 'ltr' | 'rtl' | undefined;
@@ -127,7 +128,7 @@ export default class SelectPopup<T = unknown> extends PureComponent<SelectPopupP
127
128
  list?: List<T> | null;
128
129
  listRef: (el: List<T> | null) => void;
129
130
  filterRef: (el: HTMLInputElement | null) => void;
130
- composedFilterRef: import("memoize-one").MemoizedFn<(...refs: (Ref<HTMLInputElement> | undefined)[]) => (value: T_1 | null) => void>;
131
+ composedFilterRef: import("memoize-one").MemoizedFn<(...refs: (Ref<HTMLInputElement> | undefined)[]) => (value: T_1 | null) => () => void>;
131
132
  shortcutsScope: string;
132
133
  shortcutsMap: {
133
134
  tab: (event: Event) => void;
@@ -323,8 +323,8 @@ export default class SelectPopup extends PureComponent {
323
323
  right: event => this.handleNavigation(event),
324
324
  };
325
325
  render() {
326
- const { toolbar, topbar, className, multiple, hidden, isInputMode, anchorElement, minWidth, onCloseAttempt, onOutsideClick, directions, top, left, offset, style, dir, filter, } = this.props;
327
- const classes = classNames(styles.popup, className);
326
+ const { toolbar, topbar, className, multiple, hidden, isInputMode, anchorElement, minWidth, onCloseAttempt, onOutsideClick, directions, top, left, offset, style, dir, filter, popupProps, } = this.props;
327
+ const classes = classNames(styles.popup, className, popupProps?.className);
328
328
  return (<PopupTargetContext.Consumer>
329
329
  {ringPopupTarget => {
330
330
  const filterWithTags = this.getFilterWithTags();
@@ -332,7 +332,7 @@ export default class SelectPopup extends PureComponent {
332
332
  const list = this.getList(this.props.ringPopupTarget || normalizePopupTarget(ringPopupTarget));
333
333
  const bottomLine = this.getBottomLine();
334
334
  const hasContent = filterWithTags || selectAll || list || bottomLine || toolbar || topbar;
335
- return (<Popup trapFocus={false} ref={this.popupRef} hidden={hidden || !hasContent} attached={isInputMode} className={classes} dontCloseOnAnchorClick anchorElement={anchorElement} minWidth={minWidth} onCloseAttempt={onCloseAttempt} onOutsideClick={onOutsideClick} directions={directions} top={top} left={left} offset={offset} onMouseDown={this.mouseDownHandler} target={this.props.ringPopupTarget} autoCorrectTopOverflow={false} style={style} largeBorderRadius>
335
+ return (<Popup {...popupProps} trapFocus={false} ref={this.popupRef} hidden={hidden || !hasContent} attached={isInputMode} className={classes} dontCloseOnAnchorClick anchorElement={anchorElement} minWidth={minWidth} onCloseAttempt={onCloseAttempt} onOutsideClick={onOutsideClick} directions={directions} top={top} left={left} offset={offset} onMouseDown={this.mouseDownHandler} target={this.props.ringPopupTarget} autoCorrectTopOverflow={false} style={{ ...popupProps?.style, ...style }} largeBorderRadius>
336
336
  <div dir={dir}>
337
337
  {!hidden && filter && <Shortcuts map={this.shortcutsMap} scope={this.shortcutsScope}/>}
338
338
  {topbar}
@@ -1,5 +1,6 @@
1
1
  import { type ButtonHTMLAttributes, Component, type ComponentType, type CSSProperties, type HTMLAttributes, type ReactNode, type Ref, type RefCallback, type SyntheticEvent } from 'react';
2
2
  import * as React from 'react';
3
+ import { type PopupAttrs } from '../popup/popup';
3
4
  import { type SelectHandlerParams } from '../list/list';
4
5
  import { Size } from '../input/input';
5
6
  import { type LabelType } from '../control-label/control-label';
@@ -99,6 +100,7 @@ export interface BaseSelectProps<T = unknown> {
99
100
  getInitial?: (() => string) | null | undefined;
100
101
  minWidth?: number | undefined;
101
102
  popupClassName?: string | null | undefined;
103
+ popupProps?: Partial<PopupAttrs> | undefined;
102
104
  popupStyle?: CSSProperties | undefined;
103
105
  top?: number | undefined;
104
106
  left?: number | undefined;
@@ -264,7 +266,7 @@ export default class Select<T = unknown> extends Component<SelectProps<T>, Selec
264
266
  private _getAvatar;
265
267
  filter?: HTMLInputElement | null;
266
268
  filterRef: (el: HTMLInputElement | null) => void;
267
- composedFilterRef: import("memoize-one").MemoizedFn<(...refs: (Ref<HTMLInputElement> | undefined)[]) => (value: T_1 | null) => void>;
269
+ composedFilterRef: import("memoize-one").MemoizedFn<(...refs: (Ref<HTMLInputElement> | undefined)[]) => (value: T_1 | null) => () => void>;
268
270
  getShortcutsMap(): {
269
271
  enter: () => true | undefined;
270
272
  esc: (event: KeyboardEvent) => boolean | undefined;
@@ -282,5 +284,7 @@ export default class Select<T = unknown> extends Component<SelectProps<T>, Selec
282
284
  export type SingleSelectAttrs<T = unknown> = React.JSX.LibraryManagedAttributes<typeof Select, SingleSelectProps<T>>;
283
285
  export type MultipleSelectAttrs<T = unknown> = React.JSX.LibraryManagedAttributes<typeof Select, MultipleSelectProps<T>>;
284
286
  export type SelectAttrs<T = unknown> = React.JSX.LibraryManagedAttributes<typeof Select, SelectProps<T>>;
285
- export declare const RerenderableSelect: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<any>>;
287
+ export declare const RerenderableSelect: ({ ref, ...props }: Omit<any, "ref"> & {
288
+ ref?: Ref<any> | undefined;
289
+ }) => React.JSX.Element;
286
290
  export {};
@@ -47,9 +47,7 @@ const getStyle = memoize((iconsLength) => ({
47
47
  }));
48
48
  const isInputMode = (type) => type === Type.INPUT || type === Type.INPUT_WITHOUT_CONTROLS;
49
49
  function getLowerCaseLabel(item) {
50
- if (List.isItemType(List.ListProps.Type.SEPARATOR, item) ||
51
- List.isItemType(List.ListProps.Type.HINT, item) ||
52
- typeof item.label !== 'string') {
50
+ if (List.isItemType(List.ListProps.Type.SEPARATOR, item) || typeof item.label !== 'string') {
53
51
  return null;
54
52
  }
55
53
  return item.label.toLowerCase();
@@ -456,7 +454,7 @@ export default class Select extends Component {
456
454
  else if (!shownData.length) {
457
455
  message = this.props.notFoundMessage ?? translate('noOptionsFound');
458
456
  }
459
- return (<SelectPopup data={_shownData} message={message} toolbar={showPopup && this.getToolbar()} topbar={this.getTopbar()} loading={this.props.loading} activeIndex={activeIndex} hidden={!showPopup} ref={this.popupRef} maxHeight={this.props.maxHeight} minWidth={this.props.minWidth} directions={this.props.directions} className={this.props.popupClassName} style={this.props.popupStyle} top={this.props.top} left={this.props.left} offset={this.props.offset} filter={this.isInputMode() ? false : this.props.filter} // disable popup filter in INPUT mode
457
+ return (<SelectPopup data={_shownData} message={message} toolbar={showPopup && this.getToolbar()} topbar={this.getTopbar()} loading={this.props.loading} activeIndex={activeIndex} hidden={!showPopup} ref={this.popupRef} maxHeight={this.props.maxHeight} minWidth={this.props.minWidth} directions={this.props.directions} popupProps={this.props.popupProps} className={this.props.popupClassName} style={this.props.popupStyle} top={this.props.top} left={this.props.left} offset={this.props.offset} filter={this.isInputMode() ? false : this.props.filter} // disable popup filter in INPUT mode
460
458
  filterIcon={this.props.filterIcon} filterRef={this.props.filterRef} multiple={this.props.multiple} filterValue={this.state.filterValue} anchorElement={anchorElement} onCloseAttempt={this._onCloseAttempt} onOutsideClick={this.props.onOutsideClick} onSelect={this._listSelectHandler} onSelectAll={this._listSelectAllHandler} onFilter={this._filterChangeHandler} onClear={this.clearFilter} onLoadMore={this.props.onLoadMore} isInputMode={this.isInputMode()} selected={this.state.selected} tags={this.props.tags} compact={this.props.compact} renderOptimization={this.props.renderOptimization} ringPopupTarget={this.props.ringPopupTarget} disableMoveOverflow={this.props.disableMoveOverflow} disableScrollToActive={this.props.disableScrollToActive} dir={this.props.dir} onEmptyPopupEnter={this.onEmptyPopupEnter} listId={this.listId} preventListOverscroll={this.props.preventListOverscroll}/>);
461
459
  }}
462
460
  </I18nContext.Consumer>);
@@ -0,0 +1,86 @@
1
+ @import '../global/variables.css';
2
+
3
+ .toolbar {
4
+ display: inline-flex;
5
+ align-items: center;
6
+
7
+ box-sizing: border-box;
8
+ max-width: 100%;
9
+ height: calc(var(--ring-unit) * 5);
10
+ padding: 10px calc(var(--ring-unit) * 2);
11
+
12
+ pointer-events: auto;
13
+
14
+ color: var(--ring-white-text-color);
15
+ border-radius: var(--ring-border-radius-large);
16
+ background-color: var(--ring-sidebar-background-color);
17
+ box-shadow:
18
+ 0 2px 8px rgb(0 28 54 / 10%),
19
+ 0 1px 2px rgb(0 28 54 / 4%);
20
+
21
+ line-height: var(--ring-line-height);
22
+ gap: calc(var(--ring-unit) * 2);
23
+ }
24
+
25
+ .content {
26
+ display: flex;
27
+ align-items: center;
28
+ gap: calc(var(--ring-unit) * 3);
29
+ }
30
+
31
+ .selectAll {
32
+ flex: none;
33
+ }
34
+
35
+ .actions {
36
+ display: flex;
37
+ align-items: center;
38
+ gap: calc(var(--ring-unit) * 2);
39
+
40
+ min-width: 0;
41
+ }
42
+
43
+ .closeAction {
44
+ flex: none;
45
+ }
46
+
47
+ .separator {
48
+ flex: none;
49
+
50
+ width: 1px;
51
+ height: calc(var(--ring-unit) * 2);
52
+ margin-inline: var(--ring-unit);
53
+
54
+ background-color: var(--ring-line-color);
55
+ }
56
+
57
+ .compact {
58
+ min-width: 0;
59
+ max-width: 100%;
60
+ padding-inline: 12px;
61
+ }
62
+
63
+ .compact .content {
64
+ min-width: 0;
65
+ gap: var(--ring-unit);
66
+ }
67
+
68
+ .compact .label {
69
+ overflow: hidden;
70
+
71
+ flex: 1 1 auto;
72
+
73
+ min-width: 0;
74
+
75
+ white-space: nowrap;
76
+
77
+ text-overflow: ellipsis;
78
+ }
79
+
80
+ .compact .actions {
81
+ flex-shrink: 1;
82
+ }
83
+
84
+ .compact .separator {
85
+ margin-inline: 2px;
86
+ }
@@ -0,0 +1,11 @@
1
+ import { type ComponentPropsWithRef, type ReactNode } from 'react';
2
+ export interface SelectionToolbarProps extends ComponentPropsWithRef<'div'> {
3
+ label: ReactNode;
4
+ selectAll?: ReactNode;
5
+ closeAction: ReactNode;
6
+ compact?: boolean;
7
+ 'data-test'?: string | null;
8
+ }
9
+ export declare function SelectionToolbar({ ref, label, selectAll, closeAction, compact, className, children, 'data-test': dataTest, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, ...restProps }: SelectionToolbarProps): import("react").JSX.Element;
10
+ export declare function SelectionToolbarSeparator(): import("react").JSX.Element;
11
+ export default SelectionToolbar;
@@ -0,0 +1,23 @@
1
+ import { useId } from 'react';
2
+ import classNames from 'classnames';
3
+ import dataTests from '../global/data-tests';
4
+ import Theme, { ThemeProvider } from '../global/theme';
5
+ import styles from './selection-toolbar.css';
6
+ export function SelectionToolbar({ ref, label, selectAll, closeAction, compact, className, children, 'data-test': dataTest, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, ...restProps }) {
7
+ const labelId = useId();
8
+ const hasSelectAll = selectAll != null;
9
+ return (<ThemeProvider {...restProps} ref={ref} theme={Theme.DARK} role='group' aria-label={ariaLabel} aria-labelledby={ariaLabelledBy ?? (ariaLabel == null ? labelId : undefined)} data-test={dataTests('ring-selection-toolbar', dataTest)} className={classNames(styles.toolbar, { [styles.compact]: compact }, className)}>
10
+ <div className={styles.content}>
11
+ <span id={labelId} className={styles.label}>
12
+ {label}
13
+ </span>
14
+ {hasSelectAll && <span className={styles.selectAll}>{selectAll}</span>}
15
+ <div className={styles.actions}>{children}</div>
16
+ </div>
17
+ <div className={styles.closeAction}>{closeAction}</div>
18
+ </ThemeProvider>);
19
+ }
20
+ export function SelectionToolbarSeparator() {
21
+ return <span role='separator' aria-orientation='vertical' className={styles.separator}/>;
22
+ }
23
+ export default SelectionToolbar;
@@ -1,11 +1,10 @@
1
- import { Fragment, useEffect, useRef, useState } from 'react';
1
+ import { Fragment, useEffect, useEffectEvent, useRef, useState } from 'react';
2
2
  import * as React from 'react';
3
3
  import classNames from 'classnames';
4
4
  import { isArray } from '../global/typescript-utils';
5
5
  import Shortcuts from '../shortcuts/shortcuts';
6
6
  import getUID from '../global/get-uid';
7
7
  import { adjustValues, calculateMarks, calculateValue, HUNDRED, toPercent, toRange, validateValue } from './slider.utils';
8
- import useEventCallback from '../global/use-event-callback';
9
8
  import styles from './slider.css';
10
9
  export const Slider = ({ defaultValue, value, min = 0, max = HUNDRED, step = 1, disabled, marks, showTicks, showTag, className, renderTag, onChange, }) => {
11
10
  const ref = useRef(null);
@@ -86,7 +85,7 @@ export const Slider = ({ defaultValue, value, min = 0, max = HUNDRED, step = 1,
86
85
  setIsDragging(true);
87
86
  previouslyDragged.current = false;
88
87
  };
89
- const handleMouseUp = useEventCallback(({ pageX }) => {
88
+ const handleMouseUp = useEffectEvent(({ pageX }) => {
90
89
  const nextValues = adjustValues(validValues, ref, draggedIndex, pageX, max, min, validStep);
91
90
  if (nextValues[0] > nextValues[1]) {
92
91
  nextValues.reverse();
@@ -96,7 +95,7 @@ export const Slider = ({ defaultValue, value, min = 0, max = HUNDRED, step = 1,
96
95
  setIsDragging(false);
97
96
  previouslyDragged.current = true;
98
97
  });
99
- const handleMouseMove = useEventCallback(({ pageX }) => {
98
+ const handleMouseMove = useEffectEvent(({ pageX }) => {
100
99
  const nextValues = adjustValues(validValues, ref, draggedIndex, pageX, max, min, validStep);
101
100
  if (nextValues[0] > nextValues[1]) {
102
101
  nextValues.reverse();
@@ -120,7 +119,7 @@ export const Slider = ({ defaultValue, value, min = 0, max = HUNDRED, step = 1,
120
119
  window.removeEventListener('mousemove', handleMouseMove);
121
120
  window.removeEventListener('mouseup', handleMouseUp);
122
121
  };
123
- }, [isDragging, disabled, handleMouseMove, handleMouseUp]);
122
+ }, [isDragging, disabled]);
124
123
  return (<div ref={ref} role='presentation' // contains interactive elements
125
124
  className={classNames(styles.slider, className, {
126
125
  [styles.disabled]: disabled,
@@ -2,6 +2,7 @@ import { type HTMLAttributes, type ReactNode } from 'react';
2
2
  import * as React from 'react';
3
3
  export declare const FOCUSABLE_ELEMENTS = "input, button, select, textarea, a[href], *[tabindex]:not([data-trap-button]):not([data-scrollable-container])";
4
4
  export interface TabTrapProps extends HTMLAttributes<HTMLElement> {
5
+ ref?: React.Ref<TabTrapObject>;
5
6
  children: ReactNode;
6
7
  trapDisabled?: boolean;
7
8
  autoFocusFirst?: boolean;
@@ -11,8 +12,7 @@ export interface TabTrapProps extends HTMLAttributes<HTMLElement> {
11
12
  /**
12
13
  * @name TabTrap
13
14
  */
14
- interface TabTrap {
15
+ export interface TabTrapObject {
15
16
  node: HTMLElement | null;
16
17
  }
17
- declare const TabTrap: React.ForwardRefExoticComponent<TabTrapProps & React.RefAttributes<TabTrap>>;
18
- export default TabTrap;
18
+ export default function TabTrap({ ref, children, trapDisabled, autoFocusFirst, focusBackOnClose, focusBackOnExit, ...restProps }: TabTrapProps): React.JSX.Element;
@@ -1,10 +1,9 @@
1
- import { forwardRef, useCallback, useEffect, useImperativeHandle, useRef, } from 'react';
1
+ import { useCallback, useEffect, useImperativeHandle, useRef } from 'react';
2
2
  import * as React from 'react';
3
3
  import { isNodeInVisiblePartOfPage } from '../global/dom';
4
4
  import styles from './tab-trap.css';
5
5
  export const FOCUSABLE_ELEMENTS = 'input, button, select, textarea, a[href], *[tabindex]:not([data-trap-button]):not([data-scrollable-container])';
6
- // eslint-disable-next-line no-shadow
7
- const TabTrap = forwardRef(function TabTrap({ children, trapDisabled = false, autoFocusFirst = true, focusBackOnClose = true, focusBackOnExit = false, ...restProps }, ref) {
6
+ export default function TabTrap({ ref, children, trapDisabled = false, autoFocusFirst = true, focusBackOnClose = true, focusBackOnExit = false, ...restProps }) {
8
7
  const nodeRef = useRef(null);
9
8
  const trapButtonNodeRef = useRef(null);
10
9
  const previousFocusedNodeRef = useRef(null);
@@ -121,5 +120,4 @@ const TabTrap = forwardRef(function TabTrap({ children, trapDisabled = false, au
121
120
  // eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
122
121
  tabIndex={0} onFocus={restoreFocusOrFocusFirst} data-trap-button/>
123
122
  </div>);
124
- });
125
- export default TabTrap;
123
+ }
@@ -1,25 +1,55 @@
1
- import { type ComponentPropsWithoutRef } from 'react';
1
+ import { type ComponentPropsWithRef } from 'react';
2
2
  export interface DefaultItemRendererProps {
3
3
  /**
4
- * Installed on the `<tr>` element
4
+ * The index of the `data` item to render.
5
5
  */
6
- ref?: React.RefObject<HTMLTableRowElement | null>;
6
+ index: number;
7
7
  /**
8
- * The index of the `data` item to render
8
+ * If `true`, the row will be focusable with up/down arrow keys.
9
+ * Focus is implemented using the
10
+ * ["roving tabindex"](https://developer.mozilla.org/en-US/docs/Web/Accessibility/Guides/Keyboard-navigable_JavaScript_widgets#technique_1_roving_tabindex)
11
+ * technique, that is, only the focused row has `tabIndex={0}`.
9
12
  */
10
- index: number;
13
+ keyboardFocusable?: boolean;
11
14
  /**
12
- * Changes the highlight on hover and applies the pointer cursor.
13
- * Note that `false` doesn't mean it cannot handle `onClick`.
15
+ * Changes the background on hover and applies the pointer cursor.
16
+ * Note that `false` does not mean the row cannot handle `onClick`.
14
17
  */
15
18
  clickable?: boolean;
16
19
  /**
17
- * A level of a nested item. Results in an indent for columns with `indent: true`.
18
- * 0, negative and not set mean no indent.
20
+ * If `true`, the row is highlighted as selected with a different background color.
21
+ */
22
+ selected?: boolean;
23
+ /**
24
+ * The nesting level of an item. Applies an indent for columns with
25
+ * `Column.indent` set to `true`. `0`, negative values, and an unset value
26
+ * mean no indent.
19
27
  */
20
28
  level?: number;
29
+ /**
30
+ * When set to `true`, does not control item virtualization.
31
+ * Useful when you include `DefaultItemRenderer` as a part of a custom row renderer,
32
+ * and track the visibility yourself.
33
+ */
34
+ noItemVirtualization?: boolean;
35
+ /**
36
+ * When set to `true`, does not report the item's boundaries to the reorder system.
37
+ * Useful when you include `DefaultItemRenderer` as a part of a custom row renderer
38
+ * that registers boundaries itself.
39
+ */
40
+ noReorderLayout?: boolean;
21
41
  }
22
42
  /**
23
- * @see TableProps.renderItem
43
+ * Standard component for rendering a table row.
44
+ *
45
+ * Renders an item using the table's column definitions and lets you
46
+ * configure item-scoped behavior such as selection, keyboard navigation,
47
+ * event handlers, `className`, and `ref`.
48
+ *
49
+ * Note that row-level click and keyboard handlers are not discoverable
50
+ * by assistive technologies. Make sure that any functionality relying on
51
+ * them (such as selection or expand/collapse) is also available through
52
+ * accessible controls, such as checkboxes or buttons with accessible
53
+ * labels.
24
54
  */
25
- export declare function DefaultItemRenderer<T>({ ref: userRef, index, clickable, level, className, onKeyDown, onBlur, ...restProps }: DefaultItemRendererProps & ComponentPropsWithoutRef<'tr'>): import("react").JSX.Element;
55
+ export declare function DefaultItemRenderer<T>({ index, keyboardFocusable, clickable, selected, level, noItemVirtualization, noReorderLayout, ref: userRef, className, ...restProps }: DefaultItemRendererProps & ComponentPropsWithRef<'tr'>): import("react").JSX.Element | null;