@sb1/ffe-datepicker-react 100.12.3 → 101.0.0

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.
Files changed (41) hide show
  1. package/es/button/Button.js +4 -5
  2. package/es/calendar/Calendar.js +88 -111
  3. package/es/calendar/ClickableDate.js +20 -41
  4. package/es/calendar/Header.js +13 -14
  5. package/es/calendar/NonClickableDate.js +1 -2
  6. package/es/datelogic/simplecalendar.js +97 -124
  7. package/es/datelogic/simpledate.js +66 -96
  8. package/es/datepicker/Datepicker.js +2 -25
  9. package/es/datepicker/DatepickerComp.js +61 -64
  10. package/es/datepicker/DatepickerContext.js +33 -36
  11. package/es/datepicker/SpinButton.js +8 -32
  12. package/es/datepicker/padZero.js +2 -2
  13. package/es/datepicker/testHelper.js +72 -143
  14. package/es/datepicker/toNumber.js +4 -6
  15. package/es/i18n/i18n.js +3 -3
  16. package/es/input/DateInput.js +3 -26
  17. package/es/types.js +1 -1
  18. package/es/util/dateRangeUtils.js +12 -12
  19. package/es/util/dateUtil.js +2 -2
  20. package/es/util/isIOSSafari.js +4 -4
  21. package/lib/button/Button.js +8 -9
  22. package/lib/calendar/Calendar.js +94 -116
  23. package/lib/calendar/ClickableDate.js +22 -42
  24. package/lib/calendar/Header.js +17 -18
  25. package/lib/calendar/NonClickableDate.js +2 -3
  26. package/lib/datelogic/simplecalendar.js +99 -125
  27. package/lib/datelogic/simpledate.js +67 -96
  28. package/lib/datepicker/Datepicker.js +5 -28
  29. package/lib/datepicker/DatepickerComp.js +74 -77
  30. package/lib/datepicker/DatepickerContext.js +36 -39
  31. package/lib/datepicker/SpinButton.js +10 -34
  32. package/lib/datepicker/padZero.js +2 -2
  33. package/lib/datepicker/testHelper.js +73 -177
  34. package/lib/datepicker/toNumber.js +4 -6
  35. package/lib/i18n/i18n.js +3 -3
  36. package/lib/input/DateInput.js +7 -30
  37. package/lib/types.js +1 -1
  38. package/lib/util/dateRangeUtils.js +14 -14
  39. package/lib/util/dateUtil.js +3 -3
  40. package/lib/util/isIOSSafari.js +4 -4
  41. package/package.json +13 -14
@@ -1,119 +1,38 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
36
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
37
- return new (P || (P = Promise))(function (resolve, reject) {
38
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
39
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
40
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
41
- step((generator = generator.apply(thisArg, _arguments || [])).next());
42
- });
43
- };
44
- var __generator = (this && this.__generator) || function (thisArg, body) {
45
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
46
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
47
- function verb(n) { return function (v) { return step([n, v]); }; }
48
- function step(op) {
49
- if (f) throw new TypeError("Generator is already executing.");
50
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
51
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
52
- if (y = 0, t) op = [op[0] & 2, t.value];
53
- switch (op[0]) {
54
- case 0: case 1: t = op; break;
55
- case 4: _.label++; return { value: op[1], done: false };
56
- case 5: _.label++; y = op[1]; op = [0]; continue;
57
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
58
- default:
59
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
60
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
61
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
62
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
63
- if (t[2]) _.ops.pop();
64
- _.trys.pop(); continue;
65
- }
66
- op = body.call(thisArg, _);
67
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
68
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
69
- }
70
- };
71
2
  Object.defineProperty(exports, "__esModule", { value: true });
72
3
  exports.getDatepickerByLabelText = getDatepickerByLabelText;
