@rescui/collapse 0.1.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/LICENSE.txt +202 -0
- package/README.md +3 -0
- package/lib/accordion.d.ts +43 -0
- package/lib/accordion.js +104 -0
- package/lib/collapse.d.ts +46 -0
- package/lib/collapse.js +197 -0
- package/lib/collapse.p.module.css.js +34 -0
- package/lib/context.d.ts +15 -0
- package/lib/context.js +14 -0
- package/lib/index.css +413 -0
- package/lib/index.d.ts +4 -0
- package/lib/index.js +3 -0
- package/lib/types.d.ts +6 -0
- package/lib/use-collapse-state.d.ts +18 -0
- package/lib/use-collapse-state.js +86 -0
- package/package.json +39 -0
package/LICENSE.txt
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright 2000-2016 JetBrains s.r.o.
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Theme } from '@rescui/ui-contexts';
|
|
3
|
+
import type { AccordionGap, CollapseSize, CollapseMode, CollapseIcon, KeyType } from './types';
|
|
4
|
+
export declare type AccordionExplicitProps = {
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
className?: string;
|
|
7
|
+
/**
|
|
8
|
+
* Opened collapse classname
|
|
9
|
+
*/
|
|
10
|
+
openedClassName?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Collapse items size
|
|
13
|
+
*/
|
|
14
|
+
size?: CollapseSize;
|
|
15
|
+
/**
|
|
16
|
+
* Collapse items appearance mode
|
|
17
|
+
*/
|
|
18
|
+
mode?: CollapseMode;
|
|
19
|
+
/**
|
|
20
|
+
* Collapse items icon type
|
|
21
|
+
*/
|
|
22
|
+
icon?: CollapseIcon;
|
|
23
|
+
/**
|
|
24
|
+
* Controls the bottom border of collapse items
|
|
25
|
+
*/
|
|
26
|
+
borderBottom?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Vertical gap between children items
|
|
29
|
+
*/
|
|
30
|
+
gap?: AccordionGap;
|
|
31
|
+
theme?: Theme;
|
|
32
|
+
/**
|
|
33
|
+
* Active collapse key. Must be used with `itemKey` prop on the collapse items.
|
|
34
|
+
* Any value except `undefined` turns accordion into controlled mode.
|
|
35
|
+
*/
|
|
36
|
+
value?: KeyType;
|
|
37
|
+
/**
|
|
38
|
+
* Event which fired when the active collapse item is changed.
|
|
39
|
+
*/
|
|
40
|
+
onChange?: (key: KeyType) => void;
|
|
41
|
+
};
|
|
42
|
+
export declare type AccordionProps = AccordionExplicitProps & Omit<React.HTMLProps<HTMLDivElement>, keyof AccordionExplicitProps | 'ref'>;
|
|
43
|
+
export declare const Accordion: React.ForwardRefExoticComponent<AccordionExplicitProps & Omit<React.HTMLProps<HTMLDivElement>, keyof AccordionExplicitProps | "ref"> & React.RefAttributes<HTMLDivElement>>;
|
package/lib/accordion.js
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
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", "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
|
+
import React, { useState } from 'react';
|
|
18
|
+
import cn from 'classnames';
|
|
19
|
+
import PropTypes from 'prop-types';
|
|
20
|
+
import { useTheme, ThemeProvider } from '@rescui/ui-contexts';
|
|
21
|
+
import { collapseContext } from './context.js';
|
|
22
|
+
import styles from './collapse.p.module.css.js';
|
|
23
|
+
var GAP_STYLES = {
|
|
24
|
+
0: styles.accordionGap0,
|
|
25
|
+
8: styles.accordionGap8,
|
|
26
|
+
12: styles.accordionGap12,
|
|
27
|
+
16: styles.accordionGap16,
|
|
28
|
+
24: styles.accordionGap24,
|
|
29
|
+
32: styles.accordionGap32
|
|
30
|
+
};
|
|
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$gap = _ref.gap,
|
|
45
|
+
gap = _ref$gap === void 0 ? 0 : _ref$gap,
|
|
46
|
+
themeFromProps = _ref.theme,
|
|
47
|
+
value = _ref.value,
|
|
48
|
+
onChange = _ref.onChange,
|
|
49
|
+
restProps = _objectWithoutProperties(_ref, _excluded);
|
|
50
|
+
|
|
51
|
+
var isControlled = typeof value !== 'undefined';
|
|
52
|
+
var theme = useTheme(themeFromProps);
|
|
53
|
+
|
|
54
|
+
var _useState = useState(isControlled ? value : null),
|
|
55
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
56
|
+
openKey = _useState2[0],
|
|
57
|
+
setActiveKey = _useState2[1];
|
|
58
|
+
|
|
59
|
+
var toggleActiveKey = function toggleActiveKey(key) {
|
|
60
|
+
var activatingKey = key !== openKey ? key : null;
|
|
61
|
+
|
|
62
|
+
if (onChange) {
|
|
63
|
+
onChange(activatingKey);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
setActiveKey(activatingKey);
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
return /*#__PURE__*/React.createElement(collapseContext.Provider, {
|
|
70
|
+
value: {
|
|
71
|
+
openedKey: isControlled ? value : openKey,
|
|
72
|
+
isInAccordion: true,
|
|
73
|
+
isInControlledAccordion: isControlled,
|
|
74
|
+
toggleActiveKey: toggleActiveKey,
|
|
75
|
+
setActiveKey: setActiveKey,
|
|
76
|
+
size: size,
|
|
77
|
+
mode: mode,
|
|
78
|
+
icon: icon,
|
|
79
|
+
borderBottom: borderBottom,
|
|
80
|
+
openedClassName: openedClassName
|
|
81
|
+
}
|
|
82
|
+
}, /*#__PURE__*/React.createElement(ThemeProvider, {
|
|
83
|
+
theme: theme
|
|
84
|
+
}, /*#__PURE__*/React.createElement("div", _objectSpread(_objectSpread({
|
|
85
|
+
"data-test": 'accordion'
|
|
86
|
+
}, restProps), {}, {
|
|
87
|
+
className: cn(styles.accordion, GAP_STYLES[gap], className),
|
|
88
|
+
ref: ref
|
|
89
|
+
}), children)));
|
|
90
|
+
});
|
|
91
|
+
Accordion.displayName = 'Accordion';
|
|
92
|
+
Accordion.propTypes = {
|
|
93
|
+
children: PropTypes.node,
|
|
94
|
+
className: PropTypes.string,
|
|
95
|
+
openedClassName: PropTypes.string,
|
|
96
|
+
size: PropTypes.oneOf(['s', 'm', 'l']),
|
|
97
|
+
mode: PropTypes.oneOf(['classic', 'rock', 'clear']),
|
|
98
|
+
icon: PropTypes.oneOf(['arrow', 'left-plus', 'right-plus']),
|
|
99
|
+
gap: PropTypes.oneOf([0, 8, 12, 16, 24, 32]),
|
|
100
|
+
theme: PropTypes.oneOf(['light', 'dark']),
|
|
101
|
+
value: PropTypes.oneOfType([PropTypes.number, PropTypes.string, PropTypes.symbol]),
|
|
102
|
+
onChange: PropTypes.func
|
|
103
|
+
};
|
|
104
|
+
export { Accordion };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Theme } from '@rescui/ui-contexts';
|
|
3
|
+
import type { CollapseBorderRadius, CollapseIcon, CollapseMode, CollapseSize, KeyType } from './types';
|
|
4
|
+
export declare type CollapseExplicitProps = {
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
className?: string;
|
|
7
|
+
/**
|
|
8
|
+
* Classname for the opened state
|
|
9
|
+
*/
|
|
10
|
+
openedClassName?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Collapse title slot
|
|
13
|
+
*/
|
|
14
|
+
title?: React.ReactNode;
|
|
15
|
+
/**
|
|
16
|
+
* Collapse size
|
|
17
|
+
* @default m
|
|
18
|
+
*/
|
|
19
|
+
size?: CollapseSize;
|
|
20
|
+
/**
|
|
21
|
+
* Collapse appearance mode
|
|
22
|
+
* @default classic
|
|
23
|
+
*/
|
|
24
|
+
mode?: CollapseMode;
|
|
25
|
+
/**
|
|
26
|
+
* Collapse icon type
|
|
27
|
+
* @default left-plus
|
|
28
|
+
*/
|
|
29
|
+
icon?: CollapseIcon;
|
|
30
|
+
/**
|
|
31
|
+
* Controls the Collapse bottom border
|
|
32
|
+
* @default false
|
|
33
|
+
*/
|
|
34
|
+
borderBottom?: CollapseBorderRadius;
|
|
35
|
+
/**
|
|
36
|
+
* Is collapse opened by default. Will be ignored in controlled `Accordion`
|
|
37
|
+
*/
|
|
38
|
+
isDefaultOpened?: boolean;
|
|
39
|
+
theme?: Theme;
|
|
40
|
+
/**
|
|
41
|
+
* Collapse item key. May be required for the controlled `Accordion`
|
|
42
|
+
*/
|
|
43
|
+
itemKey?: KeyType;
|
|
44
|
+
};
|
|
45
|
+
export declare type CollapseProps = CollapseExplicitProps & Omit<React.HTMLProps<HTMLDivElement>, keyof CollapseExplicitProps | 'ref'>;
|
|
46
|
+
export declare const Collapse: React.ForwardRefExoticComponent<CollapseExplicitProps & Omit<React.HTMLProps<HTMLDivElement>, keyof CollapseExplicitProps | "ref"> & React.RefAttributes<HTMLDivElement>>;
|
package/lib/collapse.js
ADDED
|
@@ -0,0 +1,197 @@
|
|
|
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", "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
|
+
import React, { useRef, useContext, useState, useEffect } from 'react';
|
|
19
|
+
import cn from 'classnames';
|
|
20
|
+
import PropTypes from 'prop-types';
|
|
21
|
+
import { RightIcon, AddOutlineIcon } from '@rescui/icons';
|
|
22
|
+
import { useTheme, ThemeProvider } from '@rescui/ui-contexts';
|
|
23
|
+
import { useResizeObserver } from '@rescui/use-resize-observer';
|
|
24
|
+
import { collapseContext } from './context.js';
|
|
25
|
+
import { useCollapseState, COLLAPSE_STATES, useStartedClosing } from './use-collapse-state.js';
|
|
26
|
+
import styles from './collapse.p.module.css.js';
|
|
27
|
+
|
|
28
|
+
function getRandId() {
|
|
29
|
+
return Math.random().toString(36).substring(7);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
var THEME_STYLES = {
|
|
33
|
+
light: styles.themeLight,
|
|
34
|
+
dark: styles.themeDark
|
|
35
|
+
};
|
|
36
|
+
var SIZE_STYLES = {
|
|
37
|
+
s: styles.sizeS,
|
|
38
|
+
m: styles.sizeM,
|
|
39
|
+
l: styles.sizeL
|
|
40
|
+
};
|
|
41
|
+
var MODE_STYLES = {
|
|
42
|
+
classic: styles.classic,
|
|
43
|
+
rock: styles.rock,
|
|
44
|
+
clear: styles.clear
|
|
45
|
+
};
|
|
46
|
+
var ICON_STYLES = {
|
|
47
|
+
'left-plus': styles.iconPlus,
|
|
48
|
+
'right-plus': styles.iconPlus,
|
|
49
|
+
arrow: styles.iconArrow
|
|
50
|
+
};
|
|
51
|
+
var Collapse = /*#__PURE__*/React.forwardRef( // eslint-disable-next-line complexity
|
|
52
|
+
function (_ref, ref) {
|
|
53
|
+
var _ref2, _ref3, _ref4, _ref5;
|
|
54
|
+
|
|
55
|
+
var children = _ref.children,
|
|
56
|
+
className = _ref.className,
|
|
57
|
+
openedClassnameFromProps = _ref.openedClassName,
|
|
58
|
+
sizeFromProps = _ref.size,
|
|
59
|
+
modeFromProps = _ref.mode,
|
|
60
|
+
iconFromProps = _ref.icon,
|
|
61
|
+
borderBottomFromProps = _ref.borderBottom,
|
|
62
|
+
title = _ref.title,
|
|
63
|
+
_ref$isDefaultOpened = _ref.isDefaultOpened,
|
|
64
|
+
isDefaultOpened = _ref$isDefaultOpened === void 0 ? false : _ref$isDefaultOpened,
|
|
65
|
+
themeFromProps = _ref.theme,
|
|
66
|
+
itemKey = _ref.itemKey,
|
|
67
|
+
restProps = _objectWithoutProperties(_ref, _excluded);
|
|
68
|
+
|
|
69
|
+
// using the trick from https://github.com/Yaska/react-use-id-hook/
|
|
70
|
+
var _useRef = useRef(itemKey !== null && itemKey !== void 0 ? itemKey : getRandId()),
|
|
71
|
+
key = _useRef.current;
|
|
72
|
+
|
|
73
|
+
var theme = useTheme(themeFromProps);
|
|
74
|
+
|
|
75
|
+
var _useContext = useContext(collapseContext),
|
|
76
|
+
openedKey = _useContext.openedKey,
|
|
77
|
+
isInAccordion = _useContext.isInAccordion,
|
|
78
|
+
isInControlledAccordion = _useContext.isInControlledAccordion,
|
|
79
|
+
toggleActiveKey = _useContext.toggleActiveKey,
|
|
80
|
+
setActiveKey = _useContext.setActiveKey,
|
|
81
|
+
sizeFromContext = _useContext.size,
|
|
82
|
+
modeFromContext = _useContext.mode,
|
|
83
|
+
iconFromContext = _useContext.icon,
|
|
84
|
+
borderBottomFromContext = _useContext.borderBottom,
|
|
85
|
+
openedClassNameFromContext = _useContext.openedClassName;
|
|
86
|
+
|
|
87
|
+
var size = (_ref2 = sizeFromProps !== null && sizeFromProps !== void 0 ? sizeFromProps : sizeFromContext) !== null && _ref2 !== void 0 ? _ref2 : 'm';
|
|
88
|
+
var mode = (_ref3 = modeFromProps !== null && modeFromProps !== void 0 ? modeFromProps : modeFromContext) !== null && _ref3 !== void 0 ? _ref3 : 'classic';
|
|
89
|
+
var icon = (_ref4 = iconFromProps !== null && iconFromProps !== void 0 ? iconFromProps : iconFromContext) !== null && _ref4 !== void 0 ? _ref4 : 'left-plus';
|
|
90
|
+
var borderBottom = (_ref5 = borderBottomFromProps !== null && borderBottomFromProps !== void 0 ? borderBottomFromProps : borderBottomFromContext) !== null && _ref5 !== void 0 ? _ref5 : false;
|
|
91
|
+
var openedClassName = openedClassnameFromProps !== null && openedClassnameFromProps !== void 0 ? openedClassnameFromProps : openedClassNameFromContext; // height calculations
|
|
92
|
+
|
|
93
|
+
var resizeRef = useRef(null);
|
|
94
|
+
|
|
95
|
+
var _useState = useState('initial'),
|
|
96
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
97
|
+
height = _useState2[0],
|
|
98
|
+
setHeight = _useState2[1];
|
|
99
|
+
|
|
100
|
+
useResizeObserver(resizeRef, function (entry) {
|
|
101
|
+
return setHeight(entry.target.offsetHeight);
|
|
102
|
+
});
|
|
103
|
+
var isHeightCalculated = height !== 'initial'; // this state is ignored in accordion
|
|
104
|
+
|
|
105
|
+
var _useState3 = useState(isDefaultOpened),
|
|
106
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
107
|
+
shouldBeOpenedLocal = _useState4[0],
|
|
108
|
+
setShouldBeOpenedLocal = _useState4[1]; // boolean state. ignores CLOSING and OPENING states
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
var shouldBeOpened = isInAccordion ? openedKey === key : shouldBeOpenedLocal; // add CLOSING and OPENING states.
|
|
112
|
+
|
|
113
|
+
var _useCollapseState = useCollapseState({
|
|
114
|
+
shouldBeOpened: shouldBeOpened,
|
|
115
|
+
// because how css transitions work, we shouldn't use OPENING and CLOSING states while height still calculating
|
|
116
|
+
// it also allows us to skip animation on the first renders
|
|
117
|
+
cancelAnimation: !isHeightCalculated
|
|
118
|
+
}),
|
|
119
|
+
handleTransitionEnd = _useCollapseState.onAnimationEnd,
|
|
120
|
+
collapseState = _useCollapseState.state;
|
|
121
|
+
|
|
122
|
+
var isOpening = collapseState === COLLAPSE_STATES.OPENING;
|
|
123
|
+
var isOpened = collapseState === COLLAPSE_STATES.OPEN;
|
|
124
|
+
var isClosing = collapseState === COLLAPSE_STATES.CLOSING;
|
|
125
|
+
var isClosed = collapseState === COLLAPSE_STATES.CLOSE;
|
|
126
|
+
|
|
127
|
+
var _useStartedClosing = useStartedClosing(collapseState),
|
|
128
|
+
isStartedClosing = _useStartedClosing.isStartedClosing,
|
|
129
|
+
contentRef = _useStartedClosing.contentRef;
|
|
130
|
+
|
|
131
|
+
var isRightIcon = icon === 'right-plus';
|
|
132
|
+
var Icon = icon === 'arrow' ? RightIcon : AddOutlineIcon;
|
|
133
|
+
|
|
134
|
+
var toggleOpened = function toggleOpened() {
|
|
135
|
+
if (toggleActiveKey) {
|
|
136
|
+
toggleActiveKey(key);
|
|
137
|
+
} // this state update does nothing in accordion
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
setShouldBeOpenedLocal(!shouldBeOpened);
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
useEffect(function () {
|
|
144
|
+
// for uncontrolled accordion, tell it that this collapse is opened by default
|
|
145
|
+
if (isInAccordion && !isInControlledAccordion && isDefaultOpened && setActiveKey) {
|
|
146
|
+
setActiveKey(key);
|
|
147
|
+
}
|
|
148
|
+
}, []);
|
|
149
|
+
return /*#__PURE__*/React.createElement(ThemeProvider, {
|
|
150
|
+
theme: theme
|
|
151
|
+
}, /*#__PURE__*/React.createElement("div", _objectSpread(_objectSpread({
|
|
152
|
+
"data-test": 'collapse'
|
|
153
|
+
}, restProps), {}, {
|
|
154
|
+
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, isRightIcon ? styles.rightIcon : styles.leftIcon, THEME_STYLES[theme]),
|
|
155
|
+
ref: ref
|
|
156
|
+
}), /*#__PURE__*/React.createElement("button", {
|
|
157
|
+
type: "button",
|
|
158
|
+
className: styles.button,
|
|
159
|
+
onClick: toggleOpened
|
|
160
|
+
}, !isRightIcon && /*#__PURE__*/React.createElement(Icon, {
|
|
161
|
+
className: styles.icon
|
|
162
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
163
|
+
className: cn(styles.title)
|
|
164
|
+
}, title), isRightIcon && /*#__PURE__*/React.createElement(Icon, {
|
|
165
|
+
className: styles.icon
|
|
166
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
167
|
+
className: styles.content,
|
|
168
|
+
style: {
|
|
169
|
+
// So, we set the height value only on OPENING stage and just after beginning CLOSING stage
|
|
170
|
+
// The reason we don't leave this style for OPEN stage is because some content of the expanded Collapse may change its height dynamically
|
|
171
|
+
// This will be processed by resizeObserver, but some devices may lag behind
|
|
172
|
+
// And to make collapsing transition work, we need to have a frame with numbered height value before starting the collapse transition
|
|
173
|
+
maxHeight: (isOpening || isStartedClosing) && height
|
|
174
|
+
},
|
|
175
|
+
ref: contentRef,
|
|
176
|
+
onTransitionEnd: handleTransitionEnd,
|
|
177
|
+
tabIndex: -1
|
|
178
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
179
|
+
ref: resizeRef,
|
|
180
|
+
className: styles.innerWrapper
|
|
181
|
+
}, children))));
|
|
182
|
+
});
|
|
183
|
+
Collapse.displayName = 'Collapse';
|
|
184
|
+
Collapse.propTypes = {
|
|
185
|
+
children: PropTypes.node,
|
|
186
|
+
className: PropTypes.string,
|
|
187
|
+
openedClassName: PropTypes.string,
|
|
188
|
+
size: PropTypes.oneOf(['s', 'm', 'l']),
|
|
189
|
+
mode: PropTypes.oneOf(['classic', 'rock', 'clear']),
|
|
190
|
+
icon: PropTypes.oneOf(['arrow', 'left-plus', 'right-plus']),
|
|
191
|
+
theme: PropTypes.oneOf(['light', 'dark']),
|
|
192
|
+
itemKey: PropTypes.oneOfType([PropTypes.number, PropTypes.string, PropTypes.symbol]),
|
|
193
|
+
isDefaultOpened: PropTypes.bool,
|
|
194
|
+
borderBottom: PropTypes.bool,
|
|
195
|
+
title: PropTypes.node
|
|
196
|
+
};
|
|
197
|
+
export { Collapse };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
var styles = {
|
|
2
|
+
"hasBorderBottom": "_hasBorderBottom_zyxqwq_14",
|
|
3
|
+
"main": "_main_zyxqwq_18",
|
|
4
|
+
"themeLight": "_themeLight_zyxqwq_21",
|
|
5
|
+
"themeDark": "_themeDark_zyxqwq_27",
|
|
6
|
+
"rock": "_rock_zyxqwq_33",
|
|
7
|
+
"opening": "_opening_zyxqwq_34",
|
|
8
|
+
"opened": "_opened_zyxqwq_35",
|
|
9
|
+
"closing": "_closing_zyxqwq_36",
|
|
10
|
+
"classic": "_classic_zyxqwq_50",
|
|
11
|
+
"title": "_title_zyxqwq_108",
|
|
12
|
+
"sizeS": "_sizeS_zyxqwq_113",
|
|
13
|
+
"button": "_button_zyxqwq_113",
|
|
14
|
+
"sizeM": "_sizeM_zyxqwq_116",
|
|
15
|
+
"sizeL": "_sizeL_zyxqwq_119",
|
|
16
|
+
"content": "_content_zyxqwq_124",
|
|
17
|
+
"closingTransition": "_closingTransition_zyxqwq_136",
|
|
18
|
+
"rs-reset-letter-spacing": "_rs-reset-letter-spacing_zyxqwq_1",
|
|
19
|
+
"leftIcon": "_leftIcon_zyxqwq_152",
|
|
20
|
+
"innerWrapper": "_innerWrapper_zyxqwq_151",
|
|
21
|
+
"rightIcon": "_rightIcon_zyxqwq_156",
|
|
22
|
+
"clear": "_clear_zyxqwq_242",
|
|
23
|
+
"icon": "_icon_zyxqwq_269",
|
|
24
|
+
"iconPlus": "_iconPlus_zyxqwq_315",
|
|
25
|
+
"iconArrow": "_iconArrow_zyxqwq_320",
|
|
26
|
+
"accordion": "_accordion_zyxqwq_326",
|
|
27
|
+
"accordionGap0": "_accordionGap0_zyxqwq_330",
|
|
28
|
+
"accordionGap8": "_accordionGap8_zyxqwq_333",
|
|
29
|
+
"accordionGap12": "_accordionGap12_zyxqwq_336",
|
|
30
|
+
"accordionGap16": "_accordionGap16_zyxqwq_339",
|
|
31
|
+
"accordionGap24": "_accordionGap24_zyxqwq_342",
|
|
32
|
+
"accordionGap32": "_accordionGap32_zyxqwq_345"
|
|
33
|
+
};
|
|
34
|
+
export { styles as default };
|
package/lib/context.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { CollapseIcon, CollapseMode, CollapseSize, KeyType } from './types';
|
|
3
|
+
export declare type CollapseContext = {
|
|
4
|
+
openedKey?: KeyType;
|
|
5
|
+
isInAccordion?: boolean;
|
|
6
|
+
isInControlledAccordion?: boolean;
|
|
7
|
+
toggleActiveKey?: (key: KeyType) => void;
|
|
8
|
+
setActiveKey?: (key: KeyType) => void;
|
|
9
|
+
size?: CollapseSize;
|
|
10
|
+
mode?: CollapseMode;
|
|
11
|
+
icon?: CollapseIcon;
|
|
12
|
+
borderBottom?: boolean;
|
|
13
|
+
openedClassName?: string;
|
|
14
|
+
};
|
|
15
|
+
export declare const collapseContext: React.Context<CollapseContext>;
|
package/lib/context.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
var collapseContext = /*#__PURE__*/React.createContext({
|
|
3
|
+
openedKey: null,
|
|
4
|
+
isInAccordion: false,
|
|
5
|
+
isInControlledAccordion: false,
|
|
6
|
+
toggleActiveKey: null,
|
|
7
|
+
setActiveKey: null,
|
|
8
|
+
size: null,
|
|
9
|
+
mode: null,
|
|
10
|
+
icon: null,
|
|
11
|
+
borderBottom: null,
|
|
12
|
+
openedClassName: null
|
|
13
|
+
});
|
|
14
|
+
export { collapseContext };
|
package/lib/index.css
ADDED
|
@@ -0,0 +1,413 @@
|
|
|
1
|
+
._hasBorderBottom_zyxqwq_14{
|
|
2
|
+
border-bottom:1px solid;
|
|
3
|
+
}
|
|
4
|
+
._main_zyxqwq_18{
|
|
5
|
+
position:relative;
|
|
6
|
+
}
|
|
7
|
+
._main_zyxqwq_18._themeLight_zyxqwq_21{
|
|
8
|
+
border-color:rgba(25,25,28,0.2);
|
|
9
|
+
|
|
10
|
+
color:#19191C;
|
|
11
|
+
|
|
12
|
+
color:var(--rs-typography-color-hard, #19191C);
|
|
13
|
+
}
|
|
14
|
+
._main_zyxqwq_18._themeDark_zyxqwq_27{
|
|
15
|
+
border-color:rgba(255,255,255,0.2);
|
|
16
|
+
|
|
17
|
+
color:#FFFFFF;
|
|
18
|
+
|
|
19
|
+
color:var(--rs-typography-color-hard, #FFFFFF);
|
|
20
|
+
}
|
|
21
|
+
._main_zyxqwq_18._hasBorderBottom_zyxqwq_14._rock_zyxqwq_33:active,
|
|
22
|
+
._main_zyxqwq_18._hasBorderBottom_zyxqwq_14._rock_zyxqwq_33._opening_zyxqwq_34,
|
|
23
|
+
._main_zyxqwq_18._hasBorderBottom_zyxqwq_14._rock_zyxqwq_33._opened_zyxqwq_35,
|
|
24
|
+
._main_zyxqwq_18._hasBorderBottom_zyxqwq_14._rock_zyxqwq_33._closing_zyxqwq_36{
|
|
25
|
+
padding-bottom:1px;
|
|
26
|
+
|
|
27
|
+
border-bottom:none;
|
|
28
|
+
}
|
|
29
|
+
@media (hover: hover){
|
|
30
|
+
._main_zyxqwq_18._hasBorderBottom_zyxqwq_14._rock_zyxqwq_33:hover{
|
|
31
|
+
padding-bottom:1px;
|
|
32
|
+
|
|
33
|
+
border-bottom:none;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
@media (hover: hover){
|
|
37
|
+
._main_zyxqwq_18._themeLight_zyxqwq_21._classic_zyxqwq_50:hover{
|
|
38
|
+
background:rgba(25,25,28,0.05);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
._main_zyxqwq_18._themeLight_zyxqwq_21._classic_zyxqwq_50._opening_zyxqwq_34,
|
|
42
|
+
._main_zyxqwq_18._themeLight_zyxqwq_21._classic_zyxqwq_50._opened_zyxqwq_35,
|
|
43
|
+
._main_zyxqwq_18._themeLight_zyxqwq_21._classic_zyxqwq_50._closing_zyxqwq_36{
|
|
44
|
+
background:rgba(25,25,28,0.05);
|
|
45
|
+
}
|
|
46
|
+
@media (hover: hover){
|
|
47
|
+
._main_zyxqwq_18._themeLight_zyxqwq_21._rock_zyxqwq_33:hover{
|
|
48
|
+
--rs-typography-color-hard:#FFFFFF;
|
|
49
|
+
--rs-typography-color-average:rgba(255,255,255,0.7);
|
|
50
|
+
--rs-typography-color-pale:rgba(255,255,255,0.5);
|
|
51
|
+
--rs-typography-pre-color:rgba(255,255,255,0.7);
|
|
52
|
+
--rs-typography-pre-bg-color:rgba(255,255,255,0.1);
|
|
53
|
+
--rs-typography-classic-link-underline-color:rgba(255,255,255,0.4);
|
|
54
|
+
--rs-typography-rock-link-hover-color:#19191C;
|
|
55
|
+
background:rgba(25,25,28,0.9);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
._main_zyxqwq_18._themeLight_zyxqwq_21._rock_zyxqwq_33._opening_zyxqwq_34,
|
|
59
|
+
._main_zyxqwq_18._themeLight_zyxqwq_21._rock_zyxqwq_33._opened_zyxqwq_35,
|
|
60
|
+
._main_zyxqwq_18._themeLight_zyxqwq_21._rock_zyxqwq_33._closing_zyxqwq_36{
|
|
61
|
+
--rs-typography-color-hard:#FFFFFF;
|
|
62
|
+
--rs-typography-color-average:rgba(255,255,255,0.7);
|
|
63
|
+
--rs-typography-color-pale:rgba(255,255,255,0.5);
|
|
64
|
+
--rs-typography-pre-color:rgba(255,255,255,0.7);
|
|
65
|
+
--rs-typography-pre-bg-color:rgba(255,255,255,0.1);
|
|
66
|
+
--rs-typography-classic-link-underline-color:rgba(255,255,255,0.4);
|
|
67
|
+
--rs-typography-rock-link-hover-color:#19191C;
|
|
68
|
+
background:#19191C;
|
|
69
|
+
}
|
|
70
|
+
@media (hover: hover){
|
|
71
|
+
._main_zyxqwq_18._themeDark_zyxqwq_27._classic_zyxqwq_50:hover{
|
|
72
|
+
background:rgba(255,255,255,0.05);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
._main_zyxqwq_18._themeDark_zyxqwq_27._classic_zyxqwq_50._opening_zyxqwq_34,
|
|
76
|
+
._main_zyxqwq_18._themeDark_zyxqwq_27._classic_zyxqwq_50._opened_zyxqwq_35,
|
|
77
|
+
._main_zyxqwq_18._themeDark_zyxqwq_27._classic_zyxqwq_50._closing_zyxqwq_36{
|
|
78
|
+
background:rgba(255,255,255,0.05);
|
|
79
|
+
}
|
|
80
|
+
@media (hover: hover){
|
|
81
|
+
._main_zyxqwq_18._themeDark_zyxqwq_27._rock_zyxqwq_33:hover{
|
|
82
|
+
--rs-typography-color-hard:#19191C;
|
|
83
|
+
--rs-typography-color-average:rgba(25,25,28,0.7);
|
|
84
|
+
--rs-typography-color-pale:rgba(25,25,28,0.5);
|
|
85
|
+
--rs-typography-pre-color:#19191C;
|
|
86
|
+
--rs-typography-pre-bg-color:rgba(25,25,28,0.1);
|
|
87
|
+
--rs-typography-classic-link-underline-color:rgba(25,25,28,0.4);
|
|
88
|
+
--rs-typography-rock-link-hover-color:#FFFFFF;
|
|
89
|
+
background:rgba(255,255,255,0.9);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
._main_zyxqwq_18._themeDark_zyxqwq_27._rock_zyxqwq_33._opening_zyxqwq_34,
|
|
93
|
+
._main_zyxqwq_18._themeDark_zyxqwq_27._rock_zyxqwq_33._opened_zyxqwq_35,
|
|
94
|
+
._main_zyxqwq_18._themeDark_zyxqwq_27._rock_zyxqwq_33._closing_zyxqwq_36{
|
|
95
|
+
--rs-typography-color-hard:#19191C;
|
|
96
|
+
--rs-typography-color-average:rgba(25,25,28,0.7);
|
|
97
|
+
--rs-typography-color-pale:rgba(25,25,28,0.5);
|
|
98
|
+
--rs-typography-pre-color:#19191C;
|
|
99
|
+
--rs-typography-pre-bg-color:rgba(25,25,28,0.1);
|
|
100
|
+
--rs-typography-classic-link-underline-color:rgba(25,25,28,0.4);
|
|
101
|
+
--rs-typography-rock-link-hover-color:#FFFFFF;
|
|
102
|
+
background:#FFFFFF;
|
|
103
|
+
}
|
|
104
|
+
._title_zyxqwq_108{
|
|
105
|
+
-webkit-box-flex:1;
|
|
106
|
+
-ms-flex:1 1 auto;
|
|
107
|
+
flex:1 1 auto;
|
|
108
|
+
|
|
109
|
+
color:inherit;
|
|
110
|
+
}
|
|
111
|
+
._sizeS_zyxqwq_113 > ._button_zyxqwq_113 > ._title_zyxqwq_108{
|
|
112
|
+
font-family:'JetBrains Sans', Inter, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Droid Sans', 'Helvetica Neue', Arial, sans-serif;
|
|
113
|
+
font-family:var(--rs-font-family-ui, var(--rs-font-family-jb-sans, 'JetBrains Sans', Inter, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Droid Sans', 'Helvetica Neue', Arial, sans-serif));
|
|
114
|
+
-webkit-font-feature-settings:"kern", "liga", "calt";
|
|
115
|
+
font-feature-settings:"kern", "liga", "calt";
|
|
116
|
+
font-size:13px;
|
|
117
|
+
font-size:var(--rs-h5-font-size, 13px);
|
|
118
|
+
font-weight:530;
|
|
119
|
+
font-weight:var(--rs-font-weight-semi-bold, 530);
|
|
120
|
+
line-height:20px;
|
|
121
|
+
line-height:var(--rs-h5-line-height, 20px);
|
|
122
|
+
}
|
|
123
|
+
._sizeM_zyxqwq_116 > ._button_zyxqwq_113 > ._title_zyxqwq_108{
|
|
124
|
+
font-family:'JetBrains Sans', Inter, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Droid Sans', 'Helvetica Neue', Arial, sans-serif;
|
|
125
|
+
font-family:var(--rs-font-family-ui, var(--rs-font-family-jb-sans, 'JetBrains Sans', Inter, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Droid Sans', 'Helvetica Neue', Arial, sans-serif));
|
|
126
|
+
-webkit-font-feature-settings:"kern", "liga", "calt";
|
|
127
|
+
font-feature-settings:"kern", "liga", "calt";
|
|
128
|
+
font-size:16px;
|
|
129
|
+
font-size:var(--rs-h4-font-size, 16px);
|
|
130
|
+
font-weight:530;
|
|
131
|
+
font-weight:var(--rs-font-weight-semi-bold, 530);
|
|
132
|
+
line-height:24px;
|
|
133
|
+
line-height:var(--rs-h4-line-height, 24px);
|
|
134
|
+
}
|
|
135
|
+
._sizeL_zyxqwq_119 > ._button_zyxqwq_113 > ._title_zyxqwq_108{
|
|
136
|
+
letter-spacing:normal;
|
|
137
|
+
font-family:'JetBrains Sans', Inter, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Droid Sans', 'Helvetica Neue', Arial, sans-serif;
|
|
138
|
+
font-family:var(--rs-font-family-ui, var(--rs-font-family-jb-sans, 'JetBrains Sans', Inter, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Droid Sans', 'Helvetica Neue', Arial, sans-serif));
|
|
139
|
+
-webkit-font-feature-settings:"kern", "liga", "calt";
|
|
140
|
+
font-feature-settings:"kern", "liga", "calt";
|
|
141
|
+
font-size:20px;
|
|
142
|
+
font-size:var(--rs-h3-font-size, 20px);
|
|
143
|
+
font-weight:530;
|
|
144
|
+
font-weight:var(--rs-font-weight-semi-bold, 530);
|
|
145
|
+
line-height:28px;
|
|
146
|
+
line-height:var(--rs-h3-line-height, 28px);
|
|
147
|
+
}
|
|
148
|
+
._content_zyxqwq_124{
|
|
149
|
+
overflow-y:hidden;
|
|
150
|
+
|
|
151
|
+
max-height:0;
|
|
152
|
+
|
|
153
|
+
color:inherit;
|
|
154
|
+
}
|
|
155
|
+
._opened_zyxqwq_35 > ._content_zyxqwq_124{
|
|
156
|
+
max-height:initial;
|
|
157
|
+
}
|
|
158
|
+
._opening_zyxqwq_34 > ._content_zyxqwq_124,
|
|
159
|
+
._closingTransition_zyxqwq_136 > ._content_zyxqwq_124{
|
|
160
|
+
-webkit-transition:max-height 300ms;
|
|
161
|
+
transition:max-height 300ms;
|
|
162
|
+
}
|
|
163
|
+
._sizeS_zyxqwq_113 > ._content_zyxqwq_124{
|
|
164
|
+
letter-spacing:0.0045em;
|
|
165
|
+
font-family:'JetBrains Sans', Inter, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Droid Sans', 'Helvetica Neue', Arial, sans-serif;
|
|
166
|
+
font-family:var(--rs-font-family-ui, var(--rs-font-family-jb-sans, 'JetBrains Sans', Inter, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Droid Sans', 'Helvetica Neue', Arial, sans-serif));
|
|
167
|
+
-webkit-font-feature-settings:"kern", "liga", "calt";
|
|
168
|
+
font-feature-settings:"kern", "liga", "calt";
|
|
169
|
+
font-size:13px;
|
|
170
|
+
font-size:var(--rs-text-3-font-size, 13px);
|
|
171
|
+
line-height:20px;
|
|
172
|
+
line-height:var(--rs-text-3-line-height, 20px);
|
|
173
|
+
}
|
|
174
|
+
._rs-reset-letter-spacing_zyxqwq_1 ._sizeS_zyxqwq_113 > ._content_zyxqwq_124{
|
|
175
|
+
letter-spacing:normal;
|
|
176
|
+
}
|
|
177
|
+
._sizeM_zyxqwq_116 > ._content_zyxqwq_124{
|
|
178
|
+
letter-spacing:0.0015em;
|
|
179
|
+
font-family:'JetBrains Sans', Inter, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Droid Sans', 'Helvetica Neue', Arial, sans-serif;
|
|
180
|
+
font-family:var(--rs-font-family-ui, var(--rs-font-family-jb-sans, 'JetBrains Sans', Inter, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Droid Sans', 'Helvetica Neue', Arial, sans-serif));
|
|
181
|
+
-webkit-font-feature-settings:"kern", "liga", "calt";
|
|
182
|
+
font-feature-settings:"kern", "liga", "calt";
|
|
183
|
+
font-size:16px;
|
|
184
|
+
font-size:var(--rs-text-2-font-size, 16px);
|
|
185
|
+
font-weight:400;
|
|
186
|
+
line-height:24px;
|
|
187
|
+
line-height:var(--rs-text-2-line-height, 24px);
|
|
188
|
+
}
|
|
189
|
+
._rs-reset-letter-spacing_zyxqwq_1 ._sizeM_zyxqwq_116 > ._content_zyxqwq_124{
|
|
190
|
+
letter-spacing:normal;
|
|
191
|
+
}
|
|
192
|
+
._sizeL_zyxqwq_119 > ._content_zyxqwq_124{
|
|
193
|
+
font-family:'JetBrains Sans', Inter, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Droid Sans', 'Helvetica Neue', Arial, sans-serif;
|
|
194
|
+
font-family:var(--rs-font-family-ui, var(--rs-font-family-jb-sans, 'JetBrains Sans', Inter, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Droid Sans', 'Helvetica Neue', Arial, sans-serif));
|
|
195
|
+
-webkit-font-feature-settings:"kern", "liga", "calt";
|
|
196
|
+
font-feature-settings:"kern", "liga", "calt";
|
|
197
|
+
font-size:20px;
|
|
198
|
+
font-size:var(--rs-text-1-font-size, 20px);
|
|
199
|
+
font-weight:normal;
|
|
200
|
+
line-height:28px;
|
|
201
|
+
line-height:var(--rs-text-1-line-height, 28px);
|
|
202
|
+
}
|
|
203
|
+
._sizeS_zyxqwq_113._leftIcon_zyxqwq_152 > ._content_zyxqwq_124 > ._innerWrapper_zyxqwq_151{
|
|
204
|
+
padding:0 8px 8px 36px;
|
|
205
|
+
}
|
|
206
|
+
._sizeS_zyxqwq_113._rightIcon_zyxqwq_156 > ._content_zyxqwq_124 > ._innerWrapper_zyxqwq_151{
|
|
207
|
+
padding:0 8px 8px 8px;
|
|
208
|
+
}
|
|
209
|
+
._sizeM_zyxqwq_116._leftIcon_zyxqwq_152 > ._content_zyxqwq_124 > ._innerWrapper_zyxqwq_151{
|
|
210
|
+
padding:0 8px 8px 40px;
|
|
211
|
+
}
|
|
212
|
+
._sizeM_zyxqwq_116._rightIcon_zyxqwq_156 > ._content_zyxqwq_124 > ._innerWrapper_zyxqwq_151{
|
|
213
|
+
padding:0 8px 8px 8px;
|
|
214
|
+
}
|
|
215
|
+
._sizeL_zyxqwq_119._leftIcon_zyxqwq_152 > ._content_zyxqwq_124 > ._innerWrapper_zyxqwq_151{
|
|
216
|
+
padding:0 16px 16px 60px;
|
|
217
|
+
}
|
|
218
|
+
._sizeL_zyxqwq_119._rightIcon_zyxqwq_156 > ._content_zyxqwq_124 > ._innerWrapper_zyxqwq_151{
|
|
219
|
+
padding:0 16px 16px 16px;
|
|
220
|
+
}
|
|
221
|
+
._button_zyxqwq_113{
|
|
222
|
+
position:relative;
|
|
223
|
+
|
|
224
|
+
display:-webkit-box;
|
|
225
|
+
|
|
226
|
+
display:-ms-flexbox;
|
|
227
|
+
|
|
228
|
+
display:flex;
|
|
229
|
+
|
|
230
|
+
overflow:visible;
|
|
231
|
+
-webkit-box-align:start;
|
|
232
|
+
-ms-flex-align:start;
|
|
233
|
+
align-items:flex-start;
|
|
234
|
+
|
|
235
|
+
width:100%;
|
|
236
|
+
margin:0;
|
|
237
|
+
|
|
238
|
+
border:none;
|
|
239
|
+
|
|
240
|
+
cursor:pointer;
|
|
241
|
+
text-align:left;
|
|
242
|
+
|
|
243
|
+
color:inherit;
|
|
244
|
+
|
|
245
|
+
background:transparent;
|
|
246
|
+
|
|
247
|
+
font:inherit;
|
|
248
|
+
line-height:normal;
|
|
249
|
+
-webkit-font-smoothing:inherit;
|
|
250
|
+
-moz-osx-font-smoothing:inherit;
|
|
251
|
+
-webkit-appearance:none;
|
|
252
|
+
}
|
|
253
|
+
._button_zyxqwq_113::-moz-focus-inner{
|
|
254
|
+
padding:0;
|
|
255
|
+
|
|
256
|
+
border:0;
|
|
257
|
+
}
|
|
258
|
+
._sizeS_zyxqwq_113 > ._button_zyxqwq_113{
|
|
259
|
+
padding:6px 8px;
|
|
260
|
+
}
|
|
261
|
+
._sizeM_zyxqwq_116 > ._button_zyxqwq_113{
|
|
262
|
+
padding:8px 8px;
|
|
263
|
+
}
|
|
264
|
+
._sizeL_zyxqwq_119 > ._button_zyxqwq_113{
|
|
265
|
+
padding:12px 16px;
|
|
266
|
+
}
|
|
267
|
+
._button_zyxqwq_113:focus{
|
|
268
|
+
outline:none;
|
|
269
|
+
}
|
|
270
|
+
._themeLight_zyxqwq_21 ._button_zyxqwq_113{
|
|
271
|
+
color:#19191C;
|
|
272
|
+
color:var(--rs-typography-color-hard, #19191C);
|
|
273
|
+
}
|
|
274
|
+
._themeDark_zyxqwq_27 ._button_zyxqwq_113{
|
|
275
|
+
color:#FFFFFF;
|
|
276
|
+
color:var(--rs-typography-color-hard, #FFFFFF);
|
|
277
|
+
}
|
|
278
|
+
._themeLight_zyxqwq_21 > ._button_zyxqwq_113:focus[data-focus-method='key']{
|
|
279
|
+
-webkit-box-shadow:rgba(107, 87, 255, 0.8) 0 0 0 4px;
|
|
280
|
+
-webkit-box-shadow:var(--rs-color-primary-t-dim-light-theme, rgba(107, 87, 255, 0.8)) 0 0 0 4px;
|
|
281
|
+
box-shadow:rgba(107, 87, 255, 0.8) 0 0 0 4px;
|
|
282
|
+
box-shadow:var(--rs-color-primary-t-dim-light-theme, rgba(107, 87, 255, 0.8)) 0 0 0 4px;
|
|
283
|
+
}
|
|
284
|
+
._themeDark_zyxqwq_27 > ._button_zyxqwq_113:focus[data-focus-method='key']{
|
|
285
|
+
-webkit-box-shadow:rgba(132, 115, 255,0.8) 0 0 0 4px;
|
|
286
|
+
-webkit-box-shadow:var(--rs-color-primary-t-dim-dark-theme, rgba(132, 115, 255,0.8)) 0 0 0 4px;
|
|
287
|
+
box-shadow:rgba(132, 115, 255,0.8) 0 0 0 4px;
|
|
288
|
+
box-shadow:var(--rs-color-primary-t-dim-dark-theme, rgba(132, 115, 255,0.8)) 0 0 0 4px;
|
|
289
|
+
}
|
|
290
|
+
._themeLight_zyxqwq_21._clear_zyxqwq_242 > ._button_zyxqwq_113:hover{
|
|
291
|
+
color:rgba(25,25,28,0.7);
|
|
292
|
+
color:var(--rs-typography-color-average, rgba(25,25,28,0.7));
|
|
293
|
+
}
|
|
294
|
+
._themeDark_zyxqwq_27._clear_zyxqwq_242 > ._button_zyxqwq_113:hover{
|
|
295
|
+
color:rgba(255,255,255,0.7);
|
|
296
|
+
color:var(--rs-typography-color-average, rgba(255,255,255,0.7));
|
|
297
|
+
}
|
|
298
|
+
._themeLight_zyxqwq_21._classic_zyxqwq_50 > ._button_zyxqwq_113:active{
|
|
299
|
+
background:rgba(25,25,28,0.05);
|
|
300
|
+
}
|
|
301
|
+
._themeLight_zyxqwq_21._rock_zyxqwq_33 > ._button_zyxqwq_113:active{
|
|
302
|
+
--rs-typography-color-hard:#FFFFFF;
|
|
303
|
+
--rs-typography-color-average:rgba(255,255,255,0.7);
|
|
304
|
+
--rs-typography-color-pale:rgba(255,255,255,0.5);
|
|
305
|
+
--rs-typography-pre-color:rgba(255,255,255,0.7);
|
|
306
|
+
--rs-typography-pre-bg-color:rgba(255,255,255,0.1);
|
|
307
|
+
--rs-typography-classic-link-underline-color:rgba(255,255,255,0.4);
|
|
308
|
+
--rs-typography-rock-link-hover-color:#19191C;
|
|
309
|
+
background:#19191C;
|
|
310
|
+
}
|
|
311
|
+
._themeDark_zyxqwq_27._classic_zyxqwq_50 > ._button_zyxqwq_113:active{
|
|
312
|
+
background:rgba(255,255,255,0.1);
|
|
313
|
+
}
|
|
314
|
+
._themeDark_zyxqwq_27._rock_zyxqwq_33 > ._button_zyxqwq_113:active{
|
|
315
|
+
--rs-typography-color-hard:#19191C;
|
|
316
|
+
--rs-typography-color-average:rgba(25,25,28,0.7);
|
|
317
|
+
--rs-typography-color-pale:rgba(25,25,28,0.5);
|
|
318
|
+
--rs-typography-pre-color:#19191C;
|
|
319
|
+
--rs-typography-pre-bg-color:rgba(25,25,28,0.1);
|
|
320
|
+
--rs-typography-classic-link-underline-color:rgba(25,25,28,0.4);
|
|
321
|
+
--rs-typography-rock-link-hover-color:#FFFFFF;
|
|
322
|
+
background:#FFFFFF;
|
|
323
|
+
}
|
|
324
|
+
._icon_zyxqwq_269{
|
|
325
|
+
position:relative;
|
|
326
|
+
top:0;
|
|
327
|
+
left:0;
|
|
328
|
+
|
|
329
|
+
-webkit-box-flex:0;
|
|
330
|
+
|
|
331
|
+
-ms-flex:0 0 auto;
|
|
332
|
+
|
|
333
|
+
flex:0 0 auto;
|
|
334
|
+
|
|
335
|
+
-webkit-transition:-webkit-transform 300ms;
|
|
336
|
+
|
|
337
|
+
transition:-webkit-transform 300ms;
|
|
338
|
+
|
|
339
|
+
transition:transform 300ms;
|
|
340
|
+
|
|
341
|
+
transition:transform 300ms, -webkit-transform 300ms;
|
|
342
|
+
|
|
343
|
+
will-change:transform;
|
|
344
|
+
-webkit-transform-origin:center center;
|
|
345
|
+
transform-origin:center center;
|
|
346
|
+
}
|
|
347
|
+
._sizeS_zyxqwq_113 > ._button_zyxqwq_113 > ._icon_zyxqwq_269{
|
|
348
|
+
width:20px;
|
|
349
|
+
height:20px;
|
|
350
|
+
}
|
|
351
|
+
._sizeM_zyxqwq_116 > ._button_zyxqwq_113 > ._icon_zyxqwq_269{
|
|
352
|
+
width:24px;
|
|
353
|
+
height:24px;
|
|
354
|
+
}
|
|
355
|
+
._sizeL_zyxqwq_119 > ._button_zyxqwq_113 > ._icon_zyxqwq_269{
|
|
356
|
+
width:28px;
|
|
357
|
+
height:28px;
|
|
358
|
+
}
|
|
359
|
+
._sizeS_zyxqwq_113._leftIcon_zyxqwq_152 > ._button_zyxqwq_113 > ._icon_zyxqwq_269{
|
|
360
|
+
margin-right:8px;
|
|
361
|
+
}
|
|
362
|
+
._sizeS_zyxqwq_113._rightIcon_zyxqwq_156 > ._button_zyxqwq_113 > ._icon_zyxqwq_269{
|
|
363
|
+
margin-left:8px;
|
|
364
|
+
}
|
|
365
|
+
._sizeM_zyxqwq_116._leftIcon_zyxqwq_152 > ._button_zyxqwq_113 > ._icon_zyxqwq_269{
|
|
366
|
+
margin-right:8px;
|
|
367
|
+
}
|
|
368
|
+
._sizeM_zyxqwq_116._rightIcon_zyxqwq_156 > ._button_zyxqwq_113 > ._icon_zyxqwq_269{
|
|
369
|
+
margin-left:8px;
|
|
370
|
+
}
|
|
371
|
+
._sizeL_zyxqwq_119._leftIcon_zyxqwq_152 > ._button_zyxqwq_113 > ._icon_zyxqwq_269{
|
|
372
|
+
margin-right:16px;
|
|
373
|
+
}
|
|
374
|
+
._sizeL_zyxqwq_119._rightIcon_zyxqwq_156 > ._button_zyxqwq_113 > ._icon_zyxqwq_269{
|
|
375
|
+
margin-left:16px;
|
|
376
|
+
}
|
|
377
|
+
._opening_zyxqwq_34._iconPlus_zyxqwq_315 > ._button_zyxqwq_113 > ._icon_zyxqwq_269,
|
|
378
|
+
._opened_zyxqwq_35._iconPlus_zyxqwq_315 > ._button_zyxqwq_113 > ._icon_zyxqwq_269{
|
|
379
|
+
-webkit-transform:rotate(45deg);
|
|
380
|
+
transform:rotate(45deg);
|
|
381
|
+
}
|
|
382
|
+
._opening_zyxqwq_34._iconArrow_zyxqwq_320 > ._button_zyxqwq_113 > ._icon_zyxqwq_269,
|
|
383
|
+
._opened_zyxqwq_35._iconArrow_zyxqwq_320 > ._button_zyxqwq_113 > ._icon_zyxqwq_269{
|
|
384
|
+
-webkit-transform:rotate(90deg);
|
|
385
|
+
transform:rotate(90deg);
|
|
386
|
+
}
|
|
387
|
+
._accordion_zyxqwq_326{
|
|
388
|
+
display:-webkit-box;
|
|
389
|
+
display:-ms-flexbox;
|
|
390
|
+
display:flex;
|
|
391
|
+
-webkit-box-orient:vertical;
|
|
392
|
+
-webkit-box-direction:normal;
|
|
393
|
+
-ms-flex-direction:column;
|
|
394
|
+
flex-direction:column;
|
|
395
|
+
}
|
|
396
|
+
._accordionGap0_zyxqwq_330{
|
|
397
|
+
row-gap:0;
|
|
398
|
+
}
|
|
399
|
+
._accordionGap8_zyxqwq_333{
|
|
400
|
+
row-gap:8px;
|
|
401
|
+
}
|
|
402
|
+
._accordionGap12_zyxqwq_336{
|
|
403
|
+
row-gap:12px;
|
|
404
|
+
}
|
|
405
|
+
._accordionGap16_zyxqwq_339{
|
|
406
|
+
row-gap:16px;
|
|
407
|
+
}
|
|
408
|
+
._accordionGap24_zyxqwq_342{
|
|
409
|
+
row-gap:24px;
|
|
410
|
+
}
|
|
411
|
+
._accordionGap32_zyxqwq_345{
|
|
412
|
+
row-gap:32px;
|
|
413
|
+
}
|
package/lib/index.d.ts
ADDED
package/lib/index.js
ADDED
package/lib/types.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare type CollapseSize = 's' | 'm' | 'l';
|
|
2
|
+
export declare type CollapseMode = 'classic' | 'rock' | 'clear';
|
|
3
|
+
export declare type CollapseIcon = 'left-plus' | 'right-plus' | 'arrow';
|
|
4
|
+
export declare type CollapseBorderRadius = 0 | 8 | 16 | 24;
|
|
5
|
+
export declare type KeyType = number | string | symbol;
|
|
6
|
+
export declare type AccordionGap = 0 | 8 | 12 | 16 | 24 | 32;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare enum COLLAPSE_STATES {
|
|
3
|
+
OPENING = "OPENING",
|
|
4
|
+
OPEN = "OPEN",
|
|
5
|
+
CLOSING = "CLOSING",
|
|
6
|
+
CLOSE = "CLOSE"
|
|
7
|
+
}
|
|
8
|
+
export declare function useCollapseState({ shouldBeOpened, cancelAnimation }: {
|
|
9
|
+
shouldBeOpened: boolean;
|
|
10
|
+
cancelAnimation?: boolean;
|
|
11
|
+
}): {
|
|
12
|
+
onAnimationEnd: () => void;
|
|
13
|
+
state: COLLAPSE_STATES;
|
|
14
|
+
};
|
|
15
|
+
export declare function useStartedClosing(state: COLLAPSE_STATES): {
|
|
16
|
+
isStartedClosing: boolean;
|
|
17
|
+
contentRef: import("react").MutableRefObject<HTMLDivElement>;
|
|
18
|
+
};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
|
|
2
|
+
import { useState, useRef, useCallback } from 'react';
|
|
3
|
+
var COLLAPSE_STATES;
|
|
4
|
+
|
|
5
|
+
(function (COLLAPSE_STATES) {
|
|
6
|
+
COLLAPSE_STATES["OPENING"] = "OPENING";
|
|
7
|
+
COLLAPSE_STATES["OPEN"] = "OPEN";
|
|
8
|
+
COLLAPSE_STATES["CLOSING"] = "CLOSING";
|
|
9
|
+
COLLAPSE_STATES["CLOSE"] = "CLOSE";
|
|
10
|
+
})(COLLAPSE_STATES || (COLLAPSE_STATES = {})); // eslint-disable-next-line complexity
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
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 () {
|
|
23
|
+
if ((stateRef.current === COLLAPSE_STATES.CLOSING || stateRef.current === COLLAPSE_STATES.OPENING) && !shouldBeOpened) {
|
|
24
|
+
stateRef.current = COLLAPSE_STATES.CLOSE; //force rerender
|
|
25
|
+
|
|
26
|
+
setDummyState(function (s) {
|
|
27
|
+
return !s;
|
|
28
|
+
});
|
|
29
|
+
} else if (stateRef.current === COLLAPSE_STATES.OPENING && shouldBeOpened) {
|
|
30
|
+
stateRef.current = COLLAPSE_STATES.OPEN; //force rerender
|
|
31
|
+
|
|
32
|
+
setDummyState(function (s) {
|
|
33
|
+
return !s;
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
}, [shouldBeOpened]);
|
|
37
|
+
|
|
38
|
+
if (shouldBeOpened && stateRef.current !== COLLAPSE_STATES.OPEN) {
|
|
39
|
+
stateRef.current = cancelAnimation ? COLLAPSE_STATES.OPEN : COLLAPSE_STATES.OPENING;
|
|
40
|
+
} else if ((stateRef.current === COLLAPSE_STATES.OPEN || stateRef.current === COLLAPSE_STATES.OPENING) && !shouldBeOpened) {
|
|
41
|
+
stateRef.current = cancelAnimation ? COLLAPSE_STATES.CLOSE : COLLAPSE_STATES.CLOSING;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return {
|
|
45
|
+
onAnimationEnd: onAnimationEnd,
|
|
46
|
+
state: stateRef.current
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
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];
|
|
58
|
+
|
|
59
|
+
if (prevState.current === COLLAPSE_STATES.OPEN && state === COLLAPSE_STATES.CLOSING) {
|
|
60
|
+
isStartedClosingRef.current = true; // the next frame we need to force layout recalculations and new render
|
|
61
|
+
|
|
62
|
+
if (typeof window !== 'undefined') {
|
|
63
|
+
requestAnimationFrame(function () {
|
|
64
|
+
if (!contentRef.current || !isStartedClosingRef.current) {
|
|
65
|
+
return;
|
|
66
|
+
} // force layout recalc, without this step firefox doesn't register style values for transitions
|
|
67
|
+
// eslint-disable-next-line no-unused-expressions
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
contentRef.current.offsetHeight;
|
|
71
|
+
isStartedClosingRef.current = false;
|
|
72
|
+
setDummyState(function (s) {
|
|
73
|
+
return !s;
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
prevState.current = state;
|
|
80
|
+
return {
|
|
81
|
+
isStartedClosing: isStartedClosingRef.current,
|
|
82
|
+
contentRef: contentRef
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export { COLLAPSE_STATES, useCollapseState, useStartedClosing };
|
package/package.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@rescui/collapse",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"author": "JetBrains",
|
|
7
|
+
"main": "lib/index.js",
|
|
8
|
+
"src:main": "src/index.ts",
|
|
9
|
+
"files": [
|
|
10
|
+
"lib",
|
|
11
|
+
"LICENSE.txt"
|
|
12
|
+
],
|
|
13
|
+
"publishConfig": {
|
|
14
|
+
"access": "public"
|
|
15
|
+
},
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"@babel/runtime-corejs3": "^7.14.0",
|
|
18
|
+
"@rescui/icons": "^0.13.0",
|
|
19
|
+
"@rescui/use-resize-observer": "^0.1.4",
|
|
20
|
+
"classnames": "^2.2.6",
|
|
21
|
+
"core-js": "^3.9.1"
|
|
22
|
+
},
|
|
23
|
+
"peerDependencies": {
|
|
24
|
+
"@rescui/ui-contexts": "^0.4.0",
|
|
25
|
+
"prop-types": "^15.7.2",
|
|
26
|
+
"react": ">=16.8.0 <19"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@rescui/colors": "^0.1.6",
|
|
30
|
+
"@rescui/scripts": "^0.2.0",
|
|
31
|
+
"@rescui/typography": "^0.11.0",
|
|
32
|
+
"@rescui/visual-regression": "^0.1.0",
|
|
33
|
+
"@types/classnames": "^2.2.11"
|
|
34
|
+
},
|
|
35
|
+
"scripts": {
|
|
36
|
+
"build": "rescui-scripts build"
|
|
37
|
+
},
|
|
38
|
+
"gitHead": "508e99e53d34798527a14ceae356351c95937915"
|
|
39
|
+
}
|