@appquality/unguess-design-system 3.1.84-beta-attachments → 3.1.85-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,22 @@ const ChatContextProvider = ({ onSave, onFileUpload, setMentionableUsers, childr
2335
2336
  editor,
2336
2337
  setEditor,
2337
2338
  thumbnails,
2338
- addThumbnails: ({ files }) => {
2339
+ setMediaStatus: (files, index) => {
2340
+ files[index].isLoadingMedia = false;
2341
+ },
2342
+ //isMediaUploading, // Incluso nel valore del contesto
2343
+ //setIsMediaUploading, // Incluso nel valore del contesto
2344
+ addThumbnails: ({ files, }) => {
2339
2345
  onFileUpload && onFileUpload(files);
2346
+ /* const media = files.map((file) => ({
2347
+ ...file,
2348
+ isLoadingMedia: false,
2349
+ }));
2350
+ media[0].isLoadingMedia = false;*/
2351
+ //setIsMediaUploading(true);
2352
+ files.forEach((file) => (file.isLoadingMedia = true));
2340
2353
  setThumbnails((prev) => [...prev, ...files]);
2354
+ //setIsMediaUploading(false);
2341
2355
  },
2342
2356
  removeThumbnail: (index) => setThumbnails(thumbnails.filter((_, i) => i !== index)),
2343
2357
  triggerSave: () => {
@@ -2356,7 +2370,10 @@ const ChatContextProvider = ({ onSave, onFileUpload, setMentionableUsers, childr
2356
2370
  thumbnails,
2357
2371
  setThumbnails,
2358
2372
  onFileUpload,
2373
+ //setIsMediaUploading,
2374
+ //isMediaUploading,
2359
2375
  ]);
2376
+ console.log("thumbnails: ", thumbnails);
2360
2377
  return (jsxRuntime.jsx(ChatContext.Provider, Object.assign({ value: chatContextValue }, { children: children })));
2361
2378
  };
2362
2379
  const useChatContext = () => {
@@ -2981,7 +2998,9 @@ const CommentBar = ({ editor, i18n, }) => {
2981
2998
  fileInput.onchange = () => {
2982
2999
  const files = fileInput.files;
2983
3000
  if (files) {
2984
- const mediaFiles = Array.from(files);
3001
+ const mediaFiles = Array.from(files).map((file) => {
3002
+ return Object.assign(file, { isLoadingMedia: false });
3003
+ });
2985
3004
  if (mediaFiles.length === 0)
2986
3005
  return;
2987
3006
  addThumbnails({ files: mediaFiles });
@@ -3261,6 +3280,19 @@ const DeleteThumbnailX = ({ content, deleteThumbnail }) => {
3261
3280
  return (jsxRuntime.jsx(StyledDeleteThumbnailX, Object.assign({ className: "deleteThumbnail", onClick: (e) => deleteThumbnail(e) }, { children: jsxRuntime.jsx("span", { children: content }) })));
3262
3281
  };
3263
3282
 
3283
+ var _path$n;
3284
+ 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); }
3285
+ const SvgPlayFill = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$r({
3286
+ xmlns: "http://www.w3.org/2000/svg",
3287
+ width: 16,
3288
+ height: 16,
3289
+ focusable: "false",
3290
+ viewBox: "0 0 16 16"
3291
+ }, props), _path$n || (_path$n = /*#__PURE__*/React__namespace.createElement("path", {
3292
+ fill: "currentColor",
3293
+ 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"
3294
+ })));
3295
+
3264
3296
  const StyledThumbnail = styled__default["default"].div `
3265
3297
  border-radius: 4%;
3266
3298
  height: 90px;
@@ -3284,13 +3316,29 @@ const StyledThumbnail = styled__default["default"].div `
3284
3316
  font-weight: 100;
3285
3317
  }
3286
3318
  `;
3287
- const Thumbnail = ({ clickThumbnail, src, label, index = 0, removeThumbnail, showX = true, showLabel = false, mediaType, }) => {
3319
+ const Thumbnail = ({ clickThumbnail, src, label, index = 0, removeThumbnail, showX = true, showLabel = false, mediaType, isLoadingMedia = false, }) => {
3320
+ //const { isMediaUploading, setIsMediaUploading } = useChatContext();
3288
3321
  const handleCancel = (e) => {
3289
3322
  e.stopPropagation();
3290
3323
  if (removeThumbnail)
3291
3324
  removeThumbnail(index);
3292
3325
  };
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 }))] })));
3326
+ 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: {
3327
+ width: "100%",
3328
+ height: "100%",
3329
+ backgroundColor: "gray",
3330
+ zIndex: "-1",
3331
+ opacity: "0.5",
3332
+ color: "black",
3333
+ } }, { children: [jsxRuntime.jsx(SvgPlayFill, { style: {
3334
+ position: "absolute",
3335
+ top: "35%",
3336
+ left: "35%",
3337
+ width: "30px",
3338
+ height: "30px",
3339
+ backgroundColor: "white",
3340
+ borderRadius: "50%",
3341
+ } }), 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
3342
  };
3295
3343
 
3296
3344
  const StyledThumbnailContainer$1 = styled.styled.div `
@@ -3313,8 +3361,27 @@ const ThumbnailContainer = ({ openLightbox }) => {
3313
3361
  if (!thumbnails || thumbnails.length === 0) {
3314
3362
  return null;
3315
3363
  }
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);
3364
+ /* const mediaFiles: File[] = thumbnails.map((file) => {
3365
+ // Crea un nuovo oggetto File senza la proprietà isLoadingMedia
3366
+ const blob = new Blob([file], { type: file.type });
3367
+
3368
+ // Creiamo un nuovo File utilizzando il Blob e mantenendo il nome del file originale
3369
+ const nf = new File([blob], file.name, { type: file.type });
3370
+
3371
+ return nf;
3372
+ });*/
3373
+ const mediaFiles = [];
3374
+ thumbnails.forEach((file) => {
3375
+ mediaFiles.push({
3376
+ fileName: file.name,
3377
+ fileType: file.type,
3378
+ status: file.isLoadingMedia ? "uploading" : "success",
3379
+ previewUrl: URL.createObjectURL(file),
3380
+ });
3381
+ });
3382
+ console.log("mediafiles", mediaFiles);
3383
+ 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: () => {
3384
+ openLightbox(thumbnails[index], index);
3318
3385
  } }, index))) })) }));
