@northlight/ui 2.24.4 → 2.24.6

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.
@@ -6858,15 +6858,16 @@
6858
6858
  },
6859
6859
  label: "Next Year"
6860
6860
  };
6861
+ const offsetFiscalYear = thisDay.month < fiscalStartMonth || thisDay.month === fiscalStartMonth && thisDay.day < fiscalStartDay ? 1 : 0;
6861
6862
  const thisFiscalYear = {
6862
6863
  value: {
6863
6864
  start: startOfMonthWithDays(
6864
- date.startOfYear(thisDay),
6865
+ date.startOfYear(thisDay).subtract({ years: offsetFiscalYear }),
6865
6866
  { months: fiscalStartMonth, days: fiscalStartDay }
6866
6867
  ),
6867
6868
  end: endOfMonthWithDays(
6868
- date.startOfYear(thisDay),
6869
- { months: fiscalStartMonth + 11, days: fiscalStartDay }
6869
+ date.startOfYear(thisDay).subtract({ years: offsetFiscalYear }),
6870
+ { months: fiscalStartMonth + 12, days: fiscalStartDay }
6870
6871
  )
6871
6872
  },
6872
6873
  label: "This Fiscal Year"
@@ -6874,22 +6875,28 @@
6874
6875
  const lastFiscalYear = {
6875
6876
  value: {
6876
6877
  start: startOfMonthWithDays(
6877
- date.startOfYear(thisDay).subtract({ years: 1 }),
6878
- { months: fiscalStartMonth, days: fiscalStartDay - 1 }
6878
+ date.startOfYear(thisDay).subtract({ years: offsetFiscalYear + 1 }),
6879
+ {
6880
+ months: fiscalStartMonth,
6881
+ days: fiscalStartDay
6882
+ }
6879
6883
  ),
6880
6884
  end: endOfMonthWithDays(
6881
- date.startOfYear(thisDay).subtract({ years: 1 }),
6882
- { months: fiscalStartMonth + 11, days: fiscalStartDay }
6885
+ date.startOfYear(thisDay).subtract({ years: offsetFiscalYear + 1 }),
6886
+ {
6887
+ months: fiscalStartMonth + 12,
6888
+ days: fiscalStartDay
6889
+ }
6883
6890
  )
6884
6891
  },
6885
6892
  label: "Last Fiscal Year"
6886
6893
  };
6887
6894
  const yearToDate = {
6888
6895
  value: {
6889
- start: startOfMonthWithDays(
6890
- date.startOfYear(thisDay),
6891
- { months: fiscalStartMonth, days: fiscalStartDay }
6892
- ),
6896
+ start: startOfMonthWithDays(date.startOfYear(thisDay), {
6897
+ months: fiscalStartMonth,
6898
+ days: fiscalStartDay
6899
+ }),
6893
6900
  end: thisDay
6894
6901
  },
6895
6902
  label: "Year to Date"
@@ -6897,12 +6904,18 @@
6897
6904
  const F1 = {
6898
6905
  value: {
6899
6906
  start: startOfMonthWithDays(
6900
- date.startOfYear(thisDay),
6901
- { months: fiscalStartMonth, days: fiscalStartDay }
6907
+ date.startOfYear(thisDay).subtract({ years: offsetFiscalYear }),
6908
+ {
6909
+ months: fiscalStartMonth,
6910
+ days: fiscalStartDay
6911
+ }
6902
6912
  ),
6903
6913
  end: endOfMonthWithDays(
6904
- date.startOfYear(thisDay),
6905
- { months: fiscalStartMonth + 3, days: fiscalStartDay }
6914
+ date.startOfYear(thisDay).subtract({ years: offsetFiscalYear }),
6915
+ {
6916
+ months: fiscalStartMonth + 3,
6917
+ days: fiscalStartDay
6918
+ }
6906
6919
  )
6907
6920
  },
6908
6921
  label: fiscalStartMonth === 0 ? "Q1" : "FQ1"
@@ -6910,12 +6923,18 @@
6910
6923
  const F2 = {
6911
6924
  value: {
6912
6925
  start: startOfMonthWithDays(
6913
- date.startOfYear(thisDay),
6914
- { months: fiscalStartMonth + 3, days: fiscalStartDay }
6926
+ date.startOfYear(thisDay).subtract({ years: offsetFiscalYear }),
6927
+ {
6928
+ months: fiscalStartMonth + 3,
6929
+ days: fiscalStartDay
6930
+ }
6915
6931
  ),
6916
6932
  end: endOfMonthWithDays(
6917
- date.startOfYear(thisDay),
6918
- { months: fiscalStartMonth + 6, days: fiscalStartDay }
6933
+ date.startOfYear(thisDay).subtract({ years: offsetFiscalYear }),
6934
+ {
6935
+ months: fiscalStartMonth + 6,
6936
+ days: fiscalStartDay
6937
+ }
6919
6938
  )
6920
6939
  },
6921
6940
  label: fiscalStartMonth === 0 ? "Q2" : "FQ2"
@@ -6923,12 +6942,18 @@
6923
6942
  const F3 = {
6924
6943
  value: {
6925
6944
  start: startOfMonthWithDays(
6926
- date.startOfYear(thisDay),
6927
- { months: fiscalStartMonth + 6, days: fiscalStartDay }
6945
+ date.startOfYear(thisDay).subtract({ years: offsetFiscalYear }),
6946
+ {
6947
+ months: fiscalStartMonth + 6,
6948
+ days: fiscalStartDay
6949
+ }
6928
6950
  ),
6929
6951
  end: endOfMonthWithDays(
6930
- date.startOfYear(thisDay),
6931
- { months: fiscalStartMonth + 9, days: fiscalStartDay }
6952
+ date.startOfYear(thisDay).subtract({ years: offsetFiscalYear }),
6953
+ {
6954
+ months: fiscalStartMonth + 9,
6955
+ days: fiscalStartDay
6956
+ }
6932
6957
  )
6933
6958
  },
6934
6959
  label: fiscalStartMonth === 0 ? "Q3" : "FQ3"
@@ -6936,12 +6961,18 @@
6936
6961
  const F4 = {
6937
6962
  value: {
6938
6963
  start: startOfMonthWithDays(
6939
- date.startOfYear(thisDay),
6940
- { months: fiscalStartMonth + 9, days: fiscalStartDay }
6964
+ date.startOfYear(thisDay).subtract({ years: offsetFiscalYear }),
6965
+ {
6966
+ months: fiscalStartMonth + 9,
6967
+ days: fiscalStartDay
6968
+ }
6941
6969
  ),
6942
6970
  end: endOfMonthWithDays(
6943
- date.startOfYear(thisDay),
6944
- { months: fiscalStartMonth + 12, days: fiscalStartDay }
6971
+ date.startOfYear(thisDay).subtract({ years: offsetFiscalYear }),
6972
+ {
6973
+ months: fiscalStartMonth + 12,
6974
+ days: fiscalStartDay
6975
+ }
6945
6976
  )
6946
6977
  },
6947
6978
  label: fiscalStartMonth === 0 ? "Q4" : "FQ4"
@@ -7165,6 +7196,15 @@
7165
7196
  return null;
7166
7197
  return { start: date.parseDate(value.startDate), end: date.parseDate(value.endDate) };
7167
7198
  };
7199
+ const PortalWrapper = ({
7200
+ renderInPortal,
7201
+ children
7202
+ }) => {
7203
+ if (renderInPortal) {
7204
+ return /* @__PURE__ */ React.createElement(react.Portal, null, children);
7205
+ }
7206
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, children);
7207
+ };
7168
7208
  const DateRangePicker = (props) => {
7169
7209
  const {
7170
7210
  isDisabled,
@@ -7178,7 +7218,8 @@
7178
7218
  onChange: onChangeCallback = ramda.identity,
7179
7219
  value,
7180
7220
  minValue = "1994-03-08",
7181
- maxValue
7221
+ maxValue,
7222
+ renderInPortal = false
7182
7223
  } = props;
7183
7224
  const ref = React.useRef();
7184
7225
  const { group } = react.useMultiStyleConfig("DatePicker");
@@ -7249,7 +7290,7 @@
7249
7290
  icon: /* @__PURE__ */ React.createElement(Icon$1, { as: icons.XCloseSolid })
7250
7291
  }
7251
7292
  ))),
7252
- /* @__PURE__ */ React.createElement(react.Portal, null, state.isOpen && /* @__PURE__ */ React.createElement(react.PopoverContent, __spreadProps$d(__spreadValues$1o({}, dialogProps), { ref, w: "max-content" }), /* @__PURE__ */ React.createElement(focus.FocusScope, { contain: true, restoreFocus: true }, /* @__PURE__ */ React.createElement(
7293
+ /* @__PURE__ */ React.createElement(PortalWrapper, { renderInPortal }, state.isOpen && /* @__PURE__ */ React.createElement(react.PopoverContent, __spreadProps$d(__spreadValues$1o({}, dialogProps), { ref, w: "max-content" }), /* @__PURE__ */ React.createElement(focus.FocusScope, { contain: true, restoreFocus: true }, /* @__PURE__ */ React.createElement(
7253
7294
  RangeCalendar,
7254
7295
  __spreadProps$d(__spreadValues$1o({}, calendarProps), {
7255
7296
  resetDate,