@chayns-components/core 5.0.0-beta.970 → 5.0.0-beta.972

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.
@@ -24,6 +24,7 @@ const FileInput = /*#__PURE__*/(0, _react.forwardRef)(({
24
24
  maxFiles,
25
25
  onRemove,
26
26
  files,
27
+ isDisabled,
27
28
  maxFileSizeInMB,
28
29
  onAdd,
29
30
  fileSelectionPlaceholder = 'Dateien hochladen',
@@ -115,7 +116,10 @@ const FileInput = /*#__PURE__*/(0, _react.forwardRef)(({
115
116
  }
116
117
  onRemove(fileToDelete);
117
118
  }, [files, internalFiles, internalImages, onRemove]);
118
- const isDisabled = (0, _react.useMemo)(() => {
119
+ const internalIsDisabled = (0, _react.useMemo)(() => {
120
+ if (isDisabled) {
121
+ return true;
122
+ }
119
123
  if (maxFiles) {
120
124
  if (internalFiles.length + internalImages.length >= maxFiles) {
121
125
  if (typeof onMaxFilesReached === 'function') {
@@ -125,9 +129,9 @@ const FileInput = /*#__PURE__*/(0, _react.forwardRef)(({
125
129
  }
126
130
  }
127
131
  return false;
128
- }, [internalFiles.length, internalImages.length, maxFiles, onMaxFilesReached]);
132
+ }, [internalFiles.length, internalImages.length, isDisabled, maxFiles, onMaxFilesReached]);
129
133
  const handleImageSelectionClick = (0, _react.useCallback)(async () => {
130
- if (isDisabled) {
134
+ if (internalIsDisabled) {
131
135
  return;
132
136
  }
133
137
  const {
@@ -156,9 +160,9 @@ const FileInput = /*#__PURE__*/(0, _react.forwardRef)(({
156
160
  if (buttonType === 1 && result !== null && result !== void 0 && result.url) {
157
161
  handleAddImages([result.url]);
158
162
  }
159
- }, [handleAddImages, isDisabled]);
163
+ }, [handleAddImages, internalIsDisabled]);
160
164
  const handleFileSelectionClick = (0, _react.useCallback)(async () => {
161
- if (isDisabled) {
165
+ if (internalIsDisabled) {
162
166
  return;
163
167
  }
164
168
  const newFiles = await (0, _fileDialog.selectFiles)({
@@ -167,7 +171,7 @@ const FileInput = /*#__PURE__*/(0, _react.forwardRef)(({
167
171
  maxFileSizeInMB
168
172
  });
169
173
  handleAddFiles(newFiles);
170
- }, [fileTypes, handleAddFiles, isDisabled, maxFileSizeInMB]);
174
+ }, [fileTypes, handleAddFiles, internalIsDisabled, maxFileSizeInMB]);
171
175
  const handleDrop = (0, _react.useCallback)(e => {
172
176
  e.preventDefault();
173
177
  const draggedFiles = Array.from(e.dataTransfer.files);
@@ -229,7 +233,7 @@ const FileInput = /*#__PURE__*/(0, _react.forwardRef)(({
229
233
  return items;
230
234
  }, [files, handleDeleteFile, maxFiles]);
231
235
  return (0, _react.useMemo)(() => /*#__PURE__*/_react.default.createElement(_FileInput.StyledFileInput, null, /*#__PURE__*/_react.default.createElement(_FileInput.StyledFileInputWrapper, {
232
- $isDisabled: isDisabled
236
+ $isDisabled: internalIsDisabled
233
237
  }, /*#__PURE__*/_react.default.createElement(_FileInput.StyledFileInputContainer, {
234
238
  onClick: () => void handleFileSelectionClick(),
235
239
  onDragOver: e => e.preventDefault(),
@@ -247,7 +251,7 @@ const FileInput = /*#__PURE__*/(0, _react.forwardRef)(({
247
251
  $shouldShowBorder: content.length > 0
248
252
  }, /*#__PURE__*/_react.default.createElement(_List.default, null, /*#__PURE__*/_react.default.createElement(_framerMotion.AnimatePresence, {
249
253
  initial: false
250
- }, uploadedFiles)))), [isDisabled, fileSelectionIcons, fileSelectionPlaceholder, imageSelectPlaceholder, imageSelectIcons, content, uploadedFiles, handleFileSelectionClick, handleDrop, handleImageSelectionClick]);
254
+ }, uploadedFiles)))), [internalIsDisabled, fileSelectionIcons, fileSelectionPlaceholder, imageSelectPlaceholder, imageSelectIcons, content, uploadedFiles, handleFileSelectionClick, handleDrop, handleImageSelectionClick]);
251
255
  });
252
256
  FileInput.displayName = 'FileInput';
253
257
  var _default = exports.default = FileInput;
@@ -1 +1 @@
1
- {"version":3,"file":"FileInput.js","names":["_chaynsApi","require","_framerMotion","_react","_interopRequireWildcard","_file","_fileDialog","_Icon","_interopRequireDefault","_List","_FileListItem","_FileInput","e","__esModule","default","_getRequireWildcardCache","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","FileInput","forwardRef","fileSelectionIcons","imageSelectIcons","fileTypes","onMaxFilesReached","maxFiles","onRemove","files","maxFileSizeInMB","onAdd","fileSelectionPlaceholder","imageSelectPlaceholder","ref","internalFiles","setInternalFiles","useState","internalImages","setInternalImages","handleInputClear","useImperativeHandle","clear","handleAddImages","useCallback","images","newImages","forEach","image","filterDuplicateFileUrls","newFile","push","tmp","slice","length","prevState","handleAddFiles","newFiles","newFileItems","file","isValidFileType","types","filterDuplicateFile","handleDeleteFile","fileName","fileToDelete","filteredFiles","filter","name","filteredImages","url","isDisabled","useMemo","handleImageSelectionClick","buttonType","result","createDialog","dialogInput","upload","buttons","text","initialView","type","DialogType","MODULE","system","scope","module","open","handleFileSelectionClick","selectFiles","multiple","handleDrop","preventDefault","draggedFiles","Array","from","dataTransfer","content","combinedFiles","items","map","createElement","StyledMotionFileInputList","animate","height","opacity","exit","key","transition","duration","fileType","undefined","fileSize","size","uploadedFiles","cutFiles","splice","id","StyledFileInput","StyledFileInputWrapper","$isDisabled","StyledFileInputContainer","onClick","onDragOver","onDrop","icons","StyledFileInputText","$isImageSelection","AnimatePresence","initial","StyledUploadedFilesList","$shouldShowBorder","displayName","_default","exports"],"sources":["../../../../src/components/file-input/FileInput.tsx"],"sourcesContent":["import { createDialog, DialogType } from 'chayns-api';\nimport { AnimatePresence } from 'framer-motion';\nimport React, {\n DragEvent,\n forwardRef,\n ReactElement,\n useCallback,\n useImperativeHandle,\n useMemo,\n useState,\n} from 'react';\nimport type { FileInputFileItem, ImageDialogResult } from '../../types/fileInput';\nimport { filterDuplicateFile, filterDuplicateFileUrls, isValidFileType } from '../../utils/file';\nimport { selectFiles } from '../../utils/fileDialog';\nimport Icon from '../icon/Icon';\nimport List from '../list/List';\nimport FileListItem from './file-list/FileListItem';\nimport {\n StyledFileInput,\n StyledFileInputContainer,\n StyledFileInputText,\n StyledFileInputWrapper,\n StyledMotionFileInputList,\n StyledUploadedFilesList,\n} from './FileInput.styles';\n\nexport type FileInputProps = {\n /**\n * Already uploaded files to display.\n */\n files?: FileInputFileItem[];\n /**\n * An array of icons that should be displayed inside the FileInput\n */\n fileSelectionIcons?: string[];\n /**\n * The text that should be displayed inside the FileInput.\n */\n fileSelectionPlaceholder?: string;\n /**\n * The filetypes that could be selected. Example for multiple types: 'image/*, video/*'.\n */\n fileTypes?: string;\n /**\n * The icon of the image selection.\n */\n imageSelectIcons?: string[];\n /**\n * If set, pictures can be select via Pixabay.\n */\n imageSelectPlaceholder?: string;\n /**\n * The maximum amount of Files that can be uploaded.\n */\n maxFiles?: number;\n /**\n * The maximum size of a file in MB.\n */\n maxFileSizeInMB?: number;\n /**\n * A function to be executed when files are added.\n */\n onAdd?: (files: File[] | string[]) => void;\n /**\n * Function to be executed when the maximum amount of Files are reached.\n */\n onMaxFilesReached?: () => void;\n /**\n * A function to be executed when a file is removed.\n */\n onRemove?: (file: File | FileInputFileItem | string) => void;\n};\n\ntype DialogInput = {\n upload: boolean;\n buttons: {\n text: string;\n buttonType: number;\n }[];\n initialView: string;\n};\n\nexport type FileInputRef = {\n clear: () => void;\n};\n\nconst FileInput = forwardRef<FileInputRef, FileInputProps>(\n (\n {\n fileSelectionIcons = ['fa fa-upload'],\n imageSelectIcons = ['ts-image'],\n fileTypes,\n onMaxFilesReached,\n maxFiles,\n onRemove,\n files,\n maxFileSizeInMB,\n onAdd,\n fileSelectionPlaceholder = 'Dateien hochladen',\n imageSelectPlaceholder,\n },\n ref,\n ) => {\n const [internalFiles, setInternalFiles] = useState<File[]>([]);\n const [internalImages, setInternalImages] = useState<string[]>([]);\n\n const handleInputClear = () => {\n setInternalFiles([]);\n setInternalImages([]);\n };\n\n useImperativeHandle(\n ref,\n () => ({\n clear: handleInputClear,\n }),\n [],\n );\n\n const handleAddImages = useCallback(\n (images: string[]) => {\n const newImages: string[] = [];\n\n images.forEach((image) => {\n if (!filterDuplicateFileUrls({ files: internalImages, newFile: image })) {\n newImages.push(image);\n }\n });\n\n let tmp = newImages;\n\n if (maxFiles) {\n tmp = newImages.slice(\n 0,\n maxFiles -\n (internalFiles.length + internalImages.length + (files?.length ?? 0)),\n );\n }\n\n if (tmp.length > 0 && typeof onAdd === 'function') {\n onAdd(tmp);\n }\n\n setInternalImages((prevState) => [...prevState, ...tmp]);\n },\n [files?.length, internalFiles.length, internalImages, maxFiles, onAdd],\n );\n\n const handleAddFiles = useCallback(\n (newFiles: File[]) => {\n const newFileItems: File[] = [];\n\n newFiles.forEach((file) => {\n if (fileTypes && !isValidFileType({ file, types: fileTypes })) {\n return;\n }\n\n if (file && !filterDuplicateFile({ files: internalFiles, newFile: file })) {\n newFileItems.push(file);\n }\n });\n\n let tmp = newFileItems;\n\n if (maxFiles) {\n tmp = newFileItems.slice(\n 0,\n maxFiles -\n (internalFiles.length + internalImages.length + (files?.length ?? 0)),\n );\n }\n\n if (tmp.length > 0 && typeof onAdd === 'function') {\n onAdd(tmp);\n }\n\n setInternalFiles((prevState) => [...prevState, ...tmp]);\n },\n [fileTypes, files?.length, internalFiles, internalImages.length, maxFiles, onAdd],\n );\n\n const handleDeleteFile = useCallback(\n (fileName?: string) => {\n let fileToDelete: File | FileInputFileItem | string | undefined;\n\n const filteredFiles = internalFiles.filter((file) => {\n const { name } = file;\n\n if (name === fileName) {\n fileToDelete = file;\n }\n\n return name !== fileName;\n });\n\n setInternalFiles(filteredFiles);\n\n if (!fileToDelete) {\n const filteredImages = internalImages.filter((image) => {\n if (image === fileName) {\n fileToDelete = image;\n }\n\n return image !== fileName;\n });\n\n setInternalImages(filteredImages);\n }\n\n if (!fileToDelete) {\n files?.forEach((file) => {\n if (file.url === fileName || file.name === fileName) {\n fileToDelete = file;\n }\n });\n }\n\n if (!fileToDelete || typeof onRemove !== 'function') {\n return;\n }\n\n onRemove(fileToDelete);\n },\n [files, internalFiles, internalImages, onRemove],\n );\n\n const isDisabled = useMemo(() => {\n if (maxFiles) {\n if (internalFiles.length + internalImages.length >= maxFiles) {\n if (typeof onMaxFilesReached === 'function') {\n onMaxFilesReached();\n }\n\n return true;\n }\n }\n\n return false;\n }, [internalFiles.length, internalImages.length, maxFiles, onMaxFilesReached]);\n\n const handleImageSelectionClick = useCallback(async () => {\n if (isDisabled) {\n return;\n }\n\n const { buttonType, result } = (await createDialog<DialogInput>({\n dialogInput: {\n upload: true,\n buttons: [\n { text: 'hello', buttonType: 1 },\n { text: 'can', buttonType: -1 },\n ],\n initialView: 'pixabay',\n },\n type: DialogType.MODULE,\n system: {\n url: 'https://tapp.chayns-static.space/api/dialog-image-editor/v1/remoteEntry.js',\n scope: 'dialog_image_editor',\n module: './ImageEditorEntry',\n },\n buttons: [],\n }).open()) as ImageDialogResult;\n\n if (buttonType === 1 && result?.url) {\n handleAddImages([result.url]);\n }\n }, [handleAddImages, isDisabled]);\n\n const handleFileSelectionClick = useCallback(async () => {\n if (isDisabled) {\n return;\n }\n\n const newFiles = await selectFiles({\n multiple: true,\n type: fileTypes,\n maxFileSizeInMB,\n });\n\n handleAddFiles(newFiles);\n }, [fileTypes, handleAddFiles, isDisabled, maxFileSizeInMB]);\n\n const handleDrop = useCallback(\n (e: DragEvent<HTMLDivElement>) => {\n e.preventDefault();\n const draggedFiles = Array.from(e.dataTransfer.files);\n\n handleAddFiles(draggedFiles);\n },\n [handleAddFiles],\n );\n\n const content = useMemo(() => {\n const combinedFiles = [...internalImages, ...internalFiles];\n\n const items: ReactElement[] = combinedFiles.map((file) => (\n <StyledMotionFileInputList\n animate={{ height: 'auto', opacity: 1 }}\n exit={{ height: 0, opacity: 0 }}\n key={typeof file === 'string' ? file : file.name}\n transition={{ duration: 0.25, type: 'tween' }}\n >\n <FileListItem\n fileType={typeof file !== 'string' ? file.type : undefined}\n fileName={typeof file !== 'string' ? file.name : undefined}\n fileSize={typeof file !== 'string' ? file.size : undefined}\n url={typeof file === 'string' ? file : undefined}\n onRemove={handleDeleteFile}\n />\n </StyledMotionFileInputList>\n ));\n\n return items;\n }, [handleDeleteFile, internalFiles, internalImages]);\n\n const uploadedFiles = useMemo(() => {\n const items: ReactElement[] = [];\n\n const cutFiles = maxFiles ? files?.splice(0, maxFiles) : files;\n\n cutFiles?.forEach(({ url, id, name }) => {\n items.push(\n <StyledMotionFileInputList\n animate={{ height: 'auto', opacity: 1 }}\n exit={{ height: 0, opacity: 0 }}\n key={id}\n transition={{ duration: 0.25, type: 'tween' }}\n >\n <FileListItem url={url} onRemove={handleDeleteFile} fileName={name} />\n </StyledMotionFileInputList>,\n );\n });\n\n return items;\n }, [files, handleDeleteFile, maxFiles]);\n\n return useMemo(\n () => (\n <StyledFileInput>\n <StyledFileInputWrapper $isDisabled={isDisabled}>\n <StyledFileInputContainer\n onClick={() => void handleFileSelectionClick()}\n onDragOver={(e: DragEvent<HTMLDivElement>) => e.preventDefault()}\n onDrop={(e: DragEvent<HTMLDivElement>) => void handleDrop(e)}\n >\n <Icon icons={fileSelectionIcons} />\n <StyledFileInputText>{fileSelectionPlaceholder}</StyledFileInputText>\n </StyledFileInputContainer>\n {imageSelectPlaceholder && (\n <StyledFileInputContainer\n $isImageSelection\n onClick={() => void handleImageSelectionClick()}\n >\n <Icon icons={imageSelectIcons} />\n <StyledFileInputText>{imageSelectPlaceholder}</StyledFileInputText>\n </StyledFileInputContainer>\n )}\n </StyledFileInputWrapper>\n <List>\n <AnimatePresence initial={false}>{content}</AnimatePresence>\n </List>\n {uploadedFiles.length > 0 && (\n <StyledUploadedFilesList $shouldShowBorder={content.length > 0}>\n <List>\n <AnimatePresence initial={false}>{uploadedFiles}</AnimatePresence>\n </List>\n </StyledUploadedFilesList>\n )}\n </StyledFileInput>\n ),\n [\n isDisabled,\n fileSelectionIcons,\n fileSelectionPlaceholder,\n imageSelectPlaceholder,\n imageSelectIcons,\n content,\n uploadedFiles,\n handleFileSelectionClick,\n handleDrop,\n handleImage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AClBS,wBAAwB,EACxBC,sBAAsB,EACtBT,gBAAgB,EAChB0E,OAAO,EACPiB,aAAa,EACb1B,wBAAwB,EACxBG,UAAU,EACVnB,yBAAyB,CAEjC,CAAC;AACL,CACJ,CAAC;AAEDpD,SAAS,CAACgH,WAAW,GAAG,WAAW;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAApI,OAAA,GAErBkB,SAAS","ignoreList":[]}
1
+ {"version":3,"file":"FileInput.js","names":["_chaynsApi","require","_framerMotion","_react","_interopRequireWildcard","_file","_fileDialog","_Icon","_interopRequireDefault","_List","_FileListItem","_FileInput","e","__esModule","default","_getRequireWildcardCache","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","FileInput","forwardRef","fileSelectionIcons","imageSelectIcons","fileTypes","onMaxFilesReached","maxFiles","onRemove","files","isDisabled","maxFileSizeInMB","onAdd","fileSelectionPlaceholder","imageSelectPlaceholder","ref","internalFiles","setInternalFiles","useState","internalImages","setInternalImages","handleInputClear","useImperativeHandle","clear","handleAddImages","useCallback","images","newImages","forEach","image","filterDuplicateFileUrls","newFile","push","tmp","slice","length","prevState","handleAddFiles","newFiles","newFileItems","file","isValidFileType","types","filterDuplicateFile","handleDeleteFile","fileName","fileToDelete","filteredFiles","filter","name","filteredImages","url","internalIsDisabled","useMemo","handleImageSelectionClick","buttonType","result","createDialog","dialogInput","upload","buttons","text","initialView","type","DialogType","MODULE","system","scope","module","open","handleFileSelectionClick","selectFiles","multiple","handleDrop","preventDefault","draggedFiles","Array","from","dataTransfer","content","combinedFiles","items","map","createElement","StyledMotionFileInputList","animate","height","opacity","exit","key","transition","duration","fileType","undefined","fileSize","size","uploadedFiles","cutFiles","splice","id","StyledFileInput","StyledFileInputWrapper","$isDisabled","StyledFileInputContainer","onClick","onDragOver","onDrop","icons","StyledFileInputText","$isImageSelection","AnimatePresence","initial","StyledUploadedFilesList","$shouldShowBorder","displayName","_default","exports"],"sources":["../../../../src/components/file-input/FileInput.tsx"],"sourcesContent":["import { createDialog, DialogType } from 'chayns-api';\nimport { AnimatePresence } from 'framer-motion';\nimport React, {\n DragEvent,\n forwardRef,\n ReactElement,\n useCallback,\n useImperativeHandle,\n useMemo,\n useState,\n} from 'react';\nimport type { FileInputFileItem, ImageDialogResult } from '../../types/fileInput';\nimport { filterDuplicateFile, filterDuplicateFileUrls, isValidFileType } from '../../utils/file';\nimport { selectFiles } from '../../utils/fileDialog';\nimport Icon from '../icon/Icon';\nimport List from '../list/List';\nimport FileListItem from './file-list/FileListItem';\nimport {\n StyledFileInput,\n StyledFileInputContainer,\n StyledFileInputText,\n StyledFileInputWrapper,\n StyledMotionFileInputList,\n StyledUploadedFilesList,\n} from './FileInput.styles';\n\nexport type FileInputProps = {\n /**\n * Already uploaded files to display.\n */\n files?: FileInputFileItem[];\n /**\n * An array of icons that should be displayed inside the FileInput\n */\n fileSelectionIcons?: string[];\n /**\n * The text that should be displayed inside the FileInput.\n */\n fileSelectionPlaceholder?: string;\n /**\n * The filetypes that could be selected. Example for multiple types: 'image/*, video/*'.\n */\n fileTypes?: string;\n /**\n * The icon of the image selection.\n */\n imageSelectIcons?: string[];\n /**\n * If set, pictures can be select via Pixabay.\n */\n imageSelectPlaceholder?: string;\n /**\n * Whether the FileInput is disabled.\n */\n isDisabled?: boolean;\n /**\n * The maximum amount of Files that can be uploaded.\n */\n maxFiles?: number;\n /**\n * The maximum size of a file in MB.\n */\n maxFileSizeInMB?: number;\n /**\n * A function to be executed when files are added.\n */\n onAdd?: (files: File[] | string[]) => void;\n /**\n * Function to be executed when the maximum amount of Files are reached.\n */\n onMaxFilesReached?: () => void;\n /**\n * A function to be executed when a file is removed.\n */\n onRemove?: (file: File | FileInputFileItem | string) => void;\n};\n\ntype DialogInput = {\n upload: boolean;\n buttons: {\n text: string;\n buttonType: number;\n }[];\n initialView: string;\n};\n\nexport type FileInputRef = {\n clear: () => void;\n};\n\nconst FileInput = forwardRef<FileInputRef, FileInputProps>(\n (\n {\n fileSelectionIcons = ['fa fa-upload'],\n imageSelectIcons = ['ts-image'],\n fileTypes,\n onMaxFilesReached,\n maxFiles,\n onRemove,\n files,\n isDisabled,\n maxFileSizeInMB,\n onAdd,\n fileSelectionPlaceholder = 'Dateien hochladen',\n imageSelectPlaceholder,\n },\n ref,\n ) => {\n const [internalFiles, setInternalFiles] = useState<File[]>([]);\n const [internalImages, setInternalImages] = useState<string[]>([]);\n\n const handleInputClear = () => {\n setInternalFiles([]);\n setInternalImages([]);\n };\n\n useImperativeHandle(\n ref,\n () => ({\n clear: handleInputClear,\n }),\n [],\n );\n\n const handleAddImages = useCallback(\n (images: string[]) => {\n const newImages: string[] = [];\n\n images.forEach((image) => {\n if (!filterDuplicateFileUrls({ files: internalImages, newFile: image })) {\n newImages.push(image);\n }\n });\n\n let tmp = newImages;\n\n if (maxFiles) {\n tmp = newImages.slice(\n 0,\n maxFiles -\n (internalFiles.length + internalImages.length + (files?.length ?? 0)),\n );\n }\n\n if (tmp.length > 0 && typeof onAdd === 'function') {\n onAdd(tmp);\n }\n\n setInternalImages((prevState) => [...prevState, ...tmp]);\n },\n [files?.length, internalFiles.length, internalImages, maxFiles, onAdd],\n );\n\n const handleAddFiles = useCallback(\n (newFiles: File[]) => {\n const newFileItems: File[] = [];\n\n newFiles.forEach((file) => {\n if (fileTypes && !isValidFileType({ file, types: fileTypes })) {\n return;\n }\n\n if (file && !filterDuplicateFile({ files: internalFiles, newFile: file })) {\n newFileItems.push(file);\n }\n });\n\n let tmp = newFileItems;\n\n if (maxFiles) {\n tmp = newFileItems.slice(\n 0,\n maxFiles -\n (internalFiles.length + internalImages.length + (files?.length ?? 0)),\n );\n }\n\n if (tmp.length > 0 && typeof onAdd === 'function') {\n onAdd(tmp);\n }\n\n setInternalFiles((prevState) => [...prevState, ...tmp]);\n },\n [fileTypes, files?.length, internalFiles, internalImages.length, maxFiles, onAdd],\n );\n\n const handleDeleteFile = useCallback(\n (fileName?: string) => {\n let fileToDelete: File | FileInputFileItem | string | undefined;\n\n const filteredFiles = internalFiles.filter((file) => {\n const { name } = file;\n\n if (name === fileName) {\n fileToDelete = file;\n }\n\n return name !== fileName;\n });\n\n setInternalFiles(filteredFiles);\n\n if (!fileToDelete) {\n const filteredImages = internalImages.filter((image) => {\n if (image === fileName) {\n fileToDelete = image;\n }\n\n return image !== fileName;\n });\n\n setInternalImages(filteredImages);\n }\n\n if (!fileToDelete) {\n files?.forEach((file) => {\n if (file.url === fileName || file.name === fileName) {\n fileToDelete = file;\n }\n });\n }\n\n if (!fileToDelete || typeof onRemove !== 'function') {\n return;\n }\n\n onRemove(fileToDelete);\n },\n [files, internalFiles, internalImages, onRemove],\n );\n\n const internalIsDisabled = useMemo(() => {\n if (isDisabled) {\n return true;\n }\n\n if (maxFiles) {\n if (internalFiles.length + internalImages.length >= maxFiles) {\n if (typeof onMaxFilesReached === 'function') {\n onMaxFilesReached();\n }\n\n return true;\n }\n }\n\n return false;\n }, [internalFiles.length, internalImages.length, isDisabled, maxFiles, onMaxFilesReached]);\n\n const handleImageSelectionClick = useCallback(async () => {\n if (internalIsDisabled) {\n return;\n }\n\n const { buttonType, result } = (await createDialog<DialogInput>({\n dialogInput: {\n upload: true,\n buttons: [\n { text: 'hello', buttonType: 1 },\n { text: 'can', buttonType: -1 },\n ],\n initialView: 'pixabay',\n },\n type: DialogType.MODULE,\n system: {\n url: 'https://tapp.chayns-static.space/api/dialog-image-editor/v1/remoteEntry.js',\n scope: 'dialog_image_editor',\n module: './ImageEditorEntry',\n },\n buttons: [],\n }).open()) as ImageDialogResult;\n\n if (buttonType === 1 && result?.url) {\n handleAddImages([result.url]);\n }\n }, [handleAddImages, internalIsDisabled]);\n\n const handleFileSelectionClick = useCallback(async () => {\n if (internalIsDisabled) {\n return;\n }\n\n const newFiles = await selectFiles({\n multiple: true,\n type: fileTypes,\n maxFileSizeInMB,\n });\n\n handleAddFiles(newFiles);\n }, [fileTypes, handleAddFiles, internalIsDisabled, maxFileSizeInMB]);\n\n const handleDrop = useCallback(\n (e: DragEvent<HTMLDivElement>) => {\n e.preventDefault();\n const draggedFiles = Array.from(e.dataTransfer.files);\n\n handleAddFiles(draggedFiles);\n },\n [handleAddFiles],\n );\n\n const content = useMemo(() => {\n const combinedFiles = [...internalImages, ...internalFiles];\n\n const items: ReactElement[] = combinedFiles.map((file) => (\n <StyledMotionFileInputList\n animate={{ height: 'auto', opacity: 1 }}\n exit={{ height: 0, opacity: 0 }}\n key={typeof file === 'string' ? file : file.name}\n transition={{ duration: 0.25, type: 'tween' }}\n >\n <FileListItem\n fileType={typeof file !== 'string' ? file.type : undefined}\n fileName={typeof file !== 'string' ? file.name : undefined}\n fileSize={typeof file !== 'string' ? file.size : undefined}\n url={typeof file === 'string' ? file : undefined}\n onRemove={handleDeleteFile}\n />\n </StyledMotionFileInputList>\n ));\n\n return items;\n }, [handleDeleteFile, internalFiles, internalImages]);\n\n const uploadedFiles = useMemo(() => {\n const items: ReactElement[] = [];\n\n const cutFiles = maxFiles ? files?.splice(0, maxFiles) : files;\n\n cutFiles?.forEach(({ url, id, name }) => {\n items.push(\n <StyledMotionFileInputList\n animate={{ height: 'auto', opacity: 1 }}\n exit={{ height: 0, opacity: 0 }}\n key={id}\n transition={{ duration: 0.25, type: 'tween' }}\n >\n <FileListItem url={url} onRemove={handleDeleteFile} fileName={name} />\n </StyledMotionFileInputList>,\n );\n });\n\n return items;\n }, [files, handleDeleteFile, maxFiles]);\n\n return useMemo(\n () => (\n <StyledFileInput>\n <StyledFileInputWrapper $isDisabled={internalIsDisabled}>\n <StyledFileInputContainer\n onClick={() => void handleFileSelectionClick()}\n onDragOver={(e: DragEvent<HTMLDivElement>) => e.preventDefault()}\n onDrop={(e: DragEvent<HTMLDivElement>) => void handleDrop(e)}\n >\n <Icon icons={fileSelectionIcons} />\n <StyledFileInputText>{fileSelectionPlaceholder}</StyledFileInputText>\n </StyledFileInputContainer>\n {imageSelectPlaceholder && (\n <StyledFileInputContainer\n $isImageSelection\n onClick={() => void handleImageSelectionClick()}\n >\n <Icon icons={imageSelectIcons} />\n <StyledFileInputText>{imageSelectPlaceholder}</StyledFileInputText>\n </StyledFileInputContainer>\n )}\n </StyledFileInputWrapper>\n <List>\n <AnimatePresence initial={false}>{content}</AnimatePresence>\n </List>\n {uploadedFiles.length > 0 && (\n <StyledUploadedFilesList $shouldShowBorder={content.length > 0}>\n <List>\n <AnimatePresence initial={false}>{uploadedFiles}</AnimatePresence>\n </List>\n </StyledUploadedFilesList>\n )}\n </StyledFileInput>\n ),\n [\n internalIsDisabled,\n fileSelectionIcons,\n fileSelectionPlaceholder,\n imageSelectPlaceholder,\n imageSelectIcons,\n content,\n uploadedFiles,\n handleFileSelectionClick,\n handleDrop,\n handleImageSelectionClick,\n ],\n );\n },\n);\n\nFileInput.displayName = 'FileInput';\n\nexport default FileInput;\n"],"mappings":";;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAC,uBAAA,CAAAH,OAAA;AAUA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAC,sBAAA,CAAAP,OAAA;AACA,IAAAQ,KAAA,GAAAD,sBAAA,CAAAP,OAAA;AACA,IAAAS,aAAA,GAAAF,sBAAA,CAAAP,OAAA;AACA,IAAAU,UAAA,GAAAV,OAAA;AAO4B,SAAAO,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,yBAAAH,CAAA,6BAAAI,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAD,wBAAA,YAAAA,CAAAH,CAAA,WAAAA,CAAA,GAAAM,CAAA,GAAAD,CAAA,KAAAL,CAAA;AAAA,SAAAR,wBAAAQ,CAAA,EAAAK,CAAA,SAAAA,CAAA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OAAI,qBACDX,MAAA,CAAAW,OAAA,CAAAoG,aAAA,CAAChH,aAAA,CAAA2I,eAAe;IAACC,OAAO,EAAE;EAAM,GAAEhC,OAAyB,CACzD,CAAC,EACNiB,aAAa,CAAC7D,MAAM,GAAG,CAAC,iBACrB/D,MAAA,CAAAW,OAAA,CAAAoG,aAAA,CAACvG,UAAA,CAAAoI,uBAAuB;IAACC,iBAAiB,EAAElC,OAAO,CAAC5C,MAAM,GAAG;EAAE,gBAC3D/D,MAAA,CAAAW,OAAA,CAAAoG,aAAA,CAACzG,KAAA,CAAAK,OAAI,qBACDX,MAAA,CAAAW,OAAA,CAAAoG,aAAA,CAAChH,aAAA,CAAA2I,eAAe;IAACC,OAAO,EAAE;EAAM,GAAEf,aAA+B,CAC/D,CACe,CAEhB,CACpB,EACD,CACI5C,kBAAkB,EAClBjD,kBAAkB,EAClBU,wBAAwB,EACxBC,sBAAsB,EACtBV,gBAAgB,EAChB2E,OAAO,EACPiB,aAAa,EACb1B,wBAAwB,EACxBG,UAAU,EACVnB,yBAAyB,CAEjC,CAAC;AACL,CACJ,CAAC;AAEDrD,SAAS,CAACiH,WAAW,GAAG,WAAW;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAArI,OAAA,GAErBkB,SAAS","ignoreList":[]}
@@ -23,21 +23,22 @@ const ListItem = ({
23
23
  images,
24
24
  isDefaultOpen,
25
25
  isOpen,
26
- shouldForceBackground = false,
26
+ isTitleGreyed,
27
+ leftElements,
27
28
  onClick,
29
+ onClose,
28
30
  onLongPress,
29
- shouldOpenImageOnClick = false,
30
31
  onOpen,
31
- onClose,
32
- leftElements,
33
- isTitleGreyed: isDisabledButNotReallyDisabled,
34
32
  rightElements,
33
+ shouldForceBackground = false,
34
+ shouldHideBottomLine = false,
35
35
  shouldHideImageOrIconBackground,
36
36
  shouldHideIndicator = false,
37
- subtitle,
37
+ shouldOpenImageOnClick = false,
38
+ shouldPreventLayoutAnimation = false,
38
39
  shouldShowRoundImageOrIcon,
39
- shouldHideBottomLine = false,
40
40
  shouldShowSeparatorBelow = false,
41
+ subtitle,
41
42
  title,
42
43
  titleElement
43
44
  }) => {
@@ -111,31 +112,32 @@ const ListItem = ({
111
112
  opacity: 0
112
113
  },
113
114
  key: `list-item-${uuid}`,
115
+ layout: shouldPreventLayoutAnimation ? undefined : 'position',
114
116
  $isClickable: isClickable,
115
- $isOpen: isItemOpen,
116
117
  $isInAccordion: typeof isParentAccordionWrapped === 'boolean',
118
+ $isOpen: isItemOpen,
117
119
  $isWrapped: isWrapped,
118
- $shouldHideIndicator: shouldHideIndicator,
119
120
  $shouldForceBackground: shouldForceBackground,
120
- $shouldShowSeparatorBelow: shouldShowSeparatorBelow,
121
- $shouldHideBottomLine: shouldHideBottomLine
121
+ $shouldHideBottomLine: shouldHideBottomLine,
122
+ $shouldHideIndicator: shouldHideIndicator,
123
+ $shouldShowSeparatorBelow: shouldShowSeparatorBelow
122
124
  }, /*#__PURE__*/_react.default.createElement(_ListItemHead.default, {
123
125
  hoverItem: hoverItem,
124
126
  icons: icons,
125
127
  images: images,
126
128
  isAnyItemExpandable: isAnyItemExpandable,
127
- isDisabledButNotReallyDisabled: isDisabledButNotReallyDisabled,
128
- shouldOpenImageOnClick: shouldOpenImageOnClick,
129
129
  isExpandable: isExpandable,
130
130
  isOpen: isItemOpen,
131
+ isTitleGreyed: isTitleGreyed,
131
132
  leftElements: leftElements,
132
133
  onClick: isClickable ? handleHeadClick : undefined,
133
134
  onLongPress: onLongPress,
134
135
  rightElements: rightElements,
135
136
  shouldHideImageOrIconBackground: shouldHideImageOrIconBackground,
136
137
  shouldHideIndicator: shouldHideIndicator,
137
- subtitle: subtitle,
138
+ shouldOpenImageOnClick: shouldOpenImageOnClick,
138
139
  shouldShowRoundImageOrIcon: shouldShowRoundImageOrIcon,
140
+ subtitle: subtitle,
139
141
  title: title,
140
142
  titleElement: titleElement
141
143
  }), /*#__PURE__*/_react.default.createElement(_framerMotion.AnimatePresence, {
@@ -1 +1 @@
1
- {"version":3,"file":"ListItem.js","names":["_framerMotion","require","_react","_interopRequireWildcard","_uuid","_Accordion","_AreaContextProvider","_interopRequireDefault","_List","_ListItemBody","_ListItemHead","_ListItem","e","__esModule","default","_getRequireWildcardCache","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","ListItem","children","hoverItem","icons","images","isDefaultOpen","isOpen","shouldForceBackground","onClick","onLongPress","shouldOpenImageOnClick","onOpen","onClose","leftElements","isTitleGreyed","isDisabledButNotReallyDisabled","rightElements","shouldHideImageOrIconBackground","shouldHideIndicator","subtitle","shouldShowRoundImageOrIcon","shouldHideBottomLine","shouldShowSeparatorBelow","title","titleElement","incrementExpandableItemCount","isAnyItemExpandable","isWrapped","openItemUuid","updateOpenItemUuid","useContext","ListContext","isParentAccordionWrapped","AccordionContext","isInitialRenderRef","useRef","uuid","useUuid","isExpandable","undefined","isItemOpen","onCloseRef","onOpenRef","useEffect","current","handleHeadClick","useCallback","event","shouldOnlyOpen","isClickable","createElement","StyledMotionListItem","animate","height","opacity","className","exit","initial","key","$isClickable","$isOpen","$isInAccordion","$isWrapped","$shouldHideIndicator","$shouldForceBackground","$shouldShowSeparatorBelow","$shouldHideBottomLine","AnimatePresence","id","displayName","_default","exports"],"sources":["../../../../../src/components/list/list-item/ListItem.tsx"],"sourcesContent":["import { AnimatePresence } from 'framer-motion';\nimport React, {\n FC,\n MouseEventHandler,\n ReactNode,\n TouchEventHandler,\n useCallback,\n useContext,\n useEffect,\n useRef,\n} from 'react';\nimport { useUuid } from '../../../hooks/uuid';\nimport type { IListItemRightElements } from '../../../types/list';\nimport { AccordionContext } from '../../accordion/Accordion';\nimport AreaContextProvider from '../../area-provider/AreaContextProvider';\nimport { ListContext } from '../List';\nimport ListItemBody from './list-item-body/ListItemBody';\nimport ListItemHead from './list-item-head/ListItemHead';\nimport { StyledMotionListItem } from './ListItem.styles';\n\nexport type ListItemElements = [ReactNode, ...ReactNode[]];\n\nexport type ListItemProps = {\n /**\n * The content of the `ListItem` body. When the `ListItem` has children,\n * it can be opened and also gets an icon as an indicator automatically.\n */\n children?: ReactNode;\n /**\n * Element that is displayed when hovering over the `ListItem` on the right\n * side. On mobile devices, this element is not displayed.\n */\n hoverItem?: ReactNode;\n /**\n * The FontAwesome or tobit icons to render like an image on the left side\n * of the header. Multiple icons are stacked. See the `Icon` component\n * documentation for more information.\n */\n icons?: string[];\n /**\n * A list of image URLs that are displayed on the left side of the header.\n * If multiple URLs are passed, the image is assembled from the first three\n * image URLs as a puzzle.\n */\n images?: string[];\n /**\n * This can be used to automatically expand the `ListItem` during the first render.\n */\n isDefaultOpen?: boolean;\n /**\n * Whether the ListItem locks disabled but has full functionality.\n */\n isTitleGreyed?: boolean;\n /**\n * This overrides the internal opening state of the item and makes it controlled.\n */\n isOpen?: boolean;\n /**\n * Function to be executed when the header of the `ListItem` was clicked\n */\n onClick?: MouseEventHandler<HTMLDivElement>;\n /**\n * Function to be executed when the ListItem is closed.\n */\n onClose?: VoidFunction;\n /**\n * Function to be executed when the header of the `ListItem` is pressed for\n * 400 milliseconds.\n */\n onLongPress?: TouchEventHandler<HTMLDivElement>;\n /**\n * Function to be executed when the ListItem is opened.\n */\n onOpen?: VoidFunction;\n /**\n * Elements that are displayed on the left side of the header. If multiple\n * elements are specified, they are displayed one aside the other.\n */\n leftElements?: ListItemElements;\n /**\n * Elements that are displayed on the right side of the header. If multiple\n * elements are specified, they are displayed one below the other.\n */\n rightElements?: IListItemRightElements;\n /**\n * This will force the background color of the ListItem to be used even if it is closed and not hovered.\n */\n shouldForceBackground?: boolean;\n /**\n * Whether the background and border of the shape on which the image or icon of the element is displayed should be\n * hidden.\n */\n shouldHideImageOrIconBackground?: boolean;\n /**\n * Whether the bottom line should be hidden.\n */\n shouldHideBottomLine?: boolean;\n /**\n * If the `ListItem` is expandable, the indicator is displayed on the left\n * side of the header. If this property is set to true, the indicator is\n * hidden.\n */\n shouldHideIndicator?: boolean;\n /**\n * Whether the image should be opened on click.\n */\n shouldOpenImageOnClick?: boolean;\n /**\n * Whether the image or icon should be displayed in a round shape. This should be always used for images of persons.\n */\n shouldShowRoundImageOrIcon?: boolean;\n /**\n * Whether a separator should be displayed below this item. In this case, the border is displayed thicker than normal.\n */\n shouldShowSeparatorBelow?: boolean;\n /**\n * Subtitle of the `ListItem` displayed in the head below the title\n */\n subtitle?: ReactNode;\n /**\n * Title of the `ListItem` displayed in the head\n */\n title: ReactNode;\n /**\n * Additional elements to be displayed in the header next to the title.\n */\n titleElement?: ReactNode;\n};\n\nconst ListItem: FC<ListItemProps> = ({\n children,\n hoverItem,\n icons,\n images,\n isDefaultOpen,\n isOpen,\n shouldForceBackground = false,\n onClick,\n onLongPress,\n shouldOpenImageOnClick = false,\n onOpen,\n onClose,\n leftElements,\n isTitleGreyed: isDisabledButNotReallyDisabled,\n rightElements,\n shouldHideImageOrIconBackground,\n shouldHideIndicator = false,\n subtitle,\n shouldShowRoundImageOrIcon,\n shouldHideBottomLine = false,\n shouldShowSeparatorBelow = false,\n title,\n titleElement,\n}) => {\n const {\n incrementExpandableItemCount,\n isAnyItemExpandable,\n isWrapped,\n openItemUuid,\n updateOpenItemUuid,\n } = useContext(ListContext);\n\n const { isWrapped: isParentAccordionWrapped } = useContext(AccordionContext);\n\n const isInitialRenderRef = useRef(true);\n\n const uuid = useUuid();\n\n const isExpandable = children !== undefined;\n const isItemOpen = isOpen ?? openItemUuid === uuid;\n\n const onCloseRef = useRef(onClose);\n const onOpenRef = useRef(onOpen);\n\n useEffect(() => {\n onCloseRef.current = onClose;\n onOpenRef.current = onOpen;\n }, [isOpen, onClose, onOpen]);\n\n useEffect(() => {\n if (isInitialRenderRef.current) {\n isInitialRenderRef.current = false;\n } else if (isItemOpen) {\n if (typeof onOpenRef.current === 'function') {\n onOpenRef.current();\n }\n } else if (typeof onCloseRef.current === 'function') {\n onCloseRef.current();\n }\n }, [isItemOpen]);\n\n const handleHeadClick = useCallback<MouseEventHandler<HTMLDivElement>>(\n (event) => {\n if (isExpandable) {\n updateOpenItemUuid(uuid);\n }\n\n if (typeof onClick === 'function') {\n onClick(event);\n }\n },\n [isExpandable, onClick, updateOpenItemUuid, uuid],\n );\n\n useEffect(() => {\n if (isExpandable && !shouldHideIndicator) {\n // The incrementExpandableItemCount function returns an cleanup\n // function to decrement expandableItemCount if component unmounts\n return incrementExpandableItemCount();\n }\n\n return undefined;\n }, [incrementExpandableItemCount, isExpandable, shouldHideIndicator]);\n\n useEffect(() => {\n if (isDefaultOpen) {\n updateOpenItemUuid(uuid, { shouldOnlyOpen: true });\n }\n }, [isDefaultOpen, updateOpenItemUuid, uuid]);\n\n const isClickable = typeof onClick === 'function' || isExpandable;\n\n return (\n <StyledMotionListItem\n animate={{ height: 'auto', opacity: 1 }}\n className=\"beta-chayns-list-item\"\n exit={{ height: 0, opacity: 0 }}\n initial={{ height: 0, opacity: 0 }}\n key={`list-item-${uuid}`}\n $isClickable={isClickable}\n $isOpen={isItemOpen}\n $isInAccordion={typeof isParentAccordionWrapped === 'boolean'}\n $isWrapped={isWrapped}\n $shouldHideIndicator={shouldHideIndicator}\n $shouldForceBackground={shouldForceBackground}\n $shouldShowSeparatorBelow={shouldShowSeparatorBelow}\n $shouldHideBottomLine={shouldHideBottomLine}\n >\n <ListItemHead\n hoverItem={hoverItem}\n icons={icons}\n images={images}\n isAnyItemExpandable={isAnyItemExpandable}\n isDisabledButNotReallyDisabled={isDisabledButNotReallyDisabled}\n shouldOpenImageOnClick={shouldOpenImageOnClick}\n isExpandable={isExpandable}\n isOpen={isItemOpen}\n leftElements={leftElements}\n onClick={isClickable ? handleHeadClick : undefined}\n onLongPress={onLongPress}\n rightElements={rightElements}\n shouldHideImageOrIconBackground={shouldHideImageOrIconBackground}\n shouldHideIndicator={shouldHideIndicator}\n subtitle={subtitle}\n shouldShowRoundImageOrIcon={shouldShowRoundImageOrIcon}\n title={title}\n titleElement={titleElement}\n />\n <AnimatePresence initial={false}>\n {isExpandable && isItemOpen && (\n <ListItemBody id={uuid}>\n <AreaContextProvider>{children}</AreaContextProvider>\n </ListItemBody>\n )}\n </AnimatePresence>\n </StyledMotionListItem>\n );\n};\n\nListItem.displayName = 'ListItem';\n\nexport default ListItem;\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,uBAAA,CAAAF,OAAA;AAUA,IAAAG,KAAA,GAAAH,OAAA;AAEA,IAAAI,UAAA,GAAAJ,OAAA;AACA,IAAAK,oBAAA,GAAAC,sBAAA,CAAAN,OAAA;AACA,IAAAO,KAAA,GAAAP,OAAA;AACA,IAAAQ,aAAA,GAAAF,sBAAA,CAAAN,OAAA;AACA,IAAAS,aAAA,GAAAH,sBAAA,CAAAN,OAAA;AACA,IAAAU,SAAA,GAAAV,OAAA;AAAyD,SAAAM,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,yBAAAH,CAAA,6BAAAI,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAD,wBAAA,YAAAA,CAAAH,CAAA,WAAAA,CAAA,GAAAM,CAAA,GAAAD,CAAA,KAAAL,CAAA;AAAA,SAAAT,wBAAAS,CAAA,EAAAK,CAAA,SAAAA,CAAA,IAAAL,CAAA,IAAAA,CAAA,CAAAC,UAAA,SAAAD,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAE,OAAA,EAAAF,CAAA,QAAAM,CAAA,GAAAH,wBAAA,CAAAE,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAC,GAAA,CAAAP,CAAA,UAAAM,CAAA,CAAAE,GAAA,CAAAR,CAAA,OAAAS,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAf,CAAA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AC/DL,sBAAsB,EAAEA,sBAAuB;IAC/C4B,YAAY,EAAEA,YAAa;IAC3BhC,MAAM,EAAEkC,UAAW;IACnB3B,YAAY,EAAEA,YAAa;IAC3BL,OAAO,EAAEyC,WAAW,GAAGJ,eAAe,GAAGN,SAAU;IACnD9B,WAAW,EAAEA,WAAY;IACzBO,aAAa,EAAEA,aAAc;IAC7BC,+BAA+B,EAAEA,+BAAgC;IACjEC,mBAAmB,EAAEA,mBAAoB;IACzCC,QAAQ,EAAEA,QAAS;IACnBC,0BAA0B,EAAEA,0BAA2B;IACvDG,KAAK,EAAEA,KAAM;IACbC,YAAY,EAAEA;EAAa,CAC9B,CAAC,eACFtD,MAAA,CAAAY,OAAA,CAAAoE,aAAA,CAAClF,aAAA,CAAAmG,eAAe;IAACV,OAAO,EAAE;EAAM,GAC3BnB,YAAY,IAAIE,UAAU,iBACvBtE,MAAA,CAAAY,OAAA,CAAAoE,aAAA,CAACzE,aAAA,CAAAK,OAAY;IAACsF,EAAE,EAAEhC;EAAK,gBACnBlE,MAAA,CAAAY,OAAA,CAAAoE,aAAA,CAAC5E,oBAAA,CAAAQ,OAAmB,QAAEmB,QAA8B,CAC1C,CAEL,CACC,CAAC;AAE/B,CAAC;AAEDD,QAAQ,CAACqE,WAAW,GAAG,UAAU;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAzF,OAAA,GAEnBkB,QAAQ","ignoreList":[]}
1
+ {"version":3,"file":"ListItem.js","names":["_framerMotion","require","_react","_interopRequireWildcard","_uuid","_Accordion","_AreaContextProvider","_interopRequireDefault","_List","_ListItemBody","_ListItemHead","_ListItem","e","__esModule","default","_getRequireWildcardCache","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","ListItem","children","hoverItem","icons","images","isDefaultOpen","isOpen","isTitleGreyed","leftElements","onClick","onClose","onLongPress","onOpen","rightElements","shouldForceBackground","shouldHideBottomLine","shouldHideImageOrIconBackground","shouldHideIndicator","shouldOpenImageOnClick","shouldPreventLayoutAnimation","shouldShowRoundImageOrIcon","shouldShowSeparatorBelow","subtitle","title","titleElement","incrementExpandableItemCount","isAnyItemExpandable","isWrapped","openItemUuid","updateOpenItemUuid","useContext","ListContext","isParentAccordionWrapped","AccordionContext","isInitialRenderRef","useRef","uuid","useUuid","isExpandable","undefined","isItemOpen","onCloseRef","onOpenRef","useEffect","current","handleHeadClick","useCallback","event","shouldOnlyOpen","isClickable","createElement","StyledMotionListItem","animate","height","opacity","className","exit","initial","key","layout","$isClickable","$isInAccordion","$isOpen","$isWrapped","$shouldForceBackground","$shouldHideBottomLine","$shouldHideIndicator","$shouldShowSeparatorBelow","AnimatePresence","id","displayName","_default","exports"],"sources":["../../../../../src/components/list/list-item/ListItem.tsx"],"sourcesContent":["import { AnimatePresence } from 'framer-motion';\nimport React, {\n FC,\n MouseEventHandler,\n ReactNode,\n TouchEventHandler,\n useCallback,\n useContext,\n useEffect,\n useRef,\n} from 'react';\nimport { useUuid } from '../../../hooks/uuid';\nimport type { IListItemRightElements } from '../../../types/list';\nimport { AccordionContext } from '../../accordion/Accordion';\nimport AreaContextProvider from '../../area-provider/AreaContextProvider';\nimport { ListContext } from '../List';\nimport ListItemBody from './list-item-body/ListItemBody';\nimport ListItemHead from './list-item-head/ListItemHead';\nimport { StyledMotionListItem } from './ListItem.styles';\n\nexport type ListItemElements = [ReactNode, ...ReactNode[]];\n\nexport type ListItemProps = {\n /**\n * The content of the `ListItem` body. When the `ListItem` has children,\n * it can be opened and also gets an icon as an indicator automatically.\n */\n children?: ReactNode;\n /**\n * Element that is displayed when hovering over the `ListItem` on the right\n * side. On mobile devices, this element is not displayed.\n */\n hoverItem?: ReactNode;\n /**\n * The FontAwesome or tobit icons to render like an image on the left side\n * of the header. Multiple icons are stacked. See the `Icon` component\n * documentation for more information.\n */\n icons?: string[];\n /**\n * A list of image URLs that are displayed on the left side of the header.\n * If multiple URLs are passed, the image is assembled from the first three\n * image URLs as a puzzle.\n */\n images?: string[];\n /**\n * This can be used to automatically expand the `ListItem` during the first render.\n */\n isDefaultOpen?: boolean;\n /**\n * This overrides the internal opening state of the item and makes it controlled.\n */\n isOpen?: boolean;\n /**\n * Whether the ListItem locks disabled but has full functionality.\n */\n isTitleGreyed?: boolean;\n /**\n * Elements that are displayed on the left side of the header. If multiple\n * elements are specified, they are displayed one aside the other.\n */\n leftElements?: ListItemElements;\n /**\n * Function to be executed when the header of the `ListItem` was clicked\n */\n onClick?: MouseEventHandler<HTMLDivElement>;\n /**\n * Function to be executed when the ListItem is closed.\n */\n onClose?: VoidFunction;\n /**\n * Function to be executed when the header of the `ListItem` is pressed for\n * 400 milliseconds.\n */\n onLongPress?: TouchEventHandler<HTMLDivElement>;\n /**\n * Function to be executed when the ListItem is opened.\n */\n onOpen?: VoidFunction;\n /**\n * Elements that are displayed on the right side of the header. If multiple\n * elements are specified, they are displayed one below the other.\n */\n rightElements?: IListItemRightElements;\n /**\n * This will force the background color of the ListItem to be used even if it is closed and not hovered.\n */\n shouldForceBackground?: boolean;\n /**\n * Whether the bottom line should be hidden.\n */\n shouldHideBottomLine?: boolean;\n /**\n * Whether the background and border of the shape on which the image or icon of the element is displayed should be\n * hidden.\n */\n shouldHideImageOrIconBackground?: boolean;\n /**\n * If the `ListItem` is expandable, the indicator is displayed on the left\n * side of the header. If this property is set to true, the indicator is\n * hidden.\n */\n shouldHideIndicator?: boolean;\n /**\n * Whether the image should be opened on click.\n */\n shouldOpenImageOnClick?: boolean;\n /**\n * Whether the layout animation should be prevented. This is useful when the\n * `ListItem` is used in a list with a lot of items and the layout animation\n * is not desired.\n */\n shouldPreventLayoutAnimation?: boolean;\n /**\n * Whether the image or icon should be displayed in a round shape. This should be always used for images of persons.\n */\n shouldShowRoundImageOrIcon?: boolean;\n /**\n * Whether a separator should be displayed below this item. In this case, the border is displayed thicker than normal.\n */\n shouldShowSeparatorBelow?: boolean;\n /**\n * Subtitle of the `ListItem` displayed in the head below the title\n */\n subtitle?: ReactNode;\n /**\n * Title of the `ListItem` displayed in the head\n */\n title: ReactNode;\n /**\n * Additional elements to be displayed in the header next to the title.\n */\n titleElement?: ReactNode;\n};\n\nconst ListItem: FC<ListItemProps> = ({\n children,\n hoverItem,\n icons,\n images,\n isDefaultOpen,\n isOpen,\n isTitleGreyed,\n leftElements,\n onClick,\n onClose,\n onLongPress,\n onOpen,\n rightElements,\n shouldForceBackground = false,\n shouldHideBottomLine = false,\n shouldHideImageOrIconBackground,\n shouldHideIndicator = false,\n shouldOpenImageOnClick = false,\n shouldPreventLayoutAnimation = false,\n shouldShowRoundImageOrIcon,\n shouldShowSeparatorBelow = false,\n subtitle,\n title,\n titleElement,\n}) => {\n const {\n incrementExpandableItemCount,\n isAnyItemExpandable,\n isWrapped,\n openItemUuid,\n updateOpenItemUuid,\n } = useContext(ListContext);\n\n const { isWrapped: isParentAccordionWrapped } = useContext(AccordionContext);\n\n const isInitialRenderRef = useRef(true);\n\n const uuid = useUuid();\n\n const isExpandable = children !== undefined;\n const isItemOpen = isOpen ?? openItemUuid === uuid;\n\n const onCloseRef = useRef(onClose);\n const onOpenRef = useRef(onOpen);\n\n useEffect(() => {\n onCloseRef.current = onClose;\n onOpenRef.current = onOpen;\n }, [isOpen, onClose, onOpen]);\n\n useEffect(() => {\n if (isInitialRenderRef.current) {\n isInitialRenderRef.current = false;\n } else if (isItemOpen) {\n if (typeof onOpenRef.current === 'function') {\n onOpenRef.current();\n }\n } else if (typeof onCloseRef.current === 'function') {\n onCloseRef.current();\n }\n }, [isItemOpen]);\n\n const handleHeadClick = useCallback<MouseEventHandler<HTMLDivElement>>(\n (event) => {\n if (isExpandable) {\n updateOpenItemUuid(uuid);\n }\n\n if (typeof onClick === 'function') {\n onClick(event);\n }\n },\n [isExpandable, onClick, updateOpenItemUuid, uuid],\n );\n\n useEffect(() => {\n if (isExpandable && !shouldHideIndicator) {\n // The incrementExpandableItemCount function returns an cleanup\n // function to decrement expandableItemCount if component unmounts\n return incrementExpandableItemCount();\n }\n\n return undefined;\n }, [incrementExpandableItemCount, isExpandable, shouldHideIndicator]);\n\n useEffect(() => {\n if (isDefaultOpen) {\n updateOpenItemUuid(uuid, { shouldOnlyOpen: true });\n }\n }, [isDefaultOpen, updateOpenItemUuid, uuid]);\n\n const isClickable = typeof onClick === 'function' || isExpandable;\n\n return (\n <StyledMotionListItem\n animate={{ height: 'auto', opacity: 1 }}\n className=\"beta-chayns-list-item\"\n exit={{ height: 0, opacity: 0 }}\n initial={{ height: 0, opacity: 0 }}\n key={`list-item-${uuid}`}\n layout={shouldPreventLayoutAnimation ? undefined : 'position'}\n $isClickable={isClickable}\n $isInAccordion={typeof isParentAccordionWrapped === 'boolean'}\n $isOpen={isItemOpen}\n $isWrapped={isWrapped}\n $shouldForceBackground={shouldForceBackground}\n $shouldHideBottomLine={shouldHideBottomLine}\n $shouldHideIndicator={shouldHideIndicator}\n $shouldShowSeparatorBelow={shouldShowSeparatorBelow}\n >\n <ListItemHead\n hoverItem={hoverItem}\n icons={icons}\n images={images}\n isAnyItemExpandable={isAnyItemExpandable}\n isExpandable={isExpandable}\n isOpen={isItemOpen}\n isTitleGreyed={isTitleGreyed}\n leftElements={leftElements}\n onClick={isClickable ? handleHeadClick : undefined}\n onLongPress={onLongPress}\n rightElements={rightElements}\n shouldHideImageOrIconBackground={shouldHideImageOrIconBackground}\n shouldHideIndicator={shouldHideIndicator}\n shouldOpenImageOnClick={shouldOpenImageOnClick}\n shouldShowRoundImageOrIcon={shouldShowRoundImageOrIcon}\n subtitle={subtitle}\n title={title}\n titleElement={titleElement}\n />\n <AnimatePresence initial={false}>\n {isExpandable && isItemOpen && (\n <ListItemBody id={uuid}>\n <AreaContextProvider>{children}</AreaContextProvider>\n </ListItemBody>\n )}\n </AnimatePresence>\n </StyledMotionListItem>\n );\n};\n\nListItem.displayName = 'ListItem';\n\nexport default ListItem;\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,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A,WAAY;IACzBE,aAAa,EAAEA,aAAc;IAC7BG,+BAA+B,EAAEA,+BAAgC;IACjEC,mBAAmB,EAAEA,mBAAoB;IACzCC,sBAAsB,EAAEA,sBAAuB;IAC/CE,0BAA0B,EAAEA,0BAA2B;IACvDE,QAAQ,EAAEA,QAAS;IACnBC,KAAK,EAAEA,KAAM;IACbC,YAAY,EAAEA;EAAa,CAC9B,CAAC,eACFtD,MAAA,CAAAY,OAAA,CAAAoE,aAAA,CAAClF,aAAA,CAAAoG,eAAe;IAACX,OAAO,EAAE;EAAM,GAC3BnB,YAAY,IAAIE,UAAU,iBACvBtE,MAAA,CAAAY,OAAA,CAAAoE,aAAA,CAACzE,aAAA,CAAAK,OAAY;IAACuF,EAAE,EAAEjC;EAAK,gBACnBlE,MAAA,CAAAY,OAAA,CAAAoE,aAAA,CAAC5E,oBAAA,CAAAQ,OAAmB,QAAEmB,QAA8B,CAC1C,CAEL,CACC,CAAC;AAE/B,CAAC;AAEDD,QAAQ,CAACsE,WAAW,GAAG,UAAU;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAA1F,OAAA,GAEnBkB,QAAQ","ignoreList":[]}
@@ -21,16 +21,16 @@ const ListItemHead = ({
21
21
  isAnyItemExpandable,
22
22
  isExpandable,
23
23
  isOpen,
24
+ isTitleGreyed,
24
25
  leftElements,
25
26
  onClick,
26
27
  onLongPress,
27
- shouldOpenImageOnClick,
28
28
  rightElements,
29
29
  shouldHideImageOrIconBackground,
30
30
  shouldHideIndicator,
31
- subtitle,
32
- isDisabledButNotReallyDisabled,
31
+ shouldOpenImageOnClick,
33
32
  shouldShowRoundImageOrIcon,
33
+ subtitle,
34
34
  title,
35
35
  titleElement
36
36
  }) => {
@@ -39,7 +39,7 @@ const ListItemHead = ({
39
39
  closed: 40,
40
40
  open: 40
41
41
  });
42
- const [isFirstRender, setIsFirstRender] = (0, _react.useState)(false);
42
+ const [, setIsFirstRender] = (0, _react.useState)(false);
43
43
  const longPressTimeoutRef = (0, _react.useRef)();
44
44
  const pseudoTitleOpenRef = (0, _react.useRef)(null);
45
45
  const pseudoTitleClosedRef = (0, _react.useRef)(null);
@@ -99,11 +99,11 @@ const ListItemHead = ({
99
99
  });
100
100
  }
101
101
  return undefined;
102
- }, [icons, images, shouldHideImageOrIconBackground, shouldShowRoundImageOrIcon]);
102
+ }, [icons, images, shouldHideImageOrIconBackground, shouldOpenImageOnClick, shouldShowRoundImageOrIcon]);
103
103
  return /*#__PURE__*/_react.default.createElement(_ListItemHead.StyledListItemHead, {
104
104
  animate: {
105
105
  height: isOpen ? headHeight.open : headHeight.closed,
106
- opacity: isDisabledButNotReallyDisabled ? 0.5 : 1
106
+ opacity: isTitleGreyed ? 0.5 : 1
107
107
  },
108
108
  initial: false,
109
109
  transition: {
@@ -1 +1 @@
1
- {"version":3,"file":"ListItemHead.js","names":["_react","_interopRequireWildcard","require","_useElementSize","_Icon","_interopRequireDefault","_ListItemIcon","_ListItemImage","_ListItemRightElements","_ListItemHead","e","__esModule","default","_getRequireWildcardCache","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","ListItemHead","hoverItem","icons","images","isAnyItemExpandable","isExpandable","isOpen","leftElements","onClick","onLongPress","shouldOpenImageOnClick","rightElements","shouldHideImageOrIconBackground","shouldHideIndicator","subtitle","isDisabledButNotReallyDisabled","shouldShowRoundImageOrIcon","title","titleElement","shouldShowHoverItem","setShouldShowHoverItem","useState","headHeight","setHeadHeight","closed","open","isFirstRender","setIsFirstRender","longPressTimeoutRef","useRef","pseudoTitleOpenRef","pseudoTitleClosedRef","pseudoSubtitleOpenRef","pseudoSubtitleClosedRef","closedTitle","useElementSize","openedTitle","closedSubtitle","openedSubtitle","shouldShowSubtitleRow","useEffect","height","handleMouseEnter","useCallback","handleMouseLeave","marginTop","useMemo","handleTouchStart","event","current","window","setTimeout","handleTouchEnd","clearTimeout","iconOrImageElement","createElement","shouldHideBackground","shouldShowRoundIcon","shouldShowRoundImage","undefined","StyledListItemHead","animate","opacity","initial","transition","duration","type","className","$isClickable","$isAnyItemExpandable","onMouseEnter","onMouseLeave","onTouchStart","onTouchEnd","StyledListItemHeadLeftWrapper","StyledMotionListItemHeadIndicator","rotate","StyledListItemHeadContent","$isIconOrImageGiven","$marginTop","$isOpen","StyledListItemHeadTitle","StyledListItemHeadTitleContent","StyledListItemHeadTitleTextPseudo","ref","StyledListItemHeadTitleText","$width","width","StyledListItemHeadTitleElement","StyledListItemHeadSubtitle","StyledListItemHeadSubtitleTextPseudo","StyledListItemHeadSubtitleText","StyledMotionListItemHeadHoverItem","marginLeft","displayName","_default","exports"],"sources":["../../../../../../src/components/list/list-item/list-item-head/ListItemHead.tsx"],"sourcesContent":["import React, {\n FC,\n MouseEventHandler,\n ReactNode,\n TouchEventHandler,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { useElementSize } from '../../../../hooks/useElementSize';\nimport type { IListItemRightElements } from '../../../../types/list';\nimport Icon from '../../../icon/Icon';\nimport ListItemIcon from './list-item-icon/ListItemIcon';\nimport ListItemImage from './list-item-image/ListItemImage';\nimport ListItemRightElements from './list-item-right-elements/ListItemRightElements';\nimport {\n StyledListItemHead,\n StyledListItemHeadContent,\n StyledListItemHeadLeftWrapper,\n StyledListItemHeadSubtitle,\n StyledListItemHeadSubtitleText,\n StyledListItemHeadSubtitleTextPseudo,\n StyledListItemHeadTitle,\n StyledListItemHeadTitleContent,\n StyledListItemHeadTitleElement,\n StyledListItemHeadTitleText,\n StyledListItemHeadTitleTextPseudo,\n StyledMotionListItemHeadHoverItem,\n StyledMotionListItemHeadIndicator,\n} from './ListItemHead.styles';\n\ninterface HeadHeight {\n closed: number;\n open: number;\n}\n\ntype ListItemHeadProps = {\n hoverItem?: ReactNode;\n icons?: string[];\n images?: string[];\n isAnyItemExpandable: boolean;\n isExpandable: boolean;\n isOpen: boolean;\n leftElements?: ReactNode;\n onClick?: MouseEventHandler<HTMLDivElement>;\n onLongPress?: TouchEventHandler<HTMLDivElement>;\n rightElements?: IListItemRightElements;\n shouldHideImageOrIconBackground?: boolean;\n shouldHideIndicator?: boolean;\n subtitle?: ReactNode;\n shouldShowRoundImageOrIcon?: boolean;\n title: ReactNode;\n titleElement?: ReactNode;\n isDisabledButNotReallyDisabled?: boolean;\n shouldOpenImageOnClick: boolean;\n};\n\nconst ListItemHead: FC<ListItemHeadProps> = ({\n hoverItem,\n icons,\n images,\n isAnyItemExpandable,\n isExpandable,\n isOpen,\n leftElements,\n onClick,\n onLongPress,\n shouldOpenImageOnClick,\n rightElements,\n shouldHideImageOrIconBackground,\n shouldHideIndicator,\n subtitle,\n isDisabledButNotReallyDisabled,\n shouldShowRoundImageOrIcon,\n title,\n titleElement,\n}) => {\n const [shouldShowHoverItem, setShouldShowHoverItem] = useState(false);\n const [headHeight, setHeadHeight] = useState<HeadHeight>({\n closed: 40,\n open: 40,\n });\n const [isFirstRender, setIsFirstRender] = useState(false);\n\n const longPressTimeoutRef = useRef<number>();\n const pseudoTitleOpenRef = useRef<HTMLDivElement>(null);\n const pseudoTitleClosedRef = useRef<HTMLDivElement>(null);\n const pseudoSubtitleOpenRef = useRef<HTMLDivElement>(null);\n const pseudoSubtitleClosedRef = useRef<HTMLDivElement>(null);\n\n const closedTitle = useElementSize(pseudoTitleClosedRef);\n const openedTitle = useElementSize(pseudoTitleOpenRef);\n const closedSubtitle = useElementSize(pseudoSubtitleClosedRef);\n const openedSubtitle = useElementSize(pseudoSubtitleOpenRef);\n\n const shouldShowSubtitleRow = subtitle || typeof subtitle === 'string';\n\n useEffect(() => {\n if (closedTitle && openedTitle) {\n setHeadHeight({\n closed:\n shouldShowSubtitleRow && closedSubtitle\n ? closedSubtitle.height + 4 + closedTitle.height + 24\n : closedTitle.height + 24,\n open:\n shouldShowSubtitleRow && openedSubtitle\n ? openedSubtitle.height + 4 + openedTitle.height + 24\n : openedTitle.height + 24,\n });\n }\n }, [closedSubtitle, closedTitle, openedSubtitle, openedTitle, shouldShowSubtitleRow]);\n\n // This is used to trigger a rerender, so the head height can be calculated\n useEffect(() => {\n setIsFirstRender(true);\n }, []);\n\n const handleMouseEnter = useCallback(() => setShouldShowHoverItem(true), []);\n\n const handleMouseLeave = useCallback(() => setShouldShowHoverItem(false), []);\n\n const marginTop = useMemo(() => {\n const height = headHeight[isOpen ? 'open' : 'closed'];\n\n if (height < 64) {\n return (64 - height) / 2;\n }\n\n return 0;\n }, [headHeight, isOpen]);\n\n const handleTouchStart = useCallback<TouchEventHandler<HTMLDivElement>>(\n (event) => {\n longPressTimeoutRef.current = window.setTimeout(() => {\n if (typeof onLongPress === 'function') {\n onLongPress(event);\n }\n }, 400);\n },\n [onLongPress],\n );\n\n const handleTouchEnd = useCallback(() => {\n clearTimeout(longPressTimeoutRef.current);\n }, []);\n\n const iconOrImageElement = useMemo(() => {\n if (icons) {\n return (\n <ListItemIcon\n icons={icons}\n shouldHideBackground={!!shouldHideImageOrIconBackground}\n shouldShowRoundIcon={!!shouldShowRoundImageOrIcon}\n />\n );\n }\n\n if (images) {\n return (\n <ListItemImage\n images={images}\n shouldOpenImageOnClick={shouldOpenImageOnClick}\n shouldHideBackground={!!shouldHideImageOrIconBackground}\n shouldShowRoundImage={!!shouldShowRoundImageOrIcon}\n />\n );\n }\n\n return undefined;\n }, [icons, images, shouldHideImageOrIconBackground, shouldShowRoundImageOrIcon]);\n\n return (\n <StyledListItemHead\n animate={{\n height: isOpen ? headHeight.open : headHeight.closed,\n opacity: isDisabledButNotReallyDisabled ? 0.5 : 1,\n }}\n initial={false}\n transition={{ duration: 0.2, type: 'tween' }}\n className=\"beta-chayns-list-item-head\"\n $isClickable={typeof onClick === 'function' || isExpandable}\n $isAnyItemExpandable={isAnyItemExpandable}\n onClick={onClick}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n onTouchStart={typeof onLongPress === 'function' ? handleTouchStart : undefined}\n onTouchEnd={typeof onLongPress === 'function' ? handleTouchEnd : undefined}\n >\n <StyledListItemHeadLeftWrapper>\n {isAnyItemExpandable && (\n <StyledMotionListItemHeadIndicator\n animate={{ rotate: isOpen ? 90 : 0 }}\n initial={false}\n transition={{ type: 'tween' }}\n >\n {isExpandable && !shouldHideIndicator && (\n <Icon icons={['fa fa-chevron-right']} />\n )}\n </StyledMotionListItemHeadIndicator>\n )}\n {leftElements}\n {iconOrImageElement}\n </StyledListItemHeadLeftWrapper>\n <StyledListItemHeadContent\n $isIconOrImageGiven={iconOrImageElement !== undefined}\n $marginTop={marginTop}\n $isOpen={isOpen}\n >\n <StyledListItemHeadTitle>\n <StyledListItemHeadTitleContent>\n <StyledListItemHeadTitleTextPseudo ref={pseudoTitleOpenRef} $isOpen>\n {title}\n </StyledListItemHeadTitleTextPseudo>\n <StyledListItemHeadTitleTextPseudo\n ref={pseudoTitleClosedRef}\n $isOpen={false}\n >\n {title}\n </StyledListItemHeadTitleTextPseudo>\n <StyledListItemHeadTitleText\n $isOpen={isOpen}\n $width={openedTitle?.width ?? 0}\n >\n {title}\n </StyledListItemHeadTitleText>\n <StyledListItemHeadTitleElement>\n {titleElement}\n </StyledListItemHeadTitleElement>\n </StyledListItemHeadTitleContent>\n </StyledListItemHeadTitle>\n {shouldShowSubtitleRow && (\n <StyledListItemHeadSubtitle>\n <StyledListItemHeadSubtitleTextPseudo ref={pseudoSubtitleOpenRef} $isOpen>\n {subtitle}\n </StyledListItemHeadSubtitleTextPseudo>\n <StyledListItemHeadSubtitleTextPseudo\n ref={pseudoSubtitleClosedRef}\n $isOpen={false}\n >\n {subtitle}\n </StyledListItemHeadSubtitleTextPseudo>\n <StyledListItemHeadSubtitleText $isOpen={isOpen}>\n {subtitle}\n </StyledListItemHeadSubtitleText>\n </StyledListItemHeadSubtitle>\n )}\n </StyledListItemHeadContent>\n {rightElements && <ListItemRightElements rightElements={rightElements} />}\n {hoverItem && (\n <StyledMotionListItemHeadHoverItem\n animate={{\n marginLeft: shouldShowHoverItem ? 8 : 0,\n opacity: shouldShowHoverItem ? 1 : 0,\n width: shouldShowHoverItem ? 'auto' : 0,\n }}\n initial={false}\n transition={{ duration: 0.15, type: 'tween' }}\n >\n {hoverItem}\n </StyledMotionListItemHeadHoverItem>\n )}\n </StyledListItemHead>\n );\n};\n\nListItemHead.displayName = 'ListItemHead';\n\nexport default ListItemHead;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAWA,IAAAC,eAAA,GAAAD,OAAA;AAEA,IAAAE,KAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,aAAA,GAAAD,sBAAA,CAAAH,OAAA;AACA,IAAAK,cAAA,GAAAF,sBAAA,CAAAH,OAAA;AACA,IAAAM,sBAAA,GAAAH,sBAAA,CAAAH,OAAA;AACA,IAAAO,aAAA,GAAAP,OAAA;AAc+B,SAAAG,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,yBAAAH,CAAA,6BAAAI,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAD,wBAAA,YAAAA,CAAAH,CAAA,WAAAA,CAAA,GAAAM,CAAA,GAAAD,CAAA,KAAAL,CAAA;AAAA,SAAAT,wBAAAS,CAAA,EAAAK,CAAA,SAAAA,CAAA,IAAAL,CAAA,IAAAA,CAAA,CAAAC,UAAA,SAAAD,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAE,OAAA,EAAAF,CAAA,QAAAM,CAAA,GAAAH,wBAAA,CAAAE,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAC,GAAA,CAAAP,CAAA,UAAAM,CAAA,CAAAE,GAAA,CAAAR,CAAA,OAAAS,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAf,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A,CAAAyE,aAAA,CAAC5E,aAAA,CAAA+G,oCAAoC;IAACN,GAAG,EAAEpD,qBAAsB;IAACgD,OAAO;EAAA,GACpElE,QACiC,CAAC,eACvC5C,MAAA,CAAAY,OAAA,CAAAyE,aAAA,CAAC5E,aAAA,CAAA+G,oCAAoC;IACjCN,GAAG,EAAEnD,uBAAwB;IAC7B+C,OAAO,EAAE;EAAM,GAEdlE,QACiC,CAAC,eACvC5C,MAAA,CAAAY,OAAA,CAAAyE,aAAA,CAAC5E,aAAA,CAAAgH,8BAA8B;IAACX,OAAO,EAAE1E;EAAO,GAC3CQ,QAC2B,CACR,CAET,CAAC,EAC3BH,aAAa,iBAAIzC,MAAA,CAAAY,OAAA,CAAAyE,aAAA,CAAC7E,sBAAA,CAAAI,OAAqB;IAAC6B,aAAa,EAAEA;EAAc,CAAE,CAAC,EACxEV,SAAS,iBACN/B,MAAA,CAAAY,OAAA,CAAAyE,aAAA,CAAC5E,aAAA,CAAAiH,iCAAiC;IAC9B/B,OAAO,EAAE;MACLgC,UAAU,EAAE1E,mBAAmB,GAAG,CAAC,GAAG,CAAC;MACvC2C,OAAO,EAAE3C,mBAAmB,GAAG,CAAC,GAAG,CAAC;MACpCoE,KAAK,EAAEpE,mBAAmB,GAAG,MAAM,GAAG;IAC1C,CAAE;IACF4C,OAAO,EAAE,KAAM;IACfC,UAAU,EAAE;MAAEC,QAAQ,EAAE,IAAI;MAAEC,IAAI,EAAE;IAAQ;EAAE,GAE7CjE,SAC8B,CAEvB,CAAC;AAE7B,CAAC;AAEDD,YAAY,CAAC8F,WAAW,GAAG,cAAc;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAlH,OAAA,GAE3BkB,YAAY","ignoreList":[]}
1
+ {"version":3,"file":"ListItemHead.js","names":["_react","_interopRequireWildcard","require","_useElementSize","_Icon","_interopRequireDefault","_ListItemIcon","_ListItemImage","_ListItemRightElements","_ListItemHead","e","__esModule","default","_getRequireWildcardCache","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","ListItemHead","hoverItem","icons","images","isAnyItemExpandable","isExpandable","isOpen","isTitleGreyed","leftElements","onClick","onLongPress","rightElements","shouldHideImageOrIconBackground","shouldHideIndicator","shouldOpenImageOnClick","shouldShowRoundImageOrIcon","subtitle","title","titleElement","shouldShowHoverItem","setShouldShowHoverItem","useState","headHeight","setHeadHeight","closed","open","setIsFirstRender","longPressTimeoutRef","useRef","pseudoTitleOpenRef","pseudoTitleClosedRef","pseudoSubtitleOpenRef","pseudoSubtitleClosedRef","closedTitle","useElementSize","openedTitle","closedSubtitle","openedSubtitle","shouldShowSubtitleRow","useEffect","height","handleMouseEnter","useCallback","handleMouseLeave","marginTop","useMemo","handleTouchStart","event","current","window","setTimeout","handleTouchEnd","clearTimeout","iconOrImageElement","createElement","shouldHideBackground","shouldShowRoundIcon","shouldShowRoundImage","undefined","StyledListItemHead","animate","opacity","initial","transition","duration","type","className","$isClickable","$isAnyItemExpandable","onMouseEnter","onMouseLeave","onTouchStart","onTouchEnd","StyledListItemHeadLeftWrapper","StyledMotionListItemHeadIndicator","rotate","StyledListItemHeadContent","$isIconOrImageGiven","$marginTop","$isOpen","StyledListItemHeadTitle","StyledListItemHeadTitleContent","StyledListItemHeadTitleTextPseudo","ref","StyledListItemHeadTitleText","$width","width","StyledListItemHeadTitleElement","StyledListItemHeadSubtitle","StyledListItemHeadSubtitleTextPseudo","StyledListItemHeadSubtitleText","StyledMotionListItemHeadHoverItem","marginLeft","displayName","_default","exports"],"sources":["../../../../../../src/components/list/list-item/list-item-head/ListItemHead.tsx"],"sourcesContent":["import React, {\n FC,\n MouseEventHandler,\n ReactNode,\n TouchEventHandler,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { useElementSize } from '../../../../hooks/useElementSize';\nimport type { IListItemRightElements } from '../../../../types/list';\nimport Icon from '../../../icon/Icon';\nimport ListItemIcon from './list-item-icon/ListItemIcon';\nimport ListItemImage from './list-item-image/ListItemImage';\nimport ListItemRightElements from './list-item-right-elements/ListItemRightElements';\nimport {\n StyledListItemHead,\n StyledListItemHeadContent,\n StyledListItemHeadLeftWrapper,\n StyledListItemHeadSubtitle,\n StyledListItemHeadSubtitleText,\n StyledListItemHeadSubtitleTextPseudo,\n StyledListItemHeadTitle,\n StyledListItemHeadTitleContent,\n StyledListItemHeadTitleElement,\n StyledListItemHeadTitleText,\n StyledListItemHeadTitleTextPseudo,\n StyledMotionListItemHeadHoverItem,\n StyledMotionListItemHeadIndicator,\n} from './ListItemHead.styles';\n\ninterface HeadHeight {\n closed: number;\n open: number;\n}\n\ntype ListItemHeadProps = {\n hoverItem?: ReactNode;\n icons?: string[];\n images?: string[];\n isAnyItemExpandable: boolean;\n isExpandable: boolean;\n isOpen: boolean;\n isTitleGreyed?: boolean;\n leftElements?: ReactNode;\n onClick?: MouseEventHandler<HTMLDivElement>;\n onLongPress?: TouchEventHandler<HTMLDivElement>;\n rightElements?: IListItemRightElements;\n shouldHideImageOrIconBackground?: boolean;\n shouldHideIndicator?: boolean;\n shouldOpenImageOnClick: boolean;\n shouldShowRoundImageOrIcon?: boolean;\n subtitle?: ReactNode;\n title: ReactNode;\n titleElement?: ReactNode;\n};\n\nconst ListItemHead: FC<ListItemHeadProps> = ({\n hoverItem,\n icons,\n images,\n isAnyItemExpandable,\n isExpandable,\n isOpen,\n isTitleGreyed,\n leftElements,\n onClick,\n onLongPress,\n rightElements,\n shouldHideImageOrIconBackground,\n shouldHideIndicator,\n shouldOpenImageOnClick,\n shouldShowRoundImageOrIcon,\n subtitle,\n title,\n titleElement,\n}) => {\n const [shouldShowHoverItem, setShouldShowHoverItem] = useState(false);\n const [headHeight, setHeadHeight] = useState<HeadHeight>({\n closed: 40,\n open: 40,\n });\n const [, setIsFirstRender] = useState(false);\n\n const longPressTimeoutRef = useRef<number>();\n const pseudoTitleOpenRef = useRef<HTMLDivElement>(null);\n const pseudoTitleClosedRef = useRef<HTMLDivElement>(null);\n const pseudoSubtitleOpenRef = useRef<HTMLDivElement>(null);\n const pseudoSubtitleClosedRef = useRef<HTMLDivElement>(null);\n\n const closedTitle = useElementSize(pseudoTitleClosedRef);\n const openedTitle = useElementSize(pseudoTitleOpenRef);\n const closedSubtitle = useElementSize(pseudoSubtitleClosedRef);\n const openedSubtitle = useElementSize(pseudoSubtitleOpenRef);\n\n const shouldShowSubtitleRow = subtitle || typeof subtitle === 'string';\n\n useEffect(() => {\n if (closedTitle && openedTitle) {\n setHeadHeight({\n closed:\n shouldShowSubtitleRow && closedSubtitle\n ? closedSubtitle.height + 4 + closedTitle.height + 24\n : closedTitle.height + 24,\n open:\n shouldShowSubtitleRow && openedSubtitle\n ? openedSubtitle.height + 4 + openedTitle.height + 24\n : openedTitle.height + 24,\n });\n }\n }, [closedSubtitle, closedTitle, openedSubtitle, openedTitle, shouldShowSubtitleRow]);\n\n // This is used to trigger a rerender, so the head height can be calculated\n useEffect(() => {\n setIsFirstRender(true);\n }, []);\n\n const handleMouseEnter = useCallback(() => setShouldShowHoverItem(true), []);\n\n const handleMouseLeave = useCallback(() => setShouldShowHoverItem(false), []);\n\n const marginTop = useMemo(() => {\n const height = headHeight[isOpen ? 'open' : 'closed'];\n\n if (height < 64) {\n return (64 - height) / 2;\n }\n\n return 0;\n }, [headHeight, isOpen]);\n\n const handleTouchStart = useCallback<TouchEventHandler<HTMLDivElement>>(\n (event) => {\n longPressTimeoutRef.current = window.setTimeout(() => {\n if (typeof onLongPress === 'function') {\n onLongPress(event);\n }\n }, 400);\n },\n [onLongPress],\n );\n\n const handleTouchEnd = useCallback(() => {\n clearTimeout(longPressTimeoutRef.current);\n }, []);\n\n const iconOrImageElement = useMemo(() => {\n if (icons) {\n return (\n <ListItemIcon\n icons={icons}\n shouldHideBackground={!!shouldHideImageOrIconBackground}\n shouldShowRoundIcon={!!shouldShowRoundImageOrIcon}\n />\n );\n }\n\n if (images) {\n return (\n <ListItemImage\n images={images}\n shouldOpenImageOnClick={shouldOpenImageOnClick}\n shouldHideBackground={!!shouldHideImageOrIconBackground}\n shouldShowRoundImage={!!shouldShowRoundImageOrIcon}\n />\n );\n }\n\n return undefined;\n }, [\n icons,\n images,\n shouldHideImageOrIconBackground,\n shouldOpenImageOnClick,\n shouldShowRoundImageOrIcon,\n ]);\n\n return (\n <StyledListItemHead\n animate={{\n height: isOpen ? headHeight.open : headHeight.closed,\n opacity: isTitleGreyed ? 0.5 : 1,\n }}\n initial={false}\n transition={{ duration: 0.2, type: 'tween' }}\n className=\"beta-chayns-list-item-head\"\n $isClickable={typeof onClick === 'function' || isExpandable}\n $isAnyItemExpandable={isAnyItemExpandable}\n onClick={onClick}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n onTouchStart={typeof onLongPress === 'function' ? handleTouchStart : undefined}\n onTouchEnd={typeof onLongPress === 'function' ? handleTouchEnd : undefined}\n >\n <StyledListItemHeadLeftWrapper>\n {isAnyItemExpandable && (\n <StyledMotionListItemHeadIndicator\n animate={{ rotate: isOpen ? 90 : 0 }}\n initial={false}\n transition={{ type: 'tween' }}\n >\n {isExpandable && !shouldHideIndicator && (\n <Icon icons={['fa fa-chevron-right']} />\n )}\n </StyledMotionListItemHeadIndicator>\n )}\n {leftElements}\n {iconOrImageElement}\n </StyledListItemHeadLeftWrapper>\n <StyledListItemHeadContent\n $isIconOrImageGiven={iconOrImageElement !== undefined}\n $marginTop={marginTop}\n $isOpen={isOpen}\n >\n <StyledListItemHeadTitle>\n <StyledListItemHeadTitleContent>\n <StyledListItemHeadTitleTextPseudo ref={pseudoTitleOpenRef} $isOpen>\n {title}\n </StyledListItemHeadTitleTextPseudo>\n <StyledListItemHeadTitleTextPseudo\n ref={pseudoTitleClosedRef}\n $isOpen={false}\n >\n {title}\n </StyledListItemHeadTitleTextPseudo>\n <StyledListItemHeadTitleText\n $isOpen={isOpen}\n $width={openedTitle?.width ?? 0}\n >\n {title}\n </StyledListItemHeadTitleText>\n <StyledListItemHeadTitleElement>\n {titleElement}\n </StyledListItemHeadTitleElement>\n </StyledListItemHeadTitleContent>\n </StyledListItemHeadTitle>\n {shouldShowSubtitleRow && (\n <StyledListItemHeadSubtitle>\n <StyledListItemHeadSubtitleTextPseudo ref={pseudoSubtitleOpenRef} $isOpen>\n {subtitle}\n </StyledListItemHeadSubtitleTextPseudo>\n <StyledListItemHeadSubtitleTextPseudo\n ref={pseudoSubtitleClosedRef}\n $isOpen={false}\n >\n {subtitle}\n </StyledListItemHeadSubtitleTextPseudo>\n <StyledListItemHeadSubtitleText $isOpen={isOpen}>\n {subtitle}\n </StyledListItemHeadSubtitleText>\n </StyledListItemHeadSubtitle>\n )}\n </StyledListItemHeadContent>\n {rightElements && <ListItemRightElements rightElements={rightElements} />}\n {hoverItem && (\n <StyledMotionListItemHeadHoverItem\n animate={{\n marginLeft: shouldShowHoverItem ? 8 : 0,\n opacity: shouldShowHoverItem ? 1 : 0,\n width: shouldShowHoverItem ? 'auto' : 0,\n }}\n initial={false}\n transition={{ duration: 0.15, type: 'tween' }}\n >\n {hoverItem}\n </StyledMotionListItemHeadHoverItem>\n )}\n </StyledListItemHead>\n );\n};\n\nListItemHead.displayName = 'ListItemHead';\n\nexport default ListItemHead;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAWA,IAAAC,eAAA,GAAAD,OAAA;AAEA,IAAAE,KAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,aAAA,GAAAD,sBAAA,CAAAH,OAAA;AACA,IAAAK,cAAA,GAAAF,sBAAA,CAAAH,OAAA;AACA,IAAAM,sBAAA,GAAAH,sBAAA,CAAAH,OAAA;AACA,IAAAO,aAAA,GAAAP,OAAA;AAc+B,SAAAG,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,yBAAAH,CAAA,6BAAAI,OAAA,mBAAAC,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GAAG,CAAC;MACvC0C,OAAO,EAAE1C,mBAAmB,GAAG,CAAC,GAAG,CAAC;MACpCmE,KAAK,EAAEnE,mBAAmB,GAAG,MAAM,GAAG;IAC1C,CAAE;IACF2C,OAAO,EAAE,KAAM;IACfC,UAAU,EAAE;MAAEC,QAAQ,EAAE,IAAI;MAAEC,IAAI,EAAE;IAAQ;EAAE,GAE7ChE,SAC8B,CAEvB,CAAC;AAE7B,CAAC;AAEDD,YAAY,CAAC6F,WAAW,GAAG,cAAc;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAjH,OAAA,GAE3BkB,YAAY","ignoreList":[]}
package/lib/cjs/index.js CHANGED
@@ -171,6 +171,12 @@ Object.defineProperty(exports, "Input", {
171
171
  return _Input.default;
172
172
  }
173
173
  });
174
+ Object.defineProperty(exports, "InputSize", {
175
+ enumerable: true,
176
+ get: function () {
177
+ return _Input.InputSize;
178
+ }
179
+ });
174
180
  Object.defineProperty(exports, "List", {
175
181
  enumerable: true,
176
182
  get: function () {
@@ -419,7 +425,7 @@ var _FilterButton = _interopRequireDefault(require("./components/filter-buttons/
419
425
  var _FilterButtons = _interopRequireDefault(require("./components/filter-buttons/FilterButtons"));
420
426
  var _GridImage = _interopRequireDefault(require("./components/grid-image/GridImage"));
421
427
  var _Icon = _interopRequireDefault(require("./components/icon/Icon"));
422
- var _Input = _interopRequireDefault(require("./components/input/Input"));
428
+ var _Input = _interopRequireWildcard(require("./components/input/Input"));
423
429
  var _List = _interopRequireDefault(require("./components/list/List"));
424
430
  var _ListItemContent = _interopRequireDefault(require("./components/list/list-item/list-item-content/ListItemContent"));
425
431
  var _ListItem = _interopRequireDefault(require("./components/list/list-item/ListItem"));
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_Accordion","_interopRequireDefault","require","_AccordionContent","_AccordionGroup","_AccordionIntro","_AccordionItem","_AmountControl","_AreaContextProvider","_interopRequireWildcard","_Badge","_Button","_Checkbox","_ColorSchemeProvider","_ComboBox","_ContentCard","_ContextMenu","_ExpandableContent","_FileInput","_FilterButton","_FilterButtons","_GridImage","_Icon","_Input","_List","_ListItemContent","_ListItem","_MentionFinder","_NumberInput","_PageProvider","_Popup","_PopupContent","_ProgressBar","_RadioButtonGroup","_RadioButton","_ScrollView","_SearchBox","_SearchInput","_SelectButton","_SetupWizardItem","_SetupWizard","_SharingBar","_Signature","_SliderButton","_Slider","_SmallWaitCursor","_TagInput","_TextArea","_Tooltip","_Truncation","_mentionFinder","_useElementSize","_comboBox","_contentCard","_contextMenu","_filterButtons","_truncation","_environment","_fileDialog","_isTobitEmployee","_pageProvider","_uploadFile","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set"],"sources":["../../src/index.ts"],"sourcesContent":["// noinspection JSUnusedGlobalSymbols\nexport { default as Accordion } from './components/accordion/Accordion';\nexport { default as AccordionContent } from './components/accordion/accordion-content/AccordionContent';\nexport { default as AccordionGroup } from './components/accordion/accordion-group/AccordionGroup';\nexport { default as AccordionIntro } from './components/accordion/accordion-intro/AccordionIntro';\nexport { default as AccordionItem } from './components/accordion/accordion-item/AccordionItem';\nexport { default as AmountControl } from './components/amount-control/AmountControl';\nexport {\n AreaContext,\n default as AreaProvider,\n} from './components/area-provider/AreaContextProvider';\nexport { default as Badge } from './components/badge/Badge';\nexport { default as Button } from './components/button/Button';\nexport { default as Checkbox } from './components/checkbox/Checkbox';\nexport {\n default as ColorSchemeProvider,\n useColorScheme,\n} from './components/color-scheme-provider/ColorSchemeProvider';\nexport type {\n ColorSchemeContextProps,\n FramerMotionBugFix,\n WithTheme,\n} from './components/color-scheme-provider/ColorSchemeProvider';\nexport {\n default as ComboBox,\n type ComboBoxTextStyles,\n type IComboBoxItem as ComboBoxItem,\n type IComboBoxItems as ComboBoxItems,\n} from './components/combobox/ComboBox';\nexport { default as ContentCard } from './components/content-card/ContentCard';\nexport {\n default as ContextMenu,\n type ContextMenuCoordinates,\n type ContextMenuItem,\n type ContextMenuRef,\n} from './components/context-menu/ContextMenu';\nexport { default as ExpandableContent } from './components/expandable-content/ExpandableContent';\nexport { default as FileInput, type FileInputRef } from './components/file-input/FileInput';\nexport { default as FilterButton } from './components/filter-buttons/filter-button/FilterButton';\nexport { default as FilterButtons } from './components/filter-buttons/FilterButtons';\nexport { default as GridImage } from './components/grid-image/GridImage';\nexport { default as Icon } from './components/icon/Icon';\nexport { default as Input } from './components/input/Input';\nexport { default as List } from './components/list/List';\nexport { default as ListItemContent } from './components/list/list-item/list-item-content/ListItemContent';\nexport {\n default as ListItem,\n type ListItemElements,\n type ListItemProps,\n} from './components/list/list-item/ListItem';\nexport { default as MentionFinder } from './components/mention-finder/MentionFinder';\nexport type { MentionMember } from './components/mention-finder/MentionFinder';\nexport { default as NumberInput } from './components/number-input/NumberInput';\nexport { default as PageProvider } from './components/page-provider/PageProvider';\nexport { default as Popup } from './components/popup/Popup';\nexport { default as PopupContent } from './components/popup/popup-content/PopupContent';\nexport { default as ProgressBar } from './components/progress-bar/ProgressBar';\nexport {\n default as RadioButtonGroup,\n type RadioButtonGroupRef,\n} from './components/radio-button/radio-button-group/RadioButtonGroup';\nexport { default as RadioButton } from './components/radio-button/RadioButton';\nexport { default as ScrollView } from './components/scroll-view/ScrollView';\nexport { default as SearchBox } from './components/search-box/SearchBox';\nexport { default as SearchInput } from './components/search-input/SearchInput';\nexport { default as SelectButton } from './components/select-button/SelectButton';\nexport { default as SetupWizardItem } from './components/setup-wizard/setup-wizard-item/SetupWizardItem';\nexport { default as SetupWizard } from './components/setup-wizard/SetupWizard';\nexport type { SetupWizardRef } from './components/setup-wizard/SetupWizard';\nexport { default as SharingBar } from './components/sharing-bar/SharingBar';\nexport { default as Signature } from './components/signature/Signature';\nexport type { SignatureRef } from './components/signature/Signature';\nexport { default as SliderButton } from './components/slider-button/SliderButton';\nexport { default as Slider } from './components/slider/Slider';\nexport {\n default as SmallWaitCursor,\n SmallWaitCursorSize,\n SmallWaitCursorSpeed,\n} from './components/small-wait-cursor/SmallWaitCursor';\nexport { default as TagInput } from './components/tag-input/TagInput';\nexport { default as TextArea } from './components/text-area/TextArea';\nexport { default as Tooltip } from './components/tooltip/Tooltip';\nexport { default as Truncation } from './components/truncation/Truncation';\nexport { MentionFinderPopupAlignment } from './constants/mentionFinder';\nexport { useElementSize } from './hooks/useElementSize';\nexport { ComboBoxDirection } from './types/comboBox';\nexport { ContentCardType } from './types/contentCard';\nexport { ContextMenuAlignment } from './types/contextMenu';\nexport type { FileItem, Image, InternalFileItem, Meta, Video } from './types/file';\nexport type { FileInputFileItem } from './types/fileInput';\nexport { FilterButtonItemShape, FilterButtonSize } from './types/filterButtons';\nexport type { IFilterButtonItem as FilterButtonItem } from './types/filterButtons';\nexport type { IListItemRightElements } from './types/list';\nexport type { PopupRef } from './types/popup';\nexport type { RadioButtonItem } from './types/radioButton';\nexport type {\n ISearchBoxItem as SearchBoxItem,\n ISearchBoxItems as SearchBoxItems,\n} from './types/searchBox';\nexport type { SelectButtonItem } from './types/selectButton';\nexport type { SliderButtonItem } from './types/slider-button';\nexport { ClampPosition } from './types/truncation';\nexport { getIsTouch } from './utils/environment';\nexport { filterFilesByMimeType, getFileAsArrayBuffer, selectFiles } from './utils/fileDialog';\nexport { isTobitEmployee } from './utils/isTobitEmployee';\nexport { getUsableHeight } from './utils/pageProvider';\nexport { uploadFile } from './utils/uploadFile';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAAT,CAAA,CAAAM,CAAA,IAAAd,CAAA,CAAAc,CAAA,YAAAN,CAAA,CAAAH,OAAA,GAAAL,CAAA,EAAAG,CAAA,IAAAA,CAAA,CAAAe,GAAA,CAAAlB,CAAA,EAAAQ,CAAA,GAAAA,CAAA;AAAA,SAAAtE,uBAAA8D,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAI,UAAA,GAAAJ,CAAA,KAAAK,OAAA,EAAAL,CAAA","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["_Accordion","_interopRequireDefault","require","_AccordionContent","_AccordionGroup","_AccordionIntro","_AccordionItem","_AmountControl","_AreaContextProvider","_interopRequireWildcard","_Badge","_Button","_Checkbox","_ColorSchemeProvider","_ComboBox","_ContentCard","_ContextMenu","_ExpandableContent","_FileInput","_FilterButton","_FilterButtons","_GridImage","_Icon","_Input","_List","_ListItemContent","_ListItem","_MentionFinder","_NumberInput","_PageProvider","_Popup","_PopupContent","_ProgressBar","_RadioButtonGroup","_RadioButton","_ScrollView","_SearchBox","_SearchInput","_SelectButton","_SetupWizardItem","_SetupWizard","_SharingBar","_Signature","_SliderButton","_Slider","_SmallWaitCursor","_TagInput","_TextArea","_Tooltip","_Truncation","_mentionFinder","_useElementSize","_comboBox","_contentCard","_contextMenu","_filterButtons","_truncation","_environment","_fileDialog","_isTobitEmployee","_pageProvider","_uploadFile","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set"],"sources":["../../src/index.ts"],"sourcesContent":["// noinspection JSUnusedGlobalSymbols\nexport { default as Accordion } from './components/accordion/Accordion';\nexport { default as AccordionContent } from './components/accordion/accordion-content/AccordionContent';\nexport { default as AccordionGroup } from './components/accordion/accordion-group/AccordionGroup';\nexport { default as AccordionIntro } from './components/accordion/accordion-intro/AccordionIntro';\nexport { default as AccordionItem } from './components/accordion/accordion-item/AccordionItem';\nexport { default as AmountControl } from './components/amount-control/AmountControl';\nexport {\n AreaContext,\n default as AreaProvider,\n} from './components/area-provider/AreaContextProvider';\nexport { default as Badge } from './components/badge/Badge';\nexport { default as Button } from './components/button/Button';\nexport { default as Checkbox } from './components/checkbox/Checkbox';\nexport {\n default as ColorSchemeProvider,\n useColorScheme,\n} from './components/color-scheme-provider/ColorSchemeProvider';\nexport type {\n ColorSchemeContextProps,\n FramerMotionBugFix,\n WithTheme,\n} from './components/color-scheme-provider/ColorSchemeProvider';\nexport {\n default as ComboBox,\n type ComboBoxTextStyles,\n type IComboBoxItem as ComboBoxItem,\n type IComboBoxItems as ComboBoxItems,\n} from './components/combobox/ComboBox';\nexport { default as ContentCard } from './components/content-card/ContentCard';\nexport {\n default as ContextMenu,\n type ContextMenuCoordinates,\n type ContextMenuItem,\n type ContextMenuRef,\n} from './components/context-menu/ContextMenu';\nexport { default as ExpandableContent } from './components/expandable-content/ExpandableContent';\nexport { default as FileInput, type FileInputRef } from './components/file-input/FileInput';\nexport { default as FilterButton } from './components/filter-buttons/filter-button/FilterButton';\nexport { default as FilterButtons } from './components/filter-buttons/FilterButtons';\nexport { default as GridImage } from './components/grid-image/GridImage';\nexport { default as Icon } from './components/icon/Icon';\nexport { default as Input, InputSize } from './components/input/Input';\nexport { default as List } from './components/list/List';\nexport { default as ListItemContent } from './components/list/list-item/list-item-content/ListItemContent';\nexport {\n default as ListItem,\n type ListItemElements,\n type ListItemProps,\n} from './components/list/list-item/ListItem';\nexport { default as MentionFinder } from './components/mention-finder/MentionFinder';\nexport type { MentionMember } from './components/mention-finder/MentionFinder';\nexport { default as NumberInput } from './components/number-input/NumberInput';\nexport { default as PageProvider } from './components/page-provider/PageProvider';\nexport { default as Popup } from './components/popup/Popup';\nexport { default as PopupContent } from './components/popup/popup-content/PopupContent';\nexport { default as ProgressBar } from './components/progress-bar/ProgressBar';\nexport {\n default as RadioButtonGroup,\n type RadioButtonGroupRef,\n} from './components/radio-button/radio-button-group/RadioButtonGroup';\nexport { default as RadioButton } from './components/radio-button/RadioButton';\nexport { default as ScrollView } from './components/scroll-view/ScrollView';\nexport { default as SearchBox } from './components/search-box/SearchBox';\nexport { default as SearchInput } from './components/search-input/SearchInput';\nexport { default as SelectButton } from './components/select-button/SelectButton';\nexport { default as SetupWizardItem } from './components/setup-wizard/setup-wizard-item/SetupWizardItem';\nexport { default as SetupWizard } from './components/setup-wizard/SetupWizard';\nexport type { SetupWizardRef } from './components/setup-wizard/SetupWizard';\nexport { default as SharingBar } from './components/sharing-bar/SharingBar';\nexport { default as Signature } from './components/signature/Signature';\nexport type { SignatureRef } from './components/signature/Signature';\nexport { default as SliderButton } from './components/slider-button/SliderButton';\nexport { default as Slider } from './components/slider/Slider';\nexport {\n default as SmallWaitCursor,\n SmallWaitCursorSize,\n SmallWaitCursorSpeed,\n} from './components/small-wait-cursor/SmallWaitCursor';\nexport { default as TagInput } from './components/tag-input/TagInput';\nexport { default as TextArea } from './components/text-area/TextArea';\nexport { default as Tooltip } from './components/tooltip/Tooltip';\nexport { default as Truncation } from './components/truncation/Truncation';\nexport { MentionFinderPopupAlignment } from './constants/mentionFinder';\nexport { useElementSize } from './hooks/useElementSize';\nexport { ComboBoxDirection } from './types/comboBox';\nexport { ContentCardType } from './types/contentCard';\nexport { ContextMenuAlignment } from './types/contextMenu';\nexport type { FileItem, Image, InternalFileItem, Meta, Video } from './types/file';\nexport type { FileInputFileItem } from './types/fileInput';\nexport { FilterButtonItemShape, FilterButtonSize } from './types/filterButtons';\nexport type { IFilterButtonItem as FilterButtonItem } from './types/filterButtons';\nexport type { IListItemRightElements } from './types/list';\nexport type { PopupRef } from './types/popup';\nexport type { RadioButtonItem } from './types/radioButton';\nexport type {\n ISearchBoxItem as SearchBoxItem,\n ISearchBoxItems as SearchBoxItems,\n} from './types/searchBox';\nexport type { SelectButtonItem } from './types/selectButton';\nexport type { SliderButtonItem } from './types/slider-button';\nexport { ClampPosition } from './types/truncation';\nexport { getIsTouch } from './utils/environment';\nexport { filterFilesByMimeType, getFileAsArrayBuffer, selectFiles } from './utils/fileDialog';\nexport { isTobitEmployee } from './utils/isTobitEmployee';\nexport { getUsableHeight } from './utils/pageProvider';\nexport { uploadFile } from './utils/uploadFile';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,eAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,eAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,cAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,cAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,oBAAA,GAAAC,uBAAA,CAAAP,OAAA;AAIA,IAAAQ,MAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,OAAA,GAAAV,sBAAA,CAAAC,OAAA;AACA,IAAAU,SAAA,GAAAX,sBAAA,CAAAC,OAAA;AACA,IAAAW,oBAAA,GAAAJ,uBAAA,CAAAP,OAAA;AASA,IAAAY,SAAA,GAAAb,sBAAA,CAAAC,OAAA;AAMA,IAAAa,YAAA,GAAAd,sBAAA,CAAAC,OAAA;AACA,IA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