@helsenorge/datepicker 6.3.0 → 6.4.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/CHANGELOG.md +17 -0
- package/__mocks__/styleMock.d.ts +1 -1
- package/components/DatePicker/DatePicker.d.ts +39 -39
- package/components/DatePicker/DatePickerPopup.d.ts +9 -9
- package/components/DatePicker/DateTime.d.ts +17 -17
- package/components/DatePicker/DateTimePickerWrapper.d.ts +14 -14
- package/components/DatePicker/index.d.ts +6 -6
- package/components/DatePicker/position-utils.d.ts +26 -26
- package/components/DatePicker/validate-utils.d.ts +17 -17
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
1
|
+
## [6.3.0](https://github.com/helsenorge/designsystem/branchCompare?baseVersion=GTv6.2.0&targetVersion=GTv6.3.0) (2024-02-22)
|
|
2
|
+
|
|
3
|
+
### Features
|
|
4
|
+
|
|
5
|
+
- select og datepicker støtter autoComplete-attributt
|
|
6
|
+
([84c34af](https://github.com/helsenorge/designsystem/commit/84c34afd23a5d236573f5b3b3480175708fb9ecc)), closes
|
|
7
|
+
[#314727](https://github.com/helsenorge/designsystem/issues/314727) [#314932](https://github.com/helsenorge/designsystem/issues/314932)
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
- badge er inline-flex og skalerer ikke til full bredde
|
|
12
|
+
([ac485e9](https://github.com/helsenorge/designsystem/commit/ac485e923223e7a92ede0743e924a2c39c40bbb8))
|
|
13
|
+
- spacing i promopanel ([60a00bd](https://github.com/helsenorge/designsystem/commit/60a00bdb88d3b35b2e7b1449832674a9bf35ee46))
|
|
14
|
+
- tabell endrer responsiv oppførsel når den vises
|
|
15
|
+
([0c21208](https://github.com/helsenorge/designsystem/commit/0c212084cfa5161842dbb0339ae85c82e3c42046)), closes
|
|
16
|
+
[#315245](https://github.com/helsenorge/designsystem/issues/315245)
|
|
17
|
+
|
|
1
18
|
## [6.2.0](https://github.com/helsenorge/designsystem/branchCompare?baseVersion=GTv6.1.3&targetVersion=GTv6.2.0) (2024-02-20)
|
|
2
19
|
|
|
3
20
|
### Features
|
package/__mocks__/styleMock.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
|
2
2
|
//# sourceMappingURL=styleMock.d.ts.map
|
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { DayPickerSingleProps } from 'react-day-picker';
|
|
3
|
-
export type DateFormat = 'dd.MM.yyyy';
|
|
4
|
-
export interface DatePickerProps extends Pick<React.InputHTMLAttributes<HTMLInputElement>, 'name' | 'aria-describedby' | 'onBlur' | 'autoComplete'>, Pick<DayPickerSingleProps, 'dir' | 'initialFocus'> {
|
|
5
|
-
/** Adds custom classes to the element. */
|
|
6
|
-
className?: string;
|
|
7
|
-
/** Sets aria-label on the button that opens the datepicker dialogue */
|
|
8
|
-
dateButtonAriaLabel?: string;
|
|
9
|
-
/** Sets the format of the date - only applies for desktop use. Native mobile date fields base their formats on the device */
|
|
10
|
-
dateFormat?: DateFormat;
|
|
11
|
-
/** Sets the date of the component */
|
|
12
|
-
dateValue?: Date;
|
|
13
|
-
/** Sets the current month */
|
|
14
|
-
defaultMonth?: Date;
|
|
15
|
-
/** Disables the days in the datepicker */
|
|
16
|
-
disableDays?: Date[];
|
|
17
|
-
/** Disables weekends in the datepicker */
|
|
18
|
-
disableWeekends?: boolean;
|
|
19
|
-
/** Activates Error style for the input */
|
|
20
|
-
error?: boolean;
|
|
21
|
-
/** Error text to show above the component */
|
|
22
|
-
errorText?: string;
|
|
23
|
-
/** Content to be rendered in the footer of the datepicker popup */
|
|
24
|
-
footerContent?: React.ReactNode;
|
|
25
|
-
/** Label of the input */
|
|
26
|
-
label?: React.ReactNode;
|
|
27
|
-
/** Sets the locale of the datepicker */
|
|
28
|
-
locale?: Locale;
|
|
29
|
-
/** Maximum date allowed to be selected */
|
|
30
|
-
maxDate?: Date;
|
|
31
|
-
/** Minimum date allowed to be selected */
|
|
32
|
-
minDate?: Date;
|
|
33
|
-
/** onChange callback trigges ved endring i valgt dato */
|
|
34
|
-
onChange?: (event: React.ChangeEvent<HTMLInputElement> | React.MouseEvent<Element, MouseEvent>, date: Date | string | undefined) => void;
|
|
35
|
-
/** Sets the data-testid attribute. */
|
|
36
|
-
testId?: string;
|
|
37
|
-
}
|
|
38
|
-
export declare const DatePicker: React.ForwardRefExoticComponent<DatePickerProps & React.RefAttributes<HTMLInputElement>>;
|
|
39
|
-
export default DatePicker;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { DayPickerSingleProps } from 'react-day-picker';
|
|
3
|
+
export type DateFormat = 'dd.MM.yyyy';
|
|
4
|
+
export interface DatePickerProps extends Pick<React.InputHTMLAttributes<HTMLInputElement>, 'name' | 'aria-describedby' | 'onBlur' | 'autoComplete'>, Pick<DayPickerSingleProps, 'dir' | 'initialFocus'> {
|
|
5
|
+
/** Adds custom classes to the element. */
|
|
6
|
+
className?: string;
|
|
7
|
+
/** Sets aria-label on the button that opens the datepicker dialogue */
|
|
8
|
+
dateButtonAriaLabel?: string;
|
|
9
|
+
/** Sets the format of the date - only applies for desktop use. Native mobile date fields base their formats on the device */
|
|
10
|
+
dateFormat?: DateFormat;
|
|
11
|
+
/** Sets the date of the component */
|
|
12
|
+
dateValue?: Date;
|
|
13
|
+
/** Sets the current month */
|
|
14
|
+
defaultMonth?: Date;
|
|
15
|
+
/** Disables the days in the datepicker */
|
|
16
|
+
disableDays?: Date[];
|
|
17
|
+
/** Disables weekends in the datepicker */
|
|
18
|
+
disableWeekends?: boolean;
|
|
19
|
+
/** Activates Error style for the input */
|
|
20
|
+
error?: boolean;
|
|
21
|
+
/** Error text to show above the component */
|
|
22
|
+
errorText?: string;
|
|
23
|
+
/** Content to be rendered in the footer of the datepicker popup */
|
|
24
|
+
footerContent?: React.ReactNode;
|
|
25
|
+
/** Label of the input */
|
|
26
|
+
label?: React.ReactNode;
|
|
27
|
+
/** Sets the locale of the datepicker */
|
|
28
|
+
locale?: Locale;
|
|
29
|
+
/** Maximum date allowed to be selected */
|
|
30
|
+
maxDate?: Date;
|
|
31
|
+
/** Minimum date allowed to be selected */
|
|
32
|
+
minDate?: Date;
|
|
33
|
+
/** onChange callback trigges ved endring i valgt dato */
|
|
34
|
+
onChange?: (event: React.ChangeEvent<HTMLInputElement> | React.MouseEvent<Element, MouseEvent>, date: Date | string | undefined) => void;
|
|
35
|
+
/** Sets the data-testid attribute. */
|
|
36
|
+
testId?: string;
|
|
37
|
+
}
|
|
38
|
+
export declare const DatePicker: React.ForwardRefExoticComponent<DatePickerProps & React.RefAttributes<HTMLInputElement>>;
|
|
39
|
+
export default DatePicker;
|
|
40
40
|
//# sourceMappingURL=DatePicker.d.ts.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { DayPickerSingleProps } from 'react-day-picker';
|
|
3
|
-
interface DatePickerPopupProps extends Pick<DayPickerSingleProps, 'dir' | 'disabled' | 'footer' | 'fromDate' | 'initialFocus' | 'locale' | 'month' | 'selected' | 'onSelect' | 'onMonthChange' | 'toDate'> {
|
|
4
|
-
datepickerWrapperRef: React.RefObject<HTMLDivElement>;
|
|
5
|
-
inputRef: React.RefObject<HTMLInputElement>;
|
|
6
|
-
testId?: string;
|
|
7
|
-
}
|
|
8
|
-
declare const DatePickerPopup: React.FC<DatePickerPopupProps>;
|
|
9
|
-
export default DatePickerPopup;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { DayPickerSingleProps } from 'react-day-picker';
|
|
3
|
+
interface DatePickerPopupProps extends Pick<DayPickerSingleProps, 'dir' | 'disabled' | 'footer' | 'fromDate' | 'initialFocus' | 'locale' | 'month' | 'selected' | 'onSelect' | 'onMonthChange' | 'toDate'> {
|
|
4
|
+
datepickerWrapperRef: React.RefObject<HTMLDivElement>;
|
|
5
|
+
inputRef: React.RefObject<HTMLInputElement>;
|
|
6
|
+
testId?: string;
|
|
7
|
+
}
|
|
8
|
+
declare const DatePickerPopup: React.FC<DatePickerPopupProps>;
|
|
9
|
+
export default DatePickerPopup;
|
|
10
10
|
//# sourceMappingURL=DatePickerPopup.d.ts.map
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
export type TimeUnit = 'hours' | 'minutes';
|
|
3
|
-
export interface DateTimeProps extends Pick<React.InputHTMLAttributes<HTMLInputElement>, 'name' | 'aria-describedby' | 'aria-labelledby' | 'onChange' | 'disabled' | 'autoComplete'> {
|
|
4
|
-
defaultValue?: number;
|
|
5
|
-
/** Activates Error style for the input */
|
|
6
|
-
error?: boolean;
|
|
7
|
-
/** Error text to show above the component */
|
|
8
|
-
errorText?: string;
|
|
9
|
-
/** Label of the input */
|
|
10
|
-
label?: React.ReactNode;
|
|
11
|
-
/** Sets the unit of time for the input field */
|
|
12
|
-
timeUnit: TimeUnit;
|
|
13
|
-
/** Sets the data-testid attribute. */
|
|
14
|
-
testId?: string;
|
|
15
|
-
}
|
|
16
|
-
export declare const DateTime: React.ForwardRefExoticComponent<DateTimeProps & React.RefAttributes<HTMLInputElement>>;
|
|
17
|
-
export default DateTime;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type TimeUnit = 'hours' | 'minutes';
|
|
3
|
+
export interface DateTimeProps extends Pick<React.InputHTMLAttributes<HTMLInputElement>, 'name' | 'aria-describedby' | 'aria-labelledby' | 'onChange' | 'disabled' | 'autoComplete'> {
|
|
4
|
+
defaultValue?: number;
|
|
5
|
+
/** Activates Error style for the input */
|
|
6
|
+
error?: boolean;
|
|
7
|
+
/** Error text to show above the component */
|
|
8
|
+
errorText?: string;
|
|
9
|
+
/** Label of the input */
|
|
10
|
+
label?: React.ReactNode;
|
|
11
|
+
/** Sets the unit of time for the input field */
|
|
12
|
+
timeUnit: TimeUnit;
|
|
13
|
+
/** Sets the data-testid attribute. */
|
|
14
|
+
testId?: string;
|
|
15
|
+
}
|
|
16
|
+
export declare const DateTime: React.ForwardRefExoticComponent<DateTimeProps & React.RefAttributes<HTMLInputElement>>;
|
|
17
|
+
export default DateTime;
|
|
18
18
|
//# sourceMappingURL=DateTime.d.ts.map
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
export type TimeUnits = 'hours' | 'minutes';
|
|
3
|
-
interface DateTimePickerWrapperProps {
|
|
4
|
-
/** Sets the children of the datetimepicker - the DatePicker and DateTime components go here */
|
|
5
|
-
children?: React.ReactNode;
|
|
6
|
-
/** Error text to show above the component */
|
|
7
|
-
errorText?: string;
|
|
8
|
-
/** text placed in the legend tag of the fieldset */
|
|
9
|
-
legend?: string;
|
|
10
|
-
/** Sets the data-testid attribute. */
|
|
11
|
-
testId?: string;
|
|
12
|
-
}
|
|
13
|
-
export declare const DateTimePickerWrapper: React.ForwardRefExoticComponent<DateTimePickerWrapperProps & React.RefAttributes<HTMLDivElement>>;
|
|
14
|
-
export default DateTimePickerWrapper;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type TimeUnits = 'hours' | 'minutes';
|
|
3
|
+
interface DateTimePickerWrapperProps {
|
|
4
|
+
/** Sets the children of the datetimepicker - the DatePicker and DateTime components go here */
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
/** Error text to show above the component */
|
|
7
|
+
errorText?: string;
|
|
8
|
+
/** text placed in the legend tag of the fieldset */
|
|
9
|
+
legend?: string;
|
|
10
|
+
/** Sets the data-testid attribute. */
|
|
11
|
+
testId?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare const DateTimePickerWrapper: React.ForwardRefExoticComponent<DateTimePickerWrapperProps & React.RefAttributes<HTMLDivElement>>;
|
|
14
|
+
export default DateTimePickerWrapper;
|
|
15
15
|
//# sourceMappingURL=DateTimePickerWrapper.d.ts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { DatePicker } from './DatePicker';
|
|
2
|
-
export { DateTime } from './DateTime';
|
|
3
|
-
export { DateTimePickerWrapper } from './DateTimePickerWrapper';
|
|
4
|
-
export * from './validate-utils';
|
|
5
|
-
export * from './DatePicker';
|
|
6
|
-
export default DatePicker;
|
|
1
|
+
import { DatePicker } from './DatePicker';
|
|
2
|
+
export { DateTime } from './DateTime';
|
|
3
|
+
export { DateTimePickerWrapper } from './DateTimePickerWrapper';
|
|
4
|
+
export * from './validate-utils';
|
|
5
|
+
export * from './DatePicker';
|
|
6
|
+
export default DatePicker;
|
|
7
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { CSSProperties } from 'react';
|
|
2
|
-
import { PopOverVariant } from '@helsenorge/designsystem-react/components/PopOver';
|
|
3
|
-
/**
|
|
4
|
-
* Beregn om hjelpeboblen skal vises over eller under kontrolleren
|
|
5
|
-
* @param controllerSize DOMRect for controlleren
|
|
6
|
-
* @param bubbleSize DOMRect for hjelpeboblen
|
|
7
|
-
* @param variant Ønsket plassering av hjelpeboblen (over/under/automatisk)
|
|
8
|
-
* @returns Om hjelpeboblen skal vises over eller under
|
|
9
|
-
*/
|
|
10
|
-
export declare const getVerticalPosition: (controllerSize: DOMRect, bubbleSize: DOMRect) => keyof typeof PopOverVariant;
|
|
11
|
-
/**
|
|
12
|
-
* Finn riktig plassering av hjelpeboblen
|
|
13
|
-
* @param controllerSize DOMRect for controlleren
|
|
14
|
-
* @param bubbleSize DOMRect for hjelpeboblen
|
|
15
|
-
* @param variant Ønsket plassering av hjelpeboblen (over/under)
|
|
16
|
-
* @returns CSSProperties som plasserer hjelpeboblen riktig
|
|
17
|
-
*/
|
|
18
|
-
export declare const getBubbleStyle: (controllerSize: DOMRect, bubbleSize: DOMRect) => CSSProperties;
|
|
19
|
-
/**
|
|
20
|
-
* Finn riktig plassering av pilen
|
|
21
|
-
* @param bubbleStyle CSSProperties for hjelpeboblen
|
|
22
|
-
* @param controllerSize DOMRect for kontrolleren
|
|
23
|
-
* @param verticalPosition Ønsket plassering av hjelpeboblen (over/under)
|
|
24
|
-
* @returns CSSProperties som plasserer pilen riktig
|
|
25
|
-
*/
|
|
26
|
-
export declare const getArrowStyle: (bubbleStyle: CSSProperties, controllerSize: DOMRect, verticalPosition: keyof typeof PopOverVariant) => CSSProperties;
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
import { PopOverVariant } from '@helsenorge/designsystem-react/components/PopOver';
|
|
3
|
+
/**
|
|
4
|
+
* Beregn om hjelpeboblen skal vises over eller under kontrolleren
|
|
5
|
+
* @param controllerSize DOMRect for controlleren
|
|
6
|
+
* @param bubbleSize DOMRect for hjelpeboblen
|
|
7
|
+
* @param variant Ønsket plassering av hjelpeboblen (over/under/automatisk)
|
|
8
|
+
* @returns Om hjelpeboblen skal vises over eller under
|
|
9
|
+
*/
|
|
10
|
+
export declare const getVerticalPosition: (controllerSize: DOMRect, bubbleSize: DOMRect) => keyof typeof PopOverVariant;
|
|
11
|
+
/**
|
|
12
|
+
* Finn riktig plassering av hjelpeboblen
|
|
13
|
+
* @param controllerSize DOMRect for controlleren
|
|
14
|
+
* @param bubbleSize DOMRect for hjelpeboblen
|
|
15
|
+
* @param variant Ønsket plassering av hjelpeboblen (over/under)
|
|
16
|
+
* @returns CSSProperties som plasserer hjelpeboblen riktig
|
|
17
|
+
*/
|
|
18
|
+
export declare const getBubbleStyle: (controllerSize: DOMRect, bubbleSize: DOMRect) => CSSProperties;
|
|
19
|
+
/**
|
|
20
|
+
* Finn riktig plassering av pilen
|
|
21
|
+
* @param bubbleStyle CSSProperties for hjelpeboblen
|
|
22
|
+
* @param controllerSize DOMRect for kontrolleren
|
|
23
|
+
* @param verticalPosition Ønsket plassering av hjelpeboblen (over/under)
|
|
24
|
+
* @returns CSSProperties som plasserer pilen riktig
|
|
25
|
+
*/
|
|
26
|
+
export declare const getArrowStyle: (bubbleStyle: CSSProperties, controllerSize: DOMRect, verticalPosition: keyof typeof PopOverVariant) => CSSProperties;
|
|
27
27
|
//# sourceMappingURL=position-utils.d.ts.map
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
export declare const parseInputDate: (dateString: string) => Date | null;
|
|
2
|
-
export declare const isValidDate: (dateString: string) => boolean;
|
|
3
|
-
/** react-hook-form fromDate and toDate validation */
|
|
4
|
-
export declare const validateMinMaxDate: (date: string, errorMessage: string, minDate?: Date, maxDate?: Date) => string | true;
|
|
5
|
-
/** react-hook-form fromDate and toDate validation */
|
|
6
|
-
export declare const validateDisabledDates: (date: string, disabledDates: Date[], errorMessage: string) => string | true;
|
|
7
|
-
/** react-hook-form fromTime and toTime validation */
|
|
8
|
-
export declare const validateMinTimeMaxTime: (time: {
|
|
9
|
-
hour: number;
|
|
10
|
-
minute: number;
|
|
11
|
-
}, errorMessage: string, minTime?: {
|
|
12
|
-
hour: number;
|
|
13
|
-
minute: number;
|
|
14
|
-
}, maxTime?: {
|
|
15
|
-
hour: number;
|
|
16
|
-
minute: number;
|
|
17
|
-
}) => string | true;
|
|
1
|
+
export declare const parseInputDate: (dateString: string) => Date | null;
|
|
2
|
+
export declare const isValidDate: (dateString: string) => boolean;
|
|
3
|
+
/** react-hook-form fromDate and toDate validation */
|
|
4
|
+
export declare const validateMinMaxDate: (date: string, errorMessage: string, minDate?: Date, maxDate?: Date) => string | true;
|
|
5
|
+
/** react-hook-form fromDate and toDate validation */
|
|
6
|
+
export declare const validateDisabledDates: (date: string, disabledDates: Date[], errorMessage: string) => string | true;
|
|
7
|
+
/** react-hook-form fromTime and toTime validation */
|
|
8
|
+
export declare const validateMinTimeMaxTime: (time: {
|
|
9
|
+
hour: number;
|
|
10
|
+
minute: number;
|
|
11
|
+
}, errorMessage: string, minTime?: {
|
|
12
|
+
hour: number;
|
|
13
|
+
minute: number;
|
|
14
|
+
}, maxTime?: {
|
|
15
|
+
hour: number;
|
|
16
|
+
minute: number;
|
|
17
|
+
}) => string | true;
|
|
18
18
|
//# sourceMappingURL=validate-utils.d.ts.map
|
package/package.json
CHANGED
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
"description": "The official Helsenorge datepicker.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
|
-
"url": "https://github.com/helsenorge/designsystem"
|
|
7
|
+
"url": "git+https://github.com/helsenorge/designsystem.git"
|
|
8
8
|
},
|
|
9
9
|
"homepage": "https://helsenorge.design",
|
|
10
|
-
"version": "6.
|
|
10
|
+
"version": "6.4.0",
|
|
11
11
|
"author": "Helsenorge",
|
|
12
12
|
"license": "MIT",
|
|
13
13
|
"dependencies": {
|