@entur/datepicker 4.0.0-alpha.1 → 4.0.0-beta.1
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 +12 -0
- package/dist/DatePicker/beta/DateField.d.ts +15 -1
- package/dist/DatePicker/beta/DatePicker.d.ts +31 -9
- package/dist/datepicker.cjs.development.js +26 -10
- 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 +26 -10
- package/dist/datepicker.esm.js.map +1 -1
- package/dist/styles.css +109 -94
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,18 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [4.0.0-beta.1](https://bitbucket.org/enturas/design-system/compare/@entur/datepicker@4.0.0-beta.0...@entur/datepicker@4.0.0-beta.1) (2022-10-28)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- **datepicker:** hide next and previous month button when disabled ([1ae7037](https://bitbucket.org/enturas/design-system/commits/1ae70371fb5622b1fbfc593c9c0becd83f665531))
|
|
11
|
+
|
|
12
|
+
# [4.0.0-beta.0](https://bitbucket.org/enturas/design-system/compare/@entur/datepicker@4.0.0-alpha.1...@entur/datepicker@4.0.0-beta.0) (2022-10-27)
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
- **datepicker:** final touches to datepicker and supcomponents ([8c21915](https://bitbucket.org/enturas/design-system/commits/8c21915cea21346444bfdf2b66bfe10de1c9fcba))
|
|
17
|
+
|
|
6
18
|
# [4.0.0-alpha.1](https://bitbucket.org/enturas/design-system/compare/@entur/datepicker@4.0.0-alpha.0...@entur/datepicker@4.0.0-alpha.1) (2022-10-26)
|
|
7
19
|
|
|
8
20
|
### Bug Fixes
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { SpectrumDateFieldProps, DateValue } from '@react-types/datepicker';
|
|
3
|
+
import type { CalendarDate } from '@internationalized/date';
|
|
3
4
|
import { VariantType } from '@entur/form';
|
|
4
5
|
import './DateField.scss';
|
|
5
6
|
export declare type DateFieldProps = {
|
|
@@ -18,15 +19,28 @@ export declare type DateFieldProps = {
|
|
|
18
19
|
*/
|
|
19
20
|
showTimeZone?: boolean;
|
|
20
21
|
showTime?: boolean;
|
|
22
|
+
/** Tidligste gyldige datovalg.
|
|
23
|
+
* Eks: today(getLocalTimeZone()) == i dag i lokal tidssone */
|
|
24
|
+
minValue?: CalendarDate;
|
|
25
|
+
/** Seneste gyldige datovalg. (se minValue) */
|
|
26
|
+
maxValue?: CalendarDate;
|
|
21
27
|
/** Varselmelding, som vil komme under TimePicker */
|
|
22
28
|
feedback?: string;
|
|
23
29
|
/** Valideringsvariant */
|
|
24
30
|
variant?: VariantType;
|
|
31
|
+
/** Varselmelding som forteller om ugyldig dato
|
|
32
|
+
* @default "Ugyldig dato"
|
|
33
|
+
*/
|
|
34
|
+
validationFeedback?: string;
|
|
35
|
+
/** Valideringsvariant for melding om ugyldig dato
|
|
36
|
+
* @default "error"
|
|
37
|
+
*/
|
|
38
|
+
validationVariant?: VariantType;
|
|
25
39
|
labelTooltip?: React.ReactNode;
|
|
26
40
|
disabled?: boolean;
|
|
27
41
|
/** Ekstra klassenavn */
|
|
28
42
|
className?: string;
|
|
29
43
|
style?: React.CSSProperties;
|
|
30
44
|
[key: string]: any;
|
|
31
|
-
} & Omit<SpectrumDateFieldProps<DateValue>, 'onChange' | 'label' | 'hideTimeZone' | 'placeholder'>;
|
|
45
|
+
} & Omit<SpectrumDateFieldProps<DateValue>, 'value' | 'onChange' | 'label' | 'hideTimeZone' | 'placeholder' | 'minValue' | 'maxValue'>;
|
|
32
46
|
export declare const DateField: React.ForwardRefExoticComponent<Pick<DateFieldProps, string | number> & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type {
|
|
3
|
-
import {
|
|
2
|
+
import type { CalendarDate } from '@internationalized/date';
|
|
3
|
+
import type { DateValue, SpectrumDatePickerProps } from '@react-types/datepicker';
|
|
4
|
+
import type { VariantType } from '@entur/form';
|
|
4
5
|
import './DatePicker.scss';
|
|
5
6
|
declare type DatePickerProps = {
|
|
6
7
|
/** Den valgte datoen. Dato i '@internationalized/date'-pakkens format */
|
|
@@ -17,25 +18,46 @@ declare type DatePickerProps = {
|
|
|
17
18
|
* @default false
|
|
18
19
|
*/
|
|
19
20
|
showTimeZone?: boolean;
|
|
20
|
-
/** Viser tidspunkt i tillegg til dato
|
|
21
|
+
/** Viser tidspunkt i tillegg til dato.
|
|
22
|
+
* OBS: selectedDate må være av typen CalendarDateTime eller ZonedDateTime
|
|
23
|
+
*/
|
|
21
24
|
showTime?: boolean;
|
|
25
|
+
/** Tidligste gyldige datovalg.
|
|
26
|
+
* Eks: today(getLocalTimeZone()) == i dag i lokal tidssone. */
|
|
27
|
+
minValue?: CalendarDate;
|
|
28
|
+
/** Seneste gyldige datovalg.
|
|
29
|
+
* Eks: today(getLocalTimeZone()) == i dag i lokal tidssone
|
|
30
|
+
*
|
|
31
|
+
* OBS: Hvis du bruker dato med tid vil det være til, men ikke med denne datoen */
|
|
32
|
+
maxValue?: CalendarDate;
|
|
33
|
+
/** Funksjon som tar inn en dato og sier om den er utilgjengelig.
|
|
34
|
+
* Eks. (date) => isWeekend(date, 'no-NO') == helgedager er ikke tilgjengelig */
|
|
35
|
+
isDateUnavailable?: (date: DateValue) => boolean;
|
|
22
36
|
/** Varselmelding, som vil komme under DatePicker sitt inputfelt */
|
|
23
37
|
feedback?: string;
|
|
24
38
|
/** Valideringsvariant */
|
|
25
39
|
variant?: VariantType;
|
|
40
|
+
/** Varselmelding som forteller om ugyldig dato
|
|
41
|
+
* @default "Ugyldig dato"
|
|
42
|
+
*/
|
|
43
|
+
validationFeedback?: string;
|
|
44
|
+
/** Valideringsvariant for melding om ugyldig dato
|
|
45
|
+
* @default "error"
|
|
46
|
+
*/
|
|
47
|
+
validationVariant?: VariantType;
|
|
26
48
|
disabled?: boolean;
|
|
27
49
|
/** Hvis true vil kalenderen alltid vises i en popover når den åpnes
|
|
28
50
|
* @default false
|
|
29
51
|
*/
|
|
30
52
|
disableModal?: boolean;
|
|
31
|
-
|
|
32
|
-
className?: string;
|
|
33
|
-
style?: React.CSSProperties;
|
|
53
|
+
labelTooltip?: React.ReactNode;
|
|
34
54
|
/** Skjermlesertest som forklarer navigasjon i kalenderen. Oversettes automatisk for engelsk locale, men ikke andre språk.
|
|
35
55
|
* @default 'Bruk piltastene til å navigere mellom datoer'
|
|
36
56
|
*/
|
|
37
57
|
navigationDescription?: string;
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
58
|
+
/** Ekstra klassenavn */
|
|
59
|
+
className?: string;
|
|
60
|
+
style?: React.CSSProperties;
|
|
61
|
+
} & Omit<SpectrumDatePickerProps<DateValue>, 'value' | 'onChange' | 'label' | 'hideTimeZone' | 'placeholder' | 'minValue' | 'maxValue'>;
|
|
62
|
+
export declare const DatePickerBeta: ({ selectedDate: value, onChange, locale, disabled: isDisabled, showTime, showTimeZone, className, style, variant, feedback, validationVariant, validationFeedback, disableModal, labelTooltip, navigationDescription, ...rest }: DatePickerProps) => JSX.Element;
|
|
41
63
|
export {};
|
|
@@ -599,7 +599,7 @@ var ariaLabelIfNorwegian = function ariaLabelIfNorwegian(norwegianAriaLabel, loc
|
|
|
599
599
|
return norwegianAriaLabel;
|
|
600
600
|
};
|
|
601
601
|
|
|
602
|
-
var _excluded$8 = ["selectedDate", "label", "locale", "showTimeZone", "showTime", "granularity", "disabled", "variant", "feedback", "labelTooltip", "style", "className", "labelProps", "append"];
|
|
602
|
+
var _excluded$8 = ["selectedDate", "label", "locale", "showTimeZone", "showTime", "granularity", "disabled", "variant", "feedback", "validationVariant", "validationFeedback", "labelTooltip", "style", "className", "labelProps", "append"];
|
|
603
603
|
var DateField = /*#__PURE__*/React__default["default"].forwardRef(function (_ref, ref) {
|
|
604
604
|
var value = _ref.selectedDate,
|
|
605
605
|
label = _ref.label,
|
|
@@ -611,6 +611,10 @@ var DateField = /*#__PURE__*/React__default["default"].forwardRef(function (_ref
|
|
|
611
611
|
disabled = _ref.disabled,
|
|
612
612
|
variant = _ref.variant,
|
|
613
613
|
feedback = _ref.feedback,
|
|
614
|
+
_ref$validationVarian = _ref.validationVariant,
|
|
615
|
+
validationVariant = _ref$validationVarian === void 0 ? 'error' : _ref$validationVarian,
|
|
616
|
+
_ref$validationFeedba = _ref.validationFeedback,
|
|
617
|
+
validationFeedback = _ref$validationFeedba === void 0 ? 'Ugyldig dato' : _ref$validationFeedba,
|
|
614
618
|
labelTooltip = _ref.labelTooltip,
|
|
615
619
|
style = _ref.style,
|
|
616
620
|
className = _ref.className,
|
|
@@ -656,9 +660,10 @@ var DateField = /*#__PURE__*/React__default["default"].forwardRef(function (_ref
|
|
|
656
660
|
labelTooltip: labelTooltip,
|
|
657
661
|
labelProps: parentLabelProps != null ? parentLabelProps : labelProps
|
|
658
662
|
}, fieldProps, {
|
|
659
|
-
variant: variant,
|
|
660
|
-
feedback: feedback,
|
|
661
|
-
append: append
|
|
663
|
+
variant: (variant != null ? variant : state.validationState === 'invalid') ? validationVariant : undefined,
|
|
664
|
+
feedback: (feedback != null ? feedback : state.validationState === 'invalid') ? validationFeedback : undefined,
|
|
665
|
+
append: append,
|
|
666
|
+
ariaAlertOnFeedback: true
|
|
662
667
|
}), state.segments.map(function (segment, i) {
|
|
663
668
|
return React__default["default"].createElement(FieldSegment, {
|
|
664
669
|
segment: segment,
|
|
@@ -715,8 +720,8 @@ var CalendarCell = function CalendarCell(_ref) {
|
|
|
715
720
|
hidden: isOutsideVisibleRange,
|
|
716
721
|
className: classNames__default["default"]('eds-datepicker__calendar__grid__cell', {
|
|
717
722
|
'eds-datepicker__calendar__grid__cell--selected': isSelected,
|
|
718
|
-
'eds-datepicker__calendar__grid__cell--disabled': isDisabled,
|
|
719
|
-
'eds-datepicker__calendar__grid__cell--
|
|
723
|
+
'eds-datepicker__calendar__grid__cell--disabled': isDisabled || isUnavailable,
|
|
724
|
+
'eds-datepicker__calendar__grid__cell--outside-month': isOutsideVisibleRange,
|
|
720
725
|
'eds-datepicker__calendar__grid__cell--today': date.isEqualDay(date$1, date.now((_state$timeZone = state.timeZone) != null ? _state$timeZone : date.getLocalTimeZone()))
|
|
721
726
|
})
|
|
722
727
|
}, rest), formattedDate));
|
|
@@ -830,17 +835,23 @@ var Calendar = /*#__PURE__*/React__default["default"].forwardRef(function (_ref,
|
|
|
830
835
|
})));
|
|
831
836
|
});
|
|
832
837
|
|
|
833
|
-
var _excluded$3 = ["selectedDate", "onChange", "locale", "disabled", "className", "style", "variant", "feedback", "disableModal", "navigationDescription"];
|
|
838
|
+
var _excluded$3 = ["selectedDate", "onChange", "locale", "disabled", "showTime", "showTimeZone", "className", "style", "variant", "feedback", "validationVariant", "validationFeedback", "disableModal", "labelTooltip", "navigationDescription"];
|
|
834
839
|
var DatePickerBeta = function DatePickerBeta(_ref) {
|
|
835
840
|
var value = _ref.selectedDate,
|
|
836
841
|
_onChange = _ref.onChange,
|
|
837
842
|
locale = _ref.locale,
|
|
838
843
|
isDisabled = _ref.disabled,
|
|
844
|
+
showTime = _ref.showTime,
|
|
845
|
+
_ref$showTimeZone = _ref.showTimeZone,
|
|
846
|
+
showTimeZone = _ref$showTimeZone === void 0 ? false : _ref$showTimeZone,
|
|
839
847
|
className = _ref.className,
|
|
840
848
|
variant = _ref.variant,
|
|
841
849
|
feedback = _ref.feedback,
|
|
850
|
+
validationVariant = _ref.validationVariant,
|
|
851
|
+
validationFeedback = _ref.validationFeedback,
|
|
842
852
|
_ref$disableModal = _ref.disableModal,
|
|
843
853
|
disableModal = _ref$disableModal === void 0 ? false : _ref$disableModal,
|
|
854
|
+
labelTooltip = _ref.labelTooltip,
|
|
844
855
|
navigationDescription = _ref.navigationDescription,
|
|
845
856
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded$3);
|
|
846
857
|
|
|
@@ -978,12 +989,17 @@ var DatePickerBeta = function DatePickerBeta(_ref) {
|
|
|
978
989
|
selectedDate: state.value,
|
|
979
990
|
label: rest.label,
|
|
980
991
|
labelProps: labelProps,
|
|
992
|
+
showTime: showTime,
|
|
993
|
+
showTimeZone: showTimeZone,
|
|
981
994
|
ref: dateFieldRef,
|
|
995
|
+
variant: variant,
|
|
996
|
+
feedback: feedback,
|
|
997
|
+
validationVariant: validationVariant,
|
|
998
|
+
validationFeedback: validationFeedback,
|
|
999
|
+
labelTooltip: labelTooltip,
|
|
982
1000
|
className: classNames__default["default"]('eds-datepicker__datefield', {
|
|
983
1001
|
'eds-datepicker__datefield--disabled': fieldProps.isDisabled
|
|
984
|
-
})
|
|
985
|
-
variant: variant,
|
|
986
|
-
feedback: feedback
|
|
1002
|
+
})
|
|
987
1003
|
})), !fieldProps.isDisabled && React__default["default"].createElement(CalendarButton, _extends({}, buttonProps, {
|
|
988
1004
|
onPress: function onPress() {
|
|
989
1005
|
return handleCalendarButtonOnClick(state.isOpen);
|