@salutejs/plasma-new-hope 0.88.0-canary.1222.9283214118.0 → 0.88.0-canary.1223.9286484439.0
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +4 -4
- package/styled-components/cjs/components/Accordion/Accordion.js +50 -0
- package/styled-components/cjs/components/Accordion/Accordion.styles.js +9 -0
- package/styled-components/cjs/components/Accordion/Accordion.tokens.js +41 -0
- package/styled-components/cjs/components/Accordion/Accordion.types.js +5 -0
- package/styled-components/cjs/components/Accordion/index.js +38 -0
- package/styled-components/cjs/components/Accordion/ui/AccordionItem/AccordionItem.js +89 -0
- package/styled-components/cjs/components/Accordion/ui/AccordionItem/AccordionItem.styles.js +46 -0
- package/styled-components/cjs/components/Accordion/ui/AccordionItem/AccordionItem.types.js +5 -0
- package/styled-components/cjs/components/Accordion/variations/_size/base.js +8 -0
- package/styled-components/cjs/components/Accordion/variations/_size/tokens.json +6 -0
- package/styled-components/cjs/components/Accordion/variations/_stretching/base.js +8 -0
- package/styled-components/cjs/components/Accordion/variations/_stretching/tokens.json +1 -0
- package/styled-components/cjs/components/Accordion/variations/_view/base.js +8 -0
- package/styled-components/cjs/components/Accordion/variations/_view/tokens.json +8 -0
- package/styled-components/cjs/examples/plasma_b2c/components/Accordion/Accordion.config.js +30 -0
- package/styled-components/cjs/examples/plasma_b2c/components/Accordion/Accordion.js +17 -0
- package/styled-components/cjs/examples/plasma_b2c/components/Accordion/Accordion.stories.tsx +75 -0
- package/styled-components/cjs/examples/plasma_web/components/Accordion/Accordion.config.js +30 -0
- package/styled-components/cjs/examples/plasma_web/components/Accordion/Accordion.js +17 -0
- package/styled-components/cjs/examples/plasma_web/components/Accordion/Accordion.stories.tsx +90 -0
- package/styled-components/es/components/Accordion/Accordion.js +41 -0
- package/styled-components/es/components/Accordion/Accordion.styles.js +3 -0
- package/styled-components/es/components/Accordion/Accordion.tokens.js +35 -0
- package/styled-components/es/components/Accordion/Accordion.types.js +1 -0
- package/styled-components/es/components/Accordion/index.js +3 -0
- package/styled-components/es/components/Accordion/ui/AccordionItem/AccordionItem.js +80 -0
- package/styled-components/es/components/Accordion/ui/AccordionItem/AccordionItem.styles.js +39 -0
- package/styled-components/es/components/Accordion/ui/AccordionItem/AccordionItem.types.js +1 -0
- package/styled-components/es/components/Accordion/variations/_size/base.js +2 -0
- package/styled-components/es/components/Accordion/variations/_size/tokens.json +6 -0
- package/styled-components/es/components/Accordion/variations/_stretching/base.js +2 -0
- package/styled-components/es/components/Accordion/variations/_stretching/tokens.json +1 -0
- package/styled-components/es/components/Accordion/variations/_view/base.js +2 -0
- package/styled-components/es/components/Accordion/variations/_view/tokens.json +8 -0
- package/styled-components/es/examples/plasma_b2c/components/Accordion/Accordion.config.js +24 -0
- package/styled-components/es/examples/plasma_b2c/components/Accordion/Accordion.js +6 -0
- package/styled-components/es/examples/plasma_b2c/components/Accordion/Accordion.stories.tsx +75 -0
- package/styled-components/es/examples/plasma_web/components/Accordion/Accordion.config.js +24 -0
- package/styled-components/es/examples/plasma_web/components/Accordion/Accordion.js +6 -0
- package/styled-components/es/examples/plasma_web/components/Accordion/Accordion.stories.tsx +90 -0
- package/types/components/Accordion/Accordion.d.ts +35 -0
- package/types/components/Accordion/Accordion.d.ts.map +1 -0
- package/types/components/Accordion/Accordion.styles.d.ts +2 -0
- package/types/components/Accordion/Accordion.styles.d.ts.map +1 -0
- package/types/components/Accordion/Accordion.tokens.d.ts +36 -0
- package/types/components/Accordion/Accordion.tokens.d.ts.map +1 -0
- package/types/components/Accordion/Accordion.types.d.ts +24 -0
- package/types/components/Accordion/Accordion.types.d.ts.map +1 -0
- package/types/components/Accordion/index.d.ts +5 -0
- package/types/components/Accordion/index.d.ts.map +1 -0
- package/types/components/Accordion/ui/AccordionItem/AccordionItem.d.ts +4 -0
- package/types/components/Accordion/ui/AccordionItem/AccordionItem.d.ts.map +1 -0
- package/types/components/Accordion/ui/AccordionItem/AccordionItem.styles.d.ts +12 -0
- package/types/components/Accordion/ui/AccordionItem/AccordionItem.styles.d.ts.map +1 -0
- package/types/components/Accordion/ui/AccordionItem/AccordionItem.types.d.ts +39 -0
- package/types/components/Accordion/ui/AccordionItem/AccordionItem.types.d.ts.map +1 -0
- package/types/components/Accordion/variations/_size/base.d.ts +2 -0
- package/types/components/Accordion/variations/_size/base.d.ts.map +1 -0
- package/types/components/Accordion/variations/_stretching/base.d.ts +2 -0
- package/types/components/Accordion/variations/_stretching/base.d.ts.map +1 -0
- package/types/components/Accordion/variations/_view/base.d.ts +2 -0
- package/types/components/Accordion/variations/_view/base.d.ts.map +1 -0
- package/types/examples/plasma_b2c/components/Accordion/Accordion.config.d.ts +23 -0
- package/types/examples/plasma_b2c/components/Accordion/Accordion.config.d.ts.map +1 -0
- package/types/examples/plasma_b2c/components/Accordion/Accordion.d.ts +26 -0
- package/types/examples/plasma_b2c/components/Accordion/Accordion.d.ts.map +1 -0
- package/types/examples/plasma_web/components/Accordion/Accordion.config.d.ts +23 -0
- package/types/examples/plasma_web/components/Accordion/Accordion.config.d.ts.map +1 -0
- package/types/examples/plasma_web/components/Accordion/Accordion.d.ts +26 -0
- package/types/examples/plasma_web/components/Accordion/Accordion.d.ts.map +1 -0
@@ -0,0 +1,90 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
import type { ComponentProps } from 'react';
|
3
|
+
import type { StoryObj, Meta } from '@storybook/react';
|
4
|
+
import { disableProps } from '@salutejs/plasma-sb-utils';
|
5
|
+
|
6
|
+
import { mergeConfig } from '../../../../engines';
|
7
|
+
import { WithTheme, argTypesFromConfig } from '../../../_helpers';
|
8
|
+
import { accordionConfig } from '../../../../components/Accordion';
|
9
|
+
|
10
|
+
import { config } from './Accordion.config';
|
11
|
+
import { Accordion, AccordionItem } from './Accordion';
|
12
|
+
|
13
|
+
const meta: Meta<typeof Accordion> = {
|
14
|
+
title: 'plasma_web/Accordion',
|
15
|
+
decorators: [WithTheme],
|
16
|
+
component: Accordion,
|
17
|
+
args: {
|
18
|
+
view: 'secondary',
|
19
|
+
size: 'm',
|
20
|
+
stretching: 'filled',
|
21
|
+
pin: 'square-square',
|
22
|
+
type: 'arrow',
|
23
|
+
title: 'Как оплатить заправку бонусами СберСпасибо?',
|
24
|
+
body:
|
25
|
+
'После указания деталей заправки нажмите кнопку «К оплате». Откроется окно оплаты, где вы сможете списать бонусы и оплатить ими до 99% стоимости топлива',
|
26
|
+
},
|
27
|
+
argTypes: {
|
28
|
+
...argTypesFromConfig(mergeConfig(accordionConfig, config)),
|
29
|
+
pin: {
|
30
|
+
options: [
|
31
|
+
'square-square',
|
32
|
+
'square-clear',
|
33
|
+
'clear-square',
|
34
|
+
'clear-clear',
|
35
|
+
'clear-circle',
|
36
|
+
'circle-clear',
|
37
|
+
'circle-circle',
|
38
|
+
'',
|
39
|
+
],
|
40
|
+
control: {
|
41
|
+
type: 'select',
|
42
|
+
},
|
43
|
+
table: { defaultValue: { summary: 'bottom' } },
|
44
|
+
},
|
45
|
+
stretching: {
|
46
|
+
options: ['filled', 'fixed'],
|
47
|
+
control: {
|
48
|
+
type: 'select',
|
49
|
+
},
|
50
|
+
},
|
51
|
+
type: {
|
52
|
+
options: ['arrow', 'sign', 'clear'],
|
53
|
+
control: {
|
54
|
+
type: 'select',
|
55
|
+
},
|
56
|
+
},
|
57
|
+
},
|
58
|
+
};
|
59
|
+
|
60
|
+
export default meta;
|
61
|
+
|
62
|
+
export const Default: StoryObj<ComponentProps<typeof Accordion>> = {
|
63
|
+
argTypes: { ...disableProps(['text']) },
|
64
|
+
render: (props: ComponentProps<typeof Accordion>) => {
|
65
|
+
const args = { ...props, text: undefined };
|
66
|
+
|
67
|
+
return (
|
68
|
+
<Accordion {...args}>
|
69
|
+
<AccordionItem
|
70
|
+
type={args.type}
|
71
|
+
pin={args.pin}
|
72
|
+
title="Как оплатить заправку бонусами СберСпасибо?"
|
73
|
+
body="После указания деталей заправки нажмите кнопку «К оплате». Откроется окно оплаты, где вы сможете списать бонусы и оплатить ими до 99% стоимости топлива"
|
74
|
+
/>
|
75
|
+
<AccordionItem
|
76
|
+
type={args.type}
|
77
|
+
pin={args.pin}
|
78
|
+
title="Как оплатить заправку бонусами СберСпасибо?"
|
79
|
+
body="После указания деталей заправки нажмите кнопку «К оплате». Откроется окно оплаты, где вы сможете списать бонусы и оплатить ими до 99% стоимости топлива"
|
80
|
+
/>
|
81
|
+
<AccordionItem
|
82
|
+
type={args.type}
|
83
|
+
pin={args.pin}
|
84
|
+
title="Как оплатить заправку бонусами СберСпасибо?"
|
85
|
+
body="После указания деталей заправки нажмите кнопку «К оплате». Откроется окно оплаты, где вы сможете списать бонусы и оплатить ими до 99% стоимости топлива"
|
86
|
+
/>
|
87
|
+
</Accordion>
|
88
|
+
);
|
89
|
+
},
|
90
|
+
};
|
@@ -0,0 +1,41 @@
|
|
1
|
+
import React, { forwardRef } from 'react';
|
2
|
+
import { cx } from '../../utils';
|
3
|
+
import { base } from './Accordion.styles';
|
4
|
+
import { classes } from './Accordion.tokens';
|
5
|
+
import { base as viewCSS } from './variations/_view/base';
|
6
|
+
import { base as sizeCSS } from './variations/_size/base';
|
7
|
+
export var accordionRoot = function accordionRoot(Root) {
|
8
|
+
return /*#__PURE__*/forwardRef(function (_ref, outerRootRef) {
|
9
|
+
var size = _ref.size,
|
10
|
+
view = _ref.view,
|
11
|
+
_ref$stretching = _ref.stretching,
|
12
|
+
stretching = _ref$stretching === void 0 ? 'filled' : _ref$stretching,
|
13
|
+
children = _ref.children,
|
14
|
+
className = _ref.className;
|
15
|
+
var stretchingClass = classes["".concat(stretching, "Stretching")];
|
16
|
+
return /*#__PURE__*/React.createElement(Root, {
|
17
|
+
ref: outerRootRef,
|
18
|
+
size: size,
|
19
|
+
view: view,
|
20
|
+
className: cx(stretchingClass, classes.accordionRoot, className)
|
21
|
+
}, children);
|
22
|
+
});
|
23
|
+
};
|
24
|
+
export var accordionConfig = {
|
25
|
+
name: 'Accordion',
|
26
|
+
tag: 'div',
|
27
|
+
layout: accordionRoot,
|
28
|
+
base: base,
|
29
|
+
variations: {
|
30
|
+
view: {
|
31
|
+
css: viewCSS
|
32
|
+
},
|
33
|
+
size: {
|
34
|
+
css: sizeCSS
|
35
|
+
}
|
36
|
+
},
|
37
|
+
defaults: {
|
38
|
+
view: 'secondary',
|
39
|
+
size: 'm'
|
40
|
+
}
|
41
|
+
};
|
@@ -0,0 +1,3 @@
|
|
1
|
+
import { css } from 'styled-components';
|
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(", ");&&.", "{width:var(", ");}&&.", "{width:100%;}"], tokens.accordionGap, tokens.accordionBackground, classes.fixedStretching, tokens.accordionWidth, classes.filledStretching);
|
@@ -0,0 +1,35 @@
|
|
1
|
+
export var classes = {
|
2
|
+
filledStretching: 'accordion-stretching-filled',
|
3
|
+
fixedStretching: 'accordion-stretching-fixed',
|
4
|
+
accordionRoot: 'accordion-root',
|
5
|
+
accordionItem: 'accordion-item',
|
6
|
+
clearAccordionItem: 'clear-accordion-item',
|
7
|
+
accordionItemShowBody: 'accordion-item-show-body'
|
8
|
+
};
|
9
|
+
export var tokens = {
|
10
|
+
accordionGap: '--plasma-accordion-gap',
|
11
|
+
accordionWidth: '--plasma-accordion-width',
|
12
|
+
accordionBackground: '--plasma-accordion-background',
|
13
|
+
accordionItemBackground: '--plasma-accordion-item-background',
|
14
|
+
accordionItemBorderRadius: '--plasma-accordion-item-border-radius',
|
15
|
+
accordionItemPaddingTop: '--plasma-accordion-item-padding-top',
|
16
|
+
accordionItemPaddingRight: '--plasma-accordion-item-padding-right',
|
17
|
+
accordionItemPaddingBottom: '--plasma-accordion-item-padding-bottom',
|
18
|
+
accordionItemPaddingLeft: '--plasma-accordion-item-padding-left',
|
19
|
+
accordionItemGap: '--plasma-accordion-item-gap',
|
20
|
+
accordionItemFocus: '--plasma-accordion-item-focus',
|
21
|
+
accordionItemTitleColor: '--plasma-accordion-item-title-color',
|
22
|
+
accordionItemTitleFontFamily: '--plasma-accordion-item-title-font-family',
|
23
|
+
accordionItemTitleFontSize: '--plasma-accordion-item-title-font-size',
|
24
|
+
accordionItemTitleFontStyle: '--plasma-accordion-item-title-font-style',
|
25
|
+
accordionItemTitleFontWeight: '--plasma-accordion-item-title-font-weight',
|
26
|
+
accordionItemTitleLetterSpacing: '--plasma-accordion-item-title-letter-spacing',
|
27
|
+
accordionItemTitleLineHeight: '--plasma-accordion-item-title-line-height',
|
28
|
+
accordionItemTextColor: '--plasma-accordion-item-text-color',
|
29
|
+
accordionItemTextFontFamily: '--plasma-accordion-item-text-font-family',
|
30
|
+
accordionItemTextFontSize: '--plasma-accordion-item-text-font-size',
|
31
|
+
accordionItemTextFontStyle: '--plasma-accordion-item-text-font-style',
|
32
|
+
accordionItemTextFontWeight: '--plasma-accordion-item-text-font-weight',
|
33
|
+
accordionItemTextLetterSpacing: '--plasma-accordion-item-text-letter-spacing',
|
34
|
+
accordionItemTextLineHeight: '--plasma-accordion-item-text-line-height'
|
35
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1,80 @@
|
|
1
|
+
var _StyledArrow, _StyledClose;
|
2
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
3
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
4
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
5
|
+
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; }
|
6
|
+
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; } }
|
7
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
8
|
+
import React, { useState, useRef, useEffect } from 'react';
|
9
|
+
import { convertRoundnessMatrix } from '../../../../utils/roundness';
|
10
|
+
import { classes, tokens } from '../../Accordion.tokens';
|
11
|
+
import { StyledAccordionItem, StyledAccordionHeader, StyledAccordionBody, StyledAccordionTitle, StyledAccordionContentLeft, StyledAccordionHeaderLeft, StyledAccordionContentRight, StyledArrow, StyledClose, StyledAccordionBodyAnimate } from './AccordionItem.styles';
|
12
|
+
export var AccordionItem = function AccordionItem(_ref) {
|
13
|
+
var value = _ref.value,
|
14
|
+
contentRight = _ref.contentRight,
|
15
|
+
contentLeft = _ref.contentLeft,
|
16
|
+
title = _ref.title,
|
17
|
+
_ref$pin = _ref.pin,
|
18
|
+
pin = _ref$pin === void 0 ? 'square-square' : _ref$pin,
|
19
|
+
body = _ref.body,
|
20
|
+
_ref$type = _ref.type,
|
21
|
+
type = _ref$type === void 0 ? 'sign' : _ref$type,
|
22
|
+
onChangeValue = _ref.onChangeValue;
|
23
|
+
var _useState = useState(value),
|
24
|
+
_useState2 = _slicedToArray(_useState, 2),
|
25
|
+
show = _useState2[0],
|
26
|
+
setShow = _useState2[1];
|
27
|
+
var _useState3 = useState(),
|
28
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
29
|
+
leftPadding = _useState4[0],
|
30
|
+
setLeftPadding = _useState4[1];
|
31
|
+
var accordionBorderRadius = convertRoundnessMatrix(pin, "var(".concat(tokens.accordionItemBorderRadius, ")"));
|
32
|
+
var leftContent = contentLeft !== null && contentLeft !== void 0 ? contentLeft : type === 'arrow' ? _StyledArrow || (_StyledArrow = /*#__PURE__*/React.createElement(StyledArrow, {
|
33
|
+
size: "s",
|
34
|
+
color: "inhert"
|
35
|
+
})) : undefined;
|
36
|
+
var leftContentRotate = type === 'arrow' && show ? classes.accordionItemShowBody : undefined;
|
37
|
+
var rightContent = contentRight !== null && contentRight !== void 0 ? contentRight : type === 'sign' ? _StyledClose || (_StyledClose = /*#__PURE__*/React.createElement(StyledClose, {
|
38
|
+
size: "xs",
|
39
|
+
color: "inhert"
|
40
|
+
})) : undefined;
|
41
|
+
var rightContentRotate = type === 'sign' && show ? classes.accordionItemShowBody : undefined;
|
42
|
+
var showedBody = show ? classes.accordionItemShowBody : undefined;
|
43
|
+
var showHandler = function showHandler() {
|
44
|
+
setShow(!show);
|
45
|
+
onChangeValue && onChangeValue(!show);
|
46
|
+
};
|
47
|
+
var onKeyPress = function onKeyPress(event) {
|
48
|
+
event.persist();
|
49
|
+
if (event.keyCode === 13) {
|
50
|
+
showHandler();
|
51
|
+
}
|
52
|
+
};
|
53
|
+
var leftContentRef = useRef(null);
|
54
|
+
useEffect(function () {
|
55
|
+
var _leftContentRef$curre, _leftContentRef$curre2;
|
56
|
+
var leftContentWidth = (_leftContentRef$curre = leftContentRef === null || leftContentRef === void 0 || (_leftContentRef$curre2 = leftContentRef.current) === null || _leftContentRef$curre2 === void 0 ? void 0 : _leftContentRef$curre2.offsetWidth) !== null && _leftContentRef$curre !== void 0 ? _leftContentRef$curre : 0;
|
57
|
+
var leftPaddingBody = leftContentWidth ? "calc(".concat(leftContentWidth, "px + var(").concat(tokens.accordionItemGap, "))") : 0;
|
58
|
+
setLeftPadding(leftPaddingBody);
|
59
|
+
}, [type, leftContentRef, setLeftPadding]);
|
60
|
+
return /*#__PURE__*/React.createElement(StyledAccordionItem, {
|
61
|
+
role: "tab",
|
62
|
+
tabIndex: 0,
|
63
|
+
style: {
|
64
|
+
borderRadius: accordionBorderRadius
|
65
|
+
},
|
66
|
+
onKeyDown: onKeyPress
|
67
|
+
}, /*#__PURE__*/React.createElement(StyledAccordionHeader, {
|
68
|
+
onClick: showHandler
|
69
|
+
}, /*#__PURE__*/React.createElement(StyledAccordionHeaderLeft, null, leftContent && /*#__PURE__*/React.createElement(StyledAccordionContentLeft, {
|
70
|
+
ref: leftContentRef,
|
71
|
+
className: leftContentRotate
|
72
|
+
}, leftContent), /*#__PURE__*/React.createElement(StyledAccordionTitle, null, title)), /*#__PURE__*/React.createElement(StyledAccordionContentRight, {
|
73
|
+
className: rightContentRotate
|
74
|
+
}, rightContent && rightContent)), /*#__PURE__*/React.createElement(StyledAccordionBodyAnimate, {
|
75
|
+
className: showedBody,
|
76
|
+
style: {
|
77
|
+
paddingLeft: "".concat(leftPadding)
|
78
|
+
}
|
79
|
+
}, /*#__PURE__*/React.createElement(StyledAccordionBody, null, body)));
|
80
|
+
};
|
@@ -0,0 +1,39 @@
|
|
1
|
+
import styled from 'styled-components';
|
2
|
+
import { IconChevronDown, IconClose } from '../../../_Icon';
|
3
|
+
import { classes, tokens } from '../../Accordion.tokens';
|
4
|
+
import { addFocus } from '../../../../mixins';
|
5
|
+
export var StyledAccordionItem = /*#__PURE__*/styled.div.withConfig({
|
6
|
+
componentId: "plasma-new-hope__sc-20ij9z-0"
|
7
|
+
})(["background:var(", ");&:focus{outline:none;}", ""], tokens.accordionItemBackground, /*#__PURE__*/addFocus({
|
8
|
+
outlineOffset: '0.125rem',
|
9
|
+
outlineSize: '0.125rem',
|
10
|
+
outlineRadius: '0',
|
11
|
+
outlineColor: /*#__PURE__*/"var(".concat(tokens.accordionItemFocus, ")")
|
12
|
+
}));
|
13
|
+
export var StyledAccordionHeader = /*#__PURE__*/styled.div.withConfig({
|
14
|
+
componentId: "plasma-new-hope__sc-20ij9z-1"
|
15
|
+
})(["padding-top:var(", ");padding-right:var(", ");padding-bottom:var(", ");padding-left:var(", ");display:flex;gap:var(", ");justify-content:space-between;align-items:center;cursor:pointer;"], tokens.accordionItemPaddingTop, tokens.accordionItemPaddingRight, tokens.accordionItemPaddingBottom, tokens.accordionItemPaddingLeft, tokens.accordionItemGap);
|
16
|
+
export var StyledAccordionHeaderLeft = /*#__PURE__*/styled.div.withConfig({
|
17
|
+
componentId: "plasma-new-hope__sc-20ij9z-2"
|
18
|
+
})(["display:flex;gap:var(", ");justify-content:space-between;align-items:center;"], tokens.accordionItemGap);
|
19
|
+
export var StyledAccordionContentRight = /*#__PURE__*/styled.div.withConfig({
|
20
|
+
componentId: "plasma-new-hope__sc-20ij9z-3"
|
21
|
+
})(["transition:0.2s;&&.", "{transition:0.2s;transform:rotate(45deg);}"], classes.accordionItemShowBody);
|
22
|
+
export var StyledAccordionContentLeft = /*#__PURE__*/styled.div.withConfig({
|
23
|
+
componentId: "plasma-new-hope__sc-20ij9z-4"
|
24
|
+
})(["transition:0.2s;display:flex;align-items:center;&&.", "{transition:0.2s;transform:rotate(180deg);}"], classes.accordionItemShowBody);
|
25
|
+
export var StyledAccordionTitle = /*#__PURE__*/styled.div.withConfig({
|
26
|
+
componentId: "plasma-new-hope__sc-20ij9z-5"
|
27
|
+
})(["color:var(", ");font-family:var(", ");font-size:var(", ");font-weight:var(", ");font-style:var(", ");letter-spacing:var(", ");line-height:var(", ");"], tokens.accordionItemTitleColor, tokens.accordionItemTitleFontWeight, tokens.accordionItemTitleFontSize, tokens.accordionItemTitleFontWeight, tokens.accordionItemTitleFontStyle, tokens.accordionItemTitleLetterSpacing, tokens.accordionItemTitleLineHeight);
|
28
|
+
export var StyledAccordionBodyAnimate = /*#__PURE__*/styled.div.withConfig({
|
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;&&.", "{grid-template-rows:1fr;padding-bottom:var(", ");}"], classes.accordionItemShowBody, tokens.accordionItemPaddingBottom);
|
31
|
+
export var StyledAccordionBody = /*#__PURE__*/styled.div.withConfig({
|
32
|
+
componentId: "plasma-new-hope__sc-20ij9z-7"
|
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.accordionItemTextFontWeight, tokens.accordionItemTextFontSize, tokens.accordionItemTextFontWeight, tokens.accordionItemTextFontStyle, tokens.accordionItemTextLetterSpacing, tokens.accordionItemTextLineHeight, tokens.accordionItemPaddingRight, tokens.accordionItemPaddingLeft);
|
34
|
+
export var StyledArrow = /*#__PURE__*/styled(IconChevronDown).withConfig({
|
35
|
+
componentId: "plasma-new-hope__sc-20ij9z-8"
|
36
|
+
})(["pointer-events:none;user-select:none;color:var(", ");"], tokens.accordionItemTextColor);
|
37
|
+
export var StyledClose = /*#__PURE__*/styled(IconClose).withConfig({
|
38
|
+
componentId: "plasma-new-hope__sc-20ij9z-9"
|
39
|
+
})(["pointer-events:none;user-select:none;color:var(", ");transform:rotate(45deg);display:flex;align-items:center;"], tokens.accordionItemTextColor);
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1 @@
|
|
1
|
+
["--plasma-button-width"]
|
@@ -0,0 +1,24 @@
|
|
1
|
+
import { css } from 'styled-components';
|
2
|
+
import { accordionTokens } from '../../../../components/Accordion';
|
3
|
+
export var config = {
|
4
|
+
defaults: {
|
5
|
+
view: 'secondary',
|
6
|
+
size: 'm'
|
7
|
+
},
|
8
|
+
variations: {
|
9
|
+
view: {
|
10
|
+
secondary: /*#__PURE__*/css(["", ":0.125rem;", ":20rem;", ":var(--surface-solid-card);", ":var(--text-primary);", ":var(--text-primary);", ":var(--surface-accent);", ":var(--surface-clear);"], accordionTokens.accordionGap, accordionTokens.accordionWidth, accordionTokens.accordionItemBackground, accordionTokens.accordionItemTitleColor, accordionTokens.accordionItemTextColor, accordionTokens.accordionItemFocus, accordionTokens.accordionBackground),
|
11
|
+
clear: /*#__PURE__*/css(["", ":0.125rem;", ":20rem;", ":0rem !important;", ":0rem !important;", ":var(--background-primary);", ":var(--text-primary);", ":var(--text-primary);", ":var(--surface-accent);", ":0rem !important;", ":var(--surface-solid-tertiary);"], accordionTokens.accordionGap, accordionTokens.accordionWidth, accordionTokens.accordionItemPaddingRight, accordionTokens.accordionItemPaddingLeft, accordionTokens.accordionItemBackground, accordionTokens.accordionItemTitleColor, accordionTokens.accordionItemTextColor, accordionTokens.accordionItemFocus, accordionTokens.accordionItemBorderRadius, accordionTokens.accordionBackground)
|
12
|
+
},
|
13
|
+
size: {
|
14
|
+
l: /*#__PURE__*/css(["", ":1.0625rem;", ":1.25rem;", ":1.0625rem;", ":1.25rem;", ":0.5rem;", ":0.875rem;", ":var(--plasma-typo-body-l-font-family);", ":var(--plasma-typo-body-l-font-size);", ":var(--plasma-typo-body-l-font-style);", ":var(--plasma-typo-body-l-bold-font-weight);", ":var(--plasma-typo-body-l-letter-spacing);", ":var(--plasma-typo-body-l-line-height);", ":var(--plasma-typo-body-l-font-family);", ":var(--plasma-typo-body-l-font-size);", ":var(--plasma-typo-body-l-font-style);", ":var(--plasma-typo-body-l-font-weight);", ":var(--plasma-typo-body-l-letter-spacing);", ":var(--plasma-typo-body-l-line-height);"], accordionTokens.accordionItemPaddingTop, accordionTokens.accordionItemPaddingRight, accordionTokens.accordionItemPaddingBottom, accordionTokens.accordionItemPaddingLeft, 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),
|
15
|
+
m: /*#__PURE__*/css(["", ":0.875rem;", ":1.125rem;", ":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.accordionItemPaddingTop, accordionTokens.accordionItemPaddingRight, accordionTokens.accordionItemPaddingBottom, accordionTokens.accordionItemPaddingLeft, 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
|
+
s: /*#__PURE__*/css(["", ":0.6875rem;", ":0.875rem;", ":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.accordionItemPaddingTop, accordionTokens.accordionItemPaddingRight, accordionTokens.accordionItemPaddingBottom, accordionTokens.accordionItemPaddingLeft, 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
|
+
xs: /*#__PURE__*/css(["", ":0.5rem;", ":0.75rem;", ":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.accordionItemPaddingTop, accordionTokens.accordionItemPaddingRight, accordionTokens.accordionItemPaddingBottom, accordionTokens.accordionItemPaddingLeft, 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
|
+
}
|
23
|
+
}
|
24
|
+
};
|
@@ -0,0 +1,6 @@
|
|
1
|
+
import { accordionConfig, AccordionItem } from '../../../../components/Accordion';
|
2
|
+
import { component, mergeConfig } from '../../../../engines';
|
3
|
+
import { config } from './Accordion.config';
|
4
|
+
var mergedConfig = /*#__PURE__*/mergeConfig(accordionConfig, config);
|
5
|
+
export var Accordion = /*#__PURE__*/component(mergedConfig);
|
6
|
+
export { AccordionItem };
|
@@ -0,0 +1,75 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
import type { ComponentProps } from 'react';
|
3
|
+
import type { StoryObj, Meta } from '@storybook/react';
|
4
|
+
import { disableProps } from '@salutejs/plasma-sb-utils';
|
5
|
+
|
6
|
+
import { mergeConfig } from '../../../../engines';
|
7
|
+
import { WithTheme, argTypesFromConfig } from '../../../_helpers';
|
8
|
+
import { accordionConfig } from '../../../../components/Accordion';
|
9
|
+
|
10
|
+
import { config } from './Accordion.config';
|
11
|
+
import { Accordion, AccordionItem } from './Accordion';
|
12
|
+
|
13
|
+
const meta: Meta<typeof Accordion> = {
|
14
|
+
title: 'plasma_b2c/Accordion',
|
15
|
+
decorators: [WithTheme],
|
16
|
+
component: Accordion,
|
17
|
+
args: {
|
18
|
+
view: 'secondary',
|
19
|
+
size: 'm',
|
20
|
+
stretching: 'filled',
|
21
|
+
pin: 'square-square',
|
22
|
+
type: 'arrow',
|
23
|
+
title: 'Как оплатить заправку бонусами СберСпасибо?',
|
24
|
+
body:
|
25
|
+
'После указания деталей заправки нажмите кнопку «К оплате». Откроется окно оплаты, где вы сможете списать бонусы и оплатить ими до 99% стоимости топлива',
|
26
|
+
},
|
27
|
+
argTypes: {
|
28
|
+
...argTypesFromConfig(mergeConfig(accordionConfig, config)),
|
29
|
+
pin: {
|
30
|
+
options: [
|
31
|
+
'square-square',
|
32
|
+
'square-clear',
|
33
|
+
'clear-square',
|
34
|
+
'clear-clear',
|
35
|
+
'clear-circle',
|
36
|
+
'circle-clear',
|
37
|
+
'circle-circle',
|
38
|
+
'',
|
39
|
+
],
|
40
|
+
control: {
|
41
|
+
type: 'select',
|
42
|
+
},
|
43
|
+
table: { defaultValue: { summary: 'bottom' } },
|
44
|
+
},
|
45
|
+
stretching: {
|
46
|
+
options: ['filled', 'fixed'],
|
47
|
+
control: {
|
48
|
+
type: 'select',
|
49
|
+
},
|
50
|
+
},
|
51
|
+
type: {
|
52
|
+
options: ['arrow', 'sign', 'clear'],
|
53
|
+
control: {
|
54
|
+
type: 'select',
|
55
|
+
},
|
56
|
+
},
|
57
|
+
},
|
58
|
+
};
|
59
|
+
|
60
|
+
export default meta;
|
61
|
+
|
62
|
+
export const Default: StoryObj<ComponentProps<typeof Accordion>> = {
|
63
|
+
argTypes: { ...disableProps(['text']) },
|
64
|
+
render: (props: ComponentProps<typeof Accordion>) => {
|
65
|
+
const args = { ...props, text: undefined };
|
66
|
+
|
67
|
+
return (
|
68
|
+
<Accordion {...args}>
|
69
|
+
<AccordionItem type={args.type} pin={args.pin} title={args.title} body={args.body} />
|
70
|
+
<AccordionItem type={args.type} pin={args.pin} title={args.title} body={args.body} />
|
71
|
+
<AccordionItem type={args.type} pin={args.pin} title={args.title} body={args.body} />
|
72
|
+
</Accordion>
|
73
|
+
);
|
74
|
+
},
|
75
|
+
};
|
@@ -0,0 +1,24 @@
|
|
1
|
+
import { css } from 'styled-components';
|
2
|
+
import { accordionTokens } from '../../../../components/Accordion';
|
3
|
+
export var config = {
|
4
|
+
defaults: {
|
5
|
+
view: 'secondary',
|
6
|
+
size: 'm'
|
7
|
+
},
|
8
|
+
variations: {
|
9
|
+
view: {
|
10
|
+
secondary: /*#__PURE__*/css(["", ":0.125rem;", ":20rem;", ":var(--surface-solid-card);", ":var(--text-primary);", ":var(--text-primary);", ":var(--surface-accent);", ":var(--surface-clear);"], accordionTokens.accordionGap, accordionTokens.accordionWidth, accordionTokens.accordionItemBackground, accordionTokens.accordionItemTitleColor, accordionTokens.accordionItemTextColor, accordionTokens.accordionItemFocus, accordionTokens.accordionBackground),
|
11
|
+
clear: /*#__PURE__*/css(["", ":0.125rem;", ":20rem;", ":0rem !important;", ":0rem !important;", ":var(--background-primary);", ":var(--text-primary);", ":var(--text-primary);", ":var(--surface-accent);", ":0rem !important;", ":var(--surface-solid-tertiary);"], accordionTokens.accordionGap, accordionTokens.accordionWidth, accordionTokens.accordionItemPaddingRight, accordionTokens.accordionItemPaddingLeft, accordionTokens.accordionItemBackground, accordionTokens.accordionItemTitleColor, accordionTokens.accordionItemTextColor, accordionTokens.accordionItemFocus, accordionTokens.accordionItemBorderRadius, accordionTokens.accordionBackground)
|
12
|
+
},
|
13
|
+
size: {
|
14
|
+
l: /*#__PURE__*/css(["", ":1.0625rem;", ":1.25rem;", ":1.0625rem;", ":1.25rem;", ":0.5rem;", ":0.875rem;", ":var(--plasma-typo-body-l-font-family);", ":var(--plasma-typo-body-l-font-size);", ":var(--plasma-typo-body-l-font-style);", ":var(--plasma-typo-body-l-bold-font-weight);", ":var(--plasma-typo-body-l-letter-spacing);", ":var(--plasma-typo-body-l-line-height);", ":var(--plasma-typo-body-l-font-family);", ":var(--plasma-typo-body-l-font-size);", ":var(--plasma-typo-body-l-font-style);", ":var(--plasma-typo-body-l-font-weight);", ":var(--plasma-typo-body-l-letter-spacing);", ":var(--plasma-typo-body-l-line-height);"], accordionTokens.accordionItemPaddingTop, accordionTokens.accordionItemPaddingRight, accordionTokens.accordionItemPaddingBottom, accordionTokens.accordionItemPaddingLeft, 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),
|
15
|
+
m: /*#__PURE__*/css(["", ":0.875rem;", ":1.125rem;", ":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.accordionItemPaddingTop, accordionTokens.accordionItemPaddingRight, accordionTokens.accordionItemPaddingBottom, accordionTokens.accordionItemPaddingLeft, 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
|
+
s: /*#__PURE__*/css(["", ":0.6875rem;", ":0.875rem;", ":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.accordionItemPaddingTop, accordionTokens.accordionItemPaddingRight, accordionTokens.accordionItemPaddingBottom, accordionTokens.accordionItemPaddingLeft, 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
|
+
xs: /*#__PURE__*/css(["", ":0.5rem;", ":0.75rem;", ":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.accordionItemPaddingTop, accordionTokens.accordionItemPaddingRight, accordionTokens.accordionItemPaddingBottom, accordionTokens.accordionItemPaddingLeft, 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
|
+
}
|
23
|
+
}
|
24
|
+
};
|
@@ -0,0 +1,6 @@
|
|
1
|
+
import { accordionConfig, AccordionItem } from '../../../../components/Accordion';
|
2
|
+
import { component, mergeConfig } from '../../../../engines';
|
3
|
+
import { config } from './Accordion.config';
|
4
|
+
var mergedConfig = /*#__PURE__*/mergeConfig(accordionConfig, config);
|
5
|
+
export var Accordion = /*#__PURE__*/component(mergedConfig);
|
6
|
+
export { AccordionItem };
|
@@ -0,0 +1,90 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
import type { ComponentProps } from 'react';
|
3
|
+
import type { StoryObj, Meta } from '@storybook/react';
|
4
|
+
import { disableProps } from '@salutejs/plasma-sb-utils';
|
5
|
+
|
6
|
+
import { mergeConfig } from '../../../../engines';
|
7
|
+
import { WithTheme, argTypesFromConfig } from '../../../_helpers';
|
8
|
+
import { accordionConfig } from '../../../../components/Accordion';
|
9
|
+
|
10
|
+
import { config } from './Accordion.config';
|
11
|
+
import { Accordion, AccordionItem } from './Accordion';
|
12
|
+
|
13
|
+
const meta: Meta<typeof Accordion> = {
|
14
|
+
title: 'plasma_web/Accordion',
|
15
|
+
decorators: [WithTheme],
|
16
|
+
component: Accordion,
|
17
|
+
args: {
|
18
|
+
view: 'secondary',
|
19
|
+
size: 'm',
|
20
|
+
stretching: 'filled',
|
21
|
+
pin: 'square-square',
|
22
|
+
type: 'arrow',
|
23
|
+
title: 'Как оплатить заправку бонусами СберСпасибо?',
|
24
|
+
body:
|
25
|
+
'После указания деталей заправки нажмите кнопку «К оплате». Откроется окно оплаты, где вы сможете списать бонусы и оплатить ими до 99% стоимости топлива',
|
26
|
+
},
|
27
|
+
argTypes: {
|
28
|
+
...argTypesFromConfig(mergeConfig(accordionConfig, config)),
|
29
|
+
pin: {
|
30
|
+
options: [
|
31
|
+
'square-square',
|
32
|
+
'square-clear',
|
33
|
+
'clear-square',
|
34
|
+
'clear-clear',
|
35
|
+
'clear-circle',
|
36
|
+
'circle-clear',
|
37
|
+
'circle-circle',
|
38
|
+
'',
|
39
|
+
],
|
40
|
+
control: {
|
41
|
+
type: 'select',
|
42
|
+
},
|
43
|
+
table: { defaultValue: { summary: 'bottom' } },
|
44
|
+
},
|
45
|
+
stretching: {
|
46
|
+
options: ['filled', 'fixed'],
|
47
|
+
control: {
|
48
|
+
type: 'select',
|
49
|
+
},
|
50
|
+
},
|
51
|
+
type: {
|
52
|
+
options: ['arrow', 'sign', 'clear'],
|
53
|
+
control: {
|
54
|
+
type: 'select',
|
55
|
+
},
|
56
|
+
},
|
57
|
+
},
|
58
|
+
};
|
59
|
+
|
60
|
+
export default meta;
|
61
|
+
|
62
|
+
export const Default: StoryObj<ComponentProps<typeof Accordion>> = {
|
63
|
+
argTypes: { ...disableProps(['text']) },
|
64
|
+
render: (props: ComponentProps<typeof Accordion>) => {
|
65
|
+
const args = { ...props, text: undefined };
|
66
|
+
|
67
|
+
return (
|
68
|
+
<Accordion {...args}>
|
69
|
+
<AccordionItem
|
70
|
+
type={args.type}
|
71
|
+
pin={args.pin}
|
72
|
+
title="Как оплатить заправку бонусами СберСпасибо?"
|
73
|
+
body="После указания деталей заправки нажмите кнопку «К оплате». Откроется окно оплаты, где вы сможете списать бонусы и оплатить ими до 99% стоимости топлива"
|
74
|
+
/>
|
75
|
+
<AccordionItem
|
76
|
+
type={args.type}
|
77
|
+
pin={args.pin}
|
78
|
+
title="Как оплатить заправку бонусами СберСпасибо?"
|
79
|
+
body="После указания деталей заправки нажмите кнопку «К оплате». Откроется окно оплаты, где вы сможете списать бонусы и оплатить ими до 99% стоимости топлива"
|
80
|
+
/>
|
81
|
+
<AccordionItem
|
82
|
+
type={args.type}
|
83
|
+
pin={args.pin}
|
84
|
+
title="Как оплатить заправку бонусами СберСпасибо?"
|
85
|
+
body="После указания деталей заправки нажмите кнопку «К оплате». Откроется окно оплаты, где вы сможете списать бонусы и оплатить ими до 99% стоимости топлива"
|
86
|
+
/>
|
87
|
+
</Accordion>
|
88
|
+
);
|
89
|
+
},
|
90
|
+
};
|
@@ -0,0 +1,35 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { RootProps } from '../../engines';
|
3
|
+
import type { AccordionProps } from './Accordion.types';
|
4
|
+
export declare const accordionRoot: (Root: RootProps<HTMLDivElement, AccordionProps>) => React.ForwardRefExoticComponent<{
|
5
|
+
view: string;
|
6
|
+
size?: string | undefined;
|
7
|
+
stretching?: "fixed" | "filled" | undefined;
|
8
|
+
children?: React.ReactNode;
|
9
|
+
className?: string | undefined;
|
10
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
11
|
+
export declare const accordionConfig: {
|
12
|
+
name: string;
|
13
|
+
tag: string;
|
14
|
+
layout: (Root: RootProps<HTMLDivElement, AccordionProps>) => React.ForwardRefExoticComponent<{
|
15
|
+
view: string;
|
16
|
+
size?: string | undefined;
|
17
|
+
stretching?: "fixed" | "filled" | undefined;
|
18
|
+
children?: React.ReactNode;
|
19
|
+
className?: string | undefined;
|
20
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
21
|
+
base: import("@linaria/core").LinariaClassName;
|
22
|
+
variations: {
|
23
|
+
view: {
|
24
|
+
css: import("@linaria/core").LinariaClassName;
|
25
|
+
};
|
26
|
+
size: {
|
27
|
+
css: import("@linaria/core").LinariaClassName;
|
28
|
+
};
|
29
|
+
};
|
30
|
+
defaults: {
|
31
|
+
view: string;
|
32
|
+
size: string;
|
33
|
+
};
|
34
|
+
};
|
35
|
+
//# sourceMappingURL=Accordion.d.ts.map
|