@aotearoan/neon 22.1.2 → 22.3.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/enums/NeonToggleStyle.cjs.js +1 -1
- package/dist/common/enums/NeonToggleStyle.cjs.js.map +1 -1
- package/dist/common/enums/NeonToggleStyle.es.js +2 -2
- package/dist/common/enums/NeonToggleStyle.es.js.map +1 -1
- 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 +45 -39
- package/dist/common/utils/NeonDateUtils.es.js.map +1 -1
- package/dist/common/utils/NeonFileUtils.cjs.js +2 -0
- package/dist/common/utils/NeonFileUtils.cjs.js.map +1 -0
- package/dist/common/utils/NeonFileUtils.es.js +10 -0
- package/dist/common/utils/NeonFileUtils.es.js.map +1 -0
- package/dist/components/navigation/stepper/NeonStepper.vue.cjs.js +1 -1
- package/dist/components/navigation/stepper/NeonStepper.vue.cjs.js.map +1 -1
- package/dist/components/navigation/stepper/NeonStepper.vue.es.js +29 -21
- package/dist/components/navigation/stepper/NeonStepper.vue.es.js.map +1 -1
- package/dist/components/presentation/badge/NeonBadge.cjs.js +1 -1
- package/dist/components/presentation/badge/NeonBadge.cjs.js.map +1 -1
- package/dist/components/presentation/badge/NeonBadge.es.js +51 -26
- package/dist/components/presentation/badge/NeonBadge.es.js.map +1 -1
- package/dist/components/presentation/badge/NeonBadge.vue.cjs.js +1 -1
- package/dist/components/presentation/badge/NeonBadge.vue.cjs.js.map +1 -1
- package/dist/components/presentation/badge/NeonBadge.vue.es.js +28 -14
- package/dist/components/presentation/badge/NeonBadge.vue.es.js.map +1 -1
- package/dist/components/presentation/image-carousel/NeonImageCarousel.cjs.js +1 -1
- package/dist/components/presentation/image-carousel/NeonImageCarousel.cjs.js.map +1 -1
- package/dist/components/presentation/image-carousel/NeonImageCarousel.es.js +44 -32
- package/dist/components/presentation/image-carousel/NeonImageCarousel.es.js.map +1 -1
- package/dist/components/presentation/image-carousel/NeonImageCarousel.vue.cjs.js +1 -1
- package/dist/components/presentation/image-carousel/NeonImageCarousel.vue.cjs.js.map +1 -1
- package/dist/components/presentation/image-carousel/NeonImageCarousel.vue.es.js +116 -86
- package/dist/components/presentation/image-carousel/NeonImageCarousel.vue.es.js.map +1 -1
- package/dist/components/user-input/file/NeonFile.cjs.js +1 -1
- package/dist/components/user-input/file/NeonFile.cjs.js.map +1 -1
- package/dist/components/user-input/file/NeonFile.es.js +20 -12
- package/dist/components/user-input/file/NeonFile.es.js.map +1 -1
- package/dist/components/user-input/file/NeonFile.vue.cjs.js +1 -1
- package/dist/components/user-input/file/NeonFile.vue.cjs.js.map +1 -1
- package/dist/components/user-input/file/NeonFile.vue.es.js +7 -5
- package/dist/components/user-input/file/NeonFile.vue.es.js.map +1 -1
- package/dist/components/user-input/toggle/NeonToggle.cjs.js +1 -1
- package/dist/components/user-input/toggle/NeonToggle.cjs.js.map +1 -1
- package/dist/components/user-input/toggle/NeonToggle.es.js +19 -18
- package/dist/components/user-input/toggle/NeonToggle.es.js.map +1 -1
- package/dist/components/user-input/toggle/NeonToggle.vue.cjs.js +1 -1
- package/dist/components/user-input/toggle/NeonToggle.vue.cjs.js.map +1 -1
- package/dist/components/user-input/toggle/NeonToggle.vue.es.js +9 -9
- package/dist/components/user-input/toggle/NeonToggle.vue.es.js.map +1 -1
- package/dist/neon.cjs.js +1 -1
- package/dist/neon.es.js +40 -38
- package/dist/neon.es.js.map +1 -1
- package/dist/src/common/enums/NeonToggleStyle.d.ts +3 -1
- package/dist/src/common/models/NeonDate.d.ts +2 -0
- package/dist/src/common/utils/NeonFileUtils.d.ts +6 -0
- package/dist/src/components/feedback/dialog/NeonDialog.d.ts +2 -2
- package/dist/src/components/feedback/note/NeonNote.d.ts +1 -1
- package/dist/src/components/layout/card-list/NeonCardList.d.ts +1 -1
- package/dist/src/components/layout/modal/NeonModal.d.ts +1 -1
- package/dist/src/components/navigation/dropdown-menu/NeonDropdownMenu.d.ts +4953 -471
- package/dist/src/components/navigation/menu/NeonMenu.d.ts +4920 -402
- package/dist/src/components/navigation/mobile-menu/NeonMobileMenu.d.ts +4897 -469
- package/dist/src/components/presentation/badge/NeonBadge.d.ts +1501 -3
- package/dist/src/components/presentation/dropdown/NeonDropdown.d.ts +1529 -17
- package/dist/src/components/presentation/image-carousel/NeonImageCarousel.d.ts +36 -23
- package/dist/src/components/user-input/button/NeonButton.d.ts +1 -1
- package/dist/src/components/user-input/chip/NeonChip.d.ts +1 -1
- package/dist/src/components/user-input/date-picker/NeonDatePicker.d.ts +1801 -218
- package/dist/src/components/user-input/drop-zone/NeonDropZone.d.ts +1 -1
- package/dist/src/components/user-input/file/NeonFile.d.ts +636 -7
- package/dist/src/components/user-input/filter-list/NeonFilterList.d.ts +1 -1
- package/dist/src/components/user-input/number/NeonNumber.d.ts +1 -1
- package/dist/src/components/user-input/search/NeonSearch.d.ts +5247 -693
- package/dist/src/components/user-input/select/NeonSelect.d.ts +4571 -71
- package/dist/src/components/user-input/toggle/NeonToggle.d.ts +1 -0
- package/dist/src/neon.d.ts +1 -0
- package/package.json +1 -1
- package/src/sass/components/_badge.scss +79 -0
- package/src/sass/components/_image-carousel.scss +109 -14
- package/src/sass/components/_stepper.scss +8 -3
- package/src/sass/components/_toggle.scss +29 -6
- package/src/sass/includes/_dependencies.scss +1 -1
- package/src/sass/variables.scss +33 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var r=(t=>(t.Toggle="toggle",t.RadioButtons="radio-buttons",t.Card="card",t))(r||{});exports.NeonToggleStyle=r;
|
|
2
2
|
//# sourceMappingURL=NeonToggleStyle.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NeonToggleStyle.cjs.js","sources":["../../../src/common/enums/NeonToggleStyle.ts"],"sourcesContent":["/**\n * Describes the available <a href=\"/user-input/toggle\">NeonToggle</a> styles.\n */\nexport enum NeonToggleStyle {\n /** Toggle style which is a horizontal group of connected buttons with one active member. */\n Toggle = 'toggle',\n /** Traditional HTML radio button input style. */\n RadioButtons = 'radio-buttons',\n}\n"],"names":["NeonToggleStyle"],"mappings":"gFAGO,IAAKA,GAAAA,IAEVA,EAAA,OAAS,SAETA,EAAA,aAAe,
|
|
1
|
+
{"version":3,"file":"NeonToggleStyle.cjs.js","sources":["../../../src/common/enums/NeonToggleStyle.ts"],"sourcesContent":["/**\n * Describes the available <a href=\"/user-input/toggle\">NeonToggle</a> styles.\n */\nexport enum NeonToggleStyle {\n /** Toggle style which is a horizontal group of connected buttons with one active member. */\n Toggle = 'toggle',\n /** Traditional HTML radio button input style. */\n RadioButtons = 'radio-buttons',\n /** Card style radio buttons for more detailed content */\n Card = 'card',\n}\n"],"names":["NeonToggleStyle"],"mappings":"gFAGO,IAAKA,GAAAA,IAEVA,EAAA,OAAS,SAETA,EAAA,aAAe,gBAEfA,EAAA,KAAO,OANGA,IAAAA,GAAA,CAAA,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var
|
|
1
|
+
var a = /* @__PURE__ */ ((r) => (r.Toggle = "toggle", r.RadioButtons = "radio-buttons", r.Card = "card", r))(a || {});
|
|
2
2
|
export {
|
|
3
|
-
|
|
3
|
+
a as NeonToggleStyle
|
|
4
4
|
};
|
|
5
5
|
//# sourceMappingURL=NeonToggleStyle.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NeonToggleStyle.es.js","sources":["../../../src/common/enums/NeonToggleStyle.ts"],"sourcesContent":["/**\n * Describes the available <a href=\"/user-input/toggle\">NeonToggle</a> styles.\n */\nexport enum NeonToggleStyle {\n /** Toggle style which is a horizontal group of connected buttons with one active member. */\n Toggle = 'toggle',\n /** Traditional HTML radio button input style. */\n RadioButtons = 'radio-buttons',\n}\n"],"names":["NeonToggleStyle"],"mappings":"AAGO,IAAKA,sBAAAA,OAEVA,EAAA,SAAS,UAETA,EAAA,eAAe,
|
|
1
|
+
{"version":3,"file":"NeonToggleStyle.es.js","sources":["../../../src/common/enums/NeonToggleStyle.ts"],"sourcesContent":["/**\n * Describes the available <a href=\"/user-input/toggle\">NeonToggle</a> styles.\n */\nexport enum NeonToggleStyle {\n /** Toggle style which is a horizontal group of connected buttons with one active member. */\n Toggle = 'toggle',\n /** Traditional HTML radio button input style. */\n RadioButtons = 'radio-buttons',\n /** Card style radio buttons for more detailed content */\n Card = 'card',\n}\n"],"names":["NeonToggleStyle"],"mappings":"AAGO,IAAKA,sBAAAA,OAEVA,EAAA,SAAS,UAETA,EAAA,eAAe,iBAEfA,EAAA,OAAO,QANGA,IAAAA,KAAA,CAAA,CAAA;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class s{static stringToNeonDate(e,o,
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class s{static stringToNeonDate(e,o,n=!1){const a=o||navigator.language,r=new Date,t=new Date(!n&&e.length===10?`${e}T${r.toISOString().split("T")[1]}`:e);let i;e.length>10&&(i=t.toLocaleString("en-GB",e.length<=16?{hour12:!1,hour:"2-digit",minute:"2-digit"}:{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"}));const c={year:+t.toLocaleString("en-US",{year:"numeric"}),yearFormatted:t.toLocaleString(a,{year:"numeric"}),month:+t.toLocaleString("en-US",{month:"numeric"}),monthShortName:t.toLocaleString(a,{month:"short"}),monthLongName:t.toLocaleString(a,{month:"long"}),day:+t.toLocaleString("en-US",{day:"numeric"}),dayFormatted:t.toLocaleString(a,{day:"2-digit"})};return i&&(c.time=i,c.timeShort=t.toLocaleString("en-GB",{hour12:!1,hourCycle:"h23",hour:"2-digit",minute:"2-digit"})),c}static dateToIso(e,o=!1){const n=e.toISOString();return o?n:n.split("T")[0]}static dmyToIso(e,o,n){return`${n}-${o<10?"0"+o:o}-${e<10?"0"+e:e}`}static dowNames(e,o="short"){const n=e||navigator.language,a=new Date,r=[];for(;!r[a.getDay()];)r[a.getDay()]=a.toLocaleString(n,{weekday:o}),a.setDate(a.getDate()+1);const t=r.shift();return t&&r.push(t),r}static monthNames(e,o="short"){const n=e||navigator.language;return Array.from(Array(12).keys()).map(a=>new Date(2023,a,15).toLocaleString(n,{month:o}))}static toCalendarConfiguration(e,o,n,a,r){const t=r||navigator.language,i=s.stringToNeonDate(s.dateToIso(new Date),t),c=e?s.stringToNeonDate(e,t,!0):void 0,u=o||i.month,S=o&&n?new Date(n,o-1,15):null,L=(S==null?void 0:S.toLocaleString(t,{month:"long"}))||i.monthLongName,h=n||i.year,N=a||Math.floor(h/10)*10,m=new Date(h,(u+11)%12,1),f=new Date(h,(u+11)%12,1);f.setDate(f.getDate()-1);const d=[];let D=1,w=!1;for(let g=0;g<6;g++){d[g]=[];for(let l=0;l<7;l++)if(g===0&&l<f.getDay())d[g][l]=null;else if(d[g][l]=m.getDate(),D=m.getDate(),m.setDate(m.getDate()+1),m.getDate()===1){for(let y=l+1;y<7;y++)d[g][y]=null;w=!0;break}if(w)break}return{today:i,selected:c,pageMonth:u,pageMonthName:L,pageYear:h,pageDecadeStart:N,dowNames:s.dowNames(t),dowLongNames:s.dowNames(t,"long"),dates:d,lastDayOfMonth:D,months:s.monthNames(t),monthLongNames:s.monthNames(t,"long")}}}exports.NeonDateUtils=s;
|
|
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 loc,\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 }\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,MA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AMG,CAAG,EAAI,CAAA,EAEb,QAASC,EAAM,EAAGA,EAAM,EAAGA,IACzB,GAAID,IAAQ,GAAKC,EAAML,EAAW,SAChCC,EAAMG,CAAG,EAAEC,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 * 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,EA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AAKC,EAAML,EAAW,SAChCC,EAAMG,CAAG,EAAEC,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,4 +1,4 @@
|
|
|
1
|
-
class
|
|
1
|
+
class i {
|
|
2
2
|
/**
|
|
3
3
|
* 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
4
|
*
|
|
@@ -8,23 +8,29 @@ class g {
|
|
|
8
8
|
*
|
|
9
9
|
* @returns Object representing the provided date.
|
|
10
10
|
*/
|
|
11
|
-
static stringToNeonDate(e, o,
|
|
12
|
-
const
|
|
11
|
+
static stringToNeonDate(e, o, n = !1) {
|
|
12
|
+
const a = o || navigator.language, r = /* @__PURE__ */ new Date(), t = new Date(!n && e.length === 10 ? `${e}T${r.toISOString().split("T")[1]}` : e);
|
|
13
13
|
let s;
|
|
14
14
|
e.length > 10 && (s = t.toLocaleString(
|
|
15
|
-
|
|
15
|
+
"en-GB",
|
|
16
|
+
// use en-GB for 0-23 hr offset
|
|
16
17
|
e.length <= 16 ? { hour12: !1, hour: "2-digit", minute: "2-digit" } : { hour12: !1, hour: "2-digit", minute: "2-digit", second: "2-digit" }
|
|
17
18
|
));
|
|
18
|
-
const
|
|
19
|
+
const c = {
|
|
19
20
|
year: +t.toLocaleString("en-US", { year: "numeric" }),
|
|
20
|
-
yearFormatted: t.toLocaleString(
|
|
21
|
+
yearFormatted: t.toLocaleString(a, { year: "numeric" }),
|
|
21
22
|
month: +t.toLocaleString("en-US", { month: "numeric" }),
|
|
22
|
-
monthShortName: t.toLocaleString(
|
|
23
|
-
monthLongName: t.toLocaleString(
|
|
23
|
+
monthShortName: t.toLocaleString(a, { month: "short" }),
|
|
24
|
+
monthLongName: t.toLocaleString(a, { month: "long" }),
|
|
24
25
|
day: +t.toLocaleString("en-US", { day: "numeric" }),
|
|
25
|
-
dayFormatted: t.toLocaleString(
|
|
26
|
+
dayFormatted: t.toLocaleString(a, { day: "2-digit" })
|
|
26
27
|
};
|
|
27
|
-
return s && (
|
|
28
|
+
return s && (c.time = s, c.timeShort = t.toLocaleString("en-GB", {
|
|
29
|
+
hour12: !1,
|
|
30
|
+
hourCycle: "h23",
|
|
31
|
+
hour: "2-digit",
|
|
32
|
+
minute: "2-digit"
|
|
33
|
+
})), c;
|
|
28
34
|
}
|
|
29
35
|
/**
|
|
30
36
|
* Convert a date object to an ISO 8601 formatted string. By default, the time is not considered.
|
|
@@ -35,8 +41,8 @@ class g {
|
|
|
35
41
|
* @returns an ISO 8601 formatted date, optionally with the time as well.
|
|
36
42
|
*/
|
|
37
43
|
static dateToIso(e, o = !1) {
|
|
38
|
-
const
|
|
39
|
-
return o ?
|
|
44
|
+
const n = e.toISOString();
|
|
45
|
+
return o ? n : n.split("T")[0];
|
|
40
46
|
}
|
|
41
47
|
/**
|
|
42
48
|
* Convert the params received into an ISO 8601 formatted string with only date in it.
|
|
@@ -47,8 +53,8 @@ class g {
|
|
|
47
53
|
*
|
|
48
54
|
* @returns an ISO 8601 formatted date for the given parameters.
|
|
49
55
|
*/
|
|
50
|
-
static dmyToIso(e, o,
|
|
51
|
-
return `${
|
|
56
|
+
static dmyToIso(e, o, n) {
|
|
57
|
+
return `${n}-${o < 10 ? "0" + o : o}-${e < 10 ? "0" + e : e}`;
|
|
52
58
|
}
|
|
53
59
|
/**
|
|
54
60
|
* Returns the days of the week starting at Monday day name translated using the locale received as a first element.
|
|
@@ -59,9 +65,9 @@ class g {
|
|
|
59
65
|
* @returns an array with the days of the week named according to the locale received.
|
|
60
66
|
*/
|
|
61
67
|
static dowNames(e, o = "short") {
|
|
62
|
-
const
|
|
63
|
-
for (; !r[
|
|
64
|
-
r[
|
|
68
|
+
const n = e || navigator.language, a = /* @__PURE__ */ new Date(), r = [];
|
|
69
|
+
for (; !r[a.getDay()]; )
|
|
70
|
+
r[a.getDay()] = a.toLocaleString(n, { weekday: o }), a.setDate(a.getDate() + 1);
|
|
65
71
|
const t = r.shift();
|
|
66
72
|
return t && r.push(t), r;
|
|
67
73
|
}
|
|
@@ -74,8 +80,8 @@ class g {
|
|
|
74
80
|
* @returns an array with the month names of the year, all named according to the locale received.
|
|
75
81
|
*/
|
|
76
82
|
static monthNames(e, o = "short") {
|
|
77
|
-
const
|
|
78
|
-
return Array.from(Array(12).keys()).map((
|
|
83
|
+
const n = e || navigator.language;
|
|
84
|
+
return Array.from(Array(12).keys()).map((a) => new Date(2023, a, 15).toLocaleString(n, { month: o }));
|
|
79
85
|
}
|
|
80
86
|
/**
|
|
81
87
|
* Collate & return the data required to drive the calendar popup in
|
|
@@ -89,19 +95,19 @@ class g {
|
|
|
89
95
|
*
|
|
90
96
|
* @returns The calendar configuration.
|
|
91
97
|
*/
|
|
92
|
-
static toCalendarConfiguration(e, o,
|
|
93
|
-
const t = r || navigator.language, s =
|
|
94
|
-
|
|
95
|
-
const
|
|
98
|
+
static toCalendarConfiguration(e, o, n, a, r) {
|
|
99
|
+
const t = r || navigator.language, s = i.stringToNeonDate(i.dateToIso(/* @__PURE__ */ new Date()), t), c = e ? i.stringToNeonDate(e, t, !0) : void 0, u = o || s.month, S = o && n ? new Date(n, o - 1, 15) : null, L = (S == null ? void 0 : S.toLocaleString(t, { month: "long" })) || s.monthLongName, d = n || s.year, N = a || Math.floor(d / 10) * 10, m = new Date(d, (u + 11) % 12, 1), f = new Date(d, (u + 11) % 12, 1);
|
|
100
|
+
f.setDate(f.getDate() - 1);
|
|
101
|
+
const h = [];
|
|
96
102
|
let w = 1, D = !1;
|
|
97
|
-
for (let
|
|
98
|
-
|
|
99
|
-
for (let
|
|
100
|
-
if (
|
|
101
|
-
|
|
102
|
-
else if (
|
|
103
|
-
for (let y =
|
|
104
|
-
|
|
103
|
+
for (let g = 0; g < 6; g++) {
|
|
104
|
+
h[g] = [];
|
|
105
|
+
for (let l = 0; l < 7; l++)
|
|
106
|
+
if (g === 0 && l < f.getDay())
|
|
107
|
+
h[g][l] = null;
|
|
108
|
+
else if (h[g][l] = m.getDate(), w = m.getDate(), m.setDate(m.getDate() + 1), m.getDate() === 1) {
|
|
109
|
+
for (let y = l + 1; y < 7; y++)
|
|
110
|
+
h[g][y] = null;
|
|
105
111
|
D = !0;
|
|
106
112
|
break;
|
|
107
113
|
}
|
|
@@ -110,21 +116,21 @@ class g {
|
|
|
110
116
|
}
|
|
111
117
|
return {
|
|
112
118
|
today: s,
|
|
113
|
-
selected:
|
|
119
|
+
selected: c,
|
|
114
120
|
pageMonth: u,
|
|
115
121
|
pageMonthName: L,
|
|
116
|
-
pageYear:
|
|
122
|
+
pageYear: d,
|
|
117
123
|
pageDecadeStart: N,
|
|
118
|
-
dowNames:
|
|
119
|
-
dowLongNames:
|
|
120
|
-
dates:
|
|
124
|
+
dowNames: i.dowNames(t),
|
|
125
|
+
dowLongNames: i.dowNames(t, "long"),
|
|
126
|
+
dates: h,
|
|
121
127
|
lastDayOfMonth: w,
|
|
122
|
-
months:
|
|
123
|
-
monthLongNames:
|
|
128
|
+
months: i.monthNames(t),
|
|
129
|
+
monthLongNames: i.monthNames(t, "long")
|
|
124
130
|
};
|
|
125
131
|
}
|
|
126
132
|
}
|
|
127
133
|
export {
|
|
128
|
-
|
|
134
|
+
i as NeonDateUtils
|
|
129
135
|
};
|
|
130
136
|
//# sourceMappingURL=NeonDateUtils.es.js.map
|
|
@@ -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 loc,\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 }\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,MACbF;AAAA,MACAH,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,MAC5D,gBAAgBA,EAAQ,eAAeF,GAAK,EAAE,OAAO,SAAS;AAAA,MAC9D,eAAeE,EAAQ,eAAeF,GAAK,EAAE,OAAO,QAAQ;AAAA,MAC5D,KAAK,CAACE,EAAQ,eAAe,SAAS,EAAE,KAAK,WAAW;AAAA,MACxD,cAAcA,EAAQ,eAAeF,GAAK,EAA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,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 * 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,QAA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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,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;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NeonFileUtils.cjs.js","sources":["../../../src/common/utils/NeonFileUtils.ts"],"sourcesContent":["/**\n * Convert a file into a data URL.\n * @param file The file to convert to a data URL\n * @returns {Promise<string>>} The data URL of the file\n */\nexport const fileToDataURL = (file: File) => {\n return new Promise<string>((resolve, reject) => {\n const reader = new FileReader();\n reader.onload = () => {\n resolve(reader.result as string);\n };\n reader.onerror = reject;\n reader.readAsDataURL(file);\n });\n};\n"],"names":["fileToDataURL","file","resolve","reject","reader"],"mappings":"gFAKO,MAAMA,EAAiBC,GACrB,IAAI,QAAgB,CAACC,EAASC,IAAW,CAC9C,MAAMC,EAAS,IAAI,WACnBA,EAAO,OAAS,IAAM,CACpBF,EAAQE,EAAO,MAAgB,CACjC,EACAA,EAAO,QAAUD,EACjBC,EAAO,cAAcH,CAAI,CAC3B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NeonFileUtils.es.js","sources":["../../../src/common/utils/NeonFileUtils.ts"],"sourcesContent":["/**\n * Convert a file into a data URL.\n * @param file The file to convert to a data URL\n * @returns {Promise<string>>} The data URL of the file\n */\nexport const fileToDataURL = (file: File) => {\n return new Promise<string>((resolve, reject) => {\n const reader = new FileReader();\n reader.onload = () => {\n resolve(reader.result as string);\n };\n reader.onerror = reject;\n reader.readAsDataURL(file);\n });\n};\n"],"names":["fileToDataURL","file","resolve","reject","reader"],"mappings":"AAKO,MAAMA,IAAgB,CAACC,MACrB,IAAI,QAAgB,CAACC,GAASC,MAAW;AAC9C,QAAMC,IAAS,IAAI,WAAA;AACnB,EAAAA,EAAO,SAAS,MAAM;AACpB,IAAAF,EAAQE,EAAO,MAAgB;AAAA,EACjC,GACAA,EAAO,UAAUD,GACjBC,EAAO,cAAcH,CAAI;AAC3B,CAAC;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const s=require("./NeonStepper.cjs.js"),e=require("vue"),r=require("../../../_virtual/_plugin-vue_export-helper.cjs.js"),a=["aria-label","onClick"],c=["tabindex","onKeydown"],d=["onClick"];function m(o,u,_,k,V,v){const l=e.resolveComponent("neon-icon");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass([`neon-stepper--${o.color}`,"neon-stepper"])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.steps,(t,n)=>(e.openBlock(),e.createElementBlock("div",{key:t,class:e.normalizeClass([{"neon-stepper__step--has-value":n<=o.modelValue||n<=o.completedIndex,"neon-stepper__step--active":n===o.modelValue,"neon-stepper__step--display-stepper":n<=o.completedIndex},"neon-stepper__step"])},[e.createElementVNode("div",{"aria-label":t,class:"neon-stepper__step-indicator-wrapper",role:"button",tabindex:"-1",onClick:p=>n!==o.modelValue&&n<=o.completedIndex&&o.emit("update:modelValue",n)},[e.createElementVNode("div",{tabindex:n<=o.completedIndex?0:-1,class:"neon-stepper__step-indicator",onKeydown:e.withKeys(p=>n!==o.modelValue&&n<=o.completedIndex&&o.emit("update:modelValue",n),["enter"])},[n<o.completedIndex?(e.openBlock(),e.createBlock(l,{key:0,class:"neon-stepper__step-completed-icon",name:"check"})):n===o.completedIndex?(e.openBlock(),e.createBlock(l,{key:1,class:"neon-stepper__step-completing-icon",name:"dot"})):e.createCommentVNode("",!0)],40,c)],8,a),e.createElementVNode("span",{class:"neon-stepper__step-title",tabindex:"-1",onClick:p=>n!==o.modelValue&&n<=o.completedIndex&&o.emit("update:modelValue",n)},e.toDisplayString(t),9,d)],2))),128))],2)}const i=r(s,[["render",m]]);module.exports=i;
|
|
2
2
|
//# sourceMappingURL=NeonStepper.vue.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NeonStepper.vue.cjs.js","sources":["../../../../src/components/navigation/stepper/NeonStepper.vue"],"sourcesContent":["<template>\n <div :class=\"`neon-stepper--${color}`\" class=\"neon-stepper\">\n <div\n v-for=\"(step, index) in steps\"\n :key=\"step\"\n :class=\"{\n 'neon-stepper__step--has-value': index <= modelValue || index <= completedIndex,\n 'neon-stepper__step--active': index === modelValue,\n 'neon-stepper__step--display-stepper': index <= completedIndex,\n }\"\n class=\"neon-stepper__step\"\n >\n <div\n class=\"neon-stepper__step-indicator-wrapper\"\n @click=\"index !== modelValue && index <= completedIndex && emit('update:modelValue', index)\"\n >\n <div class=\"neon-stepper__step-indicator\">\n <neon-icon v-if=\"index < completedIndex\" class=\"neon-stepper__step-completed-icon\" name=\"check\" />\n <neon-icon v-else-if=\"index === completedIndex\" class=\"neon-stepper__step-completing-icon\" name=\"dot\" />\n </div>\n </div>\n <span\n class=\"neon-stepper__step-title\"\n @click=\"index !== modelValue && index <= completedIndex && emit('update:modelValue', index)\"\n >\n {{ step }}\n </span>\n </div>\n </div>\n</template>\n\n<script lang=\"ts\" src=\"./NeonStepper.ts\" />\n"],"names":["
|
|
1
|
+
{"version":3,"file":"NeonStepper.vue.cjs.js","sources":["../../../../src/components/navigation/stepper/NeonStepper.vue"],"sourcesContent":["<template>\n <div :class=\"`neon-stepper--${color}`\" class=\"neon-stepper\">\n <div\n v-for=\"(step, index) in steps\"\n :key=\"step\"\n :class=\"{\n 'neon-stepper__step--has-value': index <= modelValue || index <= completedIndex,\n 'neon-stepper__step--active': index === modelValue,\n 'neon-stepper__step--display-stepper': index <= completedIndex,\n }\"\n class=\"neon-stepper__step\"\n >\n <div\n :aria-label=\"step\"\n class=\"neon-stepper__step-indicator-wrapper\"\n role=\"button\"\n tabindex=\"-1\"\n @click=\"index !== modelValue && index <= completedIndex && emit('update:modelValue', index)\"\n >\n <div\n :tabindex=\"index <= completedIndex ? 0 : -1\"\n class=\"neon-stepper__step-indicator\"\n @keydown.enter=\"index !== modelValue && index <= completedIndex && emit('update:modelValue', index)\"\n >\n <neon-icon v-if=\"index < completedIndex\" class=\"neon-stepper__step-completed-icon\" name=\"check\" />\n <neon-icon v-else-if=\"index === completedIndex\" class=\"neon-stepper__step-completing-icon\" name=\"dot\" />\n </div>\n </div>\n <span\n class=\"neon-stepper__step-title\"\n tabindex=\"-1\"\n @click=\"index !== modelValue && index <= completedIndex && emit('update:modelValue', index)\"\n >\n {{ step }}\n </span>\n </div>\n </div>\n</template>\n\n<script lang=\"ts\" src=\"./NeonStepper.ts\" />\n"],"names":["_createElementBlock","_normalizeClass","_ctx","_openBlock","_Fragment","_renderList","step","index","_createElementVNode","$event","_withKeys","_createBlock","_component_neon_icon","_hoisted_3"],"mappings":"+RACEA,EAAAA,mBAmCM,MAAA,CAnCA,MAAKC,EAAAA,eAAA,CAAA,iBAAmBC,EAAA,KAAK,GAAU,cAAc,CAAA,KACzDC,EAAAA,UAAA,EAAA,EAAAH,EAAAA,mBAiCMI,WAAA,KAAAC,EAAAA,WAhCoBH,EAAA,MAAK,CAArBI,EAAMC,mBADhBP,EAAAA,mBAiCM,MAAA,CA/BH,IAAKM,EACL,MAAKL,EAAAA,eAAA,CAAA,CAA6C,gCAAAM,GAASL,EAAA,YAAcK,GAASL,EAAA,eAAsD,6BAAAK,IAAUL,EAAA,WAA2D,sCAAAK,GAASL,EAAA,gBAKjN,oBAAoB,CAAA,IAE1BM,EAAAA,mBAeM,MAAA,CAdH,aAAYF,EACb,MAAM,uCACN,KAAK,SACL,SAAS,KACR,QAAKG,GAAEF,IAAUL,EAAA,YAAcK,GAASL,EAAA,gBAAkBA,EAAA,KAAI,oBAAsBK,CAAK,IAE1FC,EAAAA,mBAOM,MAAA,CANH,SAAUD,GAASL,EAAA,eAAc,EAAA,GAClC,MAAM,+BACL,UAAOQ,EAAAA,SAAAD,GAAQF,IAAUL,EAAA,YAAcK,GAASL,EAAA,gBAAkBA,EAAA,KAAI,oBAAsBK,CAAK,EAAA,CAAA,OAAA,CAAA,IAEjFA,EAAQL,EAAA,8BAAzBS,EAAAA,YAAkGC,EAAA,OAAzD,MAAM,oCAAoC,KAAK,WAClEL,IAAUL,EAAA,8BAAhCS,EAAAA,YAAwGC,EAAA,OAAxD,MAAM,qCAAqC,KAAK,kDAGpGJ,EAAAA,mBAMO,OAAA,CALL,MAAM,2BACN,SAAS,KACR,QAAKC,GAAEF,IAAUL,EAAA,YAAcK,GAASL,EAAA,gBAAkBA,EAAA,KAAI,oBAAsBK,CAAK,qBAEvFD,CAAI,EAAA,EAAAO,CAAA"}
|
|
@@ -1,45 +1,53 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { resolveComponent as
|
|
3
|
-
import
|
|
4
|
-
const f = ["onClick"],
|
|
5
|
-
function $(e, h,
|
|
6
|
-
const
|
|
7
|
-
return n(),
|
|
1
|
+
import d from "./NeonStepper.es.js";
|
|
2
|
+
import { resolveComponent as c, openBlock as n, createElementBlock as p, normalizeClass as r, Fragment as i, renderList as u, createElementVNode as s, withKeys as _, createBlock as m, createCommentVNode as k, toDisplayString as v } from "vue";
|
|
3
|
+
import V from "../../../_virtual/_plugin-vue_export-helper.es.js";
|
|
4
|
+
const f = ["aria-label", "onClick"], y = ["tabindex", "onKeydown"], I = ["onClick"];
|
|
5
|
+
function $(e, b, h, C, w, g) {
|
|
6
|
+
const l = c("neon-icon");
|
|
7
|
+
return n(), p("div", {
|
|
8
8
|
class: r([`neon-stepper--${e.color}`, "neon-stepper"])
|
|
9
9
|
}, [
|
|
10
|
-
(n(!0),
|
|
11
|
-
key:
|
|
10
|
+
(n(!0), p(i, null, u(e.steps, (t, o) => (n(), p("div", {
|
|
11
|
+
key: t,
|
|
12
12
|
class: r([{
|
|
13
13
|
"neon-stepper__step--has-value": o <= e.modelValue || o <= e.completedIndex,
|
|
14
14
|
"neon-stepper__step--active": o === e.modelValue,
|
|
15
15
|
"neon-stepper__step--display-stepper": o <= e.completedIndex
|
|
16
16
|
}, "neon-stepper__step"])
|
|
17
17
|
}, [
|
|
18
|
-
|
|
18
|
+
s("div", {
|
|
19
|
+
"aria-label": t,
|
|
19
20
|
class: "neon-stepper__step-indicator-wrapper",
|
|
20
|
-
|
|
21
|
+
role: "button",
|
|
22
|
+
tabindex: "-1",
|
|
23
|
+
onClick: (a) => o !== e.modelValue && o <= e.completedIndex && e.emit("update:modelValue", o)
|
|
21
24
|
}, [
|
|
22
|
-
|
|
23
|
-
o
|
|
25
|
+
s("div", {
|
|
26
|
+
tabindex: o <= e.completedIndex ? 0 : -1,
|
|
27
|
+
class: "neon-stepper__step-indicator",
|
|
28
|
+
onKeydown: _((a) => o !== e.modelValue && o <= e.completedIndex && e.emit("update:modelValue", o), ["enter"])
|
|
29
|
+
}, [
|
|
30
|
+
o < e.completedIndex ? (n(), m(l, {
|
|
24
31
|
key: 0,
|
|
25
32
|
class: "neon-stepper__step-completed-icon",
|
|
26
33
|
name: "check"
|
|
27
|
-
})) : o === e.completedIndex ? (n(),
|
|
34
|
+
})) : o === e.completedIndex ? (n(), m(l, {
|
|
28
35
|
key: 1,
|
|
29
36
|
class: "neon-stepper__step-completing-icon",
|
|
30
37
|
name: "dot"
|
|
31
|
-
})) :
|
|
32
|
-
])
|
|
38
|
+
})) : k("", !0)
|
|
39
|
+
], 40, y)
|
|
33
40
|
], 8, f),
|
|
34
|
-
|
|
41
|
+
s("span", {
|
|
35
42
|
class: "neon-stepper__step-title",
|
|
36
|
-
|
|
37
|
-
|
|
43
|
+
tabindex: "-1",
|
|
44
|
+
onClick: (a) => o !== e.modelValue && o <= e.completedIndex && e.emit("update:modelValue", o)
|
|
45
|
+
}, v(t), 9, I)
|
|
38
46
|
], 2))), 128))
|
|
39
47
|
], 2);
|
|
40
48
|
}
|
|
41
|
-
const
|
|
49
|
+
const E = /* @__PURE__ */ V(d, [["render", $]]);
|
|
42
50
|
export {
|
|
43
|
-
|
|
51
|
+
E as default
|
|
44
52
|
};
|
|
45
53
|
//# sourceMappingURL=NeonStepper.vue.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NeonStepper.vue.es.js","sources":["../../../../src/components/navigation/stepper/NeonStepper.vue"],"sourcesContent":["<template>\n <div :class=\"`neon-stepper--${color}`\" class=\"neon-stepper\">\n <div\n v-for=\"(step, index) in steps\"\n :key=\"step\"\n :class=\"{\n 'neon-stepper__step--has-value': index <= modelValue || index <= completedIndex,\n 'neon-stepper__step--active': index === modelValue,\n 'neon-stepper__step--display-stepper': index <= completedIndex,\n }\"\n class=\"neon-stepper__step\"\n >\n <div\n class=\"neon-stepper__step-indicator-wrapper\"\n @click=\"index !== modelValue && index <= completedIndex && emit('update:modelValue', index)\"\n >\n <div class=\"neon-stepper__step-indicator\">\n <neon-icon v-if=\"index < completedIndex\" class=\"neon-stepper__step-completed-icon\" name=\"check\" />\n <neon-icon v-else-if=\"index === completedIndex\" class=\"neon-stepper__step-completing-icon\" name=\"dot\" />\n </div>\n </div>\n <span\n class=\"neon-stepper__step-title\"\n @click=\"index !== modelValue && index <= completedIndex && emit('update:modelValue', index)\"\n >\n {{ step }}\n </span>\n </div>\n </div>\n</template>\n\n<script lang=\"ts\" src=\"./NeonStepper.ts\" />\n"],"names":["
|
|
1
|
+
{"version":3,"file":"NeonStepper.vue.es.js","sources":["../../../../src/components/navigation/stepper/NeonStepper.vue"],"sourcesContent":["<template>\n <div :class=\"`neon-stepper--${color}`\" class=\"neon-stepper\">\n <div\n v-for=\"(step, index) in steps\"\n :key=\"step\"\n :class=\"{\n 'neon-stepper__step--has-value': index <= modelValue || index <= completedIndex,\n 'neon-stepper__step--active': index === modelValue,\n 'neon-stepper__step--display-stepper': index <= completedIndex,\n }\"\n class=\"neon-stepper__step\"\n >\n <div\n :aria-label=\"step\"\n class=\"neon-stepper__step-indicator-wrapper\"\n role=\"button\"\n tabindex=\"-1\"\n @click=\"index !== modelValue && index <= completedIndex && emit('update:modelValue', index)\"\n >\n <div\n :tabindex=\"index <= completedIndex ? 0 : -1\"\n class=\"neon-stepper__step-indicator\"\n @keydown.enter=\"index !== modelValue && index <= completedIndex && emit('update:modelValue', index)\"\n >\n <neon-icon v-if=\"index < completedIndex\" class=\"neon-stepper__step-completed-icon\" name=\"check\" />\n <neon-icon v-else-if=\"index === completedIndex\" class=\"neon-stepper__step-completing-icon\" name=\"dot\" />\n </div>\n </div>\n <span\n class=\"neon-stepper__step-title\"\n tabindex=\"-1\"\n @click=\"index !== modelValue && index <= completedIndex && emit('update:modelValue', index)\"\n >\n {{ step }}\n </span>\n </div>\n </div>\n</template>\n\n<script lang=\"ts\" src=\"./NeonStepper.ts\" />\n"],"names":["_createElementBlock","_normalizeClass","_ctx","_openBlock","_Fragment","_renderList","step","index","_createElementVNode","$event","_withKeys","_createBlock","_component_neon_icon","_hoisted_3"],"mappings":";;;;;;cACEA,EAmCM,OAAA;AAAA,IAnCA,OAAKC,EAAA,CAAA,iBAAmBC,EAAA,KAAK,IAAU,cAAc,CAAA;AAAA;KACzDC,EAAA,EAAA,GAAAH,EAiCMI,GAAA,MAAAC,EAhCoBH,EAAA,OAAK,CAArBI,GAAMC,YADhBP,EAiCM,OAAA;AAAA,MA/BH,KAAKM;AAAA,MACL,OAAKL,EAAA,CAAA;AAAA,QAA6C,iCAAAM,KAASL,EAAA,cAAcK,KAASL,EAAA;AAAA,QAAsD,8BAAAK,MAAUL,EAAA;AAAA,QAA2D,uCAAAK,KAASL,EAAA;AAAA,SAKjN,oBAAoB,CAAA;AAAA;MAE1BM,EAeM,OAAA;AAAA,QAdH,cAAYF;AAAA,QACb,OAAM;AAAA,QACN,MAAK;AAAA,QACL,UAAS;AAAA,QACR,SAAK,CAAAG,MAAEF,MAAUL,EAAA,cAAcK,KAASL,EAAA,kBAAkBA,EAAA,KAAI,qBAAsBK,CAAK;AAAA;QAE1FC,EAOM,OAAA;AAAA,UANH,UAAUD,KAASL,EAAA,iBAAc,IAAA;AAAA,UAClC,OAAM;AAAA,UACL,WAAOQ,EAAA,CAAAD,MAAQF,MAAUL,EAAA,cAAcK,KAASL,EAAA,kBAAkBA,EAAA,KAAI,qBAAsBK,CAAK,GAAA,CAAA,OAAA,CAAA;AAAA;UAEjFA,IAAQL,EAAA,uBAAzBS,EAAkGC,GAAA;AAAA;YAAzD,OAAM;AAAA,YAAoC,MAAK;AAAA,gBAClEL,MAAUL,EAAA,uBAAhCS,EAAwGC,GAAA;AAAA;YAAxD,OAAM;AAAA,YAAqC,MAAK;AAAA;;;MAGpGJ,EAMO,QAAA;AAAA,QALL,OAAM;AAAA,QACN,UAAS;AAAA,QACR,SAAK,CAAAC,MAAEF,MAAUL,EAAA,cAAcK,KAASL,EAAA,kBAAkBA,EAAA,KAAI,qBAAsBK,CAAK;AAAA,WAEvFD,CAAI,GAAA,GAAAO,CAAA;AAAA;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const l=require("vue"),e=require("../../../common/enums/NeonFunctionalColor.cjs.js"),s=require("../icon/NeonIcon.vue.cjs.js"),
|
|
1
|
+
"use strict";const l=require("vue"),e=require("../../../common/enums/NeonFunctionalColor.cjs.js"),s=require("../../user-input/file/NeonFile.vue.cjs.js"),m=require("../icon/NeonIcon.vue.cjs.js"),p=require("../../../common/utils/NeonJazziconUtils.cjs.js"),f=require("../../../common/utils/NeonColorUtils.cjs.js"),i=require("../../../common/enums/NeonBadgeSize.cjs.js"),N=l.defineComponent({name:"NeonBadge",components:{NeonFile:s,NeonIcon:m},emits:["change-image"],props:{label:{type:String,default:null},image:{type:String,default:null},icon:{type:String,default:null},circular:{type:Boolean,default:!1},size:{type:String,default:i.NeonBadgeSize.Medium},color:{type:String,default:e.NeonFunctionalColor.Primary},alternateColor:{type:String,default:null},editable:{type:Boolean,default:!1},accept:{type:String,default:"image/*"},disabled:{type:Boolean,default:!1},jazziconId:{type:String,default:null},imageAlt:{type:String,default:"Badge"},editButtonTitle:{type:String,default:"Edit"}},setup(n,{emit:a}){const t=c=>{let o=getComputedStyle(document.documentElement).getPropertyValue(`--neon-rgb-${c}-l1`);o.length===0&&(o="0, 0, 0");const d=o.trim().split(", ").map(g=>+g);return f.NeonColorUtils.rgbToHex(d)},r=l.computed(()=>["#000000",t(e.NeonFunctionalColor.Brand),t(e.NeonFunctionalColor.Primary),t(e.NeonFunctionalColor.Info),t(e.NeonFunctionalColor.Success),t(e.NeonFunctionalColor.Warn),t(e.NeonFunctionalColor.Error)]),u=l.computed(()=>n.jazziconId?p.NeonJazziconUtils.genSvg(r.value,n.jazziconId,n.size===i.NeonBadgeSize.Small?32:n.size===i.NeonBadgeSize.Medium?40:48):null);return{emit:a,svg:u}}});module.exports=N;
|
|
2
2
|
//# sourceMappingURL=NeonBadge.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NeonBadge.cjs.js","sources":["../../../../src/components/presentation/badge/NeonBadge.ts?vue&type=script&src=true&lang.ts"],"sourcesContent":["import { computed, defineComponent } from 'vue';\nimport { NeonFunctionalColor } from '@/common/enums/NeonFunctionalColor';\nimport NeonIcon from '@/components/presentation/icon/NeonIcon.vue';\nimport { NeonJazziconUtils } from '@/common/utils/NeonJazziconUtils';\nimport { NeonColorUtils } from '@/common/utils/NeonColorUtils';\nimport { NeonBadgeSize } from '@/common/enums/NeonBadgeSize';\n\n/**\n * A badge is a small square or circular component for representing user avatars. These can be in the form of an image, an icon or a two character string (e.g. the user's initials).\n */\nexport default defineComponent({\n name: 'NeonBadge',\n components: {\n NeonIcon,\n },\n props: {\n /**\n * The two character <em>initials</em> to display on the badge.\n */\n label: { type: String, default: null },\n /**\n * URL of the image to display on the badge.\n */\n image: { type: String, default: null },\n /**\n * An icon to display on the badge.\n */\n icon: { type: String, default: null },\n /**\n * If true, render the badge as a circle, instead of a square.\n */\n circular: { type: Boolean, default: false },\n /**\n * The size of the badge - s, m, l, xl, xxl.\n */\n size: { type: String as () => NeonBadgeSize, default: NeonBadgeSize.Medium },\n /**\n * The color of the badge. This is one of the provided NeonFunctionalColors.\n */\n color: { type: String as () => NeonFunctionalColor, default: NeonFunctionalColor.
|
|
1
|
+
{"version":3,"file":"NeonBadge.cjs.js","sources":["../../../../src/components/presentation/badge/NeonBadge.ts?vue&type=script&src=true&lang.ts"],"sourcesContent":["import { computed, defineComponent } from 'vue';\nimport { NeonFunctionalColor } from '@/common/enums/NeonFunctionalColor';\nimport NeonFile from '@/components/user-input/file/NeonFile.vue';\nimport NeonIcon from '@/components/presentation/icon/NeonIcon.vue';\nimport { NeonJazziconUtils } from '@/common/utils/NeonJazziconUtils';\nimport { NeonColorUtils } from '@/common/utils/NeonColorUtils';\nimport { NeonBadgeSize } from '@/common/enums/NeonBadgeSize';\n\n/**\n * A badge is a small square or circular component for representing user avatars. These can be in the form of an image, an icon or a two character string (e.g. the user's initials).\n */\nexport default defineComponent({\n name: 'NeonBadge',\n components: {\n NeonFile,\n NeonIcon,\n },\n emits: [\n /**\n * emitted when the user selects or clears their image in edit mode.\n * NOTE: This emit event DOES NOT set the badge image, it is the responsibility of the parent component to pass an\n * image URL back into the component's image property to set it, e.g. a data URI.\n * @type {File}\n */\n 'change-image',\n ],\n props: {\n /**\n * The two character <em>initials</em> to display on the badge.\n */\n label: { type: String, default: null },\n /**\n * URL of the image to display on the badge.\n */\n image: { type: String, default: null },\n /**\n * An icon to display on the badge.\n */\n icon: { type: String, default: null },\n /**\n * If true, render the badge as a circle, instead of a square.\n */\n circular: { type: Boolean, default: false },\n /**\n * The size of the badge - s, m, l, xl, xxl.\n */\n size: { type: String as () => NeonBadgeSize, default: NeonBadgeSize.Medium },\n /**\n * The color of the badge. This is one of the provided NeonFunctionalColors.\n */\n color: { type: String as () => NeonFunctionalColor, default: NeonFunctionalColor.Primary },\n /**\n * Alternate color for creating gradient badges. NOTE: can also be the same color as 'color'.\n */\n alternateColor: { type: String as () => NeonFunctionalColor, default: null },\n /**\n * Allow editing of the image. This will place an image file lookup button on top of the image allowing the user to\n * choose a new image to upload.\n */\n editable: { type: Boolean, default: false },\n /**\n * Accept string for the filetype to support selecting.\n */\n accept: { type: String, default: 'image/*' },\n /**\n * Display the badge in the disable style\n */\n disabled: { type: Boolean, default: false },\n /**\n * Apply the generated Jazzicon style based on the unique identified provided (e.g. a wallet address, name, etc)\n */\n jazziconId: { type: String, default: null },\n /**\n * Badge image alt text.\n */\n imageAlt: { type: String, default: 'Badge' },\n /**\n * Title for the file upload button in edit mode.\n */\n editButtonTitle: { type: String, default: 'Edit' },\n },\n setup(props, { emit }) {\n const getColor = (key: NeonFunctionalColor) => {\n let colorString = getComputedStyle(document.documentElement).getPropertyValue(`--neon-rgb-${key}-l1`);\n if (colorString.length === 0) {\n colorString = '0, 0, 0';\n }\n const colorRgb = colorString\n .trim()\n .split(', ')\n .map((str) => +str);\n return NeonColorUtils.rgbToHex(colorRgb);\n };\n\n const palette = computed(() => [\n '#000000',\n getColor(NeonFunctionalColor.Brand),\n getColor(NeonFunctionalColor.Primary),\n getColor(NeonFunctionalColor.Info),\n getColor(NeonFunctionalColor.Success),\n getColor(NeonFunctionalColor.Warn),\n getColor(NeonFunctionalColor.Error),\n ]);\n\n const svg = computed(() =>\n props.jazziconId\n ? NeonJazziconUtils.genSvg(\n palette.value,\n props.jazziconId,\n props.size === NeonBadgeSize.Small ? 32 : props.size === NeonBadgeSize.Medium ? 40 : 48,\n )\n : null,\n );\n\n return {\n emit,\n svg,\n };\n },\n});\n"],"names":["_sfc_main","defineComponent","NeonFile","NeonIcon","NeonBadgeSize","NeonFunctionalColor","props","emit","getColor","key","colorString","colorRgb","str","NeonColorUtils","palette","computed","svg","NeonJazziconUtils"],"mappings":"+WAWAA,EAAeC,kBAAgB,CAC7B,KAAM,YACN,WAAY,CACV,SAAAC,EACA,SAAAC,CAAA,EAEF,MAAO,CAOL,cAAA,EAEF,MAAO,CAIL,MAAO,CAAE,KAAM,OAAQ,QAAS,IAAA,EAIhC,MAAO,CAAE,KAAM,OAAQ,QAAS,IAAA,EAIhC,KAAM,CAAE,KAAM,OAAQ,QAAS,IAAA,EAI/B,SAAU,CAAE,KAAM,QAAS,QAAS,EAAA,EAIpC,KAAM,CAAE,KAAM,OAA+B,QAASC,EAAAA,cAAc,MAAA,EAIpE,MAAO,CAAE,KAAM,OAAqC,QAASC,EAAAA,oBAAoB,OAAA,EAIjF,eAAgB,CAAE,KAAM,OAAqC,QAAS,IAAA,EAKtE,SAAU,CAAE,KAAM,QAAS,QAAS,EAAA,EAIpC,OAAQ,CAAE,KAAM,OAAQ,QAAS,SAAA,EAIjC,SAAU,CAAE,KAAM,QAAS,QAAS,EAAA,EAIpC,WAAY,CAAE,KAAM,OAAQ,QAAS,IAA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