3319
3386
  };
3320
3387
 
@@ -3384,28 +3451,28 @@ Lightbox.Body = ModalBody; // Includes Main and Details
3384
3451
  Lightbox.Footer = Footer$3;
3385
3452
  Lightbox.Close = reactModals.Close;
3386
3453
 
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({
3454
+ var _path$m;
3455
+ 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); }
3456
+ const SvgChevronLeftStroke = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$q({
3390
3457
  xmlns: "http://www.w3.org/2000/svg",
3391
3458
  width: 16,
3392
3459
  height: 16,
3393
3460
  focusable: "false",
3394
3461
  viewBox: "0 0 16 16"
3395
- }, props), _path$n || (_path$n = /*#__PURE__*/React__namespace.createElement("path", {
3462
+ }, props), _path$m || (_path$m = /*#__PURE__*/React__namespace.createElement("path", {
3396
3463
  fill: "currentColor",
3397
3464
  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
3465
  })));
3399
3466
 
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({
3467
+ var _path$l;
3468
+ 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); }
3469
+ const SvgChevronRightStroke = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$p({
3403
3470
  xmlns: "http://www.w3.org/2000/svg",
3404
3471
  width: 16,
3405
3472
  height: 16,
3406
3473
  focusable: "false",
3407
3474
  viewBox: "0 0 16 16"
3408
- }, props), _path$m || (_path$m = /*#__PURE__*/React__namespace.createElement("path", {
3475
+ }, props), _path$l || (_path$l = /*#__PURE__*/React__namespace.createElement("path", {
3409
3476
  fill: "currentColor",
3410
3477
  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
3478
  })));
@@ -3663,19 +3730,6 @@ const PlayerTooltip = (_a) => {
3663
3730
  return (jsxRuntime.jsx(Wrapper$1, Object.assign({}, props, { children: jsxRuntime.jsx(Content$1, { children: children }) })));
3664
3731
  };
3665
3732
 
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
3733
  var _g$1;
3680
3734
  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
