@chayns-components/core 5.0.0-beta.19 → 5.0.0-beta.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/accordion/Accordion.d.ts +15 -1
- package/lib/components/accordion/Accordion.js +11 -1
- package/lib/components/accordion/Accordion.js.map +1 -1
- package/lib/components/accordion/accordion-body/AccordionBody.js +0 -3
- package/lib/components/accordion/accordion-body/AccordionBody.js.map +1 -1
- package/lib/components/accordion/accordion-head/AccordionHead.d.ts +4 -1
- package/lib/components/accordion/accordion-head/AccordionHead.js +57 -25
- package/lib/components/accordion/accordion-head/AccordionHead.js.map +1 -1
- package/lib/components/accordion/accordion-head/AccordionHead.styles.d.ts +9 -1
- package/lib/components/accordion/accordion-head/AccordionHead.styles.js +22 -10
- package/lib/components/accordion/accordion-head/AccordionHead.styles.js.map +1 -1
- package/lib/components/accordion/accordion-intro/AccordionIntro.d.ts +3 -0
- package/lib/components/accordion/accordion-intro/AccordionIntro.js +24 -0
- package/lib/components/accordion/accordion-intro/AccordionIntro.js.map +1 -0
- package/lib/components/accordion/accordion-intro/AccordionIntro.styles.d.ts +1 -0
- package/lib/components/accordion/accordion-intro/AccordionIntro.styles.js +19 -0
- package/lib/components/accordion/accordion-intro/AccordionIntro.styles.js.map +1 -0
- package/lib/components/context-menu/ContextMenu.js +2 -2
- package/lib/components/context-menu/ContextMenu.js.map +1 -1
- package/lib/components/list/list-item/list-item-head/ListItemHead.js +2 -1
- package/lib/components/list/list-item/list-item-head/ListItemHead.js.map +1 -1
- package/lib/components/list/list-item/list-item-head/ListItemHead.styles.d.ts +1 -0
- package/lib/components/list/list-item/list-item-head/ListItemHead.styles.js +5 -2
- package/lib/components/list/list-item/list-item-head/ListItemHead.styles.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +8 -0
- package/lib/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { FC, ReactNode } from 'react';
|
|
1
|
+
import React, { ChangeEventHandler, FC, ReactNode } from 'react';
|
|
2
2
|
export declare const AccordionContext: React.Context<{
|
|
3
3
|
isWrapped: boolean;
|
|
4
4
|
}>;
|
|
@@ -29,10 +29,24 @@ declare type AccordionProps = {
|
|
|
29
29
|
* the head and the padding of the content.
|
|
30
30
|
*/
|
|
31
31
|
isWrapped?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Function that is executed when the text of the search in the accordion
|
|
34
|
+
* head changes. When this function is given, the search field is displayed
|
|
35
|
+
* in the Accordion Head.
|
|
36
|
+
*/
|
|
37
|
+
onSearchChange?: ChangeEventHandler<HTMLInputElement>;
|
|
32
38
|
/**
|
|
33
39
|
* Content to be displayed on the right side in the head of the Accordion
|
|
34
40
|
*/
|
|
35
41
|
rightElement?: ReactNode;
|
|
42
|
+
/**
|
|
43
|
+
* Icon to be displayed on the right side in the search input
|
|
44
|
+
*/
|
|
45
|
+
searchIcon?: string[];
|
|
46
|
+
/**
|
|
47
|
+
* The placeholder to be used for the search
|
|
48
|
+
*/
|
|
49
|
+
searchPlaceholder?: string;
|
|
36
50
|
/**
|
|
37
51
|
* Title of the Accordion displayed in the head
|
|
38
52
|
*/
|
|
@@ -57,7 +57,10 @@ var Accordion = function Accordion(_ref) {
|
|
|
57
57
|
isTitleGreyed = _ref$isTitleGreyed === void 0 ? false : _ref$isTitleGreyed,
|
|
58
58
|
_ref$isWrapped = _ref.isWrapped,
|
|
59
59
|
isWrapped = _ref$isWrapped === void 0 ? false : _ref$isWrapped,
|
|
60
|
+
onSearchChange = _ref.onSearchChange,
|
|
60
61
|
rightElement = _ref.rightElement,
|
|
62
|
+
searchIcon = _ref.searchIcon,
|
|
63
|
+
searchPlaceholder = _ref.searchPlaceholder,
|
|
61
64
|
title = _ref.title,
|
|
62
65
|
titleElement = _ref.titleElement;
|
|
63
66
|
|
|
@@ -97,6 +100,10 @@ var Accordion = function Accordion(_ref) {
|
|
|
97
100
|
value: {
|
|
98
101
|
isWrapped: isWrapped
|
|
99
102
|
}
|
|
103
|
+
}, /*#__PURE__*/_react.default.createElement(_framerMotion.MotionConfig, {
|
|
104
|
+
transition: {
|
|
105
|
+
type: 'tween'
|
|
106
|
+
}
|
|
100
107
|
}, /*#__PURE__*/_react.default.createElement(_AccordionHead.default, {
|
|
101
108
|
icon: icon,
|
|
102
109
|
isOpen: isOpen,
|
|
@@ -104,12 +111,15 @@ var Accordion = function Accordion(_ref) {
|
|
|
104
111
|
isTitleGreyed: isTitleGreyed,
|
|
105
112
|
isWrapped: isWrapped,
|
|
106
113
|
onClick: handleHeadClick,
|
|
114
|
+
onSearchChange: onSearchChange,
|
|
107
115
|
rightElement: rightElement,
|
|
116
|
+
searchIcon: searchIcon,
|
|
117
|
+
searchPlaceholder: searchPlaceholder,
|
|
108
118
|
title: title,
|
|
109
119
|
titleElement: titleElement
|
|
110
120
|
}), /*#__PURE__*/_react.default.createElement(_framerMotion.AnimatePresence, {
|
|
111
121
|
initial: false
|
|
112
|
-
}, isOpen && /*#__PURE__*/_react.default.createElement(_AccordionBody.default, null, children))));
|
|
122
|
+
}, isOpen && /*#__PURE__*/_react.default.createElement(_AccordionBody.default, null, children)))));
|
|
113
123
|
};
|
|
114
124
|
|
|
115
125
|
Accordion.displayName = 'Accordion';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/accordion/Accordion.tsx"],"names":["AccordionContext","React","createContext","isWrapped","displayName","Accordion","children","icon","isDefaultOpen","isFixed","isTitleGreyed","rightElement","title","titleElement","AccordionGroupContext","openAccordionUuid","updateOpenAccordionUuid","isAccordionOpen","setIsAccordionOpen","uuid","isInGroup","isOpen","handleHeadClick","currentIsAccordionOpen","shouldOnlyOpen"],"mappings":";;;;;;;;;AAAA;;AACA;;
|
|
1
|
+
{"version":3,"sources":["../../../src/components/accordion/Accordion.tsx"],"names":["AccordionContext","React","createContext","isWrapped","displayName","Accordion","children","icon","isDefaultOpen","isFixed","isTitleGreyed","onSearchChange","rightElement","searchIcon","searchPlaceholder","title","titleElement","AccordionGroupContext","openAccordionUuid","updateOpenAccordionUuid","isAccordionOpen","setIsAccordionOpen","uuid","isInGroup","isOpen","handleHeadClick","currentIsAccordionOpen","shouldOnlyOpen","type"],"mappings":";;;;;;;;;AAAA;;AACA;;AASA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;AAEO,IAAMA,gBAAgB,gBAAGC,eAAMC,aAAN,CAAoB;AAAEC,EAAAA,SAAS,EAAE;AAAb,CAApB,CAAzB;;;AAEPH,gBAAgB,CAACI,WAAjB,GAA+B,kBAA/B;;AAyDA,IAAMC,SAA6B,GAAG,SAAhCA,SAAgC,OAahC;AAAA,MAZFC,QAYE,QAZFA,QAYE;AAAA,MAXFC,IAWE,QAXFA,IAWE;AAAA,gCAVFC,aAUE;AAAA,MAVFA,aAUE,mCAVc,KAUd;AAAA,0BATFC,OASE;AAAA,MATFA,OASE,6BATQ,KASR;AAAA,gCARFC,aAQE;AAAA,MARFA,aAQE,mCARc,KAQd;AAAA,4BAPFP,SAOE;AAAA,MAPFA,SAOE,+BAPU,KAOV;AAAA,MANFQ,cAME,QANFA,cAME;AAAA,MALFC,YAKE,QALFA,YAKE;AAAA,MAJFC,UAIE,QAJFA,UAIE;AAAA,MAHFC,iBAGE,QAHFA,iBAGE;AAAA,MAFFC,KAEE,QAFFA,KAEE;AAAA,MADFC,YACE,QADFA,YACE;;AACF,oBAAuD,uBAAWC,qCAAX,CAAvD;AAAA,MAAQC,iBAAR,eAAQA,iBAAR;AAAA,MAA2BC,uBAA3B,eAA2BA,uBAA3B;;AAEA,kBAA8C,qBAAkBX,aAAlB,CAA9C;AAAA;AAAA,MAAOY,eAAP;AAAA,MAAwBC,kBAAxB;;AAEA,MAAMC,IAAI,GAAG,oBAAb;AAEA,MAAMC,SAAS,GAAG,OAAOJ,uBAAP,KAAmC,UAArD;AAEA,MAAMK,MAAM,GAAGD,SAAS,GAAGL,iBAAiB,KAAK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AAYI,IAAA,YAAY,EAAEC;AAZlB,IADJ,eAeI,6BAAC,6BAAD;AAAiB,IAAA,OAAO,EAAE;AAA1B,KACKQ,MAAM,iBAAI,6BAAC,sBAAD,QAAgBlB,QAAhB,CADf,CAfJ,CADJ,CADJ,CADJ;AAyBH,CA/DD;;AAiEAD,SAAS,CAACD,WAAV,GAAwB,WAAxB;eAEeC,S","sourcesContent":["import { AnimatePresence, MotionConfig } from 'framer-motion';\nimport React, {\n ChangeEventHandler,\n FC,\n ReactNode,\n useCallback,\n useContext,\n useEffect,\n useState,\n} from 'react';\nimport { useUuid } from '../../hooks/uuid';\nimport AccordionBody from './accordion-body/AccordionBody';\nimport { AccordionGroupContext } from './accordion-group/AccordionGroup';\nimport AccordionHead from './accordion-head/AccordionHead';\nimport { StyledAccordion } from './Accordion.styles';\n\nexport const AccordionContext = React.createContext({ isWrapped: false });\n\nAccordionContext.displayName = 'AccordionContext';\n\ntype AccordionProps = {\n /**\n * The content of the accordion body\n */\n children: ReactNode;\n /**\n * The icon that is displayed in front of the title\n */\n icon?: string;\n /**\n * This can be used to automatically expand the Accordion during the first render.\n */\n isDefaultOpen?: boolean;\n /**\n * This can be used so that the Accordion cannot be opened or closed.\n * In addition, in this case the icon is exchanged to mark the Accordions.\n */\n isFixed?: boolean;\n /**\n * This will gray out the title of the Accordion to indicate hidden content, for example.\n */\n isTitleGreyed?: boolean;\n /**\n * This value must be set for nested Accordions. This adjusts the style of\n * the head and the padding of the content.\n */\n isWrapped?: boolean;\n /**\n * Function that is executed when the text of the search in the accordion\n * head changes. When this function is given, the search field is displayed\n * in the Accordion Head.\n */\n onSearchChange?: ChangeEventHandler<HTMLInputElement>;\n /**\n * Content to be displayed on the right side in the head of the Accordion\n */\n rightElement?: ReactNode;\n /**\n * Icon to be displayed on the right side in the search input\n */\n searchIcon?: string[];\n /**\n * The placeholder to be used for the search\n */\n searchPlaceholder?: string;\n /**\n * Title of the Accordion displayed in the head\n */\n title: string;\n /**\n * Additional elements to be displayed in the header next to the title.\n */\n titleElement?: ReactNode;\n};\n\nconst Accordion: FC<AccordionProps> = ({\n children,\n icon,\n isDefaultOpen = false,\n isFixed = false,\n isTitleGreyed = false,\n isWrapped = false,\n onSearchChange,\n rightElement,\n searchIcon,\n searchPlaceholder,\n title,\n titleElement,\n}) => {\n const { openAccordionUuid, updateOpenAccordionUuid } = useContext(AccordionGroupContext);\n\n const [isAccordionOpen, setIsAccordionOpen] = useState<boolean>(isDefaultOpen);\n\n const uuid = useUuid();\n\n const isInGroup = typeof updateOpenAccordionUuid === 'function';\n\n const isOpen = isInGroup ? openAccordionUuid === uuid : isAccordionOpen;\n\n const handleHeadClick = useCallback(() => {\n if (typeof updateOpenAccordionUuid === 'function') {\n updateOpenAccordionUuid(uuid);\n }\n\n setIsAccordionOpen((currentIsAccordionOpen) => !currentIsAccordionOpen);\n }, [updateOpenAccordionUuid, uuid]);\n\n useEffect(() => {\n if (isDefaultOpen && typeof updateOpenAccordionUuid === 'function') {\n updateOpenAccordionUuid(uuid, { shouldOnlyOpen: true });\n }\n }, [isDefaultOpen, updateOpenAccordionUuid, uuid]);\n\n return (\n <StyledAccordion className=\"beta-chayns-accordion\" isOpen={isOpen} isWrapped={isWrapped}>\n <AccordionContext.Provider value={{ isWrapped }}>\n <MotionConfig transition={{ type: 'tween' }}>\n <AccordionHead\n icon={icon}\n isOpen={isOpen}\n isFixed={isFixed}\n isTitleGreyed={isTitleGreyed}\n isWrapped={isWrapped}\n onClick={handleHeadClick}\n onSearchChange={onSearchChange}\n rightElement={rightElement}\n searchIcon={searchIcon}\n searchPlaceholder={searchPlaceholder}\n title={title}\n titleElement={titleElement}\n />\n <AnimatePresence initial={false}>\n {isOpen && <AccordionBody>{children}</AccordionBody>}\n </AnimatePresence>\n </MotionConfig>\n </AccordionContext.Provider>\n </StyledAccordion>\n );\n};\n\nAccordion.displayName = 'Accordion';\n\nexport default Accordion;\n"],"file":"Accordion.js"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/accordion/accordion-body/AccordionBody.tsx"],"names":["AccordionBody","children","height","opacity","
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/accordion/accordion-body/AccordionBody.tsx"],"names":["AccordionBody","children","height","opacity","displayName"],"mappings":";;;;;;;AAAA;;AACA;;;;AAEA,IAAMA,aAAiB,GAAG,SAApBA,aAAoB;AAAA,MAAGC,QAAH,QAAGA,QAAH;AAAA,sBACtB,6BAAC,wCAAD;AACI,IAAA,OAAO,EAAE;AAAEC,MAAAA,MAAM,EAAE,MAAV;AAAkBC,MAAAA,OAAO,EAAE;AAA3B,KADb;AAEI,IAAA,SAAS,EAAC,4BAFd;AAGI,IAAA,IAAI,EAAE;AAAED,MAAAA,MAAM,EAAE,CAAV;AAAaC,MAAAA,OAAO,EAAE;AAAtB,KAHV;AAII,IAAA,OAAO,EAAE;AAAED,MAAAA,MAAM,EAAE,CAAV;AAAaC,MAAAA,OAAO,EAAE;AAAtB;AAJb,KAMKF,QANL,CADsB;AAAA,CAA1B;;AAWAD,aAAa,CAACI,WAAd,GAA4B,eAA5B;eAEeJ,a","sourcesContent":["import React, { FC } from 'react';\nimport { StyledMotionAccordionBody } from './AccordionBody.styles';\n\nconst AccordionBody: FC = ({ children }) => (\n <StyledMotionAccordionBody\n animate={{ height: 'auto', opacity: 1 }}\n className=\"beta-chayns-accordion-body\"\n exit={{ height: 0, opacity: 0 }}\n initial={{ height: 0, opacity: 0 }}\n >\n {children}\n </StyledMotionAccordionBody>\n);\n\nAccordionBody.displayName = 'AccordionBody';\n\nexport default AccordionBody;\n"],"file":"AccordionBody.js"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FC, MouseEventHandler, ReactNode } from 'react';
|
|
1
|
+
import { ChangeEventHandler, FC, MouseEventHandler, ReactNode } from 'react';
|
|
2
2
|
declare type AccordionHeadProps = {
|
|
3
3
|
icon?: string;
|
|
4
4
|
isOpen: boolean;
|
|
@@ -6,7 +6,10 @@ declare type AccordionHeadProps = {
|
|
|
6
6
|
isTitleGreyed: boolean;
|
|
7
7
|
isWrapped: boolean;
|
|
8
8
|
onClick: MouseEventHandler<HTMLDivElement>;
|
|
9
|
+
onSearchChange?: ChangeEventHandler<HTMLInputElement>;
|
|
9
10
|
rightElement?: ReactNode;
|
|
11
|
+
searchIcon?: string[];
|
|
12
|
+
searchPlaceholder?: string;
|
|
10
13
|
title: string;
|
|
11
14
|
titleElement?: ReactNode;
|
|
12
15
|
};
|
|
@@ -42,7 +42,10 @@ var AccordionHead = function AccordionHead(_ref) {
|
|
|
42
42
|
isTitleGreyed = _ref.isTitleGreyed,
|
|
43
43
|
isWrapped = _ref.isWrapped,
|
|
44
44
|
onClick = _ref.onClick,
|
|
45
|
+
onSearchChange = _ref.onSearchChange,
|
|
45
46
|
rightElement = _ref.rightElement,
|
|
47
|
+
searchIcon = _ref.searchIcon,
|
|
48
|
+
searchPlaceholder = _ref.searchPlaceholder,
|
|
46
49
|
title = _ref.title,
|
|
47
50
|
titleElement = _ref.titleElement;
|
|
48
51
|
|
|
@@ -55,6 +58,7 @@ var AccordionHead = function AccordionHead(_ref) {
|
|
|
55
58
|
setHeadHeight = _useState2[1];
|
|
56
59
|
|
|
57
60
|
var titleWrapperRef = (0, _react.useRef)(null);
|
|
61
|
+
var hasSearchIcon = Array.isArray(searchIcon);
|
|
58
62
|
(0, _react.useEffect)(function () {
|
|
59
63
|
var _titleWrapperRef$curr, _titleWrapperRef$curr2;
|
|
60
64
|
|
|
@@ -69,54 +73,82 @@ var AccordionHead = function AccordionHead(_ref) {
|
|
|
69
73
|
height: isOpen ? headHeight.open : headHeight.closed
|
|
70
74
|
},
|
|
71
75
|
className: "beta-chayns-accordion-head",
|
|
72
|
-
initial: false
|
|
73
|
-
transition: {
|
|
74
|
-
type: 'tween'
|
|
75
|
-
}
|
|
76
|
+
initial: false
|
|
76
77
|
}, /*#__PURE__*/_react.default.createElement(_AccordionHead.StyledMotionIconWrapper, {
|
|
77
78
|
animate: {
|
|
78
79
|
rotate: isOpen || isFixed ? 90 : 0
|
|
79
80
|
},
|
|
80
81
|
initial: false,
|
|
81
|
-
onClick: !isFixed ? onClick : undefined
|
|
82
|
-
transition: {
|
|
83
|
-
type: 'tween'
|
|
84
|
-
}
|
|
82
|
+
onClick: !isFixed ? onClick : undefined
|
|
85
83
|
}, /*#__PURE__*/_react.default.createElement(_Icon.default, {
|
|
86
84
|
icons: [isFixed ? 'fa fa-horizontal-rule' : icon !== null && icon !== void 0 ? icon : 'fa fa-chevron-right']
|
|
87
|
-
})), /*#__PURE__*/_react.default.createElement(_AccordionHead.
|
|
85
|
+
})), /*#__PURE__*/_react.default.createElement(_AccordionHead.StyledMotionContentWrapper, {
|
|
88
86
|
animate: {
|
|
89
87
|
opacity: isTitleGreyed ? 0.5 : 1
|
|
90
88
|
},
|
|
91
89
|
initial: false,
|
|
92
90
|
onClick: !isFixed ? onClick : undefined,
|
|
93
|
-
ref: titleWrapperRef
|
|
94
|
-
|
|
95
|
-
type: 'tween'
|
|
96
|
-
}
|
|
97
|
-
}, /*#__PURE__*/_react.default.createElement(_framerMotion.AnimatePresence, {
|
|
91
|
+
ref: titleWrapperRef
|
|
92
|
+
}, /*#__PURE__*/_react.default.createElement(_framerMotion.AnimateSharedLayout, null, /*#__PURE__*/_react.default.createElement(_AccordionHead.StyledMotionTitleWrapper, null, /*#__PURE__*/_react.default.createElement(_framerMotion.AnimatePresence, {
|
|
98
93
|
initial: false
|
|
99
94
|
}, /*#__PURE__*/_react.default.createElement(_AccordionHead.StyledMotionTitle, {
|
|
100
95
|
animate: {
|
|
101
|
-
opacity: 1,
|
|
102
96
|
scale: 1
|
|
103
97
|
},
|
|
98
|
+
initial: {
|
|
99
|
+
scale: isOpen && !isWrapped ? 1 / 1.3 : 1.3
|
|
100
|
+
},
|
|
101
|
+
isOpen: isOpen,
|
|
102
|
+
isWrapped: isWrapped,
|
|
103
|
+
key: isOpen && !isWrapped ? 'accordionHeadTitleBig' : 'accordionHeadTitle'
|
|
104
|
+
}, title))), titleElement && /*#__PURE__*/_react.default.createElement(_AccordionHead.StyledMotionTitleElementWrapper, {
|
|
105
|
+
layout: true
|
|
106
|
+
}, titleElement))), (typeof onSearchChange === 'function' || rightElement) && /*#__PURE__*/_react.default.createElement(_AccordionHead.StyledRightWrapper, null, /*#__PURE__*/_react.default.createElement(_framerMotion.AnimatePresence, {
|
|
107
|
+
initial: false
|
|
108
|
+
}, typeof onSearchChange === 'function' && isOpen ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_AccordionHead.StyledMotionRightInput, {
|
|
109
|
+
animate: {
|
|
110
|
+
opacity: 1,
|
|
111
|
+
width: 'auto'
|
|
112
|
+
},
|
|
113
|
+
autoComplete: "off",
|
|
104
114
|
exit: {
|
|
105
115
|
opacity: 0,
|
|
106
|
-
|
|
107
|
-
scale: isOpen && !isWrapped ? 1 / 1.3 : 1.3
|
|
116
|
+
width: 0
|
|
108
117
|
},
|
|
118
|
+
hasIcon: hasSearchIcon,
|
|
109
119
|
initial: {
|
|
110
120
|
opacity: 0,
|
|
111
|
-
|
|
121
|
+
width: 0
|
|
112
122
|
},
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
123
|
+
key: "rightInput",
|
|
124
|
+
onChange: onSearchChange,
|
|
125
|
+
placeholder: searchPlaceholder,
|
|
126
|
+
type: "text"
|
|
127
|
+
}), hasSearchIcon && /*#__PURE__*/_react.default.createElement(_AccordionHead.StyledMotionRightInputIconWrapper, {
|
|
128
|
+
animate: {
|
|
129
|
+
opacity: 1
|
|
130
|
+
},
|
|
131
|
+
exit: {
|
|
132
|
+
opacity: 0
|
|
133
|
+
},
|
|
134
|
+
initial: {
|
|
135
|
+
opacity: 0
|
|
136
|
+
},
|
|
137
|
+
key: "rightInputIcon"
|
|
138
|
+
}, /*#__PURE__*/_react.default.createElement(_Icon.default, {
|
|
139
|
+
icons: searchIcon
|
|
140
|
+
}))) : /*#__PURE__*/_react.default.createElement(_AccordionHead.StyledMotionRightElementWrapper, {
|
|
141
|
+
animate: {
|
|
142
|
+
opacity: 1
|
|
143
|
+
},
|
|
144
|
+
exit: {
|
|
145
|
+
opacity: 0
|
|
146
|
+
},
|
|
147
|
+
initial: {
|
|
148
|
+
opacity: 0
|
|
149
|
+
},
|
|
150
|
+
key: "rightElementWrapper"
|
|
151
|
+
}, rightElement))));
|
|
120
152
|
};
|
|
121
153
|
|
|
122
154
|
AccordionHead.displayName = 'AccordionHead';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/accordion/accordion-head/AccordionHead.tsx"],"names":["AccordionHead","icon","isOpen","isFixed","isTitleGreyed","isWrapped","onClick","rightElement","title","titleElement","closed","open","headHeight","setHeadHeight","titleWrapperRef","width","current","clientWidth","height","type","rotate","undefined","opacity","scale","position","displayName"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;AA0BA,IAAMA,aAAqC,GAAG,SAAxCA,aAAwC,OAUxC;AAAA,MATFC,IASE,QATFA,IASE;AAAA,MARFC,MAQE,QARFA,MAQE;AAAA,MAPFC,OAOE,QAPFA,OAOE;AAAA,MANFC,aAME,QANFA,aAME;AAAA,MALFC,SAKE,QALFA,SAKE;AAAA,MAJFC,OAIE,QAJFA,OAIE;AAAA,MAHFC,YAGE,QAHFA,YAGE;AAAA,MAFFC,KAEE,QAFFA,KAEE;AAAA,MADFC,YACE,QADFA,YACE;;AACF,kBAAoC,qBAAqB;AACrDC,IAAAA,MAAM,EAAEL,SAAS,GAAG,EAAH,GAAQ,EAD4B;AAErDM,IAAAA,IAAI,EAAEN,SAAS,GAAG,EAAH,GAAQ;AAF8B,GAArB,CAApC;AAAA;AAAA,MAAOO,UAAP;AAAA,MAAmBC,aAAnB;;AAIA,MAAMC,eAAe,GAAG,mBAAuB,IAAvB,CAAxB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T;AAKI,IAAA,UAAU,EAAE;AAAEK,MAAAA,IAAI,EAAE;AAAR;AALhB,kBAOI,6BAAC,6BAAD;AAAiB,IAAA,OAAO,EAAE;AAA1B,kBACI,6BAAC,gCAAD;AACI,IAAA,OAAO,EAAE;AAAEG,MAAAA,OAAO,EAAE,CAAX;AAAcC,MAAAA,KAAK,EAAE;AAArB,KADb;AAEI,IAAA,IAAI,EAAE;AACFD,MAAAA,OAAO,EAAE,CADP;AAEFE,MAAAA,QAAQ,EAAE,UAFR;AAGFD,MAAAA,KAAK,EAAErB,MAAM,IAAI,CAACG,SAAX,GAAuB,IAAI,GAA3B,GAAiC;AAHtC,KAFV;AAOI,IAAA,OAAO,EAAE;AAAEiB,MAAAA,OAAO,EAAE,CAAX;AAAcC,MAAAA,KAAK,EAAErB,MAAM,IAAI,CAACG,SAAX,GAAuB,IAAI,GAA3B,GAAiC;AAAtD,KAPb;AAQI,IAAA,MAAM,EAAEH,MARZ;AASI,IAAA,SAAS,EAAEG,SATf;AAUI,IAAA,GAAG,EAAEH,MAAM,IAAI,CAACG,SAAX,GAAuB,uBAAvB,GAAiD,oBAV1D;AAWI,IAAA,UAAU,EAAE;AAAEc,MAAAA,IAAI,EAAE;AAAR;AAXhB,KAaKX,KAbL,CADJ,CAPJ,EAwBKC,YAAY,iBACT,6BAAC,wCAAD,QAA4BA,YAA5B,CAzBR,CAdJ,EA0CKF,YAAY,iBAAI,6BAAC,iCAAD,QAAqBA,YAArB,CA1CrB,CADJ;AA8CH,CAzED;;AA2EAP,aAAa,CAACyB,WAAd,GAA4B,eAA5B;eAEezB,a","sourcesContent":["import { AnimatePresence } from 'framer-motion';\nimport React, { FC, MouseEventHandler, ReactNode, useEffect, useRef, useState } from 'react';\nimport Icon from '../../icon/Icon';\nimport { getAccordionHeadHeight } from '../utils';\nimport {\n StyledMotionAccordionHead,\n StyledMotionIconWrapper,\n StyledMotionTitle,\n StyledMotionTitleWrapper,\n StyledRightWrapper,\n StyledTitleElementWrapper,\n} from './AccordionHead.styles';\n\ntype AccordionHeadProps = {\n icon?: string;\n isOpen: boolean;\n isFixed: boolean;\n isTitleGreyed: boolean;\n isWrapped: boolean;\n onClick: MouseEventHandler<HTMLDivElement>;\n rightElement?: ReactNode;\n title: string;\n titleElement?: ReactNode;\n};\n\ninterface HeadHeight {\n closed: number;\n open: number;\n}\n\nconst AccordionHead: FC<AccordionHeadProps> = ({\n icon,\n isOpen,\n isFixed,\n isTitleGreyed,\n isWrapped,\n onClick,\n rightElement,\n title,\n titleElement,\n}) => {\n const [headHeight, setHeadHeight] = useState<HeadHeight>({\n closed: isWrapped ? 40 : 33,\n open: isWrapped ? 40 : 33,\n });\n const titleWrapperRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n setHeadHeight(\n getAccordionHeadHeight({\n isWrapped,\n title,\n width: (titleWrapperRef.current?.clientWidth ?? 0) - 10,\n })\n );\n }, [isWrapped, title]);\n\n return (\n <StyledMotionAccordionHead\n animate={{ height: isOpen ? headHeight.open : headHeight.closed }}\n className=\"beta-chayns-accordion-head\"\n initial={false}\n transition={{ type: 'tween' }}\n >\n <StyledMotionIconWrapper\n animate={{ rotate: isOpen || isFixed ? 90 : 0 }}\n initial={false}\n onClick={!isFixed ? onClick : undefined}\n transition={{ type: 'tween' }}\n >\n <Icon icons={[isFixed ? 'fa fa-horizontal-rule' : icon ?? 'fa fa-chevron-right']} />\n </StyledMotionIconWrapper>\n <StyledMotionTitleWrapper\n animate={{ opacity: isTitleGreyed ? 0.5 : 1 }}\n initial={false}\n onClick={!isFixed ? onClick : undefined}\n ref={titleWrapperRef}\n transition={{ type: 'tween' }}\n >\n <AnimatePresence initial={false}>\n <StyledMotionTitle\n animate={{ opacity: 1, scale: 1 }}\n exit={{\n opacity: 0,\n position: 'absolute',\n scale: isOpen && !isWrapped ? 1 / 1.3 : 1.3,\n }}\n initial={{ opacity: 0, scale: isOpen && !isWrapped ? 1 / 1.3 : 1.3 }}\n isOpen={isOpen}\n isWrapped={isWrapped}\n key={isOpen && !isWrapped ? 'accordionHeadTitleBig' : 'accordionHeadTitle'}\n transition={{ type: 'tween' }}\n >\n {title}\n </StyledMotionTitle>\n </AnimatePresence>\n {titleElement && (\n <StyledTitleElementWrapper>{titleElement}</StyledTitleElementWrapper>\n )}\n </StyledMotionTitleWrapper>\n {rightElement && <StyledRightWrapper>{rightElement}</StyledRightWrapper>}\n </StyledMotionAccordionHead>\n );\n};\n\nAccordionHead.displayName = 'AccordionHead';\n\nexport default AccordionHead;\n"],"file":"AccordionHead.js"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/accordion/accordion-head/AccordionHead.tsx"],"names":["AccordionHead","icon","isOpen","isFixed","isTitleGreyed","isWrapped","onClick","onSearchChange","rightElement","searchIcon","searchPlaceholder","title","titleElement","closed","open","headHeight","setHeadHeight","titleWrapperRef","hasSearchIcon","Array","isArray","width","current","clientWidth","height","rotate","undefined","opacity","scale","displayName"],"mappings":";;;;;;;;;AAAA;;AACA;;AASA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;AAiCA,IAAMA,aAAqC,GAAG,SAAxCA,aAAwC,OAaxC;AAAA,MAZFC,IAYE,QAZFA,IAYE;AAAA,MAXFC,MAWE,QAXFA,MAWE;AAAA,MAVFC,OAUE,QAVFA,OAUE;AAAA,MATFC,aASE,QATFA,aASE;AAAA,MARFC,SAQE,QARFA,SAQE;AAAA,MAPFC,OAOE,QAPFA,OAOE;AAAA,MANFC,cAME,QANFA,cAME;AAAA,MALFC,YAKE,QALFA,YAKE;AAAA,MAJFC,UAIE,QAJFA,UAIE;AAAA,MAHFC,iBAGE,QAHFA,iBAGE;AAAA,MAFFC,KAEE,QAFFA,KAEE;AAAA,MADFC,YACE,QADFA,YACE;;AACF,kBAAoC,qBAAqB;AACrDC,IAAAA,MAAM,EAAER,SAAS,GAAG,EAAH,GAAQ,EAD4B;AAErDS,IAAAA,IAAI,EAAET,SAAS,GAAG,EAAH,GAAQ;AAF8B,GAArB,CAApC;AAAA;A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IAAA,IAAI,EAAC;AATT,IADJ,EAYKQ,aAAa,iBACV,6BAAC,gDAAD;AACI,IAAA,OAAO,EAAE;AAAES,MAAAA,OAAO,EAAE;AAAX,KADb;AAEI,IAAA,IAAI,EAAE;AAAEA,MAAAA,OAAO,EAAE;AAAX,KAFV;AAGI,IAAA,OAAO,EAAE;AAAEA,MAAAA,OAAO,EAAE;AAAX,KAHb;AAII,IAAA,GAAG,EAAC;AAJR,kBAMI,6BAAC,aAAD;AAAM,IAAA,KAAK,EAAElB;AAAb,IANJ,CAbR,CADH,gBAyBG,6BAAC,8CAAD;AACI,IAAA,OAAO,EAAE;AAAEkB,MAAAA,OAAO,EAAE;AAAX,KADb;AAEI,IAAA,IAAI,EAAE;AAAEA,MAAAA,OAAO,EAAE;AAAX,KAFV;AAGI,IAAA,OAAO,EAAE;AAAEA,MAAAA,OAAO,EAAE;AAAX,KAHb;AAII,IAAA,GAAG,EAAC;AAJR,KAMKnB,YANL,CA1BR,CADJ,CA5CR,CADJ;AAsFH,CAvHD;;AAyHAR,aAAa,CAAC6B,WAAd,GAA4B,eAA5B;eAEe7B,a","sourcesContent":["import { AnimatePresence, AnimateSharedLayout } from 'framer-motion';\nimport React, {\n ChangeEventHandler,\n FC,\n MouseEventHandler,\n ReactNode,\n useEffect,\n useRef,\n useState,\n} from 'react';\nimport Icon from '../../icon/Icon';\nimport { getAccordionHeadHeight } from '../utils';\nimport {\n StyledMotionAccordionHead,\n StyledMotionContentWrapper,\n StyledMotionIconWrapper,\n StyledMotionRightElementWrapper,\n StyledMotionRightInput,\n StyledMotionRightInputIconWrapper,\n StyledMotionTitle,\n StyledMotionTitleElementWrapper,\n StyledMotionTitleWrapper,\n StyledRightWrapper,\n} from './AccordionHead.styles';\n\ntype AccordionHeadProps = {\n icon?: string;\n isOpen: boolean;\n isFixed: boolean;\n isTitleGreyed: boolean;\n isWrapped: boolean;\n onClick: MouseEventHandler<HTMLDivElement>;\n onSearchChange?: ChangeEventHandler<HTMLInputElement>;\n rightElement?: ReactNode;\n searchIcon?: string[];\n searchPlaceholder?: string;\n title: string;\n titleElement?: ReactNode;\n};\n\ninterface HeadHeight {\n closed: number;\n open: number;\n}\n\nconst AccordionHead: FC<AccordionHeadProps> = ({\n icon,\n isOpen,\n isFixed,\n isTitleGreyed,\n isWrapped,\n onClick,\n onSearchChange,\n rightElement,\n searchIcon,\n searchPlaceholder,\n title,\n titleElement,\n}) => {\n const [headHeight, setHeadHeight] = useState<HeadHeight>({\n closed: isWrapped ? 40 : 33,\n open: isWrapped ? 40 : 33,\n });\n\n const titleWrapperRef = useRef<HTMLDivElement>(null);\n\n const hasSearchIcon = Array.isArray(searchIcon);\n\n useEffect(() => {\n setHeadHeight(\n getAccordionHeadHeight({\n isWrapped,\n title,\n width: (titleWrapperRef.current?.clientWidth ?? 0) - 10,\n })\n );\n }, [isWrapped, title]);\n\n return (\n <StyledMotionAccordionHead\n animate={{ height: isOpen ? headHeight.open : headHeight.closed }}\n className=\"beta-chayns-accordion-head\"\n initial={false}\n >\n <StyledMotionIconWrapper\n animate={{ rotate: isOpen || isFixed ? 90 : 0 }}\n initial={false}\n onClick={!isFixed ? onClick : undefined}\n >\n <Icon icons={[isFixed ? 'fa fa-horizontal-rule' : icon ?? 'fa fa-chevron-right']} />\n </StyledMotionIconWrapper>\n <StyledMotionContentWrapper\n animate={{ opacity: isTitleGreyed ? 0.5 : 1 }}\n initial={false}\n onClick={!isFixed ? onClick : undefined}\n ref={titleWrapperRef}\n >\n <AnimateSharedLayout>\n <StyledMotionTitleWrapper>\n <AnimatePresence initial={false}>\n <StyledMotionTitle\n animate={{ scale: 1 }}\n initial={{ scale: isOpen && !isWrapped ? 1 / 1.3 : 1.3 }}\n isOpen={isOpen}\n isWrapped={isWrapped}\n key={\n isOpen && !isWrapped\n ? 'accordionHeadTitleBig'\n : 'accordionHeadTitle'\n }\n >\n {title}\n </StyledMotionTitle>\n </AnimatePresence>\n </StyledMotionTitleWrapper>\n {titleElement && (\n <StyledMotionTitleElementWrapper layout>\n {titleElement}\n </StyledMotionTitleElementWrapper>\n )}\n </AnimateSharedLayout>\n </StyledMotionContentWrapper>\n {(typeof onSearchChange === 'function' || rightElement) && (\n <StyledRightWrapper>\n <AnimatePresence initial={false}>\n {typeof onSearchChange === 'function' && isOpen ? (\n <>\n <StyledMotionRightInput\n animate={{ opacity: 1, width: 'auto' }}\n autoComplete=\"off\"\n exit={{ opacity: 0, width: 0 }}\n hasIcon={hasSearchIcon}\n initial={{ opacity: 0, width: 0 }}\n key=\"rightInput\"\n onChange={onSearchChange}\n placeholder={searchPlaceholder}\n type=\"text\"\n />\n {hasSearchIcon && (\n <StyledMotionRightInputIconWrapper\n animate={{ opacity: 1 }}\n exit={{ opacity: 0 }}\n initial={{ opacity: 0 }}\n key=\"rightInputIcon\"\n >\n <Icon icons={searchIcon} />\n </StyledMotionRightInputIconWrapper>\n )}\n </>\n ) : (\n <StyledMotionRightElementWrapper\n animate={{ opacity: 1 }}\n exit={{ opacity: 0 }}\n initial={{ opacity: 0 }}\n key=\"rightElementWrapper\"\n >\n {rightElement}\n </StyledMotionRightElementWrapper>\n )}\n </AnimatePresence>\n </StyledRightWrapper>\n )}\n </StyledMotionAccordionHead>\n );\n};\n\nAccordionHead.displayName = 'AccordionHead';\n\nexport default AccordionHead;\n"],"file":"AccordionHead.js"}
|
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
export declare const StyledMotionAccordionHead: import("styled-components").StyledComponent<import("framer-motion").ForwardRefComponent<HTMLDivElement, import("framer-motion").HTMLMotionProps<"div">>, any, {}, never>;
|
|
2
2
|
export declare const StyledMotionIconWrapper: import("styled-components").StyledComponent<import("framer-motion").ForwardRefComponent<HTMLDivElement, import("framer-motion").HTMLMotionProps<"div">>, any, {}, never>;
|
|
3
|
+
export declare const StyledMotionContentWrapper: import("styled-components").StyledComponent<import("framer-motion").ForwardRefComponent<HTMLDivElement, import("framer-motion").HTMLMotionProps<"div">>, any, {}, never>;
|
|
3
4
|
export declare const StyledMotionTitleWrapper: import("styled-components").StyledComponent<import("framer-motion").ForwardRefComponent<HTMLDivElement, import("framer-motion").HTMLMotionProps<"div">>, any, {}, never>;
|
|
4
5
|
interface StyledMotionTitleProps {
|
|
5
6
|
isOpen: boolean;
|
|
6
7
|
isWrapped: boolean;
|
|
7
8
|
}
|
|
8
9
|
export declare const StyledMotionTitle: import("styled-components").StyledComponent<import("framer-motion").ForwardRefComponent<HTMLDivElement, import("framer-motion").HTMLMotionProps<"div">>, any, StyledMotionTitleProps, never>;
|
|
9
|
-
export declare const
|
|
10
|
+
export declare const StyledMotionTitleElementWrapper: import("styled-components").StyledComponent<import("framer-motion").ForwardRefComponent<HTMLDivElement, import("framer-motion").HTMLMotionProps<"div">>, any, {}, never>;
|
|
10
11
|
export declare const StyledRightWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
12
|
+
export declare const StyledMotionRightElementWrapper: import("styled-components").StyledComponent<import("framer-motion").ForwardRefComponent<HTMLDivElement, import("framer-motion").HTMLMotionProps<"div">>, any, {}, never>;
|
|
13
|
+
export declare const StyledMotionRightInput: import("styled-components").StyledComponent<import("framer-motion").ForwardRefComponent<HTMLInputElement, import("framer-motion").HTMLMotionProps<"input">>, any, {
|
|
14
|
+
hasIcon: boolean;
|
|
15
|
+
} & {
|
|
16
|
+
theme: import("../../color-scheme-provider/ColorSchemeProvider").Theme;
|
|
17
|
+
}, never>;
|
|
18
|
+
export declare const StyledMotionRightInputIconWrapper: import("styled-components").StyledComponent<import("framer-motion").ForwardRefComponent<HTMLDivElement, import("framer-motion").HTMLMotionProps<"div">>, any, {}, never>;
|
|
11
19
|
export {};
|
|
@@ -5,13 +5,13 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.
|
|
8
|
+
exports.StyledRightWrapper = exports.StyledMotionTitleWrapper = exports.StyledMotionTitleElementWrapper = exports.StyledMotionTitle = exports.StyledMotionRightInputIconWrapper = exports.StyledMotionRightInput = exports.StyledMotionRightElementWrapper = exports.StyledMotionIconWrapper = exports.StyledMotionContentWrapper = exports.StyledMotionAccordionHead = void 0;
|
|
9
9
|
|
|
10
10
|
var _framerMotion = require("framer-motion");
|
|
11
11
|
|
|
12
12
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
13
13
|
|
|
14
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7;
|
|
14
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11;
|
|
15
15
|
|
|
16
16
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
17
17
|
|
|
@@ -29,12 +29,14 @@ var StyledMotionIconWrapper = (0, _styledComponents.default)(_framerMotion.motio
|
|
|
29
29
|
return typeof onClick === 'function' ? 'pointer' : 'default';
|
|
30
30
|
});
|
|
31
31
|
exports.StyledMotionIconWrapper = StyledMotionIconWrapper;
|
|
32
|
-
var
|
|
32
|
+
var StyledMotionContentWrapper = (0, _styledComponents.default)(_framerMotion.motion.div)(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n align-self: flex-start;\n cursor: ", ";\n display: flex;\n flex: 1 1 auto;\n height: 100%;\n overflow: hidden;\n margin-right: 10px;\n"])), function (_ref3) {
|
|
33
33
|
var onClick = _ref3.onClick;
|
|
34
34
|
return typeof onClick === 'function' ? 'pointer' : 'default';
|
|
35
35
|
});
|
|
36
|
+
exports.StyledMotionContentWrapper = StyledMotionContentWrapper;
|
|
37
|
+
var StyledMotionTitleWrapper = (0, _styledComponents.default)(_framerMotion.motion.div)(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n display: grid;\n flex: 0 1 auto;\n grid-template-areas: 'header';\n"])));
|
|
36
38
|
exports.StyledMotionTitleWrapper = StyledMotionTitleWrapper;
|
|
37
|
-
var StyledMotionTitle = (0, _styledComponents.default)(_framerMotion.motion.div)(
|
|
39
|
+
var StyledMotionTitle = (0, _styledComponents.default)(_framerMotion.motion.div)(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n font-size: ", ";\n font-weight: ", ";\n grid-area: header;\n height: ", ";\n overflow: hidden;\n text-overflow: ellipsis;\n transform-origin: top left;\n user-select: none;\n white-space: ", ";\n\n ", "\n"])), function (_ref4) {
|
|
38
40
|
var isOpen = _ref4.isOpen,
|
|
39
41
|
isWrapped = _ref4.isWrapped;
|
|
40
42
|
return isOpen && !isWrapped ? '1.3rem' : undefined;
|
|
@@ -51,15 +53,25 @@ var StyledMotionTitle = (0, _styledComponents.default)(_framerMotion.motion.div)
|
|
|
51
53
|
return isOpen && !isWrapped ? 'normal' : 'nowrap';
|
|
52
54
|
}, function (_ref8) {
|
|
53
55
|
var isWrapped = _ref8.isWrapped;
|
|
54
|
-
return isWrapped && (0, _styledComponents.css)(
|
|
56
|
+
return isWrapped && (0, _styledComponents.css)(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n align-items: center;\n display: flex;\n "])));
|
|
55
57
|
});
|
|
56
58
|
exports.StyledMotionTitle = StyledMotionTitle;
|
|
59
|
+
var StyledMotionTitleElementWrapper = (0, _styledComponents.default)(_framerMotion.motion.div)(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n align-items: center;\n display: flex;\n margin-left: 8px;\n"])));
|
|
60
|
+
exports.StyledMotionTitleElementWrapper = StyledMotionTitleElementWrapper;
|
|
57
61
|
|
|
58
|
-
var
|
|
59
|
-
|
|
60
|
-
exports.StyledTitleElementWrapper = StyledTitleElementWrapper;
|
|
61
|
-
|
|
62
|
-
var StyledRightWrapper = _styledComponents.default.div(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n display: flex;\n flex: 0 0 auto;\n flex-direction: column;\n justify-content: center;\n margin-right: 5px;\n overflow: hidden;\n"])));
|
|
62
|
+
var StyledRightWrapper = _styledComponents.default.div(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n display: grid;\n flex: 0 0 auto;\n grid-template-areas: 'right';\n margin-right: 5px;\n overflow: hidden;\n position: relative;\n"])));
|
|
63
63
|
|
|
64
64
|
exports.StyledRightWrapper = StyledRightWrapper;
|
|
65
|
+
var StyledMotionRightElementWrapper = (0, _styledComponents.default)(_framerMotion.motion.div)(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n align-items: center;\n display: flex;\n grid-area: header;\n justify-content: flex-end;\n"])));
|
|
66
|
+
exports.StyledMotionRightElementWrapper = StyledMotionRightElementWrapper;
|
|
67
|
+
var StyledMotionRightInput = (0, _styledComponents.default)(_framerMotion.motion.input)(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n border: 1px solid transparent;\n border-bottom-color: rgba(\n ", ",\n 0.45\n );\n grid-area: header;\n padding: ", ";\n"])), function (_ref9) {
|
|
68
|
+
var theme = _ref9.theme;
|
|
69
|
+
return theme['headline-rgb'];
|
|
70
|
+
}, function (_ref10) {
|
|
71
|
+
var hasIcon = _ref10.hasIcon;
|
|
72
|
+
return hasIcon ? '5px 23px 5px 1px' : '5px 1px';
|
|
73
|
+
});
|
|
74
|
+
exports.StyledMotionRightInput = StyledMotionRightInput;
|
|
75
|
+
var StyledMotionRightInputIconWrapper = (0, _styledComponents.default)(_framerMotion.motion.div)(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n align-items: center;\n display: flex;\n height: 100%;\n justify-content: center;\n position: absolute;\n right: 4px;\n top: 0;\n"])));
|
|
76
|
+
exports.StyledMotionRightInputIconWrapper = StyledMotionRightInputIconWrapper;
|
|
65
77
|
//# sourceMappingURL=AccordionHead.styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/accordion/accordion-head/AccordionHead.styles.ts"],"names":["StyledMotionAccordionHead","motion","div","theme","text","StyledMotionIconWrapper","onClick","StyledMotionTitleWrapper","StyledMotionTitle","isOpen","isWrapped","undefined","css","
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/accordion/accordion-head/AccordionHead.styles.ts"],"names":["StyledMotionAccordionHead","motion","div","theme","text","StyledMotionIconWrapper","onClick","StyledMotionContentWrapper","StyledMotionTitleWrapper","StyledMotionTitle","isOpen","isWrapped","undefined","css","StyledMotionTitleElementWrapper","StyledRightWrapper","styled","StyledMotionRightElementWrapper","StyledMotionRightInput","input","hasIcon","StyledMotionRightInputIconWrapper"],"mappings":";;;;;;;;;AAAA;;AACA;;;;;;;;;;AAKO,IAAMA,yBAAyB,GAAG,+BAAOC,qBAAOC,GAAd,CAAH,oLAEzB;AAAA,MAAGC,KAAH,QAAGA,KAAH;AAAA,SAA+CA,KAAK,CAACC,IAArD;AAAA,CAFyB,CAA/B;;AAQA,IAAMC,uBAAuB,GAAG,+BAAOJ,qBAAOC,GAAd,CAAH,mOAEtB;AAAA,MAAGI,OAAH,SAAGA,OAAH;AAAA,SAAkB,OAAOA,OAAP,KAAmB,UAAnB,GAAgC,SAAhC,GAA4C,SAA9D;AAAA,CAFsB,CAA7B;;AAUA,IAAMC,0BAA0B,GAAG,+BAAON,qBAAOC,GAAd,CAAH,sOAEzB;AAAA,MAAGI,OAAH,SAAGA,OAAH;AAAA,SAAkB,OAAOA,OAAP,KAAmB,UAAnB,GAAgC,SAAhC,GAA4C,SAA9D;AAAA,CAFyB,CAAhC;;AAUA,IAAME,wBAAwB,GAAG,+BAAOP,qBAAOC,GAAd,CAAH,sJAA9B;;AAWA,IAAMO,iBAAiB,GAAG,+BAAOR,qBAAOC,GAAd,CAAH,qTACb;AAAA,MAAGQ,MAAH,SAAGA,MAAH;AAAA,MAAWC,SAAX,SAAWA,SAAX;AAAA,SAA4BD,MAAM,IAAI,CAACC,SAAX,GAAuB,QAAvB,GAAkCC,SAA9D;AAAA,CADa,EAEX;AAAA,MAAGF,MAAH,SAAGA,MAAH;AAAA,MAAWC,SAAX,SAAWA,SAAX;AAAA,SAA4BD,MAAM,IAAIC,SAAV,GAAsB,GAAtB,GAA4B,QAAxD;AAAA,CAFW,EAIhB;AAAA,MAAGA,SAAH,SAAGA,SAAH;AAAA,SAAoBA,SAAS,GAAG,MAAH,GAAYC,SAAzC;AAAA,CAJgB,EASX;AAAA,MAAGF,MAAH,SAAGA,MAAH;AAAA,MAAWC,SAAX,SAAWA,SAAX;AAAA,SAA4BD,MAAM,IAAI,CAACC,SAAX,GAAuB,QAAvB,GAAkC,QAA9D;AAAA,CATW,EAWxB;AAAA,MAAGA,SAAH,SAAGA,SAAH;AAAA,SACEA,SAAS,QACTE,qBADS,gJADX;AAAA,CAXwB,CAAvB;;AAmBA,IAAMC,+BAA+B,GAAG,+BAAOb,qBAAOC,GAAd,CAAH,8IAArC;;;AAMA,IAAMa,kBAAkB,GAAGC,0BAAOd,GAAV,6NAAxB;;;AASA,IAAMe,+BAA+B,GAAG,+BAAOhB,qBAAOC,GAAd,CAAH,+KAArC;;AAWA,IAAMgB,sBAAsB,GAAG,+BAAOjB,qBAAOkB,KAAd,CAAH,iOAGzB;AAAA,MAAGhB,KAAH,SAAGA,KAAH;AAAA,SAA4CA,KAAK,CAAC,cAAD,CAAjD;AAAA,CAHyB,EAOpB;AAAA,MAAGiB,OAAH,UAAGA,OAAH;AAAA,SAAkBA,OAAO,GAAG,kBAAH,GAAwB,SAAjD;AAAA,CAPoB,CAA5B;;AAUA,IAAMC,iCAAiC,GAAG,+BAAOpB,qBAAOC,GAAd,CAAH,iOAAvC","sourcesContent":["import { motion } from 'framer-motion';\nimport styled, { css } from 'styled-components';\nimport type { WithTheme } from '../../color-scheme-provider/ColorSchemeProvider';\n\ntype StyledMotionAccordionHeadProps = WithTheme<unknown>;\n\nexport const StyledMotionAccordionHead = styled(motion.div)`\n align-items: center;\n color: ${({ theme }: StyledMotionAccordionHeadProps) => theme.text};\n display: flex;\n overflow: hidden;\n padding: 4px 0;\n`;\n\nexport const StyledMotionIconWrapper = styled(motion.div)`\n align-items: center;\n cursor: ${({ onClick }) => (typeof onClick === 'function' ? 'pointer' : 'default')};\n display: flex;\n flex: 0 0 auto;\n height: 25px;\n justify-content: center;\n width: 25px;\n`;\n\nexport const StyledMotionContentWrapper = styled(motion.div)`\n align-self: flex-start;\n cursor: ${({ onClick }) => (typeof onClick === 'function' ? 'pointer' : 'default')};\n display: flex;\n flex: 1 1 auto;\n height: 100%;\n overflow: hidden;\n margin-right: 10px;\n`;\n\nexport const StyledMotionTitleWrapper = styled(motion.div)`\n display: grid;\n flex: 0 1 auto;\n grid-template-areas: 'header';\n`;\n\ninterface StyledMotionTitleProps {\n isOpen: boolean;\n isWrapped: boolean;\n}\n\nexport const StyledMotionTitle = styled(motion.div)<StyledMotionTitleProps>`\n font-size: ${({ isOpen, isWrapped }) => (isOpen && !isWrapped ? '1.3rem' : undefined)};\n font-weight: ${({ isOpen, isWrapped }) => (isOpen && isWrapped ? 700 : 'normal')};\n grid-area: header;\n height: ${({ isWrapped }) => (isWrapped ? '100%' : undefined)};\n overflow: hidden;\n text-overflow: ellipsis;\n transform-origin: top left;\n user-select: none;\n white-space: ${({ isOpen, isWrapped }) => (isOpen && !isWrapped ? 'normal' : 'nowrap')};\n\n ${({ isWrapped }) =>\n isWrapped &&\n css`\n align-items: center;\n display: flex;\n `}\n`;\n\nexport const StyledMotionTitleElementWrapper = styled(motion.div)`\n align-items: center;\n display: flex;\n margin-left: 8px;\n`;\n\nexport const StyledRightWrapper = styled.div`\n display: grid;\n flex: 0 0 auto;\n grid-template-areas: 'right';\n margin-right: 5px;\n overflow: hidden;\n position: relative;\n`;\n\nexport const StyledMotionRightElementWrapper = styled(motion.div)`\n align-items: center;\n display: flex;\n grid-area: header;\n justify-content: flex-end;\n`;\n\ntype StyledMotionRightInputProps = WithTheme<{\n hasIcon: boolean;\n}>;\n\nexport const StyledMotionRightInput = styled(motion.input)<StyledMotionRightInputProps>`\n border: 1px solid transparent;\n border-bottom-color: rgba(\n ${({ theme }: StyledMotionRightInputProps) => theme['headline-rgb']},\n 0.45\n );\n grid-area: header;\n padding: ${({ hasIcon }) => (hasIcon ? '5px 23px 5px 1px' : '5px 1px')};\n`;\n\nexport const StyledMotionRightInputIconWrapper = styled(motion.div)`\n align-items: center;\n display: flex;\n height: 100%;\n justify-content: center;\n position: absolute;\n right: 4px;\n top: 0;\n`;\n"],"file":"AccordionHead.styles.js"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
var _AccordionIntro = require("./AccordionIntro.styles");
|
|
11
|
+
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
|
|
14
|
+
var AccordionIntro = function AccordionIntro(_ref) {
|
|
15
|
+
var children = _ref.children;
|
|
16
|
+
return /*#__PURE__*/_react.default.createElement(_AccordionIntro.StyledAccordionIntro, {
|
|
17
|
+
className: "beta-chayns-accordion-intro"
|
|
18
|
+
}, children);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
AccordionIntro.displayName = 'AccordionIntro';
|
|
22
|
+
var _default = AccordionIntro;
|
|
23
|
+
exports.default = _default;
|
|
24
|
+
//# sourceMappingURL=AccordionIntro.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/accordion/accordion-intro/AccordionIntro.tsx"],"names":["AccordionIntro","children","displayName"],"mappings":";;;;;;;AAAA;;AACA;;;;AAEA,IAAMA,cAAkB,GAAG,SAArBA,cAAqB;AAAA,MAAGC,QAAH,QAAGA,QAAH;AAAA,sBACvB,6BAAC,oCAAD;AAAsB,IAAA,SAAS,EAAC;AAAhC,KAA+DA,QAA/D,CADuB;AAAA,CAA3B;;AAIAD,cAAc,CAACE,WAAf,GAA6B,gBAA7B;eAEeF,c","sourcesContent":["import React, { FC } from 'react';\nimport { StyledAccordionIntro } from './AccordionIntro.styles';\n\nconst AccordionIntro: FC = ({ children }) => (\n <StyledAccordionIntro className=\"beta-chayns-accordion-intro\">{children}</StyledAccordionIntro>\n);\n\nAccordionIntro.displayName = 'AccordionIntro';\n\nexport default AccordionIntro;\n"],"file":"AccordionIntro.js"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const StyledAccordionIntro: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.StyledAccordionIntro = void 0;
|
|
7
|
+
|
|
8
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
9
|
+
|
|
10
|
+
var _templateObject;
|
|
11
|
+
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
|
|
14
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
15
|
+
|
|
16
|
+
var StyledAccordionIntro = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n padding: 0 9px 6px;\n"])));
|
|
17
|
+
|
|
18
|
+
exports.StyledAccordionIntro = StyledAccordionIntro;
|
|
19
|
+
//# sourceMappingURL=AccordionIntro.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/accordion/accordion-intro/AccordionIntro.styles.ts"],"names":["StyledAccordionIntro","styled","div"],"mappings":";;;;;;;AAAA;;;;;;;;AAEO,IAAMA,oBAAoB,GAAGC,0BAAOC,GAAV,gGAA1B","sourcesContent":["import styled from 'styled-components';\n\nexport const StyledAccordionIntro = styled.div`\n padding: 0 9px 6px;\n`;\n"],"file":"AccordionIntro.styles.js"}
|
|
@@ -136,7 +136,7 @@ var ContextMenu = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
136
136
|
(0, _react.useEffect)(function () {
|
|
137
137
|
if (isContentShown) {
|
|
138
138
|
document.addEventListener('click', handleDocumentClick, true);
|
|
139
|
-
|
|
139
|
+
window.addEventListener('blur', handleHide);
|
|
140
140
|
|
|
141
141
|
if (typeof onShow === 'function') {
|
|
142
142
|
onShow();
|
|
@@ -147,7 +147,7 @@ var ContextMenu = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
147
147
|
|
|
148
148
|
return function () {
|
|
149
149
|
document.removeEventListener('click', handleDocumentClick, true);
|
|
150
|
-
|
|
150
|
+
window.removeEventListener('blur', handleHide);
|
|
151
151
|
};
|
|
152
152
|
}, [handleDocumentClick, handleHide, isContentShown, onHide, onShow]);
|
|
153
153
|
var portal = (0, _react.useMemo)(function () {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/context-menu/ContextMenu.tsx"],"names":["ContextMenu","ref","alignment","children","container","document","body","coordinates","items","onHide","onShow","x","y","internalCoordinates","setInternalCoordinates","ContextMenuAlignment","TopLeft","internalAlignment","setInternalAlignment","isContentShown","setIsContentShown","uuid","contextMenuContentRef","contextMenuRef","handleHide","handleShow","current","rootElement","querySelector","getBoundingClientRect","childrenHeight","height","childrenWidth","width","BottomRight","TopRight","BottomLeft","handleClick","event","preventDefault","stopPropagation","handleDocumentClick","contains","target","hide","show","addEventListener","removeEventListener","portal","displayName"],"mappings":";;;;;;;;;AAAA;;AACA;;AAWA;;AACA;;AACA;;AACA;;AACA;;AAC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AA,GAAG,wBAAiBa,IAAjB,CAHP;AAII,MAAA,SAAS,EAAEnB,SAAF,aAAEA,SAAF,cAAEA,SAAF,GAAee,iBAJ5B;AAKI,MAAA,GAAG,EAAEK;AALT,MAFR,CADJ,EAYIlB,SAZJ,CADJ;AAAA,GADW,EAgBX,CACIA,SADJ,EAEIG,WAFJ,EAGIM,mBAHJ,EAIII,iBAJJ,EAKIE,cALJ,EAMIX,KANJ,EAOIN,SAPJ,EAQImB,IARJ,CAhBW,CAAf;AA4BA,sBACI,yEACI,6BAAC,8BAAD;AACI,IAAA,SAAS,EAAC,0BADd;AAEI,IAAA,OAAO,EAAEgB,WAFb;AAGI,IAAA,GAAG,EAAEd;AAHT,KAKKpB,QALL,CADJ,EAQK6C,MARL,CADJ;AAYH,CAvJe,CAApB;AA0JAhD,WAAW,CAACiD,WAAZ,GAA0B,aAA1B;eAEejD,W","sourcesContent":["import { AnimatePresence } from 'framer-motion';\nimport React, {\n forwardRef,\n MouseEventHandler,\n ReactNode,\n useCallback,\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { createPortal } from 'react-dom';\nimport { useUuid } from '../../hooks/uuid';\nimport Icon from '../icon/Icon';\nimport { ContextMenuAlignment } from './constants/alignment';\nimport ContextMenuContent from './context-menu-content/ContextMenuContent';\nimport { StyledContextMenu } from './ContextMenu.styles';\n\nexport type ContextMenuCoordinates = {\n x: number;\n y: number;\n};\n\nexport type ContextMenuItem = {\n icons: string[];\n key: string;\n onClick: MouseEventHandler<HTMLDivElement>;\n text: string;\n};\n\ntype ContextMenuRef = {\n hide: VoidFunction;\n show: VoidFunction;\n};\n\ntype ContextMenuProps = {\n /**\n * Optional custom alignment used instead of calculating it using the\n * alignment within the page. The available alignment can be taken from the\n * ContextMenuAlignment enum.\n */\n alignment?: ContextMenuAlignment;\n /**\n * The element over which the content of the `ContextMenu` should be displayed.\n */\n children?: ReactNode;\n /**\n * The element where the content of the `ContextMenu` should be rendered via React Portal.\n */\n container?: Element;\n /**\n * Optional own coordinates to be used instead of calculating the alignment\n * based on the alignment of the children.\n */\n coordinates?: ContextMenuCoordinates;\n /**\n * The items that will be displayed in the content of the `ContextMenu`.\n */\n items: ContextMenuItem[];\n /**\n * Function to be executed when the content of the Context menu has been hidden.\n */\n onHide?: VoidFunction;\n /**\n * Function to be executed when the content of the Context menu has been shown.\n */\n onShow?: VoidFunction;\n};\n\nconst ContextMenu = forwardRef<ContextMenuRef, ContextMenuProps>(\n (\n {\n alignment,\n children = <Icon icons={['ts-ellipsis_v']} />,\n container = document.body,\n coordinates,\n items,\n onHide,\n onShow,\n },\n ref\n ) => {\n const [internalCoordinates, setInternalCoordinates] = useState<ContextMenuCoordinates>({\n x: 0,\n y: 0,\n });\n const [internalAlignment, setInternalAlignment] = useState<ContextMenuAlignment>(\n ContextMenuAlignment.TopLeft\n );\n const [isContentShown, setIsContentShown] = useState(false);\n\n const uuid = useUuid();\n\n const contextMenuContentRef = useRef<HTMLDivElement>(null);\n const contextMenuRef = useRef<HTMLSpanElement>(null);\n\n const handleHide = useCallback(() => {\n setIsContentShown(false);\n }, []);\n\n const handleShow = useCallback(() => {\n if (contextMenuRef.current) {\n const rootElement = document.querySelector('.tapp') || document.body;\n\n const {\n x,\n y,\n height: childrenHeight,\n width: childrenWidth,\n } = contextMenuRef.current.getBoundingClientRect();\n\n setInternalCoordinates({ x: x + childrenWidth / 2, y: y + childrenHeight / 2 });\n\n const { height, width } = rootElement.getBoundingClientRect();\n\n if (x < width / 2) {\n if (y < height / 2) {\n setInternalAlignment(ContextMenuAlignment.BottomRight);\n } else {\n setInternalAlignment(ContextMenuAlignment.TopRight);\n }\n } else if (y < height / 2) {\n setInternalAlignment(ContextMenuAlignment.BottomLeft);\n } else {\n setInternalAlignment(ContextMenuAlignment.TopLeft);\n }\n\n setIsContentShown(true);\n }\n }, []);\n\n const handleClick = useCallback<MouseEventHandler<HTMLDivElement>>(\n (event) => {\n event.preventDefault();\n event.stopPropagation();\n\n handleShow();\n },\n [handleShow]\n );\n\n const handleDocumentClick = useCallback<EventListener>(\n (event) => {\n if (!contextMenuContentRef.current?.contains(event.target as Node)) {\n event.preventDefault();\n event.stopPropagation();\n }\n\n handleHide();\n },\n [handleHide]\n );\n\n useImperativeHandle(\n ref,\n () => ({\n hide: handleHide,\n show: handleShow,\n }),\n [handleHide, handleShow]\n );\n\n useEffect(() => {\n if (isContentShown) {\n document.addEventListener('click', handleDocumentClick, true);\n document.addEventListener('blur', handleHide);\n\n if (typeof onShow === 'function') {\n onShow();\n }\n } else if (typeof onHide === 'function') {\n onHide();\n }\n\n return () => {\n document.removeEventListener('click', handleDocumentClick, true);\n document.removeEventListener('blur', handleHide);\n };\n }, [handleDocumentClick, handleHide, isContentShown, onHide, onShow]);\n\n const portal = useMemo(\n () =>\n createPortal(\n <AnimatePresence initial={false}>\n {isContentShown && (\n <ContextMenuContent\n coordinates={coordinates ?? internalCoordinates}\n items={items}\n key={`contextMenu_${uuid}`}\n alignment={alignment ?? internalAlignment}\n ref={contextMenuContentRef}\n />\n )}\n </AnimatePresence>,\n container\n ),\n [\n container,\n coordinates,\n internalCoordinates,\n internalAlignment,\n isContentShown,\n items,\n alignment,\n uuid,\n ]\n );\n\n return (\n <>\n <StyledContextMenu\n className=\"beta-chayns-context-menu\"\n onClick={handleClick}\n ref={contextMenuRef}\n >\n {children}\n </StyledContextMenu>\n {portal}\n </>\n );\n }\n);\n\nContextMenu.displayName = 'ContextMenu';\n\nexport default ContextMenu;\n"],"file":"ContextMenu.js"}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/context-menu/ContextMenu.tsx"],"names":["ContextMenu","ref","alignment","children","container","document","body","coordinates","items","onHide","onShow","x","y","internalCoordinates","setInternalCoordinates","ContextMenuAlignment","TopLeft","internalAlignment","setInternalAlignment","isContentShown","setIsContentShown","uuid","contextMenuContentRef","contextMenuRef","handleHide","handleShow","current","rootElement","querySelector","getBoundingClientRect","childrenHeight","height","childrenWidth","width","BottomRight","TopRight","BottomLeft","handleClick","event","preventDefault","stopPropagation","handleDocumentClick","contains","target","hide","show","addEventListener","window","removeEventListener","portal","displayName"],"mappings":";;;;;;;;;AAAA;;AACA;;AAWA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;AAqDA,IAAMA,WAAW,gBAAG,uBAChB,gBAUIC,GAVJ,EAWK;AAAA,MATGC,SASH,QATGA,SASH;AAAA,2BARGC,QAQH;AAAA,MARGA,QAQH,2CARc,6BAAC,aAAD;AAAM,IAAA,KAAK,EAAE,CAAC,eAAD;AAAb,IAQd;AAAA,4BAPGC,SAOH;AAAA,MAPGA,SAOH,+BAPeC,QAAQ,CAACC,IAOxB;AAAA,MANGC,WAMH,QANGA,WAMH;AAAA,MALGC,KAKH,QALGA,KAKH;AAAA,MAJGC,MAIH,QAJGA,MAIH;AAAA,MAHGC,MAGH,QAHGA,MAGH;;AACD,kBAAsD,qBAAiC;AACnFC,IAAAA,CAAC,EAAE,CADgF;AAEnFC,IAAAA,CAAC,EAAE;AAFgF,GAAjC,CAAtD;AAAA;AAAA,MAAOC,mBAAP;AAAA,MAA4BC,sBAA5B;;AAIA,mBAAkD,qBAC9CC,gCAAqBC,OADyB,CAAlD;AAAA;AAAA,MAAOC,iBAAP;AAAA,MAA0BC,oBAA1B;;AAGA,mBAA4C,qBAAS,KAAT,CAA5C;AAAA;AAAA,MAAOC,cAAP;AAAA,MAAuBC,iBAAvB;;AAEA,MAAMC,IAAI,GAAG,oBAAb;AAEA,MAAMC,qBAAqB,GAAG,mBAAuB,IAAvB,CAA9B;AACA,MAAMC,cAAc,GAAG,mBAAwB,IAAxB,CAAvB;AAEA,MAAMC,UAAU,GAAG,wBAAY,YAAM;AACjCJ,IAAAA,iBAAiB,CAAC,KAAD,CAAjB;AACH,GAFkB,EAEhB,EAFgB,CAAnB;AAIA,MAAMK,UAAU,GAAG,wBAAY,YAAM;AACjC,QAAIF,cAAc,CAACG,OAAnB,EAA4B;AACxB,UAAMC,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ACK9B,cAAc,iBACX,6BAAC,2BAAD;AACI,MAAA,WAAW,EAAEZ,WAAF,aAAEA,WAAF,cAAEA,WAAF,GAAiBM,mBADhC;AAEI,MAAA,KAAK,EAAEL,KAFX;AAGI,MAAA,GAAG,wBAAiBa,IAAjB,CAHP;AAII,MAAA,SAAS,EAAEnB,SAAF,aAAEA,SAAF,cAAEA,SAAF,GAAee,iBAJ5B;AAKI,MAAA,GAAG,EAAEK;AALT,MAFR,CADJ,EAYIlB,SAZJ,CADJ;AAAA,GADW,EAgBX,CACIA,SADJ,EAEIG,WAFJ,EAGIM,mBAHJ,EAIII,iBAJJ,EAKIE,cALJ,EAMIX,KANJ,EAOIN,SAPJ,EAQImB,IARJ,CAhBW,CAAf;AA4BA,sBACI,yEACI,6BAAC,8BAAD;AACI,IAAA,SAAS,EAAC,0BADd;AAEI,IAAA,OAAO,EAAEgB,WAFb;AAGI,IAAA,GAAG,EAAEd;AAHT,KAKKpB,QALL,CADJ,EAQK8C,MARL,CADJ;AAYH,CAvJe,CAApB;AA0JAjD,WAAW,CAACkD,WAAZ,GAA0B,aAA1B;eAEelD,W","sourcesContent":["import { AnimatePresence } from 'framer-motion';\nimport React, {\n forwardRef,\n MouseEventHandler,\n ReactNode,\n useCallback,\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { createPortal } from 'react-dom';\nimport { useUuid } from '../../hooks/uuid';\nimport Icon from '../icon/Icon';\nimport { ContextMenuAlignment } from './constants/alignment';\nimport ContextMenuContent from './context-menu-content/ContextMenuContent';\nimport { StyledContextMenu } from './ContextMenu.styles';\n\nexport type ContextMenuCoordinates = {\n x: number;\n y: number;\n};\n\nexport type ContextMenuItem = {\n icons: string[];\n key: string;\n onClick: MouseEventHandler<HTMLDivElement>;\n text: string;\n};\n\ntype ContextMenuRef = {\n hide: VoidFunction;\n show: VoidFunction;\n};\n\ntype ContextMenuProps = {\n /**\n * Optional custom alignment used instead of calculating it using the\n * alignment within the page. The available alignment can be taken from the\n * ContextMenuAlignment enum.\n */\n alignment?: ContextMenuAlignment;\n /**\n * The element over which the content of the `ContextMenu` should be displayed.\n */\n children?: ReactNode;\n /**\n * The element where the content of the `ContextMenu` should be rendered via React Portal.\n */\n container?: Element;\n /**\n * Optional own coordinates to be used instead of calculating the alignment\n * based on the alignment of the children.\n */\n coordinates?: ContextMenuCoordinates;\n /**\n * The items that will be displayed in the content of the `ContextMenu`.\n */\n items: ContextMenuItem[];\n /**\n * Function to be executed when the content of the Context menu has been hidden.\n */\n onHide?: VoidFunction;\n /**\n * Function to be executed when the content of the Context menu has been shown.\n */\n onShow?: VoidFunction;\n};\n\nconst ContextMenu = forwardRef<ContextMenuRef, ContextMenuProps>(\n (\n {\n alignment,\n children = <Icon icons={['ts-ellipsis_v']} />,\n container = document.body,\n coordinates,\n items,\n onHide,\n onShow,\n },\n ref\n ) => {\n const [internalCoordinates, setInternalCoordinates] = useState<ContextMenuCoordinates>({\n x: 0,\n y: 0,\n });\n const [internalAlignment, setInternalAlignment] = useState<ContextMenuAlignment>(\n ContextMenuAlignment.TopLeft\n );\n const [isContentShown, setIsContentShown] = useState(false);\n\n const uuid = useUuid();\n\n const contextMenuContentRef = useRef<HTMLDivElement>(null);\n const contextMenuRef = useRef<HTMLSpanElement>(null);\n\n const handleHide = useCallback(() => {\n setIsContentShown(false);\n }, []);\n\n const handleShow = useCallback(() => {\n if (contextMenuRef.current) {\n const rootElement = document.querySelector('.tapp') || document.body;\n\n const {\n x,\n y,\n height: childrenHeight,\n width: childrenWidth,\n } = contextMenuRef.current.getBoundingClientRect();\n\n setInternalCoordinates({ x: x + childrenWidth / 2, y: y + childrenHeight / 2 });\n\n const { height, width } = rootElement.getBoundingClientRect();\n\n if (x < width / 2) {\n if (y < height / 2) {\n setInternalAlignment(ContextMenuAlignment.BottomRight);\n } else {\n setInternalAlignment(ContextMenuAlignment.TopRight);\n }\n } else if (y < height / 2) {\n setInternalAlignment(ContextMenuAlignment.BottomLeft);\n } else {\n setInternalAlignment(ContextMenuAlignment.TopLeft);\n }\n\n setIsContentShown(true);\n }\n }, []);\n\n const handleClick = useCallback<MouseEventHandler<HTMLDivElement>>(\n (event) => {\n event.preventDefault();\n event.stopPropagation();\n\n handleShow();\n },\n [handleShow]\n );\n\n const handleDocumentClick = useCallback<EventListener>(\n (event) => {\n if (!contextMenuContentRef.current?.contains(event.target as Node)) {\n event.preventDefault();\n event.stopPropagation();\n }\n\n handleHide();\n },\n [handleHide]\n );\n\n useImperativeHandle(\n ref,\n () => ({\n hide: handleHide,\n show: handleShow,\n }),\n [handleHide, handleShow]\n );\n\n useEffect(() => {\n if (isContentShown) {\n document.addEventListener('click', handleDocumentClick, true);\n window.addEventListener('blur', handleHide);\n\n if (typeof onShow === 'function') {\n onShow();\n }\n } else if (typeof onHide === 'function') {\n onHide();\n }\n\n return () => {\n document.removeEventListener('click', handleDocumentClick, true);\n window.removeEventListener('blur', handleHide);\n };\n }, [handleDocumentClick, handleHide, isContentShown, onHide, onShow]);\n\n const portal = useMemo(\n () =>\n createPortal(\n <AnimatePresence initial={false}>\n {isContentShown && (\n <ContextMenuContent\n coordinates={coordinates ?? internalCoordinates}\n items={items}\n key={`contextMenu_${uuid}`}\n alignment={alignment ?? internalAlignment}\n ref={contextMenuContentRef}\n />\n )}\n </AnimatePresence>,\n container\n ),\n [\n container,\n coordinates,\n internalCoordinates,\n internalAlignment,\n isContentShown,\n items,\n alignment,\n uuid,\n ]\n );\n\n return (\n <>\n <StyledContextMenu\n className=\"beta-chayns-context-menu\"\n onClick={handleClick}\n ref={contextMenuRef}\n >\n {children}\n </StyledContextMenu>\n {portal}\n </>\n );\n }\n);\n\nContextMenu.displayName = 'ContextMenu';\n\nexport default ContextMenu;\n"],"file":"ContextMenu.js"}
|
|
@@ -125,7 +125,8 @@ var ListItemHead = function ListItemHead(_ref) {
|
|
|
125
125
|
}, isExpandable && /*#__PURE__*/_react.default.createElement(_Icon.default, {
|
|
126
126
|
icons: ['fa fa-chevron-right']
|
|
127
127
|
})), iconOrImageElement, /*#__PURE__*/_react.default.createElement(_ListItemHead.StyledListItemHeadContent, {
|
|
128
|
-
isIconOrImageGiven: iconOrImageElement !== undefined
|
|
128
|
+
isIconOrImageGiven: iconOrImageElement !== undefined,
|
|
129
|
+
isOpen: isOpen
|
|
129
130
|
}, /*#__PURE__*/_react.default.createElement(_ListItemHead.StyledListItemHeadTitle, null, /*#__PURE__*/_react.default.createElement(_ListItemHead.StyledListItemHeadTitleText, {
|
|
130
131
|
className: "ellipsis"
|
|
131
132
|
}, title), rightElements && rightElements.length > 1 && rightElements[0] && /*#__PURE__*/_react.default.createElement(_ListItemHead.StyledListItemHeadTopRightElement, null, rightElements[0])), subtitle && /*#__PURE__*/_react.default.createElement(_ListItemHead.StyledListItemHeadSubtitle, null, /*#__PURE__*/_react.default.createElement(_ListItemHead.StyledListItemHeadSubtitleText, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/components/list/list-item/list-item-head/ListItemHead.tsx"],"names":["ListItemHead","hoverItem","icons","images","isAnyItemExpandable","isExpandable","isOpen","onClick","onLongPress","rightElements","subtitle","shouldShowRoundImage","title","hasLoadedImage","setHasLoadedImage","shouldShowHoverItem","setShouldShowHoverItem","longPressTimeoutRef","handleImageLoaded","handleMouseEnter","handleMouseLeave","handleTouchStart","event","current","window","setTimeout","handleTouchEnd","clearTimeout","iconOrImageElement","gridImages","undefined","rotate","type","length","marginLeft","opacity","width","duration","displayName"],"mappings":";;;;;;;;;AAAA;;AAUA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;AAgCA,IAAMA,YAAmC,GAAG,SAAtCA,YAAsC,OAatC;AAAA,MAZFC,SAYE,QAZFA,SAYE;AAAA,MAXFC,KAWE,QAXFA,KAWE;AAAA,MAVFC,MAUE,QAVFA,MAUE;AAAA,MATFC,mBASE,QATFA,mBASE;AAAA,MARFC,YAQE,QARFA,YAQE;AAAA,MAPFC,MAOE,QAPFA,MAOE;AA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BAAmB,GAAG,CAAH,GAAO,CADjC;AAELoB,MAAAA,OAAO,EAAEpB,mBAAmB,GAAG,CAAH,GAAO,CAF9B;AAGLqB,MAAAA,KAAK,EAAErB,mBAAmB,GAAG,MAAH,GAAY;AAHjC,KADb;AAMI,IAAA,OAAO,EAAE,KANb;AAOI,IAAA,UAAU,EAAE;AAAEsB,MAAAA,QAAQ,EAAE,IAAZ;AAAkBL,MAAAA,IAAI,EAAE;AAAxB;AAPhB,KASK/B,SATL,CA/CR,CADJ;AA8DH,CA5ID;;AA8IAD,YAAY,CAACsC,WAAb,GAA2B,cAA3B;eAEetC,Y","sourcesContent":["import React, {\n FC,\n MouseEventHandler,\n ReactNode,\n TouchEventHandler,\n useCallback,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport GridImage from '../../../grid-image/GridImage';\nimport Icon from '../../../icon/Icon';\nimport {\n StyledListItemHead,\n StyledListItemHeadBottomRightElement,\n StyledListItemHeadContent,\n StyledListItemHeadIcon,\n StyledListItemHeadImage,\n StyledListItemHeadImageWrapper,\n StyledListItemHeadRightElement,\n StyledListItemHeadSubtitle,\n StyledListItemHeadSubtitleText,\n StyledListItemHeadTitle,\n StyledListItemHeadTitleText,\n StyledListItemHeadTopRightElement,\n StyledMotionListItemHeadHoverItem,\n StyledMotionListItemHeadIndicator,\n} from './ListItemHead.styles';\n\ntype ListItemHeadProps = {\n hoverItem?: ReactNode;\n icons?: string[];\n images?: string[];\n isAnyItemExpandable: boolean;\n isExpandable: boolean;\n isOpen: boolean;\n onClick?: MouseEventHandler<HTMLDivElement>;\n onLongPress?: TouchEventHandler<HTMLDivElement>;\n rightElements?: [ReactNode, ...ReactNode[]];\n subtitle?: ReactNode;\n shouldShowRoundImage?: boolean;\n title: ReactNode;\n};\n\nconst ListItemHead: FC<ListItemHeadProps> = ({\n hoverItem,\n icons,\n images,\n isAnyItemExpandable,\n isExpandable,\n isOpen,\n onClick,\n onLongPress,\n rightElements,\n subtitle,\n shouldShowRoundImage,\n title,\n}) => {\n const [hasLoadedImage, setHasLoadedImage] = useState(false);\n const [shouldShowHoverItem, setShouldShowHoverItem] = useState(false);\n\n const longPressTimeoutRef = useRef<number>();\n\n const handleImageLoaded = useCallback(() => {\n setHasLoadedImage(true);\n }, []);\n\n const handleMouseEnter = useCallback(() => setShouldShowHoverItem(true), []);\n\n const handleMouseLeave = useCallback(() => setShouldShowHoverItem(false), []);\n\n const handleTouchStart = useCallback<TouchEventHandler<HTMLDivElement>>(\n (event) => {\n longPressTimeoutRef.current = window.setTimeout(() => {\n if (typeof onLongPress === 'function') {\n onLongPress(event);\n }\n }, 400);\n },\n [onLongPress]\n );\n\n const handleTouchEnd = useCallback(() => {\n clearTimeout(longPressTimeoutRef.current);\n }, []);\n\n const iconOrImageElement = useMemo(() => {\n if (icons) {\n return (\n <StyledListItemHeadIcon>\n <Icon icons={icons} size={22} />\n </StyledListItemHeadIcon>\n );\n }\n\n if (images && images[0] && images[1] && images[2]) {\n const gridImages = [images[0], images[1], images[2]];\n\n return (\n <GridImage\n images={gridImages}\n shouldShowRoundImage={shouldShowRoundImage}\n size={40}\n />\n );\n }\n\n if (images && images[0]) {\n return (\n <StyledListItemHeadImageWrapper shouldShowRoundImage={shouldShowRoundImage}>\n <StyledListItemHeadImage\n isHidden={!hasLoadedImage}\n onLoad={handleImageLoaded}\n src={images[0]}\n />\n </StyledListItemHeadImageWrapper>\n );\n }\n\n return undefined;\n }, [handleImageLoaded, hasLoadedImage, icons, images, shouldShowRoundImage]);\n\n return (\n <StyledListItemHead\n className=\"beta-chayns-list-item-head\"\n isClickable={typeof onClick === 'function' || isExpandable}\n onClick={onClick}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n onTouchStart={typeof onLongPress === 'function' ? handleTouchStart : undefined}\n onTouchEnd={typeof onLongPress === 'function' ? handleTouchEnd : undefined}\n >\n {isAnyItemExpandable && (\n <StyledMotionListItemHeadIndicator\n animate={{ rotate: isOpen ? 90 : 0 }}\n initial={false}\n transition={{ type: 'tween' }}\n >\n {isExpandable && <Icon icons={['fa fa-chevron-right']} />}\n </StyledMotionListItemHeadIndicator>\n )}\n {iconOrImageElement}\n <StyledListItemHeadContent isIconOrImageGiven={iconOrImageElement !== undefined}>\n <StyledListItemHeadTitle>\n <StyledListItemHeadTitleText className=\"ellipsis\">\n {title}\n </StyledListItemHeadTitleText>\n {rightElements && rightElements.length > 1 && rightElements[0] && (\n <StyledListItemHeadTopRightElement>\n {rightElements[0]}\n </StyledListItemHeadTopRightElement>\n )}\n </StyledListItemHeadTitle>\n {subtitle && (\n <StyledListItemHeadSubtitle>\n <StyledListItemHeadSubtitleText className=\"ellipsis\">\n {subtitle}\n </StyledListItemHeadSubtitleText>\n {rightElements && rightElements.length > 1 && rightElements[1] && (\n <StyledListItemHeadBottomRightElement>\n {rightElements[1]}\n </StyledListItemHeadBottomRightElement>\n )}\n </StyledListItemHeadSubtitle>\n )}\n </StyledListItemHeadContent>\n {rightElements?.length === 1 && (\n <StyledListItemHeadRightElement>{rightElements[0]}</StyledListItemHeadRightElement>\n )}\n {hoverItem && (\n <StyledMotionListItemHeadHoverItem\n animate={{\n marginLeft: shouldShowHoverItem ? 8 : 0,\n opacity: shouldShowHoverItem ? 1 : 0,\n width: shouldShowHoverItem ? 'auto' : 0,\n }}\n initial={false}\n transition={{ duration: 0.15, type: 'tween' }}\n >\n {hoverItem}\n </StyledMotionListItemHeadHoverItem>\n )}\n </StyledListItemHead>\n );\n};\n\nListItemHead.displayName = 'ListItemHead';\n\nexport default ListItemHead;\n"],"file":"ListItemHead.js"}
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/list/list-item/list-item-head/ListItemHead.tsx"],"names":["ListItemHead","hoverItem","icons","images","isAnyItemExpandable","isExpandable","isOpen","onClick","onLongPress","rightElements","subtitle","shouldShowRoundImage","title","hasLoadedImage","setHasLoadedImage","shouldShowHoverItem","setShouldShowHoverItem","longPressTimeoutRef","handleImageLoaded","handleMouseEnter","handleMouseLeave","handleTouchStart","event","current","window","setTimeout","handleTouchEnd","clearTimeout","iconOrImageElement","gridImages","undefined","rotate","type","length","marginLeft","opacity","width","duration","displayName"],"mappings":";;;;;;;;;AAAA;;AAUA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;AAgCA,IAAMA,YAAmC,GAAG,SAAtCA,YAAsC,OAatC;AAAA,MAZFC,SAYE,QAZFA,SAYE;AAAA,MAXFC,KAWE,QAXFA,KAWE;AAAA,MAVFC,MAUE,QAVFA,MAUE;AAAA,MATFC,mBASE,QATFA,mBASE;AAAA,MARFC,YAQE,QARFA,YAQE;AAAA,MAPFC,MAOE,QAPFA,MAOE;AAAA,MANFC,OAME,QANFA,OAME;AAAA,MALFC,WAKE,QALFA,WAKE;AAAA,MAJFC,aAIE,QAJFA,aAIE;AAAA,MAHFC,QAGE,QAHFA,QAGE;AAAA,MAFFC,oBAEE,QAFFA,oBAEE;AAAA,MADFC,KACE,QADFA,KACE;;AACF,kBAA4C,qBAAS,KAAT,CAA5C;AAAA;AAAA,MAAOC,cAAP;AAAA,MAAuBC,iBAAvB;;AACA,mBAAsD,qBAAS,KAAT,CAAtD;AAAA;AAAA,MAAOC,mBAAP;AAAA,MAA4BC,sBAA5B;;AAEA,MAAMC,mBAAmB,GAAG,oBAA5B;AAEA,MAAMC,iBAAiB,GAAG,wBAAY,YAAM;AACxCJ,IAAAA,iBAAiB,CAAC,IAAD,CAAjB;AACH,GAFyB,EAEvB,EAFuB,CAA1B;AAIA,MAAMK,gBAAgB,GAAG,wBAAY;AAAA,WAAMH,sBAAsB,CAAC,IAAD,CAA5B;AAAA,GAAZ,EAAgD,EAAhD,CAAzB;AAEA,MAAMI,gBAAgB,GAAG,wBAAY;AAAA,WAAMJ,sBAAsB,CAAC,KAAD,CAA5B;AAAA,GAAZ,EAAiD,EAAjD,CAAzB;AAEA,MAAMK,gBAAgB,GAAG,wBACrB,UAACC,KAAD,EAAW;AACPL,IAAAA,mBAAmB,CAACM,OAApB,GAA8BC,MAAM,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SAAS,EAAC;AAA1C,KACKA,QADL,CADJ,EAIKD,aAAa,IAAIA,aAAa,CAACwB,MAAd,GAAuB,CAAxC,IAA6CxB,aAAa,CAAC,CAAD,CAA1D,iBACG,6BAAC,kDAAD,QACKA,aAAa,CAAC,CAAD,CADlB,CALR,CAfR,CAnBJ,EA8CK,CAAAA,aAAa,SAAb,IAAAA,aAAa,WAAb,YAAAA,aAAa,CAAEwB,MAAf,MAA0B,CAA1B,iBACG,6BAAC,4CAAD,QAAiCxB,aAAa,CAAC,CAAD,CAA9C,CA/CR,EAiDKR,SAAS,iBACN,6BAAC,+CAAD;AACI,IAAA,OAAO,EAAE;AACLiC,MAAAA,UAAU,EAAEnB,mBAAmB,GAAG,CAAH,GAAO,CADjC;AAELoB,MAAAA,OAAO,EAAEpB,mBAAmB,GAAG,CAAH,GAAO,CAF9B;AAGLqB,MAAAA,KAAK,EAAErB,mBAAmB,GAAG,MAAH,GAAY;AAHjC,KADb;AAMI,IAAA,OAAO,EAAE,KANb;AAOI,IAAA,UAAU,EAAE;AAAEsB,MAAAA,QAAQ,EAAE,IAAZ;AAAkBL,MAAAA,IAAI,EAAE;AAAxB;AAPhB,KASK/B,SATL,CAlDR,CADJ;AAiEH,CA/ID;;AAiJAD,YAAY,CAACsC,WAAb,GAA2B,cAA3B;eAEetC,Y","sourcesContent":["import React, {\n FC,\n MouseEventHandler,\n ReactNode,\n TouchEventHandler,\n useCallback,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport GridImage from '../../../grid-image/GridImage';\nimport Icon from '../../../icon/Icon';\nimport {\n StyledListItemHead,\n StyledListItemHeadBottomRightElement,\n StyledListItemHeadContent,\n StyledListItemHeadIcon,\n StyledListItemHeadImage,\n StyledListItemHeadImageWrapper,\n StyledListItemHeadRightElement,\n StyledListItemHeadSubtitle,\n StyledListItemHeadSubtitleText,\n StyledListItemHeadTitle,\n StyledListItemHeadTitleText,\n StyledListItemHeadTopRightElement,\n StyledMotionListItemHeadHoverItem,\n StyledMotionListItemHeadIndicator,\n} from './ListItemHead.styles';\n\ntype ListItemHeadProps = {\n hoverItem?: ReactNode;\n icons?: string[];\n images?: string[];\n isAnyItemExpandable: boolean;\n isExpandable: boolean;\n isOpen: boolean;\n onClick?: MouseEventHandler<HTMLDivElement>;\n onLongPress?: TouchEventHandler<HTMLDivElement>;\n rightElements?: [ReactNode, ...ReactNode[]];\n subtitle?: ReactNode;\n shouldShowRoundImage?: boolean;\n title: ReactNode;\n};\n\nconst ListItemHead: FC<ListItemHeadProps> = ({\n hoverItem,\n icons,\n images,\n isAnyItemExpandable,\n isExpandable,\n isOpen,\n onClick,\n onLongPress,\n rightElements,\n subtitle,\n shouldShowRoundImage,\n title,\n}) => {\n const [hasLoadedImage, setHasLoadedImage] = useState(false);\n const [shouldShowHoverItem, setShouldShowHoverItem] = useState(false);\n\n const longPressTimeoutRef = useRef<number>();\n\n const handleImageLoaded = useCallback(() => {\n setHasLoadedImage(true);\n }, []);\n\n const handleMouseEnter = useCallback(() => setShouldShowHoverItem(true), []);\n\n const handleMouseLeave = useCallback(() => setShouldShowHoverItem(false), []);\n\n const handleTouchStart = useCallback<TouchEventHandler<HTMLDivElement>>(\n (event) => {\n longPressTimeoutRef.current = window.setTimeout(() => {\n if (typeof onLongPress === 'function') {\n onLongPress(event);\n }\n }, 400);\n },\n [onLongPress]\n );\n\n const handleTouchEnd = useCallback(() => {\n clearTimeout(longPressTimeoutRef.current);\n }, []);\n\n const iconOrImageElement = useMemo(() => {\n if (icons) {\n return (\n <StyledListItemHeadIcon>\n <Icon icons={icons} size={22} />\n </StyledListItemHeadIcon>\n );\n }\n\n if (images && images[0] && images[1] && images[2]) {\n const gridImages = [images[0], images[1], images[2]];\n\n return (\n <GridImage\n images={gridImages}\n shouldShowRoundImage={shouldShowRoundImage}\n size={40}\n />\n );\n }\n\n if (images && images[0]) {\n return (\n <StyledListItemHeadImageWrapper shouldShowRoundImage={shouldShowRoundImage}>\n <StyledListItemHeadImage\n isHidden={!hasLoadedImage}\n onLoad={handleImageLoaded}\n src={images[0]}\n />\n </StyledListItemHeadImageWrapper>\n );\n }\n\n return undefined;\n }, [handleImageLoaded, hasLoadedImage, icons, images, shouldShowRoundImage]);\n\n return (\n <StyledListItemHead\n className=\"beta-chayns-list-item-head\"\n isClickable={typeof onClick === 'function' || isExpandable}\n onClick={onClick}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n onTouchStart={typeof onLongPress === 'function' ? handleTouchStart : undefined}\n onTouchEnd={typeof onLongPress === 'function' ? handleTouchEnd : undefined}\n >\n {isAnyItemExpandable && (\n <StyledMotionListItemHeadIndicator\n animate={{ rotate: isOpen ? 90 : 0 }}\n initial={false}\n transition={{ type: 'tween' }}\n >\n {isExpandable && <Icon icons={['fa fa-chevron-right']} />}\n </StyledMotionListItemHeadIndicator>\n )}\n {iconOrImageElement}\n <StyledListItemHeadContent\n isIconOrImageGiven={iconOrImageElement !== undefined}\n isOpen={isOpen}\n >\n <StyledListItemHeadTitle>\n <StyledListItemHeadTitleText className=\"ellipsis\">\n {title}\n </StyledListItemHeadTitleText>\n {rightElements && rightElements.length > 1 && rightElements[0] && (\n <StyledListItemHeadTopRightElement>\n {rightElements[0]}\n </StyledListItemHeadTopRightElement>\n )}\n </StyledListItemHeadTitle>\n {subtitle && (\n <StyledListItemHeadSubtitle>\n <StyledListItemHeadSubtitleText className=\"ellipsis\">\n {subtitle}\n </StyledListItemHeadSubtitleText>\n {rightElements && rightElements.length > 1 && rightElements[1] && (\n <StyledListItemHeadBottomRightElement>\n {rightElements[1]}\n </StyledListItemHeadBottomRightElement>\n )}\n </StyledListItemHeadSubtitle>\n )}\n </StyledListItemHeadContent>\n {rightElements?.length === 1 && (\n <StyledListItemHeadRightElement>{rightElements[0]}</StyledListItemHeadRightElement>\n )}\n {hoverItem && (\n <StyledMotionListItemHeadHoverItem\n animate={{\n marginLeft: shouldShowHoverItem ? 8 : 0,\n opacity: shouldShowHoverItem ? 1 : 0,\n width: shouldShowHoverItem ? 'auto' : 0,\n }}\n initial={false}\n transition={{ duration: 0.15, type: 'tween' }}\n >\n {hoverItem}\n </StyledMotionListItemHeadHoverItem>\n )}\n </StyledListItemHead>\n );\n};\n\nListItemHead.displayName = 'ListItemHead';\n\nexport default ListItemHead;\n"],"file":"ListItemHead.js"}
|
|
@@ -16,6 +16,7 @@ declare type StyledListItemHeadImageProps = {
|
|
|
16
16
|
export declare const StyledListItemHeadImage: import("styled-components").StyledComponent<"img", any, StyledListItemHeadImageProps, never>;
|
|
17
17
|
declare type StyledListItemHeadContentProps = {
|
|
18
18
|
isIconOrImageGiven: boolean;
|
|
19
|
+
isOpen: boolean;
|
|
19
20
|
};
|
|
20
21
|
export declare const StyledListItemHeadContent: import("styled-components").StyledComponent<"div", any, StyledListItemHeadContentProps, never>;
|
|
21
22
|
export declare const StyledListItemHeadTitle: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -61,8 +61,11 @@ var StyledListItemHeadImage = _styledComponents.default.img(_templateObject6 ||
|
|
|
61
61
|
|
|
62
62
|
exports.StyledListItemHeadImage = StyledListItemHeadImage;
|
|
63
63
|
|
|
64
|
-
var StyledListItemHeadContent = _styledComponents.default.div(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n display: flex;\n flex: 1 1 auto;\n flex-direction: column;\n justify-content: center;\n line-height: normal;\n margin-left: ", ";\n min-width: 0;\n"])), function (_ref9) {
|
|
65
|
-
var
|
|
64
|
+
var StyledListItemHeadContent = _styledComponents.default.div(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n display: flex;\n flex: 1 1 auto;\n flex-direction: column;\n font-weight: ", ";\n justify-content: center;\n line-height: normal;\n margin-left: ", ";\n min-width: 0;\n"])), function (_ref9) {
|
|
65
|
+
var isOpen = _ref9.isOpen;
|
|
66
|
+
return isOpen ? 'bold' : 'normal';
|
|
67
|
+
}, function (_ref10) {
|
|
68
|
+
var isIconOrImageGiven = _ref10.isIconOrImageGiven;
|
|
66
69
|
return isIconOrImageGiven ? '10px' : undefined;
|
|
67
70
|
});
|
|
68
71
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/components/list/list-item/list-item-head/ListItemHead.styles.ts"],"names":["StyledListItemHead","styled","div","theme","text","isClickable","css","StyledMotionListItemHeadIndicator","motion","StyledListItemHeadIcon","StyledListItemHeadImageWrapper","shouldShowRoundImage","undefined","StyledListItemHeadImage","img","isHidden","StyledListItemHeadContent","isIconOrImageGiven","StyledListItemHeadTitle","StyledListItemHeadTitleText","span","StyledListItemHeadSubtitle","StyledListItemHeadSubtitleText","StyledListItemHeadTopRightElement","StyledListItemHeadBottomRightElement","StyledListItemHeadRightElement","StyledMotionListItemHeadHoverItem"],"mappings":";;;;;;;;;AAAA;;AACA;;;;;;;;;;AAOO,IAAMA,kBAAkB,GAAGC,0BAAOC,GAAV,+LAElB;AAAA,MAAGC,KAAH,QAAGA,KAAH;AAAA,SAAwCA,KAAK,CAACC,IAA9C;AAAA,CAFkB,EAOzB;AAAA,MAAGC,WAAH,SAAGA,WAAH;AAAA,SACEA,WAAW,QACXC,qBADW,gHADb;AAAA,CAPyB,CAAxB;;;AAcA,IAAMC,iCAAiC,GAAG,+BAAOC,qBAAON,GAAd,CAAH,+MAAvC;;;AAWA,IAAMO,sBAAsB,GAAGR,0BAAOC,GAAV,6UAEN;AAAA,MAAGC,KAAH,SAAGA,KAAH;AAAA,SAA4CA,KAAK,CAAC,UAAD,CAAjD;AAAA,CAFM,EAIpB;AAAA,MAAGA,KAAH,SAAGA,KAAH;AAAA,SAA4CA,KAAK,CAAC,SAAD,CAAjD;AAAA,CAJoB,CAA5B;;;;AAiBA,IAAMO,8BAA8B,GAAGT,0BAAOC,GAAV,4VAEjC;AAAA,MAAGC,KAAH,SAAGA,KAAH;AAAA,SAAoDA,KAAK,CAAC,UAAD,CAAzD;AAAA,CAFiC,EAKtB;AAAA,MAAGQ,oBAAH,SAAGA,oBAAH;AAAA,SAA+BA,oBAAoB,GAAG,KAAH,GAAWC,SAA9D;AAAA,CALsB,EAO5B;AAAA,MAAGT,KAAH,SAAGA,KAAH;AAAA,SAAoDA,KAAK,CAAC,SAAD,CAAzD;AAAA,CAP4B,CAApC;;;;AAmBA,IAAMU,uBAAuB,GAAGZ,0BAAOa,GAAV,+LAGrB;AAAA,MAAGC,QAAH,SAAGA,QAAH;AAAA,SAAmBA,QAAQ,GAAG,CAAH,GAAO,CAAlC;AAAA,CAHqB,CAA7B;;;;
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/list/list-item/list-item-head/ListItemHead.styles.ts"],"names":["StyledListItemHead","styled","div","theme","text","isClickable","css","StyledMotionListItemHeadIndicator","motion","StyledListItemHeadIcon","StyledListItemHeadImageWrapper","shouldShowRoundImage","undefined","StyledListItemHeadImage","img","isHidden","StyledListItemHeadContent","isOpen","isIconOrImageGiven","StyledListItemHeadTitle","StyledListItemHeadTitleText","span","StyledListItemHeadSubtitle","StyledListItemHeadSubtitleText","StyledListItemHeadTopRightElement","StyledListItemHeadBottomRightElement","StyledListItemHeadRightElement","StyledMotionListItemHeadHoverItem"],"mappings":";;;;;;;;;AAAA;;AACA;;;;;;;;;;AAOO,IAAMA,kBAAkB,GAAGC,0BAAOC,GAAV,+LAElB;AAAA,MAAGC,KAAH,QAAGA,KAAH;AAAA,SAAwCA,KAAK,CAACC,IAA9C;AAAA,CAFkB,EAOzB;AAAA,MAAGC,WAAH,SAAGA,WAAH;AAAA,SACEA,WAAW,QACXC,qBADW,gHADb;AAAA,CAPyB,CAAxB;;;AAcA,IAAMC,iCAAiC,GAAG,+BAAOC,qBAAON,GAAd,CAAH,+MAAvC;;;AAWA,IAAMO,sBAAsB,GAAGR,0BAAOC,GAAV,6UAEN;AAAA,MAAGC,KAAH,SAAGA,KAAH;AAAA,SAA4CA,KAAK,CAAC,UAAD,CAAjD;AAAA,CAFM,EAIpB;AAAA,MAAGA,KAAH,SAAGA,KAAH;AAAA,SAA4CA,KAAK,CAAC,S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B,qBAAON,GAAd,CAAH,kGAAvC","sourcesContent":["import { motion } from 'framer-motion';\nimport styled, { css } from 'styled-components';\nimport type { WithTheme } from '../../../color-scheme-provider/ColorSchemeProvider';\n\ntype StyledListItemHeadProps = WithTheme<{\n isClickable: boolean;\n}>;\n\nexport const StyledListItemHead = styled.div<StyledListItemHeadProps>`\n align-items: center;\n color: ${({ theme }: StyledListItemHeadProps) => theme.text};\n display: flex;\n height: 64px;\n padding: 12px 9px;\n\n ${({ isClickable }) =>\n isClickable &&\n css`\n cursor: pointer;\n `}\n`;\n\nexport const StyledMotionListItemHeadIndicator = styled(motion.div)`\n align-items: center;\n display: flex;\n flex: 0 0 auto;\n height: 26px;\n justify-content: center;\n width: 26px;\n`;\n\ntype StyledListItemHeadIconProps = WithTheme<unknown>;\n\nexport const StyledListItemHeadIcon = styled.div`\n align-items: center;\n background-color: rgba(${({ theme }: StyledListItemHeadIconProps) => theme['text-rgb']}, 0.1);\n box-shadow: 0 0 0 1px\n rgba(${({ theme }: StyledListItemHeadIconProps) => theme['009-rgb']}, 0.08) inset;\n display: flex;\n flex: 0 0 auto;\n height: 40px;\n justify-content: center;\n margin-right: 10px;\n width: 40px;\n`;\n\ntype StyledListItemHeadImageWrapperProps = WithTheme<{\n shouldShowRoundImage?: boolean;\n}>;\n\nexport const StyledListItemHeadImageWrapper = styled.div<StyledListItemHeadImageWrapperProps>`\n background-color: rgba(\n ${({ theme }: StyledListItemHeadImageWrapperProps) => theme['text-rgb']},\n 0.1\n );\n border-radius: ${({ shouldShowRoundImage }) => (shouldShowRoundImage ? '50%' : undefined)};\n box-shadow: 0 0 0 1px\n rgba(${({ theme }: StyledListItemHeadImageWrapperProps) => theme['009-rgb']}, 0.08) inset;\n flex: 0 0 auto;\n height: 40px;\n overflow: hidden;\n transition: border-radius 0.3s ease;\n width: 40px;\n`;\n\ntype StyledListItemHeadImageProps = {\n isHidden: boolean;\n};\n\nexport const StyledListItemHeadImage = styled.img<StyledListItemHeadImageProps>`\n height: 100%;\n object-fit: cover;\n opacity: ${({ isHidden }) => (isHidden ? 0 : 1)};\n transition: opacity 0.4s ease;\n width: 100%;\n`;\n\ntype StyledListItemHeadContentProps = {\n isIconOrImageGiven: boolean;\n isOpen: boolean;\n};\n\nexport const StyledListItemHeadContent = styled.div<StyledListItemHeadContentProps>`\n display: flex;\n flex: 1 1 auto;\n flex-direction: column;\n font-weight: ${({ isOpen }) => (isOpen ? 'bold' : 'normal')};\n justify-content: center;\n line-height: normal;\n margin-left: ${({ isIconOrImageGiven }) => (isIconOrImageGiven ? '10px' : undefined)};\n min-width: 0;\n`;\n\nexport const StyledListItemHeadTitle = styled.div`\n align-items: center;\n display: flex;\n justify-content: space-between;\n`;\n\nexport const StyledListItemHeadTitleText = styled.span`\n flex: 1 1 auto;\n min-width: 0;\n`;\n\nexport const StyledListItemHeadSubtitle = styled.div`\n align-items: center;\n display: flex;\n justify-content: space-between;\n margin-top: 2px;\n opacity: 0.75;\n`;\n\nexport const StyledListItemHeadSubtitleText = styled.span`\n flex: 1 1 auto;\n font-size: 85%;\n min-width: 0;\n`;\n\nexport const StyledListItemHeadTopRightElement = styled.div`\n flex: 0 0 auto;\n font-size: 85%;\n margin-left: 8px;\n opacity: 0.75;\n`;\n\nexport const StyledListItemHeadBottomRightElement = styled.div`\n flex: 0 0 auto;\n margin-left: 8px;\n font-size: 85%;\n`;\n\nexport const StyledListItemHeadRightElement = styled.div`\n flex: 0 0 auto;\n margin-left: 8px;\n`;\n\nexport const StyledMotionListItemHeadHoverItem = styled(motion.div)`\n overflow: hidden;\n`;\n"],"file":"ListItemHead.styles.js"}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { default as Accordion } from './components/accordion/Accordion';
|
|
2
2
|
export { default as AccordionContent } from './components/accordion/accordion-content/AccordionContent';
|
|
3
3
|
export { default as AccordionGroup } from './components/accordion/accordion-group/AccordionGroup';
|
|
4
|
+
export { default as AccordionIntro } from './components/accordion/accordion-intro/AccordionIntro';
|
|
4
5
|
export { default as Badge } from './components/badge/Badge';
|
|
5
6
|
export { default as Button } from './components/button/Button';
|
|
6
7
|
export { default as ColorSchemeProvider } from './components/color-scheme-provider/ColorSchemeProvider';
|
package/lib/index.js
CHANGED
|
@@ -21,6 +21,12 @@ Object.defineProperty(exports, "AccordionGroup", {
|
|
|
21
21
|
return _AccordionGroup.default;
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
|
+
Object.defineProperty(exports, "AccordionIntro", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function get() {
|
|
27
|
+
return _AccordionIntro.default;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
24
30
|
Object.defineProperty(exports, "Badge", {
|
|
25
31
|
enumerable: true,
|
|
26
32
|
get: function get() {
|
|
@@ -82,6 +88,8 @@ var _AccordionContent = _interopRequireDefault(require("./components/accordion/a
|
|
|
82
88
|
|
|
83
89
|
var _AccordionGroup = _interopRequireDefault(require("./components/accordion/accordion-group/AccordionGroup"));
|
|
84
90
|
|
|
91
|
+
var _AccordionIntro = _interopRequireDefault(require("./components/accordion/accordion-intro/AccordionIntro"));
|
|
92
|
+
|
|
85
93
|
var _Badge = _interopRequireDefault(require("./components/badge/Badge"));
|
|
86
94
|
|
|
87
95
|
var _Button = _interopRequireDefault(require("./components/button/Button"));
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA","sourcesContent":["export { default as Accordion } from './components/accordion/Accordion';\nexport { default as AccordionContent } from './components/accordion/accordion-content/AccordionContent';\nexport { default as AccordionGroup } from './components/accordion/accordion-group/AccordionGroup';\nexport { default as AccordionIntro } from './components/accordion/accordion-intro/AccordionIntro';\nexport { default as Badge } from './components/badge/Badge';\nexport { default as Button } from './components/button/Button';\nexport { default as ColorSchemeProvider } from './components/color-scheme-provider/ColorSchemeProvider';\nexport { default as ContextMenu } from './components/context-menu/ContextMenu';\nexport { default as GridImage } from './components/grid-image/GridImage';\nexport { default as Icon } from './components/icon/Icon';\nexport { default as List } from './components/list/List';\nexport { default as ListItemContent } from './components/list/list-item/list-item-content/ListItemContent';\nexport { default as ListItem } from './components/list/list-item/ListItem';\n"],"file":"index.js"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chayns-components/core",
|
|
3
|
-
"version": "5.0.0-beta.
|
|
3
|
+
"version": "5.0.0-beta.22",
|
|
4
4
|
"description": "A set of beautiful React components for developing your own applications with chayns.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"chayns",
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
"publishConfig": {
|
|
62
62
|
"access": "public"
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "ec9c3e315b0bc5469612cb97079801f29c7a21c9"
|
|
65
65
|
}
|