@salutejs/plasma-new-hope 0.88.0-canary.1223.9455252491.0 → 0.88.0-canary.1223.9462887113.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (25) hide show
  1. package/cjs/components/Accordion/Accordion.js +7 -6
  2. package/cjs/components/Accordion/Accordion.js.map +1 -1
  3. package/cjs/components/Accordion/ui/AccordionItem/AccordionItem.js +4 -2
  4. package/cjs/components/Accordion/ui/AccordionItem/AccordionItem.js.map +1 -1
  5. package/cjs/components/Accordion/utils/index.js +2 -2
  6. package/cjs/components/Accordion/utils/index.js.map +1 -1
  7. package/es/components/Accordion/Accordion.js +4 -3
  8. package/es/components/Accordion/Accordion.js.map +1 -1
  9. package/es/components/Accordion/ui/AccordionItem/AccordionItem.js +4 -2
  10. package/es/components/Accordion/ui/AccordionItem/AccordionItem.js.map +1 -1
  11. package/es/components/Accordion/utils/index.js +2 -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 +4 -3
  15. package/styled-components/cjs/components/Accordion/ui/AccordionItem/AccordionItem.js +4 -2
  16. package/styled-components/cjs/components/Accordion/utils/index.js +2 -2
  17. package/styled-components/cjs/examples/plasma_b2c/components/Accordion/Accordion.stories.tsx +2 -2
  18. package/styled-components/cjs/examples/plasma_web/components/Accordion/Accordion.stories.tsx +1 -1
  19. package/styled-components/es/components/Accordion/Accordion.js +4 -3
  20. package/styled-components/es/components/Accordion/ui/AccordionItem/AccordionItem.js +4 -2
  21. package/styled-components/es/components/Accordion/utils/index.js +2 -2
  22. package/styled-components/es/examples/plasma_b2c/components/Accordion/Accordion.stories.tsx +2 -2
  23. package/styled-components/es/examples/plasma_web/components/Accordion/Accordion.stories.tsx +1 -1
  24. package/types/components/Accordion/Accordion.d.ts.map +1 -1
  25. package/types/components/Accordion/ui/AccordionItem/AccordionItem.d.ts.map +1 -1
@@ -4,12 +4,12 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
6
6
  var React = require('react');
7
- var index$1 = require('../../utils/index.js');
7
+ var index = require('../../utils/index.js');
8
8
  var Accordion_styles = require('./Accordion.styles.js');
9
9
  var Accordion_tokens = require('./Accordion.tokens.js');
10
10
  var base = require('./variations/_view/base.js');
11
11
  var base$1 = require('./variations/_size/base.js');
12
- var index = require('./utils/index.js');
12
+ var index$1 = require('./utils/index.js');
13
13
 
