@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
package/babel.config.js CHANGED
@@ -1,5 +1,3 @@
1
- const browserslist = require('browserslist');
2
-
3
1
  module.exports = function config(api) {
4
2
  api.cache(true);
5
3
 
@@ -8,16 +6,10 @@ module.exports = function config(api) {
8
6
  [
9
7
  'babel-plugin-react-compiler',
10
8
  {
11
- target: '18', // should be the minimal supported version from peerDependencies
9
+ target: '19', // should be the minimal supported version from peerDependencies
12
10
  panicThreshold: 'all_errors',
13
11
  },
14
12
  ],
15
- [
16
- 'babel-plugin-transform-define',
17
- {
18
- SUPPORTED_BROWSERS: browserslist(),
19
- },
20
- ],
21
13
  ],
22
14
  presets: [
23
15
  [
@@ -10,9 +10,9 @@ export const reactRoot = createRoot(containerElement);
10
10
  * Renders AuthDialog into virtual node to skip maintaining container
11
11
  */
12
12
  function renderAuthDialog(props) {
13
- reactRoot.render(<ControlsHeightContext.Provider value={getGlobalControlsHeight()}>
13
+ reactRoot.render(<ControlsHeightContext value={getGlobalControlsHeight()}>
14
14
  <AuthDialog {...props}/>
15
- </ControlsHeightContext.Provider>);
15
+ </ControlsHeightContext>);
16
16
  }
17
17
  export default function showAuthDialog(props = {}) {
18
18
  renderAuthDialog({
@@ -3,13 +3,11 @@ import { Size } from './avatar-size';
3
3
  import styles from './avatar.css';
4
4
  export const fontSizes = {
5
5
  [Size.Size16]: 9,
6
- [Size.Size18]: 9,
7
6
  [Size.Size20]: 9,
8
7
  [Size.Size24]: 11,
9
8
  [Size.Size28]: 12,
10
9
  [Size.Size32]: 14,
11
10
  [Size.Size40]: 16,
12
- [Size.Size48]: 16,
13
11
  [Size.Size56]: 22,
14
12
  };
15
13
  export default function AvatarInfo({ size, children }) {
@@ -3,14 +3,10 @@
3
3
  */
4
4
  export declare enum Size {
5
5
  Size16 = 16,
6
- /** @deprecated */
7
- Size18 = 18,
8
6
  Size20 = 20,
9
7
  Size24 = 24,
10
8
  Size28 = 28,
11
9
  Size32 = 32,
12
10
  Size40 = 40,
13
- /** @deprecated */
14
- Size48 = 48,
15
11
  Size56 = 56
16
12
  }
@@ -4,14 +4,10 @@
4
4
  export var Size;
5
5
  (function (Size) {
6
6
  Size[Size["Size16"] = 16] = "Size16";
7
- /** @deprecated */
8
- Size[Size["Size18"] = 18] = "Size18";
9
7
  Size[Size["Size20"] = 20] = "Size20";
10
8
  Size[Size["Size24"] = 24] = "Size24";
11
9
  Size[Size["Size28"] = 28] = "Size28";
12
10
  Size[Size["Size32"] = 32] = "Size32";
13
11
  Size[Size["Size40"] = 40] = "Size40";
14
- /** @deprecated */
15
- Size[Size["Size48"] = 48] = "Size48";
16
12
  Size[Size["Size56"] = 56] = "Size56";
17
13
  })(Size || (Size = {}));
@@ -1,15 +1,12 @@
1
1
  import { PureComponent } from 'react';
2
2
  import classNames from 'classnames';
3
- import deprecate from 'util-deprecate';
4
3
  import { encodeURL, isDataURI, parseQueryString } from '../global/url';
5
4
  import { getPixelRatio } from '../global/dom';
6
- import memoize from '../global/memoize';
7
5
  import FallbackAvatar from './fallback-avatar';
8
6
  import { Size } from './avatar-size';
9
7
  import AvatarInfo from './avatar-info';
10
8
  import styles from './avatar.css';
11
9
  export { Size };
12
- const warnSize = memoize((size) => deprecate(() => { }, `Avatar: Size${size} is deprecated and will be removed in 8.0. The supported sizes are: Size20, Size24, Size28, Size32, Size40.`));
13
10
  export default class Avatar extends PureComponent {
14
11
  static defaultProps = {
15
12
  dpr: getPixelRatio(),
@@ -28,9 +25,6 @@ export default class Avatar extends PureComponent {
28
25
  };
29
26
  render() {
30
27
  const { size, url, dpr, style, round, subavatar, subavatarSize, username, info, skipParams, ...restProps } = this.props;
31
- if ([Size.Size18, Size.Size48].includes(size)) {
32
- warnSize(size)();
33
- }
34
28
  const sizeString = `${size}px`;
35
29
  const subavatarSizeString = `${subavatarSize}px`;
36
30
  const styleObj = {
@@ -31,12 +31,6 @@ const SizesSquare = {
31
31
  fontSize: '8px',
32
32
  textAnchor: 'middle',
33
33
  },
34
- [Size.Size18]: {
35
- radius: 4,
36
- text: { x: 9, y: 13 },
37
- fontSize: '11px',
38
- textAnchor: 'middle',
39
- },
40
34
  [Size.Size20]: {
41
35
  radius: 4,
42
36
  text: { x: 2, y: 10 },
@@ -69,13 +63,6 @@ const SizesSquare = {
69
63
  letterSpacing: 1,
70
64
  underscore: { x: 5, y: 32, width: 15, height: 2.5 },
71
65
  },
72
- [Size.Size48]: {
73
- radius: 4,
74
- text: { x: 3, y: 21 },
75
- fontSize: '19px',
76
- letterSpacing: 1,
77
- underscore: { x: 5, y: 32, width: 15, height: 2.5 },
78
- },
79
66
  [Size.Size56]: {
80
67
  radius: 4,
81
68
  text: { x: 4, y: 28 },
@@ -92,13 +79,6 @@ const SizesRound = {
92
79
  textAnchor: 'middle',
93
80
  dominantBaseline: 'middle',
94
81
  },
95
- [Size.Size18]: {
96
- radius: 4,
97
- fontSize: '11px',
98
- text: { x: '50%', y: '54%' },
99
- textAnchor: 'middle',
100
- dominantBaseline: 'middle',
101
- },
102
82
  [Size.Size20]: {
103
83
  radius: 4,
104
84
  fontSize: '9px',
@@ -136,14 +116,6 @@ const SizesRound = {
136
116
  textAnchor: 'middle',
137
117
  dominantBaseline: 'middle',
138
118
  },
139
- [Size.Size48]: {
140
- radius: 4,
141
- fontSize: '19px',
142
- letterSpacing: 1,
143
- text: { x: '50%', y: '54%' },
144
- textAnchor: 'middle',
145
- dominantBaseline: 'middle',
146
- },
147
119
  [Size.Size56]: {
148
120
  radius: 4,
149
121
  fontSize: '26px',
@@ -6,7 +6,7 @@ import { fontSizes } from '../avatar/avatar-info';
6
6
  import styles from './avatar-stack.css';
7
7
  export default function AvatarStack({ children, className, size = Size.Size20, extraItems, dropdownMenuProps, ...restProps }) {
8
8
  const [dropdownOpen, setDropdownOpen] = useState(false);
9
- const sizeClass = size !== Size.Size16 && size !== Size.Size18 && size !== Size.Size48 ? styles[`size${size}`] : undefined;
9
+ const sizeClass = size !== Size.Size16 ? styles[`size${size}`] : undefined;
10
10
  return (<div className={classNames(styles.avatarStack, className, sizeClass, {
11
11
  [styles.hovered]: dropdownOpen,
12
12
  })} {...restProps} style={{ height: size, ...restProps.style }}>
@@ -235,12 +235,12 @@
235
235
  }
236
236
 
237
237
  .primaryBlock {
238
- --ring-button-default-background-color: var(--ring-button-primary-background-color);
238
+ --ring-button-default-background-color: var(--ring-main-color);
239
239
  --ring-button-hover-background-color: var(--ring-main-hover-color);
240
- --ring-button-pressed-background-color: var(--ring-button-primary-background-color);
241
- --ring-button-active-background-color: var(--ring-button-primary-background-color);
240
+ --ring-button-pressed-background-color: var(--ring-main-color);
241
+ --ring-button-active-background-color: var(--ring-main-color);
242
242
  --ring-button-active-hover-background-color: var(--ring-main-hover-color);
243
- --ring-button-active-pressed-background-color: var(--ring-button-primary-background-color);
243
+ --ring-button-active-pressed-background-color: var(--ring-main-color);
244
244
  --ring-button-disabled-background-color: var(--ring-border-hover-color);
245
245
  --ring-button-pressed-border-color: var(--ring-button-primary-border-color);
246
246
  --ring-button-active-border-color: var(--ring-button-primary-border-color);
@@ -15,10 +15,6 @@ export interface ButtonBaseProps {
15
15
  secondary?: boolean | null | undefined;
16
16
  ghost?: boolean | null | undefined;
17
17
  short?: boolean | null | undefined;
18
- /**
19
- * @deprecated Use inline instead
20
- */
21
- text?: boolean | null | undefined;
22
18
  inline?: boolean | null | undefined;
23
19
  dropdown?: boolean | null | undefined;
24
20
  disabled?: boolean | undefined;
@@ -3,13 +3,11 @@ import * as React from 'react';
3
3
  import classNames from 'classnames';
4
4
  import chevronDown from '@jetbrains/icons/chevron-down';
5
5
  import chevron12pxDown from '@jetbrains/icons/chevron-12px-down';
6
- import deprecate from 'util-deprecate';
7
6
  import Icon, { Size } from '../icon/icon';
8
7
  import ClickableLink from '../link/clickable-link';
9
8
  import { ControlsHeightContext } from '../global/controls-height';
10
9
  import { getButtonClasses } from './button.classes';
11
10
  import styles from './button.css';
12
- const warnText = deprecate(() => { }, 'Button: "text" prop is deprecated and will be removed in 8.0. Use inline instead.');
13
11
  function removeLinkProps(props) {
14
12
  const { download, href, hrefLang, media, ping, target, type, referrerPolicy, onConditionalClick, onPlainLeftClick, activeClassName, ...restProps } = props;
15
13
  return restProps;
@@ -30,13 +28,10 @@ export class Button extends PureComponent {
30
28
  render() {
31
29
  const {
32
30
  // Modifiers
33
- active, danger, delayed, loader, primary, success, error, secondary, ghost, short, text, dropdown, height,
31
+ active, danger, delayed, loader, primary, success, error, secondary, ghost, short, dropdown, height,
34
32
  // Props
35
33
  icon, iconRight, iconSize, iconClassName, iconRightClassName, iconSuppressSizeWarning, className, children, inline, disabled, ...props } = this.props;
36
- const isInline = inline ?? text ?? !!icon;
37
- if (text) {
38
- warnText();
39
- }
34
+ const isInline = inline ?? !!icon;
40
35
  const classes = getButtonClasses({
41
36
  ...this.props,
42
37
  inline: isInline,
@@ -1,6 +1,6 @@
1
1
  @import '../global/variables.css';
2
2
 
3
- @value button as buttonClass, active as buttonActive, flat from '../button/button.css';
3
+ @value button, active as buttonActive, flat from '../button/button.css';
4
4
 
5
5
  :root,
6
6
  :host {
@@ -37,7 +37,7 @@
37
37
  --ring-button-group-button-border-color: var(--ring-border-disabled-color);
38
38
  }
39
39
 
40
- .buttonGroup .buttonClass {
40
+ .buttonGroup .button {
41
41
  position: relative;
42
42
 
43
43
  transition: none;
@@ -47,7 +47,7 @@
47
47
  0 -1px var(--ring-button-group-button-border-color) inset;
48
48
  }
49
49
 
50
- .buttonGroup .buttonClass[disabled] {
50
+ .buttonGroup .button[disabled] {
51
51
  /* stylelint-disable selector-max-specificity */
52
52
  &::before,
53
53
  &::after {
@@ -75,8 +75,8 @@
75
75
  /* stylelint-enable */
76
76
  }
77
77
 
78
- .buttonGroup > .buttonClass:first-child,
79
- .buttonGroup > :first-child .buttonClass {
78
+ .buttonGroup > .button:first-child,
79
+ .buttonGroup > :first-child .button {
80
80
  box-shadow:
81
81
  0 1px var(--ring-button-group-button-border-color) inset,
82
82
  0 -1px var(--ring-button-group-button-border-color) inset,
@@ -88,8 +88,8 @@
88
88
  }
89
89
  }
90
90
 
91
- .buttonGroup > .buttonClass:last-child,
92
- .buttonGroup > :last-child .buttonClass {
91
+ .buttonGroup > .button:last-child,
92
+ .buttonGroup > :last-child .button {
93
93
  box-shadow:
94
94
  0 1px var(--ring-button-group-button-border-color) inset,
95
95
  0 -1px var(--ring-button-group-button-border-color) inset,
@@ -101,8 +101,8 @@
101
101
  }
102
102
  }
103
103
 
104
- .buttonGroup > .buttonClass:only-child,
105
- .buttonGroup > :only-child .buttonClass {
104
+ .buttonGroup > .button:only-child,
105
+ .buttonGroup > :only-child .button {
106
106
  box-shadow:
107
107
  0 1px var(--ring-button-group-button-border-color) inset,
108
108
  0 -1px var(--ring-button-group-button-border-color) inset,
@@ -116,15 +116,15 @@
116
116
  }
117
117
 
118
118
  /* stylelint-disable selector-max-specificity */
119
- .buttonGroup .buttonClass.buttonClass:hover:not(:disabled),
120
- .buttonGroup .buttonClass.buttonClass:active:not(:disabled) {
119
+ .buttonGroup .button.button:hover:not(:disabled),
120
+ .buttonGroup .button.button:active:not(:disabled) {
121
121
  --ring-button-border-radius-left: var(--ring-border-radius);
122
122
  --ring-button-border-radius-right: var(--ring-border-radius);
123
123
 
124
124
  box-shadow: var(--ring-button-shadow) var(--ring-button-border-color);
125
125
  }
126
126
 
127
- .buttonGroup .buttonClass.buttonClass:focus-visible {
127
+ .buttonGroup .button.button:focus-visible {
128
128
  --ring-button-border-radius-left: var(--ring-border-radius);
129
129
  --ring-button-border-radius-right: var(--ring-border-radius);
130
130
 
@@ -133,14 +133,14 @@
133
133
  0 0 0 1px var(--ring-border-hover-color);
134
134
  }
135
135
 
136
- .buttonGroup .buttonClass.buttonClass.buttonActive {
136
+ .buttonGroup .button.button.buttonActive {
137
137
  --ring-button-border-radius-left: var(--ring-border-radius);
138
138
  --ring-button-border-radius-right: var(--ring-border-radius);
139
139
 
140
140
  box-shadow: var(--ring-button-shadow) var(--ring-button-border-color);
141
141
  }
142
142
 
143
- .buttonGroup .buttonClass:focus-visible.buttonActive {
143
+ .buttonGroup .button:focus-visible.buttonActive {
144
144
  --ring-button-border-radius-left: var(--ring-border-radius);
145
145
  --ring-button-border-radius-right: var(--ring-border-radius);
146
146
 
@@ -149,7 +149,7 @@
149
149
  0 0 0 1px var(--ring-border-hover-color);
150
150
  }
151
151
 
152
- .buttonGroup .buttonClass.buttonActive[disabled] {
152
+ .buttonGroup .button.buttonActive[disabled] {
153
153
  box-shadow: var(--ring-button-shadow) var(--ring-border-hover-color);
154
154
  }
155
155
  /* stylelint-enable */
@@ -159,17 +159,17 @@
159
159
  composes: buttonGroup from '../button-toolbar/button-toolbar.css';
160
160
  }
161
161
 
162
- .common button:not(:where(.buttonClass)) {
162
+ .common button {
163
163
  border-radius: 0;
164
164
  }
165
165
 
166
- .common .buttonClass {
166
+ .common .button {
167
167
  --ring-button-border-radius-left: 0;
168
168
  --ring-button-border-radius-right: 0;
169
169
  }
170
170
 
171
171
  .split button,
172
- .split .buttonClass {
172
+ .split .button {
173
173
  margin: 0 0 0 -1px;
174
174
  }
175
175
 
@@ -192,8 +192,8 @@
192
192
  border-bottom-left-radius: var(--ring-border-radius);
193
193
  }
194
194
 
195
- .common > .buttonClass:first-child,
196
- .common > :first-child .buttonClass {
195
+ .common > .button:first-child,
196
+ .common > :first-child .button {
197
197
  --ring-button-border-radius-left: var(--ring-border-radius);
198
198
 
199
199
  margin: 0;
@@ -204,8 +204,8 @@
204
204
  border-bottom-right-radius: var(--ring-border-radius);
205
205
  }
206
206
 
207
- .common > .buttonClass:last-child,
208
- .common > :last-child .buttonClass {
207
+ .common > .button:last-child,
208
+ .common > :last-child .button {
209
209
  --ring-button-border-radius-right: var(--ring-border-radius);
210
210
  }
211
211
 
@@ -218,7 +218,7 @@
218
218
  }
219
219
 
220
220
  .common {
221
- & .buttonClass {
221
+ & .button {
222
222
  position: relative;
223
223
  z-index: var(--ring-button-group-default-z-index);
224
224
 
@@ -1,6 +1,6 @@
1
1
  @import '../global/variables.css';
2
2
 
3
- @value button as buttonClass from '../button/button.css';
3
+ @value button from '../button/button.css';
4
4
 
5
5
  .buttonToolbar {
6
6
  display: inline-block;
@@ -13,7 +13,7 @@
13
13
 
14
14
  .buttonToolbar > button,
15
15
  .buttonToolbar > :global(.ring-button-group),
16
- .buttonToolbar > .buttonClass,
16
+ .buttonToolbar > .button,
17
17
  .buttonToolbar > .buttonGroup,
18
18
  .buttonToolbar > .split,
19
19
  .buttonToolbar > .buttonToolbar {
@@ -24,6 +24,6 @@ export default class Checkbox extends PureComponent<CheckboxProps> {
24
24
  componentDidUpdate(prevProps: CheckboxProps): void;
25
25
  input?: HTMLInputElement | null;
26
26
  inputRef: (el: HTMLInputElement | null) => void;
27
- composedInputRef: import("memoize-one").MemoizedFn<(...refs: (Ref<HTMLInputElement> | undefined)[]) => (value: T | null) => void>;
27
+ composedInputRef: import("memoize-one").MemoizedFn<(...refs: (Ref<HTMLInputElement> | undefined)[]) => (value: T | null) => () => void>;
28
28
  render(): import("react").JSX.Element;
29
29
  }
@@ -1,30 +1,23 @@
1
- import React, { useState, useEffect, useRef, useContext } from 'react';
1
+ import React, { useState, useEffect, useRef, use } from 'react';
2
2
  import classNames from 'classnames';
3
3
  import dataTests from '../global/data-tests';
4
4
  import { getRect } from '../global/dom';
5
+ import { parseCssDuration } from '../global/parse-css-duration';
5
6
  import { toPx } from './utils';
6
7
  import CollapseContext from './collapse-context';
7
8
  import { COLLAPSE_CONTENT_TEST_ID, COLLAPSE_CONTENT_CONTAINER_TEST_ID } from './consts';
8
9
  import styles from './collapse.css';
9
- const DURATION_FACTOR = 0.5;
10
10
  const DEFAULT_HEIGHT = 0;
11
11
  const VISIBLE = 1;
12
12
  const HIDDEN = 0;
13
13
  // margin for the hide fallback timer, so it fires only if transitionend never did
14
14
  const HIDE_FALLBACK_EXTRA_DELAY = 100;
15
- // React 18 renders unknown attributes from strings only, while React 19 treats `inert`
16
- // as a real boolean and removes the attribute when it gets ''
17
- // TODO drop the React 18 branch in develop-8.0 — Ring UI 8.0 supports React 19 only
18
- const REACT_MAJOR_WITH_INERT_SUPPORT = 19;
19
- const getInertAttributeValue = (reactMajor) => reactMajor >= REACT_MAJOR_WITH_INERT_SUPPORT ? true : '';
20
- // the cast is confined to the JSX assignment: React 18 actually receives the string form
21
- const INERT = getInertAttributeValue(Number(React.version.split('.')[0]));
22
15
  const isFullyCollapsed = (collapsed, initialContentHeight) => collapsed && initialContentHeight <= DEFAULT_HEIGHT;
23
16
  /**
24
17
  * @name CollapseContent
25
18
  */
26
19
  export const CollapseContent = ({ children, minHeight = DEFAULT_HEIGHT, 'data-test': dataTest, }) => {
27
- const { collapsed, duration, id, disableAnimation, keepMounted } = useContext(CollapseContext);
20
+ const { collapsed, duration, id, animate, disableAnimation, keepMounted } = use(CollapseContext);
28
21
  const containerRef = useRef(null);
29
22
  const contentRef = useRef(null);
30
23
  const [initialContentHeight] = useState(minHeight);
@@ -51,8 +44,7 @@ export const CollapseContent = ({ children, minHeight = DEFAULT_HEIGHT, 'data-te
51
44
  // Armed once per collapse toggle from the --duration committed to the DOM — the value
52
45
  // the running transition actually uses — so it can neither undercut a transition started
53
46
  // from a stale height nor be restarted by content resizes or duration changes mid-collapse
54
- // TODO merge with global/parse-css-duration when this lands in develop-8.0
55
- const cssDuration = parseFloat(container?.style.getPropertyValue('--duration') || '') || 0;
47
+ const cssDuration = parseCssDuration(container?.style.getPropertyValue('--duration') || '');
56
48
  const fallbackTimeout = window.setTimeout(finalizeCollapse, cssDuration + HIDE_FALLBACK_EXTRA_DELAY);
57
49
  return () => {
58
50
  container?.removeEventListener('transitionend', onTransitionEnd);
@@ -77,9 +69,8 @@ export const CollapseContent = ({ children, minHeight = DEFAULT_HEIGHT, 'data-te
77
69
  observer.observe(contentRef.current);
78
70
  }
79
71
  }, []);
80
- const calculatedDuration = duration + contentHeight * DURATION_FACTOR;
81
72
  const style = {
82
- '--duration': `${calculatedDuration}ms`,
73
+ '--duration': `${duration}ms`,
83
74
  height,
84
75
  opacity: collapsed && !minHeight ? HIDDEN : VISIBLE,
85
76
  };
@@ -91,12 +82,12 @@ export const CollapseContent = ({ children, minHeight = DEFAULT_HEIGHT, 'data-te
91
82
  // This includes a minHeight preview: content clipped below it must not take focus,
92
83
  // and inert cannot be applied any more granularly than to the whole subtree
93
84
  const contentInert = collapsed;
94
- return (<div ref={containerRef} id={`collapse-content-${id}`} data-test={dataTests(COLLAPSE_CONTENT_CONTAINER_TEST_ID)} className={classNames(styles.container, { [styles.transition]: !disableAnimation })} style={style}>
85
+ return (<div ref={containerRef} id={`collapse-content-${id}`} data-test={dataTests(COLLAPSE_CONTENT_CONTAINER_TEST_ID)} className={classNames(styles.container, { [styles.transition]: animate && !disableAnimation })} style={style}>
95
86
  <div ref={contentRef} data-test={dataTests(COLLAPSE_CONTENT_TEST_ID, dataTest)}
96
87
  // visibility: hidden removes the fully collapsed content from the tab order and accessibility
97
88
  // tree, but descendants can override it with visibility: visible — inert cannot be escaped.
98
89
  // Both are rendered in JSX so server-rendered collapsed markup is protected before hydration.
99
- style={contentHidden ? { visibility: 'hidden' } : undefined} inert={contentInert ? INERT : undefined}>
90
+ style={contentHidden ? { visibility: 'hidden' } : undefined} inert={contentInert}>
100
91
  {keepMounted || contentVisible ? children : null}
101
92
  </div>
102
93
  {fadeShouldBeVisible && <div className={styles.fade}/>}
@@ -1,6 +1,7 @@
1
1
  interface CollapseContextInterface {
2
2
  collapsed: boolean;
3
3
  duration: number;
4
+ animate: boolean;
4
5
  disableAnimation: boolean;
5
6
  keepMounted?: boolean;
6
7
  setCollapsed: () => void;
@@ -3,6 +3,7 @@ import { BASE_ANIMATION_DURATION } from './consts';
3
3
  export const CollapseContext = createContext({
4
4
  collapsed: true,
5
5
  duration: BASE_ANIMATION_DURATION,
6
+ animate: false,
6
7
  disableAnimation: false,
7
8
  keepMounted: false,
8
9
  setCollapsed: () => { },
@@ -1,4 +1,4 @@
1
- import { useContext, cloneElement } from 'react';
1
+ import { use, cloneElement } from 'react';
2
2
  import * as React from 'react';
3
3
  import dataTests from '../global/data-tests';
4
4
  import { CollapseContext } from './collapse-context';
@@ -7,7 +7,7 @@ import { COLLAPSE_CONTROL_TEST_ID } from './consts';
7
7
  * @name CollapseControl
8
8
  */
9
9
  export const CollapseControl = ({ children, 'data-test': dataTest }) => {
10
- const { setCollapsed, collapsed, id } = useContext(CollapseContext);
10
+ const { setCollapsed, collapsed, id } = use(CollapseContext);
11
11
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
12
12
  const child = typeof children === 'function' ? children(collapsed) : children;
13
13
  return (<p data-test={dataTests(COLLAPSE_CONTROL_TEST_ID, dataTest)}>
@@ -7,8 +7,14 @@
7
7
 
8
8
  .transition {
9
9
  transition:
10
- height var(--duration) ease-in-out 0s,
11
- opacity var(--duration) ease-in-out 0s;
10
+ height var(--duration) cubic-bezier(0.2, 0, 0, 1) 0s,
11
+ opacity var(--duration) cubic-bezier(0.2, 0, 0, 1) 0s;
12
+ }
13
+
14
+ @media (prefers-reduced-motion: reduce) {
15
+ .transition {
16
+ transition: none;
17
+ }
12
18
  }
13
19
 
14
20
  .summary {
@@ -9,21 +9,29 @@ export const Collapse = ({ children, duration = BASE_ANIMATION_DURATION, disable
9
9
  const [innerCollapsed, setInnerCollapsed] = useState(defaultCollapsed);
10
10
  const id = useId();
11
11
  const finalCollapsedValue = collapsed ?? innerCollapsed;
12
+ const [previousCollapsedValue, setPreviousCollapsedValue] = useState(finalCollapsedValue);
13
+ const [animate, setAnimate] = useState(false);
14
+ if (previousCollapsedValue !== finalCollapsedValue) {
15
+ setPreviousCollapsedValue(finalCollapsedValue);
16
+ setAnimate(true);
17
+ }
12
18
  const setCollapsed = () => {
19
+ setAnimate(true);
13
20
  setInnerCollapsed(!finalCollapsedValue);
14
21
  onChange(!finalCollapsedValue);
15
22
  };
16
23
  return (<div className={className}>
17
- <CollapseContext.Provider value={{
24
+ <CollapseContext value={{
18
25
  collapsed: finalCollapsedValue,
19
26
  setCollapsed,
20
27
  duration,
28
+ animate,
21
29
  disableAnimation,
22
30
  keepMounted,
23
31
  id,
24
32
  }}>
25
33
  {children}
26
- </CollapseContext.Provider>
34
+ </CollapseContext>
27
35
  </div>);
28
36
  };
29
37
  export default Collapse;
@@ -25,7 +25,7 @@
25
25
  box-shadow: var(--ring-popup-shadow);
26
26
  }
27
27
 
28
- .focused {
28
+ .expand:has(.headerButton:focus-visible) {
29
29
  box-shadow: 0 0 0 2px var(--ring-border-hover-color), var(--ring-popup-shadow);
30
30
  }
31
31
 
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  export interface CollapsibleGroupProps {
3
+ ref?: React.Ref<HTMLDivElement>;
3
4
  avatar?: React.ReactNode;
4
5
  title: React.ReactNode;
5
6
  subtitle?: React.ReactNode;
@@ -25,5 +26,8 @@ export interface CollapsibleGroupProps {
25
26
  headingLevel?: 2 | 3 | 4 | 5 | 6;
26
27
  'data-test'?: string | null | undefined;
27
28
  }
28
- declare const CollapsibleGroup: React.ForwardRefExoticComponent<CollapsibleGroupProps & React.RefAttributes<HTMLDivElement>>;
29
+ declare const CollapsibleGroup: {
30
+ ({ ref, avatar, title, subtitle, children, className, defaultExpanded, expanded, onChange, disableAnimation, interactive, keepMounted, headingLevel, "data-test": dataTest, }: CollapsibleGroupProps): React.JSX.Element;
31
+ displayName: string;
32
+ };
29
33
  export default CollapsibleGroup;