@carlonicora/nextjs-jsonapi 1.140.2 → 1.141.1

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.
@@ -48,7 +48,7 @@ import {
48
48
  TabsList,
49
49
  TabsTrigger,
50
50
  useCurrentUserContext
51
- } from "../chunk-LB5B5KYF.mjs";
51
+ } from "../chunk-R6FRTQXV.mjs";
52
52
  import {
53
53
  getRoleId,
54
54
  getStripePublishableKey
@@ -9397,7 +9397,7 @@ __name(DateRangeSelector, "DateRangeSelector");
9397
9397
 
9398
9398
  // src/components/forms/EditorSheet.tsx
9399
9399
  import { useTranslations as useTranslations15 } from "next-intl";
9400
- import { useCallback as useCallback16, useEffect as useEffect17, useRef as useRef14 } from "react";
9400
+ import { isValidElement as isValidElement2, useCallback as useCallback16, useEffect as useEffect17, useRef as useRef14 } from "react";
9401
9401
  import { PencilIcon as PencilIcon3 } from "lucide-react";
9402
9402
 
9403
9403
  // src/components/forms/useEditorDialog.ts
@@ -9480,6 +9480,15 @@ __name(useEditorDialog, "useEditorDialog");
9480
9480
 
9481
9481
  // src/components/forms/EditorSheet.tsx
9482
9482
  import { Fragment as Fragment10, jsx as jsx83, jsxs as jsxs48 } from "react/jsx-runtime";
9483
+ function resolveTriggerIsNativeButton(trigger) {
9484
+ if (!isValidElement2(trigger)) return true;
9485
+ const props = trigger.props ?? {};
9486
+ if (typeof props.nativeButton === "boolean") return props.nativeButton;
9487
+ if (isValidElement2(props.render)) return props.render.type === "button";
9488
+ if (typeof trigger.type === "string") return trigger.type === "button";
9489
+ return true;
9490
+ }
9491
+ __name(resolveTriggerIsNativeButton, "resolveTriggerIsNativeButton");
9483
9492
  var sizeClasses = {
9484
9493
  sm: "data-[side=right]:sm:max-w-2xl",
9485
9494
  md: "data-[side=right]:sm:max-w-3xl",
@@ -9580,12 +9589,13 @@ function EditorSheet({
9580
9589
  // <button> inside SheetTrigger's <button> (invalid HTML / hydration
9581
9590
  // error). `render` also preserves the element's native `disabled`.
9582
9591
  //
9583
- // `nativeButton={false}` because this package's trigger convention is
9584
- // `<Button render={<div />} nativeButton={false}>` (see the package
9585
- // CLAUDE.md "pointer cursor" note). Without it the Trigger defaults to
9586
- // `nativeButton: true`, promising a native <button> it never renders,
9587
- // and Base UI logs a semantics/accessibility error at runtime.
9588
- /* @__PURE__ */ jsx83(SheetTrigger, { nativeButton: false, render: trigger })
9592
+ // `nativeButton` must match the element the trigger actually renders,
9593
+ // or Base UI logs a semantics/accessibility error at runtime. Call
9594
+ // sites pass BOTH kinds a native `<Button>` and the div-rendering
9595
+ // `<Button render={<div />} nativeButton={false}>` convention so it
9596
+ // is resolved per trigger rather than hardcoded (a constant `false`
9597
+ // warned on every native-button trigger).
9598
+ /* @__PURE__ */ jsx83(SheetTrigger, { nativeButton: resolveTriggerIsNativeButton(trigger), render: trigger })
9589
9599
  ) : /* @__PURE__ */ jsx83(SheetTrigger, { children: isEdit ? /* @__PURE__ */ jsx83(
9590
9600
  Button,
9591
9601
  {
@@ -9842,7 +9852,10 @@ import {
9842
9852
  useRef as useRef16,
9843
9853
  useState as useState24
9844
9854
  } from "react";
9845
- import { useDropzone } from "react-dropzone";
9855
+ import {
9856
+ ErrorCode,
9857
+ useDropzone
9858
+ } from "react-dropzone";
9846
9859
  import { jsx as jsx85, jsxs as jsxs50 } from "react/jsx-runtime";
9847
9860
  var FileUploaderContext = createContext11(null);
9848
9861
  var useFileUpload = /* @__PURE__ */ __name(() => {
@@ -9853,7 +9866,18 @@ var useFileUpload = /* @__PURE__ */ __name(() => {
9853
9866
  return context;
9854
9867
  }, "useFileUpload");
9855
9868
  var FileUploader = forwardRef6(
9856
- ({ className, dropzoneOptions, value, onValueChange, reSelect, orientation = "vertical", children, dir, ...props }, ref) => {
9869
+ ({
9870
+ className,
9871
+ dropzoneOptions,
9872
+ value,
9873
+ onValueChange,
9874
+ reSelect,
9875
+ orientation = "vertical",
9876
+ children,
9877
+ dir,
9878
+ onFilesRejected,
9879
+ ...props
9880
+ }, ref) => {
9857
9881
  const [isFileTooBig, setIsFileTooBig] = useState24(false);
9858
9882
  const [isLOF, setIsLOF] = useState24(false);
9859
9883
  const [activeIndex, setActiveIndex] = useState24(-1);
@@ -9920,12 +9944,20 @@ var FileUploader = forwardRef6(
9920
9944
  if (reSelectAll) {
9921
9945
  newValues.splice(0, newValues.length);
9922
9946
  }
9923
- files.forEach((file) => {
9924
- if (newValues.length < maxFiles) {
9925
- newValues.push(file);
9926
- }
9927
- });
9947
+ const remaining = Math.max(0, maxFiles - newValues.length);
9948
+ const admitted = files.slice(0, remaining);
9949
+ const overflow = files.slice(remaining);
9950
+ admitted.forEach((file) => newValues.push(file));
9928
9951
  onValueChange(newValues);
9952
+ if (onFilesRejected) {
9953
+ const overflowRejections = overflow.map((file) => ({
9954
+ file,
9955
+ errors: [{ code: ErrorCode.TooManyFiles, message: `Too many files. Only ${maxFiles} allowed.` }]
9956
+ }));
9957
+ const allRejections = [...rejectedFiles, ...overflowRejections];
9958
+ if (allRejections.length > 0) onFilesRejected(allRejections);
9959
+ return;
9960
+ }
9929
9961
  if (rejectedFiles.length > 0) {
9930
9962
  for (let i = 0; i < rejectedFiles.length; i++) {
9931
9963
  if (rejectedFiles[i].errors[0]?.code === "file-too-large") {
@@ -9943,7 +9975,7 @@ var FileUploader = forwardRef6(
9943
9975
  }
9944
9976
  }
9945
9977
  },
9946
- [reSelectAll, value]
9978
+ [reSelectAll, value, maxFiles, maxSize, onValueChange, onFilesRejected, t]
9947
9979
  );
9948
9980
  useEffect19(() => {
9949
9981
  if (!value) return;
@@ -10131,7 +10163,7 @@ import { useRef as useRef17 } from "react";
10131
10163
  import dynamic from "next/dynamic";
10132
10164
  import React17 from "react";
10133
10165
  import { jsx as jsx86 } from "react/jsx-runtime";
10134
- var BlockNoteEditor = dynamic(() => import("./BlockNoteEditor-5ZEC7GOM.mjs"), {
10166
+ var BlockNoteEditor = dynamic(() => import("./BlockNoteEditor-WUDLPAKY.mjs"), {
10135
10167
  ssr: false
10136
10168
  });
10137
10169
  var BlockNoteEditorContainer = React17.memo(/* @__PURE__ */ __name(function EditorContainer(props) {
@@ -23917,4 +23949,4 @@ export {
23917
23949
  useOAuthClients,
23918
23950
  useOAuthClient
23919
23951
  };
23920
- //# sourceMappingURL=chunk-LB5B5KYF.mjs.map
23952
+ //# sourceMappingURL=chunk-R6FRTQXV.mjs.map