impact-nova 2.5.8 → 2.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.
@@ -1,98 +1,95 @@
1
1
  import { jsx as i, jsxs as z } from "react/jsx-runtime";
2
- import * as k from "react";
3
- import { useDayPicker as K } from "react-day-picker";
2
+ import * as x from "react";
3
+ import { useDayPicker as V } from "react-day-picker";
4
4
  import { ChevronRight as B } from "impact-nova-icons";
5
- import { cn as D } from "../../../lib/utils.js";
6
- import { Button as R } from "../../primitives/button/button.js";
7
- import { Select as _ } from "../../forms/select/select.js";
8
- import { CalendarCaptionHeader as V } from "./calendar-caption-header.js";
9
- import { CalendarDayButton as ee } from "./calendar-day-button.js";
10
- import { PanelIndexContext as y } from "./calendar-panel-context.js";
11
- import { CalendarWeekNumberCell as te } from "./calendar-week-number-cell.js";
12
- import { paneCivilMonthIndex as re } from "./calendar-week-number-header.js";
13
- import { localDateFromCivil as E } from "../../../lib/fiscal-calendar/civil-date.js";
14
- import { buildFiscalYear as ne } from "../../../lib/fiscal-calendar/build-year.js";
15
- import { getAvailableMonths as oe } from "./calendar-month-utils.js";
16
- import { isCalendarPaddingWeek as ie, weekHasInMonthSelection as ae, weekIntervalContinues as se } from "./calendar-padding-week.utils.js";
17
- import { fiscalPeriodForWeek as le } from "./calendar-week-utils.js";
18
- import { FiscalPeriodCaptionSelect as de } from "./fiscal-period-caption-select.js";
19
- function M(u, m, h) {
20
- if (m != null && u)
5
+ import { cn as k } from "../../../lib/utils.js";
6
+ import { Button as M } from "../../primitives/button/button.js";
7
+ import { Select as R } from "../../forms/select/select.js";
8
+ import { CalendarCaptionHeader as ee } from "./calendar-caption-header.js";
9
+ import { CalendarDayButton as te } from "./calendar-day-button.js";
10
+ import { PanelIndexContext as N } from "./calendar-panel-context.js";
11
+ import { CalendarWeekNumberCell as re } from "./calendar-week-number-cell.js";
12
+ import { paneCivilMonthIndex as ne } from "./calendar-week-number-header.js";
13
+ import { buildFiscalYear as oe } from "../../../lib/fiscal-calendar/build-year.js";
14
+ import { civilMonthAtOffset as _, midMonthDate as E, visibleMonthForPeriod as G, periodForCivilMonth as ie } from "./calendar-fiscal-period-nav.js";
15
+ import { getAvailableMonths as ae } from "./calendar-month-utils.js";
16
+ import { isCalendarPaddingWeek as se, weekHasInMonthSelection as le, weekIntervalContinues as de } from "./calendar-padding-week.utils.js";
17
+ import { fiscalPeriodForWeek as ce } from "./calendar-week-utils.js";
18
+ import { FiscalPeriodCaptionSelect as me } from "./fiscal-period-caption-select.js";
19
+ function H(y, m, u) {
20
+ if (m != null && y)
21
21
  try {
22
- return ne(u, m).periods;
22
+ return oe(y, m).periods;
23
23
  } catch {
24
24
  }
25
- return h ?? [];
25
+ return u ?? [];
26
26
  }
27
- function G(u, m) {
28
- return new Date(u.getFullYear(), u.getMonth() - (m ? 1 : 0), 1);
29
- }
30
- function We({
31
- buttonVariant: u,
27
+ function Ie({
28
+ buttonVariant: y,
32
29
  pickerType: m,
33
- calendarKind: h,
34
- currentMonth: p,
35
- monthsFull: C,
36
- monthsShort: H,
37
- resolvedStartMonth: q,
38
- resolvedEndMonth: J,
39
- availableYears: P,
40
- fiscalPeriods: N,
30
+ calendarKind: u,
31
+ currentMonth: h,
32
+ monthsFull: b,
33
+ monthsShort: q,
34
+ resolvedStartMonth: J,
35
+ resolvedEndMonth: Q,
36
+ availableYears: g,
37
+ fiscalPeriods: C,
41
38
  fiscalConfig: w,
42
- weekStartsOn: Q,
43
- previousMonthLabel: W,
44
- nextMonthLabel: b,
45
- monthPlaceholder: F,
46
- yearPlaceholder: U,
47
- weekNumberLabel: X,
48
- weekNumberHeader: I,
49
- weekLabel: Z,
50
- fiscalWeekNumberLabel: $,
51
- fiscalWeekAriaLabel: L,
52
- getCellMeta: x,
53
- onMonthChange: g,
54
- onWeekSelect: Y,
55
- periodRowHover: A = !1,
39
+ weekStartsOn: U,
40
+ previousMonthLabel: P,
41
+ nextMonthLabel: W,
42
+ monthPlaceholder: I,
43
+ yearPlaceholder: X,
44
+ weekNumberLabel: Z,
45
+ weekNumberHeader: F,
46
+ weekLabel: $,
47
+ fiscalWeekNumberLabel: L,
48
+ fiscalWeekAriaLabel: T,
49
+ getCellMeta: f,
50
+ onMonthChange: v,
51
+ onWeekSelect: A,
52
+ periodRowHover: Y = !1,
56
53
  weekMode: O = "single",
57
- components: T
54
+ components: K
58
55
  }) {
59
56
  return {
60
- Root: ({ className: e, rootRef: r, ...t }) => /* @__PURE__ */ i("div", { "data-slot": "calendar", ref: r, className: D(e), ...t }),
57
+ Root: ({ className: e, rootRef: r, ...t }) => /* @__PURE__ */ i("div", { "data-slot": "calendar", ref: r, className: k(e), ...t }),
61
58
  Chevron: ({ className: e, orientation: r, ...t }) => r === "left" ? /* @__PURE__ */ i(
62
59
  B,
63
60
  {
64
61
  size: 16,
65
- className: D("rotate-180 text-content", e),
62
+ className: k("rotate-180 text-content", e),
66
63
  ...t
67
64
  }
68
- ) : r === "right" ? /* @__PURE__ */ i(B, { size: 16, className: D("text-content", e), ...t }) : /* @__PURE__ */ i("span", {}),
65
+ ) : r === "right" ? /* @__PURE__ */ i(B, { size: 16, className: k("text-content", e), ...t }) : /* @__PURE__ */ i("span", {}),
69
66
  PreviousMonthButton: (e) => /* @__PURE__ */ i(
70
- R,
67
+ M,
71
68
  {
72
- variant: u,
69
+ variant: y,
73
70
  size: "icon",
74
71
  className: "h-7 w-7",
75
- "aria-label": W,
76
- title: W,
72
+ "aria-label": P,
73
+ title: P,
77
74
  ...e
78
75
  }
79
76
  ),
80
77
  NextMonthButton: (e) => /* @__PURE__ */ i(
81
- R,
78
+ M,
82
79
  {
83
- variant: u,
80
+ variant: y,
84
81
  size: "icon",
85
82
  className: "h-7 w-7",
86
- "aria-label": b,
87
- title: b,
83
+ "aria-label": W,
84
+ title: W,
88
85
  ...e
89
86
  }
90
87
  ),
91
88
  MonthCaption: ({ displayIndex: e, calendarMonth: r, ...t }) => /* @__PURE__ */ i("div", { ...t }),
92
- Month: ({ calendarMonth: e, displayIndex: r, className: t, children: a, ...s }) => {
93
- const d = k.Children.toArray(a), l = d[d.length - 1], o = d.slice(0, -1);
94
- return /* @__PURE__ */ i(y.Provider, { value: r, children: /* @__PURE__ */ z("div", { className: D(t), ...s, children: [
95
- o.length > 0 ? /* @__PURE__ */ i(V, { children: o }) : null,
89
+ Month: ({ calendarMonth: e, displayIndex: r, className: t, children: o, ...a }) => {
90
+ const d = x.Children.toArray(o), l = d[d.length - 1], s = d.slice(0, -1);
91
+ return /* @__PURE__ */ i(N.Provider, { value: r, children: /* @__PURE__ */ z("div", { className: k(t), ...a, children: [
92
+ s.length > 0 ? /* @__PURE__ */ i(ee, { children: s }) : null,
96
93
  l
97
94
  ] }) });
98
95
  },
@@ -100,56 +97,60 @@ function We({
100
97
  "div",
101
98
  {
102
99
  "data-slot": "day-months",
103
- "data-period-row-hover": A ? "true" : void 0,
100
+ "data-period-row-hover": Y ? "true" : void 0,
104
101
  "data-week-gutter-track": m === "week" ? "true" : void 0,
105
- className: D(e),
102
+ className: k(e),
106
103
  ...t,
107
104
  children: r
108
105
  }
109
106
  ),
110
107
  DropdownNav: ({ children: e, className: r, ...t }) => {
111
- if (h !== "fiscal")
108
+ if (u !== "fiscal")
112
109
  return /* @__PURE__ */ i("div", { className: r, ...t, children: e });
113
- const a = k.Children.toArray(e), s = (n) => k.isValidElement(n) && n.key != null ? String(n.key) : "", d = a.find((n) => s(n).endsWith("year")), l = a.find((n) => s(n).endsWith("month")), o = a.filter((n) => {
114
- const c = s(n);
110
+ const o = x.Children.toArray(e), a = (n) => x.isValidElement(n) && n.key != null ? String(n.key) : "", d = o.find((n) => a(n).endsWith("year")), l = o.find((n) => a(n).endsWith("month")), s = o.filter((n) => {
111
+ const c = a(n);
115
112
  return !c.endsWith("year") && !c.endsWith("month");
116
113
  });
117
114
  return /* @__PURE__ */ z("div", { className: r, ...t, children: [
118
115
  d,
119
116
  l,
120
- o
117
+ s
121
118
  ] });
122
119
  },
123
120
  MonthsDropdown: ({ value: e }) => {
124
- const r = k.useContext(y), t = r > 0, a = new Date(p.getFullYear(), p.getMonth() + r, 1), s = a.getFullYear();
125
- if (h === "fiscal" && w) {
126
- const o = x?.(a), n = M(w, o?.fy, N), c = o?.fiscalPeriod != null ? String(o.fiscalPeriod) : void 0, v = n.find((f) => String(f.period) === c);
121
+ const r = x.useContext(N), t = r > 0, o = _(h, r), a = o.getFullYear();
122
+ if (u === "fiscal" && w) {
123
+ const s = f?.(E(o)) ?? f?.(o), n = H(w, s?.fy, C), c = ie(
124
+ n,
125
+ o.getFullYear(),
126
+ o.getMonth()
127
+ );
127
128
  return /* @__PURE__ */ i(
128
- de,
129
+ me,
129
130
  {
130
131
  periods: n,
131
- selectedPeriod: v,
132
- placeholder: F,
133
- onPeriodChange: (f) => {
134
- g(G(E(f.start), t));
132
+ selectedPeriod: c,
133
+ placeholder: I,
134
+ onPeriodChange: (p) => {
135
+ v(G(p, t));
135
136
  }
136
137
  }
137
138
  );
138
139
  }
139
- const l = oe(
140
- s,
141
- C,
142
- q,
143
- J
140
+ const l = ae(
141
+ a,
142
+ b,
143
+ J,
144
+ Q
144
145
  );
145
146
  return /* @__PURE__ */ i(
146
- _,
147
+ R,
147
148
  {
148
- value: l.find((o) => o.value === e?.toString()),
149
- onChange: (o) => {
150
- if (o && "value" in o) {
151
- const n = parseInt(o.value);
152
- g(t ? new Date(s, n - 1, 1) : new Date(s, n, 1));
149
+ value: l.find((s) => s.value === e?.toString()),
150
+ onChange: (s) => {
151
+ if (s && "value" in s) {
152
+ const n = parseInt(s.value);
153
+ v(t ? new Date(a, n - 1, 1) : new Date(a, n, 1));
153
154
  }
154
155
  },
155
156
  scrollToSelectedOnOpen: !0,
@@ -158,105 +159,105 @@ function We({
158
159
  menuWidth: "160px",
159
160
  isSearchable: !0,
160
161
  isClearable: !1,
161
- placeholder: F
162
+ placeholder: I
162
163
  }
163
164
  );
164
165
  },
165
166
  YearsDropdown: ({ value: e }) => {
166
- const r = k.useContext(y), t = r > 0, a = h === "fiscal" && w, s = new Date(p.getFullYear(), p.getMonth() + r, 1), d = a ? x?.(s) : void 0, l = a && d?.fy != null ? String(d.fy) : e?.toString();
167
+ const r = x.useContext(N), t = r > 0, o = u === "fiscal" && w, a = _(h, r), d = o ? f?.(E(a)) ?? f?.(a) : void 0, l = o && d?.fy != null ? String(d.fy) : e?.toString();
167
168
  return /* @__PURE__ */ i(
168
- _,
169
+ R,
169
170
  {
170
- value: P.find((n) => n.value === l),
171
+ value: g.find((n) => n.value === l),
171
172
  onChange: (n) => {
172
173
  if (n && "value" in n) {
173
174
  const c = parseInt(n.value);
174
- if (a) {
175
- const v = M(w, c, N), f = v.find((S) => S.period === d?.fiscalPeriod) ?? v[0];
176
- f && g(G(E(f.start), t));
175
+ if (o) {
176
+ const p = H(w, c, C), D = p.find((S) => S.period === d?.fiscalPeriod) ?? p[0];
177
+ D && v(G(D, t));
177
178
  return;
178
179
  }
179
180
  if (t) {
180
- const v = new Date(
181
- p.getFullYear(),
182
- p.getMonth() + 1,
181
+ const p = new Date(
182
+ h.getFullYear(),
183
+ h.getMonth() + 1,
183
184
  1
184
185
  ).getMonth();
185
- g(new Date(c, v - 1, 1));
186
+ v(new Date(c, p - 1, 1));
186
187
  } else
187
- g(new Date(c, p.getMonth(), 1));
188
+ v(new Date(c, h.getMonth(), 1));
188
189
  }
189
190
  },
190
191
  scrollToSelectedOnOpen: !0,
191
- options: P,
192
+ options: g,
192
193
  className: "w-[116px] shrink-0",
193
194
  menuWidth: "140px",
194
195
  isSearchable: !0,
195
196
  isClearable: !1,
196
- placeholder: U
197
+ placeholder: X
197
198
  }
198
199
  );
199
200
  },
200
201
  DayButton: (e) => /* @__PURE__ */ i(
201
- ee,
202
+ te,
202
203
  {
203
204
  ...e,
204
205
  pickerType: m,
205
206
  modifiers: {
206
207
  ...e.modifiers,
207
- fiscal_period_start: !!x?.(e.day.date)?.isPeriodStart,
208
- fiscal_period_end: !!x?.(e.day.date)?.isPeriodEnd
208
+ fiscal_period_start: !!f?.(e.day.date)?.isPeriodStart,
209
+ fiscal_period_end: !!f?.(e.day.date)?.isPeriodEnd
209
210
  }
210
211
  }
211
212
  ),
212
- Week: ({ week: e, className: r, children: t, onClick: a, ...s }) => {
213
- const { isSelected: d } = K(), l = ie(e), o = m === "week", n = A && !l ? le(e, x) : void 0, c = !l && ae(e, d), f = m === "week" && O !== "multiple" && O !== "multi-range" && c ? se(e, d) : { prev: !1, next: !1 };
213
+ Week: ({ week: e, className: r, children: t, onClick: o, ...a }) => {
214
+ const { isSelected: d } = V(), l = se(e), s = m === "week", n = Y && !l ? ce(e, f) : void 0, c = !l && le(e, d), D = m === "week" && O !== "multiple" && O !== "multi-range" && c ? de(e, d) : { prev: !1, next: !1 };
214
215
  return /* @__PURE__ */ i(
215
216
  "tr",
216
217
  {
217
- className: D(
218
+ className: k(
218
219
  r,
219
220
  l && "invisible",
220
- o && !l && "cursor-pointer"
221
+ s && !l && "cursor-pointer"
221
222
  ),
222
- ...s,
223
+ ...a,
223
224
  "aria-hidden": l || void 0,
224
225
  "data-fiscal-period": n,
225
226
  "data-week-selected": c ? !0 : void 0,
226
- "data-week-continues-next": f.next || void 0,
227
- "data-week-continues-prev": f.prev || void 0,
228
- onClick: o && !l ? (S) => {
229
- if (a?.(S), S.defaultPrevented) return;
227
+ "data-week-continues-next": D.next || void 0,
228
+ "data-week-continues-prev": D.prev || void 0,
229
+ onClick: s && !l ? (S) => {
230
+ if (o?.(S), S.defaultPrevented) return;
230
231
  const j = S.target;
231
- j.closest("button") || j.closest("[data-week-number]") || Y(e);
232
- } : a,
232
+ j.closest("button") || j.closest("[data-week-number]") || A(e);
233
+ } : o,
233
234
  children: t
234
235
  }
235
236
  );
236
237
  },
237
238
  WeekNumber: ({ week: e, ...r }) => /* @__PURE__ */ i(
238
- te,
239
+ re,
239
240
  {
240
241
  week: e,
241
- weekStartsOn: Q,
242
+ weekStartsOn: U,
242
243
  pickerType: m,
243
- calendarKind: h,
244
- weekNumberLabel: X,
245
- weekLabel: Z,
246
- fiscalWeekNumberLabel: $,
247
- fiscalWeekAriaLabel: L,
248
- getCellMeta: x,
249
- onWeekSelect: Y,
244
+ calendarKind: u,
245
+ weekNumberLabel: Z,
246
+ weekLabel: $,
247
+ fiscalWeekNumberLabel: L,
248
+ fiscalWeekAriaLabel: T,
249
+ getCellMeta: f,
250
+ onWeekSelect: A,
250
251
  ...r
251
252
  }
252
253
  ),
253
254
  WeekNumberHeader: (e) => {
254
- const r = k.useContext(y), t = re(h, p, r), a = t === void 0 ? I : H[t], s = t === void 0 ? I : C[t];
255
- return /* @__PURE__ */ i("th", { ...e, "aria-label": s, children: a });
255
+ const r = x.useContext(N), t = ne(u, h, r), o = t === void 0 ? F : q[t], a = t === void 0 ? F : b[t];
256
+ return /* @__PURE__ */ i("th", { ...e, "aria-label": a, children: o });
256
257
  },
257
- ...T
258
+ ...K
258
259
  };
259
260
  }
260
261
  export {
261
- We as buildCalendarDayPickerComponents
262
+ Ie as buildCalendarDayPickerComponents
262
263
  };
@@ -17,7 +17,7 @@ const a = [
17
17
  function u(r, t = "fy-short") {
18
18
  return c(r, t);
19
19
  }
20
- function p(r, t) {
20
+ function d(r, t) {
21
21
  if (t)
22
22
  try {
23
23
  const n = f(t, r);
@@ -28,7 +28,7 @@ function p(r, t) {
28
28
  }
29
29
  function $(r, t) {
30
30
  const n = l(r), e = l(t);
31
- return n.y === e.y && n.m === e.m ? `${a[n.m - 1]} ${n.d} – ${e.d}` : n.y === e.y ? `${a[n.m - 1]} ${n.d} – ${a[e.m - 1]} ${e.d}` : `${a[n.m - 1]} ${n.d} ${n.y} – ${a[e.m - 1]} ${e.d} ${e.y}`;
31
+ return n.y === e.y ? `${a[n.m - 1]} ${n.d} – ${a[e.m - 1]} ${e.d}` : `${a[n.m - 1]} ${n.d} ${n.y} – ${a[e.m - 1]} ${e.d} ${e.y}`;
32
32
  }
33
33
  function Q(r) {
34
34
  return `Period ${r.period} (${$(r.start, r.end)})`;
@@ -52,11 +52,11 @@ function s(r) {
52
52
  function L(r, t) {
53
53
  return `P${r} ${u(t)}`;
54
54
  }
55
- function y(r, t) {
55
+ function b(r, t) {
56
56
  return `Q${r} ${u(t)}`;
57
57
  }
58
58
  function P(r) {
59
- return r.fy != null ? y(r.quarter, r.fy) : `Q${r.quarter} ${r.year}`;
59
+ return r.fy != null ? b(r.quarter, r.fy) : `Q${r.quarter} ${r.year}`;
60
60
  }
61
61
  function I(r, t = "fy-long") {
62
62
  return r.fy != null ? u(r.fy, t) : String(r.year);
@@ -77,7 +77,7 @@ function R(r, t) {
77
77
  }
78
78
  export {
79
79
  L as formatFiscalPeriodInput,
80
- y as formatFiscalQuarterInput,
80
+ b as formatFiscalQuarterInput,
81
81
  u as formatFiscalYearLabel,
82
82
  m as formatPeriodCell,
83
83
  F as formatPeriodOption,
@@ -86,5 +86,5 @@ export {
86
86
  P as formatQuarterInput,
87
87
  R as formatQuarterLabelsForYear,
88
88
  I as formatYearInput,
89
- p as formatYearIntervalCaption
89
+ d as formatYearIntervalCaption
90
90
  };
@@ -0,0 +1,16 @@
1
+ import { FiscalPeriod } from '../../../lib/fiscal-calendar';
2
+ /** Local midnight on the 15th. FY can change on the 1st of a civil month. */
3
+ export declare function midMonthDate(month: Date): Date;
4
+ export declare function civilMonthAtOffset(month: Date, offset: number): Date;
5
+ /** Civil month (0-indexed) where `period` has the most days. */
6
+ export declare function dominantCivilMonthForPeriod(period: FiscalPeriod): {
7
+ year: number;
8
+ monthIndex: number;
9
+ };
10
+ /**
11
+ * Month the week/date grid should show after picking a fiscal period.
12
+ * Dual-month range pickers pass `isRightPanel` so the period lands on the right pane.
13
+ */
14
+ export declare function visibleMonthForPeriod(period: FiscalPeriod, isRightPanel: boolean): Date;
15
+ /** Period that occupies the most days of a civil month (caption selected value). */
16
+ export declare function periodForCivilMonth(periods: readonly FiscalPeriod[], year: number, monthIndex: number): FiscalPeriod | undefined;
@@ -0,0 +1,41 @@
1
+ import { setDate as m, startOfMonth as s, addMonths as h } from "date-fns";
2
+ import { parseCivilDate as d, toCivilDate as l, lastDayOfMonth as y, compareCivil as u, diffDays as v, minCivil as M, maxCivil as p } from "../../../lib/fiscal-calendar/civil-date.js";
3
+ function x(t) {
4
+ return m(s(t), 15);
5
+ }
6
+ function b(t, n) {
7
+ return s(h(t, n));
8
+ }
9
+ function c(t, n, o, e) {
10
+ const r = l(o, e + 1, 1), a = y(o, e + 1), i = p(t, r), f = M(n, a);
11
+ return u(i, f) > 0 ? 0 : v(f, i) + 1;
12
+ }
13
+ function C(t) {
14
+ const n = d(t.start);
15
+ let o = { year: n.y, monthIndex: n.m - 1, days: 0 };
16
+ const e = t.gregorianMonthSpan.length > 0 ? t.gregorianMonthSpan : [{ year: n.y, month: n.m - 1 }];
17
+ for (const { year: r, month: a } of e) {
18
+ const i = c(t.start, t.end, r, a);
19
+ i > o.days && (o = { year: r, monthIndex: a, days: i });
20
+ }
21
+ return { year: o.year, monthIndex: o.monthIndex };
22
+ }
23
+ function I(t, n) {
24
+ const { year: o, monthIndex: e } = C(t), r = s(new Date(o, e, 1));
25
+ return n ? h(r, -1) : r;
26
+ }
27
+ function O(t, n, o) {
28
+ let e, r = 0;
29
+ for (const a of t) {
30
+ const i = c(a.start, a.end, n, o);
31
+ i > r && (e = a, r = i);
32
+ }
33
+ return e;
34
+ }
35
+ export {
36
+ b as civilMonthAtOffset,
37
+ C as dominantCivilMonthForPeriod,
38
+ x as midMonthDate,
39
+ O as periodForCivilMonth,
40
+ I as visibleMonthForPeriod
41
+ };
@@ -1,24 +1,25 @@
1
- import * as r from "react";
2
- import { civilFromLocalDate as i } from "../../../lib/fiscal-calendar/civil-date.js";
3
- import { buildFiscalYear as m } from "../../../lib/fiscal-calendar/build-year.js";
4
- import { getCellMeta as s } from "../../../lib/fiscal-calendar/lookup.js";
5
- function p(e, l) {
6
- const t = l.getFullYear(), a = r.useMemo(() => {
7
- if (e)
1
+ import * as a from "react";
2
+ import { civilFromLocalDate as o } from "../../../lib/fiscal-calendar/civil-date.js";
3
+ import { buildFiscalYear as d } from "../../../lib/fiscal-calendar/build-year.js";
4
+ import { getCellMeta as l } from "../../../lib/fiscal-calendar/lookup.js";
5
+ import { midMonthDate as n } from "./calendar-fiscal-period-nav.js";
6
+ function F(t, r) {
7
+ const m = n(r), e = (t && l(t, o(m))?.fy) ?? r.getFullYear(), u = a.useMemo(() => {
8
+ if (t)
8
9
  try {
9
- return m(e, t);
10
+ return d(t, e);
10
11
  } catch {
11
12
  return;
12
13
  }
13
- }, [e, t]), o = r.useCallback(
14
- (u) => {
15
- if (e)
16
- return s(e, i(u));
14
+ }, [t, e]), i = a.useCallback(
15
+ (s) => {
16
+ if (t)
17
+ return l(t, o(s));
17
18
  },
18
- [e]
19
+ [t]
19
20
  );
20
- return { model: a, getCellMeta: o };
21
+ return { model: u, getCellMeta: i };
21
22
  }
22
23
  export {
23
- p as useFiscalCalendar
24
+ F as useFiscalCalendar
24
25
  };