@carlonicora/nextjs-jsonapi 3.5.7 → 3.5.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/dist/{BlockNoteEditor-PZ5HOXFK.mjs → BlockNoteEditor-5LH6CCQF.mjs} +2 -2
  2. package/dist/{BlockNoteEditor-JSZ2YZVY.js → BlockNoteEditor-J27BAKEF.js} +9 -9
  3. package/dist/{BlockNoteEditor-JSZ2YZVY.js.map → BlockNoteEditor-J27BAKEF.js.map} +1 -1
  4. package/dist/billing/index.js +333 -333
  5. package/dist/billing/index.mjs +1 -1
  6. package/dist/{chunk-N73QMKQU.js → chunk-G2PQN6HK.js} +292 -202
  7. package/dist/chunk-G2PQN6HK.js.map +1 -0
  8. package/dist/{chunk-C7I6YFTA.mjs → chunk-Q2QO5XYN.mjs} +99 -9
  9. package/dist/chunk-Q2QO5XYN.mjs.map +1 -0
  10. package/dist/client/index.js +2 -2
  11. package/dist/client/index.mjs +1 -1
  12. package/dist/components/index.d.mts +21 -1
  13. package/dist/components/index.d.ts +21 -1
  14. package/dist/components/index.js +4 -2
  15. package/dist/components/index.js.map +1 -1
  16. package/dist/components/index.mjs +3 -1
  17. package/dist/contexts/index.js +2 -2
  18. package/dist/contexts/index.mjs +1 -1
  19. package/dist/features/help/index.js +31 -31
  20. package/dist/features/help/index.mjs +1 -1
  21. package/dist/features/tokenusage/index.js +75 -75
  22. package/dist/features/tokenusage/index.mjs +1 -1
  23. package/package.json +1 -1
  24. package/src/components/forms/EditorSheet.tsx +16 -5
  25. package/src/components/forms/FileUploader.tsx +18 -2
  26. package/src/components/forms/MultiFileUploader.tsx +23 -5
  27. package/src/components/forms/index.ts +1 -1
  28. package/dist/chunk-C7I6YFTA.mjs.map +0 -1
  29. package/dist/chunk-N73QMKQU.js.map +0 -1
  30. /package/dist/{BlockNoteEditor-PZ5HOXFK.mjs.map → BlockNoteEditor-5LH6CCQF.mjs.map} +0 -0
@@ -9638,12 +9638,13 @@ function resolveTriggerIsNativeButton(trigger) {
9638
9638
  return true;
9639
9639
  }
9640
9640
  __name(resolveTriggerIsNativeButton, "resolveTriggerIsNativeButton");
9641
+ var fullWidthOnMobile = "data-[side=right]:w-full data-[side=left]:w-full";
9641
9642
  var sizeClasses = {
9642
- sm: "data-[side=right]:sm:max-w-2xl data-[side=left]:sm:max-w-2xl",
9643
- md: "data-[side=right]:sm:max-w-3xl data-[side=left]:sm:max-w-3xl",
9644
- lg: "data-[side=right]:sm:max-w-5xl data-[side=left]:sm:max-w-5xl",
9645
- xl: "data-[side=right]:sm:max-w-7xl data-[side=left]:sm:max-w-7xl",
9646
- "2xl": "data-[side=right]:sm:!max-w-[min(96rem,90vw)] data-[side=left]:sm:!max-w-[min(96rem,90vw)]"
9643
+ sm: `${fullWidthOnMobile} data-[side=right]:sm:max-w-2xl data-[side=left]:sm:max-w-2xl`,
9644
+ md: `${fullWidthOnMobile} data-[side=right]:sm:max-w-3xl data-[side=left]:sm:max-w-3xl`,
9645
+ lg: `${fullWidthOnMobile} data-[side=right]:sm:max-w-5xl data-[side=left]:sm:max-w-5xl`,
9646
+ xl: `${fullWidthOnMobile} data-[side=right]:sm:max-w-7xl data-[side=left]:sm:max-w-7xl`,
9647
+ "2xl": `${fullWidthOnMobile} data-[side=right]:sm:!max-w-[min(96rem,90vw)] data-[side=left]:sm:!max-w-[min(96rem,90vw)]`
9647
9648
  };
