@carlonicora/nextjs-jsonapi 6.18.0 → 6.19.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.
Files changed (32) hide show
  1. package/dist/{BlockNoteEditor-KSOVYIOL.mjs → BlockNoteEditor-5HSL74IX.mjs} +2 -2
  2. package/dist/{BlockNoteEditor-HHTAZKRO.js → BlockNoteEditor-6RZXGMSD.js} +9 -9
  3. package/dist/{BlockNoteEditor-HHTAZKRO.js.map → BlockNoteEditor-6RZXGMSD.js.map} +1 -1
  4. package/dist/billing/index.js +378 -378
  5. package/dist/billing/index.mjs +1 -1
  6. package/dist/{chunk-B6WMZXRY.js → chunk-B4ZH2FOC.js} +343 -307
  7. package/dist/chunk-B4ZH2FOC.js.map +1 -0
  8. package/dist/{chunk-MBLF236G.mjs → chunk-HEDHJAKT.mjs} +43 -7
  9. package/dist/chunk-HEDHJAKT.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 +7 -1
  13. package/dist/components/index.d.ts +7 -1
  14. package/dist/components/index.js +2 -2
  15. package/dist/components/index.mjs +1 -1
  16. package/dist/contexts/index.js +2 -2
  17. package/dist/contexts/index.mjs +1 -1
  18. package/dist/email-automations/index.js +78 -78
  19. package/dist/email-automations/index.mjs +1 -1
  20. package/dist/features/analytics/index.js +96 -96
  21. package/dist/features/analytics/index.mjs +1 -1
  22. package/dist/features/blog/index.js +93 -93
  23. package/dist/features/blog/index.mjs +1 -1
  24. package/dist/features/help/index.js +31 -31
  25. package/dist/features/help/index.mjs +1 -1
  26. package/dist/features/tokenusage/index.js +102 -102
  27. package/dist/features/tokenusage/index.mjs +1 -1
  28. package/package.json +1 -1
  29. package/src/components/forms/FormDateTime.tsx +55 -3
  30. package/dist/chunk-B6WMZXRY.js.map +0 -1
  31. package/dist/chunk-MBLF236G.mjs.map +0 -1
  32. /package/dist/{BlockNoteEditor-KSOVYIOL.mjs.map → BlockNoteEditor-5HSL74IX.mjs.map} +0 -0
@@ -10867,7 +10867,7 @@ import { useRef as useRef18 } from "react";
10867
10867
  import dynamic from "next/dynamic";
10868
10868
  import React18 from "react";
10869
10869
  import { jsx as jsx91 } from "react/jsx-runtime";
