@rescui/collapse 0.3.6 → 0.4.1
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/accordion.js +2 -2
- package/lib/collapse.js +9 -7
- package/lib/collapse.p.module.css.js +32 -33
- package/lib/index.css +425 -322
- package/lib/public-api.p.css +592 -0
- package/lib/public-api.pcss +592 -0
- package/package.json +10 -9
package/lib/accordion.js
CHANGED
|
@@ -17,7 +17,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
17
17
|
import React, { useState } from 'react';
|
|
18
18
|
import cn from 'classnames';
|
|
19
19
|
import PropTypes from 'prop-types';
|
|
20
|
-
import {
|
|
20
|
+
import { useThemeWithUndefined, ThemeProvider } from '@rescui/ui-contexts';
|
|
21
21
|
import { collapseContext } from './context.js';
|
|
22
22
|
import styles from './collapse.p.module.css.js';
|
|
23
23
|
var GAP_STYLES = {
|
|
@@ -51,7 +51,7 @@ function (_ref, ref) {
|
|
|
51
51
|
restProps = _objectWithoutProperties(_ref, _excluded);
|
|
52
52
|
|
|
53
53
|
var isControlled = typeof value !== 'undefined';
|
|
54
|
-
var theme =
|
|
54
|
+
var theme = useThemeWithUndefined(themeFromProps);
|
|
55
55
|
|
|
56
56
|
var _useState = useState(isControlled ? value : null),
|
|
57
57
|
_useState2 = _slicedToArray(_useState, 2),
|
package/lib/collapse.js
CHANGED
|
@@ -19,7 +19,7 @@ import React, { useRef, useContext, useState, useEffect } from 'react';
|
|
|
19
19
|
import cn from 'classnames';
|
|
20
20
|
import PropTypes from 'prop-types';
|
|
21
21
|
import { RightIcon, AddOutlineIcon } from '@rescui/icons';
|
|
22
|
-
import {
|
|
22
|
+
import { useThemeWithUndefined, ThemeProvider } from '@rescui/ui-contexts';
|
|
23
23
|
import { useResizeObserver } from '@rescui/use-resize-observer';
|
|
24
24
|
import { collapseContext } from './context.js';
|
|
25
25
|
import { useCollapseState, COLLAPSE_STATES, useStartedClosing } from './use-collapse-state.js';
|
|
@@ -71,7 +71,7 @@ function (_ref, ref) {
|
|
|
71
71
|
var _useRef = useRef(itemKey !== null && itemKey !== void 0 ? itemKey : getRandId()),
|
|
72
72
|
key = _useRef.current;
|
|
73
73
|
|
|
74
|
-
var theme =
|
|
74
|
+
var theme = useThemeWithUndefined(themeFromProps);
|
|
75
75
|
|
|
76
76
|
var _useContext = useContext(collapseContext),
|
|
77
77
|
openedKey = _useContext.openedKey,
|
|
@@ -155,19 +155,21 @@ function (_ref, ref) {
|
|
|
155
155
|
"data-test": 'collapse'
|
|
156
156
|
}, restProps), {}, {
|
|
157
157
|
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]),
|
|
158
|
+
"data-rs-internal": "collapse__collapse",
|
|
158
159
|
ref: ref
|
|
159
160
|
}), /*#__PURE__*/React.createElement("button", {
|
|
160
161
|
type: "button",
|
|
162
|
+
"data-rs-internal": "collapse__button",
|
|
161
163
|
className: styles.button,
|
|
162
164
|
onClick: toggleOpened
|
|
163
|
-
},
|
|
165
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
164
166
|
className: styles.icon
|
|
165
167
|
}), /*#__PURE__*/React.createElement("span", {
|
|
166
|
-
className: cn(styles.title)
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
})), /*#__PURE__*/React.createElement("div", {
|
|
168
|
+
className: cn(styles.title),
|
|
169
|
+
"data-rs-internal": "collapse__title"
|
|
170
|
+
}, title)), /*#__PURE__*/React.createElement("div", {
|
|
170
171
|
className: styles.content,
|
|
172
|
+
"data-rs-internal": "collapse__content",
|
|
171
173
|
style: {
|
|
172
174
|
// So, we set the height value only on OPENING stage and just after beginning CLOSING stage
|
|
173
175
|
// The reason we don't leave this style for OPEN stage is because some content of the expanded Collapse may change its height dynamically
|
|
@@ -1,36 +1,35 @@
|
|
|
1
1
|
var styles = {
|
|
2
|
-
"
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"accordionGap32": "_accordionGap32_4bvqsp_357"
|
|
2
|
+
"themeLight": "_themeLight_9n5huc_6",
|
|
3
|
+
"themeDark": "_themeDark_9n5huc_9",
|
|
4
|
+
"sizeS": "_sizeS_9n5huc_13",
|
|
5
|
+
"sizeM": "_sizeM_9n5huc_16",
|
|
6
|
+
"sizeL": "_sizeL_9n5huc_19",
|
|
7
|
+
"classic": "_classic_9n5huc_23",
|
|
8
|
+
"rock": "_rock_9n5huc_26",
|
|
9
|
+
"clear": "_clear_9n5huc_29",
|
|
10
|
+
"hasBorderBottom": "_hasBorderBottom_9n5huc_33",
|
|
11
|
+
"leftIcon": "_leftIcon_9n5huc_37",
|
|
12
|
+
"rightIcon": "_rightIcon_9n5huc_40",
|
|
13
|
+
"disableLeftPadding": "_disableLeftPadding_9n5huc_44",
|
|
14
|
+
"main": "_main_9n5huc_48",
|
|
15
|
+
"opening": "_opening_9n5huc_58",
|
|
16
|
+
"opened": "_opened_9n5huc_59",
|
|
17
|
+
"closing": "_closing_9n5huc_60",
|
|
18
|
+
"title": "_title_9n5huc_94",
|
|
19
|
+
"content": "_content_9n5huc_102",
|
|
20
|
+
"closed": "_closed_9n5huc_112",
|
|
21
|
+
"closingTransition": "_closingTransition_9n5huc_121",
|
|
22
|
+
"innerWrapper": "_innerWrapper_9n5huc_128",
|
|
23
|
+
"button": "_button_9n5huc_134",
|
|
24
|
+
"icon": "_icon_9n5huc_188",
|
|
25
|
+
"iconPlus": "_iconPlus_9n5huc_204",
|
|
26
|
+
"iconArrow": "_iconArrow_9n5huc_209",
|
|
27
|
+
"accordion": "_accordion_9n5huc_215",
|
|
28
|
+
"accordionGap0": "_accordionGap0_9n5huc_220",
|
|
29
|
+
"accordionGap8": "_accordionGap8_9n5huc_223",
|
|
30
|
+
"accordionGap12": "_accordionGap12_9n5huc_226",
|
|
31
|
+
"accordionGap16": "_accordionGap16_9n5huc_229",
|
|
32
|
+
"accordionGap24": "_accordionGap24_9n5huc_232",
|
|
33
|
+
"accordionGap32": "_accordionGap32_9n5huc_235"
|
|
35
34
|
};
|
|
36
35
|
export { styles as default };
|