@chayns-components/core 5.0.0-beta.22 → 5.0.0-beta.26

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.
Files changed (27) hide show
  1. package/lib/components/accordion/Accordion.d.ts +12 -0
  2. package/lib/components/accordion/Accordion.js +23 -3
  3. package/lib/components/accordion/Accordion.js.map +1 -1
  4. package/lib/components/accordion/Accordion.styles.js +1 -1
  5. package/lib/components/accordion/accordion-group/AccordionGroup.d.ts +8 -0
  6. package/lib/components/accordion/accordion-group/AccordionGroup.js +16 -2
  7. package/lib/components/accordion/accordion-group/AccordionGroup.js.map +1 -1
  8. package/lib/components/accordion/accordion-head/AccordionHead.js +2 -2
  9. package/lib/components/accordion/accordion-head/AccordionHead.js.map +1 -1
  10. package/lib/components/accordion/accordion-head/AccordionHead.styles.js +2 -2
  11. package/lib/components/accordion/accordion-head/AccordionHead.styles.js.map +1 -1
  12. package/lib/components/color-scheme-provider/ColorSchemeProvider.js +3 -3
  13. package/lib/components/context-menu/ContextMenu.d.ts +2 -2
  14. package/lib/components/context-menu/ContextMenu.js +79 -35
  15. package/lib/components/context-menu/ContextMenu.js.map +1 -1
  16. package/lib/components/context-menu/context-menu-content/ContextMenuContent.styles.js +1 -1
  17. package/lib/components/grid-image/GridImage.js +1 -1
  18. package/lib/components/icon/Icon.styles.js +1 -1
  19. package/lib/components/list/List.js +1 -1
  20. package/lib/components/list/list-item/ListItem.js +1 -1
  21. package/lib/components/list/list-item/ListItem.styles.js +1 -1
  22. package/lib/components/list/list-item/list-item-head/ListItemHead.js +1 -1
  23. package/lib/components/list/list-item/list-item-head/ListItemHead.styles.js +1 -1
  24. package/lib/types/chayns.d.ts +56 -0
  25. package/lib/types/chayns.js +15 -0
  26. package/lib/types/chayns.js.map +1 -0
  27. package/package.json +15 -15
