@salutejs/plasma-new-hope 0.88.0-canary.1223.9302553119.0 → 0.88.0-canary.1223.9380263327.0
Sign up to get free protection for your applications and to get access to all the features.
- package/cjs/components/Accordion/Accordion.css +1 -0
- package/cjs/components/Accordion/Accordion.js +66 -0
- package/cjs/components/Accordion/Accordion.js.map +1 -0
- package/cjs/components/Accordion/Accordion.styles.js +9 -0
- package/cjs/components/Accordion/Accordion.styles.js.map +1 -0
- package/cjs/components/Accordion/Accordion.styles_1mo1sxr.css +1 -0
- package/cjs/components/Accordion/Accordion.tokens.js +44 -0
- package/cjs/components/Accordion/Accordion.tokens.js.map +1 -0
- package/cjs/components/Accordion/ui/AccordionItem/AccordionItem.js +97 -0
- package/cjs/components/Accordion/ui/AccordionItem/AccordionItem.js.map +1 -0
- package/cjs/components/Accordion/ui/AccordionItem/AccordionItem.styles.js +63 -0
- package/cjs/components/Accordion/ui/AccordionItem/AccordionItem.styles.js.map +1 -0
- package/cjs/components/Accordion/utils/index.js +26 -0
- package/cjs/components/Accordion/utils/index.js.map +1 -0
- package/cjs/components/Accordion/variations/_size/base.js +9 -0
- package/cjs/components/Accordion/variations/_size/base.js.map +1 -0
- package/cjs/components/Accordion/variations/_size/base_x642ct.css +1 -0
- package/cjs/components/Accordion/variations/_view/base.js +9 -0
- package/cjs/components/Accordion/variations/_view/base.js.map +1 -0
- package/cjs/components/Accordion/variations/_view/base_x642ct.css +1 -0
- package/cjs/components/_Icon/Icon.assets/ChevronDownFill.js +33 -0
- package/cjs/components/_Icon/Icon.assets/ChevronDownFill.js.map +1 -0
- package/cjs/components/_Icon/Icon.assets/Minus.js +22 -0
- package/cjs/components/_Icon/Icon.assets/Minus.js.map +1 -0
- package/cjs/components/_Icon/Icons/IconChevronDownFill.js +23 -0
- package/cjs/components/_Icon/Icons/IconChevronDownFill.js.map +1 -0
- package/cjs/components/_Icon/Icons/IconMinus.js +23 -0
- package/cjs/components/_Icon/Icons/IconMinus.js.map +1 -0
- package/cjs/index.css +2 -0
- package/cjs/index.js +8 -0
- package/cjs/index.js.map +1 -1
- package/es/components/Accordion/Accordion.css +1 -0
- package/es/components/Accordion/Accordion.js +61 -0
- package/es/components/Accordion/Accordion.js.map +1 -0
- package/es/components/Accordion/Accordion.styles.js +5 -0
- package/es/components/Accordion/Accordion.styles.js.map +1 -0
- package/es/components/Accordion/Accordion.styles_1mo1sxr.css +1 -0
- package/es/components/Accordion/Accordion.tokens.js +39 -0
- package/es/components/Accordion/Accordion.tokens.js.map +1 -0
- package/es/components/Accordion/ui/AccordionItem/AccordionItem.js +93 -0
- package/es/components/Accordion/ui/AccordionItem/AccordionItem.js.map +1 -0
- package/es/components/Accordion/ui/AccordionItem/AccordionItem.styles.js +49 -0
- package/es/components/Accordion/ui/AccordionItem/AccordionItem.styles.js.map +1 -0
- package/es/components/Accordion/utils/index.js +21 -0
- package/es/components/Accordion/utils/index.js.map +1 -0
- package/es/components/Accordion/variations/_size/base.js +5 -0
- package/es/components/Accordion/variations/_size/base.js.map +1 -0
- package/es/components/Accordion/variations/_size/base_x642ct.css +1 -0
- package/es/components/Accordion/variations/_view/base.js +5 -0
- package/es/components/Accordion/variations/_view/base.js.map +1 -0
- package/es/components/Accordion/variations/_view/base_x642ct.css +1 -0
- package/es/components/_Icon/Icon.assets/ChevronDownFill.js +29 -0
- package/es/components/_Icon/Icon.assets/ChevronDownFill.js.map +1 -0
- package/es/components/_Icon/Icon.assets/Minus.js +18 -0
- package/es/components/_Icon/Icon.assets/Minus.js.map +1 -0
- package/es/components/_Icon/Icons/IconChevronDownFill.js +19 -0
- package/es/components/_Icon/Icons/IconChevronDownFill.js.map +1 -0
- package/es/components/_Icon/Icons/IconMinus.js +19 -0
- package/es/components/_Icon/Icons/IconMinus.js.map +1 -0
- package/es/index.css +2 -0
- package/es/index.js +3 -0
- package/es/index.js.map +1 -1
- package/package.json +2 -2
- package/styled-components/cjs/components/Accordion/Accordion.js +23 -2
- package/styled-components/cjs/components/Accordion/Accordion.tokens.js +4 -4
- package/styled-components/cjs/components/Accordion/ui/AccordionItem/AccordionItem.js +10 -3
- package/styled-components/cjs/components/Accordion/ui/AccordionItem/AccordionItem.styles.js +5 -5
- package/styled-components/cjs/components/Accordion/utils/index.js +23 -0
- package/styled-components/cjs/examples/plasma_b2c/components/Accordion/Accordion.config.js +6 -6
- package/styled-components/cjs/examples/plasma_b2c/components/Accordion/Accordion.stories.tsx +1 -0
- package/styled-components/cjs/examples/plasma_web/components/Accordion/Accordion.config.js +6 -6
- package/styled-components/cjs/examples/plasma_web/components/Accordion/Accordion.stories.tsx +1 -0
- package/styled-components/cjs/index.js +11 -0
- package/styled-components/es/components/Accordion/Accordion.js +24 -3
- package/styled-components/es/components/Accordion/Accordion.tokens.js +4 -4
- package/styled-components/es/components/Accordion/ui/AccordionItem/AccordionItem.js +10 -3
- package/styled-components/es/components/Accordion/ui/AccordionItem/AccordionItem.styles.js +5 -5
- package/styled-components/es/components/Accordion/utils/index.js +17 -0
- package/styled-components/es/examples/plasma_b2c/components/Accordion/Accordion.config.js +6 -6
- package/styled-components/es/examples/plasma_b2c/components/Accordion/Accordion.stories.tsx +1 -0
- package/styled-components/es/examples/plasma_web/components/Accordion/Accordion.config.js +6 -6
- package/styled-components/es/examples/plasma_web/components/Accordion/Accordion.stories.tsx +1 -0
- package/styled-components/es/index.js +2 -1
- package/types/components/Accordion/Accordion.d.ts +2 -0
- package/types/components/Accordion/Accordion.d.ts.map +1 -1
- package/types/components/Accordion/Accordion.tokens.d.ts +4 -4
- package/types/components/Accordion/Accordion.types.d.ts +5 -1
- package/types/components/Accordion/Accordion.types.d.ts.map +1 -1
- package/types/components/Accordion/ui/AccordionItem/AccordionItem.d.ts.map +1 -1
- package/types/components/Accordion/ui/AccordionItem/AccordionItem.styles.d.ts.map +1 -1
- package/types/components/Accordion/ui/AccordionItem/AccordionItem.types.d.ts +10 -4
- package/types/components/Accordion/ui/AccordionItem/AccordionItem.types.d.ts.map +1 -1
- package/types/components/Accordion/utils/index.d.ts +17 -0
- package/types/components/Accordion/utils/index.d.ts.map +1 -0
- package/types/examples/plasma_b2c/components/Accordion/Accordion.config.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/Accordion/Accordion.d.ts +1 -0
- package/types/examples/plasma_b2c/components/Accordion/Accordion.d.ts.map +1 -1
- package/types/examples/plasma_web/components/Accordion/Accordion.config.d.ts.map +1 -1
- package/types/examples/plasma_web/components/Accordion/Accordion.d.ts +1 -0
- package/types/examples/plasma_web/components/Accordion/Accordion.d.ts.map +1 -1
- package/types/index.d.ts +1 -0
- package/types/index.d.ts.map +1 -1
- /package/cjs/components/{_Icon/Icons/IconClose.css → Accordion/ui/AccordionItem/AccordionItem.css} +0 -0
- /package/es/components/{_Icon/Icons/IconClose.css → Accordion/ui/AccordionItem/AccordionItem.css} +0 -0
@@ -0,0 +1,61 @@
|
|
1
|
+
import { slicedToArray as _slicedToArray } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
2
|
+
import React, { forwardRef, useState, useMemo, Children } from 'react';
|
3
|
+
import { cx } from '../../utils/index.js';
|
4
|
+
import { base } from './Accordion.styles.js';
|
5
|
+
import { classes } from './Accordion.tokens.js';
|
6
|
+
import { base as base$1 } from './variations/_view/base.js';
|
7
|
+
import { base as base$2 } from './variations/_size/base.js';
|
8
|
+
import { getChildren } from './utils/index.js';
|
9
|
+
|
10
|
+
var accordionRoot = function accordionRoot(Root) {
|
11
|
+
return /*#__PURE__*/forwardRef(function (_ref, outerRootRef) {
|
12
|
+
var size = _ref.size,
|
13
|
+
view = _ref.view,
|
14
|
+
_ref$stretching = _ref.stretching,
|
15
|
+
stretching = _ref$stretching === void 0 ? 'filled' : _ref$stretching,
|
16
|
+
children = _ref.children,
|
17
|
+
className = _ref.className,
|
18
|
+
once = _ref.once;
|
19
|
+
var stretchingClass = classes["".concat(stretching, "Stretching")];
|
20
|
+
var _useState = useState(),
|
21
|
+
_useState2 = _slicedToArray(_useState, 2),
|
22
|
+
activeIndex = _useState2[0],
|
23
|
+
setActiveIndex = _useState2[1];
|
24
|
+
var updateValue = function updateValue(index, value) {
|
25
|
+
value && setActiveIndex(index);
|
26
|
+
};
|
27
|
+
var childrenArray = useMemo(function () {
|
28
|
+
return Children.toArray(children);
|
29
|
+
}, [children]);
|
30
|
+
var childrenMemo = useMemo(function () {
|
31
|
+
return getChildren(childrenArray, activeIndex, updateValue);
|
32
|
+
}, [activeIndex, updateValue, childrenArray]);
|
33
|
+
return /*#__PURE__*/React.createElement(Root, {
|
34
|
+
ref: outerRootRef,
|
35
|
+
size: size,
|
36
|
+
view: view,
|
37
|
+
className: cx(stretchingClass, classes.accordionRoot, className)
|
38
|
+
}, once ? childrenMemo : children);
|
39
|
+
});
|
40
|
+
};
|
41
|
+
var accordionConfig = {
|
42
|
+
name: 'Accordion',
|
43
|
+
tag: 'div',
|
44
|
+
layout: accordionRoot,
|
45
|
+
base: base,
|
46
|
+
variations: {
|
47
|
+
view: {
|
48
|
+
css: base$1
|
49
|
+
},
|
50
|
+
size: {
|
51
|
+
css: base$2
|
52
|
+
}
|
53
|
+
},
|
54
|
+
defaults: {
|
55
|
+
view: 'default',
|
56
|
+
size: 'm'
|
57
|
+
}
|
58
|
+
};
|
59
|
+
|
60
|
+
export { accordionConfig, accordionRoot };
|
61
|
+
//# sourceMappingURL=Accordion.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Accordion.js","sources":["../../../src/components/Accordion/Accordion.tsx"],"sourcesContent":["import React, { Children, forwardRef, useMemo, 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 ({ size, view, stretching = 'filled', children, className, once }, outerRootRef) => {\n const stretchingClass = classes[`${stretching}Stretching` as keyof typeof classes];\n\n const [activeIndex, setActiveIndex] = useState<number | undefined>();\n\n const updateValue = (index?: number, value?: boolean) => {\n value && setActiveIndex(index);\n };\n\n const childrenArray = useMemo(() => Children.toArray(children), [children]) as React.ReactElement[];\n\n const childrenMemo = useMemo(() => getChildren(childrenArray, activeIndex, updateValue), [\n activeIndex,\n updateValue,\n childrenArray,\n ]);\n\n return (\n <Root\n ref={outerRootRef}\n size={size}\n view={view}\n className={cx(stretchingClass, classes.accordionRoot, className)}\n >\n {once ? childrenMemo : children}\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","children","className","once","stretchingClass","classes","concat","_useState","useState","_useState2","_slicedToArray","activeIndex","setActiveIndex","updateValue","index","value","childrenArray","useMemo","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,EAAmEC,YAAY,EAAK;AAAA,IAAA,IAAjFC,IAAI,GAAAF,IAAA,CAAJE,IAAI;MAAEC,IAAI,GAAAH,IAAA,CAAJG,IAAI;MAAAC,eAAA,GAAAJ,IAAA,CAAEK,UAAU;AAAVA,MAAAA,UAAU,GAAAD,eAAA,KAAG,KAAA,CAAA,GAAA,QAAQ,GAAAA,eAAA;MAAEE,QAAQ,GAAAN,IAAA,CAARM,QAAQ;MAAEC,SAAS,GAAAP,IAAA,CAATO,SAAS;MAAEC,IAAI,GAAAR,IAAA,CAAJQ,IAAI,CAA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G,EAAE,KAAK;AACVC,EAAAA,MAAM,EAAErC,aAAa;AACrBsC,EAAAA,IAAI,EAAJA,IAAI;AACJC,EAAAA,UAAU,EAAE;AACRjC,IAAAA,IAAI,EAAE;AACFkC,MAAAA,GAAG,EAAEC,MAAAA;KACR;AACDpC,IAAAA,IAAI,EAAE;AACFmC,MAAAA,GAAG,EAAEE,MAAAA;AACT,KAAA;GACH;AACDC,EAAAA,QAAQ,EAAE;AACNrC,IAAAA,IAAI,EAAE,SAAS;AACfD,IAAAA,IAAI,EAAE,GAAA;AACV,GAAA;AACJ;;;;"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Accordion.styles.js","sources":["../../../src/components/Accordion/Accordion.styles.ts"],"sourcesContent":["import { css } from '@linaria/core';\n\nimport { classes, tokens } from './Accordion.tokens';\n\nexport const base = css`\n display: flex;\n flex-direction: column;\n gap: var(${tokens.accordionGap});\n align-items: stretch;\n height: auto;\n background: var(${tokens.accordionBackground});\n\n &&.${classes.fixedStretching} {\n width: var(${tokens.accordionWidth});\n }\n &&.${classes.filledStretching} {\n width: 100%;\n }\n`;\n"],"names":["base"],"mappings":"AAIO,IAAMA,IAAI,GAchB;;;;"}
|
@@ -0,0 +1 @@
|
|
1
|
+
.bjv6ypd{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;gap:var(--plasma-accordion-gap);-webkit-align-items:stretch;-webkit-box-align:stretch;-ms-flex-align:stretch;align-items:stretch;height:auto;background:var(--plasma-accordion-background);}.bjv6ypd.bjv6ypd.accordion-stretching-fixed{width:var(--plasma-accordion-width);}.bjv6ypd.bjv6ypd.accordion-stretching-filled{width:100%;}
|
@@ -0,0 +1,39 @@
|
|
1
|
+
var classes = {
|
2
|
+
filledStretching: 'accordion-stretching-filled',
|
3
|
+
fixedStretching: 'accordion-stretching-fixed',
|
4
|
+
accordionRoot: 'accordion-root',
|
5
|
+
accordionItem: 'accordion-item',
|
6
|
+
clearAccordionItem: 'clear-accordion-item',
|
7
|
+
accordionItemShowBody: 'accordion-item-show-body',
|
8
|
+
accordionPlusAnimationElement: 'accordion-plus-animation-element'
|
9
|
+
};
|
10
|
+
var tokens = {
|
11
|
+
accordionGap: '--plasma-accordion-gap',
|
12
|
+
accordionWidth: '--plasma-accordion-width',
|
13
|
+
accordionBackground: '--plasma-accordion-background',
|
14
|
+
accordionItemBackground: '--plasma-accordion-item-background',
|
15
|
+
accordionItemBorderRadius: '--plasma-accordion-item-border-radius',
|
16
|
+
accordionItemPadding: '--plasma-accordion-item-padding',
|
17
|
+
accordionItemPaddingVertical: '--plasma-accordion-item-padding-vertical',
|
18
|
+
accordionItemPaddingHorizontal: '--plasma-accordion-item-padding-horizontal',
|
19
|
+
accordionItemGap: '--plasma-accordion-item-gap',
|
20
|
+
accordionItemFocus: '--plasma-accordion-item-focus',
|
21
|
+
accordionItemBorderBottom: '--plasma-accordion-item-border-bottom',
|
22
|
+
accordionItemTitleColor: '--plasma-accordion-item-title-color',
|
23
|
+
accordionItemTitleFontFamily: '--plasma-accordion-item-title-font-family',
|
24
|
+
accordionItemTitleFontSize: '--plasma-accordion-item-title-font-size',
|
25
|
+
accordionItemTitleFontStyle: '--plasma-accordion-item-title-font-style',
|
26
|
+
accordionItemTitleFontWeight: '--plasma-accordion-item-title-font-weight',
|
27
|
+
accordionItemTitleLetterSpacing: '--plasma-accordion-item-title-letter-spacing',
|
28
|
+
accordionItemTitleLineHeight: '--plasma-accordion-item-title-line-height',
|
29
|
+
accordionItemTextColor: '--plasma-accordion-item-text-color',
|
30
|
+
accordionItemTextFontFamily: '--plasma-accordion-item-text-font-family',
|
31
|
+
accordionItemTextFontSize: '--plasma-accordion-item-text-font-size',
|
32
|
+
accordionItemTextFontStyle: '--plasma-accordion-item-text-font-style',
|
33
|
+
accordionItemTextFontWeight: '--plasma-accordion-item-text-font-weight',
|
34
|
+
accordionItemTextLetterSpacing: '--plasma-accordion-item-text-letter-spacing',
|
35
|
+
accordionItemTextLineHeight: '--plasma-accordion-item-text-line-height'
|
36
|
+
};
|
37
|
+
|
38
|
+
export { classes, tokens };
|
39
|
+
//# sourceMappingURL=Accordion.tokens.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Accordion.tokens.js","sources":["../../../src/components/Accordion/Accordion.tokens.ts"],"sourcesContent":["export const classes = {\n filledStretching: 'accordion-stretching-filled',\n fixedStretching: 'accordion-stretching-fixed',\n accordionRoot: 'accordion-root',\n accordionItem: 'accordion-item',\n clearAccordionItem: 'clear-accordion-item',\n accordionItemShowBody: 'accordion-item-show-body',\n accordionPlusAnimationElement: 'accordion-plus-animation-element',\n};\n\nexport const tokens = {\n accordionGap: '--plasma-accordion-gap',\n accordionWidth: '--plasma-accordion-width',\n accordionBackground: '--plasma-accordion-background',\n\n accordionItemBackground: '--plasma-accordion-item-background',\n accordionItemBorderRadius: '--plasma-accordion-item-border-radius',\n accordionItemPadding: '--plasma-accordion-item-padding',\n accordionItemPaddingVertical: '--plasma-accordion-item-padding-vertical',\n accordionItemPaddingHorizontal: '--plasma-accordion-item-padding-horizontal',\n accordionItemGap: '--plasma-accordion-item-gap',\n accordionItemFocus: '--plasma-accordion-item-focus',\n accordionItemBorderBottom: '--plasma-accordion-item-border-bottom',\n\n accordionItemTitleColor: '--plasma-accordion-item-title-color',\n accordionItemTitleFontFamily: '--plasma-accordion-item-title-font-family',\n accordionItemTitleFontSize: '--plasma-accordion-item-title-font-size',\n accordionItemTitleFontStyle: '--plasma-accordion-item-title-font-style',\n accordionItemTitleFontWeight: '--plasma-accordion-item-title-font-weight',\n accordionItemTitleLetterSpacing: '--plasma-accordion-item-title-letter-spacing',\n accordionItemTitleLineHeight: '--plasma-accordion-item-title-line-height',\n\n accordionItemTextColor: '--plasma-accordion-item-text-color',\n accordionItemTextFontFamily: '--plasma-accordion-item-text-font-family',\n accordionItemTextFontSize: '--plasma-accordion-item-text-font-size',\n accordionItemTextFontStyle: '--plasma-accordion-item-text-font-style',\n accordionItemTextFontWeight: '--plasma-accordion-item-text-font-weight',\n accordionItemTextLetterSpacing: '--plasma-accordion-item-text-letter-spacing',\n accordionItemTextLineHeight: '--plasma-accordion-item-text-line-height',\n};\n"],"names":["classes","filledStretching","fixedStretching","accordionRoot","accordionItem","clearAccordionItem","accordionItemShowBody","accordionPlusAnimationElement","tokens","accordionGap","accordionWidth","accordionBackground","accordionItemBackground","accordionItemBorderRadius","accordionItemPadding","accordionItemPaddingVertical","accordionItemPaddingHorizontal","accordionItemGap","accordionItemFocus","accordionItemBorderBottom","accordionItemTitleColor","accordionItemTitleFontFamily","accordionItemTitleFontSize","accordionItemTitleFontStyle","accordionItemTitleFontWeight","accordionItemTitleLetterSpacing","accordionItemTitleLineHeight","accordionItemTextColor","accordionItemTextFontFamily","accordionItemTextFontSize","accordionItemTextFontStyle","accordionItemTextFontWeight","accordionItemTextLetterSpacing","accordionItemTextLineHeight"],"mappings":"AAAO,IAAMA,OAAO,GAAG;AACnBC,EAAAA,gBAAgB,EAAE,6BAA6B;AAC/CC,EAAAA,eAAe,EAAE,4BAA4B;AAC7CC,EAAAA,aAAa,EAAE,gBAAgB;AAC/BC,EAAAA,aAAa,EAAE,gBAAgB;AAC/BC,EAAAA,kBAAkB,EAAE,sBAAsB;AAC1CC,EAAAA,qBAAqB,EAAE,0BAA0B;AACjDC,EAAAA,6BAA6B,EAAE,kCAAA;AACnC,EAAC;AAEM,IAAMC,MAAM,GAAG;AAClBC,EAAAA,YAAY,EAAE,wBAAwB;AACtCC,EAAAA,cAAc,EAAE,0BAA0B;AAC1CC,EAAAA,mBAAmB,EAAE,+BAA+B;AAEpDC,EAAAA,uBAAuB,EAAE,oCAAoC;AAC7DC,EAAAA,yBAAyB,EAAE,uCAAuC;AAClEC,EAAAA,oBAAoB,EAAE,iCAAiC;AACvDC,EAAAA,4BAA4B,EAAE,0CAA0C;AACxEC,EAAAA,8BAA8B,EAAE,4CAA4C;AAC5EC,EAAAA,gBAAgB,EAAE,6BAA6B;AAC/CC,EAAAA,kBAAkB,EAAE,+BAA+B;AACnDC,EAAAA,yBAAyB,EAAE,uCAAuC;AAElEC,EAAAA,uBAAuB,EAAE,qCAAqC;AAC9DC,EAAAA,4BAA4B,EAAE,2CAA2C;AACzEC,EAAAA,0BAA0B,EAAE,yCAAyC;AACrEC,EAAAA,2BAA2B,EAAE,0CAA0C;AACvEC,EAAAA,4BAA4B,EAAE,2CAA2C;AACzEC,EAAAA,+BAA+B,EAAE,8CAA8C;AAC/EC,EAAAA,4BAA4B,EAAE,2CAA2C;AAEzEC,EAAAA,sBAAsB,EAAE,oCAAoC;AAC5DC,EAAAA,2BAA2B,EAAE,0CAA0C;AACvEC,EAAAA,yBAAyB,EAAE,wCAAwC;AACnEC,EAAAA,0BAA0B,EAAE,yCAAyC;AACrEC,EAAAA,2BAA2B,EAAE,0CAA0C;AACvEC,EAAAA,8BAA8B,EAAE,6CAA6C;AAC7EC,EAAAA,2BAA2B,EAAE,0CAAA;AACjC;;;;"}
|
@@ -0,0 +1,93 @@
|
|
1
|
+
import { slicedToArray as _slicedToArray } from '../../../../_virtual/_rollupPluginBabelHelpers.js';
|
2
|
+
import React, { useState, useRef, useEffect } from 'react';
|
3
|
+
import { convertRoundnessMatrix } from '../../../../utils/roundness.js';
|
4
|
+
import { classes, tokens } from '../../Accordion.tokens.js';
|
5
|
+
import { StyledAccordionItem, StyledAccordionHeader, StyledAccordionHeaderLeft, StyledAccordionContentLeft, StyledAccordionTitle, StyledAccordionContentRight, StyledAccordionBodyAnimate, StyledAccordionBody, StyledArrow, StyledPlus, StyledMinus } from './AccordionItem.styles.js';
|
6
|
+
|
7
|
+
var _StyledMinus, _StyledArrow;
|
8
|
+
var AccordionItem = function AccordionItem(_ref) {
|
9
|
+
var value = _ref.value,
|
10
|
+
contentRight = _ref.contentRight,
|
11
|
+
contentLeft = _ref.contentLeft,
|
12
|
+
title = _ref.title,
|
13
|
+
_ref$pin = _ref.pin,
|
14
|
+
pin = _ref$pin === void 0 ? 'square-square' : _ref$pin,
|
15
|
+
body = _ref.body,
|
16
|
+
_ref$type = _ref.type,
|
17
|
+
type = _ref$type === void 0 ? 'sign' : _ref$type,
|
18
|
+
index = _ref.index,
|
19
|
+
eventKey = _ref.eventKey,
|
20
|
+
updateValue = _ref.updateValue,
|
21
|
+
onChangeValue = _ref.onChangeValue;
|
22
|
+
var _useState = useState(value),
|
23
|
+
_useState2 = _slicedToArray(_useState, 2),
|
24
|
+
show = _useState2[0],
|
25
|
+
setShow = _useState2[1];
|
26
|
+
var _useState3 = useState(),
|
27
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
28
|
+
leftPadding = _useState4[0],
|
29
|
+
setLeftPadding = _useState4[1];
|
30
|
+
var showHandler = function showHandler() {
|
31
|
+
setShow(!show);
|
32
|
+
updateValue && updateValue(index, !show);
|
33
|
+
onChangeValue && onChangeValue(!show, eventKey);
|
34
|
+
};
|
35
|
+
var onKeyPress = function onKeyPress(event) {
|
36
|
+
event.persist();
|
37
|
+
if (event.keyCode === 13) {
|
38
|
+
showHandler();
|
39
|
+
}
|
40
|
+
};
|
41
|
+
var leftContentRef = useRef(null);
|
42
|
+
useEffect(function () {
|
43
|
+
var _leftContentRef$curre, _leftContentRef$curre2;
|
44
|
+
setShow(value);
|
45
|
+
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;
|
46
|
+
var leftPaddingBody = leftContentWidth ? "calc(".concat(leftContentWidth, "px + var(").concat(tokens.accordionItemGap, "))") : 0;
|
47
|
+
setLeftPadding(leftPaddingBody);
|
48
|
+
}, [value, type, leftContentRef, setLeftPadding]);
|
49
|
+
var showedBody = show ? classes.accordionItemShowBody : undefined;
|
50
|
+
var StyledAnimationPLus = function StyledAnimationPLus() {
|
51
|
+
return /*#__PURE__*/React.createElement(StyledPlus, null, _StyledMinus || (_StyledMinus = /*#__PURE__*/React.createElement(StyledMinus, {
|
52
|
+
size: "xs",
|
53
|
+
color: "inhert"
|
54
|
+
})), /*#__PURE__*/React.createElement(StyledMinus, {
|
55
|
+
size: "xs",
|
56
|
+
color: "inhert",
|
57
|
+
className: showedBody !== null && showedBody !== void 0 ? showedBody : classes.accordionPlusAnimationElement
|
58
|
+
}));
|
59
|
+
};
|
60
|
+
var accordionBorderRadius = convertRoundnessMatrix(pin, "var(".concat(tokens.accordionItemBorderRadius, ")"), '1.5rem');
|
61
|
+
var leftContent = contentLeft !== null && contentLeft !== void 0 ? contentLeft : type === 'arrow' ? _StyledArrow || (_StyledArrow = /*#__PURE__*/React.createElement(StyledArrow, {
|
62
|
+
size: "xs",
|
63
|
+
color: "inhert"
|
64
|
+
})) : undefined;
|
65
|
+
var leftContentRotate = type === 'arrow' && show ? classes.accordionItemShowBody : undefined;
|
66
|
+
var rightContent = contentRight !== null && contentRight !== void 0 ? contentRight : type === 'sign' ? /*#__PURE__*/React.createElement(StyledAnimationPLus, null) : undefined;
|
67
|
+
var rightContentRotate = type === 'sign' && show ? classes.accordionItemShowBody : undefined;
|
68
|
+
return /*#__PURE__*/React.createElement(StyledAccordionItem, {
|
69
|
+
role: "tab",
|
70
|
+
className: classes.accordionItem,
|
71
|
+
tabIndex: 0,
|
72
|
+
key: eventKey,
|
73
|
+
style: {
|
74
|
+
borderRadius: accordionBorderRadius
|
75
|
+
},
|
76
|
+
onKeyDown: onKeyPress
|
77
|
+
}, /*#__PURE__*/React.createElement(StyledAccordionHeader, {
|
78
|
+
onClick: showHandler
|
79
|
+
}, /*#__PURE__*/React.createElement(StyledAccordionHeaderLeft, null, leftContent && /*#__PURE__*/React.createElement(StyledAccordionContentLeft, {
|
80
|
+
ref: leftContentRef,
|
81
|
+
className: leftContentRotate
|
82
|
+
}, leftContent), /*#__PURE__*/React.createElement(StyledAccordionTitle, null, title)), /*#__PURE__*/React.createElement(StyledAccordionContentRight, {
|
83
|
+
className: rightContentRotate
|
84
|
+
}, rightContent && rightContent)), /*#__PURE__*/React.createElement(StyledAccordionBodyAnimate, {
|
85
|
+
className: showedBody,
|
86
|
+
style: {
|
87
|
+
paddingLeft: "".concat(leftPadding)
|
88
|
+
}
|
89
|
+
}, /*#__PURE__*/React.createElement(StyledAccordionBody, null, body)));
|
90
|
+
};
|
91
|
+
|
92
|
+
export { AccordionItem };
|
93
|
+
//# sourceMappingURL=AccordionItem.js.map
|
@@ -0,0 +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 body,\n type = 'sign',\n index,\n eventKey,\n updateValue,\n onChangeValue,\n}) => {\n const [show, setShow] = useState(value);\n const [leftPadding, setLeftPadding] = useState<string | number | null>();\n\n const showHandler = () => {\n setShow(!show);\n updateValue && updateValue(index, !show);\n onChangeValue && onChangeValue(!show, eventKey);\n };\n\n const onKeyPress = (event: KeyboardEvent<HTMLDivElement>) => {\n event.persist();\n if (event.keyCode === 13) {\n showHandler();\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 = show ? 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\n const leftContent = contentLeft ?? (type === 'arrow' ? <StyledArrow size=\"xs\" color=\"inhert\" /> : undefined);\n const leftContentRotate = type === 'arrow' && show ? classes.accordionItemShowBody : undefined;\n\n const rightContent = contentRight ?? (type === 'sign' ? <StyledAnimationPLus /> : undefined);\n const rightContentRotate = type === 'sign' && show ? classes.accordionItemShowBody : undefined;\n\n return (\n <StyledAccordionItem\n role=\"tab\"\n className={classes.accordionItem}\n tabIndex={0}\n key={eventKey}\n style={{ borderRadius: accordionBorderRadius }}\n onKeyDown={onKeyPress}\n >\n <StyledAccordionHeader onClick={showHandler}>\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>{body}</StyledAccordionBody>\n </StyledAccordionBodyAnimate>\n </StyledAccordionItem>\n );\n};\n"],"names":["AccordionItem","_ref","value","contentRight","contentLeft","title","_ref$pin","pin","body","_ref$type","type","index","eventKey","updateValue","onChangeValue","_useState","useState","_useState2","_slicedToArray","show","setShow","_useState3","_useState4","leftPadding","setLeftPadding","showHandler","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","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,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,IAAI,GAAAP,IAAA,CAAJO,IAAI;IAAAC,SAAA,GAAAR,IAAA,CACJS,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,WAAW,GAAAZ,IAAA,CAAXY,WAAW;IACXC,aAAa,GAAAb,IAAA,CAAba,aAAa,CAAA;AAEb,EAAA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0BAA0B,EAAA;AAACC,IAAAA,GAAG,EAAE/C,cAAe;AAACwB,IAAAA,SAAS,EAAEQ,iBAAAA;AAAkB,GAAA,EACzEH,WACuB,CAC/B,eACDZ,KAAA,CAAAC,aAAA,CAAC8B,oBAAoB,EAAEzE,IAAAA,EAAAA,KAA4B,CAC5B,CAAC,eAE5B0C,KAAA,CAAAC,aAAA,CAAC+B,2BAA2B,EAAA;AAACzB,IAAAA,SAAS,EAAEU,kBAAAA;GACnCD,EAAAA,YAAY,IAAIA,YACQ,CACV,CAAC,eACxBhB,KAAA,CAAAC,aAAA,CAACgC,0BAA0B,EAAA;AAAC1B,IAAAA,SAAS,EAAEZ,UAAW;AAAC4B,IAAAA,KAAK,EAAE;MAAEW,WAAW,EAAA,EAAA,CAAA1C,MAAA,CAAKhB,WAAW,CAAA;AAAG,KAAA;GACtFwB,eAAAA,KAAA,CAAAC,aAAA,CAACkC,mBAAmB,EAAE1E,IAAAA,EAAAA,IAA0B,CACxB,CACX,CAAC,CAAA;AAE9B;;;;"}
|
@@ -0,0 +1,49 @@
|
|
1
|
+
import styled from 'styled-components';
|
2
|
+
import 'react';
|
3
|
+
import '@linaria/react';
|
4
|
+
import { IconChevronDownFill } from '../../../_Icon/Icons/IconChevronDownFill.js';
|
5
|
+
import { IconMinus } from '../../../_Icon/Icons/IconMinus.js';
|
6
|
+
import { tokens, classes } from '../../Accordion.tokens.js';
|
7
|
+
import { addFocus } from '../../../../mixins/addFocus.js';
|
8
|
+
|
9
|
+
var StyledAccordionItem = /*#__PURE__*/styled.div.withConfig({
|
10
|
+
componentId: "plasma-new-hope__sc-iot32d-0"
|
11
|
+
})(["background:var(", ");border-bottom:var(", ");&:focus{outline:none;}", " &:last-child{border-bottom:none;}"], tokens.accordionItemBackground, tokens.accordionItemBorderBottom, /*#__PURE__*/addFocus({
|
12
|
+
outlineOffset: '0.125rem',
|
13
|
+
outlineSize: '0.125rem',
|
14
|
+
outlineRadius: '0',
|
15
|
+
outlineColor: /*#__PURE__*/"var(".concat(tokens.accordionItemFocus, ")")
|
16
|
+
}));
|
17
|
+
var StyledAccordionHeader = /*#__PURE__*/styled.div.withConfig({
|
18
|
+
componentId: "plasma-new-hope__sc-iot32d-1"
|
19
|
+
})(["padding:var(", ");display:flex;gap:var(", ");justify-content:space-between;align-items:center;cursor:pointer;"], tokens.accordionItemPadding, tokens.accordionItemGap);
|
20
|
+
var StyledAccordionHeaderLeft = /*#__PURE__*/styled.div.withConfig({
|
21
|
+
componentId: "plasma-new-hope__sc-iot32d-2"
|
22
|
+
})(["display:flex;gap:var(", ");justify-content:space-between;align-items:center;"], tokens.accordionItemGap);
|
23
|
+
var StyledAccordionContentRight = /*#__PURE__*/styled.div.withConfig({
|
24
|
+
componentId: "plasma-new-hope__sc-iot32d-3"
|
25
|
+
})(["transition:0.2s;transform:rotate(90deg);&&.", "{transition:0.2s;transform:rotate(0deg);}"], classes.accordionItemShowBody);
|
26
|
+
var StyledAccordionContentLeft = /*#__PURE__*/styled.div.withConfig({
|
27
|
+
componentId: "plasma-new-hope__sc-iot32d-4"
|
28
|
+
})(["transition:0.2s;display:flex;align-items:center;&&.", "{transition:0.2s;transform:rotate(180deg);}"], classes.accordionItemShowBody);
|
29
|
+
var StyledAccordionTitle = /*#__PURE__*/styled.div.withConfig({
|
30
|
+
componentId: "plasma-new-hope__sc-iot32d-5"
|
31
|
+
})(["color:var(", ");font-family:var(", ");font-size:var(", ");font-weight:var(", ");font-style:var(", ");letter-spacing:var(", ");line-height:var(", ");"], tokens.accordionItemTitleColor, tokens.accordionItemTitleFontFamily, tokens.accordionItemTitleFontSize, tokens.accordionItemTitleFontWeight, tokens.accordionItemTitleFontStyle, tokens.accordionItemTitleLetterSpacing, tokens.accordionItemTitleLineHeight);
|
32
|
+
var StyledAccordionBodyAnimate = /*#__PURE__*/styled.div.withConfig({
|
33
|
+
componentId: "plasma-new-hope__sc-iot32d-6"
|
34
|
+
})(["display:grid;grid-template-rows:0fr;transition:grid-template-rows 0.2s ease-out;overflow:hidden;&&.", "{grid-template-rows:1fr;padding-bottom:var(", ");&.", "{transition:0.2s;transform:rotate(0deg);}}"], classes.accordionItemShowBody, tokens.accordionItemPaddingVertical, classes.accordionPlusAnimationElement);
|
35
|
+
var StyledAccordionBody = /*#__PURE__*/styled.div.withConfig({
|
36
|
+
componentId: "plasma-new-hope__sc-iot32d-7"
|
37
|
+
})(["color:var(", ");font-family:var(", ");font-size:var(", ");font-weight:var(", ");font-style:var(", ");letter-spacing:var(", ");line-height:var(", ");overflow:hidden;padding-right:var(", ");padding-left:var(", ");"], tokens.accordionItemTextColor, tokens.accordionItemTextFontFamily, tokens.accordionItemTextFontSize, tokens.accordionItemTextFontWeight, tokens.accordionItemTextFontStyle, tokens.accordionItemTextLetterSpacing, tokens.accordionItemTextLineHeight, tokens.accordionItemPaddingHorizontal, tokens.accordionItemPaddingHorizontal);
|
38
|
+
var StyledArrow = /*#__PURE__*/styled(IconChevronDownFill).withConfig({
|
39
|
+
componentId: "plasma-new-hope__sc-iot32d-8"
|
40
|
+
})(["pointer-events:none;user-select:none;color:var(", ");"], tokens.accordionItemTextColor);
|
41
|
+
var StyledMinus = /*#__PURE__*/styled(IconMinus).withConfig({
|
42
|
+
componentId: "plasma-new-hope__sc-iot32d-9"
|
43
|
+
})(["pointer-events:none;user-select:none;color:var(", ");display:flex;align-items:center;position:absolute;top:0;left:0;&&.", "{transition:0.2s;transform:rotate(90deg);}&&.", "{transition:0.2s;transform:rotate(0deg);}"], tokens.accordionItemTextColor, classes.accordionPlusAnimationElement, classes.accordionItemShowBody);
|
44
|
+
var StyledPlus = /*#__PURE__*/styled.div.withConfig({
|
45
|
+
componentId: "plasma-new-hope__sc-iot32d-10"
|
46
|
+
})(["position:relative;height:1rem;display:flex;align-items:center;justify-content:center;width:1rem;"]);
|
47
|
+
|
48
|
+
export { StyledAccordionBody, StyledAccordionBodyAnimate, StyledAccordionContentLeft, StyledAccordionContentRight, StyledAccordionHeader, StyledAccordionHeaderLeft, StyledAccordionItem, StyledAccordionTitle, StyledArrow, StyledMinus, StyledPlus };
|
49
|
+
//# sourceMappingURL=AccordionItem.styles.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"AccordionItem.styles.js","sources":["../../../../../src/components/Accordion/ui/AccordionItem/AccordionItem.styles.ts"],"sourcesContent":["import styled from 'styled-components';\n\nimport { IconChevronDownFill, IconMinus } from '../../../_Icon';\nimport { classes, tokens } from '../../Accordion.tokens';\nimport { addFocus } from '../../../../mixins';\n\nexport const StyledAccordionItem = styled.div`\n background: var(${tokens.accordionItemBackground});\n border-bottom: var(${tokens.accordionItemBorderBottom});\n &:focus {\n outline: none;\n }\n\n ${addFocus({\n outlineOffset: '0.125rem',\n outlineSize: '0.125rem',\n outlineRadius: '0',\n outlineColor: `var(${tokens.accordionItemFocus})`,\n })}\n\n &:last-child {\n border-bottom: none;\n }\n`;\n\nexport const StyledAccordionHeader = styled.div`\n padding: var(${tokens.accordionItemPadding});\n display: flex;\n gap: var(${tokens.accordionItemGap});\n justify-content: space-between;\n align-items: center;\n cursor: pointer;\n`;\n\nexport const StyledAccordionHeaderLeft = styled.div`\n display: flex;\n gap: var(${tokens.accordionItemGap});\n justify-content: space-between;\n align-items: center;\n`;\n\nexport const StyledAccordionContentRight = styled.div`\n transition: 0.2s;\n transform: rotate(90deg);\n\n &&.${classes.accordionItemShowBody} {\n transition: 0.2s;\n transform: rotate(0deg);\n }\n`;\n\nexport const StyledAccordionContentLeft = styled.div`\n transition: 0.2s;\n display: flex;\n align-items: center;\n\n &&.${classes.accordionItemShowBody} {\n transition: 0.2s;\n transform: rotate(180deg);\n }\n`;\n\nexport const StyledAccordionTitle = styled.div`\n color: var(${tokens.accordionItemTitleColor});\n font-family: var(${tokens.accordionItemTitleFontFamily});\n font-size: var(${tokens.accordionItemTitleFontSize});\n font-weight: var(${tokens.accordionItemTitleFontWeight});\n font-style: var(${tokens.accordionItemTitleFontStyle});\n letter-spacing: var(${tokens.accordionItemTitleLetterSpacing});\n line-height: var(${tokens.accordionItemTitleLineHeight});\n`;\n\nexport const StyledAccordionBodyAnimate = styled.div`\n display: grid;\n grid-template-rows: 0fr;\n transition: grid-template-rows 0.2s ease-out;\n overflow: hidden;\n\n &&.${classes.accordionItemShowBody} {\n grid-template-rows: 1fr;\n padding-bottom: var(${tokens.accordionItemPaddingVertical});\n\n &.${classes.accordionPlusAnimationElement} {\n transition: 0.2s;\n transform: rotate(0deg);\n }\n }\n`;\n\nexport const StyledAccordionBody = styled.div`\n color: var(${tokens.accordionItemTextColor});\n font-family: var(${tokens.accordionItemTextFontFamily});\n font-size: var(${tokens.accordionItemTextFontSize});\n font-weight: var(${tokens.accordionItemTextFontWeight});\n font-style: var(${tokens.accordionItemTextFontStyle});\n letter-spacing: var(${tokens.accordionItemTextLetterSpacing});\n line-height: var(${tokens.accordionItemTextLineHeight});\n overflow: hidden;\n padding-right: var(${tokens.accordionItemPaddingHorizontal});\n padding-left: var(${tokens.accordionItemPaddingHorizontal});\n`;\n\nexport const StyledArrow = styled(IconChevronDownFill)`\n pointer-events: none;\n user-select: none;\n color: var(${tokens.accordionItemTextColor});\n`;\n\nexport const StyledMinus = styled(IconMinus)`\n pointer-events: none;\n user-select: none;\n color: var(${tokens.accordionItemTextColor});\n display: flex;\n align-items: center;\n position: absolute;\n top: 0;\n left: 0;\n\n &&.${classes.accordionPlusAnimationElement} {\n transition: 0.2s;\n transform: rotate(90deg);\n }\n\n &&.${classes.accordionItemShowBody} {\n transition: 0.2s;\n transform: rotate(0deg);\n }\n`;\n\nexport const StyledPlus = styled.div`\n position: relative;\n height: 1rem;\n display: flex;\n align-items: center;\n justify-content: center;\n width: 1rem;\n`;\n"],"names":["StyledAccordionItem","styled","div","withConfig","componentId","tokens","accordionItemBackground","accordionItemBorderBottom","addFocus","outlineOffset","outlineSize","outlineRadius","outlineColor","concat","accordionItemFocus","StyledAccordionHeader","accordionItemPadding","accordionItemGap","StyledAccordionHeaderLeft","StyledAccordionContentRight","classes","accordionItemShowBody","StyledAccordionContentLeft","StyledAccordionTitle","accordionItemTitleColor","accordionItemTitleFontFamily","accordionItemTitleFontSize","accordionItemTitleFontWeight","accordionItemTitleFontStyle","accordionItemTitleLetterSpacing","accordionItemTitleLineHeight","StyledAccordionBodyAnimate","accordionItemPaddingVertical","accordionPlusAnimationElement","StyledAccordionBody","accordionItemTextColor","accordionItemTextFontFamily","accordionItemTextFontSize","accordionItemTextFontWeight","accordionItemTextFontStyle","accordionItemTextLetterSpacing","accordionItemTextLineHeight","accordionItemPaddingHorizontal","StyledArrow","IconChevronDownFill","StyledMinus","IconMinus","StyledPlus"],"mappings":";;;;;;;;IAMaA,mBAAmB,gBAAGC,MAAM,CAACC,GAAG,CAAAC,UAAA,CAAA;EAAAC,WAAA,EAAA,8BAAA;AAAA,CACvBC,CAAAA,CAAAA,CAAAA,iBAAAA,EAAAA,sBAAAA,EAAAA,0BAAAA,EAAAA,oCAAAA,CAAAA,EAAAA,MAAM,CAACC,uBAAuB,EAC3BD,MAAM,CAACE,yBAAyB,eAKnDC,QAAQ,CAAC;AACPC,EAAAA,aAAa,EAAE,UAAU;AACzBC,EAAAA,WAAW,EAAE,UAAU;AACvBC,EAAAA,aAAa,EAAE,GAAG;AAClBC,EAAAA,YAAY,eAAAC,MAAAA,CAAAA,MAAA,CAASR,MAAM,CAACS,kBAAkB,EAAA,GAAA,CAAA;AAClD,CAAC,CAAC,EAKL;IAEYC,qBAAqB,gBAAGd,MAAM,CAACC,GAAG,CAAAC,UAAA,CAAA;EAAAC,WAAA,EAAA,8BAAA;AAAA,CAAA,CAAA,CAAA,CAAA,cAAA,EAAA,yBAAA,EAAA,oEAAA,CAAA,EAC5BC,MAAM,CAACW,oBAAoB,EAE/BX,MAAM,CAACY,gBAAgB,EAIrC;IAEYC,yBAAyB,gBAAGjB,MAAM,CAACC,GAAG,CAAAC,UAAA,CAAA;EAAAC,WAAA,EAAA,8BAAA;AAAA,CAEpCC,CAAAA,CAAAA,CAAAA,uBA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= function updatePropsRecursively(children, activeIndex, updateValue) {
|
4
|
+
return Children.map(children || [], function (child, index) {
|
5
|
+
if (! /*#__PURE__*/isValidElement(child)) {
|
6
|
+
return child;
|
7
|
+
}
|
8
|
+
var props = {
|
9
|
+
index: index,
|
10
|
+
value: activeIndex === index,
|
11
|
+
updateValue: updateValue
|
12
|
+
};
|
13
|
+
return /*#__PURE__*/cloneElement(child, props);
|
14
|
+
});
|
15
|
+
};
|
16
|
+
var getChildren = function getChildren(children, activeIndex, updateValue) {
|
17
|
+
return updatePropsRecursively(children, activeIndex, updateValue);
|
18
|
+
};
|
19
|
+
|
20
|
+
export { getChildren, updatePropsRecursively };
|
21
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/Accordion/utils/index.ts"],"sourcesContent":["import { Children, ReactElement, ReactNode, cloneElement, isValidElement } from 'react';\n\nimport { AccordionItemProps } from '../ui/AccordionItem/AccordionItem.types';\n\nexport const updatePropsRecursively = (\n children?: ReactElement<AccordionItemProps>[],\n activeIndex?: number,\n updateValue?: (index?: number, value?: boolean) => void,\n): ReactNode[] =>\n Children.map(children || [], (child, index) => {\n if (!isValidElement(child)) {\n return child;\n }\n\n const props = {\n index,\n value: activeIndex === index,\n updateValue,\n };\n\n return cloneElement(child, props);\n });\n\nexport const getChildren = (\n children: ReactElement<AccordionItemProps>[],\n activeIndex?: number,\n updateValue?: (index?: number, value?: boolean) => void,\n) => {\n return updatePropsRecursively(children, activeIndex, updateValue);\n};\n"],"names":["updatePropsRecursively","children","activeIndex","updateValue","Children","map","child","index","isValidElement","props","value","cloneElement","getChildren"],"mappings":";;AAIO,IAAMA,sBAAsB,GAAG,SAAzBA,sBAAsBA,CAC/BC,QAA6C,EAC7CC,WAAoB,EACpBC,WAAuD,EAAA;AAAA,EAAA,OAEvDC,QAAQ,CAACC,GAAG,CAACJ,QAAQ,IAAI,EAAE,EAAE,UAACK,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,EAAER,WAAW,KAAKK,KAAK;AAC5BJ,MAAAA,WAAW,EAAXA,WAAAA;KACH,CAAA;AAED,IAAA,oBAAOQ,YAAY,CAACL,KAAK,EAAEG,KAAK,CAAC,CAAA;AACrC,GAAC,CAAC,CAAA;AAAA,EAAA;AAEC,IAAMG,WAAW,GAAG,SAAdA,WAAWA,CACpBX,QAA4C,EAC5CC,WAAoB,EACpBC,WAAuD,EACtD;AACD,EAAA,OAAOH,sBAAsB,CAACC,QAAQ,EAAEC,WAAW,EAAEC,WAAW,CAAC,CAAA;AACrE;;;;"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"base.js","sources":["../../../../../src/components/Accordion/variations/_size/base.ts"],"sourcesContent":["import { css } from '@linaria/core';\n\nexport const base = css``;\n"],"names":["base"],"mappings":"AAEO,IAAMA,IAAI,GAAQ;;;;"}
|
@@ -0,0 +1 @@
|
|
1
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"base.js","sources":["../../../../../src/components/Accordion/variations/_view/base.ts"],"sourcesContent":["import { css } from '@linaria/core';\n\nexport const base = css``;\n"],"names":["base"],"mappings":"AAEO,IAAMA,IAAI,GAAQ;;;;"}
|
@@ -0,0 +1 @@
|
|
1
|
+
|
@@ -0,0 +1,29 @@
|
|
1
|
+
import { extends as _extends } from '../../../_virtual/_rollupPluginBabelHelpers.js';
|
2
|
+
import React from 'react';
|
3
|
+
|
4
|
+
var _defs, _g;
|
5
|
+
var ChevronDownFill = function ChevronDownFill(props) {
|
6
|
+
return /*#__PURE__*/React.createElement("svg", _extends({
|
7
|
+
width: "100%",
|
8
|
+
viewBox: "0 0 16 16",
|
9
|
+
fill: "none"
|
10
|
+
}, props), _defs || (_defs = /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("clipPath", {
|
11
|
+
id: "clip3066_154194"
|
12
|
+
}, /*#__PURE__*/React.createElement("rect", {
|
13
|
+
width: "16.000000",
|
14
|
+
height: "16.000000",
|
15
|
+
fill: "currentColor",
|
16
|
+
fillOpacity: "0"
|
17
|
+
})))), _g || (_g = /*#__PURE__*/React.createElement("g", {
|
18
|
+
clipPath: "url(#clip3066_154194)"
|
19
|
+
}, /*#__PURE__*/React.createElement("path", {
|
20
|
+
id: "path",
|
21
|
+
d: "M11.45 5.79C11.37 5.61 11.19 5.5 11 5.5L5 5.5C4.8 5.5 4.62 5.61 4.54 5.79C4.46 5.96 4.49 6.17 4.62 6.32L7.62 9.82C7.71 9.93 7.85 10 8 10C8.14 10 8.28 9.93 8.37 9.82L11.37 6.32C11.5 6.17 11.53 5.96 11.45 5.79Z",
|
22
|
+
fillRule: "evenodd",
|
23
|
+
fill: "currentColor",
|
24
|
+
clipRule: "evenodd"
|
25
|
+
}))));
|
26
|
+
};
|
27
|
+
|
28
|
+
export { ChevronDownFill };
|
29
|
+
//# sourceMappingURL=ChevronDownFill.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"ChevronDownFill.js","sources":["../../../../src/components/_Icon/Icon.assets/ChevronDownFill.tsx"],"sourcesContent":["import React from 'react';\n\nimport { IconProps } from '../IconRoot';\n\nexport const ChevronDownFill: React.FC<IconProps> = (props) => (\n <svg width=\"100%\" viewBox=\"0 0 16 16\" fill=\"none\" {...props}>\n <defs>\n <clipPath id=\"clip3066_154194\">\n <rect width=\"16.000000\" height=\"16.000000\" fill=\"currentColor\" fillOpacity=\"0\" />\n </clipPath>\n </defs>\n <g clipPath=\"url(#clip3066_154194)\">\n <path\n id=\"path\"\n d=\"M11.45 5.79C11.37 5.61 11.19 5.5 11 5.5L5 5.5C4.8 5.5 4.62 5.61 4.54 5.79C4.46 5.96 4.49 6.17 4.62 6.32L7.62 9.82C7.71 9.93 7.85 10 8 10C8.14 10 8.28 9.93 8.37 9.82L11.37 6.32C11.5 6.17 11.53 5.96 11.45 5.79Z\"\n fillRule=\"evenodd\"\n fill=\"currentColor\"\n clipRule=\"evenodd\"\n />\n </g>\n </svg>\n);\n"],"names":["ChevronDownFill","props","React","createElement","_extends","width","viewBox","fill","_defs","id","height","fillOpacity","_g","clipPath","d","fillRule","clipRule"],"mappings":";;;;IAIaA,eAAoC,GAAG,SAAvCA,eAAoCA,CAAIC,KAAK,EAAA;AAAA,EAAA,oBACtDC,KAAA,CAAAC,aAAA,CAAA,KAAA,EAAAC,QAAA,CAAA;AAAKC,IAAAA,KAAK,EAAC,MAAM;AAACC,IAAAA,OAAO,EAAC,WAAW;AAACC,IAAAA,IAAI,EAAC,MAAA;AAAM,GAAA,EAAKN,KAAK,CAAA,EAAAO,KAAA,KAAAA,KAAA,gBACvDN,KAAA,CAAAC,aAAA,CAAA,MAAA,EAAA,IAAA,eACID,KAAA,CAAAC,aAAA,CAAA,UAAA,EAAA;AAAUM,IAAAA,EAAE,EAAC,iBAAA;GACTP,eAAAA,KAAA,CAAAC,aAAA,CAAA,MAAA,EAAA;AAAME,IAAAA,KAAK,EAAC,WAAW;AAACK,IAAAA,MAAM,EAAC,WAAW;AAACH,IAAAA,IAAI,EAAC,cAAc;AAACI,IAAAA,WAAW,EAAC,GAAA;GAAK,CAC1E,CACR,CAAC,CAAAC,EAAAA,EAAA,KAAAA,EAAA,gBACPV,KAAA,CAAAC,aAAA,CAAA,GAAA,EAAA;AAAGU,IAAAA,QAAQ,EAAC,uBAAA;GACRX,eAAAA,KAAA,CAAAC,aAAA,CAAA,MAAA,EAAA;AACIM,IAAAA,EAAE,EAAC,MAAM;AACTK,IAAAA,CAAC,EAAC,kNAAkN;AACpNC,IAAAA,QAAQ,EAAC,SAAS;AAClBR,IAAAA,IAAI,EAAC,cAAc;AACnBS,IAAAA,QAAQ,EAAC,SAAA;GACZ,CACF,CAAC,CACH,CAAC,CAAA;AAAA;;;;"}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import { extends as _extends } from '../../../_virtual/_rollupPluginBabelHelpers.js';
|
2
|
+
import React from 'react';
|
3
|
+
|
4
|
+
var _path;
|
5
|
+
var Minus = function Minus(props) {
|
6
|
+
return /*#__PURE__*/React.createElement("svg", _extends({
|
7
|
+
width: "100%",
|
8
|
+
viewBox: "0 0 24 24",
|
9
|
+
fill: "none"
|
10
|
+
}, props), _path || (_path = /*#__PURE__*/React.createElement("path", {
|
11
|
+
id: "icon",
|
12
|
+
d: "M3.25 12C3.25 11.58 3.58 11.25 4 11.25L20 11.25C20.41 11.25 20.75 11.58 20.75 12C20.75 12.41 20.41 12.75 20 12.75L4 12.75C3.58 12.75 3.25 12.41 3.25 12Z",
|
13
|
+
fill: "currentColor"
|
14
|
+
})));
|
15
|
+
};
|
16
|
+
|
17
|
+
export { Minus };
|
18
|
+
//# sourceMappingURL=Minus.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Minus.js","sources":["../../../../src/components/_Icon/Icon.assets/Minus.tsx"],"sourcesContent":["import React from 'react';\n\nimport { IconProps } from '../IconRoot';\n\nexport const Minus: React.FC<IconProps> = (props) => (\n <svg width=\"100%\" viewBox=\"0 0 24 24\" fill=\"none\" {...props}>\n <path\n id=\"icon\"\n d=\"M3.25 12C3.25 11.58 3.58 11.25 4 11.25L20 11.25C20.41 11.25 20.75 11.58 20.75 12C20.75 12.41 20.41 12.75 20 12.75L4 12.75C3.58 12.75 3.25 12.41 3.25 12Z\"\n fill=\"currentColor\"\n />\n </svg>\n);\n"],"names":["Minus","props","React","createElement","_extends","width","viewBox","fill","_path","id","d"],"mappings":";;;;IAIaA,KAA0B,GAAG,SAA7BA,KAA0BA,CAAIC,KAAK,EAAA;AAAA,EAAA,oBAC5CC,KAAA,CAAAC,aAAA,CAAA,KAAA,EAAAC,QAAA,CAAA;AAAKC,IAAAA,KAAK,EAAC,MAAM;AAACC,IAAAA,OAAO,EAAC,WAAW;AAACC,IAAAA,IAAI,EAAC,MAAA;GAAWN,EAAAA,KAAK,GAAAO,KAAA,KAAAA,KAAA,gBACvDN,KAAA,CAAAC,aAAA,CAAA,MAAA,EAAA;AACIM,IAAAA,EAAE,EAAC,MAAM;AACTC,IAAAA,CAAC,EAAC,0JAA0J;AAC5JH,IAAAA,IAAI,EAAC,cAAA;GACR,CAAC,CACD,CAAC,CAAA;AAAA;;;;"}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { ChevronDownFill } from '../Icon.assets/ChevronDownFill.js';
|
3
|
+
import { IconRoot } from '../IconRoot.js';
|
4
|
+
|
5
|
+
var IconChevronDownFill = function IconChevronDownFill(_ref) {
|
6
|
+
var _ref$size = _ref.size,
|
7
|
+
size = _ref$size === void 0 ? 'xs' : _ref$size,
|
8
|
+
color = _ref.color,
|
9
|
+
className = _ref.className;
|
10
|
+
return /*#__PURE__*/React.createElement(IconRoot, {
|
11
|
+
className: className,
|
12
|
+
size: size,
|
13
|
+
color: color,
|
14
|
+
icon: ChevronDownFill
|
15
|
+
});
|
16
|
+
};
|
17
|
+
|
18
|
+
export { IconChevronDownFill };
|
19
|
+
//# sourceMappingURL=IconChevronDownFill.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"IconChevronDownFill.js","sources":["../../../../src/components/_Icon/Icons/IconChevronDownFill.tsx"],"sourcesContent":["import React from 'react';\n\nimport { ChevronDownFill } from '../Icon.assets/ChevronDownFill';\nimport { IconRoot, IconProps } from '../IconRoot';\n\nexport const IconChevronDownFill: React.FC<IconProps> = ({ size = 'xs', color, className }) => {\n return <IconRoot className={className} size={size} color={color} icon={ChevronDownFill} />;\n};\n"],"names":["IconChevronDownFill","_ref","_ref$size","size","color","className","React","createElement","IconRoot","icon","ChevronDownFill"],"mappings":";;;;IAKaA,mBAAwC,GAAG,SAA3CA,mBAAwCA,CAAAC,IAAA,EAA0C;AAAA,EAAA,IAAAC,SAAA,GAAAD,IAAA,CAApCE,IAAI;AAAJA,IAAAA,IAAI,GAAAD,SAAA,KAAG,KAAA,CAAA,GAAA,IAAI,GAAAA,SAAA;IAAEE,KAAK,GAAAH,IAAA,CAALG,KAAK;IAAEC,SAAS,GAAAJ,IAAA,CAATI,SAAS,CAAA;AACpF,EAAA,oBAAOC,KAAA,CAAAC,aAAA,CAACC,QAAQ,EAAA;AAACH,IAAAA,SAAS,EAAEA,SAAU;AAACF,IAAAA,IAAI,EAAEA,IAAK;AAACC,IAAAA,KAAK,EAAEA,KAAM;AAACK,IAAAA,IAAI,EAAEC,eAAAA;AAAgB,GAAE,CAAC,CAAA;AAC9F;;;;"}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { Minus } from '../Icon.assets/Minus.js';
|
3
|
+
import { IconRoot } from '../IconRoot.js';
|
4
|
+
|
5
|
+
var IconMinus = function IconMinus(_ref) {
|
6
|
+
var _ref$size = _ref.size,
|
7
|
+
size = _ref$size === void 0 ? 's' : _ref$size,
|
8
|
+
color = _ref.color,
|
9
|
+
className = _ref.className;
|
10
|
+
return /*#__PURE__*/React.createElement(IconRoot, {
|
11
|
+
className: className,
|
12
|
+
size: size,
|
13
|
+
color: color,
|
14
|
+
icon: Minus
|
15
|
+
});
|
16
|
+
};
|
17
|
+
|
18
|
+
export { IconMinus };
|
19
|
+
//# sourceMappingURL=IconMinus.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"IconMinus.js","sources":["../../../../src/components/_Icon/Icons/IconMinus.tsx"],"sourcesContent":["import React from 'react';\n\nimport { Minus } from '../Icon.assets/Minus';\nimport { IconRoot, IconProps } from '../IconRoot';\n\nexport const IconMinus: React.FC<IconProps> = ({ size = 's', color, className }) => {\n return <IconRoot className={className} size={size} color={color} icon={Minus} />;\n};\n"],"names":["IconMinus","_ref","_ref$size","size","color","className","React","createElement","IconRoot","icon","Minus"],"mappings":";;;;IAKaA,SAA8B,GAAG,SAAjCA,SAA8BA,CAAAC,IAAA,EAAyC;AAAA,EAAA,IAAAC,SAAA,GAAAD,IAAA,CAAnCE,IAAI;AAAJA,IAAAA,IAAI,GAAAD,SAAA,KAAG,KAAA,CAAA,GAAA,GAAG,GAAAA,SAAA;IAAEE,KAAK,GAAAH,IAAA,CAALG,KAAK;IAAEC,SAAS,GAAAJ,IAAA,CAATI,SAAS,CAAA;AACzE,EAAA,oBAAOC,KAAA,CAAAC,aAAA,CAACC,QAAQ,EAAA;AAACH,IAAAA,SAAS,EAAEA,SAAU;AAACF,IAAAA,IAAI,EAAEA,IAAK;AAACC,IAAAA,KAAK,EAAEA,KAAM;AAACK,IAAAA,IAAI,EAAEC,KAAAA;AAAM,GAAE,CAAC,CAAA;AACpF;;;;"}
|
package/es/index.css
CHANGED
@@ -579,3 +579,5 @@
|
|
579
579
|
|
580
580
|
|
581
581
|
|
582
|
+
|
583
|
+
.Accordion_styles_1mo1sxr_bjv6ypd__b7c4430d{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;gap:var(--plasma-accordion-gap);-webkit-align-items:stretch;-webkit-box-align:stretch;-ms-flex-align:stretch;align-items:stretch;height:auto;background:var(--plasma-accordion-background);}.Accordion_styles_1mo1sxr_bjv6ypd__b7c4430d.Accordion_styles_1mo1sxr_bjv6ypd__b7c4430d.Accordion_styles_1mo1sxr_accordionStretchingFixed__b7c4430d{width:var(--plasma-accordion-width);}.Accordion_styles_1mo1sxr_bjv6ypd__b7c4430d.Accordion_styles_1mo1sxr_bjv6ypd__b7c4430d.Accordion_styles_1mo1sxr_accordionStretchingFilled__b7c4430d{width:100%;}
|
package/es/index.js
CHANGED
@@ -175,6 +175,9 @@ export { ThumbBase } from './components/Slider/ui/Thumb/Thumb.styles.js';
|
|
175
175
|
import '@linaria/react';
|
176
176
|
export { rangeConfig, rangeRoot } from './components/Range/Range.js';
|
177
177
|
export { tokens as rangeTokens } from './components/Range/Range.tokens.js';
|
178
|
+
export { accordionConfig, accordionRoot } from './components/Accordion/Accordion.js';
|
179
|
+
export { AccordionItem } from './components/Accordion/ui/AccordionItem/AccordionItem.js';
|
180
|
+
export { classes as accordionClasses, tokens as accordionTokens } from './components/Accordion/Accordion.tokens.js';
|
178
181
|
export { component, mergeConfig } from './engines/common.js';
|
179
182
|
export { canUseDOM } from './utils/canUseDOM.js';
|
180
183
|
export { extractTextFrom } from './utils/extractTextFrom.js';
|
package/es/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@salutejs/plasma-new-hope",
|
3
|
-
"version": "0.88.0-canary.1223.
|
3
|
+
"version": "0.88.0-canary.1223.9380263327.0",
|
4
4
|
"description": "Salute Design System blueprint",
|
5
5
|
"main": "cjs/index.js",
|
6
6
|
"module": "es/index.js",
|
@@ -103,5 +103,5 @@
|
|
103
103
|
"react-popper": "2.3.0",
|
104
104
|
"storeon": "3.1.5"
|
105
105
|
},
|
106
|
-
"gitHead": "
|
106
|
+
"gitHead": "ba05c0e33339ad85bf631698835c95e5b87098dc"
|
107
107
|
}
|
@@ -11,8 +11,15 @@ var _Accordion = /*#__PURE__*/require("./Accordion.styles");
|
|
11
11
|
var _Accordion2 = /*#__PURE__*/require("./Accordion.tokens");
|
12
12
|
var _base = /*#__PURE__*/require("./variations/_view/base");
|
13
13
|
var _base2 = /*#__PURE__*/require("./variations/_size/base");
|
14
|
+
var _utils2 = /*#__PURE__*/require("./utils");
|
14
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); }
|
15
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 _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
18
|
+
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
|
+
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); }
|
20
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
21
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
22
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
16
23
|
var accordionRoot = exports.accordionRoot = function accordionRoot(Root) {
|
17
24
|
return /*#__PURE__*/(0, _react.forwardRef)(function (_ref, outerRootRef) {
|
18
25
|
var size = _ref.size,
|
@@ -20,14 +27,28 @@ var accordionRoot = exports.accordionRoot = function accordionRoot(Root) {
|
|
20
27
|
_ref$stretching = _ref.stretching,
|
21
28
|
stretching = _ref$stretching === void 0 ? 'filled' : _ref$stretching,
|
22
29
|
children = _ref.children,
|
23
|
-
className = _ref.className
|
30
|
+
className = _ref.className,
|
31
|
+
once = _ref.once;
|
24
32
|
var stretchingClass = _Accordion2.classes["".concat(stretching, "Stretching")];
|
33
|
+
var _useState = (0, _react.useState)(),
|
34
|
+
_useState2 = _slicedToArray(_useState, 2),
|
35
|
+
activeIndex = _useState2[0],
|
36
|
+
setActiveIndex = _useState2[1];
|
37
|
+
var updateValue = function updateValue(index, value) {
|
38
|
+
value && setActiveIndex(index);
|
39
|
+
};
|
40
|
+
var childrenArray = (0, _react.useMemo)(function () {
|
41
|
+
return _react.Children.toArray(children);
|
42
|
+
}, [children]);
|
43
|
+
var childrenMemo = (0, _react.useMemo)(function () {
|
44
|
+
return (0, _utils2.getChildren)(childrenArray, activeIndex, updateValue);
|
45
|
+
}, [activeIndex, updateValue, childrenArray]);
|
25
46
|
return /*#__PURE__*/_react["default"].createElement(Root, {
|
26
47
|
ref: outerRootRef,
|
27
48
|
size: size,
|
28
49
|
view: view,
|
29
50
|
className: (0, _utils.cx)(stretchingClass, _Accordion2.classes.accordionRoot, className)
|
30
|
-
}, children);
|
51
|
+
}, once ? childrenMemo : children);
|
31
52
|
});
|
32
53
|
};
|
33
54
|
var accordionConfig = exports.accordionConfig = {
|