@jetbrains/ring-ui-built 7.0.121 → 7.0.123-beta.0

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.
package/README.md CHANGED
@@ -13,6 +13,10 @@
13
13
 
14
14
  This collection of UI components aims to provide all the necessary building blocks for web-based products built inside JetBrains, as well as third-party plugins developed for JetBrains' products.
15
15
 
16
+ ## Guidance for coding agents
17
+
18
+ The npm packages include [`skills/ring-ui/SKILL.md`](./skills/ring-ui/SKILL.md), which teaches coding agents to consume Ring UI through `@jetbrains/ring-ui-built` when composing complete pages, responsive layouts, forms, themes, and feedback. The same Skill files are published in both npm artifacts.
19
+
16
20
  ## Try now
17
21
  * Try the [codesandbox](https://codesandbox.io/p/sandbox/ring-ui-7-0-demo-z6v6ym), based on `create-react-app` tooling, to see and try the UI components
18
22
  * Check out [list of examples](https://jetbrains.github.io/ring-ui/master/index.html) for each component
@@ -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;
@@ -1,5 +1,5 @@
1
1
  import { c } from 'react-compiler-runtime';
2
- import { useContext, useRef, useState, useEffect } from 'react';
2
+ import React__default, { useContext, 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';
@@ -14,16 +14,26 @@ const DURATION_FACTOR = 0.5;
14
14
  const DEFAULT_HEIGHT = 0;
15
15
  const VISIBLE = 1;
16
16
  const HIDDEN = 0;
17
+ // margin for the hide fallback timer, so it fires only if transitionend never did
18
+ const HIDE_FALLBACK_EXTRA_DELAY = 100;
19
+ // React 18 renders unknown attributes from strings only, while React 19 treats `inert`
20
+ // as a real boolean and removes the attribute when it gets ''
21
+ // TODO drop the React 18 branch in develop-8.0 — Ring UI 8.0 supports React 19 only
22
+ const REACT_MAJOR_WITH_INERT_SUPPORT = 19;
23
+ const getInertAttributeValue = reactMajor => reactMajor >= REACT_MAJOR_WITH_INERT_SUPPORT ? true : '';
24
+ // the cast is confined to the JSX assignment: React 18 actually receives the string form
25
+ const INERT = getInertAttributeValue(Number(React__default.version.split('.')[0]));
26
+ const isFullyCollapsed = (collapsed, initialContentHeight) => collapsed && initialContentHeight <= DEFAULT_HEIGHT;
17
27
  /**
18
28
  * @name CollapseContent
19
29
  */
20
30
  const CollapseContent = t0 => {
21
- const $ = c(29);
22
- if ($[0] !== "f05635de80c1ecb2484d9a8273c8da5ce7d933172be03e8d761443c32d96d937") {
23
- for (let $i = 0; $i < 29; $i += 1) {
31
+ const $ = c(33);
32
+ if ($[0] !== "47b29aa882db3160a9eb92f6edb4f7c80dfcfaaa3f079e25b6f03c957cb3c632") {
33
+ for (let $i = 0; $i < 33; $i += 1) {
24
34
  $[$i] = Symbol.for("react.memo_cache_sentinel");
25
35
  }
26
- $[0] = "f05635de80c1ecb2484d9a8273c8da5ce7d933172be03e8d761443c32d96d937";
36
+ $[0] = "47b29aa882db3160a9eb92f6edb4f7c80dfcfaaa3f079e25b6f03c957cb3c632";
27
37
  }
28
38
  const {
29
39
  children,
@@ -35,7 +45,8 @@ const CollapseContent = t0 => {
35
45
  collapsed,
36
46
  duration,
37
47
  id,
38
- disableAnimation
48
+ disableAnimation,
49
+ keepMounted
39
50
  } = useContext(CollapseContext);
40
51
  const containerRef = useRef(null);
41
52
  const contentRef = useRef(null);
@@ -56,15 +67,23 @@ const CollapseContent = t0 => {
56
67
  let t4;
57
68
  if ($[3] !== collapsed || $[4] !== initialContentHeight) {
58
69
  t3 = () => {
59
- const onTransitionEnd = function onTransitionEnd() {
70
+ const container = containerRef.current;
71
+ const finalizeCollapse = function finalizeCollapse() {
60
72
  if (initialContentHeight <= DEFAULT_HEIGHT) {
61
73
  setShouldHideContent(collapsed);
62
74
  }
63
75
  };
64
- const container = containerRef.current;
76
+ const onTransitionEnd = function onTransitionEnd(event) {
77
+ if (event.target === container && event.propertyName === "height") {
78
+ finalizeCollapse();
79
+ }
80
+ };
65
81
  container?.addEventListener("transitionend", onTransitionEnd);
82
+ const cssDuration = parseFloat(container?.style.getPropertyValue("--duration") || "") || 0;
83
+ const fallbackTimeout = window.setTimeout(finalizeCollapse, cssDuration + HIDE_FALLBACK_EXTRA_DELAY);
66
84
  return () => {
67
85
  container?.removeEventListener("transitionend", onTransitionEnd);
86
+ window.clearTimeout(fallbackTimeout);
68
87
  };
69
88
  };
70
89
  t4 = [collapsed, initialContentHeight];
@@ -80,6 +99,9 @@ const CollapseContent = t0 => {
80
99
  if (!collapsed && shouldHideContent) {
81
100
  setShouldHideContent(false);
82
101
  }
102
+ if (disableAnimation && !shouldHideContent && isFullyCollapsed(collapsed, initialContentHeight)) {
103
+ setShouldHideContent(true);
104
+ }
83
105
  let t5;
84
106
  let t6;
85
107
  if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
@@ -118,7 +140,9 @@ const CollapseContent = t0 => {
118
140
  }
119
141
  const style = t9;
120
142
  const fadeShouldBeVisible = Boolean(minHeight && collapsed);
121
- const shouldRenderContent = disableAnimation ? !collapsed : !shouldHideContent;
143
+ const contentVisible = !shouldHideContent;
144
+ const contentHidden = Boolean(keepMounted) && !contentVisible;
145
+ const contentInert = collapsed;
122
146
  const t10 = `collapse-content-${id}`;
123
147
  let t11;
124
148
  if ($[13] === Symbol.for("react.memo_cache_sentinel")) {
@@ -146,50 +170,65 @@ const CollapseContent = t0 => {
146
170
  } else {
147
171
  t14 = $[17];
148
172
  }
149
- const t15 = shouldRenderContent ? children : null;
150
- let t16;
151
- if ($[18] !== t14 || $[19] !== t15) {
152
- t16 = /*#__PURE__*/jsx("div", {
173
+ let t15;
174
+ if ($[18] !== contentHidden) {
175
+ t15 = contentHidden ? {
176
+ visibility: "hidden"
177
+ } : undefined;
178
+ $[18] = contentHidden;
179
+ $[19] = t15;
180
+ } else {
181
+ t15 = $[19];
182
+ }
183
+ const t16 = contentInert ? INERT : undefined;
184
+ const t17 = keepMounted || contentVisible ? children : null;
185
+ let t18;
186
+ if ($[20] !== t14 || $[21] !== t15 || $[22] !== t16 || $[23] !== t17) {
187
+ t18 = /*#__PURE__*/jsx("div", {
153
188
  ref: contentRef,
154
189
  "data-test": t14,
155
- children: t15
190
+ style: t15,
191
+ inert: t16,
192
+ children: t17
156
193
  });
157
- $[18] = t14;
158
- $[19] = t15;
159
- $[20] = t16;
194
+ $[20] = t14;
195
+ $[21] = t15;
196
+ $[22] = t16;
197
+ $[23] = t17;
198
+ $[24] = t18;
160
199
  } else {
161
- t16 = $[20];
200
+ t18 = $[24];
162
201
  }
163
- let t17;
164
- if ($[21] !== fadeShouldBeVisible) {
165
- t17 = fadeShouldBeVisible && /*#__PURE__*/jsx("div", {
202
+ let t19;
203
+ if ($[25] !== fadeShouldBeVisible) {
204
+ t19 = fadeShouldBeVisible && /*#__PURE__*/jsx("div", {
166
205
  className: styles.fade
167
206
  });
168
- $[21] = fadeShouldBeVisible;
169
- $[22] = t17;
207
+ $[25] = fadeShouldBeVisible;
208
+ $[26] = t19;
170
209
  } else {
171
- t17 = $[22];
210
+ t19 = $[26];
172
211
  }
173
- let t18;
174
- if ($[23] !== style || $[24] !== t10 || $[25] !== t13 || $[26] !== t16 || $[27] !== t17) {
175
- t18 = /*#__PURE__*/jsxs("div", {
212
+ let t20;
213
+ if ($[27] !== style || $[28] !== t10 || $[29] !== t13 || $[30] !== t18 || $[31] !== t19) {
214
+ t20 = /*#__PURE__*/jsxs("div", {
176
215
  ref: containerRef,
177
216
  id: t10,
178
217
  "data-test": t11,
179
218
  className: t13,
180
219
  style: style,
181
- children: [t16, t17]
220
+ children: [t18, t19]
182
221
  });
183
- $[23] = style;
184
- $[24] = t10;
185
- $[25] = t13;
186
- $[26] = t16;
187
- $[27] = t17;
188
- $[28] = t18;
222
+ $[27] = style;
223
+ $[28] = t10;
224
+ $[29] = t13;
225
+ $[30] = t18;
226
+ $[31] = t19;
227
+ $[32] = t20;
189
228
  } else {
190
- t18 = $[28];
229
+ t20 = $[32];
191
230
  }
192
- return t18;
231
+ return t20;
193
232
  };
194
233
 
195
234
  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] !== "4b1bc7149bb2f70cda665f353438e1d305c0392543f5779c6ac7ceb49ca39f10") {
10
- for (let $i = 0; $i < 16; $i += 1) {
8
+ const $ = c(17);
9
+ if ($[0] !== "3330160d096e3f437f4f27543e39ff405e76a4e1f92b7ab6836337ac8d11cb7e") {
10
+ for (let $i = 0; $i < 17; $i += 1) {
11
11
  $[$i] = Symbol.for("react.memo_cache_sentinel");
12
12
  }
13
- $[0] = "4b1bc7149bb2f70cda665f353438e1d305c0392543f5779c6ac7ceb49ca39f10";
13
+ $[0] = "3330160d096e3f437f4f27543e39ff405e76a4e1f92b7ab6836337ac8d11cb7e";
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.Provider, {
67
- value: t8,
68
+ let t10;
69
+ if ($[11] !== children || $[12] !== t9) {
70
+ t10 = /*#__PURE__*/jsx(CollapseContext.Provider, {
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
 
@@ -10,6 +10,19 @@ export interface CollapsibleGroupProps {
10
10
  onChange?: (expanded: boolean) => void;
11
11
  disableAnimation?: boolean;
12
12
  interactive?: boolean;
13
+ /**
14
+ * Keep children mounted while collapsed (hidden via `visibility: hidden`
15
+ * and the `inert` attribute) instead of unmounting them, preserving their state.
16
+ * Note: hidden form controls still participate in form validation
17
+ * and submission — disable them while collapsed if needed.
18
+ * Content rendered through portals (e.g. Popup) escapes the hidden
19
+ * wrapper and is not hidden — close overlays on collapse.
20
+ */
21
+ keepMounted?: boolean;
22
+ /**
23
+ * Wraps the header in an <h2>–<h6> to keep the document outline.
24
+ */
25
+ headingLevel?: 2 | 3 | 4 | 5 | 6;
13
26
  'data-test'?: string | null | undefined;
14
27
  }
15
28
  declare const CollapsibleGroup: React.ForwardRefExoticComponent<CollapsibleGroupProps & React.RefAttributes<HTMLDivElement>>;
@@ -1,5 +1,5 @@
1
1
  import { c } from 'react-compiler-runtime';
2
- import { forwardRef, useState, useContext } from 'react';
2
+ import React__default, { forwardRef, useState, useContext } 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';
@@ -17,15 +17,15 @@ import '../global/data-tests.js';
17
17
  import '../global/dom.js';
18
18
  import '../collapse/utils.js';
19
19
 
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"};
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","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
21
 
22
22
  function CollapsibleGroupHeaderContent(t0) {
23
23
  const $ = c(16);
24
- if ($[0] !== "248ebb691e89143680b26b525c22d5d37f19214f4f7f322680c1c724fd0796c3") {
24
+ if ($[0] !== "cbe0597c73ab62ed991f87044cb9b2d934802c6afcf5a086cbdf67a67a6010fa") {
25
25
  for (let $i = 0; $i < 16; $i += 1) {
26
26
  $[$i] = Symbol.for("react.memo_cache_sentinel");
27
27
  }
28
- $[0] = "248ebb691e89143680b26b525c22d5d37f19214f4f7f322680c1c724fd0796c3";
28
+ $[0] = "cbe0597c73ab62ed991f87044cb9b2d934802c6afcf5a086cbdf67a67a6010fa";
29
29
  }
30
30
  const {
31
31
  avatar,
@@ -120,11 +120,11 @@ function CollapsibleGroupHeaderContent(t0) {
120
120
  }
121
121
  function CollapsibleGroupHeader(t0) {
122
122
  const $ = c(16);
123
- if ($[0] !== "248ebb691e89143680b26b525c22d5d37f19214f4f7f322680c1c724fd0796c3") {
123
+ if ($[0] !== "cbe0597c73ab62ed991f87044cb9b2d934802c6afcf5a086cbdf67a67a6010fa") {
124
124
  for (let $i = 0; $i < 16; $i += 1) {
125
125
  $[$i] = Symbol.for("react.memo_cache_sentinel");
126
126
  }
127
- $[0] = "248ebb691e89143680b26b525c22d5d37f19214f4f7f322680c1c724fd0796c3";
127
+ $[0] = "cbe0597c73ab62ed991f87044cb9b2d934802c6afcf5a086cbdf67a67a6010fa";
128
128
  }
129
129
  let avatar;
130
130
  let buttonProps;
@@ -193,11 +193,11 @@ function CollapsibleGroupHeader(t0) {
193
193
  }
194
194
  function CollapsibleGroupHeaderStatic(t0) {
195
195
  const $ = c(5);
196
- if ($[0] !== "248ebb691e89143680b26b525c22d5d37f19214f4f7f322680c1c724fd0796c3") {
196
+ if ($[0] !== "cbe0597c73ab62ed991f87044cb9b2d934802c6afcf5a086cbdf67a67a6010fa") {
197
197
  for (let $i = 0; $i < 5; $i += 1) {
198
198
  $[$i] = Symbol.for("react.memo_cache_sentinel");
199
199
  }
200
- $[0] = "248ebb691e89143680b26b525c22d5d37f19214f4f7f322680c1c724fd0796c3";
200
+ $[0] = "cbe0597c73ab62ed991f87044cb9b2d934802c6afcf5a086cbdf67a67a6010fa";
201
201
  }
202
202
  const {
203
203
  avatar,
@@ -224,12 +224,12 @@ function CollapsibleGroupHeaderStatic(t0) {
224
224
  return t1;
225
225
  }
226
226
  const CollapsibleGroup = /*#__PURE__*/forwardRef((t0, ref) => {
227
- const $ = c(29);
228
- if ($[0] !== "248ebb691e89143680b26b525c22d5d37f19214f4f7f322680c1c724fd0796c3") {
229
- for (let $i = 0; $i < 29; $i += 1) {
227
+ const $ = c(33);
228
+ if ($[0] !== "cbe0597c73ab62ed991f87044cb9b2d934802c6afcf5a086cbdf67a67a6010fa") {
229
+ for (let $i = 0; $i < 33; $i += 1) {
230
230
  $[$i] = Symbol.for("react.memo_cache_sentinel");
231
231
  }
232
- $[0] = "248ebb691e89143680b26b525c22d5d37f19214f4f7f322680c1c724fd0796c3";
232
+ $[0] = "cbe0597c73ab62ed991f87044cb9b2d934802c6afcf5a086cbdf67a67a6010fa";
233
233
  }
234
234
  const {
235
235
  avatar,
@@ -242,6 +242,8 @@ const CollapsibleGroup = /*#__PURE__*/forwardRef((t0, ref) => {
242
242
  onChange: t3,
243
243
  disableAnimation: t4,
244
244
  interactive: t5,
245
+ keepMounted: t6,
246
+ headingLevel,
245
247
  "data-test": dataTest
246
248
  } = t0;
247
249
  const defaultExpanded = t1 === undefined ? false : t1;
@@ -249,13 +251,14 @@ const CollapsibleGroup = /*#__PURE__*/forwardRef((t0, ref) => {
249
251
  const onChange = t3 === undefined ? _temp : t3;
250
252
  const disableAnimation = t4 === undefined ? false : t4;
251
253
  const interactive = t5 === undefined ? true : t5;
254
+ const keepMounted = t6 === undefined ? false : t6;
252
255
  const [innerExpanded, setInnerExpanded] = useState(defaultExpanded);
253
256
  const [hovered, setHovered] = useState(false);
254
257
  const [focused, setFocused] = useState(false);
255
258
  const isExpanded = expanded !== null && expanded !== void 0 ? expanded : innerExpanded;
256
- let t6;
259
+ let t7;
257
260
  if ($[1] !== expanded || $[2] !== onChange) {
258
- t6 = collapsed => {
261
+ t7 = collapsed => {
259
262
  const nextExpanded = !collapsed;
260
263
  if (expanded == null) {
261
264
  setInnerExpanded(nextExpanded);
@@ -264,28 +267,28 @@ const CollapsibleGroup = /*#__PURE__*/forwardRef((t0, ref) => {
264
267
  };
265
268
  $[1] = expanded;
266
269
  $[2] = onChange;
267
- $[3] = t6;
270
+ $[3] = t7;
268
271
  } else {
269
- t6 = $[3];
272
+ t7 = $[3];
270
273
  }
271
- const handleChange = t6;
272
- let t7;
274
+ const handleChange = t7;
275
+ let t8;
273
276
  if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
274
- t7 = event => {
277
+ t8 = event => {
275
278
  const nextTarget = event.relatedTarget;
276
279
  if (nextTarget instanceof Node && event.currentTarget.contains(nextTarget)) {
277
280
  return;
278
281
  }
279
282
  setFocused(false);
280
283
  };
281
- $[4] = t7;
284
+ $[4] = t8;
282
285
  } else {
283
- t7 = $[4];
286
+ t8 = $[4];
284
287
  }
285
- const onBlur = t7;
286
- let t8;
288
+ const onBlur = t8;
289
+ let t9;
287
290
  if ($[5] !== className || $[6] !== focused || $[7] !== hovered || $[8] !== isExpanded) {
288
- t8 = classNames(styles.expand, className, {
291
+ t9 = classNames(styles.expand, className, {
289
292
  [styles.hovered]: hovered,
290
293
  [styles.expanded]: isExpanded,
291
294
  [styles.focused]: focused
@@ -294,16 +297,14 @@ const CollapsibleGroup = /*#__PURE__*/forwardRef((t0, ref) => {
294
297
  $[6] = focused;
295
298
  $[7] = hovered;
296
299
  $[8] = isExpanded;
297
- $[9] = t8;
300
+ $[9] = t9;
298
301
  } else {
299
- t8 = $[9];
302
+ t9 = $[9];
300
303
  }
301
- const classes = t8;
302
- const t9 = !defaultExpanded;
303
- const t10 = expanded == null ? null : !expanded;
304
- let t11;
304
+ const classes = t9;
305
+ let t10;
305
306
  if ($[10] !== avatar || $[11] !== interactive || $[12] !== subtitle || $[13] !== title) {
306
- t11 = interactive ? /*#__PURE__*/jsx(CollapsibleGroupHeader, {
307
+ t10 = interactive ? /*#__PURE__*/jsx(CollapsibleGroupHeader, {
307
308
  avatar: avatar,
308
309
  titleContent: title,
309
310
  subtitle: subtitle,
@@ -320,60 +321,76 @@ const CollapsibleGroup = /*#__PURE__*/forwardRef((t0, ref) => {
320
321
  $[11] = interactive;
321
322
  $[12] = subtitle;
322
323
  $[13] = title;
323
- $[14] = t11;
324
+ $[14] = t10;
324
325
  } else {
325
- t11 = $[14];
326
+ t10 = $[14];
326
327
  }
327
- let t12;
328
- if ($[15] !== children) {
329
- t12 = /*#__PURE__*/jsx(CollapseContent, {
328
+ const header = t10;
329
+ const t11 = !defaultExpanded;
330
+ const t12 = expanded == null ? null : !expanded;
331
+ let t13;
332
+ if ($[15] !== header || $[16] !== headingLevel) {
333
+ t13 = headingLevel != null ? /*#__PURE__*/React__default.createElement(`h${headingLevel}`, {
334
+ className: styles.heading
335
+ }, header) : header;
336
+ $[15] = header;
337
+ $[16] = headingLevel;
338
+ $[17] = t13;
339
+ } else {
340
+ t13 = $[17];
341
+ }
342
+ let t14;
343
+ if ($[18] !== children) {
344
+ t14 = /*#__PURE__*/jsx(CollapseContent, {
330
345
  children: /*#__PURE__*/jsx("div", {
331
346
  className: styles.body,
332
347
  children: children
333
348
  })
334
349
  });
335
- $[15] = children;
336
- $[16] = t12;
350
+ $[18] = children;
351
+ $[19] = t14;
337
352
  } else {
338
- t12 = $[16];
353
+ t14 = $[19];
339
354
  }
340
- let t13;
341
- if ($[17] !== disableAnimation || $[18] !== handleChange || $[19] !== t10 || $[20] !== t11 || $[21] !== t12 || $[22] !== t9) {
342
- t13 = /*#__PURE__*/jsxs(Collapse, {
343
- defaultCollapsed: t9,
344
- collapsed: t10,
355
+ let t15;
356
+ if ($[20] !== disableAnimation || $[21] !== handleChange || $[22] !== keepMounted || $[23] !== t11 || $[24] !== t12 || $[25] !== t13 || $[26] !== t14) {
357
+ t15 = /*#__PURE__*/jsxs(Collapse, {
358
+ defaultCollapsed: t11,
359
+ collapsed: t12,
345
360
  onChange: handleChange,
346
361
  disableAnimation: disableAnimation,
362
+ keepMounted: keepMounted,
347
363
  className: styles.collapseRoot,
348
- children: [t11, t12]
364
+ children: [t13, t14]
349
365
  });
350
- $[17] = disableAnimation;
351
- $[18] = handleChange;
352
- $[19] = t10;
353
- $[20] = t11;
354
- $[21] = t12;
355
- $[22] = t9;
356
- $[23] = t13;
366
+ $[20] = disableAnimation;
367
+ $[21] = handleChange;
368
+ $[22] = keepMounted;
369
+ $[23] = t11;
370
+ $[24] = t12;
371
+ $[25] = t13;
372
+ $[26] = t14;
373
+ $[27] = t15;
357
374
  } else {
358
- t13 = $[23];
375
+ t15 = $[27];
359
376
  }
360
- let t14;
361
- if ($[24] !== classes || $[25] !== dataTest || $[26] !== ref || $[27] !== t13) {
362
- t14 = /*#__PURE__*/jsx("div", {
377
+ let t16;
378
+ if ($[28] !== classes || $[29] !== dataTest || $[30] !== ref || $[31] !== t15) {
379
+ t16 = /*#__PURE__*/jsx("div", {
363
380
  ref: ref,
364
381
  className: classes,
365
382
  "data-test": dataTest,
366
- children: t13
383
+ children: t15
367
384
  });
368
- $[24] = classes;
369
- $[25] = dataTest;
370
- $[26] = ref;
371
- $[27] = t13;
372
- $[28] = t14;
385
+ $[28] = classes;
386
+ $[29] = dataTest;
387
+ $[30] = ref;
388
+ $[31] = t15;
389
+ $[32] = t16;
373
390
  } else {
374
- t14 = $[28];
391
+ t16 = $[32];
375
392
  }
376
- return t14;
393
+ return t16;
377
394
  });
378
395
  CollapsibleGroup.displayName = 'CollapsibleGroup';
379
396
  function _temp() {}