@designsystem-se/af 34.2.1-beta.2 → 34.2.1-beta.3
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/components/digi-bar-chart.js +4 -4
- package/components/digi-form-input-search.js +1 -1
- package/dist/cjs/digi-arbetsformedlingen.cjs.js +1 -1
- package/dist/cjs/digi-bar-chart.cjs.entry.js +4 -4
- package/dist/cjs/digi-button_10.cjs.entry.js +643 -0
- package/dist/cjs/{digi-calendar_16.cjs.entry.js → digi-calendar-datepicker.cjs.entry.js} +48 -1271
- package/dist/cjs/digi-calendar-week-view.cjs.entry.js +51 -50
- package/dist/cjs/digi-calendar_2.cjs.entry.js +478 -0
- package/dist/cjs/digi-code-block_3.cjs.entry.js +5 -4
- package/dist/cjs/digi-dialog.cjs.entry.js +5 -4
- package/dist/cjs/digi-footer.cjs.entry.js +5 -4
- package/dist/cjs/digi-form-error-list.cjs.entry.js +5 -4
- package/dist/cjs/digi-form-file-upload.cjs.entry.js +10 -9
- package/dist/cjs/digi-form-receipt.cjs.entry.js +5 -4
- package/dist/cjs/digi-form-select-filter.cjs.entry.js +6 -5
- package/dist/cjs/digi-form-select_2.cjs.entry.js +176 -0
- package/dist/cjs/digi-header-navigation.cjs.entry.js +5 -4
- package/dist/cjs/digi-header.cjs.entry.js +5 -4
- package/dist/cjs/digi-icon-chevron-left.cjs.entry.js +30 -0
- package/dist/cjs/digi-icon-chevron-right.cjs.entry.js +30 -0
- package/dist/cjs/digi-navigation-pagination.cjs.entry.js +5 -4
- package/dist/cjs/digi-notification-alert.cjs.entry.js +5 -4
- package/dist/cjs/digi-notification-error-page.cjs.entry.js +5 -4
- package/dist/cjs/digi-tools-feedback.cjs.entry.js +5 -4
- package/dist/cjs/digi-util-keydown-handler.cjs.entry.js +83 -0
- package/dist/cjs/digi-util-mutation-observer.cjs.entry.js +64 -0
- package/dist/cjs/{form-validation-message-variation.enum-c5ec3e2d.js → form-file-upload-variation.enum-634cfae8.js} +0 -7
- package/dist/cjs/form-input-variation.enum-d8228d73.js +67 -0
- package/dist/cjs/form-select-variation.enum-528c1bf0.js +16 -0
- package/dist/cjs/form-validation-message-variation.enum-855ae0be.js +8 -0
- package/dist/cjs/index-81fc5a97.js +28 -12
- package/dist/cjs/{index-acb7b350.js → index-ac8e01b4.js} +19 -189
- package/dist/cjs/index-cad91a90.js +66 -0
- package/dist/cjs/index-e8333bcc.js +174 -0
- package/dist/cjs/index.cjs.js +55 -54
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{typography-variation.enum-2cf77231.js → typography-variation.enum-d6a04b47.js} +0 -43
- package/dist/collection/components/_chart/bar-chart/bar-chart.js +4 -4
- package/dist/collection/components/_form/form-input-search/form-input-search.css +4 -0
- package/dist/digi-arbetsformedlingen/digi-arbetsformedlingen.esm.js +1 -1
- package/dist/digi-arbetsformedlingen/index.esm.js +1 -1
- package/dist/digi-arbetsformedlingen/p-1aa24ef1.entry.js +1 -0
- package/dist/digi-arbetsformedlingen/p-1f3345e9.js +1 -0
- package/dist/digi-arbetsformedlingen/p-25854117.js +1 -0
- package/dist/digi-arbetsformedlingen/p-3874db62.entry.js +1 -0
- package/dist/digi-arbetsformedlingen/p-4ad84e73.entry.js +1 -0
- package/dist/digi-arbetsformedlingen/p-4e2796b4.entry.js +1 -0
- package/dist/digi-arbetsformedlingen/p-56ed4535.entry.js +1 -0
- package/dist/digi-arbetsformedlingen/p-6786da6f.entry.js +1 -0
- package/dist/digi-arbetsformedlingen/p-6f59033a.entry.js +1 -0
- package/dist/digi-arbetsformedlingen/p-79152be3.entry.js +1 -0
- package/dist/digi-arbetsformedlingen/p-7933b555.js +1 -0
- package/dist/digi-arbetsformedlingen/p-7aacd45f.js +1 -0
- package/dist/digi-arbetsformedlingen/p-7c138f6f.entry.js +1 -0
- package/dist/digi-arbetsformedlingen/p-831ee484.entry.js +1 -0
- package/dist/digi-arbetsformedlingen/p-84aa5804.entry.js +1 -0
- package/dist/digi-arbetsformedlingen/p-867a8b3e.entry.js +1 -0
- package/dist/digi-arbetsformedlingen/p-881168f2.entry.js +1 -0
- package/dist/digi-arbetsformedlingen/p-905ccb30.js +1 -0
- package/dist/digi-arbetsformedlingen/p-91e65c6d.entry.js +1 -0
- package/dist/digi-arbetsformedlingen/p-9f8189c0.entry.js +1 -0
- package/dist/digi-arbetsformedlingen/p-9f86edca.entry.js +1 -0
- package/dist/digi-arbetsformedlingen/p-a1822414.entry.js +1 -0
- package/dist/digi-arbetsformedlingen/p-ae74ccf4.entry.js +1 -0
- package/dist/digi-arbetsformedlingen/p-bd5122b0.js +1 -0
- package/dist/digi-arbetsformedlingen/p-c7949525.js +1 -0
- package/dist/digi-arbetsformedlingen/p-ce3531cb.entry.js +1 -0
- package/dist/digi-arbetsformedlingen/p-d41834f2.entry.js +1 -0
- package/dist/digi-arbetsformedlingen/p-d612e424.entry.js +1 -0
- package/dist/digi-arbetsformedlingen/p-e5443d9d.entry.js +1 -0
- package/dist/digi-arbetsformedlingen/p-f447b984.js +1 -0
- package/dist/digi-arbetsformedlingen/p-fee0e9e0.entry.js +1 -0
- package/dist/esm/digi-arbetsformedlingen.js +1 -1
- package/dist/esm/digi-bar-chart.entry.js +4 -4
- package/dist/esm/digi-button_10.entry.js +630 -0
- package/dist/esm/{digi-calendar_16.entry.js → digi-calendar-datepicker.entry.js} +11 -1219
- package/dist/esm/digi-calendar-week-view.entry.js +2 -1
- package/dist/esm/digi-calendar_2.entry.js +473 -0
- package/dist/esm/digi-code-block_3.entry.js +5 -4
- package/dist/esm/digi-dialog.entry.js +5 -4
- package/dist/esm/digi-footer.entry.js +5 -4
- package/dist/esm/digi-form-error-list.entry.js +5 -4
- package/dist/esm/digi-form-file-upload.entry.js +2 -1
- package/dist/esm/digi-form-receipt.entry.js +5 -4
- package/dist/esm/digi-form-select-filter.entry.js +5 -4
- package/dist/esm/digi-form-select_2.entry.js +171 -0
- package/dist/esm/digi-header-navigation.entry.js +5 -4
- package/dist/esm/digi-header.entry.js +5 -4
- package/dist/esm/digi-icon-chevron-left.entry.js +26 -0
- package/dist/esm/digi-icon-chevron-right.entry.js +26 -0
- package/dist/esm/digi-navigation-pagination.entry.js +5 -4
- package/dist/esm/digi-notification-alert.entry.js +5 -4
- package/dist/esm/digi-notification-error-page.entry.js +5 -4
- package/dist/esm/digi-tools-feedback.entry.js +5 -4
- package/dist/esm/digi-util-keydown-handler.entry.js +79 -0
- package/dist/esm/digi-util-mutation-observer.entry.js +60 -0
- package/dist/esm/{form-validation-message-variation.enum-f7835fc5.js → form-file-upload-variation.enum-9c49ec5e.js} +1 -8
- package/dist/esm/form-input-variation.enum-b78808ba.js +67 -0
- package/dist/esm/form-select-variation.enum-f2f6098d.js +16 -0
- package/dist/esm/form-validation-message-variation.enum-bcef8a9d.js +8 -0
- package/dist/esm/{index-dc6b83f7.js → index-2fce392f.js} +3 -170
- package/dist/esm/index-5b6c95c6.js +63 -0
- package/dist/esm/index-8685f88d.js +170 -0
- package/dist/esm/index-bfea2cc5.js +28 -12
- package/dist/esm/index.js +5 -4
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{typography-variation.enum-259c1751.js → typography-variation.enum-0f0f74d5.js} +1 -44
- package/hydrate/index.js +5 -5
- package/hydrate/index.mjs +5 -5
- package/package.json +1 -1
- package/dist/cjs/button-type.enum-406723db.js +0 -8
- package/dist/cjs/digi-button.cjs.entry.js +0 -130
- package/dist/cjs/digi-form-input-search.cjs.entry.js +0 -143
- package/dist/cjs/digi-icon-search.cjs.entry.js +0 -30
- package/dist/cjs/form-input-type.enum-daf781ba.js +0 -32
- package/dist/digi-arbetsformedlingen/p-0ae59327.entry.js +0 -1
- package/dist/digi-arbetsformedlingen/p-1158702e.entry.js +0 -1
- package/dist/digi-arbetsformedlingen/p-133bdba4.entry.js +0 -1
- package/dist/digi-arbetsformedlingen/p-2496eee3.entry.js +0 -1
- package/dist/digi-arbetsformedlingen/p-3887bb40.js +0 -1
- package/dist/digi-arbetsformedlingen/p-403a97f3.entry.js +0 -1
- package/dist/digi-arbetsformedlingen/p-4df790de.entry.js +0 -1
- package/dist/digi-arbetsformedlingen/p-62534ddc.entry.js +0 -1
- package/dist/digi-arbetsformedlingen/p-6f33ef76.entry.js +0 -1
- package/dist/digi-arbetsformedlingen/p-8798c901.entry.js +0 -1
- package/dist/digi-arbetsformedlingen/p-9092f712.entry.js +0 -1
- package/dist/digi-arbetsformedlingen/p-9f124b4f.entry.js +0 -1
- package/dist/digi-arbetsformedlingen/p-a105d9fe.js +0 -1
- package/dist/digi-arbetsformedlingen/p-a1bffbc3.entry.js +0 -1
- package/dist/digi-arbetsformedlingen/p-bd578fbb.entry.js +0 -1
- package/dist/digi-arbetsformedlingen/p-c15ba44e.js +0 -1
- package/dist/digi-arbetsformedlingen/p-c2d45a0d.entry.js +0 -1
- package/dist/digi-arbetsformedlingen/p-cf75cbcd.entry.js +0 -1
- package/dist/digi-arbetsformedlingen/p-d4a341f4.js +0 -1
- package/dist/digi-arbetsformedlingen/p-dc0da84c.entry.js +0 -1
- package/dist/digi-arbetsformedlingen/p-df292ae0.entry.js +0 -1
- package/dist/digi-arbetsformedlingen/p-e292ae3b.entry.js +0 -1
- package/dist/digi-arbetsformedlingen/p-e5ca499a.entry.js +0 -1
- package/dist/digi-arbetsformedlingen/p-ee9589e6.js +0 -1
- package/dist/esm/button-type.enum-5250ae0b.js +0 -8
- package/dist/esm/digi-button.entry.js +0 -126
- package/dist/esm/digi-form-input-search.entry.js +0 -139
- package/dist/esm/digi-icon-search.entry.js +0 -26
- package/dist/esm/form-input-type.enum-62a97d5d.js +0 -32
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { r as registerInstance, c as createEvent, h, g as getElement } from './index-bfea2cc5.js';
|
|
2
|
+
import { r as randomIdGenerator } from './randomIdGenerator.util-56406f2e.js';
|
|
3
|
+
|
|
4
|
+
const UtilMutationObserver = class {
|
|
5
|
+
constructor(hostRef) {
|
|
6
|
+
registerInstance(this, hostRef);
|
|
7
|
+
this.afOnChange = createEvent(this, "afOnChange", 7);
|
|
8
|
+
this._observer = null;
|
|
9
|
+
this._isObserving = false;
|
|
10
|
+
this.afId = randomIdGenerator('digi-util-mutation-observer');
|
|
11
|
+
this.afOptions = {
|
|
12
|
+
attributes: false,
|
|
13
|
+
childList: true,
|
|
14
|
+
subtree: false,
|
|
15
|
+
characterData: false
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
afOptionsWatcher(newValue) {
|
|
19
|
+
this._afOptions =
|
|
20
|
+
typeof newValue === 'string' ? JSON.parse(newValue) : newValue;
|
|
21
|
+
}
|
|
22
|
+
componentWillLoad() {
|
|
23
|
+
this.afOptionsWatcher(this.afOptions);
|
|
24
|
+
this.initObserver();
|
|
25
|
+
}
|
|
26
|
+
disconnectedCallback() {
|
|
27
|
+
if (this._isObserving) {
|
|
28
|
+
this.removeObserver();
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
initObserver() {
|
|
32
|
+
this._observer = new MutationObserver((mutationsList) => {
|
|
33
|
+
for (const mutation of mutationsList) {
|
|
34
|
+
if (mutation.type === 'childList' ||
|
|
35
|
+
mutation.type === 'attributes' ||
|
|
36
|
+
mutation.type === 'characterData') {
|
|
37
|
+
this.changeHandler(mutation);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
this._observer.observe(this.$el, this._afOptions);
|
|
42
|
+
this._isObserving = true;
|
|
43
|
+
}
|
|
44
|
+
removeObserver() {
|
|
45
|
+
this._observer.disconnect();
|
|
46
|
+
this._isObserving = false;
|
|
47
|
+
}
|
|
48
|
+
changeHandler(e) {
|
|
49
|
+
this.afOnChange.emit(e);
|
|
50
|
+
}
|
|
51
|
+
render() {
|
|
52
|
+
h("div", { id: this.afId, ref: (el) => (this.$el = el) }, h("slot", null));
|
|
53
|
+
}
|
|
54
|
+
get $el() { return getElement(this); }
|
|
55
|
+
static get watchers() { return {
|
|
56
|
+
"afOptions": ["afOptionsWatcher"]
|
|
57
|
+
}; }
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export { UtilMutationObserver as digi_util_mutation_observer };
|
|
@@ -21,11 +21,4 @@ var FormFileUploadVariation;
|
|
|
21
21
|
FormFileUploadVariation["LARGE"] = "large";
|
|
22
22
|
})(FormFileUploadVariation || (FormFileUploadVariation = {}));
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
(function (FormValidationMessageVariation) {
|
|
26
|
-
FormValidationMessageVariation["SUCCESS"] = "success";
|
|
27
|
-
FormValidationMessageVariation["ERROR"] = "error";
|
|
28
|
-
FormValidationMessageVariation["WARNING"] = "warning";
|
|
29
|
-
})(FormValidationMessageVariation || (FormValidationMessageVariation = {}));
|
|
30
|
-
|
|
31
|
-
export { FormFileUploadHeadingLevel as F, FormFileUploadValidation as a, FormFileUploadVariation as b, FormValidationMessageVariation as c };
|
|
24
|
+
export { FormFileUploadHeadingLevel as F, FormFileUploadValidation as a, FormFileUploadVariation as b };
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
var ButtonType;
|
|
2
|
+
(function (ButtonType) {
|
|
3
|
+
ButtonType["BUTTON"] = "button";
|
|
4
|
+
ButtonType["SUBMIT"] = "submit";
|
|
5
|
+
ButtonType["RESET"] = "reset";
|
|
6
|
+
})(ButtonType || (ButtonType = {}));
|
|
7
|
+
|
|
8
|
+
var FormInputSearchVariation;
|
|
9
|
+
(function (FormInputSearchVariation) {
|
|
10
|
+
FormInputSearchVariation["SMALL"] = "small";
|
|
11
|
+
FormInputSearchVariation["MEDIUM"] = "medium";
|
|
12
|
+
FormInputSearchVariation["LARGE"] = "large";
|
|
13
|
+
})(FormInputSearchVariation || (FormInputSearchVariation = {}));
|
|
14
|
+
|
|
15
|
+
var FormInputButtonVariation;
|
|
16
|
+
(function (FormInputButtonVariation) {
|
|
17
|
+
FormInputButtonVariation["PRIMARY"] = "primary";
|
|
18
|
+
FormInputButtonVariation["SECONDARY"] = "secondary";
|
|
19
|
+
})(FormInputButtonVariation || (FormInputButtonVariation = {}));
|
|
20
|
+
|
|
21
|
+
var FormInputMode;
|
|
22
|
+
(function (FormInputMode) {
|
|
23
|
+
FormInputMode["DEFAULT"] = "";
|
|
24
|
+
FormInputMode["NONE"] = "none";
|
|
25
|
+
FormInputMode["TEXT"] = "text";
|
|
26
|
+
FormInputMode["DECIMAL"] = "decimal";
|
|
27
|
+
FormInputMode["NUMERIC"] = "numeric";
|
|
28
|
+
FormInputMode["TEL"] = "tel";
|
|
29
|
+
FormInputMode["SEARCH"] = "search";
|
|
30
|
+
FormInputMode["EMAIL"] = "email";
|
|
31
|
+
FormInputMode["URL"] = "url";
|
|
32
|
+
})(FormInputMode || (FormInputMode = {}));
|
|
33
|
+
|
|
34
|
+
var FormInputType;
|
|
35
|
+
(function (FormInputType) {
|
|
36
|
+
FormInputType["COLOR"] = "color";
|
|
37
|
+
FormInputType["DATE"] = "date";
|
|
38
|
+
FormInputType["DATETIME_LOCAL"] = "datetime-local";
|
|
39
|
+
FormInputType["EMAIL"] = "email";
|
|
40
|
+
FormInputType["HIDDEN"] = "hidden";
|
|
41
|
+
FormInputType["MONTH"] = "month";
|
|
42
|
+
FormInputType["NUMBER"] = "number";
|
|
43
|
+
FormInputType["PASSWORD"] = "password";
|
|
44
|
+
FormInputType["SEARCH"] = "search";
|
|
45
|
+
FormInputType["TEL"] = "tel";
|
|
46
|
+
FormInputType["TEXT"] = "text";
|
|
47
|
+
FormInputType["TIME"] = "time";
|
|
48
|
+
FormInputType["URL"] = "url";
|
|
49
|
+
FormInputType["WEEK"] = "week";
|
|
50
|
+
})(FormInputType || (FormInputType = {}));
|
|
51
|
+
|
|
52
|
+
var FormInputValidation;
|
|
53
|
+
(function (FormInputValidation) {
|
|
54
|
+
FormInputValidation["SUCCESS"] = "success";
|
|
55
|
+
FormInputValidation["ERROR"] = "error";
|
|
56
|
+
FormInputValidation["WARNING"] = "warning";
|
|
57
|
+
FormInputValidation["NEUTRAL"] = "neutral";
|
|
58
|
+
})(FormInputValidation || (FormInputValidation = {}));
|
|
59
|
+
|
|
60
|
+
var FormInputVariation;
|
|
61
|
+
(function (FormInputVariation) {
|
|
62
|
+
FormInputVariation["SMALL"] = "small";
|
|
63
|
+
FormInputVariation["MEDIUM"] = "medium";
|
|
64
|
+
FormInputVariation["LARGE"] = "large";
|
|
65
|
+
})(FormInputVariation || (FormInputVariation = {}));
|
|
66
|
+
|
|
67
|
+
export { ButtonType as B, FormInputSearchVariation as F, FormInputButtonVariation as a, FormInputMode as b, FormInputType as c, FormInputValidation as d, FormInputVariation as e };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
var FormSelectValidation;
|
|
2
|
+
(function (FormSelectValidation) {
|
|
3
|
+
FormSelectValidation["SUCCESS"] = "success";
|
|
4
|
+
FormSelectValidation["ERROR"] = "error";
|
|
5
|
+
FormSelectValidation["WARNING"] = "warning";
|
|
6
|
+
FormSelectValidation["NEUTRAL"] = "neutral";
|
|
7
|
+
})(FormSelectValidation || (FormSelectValidation = {}));
|
|
8
|
+
|
|
9
|
+
var FormSelectVariation;
|
|
10
|
+
(function (FormSelectVariation) {
|
|
11
|
+
FormSelectVariation["SMALL"] = "small";
|
|
12
|
+
FormSelectVariation["MEDIUM"] = "medium";
|
|
13
|
+
FormSelectVariation["LARGE"] = "large";
|
|
14
|
+
})(FormSelectVariation || (FormSelectVariation = {}));
|
|
15
|
+
|
|
16
|
+
export { FormSelectValidation as F, FormSelectVariation as a };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
var FormValidationMessageVariation;
|
|
2
|
+
(function (FormValidationMessageVariation) {
|
|
3
|
+
FormValidationMessageVariation["SUCCESS"] = "success";
|
|
4
|
+
FormValidationMessageVariation["ERROR"] = "error";
|
|
5
|
+
FormValidationMessageVariation["WARNING"] = "warning";
|
|
6
|
+
})(FormValidationMessageVariation || (FormValidationMessageVariation = {}));
|
|
7
|
+
|
|
8
|
+
export { FormValidationMessageVariation as F };
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { r as requiredArgs, t as toDate } from './index-8685f88d.js';
|
|
2
|
+
|
|
1
3
|
function toInteger(dirtyNumber) {
|
|
2
4
|
if (dirtyNumber === null || dirtyNumber === true || dirtyNumber === false) {
|
|
3
5
|
return NaN;
|
|
@@ -12,64 +14,6 @@ function toInteger(dirtyNumber) {
|
|
|
12
14
|
return number < 0 ? Math.ceil(number) : Math.floor(number);
|
|
13
15
|
}
|
|
14
16
|
|
|
15
|
-
function requiredArgs(required, args) {
|
|
16
|
-
if (args.length < required) {
|
|
17
|
-
throw new TypeError(required + ' argument' + (required > 1 ? 's' : '') + ' required, but only ' + args.length + ' present');
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* @name toDate
|
|
23
|
-
* @category Common Helpers
|
|
24
|
-
* @summary Convert the given argument to an instance of Date.
|
|
25
|
-
*
|
|
26
|
-
* @description
|
|
27
|
-
* Convert the given argument to an instance of Date.
|
|
28
|
-
*
|
|
29
|
-
* If the argument is an instance of Date, the function returns its clone.
|
|
30
|
-
*
|
|
31
|
-
* If the argument is a number, it is treated as a timestamp.
|
|
32
|
-
*
|
|
33
|
-
* If the argument is none of the above, the function returns Invalid Date.
|
|
34
|
-
*
|
|
35
|
-
* **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.
|
|
36
|
-
*
|
|
37
|
-
* @param {Date|Number} argument - the value to convert
|
|
38
|
-
* @returns {Date} the parsed date in the local time zone
|
|
39
|
-
* @throws {TypeError} 1 argument required
|
|
40
|
-
*
|
|
41
|
-
* @example
|
|
42
|
-
* // Clone the date:
|
|
43
|
-
* const result = toDate(new Date(2014, 1, 11, 11, 30, 30))
|
|
44
|
-
* //=> Tue Feb 11 2014 11:30:30
|
|
45
|
-
*
|
|
46
|
-
* @example
|
|
47
|
-
* // Convert the timestamp to date:
|
|
48
|
-
* const result = toDate(1392098430000)
|
|
49
|
-
* //=> Tue Feb 11 2014 11:30:30
|
|
50
|
-
*/
|
|
51
|
-
|
|
52
|
-
function toDate(argument) {
|
|
53
|
-
requiredArgs(1, arguments);
|
|
54
|
-
var argStr = Object.prototype.toString.call(argument); // Clone the date
|
|
55
|
-
|
|
56
|
-
if (argument instanceof Date || typeof argument === 'object' && argStr === '[object Date]') {
|
|
57
|
-
// Prevent the date to lose the milliseconds when passed to new Date() in IE10
|
|
58
|
-
return new Date(argument.getTime());
|
|
59
|
-
} else if (typeof argument === 'number' || argStr === '[object Number]') {
|
|
60
|
-
return new Date(argument);
|
|
61
|
-
} else {
|
|
62
|
-
if ((typeof argument === 'string' || argStr === '[object String]') && typeof console !== 'undefined') {
|
|
63
|
-
// eslint-disable-next-line no-console
|
|
64
|
-
console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://git.io/fjule"); // eslint-disable-next-line no-console
|
|
65
|
-
|
|
66
|
-
console.warn(new Error().stack);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
return new Date(NaN);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
17
|
/**
|
|
74
18
|
* @name addMilliseconds
|
|
75
19
|
* @category Millisecond Helpers
|
|
@@ -117,117 +61,6 @@ function getTimezoneOffsetInMilliseconds(date) {
|
|
|
117
61
|
return date.getTime() - utcDate.getTime();
|
|
118
62
|
}
|
|
119
63
|
|
|
120
|
-
/**
|
|
121
|
-
* @name isDate
|
|
122
|
-
* @category Common Helpers
|
|
123
|
-
* @summary Is the given value a date?
|
|
124
|
-
*
|
|
125
|
-
* @description
|
|
126
|
-
* Returns true if the given value is an instance of Date. The function works for dates transferred across iframes.
|
|
127
|
-
*
|
|
128
|
-
* ### v2.0.0 breaking changes:
|
|
129
|
-
*
|
|
130
|
-
* - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
|
|
131
|
-
*
|
|
132
|
-
* @param {*} value - the value to check
|
|
133
|
-
* @returns {boolean} true if the given value is a date
|
|
134
|
-
* @throws {TypeError} 1 arguments required
|
|
135
|
-
*
|
|
136
|
-
* @example
|
|
137
|
-
* // For a valid date:
|
|
138
|
-
* const result = isDate(new Date())
|
|
139
|
-
* //=> true
|
|
140
|
-
*
|
|
141
|
-
* @example
|
|
142
|
-
* // For an invalid date:
|
|
143
|
-
* const result = isDate(new Date(NaN))
|
|
144
|
-
* //=> true
|
|
145
|
-
*
|
|
146
|
-
* @example
|
|
147
|
-
* // For some value:
|
|
148
|
-
* const result = isDate('2014-02-31')
|
|
149
|
-
* //=> false
|
|
150
|
-
*
|
|
151
|
-
* @example
|
|
152
|
-
* // For an object:
|
|
153
|
-
* const result = isDate({})
|
|
154
|
-
* //=> false
|
|
155
|
-
*/
|
|
156
|
-
|
|
157
|
-
function isDate(value) {
|
|
158
|
-
requiredArgs(1, arguments);
|
|
159
|
-
return value instanceof Date || typeof value === 'object' && Object.prototype.toString.call(value) === '[object Date]';
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
/**
|
|
163
|
-
* @name isValid
|
|
164
|
-
* @category Common Helpers
|
|
165
|
-
* @summary Is the given date valid?
|
|
166
|
-
*
|
|
167
|
-
* @description
|
|
168
|
-
* Returns false if argument is Invalid Date and true otherwise.
|
|
169
|
-
* Argument is converted to Date using `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate}
|
|
170
|
-
* Invalid Date is a Date, whose time value is NaN.
|
|
171
|
-
*
|
|
172
|
-
* Time value of Date: http://es5.github.io/#x15.9.1.1
|
|
173
|
-
*
|
|
174
|
-
* ### v2.0.0 breaking changes:
|
|
175
|
-
*
|
|
176
|
-
* - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
|
|
177
|
-
*
|
|
178
|
-
* - Now `isValid` doesn't throw an exception
|
|
179
|
-
* if the first argument is not an instance of Date.
|
|
180
|
-
* Instead, argument is converted beforehand using `toDate`.
|
|
181
|
-
*
|
|
182
|
-
* Examples:
|
|
183
|
-
*
|
|
184
|
-
* | `isValid` argument | Before v2.0.0 | v2.0.0 onward |
|
|
185
|
-
* |---------------------------|---------------|---------------|
|
|
186
|
-
* | `new Date()` | `true` | `true` |
|
|
187
|
-
* | `new Date('2016-01-01')` | `true` | `true` |
|
|
188
|
-
* | `new Date('')` | `false` | `false` |
|
|
189
|
-
* | `new Date(1488370835081)` | `true` | `true` |
|
|
190
|
-
* | `new Date(NaN)` | `false` | `false` |
|
|
191
|
-
* | `'2016-01-01'` | `TypeError` | `false` |
|
|
192
|
-
* | `''` | `TypeError` | `false` |
|
|
193
|
-
* | `1488370835081` | `TypeError` | `true` |
|
|
194
|
-
* | `NaN` | `TypeError` | `false` |
|
|
195
|
-
*
|
|
196
|
-
* We introduce this change to make *date-fns* consistent with ECMAScript behavior
|
|
197
|
-
* that try to coerce arguments to the expected type
|
|
198
|
-
* (which is also the case with other *date-fns* functions).
|
|
199
|
-
*
|
|
200
|
-
* @param {*} date - the date to check
|
|
201
|
-
* @returns {Boolean} the date is valid
|
|
202
|
-
* @throws {TypeError} 1 argument required
|
|
203
|
-
*
|
|
204
|
-
* @example
|
|
205
|
-
* // For the valid date:
|
|
206
|
-
* const result = isValid(new Date(2014, 1, 31))
|
|
207
|
-
* //=> true
|
|
208
|
-
*
|
|
209
|
-
* @example
|
|
210
|
-
* // For the value, convertable into a date:
|
|
211
|
-
* const result = isValid(1393804800000)
|
|
212
|
-
* //=> true
|
|
213
|
-
*
|
|
214
|
-
* @example
|
|
215
|
-
* // For the invalid date:
|
|
216
|
-
* const result = isValid(new Date(''))
|
|
217
|
-
* //=> false
|
|
218
|
-
*/
|
|
219
|
-
|
|
220
|
-
function isValid(dirtyDate) {
|
|
221
|
-
requiredArgs(1, arguments);
|
|
222
|
-
|
|
223
|
-
if (!isDate(dirtyDate) && typeof dirtyDate !== 'number') {
|
|
224
|
-
return false;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
var date = toDate(dirtyDate);
|
|
228
|
-
return !isNaN(Number(date));
|
|
229
|
-
}
|
|
230
|
-
|
|
231
64
|
var formatDistanceLocale = {
|
|
232
65
|
lessThanXSeconds: {
|
|
233
66
|
one: 'less than a second',
|
|
@@ -1029,4 +862,4 @@ function throwProtectedError(token, format, input) {
|
|
|
1029
862
|
}
|
|
1030
863
|
}
|
|
1031
864
|
|
|
1032
|
-
export {
|
|
865
|
+
export { getUTCWeek as a, getUTCWeekYear as b, startOfUTCISOWeek as c, throwProtectedError as d, isProtectedDayOfYearToken as e, subMilliseconds as f, getUTCISOWeek as g, getTimezoneOffsetInMilliseconds as h, isProtectedWeekYearToken as i, defaultLocale as j, getUTCISOWeekYear as k, longFormatters$1 as l, buildFormatLongFn as m, buildLocalizeFn as n, buildMatchPatternFn as o, buildMatchFn as p, startOfUTCWeek as s, toInteger as t };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { r as requiredArgs, t as toDate } from './index-8685f88d.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @name isAfter
|
|
5
|
+
* @category Common Helpers
|
|
6
|
+
* @summary Is the first date after the second one?
|
|
7
|
+
*
|
|
8
|
+
* @description
|
|
9
|
+
* Is the first date after the second one?
|
|
10
|
+
*
|
|
11
|
+
* ### v2.0.0 breaking changes:
|
|
12
|
+
*
|
|
13
|
+
* - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
|
|
14
|
+
*
|
|
15
|
+
* @param {Date|Number} date - the date that should be after the other one to return true
|
|
16
|
+
* @param {Date|Number} dateToCompare - the date to compare with
|
|
17
|
+
* @returns {Boolean} the first date is after the second date
|
|
18
|
+
* @throws {TypeError} 2 arguments required
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* // Is 10 July 1989 after 11 February 1987?
|
|
22
|
+
* var result = isAfter(new Date(1989, 6, 10), new Date(1987, 1, 11))
|
|
23
|
+
* //=> true
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
function isAfter(dirtyDate, dirtyDateToCompare) {
|
|
27
|
+
requiredArgs(2, arguments);
|
|
28
|
+
var date = toDate(dirtyDate);
|
|
29
|
+
var dateToCompare = toDate(dirtyDateToCompare);
|
|
30
|
+
return date.getTime() > dateToCompare.getTime();
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* @name isBefore
|
|
35
|
+
* @category Common Helpers
|
|
36
|
+
* @summary Is the first date before the second one?
|
|
37
|
+
*
|
|
38
|
+
* @description
|
|
39
|
+
* Is the first date before the second one?
|
|
40
|
+
*
|
|
41
|
+
* ### v2.0.0 breaking changes:
|
|
42
|
+
*
|
|
43
|
+
* - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
|
|
44
|
+
*
|
|
45
|
+
* @param {Date|Number} date - the date that should be before the other one to return true
|
|
46
|
+
* @param {Date|Number} dateToCompare - the date to compare with
|
|
47
|
+
* @returns {Boolean} the first date is before the second date
|
|
48
|
+
* @throws {TypeError} 2 arguments required
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* // Is 10 July 1989 before 11 February 1987?
|
|
52
|
+
* var result = isBefore(new Date(1989, 6, 10), new Date(1987, 1, 11))
|
|
53
|
+
* //=> false
|
|
54
|
+
*/
|
|
55
|
+
|
|
56
|
+
function isBefore(dirtyDate, dirtyDateToCompare) {
|
|
57
|
+
requiredArgs(2, arguments);
|
|
58
|
+
var date = toDate(dirtyDate);
|
|
59
|
+
var dateToCompare = toDate(dirtyDateToCompare);
|
|
60
|
+
return date.getTime() < dateToCompare.getTime();
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export { isAfter as a, isBefore as i };
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
function requiredArgs(required, args) {
|
|
2
|
+
if (args.length < required) {
|
|
3
|
+
throw new TypeError(required + ' argument' + (required > 1 ? 's' : '') + ' required, but only ' + args.length + ' present');
|
|
4
|
+
}
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @name toDate
|
|
9
|
+
* @category Common Helpers
|
|
10
|
+
* @summary Convert the given argument to an instance of Date.
|
|
11
|
+
*
|
|
12
|
+
* @description
|
|
13
|
+
* Convert the given argument to an instance of Date.
|
|
14
|
+
*
|
|
15
|
+
* If the argument is an instance of Date, the function returns its clone.
|
|
16
|
+
*
|
|
17
|
+
* If the argument is a number, it is treated as a timestamp.
|
|
18
|
+
*
|
|
19
|
+
* If the argument is none of the above, the function returns Invalid Date.
|
|
20
|
+
*
|
|
21
|
+
* **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.
|
|
22
|
+
*
|
|
23
|
+
* @param {Date|Number} argument - the value to convert
|
|
24
|
+
* @returns {Date} the parsed date in the local time zone
|
|
25
|
+
* @throws {TypeError} 1 argument required
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* // Clone the date:
|
|
29
|
+
* const result = toDate(new Date(2014, 1, 11, 11, 30, 30))
|
|
30
|
+
* //=> Tue Feb 11 2014 11:30:30
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* // Convert the timestamp to date:
|
|
34
|
+
* const result = toDate(1392098430000)
|
|
35
|
+
* //=> Tue Feb 11 2014 11:30:30
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
function toDate(argument) {
|
|
39
|
+
requiredArgs(1, arguments);
|
|
40
|
+
var argStr = Object.prototype.toString.call(argument); // Clone the date
|
|
41
|
+
|
|
42
|
+
if (argument instanceof Date || typeof argument === 'object' && argStr === '[object Date]') {
|
|
43
|
+
// Prevent the date to lose the milliseconds when passed to new Date() in IE10
|
|
44
|
+
return new Date(argument.getTime());
|
|
45
|
+
} else if (typeof argument === 'number' || argStr === '[object Number]') {
|
|
46
|
+
return new Date(argument);
|
|
47
|
+
} else {
|
|
48
|
+
if ((typeof argument === 'string' || argStr === '[object String]') && typeof console !== 'undefined') {
|
|
49
|
+
// eslint-disable-next-line no-console
|
|
50
|
+
console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://git.io/fjule"); // eslint-disable-next-line no-console
|
|
51
|
+
|
|
52
|
+
console.warn(new Error().stack);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return new Date(NaN);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* @name isDate
|
|
61
|
+
* @category Common Helpers
|
|
62
|
+
* @summary Is the given value a date?
|
|
63
|
+
*
|
|
64
|
+
* @description
|
|
65
|
+
* Returns true if the given value is an instance of Date. The function works for dates transferred across iframes.
|
|
66
|
+
*
|
|
67
|
+
* ### v2.0.0 breaking changes:
|
|
68
|
+
*
|
|
69
|
+
* - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
|
|
70
|
+
*
|
|
71
|
+
* @param {*} value - the value to check
|
|
72
|
+
* @returns {boolean} true if the given value is a date
|
|
73
|
+
* @throws {TypeError} 1 arguments required
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* // For a valid date:
|
|
77
|
+
* const result = isDate(new Date())
|
|
78
|
+
* //=> true
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* // For an invalid date:
|
|
82
|
+
* const result = isDate(new Date(NaN))
|
|
83
|
+
* //=> true
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* // For some value:
|
|
87
|
+
* const result = isDate('2014-02-31')
|
|
88
|
+
* //=> false
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* // For an object:
|
|
92
|
+
* const result = isDate({})
|
|
93
|
+
* //=> false
|
|
94
|
+
*/
|
|
95
|
+
|
|
96
|
+
function isDate(value) {
|
|
97
|
+
requiredArgs(1, arguments);
|
|
98
|
+
return value instanceof Date || typeof value === 'object' && Object.prototype.toString.call(value) === '[object Date]';
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* @name isValid
|
|
103
|
+
* @category Common Helpers
|
|
104
|
+
* @summary Is the given date valid?
|
|
105
|
+
*
|
|
106
|
+
* @description
|
|
107
|
+
* Returns false if argument is Invalid Date and true otherwise.
|
|
108
|
+
* Argument is converted to Date using `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate}
|
|
109
|
+
* Invalid Date is a Date, whose time value is NaN.
|
|
110
|
+
*
|
|
111
|
+
* Time value of Date: http://es5.github.io/#x15.9.1.1
|
|
112
|
+
*
|
|
113
|
+
* ### v2.0.0 breaking changes:
|
|
114
|
+
*
|
|
115
|
+
* - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
|
|
116
|
+
*
|
|
117
|
+
* - Now `isValid` doesn't throw an exception
|
|
118
|
+
* if the first argument is not an instance of Date.
|
|
119
|
+
* Instead, argument is converted beforehand using `toDate`.
|
|
120
|
+
*
|
|
121
|
+
* Examples:
|
|
122
|
+
*
|
|
123
|
+
* | `isValid` argument | Before v2.0.0 | v2.0.0 onward |
|
|
124
|
+
* |---------------------------|---------------|---------------|
|
|
125
|
+
* | `new Date()` | `true` | `true` |
|
|
126
|
+
* | `new Date('2016-01-01')` | `true` | `true` |
|
|
127
|
+
* | `new Date('')` | `false` | `false` |
|
|
128
|
+
* | `new Date(1488370835081)` | `true` | `true` |
|
|
129
|
+
* | `new Date(NaN)` | `false` | `false` |
|
|
130
|
+
* | `'2016-01-01'` | `TypeError` | `false` |
|
|
131
|
+
* | `''` | `TypeError` | `false` |
|
|
132
|
+
* | `1488370835081` | `TypeError` | `true` |
|
|
133
|
+
* | `NaN` | `TypeError` | `false` |
|
|
134
|
+
*
|
|
135
|
+
* We introduce this change to make *date-fns* consistent with ECMAScript behavior
|
|
136
|
+
* that try to coerce arguments to the expected type
|
|
137
|
+
* (which is also the case with other *date-fns* functions).
|
|
138
|
+
*
|
|
139
|
+
* @param {*} date - the date to check
|
|
140
|
+
* @returns {Boolean} the date is valid
|
|
141
|
+
* @throws {TypeError} 1 argument required
|
|
142
|
+
*
|
|
143
|
+
* @example
|
|
144
|
+
* // For the valid date:
|
|
145
|
+
* const result = isValid(new Date(2014, 1, 31))
|
|
146
|
+
* //=> true
|
|
147
|
+
*
|
|
148
|
+
* @example
|
|
149
|
+
* // For the value, convertable into a date:
|
|
150
|
+
* const result = isValid(1393804800000)
|
|
151
|
+
* //=> true
|
|
152
|
+
*
|
|
153
|
+
* @example
|
|
154
|
+
* // For the invalid date:
|
|
155
|
+
* const result = isValid(new Date(''))
|
|
156
|
+
* //=> false
|
|
157
|
+
*/
|
|
158
|
+
|
|
159
|
+
function isValid(dirtyDate) {
|
|
160
|
+
requiredArgs(1, arguments);
|
|
161
|
+
|
|
162
|
+
if (!isDate(dirtyDate) && typeof dirtyDate !== 'number') {
|
|
163
|
+
return false;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
var date = toDate(dirtyDate);
|
|
167
|
+
return !isNaN(Number(date));
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
export { isValid as i, requiredArgs as r, toDate as t };
|