@northlight/ui 2.14.0 → 2.14.2
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.js
CHANGED
|
@@ -3265,12 +3265,10 @@ const MonthSelect = ({
|
|
|
3265
3265
|
const { dateSelect } = useMultiStyleConfig("Calendar");
|
|
3266
3266
|
const start = state.visibleRange.start.add({ months: offset }).month - 1;
|
|
3267
3267
|
const [selectedIndex, setSelectedIndex] = useState(start);
|
|
3268
|
-
const [isEditing, setIsEditing] = useState(false);
|
|
3269
3268
|
const moveStartDateBy = (inp) => state.visibleRange.start.add(inp);
|
|
3270
3269
|
const onChange = (e) => {
|
|
3271
3270
|
const index = Number(e.target.value);
|
|
3272
3271
|
setSelectedIndex(index);
|
|
3273
|
-
setIsEditing(false);
|
|
3274
3272
|
const diff = index - start;
|
|
3275
3273
|
state.setFocusedDate(moveStartDateBy({ months: diff }));
|
|
3276
3274
|
};
|
|
@@ -3279,31 +3277,21 @@ const MonthSelect = ({
|
|
|
3279
3277
|
state.visibleRange.start.add({ months: offset }).month - 1
|
|
3280
3278
|
);
|
|
3281
3279
|
}, [state.visibleRange]);
|
|
3282
|
-
const handleKeyDown = (e) => {
|
|
3283
|
-
switch (e.key) {
|
|
3284
|
-
case "ArrowDown":
|
|
3285
|
-
case "ArrowUp":
|
|
3286
|
-
case " ":
|
|
3287
|
-
setIsEditing((prev) => !prev);
|
|
3288
|
-
break;
|
|
3289
|
-
}
|
|
3290
|
-
};
|
|
3291
3280
|
return /* @__PURE__ */ React.createElement(
|
|
3292
3281
|
Select$2,
|
|
3293
3282
|
{
|
|
3294
3283
|
id: "month",
|
|
3295
3284
|
"aria-label": "Select Month",
|
|
3296
3285
|
onChange,
|
|
3297
|
-
onClick: () => setIsEditing((prev) => !prev),
|
|
3298
|
-
onKeyDown: handleKeyDown,
|
|
3299
3286
|
value: selectedIndex,
|
|
3300
3287
|
iconSize: "0px",
|
|
3301
3288
|
size: "sm",
|
|
3302
3289
|
variant: "unstyled",
|
|
3303
3290
|
sx: dateSelect,
|
|
3304
|
-
w: "max-content"
|
|
3291
|
+
w: "max-content",
|
|
3292
|
+
textAlign: "center"
|
|
3305
3293
|
},
|
|
3306
|
-
|
|
3294
|
+
months.map((month, i) => /* @__PURE__ */ React.createElement("option", { key: month, value: i }, month))
|
|
3307
3295
|
);
|
|
3308
3296
|
};
|
|
3309
3297
|
|
|
@@ -4021,7 +4009,7 @@ const ButtonRow = ({
|
|
|
4021
4009
|
},
|
|
4022
4010
|
/* @__PURE__ */ React.createElement(Icon$1, { as: icon, color: "blue.500", size: "lg" }),
|
|
4023
4011
|
dates.map(
|
|
4024
|
-
(date) => validRange(date.value, state) && /* @__PURE__ */ React.createElement(MoveButton, __spreadValues$1f({}, getMethods(date)), date.label)
|
|
4012
|
+
(date) => validRange(date.value, state) && /* @__PURE__ */ React.createElement(Box, { ml: "1", display: "inline" }, /* @__PURE__ */ React.createElement(MoveButton, __spreadValues$1f({}, getMethods(date)), date.label))
|
|
4025
4013
|
)
|
|
4026
4014
|
);
|
|
4027
4015
|
|
|
@@ -4147,15 +4135,16 @@ const AdjustRange = ({ state, adjust = "start" }) => {
|
|
|
4147
4135
|
const getMethodsEnd = (date) => ({
|
|
4148
4136
|
onClick: updateDate(date.value, false)
|
|
4149
4137
|
});
|
|
4138
|
+
const showAdjust = state.value !== null && state.highlightedRange !== null && equals(state.value, state.highlightedRange);
|
|
4150
4139
|
return /* @__PURE__ */ React.createElement(
|
|
4151
4140
|
Stack,
|
|
4152
4141
|
{
|
|
4153
4142
|
spacing: 2,
|
|
4154
|
-
visibility:
|
|
4143
|
+
visibility: showAdjust ? "visible" : "hidden",
|
|
4155
4144
|
pt: "2"
|
|
4156
4145
|
},
|
|
4157
4146
|
/* @__PURE__ */ React.createElement(Clickable, { onClick: () => setIsOpen((prev) => !prev) }, /* @__PURE__ */ React.createElement(HStack, null, /* @__PURE__ */ React.createElement(P$1, { variant: "14" }, "Adjust ", adjust), /* @__PURE__ */ React.createElement(Icon$1, { as: isOpen ? ChevronUpSolid : ChevronDownSolid, size: "xs" }))),
|
|
4158
|
-
/* @__PURE__ */ React.createElement(SlideFade, { in: isOpen, direction: "top", hideDisplay: true }, adjust === "start" && /* @__PURE__ */ React.createElement(Stack, { minH: "91px" }, /* @__PURE__ */ React.createElement(Lead$1, { sx: { fontSize: "12px" } }, "Move date"), /* @__PURE__ */ React.createElement(
|
|
4147
|
+
/* @__PURE__ */ React.createElement(SlideFade, { in: isOpen, direction: "top", hideDisplay: true }, adjust === "start" && /* @__PURE__ */ React.createElement(Stack, { minH: "91px" }, /* @__PURE__ */ React.createElement(Lead$1, { sx: { fontSize: "12px" } }, "Move date by"), /* @__PURE__ */ React.createElement(
|
|
4159
4148
|
ButtonRow,
|
|
4160
4149
|
{
|
|
4161
4150
|
icon: ArrowCircleLeftDuo,
|
|
@@ -4171,7 +4160,7 @@ const AdjustRange = ({ state, adjust = "start" }) => {
|
|
|
4171
4160
|
getMethods: getMethodsStart,
|
|
4172
4161
|
state
|
|
4173
4162
|
}
|
|
4174
|
-
)), adjust === "end" && /* @__PURE__ */ React.createElement(Stack, { minH: "91px" }, /* @__PURE__ */ React.createElement(Lead$1, { sx: { fontSize: "12px" } }, "Move date"), /* @__PURE__ */ React.createElement(
|
|
4163
|
+
)), adjust === "end" && /* @__PURE__ */ React.createElement(Stack, { minH: "91px" }, /* @__PURE__ */ React.createElement(Lead$1, { sx: { fontSize: "12px" } }, "Move date by"), /* @__PURE__ */ React.createElement(
|
|
4175
4164
|
ButtonRow,
|
|
4176
4165
|
{
|
|
4177
4166
|
icon: ArrowCircleLeftDuo,
|
|
@@ -4444,7 +4433,7 @@ const getQuickSelectOptions = (state, locale, fiscalStartMonth, fiscalStartDay)
|
|
|
4444
4433
|
),
|
|
4445
4434
|
end: endOfMonthWithDays(
|
|
4446
4435
|
startOfYear(thisDay),
|
|
4447
|
-
{ months: fiscalStartMonth +
|
|
4436
|
+
{ months: fiscalStartMonth + 3, days: fiscalStartDay }
|
|
4448
4437
|
)
|
|
4449
4438
|
},
|
|
4450
4439
|
label: fiscalStartMonth === 0 ? "Q1" : "FQ1"
|
|
@@ -4457,7 +4446,7 @@ const getQuickSelectOptions = (state, locale, fiscalStartMonth, fiscalStartDay)
|
|
|
4457
4446
|
),
|
|
4458
4447
|
end: endOfMonthWithDays(
|
|
4459
4448
|
startOfYear(thisDay),
|
|
4460
|
-
{ months: fiscalStartMonth +
|
|
4449
|
+
{ months: fiscalStartMonth + 6, days: fiscalStartDay }
|
|
4461
4450
|
)
|
|
4462
4451
|
},
|
|
4463
4452
|
label: fiscalStartMonth === 0 ? "Q2" : "FQ2"
|
|
@@ -4470,7 +4459,7 @@ const getQuickSelectOptions = (state, locale, fiscalStartMonth, fiscalStartDay)
|
|
|
4470
4459
|
),
|
|
4471
4460
|
end: endOfMonthWithDays(
|
|
4472
4461
|
startOfYear(thisDay),
|
|
4473
|
-
{ months: fiscalStartMonth +
|
|
4462
|
+
{ months: fiscalStartMonth + 9, days: fiscalStartDay }
|
|
4474
4463
|
)
|
|
4475
4464
|
},
|
|
4476
4465
|
label: fiscalStartMonth === 0 ? "Q3" : "FQ3"
|
|
@@ -4483,7 +4472,7 @@ const getQuickSelectOptions = (state, locale, fiscalStartMonth, fiscalStartDay)
|
|
|
4483
4472
|
),
|
|
4484
4473
|
end: endOfMonthWithDays(
|
|
4485
4474
|
startOfYear(thisDay),
|
|
4486
|
-
{ months: fiscalStartMonth +
|
|
4475
|
+
{ months: fiscalStartMonth + 12, days: fiscalStartDay }
|
|
4487
4476
|
)
|
|
4488
4477
|
},
|
|
4489
4478
|
label: fiscalStartMonth === 0 ? "Q4" : "FQ4"
|