@@ -15,6 +15,10 @@ declare type AccordionProps = {
15
15
  * This can be used to automatically expand the Accordion during the first render.
16
16
  */
17
17
  isDefaultOpen?: boolean;
18
+ /**
19
+ * This will disable the Accordion so that it cannot be opened and will gray out the title.
20
+ */
21
+ isDisabled?: boolean;
18
22
  /**
19
23
  * This can be used so that the Accordion cannot be opened or closed.
20
24
  * In addition, in this case the icon is exchanged to mark the Accordions.
@@ -29,6 +33,14 @@ declare type AccordionProps = {
29
33
  * the head and the padding of the content.
30
34
  */
31
35
  isWrapped?: boolean;
36
+ /**
37
+ * Function that is executed when the accordion will be closed.
38
+ */
39
+ onClose?: VoidFunction;
40
+ /**
41
+ * Function that is executed when the accordion will be opened.
42
+ */
43
+ onOpen?: VoidFunction;
32
44
  /**
33
45
  * Function that is executed when the text of the search in the accordion
34
46
  * head changes. When this function is given, the search field is displayed
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
4
 
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
@@ -51,12 +51,16 @@ var Accordion = function Accordion(_ref) {
51
51
  icon = _ref.icon,
52
52
  _ref$isDefaultOpen = _ref.isDefaultOpen,
53
53
  isDefaultOpen = _ref$isDefaultOpen === void 0 ? false : _ref$isDefaultOpen,
54
+ _ref$isDisabled = _ref.isDisabled,
55
+ isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
54
56
  _ref$isFixed = _ref.isFixed,
55
57
  isFixed = _ref$isFixed === void 0 ? false : _ref$isFixed,
56
58
  _ref$isTitleGreyed = _ref.isTitleGreyed,
57
59
  isTitleGreyed = _ref$isTitleGreyed === void 0 ? false : _ref$isTitleGreyed,
58
60
  _ref$isWrapped = _ref.isWrapped,
59
61
  isWrapped = _ref$isWrapped === void 0 ? false : _ref$isWrapped,
62
+ onClose = _ref.onClose,
63
+ onOpen = _ref.onOpen,
60
64
  onSearchChange = _ref.onSearchChange,
61
65
  rightElement = _ref.rightElement,
62
66
  searchIcon = _ref.searchIcon,
@@ -74,9 +78,14 @@ var Accordion = function Accordion(_ref) {
74
78
  setIsAccordionOpen = _useState2[1];
75
79
 
76
80
  var uuid = (0, _uuid.useUuid)();
81
+ var isInitialRenderRef = (0, _react.useRef)(true);
77
82
  var isInGroup = typeof updateOpenAccordionUuid === 'function';
78
83
  var isOpen = isInGroup ? openAccordionUuid === uuid : isAccordionOpen;
79
84
  var handleHeadClick = (0, _react.useCallback)(function () {
85
+ if (isDisabled) {
86
+ return;
87
+ }
88
+
80
89
  if (typeof updateOpenAccordionUuid === 'function') {
81
90
  updateOpenAccordionUuid(uuid);
82
91
  }
@@ -84,7 +93,18 @@ var Accordion = function Accordion(_ref) {
84
93
  setIsAccordionOpen(function (currentIsAccordionOpen) {
85
94
  return !currentIsAccordionOpen;
86
95
  });
87
- }, [updateOpenAccordionUuid, uuid]);
96
+ }, [isDisabled, updateOpenAccordionUuid, uuid]);
97
+ (0, _react.useEffect)(function () {
98
+ if (isInitialRenderRef.current) {
99
+ isInitialRenderRef.current = false;
100
+ } else if (isOpen) {
101
+ if (typeof onOpen === 'function') {
102
+ onOpen();
103
+ }
104
+ } else if (typeof onClose === 'function') {
105
+ onClose();
106
+ }
107
+ }, [isOpen, onClose, onOpen]);
88
108
  (0, _react.useEffect)(function () {
89
109
  if (isDefaultOpen && typeof updateOpenAccordionUuid === 'function') {
90
110
  updateOpenAccordionUuid(uuid, {
@@ -108,7 +128,7 @@ var Accordion = function Accordion(_ref) {
108
128
  icon: icon,
109
129
  isOpen: isOpen,
110
130
  isFixed: isFixed,
111
- isTitleGreyed: isTitleGreyed,
131
+ isTitleGreyed: isTitleGreyed || isDisabled,
112
132
  isWrapped: isWrapped,
113
133
  onClick: handleHeadClick,
114
134
  onSearchChange: onSearchChange,
@@ -1 +1 @@
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,MAA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AHb;AAII,IAAA,aAAa,EAAEC,aAJnB;AAKI,IAAA,SAAS,EAAEP,SALf;AAMI,IAAA,OAAO,EAAEsB,eANb;AAOI,IAAA,cAAc,EAAEd,cAPpB;AAQI,IAAA,YAAY,EAAEC,YARlB;AASI,IAAA,UAAU,EAAEC,UAThB;AAUI,IAAA,iBAAiB,EAAEC,iBAVvB;AAWI,IAAA,KAAK,EAAEC,KAXX;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
+ {"version":3,"sources":["../../../src/components/accordion/Accordion.tsx"],"names":["AccordionContext","React","createContext","isWrapped","displayName","Accordion","children","icon","isDefaultOpen","isDisabled","isFixed","isTitleGreyed","onClose","onOpen","onSearchChange","rightElement","searchIcon","searchPlaceholder","title","titleElement","AccordionGroupContext","openAccordionUuid","updateOpenAccordionUuid","isAccordionOpen","setIsAccordionOpen","uuid","isInitialRenderRef","isInGroup","isOpen","handleHeadClick","currentIsAccordionOpen","current","shouldOnlyOpen","type"],"mappings":";;;;;;;;;AAAA;;AACA;;AAUA;;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;;AAqEA,IAAMC,SAA6B,GAAG,SAAhCA,SAAgC,OAgBhC;AAAA,MAfFC,QAeE,QAfFA,QAeE;AAAA,MAdFC,IAcE,QAdFA,IAcE;AAAA,gCAbFC,aAaE;AAAA,MAbFA,aAaE,mCAbc,KAad;AAAA,6BAZFC,UAYE;AAAA,MAZFA,UAYE,gCAZW,KAYX;AAAA,0BAXFC,OAWE;AAAA,MAXFA,OAWE,6BAXQ,KAWR;AAAA,gCAVFC,aAUE;AAAA,MAVFA,aAUE,mCAVc,KAUd;AAAA,4BATFR,SASE;AAAA,MATFA,SASE,+BATU,KASV;AAAA,MARFS,OAQE,QARFA,OAQE;AAAA,MAPFC,MAOE,QAPFA,MAOE;AAAA,MANFC,cAME,QANFA,cAME;AAA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ent":["import { AnimatePresence, MotionConfig } from 'framer-motion';\nimport React, {\n ChangeEventHandler,\n FC,\n ReactNode,\n useCallback,\n useContext,\n useEffect,\n useRef,\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 will disable the Accordion so that it cannot be opened and will gray out the title.\n */\n isDisabled?: 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 accordion will be closed.\n */\n onClose?: VoidFunction;\n /**\n * Function that is executed when the accordion will be opened.\n */\n onOpen?: VoidFunction;\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 isDisabled = false,\n isFixed = false,\n isTitleGreyed = false,\n isWrapped = false,\n onClose,\n onOpen,\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 isInitialRenderRef = useRef(true);\n\n const isInGroup = typeof updateOpenAccordionUuid === 'function';\n\n const isOpen = isInGroup ? openAccordionUuid === uuid : isAccordionOpen;\n\n const handleHeadClick = useCallback(() => {\n if (isDisabled) {\n return;\n }\n\n if (typeof updateOpenAccordionUuid === 'function') {\n updateOpenAccordionUuid(uuid);\n }\n\n setIsAccordionOpen((currentIsAccordionOpen) => !currentIsAccordionOpen);\n }, [isDisabled, updateOpenAccordionUuid, uuid]);\n\n useEffect(() => {\n if (isInitialRenderRef.current) {\n isInitialRenderRef.current = false;\n } else if (isOpen) {\n if (typeof onOpen === 'function') {\n onOpen();\n }\n } else if (typeof onClose === 'function') {\n onClose();\n }\n }, [isOpen, onClose, onOpen]);\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 || isDisabled}\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,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
4
 
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
@@ -13,6 +13,14 @@ declare type AccordionGroupProps = {
13
13
  * automatically closed when an `Accordion` of the group is opened.
14
14
  */
15
15
  children: ReactNode;
16
+ /**
17
+ * Function that is executed when all accordions in group are closed.
18
+ */
19
+ onClose?: VoidFunction;
20
+ /**
21
+ * Function that is executed when any accordion in group will be opened.
22
+ */
23
+ onOpen?: VoidFunction;
16
24
  };
