@arc-ui/community-components 0.1.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/.turbo/turbo-build.log +16 -0
- package/CHANGELOG.md +7 -0
- package/LICENSE +21 -0
- package/dist/Accordion/Accordion.cjs.js +31 -0
- package/dist/Accordion/Accordion.esm.js +29 -0
- package/dist/Author/Author.cjs.js +14 -0
- package/dist/Author/Author.esm.js +8 -0
- package/dist/Author/styles.css +1 -0
- package/dist/BannerWithTabs/BannerWithTabs.cjs.js +36 -0
- package/dist/BannerWithTabs/BannerWithTabs.esm.js +34 -0
- package/dist/BannerWithTabs/styles.css +1 -0
- package/dist/CopyLead/CopyLead.cjs.js +129 -0
- package/dist/CopyLead/CopyLead.esm.js +127 -0
- package/dist/CopyLead/styles.css +1 -0
- package/dist/DownloadList/DownloadList.cjs.js +26 -0
- package/dist/DownloadList/DownloadList.esm.js +24 -0
- package/dist/DownloadList/styles.css +1 -0
- package/dist/FeaturePost/FeaturePost.cjs.js +2281 -0
- package/dist/FeaturePost/FeaturePost.esm.js +2279 -0
- package/dist/FeaturePost/styles.css +1 -0
- package/dist/Highlights/Highlights.cjs.js +50 -0
- package/dist/Highlights/Highlights.esm.js +48 -0
- package/dist/Highlights/styles.css +1 -0
- package/dist/PromoListing/PromoListing.cjs.js +50 -0
- package/dist/PromoListing/PromoListing.esm.js +48 -0
- package/dist/PromoListing/styles.css +1 -0
- package/dist/Quote/Quote.cjs.js +27 -0
- package/dist/Quote/Quote.esm.js +25 -0
- package/dist/Quote/styles.css +1 -0
- package/dist/SectionHeading/SectionHeading.cjs.js +14 -0
- package/dist/SectionHeading/SectionHeading.esm.js +8 -0
- package/dist/SectionHeading/styles.css +1 -0
- package/dist/Statistics/Statistics.cjs.js +60 -0
- package/dist/Statistics/Statistics.esm.js +58 -0
- package/dist/Statistics/styles.css +1 -0
- package/dist/Summary/Summary.cjs.js +30 -0
- package/dist/Summary/Summary.esm.js +28 -0
- package/dist/Summary/styles.css +1 -0
- package/dist/_shared/cjs/Author-CAo-qryZ.js +30 -0
- package/dist/_shared/cjs/SectionHeading-L2EpTQ79.js +25 -0
- package/dist/_shared/cjs/filter-data-attrs-ajtUvDAC.js +15 -0
- package/dist/_shared/cjs/index-Bp6Dd2i1.js +94 -0
- package/dist/_shared/cjs/index.es-X428Cm3N.js +15 -0
- package/dist/_shared/cjs/tslib.es6-DBA0GFPJ.js +48 -0
- package/dist/_shared/esm/Author-Bx-cE9Pz.js +28 -0
- package/dist/_shared/esm/SectionHeading-C70XNhqJ.js +23 -0
- package/dist/_shared/esm/filter-data-attrs-V7cbJuwS.js +13 -0
- package/dist/_shared/esm/index-BfTCfPZ1.js +92 -0
- package/dist/_shared/esm/index.es-BzmvPxje.js +10 -0
- package/dist/_shared/esm/tslib.es6-Cv15O4Nx.js +46 -0
- package/dist/index.es.js +2796 -0
- package/dist/index.es.js.map +1 -0
- package/dist/index.js +2808 -0
- package/dist/index.js.map +1 -0
- package/dist/styles.css +1 -0
- package/dist/types/components/Accordion/Accordion.d.ts +9 -0
- package/dist/types/components/Accordion/components/AccordionDisclosureList/AccordionDisclosureList.d.ts +9 -0
- package/dist/types/components/Accordion/index.d.ts +1 -0
- package/dist/types/components/Author/Author.d.ts +17 -0
- package/dist/types/components/Author/index.d.ts +1 -0
- package/dist/types/components/BannerWithTabs/BannerWithTabs.d.ts +17 -0
- package/dist/types/components/BannerWithTabs/index.d.ts +1 -0
- package/dist/types/components/CopyLead/CopyLead.d.ts +42 -0
- package/dist/types/components/CopyLead/components/Button/Button.d.ts +3 -0
- package/dist/types/components/CopyLead/components/Button/index.d.ts +1 -0
- package/dist/types/components/CopyLead/components/Column/Column.d.ts +6 -0
- package/dist/types/components/CopyLead/components/Column/index.d.ts +1 -0
- package/dist/types/components/CopyLead/components/Container/Container.d.ts +9 -0
- package/dist/types/components/CopyLead/components/Container/index.d.ts +1 -0
- package/dist/types/components/CopyLead/components/IconList/IconList.d.ts +8 -0
- package/dist/types/components/CopyLead/components/IconList/index.d.ts +1 -0
- package/dist/types/components/CopyLead/components/Image/Image.d.ts +3 -0
- package/dist/types/components/CopyLead/components/Image/index.d.ts +1 -0
- package/dist/types/components/CopyLead/components/MediaContent/MediaContent.d.ts +9 -0
- package/dist/types/components/CopyLead/components/MediaContent/index.d.ts +1 -0
- package/dist/types/components/CopyLead/index.d.ts +1 -0
- package/dist/types/components/CopyLead/templates/Content/Content.d.ts +10 -0
- package/dist/types/components/CopyLead/templates/Content/index.d.ts +1 -0
- package/dist/types/components/CopyLead/templates/Media/Media.d.ts +16 -0
- package/dist/types/components/CopyLead/templates/Media/index.d.ts +1 -0
- package/dist/types/components/CopyLead/types/copy-lead-button.d.ts +2 -0
- package/dist/types/components/CopyLead/types/copy-lead-image.d.ts +4 -0
- package/dist/types/components/CopyLead/types/copy-lead-list-item.d.ts +6 -0
- package/dist/types/components/CopyLead/types/copy-lead-transcript-link.d.ts +6 -0
- package/dist/types/components/CopyLead/types/index.d.ts +4 -0
- package/dist/types/components/DownloadList/DownloadList.d.ts +10 -0
- package/dist/types/components/DownloadList/index.d.ts +1 -0
- package/dist/types/components/FeaturePost/FeaturePost.d.ts +45 -0
- package/dist/types/components/FeaturePost/components/Image/Image.d.ts +3 -0
- package/dist/types/components/FeaturePost/components/Image/index.d.ts +1 -0
- package/dist/types/components/FeaturePost/components/MediaContent/MediaContent.d.ts +15 -0
- package/dist/types/components/FeaturePost/index.d.ts +1 -0
- package/dist/types/components/FeaturePost/types/feature-post-app-button-footer.d.ts +6 -0
- package/dist/types/components/FeaturePost/types/feature-post-cta-footer.d.ts +7 -0
- package/dist/types/components/FeaturePost/types/feature-post-image.d.ts +4 -0
- package/dist/types/components/FeaturePost/types/index.d.ts +3 -0
- package/dist/types/components/Highlights/Highlights.d.ts +17 -0
- package/dist/types/components/Highlights/components/HighlightItem/HighlightItem.d.ts +14 -0
- package/dist/types/components/Highlights/components/HighlightList/HighlightList.d.ts +9 -0
- package/dist/types/components/Highlights/index.d.ts +1 -0
- package/dist/types/components/Highlights/types/highlight-list-item.d.ts +10 -0
- package/dist/types/components/Highlights/types/index.d.ts +1 -0
- package/dist/types/components/PromoListing/PromoListing.d.ts +38 -0
- package/dist/types/components/PromoListing/index.d.ts +1 -0
- package/dist/types/components/Quote/Quote.d.ts +11 -0
- package/dist/types/components/Quote/index.d.ts +1 -0
- package/dist/types/components/SectionHeading/SectionHeading.d.ts +25 -0
- package/dist/types/components/SectionHeading/index.d.ts +1 -0
- package/dist/types/components/Statistics/Statistics.d.ts +7 -0
- package/dist/types/components/Statistics/helpers/get-link-props.d.ts +2 -0
- package/dist/types/components/Statistics/index.d.ts +1 -0
- package/dist/types/components/Statistics/types/statistic-link.d.ts +6 -0
- package/dist/types/components/Statistics/types/statistic.d.ts +8 -0
- package/dist/types/components/Summary/Summary.d.ts +18 -0
- package/dist/types/components/Summary/index.d.ts +1 -0
- package/dist/types/components/index.d.ts +11 -0
- package/dist/types/index.d.ts +1 -0
- package/eslint.config.js +4 -0
- package/package.json +105 -0
- package/postcss.config.cjs +5 -0
- package/rollup.config.js +101 -0
- package/src/components/Accordion/Accordion.tsx +38 -0
- package/src/components/Accordion/components/AccordionDisclosureList/AccordionDisclosureList.tsx +44 -0
- package/src/components/Accordion/index.ts +1 -0
- package/src/components/Author/Author.module.css +9 -0
- package/src/components/Author/Author.tsx +60 -0
- package/src/components/Author/index.ts +1 -0
- package/src/components/BannerWithTabs/BannerWithTabs.module.css +19 -0
- package/src/components/BannerWithTabs/BannerWithTabs.tsx +74 -0
- package/src/components/BannerWithTabs/index.ts +1 -0
- package/src/components/CopyLead/CopyLead.module.css +127 -0
- package/src/components/CopyLead/CopyLead.tsx +102 -0
- package/src/components/CopyLead/components/Button/Button.tsx +13 -0
- package/src/components/CopyLead/components/Button/index.ts +1 -0
- package/src/components/CopyLead/components/Column/Column.tsx +10 -0
- package/src/components/CopyLead/components/Column/index.ts +1 -0
- package/src/components/CopyLead/components/Container/Container.tsx +32 -0
- package/src/components/CopyLead/components/Container/index.ts +1 -0
- package/src/components/CopyLead/components/IconList/IconList.tsx +49 -0
- package/src/components/CopyLead/components/IconList/index.ts +1 -0
- package/src/components/CopyLead/components/Image/Image.tsx +17 -0
- package/src/components/CopyLead/components/Image/index.ts +1 -0
- package/src/components/CopyLead/components/MediaContent/MediaContent.tsx +36 -0
- package/src/components/CopyLead/components/MediaContent/index.ts +1 -0
- package/src/components/CopyLead/index.ts +1 -0
- package/src/components/CopyLead/templates/Content/Content.tsx +58 -0
- package/src/components/CopyLead/templates/Content/index.ts +1 -0
- package/src/components/CopyLead/templates/Media/Media.tsx +104 -0
- package/src/components/CopyLead/templates/Media/index.ts +1 -0
- package/src/components/CopyLead/types/copy-lead-button.ts +6 -0
- package/src/components/CopyLead/types/copy-lead-image.ts +19 -0
- package/src/components/CopyLead/types/copy-lead-list-item.ts +7 -0
- package/src/components/CopyLead/types/copy-lead-transcript-link.ts +6 -0
- package/src/components/CopyLead/types/index.ts +4 -0
- package/src/components/DownloadList/DownloadList.module.css +7 -0
- package/src/components/DownloadList/DownloadList.tsx +41 -0
- package/src/components/DownloadList/index.ts +1 -0
- package/src/components/FeaturePost/FeaturePost.module.css +58 -0
- package/src/components/FeaturePost/FeaturePost.tsx +203 -0
- package/src/components/FeaturePost/components/Image/Image.tsx +18 -0
- package/src/components/FeaturePost/components/Image/index.ts +1 -0
- package/src/components/FeaturePost/components/MediaContent/MediaContent.tsx +45 -0
- package/src/components/FeaturePost/components/MediaContent/index.ts +0 -0
- package/src/components/FeaturePost/index.ts +1 -0
- package/src/components/FeaturePost/types/feature-post-app-button-footer.ts +7 -0
- package/src/components/FeaturePost/types/feature-post-cta-footer.ts +11 -0
- package/src/components/FeaturePost/types/feature-post-image.ts +19 -0
- package/src/components/FeaturePost/types/index.ts +3 -0
- package/src/components/Highlights/Highlights.module.css +85 -0
- package/src/components/Highlights/Highlights.tsx +53 -0
- package/src/components/Highlights/components/HighlightItem/HighlightItem.tsx +68 -0
- package/src/components/Highlights/components/HighlightList/HighlightList.tsx +42 -0
- package/src/components/Highlights/index.ts +1 -0
- package/src/components/Highlights/types/highlight-list-item.ts +11 -0
- package/src/components/Highlights/types/index.ts +1 -0
- package/src/components/PromoListing/PromoListing.module.css +97 -0
- package/src/components/PromoListing/PromoListing.tsx +153 -0
- package/src/components/PromoListing/index.ts +1 -0
- package/src/components/Quote/Quote.module.css +60 -0
- package/src/components/Quote/Quote.tsx +57 -0
- package/src/components/Quote/index.ts +1 -0
- package/src/components/SectionHeading/SectionHeading.module.css +34 -0
- package/src/components/SectionHeading/SectionHeading.tsx +65 -0
- package/src/components/SectionHeading/index.ts +1 -0
- package/src/components/Statistics/Statistics.module.css +25 -0
- package/src/components/Statistics/Statistics.tsx +97 -0
- package/src/components/Statistics/helpers/get-link-props.ts +11 -0
- package/src/components/Statistics/index.ts +1 -0
- package/src/components/Statistics/types/statistic-link.ts +6 -0
- package/src/components/Statistics/types/statistic.ts +9 -0
- package/src/components/Summary/Summary.module.css +31 -0
- package/src/components/Summary/Summary.tsx +65 -0
- package/src/components/Summary/index.ts +1 -0
- package/src/components/index.ts +11 -0
- package/src/index.ts +5 -0
- package/src/types/file-types.d.ts +9 -0
- package/stylelint.config.js +4 -0
- package/tsconfig.json +11 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,2808 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var Heading = require('@arc-ui/components/dist/Heading');
|
|
5
|
+
var Text = require('@arc-ui/components/dist/Text');
|
|
6
|
+
var VerticalSpace = require('@arc-ui/components/dist/VerticalSpace');
|
|
7
|
+
var Disclosure = require('@arc-ui/components/dist/Disclosure');
|
|
8
|
+
var Grid = require('@arc-ui/components/dist/Grid');
|
|
9
|
+
var Avatar = require('@arc-ui/components/dist/Avatar');
|
|
10
|
+
var Columns = require('@arc-ui/components/dist/Columns');
|
|
11
|
+
var useMediaQuery = require('@arc-ui/components/dist/use-media-query');
|
|
12
|
+
var Image$2 = require('@arc-ui/components/dist/Image');
|
|
13
|
+
var Icon = require('@arc-ui/components/dist/Icon');
|
|
14
|
+
var ButtonV2 = require('@arc-ui/components/dist/ButtonV2');
|
|
15
|
+
var Download = require('@arc-ui/components/dist/Download');
|
|
16
|
+
var AppButton = require('@arc-ui/components/dist/AppButton');
|
|
17
|
+
var Link = require('@arc-ui/components/dist/Link');
|
|
18
|
+
var Carousel = require('@arc-ui/components/dist/Carousel');
|
|
19
|
+
var MediaCard = require('@arc-ui/components/dist/MediaCard');
|
|
20
|
+
var ImpactCard = require('@arc-ui/components/dist/ImpactCard');
|
|
21
|
+
var InformationCard = require('@arc-ui/components/dist/InformationCard');
|
|
22
|
+
var TypographyCard = require('@arc-ui/components/dist/TypographyCard');
|
|
23
|
+
var Box = require('@arc-ui/components/dist/Box');
|
|
24
|
+
var Rule = require('@arc-ui/components/dist/Rule');
|
|
25
|
+
var Align = require('@arc-ui/components/dist/Align');
|
|
26
|
+
var HeroBanner = require('@arc-ui/components/dist/HeroBanner');
|
|
27
|
+
var ContentSwitcher = require('@arc-ui/components/dist/ContentSwitcher');
|
|
28
|
+
var ContentSwitcherDropdown = require('@arc-ui/components/dist/ContentSwitcherDropdown');
|
|
29
|
+
|
|
30
|
+
/******************************************************************************
|
|
31
|
+
Copyright (c) Microsoft Corporation.
|
|
32
|
+
|
|
33
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
34
|
+
purpose with or without fee is hereby granted.
|
|
35
|
+
|
|
36
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
37
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
38
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
39
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
40
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
41
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
42
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
43
|
+
***************************************************************************** */
|
|
44
|
+
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
var __assign = function() {
|
|
48
|
+
__assign = Object.assign || function __assign(t) {
|
|
49
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
50
|
+
s = arguments[i];
|
|
51
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
52
|
+
}
|
|
53
|
+
return t;
|
|
54
|
+
};
|
|
55
|
+
return __assign.apply(this, arguments);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
function __rest(s, e) {
|
|
59
|
+
var t = {};
|
|
60
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
61
|
+
t[p] = s[p];
|
|
62
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
63
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
64
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
65
|
+
t[p[i]] = s[p[i]];
|
|
66
|
+
}
|
|
67
|
+
return t;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
71
|
+
var e = new Error(message);
|
|
72
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
var dataAttrRe = /^(data-.*)$/;
|
|
76
|
+
var filterDataAttrs = function (props) {
|
|
77
|
+
var filteredProps = {};
|
|
78
|
+
for (var prop in props) {
|
|
79
|
+
if (Object.prototype.hasOwnProperty.call(props, prop) &&
|
|
80
|
+
dataAttrRe.test(prop)) {
|
|
81
|
+
filteredProps[prop] = props[prop];
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return filteredProps;
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
function getDefaultExportFromCjs (x) {
|
|
88
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
var classnames = {exports: {}};
|
|
92
|
+
|
|
93
|
+
/*!
|
|
94
|
+
Copyright (c) 2018 Jed Watson.
|
|
95
|
+
Licensed under the MIT License (MIT), see
|
|
96
|
+
http://jedwatson.github.io/classnames
|
|
97
|
+
*/
|
|
98
|
+
|
|
99
|
+
var hasRequiredClassnames;
|
|
100
|
+
|
|
101
|
+
function requireClassnames () {
|
|
102
|
+
if (hasRequiredClassnames) return classnames.exports;
|
|
103
|
+
hasRequiredClassnames = 1;
|
|
104
|
+
(function (module) {
|
|
105
|
+
/* global define */
|
|
106
|
+
|
|
107
|
+
(function () {
|
|
108
|
+
|
|
109
|
+
var hasOwn = {}.hasOwnProperty;
|
|
110
|
+
|
|
111
|
+
function classNames () {
|
|
112
|
+
var classes = '';
|
|
113
|
+
|
|
114
|
+
for (var i = 0; i < arguments.length; i++) {
|
|
115
|
+
var arg = arguments[i];
|
|
116
|
+
if (arg) {
|
|
117
|
+
classes = appendClass(classes, parseValue(arg));
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
return classes;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function parseValue (arg) {
|
|
125
|
+
if (typeof arg === 'string' || typeof arg === 'number') {
|
|
126
|
+
return arg;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
if (typeof arg !== 'object') {
|
|
130
|
+
return '';
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
if (Array.isArray(arg)) {
|
|
134
|
+
return classNames.apply(null, arg);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {
|
|
138
|
+
return arg.toString();
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
var classes = '';
|
|
142
|
+
|
|
143
|
+
for (var key in arg) {
|
|
144
|
+
if (hasOwn.call(arg, key) && arg[key]) {
|
|
145
|
+
classes = appendClass(classes, key);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
return classes;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
function appendClass (value, newClass) {
|
|
153
|
+
if (!newClass) {
|
|
154
|
+
return value;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
if (value) {
|
|
158
|
+
return value + ' ' + newClass;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
return value + newClass;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
if (module.exports) {
|
|
165
|
+
classNames.default = classNames;
|
|
166
|
+
module.exports = classNames;
|
|
167
|
+
} else {
|
|
168
|
+
window.classNames = classNames;
|
|
169
|
+
}
|
|
170
|
+
}());
|
|
171
|
+
} (classnames));
|
|
172
|
+
return classnames.exports;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
var classnamesExports = requireClassnames();
|
|
176
|
+
var classNames = /*@__PURE__*/getDefaultExportFromCjs(classnamesExports);
|
|
177
|
+
|
|
178
|
+
var styles$a = {"section-header--padded":"SectionHeading-module_section-header--padded__0FXP2"};
|
|
179
|
+
|
|
180
|
+
var SectionHeading = function (_a) {
|
|
181
|
+
var _b;
|
|
182
|
+
var heading = _a.heading, content = _a.content, id = _a.id, _c = _a.isPadded, isPadded = _c === void 0 ? false : _c, _d = _a.headingLevel, headingLevel = _d === void 0 ? "2" : _d, props = __rest(_a, ["heading", "content", "id", "isPadded", "headingLevel"]);
|
|
183
|
+
return (React.createElement("div", __assign({ className: classNames((_b = {},
|
|
184
|
+
_b[styles$a["section-header--padded"]] = isPadded,
|
|
185
|
+
_b)) }, filterDataAttrs(props)),
|
|
186
|
+
React.createElement(Heading.Heading, { level: headingLevel, id: id, size: "xl" }, heading),
|
|
187
|
+
content && (React.createElement(React.Fragment, null,
|
|
188
|
+
React.createElement(VerticalSpace.VerticalSpace, { size: "24" }),
|
|
189
|
+
React.createElement(Text.Text, { size: "l", elementType: "p" }, content)))));
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
var AccordionDisclosureList = function (_a) {
|
|
193
|
+
var disclosureList = _a.disclosureList;
|
|
194
|
+
return (React.createElement(React.Fragment, null, disclosureList.map(function (_a, index) {
|
|
195
|
+
var children = _a.children, summary = _a.summary, _b = _a.isOpen, isOpen = _b === void 0 ? false : _b, _c = _a.indentDetails, indentDetails = _c === void 0 ? false : _c, headingLevel = _a.headingLevel;
|
|
196
|
+
return (React.createElement(Disclosure.Disclosure, { key: index, summary: summary, isOpen: isOpen, indentDetails: indentDetails, headingLevel: headingLevel }, children));
|
|
197
|
+
})));
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Use the `Accordion` component to package together a title, content and a number of disclosure components into one section (maximum 10).
|
|
202
|
+
*/
|
|
203
|
+
var Accordion = function (_a) {
|
|
204
|
+
var heading = _a.heading, headingLevel = _a.headingLevel, content = _a.content, disclosureList = _a.disclosureList, props = __rest(_a, ["heading", "headingLevel", "content", "disclosureList"]);
|
|
205
|
+
return (React.createElement("div", __assign({}, filterDataAttrs(props)),
|
|
206
|
+
React.createElement(SectionHeading, { isPadded: true, "data-testid": "Accordion-header", heading: heading, headingLevel: headingLevel, content: content }),
|
|
207
|
+
React.createElement(AccordionDisclosureList, { disclosureList: disclosureList })));
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
var styles$9 = {"authorContent":"Author-module_authorContent__TBY7b","largeAvatar":"Author-module_largeAvatar__Vco03"};
|
|
211
|
+
|
|
212
|
+
var Author = function (_a) {
|
|
213
|
+
var name = _a.name, title = _a.title, _b = _a.avatar, avatar = _b === void 0 ? {} : _b, props = __rest(_a, ["name", "title", "avatar"]);
|
|
214
|
+
var avatarSizes = ["s", "m", "l", "xl"];
|
|
215
|
+
avatar.size = avatarSizes.includes(avatar.size || "") ? avatar.size : "m";
|
|
216
|
+
var isLargeAvatar = avatar.size === "l" || avatar.size === "xl";
|
|
217
|
+
return (React.createElement("div", __assign({}, filterDataAttrs(props)),
|
|
218
|
+
React.createElement(Grid.Grid, { isFluid: true, isGutterless: true },
|
|
219
|
+
React.createElement(Grid.Grid.Row, { align: "center" },
|
|
220
|
+
React.createElement(Grid.Grid.Col, { xs: isLargeAvatar ? 12 : "auto" },
|
|
221
|
+
React.createElement("div", { className: isLargeAvatar ? styles$9.largeAvatar : undefined },
|
|
222
|
+
React.createElement(Avatar.Avatar, __assign({}, avatar)))),
|
|
223
|
+
React.createElement(Grid.Grid.Col, null,
|
|
224
|
+
React.createElement("div", { className: "".concat(!isLargeAvatar && styles$9.authorContent), "data-testid": "authorContent" },
|
|
225
|
+
React.createElement(Heading.Heading, { size: "xs" }, name),
|
|
226
|
+
React.createElement(Text.Text, { size: "s" }, title)))))));
|
|
227
|
+
};
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Do not edit directly
|
|
231
|
+
* Generated on Fri, 29 Nov 2024 12:01:05 GMT
|
|
232
|
+
*/
|
|
233
|
+
var ArcSizeBreakpointsS = "636px";
|
|
234
|
+
var ArcSizeBreakpointsM = "768px";
|
|
235
|
+
var ArcSizeBreakpointsL = "1024px";
|
|
236
|
+
var ArcSizeBreakpointsXl = "1280px";
|
|
237
|
+
|
|
238
|
+
var styles$8 = {"buttonContainer":"CopyLead-module_buttonContainer__3OaRG","col":"CopyLead-module_col__0Da5H","container":"CopyLead-module_container__I91ym","container--content":"CopyLead-module_container--content__e8LxG","container--media":"CopyLead-module_container--media__QcMWi","container--align-center":"CopyLead-module_container--align-center__Fh1Sd","container--align-top":"CopyLead-module_container--align-top__UIXOZ","list":"CopyLead-module_list__arnJd","listItem":"CopyLead-module_listItem__NscHE","listItemCentered":"CopyLead-module_listItemCentered__Kwdab","listItemIconContainer":"CopyLead-module_listItemIconContainer__dgnhJ","listItemTextContainer":"CopyLead-module_listItemTextContainer__Dl9lw","imgWrapper":"CopyLead-module_imgWrapper__HYP3w","mediaContainer":"CopyLead-module_mediaContainer__PxTnm","content":"CopyLead-module_content__Bja1D","container--reverse":"CopyLead-module_container--reverse__Gq9u8"};
|
|
239
|
+
|
|
240
|
+
var MediaContent$1 = function (_a) {
|
|
241
|
+
var heading = _a.heading, headingLevel = _a.headingLevel, children = _a.children;
|
|
242
|
+
return (React.createElement("div", { className: styles$8.mediaContainer },
|
|
243
|
+
React.createElement(Heading.Heading, { level: headingLevel, size: "xl" }, heading),
|
|
244
|
+
children && (React.createElement("div", { className: styles$8.content },
|
|
245
|
+
React.createElement(VerticalSpace.VerticalSpace, { size: "24" }),
|
|
246
|
+
React.createElement(Text.Text, { size: "l" }, children)))));
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
var Image$1 = function (_a) {
|
|
250
|
+
var sources = _a.sources, props = __rest(_a, ["sources"]);
|
|
251
|
+
return (React.createElement("div", { className: styles$8.imgWrapper },
|
|
252
|
+
React.createElement(Image$2.Image, __assign({ fadeOnLoad: true }, props), sources &&
|
|
253
|
+
sources.map(function (source) { return (React.createElement(Image$2.Image.Source, __assign({ key: source.srcSet }, source))); }))));
|
|
254
|
+
};
|
|
255
|
+
|
|
256
|
+
var IconList = function (_a) {
|
|
257
|
+
var listItems = _a.listItems, isLgScreen = _a.isLgScreen;
|
|
258
|
+
return (React.createElement("ul", { className: styles$8.list }, listItems.map(function (_a) {
|
|
259
|
+
var _b;
|
|
260
|
+
var icon = _a.icon, heading = _a.heading, text = _a.text;
|
|
261
|
+
return (React.createElement("li", { key: heading, className: classNames(styles$8.listItem, (_b = {},
|
|
262
|
+
_b[styles$8.listItemCentered] = !text,
|
|
263
|
+
_b)) },
|
|
264
|
+
React.createElement("div", { className: styles$8.listItemIconContainer },
|
|
265
|
+
React.createElement(Icon.Icon, { color: "brand", icon: icon, size: isLgScreen ? 64 : 48 })),
|
|
266
|
+
React.createElement("div", { className: styles$8.listItemTextContainer },
|
|
267
|
+
React.createElement(Heading.Heading, { level: "3", size: "s" }, heading),
|
|
268
|
+
text && (React.createElement(React.Fragment, null,
|
|
269
|
+
React.createElement(VerticalSpace.VerticalSpace, { size: "8", sizeL: "16" }),
|
|
270
|
+
React.createElement(Text.Text, null, text))))));
|
|
271
|
+
})));
|
|
272
|
+
};
|
|
273
|
+
|
|
274
|
+
var Button = function (props) { return (React.createElement("div", { className: styles$8.buttonContainer },
|
|
275
|
+
React.createElement(ButtonV2.ButtonV2, __assign({ isFullWidth: true, buttonStyle: "secondary" }, props)))); };
|
|
276
|
+
|
|
277
|
+
var Container = function (_a) {
|
|
278
|
+
var _b;
|
|
279
|
+
var children = _a.children, isReverseOrder = _a.isReverseOrder, type = _a.type, alignment = _a.alignment;
|
|
280
|
+
return (React.createElement("div", { "data-testid": "copy-lead-container", className: classNames(styles$8.container, styles$8["container--".concat(type)], styles$8["container--align-".concat(alignment)], (_b = {},
|
|
281
|
+
_b[styles$8["container--reverse"]] = isReverseOrder,
|
|
282
|
+
_b)) }, children));
|
|
283
|
+
};
|
|
284
|
+
|
|
285
|
+
var Column = function (_a) {
|
|
286
|
+
var children = _a.children;
|
|
287
|
+
return (React.createElement("div", { className: styles$8.col }, children));
|
|
288
|
+
};
|
|
289
|
+
|
|
290
|
+
var VideoPlayer$1 = React.lazy(function () {
|
|
291
|
+
return import('@arc-ui/components/dist/VideoPlayer').then(function (_a) {
|
|
292
|
+
var VideoPlayer = _a.VideoPlayer;
|
|
293
|
+
return ({
|
|
294
|
+
default: VideoPlayer,
|
|
295
|
+
});
|
|
296
|
+
});
|
|
297
|
+
});
|
|
298
|
+
var MediaTemplate = function (_a) {
|
|
299
|
+
var button = _a.button, heading = _a.heading, headingLevel = _a.headingLevel, listItems = _a.listItems, video = _a.video, image = _a.image, content = _a.content, _b = _a.isReverseOrder, isReverseOrder = _b === void 0 ? false : _b;
|
|
300
|
+
var _c = React.useState(false), isClient = _c[0], setIsClient = _c[1];
|
|
301
|
+
var isMinWidthArcBreakpointL = useMediaQuery.useMediaQuery("(min-width: ".concat(ArcSizeBreakpointsL, ")"));
|
|
302
|
+
var isMinWidthArcBreakpointXl = useMediaQuery.useMediaQuery("(min-width: ".concat(ArcSizeBreakpointsXl, ")"));
|
|
303
|
+
React.useEffect(function () {
|
|
304
|
+
setIsClient(true);
|
|
305
|
+
}, []);
|
|
306
|
+
return (React.createElement("div", null,
|
|
307
|
+
!isMinWidthArcBreakpointXl && (React.createElement(Columns.Columns, null,
|
|
308
|
+
React.createElement(Columns.Columns.Col, { span: 12, spanM: 9 },
|
|
309
|
+
React.createElement(MediaContent$1, { heading: heading, headingLevel: headingLevel }, content)))),
|
|
310
|
+
React.createElement(Container, { type: "media", isReverseOrder: isReverseOrder, alignment: !isMinWidthArcBreakpointXl ? "top" : "center" },
|
|
311
|
+
React.createElement(Column, null,
|
|
312
|
+
isMinWidthArcBreakpointXl && (React.createElement(MediaContent$1, { heading: heading }, content)),
|
|
313
|
+
React.createElement(IconList, { listItems: listItems, isLgScreen: isMinWidthArcBreakpointL }),
|
|
314
|
+
button && React.createElement(Button, __assign({}, button))),
|
|
315
|
+
React.createElement(Column, null,
|
|
316
|
+
video && isClient && (React.createElement(React.Suspense, { fallback: null },
|
|
317
|
+
React.createElement(VideoPlayer$1, __assign({}, video)))),
|
|
318
|
+
image && !video && React.createElement(Image$1, __assign({}, image))))));
|
|
319
|
+
};
|
|
320
|
+
|
|
321
|
+
var ContentTemplate = function (_a) {
|
|
322
|
+
var button = _a.button, heading = _a.heading, headingLevel = _a.headingLevel, listItems = _a.listItems, content = _a.content;
|
|
323
|
+
var isMinWidthArcBreakpointM = useMediaQuery.useMediaQuery("(min-width: ".concat(ArcSizeBreakpointsM, ")"));
|
|
324
|
+
var isMinWidthArcBreakpointL = useMediaQuery.useMediaQuery("(min-width: ".concat(ArcSizeBreakpointsL, ")"));
|
|
325
|
+
return (React.createElement(Container, { type: "content", alignment: "top" },
|
|
326
|
+
React.createElement(Column, null,
|
|
327
|
+
React.createElement(SectionHeading, { heading: heading, headingLevel: headingLevel, content: content }),
|
|
328
|
+
button && isMinWidthArcBreakpointM && React.createElement(Button, __assign({}, button))),
|
|
329
|
+
React.createElement(Column, null,
|
|
330
|
+
React.createElement(IconList, { listItems: listItems, isLgScreen: isMinWidthArcBreakpointL }),
|
|
331
|
+
button && !isMinWidthArcBreakpointM && React.createElement(Button, __assign({}, button)))));
|
|
332
|
+
};
|
|
333
|
+
|
|
334
|
+
/**
|
|
335
|
+
* Use `CopyLead` to give supporting information about a page or proposition. It can be used to call out key benefits in bullet points, or link to a supporting explanatory video. An optional CTA can be used to link to further information or trigger a sales or enquiry journey.
|
|
336
|
+
*/
|
|
337
|
+
var CopyLead = function (_a) {
|
|
338
|
+
var button = _a.button, heading = _a.heading, _b = _a.headingLevel, headingLevel = _b === void 0 ? "2" : _b, listItems = _a.listItems, video = _a.video, image = _a.image, content = _a.content, _c = _a.isReverseOrder, isReverseOrder = _c === void 0 ? false : _c, props = __rest(_a, ["button", "heading", "headingLevel", "listItems", "video", "image", "content", "isReverseOrder"]);
|
|
339
|
+
console.log(video);
|
|
340
|
+
if (video || image) {
|
|
341
|
+
return (React.createElement(MediaTemplate, __assign({ content: content, video: video, image: image, listItems: listItems, heading: heading, headingLevel: headingLevel, button: button, isReverseOrder: isReverseOrder }, filterDataAttrs(props))));
|
|
342
|
+
}
|
|
343
|
+
if (content) {
|
|
344
|
+
return (React.createElement(ContentTemplate, { listItems: listItems, heading: heading, headingLevel: headingLevel, button: button, content: content }));
|
|
345
|
+
}
|
|
346
|
+
return null;
|
|
347
|
+
};
|
|
348
|
+
|
|
349
|
+
var styles$7 = {"headingContainer":"DownloadList-module_headingContainer__PNio8"};
|
|
350
|
+
|
|
351
|
+
var DownloadList = function (_a) {
|
|
352
|
+
var heading = _a.heading, _b = _a.headingLevel, headingLevel = _b === void 0 ? "2" : _b, content = _a.content, downloads = _a.downloads;
|
|
353
|
+
return (React.createElement(React.Fragment, null,
|
|
354
|
+
React.createElement("div", { className: styles$7.headingContainer },
|
|
355
|
+
React.createElement(Heading.Heading, { size: "xl", level: headingLevel }, heading),
|
|
356
|
+
React.createElement(VerticalSpace.VerticalSpace, { size: "24" }),
|
|
357
|
+
React.createElement(Text.Text, { size: "l" }, content)),
|
|
358
|
+
React.createElement(VerticalSpace.VerticalSpace, { size: "40" }),
|
|
359
|
+
downloads.map(function (props, i) { return (React.createElement(React.Fragment, null,
|
|
360
|
+
React.createElement(Download.Download, __assign({}, props)),
|
|
361
|
+
" ",
|
|
362
|
+
i !== downloads.length - 1 && React.createElement(VerticalSpace.VerticalSpace, { size: "16" }))); })));
|
|
363
|
+
};
|
|
364
|
+
|
|
365
|
+
function _typeof(o) {
|
|
366
|
+
"@babel/helpers - typeof";
|
|
367
|
+
|
|
368
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
369
|
+
return typeof o;
|
|
370
|
+
} : function (o) {
|
|
371
|
+
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
372
|
+
}, _typeof(o);
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
function toInteger(dirtyNumber) {
|
|
376
|
+
if (dirtyNumber === null || dirtyNumber === true || dirtyNumber === false) {
|
|
377
|
+
return NaN;
|
|
378
|
+
}
|
|
379
|
+
var number = Number(dirtyNumber);
|
|
380
|
+
if (isNaN(number)) {
|
|
381
|
+
return number;
|
|
382
|
+
}
|
|
383
|
+
return number < 0 ? Math.ceil(number) : Math.floor(number);
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
function requiredArgs(required, args) {
|
|
387
|
+
if (args.length < required) {
|
|
388
|
+
throw new TypeError(required + ' argument' + (required > 1 ? 's' : '') + ' required, but only ' + args.length + ' present');
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
/**
|
|
393
|
+
* @name toDate
|
|
394
|
+
* @category Common Helpers
|
|
395
|
+
* @summary Convert the given argument to an instance of Date.
|
|
396
|
+
*
|
|
397
|
+
* @description
|
|
398
|
+
* Convert the given argument to an instance of Date.
|
|
399
|
+
*
|
|
400
|
+
* If the argument is an instance of Date, the function returns its clone.
|
|
401
|
+
*
|
|
402
|
+
* If the argument is a number, it is treated as a timestamp.
|
|
403
|
+
*
|
|
404
|
+
* If the argument is none of the above, the function returns Invalid Date.
|
|
405
|
+
*
|
|
406
|
+
* **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.
|
|
407
|
+
*
|
|
408
|
+
* @param {Date|Number} argument - the value to convert
|
|
409
|
+
* @returns {Date} the parsed date in the local time zone
|
|
410
|
+
* @throws {TypeError} 1 argument required
|
|
411
|
+
*
|
|
412
|
+
* @example
|
|
413
|
+
* // Clone the date:
|
|
414
|
+
* const result = toDate(new Date(2014, 1, 11, 11, 30, 30))
|
|
415
|
+
* //=> Tue Feb 11 2014 11:30:30
|
|
416
|
+
*
|
|
417
|
+
* @example
|
|
418
|
+
* // Convert the timestamp to date:
|
|
419
|
+
* const result = toDate(1392098430000)
|
|
420
|
+
* //=> Tue Feb 11 2014 11:30:30
|
|
421
|
+
*/
|
|
422
|
+
function toDate(argument) {
|
|
423
|
+
requiredArgs(1, arguments);
|
|
424
|
+
var argStr = Object.prototype.toString.call(argument);
|
|
425
|
+
|
|
426
|
+
// Clone the date
|
|
427
|
+
if (argument instanceof Date || _typeof(argument) === 'object' && argStr === '[object Date]') {
|
|
428
|
+
// Prevent the date to lose the milliseconds when passed to new Date() in IE10
|
|
429
|
+
return new Date(argument.getTime());
|
|
430
|
+
} else if (typeof argument === 'number' || argStr === '[object Number]') {
|
|
431
|
+
return new Date(argument);
|
|
432
|
+
} else {
|
|
433
|
+
if ((typeof argument === 'string' || argStr === '[object String]') && typeof console !== 'undefined') {
|
|
434
|
+
// eslint-disable-next-line no-console
|
|
435
|
+
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://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments");
|
|
436
|
+
// eslint-disable-next-line no-console
|
|
437
|
+
console.warn(new Error().stack);
|
|
438
|
+
}
|
|
439
|
+
return new Date(NaN);
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
/**
|
|
444
|
+
* @name addMilliseconds
|
|
445
|
+
* @category Millisecond Helpers
|
|
446
|
+
* @summary Add the specified number of milliseconds to the given date.
|
|
447
|
+
*
|
|
448
|
+
* @description
|
|
449
|
+
* Add the specified number of milliseconds to the given date.
|
|
450
|
+
*
|
|
451
|
+
* @param {Date|Number} date - the date to be changed
|
|
452
|
+
* @param {Number} amount - the amount of milliseconds to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
|
|
453
|
+
* @returns {Date} the new date with the milliseconds added
|
|
454
|
+
* @throws {TypeError} 2 arguments required
|
|
455
|
+
*
|
|
456
|
+
* @example
|
|
457
|
+
* // Add 750 milliseconds to 10 July 2014 12:45:30.000:
|
|
458
|
+
* const result = addMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)
|
|
459
|
+
* //=> Thu Jul 10 2014 12:45:30.750
|
|
460
|
+
*/
|
|
461
|
+
function addMilliseconds(dirtyDate, dirtyAmount) {
|
|
462
|
+
requiredArgs(2, arguments);
|
|
463
|
+
var timestamp = toDate(dirtyDate).getTime();
|
|
464
|
+
var amount = toInteger(dirtyAmount);
|
|
465
|
+
return new Date(timestamp + amount);
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
var defaultOptions = {};
|
|
469
|
+
function getDefaultOptions() {
|
|
470
|
+
return defaultOptions;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
/**
|
|
474
|
+
* Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds.
|
|
475
|
+
* They usually appear for dates that denote time before the timezones were introduced
|
|
476
|
+
* (e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891
|
|
477
|
+
* and GMT+01:00:00 after that date)
|
|
478
|
+
*
|
|
479
|
+
* Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above,
|
|
480
|
+
* which would lead to incorrect calculations.
|
|
481
|
+
*
|
|
482
|
+
* This function returns the timezone offset in milliseconds that takes seconds in account.
|
|
483
|
+
*/
|
|
484
|
+
function getTimezoneOffsetInMilliseconds(date) {
|
|
485
|
+
var utcDate = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds()));
|
|
486
|
+
utcDate.setUTCFullYear(date.getFullYear());
|
|
487
|
+
return date.getTime() - utcDate.getTime();
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
/**
|
|
491
|
+
* @name isDate
|
|
492
|
+
* @category Common Helpers
|
|
493
|
+
* @summary Is the given value a date?
|
|
494
|
+
*
|
|
495
|
+
* @description
|
|
496
|
+
* Returns true if the given value is an instance of Date. The function works for dates transferred across iframes.
|
|
497
|
+
*
|
|
498
|
+
* @param {*} value - the value to check
|
|
499
|
+
* @returns {boolean} true if the given value is a date
|
|
500
|
+
* @throws {TypeError} 1 arguments required
|
|
501
|
+
*
|
|
502
|
+
* @example
|
|
503
|
+
* // For a valid date:
|
|
504
|
+
* const result = isDate(new Date())
|
|
505
|
+
* //=> true
|
|
506
|
+
*
|
|
507
|
+
* @example
|
|
508
|
+
* // For an invalid date:
|
|
509
|
+
* const result = isDate(new Date(NaN))
|
|
510
|
+
* //=> true
|
|
511
|
+
*
|
|
512
|
+
* @example
|
|
513
|
+
* // For some value:
|
|
514
|
+
* const result = isDate('2014-02-31')
|
|
515
|
+
* //=> false
|
|
516
|
+
*
|
|
517
|
+
* @example
|
|
518
|
+
* // For an object:
|
|
519
|
+
* const result = isDate({})
|
|
520
|
+
* //=> false
|
|
521
|
+
*/
|
|
522
|
+
function isDate(value) {
|
|
523
|
+
requiredArgs(1, arguments);
|
|
524
|
+
return value instanceof Date || _typeof(value) === 'object' && Object.prototype.toString.call(value) === '[object Date]';
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
/**
|
|
528
|
+
* @name isValid
|
|
529
|
+
* @category Common Helpers
|
|
530
|
+
* @summary Is the given date valid?
|
|
531
|
+
*
|
|
532
|
+
* @description
|
|
533
|
+
* Returns false if argument is Invalid Date and true otherwise.
|
|
534
|
+
* Argument is converted to Date using `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate}
|
|
535
|
+
* Invalid Date is a Date, whose time value is NaN.
|
|
536
|
+
*
|
|
537
|
+
* Time value of Date: http://es5.github.io/#x15.9.1.1
|
|
538
|
+
*
|
|
539
|
+
* @param {*} date - the date to check
|
|
540
|
+
* @returns {Boolean} the date is valid
|
|
541
|
+
* @throws {TypeError} 1 argument required
|
|
542
|
+
*
|
|
543
|
+
* @example
|
|
544
|
+
* // For the valid date:
|
|
545
|
+
* const result = isValid(new Date(2014, 1, 31))
|
|
546
|
+
* //=> true
|
|
547
|
+
*
|
|
548
|
+
* @example
|
|
549
|
+
* // For the value, convertable into a date:
|
|
550
|
+
* const result = isValid(1393804800000)
|
|
551
|
+
* //=> true
|
|
552
|
+
*
|
|
553
|
+
* @example
|
|
554
|
+
* // For the invalid date:
|
|
555
|
+
* const result = isValid(new Date(''))
|
|
556
|
+
* //=> false
|
|
557
|
+
*/
|
|
558
|
+
function isValid(dirtyDate) {
|
|
559
|
+
requiredArgs(1, arguments);
|
|
560
|
+
if (!isDate(dirtyDate) && typeof dirtyDate !== 'number') {
|
|
561
|
+
return false;
|
|
562
|
+
}
|
|
563
|
+
var date = toDate(dirtyDate);
|
|
564
|
+
return !isNaN(Number(date));
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
/**
|
|
568
|
+
* @name subMilliseconds
|
|
569
|
+
* @category Millisecond Helpers
|
|
570
|
+
* @summary Subtract the specified number of milliseconds from the given date.
|
|
571
|
+
*
|
|
572
|
+
* @description
|
|
573
|
+
* Subtract the specified number of milliseconds from the given date.
|
|
574
|
+
*
|
|
575
|
+
* @param {Date|Number} date - the date to be changed
|
|
576
|
+
* @param {Number} amount - the amount of milliseconds to be subtracted. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
|
|
577
|
+
* @returns {Date} the new date with the milliseconds subtracted
|
|
578
|
+
* @throws {TypeError} 2 arguments required
|
|
579
|
+
*
|
|
580
|
+
* @example
|
|
581
|
+
* // Subtract 750 milliseconds from 10 July 2014 12:45:30.000:
|
|
582
|
+
* const result = subMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)
|
|
583
|
+
* //=> Thu Jul 10 2014 12:45:29.250
|
|
584
|
+
*/
|
|
585
|
+
function subMilliseconds(dirtyDate, dirtyAmount) {
|
|
586
|
+
requiredArgs(2, arguments);
|
|
587
|
+
var amount = toInteger(dirtyAmount);
|
|
588
|
+
return addMilliseconds(dirtyDate, -amount);
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
var MILLISECONDS_IN_DAY = 86400000;
|
|
592
|
+
function getUTCDayOfYear(dirtyDate) {
|
|
593
|
+
requiredArgs(1, arguments);
|
|
594
|
+
var date = toDate(dirtyDate);
|
|
595
|
+
var timestamp = date.getTime();
|
|
596
|
+
date.setUTCMonth(0, 1);
|
|
597
|
+
date.setUTCHours(0, 0, 0, 0);
|
|
598
|
+
var startOfYearTimestamp = date.getTime();
|
|
599
|
+
var difference = timestamp - startOfYearTimestamp;
|
|
600
|
+
return Math.floor(difference / MILLISECONDS_IN_DAY) + 1;
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
function startOfUTCISOWeek(dirtyDate) {
|
|
604
|
+
requiredArgs(1, arguments);
|
|
605
|
+
var weekStartsOn = 1;
|
|
606
|
+
var date = toDate(dirtyDate);
|
|
607
|
+
var day = date.getUTCDay();
|
|
608
|
+
var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
|
|
609
|
+
date.setUTCDate(date.getUTCDate() - diff);
|
|
610
|
+
date.setUTCHours(0, 0, 0, 0);
|
|
611
|
+
return date;
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
function getUTCISOWeekYear(dirtyDate) {
|
|
615
|
+
requiredArgs(1, arguments);
|
|
616
|
+
var date = toDate(dirtyDate);
|
|
617
|
+
var year = date.getUTCFullYear();
|
|
618
|
+
var fourthOfJanuaryOfNextYear = new Date(0);
|
|
619
|
+
fourthOfJanuaryOfNextYear.setUTCFullYear(year + 1, 0, 4);
|
|
620
|
+
fourthOfJanuaryOfNextYear.setUTCHours(0, 0, 0, 0);
|
|
621
|
+
var startOfNextYear = startOfUTCISOWeek(fourthOfJanuaryOfNextYear);
|
|
622
|
+
var fourthOfJanuaryOfThisYear = new Date(0);
|
|
623
|
+
fourthOfJanuaryOfThisYear.setUTCFullYear(year, 0, 4);
|
|
624
|
+
fourthOfJanuaryOfThisYear.setUTCHours(0, 0, 0, 0);
|
|
625
|
+
var startOfThisYear = startOfUTCISOWeek(fourthOfJanuaryOfThisYear);
|
|
626
|
+
if (date.getTime() >= startOfNextYear.getTime()) {
|
|
627
|
+
return year + 1;
|
|
628
|
+
} else if (date.getTime() >= startOfThisYear.getTime()) {
|
|
629
|
+
return year;
|
|
630
|
+
} else {
|
|
631
|
+
return year - 1;
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
function startOfUTCISOWeekYear(dirtyDate) {
|
|
636
|
+
requiredArgs(1, arguments);
|
|
637
|
+
var year = getUTCISOWeekYear(dirtyDate);
|
|
638
|
+
var fourthOfJanuary = new Date(0);
|
|
639
|
+
fourthOfJanuary.setUTCFullYear(year, 0, 4);
|
|
640
|
+
fourthOfJanuary.setUTCHours(0, 0, 0, 0);
|
|
641
|
+
var date = startOfUTCISOWeek(fourthOfJanuary);
|
|
642
|
+
return date;
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
var MILLISECONDS_IN_WEEK$1 = 604800000;
|
|
646
|
+
function getUTCISOWeek(dirtyDate) {
|
|
647
|
+
requiredArgs(1, arguments);
|
|
648
|
+
var date = toDate(dirtyDate);
|
|
649
|
+
var diff = startOfUTCISOWeek(date).getTime() - startOfUTCISOWeekYear(date).getTime();
|
|
650
|
+
|
|
651
|
+
// Round the number of days to the nearest integer
|
|
652
|
+
// because the number of milliseconds in a week is not constant
|
|
653
|
+
// (e.g. it's different in the week of the daylight saving time clock shift)
|
|
654
|
+
return Math.round(diff / MILLISECONDS_IN_WEEK$1) + 1;
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
function startOfUTCWeek(dirtyDate, options) {
|
|
658
|
+
var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
|
|
659
|
+
requiredArgs(1, arguments);
|
|
660
|
+
var defaultOptions = getDefaultOptions();
|
|
661
|
+
var weekStartsOn = toInteger((_ref = (_ref2 = (_ref3 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.weekStartsOn) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.weekStartsOn) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.weekStartsOn) !== null && _ref !== void 0 ? _ref : 0);
|
|
662
|
+
|
|
663
|
+
// Test if weekStartsOn is between 0 and 6 _and_ is not NaN
|
|
664
|
+
if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
|
|
665
|
+
throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
|
|
666
|
+
}
|
|
667
|
+
var date = toDate(dirtyDate);
|
|
668
|
+
var day = date.getUTCDay();
|
|
669
|
+
var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
|
|
670
|
+
date.setUTCDate(date.getUTCDate() - diff);
|
|
671
|
+
date.setUTCHours(0, 0, 0, 0);
|
|
672
|
+
return date;
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
function getUTCWeekYear(dirtyDate, options) {
|
|
676
|
+
var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
|
|
677
|
+
requiredArgs(1, arguments);
|
|
678
|
+
var date = toDate(dirtyDate);
|
|
679
|
+
var year = date.getUTCFullYear();
|
|
680
|
+
var defaultOptions = getDefaultOptions();
|
|
681
|
+
var firstWeekContainsDate = toInteger((_ref = (_ref2 = (_ref3 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref !== void 0 ? _ref : 1);
|
|
682
|
+
|
|
683
|
+
// Test if weekStartsOn is between 1 and 7 _and_ is not NaN
|
|
684
|
+
if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {
|
|
685
|
+
throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');
|
|
686
|
+
}
|
|
687
|
+
var firstWeekOfNextYear = new Date(0);
|
|
688
|
+
firstWeekOfNextYear.setUTCFullYear(year + 1, 0, firstWeekContainsDate);
|
|
689
|
+
firstWeekOfNextYear.setUTCHours(0, 0, 0, 0);
|
|
690
|
+
var startOfNextYear = startOfUTCWeek(firstWeekOfNextYear, options);
|
|
691
|
+
var firstWeekOfThisYear = new Date(0);
|
|
692
|
+
firstWeekOfThisYear.setUTCFullYear(year, 0, firstWeekContainsDate);
|
|
693
|
+
firstWeekOfThisYear.setUTCHours(0, 0, 0, 0);
|
|
694
|
+
var startOfThisYear = startOfUTCWeek(firstWeekOfThisYear, options);
|
|
695
|
+
if (date.getTime() >= startOfNextYear.getTime()) {
|
|
696
|
+
return year + 1;
|
|
697
|
+
} else if (date.getTime() >= startOfThisYear.getTime()) {
|
|
698
|
+
return year;
|
|
699
|
+
} else {
|
|
700
|
+
return year - 1;
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
function startOfUTCWeekYear(dirtyDate, options) {
|
|
705
|
+
var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
|
|
706
|
+
requiredArgs(1, arguments);
|
|
707
|
+
var defaultOptions = getDefaultOptions();
|
|
708
|
+
var firstWeekContainsDate = toInteger((_ref = (_ref2 = (_ref3 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref !== void 0 ? _ref : 1);
|
|
709
|
+
var year = getUTCWeekYear(dirtyDate, options);
|
|
710
|
+
var firstWeek = new Date(0);
|
|
711
|
+
firstWeek.setUTCFullYear(year, 0, firstWeekContainsDate);
|
|
712
|
+
firstWeek.setUTCHours(0, 0, 0, 0);
|
|
713
|
+
var date = startOfUTCWeek(firstWeek, options);
|
|
714
|
+
return date;
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
var MILLISECONDS_IN_WEEK = 604800000;
|
|
718
|
+
function getUTCWeek(dirtyDate, options) {
|
|
719
|
+
requiredArgs(1, arguments);
|
|
720
|
+
var date = toDate(dirtyDate);
|
|
721
|
+
var diff = startOfUTCWeek(date, options).getTime() - startOfUTCWeekYear(date, options).getTime();
|
|
722
|
+
|
|
723
|
+
// Round the number of days to the nearest integer
|
|
724
|
+
// because the number of milliseconds in a week is not constant
|
|
725
|
+
// (e.g. it's different in the week of the daylight saving time clock shift)
|
|
726
|
+
return Math.round(diff / MILLISECONDS_IN_WEEK) + 1;
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
function addLeadingZeros(number, targetLength) {
|
|
730
|
+
var sign = number < 0 ? '-' : '';
|
|
731
|
+
var output = Math.abs(number).toString();
|
|
732
|
+
while (output.length < targetLength) {
|
|
733
|
+
output = '0' + output;
|
|
734
|
+
}
|
|
735
|
+
return sign + output;
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
/*
|
|
739
|
+
* | | Unit | | Unit |
|
|
740
|
+
* |-----|--------------------------------|-----|--------------------------------|
|
|
741
|
+
* | a | AM, PM | A* | |
|
|
742
|
+
* | d | Day of month | D | |
|
|
743
|
+
* | h | Hour [1-12] | H | Hour [0-23] |
|
|
744
|
+
* | m | Minute | M | Month |
|
|
745
|
+
* | s | Second | S | Fraction of second |
|
|
746
|
+
* | y | Year (abs) | Y | |
|
|
747
|
+
*
|
|
748
|
+
* Letters marked by * are not implemented but reserved by Unicode standard.
|
|
749
|
+
*/
|
|
750
|
+
var formatters$1 = {
|
|
751
|
+
// Year
|
|
752
|
+
y: function y(date, token) {
|
|
753
|
+
// From http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_tokens
|
|
754
|
+
// | Year | y | yy | yyy | yyyy | yyyyy |
|
|
755
|
+
// |----------|-------|----|-------|-------|-------|
|
|
756
|
+
// | AD 1 | 1 | 01 | 001 | 0001 | 00001 |
|
|
757
|
+
// | AD 12 | 12 | 12 | 012 | 0012 | 00012 |
|
|
758
|
+
// | AD 123 | 123 | 23 | 123 | 0123 | 00123 |
|
|
759
|
+
// | AD 1234 | 1234 | 34 | 1234 | 1234 | 01234 |
|
|
760
|
+
// | AD 12345 | 12345 | 45 | 12345 | 12345 | 12345 |
|
|
761
|
+
|
|
762
|
+
var signedYear = date.getUTCFullYear();
|
|
763
|
+
// Returns 1 for 1 BC (which is year 0 in JavaScript)
|
|
764
|
+
var year = signedYear > 0 ? signedYear : 1 - signedYear;
|
|
765
|
+
return addLeadingZeros(token === 'yy' ? year % 100 : year, token.length);
|
|
766
|
+
},
|
|
767
|
+
// Month
|
|
768
|
+
M: function M(date, token) {
|
|
769
|
+
var month = date.getUTCMonth();
|
|
770
|
+
return token === 'M' ? String(month + 1) : addLeadingZeros(month + 1, 2);
|
|
771
|
+
},
|
|
772
|
+
// Day of the month
|
|
773
|
+
d: function d(date, token) {
|
|
774
|
+
return addLeadingZeros(date.getUTCDate(), token.length);
|
|
775
|
+
},
|
|
776
|
+
// AM or PM
|
|
777
|
+
a: function a(date, token) {
|
|
778
|
+
var dayPeriodEnumValue = date.getUTCHours() / 12 >= 1 ? 'pm' : 'am';
|
|
779
|
+
switch (token) {
|
|
780
|
+
case 'a':
|
|
781
|
+
case 'aa':
|
|
782
|
+
return dayPeriodEnumValue.toUpperCase();
|
|
783
|
+
case 'aaa':
|
|
784
|
+
return dayPeriodEnumValue;
|
|
785
|
+
case 'aaaaa':
|
|
786
|
+
return dayPeriodEnumValue[0];
|
|
787
|
+
case 'aaaa':
|
|
788
|
+
default:
|
|
789
|
+
return dayPeriodEnumValue === 'am' ? 'a.m.' : 'p.m.';
|
|
790
|
+
}
|
|
791
|
+
},
|
|
792
|
+
// Hour [1-12]
|
|
793
|
+
h: function h(date, token) {
|
|
794
|
+
return addLeadingZeros(date.getUTCHours() % 12 || 12, token.length);
|
|
795
|
+
},
|
|
796
|
+
// Hour [0-23]
|
|
797
|
+
H: function H(date, token) {
|
|
798
|
+
return addLeadingZeros(date.getUTCHours(), token.length);
|
|
799
|
+
},
|
|
800
|
+
// Minute
|
|
801
|
+
m: function m(date, token) {
|
|
802
|
+
return addLeadingZeros(date.getUTCMinutes(), token.length);
|
|
803
|
+
},
|
|
804
|
+
// Second
|
|
805
|
+
s: function s(date, token) {
|
|
806
|
+
return addLeadingZeros(date.getUTCSeconds(), token.length);
|
|
807
|
+
},
|
|
808
|
+
// Fraction of second
|
|
809
|
+
S: function S(date, token) {
|
|
810
|
+
var numberOfDigits = token.length;
|
|
811
|
+
var milliseconds = date.getUTCMilliseconds();
|
|
812
|
+
var fractionalSeconds = Math.floor(milliseconds * Math.pow(10, numberOfDigits - 3));
|
|
813
|
+
return addLeadingZeros(fractionalSeconds, token.length);
|
|
814
|
+
}
|
|
815
|
+
};
|
|
816
|
+
|
|
817
|
+
var dayPeriodEnum = {
|
|
818
|
+
am: 'am',
|
|
819
|
+
pm: 'pm',
|
|
820
|
+
midnight: 'midnight',
|
|
821
|
+
noon: 'noon',
|
|
822
|
+
morning: 'morning',
|
|
823
|
+
afternoon: 'afternoon',
|
|
824
|
+
evening: 'evening',
|
|
825
|
+
night: 'night'
|
|
826
|
+
};
|
|
827
|
+
/*
|
|
828
|
+
* | | Unit | | Unit |
|
|
829
|
+
* |-----|--------------------------------|-----|--------------------------------|
|
|
830
|
+
* | a | AM, PM | A* | Milliseconds in day |
|
|
831
|
+
* | b | AM, PM, noon, midnight | B | Flexible day period |
|
|
832
|
+
* | c | Stand-alone local day of week | C* | Localized hour w/ day period |
|
|
833
|
+
* | d | Day of month | D | Day of year |
|
|
834
|
+
* | e | Local day of week | E | Day of week |
|
|
835
|
+
* | f | | F* | Day of week in month |
|
|
836
|
+
* | g* | Modified Julian day | G | Era |
|
|
837
|
+
* | h | Hour [1-12] | H | Hour [0-23] |
|
|
838
|
+
* | i! | ISO day of week | I! | ISO week of year |
|
|
839
|
+
* | j* | Localized hour w/ day period | J* | Localized hour w/o day period |
|
|
840
|
+
* | k | Hour [1-24] | K | Hour [0-11] |
|
|
841
|
+
* | l* | (deprecated) | L | Stand-alone month |
|
|
842
|
+
* | m | Minute | M | Month |
|
|
843
|
+
* | n | | N | |
|
|
844
|
+
* | o! | Ordinal number modifier | O | Timezone (GMT) |
|
|
845
|
+
* | p! | Long localized time | P! | Long localized date |
|
|
846
|
+
* | q | Stand-alone quarter | Q | Quarter |
|
|
847
|
+
* | r* | Related Gregorian year | R! | ISO week-numbering year |
|
|
848
|
+
* | s | Second | S | Fraction of second |
|
|
849
|
+
* | t! | Seconds timestamp | T! | Milliseconds timestamp |
|
|
850
|
+
* | u | Extended year | U* | Cyclic year |
|
|
851
|
+
* | v* | Timezone (generic non-locat.) | V* | Timezone (location) |
|
|
852
|
+
* | w | Local week of year | W* | Week of month |
|
|
853
|
+
* | x | Timezone (ISO-8601 w/o Z) | X | Timezone (ISO-8601) |
|
|
854
|
+
* | y | Year (abs) | Y | Local week-numbering year |
|
|
855
|
+
* | z | Timezone (specific non-locat.) | Z* | Timezone (aliases) |
|
|
856
|
+
*
|
|
857
|
+
* Letters marked by * are not implemented but reserved by Unicode standard.
|
|
858
|
+
*
|
|
859
|
+
* Letters marked by ! are non-standard, but implemented by date-fns:
|
|
860
|
+
* - `o` modifies the previous token to turn it into an ordinal (see `format` docs)
|
|
861
|
+
* - `i` is ISO day of week. For `i` and `ii` is returns numeric ISO week days,
|
|
862
|
+
* i.e. 7 for Sunday, 1 for Monday, etc.
|
|
863
|
+
* - `I` is ISO week of year, as opposed to `w` which is local week of year.
|
|
864
|
+
* - `R` is ISO week-numbering year, as opposed to `Y` which is local week-numbering year.
|
|
865
|
+
* `R` is supposed to be used in conjunction with `I` and `i`
|
|
866
|
+
* for universal ISO week-numbering date, whereas
|
|
867
|
+
* `Y` is supposed to be used in conjunction with `w` and `e`
|
|
868
|
+
* for week-numbering date specific to the locale.
|
|
869
|
+
* - `P` is long localized date format
|
|
870
|
+
* - `p` is long localized time format
|
|
871
|
+
*/
|
|
872
|
+
|
|
873
|
+
var formatters = {
|
|
874
|
+
// Era
|
|
875
|
+
G: function G(date, token, localize) {
|
|
876
|
+
var era = date.getUTCFullYear() > 0 ? 1 : 0;
|
|
877
|
+
switch (token) {
|
|
878
|
+
// AD, BC
|
|
879
|
+
case 'G':
|
|
880
|
+
case 'GG':
|
|
881
|
+
case 'GGG':
|
|
882
|
+
return localize.era(era, {
|
|
883
|
+
width: 'abbreviated'
|
|
884
|
+
});
|
|
885
|
+
// A, B
|
|
886
|
+
case 'GGGGG':
|
|
887
|
+
return localize.era(era, {
|
|
888
|
+
width: 'narrow'
|
|
889
|
+
});
|
|
890
|
+
// Anno Domini, Before Christ
|
|
891
|
+
case 'GGGG':
|
|
892
|
+
default:
|
|
893
|
+
return localize.era(era, {
|
|
894
|
+
width: 'wide'
|
|
895
|
+
});
|
|
896
|
+
}
|
|
897
|
+
},
|
|
898
|
+
// Year
|
|
899
|
+
y: function y(date, token, localize) {
|
|
900
|
+
// Ordinal number
|
|
901
|
+
if (token === 'yo') {
|
|
902
|
+
var signedYear = date.getUTCFullYear();
|
|
903
|
+
// Returns 1 for 1 BC (which is year 0 in JavaScript)
|
|
904
|
+
var year = signedYear > 0 ? signedYear : 1 - signedYear;
|
|
905
|
+
return localize.ordinalNumber(year, {
|
|
906
|
+
unit: 'year'
|
|
907
|
+
});
|
|
908
|
+
}
|
|
909
|
+
return formatters$1.y(date, token);
|
|
910
|
+
},
|
|
911
|
+
// Local week-numbering year
|
|
912
|
+
Y: function Y(date, token, localize, options) {
|
|
913
|
+
var signedWeekYear = getUTCWeekYear(date, options);
|
|
914
|
+
// Returns 1 for 1 BC (which is year 0 in JavaScript)
|
|
915
|
+
var weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear;
|
|
916
|
+
|
|
917
|
+
// Two digit year
|
|
918
|
+
if (token === 'YY') {
|
|
919
|
+
var twoDigitYear = weekYear % 100;
|
|
920
|
+
return addLeadingZeros(twoDigitYear, 2);
|
|
921
|
+
}
|
|
922
|
+
|
|
923
|
+
// Ordinal number
|
|
924
|
+
if (token === 'Yo') {
|
|
925
|
+
return localize.ordinalNumber(weekYear, {
|
|
926
|
+
unit: 'year'
|
|
927
|
+
});
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
// Padding
|
|
931
|
+
return addLeadingZeros(weekYear, token.length);
|
|
932
|
+
},
|
|
933
|
+
// ISO week-numbering year
|
|
934
|
+
R: function R(date, token) {
|
|
935
|
+
var isoWeekYear = getUTCISOWeekYear(date);
|
|
936
|
+
|
|
937
|
+
// Padding
|
|
938
|
+
return addLeadingZeros(isoWeekYear, token.length);
|
|
939
|
+
},
|
|
940
|
+
// Extended year. This is a single number designating the year of this calendar system.
|
|
941
|
+
// The main difference between `y` and `u` localizers are B.C. years:
|
|
942
|
+
// | Year | `y` | `u` |
|
|
943
|
+
// |------|-----|-----|
|
|
944
|
+
// | AC 1 | 1 | 1 |
|
|
945
|
+
// | BC 1 | 1 | 0 |
|
|
946
|
+
// | BC 2 | 2 | -1 |
|
|
947
|
+
// Also `yy` always returns the last two digits of a year,
|
|
948
|
+
// while `uu` pads single digit years to 2 characters and returns other years unchanged.
|
|
949
|
+
u: function u(date, token) {
|
|
950
|
+
var year = date.getUTCFullYear();
|
|
951
|
+
return addLeadingZeros(year, token.length);
|
|
952
|
+
},
|
|
953
|
+
// Quarter
|
|
954
|
+
Q: function Q(date, token, localize) {
|
|
955
|
+
var quarter = Math.ceil((date.getUTCMonth() + 1) / 3);
|
|
956
|
+
switch (token) {
|
|
957
|
+
// 1, 2, 3, 4
|
|
958
|
+
case 'Q':
|
|
959
|
+
return String(quarter);
|
|
960
|
+
// 01, 02, 03, 04
|
|
961
|
+
case 'QQ':
|
|
962
|
+
return addLeadingZeros(quarter, 2);
|
|
963
|
+
// 1st, 2nd, 3rd, 4th
|
|
964
|
+
case 'Qo':
|
|
965
|
+
return localize.ordinalNumber(quarter, {
|
|
966
|
+
unit: 'quarter'
|
|
967
|
+
});
|
|
968
|
+
// Q1, Q2, Q3, Q4
|
|
969
|
+
case 'QQQ':
|
|
970
|
+
return localize.quarter(quarter, {
|
|
971
|
+
width: 'abbreviated',
|
|
972
|
+
context: 'formatting'
|
|
973
|
+
});
|
|
974
|
+
// 1, 2, 3, 4 (narrow quarter; could be not numerical)
|
|
975
|
+
case 'QQQQQ':
|
|
976
|
+
return localize.quarter(quarter, {
|
|
977
|
+
width: 'narrow',
|
|
978
|
+
context: 'formatting'
|
|
979
|
+
});
|
|
980
|
+
// 1st quarter, 2nd quarter, ...
|
|
981
|
+
case 'QQQQ':
|
|
982
|
+
default:
|
|
983
|
+
return localize.quarter(quarter, {
|
|
984
|
+
width: 'wide',
|
|
985
|
+
context: 'formatting'
|
|
986
|
+
});
|
|
987
|
+
}
|
|
988
|
+
},
|
|
989
|
+
// Stand-alone quarter
|
|
990
|
+
q: function q(date, token, localize) {
|
|
991
|
+
var quarter = Math.ceil((date.getUTCMonth() + 1) / 3);
|
|
992
|
+
switch (token) {
|
|
993
|
+
// 1, 2, 3, 4
|
|
994
|
+
case 'q':
|
|
995
|
+
return String(quarter);
|
|
996
|
+
// 01, 02, 03, 04
|
|
997
|
+
case 'qq':
|
|
998
|
+
return addLeadingZeros(quarter, 2);
|
|
999
|
+
// 1st, 2nd, 3rd, 4th
|
|
1000
|
+
case 'qo':
|
|
1001
|
+
return localize.ordinalNumber(quarter, {
|
|
1002
|
+
unit: 'quarter'
|
|
1003
|
+
});
|
|
1004
|
+
// Q1, Q2, Q3, Q4
|
|
1005
|
+
case 'qqq':
|
|
1006
|
+
return localize.quarter(quarter, {
|
|
1007
|
+
width: 'abbreviated',
|
|
1008
|
+
context: 'standalone'
|
|
1009
|
+
});
|
|
1010
|
+
// 1, 2, 3, 4 (narrow quarter; could be not numerical)
|
|
1011
|
+
case 'qqqqq':
|
|
1012
|
+
return localize.quarter(quarter, {
|
|
1013
|
+
width: 'narrow',
|
|
1014
|
+
context: 'standalone'
|
|
1015
|
+
});
|
|
1016
|
+
// 1st quarter, 2nd quarter, ...
|
|
1017
|
+
case 'qqqq':
|
|
1018
|
+
default:
|
|
1019
|
+
return localize.quarter(quarter, {
|
|
1020
|
+
width: 'wide',
|
|
1021
|
+
context: 'standalone'
|
|
1022
|
+
});
|
|
1023
|
+
}
|
|
1024
|
+
},
|
|
1025
|
+
// Month
|
|
1026
|
+
M: function M(date, token, localize) {
|
|
1027
|
+
var month = date.getUTCMonth();
|
|
1028
|
+
switch (token) {
|
|
1029
|
+
case 'M':
|
|
1030
|
+
case 'MM':
|
|
1031
|
+
return formatters$1.M(date, token);
|
|
1032
|
+
// 1st, 2nd, ..., 12th
|
|
1033
|
+
case 'Mo':
|
|
1034
|
+
return localize.ordinalNumber(month + 1, {
|
|
1035
|
+
unit: 'month'
|
|
1036
|
+
});
|
|
1037
|
+
// Jan, Feb, ..., Dec
|
|
1038
|
+
case 'MMM':
|
|
1039
|
+
return localize.month(month, {
|
|
1040
|
+
width: 'abbreviated',
|
|
1041
|
+
context: 'formatting'
|
|
1042
|
+
});
|
|
1043
|
+
// J, F, ..., D
|
|
1044
|
+
case 'MMMMM':
|
|
1045
|
+
return localize.month(month, {
|
|
1046
|
+
width: 'narrow',
|
|
1047
|
+
context: 'formatting'
|
|
1048
|
+
});
|
|
1049
|
+
// January, February, ..., December
|
|
1050
|
+
case 'MMMM':
|
|
1051
|
+
default:
|
|
1052
|
+
return localize.month(month, {
|
|
1053
|
+
width: 'wide',
|
|
1054
|
+
context: 'formatting'
|
|
1055
|
+
});
|
|
1056
|
+
}
|
|
1057
|
+
},
|
|
1058
|
+
// Stand-alone month
|
|
1059
|
+
L: function L(date, token, localize) {
|
|
1060
|
+
var month = date.getUTCMonth();
|
|
1061
|
+
switch (token) {
|
|
1062
|
+
// 1, 2, ..., 12
|
|
1063
|
+
case 'L':
|
|
1064
|
+
return String(month + 1);
|
|
1065
|
+
// 01, 02, ..., 12
|
|
1066
|
+
case 'LL':
|
|
1067
|
+
return addLeadingZeros(month + 1, 2);
|
|
1068
|
+
// 1st, 2nd, ..., 12th
|
|
1069
|
+
case 'Lo':
|
|
1070
|
+
return localize.ordinalNumber(month + 1, {
|
|
1071
|
+
unit: 'month'
|
|
1072
|
+
});
|
|
1073
|
+
// Jan, Feb, ..., Dec
|
|
1074
|
+
case 'LLL':
|
|
1075
|
+
return localize.month(month, {
|
|
1076
|
+
width: 'abbreviated',
|
|
1077
|
+
context: 'standalone'
|
|
1078
|
+
});
|
|
1079
|
+
// J, F, ..., D
|
|
1080
|
+
case 'LLLLL':
|
|
1081
|
+
return localize.month(month, {
|
|
1082
|
+
width: 'narrow',
|
|
1083
|
+
context: 'standalone'
|
|
1084
|
+
});
|
|
1085
|
+
// January, February, ..., December
|
|
1086
|
+
case 'LLLL':
|
|
1087
|
+
default:
|
|
1088
|
+
return localize.month(month, {
|
|
1089
|
+
width: 'wide',
|
|
1090
|
+
context: 'standalone'
|
|
1091
|
+
});
|
|
1092
|
+
}
|
|
1093
|
+
},
|
|
1094
|
+
// Local week of year
|
|
1095
|
+
w: function w(date, token, localize, options) {
|
|
1096
|
+
var week = getUTCWeek(date, options);
|
|
1097
|
+
if (token === 'wo') {
|
|
1098
|
+
return localize.ordinalNumber(week, {
|
|
1099
|
+
unit: 'week'
|
|
1100
|
+
});
|
|
1101
|
+
}
|
|
1102
|
+
return addLeadingZeros(week, token.length);
|
|
1103
|
+
},
|
|
1104
|
+
// ISO week of year
|
|
1105
|
+
I: function I(date, token, localize) {
|
|
1106
|
+
var isoWeek = getUTCISOWeek(date);
|
|
1107
|
+
if (token === 'Io') {
|
|
1108
|
+
return localize.ordinalNumber(isoWeek, {
|
|
1109
|
+
unit: 'week'
|
|
1110
|
+
});
|
|
1111
|
+
}
|
|
1112
|
+
return addLeadingZeros(isoWeek, token.length);
|
|
1113
|
+
},
|
|
1114
|
+
// Day of the month
|
|
1115
|
+
d: function d(date, token, localize) {
|
|
1116
|
+
if (token === 'do') {
|
|
1117
|
+
return localize.ordinalNumber(date.getUTCDate(), {
|
|
1118
|
+
unit: 'date'
|
|
1119
|
+
});
|
|
1120
|
+
}
|
|
1121
|
+
return formatters$1.d(date, token);
|
|
1122
|
+
},
|
|
1123
|
+
// Day of year
|
|
1124
|
+
D: function D(date, token, localize) {
|
|
1125
|
+
var dayOfYear = getUTCDayOfYear(date);
|
|
1126
|
+
if (token === 'Do') {
|
|
1127
|
+
return localize.ordinalNumber(dayOfYear, {
|
|
1128
|
+
unit: 'dayOfYear'
|
|
1129
|
+
});
|
|
1130
|
+
}
|
|
1131
|
+
return addLeadingZeros(dayOfYear, token.length);
|
|
1132
|
+
},
|
|
1133
|
+
// Day of week
|
|
1134
|
+
E: function E(date, token, localize) {
|
|
1135
|
+
var dayOfWeek = date.getUTCDay();
|
|
1136
|
+
switch (token) {
|
|
1137
|
+
// Tue
|
|
1138
|
+
case 'E':
|
|
1139
|
+
case 'EE':
|
|
1140
|
+
case 'EEE':
|
|
1141
|
+
return localize.day(dayOfWeek, {
|
|
1142
|
+
width: 'abbreviated',
|
|
1143
|
+
context: 'formatting'
|
|
1144
|
+
});
|
|
1145
|
+
// T
|
|
1146
|
+
case 'EEEEE':
|
|
1147
|
+
return localize.day(dayOfWeek, {
|
|
1148
|
+
width: 'narrow',
|
|
1149
|
+
context: 'formatting'
|
|
1150
|
+
});
|
|
1151
|
+
// Tu
|
|
1152
|
+
case 'EEEEEE':
|
|
1153
|
+
return localize.day(dayOfWeek, {
|
|
1154
|
+
width: 'short',
|
|
1155
|
+
context: 'formatting'
|
|
1156
|
+
});
|
|
1157
|
+
// Tuesday
|
|
1158
|
+
case 'EEEE':
|
|
1159
|
+
default:
|
|
1160
|
+
return localize.day(dayOfWeek, {
|
|
1161
|
+
width: 'wide',
|
|
1162
|
+
context: 'formatting'
|
|
1163
|
+
});
|
|
1164
|
+
}
|
|
1165
|
+
},
|
|
1166
|
+
// Local day of week
|
|
1167
|
+
e: function e(date, token, localize, options) {
|
|
1168
|
+
var dayOfWeek = date.getUTCDay();
|
|
1169
|
+
var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
|
|
1170
|
+
switch (token) {
|
|
1171
|
+
// Numerical value (Nth day of week with current locale or weekStartsOn)
|
|
1172
|
+
case 'e':
|
|
1173
|
+
return String(localDayOfWeek);
|
|
1174
|
+
// Padded numerical value
|
|
1175
|
+
case 'ee':
|
|
1176
|
+
return addLeadingZeros(localDayOfWeek, 2);
|
|
1177
|
+
// 1st, 2nd, ..., 7th
|
|
1178
|
+
case 'eo':
|
|
1179
|
+
return localize.ordinalNumber(localDayOfWeek, {
|
|
1180
|
+
unit: 'day'
|
|
1181
|
+
});
|
|
1182
|
+
case 'eee':
|
|
1183
|
+
return localize.day(dayOfWeek, {
|
|
1184
|
+
width: 'abbreviated',
|
|
1185
|
+
context: 'formatting'
|
|
1186
|
+
});
|
|
1187
|
+
// T
|
|
1188
|
+
case 'eeeee':
|
|
1189
|
+
return localize.day(dayOfWeek, {
|
|
1190
|
+
width: 'narrow',
|
|
1191
|
+
context: 'formatting'
|
|
1192
|
+
});
|
|
1193
|
+
// Tu
|
|
1194
|
+
case 'eeeeee':
|
|
1195
|
+
return localize.day(dayOfWeek, {
|
|
1196
|
+
width: 'short',
|
|
1197
|
+
context: 'formatting'
|
|
1198
|
+
});
|
|
1199
|
+
// Tuesday
|
|
1200
|
+
case 'eeee':
|
|
1201
|
+
default:
|
|
1202
|
+
return localize.day(dayOfWeek, {
|
|
1203
|
+
width: 'wide',
|
|
1204
|
+
context: 'formatting'
|
|
1205
|
+
});
|
|
1206
|
+
}
|
|
1207
|
+
},
|
|
1208
|
+
// Stand-alone local day of week
|
|
1209
|
+
c: function c(date, token, localize, options) {
|
|
1210
|
+
var dayOfWeek = date.getUTCDay();
|
|
1211
|
+
var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
|
|
1212
|
+
switch (token) {
|
|
1213
|
+
// Numerical value (same as in `e`)
|
|
1214
|
+
case 'c':
|
|
1215
|
+
return String(localDayOfWeek);
|
|
1216
|
+
// Padded numerical value
|
|
1217
|
+
case 'cc':
|
|
1218
|
+
return addLeadingZeros(localDayOfWeek, token.length);
|
|
1219
|
+
// 1st, 2nd, ..., 7th
|
|
1220
|
+
case 'co':
|
|
1221
|
+
return localize.ordinalNumber(localDayOfWeek, {
|
|
1222
|
+
unit: 'day'
|
|
1223
|
+
});
|
|
1224
|
+
case 'ccc':
|
|
1225
|
+
return localize.day(dayOfWeek, {
|
|
1226
|
+
width: 'abbreviated',
|
|
1227
|
+
context: 'standalone'
|
|
1228
|
+
});
|
|
1229
|
+
// T
|
|
1230
|
+
case 'ccccc':
|
|
1231
|
+
return localize.day(dayOfWeek, {
|
|
1232
|
+
width: 'narrow',
|
|
1233
|
+
context: 'standalone'
|
|
1234
|
+
});
|
|
1235
|
+
// Tu
|
|
1236
|
+
case 'cccccc':
|
|
1237
|
+
return localize.day(dayOfWeek, {
|
|
1238
|
+
width: 'short',
|
|
1239
|
+
context: 'standalone'
|
|
1240
|
+
});
|
|
1241
|
+
// Tuesday
|
|
1242
|
+
case 'cccc':
|
|
1243
|
+
default:
|
|
1244
|
+
return localize.day(dayOfWeek, {
|
|
1245
|
+
width: 'wide',
|
|
1246
|
+
context: 'standalone'
|
|
1247
|
+
});
|
|
1248
|
+
}
|
|
1249
|
+
},
|
|
1250
|
+
// ISO day of week
|
|
1251
|
+
i: function i(date, token, localize) {
|
|
1252
|
+
var dayOfWeek = date.getUTCDay();
|
|
1253
|
+
var isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek;
|
|
1254
|
+
switch (token) {
|
|
1255
|
+
// 2
|
|
1256
|
+
case 'i':
|
|
1257
|
+
return String(isoDayOfWeek);
|
|
1258
|
+
// 02
|
|
1259
|
+
case 'ii':
|
|
1260
|
+
return addLeadingZeros(isoDayOfWeek, token.length);
|
|
1261
|
+
// 2nd
|
|
1262
|
+
case 'io':
|
|
1263
|
+
return localize.ordinalNumber(isoDayOfWeek, {
|
|
1264
|
+
unit: 'day'
|
|
1265
|
+
});
|
|
1266
|
+
// Tue
|
|
1267
|
+
case 'iii':
|
|
1268
|
+
return localize.day(dayOfWeek, {
|
|
1269
|
+
width: 'abbreviated',
|
|
1270
|
+
context: 'formatting'
|
|
1271
|
+
});
|
|
1272
|
+
// T
|
|
1273
|
+
case 'iiiii':
|
|
1274
|
+
return localize.day(dayOfWeek, {
|
|
1275
|
+
width: 'narrow',
|
|
1276
|
+
context: 'formatting'
|
|
1277
|
+
});
|
|
1278
|
+
// Tu
|
|
1279
|
+
case 'iiiiii':
|
|
1280
|
+
return localize.day(dayOfWeek, {
|
|
1281
|
+
width: 'short',
|
|
1282
|
+
context: 'formatting'
|
|
1283
|
+
});
|
|
1284
|
+
// Tuesday
|
|
1285
|
+
case 'iiii':
|
|
1286
|
+
default:
|
|
1287
|
+
return localize.day(dayOfWeek, {
|
|
1288
|
+
width: 'wide',
|
|
1289
|
+
context: 'formatting'
|
|
1290
|
+
});
|
|
1291
|
+
}
|
|
1292
|
+
},
|
|
1293
|
+
// AM or PM
|
|
1294
|
+
a: function a(date, token, localize) {
|
|
1295
|
+
var hours = date.getUTCHours();
|
|
1296
|
+
var dayPeriodEnumValue = hours / 12 >= 1 ? 'pm' : 'am';
|
|
1297
|
+
switch (token) {
|
|
1298
|
+
case 'a':
|
|
1299
|
+
case 'aa':
|
|
1300
|
+
return localize.dayPeriod(dayPeriodEnumValue, {
|
|
1301
|
+
width: 'abbreviated',
|
|
1302
|
+
context: 'formatting'
|
|
1303
|
+
});
|
|
1304
|
+
case 'aaa':
|
|
1305
|
+
return localize.dayPeriod(dayPeriodEnumValue, {
|
|
1306
|
+
width: 'abbreviated',
|
|
1307
|
+
context: 'formatting'
|
|
1308
|
+
}).toLowerCase();
|
|
1309
|
+
case 'aaaaa':
|
|
1310
|
+
return localize.dayPeriod(dayPeriodEnumValue, {
|
|
1311
|
+
width: 'narrow',
|
|
1312
|
+
context: 'formatting'
|
|
1313
|
+
});
|
|
1314
|
+
case 'aaaa':
|
|
1315
|
+
default:
|
|
1316
|
+
return localize.dayPeriod(dayPeriodEnumValue, {
|
|
1317
|
+
width: 'wide',
|
|
1318
|
+
context: 'formatting'
|
|
1319
|
+
});
|
|
1320
|
+
}
|
|
1321
|
+
},
|
|
1322
|
+
// AM, PM, midnight, noon
|
|
1323
|
+
b: function b(date, token, localize) {
|
|
1324
|
+
var hours = date.getUTCHours();
|
|
1325
|
+
var dayPeriodEnumValue;
|
|
1326
|
+
if (hours === 12) {
|
|
1327
|
+
dayPeriodEnumValue = dayPeriodEnum.noon;
|
|
1328
|
+
} else if (hours === 0) {
|
|
1329
|
+
dayPeriodEnumValue = dayPeriodEnum.midnight;
|
|
1330
|
+
} else {
|
|
1331
|
+
dayPeriodEnumValue = hours / 12 >= 1 ? 'pm' : 'am';
|
|
1332
|
+
}
|
|
1333
|
+
switch (token) {
|
|
1334
|
+
case 'b':
|
|
1335
|
+
case 'bb':
|
|
1336
|
+
return localize.dayPeriod(dayPeriodEnumValue, {
|
|
1337
|
+
width: 'abbreviated',
|
|
1338
|
+
context: 'formatting'
|
|
1339
|
+
});
|
|
1340
|
+
case 'bbb':
|
|
1341
|
+
return localize.dayPeriod(dayPeriodEnumValue, {
|
|
1342
|
+
width: 'abbreviated',
|
|
1343
|
+
context: 'formatting'
|
|
1344
|
+
}).toLowerCase();
|
|
1345
|
+
case 'bbbbb':
|
|
1346
|
+
return localize.dayPeriod(dayPeriodEnumValue, {
|
|
1347
|
+
width: 'narrow',
|
|
1348
|
+
context: 'formatting'
|
|
1349
|
+
});
|
|
1350
|
+
case 'bbbb':
|
|
1351
|
+
default:
|
|
1352
|
+
return localize.dayPeriod(dayPeriodEnumValue, {
|
|
1353
|
+
width: 'wide',
|
|
1354
|
+
context: 'formatting'
|
|
1355
|
+
});
|
|
1356
|
+
}
|
|
1357
|
+
},
|
|
1358
|
+
// in the morning, in the afternoon, in the evening, at night
|
|
1359
|
+
B: function B(date, token, localize) {
|
|
1360
|
+
var hours = date.getUTCHours();
|
|
1361
|
+
var dayPeriodEnumValue;
|
|
1362
|
+
if (hours >= 17) {
|
|
1363
|
+
dayPeriodEnumValue = dayPeriodEnum.evening;
|
|
1364
|
+
} else if (hours >= 12) {
|
|
1365
|
+
dayPeriodEnumValue = dayPeriodEnum.afternoon;
|
|
1366
|
+
} else if (hours >= 4) {
|
|
1367
|
+
dayPeriodEnumValue = dayPeriodEnum.morning;
|
|
1368
|
+
} else {
|
|
1369
|
+
dayPeriodEnumValue = dayPeriodEnum.night;
|
|
1370
|
+
}
|
|
1371
|
+
switch (token) {
|
|
1372
|
+
case 'B':
|
|
1373
|
+
case 'BB':
|
|
1374
|
+
case 'BBB':
|
|
1375
|
+
return localize.dayPeriod(dayPeriodEnumValue, {
|
|
1376
|
+
width: 'abbreviated',
|
|
1377
|
+
context: 'formatting'
|
|
1378
|
+
});
|
|
1379
|
+
case 'BBBBB':
|
|
1380
|
+
return localize.dayPeriod(dayPeriodEnumValue, {
|
|
1381
|
+
width: 'narrow',
|
|
1382
|
+
context: 'formatting'
|
|
1383
|
+
});
|
|
1384
|
+
case 'BBBB':
|
|
1385
|
+
default:
|
|
1386
|
+
return localize.dayPeriod(dayPeriodEnumValue, {
|
|
1387
|
+
width: 'wide',
|
|
1388
|
+
context: 'formatting'
|
|
1389
|
+
});
|
|
1390
|
+
}
|
|
1391
|
+
},
|
|
1392
|
+
// Hour [1-12]
|
|
1393
|
+
h: function h(date, token, localize) {
|
|
1394
|
+
if (token === 'ho') {
|
|
1395
|
+
var hours = date.getUTCHours() % 12;
|
|
1396
|
+
if (hours === 0) hours = 12;
|
|
1397
|
+
return localize.ordinalNumber(hours, {
|
|
1398
|
+
unit: 'hour'
|
|
1399
|
+
});
|
|
1400
|
+
}
|
|
1401
|
+
return formatters$1.h(date, token);
|
|
1402
|
+
},
|
|
1403
|
+
// Hour [0-23]
|
|
1404
|
+
H: function H(date, token, localize) {
|
|
1405
|
+
if (token === 'Ho') {
|
|
1406
|
+
return localize.ordinalNumber(date.getUTCHours(), {
|
|
1407
|
+
unit: 'hour'
|
|
1408
|
+
});
|
|
1409
|
+
}
|
|
1410
|
+
return formatters$1.H(date, token);
|
|
1411
|
+
},
|
|
1412
|
+
// Hour [0-11]
|
|
1413
|
+
K: function K(date, token, localize) {
|
|
1414
|
+
var hours = date.getUTCHours() % 12;
|
|
1415
|
+
if (token === 'Ko') {
|
|
1416
|
+
return localize.ordinalNumber(hours, {
|
|
1417
|
+
unit: 'hour'
|
|
1418
|
+
});
|
|
1419
|
+
}
|
|
1420
|
+
return addLeadingZeros(hours, token.length);
|
|
1421
|
+
},
|
|
1422
|
+
// Hour [1-24]
|
|
1423
|
+
k: function k(date, token, localize) {
|
|
1424
|
+
var hours = date.getUTCHours();
|
|
1425
|
+
if (hours === 0) hours = 24;
|
|
1426
|
+
if (token === 'ko') {
|
|
1427
|
+
return localize.ordinalNumber(hours, {
|
|
1428
|
+
unit: 'hour'
|
|
1429
|
+
});
|
|
1430
|
+
}
|
|
1431
|
+
return addLeadingZeros(hours, token.length);
|
|
1432
|
+
},
|
|
1433
|
+
// Minute
|
|
1434
|
+
m: function m(date, token, localize) {
|
|
1435
|
+
if (token === 'mo') {
|
|
1436
|
+
return localize.ordinalNumber(date.getUTCMinutes(), {
|
|
1437
|
+
unit: 'minute'
|
|
1438
|
+
});
|
|
1439
|
+
}
|
|
1440
|
+
return formatters$1.m(date, token);
|
|
1441
|
+
},
|
|
1442
|
+
// Second
|
|
1443
|
+
s: function s(date, token, localize) {
|
|
1444
|
+
if (token === 'so') {
|
|
1445
|
+
return localize.ordinalNumber(date.getUTCSeconds(), {
|
|
1446
|
+
unit: 'second'
|
|
1447
|
+
});
|
|
1448
|
+
}
|
|
1449
|
+
return formatters$1.s(date, token);
|
|
1450
|
+
},
|
|
1451
|
+
// Fraction of second
|
|
1452
|
+
S: function S(date, token) {
|
|
1453
|
+
return formatters$1.S(date, token);
|
|
1454
|
+
},
|
|
1455
|
+
// Timezone (ISO-8601. If offset is 0, output is always `'Z'`)
|
|
1456
|
+
X: function X(date, token, _localize, options) {
|
|
1457
|
+
var originalDate = options._originalDate || date;
|
|
1458
|
+
var timezoneOffset = originalDate.getTimezoneOffset();
|
|
1459
|
+
if (timezoneOffset === 0) {
|
|
1460
|
+
return 'Z';
|
|
1461
|
+
}
|
|
1462
|
+
switch (token) {
|
|
1463
|
+
// Hours and optional minutes
|
|
1464
|
+
case 'X':
|
|
1465
|
+
return formatTimezoneWithOptionalMinutes(timezoneOffset);
|
|
1466
|
+
|
|
1467
|
+
// Hours, minutes and optional seconds without `:` delimiter
|
|
1468
|
+
// Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
|
|
1469
|
+
// so this token always has the same output as `XX`
|
|
1470
|
+
case 'XXXX':
|
|
1471
|
+
case 'XX':
|
|
1472
|
+
// Hours and minutes without `:` delimiter
|
|
1473
|
+
return formatTimezone(timezoneOffset);
|
|
1474
|
+
|
|
1475
|
+
// Hours, minutes and optional seconds with `:` delimiter
|
|
1476
|
+
// Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
|
|
1477
|
+
// so this token always has the same output as `XXX`
|
|
1478
|
+
case 'XXXXX':
|
|
1479
|
+
case 'XXX': // Hours and minutes with `:` delimiter
|
|
1480
|
+
default:
|
|
1481
|
+
return formatTimezone(timezoneOffset, ':');
|
|
1482
|
+
}
|
|
1483
|
+
},
|
|
1484
|
+
// Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)
|
|
1485
|
+
x: function x(date, token, _localize, options) {
|
|
1486
|
+
var originalDate = options._originalDate || date;
|
|
1487
|
+
var timezoneOffset = originalDate.getTimezoneOffset();
|
|
1488
|
+
switch (token) {
|
|
1489
|
+
// Hours and optional minutes
|
|
1490
|
+
case 'x':
|
|
1491
|
+
return formatTimezoneWithOptionalMinutes(timezoneOffset);
|
|
1492
|
+
|
|
1493
|
+
// Hours, minutes and optional seconds without `:` delimiter
|
|
1494
|
+
// Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
|
|
1495
|
+
// so this token always has the same output as `xx`
|
|
1496
|
+
case 'xxxx':
|
|
1497
|
+
case 'xx':
|
|
1498
|
+
// Hours and minutes without `:` delimiter
|
|
1499
|
+
return formatTimezone(timezoneOffset);
|
|
1500
|
+
|
|
1501
|
+
// Hours, minutes and optional seconds with `:` delimiter
|
|
1502
|
+
// Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
|
|
1503
|
+
// so this token always has the same output as `xxx`
|
|
1504
|
+
case 'xxxxx':
|
|
1505
|
+
case 'xxx': // Hours and minutes with `:` delimiter
|
|
1506
|
+
default:
|
|
1507
|
+
return formatTimezone(timezoneOffset, ':');
|
|
1508
|
+
}
|
|
1509
|
+
},
|
|
1510
|
+
// Timezone (GMT)
|
|
1511
|
+
O: function O(date, token, _localize, options) {
|
|
1512
|
+
var originalDate = options._originalDate || date;
|
|
1513
|
+
var timezoneOffset = originalDate.getTimezoneOffset();
|
|
1514
|
+
switch (token) {
|
|
1515
|
+
// Short
|
|
1516
|
+
case 'O':
|
|
1517
|
+
case 'OO':
|
|
1518
|
+
case 'OOO':
|
|
1519
|
+
return 'GMT' + formatTimezoneShort(timezoneOffset, ':');
|
|
1520
|
+
// Long
|
|
1521
|
+
case 'OOOO':
|
|
1522
|
+
default:
|
|
1523
|
+
return 'GMT' + formatTimezone(timezoneOffset, ':');
|
|
1524
|
+
}
|
|
1525
|
+
},
|
|
1526
|
+
// Timezone (specific non-location)
|
|
1527
|
+
z: function z(date, token, _localize, options) {
|
|
1528
|
+
var originalDate = options._originalDate || date;
|
|
1529
|
+
var timezoneOffset = originalDate.getTimezoneOffset();
|
|
1530
|
+
switch (token) {
|
|
1531
|
+
// Short
|
|
1532
|
+
case 'z':
|
|
1533
|
+
case 'zz':
|
|
1534
|
+
case 'zzz':
|
|
1535
|
+
return 'GMT' + formatTimezoneShort(timezoneOffset, ':');
|
|
1536
|
+
// Long
|
|
1537
|
+
case 'zzzz':
|
|
1538
|
+
default:
|
|
1539
|
+
return 'GMT' + formatTimezone(timezoneOffset, ':');
|
|
1540
|
+
}
|
|
1541
|
+
},
|
|
1542
|
+
// Seconds timestamp
|
|
1543
|
+
t: function t(date, token, _localize, options) {
|
|
1544
|
+
var originalDate = options._originalDate || date;
|
|
1545
|
+
var timestamp = Math.floor(originalDate.getTime() / 1000);
|
|
1546
|
+
return addLeadingZeros(timestamp, token.length);
|
|
1547
|
+
},
|
|
1548
|
+
// Milliseconds timestamp
|
|
1549
|
+
T: function T(date, token, _localize, options) {
|
|
1550
|
+
var originalDate = options._originalDate || date;
|
|
1551
|
+
var timestamp = originalDate.getTime();
|
|
1552
|
+
return addLeadingZeros(timestamp, token.length);
|
|
1553
|
+
}
|
|
1554
|
+
};
|
|
1555
|
+
function formatTimezoneShort(offset, dirtyDelimiter) {
|
|
1556
|
+
var sign = offset > 0 ? '-' : '+';
|
|
1557
|
+
var absOffset = Math.abs(offset);
|
|
1558
|
+
var hours = Math.floor(absOffset / 60);
|
|
1559
|
+
var minutes = absOffset % 60;
|
|
1560
|
+
if (minutes === 0) {
|
|
1561
|
+
return sign + String(hours);
|
|
1562
|
+
}
|
|
1563
|
+
var delimiter = dirtyDelimiter;
|
|
1564
|
+
return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2);
|
|
1565
|
+
}
|
|
1566
|
+
function formatTimezoneWithOptionalMinutes(offset, dirtyDelimiter) {
|
|
1567
|
+
if (offset % 60 === 0) {
|
|
1568
|
+
var sign = offset > 0 ? '-' : '+';
|
|
1569
|
+
return sign + addLeadingZeros(Math.abs(offset) / 60, 2);
|
|
1570
|
+
}
|
|
1571
|
+
return formatTimezone(offset, dirtyDelimiter);
|
|
1572
|
+
}
|
|
1573
|
+
function formatTimezone(offset, dirtyDelimiter) {
|
|
1574
|
+
var delimiter = dirtyDelimiter || '';
|
|
1575
|
+
var sign = offset > 0 ? '-' : '+';
|
|
1576
|
+
var absOffset = Math.abs(offset);
|
|
1577
|
+
var hours = addLeadingZeros(Math.floor(absOffset / 60), 2);
|
|
1578
|
+
var minutes = addLeadingZeros(absOffset % 60, 2);
|
|
1579
|
+
return sign + hours + delimiter + minutes;
|
|
1580
|
+
}
|
|
1581
|
+
|
|
1582
|
+
var dateLongFormatter = function dateLongFormatter(pattern, formatLong) {
|
|
1583
|
+
switch (pattern) {
|
|
1584
|
+
case 'P':
|
|
1585
|
+
return formatLong.date({
|
|
1586
|
+
width: 'short'
|
|
1587
|
+
});
|
|
1588
|
+
case 'PP':
|
|
1589
|
+
return formatLong.date({
|
|
1590
|
+
width: 'medium'
|
|
1591
|
+
});
|
|
1592
|
+
case 'PPP':
|
|
1593
|
+
return formatLong.date({
|
|
1594
|
+
width: 'long'
|
|
1595
|
+
});
|
|
1596
|
+
case 'PPPP':
|
|
1597
|
+
default:
|
|
1598
|
+
return formatLong.date({
|
|
1599
|
+
width: 'full'
|
|
1600
|
+
});
|
|
1601
|
+
}
|
|
1602
|
+
};
|
|
1603
|
+
var timeLongFormatter = function timeLongFormatter(pattern, formatLong) {
|
|
1604
|
+
switch (pattern) {
|
|
1605
|
+
case 'p':
|
|
1606
|
+
return formatLong.time({
|
|
1607
|
+
width: 'short'
|
|
1608
|
+
});
|
|
1609
|
+
case 'pp':
|
|
1610
|
+
return formatLong.time({
|
|
1611
|
+
width: 'medium'
|
|
1612
|
+
});
|
|
1613
|
+
case 'ppp':
|
|
1614
|
+
return formatLong.time({
|
|
1615
|
+
width: 'long'
|
|
1616
|
+
});
|
|
1617
|
+
case 'pppp':
|
|
1618
|
+
default:
|
|
1619
|
+
return formatLong.time({
|
|
1620
|
+
width: 'full'
|
|
1621
|
+
});
|
|
1622
|
+
}
|
|
1623
|
+
};
|
|
1624
|
+
var dateTimeLongFormatter = function dateTimeLongFormatter(pattern, formatLong) {
|
|
1625
|
+
var matchResult = pattern.match(/(P+)(p+)?/) || [];
|
|
1626
|
+
var datePattern = matchResult[1];
|
|
1627
|
+
var timePattern = matchResult[2];
|
|
1628
|
+
if (!timePattern) {
|
|
1629
|
+
return dateLongFormatter(pattern, formatLong);
|
|
1630
|
+
}
|
|
1631
|
+
var dateTimeFormat;
|
|
1632
|
+
switch (datePattern) {
|
|
1633
|
+
case 'P':
|
|
1634
|
+
dateTimeFormat = formatLong.dateTime({
|
|
1635
|
+
width: 'short'
|
|
1636
|
+
});
|
|
1637
|
+
break;
|
|
1638
|
+
case 'PP':
|
|
1639
|
+
dateTimeFormat = formatLong.dateTime({
|
|
1640
|
+
width: 'medium'
|
|
1641
|
+
});
|
|
1642
|
+
break;
|
|
1643
|
+
case 'PPP':
|
|
1644
|
+
dateTimeFormat = formatLong.dateTime({
|
|
1645
|
+
width: 'long'
|
|
1646
|
+
});
|
|
1647
|
+
break;
|
|
1648
|
+
case 'PPPP':
|
|
1649
|
+
default:
|
|
1650
|
+
dateTimeFormat = formatLong.dateTime({
|
|
1651
|
+
width: 'full'
|
|
1652
|
+
});
|
|
1653
|
+
break;
|
|
1654
|
+
}
|
|
1655
|
+
return dateTimeFormat.replace('{{date}}', dateLongFormatter(datePattern, formatLong)).replace('{{time}}', timeLongFormatter(timePattern, formatLong));
|
|
1656
|
+
};
|
|
1657
|
+
var longFormatters = {
|
|
1658
|
+
p: timeLongFormatter,
|
|
1659
|
+
P: dateTimeLongFormatter
|
|
1660
|
+
};
|
|
1661
|
+
|
|
1662
|
+
var protectedDayOfYearTokens = ['D', 'DD'];
|
|
1663
|
+
var protectedWeekYearTokens = ['YY', 'YYYY'];
|
|
1664
|
+
function isProtectedDayOfYearToken(token) {
|
|
1665
|
+
return protectedDayOfYearTokens.indexOf(token) !== -1;
|
|
1666
|
+
}
|
|
1667
|
+
function isProtectedWeekYearToken(token) {
|
|
1668
|
+
return protectedWeekYearTokens.indexOf(token) !== -1;
|
|
1669
|
+
}
|
|
1670
|
+
function throwProtectedError(token, format, input) {
|
|
1671
|
+
if (token === 'YYYY') {
|
|
1672
|
+
throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(format, "`) for formatting years to the input `").concat(input, "`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));
|
|
1673
|
+
} else if (token === 'YY') {
|
|
1674
|
+
throw new RangeError("Use `yy` instead of `YY` (in `".concat(format, "`) for formatting years to the input `").concat(input, "`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));
|
|
1675
|
+
} else if (token === 'D') {
|
|
1676
|
+
throw new RangeError("Use `d` instead of `D` (in `".concat(format, "`) for formatting days of the month to the input `").concat(input, "`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));
|
|
1677
|
+
} else if (token === 'DD') {
|
|
1678
|
+
throw new RangeError("Use `dd` instead of `DD` (in `".concat(format, "`) for formatting days of the month to the input `").concat(input, "`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));
|
|
1679
|
+
}
|
|
1680
|
+
}
|
|
1681
|
+
|
|
1682
|
+
var formatDistanceLocale = {
|
|
1683
|
+
lessThanXSeconds: {
|
|
1684
|
+
one: 'less than a second',
|
|
1685
|
+
other: 'less than {{count}} seconds'
|
|
1686
|
+
},
|
|
1687
|
+
xSeconds: {
|
|
1688
|
+
one: '1 second',
|
|
1689
|
+
other: '{{count}} seconds'
|
|
1690
|
+
},
|
|
1691
|
+
halfAMinute: 'half a minute',
|
|
1692
|
+
lessThanXMinutes: {
|
|
1693
|
+
one: 'less than a minute',
|
|
1694
|
+
other: 'less than {{count}} minutes'
|
|
1695
|
+
},
|
|
1696
|
+
xMinutes: {
|
|
1697
|
+
one: '1 minute',
|
|
1698
|
+
other: '{{count}} minutes'
|
|
1699
|
+
},
|
|
1700
|
+
aboutXHours: {
|
|
1701
|
+
one: 'about 1 hour',
|
|
1702
|
+
other: 'about {{count}} hours'
|
|
1703
|
+
},
|
|
1704
|
+
xHours: {
|
|
1705
|
+
one: '1 hour',
|
|
1706
|
+
other: '{{count}} hours'
|
|
1707
|
+
},
|
|
1708
|
+
xDays: {
|
|
1709
|
+
one: '1 day',
|
|
1710
|
+
other: '{{count}} days'
|
|
1711
|
+
},
|
|
1712
|
+
aboutXWeeks: {
|
|
1713
|
+
one: 'about 1 week',
|
|
1714
|
+
other: 'about {{count}} weeks'
|
|
1715
|
+
},
|
|
1716
|
+
xWeeks: {
|
|
1717
|
+
one: '1 week',
|
|
1718
|
+
other: '{{count}} weeks'
|
|
1719
|
+
},
|
|
1720
|
+
aboutXMonths: {
|
|
1721
|
+
one: 'about 1 month',
|
|
1722
|
+
other: 'about {{count}} months'
|
|
1723
|
+
},
|
|
1724
|
+
xMonths: {
|
|
1725
|
+
one: '1 month',
|
|
1726
|
+
other: '{{count}} months'
|
|
1727
|
+
},
|
|
1728
|
+
aboutXYears: {
|
|
1729
|
+
one: 'about 1 year',
|
|
1730
|
+
other: 'about {{count}} years'
|
|
1731
|
+
},
|
|
1732
|
+
xYears: {
|
|
1733
|
+
one: '1 year',
|
|
1734
|
+
other: '{{count}} years'
|
|
1735
|
+
},
|
|
1736
|
+
overXYears: {
|
|
1737
|
+
one: 'over 1 year',
|
|
1738
|
+
other: 'over {{count}} years'
|
|
1739
|
+
},
|
|
1740
|
+
almostXYears: {
|
|
1741
|
+
one: 'almost 1 year',
|
|
1742
|
+
other: 'almost {{count}} years'
|
|
1743
|
+
}
|
|
1744
|
+
};
|
|
1745
|
+
var formatDistance = function formatDistance(token, count, options) {
|
|
1746
|
+
var result;
|
|
1747
|
+
var tokenValue = formatDistanceLocale[token];
|
|
1748
|
+
if (typeof tokenValue === 'string') {
|
|
1749
|
+
result = tokenValue;
|
|
1750
|
+
} else if (count === 1) {
|
|
1751
|
+
result = tokenValue.one;
|
|
1752
|
+
} else {
|
|
1753
|
+
result = tokenValue.other.replace('{{count}}', count.toString());
|
|
1754
|
+
}
|
|
1755
|
+
if (options !== null && options !== void 0 && options.addSuffix) {
|
|
1756
|
+
if (options.comparison && options.comparison > 0) {
|
|
1757
|
+
return 'in ' + result;
|
|
1758
|
+
} else {
|
|
1759
|
+
return result + ' ago';
|
|
1760
|
+
}
|
|
1761
|
+
}
|
|
1762
|
+
return result;
|
|
1763
|
+
};
|
|
1764
|
+
|
|
1765
|
+
function buildFormatLongFn(args) {
|
|
1766
|
+
return function () {
|
|
1767
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1768
|
+
// TODO: Remove String()
|
|
1769
|
+
var width = options.width ? String(options.width) : args.defaultWidth;
|
|
1770
|
+
var format = args.formats[width] || args.formats[args.defaultWidth];
|
|
1771
|
+
return format;
|
|
1772
|
+
};
|
|
1773
|
+
}
|
|
1774
|
+
|
|
1775
|
+
var dateFormats = {
|
|
1776
|
+
full: 'EEEE, MMMM do, y',
|
|
1777
|
+
long: 'MMMM do, y',
|
|
1778
|
+
medium: 'MMM d, y',
|
|
1779
|
+
short: 'MM/dd/yyyy'
|
|
1780
|
+
};
|
|
1781
|
+
var timeFormats = {
|
|
1782
|
+
full: 'h:mm:ss a zzzz',
|
|
1783
|
+
long: 'h:mm:ss a z',
|
|
1784
|
+
medium: 'h:mm:ss a',
|
|
1785
|
+
short: 'h:mm a'
|
|
1786
|
+
};
|
|
1787
|
+
var dateTimeFormats = {
|
|
1788
|
+
full: "{{date}} 'at' {{time}}",
|
|
1789
|
+
long: "{{date}} 'at' {{time}}",
|
|
1790
|
+
medium: '{{date}}, {{time}}',
|
|
1791
|
+
short: '{{date}}, {{time}}'
|
|
1792
|
+
};
|
|
1793
|
+
var formatLong = {
|
|
1794
|
+
date: buildFormatLongFn({
|
|
1795
|
+
formats: dateFormats,
|
|
1796
|
+
defaultWidth: 'full'
|
|
1797
|
+
}),
|
|
1798
|
+
time: buildFormatLongFn({
|
|
1799
|
+
formats: timeFormats,
|
|
1800
|
+
defaultWidth: 'full'
|
|
1801
|
+
}),
|
|
1802
|
+
dateTime: buildFormatLongFn({
|
|
1803
|
+
formats: dateTimeFormats,
|
|
1804
|
+
defaultWidth: 'full'
|
|
1805
|
+
})
|
|
1806
|
+
};
|
|
1807
|
+
|
|
1808
|
+
var formatRelativeLocale = {
|
|
1809
|
+
lastWeek: "'last' eeee 'at' p",
|
|
1810
|
+
yesterday: "'yesterday at' p",
|
|
1811
|
+
today: "'today at' p",
|
|
1812
|
+
tomorrow: "'tomorrow at' p",
|
|
1813
|
+
nextWeek: "eeee 'at' p",
|
|
1814
|
+
other: 'P'
|
|
1815
|
+
};
|
|
1816
|
+
var formatRelative = function formatRelative(token, _date, _baseDate, _options) {
|
|
1817
|
+
return formatRelativeLocale[token];
|
|
1818
|
+
};
|
|
1819
|
+
|
|
1820
|
+
function buildLocalizeFn(args) {
|
|
1821
|
+
return function (dirtyIndex, options) {
|
|
1822
|
+
var context = options !== null && options !== void 0 && options.context ? String(options.context) : 'standalone';
|
|
1823
|
+
var valuesArray;
|
|
1824
|
+
if (context === 'formatting' && args.formattingValues) {
|
|
1825
|
+
var defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
|
|
1826
|
+
var width = options !== null && options !== void 0 && options.width ? String(options.width) : defaultWidth;
|
|
1827
|
+
valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth];
|
|
1828
|
+
} else {
|
|
1829
|
+
var _defaultWidth = args.defaultWidth;
|
|
1830
|
+
var _width = options !== null && options !== void 0 && options.width ? String(options.width) : args.defaultWidth;
|
|
1831
|
+
valuesArray = args.values[_width] || args.values[_defaultWidth];
|
|
1832
|
+
}
|
|
1833
|
+
var index = args.argumentCallback ? args.argumentCallback(dirtyIndex) : dirtyIndex;
|
|
1834
|
+
// @ts-ignore: For some reason TypeScript just don't want to match it, no matter how hard we try. I challenge you to try to remove it!
|
|
1835
|
+
return valuesArray[index];
|
|
1836
|
+
};
|
|
1837
|
+
}
|
|
1838
|
+
|
|
1839
|
+
var eraValues = {
|
|
1840
|
+
narrow: ['B', 'A'],
|
|
1841
|
+
abbreviated: ['BC', 'AD'],
|
|
1842
|
+
wide: ['Before Christ', 'Anno Domini']
|
|
1843
|
+
};
|
|
1844
|
+
var quarterValues = {
|
|
1845
|
+
narrow: ['1', '2', '3', '4'],
|
|
1846
|
+
abbreviated: ['Q1', 'Q2', 'Q3', 'Q4'],
|
|
1847
|
+
wide: ['1st quarter', '2nd quarter', '3rd quarter', '4th quarter']
|
|
1848
|
+
};
|
|
1849
|
+
|
|
1850
|
+
// Note: in English, the names of days of the week and months are capitalized.
|
|
1851
|
+
// If you are making a new locale based on this one, check if the same is true for the language you're working on.
|
|
1852
|
+
// Generally, formatted dates should look like they are in the middle of a sentence,
|
|
1853
|
+
// e.g. in Spanish language the weekdays and months should be in the lowercase.
|
|
1854
|
+
var monthValues = {
|
|
1855
|
+
narrow: ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'],
|
|
1856
|
+
abbreviated: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
|
|
1857
|
+
wide: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
|
|
1858
|
+
};
|
|
1859
|
+
var dayValues = {
|
|
1860
|
+
narrow: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],
|
|
1861
|
+
short: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
|
|
1862
|
+
abbreviated: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
|
|
1863
|
+
wide: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
|
|
1864
|
+
};
|
|
1865
|
+
var dayPeriodValues = {
|
|
1866
|
+
narrow: {
|
|
1867
|
+
am: 'a',
|
|
1868
|
+
pm: 'p',
|
|
1869
|
+
midnight: 'mi',
|
|
1870
|
+
noon: 'n',
|
|
1871
|
+
morning: 'morning',
|
|
1872
|
+
afternoon: 'afternoon',
|
|
1873
|
+
evening: 'evening',
|
|
1874
|
+
night: 'night'
|
|
1875
|
+
},
|
|
1876
|
+
abbreviated: {
|
|
1877
|
+
am: 'AM',
|
|
1878
|
+
pm: 'PM',
|
|
1879
|
+
midnight: 'midnight',
|
|
1880
|
+
noon: 'noon',
|
|
1881
|
+
morning: 'morning',
|
|
1882
|
+
afternoon: 'afternoon',
|
|
1883
|
+
evening: 'evening',
|
|
1884
|
+
night: 'night'
|
|
1885
|
+
},
|
|
1886
|
+
wide: {
|
|
1887
|
+
am: 'a.m.',
|
|
1888
|
+
pm: 'p.m.',
|
|
1889
|
+
midnight: 'midnight',
|
|
1890
|
+
noon: 'noon',
|
|
1891
|
+
morning: 'morning',
|
|
1892
|
+
afternoon: 'afternoon',
|
|
1893
|
+
evening: 'evening',
|
|
1894
|
+
night: 'night'
|
|
1895
|
+
}
|
|
1896
|
+
};
|
|
1897
|
+
var formattingDayPeriodValues = {
|
|
1898
|
+
narrow: {
|
|
1899
|
+
am: 'a',
|
|
1900
|
+
pm: 'p',
|
|
1901
|
+
midnight: 'mi',
|
|
1902
|
+
noon: 'n',
|
|
1903
|
+
morning: 'in the morning',
|
|
1904
|
+
afternoon: 'in the afternoon',
|
|
1905
|
+
evening: 'in the evening',
|
|
1906
|
+
night: 'at night'
|
|
1907
|
+
},
|
|
1908
|
+
abbreviated: {
|
|
1909
|
+
am: 'AM',
|
|
1910
|
+
pm: 'PM',
|
|
1911
|
+
midnight: 'midnight',
|
|
1912
|
+
noon: 'noon',
|
|
1913
|
+
morning: 'in the morning',
|
|
1914
|
+
afternoon: 'in the afternoon',
|
|
1915
|
+
evening: 'in the evening',
|
|
1916
|
+
night: 'at night'
|
|
1917
|
+
},
|
|
1918
|
+
wide: {
|
|
1919
|
+
am: 'a.m.',
|
|
1920
|
+
pm: 'p.m.',
|
|
1921
|
+
midnight: 'midnight',
|
|
1922
|
+
noon: 'noon',
|
|
1923
|
+
morning: 'in the morning',
|
|
1924
|
+
afternoon: 'in the afternoon',
|
|
1925
|
+
evening: 'in the evening',
|
|
1926
|
+
night: 'at night'
|
|
1927
|
+
}
|
|
1928
|
+
};
|
|
1929
|
+
var ordinalNumber = function ordinalNumber(dirtyNumber, _options) {
|
|
1930
|
+
var number = Number(dirtyNumber);
|
|
1931
|
+
|
|
1932
|
+
// If ordinal numbers depend on context, for example,
|
|
1933
|
+
// if they are different for different grammatical genders,
|
|
1934
|
+
// use `options.unit`.
|
|
1935
|
+
//
|
|
1936
|
+
// `unit` can be 'year', 'quarter', 'month', 'week', 'date', 'dayOfYear',
|
|
1937
|
+
// 'day', 'hour', 'minute', 'second'.
|
|
1938
|
+
|
|
1939
|
+
var rem100 = number % 100;
|
|
1940
|
+
if (rem100 > 20 || rem100 < 10) {
|
|
1941
|
+
switch (rem100 % 10) {
|
|
1942
|
+
case 1:
|
|
1943
|
+
return number + 'st';
|
|
1944
|
+
case 2:
|
|
1945
|
+
return number + 'nd';
|
|
1946
|
+
case 3:
|
|
1947
|
+
return number + 'rd';
|
|
1948
|
+
}
|
|
1949
|
+
}
|
|
1950
|
+
return number + 'th';
|
|
1951
|
+
};
|
|
1952
|
+
var localize = {
|
|
1953
|
+
ordinalNumber: ordinalNumber,
|
|
1954
|
+
era: buildLocalizeFn({
|
|
1955
|
+
values: eraValues,
|
|
1956
|
+
defaultWidth: 'wide'
|
|
1957
|
+
}),
|
|
1958
|
+
quarter: buildLocalizeFn({
|
|
1959
|
+
values: quarterValues,
|
|
1960
|
+
defaultWidth: 'wide',
|
|
1961
|
+
argumentCallback: function argumentCallback(quarter) {
|
|
1962
|
+
return quarter - 1;
|
|
1963
|
+
}
|
|
1964
|
+
}),
|
|
1965
|
+
month: buildLocalizeFn({
|
|
1966
|
+
values: monthValues,
|
|
1967
|
+
defaultWidth: 'wide'
|
|
1968
|
+
}),
|
|
1969
|
+
day: buildLocalizeFn({
|
|
1970
|
+
values: dayValues,
|
|
1971
|
+
defaultWidth: 'wide'
|
|
1972
|
+
}),
|
|
1973
|
+
dayPeriod: buildLocalizeFn({
|
|
1974
|
+
values: dayPeriodValues,
|
|
1975
|
+
defaultWidth: 'wide',
|
|
1976
|
+
formattingValues: formattingDayPeriodValues,
|
|
1977
|
+
defaultFormattingWidth: 'wide'
|
|
1978
|
+
})
|
|
1979
|
+
};
|
|
1980
|
+
|
|
1981
|
+
function buildMatchFn(args) {
|
|
1982
|
+
return function (string) {
|
|
1983
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1984
|
+
var width = options.width;
|
|
1985
|
+
var matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];
|
|
1986
|
+
var matchResult = string.match(matchPattern);
|
|
1987
|
+
if (!matchResult) {
|
|
1988
|
+
return null;
|
|
1989
|
+
}
|
|
1990
|
+
var matchedString = matchResult[0];
|
|
1991
|
+
var parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth];
|
|
1992
|
+
var key = Array.isArray(parsePatterns) ? findIndex(parsePatterns, function (pattern) {
|
|
1993
|
+
return pattern.test(matchedString);
|
|
1994
|
+
}) : findKey(parsePatterns, function (pattern) {
|
|
1995
|
+
return pattern.test(matchedString);
|
|
1996
|
+
});
|
|
1997
|
+
var value;
|
|
1998
|
+
value = args.valueCallback ? args.valueCallback(key) : key;
|
|
1999
|
+
value = options.valueCallback ? options.valueCallback(value) : value;
|
|
2000
|
+
var rest = string.slice(matchedString.length);
|
|
2001
|
+
return {
|
|
2002
|
+
value: value,
|
|
2003
|
+
rest: rest
|
|
2004
|
+
};
|
|
2005
|
+
};
|
|
2006
|
+
}
|
|
2007
|
+
function findKey(object, predicate) {
|
|
2008
|
+
for (var key in object) {
|
|
2009
|
+
if (object.hasOwnProperty(key) && predicate(object[key])) {
|
|
2010
|
+
return key;
|
|
2011
|
+
}
|
|
2012
|
+
}
|
|
2013
|
+
return undefined;
|
|
2014
|
+
}
|
|
2015
|
+
function findIndex(array, predicate) {
|
|
2016
|
+
for (var key = 0; key < array.length; key++) {
|
|
2017
|
+
if (predicate(array[key])) {
|
|
2018
|
+
return key;
|
|
2019
|
+
}
|
|
2020
|
+
}
|
|
2021
|
+
return undefined;
|
|
2022
|
+
}
|
|
2023
|
+
|
|
2024
|
+
function buildMatchPatternFn(args) {
|
|
2025
|
+
return function (string) {
|
|
2026
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
2027
|
+
var matchResult = string.match(args.matchPattern);
|
|
2028
|
+
if (!matchResult) return null;
|
|
2029
|
+
var matchedString = matchResult[0];
|
|
2030
|
+
var parseResult = string.match(args.parsePattern);
|
|
2031
|
+
if (!parseResult) return null;
|
|
2032
|
+
var value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];
|
|
2033
|
+
value = options.valueCallback ? options.valueCallback(value) : value;
|
|
2034
|
+
var rest = string.slice(matchedString.length);
|
|
2035
|
+
return {
|
|
2036
|
+
value: value,
|
|
2037
|
+
rest: rest
|
|
2038
|
+
};
|
|
2039
|
+
};
|
|
2040
|
+
}
|
|
2041
|
+
|
|
2042
|
+
var matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i;
|
|
2043
|
+
var parseOrdinalNumberPattern = /\d+/i;
|
|
2044
|
+
var matchEraPatterns = {
|
|
2045
|
+
narrow: /^(b|a)/i,
|
|
2046
|
+
abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
|
|
2047
|
+
wide: /^(before christ|before common era|anno domini|common era)/i
|
|
2048
|
+
};
|
|
2049
|
+
var parseEraPatterns = {
|
|
2050
|
+
any: [/^b/i, /^(a|c)/i]
|
|
2051
|
+
};
|
|
2052
|
+
var matchQuarterPatterns = {
|
|
2053
|
+
narrow: /^[1234]/i,
|
|
2054
|
+
abbreviated: /^q[1234]/i,
|
|
2055
|
+
wide: /^[1234](th|st|nd|rd)? quarter/i
|
|
2056
|
+
};
|
|
2057
|
+
var parseQuarterPatterns = {
|
|
2058
|
+
any: [/1/i, /2/i, /3/i, /4/i]
|
|
2059
|
+
};
|
|
2060
|
+
var matchMonthPatterns = {
|
|
2061
|
+
narrow: /^[jfmasond]/i,
|
|
2062
|
+
abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
|
|
2063
|
+
wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
|
|
2064
|
+
};
|
|
2065
|
+
var parseMonthPatterns = {
|
|
2066
|
+
narrow: [/^j/i, /^f/i, /^m/i, /^a/i, /^m/i, /^j/i, /^j/i, /^a/i, /^s/i, /^o/i, /^n/i, /^d/i],
|
|
2067
|
+
any: [/^ja/i, /^f/i, /^mar/i, /^ap/i, /^may/i, /^jun/i, /^jul/i, /^au/i, /^s/i, /^o/i, /^n/i, /^d/i]
|
|
2068
|
+
};
|
|
2069
|
+
var matchDayPatterns = {
|
|
2070
|
+
narrow: /^[smtwf]/i,
|
|
2071
|
+
short: /^(su|mo|tu|we|th|fr|sa)/i,
|
|
2072
|
+
abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
|
|
2073
|
+
wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
|
|
2074
|
+
};
|
|
2075
|
+
var parseDayPatterns = {
|
|
2076
|
+
narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
|
|
2077
|
+
any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
|
|
2078
|
+
};
|
|
2079
|
+
var matchDayPeriodPatterns = {
|
|
2080
|
+
narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
|
|
2081
|
+
any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
|
|
2082
|
+
};
|
|
2083
|
+
var parseDayPeriodPatterns = {
|
|
2084
|
+
any: {
|
|
2085
|
+
am: /^a/i,
|
|
2086
|
+
pm: /^p/i,
|
|
2087
|
+
midnight: /^mi/i,
|
|
2088
|
+
noon: /^no/i,
|
|
2089
|
+
morning: /morning/i,
|
|
2090
|
+
afternoon: /afternoon/i,
|
|
2091
|
+
evening: /evening/i,
|
|
2092
|
+
night: /night/i
|
|
2093
|
+
}
|
|
2094
|
+
};
|
|
2095
|
+
var match = {
|
|
2096
|
+
ordinalNumber: buildMatchPatternFn({
|
|
2097
|
+
matchPattern: matchOrdinalNumberPattern,
|
|
2098
|
+
parsePattern: parseOrdinalNumberPattern,
|
|
2099
|
+
valueCallback: function valueCallback(value) {
|
|
2100
|
+
return parseInt(value, 10);
|
|
2101
|
+
}
|
|
2102
|
+
}),
|
|
2103
|
+
era: buildMatchFn({
|
|
2104
|
+
matchPatterns: matchEraPatterns,
|
|
2105
|
+
defaultMatchWidth: 'wide',
|
|
2106
|
+
parsePatterns: parseEraPatterns,
|
|
2107
|
+
defaultParseWidth: 'any'
|
|
2108
|
+
}),
|
|
2109
|
+
quarter: buildMatchFn({
|
|
2110
|
+
matchPatterns: matchQuarterPatterns,
|
|
2111
|
+
defaultMatchWidth: 'wide',
|
|
2112
|
+
parsePatterns: parseQuarterPatterns,
|
|
2113
|
+
defaultParseWidth: 'any',
|
|
2114
|
+
valueCallback: function valueCallback(index) {
|
|
2115
|
+
return index + 1;
|
|
2116
|
+
}
|
|
2117
|
+
}),
|
|
2118
|
+
month: buildMatchFn({
|
|
2119
|
+
matchPatterns: matchMonthPatterns,
|
|
2120
|
+
defaultMatchWidth: 'wide',
|
|
2121
|
+
parsePatterns: parseMonthPatterns,
|
|
2122
|
+
defaultParseWidth: 'any'
|
|
2123
|
+
}),
|
|
2124
|
+
day: buildMatchFn({
|
|
2125
|
+
matchPatterns: matchDayPatterns,
|
|
2126
|
+
defaultMatchWidth: 'wide',
|
|
2127
|
+
parsePatterns: parseDayPatterns,
|
|
2128
|
+
defaultParseWidth: 'any'
|
|
2129
|
+
}),
|
|
2130
|
+
dayPeriod: buildMatchFn({
|
|
2131
|
+
matchPatterns: matchDayPeriodPatterns,
|
|
2132
|
+
defaultMatchWidth: 'any',
|
|
2133
|
+
parsePatterns: parseDayPeriodPatterns,
|
|
2134
|
+
defaultParseWidth: 'any'
|
|
2135
|
+
})
|
|
2136
|
+
};
|
|
2137
|
+
|
|
2138
|
+
/**
|
|
2139
|
+
* @type {Locale}
|
|
2140
|
+
* @category Locales
|
|
2141
|
+
* @summary English locale (United States).
|
|
2142
|
+
* @language English
|
|
2143
|
+
* @iso-639-2 eng
|
|
2144
|
+
* @author Sasha Koss [@kossnocorp]{@link https://github.com/kossnocorp}
|
|
2145
|
+
* @author Lesha Koss [@leshakoss]{@link https://github.com/leshakoss}
|
|
2146
|
+
*/
|
|
2147
|
+
var locale = {
|
|
2148
|
+
code: 'en-US',
|
|
2149
|
+
formatDistance: formatDistance,
|
|
2150
|
+
formatLong: formatLong,
|
|
2151
|
+
formatRelative: formatRelative,
|
|
2152
|
+
localize: localize,
|
|
2153
|
+
match: match,
|
|
2154
|
+
options: {
|
|
2155
|
+
weekStartsOn: 0 /* Sunday */,
|
|
2156
|
+
firstWeekContainsDate: 1
|
|
2157
|
+
}
|
|
2158
|
+
};
|
|
2159
|
+
|
|
2160
|
+
// - [yYQqMLwIdDecihHKkms]o matches any available ordinal number token
|
|
2161
|
+
// (one of the certain letters followed by `o`)
|
|
2162
|
+
// - (\w)\1* matches any sequences of the same letter
|
|
2163
|
+
// - '' matches two quote characters in a row
|
|
2164
|
+
// - '(''|[^'])+('|$) matches anything surrounded by two quote characters ('),
|
|
2165
|
+
// except a single quote symbol, which ends the sequence.
|
|
2166
|
+
// Two quote characters do not end the sequence.
|
|
2167
|
+
// If there is no matching single quote
|
|
2168
|
+
// then the sequence will continue until the end of the string.
|
|
2169
|
+
// - . matches any single character unmatched by previous parts of the RegExps
|
|
2170
|
+
var formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;
|
|
2171
|
+
|
|
2172
|
+
// This RegExp catches symbols escaped by quotes, and also
|
|
2173
|
+
// sequences of symbols P, p, and the combinations like `PPPPPPPppppp`
|
|
2174
|
+
var longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
|
|
2175
|
+
var escapedStringRegExp = /^'([^]*?)'?$/;
|
|
2176
|
+
var doubleQuoteRegExp = /''/g;
|
|
2177
|
+
var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
|
|
2178
|
+
|
|
2179
|
+
/**
|
|
2180
|
+
* @name format
|
|
2181
|
+
* @category Common Helpers
|
|
2182
|
+
* @summary Format the date.
|
|
2183
|
+
*
|
|
2184
|
+
* @description
|
|
2185
|
+
* Return the formatted date string in the given format. The result may vary by locale.
|
|
2186
|
+
*
|
|
2187
|
+
* > ⚠️ Please note that the `format` tokens differ from Moment.js and other libraries.
|
|
2188
|
+
* > See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
|
|
2189
|
+
*
|
|
2190
|
+
* The characters wrapped between two single quotes characters (') are escaped.
|
|
2191
|
+
* Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote.
|
|
2192
|
+
* (see the last example)
|
|
2193
|
+
*
|
|
2194
|
+
* Format of the string is based on Unicode Technical Standard #35:
|
|
2195
|
+
* https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
|
|
2196
|
+
* with a few additions (see note 7 below the table).
|
|
2197
|
+
*
|
|
2198
|
+
* Accepted patterns:
|
|
2199
|
+
* | Unit | Pattern | Result examples | Notes |
|
|
2200
|
+
* |---------------------------------|---------|-----------------------------------|-------|
|
|
2201
|
+
* | Era | G..GGG | AD, BC | |
|
|
2202
|
+
* | | GGGG | Anno Domini, Before Christ | 2 |
|
|
2203
|
+
* | | GGGGG | A, B | |
|
|
2204
|
+
* | Calendar year | y | 44, 1, 1900, 2017 | 5 |
|
|
2205
|
+
* | | yo | 44th, 1st, 0th, 17th | 5,7 |
|
|
2206
|
+
* | | yy | 44, 01, 00, 17 | 5 |
|
|
2207
|
+
* | | yyy | 044, 001, 1900, 2017 | 5 |
|
|
2208
|
+
* | | yyyy | 0044, 0001, 1900, 2017 | 5 |
|
|
2209
|
+
* | | yyyyy | ... | 3,5 |
|
|
2210
|
+
* | Local week-numbering year | Y | 44, 1, 1900, 2017 | 5 |
|
|
2211
|
+
* | | Yo | 44th, 1st, 1900th, 2017th | 5,7 |
|
|
2212
|
+
* | | YY | 44, 01, 00, 17 | 5,8 |
|
|
2213
|
+
* | | YYY | 044, 001, 1900, 2017 | 5 |
|
|
2214
|
+
* | | YYYY | 0044, 0001, 1900, 2017 | 5,8 |
|
|
2215
|
+
* | | YYYYY | ... | 3,5 |
|
|
2216
|
+
* | ISO week-numbering year | R | -43, 0, 1, 1900, 2017 | 5,7 |
|
|
2217
|
+
* | | RR | -43, 00, 01, 1900, 2017 | 5,7 |
|
|
2218
|
+
* | | RRR | -043, 000, 001, 1900, 2017 | 5,7 |
|
|
2219
|
+
* | | RRRR | -0043, 0000, 0001, 1900, 2017 | 5,7 |
|
|
2220
|
+
* | | RRRRR | ... | 3,5,7 |
|
|
2221
|
+
* | Extended year | u | -43, 0, 1, 1900, 2017 | 5 |
|
|
2222
|
+
* | | uu | -43, 01, 1900, 2017 | 5 |
|
|
2223
|
+
* | | uuu | -043, 001, 1900, 2017 | 5 |
|
|
2224
|
+
* | | uuuu | -0043, 0001, 1900, 2017 | 5 |
|
|
2225
|
+
* | | uuuuu | ... | 3,5 |
|
|
2226
|
+
* | Quarter (formatting) | Q | 1, 2, 3, 4 | |
|
|
2227
|
+
* | | Qo | 1st, 2nd, 3rd, 4th | 7 |
|
|
2228
|
+
* | | QQ | 01, 02, 03, 04 | |
|
|
2229
|
+
* | | QQQ | Q1, Q2, Q3, Q4 | |
|
|
2230
|
+
* | | QQQQ | 1st quarter, 2nd quarter, ... | 2 |
|
|
2231
|
+
* | | QQQQQ | 1, 2, 3, 4 | 4 |
|
|
2232
|
+
* | Quarter (stand-alone) | q | 1, 2, 3, 4 | |
|
|
2233
|
+
* | | qo | 1st, 2nd, 3rd, 4th | 7 |
|
|
2234
|
+
* | | qq | 01, 02, 03, 04 | |
|
|
2235
|
+
* | | qqq | Q1, Q2, Q3, Q4 | |
|
|
2236
|
+
* | | qqqq | 1st quarter, 2nd quarter, ... | 2 |
|
|
2237
|
+
* | | qqqqq | 1, 2, 3, 4 | 4 |
|
|
2238
|
+
* | Month (formatting) | M | 1, 2, ..., 12 | |
|
|
2239
|
+
* | | Mo | 1st, 2nd, ..., 12th | 7 |
|
|
2240
|
+
* | | MM | 01, 02, ..., 12 | |
|
|
2241
|
+
* | | MMM | Jan, Feb, ..., Dec | |
|
|
2242
|
+
* | | MMMM | January, February, ..., December | 2 |
|
|
2243
|
+
* | | MMMMM | J, F, ..., D | |
|
|
2244
|
+
* | Month (stand-alone) | L | 1, 2, ..., 12 | |
|
|
2245
|
+
* | | Lo | 1st, 2nd, ..., 12th | 7 |
|
|
2246
|
+
* | | LL | 01, 02, ..., 12 | |
|
|
2247
|
+
* | | LLL | Jan, Feb, ..., Dec | |
|
|
2248
|
+
* | | LLLL | January, February, ..., December | 2 |
|
|
2249
|
+
* | | LLLLL | J, F, ..., D | |
|
|
2250
|
+
* | Local week of year | w | 1, 2, ..., 53 | |
|
|
2251
|
+
* | | wo | 1st, 2nd, ..., 53th | 7 |
|
|
2252
|
+
* | | ww | 01, 02, ..., 53 | |
|
|
2253
|
+
* | ISO week of year | I | 1, 2, ..., 53 | 7 |
|
|
2254
|
+
* | | Io | 1st, 2nd, ..., 53th | 7 |
|
|
2255
|
+
* | | II | 01, 02, ..., 53 | 7 |
|
|
2256
|
+
* | Day of month | d | 1, 2, ..., 31 | |
|
|
2257
|
+
* | | do | 1st, 2nd, ..., 31st | 7 |
|
|
2258
|
+
* | | dd | 01, 02, ..., 31 | |
|
|
2259
|
+
* | Day of year | D | 1, 2, ..., 365, 366 | 9 |
|
|
2260
|
+
* | | Do | 1st, 2nd, ..., 365th, 366th | 7 |
|
|
2261
|
+
* | | DD | 01, 02, ..., 365, 366 | 9 |
|
|
2262
|
+
* | | DDD | 001, 002, ..., 365, 366 | |
|
|
2263
|
+
* | | DDDD | ... | 3 |
|
|
2264
|
+
* | Day of week (formatting) | E..EEE | Mon, Tue, Wed, ..., Sun | |
|
|
2265
|
+
* | | EEEE | Monday, Tuesday, ..., Sunday | 2 |
|
|
2266
|
+
* | | EEEEE | M, T, W, T, F, S, S | |
|
|
2267
|
+
* | | EEEEEE | Mo, Tu, We, Th, Fr, Sa, Su | |
|
|
2268
|
+
* | ISO day of week (formatting) | i | 1, 2, 3, ..., 7 | 7 |
|
|
2269
|
+
* | | io | 1st, 2nd, ..., 7th | 7 |
|
|
2270
|
+
* | | ii | 01, 02, ..., 07 | 7 |
|
|
2271
|
+
* | | iii | Mon, Tue, Wed, ..., Sun | 7 |
|
|
2272
|
+
* | | iiii | Monday, Tuesday, ..., Sunday | 2,7 |
|
|
2273
|
+
* | | iiiii | M, T, W, T, F, S, S | 7 |
|
|
2274
|
+
* | | iiiiii | Mo, Tu, We, Th, Fr, Sa, Su | 7 |
|
|
2275
|
+
* | Local day of week (formatting) | e | 2, 3, 4, ..., 1 | |
|
|
2276
|
+
* | | eo | 2nd, 3rd, ..., 1st | 7 |
|
|
2277
|
+
* | | ee | 02, 03, ..., 01 | |
|
|
2278
|
+
* | | eee | Mon, Tue, Wed, ..., Sun | |
|
|
2279
|
+
* | | eeee | Monday, Tuesday, ..., Sunday | 2 |
|
|
2280
|
+
* | | eeeee | M, T, W, T, F, S, S | |
|
|
2281
|
+
* | | eeeeee | Mo, Tu, We, Th, Fr, Sa, Su | |
|
|
2282
|
+
* | Local day of week (stand-alone) | c | 2, 3, 4, ..., 1 | |
|
|
2283
|
+
* | | co | 2nd, 3rd, ..., 1st | 7 |
|
|
2284
|
+
* | | cc | 02, 03, ..., 01 | |
|
|
2285
|
+
* | | ccc | Mon, Tue, Wed, ..., Sun | |
|
|
2286
|
+
* | | cccc | Monday, Tuesday, ..., Sunday | 2 |
|
|
2287
|
+
* | | ccccc | M, T, W, T, F, S, S | |
|
|
2288
|
+
* | | cccccc | Mo, Tu, We, Th, Fr, Sa, Su | |
|
|
2289
|
+
* | AM, PM | a..aa | AM, PM | |
|
|
2290
|
+
* | | aaa | am, pm | |
|
|
2291
|
+
* | | aaaa | a.m., p.m. | 2 |
|
|
2292
|
+
* | | aaaaa | a, p | |
|
|
2293
|
+
* | AM, PM, noon, midnight | b..bb | AM, PM, noon, midnight | |
|
|
2294
|
+
* | | bbb | am, pm, noon, midnight | |
|
|
2295
|
+
* | | bbbb | a.m., p.m., noon, midnight | 2 |
|
|
2296
|
+
* | | bbbbb | a, p, n, mi | |
|
|
2297
|
+
* | Flexible day period | B..BBB | at night, in the morning, ... | |
|
|
2298
|
+
* | | BBBB | at night, in the morning, ... | 2 |
|
|
2299
|
+
* | | BBBBB | at night, in the morning, ... | |
|
|
2300
|
+
* | Hour [1-12] | h | 1, 2, ..., 11, 12 | |
|
|
2301
|
+
* | | ho | 1st, 2nd, ..., 11th, 12th | 7 |
|
|
2302
|
+
* | | hh | 01, 02, ..., 11, 12 | |
|
|
2303
|
+
* | Hour [0-23] | H | 0, 1, 2, ..., 23 | |
|
|
2304
|
+
* | | Ho | 0th, 1st, 2nd, ..., 23rd | 7 |
|
|
2305
|
+
* | | HH | 00, 01, 02, ..., 23 | |
|
|
2306
|
+
* | Hour [0-11] | K | 1, 2, ..., 11, 0 | |
|
|
2307
|
+
* | | Ko | 1st, 2nd, ..., 11th, 0th | 7 |
|
|
2308
|
+
* | | KK | 01, 02, ..., 11, 00 | |
|
|
2309
|
+
* | Hour [1-24] | k | 24, 1, 2, ..., 23 | |
|
|
2310
|
+
* | | ko | 24th, 1st, 2nd, ..., 23rd | 7 |
|
|
2311
|
+
* | | kk | 24, 01, 02, ..., 23 | |
|
|
2312
|
+
* | Minute | m | 0, 1, ..., 59 | |
|
|
2313
|
+
* | | mo | 0th, 1st, ..., 59th | 7 |
|
|
2314
|
+
* | | mm | 00, 01, ..., 59 | |
|
|
2315
|
+
* | Second | s | 0, 1, ..., 59 | |
|
|
2316
|
+
* | | so | 0th, 1st, ..., 59th | 7 |
|
|
2317
|
+
* | | ss | 00, 01, ..., 59 | |
|
|
2318
|
+
* | Fraction of second | S | 0, 1, ..., 9 | |
|
|
2319
|
+
* | | SS | 00, 01, ..., 99 | |
|
|
2320
|
+
* | | SSS | 000, 001, ..., 999 | |
|
|
2321
|
+
* | | SSSS | ... | 3 |
|
|
2322
|
+
* | Timezone (ISO-8601 w/ Z) | X | -08, +0530, Z | |
|
|
2323
|
+
* | | XX | -0800, +0530, Z | |
|
|
2324
|
+
* | | XXX | -08:00, +05:30, Z | |
|
|
2325
|
+
* | | XXXX | -0800, +0530, Z, +123456 | 2 |
|
|
2326
|
+
* | | XXXXX | -08:00, +05:30, Z, +12:34:56 | |
|
|
2327
|
+
* | Timezone (ISO-8601 w/o Z) | x | -08, +0530, +00 | |
|
|
2328
|
+
* | | xx | -0800, +0530, +0000 | |
|
|
2329
|
+
* | | xxx | -08:00, +05:30, +00:00 | 2 |
|
|
2330
|
+
* | | xxxx | -0800, +0530, +0000, +123456 | |
|
|
2331
|
+
* | | xxxxx | -08:00, +05:30, +00:00, +12:34:56 | |
|
|
2332
|
+
* | Timezone (GMT) | O...OOO | GMT-8, GMT+5:30, GMT+0 | |
|
|
2333
|
+
* | | OOOO | GMT-08:00, GMT+05:30, GMT+00:00 | 2 |
|
|
2334
|
+
* | Timezone (specific non-locat.) | z...zzz | GMT-8, GMT+5:30, GMT+0 | 6 |
|
|
2335
|
+
* | | zzzz | GMT-08:00, GMT+05:30, GMT+00:00 | 2,6 |
|
|
2336
|
+
* | Seconds timestamp | t | 512969520 | 7 |
|
|
2337
|
+
* | | tt | ... | 3,7 |
|
|
2338
|
+
* | Milliseconds timestamp | T | 512969520900 | 7 |
|
|
2339
|
+
* | | TT | ... | 3,7 |
|
|
2340
|
+
* | Long localized date | P | 04/29/1453 | 7 |
|
|
2341
|
+
* | | PP | Apr 29, 1453 | 7 |
|
|
2342
|
+
* | | PPP | April 29th, 1453 | 7 |
|
|
2343
|
+
* | | PPPP | Friday, April 29th, 1453 | 2,7 |
|
|
2344
|
+
* | Long localized time | p | 12:00 AM | 7 |
|
|
2345
|
+
* | | pp | 12:00:00 AM | 7 |
|
|
2346
|
+
* | | ppp | 12:00:00 AM GMT+2 | 7 |
|
|
2347
|
+
* | | pppp | 12:00:00 AM GMT+02:00 | 2,7 |
|
|
2348
|
+
* | Combination of date and time | Pp | 04/29/1453, 12:00 AM | 7 |
|
|
2349
|
+
* | | PPpp | Apr 29, 1453, 12:00:00 AM | 7 |
|
|
2350
|
+
* | | PPPppp | April 29th, 1453 at ... | 7 |
|
|
2351
|
+
* | | PPPPpppp| Friday, April 29th, 1453 at ... | 2,7 |
|
|
2352
|
+
* Notes:
|
|
2353
|
+
* 1. "Formatting" units (e.g. formatting quarter) in the default en-US locale
|
|
2354
|
+
* are the same as "stand-alone" units, but are different in some languages.
|
|
2355
|
+
* "Formatting" units are declined according to the rules of the language
|
|
2356
|
+
* in the context of a date. "Stand-alone" units are always nominative singular:
|
|
2357
|
+
*
|
|
2358
|
+
* `format(new Date(2017, 10, 6), 'do LLLL', {locale: cs}) //=> '6. listopad'`
|
|
2359
|
+
*
|
|
2360
|
+
* `format(new Date(2017, 10, 6), 'do MMMM', {locale: cs}) //=> '6. listopadu'`
|
|
2361
|
+
*
|
|
2362
|
+
* 2. Any sequence of the identical letters is a pattern, unless it is escaped by
|
|
2363
|
+
* the single quote characters (see below).
|
|
2364
|
+
* If the sequence is longer than listed in table (e.g. `EEEEEEEEEEE`)
|
|
2365
|
+
* the output will be the same as default pattern for this unit, usually
|
|
2366
|
+
* the longest one (in case of ISO weekdays, `EEEE`). Default patterns for units
|
|
2367
|
+
* are marked with "2" in the last column of the table.
|
|
2368
|
+
*
|
|
2369
|
+
* `format(new Date(2017, 10, 6), 'MMM') //=> 'Nov'`
|
|
2370
|
+
*
|
|
2371
|
+
* `format(new Date(2017, 10, 6), 'MMMM') //=> 'November'`
|
|
2372
|
+
*
|
|
2373
|
+
* `format(new Date(2017, 10, 6), 'MMMMM') //=> 'N'`
|
|
2374
|
+
*
|
|
2375
|
+
* `format(new Date(2017, 10, 6), 'MMMMMM') //=> 'November'`
|
|
2376
|
+
*
|
|
2377
|
+
* `format(new Date(2017, 10, 6), 'MMMMMMM') //=> 'November'`
|
|
2378
|
+
*
|
|
2379
|
+
* 3. Some patterns could be unlimited length (such as `yyyyyyyy`).
|
|
2380
|
+
* The output will be padded with zeros to match the length of the pattern.
|
|
2381
|
+
*
|
|
2382
|
+
* `format(new Date(2017, 10, 6), 'yyyyyyyy') //=> '00002017'`
|
|
2383
|
+
*
|
|
2384
|
+
* 4. `QQQQQ` and `qqqqq` could be not strictly numerical in some locales.
|
|
2385
|
+
* These tokens represent the shortest form of the quarter.
|
|
2386
|
+
*
|
|
2387
|
+
* 5. The main difference between `y` and `u` patterns are B.C. years:
|
|
2388
|
+
*
|
|
2389
|
+
* | Year | `y` | `u` |
|
|
2390
|
+
* |------|-----|-----|
|
|
2391
|
+
* | AC 1 | 1 | 1 |
|
|
2392
|
+
* | BC 1 | 1 | 0 |
|
|
2393
|
+
* | BC 2 | 2 | -1 |
|
|
2394
|
+
*
|
|
2395
|
+
* Also `yy` always returns the last two digits of a year,
|
|
2396
|
+
* while `uu` pads single digit years to 2 characters and returns other years unchanged:
|
|
2397
|
+
*
|
|
2398
|
+
* | Year | `yy` | `uu` |
|
|
2399
|
+
* |------|------|------|
|
|
2400
|
+
* | 1 | 01 | 01 |
|
|
2401
|
+
* | 14 | 14 | 14 |
|
|
2402
|
+
* | 376 | 76 | 376 |
|
|
2403
|
+
* | 1453 | 53 | 1453 |
|
|
2404
|
+
*
|
|
2405
|
+
* The same difference is true for local and ISO week-numbering years (`Y` and `R`),
|
|
2406
|
+
* except local week-numbering years are dependent on `options.weekStartsOn`
|
|
2407
|
+
* and `options.firstWeekContainsDate` (compare [getISOWeekYear]{@link https://date-fns.org/docs/getISOWeekYear}
|
|
2408
|
+
* and [getWeekYear]{@link https://date-fns.org/docs/getWeekYear}).
|
|
2409
|
+
*
|
|
2410
|
+
* 6. Specific non-location timezones are currently unavailable in `date-fns`,
|
|
2411
|
+
* so right now these tokens fall back to GMT timezones.
|
|
2412
|
+
*
|
|
2413
|
+
* 7. These patterns are not in the Unicode Technical Standard #35:
|
|
2414
|
+
* - `i`: ISO day of week
|
|
2415
|
+
* - `I`: ISO week of year
|
|
2416
|
+
* - `R`: ISO week-numbering year
|
|
2417
|
+
* - `t`: seconds timestamp
|
|
2418
|
+
* - `T`: milliseconds timestamp
|
|
2419
|
+
* - `o`: ordinal number modifier
|
|
2420
|
+
* - `P`: long localized date
|
|
2421
|
+
* - `p`: long localized time
|
|
2422
|
+
*
|
|
2423
|
+
* 8. `YY` and `YYYY` tokens represent week-numbering years but they are often confused with years.
|
|
2424
|
+
* You should enable `options.useAdditionalWeekYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
|
|
2425
|
+
*
|
|
2426
|
+
* 9. `D` and `DD` tokens represent days of the year but they are often confused with days of the month.
|
|
2427
|
+
* You should enable `options.useAdditionalDayOfYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
|
|
2428
|
+
*
|
|
2429
|
+
* @param {Date|Number} date - the original date
|
|
2430
|
+
* @param {String} format - the string of tokens
|
|
2431
|
+
* @param {Object} [options] - an object with options.
|
|
2432
|
+
* @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}
|
|
2433
|
+
* @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)
|
|
2434
|
+
* @param {Number} [options.firstWeekContainsDate=1] - the day of January, which is
|
|
2435
|
+
* @param {Boolean} [options.useAdditionalWeekYearTokens=false] - if true, allows usage of the week-numbering year tokens `YY` and `YYYY`;
|
|
2436
|
+
* see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
|
|
2437
|
+
* @param {Boolean} [options.useAdditionalDayOfYearTokens=false] - if true, allows usage of the day of year tokens `D` and `DD`;
|
|
2438
|
+
* see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
|
|
2439
|
+
* @returns {String} the formatted date string
|
|
2440
|
+
* @throws {TypeError} 2 arguments required
|
|
2441
|
+
* @throws {RangeError} `date` must not be Invalid Date
|
|
2442
|
+
* @throws {RangeError} `options.locale` must contain `localize` property
|
|
2443
|
+
* @throws {RangeError} `options.locale` must contain `formatLong` property
|
|
2444
|
+
* @throws {RangeError} `options.weekStartsOn` must be between 0 and 6
|
|
2445
|
+
* @throws {RangeError} `options.firstWeekContainsDate` must be between 1 and 7
|
|
2446
|
+
* @throws {RangeError} use `yyyy` instead of `YYYY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
|
|
2447
|
+
* @throws {RangeError} use `yy` instead of `YY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
|
|
2448
|
+
* @throws {RangeError} use `d` instead of `D` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
|
|
2449
|
+
* @throws {RangeError} use `dd` instead of `DD` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
|
|
2450
|
+
* @throws {RangeError} format string contains an unescaped latin alphabet character
|
|
2451
|
+
*
|
|
2452
|
+
* @example
|
|
2453
|
+
* // Represent 11 February 2014 in middle-endian format:
|
|
2454
|
+
* const result = format(new Date(2014, 1, 11), 'MM/dd/yyyy')
|
|
2455
|
+
* //=> '02/11/2014'
|
|
2456
|
+
*
|
|
2457
|
+
* @example
|
|
2458
|
+
* // Represent 2 July 2014 in Esperanto:
|
|
2459
|
+
* import { eoLocale } from 'date-fns/locale/eo'
|
|
2460
|
+
* const result = format(new Date(2014, 6, 2), "do 'de' MMMM yyyy", {
|
|
2461
|
+
* locale: eoLocale
|
|
2462
|
+
* })
|
|
2463
|
+
* //=> '2-a de julio 2014'
|
|
2464
|
+
*
|
|
2465
|
+
* @example
|
|
2466
|
+
* // Escape string by single quote characters:
|
|
2467
|
+
* const result = format(new Date(2014, 6, 2, 15), "h 'o''clock'")
|
|
2468
|
+
* //=> "3 o'clock"
|
|
2469
|
+
*/
|
|
2470
|
+
|
|
2471
|
+
function format(dirtyDate, dirtyFormatStr, options) {
|
|
2472
|
+
var _ref, _options$locale, _ref2, _ref3, _ref4, _options$firstWeekCon, _defaultOptions$local, _defaultOptions$local2, _ref5, _ref6, _ref7, _options$weekStartsOn, _defaultOptions$local3, _defaultOptions$local4;
|
|
2473
|
+
requiredArgs(2, arguments);
|
|
2474
|
+
var formatStr = String(dirtyFormatStr);
|
|
2475
|
+
var defaultOptions = getDefaultOptions();
|
|
2476
|
+
var locale$1 = (_ref = (_options$locale = void 0 ) !== null && _options$locale !== void 0 ? _options$locale : defaultOptions.locale) !== null && _ref !== void 0 ? _ref : locale;
|
|
2477
|
+
var firstWeekContainsDate = toInteger((_ref2 = (_ref3 = (_ref4 = (_options$firstWeekCon = void 0 ) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : void 0 ) !== null && _ref4 !== void 0 ? _ref4 : defaultOptions.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : 1);
|
|
2478
|
+
|
|
2479
|
+
// Test if weekStartsOn is between 1 and 7 _and_ is not NaN
|
|
2480
|
+
if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {
|
|
2481
|
+
throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');
|
|
2482
|
+
}
|
|
2483
|
+
var weekStartsOn = toInteger((_ref5 = (_ref6 = (_ref7 = (_options$weekStartsOn = void 0 ) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : void 0 ) !== null && _ref7 !== void 0 ? _ref7 : defaultOptions.weekStartsOn) !== null && _ref6 !== void 0 ? _ref6 : (_defaultOptions$local3 = defaultOptions.locale) === null || _defaultOptions$local3 === void 0 ? void 0 : (_defaultOptions$local4 = _defaultOptions$local3.options) === null || _defaultOptions$local4 === void 0 ? void 0 : _defaultOptions$local4.weekStartsOn) !== null && _ref5 !== void 0 ? _ref5 : 0);
|
|
2484
|
+
|
|
2485
|
+
// Test if weekStartsOn is between 0 and 6 _and_ is not NaN
|
|
2486
|
+
if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
|
|
2487
|
+
throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
|
|
2488
|
+
}
|
|
2489
|
+
if (!locale$1.localize) {
|
|
2490
|
+
throw new RangeError('locale must contain localize property');
|
|
2491
|
+
}
|
|
2492
|
+
if (!locale$1.formatLong) {
|
|
2493
|
+
throw new RangeError('locale must contain formatLong property');
|
|
2494
|
+
}
|
|
2495
|
+
var originalDate = toDate(dirtyDate);
|
|
2496
|
+
if (!isValid(originalDate)) {
|
|
2497
|
+
throw new RangeError('Invalid time value');
|
|
2498
|
+
}
|
|
2499
|
+
|
|
2500
|
+
// Convert the date in system timezone to the same date in UTC+00:00 timezone.
|
|
2501
|
+
// This ensures that when UTC functions will be implemented, locales will be compatible with them.
|
|
2502
|
+
// See an issue about UTC functions: https://github.com/date-fns/date-fns/issues/376
|
|
2503
|
+
var timezoneOffset = getTimezoneOffsetInMilliseconds(originalDate);
|
|
2504
|
+
var utcDate = subMilliseconds(originalDate, timezoneOffset);
|
|
2505
|
+
var formatterOptions = {
|
|
2506
|
+
firstWeekContainsDate: firstWeekContainsDate,
|
|
2507
|
+
weekStartsOn: weekStartsOn,
|
|
2508
|
+
locale: locale$1,
|
|
2509
|
+
_originalDate: originalDate
|
|
2510
|
+
};
|
|
2511
|
+
var result = formatStr.match(longFormattingTokensRegExp).map(function (substring) {
|
|
2512
|
+
var firstCharacter = substring[0];
|
|
2513
|
+
if (firstCharacter === 'p' || firstCharacter === 'P') {
|
|
2514
|
+
var longFormatter = longFormatters[firstCharacter];
|
|
2515
|
+
return longFormatter(substring, locale$1.formatLong);
|
|
2516
|
+
}
|
|
2517
|
+
return substring;
|
|
2518
|
+
}).join('').match(formattingTokensRegExp).map(function (substring) {
|
|
2519
|
+
// Replace two single quote characters with one single quote character
|
|
2520
|
+
if (substring === "''") {
|
|
2521
|
+
return "'";
|
|
2522
|
+
}
|
|
2523
|
+
var firstCharacter = substring[0];
|
|
2524
|
+
if (firstCharacter === "'") {
|
|
2525
|
+
return cleanEscapedString(substring);
|
|
2526
|
+
}
|
|
2527
|
+
var formatter = formatters[firstCharacter];
|
|
2528
|
+
if (formatter) {
|
|
2529
|
+
if (isProtectedWeekYearToken(substring)) {
|
|
2530
|
+
throwProtectedError(substring, dirtyFormatStr, String(dirtyDate));
|
|
2531
|
+
}
|
|
2532
|
+
if (isProtectedDayOfYearToken(substring)) {
|
|
2533
|
+
throwProtectedError(substring, dirtyFormatStr, String(dirtyDate));
|
|
2534
|
+
}
|
|
2535
|
+
return formatter(utcDate, substring, locale$1.localize, formatterOptions);
|
|
2536
|
+
}
|
|
2537
|
+
if (firstCharacter.match(unescapedLatinCharacterRegExp)) {
|
|
2538
|
+
throw new RangeError('Format string contains an unescaped latin alphabet character `' + firstCharacter + '`');
|
|
2539
|
+
}
|
|
2540
|
+
return substring;
|
|
2541
|
+
}).join('');
|
|
2542
|
+
return result;
|
|
2543
|
+
}
|
|
2544
|
+
function cleanEscapedString(input) {
|
|
2545
|
+
var matched = input.match(escapedStringRegExp);
|
|
2546
|
+
if (!matched) {
|
|
2547
|
+
return input;
|
|
2548
|
+
}
|
|
2549
|
+
return matched[1].replace(doubleQuoteRegExp, "'");
|
|
2550
|
+
}
|
|
2551
|
+
|
|
2552
|
+
var styles$6 = {"labelDate":"FeaturePost-module_labelDate__NXOgY","authorContent":"FeaturePost-module_authorContent__FEuRO","googlePlayButtonWrapper":"FeaturePost-module_googlePlayButtonWrapper__GI-ag","imgWrapper":"FeaturePost-module_imgWrapper__r6omd","featurePost":"FeaturePost-module_featurePost__9jY21","featurePostReversed":"FeaturePost-module_featurePostReversed__WQRXm","contentContainer":"FeaturePost-module_contentContainer__kdus7","col":"FeaturePost-module_col__eW8gY"};
|
|
2553
|
+
|
|
2554
|
+
var Image = function (_a) {
|
|
2555
|
+
var sources = _a.sources, props = __rest(_a, ["sources"]);
|
|
2556
|
+
return (React.createElement("div", { className: styles$6.imgWrapper },
|
|
2557
|
+
React.createElement(Image$2.Image, __assign({ fadeOnLoad: true }, props), sources &&
|
|
2558
|
+
sources.map(function (source) { return (React.createElement(Image$2.Image.Source, __assign({ key: source.srcSet }, source))); }))));
|
|
2559
|
+
};
|
|
2560
|
+
|
|
2561
|
+
var VideoPlayer = React.lazy(function () {
|
|
2562
|
+
return import('@arc-ui/components/dist/VideoPlayer').then(function (_a) {
|
|
2563
|
+
var VideoPlayer = _a.VideoPlayer;
|
|
2564
|
+
return ({
|
|
2565
|
+
default: VideoPlayer,
|
|
2566
|
+
});
|
|
2567
|
+
});
|
|
2568
|
+
});
|
|
2569
|
+
var MediaContent = function (_a) {
|
|
2570
|
+
var image = _a.image, video = _a.video;
|
|
2571
|
+
var _b = React.useState(false), isClient = _b[0], setIsClient = _b[1];
|
|
2572
|
+
React.useEffect(function () {
|
|
2573
|
+
setIsClient(true);
|
|
2574
|
+
}, []);
|
|
2575
|
+
return (React.createElement(React.Fragment, null,
|
|
2576
|
+
image && !video && React.createElement(Image, __assign({}, image)),
|
|
2577
|
+
video && isClient && (React.createElement(React.Suspense, { fallback: null },
|
|
2578
|
+
React.createElement(VideoPlayer, __assign({}, video))))));
|
|
2579
|
+
};
|
|
2580
|
+
|
|
2581
|
+
/**
|
|
2582
|
+
* Use `FeaturePost` to direct traffic towards an article, case study, or product information page, or to a 3rd part App Store provider. Where the component links to an article page, the author attribution can be given here. The `FeaturePost` must be supported by an image, and in future, the component will support embedded video as well.
|
|
2583
|
+
* */
|
|
2584
|
+
var FeaturePost = function (_a) {
|
|
2585
|
+
var _b;
|
|
2586
|
+
var heading = _a.heading, _c = _a.headingLevel, headingLevel = _c === void 0 ? "2" : _c, label = _a.label, image = _a.image, content = _a.content, footer = _a.footer, video = _a.video, _d = _a.isReverseOrder, isReverseOrder = _d === void 0 ? false : _d, props = __rest(_a, ["heading", "headingLevel", "label", "image", "content", "footer", "video", "isReverseOrder"]);
|
|
2587
|
+
var isMinWidthArcBreakpointM = useMediaQuery.useMediaQuery("(min-width: ".concat(ArcSizeBreakpointsM, ")"));
|
|
2588
|
+
return (React.createElement("div", __assign({ "data-testid": "feature-post", className: classNames(styles$6.featurePost, (_b = {},
|
|
2589
|
+
_b[styles$6.featurePostReversed] = isReverseOrder,
|
|
2590
|
+
_b)) }, filterDataAttrs(props)),
|
|
2591
|
+
React.createElement("div", { className: styles$6.col },
|
|
2592
|
+
React.createElement("div", { className: styles$6.contentContainer },
|
|
2593
|
+
label && (React.createElement(Grid.Grid, { isGutterless: true, isFluid: true },
|
|
2594
|
+
React.createElement(Grid.Grid.Row, { align: "baseline" },
|
|
2595
|
+
React.createElement(Grid.Grid.Col, { xs: 12, m: "auto" },
|
|
2596
|
+
React.createElement(Heading.Heading, { size: "xxs" }, label.text.toUpperCase())),
|
|
2597
|
+
React.createElement(Grid.Grid.Col, { xs: 12, m: "auto" },
|
|
2598
|
+
React.createElement("div", { className: styles$6.labelDate },
|
|
2599
|
+
React.createElement(Text.Text, { size: "xs", tone: "muted" }, isDate(label.date) ? (React.createElement("time", { dateTime: format(label.date, "yyyy-MM-dd") }, format(label.date, "LLLL d, yyyy"))) : (React.createElement("span", null, label.date)))))),
|
|
2600
|
+
React.createElement(VerticalSpace.VerticalSpace, { size: "24" }))),
|
|
2601
|
+
React.createElement(Heading.Heading, { level: headingLevel, size: "xl" }, heading),
|
|
2602
|
+
!isMinWidthArcBreakpointM && (React.createElement("div", { "data-testid": "mobile-img" },
|
|
2603
|
+
React.createElement(VerticalSpace.VerticalSpace, { size: "40" }),
|
|
2604
|
+
React.createElement(MediaContent, { image: image, video: video }))),
|
|
2605
|
+
React.createElement(VerticalSpace.VerticalSpace, { size: "40" }),
|
|
2606
|
+
React.createElement(Text.Text, { size: "l" }, content),
|
|
2607
|
+
(footer === null || footer === void 0 ? void 0 : footer.type) === "cta" && (React.createElement(React.Fragment, null,
|
|
2608
|
+
footer.author && (React.createElement(React.Fragment, null,
|
|
2609
|
+
React.createElement(VerticalSpace.VerticalSpace, { size: "24" }),
|
|
2610
|
+
React.createElement(Author, { name: footer.author.name, title: footer.author.title, avatar: footer.author.avatar }))),
|
|
2611
|
+
React.createElement(VerticalSpace.VerticalSpace, { size: "40" }),
|
|
2612
|
+
React.createElement(ButtonV2.ButtonV2, __assign({ buttonStyle: "secondary" }, footer.button)))),
|
|
2613
|
+
(footer === null || footer === void 0 ? void 0 : footer.type) === "appButton" && (React.createElement(React.Fragment, null,
|
|
2614
|
+
React.createElement(VerticalSpace.VerticalSpace, { size: "40" }),
|
|
2615
|
+
React.createElement(Grid.Grid, { isGutterless: true, isFluid: true },
|
|
2616
|
+
React.createElement(Grid.Grid.Row, null,
|
|
2617
|
+
footer.appStore && (React.createElement(Grid.Grid.Col, { xs: 12, s: "auto" },
|
|
2618
|
+
React.createElement(AppButton.AppButton, { type: "apple-app-store", screenReaderText: footer.appStore.screenReaderText, url: footer.appStore.url }))),
|
|
2619
|
+
footer.googlePlay && (React.createElement(Grid.Grid.Col, { xs: 12, s: "auto" },
|
|
2620
|
+
React.createElement("div", { className: styles$6.googlePlayButtonWrapper },
|
|
2621
|
+
React.createElement(AppButton.AppButton, { type: "google-play", screenReaderText: footer.googlePlay.screenReaderText, url: footer.googlePlay.url })))))))))),
|
|
2622
|
+
isMinWidthArcBreakpointM && (React.createElement("div", { className: styles$6.col },
|
|
2623
|
+
React.createElement("div", { "data-testid": "desktop-img", className: styles$6.imgContainer },
|
|
2624
|
+
React.createElement(MediaContent, { image: image, video: video }))))));
|
|
2625
|
+
};
|
|
2626
|
+
|
|
2627
|
+
var styles$5 = {"highlights":"Highlights-module_highlights__Hf7Zq","highlightItem":"Highlights-module_highlightItem__-N6le","highlights2Column":"Highlights-module_highlights2Column__6qIuI","highlights3Column":"Highlights-module_highlights3Column__qsCMP"};
|
|
2628
|
+
|
|
2629
|
+
var HighlightItem = function (_a) {
|
|
2630
|
+
var icon = _a.icon, heading = _a.heading, text = _a.text, link = _a.link, isSmallIcon = _a.isSmallIcon;
|
|
2631
|
+
return (React.createElement("div", { "data-testid": "highlight-item-container", className: styles$5.highlightItem },
|
|
2632
|
+
icon && (React.createElement("div", { className: styles$5.Icon },
|
|
2633
|
+
React.createElement(Icon.Icon, { "data-testid": "highlight-icon", color: "brand", icon: icon, size: isSmallIcon ? 64 : 76 }))),
|
|
2634
|
+
React.createElement(VerticalSpace.VerticalSpace, { size: "16" }),
|
|
2635
|
+
React.createElement(Heading.Heading, { level: "3", size: "m" }, heading),
|
|
2636
|
+
React.createElement(VerticalSpace.VerticalSpace, { size: "16" }),
|
|
2637
|
+
React.createElement(Text.Text, null, text),
|
|
2638
|
+
React.createElement(VerticalSpace.VerticalSpace, { size: "16" }),
|
|
2639
|
+
link && (React.createElement(Link.Link, { href: link.url, id: link.url, onClick: function noRefCheck() { }, rel: "", size: "m", target: "_self", title: link.textLink }, link.textLink))));
|
|
2640
|
+
};
|
|
2641
|
+
|
|
2642
|
+
var HighlightList = function (_a) {
|
|
2643
|
+
var listItems = _a.listItems, columns = _a.columns, isSmallIcon = _a.isSmallIcon;
|
|
2644
|
+
var id = React.useId();
|
|
2645
|
+
return (React.createElement("div", { "data-testid": "highlights-list", className: classNames(styles$5.highlights, styles$5["highlights".concat(columns, "Column")]) }, listItems.map(function (_a, i) {
|
|
2646
|
+
var icon = _a.icon, heading = _a.heading, text = _a.text, link = _a.link;
|
|
2647
|
+
return (React.createElement(HighlightItem, { key: "highlight-".concat(id, "-").concat(i), icon: icon, heading: heading, text: text, link: link, isSmallIcon: isSmallIcon }));
|
|
2648
|
+
})));
|
|
2649
|
+
};
|
|
2650
|
+
|
|
2651
|
+
/**
|
|
2652
|
+
* Use `Highlights` to give supporting information about a page or proposition. It can be used to call out key benefits in bullet points, or link. Both two and three column options are available.
|
|
2653
|
+
*/
|
|
2654
|
+
var Highlights = function (_a) {
|
|
2655
|
+
var heading = _a.heading, headingLevel = _a.headingLevel, content = _a.content, listItems = _a.listItems, _b = _a.columns, columns = _b === void 0 ? "2" : _b;
|
|
2656
|
+
var isMaxWidthArcBreakpointXs = useMediaQuery.useMediaQuery("(max-width: 767px)");
|
|
2657
|
+
return (React.createElement("div", null,
|
|
2658
|
+
React.createElement(SectionHeading, { isPadded: true, "data-testid": "highlights-header", heading: heading, headingLevel: headingLevel, content: content }),
|
|
2659
|
+
React.createElement(HighlightList, { "data-testid": "highlights-list-container", listItems: listItems, columns: columns, isSmallIcon: isMaxWidthArcBreakpointXs })));
|
|
2660
|
+
};
|
|
2661
|
+
|
|
2662
|
+
var styles$4 = {"PromoListing":"PromoListing-module_PromoListing__6ensv","promoListingContainer":"PromoListing-module_promoListingContainer__vwez-","cardGrid":"PromoListing-module_cardGrid__llf73","carouselSlide":"PromoListing-module_carouselSlide__AMTPF","cardGrid2Columns":"PromoListing-module_cardGrid2Columns__qPLQk","cardGrid3Cards":"PromoListing-module_cardGrid3Cards__VKWMs","cardGrid5Cards":"PromoListing-module_cardGrid5Cards__ywl5k","cardGrid3Columns":"PromoListing-module_cardGrid3Columns__g0Xru","cardGrid4Cards":"PromoListing-module_cardGrid4Cards__5Bv5u","cardGrid2Cards":"PromoListing-module_cardGrid2Cards__wDc4S"};
|
|
2663
|
+
|
|
2664
|
+
/**
|
|
2665
|
+
* Use `PromoListing` to give supporting information about a page or proposition in the form of the card components (`ImpactCard`, `InformationCard`, `MediaCard` and `TypographyCard`).
|
|
2666
|
+
*/
|
|
2667
|
+
var PromoListing = function (_a) {
|
|
2668
|
+
var heading = _a.heading, content = _a.content, isCarousel = _a.isCarousel, cards = _a.cards, headingLevel = _a.headingLevel, _b = _a.columns, columns = _b === void 0 ? "2" : _b;
|
|
2669
|
+
var id = React.useId();
|
|
2670
|
+
var isMinWidthArcBreakpointL = useMediaQuery.useMediaQuery("(min-width: ".concat(ArcSizeBreakpointsL, ")"));
|
|
2671
|
+
var columnCount = isMinWidthArcBreakpointL ? columns : 2;
|
|
2672
|
+
var getCard = function (card) { return (React.createElement(React.Fragment, null,
|
|
2673
|
+
card.type === "media-card" && React.createElement(MediaCard.MediaCard, __assign({}, card)),
|
|
2674
|
+
card.type === "impact-card" && React.createElement(ImpactCard.ImpactCard, __assign({}, card)),
|
|
2675
|
+
card.type === "information-card" && React.createElement(InformationCard.InformationCard, __assign({}, card)),
|
|
2676
|
+
card.type === "typography-card" && React.createElement(TypographyCard.TypographyCard, __assign({}, card)))); };
|
|
2677
|
+
return (React.createElement("div", { className: styles$4.PromoListing },
|
|
2678
|
+
React.createElement(SectionHeading, { isPadded: true, "data-testid": "PromoListing-header", heading: heading, headingLevel: headingLevel, content: content }),
|
|
2679
|
+
isCarousel && !isMinWidthArcBreakpointL ? (React.createElement(Carousel.Carousel, { itemsPerSlide: 1, responsive: {
|
|
2680
|
+
s: {
|
|
2681
|
+
itemsToScroll: 1,
|
|
2682
|
+
isPartialVisible: false,
|
|
2683
|
+
itemsPerSlide: 2,
|
|
2684
|
+
},
|
|
2685
|
+
m: {
|
|
2686
|
+
itemsToScroll: 1,
|
|
2687
|
+
isPartialVisible: true,
|
|
2688
|
+
itemsPerSlide: 2,
|
|
2689
|
+
},
|
|
2690
|
+
} }, cards === null || cards === void 0 ? void 0 : cards.map(function (card, i) { return (React.createElement("div", { key: "card-".concat(id, "-").concat(i), className: styles$4.carouselSlide }, getCard(card))); }))) : (React.createElement("div", { className: classNames(styles$4.cardGrid, styles$4["cardGrid".concat(columnCount, "Columns")], styles$4["cardGrid".concat(cards.length, "Cards")]) }, cards === null || cards === void 0 ? void 0 : cards.map(function (card, index) { return (React.createElement("div", { "data-testid": "promoList-card".concat(index), className: classNames(styles$4.promoListingContainer), key: index }, getCard(card))); })))));
|
|
2691
|
+
};
|
|
2692
|
+
|
|
2693
|
+
var styles$3 = {"blockQuote":"Quote-module_blockQuote__STj-z","quoteContent":"Quote-module_quoteContent__kWc51","quoteDefault":"Quote-module_quoteDefault__tU5db","quoteSecondary":"Quote-module_quoteSecondary__3Rk3f","quoteIcon":"Quote-module_quoteIcon__HK1TV"};
|
|
2694
|
+
|
|
2695
|
+
/**
|
|
2696
|
+
* Use `Quote` where a quote or testimonial from an existing customer or stakeholder would help build trust and credibility with potential new customers. It's commonly used on product pages where customers would learn about a product or service that we offer.*/
|
|
2697
|
+
var Quote = function (_a) {
|
|
2698
|
+
var author = _a.author, _b = _a.styling, styling = _b === void 0 ? "Default" : _b, content = _a.content, citeUrl = _a.citeUrl, props = __rest(_a, ["author", "styling", "content", "citeUrl"]);
|
|
2699
|
+
return (React.createElement("div", __assign({ className: "community-component--quote", "data-testid": "quote-test" }, filterDataAttrs(props)),
|
|
2700
|
+
React.createElement("blockquote", { "data-testid": "style-test", className: classNames(styles$3.blockQuote, styles$3["quote".concat(styling)]), cite: citeUrl },
|
|
2701
|
+
React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 100 77", className: styles$3.quoteIcon, "aria-hidden": "true" },
|
|
2702
|
+
React.createElement("path", { d: "M21.8085 76.4706C15.9574 76.4706 10.8156 74.2732 6.38298 69.8783C2.12766 65.4834 0 58.979 0 50.3651C0 40.5206 3.10284 31.1156 9.30851 22.1501C15.6915 13.1846 25.3546 5.80122 38.2979 0L44.1489 11.3387C37.4113 14.3272 31.7376 18.0189 27.1277 22.4138C22.5177 26.6329 19.6809 31.4672 18.617 36.9168C19.8582 36.741 21.0106 36.6531 22.0745 36.6531C27.7482 36.6531 32.4468 38.499 36.1702 42.1907C40.0709 45.8824 42.0213 50.7167 42.0213 56.6937C42.0213 62.4949 39.9823 67.2414 35.9043 70.9331C32.0035 74.6247 27.305 76.4706 21.8085 76.4706ZM77.6596 76.4706C71.8085 76.4706 66.6667 74.2732 62.234 69.8783C57.9787 65.4834 55.8511 58.979 55.8511 50.3651C55.8511 40.5206 58.9539 31.1156 65.1596 22.1501C71.5425 13.1846 81.2057 5.80122 94.1489 0L100 11.3387C93.2624 14.3272 87.5886 18.0189 82.9787 22.4138C78.3688 26.6329 75.5319 31.4672 74.4681 36.9168C75.7092 36.741 76.8617 36.6531 77.9255 36.6531C83.5993 36.6531 88.2979 38.499 92.0213 42.1907C95.922 45.8824 97.8723 50.7167 97.8723 56.6937C97.8723 62.4949 95.8333 67.2414 91.7553 70.9331C87.8546 74.6247 83.156 76.4706 77.6596 76.4706Z" })),
|
|
2703
|
+
React.createElement("p", { className: styles$3.quoteContent }, content)),
|
|
2704
|
+
author && (React.createElement(Author, { name: author.name, title: author.title, avatar: author.avatar }))));
|
|
2705
|
+
};
|
|
2706
|
+
|
|
2707
|
+
var styles$2 = {"ruleContainer":"Summary-module_ruleContainer__ydWlG","row":"Summary-module_row__SKV--"};
|
|
2708
|
+
|
|
2709
|
+
var Summary = function (_a) {
|
|
2710
|
+
var content = _a.content, _b = _a.headingLevel, headingLevel = _b === void 0 ? "3" : _b;
|
|
2711
|
+
var isMinWidthArcBreakpointS = useMediaQuery.useMediaQuery("(min-width: ".concat(ArcSizeBreakpointsS, ")"));
|
|
2712
|
+
return (React.createElement(Box.Box, { isBorderRadius: true, borderWidth: "thin", padding: "24" },
|
|
2713
|
+
React.createElement("div", { className: styles$2.row }, content.map(function (_a, i) {
|
|
2714
|
+
var heading = _a.heading, text = _a.text;
|
|
2715
|
+
return (React.createElement(React.Fragment, null,
|
|
2716
|
+
React.createElement("div", { className: styles$2.col },
|
|
2717
|
+
React.createElement(Heading.Heading, { size: "s", level: headingLevel }, heading),
|
|
2718
|
+
React.createElement(VerticalSpace.VerticalSpace, { size: "8" }),
|
|
2719
|
+
React.createElement(Text.Text, { size: "s" }, text)),
|
|
2720
|
+
i !== content.length - 1 && (React.createElement("div", { className: styles$2.ruleContainer },
|
|
2721
|
+
React.createElement(Rule.Rule, { orientation: isMinWidthArcBreakpointS ? "vertical" : "horizontal" })))));
|
|
2722
|
+
}))));
|
|
2723
|
+
};
|
|
2724
|
+
|
|
2725
|
+
var styles$1 = {"list":"Statistics-module_list__BI-eQ","mutedText":"Statistics-module_mutedText__MR1JM","statWrapper":"Statistics-module_statWrapper__83OnM"};
|
|
2726
|
+
|
|
2727
|
+
var getLinkProps = function (link) {
|
|
2728
|
+
return link.openInNewTab
|
|
2729
|
+
? {
|
|
2730
|
+
rel: "noreferrer",
|
|
2731
|
+
target: "_blank",
|
|
2732
|
+
}
|
|
2733
|
+
: {};
|
|
2734
|
+
};
|
|
2735
|
+
|
|
2736
|
+
var Statistics = function (_a) {
|
|
2737
|
+
var headingLevel = _a.headingLevel, heading = _a.heading, content = _a.content, statistics = _a.statistics;
|
|
2738
|
+
var id = React.useId();
|
|
2739
|
+
return (React.createElement(Columns.Columns, null,
|
|
2740
|
+
React.createElement(Columns.Columns.Col, { spanM: 9 },
|
|
2741
|
+
React.createElement(SectionHeading, { heading: heading, headingLevel: headingLevel, content: content }),
|
|
2742
|
+
React.createElement(VerticalSpace.VerticalSpace, { size: "16" })),
|
|
2743
|
+
React.createElement(Columns.Columns.Col, { spanL: 9 },
|
|
2744
|
+
React.createElement("ul", { className: styles$1.list }, statistics.map(function (_a, i) {
|
|
2745
|
+
var stat = _a.stat, copy = _a.copy, link = _a.link, source = _a.source, sourceUrl = _a.sourceUrl;
|
|
2746
|
+
return (React.createElement("li", { key: "statistic-".concat(id, "-").concat(i) },
|
|
2747
|
+
i !== 0 && (React.createElement(React.Fragment, null,
|
|
2748
|
+
React.createElement(VerticalSpace.VerticalSpace, { size: "24", sizeS: "32", sizeXL: "40" }),
|
|
2749
|
+
React.createElement(Rule.Rule, null),
|
|
2750
|
+
React.createElement(VerticalSpace.VerticalSpace, { size: "24", sizeS: "32", sizeXL: "40" }))),
|
|
2751
|
+
React.createElement(Columns.Columns, null,
|
|
2752
|
+
React.createElement(Columns.Columns.Col, { spanS: 6, spanM: 8 },
|
|
2753
|
+
React.createElement(Align.Align, { vertical: "center" },
|
|
2754
|
+
React.createElement("div", { className: styles$1.statWrapper },
|
|
2755
|
+
React.createElement(Heading.Heading, { color: "brand", size: "xxl" }, stat)))),
|
|
2756
|
+
React.createElement(Columns.Columns.Col, { spanS: 6, spanM: 4 },
|
|
2757
|
+
React.createElement(Text.Text, null, copy),
|
|
2758
|
+
link && (React.createElement(React.Fragment, null,
|
|
2759
|
+
React.createElement(VerticalSpace.VerticalSpace, { size: "12" }),
|
|
2760
|
+
React.createElement("a", __assign({ href: link.href, "aria-label": link.ariaLabel }, getLinkProps(link)), link.text))),
|
|
2761
|
+
source && (React.createElement(React.Fragment, null,
|
|
2762
|
+
React.createElement(VerticalSpace.VerticalSpace, { size: "12" }),
|
|
2763
|
+
React.createElement(Text.Text, { size: "xs" },
|
|
2764
|
+
React.createElement("span", { className: styles$1.mutedText }, source)))),
|
|
2765
|
+
sourceUrl && (React.createElement(Text.Text, { size: "xs" },
|
|
2766
|
+
React.createElement("a", { className: styles$1.mutedText, href: sourceUrl }, sourceUrl)))))));
|
|
2767
|
+
})))));
|
|
2768
|
+
};
|
|
2769
|
+
|
|
2770
|
+
var styles = {"contentSwitcherWrapper":"BannerWithTabs-module_contentSwitcherWrapper__xvz39","contentSwitcherDropdownWrapper":"BannerWithTabs-module_contentSwitcherDropdownWrapper__eT5zq"};
|
|
2771
|
+
|
|
2772
|
+
var BannerWithTabs = function (_a) {
|
|
2773
|
+
var _b;
|
|
2774
|
+
var tabs = _a.tabs, defaultValue = _a.defaultValue;
|
|
2775
|
+
var initialTab = defaultValue !== null && defaultValue !== void 0 ? defaultValue : (_b = tabs[0]) === null || _b === void 0 ? void 0 : _b.value;
|
|
2776
|
+
var _c = React.useState(initialTab), selectedTab = _c[0], setSelectedTab = _c[1];
|
|
2777
|
+
return (React.createElement(React.Fragment, null,
|
|
2778
|
+
React.createElement("div", { className: styles.contentSwitcherWrapper },
|
|
2779
|
+
React.createElement(ContentSwitcher.ContentSwitcher, { value: selectedTab, onValueChange: function (value) { return setSelectedTab(value); } },
|
|
2780
|
+
React.createElement(ContentSwitcher.ContentSwitcher.List, { isInset: true }, tabs.map(function (_a, index) {
|
|
2781
|
+
var label = _a.label, value = _a.value;
|
|
2782
|
+
return (React.createElement(ContentSwitcher.ContentSwitcher.Tab, { label: label, value: value, key: "".concat(index, "-").concat(value) }));
|
|
2783
|
+
})),
|
|
2784
|
+
tabs.map(function (_a, index) {
|
|
2785
|
+
var value = _a.value, content = _a.content;
|
|
2786
|
+
return (React.createElement(ContentSwitcher.ContentSwitcher.Content, { value: value, key: index },
|
|
2787
|
+
React.createElement(HeroBanner.HeroBanner, __assign({}, content))));
|
|
2788
|
+
}))),
|
|
2789
|
+
React.createElement("div", { className: styles.contentSwitcherDropdownWrapper },
|
|
2790
|
+
React.createElement(ContentSwitcherDropdown.ContentSwitcherDropdown, { value: selectedTab, tabs: tabs, isInset: true, isFluid: true, onValueChange: function (value) { return setSelectedTab(value); } }, tabs.map(function (_a, index) {
|
|
2791
|
+
var value = _a.value, content = _a.content;
|
|
2792
|
+
return (React.createElement(ContentSwitcherDropdown.ContentSwitcherDropdown.Content, { value: value, key: "".concat(index, "-").concat(value) },
|
|
2793
|
+
React.createElement(HeroBanner.HeroBanner, __assign({}, content))));
|
|
2794
|
+
})))));
|
|
2795
|
+
};
|
|
2796
|
+
|
|
2797
|
+
exports.Accordion = Accordion;
|
|
2798
|
+
exports.Author = Author;
|
|
2799
|
+
exports.BannerWithTabs = BannerWithTabs;
|
|
2800
|
+
exports.CopyLead = CopyLead;
|
|
2801
|
+
exports.DownloadList = DownloadList;
|
|
2802
|
+
exports.FeaturePost = FeaturePost;
|
|
2803
|
+
exports.Highlights = Highlights;
|
|
2804
|
+
exports.PromoListing = PromoListing;
|
|
2805
|
+
exports.Quote = Quote;
|
|
2806
|
+
exports.Statistics = Statistics;
|
|
2807
|
+
exports.Summary = Summary;
|
|
2808
|
+
//# sourceMappingURL=index.js.map
|