@salutejs/plasma-new-hope 0.88.0-canary.1223.9405589989.0 → 0.88.0-canary.1223.9447085309.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. package/cjs/components/Accordion/Accordion.js +13 -5
  2. package/cjs/components/Accordion/Accordion.js.map +1 -1
  3. package/cjs/components/Accordion/ui/AccordionItem/AccordionItem.js +5 -4
  4. package/cjs/components/Accordion/ui/AccordionItem/AccordionItem.js.map +1 -1
  5. package/cjs/components/Accordion/utils/index.js +5 -2
  6. package/cjs/components/Accordion/utils/index.js.map +1 -1
  7. package/es/components/Accordion/Accordion.js +14 -6
  8. package/es/components/Accordion/Accordion.js.map +1 -1
  9. package/es/components/Accordion/ui/AccordionItem/AccordionItem.js +5 -4
  10. package/es/components/Accordion/ui/AccordionItem/AccordionItem.js.map +1 -1
  11. package/es/components/Accordion/utils/index.js +5 -2
  12. package/es/components/Accordion/utils/index.js.map +1 -1
  13. package/package.json +2 -2
  14. package/styled-components/cjs/components/Accordion/Accordion.js +17 -5
  15. package/styled-components/cjs/components/Accordion/ui/AccordionItem/AccordionItem.js +5 -4
  16. package/styled-components/cjs/components/Accordion/utils/index.js +5 -2
  17. package/styled-components/cjs/examples/plasma_b2c/components/Accordion/Accordion.stories.tsx +1 -1
  18. package/styled-components/es/components/Accordion/Accordion.js +17 -5
  19. package/styled-components/es/components/Accordion/ui/AccordionItem/AccordionItem.js +5 -4
  20. package/styled-components/es/components/Accordion/utils/index.js +5 -2
  21. package/styled-components/es/examples/plasma_b2c/components/Accordion/Accordion.stories.tsx +1 -1
  22. package/types/components/Accordion/Accordion.d.ts +7 -7
  23. package/types/components/Accordion/Accordion.d.ts.map +1 -1
  24. package/types/components/Accordion/Accordion.types.d.ts +2 -2
  25. package/types/components/Accordion/Accordion.types.d.ts.map +1 -1
  26. package/types/components/Accordion/ui/AccordionItem/AccordionItem.d.ts.map +1 -1
  27. package/types/components/Accordion/ui/AccordionItem/AccordionItem.types.d.ts +5 -1
  28. package/types/components/Accordion/ui/AccordionItem/AccordionItem.types.d.ts.map +1 -1
  29. package/types/components/Accordion/utils/index.d.ts +4 -3
  30. package/types/components/Accordion/utils/index.d.ts.map +1 -1
  31. package/types/examples/plasma_b2c/components/Accordion/Accordion.d.ts +2 -2
  32. package/types/examples/plasma_web/components/Accordion/Accordion.d.ts +2 -2
