@salutejs/plasma-new-hope 0.88.0-canary.1252.9517095860.0 → 0.88.0-canary.1254.9538803694.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 +81 -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_rsiff6.css +1 -0
- package/cjs/components/Accordion/Accordion.tokens.js +45 -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 +30 -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/Segment/SegmentProvider/SegmentProvider.js +1 -4
- package/cjs/components/Segment/SegmentProvider/SegmentProvider.js.map +1 -1
- package/cjs/components/Segment/ui/SegmentGroup/SegmentGroup.js +2 -9
- package/cjs/components/Segment/ui/SegmentGroup/SegmentGroup.js.map +1 -1
- package/cjs/components/_Icon/Icon.assets/ChevronDownFill.js +24 -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 +76 -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_rsiff6.css +1 -0
- package/es/components/Accordion/Accordion.tokens.js +40 -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 +25 -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/Segment/SegmentProvider/SegmentProvider.js +1 -4
- package/es/components/Segment/SegmentProvider/SegmentProvider.js.map +1 -1
- package/es/components/Segment/ui/SegmentGroup/SegmentGroup.js +2 -9
- package/es/components/Segment/ui/SegmentGroup/SegmentGroup.js.map +1 -1
- package/es/components/_Icon/Icon.assets/ChevronDownFill.js +20 -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 +90 -0
- package/styled-components/cjs/components/Accordion/Accordion.styles.js +9 -0
- package/styled-components/cjs/components/Accordion/Accordion.tokens.js +43 -0
- package/styled-components/cjs/components/Accordion/Accordion.types.js +5 -0
- package/styled-components/cjs/components/Accordion/index.js +38 -0
- package/styled-components/cjs/components/Accordion/ui/AccordionItem/AccordionItem.js +103 -0
- package/styled-components/cjs/components/Accordion/ui/AccordionItem/AccordionItem.styles.js +49 -0
- package/styled-components/cjs/components/Accordion/ui/AccordionItem/AccordionItem.types.js +5 -0
- package/styled-components/cjs/components/Accordion/utils/index.js +27 -0
- package/styled-components/cjs/components/Accordion/variations/_size/base.js +8 -0
- package/styled-components/cjs/components/Accordion/variations/_size/tokens.json +6 -0
- package/styled-components/cjs/components/Accordion/variations/_stretching/base.js +8 -0
- package/styled-components/cjs/components/Accordion/variations/_stretching/tokens.json +1 -0
- package/styled-components/cjs/components/Accordion/variations/_view/base.js +8 -0
- package/styled-components/cjs/components/Accordion/variations/_view/tokens.json +8 -0
- package/styled-components/cjs/components/Segment/Segment.template-doc.mdx +1 -6
- package/styled-components/cjs/components/Segment/SegmentProvider/SegmentProvider.js +1 -4
- package/styled-components/cjs/components/Segment/ui/SegmentGroup/SegmentGroup.js +2 -9
- package/styled-components/cjs/components/_Icon/Icon.assets/ChevronDownFill.js +23 -0
- package/styled-components/cjs/components/_Icon/Icon.assets/Minus.js +21 -0
- package/styled-components/cjs/components/_Icon/Icons/IconChevronDownFill.js +22 -0
- package/styled-components/cjs/components/_Icon/Icons/IconMinus.js +22 -0
- package/styled-components/cjs/components/_Icon/index.js +15 -1
- package/styled-components/cjs/examples/plasma_b2c/components/Accordion/Accordion.config.js +26 -0
- package/styled-components/cjs/examples/plasma_b2c/components/Accordion/Accordion.js +17 -0
- package/styled-components/cjs/examples/plasma_b2c/components/Accordion/Accordion.stories.tsx +66 -0
- package/styled-components/cjs/examples/plasma_web/components/Accordion/Accordion.config.js +30 -0
- package/styled-components/cjs/examples/plasma_web/components/Accordion/Accordion.js +17 -0
- package/styled-components/cjs/examples/plasma_web/components/Accordion/Accordion.stories.tsx +65 -0
- package/styled-components/cjs/index.js +11 -0
- package/styled-components/es/components/Accordion/Accordion.js +81 -0
- package/styled-components/es/components/Accordion/Accordion.styles.js +3 -0
- package/styled-components/es/components/Accordion/Accordion.tokens.js +37 -0
- package/styled-components/es/components/Accordion/Accordion.types.js +1 -0
- package/styled-components/es/components/Accordion/index.js +3 -0
- package/styled-components/es/components/Accordion/ui/AccordionItem/AccordionItem.js +94 -0
- package/styled-components/es/components/Accordion/ui/AccordionItem/AccordionItem.styles.js +42 -0
- package/styled-components/es/components/Accordion/ui/AccordionItem/AccordionItem.types.js +1 -0
- package/styled-components/es/components/Accordion/utils/index.js +21 -0
- package/styled-components/es/components/Accordion/variations/_size/base.js +2 -0
- package/styled-components/es/components/Accordion/variations/_size/tokens.json +6 -0
- package/styled-components/es/components/Accordion/variations/_stretching/base.js +2 -0
- package/styled-components/es/components/Accordion/variations/_stretching/tokens.json +1 -0
- package/styled-components/es/components/Accordion/variations/_view/base.js +2 -0
- package/styled-components/es/components/Accordion/variations/_view/tokens.json +8 -0
- package/styled-components/es/components/Segment/Segment.template-doc.mdx +1 -6
- package/styled-components/es/components/Segment/SegmentProvider/SegmentProvider.js +1 -4
- package/styled-components/es/components/Segment/ui/SegmentGroup/SegmentGroup.js +2 -9
- package/styled-components/es/components/_Icon/Icon.assets/ChevronDownFill.js +16 -0
- package/styled-components/es/components/_Icon/Icon.assets/Minus.js +14 -0
- package/styled-components/es/components/_Icon/Icons/IconChevronDownFill.js +15 -0
- package/styled-components/es/components/_Icon/Icons/IconMinus.js +15 -0
- package/styled-components/es/components/_Icon/index.js +3 -1
- package/styled-components/es/examples/plasma_b2c/components/Accordion/Accordion.config.js +20 -0
- package/styled-components/es/examples/plasma_b2c/components/Accordion/Accordion.js +6 -0
- package/styled-components/es/examples/plasma_b2c/components/Accordion/Accordion.stories.tsx +66 -0
- package/styled-components/es/examples/plasma_web/components/Accordion/Accordion.config.js +24 -0
- package/styled-components/es/examples/plasma_web/components/Accordion/Accordion.js +6 -0
- package/styled-components/es/examples/plasma_web/components/Accordion/Accordion.stories.tsx +65 -0
- package/styled-components/es/index.js +2 -1
- package/types/components/Accordion/Accordion.d.ts +43 -0
- package/types/components/Accordion/Accordion.d.ts.map +1 -0
- package/types/components/Accordion/Accordion.styles.d.ts +2 -0
- package/types/components/Accordion/Accordion.styles.d.ts.map +1 -0
- package/types/components/Accordion/Accordion.tokens.d.ts +38 -0
- package/types/components/Accordion/Accordion.tokens.d.ts.map +1 -0
- package/types/components/Accordion/Accordion.types.d.ts +36 -0
- package/types/components/Accordion/Accordion.types.d.ts.map +1 -0
- package/types/components/Accordion/index.d.ts +5 -0
- package/types/components/Accordion/index.d.ts.map +1 -0
- package/types/components/Accordion/ui/AccordionItem/AccordionItem.d.ts +4 -0
- package/types/components/Accordion/ui/AccordionItem/AccordionItem.d.ts.map +1 -0
- package/types/components/Accordion/ui/AccordionItem/AccordionItem.styles.d.ts +13 -0
- package/types/components/Accordion/ui/AccordionItem/AccordionItem.styles.d.ts.map +1 -0
- package/types/components/Accordion/ui/AccordionItem/AccordionItem.types.d.ts +51 -0
- package/types/components/Accordion/ui/AccordionItem/AccordionItem.types.d.ts.map +1 -0
- package/types/components/Accordion/utils/index.d.ts +17 -0
- package/types/components/Accordion/utils/index.d.ts.map +1 -0
- package/types/components/Accordion/variations/_size/base.d.ts +2 -0
- package/types/components/Accordion/variations/_size/base.d.ts.map +1 -0
- package/types/components/Accordion/variations/_stretching/base.d.ts +2 -0
- package/types/components/Accordion/variations/_stretching/base.d.ts.map +1 -0
- package/types/components/Accordion/variations/_view/base.d.ts +2 -0
- package/types/components/Accordion/variations/_view/base.d.ts.map +1 -0
- package/types/components/Segment/SegmentProvider/SegmentProvider.d.ts.map +1 -1
- package/types/components/Segment/SegmentProvider/SegmentProvider.types.d.ts +3 -4
- package/types/components/Segment/SegmentProvider/SegmentProvider.types.d.ts.map +1 -1
- package/types/components/Segment/ui/SegmentGroup/SegmentGroup.d.ts +0 -2
- package/types/components/Segment/ui/SegmentGroup/SegmentGroup.d.ts.map +1 -1
- package/types/components/Segment/ui/SegmentGroup/SegmentGroup.types.d.ts +0 -5
- package/types/components/Segment/ui/SegmentGroup/SegmentGroup.types.d.ts.map +1 -1
- package/types/components/_Icon/Icon.assets/ChevronDownFill.d.ts +4 -0
- package/types/components/_Icon/Icon.assets/ChevronDownFill.d.ts.map +1 -0
- package/types/components/_Icon/Icon.assets/Minus.d.ts +4 -0
- package/types/components/_Icon/Icon.assets/Minus.d.ts.map +1 -0
- package/types/components/_Icon/Icons/IconChevronDownFill.d.ts +4 -0
- package/types/components/_Icon/Icons/IconChevronDownFill.d.ts.map +1 -0
- package/types/components/_Icon/Icons/IconMinus.d.ts +4 -0
- package/types/components/_Icon/Icons/IconMinus.d.ts.map +1 -0
- package/types/components/_Icon/index.d.ts +2 -0
- package/types/components/_Icon/index.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/Accordion/Accordion.config.d.ts +19 -0
- package/types/examples/plasma_b2c/components/Accordion/Accordion.config.d.ts.map +1 -0
- package/types/examples/plasma_b2c/components/Accordion/Accordion.d.ts +26 -0
- package/types/examples/plasma_b2c/components/Accordion/Accordion.d.ts.map +1 -0
- package/types/examples/plasma_b2c/components/Segment/Segment.d.ts +0 -1
- package/types/examples/plasma_b2c/components/Segment/Segment.d.ts.map +1 -1
- package/types/examples/plasma_web/components/Accordion/Accordion.config.d.ts +23 -0
- package/types/examples/plasma_web/components/Accordion/Accordion.config.d.ts.map +1 -0
- package/types/examples/plasma_web/components/Accordion/Accordion.d.ts +30 -0
- package/types/examples/plasma_web/components/Accordion/Accordion.d.ts.map +1 -0
- package/types/examples/plasma_web/components/Segment/Segment.d.ts +0 -1
- package/types/examples/plasma_web/components/Segment/Segment.d.ts.map +1 -1
- package/types/examples/sds_engineer/components/Segment/Segment.d.ts +0 -1
- package/types/examples/sds_engineer/components/Segment/Segment.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,25 @@
|
|
1
|
+
import { Children, isValidElement, cloneElement } from 'react';
|
2
|
+
|
3
|
+
var updatePropsRecursively = function updatePropsRecursively(children, activeIndex, disabled, 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 === null || activeIndex === void 0 ? void 0 : activeIndex.findIndex(function (i) {
|
11
|
+
var _child$props$eventKey;
|
12
|
+
return i === ((_child$props$eventKey = child.props.eventKey) !== null && _child$props$eventKey !== void 0 ? _child$props$eventKey : index);
|
13
|
+
})) !== -1),
|
14
|
+
disabled: disabled,
|
15
|
+
onChange: updateValue
|
16
|
+
};
|
17
|
+
return /*#__PURE__*/cloneElement(child, props);
|
18
|
+
});
|
19
|
+
};
|
20
|
+
var getChildren = function getChildren(children, activeIndex, disabled, updateValue) {
|
21
|
+
return updatePropsRecursively(children, activeIndex, disabled, updateValue);
|
22
|
+
};
|
23
|
+
|
24
|
+
export { getChildren, updatePropsRecursively };
|
25
|
+
//# 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 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;;;;"}
|
@@ -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
|
+
|
@@ -45,7 +45,6 @@ var SegmentProvider = function SegmentProvider(_ref) {
|
|
45
45
|
}, [selectionMode, setSelectedSegmentItems]);
|
46
46
|
var contextValue = {
|
47
47
|
selectedSegmentItems: selectedSegmentItems,
|
48
|
-
setSelectedSegmentItems: setSelectedSegmentItems,
|
49
48
|
handleSelect: handleSelect,
|
50
49
|
selectionMode: selectionMode,
|
51
50
|
setSelectionMode: setSelectionMode,
|
@@ -53,9 +52,7 @@ var SegmentProvider = function SegmentProvider(_ref) {
|
|
53
52
|
setDisabledGroup: setDisabledGroup
|
54
53
|
};
|
55
54
|
useEffect(function () {
|
56
|
-
|
57
|
-
setSelectedSegmentItems([selectedSegmentItems[0]]);
|
58
|
-
}
|
55
|
+
setSelectedSegmentItems([]);
|
59
56
|
}, [selectionMode]);
|
60
57
|
return /*#__PURE__*/React.createElement(SegmentContext.Provider, {
|
61
58
|
value: contextValue
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"SegmentProvider.js","sources":["../../../../src/components/Segment/SegmentProvider/SegmentProvider.tsx"],"sourcesContent":["import React, { createContext, useCallback, useContext, useEffect, useState } from 'react';\nimport type { FC, PropsWithChildren } from 'react';\n\nimport { SegmentContextType, SegmentSelectionMode } from './SegmentProvider.types';\n\nexport const SegmentContext = createContext<SegmentContextType | undefined>(undefined);\n\nexport const useSegmentInner = () => {\n const context = useContext(SegmentContext);\n if (!context) {\n throw new Error('useSegment must be used within a SegmentProvider');\n }\n return context;\n};\n\nexport const useSegment = () => {\n const { selectedSegmentItems } = useSegmentInner();\n return { selectedSegmentItems };\n};\n\nexport const SegmentProvider: FC<PropsWithChildren> = ({ children }) => {\n const [selectedSegmentItems, setSelectedSegmentItems] = useState<string[]>([]);\n const [selectionMode, setSelectionMode] = useState<SegmentSelectionMode>('single');\n const [disabledGroup, setDisabledGroup] = useState(false);\n\n const handleSelect = useCallback(\n (label: string) => {\n if (selectionMode !== 'multiple') {\n setSelectedSegmentItems((prevSelected) => (prevSelected.includes(label) ? [] : [label]));\n return;\n }\n\n setSelectedSegmentItems((prevSelected) =>\n prevSelected.includes(label) ? prevSelected.filter((item) => item !== label) : [...prevSelected, label],\n );\n },\n [selectionMode, setSelectedSegmentItems],\n );\n\n const contextValue: SegmentContextType = {\n selectedSegmentItems,\n
|
1
|
+
{"version":3,"file":"SegmentProvider.js","sources":["../../../../src/components/Segment/SegmentProvider/SegmentProvider.tsx"],"sourcesContent":["import React, { createContext, useCallback, useContext, useEffect, useState } from 'react';\nimport type { FC, PropsWithChildren } from 'react';\n\nimport { SegmentContextType, SegmentSelectionMode } from './SegmentProvider.types';\n\nexport const SegmentContext = createContext<SegmentContextType | undefined>(undefined);\n\nexport const useSegmentInner = () => {\n const context = useContext(SegmentContext);\n if (!context) {\n throw new Error('useSegment must be used within a SegmentProvider');\n }\n return context;\n};\n\nexport const useSegment = () => {\n const { selectedSegmentItems } = useSegmentInner();\n return { selectedSegmentItems };\n};\n\nexport const SegmentProvider: FC<PropsWithChildren> = ({ children }) => {\n const [selectedSegmentItems, setSelectedSegmentItems] = useState<string[]>([]);\n const [selectionMode, setSelectionMode] = useState<SegmentSelectionMode>('single');\n const [disabledGroup, setDisabledGroup] = useState(false);\n\n const handleSelect = useCallback(\n (label: string) => {\n if (selectionMode !== 'multiple') {\n setSelectedSegmentItems((prevSelected) => (prevSelected.includes(label) ? [] : [label]));\n return;\n }\n\n setSelectedSegmentItems((prevSelected) =>\n prevSelected.includes(label) ? prevSelected.filter((item) => item !== label) : [...prevSelected, label],\n );\n },\n [selectionMode, setSelectedSegmentItems],\n );\n\n const contextValue: SegmentContextType = {\n selectedSegmentItems,\n handleSelect,\n selectionMode,\n setSelectionMode,\n disabledGroup,\n setDisabledGroup,\n };\n\n useEffect(() => {\n setSelectedSegmentItems([]);\n }, [selectionMode]);\n\n return <SegmentContext.Provider value={contextValue}>{children}</SegmentContext.Provider>;\n};\n"],"names":["SegmentContext","createContext","undefined","useSegmentInner","context","useContext","Error","useSegment","_useSegmentInner","selectedSegmentItems","SegmentProvider","_ref","children","_useState","useState","_useState2","_slicedToArray","setSelectedSegmentItems","_useState3","_useState4","selectionMode","setSelectionMode","_useState5","_useState6","disabledGroup","setDisabledGroup","handleSelect","useCallback","label","prevSelected","includes","filter","item","concat","_toConsumableArray","contextValue","useEffect","React","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QAAQ,EAAA;AAACC,IAAAA,KAAK,EAAEL,YAAAA;AAAa,GAAA,EAAEvB,QAAkC,CAAC,CAAA;AAC7F;;;;"}
|
@@ -15,7 +15,7 @@ import { base as base$6 } from './variations/_filledBackgound/base.js';
|
|
15
15
|
import { base as base$5 } from './variations/_stretch/base.js';
|
16
16
|
import { StyledArrow, StyledContentWrapper, StyledContent, base } from './SegmentGroup.styles.js';
|
17
17
|
|
18
|
-
var _excluded = ["id", "selectionMode", "pilled", "stretch", "filledBackground", "disabled", "size", "view", "children"
|
18
|
+
var _excluded = ["id", "selectionMode", "pilled", "stretch", "filledBackground", "disabled", "size", "view", "children"];
|
19
19
|
var segmentGroupRoot = function segmentGroupRoot(Root) {
|
20
20
|
return /*#__PURE__*/forwardRef(function (props, outerRef) {
|
21
21
|
var id = props.id,
|
@@ -29,12 +29,10 @@ var segmentGroupRoot = function segmentGroupRoot(Root) {
|
|
29
29
|
size = props.size,
|
30
30
|
view = props.view,
|
31
31
|
children = props.children,
|
32
|
-
defaultSelected = props.defaultSelected,
|
33
32
|
rest = _objectWithoutProperties(props, _excluded);
|
34
33
|
var _useSegmentInner = useSegmentInner(),
|
35
34
|
setSelectionMode = _useSegmentInner.setSelectionMode,
|
36
|
-
setDisabledGroup = _useSegmentInner.setDisabledGroup
|
37
|
-
setSelectedSegmentItems = _useSegmentInner.setSelectedSegmentItems;
|
35
|
+
setDisabledGroup = _useSegmentInner.setDisabledGroup;
|
38
36
|
var _useState = useState(0),
|
39
37
|
_useState2 = _slicedToArray(_useState, 2),
|
40
38
|
index = _useState2[0],
|
@@ -118,11 +116,6 @@ var segmentGroupRoot = function segmentGroupRoot(Root) {
|
|
118
116
|
selectionMode && setSelectionMode(selectionMode);
|
119
117
|
setDisabledGroup(disabled);
|
120
118
|
}, [selectionMode, disabled]);
|
121
|
-
useEffect(function () {
|
122
|
-
if (defaultSelected !== null && defaultSelected !== void 0 && defaultSelected.length) {
|
123
|
-
setSelectedSegmentItems(defaultSelected);
|
124
|
-
}
|
125
|
-
}, [defaultSelected]);
|
126
119
|
useEffect(function () {
|
127
120
|
var _trackRef$current;
|
128
121
|
// Intersection observer для первого сегмента
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"SegmentGroup.js","sources":["../../../../../src/components/Segment/ui/SegmentGroup/SegmentGroup.tsx"],"sourcesContent":["import React, { forwardRef, useCallback, useMemo, useState, Children, useEffect } from 'react';\nimport type { SetStateAction, RefObject, MutableRefObject } from 'react';\nimport { safeUseId, useCarousel } from '@salutejs/plasma-core';\n\nimport type { RootProps } from '../../../../engines/types';\nimport { IconDisclosureLeft, IconDisclosureRight } from '../../../_Icon';\nimport { classes, tokens } from '../../tokens';\nimport { cx } from '../../../../utils';\nimport { useSegmentInner } from '../../SegmentProvider/SegmentProvider';\n\nimport { base as sizeCSS } from './variations/_size/base';\nimport { base as viewCSS } from './variations/_view/base';\nimport { base as disabledCSS } from './variations/_disabled/base';\nimport { base as pilledCSS } from './variations/_pilled/base';\nimport { base as filledBackgroundCSS } from './variations/_filledBackgound/base';\nimport { base as stretchCSS } from './variations/_stretch/base';\nimport type { SegmentGroupProps } from './SegmentGroup.types';\nimport { StyledArrow, StyledContent, StyledContentWrapper, base } from './SegmentGroup.styles';\n\nexport const segmentGroupRoot = (Root: RootProps<HTMLDivElement, SegmentGroupProps>) =>\n forwardRef<HTMLDivElement, SegmentGroupProps>((props, outerRef) => {\n const {\n id,\n selectionMode,\n pilled,\n stretch,\n filledBackground = false,\n disabled = false,\n size,\n view,\n children,\n defaultSelected,\n ...rest\n } = props;\n\n const { setSelectionMode, setDisabledGroup, setSelectedSegmentItems } = useSegmentInner();\n\n const [index, setIndex] = useState(0);\n const [firstItemVisible, setFirstItemVisible] = useState(false);\n const [lastItemVisible, setLastItemVisible] = useState(false);\n\n const uniqId = safeUseId();\n const segmentGroupId = id || uniqId;\n\n const pilledAttr = view !== 'clear' && pilled;\n const filledBackgroundAttr = view !== 'clear' && filledBackground;\n const pilledClass = pilledAttr ? classes.segmentPilled : undefined;\n const filledClass = filledBackgroundAttr ? classes.segmentGroupFilledBackground : undefined;\n const stretchClass = firstItemVisible && lastItemVisible && stretch ? classes.segmentStretch : undefined;\n\n const items = Children?.map(children, (child) => child) || [];\n\n const onPrev = useCallback(() => {\n !disabled && setIndex((prevIndex) => (prevIndex > 0 ? prevIndex - 1 : 0));\n }, [disabled]);\n\n const onNext = useCallback(() => {\n !disabled && setIndex((prevIndex) => (prevIndex < items.length - 1 ? prevIndex + 1 : prevIndex));\n }, [disabled]);\n\n const onIntersecting = (setVisible: (value: SetStateAction<boolean>) => void) => (\n entries: IntersectionObserverEntry[],\n ) => {\n /*\n * Пробегаемся по элементам на которых есть слушатель события появления.\n * Если элемент находится в зоне видимости или выходит из нее, меняем значение флага видимости\n */\n entries.forEach((entry) => {\n if (entry.isIntersecting) {\n setVisible(true);\n } else {\n setVisible(false);\n }\n });\n };\n\n const { scrollRef, trackRef } = useCarousel({\n index,\n axis: 'x',\n scrollAlign: 'start',\n detectActive: true,\n debounceMs: 250,\n onIndexChange: setIndex,\n });\n\n const PreviousButton = useMemo(\n () => (\n <StyledArrow\n type=\"button\"\n aria-label=\"Предыдущий сегмент\"\n onClick={onPrev}\n tabIndex={disabled ? -1 : 0}\n disabled={disabled}\n >\n <IconDisclosureLeft color={`var(${tokens.arrowColor})`} />\n </StyledArrow>\n ),\n [onPrev],\n );\n\n const NextButton = useMemo(\n () => (\n <StyledArrow\n type=\"button\"\n aria-label=\"Следующий сегмент\"\n onClick={onNext}\n tabIndex={disabled ? -1 : 0}\n disabled={disabled}\n >\n <IconDisclosureRight color={`var(${tokens.arrowColor})`} />\n </StyledArrow>\n ),\n [onNext],\n );\n\n useEffect(() => {\n selectionMode && setSelectionMode(selectionMode);\n setDisabledGroup(disabled);\n }, [selectionMode, disabled]);\n\n useEffect(() => {\n if (defaultSelected?.length) {\n setSelectedSegmentItems(defaultSelected);\n }\n }, [defaultSelected]);\n\n useEffect(() => {\n // Intersection observer для первого сегмента\n const observeFirstItem = new IntersectionObserver(onIntersecting(setFirstItemVisible), {\n root: null,\n rootMargin: '0px',\n threshold: 0.5,\n });\n\n // Intersection observer для последнего сегмента\n const observeLastItem = new IntersectionObserver(onIntersecting(setLastItemVisible), {\n root: null,\n rootMargin: '0px',\n threshold: 0.5,\n });\n\n // получаем список сегментов внутри SegmentGroup\n const childrenArray = Array.from(trackRef.current?.children || []) as Array<Element>;\n if (childrenArray.length) {\n // подписываемся на событие появление внутри SegmentGroup\n observeFirstItem.observe(childrenArray[0]);\n observeLastItem.observe(childrenArray[childrenArray.length - 1]);\n }\n\n return () => {\n // отписываемся от события появления внутри SegmentGroup\n observeFirstItem.disconnect();\n observeLastItem.disconnect();\n };\n }, [children]);\n\n return (\n <Root\n view={view}\n size={size}\n id={segmentGroupId}\n ref={outerRef}\n filledBackground={filledBackgroundAttr}\n disabled={disabled}\n pilled={pilledAttr}\n className={cx(pilledClass, filledClass, stretchClass)}\n {...rest}\n >\n {!firstItemVisible && PreviousButton}\n <StyledContentWrapper ref={scrollRef as RefObject<HTMLDivElement>}>\n <StyledContent ref={trackRef as MutableRefObject<HTMLDivElement | null>}>{children}</StyledContent>\n </StyledContentWrapper>\n {!lastItemVisible && NextButton}\n </Root>\n );\n });\n\nexport const segmentGroupConfig = {\n name: 'SegmentGroup',\n tag: 'div',\n layout: segmentGroupRoot,\n base,\n variations: {\n size: {\n css: sizeCSS,\n },\n view: {\n css: viewCSS,\n },\n disabled: {\n css: disabledCSS,\n attrs: true,\n },\n pilled: {\n css: pilledCSS,\n attrs: true,\n },\n stretch: {\n css: stretchCSS,\n attrs: true,\n },\n filledBackground: {\n css: filledBackgroundCSS,\n attrs: true,\n },\n },\n defaults: {\n view: 'clear',\n size: 'xs',\n },\n};\n"],"names":["segmentGroupRoot","Root","forwardRef","props","outerRef","id","selectionMode","pilled","stretch","_props$filledBackgrou","filledBackground","_props$disabled","disabled","size","view","children","defaultSelected","rest","_objectWithoutProperties","_excluded","_useSegmentInner","useSegmentInner","setSelectionMode","setDisabledGroup","setSelectedSegmentItems","_useState","useState","_useState2","_slicedToArray","index","setIndex","_useState3","_useState4","firstItemVisible","setFirstItemVisible","_useState5","_useState6","lastItemVisible","setLastItemVisible","uniqId","safeUseId","segmentGroupId","pilledAttr","filledBackgroundAttr","pilledClass","classes","segmentPilled","undefined","filledClass","segmentGroupFilledBackground","stretchClass","segmentStretch","items","Children","map","child","onPrev","useCallback","prevIndex","onNext","length","onIntersecting","setVisible","entries","forEach","entry","isIntersecting","_useCarousel","useCarousel","axis","scrollAlign","detectActive","debounceMs","onIndexChange","scrollRef","trackRef","PreviousButton","useMemo","React","createElement","StyledArrow","type","onClick","tabIndex","IconDisclosureLeft","color","concat","tokens","arrowColor","NextButton","IconDisclosureRight","useEffect","_trackRef$current","observeFirstItem","IntersectionObserver","root","rootMargin","threshold","observeLastItem","childrenArray","Array","from","current","observe","disconnect","_extends","ref","className","cx","StyledContentWrapper","StyledContent","segmentGroupConfig","name","tag","layout","base","variations","css","sizeCSS","viewCSS","disabledCSS","attrs","pilledCSS","stretchCSS","filledBackgroundCSS","defaults"],"mappings":";;;;;;;;;;;;;;;;;;IAmBaA,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAIC,IAAkD,EAAA;AAAA,EAAA,oBAC/EC,UAAU,CAAoC,UAACC,KAAK,EAAEC,QAAQ,EAAK;AAC/D,IAAA,IACIC,EAAE,GAWFF,KAAK,CAXLE,EAAE;MACFC,aAAa,GAUbH,KAAK,CAVLG,aAAa;MACbC,MAAM,GASNJ,KAAK,CATLI,MAAM;MACNC,OAAO,GAQPL,KAAK,CARLK,OAAO;MAAAC,qBAAA,GAQPN,KAAK,CAPLO,gBAAgB;AAAhBA,MAAAA,gBAAgB,GAAAD,qBAAA,KAAG,KAAA,CAAA,GAAA,KAAK,GAAAA,qBAAA;MAAAE,eAAA,GAOxBR,KAAK,CANLS,QAAQ;AAARA,MAAAA,QAAQ,GAAAD,eAAA,KAAG,KAAA,CAAA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A,IAAI,EAAE,IAAA;AACV,GAAA;AACJ;;;;"}
|
1
|
+
{"version":3,"file":"SegmentGroup.js","sources":["../../../../../src/components/Segment/ui/SegmentGroup/SegmentGroup.tsx"],"sourcesContent":["import React, { forwardRef, useCallback, useMemo, useState, Children, useEffect } from 'react';\nimport type { SetStateAction, RefObject, MutableRefObject } from 'react';\nimport { safeUseId, useCarousel } from '@salutejs/plasma-core';\n\nimport type { RootProps } from '../../../../engines/types';\nimport { IconDisclosureLeft, IconDisclosureRight } from '../../../_Icon';\nimport { classes, tokens } from '../../tokens';\nimport { cx } from '../../../../utils';\nimport { useSegmentInner } from '../../SegmentProvider/SegmentProvider';\n\nimport { base as sizeCSS } from './variations/_size/base';\nimport { base as viewCSS } from './variations/_view/base';\nimport { base as disabledCSS } from './variations/_disabled/base';\nimport { base as pilledCSS } from './variations/_pilled/base';\nimport { base as filledBackgroundCSS } from './variations/_filledBackgound/base';\nimport { base as stretchCSS } from './variations/_stretch/base';\nimport type { SegmentGroupProps } from './SegmentGroup.types';\nimport { StyledArrow, StyledContent, StyledContentWrapper, base } from './SegmentGroup.styles';\n\nexport const segmentGroupRoot = (Root: RootProps<HTMLDivElement, SegmentGroupProps>) =>\n forwardRef<HTMLDivElement, SegmentGroupProps>((props, outerRef) => {\n const {\n id,\n selectionMode,\n pilled,\n stretch,\n filledBackground = false,\n disabled = false,\n size,\n view,\n children,\n ...rest\n } = props;\n\n const { setSelectionMode, setDisabledGroup } = useSegmentInner();\n\n const [index, setIndex] = useState(0);\n const [firstItemVisible, setFirstItemVisible] = useState(false);\n const [lastItemVisible, setLastItemVisible] = useState(false);\n\n const uniqId = safeUseId();\n const segmentGroupId = id || uniqId;\n\n const pilledAttr = view !== 'clear' && pilled;\n const filledBackgroundAttr = view !== 'clear' && filledBackground;\n const pilledClass = pilledAttr ? classes.segmentPilled : undefined;\n const filledClass = filledBackgroundAttr ? classes.segmentGroupFilledBackground : undefined;\n const stretchClass = firstItemVisible && lastItemVisible && stretch ? classes.segmentStretch : undefined;\n\n const items = Children?.map(children, (child) => child) || [];\n\n const onPrev = useCallback(() => {\n !disabled && setIndex((prevIndex) => (prevIndex > 0 ? prevIndex - 1 : 0));\n }, [disabled]);\n\n const onNext = useCallback(() => {\n !disabled && setIndex((prevIndex) => (prevIndex < items.length - 1 ? prevIndex + 1 : prevIndex));\n }, [disabled]);\n\n const onIntersecting = (setVisible: (value: SetStateAction<boolean>) => void) => (\n entries: IntersectionObserverEntry[],\n ) => {\n /*\n * Пробегаемся по элементам на которых есть слушатель события появления.\n * Если элемент находится в зоне видимости или выходит из нее, меняем значение флага видимости\n */\n entries.forEach((entry) => {\n if (entry.isIntersecting) {\n setVisible(true);\n } else {\n setVisible(false);\n }\n });\n };\n\n const { scrollRef, trackRef } = useCarousel({\n index,\n axis: 'x',\n scrollAlign: 'start',\n detectActive: true,\n debounceMs: 250,\n onIndexChange: setIndex,\n });\n\n const PreviousButton = useMemo(\n () => (\n <StyledArrow\n type=\"button\"\n aria-label=\"Предыдущий сегмент\"\n onClick={onPrev}\n tabIndex={disabled ? -1 : 0}\n disabled={disabled}\n >\n <IconDisclosureLeft color={`var(${tokens.arrowColor})`} />\n </StyledArrow>\n ),\n [onPrev],\n );\n\n const NextButton = useMemo(\n () => (\n <StyledArrow\n type=\"button\"\n aria-label=\"Следующий сегмент\"\n onClick={onNext}\n tabIndex={disabled ? -1 : 0}\n disabled={disabled}\n >\n <IconDisclosureRight color={`var(${tokens.arrowColor})`} />\n </StyledArrow>\n ),\n [onNext],\n );\n\n useEffect(() => {\n selectionMode && setSelectionMode(selectionMode);\n setDisabledGroup(disabled);\n }, [selectionMode, disabled]);\n\n useEffect(() => {\n // Intersection observer для первого сегмента\n const observeFirstItem = new IntersectionObserver(onIntersecting(setFirstItemVisible), {\n root: null,\n rootMargin: '0px',\n threshold: 0.5,\n });\n\n // Intersection observer для последнего сегмента\n const observeLastItem = new IntersectionObserver(onIntersecting(setLastItemVisible), {\n root: null,\n rootMargin: '0px',\n threshold: 0.5,\n });\n\n // получаем список сегментов внутри SegmentGroup\n const childrenArray = Array.from(trackRef.current?.children || []) as Array<Element>;\n if (childrenArray.length) {\n // подписываемся на событие появление внутри SegmentGroup\n observeFirstItem.observe(childrenArray[0]);\n observeLastItem.observe(childrenArray[childrenArray.length - 1]);\n }\n\n return () => {\n // отписываемся от события появления внутри SegmentGroup\n observeFirstItem.disconnect();\n observeLastItem.disconnect();\n };\n }, [children]);\n\n return (\n <Root\n view={view}\n size={size}\n id={segmentGroupId}\n ref={outerRef}\n filledBackground={filledBackgroundAttr}\n disabled={disabled}\n pilled={pilledAttr}\n className={cx(pilledClass, filledClass, stretchClass)}\n {...rest}\n >\n {!firstItemVisible && PreviousButton}\n <StyledContentWrapper ref={scrollRef as RefObject<HTMLDivElement>}>\n <StyledContent ref={trackRef as MutableRefObject<HTMLDivElement | null>}>{children}</StyledContent>\n </StyledContentWrapper>\n {!lastItemVisible && NextButton}\n </Root>\n );\n });\n\nexport const segmentGroupConfig = {\n name: 'SegmentGroup',\n tag: 'div',\n layout: segmentGroupRoot,\n base,\n variations: {\n size: {\n css: sizeCSS,\n },\n view: {\n css: viewCSS,\n },\n disabled: {\n css: disabledCSS,\n attrs: true,\n },\n pilled: {\n css: pilledCSS,\n attrs: true,\n },\n stretch: {\n css: stretchCSS,\n attrs: true,\n },\n filledBackground: {\n css: filledBackgroundCSS,\n attrs: true,\n },\n },\n defaults: {\n view: 'clear',\n size: 'xs',\n },\n};\n"],"names":["segmentGroupRoot","Root","forwardRef","props","outerRef","id","selectionMode","pilled","stretch","_props$filledBackgrou","filledBackground","_props$disabled","disabled","size","view","children","rest","_objectWithoutProperties","_excluded","_useSegmentInner","useSegmentInner","setSelectionMode","setDisabledGroup","_useState","useState","_useState2","_slicedToArray","index","setIndex","_useState3","_useState4","firstItemVisible","setFirstItemVisible","_useState5","_useState6","lastItemVisible","setLastItemVisible","uniqId","safeUseId","segmentGroupId","pilledAttr","filledBackgroundAttr","pilledClass","classes","segmentPilled","undefined","filledClass","segmentGroupFilledBackground","stretchClass","segmentStretch","items","Children","map","child","onPrev","useCallback","prevIndex","onNext","length","onIntersecting","setVisible","entries","forEach","entry","isIntersecting","_useCarousel","useCarousel","axis","scrollAlign","detectActive","debounceMs","onIndexChange","scrollRef","trackRef","PreviousButton","useMemo","React","createElement","StyledArrow","type","onClick","tabIndex","IconDisclosureLeft","color","concat","tokens","arrowColor","NextButton","IconDisclosureRight","useEffect","_trackRef$current","observeFirstItem","IntersectionObserver","root","rootMargin","threshold","observeLastItem","childrenArray","Array","from","current","observe","disconnect","_extends","ref","className","cx","StyledContentWrapper","StyledContent","segmentGroupConfig","name","tag","layout","base","variations","css","sizeCSS","viewCSS","disabledCSS","attrs","pilledCSS","stretchCSS","filledBackgroundCSS","defaults"],"mappings":";;;;;;;;;;;;;;;;;;IAmBaA,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAIC,IAAkD,EAAA;AAAA,EAAA,oBAC/EC,UAAU,CAAoC,UAACC,KAAK,EAAEC,QAAQ,EAAK;AAC/D,IAAA,IACIC,EAAE,GAUFF,KAAK,CAVLE,EAAE;MACFC,aAAa,GASbH,KAAK,CATLG,aAAa;MACbC,MAAM,GAQNJ,KAAK,CARLI,MAAM;MACNC,OAAO,GAOPL,KAAK,CAPLK,OAAO;MAAAC,qBAAA,GAOPN,KAAK,CANLO,gBAAgB;AAAhBA,MAAAA,gBAAgB,GAAAD,qBAAA,KAAG,KAAA,CAAA,GAAA,KAAK,GAAAA,qBAAA;MAAAE,eAAA,GAMxBR,KAAK,CALLS,QAAQ;AAARA,MAAAA,QAAQ,GAAAD,eAAA,KAAG,KAAA,CAAA,GAAA,KAAK,GAAAA,eAAA;MAChBE,IAAI,GAIJV,KAAK,CAJLU,IAAI;MACJC,IAAI,GAGJX,KAAK,CAHLW,IAAI;MACJC,QAAQ,GAERZ,KAAK,CAFLY,QAAQ;AACLC,MAAAA,IAAI,GAAAC,wBAAA,CACPd,KAAK,EAAAe,SAAA,C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,KAAK;AACVC,EAAAA,MAAM,EAAEhH,gBAAgB;AACxBiH,EAAAA,IAAI,EAAJA,IAAI;AACJC,EAAAA,UAAU,EAAE;AACRrG,IAAAA,IAAI,EAAE;AACFsG,MAAAA,GAAG,EAAEC,MAAAA;KACR;AACDtG,IAAAA,IAAI,EAAE;AACFqG,MAAAA,GAAG,EAAEE,MAAAA;KACR;AACDzG,IAAAA,QAAQ,EAAE;AACNuG,MAAAA,GAAG,EAAEG,MAAW;AAChBC,MAAAA,KAAK,EAAE,IAAA;KACV;AACDhH,IAAAA,MAAM,EAAE;AACJ4G,MAAAA,GAAG,EAAEK,MAAS;AACdD,MAAAA,KAAK,EAAE,IAAA;KACV;AACD/G,IAAAA,OAAO,EAAE;AACL2G,MAAAA,GAAG,EAAEM,MAAU;AACfF,MAAAA,KAAK,EAAE,IAAA;KACV;AACD7G,IAAAA,gBAAgB,EAAE;AACdyG,MAAAA,GAAG,EAAEO,MAAmB;AACxBH,MAAAA,KAAK,EAAE,IAAA;AACX,KAAA;GACH;AACDI,EAAAA,QAAQ,EAAE;AACN7G,IAAAA,IAAI,EAAE,OAAO;AACbD,IAAAA,IAAI,EAAE,IAAA;AACV,GAAA;AACJ;;;;"}
|
@@ -0,0 +1,20 @@
|
|
1
|
+
import { extends as _extends } from '../../../_virtual/_rollupPluginBabelHelpers.js';
|
2
|
+
import React from 'react';
|
3
|
+
|
4
|
+
var _path;
|
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), _path || (_path = /*#__PURE__*/React.createElement("path", {
|
11
|
+
id: "path",
|
12
|
+
d: "M11.45 5.79C11.37 5.61 11.19 5.5 11 5.5L5 5.5C4.8 5.5 4.62 5.61 4.54 5.79C4.46 5.96 4.49 6.17 4.62 6.32L7.62 9.82C7.71 9.93 7.85 10 8 10C8.14 10 8.28 9.93 8.37 9.82L11.37 6.32C11.5 6.17 11.53 5.96 11.45 5.79Z",
|
13
|
+
fillRule: "evenodd",
|
14
|
+
fill: "currentColor",
|
15
|
+
clipRule: "evenodd"
|
16
|
+
})));
|
17
|
+
};
|
18
|
+
|
19
|
+
export { ChevronDownFill };
|
20
|
+
//# 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 <path\n id=\"path\"\n d=\"M11.45 5.79C11.37 5.61 11.19 5.5 11 5.5L5 5.5C4.8 5.5 4.62 5.61 4.54 5.79C4.46 5.96 4.49 6.17 4.62 6.32L7.62 9.82C7.71 9.93 7.85 10 8 10C8.14 10 8.28 9.93 8.37 9.82L11.37 6.32C11.5 6.17 11.53 5.96 11.45 5.79Z\"\n fillRule=\"evenodd\"\n fill=\"currentColor\"\n clipRule=\"evenodd\"\n />\n </svg>\n);\n"],"names":["ChevronDownFill","props","React","createElement","_extends","width","viewBox","fill","_path","id","d","fillRule","clipRule"],"mappings":";;;;IAIaA,eAAoC,GAAG,SAAvCA,eAAoCA,CAAIC,KAAK,EAAA;AAAA,EAAA,oBACtDC,KAAA,CAAAC,aAAA,CAAA,KAAA,EAAAC,QAAA,CAAA;AAAKC,IAAAA,KAAK,EAAC,MAAM;AAACC,IAAAA,OAAO,EAAC,WAAW;AAACC,IAAAA,IAAI,EAAC,MAAA;GAAWN,EAAAA,KAAK,GAAAO,KAAA,KAAAA,KAAA,gBACvDN,KAAA,CAAAC,aAAA,CAAA,MAAA,EAAA;AACIM,IAAAA,EAAE,EAAC,MAAM;AACTC,IAAAA,CAAC,EAAC,kNAAkN;AACpNC,IAAAA,QAAQ,EAAC,SAAS;AAClBJ,IAAAA,IAAI,EAAC,cAAc;AACnBK,IAAAA,QAAQ,EAAC,SAAA;GACZ,CAAC,CACD,CAAC,CAAA;AAAA;;;;"}
|
@@ -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_rsiff6_bjv6ypd__465a9c67{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;gap:var(--plasma-accordion-gap);-webkit-align-items:stretch;-webkit-box-align:stretch;-ms-flex-align:stretch;align-items:stretch;height:auto;background:var(--plasma-accordion-background);}.Accordion_styles_rsiff6_bjv6ypd__465a9c67.Accordion_styles_rsiff6_accordionStretchingFixed__465a9c67{width:var(--plasma-accordion-width);}.Accordion_styles_rsiff6_bjv6ypd__465a9c67.Accordion_styles_rsiff6_accordionStretchingFilled__465a9c67{width:100%;}
|
package/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.
|
3
|
+
"version": "0.88.0-canary.1254.9538803694.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": "593d20fb9d90ce7671c9352d576d025fead39bd0"
|
107
107
|
}
|
@@ -0,0 +1,90 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
5
|
+
value: true
|
6
|
+
});
|
7
|
+
exports.accordionRoot = exports.accordionConfig = void 0;
|
8
|
+
var _react = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("react"));
|
9
|
+
var _utils = /*#__PURE__*/require("../../utils");
|
10
|
+
var _Accordion = /*#__PURE__*/require("./Accordion.styles");
|
11
|
+
var _Accordion2 = /*#__PURE__*/require("./Accordion.tokens");
|
12
|
+
var _base = /*#__PURE__*/require("./variations/_view/base");
|
13
|
+
var _base2 = /*#__PURE__*/require("./variations/_size/base");
|
14
|
+
var _utils2 = /*#__PURE__*/require("./utils");
|
15
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
16
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
17
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
18
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
19
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
20
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
21
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
22
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
23
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
24
|
+
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; }
|
25
|
+
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; } }
|
26
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
27
|
+
var accordionRoot = exports.accordionRoot = function accordionRoot(Root) {
|
28
|
+
return /*#__PURE__*/(0, _react.forwardRef)(function (_ref, outerRootRef) {
|
29
|
+
var size = _ref.size,
|
30
|
+
view = _ref.view,
|
31
|
+
_ref$stretching = _ref.stretching,
|
32
|
+
stretching = _ref$stretching === void 0 ? 'filled' : _ref$stretching,
|
33
|
+
_ref$defaultActiveEve = _ref.defaultActiveEventKey,
|
34
|
+
defaultActiveEventKey = _ref$defaultActiveEve === void 0 ? [] : _ref$defaultActiveEve,
|
35
|
+
children = _ref.children,
|
36
|
+
disabled = _ref.disabled,
|
37
|
+
className = _ref.className,
|
38
|
+
singleActive = _ref.singleActive,
|
39
|
+
onChange = _ref.onChange;
|
40
|
+
var stretchingClass = _Accordion2.classes["".concat(stretching, "Stretching")];
|
41
|
+
var _useState = (0, _react.useState)(defaultActiveEventKey),
|
42
|
+
_useState2 = _slicedToArray(_useState, 2),
|
43
|
+
activeIndex = _useState2[0],
|
44
|
+
setActiveIndex = _useState2[1];
|
45
|
+
var updateValue = function updateValue(index, value) {
|
46
|
+
if (onChange) {
|
47
|
+
onChange(index, value);
|
48
|
+
}
|
49
|
+
if (singleActive) {
|
50
|
+
if (value) {
|
51
|
+
setActiveIndex([index]);
|
52
|
+
} else {
|
53
|
+
setActiveIndex([]);
|
54
|
+
}
|
55
|
+
} else if (value) {
|
56
|
+
setActiveIndex([index].concat(_toConsumableArray(activeIndex)));
|
57
|
+
} else {
|
58
|
+
var updatedActiveIndex = activeIndex.filter(function (i) {
|
59
|
+
return i !== index;
|
60
|
+
});
|
61
|
+
setActiveIndex(updatedActiveIndex);
|
62
|
+
}
|
63
|
+
};
|
64
|
+
var childrenArray = _react.Children.toArray(children);
|
65
|
+
return /*#__PURE__*/_react["default"].createElement(Root, {
|
66
|
+
ref: outerRootRef,
|
67
|
+
size: size,
|
68
|
+
view: view,
|
69
|
+
className: (0, _utils.cx)(stretchingClass, _Accordion2.classes.accordionRoot, className)
|
70
|
+
}, (0, _utils2.getChildren)(childrenArray, activeIndex, disabled, updateValue));
|
71
|
+
});
|
72
|
+
};
|
73
|
+
var accordionConfig = exports.accordionConfig = {
|
74
|
+
name: 'Accordion',
|
75
|
+
tag: 'div',
|
76
|
+
layout: accordionRoot,
|
77
|
+
base: _Accordion.base,
|
78
|
+
variations: {
|
79
|
+
view: {
|
80
|
+
css: _base.base
|
81
|
+
},
|
82
|
+
size: {
|
83
|
+
css: _base2.base
|
84
|
+
}
|
85
|
+
},
|
86
|
+
defaults: {
|
87
|
+
view: 'default',
|
88
|
+
size: 'm'
|
89
|
+
}
|
90
|
+
};
|
@@ -0,0 +1,9 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.base = void 0;
|
7
|
+
var _styledComponents = /*#__PURE__*/require("styled-components");
|
8
|
+
var _Accordion = /*#__PURE__*/require("./Accordion.tokens");
|
9
|
+
var base = exports.base = /*#__PURE__*/(0, _styledComponents.css)(["display:flex;flex-direction:column;gap:var(", ");align-items:stretch;height:auto;background:var(", ");&.", "{width:var(", ");}&.", "{width:100%;}"], _Accordion.tokens.accordionGap, _Accordion.tokens.accordionBackground, _Accordion.classes.fixedStretching, _Accordion.tokens.accordionWidth, _Accordion.classes.filledStretching);
|
@@ -0,0 +1,43 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.tokens = exports.classes = void 0;
|
7
|
+
var classes = exports.classes = {
|
8
|
+
filledStretching: 'accordion-stretching-filled',
|
9
|
+
fixedStretching: 'accordion-stretching-fixed',
|
10
|
+
accordionRoot: 'accordion-root',
|
11
|
+
accordionItem: 'accordion-item',
|
12
|
+
clearAccordionItem: 'clear-accordion-item',
|
13
|
+
accordionItemShowBody: 'accordion-item-show-body',
|
14
|
+
accordionPlusAnimationElement: 'accordion-plus-animation-element',
|
15
|
+
accordionDisabled: 'accordion-disabled'
|
16
|
+
};
|
17
|
+
var tokens = exports.tokens = {
|
18
|
+
accordionGap: '--plasma-accordion-gap',
|
19
|
+
accordionWidth: '--plasma-accordion-width',
|
20
|
+
accordionBackground: '--plasma-accordion-background',
|
21
|
+
accordionItemBackground: '--plasma-accordion-item-background',
|
22
|
+
accordionItemBorderRadius: '--plasma-accordion-item-border-radius',
|
23
|
+
accordionItemPadding: '--plasma-accordion-item-padding',
|
24
|
+
accordionItemPaddingVertical: '--plasma-accordion-item-padding-vertical',
|
25
|
+
accordionItemPaddingHorizontal: '--plasma-accordion-item-padding-horizontal',
|
26
|
+
accordionItemGap: '--plasma-accordion-item-gap',
|
27
|
+
accordionItemFocus: '--plasma-accordion-item-focus',
|
28
|
+
accordionItemBorderBottom: '--plasma-accordion-item-border-bottom',
|
29
|
+
accordionItemTitleColor: '--plasma-accordion-item-title-color',
|
30
|
+
accordionItemTitleFontFamily: '--plasma-accordion-item-title-font-family',
|
31
|
+
accordionItemTitleFontSize: '--plasma-accordion-item-title-font-size',
|
32
|
+
accordionItemTitleFontStyle: '--plasma-accordion-item-title-font-style',
|
33
|
+
accordionItemTitleFontWeight: '--plasma-accordion-item-title-font-weight',
|
34
|
+
accordionItemTitleLetterSpacing: '--plasma-accordion-item-title-letter-spacing',
|
35
|
+
accordionItemTitleLineHeight: '--plasma-accordion-item-title-line-height',
|
36
|
+
accordionItemTextColor: '--plasma-accordion-item-text-color',
|
37
|
+
accordionItemTextFontFamily: '--plasma-accordion-item-text-font-family',
|
38
|
+
accordionItemTextFontSize: '--plasma-accordion-item-text-font-size',
|
39
|
+
accordionItemTextFontStyle: '--plasma-accordion-item-text-font-style',
|
40
|
+
accordionItemTextFontWeight: '--plasma-accordion-item-text-font-weight',
|
41
|
+
accordionItemTextLetterSpacing: '--plasma-accordion-item-text-letter-spacing',
|
42
|
+
accordionItemTextLineHeight: '--plasma-accordion-item-text-line-height'
|
43
|
+
};
|
@@ -0,0 +1,38 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
Object.defineProperty(exports, "AccordionItem", {
|
7
|
+
enumerable: true,
|
8
|
+
get: function get() {
|
9
|
+
return _AccordionItem.AccordionItem;
|
10
|
+
}
|
11
|
+
});
|
12
|
+
Object.defineProperty(exports, "accordionClasses", {
|
13
|
+
enumerable: true,
|
14
|
+
get: function get() {
|
15
|
+
return _Accordion2.classes;
|
16
|
+
}
|
17
|
+
});
|
18
|
+
Object.defineProperty(exports, "accordionConfig", {
|
19
|
+
enumerable: true,
|
20
|
+
get: function get() {
|
21
|
+
return _Accordion.accordionConfig;
|
22
|
+
}
|
23
|
+
});
|
24
|
+
Object.defineProperty(exports, "accordionRoot", {
|
25
|
+
enumerable: true,
|
26
|
+
get: function get() {
|
27
|
+
return _Accordion.accordionRoot;
|
28
|
+
}
|
29
|
+
});
|
30
|
+
Object.defineProperty(exports, "accordionTokens", {
|
31
|
+
enumerable: true,
|
32
|
+
get: function get() {
|
33
|
+
return _Accordion2.tokens;
|
34
|
+
}
|
35
|
+
});
|
36
|
+
var _Accordion = /*#__PURE__*/require("./Accordion");
|
37
|
+
var _AccordionItem = /*#__PURE__*/require("./ui/AccordionItem/AccordionItem");
|
38
|
+
var _Accordion2 = /*#__PURE__*/require("./Accordion.tokens");
|