@carlonicora/nextjs-jsonapi 1.58.2 → 1.58.4

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.
@@ -47,7 +47,7 @@ import {
47
47
  TabsList,
48
48
  TabsTrigger,
49
49
  useCurrentUserContext
50
- } from "../chunk-OAJFQZXY.mjs";
50
+ } from "../chunk-LSJ6IP34.mjs";
51
51
  import {
52
52
  getRoleId,
53
53
  getStripePublishableKey
@@ -8368,7 +8368,7 @@ __name(FormCheckbox, "FormCheckbox");
8368
8368
  import dynamic from "next/dynamic";
8369
8369
  import React14 from "react";
8370
8370
  import { jsx as jsx69 } from "react/jsx-runtime";
8371
- var BlockNoteEditor = dynamic(() => import("./BlockNoteEditor-I7N4N6MZ.mjs"), {
8371
+ var BlockNoteEditor = dynamic(() => import("./BlockNoteEditor-WAE53RNS.mjs"), {
8372
8372
  ssr: false
8373
8373
  });
8374
8374
  var BlockNoteEditorContainer = React14.memo(/* @__PURE__ */ __name(function EditorContainer(props) {
@@ -8463,15 +8463,6 @@ function FormDate({
8463
8463
  const currentValue = form.getValues(id);
8464
8464
  return currentValue ? formatDate(currentValue) : "";
8465
8465
  });
8466
- const currentYear = (/* @__PURE__ */ new Date()).getFullYear();
8467
- const yearOptions = Array.from({ length: currentYear - 1900 + 1 }, (_, i) => 1900 + i);
8468
- const monthNames = useMemo10(() => {
8469
- const formatter = new Intl.DateTimeFormat(locale, { month: "long" });
8470
- return Array.from({ length: 12 }, (_, i) => {
8471
- const monthName = formatter.format(new Date(2e3, i, 1));
8472
- return monthName.charAt(0).toUpperCase() + monthName.slice(1);
8473
- });
8474
- }, [locale]);
8475
8466
  const handleInputChange = /* @__PURE__ */ __name((value, field) => {
8476
8467
  setInputValue(value);
8477
8468
  const parsedDate = parse2(value, dateFormatPattern, /* @__PURE__ */ new Date());
@@ -8521,58 +8512,25 @@ function FormDate({
8521
8512
  )
8522
8513
  ] })
8523
8514
  ] }),
8524
- /* @__PURE__ */ jsx71(PopoverContent, { className: "w-auto p-0", align: "start", children: /* @__PURE__ */ jsxs39("div", { className: "p-3", children: [
8525
- /* @__PURE__ */ jsxs39("div", { className: "mb-3 flex gap-2", children: [
8526
- /* @__PURE__ */ jsxs39(
8527
- Select,
8528
- {
8529
- value: displayMonth.getMonth().toString(),
8530
- onValueChange: (value) => {
8531
- if (!value) return;
8532
- const newMonth = parseInt(value);
8533
- const newDate = new Date(displayMonth.getFullYear(), newMonth, 1);
8534
- setDisplayMonth(newDate);
8535
- },
8536
- children: [
8537
- /* @__PURE__ */ jsx71(SelectTrigger, { className: "w-[130px]", children: /* @__PURE__ */ jsx71(SelectValue, {}) }),
8538
- /* @__PURE__ */ jsx71(SelectContent, { children: monthNames.map((month, index) => /* @__PURE__ */ jsx71(SelectItem, { value: index.toString(), children: month }, index)) })
8539
- ]
8540
- }
8541
- ),
8542
- /* @__PURE__ */ jsxs39(
8543
- Select,
8544
- {
8545
- value: displayMonth.getFullYear().toString(),
8546
- onValueChange: (value) => {
8547
- if (!value) return;
8548
- const newYear = parseInt(value);
8549
- const newDate = new Date(newYear, displayMonth.getMonth(), 1);
8550
- setDisplayMonth(newDate);
8551
- },
8552
- children: [
8553
- /* @__PURE__ */ jsx71(SelectTrigger, { className: "w-[80px]", children: /* @__PURE__ */ jsx71(SelectValue, {}) }),
8554
- /* @__PURE__ */ jsx71(SelectContent, { children: yearOptions.reverse().map((year) => /* @__PURE__ */ jsx71(SelectItem, { value: year.toString(), children: year }, year)) })
8555
- ]
8556
- }
8557
- )
8558
- ] }),
8559
- /* @__PURE__ */ jsx71(
8560
- Calendar,
8561
- {
8562
- mode: "single",
8563
- selected: field.value,
8564
- onSelect: (e) => {
8565
- handleCalendarSelect(e, field);
8566
- setOpen(false);
8567
- },
8568
- disabled: (date) => minDate && date < minDate ? true : false,
8569
- locale: dateFnsLocale,
8570
- weekStartsOn: 1,
8571
- month: displayMonth,
8572
- onMonthChange: setDisplayMonth
8573
- }
8574
- )
8575
- ] }) })
8515
+ /* @__PURE__ */ jsx71(PopoverContent, { className: "w-auto p-0", align: "end", children: /* @__PURE__ */ jsx71(
8516
+ Calendar,
8517
+ {
8518
+ mode: "single",
8519
+ captionLayout: "dropdown",
8520
+ selected: field.value,
8521
+ onSelect: (e) => {
8522
+ handleCalendarSelect(e, field);
8523
+ setOpen(false);
8524
+ },
8525
+ disabled: (date) => minDate && date < minDate ? true : false,
8526
+ locale: dateFnsLocale,
8527
+ weekStartsOn: 1,
8528
+ month: displayMonth,
8529
+ onMonthChange: setDisplayMonth,
8530
+ startMonth: new Date(1900, 0),
8531
+ endMonth: new Date((/* @__PURE__ */ new Date()).getFullYear() + 10, 11)
8532
+ }
8533
+ ) })
8576
8534
  ] }) }) });
