@navikt/ds-react 5.7.2 → 5.7.3
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/_docs.json +4 -4
- package/cjs/date/datepicker/DatePicker.js +6 -6
- package/cjs/date/datepicker/DatePickerStandalone.js +4 -4
- package/cjs/date/hooks/useDatepicker.js +5 -4
- package/cjs/date/hooks/useMonthPicker.js +4 -3
- package/cjs/date/hooks/useRangeDatepicker.js +1 -1
- package/cjs/date/monthpicker/MonthCaption.js +7 -7
- package/cjs/date/utils/navigation.js +6 -6
- package/cjs/form/Select.js +1 -1
- package/cjs/form/TextField.js +1 -1
- package/cjs/form/Textarea.js +1 -1
- package/cjs/form/combobox/Input/Input.js +1 -1
- package/cjs/form/combobox/Input/inputContext.js +4 -4
- package/cjs/form/combobox/SelectedOptions/selectedOptionsContext.js +3 -3
- package/cjs/form/search/Search.js +1 -1
- package/cjs/help-text/HelpText.js +1 -1
- package/cjs/help-text/HelpTextIcon.js +1 -1
- package/cjs/table/ExpandableRow.js +2 -2
- package/cjs/tabs/TabList.js +3 -3
- package/cjs/timeline/Timeline.js +6 -6
- package/cjs/timeline/hooks/useTimelineRows.js +1 -2
- package/cjs/util/omit.js +1 -1
- package/esm/date/datepicker/DatePicker.js +6 -6
- package/esm/date/datepicker/DatePicker.js.map +1 -1
- package/esm/date/datepicker/DatePickerStandalone.js +4 -4
- package/esm/date/datepicker/DatePickerStandalone.js.map +1 -1
- package/esm/date/hooks/useDatepicker.js +5 -4
- package/esm/date/hooks/useDatepicker.js.map +1 -1
- package/esm/date/hooks/useMonthPicker.js +4 -3
- package/esm/date/hooks/useMonthPicker.js.map +1 -1
- package/esm/date/hooks/useRangeDatepicker.js +3 -3
- package/esm/date/hooks/useRangeDatepicker.js.map +1 -1
- package/esm/date/monthpicker/MonthCaption.js +7 -7
- package/esm/date/monthpicker/MonthCaption.js.map +1 -1
- package/esm/date/utils/navigation.js +6 -6
- package/esm/date/utils/navigation.js.map +1 -1
- package/esm/form/Select.js +1 -1
- package/esm/form/Select.js.map +1 -1
- package/esm/form/TextField.js +1 -1
- package/esm/form/TextField.js.map +1 -1
- package/esm/form/Textarea.js +1 -1
- package/esm/form/Textarea.js.map +1 -1
- package/esm/form/combobox/Input/Input.js +1 -1
- package/esm/form/combobox/Input/Input.js.map +1 -1
- package/esm/form/combobox/Input/inputContext.js +4 -4
- package/esm/form/combobox/Input/inputContext.js.map +1 -1
- package/esm/form/combobox/SelectedOptions/selectedOptionsContext.js +3 -3
- package/esm/form/combobox/SelectedOptions/selectedOptionsContext.js.map +1 -1
- package/esm/form/search/Search.js +1 -1
- package/esm/form/search/Search.js.map +1 -1
- package/esm/help-text/HelpText.js +1 -1
- package/esm/help-text/HelpText.js.map +1 -1
- package/esm/help-text/HelpTextIcon.js +1 -1
- package/esm/help-text/HelpTextIcon.js.map +1 -1
- package/esm/layout/utilities/css.d.ts +1 -1
- package/esm/layout/utilities/css.js.map +1 -1
- package/esm/table/ExpandableRow.js +2 -2
- package/esm/table/ExpandableRow.js.map +1 -1
- package/esm/tabs/TabList.js +3 -3
- package/esm/tabs/TabList.js.map +1 -1
- package/esm/timeline/Timeline.d.ts +2 -2
- package/esm/timeline/Timeline.js +6 -6
- package/esm/timeline/Timeline.js.map +1 -1
- package/esm/timeline/hooks/useTimelineRows.js +1 -2
- package/esm/timeline/hooks/useTimelineRows.js.map +1 -1
- package/esm/util/omit.js +1 -1
- package/esm/util/omit.js.map +1 -1
- package/package.json +3 -3
- package/src/chips/chips.stories.tsx +13 -15
- package/src/date/datepicker/DatePicker.tsx +6 -6
- package/src/date/datepicker/DatePickerStandalone.tsx +4 -4
- package/src/date/hooks/useDatepicker.tsx +5 -4
- package/src/date/hooks/useMonthPicker.tsx +4 -3
- package/src/date/hooks/useRangeDatepicker.tsx +3 -3
- package/src/date/monthpicker/MonthCaption.tsx +9 -9
- package/src/date/utils/__tests__/get-month-weeks.test.ts +10 -7
- package/src/date/utils/navigation.ts +6 -6
- package/src/form/Select.tsx +1 -1
- package/src/form/TextField.tsx +1 -1
- package/src/form/Textarea.tsx +1 -1
- package/src/form/combobox/Input/Input.tsx +1 -1
- package/src/form/combobox/Input/inputContext.tsx +4 -4
- package/src/form/combobox/SelectedOptions/selectedOptionsContext.tsx +5 -5
- package/src/form/search/Search.tsx +1 -1
- package/src/form/stories/textarea.stories.tsx +21 -37
- package/src/help-text/HelpText.tsx +1 -0
- package/src/help-text/HelpTextIcon.tsx +1 -1
- package/src/layout/utilities/css.ts +1 -0
- package/src/table/ExpandableRow.tsx +2 -2
- package/src/table/stories/table-async.stories.tsx +4 -4
- package/src/table/stories/table-expandable.stories.tsx +26 -26
- package/src/table/stories/table.stories.tsx +4 -4
- package/src/tabs/TabList.tsx +4 -4
- package/src/timeline/Timeline.tsx +8 -8
- package/src/timeline/hooks/useTimelineRows.ts +1 -2
- package/src/util/omit.ts +2 -2
package/_docs.json
CHANGED
|
@@ -16803,7 +16803,7 @@
|
|
|
16803
16803
|
],
|
|
16804
16804
|
"required": false,
|
|
16805
16805
|
"type": {
|
|
16806
|
-
"name": "ResponsiveProp<BleedSpacingInline | \"full full\" | \"full px\" | \"full 0\" | \"full 05\" | \"full 1\" | \"full
|
|
16806
|
+
"name": "ResponsiveProp<BleedSpacingInline | \"full full\" | \"full px\" | \"full 0\" | \"full 05\" | \"full 1\" | \"full 1-alt\" | \"full 2\" | \"full 3\" | \"full 4\" | \"full 5\" | \"full 6\" | ... 517 more ... | \"32 32\">"
|
|
16807
16807
|
}
|
|
16808
16808
|
},
|
|
16809
16809
|
"marginBlock": {
|
|
@@ -16822,7 +16822,7 @@
|
|
|
16822
16822
|
],
|
|
16823
16823
|
"required": false,
|
|
16824
16824
|
"type": {
|
|
16825
|
-
"name": "ResponsiveProp<\"px px\" | \"px 0\" | \"px 05\" | \"px 1\" | \"px 2\" | \"px 3\" | \"px 4\" | \"px 5\" | \"px 6\" | \"px 7\" | \"px 8\" | \"px 9\" | \"px 10\" | \"px 11\" | \"px 12\" | \"px 14\" | \"px 16\" | \"px 18\" |
|
|
16825
|
+
"name": "ResponsiveProp<\"px px\" | \"px 0\" | \"px 05\" | \"px 1\" | \"px 1-alt\" | \"px 2\" | \"px 3\" | \"px 4\" | \"px 5\" | \"px 6\" | \"px 7\" | \"px 8\" | \"px 9\" | \"px 10\" | \"px 11\" | \"px 12\" | \"px 14\" | \"px 16\" | \"px 18\" | ... 465 more ... | BleedSpacingBlock>"
|
|
16826
16826
|
}
|
|
16827
16827
|
},
|
|
16828
16828
|
"reflectivePadding": {
|
|
@@ -17018,7 +17018,7 @@
|
|
|
17018
17018
|
],
|
|
17019
17019
|
"required": false,
|
|
17020
17020
|
"type": {
|
|
17021
|
-
"name": "ResponsiveProp<\"0 0\" | \"0 1\" | \"0 2\" | \"0 3\" | \"0 4\" | \"0 5\" | \"1 0\" | \"1 1\" | \"1 2\" | \"1 3\" | \"1 4\" | \"1 5\" | \"2 0\" | \"2 1\" | \"2 2\" | \"2 3\" | \"2 4\" | \"2 5\" | \"3 0\" | \"3 1\" | \"3 2\" | \"3 3\" | \"3 4\" | ...
|
|
17021
|
+
"name": "ResponsiveProp<\"0 0\" | \"0 1\" | \"0 2\" | \"0 3\" | \"0 4\" | \"0 5\" | \"1 0\" | \"1 1\" | \"1 2\" | \"1 3\" | \"1 4\" | \"1 5\" | \"2 0\" | \"2 1\" | \"2 2\" | \"2 3\" | \"2 4\" | \"2 5\" | \"3 0\" | \"3 1\" | \"3 2\" | \"3 3\" | \"3 4\" | ... 418 more ... | \"32 32\">"
|
|
17022
17022
|
}
|
|
17023
17023
|
},
|
|
17024
17024
|
"paddingBlock": {
|
|
@@ -17037,7 +17037,7 @@
|
|
|
17037
17037
|
],
|
|
17038
17038
|
"required": false,
|
|
17039
17039
|
"type": {
|
|
17040
|
-
"name": "ResponsiveProp<\"0 0\" | \"0 1\" | \"0 2\" | \"0 3\" | \"0 4\" | \"0 5\" | \"1 0\" | \"1 1\" | \"1 2\" | \"1 3\" | \"1 4\" | \"1 5\" | \"2 0\" | \"2 1\" | \"2 2\" | \"2 3\" | \"2 4\" | \"2 5\" | \"3 0\" | \"3 1\" | \"3 2\" | \"3 3\" | \"3 4\" | ...
|
|
17040
|
+
"name": "ResponsiveProp<\"0 0\" | \"0 1\" | \"0 2\" | \"0 3\" | \"0 4\" | \"0 5\" | \"1 0\" | \"1 1\" | \"1 2\" | \"1 3\" | \"1 4\" | \"1 5\" | \"2 0\" | \"2 1\" | \"2 2\" | \"2 3\" | \"2 4\" | \"2 5\" | \"3 0\" | \"3 1\" | \"3 2\" | \"3 3\" | \"3 4\" | ... 418 more ... | \"32 32\">"
|
|
17041
17041
|
}
|
|
17042
17042
|
},
|
|
17043
17043
|
"shadow": {
|
|
@@ -86,18 +86,18 @@ exports.DatePicker = (0, react_1.forwardRef)((_a, ref) => {
|
|
|
86
86
|
const [selectedDates, setSelectedDates] = react_1.default.useState(defaultSelected);
|
|
87
87
|
const mode = (_b = rest.mode) !== null && _b !== void 0 ? _b : "single";
|
|
88
88
|
/**
|
|
89
|
-
* @param
|
|
89
|
+
* @param newSelected Date | Date[] | DateRange | undefined
|
|
90
90
|
*/
|
|
91
|
-
const handleSelect = (
|
|
91
|
+
const handleSelect = (newSelected) => {
|
|
92
92
|
var _a, _b, _c;
|
|
93
|
-
setSelectedDates(
|
|
93
|
+
setSelectedDates(newSelected);
|
|
94
94
|
if (rest.mode === "single") {
|
|
95
|
-
|
|
95
|
+
newSelected && ((_a = onClose === null || onClose === void 0 ? void 0 : onClose()) !== null && _a !== void 0 ? _a : setOpen(false));
|
|
96
96
|
}
|
|
97
97
|
else if (rest.mode === "range") {
|
|
98
|
-
(
|
|
98
|
+
(newSelected === null || newSelected === void 0 ? void 0 : newSelected.from) && (newSelected === null || newSelected === void 0 ? void 0 : newSelected.to) && ((_b = onClose === null || onClose === void 0 ? void 0 : onClose()) !== null && _b !== void 0 ? _b : setOpen(false));
|
|
99
99
|
}
|
|
100
|
-
(_c = rest === null || rest === void 0 ? void 0 : rest.onSelect) === null || _c === void 0 ? void 0 : _c.call(rest,
|
|
100
|
+
(_c = rest === null || rest === void 0 ? void 0 : rest.onSelect) === null || _c === void 0 ? void 0 : _c.call(rest, newSelected);
|
|
101
101
|
};
|
|
102
102
|
return (react_1.default.createElement(context_1.DateContext.Provider, { value: {
|
|
103
103
|
open: _open !== null && _open !== void 0 ? _open : open,
|
|
@@ -57,11 +57,11 @@ exports.DatePickerStandalone = (0, react_1.forwardRef)((_a, ref) => {
|
|
|
57
57
|
const [selectedDates, setSelectedDates] = react_1.default.useState(defaultSelected);
|
|
58
58
|
const mode = (_b = rest.mode) !== null && _b !== void 0 ? _b : "single";
|
|
59
59
|
/**
|
|
60
|
-
* @param
|
|
60
|
+
* @param newSelected Date | Date[] | DateRange | undefined
|
|
61
61
|
*/
|
|
62
|
-
const handleSelect = (
|
|
63
|
-
setSelectedDates(
|
|
64
|
-
onSelect === null || onSelect === void 0 ? void 0 : onSelect(
|
|
62
|
+
const handleSelect = (newSelected) => {
|
|
63
|
+
setSelectedDates(newSelected);
|
|
64
|
+
onSelect === null || onSelect === void 0 ? void 0 : onSelect(newSelected);
|
|
65
65
|
};
|
|
66
66
|
return (react_1.default.createElement("div", { ref: ref, className: (0, clsx_1.default)("navds-date__standalone-wrapper", className) },
|
|
67
67
|
react_1.default.createElement(react_day_picker_1.DayPicker, Object.assign({ locale: (0, utils_1.getLocaleFromString)(locale), mode: mode, onSelect: handleSelect, selected: selected !== null && selected !== void 0 ? selected : selectedDates, components: {
|
|
@@ -40,10 +40,11 @@ const useDatepicker = (opt = {}) => {
|
|
|
40
40
|
? (0, utils_1.formatDateForInput)(defaultSelected, locale, "date", inputFormat)
|
|
41
41
|
: "";
|
|
42
42
|
const [inputValue, setInputValue] = (0, react_1.useState)(defaultInputValue);
|
|
43
|
-
const handleOpen = (0, react_1.useCallback)((
|
|
43
|
+
const handleOpen = (0, react_1.useCallback)((newOpen) => {
|
|
44
44
|
var _a, _b;
|
|
45
|
-
setOpen(
|
|
46
|
-
|
|
45
|
+
setOpen(newOpen);
|
|
46
|
+
newOpen &&
|
|
47
|
+
setMonth((_b = (_a = selectedDay !== null && selectedDay !== void 0 ? selectedDay : defaultSelected) !== null && _a !== void 0 ? _a : defaultMonth) !== null && _b !== void 0 ? _b : today);
|
|
47
48
|
}, [defaultMonth, defaultSelected, selectedDay, today]);
|
|
48
49
|
(0, useOutsideClickHandler_1.useOutsideClickHandler)(open, handleOpen, [
|
|
49
50
|
daypickerRef,
|
|
@@ -142,7 +143,7 @@ const useDatepicker = (opt = {}) => {
|
|
|
142
143
|
};
|
|
143
144
|
const datepickerProps = {
|
|
144
145
|
month,
|
|
145
|
-
onMonthChange:
|
|
146
|
+
onMonthChange: setMonth,
|
|
146
147
|
onDayClick: handleDayClick,
|
|
147
148
|
selected: selectedDay !== null && selectedDay !== void 0 ? selectedDay : new Date("Invalid date"),
|
|
148
149
|
locale: _locale,
|
|
@@ -45,10 +45,11 @@ const useMonthpicker = (opt = {}) => {
|
|
|
45
45
|
? (0, utils_1.formatDateForInput)(defaultSelected, locale, "month", inputFormat)
|
|
46
46
|
: "";
|
|
47
47
|
const [inputValue, setInputValue] = (0, react_1.useState)(defaultInputValue);
|
|
48
|
-
const handleOpen = (0, react_1.useCallback)((
|
|
48
|
+
const handleOpen = (0, react_1.useCallback)((newOpen) => {
|
|
49
49
|
var _a, _b;
|
|
50
|
-
setOpen(
|
|
51
|
-
|
|
50
|
+
setOpen(newOpen);
|
|
51
|
+
newOpen &&
|
|
52
|
+
setYear((_b = (_a = selectedMonth !== null && selectedMonth !== void 0 ? selectedMonth : defaultSelected) !== null && _a !== void 0 ? _a : defaultYear) !== null && _b !== void 0 ? _b : today);
|
|
52
53
|
}, [defaultSelected, defaultYear, selectedMonth, today]);
|
|
53
54
|
(0, useOutsideClickHandler_1.useOutsideClickHandler)(open, handleOpen, [
|
|
54
55
|
monthpickerRef,
|
|
@@ -5,25 +5,25 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.MonthCaption = void 0;
|
|
7
7
|
const aksel_icons_1 = require("@navikt/aksel-icons");
|
|
8
|
+
const date_fns_1 = require("date-fns");
|
|
8
9
|
const setYear_1 = __importDefault(require("date-fns/setYear"));
|
|
9
10
|
const startOfMonth_1 = __importDefault(require("date-fns/startOfMonth"));
|
|
10
11
|
const startOfYear_1 = __importDefault(require("date-fns/startOfYear"));
|
|
11
12
|
const react_1 = __importDefault(require("react"));
|
|
12
13
|
const react_day_picker_1 = require("react-day-picker");
|
|
13
|
-
const context_1 = require("../context");
|
|
14
|
-
const utils_1 = require("../utils");
|
|
15
|
-
const date_fns_1 = require("date-fns");
|
|
16
14
|
const button_1 = require("../../button");
|
|
17
15
|
const Select_1 = require("../../form/Select");
|
|
16
|
+
const context_1 = require("../context");
|
|
17
|
+
const utils_1 = require("../utils");
|
|
18
18
|
const MonthCaption = () => {
|
|
19
19
|
const { fromDate, toDate, formatters: { formatYearCaption }, locale, } = (0, react_day_picker_1.useDayPicker)();
|
|
20
20
|
const { hasDropdown, year, toYear } = (0, context_1.useSharedMonthContext)();
|
|
21
21
|
const years = [];
|
|
22
22
|
if (hasDropdown && fromDate && toDate) {
|
|
23
23
|
const fromYear = fromDate.getFullYear();
|
|
24
|
-
const
|
|
25
|
-
for (let
|
|
26
|
-
years.push((0, setYear_1.default)((0, startOfYear_1.default)(new Date()),
|
|
24
|
+
const toDateYear = toDate.getFullYear();
|
|
25
|
+
for (let currYear = fromYear; currYear <= toDateYear; currYear++) {
|
|
26
|
+
years.push((0, setYear_1.default)((0, startOfYear_1.default)(new Date()), currYear));
|
|
27
27
|
}
|
|
28
28
|
if (!years.map((x) => x.getFullYear()).includes(year.getFullYear())) {
|
|
29
29
|
years.push((0, setYear_1.default)((0, startOfYear_1.default)(new Date()), year.getFullYear()));
|
|
@@ -47,7 +47,7 @@ const MonthCaption = () => {
|
|
|
47
47
|
};
|
|
48
48
|
return (react_1.default.createElement("div", { className: "navds-date__caption" },
|
|
49
49
|
react_1.default.createElement(button_1.Button, { className: "navds-date__caption-button", disabled: hasPrevYear(), onClick: () => handleButtonClick(-1), "aria-label": (0, utils_1.labelPrevYear)(locale === null || locale === void 0 ? void 0 : locale.code), icon: react_1.default.createElement(aksel_icons_1.ArrowLeftIcon, { "aria-hidden": true }), variant: "tertiary", type: "button" }),
|
|
50
|
-
hasDropdown ? (react_1.default.createElement(Select_1.Select, { label: "velg \u00E5r", hideLabel: true, value: year === null || year === void 0 ? void 0 : year.getFullYear(), onChange: handleYearChange, className: "navds-date__caption__year" }, years.map((
|
|
50
|
+
hasDropdown ? (react_1.default.createElement(Select_1.Select, { label: "velg \u00E5r", hideLabel: true, value: year === null || year === void 0 ? void 0 : year.getFullYear(), onChange: handleYearChange, className: "navds-date__caption__year" }, years.map((yearOpt) => (react_1.default.createElement("option", { key: yearOpt.getFullYear(), value: yearOpt.getFullYear() }, formatYearCaption(yearOpt, { locale })))))) : (react_1.default.createElement("span", { className: "navds-date__year-label", "aria-live": "polite" }, year.getFullYear())),
|
|
51
51
|
react_1.default.createElement(button_1.Button, { className: "navds-date__caption-button", disabled: hasNextYear(), onClick: () => handleButtonClick(1), "aria-label": (0, utils_1.labelNextYear)(locale === null || locale === void 0 ? void 0 : locale.code), icon: react_1.default.createElement(aksel_icons_1.ArrowRightIcon, { "aria-hidden": true }), variant: "tertiary", type: "button" })));
|
|
52
52
|
};
|
|
53
53
|
exports.MonthCaption = MonthCaption;
|
|
@@ -9,15 +9,15 @@ const is_match_1 = require("./is-match");
|
|
|
9
9
|
const nextEnabled = (months, key, disabled, currentMonth, setYearState, yearState, dropdownCaption, fromDate, toDate) => {
|
|
10
10
|
const currentIndex = currentMonth.getMonth();
|
|
11
11
|
if (key === "Home") {
|
|
12
|
-
const
|
|
13
|
-
if (
|
|
14
|
-
return
|
|
12
|
+
const nextDate = nextOnRow(currentIndex, months, yearState, disabled, "home");
|
|
13
|
+
if (nextDate) {
|
|
14
|
+
return nextDate;
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
if (key === "End") {
|
|
18
|
-
const
|
|
19
|
-
if (
|
|
20
|
-
return
|
|
18
|
+
const nextDate = nextOnRow(currentIndex, months, yearState, disabled, "end");
|
|
19
|
+
if (nextDate) {
|
|
20
|
+
return nextDate;
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
if (key === "PageUp") {
|
package/cjs/form/Select.js
CHANGED
|
@@ -95,7 +95,7 @@ exports.Select = (0, react_1.forwardRef)((props, ref) => {
|
|
|
95
95
|
"navds-sr-only": hideLabel,
|
|
96
96
|
}), id: inputDescriptionId, size: size, as: "div" }, description)),
|
|
97
97
|
react_1.default.createElement("div", { className: "navds-select__container", style: style },
|
|
98
|
-
react_1.default.createElement("select", Object.assign({}, (0, util_1.omit)(rest, ["error", "errorId", "size", "readOnly"]), inputProps, readOnlyEventHandlers, { ref: ref, className: (0, clsx_1.default)("navds-select__input", "navds-body-short", `navds-body--${size !== null && size !== void 0 ? size : "medium"}`), size: htmlSize }), children),
|
|
98
|
+
react_1.default.createElement("select", Object.assign({}, (0, util_1.omit)(rest, ["error", "errorId", "size", "readOnly"]), inputProps, readOnlyEventHandlers, { ref: ref, className: (0, clsx_1.default)("navds-select__input", "navds-body-short", `navds-body-short--${size !== null && size !== void 0 ? size : "medium"}`), size: htmlSize }), children),
|
|
99
99
|
react_1.default.createElement(aksel_icons_1.ChevronDownIcon, { className: "navds-select__chevron", "aria-hidden": true })),
|
|
100
100
|
react_1.default.createElement("div", { className: "navds-form-field__error", id: errorId, "aria-relevant": "additions removals", "aria-live": "polite" }, showErrorMsg && (react_1.default.createElement(typography_1.ErrorMessage, { size: size }, props.error)))));
|
|
101
101
|
});
|
package/cjs/form/TextField.js
CHANGED
|
@@ -73,7 +73,7 @@ exports.TextField = (0, react_1.forwardRef)((props, ref) => {
|
|
|
73
73
|
!!description && (react_1.default.createElement(typography_1.BodyShort, { className: (0, clsx_1.default)("navds-form-field__description", {
|
|
74
74
|
"navds-sr-only": hideLabel,
|
|
75
75
|
}), id: inputDescriptionId, size: size, as: "div" }, description)),
|
|
76
|
-
react_1.default.createElement("input", Object.assign({}, (0, util_1.omit)(rest, ["error", "errorId", "size"]), inputProps, { ref: ref, type: type, readOnly: readOnly, className: (0, clsx_1.default)("navds-text-field__input", "navds-body-short", `navds-body
|
|
76
|
+
react_1.default.createElement("input", Object.assign({}, (0, util_1.omit)(rest, ["error", "errorId", "size"]), inputProps, { ref: ref, type: type, readOnly: readOnly, className: (0, clsx_1.default)("navds-text-field__input", "navds-body-short", `navds-body-short--${size !== null && size !== void 0 ? size : "medium"}`), size: htmlSize })),
|
|
77
77
|
react_1.default.createElement("div", { className: "navds-form-field__error", id: errorId, "aria-relevant": "additions removals", "aria-live": "polite" }, showErrorMsg && (react_1.default.createElement(typography_1.ErrorMessage, { size: size }, props.error)))));
|
|
78
78
|
});
|
|
79
79
|
exports.default = exports.TextField;
|
package/cjs/form/Textarea.js
CHANGED
|
@@ -91,7 +91,7 @@ exports.Textarea = (0, react_1.forwardRef)((props, ref) => {
|
|
|
91
91
|
react_1.default.createElement("div", { className: "navds-textarea__wrapper" },
|
|
92
92
|
react_1.default.createElement(TextareaAutoSize_1.default, Object.assign({}, (0, util_1.omit)(rest, ["error", "errorId", "size"]), inputProps, { onChange: (e) => props.onChange
|
|
93
93
|
? props.onChange(e)
|
|
94
|
-
: setControlledValue(e.target.value), minRows: getMinRows(), ref: ref, readOnly: readOnly, className: (0, clsx_1.default)("navds-textarea__input", "navds-body-short", `navds-body
|
|
94
|
+
: setControlledValue(e.target.value), minRows: getMinRows(), ref: ref, readOnly: readOnly, className: (0, clsx_1.default)("navds-textarea__input", "navds-body-short", `navds-body-short--${size !== null && size !== void 0 ? size : "medium"}`, {
|
|
95
95
|
"navds-textarea--counter": hasMaxLength,
|
|
96
96
|
}) }, (describedBy ? { "aria-describedby": describedBy } : {}))),
|
|
97
97
|
hasMaxLength && (react_1.default.createElement(react_1.default.Fragment, null,
|
|
@@ -147,6 +147,6 @@ const Input = (0, react_1.forwardRef)((_a, ref) => {
|
|
|
147
147
|
const onBlur = () => {
|
|
148
148
|
setFilteredOptionsIndex(-1);
|
|
149
149
|
};
|
|
150
|
-
return (react_1.default.createElement("input", Object.assign({}, rest, (0, util_1.omit)(inputProps, ["aria-invalid"]), { ref: ref, value: value, onChange: onChangeHandler, type: "text", role: "combobox", onBlur: onBlur, onKeyUp: handleKeyUp, onKeyDown: handleKeyDown, "aria-controls": `${inputProps.id}-filtered-options`, "aria-expanded": !!isListOpen, autoComplete: "off", "aria-autocomplete": shouldAutocomplete ? "both" : "list", "aria-activedescendant": activeDecendantId, "aria-describedby": ariaDescribedBy, "aria-invalid": inputProps["aria-invalid"], className: (0, clsx_1.default)(inputClassName, "navds-combobox__input", "navds-body-short", `navds-body
|
|
150
|
+
return (react_1.default.createElement("input", Object.assign({}, rest, (0, util_1.omit)(inputProps, ["aria-invalid"]), { ref: ref, value: value, onChange: onChangeHandler, type: "text", role: "combobox", onBlur: onBlur, onKeyUp: handleKeyUp, onKeyDown: handleKeyDown, "aria-controls": `${inputProps.id}-filtered-options`, "aria-expanded": !!isListOpen, autoComplete: "off", "aria-autocomplete": shouldAutocomplete ? "both" : "list", "aria-activedescendant": activeDecendantId, "aria-describedby": ariaDescribedBy, "aria-invalid": inputProps["aria-invalid"], className: (0, clsx_1.default)(inputClassName, "navds-combobox__input", "navds-body-short", `navds-body-short--${size}`) })));
|
|
151
151
|
});
|
|
152
152
|
exports.default = Input;
|
|
@@ -25,8 +25,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.useInputContext = exports.InputContextProvider = void 0;
|
|
27
27
|
const react_1 = __importStar(require("react"));
|
|
28
|
-
const useFormField_1 = require("../../useFormField");
|
|
29
28
|
const util_1 = require("../../../util");
|
|
29
|
+
const useFormField_1 = require("../../useFormField");
|
|
30
30
|
const InputContext = (0, react_1.createContext)({});
|
|
31
31
|
const InputContextProvider = ({ children, value: props }) => {
|
|
32
32
|
const { defaultValue = "", description, disabled, error, errorId, id: externalId, value: externalValue, onChange: externalOnChange, onClear, shouldAutocomplete, size, } = props;
|
|
@@ -43,10 +43,10 @@ const InputContextProvider = ({ children, value: props }) => {
|
|
|
43
43
|
const value = (0, react_1.useMemo)(() => String(externalValue !== null && externalValue !== void 0 ? externalValue : internalValue), [externalValue, internalValue]);
|
|
44
44
|
const [searchTerm, setSearchTerm] = (0, react_1.useState)(value);
|
|
45
45
|
const onChange = (0, react_1.useCallback)((event) => {
|
|
46
|
-
const
|
|
47
|
-
externalValue !== null && externalValue !== void 0 ? externalValue : setInternalValue(
|
|
46
|
+
const newValue = event.currentTarget.value;
|
|
47
|
+
externalValue !== null && externalValue !== void 0 ? externalValue : setInternalValue(newValue);
|
|
48
48
|
externalOnChange === null || externalOnChange === void 0 ? void 0 : externalOnChange(event);
|
|
49
|
-
setSearchTerm(
|
|
49
|
+
setSearchTerm(newValue);
|
|
50
50
|
}, [externalValue, externalOnChange]);
|
|
51
51
|
const setValue = (0, react_1.useCallback)((text) => {
|
|
52
52
|
setInternalValue(text);
|
|
@@ -48,8 +48,8 @@ const SelectedOptionsProvider = ({ children, value, }) => {
|
|
|
48
48
|
!isMultiSelect && setSelectedOptions([]);
|
|
49
49
|
}
|
|
50
50
|
else if (isMultiSelect) {
|
|
51
|
-
setSelectedOptions((
|
|
52
|
-
...
|
|
51
|
+
setSelectedOptions((oldSelectedOptions) => [
|
|
52
|
+
...oldSelectedOptions,
|
|
53
53
|
option,
|
|
54
54
|
]);
|
|
55
55
|
}
|
|
@@ -72,7 +72,7 @@ const SelectedOptionsProvider = ({ children, value, }) => {
|
|
|
72
72
|
removeCustomOption(option);
|
|
73
73
|
}
|
|
74
74
|
else {
|
|
75
|
-
setSelectedOptions((
|
|
75
|
+
setSelectedOptions((oldSelectedOptions) => oldSelectedOptions.filter((selectedOption) => selectedOption !== option));
|
|
76
76
|
}
|
|
77
77
|
onToggleSelected === null || onToggleSelected === void 0 ? void 0 : onToggleSelected(option, false, isCustomOption);
|
|
78
78
|
}, [customOptions, onToggleSelected, removeCustomOption]);
|
|
@@ -103,7 +103,7 @@ exports.Search = (0, react_1.forwardRef)((props, ref) => {
|
|
|
103
103
|
react_1.default.createElement("div", { className: "navds-search__wrapper" },
|
|
104
104
|
react_1.default.createElement("div", { className: "navds-search__wrapper-inner" },
|
|
105
105
|
variant === "simple" && (react_1.default.createElement(aksel_icons_1.MagnifyingGlassIcon, { "aria-hidden": true, className: "navds-search__search-icon" })),
|
|
106
|
-
react_1.default.createElement("input", Object.assign({ ref: mergedRef }, (0, util_1.omit)(rest, ["error", "errorId", "size", "readOnly"]), inputProps, { value: value !== null && value !== void 0 ? value : internalValue, onChange: (e) => handleChange(e.target.value), type: "search", role: "searchbox", className: (0, clsx_1.default)(className, "navds-search__input", `navds-search__input--${variant}`, "navds-text-field__input", "navds-body-short", `navds-body
|
|
106
|
+
react_1.default.createElement("input", Object.assign({ ref: mergedRef }, (0, util_1.omit)(rest, ["error", "errorId", "size", "readOnly"]), inputProps, { value: value !== null && value !== void 0 ? value : internalValue, onChange: (e) => handleChange(e.target.value), type: "search", role: "searchbox", className: (0, clsx_1.default)(className, "navds-search__input", `navds-search__input--${variant}`, "navds-text-field__input", "navds-body-short", `navds-body-short--${size}`) }, (htmlSize ? { size: Number(htmlSize) } : {}))),
|
|
107
107
|
(value !== null && value !== void 0 ? value : internalValue) && clearButton && (react_1.default.createElement("button", { type: "button", onClick: (e) => handleClear({ trigger: "Click", event: e }), className: "navds-search__button-clear" },
|
|
108
108
|
react_1.default.createElement("span", { className: "navds-sr-only" }, clearButtonLabel ? clearButtonLabel : "Tøm"),
|
|
109
109
|
react_1.default.createElement(aksel_icons_1.XMarkIcon, { "aria-hidden": true })))),
|
|
@@ -68,7 +68,7 @@ exports.HelpText = (0, react_1.forwardRef)((_a, ref) => {
|
|
|
68
68
|
}, className: (0, clsx_1.default)(className, "navds-help-text__button"), type: "button", "aria-expanded": open }),
|
|
69
69
|
react_1.default.createElement(HelpTextIcon_1.HelpTextIcon, { title: title }),
|
|
70
70
|
react_1.default.createElement(HelpTextIcon_1.HelpTextIcon, { filled: true, title: title })),
|
|
71
|
-
react_1.default.createElement(popover_1.Popover, { onClose: () => setOpen(false), className: "navds-help-text__popover", open: open, anchorEl: buttonRef.current, placement: placement, strategy: strategy },
|
|
71
|
+
react_1.default.createElement(popover_1.Popover, { onClose: () => setOpen(false), className: "navds-help-text__popover", open: open, anchorEl: buttonRef.current, placement: placement, strategy: strategy, offset: 12 },
|
|
72
72
|
react_1.default.createElement(popover_1.Popover.Content, { className: "navds-body-short" }, children))));
|
|
73
73
|
});
|
|
74
74
|
exports.default = exports.HelpText;
|
|
@@ -14,7 +14,7 @@ const HelpTextIcon = ({ title, filled = false, }) => {
|
|
|
14
14
|
"navds-help-text__icon--filled": filled,
|
|
15
15
|
}) },
|
|
16
16
|
title ? react_1.default.createElement("title", { id: titleId }, title) : null,
|
|
17
|
-
react_1.default.createElement("circle", { cx: "12", cy: "12", r: "11", strokeWidth: "
|
|
17
|
+
react_1.default.createElement("circle", { cx: "12", cy: "12", r: "11", strokeWidth: "1.5", stroke: "currentColor", fill: filled ? "currentColor" : "transparent" }),
|
|
18
18
|
react_1.default.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M9.75 9C9.75 7.75736 10.7574 6.75 12 6.75H12.1716C13.3195 6.75 14.25 7.68054 14.25 8.82843C14.25 9.37966 14.031 9.90832 13.6412 10.2981L12.6412 11.2981C11.7504 12.1889 11.25 13.3971 11.25 14.6569C11.25 15.0711 11.5858 15.4069 12 15.4069C12.4142 15.4069 12.75 15.0711 12.75 14.6569C12.75 13.7949 13.0924 12.9682 13.7019 12.3588L14.7019 11.3588C15.373 10.6877 15.75 9.77748 15.75 8.82843C15.75 6.85212 14.1479 5.25 12.1716 5.25H12C9.92893 5.25 8.25 6.92893 8.25 9V9.5C8.25 9.91421 8.58579 10.25 9 10.25C9.41421 10.25 9.75 9.91421 9.75 9.5V9ZM12 16.5C11.4477 16.5 11 16.9477 11 17.5C11 18.0523 11.4477 18.5 12 18.5C12.5523 18.5 13 18.0523 13 17.5C13 16.9477 12.5523 16.5 12 16.5Z", fill: filled ? "var(--a-surface-default)" : "currentColor" })));
|
|
19
19
|
};
|
|
20
20
|
exports.HelpTextIcon = HelpTextIcon;
|
|
@@ -38,13 +38,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
38
38
|
};
|
|
39
39
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
40
|
exports.ExpandableRow = void 0;
|
|
41
|
+
const aksel_icons_1 = require("@navikt/aksel-icons");
|
|
41
42
|
const clsx_1 = __importDefault(require("clsx"));
|
|
42
43
|
const react_1 = __importStar(require("react"));
|
|
43
44
|
const util_1 = require("../util");
|
|
44
45
|
const AnimateHeight_1 = __importDefault(require("../util/AnimateHeight"));
|
|
45
46
|
const DataCell_1 = __importDefault(require("./DataCell"));
|
|
46
47
|
const Row_1 = __importDefault(require("./Row"));
|
|
47
|
-
const aksel_icons_1 = require("@navikt/aksel-icons");
|
|
48
48
|
exports.ExpandableRow = (0, react_1.forwardRef)((_a, ref) => {
|
|
49
49
|
var { className, children, content, togglePlacement = "left", defaultOpen = false, open, onOpenChange, expansionDisabled = false, expandOnRowClick = false, colSpan = 999 } = _a, rest = __rest(_a, ["className", "children", "content", "togglePlacement", "defaultOpen", "open", "onOpenChange", "expansionDisabled", "expandOnRowClick", "colSpan"]);
|
|
50
50
|
const [internalOpen, setInternalOpen] = (0, react_1.useState)(defaultOpen);
|
|
@@ -53,7 +53,7 @@ exports.ExpandableRow = (0, react_1.forwardRef)((_a, ref) => {
|
|
|
53
53
|
const expansionHandler = (e) => {
|
|
54
54
|
onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(!isOpen);
|
|
55
55
|
if (open === undefined) {
|
|
56
|
-
setInternalOpen((
|
|
56
|
+
setInternalOpen((oldOpen) => !oldOpen);
|
|
57
57
|
}
|
|
58
58
|
e.stopPropagation();
|
|
59
59
|
};
|
package/cjs/tabs/TabList.js
CHANGED
|
@@ -61,9 +61,9 @@ exports.TabList = (0, react_1.forwardRef)((_a, ref) => {
|
|
|
61
61
|
// use 1 for the potential rounding error with browser zooms.
|
|
62
62
|
const showStartScroll = scrollLeft > 1;
|
|
63
63
|
const showEndScroll = scrollLeft < scrollWidth - clientWidth - 1;
|
|
64
|
-
setDisplayScroll((
|
|
65
|
-
showEndScroll ===
|
|
66
|
-
?
|
|
64
|
+
setDisplayScroll((oldDisplayScroll) => showStartScroll === oldDisplayScroll.start &&
|
|
65
|
+
showEndScroll === oldDisplayScroll.end
|
|
66
|
+
? oldDisplayScroll
|
|
67
67
|
: { start: showStartScroll, end: showEndScroll });
|
|
68
68
|
}), []);
|
|
69
69
|
(0, react_1.useEffect)(() => {
|
package/cjs/timeline/Timeline.js
CHANGED
|
@@ -41,12 +41,12 @@ exports.Timeline = void 0;
|
|
|
41
41
|
const date_fns_1 = require("date-fns");
|
|
42
42
|
const react_1 = __importStar(require("react"));
|
|
43
43
|
const AxisLabels_1 = require("./AxisLabels");
|
|
44
|
+
const Pin_1 = __importDefault(require("./Pin"));
|
|
45
|
+
const TimelineRow_1 = __importDefault(require("./TimelineRow"));
|
|
44
46
|
const useRowContext_1 = require("./hooks/useRowContext");
|
|
45
47
|
const useTimelineContext_1 = require("./hooks/useTimelineContext");
|
|
46
48
|
const useTimelineRows_1 = require("./hooks/useTimelineRows");
|
|
47
49
|
const period_1 = __importDefault(require("./period"));
|
|
48
|
-
const Pin_1 = __importDefault(require("./Pin"));
|
|
49
|
-
const TimelineRow_1 = __importDefault(require("./TimelineRow"));
|
|
50
50
|
const timeline_1 = require("./utils/timeline");
|
|
51
51
|
const zoom_1 = __importDefault(require("./zoom"));
|
|
52
52
|
/**
|
|
@@ -141,10 +141,10 @@ exports.Timeline = (0, react_1.forwardRef)((_a, ref) => {
|
|
|
141
141
|
return;
|
|
142
142
|
}
|
|
143
143
|
};
|
|
144
|
-
const addFocusable = (
|
|
144
|
+
const addFocusable = (btnRef, id) => {
|
|
145
145
|
let items = firstFocusabled.current;
|
|
146
146
|
items = items.filter((x) => x.id !== id);
|
|
147
|
-
items.push({ ref, id });
|
|
147
|
+
items.push({ ref: btnRef, id });
|
|
148
148
|
firstFocusabled.current = items;
|
|
149
149
|
};
|
|
150
150
|
return (react_1.default.createElement(useTimelineContext_1.TimelineContext.Provider, { value: {
|
|
@@ -161,7 +161,7 @@ exports.Timeline = (0, react_1.forwardRef)((_a, ref) => {
|
|
|
161
161
|
react_1.default.createElement("div", Object.assign({}, rest, { ref: ref }),
|
|
162
162
|
react_1.default.createElement("div", { className: "navds-timeline" },
|
|
163
163
|
react_1.default.createElement(AxisLabels_1.AxisLabels, { templates: axisLabelTemplates }),
|
|
164
|
-
pins.map((
|
|
164
|
+
pins.map((PinChild, i) => (react_1.default.createElement(PinChild, { key: `pin-${i}` }))),
|
|
165
165
|
processedRows.map((row, i) => {
|
|
166
166
|
return (react_1.default.createElement(useRowContext_1.RowContext.Provider, { key: `row-${row.id}`, value: {
|
|
167
167
|
periods: row.periods,
|
|
@@ -171,7 +171,7 @@ exports.Timeline = (0, react_1.forwardRef)((_a, ref) => {
|
|
|
171
171
|
} },
|
|
172
172
|
react_1.default.createElement(TimelineRow_1.default, Object.assign({}, row === null || row === void 0 ? void 0 : row.restProps, { ref: row === null || row === void 0 ? void 0 : row.ref, label: row.label, icon: row.icon, headingTag: row.headingTag }))));
|
|
173
173
|
})),
|
|
174
|
-
zoomComponent
|
|
174
|
+
zoomComponent)));
|
|
175
175
|
});
|
|
176
176
|
exports.Timeline.Row = TimelineRow_1.default;
|
|
177
177
|
exports.Timeline.Period = period_1.default;
|
|
@@ -51,8 +51,7 @@ const trimmedPeriods = (period) => {
|
|
|
51
51
|
horizontalPosition,
|
|
52
52
|
cropped });
|
|
53
53
|
};
|
|
54
|
-
const useTimelineRows = (rows, startDate, endDate, direction) => (0, react_1.useMemo)(() => rows.map((periods,
|
|
55
|
-
const rowIndex = i;
|
|
54
|
+
const useTimelineRows = (rows, startDate, endDate, direction) => (0, react_1.useMemo)(() => rows.map((periods, rowIndex) => {
|
|
56
55
|
const timelinePeriods = periods.periods
|
|
57
56
|
.sort((a, b) => a.start.valueOf() - b.start.valueOf())
|
|
58
57
|
.map((period, i) => (Object.assign(Object.assign({}, spatialPeriod(period, startDate, endDate, direction, i, periods.periods, rowIndex)), { restProps: period === null || period === void 0 ? void 0 : period.restProps, ref: period === null || period === void 0 ? void 0 : period.ref })))
|
package/cjs/util/omit.js
CHANGED
|
@@ -3,5 +3,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.omit = void 0;
|
|
4
4
|
const omit = (obj, props) => Object.entries(obj)
|
|
5
5
|
.filter(([key]) => !props.includes(key))
|
|
6
|
-
.reduce((
|
|
6
|
+
.reduce((prevObj, [key, value]) => (Object.assign(Object.assign({}, prevObj), { [key]: value })), {});
|
|
7
7
|
exports.omit = omit;
|
|
@@ -57,18 +57,18 @@ export const DatePicker = forwardRef((_a, ref) => {
|
|
|
57
57
|
const [selectedDates, setSelectedDates] = React.useState(defaultSelected);
|
|
58
58
|
const mode = (_b = rest.mode) !== null && _b !== void 0 ? _b : "single";
|
|
59
59
|
/**
|
|
60
|
-
* @param
|
|
60
|
+
* @param newSelected Date | Date[] | DateRange | undefined
|
|
61
61
|
*/
|
|
62
|
-
const handleSelect = (
|
|
62
|
+
const handleSelect = (newSelected) => {
|
|
63
63
|
var _a, _b, _c;
|
|
64
|
-
setSelectedDates(
|
|
64
|
+
setSelectedDates(newSelected);
|
|
65
65
|
if (rest.mode === "single") {
|
|
66
|
-
|
|
66
|
+
newSelected && ((_a = onClose === null || onClose === void 0 ? void 0 : onClose()) !== null && _a !== void 0 ? _a : setOpen(false));
|
|
67
67
|
}
|
|
68
68
|
else if (rest.mode === "range") {
|
|
69
|
-
(
|
|
69
|
+
(newSelected === null || newSelected === void 0 ? void 0 : newSelected.from) && (newSelected === null || newSelected === void 0 ? void 0 : newSelected.to) && ((_b = onClose === null || onClose === void 0 ? void 0 : onClose()) !== null && _b !== void 0 ? _b : setOpen(false));
|
|
70
70
|
}
|
|
71
|
-
(_c = rest === null || rest === void 0 ? void 0 : rest.onSelect) === null || _c === void 0 ? void 0 : _c.call(rest,
|
|
71
|
+
(_c = rest === null || rest === void 0 ? void 0 : rest.onSelect) === null || _c === void 0 ? void 0 : _c.call(rest, newSelected);
|
|
72
72
|
};
|
|
73
73
|
return (React.createElement(DateContext.Provider, { value: {
|
|
74
74
|
open: _open !== null && _open !== void 0 ? _open : open,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DatePicker.js","sourceRoot":"","sources":["../../../src/date/datepicker/DatePicker.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,MAAM,CAAC;AACtB,OAAO,SAAS,MAAM,oBAAoB,CAAC;AAC3C,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5D,OAAO,EAAa,SAAS,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AACvD,OAAO,oBAAoB,MAAM,wBAAwB,CAAC;AAC1D,OAAO,OAAO,MAAM,iBAAiB,CAAC;AACtC,OAAO,SAAS,MAAM,mBAAmB,CAAC;AAC1C,OAAO,eAAe,MAAM,yBAAyB,CAA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AC,CAAC;4BACnC,OAAO,CAAC,GAAG,EAAE,QAAQ,CAAC,CACvB,CAAC;oBACJ,CAAC,EACD,YAAY,EAAE,CAAC,EACf,YAAY,EAAE,KAAK,EACnB,MAAM,EAAE,MAAa,EACrB,SAAS,EAAE;wBACT,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,eAAe,IAAI,SAAS,CAAC,GAAG,CAAC;qBACpD,EACD,mBAAmB,EAAE;wBACnB,OAAO,EAAE,kBAAkB;qBAC5B,EACD,cAAc,EAAE,cAAc,EAC9B,iBAAiB,EACf,IAAI,KAAK,UAAU,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,SAAS,EAErD,UAAU,QACV,eAAe,UACX,IAAI,CAAC,IAAI,EAAE,CAAC,UAAU,CAAC,CAAC,EAC5B,CACM,CACX,CACG,CACe,CACxB,CAAC;AACJ,CAAC,CACqB,CAAC;AAEzB,UAAU,CAAC,UAAU,GAAG,oBAAoB,CAAC;AAC7C,UAAU,CAAC,KAAK,GAAG,eAAe,CAAC;AAEnC,eAAe,UAAU,CAAC"}
|
|
@@ -28,11 +28,11 @@ export const DatePickerStandalone = forwardRef((_a, ref) => {
|
|
|
28
28
|
const [selectedDates, setSelectedDates] = React.useState(defaultSelected);
|
|
29
29
|
const mode = (_b = rest.mode) !== null && _b !== void 0 ? _b : "single";
|
|
30
30
|
/**
|
|
31
|
-
* @param
|
|
31
|
+
* @param newSelected Date | Date[] | DateRange | undefined
|
|
32
32
|
*/
|
|
33
|
-
const handleSelect = (
|
|
34
|
-
setSelectedDates(
|
|
35
|
-
onSelect === null || onSelect === void 0 ? void 0 : onSelect(
|
|
33
|
+
const handleSelect = (newSelected) => {
|
|
34
|
+
setSelectedDates(newSelected);
|
|
35
|
+
onSelect === null || onSelect === void 0 ? void 0 : onSelect(newSelected);
|
|
36
36
|
};
|
|
37
37
|
return (React.createElement("div", { ref: ref, className: cl("navds-date__standalone-wrapper", className) },
|
|
38
38
|
React.createElement(DayPicker, Object.assign({ locale: getLocaleFromString(locale), mode: mode, onSelect: handleSelect, selected: selected !== null && selected !== void 0 ? selected : selectedDates, components: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DatePickerStandalone.js","sourceRoot":"","sources":["../../../src/date/datepicker/DatePickerStandalone.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,MAAM,CAAC;AACtB,OAAO,SAAS,MAAM,oBAAoB,CAAC;AAC3C,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAa,SAAS,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAClC,OAAO,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AACvD,OAAO,OAAO,MAAM,iBAAiB,CAAC;AACtC,OAAO,SAAS,MAAM,mBAAmB,CAAC;AAC1C,OAAO,eAAe,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,GAAG,MAAM,aAAa,CAAC;AAC9B,OAAO,SAAS,MAAM,mBAAmB,CAAC;AAC1C,OAAO,UAAU,MAAM,oBAAoB,CAAC;AAiC5C,MAAM,CAAC,MAAM,oBAAoB,GAA6B,UAAU,CAItE,CACE,EAaC,EACD,GAAG,EACH,EAAE;;QAfF,EACE,SAAS,EACT,MAAM,GAAG,IAAI,EACb,eAAe,EACf,QAAQ,GAAG,EAAE,EACb,eAAe,GAAG,KAAK,EACvB,cAAc,GAAG,KAAK,EACtB,QAAQ,EACR,eAAe,EACf,QAAQ,EACR,UAAU,GAAG,KAAK,EAClB,iBAAiB,OAElB,EADI,IAAI,cAZT,yKAaC,CADQ;IAIT,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAEtD,eAAe,CAAC,CAAC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,EACf,IAAI,KAAK,UAAU,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,SAAS,EAErD,UAAU,EAAE,UAAU,EACtB,eAAe,UACX,IAAI,CAAC,IAAI,EAAE,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC,EAClC,CACE,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
|
|
@@ -34,10 +34,11 @@ export const useDatepicker = (opt = {}) => {
|
|
|
34
34
|
? formatDateForInput(defaultSelected, locale, "date", inputFormat)
|
|
35
35
|
: "";
|
|
36
36
|
const [inputValue, setInputValue] = useState(defaultInputValue);
|
|
37
|
-
const handleOpen = useCallback((
|
|
37
|
+
const handleOpen = useCallback((newOpen) => {
|
|
38
38
|
var _a, _b;
|
|
39
|
-
setOpen(
|
|
40
|
-
|
|
39
|
+
setOpen(newOpen);
|
|
40
|
+
newOpen &&
|
|
41
|
+
setMonth((_b = (_a = selectedDay !== null && selectedDay !== void 0 ? selectedDay : defaultSelected) !== null && _a !== void 0 ? _a : defaultMonth) !== null && _b !== void 0 ? _b : today);
|
|
41
42
|
}, [defaultMonth, defaultSelected, selectedDay, today]);
|
|
42
43
|
useOutsideClickHandler(open, handleOpen, [
|
|
43
44
|
daypickerRef,
|
|
@@ -136,7 +137,7 @@ export const useDatepicker = (opt = {}) => {
|
|
|
136
137
|
};
|
|
137
138
|
const datepickerProps = {
|
|
138
139
|
month,
|
|
139
|
-
onMonthChange:
|
|
140
|
+
onMonthChange: setMonth,
|
|
140
141
|
onDayClick: handleDayClick,
|
|
141
142
|
selected: selectedDay !== null && selectedDay !== void 0 ? selectedDay : new Date("Invalid date"),
|
|
142
143
|
locale: _locale,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDatepicker.js","sourceRoot":"","sources":["../../../src/date/hooks/useDatepicker.tsx"],"names":[],"mappings":"AAAA,OAAO,wBAAwB,MAAM,mCAAmC,CAAC;AACzE,OAAO,SAAS,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QACL,aAAa,EAAE,QAAQ;QACvB,UAAU,EAAE,cAAc;QAC1B,QAAQ,EAAE,WAAW,aAAX,WAAW,cAAX,WAAW,GAAI,IAAI,IAAI,CAAC,cAAc,CAAC;QACjD,MAAM,EAAE,OAAO;QACf,QAAQ;QACR,MAAM;QACN,KAAK;QACL,IAAI;QACJ,YAAY,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC;QACrC,QAAQ;QACR,eAAe;QACf,YAAY,EAAE,IAAI;QAClB,GAAG,EAAE,eAAe;KACrB,CAAC;IAEF,MAAM,UAAU,GAAG;QACjB,QAAQ,EAAE,YAAY;QACtB,OAAO,EAAE,WAAW;QACpB,MAAM,EAAE,UAAU;QAClB,KAAK,EAAE,UAAU;QACjB,GAAG,EAAE,QAAQ;KACd,CAAC;IAEF,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC;AAC1E,CAAC,CAAC"}
|
|
@@ -42,10 +42,11 @@ export const useMonthpicker = (opt = {}) => {
|
|
|
42
42
|
? formatDateForInput(defaultSelected, locale, "month", inputFormat)
|
|
43
43
|
: "";
|
|
44
44
|
const [inputValue, setInputValue] = useState(defaultInputValue);
|
|
45
|
-
const handleOpen = useCallback((
|
|
45
|
+
const handleOpen = useCallback((newOpen) => {
|
|
46
46
|
var _a, _b;
|
|
47
|
-
setOpen(
|
|
48
|
-
|
|
47
|
+
setOpen(newOpen);
|
|
48
|
+
newOpen &&
|
|
49
|
+
setYear((_b = (_a = selectedMonth !== null && selectedMonth !== void 0 ? selectedMonth : defaultSelected) !== null && _a !== void 0 ? _a : defaultYear) !== null && _b !== void 0 ? _b : today);
|
|
49
50
|
}, [defaultSelected, defaultYear, selectedMonth, today]);
|
|
50
51
|
useOutsideClickHandler(open, handleOpen, [
|
|
51
52
|
monthpickerRef,
|