@carlonicora/nextjs-jsonapi 3.5.7 → 3.5.9

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-5AQQQQY3.mjs} +2 -2
  2. package/dist/{BlockNoteEditor-JSZ2YZVY.js → BlockNoteEditor-EWMWY4SK.js} +9 -9
  3. package/dist/{BlockNoteEditor-JSZ2YZVY.js.map → BlockNoteEditor-EWMWY4SK.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-EJIWXCXI.js} +319 -213
  7. package/dist/chunk-EJIWXCXI.js.map +1 -0
  8. package/dist/{chunk-C7I6YFTA.mjs → chunk-OE2WEAPU.mjs} +126 -20
  9. package/dist/chunk-OE2WEAPU.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 +44 -22
  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-5AQQQQY3.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,
@@ -9745,17 +9746,33 @@ function EditorSheet({
9745
9746
  // is resolved per trigger rather than hardcoded (a constant `false`
9746
9747
  // warned on every native-button trigger).
9747
9748
  /* @__PURE__ */ jsx86(SheetTrigger, { nativeButton: resolveTriggerIsNativeButton(trigger), render: trigger })
9748
- ) : /* @__PURE__ */ jsx86(SheetTrigger, { children: isEdit ? /* @__PURE__ */ jsx86(
9749
- Button,
9750
- {
9751
- render: /* @__PURE__ */ jsx86("div", {}),
9752
- nativeButton: false,
9753
- size: "sm",
9754
- variant: "ghost",
9755
- className: "text-muted-foreground",
9756
- children: /* @__PURE__ */ jsx86(PencilIcon3, {})
9757
- }
9758
- ) : /* @__PURE__ */ jsx86(Button, { render: /* @__PURE__ */ jsx86("div", {}), nativeButton: false, size: "sm", variant: "outline", children: t("ui.buttons.create") }) })),
9749
+ ) : (
9750
+ // The default trigger goes through `render` for the SAME reason the
9751
+ // caller-supplied one above does. As CHILDREN, the Button rendered a
9752
+ // second `role="button"` inside SheetTrigger's own button: two nodes
9753
+ // with one accessible name, which a screen reader announces as a
9754
+ // button inside a button and which makes
9755
+ // `getByRole("button", { name })` ambiguous (e2e DRQ-01 failed strict
9756
+ // mode on exactly this). `nativeButton={false}` because both variants
9757
+ // render a <div>, matching the element the trigger actually emits.
9758
+ /* @__PURE__ */ jsx86(
9759
+ SheetTrigger,
9760
+ {
9761
+ nativeButton: false,
9762
+ render: isEdit ? /* @__PURE__ */ jsx86(
9763
+ Button,
9764
+ {
9765
+ render: /* @__PURE__ */ jsx86("div", {}),
9766
+ nativeButton: false,
9767
+ size: "sm",
9768
+ variant: "ghost",
9769
+ className: "text-muted-foreground",
9770
+ children: /* @__PURE__ */ jsx86(PencilIcon3, {})
9771
+ }
9772
+ ) : /* @__PURE__ */ jsx86(Button, { render: /* @__PURE__ */ jsx86("div", {}), nativeButton: false, size: "sm", variant: "outline", children: t("ui.buttons.create") })
9773
+ }
9774
+ )
9775
+ )),
9759
9776
  /* @__PURE__ */ jsxs48(SheetContent, { side: "end", className: sizeClasses[size], children: [
9760
9777
  /* @__PURE__ */ jsx86(SheetHeader, { className: "border-b px-6 py-4", children: actions ? (
9761
9778
  // pe-10 clears the SheetContent close button, which sits at the
@@ -10045,9 +10062,21 @@ var FileUploader = forwardRef6(
10045
10062
  );
10046
10063
  const handleKeyDown = useCallback18(
10047
10064
  (e) => {
10065
+ if (!value) return;
10066
+ const handledKeys = [
10067
+ "ArrowLeft",
10068
+ "ArrowRight",
10069
+ "ArrowUp",
10070
+ "ArrowDown",
10071
+ "Enter",
10072
+ "Space",
10073
+ "Delete",
10074
+ "Backspace",
10075
+ "Escape"
10076
+ ];
10077
+ if (!handledKeys.includes(e.key)) return;
10048
10078
  e.preventDefault();
10049
10079
  e.stopPropagation();
10050
- if (!value) return;
10051
10080
  const moveNext = /* @__PURE__ */ __name(() => {
10052
10081
  const nextIndex = activeIndex + 1;
10053
10082
  setActiveIndex(nextIndex > value.length - 1 ? 0 : nextIndex);
@@ -10314,7 +10343,7 @@ import { useRef as useRef17 } from "react";
10314
10343
  import dynamic from "next/dynamic";
10315
10344
  import React18 from "react";
10316
10345
  import { jsx as jsx89 } from "react/jsx-runtime";
10317
- var BlockNoteEditor = dynamic(() => import("./BlockNoteEditor-PZ5HOXFK.mjs"), {
10346
+ var BlockNoteEditor = dynamic(() => import("./BlockNoteEditor-5AQQQQY3.mjs"), {
10318
10347
  ssr: false
10319
10348
  });
10320
10349
  var BlockNoteEditorContainer = React18.memo(/* @__PURE__ */ __name(function EditorContainer(props) {
@@ -11376,13 +11405,89 @@ import Image3 from "next/image";
11376
11405
  import { useEffect as useEffect21, useState as useState29 } from "react";
11377
11406
  import { jsx as jsx104, jsxs as jsxs62 } from "react/jsx-runtime";
11378
11407
  var dropzone = {
11379
- multiple: false,
11380
11408
  maxSize: 100 * 1024 * 1024,
11381
11409
  preventDropOnDocument: false,
11382
11410
  accept: {
11383
11411
  "application/images": [".jpg", ".jpeg", ".png", ".gif", ".webp", ".svg", ".docx", ".xslx", ".pdf", ".txt", ".md"]
11384
11412
  }
11385
11413
  };
11414
+ function MultiFileUploader({ files, setFiles, multiple = false, className }) {
11415
+ const uploadFiles = /* @__PURE__ */ __name((newFiles) => {
11416
+ if (!newFiles) return;
11417
+ setFiles([...files, ...newFiles]);
11418
+ }, "uploadFiles");
11419
+ const handleRemoveFile = /* @__PURE__ */ __name((indexToRemove) => {
11420
+ setFiles(files.filter((_, index) => index !== indexToRemove));
11421
+ }, "handleRemoveFile");
11422
+ return /* @__PURE__ */ jsxs62(
11423
+ "div",
11424
+ {
11425
+ className: cn(
11426
+ "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",
11427
+ className
11428
+ ),
11429
+ children: [
11430
+ /* @__PURE__ */ jsx104(
11431
+ FileUploader,
11432
+ {
11433
+ value: files,
11434
+ onValueChange: uploadFiles,
11435
+ dropzoneOptions: { ...dropzone, multiple },
11436
+ className: "text-muted-foreground hover:text-primary relative aspect-square h-full cursor-pointer overflow-hidden rounded-lg border",
11437
+ 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" }) })
11438
+ }
11439
+ ),
11440
+ files.map((file, index) => /* @__PURE__ */ jsx104(FilePreviewItem, { file, onRemoveClick: () => handleRemoveFile(index) }, file.name + "-" + index))
11441
+ ]
11442
+ }
11443
+ );
11444
+ }
11445
+ __name(MultiFileUploader, "MultiFileUploader");
11446
+ var FilePreviewItem = /* @__PURE__ */ __name(({ file, onRemoveClick }) => {
11447
+ const [objectUrl, setObjectUrl] = useState29(null);
11448
+ useEffect21(() => {
11449
+ if (file.type.startsWith("image/")) {
11450
+ const url = URL.createObjectURL(file);
11451
+ setObjectUrl(url);
11452
+ return () => URL.revokeObjectURL(url);
11453
+ }
11454
+ setObjectUrl(null);
11455
+ }, [file]);
11456
+ const getFileIcon = /* @__PURE__ */ __name(() => {
11457
+ const extension = file.name.split(".").pop()?.toLowerCase();
11458
+ if (file.type.startsWith("image/")) {
11459
+ return /* @__PURE__ */ jsx104(FileImageIcon, { className: "text-muted h-10 w-10 sm:h-12 sm:w-12" });
11460
+ }
11461
+ if (file.type === "application/pdf") {
11462
+ return /* @__PURE__ */ jsx104(FileTextIcon, { className: "text-destructive h-10 w-10 sm:h-12 sm:w-12" });
11463
+ }
11464
+ if (file.type.includes("wordprocessingml") || extension === "docx" || extension === "doc") {
11465
+ return /* @__PURE__ */ jsx104(FileTextIcon, { className: "text-primary h-10 w-10 sm:h-12 sm:w-12" });
11466
+ }
11467
+ if (file.type.includes("spreadsheetml") || extension === "xlsx" || extension === "xls") {
11468
+ return /* @__PURE__ */ jsx104(FileSpreadsheetIcon, { className: "text-secondary h-10 w-10 sm:h-12 sm:w-12" });
11469
+ }
11470
+ if (file.type.startsWith("text/")) {
11471
+ return /* @__PURE__ */ jsx104(FileTextIcon, { className: "h-10 w-10 sm:h-12 sm:w-12" });
11472
+ }
11473
+ return /* @__PURE__ */ jsx104(FileIcon, { className: "text-muted h-10 w-10 sm:h-12 sm:w-12" });
11474
+ }, "getFileIcon");
11475
+ return /* @__PURE__ */ jsxs62("div", { className: "text-muted-foreground group relative aspect-square h-full overflow-hidden rounded-lg border", children: [
11476
+ /* @__PURE__ */ jsx104(
11477
+ "button",
11478
+ {
11479
+ onClick: onRemoveClick,
11480
+ 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",
11481
+ "aria-label": "Remove file",
11482
+ children: /* @__PURE__ */ jsx104(XIcon7, { className: "h-3.5 w-3.5" })
11483
+ }
11484
+ ),
11485
+ 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: [
11486
+ getFileIcon(),
11487
+ /* @__PURE__ */ jsx104("span", { className: "text-foreground/80 mt-2 w-full truncate px-1 text-center text-xs sm:text-xs", children: file.name })
11488
+ ] })
11489
+ ] });
11490
+ }, "FilePreviewItem");
11386
11491
 
11387
11492
  // src/features/user/components/widgets/UserAvatar.tsx
11388
11493
  import { jsx as jsx105, jsxs as jsxs63 } from "react/jsx-runtime";
@@ -25372,6 +25477,7 @@ export {
25372
25477
  FormSwitch,
25373
25478
  FormTextarea,
25374
25479
  GdprConsentCheckbox,
25480
+ MultiFileUploader,
25375
25481
  PageContainerContentDetails,
25376
25482
  PageContentContainer,
25377
25483
  cellComponent,
@@ -25541,4 +25647,4 @@ export {
25541
25647
  useOAuthClients,
25542
25648
  useOAuthClient
25543
25649
  };
25544
- //# sourceMappingURL=chunk-C7I6YFTA.mjs.map
25650
+ //# sourceMappingURL=chunk-OE2WEAPU.mjs.map