9648
9649
  function EditorSheet({
9649
9650
  form,
@@ -10045,9 +10046,21 @@ var FileUploader = forwardRef6(
10045
10046
  );
10046
10047
  const handleKeyDown = useCallback18(
10047
10048
  (e) => {
10049
+ if (!value) return;
10050
+ const handledKeys = [
10051
+ "ArrowLeft",
10052
+ "ArrowRight",
10053
+ "ArrowUp",
10054
+ "ArrowDown",
10055
+ "Enter",
10056
+ "Space",
10057
+ "Delete",
10058
+ "Backspace",
10059
+ "Escape"
10060
+ ];
10061
+ if (!handledKeys.includes(e.key)) return;
10048
10062
  e.preventDefault();
10049
10063
  e.stopPropagation();
10050
- if (!value) return;
10051
10064
  const moveNext = /* @__PURE__ */ __name(() => {
10052
10065
  const nextIndex = activeIndex + 1;
10053
10066
  setActiveIndex(nextIndex > value.length - 1 ? 0 : nextIndex);
@@ -10314,7 +10327,7 @@ import { useRef as useRef17 } from "react";
10314
10327
  import dynamic from "next/dynamic";
10315
10328
  import React18 from "react";
10316
10329
  import { jsx as jsx89 } from "react/jsx-runtime";
10317
- var BlockNoteEditor = dynamic(() => import("./BlockNoteEditor-PZ5HOXFK.mjs"), {
10330
+ var BlockNoteEditor = dynamic(() => import("./BlockNoteEditor-5LH6CCQF.mjs"), {
10318
10331
  ssr: false
10319
10332
  });
10320
10333
  var BlockNoteEditorContainer = React18.memo(/* @__PURE__ */ __name(function EditorContainer(props) {
@@ -11376,13 +11389,89 @@ import Image3 from "next/image";
11376
11389
  import { useEffect as useEffect21, useState as useState29 } from "react";
11377
11390
  import { jsx as jsx104, jsxs as jsxs62 } from "react/jsx-runtime";
11378
11391
  var dropzone = {
11379
- multiple: false,
11380
11392
  maxSize: 100 * 1024 * 1024,
11381
11393
  preventDropOnDocument: false,
11382
11394
  accept: {
11383
11395
  "application/images": [".jpg", ".jpeg", ".png", ".gif", ".webp", ".svg", ".docx", ".xslx", ".pdf", ".txt", ".md"]
11384
11396
  }
11385
11397
  };
11398
+ function MultiFileUploader({ files, setFiles, multiple = false, className }) {
11399
+ const uploadFiles = /* @__PURE__ */ __name((newFiles) => {
11400
+ if (!newFiles) return;
11401
+ setFiles([...files, ...newFiles]);
11402
+ }, "uploadFiles");
11403
+ const handleRemoveFile = /* @__PURE__ */ __name((indexToRemove) => {
11404
+ setFiles(files.filter((_, index) => index !== indexToRemove));
11405
+ }, "handleRemoveFile");
11406
+ return /* @__PURE__ */ jsxs62(
11407
+ "div",
11408
+ {
11409
+ className: cn(
11410
+ "grid w-full grid-cols-1 gap-4 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 2xl:grid-cols-6",
11411
+ className
11412
+ ),
11413
+ children: [
11414
+ /* @__PURE__ */ jsx104(
11415
+ FileUploader,
11416
+ {
11417
+ value: files,
11418
+ onValueChange: uploadFiles,
11419
+ dropzoneOptions: { ...dropzone, multiple },
11420
+ className: "text-muted-foreground hover:text-primary relative aspect-square h-full cursor-pointer overflow-hidden rounded-lg border",
11421
+ children: /* @__PURE__ */ jsx104(FileInput, { className: cn("text-muted-foreground flex h-full w-full flex-col items-center justify-center"), children: /* @__PURE__ */ jsx104(UploadIcon2, { className: "my-4 h-8 w-8" }) })
11422
+ }
11423
+ ),
11424
+ files.map((file, index) => /* @__PURE__ */ jsx104(FilePreviewItem, { file, onRemoveClick: () => handleRemoveFile(index) }, file.name + "-" + index))
11425
+ ]
11426
+ }
11427
+ );
11428
+ }
11429
+ __name(MultiFileUploader, "MultiFileUploader");
11430
+ var FilePreviewItem = /* @__PURE__ */ __name(({ file, onRemoveClick }) => {
11431
+ const [objectUrl, setObjectUrl] = useState29(null);
11432
+ useEffect21(() => {
11433
+ if (file.type.startsWith("image/")) {
11434
+ const url = URL.createObjectURL(file);
11435
+ setObjectUrl(url);
11436
+ return () => URL.revokeObjectURL(url);
11437
+ }
11438
+ setObjectUrl(null);
11439
+ }, [file]);
11440
+ const getFileIcon = /* @__PURE__ */ __name(() => {
11441
+ const extension = file.name.split(".").pop()?.toLowerCase();
11442
+ if (file.type.startsWith("image/")) {
11443
+ return /* @__PURE__ */ jsx104(FileImageIcon, { className: "text-muted h-10 w-10 sm:h-12 sm:w-12" });
11444
+ }
11445
+ if (file.type === "application/pdf") {
11446
+ return /* @__PURE__ */ jsx104(FileTextIcon, { className: "text-destructive h-10 w-10 sm:h-12 sm:w-12" });
11447
+ }
11448
+ if (file.type.includes("wordprocessingml") || extension === "docx" || extension === "doc") {
11449
+ return /* @__PURE__ */ jsx104(FileTextIcon, { className: "text-primary h-10 w-10 sm:h-12 sm:w-12" });
11450
+ }
11451
+ if (file.type.includes("spreadsheetml") || extension === "xlsx" || extension === "xls") {
11452
+ return /* @__PURE__ */ jsx104(FileSpreadsheetIcon, { className: "text-secondary h-10 w-10 sm:h-12 sm:w-12" });
11453
+ }
11454
+ if (file.type.startsWith("text/")) {
11455
+ return /* @__PURE__ */ jsx104(FileTextIcon, { className: "h-10 w-10 sm:h-12 sm:w-12" });
11456
+ }
11457
+ return /* @__PURE__ */ jsx104(FileIcon, { className: "text-muted h-10 w-10 sm:h-12 sm:w-12" });
11458
+ }, "getFileIcon");
11459
+ return /* @__PURE__ */ jsxs62("div", { className: "text-muted-foreground group relative aspect-square h-full overflow-hidden rounded-lg border", children: [
11460
+ /* @__PURE__ */ jsx104(
11461
+ "button",
11462
+ {
11463
+ onClick: onRemoveClick,
11464
+ className: "absolute top-1.5 end-1.5 z-20 rounded-full bg-black/60 p-1 text-white opacity-0 transition-all duration-200 ease-in-out group-hover:opacity-100 hover:bg-red-600 focus:outline-none",
11465
+ "aria-label": "Remove file",
11466
+ children: /* @__PURE__ */ jsx104(XIcon7, { className: "h-3.5 w-3.5" })
11467
+ }
11468
+ ),
11469
+ objectUrl ? /* @__PURE__ */ jsx104(Image3, { src: objectUrl, alt: file.name, className: "h-full w-full object-cover", width: 200, height: 200 }) : /* @__PURE__ */ jsxs62("div", { className: "bg-muted/30 flex h-full w-full flex-col items-center justify-center p-2", children: [
11470
+ getFileIcon(),
11471
+ /* @__PURE__ */ jsx104("span", { className: "text-foreground/80 mt-2 w-full truncate px-1 text-center text-xs sm:text-xs", children: file.name })
11472
+ ] })
11473
+ ] });
11474
+ }, "FilePreviewItem");
11386
11475
 
11387
11476
  // src/features/user/components/widgets/UserAvatar.tsx
11388
11477
  import { jsx as jsx105, jsxs as jsxs63 } from "react/jsx-runtime";
@@ -25372,6 +25461,7 @@ export {
25372
25461
  FormSwitch,
25373
25462
  FormTextarea,
25374
25463
  GdprConsentCheckbox,
25464
+ MultiFileUploader,
25375
25465
  PageContainerContentDetails,
25376
25466
  PageContentContainer,
25377
25467
  cellComponent,
@@ -25541,4 +25631,4 @@ export {
25541
25631
  useOAuthClients,
25542
25632
  useOAuthClient
25543
25633
  };
25544
- //# sourceMappingURL=chunk-C7I6YFTA.mjs.map
25634
+ //# sourceMappingURL=chunk-Q2QO5XYN.mjs.map