@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.
- package/dist/es/northlight.d.ts +1 -0
- package/dist/es/northlight.js +70 -29
- package/dist/es/northlight.js.map +1 -1
- package/dist/umd/northlight.cjs +70 -29
- package/dist/umd/northlight.cjs.map +1 -1
- package/dist/umd/northlight.min.cjs +3 -3
- package/dist/umd/northlight.min.cjs.map +1 -1
- package/package.json +2 -2
package/dist/es/northlight.d.ts
CHANGED
|
@@ -877,6 +877,7 @@ interface DateRangePickerProps extends Omit<AriaDateRangePickerProps<DateValue>,
|
|
|
877
877
|
maxValue?: string | undefined;
|
|
878
878
|
fiscalStartMonth?: number;
|
|
879
879
|
fiscalStartDay?: number;
|
|
880
|
+
renderInPortal?: boolean;
|
|
880
881
|
}
|
|
881
882
|
interface DatePickerFieldProps extends Omit<InputProps, 'onChange'>, InputFieldProps {
|
|
882
883
|
name: string;
|
package/dist/es/northlight.js
CHANGED
|
@@ -6895,15 +6895,16 @@ const getQuickSelectOptions = (state, locale, fiscalStartMonth, fiscalStartDay)
|
|
|
6895
6895
|
},
|
|
6896
6896
|
label: "Next Year"
|
|
6897
6897
|
};
|
|
6898
|
+
const offsetFiscalYear = thisDay.month < fiscalStartMonth || thisDay.month === fiscalStartMonth && thisDay.day < fiscalStartDay ? 1 : 0;
|
|
6898
6899
|
const thisFiscalYear = {
|
|
6899
6900
|
value: {
|
|
6900
6901
|
start: startOfMonthWithDays(
|
|
6901
|
-
startOfYear(thisDay),
|
|
6902
|
+
startOfYear(thisDay).subtract({ years: offsetFiscalYear }),
|
|
6902
6903
|
{ months: fiscalStartMonth, days: fiscalStartDay }
|
|
6903
6904
|
),
|
|
6904
6905
|
end: endOfMonthWithDays(
|
|
6905
|
-
startOfYear(thisDay),
|
|
6906
|
-
{ months: fiscalStartMonth +
|
|
6906
|
+
startOfYear(thisDay).subtract({ years: offsetFiscalYear }),
|
|
6907
|
+
{ months: fiscalStartMonth + 12, days: fiscalStartDay }
|
|
6907
6908
|
)
|
|
6908
6909
|
},
|
|
6909
6910
|
label: "This Fiscal Year"
|
|
@@ -6911,22 +6912,28 @@ const getQuickSelectOptions = (state, locale, fiscalStartMonth, fiscalStartDay)
|
|
|
6911
6912
|
const lastFiscalYear = {
|
|
6912
6913
|
value: {
|
|
6913
6914
|
start: startOfMonthWithDays(
|
|
6914
|
-
startOfYear(thisDay).subtract({ years: 1 }),
|
|
6915
|
-
{
|
|
6915
|
+
startOfYear(thisDay).subtract({ years: offsetFiscalYear + 1 }),
|
|
6916
|
+
{
|
|
6917
|
+
months: fiscalStartMonth,
|
|
6918
|
+
days: fiscalStartDay
|
|
6919
|
+
}
|
|
6916
6920
|
),
|
|
6917
6921
|
end: endOfMonthWithDays(
|
|
6918
|
-
startOfYear(thisDay).subtract({ years: 1 }),
|
|
6919
|
-
{
|
|
6922
|
+
startOfYear(thisDay).subtract({ years: offsetFiscalYear + 1 }),
|
|
6923
|
+
{
|
|
6924
|
+
months: fiscalStartMonth + 12,
|
|
6925
|
+
days: fiscalStartDay
|
|
6926
|
+
}
|
|
6920
6927
|
)
|
|
6921
6928
|
},
|
|
6922
6929
|
label: "Last Fiscal Year"
|
|
6923
6930
|
};
|
|
6924
6931
|
const yearToDate = {
|
|
6925
6932
|
value: {
|
|
6926
|
-
start: startOfMonthWithDays(
|
|
6927
|
-
|
|
6928
|
-
|
|
6929
|
-
),
|
|
6933
|
+
start: startOfMonthWithDays(startOfYear(thisDay), {
|
|
6934
|
+
months: fiscalStartMonth,
|
|
6935
|
+
days: fiscalStartDay
|
|
6936
|
+
}),
|
|
6930
6937
|
end: thisDay
|
|
6931
6938
|
},
|
|
6932
6939
|
label: "Year to Date"
|
|
@@ -6934,12 +6941,18 @@ const getQuickSelectOptions = (state, locale, fiscalStartMonth, fiscalStartDay)
|
|
|
6934
6941
|
const F1 = {
|
|
6935
6942
|
value: {
|
|
6936
6943
|
start: startOfMonthWithDays(
|
|
6937
|
-
startOfYear(thisDay),
|
|
6938
|
-
{
|
|
6944
|
+
startOfYear(thisDay).subtract({ years: offsetFiscalYear }),
|
|
6945
|
+
{
|
|
6946
|
+
months: fiscalStartMonth,
|
|
6947
|
+
days: fiscalStartDay
|
|
6948
|
+
}
|
|
6939
6949
|
),
|
|
6940
6950
|
end: endOfMonthWithDays(
|
|
6941
|
-
startOfYear(thisDay),
|
|
6942
|
-
{
|
|
6951
|
+
startOfYear(thisDay).subtract({ years: offsetFiscalYear }),
|
|
6952
|
+
{
|
|
6953
|
+
months: fiscalStartMonth + 3,
|
|
6954
|
+
days: fiscalStartDay
|
|
6955
|
+
}
|
|
6943
6956
|
)
|
|
6944
6957
|
},
|
|
6945
6958
|
label: fiscalStartMonth === 0 ? "Q1" : "FQ1"
|
|
@@ -6947,12 +6960,18 @@ const getQuickSelectOptions = (state, locale, fiscalStartMonth, fiscalStartDay)
|
|
|
6947
6960
|
const F2 = {
|
|
6948
6961
|
value: {
|
|
6949
6962
|
start: startOfMonthWithDays(
|
|
6950
|
-
startOfYear(thisDay),
|
|
6951
|
-
{
|
|
6963
|
+
startOfYear(thisDay).subtract({ years: offsetFiscalYear }),
|
|
6964
|
+
{
|
|
6965
|
+
months: fiscalStartMonth + 3,
|
|
6966
|
+
days: fiscalStartDay
|
|
6967
|
+
}
|
|
6952
6968
|
),
|
|
6953
6969
|
end: endOfMonthWithDays(
|
|
6954
|
-
startOfYear(thisDay),
|
|
6955
|
-
{
|
|
6970
|
+
startOfYear(thisDay).subtract({ years: offsetFiscalYear }),
|
|
6971
|
+
{
|
|
6972
|
+
months: fiscalStartMonth + 6,
|
|
6973
|
+
days: fiscalStartDay
|
|
6974
|
+
}
|
|
6956
6975
|
)
|
|
6957
6976
|
},
|
|
6958
6977
|
label: fiscalStartMonth === 0 ? "Q2" : "FQ2"
|
|
@@ -6960,12 +6979,18 @@ const getQuickSelectOptions = (state, locale, fiscalStartMonth, fiscalStartDay)
|
|
|
6960
6979
|
const F3 = {
|
|
6961
6980
|
value: {
|
|
6962
6981
|
start: startOfMonthWithDays(
|
|
6963
|
-
startOfYear(thisDay),
|
|
6964
|
-
{
|
|
6982
|
+
startOfYear(thisDay).subtract({ years: offsetFiscalYear }),
|
|
6983
|
+
{
|
|
6984
|
+
months: fiscalStartMonth + 6,
|
|
6985
|
+
days: fiscalStartDay
|
|
6986
|
+
}
|
|
6965
6987
|
),
|
|
6966
6988
|
end: endOfMonthWithDays(
|
|
6967
|
-
startOfYear(thisDay),
|
|
6968
|
-
{
|
|
6989
|
+
startOfYear(thisDay).subtract({ years: offsetFiscalYear }),
|
|
6990
|
+
{
|
|
6991
|
+
months: fiscalStartMonth + 9,
|
|
6992
|
+
days: fiscalStartDay
|
|
6993
|
+
}
|
|
6969
6994
|
)
|
|
6970
6995
|
},
|
|
6971
6996
|
label: fiscalStartMonth === 0 ? "Q3" : "FQ3"
|
|
@@ -6973,12 +6998,18 @@ const getQuickSelectOptions = (state, locale, fiscalStartMonth, fiscalStartDay)
|
|
|
6973
6998
|
const F4 = {
|
|
6974
6999
|
value: {
|
|
6975
7000
|
start: startOfMonthWithDays(
|
|
6976
|
-
startOfYear(thisDay),
|
|
6977
|
-
{
|
|
7001
|
+
startOfYear(thisDay).subtract({ years: offsetFiscalYear }),
|
|
7002
|
+
{
|
|
7003
|
+
months: fiscalStartMonth + 9,
|
|
7004
|
+
days: fiscalStartDay
|
|
7005
|
+
}
|
|
6978
7006
|
),
|
|
6979
7007
|
end: endOfMonthWithDays(
|
|
6980
|
-
startOfYear(thisDay),
|
|
6981
|
-
{
|
|
7008
|
+
startOfYear(thisDay).subtract({ years: offsetFiscalYear }),
|
|
7009
|
+
{
|
|
7010
|
+
months: fiscalStartMonth + 12,
|
|
7011
|
+
days: fiscalStartDay
|
|
7012
|
+
}
|
|
6982
7013
|
)
|
|
6983
7014
|
},
|
|
6984
7015
|
label: fiscalStartMonth === 0 ? "Q4" : "FQ4"
|
|
@@ -7202,6 +7233,15 @@ const parseValue = (value) => {
|
|
|
7202
7233
|
return null;
|
|
7203
7234
|
return { start: parseDate(value.startDate), end: parseDate(value.endDate) };
|
|
7204
7235
|
};
|
|
7236
|
+
const PortalWrapper = ({
|
|
7237
|
+
renderInPortal,
|
|
7238
|
+
children
|
|
7239
|
+
}) => {
|
|
7240
|
+
if (renderInPortal) {
|
|
7241
|
+
return /* @__PURE__ */ React.createElement(Portal, null, children);
|
|
7242
|
+
}
|
|
7243
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, children);
|
|
7244
|
+
};
|
|
7205
7245
|
const DateRangePicker = (props) => {
|
|
7206
7246
|
const {
|
|
7207
7247
|
isDisabled,
|
|
@@ -7215,7 +7255,8 @@ const DateRangePicker = (props) => {
|
|
|
7215
7255
|
onChange: onChangeCallback = identity,
|
|
7216
7256
|
value,
|
|
7217
7257
|
minValue = "1994-03-08",
|
|
7218
|
-
maxValue
|
|
7258
|
+
maxValue,
|
|
7259
|
+
renderInPortal = false
|
|
7219
7260
|
} = props;
|
|
7220
7261
|
const ref = useRef();
|
|
7221
7262
|
const { group } = useMultiStyleConfig("DatePicker");
|
|
@@ -7286,7 +7327,7 @@ const DateRangePicker = (props) => {
|
|
|
7286
7327
|
icon: /* @__PURE__ */ React.createElement(Icon$1, { as: XCloseSolid })
|
|
7287
7328
|
}
|
|
7288
7329
|
))),
|
|
7289
|
-
/* @__PURE__ */ React.createElement(
|
|
7330
|
+
/* @__PURE__ */ React.createElement(PortalWrapper, { renderInPortal }, state.isOpen && /* @__PURE__ */ React.createElement(PopoverContent, __spreadProps$d(__spreadValues$1o({}, dialogProps), { ref, w: "max-content" }), /* @__PURE__ */ React.createElement(FocusScope, { contain: true, restoreFocus: true }, /* @__PURE__ */ React.createElement(
|
|
7290
7331
|
RangeCalendar,
|
|
7291
7332
|
__spreadProps$d(__spreadValues$1o({}, calendarProps), {
|
|
7292
7333
|
resetDate,
|