@salutejs/plasma-new-hope 0.88.0-canary.1223.9505247307.0 → 0.88.0-canary.1223.9513673141.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -83,7 +83,7 @@ var AccordionItem = function AccordionItem(_ref) {
83
83
  tabIndex: 0,
84
84
  onClick: handleOpen,
85
85
  className: disabledClass,
86
- "aria-expanded": "true",
86
+ "aria-expanded": value,
87
87
  "aria-controls": "accordion-item-section".concat(key),
88
88
  id: "accordion-item-".concat(key),
89
89
  onKeyDown: onKeyPress
@@ -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 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 className={classes.accordionItem}\n key={key}\n style={{ borderRadius: accordionBorderRadius }}\n >\n <StyledAccordionHeader\n role=\"tab\"\n tabIndex={0}\n onClick={handleOpen}\n className={disabledClass}\n aria-expanded=\"true\"\n aria-controls={`accordion-item-section${key}`}\n id={`accordion-item-${key}`}\n onKeyDown={onKeyPress}\n >\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\n aria-labelledby={`accordion-item-${key}`}\n id={`accordion-item-section${key}`}\n className={openedBodyClass}\n style={{ paddingLeft: `${leftPadding}` }}\n >\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","accordionItem","style","borderRadius","StyledAccordionHeader","role","tabIndex","onClick","id","onKeyDown","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,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"],"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 className={classes.accordionItem}\n key={key}\n style={{ borderRadius: accordionBorderRadius }}\n >\n <StyledAccordionHeader\n role=\"tab\"\n tabIndex={0}\n onClick={handleOpen}\n className={disabledClass}\n aria-expanded={value}\n aria-controls={`accordion-item-section${key}`}\n id={`accordion-item-${key}`}\n onKeyDown={onKeyPress}\n >\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\n aria-labelledby={`accordion-item-${key}`}\n id={`accordion-item-section${key}`}\n className={openedBodyClass}\n style={{ paddingLeft: `${leftPadding}` }}\n >\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","accordionItem","style","borderRadius","StyledAccordionHeader","role","tabIndex","onClick","id","onKeyDown","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,GA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,IAAAA,GAAG,EAAEjD,cAAe;AAACwB,IAAAA,SAAS,EAAEU,iBAAAA;AAAkB,GAAA,EACzEH,WACuB,CAC/B,eACDd,KAAA,CAAAC,aAAA,CAACgC,yCAAoB,EAAExE,IAAAA,EAAAA,KAA4B,CAC5B,CAAC,eAE5BuC,KAAA,CAAAC,aAAA,CAACiC,gDAA2B,EAAA;AAAC3B,IAAAA,SAAS,EAAEY,kBAAAA;GACnCD,EAAAA,YAAY,IAAIA,YACQ,CACV,CAAC,eACxBlB,KAAA,CAAAC,aAAA,CAACkC,+CAA0B,EAAA;IACvB,iBAAA3C,EAAAA,iBAAAA,CAAAA,MAAA,CAAmCrB,GAAG,CAAG;AACzCyD,IAAAA,EAAE,EAAApC,wBAAAA,CAAAA,MAAA,CAA2BrB,GAAG,CAAG;AACnCoC,IAAAA,SAAS,EAAEZ,eAAgB;AAC3B2B,IAAAA,KAAK,EAAE;MAAEc,WAAW,EAAA,EAAA,CAAA5C,MAAA,CAAKhB,WAAW,CAAA;AAAG,KAAA;GAEvCwB,eAAAA,KAAA,CAAAC,aAAA,CAACoC,wCAAmB,EAAEzE,IAAAA,EAAAA,QAA8B,CAC5B,CACX,CAAC,CAAA;AAE9B;;;;"}
@@ -79,7 +79,7 @@ var AccordionItem = function AccordionItem(_ref) {
79
79
  tabIndex: 0,
80
80
  onClick: handleOpen,
81
81
  className: disabledClass,
82
- "aria-expanded": "true",
82
+ "aria-expanded": value,
83
83
  "aria-controls": "accordion-item-section".concat(key),
84
84
  id: "accordion-item-".concat(key),
85
85
  onKeyDown: onKeyPress
@@ -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 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 className={classes.accordionItem}\n key={key}\n style={{ borderRadius: accordionBorderRadius }}\n >\n <StyledAccordionHeader\n role=\"tab\"\n tabIndex={0}\n onClick={handleOpen}\n className={disabledClass}\n aria-expanded=\"true\"\n aria-controls={`accordion-item-section${key}`}\n id={`accordion-item-${key}`}\n onKeyDown={onKeyPress}\n >\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\n aria-labelledby={`accordion-item-${key}`}\n id={`accordion-item-section${key}`}\n className={openedBodyClass}\n style={{ paddingLeft: `${leftPadding}` }}\n >\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","accordionItem","style","borderRadius","StyledAccordionHeader","role","tabIndex","onClick","id","onKeyDown","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,CAAA;AAAEG,IAAAA,cAAc,GAAAH,UAAA,CAAA,CAAA,CAAA,CAAA;AAElC,EAAA,IAAMI,UAAU,GAAG,SAAbA,UAAUA,GAAS;AACrB,IAAA,IAAIT,QAAQ,EAAE;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uC,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;IACvB,iBAAA3C,EAAAA,iBAAAA,CAAAA,MAAA,CAAmCrB,GAAG,CAAG;AACzCyD,IAAAA,EAAE,EAAApC,wBAAAA,CAAAA,MAAA,CAA2BrB,GAAG,CAAG;AACnCoC,IAAAA,SAAS,EAAEZ,eAAgB;AAC3B2B,IAAAA,KAAK,EAAE;MAAEc,WAAW,EAAA,EAAA,CAAA5C,MAAA,CAAKhB,WAAW,CAAA;AAAG,KAAA;GAEvCwB,eAAAA,KAAA,CAAAC,aAAA,CAACoC,mBAAmB,EAAEzE,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 className={classes.accordionItem}\n key={key}\n style={{ borderRadius: accordionBorderRadius }}\n >\n <StyledAccordionHeader\n role=\"tab\"\n tabIndex={0}\n onClick={handleOpen}\n className={disabledClass}\n aria-expanded={value}\n aria-controls={`accordion-item-section${key}`}\n id={`accordion-item-${key}`}\n onKeyDown={onKeyPress}\n >\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\n aria-labelledby={`accordion-item-${key}`}\n id={`accordion-item-section${key}`}\n className={openedBodyClass}\n style={{ paddingLeft: `${leftPadding}` }}\n >\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","accordionItem","style","borderRadius","StyledAccordionHeader","role","tabIndex","onClick","id","onKeyDown","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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,CAAKhB,WAAW,CAAA;AAAG,KAAA;GAEvCwB,eAAAA,KAAA,CAAAC,aAAA,CAACoC,mBAAmB,EAAEzE,IAAAA,EAAAA,QAA8B,CAC5B,CACX,CAAC,CAAA;AAE9B;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salutejs/plasma-new-hope",
3
- "version": "0.88.0-canary.1223.9505247307.0",
3
+ "version": "0.88.0-canary.1223.9513673141.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": "09b90fa9fdeda86772f56ffec2ae98d22d8182e4"
106
+ "gitHead": "96e3f6d2b6469c38d0fabecf4767b76b1732028a"
107
107
  }
