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

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.
@@ -1,5 +1,12 @@
1
1
  import React, { type PropsWithChildren } from 'react';
2
2
  interface Props {
3
+ /**
4
+ * Height of the always-visible preview of the collapsed content.
5
+ * The collapsed subtree is inert until expanded, matching `aria-expanded`.
6
+ * The preview is only a visual clip of that subtree, so it is inert too and
7
+ * assistive technology will not perceive it — if the preview carries essential
8
+ * information, expose an accessible summary outside the collapsed content.
9
+ */
3
10
  minHeight?: number;
4
11
  className?: string;
5
12
  'data-test'?: string | null | undefined;
@@ -3,6 +3,7 @@ import { use, useRef, useState, useEffect } from 'react';
3
3
  import classNames from 'classnames';
4
4
  import joinDataTestAttributes from '../global/data-tests.js';
5
5
  import { getRect } from '../global/dom.js';
6
+ import { parseCssDuration } from '../global/parse-css-duration.js';
6
7
  import { toPx } from './utils.js';
7
8
  import { CollapseContext } from './collapse-context.js';
8
9
  import { COLLAPSE_CONTENT_CONTAINER_TEST_ID, COLLAPSE_CONTENT_TEST_ID } from './consts.js';
@@ -14,16 +15,19 @@ const DURATION_FACTOR = 0.5;
14
15
  const DEFAULT_HEIGHT = 0;
15
16
  const VISIBLE = 1;
16
17
  const HIDDEN = 0;
18
+ // margin for the hide fallback timer, so it fires only if transitionend never did
19
+ const HIDE_FALLBACK_EXTRA_DELAY = 100;
20
+ const isFullyCollapsed = (collapsed, initialContentHeight) => collapsed && initialContentHeight <= DEFAULT_HEIGHT;
17
21
  /**
18
22
  * @name CollapseContent
19
23
  */
20
24
  const CollapseContent = t0 => {
21
- const $ = c(29);
22
- if ($[0] !== "db13df5cd36e9e8017f88ee099234f4bd4acb2f34d80bfcbd6171247616c949c") {
23
- for (let $i = 0; $i < 29; $i += 1) {
25
+ const $ = c(33);
26
+ if ($[0] !== "e428f8c30c8f8cfdd43da215eea42f35a3b93ebf1af57f7e14bd2e082111ea3f") {
27
+ for (let $i = 0; $i < 33; $i += 1) {
24
28
  $[$i] = Symbol.for("react.memo_cache_sentinel");
25
29
  }
26
- $[0] = "db13df5cd36e9e8017f88ee099234f4bd4acb2f34d80bfcbd6171247616c949c";
30
+ $[0] = "e428f8c30c8f8cfdd43da215eea42f35a3b93ebf1af57f7e14bd2e082111ea3f";
27
31
  }
28
32
  const {
29
33
  children,
@@ -35,7 +39,8 @@ const CollapseContent = t0 => {
35
39
  collapsed,
36
40
  duration,
37
41
  id,
38
- disableAnimation
42
+ disableAnimation,
43
+ keepMounted
39
44
  } = use(CollapseContext);
40
45
  const containerRef = useRef(null);
41
46
  const contentRef = useRef(null);
@@ -56,15 +61,23 @@ const CollapseContent = t0 => {
56
61
  let t4;
57
62
  if ($[3] !== collapsed || $[4] !== initialContentHeight) {
58
63
  t3 = () => {
59
- const onTransitionEnd = function onTransitionEnd() {
64
+ const container = containerRef.current;
65
+ const finalizeCollapse = function finalizeCollapse() {
60
66
  if (initialContentHeight <= DEFAULT_HEIGHT) {
61
67
  setShouldHideContent(collapsed);
62
68
  }
63
69
  };
64
- const container = containerRef.current;
70
+ const onTransitionEnd = function onTransitionEnd(event) {
71
+ if (event.target === container && event.propertyName === "height") {
72
+ finalizeCollapse();
73
+ }
74
+ };
65
75
  container?.addEventListener("transitionend", onTransitionEnd);
76
+ const cssDuration = parseCssDuration(container?.style.getPropertyValue("--duration") || "");
77
+ const fallbackTimeout = window.setTimeout(finalizeCollapse, cssDuration + HIDE_FALLBACK_EXTRA_DELAY);
66
78
  return () => {
67
79
  container?.removeEventListener("transitionend", onTransitionEnd);
80
+ window.clearTimeout(fallbackTimeout);
68
81
  };
69
82
  };
70
83
  t4 = [collapsed, initialContentHeight];
@@ -80,6 +93,9 @@ const CollapseContent = t0 => {
80
93
  if (!collapsed && shouldHideContent) {
81
94
  setShouldHideContent(false);
82
95
  }
96
+ if (disableAnimation && !shouldHideContent && isFullyCollapsed(collapsed, initialContentHeight)) {
97
+ setShouldHideContent(true);
98
+ }
83
99
  let t5;
84
100
  let t6;
85
101
  if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
@@ -118,7 +134,9 @@ const CollapseContent = t0 => {
118
134
  }
119
135
  const style = t9;
120
136
  const fadeShouldBeVisible = Boolean(minHeight && collapsed);
121
- const shouldRenderContent = disableAnimation ? !collapsed : !shouldHideContent;
137
+ const contentVisible = !shouldHideContent;
138
+ const contentHidden = Boolean(keepMounted) && !contentVisible;
139
+ const contentInert = collapsed;
122
140
  const t10 = `collapse-content-${id}`;
123
141
  let t11;
124
142
  if ($[13] === Symbol.for("react.memo_cache_sentinel")) {
@@ -146,50 +164,64 @@ const CollapseContent = t0 => {
146
164
  } else {
147
165
  t14 = $[17];
148
166
  }
149
- const t15 = shouldRenderContent ? children : null;
150
- let t16;
151
- if ($[18] !== t14 || $[19] !== t15) {
152
- t16 = /*#__PURE__*/jsx("div", {
167
+ let t15;
168
+ if ($[18] !== contentHidden) {
169
+ t15 = contentHidden ? {
170
+ visibility: "hidden"
171
+ } : undefined;
172
+ $[18] = contentHidden;
173
+ $[19] = t15;
174
+ } else {
175
+ t15 = $[19];
176
+ }
177
+ const t16 = keepMounted || contentVisible ? children : null;
178
+ let t17;
179
+ if ($[20] !== contentInert || $[21] !== t14 || $[22] !== t15 || $[23] !== t16) {
180
+ t17 = /*#__PURE__*/jsx("div", {
153
181
  ref: contentRef,
154
182
  "data-test": t14,
155
- children: t15
183
+ style: t15,
184
+ inert: contentInert,
185
+ children: t16
156
186
  });
157
- $[18] = t14;
158
- $[19] = t15;
159
- $[20] = t16;
187
+ $[20] = contentInert;
188
+ $[21] = t14;
189
+ $[22] = t15;
190
+ $[23] = t16;
191
+ $[24] = t17;
160
192
  } else {
161
- t16 = $[20];
193
+ t17 = $[24];
162
194
  }
163
- let t17;
164
- if ($[21] !== fadeShouldBeVisible) {
165
- t17 = fadeShouldBeVisible && /*#__PURE__*/jsx("div", {
195
+ let t18;
196
+ if ($[25] !== fadeShouldBeVisible) {
197
+ t18 = fadeShouldBeVisible && /*#__PURE__*/jsx("div", {
166
198
  className: styles.fade
167
199
  });
168
- $[21] = fadeShouldBeVisible;
169
- $[22] = t17;
200
+ $[25] = fadeShouldBeVisible;
201
+ $[26] = t18;
170
202
  } else {
171
- t17 = $[22];
203
+ t18 = $[26];
172
204
  }
173
- let t18;
174
- if ($[23] !== style || $[24] !== t10 || $[25] !== t13 || $[26] !== t16 || $[27] !== t17) {
175
- t18 = /*#__PURE__*/jsxs("div", {
205
+ let t19;
206
+ if ($[27] !== style || $[28] !== t10 || $[29] !== t13 || $[30] !== t17 || $[31] !== t18) {
207
+ t19 = /*#__PURE__*/jsxs("div", {
176
208
  ref: containerRef,
177
209
  id: t10,
178
210
  "data-test": t11,
179
211
  className: t13,
180
212
  style: style,
181
- children: [t16, t17]
213
+ children: [t17, t18]
182
214
  });
183
- $[23] = style;
184
- $[24] = t10;
185
- $[25] = t13;
186
- $[26] = t16;
187
- $[27] = t17;
188
- $[28] = t18;
215
+ $[27] = style;
216
+ $[28] = t10;
217
+ $[29] = t13;
218
+ $[30] = t17;
219
+ $[31] = t18;
220
+ $[32] = t19;
189
221
  } else {
190
- t18 = $[28];
222
+ t19 = $[32];
191
223
  }
192
- return t18;
224
+ return t19;
193
225
  };
194
226
 
195
227
  export { CollapseContent, CollapseContent as default };
@@ -2,6 +2,7 @@ interface CollapseContextInterface {
2
2
  collapsed: boolean;
3
3
  duration: number;
4
4
  disableAnimation: boolean;
5
+ keepMounted?: boolean;
5
6
  setCollapsed: () => void;
6
7
  id: string;
7
8
  }
@@ -5,6 +5,7 @@ const CollapseContext = /*#__PURE__*/createContext({
5
5
  collapsed: true,
6
6
  duration: BASE_ANIMATION_DURATION,
7
7
  disableAnimation: false,
8
+ keepMounted: false,
8
9
  setCollapsed: () => {},
9
10
  id: ''
10
11
  });
@@ -4,6 +4,15 @@ interface Props {
4
4
  onChange?: (collapsed: boolean) => void;
5
5
  duration?: number;
6
6
  disableAnimation?: boolean;
7
+ /**
8
+ * Keep children mounted while collapsed (hidden via `visibility: hidden`
9
+ * and the `inert` attribute) instead of unmounting them, preserving their state.
10
+ * Note: hidden form controls still participate in form validation
11
+ * and submission — disable them while collapsed if needed.
12
+ * Content rendered through portals (e.g. Popup) escapes the hidden
13
+ * wrapper and is not hidden — close overlays on collapse.
14
+ */
15
+ keepMounted?: boolean;
7
16
  className?: string;
8
17
  defaultCollapsed?: boolean;
9
18
  collapsed?: boolean | null;
@@ -5,87 +5,91 @@ import { BASE_ANIMATION_DURATION } from './consts.js';
5
5
  import { jsx } from 'react/jsx-runtime';
6
6
 
7
7
  const Collapse = t0 => {
8
- const $ = c(16);
9
- if ($[0] !== "82eaf77725c22a5c861c79e76fbc1b71c454cd55ea6a0d6b6ce3ecd951f15271") {
10
- for (let $i = 0; $i < 16; $i += 1) {
8
+ const $ = c(17);
9
+ if ($[0] !== "c01294e8c8f1b12e5881d26b9c4bcfc3b1ba5726fff07b53471c113b3a63b1f5") {
10
+ for (let $i = 0; $i < 17; $i += 1) {
11
11
  $[$i] = Symbol.for("react.memo_cache_sentinel");
12
12
  }
13
- $[0] = "82eaf77725c22a5c861c79e76fbc1b71c454cd55ea6a0d6b6ce3ecd951f15271";
13
+ $[0] = "c01294e8c8f1b12e5881d26b9c4bcfc3b1ba5726fff07b53471c113b3a63b1f5";
14
14
  }
15
15
  const {
16
16
  children,
17
17
  duration: t1,
18
18
  disableAnimation: t2,
19
- className: t3,
20
- onChange: t4,
21
- defaultCollapsed: t5,
22
- collapsed: t6
19
+ keepMounted: t3,
20
+ className: t4,
21
+ onChange: t5,
22
+ defaultCollapsed: t6,
23
+ collapsed: t7
23
24
  } = t0;
24
25
  const duration = t1 === undefined ? BASE_ANIMATION_DURATION : t1;
25
26
  const disableAnimation = t2 === undefined ? false : t2;
26
- const className = t3 === undefined ? "" : t3;
27
- const onChange = t4 === undefined ? _temp : t4;
28
- const defaultCollapsed = t5 === undefined ? true : t5;
29
- const collapsed = t6 === undefined ? null : t6;
27
+ const keepMounted = t3 === undefined ? false : t3;
28
+ const className = t4 === undefined ? "" : t4;
29
+ const onChange = t5 === undefined ? _temp : t5;
30
+ const defaultCollapsed = t6 === undefined ? true : t6;
31
+ const collapsed = t7 === undefined ? null : t7;
30
32
  const [innerCollapsed, setInnerCollapsed] = useState(defaultCollapsed);
31
33
  const id = useId();
32
34
  const finalCollapsedValue = collapsed !== null && collapsed !== void 0 ? collapsed : innerCollapsed;
33
- let t7;
35
+ let t8;
34
36
  if ($[1] !== finalCollapsedValue || $[2] !== onChange) {
35
- t7 = () => {
37
+ t8 = () => {
36
38
  setInnerCollapsed(!finalCollapsedValue);
37
39
  onChange(!finalCollapsedValue);
38
40
  };
39
41
  $[1] = finalCollapsedValue;
40
42
  $[2] = onChange;
41
- $[3] = t7;
43
+ $[3] = t8;
42
44
  } else {
43
- t7 = $[3];
45
+ t8 = $[3];
44
46
  }
45
- const setCollapsed = t7;
46
- let t8;
47
- if ($[4] !== disableAnimation || $[5] !== duration || $[6] !== finalCollapsedValue || $[7] !== id || $[8] !== setCollapsed) {
48
- t8 = {
47
+ const setCollapsed = t8;
48
+ let t9;
49
+ if ($[4] !== disableAnimation || $[5] !== duration || $[6] !== finalCollapsedValue || $[7] !== id || $[8] !== keepMounted || $[9] !== setCollapsed) {
50
+ t9 = {
49
51
  collapsed: finalCollapsedValue,
50
52
  setCollapsed,
51
53
  duration,
52
54
  disableAnimation,
55
+ keepMounted,
53
56
  id
54
57
  };
55
58
  $[4] = disableAnimation;
56
59
  $[5] = duration;
57
60
  $[6] = finalCollapsedValue;
58
61
  $[7] = id;
59
- $[8] = setCollapsed;
60
- $[9] = t8;
62
+ $[8] = keepMounted;
63
+ $[9] = setCollapsed;
64
+ $[10] = t9;
61
65
  } else {
62
- t8 = $[9];
66
+ t9 = $[10];
63
67
  }
64
- let t9;
65
- if ($[10] !== children || $[11] !== t8) {
66
- t9 = /*#__PURE__*/jsx(CollapseContext, {
67
- value: t8,
68
+ let t10;
69
+ if ($[11] !== children || $[12] !== t9) {
70
+ t10 = /*#__PURE__*/jsx(CollapseContext, {
71
+ value: t9,
68
72
  children: children
69
73
  });
70
- $[10] = children;
71
- $[11] = t8;
74
+ $[11] = children;
72
75
  $[12] = t9;
76
+ $[13] = t10;
73
77
  } else {
74
- t9 = $[12];
78
+ t10 = $[13];
75
79
  }
76
- let t10;
77
- if ($[13] !== className || $[14] !== t9) {
78
- t10 = /*#__PURE__*/jsx("div", {
80
+ let t11;
81
+ if ($[14] !== className || $[15] !== t10) {
82
+ t11 = /*#__PURE__*/jsx("div", {
79
83
  className: className,
80
- children: t9
84
+ children: t10
81
85
  });
82
- $[13] = className;
83
- $[14] = t9;
86
+ $[14] = className;
84
87
  $[15] = t10;
88
+ $[16] = t11;
85
89
  } else {
86
- t10 = $[15];
90
+ t11 = $[16];
87
91
  }
88
- return t10;
92
+ return t11;
89
93
  };
90
94
  function _temp() {}
91
95
 
@@ -11,10 +11,23 @@ export interface CollapsibleGroupProps {
11
11
  onChange?: (expanded: boolean) => void;
12
12
  disableAnimation?: boolean;
13
13
  interactive?: boolean;
14
+ /**
15
+ * Keep children mounted while collapsed (hidden via `visibility: hidden`
16
+ * and the `inert` attribute) instead of unmounting them, preserving their state.
17
+ * Note: hidden form controls still participate in form validation
18
+ * and submission — disable them while collapsed if needed.
19
+ * Content rendered through portals (e.g. Popup) escapes the hidden
20
+ * wrapper and is not hidden — close overlays on collapse.
21
+ */
22
+ keepMounted?: boolean;
23
+ /**
24
+ * Wraps the header in an <h2>–<h6> to keep the document outline.
25
+ */
26
+ headingLevel?: 2 | 3 | 4 | 5 | 6;
14
27
  'data-test'?: string | null | undefined;
15
28
  }
16
29
  declare const CollapsibleGroup: {
17
- ({ ref, avatar, title, subtitle, children, className, defaultExpanded, expanded, onChange, disableAnimation, interactive, "data-test": dataTest, }: CollapsibleGroupProps): React.JSX.Element;
30
+ ({ ref, avatar, title, subtitle, children, className, defaultExpanded, expanded, onChange, disableAnimation, interactive, keepMounted, headingLevel, "data-test": dataTest, }: CollapsibleGroupProps): React.JSX.Element;
18
31
  displayName: string;
19
32
  };
20
33
  export default CollapsibleGroup;
@@ -1,5 +1,5 @@
1
1
  import { c } from 'react/compiler-runtime';
2
- import { useState, use } from 'react';
2
+ import React__default, { useState, use } from 'react';
3
3
  import classNames from 'classnames';
4
4
  import chevronRightIcon from '@jetbrains/icons/chevron-12px-right';
5
5
  import chevron12pxDown from '@jetbrains/icons/chevron-12px-down';
@@ -15,17 +15,18 @@ import '../global/memoize.js';
15
15
  import '../collapse/consts.js';
16
16
  import '../global/data-tests.js';
17
17
  import '../global/dom.js';
18
+ import '../global/parse-css-duration.js';
18
19
  import '../collapse/utils.js';
19
20
 
20
- var styles = {"expand":"ring-collapsible-group-expand","collapseRoot":"ring-collapsible-group-collapseRoot","hovered":"ring-collapsible-group-hovered","expanded":"ring-collapsible-group-expanded","focused":"ring-collapsible-group-focused","header":"ring-collapsible-group-header","headerButton":"ring-collapsible-group-headerButton","headerStatic":"ring-collapsible-group-headerStatic","headerContent":"ring-collapsible-group-headerContent","avatarGroup":"ring-collapsible-group-avatarGroup","title":"ring-collapsible-group-title","subtitleGroup":"ring-collapsible-group-subtitleGroup","subtitle":"ring-collapsible-group-subtitle","subtitleChevron":"ring-collapsible-group-subtitleChevron","toggle":"ring-collapsible-group-toggle","toggleIcon":"ring-collapsible-group-toggleIcon","body":"ring-collapsible-group-body"};
21
+ var styles = {"expand":"ring-collapsible-group-expand","collapseRoot":"ring-collapsible-group-collapseRoot","hovered":"ring-collapsible-group-hovered","expanded":"ring-collapsible-group-expanded","focused":"ring-collapsible-group-focused","header":"ring-collapsible-group-header","heading":"ring-collapsible-group-heading","headerButton":"ring-collapsible-group-headerButton","headerStatic":"ring-collapsible-group-headerStatic","headerContent":"ring-collapsible-group-headerContent","avatarGroup":"ring-collapsible-group-avatarGroup","title":"ring-collapsible-group-title","subtitleGroup":"ring-collapsible-group-subtitleGroup","subtitle":"ring-collapsible-group-subtitle","subtitleChevron":"ring-collapsible-group-subtitleChevron","toggle":"ring-collapsible-group-toggle","toggleIcon":"ring-collapsible-group-toggleIcon","body":"ring-collapsible-group-body"};
21
22
 
22
23
  function CollapsibleGroupHeaderContent(t0) {
23
24
  const $ = c(16);
24
- if ($[0] !== "0b0104270833ca27f2118e72fd68547a84ef5bf33921c0d276e95941f6f80768") {
25
+ if ($[0] !== "541af245e7b946a00fb862bbdbeef43dd124294e4c71865b955620d61a2591dd") {
25
26
  for (let $i = 0; $i < 16; $i += 1) {
26
27
  $[$i] = Symbol.for("react.memo_cache_sentinel");
27
28
  }
28
- $[0] = "0b0104270833ca27f2118e72fd68547a84ef5bf33921c0d276e95941f6f80768";
29
+ $[0] = "541af245e7b946a00fb862bbdbeef43dd124294e4c71865b955620d61a2591dd";
29
30
  }
30
31
  const {
31
32
  avatar,
@@ -120,11 +121,11 @@ function CollapsibleGroupHeaderContent(t0) {
120
121
  }
121
122
  function CollapsibleGroupHeader(t0) {
122
123
  const $ = c(16);
123
- if ($[0] !== "0b0104270833ca27f2118e72fd68547a84ef5bf33921c0d276e95941f6f80768") {
124
+ if ($[0] !== "541af245e7b946a00fb862bbdbeef43dd124294e4c71865b955620d61a2591dd") {
124
125
  for (let $i = 0; $i < 16; $i += 1) {
125
126
  $[$i] = Symbol.for("react.memo_cache_sentinel");
126
127
  }
127
- $[0] = "0b0104270833ca27f2118e72fd68547a84ef5bf33921c0d276e95941f6f80768";
128
+ $[0] = "541af245e7b946a00fb862bbdbeef43dd124294e4c71865b955620d61a2591dd";
128
129
  }
129
130
  let avatar;
130
131
  let buttonProps;
@@ -193,11 +194,11 @@ function CollapsibleGroupHeader(t0) {
193
194
  }
194
195
  function CollapsibleGroupHeaderStatic(t0) {
195
196
  const $ = c(5);
196
- if ($[0] !== "0b0104270833ca27f2118e72fd68547a84ef5bf33921c0d276e95941f6f80768") {
197
+ if ($[0] !== "541af245e7b946a00fb862bbdbeef43dd124294e4c71865b955620d61a2591dd") {
197
198
  for (let $i = 0; $i < 5; $i += 1) {
198
199
  $[$i] = Symbol.for("react.memo_cache_sentinel");
199
200
  }
200
- $[0] = "0b0104270833ca27f2118e72fd68547a84ef5bf33921c0d276e95941f6f80768";
201
+ $[0] = "541af245e7b946a00fb862bbdbeef43dd124294e4c71865b955620d61a2591dd";
201
202
  }
202
203
  const {
203
204
  avatar,
@@ -224,12 +225,12 @@ function CollapsibleGroupHeaderStatic(t0) {
224
225
  return t1;
225
226
  }
226
227
  const CollapsibleGroup = t0 => {
227
- const $ = c(29);
228
- if ($[0] !== "0b0104270833ca27f2118e72fd68547a84ef5bf33921c0d276e95941f6f80768") {
229
- for (let $i = 0; $i < 29; $i += 1) {
228
+ const $ = c(33);
229
+ if ($[0] !== "541af245e7b946a00fb862bbdbeef43dd124294e4c71865b955620d61a2591dd") {
230
+ for (let $i = 0; $i < 33; $i += 1) {
230
231
  $[$i] = Symbol.for("react.memo_cache_sentinel");
231
232
  }
232
- $[0] = "0b0104270833ca27f2118e72fd68547a84ef5bf33921c0d276e95941f6f80768";
233
+ $[0] = "541af245e7b946a00fb862bbdbeef43dd124294e4c71865b955620d61a2591dd";
233
234
  }
234
235
  const {
235
236
  ref,
@@ -243,6 +244,8 @@ const CollapsibleGroup = t0 => {
243
244
  onChange: t3,
244
245
  disableAnimation: t4,
245
246
  interactive: t5,
247
+ keepMounted: t6,
248
+ headingLevel,
246
249
  "data-test": dataTest
247
250
  } = t0;
248
251
  const defaultExpanded = t1 === undefined ? false : t1;
@@ -250,13 +253,14 @@ const CollapsibleGroup = t0 => {
250
253
  const onChange = t3 === undefined ? _temp : t3;
251
254
  const disableAnimation = t4 === undefined ? false : t4;
252
255
  const interactive = t5 === undefined ? true : t5;
256
+ const keepMounted = t6 === undefined ? false : t6;
253
257
  const [innerExpanded, setInnerExpanded] = useState(defaultExpanded);
254
258
  const [hovered, setHovered] = useState(false);
255
259
  const [focused, setFocused] = useState(false);
256
260
  const isExpanded = expanded !== null && expanded !== void 0 ? expanded : innerExpanded;
257
- let t6;
261
+ let t7;
258
262
  if ($[1] !== expanded || $[2] !== onChange) {
259
- t6 = collapsed => {
263
+ t7 = collapsed => {
260
264
  const nextExpanded = !collapsed;
261
265
  if (expanded == null) {
262
266
  setInnerExpanded(nextExpanded);
@@ -265,28 +269,28 @@ const CollapsibleGroup = t0 => {
265
269
  };
266
270
  $[1] = expanded;
267
271
  $[2] = onChange;
268
- $[3] = t6;
272
+ $[3] = t7;
269
273
  } else {
270
- t6 = $[3];
274
+ t7 = $[3];
271
275
  }
272
- const handleChange = t6;
273
- let t7;
276
+ const handleChange = t7;
277
+ let t8;
274
278
  if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
275
- t7 = event => {
279
+ t8 = event => {
276
280
  const nextTarget = event.relatedTarget;
277
281
  if (nextTarget instanceof Node && event.currentTarget.contains(nextTarget)) {
278
282
  return;
279
283
  }
280
284
  setFocused(false);
281
285
  };
282
- $[4] = t7;
286
+ $[4] = t8;
283
287
  } else {
284
- t7 = $[4];
288
+ t8 = $[4];
285
289
  }
286
- const onBlur = t7;
287
- let t8;
290
+ const onBlur = t8;
291
+ let t9;
288
292
  if ($[5] !== className || $[6] !== focused || $[7] !== hovered || $[8] !== isExpanded) {
289
- t8 = classNames(styles.expand, className, {
293
+ t9 = classNames(styles.expand, className, {
290
294
  [styles.hovered]: hovered,
291
295
  [styles.expanded]: isExpanded,
292
296
  [styles.focused]: focused
@@ -295,16 +299,14 @@ const CollapsibleGroup = t0 => {
295
299
  $[6] = focused;
296
300
  $[7] = hovered;
297
301
  $[8] = isExpanded;
298
- $[9] = t8;
302
+ $[9] = t9;
299
303
  } else {
300
- t8 = $[9];
304
+ t9 = $[9];
301
305
  }
302
- const classes = t8;
303
- const t9 = !defaultExpanded;
304
- const t10 = expanded == null ? null : !expanded;
305
- let t11;
306
+ const classes = t9;
307
+ let t10;
306
308
  if ($[10] !== avatar || $[11] !== interactive || $[12] !== subtitle || $[13] !== title) {
307
- t11 = interactive ? /*#__PURE__*/jsx(CollapsibleGroupHeader, {
309
+ t10 = interactive ? /*#__PURE__*/jsx(CollapsibleGroupHeader, {
308
310
  avatar: avatar,
309
311
  titleContent: title,
310
312
  subtitle: subtitle,
@@ -321,60 +323,76 @@ const CollapsibleGroup = t0 => {
321
323
  $[11] = interactive;
322
324
  $[12] = subtitle;
323
325
  $[13] = title;
324
- $[14] = t11;
326
+ $[14] = t10;
325
327
  } else {
326
- t11 = $[14];
328
+ t10 = $[14];
327
329
  }
328
- let t12;
329
- if ($[15] !== children) {
330
- t12 = /*#__PURE__*/jsx(CollapseContent, {
330
+ const header = t10;
331
+ const t11 = !defaultExpanded;
332
+ const t12 = expanded == null ? null : !expanded;
333
+ let t13;
334
+ if ($[15] !== header || $[16] !== headingLevel) {
335
+ t13 = headingLevel != null ? /*#__PURE__*/React__default.createElement(`h${headingLevel}`, {
336
+ className: styles.heading
337
+ }, header) : header;
338
+ $[15] = header;
339
+ $[16] = headingLevel;
340
+ $[17] = t13;
341
+ } else {
342
+ t13 = $[17];
343
+ }
344
+ let t14;
345
+ if ($[18] !== children) {
346
+ t14 = /*#__PURE__*/jsx(CollapseContent, {
331
347
  children: /*#__PURE__*/jsx("div", {
332
348
  className: styles.body,
333
349
  children: children
334
350
  })
335
351
  });
336
- $[15] = children;
337
- $[16] = t12;
352
+ $[18] = children;
353
+ $[19] = t14;
338
354
  } else {
339
- t12 = $[16];
355
+ t14 = $[19];
340
356
  }
341
- let t13;
342
- if ($[17] !== disableAnimation || $[18] !== handleChange || $[19] !== t10 || $[20] !== t11 || $[21] !== t12 || $[22] !== t9) {
343
- t13 = /*#__PURE__*/jsxs(Collapse, {
344
- defaultCollapsed: t9,
345
- collapsed: t10,
357
+ let t15;
358
+ if ($[20] !== disableAnimation || $[21] !== handleChange || $[22] !== keepMounted || $[23] !== t11 || $[24] !== t12 || $[25] !== t13 || $[26] !== t14) {
359
+ t15 = /*#__PURE__*/jsxs(Collapse, {
360
+ defaultCollapsed: t11,
361
+ collapsed: t12,
346
362
  onChange: handleChange,
347
363
  disableAnimation: disableAnimation,
364
+ keepMounted: keepMounted,
348
365
  className: styles.collapseRoot,
349
- children: [t11, t12]
366
+ children: [t13, t14]
350
367
  });
351
- $[17] = disableAnimation;
352
- $[18] = handleChange;
353
- $[19] = t10;
354
- $[20] = t11;
355
- $[21] = t12;
356
- $[22] = t9;
357
- $[23] = t13;
368
+ $[20] = disableAnimation;
369
+ $[21] = handleChange;
370
+ $[22] = keepMounted;
371
+ $[23] = t11;
372
+ $[24] = t12;
373
+ $[25] = t13;
374
+ $[26] = t14;
375
+ $[27] = t15;
358
376
  } else {
359
- t13 = $[23];
377
+ t15 = $[27];
360
378
  }
361
- let t14;
362
- if ($[24] !== classes || $[25] !== dataTest || $[26] !== ref || $[27] !== t13) {
363
- t14 = /*#__PURE__*/jsx("div", {
379
+ let t16;
380
+ if ($[28] !== classes || $[29] !== dataTest || $[30] !== ref || $[31] !== t15) {
381
+ t16 = /*#__PURE__*/jsx("div", {
364
382
  ref: ref,
365
383
  className: classes,
366
384
  "data-test": dataTest,
367
- children: t13
385
+ children: t15
368
386
  });
369
- $[24] = classes;
370
- $[25] = dataTest;
371
- $[26] = ref;
372
- $[27] = t13;
373
- $[28] = t14;
387
+ $[28] = classes;
388
+ $[29] = dataTest;
389
+ $[30] = ref;
390
+ $[31] = t15;
391
+ $[32] = t16;
374
392
  } else {
375
- t14 = $[28];
393
+ t16 = $[32];
376
394
  }
377
- return t14;
395
+ return t16;
378
396
  };
379
397
  CollapsibleGroup.displayName = 'CollapsibleGroup';
380
398
  function _temp() {}
@@ -16,6 +16,7 @@ import '../collapse/consts.js';
16
16
  import '../collapse/collapse-content.js';
17
17
  import '../global/data-tests.js';
18
18
  import '../global/dom.js';
19
+ import '../global/parse-css-duration.js';
19
20
  import '../collapse/utils.js';
20
21
 
21
22
  const warnDeprecation = deprecate(() => {}, '`CollapsibleGroup` from `@jetbrains/ring-ui/components/expand/collapsible-group` is deprecated and will be removed in Ring UI 8.0. Import it from `@jetbrains/ring-ui/components/collapsible-group/collapsible-group` instead.');