73
- function simulateTyping(element_1, text_1) {
74
- return __awaiter(this, arguments, void 0, function (element, text, delay) {
75
- var act, _text;
76
- if (delay === void 0) { delay = 100; }
77
- return __generator(this, function (_a) {
78
- switch (_a.label) {
79
- case 0: return [4 /*yield*/, Promise.resolve().then(function () { return __importStar(require('@testing-library/react')); })];
80
- case 1:
81
- act = (_a.sent()).act;
82
- _text = text;
83
- if (text.length === 0) {
84
- _text = '0';
85
- }
86
- return [2 /*return*/, new Promise(function (resolve) {
87
- var index = 0;
88
- function typeCharacter() {
89
- if (index < _text.length) {
90
- var char = _text[index];
91
- var eventOptions_1 = {
92
- key: char,
93
- keyCode: char.charCodeAt(0),
94
- which: char.charCodeAt(0),
95
- bubbles: true,
96
- };
97
- act(function () {
98
- element.dispatchEvent(new KeyboardEvent('keydown', eventOptions_1));
99
- });
100
- index++;
101
- setTimeout(typeCharacter, delay);
102
- }
103
- else {
104
- resolve(); // Resolve the promise when done
105
- }
106
- }
107
- typeCharacter();
108
- })];
4
+ const react_1 = require("react");
5
+ async function simulateTyping(element, text, delay = 100) {
6
+ let _text = text;
7
+ if (text.length === 0) {
8
+ _text = '0';
9
+ }
10
+ return new Promise(resolve => {
11
+ let index = 0;
12
+ function typeCharacter() {
13
+ if (index < _text.length) {
14
+ const char = _text[index];
15
+ const eventOptions = {
16
+ key: char,
17
+ keyCode: char.charCodeAt(0),
18
+ which: char.charCodeAt(0),
19
+ bubbles: true,
20
+ };
21
+ (0, react_1.act)(() => {
22
+ element.dispatchEvent(new KeyboardEvent('keydown', eventOptions));
23
+ });
24
+ index++;
25
+ setTimeout(typeCharacter, delay);
26
+ }
27
+ else {
28
+ resolve(); // Resolve the promise when done
109
29
  }
110
- });
30
+ }
31
+ typeCharacter();
111
32
  });
112
33
  }
113
- function leftPad(str, len, ch) {
114
- if (len === void 0) { len = 2; }
115
- if (ch === void 0) { ch = '0'; }
116
- var newStr = str;
34
+ function leftPad(str, len = 2, ch = '0') {
35
+ let newStr = str;
117
36
  while (newStr.length < len) {
118
37
  newStr = ch + newStr;
119
38
  }
@@ -126,71 +45,48 @@ function leftPad(str, len, ch) {
126
45
  * @param index if there are multiple datepicker elements with the same label, you can specify which one you want to get
127
46
  * @returns DatepickerTestHelper
128
47
  */
129
- function getDatepickerByLabelText(label_1) {
130
- return __awaiter(this, arguments, void 0, function (label, index) {
131
- function getValue(element) {
132
- var _a = Array.from(element.querySelectorAll('[role="spinbutton"]')), dayElement = _a[0], monthElement = _a[1], yearElement = _a[2];
133
- var day = dayElement.getAttribute('aria-valuenow') || '';
134
- var month = monthElement.getAttribute('aria-valuenow') || '';
135
- var year = yearElement.getAttribute('aria-valuenow') || '';
136
- return year !== '' &&
137
- year !== '0' &&
138
- month !== '' &&
139
- month !== '0' &&
140
- day !== '' &&
141
- day !== '0'
142
- ? "".concat(leftPad(day), ".").concat(leftPad(month), ".").concat(year)
143
- : '';
144
- }
145
- function setValue(element, value) {
146
- return __awaiter(this, void 0, void 0, function () {
147
- var act, _a, dayElement, monthElement, yearElement, _b, dayValue, monthValue, yearValue;
148
- return __generator(this, function (_c) {
149
- switch (_c.label) {
150
- case 0: return [4 /*yield*/, Promise.resolve().then(function () { return __importStar(require('@testing-library/react')); })];
151
- case 1:
152
- act = (_c.sent()).act;
153
- _a = Array.from(element.querySelectorAll('[role="spinbutton"]')), dayElement = _a[0], monthElement = _a[1], yearElement = _a[2];
154
- _b = value
155
- ? value.split('.')
156
- : ['0', '0', '0'], dayValue = _b[0], monthValue = _b[1], yearValue = _b[2];
157
- dayValue = dayValue.length === 1 ? "0".concat(dayValue) : dayValue;
158
- monthValue = monthValue.length === 1 ? "0".concat(monthValue) : monthValue;
159
- return [4 /*yield*/, simulateTyping(dayElement, dayValue)];
160
- case 2:
161
- _c.sent();
162
- return [4 /*yield*/, simulateTyping(monthElement, monthValue)];
163
- case 3:
164
- _c.sent();
165
- return [4 /*yield*/, simulateTyping(yearElement, yearValue)];
166
- case 4:
167
- _c.sent();
168
- act(function () { return yearElement.blur(); });
169
- return [2 /*return*/];
170
- }
171
- });
172
- });
173
- }
174
- var screen, elements;
175
- if (index === void 0) { index = 0; }
176
- return __generator(this, function (_a) {
177
- switch (_a.label) {
178
- case 0: return [4 /*yield*/, Promise.resolve().then(function () { return __importStar(require('@testing-library/react')); })];
179
- case 1:
180
- screen = (_a.sent()).screen;
181
- elements = screen
182
- .getAllByText(label)
183
- .map(function (element) {
184
- var _a, _b;
185
- return (_b = (_a = element.parentElement) === null || _a === void 0 ? void 0 : _a.parentElement) === null || _b === void 0 ? void 0 : _b.querySelector('.ffe-datepicker');
186
- })
187
- .filter(function (element) { return element !== null && element !== undefined; });
188
- return [2 /*return*/, {
189
- element: elements[index],
190
- getValue: function () { return getValue(elements[index]); },
191
- setValue: function (value) { return setValue(elements[index], value); },
192
- }];
193
- }
194
- });
195
- });
48
+ async function getDatepickerByLabelText(label, index = 0) {
49
+ const elements = Array.from(document.querySelectorAll('*'))
50
+ .filter(el => {
51
+ var _a;
52
+ return el.children.length === 0 &&
53
+ ((_a = el.textContent) === null || _a === void 0 ? void 0 : _a.trim()) === label;
54
+ })
55
+ .map(el => {
56
+ var _a, _b;
57
+ return (_b = (_a = el.parentElement) === null || _a === void 0 ? void 0 : _a.parentElement) === null || _b === void 0 ? void 0 : _b.querySelector('.ffe-datepicker');
58
+ })
59
+ .filter((el) => el !== null && el !== undefined);
60
+ function getValue(element) {
61
+ const [dayElement, monthElement, yearElement] = Array.from(element.querySelectorAll('[role="spinbutton"]'));
62
+ const day = dayElement.getAttribute('aria-valuenow') || '';
63
+ const month = monthElement.getAttribute('aria-valuenow') || '';
64
+ const year = yearElement.getAttribute('aria-valuenow') || '';
65
+ return year !== '' &&
66
+ year !== '0' &&
67
+ month !== '' &&
68
+ month !== '0' &&
69
+ day !== '' &&
70
+ day !== '0'
71
+ ? `${leftPad(day)}.${leftPad(month)}.${year}`
72
+ : '';
73
+ }
74
+ async function setValue(element, value) {
75
+ const [dayElement, monthElement, yearElement] = Array.from(element.querySelectorAll('[role="spinbutton"]'));
76
+ // eslint-disable-next-line prefer-const
77
+ let [dayValue, monthValue, yearValue] = value
78
+ ? value.split('.')
79
+ : ['0', '0', '0'];
80
+ dayValue = dayValue.length === 1 ? `0${dayValue}` : dayValue;
81
+ monthValue = monthValue.length === 1 ? `0${monthValue}` : monthValue;
82
+ await simulateTyping(dayElement, dayValue);
83
+ await simulateTyping(monthElement, monthValue);
84
+ await simulateTyping(yearElement, yearValue);
85
+ (0, react_1.act)(() => yearElement.blur());
86
+ }
87
+ return {
88
+ element: elements[index],
89
+ getValue: () => getValue(elements[index]),
90
+ setValue: (value) => setValue(elements[index], value),
91
+ };
196
92
  }
@@ -1,12 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.toNumber = void 0;
4
- var toNumber = function (numbers) {
5
- var validNumbers = numbers.filter(function (it) { return typeof it === 'number'; });
4
+ const toNumber = (numbers) => {
5
+ const validNumbers = numbers.filter(it => typeof it === 'number');
6
6
  return validNumbers
7
- .map(function (it, index) {
8
- return (it !== null && it !== void 0 ? it : 1) * Math.pow(10, validNumbers.length - index - 1);
9
- })
10
- .reduce(function (acc, curr) { return acc + curr; }, 0);
7
+ .map((it, index) => (it !== null && it !== void 0 ? it : 1) * Math.pow(10, validNumbers.length - index - 1))
8
+ .reduce((acc, curr) => acc + curr, 0);
11
9
  };
12
10
  exports.toNumber = toNumber;
package/lib/i18n/i18n.js CHANGED
@@ -3,9 +3,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- var en_1 = __importDefault(require("./en"));
7
- var nn_1 = __importDefault(require("./nn"));
8
- var nb_1 = __importDefault(require("./nb"));
6
+ const en_1 = __importDefault(require("./en"));
7
+ const nn_1 = __importDefault(require("./nn"));
8
+ const nb_1 = __importDefault(require("./nb"));
9
9
  exports.default = {
10
10
  nb: nb_1.default,
11
11
  nn: nn_1.default,
@@ -1,15 +1,4 @@
1
1
  "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
3
  if (k2 === undefined) k2 = k;
15
4
  var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -43,31 +32,19 @@ var __importStar = (this && this.__importStar) || (function () {
43
32
  return result;
44
33
  };
45
34
  })();
46
- var __rest = (this && this.__rest) || function (s, e) {
47
- var t = {};
48
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
49
- t[p] = s[p];
50
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
51
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
52
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
53
- t[p[i]] = s[p[i]];
54
- }
55
- return t;
56
- };
57
35
  var __importDefault = (this && this.__importDefault) || function (mod) {
58
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
59
37
  };
60
38
  Object.defineProperty(exports, "__esModule", { value: true });
61
39
  exports.DateInput = void 0;
62
- var react_1 = __importStar(require("react"));
63
- var classnames_1 = __importDefault(require("classnames"));
64
- var i18n_1 = __importDefault(require("../i18n/i18n"));
65
- var isIOSSafari_1 = require("../util/isIOSSafari");
66
- exports.DateInput = react_1.default.forwardRef(function (_a, ref) {
67
- var ariaInvalid = _a.ariaInvalid, value = _a.value, className = _a.className, _b = _a.locale, locale = _b === void 0 ? 'nb' : _b, rest = __rest(_a, ["ariaInvalid", "value", "className", "locale"]);
40
+ const react_1 = __importStar(require("react"));
41
+ const classnames_1 = __importDefault(require("classnames"));
42
+ const i18n_1 = __importDefault(require("../i18n/i18n"));
43
+ const isIOSSafari_1 = require("../util/isIOSSafari");
44
+ exports.DateInput = react_1.default.forwardRef(({ ariaInvalid, value, className, locale = 'nb', ...rest }, ref) => {
68
45
  // VoiceOver on iOS Safari blocks interaction with date-related inputs.
69
46
  // Using role="textbox" as a workaround on that platform.
70
47
  // https://dev.to/mfranzke/voiceover-bug-on-ios-safari-blocks-date-time-related-inputs-especially-in-react-4f61
71
- var role = (0, react_1.useMemo)(function () { return ((0, isIOSSafari_1.isIOSSafari)() ? 'textbox' : undefined); }, []);
72
- return (react_1.default.createElement("input", __assign({ type: "date", role: role, "aria-invalid": ariaInvalid, maxLength: 10, ref: ref, "aria-placeholder": i18n_1.default[locale].DATE_FORMAT, value: value, className: (0, classnames_1.default)('ffe-input-field ffe-dateinput__field', className) }, rest)));
48
+ const role = (0, react_1.useMemo)(() => ((0, isIOSSafari_1.isIOSSafari)() ? 'textbox' : undefined), []);
49
+ return (react_1.default.createElement("input", { type: "date", role: role, "aria-invalid": ariaInvalid, maxLength: 10, ref: ref, "aria-placeholder": i18n_1.default[locale].DATE_FORMAT, value: value, className: (0, classnames_1.default)('ffe-input-field ffe-dateinput__field', className), ...rest }));
73
50
  });
package/lib/types.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isMonth = void 0;
4
- var isMonth = function (thing) {
4
+ const isMonth = (thing) => {
5
5
  return typeof thing === 'number' && thing >= 1 && thing <= 12;
6
6
  };
7
7
  exports.isMonth = isMonth;
@@ -4,15 +4,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getYearOptions = exports.getMonthOptions = void 0;
7
- var simpledate_1 = require("../datelogic/simpledate");
8
- var i18n_1 = __importDefault(require("../i18n/i18n"));
7
+ const simpledate_1 = require("../datelogic/simpledate");
8
+ const i18n_1 = __importDefault(require("../i18n/i18n"));
9
9
  /**
10
10
  * Generates month options for dropdown selection
11
11
  */
12
- var getMonthOptions = function (locale) {
13
- var months = [];
14
- for (var i = 1; i <= 12; i++) {
15
- var monthKey = "MONTH_".concat(i);
12
+ const getMonthOptions = (locale) => {
13
+ const months = [];
14
+ for (let i = 1; i <= 12; i++) {
15
+ const monthKey = `MONTH_${i}`;
16
16
  months.push({
17
17
  value: i,
18
18
  label: i18n_1.default[locale][monthKey],
@@ -24,27 +24,27 @@ exports.getMonthOptions = getMonthOptions;
24
24
  /**
25
25
  * Generates year options based on min and max dates, or defaults to standard range
26
26
  */
27
- var getYearOptions = function (minDate, maxDate) {
28
- var currentYear = new Date().getFullYear();
27
+ const getYearOptions = (minDate, maxDate) => {
28
+ const currentYear = new Date().getFullYear();
29
29
  // Default range: 6 years backward and 2 years forward
30
- var minYear = currentYear - 6;
31
- var maxYear = currentYear + 2;
30
+ let minYear = currentYear - 6;
31
+ let maxYear = currentYear + 2;
32
32
  // Use minDate year if provided
33
33
  if (minDate) {
34
- var minDateObj = (0, simpledate_1.getSimpleDateFromString)(minDate);
34
+ const minDateObj = (0, simpledate_1.getSimpleDateFromString)(minDate);
35
35
  if (minDateObj) {
36
36
  minYear = minDateObj.year;
37
37
  }
38
38
  }
39
39
  // Use maxDate year if provided
40
40
  if (maxDate) {
41
- var maxDateObj = (0, simpledate_1.getSimpleDateFromString)(maxDate);
41
+ const maxDateObj = (0, simpledate_1.getSimpleDateFromString)(maxDate);
42
42
  if (maxDateObj) {
43
43
  maxYear = maxDateObj.year;
44
44
  }
45
45
  }
46
- var years = [];
47
- for (var i = minYear; i <= maxYear; i++) {
46
+ const years = [];
47
+ for (let i = minYear; i <= maxYear; i++) {
48
48
  years.push({
49
49
  value: i,
50
50
  label: String(i),
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.validateDate = validateDate;
4
4
  exports.isDateInputWithTwoDigitYear = isDateInputWithTwoDigitYear;
5
5
  exports.getPaddedDateString = getPaddedDateString;
6
- var padZero_1 = require("../datepicker/padZero");
7
- var dateRegex = /^(\d{1,2})(\.| |-|\/)?(\d{0,2})\2?(\d{0,2}(\d{2})?)$/;
6
+ const padZero_1 = require("../datepicker/padZero");
7
+ const dateRegex = /^(\d{1,2})(\.| |-|\/)?(\d{0,2})\2?(\d{0,2}(\d{2})?)$/;
8
8
  function validateDate(date) {
9
9
  return dateRegex.exec(date);
10
10
  }
@@ -13,5 +13,5 @@ function isDateInputWithTwoDigitYear(value) {
13
13
  return ((_a = validateDate(value)) === null || _a === void 0 ? void 0 : _a[4].length) === 2;
14
14
  }
15
15
  function getPaddedDateString(day, month, year) {
16
- return "".concat((0, padZero_1.padZero)(day !== null && day !== void 0 ? day : 0), ".").concat((0, padZero_1.padZero)(month !== null && month !== void 0 ? month : 0), ".").concat(year);
16
+ return `${(0, padZero_1.padZero)(day !== null && day !== void 0 ? day : 0)}.${(0, padZero_1.padZero)(month !== null && month !== void 0 ? month : 0)}.${year}`;
17
17
  }
@@ -11,16 +11,16 @@ exports.isIOSSafari = void 0;
11
11
  * be affected by the same bug, but are not detected here since they don't
12
12
  * include "Safari" in the user agent string.
13
13
  */
14
- var isIOSSafari = function () {
14
+ const isIOSSafari = () => {
15
15
  if (typeof navigator === 'undefined') {
16
16
  return false;
17
17
  }
18
- var ua = navigator.userAgent;
18
+ const ua = navigator.userAgent;
19
19
  // iPadOS 13+ in desktop mode reports as Macintosh, but can be identified
20
20
  // by having touch points (real Macs have maxTouchPoints === 0).
21
- var isIOS = /iP(ad|hone|od)/.test(ua) ||
21
+ const isIOS = /iP(ad|hone|od)/.test(ua) ||
22
22
  (/Macintosh/.test(ua) && navigator.maxTouchPoints > 1);
23
- var isSafari = !!ua.match(/Safari/) && !ua.match(/CriOS|FxiOS|OPiOS|EdgiOS/);
23
+ const isSafari = !!ua.match(/Safari/) && !ua.match(/CriOS|FxiOS|OPiOS|EdgiOS/);
24
24
  return isIOS && isSafari;
25
25
  };
26
26
  exports.isIOSSafari = isIOSSafari;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sb1/ffe-datepicker-react",
3
- "version": "100.12.3",
3
+ "version": "101.0.0",
4
4
  "license": "MIT",
5
5
  "author": "SpareBank 1",
6
6
  "files": [
@@ -24,20 +24,19 @@
24
24
  "test:watch": "ffe-buildtool jest --watch"
25
25
  },
26
26
  "dependencies": {
27
- "@sb1/ffe-datepicker": "^100.12.3",
28
- "@sb1/ffe-dropdown-react": "^100.12.3",
29
- "@sb1/ffe-form": "^100.12.3",
30
- "@sb1/ffe-form-react": "^100.12.3",
31
- "@sb1/ffe-icons-react": "^100.12.3",
32
- "@testing-library/react": "^16.0.0",
33
- "@types/lodash.debounce": "^4.0.9",
34
- "classnames": "^2.3.1",
35
- "lodash.debounce": "^4.0.8",
36
- "uuid": "^9.0.0"
27
+ "@sb1/ffe-datepicker": "^101.0.0",
28
+ "@sb1/ffe-dropdown-react": "^101.0.0",
29
+ "@sb1/ffe-form": "^101.0.0",
30
+ "@sb1/ffe-form-react": "^101.0.0",
31
+ "@sb1/ffe-icons-react": "^101.0.0",
32
+ "classnames": "^2.5.1",
33
+ "lodash.debounce": "^4.0.8"
37
34
  },
38
35
  "devDependencies": {
39
- "@sb1/ffe-buildtool": "^100.12.3",
40
- "eslint": "^9.22.0",
36
+ "@sb1/ffe-buildtool": "^101.0.0",
37
+ "@testing-library/react": "^16.3.2",
38
+ "@types/lodash.debounce": "^4.0.9",
39
+ "eslint": "^10.2.0",
41
40
  "react": "^18.2.0",
42
41
  "react-dom": "^18.2.0"
43
42
  },
@@ -47,5 +46,5 @@
47
46
  "publishConfig": {
48
47
  "access": "public"
49
48
  },
50
- "gitHead": "c250edc3d20e5ed115c5c5951495d700e96a3be3"
49
+ "gitHead": "7714019dbb9001551cb5d1c262c58afd609d4fb0"
51
50
  }