@@ -92,7 +92,7 @@ var AccordionItem = exports.AccordionItem = function AccordionItem(_ref) {
92
92
  tabIndex: 0,
93
93
  onClick: handleOpen,
94
94
  className: disabledClass,
95
- "aria-expanded": "true",
95
+ "aria-expanded": value,
96
96
  "aria-controls": "accordion-item-section".concat(key),
97
97
  id: "accordion-item-".concat(key),
98
98
  onKeyDown: onKeyPress
@@ -83,7 +83,7 @@ export var AccordionItem = function AccordionItem(_ref) {
83
83
  tabIndex: 0,
84
84
  onClick: handleOpen,
85
85
  className: disabledClass,
86
- "aria-expanded": "true",
86
+ "aria-expanded": value,
87
87
  "aria-controls": "accordion-item-section".concat(key),
88
88
  id: "accordion-item-".concat(key),
89
89
  onKeyDown: onKeyPress
@@ -2,7 +2,7 @@ import type { ReactNode } from 'react';
2
2
  import type { Pin } from '../../../../utils/roundness';
3
3
  declare type CustomAccordionItemProps = {
4
4
  /**
5
- * Значение раскрытия аккардеона
5
+ * Значение раскрытия аккордеона
6
6
  */
7
7
  value?: boolean;
8
8
  /**