14
14
  var accordionRoot = function accordionRoot(Root) {
15
15
  return /*#__PURE__*/React.forwardRef(function (_ref, outerRootRef) {
@@ -30,7 +30,9 @@ var accordionRoot = function accordionRoot(Root) {
30
30
  activeIndex = _useState2[0],
31
31
  setActiveIndex = _useState2[1];
32
32
  var updateValue = function updateValue(index, value) {
33
- onChange && onChange(index, value);
33
+ if (onChange) {
34
+ onChange(index, value);
35
+ }
34
36
  if (singleActive) {
35
37
  if (value) {
36
38
  setActiveIndex([index]);
@@ -47,13 +49,12 @@ var accordionRoot = function accordionRoot(Root) {
47
49
  }
48
50
  };
49
51
  var childrenArray = React.Children.toArray(children);
50
- var childrenMemo = index.getChildren(childrenArray, activeIndex, disabled, updateValue);
51
52
  return /*#__PURE__*/React.createElement(Root, {
52
53
  ref: outerRootRef,
53
54
  size: size,
54
55
  view: view,
55
- className: index$1.cx(stretchingClass, Accordion_tokens.classes.accordionRoot, className)
56
- }, childrenMemo);
56
+ className: index.cx(stretchingClass, Accordion_tokens.classes.accordionRoot, className)
57
+ }, index$1.getChildren(childrenArray, activeIndex, disabled, updateValue));
57
58
  });
58
59
  };
59
60
  var accordionConfig = {
@@ -1 +1 @@
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 defaultActiveEventKey = [],\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[]>(defaultActiveEventKey);\n\n const updateValue = (index: number, value?: boolean) => {\n onChange && onChange(index, value);\n if (singleActive) {\n if (value) {\n setActiveIndex([index]);\n } else {\n setActiveIndex([]);\n }\n } else if (value) {\n setActiveIndex([index, ...activeIndex]);\n } else {\n const updatedActiveIndex = activeIndex.filter((i) => i !== index);\n setActiveIndex(updatedActiveIndex);\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$defaultActiveEve","defaultActiveEventKey","children","disabled","className","singleActive","onChange","stretchingClass","classes","concat","_useState","useState","_useState2","_slicedToArray","activeIndex","setActiveIndex","updateValue","index","value","_toConsumableArray","updatedActiveIndex","filter","i","childrenArray","Children","toArray","childrenMemo","getChildren","React","createElement","ref","cx","accordionConfig","name","tag","layout","base","variations","css","viewCSS","sizeCSS","defaults"],"mappings":";;;;;;;;;;;;;IAY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AAEE,WAAAA;AACT,KAAA;GACH;AACDC,EAAAA,QAAQ,EAAE;AACN5C,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 defaultActiveEventKey = [],\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[]>(defaultActiveEventKey);\n\n const updateValue = (index: number, value?: boolean) => {\n if (onChange) {\n onChange(index, value);\n }\n if (singleActive) {\n if (value) {\n setActiveIndex([index]);\n } else {\n setActiveIndex([]);\n }\n } else if (value) {\n setActiveIndex([index, ...activeIndex]);\n } else {\n const updatedActiveIndex = activeIndex.filter((i) => i !== index);\n setActiveIndex(updatedActiveIndex);\n }\n };\n\n const childrenArray = Children.toArray(children) as React.ReactElement[];\n return (\n <Root\n ref={outerRootRef}\n size={size}\n view={view}\n className={cx(stretchingClass, classes.accordionRoot, className)}\n >\n {getChildren(childrenArray, activeIndex, disabled, updateValue)}\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$defaultActiveEve","defaultActiveEventKey","children","disabled","className","singleActive","onChange","stretchingClass","classes","concat","_useState","useState","_useState2","_slicedToArray","activeIndex","setActiveIndex","updateValue","index","value","_toConsumableArray","updatedActiveIndex","filter","i","childrenArray","Children","toArray","React","createElement","ref","cx","getChildren","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,CACJK,UAAU;AAAVA,MAAAA,UAAU,GAAAD,eAAA,KAAG,KAAA,CAAA,GAAA,QAAQ,GAAAA,eAAA;MAAAE,qBAAA,GAAAN,IAAA,CACrBO,qBAAqB;AAArBA,MAAAA,qBAAqB,GAAAD,qBAAA,KAAG,KAAA,CAAA,GAAA,EAAE,GAAAA,qBAAA;MAC1BE,QAAQ,GAAAR,IAAA,CAARQ,QAAQ;MACRC,QAAQ,GAAAT,IAAA,CAARS,QAAQ;MACRC,SAAS,GAAAV,IAAA,CAATU,SAAS;MACTC,YAAY,GAAAX,IAAA,CAAZW,YAAY;MACZC,QAAQ,GAAAZ,IAAA,CAARY,QAAQ,CAAA;AAIZ,IAAA,IAAMC,eAAe,GAAGC,wBAAO,IAAAC,MAAA,CAAIV,UAAU,EAAqC,YAAA,CAAA,CAAA,CAAA;AAElF,IAAA,IAAAW,SAAA,GAAsCC,cAAQ,CAAWV,qBAAqB,CAAC;MAAAW,UAAA,GAAAC,uCAAA,CAAAH,SAAA,EAAA,CAAA,CAAA;AAAxEI,MAAAA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J,CAAC,CAAA;AAAA,EAAA;AAEE,IAAMe,eAAe,GAAG;AAC3BC,EAAAA,IAAI,EAAE,WAAW;AACjBC,EAAAA,GAAG,EAAE,KAAK;AACVC,EAAAA,MAAM,EAAE3C,aAAa;AACrB4C,EAAAA,IAAI,EAAJA,qBAAI;AACJC,EAAAA,UAAU,EAAE;AACRvC,IAAAA,IAAI,EAAE;AACFwC,MAAAA,GAAG,EAAEC,SAAAA;KACR;AACD1C,IAAAA,IAAI,EAAE;AACFyC,MAAAA,GAAG,EAAEE,WAAAA;AACT,KAAA;GACH;AACDC,EAAAA,QAAQ,EAAE;AACN3C,IAAAA,IAAI,EAAE,SAAS;AACfD,IAAAA,IAAI,EAAE,GAAA;AACV,GAAA;AACJ;;;;;"}
@@ -32,14 +32,16 @@ var AccordionItem = function AccordionItem(_ref) {
32
32
  if (disabled) {
33
33
  return;
34
34
  }
35
- onChange && onChange(key, !value);
35
+ if (onChange) {
36
+ onChange(key, !value);
37
+ }
36
38
  };
37
39
  var onKeyPress = function onKeyPress(event) {
38
40
  if (disabled) {
39
41
  return;
40
42
  }
41
43
  event.persist();
42
- if (event.keyCode === 13) {
44
+ if (event.keyCode === 13 || event.keyCode === 32) {
43
45
  handleOpen();
44
46
  }
45
47
  };
@@ -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 eventKey,\n disabled,\n onChange,\n}) => {\n const key = eventKey ?? index;\n\n const [leftPadding, setLeftPadding] = useState<string | number | null>();\n\n const handleOpen = () => {\n if (disabled) {\n return;\n }\n onChange && onChange(key, !value);\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 openedBodyClass = value ? classes.accordionItemShowBody : undefined;\n\n const StyledAnimationPLus = () => (\n <StyledPlus>\n <StyledMinus size=\"xs\" color=\"inhert\" />\n <StyledMinus\n size=\"xs\"\n color=\"inhert\"\n className={openedBodyClass ?? classes.accordionPlusAnimationElement}\n />\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' && value ? classes.accordionItemShowBody : undefined;\n\n const rightContent = contentRight ?? (type === 'sign' ? <StyledAnimationPLus /> : undefined);\n const rightContentRotate = type === 'sign' && value ? 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={openedBodyClass} 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","leftPadding","setLeftPadding","handleOpen","onKeyPress","event","persist","keyCode","leftContentRef","useRef","useEffect","_leftContentRef$curre","_leftContentRef$curre2","leftContentWidth","current","offsetWidth","leftPaddingBody","concat","tokens","accordionItemGap","openedBodyClass","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,CAAX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,KAAK;IACVd,SAAS,EAAEX,wBAAO,CAAC0B,aAAc;AACjCC,IAAAA,QAAQ,EAAE,CAAE;AACZpD,IAAAA,GAAG,EAAEA,GAAI;AACTqD,IAAAA,KAAK,EAAE;AAAEC,MAAAA,YAAY,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,EAAEvE,IAAAA,EAAAA,KAA4B,CAC5B,CAAC,eAE5BuC,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,eAAgB;AAAC6B,IAAAA,KAAK,EAAE;MAAEW,WAAW,EAAA,EAAA,CAAA3C,MAAA,CAAKhB,WAAW,CAAA;AAAG,KAAA;GAC3FwB,eAAAA,KAAA,CAAAC,aAAA,CAACmC,wCAAmB,EAAExE,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 [leftPadding, setLeftPadding] = useState<string | number | null>();\n\n const handleOpen = () => {\n if (disabled) {\n return;\n }\n if (onChange) {\n onChange(key, !value);\n }\n };\n\n const onKeyPress = (event: KeyboardEvent<HTMLDivElement>) => {\n if (disabled) {\n return;\n }\n event.persist();\n if (event.keyCode === 13 || event.keyCode === 32) {\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 openedBodyClass = value ? classes.accordionItemShowBody : undefined;\n\n const StyledAnimationPLus = () => (\n <StyledPlus>\n <StyledMinus size=\"xs\" color=\"inhert\" />\n <StyledMinus\n size=\"xs\"\n color=\"inhert\"\n className={openedBodyClass ?? classes.accordionPlusAnimationElement}\n />\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' && value ? classes.accordionItemShowBody : undefined;\n\n const rightContent = contentRight ?? (type === 'sign' ? <StyledAnimationPLus /> : undefined);\n const rightContentRotate = type === 'sign' && value ? 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={openedBodyClass} 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","leftPadding","setLeftPadding","handleOpen","onKeyPress","event","persist","keyCode","leftContentRef","useRef","useEffect","_leftContentRef$curre","_leftContentRef$curre2","leftContentWidth","current","offsetWidth","leftPaddingBody","concat","tokens","accordionItemGap","openedBodyClass","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,GAAsCC,cAAQ,EAA0B;IAAAC,UAAA,GAAAC,uCAAA,CAAAH,SAAA,EAAA,CAAA,CAAA;AAAjEI,IAAAA,WAAW,GAAAF,UAAA,CAAA,CAAA,CAAA;AAAEG,IAAAA,cAAc,GAAAH,UAAA,CAAA,CAAA,CAAA,CAAA;AAElC,EAAA,IAAMI,UAAU,GAAG,SAAbA,UAAUA,GAAS;AACrB,IAAA,IAAIT,QAAQ,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,aAAA,CAACiC,+CAA0B,EAAA;AAAC3B,IAAAA,SAAS,EAAEZ,eAAgB;AAAC6B,IAAAA,KAAK,EAAE;MAAEW,WAAW,EAAA,EAAA,CAAA3C,MAAA,CAAKhB,WAAW,CAAA;AAAG,KAAA;GAC3FwB,eAAAA,KAAA,CAAAC,aAAA,CAACmC,wCAAmB,EAAExE,IAAAA,EAAAA,QAA8B,CAC5B,CACX,CAAC,CAAA;AAE9B;;;;"}
@@ -11,10 +11,10 @@ var updatePropsRecursively = function updatePropsRecursively(children, activeInd
11
11
  }
12
12
  var props = {
13
13
  index: index,
14
- value: !!(activeIndex !== null && activeIndex !== void 0 && activeIndex.find(function (i) {
14
+ value: !!((activeIndex === null || activeIndex === void 0 ? void 0 : activeIndex.findIndex(function (i) {
15
15
  var _child$props$eventKey;
16
16
  return i === ((_child$props$eventKey = child.props.eventKey) !== null && _child$props$eventKey !== void 0 ? _child$props$eventKey : index);
17
- })),
17
+ })) !== -1),
18
18
  disabled: disabled,
19
19
  onChange: updateValue
20
20
  };
@@ -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?.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
+ {"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?.findIndex((i: number) => i === (child.props.eventKey ?? index)) !== -1),\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","findIndex","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,EAAE,CAAAT,WAAW,KAAA,IAAA,IAAXA,WAAW,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAXA,WAAW,CAAEU,SAAS,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,MAAK,CAAC,CAAC,CAAC;AAC9FL,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;;;;;"}
@@ -26,7 +26,9 @@ var accordionRoot = function accordionRoot(Root) {
26
26
  activeIndex = _useState2[0],
27
27
  setActiveIndex = _useState2[1];
28
28
  var updateValue = function updateValue(index, value) {
29
- onChange && onChange(index, value);
29
+ if (onChange) {
30
+ onChange(index, value);
31
+ }
30
32
  if (singleActive) {
31
33
  if (value) {
32
34
  setActiveIndex([index]);
@@ -43,13 +45,12 @@ var accordionRoot = function accordionRoot(Root) {
43
45
  }
44
46
  };
45
47
  var childrenArray = Children.toArray(children);
46
- var childrenMemo = getChildren(childrenArray, activeIndex, disabled, updateValue);
47
48
  return /*#__PURE__*/React.createElement(Root, {
48
49
  ref: outerRootRef,
49
50
  size: size,
50
51
  view: view,
51
52
  className: cx(stretchingClass, classes.accordionRoot, className)
52
- }, childrenMemo);
53
+ }, getChildren(childrenArray, activeIndex, disabled, updateValue));
53
54
  });
54
55
  };
55
56
  var accordionConfig = {
@@ -1 +1 @@
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 defaultActiveEventKey = [],\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[]>(defaultActiveEventKey);\n\n const updateValue = (index: number, value?: boolean) => {\n onChange && onChange(index, value);\n if (singleActive) {\n if (value) {\n setActiveIndex([index]);\n } else {\n setActiveIndex([]);\n }\n } else if (value) {\n setActiveIndex([index, ...activeIndex]);\n } else {\n const updatedActiveIndex = activeIndex.filter((i) => i !== index);\n setActiveIndex(updatedActiveIndex);\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$defaultActiveEve","defaultActiveEventKey","children","disabled","className","singleActive","onChange","stretchingClass","classes","concat","_useState","useState","_useState2","_slicedToArray","activeIndex","setActiveIndex","updateValue","index","value","_toConsumableArray","updatedActiveIndex","filter","i","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,qBAAqB;AAArBA,MAAAA,qBAAqB,GAAAD,qBAAA,KAAG,KAAA,CAAA,GAAA,EAAE,GAAAA,qBAAA;MAC1BE,QAAQ,GAAAR,IAAA,CAARQ,QAAQ;MACRC,QAAQ,GAAAT,IAAA,CAARS,QAAQ;MACRC,SAAS,GAAAV,IAAA,CAATU,SAAS;MACTC,YAAY,GAAAX,IAAA,CAAZW,YAAY;MACZC,QAAQ,GAAAZ,IAAA,CAARY,QAAQ,CAAA;AAIZ,IAAA,IAAMC,eAAe,GAAGC,OAAO,IAAAC,MAAA,CAAIV,UAAU,EAAqC,YAAA,CAAA,CAAA,CAAA;AAElF,IAAA,IAAAW,SAAA,GAAsCC,QAAQ,CAAWV,qBAAqB,CAAC;MAAAW,UAAA,GAAAC,cAAA,CAAAH,SAAA,EAAA,CAAA,CAAA;AAAxEI,MAAAA,WAAW,GAAAF,UAAA,CAAA,CAAA,CAAA;AAAEG,MAAAA,cAAc,GAAAH,UAAA,CAAA,CAAA,CAAA,CAAA;IAElC,IAAMI,WAAW,GAAG,SAAdA,WAAWA,CAAIC,KAAa,EAAEC,KA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aAAa;AACrB6C,EAAAA,IAAI,EAAJA,IAAI;AACJC,EAAAA,UAAU,EAAE;AACRxC,IAAAA,IAAI,EAAE;AACFyC,MAAAA,GAAG,EAAEC,MAAAA;KACR;AACD3C,IAAAA,IAAI,EAAE;AACF0C,MAAAA,GAAG,EAAEE,MAAAA;AACT,KAAA;GACH;AACDC,EAAAA,QAAQ,EAAE;AACN5C,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 defaultActiveEventKey = [],\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[]>(defaultActiveEventKey);\n\n const updateValue = (index: number, value?: boolean) => {\n if (onChange) {\n onChange(index, value);\n }\n if (singleActive) {\n if (value) {\n setActiveIndex([index]);\n } else {\n setActiveIndex([]);\n }\n } else if (value) {\n setActiveIndex([index, ...activeIndex]);\n } else {\n const updatedActiveIndex = activeIndex.filter((i) => i !== index);\n setActiveIndex(updatedActiveIndex);\n }\n };\n\n const childrenArray = Children.toArray(children) as React.ReactElement[];\n return (\n <Root\n ref={outerRootRef}\n size={size}\n view={view}\n className={cx(stretchingClass, classes.accordionRoot, className)}\n >\n {getChildren(childrenArray, activeIndex, disabled, updateValue)}\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$defaultActiveEve","defaultActiveEventKey","children","disabled","className","singleActive","onChange","stretchingClass","classes","concat","_useState","useState","_useState2","_slicedToArray","activeIndex","setActiveIndex","updateValue","index","value","_toConsumableArray","updatedActiveIndex","filter","i","childrenArray","Children","toArray","React","createElement","ref","cx","getChildren","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,qBAAqB;AAArBA,MAAAA,qBAAqB,GAAAD,qBAAA,KAAG,KAAA,CAAA,GAAA,EAAE,GAAAA,qBAAA;MAC1BE,QAAQ,GAAAR,IAAA,CAARQ,QAAQ;MACRC,QAAQ,GAAAT,IAAA,CAARS,QAAQ;MACRC,SAAS,GAAAV,IAAA,CAATU,SAAS;MACTC,YAAY,GAAAX,IAAA,CAAZW,YAAY;MACZC,QAAQ,GAAAZ,IAAA,CAARY,QAAQ,CAAA;AAIZ,IAAA,IAAMC,eAAe,GAAGC,OAAO,IAAAC,MAAA,CAAIV,U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,EAAE,CAACtB,eAAe,EAAEC,OAAO,CAACjB,aAAa,EAAEa,SAAS,CAAA;KAE9D0B,EAAAA,WAAW,CAACP,aAAa,EAAET,WAAW,EAAEX,QAAQ,EAAEa,WAAW,CAC5D,CAAC,CAAA;AAEf,GACJ,CAAC,CAAA;AAAA,EAAA;AAEE,IAAMe,eAAe,GAAG;AAC3BC,EAAAA,IAAI,EAAE,WAAW;AACjBC,EAAAA,GAAG,EAAE,KAAK;AACVC,EAAAA,MAAM,EAAE3C,aAAa;AACrB4C,EAAAA,IAAI,EAAJA,IAAI;AACJC,EAAAA,UAAU,EAAE;AACRvC,IAAAA,IAAI,EAAE;AACFwC,MAAAA,GAAG,EAAEC,MAAAA;KACR;AACD1C,IAAAA,IAAI,EAAE;AACFyC,MAAAA,GAAG,EAAEE,MAAAA;AACT,KAAA;GACH;AACDC,EAAAA,QAAQ,EAAE;AACN3C,IAAAA,IAAI,EAAE,SAAS;AACfD,IAAAA,IAAI,EAAE,GAAA;AACV,GAAA;AACJ;;;;"}
@@ -28,14 +28,16 @@ var AccordionItem = function AccordionItem(_ref) {
28
28
  if (disabled) {
29
29
  return;
30
30
  }
31
- onChange && onChange(key, !value);
31
+ if (onChange) {
32
+ onChange(key, !value);
33
+ }
32
34
  };
33
35
  var onKeyPress = function onKeyPress(event) {
34
36
  if (disabled) {
35
37
  return;
36
38
  }
37
39
  event.persist();
38
- if (event.keyCode === 13) {
40
+ if (event.keyCode === 13 || event.keyCode === 32) {
39
41
  handleOpen();
40
42
  }
41
43
  };
@@ -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 eventKey,\n disabled,\n onChange,\n}) => {\n const key = eventKey ?? index;\n\n const [leftPadding, setLeftPadding] = useState<string | number | null>();\n\n const handleOpen = () => {\n if (disabled) {\n return;\n }\n onChange && onChange(key, !value);\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 openedBodyClass = value ? classes.accordionItemShowBody : undefined;\n\n const StyledAnimationPLus = () => (\n <StyledPlus>\n <StyledMinus size=\"xs\" color=\"inhert\" />\n <StyledMinus\n size=\"xs\"\n color=\"inhert\"\n className={openedBodyClass ?? classes.accordionPlusAnimationElement}\n />\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' && value ? classes.accordionItemShowBody : undefined;\n\n const rightContent = contentRight ?? (type === 'sign' ? <StyledAnimationPLus /> : undefined);\n const rightContentRotate = type === 'sign' && value ? 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={openedBodyClass} 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","leftPadding","setLeftPadding","handleOpen","onKeyPress","event","persist","keyCode","leftContentRef","useRef","useEffect","_leftContentRef$curre","_leftContentRef$curre2","leftContentWidth","current","offsetWidth","leftPaddingBody","concat","tokens","accordionItemGap","openedBodyClass","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,G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X,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 [leftPadding, setLeftPadding] = useState<string | number | null>();\n\n const handleOpen = () => {\n if (disabled) {\n return;\n }\n if (onChange) {\n onChange(key, !value);\n }\n };\n\n const onKeyPress = (event: KeyboardEvent<HTMLDivElement>) => {\n if (disabled) {\n return;\n }\n event.persist();\n if (event.keyCode === 13 || event.keyCode === 32) {\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 openedBodyClass = value ? classes.accordionItemShowBody : undefined;\n\n const StyledAnimationPLus = () => (\n <StyledPlus>\n <StyledMinus size=\"xs\" color=\"inhert\" />\n <StyledMinus\n size=\"xs\"\n color=\"inhert\"\n className={openedBodyClass ?? classes.accordionPlusAnimationElement}\n />\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' && value ? classes.accordionItemShowBody : undefined;\n\n const rightContent = contentRight ?? (type === 'sign' ? <StyledAnimationPLus /> : undefined);\n const rightContentRotate = type === 'sign' && value ? 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={openedBodyClass} 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","leftPadding","setLeftPadding","handleOpen","onKeyPress","event","persist","keyCode","leftContentRef","useRef","useEffect","_leftContentRef$curre","_leftContentRef$curre2","leftContentWidth","current","offsetWidth","leftPaddingBody","concat","tokens","accordionItemGap","openedBodyClass","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,GAAsCC,QAAQ,EAA0B;IAAAC,UAAA,GAAAC,cAAA,CAAAH,SAAA,EAAA,CAAA,CAAA;AAAjEI,IAAAA,WAAW,GAAAF,UAAA,CAAA,CAAA,CA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,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,eAAgB;AAAC6B,IAAAA,KAAK,EAAE;MAAEW,WAAW,EAAA,EAAA,CAAA3C,MAAA,CAAKhB,WAAW,CAAA;AAAG,KAAA;GAC3FwB,eAAAA,KAAA,CAAAC,aAAA,CAACmC,mBAAmB,EAAExE,IAAAA,EAAAA,QAA8B,CAC5B,CACX,CAAC,CAAA;AAE9B;;;;"}
@@ -7,10 +7,10 @@ var updatePropsRecursively = function updatePropsRecursively(children, activeInd
7
7
  }
8
8
  var props = {
9
9
  index: index,
10
- value: !!(activeIndex !== null && activeIndex !== void 0 && activeIndex.find(function (i) {
10
+ value: !!((activeIndex === null || activeIndex === void 0 ? void 0 : activeIndex.findIndex(function (i) {
11
11
  var _child$props$eventKey;
12
12
  return i === ((_child$props$eventKey = child.props.eventKey) !== null && _child$props$eventKey !== void 0 ? _child$props$eventKey : index);
13
- })),
13
+ })) !== -1),
14
14
  disabled: disabled,
15
15
  onChange: updateValue
16
16
  };
@@ -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?.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;;;;"}
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?.findIndex((i: number) => i === (child.props.eventKey ?? index)) !== -1),\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","findIndex","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,EAAE,CAAAT,WAAW,KAAA,IAAA,IAAXA,WAAW,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAXA,WAAW,CAAEU,SAAS,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,MAAK,CAAC,CAAC,CAAC;AAC9FL,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.9455252491.0",
3
+ "version": "0.88.0-canary.1223.9462887113.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": "30560ca8f3c4ab42f816c70f937e2eff313616f1"
106
+ "gitHead": "e1a603047e80c8086f177567584ab02e41e0106e"
107
107
  }
@@ -43,7 +43,9 @@ var accordionRoot = exports.accordionRoot = function accordionRoot(Root) {
43
43
  activeIndex = _useState2[0],
44
44
  setActiveIndex = _useState2[1];
45
45
  var updateValue = function updateValue(index, value) {
46
- onChange && onChange(index, value);
46
+ if (onChange) {
47
+ onChange(index, value);
48
+ }
47
49
  if (singleActive) {
48
50
  if (value) {
49
51
  setActiveIndex([index]);
@@ -60,13 +62,12 @@ var accordionRoot = exports.accordionRoot = function accordionRoot(Root) {
60
62
  }
61
63
  };
62
64
  var childrenArray = _react.Children.toArray(children);
63
- var childrenMemo = (0, _utils2.getChildren)(childrenArray, activeIndex, disabled, updateValue);
64
65
  return /*#__PURE__*/_react["default"].createElement(Root, {
65
66
  ref: outerRootRef,
66
67
  size: size,
67
68
  view: view,
68
69
  className: (0, _utils.cx)(stretchingClass, _Accordion2.classes.accordionRoot, className)
69
- }, childrenMemo);
70
+ }, (0, _utils2.getChildren)(childrenArray, activeIndex, disabled, updateValue));
70
71
  });
71
72
  };
72
73
  var accordionConfig = exports.accordionConfig = {
@@ -41,14 +41,16 @@ var AccordionItem = exports.AccordionItem = function AccordionItem(_ref) {
41
41
  if (disabled) {
42
42
  return;
43
43
  }
44
- onChange && onChange(key, !value);
44
+ if (onChange) {
45
+ onChange(key, !value);
46
+ }
45
47
  };
46
48
  var onKeyPress = function onKeyPress(event) {
47
49
  if (disabled) {
48
50
  return;
49
51
  }
50
52
  event.persist();
51
- if (event.keyCode === 13) {
53
+ if (event.keyCode === 13 || event.keyCode === 32) {
52
54
  handleOpen();
53
55
  }
54
56
  };
@@ -12,10 +12,10 @@ var updatePropsRecursively = exports.updatePropsRecursively = function updatePro
12
12
  }
13
13
  var props = {
14
14
  index: index,
15
- value: !!(activeIndex !== null && activeIndex !== void 0 && activeIndex.find(function (i) {
15
+ value: !!((activeIndex === null || activeIndex === void 0 ? void 0 : activeIndex.findIndex(function (i) {
16
16
  var _child$props$eventKey;
17
17
  return i === ((_child$props$eventKey = child.props.eventKey) !== null && _child$props$eventKey !== void 0 ? _child$props$eventKey : index);
18
- })),
18
+ })) !== -1),
19
19
  disabled: disabled,
20
20
  onChange: updateValue
21
21
  };
@@ -15,7 +15,7 @@ const meta: Meta<typeof Accordion> = {
15
15
  decorators: [WithTheme],
16
16
  component: Accordion,
17
17
  args: {
18
- singleActive: true,
18
+ singleActive: false,
19
19
  view: 'default',
20
20
  size: 'm',
21
21
  stretching: 'filled',
@@ -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} eventKey={3435}>
54
+ <AccordionItem type={args.type} pin={args.pin} title={args.title}>
55
55
  {args.body}
56
56
  </AccordionItem>
57
57
  <AccordionItem type={args.type} pin={args.pin} title={args.title}>
@@ -15,7 +15,7 @@ const meta: Meta<typeof Accordion> = {
15
15
  decorators: [WithTheme],
16
16
  component: Accordion,
17
17
  args: {
18
- singleActive: true,
18
+ singleActive: false,
19
19
  view: 'default',
20
20
  size: 'm',
21
21
  stretching: 'filled',
@@ -34,7 +34,9 @@ export var accordionRoot = function accordionRoot(Root) {
34
34
  activeIndex = _useState2[0],
35
35
  setActiveIndex = _useState2[1];
36
36
  var updateValue = function updateValue(index, value) {
37
- onChange && onChange(index, value);
37
+ if (onChange) {
38
+ onChange(index, value);
39
+ }
38
40
  if (singleActive) {
39
41
  if (value) {
40
42
  setActiveIndex([index]);
@@ -51,13 +53,12 @@ export var accordionRoot = function accordionRoot(Root) {
51
53
  }
52
54
  };
53
55
  var childrenArray = Children.toArray(children);
54
- var childrenMemo = getChildren(childrenArray, activeIndex, disabled, updateValue);
55
56
  return /*#__PURE__*/React.createElement(Root, {
56
57
  ref: outerRootRef,
57
58
  size: size,
58
59
  view: view,
59
60
  className: cx(stretchingClass, classes.accordionRoot, className)
60
- }, childrenMemo);
61
+ }, getChildren(childrenArray, activeIndex, disabled, updateValue));
61
62
  });
62
63
  };
63
64
  export var accordionConfig = {
@@ -32,14 +32,16 @@ export var AccordionItem = function AccordionItem(_ref) {
32
32
  if (disabled) {
33
33
  return;
34
34
  }
35
- onChange && onChange(key, !value);
35
+ if (onChange) {
36
+ onChange(key, !value);
37
+ }
36
38
  };
37
39
  var onKeyPress = function onKeyPress(event) {
38
40
  if (disabled) {
39
41
  return;
40
42
  }
41
43
  event.persist();
42
- if (event.keyCode === 13) {
44
+ if (event.keyCode === 13 || event.keyCode === 32) {
43
45
  handleOpen();
44
46
  }
45
47
  };
@@ -6,10 +6,10 @@ export var updatePropsRecursively = function updatePropsRecursively(children, ac
6
6
  }
7
7
  var props = {
8
8
  index: index,
9
- value: !!(activeIndex !== null && activeIndex !== void 0 && activeIndex.find(function (i) {
9
+ value: !!((activeIndex === null || activeIndex === void 0 ? void 0 : activeIndex.findIndex(function (i) {
10
10
  var _child$props$eventKey;
11
11
  return i === ((_child$props$eventKey = child.props.eventKey) !== null && _child$props$eventKey !== void 0 ? _child$props$eventKey : index);
12
- })),
12
+ })) !== -1),
13
13
  disabled: disabled,
14
14
  onChange: updateValue
15
15
  };
@@ -15,7 +15,7 @@ const meta: Meta<typeof Accordion> = {
15
15
  decorators: [WithTheme],
16
16
  component: Accordion,
17
17
  args: {
18
- singleActive: true,
18
+ singleActive: false,
19
19
  view: 'default',
20
20
  size: 'm',
21
21
  stretching: 'filled',
@@ -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} eventKey={3435}>
54
+ <AccordionItem type={args.type} pin={args.pin} title={args.title}>
55
55
  {args.body}
56
56
  </AccordionItem>
57
57
  <AccordionItem type={args.type} pin={args.pin} title={args.title}>
@@ -15,7 +15,7 @@ const meta: Meta<typeof Accordion> = {
15
15
  decorators: [WithTheme],
16
16
  component: Accordion,
17
17
  args: {
18
- singleActive: true,
18
+ singleActive: false,
19
19
  view: 'default',
20
20
  size: 'm',
21
21
  stretching: 'filled',
@@ -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,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAGtD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAOxD,eAAO,MAAM,aAAa,SAAU,sBAAsB,cAAc,EAAE,cAAc,CAAC;;;;;;;;;;wCAmDpF,CAAC;AAEN,eAAO,MAAM,eAAe;;;mBArDQ,sBAAsB,cAAc,EAAE,cAAc,CAAC;;;;;;;;;;;;;;;;;;;;;;;;CAsExF,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;;;;;;;;;;wCAkDpF,CAAC;AAEN,eAAO,MAAM,eAAe;;;mBApDQ,sBAAsB,cAAc,EAAE,cAAc,CAAC;;;;;;;;;;;;;;;;;;;;;;;;CAqExF,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,CA4FvF,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,CA8FvF,CAAC"}