@appquality/unguess-design-system 3.1.84-beta-attachments → 3.1.86-beta-attachments

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/index.js CHANGED
@@ -2316,6 +2316,7 @@ const ChatContext = React.createContext(null);
2316
2316
  const ChatContextProvider = ({ onSave, onFileUpload, setMentionableUsers, children, }) => {
2317
2317
  const [editor, setEditor] = React.useState();
2318
2318
  const [thumbnails, setThumbnails] = React.useState([]);
2319
+ //const [isMediaUploading, setIsMediaUploading] = useState<boolean>(false);
2319
2320
  const getMentions = (editor) => {
2320
2321
  const result = [];
2321
2322
  editor.state.doc.descendants((node) => {
@@ -2335,9 +2336,32 @@ const ChatContextProvider = ({ onSave, onFileUpload, setMentionableUsers, childr
2335
2336
  editor,
2336
2337
  setEditor,
2337
2338
  thumbnails,
2338
- addThumbnails: ({ files }) => {
2339
+ afterUploadCallback: (failed) => {
2340
+ setThumbnails(thumbnails.map((file) => {
2341
+ if (failed.includes(file.name)) {
2342
+ file.isLoadingMedia = false;
2343
+ //file.isError = true;
2344
+ }
2345
+ else {
2346
+ file.isLoadingMedia = false;
2347
+ //file.isError = false
2348
+ }
2349
+ return file;
2350
+ }));
2351
+ },
2352
+ //isMediaUploading, // Incluso nel valore del contesto
2353
+ //setIsMediaUploading, // Incluso nel valore del contesto
2354
+ addThumbnails: ({ files, }) => {
2339
2355
  onFileUpload && onFileUpload(files);
2356
+ /* const media = files.map((file) => ({
2357
+ ...file,
2358
+ isLoadingMedia: false,
2359
+ }));
2360
+ media[0].isLoadingMedia = false;*/
2361
+ //setIsMediaUploading(true);
2362
+ files.forEach((file) => (file.isLoadingMedia = true));
2340
2363
  setThumbnails((prev) => [...prev, ...files]);
2364
+ //setIsMediaUploading(false);
2341
2365
  },
2342
2366
  removeThumbnail: (index) => setThumbnails(thumbnails.filter((_, i) => i !== index)),
2343
2367
  triggerSave: () => {
@@ -2356,7 +2380,10 @@ const ChatContextProvider = ({ onSave, onFileUpload, setMentionableUsers, childr
2356
2380
  thumbnails,
2357
2381
  setThumbnails,
2358
2382
  onFileUpload,
2383
+ //setIsMediaUploading,
2384
+ //isMediaUploading,
2359
2385
  ]);
2386
+ console.log("thumbnails: ", thumbnails);
2360
2387
  return (jsxRuntime.jsx(ChatContext.Provider, Object.assign({ value: chatContextValue }, { children: children })));
2361
2388
  };
2362
2389
  const useChatContext = () => {
@@ -2981,7 +3008,9 @@ const CommentBar = ({ editor, i18n, }) => {
2981
3008
  fileInput.onchange = () => {
2982
3009
  const files = fileInput.files;
2983
3010
  if (files) {
2984
- const mediaFiles = Array.from(files);
3011
+ const mediaFiles = Array.from(files).map((file) => {
3012
+ return Object.assign(file, { isLoadingMedia: false });
3013
+ });
2985
3014
  if (mediaFiles.length === 0)
2986
3015
  return;
2987
3016
  addThumbnails({ files: mediaFiles });
@@ -3261,6 +3290,19 @@ const DeleteThumbnailX = ({ content, deleteThumbnail }) => {
3261
3290
  return (jsxRuntime.jsx(StyledDeleteThumbnailX, Object.assign({ className: "deleteThumbnail", onClick: (e) => deleteThumbnail(e) }, { children: jsxRuntime.jsx("span", { children: content }) })));
3262
3291
  };
3263
3292
 
3293
+ var _path$n;
3294
+ function _extends$r() { _extends$r = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$r.apply(this, arguments); }
3295
+ const SvgPlayFill = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$r({
3296
+ xmlns: "http://www.w3.org/2000/svg",
3297
+ width: 16,
3298
+ height: 16,
3299
+ focusable: "false",
3300
+ viewBox: "0 0 16 16"
3301
+ }, props), _path$n || (_path$n = /*#__PURE__*/React__namespace.createElement("path", {
3302
+ fill: "currentColor",
3303
+ d: "M6 15.79c-.13 0-.26-.03-.38-.08a.977.977 0 01-.62-.92V1.21a1 1 0 01.62-.93C6 .12 6.42.21 6.71.5l6.44 6.44c.58.58.58 1.54 0 2.12L6.71 15.5c-.19.19-.45.29-.71.29z"
3304
+ })));
3305
+
3264
3306
  const StyledThumbnail = styled__default["default"].div `
3265
3307
  border-radius: 4%;
3266
3308
  height: 90px;
@@ -3284,13 +3326,29 @@ const StyledThumbnail = styled__default["default"].div `
3284
3326
  font-weight: 100;
3285
3327
  }
3286
3328
  `;
3287
- const Thumbnail = ({ clickThumbnail, src, label, index = 0, removeThumbnail, showX = true, showLabel = false, mediaType, }) => {
3329
+ const Thumbnail = ({ clickThumbnail, src, label, index = 0, removeThumbnail, showX = true, showLabel = false, mediaType, isLoadingMedia = false, }) => {
3330
+ //const { isMediaUploading, setIsMediaUploading } = useChatContext();
3288
3331
  const handleCancel = (e) => {
3289
3332
  e.stopPropagation();
3290
3333
  if (removeThumbnail)
3291
3334
  removeThumbnail(index);
3292
3335
  };
3293
- return (jsxRuntime.jsxs(StyledThumbnail, Object.assign({ className: "singleThumbnail", onClick: clickThumbnail }, { children: [showX && (jsxRuntime.jsx(DeleteThumbnailX, { content: "╳", deleteThumbnail: (e) => handleCancel(e) })), mediaType.includes("image") && jsxRuntime.jsx("img", { src: src, alt: label }), mediaType.includes("video") && (jsxRuntime.jsx("video", Object.assign({ width: "80", height: "89" }, { children: jsxRuntime.jsx("source", { src: src, type: "video/mp4" }) }))), showLabel && jsxRuntime.jsx("span", Object.assign({ className: "thumbnailLabel" }, { children: label }))] })));
3336
+ return (jsxRuntime.jsxs(StyledThumbnail, Object.assign({ className: "singleThumbnail", onClick: clickThumbnail }, { children: [showX && (jsxRuntime.jsx(DeleteThumbnailX, { content: "╳", deleteThumbnail: (e) => handleCancel(e) })), isLoadingMedia && (jsxRuntime.jsx(reactLoaders.Spinner, { style: { position: "absolute", top: "39%", left: "37%" }, size: "large" })), !isLoadingMedia && mediaType.includes("image") && (jsxRuntime.jsx("img", { src: src, alt: label })), !isLoadingMedia && mediaType.includes("video") && (jsxRuntime.jsxs("span", Object.assign({ style: {
3337
+ width: "100%",
3338
+ height: "100%",
3339
+ backgroundColor: "gray",
3340
+ zIndex: "-1",
3341
+ opacity: "0.5",
3342
+ color: "black",
3343
+ } }, { children: [jsxRuntime.jsx(SvgPlayFill, { style: {
3344
+ position: "absolute",
3345
+ top: "35%",
3346
+ left: "35%",
3347
+ width: "30px",
3348
+ height: "30px",
3349
+ backgroundColor: "white",
3350
+ borderRadius: "50%",
3351
+ } }), jsxRuntime.jsx("video", Object.assign({ width: "80", height: "89" }, { children: jsxRuntime.jsx("source", { src: src, type: "video/mp4" }) }))] }))), showLabel && jsxRuntime.jsx("span", Object.assign({ className: "thumbnailLabel" }, { children: label }))] })));
3294
3352
  };
3295
3353
 
3296
3354
  const StyledThumbnailContainer$1 = styled.styled.div `
@@ -3313,8 +3371,27 @@ const ThumbnailContainer = ({ openLightbox }) => {
3313
3371
  if (!thumbnails || thumbnails.length === 0) {
3314
3372
  return null;
3315
3373
  }
3316
- return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsx(StyledThumbnailContainer$1, Object.assign({ className: "thumbnailContainer" }, { children: thumbnails.map((file, index) => (jsxRuntime.jsx(Thumbnail, { src: URL.createObjectURL(file), label: file.name, index: index, showX: true, showLabel: false, mediaType: file.type, removeThumbnail: () => removeThumbnail(index), clickThumbnail: () => {
3317
- openLightbox(file, index);
3374
+ /* const mediaFiles: File[] = thumbnails.map((file) => {
3375
+ // Crea un nuovo oggetto File senza la proprietà isLoadingMedia
3376
+ const blob = new Blob([file], { type: file.type });
3377
+
3378
+ // Creiamo un nuovo File utilizzando il Blob e mantenendo il nome del file originale
3379
+ const nf = new File([blob], file.name, { type: file.type });
3380
+
3381
+ return nf;
3382
+ });*/
3383
+ const mediaFiles = [];
3384
+ thumbnails.forEach((file) => {
3385
+ mediaFiles.push({
3386
+ fileName: file.name,
3387
+ fileType: file.type,
3388
+ status: file.isLoadingMedia ? "uploading" : "success",
3389
+ previewUrl: URL.createObjectURL(file),
3390
+ });
3391
+ });
3392
+ console.log("mediafiles", mediaFiles);
3393
+ return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsx(StyledThumbnailContainer$1, Object.assign({ className: "thumbnailContainer" }, { children: mediaFiles.map((file, index) => (jsxRuntime.jsx(Thumbnail, { src: file.previewUrl, label: file.fileName, index: index, showX: true, showLabel: false, mediaType: file.fileType, isLoadingMedia: file.status === "uploading", removeThumbnail: () => removeThumbnail(index), clickThumbnail: () => {
3394
+ openLightbox(thumbnails[index], index);
3318
3395
  } }, index))) })) }));
3319
3396
  };
3320
3397
 
@@ -3384,28 +3461,28 @@ Lightbox.Body = ModalBody; // Includes Main and Details
3384
3461
  Lightbox.Footer = Footer$3;
3385
3462
  Lightbox.Close = reactModals.Close;
3386
3463
 
3387
- var _path$n;
3388
- function _extends$r() { _extends$r = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$r.apply(this, arguments); }
3389
- const SvgChevronLeftStroke = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$r({
3464
+ var _path$m;
3465
+ function _extends$q() { _extends$q = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$q.apply(this, arguments); }
3466
+ const SvgChevronLeftStroke = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$q({
3390
3467
  xmlns: "http://www.w3.org/2000/svg",
3391
3468
  width: 16,
3392
3469
  height: 16,
3393
3470
  focusable: "false",
3394
3471
  viewBox: "0 0 16 16"
3395
- }, props), _path$n || (_path$n = /*#__PURE__*/React__namespace.createElement("path", {
3472
+ }, props), _path$m || (_path$m = /*#__PURE__*/React__namespace.createElement("path", {
3396
3473
  fill: "currentColor",
3397
3474
  d: "M10.39 12.688a.5.5 0 01-.718.69l-.062-.066-4-5a.5.5 0 01-.054-.542l.054-.082 4-5a.5.5 0 01.83.55l-.05.074L6.641 8l3.75 4.688z"
3398
3475
  })));
3399
3476
 
3400
- var _path$m;
3401
- function _extends$q() { _extends$q = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$q.apply(this, arguments); }
3402
- const SvgChevronRightStroke = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$q({
3477
+ var _path$l;
3478
+ function _extends$p() { _extends$p = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$p.apply(this, arguments); }
3479
+ const SvgChevronRightStroke = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$p({
3403
3480
  xmlns: "http://www.w3.org/2000/svg",
3404
3481
  width: 16,
3405
3482
  height: 16,
3406
3483
  focusable: "false",
3407
3484
  viewBox: "0 0 16 16"
3408
- }, props), _path$m || (_path$m = /*#__PURE__*/React__namespace.createElement("path", {
3485
+ }, props), _path$l || (_path$l = /*#__PURE__*/React__namespace.createElement("path", {
3409
3486
  fill: "currentColor",
3410
3487
  d: "M5.61 3.312a.5.5 0 01.718-.69l.062.066 4 5a.5.5 0 01.054.542l-.054.082-4 5a.5.5 0 01-.83-.55l.05-.074L9.359 8l-3.75-4.688z"
3411
3488
  })));
@@ -3663,19 +3740,6 @@ const PlayerTooltip = (_a) => {
3663
3740
  return (jsxRuntime.jsx(Wrapper$1, Object.assign({}, props, { children: jsxRuntime.jsx(Content$1, { children: children }) })));
3664
3741
  };
3665
3742
 
3666
- var _path$l;
3667
- function _extends$p() { _extends$p = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$p.apply(this, arguments); }
3668
- const SvgPlayFill = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$p({
3669
- xmlns: "http://www.w3.org/2000/svg",
3670
- width: 16,
3671
- height: 16,
3672
- focusable: "false",
3673
- viewBox: "0 0 16 16"
3674
- }, props), _path$l || (_path$l = /*#__PURE__*/React__namespace.createElement("path", {
3675
- fill: "currentColor",
3676
- d: "M6 15.79c-.13 0-.26-.03-.38-.08a.977.977 0 01-.62-.92V1.21a1 1 0 01.62-.93C6 .12 6.42.21 6.71.5l6.44 6.44c.58.58.58 1.54 0 2.12L6.71 15.5c-.19.19-.45.29-.71.29z"
3677
- })));
3678
-
3679
3743
  var _g$1;
3680
3744
  function _extends$o() { _extends$o = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$o.apply(this, arguments); }
3681
3745
  const SvgPauseFill = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$o({
@@ -4271,7 +4335,7 @@ const ChatBoxContainer = styled__default["default"].div `
4271
4335
  const CommentBox = (_a) => {
4272
4336
  var { placeholderOptions } = _a, props = __rest(_a, ["placeholderOptions"]);
4273
4337
  const { children, hasFloatingMenu, hasButtonsMenu, bubbleOptions, i18n } = props;
4274
- const { editor, setEditor, mentionableUsers, triggerSave, thumbnails, addThumbnails, removeThumbnail, } = useChatContext();
4338
+ const { editor, setEditor, mentionableUsers, triggerSave, thumbnails, addThumbnails } = useChatContext();
4275
4339
  const [isOpen, setIsOpen] = React.useState(false);
4276
4340
  const [selectedImage, setSelectedImage] = React.useState({});
4277
4341
  const [selectedImageIndex, setSelectedImageIndex] = React.useState(0);
@@ -4306,7 +4370,25 @@ const CommentBox = (_a) => {
4306
4370
  if (!event.dataTransfer || !event.dataTransfer.files)
4307
4371
  return false;
4308
4372
  event.preventDefault();
4309
- const files = Array.from(event.dataTransfer.files);
4373
+ const files = Array.from(event.dataTransfer.files).map((file) => {
4374
+ return Object.assign(file, { isLoadingMedia: false });
4375
+ });
4376
+ /*for (const f of files) {
4377
+ if (!/^(image|video)\//.test(f.type)) {
4378
+ addToast(
4379
+ ({ close }) => (
4380
+ <Notification
4381
+ onClose={close}
4382
+ type="error"
4383
+ message={"File type not supported"}
4384
+ closeText={"Close"}
4385
+ isPrimary
4386
+ />
4387
+ ),
4388
+ { placement: "top" }
4389
+ );
4390
+ }
4391
+ }*/
4310
4392
  const mediaFiles = files.filter((file) => /^(image|video)\//.test(file.type));
4311
4393
  if (mediaFiles.length === 0)
4312
4394
  return false;
@@ -4359,9 +4441,12 @@ const CommentBox = (_a) => {
4359
4441
  return null;
4360
4442
  ed.on("create", ({ editor }) => setEditor(editor));
4361
4443
  ed.on("update", ({ editor }) => setEditor(editor));
4362
- return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [isOpen && selectedImage && (jsxRuntime.jsxs(Lightbox, Object.assign({ onClose: closeLightbox }, { children: [jsxRuntime.jsx(Lightbox.Header, { children: selectedImage.name }), jsxRuntime.jsx(Lightbox.Body, { children: jsxRuntime.jsx(Lightbox.Body.Main, Object.assign({ style: { flex: 3 } }, { children: jsxRuntime.jsx(Slider, Object.assign({ prevArrow: jsxRuntime.jsx(Slider.PrevButton, { isBright: true }), nextArrow: jsxRuntime.jsx(Slider.NextButton, { isBright: true }), onSlideChange: slideChange, initialSlide: selectedImageIndex }, { children: thumbnails.map((item) => (jsxRuntime.jsxs(Slider.Slide, { children: [item.type.includes("image") && (jsxRuntime.jsx("img", { src: URL.createObjectURL(item), alt: `media ${item.name}` })), item.type.includes("video") && (jsxRuntime.jsx(Player, { ref: (ref) => {
4444
+ const mediaFiles = thumbnails.map((file) => {
4445
+ return Object.assign(file, { isLoadingMedia: file.isLoadingMedia });
4446
+ });
4447
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [isOpen && selectedImage && (jsxRuntime.jsxs(Lightbox, Object.assign({ onClose: closeLightbox }, { children: [jsxRuntime.jsx(Lightbox.Header, { children: selectedImage.name }), jsxRuntime.jsx(Lightbox.Body, { children: jsxRuntime.jsx(Lightbox.Body.Main, Object.assign({ style: { flex: 3 } }, { children: jsxRuntime.jsx(Slider, Object.assign({ prevArrow: jsxRuntime.jsx(Slider.PrevButton, { isBright: true }), nextArrow: jsxRuntime.jsx(Slider.NextButton, { isBright: true }), onSlideChange: slideChange, initialSlide: selectedImageIndex }, { children: mediaFiles.map((item, index) => (jsxRuntime.jsxs(Slider.Slide, { children: [item.type.includes("image") && (jsxRuntime.jsx("img", { src: URL.createObjectURL(thumbnails[index]), alt: `media ${item.name}` })), item.type.includes("video") && (jsxRuntime.jsx(Player, { ref: (ref) => {
4363
4448
  videoRefs.current.push(ref);
4364
- }, url: URL.createObjectURL(item) }))] }))) })) })) }), jsxRuntime.jsx(Lightbox.Close, { "aria-label": "Close modal" })] }))), jsxRuntime.jsx(ChatBoxContainer, { children: jsxRuntime.jsxs(EditorContainer$1, Object.assign({ editable: true, style: { marginLeft: 0, paddingBottom: 12 } }, { children: [hasFloatingMenu && (jsxRuntime.jsx(FloatingMenu, { editor: ed, tippyOptions: Object.assign({}, bubbleOptions) })), jsxRuntime.jsx(react.EditorContent, { editor: ed, onKeyDown: onKeyDown }), jsxRuntime.jsx(ThumbnailContainer, { openLightbox: handleOpenLightbox })] })) }), hasButtonsMenu && jsxRuntime.jsx(CommentBar, { editor: ed, i18n: i18n })] }));
4449
+ }, url: URL.createObjectURL(thumbnails[index]) }))] }))) })) })) }), jsxRuntime.jsx(Lightbox.Close, { "aria-label": "Close modal" })] }))), jsxRuntime.jsx(ChatBoxContainer, { children: jsxRuntime.jsxs(EditorContainer$1, Object.assign({ editable: true, style: { marginLeft: 0, paddingBottom: 12 } }, { children: [hasFloatingMenu && (jsxRuntime.jsx(FloatingMenu, { editor: ed, tippyOptions: Object.assign({}, bubbleOptions) })), jsxRuntime.jsx(react.EditorContent, { editor: ed, onKeyDown: onKeyDown }), jsxRuntime.jsx(ThumbnailContainer, { openLightbox: handleOpenLightbox })] })) }), hasButtonsMenu && jsxRuntime.jsx(CommentBar, { editor: ed, i18n: i18n })] }));
4365
4450
  };
4366
4451
 
4367
4452
  var _path$c;
@@ -4426,7 +4511,7 @@ const StyledThumbnailContainer = styled.styled.div `
4426
4511
  gap: 9px;
4427
4512
  background-color: inherit;
4428
4513
  margin-top: 10px;
4429
- height: 120px;
4514
+ height: auto;
4430
4515
  `;
4431
4516
  const Comment = ({ author, message, children, date, media = [], header, }) => {
4432
4517
  var _a, _b;
@@ -4463,7 +4548,7 @@ const Comment = ({ author, message, children, date, media = [], header, }) => {
4463
4548
  ed.setOptions({
4464
4549
  editable: false,
4465
4550
  });
4466
- return (jsxRuntime.jsxs(CommentCard, { children: [jsxRuntime.jsxs(AuthorContainer, { children: [jsxRuntime.jsx(Avatar, Object.assign({ avatarType: (_a = author.avatarType) !== null && _a !== void 0 ? _a : "text", style: { flexShrink: 0 } }, { children: author.avatar })), jsxRuntime.jsxs("div", { children: [jsxRuntime.jsxs(CommentTitle, { children: [(_b = author.name) !== null && _b !== void 0 ? _b : "User", jsxRuntime.jsx(CommentDate, { children: date })] }), jsxRuntime.jsx(ReadOnly, { children: jsxRuntime.jsx(EditorContainer$1, Object.assign({ editable: false }, { children: jsxRuntime.jsx(react.EditorContent, { editor: ed }) })) })] })] }), jsxRuntime.jsx(StyledThumbnailContainer, { children: media.map((item, index) => (jsxRuntime.jsx(Thumbnail, { src: item.url, label: "", showLabel: false, showX: false, mediaType: item.type, clickThumbnail: () => {
4551
+ return (jsxRuntime.jsxs(CommentCard, { children: [jsxRuntime.jsxs(AuthorContainer, { children: [jsxRuntime.jsx(Avatar, Object.assign({ avatarType: (_a = author.avatarType) !== null && _a !== void 0 ? _a : "text", style: { flexShrink: 0 } }, { children: author.avatar })), jsxRuntime.jsxs("div", { children: [jsxRuntime.jsxs(CommentTitle, { children: [(_b = author.name) !== null && _b !== void 0 ? _b : "User", jsxRuntime.jsx(CommentDate, { children: date })] }), jsxRuntime.jsx(ReadOnly, { children: jsxRuntime.jsx(EditorContainer$1, Object.assign({ editable: false }, { children: jsxRuntime.jsx(react.EditorContent, { editor: ed }) })) })] })] }), jsxRuntime.jsx(StyledThumbnailContainer, { children: media.map((item, index) => (jsxRuntime.jsx(Thumbnail, { isLoadingMedia: false, src: item.url, label: "", showLabel: false, showX: false, mediaType: item.type, clickThumbnail: () => {
4467
4552
  handleClickThumbnail(item, index);
4468
4553
  } }))) }), isOpen && selectedImage && (jsxRuntime.jsxs(Lightbox, Object.assign({ onClose: closeLightbox }, { children: [jsxRuntime.jsx(Lightbox.Header, { children: jsxRuntime.jsxs(reactTypography.MD, Object.assign({ isBold: true }, { children: [jsxRuntime.jsx(Grey600Span, { children: header && header.title }), header && header.message && (jsxRuntime.jsxs(Grey800Span, { children: [" | ", header.message] }))] })) }), jsxRuntime.jsxs(Lightbox.Body, { children: [jsxRuntime.jsx(Lightbox.Body.Main, Object.assign({ style: { flex: 2 } }, { children: jsxRuntime.jsx(Slider, Object.assign({ prevArrow: jsxRuntime.jsx(Slider.PrevButton, { isBright: true }), nextArrow: jsxRuntime.jsx(Slider.NextButton, { isBright: true }), onSlideChange: slideChange, initialSlide: selectedImageIndex }, { children: media.map((item, index) => (jsxRuntime.jsxs(Slider.Slide, { children: [item.type === "image" && (jsxRuntime.jsx("img", { src: item.url, alt: `{{${item.url}}}` })), item.type === "video" && (jsxRuntime.jsx(Player, { ref: (ref) => {
4469
4554
  videoRefs.current.push(ref);
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { ButtonArgs } from "./_types";
3
2
  export declare const Default: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0a347bb9").R, ButtonArgs>;
4
3
  export declare const Basic: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0a347bb9").R, ButtonArgs>;
@@ -8,18 +8,18 @@ export declare const variants: readonly [{}, {
8
8
  readonly disabled: true;
9
9
  }];
10
10
  export declare const Row: import("styled-components").IStyledComponent<"web", {
11
- alignItems?: "center" | "start" | "end" | "baseline" | "stretch" | undefined;
12
- alignItemsXs?: "center" | "start" | "end" | "baseline" | "stretch" | undefined;
13
- alignItemsSm?: "center" | "start" | "end" | "baseline" | "stretch" | undefined;
14
- alignItemsMd?: "center" | "start" | "end" | "baseline" | "stretch" | undefined;
15
- alignItemsLg?: "center" | "start" | "end" | "baseline" | "stretch" | undefined;
16
- alignItemsXl?: "center" | "start" | "end" | "baseline" | "stretch" | undefined;
17
- justifyContent?: "center" | "start" | "end" | "between" | "around" | undefined;
18
- justifyContentXs?: "center" | "start" | "end" | "between" | "around" | undefined;
19
- justifyContentSm?: "center" | "start" | "end" | "between" | "around" | undefined;
20
- justifyContentMd?: "center" | "start" | "end" | "between" | "around" | undefined;
21
- justifyContentLg?: "center" | "start" | "end" | "between" | "around" | undefined;
22
- justifyContentXl?: "center" | "start" | "end" | "between" | "around" | undefined;
11
+ alignItems?: "start" | "center" | "end" | "baseline" | "stretch" | undefined;
12
+ alignItemsXs?: "start" | "center" | "end" | "baseline" | "stretch" | undefined;
13
+ alignItemsSm?: "start" | "center" | "end" | "baseline" | "stretch" | undefined;
14
+ alignItemsMd?: "start" | "center" | "end" | "baseline" | "stretch" | undefined;
15
+ alignItemsLg?: "start" | "center" | "end" | "baseline" | "stretch" | undefined;
16
+ alignItemsXl?: "start" | "center" | "end" | "baseline" | "stretch" | undefined;
17
+ justifyContent?: "start" | "center" | "end" | "between" | "around" | undefined;
18
+ justifyContentXs?: "start" | "center" | "end" | "between" | "around" | undefined;
19
+ justifyContentSm?: "start" | "center" | "end" | "between" | "around" | undefined;
20
+ justifyContentMd?: "start" | "center" | "end" | "between" | "around" | undefined;
21
+ justifyContentLg?: "start" | "center" | "end" | "between" | "around" | undefined;
22
+ justifyContentXl?: "start" | "center" | "end" | "between" | "around" | undefined;
23
23
  wrap?: "wrap" | "nowrap" | "wrap-reverse" | undefined;
24
24
  wrapXs?: "wrap" | "nowrap" | "wrap-reverse" | undefined;
25
25
  wrapSm?: "wrap" | "nowrap" | "wrap-reverse" | undefined;
@@ -73,7 +73,7 @@ export declare const Row: import("styled-components").IStyledComponent<"web", {
73
73
  results?: number | undefined;
74
74
  security?: string | undefined;
75
75
  unselectable?: "on" | "off" | undefined;
76
- inputMode?: "none" | "search" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined;
76
+ inputMode?: "decimal" | "none" | "search" | "text" | "tel" | "url" | "email" | "numeric" | undefined;
77
77
  is?: string | undefined;
78
78
  "aria-activedescendant"?: string | undefined;
79
79
  "aria-atomic"?: (boolean | "true" | "false") | undefined;
@@ -299,18 +299,18 @@ export declare const Col: import("styled-components").IStyledComponent<"web", {
299
299
  md?: string | number | boolean | undefined;
300
300
  lg?: string | number | boolean | undefined;
301
301
  xl?: string | number | boolean | undefined;
302
- alignSelf?: "center" | "start" | "end" | "baseline" | "stretch" | "auto" | undefined;
303
- alignSelfXs?: "center" | "start" | "end" | "baseline" | "stretch" | "auto" | undefined;
304
- alignSelfSm?: "center" | "start" | "end" | "baseline" | "stretch" | "auto" | undefined;
305
- alignSelfMd?: "center" | "start" | "end" | "baseline" | "stretch" | "auto" | undefined;
306
- alignSelfLg?: "center" | "start" | "end" | "baseline" | "stretch" | "auto" | undefined;
307
- alignSelfXl?: "center" | "start" | "end" | "baseline" | "stretch" | "auto" | undefined;
308
- textAlign?: "center" | "start" | "end" | "justify" | undefined;
309
- textAlignXs?: "center" | "start" | "end" | "justify" | undefined;
310
- textAlignSm?: "center" | "start" | "end" | "justify" | undefined;
311
- textAlignMd?: "center" | "start" | "end" | "justify" | undefined;
312
- textAlignLg?: "center" | "start" | "end" | "justify" | undefined;
313
- textAlignXl?: "center" | "start" | "end" | "justify" | undefined;
302
+ alignSelf?: "start" | "center" | "end" | "baseline" | "stretch" | "auto" | undefined;
303
+ alignSelfXs?: "start" | "center" | "end" | "baseline" | "stretch" | "auto" | undefined;
304
+ alignSelfSm?: "start" | "center" | "end" | "baseline" | "stretch" | "auto" | undefined;
305
+ alignSelfMd?: "start" | "center" | "end" | "baseline" | "stretch" | "auto" | undefined;
306
+ alignSelfLg?: "start" | "center" | "end" | "baseline" | "stretch" | "auto" | undefined;
307
+ alignSelfXl?: "start" | "center" | "end" | "baseline" | "stretch" | "auto" | undefined;
308
+ textAlign?: "start" | "center" | "end" | "justify" | undefined;
309
+ textAlignXs?: "start" | "center" | "end" | "justify" | undefined;
310
+ textAlignSm?: "start" | "center" | "end" | "justify" | undefined;
311
+ textAlignMd?: "start" | "center" | "end" | "justify" | undefined;
312
+ textAlignLg?: "start" | "center" | "end" | "justify" | undefined;
313
+ textAlignXl?: "start" | "center" | "end" | "justify" | undefined;
314
314
  offset?: string | number | undefined;
315
315
  offsetXs?: string | number | undefined;
316
316
  offsetSm?: string | number | undefined;
@@ -370,7 +370,7 @@ export declare const Col: import("styled-components").IStyledComponent<"web", {
370
370
  results?: number | undefined;
371
371
  security?: string | undefined;
372
372
  unselectable?: "on" | "off" | undefined;
373
- inputMode?: "none" | "search" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined;
373
+ inputMode?: "decimal" | "none" | "search" | "text" | "tel" | "url" | "email" | "numeric" | undefined;
374
374
  is?: string | undefined;
375
375
  "aria-activedescendant"?: string | undefined;
376
376
  "aria-atomic"?: (boolean | "true" | "false") | undefined;
@@ -640,7 +640,7 @@ export declare const MD: import("styled-components").IStyledComponent<"web", {
640
640
  results?: number | undefined;
641
641
  security?: string | undefined;
642
642
  unselectable?: "on" | "off" | undefined;
643
- inputMode?: "none" | "search" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined;
643
+ inputMode?: "decimal" | "none" | "search" | "text" | "tel" | "url" | "email" | "numeric" | undefined;
644
644
  is?: string | undefined;
645
645
  "aria-activedescendant"?: string | undefined;
646
646
  "aria-atomic"?: (boolean | "true" | "false") | undefined;
@@ -10,6 +10,7 @@ export type SuggestedUser = {
10
10
  export interface ChatEditorArgs extends Partial<EditorOptions> {
11
11
  placeholderOptions?: Partial<PlaceholderOptions>;
12
12
  hasFloatingMenu?: boolean;
13
+ isNewMedia: boolean;
13
14
  hasButtonsMenu?: boolean;
14
15
  bubbleOptions?: any;
15
16
  author: Author;
@@ -6,18 +6,25 @@ export type ChatContextType = {
6
6
  editor?: Editor;
7
7
  setEditor: React.Dispatch<React.SetStateAction<Editor | undefined>>;
8
8
  addThumbnails: (props: {
9
- files: File[];
9
+ files: (File & {
10
+ isLoadingMedia: boolean;
11
+ })[];
10
12
  }) => void;
11
13
  removeThumbnail: (index: number) => void;
12
- thumbnails: File[];
14
+ thumbnails: (File & {
15
+ isLoadingMedia: boolean;
16
+ })[];
13
17
  mentionableUsers: (props: {
14
18
  query: string;
15
19
  }) => SuggestedUser[];
20
+ afterUploadCallback: (failed: string[]) => void;
16
21
  };
17
22
  export declare const ChatContext: React.Context<ChatContextType | null>;
18
23
  export declare const ChatContextProvider: ({ onSave, onFileUpload, setMentionableUsers, children, }: {
19
24
  onSave?: ((editor: Editor, mentions: SuggestedUser[]) => void) | undefined;
20
- onFileUpload?: ((files: File[]) => Promise<void>) | undefined;
25
+ onFileUpload?: ((files: (File & {
26
+ isLoadingMedia: boolean;
27
+ })[]) => Promise<void>) | undefined;
21
28
  children: React.ReactNode;
22
29
  setMentionableUsers: (props: {
23
30
  query: string;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { PlaceholderOptions } from "@tiptap/extension-placeholder";
3
2
  import { Editor as TipTapEditor } from "@tiptap/react";
4
3
  import { ChatEditorArgs, SuggestedUser } from "./_types";
@@ -7,6 +7,7 @@ interface Props {
7
7
  showX?: boolean;
8
8
  showLabel?: boolean;
9
9
  mediaType: string;
10
+ isLoadingMedia: boolean;
10
11
  }
11
- declare const Thumbnail: ({ clickThumbnail, src, label, index, removeThumbnail, showX, showLabel, mediaType, }: Props) => import("react/jsx-runtime").JSX.Element;
12
+ declare const Thumbnail: ({ clickThumbnail, src, label, index, removeThumbnail, showX, showLabel, mediaType, isLoadingMedia, }: Props) => import("react/jsx-runtime").JSX.Element;
12
13
  export default Thumbnail;
@@ -1,3 +1,10 @@
1
+ export interface FileElement {
2
+ fileName: string;
3
+ fileType: string;
4
+ status: "success" | "failed" | "uploading";
5
+ errorCode?: "FILE_TOO_BIG" | "INVALID_FILE_EXTENSION" | "GENERIC_ERROR";
6
+ previewUrl: string;
7
+ }
1
8
  interface Props {
2
9
  openLightbox: (file: File, index: number) => void;
3
10
  }
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { DropdownArgs, SelectArgs } from "./_types";
3
2
  import { MenuArgs } from "../menu/_types";
4
3
  interface IItem {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { EditorArgs } from "./_types";
3
2
  interface EditorStoryArgs extends EditorArgs {
4
3
  children?: any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appquality/unguess-design-system",
3
- "version": "3.1.84-beta-attachments",
3
+ "version": "3.1.86-beta-attachments",
4
4
  "description": "",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",