17
25
  declare const AccordionGroup: FC<AccordionGroupProps>;
18
26
  export default AccordionGroup;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
4
 
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
@@ -34,13 +34,16 @@ exports.AccordionGroupContext = AccordionGroupContext;
34
34
  AccordionGroupContext.displayName = 'AccordionGroupContext';
35
35
 
36
36
  var AccordionGroup = function AccordionGroup(_ref) {
37
- var children = _ref.children;
37
+ var children = _ref.children,
38
+ onClose = _ref.onClose,
39
+ onOpen = _ref.onOpen;
38
40
 
39
41
  var _useState = (0, _react.useState)(undefined),
40
42
  _useState2 = _slicedToArray(_useState, 2),
41
43
  openAccordionUuid = _useState2[0],
42
44
  setOpenAccordionUuid = _useState2[1];
43
45
 
46
+ var isInitialRenderRef = (0, _react.useRef)(true);
44
47
  var updateOpenAccordionUuid = (0, _react.useCallback)(function (uuid) {
45
48
  var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
46
49
  shouldOnlyOpen = _ref2.shouldOnlyOpen;
@@ -53,6 +56,17 @@ var AccordionGroup = function AccordionGroup(_ref) {
53
56
  return uuid;
54
57
  });
55
58
  }, [setOpenAccordionUuid]);
