@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
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Accordion.tokens.js","sources":["../../../src/components/Accordion/Accordion.tokens.ts"],"sourcesContent":["export const classes = {\n filledStretching: 'accordion-stretching-filled',\n fixedStretching: 'accordion-stretching-fixed',\n accordionRoot: 'accordion-root',\n accordionItem: 'accordion-item',\n clearAccordionItem: 'clear-accordion-item',\n accordionItemShowBody: 'accordion-item-show-body',\n accordionPlusAnimationElement: 'accordion-plus-animation-element',\n};\n\nexport const tokens = {\n accordionGap: '--plasma-accordion-gap',\n accordionWidth: '--plasma-accordion-width',\n accordionBackground: '--plasma-accordion-background',\n\n accordionItemBackground: '--plasma-accordion-item-background',\n accordionItemBorderRadius: '--plasma-accordion-item-border-radius',\n accordionItemPadding: '--plasma-accordion-item-padding',\n accordionItemPaddingVertical: '--plasma-accordion-item-padding-vertical',\n accordionItemPaddingHorizontal: '--plasma-accordion-item-padding-horizontal',\n accordionItemGap: '--plasma-accordion-item-gap',\n accordionItemFocus: '--plasma-accordion-item-focus',\n accordionItemBorderBottom: '--plasma-accordion-item-border-bottom',\n\n accordionItemTitleColor: '--plasma-accordion-item-title-color',\n accordionItemTitleFontFamily: '--plasma-accordion-item-title-font-family',\n accordionItemTitleFontSize: '--plasma-accordion-item-title-font-size',\n accordionItemTitleFontStyle: '--plasma-accordion-item-title-font-style',\n accordionItemTitleFontWeight: '--plasma-accordion-item-title-font-weight',\n accordionItemTitleLetterSpacing: '--plasma-accordion-item-title-letter-spacing',\n accordionItemTitleLineHeight: '--plasma-accordion-item-title-line-height',\n\n accordionItemTextColor: '--plasma-accordion-item-text-color',\n accordionItemTextFontFamily: '--plasma-accordion-item-text-font-family',\n accordionItemTextFontSize: '--plasma-accordion-item-text-font-size',\n accordionItemTextFontStyle: '--plasma-accordion-item-text-font-style',\n accordionItemTextFontWeight: '--plasma-accordion-item-text-font-weight',\n accordionItemTextLetterSpacing: '--plasma-accordion-item-text-letter-spacing',\n accordionItemTextLineHeight: '--plasma-accordion-item-text-line-height',\n};\n"],"names":["classes","filledStretching","fixedStretching","accordionRoot","accordionItem","clearAccordionItem","accordionItemShowBody","accordionPlusAnimationElement","tokens","accordionGap","accordionWidth","accordionBackground","accordionItemBackground","accordionItemBorderRadius","accordionItemPadding","accordionItemPaddingVertical","accordionItemPaddingHorizontal","accordionItemGap","accordionItemFocus","accordionItemBorderBottom","accordionItemTitleColor","accordionItemTitleFontFamily","accordionItemTitleFontSize","accordionItemTitleFontStyle","accordionItemTitleFontWeight","accordionItemTitleLetterSpacing","accordionItemTitleLineHeight","accordionItemTextColor","accordionItemTextFontFamily","accordionItemTextFontSize","accordionItemTextFontStyle","accordionItemTextFontWeight","accordionItemTextLetterSpacing","accordionItemTextLineHeight"],"mappings":"AAAO,IAAMA,OAAO,GAAG;AACnBC,EAAAA,gBAAgB,EAAE,6BAA6B;AAC/CC,EAAAA,eAAe,EAAE,4BAA4B;AAC7CC,EAAAA,aAAa,EAAE,gBAAgB;AAC/BC,EAAAA,aAAa,EAAE,gBAAgB;AAC/BC,EAAAA,kBAAkB,EAAE,sBAAsB;AAC1CC,EAAAA,qBAAqB,EAAE,0BAA0B;AACjDC,EAAAA,6BAA6B,EAAE,
|
1
|
+
{"version":3,"file":"Accordion.tokens.js","sources":["../../../src/components/Accordion/Accordion.tokens.ts"],"sourcesContent":["export const classes = {\n filledStretching: 'accordion-stretching-filled',\n fixedStretching: 'accordion-stretching-fixed',\n accordionRoot: 'accordion-root',\n accordionItem: 'accordion-item',\n clearAccordionItem: 'clear-accordion-item',\n accordionItemShowBody: 'accordion-item-show-body',\n accordionPlusAnimationElement: 'accordion-plus-animation-element',\n accordionDisabled: 'accordion-disabled',\n};\n\nexport const tokens = {\n accordionGap: '--plasma-accordion-gap',\n accordionWidth: '--plasma-accordion-width',\n accordionBackground: '--plasma-accordion-background',\n\n accordionItemBackground: '--plasma-accordion-item-background',\n accordionItemBorderRadius: '--plasma-accordion-item-border-radius',\n accordionItemPadding: '--plasma-accordion-item-padding',\n accordionItemPaddingVertical: '--plasma-accordion-item-padding-vertical',\n accordionItemPaddingHorizontal: '--plasma-accordion-item-padding-horizontal',\n accordionItemGap: '--plasma-accordion-item-gap',\n accordionItemFocus: '--plasma-accordion-item-focus',\n accordionItemBorderBottom: '--plasma-accordion-item-border-bottom',\n\n accordionItemTitleColor: '--plasma-accordion-item-title-color',\n accordionItemTitleFontFamily: '--plasma-accordion-item-title-font-family',\n accordionItemTitleFontSize: '--plasma-accordion-item-title-font-size',\n accordionItemTitleFontStyle: '--plasma-accordion-item-title-font-style',\n accordionItemTitleFontWeight: '--plasma-accordion-item-title-font-weight',\n accordionItemTitleLetterSpacing: '--plasma-accordion-item-title-letter-spacing',\n accordionItemTitleLineHeight: '--plasma-accordion-item-title-line-height',\n\n accordionItemTextColor: '--plasma-accordion-item-text-color',\n accordionItemTextFontFamily: '--plasma-accordion-item-text-font-family',\n accordionItemTextFontSize: '--plasma-accordion-item-text-font-size',\n accordionItemTextFontStyle: '--plasma-accordion-item-text-font-style',\n accordionItemTextFontWeight: '--plasma-accordion-item-text-font-weight',\n accordionItemTextLetterSpacing: '--plasma-accordion-item-text-letter-spacing',\n accordionItemTextLineHeight: '--plasma-accordion-item-text-line-height',\n};\n"],"names":["classes","filledStretching","fixedStretching","accordionRoot","accordionItem","clearAccordionItem","accordionItemShowBody","accordionPlusAnimationElement","accordionDisabled","tokens","accordionGap","accordionWidth","accordionBackground","accordionItemBackground","accordionItemBorderRadius","accordionItemPadding","accordionItemPaddingVertical","accordionItemPaddingHorizontal","accordionItemGap","accordionItemFocus","accordionItemBorderBottom","accordionItemTitleColor","accordionItemTitleFontFamily","accordionItemTitleFontSize","accordionItemTitleFontStyle","accordionItemTitleFontWeight","accordionItemTitleLetterSpacing","accordionItemTitleLineHeight","accordionItemTextColor","accordionItemTextFontFamily","accordionItemTextFontSize","accordionItemTextFontStyle","accordionItemTextFontWeight","accordionItemTextLetterSpacing","accordionItemTextLineHeight"],"mappings":"AAAO,IAAMA,OAAO,GAAG;AACnBC,EAAAA,gBAAgB,EAAE,6BAA6B;AAC/CC,EAAAA,eAAe,EAAE,4BAA4B;AAC7CC,EAAAA,aAAa,EAAE,gBAAgB;AAC/BC,EAAAA,aAAa,EAAE,gBAAgB;AAC/BC,EAAAA,kBAAkB,EAAE,sBAAsB;AAC1CC,EAAAA,qBAAqB,EAAE,0BAA0B;AACjDC,EAAAA,6BAA6B,EAAE,kCAAkC;AACjEC,EAAAA,iBAAiB,EAAE,oBAAA;AACvB,EAAC;AAEM,IAAMC,MAAM,GAAG;AAClBC,EAAAA,YAAY,EAAE,wBAAwB;AACtCC,EAAAA,cAAc,EAAE,0BAA0B;AAC1CC,EAAAA,mBAAmB,EAAE,+BAA+B;AAEpDC,EAAAA,uBAAuB,EAAE,oCAAoC;AAC7DC,EAAAA,yBAAyB,EAAE,uCAAuC;AAClEC,EAAAA,oBAAoB,EAAE,iCAAiC;AACvDC,EAAAA,4BAA4B,EAAE,0CAA0C;AACxEC,EAAAA,8BAA8B,EAAE,4CAA4C;AAC5EC,EAAAA,gBAAgB,EAAE,6BAA6B;AAC/CC,EAAAA,kBAAkB,EAAE,+BAA+B;AACnDC,EAAAA,yBAAyB,EAAE,uCAAuC;AAElEC,EAAAA,uBAAuB,EAAE,qCAAqC;AAC9DC,EAAAA,4BAA4B,EAAE,2CAA2C;AACzEC,EAAAA,0BAA0B,EAAE,yCAAyC;AACrEC,EAAAA,2BAA2B,EAAE,0CAA0C;AACvEC,EAAAA,4BAA4B,EAAE,2CAA2C;AACzEC,EAAAA,+BAA+B,EAAE,8CAA8C;AAC/EC,EAAAA,4BAA4B,EAAE,2CAA2C;AAEzEC,EAAAA,sBAAsB,EAAE,oCAAoC;AAC5DC,EAAAA,2BAA2B,EAAE,0CAA0C;AACvEC,EAAAA,yBAAyB,EAAE,wCAAwC;AACnEC,EAAAA,0BAA0B,EAAE,yCAAyC;AACrEC,EAAAA,2BAA2B,EAAE,0CAA0C;AACvEC,EAAAA,8BAA8B,EAAE,6CAA6C;AAC7EC,EAAAA,2BAA2B,EAAE,0CAAA;AACjC;;;;"}
|
@@ -12,30 +12,34 @@ var AccordionItem = function AccordionItem(_ref) {
|
|
12
12
|
title = _ref.title,
|
13
13
|
_ref$pin = _ref.pin,
|
14
14
|
pin = _ref$pin === void 0 ? 'square-square' : _ref$pin,
|
15
|
-
|
15
|
+
children = _ref.children,
|
16
16
|
_ref$type = _ref.type,
|
17
17
|
type = _ref$type === void 0 ? 'sign' : _ref$type,
|
18
18
|
index = _ref.index,
|
19
|
-
|
20
|
-
updateValue = _ref.updateValue,
|
19
|
+
disabled = _ref.disabled,
|
21
20
|
onChangeValue = _ref.onChangeValue;
|
22
21
|
var _useState = useState(value),
|
23
22
|
_useState2 = _slicedToArray(_useState, 2),
|
24
|
-
|
23
|
+
isOpen = _useState2[0],
|
25
24
|
setShow = _useState2[1];
|
26
25
|
var _useState3 = useState(),
|
27
26
|
_useState4 = _slicedToArray(_useState3, 2),
|
28
27
|
leftPadding = _useState4[0],
|
29
28
|
setLeftPadding = _useState4[1];
|
30
|
-
var
|
31
|
-
|
32
|
-
|
33
|
-
|
29
|
+
var handleOpen = function handleOpen() {
|
30
|
+
if (disabled) {
|
31
|
+
return;
|
32
|
+
}
|
33
|
+
setShow(!isOpen);
|
34
|
+
onChangeValue && onChangeValue(index, !isOpen);
|
34
35
|
};
|
35
36
|
var onKeyPress = function onKeyPress(event) {
|
37
|
+
if (disabled) {
|
38
|
+
return;
|
39
|
+
}
|
36
40
|
event.persist();
|
37
41
|
if (event.keyCode === 13) {
|
38
|
-
|
42
|
+
handleOpen();
|
39
43
|
}
|
40
44
|
};
|
41
45
|
var leftContentRef = useRef(null);
|
@@ -46,7 +50,7 @@ var AccordionItem = function AccordionItem(_ref) {
|
|
46
50
|
var leftPaddingBody = leftContentWidth ? "calc(".concat(leftContentWidth, "px + var(").concat(tokens.accordionItemGap, "))") : 0;
|
47
51
|
setLeftPadding(leftPaddingBody);
|
48
52
|
}, [value, type, leftContentRef, setLeftPadding]);
|
49
|
-
var showedBody =
|
53
|
+
var showedBody = isOpen ? classes.accordionItemShowBody : undefined;
|
50
54
|
var StyledAnimationPLus = function StyledAnimationPLus() {
|
51
55
|
return /*#__PURE__*/React.createElement(StyledPlus, null, _StyledMinus || (_StyledMinus = /*#__PURE__*/React.createElement(StyledMinus, {
|
52
56
|
size: "xs",
|
@@ -58,24 +62,26 @@ var AccordionItem = function AccordionItem(_ref) {
|
|
58
62
|
}));
|
59
63
|
};
|
60
64
|
var accordionBorderRadius = convertRoundnessMatrix(pin, "var(".concat(tokens.accordionItemBorderRadius, ")"), '1.5rem');
|
65
|
+
var disabledClass = disabled ? classes.accordionDisabled : '';
|
61
66
|
var leftContent = contentLeft !== null && contentLeft !== void 0 ? contentLeft : type === 'arrow' ? _StyledArrow || (_StyledArrow = /*#__PURE__*/React.createElement(StyledArrow, {
|
62
67
|
size: "xs",
|
63
68
|
color: "inhert"
|
64
69
|
})) : undefined;
|
65
|
-
var leftContentRotate = type === 'arrow' &&
|
70
|
+
var leftContentRotate = type === 'arrow' && isOpen ? classes.accordionItemShowBody : undefined;
|
66
71
|
var rightContent = contentRight !== null && contentRight !== void 0 ? contentRight : type === 'sign' ? /*#__PURE__*/React.createElement(StyledAnimationPLus, null) : undefined;
|
67
|
-
var rightContentRotate = type === 'sign' &&
|
72
|
+
var rightContentRotate = type === 'sign' && isOpen ? classes.accordionItemShowBody : undefined;
|
68
73
|
return /*#__PURE__*/React.createElement(StyledAccordionItem, {
|
69
74
|
role: "tab",
|
70
75
|
className: classes.accordionItem,
|
71
76
|
tabIndex: 0,
|
72
|
-
key:
|
77
|
+
key: index,
|
73
78
|
style: {
|
74
79
|
borderRadius: accordionBorderRadius
|
75
80
|
},
|
76
81
|
onKeyDown: onKeyPress
|
77
82
|
}, /*#__PURE__*/React.createElement(StyledAccordionHeader, {
|
78
|
-
onClick:
|
83
|
+
onClick: handleOpen,
|
84
|
+
className: disabledClass
|
79
85
|
}, /*#__PURE__*/React.createElement(StyledAccordionHeaderLeft, null, leftContent && /*#__PURE__*/React.createElement(StyledAccordionContentLeft, {
|
80
86
|
ref: leftContentRef,
|
81
87
|
className: leftContentRotate
|
@@ -86,7 +92,7 @@ var AccordionItem = function AccordionItem(_ref) {
|
|
86
92
|
style: {
|
87
93
|
paddingLeft: "".concat(leftPadding)
|
88
94
|
}
|
89
|
-
}, /*#__PURE__*/React.createElement(StyledAccordionBody, null,
|
95
|
+
}, /*#__PURE__*/React.createElement(StyledAccordionBody, null, children)));
|
90
96
|
};
|
91
97
|
|
92
98
|
export { AccordionItem };
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"AccordionItem.js","sources":["../../../../../src/components/Accordion/ui/AccordionItem/AccordionItem.tsx"],"sourcesContent":["import React, { HTMLAttributes, useState, KeyboardEvent, useRef, useEffect } from 'react';\n\nimport { convertRoundnessMatrix } from '../../../../utils/roundness';\nimport { classes, tokens } from '../../Accordion.tokens';\n\nimport {\n StyledAccordionItem,\n StyledAccordionHeader,\n StyledAccordionBody,\n StyledAccordionTitle,\n StyledAccordionContentLeft,\n StyledAccordionHeaderLeft,\n StyledAccordionContentRight,\n StyledArrow,\n StyledMinus,\n StyledPlus,\n StyledAccordionBodyAnimate,\n} from './AccordionItem.styles';\nimport type { AccordionItemProps } from './AccordionItem.types';\n\nexport const AccordionItem: React.FC<HTMLAttributes<HTMLDivElement> & AccordionItemProps> = ({\n value,\n contentRight,\n contentLeft,\n title,\n pin = 'square-square',\n
|
1
|
+
{"version":3,"file":"AccordionItem.js","sources":["../../../../../src/components/Accordion/ui/AccordionItem/AccordionItem.tsx"],"sourcesContent":["import React, { HTMLAttributes, useState, KeyboardEvent, useRef, useEffect } from 'react';\n\nimport { convertRoundnessMatrix } from '../../../../utils/roundness';\nimport { classes, tokens } from '../../Accordion.tokens';\n\nimport {\n StyledAccordionItem,\n StyledAccordionHeader,\n StyledAccordionBody,\n StyledAccordionTitle,\n StyledAccordionContentLeft,\n StyledAccordionHeaderLeft,\n StyledAccordionContentRight,\n StyledArrow,\n StyledMinus,\n StyledPlus,\n StyledAccordionBodyAnimate,\n} from './AccordionItem.styles';\nimport type { AccordionItemProps } from './AccordionItem.types';\n\nexport const AccordionItem: React.FC<HTMLAttributes<HTMLDivElement> & AccordionItemProps> = ({\n value,\n contentRight,\n contentLeft,\n title,\n pin = 'square-square',\n children,\n type = 'sign',\n index,\n disabled,\n onChangeValue,\n}) => {\n const [isOpen, setShow] = useState(value);\n const [leftPadding, setLeftPadding] = useState<string | number | null>();\n\n const handleOpen = () => {\n if (disabled) {\n return;\n }\n setShow(!isOpen);\n onChangeValue && onChangeValue(index, !isOpen);\n };\n\n const onKeyPress = (event: KeyboardEvent<HTMLDivElement>) => {\n if (disabled) {\n return;\n }\n event.persist();\n if (event.keyCode === 13) {\n handleOpen();\n }\n };\n\n const leftContentRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n setShow(value);\n const leftContentWidth = leftContentRef?.current?.offsetWidth ?? 0;\n const leftPaddingBody = leftContentWidth ? `calc(${leftContentWidth}px + var(${tokens.accordionItemGap}))` : 0;\n setLeftPadding(leftPaddingBody);\n }, [value, type, leftContentRef, setLeftPadding]);\n\n const showedBody = isOpen ? classes.accordionItemShowBody : undefined;\n\n const StyledAnimationPLus = () => (\n <StyledPlus>\n <StyledMinus size=\"xs\" color=\"inhert\" />\n <StyledMinus size=\"xs\" color=\"inhert\" className={showedBody ?? classes.accordionPlusAnimationElement} />\n </StyledPlus>\n );\n\n const accordionBorderRadius = convertRoundnessMatrix(pin, `var(${tokens.accordionItemBorderRadius})`, '1.5rem');\n const disabledClass = disabled ? classes.accordionDisabled : '';\n\n const leftContent = contentLeft ?? (type === 'arrow' ? <StyledArrow size=\"xs\" color=\"inhert\" /> : undefined);\n const leftContentRotate = type === 'arrow' && isOpen ? classes.accordionItemShowBody : undefined;\n\n const rightContent = contentRight ?? (type === 'sign' ? <StyledAnimationPLus /> : undefined);\n const rightContentRotate = type === 'sign' && isOpen ? classes.accordionItemShowBody : undefined;\n\n return (\n <StyledAccordionItem\n role=\"tab\"\n className={classes.accordionItem}\n tabIndex={0}\n key={index}\n style={{ borderRadius: accordionBorderRadius }}\n onKeyDown={onKeyPress}\n >\n <StyledAccordionHeader onClick={handleOpen} className={disabledClass}>\n <StyledAccordionHeaderLeft>\n {leftContent && (\n <StyledAccordionContentLeft ref={leftContentRef} className={leftContentRotate}>\n {leftContent}\n </StyledAccordionContentLeft>\n )}\n <StyledAccordionTitle>{title}</StyledAccordionTitle>\n </StyledAccordionHeaderLeft>\n\n <StyledAccordionContentRight className={rightContentRotate}>\n {rightContent && rightContent}\n </StyledAccordionContentRight>\n </StyledAccordionHeader>\n <StyledAccordionBodyAnimate className={showedBody} style={{ paddingLeft: `${leftPadding}` }}>\n <StyledAccordionBody>{children}</StyledAccordionBody>\n </StyledAccordionBodyAnimate>\n </StyledAccordionItem>\n );\n};\n"],"names":["AccordionItem","_ref","value","contentRight","contentLeft","title","_ref$pin","pin","children","_ref$type","type","index","disabled","onChangeValue","_useState","useState","_useState2","_slicedToArray","isOpen","setShow","_useState3","_useState4","leftPadding","setLeftPadding","handleOpen","onKeyPress","event","persist","keyCode","leftContentRef","useRef","useEffect","_leftContentRef$curre","_leftContentRef$curre2","leftContentWidth","current","offsetWidth","leftPaddingBody","concat","tokens","accordionItemGap","showedBody","classes","accordionItemShowBody","undefined","StyledAnimationPLus","React","createElement","StyledPlus","_StyledMinus","StyledMinus","size","color","className","accordionPlusAnimationElement","accordionBorderRadius","convertRoundnessMatrix","accordionItemBorderRadius","disabledClass","accordionDisabled","leftContent","_StyledArrow","StyledArrow","leftContentRotate","rightContent","rightContentRotate","StyledAccordionItem","role","accordionItem","tabIndex","key","style","borderRadius","onKeyDown","StyledAccordionHeader","onClick","StyledAccordionHeaderLeft","StyledAccordionContentLeft","ref","StyledAccordionTitle","StyledAccordionContentRight","StyledAccordionBodyAnimate","paddingLeft","StyledAccordionBody"],"mappings":";;;;;;;IAoBaA,aAA4E,GAAG,SAA/EA,aAA4EA,CAAAC,IAAA,EAWnF;AAAA,EAAA,IAVFC,KAAK,GAAAD,IAAA,CAALC,KAAK;IACLC,YAAY,GAAAF,IAAA,CAAZE,YAAY;IACZC,WAAW,GAAAH,IAAA,CAAXG,WAAW;IACXC,KAAK,GAAAJ,IAAA,CAALI,KAAK;IAAAC,QAAA,GAAAL,IAAA,CACLM,GAAG;AAAHA,IAAAA,GAAG,GAAAD,QAAA,KAAG,KAAA,CAAA,GAAA,eAAe,GAAAA,QAAA;IACrBE,QAAQ,GAAAP,IAAA,CAARO,QAAQ;IAAAC,SAAA,GAAAR,IAAA,CACRS,IAAI;AAAJA,IAAAA,IAAI,GAAAD,SAAA,KAAG,KAAA,CAAA,GAAA,MAAM,GAAAA,SAAA;IACbE,KAAK,GAAAV,IAAA,CAALU,KAAK;IAC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AAAA;AAAW,GAAA,eAEtBqB,KAAA,CAAAC,aAAA,CAAC2B,qBAAqB,EAAA;AAACC,IAAAA,OAAO,EAAEnD,UAAW;AAAC6B,IAAAA,SAAS,EAAEK,aAAAA;AAAc,GAAA,eACjEZ,KAAA,CAAAC,aAAA,CAAC6B,yBAAyB,EAAA,IAAA,EACrBhB,WAAW,iBACRd,KAAA,CAAAC,aAAA,CAAC8B,0BAA0B,EAAA;AAACC,IAAAA,GAAG,EAAEjD,cAAe;AAACwB,IAAAA,SAAS,EAAEU,iBAAAA;AAAkB,GAAA,EACzEH,WACuB,CAC/B,eACDd,KAAA,CAAAC,aAAA,CAACgC,oBAAoB,EAAE1E,IAAAA,EAAAA,KAA4B,CAC5B,CAAC,eAE5ByC,KAAA,CAAAC,aAAA,CAACiC,2BAA2B,EAAA;AAAC3B,IAAAA,SAAS,EAAEY,kBAAAA;GACnCD,EAAAA,YAAY,IAAIA,YACQ,CACV,CAAC,eACxBlB,KAAA,CAAAC,aAAA,CAACkC,0BAA0B,EAAA;AAAC5B,IAAAA,SAAS,EAAEZ,UAAW;AAAC8B,IAAAA,KAAK,EAAE;MAAEW,WAAW,EAAA,EAAA,CAAA5C,MAAA,CAAKhB,WAAW,CAAA;AAAG,KAAA;GACtFwB,eAAAA,KAAA,CAAAC,aAAA,CAACoC,mBAAmB,EAAE3E,IAAAA,EAAAA,QAA8B,CAC5B,CACX,CAAC,CAAA;AAE9B;;;;"}
|
@@ -16,22 +16,22 @@ var StyledAccordionItem = /*#__PURE__*/styled.div.withConfig({
|
|
16
16
|
}));
|
17
17
|
var StyledAccordionHeader = /*#__PURE__*/styled.div.withConfig({
|
18
18
|
componentId: "plasma-new-hope__sc-iot32d-1"
|
19
|
-
})(["padding:var(", ");display:flex;gap:var(", ");justify-content:space-between;align-items:center;cursor:pointer;"], tokens.accordionItemPadding, tokens.accordionItemGap);
|
19
|
+
})(["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);
|
20
20
|
var StyledAccordionHeaderLeft = /*#__PURE__*/styled.div.withConfig({
|
21
21
|
componentId: "plasma-new-hope__sc-iot32d-2"
|
22
22
|
})(["display:flex;gap:var(", ");justify-content:space-between;align-items:center;"], tokens.accordionItemGap);
|
23
23
|
var StyledAccordionContentRight = /*#__PURE__*/styled.div.withConfig({
|
24
24
|
componentId: "plasma-new-hope__sc-iot32d-3"
|
25
|
-
})(["transition:0.2s;transform:rotate(90deg)
|
25
|
+
})(["transition:0.2s;transform:rotate(90deg);&.", "{transition:0.2s;transform:rotate(0deg);}"], classes.accordionItemShowBody);
|
26
26
|
var StyledAccordionContentLeft = /*#__PURE__*/styled.div.withConfig({
|
27
27
|
componentId: "plasma-new-hope__sc-iot32d-4"
|
28
|
-
})(["transition:0.2s;display:flex;align-items:center
|
28
|
+
})(["transition:0.2s;display:flex;align-items:center;&.", "{transition:0.2s;transform:rotate(180deg);}"], classes.accordionItemShowBody);
|
29
29
|
var StyledAccordionTitle = /*#__PURE__*/styled.div.withConfig({
|
30
30
|
componentId: "plasma-new-hope__sc-iot32d-5"
|
31
31
|
})(["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);
|
32
32
|
var StyledAccordionBodyAnimate = /*#__PURE__*/styled.div.withConfig({
|
33
33
|
componentId: "plasma-new-hope__sc-iot32d-6"
|
34
|
-
})(["display:grid;grid-template-rows:0fr;transition:grid-template-rows 0.2s ease-out;overflow:hidden
|
34
|
+
})(["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);
|
35
35
|
var StyledAccordionBody = /*#__PURE__*/styled.div.withConfig({
|
36
36
|
componentId: "plasma-new-hope__sc-iot32d-7"
|
37
37
|
})(["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);
|
@@ -40,7 +40,7 @@ var StyledArrow = /*#__PURE__*/styled(IconChevronDownFill).withConfig({
|
|
40
40
|
})(["pointer-events:none;user-select:none;color:var(", ");"], tokens.accordionItemTextColor);
|
41
41
|
var StyledMinus = /*#__PURE__*/styled(IconMinus).withConfig({
|
42
42
|
componentId: "plasma-new-hope__sc-iot32d-9"
|
43
|
-
})(["pointer-events:none;user-select:none;color:var(", ");display:flex;align-items:center;position:absolute;top:0;left:0
|
43
|
+
})(["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);
|
44
44
|
var StyledPlus = /*#__PURE__*/styled.div.withConfig({
|
45
45
|
componentId: "plasma-new-hope__sc-iot32d-10"
|
46
46
|
})(["position:relative;height:1rem;display:flex;align-items:center;justify-content:center;width:1rem;"]);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"AccordionItem.styles.js","sources":["../../../../../src/components/Accordion/ui/AccordionItem/AccordionItem.styles.ts"],"sourcesContent":["import styled from 'styled-components';\n\nimport { IconChevronDownFill, IconMinus } from '../../../_Icon';\nimport { classes, tokens } from '../../Accordion.tokens';\nimport { addFocus } from '../../../../mixins';\n\nexport const StyledAccordionItem = styled.div`\n background: var(${tokens.accordionItemBackground});\n border-bottom: var(${tokens.accordionItemBorderBottom});\n &:focus {\n outline: none;\n }\n\n ${addFocus({\n outlineOffset: '0.125rem',\n outlineSize: '0.125rem',\n outlineRadius: '0',\n outlineColor: `var(${tokens.accordionItemFocus})`,\n })}\n\n &:last-child {\n border-bottom: none;\n }\n`;\n\nexport const StyledAccordionHeader = styled.div`\n padding: var(${tokens.accordionItemPadding});\n display: flex;\n gap: var(${tokens.accordionItemGap});\n justify-content: space-between;\n align-items: center;\n cursor: pointer;\n`;\n\nexport const StyledAccordionHeaderLeft = styled.div`\n display: flex;\n gap: var(${tokens.accordionItemGap});\n justify-content: space-between;\n align-items: center;\n`;\n\nexport const StyledAccordionContentRight = styled.div`\n transition: 0.2s;\n transform: rotate(90deg);\n\n
|
1
|
+
{"version":3,"file":"AccordionItem.styles.js","sources":["../../../../../src/components/Accordion/ui/AccordionItem/AccordionItem.styles.ts"],"sourcesContent":["import styled from 'styled-components';\n\nimport { IconChevronDownFill, IconMinus } from '../../../_Icon';\nimport { classes, tokens } from '../../Accordion.tokens';\nimport { addFocus } from '../../../../mixins';\n\nexport const StyledAccordionItem = styled.div`\n background: var(${tokens.accordionItemBackground});\n border-bottom: var(${tokens.accordionItemBorderBottom});\n &:focus {\n outline: none;\n }\n\n ${addFocus({\n outlineOffset: '0.125rem',\n outlineSize: '0.125rem',\n outlineRadius: '0',\n outlineColor: `var(${tokens.accordionItemFocus})`,\n })}\n\n &:last-child {\n border-bottom: none;\n }\n`;\n\nexport const StyledAccordionHeader = styled.div`\n padding: var(${tokens.accordionItemPadding});\n display: flex;\n gap: var(${tokens.accordionItemGap});\n justify-content: space-between;\n align-items: center;\n cursor: pointer;\n\n &.${classes.accordionDisabled} {\n opacity: 0.4;\n cursor: not-allowed;\n }\n`;\n\nexport const StyledAccordionHeaderLeft = styled.div`\n display: flex;\n gap: var(${tokens.accordionItemGap});\n justify-content: space-between;\n align-items: center;\n`;\n\nexport const StyledAccordionContentRight = styled.div`\n transition: 0.2s;\n transform: rotate(90deg);\n\n &.${classes.accordionItemShowBody} {\n transition: 0.2s;\n transform: rotate(0deg);\n }\n`;\n\nexport const StyledAccordionContentLeft = styled.div`\n transition: 0.2s;\n display: flex;\n align-items: center;\n\n &.${classes.accordionItemShowBody} {\n transition: 0.2s;\n transform: rotate(180deg);\n }\n`;\n\nexport const StyledAccordionTitle = styled.div`\n color: var(${tokens.accordionItemTitleColor});\n font-family: var(${tokens.accordionItemTitleFontFamily});\n font-size: var(${tokens.accordionItemTitleFontSize});\n font-weight: var(${tokens.accordionItemTitleFontWeight});\n font-style: var(${tokens.accordionItemTitleFontStyle});\n letter-spacing: var(${tokens.accordionItemTitleLetterSpacing});\n line-height: var(${tokens.accordionItemTitleLineHeight});\n`;\n\nexport const StyledAccordionBodyAnimate = styled.div`\n display: grid;\n grid-template-rows: 0fr;\n transition: grid-template-rows 0.2s ease-out;\n overflow: hidden;\n\n &.${classes.accordionItemShowBody} {\n grid-template-rows: 1fr;\n padding-bottom: var(${tokens.accordionItemPaddingVertical});\n\n &.${classes.accordionPlusAnimationElement} {\n transition: 0.2s;\n transform: rotate(0deg);\n }\n }\n`;\n\nexport const StyledAccordionBody = styled.div`\n color: var(${tokens.accordionItemTextColor});\n font-family: var(${tokens.accordionItemTextFontFamily});\n font-size: var(${tokens.accordionItemTextFontSize});\n font-weight: var(${tokens.accordionItemTextFontWeight});\n font-style: var(${tokens.accordionItemTextFontStyle});\n letter-spacing: var(${tokens.accordionItemTextLetterSpacing});\n line-height: var(${tokens.accordionItemTextLineHeight});\n overflow: hidden;\n padding-right: var(${tokens.accordionItemPaddingHorizontal});\n padding-left: var(${tokens.accordionItemPaddingHorizontal});\n`;\n\nexport const StyledArrow = styled(IconChevronDownFill)`\n pointer-events: none;\n user-select: none;\n color: var(${tokens.accordionItemTextColor});\n`;\n\nexport const StyledMinus = styled(IconMinus)`\n pointer-events: none;\n user-select: none;\n color: var(${tokens.accordionItemTextColor});\n display: flex;\n align-items: center;\n position: absolute;\n top: 0;\n left: 0;\n\n &.${classes.accordionPlusAnimationElement} {\n transition: 0.2s;\n transform: rotate(90deg);\n }\n\n &.${classes.accordionItemShowBody} {\n transition: 0.2s;\n transform: rotate(0deg);\n }\n`;\n\nexport const StyledPlus = styled.div`\n position: relative;\n height: 1rem;\n display: flex;\n align-items: center;\n justify-content: center;\n width: 1rem;\n`;\n"],"names":["StyledAccordionItem","styled","div","withConfig","componentId","tokens","accordionItemBackground","accordionItemBorderBottom","addFocus","outlineOffset","outlineSize","outlineRadius","outlineColor","concat","accordionItemFocus","StyledAccordionHeader","accordionItemPadding","accordionItemGap","classes","accordionDisabled","StyledAccordionHeaderLeft","StyledAccordionContentRight","accordionItemShowBody","StyledAccordionContentLeft","StyledAccordionTitle","accordionItemTitleColor","accordionItemTitleFontFamily","accordionItemTitleFontSize","accordionItemTitleFontWeight","accordionItemTitleFontStyle","accordionItemTitleLetterSpacing","accordionItemTitleLineHeight","StyledAccordionBodyAnimate","accordionItemPaddingVertical","accordionPlusAnimationElement","StyledAccordionBody","accordionItemTextColor","accordionItemTextFontFamily","accordionItemTextFontSize","accordionItemTextFontWeight","accordionItemTextFontStyle","accordionItemTextLetterSpacing","accordionItemTextLineHeight","accordionItemPaddingHorizontal","StyledArrow","IconChevronDownFill","StyledMinus","IconMinus","StyledPlus"],"mappings":";;;;;;;;IAMaA,mBAAmB,gBAAGC,MAAM,CAACC,GAAG,CAAAC,UAAA,CAAA;EAAAC,WAAA,EAAA,8BAAA;AAAA,CACvBC,CAAAA,CAAAA,CAAAA,iBAAAA,EAAAA,sBAAAA,EAAAA,0BAAAA,EAAAA,oCAAAA,CAAAA,EAAAA,MAAM,CAACC,uBAAuB,EAC3BD,MAAM,CAACE,yBAAyB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A,8BAAA;AAAA,CAGrCC,CAAAA,CAAAA,CAAAA,iDAAAA,EAAAA,IAAAA,CAAAA,EAAAA,MAAM,CAAC+B,sBAAsB,EAC7C;AAEM,IAAMU,WAAW,gBAAG7C,MAAM,CAAC8C,SAAS,CAAC,CAAA5C,UAAA,CAAA;EAAAC,WAAA,EAAA,8BAAA;AAAA,CAG3BC,CAAAA,CAAAA,CAAAA,iDAAAA,EAAAA,qEAAAA,EAAAA,8CAAAA,EAAAA,2CAAAA,CAAAA,EAAAA,MAAM,CAAC+B,sBAAsB,EAOtClB,OAAO,CAACgB,6BAA6B,EAKrChB,OAAO,CAACI,qBAAqB,EAIpC;IAEY0B,UAAU,gBAAG/C,MAAM,CAACC,GAAG,CAAAC,UAAA,CAAA;EAAAC,WAAA,EAAA,+BAAA;AAAA,CAOnC,CAAA,CAAA,CAAA,kGAAA,CAAA;;;;"}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { Children, isValidElement, cloneElement } from 'react';
|
2
2
|
|
3
|
-
var updatePropsRecursively = function updatePropsRecursively(children, activeIndex, updateValue) {
|
3
|
+
var updatePropsRecursively = function updatePropsRecursively(children, activeIndex, disabled, updateValue) {
|
4
4
|
return Children.map(children || [], function (child, index) {
|
5
5
|
if (! /*#__PURE__*/isValidElement(child)) {
|
6
6
|
return child;
|
@@ -8,13 +8,14 @@ var updatePropsRecursively = function updatePropsRecursively(children, activeInd
|
|
8
8
|
var props = {
|
9
9
|
index: index,
|
10
10
|
value: activeIndex === index,
|
11
|
-
|
11
|
+
disabled: disabled,
|
12
|
+
onChangeValue: updateValue
|
12
13
|
};
|
13
14
|
return /*#__PURE__*/cloneElement(child, props);
|
14
15
|
});
|
15
16
|
};
|
16
|
-
var getChildren = function getChildren(children, activeIndex, updateValue) {
|
17
|
-
return updatePropsRecursively(children, activeIndex, updateValue);
|
17
|
+
var getChildren = function getChildren(children, activeIndex, disabled, updateValue) {
|
18
|
+
return updatePropsRecursively(children, activeIndex, disabled, updateValue);
|
18
19
|
};
|
19
20
|
|
20
21
|
export { getChildren, updatePropsRecursively };
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/Accordion/utils/index.ts"],"sourcesContent":["import { Children, ReactElement, ReactNode, cloneElement, isValidElement } from 'react';\n\nimport { AccordionItemProps } from '../ui/AccordionItem/AccordionItem.types';\n\nexport const updatePropsRecursively = (\n children?: ReactElement<AccordionItemProps>[],\n activeIndex?: number,\n updateValue?: (index?: number, value?: boolean) => void,\n): ReactNode[] =>\n Children.map(children || [], (child, index) => {\n if (!isValidElement(child)) {\n return child;\n }\n\n const props = {\n index,\n value: activeIndex === index,\n updateValue,\n };\n\n return cloneElement(child, props);\n });\n\nexport const getChildren = (\n children: ReactElement<AccordionItemProps>[],\n activeIndex?: number,\n updateValue?: (index?: number, value?: boolean) => void,\n) => {\n return updatePropsRecursively(children, activeIndex, updateValue);\n};\n"],"names":["updatePropsRecursively","children","activeIndex","updateValue","Children","map","child","index","isValidElement","props","value","cloneElement","getChildren"],"mappings":";;
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/Accordion/utils/index.ts"],"sourcesContent":["import { Children, ReactElement, ReactNode, cloneElement, isValidElement } from 'react';\n\nimport { AccordionItemProps } from '../ui/AccordionItem/AccordionItem.types';\n\nexport const updatePropsRecursively = (\n children?: ReactElement<AccordionItemProps>[],\n activeIndex?: number,\n disabled?: boolean,\n updateValue?: (index?: number, value?: boolean) => void,\n): ReactNode[] =>\n Children.map(children || [], (child, index) => {\n if (!isValidElement(child)) {\n return child;\n }\n\n const props = {\n index,\n value: activeIndex === index,\n disabled,\n onChangeValue: updateValue,\n };\n\n return cloneElement(child, props);\n });\n\nexport const getChildren = (\n children: ReactElement<AccordionItemProps>[],\n activeIndex?: number,\n disabled?: boolean,\n updateValue?: (index?: number, value?: boolean) => void,\n) => {\n return updatePropsRecursively(children, activeIndex, disabled, updateValue);\n};\n"],"names":["updatePropsRecursively","children","activeIndex","disabled","updateValue","Children","map","child","index","isValidElement","props","value","onChangeValue","cloneElement","getChildren"],"mappings":";;AAIaA,IAAAA,sBAAsB,GAAG,SAAzBA,sBAAsBA,CAC/BC,QAA6C,EAC7CC,WAAoB,EACpBC,QAAkB,EAClBC,WAAuD,EAAA;AAAA,EAAA,OAEvDC,QAAQ,CAACC,GAAG,CAACL,QAAQ,IAAI,EAAE,EAAE,UAACM,KAAK,EAAEC,KAAK,EAAK;AAC3C,IAAA,IAAI,eAACC,cAAc,CAACF,KAAK,CAAC,EAAE;AACxB,MAAA,OAAOA,KAAK,CAAA;AAChB,KAAA;AAEA,IAAA,IAAMG,KAAK,GAAG;AACVF,MAAAA,KAAK,EAALA,KAAK;MACLG,KAAK,EAAET,WAAW,KAAKM,KAAK;AAC5BL,MAAAA,QAAQ,EAARA,QAAQ;AACRS,MAAAA,aAAa,EAAER,WAAAA;KAClB,CAAA;AAED,IAAA,oBAAOS,YAAY,CAACN,KAAK,EAAEG,KAAK,CAAC,CAAA;AACrC,GAAC,CAAC,CAAA;AAAA,EAAA;AAEOI,IAAAA,WAAW,GAAG,SAAdA,WAAWA,CACpBb,QAA4C,EAC5CC,WAAoB,EACpBC,QAAkB,EAClBC,WAAuD,EACtD;EACD,OAAOJ,sBAAsB,CAACC,QAAQ,EAAEC,WAAW,EAAEC,QAAQ,EAAEC,WAAW,CAAC,CAAA;AAC/E;;;;"}
|
@@ -1,28 +1,19 @@
|
|
1
1
|
import { extends as _extends } from '../../../_virtual/_rollupPluginBabelHelpers.js';
|
2
2
|
import React from 'react';
|
3
3
|
|
4
|
-
var
|
4
|
+
var _path;
|
5
5
|
var ChevronDownFill = function ChevronDownFill(props) {
|
6
6
|
return /*#__PURE__*/React.createElement("svg", _extends({
|
7
7
|
width: "100%",
|
8
8
|
viewBox: "0 0 16 16",
|
9
9
|
fill: "none"
|
10
|
-
}, props),
|
11
|
-
id: "clip3066_154194"
|
12
|
-
}, /*#__PURE__*/React.createElement("rect", {
|
13
|
-
width: "16.000000",
|
14
|
-
height: "16.000000",
|
15
|
-
fill: "currentColor",
|
16
|
-
fillOpacity: "0"
|
17
|
-
})))), _g || (_g = /*#__PURE__*/React.createElement("g", {
|
18
|
-
clipPath: "url(#clip3066_154194)"
|
19
|
-
}, /*#__PURE__*/React.createElement("path", {
|
10
|
+
}, props), _path || (_path = /*#__PURE__*/React.createElement("path", {
|
20
11
|
id: "path",
|
21
12
|
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",
|
22
13
|
fillRule: "evenodd",
|
23
14
|
fill: "currentColor",
|
24
15
|
clipRule: "evenodd"
|
25
|
-
})))
|
16
|
+
})));
|
26
17
|
};
|
27
18
|
|
28
19
|
export { ChevronDownFill };
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ChevronDownFill.js","sources":["../../../../src/components/_Icon/Icon.assets/ChevronDownFill.tsx"],"sourcesContent":["import React from 'react';\n\nimport { IconProps } from '../IconRoot';\n\nexport const ChevronDownFill: React.FC<IconProps> = (props) => (\n <svg width=\"100%\" viewBox=\"0 0 16 16\" fill=\"none\" {...props}>\n <
|
1
|
+
{"version":3,"file":"ChevronDownFill.js","sources":["../../../../src/components/_Icon/Icon.assets/ChevronDownFill.tsx"],"sourcesContent":["import React from 'react';\n\nimport { IconProps } from '../IconRoot';\n\nexport const ChevronDownFill: React.FC<IconProps> = (props) => (\n <svg width=\"100%\" viewBox=\"0 0 16 16\" fill=\"none\" {...props}>\n <path\n id=\"path\"\n 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\"\n fillRule=\"evenodd\"\n fill=\"currentColor\"\n clipRule=\"evenodd\"\n />\n </svg>\n);\n"],"names":["ChevronDownFill","props","React","createElement","_extends","width","viewBox","fill","_path","id","d","fillRule","clipRule"],"mappings":";;;;IAIaA,eAAoC,GAAG,SAAvCA,eAAoCA,CAAIC,KAAK,EAAA;AAAA,EAAA,oBACtDC,KAAA,CAAAC,aAAA,CAAA,KAAA,EAAAC,QAAA,CAAA;AAAKC,IAAAA,KAAK,EAAC,MAAM;AAACC,IAAAA,OAAO,EAAC,WAAW;AAACC,IAAAA,IAAI,EAAC,MAAA;GAAWN,EAAAA,KAAK,GAAAO,KAAA,KAAAA,KAAA,gBACvDN,KAAA,CAAAC,aAAA,CAAA,MAAA,EAAA;AACIM,IAAAA,EAAE,EAAC,MAAM;AACTC,IAAAA,CAAC,EAAC,kNAAkN;AACpNC,IAAAA,QAAQ,EAAC,SAAS;AAClBJ,IAAAA,IAAI,EAAC,cAAc;AACnBK,IAAAA,QAAQ,EAAC,SAAA;GACZ,CAAC,CACD,CAAC,CAAA;AAAA;;;;"}
|
package/es/index.css
CHANGED
@@ -580,4 +580,4 @@
|
|
580
580
|
|
581
581
|
|
582
582
|
|
583
|
-
.
|
583
|
+
.Accordion_styles_rsiff6_bjv6ypd__465a9c67{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;gap:var(--plasma-accordion-gap);-webkit-align-items:stretch;-webkit-box-align:stretch;-ms-flex-align:stretch;align-items:stretch;height:auto;background:var(--plasma-accordion-background);}.Accordion_styles_rsiff6_bjv6ypd__465a9c67.Accordion_styles_rsiff6_accordionStretchingFixed__465a9c67{width:var(--plasma-accordion-width);}.Accordion_styles_rsiff6_bjv6ypd__465a9c67.Accordion_styles_rsiff6_accordionStretchingFilled__465a9c67{width:100%;}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@salutejs/plasma-new-hope",
|
3
|
-
"version": "0.88.0-canary.1223.
|
3
|
+
"version": "0.88.0-canary.1223.9398061354.0",
|
4
4
|
"description": "Salute Design System blueprint",
|
5
5
|
"main": "cjs/index.js",
|
6
6
|
"module": "es/index.js",
|
@@ -103,5 +103,5 @@
|
|
103
103
|
"react-popper": "2.3.0",
|
104
104
|
"storeon": "3.1.5"
|
105
105
|
},
|
106
|
-
"gitHead": "
|
106
|
+
"gitHead": "0383cd63df621a424b3351fe443dc74692b3ed28"
|
107
107
|
}
|
@@ -26,29 +26,31 @@ var accordionRoot = exports.accordionRoot = function accordionRoot(Root) {
|
|
26
26
|
view = _ref.view,
|
27
27
|
_ref$stretching = _ref.stretching,
|
28
28
|
stretching = _ref$stretching === void 0 ? 'filled' : _ref$stretching,
|
29
|
+
defaultActiveIndex = _ref.defaultActiveIndex,
|
29
30
|
children = _ref.children,
|
31
|
+
disabled = _ref.disabled,
|
30
32
|
className = _ref.className,
|
31
|
-
|
33
|
+
singleActive = _ref.singleActive,
|
34
|
+
onChangeValue = _ref.onChangeValue;
|
32
35
|
var stretchingClass = _Accordion2.classes["".concat(stretching, "Stretching")];
|
33
|
-
var _useState = (0, _react.useState)(),
|
36
|
+
var _useState = (0, _react.useState)(defaultActiveIndex),
|
34
37
|
_useState2 = _slicedToArray(_useState, 2),
|
35
38
|
activeIndex = _useState2[0],
|
36
39
|
setActiveIndex = _useState2[1];
|
37
40
|
var updateValue = function updateValue(index, value) {
|
38
|
-
|
41
|
+
onChangeValue && onChangeValue(index, value);
|
42
|
+
if (value && singleActive) {
|
43
|
+
setActiveIndex(index);
|
44
|
+
}
|
39
45
|
};
|
40
|
-
var childrenArray =
|
41
|
-
|
42
|
-
}, [children]);
|
43
|
-
var childrenMemo = (0, _react.useMemo)(function () {
|
44
|
-
return (0, _utils2.getChildren)(childrenArray, activeIndex, updateValue);
|
45
|
-
}, [activeIndex, updateValue, childrenArray]);
|
46
|
+
var childrenArray = _react.Children.toArray(children);
|
47
|
+
var childrenMemo = (0, _utils2.getChildren)(childrenArray, activeIndex, disabled, updateValue);
|
46
48
|
return /*#__PURE__*/_react["default"].createElement(Root, {
|
47
49
|
ref: outerRootRef,
|
48
50
|
size: size,
|
49
51
|
view: view,
|
50
52
|
className: (0, _utils.cx)(stretchingClass, _Accordion2.classes.accordionRoot, className)
|
51
|
-
},
|
53
|
+
}, childrenMemo);
|
52
54
|
});
|
53
55
|
};
|
54
56
|
var accordionConfig = exports.accordionConfig = {
|
@@ -6,4 +6,4 @@ Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
exports.base = void 0;
|
7
7
|
var _styledComponents = /*#__PURE__*/require("styled-components");
|
8
8
|
var _Accordion = /*#__PURE__*/require("./Accordion.tokens");
|
9
|
-
var base = exports.base = /*#__PURE__*/(0, _styledComponents.css)(["display:flex;flex-direction:column;gap:var(", ");align-items:stretch;height:auto;background:var(", ")
|
9
|
+
var base = exports.base = /*#__PURE__*/(0, _styledComponents.css)(["display:flex;flex-direction:column;gap:var(", ");align-items:stretch;height:auto;background:var(", ");&.", "{width:var(", ");}&.", "{width:100%;}"], _Accordion.tokens.accordionGap, _Accordion.tokens.accordionBackground, _Accordion.classes.fixedStretching, _Accordion.tokens.accordionWidth, _Accordion.classes.filledStretching);
|
@@ -11,7 +11,8 @@ var classes = exports.classes = {
|
|
11
11
|
accordionItem: 'accordion-item',
|
12
12
|
clearAccordionItem: 'clear-accordion-item',
|
13
13
|
accordionItemShowBody: 'accordion-item-show-body',
|
14
|
-
accordionPlusAnimationElement: 'accordion-plus-animation-element'
|
14
|
+
accordionPlusAnimationElement: 'accordion-plus-animation-element',
|
15
|
+
accordionDisabled: 'accordion-disabled'
|
15
16
|
};
|
16
17
|
var tokens = exports.tokens = {
|
17
18
|
accordionGap: '--plasma-accordion-gap',
|
@@ -25,30 +25,34 @@ var AccordionItem = exports.AccordionItem = function AccordionItem(_ref) {
|
|
25
25
|
title = _ref.title,
|
26
26
|
_ref$pin = _ref.pin,
|
27
27
|
pin = _ref$pin === void 0 ? 'square-square' : _ref$pin,
|
28
|
-
|
28
|
+
children = _ref.children,
|
29
29
|
_ref$type = _ref.type,
|
30
30
|
type = _ref$type === void 0 ? 'sign' : _ref$type,
|
31
31
|
index = _ref.index,
|
32
|
-
|
33
|
-
updateValue = _ref.updateValue,
|
32
|
+
disabled = _ref.disabled,
|
34
33
|
onChangeValue = _ref.onChangeValue;
|
35
34
|
var _useState = (0, _react.useState)(value),
|
36
35
|
_useState2 = _slicedToArray(_useState, 2),
|
37
|
-
|
36
|
+
isOpen = _useState2[0],
|
38
37
|
setShow = _useState2[1];
|
39
38
|
var _useState3 = (0, _react.useState)(),
|
40
39
|
_useState4 = _slicedToArray(_useState3, 2),
|
41
40
|
leftPadding = _useState4[0],
|
42
41
|
setLeftPadding = _useState4[1];
|
43
|
-
var
|
44
|
-
|
45
|
-
|
46
|
-
|
42
|
+
var handleOpen = function handleOpen() {
|
43
|
+
if (disabled) {
|
44
|
+
return;
|
45
|
+
}
|
46
|
+
setShow(!isOpen);
|
47
|
+
onChangeValue && onChangeValue(index, !isOpen);
|
47
48
|
};
|
48
49
|
var onKeyPress = function onKeyPress(event) {
|
50
|
+
if (disabled) {
|
51
|
+
return;
|
52
|
+
}
|
49
53
|
event.persist();
|
50
54
|
if (event.keyCode === 13) {
|
51
|
-
|
55
|
+
handleOpen();
|
52
56
|
}
|
53
57
|
};
|
54
58
|
var leftContentRef = (0, _react.useRef)(null);
|
@@ -59,7 +63,7 @@ var AccordionItem = exports.AccordionItem = function AccordionItem(_ref) {
|
|
59
63
|
var leftPaddingBody = leftContentWidth ? "calc(".concat(leftContentWidth, "px + var(").concat(_Accordion.tokens.accordionItemGap, "))") : 0;
|
60
64
|
setLeftPadding(leftPaddingBody);
|
61
65
|
}, [value, type, leftContentRef, setLeftPadding]);
|
62
|
-
var showedBody =
|
66
|
+
var showedBody = isOpen ? _Accordion.classes.accordionItemShowBody : undefined;
|
63
67
|
var StyledAnimationPLus = function StyledAnimationPLus() {
|
64
68
|
return /*#__PURE__*/_react["default"].createElement(_AccordionItem.StyledPlus, null, _StyledMinus || (_StyledMinus = /*#__PURE__*/_react["default"].createElement(_AccordionItem.StyledMinus, {
|
65
69
|
size: "xs",
|
@@ -71,24 +75,26 @@ var AccordionItem = exports.AccordionItem = function AccordionItem(_ref) {
|
|
71
75
|
}));
|
72
76
|
};
|
73
77
|
var accordionBorderRadius = (0, _roundness.convertRoundnessMatrix)(pin, "var(".concat(_Accordion.tokens.accordionItemBorderRadius, ")"), '1.5rem');
|
78
|
+
var disabledClass = disabled ? _Accordion.classes.accordionDisabled : '';
|
74
79
|
var leftContent = contentLeft !== null && contentLeft !== void 0 ? contentLeft : type === 'arrow' ? _StyledArrow || (_StyledArrow = /*#__PURE__*/_react["default"].createElement(_AccordionItem.StyledArrow, {
|
75
80
|
size: "xs",
|
76
81
|
color: "inhert"
|
77
82
|
})) : undefined;
|
78
|
-
var leftContentRotate = type === 'arrow' &&
|
83
|
+
var leftContentRotate = type === 'arrow' && isOpen ? _Accordion.classes.accordionItemShowBody : undefined;
|
79
84
|
var rightContent = contentRight !== null && contentRight !== void 0 ? contentRight : type === 'sign' ? /*#__PURE__*/_react["default"].createElement(StyledAnimationPLus, null) : undefined;
|
80
|
-
var rightContentRotate = type === 'sign' &&
|
85
|
+
var rightContentRotate = type === 'sign' && isOpen ? _Accordion.classes.accordionItemShowBody : undefined;
|
81
86
|
return /*#__PURE__*/_react["default"].createElement(_AccordionItem.StyledAccordionItem, {
|
82
87
|
role: "tab",
|
83
88
|
className: _Accordion.classes.accordionItem,
|
84
89
|
tabIndex: 0,
|
85
|
-
key:
|
90
|
+
key: index,
|
86
91
|
style: {
|
87
92
|
borderRadius: accordionBorderRadius
|
88
93
|
},
|
89
94
|
onKeyDown: onKeyPress
|
90
95
|
}, /*#__PURE__*/_react["default"].createElement(_AccordionItem.StyledAccordionHeader, {
|
91
|
-
onClick:
|
96
|
+
onClick: handleOpen,
|
97
|
+
className: disabledClass
|
92
98
|
}, /*#__PURE__*/_react["default"].createElement(_AccordionItem.StyledAccordionHeaderLeft, null, leftContent && /*#__PURE__*/_react["default"].createElement(_AccordionItem.StyledAccordionContentLeft, {
|
93
99
|
ref: leftContentRef,
|
94
100
|
className: leftContentRotate
|
@@ -99,5 +105,5 @@ var AccordionItem = exports.AccordionItem = function AccordionItem(_ref) {
|
|
99
105
|
style: {
|
100
106
|
paddingLeft: "".concat(leftPadding)
|
101
107
|
}
|
102
|
-
}, /*#__PURE__*/_react["default"].createElement(_AccordionItem.StyledAccordionBody, null,
|
108
|
+
}, /*#__PURE__*/_react["default"].createElement(_AccordionItem.StyledAccordionBody, null, children)));
|
103
109
|
};
|
@@ -19,22 +19,22 @@ var StyledAccordionItem = exports.StyledAccordionItem = /*#__PURE__*/_styledComp
|
|
19
19
|
}));
|
20
20
|
var StyledAccordionHeader = exports.StyledAccordionHeader = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
21
21
|
componentId: "plasma-new-hope__sc-20ij9z-1"
|
22
|
-
})(["padding:var(", ");display:flex;gap:var(", ");justify-content:space-between;align-items:center;cursor:pointer;"], _Accordion.tokens.accordionItemPadding, _Accordion.tokens.accordionItemGap);
|
22
|
+
})(["padding:var(", ");display:flex;gap:var(", ");justify-content:space-between;align-items:center;cursor:pointer;&.", "{opacity:0.4;cursor:not-allowed;}"], _Accordion.tokens.accordionItemPadding, _Accordion.tokens.accordionItemGap, _Accordion.classes.accordionDisabled);
|
23
23
|
var StyledAccordionHeaderLeft = exports.StyledAccordionHeaderLeft = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
24
24
|
componentId: "plasma-new-hope__sc-20ij9z-2"
|
25
25
|
})(["display:flex;gap:var(", ");justify-content:space-between;align-items:center;"], _Accordion.tokens.accordionItemGap);
|
26
26
|
var StyledAccordionContentRight = exports.StyledAccordionContentRight = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
27
27
|
componentId: "plasma-new-hope__sc-20ij9z-3"
|
28
|
-
})(["transition:0.2s;transform:rotate(90deg)
|
28
|
+
})(["transition:0.2s;transform:rotate(90deg);&.", "{transition:0.2s;transform:rotate(0deg);}"], _Accordion.classes.accordionItemShowBody);
|
29
29
|
var StyledAccordionContentLeft = exports.StyledAccordionContentLeft = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
30
30
|
componentId: "plasma-new-hope__sc-20ij9z-4"
|
31
|
-
})(["transition:0.2s;display:flex;align-items:center
|
31
|
+
})(["transition:0.2s;display:flex;align-items:center;&.", "{transition:0.2s;transform:rotate(180deg);}"], _Accordion.classes.accordionItemShowBody);
|
32
32
|
var StyledAccordionTitle = exports.StyledAccordionTitle = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
33
33
|
componentId: "plasma-new-hope__sc-20ij9z-5"
|
34
34
|
})(["color:var(", ");font-family:var(", ");font-size:var(", ");font-weight:var(", ");font-style:var(", ");letter-spacing:var(", ");line-height:var(", ");"], _Accordion.tokens.accordionItemTitleColor, _Accordion.tokens.accordionItemTitleFontFamily, _Accordion.tokens.accordionItemTitleFontSize, _Accordion.tokens.accordionItemTitleFontWeight, _Accordion.tokens.accordionItemTitleFontStyle, _Accordion.tokens.accordionItemTitleLetterSpacing, _Accordion.tokens.accordionItemTitleLineHeight);
|
35
35
|
var StyledAccordionBodyAnimate = exports.StyledAccordionBodyAnimate = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
36
36
|
componentId: "plasma-new-hope__sc-20ij9z-6"
|
37
|
-
})(["display:grid;grid-template-rows:0fr;transition:grid-template-rows 0.2s ease-out;overflow:hidden
|
37
|
+
})(["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);}}"], _Accordion.classes.accordionItemShowBody, _Accordion.tokens.accordionItemPaddingVertical, _Accordion.classes.accordionPlusAnimationElement);
|
38
38
|
var StyledAccordionBody = exports.StyledAccordionBody = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
39
39
|
componentId: "plasma-new-hope__sc-20ij9z-7"
|
40
40
|
})(["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(", ");"], _Accordion.tokens.accordionItemTextColor, _Accordion.tokens.accordionItemTextFontFamily, _Accordion.tokens.accordionItemTextFontSize, _Accordion.tokens.accordionItemTextFontWeight, _Accordion.tokens.accordionItemTextFontStyle, _Accordion.tokens.accordionItemTextLetterSpacing, _Accordion.tokens.accordionItemTextLineHeight, _Accordion.tokens.accordionItemPaddingHorizontal, _Accordion.tokens.accordionItemPaddingHorizontal);
|
@@ -43,7 +43,7 @@ var StyledArrow = exports.StyledArrow = /*#__PURE__*/(0, _styledComponents["defa
|
|
43
43
|
})(["pointer-events:none;user-select:none;color:var(", ");"], _Accordion.tokens.accordionItemTextColor);
|
44
44
|
var StyledMinus = exports.StyledMinus = /*#__PURE__*/(0, _styledComponents["default"])(_Icon.IconMinus).withConfig({
|
45
45
|
componentId: "plasma-new-hope__sc-20ij9z-9"
|
46
|
-
})(["pointer-events:none;user-select:none;color:var(", ");display:flex;align-items:center;position:absolute;top:0;left:0
|
46
|
+
})(["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);}"], _Accordion.tokens.accordionItemTextColor, _Accordion.classes.accordionPlusAnimationElement, _Accordion.classes.accordionItemShowBody);
|
47
47
|
var StyledPlus = exports.StyledPlus = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
48
48
|
componentId: "plasma-new-hope__sc-20ij9z-10"
|
49
49
|
})(["position:relative;height:1rem;display:flex;align-items:center;justify-content:center;width:1rem;"]);
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.updatePropsRecursively = exports.getChildren = void 0;
|
7
7
|
var _react = /*#__PURE__*/require("react");
|
8
|
-
var updatePropsRecursively = exports.updatePropsRecursively = function updatePropsRecursively(children, activeIndex, updateValue) {
|
8
|
+
var updatePropsRecursively = exports.updatePropsRecursively = function updatePropsRecursively(children, activeIndex, disabled, updateValue) {
|
9
9
|
return _react.Children.map(children || [], function (child, index) {
|
10
10
|
if (! /*#__PURE__*/(0, _react.isValidElement)(child)) {
|
11
11
|
return child;
|
@@ -13,11 +13,12 @@ var updatePropsRecursively = exports.updatePropsRecursively = function updatePro
|
|
13
13
|
var props = {
|
14
14
|
index: index,
|
15
15
|
value: activeIndex === index,
|
16
|
-
|
16
|
+
disabled: disabled,
|
17
|
+
onChangeValue: updateValue
|
17
18
|
};
|
18
19
|
return /*#__PURE__*/(0, _react.cloneElement)(child, props);
|
19
20
|
});
|
20
21
|
};
|
21
|
-
var getChildren = exports.getChildren = function getChildren(children, activeIndex, updateValue) {
|
22
|
-
return updatePropsRecursively(children, activeIndex, updateValue);
|
22
|
+
var getChildren = exports.getChildren = function getChildren(children, activeIndex, disabled, updateValue) {
|
23
|
+
return updatePropsRecursively(children, activeIndex, disabled, updateValue);
|
23
24
|
};
|