@rescui/collapse 0.5.8 → 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.
@@ -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
- var _excluded = ["theme", "size", "className"];
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
- var AddOutlineIcon = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
15
- var theme = _ref.theme,
16
- size = _ref.size,
17
- className = _ref.className,
18
- props = _objectWithoutProperties(_ref, _excluded);
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": "_icon_1g6zqe1_4",
3
- "sizeXS": "_sizeXS_1g6zqe1_14",
4
- "sizeS": "_sizeS_1g6zqe1_18",
5
- "sizeM": "_sizeM_1g6zqe1_22",
6
- "sizeL": "_sizeL_1g6zqe1_26",
7
- "light": "_light_1g6zqe1_30",
8
- "dark": "_dark_1g6zqe1_34"
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 };
@@ -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
- var _excluded = ["theme", "size", "className"];
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
- var RightIcon = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
15
- var theme = _ref.theme,
16
- size = _ref.size,
17
- className = _ref.className,
18
- props = _objectWithoutProperties(_ref, _excluded);
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
- var GAP_STYLES = {
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
- var Accordion = /*#__PURE__*/React.forwardRef( // eslint-disable-next-line complexity
32
- function (_ref, ref) {
33
- var children = _ref.children,
34
- className = _ref.className,
35
- openedClassName = _ref.openedClassName,
36
- _ref$size = _ref.size,
37
- size = _ref$size === void 0 ? 'm' : _ref$size,
38
- _ref$mode = _ref.mode,
39
- mode = _ref$mode === void 0 ? 'classic' : _ref$mode,
40
- _ref$icon = _ref.icon,
41
- icon = _ref$icon === void 0 ? 'left-plus' : _ref$icon,
42
- _ref$borderBottom = _ref.borderBottom,
43
- borderBottom = _ref$borderBottom === void 0 ? false : _ref$borderBottom,
44
- _ref$disableLeftPaddi = _ref.disableLeftPadding,
45
- disableLeftPadding = _ref$disableLeftPaddi === void 0 ? false : _ref$disableLeftPaddi,
46
- _ref$gap = _ref.gap,
47
- gap = _ref$gap === void 0 ? 0 : _ref$gap,
48
- themeFromProps = _ref.theme,
49
- value = _ref.value,
50
- onChange = _ref.onChange,
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
- var toggleActiveKey = function toggleActiveKey(key) {
62
- var activatingKey = key !== openKey ? key : null;
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: toggleActiveKey,
77
- setActiveKey: setActiveKey,
78
- size: size,
79
- mode: mode,
80
- icon: icon,
81
- borderBottom: borderBottom,
82
- disableLeftPadding: disableLeftPadding,
83
- openedClassName: 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", _objectSpread(_objectSpread({
88
- "data-test": 'accordion'
89
- }, restProps), {}, {
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
- }), children)));
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
- var THEME_STYLES = {
16
+ const THEME_STYLES = {
34
17
  light: styles.themeLight,
35
18
  dark: styles.themeDark
36
19
  };
37
- var SIZE_STYLES = {
20
+ const SIZE_STYLES = {
38
21
  s: styles.sizeS,
39
22
  m: styles.sizeM,
40
23
  l: styles.sizeL
41
24
  };
42
- var MODE_STYLES = {
25
+ const MODE_STYLES = {
43
26
  classic: styles.classic,
44
27
  rock: styles.rock,
45
28
  clear: styles.clear
46
29
  };
47
- var ICON_STYLES = {
30
+ const ICON_STYLES = {
48
31
  'left-plus': styles.iconPlus,
49
32
  'right-plus': styles.iconPlus,
50
33
  arrow: styles.iconArrow
51
34
  };
52
- var Collapse = /*#__PURE__*/React.forwardRef( // eslint-disable-next-line complexity
53
- function (_ref, ref) {
54
- var _ref2, _ref3, _ref4, _ref5, _ref6;
55
-
56
- var children = _ref.children,
57
- className = _ref.className,
58
- openedClassnameFromProps = _ref.openedClassName,
59
- sizeFromProps = _ref.size,
60
- modeFromProps = _ref.mode,
61
- iconFromProps = _ref.icon,
62
- borderBottomFromProps = _ref.borderBottom,
63
- disableLeftPaddingFromProps = _ref.disableLeftPadding,
64
- title = _ref.title,
65
- _ref$isDefaultOpened = _ref.isDefaultOpened,
66
- isDefaultOpened = _ref$isDefaultOpened === void 0 ? false : _ref$isDefaultOpened,
67
- themeFromProps = _ref.theme,
68
- itemKey = _ref.itemKey,
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
- var _useRef = useRef(itemKey !== null && itemKey !== void 0 ? itemKey : getRandId()),
73
- key = _useRef.current;
74
-
75
- var theme = useThemeWithUndefined(themeFromProps);
76
-
77
- var _useContext = useContext(collapseContext),
78
- openedKey = _useContext.openedKey,
79
- isInAccordion = _useContext.isInAccordion,
80
- isInControlledAccordion = _useContext.isInControlledAccordion,
81
- toggleActiveKey = _useContext.toggleActiveKey,
82
- setActiveKey = _useContext.setActiveKey,
83
- sizeFromContext = _useContext.size,
84
- modeFromContext = _useContext.mode,
85
- iconFromContext = _useContext.icon,
86
- borderBottomFromContext = _useContext.borderBottom,
87
- disableLeftPaddingFromContext = _useContext.disableLeftPadding,
88
- openedClassNameFromContext = _useContext.openedClassName;
89
-
90
- var size = (_ref2 = sizeFromProps !== null && sizeFromProps !== void 0 ? sizeFromProps : sizeFromContext) !== null && _ref2 !== void 0 ? _ref2 : 'm';
91
- var mode = (_ref3 = modeFromProps !== null && modeFromProps !== void 0 ? modeFromProps : modeFromContext) !== null && _ref3 !== void 0 ? _ref3 : 'classic';
92
- var icon = (_ref4 = iconFromProps !== null && iconFromProps !== void 0 ? iconFromProps : iconFromContext) !== null && _ref4 !== void 0 ? _ref4 : 'left-plus';
93
- var borderBottom = (_ref5 = borderBottomFromProps !== null && borderBottomFromProps !== void 0 ? borderBottomFromProps : borderBottomFromContext) !== null && _ref5 !== void 0 ? _ref5 : false;
94
- var disableLeftPadding = (_ref6 = disableLeftPaddingFromProps !== null && disableLeftPaddingFromProps !== void 0 ? disableLeftPaddingFromProps : disableLeftPaddingFromContext) !== null && _ref6 !== void 0 ? _ref6 : false;
95
- var openedClassName = openedClassnameFromProps !== null && openedClassnameFromProps !== void 0 ? openedClassnameFromProps : openedClassNameFromContext; // height calculations
96
-
97
- var resizeRef = useRef(null);
98
-
99
- var _useState = useState('initial'),
100
- _useState2 = _slicedToArray(_useState, 2),
101
- height = _useState2[0],
102
- setHeight = _useState2[1];
103
-
104
- useResizeObserver(resizeRef, function (entry) {
105
- return setHeight(entry.target.offsetHeight);
106
- });
107
- var isHeightCalculated = height !== 'initial'; // this state is ignored in accordion
108
-
109
- var _useState3 = useState(isDefaultOpened),
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
- handleTransitionEnd = _useCollapseState.onAnimationEnd,
124
- collapseState = _useCollapseState.state;
125
-
126
- var isOpening = collapseState === COLLAPSE_STATES.OPENING;
127
- var isOpened = collapseState === COLLAPSE_STATES.OPEN;
128
- var isClosing = collapseState === COLLAPSE_STATES.CLOSING;
129
- var isClosed = collapseState === COLLAPSE_STATES.CLOSE;
130
-
131
- var _useStartedClosing = useStartedClosing(collapseState),
132
- isStartedClosing = _useStartedClosing.isStartedClosing,
133
- contentRef = _useStartedClosing.contentRef;
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(function () {
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", _objectSpread(_objectSpread({
156
- "data-test": 'collapse'
157
- }, restProps), {}, {
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
- }), /*#__PURE__*/React.createElement("button", {
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": "_themeLight_1vcpvif_6",
3
- "themeDark": "_themeDark_1vcpvif_9",
4
- "sizeS": "_sizeS_1vcpvif_13",
5
- "sizeM": "_sizeM_1vcpvif_16",
6
- "sizeL": "_sizeL_1vcpvif_19",
7
- "classic": "_classic_1vcpvif_23",
8
- "rock": "_rock_1vcpvif_26",
9
- "clear": "_clear_1vcpvif_29",
10
- "hasBorderBottom": "_hasBorderBottom_1vcpvif_33",
11
- "leftIcon": "_leftIcon_1vcpvif_37",
12
- "rightIcon": "_rightIcon_1vcpvif_40",
13
- "disableLeftPadding": "_disableLeftPadding_1vcpvif_44",
14
- "main": "_main_1vcpvif_48",
15
- "opening": "_opening_1vcpvif_59",
16
- "opened": "_opened_1vcpvif_60",
17
- "closing": "_closing_1vcpvif_61",
18
- "title": "_title_1vcpvif_95",
19
- "content": "_content_1vcpvif_103",
20
- "closed": "_closed_1vcpvif_111",
21
- "closingTransition": "_closingTransition_1vcpvif_120",
22
- "innerWrapper": "_innerWrapper_1vcpvif_127",
23
- "button": "_button_1vcpvif_133",
24
- "icon": "_icon_1vcpvif_186",
25
- "iconPlus": "_iconPlus_1vcpvif_202",
26
- "iconArrow": "_iconArrow_1vcpvif_207",
27
- "accordion": "_accordion_1vcpvif_213",
28
- "accordionGap0": "_accordionGap0_1vcpvif_218",
29
- "accordionGap8": "_accordionGap8_1vcpvif_221",
30
- "accordionGap12": "_accordionGap12_1vcpvif_224",
31
- "accordionGap16": "_accordionGap16_1vcpvif_227",
32
- "accordionGap24": "_accordionGap24_1vcpvif_230",
33
- "accordionGap32": "_accordionGap32_1vcpvif_233"
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
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- var collapseContext = /*#__PURE__*/React.createContext({
2
+ const collapseContext = /*#__PURE__*/React.createContext({
3
3
  openedKey: null,
4
4
  isInAccordion: false,
5
5
  isInControlledAccordion: false,
package/lib/index.css CHANGED
@@ -1,4 +1,4 @@
1
- ._icon_1g6zqe1_4{
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
- ._icon_1g6zqe1_4{
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
- ._icon_1g6zqe1_4{
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
- ._icon_1g6zqe1_4{
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
- ._sizeXS_1g6zqe1_14{
35
+ ._sizeXS_ons1cf_14{
36
36
  --_rs-icons-height:16px;
37
37
  }
38
- ._sizeS_1g6zqe1_18{
38
+ ._sizeS_ons1cf_18{
39
39
  --_rs-icons-height:20px;
40
40
  }
41
- ._sizeM_1g6zqe1_22{
41
+ ._sizeM_ons1cf_22{
42
42
  --_rs-icons-height:24px;
43
43
  }
44
- ._sizeL_1g6zqe1_26{
44
+ ._sizeL_ons1cf_26{
45
45
  --_rs-icons-height:28px;
46
46
  }
47
- ._light_1g6zqe1_30{
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
- ._dark_1g6zqe1_34{
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
- -webkit-transform:rotate(0deg);
68
- transform:rotate(0deg);
57
+ transform:rotate(0deg);
69
58
  }
70
59
  to{
71
- -webkit-transform:rotate(360deg);
72
- transform:rotate(360deg);
60
+ transform:rotate(360deg);
73
61
  }
74
62
  }
75
- ._themeLight_1vcpvif_6{
63
+ ._themeLight_22glu9_6{
76
64
  --rs-theme-dark:0;
77
65
  }
78
- ._themeDark_1vcpvif_9{
66
+ ._themeDark_22glu9_9{
79
67
  --rs-theme-dark:1;
80
68
  }
81
- ._sizeS_1vcpvif_13{
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
- ._sizeS_1vcpvif_13 > [data-rs-internal='collapse__button'] > [data-rs-internal='collapse__title']{
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
- ._sizeS_1vcpvif_13 > [data-rs-internal='collapse__content']{
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
- ._sizeM_1vcpvif_16{
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
- ._sizeM_1vcpvif_16 > [data-rs-internal='collapse__button'] > [data-rs-internal='collapse__title']{
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
- ._sizeM_1vcpvif_16 > [data-rs-internal='collapse__content']{
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
- ._sizeM_1vcpvif_16 > [data-rs-internal='collapse__content']{
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
- ._sizeL_1vcpvif_19{
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
- ._sizeL_1vcpvif_19 > [data-rs-internal='collapse__button'] > [data-rs-internal='collapse__title']{
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
- ._sizeL_1vcpvif_19 > [data-rs-internal='collapse__content']{
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
- ._sizeL_1vcpvif_19 > [data-rs-internal='collapse__content']{
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
- ._classic_1vcpvif_23{
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
- ._rock_1vcpvif_26{
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
- ._clear_1vcpvif_29{
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
- ._hasBorderBottom_1vcpvif_33{
325
+ ._hasBorderBottom_22glu9_33{
338
326
  --_rs-collapse-border-bottom-width-or-initial:1px;
339
327
  }
340
- ._leftIcon_1vcpvif_37{
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
- ._rightIcon_1vcpvif_40{
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
- ._disableLeftPadding_1vcpvif_44{
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
- ._main_1vcpvif_48{
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
- ._main_1vcpvif_48{
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
- ._main_1vcpvif_48{
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
- ._main_1vcpvif_48 {
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
- ._main_1vcpvif_48._opening_1vcpvif_59,
400
- ._main_1vcpvif_48._opened_1vcpvif_60,
401
- ._main_1vcpvif_48._closing_1vcpvif_61{
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
- ._main_1vcpvif_48:hover{
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
- ._title_1vcpvif_95{
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
- -webkit-box-flex:1;
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
- ._content_1vcpvif_103{
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
- ._closed_1vcpvif_111 > ._content_1vcpvif_103{
447
+ ._closed_22glu9_111 > ._content_22glu9_103{
466
448
  display:none;
467
449
  }
468
- ._opened_1vcpvif_60 > ._content_1vcpvif_103{
450
+ ._opened_22glu9_60 > ._content_22glu9_103{
469
451
  height:initial;
470
452
  }
471
- ._opening_1vcpvif_59 > ._content_1vcpvif_103,
472
- ._closingTransition_1vcpvif_120 > ._content_1vcpvif_103{
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
- ._innerWrapper_1vcpvif_127{
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
- ._button_1vcpvif_133{
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
- -webkit-box-orient:vertical;
498
- -webkit-box-direction:normal;
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
- ._button_1vcpvif_133::-moz-focus-inner{
495
+ ._button_22glu9_133::-moz-focus-inner{
526
496
  padding:0;
527
497
 
528
498
  border:0;
529
499
  }
530
- ._button_1vcpvif_133:focus{
500
+ ._button_22glu9_133:focus{
531
501
  outline:none;
532
502
  }
533
- ._button_1vcpvif_133:focus[data-focus-method='key']{
534
- -webkit-box-shadow:var(--_rs-color-primary-t-dim) 0 0 0 4px;
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
- ._button_1vcpvif_133:hover{
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
- ._icon_1vcpvif_186{
512
+ ._icon_22glu9_186{
544
513
  position:relative;
545
514
  top:0;
546
515
  left:0;
547
516
 
548
- -webkit-box-flex:0;
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
- ._opening_1vcpvif_59._iconPlus_1vcpvif_202 > ._button_1vcpvif_133 > ._icon_1vcpvif_186,
571
- ._opened_1vcpvif_60._iconPlus_1vcpvif_202 > ._button_1vcpvif_133 > ._icon_1vcpvif_186{
572
- -webkit-transform:rotate(45deg);
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
- ._opening_1vcpvif_59._iconArrow_1vcpvif_207 > ._button_1vcpvif_133 > ._icon_1vcpvif_186,
576
- ._opened_1vcpvif_60._iconArrow_1vcpvif_207 > ._button_1vcpvif_133 > ._icon_1vcpvif_186{
577
- -webkit-transform:rotate(90deg);
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
- ._accordion_1vcpvif_213{
581
- display:-webkit-box;
582
- display:-ms-flexbox;
536
+ ._accordion_22glu9_213{
583
537
  display:flex;
584
- -webkit-box-orient:vertical;
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
- ._accordionGap0_1vcpvif_218{
541
+ ._accordionGap0_22glu9_218{
591
542
  --_rs-collapse-accordion-gap:0px;
592
543
  }
593
- ._accordionGap8_1vcpvif_221{
544
+ ._accordionGap8_22glu9_221{
594
545
  --_rs-collapse-accordion-gap:8px;
595
546
  }
596
- ._accordionGap12_1vcpvif_224{
547
+ ._accordionGap12_22glu9_224{
597
548
  --_rs-collapse-accordion-gap:12px;
598
549
  }
599
- ._accordionGap16_1vcpvif_227{
550
+ ._accordionGap16_22glu9_227{
600
551
  --_rs-collapse-accordion-gap:16px;
601
552
  }
602
- ._accordionGap24_1vcpvif_230{
553
+ ._accordionGap24_22glu9_230{
603
554
  --_rs-collapse-accordion-gap:24px;
604
555
  }
605
- ._accordionGap32_1vcpvif_233{
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
- var shouldBeOpened = _ref.shouldBeOpened,
15
- cancelAnimation = _ref.cancelAnimation;
16
-
17
- var _useState = useState(false),
18
- _useState2 = _slicedToArray(_useState, 2),
19
- setDummyState = _useState2[1];
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(function (s) {
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(function (s) {
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: onAnimationEnd,
38
+ onAnimationEnd,
46
39
  state: stateRef.current
47
40
  };
48
41
  }
49
42
 
50
43
  function useStartedClosing(state) {
51
- var isStartedClosingRef = useRef(false);
52
- var prevState = useRef(state);
53
- var contentRef = useRef(null);
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(function () {
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(function (s) {
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: 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.8",
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.14.0",
18
- "@rescui/use-resize-observer": "^0.2.4",
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.5",
29
- "@rescui/scripts": "^0.3.4",
30
- "@rescui/typography": "^0.19.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": "69a84812628809943698f0b27643c83dc449f119"
38
+ "gitHead": "67627f69be3de4b4c6a21244fd7de36e841f01f0"
40
39
  }