@rescui/collapse 0.5.7 → 0.5.9
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/lib/_virtual/add-outline.js +8 -9
- package/lib/_virtual/index.css.js +7 -7
- package/lib/_virtual/right.js +8 -9
- package/lib/accordion.js +35 -60
- package/lib/collapse.js +77 -109
- package/lib/collapse.p.module.css.js +32 -32
- package/lib/context.js +1 -1
- package/lib/index.css +73 -122
- package/lib/use-collapse-state.js +17 -29
- package/package.json +8 -9
|
@@ -1,22 +1,21 @@
|
|
|
1
1
|
import _extends from '@babel/runtime-corejs3/helpers/esm/extends';
|
|
2
|
-
import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/esm/objectWithoutProperties';
|
|
3
2
|
import React from 'react';
|
|
4
3
|
import PropTypes from 'prop-types';
|
|
5
4
|
import cn from 'classnames';
|
|
6
5
|
import styles from './index.css.js';
|
|
7
|
-
|
|
8
|
-
var sizeStyles = {
|
|
6
|
+
const sizeStyles = {
|
|
9
7
|
"xs": styles.sizeXS,
|
|
10
8
|
"s": styles.sizeS,
|
|
11
9
|
"m": styles.sizeM,
|
|
12
10
|
"l": styles.sizeL
|
|
13
11
|
};
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
12
|
+
const AddOutlineIcon = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
13
|
+
let {
|
|
14
|
+
theme,
|
|
15
|
+
size,
|
|
16
|
+
className,
|
|
17
|
+
...props
|
|
18
|
+
} = _ref;
|
|
20
19
|
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
21
20
|
viewBox: "0 0 24 24"
|
|
22
21
|
}, props, {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
var styles = {
|
|
2
|
-
"icon": "
|
|
3
|
-
"sizeXS": "
|
|
4
|
-
"sizeS": "
|
|
5
|
-
"sizeM": "
|
|
6
|
-
"sizeL": "
|
|
7
|
-
"light": "
|
|
8
|
-
"dark": "
|
|
2
|
+
"icon": "_icon_ons1cf_4",
|
|
3
|
+
"sizeXS": "_sizeXS_ons1cf_14",
|
|
4
|
+
"sizeS": "_sizeS_ons1cf_18",
|
|
5
|
+
"sizeM": "_sizeM_ons1cf_22",
|
|
6
|
+
"sizeL": "_sizeL_ons1cf_26",
|
|
7
|
+
"light": "_light_ons1cf_30",
|
|
8
|
+
"dark": "_dark_ons1cf_34"
|
|
9
9
|
};
|
|
10
10
|
export { styles as default };
|
package/lib/_virtual/right.js
CHANGED
|
@@ -1,22 +1,21 @@
|
|
|
1
1
|
import _extends from '@babel/runtime-corejs3/helpers/esm/extends';
|
|
2
|
-
import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/esm/objectWithoutProperties';
|
|
3
2
|
import React from 'react';
|
|
4
3
|
import PropTypes from 'prop-types';
|
|
5
4
|
import cn from 'classnames';
|
|
6
5
|
import styles from './index.css.js';
|
|
7
|
-
|
|
8
|
-
var sizeStyles = {
|
|
6
|
+
const sizeStyles = {
|
|
9
7
|
"xs": styles.sizeXS,
|
|
10
8
|
"s": styles.sizeS,
|
|
11
9
|
"m": styles.sizeM,
|
|
12
10
|
"l": styles.sizeL
|
|
13
11
|
};
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
12
|
+
const RightIcon = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
13
|
+
let {
|
|
14
|
+
theme,
|
|
15
|
+
size,
|
|
16
|
+
className,
|
|
17
|
+
...props
|
|
18
|
+
} = _ref;
|
|
20
19
|
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
21
20
|
viewBox: "0 0 24 24"
|
|
22
21
|
}, props, {
|
package/lib/accordion.js
CHANGED
|
@@ -1,26 +1,10 @@
|
|
|
1
|
-
import "core-js/modules/es.object.to-string.js";
|
|
2
|
-
import "core-js/modules/web.dom-collections.for-each.js";
|
|
3
|
-
import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
|
|
4
|
-
import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols";
|
|
5
|
-
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
|
6
|
-
import _Object$getOwnPropertyDescriptor from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor";
|
|
7
|
-
import _Object$getOwnPropertyDescriptors from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors";
|
|
8
|
-
import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
|
|
9
|
-
import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
|
|
10
|
-
import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
|
|
11
|
-
var _excluded = ["children", "className", "openedClassName", "size", "mode", "icon", "borderBottom", "disableLeftPadding", "gap", "theme", "value", "onChange"];
|
|
12
|
-
|
|
13
|
-
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
14
|
-
|
|
15
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? Object.defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
16
|
-
|
|
17
1
|
import React, { useState } from 'react';
|
|
18
2
|
import cn from 'classnames';
|
|
19
3
|
import PropTypes from 'prop-types';
|
|
20
4
|
import { useThemeWithUndefined, ThemeProvider } from '@rescui/ui-contexts';
|
|
21
5
|
import { collapseContext } from './context.js';
|
|
22
6
|
import styles from './collapse.p.module.css.js';
|
|
23
|
-
|
|
7
|
+
const GAP_STYLES = {
|
|
24
8
|
0: styles.accordionGap0,
|
|
25
9
|
8: styles.accordionGap8,
|
|
26
10
|
12: styles.accordionGap12,
|
|
@@ -28,38 +12,29 @@ var GAP_STYLES = {
|
|
|
28
12
|
24: styles.accordionGap24,
|
|
29
13
|
32: styles.accordionGap32
|
|
30
14
|
};
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
restProps = _objectWithoutProperties(_ref, _excluded);
|
|
52
|
-
|
|
53
|
-
var isControlled = typeof value !== 'undefined';
|
|
54
|
-
var theme = useThemeWithUndefined(themeFromProps);
|
|
55
|
-
|
|
56
|
-
var _useState = useState(isControlled ? value : null),
|
|
57
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
58
|
-
openKey = _useState2[0],
|
|
59
|
-
setActiveKey = _useState2[1];
|
|
15
|
+
const Accordion = /*#__PURE__*/React.forwardRef( // eslint-disable-next-line complexity
|
|
16
|
+
(_ref, ref) => {
|
|
17
|
+
let {
|
|
18
|
+
children,
|
|
19
|
+
className,
|
|
20
|
+
openedClassName,
|
|
21
|
+
size = 'm',
|
|
22
|
+
mode = 'classic',
|
|
23
|
+
icon = 'left-plus',
|
|
24
|
+
borderBottom = false,
|
|
25
|
+
disableLeftPadding = false,
|
|
26
|
+
gap = 0,
|
|
27
|
+
theme: themeFromProps,
|
|
28
|
+
value,
|
|
29
|
+
onChange,
|
|
30
|
+
...restProps
|
|
31
|
+
} = _ref;
|
|
32
|
+
const isControlled = typeof value !== 'undefined';
|
|
33
|
+
const theme = useThemeWithUndefined(themeFromProps);
|
|
34
|
+
const [openKey, setActiveKey] = useState(isControlled ? value : null);
|
|
60
35
|
|
|
61
|
-
|
|
62
|
-
|
|
36
|
+
const toggleActiveKey = key => {
|
|
37
|
+
const activatingKey = key !== openKey ? key : null;
|
|
63
38
|
|
|
64
39
|
if (onChange) {
|
|
65
40
|
onChange(activatingKey);
|
|
@@ -73,23 +48,23 @@ function (_ref, ref) {
|
|
|
73
48
|
openedKey: isControlled ? value : openKey,
|
|
74
49
|
isInAccordion: true,
|
|
75
50
|
isInControlledAccordion: isControlled,
|
|
76
|
-
toggleActiveKey
|
|
77
|
-
setActiveKey
|
|
78
|
-
size
|
|
79
|
-
mode
|
|
80
|
-
icon
|
|
81
|
-
borderBottom
|
|
82
|
-
disableLeftPadding
|
|
83
|
-
openedClassName
|
|
51
|
+
toggleActiveKey,
|
|
52
|
+
setActiveKey,
|
|
53
|
+
size,
|
|
54
|
+
mode,
|
|
55
|
+
icon,
|
|
56
|
+
borderBottom,
|
|
57
|
+
disableLeftPadding,
|
|
58
|
+
openedClassName
|
|
84
59
|
}
|
|
85
60
|
}, /*#__PURE__*/React.createElement(ThemeProvider, {
|
|
86
61
|
theme: theme
|
|
87
|
-
}, /*#__PURE__*/React.createElement("div",
|
|
88
|
-
"data-test": 'accordion'
|
|
89
|
-
|
|
62
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
63
|
+
"data-test": 'accordion',
|
|
64
|
+
...restProps,
|
|
90
65
|
className: cn(styles.accordion, GAP_STYLES[gap], className),
|
|
91
66
|
ref: ref
|
|
92
|
-
}
|
|
67
|
+
}, children)));
|
|
93
68
|
});
|
|
94
69
|
Accordion.displayName = 'Accordion';
|
|
95
70
|
Accordion.propTypes = {
|
package/lib/collapse.js
CHANGED
|
@@ -1,20 +1,3 @@
|
|
|
1
|
-
import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
|
|
2
|
-
import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols";
|
|
3
|
-
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
|
4
|
-
import _Object$getOwnPropertyDescriptor from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor";
|
|
5
|
-
import _Object$getOwnPropertyDescriptors from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors";
|
|
6
|
-
import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
|
|
7
|
-
import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
|
|
8
|
-
import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
|
|
9
|
-
var _excluded = ["children", "className", "openedClassName", "size", "mode", "icon", "borderBottom", "disableLeftPadding", "title", "isDefaultOpened", "theme", "itemKey"];
|
|
10
|
-
|
|
11
|
-
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
12
|
-
|
|
13
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? Object.defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
14
|
-
|
|
15
|
-
import "core-js/modules/es.object.to-string.js";
|
|
16
|
-
import "core-js/modules/es.regexp.to-string.js";
|
|
17
|
-
import "core-js/modules/web.dom-collections.for-each.js";
|
|
18
1
|
import React, { useRef, useContext, useState, useEffect } from 'react';
|
|
19
2
|
import cn from 'classnames';
|
|
20
3
|
import PropTypes from 'prop-types';
|
|
@@ -30,112 +13,97 @@ function getRandId() {
|
|
|
30
13
|
return Math.random().toString(36).substring(7);
|
|
31
14
|
}
|
|
32
15
|
|
|
33
|
-
|
|
16
|
+
const THEME_STYLES = {
|
|
34
17
|
light: styles.themeLight,
|
|
35
18
|
dark: styles.themeDark
|
|
36
19
|
};
|
|
37
|
-
|
|
20
|
+
const SIZE_STYLES = {
|
|
38
21
|
s: styles.sizeS,
|
|
39
22
|
m: styles.sizeM,
|
|
40
23
|
l: styles.sizeL
|
|
41
24
|
};
|
|
42
|
-
|
|
25
|
+
const MODE_STYLES = {
|
|
43
26
|
classic: styles.classic,
|
|
44
27
|
rock: styles.rock,
|
|
45
28
|
clear: styles.clear
|
|
46
29
|
};
|
|
47
|
-
|
|
30
|
+
const ICON_STYLES = {
|
|
48
31
|
'left-plus': styles.iconPlus,
|
|
49
32
|
'right-plus': styles.iconPlus,
|
|
50
33
|
arrow: styles.iconArrow
|
|
51
34
|
};
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
restProps = _objectWithoutProperties(_ref, _excluded);
|
|
70
|
-
|
|
35
|
+
const Collapse = /*#__PURE__*/React.forwardRef( // eslint-disable-next-line complexity
|
|
36
|
+
(_ref, ref) => {
|
|
37
|
+
let {
|
|
38
|
+
children,
|
|
39
|
+
className,
|
|
40
|
+
openedClassName: openedClassnameFromProps,
|
|
41
|
+
size: sizeFromProps,
|
|
42
|
+
mode: modeFromProps,
|
|
43
|
+
icon: iconFromProps,
|
|
44
|
+
borderBottom: borderBottomFromProps,
|
|
45
|
+
disableLeftPadding: disableLeftPaddingFromProps,
|
|
46
|
+
title,
|
|
47
|
+
isDefaultOpened = false,
|
|
48
|
+
theme: themeFromProps,
|
|
49
|
+
itemKey,
|
|
50
|
+
...restProps
|
|
51
|
+
} = _ref;
|
|
71
52
|
// using the trick from https://github.com/Yaska/react-use-id-hook/
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
111
|
-
shouldBeOpenedLocal = _useState4[0],
|
|
112
|
-
setShouldBeOpenedLocal = _useState4[1]; // boolean state. ignores CLOSING and OPENING states
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
var shouldBeOpened = isInAccordion ? openedKey === key : shouldBeOpenedLocal; // add CLOSING and OPENING states.
|
|
116
|
-
|
|
117
|
-
var _useCollapseState = useCollapseState({
|
|
118
|
-
shouldBeOpened: shouldBeOpened,
|
|
53
|
+
const {
|
|
54
|
+
current: key
|
|
55
|
+
} = useRef(itemKey ?? getRandId());
|
|
56
|
+
const theme = useThemeWithUndefined(themeFromProps);
|
|
57
|
+
const {
|
|
58
|
+
openedKey,
|
|
59
|
+
isInAccordion,
|
|
60
|
+
isInControlledAccordion,
|
|
61
|
+
toggleActiveKey,
|
|
62
|
+
setActiveKey,
|
|
63
|
+
size: sizeFromContext,
|
|
64
|
+
mode: modeFromContext,
|
|
65
|
+
icon: iconFromContext,
|
|
66
|
+
borderBottom: borderBottomFromContext,
|
|
67
|
+
disableLeftPadding: disableLeftPaddingFromContext,
|
|
68
|
+
openedClassName: openedClassNameFromContext
|
|
69
|
+
} = useContext(collapseContext);
|
|
70
|
+
const size = sizeFromProps ?? sizeFromContext ?? 'm';
|
|
71
|
+
const mode = modeFromProps ?? modeFromContext ?? 'classic';
|
|
72
|
+
const icon = iconFromProps ?? iconFromContext ?? 'left-plus';
|
|
73
|
+
const borderBottom = borderBottomFromProps ?? borderBottomFromContext ?? false;
|
|
74
|
+
const disableLeftPadding = disableLeftPaddingFromProps ?? disableLeftPaddingFromContext ?? false;
|
|
75
|
+
const openedClassName = openedClassnameFromProps ?? openedClassNameFromContext; // height calculations
|
|
76
|
+
|
|
77
|
+
const resizeRef = useRef(null);
|
|
78
|
+
const [height, setHeight] = useState('initial');
|
|
79
|
+
useResizeObserver(resizeRef, entry => setHeight(entry.target.offsetHeight));
|
|
80
|
+
const isHeightCalculated = height !== 'initial'; // this state is ignored in accordion
|
|
81
|
+
|
|
82
|
+
const [shouldBeOpenedLocal, setShouldBeOpenedLocal] = useState(isDefaultOpened); // boolean state. ignores CLOSING and OPENING states
|
|
83
|
+
|
|
84
|
+
const shouldBeOpened = isInAccordion ? openedKey === key : shouldBeOpenedLocal; // add CLOSING and OPENING states.
|
|
85
|
+
|
|
86
|
+
const {
|
|
87
|
+
onAnimationEnd: handleTransitionEnd,
|
|
88
|
+
state: collapseState
|
|
89
|
+
} = useCollapseState({
|
|
90
|
+
shouldBeOpened,
|
|
119
91
|
// because how css transitions work, we shouldn't use OPENING and CLOSING states while height still calculating
|
|
120
92
|
// it also allows us to skip animation on the first renders
|
|
121
93
|
cancelAnimation: !isHeightCalculated
|
|
122
|
-
})
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
var isRightIcon = icon === 'right-plus';
|
|
136
|
-
var Icon = icon === 'arrow' ? RightIcon : AddOutlineIcon;
|
|
137
|
-
|
|
138
|
-
var toggleOpened = function toggleOpened() {
|
|
94
|
+
});
|
|
95
|
+
const isOpening = collapseState === COLLAPSE_STATES.OPENING;
|
|
96
|
+
const isOpened = collapseState === COLLAPSE_STATES.OPEN;
|
|
97
|
+
const isClosing = collapseState === COLLAPSE_STATES.CLOSING;
|
|
98
|
+
const isClosed = collapseState === COLLAPSE_STATES.CLOSE;
|
|
99
|
+
const {
|
|
100
|
+
isStartedClosing,
|
|
101
|
+
contentRef
|
|
102
|
+
} = useStartedClosing(collapseState);
|
|
103
|
+
const isRightIcon = icon === 'right-plus';
|
|
104
|
+
const Icon = icon === 'arrow' ? RightIcon : AddOutlineIcon;
|
|
105
|
+
|
|
106
|
+
const toggleOpened = () => {
|
|
139
107
|
if (toggleActiveKey) {
|
|
140
108
|
toggleActiveKey(key);
|
|
141
109
|
} // this state update does nothing in accordion
|
|
@@ -144,7 +112,7 @@ function (_ref, ref) {
|
|
|
144
112
|
setShouldBeOpenedLocal(!shouldBeOpened);
|
|
145
113
|
};
|
|
146
114
|
|
|
147
|
-
useEffect(
|
|
115
|
+
useEffect(() => {
|
|
148
116
|
// for uncontrolled accordion, tell it that this collapse is opened by default
|
|
149
117
|
if (isInAccordion && !isInControlledAccordion && isDefaultOpened && setActiveKey) {
|
|
150
118
|
setActiveKey(key);
|
|
@@ -152,13 +120,13 @@ function (_ref, ref) {
|
|
|
152
120
|
}, []);
|
|
153
121
|
return /*#__PURE__*/React.createElement(ThemeProvider, {
|
|
154
122
|
theme: theme
|
|
155
|
-
}, /*#__PURE__*/React.createElement("div",
|
|
156
|
-
"data-test": 'collapse'
|
|
157
|
-
|
|
123
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
124
|
+
"data-test": 'collapse',
|
|
125
|
+
...restProps,
|
|
158
126
|
className: cn(className, styles.main, isOpening && styles.opening, isOpened && styles.opened, isClosing && !isStartedClosing && styles.closingTransition, isClosing && styles.closing, isClosed && styles.closed, !isClosed && openedClassName, SIZE_STYLES[size], MODE_STYLES[mode], ICON_STYLES[icon], borderBottom && styles.hasBorderBottom, disableLeftPadding && styles.disableLeftPadding, isRightIcon ? styles.rightIcon : styles.leftIcon, THEME_STYLES[theme]),
|
|
159
127
|
"data-rs-internal": "collapse__collapse",
|
|
160
128
|
ref: ref
|
|
161
|
-
}
|
|
129
|
+
}, /*#__PURE__*/React.createElement("button", {
|
|
162
130
|
type: "button",
|
|
163
131
|
"data-test": 'collapse__button',
|
|
164
132
|
"data-rs-internal": "collapse__button",
|
|
@@ -1,35 +1,35 @@
|
|
|
1
1
|
var styles = {
|
|
2
|
-
"themeLight": "
|
|
3
|
-
"themeDark": "
|
|
4
|
-
"sizeS": "
|
|
5
|
-
"sizeM": "
|
|
6
|
-
"sizeL": "
|
|
7
|
-
"classic": "
|
|
8
|
-
"rock": "
|
|
9
|
-
"clear": "
|
|
10
|
-
"hasBorderBottom": "
|
|
11
|
-
"leftIcon": "
|
|
12
|
-
"rightIcon": "
|
|
13
|
-
"disableLeftPadding": "
|
|
14
|
-
"main": "
|
|
15
|
-
"opening": "
|
|
16
|
-
"opened": "
|
|
17
|
-
"closing": "
|
|
18
|
-
"title": "
|
|
19
|
-
"content": "
|
|
20
|
-
"closed": "
|
|
21
|
-
"closingTransition": "
|
|
22
|
-
"innerWrapper": "
|
|
23
|
-
"button": "
|
|
24
|
-
"icon": "
|
|
25
|
-
"iconPlus": "
|
|
26
|
-
"iconArrow": "
|
|
27
|
-
"accordion": "
|
|
28
|
-
"accordionGap0": "
|
|
29
|
-
"accordionGap8": "
|
|
30
|
-
"accordionGap12": "
|
|
31
|
-
"accordionGap16": "
|
|
32
|
-
"accordionGap24": "
|
|
33
|
-
"accordionGap32": "
|
|
2
|
+
"themeLight": "_themeLight_22glu9_6",
|
|
3
|
+
"themeDark": "_themeDark_22glu9_9",
|
|
4
|
+
"sizeS": "_sizeS_22glu9_13",
|
|
5
|
+
"sizeM": "_sizeM_22glu9_16",
|
|
6
|
+
"sizeL": "_sizeL_22glu9_19",
|
|
7
|
+
"classic": "_classic_22glu9_23",
|
|
8
|
+
"rock": "_rock_22glu9_26",
|
|
9
|
+
"clear": "_clear_22glu9_29",
|
|
10
|
+
"hasBorderBottom": "_hasBorderBottom_22glu9_33",
|
|
11
|
+
"leftIcon": "_leftIcon_22glu9_37",
|
|
12
|
+
"rightIcon": "_rightIcon_22glu9_40",
|
|
13
|
+
"disableLeftPadding": "_disableLeftPadding_22glu9_44",
|
|
14
|
+
"main": "_main_22glu9_48",
|
|
15
|
+
"opening": "_opening_22glu9_59",
|
|
16
|
+
"opened": "_opened_22glu9_60",
|
|
17
|
+
"closing": "_closing_22glu9_61",
|
|
18
|
+
"title": "_title_22glu9_95",
|
|
19
|
+
"content": "_content_22glu9_103",
|
|
20
|
+
"closed": "_closed_22glu9_111",
|
|
21
|
+
"closingTransition": "_closingTransition_22glu9_120",
|
|
22
|
+
"innerWrapper": "_innerWrapper_22glu9_127",
|
|
23
|
+
"button": "_button_22glu9_133",
|
|
24
|
+
"icon": "_icon_22glu9_186",
|
|
25
|
+
"iconPlus": "_iconPlus_22glu9_202",
|
|
26
|
+
"iconArrow": "_iconArrow_22glu9_207",
|
|
27
|
+
"accordion": "_accordion_22glu9_213",
|
|
28
|
+
"accordionGap0": "_accordionGap0_22glu9_218",
|
|
29
|
+
"accordionGap8": "_accordionGap8_22glu9_221",
|
|
30
|
+
"accordionGap12": "_accordionGap12_22glu9_224",
|
|
31
|
+
"accordionGap16": "_accordionGap16_22glu9_227",
|
|
32
|
+
"accordionGap24": "_accordionGap24_22glu9_230",
|
|
33
|
+
"accordionGap32": "_accordionGap32_22glu9_233"
|
|
34
34
|
};
|
|
35
35
|
export { styles as default };
|
package/lib/context.js
CHANGED
package/lib/index.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
.
|
|
1
|
+
._icon_ons1cf_4{
|
|
2
2
|
--_rs-theme-dark:var(
|
|
3
3
|
--_rs-internal-force-theme-dark-consult-rescui-before-using,
|
|
4
4
|
var(--rs-theme-dark, 0)
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
--_rs-theme-light-coefficient:calc(1 - var(--_rs-theme-dark-coefficient));
|
|
9
9
|
}
|
|
10
10
|
@supports (color: color-mix(in srgb, #fff 50%, #000 50%)){
|
|
11
|
-
.
|
|
11
|
+
._icon_ons1cf_4{
|
|
12
12
|
--_rs-color-primary:color-mix(in srgb, var(--rs-color-primary-light-theme, #6B57FF) calc(100%*var(--_rs-theme-light-coefficient, 1)), var(--rs-color-primary-dark-theme, #8473FF) calc(100%*var(--_rs-theme-dark-coefficient, 0)));
|
|
13
13
|
--_rs-color-primary-dim:color-mix(in srgb, var(--rs-color-primary-dim-light-theme, #8979ff) calc(100%*var(--_rs-theme-light-coefficient, 1)), var(--rs-color-primary-dim-dark-theme, #6f61d2) calc(100%*var(--_rs-theme-dark-coefficient, 0)));
|
|
14
14
|
--_rs-color-primary-fog:color-mix(in srgb, var(--rs-color-primary-fog-light-theme, #e1ddff) calc(100%*var(--_rs-theme-light-coefficient, 1)), var(--rs-color-primary-fog-dark-theme, #2e2b49) calc(100%*var(--_rs-theme-dark-coefficient, 0)));
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
@supports not (color: color-mix(in srgb, #fff 50%, #000 50%)){
|
|
20
|
-
.
|
|
20
|
+
._icon_ons1cf_4{
|
|
21
21
|
--_rs-color-primary:rgb(calc(var(--_rs-theme-light-coefficient, 1)*107 + var(--_rs-theme-dark-coefficient, 0)*132), calc(var(--_rs-theme-light-coefficient, 1)*87 + var(--_rs-theme-dark-coefficient, 0)*115), 255);
|
|
22
22
|
--_rs-color-primary-dim:rgb(calc(var(--_rs-theme-light-coefficient, 1)*137 + var(--_rs-theme-dark-coefficient, 0)*111), calc(var(--_rs-theme-light-coefficient, 1)*121 + var(--_rs-theme-dark-coefficient, 0)*97), calc(var(--_rs-theme-light-coefficient, 1)*255 + var(--_rs-theme-dark-coefficient, 0)*210));
|
|
23
23
|
--_rs-color-primary-fog:rgb(calc(var(--_rs-theme-light-coefficient, 1)*225 + var(--_rs-theme-dark-coefficient, 0)*46), calc(var(--_rs-theme-light-coefficient, 1)*221 + var(--_rs-theme-dark-coefficient, 0)*43), calc(var(--_rs-theme-light-coefficient, 1)*255 + var(--_rs-theme-dark-coefficient, 0)*73));
|
|
@@ -25,65 +25,53 @@
|
|
|
25
25
|
--_rs-color-primary-t-fog:rgba(calc(var(--_rs-theme-light-coefficient, 1)*107 + var(--_rs-theme-dark-coefficient, 0)*132), calc(var(--_rs-theme-light-coefficient, 1)*87 + var(--_rs-theme-dark-coefficient, 0)*115), 255, calc(var(--_rs-theme-light-coefficient, 1)*0.2 + var(--_rs-theme-dark-coefficient, 0)*0.3));
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
|
-
.
|
|
28
|
+
._icon_ons1cf_4{
|
|
29
29
|
|
|
30
30
|
fill:var(--_rs-icons-themed-fill-or-initial, currentcolor);
|
|
31
31
|
|
|
32
32
|
width:auto;
|
|
33
33
|
height:var(--_rs-icons-height);
|
|
34
34
|
}
|
|
35
|
-
.
|
|
35
|
+
._sizeXS_ons1cf_14{
|
|
36
36
|
--_rs-icons-height:16px;
|
|
37
37
|
}
|
|
38
|
-
.
|
|
38
|
+
._sizeS_ons1cf_18{
|
|
39
39
|
--_rs-icons-height:20px;
|
|
40
40
|
}
|
|
41
|
-
.
|
|
41
|
+
._sizeM_ons1cf_22{
|
|
42
42
|
--_rs-icons-height:24px;
|
|
43
43
|
}
|
|
44
|
-
.
|
|
44
|
+
._sizeL_ons1cf_26{
|
|
45
45
|
--_rs-icons-height:28px;
|
|
46
46
|
}
|
|
47
|
-
.
|
|
47
|
+
._light_ons1cf_30{
|
|
48
48
|
--rs-theme-dark:0;
|
|
49
49
|
--_rs-icons-themed-fill-or-initial:rgb(calc(25 + var(--_rs-theme-dark-coefficient, 0)*230), calc(25 + var(--_rs-theme-dark-coefficient, 0)*230), calc(28 + var(--_rs-theme-dark-coefficient, 0)*227));
|
|
50
50
|
}
|
|
51
|
-
.
|
|
51
|
+
._dark_ons1cf_34{
|
|
52
52
|
--rs-theme-dark:1;
|
|
53
53
|
--_rs-icons-themed-fill-or-initial:rgb(calc(25 + var(--_rs-theme-dark-coefficient, 0)*230), calc(25 + var(--_rs-theme-dark-coefficient, 0)*230), calc(28 + var(--_rs-theme-dark-coefficient, 0)*227));
|
|
54
54
|
}
|
|
55
|
-
@-webkit-keyframes rs-icon-rotate{
|
|
56
|
-
from{
|
|
57
|
-
-webkit-transform:rotate(0deg);
|
|
58
|
-
transform:rotate(0deg);
|
|
59
|
-
}
|
|
60
|
-
to{
|
|
61
|
-
-webkit-transform:rotate(360deg);
|
|
62
|
-
transform:rotate(360deg);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
55
|
@keyframes rs-icon-rotate{
|
|
66
56
|
from{
|
|
67
|
-
|
|
68
|
-
transform:rotate(0deg);
|
|
57
|
+
transform:rotate(0deg);
|
|
69
58
|
}
|
|
70
59
|
to{
|
|
71
|
-
|
|
72
|
-
transform:rotate(360deg);
|
|
60
|
+
transform:rotate(360deg);
|
|
73
61
|
}
|
|
74
62
|
}
|
|
75
|
-
.
|
|
63
|
+
._themeLight_22glu9_6{
|
|
76
64
|
--rs-theme-dark:0;
|
|
77
65
|
}
|
|
78
|
-
.
|
|
66
|
+
._themeDark_22glu9_9{
|
|
79
67
|
--rs-theme-dark:1;
|
|
80
68
|
}
|
|
81
|
-
.
|
|
69
|
+
._sizeS_22glu9_13{
|
|
82
70
|
--_rs-collapse-vertical-padding:6px;
|
|
83
71
|
--_rs-collapse-horizontal-padding:8px;
|
|
84
72
|
--_rs-collapse-icon-size:20px;
|
|
85
73
|
}
|
|
86
|
-
.
|
|
74
|
+
._sizeS_22glu9_13 > [data-rs-internal='collapse__button'] > [data-rs-internal='collapse__title']{
|
|
87
75
|
--_rs-typography-letter-spacing:normal;
|
|
88
76
|
--_rs-typography-text-transform:initial;
|
|
89
77
|
--_rs-typography-font-variant-numeric:initial;
|
|
@@ -114,7 +102,7 @@
|
|
|
114
102
|
--_rs-typography-link-external-standalone-border-offset-from-text-base:1.02em;
|
|
115
103
|
--_rs-typography-link-border-bottom-width-from-text:2px;
|
|
116
104
|
}
|
|
117
|
-
.
|
|
105
|
+
._sizeS_22glu9_13 > [data-rs-internal='collapse__content']{
|
|
118
106
|
--_rs-typography-letter-spacing:0.0045em;
|
|
119
107
|
--_rs-typography-text-transform:initial;
|
|
120
108
|
--_rs-typography-font-variant-numeric:initial;
|
|
@@ -148,12 +136,12 @@
|
|
|
148
136
|
--_rs-typography-link-external-standalone-border-offset-from-text-base:1.02em;
|
|
149
137
|
--_rs-typography-link-border-bottom-width-from-text:1px;
|
|
150
138
|
}
|
|
151
|
-
.
|
|
139
|
+
._sizeM_22glu9_16{
|
|
152
140
|
--_rs-collapse-vertical-padding:8px;
|
|
153
141
|
--_rs-collapse-horizontal-padding:8px;
|
|
154
142
|
--_rs-collapse-icon-size:24px;
|
|
155
143
|
}
|
|
156
|
-
.
|
|
144
|
+
._sizeM_22glu9_16 > [data-rs-internal='collapse__button'] > [data-rs-internal='collapse__title']{
|
|
157
145
|
--_rs-typography-letter-spacing:normal;
|
|
158
146
|
--_rs-typography-text-transform:initial;
|
|
159
147
|
--_rs-typography-font-variant-numeric:initial;
|
|
@@ -184,7 +172,7 @@
|
|
|
184
172
|
--_rs-typography-link-external-standalone-border-offset-from-text-base:1.02em;
|
|
185
173
|
--_rs-typography-link-border-bottom-width-from-text:2px;
|
|
186
174
|
}
|
|
187
|
-
.
|
|
175
|
+
._sizeM_22glu9_16 > [data-rs-internal='collapse__content']{
|
|
188
176
|
--_rs-typography-letter-spacing:0.0015em;
|
|
189
177
|
--_rs-typography-text-transform:initial;
|
|
190
178
|
--_rs-typography-font-variant-numeric:initial;
|
|
@@ -219,16 +207,16 @@
|
|
|
219
207
|
--_rs-typography-link-border-bottom-width-from-text:1px;
|
|
220
208
|
}
|
|
221
209
|
@media screen and (max-width: 640px){
|
|
222
|
-
.
|
|
210
|
+
._sizeM_22glu9_16 > [data-rs-internal='collapse__content']{
|
|
223
211
|
--_rs-typography-list-li-margin-top-from-text:12px;
|
|
224
212
|
}
|
|
225
213
|
}
|
|
226
|
-
.
|
|
214
|
+
._sizeL_22glu9_19{
|
|
227
215
|
--_rs-collapse-vertical-padding:12px;
|
|
228
216
|
--_rs-collapse-horizontal-padding:16px;
|
|
229
217
|
--_rs-collapse-icon-size:28px;
|
|
230
218
|
}
|
|
231
|
-
.
|
|
219
|
+
._sizeL_22glu9_19 > [data-rs-internal='collapse__button'] > [data-rs-internal='collapse__title']{
|
|
232
220
|
--_rs-typography-letter-spacing:normal;
|
|
233
221
|
--_rs-typography-text-transform:initial;
|
|
234
222
|
--_rs-typography-font-variant-numeric:initial;
|
|
@@ -259,7 +247,7 @@
|
|
|
259
247
|
--_rs-typography-link-external-standalone-border-offset-from-text-base:1.02em;
|
|
260
248
|
--_rs-typography-link-border-bottom-width-from-text:2px;
|
|
261
249
|
}
|
|
262
|
-
.
|
|
250
|
+
._sizeL_22glu9_19 > [data-rs-internal='collapse__content']{
|
|
263
251
|
--_rs-typography-letter-spacing:normal;
|
|
264
252
|
--_rs-typography-text-transform:initial;
|
|
265
253
|
--_rs-typography-font-variant-numeric:initial;
|
|
@@ -294,11 +282,11 @@
|
|
|
294
282
|
--_rs-typography-link-border-bottom-width-from-text:1px;
|
|
295
283
|
}
|
|
296
284
|
@media screen and (max-width: 640px){
|
|
297
|
-
.
|
|
285
|
+
._sizeL_22glu9_19 > [data-rs-internal='collapse__content']{
|
|
298
286
|
--_rs-typography-list-li-margin-top-from-text:16px;
|
|
299
287
|
}
|
|
300
288
|
}
|
|
301
|
-
.
|
|
289
|
+
._classic_22glu9_23{
|
|
302
290
|
--_rs-collapse-active-theme-flip:0;
|
|
303
291
|
--_rs-collapse-active-background:rgba(
|
|
304
292
|
calc(25 + var(--_rs-theme-dark-coefficient, 0)*230), calc(25 + var(--_rs-theme-dark-coefficient, 0)*230), calc(28 + var(--_rs-theme-dark-coefficient, 0)*227),
|
|
@@ -312,7 +300,7 @@
|
|
|
312
300
|
);
|
|
313
301
|
--_rs-collapse-button-hover-color:rgba(calc(25 + var(--_rs-theme-dark-coefficient, 0)*230), calc(25 + var(--_rs-theme-dark-coefficient, 0)*230), calc(28 + var(--_rs-theme-dark-coefficient, 0)*227), 1);
|
|
314
302
|
}
|
|
315
|
-
.
|
|
303
|
+
._rock_22glu9_26{
|
|
316
304
|
--_rs-collapse-active-theme-flip:1;
|
|
317
305
|
--_rs-collapse-active-background:rgb(calc(255 - var(--_rs-theme-dark-coefficient, 0)*230), calc(255 - var(--_rs-theme-dark-coefficient, 0)*230), calc(255 - var(--_rs-theme-dark-coefficient, 0)*227));
|
|
318
306
|
--_rs-collapse-active-border-bottom-to-padding-multiplier:1;
|
|
@@ -323,7 +311,7 @@
|
|
|
323
311
|
);
|
|
324
312
|
--_rs-collapse-button-hover-color:rgba(calc(25 + var(--_rs-theme-dark-coefficient, 0)*230), calc(25 + var(--_rs-theme-dark-coefficient, 0)*230), calc(28 + var(--_rs-theme-dark-coefficient, 0)*227), 1);
|
|
325
313
|
}
|
|
326
|
-
.
|
|
314
|
+
._clear_22glu9_29{
|
|
327
315
|
--_rs-collapse-active-theme-flip:0;
|
|
328
316
|
--_rs-collapse-active-background:transparent;
|
|
329
317
|
--_rs-collapse-active-border-bottom-to-padding-multiplier:0;
|
|
@@ -334,27 +322,27 @@
|
|
|
334
322
|
0.7
|
|
335
323
|
);
|
|
336
324
|
}
|
|
337
|
-
.
|
|
325
|
+
._hasBorderBottom_22glu9_33{
|
|
338
326
|
--_rs-collapse-border-bottom-width-or-initial:1px;
|
|
339
327
|
}
|
|
340
|
-
.
|
|
328
|
+
._leftIcon_22glu9_37{
|
|
341
329
|
--_rs-collapse-button-flex-direction:row;
|
|
342
330
|
--_rs-collapse-icon-margin:0 var(--_rs-collapse-horizontal-padding) 0 0;
|
|
343
331
|
--_rs-collapse-inner-wrapper-padding-left-base:calc(var(--_rs-collapse-horizontal-padding)*2 + var(--_rs-collapse-icon-size));
|
|
344
332
|
}
|
|
345
|
-
.
|
|
333
|
+
._rightIcon_22glu9_40{
|
|
346
334
|
--_rs-collapse-button-flex-direction:row-reverse;
|
|
347
335
|
--_rs-collapse-icon-margin:0 0 0 var(--_rs-collapse-horizontal-padding);
|
|
348
336
|
--_rs-collapse-inner-wrapper-padding-left-base:var(
|
|
349
337
|
--_rs-collapse-horizontal-padding
|
|
350
338
|
);
|
|
351
339
|
}
|
|
352
|
-
.
|
|
340
|
+
._disableLeftPadding_22glu9_44{
|
|
353
341
|
--_rs-collapse-inner-wrapper-padding-left-from-disable-left-padding-or-initial:var(
|
|
354
342
|
--_rs-collapse-horizontal-padding
|
|
355
343
|
);
|
|
356
344
|
}
|
|
357
|
-
.
|
|
345
|
+
._main_22glu9_48{
|
|
358
346
|
--_rs-theme-dark:var(
|
|
359
347
|
--_rs-internal-force-theme-dark-consult-rescui-before-using,
|
|
360
348
|
var(--rs-theme-dark, 0)
|
|
@@ -364,7 +352,7 @@
|
|
|
364
352
|
--_rs-theme-light-coefficient:calc(1 - var(--_rs-theme-dark-coefficient));
|
|
365
353
|
}
|
|
366
354
|
@supports (color: color-mix(in srgb, #fff 50%, #000 50%)){
|
|
367
|
-
.
|
|
355
|
+
._main_22glu9_48{
|
|
368
356
|
--_rs-color-primary:color-mix(in srgb, var(--rs-color-primary-light-theme, #6B57FF) calc(100%*var(--_rs-theme-light-coefficient, 1)), var(--rs-color-primary-dark-theme, #8473FF) calc(100%*var(--_rs-theme-dark-coefficient, 0)));
|
|
369
357
|
--_rs-color-primary-dim:color-mix(in srgb, var(--rs-color-primary-dim-light-theme, #8979ff) calc(100%*var(--_rs-theme-light-coefficient, 1)), var(--rs-color-primary-dim-dark-theme, #6f61d2) calc(100%*var(--_rs-theme-dark-coefficient, 0)));
|
|
370
358
|
--_rs-color-primary-fog:color-mix(in srgb, var(--rs-color-primary-fog-light-theme, #e1ddff) calc(100%*var(--_rs-theme-light-coefficient, 1)), var(--rs-color-primary-fog-dark-theme, #2e2b49) calc(100%*var(--_rs-theme-dark-coefficient, 0)));
|
|
@@ -373,7 +361,7 @@
|
|
|
373
361
|
}
|
|
374
362
|
}
|
|
375
363
|
@supports not (color: color-mix(in srgb, #fff 50%, #000 50%)){
|
|
376
|
-
.
|
|
364
|
+
._main_22glu9_48{
|
|
377
365
|
--_rs-color-primary:rgb(calc(var(--_rs-theme-light-coefficient, 1)*107 + var(--_rs-theme-dark-coefficient, 0)*132), calc(var(--_rs-theme-light-coefficient, 1)*87 + var(--_rs-theme-dark-coefficient, 0)*115), 255);
|
|
378
366
|
--_rs-color-primary-dim:rgb(calc(var(--_rs-theme-light-coefficient, 1)*137 + var(--_rs-theme-dark-coefficient, 0)*111), calc(var(--_rs-theme-light-coefficient, 1)*121 + var(--_rs-theme-dark-coefficient, 0)*97), calc(var(--_rs-theme-light-coefficient, 1)*255 + var(--_rs-theme-dark-coefficient, 0)*210));
|
|
379
367
|
--_rs-color-primary-fog:rgb(calc(var(--_rs-theme-light-coefficient, 1)*225 + var(--_rs-theme-dark-coefficient, 0)*46), calc(var(--_rs-theme-light-coefficient, 1)*221 + var(--_rs-theme-dark-coefficient, 0)*43), calc(var(--_rs-theme-light-coefficient, 1)*255 + var(--_rs-theme-dark-coefficient, 0)*73));
|
|
@@ -381,7 +369,7 @@
|
|
|
381
369
|
--_rs-color-primary-t-fog:rgba(calc(var(--_rs-theme-light-coefficient, 1)*107 + var(--_rs-theme-dark-coefficient, 0)*132), calc(var(--_rs-theme-light-coefficient, 1)*87 + var(--_rs-theme-dark-coefficient, 0)*115), 255, calc(var(--_rs-theme-light-coefficient, 1)*0.2 + var(--_rs-theme-dark-coefficient, 0)*0.3));
|
|
382
370
|
}
|
|
383
371
|
}
|
|
384
|
-
.
|
|
372
|
+
._main_22glu9_48 {
|
|
385
373
|
--_rs-collapse-border-bottom-width:var(
|
|
386
374
|
--_rs-collapse-border-bottom-width-or-initial,
|
|
387
375
|
0px
|
|
@@ -396,9 +384,9 @@
|
|
|
396
384
|
border-bottom:var(--_rs-collapse-border-bottom-width) solid rgba(calc(25 + var(--_rs-theme-dark-coefficient, 0)*230), calc(25 + var(--_rs-theme-dark-coefficient, 0)*230), calc(28 + var(--_rs-theme-dark-coefficient, 0)*227), 0.2);
|
|
397
385
|
border-radius:var(--rs-collapse-border-radius, 0px);
|
|
398
386
|
}
|
|
399
|
-
.
|
|
400
|
-
.
|
|
401
|
-
.
|
|
387
|
+
._main_22glu9_48._opening_22glu9_59,
|
|
388
|
+
._main_22glu9_48._opened_22glu9_60,
|
|
389
|
+
._main_22glu9_48._closing_22glu9_61{
|
|
402
390
|
--rs-theme-flip:var(--_rs-collapse-active-theme-flip);
|
|
403
391
|
|
|
404
392
|
padding-bottom:calc(var(--_rs-collapse-border-bottom-width)*var(--_rs-collapse-active-border-bottom-to-padding-multiplier));
|
|
@@ -408,7 +396,7 @@
|
|
|
408
396
|
background:var(--_rs-collapse-active-background);
|
|
409
397
|
}
|
|
410
398
|
@media (hover: hover){
|
|
411
|
-
.
|
|
399
|
+
._main_22glu9_48:hover{
|
|
412
400
|
--rs-theme-flip:var(--_rs-collapse-active-theme-flip);
|
|
413
401
|
|
|
414
402
|
padding-bottom:calc(var(--_rs-collapse-border-bottom-width)*var(--_rs-collapse-active-border-bottom-to-padding-multiplier));
|
|
@@ -418,7 +406,7 @@
|
|
|
418
406
|
background:var(--_rs-collapse-active-background);
|
|
419
407
|
}
|
|
420
408
|
}
|
|
421
|
-
.
|
|
409
|
+
._title_22glu9_95{
|
|
422
410
|
letter-spacing:var(
|
|
423
411
|
--rs-text-base-letter-spacing,
|
|
424
412
|
var(--_rs-typography-letter-spacing)
|
|
@@ -429,18 +417,13 @@
|
|
|
429
417
|
font-weight:var(--_rs-typography-font-weight);
|
|
430
418
|
line-height:var(--_rs-typography-line-height);
|
|
431
419
|
font-variant-numeric:var(--_rs-typography-font-variant-numeric);
|
|
432
|
-
-webkit-font-feature-settings:'kern', 'liga', 'calt';
|
|
433
420
|
font-feature-settings:'kern', 'liga', 'calt';
|
|
434
421
|
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
-ms-flex:1 1 auto;
|
|
438
|
-
|
|
439
|
-
flex:1 1 auto;
|
|
422
|
+
flex:1 1 auto;
|
|
440
423
|
|
|
441
424
|
color:inherit;
|
|
442
425
|
}
|
|
443
|
-
.
|
|
426
|
+
._content_22glu9_103{
|
|
444
427
|
letter-spacing:var(
|
|
445
428
|
--rs-text-base-letter-spacing,
|
|
446
429
|
var(--_rs-typography-letter-spacing)
|
|
@@ -451,7 +434,6 @@
|
|
|
451
434
|
font-weight:var(--_rs-typography-font-weight);
|
|
452
435
|
line-height:var(--_rs-typography-line-height);
|
|
453
436
|
font-variant-numeric:var(--_rs-typography-font-variant-numeric);
|
|
454
|
-
-webkit-font-feature-settings:'kern', 'liga', 'calt';
|
|
455
437
|
font-feature-settings:'kern', 'liga', 'calt';
|
|
456
438
|
color:var(
|
|
457
439
|
--rs-color-hard,
|
|
@@ -462,24 +444,22 @@
|
|
|
462
444
|
|
|
463
445
|
height:0;
|
|
464
446
|
}
|
|
465
|
-
.
|
|
447
|
+
._closed_22glu9_111 > ._content_22glu9_103{
|
|
466
448
|
display:none;
|
|
467
449
|
}
|
|
468
|
-
.
|
|
450
|
+
._opened_22glu9_60 > ._content_22glu9_103{
|
|
469
451
|
height:initial;
|
|
470
452
|
}
|
|
471
|
-
.
|
|
472
|
-
.
|
|
453
|
+
._opening_22glu9_59 > ._content_22glu9_103,
|
|
454
|
+
._closingTransition_22glu9_120 > ._content_22glu9_103{
|
|
473
455
|
overflow:hidden;
|
|
474
456
|
|
|
475
|
-
-webkit-transition:height 300ms;
|
|
476
|
-
|
|
477
457
|
transition:height 300ms;
|
|
478
458
|
}
|
|
479
|
-
.
|
|
459
|
+
._innerWrapper_22glu9_127{
|
|
480
460
|
padding:0 var(--_rs-collapse-horizontal-padding) var(--_rs-collapse-horizontal-padding) var(--_rs-collapse-inner-wrapper-padding-left);
|
|
481
461
|
}
|
|
482
|
-
.
|
|
462
|
+
._button_22glu9_133{
|
|
483
463
|
color:var(
|
|
484
464
|
--rs-color-hard,
|
|
485
465
|
rgb(calc(25 + var(--_rs-theme-dark-coefficient, 0)*230), calc(25 + var(--_rs-theme-dark-coefficient, 0)*230), calc(28 + var(--_rs-theme-dark-coefficient, 0)*227))
|
|
@@ -487,20 +467,11 @@
|
|
|
487
467
|
|
|
488
468
|
position:relative;
|
|
489
469
|
|
|
490
|
-
display:-webkit-box;
|
|
491
|
-
|
|
492
|
-
display:-ms-flexbox;
|
|
493
|
-
|
|
494
470
|
display:flex;
|
|
495
471
|
|
|
496
472
|
overflow:visible;
|
|
497
|
-
-
|
|
498
|
-
-
|
|
499
|
-
-ms-flex-direction:var(--_rs-collapse-button-flex-direction);
|
|
500
|
-
flex-direction:var(--_rs-collapse-button-flex-direction);
|
|
501
|
-
-webkit-box-align:start;
|
|
502
|
-
-ms-flex-align:start;
|
|
503
|
-
align-items:flex-start;
|
|
473
|
+
flex-direction:var(--_rs-collapse-button-flex-direction);
|
|
474
|
+
align-items:flex-start;
|
|
504
475
|
|
|
505
476
|
width:100%;
|
|
506
477
|
margin:0;
|
|
@@ -516,92 +487,72 @@
|
|
|
516
487
|
|
|
517
488
|
font:inherit;
|
|
518
489
|
line-height:normal;
|
|
519
|
-
-webkit-transition:var(--_rs-collapse-button-transition);
|
|
520
490
|
transition:var(--_rs-collapse-button-transition);
|
|
521
491
|
-webkit-font-smoothing:inherit;
|
|
522
492
|
-moz-osx-font-smoothing:inherit;
|
|
523
493
|
-webkit-appearance:none;
|
|
524
494
|
}
|
|
525
|
-
.
|
|
495
|
+
._button_22glu9_133::-moz-focus-inner{
|
|
526
496
|
padding:0;
|
|
527
497
|
|
|
528
498
|
border:0;
|
|
529
499
|
}
|
|
530
|
-
.
|
|
500
|
+
._button_22glu9_133:focus{
|
|
531
501
|
outline:none;
|
|
532
502
|
}
|
|
533
|
-
.
|
|
534
|
-
|
|
535
|
-
box-shadow:var(--_rs-color-primary-t-dim) 0 0 0 4px;
|
|
503
|
+
._button_22glu9_133:focus[data-focus-method='key']{
|
|
504
|
+
box-shadow:var(--_rs-color-primary-t-dim) 0 0 0 4px;
|
|
536
505
|
}
|
|
537
506
|
@media (hover: hover){
|
|
538
|
-
.
|
|
507
|
+
._button_22glu9_133:hover{
|
|
539
508
|
color:var(--_rs-collapse-button-hover-color);
|
|
540
509
|
background:var(--_rs-collapse-button-hover-background);
|
|
541
510
|
}
|
|
542
511
|
}
|
|
543
|
-
.
|
|
512
|
+
._icon_22glu9_186{
|
|
544
513
|
position:relative;
|
|
545
514
|
top:0;
|
|
546
515
|
left:0;
|
|
547
516
|
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
-ms-flex:0 0 auto;
|
|
551
|
-
|
|
552
|
-
flex:0 0 auto;
|
|
517
|
+
flex:0 0 auto;
|
|
553
518
|
|
|
554
519
|
width:auto;
|
|
555
520
|
height:var(--_rs-collapse-icon-size);
|
|
556
521
|
margin:var(--_rs-collapse-icon-margin);
|
|
557
522
|
|
|
558
|
-
-webkit-transition:-webkit-transform 300ms;
|
|
559
|
-
|
|
560
|
-
transition:-webkit-transform 300ms;
|
|
561
|
-
|
|
562
523
|
transition:transform 300ms;
|
|
563
|
-
|
|
564
|
-
transition:transform 300ms, -webkit-transform 300ms;
|
|
565
|
-
-webkit-transform-origin:center center;
|
|
566
|
-
transform-origin:center center;
|
|
524
|
+
transform-origin:center center;
|
|
567
525
|
|
|
568
526
|
will-change:transform;
|
|
569
527
|
}
|
|
570
|
-
.
|
|
571
|
-
.
|
|
572
|
-
|
|
573
|
-
transform:rotate(45deg);
|
|
528
|
+
._opening_22glu9_59._iconPlus_22glu9_202 > ._button_22glu9_133 > ._icon_22glu9_186,
|
|
529
|
+
._opened_22glu9_60._iconPlus_22glu9_202 > ._button_22glu9_133 > ._icon_22glu9_186{
|
|
530
|
+
transform:rotate(45deg);
|
|
574
531
|
}
|
|
575
|
-
.
|
|
576
|
-
.
|
|
577
|
-
|
|
578
|
-
transform:rotate(90deg);
|
|
532
|
+
._opening_22glu9_59._iconArrow_22glu9_207 > ._button_22glu9_133 > ._icon_22glu9_186,
|
|
533
|
+
._opened_22glu9_60._iconArrow_22glu9_207 > ._button_22glu9_133 > ._icon_22glu9_186{
|
|
534
|
+
transform:rotate(90deg);
|
|
579
535
|
}
|
|
580
|
-
.
|
|
581
|
-
display:-webkit-box;
|
|
582
|
-
display:-ms-flexbox;
|
|
536
|
+
._accordion_22glu9_213{
|
|
583
537
|
display:flex;
|
|
584
|
-
-
|
|
585
|
-
-webkit-box-direction:normal;
|
|
586
|
-
-ms-flex-direction:column;
|
|
587
|
-
flex-direction:column;
|
|
538
|
+
flex-direction:column;
|
|
588
539
|
row-gap:var(--_rs-collapse-accordion-gap);
|
|
589
540
|
}
|
|
590
|
-
.
|
|
541
|
+
._accordionGap0_22glu9_218{
|
|
591
542
|
--_rs-collapse-accordion-gap:0px;
|
|
592
543
|
}
|
|
593
|
-
.
|
|
544
|
+
._accordionGap8_22glu9_221{
|
|
594
545
|
--_rs-collapse-accordion-gap:8px;
|
|
595
546
|
}
|
|
596
|
-
.
|
|
547
|
+
._accordionGap12_22glu9_224{
|
|
597
548
|
--_rs-collapse-accordion-gap:12px;
|
|
598
549
|
}
|
|
599
|
-
.
|
|
550
|
+
._accordionGap16_22glu9_227{
|
|
600
551
|
--_rs-collapse-accordion-gap:16px;
|
|
601
552
|
}
|
|
602
|
-
.
|
|
553
|
+
._accordionGap24_22glu9_230{
|
|
603
554
|
--_rs-collapse-accordion-gap:24px;
|
|
604
555
|
}
|
|
605
|
-
.
|
|
556
|
+
._accordionGap32_22glu9_233{
|
|
606
557
|
--_rs-collapse-accordion-gap:32px;
|
|
607
558
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
|
|
2
1
|
import { useState, useRef, useCallback } from 'react';
|
|
3
2
|
var COLLAPSE_STATES;
|
|
4
3
|
|
|
@@ -11,27 +10,21 @@ var COLLAPSE_STATES;
|
|
|
11
10
|
|
|
12
11
|
|
|
13
12
|
function useCollapseState(_ref) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
var stateRef = useRef(COLLAPSE_STATES.CLOSE);
|
|
22
|
-
var onAnimationEnd = useCallback(function () {
|
|
13
|
+
let {
|
|
14
|
+
shouldBeOpened,
|
|
15
|
+
cancelAnimation
|
|
16
|
+
} = _ref;
|
|
17
|
+
const [, setDummyState] = useState(false);
|
|
18
|
+
const stateRef = useRef(COLLAPSE_STATES.CLOSE);
|
|
19
|
+
const onAnimationEnd = useCallback(() => {
|
|
23
20
|
if ((stateRef.current === COLLAPSE_STATES.CLOSING || stateRef.current === COLLAPSE_STATES.OPENING) && !shouldBeOpened) {
|
|
24
21
|
stateRef.current = COLLAPSE_STATES.CLOSE; //force rerender
|
|
25
22
|
|
|
26
|
-
setDummyState(
|
|
27
|
-
return !s;
|
|
28
|
-
});
|
|
23
|
+
setDummyState(s => !s);
|
|
29
24
|
} else if (stateRef.current === COLLAPSE_STATES.OPENING && shouldBeOpened) {
|
|
30
25
|
stateRef.current = COLLAPSE_STATES.OPEN; //force rerender
|
|
31
26
|
|
|
32
|
-
setDummyState(
|
|
33
|
-
return !s;
|
|
34
|
-
});
|
|
27
|
+
setDummyState(s => !s);
|
|
35
28
|
}
|
|
36
29
|
}, [shouldBeOpened]);
|
|
37
30
|
|
|
@@ -42,25 +35,22 @@ function useCollapseState(_ref) {
|
|
|
42
35
|
}
|
|
43
36
|
|
|
44
37
|
return {
|
|
45
|
-
onAnimationEnd
|
|
38
|
+
onAnimationEnd,
|
|
46
39
|
state: stateRef.current
|
|
47
40
|
};
|
|
48
41
|
}
|
|
49
42
|
|
|
50
43
|
function useStartedClosing(state) {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
var _useState3 = useState(false),
|
|
56
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
57
|
-
setDummyState = _useState4[1];
|
|
44
|
+
const isStartedClosingRef = useRef(false);
|
|
45
|
+
const prevState = useRef(state);
|
|
46
|
+
const contentRef = useRef(null);
|
|
47
|
+
const [, setDummyState] = useState(false);
|
|
58
48
|
|
|
59
49
|
if (prevState.current === COLLAPSE_STATES.OPEN && state === COLLAPSE_STATES.CLOSING) {
|
|
60
50
|
isStartedClosingRef.current = true; // the next frame we need to force layout recalculations and new render
|
|
61
51
|
|
|
62
52
|
if (typeof window !== 'undefined') {
|
|
63
|
-
requestAnimationFrame(
|
|
53
|
+
requestAnimationFrame(() => {
|
|
64
54
|
if (!contentRef.current || !isStartedClosingRef.current) {
|
|
65
55
|
return;
|
|
66
56
|
} // force layout recalc, without this step firefox doesn't register style values for transitions
|
|
@@ -69,9 +59,7 @@ function useStartedClosing(state) {
|
|
|
69
59
|
|
|
70
60
|
contentRef.current.offsetHeight;
|
|
71
61
|
isStartedClosingRef.current = false;
|
|
72
|
-
setDummyState(
|
|
73
|
-
return !s;
|
|
74
|
-
});
|
|
62
|
+
setDummyState(s => !s);
|
|
75
63
|
});
|
|
76
64
|
}
|
|
77
65
|
}
|
|
@@ -79,7 +67,7 @@ function useStartedClosing(state) {
|
|
|
79
67
|
prevState.current = state;
|
|
80
68
|
return {
|
|
81
69
|
isStartedClosing: isStartedClosingRef.current,
|
|
82
|
-
contentRef
|
|
70
|
+
contentRef
|
|
83
71
|
};
|
|
84
72
|
}
|
|
85
73
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rescui/collapse",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.9",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "JetBrains",
|
|
@@ -14,10 +14,9 @@
|
|
|
14
14
|
"access": "public"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@babel/runtime-corejs3": "^7.
|
|
18
|
-
"@rescui/use-resize-observer": "^0.2.
|
|
19
|
-
"classnames": "^2.2.6"
|
|
20
|
-
"core-js": "^3.9.1"
|
|
17
|
+
"@babel/runtime-corejs3": "^7.26.0",
|
|
18
|
+
"@rescui/use-resize-observer": "^0.2.5",
|
|
19
|
+
"classnames": "^2.2.6"
|
|
21
20
|
},
|
|
22
21
|
"peerDependencies": {
|
|
23
22
|
"@rescui/ui-contexts": "^0.5.0",
|
|
@@ -25,9 +24,9 @@
|
|
|
25
24
|
"react": ">=16.8.0 <19"
|
|
26
25
|
},
|
|
27
26
|
"devDependencies": {
|
|
28
|
-
"@rescui/colors": "^0.2.
|
|
29
|
-
"@rescui/scripts": "^0.3.
|
|
30
|
-
"@rescui/typography": "^0.
|
|
27
|
+
"@rescui/colors": "^0.2.6",
|
|
28
|
+
"@rescui/scripts": "^0.3.5",
|
|
29
|
+
"@rescui/typography": "^0.19.1",
|
|
31
30
|
"@rescui/visual-regression": "^0.1.2",
|
|
32
31
|
"@types/classnames": "^2.2.11"
|
|
33
32
|
},
|
|
@@ -36,5 +35,5 @@
|
|
|
36
35
|
"build-pcss-api": "rescui-scripts build-pcss-api --file public-api.p.css"
|
|
37
36
|
},
|
|
38
37
|
"nx": {},
|
|
39
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "67627f69be3de4b4c6a21244fd7de36e841f01f0"
|
|
40
39
|
}
|