8577
8535
  }
8578
8536
  __name(FormDate, "FormDate");
@@ -8789,10 +8747,21 @@ function FormInput({
8789
8747
  field.onBlur();
8790
8748
  }, "handleBlur");
8791
8749
  const handleChange = /* @__PURE__ */ __name((e) => {
8792
- if (type === "number" || type === "currency") {
8750
+ if (type === "number") {
8793
8751
  const value = e.target.value.replace(/[^0-9]/g, "");
8794
8752
  field.onChange(+value);
8795
8753
  if (onChange) onChange(+value);
8754
+ } else if (type === "currency" || type === "decimal") {
8755
+ let value = e.target.value.replace(/[^0-9.,]/g, "");
8756
+ const firstSep = value.search(/[.,]/);
8757
+ if (firstSep !== -1) {
8758
+ const sep = value[firstSep];
8759
+ const before = value.slice(0, firstSep);
8760
+ const after = value.slice(firstSep + 1).replace(/[.,]/g, "");
8761
+ value = before + sep + after;
8762
+ }
8763
+ field.onChange(value);
8764
+ if (onChange) onChange(value);
8796
8765
  } else {
8797
8766
  field.onChange(e.target.value);
8798
8767
  if (onChange) onChange(e.target.value);
@@ -8801,8 +8770,9 @@ function FormInput({
8801
8770
  const inputProps = {
8802
8771
  ...field,
8803
8772
  autoFocus: autoFocus === true,
8804
- type: type === "number" || type === "currency" ? "number" : type === "password" ? "password" : "text",
8805
- className: `w-full ${type === "number" || type === "currency" ? "text-end" : ""}`,
8773
+ type: type === "password" ? "password" : "text",
8774
+ inputMode: type === "number" || type === "currency" || type === "decimal" ? "decimal" : void 0,
8775
+ className: `w-full ${type === "number" || type === "currency" || type === "decimal" ? "text-end" : ""}`,
8806
8776
  disabled: disabled === true || form.formState.isSubmitting,
8807
8777
  placeholder: placeholder || "",
8808
8778
  onBlur: handleBlur,
@@ -18836,4 +18806,4 @@ export {
18836
18806
  useOAuthClients,
18837
18807
  useOAuthClient
18838
18808
  };
18839
- //# sourceMappingURL=chunk-OAJFQZXY.mjs.map
18809
+ //# sourceMappingURL=chunk-LSJ6IP34.mjs.map