@chayns-components/core 5.0.0-beta.104 → 5.0.0-beta.117

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.
@@ -0,0 +1,31 @@
1
+ import { FC } from 'react';
2
+ import { MentionFinderPopupAlignment } from './constants/alignment';
3
+ export type MentionMember = {
4
+ id: string;
5
+ info: string;
6
+ imageUrl: string;
7
+ name: string;
8
+ };
9
+ export type MentionFinderProps = {
10
+ /**
11
+ * The text from the input field
12
+ */
13
+ inputValue: string;
14
+ /**
15
+ * Members that can be selected
16
+ */
17
+ members: MentionMember[];
18
+ /**
19
+ * Function to be executed when a member is selected
20
+ */
21
+ onSelect: ({ fullMatch, member }: {
22
+ fullMatch: string;
23
+ member: MentionMember;
24
+ }) => void;
25
+ /**
26
+ * Alignment of the popup
27
+ */
28
+ popupAlignment: MentionFinderPopupAlignment;
29
+ };
30
+ declare const MentionFinder: FC<MentionFinderProps>;
31
+ export default MentionFinder;
@@ -0,0 +1,135 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _framerMotion = require("framer-motion");
8
+ var _react = _interopRequireWildcard(require("react"));
9
+ var _alignment = require("./constants/alignment");
10
+ var _MentionFinderItem = _interopRequireDefault(require("./mention-finder-item/MentionFinderItem"));
11
+ var _MentionFinder = require("./MentionFinder.styles");
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
14
+ 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; }
15
+ const MentionFinder = _ref => {
16
+ let {
17
+ inputValue,
18
+ members,
19
+ onSelect,
20
+ popupAlignment
21
+ } = _ref;
22
+ const [activeMember, setActiveMember] = (0, _react.useState)(members[0]);
23
+ const [fullMatch, searchString] = (0, _react.useMemo)(() => {
24
+ var _regExpMatchArray$1$t, _regExpMatchArray$;
25
+ const regExpMatchArray = inputValue.match(/@(\w*)/);
26
+ return [regExpMatchArray === null || regExpMatchArray === void 0 ? void 0 : regExpMatchArray[0], (_regExpMatchArray$1$t = regExpMatchArray === null || regExpMatchArray === void 0 ? void 0 : (_regExpMatchArray$ = regExpMatchArray[1]) === null || _regExpMatchArray$ === void 0 ? void 0 : _regExpMatchArray$.toLowerCase()) !== null && _regExpMatchArray$1$t !== void 0 ? _regExpMatchArray$1$t : ''];
27
+ }, [inputValue]);
28
+ const filteredMembers = (0, _react.useMemo)(() => searchString !== '' ? members.filter(_ref2 => {
29
+ let {
30
+ id,
31
+ info,
32
+ name
33
+ } = _ref2;
34
+ return id.toLowerCase().includes(searchString) || info.toLowerCase().includes(searchString) || name.toLowerCase().includes(searchString);
35
+ }) : members, [members, searchString]);
36
+ const handleKeyDown = (0, _react.useCallback)(event => {
37
+ let shouldPreventDefault = false;
38
+ if (event.key === 'ArrowUp') {
39
+ const currentIndex = filteredMembers.findIndex(_ref3 => {
40
+ let {
41
+ id
42
+ } = _ref3;
43
+ return id === (activeMember === null || activeMember === void 0 ? void 0 : activeMember.id);
44
+ });
45
+ const prevIndex = Math.max(currentIndex - 1, 0);
46
+ const member = filteredMembers[prevIndex];
47
+ setActiveMember(member);
48
+ shouldPreventDefault = true;
49
+ } else if (event.key === 'ArrowDown') {
50
+ const currentIndex = filteredMembers.findIndex(_ref4 => {
51
+ let {
52
+ id
53
+ } = _ref4;
54
+ return id === (activeMember === null || activeMember === void 0 ? void 0 : activeMember.id);
55
+ });
56
+ const nextIndex = Math.min(currentIndex + 1, filteredMembers.length - 1);
57
+ const member = filteredMembers[nextIndex];
58
+ setActiveMember(member);
59
+ shouldPreventDefault = true;
60
+ } else if (event.key === 'Enter') {
61
+ if (fullMatch && activeMember) {
62
+ onSelect({
63
+ fullMatch,
64
+ member: activeMember
65
+ });
66
+ shouldPreventDefault = true;
67
+ }
68
+ }
69
+ if (shouldPreventDefault) {
70
+ event.preventDefault();
71
+ event.stopPropagation();
72
+ }
73
+ }, [activeMember, filteredMembers, fullMatch, onSelect]);
74
+ const handleMemberClick = (0, _react.useCallback)(member => {
75
+ if (fullMatch) {
76
+ onSelect({
77
+ fullMatch,
78
+ member
79
+ });
80
+ }
81
+ }, [fullMatch, onSelect]);
82
+ const handleMemberHover = (0, _react.useCallback)(member => {
83
+ setActiveMember(member);
84
+ }, []);
85
+ (0, _react.useEffect)(() => {
86
+ window.addEventListener('keydown', handleKeyDown);
87
+ return () => {
88
+ window.removeEventListener('keydown', handleKeyDown);
89
+ };
90
+ }, [handleKeyDown]);
91
+ (0, _react.useEffect)(() => {
92
+ if (filteredMembers.length > 0) {
93
+ const isActiveMemberShown = filteredMembers.some(_ref5 => {
94
+ let {
95
+ id
96
+ } = _ref5;
97
+ return id === (activeMember === null || activeMember === void 0 ? void 0 : activeMember.id);
98
+ });
99
+ if (!isActiveMemberShown) {
100
+ setActiveMember(filteredMembers[0]);
101
+ }
102
+ }
103
+ }, [activeMember === null || activeMember === void 0 ? void 0 : activeMember.id, filteredMembers]);
104
+ const items = (0, _react.useMemo)(() => filteredMembers.map(member => /*#__PURE__*/_react.default.createElement(_MentionFinderItem.default, {
105
+ isActive: member.id === (activeMember === null || activeMember === void 0 ? void 0 : activeMember.id),
106
+ key: member.id,
107
+ member: member,
108
+ onClick: handleMemberClick,
109
+ onHover: handleMemberHover
110
+ })), [activeMember, filteredMembers, handleMemberClick, handleMemberHover]);
111
+ const exitAndInitialY = popupAlignment === _alignment.MentionFinderPopupAlignment.Bottom ? 16 : -16;
112
+ return /*#__PURE__*/_react.default.createElement(_MentionFinder.StyledMentionFinder, {
113
+ className: "beta-chayns-mention-finder"
114
+ }, /*#__PURE__*/_react.default.createElement(_framerMotion.AnimatePresence, {
115
+ initial: false
116
+ }, fullMatch && items.length > 0 && /*#__PURE__*/_react.default.createElement(_MentionFinder.StyledMotionMentionFinderPopup, {
117
+ animate: {
118
+ opacity: 1,
119
+ y: 0
120
+ },
121
+ exit: {
122
+ opacity: 0,
123
+ y: exitAndInitialY
124
+ },
125
+ initial: {
126
+ opacity: 0,
127
+ y: exitAndInitialY
128
+ },
129
+ popupAlignment: popupAlignment
130
+ }, items)));
131
+ };
132
+ MentionFinder.displayName = 'MentionFinder';
133
+ var _default = MentionFinder;
134
+ exports.default = _default;
135
+ //# sourceMappingURL=MentionFinder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MentionFinder.js","names":["_framerMotion","require","_react","_interopRequireWildcard","_alignment","_MentionFinderItem","_interopRequireDefault","_MentionFinder","obj","__esModule","default","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","MentionFinder","_ref","inputValue","members","onSelect","popupAlignment","activeMember","setActiveMember","useState","fullMatch","searchString","useMemo","_regExpMatchArray$1$t","_regExpMatchArray$","regExpMatchArray","match","toLowerCase","filteredMembers","filter","_ref2","id","info","name","includes","handleKeyDown","useCallback","event","shouldPreventDefault","currentIndex","findIndex","_ref3","prevIndex","Math","max","member","_ref4","nextIndex","min","length","preventDefault","stopPropagation","handleMemberClick","handleMemberHover","useEffect","window","addEventListener","removeEventListener","isActiveMemberShown","some","_ref5","items","map","createElement","isActive","onClick","onHover","exitAndInitialY","MentionFinderPopupAlignment","Bottom","StyledMentionFinder","className","AnimatePresence","initial","StyledMotionMentionFinderPopup","animate","opacity","y","exit","displayName","_default","exports"],"sources":["../../../src/components/mention-finder/MentionFinder.tsx"],"sourcesContent":["import { AnimatePresence } from 'framer-motion';\nimport React, { FC, useCallback, useEffect, useMemo, useState } from 'react';\nimport { MentionFinderPopupAlignment } from './constants/alignment';\nimport MentionFinderItem from './mention-finder-item/MentionFinderItem';\nimport { StyledMentionFinder, StyledMotionMentionFinderPopup } from './MentionFinder.styles';\n\nexport type MentionMember = {\n id: string;\n info: string;\n imageUrl: string;\n name: string;\n};\n\nexport type MentionFinderProps = {\n /**\n * The text from the input field\n */\n inputValue: string;\n /**\n * Members that can be selected\n */\n members: MentionMember[];\n /**\n * Function to be executed when a member is selected\n */\n onSelect: ({ fullMatch, member }: { fullMatch: string; member: MentionMember }) => void;\n /**\n * Alignment of the popup\n */\n popupAlignment: MentionFinderPopupAlignment;\n};\n\nconst MentionFinder: FC<MentionFinderProps> = ({\n inputValue,\n members,\n onSelect,\n popupAlignment,\n}) => {\n const [activeMember, setActiveMember] = useState(members[0]);\n\n const [fullMatch, searchString] = useMemo(() => {\n const regExpMatchArray = inputValue.match(/@(\\w*)/);\n\n return [regExpMatchArray?.[0], regExpMatchArray?.[1]?.toLowerCase() ?? ''];\n }, [inputValue]);\n\n const filteredMembers = useMemo(\n () =>\n searchString !== ''\n ? members.filter(\n ({ id, info, name }) =>\n id.toLowerCase().includes(searchString) ||\n info.toLowerCase().includes(searchString) ||\n name.toLowerCase().includes(searchString)\n )\n : members,\n [members, searchString]\n );\n\n const handleKeyDown = useCallback(\n (event: KeyboardEvent) => {\n let shouldPreventDefault = false;\n\n if (event.key === 'ArrowUp') {\n const currentIndex = filteredMembers.findIndex(({ id }) => id === activeMember?.id);\n\n const prevIndex = Math.max(currentIndex - 1, 0);\n\n const member = filteredMembers[prevIndex];\n\n setActiveMember(member);\n\n shouldPreventDefault = true;\n } else if (event.key === 'ArrowDown') {\n const currentIndex = filteredMembers.findIndex(({ id }) => id === activeMember?.id);\n\n const nextIndex = Math.min(currentIndex + 1, filteredMembers.length - 1);\n\n const member = filteredMembers[nextIndex];\n\n setActiveMember(member);\n\n shouldPreventDefault = true;\n } else if (event.key === 'Enter') {\n if (fullMatch && activeMember) {\n onSelect({ fullMatch, member: activeMember });\n\n shouldPreventDefault = true;\n }\n }\n\n if (shouldPreventDefault) {\n event.preventDefault();\n event.stopPropagation();\n }\n },\n [activeMember, filteredMembers, fullMatch, onSelect]\n );\n\n const handleMemberClick = useCallback(\n (member: MentionMember) => {\n if (fullMatch) {\n onSelect({ fullMatch, member });\n }\n },\n [fullMatch, onSelect]\n );\n\n const handleMemberHover = useCallback((member: MentionMember) => {\n setActiveMember(member);\n }, []);\n\n useEffect(() => {\n window.addEventListener('keydown', handleKeyDown);\n\n return () => {\n window.removeEventListener('keydown', handleKeyDown);\n };\n }, [handleKeyDown]);\n\n useEffect(() => {\n if (filteredMembers.length > 0) {\n const isActiveMemberShown = filteredMembers.some(({ id }) => id === activeMember?.id);\n\n if (!isActiveMemberShown) {\n setActiveMember(filteredMembers[0]);\n }\n }\n }, [activeMember?.id, filteredMembers]);\n\n const items = useMemo(\n () =>\n filteredMembers.map((member) => (\n <MentionFinderItem\n isActive={member.id === activeMember?.id}\n key={member.id}\n member={member}\n onClick={handleMemberClick}\n onHover={handleMemberHover}\n />\n )),\n [activeMember, filteredMembers, handleMemberClick, handleMemberHover]\n );\n\n const exitAndInitialY = popupAlignment === MentionFinderPopupAlignment.Bottom ? 16 : -16;\n\n return (\n <StyledMentionFinder className=\"beta-chayns-mention-finder\">\n <AnimatePresence initial={false}>\n {fullMatch && items.length > 0 && (\n <StyledMotionMentionFinderPopup\n animate={{ opacity: 1, y: 0 }}\n exit={{ opacity: 0, y: exitAndInitialY }}\n initial={{ opacity: 0, y: exitAndInitialY }}\n popupAlignment={popupAlignment}\n >\n {items}\n </StyledMotionMentionFinderPopup>\n )}\n </AnimatePresence>\n </StyledMentionFinder>\n );\n};\n\nMentionFinder.displayName = 'MentionFinder';\n\nexport default MentionFinder;\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,uBAAA,CAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,kBAAA,GAAAC,sBAAA,CAAAL,OAAA;AACA,IAAAM,cAAA,GAAAN,OAAA;AAA6F,SAAAK,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAT,wBAAAK,GAAA,EAAAI,WAAA,SAAAA,WAAA,IAAAJ,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oBAAAA,GAAA,wBAAAA,GAAA,4BAAAE,OAAA,EAAAF,GAAA,UAAAQ,KAAA,GAAAL,wBAAA,CAAAC,WAAA,OAAAI,KAAA,IAAAA,KAAA,CAAAC,GAAA,CAAAT,GAAA,YAAAQ,KAAA,CAAAE,GAAA,CAAAV,GAAA,SAAAW,MAAA,WAAAC,qBAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,GAAA,IAAAhB,GAAA,QAAAgB,GAAA,kBAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAnB,GAAA,EAAAgB,GAAA,SAAAI,IAAA,GAA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AEC,OAAO,EAAE,CAAC;MAAEC,CAAC,EAAE;IAAE,CAAE;IAC9BC,IAAI,EAAE;MAAEF,OAAO,EAAE,CAAC;MAAEC,CAAC,EAAEV;IAAgB,CAAE;IACzCM,OAAO,EAAE;MAAEG,OAAO,EAAE,CAAC;MAAEC,CAAC,EAAEV;IAAgB,CAAE;IAC5CnD,cAAc,EAAEA;EAAe,GAE9B6C,KAAK,CAEb,CACa,CACA;AAE9B,CAAC;AAEDlD,aAAa,CAACoE,WAAW,GAAG,eAAe;AAAC,IAAAC,QAAA,GAE7BrE,aAAa;AAAAsE,OAAA,CAAA1F,OAAA,GAAAyF,QAAA"}
@@ -0,0 +1,5 @@
1
+ import type { MentionFinderProps } from './MentionFinder';
2
+ export declare const StyledMentionFinder: import("styled-components").StyledComponent<"div", any, {}, never>;
3
+ export declare const StyledMotionMentionFinderPopup: import("styled-components").StyledComponent<import("framer-motion").ForwardRefComponent<HTMLDivElement, import("framer-motion").HTMLMotionProps<"div">>, any, Pick<MentionFinderProps, "popupAlignment"> & {
4
+ theme: import("../color-scheme-provider/ColorSchemeProvider").Theme;
5
+ }, never>;
@@ -0,0 +1,94 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.StyledMotionMentionFinderPopup = exports.StyledMentionFinder = void 0;
7
+ var _framerMotion = require("framer-motion");
8
+ var _styledComponents = _interopRequireWildcard(require("styled-components"));
9
+ var _alignment = require("./constants/alignment");
10
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
11
+ 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; }
12
+ const StyledMentionFinder = _styledComponents.default.div`
13
+ position: relative;
14
+ `;
15
+ exports.StyledMentionFinder = StyledMentionFinder;
16
+ const StyledMotionMentionFinderPopup = (0, _styledComponents.default)(_framerMotion.motion.div)`
17
+ background-color: ${_ref => {
18
+ let {
19
+ theme
20
+ } = _ref;
21
+ return theme['001'];
22
+ }};
23
+ border: 1px solid rgba(0, 0, 0, 0.1);
24
+ border-radius: 3px;
25
+ box-shadow: 1px 3px 8px rgba(0, 0, 0, 0.1);
26
+ left: 0;
27
+ max-height: 300px;
28
+ overflow-y: scroll;
29
+ position: absolute;
30
+ width: 100%;
31
+
32
+ ${_ref2 => {
33
+ let {
34
+ popupAlignment
35
+ } = _ref2;
36
+ switch (popupAlignment) {
37
+ case _alignment.MentionFinderPopupAlignment.Bottom:
38
+ return (0, _styledComponents.css)`
39
+ top: 0;
40
+ `;
41
+ case _alignment.MentionFinderPopupAlignment.Top:
42
+ return (0, _styledComponents.css)`
43
+ bottom: 0;
44
+ `;
45
+ default:
46
+ return undefined;
47
+ }
48
+ }}
49
+
50
+ // Styles for custom scrollbar
51
+ ::-webkit-scrollbar {
52
+ width: 5px;
53
+ }
54
+
55
+ ::-webkit-scrollbar-track {
56
+ background-color: transparent;
57
+ }
58
+
59
+ ::-webkit-scrollbar-button {
60
+ background-color: transparent;
61
+ height: 5px;
62
+ }
63
+
64
+ ::-webkit-scrollbar-thumb {
65
+ background-color: rgba(
66
+ ${_ref3 => {
67
+ let {
68
+ theme
69
+ } = _ref3;
70
+ return theme['text-rgb'];
71
+ }},
72
+ 0.15
73
+ );
74
+ border-radius: 20px;
75
+ }
76
+
77
+ // Scrollbar styles for Firefox. The above styles are not supported in Firefox, these styles are
78
+ // only supported in Firefox:
79
+ * {
80
+ scrollbar-color: rgba(
81
+ ${_ref4 => {
82
+ let {
83
+ theme
84
+ } = _ref4;
85
+ return theme['text-rgb'];
86
+ }},
87
+ 0.15
88
+ )
89
+ transparent;
90
+ scrollbar-width: thin;
91
+ }
92
+ `;
93
+ exports.StyledMotionMentionFinderPopup = StyledMotionMentionFinderPopup;
94
+ //# sourceMappingURL=MentionFinder.styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MentionFinder.styles.js","names":["_framerMotion","require","_styledComponents","_interopRequireWildcard","_alignment","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","StyledMentionFinder","styled","div","exports","StyledMotionMentionFinderPopup","motion","_ref","theme","_ref2","popupAlignment","MentionFinderPopupAlignment","Bottom","css","Top","undefined","_ref3","_ref4"],"sources":["../../../src/components/mention-finder/MentionFinder.styles.ts"],"sourcesContent":["import { motion } from 'framer-motion';\nimport styled, { css } from 'styled-components';\nimport type { WithTheme } from '../color-scheme-provider/ColorSchemeProvider';\nimport { MentionFinderPopupAlignment } from './constants/alignment';\nimport type { MentionFinderProps } from './MentionFinder';\n\nexport const StyledMentionFinder = styled.div`\n position: relative;\n`;\n\ntype StyledMentionFinderPopupProps = WithTheme<Pick<MentionFinderProps, 'popupAlignment'>>;\n\nexport const StyledMotionMentionFinderPopup = styled(motion.div)<StyledMentionFinderPopupProps>`\n background-color: ${({ theme }: StyledMentionFinderPopupProps) => theme['001']};\n border: 1px solid rgba(0, 0, 0, 0.1);\n border-radius: 3px;\n box-shadow: 1px 3px 8px rgba(0, 0, 0, 0.1);\n left: 0;\n max-height: 300px;\n overflow-y: scroll;\n position: absolute;\n width: 100%;\n\n ${({ popupAlignment }) => {\n switch (popupAlignment) {\n case MentionFinderPopupAlignment.Bottom:\n return css`\n top: 0;\n `;\n case MentionFinderPopupAlignment.Top:\n return css`\n bottom: 0;\n `;\n default:\n return undefined;\n }\n }}\n\n // Styles for custom scrollbar\n ::-webkit-scrollbar {\n width: 5px;\n }\n\n ::-webkit-scrollbar-track {\n background-color: transparent;\n }\n\n ::-webkit-scrollbar-button {\n background-color: transparent;\n height: 5px;\n }\n\n ::-webkit-scrollbar-thumb {\n background-color: rgba(\n ${({ theme }: StyledMentionFinderPopupProps) => theme['text-rgb']},\n 0.15\n );\n border-radius: 20px;\n }\n\n // Scrollbar styles for Firefox. The above styles are not supported in Firefox, these styles are\n // only supported in Firefox:\n * {\n scrollbar-color: rgba(\n ${({ theme }: StyledMentionFinderPopupProps) => theme['text-rgb']},\n 0.15\n )\n transparent;\n scrollbar-width: thin;\n }\n`;\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAC,uBAAA,CAAAF,OAAA;AAEA,IAAAG,UAAA,GAAAH,OAAA;AAAoE,SAAAI,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAH,wBAAAO,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oBAAAA,GAAA,wBAAAA,GAAA,4BAAAE,OAAA,EAAAF,GAAA,UAAAG,KAAA,GAAAR,wBAAA,CAAAC,WAAA,OAAAO,KAAA,IAAAA,KAAA,CAAAC,GAAA,CAAAJ,GAAA,YAAAG,KAAA,CAAAE,GAAA,CA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AAC;AAE7B,CAAE;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAcC,KAAA;EAAA,IAAC;IAAER;EAAqC,CAAC,GAAAQ,KAAA;EAAA,OAAKR,KAAK,CAAC,UAAU,CAAC;AAAA,CAAC;AAC9E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkBS,KAAA;EAAA,IAAC;IAAET;EAAqC,CAAC,GAAAS,KAAA;EAAA,OAAKT,KAAK,CAAC,UAAU,CAAC;AAAA,CAAC;AAClF;AACA;AACA;AACA;AACA;AACA,CAAC;AAACJ,OAAA,CAAAC,8BAAA,GAAAA,8BAAA"}
@@ -0,0 +1,4 @@
1
+ export declare enum MentionFinderPopupAlignment {
2
+ Top = 0,
3
+ Bottom = 1
4
+ }
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.MentionFinderPopupAlignment = void 0;
7
+ let MentionFinderPopupAlignment = /*#__PURE__*/function (MentionFinderPopupAlignment) {
8
+ MentionFinderPopupAlignment[MentionFinderPopupAlignment["Top"] = 0] = "Top";
9
+ MentionFinderPopupAlignment[MentionFinderPopupAlignment["Bottom"] = 1] = "Bottom";
10
+ return MentionFinderPopupAlignment;
11
+ }({});
12
+ exports.MentionFinderPopupAlignment = MentionFinderPopupAlignment;
13
+ //# sourceMappingURL=alignment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alignment.js","names":["MentionFinderPopupAlignment","exports"],"sources":["../../../../src/components/mention-finder/constants/alignment.ts"],"sourcesContent":["export enum MentionFinderPopupAlignment {\n Top,\n Bottom,\n}\n"],"mappings":";;;;;;IAAYA,2BAA2B,0BAA3BA,2BAA2B;EAA3BA,2BAA2B,CAA3BA,2BAA2B;EAA3BA,2BAA2B,CAA3BA,2BAA2B;EAAA,OAA3BA,2BAA2B;AAAA;AAAAC,OAAA,CAAAD,2BAAA,GAAAA,2BAAA"}
@@ -0,0 +1,10 @@
1
+ import { FC } from 'react';
2
+ import type { MentionMember } from '../MentionFinder';
3
+ export type MentionFinderItemProps = {
4
+ isActive: boolean;
5
+ member: MentionMember;
6
+ onClick: (member: MentionMember) => void;
7
+ onHover: (member: MentionMember) => void;
8
+ };
9
+ declare const MentionFinderItem: FC<MentionFinderItemProps>;
10
+ export default MentionFinderItem;
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _react = _interopRequireWildcard(require("react"));
8
+ var _MentionFinderItem = require("./MentionFinderItem.styles");
9
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
10
+ 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; }
11
+ const MentionFinderItem = _ref => {
12
+ let {
13
+ isActive,
14
+ member,
15
+ onClick,
16
+ onHover
17
+ } = _ref;
18
+ const handleItemClick = (0, _react.useCallback)(() => onClick(member), [member, onClick]);
19
+ const handleItemMouseEnter = (0, _react.useCallback)(() => onHover(member), [member, onHover]);
20
+ return /*#__PURE__*/_react.default.createElement(_MentionFinderItem.StyledMentionFinderItem, {
21
+ isActive: isActive,
22
+ onClick: handleItemClick,
23
+ onMouseEnter: handleItemMouseEnter
24
+ }, /*#__PURE__*/_react.default.createElement(_MentionFinderItem.StyledMentionFinderItemImage, {
25
+ src: member.imageUrl
26
+ }), /*#__PURE__*/_react.default.createElement(_MentionFinderItem.StyledMentionFinderItemContent, null, /*#__PURE__*/_react.default.createElement(_MentionFinderItem.StyledMentionFinderItemContentName, null, member.name), /*#__PURE__*/_react.default.createElement(_MentionFinderItem.StyledMentionFinderItemContentInfo, null, member.info)));
27
+ };
28
+ MentionFinderItem.displayName = 'MentionFinder';
29
+ var _default = MentionFinderItem;
30
+ exports.default = _default;
31
+ //# sourceMappingURL=MentionFinderItem.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MentionFinderItem.js","names":["_react","_interopRequireWildcard","require","_MentionFinderItem","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","MentionFinderItem","_ref","isActive","member","onClick","onHover","handleItemClick","useCallback","handleItemMouseEnter","createElement","StyledMentionFinderItem","onMouseEnter","StyledMentionFinderItemImage","src","imageUrl","StyledMentionFinderItemContent","StyledMentionFinderItemContentName","name","StyledMentionFinderItemContentInfo","info","displayName","_default","exports"],"sources":["../../../../src/components/mention-finder/mention-finder-item/MentionFinderItem.tsx"],"sourcesContent":["import React, { FC, useCallback } from 'react';\nimport type { MentionMember } from '../MentionFinder';\nimport {\n StyledMentionFinderItem,\n StyledMentionFinderItemContent,\n StyledMentionFinderItemContentInfo,\n StyledMentionFinderItemContentName,\n StyledMentionFinderItemImage,\n} from './MentionFinderItem.styles';\n\nexport type MentionFinderItemProps = {\n isActive: boolean;\n member: MentionMember;\n onClick: (member: MentionMember) => void;\n onHover: (member: MentionMember) => void;\n};\n\nconst MentionFinderItem: FC<MentionFinderItemProps> = ({ isActive, member, onClick, onHover }) => {\n const handleItemClick = useCallback(() => onClick(member), [member, onClick]);\n\n const handleItemMouseEnter = useCallback(() => onHover(member), [member, onHover]);\n\n return (\n <StyledMentionFinderItem\n isActive={isActive}\n onClick={handleItemClick}\n onMouseEnter={handleItemMouseEnter}\n >\n <StyledMentionFinderItemImage src={member.imageUrl} />\n <StyledMentionFinderItemContent>\n <StyledMentionFinderItemContentName>\n {member.name}\n </StyledMentionFinderItemContentName>\n <StyledMentionFinderItemContentInfo>\n {member.info}\n </StyledMentionFinderItemContentInfo>\n </StyledMentionFinderItemContent>\n </StyledMentionFinderItem>\n );\n};\n\nMentionFinderItem.displayName = 'MentionFinder';\n\nexport default MentionFinderItem;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAEA,IAAAC,kBAAA,GAAAD,OAAA;AAMoC,SAAAE,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAJ,wBAAAQ,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oBAAAA,GAAA,wBAAAA,GAAA,4BAAAE,OAAA,EAAAF,GAAA,UAAAG,KAAA,GAAAR,wBAAA,CAAAC,WAAA,OAAAO,KAAA,IAAAA,KAAA,CAAAC,GAAA,CAAAJ,GAAA,YAAAG,KAAA,CAAAE,GAAA,CAAAL,GAAA,SAAAM,MAAA,WAAAC,qBAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,GAAA,IAAAX,GAAA,QAAAW,GAAA,kBAAAH,MAA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AAChC,kBAAA,CAAAuC,kCAAkC,QAC9Bb,MAAM,CAACc,IAAI,CACqB,eACrC3C,MAAA,CAAAW,OAAA,CAAAwB,aAAA,CAAChC,kBAAA,CAAAyC,kCAAkC,QAC9Bf,MAAM,CAACgB,IAAI,CACqB,CACR,CACX;AAElC,CAAC;AAEDnB,iBAAiB,CAACoB,WAAW,GAAG,eAAe;AAAC,IAAAC,QAAA,GAEjCrB,iBAAiB;AAAAsB,OAAA,CAAArC,OAAA,GAAAoC,QAAA"}
@@ -0,0 +1,8 @@
1
+ import type { MentionFinderItemProps } from './MentionFinderItem';
2
+ export declare const StyledMentionFinderItem: import("styled-components").StyledComponent<"div", any, Pick<MentionFinderItemProps, "isActive"> & {
3
+ theme: import("../../color-scheme-provider/ColorSchemeProvider").Theme;
4
+ }, never>;
5
+ export declare const StyledMentionFinderItemImage: import("styled-components").StyledComponent<"img", any, {}, never>;
6
+ export declare const StyledMentionFinderItemContent: import("styled-components").StyledComponent<"div", any, {}, never>;
7
+ export declare const StyledMentionFinderItemContentName: import("styled-components").StyledComponent<"div", any, {}, never>;
8
+ export declare const StyledMentionFinderItemContentInfo: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -0,0 +1,100 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.StyledMentionFinderItemImage = exports.StyledMentionFinderItemContentName = exports.StyledMentionFinderItemContentInfo = exports.StyledMentionFinderItemContent = exports.StyledMentionFinderItem = void 0;
7
+ var _styledComponents = _interopRequireWildcard(require("styled-components"));
8
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
9
+ 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; }
10
+ const StyledMentionFinderItem = _styledComponents.default.div`
11
+ align-items: center;
12
+ cursor: pointer;
13
+ display: flex;
14
+ height: 64px;
15
+ padding: 12px 9px;
16
+
17
+ :not(:last-child) {
18
+ border-bottom: 1px solid
19
+ rgba(${_ref => {
20
+ let {
21
+ theme
22
+ } = _ref;
23
+ return theme['text-rgb'];
24
+ }}, 0.15);
25
+ }
26
+
27
+ :nth-child(even) {
28
+ background-color: ${_ref2 => {
29
+ let {
30
+ theme
31
+ } = _ref2;
32
+ return theme['002'];
33
+ }};
34
+ }
35
+
36
+ ${_ref3 => {
37
+ let {
38
+ isActive
39
+ } = _ref3;
40
+ return isActive && (0, _styledComponents.css)`
41
+ background-color: ${_ref4 => {
42
+ let {
43
+ theme
44
+ } = _ref4;
45
+ return theme['102'];
46
+ }} !important;
47
+ `;
48
+ }}
49
+ `;
50
+ exports.StyledMentionFinderItem = StyledMentionFinderItem;
51
+ const StyledMentionFinderItemImage = _styledComponents.default.img`
52
+ background-color: rgba(
53
+ ${_ref5 => {
54
+ let {
55
+ theme
56
+ } = _ref5;
57
+ return theme['text-rgb'];
58
+ }},
59
+ 0.1
60
+ );
61
+ border-radius: 50%;
62
+ box-shadow: 0 0 0 1px
63
+ rgba(${_ref6 => {
64
+ let {
65
+ theme
66
+ } = _ref6;
67
+ return theme['009-rgb'];
68
+ }}, 0.08) inset;
69
+ flex: 0 0 auto;
70
+ height: 40px;
71
+ overflow: hidden;
72
+ transition: border-radius 0.3s ease;
73
+ width: 40px;
74
+ `;
75
+ exports.StyledMentionFinderItemImage = StyledMentionFinderItemImage;
76
+ const StyledMentionFinderItemContent = _styledComponents.default.div`
77
+ color: ${_ref7 => {
78
+ let {
79
+ theme
80
+ } = _ref7;
81
+ return theme.text;
82
+ }};
83
+ display: flex;
84
+ flex: 1 1 auto;
85
+ flex-direction: column;
86
+ justify-content: center;
87
+ line-height: normal;
88
+ margin-left: 10px;
89
+ min-width: 0;
90
+ `;
91
+ exports.StyledMentionFinderItemContent = StyledMentionFinderItemContent;
92
+ const StyledMentionFinderItemContentName = _styledComponents.default.div``;
93
+ exports.StyledMentionFinderItemContentName = StyledMentionFinderItemContentName;
94
+ const StyledMentionFinderItemContentInfo = _styledComponents.default.div`
95
+ font-size: 85%;
96
+ margin-top: 2px;
97
+ opacity: 0.75;
98
+ `;
99
+ exports.StyledMentionFinderItemContentInfo = StyledMentionFinderItemContentInfo;
100
+ //# sourceMappingURL=MentionFinderItem.styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MentionFinderItem.styles.js","names":["_styledComponents","_interopRequireWildcard","require","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","StyledMentionFinderItem","styled","div","_ref","theme","_ref2","_ref3","isActive","css","_ref4","exports","StyledMentionFinderItemImage","img","_ref5","_ref6","StyledMentionFinderItemContent","_ref7","text","StyledMentionFinderItemContentName","StyledMentionFinderItemContentInfo"],"sources":["../../../../src/components/mention-finder/mention-finder-item/MentionFinderItem.styles.ts"],"sourcesContent":["import styled, { css } from 'styled-components';\nimport type { WithTheme } from '../../color-scheme-provider/ColorSchemeProvider';\nimport type { MentionFinderItemProps } from './MentionFinderItem';\n\ntype StyledMentionFinderItemProps = WithTheme<Pick<MentionFinderItemProps, 'isActive'>>;\n\nexport const StyledMentionFinderItem = styled.div<StyledMentionFinderItemProps>`\n align-items: center;\n cursor: pointer;\n display: flex;\n height: 64px;\n padding: 12px 9px;\n\n :not(:last-child) {\n border-bottom: 1px solid\n rgba(${({ theme }: StyledMentionFinderItemProps) => theme['text-rgb']}, 0.15);\n }\n\n :nth-child(even) {\n background-color: ${({ theme }: StyledMentionFinderItemProps) => theme['002']};\n }\n\n ${({ isActive }) =>\n isActive &&\n css`\n background-color: ${({ theme }: StyledMentionFinderItemProps) =>\n theme['102']} !important;\n `}\n`;\n\ntype StyledMentionFinderItemImageProps = WithTheme<unknown>;\n\nexport const StyledMentionFinderItemImage = styled.img`\n background-color: rgba(\n ${({ theme }: StyledMentionFinderItemImageProps) => theme['text-rgb']},\n 0.1\n );\n border-radius: 50%;\n box-shadow: 0 0 0 1px\n rgba(${({ theme }: StyledMentionFinderItemImageProps) => 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 StyledMentionFinderItemContentProps = WithTheme<unknown>;\n\nexport const StyledMentionFinderItemContent = styled.div`\n color: ${({ theme }: StyledMentionFinderItemContentProps) => theme.text};\n display: flex;\n flex: 1 1 auto;\n flex-direction: column;\n justify-content: center;\n line-height: normal;\n margin-left: 10px;\n min-width: 0;\n`;\n\nexport const StyledMentionFinderItemContentName = styled.div``;\n\nexport const StyledMentionFinderItemContentInfo = styled.div`\n font-size: 85%;\n margin-top: 2px;\n opacity: 0.75;\n`;\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,uBAAA,CAAAC,OAAA;AAAgD,SAAAC,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAH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urls: string | string[], start?: number): Promise<undefined>;
8
+ openVideo(url: string): Promise<void>;
7
9
  }