10870
- var BlockNoteEditor = dynamic(() => import("./BlockNoteEditor-KSOVYIOL.mjs"), {
10870
+ var BlockNoteEditor = dynamic(() => import("./BlockNoteEditor-5HSL74IX.mjs"), {
10871
10871
  ssr: false
10872
10872
  });
10873
10873
  var BlockNoteEditorContainer = React18.memo(/* @__PURE__ */ __name(function EditorContainer(props) {
@@ -11153,6 +11153,12 @@ __name(FormDate, "FormDate");
11153
11153
  import { Calendar as CalendarIcon4, CircleXIcon as CircleXIcon3 } from "lucide-react";
11154
11154
  import { useMemo as useMemo15, useState as useState28 } from "react";
11155
11155
  import { jsx as jsx95, jsxs as jsxs54 } from "react/jsx-runtime";
11156
+ function snapToFiveMinutes(date) {
11157
+ const snapped = new Date(date);
11158
+ snapped.setMinutes(Math.round(snapped.getMinutes() / 5) * 5, 0, 0);
11159
+ return snapped;
11160
+ }
11161
+ __name(snapToFiveMinutes, "snapToFiveMinutes");
11156
11162
  function FormDateTime({
11157
11163
  form,
11158
11164
  id,
@@ -11163,7 +11169,9 @@ function FormDateTime({
11163
11169
  defaultMonth,
11164
11170
  placeholder,
11165
11171
  isRequired,
11166
- description
11172
+ description,
11173
+ reference,
11174
+ markedDate
11167
11175
  }) {
11168
11176
  const [open, setOpen] = useState28(false);
11169
11177
  const t = useI18nTranslations();
@@ -11171,7 +11179,7 @@ function FormDateTime({
11171
11179
  const dateFnsLocale = useI18nDateFnsLocale();
11172
11180
  const [displayMonth, setDisplayMonth] = useState28(() => {
11173
11181
  const currentValue = form.getValues(id);
11174
- return currentValue || defaultMonth || /* @__PURE__ */ new Date();
11182
+ return currentValue || defaultMonth || reference?.date || /* @__PURE__ */ new Date();
11175
11183
  });
11176
11184
  const dateTimeFormatter = useMemo15(
11177
11185
  () => new Intl.DateTimeFormat(locale, {
@@ -11185,8 +11193,17 @@ function FormDateTime({
11185
11193
  [locale]
11186
11194
  );
11187
11195
  const formatDateTime = /* @__PURE__ */ __name((date) => dateTimeFormatter.format(date), "formatDateTime");
11188
- const [selectedHours, setSelectedHours] = useState28((/* @__PURE__ */ new Date()).getHours());
11189
- const [selectedMinutes, setSelectedMinutes] = useState28(roundToNearestFiveMinutes((/* @__PURE__ */ new Date()).getMinutes()));
11196
+ const initialTime = reference ? snapToFiveMinutes(reference.date) : /* @__PURE__ */ new Date();
11197
+ const [selectedHours, setSelectedHours] = useState28(initialTime.getHours());
11198
+ const [selectedMinutes, setSelectedMinutes] = useState28(roundToNearestFiveMinutes(initialTime.getMinutes()));
11199
+ const dayModifiers = {
11200
+ ...reference ? { reference: reference.date } : {},
11201
+ ...markedDate ? { marked: markedDate } : {}
11202
+ };
11203
+ const dayModifiersClassNames = {
11204
+ reference: "rounded-(--cell-radius) ring-1 ring-primary ring-offset-1 ring-offset-background",
11205
+ marked: "[&>button]:underline [&>button]:decoration-2 [&>button]:underline-offset-4"
11206
+ };
11190
11207
  const hoursOptions = Array.from({ length: 24 }, (_, i) => {
11191
11208
  const hour = i;
11192
11209
  return {
@@ -11207,6 +11224,15 @@ function FormDateTime({
11207
11224
  return Math.round(minutes / 5) * 5 % 60;
11208
11225
  }
11209
11226
  __name(roundToNearestFiveMinutes, "roundToNearestFiveMinutes");
11227
+ const handleUseReference = /* @__PURE__ */ __name(() => {
11228
+ if (!reference) return;
11229
+ const referenceDate = snapToFiveMinutes(reference.date);
11230
+ form.setValue(id, referenceDate);
11231
+ if (onChange) onChange(referenceDate);
11232
+ setDisplayMonth(referenceDate);
11233
+ setSelectedHours(referenceDate.getHours());
11234
+ setSelectedMinutes(referenceDate.getMinutes());
11235
+ }, "handleUseReference");
11210
11236
  const handleTimeChange = /* @__PURE__ */ __name((hours, minutes) => {
11211
11237
  const currentDate = form.getValues(id);
11212
11238
  if (currentDate) {
@@ -11275,9 +11301,19 @@ function FormDateTime({
11275
11301
  locale: dateFnsLocale,
11276
11302
  weekStartsOn: 1,
11277
11303
  startMonth: new Date(1900, 0),
11278
- endMonth: new Date((/* @__PURE__ */ new Date()).getFullYear() + 10, 11)
11304
+ endMonth: new Date((/* @__PURE__ */ new Date()).getFullYear() + 10, 11),
11305
+ modifiers: dayModifiers,
11306
+ modifiersClassNames: dayModifiersClassNames
11279
11307
  }
11280
11308
  ),
11309
+ reference?.label && /* @__PURE__ */ jsxs54("div", { className: "flex flex-row items-center justify-between gap-x-4 border-t pt-4", children: [
11310
+ /* @__PURE__ */ jsxs54("span", { className: "text-muted-foreground text-sm", children: [
11311
+ reference.label,
11312
+ ": ",
11313
+ formatDateTime(reference.date)
11314
+ ] }),
11315
+ reference.actionLabel && /* @__PURE__ */ jsx95(Button, { type: "button", variant: "outline", size: "sm", onClick: handleUseReference, children: reference.actionLabel })
11316
+ ] }),
11281
11317
  /* @__PURE__ */ jsxs54("div", { className: "flex flex-row items-end justify-center space-x-4", children: [
11282
11318
  /* @__PURE__ */ jsxs54("div", { className: "flex flex-col space-y-2", children: [
11283
11319
  /* @__PURE__ */ jsx95(Label, { htmlFor: "hours-select", children: t(`common.hours`) }),
@@ -30845,4 +30881,4 @@ export {
30845
30881
  useOAuthClients,
30846
30882
  useOAuthClient
30847
30883
  };
30848
- //# sourceMappingURL=chunk-MBLF236G.mjs.map
30884
+ //# sourceMappingURL=chunk-HEDHJAKT.mjs.map