@jetbrains/ring-ui 8.0.0-beta.5 → 8.0.0-beta.7
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/babel.config.js +0 -8
- package/components/avatar/avatar-info.js +0 -2
- package/components/avatar/avatar-size.d.ts +0 -4
- package/components/avatar/avatar-size.js +0 -4
- package/components/avatar/avatar.js +0 -6
- package/components/avatar/fallback-avatar.js +0 -28
- package/components/avatar-stack/avatar-stack.js +1 -1
- package/components/banner/banner.css +3 -3
- package/components/button/button.css +4 -4
- package/components/button/button.d.ts +0 -4
- package/components/button/button.js +2 -7
- package/components/collapse/collapse-content.d.ts +7 -0
- package/components/collapse/collapse-content.js +41 -6
- package/components/collapse/collapse-context.d.ts +1 -0
- package/components/collapse/collapse-context.js +1 -0
- package/components/collapse/collapse.d.ts +9 -0
- package/components/collapse/collapse.js +2 -1
- package/components/collapsible-group/collapsible-group.css +6 -0
- package/components/collapsible-group/collapsible-group.d.ts +14 -1
- package/components/collapsible-group/collapsible-group.js +4 -3
- package/components/global/variables.css +18 -28
- package/components/global/variables.interface.d.ts +0 -4
- package/components/global/variables_dark.css +18 -25
- package/components/icon/icon.css +0 -27
- package/components/icon/icon.d.ts +0 -1
- package/components/icon/icon.js +2 -4
- package/components/list/consts.d.ts +0 -1
- package/components/list/consts.js +0 -1
- package/components/list/list.d.ts +0 -4
- package/components/select/select.js +1 -3
- package/components/tag/tag.css +3 -3
- package/package.json +3 -6
- package/components/content-layout/content-layout.css +0 -109
- package/components/content-layout/content-layout.d.ts +0 -20
- package/components/content-layout/content-layout.js +0 -40
- package/components/content-layout/sidebar.d.ts +0 -26
- package/components/content-layout/sidebar.js +0 -71
- package/components/expand/collapsible-group.css +0 -72
- package/components/expand/collapsible-group.d.ts +0 -8
- package/components/expand/collapsible-group.js +0 -14
- package/components/grid/col.d.ts +0 -16
- package/components/grid/col.js +0 -35
- package/components/grid/grid.css +0 -920
- package/components/grid/grid.d.ts +0 -13
- package/components/grid/grid.js +0 -19
- package/components/grid/row.d.ts +0 -21
- package/components/grid/row.js +0 -41
- package/components/old-browsers-message/__mocks__/old-browsers-message.js +0 -1
- package/components/old-browsers-message/old-browsers-message-stop.d.ts +0 -1
- package/components/old-browsers-message/old-browsers-message-stop.js +0 -2
- package/components/old-browsers-message/old-browsers-message.css +0 -26
- package/components/old-browsers-message/old-browsers-message.d.ts +0 -5
- package/components/old-browsers-message/old-browsers-message.js +0 -86
- package/components/old-browsers-message/white-list.d.ts +0 -2
- package/components/old-browsers-message/white-list.js +0 -24
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
|
|
|
@@ -12,12 +10,6 @@ module.exports = function config(api) {
|
|
|
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
|
[
|
|
@@ -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 }) {
|
|
@@ -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
|
|
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 }}>
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
background-color: var(--ring-error-container-light-color);
|
|
33
33
|
|
|
34
34
|
.icon {
|
|
35
|
-
color: var(--ring-
|
|
35
|
+
color: var(--ring-icon-error-color);
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
background-color: var(--ring-success-container-light-color);
|
|
42
42
|
|
|
43
43
|
.icon {
|
|
44
|
-
color: var(--ring-
|
|
44
|
+
color: var(--ring-icon-success-color);
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
background-color: var(--ring-warning-container-light-color);
|
|
51
51
|
|
|
52
52
|
.icon {
|
|
53
|
-
color: var(--ring-
|
|
53
|
+
color: var(--ring-icon-warning-color);
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
|
|
@@ -235,12 +235,12 @@
|
|
|
235
235
|
}
|
|
236
236
|
|
|
237
237
|
.primaryBlock {
|
|
238
|
-
--ring-button-default-background-color: var(--ring-
|
|
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-
|
|
241
|
-
--ring-button-active-background-color: var(--ring-
|
|
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-
|
|
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,
|
|
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 ??
|
|
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,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;
|
|
@@ -2,6 +2,7 @@ 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';
|
|
@@ -10,11 +11,14 @@ const DURATION_FACTOR = 0.5;
|
|
|
10
11
|
const DEFAULT_HEIGHT = 0;
|
|
11
12
|
const VISIBLE = 1;
|
|
12
13
|
const HIDDEN = 0;
|
|
14
|
+
// margin for the hide fallback timer, so it fires only if transitionend never did
|
|
15
|
+
const HIDE_FALLBACK_EXTRA_DELAY = 100;
|
|
16
|
+
const isFullyCollapsed = (collapsed, initialContentHeight) => collapsed && initialContentHeight <= DEFAULT_HEIGHT;
|
|
13
17
|
/**
|
|
14
18
|
* @name CollapseContent
|
|
15
19
|
*/
|
|
16
20
|
export const CollapseContent = ({ children, minHeight = DEFAULT_HEIGHT, 'data-test': dataTest, }) => {
|
|
17
|
-
const { collapsed, duration, id, disableAnimation } = use(CollapseContext);
|
|
21
|
+
const { collapsed, duration, id, disableAnimation, keepMounted } = use(CollapseContext);
|
|
18
22
|
const containerRef = useRef(null);
|
|
19
23
|
const contentRef = useRef(null);
|
|
20
24
|
const [initialContentHeight] = useState(minHeight);
|
|
@@ -23,20 +27,41 @@ export const CollapseContent = ({ children, minHeight = DEFAULT_HEIGHT, 'data-te
|
|
|
23
27
|
const height = toPx(nextHeight);
|
|
24
28
|
const [shouldHideContent, setShouldHideContent] = useState(collapsed && minHeight <= DEFAULT_HEIGHT);
|
|
25
29
|
useEffect(() => {
|
|
26
|
-
|
|
30
|
+
const container = containerRef.current;
|
|
31
|
+
function finalizeCollapse() {
|
|
27
32
|
if (initialContentHeight <= DEFAULT_HEIGHT) {
|
|
28
33
|
setShouldHideContent(collapsed);
|
|
29
34
|
}
|
|
30
35
|
}
|
|
31
|
-
|
|
36
|
+
function onTransitionEnd(event) {
|
|
37
|
+
// transitionend bubbles: only the container's own height transition finalizes the collapse
|
|
38
|
+
if (event.target === container && event.propertyName === 'height') {
|
|
39
|
+
finalizeCollapse();
|
|
40
|
+
}
|
|
41
|
+
}
|
|
32
42
|
container?.addEventListener('transitionend', onTransitionEnd);
|
|
43
|
+
// fallback for suppressed or cancelled transitions (e.g. `transition: none` overrides),
|
|
44
|
+
// which emit no transitionend and would otherwise leave the content interactive forever.
|
|
45
|
+
// Armed once per collapse toggle from the --duration committed to the DOM — the value
|
|
46
|
+
// the running transition actually uses — so it can neither undercut a transition started
|
|
47
|
+
// from a stale height nor be restarted by content resizes or duration changes mid-collapse
|
|
48
|
+
const cssDuration = parseCssDuration(container?.style.getPropertyValue('--duration') || '');
|
|
49
|
+
const fallbackTimeout = window.setTimeout(finalizeCollapse, cssDuration + HIDE_FALLBACK_EXTRA_DELAY);
|
|
33
50
|
return () => {
|
|
34
51
|
container?.removeEventListener('transitionend', onTransitionEnd);
|
|
52
|
+
window.clearTimeout(fallbackTimeout);
|
|
35
53
|
};
|
|
36
54
|
}, [collapsed, initialContentHeight]);
|
|
55
|
+
// render-phase state adjustments (not effects): the React Compiler lint forbids
|
|
56
|
+
// setState-in-effect, and https://react.dev/learn/you-might-not-need-an-effect
|
|
57
|
+
// documents this pattern for resetting state when props change
|
|
37
58
|
if (!collapsed && shouldHideContent) {
|
|
38
59
|
setShouldHideContent(false);
|
|
39
60
|
}
|
|
61
|
+
// without a transition there is no transitionend to wait for, so hide immediately
|
|
62
|
+
if (disableAnimation && !shouldHideContent && isFullyCollapsed(collapsed, initialContentHeight)) {
|
|
63
|
+
setShouldHideContent(true);
|
|
64
|
+
}
|
|
40
65
|
useEffect(() => {
|
|
41
66
|
if (contentRef.current) {
|
|
42
67
|
const observer = new ResizeObserver(() => {
|
|
@@ -52,10 +77,20 @@ export const CollapseContent = ({ children, minHeight = DEFAULT_HEIGHT, 'data-te
|
|
|
52
77
|
opacity: collapsed && !minHeight ? HIDDEN : VISIBLE,
|
|
53
78
|
};
|
|
54
79
|
const fadeShouldBeVisible = Boolean(minHeight && collapsed);
|
|
55
|
-
const
|
|
80
|
+
const contentVisible = !shouldHideContent;
|
|
81
|
+
const contentHidden = Boolean(keepMounted) && !contentVisible;
|
|
82
|
+
// interaction is blocked as soon as the panel collapses (matching aria-expanded), while
|
|
83
|
+
// visibility waits for the animation to finish so the content stays painted meanwhile.
|
|
84
|
+
// This includes a minHeight preview: content clipped below it must not take focus,
|
|
85
|
+
// and inert cannot be applied any more granularly than to the whole subtree
|
|
86
|
+
const contentInert = collapsed;
|
|
56
87
|
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}>
|
|
57
|
-
<div ref={contentRef} data-test={dataTests(COLLAPSE_CONTENT_TEST_ID, dataTest)}
|
|
58
|
-
|
|
88
|
+
<div ref={contentRef} data-test={dataTests(COLLAPSE_CONTENT_TEST_ID, dataTest)}
|
|
89
|
+
// visibility: hidden removes the fully collapsed content from the tab order and accessibility
|
|
90
|
+
// tree, but descendants can override it with visibility: visible — inert cannot be escaped.
|
|
91
|
+
// Both are rendered in JSX so server-rendered collapsed markup is protected before hydration.
|
|
92
|
+
style={contentHidden ? { visibility: 'hidden' } : undefined} inert={contentInert}>
|
|
93
|
+
{keepMounted || contentVisible ? children : null}
|
|
59
94
|
</div>
|
|
60
95
|
{fadeShouldBeVisible && <div className={styles.fade}/>}
|
|
61
96
|
</div>);
|
|
@@ -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,7 +5,7 @@ import { BASE_ANIMATION_DURATION } from './consts';
|
|
|
5
5
|
/**
|
|
6
6
|
* @name Collapse
|
|
7
7
|
*/
|
|
8
|
-
export const Collapse = ({ children, duration = BASE_ANIMATION_DURATION, disableAnimation = false, className = '', onChange = () => { }, defaultCollapsed = true, collapsed = null, }) => {
|
|
8
|
+
export const Collapse = ({ children, duration = BASE_ANIMATION_DURATION, disableAnimation = false, keepMounted = false, className = '', onChange = () => { }, defaultCollapsed = true, collapsed = null, }) => {
|
|
9
9
|
const [innerCollapsed, setInnerCollapsed] = useState(defaultCollapsed);
|
|
10
10
|
const id = useId();
|
|
11
11
|
const finalCollapsedValue = collapsed ?? innerCollapsed;
|
|
@@ -19,6 +19,7 @@ export const Collapse = ({ children, duration = BASE_ANIMATION_DURATION, disable
|
|
|
19
19
|
setCollapsed,
|
|
20
20
|
duration,
|
|
21
21
|
disableAnimation,
|
|
22
|
+
keepMounted,
|
|
22
23
|
id,
|
|
23
24
|
}}>
|
|
24
25
|
{children}
|
|
@@ -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;
|
|
@@ -36,7 +36,7 @@ function CollapsibleGroupHeaderStatic({ avatar, titleContent, subtitle }) {
|
|
|
36
36
|
<CollapsibleGroupHeaderContent avatar={avatar} titleContent={titleContent} subtitle={subtitle}/>
|
|
37
37
|
</span>);
|
|
38
38
|
}
|
|
39
|
-
const CollapsibleGroup = ({ ref, avatar, title, subtitle, children, className, defaultExpanded = false, expanded = null, onChange = () => { }, disableAnimation = false, interactive = true, 'data-test': dataTest, }) => {
|
|
39
|
+
const CollapsibleGroup = ({ ref, avatar, title, subtitle, children, className, defaultExpanded = false, expanded = null, onChange = () => { }, disableAnimation = false, interactive = true, keepMounted = false, headingLevel, 'data-test': dataTest, }) => {
|
|
40
40
|
const [innerExpanded, setInnerExpanded] = useState(defaultExpanded);
|
|
41
41
|
const [hovered, setHovered] = useState(false);
|
|
42
42
|
const [focused, setFocused] = useState(false);
|
|
@@ -60,9 +60,10 @@ const CollapsibleGroup = ({ ref, avatar, title, subtitle, children, className, d
|
|
|
60
60
|
[styles.expanded]: isExpanded,
|
|
61
61
|
[styles.focused]: focused,
|
|
62
62
|
});
|
|
63
|
+
const header = interactive ? (<CollapsibleGroupHeader avatar={avatar} titleContent={title} subtitle={subtitle} onMouseEnter={() => setHovered(true)} onMouseLeave={() => setHovered(false)} onFocus={() => setFocused(true)} onBlur={onBlur}/>) : (<CollapsibleGroupHeaderStatic avatar={avatar} titleContent={title} subtitle={subtitle}/>);
|
|
63
64
|
return (<div ref={ref} className={classes} data-test={dataTest}>
|
|
64
|
-
<Collapse defaultCollapsed={!defaultExpanded} collapsed={expanded == null ? null : !expanded} onChange={handleChange} disableAnimation={disableAnimation} className={styles.collapseRoot}>
|
|
65
|
-
{
|
|
65
|
+
<Collapse defaultCollapsed={!defaultExpanded} collapsed={expanded == null ? null : !expanded} onChange={handleChange} disableAnimation={disableAnimation} keepMounted={keepMounted} className={styles.collapseRoot}>
|
|
66
|
+
{headingLevel != null ? React.createElement(`h${headingLevel}`, { className: styles.heading }, header) : header}
|
|
66
67
|
<CollapseContent>
|
|
67
68
|
<div className={styles.body}>{children}</div>
|
|
68
69
|
</CollapseContent>
|
|
@@ -20,8 +20,6 @@
|
|
|
20
20
|
--ring-border-disabled-color: rgb(var(--ring-border-disabled-components)); /* #ebecf0 */
|
|
21
21
|
--ring-border-selected-disabled-components: 201, 204, 214;
|
|
22
22
|
--ring-border-selected-disabled-color: rgb(var(--ring-border-selected-disabled-components)); /* #c9ccd6 */
|
|
23
|
-
--ring-border-disabled-active-components: var(--ring-border-hover-components);
|
|
24
|
-
--ring-border-disabled-active-color: var(--ring-border-hover-color); /* TODO: remove in 8.0 in favor of --ring-border-hover-color */
|
|
25
23
|
--ring-icon-disabled-components: 168, 173, 189;
|
|
26
24
|
--ring-icon-disabled-color: rgb(var(--ring-icon-disabled-components)); /* #A8ADBD */
|
|
27
25
|
--ring-border-hover-components: 160, 189, 248;
|
|
@@ -36,8 +34,6 @@
|
|
|
36
34
|
--ring-icon-hover-color: rgb(var(--ring-icon-hover-components)); /* #5a5d6b */
|
|
37
35
|
--ring-main-components: 51, 105, 214;
|
|
38
36
|
--ring-main-color: rgb(var(--ring-main-components)); /* #3369D6 */
|
|
39
|
-
--ring-action-link-components: var(--ring-link-components);
|
|
40
|
-
--ring-action-link-color: var(--ring-link-color); /* #315FBD */ /* TODO: remove in 8.0 in favor of --ring-link-color */
|
|
41
37
|
--ring-main-hover-components: 49, 95, 189;
|
|
42
38
|
--ring-main-hover-color: rgb(var(--ring-main-hover-components)); /* #315FBD */
|
|
43
39
|
--ring-main-success-components: 31, 128, 57;
|
|
@@ -48,18 +44,18 @@
|
|
|
48
44
|
--ring-main-error-color: rgb(var(--ring-main-error-components)); /* #CC3645 */
|
|
49
45
|
--ring-main-error-hover-components: 188, 48, 62;
|
|
50
46
|
--ring-main-error-hover-color: rgb(var(--ring-main-error-hover-components)); /* #BC303E */
|
|
51
|
-
--ring-main-warning-components:
|
|
52
|
-
--ring-main-warning-color: rgb(var(--ring-main-warning-components)); /* #
|
|
53
|
-
--ring-main-warning-hover-components:
|
|
54
|
-
--ring-main-warning-hover-color: rgb(var(--ring-main-warning-hover-components)); /* #
|
|
47
|
+
--ring-main-warning-components: 255, 175, 15;
|
|
48
|
+
--ring-main-warning-color: rgb(var(--ring-main-warning-components)); /* #FFAF0F */
|
|
49
|
+
--ring-main-warning-hover-components: 223, 147, 3;
|
|
50
|
+
--ring-main-warning-hover-color: rgb(var(--ring-main-warning-hover-components)); /* #DF9303 */
|
|
55
51
|
--ring-main-purple-components: 131, 77, 240;
|
|
56
52
|
--ring-main-purple-color: rgb(var(--ring-main-purple-components)); /* #834DF0 */
|
|
57
53
|
--ring-main-purple-hover-components: 116, 68, 212;
|
|
58
54
|
--ring-main-purple-hover-color: rgb(var(--ring-main-purple-hover-components)); /* #7444D4 */
|
|
59
55
|
--ring-icon-error-components: 204, 54, 69;
|
|
60
56
|
--ring-icon-error-color: rgb(var(--ring-icon-error-components)); /* #CC3645 */
|
|
61
|
-
--ring-icon-warning-components:
|
|
62
|
-
--ring-icon-warning-color: rgb(var(--ring-icon-warning-components)); /* #
|
|
57
|
+
--ring-icon-warning-components: 223, 147, 3;
|
|
58
|
+
--ring-icon-warning-color: rgb(var(--ring-icon-warning-components)); /* #DF9303 */
|
|
63
59
|
--ring-icon-success-components: 32, 138, 60;
|
|
64
60
|
--ring-icon-success-color: rgb(var(--ring-icon-success-components)); /* #208A3C */
|
|
65
61
|
--ring-icon-highlight-components: 255, 175, 15;
|
|
@@ -74,10 +70,10 @@
|
|
|
74
70
|
--ring-error-border-color: rgb(var(--ring-error-border-components)); /* #F2B6BB */
|
|
75
71
|
--ring-error-border-hover-components: 228, 106, 118;
|
|
76
72
|
--ring-error-border-hover-color: rgb(var(--ring-error-border-hover-components)); /* #E46A76 */
|
|
77
|
-
--ring-warning-border-components:
|
|
78
|
-
--ring-warning-border-color: rgb(var(--ring-warning-border-components)); /* #
|
|
79
|
-
--ring-warning-border-hover-components:
|
|
80
|
-
--ring-warning-border-hover-color: rgb(var(--ring-warning-border-hover-components)); /* #
|
|
73
|
+
--ring-warning-border-components: 254, 210, 119;
|
|
74
|
+
--ring-warning-border-color: rgb(var(--ring-warning-border-components)); /* #FED277 */
|
|
75
|
+
--ring-warning-border-hover-components: 253, 189, 61;
|
|
76
|
+
--ring-warning-border-hover-color: rgb(var(--ring-warning-border-hover-components)); /* #FDBD3D */
|
|
81
77
|
--ring-highlight-border-components: 254, 210, 119;
|
|
82
78
|
--ring-highlight-border-color: rgb(var(--ring-highlight-border-components)); /* #FED277 */
|
|
83
79
|
--ring-highlight-border-hover-components: 253, 189, 61;
|
|
@@ -94,8 +90,6 @@
|
|
|
94
90
|
--ring-popup-shadow-color: rgba(var(--ring-popup-border-components), 0.1);
|
|
95
91
|
--ring-popup-secondary-shadow-color: rgba(var(--ring-popup-border-components), 0.04);
|
|
96
92
|
--ring-message-shadow-color: rgba(var(--ring-popup-border-components), 0.3);
|
|
97
|
-
--ring-pinned-shadow-components: 108, 112, 126;
|
|
98
|
-
--ring-pinned-shadow-color: rgb(var(--ring-pinned-shadow-components)); /* #6C707E */ /* TODO remove in 8.0 */
|
|
99
93
|
--ring-button-danger-hover-components: 219, 59, 75;
|
|
100
94
|
--ring-button-danger-hover-color: rgb(var(--ring-button-danger-hover-components)); /* #DB3B4B */
|
|
101
95
|
--ring-button-primary-border-components: 46, 85, 163;
|
|
@@ -108,16 +102,14 @@
|
|
|
108
102
|
/* Text */
|
|
109
103
|
--ring-search-components: 112, 156, 245;
|
|
110
104
|
--ring-search-color: rgb(var(--ring-search-components)); /* #709CF5 */
|
|
111
|
-
--ring-hint-components: 46, 85, 163;
|
|
112
|
-
--ring-hint-color: rgb(var(--ring-hint-components)); /* #2E55A3 */ /* TODO: remove in 8.0 */
|
|
113
105
|
--ring-link-components: 49, 95, 189;
|
|
114
106
|
--ring-link-color: rgb(var(--ring-link-components)); /* #315FBD */
|
|
115
107
|
--ring-link-hover-components: 46, 85, 163;
|
|
116
108
|
--ring-link-hover-color: rgb(var(--ring-link-hover-components)); /* #2E55A3 */
|
|
117
109
|
--ring-error-components: 204, 54, 69;
|
|
118
110
|
--ring-error-color: rgb(var(--ring-error-components)); /* #CC3645 */
|
|
119
|
-
--ring-warning-components:
|
|
120
|
-
--ring-warning-color: rgb(var(--ring-warning-components)); /* #
|
|
111
|
+
--ring-warning-components: 156, 97, 0;
|
|
112
|
+
--ring-warning-color: rgb(var(--ring-warning-components)); /* #9C6100 */ /* Prefer using warning icon + regular text color */
|
|
121
113
|
--ring-success-components: 31, 117, 54;
|
|
122
114
|
--ring-success-color: rgb(var(--ring-success-components)); /* #1F7536 */ /* Prefer using success icon + regular text color */
|
|
123
115
|
--ring-purple-text-components: 131, 77, 240;
|
|
@@ -154,8 +146,8 @@
|
|
|
154
146
|
--ring-tag-hover-background-color: rgb(var(--ring-tag-hover-background-components)); /* #DFE1E5 */
|
|
155
147
|
--ring-removed-background-components: 250, 212, 216;
|
|
156
148
|
--ring-removed-background-color: rgb(var(--ring-removed-background-components)); /* #FAD4D8 */
|
|
157
|
-
--ring-warning-background-components:
|
|
158
|
-
--ring-warning-background-color: rgb(var(--ring-warning-background-components)); /* #
|
|
149
|
+
--ring-warning-background-components: 255, 241, 209;
|
|
150
|
+
--ring-warning-background-color: rgb(var(--ring-warning-background-components)); /* #FFF1D1 */
|
|
159
151
|
--ring-highlight-background-components: 255, 241, 209;
|
|
160
152
|
--ring-highlight-background-color: rgb(var(--ring-highlight-background-components)); /* #FFF1D1 */
|
|
161
153
|
--ring-added-background-components: 197, 229, 204;
|
|
@@ -167,13 +159,11 @@
|
|
|
167
159
|
--ring-disabled-selected-background-components: 235, 236, 240;
|
|
168
160
|
--ring-disabled-selected-background-color: rgb(var(--ring-disabled-selected-background-components)); /* #EBECF0 */
|
|
169
161
|
--ring-button-danger-active-color: var(--ring-error-container-light-color); /* #FAD4D8 */
|
|
170
|
-
--ring-button-loader-background: rgba(var(--ring-white-text-components), 0.4); /* TODO remove in 8.0 */
|
|
171
|
-
--ring-button-primary-background-color: var(--ring-main-color); /* TODO remove in 8.0 */
|
|
172
162
|
--ring-table-loader-background-color: rgba(var(--ring-content-background-components), 0.5); /* #FFFFFF50 */
|
|
173
163
|
--ring-removed-subtle-background-components: 255, 235, 236;
|
|
174
164
|
--ring-removed-subtle-background-color: rgb(var(--ring-removed-subtle-background-components)); /* #FFEBEC */
|
|
175
|
-
--ring-warning-subtle-background-components: 255,
|
|
176
|
-
--ring-warning-subtle-background-color: rgb(var(--ring-warning-subtle-background-components)); /* #
|
|
165
|
+
--ring-warning-subtle-background-components: 255, 246, 222;
|
|
166
|
+
--ring-warning-subtle-background-color: rgb(var(--ring-warning-subtle-background-components)); /* #FFF6DE */
|
|
177
167
|
--ring-highlight-subtle-background-components: 255, 246, 222;
|
|
178
168
|
--ring-highlight-subtle-background-color: rgb(var(--ring-highlight-subtle-background-components)); /* #FFF6DE */
|
|
179
169
|
--ring-added-subtle-background-components: 230, 247, 233;
|
|
@@ -186,8 +176,8 @@
|
|
|
186
176
|
--ring-success-container-light-color: rgb(var(--ring-success-container-light-components)); /* #F2FCF3 */
|
|
187
177
|
--ring-error-container-light-components: 255, 242, 243;
|
|
188
178
|
--ring-error-container-light-color: rgb(var(--ring-error-container-light-components)); /* #FFF2F3 */
|
|
189
|
-
--ring-warning-container-light-components: 255,
|
|
190
|
-
--ring-warning-container-light-color: rgb(var(--ring-warning-container-light-components)); /* #
|
|
179
|
+
--ring-warning-container-light-components: 255, 250, 235;
|
|
180
|
+
--ring-warning-container-light-color: rgb(var(--ring-warning-container-light-components)); /* #FFFAEB */
|
|
191
181
|
--ring-highlight-container-light-components: 255, 250, 235;
|
|
192
182
|
--ring-highlight-container-light-color: rgb(var(--ring-highlight-container-light-components)); /* #FFFAEB */
|
|
193
183
|
--ring-grey-container-light-components: 247, 248, 250;
|
|
@@ -19,11 +19,9 @@ export interface RingCSSProperties {
|
|
|
19
19
|
'--ring-popup-border-color'?: Property.BorderColor;
|
|
20
20
|
'--ring-popup-shadow-color'?: Property.Color;
|
|
21
21
|
'--ring-message-shadow-color'?: Property.Color;
|
|
22
|
-
'--ring-pinned-shadow-color'?: Property.Color;
|
|
23
22
|
'--ring-button-danger-hover-color'?: Property.Color;
|
|
24
23
|
'--ring-button-primary-border-color'?: Property.Color;
|
|
25
24
|
'--ring-search-color'?: Property.Color;
|
|
26
|
-
'--ring-hint-color'?: Property.Color;
|
|
27
25
|
'--ring-link-color'?: Property.Color;
|
|
28
26
|
'--ring-link-hover-color'?: Property.Color;
|
|
29
27
|
'--ring-error-color'?: Property.Color;
|
|
@@ -49,8 +47,6 @@ export interface RingCSSProperties {
|
|
|
49
47
|
'--ring-disabled-background-color'?: Property.BackgroundColor;
|
|
50
48
|
'--ring-disabled-selected-background-color'?: Property.BackgroundColor;
|
|
51
49
|
'--ring-button-danger-active-color'?: Property.BackgroundColor;
|
|
52
|
-
'--ring-button-loader-background'?: Property.BackgroundColor;
|
|
53
|
-
'--ring-button-primary-background-color'?: Property.BackgroundColor;
|
|
54
50
|
'--ring-code-background-color'?: Property.BackgroundColor;
|
|
55
51
|
'--ring-code-color'?: Property.Color;
|
|
56
52
|
'--ring-code-comment-color'?: Property.Color;
|