3735
  const SvgPauseFill = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$o({
@@ -4271,7 +4325,9 @@ const ChatBoxContainer = styled__default["default"].div `
4271
4325
  const CommentBox = (_a) => {
4272
4326
  var { placeholderOptions } = _a, props = __rest(_a, ["placeholderOptions"]);
4273
4327
  const { children, hasFloatingMenu, hasButtonsMenu, bubbleOptions, i18n } = props;
4274
- const { editor, setEditor, mentionableUsers, triggerSave, thumbnails, addThumbnails, removeThumbnail, } = useChatContext();
4328
+ const { editor, setEditor, mentionableUsers, triggerSave, thumbnails, addThumbnails, removeThumbnail, setMediaStatus,
4329
+ //setIsMediaUploading,
4330
+ } = useChatContext();
4275
4331
  const [isOpen, setIsOpen] = React.useState(false);
4276
4332
  const [selectedImage, setSelectedImage] = React.useState({});
4277
4333
  const [selectedImageIndex, setSelectedImageIndex] = React.useState(0);
@@ -4306,7 +4362,25 @@ const CommentBox = (_a) => {
4306
4362
  if (!event.dataTransfer || !event.dataTransfer.files)
4307
4363
  return false;
4308
4364
  event.preventDefault();
4309
- const files = Array.from(event.dataTransfer.files);
4365
+ const files = Array.from(event.dataTransfer.files).map((file) => {
4366
+ return Object.assign(file, { isLoadingMedia: false });
4367
+ });
4368
+ /*for (const f of files) {
4369
+ if (!/^(image|video)\//.test(f.type)) {
4370
+ addToast(
4371
+ ({ close }) => (
4372
+ <Notification
4373
+ onClose={close}
4374
+ type="error"
4375
+ message={"File type not supported"}
4376
+ closeText={"Close"}
4377
+ isPrimary
4378
+ />
4379
+ ),
4380
+ { placement: "top" }
4381
+ );
4382
+ }
4383
+ }*/
4310
4384
  const mediaFiles = files.filter((file) => /^(image|video)\//.test(file.type));
4311
4385
  if (mediaFiles.length === 0)
4312
4386
  return false;
@@ -4359,9 +4433,12 @@ const CommentBox = (_a) => {
4359
4433
  return null;
4360
4434
  ed.on("create", ({ editor }) => setEditor(editor));
4361
4435
  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) => {
4436
+ const mediaFiles = thumbnails.map((file) => {
4437
+ return Object.assign(file, { isLoadingMedia: file.isLoadingMedia });
4438
+ });
4439
+ 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
4440
  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 })] }));
4441
+ }, 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
4442
  };
4366
4443
 
4367
4444
  var _path$c;
@@ -4426,7 +4503,7 @@ const StyledThumbnailContainer = styled.styled.div `
4426
4503
  gap: 9px;
4427
4504
  background-color: inherit;
4428
4505
  margin-top: 10px;
4429
- height: 120px;
4506
+ height: auto;
4430
4507
  `;
4431
4508
  const Comment = ({ author, message, children, date, media = [], header, }) => {
4432
4509
  var _a, _b;
@@ -4463,7 +4540,7 @@ const Comment = ({ author, message, children, date, media = [], header, }) => {
4463
4540
  ed.setOptions({
4464
4541
  editable: false,
4465
4542
  });
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: () => {
4543
+ 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
4544
  handleClickThumbnail(item, index);
4468
4545
  } }))) }), 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
4546
  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,27 @@ 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
+ setMediaStatus: (files: (File & {
21
+ isLoadingMedia: boolean;
22
+ })[], index: number) => void;
16
23
  };
17
24
  export declare const ChatContext: React.Context<ChatContextType | null>;
18
25
  export declare const ChatContextProvider: ({ onSave, onFileUpload, setMentionableUsers, children, }: {
19
26
  onSave?: ((editor: Editor, mentions: SuggestedUser[]) => void) | undefined;
20
- onFileUpload?: ((files: File[]) => Promise<void>) | undefined;
27
+ onFileUpload?: ((files: (File & {
28
+ isLoadingMedia: boolean;
29
+ })[]) => Promise<void>) | undefined;
21
30
  children: React.ReactNode;
22
31
  setMentionableUsers: (props: {
23
32
  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.85-beta-attachments",
4
4
  "description": "",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",