@carlonicora/nextjs-jsonapi 1.140.1 → 1.141.0

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-B5YZFCPE.mjs";
51
+ } from "../chunk-7TKD4SMQ.mjs";
52
52
  import {
53
53
  getRoleId,
54
54
  getStripePublishableKey
@@ -9290,6 +9290,7 @@ import { useEffect as useEffect15, useState as useState21 } from "react";
9290
9290
  import { Fragment as Fragment9, jsx as jsx82, jsxs as jsxs47 } from "react/jsx-runtime";
9291
9291
  function DateRangeSelector({ onDateChange, avoidSettingDates, showPreviousMonth }) {
9292
9292
  const t = useTranslations14();
9293
+ const dateFnsLocale = useI18nDateFnsLocale();
9293
9294
  const [date, setDate] = useState21(
9294
9295
  avoidSettingDates ? void 0 : {
9295
9296
  from: new Date((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth(), 1),
@@ -9330,10 +9331,11 @@ function DateRangeSelector({ onDateChange, avoidSettingDates, showPreviousMonth
9330
9331
  children: [
9331
9332
  /* @__PURE__ */ jsx82(CalendarIcon2, {}),
9332
9333
  date?.from ? date.to ? /* @__PURE__ */ jsxs47(Fragment9, { children: [
9333
- format(date.from, "LLL dd, y"),
9334
- " - ",
9335
- format(date.to, "LLL dd, y")
9336
- ] }) : format(date.from, "LLL dd, y") : /* @__PURE__ */ jsx82("span", { children: t("ui.labels.pick_a_date") })
9334
+ format(date.from, "d MMM yyyy", { locale: dateFnsLocale }),
9335
+ " -",
9336
+ " ",
9337
+ format(date.to, "d MMM yyyy", { locale: dateFnsLocale })
9338
+ ] }) : format(date.from, "d MMM yyyy", { locale: dateFnsLocale }) : /* @__PURE__ */ jsx82("span", { children: t("ui.labels.pick_a_date") })
9337
9339
  ]
9338
9340
  }
9339
9341
  ) });
@@ -9353,10 +9355,11 @@ function DateRangeSelector({ onDateChange, avoidSettingDates, showPreviousMonth
9353
9355
  children: [
9354
9356
  /* @__PURE__ */ jsx82(CalendarIcon2, {}),
9355
9357
  date?.from ? date.to ? /* @__PURE__ */ jsxs47(Fragment9, { children: [
9356
- format(date.from, "LLL dd, y"),
9357
- " - ",
9358
- format(date.to, "LLL dd, y")
9359
- ] }) : format(date.from, "LLL dd, y") : /* @__PURE__ */ jsx82("span", { children: t("ui.labels.pick_a_date") })
9358
+ format(date.from, "d MMM yyyy", { locale: dateFnsLocale }),
9359
+ " -",
9360
+ " ",
9361
+ format(date.to, "d MMM yyyy", { locale: dateFnsLocale })
9362
+ ] }) : format(date.from, "d MMM yyyy", { locale: dateFnsLocale }) : /* @__PURE__ */ jsx82("span", { children: t("ui.labels.pick_a_date") })
9360
9363
  ]
9361
9364
  }
9362
9365
  ),
@@ -9839,7 +9842,10 @@ import {
9839
9842
  useRef as useRef16,
9840
9843
  useState as useState24
9841
9844
  } from "react";
9842
- import { useDropzone } from "react-dropzone";
9845
+ import {
9846
+ ErrorCode,
9847
+ useDropzone
9848
+ } from "react-dropzone";
9843
9849
  import { jsx as jsx85, jsxs as jsxs50 } from "react/jsx-runtime";
9844
9850
  var FileUploaderContext = createContext11(null);
9845
9851
  var useFileUpload = /* @__PURE__ */ __name(() => {
@@ -9850,7 +9856,18 @@ var useFileUpload = /* @__PURE__ */ __name(() => {
9850
9856
  return context;
9851
9857
  }, "useFileUpload");
9852
9858
  var FileUploader = forwardRef6(
9853
- ({ className, dropzoneOptions, value, onValueChange, reSelect, orientation = "vertical", children, dir, ...props }, ref) => {
9859
+ ({
9860
+ className,
9861
+ dropzoneOptions,
9862
+ value,
9863
+ onValueChange,
9864
+ reSelect,
9865
+ orientation = "vertical",
9866
+ children,
9867
+ dir,
9868
+ onFilesRejected,
9869
+ ...props
9870
+ }, ref) => {
9854
9871
  const [isFileTooBig, setIsFileTooBig] = useState24(false);
9855
9872
  const [isLOF, setIsLOF] = useState24(false);
9856
9873
  const [activeIndex, setActiveIndex] = useState24(-1);
@@ -9917,12 +9934,20 @@ var FileUploader = forwardRef6(
9917
9934
  if (reSelectAll) {
9918
9935
  newValues.splice(0, newValues.length);
9919
9936
  }
9920
- files.forEach((file) => {
9921
- if (newValues.length < maxFiles) {
9922
- newValues.push(file);
9923
- }
9924
- });
9937
+ const remaining = Math.max(0, maxFiles - newValues.length);
9938
+ const admitted = files.slice(0, remaining);
9939
+ const overflow = files.slice(remaining);
9940
+ admitted.forEach((file) => newValues.push(file));
9925
9941
  onValueChange(newValues);
9942
+ if (onFilesRejected) {
9943
+ const overflowRejections = overflow.map((file) => ({
9944
+ file,
9945
+ errors: [{ code: ErrorCode.TooManyFiles, message: `Too many files. Only ${maxFiles} allowed.` }]
9946
+ }));
9947
+ const allRejections = [...rejectedFiles, ...overflowRejections];
9948
+ if (allRejections.length > 0) onFilesRejected(allRejections);
9949
+ return;
9950
+ }
9926
9951
  if (rejectedFiles.length > 0) {
9927
9952
  for (let i = 0; i < rejectedFiles.length; i++) {
9928
9953
  if (rejectedFiles[i].errors[0]?.code === "file-too-large") {
@@ -9940,7 +9965,7 @@ var FileUploader = forwardRef6(
9940
9965
  }
9941
9966
  }
9942
9967
  },
9943
- [reSelectAll, value]
9968
+ [reSelectAll, value, maxFiles, maxSize, onValueChange, onFilesRejected, t]
9944
9969
  );
9945
9970
  useEffect19(() => {
9946
9971
  if (!value) return;
@@ -10128,7 +10153,7 @@ import { useRef as useRef17 } from "react";
10128
10153
  import dynamic from "next/dynamic";
10129
10154
  import React17 from "react";
10130
10155
  import { jsx as jsx86 } from "react/jsx-runtime";
10131
- var BlockNoteEditor = dynamic(() => import("./BlockNoteEditor-AXAC3W24.mjs"), {
10156
+ var BlockNoteEditor = dynamic(() => import("./BlockNoteEditor-UNYOBY7K.mjs"), {
10132
10157
  ssr: false
10133
10158
  });
10134
10159
  var BlockNoteEditorContainer = React17.memo(/* @__PURE__ */ __name(function EditorContainer(props) {
@@ -23914,4 +23939,4 @@ export {
23914
23939
  useOAuthClients,
23915
23940
  useOAuthClient
23916
23941
  };
23917
- //# sourceMappingURL=chunk-B5YZFCPE.mjs.map
23942
+ //# sourceMappingURL=chunk-7TKD4SMQ.mjs.map