@entur/datepicker 9.1.6 → 9.2.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.
- package/dist/DatePicker/Calendar.d.ts +19 -3
- package/dist/DatePicker/CalendarCell.d.ts +3 -1
- package/dist/DatePicker/CalendarGrid.d.ts +4 -1
- package/dist/DatePicker/DatePicker.d.ts +18 -2
- package/dist/datepicker.cjs.development.js +27 -15
- package/dist/datepicker.cjs.development.js.map +1 -1
- package/dist/datepicker.cjs.production.min.js +1 -1
- package/dist/datepicker.cjs.production.min.js.map +1 -1
- package/dist/datepicker.esm.js +27 -15
- package/dist/datepicker.esm.js.map +1 -1
- package/dist/styles.css +45 -45
- package/package.json +10 -10
package/dist/datepicker.esm.js
CHANGED
|
@@ -290,15 +290,17 @@ var CalendarButton = function CalendarButton(_ref) {
|
|
|
290
290
|
}), children);
|
|
291
291
|
};
|
|
292
292
|
|
|
293
|
-
var _excluded$8 = ["state", "date", "onSelectedCellClick"];
|
|
293
|
+
var _excluded$8 = ["state", "date", "onSelectedCellClick", "classNameForDate", "ariaLabelForDate"];
|
|
294
294
|
var CalendarCell = function CalendarCell(_ref) {
|
|
295
|
-
var _state$timeZone;
|
|
295
|
+
var _ariaLabelForDate, _classNameForDate, _state$timeZone, _classNames;
|
|
296
296
|
var state = _ref.state,
|
|
297
297
|
date = _ref.date,
|
|
298
298
|
_ref$onSelectedCellCl = _ref.onSelectedCellClick,
|
|
299
299
|
onSelectedCellClick = _ref$onSelectedCellCl === void 0 ? function () {
|
|
300
300
|
return;
|
|
301
301
|
} : _ref$onSelectedCellCl,
|
|
302
|
+
classNameForDate = _ref.classNameForDate,
|
|
303
|
+
ariaLabelForDate = _ref.ariaLabelForDate,
|
|
302
304
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded$8);
|
|
303
305
|
var cellRef = useRef(null);
|
|
304
306
|
var _useCalendarCell = useCalendarCell({
|
|
@@ -311,17 +313,14 @@ var CalendarCell = function CalendarCell(_ref) {
|
|
|
311
313
|
isDisabled = _useCalendarCell.isDisabled,
|
|
312
314
|
isUnavailable = _useCalendarCell.isUnavailable,
|
|
313
315
|
formattedDate = _useCalendarCell.formattedDate;
|
|
316
|
+
var ariaLabel = buttonProps['aria-label'] + " " + ((_ariaLabelForDate = ariaLabelForDate == null ? void 0 : ariaLabelForDate(date)) != null ? _ariaLabelForDate : '');
|
|
314
317
|
return React.createElement("td", _extends({}, cellProps, {
|
|
315
318
|
className: "eds-datepicker__calendar__grid__cell__td"
|
|
316
319
|
}), React.createElement("div", _extends({}, buttonProps, {
|
|
320
|
+
"aria-label": ariaLabel,
|
|
317
321
|
ref: cellRef,
|
|
318
322
|
hidden: isOutsideVisibleRange,
|
|
319
|
-
className: classNames('eds-datepicker__calendar__grid__cell', {
|
|
320
|
-
'eds-datepicker__calendar__grid__cell--selected': isSelected,
|
|
321
|
-
'eds-datepicker__calendar__grid__cell--disabled': isDisabled || isUnavailable,
|
|
322
|
-
'eds-datepicker__calendar__grid__cell--outside-month': isOutsideVisibleRange,
|
|
323
|
-
'eds-datepicker__calendar__grid__cell--today': isEqualDay(date, now((_state$timeZone = state.timeZone) != null ? _state$timeZone : getLocalTimeZone()))
|
|
324
|
-
})
|
|
323
|
+
className: classNames('eds-datepicker__calendar__grid__cell', (_classNames = {}, _classNames[(_classNameForDate = classNameForDate == null ? void 0 : classNameForDate(date)) != null ? _classNameForDate : ''] = !isOutsideVisibleRange, _classNames['eds-datepicker__calendar__grid__cell--selected'] = isSelected, _classNames['eds-datepicker__calendar__grid__cell--disabled'] = isDisabled || isUnavailable, _classNames['eds-datepicker__calendar__grid__cell--outside-month'] = isOutsideVisibleRange, _classNames['eds-datepicker__calendar__grid__cell--today'] = isEqualDay(date, now((_state$timeZone = state.timeZone) != null ? _state$timeZone : getLocalTimeZone())), _classNames))
|
|
325
324
|
}, rest, {
|
|
326
325
|
onClick: function onClick(e) {
|
|
327
326
|
buttonProps.onClick && buttonProps.onClick(e);
|
|
@@ -334,7 +333,7 @@ var CalendarCell = function CalendarCell(_ref) {
|
|
|
334
333
|
}), formattedDate));
|
|
335
334
|
};
|
|
336
335
|
|
|
337
|
-
var _excluded$7 = ["state", "navigationDescription", "onSelectedCellClick"];
|
|
336
|
+
var _excluded$7 = ["state", "navigationDescription", "onSelectedCellClick", "classNameForDate", "ariaLabelForDate"];
|
|
338
337
|
var CalendarGrid = function CalendarGrid(_ref) {
|
|
339
338
|
var state = _ref.state,
|
|
340
339
|
navigationDescription = _ref.navigationDescription,
|
|
@@ -342,6 +341,8 @@ var CalendarGrid = function CalendarGrid(_ref) {
|
|
|
342
341
|
onSelectedCellClick = _ref$onSelectedCellCl === void 0 ? function () {
|
|
343
342
|
return;
|
|
344
343
|
} : _ref$onSelectedCellCl,
|
|
344
|
+
classNameForDate = _ref.classNameForDate,
|
|
345
|
+
ariaLabelForDate = _ref.ariaLabelForDate,
|
|
345
346
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded$7);
|
|
346
347
|
var calendarGridId = useRandomId('eds-calendar');
|
|
347
348
|
var _useLocale = useLocale(),
|
|
@@ -383,7 +384,9 @@ var CalendarGrid = function CalendarGrid(_ref) {
|
|
|
383
384
|
state: state,
|
|
384
385
|
date: date,
|
|
385
386
|
"aria-describedby": calendarGridId + 'description',
|
|
386
|
-
onSelectedCellClick: onSelectedCellClick
|
|
387
|
+
onSelectedCellClick: onSelectedCellClick,
|
|
388
|
+
classNameForDate: classNameForDate,
|
|
389
|
+
ariaLabelForDate: ariaLabelForDate
|
|
387
390
|
}) : React.createElement("td", {
|
|
388
391
|
key: i
|
|
389
392
|
});
|
|
@@ -393,7 +396,7 @@ var CalendarGrid = function CalendarGrid(_ref) {
|
|
|
393
396
|
}, getNavigationDescription()));
|
|
394
397
|
};
|
|
395
398
|
|
|
396
|
-
var _excluded$6 = ["selectedDate", "onChange", "locale", "minDate", "maxDate", "style", "children", "navigationDescription", "onSelectedCellClick"];
|
|
399
|
+
var _excluded$6 = ["selectedDate", "onChange", "locale", "minDate", "maxDate", "style", "className", "children", "navigationDescription", "onSelectedCellClick", "classNameForDate", "ariaLabelForDate"];
|
|
397
400
|
var Calendar = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
398
401
|
var selectedDate = _ref.selectedDate,
|
|
399
402
|
onChange = _ref.onChange,
|
|
@@ -401,11 +404,14 @@ var Calendar = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
401
404
|
minDate = _ref.minDate,
|
|
402
405
|
maxDate = _ref.maxDate,
|
|
403
406
|
style = _ref.style,
|
|
407
|
+
className = _ref.className,
|
|
404
408
|
navigationDescription = _ref.navigationDescription,
|
|
405
409
|
_ref$onSelectedCellCl = _ref.onSelectedCellClick,
|
|
406
410
|
onSelectedCellClick = _ref$onSelectedCellCl === void 0 ? function () {
|
|
407
411
|
return;
|
|
408
412
|
} : _ref$onSelectedCellCl,
|
|
413
|
+
classNameForDate = _ref.classNameForDate,
|
|
414
|
+
ariaLabelForDate = _ref.ariaLabelForDate,
|
|
409
415
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded$6);
|
|
410
416
|
var _useLocale = useLocale(),
|
|
411
417
|
locale = _useLocale.locale;
|
|
@@ -432,7 +438,7 @@ var Calendar = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
432
438
|
}
|
|
433
439
|
}, React.createElement("div", _extends({}, calendarProps, {
|
|
434
440
|
ref: ref,
|
|
435
|
-
className:
|
|
441
|
+
className: classNames('eds-datepicker__calendar', className),
|
|
436
442
|
style: style
|
|
437
443
|
}), React.createElement("div", {
|
|
438
444
|
className: "eds-datepicker__calendar__header"
|
|
@@ -447,11 +453,13 @@ var Calendar = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
447
453
|
}))), React.createElement(CalendarGrid, {
|
|
448
454
|
state: state,
|
|
449
455
|
navigationDescription: navigationDescription,
|
|
450
|
-
onSelectedCellClick: onSelectedCellClick
|
|
456
|
+
onSelectedCellClick: onSelectedCellClick,
|
|
457
|
+
classNameForDate: classNameForDate,
|
|
458
|
+
ariaLabelForDate: ariaLabelForDate
|
|
451
459
|
})));
|
|
452
460
|
});
|
|
453
461
|
|
|
454
|
-
var _excluded$5 = ["selectedDate", "onChange", "locale", "disabled", "showTime", "showTimeZone", "className", "style", "variant", "feedback", "validationVariant", "validationFeedback", "disableModal", "labelTooltip", "navigationDescription", "minDate", "maxDate", "modalTreshold", "forcedReturnType"];
|
|
462
|
+
var _excluded$5 = ["selectedDate", "onChange", "locale", "disabled", "showTime", "showTimeZone", "classNameForDate", "className", "style", "variant", "feedback", "validationVariant", "validationFeedback", "disableModal", "labelTooltip", "navigationDescription", "minDate", "maxDate", "modalTreshold", "forcedReturnType", "ariaLabelForDate"];
|
|
455
463
|
var DatePicker = function DatePicker(_ref) {
|
|
456
464
|
var selectedDate = _ref.selectedDate,
|
|
457
465
|
onChange = _ref.onChange,
|
|
@@ -460,6 +468,7 @@ var DatePicker = function DatePicker(_ref) {
|
|
|
460
468
|
showTime = _ref.showTime,
|
|
461
469
|
_ref$showTimeZone = _ref.showTimeZone,
|
|
462
470
|
showTimeZone = _ref$showTimeZone === void 0 ? false : _ref$showTimeZone,
|
|
471
|
+
classNameForDate = _ref.classNameForDate,
|
|
463
472
|
className = _ref.className,
|
|
464
473
|
variant = _ref.variant,
|
|
465
474
|
feedback = _ref.feedback,
|
|
@@ -474,6 +483,7 @@ var DatePicker = function DatePicker(_ref) {
|
|
|
474
483
|
_ref$modalTreshold = _ref.modalTreshold,
|
|
475
484
|
modalTreshold = _ref$modalTreshold === void 0 ? 1000 : _ref$modalTreshold,
|
|
476
485
|
forcedReturnType = _ref.forcedReturnType,
|
|
486
|
+
ariaLabelForDate = _ref.ariaLabelForDate,
|
|
477
487
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded$5);
|
|
478
488
|
var CALENDAR_MODAL_MAX_SCREEN_WIDTH = modalTreshold;
|
|
479
489
|
var datePickerRef = useRef(null);
|
|
@@ -536,7 +546,9 @@ var DatePicker = function DatePicker(_ref) {
|
|
|
536
546
|
onChange: handleOnChange,
|
|
537
547
|
minDate: minDate,
|
|
538
548
|
maxDate: maxDate,
|
|
539
|
-
ref: calendarRef
|
|
549
|
+
ref: calendarRef,
|
|
550
|
+
classNameForDate: classNameForDate,
|
|
551
|
+
ariaLabelForDate: ariaLabelForDate
|
|
540
552
|
});
|
|
541
553
|
var useModal = typeof width !== 'undefined' && width <= CALENDAR_MODAL_MAX_SCREEN_WIDTH && !disableModal;
|
|
542
554
|
var popoverCalendar = React.createElement("div", {
|