@@ -17,21 +17,29 @@ var accordionRoot = function accordionRoot(Root) {
17
17
  view = _ref.view,
18
18
  _ref$stretching = _ref.stretching,
19
19
  stretching = _ref$stretching === void 0 ? 'filled' : _ref$stretching,
20
- defaultActiveIndex = _ref.defaultActiveIndex,
20
+ _ref$defaultActiveInd = _ref.defaultActiveIndex,
21
+ defaultActiveIndex = _ref$defaultActiveInd === void 0 ? [] : _ref$defaultActiveInd,
21
22
  children = _ref.children,
22
23
  disabled = _ref.disabled,
23
24
  className = _ref.className,
24
25
  singleActive = _ref.singleActive,
25
- onChangeValue = _ref.onChangeValue;
26
+ onChange = _ref.onChange;
26
27
  var stretchingClass = Accordion_tokens.classes["".concat(stretching, "Stretching")];
27
28
  var _useState = React.useState(defaultActiveIndex),
28
29
  _useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
29
30
  activeIndex = _useState2[0],
30
31
  setActiveIndex = _useState2[1];
31
32
  var updateValue = function updateValue(index, value) {
32
- onChangeValue && onChangeValue(index, value);
33
- if (value && singleActive) {
34
- setActiveIndex(index);
33
+ onChange && onChange(index, value);
34
+ if (singleActive) {
35
+ setActiveIndex([index]);
36
+ } else if (value) {
37
+ setActiveIndex([index].concat(_rollupPluginBabelHelpers.toConsumableArray(activeIndex)));
38
+ } else {
39
+ var indexItem = activeIndex.findIndex(function (i) {
40
+ return i === index;
41
+ });
42
+ setActiveIndex(activeIndex.splice(indexItem, 1));
35
43
  }
36
44
  };
37
45
  var childrenArray = React.Children.toArray(children);
@@ -1 +1 @@
1
- {"version":3,"file":"Accordion.js","sources":["../../../src/components/Accordion/Accordion.tsx"],"sourcesContent":["import React, { Children, forwardRef, useState } from 'react';\n\nimport { RootProps } from '../../engines';\nimport { cx } from '../../utils';\n\nimport type { AccordionProps } from './Accordion.types';\nimport { base } from './Accordion.styles';\nimport { classes } from './Accordion.tokens';\nimport { base as viewCSS } from './variations/_view/base';\nimport { base as sizeCSS } from './variations/_size/base';\nimport { getChildren } from './utils';\n\nexport const accordionRoot = (Root: RootProps<HTMLDivElement, AccordionProps>) =>\n forwardRef<HTMLDivElement, AccordionProps>(\n (\n {\n size,\n view,\n stretching = 'filled',\n defaultActiveIndex,\n children,\n disabled,\n className,\n singleActive,\n onChangeValue,\n },\n outerRootRef,\n ) => {\n const stretchingClass = classes[`${stretching}Stretching` as keyof typeof classes];\n\n const [activeIndex, setActiveIndex] = useState<number | undefined>(defaultActiveIndex);\n\n const updateValue = (index?: number, value?: boolean) => {\n onChangeValue && onChangeValue(index, value);\n if (value && singleActive) {\n setActiveIndex(index);\n }\n };\n\n const childrenArray = Children.toArray(children) as React.ReactElement[];\n\n const childrenMemo = getChildren(childrenArray, activeIndex, disabled, updateValue);\n\n return (\n <Root\n ref={outerRootRef}\n size={size}\n view={view}\n className={cx(stretchingClass, classes.accordionRoot, className)}\n >\n {childrenMemo}\n </Root>\n );\n },\n );\n\nexport const accordionConfig = {\n name: 'Accordion',\n tag: 'div',\n layout: accordionRoot,\n base,\n variations: {\n view: {\n css: viewCSS,\n },\n size: {\n css: sizeCSS,\n },\n },\n defaults: {\n view: 'default',\n size: 'm',\n },\n};\n"],"names":["accordionRoot","Root","forwardRef","_ref","outerRootRef","size","view","_ref$stretching","stretching","defaultActiveIndex","children","disabled","className","singleActive","onChangeValue","stretchingClass","classes","concat","_useState","useState","_useState2","_slicedToArray","activeIndex","setActiveIndex","updateValue","index","value","childrenArray","Children","toArray","childrenMemo","getChildren","React","createElement","ref","cx","accordionConfig","name","tag","layout","base","variations","css","viewCSS","sizeCSS","defaults"],"mappings":";;;;;;;;;;;;;IAYaA,aAAa,GAAG,SAAhBA,aAAaA,CAAIC,IAA+C,EAAA;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W,EAAEX,QAAQ,EAAEa,WAAW,CAAC,CAAA;AAEnF,IAAA,oBACIQ,KAAA,CAAAC,aAAA,CAAChC,IAAI,EAAA;AACDiC,MAAAA,GAAG,EAAE9B,YAAa;AAClBC,MAAAA,IAAI,EAAEA,IAAK;AACXC,MAAAA,IAAI,EAAEA,IAAK;MACXM,SAAS,EAAEuB,UAAE,CAACpB,eAAe,EAAEC,wBAAO,CAAChB,aAAa,EAAEY,SAAS,CAAA;AAAE,KAAA,EAEhEkB,YACC,CAAC,CAAA;AAEf,GACJ,CAAC,CAAA;AAAA,EAAA;AAEE,IAAMM,eAAe,GAAG;AAC3BC,EAAAA,IAAI,EAAE,WAAW;AACjBC,EAAAA,GAAG,EAAE,KAAK;AACVC,EAAAA,MAAM,EAAEvC,aAAa;AACrBwC,EAAAA,IAAI,EAAJA,qBAAI;AACJC,EAAAA,UAAU,EAAE;AACRnC,IAAAA,IAAI,EAAE;AACFoC,MAAAA,GAAG,EAAEC,SAAAA;KACR;AACDtC,IAAAA,IAAI,EAAE;AACFqC,MAAAA,GAAG,EAAEE,WAAAA;AACT,KAAA;GACH;AACDC,EAAAA,QAAQ,EAAE;AACNvC,IAAAA,IAAI,EAAE,SAAS;AACfD,IAAAA,IAAI,EAAE,GAAA;AACV,GAAA;AACJ;;;;;"}
1
+ {"version":3,"file":"Accordion.js","sources":["../../../src/components/Accordion/Accordion.tsx"],"sourcesContent":["import React, { Children, forwardRef, useState } from 'react';\n\nimport { RootPropsOmitOnChange } from '../../engines';\nimport { cx } from '../../utils';\n\nimport type { AccordionProps } from './Accordion.types';\nimport { base } from './Accordion.styles';\nimport { classes } from './Accordion.tokens';\nimport { base as viewCSS } from './variations/_view/base';\nimport { base as sizeCSS } from './variations/_size/base';\nimport { getChildren } from './utils';\n\nexport const accordionRoot = (Root: RootPropsOmitOnChange<HTMLDivElement, AccordionProps>) =>\n forwardRef<HTMLDivElement, AccordionProps>(\n (\n {\n size,\n view,\n stretching = 'filled',\n defaultActiveIndex = [],\n children,\n disabled,\n className,\n singleActive,\n onChange,\n },\n outerRootRef,\n ) => {\n const stretchingClass = classes[`${stretching}Stretching` as keyof typeof classes];\n\n const [activeIndex, setActiveIndex] = useState<number[]>(defaultActiveIndex);\n\n const updateValue = (index: number, value?: boolean) => {\n onChange && onChange(index, value);\n if (singleActive) {\n setActiveIndex([index]);\n } else if (value) {\n setActiveIndex([index, ...activeIndex]);\n } else {\n const indexItem = activeIndex.findIndex((i) => i === index);\n setActiveIndex(activeIndex.splice(indexItem, 1));\n }\n };\n\n const childrenArray = Children.toArray(children) as React.ReactElement[];\n\n const childrenMemo = getChildren(childrenArray, activeIndex, disabled, updateValue);\n\n return (\n <Root\n ref={outerRootRef}\n size={size}\n view={view}\n className={cx(stretchingClass, classes.accordionRoot, className)}\n >\n {childrenMemo}\n </Root>\n );\n },\n );\n\nexport const accordionConfig = {\n name: 'Accordion',\n tag: 'div',\n layout: accordionRoot,\n base,\n variations: {\n view: {\n css: viewCSS,\n },\n size: {\n css: sizeCSS,\n },\n },\n defaults: {\n view: 'default',\n size: 'm',\n },\n};\n"],"names":["accordionRoot","Root","forwardRef","_ref","outerRootRef","size","view","_ref$stretching","stretching","_ref$defaultActiveInd","defaultActiveIndex","children","disabled","className","singleActive","onChange","stretchingClass","classes","concat","_useState","useState","_useState2","_slicedToArray","activeIndex","setActiveIndex","updateValue","index","value","_toConsumableArray","indexItem","findIndex","i","splice","childrenArray","Children","toArray","childrenMemo","getChildren","React","createElement","ref","cx","accordionConfig","name","tag","layout","base","variations","css","viewCSS","sizeCSS","defaults"],"mappings":";;;;;;;;;;;;;IAYaA,aAAa,GAAG,SAAhBA,aAAaA,CAAIC,IAA2D,EAAA;AAAA,EAAA,oBACrFC,gBAAU,CACN,UAAAC,IAAA,EAYIC,YAAY,EACX;AAAA,IAAA,IAXGC,IAAI,GAAAF,IAAA,CAAJE,IAAI;MACJC,IAAI,GAAAH,IAAA,CAAJG,IAAI;MAAAC,eAAA,GAAAJ,IAAA,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KAAKL,KAAK,CAAA;SAAC,CAAA,CAAA;QAC3DF,cAAc,CAACD,WAAW,CAACS,MAAM,CAACH,SAAS,EAAE,CAAC,CAAC,CAAC,CAAA;AACpD,OAAA;KACH,CAAA;AAED,IAAA,IAAMI,aAAa,GAAGC,cAAQ,CAACC,OAAO,CAACxB,QAAQ,CAAyB,CAAA;IAExE,IAAMyB,YAAY,GAAGC,iBAAW,CAACJ,aAAa,EAAEV,WAAW,EAAEX,QAAQ,EAAEa,WAAW,CAAC,CAAA;AAEnF,IAAA,oBACIa,KAAA,CAAAC,aAAA,CAACtC,IAAI,EAAA;AACDuC,MAAAA,GAAG,EAAEpC,YAAa;AAClBC,MAAAA,IAAI,EAAEA,IAAK;AACXC,MAAAA,IAAI,EAAEA,IAAK;MACXO,SAAS,EAAE4B,UAAE,CAACzB,eAAe,EAAEC,wBAAO,CAACjB,aAAa,EAAEa,SAAS,CAAA;AAAE,KAAA,EAEhEuB,YACC,CAAC,CAAA;AAEf,GACJ,CAAC,CAAA;AAAA,EAAA;AAEE,IAAMM,eAAe,GAAG;AAC3BC,EAAAA,IAAI,EAAE,WAAW;AACjBC,EAAAA,GAAG,EAAE,KAAK;AACVC,EAAAA,MAAM,EAAE7C,aAAa;AACrB8C,EAAAA,IAAI,EAAJA,qBAAI;AACJC,EAAAA,UAAU,EAAE;AACRzC,IAAAA,IAAI,EAAE;AACF0C,MAAAA,GAAG,EAAEC,SAAAA;KACR;AACD5C,IAAAA,IAAI,EAAE;AACF2C,MAAAA,GAAG,EAAEE,WAAAA;AACT,KAAA;GACH;AACDC,EAAAA,QAAQ,EAAE;AACN7C,IAAAA,IAAI,EAAE,SAAS;AACfD,IAAAA,IAAI,EAAE,GAAA;AACV,GAAA;AACJ;;;;;"}
@@ -20,8 +20,10 @@ var AccordionItem = function AccordionItem(_ref) {
20
20
  _ref$type = _ref.type,
21
21
  type = _ref$type === void 0 ? 'sign' : _ref$type,
22
22
  index = _ref.index,
23
+ eventKey = _ref.eventKey,
23
24
  disabled = _ref.disabled,
24
- onChangeValue = _ref.onChangeValue;
25
+ onChange = _ref.onChange;
26
+ var key = eventKey !== null && eventKey !== void 0 ? eventKey : index;
25
27
  var _useState = React.useState(value),
26
28
  _useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
27
29
  isOpen = _useState2[0],
@@ -35,7 +37,7 @@ var AccordionItem = function AccordionItem(_ref) {
35
37
  return;
36
38
  }
37
39
  setShow(!isOpen);
38
- onChangeValue && onChangeValue(index, !isOpen);
40
+ onChange && onChange(key, !isOpen);
39
41
  };
40
42
  var onKeyPress = function onKeyPress(event) {
41
43
  if (disabled) {
@@ -49,7 +51,6 @@ var AccordionItem = function AccordionItem(_ref) {
49
51
  var leftContentRef = React.useRef(null);
50
52
  React.useEffect(function () {
51
53
  var _leftContentRef$curre, _leftContentRef$curre2;
52
- setShow(value);
53
54
  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;
54
55
  var leftPaddingBody = leftContentWidth ? "calc(".concat(leftContentWidth, "px + var(").concat(Accordion_tokens.tokens.accordionItemGap, "))") : 0;
55
56
  setLeftPadding(leftPaddingBody);
@@ -78,7 +79,7 @@ var AccordionItem = function AccordionItem(_ref) {
78
79
  role: "tab",
79
80
  className: Accordion_tokens.classes.accordionItem,
80
81
  tabIndex: 0,
81
- key: index,
82
+ key: key,
82
83
  style: {
83
84
  borderRadius: accordionBorderRadius
84
85
  },
@@ -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 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","StyledAccordionCont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ACV,CAAC,eACxBlB,KAAA,CAAAC,aAAA,CAACkC,+CAA0B,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,wCAAmB,EAAE3E,IAAAA,EAAAA,QAA8B,CAC5B,CACX,CAAC,CAAA;AAE9B;;;;"}
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 eventKey,\n disabled,\n onChange,\n}) => {\n const key = eventKey ?? index;\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 onChange && onChange(key, !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 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={key}\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","eventKey","disabled","onChange","key","_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","style","borderRadius","onKeyDown","StyledAccordionHeader","onClick","StyledAccordionHeaderLeft","StyledAccordionContentLeft","ref","StyledAccordionTitle","StyledAccordionContentRight","StyledAccordionBodyAnimate","paddingLeft","StyledAccordionBody"],"mappings":";;;;;;;;;;;IAoBaA,aAA4E,GAAG,SAA/EA,aAA4EA,CAAAC,IAAA,EAYnF;AAAA,EAAA,IAXFC,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;IACLC,QAAQ,GAAAX,IAAA,CAARW,QAAQ;IACRC,QAAQ,GAAAZ,IAAA,CAARY,QA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AAY,EAAEhB,qBAAAA;KAAwB;AAC/CiB,IAAAA,SAAS,EAAE/C,UAAAA;AAAW,GAAA,eAEtBqB,KAAA,CAAAC,aAAA,CAAC0B,0CAAqB,EAAA;AAACC,IAAAA,OAAO,EAAElD,UAAW;AAAC6B,IAAAA,SAAS,EAAEK,aAAAA;AAAc,GAAA,eACjEZ,KAAA,CAAAC,aAAA,CAAC4B,8CAAyB,EAAA,IAAA,EACrBf,WAAW,iBACRd,KAAA,CAAAC,aAAA,CAAC6B,+CAA0B,EAAA;AAACC,IAAAA,GAAG,EAAEhD,cAAe;AAACwB,IAAAA,SAAS,EAAEU,iBAAAA;AAAkB,GAAA,EACzEH,WACuB,CAC/B,eACDd,KAAA,CAAAC,aAAA,CAAC+B,yCAAoB,EAAE3E,IAAAA,EAAAA,KAA4B,CAC5B,CAAC,eAE5B2C,KAAA,CAAAC,aAAA,CAACgC,gDAA2B,EAAA;AAAC1B,IAAAA,SAAS,EAAEY,kBAAAA;GACnCD,EAAAA,YAAY,IAAIA,YACQ,CACV,CAAC,eACxBlB,KAAA,CAAAC,aAAA,CAACiC,+CAA0B,EAAA;AAAC3B,IAAAA,SAAS,EAAEZ,UAAW;AAAC6B,IAAAA,KAAK,EAAE;MAAEW,WAAW,EAAA,EAAA,CAAA3C,MAAA,CAAKhB,WAAW,CAAA;AAAG,KAAA;GACtFwB,eAAAA,KAAA,CAAAC,aAAA,CAACmC,wCAAmB,EAAE5E,IAAAA,EAAAA,QAA8B,CAC5B,CACX,CAAC,CAAA;AAE9B;;;;"}
@@ -11,9 +11,12 @@ var updatePropsRecursively = function updatePropsRecursively(children, activeInd
11
11
  }
12
12
  var props = {
13
13
  index: index,
14
- value: activeIndex === index,
14
+ value: !!(activeIndex !== null && activeIndex !== void 0 && activeIndex.find(function (i) {
15
+ var _child$props$eventKey;
16
+ return i === ((_child$props$eventKey = child.props.eventKey) !== null && _child$props$eventKey !== void 0 ? _child$props$eventKey : index);
17
+ })),
15
18
  disabled: disabled,
16
- onChangeValue: updateValue
19
+ onChange: updateValue
17
20
  };
18
21
  return /*#__PURE__*/React.cloneElement(child, props);
19
22
  });
@@ -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 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,cAAQ,CAACC,GAAG,CAACL,QAAQ,IAAI,EAAE,EAAE,UAACM,KAAK,EAAEC,KAAK,EAAK;AAC3C,IAAA,IAAI,eAACC,oBAAc,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,kBAAY,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
+ {"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?.find((i: number) => i === (child.props.eventKey ?? index)),\n disabled,\n onChange: 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","find","i","_child$props$eventKey","eventKey","onChange","cloneElement","getChildren"],"mappings":";;;;;;AAIaA,IAAAA,sBAAsB,GAAG,SAAzBA,sBAAsBA,CAC/BC,QAA6C,EAC7CC,WAAsB,EACtBC,QAAkB,EAClBC,WAAsD,EAAA;AAAA,EAAA,OAEtDC,cAAQ,CAACC,GAAG,CAACL,QAAQ,IAAI,EAAE,EAAE,UAACM,KAAK,EAAEC,KAAK,EAAK;AAC3C,IAAA,IAAI,eAACC,oBAAc,CAACF,KAAK,CAAC,EAAE;AACxB,MAAA,OAAOA,KAAK,CAAA;AAChB,KAAA;AAEA,IAAA,IAAMG,KAAK,GAAG;AACVF,MAAAA,KAAK,EAALA,KAAK;AACLG,MAAAA,KAAK,EAAE,CAAC,EAACT,WAAW,KAAXA,IAAAA,IAAAA,WAAW,KAAXA,KAAAA,CAAAA,IAAAA,WAAW,CAAEU,IAAI,CAAC,UAACC,CAAS,EAAA;AAAA,QAAA,IAAAC,qBAAA,CAAA;AAAA,QAAA,OAAKD,CAAC,MAAA,CAAAC,qBAAA,GAAMP,KAAK,CAACG,KAAK,CAACK,QAAQ,cAAAD,qBAAA,KAAA,KAAA,CAAA,GAAAA,qBAAA,GAAIN,KAAK,CAAC,CAAA;OAAC,CAAA,CAAA;AAChFL,MAAAA,QAAQ,EAARA,QAAQ;AACRa,MAAAA,QAAQ,EAAEZ,WAAAA;KACb,CAAA;AAED,IAAA,oBAAOa,kBAAY,CAACV,KAAK,EAAEG,KAAK,CAAC,CAAA;AACrC,GAAC,CAAC,CAAA;AAAA,EAAA;AAEOQ,IAAAA,WAAW,GAAG,SAAdA,WAAWA,CACpBjB,QAA4C,EAC5CC,WAAsB,EACtBC,QAAkB,EAClBC,WAAsD,EACrD;EACD,OAAOJ,sBAAsB,CAACC,QAAQ,EAAEC,WAAW,EAAEC,QAAQ,EAAEC,WAAW,CAAC,CAAA;AAC/E;;;;;"}
@@ -1,4 +1,4 @@
1
- import { slicedToArray as _slicedToArray } from '../../_virtual/_rollupPluginBabelHelpers.js';
1
+ import { slicedToArray as _slicedToArray, toConsumableArray as _toConsumableArray } from '../../_virtual/_rollupPluginBabelHelpers.js';
2
2
  import React, { forwardRef, useState, Children } from 'react';
3
3
  import { cx } from '../../utils/index.js';
4
4
  import { base } from './Accordion.styles.js';
@@ -13,21 +13,29 @@ var accordionRoot = function accordionRoot(Root) {
13
13
  view = _ref.view,
14
14
  _ref$stretching = _ref.stretching,
15
15
  stretching = _ref$stretching === void 0 ? 'filled' : _ref$stretching,
16
- defaultActiveIndex = _ref.defaultActiveIndex,
16
+ _ref$defaultActiveInd = _ref.defaultActiveIndex,
17
+ defaultActiveIndex = _ref$defaultActiveInd === void 0 ? [] : _ref$defaultActiveInd,
17
18
  children = _ref.children,
18
19
  disabled = _ref.disabled,
19
20
  className = _ref.className,
20
21
  singleActive = _ref.singleActive,
21
- onChangeValue = _ref.onChangeValue;
22
+ onChange = _ref.onChange;
22
23
  var stretchingClass = classes["".concat(stretching, "Stretching")];
23
24
  var _useState = useState(defaultActiveIndex),
24
25
  _useState2 = _slicedToArray(_useState, 2),
25
26
  activeIndex = _useState2[0],
26
27
  setActiveIndex = _useState2[1];
27
28
  var updateValue = function updateValue(index, value) {
28
- onChangeValue && onChangeValue(index, value);
29
- if (value && singleActive) {
30
- setActiveIndex(index);
29
+ onChange && onChange(index, value);
30
+ if (singleActive) {
31
+ setActiveIndex([index]);
32
+ } else if (value) {
33
+ setActiveIndex([index].concat(_toConsumableArray(activeIndex)));
34
+ } else {
35
+ var indexItem = activeIndex.findIndex(function (i) {
36
+ return i === index;
37
+ });
38
+ setActiveIndex(activeIndex.splice(indexItem, 1));
31
39
  }
32
40
  };
33
41
  var childrenArray = Children.toArray(children);
@@ -1 +1 @@
1
- {"version":3,"file":"Accordion.js","sources":["../../../src/components/Accordion/Accordion.tsx"],"sourcesContent":["import React, { Children, forwardRef, useState } from 'react';\n\nimport { RootProps } from '../../engines';\nimport { cx } from '../../utils';\n\nimport type { AccordionProps } from './Accordion.types';\nimport { base } from './Accordion.styles';\nimport { classes } from './Accordion.tokens';\nimport { base as viewCSS } from './variations/_view/base';\nimport { base as sizeCSS } from './variations/_size/base';\nimport { getChildren } from './utils';\n\nexport const accordionRoot = (Root: RootProps<HTMLDivElement, AccordionProps>) =>\n forwardRef<HTMLDivElement, AccordionProps>(\n (\n {\n size,\n view,\n stretching = 'filled',\n defaultActiveIndex,\n children,\n disabled,\n className,\n singleActive,\n onChangeValue,\n },\n outerRootRef,\n ) => {\n const stretchingClass = classes[`${stretching}Stretching` as keyof typeof classes];\n\n const [activeIndex, setActiveIndex] = useState<number | undefined>(defaultActiveIndex);\n\n const updateValue = (index?: number, value?: boolean) => {\n onChangeValue && onChangeValue(index, value);\n if (value && singleActive) {\n setActiveIndex(index);\n }\n };\n\n const childrenArray = Children.toArray(children) as React.ReactElement[];\n\n const childrenMemo = getChildren(childrenArray, activeIndex, disabled, updateValue);\n\n return (\n <Root\n ref={outerRootRef}\n size={size}\n view={view}\n className={cx(stretchingClass, classes.accordionRoot, className)}\n >\n {childrenMemo}\n </Root>\n );\n },\n );\n\nexport const accordionConfig = {\n name: 'Accordion',\n tag: 'div',\n layout: accordionRoot,\n base,\n variations: {\n view: {\n css: viewCSS,\n },\n size: {\n css: sizeCSS,\n },\n },\n defaults: {\n view: 'default',\n size: 'm',\n },\n};\n"],"names":["accordionRoot","Root","forwardRef","_ref","outerRootRef","size","view","_ref$stretching","stretching","defaultActiveIndex","children","disabled","className","singleActive","onChangeValue","stretchingClass","classes","concat","_useState","useState","_useState2","_slicedToArray","activeIndex","setActiveIndex","updateValue","index","value","childrenArray","Children","toArray","childrenMemo","getChildren","React","createElement","ref","cx","accordionConfig","name","tag","layout","base","variations","css","viewCSS","sizeCSS","defaults"],"mappings":";;;;;;;;;IAYaA,aAAa,GAAG,SAAhBA,aAAaA,CAAIC,IAA+C,EAAA;AAAA,EAAA,oBACzEC,UAAU,CACN,UAAAC,IAAA,EAYIC,YAAY,EACX;AAAA,IAAA,IAXGC,IAAI,GAAAF,IAAA,CAAJE,IAAI;MACJC,IAAI,GAAAH,IAAA,CAAJG,IAAI;MAAAC,eAAA,GAAAJ,IAAA,CACJK,UAAU;AAAVA,MAAAA,UAAU,GAAAD,eAAA,KAAG,KAAA,CAAA,GAAA,QAAQ,GAAAA,eAAA;MACrBE,kBAAkB,GAAAN,IAAA,CAAlBM,kBAAkB;MAClBC,QAAQ,GAAAP,IAAA,CAARO,QAAQ;MACRC,Q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IAAMM,eAAe,GAAG;AAC3BC,EAAAA,IAAI,EAAE,WAAW;AACjBC,EAAAA,GAAG,EAAE,KAAK;AACVC,EAAAA,MAAM,EAAEvC,aAAa;AACrBwC,EAAAA,IAAI,EAAJA,IAAI;AACJC,EAAAA,UAAU,EAAE;AACRnC,IAAAA,IAAI,EAAE;AACFoC,MAAAA,GAAG,EAAEC,MAAAA;KACR;AACDtC,IAAAA,IAAI,EAAE;AACFqC,MAAAA,GAAG,EAAEE,MAAAA;AACT,KAAA;GACH;AACDC,EAAAA,QAAQ,EAAE;AACNvC,IAAAA,IAAI,EAAE,SAAS;AACfD,IAAAA,IAAI,EAAE,GAAA;AACV,GAAA;AACJ;;;;"}
1
+ {"version":3,"file":"Accordion.js","sources":["../../../src/components/Accordion/Accordion.tsx"],"sourcesContent":["import React, { Children, forwardRef, useState } from 'react';\n\nimport { RootPropsOmitOnChange } from '../../engines';\nimport { cx } from '../../utils';\n\nimport type { AccordionProps } from './Accordion.types';\nimport { base } from './Accordion.styles';\nimport { classes } from './Accordion.tokens';\nimport { base as viewCSS } from './variations/_view/base';\nimport { base as sizeCSS } from './variations/_size/base';\nimport { getChildren } from './utils';\n\nexport const accordionRoot = (Root: RootPropsOmitOnChange<HTMLDivElement, AccordionProps>) =>\n forwardRef<HTMLDivElement, AccordionProps>(\n (\n {\n size,\n view,\n stretching = 'filled',\n defaultActiveIndex = [],\n children,\n disabled,\n className,\n singleActive,\n onChange,\n },\n outerRootRef,\n ) => {\n const stretchingClass = classes[`${stretching}Stretching` as keyof typeof classes];\n\n const [activeIndex, setActiveIndex] = useState<number[]>(defaultActiveIndex);\n\n const updateValue = (index: number, value?: boolean) => {\n onChange && onChange(index, value);\n if (singleActive) {\n setActiveIndex([index]);\n } else if (value) {\n setActiveIndex([index, ...activeIndex]);\n } else {\n const indexItem = activeIndex.findIndex((i) => i === index);\n setActiveIndex(activeIndex.splice(indexItem, 1));\n }\n };\n\n const childrenArray = Children.toArray(children) as React.ReactElement[];\n\n const childrenMemo = getChildren(childrenArray, activeIndex, disabled, updateValue);\n\n return (\n <Root\n ref={outerRootRef}\n size={size}\n view={view}\n className={cx(stretchingClass, classes.accordionRoot, className)}\n >\n {childrenMemo}\n </Root>\n );\n },\n );\n\nexport const accordionConfig = {\n name: 'Accordion',\n tag: 'div',\n layout: accordionRoot,\n base,\n variations: {\n view: {\n css: viewCSS,\n },\n size: {\n css: sizeCSS,\n },\n },\n defaults: {\n view: 'default',\n size: 'm',\n },\n};\n"],"names":["accordionRoot","Root","forwardRef","_ref","outerRootRef","size","view","_ref$stretching","stretching","_ref$defaultActiveInd","defaultActiveIndex","children","disabled","className","singleActive","onChange","stretchingClass","classes","concat","_useState","useState","_useState2","_slicedToArray","activeIndex","setActiveIndex","updateValue","index","value","_toConsumableArray","indexItem","findIndex","i","splice","childrenArray","Children","toArray","childrenMemo","getChildren","React","createElement","ref","cx","accordionConfig","name","tag","layout","base","variations","css","viewCSS","sizeCSS","defaults"],"mappings":";;;;;;;;;IAYaA,aAAa,GAAG,SAAhBA,aAAaA,CAAIC,IAA2D,EAAA;AAAA,EAAA,oBACrFC,UAAU,CACN,UAAAC,IAAA,EAYIC,YAAY,EACX;AAAA,IAAA,IAXGC,IAAI,GAAAF,IAAA,CAAJE,IAAI;MACJC,IAAI,GAAAH,IAAA,CAAJG,IAAI;MAAAC,eAAA,GAAAJ,IAAA,CACJK,UAAU;AAAVA,MAAAA,UAAU,GAAAD,eAAA,KAAG,KAAA,CAAA,GAAA,QAAQ,GAAAA,eAAA;MAAAE,qBAAA,GAAAN,IAAA,CACrBO,kBAAkB;AAAlBA,MAAAA,kBAAkB,GAAAD,qBAAA,KAAG,KAAA,CAAA,GAAA,EAAE,GAAAA,qBAAA;MACvBE,QAAQ,GAAAR,IAAA,CAARQ,QAAQ;MACRC,QAAQ,GAAAT,IAAA,CAARS,QAAQ;MACRC,SAAS,GAAAV,IAAA,CAATU,SAAS;MACTC,YAAY,GAAAX,IAAA,CAAZW,YAAY;MACZC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uC,MAAAA,GAAG,EAAEpC,YAAa;AAClBC,MAAAA,IAAI,EAAEA,IAAK;AACXC,MAAAA,IAAI,EAAEA,IAAK;MACXO,SAAS,EAAE4B,EAAE,CAACzB,eAAe,EAAEC,OAAO,CAACjB,aAAa,EAAEa,SAAS,CAAA;AAAE,KAAA,EAEhEuB,YACC,CAAC,CAAA;AAEf,GACJ,CAAC,CAAA;AAAA,EAAA;AAEE,IAAMM,eAAe,GAAG;AAC3BC,EAAAA,IAAI,EAAE,WAAW;AACjBC,EAAAA,GAAG,EAAE,KAAK;AACVC,EAAAA,MAAM,EAAE7C,aAAa;AACrB8C,EAAAA,IAAI,EAAJA,IAAI;AACJC,EAAAA,UAAU,EAAE;AACRzC,IAAAA,IAAI,EAAE;AACF0C,MAAAA,GAAG,EAAEC,MAAAA;KACR;AACD5C,IAAAA,IAAI,EAAE;AACF2C,MAAAA,GAAG,EAAEE,MAAAA;AACT,KAAA;GACH;AACDC,EAAAA,QAAQ,EAAE;AACN7C,IAAAA,IAAI,EAAE,SAAS;AACfD,IAAAA,IAAI,EAAE,GAAA;AACV,GAAA;AACJ;;;;"}
@@ -16,8 +16,10 @@ var AccordionItem = function AccordionItem(_ref) {
16
16
  _ref$type = _ref.type,
17
17
  type = _ref$type === void 0 ? 'sign' : _ref$type,
18
18
  index = _ref.index,
19
+ eventKey = _ref.eventKey,
19
20
  disabled = _ref.disabled,
20
- onChangeValue = _ref.onChangeValue;
21
+ onChange = _ref.onChange;
22
+ var key = eventKey !== null && eventKey !== void 0 ? eventKey : index;
21
23
  var _useState = useState(value),
22
24
  _useState2 = _slicedToArray(_useState, 2),
23
25
  isOpen = _useState2[0],
@@ -31,7 +33,7 @@ var AccordionItem = function AccordionItem(_ref) {
31
33
  return;
32
34
  }
33
35
  setShow(!isOpen);
34
- onChangeValue && onChangeValue(index, !isOpen);
36
+ onChange && onChange(key, !isOpen);
35
37
  };
36
38
  var onKeyPress = function onKeyPress(event) {
37
39
  if (disabled) {
@@ -45,7 +47,6 @@ var AccordionItem = function AccordionItem(_ref) {
45
47
  var leftContentRef = useRef(null);
46
48
  useEffect(function () {
47
49
  var _leftContentRef$curre, _leftContentRef$curre2;
48
- setShow(value);
49
50
  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;
50
51
  var leftPaddingBody = leftContentWidth ? "calc(".concat(leftContentWidth, "px + var(").concat(tokens.accordionItemGap, "))") : 0;
51
52
  setLeftPadding(leftPaddingBody);
@@ -74,7 +75,7 @@ var AccordionItem = function AccordionItem(_ref) {
74
75
  role: "tab",
75
76
  className: classes.accordionItem,
76
77
  tabIndex: 0,
77
- key: index,
78
+ key: key,
78
79
  style: {
79
80
  borderRadius: accordionBorderRadius
80
81
  },
@@ -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 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;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AEX,OAAO,CAAC0B,aAAc;AACjCC,IAAAA,QAAQ,EAAE,CAAE;AACZC,IAAAA,GAAG,EAAE3D,KAAM;AACX4D,IAAAA,KAAK,EAAE;AAAEC,MAAAA,YAAY,EAAEjB,qBAAAA;KAAwB;AAC/CkB,IAAAA,SAAS,EAAEhD,UAAAA;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;;;;"}
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 eventKey,\n disabled,\n onChange,\n}) => {\n const key = eventKey ?? index;\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 onChange && onChange(key, !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 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={key}\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","eventKey","disabled","onChange","key","_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","style","borderRadius","onKeyDown","StyledAccordionHeader","onClick","StyledAccordionHeaderLeft","StyledAccordionContentLeft","ref","StyledAccordionTitle","StyledAccordionContentRight","StyledAccordionBodyAnimate","paddingLeft","StyledAccordionBody"],"mappings":";;;;;;;IAoBaA,aAA4E,GAAG,SAA/EA,aAA4EA,CAAAC,IAAA,EAYnF;AAAA,EAAA,IAXFC,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;IACLC,QAAQ,GAAAX,IAAA,CAARW,QAAQ;IACRC,QAAQ,GAAAZ,IAAA,CAARY,QAAQ;IACRC,QAAQ,GAAAb,IAAA,CAARa,QAAQ,CAAA;EAER,IAAMC,GAAG,GAAGH,QAAQ,KAAA,IAAA,IAARA,QAAQ,KAARA,KAAAA,CAAAA,GAAAA,QAAQ,GAAID,KAAK,CAAA;AAE7B,EAAA,IAAAK,SAAA,GAA0BC,QAAQ,CAACf,KAAK,CAAC;IAAAgB,UAAA,GAAAC,cAAA,CAAAH,SAAA,EAAA,CAAA,CAAA;AAAlCI,IAAAA,MAAM,GAAAF,UAAA,CAAA,CAAA,CAAA;AAAEG,IAAAA,OAAO,GAAAH,UAAA,CAAA,CAAA,CAAA,CAAA;AACtB,EAAA,IAAAI,UAAA,GAAsCL,QAAQ,EAA0B;IAAAM,UAAA,GAAAJ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,EAAE3E,IAAAA,EAAAA,KAA4B,CAC5B,CAAC,eAE5B2C,KAAA,CAAAC,aAAA,CAACgC,2BAA2B,EAAA;AAAC1B,IAAAA,SAAS,EAAEY,kBAAAA;GACnCD,EAAAA,YAAY,IAAIA,YACQ,CACV,CAAC,eACxBlB,KAAA,CAAAC,aAAA,CAACiC,0BAA0B,EAAA;AAAC3B,IAAAA,SAAS,EAAEZ,UAAW;AAAC6B,IAAAA,KAAK,EAAE;MAAEW,WAAW,EAAA,EAAA,CAAA3C,MAAA,CAAKhB,WAAW,CAAA;AAAG,KAAA;GACtFwB,eAAAA,KAAA,CAAAC,aAAA,CAACmC,mBAAmB,EAAE5E,IAAAA,EAAAA,QAA8B,CAC5B,CACX,CAAC,CAAA;AAE9B;;;;"}
@@ -7,9 +7,12 @@ var updatePropsRecursively = function updatePropsRecursively(children, activeInd
7
7
  }
8
8
  var props = {
9
9
  index: index,
10
- value: activeIndex === index,
10
+ value: !!(activeIndex !== null && activeIndex !== void 0 && activeIndex.find(function (i) {
11
+ var _child$props$eventKey;
12
+ return i === ((_child$props$eventKey = child.props.eventKey) !== null && _child$props$eventKey !== void 0 ? _child$props$eventKey : index);
13
+ })),
11
14
  disabled: disabled,
12
- onChangeValue: updateValue
15
+ onChange: updateValue
13
16
  };
14
17
  return /*#__PURE__*/cloneElement(child, props);
15
18
  });
@@ -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 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
+ {"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?.find((i: number) => i === (child.props.eventKey ?? index)),\n disabled,\n onChange: 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","find","i","_child$props$eventKey","eventKey","onChange","cloneElement","getChildren"],"mappings":";;AAIaA,IAAAA,sBAAsB,GAAG,SAAzBA,sBAAsBA,CAC/BC,QAA6C,EAC7CC,WAAsB,EACtBC,QAAkB,EAClBC,WAAsD,EAAA;AAAA,EAAA,OAEtDC,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;AACLG,MAAAA,KAAK,EAAE,CAAC,EAACT,WAAW,KAAXA,IAAAA,IAAAA,WAAW,KAAXA,KAAAA,CAAAA,IAAAA,WAAW,CAAEU,IAAI,CAAC,UAACC,CAAS,EAAA;AAAA,QAAA,IAAAC,qBAAA,CAAA;AAAA,QAAA,OAAKD,CAAC,MAAA,CAAAC,qBAAA,GAAMP,KAAK,CAACG,KAAK,CAACK,QAAQ,cAAAD,qBAAA,KAAA,KAAA,CAAA,GAAAA,qBAAA,GAAIN,KAAK,CAAC,CAAA;OAAC,CAAA,CAAA;AAChFL,MAAAA,QAAQ,EAARA,QAAQ;AACRa,MAAAA,QAAQ,EAAEZ,WAAAA;KACb,CAAA;AAED,IAAA,oBAAOa,YAAY,CAACV,KAAK,EAAEG,KAAK,CAAC,CAAA;AACrC,GAAC,CAAC,CAAA;AAAA,EAAA;AAEOQ,IAAAA,WAAW,GAAG,SAAdA,WAAWA,CACpBjB,QAA4C,EAC5CC,WAAsB,EACtBC,QAAkB,EAClBC,WAAsD,EACrD;EACD,OAAOJ,sBAAsB,CAACC,QAAQ,EAAEC,WAAW,EAAEC,QAAQ,EAAEC,WAAW,CAAC,CAAA;AAC/E;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salutejs/plasma-new-hope",
3
- "version": "0.88.0-canary.1223.9405589989.0",
3
+ "version": "0.88.0-canary.1223.9447085309.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": "f9103840f3c3e68b06eabe6ac13de149b9c80b6d"
106
+ "gitHead": "e0b851664b1cbfea1544ca3c924d2227127d97e9"
107
107
  }
@@ -14,6 +14,10 @@ var _base2 = /*#__PURE__*/require("./variations/_size/base");
14
14
  var _utils2 = /*#__PURE__*/require("./utils");
15
15
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
16
16
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
17
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
18
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
19
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
20
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
17
21
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
18
22
  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."); }
19
23
  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); }
@@ -26,21 +30,29 @@ var accordionRoot = exports.accordionRoot = function accordionRoot(Root) {
26
30
  view = _ref.view,
27
31
  _ref$stretching = _ref.stretching,
28
32
  stretching = _ref$stretching === void 0 ? 'filled' : _ref$stretching,
29
- defaultActiveIndex = _ref.defaultActiveIndex,
33
+ _ref$defaultActiveInd = _ref.defaultActiveIndex,
34
+ defaultActiveIndex = _ref$defaultActiveInd === void 0 ? [] : _ref$defaultActiveInd,
30
35
  children = _ref.children,
31
36
  disabled = _ref.disabled,
32
37
  className = _ref.className,
33
38
  singleActive = _ref.singleActive,
34
- onChangeValue = _ref.onChangeValue;
39
+ onChange = _ref.onChange;
35
40
  var stretchingClass = _Accordion2.classes["".concat(stretching, "Stretching")];
36
41
  var _useState = (0, _react.useState)(defaultActiveIndex),
37
42
  _useState2 = _slicedToArray(_useState, 2),
38
43
  activeIndex = _useState2[0],
39
44
  setActiveIndex = _useState2[1];
40
45
  var updateValue = function updateValue(index, value) {
41
- onChangeValue && onChangeValue(index, value);
42
- if (value && singleActive) {
43
- setActiveIndex(index);
46
+ onChange && onChange(index, value);
47
+ if (singleActive) {
48
+ setActiveIndex([index]);
49
+ } else if (value) {
50
+ setActiveIndex([index].concat(_toConsumableArray(activeIndex)));
51
+ } else {
52
+ var indexItem = activeIndex.findIndex(function (i) {
53
+ return i === index;
54
+ });
55
+ setActiveIndex(activeIndex.splice(indexItem, 1));
44
56
  }
45
57
  };
46
58
  var childrenArray = _react.Children.toArray(children);
@@ -29,8 +29,10 @@ var AccordionItem = exports.AccordionItem = function AccordionItem(_ref) {
29
29
  _ref$type = _ref.type,
30
30
  type = _ref$type === void 0 ? 'sign' : _ref$type,
31
31
  index = _ref.index,
32
+ eventKey = _ref.eventKey,
32
33
  disabled = _ref.disabled,
33
- onChangeValue = _ref.onChangeValue;
34
+ onChange = _ref.onChange;
35
+ var key = eventKey !== null && eventKey !== void 0 ? eventKey : index;
34
36
  var _useState = (0, _react.useState)(value),
35
37
  _useState2 = _slicedToArray(_useState, 2),
36
38
  isOpen = _useState2[0],
@@ -44,7 +46,7 @@ var AccordionItem = exports.AccordionItem = function AccordionItem(_ref) {
44
46
  return;
45
47
  }
46
48
  setShow(!isOpen);
47
- onChangeValue && onChangeValue(index, !isOpen);
49
+ onChange && onChange(key, !isOpen);
48
50
  };
49
51
  var onKeyPress = function onKeyPress(event) {
50
52
  if (disabled) {
@@ -58,7 +60,6 @@ var AccordionItem = exports.AccordionItem = function AccordionItem(_ref) {
58
60
  var leftContentRef = (0, _react.useRef)(null);
59
61
  (0, _react.useEffect)(function () {
60
62
  var _leftContentRef$curre, _leftContentRef$curre2;
61
- setShow(value);
62
63
  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;
63
64
  var leftPaddingBody = leftContentWidth ? "calc(".concat(leftContentWidth, "px + var(").concat(_Accordion.tokens.accordionItemGap, "))") : 0;
64
65
  setLeftPadding(leftPaddingBody);
@@ -87,7 +88,7 @@ var AccordionItem = exports.AccordionItem = function AccordionItem(_ref) {
87
88
  role: "tab",
88
89
  className: _Accordion.classes.accordionItem,
89
90
  tabIndex: 0,
90
- key: index,
91
+ key: key,
91
92
  style: {
92
93
  borderRadius: accordionBorderRadius
93
94
  },
@@ -12,9 +12,12 @@ var updatePropsRecursively = exports.updatePropsRecursively = function updatePro
12
12
  }
13
13
  var props = {
14
14
  index: index,
15
- value: activeIndex === index,
15
+ value: !!(activeIndex !== null && activeIndex !== void 0 && activeIndex.find(function (i) {
16
+ var _child$props$eventKey;
17
+ return i === ((_child$props$eventKey = child.props.eventKey) !== null && _child$props$eventKey !== void 0 ? _child$props$eventKey : index);
18
+ })),
16
19
  disabled: disabled,
17
- onChangeValue: updateValue
20
+ onChange: updateValue
18
21
  };
19
22
  return /*#__PURE__*/(0, _react.cloneElement)(child, props);
20
23
  });
@@ -51,7 +51,7 @@ export const Default: StoryObj<ComponentProps<typeof Accordion>> = {
51
51
 
52
52
  return (
53
53
  <Accordion {...args}>
54
- <AccordionItem type={args.type} pin={args.pin} title={args.title}>
54
+ <AccordionItem type={args.type} pin={args.pin} title={args.title} eventKey={3435}>
55
55
  {args.body}
56
56
  </AccordionItem>
57
57
  <AccordionItem type={args.type} pin={args.pin} title={args.title}>
@@ -1,3 +1,7 @@
1
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
2
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
4
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
1
5
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
6
  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."); }
3
7
  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); }
@@ -17,21 +21,29 @@ export var accordionRoot = function accordionRoot(Root) {
17
21
  view = _ref.view,
18
22
  _ref$stretching = _ref.stretching,
19
23
  stretching = _ref$stretching === void 0 ? 'filled' : _ref$stretching,
20
- defaultActiveIndex = _ref.defaultActiveIndex,
24
+ _ref$defaultActiveInd = _ref.defaultActiveIndex,
25
+ defaultActiveIndex = _ref$defaultActiveInd === void 0 ? [] : _ref$defaultActiveInd,
21
26
  children = _ref.children,
22
27
  disabled = _ref.disabled,
23
28
  className = _ref.className,
24
29
  singleActive = _ref.singleActive,
25
- onChangeValue = _ref.onChangeValue;
30
+ onChange = _ref.onChange;
26
31
  var stretchingClass = classes["".concat(stretching, "Stretching")];
27
32
  var _useState = useState(defaultActiveIndex),
28
33
  _useState2 = _slicedToArray(_useState, 2),
29
34
  activeIndex = _useState2[0],
30
35
  setActiveIndex = _useState2[1];
31
36
  var updateValue = function updateValue(index, value) {
32
- onChangeValue && onChangeValue(index, value);
33
- if (value && singleActive) {
34
- setActiveIndex(index);
37
+ onChange && onChange(index, value);
38
+ if (singleActive) {
39
+ setActiveIndex([index]);
40
+ } else if (value) {
41
+ setActiveIndex([index].concat(_toConsumableArray(activeIndex)));
42
+ } else {
43
+ var indexItem = activeIndex.findIndex(function (i) {
44
+ return i === index;
45
+ });
46
+ setActiveIndex(activeIndex.splice(indexItem, 1));
35
47
  }
36
48
  };
37
49
  var childrenArray = Children.toArray(children);
@@ -20,8 +20,10 @@ export var AccordionItem = function AccordionItem(_ref) {
20
20
  _ref$type = _ref.type,
21
21
  type = _ref$type === void 0 ? 'sign' : _ref$type,
22
22
  index = _ref.index,
23
+ eventKey = _ref.eventKey,
23
24
  disabled = _ref.disabled,
24
- onChangeValue = _ref.onChangeValue;
25
+ onChange = _ref.onChange;
26
+ var key = eventKey !== null && eventKey !== void 0 ? eventKey : index;
25
27
  var _useState = useState(value),
26
28
  _useState2 = _slicedToArray(_useState, 2),
27
29
  isOpen = _useState2[0],
@@ -35,7 +37,7 @@ export var AccordionItem = function AccordionItem(_ref) {
35
37
  return;
36
38
  }
37
39
  setShow(!isOpen);
38
- onChangeValue && onChangeValue(index, !isOpen);
40
+ onChange && onChange(key, !isOpen);
39
41
  };
40
42
  var onKeyPress = function onKeyPress(event) {
41
43
  if (disabled) {
@@ -49,7 +51,6 @@ export var AccordionItem = function AccordionItem(_ref) {
49
51
  var leftContentRef = useRef(null);
50
52
  useEffect(function () {
51
53
  var _leftContentRef$curre, _leftContentRef$curre2;
52
- setShow(value);
53
54
  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;
54
55
  var leftPaddingBody = leftContentWidth ? "calc(".concat(leftContentWidth, "px + var(").concat(tokens.accordionItemGap, "))") : 0;
55
56
  setLeftPadding(leftPaddingBody);
@@ -78,7 +79,7 @@ export var AccordionItem = function AccordionItem(_ref) {
78
79
  role: "tab",
79
80
  className: classes.accordionItem,
80
81
  tabIndex: 0,
81
- key: index,
82
+ key: key,
82
83
  style: {
83
84
  borderRadius: accordionBorderRadius
84
85
  },
@@ -6,9 +6,12 @@ export var updatePropsRecursively = function updatePropsRecursively(children, ac
6
6
  }
7
7
  var props = {
8
8
  index: index,
9
- value: activeIndex === index,
9
+ value: !!(activeIndex !== null && activeIndex !== void 0 && activeIndex.find(function (i) {
10
+ var _child$props$eventKey;
11
+ return i === ((_child$props$eventKey = child.props.eventKey) !== null && _child$props$eventKey !== void 0 ? _child$props$eventKey : index);
12
+ })),
10
13
  disabled: disabled,
11
- onChangeValue: updateValue
14
+ onChange: updateValue
12
15
  };
13
16
  return /*#__PURE__*/cloneElement(child, props);
14
17
  });
@@ -51,7 +51,7 @@ export const Default: StoryObj<ComponentProps<typeof Accordion>> = {
51
51
 
52
52
  return (
53
53
  <Accordion {...args}>
54
- <AccordionItem type={args.type} pin={args.pin} title={args.title}>
54
+ <AccordionItem type={args.type} pin={args.pin} title={args.title} eventKey={3435}>
55
55
  {args.body}
56
56
  </AccordionItem>
57
57
  <AccordionItem type={args.type} pin={args.pin} title={args.title}>
@@ -1,28 +1,28 @@
1
1
  import React from 'react';
2
- import { RootProps } from '../../engines';
2
+ import { RootPropsOmitOnChange } from '../../engines';
3
3
  import type { AccordionProps } from './Accordion.types';
4
- export declare const accordionRoot: (Root: RootProps<HTMLDivElement, AccordionProps>) => React.ForwardRefExoticComponent<{
4
+ export declare const accordionRoot: (Root: RootPropsOmitOnChange<HTMLDivElement, AccordionProps>) => React.ForwardRefExoticComponent<{
5
5
  view: string;
6
6
  size?: string | undefined;
7
7
  singleActive?: boolean | undefined;
8
- defaultActiveIndex?: number | undefined;
8
+ defaultActiveIndex?: number[] | undefined;
9
9
  disabled?: boolean | undefined;
10
10
  stretching?: "fixed" | "filled" | undefined;
11
- onChangeValue?: ((index?: number | undefined, value?: boolean | undefined) => void) | undefined;
11
+ onChange?: ((index?: number | undefined, value?: boolean | undefined) => void) | undefined;
12
12
  children?: React.ReactNode;
13
13
  className?: string | undefined;
14
14
  } & React.RefAttributes<HTMLDivElement>>;
15
15
  export declare const accordionConfig: {
16
16
  name: string;
17
17
  tag: string;
18
- layout: (Root: RootProps<HTMLDivElement, AccordionProps>) => React.ForwardRefExoticComponent<{
18
+ layout: (Root: RootPropsOmitOnChange<HTMLDivElement, AccordionProps>) => React.ForwardRefExoticComponent<{
19
19
  view: string;
20
20
  size?: string | undefined;
21
21
  singleActive?: boolean | undefined;
22
- defaultActiveIndex?: number | undefined;
22
+ defaultActiveIndex?: number[] | undefined;
23
23
  disabled?: boolean | undefined;
24
24
  stretching?: "fixed" | "filled" | undefined;
25
- onChangeValue?: ((index?: number | undefined, value?: boolean | undefined) => void) | undefined;
25
+ onChange?: ((index?: number | undefined, value?: boolean | undefined) => void) | undefined;
26
26
  children?: React.ReactNode;
27
27
  className?: string | undefined;
28
28
  } & React.RefAttributes<HTMLDivElement>>;
@@ -1 +1 @@
1
- {"version":3,"file":"Accordion.d.ts","sourceRoot":"","sources":["../../../src/components/Accordion/Accordion.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyC,MAAM,OAAO,CAAC;AAE9D,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAG1C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAOxD,eAAO,MAAM,aAAa,SAAU,UAAU,cAAc,EAAE,cAAc,CAAC;;;;;;;;;;wCA0CxE,CAAC;AAEN,eAAO,MAAM,eAAe;;;mBA5CQ,UAAU,cAAc,EAAE,cAAc,CAAC;;;;;;;;;;;;;;;;;;;;;;;;CA6D5E,CAAC"}
1
+ {"version":3,"file":"Accordion.d.ts","sourceRoot":"","sources":["../../../src/components/Accordion/Accordion.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyC,MAAM,OAAO,CAAC;AAE9D,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAGtD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAOxD,eAAO,MAAM,aAAa,SAAU,sBAAsB,cAAc,EAAE,cAAc,CAAC;;;;;;;;;;wCA+CpF,CAAC;AAEN,eAAO,MAAM,eAAe;;;mBAjDQ,sBAAsB,cAAc,EAAE,cAAc,CAAC;;;;;;;;;;;;;;;;;;;;;;;;CAkExF,CAAC"}
@@ -15,7 +15,7 @@ declare type CustomAccordionProps = {
15
15
  /**
16
16
  * Индекс элемента, который должен быть изначально раскрыт
17
17
  */
18
- defaultActiveIndex?: number;
18
+ defaultActiveIndex?: number[];
19
19
  /**
20
20
  * Блокировка всех элементов
21
21
  */
@@ -27,7 +27,7 @@ declare type CustomAccordionProps = {
27
27
  /**
28
28
  * Функция при открытии или закрытии элемента аккордеона
29
29
  */
30
- onChangeValue?: (index?: number, value?: boolean) => void;
30
+ onChange?: (index?: number, value?: boolean) => void;
31
31
  children?: ReactNode;
32
32
  className?: string;
33
33
  };
@@ -1 +1 @@
1
- {"version":3,"file":"Accordion.types.d.ts","sourceRoot":"","sources":["../../../src/components/Accordion/Accordion.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,aAAK,oBAAoB,GAAG;IACxB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB;;OAEG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAE5B;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;IAEhC;;OAEG;IACH,aAAa,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IAE1D,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,oBAAY,cAAc,GAAG,oBAAoB,CAAC"}
1
+ {"version":3,"file":"Accordion.types.d.ts","sourceRoot":"","sources":["../../../src/components/Accordion/Accordion.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,aAAK,oBAAoB,GAAG;IACxB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB;;OAEG;IACH,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;IAE9B;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;IAEhC;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IAErD,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,oBAAY,cAAc,GAAG,oBAAoB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"AccordionItem.d.ts","sourceRoot":"","sources":["../../../../../src/components/Accordion/ui/AccordionItem/AccordionItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,cAAc,EAA8C,MAAM,OAAO,CAAC;AAkB1F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAEhE,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CAAC,cAAc,CAAC,GAAG,kBAAkB,CAwFvF,CAAC"}
1
+ {"version":3,"file":"AccordionItem.d.ts","sourceRoot":"","sources":["../../../../../src/components/Accordion/ui/AccordionItem/AccordionItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,cAAc,EAA8C,MAAM,OAAO,CAAC;AAkB1F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAEhE,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CAAC,cAAc,CAAC,GAAG,kBAAkB,CA0FvF,CAAC"}
@@ -32,11 +32,15 @@ declare type CustomAccordionItemProps = {
32
32
  /**
33
33
  * Функция при открытии аккардеона
34
34
  */
35
- onChangeValue?: (index: number, value: boolean) => void;
35
+ onChange: (index: number, value: boolean) => void;
36
36
  /**
37
37
  * Блокировка элемента
38
38
  */
39
39
  disabled?: boolean;
40
+ /**
41
+ * Индекс элемента
42
+ */
43
+ eventKey?: number;
40
44
  /**
41
45
  * Индекс элемента
42
46
  */
@@ -1 +1 @@
1
- {"version":3,"file":"AccordionItem.types.d.ts","sourceRoot":"","sources":["../../../../../src/components/Accordion/ui/AccordionItem/AccordionItem.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,6BAA6B,CAAC;AAEvD,aAAK,wBAAwB,GAAG;IAC5B;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,MAAM,CAAC;IAElC;;OAEG;IACH,WAAW,CAAC,EAAE,SAAS,CAAC;IAExB;;OAEG;IACH,YAAY,CAAC,EAAE,SAAS,CAAC;IAEzB;;OAEG;IACH,GAAG,CAAC,EAAE,GAAG,CAAC;IAEV;;OAEG;IACH,KAAK,EAAE,SAAS,CAAC;IAEjB;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IAEpB;;OAEG;IACH,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IAExD;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAMnB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,oBAAY,kBAAkB,GAAG,wBAAwB,CAAC"}
1
+ {"version":3,"file":"AccordionItem.types.d.ts","sourceRoot":"","sources":["../../../../../src/components/Accordion/ui/AccordionItem/AccordionItem.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,6BAA6B,CAAC;AAEvD,aAAK,wBAAwB,GAAG;IAC5B;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,MAAM,CAAC;IAElC;;OAEG;IACH,WAAW,CAAC,EAAE,SAAS,CAAC;IAExB;;OAEG;IACH,YAAY,CAAC,EAAE,SAAS,CAAC;IAEzB;;OAEG;IACH,GAAG,CAAC,EAAE,GAAG,CAAC;IAEV;;OAEG;IACH,KAAK,EAAE,SAAS,CAAC;IAEjB;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IAEpB;;OAEG;IACH,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IAElD;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAMnB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,oBAAY,kBAAkB,GAAG,wBAAwB,CAAC"}
@@ -8,9 +8,10 @@ export declare const updatePropsRecursively: (children?: ReactElement<{
8
8
  pin?: "square-square" | "square-clear" | "clear-square" | "clear-clear" | "clear-circle" | "circle-clear" | "circle-circle" | undefined;
9
9
  title: ReactNode;
10
10
  children: ReactNode;
11
- onChangeValue?: ((index: number, value: boolean) => void) | undefined;
11
+ onChange: (index: number, value: boolean) => void;
12
12
  disabled?: boolean | undefined;
13
+ eventKey?: number | undefined;
13
14
  index: number;
14
- }, string | import("react").JSXElementConstructor<any>>[] | undefined, activeIndex?: number | undefined, disabled?: boolean | undefined, updateValue?: ((index?: number | undefined, value?: boolean | undefined) => void) | undefined) => ReactNode[];
15
- export declare const getChildren: (children: ReactElement<AccordionItemProps>[], activeIndex?: number | undefined, disabled?: boolean | undefined, updateValue?: ((index?: number | undefined, value?: boolean | undefined) => void) | undefined) => ReactNode[];
15
+ }, string | import("react").JSXElementConstructor<any>>[] | undefined, activeIndex?: number[] | undefined, disabled?: boolean | undefined, updateValue?: ((index: number, value?: boolean | undefined) => void) | undefined) => ReactNode[];
16
+ export declare const getChildren: (children: ReactElement<AccordionItemProps>[], activeIndex?: number[] | undefined, disabled?: boolean | undefined, updateValue?: ((index: number, value?: boolean | undefined) => void) | undefined) => ReactNode[];
16
17
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Accordion/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,YAAY,EAAE,SAAS,EAAgC,MAAM,OAAO,CAAC;AAExF,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAE7E,eAAO,MAAM,sBAAsB;;;;;;;;;;;qNAIoB,IAAI,kBACxD,SAAS,EAcN,CAAC;AAEP,eAAO,MAAM,WAAW,aACV,aAAa,kBAAkB,CAAC,EAAE,gJAGO,IAAI,6BAG1D,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Accordion/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,YAAY,EAAE,SAAS,EAAgC,MAAM,OAAO,CAAC;AAExF,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAE7E,eAAO,MAAM,sBAAsB;;;;;;;;;;;;kKAIT,MAAM,kCAAsB,IAAI,kBACvD,SAAS,EAcN,CAAC;AAEP,eAAO,MAAM,WAAW,aACV,aAAa,kBAAkB,CAAC,EAAE,6FAGtB,MAAM,kCAAsB,IAAI,6BAGzD,CAAC"}
@@ -15,10 +15,10 @@ export declare const Accordion: import("react").FunctionComponent<import("../../
15
15
  view: string;
16
16
  size?: string | undefined;
17
17
  singleActive?: boolean | undefined;
18
- defaultActiveIndex?: number | undefined;
18
+ defaultActiveIndex?: number[] | undefined;
19
19
  disabled?: boolean | undefined;
20
20
  stretching?: "fixed" | "filled" | undefined;
21
- onChangeValue?: ((index?: number | undefined, value?: boolean | undefined) => void) | undefined;
21
+ onChange?: ((index?: number | undefined, value?: boolean | undefined) => void) | undefined;
22
22
  children?: import("react").ReactNode;
23
23
  className?: string | undefined;
24
24
  } & import("react").RefAttributes<HTMLDivElement>>;
@@ -19,10 +19,10 @@ export declare const Accordion: import("react").FunctionComponent<import("../../
19
19
  view: string;
20
20
  size?: string | undefined;
21
21
  singleActive?: boolean | undefined;
22
- defaultActiveIndex?: number | undefined;
22
+ defaultActiveIndex?: number[] | undefined;
23
23
  disabled?: boolean | undefined;
24
24
  stretching?: "fixed" | "filled" | undefined;
25
- onChangeValue?: ((index?: number | undefined, value?: boolean | undefined) => void) | undefined;
25
+ onChange?: ((index?: number | undefined, value?: boolean | undefined) => void) | undefined;
26
26
  children?: import("react").ReactNode;
27
27
  className?: string | undefined;
28
28
  } & import("react").RefAttributes<HTMLDivElement>>;