@rescui/collapse 0.3.6 → 0.4.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/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 { useTheme, ThemeProvider } from '@rescui/ui-contexts';
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 = useTheme(themeFromProps);
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 { useTheme, ThemeProvider } from '@rescui/ui-contexts';
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 = useTheme(themeFromProps);
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
- }, !isRightIcon && /*#__PURE__*/React.createElement(Icon, {
165
+ }, /*#__PURE__*/React.createElement(Icon, {
164
166
  className: styles.icon
165
167
  }), /*#__PURE__*/React.createElement("span", {
166
- className: cn(styles.title)
167
- }, title), isRightIcon && /*#__PURE__*/React.createElement(Icon, {
168
- className: styles.icon
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
- "hasBorderBottom": "_hasBorderBottom_4bvqsp_14",
3
- "main": "_main_4bvqsp_18",
4
- "themeLight": "_themeLight_4bvqsp_21",
5
- "themeDark": "_themeDark_4bvqsp_27",
6
- "rock": "_rock_4bvqsp_33",
7
- "opening": "_opening_4bvqsp_33",
8
- "opened": "_opened_4bvqsp_34",
9
- "closing": "_closing_4bvqsp_35",
10
- "classic": "_classic_4bvqsp_49",
11
- "title": "_title_4bvqsp_106",
12
- "sizeS": "_sizeS_4bvqsp_111",
13
- "button": "_button_4bvqsp_111",
14
- "sizeM": "_sizeM_4bvqsp_114",
15
- "sizeL": "_sizeL_4bvqsp_117",
16
- "content": "_content_4bvqsp_122",
17
- "closed": "_closed_4bvqsp_129",
18
- "closingTransition": "_closingTransition_4bvqsp_138",
19
- "rs-reset-letter-spacing": "_rs-reset-letter-spacing_4bvqsp_1",
20
- "leftIcon": "_leftIcon_4bvqsp_156",
21
- "innerWrapper": "_innerWrapper_4bvqsp_155",
22
- "rightIcon": "_rightIcon_4bvqsp_160",
23
- "disableLeftPadding": "_disableLeftPadding_4bvqsp_161",
24
- "clear": "_clear_4bvqsp_233",
25
- "icon": "_icon_4bvqsp_281",
26
- "iconPlus": "_iconPlus_4bvqsp_327",
27
- "iconArrow": "_iconArrow_4bvqsp_332",
28
- "accordion": "_accordion_4bvqsp_338",
29
- "accordionGap0": "_accordionGap0_4bvqsp_342",
30
- "accordionGap8": "_accordionGap8_4bvqsp_345",
31
- "accordionGap12": "_accordionGap12_4bvqsp_348",
32
- "accordionGap16": "_accordionGap16_4bvqsp_351",
33
- "accordionGap24": "_accordionGap24_4bvqsp_354",
34
- "accordionGap32": "_accordionGap32_4bvqsp_357"
2
+ "themeLight": "_themeLight_3xv1mo_6",
3
+ "themeDark": "_themeDark_3xv1mo_9",
4
+ "sizeS": "_sizeS_3xv1mo_13",
5
+ "sizeM": "_sizeM_3xv1mo_16",
6
+ "sizeL": "_sizeL_3xv1mo_19",
7
+ "classic": "_classic_3xv1mo_23",
8
+ "rock": "_rock_3xv1mo_26",
9
+ "clear": "_clear_3xv1mo_29",
10
+ "hasBorderBottom": "_hasBorderBottom_3xv1mo_33",
11
+ "leftIcon": "_leftIcon_3xv1mo_37",
12
+ "rightIcon": "_rightIcon_3xv1mo_40",
13
+ "disableLeftPadding": "_disableLeftPadding_3xv1mo_44",
14
+ "main": "_main_3xv1mo_48",
15
+ "opening": "_opening_3xv1mo_58",
16
+ "opened": "_opened_3xv1mo_59",
17
+ "closing": "_closing_3xv1mo_60",
18
+ "title": "_title_3xv1mo_94",
19
+ "content": "_content_3xv1mo_102",
20
+ "closed": "_closed_3xv1mo_112",
21
+ "closingTransition": "_closingTransition_3xv1mo_121",
22
+ "innerWrapper": "_innerWrapper_3xv1mo_128",
23
+ "button": "_button_3xv1mo_134",
24
+ "icon": "_icon_3xv1mo_188",
25
+ "iconPlus": "_iconPlus_3xv1mo_204",
26
+ "iconArrow": "_iconArrow_3xv1mo_209",
27
+ "accordion": "_accordion_3xv1mo_215",
28
+ "accordionGap0": "_accordionGap0_3xv1mo_220",
29
+ "accordionGap8": "_accordionGap8_3xv1mo_223",
30
+ "accordionGap12": "_accordionGap12_3xv1mo_226",
31
+ "accordionGap16": "_accordionGap16_3xv1mo_229",
32
+ "accordionGap24": "_accordionGap24_3xv1mo_232",
33
+ "accordionGap32": "_accordionGap32_3xv1mo_235"
35
34
  };
36
35
  export { styles as default };