@reykjavik/hanna-react 0.10.72 → 0.10.74
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/CHANGELOG.md +13 -0
- package/Datepicker.d.ts +1 -1
- package/Datepicker.js +20 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,19 @@
|
|
|
4
4
|
|
|
5
5
|
- ... <!-- Add new lines here. -->
|
|
6
6
|
|
|
7
|
+
## 0.10.74
|
|
8
|
+
|
|
9
|
+
_2022-12-12_
|
|
10
|
+
|
|
11
|
+
- feat: Add support for Polish to `DatePicker`
|
|
12
|
+
- fix: Make Icelandic the default `DatePicker` locale
|
|
13
|
+
|
|
14
|
+
## 0.10.73
|
|
15
|
+
|
|
16
|
+
_2022-12-08_
|
|
17
|
+
|
|
18
|
+
- fix: `Datepicker` calendar not closing when date is selected
|
|
19
|
+
|
|
7
20
|
## 0.10.72
|
|
8
21
|
|
|
9
22
|
_2022-12-07_
|
package/Datepicker.d.ts
CHANGED
package/Datepicker.js
CHANGED
|
@@ -9,8 +9,10 @@ const hooks_1 = require("@hugsmidjan/react/hooks");
|
|
|
9
9
|
const getBemClass_1 = tslib_1.__importDefault(require("@hugsmidjan/react/utils/getBemClass"));
|
|
10
10
|
// For more info on localization see: https://stackoverflow.com/questions/54399084/change-locale-in-react-datepicker/58306958#58306958
|
|
11
11
|
const is_1 = tslib_1.__importDefault(require("date-fns/locale/is"));
|
|
12
|
+
const pl_1 = tslib_1.__importDefault(require("date-fns/locale/pl"));
|
|
12
13
|
const FormField_1 = tslib_1.__importDefault(require("./FormField"));
|
|
13
14
|
(0, react_datepicker_1.registerLocale)('is', is_1.default);
|
|
15
|
+
(0, react_datepicker_1.registerLocale)('pl', pl_1.default);
|
|
14
16
|
const getDateDiff = (date, diff) => {
|
|
15
17
|
const newDate = new Date(date);
|
|
16
18
|
newDate.setDate(newDate.getDate() + diff);
|
|
@@ -34,15 +36,31 @@ const i18n = {
|
|
|
34
36
|
chooseDayAriaLabelPrefix: 'Veldu:',
|
|
35
37
|
disabledDayAriaLabelPrefix: 'Dagsetning ekki í boði',
|
|
36
38
|
},
|
|
39
|
+
pl: {
|
|
40
|
+
nextMonthAriaLabel: 'Następny miesiącu',
|
|
41
|
+
nextMonthButtonLabel: 'Następny miesiącu',
|
|
42
|
+
nextYearAriaLabel: 'Następny rok',
|
|
43
|
+
nextYearButtonLabel: 'Następny rok',
|
|
44
|
+
previousMonthAriaLabel: 'Poprzedni miesiac',
|
|
45
|
+
previousMonthButtonLabel: 'Poprzedni miesiac',
|
|
46
|
+
previousYearAriaLabel: 'Poprzedni rok',
|
|
47
|
+
previousYearButtonLabel: 'Poprzedni rok',
|
|
48
|
+
timeInputLabel: 'Czas: ',
|
|
49
|
+
weekAriaLabelPrefix: 'Tydzień: ',
|
|
50
|
+
weekLabel: 'Tydzień',
|
|
51
|
+
ariaLabelPrefix: 'Miesiąc:',
|
|
52
|
+
chooseDayAriaLabelPrefix: 'Wybierać:',
|
|
53
|
+
disabledDayAriaLabelPrefix: 'Data niedostępna',
|
|
54
|
+
},
|
|
37
55
|
};
|
|
38
56
|
const Datepicker = (props) => {
|
|
39
|
-
const { className, id, label, hideLabel, assistText, disabled, readOnly, invalid, errorMessage, required, reqText, placeholder, small, localeCode, dateFormat = 'd.M.yyy', initialDate, value = initialDate, name, startDate, endDate, minDate, maxDate, isStartDate = false, isEndDate = false, onChange, datepickerExtraProps, ssr, inputRef, } = props;
|
|
57
|
+
const { className, id, label, hideLabel, assistText, disabled, readOnly, invalid, errorMessage, required, reqText, placeholder, small, localeCode = 'is', dateFormat = 'd.M.yyy', initialDate, value = initialDate, name, startDate, endDate, minDate, maxDate, isStartDate = false, isEndDate = false, onChange, datepickerExtraProps, ssr, inputRef, } = props;
|
|
40
58
|
const domid = (0, hooks_1.useDomid)(id);
|
|
41
59
|
const txts = (localeCode && i18n[localeCode]) || {};
|
|
42
60
|
const filled = !!value;
|
|
43
61
|
const empty = !filled && !placeholder;
|
|
44
62
|
return (react_1.default.createElement(FormField_1.default, { className: (0, getBemClass_1.default)('Datepicker', [], className), ssr: ssr, label: label, small: small, assistText: assistText, hideLabel: hideLabel, invalid: invalid, required: required, reqText: reqText, disabled: disabled, readOnly: readOnly, filled: filled, empty: empty, errorMessage: errorMessage, renderInput: (className, inputProps, addFocusProps) => {
|
|
45
|
-
return (react_1.default.createElement("div", Object.assign({ className: className.input, onClick: (
|
|
63
|
+
return (react_1.default.createElement("div", Object.assign({ className: className.input, onClick: ({ target, currentTarget }) => target === currentTarget && currentTarget.querySelector('input').focus(), ref: inputRef &&
|
|
46
64
|
((elm) => {
|
|
47
65
|
inputRef.current =
|
|
48
66
|
(elm === null || elm === void 0 ? void 0 : elm.querySelector('input')) || undefined;
|