@salutejs/plasma-new-hope 0.88.0-canary.1223.9382521438.0 → 0.88.0-canary.1223.9398061354.0
Sign up to get free protection for your applications and to get access to all the features.
- package/cjs/components/Accordion/Accordion.css +1 -1
- package/cjs/components/Accordion/Accordion.js +12 -10
- package/cjs/components/Accordion/Accordion.js.map +1 -1
- package/cjs/components/Accordion/Accordion.styles.js +1 -1
- package/cjs/components/Accordion/Accordion.styles.js.map +1 -1
- package/cjs/components/Accordion/{Accordion.styles_1mo1sxr.css → Accordion.styles_rsiff6.css} +1 -1
- package/cjs/components/Accordion/Accordion.tokens.js +2 -1
- package/cjs/components/Accordion/Accordion.tokens.js.map +1 -1
- package/cjs/components/Accordion/ui/AccordionItem/AccordionItem.js +21 -15
- package/cjs/components/Accordion/ui/AccordionItem/AccordionItem.js.map +1 -1
- package/cjs/components/Accordion/ui/AccordionItem/AccordionItem.styles.js +5 -5
- package/cjs/components/Accordion/ui/AccordionItem/AccordionItem.styles.js.map +1 -1
- package/cjs/components/Accordion/utils/index.js +5 -4
- package/cjs/components/Accordion/utils/index.js.map +1 -1
- package/cjs/components/_Icon/Icon.assets/ChevronDownFill.js +3 -12
- package/cjs/components/_Icon/Icon.assets/ChevronDownFill.js.map +1 -1
- package/cjs/index.css +1 -1
- package/es/components/Accordion/Accordion.css +1 -1
- package/es/components/Accordion/Accordion.js +13 -11
- package/es/components/Accordion/Accordion.js.map +1 -1
- package/es/components/Accordion/Accordion.styles.js +1 -1
- package/es/components/Accordion/Accordion.styles.js.map +1 -1
- package/es/components/Accordion/{Accordion.styles_1mo1sxr.css → Accordion.styles_rsiff6.css} +1 -1
- package/es/components/Accordion/Accordion.tokens.js +2 -1
- package/es/components/Accordion/Accordion.tokens.js.map +1 -1
- package/es/components/Accordion/ui/AccordionItem/AccordionItem.js +21 -15
- package/es/components/Accordion/ui/AccordionItem/AccordionItem.js.map +1 -1
- package/es/components/Accordion/ui/AccordionItem/AccordionItem.styles.js +5 -5
- package/es/components/Accordion/ui/AccordionItem/AccordionItem.styles.js.map +1 -1
- package/es/components/Accordion/utils/index.js +5 -4
- package/es/components/Accordion/utils/index.js.map +1 -1
- package/es/components/_Icon/Icon.assets/ChevronDownFill.js +3 -12
- package/es/components/_Icon/Icon.assets/ChevronDownFill.js.map +1 -1
- package/es/index.css +1 -1
- package/package.json +2 -2
- package/styled-components/cjs/components/Accordion/Accordion.js +12 -10
- package/styled-components/cjs/components/Accordion/Accordion.styles.js +1 -1
- package/styled-components/cjs/components/Accordion/Accordion.tokens.js +2 -1
- package/styled-components/cjs/components/Accordion/ui/AccordionItem/AccordionItem.js +21 -15
- package/styled-components/cjs/components/Accordion/ui/AccordionItem/AccordionItem.styles.js +5 -5
- package/styled-components/cjs/components/Accordion/utils/index.js +5 -4
- package/styled-components/cjs/components/_Icon/Icon.assets/ChevronDownFill.js +3 -12
- package/styled-components/cjs/examples/plasma_b2c/components/Accordion/Accordion.config.js +0 -4
- package/styled-components/cjs/examples/plasma_b2c/components/Accordion/Accordion.stories.tsx +11 -21
- package/styled-components/cjs/examples/plasma_web/components/Accordion/Accordion.stories.tsx +10 -21
- package/styled-components/es/components/Accordion/Accordion.js +13 -11
- package/styled-components/es/components/Accordion/Accordion.styles.js +1 -1
- package/styled-components/es/components/Accordion/Accordion.tokens.js +2 -1
- package/styled-components/es/components/Accordion/ui/AccordionItem/AccordionItem.js +21 -15
- package/styled-components/es/components/Accordion/ui/AccordionItem/AccordionItem.styles.js +5 -5
- package/styled-components/es/components/Accordion/utils/index.js +5 -4
- package/styled-components/es/components/_Icon/Icon.assets/ChevronDownFill.js +3 -12
- package/styled-components/es/examples/plasma_b2c/components/Accordion/Accordion.config.js +0 -4
- package/styled-components/es/examples/plasma_b2c/components/Accordion/Accordion.stories.tsx +11 -21
- package/styled-components/es/examples/plasma_web/components/Accordion/Accordion.stories.tsx +10 -21
- package/types/components/Accordion/Accordion.d.ts +8 -2
- package/types/components/Accordion/Accordion.d.ts.map +1 -1
- package/types/components/Accordion/Accordion.tokens.d.ts +1 -0
- package/types/components/Accordion/Accordion.tokens.d.ts.map +1 -1
- package/types/components/Accordion/Accordion.types.d.ts +14 -6
- package/types/components/Accordion/Accordion.types.d.ts.map +1 -1
- package/types/components/Accordion/ui/AccordionItem/AccordionItem.d.ts.map +1 -1
- package/types/components/Accordion/ui/AccordionItem/AccordionItem.styles.d.ts.map +1 -1
- package/types/components/Accordion/ui/AccordionItem/AccordionItem.types.d.ts +11 -15
- package/types/components/Accordion/ui/AccordionItem/AccordionItem.types.d.ts.map +1 -1
- package/types/components/Accordion/utils/index.d.ts +6 -7
- package/types/components/Accordion/utils/index.d.ts.map +1 -1
- package/types/components/_Icon/Icon.assets/ChevronDownFill.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/Accordion/Accordion.config.d.ts +0 -4
- package/types/examples/plasma_b2c/components/Accordion/Accordion.config.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/Accordion/Accordion.d.ts +4 -5
- package/types/examples/plasma_b2c/components/Accordion/Accordion.d.ts.map +1 -1
- package/types/examples/plasma_web/components/Accordion/Accordion.d.ts +4 -1
- package/types/examples/plasma_web/components/Accordion/Accordion.d.ts.map +1 -1
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.ChevronDownFill = void 0;
|
7
7
|
var _react = /*#__PURE__*/_interopRequireDefault( /*#__PURE__*/require("react"));
|
8
|
-
var
|
8
|
+
var _path;
|
9
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
10
10
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
11
11
|
var ChevronDownFill = exports.ChevronDownFill = function ChevronDownFill(props) {
|
@@ -13,20 +13,11 @@ var ChevronDownFill = exports.ChevronDownFill = function ChevronDownFill(props)
|
|
13
13
|
width: "100%",
|
14
14
|
viewBox: "0 0 16 16",
|
15
15
|
fill: "none"
|
16
|
-
}, props),
|
17
|
-
id: "clip3066_154194"
|
18
|
-
}, /*#__PURE__*/_react["default"].createElement("rect", {
|
19
|
-
width: "16.000000",
|
20
|
-
height: "16.000000",
|
21
|
-
fill: "currentColor",
|
22
|
-
fillOpacity: "0"
|
23
|
-
})))), _g || (_g = /*#__PURE__*/_react["default"].createElement("g", {
|
24
|
-
clipPath: "url(#clip3066_154194)"
|
25
|
-
}, /*#__PURE__*/_react["default"].createElement("path", {
|
16
|
+
}, props), _path || (_path = /*#__PURE__*/_react["default"].createElement("path", {
|
26
17
|
id: "path",
|
27
18
|
d: "M11.45 5.79C11.37 5.61 11.19 5.5 11 5.5L5 5.5C4.8 5.5 4.62 5.61 4.54 5.79C4.46 5.96 4.49 6.17 4.62 6.32L7.62 9.82C7.71 9.93 7.85 10 8 10C8.14 10 8.28 9.93 8.37 9.82L11.37 6.32C11.5 6.17 11.53 5.96 11.45 5.79Z",
|
28
19
|
fillRule: "evenodd",
|
29
20
|
fill: "currentColor",
|
30
21
|
clipRule: "evenodd"
|
31
|
-
})))
|
22
|
+
})));
|
32
23
|
};
|
@@ -21,10 +21,6 @@ var config = exports.config = {
|
|
21
21
|
m: /*#__PURE__*/(0, _styledComponents.css)(["", ":0.875rem;", ":1.125rem;", ":0.375rem;", ":0.75rem;", ":var(--plasma-typo-body-m-font-family);", ":var(--plasma-typo-body-m-font-size);", ":var(--plasma-typo-body-m-font-style);", ":var(--plasma-typo-body-m-bold-font-weight);", ":var(--plasma-typo-body-m-letter-spacing);", ":var(--plasma-typo-body-m-line-height);", ":var(--plasma-typo-body-m-font-family);", ":var(--plasma-typo-body-m-font-size);", ":var(--plasma-typo-body-m-font-style);", ":var(--plasma-typo-body-m-font-weight);", ":var(--plasma-typo-body-m-letter-spacing);", ":var(--plasma-typo-body-m-line-height);"], _Accordion.accordionTokens.accordionItemPaddingVertical, _Accordion.accordionTokens.accordionItemPaddingHorizontal, _Accordion.accordionTokens.accordionItemGap, _Accordion.accordionTokens.accordionItemBorderRadius, _Accordion.accordionTokens.accordionItemTitleFontFamily, _Accordion.accordionTokens.accordionItemTitleFontSize, _Accordion.accordionTokens.accordionItemTitleFontStyle, _Accordion.accordionTokens.accordionItemTitleFontWeight, _Accordion.accordionTokens.accordionItemTitleLetterSpacing, _Accordion.accordionTokens.accordionItemTitleLineHeight, _Accordion.accordionTokens.accordionItemTextFontFamily, _Accordion.accordionTokens.accordionItemTextFontSize, _Accordion.accordionTokens.accordionItemTextFontStyle, _Accordion.accordionTokens.accordionItemTextFontWeight, _Accordion.accordionTokens.accordionItemTextLetterSpacing, _Accordion.accordionTokens.accordionItemTextLineHeight),
|
22
22
|
s: /*#__PURE__*/(0, _styledComponents.css)(["", ":0.6875rem;", ":0.875rem;", ":0.375rem;", ":0.625rem;", ":var(--plasma-typo-body-s-font-family);", ":var(--plasma-typo-body-s-font-size);", ":var(--plasma-typo-body-s-font-style);", ":var(--plasma-typo-body-s-bold-font-weight);", ":var(--plasma-typo-body-s-letter-spacing);", ":var(--plasma-typo-body-s-line-height);", ":var(--plasma-typo-body-s-font-family);", ":var(--plasma-typo-body-s-font-size);", ":var(--plasma-typo-body-s-font-style);", ":var(--plasma-typo-body-s-font-weight);", ":var(--plasma-typo-body-s-letter-spacing);", ":var(--plasma-typo-body-s-line-height);"], _Accordion.accordionTokens.accordionItemPaddingVertical, _Accordion.accordionTokens.accordionItemPaddingHorizontal, _Accordion.accordionTokens.accordionItemGap, _Accordion.accordionTokens.accordionItemBorderRadius, _Accordion.accordionTokens.accordionItemTitleFontFamily, _Accordion.accordionTokens.accordionItemTitleFontSize, _Accordion.accordionTokens.accordionItemTitleFontStyle, _Accordion.accordionTokens.accordionItemTitleFontWeight, _Accordion.accordionTokens.accordionItemTitleLetterSpacing, _Accordion.accordionTokens.accordionItemTitleLineHeight, _Accordion.accordionTokens.accordionItemTextFontFamily, _Accordion.accordionTokens.accordionItemTextFontSize, _Accordion.accordionTokens.accordionItemTextFontStyle, _Accordion.accordionTokens.accordionItemTextFontWeight, _Accordion.accordionTokens.accordionItemTextLetterSpacing, _Accordion.accordionTokens.accordionItemTextLineHeight),
|
23
23
|
xs: /*#__PURE__*/(0, _styledComponents.css)(["", ":0.5rem;", ":0.75rem;", ":0.25rem;", ":0.5rem;", ":var(--plasma-typo-body-xs-font-family);", ":var(--plasma-typo-body-xs-font-size);", ":var(--plasma-typo-body-xs-font-style);", ":var(--plasma-typo-body-xs-bold-font-weight);", ":var(--plasma-typo-body-xs-letter-spacing);", ":var(--plasma-typo-body-xs-line-height);", ":var(--plasma-typo-body-xs-font-family);", ":var(--plasma-typo-body-xs-font-size);", ":var(--plasma-typo-body-xs-font-style);", ":var(--plasma-typo-body-xs-font-weight);", ":var(--plasma-typo-body-xs-letter-spacing);", ":var(--plasma-typo-body-xs-line-height);"], _Accordion.accordionTokens.accordionItemPaddingVertical, _Accordion.accordionTokens.accordionItemPaddingHorizontal, _Accordion.accordionTokens.accordionItemGap, _Accordion.accordionTokens.accordionItemBorderRadius, _Accordion.accordionTokens.accordionItemTitleFontFamily, _Accordion.accordionTokens.accordionItemTitleFontSize, _Accordion.accordionTokens.accordionItemTitleFontStyle, _Accordion.accordionTokens.accordionItemTitleFontWeight, _Accordion.accordionTokens.accordionItemTitleLetterSpacing, _Accordion.accordionTokens.accordionItemTitleLineHeight, _Accordion.accordionTokens.accordionItemTextFontFamily, _Accordion.accordionTokens.accordionItemTextFontSize, _Accordion.accordionTokens.accordionItemTextFontStyle, _Accordion.accordionTokens.accordionItemTextFontWeight, _Accordion.accordionTokens.accordionItemTextLetterSpacing, _Accordion.accordionTokens.accordionItemTextLineHeight)
|
24
|
-
},
|
25
|
-
stretching: {
|
26
|
-
filled: /*#__PURE__*/(0, _styledComponents.css)([""]),
|
27
|
-
fixed: /*#__PURE__*/(0, _styledComponents.css)([""])
|
28
24
|
}
|
29
25
|
}
|
30
26
|
};
|
package/styled-components/cjs/examples/plasma_b2c/components/Accordion/Accordion.stories.tsx
CHANGED
@@ -15,12 +15,12 @@ const meta: Meta<typeof Accordion> = {
|
|
15
15
|
decorators: [WithTheme],
|
16
16
|
component: Accordion,
|
17
17
|
args: {
|
18
|
-
|
18
|
+
singleActive: true,
|
19
19
|
view: 'default',
|
20
20
|
size: 'm',
|
21
21
|
stretching: 'filled',
|
22
|
-
pin: 'square-square',
|
23
22
|
type: 'arrow',
|
23
|
+
disabled: false,
|
24
24
|
title: 'Как оплатить заправку бонусами СберСпасибо?',
|
25
25
|
body:
|
26
26
|
'После указания деталей заправки нажмите кнопку «К оплате». Откроется окно оплаты, где вы сможете списать бонусы и оплатить ими до 99% стоимости топлива',
|
@@ -28,22 +28,6 @@ const meta: Meta<typeof Accordion> = {
|
|
28
28
|
argTypes: {
|
29
29
|
...argTypesFromConfig(mergeConfig(accordionConfig, config)),
|
30
30
|
...disableProps(['text']),
|
31
|
-
pin: {
|
32
|
-
options: [
|
33
|
-
'square-square',
|
34
|
-
'square-clear',
|
35
|
-
'clear-square',
|
36
|
-
'clear-clear',
|
37
|
-
'clear-circle',
|
38
|
-
'circle-clear',
|
39
|
-
'circle-circle',
|
40
|
-
'',
|
41
|
-
],
|
42
|
-
control: {
|
43
|
-
type: 'select',
|
44
|
-
},
|
45
|
-
table: { defaultValue: { summary: 'bottom' } },
|
46
|
-
},
|
47
31
|
stretching: {
|
48
32
|
options: ['filled', 'fixed'],
|
49
33
|
control: {
|
@@ -67,9 +51,15 @@ export const Default: StoryObj<ComponentProps<typeof Accordion>> = {
|
|
67
51
|
|
68
52
|
return (
|
69
53
|
<Accordion {...args}>
|
70
|
-
<AccordionItem type={args.type} pin={args.pin} title={args.title}
|
71
|
-
|
72
|
-
|
54
|
+
<AccordionItem type={args.type} pin={args.pin} title={args.title}>
|
55
|
+
{args.body}
|
56
|
+
</AccordionItem>
|
57
|
+
<AccordionItem type={args.type} pin={args.pin} title={args.title}>
|
58
|
+
{args.body}
|
59
|
+
</AccordionItem>
|
60
|
+
<AccordionItem type={args.type} pin={args.pin} title={args.title}>
|
61
|
+
{args.body}
|
62
|
+
</AccordionItem>
|
73
63
|
</Accordion>
|
74
64
|
);
|
75
65
|
},
|
package/styled-components/cjs/examples/plasma_web/components/Accordion/Accordion.stories.tsx
CHANGED
@@ -15,11 +15,10 @@ const meta: Meta<typeof Accordion> = {
|
|
15
15
|
decorators: [WithTheme],
|
16
16
|
component: Accordion,
|
17
17
|
args: {
|
18
|
-
|
18
|
+
singleActive: true,
|
19
19
|
view: 'default',
|
20
20
|
size: 'm',
|
21
21
|
stretching: 'filled',
|
22
|
-
pin: 'square-square',
|
23
22
|
type: 'arrow',
|
24
23
|
title: 'Как оплатить заправку бонусами СберСпасибо?',
|
25
24
|
body:
|
@@ -28,22 +27,6 @@ const meta: Meta<typeof Accordion> = {
|
|
28
27
|
argTypes: {
|
29
28
|
...argTypesFromConfig(mergeConfig(accordionConfig, config)),
|
30
29
|
...disableProps(['text']),
|
31
|
-
pin: {
|
32
|
-
options: [
|
33
|
-
'square-square',
|
34
|
-
'square-clear',
|
35
|
-
'clear-square',
|
36
|
-
'clear-clear',
|
37
|
-
'clear-circle',
|
38
|
-
'circle-clear',
|
39
|
-
'circle-circle',
|
40
|
-
'',
|
41
|
-
],
|
42
|
-
control: {
|
43
|
-
type: 'select',
|
44
|
-
},
|
45
|
-
table: { defaultValue: { summary: 'bottom' } },
|
46
|
-
},
|
47
30
|
stretching: {
|
48
31
|
options: ['filled', 'fixed'],
|
49
32
|
control: {
|
@@ -67,9 +50,15 @@ export const Default: StoryObj<ComponentProps<typeof Accordion>> = {
|
|
67
50
|
|
68
51
|
return (
|
69
52
|
<Accordion {...args}>
|
70
|
-
<AccordionItem type={args.type} pin={args.pin} title={args.title}
|
71
|
-
|
72
|
-
|
53
|
+
<AccordionItem type={args.type} pin={args.pin} title={args.title}>
|
54
|
+
{args.body}
|
55
|
+
</AccordionItem>
|
56
|
+
<AccordionItem type={args.type} pin={args.pin} title={args.title}>
|
57
|
+
{args.body}
|
58
|
+
</AccordionItem>
|
59
|
+
<AccordionItem type={args.type} pin={args.pin} title={args.title}>
|
60
|
+
{args.body}
|
61
|
+
</AccordionItem>
|
73
62
|
</Accordion>
|
74
63
|
);
|
75
64
|
},
|
@@ -4,7 +4,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
4
4
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
5
5
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
6
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
7
|
-
import React, { Children, forwardRef,
|
7
|
+
import React, { Children, forwardRef, useState } from 'react';
|
8
8
|
import { cx } from '../../utils';
|
9
9
|
import { base } from './Accordion.styles';
|
10
10
|
import { classes } from './Accordion.tokens';
|
@@ -17,29 +17,31 @@ export var accordionRoot = function accordionRoot(Root) {
|
|
17
17
|
view = _ref.view,
|
18
18
|
_ref$stretching = _ref.stretching,
|
19
19
|
stretching = _ref$stretching === void 0 ? 'filled' : _ref$stretching,
|
20
|
+
defaultActiveIndex = _ref.defaultActiveIndex,
|
20
21
|
children = _ref.children,
|
22
|
+
disabled = _ref.disabled,
|
21
23
|
className = _ref.className,
|
22
|
-
|
24
|
+
singleActive = _ref.singleActive,
|
25
|
+
onChangeValue = _ref.onChangeValue;
|
23
26
|
var stretchingClass = classes["".concat(stretching, "Stretching")];
|
24
|
-
var _useState = useState(),
|
27
|
+
var _useState = useState(defaultActiveIndex),
|
25
28
|
_useState2 = _slicedToArray(_useState, 2),
|
26
29
|
activeIndex = _useState2[0],
|
27
30
|
setActiveIndex = _useState2[1];
|
28
31
|
var updateValue = function updateValue(index, value) {
|
29
|
-
|
32
|
+
onChangeValue && onChangeValue(index, value);
|
33
|
+
if (value && singleActive) {
|
34
|
+
setActiveIndex(index);
|
35
|
+
}
|
30
36
|
};
|
31
|
-
var childrenArray =
|
32
|
-
|
33
|
-
}, [children]);
|
34
|
-
var childrenMemo = useMemo(function () {
|
35
|
-
return getChildren(childrenArray, activeIndex, updateValue);
|
36
|
-
}, [activeIndex, updateValue, childrenArray]);
|
37
|
+
var childrenArray = Children.toArray(children);
|
38
|
+
var childrenMemo = getChildren(childrenArray, activeIndex, disabled, updateValue);
|
37
39
|
return /*#__PURE__*/React.createElement(Root, {
|
38
40
|
ref: outerRootRef,
|
39
41
|
size: size,
|
40
42
|
view: view,
|
41
43
|
className: cx(stretchingClass, classes.accordionRoot, className)
|
42
|
-
},
|
44
|
+
}, childrenMemo);
|
43
45
|
});
|
44
46
|
};
|
45
47
|
export var accordionConfig = {
|
@@ -1,3 +1,3 @@
|
|
1
1
|
import { css } from 'styled-components';
|
2
2
|
import { classes, tokens } from './Accordion.tokens';
|
3
|
-
export var base = /*#__PURE__*/css(["display:flex;flex-direction:column;gap:var(", ");align-items:stretch;height:auto;background:var(", ")
|
3
|
+
export var base = /*#__PURE__*/css(["display:flex;flex-direction:column;gap:var(", ");align-items:stretch;height:auto;background:var(", ");&.", "{width:var(", ");}&.", "{width:100%;}"], tokens.accordionGap, tokens.accordionBackground, classes.fixedStretching, tokens.accordionWidth, classes.filledStretching);
|
@@ -5,7 +5,8 @@ export var classes = {
|
|
5
5
|
accordionItem: 'accordion-item',
|
6
6
|
clearAccordionItem: 'clear-accordion-item',
|
7
7
|
accordionItemShowBody: 'accordion-item-show-body',
|
8
|
-
accordionPlusAnimationElement: 'accordion-plus-animation-element'
|
8
|
+
accordionPlusAnimationElement: 'accordion-plus-animation-element',
|
9
|
+
accordionDisabled: 'accordion-disabled'
|
9
10
|
};
|
10
11
|
export var tokens = {
|
11
12
|
accordionGap: '--plasma-accordion-gap',
|
@@ -16,30 +16,34 @@ export var AccordionItem = function AccordionItem(_ref) {
|
|
16
16
|
title = _ref.title,
|
17
17
|
_ref$pin = _ref.pin,
|
18
18
|
pin = _ref$pin === void 0 ? 'square-square' : _ref$pin,
|
19
|
-
|
19
|
+
children = _ref.children,
|
20
20
|
_ref$type = _ref.type,
|
21
21
|
type = _ref$type === void 0 ? 'sign' : _ref$type,
|
22
22
|
index = _ref.index,
|
23
|
-
|
24
|
-
updateValue = _ref.updateValue,
|
23
|
+
disabled = _ref.disabled,
|
25
24
|
onChangeValue = _ref.onChangeValue;
|
26
25
|
var _useState = useState(value),
|
27
26
|
_useState2 = _slicedToArray(_useState, 2),
|
28
|
-
|
27
|
+
isOpen = _useState2[0],
|
29
28
|
setShow = _useState2[1];
|
30
29
|
var _useState3 = useState(),
|
31
30
|
_useState4 = _slicedToArray(_useState3, 2),
|
32
31
|
leftPadding = _useState4[0],
|
33
32
|
setLeftPadding = _useState4[1];
|
34
|
-
var
|
35
|
-
|
36
|
-
|
37
|
-
|
33
|
+
var handleOpen = function handleOpen() {
|
34
|
+
if (disabled) {
|
35
|
+
return;
|
36
|
+
}
|
37
|
+
setShow(!isOpen);
|
38
|
+
onChangeValue && onChangeValue(index, !isOpen);
|
38
39
|
};
|
39
40
|
var onKeyPress = function onKeyPress(event) {
|
41
|
+
if (disabled) {
|
42
|
+
return;
|
43
|
+
}
|
40
44
|
event.persist();
|
41
45
|
if (event.keyCode === 13) {
|
42
|
-
|
46
|
+
handleOpen();
|
43
47
|
}
|
44
48
|
};
|
45
49
|
var leftContentRef = useRef(null);
|
@@ -50,7 +54,7 @@ export var AccordionItem = function AccordionItem(_ref) {
|
|
50
54
|
var leftPaddingBody = leftContentWidth ? "calc(".concat(leftContentWidth, "px + var(").concat(tokens.accordionItemGap, "))") : 0;
|
51
55
|
setLeftPadding(leftPaddingBody);
|
52
56
|
}, [value, type, leftContentRef, setLeftPadding]);
|
53
|
-
var showedBody =
|
57
|
+
var showedBody = isOpen ? classes.accordionItemShowBody : undefined;
|
54
58
|
var StyledAnimationPLus = function StyledAnimationPLus() {
|
55
59
|
return /*#__PURE__*/React.createElement(StyledPlus, null, _StyledMinus || (_StyledMinus = /*#__PURE__*/React.createElement(StyledMinus, {
|
56
60
|
size: "xs",
|
@@ -62,24 +66,26 @@ export var AccordionItem = function AccordionItem(_ref) {
|
|
62
66
|
}));
|
63
67
|
};
|
64
68
|
var accordionBorderRadius = convertRoundnessMatrix(pin, "var(".concat(tokens.accordionItemBorderRadius, ")"), '1.5rem');
|
69
|
+
var disabledClass = disabled ? classes.accordionDisabled : '';
|
65
70
|
var leftContent = contentLeft !== null && contentLeft !== void 0 ? contentLeft : type === 'arrow' ? _StyledArrow || (_StyledArrow = /*#__PURE__*/React.createElement(StyledArrow, {
|
66
71
|
size: "xs",
|
67
72
|
color: "inhert"
|
68
73
|
})) : undefined;
|
69
|
-
var leftContentRotate = type === 'arrow' &&
|
74
|
+
var leftContentRotate = type === 'arrow' && isOpen ? classes.accordionItemShowBody : undefined;
|
70
75
|
var rightContent = contentRight !== null && contentRight !== void 0 ? contentRight : type === 'sign' ? /*#__PURE__*/React.createElement(StyledAnimationPLus, null) : undefined;
|
71
|
-
var rightContentRotate = type === 'sign' &&
|
76
|
+
var rightContentRotate = type === 'sign' && isOpen ? classes.accordionItemShowBody : undefined;
|
72
77
|
return /*#__PURE__*/React.createElement(StyledAccordionItem, {
|
73
78
|
role: "tab",
|
74
79
|
className: classes.accordionItem,
|
75
80
|
tabIndex: 0,
|
76
|
-
key:
|
81
|
+
key: index,
|
77
82
|
style: {
|
78
83
|
borderRadius: accordionBorderRadius
|
79
84
|
},
|
80
85
|
onKeyDown: onKeyPress
|
81
86
|
}, /*#__PURE__*/React.createElement(StyledAccordionHeader, {
|
82
|
-
onClick:
|
87
|
+
onClick: handleOpen,
|
88
|
+
className: disabledClass
|
83
89
|
}, /*#__PURE__*/React.createElement(StyledAccordionHeaderLeft, null, leftContent && /*#__PURE__*/React.createElement(StyledAccordionContentLeft, {
|
84
90
|
ref: leftContentRef,
|
85
91
|
className: leftContentRotate
|
@@ -90,5 +96,5 @@ export var AccordionItem = function AccordionItem(_ref) {
|
|
90
96
|
style: {
|
91
97
|
paddingLeft: "".concat(leftPadding)
|
92
98
|
}
|
93
|
-
}, /*#__PURE__*/React.createElement(StyledAccordionBody, null,
|
99
|
+
}, /*#__PURE__*/React.createElement(StyledAccordionBody, null, children)));
|
94
100
|
};
|
@@ -12,22 +12,22 @@ export var StyledAccordionItem = /*#__PURE__*/styled.div.withConfig({
|
|
12
12
|
}));
|
13
13
|
export var StyledAccordionHeader = /*#__PURE__*/styled.div.withConfig({
|
14
14
|
componentId: "plasma-new-hope__sc-20ij9z-1"
|
15
|
-
})(["padding:var(", ");display:flex;gap:var(", ");justify-content:space-between;align-items:center;cursor:pointer;"], tokens.accordionItemPadding, tokens.accordionItemGap);
|
15
|
+
})(["padding:var(", ");display:flex;gap:var(", ");justify-content:space-between;align-items:center;cursor:pointer;&.", "{opacity:0.4;cursor:not-allowed;}"], tokens.accordionItemPadding, tokens.accordionItemGap, classes.accordionDisabled);
|
16
16
|
export var StyledAccordionHeaderLeft = /*#__PURE__*/styled.div.withConfig({
|
17
17
|
componentId: "plasma-new-hope__sc-20ij9z-2"
|
18
18
|
})(["display:flex;gap:var(", ");justify-content:space-between;align-items:center;"], tokens.accordionItemGap);
|
19
19
|
export var StyledAccordionContentRight = /*#__PURE__*/styled.div.withConfig({
|
20
20
|
componentId: "plasma-new-hope__sc-20ij9z-3"
|
21
|
-
})(["transition:0.2s;transform:rotate(90deg)
|
21
|
+
})(["transition:0.2s;transform:rotate(90deg);&.", "{transition:0.2s;transform:rotate(0deg);}"], classes.accordionItemShowBody);
|
22
22
|
export var StyledAccordionContentLeft = /*#__PURE__*/styled.div.withConfig({
|
23
23
|
componentId: "plasma-new-hope__sc-20ij9z-4"
|
24
|
-
})(["transition:0.2s;display:flex;align-items:center
|
24
|
+
})(["transition:0.2s;display:flex;align-items:center;&.", "{transition:0.2s;transform:rotate(180deg);}"], classes.accordionItemShowBody);
|
25
25
|
export var StyledAccordionTitle = /*#__PURE__*/styled.div.withConfig({
|
26
26
|
componentId: "plasma-new-hope__sc-20ij9z-5"
|
27
27
|
})(["color:var(", ");font-family:var(", ");font-size:var(", ");font-weight:var(", ");font-style:var(", ");letter-spacing:var(", ");line-height:var(", ");"], tokens.accordionItemTitleColor, tokens.accordionItemTitleFontFamily, tokens.accordionItemTitleFontSize, tokens.accordionItemTitleFontWeight, tokens.accordionItemTitleFontStyle, tokens.accordionItemTitleLetterSpacing, tokens.accordionItemTitleLineHeight);
|
28
28
|
export var StyledAccordionBodyAnimate = /*#__PURE__*/styled.div.withConfig({
|
29
29
|
componentId: "plasma-new-hope__sc-20ij9z-6"
|
30
|
-
})(["display:grid;grid-template-rows:0fr;transition:grid-template-rows 0.2s ease-out;overflow:hidden
|
30
|
+
})(["display:grid;grid-template-rows:0fr;transition:grid-template-rows 0.2s ease-out;overflow:hidden;&.", "{grid-template-rows:1fr;padding-bottom:var(", ");&.", "{transition:0.2s;transform:rotate(0deg);}}"], classes.accordionItemShowBody, tokens.accordionItemPaddingVertical, classes.accordionPlusAnimationElement);
|
31
31
|
export var StyledAccordionBody = /*#__PURE__*/styled.div.withConfig({
|
32
32
|
componentId: "plasma-new-hope__sc-20ij9z-7"
|
33
33
|
})(["color:var(", ");font-family:var(", ");font-size:var(", ");font-weight:var(", ");font-style:var(", ");letter-spacing:var(", ");line-height:var(", ");overflow:hidden;padding-right:var(", ");padding-left:var(", ");"], tokens.accordionItemTextColor, tokens.accordionItemTextFontFamily, tokens.accordionItemTextFontSize, tokens.accordionItemTextFontWeight, tokens.accordionItemTextFontStyle, tokens.accordionItemTextLetterSpacing, tokens.accordionItemTextLineHeight, tokens.accordionItemPaddingHorizontal, tokens.accordionItemPaddingHorizontal);
|
@@ -36,7 +36,7 @@ export var StyledArrow = /*#__PURE__*/styled(IconChevronDownFill).withConfig({
|
|
36
36
|
})(["pointer-events:none;user-select:none;color:var(", ");"], tokens.accordionItemTextColor);
|
37
37
|
export var StyledMinus = /*#__PURE__*/styled(IconMinus).withConfig({
|
38
38
|
componentId: "plasma-new-hope__sc-20ij9z-9"
|
39
|
-
})(["pointer-events:none;user-select:none;color:var(", ");display:flex;align-items:center;position:absolute;top:0;left:0
|
39
|
+
})(["pointer-events:none;user-select:none;color:var(", ");display:flex;align-items:center;position:absolute;top:0;left:0;&.", "{transition:0.2s;transform:rotate(90deg);}&.", "{transition:0.2s;transform:rotate(0deg);}"], tokens.accordionItemTextColor, classes.accordionPlusAnimationElement, classes.accordionItemShowBody);
|
40
40
|
export var StyledPlus = /*#__PURE__*/styled.div.withConfig({
|
41
41
|
componentId: "plasma-new-hope__sc-20ij9z-10"
|
42
42
|
})(["position:relative;height:1rem;display:flex;align-items:center;justify-content:center;width:1rem;"]);
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { Children, cloneElement, isValidElement } from 'react';
|
2
|
-
export var updatePropsRecursively = function updatePropsRecursively(children, activeIndex, updateValue) {
|
2
|
+
export var updatePropsRecursively = function updatePropsRecursively(children, activeIndex, disabled, updateValue) {
|
3
3
|
return Children.map(children || [], function (child, index) {
|
4
4
|
if (! /*#__PURE__*/isValidElement(child)) {
|
5
5
|
return child;
|
@@ -7,11 +7,12 @@ export var updatePropsRecursively = function updatePropsRecursively(children, ac
|
|
7
7
|
var props = {
|
8
8
|
index: index,
|
9
9
|
value: activeIndex === index,
|
10
|
-
|
10
|
+
disabled: disabled,
|
11
|
+
onChangeValue: updateValue
|
11
12
|
};
|
12
13
|
return /*#__PURE__*/cloneElement(child, props);
|
13
14
|
});
|
14
15
|
};
|
15
|
-
export var getChildren = function getChildren(children, activeIndex, updateValue) {
|
16
|
-
return updatePropsRecursively(children, activeIndex, updateValue);
|
16
|
+
export var getChildren = function getChildren(children, activeIndex, disabled, updateValue) {
|
17
|
+
return updatePropsRecursively(children, activeIndex, disabled, updateValue);
|
17
18
|
};
|
@@ -1,4 +1,4 @@
|
|
1
|
-
var
|
1
|
+
var _path;
|
2
2
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
3
3
|
import React from 'react';
|
4
4
|
export var ChevronDownFill = function ChevronDownFill(props) {
|
@@ -6,20 +6,11 @@ export var ChevronDownFill = function ChevronDownFill(props) {
|
|
6
6
|
width: "100%",
|
7
7
|
viewBox: "0 0 16 16",
|
8
8
|
fill: "none"
|
9
|
-
}, props),
|
10
|
-
id: "clip3066_154194"
|
11
|
-
}, /*#__PURE__*/React.createElement("rect", {
|
12
|
-
width: "16.000000",
|
13
|
-
height: "16.000000",
|
14
|
-
fill: "currentColor",
|
15
|
-
fillOpacity: "0"
|
16
|
-
})))), _g || (_g = /*#__PURE__*/React.createElement("g", {
|
17
|
-
clipPath: "url(#clip3066_154194)"
|
18
|
-
}, /*#__PURE__*/React.createElement("path", {
|
9
|
+
}, props), _path || (_path = /*#__PURE__*/React.createElement("path", {
|
19
10
|
id: "path",
|
20
11
|
d: "M11.45 5.79C11.37 5.61 11.19 5.5 11 5.5L5 5.5C4.8 5.5 4.62 5.61 4.54 5.79C4.46 5.96 4.49 6.17 4.62 6.32L7.62 9.82C7.71 9.93 7.85 10 8 10C8.14 10 8.28 9.93 8.37 9.82L11.37 6.32C11.5 6.17 11.53 5.96 11.45 5.79Z",
|
21
12
|
fillRule: "evenodd",
|
22
13
|
fill: "currentColor",
|
23
14
|
clipRule: "evenodd"
|
24
|
-
})))
|
15
|
+
})));
|
25
16
|
};
|
@@ -15,10 +15,6 @@ export var config = {
|
|
15
15
|
m: /*#__PURE__*/css(["", ":0.875rem;", ":1.125rem;", ":0.375rem;", ":0.75rem;", ":var(--plasma-typo-body-m-font-family);", ":var(--plasma-typo-body-m-font-size);", ":var(--plasma-typo-body-m-font-style);", ":var(--plasma-typo-body-m-bold-font-weight);", ":var(--plasma-typo-body-m-letter-spacing);", ":var(--plasma-typo-body-m-line-height);", ":var(--plasma-typo-body-m-font-family);", ":var(--plasma-typo-body-m-font-size);", ":var(--plasma-typo-body-m-font-style);", ":var(--plasma-typo-body-m-font-weight);", ":var(--plasma-typo-body-m-letter-spacing);", ":var(--plasma-typo-body-m-line-height);"], accordionTokens.accordionItemPaddingVertical, accordionTokens.accordionItemPaddingHorizontal, accordionTokens.accordionItemGap, accordionTokens.accordionItemBorderRadius, accordionTokens.accordionItemTitleFontFamily, accordionTokens.accordionItemTitleFontSize, accordionTokens.accordionItemTitleFontStyle, accordionTokens.accordionItemTitleFontWeight, accordionTokens.accordionItemTitleLetterSpacing, accordionTokens.accordionItemTitleLineHeight, accordionTokens.accordionItemTextFontFamily, accordionTokens.accordionItemTextFontSize, accordionTokens.accordionItemTextFontStyle, accordionTokens.accordionItemTextFontWeight, accordionTokens.accordionItemTextLetterSpacing, accordionTokens.accordionItemTextLineHeight),
|
16
16
|
s: /*#__PURE__*/css(["", ":0.6875rem;", ":0.875rem;", ":0.375rem;", ":0.625rem;", ":var(--plasma-typo-body-s-font-family);", ":var(--plasma-typo-body-s-font-size);", ":var(--plasma-typo-body-s-font-style);", ":var(--plasma-typo-body-s-bold-font-weight);", ":var(--plasma-typo-body-s-letter-spacing);", ":var(--plasma-typo-body-s-line-height);", ":var(--plasma-typo-body-s-font-family);", ":var(--plasma-typo-body-s-font-size);", ":var(--plasma-typo-body-s-font-style);", ":var(--plasma-typo-body-s-font-weight);", ":var(--plasma-typo-body-s-letter-spacing);", ":var(--plasma-typo-body-s-line-height);"], accordionTokens.accordionItemPaddingVertical, accordionTokens.accordionItemPaddingHorizontal, accordionTokens.accordionItemGap, accordionTokens.accordionItemBorderRadius, accordionTokens.accordionItemTitleFontFamily, accordionTokens.accordionItemTitleFontSize, accordionTokens.accordionItemTitleFontStyle, accordionTokens.accordionItemTitleFontWeight, accordionTokens.accordionItemTitleLetterSpacing, accordionTokens.accordionItemTitleLineHeight, accordionTokens.accordionItemTextFontFamily, accordionTokens.accordionItemTextFontSize, accordionTokens.accordionItemTextFontStyle, accordionTokens.accordionItemTextFontWeight, accordionTokens.accordionItemTextLetterSpacing, accordionTokens.accordionItemTextLineHeight),
|
17
17
|
xs: /*#__PURE__*/css(["", ":0.5rem;", ":0.75rem;", ":0.25rem;", ":0.5rem;", ":var(--plasma-typo-body-xs-font-family);", ":var(--plasma-typo-body-xs-font-size);", ":var(--plasma-typo-body-xs-font-style);", ":var(--plasma-typo-body-xs-bold-font-weight);", ":var(--plasma-typo-body-xs-letter-spacing);", ":var(--plasma-typo-body-xs-line-height);", ":var(--plasma-typo-body-xs-font-family);", ":var(--plasma-typo-body-xs-font-size);", ":var(--plasma-typo-body-xs-font-style);", ":var(--plasma-typo-body-xs-font-weight);", ":var(--plasma-typo-body-xs-letter-spacing);", ":var(--plasma-typo-body-xs-line-height);"], accordionTokens.accordionItemPaddingVertical, accordionTokens.accordionItemPaddingHorizontal, accordionTokens.accordionItemGap, accordionTokens.accordionItemBorderRadius, accordionTokens.accordionItemTitleFontFamily, accordionTokens.accordionItemTitleFontSize, accordionTokens.accordionItemTitleFontStyle, accordionTokens.accordionItemTitleFontWeight, accordionTokens.accordionItemTitleLetterSpacing, accordionTokens.accordionItemTitleLineHeight, accordionTokens.accordionItemTextFontFamily, accordionTokens.accordionItemTextFontSize, accordionTokens.accordionItemTextFontStyle, accordionTokens.accordionItemTextFontWeight, accordionTokens.accordionItemTextLetterSpacing, accordionTokens.accordionItemTextLineHeight)
|
18
|
-
},
|
19
|
-
stretching: {
|
20
|
-
filled: /*#__PURE__*/css([""]),
|
21
|
-
fixed: /*#__PURE__*/css([""])
|
22
18
|
}
|
23
19
|
}
|
24
20
|
};
|
@@ -15,12 +15,12 @@ const meta: Meta<typeof Accordion> = {
|
|
15
15
|
decorators: [WithTheme],
|
16
16
|
component: Accordion,
|
17
17
|
args: {
|
18
|
-
|
18
|
+
singleActive: true,
|
19
19
|
view: 'default',
|
20
20
|
size: 'm',
|
21
21
|
stretching: 'filled',
|
22
|
-
pin: 'square-square',
|
23
22
|
type: 'arrow',
|
23
|
+
disabled: false,
|
24
24
|
title: 'Как оплатить заправку бонусами СберСпасибо?',
|
25
25
|
body:
|
26
26
|
'После указания деталей заправки нажмите кнопку «К оплате». Откроется окно оплаты, где вы сможете списать бонусы и оплатить ими до 99% стоимости топлива',
|
@@ -28,22 +28,6 @@ const meta: Meta<typeof Accordion> = {
|
|
28
28
|
argTypes: {
|
29
29
|
...argTypesFromConfig(mergeConfig(accordionConfig, config)),
|
30
30
|
...disableProps(['text']),
|
31
|
-
pin: {
|
32
|
-
options: [
|
33
|
-
'square-square',
|
34
|
-
'square-clear',
|
35
|
-
'clear-square',
|
36
|
-
'clear-clear',
|
37
|
-
'clear-circle',
|
38
|
-
'circle-clear',
|
39
|
-
'circle-circle',
|
40
|
-
'',
|
41
|
-
],
|
42
|
-
control: {
|
43
|
-
type: 'select',
|
44
|
-
},
|
45
|
-
table: { defaultValue: { summary: 'bottom' } },
|
46
|
-
},
|
47
31
|
stretching: {
|
48
32
|
options: ['filled', 'fixed'],
|
49
33
|
control: {
|
@@ -67,9 +51,15 @@ export const Default: StoryObj<ComponentProps<typeof Accordion>> = {
|
|
67
51
|
|
68
52
|
return (
|
69
53
|
<Accordion {...args}>
|
70
|
-
<AccordionItem type={args.type} pin={args.pin} title={args.title}
|
71
|
-
|
72
|
-
|
54
|
+
<AccordionItem type={args.type} pin={args.pin} title={args.title}>
|
55
|
+
{args.body}
|
56
|
+
</AccordionItem>
|
57
|
+
<AccordionItem type={args.type} pin={args.pin} title={args.title}>
|
58
|
+
{args.body}
|
59
|
+
</AccordionItem>
|
60
|
+
<AccordionItem type={args.type} pin={args.pin} title={args.title}>
|
61
|
+
{args.body}
|
62
|
+
</AccordionItem>
|
73
63
|
</Accordion>
|
74
64
|
);
|
75
65
|
},
|
@@ -15,11 +15,10 @@ const meta: Meta<typeof Accordion> = {
|
|
15
15
|
decorators: [WithTheme],
|
16
16
|
component: Accordion,
|
17
17
|
args: {
|
18
|
-
|
18
|
+
singleActive: true,
|
19
19
|
view: 'default',
|
20
20
|
size: 'm',
|
21
21
|
stretching: 'filled',
|
22
|
-
pin: 'square-square',
|
23
22
|
type: 'arrow',
|
24
23
|
title: 'Как оплатить заправку бонусами СберСпасибо?',
|
25
24
|
body:
|
@@ -28,22 +27,6 @@ const meta: Meta<typeof Accordion> = {
|
|
28
27
|
argTypes: {
|
29
28
|
...argTypesFromConfig(mergeConfig(accordionConfig, config)),
|
30
29
|
...disableProps(['text']),
|
31
|
-
pin: {
|
32
|
-
options: [
|
33
|
-
'square-square',
|
34
|
-
'square-clear',
|
35
|
-
'clear-square',
|
36
|
-
'clear-clear',
|
37
|
-
'clear-circle',
|
38
|
-
'circle-clear',
|
39
|
-
'circle-circle',
|
40
|
-
'',
|
41
|
-
],
|
42
|
-
control: {
|
43
|
-
type: 'select',
|
44
|
-
},
|
45
|
-
table: { defaultValue: { summary: 'bottom' } },
|
46
|
-
},
|
47
30
|
stretching: {
|
48
31
|
options: ['filled', 'fixed'],
|
49
32
|
control: {
|
@@ -67,9 +50,15 @@ export const Default: StoryObj<ComponentProps<typeof Accordion>> = {
|
|
67
50
|
|
68
51
|
return (
|
69
52
|
<Accordion {...args}>
|
70
|
-
<AccordionItem type={args.type} pin={args.pin} title={args.title}
|
71
|
-
|
72
|
-
|
53
|
+
<AccordionItem type={args.type} pin={args.pin} title={args.title}>
|
54
|
+
{args.body}
|
55
|
+
</AccordionItem>
|
56
|
+
<AccordionItem type={args.type} pin={args.pin} title={args.title}>
|
57
|
+
{args.body}
|
58
|
+
</AccordionItem>
|
59
|
+
<AccordionItem type={args.type} pin={args.pin} title={args.title}>
|
60
|
+
{args.body}
|
61
|
+
</AccordionItem>
|
73
62
|
</Accordion>
|
74
63
|
);
|
75
64
|
},
|
@@ -4,8 +4,11 @@ import type { AccordionProps } from './Accordion.types';
|
|
4
4
|
export declare const accordionRoot: (Root: RootProps<HTMLDivElement, AccordionProps>) => React.ForwardRefExoticComponent<{
|
5
5
|
view: string;
|
6
6
|
size?: string | undefined;
|
7
|
-
|
7
|
+
singleActive?: boolean | undefined;
|
8
|
+
defaultActiveIndex?: number | undefined;
|
9
|
+
disabled?: boolean | undefined;
|
8
10
|
stretching?: "fixed" | "filled" | undefined;
|
11
|
+
onChangeValue?: ((index?: number | undefined, value?: boolean | undefined) => void) | undefined;
|
9
12
|
children?: React.ReactNode;
|
10
13
|
className?: string | undefined;
|
11
14
|
} & React.RefAttributes<HTMLDivElement>>;
|
@@ -15,8 +18,11 @@ export declare const accordionConfig: {
|
|
15
18
|
layout: (Root: RootProps<HTMLDivElement, AccordionProps>) => React.ForwardRefExoticComponent<{
|
16
19
|
view: string;
|
17
20
|
size?: string | undefined;
|
18
|
-
|
21
|
+
singleActive?: boolean | undefined;
|
22
|
+
defaultActiveIndex?: number | undefined;
|
23
|
+
disabled?: boolean | undefined;
|
19
24
|
stretching?: "fixed" | "filled" | undefined;
|
25
|
+
onChangeValue?: ((index?: number | undefined, value?: boolean | undefined) => void) | undefined;
|
20
26
|
children?: React.ReactNode;
|
21
27
|
className?: string | undefined;
|
22
28
|
} & React.RefAttributes<HTMLDivElement>>;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Accordion.d.ts","sourceRoot":"","sources":["../../../src/components/Accordion/Accordion.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
1
|
+
{"version":3,"file":"Accordion.d.ts","sourceRoot":"","sources":["../../../src/components/Accordion/Accordion.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyC,MAAM,OAAO,CAAC;AAE9D,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAG1C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAOxD,eAAO,MAAM,aAAa,SAAU,UAAU,cAAc,EAAE,cAAc,CAAC;;;;;;;;;;wCA0CxE,CAAC;AAEN,eAAO,MAAM,eAAe;;;mBA5CQ,UAAU,cAAc,EAAE,cAAc,CAAC;;;;;;;;;;;;;;;;;;;;;;;;CA6D5E,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Accordion.tokens.d.ts","sourceRoot":"","sources":["../../../src/components/Accordion/Accordion.tokens.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO
|
1
|
+
{"version":3,"file":"Accordion.tokens.d.ts","sourceRoot":"","sources":["../../../src/components/Accordion/Accordion.tokens.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO;;;;;;;;;CASnB,CAAC;AAEF,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;CA6BlB,CAAC"}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import type { ReactNode } from 'react';
|
2
2
|
declare type CustomAccordionProps = {
|
3
3
|
/**
|
4
|
-
* Тип
|
4
|
+
* Тип аккордеона
|
5
5
|
*/
|
6
6
|
view: string;
|
7
7
|
/**
|
@@ -11,15 +11,23 @@ declare type CustomAccordionProps = {
|
|
11
11
|
/**
|
12
12
|
* Возможность раскрытия всех элементов или только одного
|
13
13
|
*/
|
14
|
-
|
14
|
+
singleActive?: boolean;
|
15
|
+
/**
|
16
|
+
* Индекс элемента, который должен быть изначально раскрыт
|
17
|
+
*/
|
18
|
+
defaultActiveIndex?: number;
|
19
|
+
/**
|
20
|
+
* Блокировка всех элементов
|
21
|
+
*/
|
22
|
+
disabled?: boolean;
|
15
23
|
/**
|
16
24
|
* Ширина
|
17
|
-
* @description
|
18
|
-
* Может принимать два значения:
|
19
|
-
* fixed - кнопка фиксированной ширины;
|
20
|
-
* filled - кнопка занимает всю доступную ширину
|
21
25
|
*/
|
22
26
|
stretching?: 'fixed' | 'filled';
|
27
|
+
/**
|
28
|
+
* Функция при открытии или закрытии элемента аккордеона
|
29
|
+
*/
|
30
|
+
onChangeValue?: (index?: number, value?: boolean) => void;
|
23
31
|
children?: ReactNode;
|
24
32
|
className?: string;
|
25
33
|
};
|