@jirawatpyk/aura-react 4.15.0 → 4.17.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/README.md +76 -5
- package/dist/aura.bundle.js +239 -142
- package/dist/cjs/index.cjs +239 -142
- package/dist/esm/AppShell.js +9 -9
- package/dist/esm/Breadcrumb.js +1 -1
- package/dist/esm/Button.js +12 -3
- package/dist/esm/Command.js +69 -49
- package/dist/esm/DataTable.js +43 -16
- package/dist/esm/DatePicker.js +17 -146
- package/dist/esm/FileUpload.js +1 -10
- package/dist/esm/Pagination.js +35 -23
- package/dist/esm/Skeleton.js +4 -1
- package/dist/esm/Stat.js +1 -1
- package/dist/esm/StatusPill.js +4 -13
- package/dist/esm/TimePicker.js +1 -12
- package/dist/esm/breakpoints.js +5 -0
- package/dist/esm/colorScheme.js +1 -11
- package/dist/esm/colorSchemeScript.js +19 -0
- package/dist/esm/dates.js +164 -0
- package/dist/esm/locale.js +1 -347
- package/dist/esm/responsive.js +1 -1
- package/dist/esm/status.js +17 -0
- package/dist/esm/strings.js +351 -0
- package/dist/esm/text.js +30 -0
- package/dist/index.d.ts +537 -503
- package/dist/server/index.cjs +791 -0
- package/dist/server/index.d.ts +171 -0
- package/dist/server/index.js +768 -0
- package/dist/styles.css +69 -4
- package/dist/styles.layer.css +1352 -0
- package/package.json +11 -4
package/dist/esm/Pagination.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import * as React from "react";
|
|
3
|
+
import { Icon } from "./Icon.js";
|
|
3
4
|
import { IconButton } from "./IconButton.js";
|
|
4
5
|
import { cx, useMaybeControlled } from "./internal.js";
|
|
5
6
|
import { useLinkComponent, useStrings } from "./locale.js";
|
|
@@ -31,7 +32,7 @@ const Pagination = React.forwardRef(function Pagination2(props, ref) {
|
|
|
31
32
|
if (p >= 1 && p <= count && p !== page) st[1](p);
|
|
32
33
|
}
|
|
33
34
|
const link = props.getHref;
|
|
34
|
-
const Link = useLinkComponent();
|
|
35
|
+
const Link = useLinkComponent(props.linkComponent);
|
|
35
36
|
function item(p, label, extra) {
|
|
36
37
|
const common = Object.assign(
|
|
37
38
|
{
|
|
@@ -66,29 +67,40 @@ const Pagination = React.forwardRef(function Pagination2(props, ref) {
|
|
|
66
67
|
label
|
|
67
68
|
);
|
|
68
69
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
70
|
+
function arrow(p, icon, label, rel, disabled) {
|
|
71
|
+
if (!link || disabled)
|
|
72
|
+
return /* @__PURE__ */ React.createElement(
|
|
73
|
+
IconButton,
|
|
74
|
+
{
|
|
75
|
+
icon,
|
|
76
|
+
label,
|
|
77
|
+
disabled,
|
|
78
|
+
onClick: function() {
|
|
79
|
+
go(p);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
);
|
|
83
|
+
return /* @__PURE__ */ React.createElement(
|
|
84
|
+
Link,
|
|
85
|
+
{
|
|
86
|
+
href: link(p),
|
|
87
|
+
rel,
|
|
88
|
+
className: "aura-icon-btn",
|
|
89
|
+
"aria-label": label,
|
|
90
|
+
title: label,
|
|
91
|
+
onClick: function(e) {
|
|
92
|
+
if (props.onChange) {
|
|
93
|
+
e.preventDefault();
|
|
94
|
+
go(p);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
/* @__PURE__ */ React.createElement(Icon, { name: icon, size: "sm" })
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
return /* @__PURE__ */ React.createElement("nav", { ref, className: cx("aura-pagination", props.className), "aria-label": props.label || t.pagination }, arrow(page - 1, "chevron-left", t.prevPage, "prev", page <= 1), /* @__PURE__ */ React.createElement("ol", { className: "aura-pagination__list" }, pageList(page, count, props.siblingCount == null ? 1 : props.siblingCount).map(function(p) {
|
|
80
102
|
return typeof p === "number" ? /* @__PURE__ */ React.createElement("li", { key: p }, item(p, p)) : /* @__PURE__ */ React.createElement("li", { key: p, className: "aura-pagination__gap", "aria-hidden": true }, "\u2026");
|
|
81
|
-
})), /* @__PURE__ */ React.createElement("span", { className: "aura-pagination__compact", "aria-hidden": true }, t.page(page, count)),
|
|
82
|
-
IconButton,
|
|
83
|
-
{
|
|
84
|
-
icon: "chevron-right",
|
|
85
|
-
label: t.nextPage,
|
|
86
|
-
disabled: page >= count,
|
|
87
|
-
onClick: function() {
|
|
88
|
-
go(page + 1);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
));
|
|
103
|
+
})), /* @__PURE__ */ React.createElement("span", { className: "aura-pagination__compact", "aria-hidden": true }, t.page(page, count)), arrow(page + 1, "chevron-right", t.nextPage, "next", page >= count));
|
|
92
104
|
});
|
|
93
105
|
export {
|
|
94
106
|
Pagination
|
package/dist/esm/Skeleton.js
CHANGED
|
@@ -18,7 +18,10 @@ const Skeleton = React.forwardRef(function Skeleton2(props, ref) {
|
|
|
18
18
|
rows
|
|
19
19
|
);
|
|
20
20
|
}
|
|
21
|
-
const style = {
|
|
21
|
+
const style = {
|
|
22
|
+
width: props.width,
|
|
23
|
+
height: props.height
|
|
24
|
+
};
|
|
22
25
|
if (v === "circle") {
|
|
23
26
|
style.width = style.height = props.size || props.width || 40;
|
|
24
27
|
}
|
package/dist/esm/Stat.js
CHANGED
|
@@ -7,7 +7,7 @@ const Stat = React.forwardRef(function Stat2(props, ref) {
|
|
|
7
7
|
const ch = props.change;
|
|
8
8
|
const dir = ch && (ch.direction || "flat");
|
|
9
9
|
const tone = ch && (ch.tone || (dir === "up" ? "positive" : dir === "down" ? "negative" : "neutral"));
|
|
10
|
-
const Link = useLinkComponent();
|
|
10
|
+
const Link = useLinkComponent(props.linkComponent);
|
|
11
11
|
const v = props.value;
|
|
12
12
|
const numeric = typeof v === "number" || typeof v === "string" && /\d/.test(v) && /^[\s\d.,:+\-\u2212%()\u0E3F$\u20AC\u00A3\u00A5kKmMbB]+$/.test(v.replace(/\b[A-Z]{3}\b/g, ""));
|
|
13
13
|
const Tag = props.href ? Link : props.onClick ? "button" : "div";
|
package/dist/esm/StatusPill.js
CHANGED
|
@@ -8,17 +8,8 @@ const TONE_ICON = {
|
|
|
8
8
|
ready: "circle-check",
|
|
9
9
|
blocked: "ban"
|
|
10
10
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
progress: ["in progress", "in review", "review", "syncing", "running", "pending"],
|
|
14
|
-
blocked: ["blocked", "failed", "error", "rejected", "on hold", "cancelled"]
|
|
15
|
-
};
|
|
16
|
-
function toneFor(status) {
|
|
17
|
-
const s = String(status == null ? "" : status).trim().toLowerCase();
|
|
18
|
-
for (const t in TONE_WORDS) if (TONE_WORDS[t].indexOf(s) >= 0) return t;
|
|
19
|
-
return "neutral";
|
|
20
|
-
}
|
|
21
|
-
const TONE_ORDER = { neutral: 0, progress: 1, ready: 2, blocked: 3 };
|
|
11
|
+
import { toneFor } from "./status.js";
|
|
12
|
+
import { toneFor as toneFor2, statusTone, TONE_ORDER } from "./status.js";
|
|
22
13
|
const StatusPill = React.forwardRef(function StatusPill2(props, ref) {
|
|
23
14
|
const tone = props.tone || toneFor(props.children);
|
|
24
15
|
return /* @__PURE__ */ React.createElement("span", { ref, className: cx("aura-pill", "aura-pill--" + tone, props.className) }, /* @__PURE__ */ React.createElement(Icon, { name: TONE_ICON[tone] || "circle", size: 12 }), props.children);
|
|
@@ -26,6 +17,6 @@ const StatusPill = React.forwardRef(function StatusPill2(props, ref) {
|
|
|
26
17
|
export {
|
|
27
18
|
StatusPill,
|
|
28
19
|
TONE_ORDER,
|
|
29
|
-
|
|
30
|
-
toneFor
|
|
20
|
+
statusTone,
|
|
21
|
+
toneFor2 as toneFor
|
|
31
22
|
};
|
package/dist/esm/TimePicker.js
CHANGED
|
@@ -15,18 +15,7 @@ function toMin(t) {
|
|
|
15
15
|
function fromMin(n) {
|
|
16
16
|
return pad(Math.floor(n / 60)) + ":" + pad(n % 60);
|
|
17
17
|
}
|
|
18
|
-
|
|
19
|
-
let s = String(text || "").trim().toLowerCase().replace(/\s*(น\.?|นาฬิกา)$/, "").trim();
|
|
20
|
-
const pm = /\s*(pm|p\.m\.)$/.test(s), am = /\s*(am|a\.m\.)$/.test(s);
|
|
21
|
-
s = s.replace(/\s*(am|pm|a\.m\.|p\.m\.)$/, "");
|
|
22
|
-
const m = /^(\d{1,2})(?:[:.](\d{2}))?$/.exec(s) || /^(\d{1,2})(\d{2})$/.exec(s);
|
|
23
|
-
if (!m) return null;
|
|
24
|
-
let hh = +m[1], mm = m[2] ? +m[2] : 0;
|
|
25
|
-
if (pm && hh < 12) hh += 12;
|
|
26
|
-
if (am && hh === 12) hh = 0;
|
|
27
|
-
if (hh > 23 || mm > 59) return null;
|
|
28
|
-
return pad(hh) + ":" + pad(mm);
|
|
29
|
-
}
|
|
18
|
+
import { parseTime } from "./text.js";
|
|
30
19
|
const TimePicker = React.forwardRef(function TimePicker2(props, ref) {
|
|
31
20
|
const t = useStrings();
|
|
32
21
|
const auto = uid(), id = props.id || auto, listId = id + "-list";
|
package/dist/esm/colorScheme.js
CHANGED
|
@@ -3,17 +3,7 @@ import * as React from "react";
|
|
|
3
3
|
import { useStrings } from "./locale.js";
|
|
4
4
|
import { IconButton } from "./IconButton.js";
|
|
5
5
|
import { DropdownMenu } from "./DropdownMenu.js";
|
|
6
|
-
|
|
7
|
-
const SCHEMES = ["light", "dark", "system"];
|
|
8
|
-
const EVENT = "aura-color-scheme";
|
|
9
|
-
function valid(v) {
|
|
10
|
-
return typeof v === "string" && SCHEMES.indexOf(v) >= 0;
|
|
11
|
-
}
|
|
12
|
-
function colorSchemeScript(options) {
|
|
13
|
-
const key = JSON.stringify(options && options.storageKey || DEFAULT_KEY);
|
|
14
|
-
const fallback = JSON.stringify(options && options.defaultScheme || "system");
|
|
15
|
-
return "(function(){try{var s=localStorage.getItem(" + key + ");if(s!=='light'&&s!=='dark'&&s!=='system')s=" + fallback + `;var d=document.documentElement;d.setAttribute("data-theme",s);var dark=s==='dark'||(s==='system'&&window.matchMedia('(prefers-color-scheme: dark)').matches);d.classList.toggle("dark",dark);}catch(e){}})();`;
|
|
16
|
-
}
|
|
6
|
+
import { DEFAULT_KEY, SCHEMES, EVENT, valid, colorSchemeScript } from "./colorSchemeScript.js";
|
|
17
7
|
function ColorSchemeScript(props) {
|
|
18
8
|
return /* @__PURE__ */ React.createElement(
|
|
19
9
|
"script",
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
const DEFAULT_KEY = "aura-color-scheme";
|
|
3
|
+
const SCHEMES = ["light", "dark", "system"];
|
|
4
|
+
const EVENT = "aura-color-scheme";
|
|
5
|
+
function valid(v) {
|
|
6
|
+
return typeof v === "string" && SCHEMES.indexOf(v) >= 0;
|
|
7
|
+
}
|
|
8
|
+
function colorSchemeScript(options) {
|
|
9
|
+
const key = JSON.stringify(options && options.storageKey || DEFAULT_KEY);
|
|
10
|
+
const fallback = JSON.stringify(options && options.defaultScheme || "system");
|
|
11
|
+
return "(function(){try{var s=localStorage.getItem(" + key + ");if(s!=='light'&&s!=='dark'&&s!=='system')s=" + fallback + `;var d=document.documentElement;d.setAttribute("data-theme",s);var dark=s==='dark'||(s==='system'&&window.matchMedia('(prefers-color-scheme: dark)').matches);d.classList.toggle("dark",dark);}catch(e){}})();`;
|
|
12
|
+
}
|
|
13
|
+
export {
|
|
14
|
+
DEFAULT_KEY,
|
|
15
|
+
EVENT,
|
|
16
|
+
SCHEMES,
|
|
17
|
+
colorSchemeScript,
|
|
18
|
+
valid
|
|
19
|
+
};
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
const ERA = /^พ\.ศ\.\s?|\s?(BE|พ\.ศ\.)$/g;
|
|
3
|
+
const pad = function(n) {
|
|
4
|
+
return (n < 10 ? "0" : "") + n;
|
|
5
|
+
};
|
|
6
|
+
function toISO(d) {
|
|
7
|
+
return d ? d.getFullYear() + "-" + pad(d.getMonth() + 1) + "-" + pad(d.getDate()) : null;
|
|
8
|
+
}
|
|
9
|
+
function fromISO(s) {
|
|
10
|
+
if (!s) return null;
|
|
11
|
+
const m = /^(\d{4})-(\d{2})-(\d{2})$/.exec(s);
|
|
12
|
+
return m ? new Date(+m[1], +m[2] - 1, +m[3]) : null;
|
|
13
|
+
}
|
|
14
|
+
function addDays(d, n) {
|
|
15
|
+
return new Date(d.getFullYear(), d.getMonth(), d.getDate() + n);
|
|
16
|
+
}
|
|
17
|
+
function addMonths(d, n) {
|
|
18
|
+
const t = new Date(d.getFullYear(), d.getMonth() + n, 1);
|
|
19
|
+
const last = new Date(t.getFullYear(), t.getMonth() + 1, 0).getDate();
|
|
20
|
+
return new Date(t.getFullYear(), t.getMonth(), Math.min(d.getDate(), last));
|
|
21
|
+
}
|
|
22
|
+
function same(a, b) {
|
|
23
|
+
return !!a && !!b && a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate();
|
|
24
|
+
}
|
|
25
|
+
const TAGS = { th: "th-TH", en: "en-GB", sv: "sv-SE" };
|
|
26
|
+
function defaultCalendar(locale) {
|
|
27
|
+
return locale === "th" ? "buddhist" : "gregory";
|
|
28
|
+
}
|
|
29
|
+
function localeTag(locale, calendar) {
|
|
30
|
+
const cal = calendar || defaultCalendar(locale);
|
|
31
|
+
return (TAGS[locale || "en"] || "en-GB") + "-u-ca-" + (cal === "gregory" ? "gregory" : "buddhist");
|
|
32
|
+
}
|
|
33
|
+
const DATE_TEXT = {
|
|
34
|
+
th: {
|
|
35
|
+
prevYears: "\u0E0A\u0E48\u0E27\u0E07\u0E1B\u0E35\u0E01\u0E48\u0E2D\u0E19\u0E2B\u0E19\u0E49\u0E32",
|
|
36
|
+
nextYears: "\u0E0A\u0E48\u0E27\u0E07\u0E1B\u0E35\u0E16\u0E31\u0E14\u0E44\u0E1B",
|
|
37
|
+
prevMonth: "\u0E40\u0E14\u0E37\u0E2D\u0E19\u0E01\u0E48\u0E2D\u0E19\u0E2B\u0E19\u0E49\u0E32",
|
|
38
|
+
nextMonth: "\u0E40\u0E14\u0E37\u0E2D\u0E19\u0E16\u0E31\u0E14\u0E44\u0E1B",
|
|
39
|
+
today: "\u0E27\u0E31\u0E19\u0E19\u0E35\u0E49",
|
|
40
|
+
clear: "\u0E25\u0E49\u0E32\u0E07",
|
|
41
|
+
chooseDate: "\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48",
|
|
42
|
+
datePlaceholder: "\u0E27\u0E27/\u0E14\u0E14/\u0E1B\u0E1B\u0E1B\u0E1B",
|
|
43
|
+
clearDate: "\u0E25\u0E49\u0E32\u0E07\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48",
|
|
44
|
+
openCalendar: "\u0E40\u0E1B\u0E34\u0E14\u0E1B\u0E0F\u0E34\u0E17\u0E34\u0E19",
|
|
45
|
+
chooseDates: "\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E0A\u0E48\u0E27\u0E07\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48",
|
|
46
|
+
rangePlaceholder: "\u0E27\u0E27/\u0E14\u0E14/\u0E1B\u0E1B\u0E1B\u0E1B \u2013 \u0E27\u0E27/\u0E14\u0E14/\u0E1B\u0E1B\u0E1B\u0E1B",
|
|
47
|
+
clearDates: "\u0E25\u0E49\u0E32\u0E07\u0E0A\u0E48\u0E27\u0E07\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48",
|
|
48
|
+
chooseStart: "\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E27\u0E31\u0E19\u0E40\u0E23\u0E34\u0E48\u0E21\u0E15\u0E49\u0E19",
|
|
49
|
+
chooseEnd: "\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E27\u0E31\u0E19\u0E2A\u0E34\u0E49\u0E19\u0E2A\u0E38\u0E14"
|
|
50
|
+
},
|
|
51
|
+
en: {
|
|
52
|
+
prevYears: "Previous years",
|
|
53
|
+
nextYears: "Next years",
|
|
54
|
+
prevMonth: "Previous month",
|
|
55
|
+
nextMonth: "Next month",
|
|
56
|
+
today: "Today",
|
|
57
|
+
clear: "Clear",
|
|
58
|
+
chooseDate: "Choose date",
|
|
59
|
+
datePlaceholder: "DD/MM/YYYY",
|
|
60
|
+
clearDate: "Clear date",
|
|
61
|
+
openCalendar: "Open calendar",
|
|
62
|
+
chooseDates: "Choose dates",
|
|
63
|
+
rangePlaceholder: "DD/MM/YYYY \u2013 DD/MM/YYYY",
|
|
64
|
+
clearDates: "Clear dates",
|
|
65
|
+
chooseStart: "Choose the start date",
|
|
66
|
+
chooseEnd: "Choose the end date"
|
|
67
|
+
},
|
|
68
|
+
sv: {
|
|
69
|
+
prevYears: "Tidigare \xE5r",
|
|
70
|
+
nextYears: "Senare \xE5r",
|
|
71
|
+
prevMonth: "F\xF6reg\xE5ende m\xE5nad",
|
|
72
|
+
nextMonth: "N\xE4sta m\xE5nad",
|
|
73
|
+
today: "Idag",
|
|
74
|
+
clear: "Rensa",
|
|
75
|
+
chooseDate: "V\xE4lj datum",
|
|
76
|
+
datePlaceholder: "\xE5\xE5\xE5\xE5-mm-dd",
|
|
77
|
+
clearDate: "Rensa datum",
|
|
78
|
+
openCalendar: "\xD6ppna kalendern",
|
|
79
|
+
chooseDates: "V\xE4lj datum",
|
|
80
|
+
rangePlaceholder: "\xE5\xE5\xE5\xE5-mm-dd \u2013 \xE5\xE5\xE5\xE5-mm-dd",
|
|
81
|
+
clearDates: "Rensa datumen",
|
|
82
|
+
chooseStart: "V\xE4lj startdatum",
|
|
83
|
+
chooseEnd: "V\xE4lj slutdatum"
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
function dateText(locale) {
|
|
87
|
+
return DATE_TEXT[locale || "en"] || DATE_TEXT.en;
|
|
88
|
+
}
|
|
89
|
+
const fmtCache = {};
|
|
90
|
+
const PRESETS = {
|
|
91
|
+
short: { day: "numeric", month: "short", year: "numeric" },
|
|
92
|
+
long: { day: "numeric", month: "long", year: "numeric" },
|
|
93
|
+
numeric: { day: "2-digit", month: "2-digit", year: "numeric" }
|
|
94
|
+
};
|
|
95
|
+
function fmt(tag, opts, d) {
|
|
96
|
+
const k = tag + JSON.stringify(opts);
|
|
97
|
+
if (!fmtCache[k]) fmtCache[k] = new Intl.DateTimeFormat(tag, opts);
|
|
98
|
+
return fmtCache[k].format(d);
|
|
99
|
+
}
|
|
100
|
+
function formatDate(iso, opts) {
|
|
101
|
+
const o = opts || {}, d = fromISO(iso);
|
|
102
|
+
if (!d) return "";
|
|
103
|
+
const f = typeof o.format === "object" ? o.format : PRESETS[o.format || "short"];
|
|
104
|
+
const loc = o.locale || "th";
|
|
105
|
+
return fmt(localeTag(loc, o.calendar || defaultCalendar(loc)), f, d).replace(ERA, "");
|
|
106
|
+
}
|
|
107
|
+
let MONTHS = null;
|
|
108
|
+
function monthIndex(word) {
|
|
109
|
+
if (!MONTHS) {
|
|
110
|
+
MONTHS = {};
|
|
111
|
+
["th-TH", "en-GB", "sv-SE"].forEach(function(tag) {
|
|
112
|
+
["short", "long"].forEach(function(w) {
|
|
113
|
+
for (let i = 0; i < 12; i++) {
|
|
114
|
+
const n = new Intl.DateTimeFormat(tag, { month: w }).format(new Date(2020, i, 1)).toLowerCase().replace(/\.$/, "");
|
|
115
|
+
MONTHS[n] = i;
|
|
116
|
+
if (/^[a-zåäö]/.test(n)) MONTHS[n.slice(0, 3)] = i;
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
const k = word.toLowerCase().replace(/\.$/, "");
|
|
122
|
+
return MONTHS[k] != null ? MONTHS[k] : -1;
|
|
123
|
+
}
|
|
124
|
+
function parseDate(text) {
|
|
125
|
+
const s = String(text || "").trim();
|
|
126
|
+
let m = /^(\d{4})-(\d{1,2})-(\d{1,2})$/.exec(s), y, mo, d;
|
|
127
|
+
if (m) {
|
|
128
|
+
y = +m[1];
|
|
129
|
+
mo = +m[2];
|
|
130
|
+
d = +m[3];
|
|
131
|
+
} else if (m = /^(\d{1,2})[\/.\-](\d{1,2})[\/.\-](\d{4})$/.exec(s)) {
|
|
132
|
+
d = +m[1];
|
|
133
|
+
mo = +m[2];
|
|
134
|
+
y = +m[3];
|
|
135
|
+
} else if ((m = /^(\d{1,2})\s+(\S+)\s+(\d{4})$/.exec(s.replace(ERA, "").trim())) && monthIndex(m[2]) >= 0) {
|
|
136
|
+
d = +m[1];
|
|
137
|
+
mo = monthIndex(m[2]) + 1;
|
|
138
|
+
y = +m[3];
|
|
139
|
+
} else return null;
|
|
140
|
+
if (y >= 2400) y -= 543;
|
|
141
|
+
const dt = new Date(y, mo - 1, d);
|
|
142
|
+
return dt.getMonth() === mo - 1 && dt.getDate() === d ? toISO(dt) : null;
|
|
143
|
+
}
|
|
144
|
+
export {
|
|
145
|
+
DATE_TEXT,
|
|
146
|
+
ERA,
|
|
147
|
+
MONTHS,
|
|
148
|
+
PRESETS,
|
|
149
|
+
TAGS,
|
|
150
|
+
addDays,
|
|
151
|
+
addMonths,
|
|
152
|
+
dateText,
|
|
153
|
+
defaultCalendar,
|
|
154
|
+
fmt,
|
|
155
|
+
fmtCache,
|
|
156
|
+
formatDate,
|
|
157
|
+
fromISO,
|
|
158
|
+
localeTag,
|
|
159
|
+
monthIndex,
|
|
160
|
+
pad,
|
|
161
|
+
parseDate,
|
|
162
|
+
same,
|
|
163
|
+
toISO
|
|
164
|
+
};
|