8
10
  export interface Dialog {
9
11
  select(config: {
@@ -1 +1 @@
1
- {"version":3,"file":"chayns.js","names":["ButtonType","exports"],"sources":["../../src/types/chayns.ts"],"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 isApp: boolean;\n isMobile: boolean;\n isTablet: boolean;\n}\n"],"mappings":";;;;;;IA6BYA,UAAU,0BAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAA,OAAVA,UAAU;AAAA;AAAAC,OAAA,CAAAD,UAAA,GAAAA,UAAA"}
1
+ {"version":3,"file":"chayns.js","names":["ButtonType","exports"],"sources":["../../src/types/chayns.ts"],"sourcesContent":["declare global {\n let chayns: Chayns;\n}\n\nexport interface Chayns {\n dialog: Dialog;\n env: Env;\n openImage(urls: string | string[], start?: number): Promise<undefined>;\n openVideo(url: string): Promise<void>;\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 isApp: boolean;\n isMobile: boolean;\n isTablet: boolean;\n}\n"],"mappings":";;;;;;IA+BYA,UAAU,0BAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAA,OAAVA,UAAU;AAAA;AAAAC,OAAA,CAAAD,UAAA,GAAAA,UAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chayns-components/core",
3
- "version": "5.0.0-beta.104",
3
+ "version": "5.0.0-beta.117",
4
4
  "description": "A set of beautiful React components for developing your own applications with chayns.",
5
5
  "keywords": [
6
6
  "chayns",
@@ -62,5 +62,5 @@
62
62
  "publishConfig": {
63
63
  "access": "public"
64
64
  },
65
- "gitHead": "14f15be7baf4fd754b013d36f1b88b2f9a8c4f77"
65
+ "gitHead": "11e687f9cc1139b4f17337ed6aa2a8507b4f997d"
66
66
  }