59
+ (0, _react.useEffect)(function () {
60
+ if (isInitialRenderRef.current) {
61
+ isInitialRenderRef.current = false;
62
+ } else if (typeof openAccordionUuid === 'string') {
63
+ if (typeof onOpen === 'function') {
64
+ onOpen();
65
+ }
66
+ } else if (typeof onClose === 'function') {
67
+ onClose();
68
+ }
69
+ }, [onClose, onOpen, openAccordionUuid]);
56
70
  var providerValue = (0, _react.useMemo)(function () {
57
71
  return {
58
72
  openAccordionUuid: openAccordionUuid,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/accordion/accordion-group/AccordionGroup.tsx"],"names":["AccordionGroupContext","React","createContext","openAccordionUuid","undefined","updateOpenAccordionUuid","displayName","AccordionGroup","children","setOpenAccordionUuid","uuid","shouldOnlyOpen","currentOpenAccordionUuid","providerValue"],"mappings":";;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;AASO,IAAMA,qBAAqB,gBAAGC,eAAMC,aAAN,CAA4C;AAC7EC,EAAAA,iBAAiB,EAAEC,SAD0D;AAE7EC,EAAAA,uBAAuB,EAAED;AAFoD,CAA5C,CAA9B;;;AAKPJ,qBAAqB,CAACM,WAAtB,GAAoC,uBAApC;;AAUA,IAAMC,cAAuC,GAAG,SAA1CA,cAA0C,OAAkB;AAAA,MAAfC,QAAe,QAAfA,QAAe;;AAC9D,kBACI,qBAAsDJ,SAAtD,CADJ;AAAA;AAAA,MAAOD,iBAAP;AAAA,MAA0BM,oBAA1B;;AAGA,MAAMJ,uBAAuB,GAAG,wBAC5B,UAACK,IAAD,EAAmC;AAAA,oFAAP,EAAO;AAAA,QAA1BC,cAA0B,SAA1BA,cAA0B;;AAC/BF,IAAAA,oBAAoB,CAAC,UAACG,wBAAD,EAA8B;AAC/C,UAAIA,wBAAwB,KAAKF,IAA7B,IAAqCC,cAAc,KAAK,IAA5D,EAAkE;AAC9D,eAAOP,SAAP;AACH;;AAED,aAAOM,IAAP;AACH,KANmB,CAApB;AAOH,GAT2B,EAU5B,CAACD,oBAAD,CAV4B,CAAhC;AAaA,MAAMI,aAAa,GAAG,oBAClB;AAAA,WAAO;AACHV,MAAAA,iBAAiB,EAAjBA,iBADG;AAEHE,MAAAA,uBAAuB,EAAvBA;AAFG,KAAP;AAAA,GADkB,EAKlB,CAACF,iBAAD,EAAoBE,uBAApB,CALkB,CAAtB;AAQA,sBACI,6BAAC,qBAAD,CAAuB,QAAvB;AAAgC,IAAA,KAAK,EAAEQ;AAAvC,KACKL,QADL,CADJ;AAKH,CA9BD;;AAgCAD,cAAc,CAACD,WAAf,GAA6B,gBAA7B;eAEeC,c","sourcesContent":["import React, { FC, ReactNode, useCallback, useMemo, useState } from 'react';\n\ntype IUpdateOpenAccordionUuid = (uuid: string, options?: { shouldOnlyOpen?: boolean }) => void;\n\ninterface IAccordionGroupContext {\n openAccordionUuid: string | undefined;\n updateOpenAccordionUuid?: IUpdateOpenAccordionUuid;\n}\n\nexport const AccordionGroupContext = React.createContext<IAccordionGroupContext>({\n openAccordionUuid: undefined,\n updateOpenAccordionUuid: undefined,\n});\n\nAccordionGroupContext.displayName = 'AccordionGroupContext';\n\ntype AccordionGroupProps = {\n /**\n * The Accordions that should be grouped. Accordions with the same group are\n * automatically closed when an `Accordion` of the group is opened.\n */\n children: ReactNode;\n};\n\nconst AccordionGroup: FC<AccordionGroupProps> = ({ children }) => {\n const [openAccordionUuid, setOpenAccordionUuid] =\n useState<IAccordionGroupContext['openAccordionUuid']>(undefined);\n\n const updateOpenAccordionUuid = useCallback<IUpdateOpenAccordionUuid>(\n (uuid, { shouldOnlyOpen } = {}) => {\n setOpenAccordionUuid((currentOpenAccordionUuid) => {\n if (currentOpenAccordionUuid === uuid && shouldOnlyOpen !== true) {\n return undefined;\n }\n\n return uuid;\n });\n },\n [setOpenAccordionUuid]\n );\n\n const providerValue = useMemo<IAccordionGroupContext>(\n () => ({\n openAccordionUuid,\n updateOpenAccordionUuid,\n }),\n [openAccordionUuid, updateOpenAccordionUuid]\n );\n\n return (\n <AccordionGroupContext.Provider value={providerValue}>\n {children}\n </AccordionGroupContext.Provider>\n );\n};\n\nAccordionGroup.displayName = 'AccordionGroup';\n\nexport default AccordionGroup;\n"],"file":"AccordionGroup.js"}
1
+ {"version":3,"sources":["../../../../src/components/accordion/accordion-group/AccordionGroup.tsx"],"names":["AccordionGroupContext","React","createContext","openAccordionUuid","undefined","updateOpenAccordionUuid","displayName","AccordionGroup","children","onClose","onOpen","setOpenAccordionUuid","isInitialRenderRef","uuid","shouldOnlyOpen","currentOpenAccordionUuid","current","providerValue"],"mappings":";;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;AASO,IAAMA,qBAAqB,gBAAGC,eAAMC,aAAN,CAA4C;AAC7EC,EAAAA,iBAAiB,EAAEC,SAD0D;AAE7EC,EAAAA,uBAAuB,EAAED;AAF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AA,GADkB,EAKlB,CAACF,iBAAD,EAAoBE,uBAApB,CALkB,CAAtB;AAQA,sBACI,6BAAC,qBAAD,CAAuB,QAAvB;AAAgC,IAAA,KAAK,EAAEY;AAAvC,KACKT,QADL,CADJ;AAKH,CA5CD;;AA8CAD,cAAc,CAACD,WAAf,GAA6B,gBAA7B;eAEeC,c","sourcesContent":["import React, { FC, ReactNode, useCallback, useEffect, useMemo, useRef, useState } from 'react';\n\ntype IUpdateOpenAccordionUuid = (uuid: string, options?: { shouldOnlyOpen?: boolean }) => void;\n\ninterface IAccordionGroupContext {\n openAccordionUuid: string | undefined;\n updateOpenAccordionUuid?: IUpdateOpenAccordionUuid;\n}\n\nexport const AccordionGroupContext = React.createContext<IAccordionGroupContext>({\n openAccordionUuid: undefined,\n updateOpenAccordionUuid: undefined,\n});\n\nAccordionGroupContext.displayName = 'AccordionGroupContext';\n\ntype AccordionGroupProps = {\n /**\n * The Accordions that should be grouped. Accordions with the same group are\n * automatically closed when an `Accordion` of the group is opened.\n */\n children: ReactNode;\n /**\n * Function that is executed when all accordions in group are closed.\n */\n onClose?: VoidFunction;\n /**\n * Function that is executed when any accordion in group will be opened.\n */\n onOpen?: VoidFunction;\n};\n\nconst AccordionGroup: FC<AccordionGroupProps> = ({ children, onClose, onOpen }) => {\n const [openAccordionUuid, setOpenAccordionUuid] =\n useState<IAccordionGroupContext['openAccordionUuid']>(undefined);\n\n const isInitialRenderRef = useRef(true);\n\n const updateOpenAccordionUuid = useCallback<IUpdateOpenAccordionUuid>(\n (uuid, { shouldOnlyOpen } = {}) => {\n setOpenAccordionUuid((currentOpenAccordionUuid) => {\n if (currentOpenAccordionUuid === uuid && shouldOnlyOpen !== true) {\n return undefined;\n }\n\n return uuid;\n });\n },\n [setOpenAccordionUuid]\n );\n\n useEffect(() => {\n if (isInitialRenderRef.current) {\n isInitialRenderRef.current = false;\n } else if (typeof openAccordionUuid === 'string') {\n if (typeof onOpen === 'function') {\n onOpen();\n }\n } else if (typeof onClose === 'function') {\n onClose();\n }\n }, [onClose, onOpen, openAccordionUuid]);\n\n const providerValue = useMemo<IAccordionGroupContext>(\n () => ({\n openAccordionUuid,\n updateOpenAccordionUuid,\n }),\n [openAccordionUuid, updateOpenAccordionUuid]\n );\n\n return (\n <AccordionGroupContext.Provider value={providerValue}>\n {children}\n </AccordionGroupContext.Provider>\n );\n};\n\nAccordionGroup.displayName = 'AccordionGroup';\n\nexport default AccordionGroup;\n"],"file":"AccordionGroup.js"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
4
 
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
@@ -108,7 +108,7 @@ var AccordionHead = function AccordionHead(_ref) {
108
108
  }, typeof onSearchChange === 'function' && isOpen ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_AccordionHead.StyledMotionRightInput, {
109
109
  animate: {
110
110
  opacity: 1,
111
- width: 'auto'
111
+ width: '165px'
112
112
  },
113
113
  autoComplete: "off",
114
114
  exit: {
@@ -1 +1 @@
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;AAAA,MAAOU,UAAP;AAAA,MAAmBC,aAAnB;;AAKA,MAAMC,eAAe,GAAG,mBAAuB,IAAvB,CAAxB;AAEA,MAAMC,aAAa,GAAGC,KAAK,CAACC,OAAN,CAAcX,UAAd,CAAtB;AAEA,wBAAU,YAAM;AAAA;;AACZO,IAAAA,aAAa,CACT,mCAAuB;AACnBX,MAAAA,SAAS,EAATA,SADmB;AAEnBM,MAAAA,KAAK,EAALA,KAFmB;AAGnBU,MAAAA,KAAK,EAAE,oDAACJ,eAAe,CAACK,OAAjB,2DAAC,uBAAyBC,WAA1B,yEAAyC,CAAzC,IAA8C;AAHlC,KAAvB,CADS,CAAb;AAOH,GARD,EAQG,CAAClB,SAAD,EAAYM,KAAZ,CARH;AAUA,sBACI,6BAAC,wCAAD;AACI,IAAA,OAAO,EAAE;AAAEa,MAAAA,MAAM,EA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,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
+ {"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;AAAA,MAAOU,UAAP;AAAA,MAAmBC,aAAnB;;AAK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BACV,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: '165px' }}\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,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
4
 
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
@@ -64,7 +64,7 @@ var StyledRightWrapper = _styledComponents.default.div(_templateObject8 || (_tem
64
64
  exports.StyledRightWrapper = StyledRightWrapper;
65
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
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) {
67
+ var StyledMotionRightInput = (0, _styledComponents.default)(_framerMotion.motion.input)(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n background-color: transparent;\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
68
  var theme = _ref9.theme;
69
69
  return theme['headline-rgb'];
70
70
  }, function (_ref10) {
@@ -1 +1 @@
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,uBAA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V,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"}
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":";;;;;;;;;AAA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GA,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,qQAIzB;AAAA,MAAGhB,KAAH,SAAGA,KAAH;AAAA,SAA4CA,KAAK,CAAC,cAAD,CAAjD;AAAA,CAJyB,EAQpB;AAAA,MAAGiB,OAAH,UAAGA,OAAH;AAAA,SAAkBA,OAAO,GAAG,kBAAH,GAAwB,SAAjD;AAAA,CARoB,CAA5B;;AAWA,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 background-color: transparent;\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"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
4
 
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
@@ -19,9 +19,9 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
19
19
 
20
20
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
21
21
 
22
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
22
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
23
23
 
24
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
24
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
25
25
 
26
26
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
27
27
 
@@ -1,4 +1,4 @@
1
- import React, { MouseEventHandler, ReactNode } from 'react';
1
+ import React, { MouseEvent, ReactNode } from 'react';
2
2
  import { ContextMenuAlignment } from './constants/alignment';
3
3
  export declare type ContextMenuCoordinates = {
4
4
  x: number;
@@ -7,7 +7,7 @@ export declare type ContextMenuCoordinates = {
7
7
  export declare type ContextMenuItem = {
8
8
  icons: string[];
9
9
  key: string;
10
- onClick: MouseEventHandler<HTMLDivElement>;
10
+ onClick: (event?: MouseEvent<HTMLDivElement>) => void;
11
11
  text: string;
12
12
  };
13
13
  declare type ContextMenuRef = {
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
4
 
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
@@ -29,6 +29,10 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
29
29
 
30
30
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
31
31
 
32
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
33
+
34
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
35
+
32
36
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
33
37
 
34
38
  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."); }
@@ -72,50 +76,90 @@ var ContextMenu = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
72
76
  isContentShown = _useState6[0],
73
77
  setIsContentShown = _useState6[1];
74
78
 
75
- var uuid = (0, _uuid.useUuid)();
79
+ var uuid = (0, _uuid.useUuid)(); // ToDo: Replace with hook if new chayns api is ready
80
+
76
81
  var contextMenuContentRef = (0, _react.useRef)(null);
77
82
  var contextMenuRef = (0, _react.useRef)(null);
78
83
  var handleHide = (0, _react.useCallback)(function () {
79
84
  setIsContentShown(false);
80
85
  }, []);
81
- var handleShow = (0, _react.useCallback)(function () {
82
- if (contextMenuRef.current) {
83
- var rootElement = document.querySelector('.tapp') || document.body;
84
-
85
- var _contextMenuRef$curre = contextMenuRef.current.getBoundingClientRect(),
86
- x = _contextMenuRef$curre.x,
87
- y = _contextMenuRef$curre.y,
88
- childrenHeight = _contextMenuRef$curre.height,
89
- childrenWidth = _contextMenuRef$curre.width;
90
-
91
- setInternalCoordinates({
92
- x: x + childrenWidth / 2,
93
- y: y + childrenHeight / 2
94
- });
95
-
96
- var _rootElement$getBound = rootElement.getBoundingClientRect(),
97
- height = _rootElement$getBound.height,
98
- width = _rootElement$getBound.width;
99
-
100
- if (x < width / 2) {
101
- if (y < height / 2) {
102
- setInternalAlignment(_alignment.ContextMenuAlignment.BottomRight);
103
- } else {
104
- setInternalAlignment(_alignment.ContextMenuAlignment.TopRight);
86
+ var handleShow = (0, _react.useCallback)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
87
+ var _chayns$env, isMobile, isTablet, _selection$, _yield$chayns$dialog$, buttonType, selection, _items$selection$0$va, rootElement, _contextMenuRef$curre, x, y, childrenHeight, childrenWidth, _rootElement$getBound, height, width;
88
+
89
+ return regeneratorRuntime.wrap(function _callee$(_context) {
90
+ while (1) {
91
+ switch (_context.prev = _context.next) {
92
+ case 0:
93
+ _chayns$env = chayns.env, isMobile = _chayns$env.isMobile, isTablet = _chayns$env.isTablet;
94
+
95
+ if (!(isMobile || isTablet)) {
96
+ _context.next = 10;
97
+ break;
98
+ }
99
+
100
+ _context.next = 4;
101
+ return chayns.dialog.select({
102
+ buttons: [],
103
+ list: items.map(function (_ref3, index) {
104
+ var icons = _ref3.icons,
105
+ text = _ref3.text;
106
+ return {
107
+ name: text,
108
+ value: index,
109
+ icon: icons[0]
110
+ };
111
+ }),
112
+ type: 2
113
+ });
114
+
115
+ case 4:
116
+ _yield$chayns$dialog$ = _context.sent;
117
+ buttonType = _yield$chayns$dialog$.buttonType;
118
+ selection = _yield$chayns$dialog$.selection;
119
+
120
+ if (buttonType === 1 && typeof ((_selection$ = selection[0]) === null || _selection$ === void 0 ? void 0 : _selection$.value) === 'number') {
121
+ (_items$selection$0$va = items[selection[0].value]) === null || _items$selection$0$va === void 0 ? void 0 : _items$selection$0$va.onClick();
122
+ }
123
+
124
+ _context.next = 11;
125
+ break;
126
+
127
+ case 10:
128
+ if (contextMenuRef.current) {
129
+ rootElement = document.querySelector('.tapp') || document.body;
130
+ _contextMenuRef$curre = contextMenuRef.current.getBoundingClientRect(), x = _contextMenuRef$curre.x, y = _contextMenuRef$curre.y, childrenHeight = _contextMenuRef$curre.height, childrenWidth = _contextMenuRef$curre.width;
131
+ setInternalCoordinates({
132
+ x: x + childrenWidth / 2,
133
+ y: y + childrenHeight / 2
134
+ });
135
+ _rootElement$getBound = rootElement.getBoundingClientRect(), height = _rootElement$getBound.height, width = _rootElement$getBound.width;
136
+
137
+ if (x < width / 2) {
138
+ if (y < height / 2) {
139
+ setInternalAlignment(_alignment.ContextMenuAlignment.BottomRight);
140
+ } else {
141
+ setInternalAlignment(_alignment.ContextMenuAlignment.TopRight);
142
+ }
143
+ } else if (y < height / 2) {
144
+ setInternalAlignment(_alignment.ContextMenuAlignment.BottomLeft);
145
+ } else {
146
+ setInternalAlignment(_alignment.ContextMenuAlignment.TopLeft);
147
+ }
148
+
149
+ setIsContentShown(true);
150
+ }
151
+
152
+ case 11:
153
+ case "end":
154
+ return _context.stop();
105
155
  }
106
- } else if (y < height / 2) {
107
- setInternalAlignment(_alignment.ContextMenuAlignment.BottomLeft);
108
- } else {
109
- setInternalAlignment(_alignment.ContextMenuAlignment.TopLeft);
110
156
  }
111
-
112
- setIsContentShown(true);
113
- }
114
- }, []);
157
+ }, _callee);
158
+ })), []);
115
159
  var handleClick = (0, _react.useCallback)(function (event) {
116
160
  event.preventDefault();
117
161
  event.stopPropagation();
118
- handleShow();
162
+ void handleShow();
119
163
  }, [handleShow]);
120
164
  var handleDocumentClick = (0, _react.useCallback)(function (event) {
121
165
  var _contextMenuContentRe;
@@ -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","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,CAAC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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"}
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","chayns","env","isMobile","isTablet","dialog","select","buttons","list","map","index","icons","text","name","value","icon","type","buttonType","selection","onClick","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;;AAYA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;AAqDA,IAAMA,WAAW,gBAAG,uBAChB,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f;AA4BA,sBACI,yEACI,6BAAC,8BAAD;AACI,IAAA,SAAS,EAAC,0BADd;AAEI,IAAA,OAAO,EAAEmC,WAFb;AAGI,IAAA,GAAG,EAAEjC;AAHT,KAKKpB,QALL,CADJ,EAQKiE,MARL,CADJ;AAYH,CAzKe,CAApB;AA4KApE,WAAW,CAACqE,WAAZ,GAA0B,aAA1B;eAEerE,W","sourcesContent":["import { AnimatePresence } from 'framer-motion';\nimport React, {\n forwardRef,\n MouseEvent,\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: (event?: MouseEvent<HTMLDivElement>) => void;\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 // ToDo: Replace with hook if new chayns api is ready\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(async () => {\n const { isMobile, isTablet } = chayns.env;\n\n if (isMobile || isTablet) {\n // ToDo: Replace with new api function if new api is ready\n const { buttonType, selection } = await chayns.dialog.select({\n buttons: [],\n list: items.map(({ icons, text }, index) => ({\n name: text,\n value: index,\n icon: icons[0],\n })),\n type: 2,\n });\n\n if (buttonType === 1 && typeof selection[0]?.value === 'number') {\n items[selection[0].value]?.onClick();\n }\n } else 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 void 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"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
4
 
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
4
 
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
4
 
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
4
 
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
4
 
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
4
 
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
4
 
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
4
 
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
@@ -0,0 +1,56 @@
1
+ declare global {
2
+ let chayns: Chayns;
3
+ }
4
+ export interface Chayns {
5
+ dialog: Dialog;
6
+ env: Env;
7
+ }
8
+ export interface Dialog {
9
+ select(config: {
10
+ title?: string;
11
+ message?: string;
12
+ list: Array<SelectDialogItem>;
13
+ multiselect?: boolean;
14
+ type?: SelectType;
15
+ preventCloseOnClick?: boolean;
16
+ buttons?: DialogButton[];
17
+ selectAllButton?: string;
18
+ }): Promise<SelectDialogResult>;
19
+ }
20
+ declare enum ButtonText {
21
+ Cancel = "Abbrechen",
22
+ No = "Nein",
23
+ Ok = "OK",
24
+ Yes = "Ja"
25
+ }
26
+ export declare enum ButtonType {
27
+ Cancel = -1,
28
+ Negative = 0,
29
+ Positive = 1
30
+ }
31
+ export interface DialogButton {
32
+ text: ButtonText | string;
33
+ buttonType: ButtonType | number;
34
+ collapseTime?: number;
35
+ textColor?: string;
36
+ backgroundColor?: string;
37
+ }
38
+ export interface SelectDialogItem {
39
+ name: string;
40
+ value: string | number;
41
+ isSelected?: boolean;
42
+ }
43
+ export interface SelectDialogResult {
44
+ buttonType: ButtonType | number;
45
+ selection: Array<SelectDialogItem>;
46
+ }
47
+ declare enum SelectType {
48
+ Default = 0,
49
+ Icon = 1,
50
+ IconAndText
51
+ }
52
+ export interface Env {
53
+ isMobile: boolean;
54
+ isTablet: boolean;
55
+ }
56
+ export {};
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ButtonType = void 0;
7
+ var ButtonType;
8
+ exports.ButtonType = ButtonType;
9
+
10
+ (function (ButtonType) {
11
+ ButtonType[ButtonType["Cancel"] = -1] = "Cancel";
12
+ ButtonType[ButtonType["Negative"] = 0] = "Negative";
13
+ ButtonType[ButtonType["Positive"] = 1] = "Positive";
14
+ })(ButtonType || (exports.ButtonType = ButtonType = {}));
15
+ //# sourceMappingURL=chayns.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/types/chayns.ts"],"names":["ButtonType"],"mappings":";;;;;;IA6BYA,U;;;WAAAA,U;AAAAA,EAAAA,U,CAAAA,U;AAAAA,EAAAA,U,CAAAA,U;AAAAA,EAAAA,U,CAAAA,U;GAAAA,U,0BAAAA,U","sourcesContent":["declare global {\n let chayns: Chayns;\n}\n\nexport interface Chayns {\n dialog: Dialog;\n env: Env;\n}\n\nexport interface Dialog {\n select(config: {\n title?: string;\n message?: string;\n list: Array<SelectDialogItem>;\n multiselect?: boolean;\n type?: SelectType;\n preventCloseOnClick?: boolean;\n buttons?: DialogButton[];\n selectAllButton?: string;\n }): Promise<SelectDialogResult>;\n}\n\ndeclare enum ButtonText {\n Cancel = 'Abbrechen',\n No = 'Nein',\n Ok = 'OK',\n Yes = 'Ja',\n}\n\nexport enum ButtonType {\n Cancel = -1,\n Negative = 0,\n Positive = 1,\n}\n\nexport interface DialogButton {\n text: ButtonText | string;\n buttonType: ButtonType | number;\n collapseTime?: number;\n textColor?: string;\n backgroundColor?: string;\n}\n\nexport interface SelectDialogItem {\n name: string;\n value: string | number;\n isSelected?: boolean;\n}\n\nexport interface SelectDialogResult {\n buttonType: ButtonType | number;\n selection: Array<SelectDialogItem>;\n}\n\ndeclare enum SelectType {\n Default = 0,\n Icon = 1,\n IconAndText,\n}\n\nexport interface Env {\n isMobile: boolean;\n isTablet: boolean;\n}\n"],"file":"chayns.js"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chayns-components/core",
3
- "version": "5.0.0-beta.22",
3
+ "version": "5.0.0-beta.26",
4
4
  "description": "A set of beautiful React components for developing your own applications with chayns.",
5
5
  "keywords": [
6
6
  "chayns",
@@ -33,25 +33,25 @@
33
33
  "url": "https://github.com/TobitSoftware/chayns-components/issues"
34
34
  },
35
35
  "devDependencies": {
36
- "@babel/cli": "^7.15.7",
37
- "@babel/core": "^7.15.8",
38
- "@babel/preset-env": "^7.15.8",
39
- "@babel/preset-react": "^7.14.5",
40
- "@babel/preset-typescript": "^7.15.0",
41
- "@types/react": "^17.0.27",
42
- "@types/react-dom": "^17.0.9",
43
- "@types/styled-components": "^5.1.15",
44
- "@types/uuid": "^8.3.1",
45
- "babel-loader": "^8.2.2",
36
+ "@babel/cli": "^7.17.3",
37
+ "@babel/core": "^7.17.5",
38
+ "@babel/preset-env": "^7.16.11",
39
+ "@babel/preset-react": "^7.16.7",
40
+ "@babel/preset-typescript": "^7.16.7",
41
+ "@types/react": "^17.0.39",
42
+ "@types/react-dom": "^17.0.11",
43
+ "@types/styled-components": "^5.1.23",
44
+ "@types/uuid": "^8.3.4",
45
+ "babel-loader": "^8.2.3",
46
46
  "lerna": "^4.0.0",
47
47
  "react": "^17.0.2",
48
48
  "react-dom": "^17.0.2",
49
- "typescript": "^4.4.3"
49
+ "typescript": "^4.5.5"
50
50
  },
51
51
  "dependencies": {
52
52
  "clsx": "^1.1.1",
53
- "framer-motion": "^4.1.17",
54
- "styled-components": "^5.3.1",
53
+ "framer-motion": "^6.2.6",
54
+ "styled-components": "^5.3.3",
55
55
  "uuid": "^8.3.2"
56
56
  },
57
57
  "peerDependencies": {
@@ -61,5 +61,5 @@
61
61
  "publishConfig": {
62
62
  "access": "public"
63
63
  },
64
- "gitHead": "ec9c3e315b0bc5469612cb97079801f29c7a21c9"
64
+ "gitHead": "0f89b97adce5d9ae2add65b32785642fea23c75b"
65
65
  }