@aotearoan/neon 25.0.2 → 25.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/dist/common/icons/first-page.svg.cjs.js +7 -0
- package/dist/common/icons/first-page.svg.cjs.js.map +1 -0
- package/dist/common/icons/first-page.svg.es.js +10 -0
- package/dist/common/icons/first-page.svg.es.js.map +1 -0
- package/dist/common/icons/last-page.svg.cjs.js +7 -0
- package/dist/common/icons/last-page.svg.cjs.js.map +1 -0
- package/dist/common/icons/last-page.svg.es.js +10 -0
- package/dist/common/icons/last-page.svg.es.js.map +1 -0
- package/dist/common/utils/NeonDateUtils.cjs.js +1 -1
- package/dist/common/utils/NeonDateUtils.cjs.js.map +1 -1
- package/dist/common/utils/NeonDateUtils.es.js +58 -41
- package/dist/common/utils/NeonDateUtils.es.js.map +1 -1
- package/dist/common/utils/RegisterIcons.cjs.js +1 -1
- package/dist/common/utils/RegisterIcons.cjs.js.map +1 -1
- package/dist/common/utils/RegisterIcons.es.js +36 -34
- package/dist/common/utils/RegisterIcons.es.js.map +1 -1
- package/dist/components/layout/card-list/NeonCardList.cjs.js +1 -1
- package/dist/components/layout/card-list/NeonCardList.cjs.js.map +1 -1
- package/dist/components/layout/card-list/NeonCardList.es.js +51 -50
- package/dist/components/layout/card-list/NeonCardList.es.js.map +1 -1
- package/dist/components/layout/card-list/NeonCardList.vue.cjs.js +1 -1
- package/dist/components/layout/card-list/NeonCardList.vue.cjs.js.map +1 -1
- package/dist/components/layout/card-list/NeonCardList.vue.es.js +47 -46
- package/dist/components/layout/card-list/NeonCardList.vue.es.js.map +1 -1
- package/dist/components/navigation/pagination/NeonPagination.cjs.js +2 -0
- package/dist/components/navigation/pagination/NeonPagination.cjs.js.map +1 -0
- package/dist/components/navigation/pagination/NeonPagination.es.js +71 -0
- package/dist/components/navigation/pagination/NeonPagination.es.js.map +1 -0
- package/dist/components/navigation/pagination/NeonPagination.vue.cjs.js +2 -0
- package/dist/components/navigation/pagination/NeonPagination.vue.cjs.js.map +1 -0
- package/dist/components/navigation/pagination/NeonPagination.vue.es.js +101 -0
- package/dist/components/navigation/pagination/NeonPagination.vue.es.js.map +1 -0
- package/dist/neon.cjs.js +1 -1
- package/dist/neon.es.js +149 -147
- package/dist/neon.es.js.map +1 -1
- package/dist/src/common/models/NeonCardListModel.d.ts +5 -11
- package/dist/src/common/models/NeonIdentifiable.d.ts +9 -0
- package/dist/src/common/models/NeonLoadOnDemandModel.d.ts +22 -0
- package/dist/src/common/models/NeonPaginationModel.d.ts +26 -0
- package/dist/src/common/utils/NeonDateUtils.d.ts +11 -0
- package/dist/src/components/feedback/linear-progress/NeonLinearProgress.d.ts +1 -1
- package/dist/src/components/layout/card-list/NeonCardList.d.ts +556 -215
- package/dist/src/components/navigation/pagination/NeonPagination.d.ts +565 -0
- package/dist/src/components/navigation/pagination/NeonPagination.vue.d.ts +2 -0
- package/dist/src/neon.d.ts +4 -0
- package/package.json +1 -1
- package/src/sass/components/_card-list.scss +14 -33
- package/src/sass/components/_pagination.scss +102 -0
- package/src/sass/components/_skeleton-loader.scss +3 -1
- package/src/sass/components/components.scss +1 -0
- package/src/sass/includes/_dependencies.scss +1 -0
- package/src/sass/theme.scss +4 -0
- package/src/sass/variables.scss +0 -11
- package/dist/components/layout/card-list/card/NeonCardListCard.cjs.js +0 -2
- package/dist/components/layout/card-list/card/NeonCardListCard.cjs.js.map +0 -1
- package/dist/components/layout/card-list/card/NeonCardListCard.es.js +0 -43
- package/dist/components/layout/card-list/card/NeonCardListCard.es.js.map +0 -1
- package/dist/components/layout/card-list/card/NeonCardListCard.vue.cjs.js +0 -2
- package/dist/components/layout/card-list/card/NeonCardListCard.vue.cjs.js.map +0 -1
- package/dist/components/layout/card-list/card/NeonCardListCard.vue.es.js +0 -32
- package/dist/components/layout/card-list/card/NeonCardListCard.vue.es.js.map +0 -1
- package/dist/src/components/layout/card-list/card/NeonCardListCard.d.ts +0 -129
- package/dist/src/components/layout/card-list/card/NeonCardListCard.vue.d.ts +0 -2
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";const s=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="-0.5 -0.5 16 16" fill="none" stroke-linecap="round" height="100%"
|
|
2
|
+
width="100%">
|
|
3
|
+
<path d="M12.75 13.799999999999999L6.45 7.5L12.75 1.2" stroke="currentColor" class="neon-svg--stroke"></path>
|
|
4
|
+
<path d="M2.25 1.2V13.799999999999999" stroke="currentColor" class="neon-svg--stroke"></path>
|
|
5
|
+
</svg>
|
|
6
|
+
`;module.exports=s;
|
|
7
|
+
//# sourceMappingURL=first-page.svg.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"first-page.svg.cjs.js","sources":["../../../src/common/icons/first-page.svg"],"sourcesContent":["export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"-0.5 -0.5 16 16\\\" fill=\\\"none\\\" stroke-linecap=\\\"round\\\" height=\\\"100%\\\"\\n width=\\\"100%\\\">\\n <path d=\\\"M12.75 13.799999999999999L6.45 7.5L12.75 1.2\\\" stroke=\\\"currentColor\\\" class=\\\"neon-svg--stroke\\\"></path>\\n <path d=\\\"M2.25 1.2V13.799999999999999\\\" stroke=\\\"currentColor\\\" class=\\\"neon-svg--stroke\\\"></path>\\n</svg>\\n\""],"names":["firstPage"],"mappings":"aAAA,MAAAA,EAAe;AAAA;AAAA;AAAA;AAAA;AAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const t = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="-0.5 -0.5 16 16" fill="none" stroke-linecap="round" height="100%"
|
|
2
|
+
width="100%">
|
|
3
|
+
<path d="M12.75 13.799999999999999L6.45 7.5L12.75 1.2" stroke="currentColor" class="neon-svg--stroke"></path>
|
|
4
|
+
<path d="M2.25 1.2V13.799999999999999" stroke="currentColor" class="neon-svg--stroke"></path>
|
|
5
|
+
</svg>
|
|
6
|
+
`;
|
|
7
|
+
export {
|
|
8
|
+
t as default
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=first-page.svg.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"first-page.svg.es.js","sources":["../../../src/common/icons/first-page.svg"],"sourcesContent":["export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"-0.5 -0.5 16 16\\\" fill=\\\"none\\\" stroke-linecap=\\\"round\\\" height=\\\"100%\\\"\\n width=\\\"100%\\\">\\n <path d=\\\"M12.75 13.799999999999999L6.45 7.5L12.75 1.2\\\" stroke=\\\"currentColor\\\" class=\\\"neon-svg--stroke\\\"></path>\\n <path d=\\\"M2.25 1.2V13.799999999999999\\\" stroke=\\\"currentColor\\\" class=\\\"neon-svg--stroke\\\"></path>\\n</svg>\\n\""],"names":["firstPage"],"mappings":"AAAA,MAAAA,IAAe;AAAA;AAAA;AAAA;AAAA;AAAA;"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";const s=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="-0.5 -0.5 16 16" fill="none" stroke-linecap="round"
|
|
2
|
+
stroke-linejoin="round" height="100%" width="100%">
|
|
3
|
+
<path d="M2.25 13.799999999999999L8.55 7.5L2.25 1.2" stroke="currentColor" class="neon-svg--stroke"></path>
|
|
4
|
+
<path d="M12.75 1.2V13.799999999999999" stroke="currentColor" class="neon-svg--stroke"></path>
|
|
5
|
+
</svg>
|
|
6
|
+
`;module.exports=s;
|
|
7
|
+
//# sourceMappingURL=last-page.svg.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"last-page.svg.cjs.js","sources":["../../../src/common/icons/last-page.svg"],"sourcesContent":["export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"-0.5 -0.5 16 16\\\" fill=\\\"none\\\" stroke-linecap=\\\"round\\\"\\n stroke-linejoin=\\\"round\\\" height=\\\"100%\\\" width=\\\"100%\\\">\\n <path d=\\\"M2.25 13.799999999999999L8.55 7.5L2.25 1.2\\\" stroke=\\\"currentColor\\\" class=\\\"neon-svg--stroke\\\"></path>\\n <path d=\\\"M12.75 1.2V13.799999999999999\\\" stroke=\\\"currentColor\\\" class=\\\"neon-svg--stroke\\\"></path>\\n</svg>\\n\""],"names":["lastPage"],"mappings":"aAAA,MAAAA,EAAe;AAAA;AAAA;AAAA;AAAA;AAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const n = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="-0.5 -0.5 16 16" fill="none" stroke-linecap="round"
|
|
2
|
+
stroke-linejoin="round" height="100%" width="100%">
|
|
3
|
+
<path d="M2.25 13.799999999999999L8.55 7.5L2.25 1.2" stroke="currentColor" class="neon-svg--stroke"></path>
|
|
4
|
+
<path d="M12.75 1.2V13.799999999999999" stroke="currentColor" class="neon-svg--stroke"></path>
|
|
5
|
+
</svg>
|
|
6
|
+
`;
|
|
7
|
+
export {
|
|
8
|
+
n as default
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=last-page.svg.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"last-page.svg.es.js","sources":["../../../src/common/icons/last-page.svg"],"sourcesContent":["export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" viewBox=\\\"-0.5 -0.5 16 16\\\" fill=\\\"none\\\" stroke-linecap=\\\"round\\\"\\n stroke-linejoin=\\\"round\\\" height=\\\"100%\\\" width=\\\"100%\\\">\\n <path d=\\\"M2.25 13.799999999999999L8.55 7.5L2.25 1.2\\\" stroke=\\\"currentColor\\\" class=\\\"neon-svg--stroke\\\"></path>\\n <path d=\\\"M12.75 1.2V13.799999999999999\\\" stroke=\\\"currentColor\\\" class=\\\"neon-svg--stroke\\\"></path>\\n</svg>\\n\""],"names":["lastPage"],"mappings":"AAAA,MAAAA,IAAe;AAAA;AAAA;AAAA;AAAA;AAAA;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class i{static formatDate(t){const{day:o,monthShortName:n}=i.stringToNeonDate(t.toISOString());return`${n} ${o}`}static formatISOStringToDateAndTime(t,o=!1){const{day:n,monthShortName:a,year:r,time:e,timeShort:s}=i.stringToNeonDate(t);return o?`${n} ${a} ${r}, ${e}`:`${n} ${a} ${r}, ${s}`}static stringToNeonDate(t,o,n=!1){const a=o||navigator.language,r=new Date,e=new Date(!n&&t.length===10?`${t}T${r.toISOString().split("T")[1]}`:t);let s;t.length>10&&(s=e.toLocaleString("en-GB",t.length<=16?{hour12:!1,hour:"2-digit",minute:"2-digit"}:{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"}));const l={year:+e.toLocaleString("en-US",{year:"numeric"}),yearFormatted:e.toLocaleString(a,{year:"numeric"}),month:+e.toLocaleString("en-US",{month:"numeric"}),monthShortName:e.toLocaleString(a,{month:"short"}),monthLongName:e.toLocaleString(a,{month:"long"}),day:+e.toLocaleString("en-US",{day:"numeric"}),dayFormatted:e.toLocaleString(a,{day:"2-digit"})};return s&&(l.time=s,l.timeShort=e.toLocaleString("en-GB",{hour12:!1,hourCycle:"h23",hour:"2-digit",minute:"2-digit"})),l}static dateToIso(t,o=!1){const n=t.toISOString();return o?n:n.split("T")[0]}static dmyToIso(t,o,n){return`${n}-${o<10?"0"+o:o}-${t<10?"0"+t:t}`}static dowNames(t,o="short"){const n=t||navigator.language,a=new Date,r=[];for(;!r[a.getDay()];)r[a.getDay()]=a.toLocaleString(n,{weekday:o}),a.setDate(a.getDate()+1);const e=r.shift();return e&&r.push(e),r}static monthNames(t,o="short"){const n=t||navigator.language;return Array.from(Array(12).keys()).map(a=>new Date(2023,a,15).toLocaleString(n,{month:o}))}static toCalendarConfiguration(t,o,n,a,r){const e=r||navigator.language,s=i.stringToNeonDate(i.dateToIso(new Date),e),l=t?i.stringToNeonDate(t,e,!0):void 0,u=o||s.month,S=o&&n?new Date(n,o-1,15):null,L=(S==null?void 0:S.toLocaleString(e,{month:"long"}))||s.monthLongName,d=n||s.year,$=a||Math.floor(d/10)*10,m=new Date(d,(u+11)%12,1),f=new Date(d,(u+11)%12,1);f.setDate(f.getDate()-1);const h=[];let D=1,w=!1;for(let g=0;g<6;g++){h[g]=[];for(let c=0;c<7;c++)if(g===0&&c<f.getDay())h[g][c]=null;else if(h[g][c]=m.getDate(),D=m.getDate(),m.setDate(m.getDate()+1),m.getDate()===1){for(let y=c+1;y<7;y++)h[g][y]=null;w=!0;break}if(w)break}return{today:s,selected:l,pageMonth:u,pageMonthName:L,pageYear:d,pageDecadeStart:$,dowNames:i.dowNames(e),dowLongNames:i.dowNames(e,"long"),dates:h,lastDayOfMonth:D,months:i.monthNames(e),monthLongNames:i.monthNames(e,"long")}}}exports.NeonDateUtils=i;
|
|
2
2
|
//# sourceMappingURL=NeonDateUtils.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NeonDateUtils.cjs.js","sources":["../../../src/common/utils/NeonDateUtils.ts"],"sourcesContent":["import type { NeonCalendarConfig } from '@/common/models/NeonCalendarConfig';\nimport type { NeonDate } from '@/common/models/NeonDate';\n\n/**\n * Date utilities for general application use as well as internally with the\n * <a href=\"/user-input/date-picker\">NeonDatePicker</a> component.\n */\nexport class NeonDateUtils {\n /**\n * Convert an ISO 8601 formatted string to a locale formatted date with a three letter month, a 2 digit day and a locale formatted time.\n *\n * @param date The date/time as an <a href=\"https://en.wikipedia.org/wiki/ISO_8601\">ISO 8601</a> string.\n * @param locale The locale for which to convert the date for display purposes, defaults to browser locale.\n * @param strict Do not add time component to localise the date.\n *\n * @returns Object representing the provided date.\n */\n public static stringToNeonDate(date: string, locale?: string, strict = false): NeonDate {\n const loc = locale || navigator.language;\n const now = new Date();\n const dateObj = new Date(!strict && date.length === 10 ? `${date}T${now.toISOString().split('T')[1]}` : date);\n let time;\n if (date.length > 10) {\n time = dateObj.toLocaleString(\n 'en-GB', // use en-GB for 0-23 hr offset\n date.length <= 16\n ? { hour12: false, hour: '2-digit', minute: '2-digit' }\n : { hour12: false, hour: '2-digit', minute: '2-digit', second: '2-digit' },\n );\n }\n\n const result: NeonDate = {\n year: +dateObj.toLocaleString('en-US', { year: 'numeric' }),\n yearFormatted: dateObj.toLocaleString(loc, { year: 'numeric' }),\n month: +dateObj.toLocaleString('en-US', { month: 'numeric' }),\n monthShortName: dateObj.toLocaleString(loc, { month: 'short' }),\n monthLongName: dateObj.toLocaleString(loc, { month: 'long' }),\n day: +dateObj.toLocaleString('en-US', { day: 'numeric' }),\n dayFormatted: dateObj.toLocaleString(loc, { day: '2-digit' }),\n };\n\n if (time) {\n result.time = time;\n // use en-GB for 0-23 hr offset\n result.timeShort = dateObj.toLocaleString('en-GB', {\n hour12: false,\n hourCycle: 'h23',\n hour: '2-digit',\n minute: '2-digit',\n });\n }\n\n return result;\n }\n\n /**\n * Convert a date object to an ISO 8601 formatted string. By default, the time is not considered.\n *\n * @param date Javascript date object.\n * @param time Whether to consider the time as part of the conversion to the ISO string.\n *\n * @returns an ISO 8601 formatted date, optionally with the time as well.\n */\n public static dateToIso(date: Date, time = false): string {\n const dateString = date.toISOString();\n return time ? dateString : dateString.split('T')[0];\n }\n\n /**\n * Convert the params received into an ISO 8601 formatted string with only date in it.\n *\n * @param day The number of the day to be used.\n * @param month The number of the month to be used.\n * @param year The number of the year to be used.\n *\n * @returns an ISO 8601 formatted date for the given parameters.\n */\n public static dmyToIso(day: number, month: number, year: number): string {\n return `${year}-${month < 10 ? '0' + month : month}-${day < 10 ? '0' + day : day}`;\n }\n\n /**\n * Returns the days of the week starting at Monday day name translated using the locale received as a first element.\n *\n * @param locale The locale for which to convert the date for display purposes, defaults to browser locale.\n * @param format The format of the returned values\n *\n * @returns an array with the days of the week named according to the locale received.\n */\n public static dowNames(locale?: string, format: 'long' | 'short' | 'narrow' = 'short'): Array<string> {\n const loc = locale || navigator.language;\n const date = new Date();\n\n const weekdays = [];\n while (!weekdays[date.getDay()]) {\n weekdays[date.getDay()] = date.toLocaleString(loc, { weekday: format });\n date.setDate(date.getDate() + 1);\n }\n\n const sunday = weekdays.shift();\n if (sunday) {\n weekdays.push(sunday);\n }\n\n return weekdays;\n }\n\n /**\n * Returns the months of the year starting at January month name translated using the locale received as a first element.\n *\n * @param locale The locale for which to convert the date for display purposes, defaults to browser locale.\n * @param format The format of the month names to return\n *\n * @returns an array with the month names of the year, all named according to the locale received.\n */\n public static monthNames(\n locale?: string,\n format: 'numeric' | '2-digit' | 'long' | 'short' | 'narrow' = 'short',\n ): Array<string> {\n const loc = locale || navigator.language;\n\n return Array.from(Array(12).keys()).map((key) => {\n const date = new Date(2023, key, 15);\n return date.toLocaleString(loc, { month: format });\n });\n }\n\n /**\n * Collate & return the data required to drive the calendar popup in\n * <a href=\"/user-input/date-picker\">NeonDatePicker</a>.\n *\n * @param selectedDate ISO-8601 date-only string for the selected date.\n * @param currentPageMonth month of the current calendar page.\n * @param currentPageYear year of the current calendar page.\n * @param currentPageDecadeStart decade start year of the current calendar page.\n * @param locale user's locale.\n *\n * @returns The calendar configuration.\n */\n public static toCalendarConfiguration(\n selectedDate?: string,\n currentPageMonth?: number,\n currentPageYear?: number,\n currentPageDecadeStart?: number,\n locale?: string,\n ): NeonCalendarConfig {\n const loc = locale || navigator.language;\n const today = NeonDateUtils.stringToNeonDate(NeonDateUtils.dateToIso(new Date()), loc);\n const selected = selectedDate ? NeonDateUtils.stringToNeonDate(selectedDate, loc, true) : undefined;\n // month indexed from 1-12\n const pageMonth = currentPageMonth || today.month;\n\n // month indexed from 0-11\n const pageDate = currentPageMonth && currentPageYear ? new Date(currentPageYear, currentPageMonth - 1, 15) : null;\n const pageMonthName = pageDate?.toLocaleString(loc, { month: 'long' }) || today.monthLongName;\n const pageYear = currentPageYear || today.year;\n const pageDecadeStart = currentPageDecadeStart || Math.floor(pageYear / 10) * 10;\n\n // determine dow of first day of month. Months are indexed from 0 here\n const date = new Date(pageYear, (pageMonth + 11) % 12, 1);\n const offsetDate = new Date(pageYear, (pageMonth + 11) % 12, 1);\n offsetDate.setDate(offsetDate.getDate() - 1);\n\n const dates: Array<Array<number | null>> = [];\n\n let lastDayOfMonth = 1;\n let done = false;\n\n for (let row = 0; row < 6; row++) {\n dates[row] = [];\n\n for (let col = 0; col < 7; col++) {\n if (row === 0 && col < offsetDate.getDay()) {\n dates[row][col] = null;\n } else {\n dates[row][col] = date.getDate();\n lastDayOfMonth = date.getDate();\n date.setDate(date.getDate() + 1);\n\n if (date.getDate() === 1) {\n for (let i = col + 1; i < 7; i++) {\n dates[row][i] = null;\n }\n done = true;\n break;\n }\n }\n }\n\n if (done) {\n break;\n }\n }\n\n return {\n today,\n selected,\n pageMonth,\n pageMonthName,\n pageYear,\n pageDecadeStart,\n dowNames: NeonDateUtils.dowNames(loc),\n dowLongNames: NeonDateUtils.dowNames(loc, 'long'),\n dates,\n lastDayOfMonth,\n months: NeonDateUtils.monthNames(loc),\n monthLongNames: NeonDateUtils.monthNames(loc, 'long'),\n };\n }\n}\n"],"names":["NeonDateUtils","date","locale","strict","loc","now","dateObj","time","result","dateString","day","month","year","format","weekdays","sunday","key","selectedDate","currentPageMonth","currentPageYear","currentPageDecadeStart","today","selected","pageMonth","pageDate","pageMonthName","pageYear","pageDecadeStart","offsetDate","dates","lastDayOfMonth","done","row","col","i"],"mappings":"gFAOO,MAAMA,CAAc,CAUzB,OAAc,iBAAiBC,EAAcC,EAAiBC,EAAS,GAAiB,CACtF,MAAMC,EAAMF,GAAU,UAAU,SAC1BG,MAAU,KACVC,EAAU,IAAI,KAAK,CAACH,GAAUF,EAAK,SAAW,GAAK,GAAGA,CAAI,IAAII,EAAI,YAAA,EAAc,MAAM,GAAG,EAAE,CAAC,CAAC,GAAKJ,CAAI,EAC5G,IAAIM,EACAN,EAAK,OAAS,KAChBM,EAAOD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C,CAAG,EAAI,aAElBJ,EAAMG,CAAG,EAAEC,CAAG,EAAIhC,EAAK,QAAA,EACvB6B,EAAiB7B,EAAK,QAAA,EACtBA,EAAK,QAAQA,EAAK,QAAA,EAAY,CAAC,EAE3BA,EAAK,QAAA,IAAc,EAAG,CACxB,QAASiC,EAAID,EAAM,EAAGC,EAAI,EAAGA,IAC3BL,EAAMG,CAAG,EAAEE,CAAC,EAAI,KAElBH,EAAO,GACP,KACF,CAIJ,GAAIA,EACF,KAEJ,CAEA,MAAO,CACL,MAAAV,EACA,SAAAC,EACA,UAAAC,EACA,cAAAE,EACA,SAAAC,EACA,gBAAAC,EACA,SAAU3B,EAAc,SAASI,CAAG,EACpC,aAAcJ,EAAc,SAASI,EAAK,MAAM,EAChD,MAAAyB,EACA,eAAAC,EACA,OAAQ9B,EAAc,WAAWI,CAAG,EACpC,eAAgBJ,EAAc,WAAWI,EAAK,MAAM,CAAA,CAExD,CACF"}
|
|
1
|
+
{"version":3,"file":"NeonDateUtils.cjs.js","sources":["../../../src/common/utils/NeonDateUtils.ts"],"sourcesContent":["import type { NeonCalendarConfig } from '@/common/models/NeonCalendarConfig';\nimport type { NeonDate } from '@/common/models/NeonDate';\n\n/**\n * Date utilities for general application use as well as internally with the\n * <a href=\"/user-input/date-picker\">NeonDatePicker</a> component.\n */\nexport class NeonDateUtils {\n /**\n * Format a Date object as a locale formatted date with a three letter month and a 2 digit day.\n * @param value The date to format.\n */\n public static formatDate(value: Date) {\n const { day, monthShortName } = NeonDateUtils.stringToNeonDate(value.toISOString());\n return `${monthShortName} ${day}`;\n }\n\n /**\n * Format an ISO 8601 string to a locale formatted date with a three letter month and a 2 digit day and the time.\n * @param value ISO date string\n * @param seconds boolean indicating whether to display seconds\n */\n public static formatISOStringToDateAndTime(value: string, seconds = false) {\n const { day, monthShortName, year, time, timeShort } = NeonDateUtils.stringToNeonDate(value);\n return seconds ? `${day} ${monthShortName} ${year}, ${time}` : `${day} ${monthShortName} ${year}, ${timeShort}`;\n }\n\n /**\n * Convert an ISO 8601 formatted string to a locale formatted date with a three letter month, a 2 digit day and a locale formatted time.\n *\n * @param date The date/time as an <a href=\"https://en.wikipedia.org/wiki/ISO_8601\">ISO 8601</a> string.\n * @param locale The locale for which to convert the date for display purposes, defaults to browser locale.\n * @param strict Do not add time component to localise the date.\n *\n * @returns Object representing the provided date.\n */\n public static stringToNeonDate(date: string, locale?: string, strict = false): NeonDate {\n const loc = locale || navigator.language;\n const now = new Date();\n const dateObj = new Date(!strict && date.length === 10 ? `${date}T${now.toISOString().split('T')[1]}` : date);\n let time;\n if (date.length > 10) {\n time = dateObj.toLocaleString(\n 'en-GB', // use en-GB for 0-23 hr offset\n date.length <= 16\n ? { hour12: false, hour: '2-digit', minute: '2-digit' }\n : { hour12: false, hour: '2-digit', minute: '2-digit', second: '2-digit' },\n );\n }\n\n const result: NeonDate = {\n year: +dateObj.toLocaleString('en-US', { year: 'numeric' }),\n yearFormatted: dateObj.toLocaleString(loc, { year: 'numeric' }),\n month: +dateObj.toLocaleString('en-US', { month: 'numeric' }),\n monthShortName: dateObj.toLocaleString(loc, { month: 'short' }),\n monthLongName: dateObj.toLocaleString(loc, { month: 'long' }),\n day: +dateObj.toLocaleString('en-US', { day: 'numeric' }),\n dayFormatted: dateObj.toLocaleString(loc, { day: '2-digit' }),\n };\n\n if (time) {\n result.time = time;\n // use en-GB for 0-23 hr offset\n result.timeShort = dateObj.toLocaleString('en-GB', {\n hour12: false,\n hourCycle: 'h23',\n hour: '2-digit',\n minute: '2-digit',\n });\n }\n\n return result;\n }\n\n /**\n * Convert a date object to an ISO 8601 formatted string. By default, the time is not considered.\n *\n * @param date Javascript date object.\n * @param time Whether to consider the time as part of the conversion to the ISO string.\n *\n * @returns an ISO 8601 formatted date, optionally with the time as well.\n */\n public static dateToIso(date: Date, time = false): string {\n const dateString = date.toISOString();\n return time ? dateString : dateString.split('T')[0];\n }\n\n /**\n * Convert the params received into an ISO 8601 formatted string with only date in it.\n *\n * @param day The number of the day to be used.\n * @param month The number of the month to be used.\n * @param year The number of the year to be used.\n *\n * @returns an ISO 8601 formatted date for the given parameters.\n */\n public static dmyToIso(day: number, month: number, year: number): string {\n return `${year}-${month < 10 ? '0' + month : month}-${day < 10 ? '0' + day : day}`;\n }\n\n /**\n * Returns the days of the week starting at Monday day name translated using the locale received as a first element.\n *\n * @param locale The locale for which to convert the date for display purposes, defaults to browser locale.\n * @param format The format of the returned values\n *\n * @returns an array with the days of the week named according to the locale received.\n */\n public static dowNames(locale?: string, format: 'long' | 'short' | 'narrow' = 'short'): Array<string> {\n const loc = locale || navigator.language;\n const date = new Date();\n\n const weekdays = [];\n while (!weekdays[date.getDay()]) {\n weekdays[date.getDay()] = date.toLocaleString(loc, { weekday: format });\n date.setDate(date.getDate() + 1);\n }\n\n const sunday = weekdays.shift();\n if (sunday) {\n weekdays.push(sunday);\n }\n\n return weekdays;\n }\n\n /**\n * Returns the months of the year starting at January month name translated using the locale received as a first element.\n *\n * @param locale The locale for which to convert the date for display purposes, defaults to browser locale.\n * @param format The format of the month names to return\n *\n * @returns an array with the month names of the year, all named according to the locale received.\n */\n public static monthNames(\n locale?: string,\n format: 'numeric' | '2-digit' | 'long' | 'short' | 'narrow' = 'short',\n ): Array<string> {\n const loc = locale || navigator.language;\n\n return Array.from(Array(12).keys()).map((key) => {\n const date = new Date(2023, key, 15);\n return date.toLocaleString(loc, { month: format });\n });\n }\n\n /**\n * Collate & return the data required to drive the calendar popup in\n * <a href=\"/user-input/date-picker\">NeonDatePicker</a>.\n *\n * @param selectedDate ISO-8601 date-only string for the selected date.\n * @param currentPageMonth month of the current calendar page.\n * @param currentPageYear year of the current calendar page.\n * @param currentPageDecadeStart decade start year of the current calendar page.\n * @param locale user's locale.\n *\n * @returns The calendar configuration.\n */\n public static toCalendarConfiguration(\n selectedDate?: string,\n currentPageMonth?: number,\n currentPageYear?: number,\n currentPageDecadeStart?: number,\n locale?: string,\n ): NeonCalendarConfig {\n const loc = locale || navigator.language;\n const today = NeonDateUtils.stringToNeonDate(NeonDateUtils.dateToIso(new Date()), loc);\n const selected = selectedDate ? NeonDateUtils.stringToNeonDate(selectedDate, loc, true) : undefined;\n // month indexed from 1-12\n const pageMonth = currentPageMonth || today.month;\n\n // month indexed from 0-11\n const pageDate = currentPageMonth && currentPageYear ? new Date(currentPageYear, currentPageMonth - 1, 15) : null;\n const pageMonthName = pageDate?.toLocaleString(loc, { month: 'long' }) || today.monthLongName;\n const pageYear = currentPageYear || today.year;\n const pageDecadeStart = currentPageDecadeStart || Math.floor(pageYear / 10) * 10;\n\n // determine dow of first day of month. Months are indexed from 0 here\n const date = new Date(pageYear, (pageMonth + 11) % 12, 1);\n const offsetDate = new Date(pageYear, (pageMonth + 11) % 12, 1);\n offsetDate.setDate(offsetDate.getDate() - 1);\n\n const dates: Array<Array<number | null>> = [];\n\n let lastDayOfMonth = 1;\n let done = false;\n\n for (let row = 0; row < 6; row++) {\n dates[row] = [];\n\n for (let col = 0; col < 7; col++) {\n if (row === 0 && col < offsetDate.getDay()) {\n dates[row][col] = null;\n } else {\n dates[row][col] = date.getDate();\n lastDayOfMonth = date.getDate();\n date.setDate(date.getDate() + 1);\n\n if (date.getDate() === 1) {\n for (let i = col + 1; i < 7; i++) {\n dates[row][i] = null;\n }\n done = true;\n break;\n }\n }\n }\n\n if (done) {\n break;\n }\n }\n\n return {\n today,\n selected,\n pageMonth,\n pageMonthName,\n pageYear,\n pageDecadeStart,\n dowNames: NeonDateUtils.dowNames(loc),\n dowLongNames: NeonDateUtils.dowNames(loc, 'long'),\n dates,\n lastDayOfMonth,\n months: NeonDateUtils.monthNames(loc),\n monthLongNames: NeonDateUtils.monthNames(loc, 'long'),\n };\n }\n}\n"],"names":["NeonDateUtils","value","day","monthShortName","seconds","year","time","timeShort","date","locale","strict","loc","now","dateObj","result","dateString","month","format","weekdays","sunday","key","selectedDate","currentPageMonth","currentPageYear","currentPageDecadeStart","today","selected","pageMonth","pageDate","pageMonthName","pageYear","pageDecadeStart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ASW,EAAK,MAAM,EAChD,MAAAsB,EACA,eAAAC,EACA,OAAQlC,EAAc,WAAWW,CAAG,EACpC,eAAgBX,EAAc,WAAWW,EAAK,MAAM,CAAA,CAExD,CACF"}
|
|
@@ -1,4 +1,21 @@
|
|
|
1
1
|
class i {
|
|
2
|
+
/**
|
|
3
|
+
* Format a Date object as a locale formatted date with a three letter month and a 2 digit day.
|
|
4
|
+
* @param value The date to format.
|
|
5
|
+
*/
|
|
6
|
+
static formatDate(t) {
|
|
7
|
+
const { day: o, monthShortName: n } = i.stringToNeonDate(t.toISOString());
|
|
8
|
+
return `${n} ${o}`;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Format an ISO 8601 string to a locale formatted date with a three letter month and a 2 digit day and the time.
|
|
12
|
+
* @param value ISO date string
|
|
13
|
+
* @param seconds boolean indicating whether to display seconds
|
|
14
|
+
*/
|
|
15
|
+
static formatISOStringToDateAndTime(t, o = !1) {
|
|
16
|
+
const { day: n, monthShortName: a, year: r, time: e, timeShort: s } = i.stringToNeonDate(t);
|
|
17
|
+
return o ? `${n} ${a} ${r}, ${e}` : `${n} ${a} ${r}, ${s}`;
|
|
18
|
+
}
|
|
2
19
|
/**
|
|
3
20
|
* Convert an ISO 8601 formatted string to a locale formatted date with a three letter month, a 2 digit day and a locale formatted time.
|
|
4
21
|
*
|
|
@@ -8,29 +25,29 @@ class i {
|
|
|
8
25
|
*
|
|
9
26
|
* @returns Object representing the provided date.
|
|
10
27
|
*/
|
|
11
|
-
static stringToNeonDate(
|
|
12
|
-
const a = o || navigator.language, r = /* @__PURE__ */ new Date(),
|
|
28
|
+
static stringToNeonDate(t, o, n = !1) {
|
|
29
|
+
const a = o || navigator.language, r = /* @__PURE__ */ new Date(), e = new Date(!n && t.length === 10 ? `${t}T${r.toISOString().split("T")[1]}` : t);
|
|
13
30
|
let s;
|
|
14
|
-
|
|
31
|
+
t.length > 10 && (s = e.toLocaleString(
|
|
15
32
|
"en-GB",
|
|
16
33
|
// use en-GB for 0-23 hr offset
|
|
17
|
-
|
|
34
|
+
t.length <= 16 ? { hour12: !1, hour: "2-digit", minute: "2-digit" } : { hour12: !1, hour: "2-digit", minute: "2-digit", second: "2-digit" }
|
|
18
35
|
));
|
|
19
|
-
const
|
|
20
|
-
year: +
|
|
21
|
-
yearFormatted:
|
|
22
|
-
month: +
|
|
23
|
-
monthShortName:
|
|
24
|
-
monthLongName:
|
|
25
|
-
day: +
|
|
26
|
-
dayFormatted:
|
|
36
|
+
const m = {
|
|
37
|
+
year: +e.toLocaleString("en-US", { year: "numeric" }),
|
|
38
|
+
yearFormatted: e.toLocaleString(a, { year: "numeric" }),
|
|
39
|
+
month: +e.toLocaleString("en-US", { month: "numeric" }),
|
|
40
|
+
monthShortName: e.toLocaleString(a, { month: "short" }),
|
|
41
|
+
monthLongName: e.toLocaleString(a, { month: "long" }),
|
|
42
|
+
day: +e.toLocaleString("en-US", { day: "numeric" }),
|
|
43
|
+
dayFormatted: e.toLocaleString(a, { day: "2-digit" })
|
|
27
44
|
};
|
|
28
|
-
return s && (
|
|
45
|
+
return s && (m.time = s, m.timeShort = e.toLocaleString("en-GB", {
|
|
29
46
|
hour12: !1,
|
|
30
47
|
hourCycle: "h23",
|
|
31
48
|
hour: "2-digit",
|
|
32
49
|
minute: "2-digit"
|
|
33
|
-
})),
|
|
50
|
+
})), m;
|
|
34
51
|
}
|
|
35
52
|
/**
|
|
36
53
|
* Convert a date object to an ISO 8601 formatted string. By default, the time is not considered.
|
|
@@ -40,8 +57,8 @@ class i {
|
|
|
40
57
|
*
|
|
41
58
|
* @returns an ISO 8601 formatted date, optionally with the time as well.
|
|
42
59
|
*/
|
|
43
|
-
static dateToIso(
|
|
44
|
-
const n =
|
|
60
|
+
static dateToIso(t, o = !1) {
|
|
61
|
+
const n = t.toISOString();
|
|
45
62
|
return o ? n : n.split("T")[0];
|
|
46
63
|
}
|
|
47
64
|
/**
|
|
@@ -53,8 +70,8 @@ class i {
|
|
|
53
70
|
*
|
|
54
71
|
* @returns an ISO 8601 formatted date for the given parameters.
|
|
55
72
|
*/
|
|
56
|
-
static dmyToIso(
|
|
57
|
-
return `${n}-${o < 10 ? "0" + o : o}-${
|
|
73
|
+
static dmyToIso(t, o, n) {
|
|
74
|
+
return `${n}-${o < 10 ? "0" + o : o}-${t < 10 ? "0" + t : t}`;
|
|
58
75
|
}
|
|
59
76
|
/**
|
|
60
77
|
* Returns the days of the week starting at Monday day name translated using the locale received as a first element.
|
|
@@ -64,12 +81,12 @@ class i {
|
|
|
64
81
|
*
|
|
65
82
|
* @returns an array with the days of the week named according to the locale received.
|
|
66
83
|
*/
|
|
67
|
-
static dowNames(
|
|
68
|
-
const n =
|
|
84
|
+
static dowNames(t, o = "short") {
|
|
85
|
+
const n = t || navigator.language, a = /* @__PURE__ */ new Date(), r = [];
|
|
69
86
|
for (; !r[a.getDay()]; )
|
|
70
87
|
r[a.getDay()] = a.toLocaleString(n, { weekday: o }), a.setDate(a.getDate() + 1);
|
|
71
|
-
const
|
|
72
|
-
return
|
|
88
|
+
const e = r.shift();
|
|
89
|
+
return e && r.push(e), r;
|
|
73
90
|
}
|
|
74
91
|
/**
|
|
75
92
|
* Returns the months of the year starting at January month name translated using the locale received as a first element.
|
|
@@ -79,8 +96,8 @@ class i {
|
|
|
79
96
|
*
|
|
80
97
|
* @returns an array with the month names of the year, all named according to the locale received.
|
|
81
98
|
*/
|
|
82
|
-
static monthNames(
|
|
83
|
-
const n =
|
|
99
|
+
static monthNames(t, o = "short") {
|
|
100
|
+
const n = t || navigator.language;
|
|
84
101
|
return Array.from(Array(12).keys()).map((a) => new Date(2023, a, 15).toLocaleString(n, { month: o }));
|
|
85
102
|
}
|
|
86
103
|
/**
|
|
@@ -95,38 +112,38 @@ class i {
|
|
|
95
112
|
*
|
|
96
113
|
* @returns The calendar configuration.
|
|
97
114
|
*/
|
|
98
|
-
static toCalendarConfiguration(
|
|
99
|
-
const
|
|
115
|
+
static toCalendarConfiguration(t, o, n, a, r) {
|
|
116
|
+
const e = r || navigator.language, s = i.stringToNeonDate(i.dateToIso(/* @__PURE__ */ new Date()), e), m = t ? i.stringToNeonDate(t, e, !0) : void 0, u = o || s.month, S = o && n ? new Date(n, o - 1, 15) : null, L = (S == null ? void 0 : S.toLocaleString(e, { month: "long" })) || s.monthLongName, d = n || s.year, $ = a || Math.floor(d / 10) * 10, l = new Date(d, (u + 11) % 12, 1), f = new Date(d, (u + 11) % 12, 1);
|
|
100
117
|
f.setDate(f.getDate() - 1);
|
|
101
118
|
const h = [];
|
|
102
|
-
let
|
|
119
|
+
let D = 1, w = !1;
|
|
103
120
|
for (let g = 0; g < 6; g++) {
|
|
104
121
|
h[g] = [];
|
|
105
|
-
for (let
|
|
106
|
-
if (g === 0 &&
|
|
107
|
-
h[g][
|
|
108
|
-
else if (h[g][
|
|
109
|
-
for (let y =
|
|
122
|
+
for (let c = 0; c < 7; c++)
|
|
123
|
+
if (g === 0 && c < f.getDay())
|
|
124
|
+
h[g][c] = null;
|
|
125
|
+
else if (h[g][c] = l.getDate(), D = l.getDate(), l.setDate(l.getDate() + 1), l.getDate() === 1) {
|
|
126
|
+
for (let y = c + 1; y < 7; y++)
|
|
110
127
|
h[g][y] = null;
|
|
111
|
-
|
|
128
|
+
w = !0;
|
|
112
129
|
break;
|
|
113
130
|
}
|
|
114
|
-
if (
|
|
131
|
+
if (w)
|
|
115
132
|
break;
|
|
116
133
|
}
|
|
117
134
|
return {
|
|
118
135
|
today: s,
|
|
119
|
-
selected:
|
|
136
|
+
selected: m,
|
|
120
137
|
pageMonth: u,
|
|
121
138
|
pageMonthName: L,
|
|
122
139
|
pageYear: d,
|
|
123
|
-
pageDecadeStart:
|
|
124
|
-
dowNames: i.dowNames(
|
|
125
|
-
dowLongNames: i.dowNames(
|
|
140
|
+
pageDecadeStart: $,
|
|
141
|
+
dowNames: i.dowNames(e),
|
|
142
|
+
dowLongNames: i.dowNames(e, "long"),
|
|
126
143
|
dates: h,
|
|
127
|
-
lastDayOfMonth:
|
|
128
|
-
months: i.monthNames(
|
|
129
|
-
monthLongNames: i.monthNames(
|
|
144
|
+
lastDayOfMonth: D,
|
|
145
|
+
months: i.monthNames(e),
|
|
146
|
+
monthLongNames: i.monthNames(e, "long")
|
|
130
147
|
};
|
|
131
148
|
}
|
|
132
149
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NeonDateUtils.es.js","sources":["../../../src/common/utils/NeonDateUtils.ts"],"sourcesContent":["import type { NeonCalendarConfig } from '@/common/models/NeonCalendarConfig';\nimport type { NeonDate } from '@/common/models/NeonDate';\n\n/**\n * Date utilities for general application use as well as internally with the\n * <a href=\"/user-input/date-picker\">NeonDatePicker</a> component.\n */\nexport class NeonDateUtils {\n /**\n * Convert an ISO 8601 formatted string to a locale formatted date with a three letter month, a 2 digit day and a locale formatted time.\n *\n * @param date The date/time as an <a href=\"https://en.wikipedia.org/wiki/ISO_8601\">ISO 8601</a> string.\n * @param locale The locale for which to convert the date for display purposes, defaults to browser locale.\n * @param strict Do not add time component to localise the date.\n *\n * @returns Object representing the provided date.\n */\n public static stringToNeonDate(date: string, locale?: string, strict = false): NeonDate {\n const loc = locale || navigator.language;\n const now = new Date();\n const dateObj = new Date(!strict && date.length === 10 ? `${date}T${now.toISOString().split('T')[1]}` : date);\n let time;\n if (date.length > 10) {\n time = dateObj.toLocaleString(\n 'en-GB', // use en-GB for 0-23 hr offset\n date.length <= 16\n ? { hour12: false, hour: '2-digit', minute: '2-digit' }\n : { hour12: false, hour: '2-digit', minute: '2-digit', second: '2-digit' },\n );\n }\n\n const result: NeonDate = {\n year: +dateObj.toLocaleString('en-US', { year: 'numeric' }),\n yearFormatted: dateObj.toLocaleString(loc, { year: 'numeric' }),\n month: +dateObj.toLocaleString('en-US', { month: 'numeric' }),\n monthShortName: dateObj.toLocaleString(loc, { month: 'short' }),\n monthLongName: dateObj.toLocaleString(loc, { month: 'long' }),\n day: +dateObj.toLocaleString('en-US', { day: 'numeric' }),\n dayFormatted: dateObj.toLocaleString(loc, { day: '2-digit' }),\n };\n\n if (time) {\n result.time = time;\n // use en-GB for 0-23 hr offset\n result.timeShort = dateObj.toLocaleString('en-GB', {\n hour12: false,\n hourCycle: 'h23',\n hour: '2-digit',\n minute: '2-digit',\n });\n }\n\n return result;\n }\n\n /**\n * Convert a date object to an ISO 8601 formatted string. By default, the time is not considered.\n *\n * @param date Javascript date object.\n * @param time Whether to consider the time as part of the conversion to the ISO string.\n *\n * @returns an ISO 8601 formatted date, optionally with the time as well.\n */\n public static dateToIso(date: Date, time = false): string {\n const dateString = date.toISOString();\n return time ? dateString : dateString.split('T')[0];\n }\n\n /**\n * Convert the params received into an ISO 8601 formatted string with only date in it.\n *\n * @param day The number of the day to be used.\n * @param month The number of the month to be used.\n * @param year The number of the year to be used.\n *\n * @returns an ISO 8601 formatted date for the given parameters.\n */\n public static dmyToIso(day: number, month: number, year: number): string {\n return `${year}-${month < 10 ? '0' + month : month}-${day < 10 ? '0' + day : day}`;\n }\n\n /**\n * Returns the days of the week starting at Monday day name translated using the locale received as a first element.\n *\n * @param locale The locale for which to convert the date for display purposes, defaults to browser locale.\n * @param format The format of the returned values\n *\n * @returns an array with the days of the week named according to the locale received.\n */\n public static dowNames(locale?: string, format: 'long' | 'short' | 'narrow' = 'short'): Array<string> {\n const loc = locale || navigator.language;\n const date = new Date();\n\n const weekdays = [];\n while (!weekdays[date.getDay()]) {\n weekdays[date.getDay()] = date.toLocaleString(loc, { weekday: format });\n date.setDate(date.getDate() + 1);\n }\n\n const sunday = weekdays.shift();\n if (sunday) {\n weekdays.push(sunday);\n }\n\n return weekdays;\n }\n\n /**\n * Returns the months of the year starting at January month name translated using the locale received as a first element.\n *\n * @param locale The locale for which to convert the date for display purposes, defaults to browser locale.\n * @param format The format of the month names to return\n *\n * @returns an array with the month names of the year, all named according to the locale received.\n */\n public static monthNames(\n locale?: string,\n format: 'numeric' | '2-digit' | 'long' | 'short' | 'narrow' = 'short',\n ): Array<string> {\n const loc = locale || navigator.language;\n\n return Array.from(Array(12).keys()).map((key) => {\n const date = new Date(2023, key, 15);\n return date.toLocaleString(loc, { month: format });\n });\n }\n\n /**\n * Collate & return the data required to drive the calendar popup in\n * <a href=\"/user-input/date-picker\">NeonDatePicker</a>.\n *\n * @param selectedDate ISO-8601 date-only string for the selected date.\n * @param currentPageMonth month of the current calendar page.\n * @param currentPageYear year of the current calendar page.\n * @param currentPageDecadeStart decade start year of the current calendar page.\n * @param locale user's locale.\n *\n * @returns The calendar configuration.\n */\n public static toCalendarConfiguration(\n selectedDate?: string,\n currentPageMonth?: number,\n currentPageYear?: number,\n currentPageDecadeStart?: number,\n locale?: string,\n ): NeonCalendarConfig {\n const loc = locale || navigator.language;\n const today = NeonDateUtils.stringToNeonDate(NeonDateUtils.dateToIso(new Date()), loc);\n const selected = selectedDate ? NeonDateUtils.stringToNeonDate(selectedDate, loc, true) : undefined;\n // month indexed from 1-12\n const pageMonth = currentPageMonth || today.month;\n\n // month indexed from 0-11\n const pageDate = currentPageMonth && currentPageYear ? new Date(currentPageYear, currentPageMonth - 1, 15) : null;\n const pageMonthName = pageDate?.toLocaleString(loc, { month: 'long' }) || today.monthLongName;\n const pageYear = currentPageYear || today.year;\n const pageDecadeStart = currentPageDecadeStart || Math.floor(pageYear / 10) * 10;\n\n // determine dow of first day of month. Months are indexed from 0 here\n const date = new Date(pageYear, (pageMonth + 11) % 12, 1);\n const offsetDate = new Date(pageYear, (pageMonth + 11) % 12, 1);\n offsetDate.setDate(offsetDate.getDate() - 1);\n\n const dates: Array<Array<number | null>> = [];\n\n let lastDayOfMonth = 1;\n let done = false;\n\n for (let row = 0; row < 6; row++) {\n dates[row] = [];\n\n for (let col = 0; col < 7; col++) {\n if (row === 0 && col < offsetDate.getDay()) {\n dates[row][col] = null;\n } else {\n dates[row][col] = date.getDate();\n lastDayOfMonth = date.getDate();\n date.setDate(date.getDate() + 1);\n\n if (date.getDate() === 1) {\n for (let i = col + 1; i < 7; i++) {\n dates[row][i] = null;\n }\n done = true;\n break;\n }\n }\n }\n\n if (done) {\n break;\n }\n }\n\n return {\n today,\n selected,\n pageMonth,\n pageMonthName,\n pageYear,\n pageDecadeStart,\n dowNames: NeonDateUtils.dowNames(loc),\n dowLongNames: NeonDateUtils.dowNames(loc, 'long'),\n dates,\n lastDayOfMonth,\n months: NeonDateUtils.monthNames(loc),\n monthLongNames: NeonDateUtils.monthNames(loc, 'long'),\n };\n }\n}\n"],"names":["NeonDateUtils","date","locale","strict","loc","now","dateObj","time","result","dateString","day","month","year","format","weekdays","sunday","key","selectedDate","currentPageMonth","currentPageYear","currentPageDecadeStart","today","selected","pageMonth","pageDate","pageMonthName","pageYear","pageDecadeStart","offsetDate","dates","lastDayOfMonth","done","row","col","i"],"mappings":"AAOO,MAAMA,EAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUzB,OAAc,iBAAiBC,GAAcC,GAAiBC,IAAS,IAAiB;AACtF,UAAMC,IAAMF,KAAU,UAAU,UAC1BG,wBAAU,KAAA,GACVC,IAAU,IAAI,KAAK,CAACH,KAAUF,EAAK,WAAW,KAAK,GAAGA,CAAI,IAAII,EAAI,YAAA,EAAc,MAAM,GAAG,EAAE,CAAC,CAAC,KAAKJ,CAAI;AAC5G,QAAIM;AACJ,IAAIN,EAAK,SAAS,OAChBM,IAAOD,EAAQ;AAAA,MACb;AAAA;AAAA,MACAL,EAAK,UAAU,KACX,EAAE,QAAQ,IAAO,MAAM,WAAW,QAAQ,cAC1C,EAAE,QAAQ,IAAO,MAAM,WAAW,QAAQ,WAAW,QAAQ,UAAA;AAAA,IAAU;AAI/E,UAAMO,IAAmB;AAAA,MACvB,MAAM,CAACF,EAAQ,eAAe,SAAS,EAAE,MAAM,WAAW;AAAA,MAC1D,eAAeA,EAAQ,eAAeF,GAAK,EAAE,MAAM,WAAW;AAAA,MAC9D,OAAO,CAACE,EAAQ,eAAe,SAAS,EAAE,OAAO,WAAW;AAAA,MAC5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GA,IAAM,GAAGA;AACzB,YAAID,MAAQ,KAAKC,IAAML,EAAW;AAChC,UAAAC,EAAMG,CAAG,EAAEC,CAAG,IAAI;AAAA,iBAElBJ,EAAMG,CAAG,EAAEC,CAAG,IAAIhC,EAAK,QAAA,GACvB6B,IAAiB7B,EAAK,QAAA,GACtBA,EAAK,QAAQA,EAAK,QAAA,IAAY,CAAC,GAE3BA,EAAK,QAAA,MAAc,GAAG;AACxB,mBAASiC,IAAID,IAAM,GAAGC,IAAI,GAAGA;AAC3B,YAAAL,EAAMG,CAAG,EAAEE,CAAC,IAAI;AAElB,UAAAH,IAAO;AACP;AAAA,QACF;AAIJ,UAAIA;AACF;AAAA,IAEJ;AAEA,WAAO;AAAA,MACL,OAAAV;AAAA,MACA,UAAAC;AAAA,MACA,WAAAC;AAAA,MACA,eAAAE;AAAA,MACA,UAAAC;AAAA,MACA,iBAAAC;AAAA,MACA,UAAU3B,EAAc,SAASI,CAAG;AAAA,MACpC,cAAcJ,EAAc,SAASI,GAAK,MAAM;AAAA,MAChD,OAAAyB;AAAA,MACA,gBAAAC;AAAA,MACA,QAAQ9B,EAAc,WAAWI,CAAG;AAAA,MACpC,gBAAgBJ,EAAc,WAAWI,GAAK,MAAM;AAAA,IAAA;AAAA,EAExD;AACF;"}
|
|
1
|
+
{"version":3,"file":"NeonDateUtils.es.js","sources":["../../../src/common/utils/NeonDateUtils.ts"],"sourcesContent":["import type { NeonCalendarConfig } from '@/common/models/NeonCalendarConfig';\nimport type { NeonDate } from '@/common/models/NeonDate';\n\n/**\n * Date utilities for general application use as well as internally with the\n * <a href=\"/user-input/date-picker\">NeonDatePicker</a> component.\n */\nexport class NeonDateUtils {\n /**\n * Format a Date object as a locale formatted date with a three letter month and a 2 digit day.\n * @param value The date to format.\n */\n public static formatDate(value: Date) {\n const { day, monthShortName } = NeonDateUtils.stringToNeonDate(value.toISOString());\n return `${monthShortName} ${day}`;\n }\n\n /**\n * Format an ISO 8601 string to a locale formatted date with a three letter month and a 2 digit day and the time.\n * @param value ISO date string\n * @param seconds boolean indicating whether to display seconds\n */\n public static formatISOStringToDateAndTime(value: string, seconds = false) {\n const { day, monthShortName, year, time, timeShort } = NeonDateUtils.stringToNeonDate(value);\n return seconds ? `${day} ${monthShortName} ${year}, ${time}` : `${day} ${monthShortName} ${year}, ${timeShort}`;\n }\n\n /**\n * Convert an ISO 8601 formatted string to a locale formatted date with a three letter month, a 2 digit day and a locale formatted time.\n *\n * @param date The date/time as an <a href=\"https://en.wikipedia.org/wiki/ISO_8601\">ISO 8601</a> string.\n * @param locale The locale for which to convert the date for display purposes, defaults to browser locale.\n * @param strict Do not add time component to localise the date.\n *\n * @returns Object representing the provided date.\n */\n public static stringToNeonDate(date: string, locale?: string, strict = false): NeonDate {\n const loc = locale || navigator.language;\n const now = new Date();\n const dateObj = new Date(!strict && date.length === 10 ? `${date}T${now.toISOString().split('T')[1]}` : date);\n let time;\n if (date.length > 10) {\n time = dateObj.toLocaleString(\n 'en-GB', // use en-GB for 0-23 hr offset\n date.length <= 16\n ? { hour12: false, hour: '2-digit', minute: '2-digit' }\n : { hour12: false, hour: '2-digit', minute: '2-digit', second: '2-digit' },\n );\n }\n\n const result: NeonDate = {\n year: +dateObj.toLocaleString('en-US', { year: 'numeric' }),\n yearFormatted: dateObj.toLocaleString(loc, { year: 'numeric' }),\n month: +dateObj.toLocaleString('en-US', { month: 'numeric' }),\n monthShortName: dateObj.toLocaleString(loc, { month: 'short' }),\n monthLongName: dateObj.toLocaleString(loc, { month: 'long' }),\n day: +dateObj.toLocaleString('en-US', { day: 'numeric' }),\n dayFormatted: dateObj.toLocaleString(loc, { day: '2-digit' }),\n };\n\n if (time) {\n result.time = time;\n // use en-GB for 0-23 hr offset\n result.timeShort = dateObj.toLocaleString('en-GB', {\n hour12: false,\n hourCycle: 'h23',\n hour: '2-digit',\n minute: '2-digit',\n });\n }\n\n return result;\n }\n\n /**\n * Convert a date object to an ISO 8601 formatted string. By default, the time is not considered.\n *\n * @param date Javascript date object.\n * @param time Whether to consider the time as part of the conversion to the ISO string.\n *\n * @returns an ISO 8601 formatted date, optionally with the time as well.\n */\n public static dateToIso(date: Date, time = false): string {\n const dateString = date.toISOString();\n return time ? dateString : dateString.split('T')[0];\n }\n\n /**\n * Convert the params received into an ISO 8601 formatted string with only date in it.\n *\n * @param day The number of the day to be used.\n * @param month The number of the month to be used.\n * @param year The number of the year to be used.\n *\n * @returns an ISO 8601 formatted date for the given parameters.\n */\n public static dmyToIso(day: number, month: number, year: number): string {\n return `${year}-${month < 10 ? '0' + month : month}-${day < 10 ? '0' + day : day}`;\n }\n\n /**\n * Returns the days of the week starting at Monday day name translated using the locale received as a first element.\n *\n * @param locale The locale for which to convert the date for display purposes, defaults to browser locale.\n * @param format The format of the returned values\n *\n * @returns an array with the days of the week named according to the locale received.\n */\n public static dowNames(locale?: string, format: 'long' | 'short' | 'narrow' = 'short'): Array<string> {\n const loc = locale || navigator.language;\n const date = new Date();\n\n const weekdays = [];\n while (!weekdays[date.getDay()]) {\n weekdays[date.getDay()] = date.toLocaleString(loc, { weekday: format });\n date.setDate(date.getDate() + 1);\n }\n\n const sunday = weekdays.shift();\n if (sunday) {\n weekdays.push(sunday);\n }\n\n return weekdays;\n }\n\n /**\n * Returns the months of the year starting at January month name translated using the locale received as a first element.\n *\n * @param locale The locale for which to convert the date for display purposes, defaults to browser locale.\n * @param format The format of the month names to return\n *\n * @returns an array with the month names of the year, all named according to the locale received.\n */\n public static monthNames(\n locale?: string,\n format: 'numeric' | '2-digit' | 'long' | 'short' | 'narrow' = 'short',\n ): Array<string> {\n const loc = locale || navigator.language;\n\n return Array.from(Array(12).keys()).map((key) => {\n const date = new Date(2023, key, 15);\n return date.toLocaleString(loc, { month: format });\n });\n }\n\n /**\n * Collate & return the data required to drive the calendar popup in\n * <a href=\"/user-input/date-picker\">NeonDatePicker</a>.\n *\n * @param selectedDate ISO-8601 date-only string for the selected date.\n * @param currentPageMonth month of the current calendar page.\n * @param currentPageYear year of the current calendar page.\n * @param currentPageDecadeStart decade start year of the current calendar page.\n * @param locale user's locale.\n *\n * @returns The calendar configuration.\n */\n public static toCalendarConfiguration(\n selectedDate?: string,\n currentPageMonth?: number,\n currentPageYear?: number,\n currentPageDecadeStart?: number,\n locale?: string,\n ): NeonCalendarConfig {\n const loc = locale || navigator.language;\n const today = NeonDateUtils.stringToNeonDate(NeonDateUtils.dateToIso(new Date()), loc);\n const selected = selectedDate ? NeonDateUtils.stringToNeonDate(selectedDate, loc, true) : undefined;\n // month indexed from 1-12\n const pageMonth = currentPageMonth || today.month;\n\n // month indexed from 0-11\n const pageDate = currentPageMonth && currentPageYear ? new Date(currentPageYear, currentPageMonth - 1, 15) : null;\n const pageMonthName = pageDate?.toLocaleString(loc, { month: 'long' }) || today.monthLongName;\n const pageYear = currentPageYear || today.year;\n const pageDecadeStart = currentPageDecadeStart || Math.floor(pageYear / 10) * 10;\n\n // determine dow of first day of month. Months are indexed from 0 here\n const date = new Date(pageYear, (pageMonth + 11) % 12, 1);\n const offsetDate = new Date(pageYear, (pageMonth + 11) % 12, 1);\n offsetDate.setDate(offsetDate.getDate() - 1);\n\n const dates: Array<Array<number | null>> = [];\n\n let lastDayOfMonth = 1;\n let done = false;\n\n for (let row = 0; row < 6; row++) {\n dates[row] = [];\n\n for (let col = 0; col < 7; col++) {\n if (row === 0 && col < offsetDate.getDay()) {\n dates[row][col] = null;\n } else {\n dates[row][col] = date.getDate();\n lastDayOfMonth = date.getDate();\n date.setDate(date.getDate() + 1);\n\n if (date.getDate() === 1) {\n for (let i = col + 1; i < 7; i++) {\n dates[row][i] = null;\n }\n done = true;\n break;\n }\n }\n }\n\n if (done) {\n break;\n }\n }\n\n return {\n today,\n selected,\n pageMonth,\n pageMonthName,\n pageYear,\n pageDecadeStart,\n dowNames: NeonDateUtils.dowNames(loc),\n dowLongNames: NeonDateUtils.dowNames(loc, 'long'),\n dates,\n lastDayOfMonth,\n months: NeonDateUtils.monthNames(loc),\n monthLongNames: NeonDateUtils.monthNames(loc, 'long'),\n };\n }\n}\n"],"names":["NeonDateUtils","value","day","monthShortName","seconds","year","time","timeShort","date","locale","strict","loc","now","dateObj","result","dateString","month","format","weekdays","sunday","key","selectedDate","currentPageMonth","currentPageYear","currentPageDecadeStart","today","selected","pageMonth","pageDate","pageMonthName","pageYear","pageDecadeStart","offsetDate","dates","lastDayOfMonth","done","row","col","i"],"mappings":"AAOO,MAAMA,EAAc;AAAA;AAAA;AAAA;AAAA;AAAA,EAKzB,OAAc,WAAWC,GAAa;AACpC,UAAM,EAAE,KAAAC,GAAK,gBAAAC,EAAA,IAAmBH,EAAc,iBAAiBC,EAAM,aAAa;AAClF,WAAO,GAAGE,CAAc,IAAID,CAAG;AAAA,EACjC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,OAAc,6BAA6BD,GAAeG,IAAU,IAAO;AACzE,UAAM,EAAE,KAAAF,GAAK,gBAAAC,GAAgB,MAAAE,GAAM,MAAAC,GAAM,WAAAC,MAAcP,EAAc,iBAAiBC,CAAK;AAC3F,WAAOG,IAAU,GAAGF,CAAG,IAAIC,CAAc,IAAIE,CAAI,KAAKC,CAAI,KAAK,GAAGJ,CAAG,IAAIC,CAAc,IAAIE,CAAI,KAAKE,CAAS;AAAA,EAC/G;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWA,OAAc,iBAAiBC,GAAcC,GAAiBC,IAAS,IAAiB;AACtF,UAAMC,IAAMF,KAAU,UAAU,UAC1BG,wBAAU,KAAA,GACVC,IAAU,IAAI,KAAK,CAACH,KAAUF,EAAK,WAAW,KAAK,GAAGA,CAAI,IAAII,EAAI,YAAA,EAAc,MAAM,GAAG,EAAE,CAAC,CAAC,KAAKJ,CAAI;AAC5G,QAAIF;AACJ,IAAIE,EAAK,SAAS,OAChBF,IAAOO,EAAQ;AAAA,MACb;AAAA;AAAA,MACAL,EAAK,UAAU,KACX,EAAE,QAAQ,IAAO,MAAM,WAAW,QAAQ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AM,IAAI,CAAC,GAClDK,IAAa,IAAI,KAAKF,IAAWH,IAAY,MAAM,IAAI,CAAC;AAC9D,IAAAK,EAAW,QAAQA,EAAW,QAAA,IAAY,CAAC;AAE3C,UAAMC,IAAqC,CAAA;AAE3C,QAAIC,IAAiB,GACjBC,IAAO;AAEX,aAASC,IAAM,GAAGA,IAAM,GAAGA,KAAO;AAChC,MAAAH,EAAMG,CAAG,IAAI,CAAA;AAEb,eAASC,IAAM,GAAGA,IAAM,GAAGA;AACzB,YAAID,MAAQ,KAAKC,IAAML,EAAW;AAChC,UAAAC,EAAMG,CAAG,EAAEC,CAAG,IAAI;AAAA,iBAElBJ,EAAMG,CAAG,EAAEC,CAAG,IAAI7B,EAAK,QAAA,GACvB0B,IAAiB1B,EAAK,QAAA,GACtBA,EAAK,QAAQA,EAAK,QAAA,IAAY,CAAC,GAE3BA,EAAK,QAAA,MAAc,GAAG;AACxB,mBAAS8B,IAAID,IAAM,GAAGC,IAAI,GAAGA;AAC3B,YAAAL,EAAMG,CAAG,EAAEE,CAAC,IAAI;AAElB,UAAAH,IAAO;AACP;AAAA,QACF;AAIJ,UAAIA;AACF;AAAA,IAEJ;AAEA,WAAO;AAAA,MACL,OAAAV;AAAA,MACA,UAAAC;AAAA,MACA,WAAAC;AAAA,MACA,eAAAE;AAAA,MACA,UAAAC;AAAA,MACA,iBAAAC;AAAA,MACA,UAAU/B,EAAc,SAASW,CAAG;AAAA,MACpC,cAAcX,EAAc,SAASW,GAAK,MAAM;AAAA,MAChD,OAAAsB;AAAA,MACA,gBAAAC;AAAA,MACA,QAAQlC,EAAc,WAAWW,CAAG;AAAA,MACpC,gBAAgBX,EAAc,WAAWW,GAAK,MAAM;AAAA,IAAA;AAAA,EAExD;AACF;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./NeonIconRegistry.cjs.js"),n=require("../icons/align-center.svg.cjs.js"),o=require("../icons/align-left.svg.cjs.js"),r=require("../icons/align-right.svg.cjs.js"),c=require("../icons/at.svg.cjs.js"),i=require("../icons/calendar.svg.cjs.js"),t=require("../icons/check.svg.cjs.js"),s=require("../icons/check-circle.svg.cjs.js"),d=require("../icons/chevron-down.svg.cjs.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./NeonIconRegistry.cjs.js"),n=require("../icons/align-center.svg.cjs.js"),o=require("../icons/align-left.svg.cjs.js"),r=require("../icons/align-right.svg.cjs.js"),c=require("../icons/at.svg.cjs.js"),i=require("../icons/calendar.svg.cjs.js"),t=require("../icons/check.svg.cjs.js"),s=require("../icons/check-circle.svg.cjs.js"),d=require("../icons/chevron-down.svg.cjs.js"),a=require("../icons/chevron-left.svg.cjs.js"),I=require("../icons/chevron-right.svg.cjs.js"),g=require("../icons/chevron-up.svg.cjs.js"),u=require("../icons/color-filter.svg.cjs.js"),l=require("../icons/contrast.svg.cjs.js"),y=require("../icons/copy.svg.cjs.js"),R=require("../icons/dash.svg.cjs.js"),q=require("../icons/desktop.svg.cjs.js"),N=require("../icons/dot.svg.cjs.js"),h=require("../icons/download.svg.cjs.js"),m=require("../icons/ellipsis.svg.cjs.js"),f=require("../icons/exclamation-circle.svg.cjs.js"),p=require("../icons/feather.svg.cjs.js"),v=require("../icons/first-page.svg.cjs.js"),k=require("../icons/github.svg.cjs.js"),b=require("../icons/hammer.svg.cjs.js"),w=require("../icons/heart.svg.cjs.js"),C=require("../icons/heart-outline.svg.cjs.js"),x=require("../icons/html-logo.svg.cjs.js"),L=require("../icons/images.svg.cjs.js"),O=require("../icons/info-circle.svg.cjs.js"),P=require("../icons/last-page.svg.cjs.js"),S=require("../icons/light-mode-sunny.svg.cjs.js"),M=require("../icons/link-external.svg.cjs.js"),j=require("../icons/loading.svg.cjs.js"),D=require("../icons/lock.svg.cjs.js"),E=require("../icons/mail.svg.cjs.js"),F=require("../icons/menu.svg.cjs.js"),T=require("../icons/minus.svg.cjs.js"),U=require("../icons/moon.svg.cjs.js"),W=require("../icons/neon-logo.svg.cjs.js"),_=require("../icons/neon-wordmark.svg.cjs.js"),z=require("../icons/palette.svg.cjs.js"),A=require("../icons/plus.svg.cjs.js"),B=require("../icons/send.svg.cjs.js"),G=require("../icons/search.svg.cjs.js"),H=require("../icons/sun.svg.cjs.js"),J=require("../icons/switch.svg.cjs.js"),K=require("../icons/times.svg.cjs.js"),Q=require("../icons/times-circle.svg.cjs.js"),V=require("../icons/user.svg.cjs.js"),X=require("../icons/visibility-off.svg.cjs.js"),Y=require("../icons/visibility-on.svg.cjs.js");class Z{static register(){e.NeonIconRegistry.addIcon("align-center",n),e.NeonIconRegistry.addIcon("align-left",o),e.NeonIconRegistry.addIcon("align-right",r),e.NeonIconRegistry.addIcon("at",c),e.NeonIconRegistry.addIcon("calendar",i),e.NeonIconRegistry.addIcon("check",t),e.NeonIconRegistry.addIcon("check-circle",s),e.NeonIconRegistry.addIcon("chevron-down",d),e.NeonIconRegistry.addIcon("chevron-left",a),e.NeonIconRegistry.addIcon("chevron-right",I),e.NeonIconRegistry.addIcon("chevron-up",g),e.NeonIconRegistry.addIcon("color-filter",u),e.NeonIconRegistry.addIcon("contrast",l),e.NeonIconRegistry.addIcon("copy",y),e.NeonIconRegistry.addIcon("dash",R),e.NeonIconRegistry.addIcon("desktop",q),e.NeonIconRegistry.addIcon("dot",N),e.NeonIconRegistry.addIcon("download",h),e.NeonIconRegistry.addIcon("ellipsis",m),e.NeonIconRegistry.addIcon("exclamation-circle",f),e.NeonIconRegistry.addIcon("feather",p),e.NeonIconRegistry.addIcon("first-page",v),e.NeonIconRegistry.addIcon("github",k),e.NeonIconRegistry.addIcon("hammer",b),e.NeonIconRegistry.addIcon("heart",w),e.NeonIconRegistry.addIcon("heart-outline",C),e.NeonIconRegistry.addIcon("html-logo",x),e.NeonIconRegistry.addIcon("images",L),e.NeonIconRegistry.addIcon("info-circle",O),e.NeonIconRegistry.addIcon("last-page",P),e.NeonIconRegistry.addIcon("light-mode-sunny",S),e.NeonIconRegistry.addIcon("link-external",M),e.NeonIconRegistry.addIcon("loading",j),e.NeonIconRegistry.addIcon("lock",D),e.NeonIconRegistry.addIcon("mail",E),e.NeonIconRegistry.addIcon("menu",F),e.NeonIconRegistry.addIcon("minus",T),e.NeonIconRegistry.addIcon("moon",U),e.NeonIconRegistry.addIcon("neon-logo",W),e.NeonIconRegistry.addIcon("neon-wordmark",_),e.NeonIconRegistry.addIcon("palette",z),e.NeonIconRegistry.addIcon("plus",A),e.NeonIconRegistry.addIcon("send",B),e.NeonIconRegistry.addIcon("search",G),e.NeonIconRegistry.addIcon("sun",H),e.NeonIconRegistry.addIcon("switch",J),e.NeonIconRegistry.addIcon("times",K),e.NeonIconRegistry.addIcon("times-circle",Q),e.NeonIconRegistry.addIcon("user",V),e.NeonIconRegistry.addIcon("visibility-off",X),e.NeonIconRegistry.addIcon("visibility-on",Y)}}exports.RegisterIcons=Z;
|
|
2
2
|
//# sourceMappingURL=RegisterIcons.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RegisterIcons.cjs.js","sources":["../../../src/common/utils/RegisterIcons.ts"],"sourcesContent":["import { NeonIconRegistry } from './NeonIconRegistry';\nimport alignCenter from '@/common/icons/align-center.svg';\nimport alignLeft from '@/common/icons/align-left.svg';\nimport alignRight from '@/common/icons/align-right.svg';\nimport at from '@/common/icons/at.svg';\nimport calendar from '@/common/icons/calendar.svg';\nimport check from '@/common/icons/check.svg';\nimport checkCircle from '@/common/icons/check-circle.svg';\nimport chevronDown from '@/common/icons/chevron-down.svg';\nimport chevronLeft from '@/common/icons/chevron-left.svg';\nimport chevronRight from '@/common/icons/chevron-right.svg';\nimport chevronUp from '@/common/icons/chevron-up.svg';\nimport colorFilter from '@/common/icons/color-filter.svg';\nimport contrast from '@/common/icons/contrast.svg';\nimport copy from '@/common/icons/copy.svg';\nimport dash from '@/common/icons/dash.svg';\nimport desktop from '@/common/icons/desktop.svg';\nimport dot from '@/common/icons/dot.svg';\nimport download from '@/common/icons/download.svg';\nimport ellipsis from '@/common/icons/ellipsis.svg';\nimport exclamationCircle from '@/common/icons/exclamation-circle.svg';\nimport feather from '@/common/icons/feather.svg';\nimport github from '@/common/icons/github.svg';\nimport hammer from '@/common/icons/hammer.svg';\nimport heart from '@/common/icons/heart.svg';\nimport heartOutline from '@/common/icons/heart-outline.svg';\nimport htmlLogo from '@/common/icons/html-logo.svg';\nimport images from '@/common/icons/images.svg';\nimport infoCircle from '@/common/icons/info-circle.svg';\nimport lightModeSunny from '@/common/icons/light-mode-sunny.svg';\nimport linkExternal from '@/common/icons/link-external.svg';\nimport loading from '@/common/icons/loading.svg';\nimport lock from '@/common/icons/lock.svg';\nimport mail from '@/common/icons/mail.svg';\nimport menu from '@/common/icons/menu.svg';\nimport minus from '@/common/icons/minus.svg';\nimport moon from '@/common/icons/moon.svg';\nimport neonLogo from '@/common/icons/neon-logo.svg';\nimport neonWordmark from '@/common/icons/neon-wordmark.svg';\nimport palette from '@/common/icons/palette.svg';\nimport plus from '@/common/icons/plus.svg';\nimport send from '@/common/icons/send.svg';\nimport search from '@/common/icons/search.svg';\nimport sun from '@/common/icons/sun.svg';\nimport switchIcon from '@/common/icons/switch.svg';\nimport times from '@/common/icons/times.svg';\nimport timesCircle from '@/common/icons/times-circle.svg';\nimport user from '@/common/icons/user.svg';\nimport visibilityOff from '@/common/icons/visibility-off.svg';\nimport visibilityOn from '@/common/icons/visibility-on.svg';\n\n/**\n * A helper for initialising the provided set of Neon icons with the\n * <a href=\"/utils/NeonIconRegistry\">NeonIconRegistry</a>.\n */\nexport class RegisterIcons {\n /**\n * Register all Neon default icons in the NeonIconRegistry. Call this in an app's <em>main.ts</em> to use Neon's\n * provided icons.\n */\n public static register() {\n NeonIconRegistry.addIcon('align-center', alignCenter);\n NeonIconRegistry.addIcon('align-left', alignLeft);\n NeonIconRegistry.addIcon('align-right', alignRight);\n NeonIconRegistry.addIcon('at', at);\n NeonIconRegistry.addIcon('calendar', calendar);\n NeonIconRegistry.addIcon('check', check);\n NeonIconRegistry.addIcon('check-circle', checkCircle);\n NeonIconRegistry.addIcon('chevron-down', chevronDown);\n NeonIconRegistry.addIcon('chevron-left', chevronLeft);\n NeonIconRegistry.addIcon('chevron-right', chevronRight);\n NeonIconRegistry.addIcon('chevron-up', chevronUp);\n NeonIconRegistry.addIcon('color-filter', colorFilter);\n NeonIconRegistry.addIcon('contrast', contrast);\n NeonIconRegistry.addIcon('copy', copy);\n NeonIconRegistry.addIcon('dash', dash);\n NeonIconRegistry.addIcon('desktop', desktop);\n NeonIconRegistry.addIcon('dot', dot);\n NeonIconRegistry.addIcon('download', download);\n NeonIconRegistry.addIcon('ellipsis', ellipsis);\n NeonIconRegistry.addIcon('exclamation-circle', exclamationCircle);\n NeonIconRegistry.addIcon('feather', feather);\n NeonIconRegistry.addIcon('github', github);\n NeonIconRegistry.addIcon('hammer', hammer);\n NeonIconRegistry.addIcon('heart', heart);\n NeonIconRegistry.addIcon('heart-outline', heartOutline);\n NeonIconRegistry.addIcon('html-logo', htmlLogo);\n NeonIconRegistry.addIcon('images', images);\n NeonIconRegistry.addIcon('info-circle', infoCircle);\n NeonIconRegistry.addIcon('light-mode-sunny', lightModeSunny);\n NeonIconRegistry.addIcon('link-external', linkExternal);\n NeonIconRegistry.addIcon('loading', loading);\n NeonIconRegistry.addIcon('lock', lock);\n NeonIconRegistry.addIcon('mail', mail);\n NeonIconRegistry.addIcon('menu', menu);\n NeonIconRegistry.addIcon('minus', minus);\n NeonIconRegistry.addIcon('moon', moon);\n NeonIconRegistry.addIcon('neon-logo', neonLogo);\n NeonIconRegistry.addIcon('neon-wordmark', neonWordmark);\n NeonIconRegistry.addIcon('palette', palette);\n NeonIconRegistry.addIcon('plus', plus);\n NeonIconRegistry.addIcon('send', send);\n NeonIconRegistry.addIcon('search', search);\n NeonIconRegistry.addIcon('sun', sun);\n NeonIconRegistry.addIcon('switch', switchIcon);\n NeonIconRegistry.addIcon('times', times);\n NeonIconRegistry.addIcon('times-circle', timesCircle);\n NeonIconRegistry.addIcon('user', user);\n NeonIconRegistry.addIcon('visibility-off', visibilityOff);\n NeonIconRegistry.addIcon('visibility-on', visibilityOn);\n }\n}\n"],"names":["RegisterIcons","NeonIconRegistry","alignCenter","alignLeft","alignRight","at","calendar","check","checkCircle","chevronDown","chevronLeft","chevronRight","chevronUp","colorFilter","contrast","copy","dash","desktop","dot","download","ellipsis","exclamationCircle","feather","github","hammer","heart","heartOutline","htmlLogo","images","infoCircle","lightModeSunny","linkExternal","loading","lock","mail","menu","minus","moon","neonLogo","neonWordmark","palette","plus","send","search","sun","switchIcon","times","timesCircle","user","visibilityOff","visibilityOn"],"mappings":"
|
|
1
|
+
{"version":3,"file":"RegisterIcons.cjs.js","sources":["../../../src/common/utils/RegisterIcons.ts"],"sourcesContent":["import { NeonIconRegistry } from './NeonIconRegistry';\nimport alignCenter from '@/common/icons/align-center.svg';\nimport alignLeft from '@/common/icons/align-left.svg';\nimport alignRight from '@/common/icons/align-right.svg';\nimport at from '@/common/icons/at.svg';\nimport calendar from '@/common/icons/calendar.svg';\nimport check from '@/common/icons/check.svg';\nimport checkCircle from '@/common/icons/check-circle.svg';\nimport chevronDown from '@/common/icons/chevron-down.svg';\nimport chevronLeft from '@/common/icons/chevron-left.svg';\nimport chevronRight from '@/common/icons/chevron-right.svg';\nimport chevronUp from '@/common/icons/chevron-up.svg';\nimport colorFilter from '@/common/icons/color-filter.svg';\nimport contrast from '@/common/icons/contrast.svg';\nimport copy from '@/common/icons/copy.svg';\nimport dash from '@/common/icons/dash.svg';\nimport desktop from '@/common/icons/desktop.svg';\nimport dot from '@/common/icons/dot.svg';\nimport download from '@/common/icons/download.svg';\nimport ellipsis from '@/common/icons/ellipsis.svg';\nimport exclamationCircle from '@/common/icons/exclamation-circle.svg';\nimport feather from '@/common/icons/feather.svg';\nimport firstPage from '@/common/icons/first-page.svg';\nimport github from '@/common/icons/github.svg';\nimport hammer from '@/common/icons/hammer.svg';\nimport heart from '@/common/icons/heart.svg';\nimport heartOutline from '@/common/icons/heart-outline.svg';\nimport htmlLogo from '@/common/icons/html-logo.svg';\nimport images from '@/common/icons/images.svg';\nimport infoCircle from '@/common/icons/info-circle.svg';\nimport lastPage from '@/common/icons/last-page.svg';\nimport lightModeSunny from '@/common/icons/light-mode-sunny.svg';\nimport linkExternal from '@/common/icons/link-external.svg';\nimport loading from '@/common/icons/loading.svg';\nimport lock from '@/common/icons/lock.svg';\nimport mail from '@/common/icons/mail.svg';\nimport menu from '@/common/icons/menu.svg';\nimport minus from '@/common/icons/minus.svg';\nimport moon from '@/common/icons/moon.svg';\nimport neonLogo from '@/common/icons/neon-logo.svg';\nimport neonWordmark from '@/common/icons/neon-wordmark.svg';\nimport palette from '@/common/icons/palette.svg';\nimport plus from '@/common/icons/plus.svg';\nimport send from '@/common/icons/send.svg';\nimport search from '@/common/icons/search.svg';\nimport sun from '@/common/icons/sun.svg';\nimport switchIcon from '@/common/icons/switch.svg';\nimport times from '@/common/icons/times.svg';\nimport timesCircle from '@/common/icons/times-circle.svg';\nimport user from '@/common/icons/user.svg';\nimport visibilityOff from '@/common/icons/visibility-off.svg';\nimport visibilityOn from '@/common/icons/visibility-on.svg';\n\n/**\n * A helper for initialising the provided set of Neon icons with the\n * <a href=\"/utils/NeonIconRegistry\">NeonIconRegistry</a>.\n */\nexport class RegisterIcons {\n /**\n * Register all Neon default icons in the NeonIconRegistry. Call this in an app's <em>main.ts</em> to use Neon's\n * provided icons.\n */\n public static register() {\n NeonIconRegistry.addIcon('align-center', alignCenter);\n NeonIconRegistry.addIcon('align-left', alignLeft);\n NeonIconRegistry.addIcon('align-right', alignRight);\n NeonIconRegistry.addIcon('at', at);\n NeonIconRegistry.addIcon('calendar', calendar);\n NeonIconRegistry.addIcon('check', check);\n NeonIconRegistry.addIcon('check-circle', checkCircle);\n NeonIconRegistry.addIcon('chevron-down', chevronDown);\n NeonIconRegistry.addIcon('chevron-left', chevronLeft);\n NeonIconRegistry.addIcon('chevron-right', chevronRight);\n NeonIconRegistry.addIcon('chevron-up', chevronUp);\n NeonIconRegistry.addIcon('color-filter', colorFilter);\n NeonIconRegistry.addIcon('contrast', contrast);\n NeonIconRegistry.addIcon('copy', copy);\n NeonIconRegistry.addIcon('dash', dash);\n NeonIconRegistry.addIcon('desktop', desktop);\n NeonIconRegistry.addIcon('dot', dot);\n NeonIconRegistry.addIcon('download', download);\n NeonIconRegistry.addIcon('ellipsis', ellipsis);\n NeonIconRegistry.addIcon('exclamation-circle', exclamationCircle);\n NeonIconRegistry.addIcon('feather', feather);\n NeonIconRegistry.addIcon('first-page', firstPage);\n NeonIconRegistry.addIcon('github', github);\n NeonIconRegistry.addIcon('hammer', hammer);\n NeonIconRegistry.addIcon('heart', heart);\n NeonIconRegistry.addIcon('heart-outline', heartOutline);\n NeonIconRegistry.addIcon('html-logo', htmlLogo);\n NeonIconRegistry.addIcon('images', images);\n NeonIconRegistry.addIcon('info-circle', infoCircle);\n NeonIconRegistry.addIcon('last-page', lastPage);\n NeonIconRegistry.addIcon('light-mode-sunny', lightModeSunny);\n NeonIconRegistry.addIcon('link-external', linkExternal);\n NeonIconRegistry.addIcon('loading', loading);\n NeonIconRegistry.addIcon('lock', lock);\n NeonIconRegistry.addIcon('mail', mail);\n NeonIconRegistry.addIcon('menu', menu);\n NeonIconRegistry.addIcon('minus', minus);\n NeonIconRegistry.addIcon('moon', moon);\n NeonIconRegistry.addIcon('neon-logo', neonLogo);\n NeonIconRegistry.addIcon('neon-wordmark', neonWordmark);\n NeonIconRegistry.addIcon('palette', palette);\n NeonIconRegistry.addIcon('plus', plus);\n NeonIconRegistry.addIcon('send', send);\n NeonIconRegistry.addIcon('search', search);\n NeonIconRegistry.addIcon('sun', sun);\n NeonIconRegistry.addIcon('switch', switchIcon);\n NeonIconRegistry.addIcon('times', times);\n NeonIconRegistry.addIcon('times-circle', timesCircle);\n NeonIconRegistry.addIcon('user', user);\n NeonIconRegistry.addIcon('visibility-off', visibilityOff);\n NeonIconRegistry.addIcon('visibility-on', visibilityOn);\n }\n}\n"],"names":["RegisterIcons","NeonIconRegistry","alignCenter","alignLeft","alignRight","at","calendar","check","checkCircle","chevronDown","chevronLeft","chevronRight","chevronUp","colorFilter","contrast","copy","dash","desktop","dot","download","ellipsis","exclamationCircle","feather","firstPage","github","hammer","heart","heartOutline","htmlLogo","images","infoCircle","lastPage","lightModeSunny","linkExternal","loading","lock","mail","menu","minus","moon","neonLogo","neonWordmark","palette","plus","send","search","sun","switchIcon","times","timesCircle","user","visibilityOff","visibilityOn"],"mappings":"quEAyDO,MAAMA,CAAc,CAKzB,OAAc,UAAW,CACvBC,mBAAiB,QAAQ,eAAgBC,CAAW,EACpDD,mBAAiB,QAAQ,aAAcE,CAAS,EAChDF,mBAAiB,QAAQ,cAAeG,CAAU,EAClDH,mBAAiB,QAAQ,KAAMI,CAAE,EACjCJ,mBAAiB,QAAQ,WAAYK,CAAQ,EAC7CL,mBAAiB,QAAQ,QAASM,CAAK,EACvCN,mBAAiB,QAAQ,eAAgBO,CAAW,EACpDP,mBAAiB,QAAQ,eAAgBQ,CAAW,EACpDR,mBAAiB,QAAQ,eAAgBS,CAAW,EACpDT,mBAAiB,QAAQ,gBAAiBU,CAAY,EACtDV,mBAAiB,QAAQ,aAAcW,CAAS,EAChDX,mBAAiB,QAAQ,eAAgBY,CAAW,EACpDZ,mBAAiB,QAAQ,WAAYa,CAAQ,EAC7Cb,mBAAiB,QAAQ,OAAQc,CAAI,EACrCd,mBAAiB,QAAQ,OAAQe,CAAI,EACrCf,mBAAiB,QAAQ,UAAWgB,CAAO,EAC3ChB,mBAAiB,QAAQ,MAAOiB,CAAG,EACnCjB,mBAAiB,QAAQ,WAAYkB,CAAQ,EAC7ClB,mBAAiB,QAAQ,WAAYmB,CAAQ,EAC7CnB,mBAAiB,QAAQ,qBAAsBoB,CAAiB,EAChEpB,mBAAiB,QAAQ,UAAWqB,CAAO,EAC3CrB,mBAAiB,QAA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
|
import m from "../icons/align-left.svg.es.js";
|
|
4
4
|
import i from "../icons/align-right.svg.es.js";
|
|
5
5
|
import d from "../icons/at.svg.es.js";
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
6
|
+
import t from "../icons/calendar.svg.es.js";
|
|
7
|
+
import n from "../icons/check.svg.es.js";
|
|
8
|
+
import a from "../icons/check-circle.svg.es.js";
|
|
9
|
+
import c from "../icons/chevron-down.svg.es.js";
|
|
10
10
|
import e from "../icons/chevron-left.svg.es.js";
|
|
11
11
|
import f from "../icons/chevron-right.svg.es.js";
|
|
12
12
|
import p from "../icons/chevron-up.svg.es.js";
|
|
@@ -20,44 +20,46 @@ import k from "../icons/download.svg.es.js";
|
|
|
20
20
|
import v from "../icons/ellipsis.svg.es.js";
|
|
21
21
|
import y from "../icons/exclamation-circle.svg.es.js";
|
|
22
22
|
import w from "../icons/feather.svg.es.js";
|
|
23
|
-
import b from "../icons/
|
|
24
|
-
import x from "../icons/
|
|
25
|
-
import C from "../icons/
|
|
26
|
-
import L from "../icons/heart
|
|
27
|
-
import R from "../icons/
|
|
28
|
-
import O from "../icons/
|
|
23
|
+
import b from "../icons/first-page.svg.es.js";
|
|
24
|
+
import x from "../icons/github.svg.es.js";
|
|
25
|
+
import C from "../icons/hammer.svg.es.js";
|
|
26
|
+
import L from "../icons/heart.svg.es.js";
|
|
27
|
+
import R from "../icons/heart-outline.svg.es.js";
|
|
28
|
+
import O from "../icons/html-logo.svg.es.js";
|
|
29
|
+
import P from "../icons/images.svg.es.js";
|
|
29
30
|
import D from "../icons/info-circle.svg.es.js";
|
|
30
|
-
import E from "../icons/
|
|
31
|
-
import F from "../icons/
|
|
32
|
-
import M from "../icons/
|
|
33
|
-
import N from "../icons/
|
|
34
|
-
import S from "../icons/
|
|
35
|
-
import U from "../icons/
|
|
36
|
-
import W from "../icons/
|
|
37
|
-
import j from "../icons/
|
|
38
|
-
import q from "../icons/
|
|
39
|
-
import z from "../icons/neon-
|
|
40
|
-
import A from "../icons/
|
|
41
|
-
import B from "../icons/
|
|
42
|
-
import G from "../icons/
|
|
43
|
-
import H from "../icons/
|
|
44
|
-
import J from "../icons/
|
|
45
|
-
import K from "../icons/
|
|
46
|
-
import
|
|
47
|
-
import
|
|
48
|
-
import
|
|
49
|
-
import
|
|
50
|
-
import
|
|
51
|
-
|
|
31
|
+
import E from "../icons/last-page.svg.es.js";
|
|
32
|
+
import F from "../icons/light-mode-sunny.svg.es.js";
|
|
33
|
+
import M from "../icons/link-external.svg.es.js";
|
|
34
|
+
import N from "../icons/loading.svg.es.js";
|
|
35
|
+
import S from "../icons/lock.svg.es.js";
|
|
36
|
+
import U from "../icons/mail.svg.es.js";
|
|
37
|
+
import W from "../icons/menu.svg.es.js";
|
|
38
|
+
import j from "../icons/minus.svg.es.js";
|
|
39
|
+
import q from "../icons/moon.svg.es.js";
|
|
40
|
+
import z from "../icons/neon-logo.svg.es.js";
|
|
41
|
+
import A from "../icons/neon-wordmark.svg.es.js";
|
|
42
|
+
import B from "../icons/palette.svg.es.js";
|
|
43
|
+
import G from "../icons/plus.svg.es.js";
|
|
44
|
+
import H from "../icons/send.svg.es.js";
|
|
45
|
+
import J from "../icons/search.svg.es.js";
|
|
46
|
+
import K from "../icons/sun.svg.es.js";
|
|
47
|
+
import Q from "../icons/switch.svg.es.js";
|
|
48
|
+
import T from "../icons/times.svg.es.js";
|
|
49
|
+
import V from "../icons/times-circle.svg.es.js";
|
|
50
|
+
import X from "../icons/user.svg.es.js";
|
|
51
|
+
import Y from "../icons/visibility-off.svg.es.js";
|
|
52
|
+
import Z from "../icons/visibility-on.svg.es.js";
|
|
53
|
+
class _o {
|
|
52
54
|
/**
|
|
53
55
|
* Register all Neon default icons in the NeonIconRegistry. Call this in an app's <em>main.ts</em> to use Neon's
|
|
54
56
|
* provided icons.
|
|
55
57
|
*/
|
|
56
58
|
static register() {
|
|
57
|
-
o.addIcon("align-center", r), o.addIcon("align-left", m), o.addIcon("align-right", i), o.addIcon("at", d), o.addIcon("calendar",
|
|
59
|
+
o.addIcon("align-center", r), o.addIcon("align-left", m), o.addIcon("align-right", i), o.addIcon("at", d), o.addIcon("calendar", t), o.addIcon("check", n), o.addIcon("check-circle", a), o.addIcon("chevron-down", c), o.addIcon("chevron-left", e), o.addIcon("chevron-right", f), o.addIcon("chevron-up", p), o.addIcon("color-filter", l), o.addIcon("contrast", I), o.addIcon("copy", s), o.addIcon("dash", h), o.addIcon("desktop", g), o.addIcon("dot", u), o.addIcon("download", k), o.addIcon("ellipsis", v), o.addIcon("exclamation-circle", y), o.addIcon("feather", w), o.addIcon("first-page", b), o.addIcon("github", x), o.addIcon("hammer", C), o.addIcon("heart", L), o.addIcon("heart-outline", R), o.addIcon("html-logo", O), o.addIcon("images", P), o.addIcon("info-circle", D), o.addIcon("last-page", E), o.addIcon("light-mode-sunny", F), o.addIcon("link-external", M), o.addIcon("loading", N), o.addIcon("lock", S), o.addIcon("mail", U), o.addIcon("menu", W), o.addIcon("minus", j), o.addIcon("moon", q), o.addIcon("neon-logo", z), o.addIcon("neon-wordmark", A), o.addIcon("palette", B), o.addIcon("plus", G), o.addIcon("send", H), o.addIcon("search", J), o.addIcon("sun", K), o.addIcon("switch", Q), o.addIcon("times", T), o.addIcon("times-circle", V), o.addIcon("user", X), o.addIcon("visibility-off", Y), o.addIcon("visibility-on", Z);
|
|
58
60
|
}
|
|
59
61
|
}
|
|
60
62
|
export {
|
|
61
|
-
|
|
63
|
+
_o as RegisterIcons
|
|
62
64
|
};
|
|
63
65
|
//# sourceMappingURL=RegisterIcons.es.js.map
|