@abgov/react-components 6.11.0-dev.12 → 6.11.0-dev.15
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/{parseISO-BHUUf1QW.mjs → calendar-date-Chmr7h4a.mjs} +202 -1
- package/calendar-date-Chmr7h4a.mjs.map +1 -0
- package/{parseISO-Dj57mwuH.js → calendar-date-IMhR_PA6.js} +202 -1
- package/calendar-date-IMhR_PA6.js.map +1 -0
- package/experimental/app-header/app-header.d.ts +33 -0
- package/experimental/app-header-menu/app-header-menu.d.ts +11 -0
- package/experimental/index.d.ts +5 -0
- package/experimental/push-drawer/push-drawer.d.ts +28 -0
- package/experimental/tabs/tabs.d.ts +4 -2
- package/experimental/work-side-menu/work-side-menu.d.ts +2 -1
- package/experimental/work-side-menu-group/work-side-menu-group.d.ts +2 -2
- package/experimental/work-side-menu-item/work-side-menu-item.d.ts +3 -2
- package/experimental/work-side-notification-item/work-side-notification-item.d.ts +31 -0
- package/experimental/work-side-notification-panel/work-side-notification-panel.d.ts +25 -0
- package/experimental.js +215 -35
- package/experimental.js.map +1 -1
- package/experimental.mjs +187 -7
- package/experimental.mjs.map +1 -1
- package/index.js +1590 -1590
- package/index.js.map +1 -1
- package/index.mjs +1583 -1583
- package/index.mjs.map +1 -1
- package/lib/app-header/app-header.d.ts +0 -17
- package/lib/push-drawer/push-drawer.d.ts +0 -14
- package/package.json +1 -1
- package/parseISO-BHUUf1QW.mjs.map +0 -1
- package/parseISO-Dj57mwuH.js.map +0 -1
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
2
5
|
const lowercase = (input) => input.toLowerCase();
|
|
3
6
|
const kebab = (input) => input.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
|
|
4
7
|
function transformProps(props, transform = lowercase) {
|
|
@@ -30,6 +33,36 @@ function constructFrom(date, value) {
|
|
|
30
33
|
return new Date(value);
|
|
31
34
|
}
|
|
32
35
|
}
|
|
36
|
+
function addDays(date, amount) {
|
|
37
|
+
const _date = toDate(date);
|
|
38
|
+
if (isNaN(amount)) return constructFrom(date, NaN);
|
|
39
|
+
if (!amount) {
|
|
40
|
+
return _date;
|
|
41
|
+
}
|
|
42
|
+
_date.setDate(_date.getDate() + amount);
|
|
43
|
+
return _date;
|
|
44
|
+
}
|
|
45
|
+
function addMonths(date, amount) {
|
|
46
|
+
const _date = toDate(date);
|
|
47
|
+
if (isNaN(amount)) return constructFrom(date, NaN);
|
|
48
|
+
if (!amount) {
|
|
49
|
+
return _date;
|
|
50
|
+
}
|
|
51
|
+
const dayOfMonth = _date.getDate();
|
|
52
|
+
const endOfDesiredMonth = constructFrom(date, _date.getTime());
|
|
53
|
+
endOfDesiredMonth.setMonth(_date.getMonth() + amount + 1, 0);
|
|
54
|
+
const daysInMonth = endOfDesiredMonth.getDate();
|
|
55
|
+
if (dayOfMonth >= daysInMonth) {
|
|
56
|
+
return endOfDesiredMonth;
|
|
57
|
+
} else {
|
|
58
|
+
_date.setFullYear(
|
|
59
|
+
endOfDesiredMonth.getFullYear(),
|
|
60
|
+
endOfDesiredMonth.getMonth(),
|
|
61
|
+
dayOfMonth
|
|
62
|
+
);
|
|
63
|
+
return _date;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
33
66
|
const millisecondsInWeek = 6048e5;
|
|
34
67
|
const millisecondsInDay = 864e5;
|
|
35
68
|
const millisecondsInMinute = 6e4;
|
|
@@ -106,6 +139,11 @@ function startOfISOWeekYear(date) {
|
|
|
106
139
|
fourthOfJanuary.setHours(0, 0, 0, 0);
|
|
107
140
|
return startOfISOWeek(fourthOfJanuary);
|
|
108
141
|
}
|
|
142
|
+
function isSameDay(dateLeft, dateRight) {
|
|
143
|
+
const dateLeftStartOfDay = startOfDay(dateLeft);
|
|
144
|
+
const dateRightStartOfDay = startOfDay(dateRight);
|
|
145
|
+
return +dateLeftStartOfDay === +dateRightStartOfDay;
|
|
146
|
+
}
|
|
109
147
|
function isDate(value) {
|
|
110
148
|
return value instanceof Date || typeof value === "object" && Object.prototype.toString.call(value) === "[object Date]";
|
|
111
149
|
}
|
|
@@ -1505,6 +1543,37 @@ function cleanEscapedString(input) {
|
|
|
1505
1543
|
}
|
|
1506
1544
|
return matched[1].replace(doubleQuoteRegExp, "'");
|
|
1507
1545
|
}
|
|
1546
|
+
function getDaysInMonth(date) {
|
|
1547
|
+
const _date = toDate(date);
|
|
1548
|
+
const year = _date.getFullYear();
|
|
1549
|
+
const monthIndex = _date.getMonth();
|
|
1550
|
+
const lastDayOfMonth2 = constructFrom(date, 0);
|
|
1551
|
+
lastDayOfMonth2.setFullYear(year, monthIndex + 1, 0);
|
|
1552
|
+
lastDayOfMonth2.setHours(0, 0, 0, 0);
|
|
1553
|
+
return lastDayOfMonth2.getDate();
|
|
1554
|
+
}
|
|
1555
|
+
function lastDayOfMonth(date) {
|
|
1556
|
+
const _date = toDate(date);
|
|
1557
|
+
const month = _date.getMonth();
|
|
1558
|
+
_date.setFullYear(_date.getFullYear(), month + 1, 0);
|
|
1559
|
+
_date.setHours(0, 0, 0, 0);
|
|
1560
|
+
return _date;
|
|
1561
|
+
}
|
|
1562
|
+
function isAfter(date, dateToCompare) {
|
|
1563
|
+
const _date = toDate(date);
|
|
1564
|
+
const _dateToCompare = toDate(dateToCompare);
|
|
1565
|
+
return _date.getTime() > _dateToCompare.getTime();
|
|
1566
|
+
}
|
|
1567
|
+
function isBefore(date, dateToCompare) {
|
|
1568
|
+
const _date = toDate(date);
|
|
1569
|
+
const _dateToCompare = toDate(dateToCompare);
|
|
1570
|
+
return +_date < +_dateToCompare;
|
|
1571
|
+
}
|
|
1572
|
+
function isSameMonth(dateLeft, dateRight) {
|
|
1573
|
+
const _dateLeft = toDate(dateLeft);
|
|
1574
|
+
const _dateRight = toDate(dateRight);
|
|
1575
|
+
return _dateLeft.getFullYear() === _dateRight.getFullYear() && _dateLeft.getMonth() === _dateRight.getMonth();
|
|
1576
|
+
}
|
|
1508
1577
|
function parseISO(argument, options) {
|
|
1509
1578
|
const additionalDigits = 2;
|
|
1510
1579
|
const dateStrings = splitDateString(argument);
|
|
@@ -1683,10 +1752,142 @@ function validateTime(hours, minutes, seconds) {
|
|
|
1683
1752
|
function validateTimezone(_hours, minutes) {
|
|
1684
1753
|
return minutes >= 0 && minutes <= 59;
|
|
1685
1754
|
}
|
|
1755
|
+
class CalendarDate {
|
|
1756
|
+
constructor(value) {
|
|
1757
|
+
__publicField(this, "_dateNums");
|
|
1758
|
+
if (value || value === 0) {
|
|
1759
|
+
this._dateNums = CalendarDate.parse(value);
|
|
1760
|
+
} else {
|
|
1761
|
+
this._dateNums = CalendarDate.parse(/* @__PURE__ */ new Date());
|
|
1762
|
+
}
|
|
1763
|
+
}
|
|
1764
|
+
static parse(value) {
|
|
1765
|
+
if (typeof value === "string") {
|
|
1766
|
+
value = value.split("T")[0];
|
|
1767
|
+
return value.split("-").map((v) => +v);
|
|
1768
|
+
} else if (value instanceof Date) {
|
|
1769
|
+
return [value.getFullYear(), value.getMonth() + 1, value.getDate()];
|
|
1770
|
+
} else if (value === 0) {
|
|
1771
|
+
return [0, 0, 0];
|
|
1772
|
+
} else {
|
|
1773
|
+
return [value.year, value.month, value.day];
|
|
1774
|
+
}
|
|
1775
|
+
}
|
|
1776
|
+
static init() {
|
|
1777
|
+
return new CalendarDate(0);
|
|
1778
|
+
}
|
|
1779
|
+
// Used internally to get the date value for the date_fns
|
|
1780
|
+
get date() {
|
|
1781
|
+
return new Date(
|
|
1782
|
+
this._dateNums[0],
|
|
1783
|
+
this._dateNums[1] - 1,
|
|
1784
|
+
this._dateNums[2]
|
|
1785
|
+
);
|
|
1786
|
+
}
|
|
1787
|
+
get year() {
|
|
1788
|
+
return this._dateNums[0];
|
|
1789
|
+
}
|
|
1790
|
+
get month() {
|
|
1791
|
+
return this._dateNums[1];
|
|
1792
|
+
}
|
|
1793
|
+
get day() {
|
|
1794
|
+
return this._dateNums[2];
|
|
1795
|
+
}
|
|
1796
|
+
get dayOfWeek() {
|
|
1797
|
+
return this.date.getDay();
|
|
1798
|
+
}
|
|
1799
|
+
get daysInMonth() {
|
|
1800
|
+
return getDaysInMonth(this.date);
|
|
1801
|
+
}
|
|
1802
|
+
get firstDayOfMonth() {
|
|
1803
|
+
return new CalendarDate({ year: this.year, month: this.month, day: 1 });
|
|
1804
|
+
}
|
|
1805
|
+
get lastDayOfMonth() {
|
|
1806
|
+
return new CalendarDate(lastDayOfMonth(this.date));
|
|
1807
|
+
}
|
|
1808
|
+
get previousDay() {
|
|
1809
|
+
return this.clone().addDays(-1);
|
|
1810
|
+
}
|
|
1811
|
+
get nextDay() {
|
|
1812
|
+
return this.clone().addDays(1);
|
|
1813
|
+
}
|
|
1814
|
+
get previousWeek() {
|
|
1815
|
+
return this.clone().addDays(-7);
|
|
1816
|
+
}
|
|
1817
|
+
get nextWeek() {
|
|
1818
|
+
return this.clone().addDays(7);
|
|
1819
|
+
}
|
|
1820
|
+
get previousMonth() {
|
|
1821
|
+
return this.clone().addMonths(-1);
|
|
1822
|
+
}
|
|
1823
|
+
get nextMonth() {
|
|
1824
|
+
return this.clone().addMonths(1);
|
|
1825
|
+
}
|
|
1826
|
+
clone() {
|
|
1827
|
+
return new CalendarDate(this.toString());
|
|
1828
|
+
}
|
|
1829
|
+
setYear(val) {
|
|
1830
|
+
this._dateNums[0] = val;
|
|
1831
|
+
}
|
|
1832
|
+
setMonth(val) {
|
|
1833
|
+
this._dateNums[1] = val;
|
|
1834
|
+
}
|
|
1835
|
+
setDay(val) {
|
|
1836
|
+
this._dateNums[2] = val;
|
|
1837
|
+
return this;
|
|
1838
|
+
}
|
|
1839
|
+
addYears(count) {
|
|
1840
|
+
this._dateNums[0] += count;
|
|
1841
|
+
return this;
|
|
1842
|
+
}
|
|
1843
|
+
addMonths(count) {
|
|
1844
|
+
this._dateNums = CalendarDate.parse(addMonths(this.date, count));
|
|
1845
|
+
return this;
|
|
1846
|
+
}
|
|
1847
|
+
addDays(count) {
|
|
1848
|
+
this._dateNums = CalendarDate.parse(addDays(this.date, count));
|
|
1849
|
+
return this;
|
|
1850
|
+
}
|
|
1851
|
+
isSameDay(cmp) {
|
|
1852
|
+
return isSameDay(this.date, cmp.date);
|
|
1853
|
+
}
|
|
1854
|
+
isSameMonth(value) {
|
|
1855
|
+
return isSameMonth(this.date, value.date);
|
|
1856
|
+
}
|
|
1857
|
+
isBefore(cmp) {
|
|
1858
|
+
return isBefore(this.date, cmp.date);
|
|
1859
|
+
}
|
|
1860
|
+
isAfter(cmp) {
|
|
1861
|
+
return isAfter(this.date, cmp.date);
|
|
1862
|
+
}
|
|
1863
|
+
isZero() {
|
|
1864
|
+
return this._dateNums[0] === 0 && this._dateNums[1] === 0 && this._dateNums[2] === 0;
|
|
1865
|
+
}
|
|
1866
|
+
isValid() {
|
|
1867
|
+
const comparisonDate = new Date(this.toString());
|
|
1868
|
+
if (isNaN(comparisonDate.getTime()) || this.toString() !== comparisonDate.toISOString().split("T")[0]) {
|
|
1869
|
+
return false;
|
|
1870
|
+
}
|
|
1871
|
+
return true;
|
|
1872
|
+
}
|
|
1873
|
+
format(tmpl) {
|
|
1874
|
+
if (this.isZero()) {
|
|
1875
|
+
return "";
|
|
1876
|
+
}
|
|
1877
|
+
return format(this.date, tmpl);
|
|
1878
|
+
}
|
|
1879
|
+
toString() {
|
|
1880
|
+
if (this.isZero()) {
|
|
1881
|
+
return "";
|
|
1882
|
+
}
|
|
1883
|
+
return this._dateNums.map((num) => `${num}`.length < 2 ? `0${num}` : `${num}`).join("-");
|
|
1884
|
+
}
|
|
1885
|
+
}
|
|
1886
|
+
exports.CalendarDate = CalendarDate;
|
|
1686
1887
|
exports.format = format;
|
|
1687
1888
|
exports.isValid = isValid;
|
|
1688
1889
|
exports.kebab = kebab;
|
|
1689
1890
|
exports.lowercase = lowercase;
|
|
1690
1891
|
exports.parseISO = parseISO;
|
|
1691
1892
|
exports.transformProps = transformProps;
|
|
1692
|
-
//# sourceMappingURL=
|
|
1893
|
+
//# sourceMappingURL=calendar-date-IMhR_PA6.js.map
|