@aotearoan/neon 21.0.0 → 21.0.1

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.
Files changed (68) hide show
  1. package/dist/common/enums/NeonBadgeSize.cjs.js +2 -0
  2. package/dist/common/enums/NeonBadgeSize.cjs.js.map +1 -0
  3. package/dist/common/enums/NeonBadgeSize.es.js +5 -0
  4. package/dist/common/enums/NeonBadgeSize.es.js.map +1 -0
  5. package/dist/common/utils/NeonDateUtils.cjs.js +1 -1
  6. package/dist/common/utils/NeonDateUtils.cjs.js.map +1 -1
  7. package/dist/common/utils/NeonDateUtils.es.js +52 -48
  8. package/dist/common/utils/NeonDateUtils.es.js.map +1 -1
  9. package/dist/components/presentation/badge/NeonBadge.cjs.js +1 -1
  10. package/dist/components/presentation/badge/NeonBadge.cjs.js.map +1 -1
  11. package/dist/components/presentation/badge/NeonBadge.es.js +8 -8
  12. package/dist/components/presentation/badge/NeonBadge.es.js.map +1 -1
  13. package/dist/components/presentation/dropdown/NeonDropdown.cjs.js +1 -1
  14. package/dist/components/presentation/dropdown/NeonDropdown.cjs.js.map +1 -1
  15. package/dist/components/presentation/dropdown/NeonDropdown.es.js +28 -24
  16. package/dist/components/presentation/dropdown/NeonDropdown.es.js.map +1 -1
  17. package/dist/components/presentation/dropdown/NeonDropdown.vue.cjs.js +1 -1
  18. package/dist/components/presentation/dropdown/NeonDropdown.vue.cjs.js.map +1 -1
  19. package/dist/components/presentation/dropdown/NeonDropdown.vue.es.js +23 -21
  20. package/dist/components/presentation/dropdown/NeonDropdown.vue.es.js.map +1 -1
  21. package/dist/components/user-input/button/NeonButton.cjs.js +1 -1
  22. package/dist/components/user-input/button/NeonButton.cjs.js.map +1 -1
  23. package/dist/components/user-input/button/NeonButton.es.js +26 -22
  24. package/dist/components/user-input/button/NeonButton.es.js.map +1 -1
  25. package/dist/components/user-input/button/NeonButton.vue.cjs.js +1 -1
  26. package/dist/components/user-input/button/NeonButton.vue.cjs.js.map +1 -1
  27. package/dist/components/user-input/button/NeonButton.vue.es.js +11 -10
  28. package/dist/components/user-input/button/NeonButton.vue.es.js.map +1 -1
  29. package/dist/components/user-input/date-picker/NeonDatePicker.cjs.js +1 -1
  30. package/dist/components/user-input/date-picker/NeonDatePicker.cjs.js.map +1 -1
  31. package/dist/components/user-input/date-picker/NeonDatePicker.es.js +27 -23
  32. package/dist/components/user-input/date-picker/NeonDatePicker.es.js.map +1 -1
  33. package/dist/components/user-input/date-picker/NeonDatePicker.vue.cjs.js +1 -1
  34. package/dist/components/user-input/date-picker/NeonDatePicker.vue.cjs.js.map +1 -1
  35. package/dist/components/user-input/date-picker/NeonDatePicker.vue.es.js +99 -114
  36. package/dist/components/user-input/date-picker/NeonDatePicker.vue.es.js.map +1 -1
  37. package/dist/components/user-input/input/NeonInput.cjs.js +1 -1
  38. package/dist/components/user-input/input/NeonInput.cjs.js.map +1 -1
  39. package/dist/components/user-input/input/NeonInput.es.js +30 -30
  40. package/dist/components/user-input/input/NeonInput.es.js.map +1 -1
  41. package/dist/neon.cjs.js +1 -1
  42. package/dist/neon.es.js +93 -91
  43. package/dist/neon.es.js.map +1 -1
  44. package/dist/src/common/enums/NeonBadgeSize.d.ts +15 -0
  45. package/dist/src/common/models/NeonCalendarConfig.d.ts +10 -0
  46. package/dist/src/common/utils/NeonDateUtils.d.ts +4 -2
  47. package/dist/src/components/feedback/dialog/NeonDialog.d.ts +12 -0
  48. package/dist/src/components/feedback/note/NeonNote.d.ts +6 -0
  49. package/dist/src/components/layout/card-list/NeonCardList.d.ts +20 -4
  50. package/dist/src/components/layout/modal/NeonModal.d.ts +6 -0
  51. package/dist/src/components/navigation/dropdown-menu/NeonDropdownMenu.d.ts +123 -39
  52. package/dist/src/components/navigation/menu/NeonMenu.d.ts +99 -27
  53. package/dist/src/components/navigation/mobile-menu/NeonMobileMenu.d.ts +57 -39
  54. package/dist/src/components/presentation/badge/NeonBadge.d.ts +12 -20
  55. package/dist/src/components/presentation/dropdown/NeonDropdown.d.ts +45 -23
  56. package/dist/src/components/presentation/image-carousel/NeonImageCarousel.d.ts +6 -0
  57. package/dist/src/components/user-input/button/NeonButton.d.ts +15 -1
  58. package/dist/src/components/user-input/date-picker/NeonDatePicker.d.ts +144 -116
  59. package/dist/src/components/user-input/file/NeonFile.d.ts +16 -14
  60. package/dist/src/components/user-input/input/NeonInput.d.ts +5 -9
  61. package/dist/src/components/user-input/number/NeonNumber.d.ts +20 -46
  62. package/dist/src/components/user-input/search/NeonSearch.d.ts +165 -165
  63. package/dist/src/components/user-input/select/NeonSelect.d.ts +261 -81
  64. package/dist/src/neon.d.ts +1 -0
  65. package/package.json +1 -1
  66. package/src/sass/components/_badge.scss +16 -42
  67. package/src/sass/components/_date-picker.scss +20 -0
  68. package/src/sass/variables.scss +7 -1
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var t=(r=>(r.Small="s",r.Medium="m",r.Large="l",r.ExtraLarge="xl",r.ExtraExtraLarge="xxl",r))(t||{});exports.NeonBadgeSize=t;
2
+ //# sourceMappingURL=NeonBadgeSize.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NeonBadgeSize.cjs.js","sources":["../../../src/common/enums/NeonBadgeSize.ts"],"sourcesContent":["/**\n * Describes the available sizing options for <a href=\"/presentation/badge\">NeonBadge</a>.\n */\nexport enum NeonBadgeSize {\n /** A small badge size, typically has a default of 32 rem. */\n Small = 's',\n /** A medium badge size, usually the default size. Which typically has a default of 40 rem. */\n Medium = 'm',\n /** A large badge size, typically has a default of 48 rem. */\n Large = 'l',\n /** An extra large badge size, typically has a default of 64 rem. */\n ExtraLarge = 'xl',\n /** An extra, extra large badge size, typically has a default of 80 rem. */\n ExtraExtraLarge = 'xxl',\n}\n"],"names":["NeonBadgeSize"],"mappings":"gFAGO,IAAKA,GAAAA,IAEVA,EAAA,MAAQ,IAERA,EAAA,OAAS,IAETA,EAAA,MAAQ,IAERA,EAAA,WAAa,KAEbA,EAAA,gBAAkB,MAVRA,IAAAA,GAAA,CAAA,CAAA"}
@@ -0,0 +1,5 @@
1
+ var x = /* @__PURE__ */ ((r) => (r.Small = "s", r.Medium = "m", r.Large = "l", r.ExtraLarge = "xl", r.ExtraExtraLarge = "xxl", r))(x || {});
2
+ export {
3
+ x as NeonBadgeSize
4
+ };
5
+ //# sourceMappingURL=NeonBadgeSize.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NeonBadgeSize.es.js","sources":["../../../src/common/enums/NeonBadgeSize.ts"],"sourcesContent":["/**\n * Describes the available sizing options for <a href=\"/presentation/badge\">NeonBadge</a>.\n */\nexport enum NeonBadgeSize {\n /** A small badge size, typically has a default of 32 rem. */\n Small = 's',\n /** A medium badge size, usually the default size. Which typically has a default of 40 rem. */\n Medium = 'm',\n /** A large badge size, typically has a default of 48 rem. */\n Large = 'l',\n /** An extra large badge size, typically has a default of 64 rem. */\n ExtraLarge = 'xl',\n /** An extra, extra large badge size, typically has a default of 80 rem. */\n ExtraExtraLarge = 'xxl',\n}\n"],"names":["NeonBadgeSize"],"mappings":"AAGO,IAAKA,sBAAAA,OAEVA,EAAA,QAAQ,KAERA,EAAA,SAAS,KAETA,EAAA,QAAQ,KAERA,EAAA,aAAa,MAEbA,EAAA,kBAAkB,OAVRA,IAAAA,KAAA,CAAA,CAAA;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class i{static stringToNeonDate(t,o,e=!1){const a=o||navigator.language,g=new Date,n=new Date(!e&&t.length===10?`${t}T${g.toISOString().split("T")[1]}`:t);let r;t.length>10&&(r=n.toLocaleString(a,t.length<=16?{hour12:!1,hour:"2-digit",minute:"2-digit"}:{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"}));const d={year:+n.toLocaleString("en-US",{year:"numeric"}),yearFormatted:n.toLocaleString(a,{year:"numeric"}),month:+n.toLocaleString("en-US",{month:"numeric"}),monthShortName:n.toLocaleString(a,{month:"short"}),monthLongName:n.toLocaleString(a,{month:"long"}),day:+n.toLocaleString("en-US",{day:"numeric"}),dayFormatted:n.toLocaleString(a,{day:"2-digit"})};return r&&(d.time=r),d}static dateToIso(t,o=!1){const e=t.toISOString();return o?e:e.split("T")[0]}static dmyToIso(t,o,e){return`${e}-${o<10?"0"+o:o}-${t<10?"0"+t:t}`}static dowNames(t){const o=t||navigator.language,e=new Date,a=[];for(;!a[e.getDay()];)a[e.getDay()]=e.toLocaleString(o,{weekday:"short"}),e.setDate(e.getDate()+1);const g=a.shift();return g&&a.push(g),a}static monthNames(t){const o=t||navigator.language;return Array.from(Array(12).keys()).map(e=>new Date(2023,e,15).toLocaleString(o,{month:"short"}))}static toCalendarConfiguration(t,o,e,a,g){const n=g||navigator.language,r=i.stringToNeonDate(i.dateToIso(new Date),n),d=t?i.stringToNeonDate(t,n,!0):void 0,h=o||r.month,S=o&&e?new Date(e,o-1,15):null,L=(S==null?void 0:S.toLocaleString(n,{month:"long"}))||r.monthLongName,u=e||r.year,T=a||Math.floor(u/10)*10,c=new Date(u,(h+11)%12,1),f=new Date(u,(h+11)%12,1);f.setDate(f.getDate()-1);const m=[];let D=1,w=!1;for(let s=0;s<6;s++){m[s]=[];for(let l=0;l<7;l++)if(s===0&&l<f.getDay())m[s][l]=null;else if(m[s][l]=c.getDate(),D=c.getDate(),c.setDate(c.getDate()+1),c.getDate()===1){for(let y=l+1;y<7;y++)m[s][y]=null;w=!0;break}if(w)break}return{today:r,selected:d,pageMonth:h,pageMonthName:L,pageYear:u,pageDecadeStart:T,dowNames:i.dowNames(n),dates:m,lastDayOfMonth:D,months:i.monthNames(n)}}}exports.NeonDateUtils=i;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class s{static stringToNeonDate(e,o,a=!1){const n=o||navigator.language,r=new Date,t=new Date(!a&&e.length===10?`${e}T${r.toISOString().split("T")[1]}`:e);let i;e.length>10&&(i=t.toLocaleString(n,e.length<=16?{hour12:!1,hour:"2-digit",minute:"2-digit"}:{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"}));const d={year:+t.toLocaleString("en-US",{year:"numeric"}),yearFormatted:t.toLocaleString(n,{year:"numeric"}),month:+t.toLocaleString("en-US",{month:"numeric"}),monthShortName:t.toLocaleString(n,{month:"short"}),monthLongName:t.toLocaleString(n,{month:"long"}),day:+t.toLocaleString("en-US",{day:"numeric"}),dayFormatted:t.toLocaleString(n,{day:"2-digit"})};return i&&(d.time=i),d}static dateToIso(e,o=!1){const a=e.toISOString();return o?a:a.split("T")[0]}static dmyToIso(e,o,a){return`${a}-${o<10?"0"+o:o}-${e<10?"0"+e:e}`}static dowNames(e,o="short"){const a=e||navigator.language,n=new Date,r=[];for(;!r[n.getDay()];)r[n.getDay()]=n.toLocaleString(a,{weekday:o}),n.setDate(n.getDate()+1);const t=r.shift();return t&&r.push(t),r}static monthNames(e,o="short"){const a=e||navigator.language;return Array.from(Array(12).keys()).map(n=>new Date(2023,n,15).toLocaleString(a,{month:o}))}static toCalendarConfiguration(e,o,a,n,r){const t=r||navigator.language,i=s.stringToNeonDate(s.dateToIso(new Date),t),d=e?s.stringToNeonDate(e,t,!0):void 0,u=o||i.month,S=o&&a?new Date(a,o-1,15):null,L=(S==null?void 0:S.toLocaleString(t,{month:"long"}))||i.monthLongName,h=a||i.year,N=n||Math.floor(h/10)*10,c=new Date(h,(u+11)%12,1),f=new Date(h,(u+11)%12,1);f.setDate(f.getDate()-1);const m=[];let D=1,w=!1;for(let g=0;g<6;g++){m[g]=[];for(let l=0;l<7;l++)if(g===0&&l<f.getDay())m[g][l]=null;else if(m[g][l]=c.getDate(),D=c.getDate(),c.setDate(c.getDate()+1),c.getDate()===1){for(let y=l+1;y<7;y++)m[g][y]=null;w=!0;break}if(w)break}return{today:i,selected:d,pageMonth:u,pageMonthName:L,pageYear:h,pageDecadeStart:N,dowNames:s.dowNames(t),dowLongNames:s.dowNames(t,"long"),dates:m,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 *\n * @returns an array with the days of the week named according to the locale received.\n */\n public static dowNames(locale?: string): 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: 'short' });\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 *\n * @returns an array with the month names of the year, all named according to the locale received.\n */\n public static monthNames(locale?: string): 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: 'short' });\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 dates,\n lastDayOfMonth,\n months: NeonDateUtils.monthNames(loc),\n };\n }\n}\n"],"names":["NeonDateUtils","date","locale","strict","loc","now","dateObj","time","result","dateString","day","month","year","weekdays","sunday","key","selectedDate","currentPageMonth","currentPageYear","currentPageDecadeStart","today","selected","pageMonth","pageDate","pageMonthName","pageYear","pageD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,EAE3C,IAAIC,EAAiB,EACjBC,EAAO,GAEX,QAASC,EAAM,EAAGA,EAAM,EAAGA,IAAO,CAChCH,EAAMG,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,EAAI/B,EAAK,QAAA,EACvB4B,EAAiB5B,EAAK,QAAA,EACtBA,EAAK,QAAQA,EAAK,QAAA,EAAY,CAAC,EAE3BA,EAAK,QAAA,IAAc,EAAG,CACxB,QAASgC,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,SAAU1B,EAAc,SAASI,CAAG,EACpC,MAAAwB,EACA,eAAAC,EACA,OAAQ7B,EAAc,WAAWI,CAAG,CAAA,CAExC,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 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,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,EAAQ,eACbF,EACAH,EAAK,QAAU,GACX,CAAE,OAAQ,GAAO,KAAM,UAAW,OAAQ,WAC1C,CAA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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 c {
1
+ class g {
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,23 @@ class c {
8
8
  *
9
9
  * @returns Object representing the provided date.
10
10
  */
11
- static stringToNeonDate(t, o, e = !1) {
12
- const a = o || navigator.language, i = /* @__PURE__ */ new Date(), n = new Date(!e && t.length === 10 ? `${t}T${i.toISOString().split("T")[1]}` : t);
13
- let r;
14
- t.length > 10 && (r = n.toLocaleString(
15
- a,
16
- t.length <= 16 ? { hour12: !1, hour: "2-digit", minute: "2-digit" } : { hour12: !1, hour: "2-digit", minute: "2-digit", second: "2-digit" }
11
+ static stringToNeonDate(e, o, a = !1) {
12
+ const n = o || navigator.language, r = /* @__PURE__ */ new Date(), t = new Date(!a && e.length === 10 ? `${e}T${r.toISOString().split("T")[1]}` : e);
13
+ let s;
14
+ e.length > 10 && (s = t.toLocaleString(
15
+ n,
16
+ e.length <= 16 ? { hour12: !1, hour: "2-digit", minute: "2-digit" } : { hour12: !1, hour: "2-digit", minute: "2-digit", second: "2-digit" }
17
17
  ));
18
18
  const d = {
19
- year: +n.toLocaleString("en-US", { year: "numeric" }),
20
- yearFormatted: n.toLocaleString(a, { year: "numeric" }),
21
- month: +n.toLocaleString("en-US", { month: "numeric" }),
22
- monthShortName: n.toLocaleString(a, { month: "short" }),
23
- monthLongName: n.toLocaleString(a, { month: "long" }),
24
- day: +n.toLocaleString("en-US", { day: "numeric" }),
25
- dayFormatted: n.toLocaleString(a, { day: "2-digit" })
19
+ year: +t.toLocaleString("en-US", { year: "numeric" }),
20
+ yearFormatted: t.toLocaleString(n, { year: "numeric" }),
21
+ month: +t.toLocaleString("en-US", { month: "numeric" }),
22
+ monthShortName: t.toLocaleString(n, { month: "short" }),
23
+ monthLongName: t.toLocaleString(n, { month: "long" }),
24
+ day: +t.toLocaleString("en-US", { day: "numeric" }),
25
+ dayFormatted: t.toLocaleString(n, { day: "2-digit" })
26
26
  };
27
- return r && (d.time = r), d;
27
+ return s && (d.time = s), d;
28
28
  }
29
29
  /**
30
30
  * Convert a date object to an ISO 8601 formatted string. By default, the time is not considered.
@@ -34,9 +34,9 @@ class c {
34
34
  *
35
35
  * @returns an ISO 8601 formatted date, optionally with the time as well.
36
36
  */
37
- static dateToIso(t, o = !1) {
38
- const e = t.toISOString();
39
- return o ? e : e.split("T")[0];
37
+ static dateToIso(e, o = !1) {
38
+ const a = e.toISOString();
39
+ return o ? a : a.split("T")[0];
40
40
  }
41
41
  /**
42
42
  * Convert the params received into an ISO 8601 formatted string with only date in it.
@@ -47,33 +47,35 @@ class c {
47
47
  *
48
48
  * @returns an ISO 8601 formatted date for the given parameters.
49
49
  */
50
- static dmyToIso(t, o, e) {
51
- return `${e}-${o < 10 ? "0" + o : o}-${t < 10 ? "0" + t : t}`;
50
+ static dmyToIso(e, o, a) {
51
+ return `${a}-${o < 10 ? "0" + o : o}-${e < 10 ? "0" + e : e}`;
52
52
  }
53
53
  /**
54
54
  * Returns the days of the week starting at Monday day name translated using the locale received as a first element.
55
55
  *
56
56
  * @param locale The locale for which to convert the date for display purposes, defaults to browser locale.
57
+ * @param format The format of the returned values
57
58
  *
58
59
  * @returns an array with the days of the week named according to the locale received.
59
60
  */
60
- static dowNames(t) {
61
- const o = t || navigator.language, e = /* @__PURE__ */ new Date(), a = [];
62
- for (; !a[e.getDay()]; )
63
- a[e.getDay()] = e.toLocaleString(o, { weekday: "short" }), e.setDate(e.getDate() + 1);
64
- const i = a.shift();
65
- return i && a.push(i), a;
61
+ static dowNames(e, o = "short") {
62
+ const a = e || navigator.language, n = /* @__PURE__ */ new Date(), r = [];
63
+ for (; !r[n.getDay()]; )
64
+ r[n.getDay()] = n.toLocaleString(a, { weekday: o }), n.setDate(n.getDate() + 1);
65
+ const t = r.shift();
66
+ return t && r.push(t), r;
66
67
  }
67
68
  /**
68
69
  * Returns the months of the year starting at January month name translated using the locale received as a first element.
69
70
  *
70
71
  * @param locale The locale for which to convert the date for display purposes, defaults to browser locale.
72
+ * @param format The format of the month names to return
71
73
  *
72
74
  * @returns an array with the month names of the year, all named according to the locale received.
73
75
  */
74
- static monthNames(t) {
75
- const o = t || navigator.language;
76
- return Array.from(Array(12).keys()).map((e) => new Date(2023, e, 15).toLocaleString(o, { month: "short" }));
76
+ static monthNames(e, o = "short") {
77
+ const a = e || navigator.language;
78
+ return Array.from(Array(12).keys()).map((n) => new Date(2023, n, 15).toLocaleString(a, { month: o }));
77
79
  }
78
80
  /**
79
81
  * Collate & return the data required to drive the calendar popup in
@@ -87,40 +89,42 @@ class c {
87
89
  *
88
90
  * @returns The calendar configuration.
89
91
  */
90
- static toCalendarConfiguration(t, o, e, a, i) {
91
- const n = i || navigator.language, r = c.stringToNeonDate(c.dateToIso(/* @__PURE__ */ new Date()), n), d = t ? c.stringToNeonDate(t, n, !0) : void 0, u = o || r.month, f = o && e ? new Date(e, o - 1, 15) : null, L = (f == null ? void 0 : f.toLocaleString(n, { month: "long" })) || r.monthLongName, h = e || r.year, T = a || Math.floor(h / 10) * 10, l = new Date(h, (u + 11) % 12, 1), S = new Date(h, (u + 11) % 12, 1);
92
+ static toCalendarConfiguration(e, o, a, n, r) {
93
+ const t = r || navigator.language, s = g.stringToNeonDate(g.dateToIso(/* @__PURE__ */ new Date()), t), d = e ? g.stringToNeonDate(e, t, !0) : void 0, u = o || s.month, f = o && a ? new Date(a, o - 1, 15) : null, L = (f == null ? void 0 : f.toLocaleString(t, { month: "long" })) || s.monthLongName, h = a || s.year, N = n || Math.floor(h / 10) * 10, l = new Date(h, (u + 11) % 12, 1), S = new Date(h, (u + 11) % 12, 1);
92
94
  S.setDate(S.getDate() - 1);
93
95
  const m = [];
94
- let y = 1, w = !1;
95
- for (let s = 0; s < 6; s++) {
96
- m[s] = [];
97
- for (let g = 0; g < 7; g++)
98
- if (s === 0 && g < S.getDay())
99
- m[s][g] = null;
100
- else if (m[s][g] = l.getDate(), y = l.getDate(), l.setDate(l.getDate() + 1), l.getDate() === 1) {
101
- for (let D = g + 1; D < 7; D++)
102
- m[s][D] = null;
103
- w = !0;
96
+ let w = 1, D = !1;
97
+ for (let i = 0; i < 6; i++) {
98
+ m[i] = [];
99
+ for (let c = 0; c < 7; c++)
100
+ if (i === 0 && c < S.getDay())
101
+ m[i][c] = null;
102
+ else if (m[i][c] = l.getDate(), w = l.getDate(), l.setDate(l.getDate() + 1), l.getDate() === 1) {
103
+ for (let y = c + 1; y < 7; y++)
104
+ m[i][y] = null;
105
+ D = !0;
104
106
  break;
105
107
  }
106
- if (w)
108
+ if (D)
107
109
  break;
108
110
  }
109
111
  return {
110
- today: r,
112
+ today: s,
111
113
  selected: d,
112
114
  pageMonth: u,
113
115
  pageMonthName: L,
114
116
  pageYear: h,
115
- pageDecadeStart: T,
116
- dowNames: c.dowNames(n),
117
+ pageDecadeStart: N,
118
+ dowNames: g.dowNames(t),
119
+ dowLongNames: g.dowNames(t, "long"),
117
120
  dates: m,
118
- lastDayOfMonth: y,
119
- months: c.monthNames(n)
121
+ lastDayOfMonth: w,
122
+ months: g.monthNames(t),
123
+ monthLongNames: g.monthNames(t, "long")
120
124
  };
121
125
  }
122
126
  }
123
127
  export {
124
- c as NeonDateUtils
128
+ g as NeonDateUtils
125
129
  };
126
130
  //# 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 *\n * @returns an array with the days of the week named according to the locale received.\n */\n public static dowNames(locale?: string): 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: 'short' });\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 *\n * @returns an array with the month names of the year, all named according to the locale received.\n */\n public static monthNames(locale?: string): 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: 'short' });\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 dates,\n lastDayOfMonth,\n months: NeonDateUtils.monthNames(loc),\n };\n }\n}\n"],"names":["NeonDateUtils","date","locale","strict","loc","now","dateObj","time","result","dateString","day","month","year","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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
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,EAAE,KAAK,WAAW;AAAA,IAAA;AAG9D,WAAIG,MACFC,EAAO,OAAOD,IAGTC;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,OAA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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,2 +1,2 @@
1
- "use strict";const l=require("vue"),r=require("../../../common/enums/NeonSize.cjs.js"),e=require("../../../common/enums/NeonFunctionalColor.cjs.js"),s=require("../icon/NeonIcon.vue.cjs.js"),d=require("../../../common/utils/NeonJazziconUtils.cjs.js"),g=require("../../../common/utils/NeonColorUtils.cjs.js"),m=l.defineComponent({name:"NeonBadge",components:{NeonIcon:s},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:r.NeonSize.Medium},color:{type:String,default:e.NeonFunctionalColor.LowContrast},alternateColor:{type:String,default:null},disabled:{type:Boolean,default:!1},jazziconId:{type:String,default:null},imageAlt:{type:String,default:"Badge"}},setup(n){const o=a=>{let t=getComputedStyle(document.documentElement).getPropertyValue(`--neon-rgb-${a}-l1`);t.length===0&&(t="0, 0, 0");const u=t.trim().split(", ").map(c=>+c);return g.NeonColorUtils.rgbToHex(u)},i=l.computed(()=>["#000000",o(e.NeonFunctionalColor.Brand),o(e.NeonFunctionalColor.Primary),o(e.NeonFunctionalColor.Info),o(e.NeonFunctionalColor.Success),o(e.NeonFunctionalColor.Warn),o(e.NeonFunctionalColor.Error)]);return{svg:l.computed(()=>n.jazziconId?d.NeonJazziconUtils.genSvg(i.value,n.jazziconId,n.size===r.NeonSize.Small?32:n.size===r.NeonSize.Medium?40:48):null)}}});module.exports=m;
1
+ "use strict";const l=require("vue"),e=require("../../../common/enums/NeonFunctionalColor.cjs.js"),s=require("../icon/NeonIcon.vue.cjs.js"),d=require("../../../common/utils/NeonJazziconUtils.cjs.js"),g=require("../../../common/utils/NeonColorUtils.cjs.js"),r=require("../../../common/enums/NeonBadgeSize.cjs.js"),m=l.defineComponent({name:"NeonBadge",components:{NeonIcon:s},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:r.NeonBadgeSize.Medium},color:{type:String,default:e.NeonFunctionalColor.LowContrast},alternateColor:{type:String,default:null},disabled:{type:Boolean,default:!1},jazziconId:{type:String,default:null},imageAlt:{type:String,default:"Badge"}},setup(n){const o=a=>{let t=getComputedStyle(document.documentElement).getPropertyValue(`--neon-rgb-${a}-l1`);t.length===0&&(t="0, 0, 0");const u=t.trim().split(", ").map(c=>+c);return g.NeonColorUtils.rgbToHex(u)},i=l.computed(()=>["#000000",o(e.NeonFunctionalColor.Brand),o(e.NeonFunctionalColor.Primary),o(e.NeonFunctionalColor.Info),o(e.NeonFunctionalColor.Success),o(e.NeonFunctionalColor.Warn),o(e.NeonFunctionalColor.Error)]);return{svg:l.computed(()=>n.jazziconId?d.NeonJazziconUtils.genSvg(i.value,n.jazziconId,n.size===r.NeonBadgeSize.Small?32:n.size===r.NeonBadgeSize.Medium?40:48):null)}}});module.exports=m;
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 { NeonSize } from '@/common/enums/NeonSize';\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';\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 - Small, Medium or Large.\n */\n size: { type: String as () => NeonSize, default: NeonSize.Medium },\n /**\n * The color of the badge. This is one of the provided NeonFunctionalColors.\n */\n color: { type: String as () => NeonFunctionalColor, default: NeonFunctionalColor.LowContrast },\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 * 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 setup(props) {\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 === NeonSize.Small ? 32 : props.size === NeonSize.Medium ? 40 : 48,\n )\n : null,\n );\n\n return {\n svg,\n };\n },\n});\n"],"names":["_sfc_main","defineComponent","NeonIcon","NeonSize","NeonFunctionalColor","props","getColor","key","colorString","colorRgb","str","NeonColorUtils","palette","computed","NeonJazziconUtils"],"mappings":"mTAUAA,EAAeC,kBAAgB,CAC7B,KAAM,YACN,WAAY,CACV,SAAAC,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,OAA0B,QAASC,EAAAA,SAAS,MAAA,EAI1D,MAAO,CAAE,KAAM,OAAqC,QAASC,EAAAA,oBAAoB,WAAA,EAIjF,eAAgB,CAAE,KAAM,OAAqC,QAAS,IAAA,EAItE,SAAU,CAAE,KAAM,QAAS,QAAS,EAAA,EAIpC,WAAY,CAAE,KAAM,OAAQ,QAAS,IAAA,EAIrC,SAAU,CAAE,KAAM,OAAQ,QAAS,OAAA,CAAQ,EAE7C,MAAMC,EAAO,CACX,MAAMC,EAAYC,GAA6B,CAC7C,IAAIC,EAAc,iBAAiB,SAAS,eAAe,EAAE,iBAAiB,cAAcD,CAAG,KAAK,EAChGC,EAAY,SAAW,IACzBA,EAAc,WAEhB,MAAMC,EAAWD,EACd,KAAA,EACA,MAAM,IAAI,EACV,IAAKE,GAAQ,CAACA,CAAG,EACpB,OAAOC,EAAAA,eAAe,SAASF,CAAQ,CACzC,EAEMG,EAAUC,EAAAA,SAAS,IAAM,CAC7B,UACAP,EAASF,EAAAA,oBAAoB,KAAK,EAClCE,EAASF,EAAAA,oBAAoB,OAAO,EACpCE,EAASF,EAAAA,oBAAoB,IAAI,EACjCE,EAASF,EAAAA,oBAAoB,OAAO,EACpCE,EAASF,EAAAA,oBAAoB,IAAI,EACjCE,EAASF,EAAAA,oBAAoB,KAAK,CAAA,CACnC,EAYD,MAAO,CACL,IAXUS,EAAAA,SAAS,IACnBR,EAAM,WACFS,EAAAA,kBAAkB,OAChBF,EAAQ,MACRP,EAAM,WACNA,EAAM,OAASF,EAAAA,SAAS,MAAQ,GAAKE,EAAM,OAASF,EAAAA,SAAS,OAAS,GAAK,EAAA,EAE7E,IAAA,CAIJ,CAEJ,CACF,CAAC"}
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.LowContrast },\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 * 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 setup(props) {\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 svg,\n };\n },\n});\n"],"names":["_sfc_main","defineComponent","NeonIcon","NeonBadgeSize","NeonFunctionalColor","props","getColor","key","colorString","colorRgb","str","NeonColorUtils","palette","computed","NeonJazziconUtils"],"mappings":"wTAUAA,EAAeC,kBAAgB,CAC7B,KAAM,YACN,WAAY,CACV,SAAAC,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,WAAA,EAIjF,eAAgB,CAAE,KAAM,OAAqC,QAAS,IAAA,EAItE,SAAU,CAAE,KAAM,QAAS,QAAS,EAAA,EAIpC,WAAY,CAAE,KAAM,OAAQ,QAAS,IAAA,EAIrC,SAAU,CAAE,KAAM,OAAQ,QAAS,OAAA,CAAQ,EAE7C,MAAMC,EAAO,CACX,MAAMC,EAAYC,GAA6B,CAC7C,IAAIC,EAAc,iBAAiB,SAAS,eAAe,EAAE,iBAAiB,cAAcD,CAAG,KAAK,EAChGC,EAAY,SAAW,IACzBA,EAAc,WAEhB,MAAMC,EAAWD,EACd,KAAA,EACA,MAAM,IAAI,EACV,IAAKE,GAAQ,CAACA,CAAG,EACpB,OAAOC,EAAAA,eAAe,SAASF,CAAQ,CACzC,EAEMG,EAAUC,EAAAA,SAAS,IAAM,CAC7B,UACAP,EAASF,EAAAA,oBAAoB,KAAK,EAClCE,EAASF,EAAAA,oBAAoB,OAAO,EACpCE,EAASF,EAAAA,oBAAoB,IAAI,EACjCE,EAASF,EAAAA,oBAAoB,OAAO,EACpCE,EAASF,EAAAA,oBAAoB,IAAI,EACjCE,EAASF,EAAAA,oBAAoB,KAAK,CAAA,CACnC,EAYD,MAAO,CACL,IAXUS,EAAAA,SAAS,IACnBR,EAAM,WACFS,EAAAA,kBAAkB,OAChBF,EAAQ,MACRP,EAAM,WACNA,EAAM,OAASF,EAAAA,cAAc,MAAQ,GAAKE,EAAM,OAASF,EAAAA,cAAc,OAAS,GAAK,EAAA,EAEvF,IAAA,CAIJ,CAEJ,CACF,CAAC"}
@@ -1,13 +1,13 @@
1
1
  import { defineComponent as d, computed as r } from "vue";
2
- import { NeonSize as l } from "../../../common/enums/NeonSize.es.js";
3
2
  import { NeonFunctionalColor as e } from "../../../common/enums/NeonFunctionalColor.es.js";
4
- import c from "../icon/NeonIcon.vue.es.js";
5
- import { NeonJazziconUtils as g } from "../../../common/utils/NeonJazziconUtils.es.js";
3
+ import g from "../icon/NeonIcon.vue.es.js";
4
+ import { NeonJazziconUtils as c } from "../../../common/utils/NeonJazziconUtils.es.js";
6
5
  import { NeonColorUtils as f } from "../../../common/utils/NeonColorUtils.es.js";
7
- const b = d({
6
+ import { NeonBadgeSize as l } from "../../../common/enums/NeonBadgeSize.es.js";
7
+ const N = d({
8
8
  name: "NeonBadge",
9
9
  components: {
10
- NeonIcon: c
10
+ NeonIcon: g
11
11
  },
12
12
  props: {
13
13
  /**
@@ -27,7 +27,7 @@ const b = d({
27
27
  */
28
28
  circular: { type: Boolean, default: !1 },
29
29
  /**
30
- * The size of the badge - Small, Medium or Large.
30
+ * The size of the badge - s, m, l, xl, xxl.
31
31
  */
32
32
  size: { type: String, default: l.Medium },
33
33
  /**
@@ -68,7 +68,7 @@ const b = d({
68
68
  ]);
69
69
  return {
70
70
  svg: r(
71
- () => o.jazziconId ? g.genSvg(
71
+ () => o.jazziconId ? c.genSvg(
72
72
  a.value,
73
73
  o.jazziconId,
74
74
  o.size === l.Small ? 32 : o.size === l.Medium ? 40 : 48
@@ -78,6 +78,6 @@ const b = d({
78
78
  }
79
79
  });
80
80
  export {
81
- b as default
81
+ N as default
82
82
  };
83
83
  //# sourceMappingURL=NeonBadge.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"NeonBadge.es.js","sources":["../../../../src/components/presentation/badge/NeonBadge.ts?vue&type=script&src=true&lang.ts"],"sourcesContent":["import { computed, defineComponent } from 'vue';\nimport { NeonSize } from '@/common/enums/NeonSize';\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';\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 - Small, Medium or Large.\n */\n size: { type: String as () => NeonSize, default: NeonSize.Medium },\n /**\n * The color of the badge. This is one of the provided NeonFunctionalColors.\n */\n color: { type: String as () => NeonFunctionalColor, default: NeonFunctionalColor.LowContrast },\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 * 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 setup(props) {\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 === NeonSize.Small ? 32 : props.size === NeonSize.Medium ? 40 : 48,\n )\n : null,\n );\n\n return {\n svg,\n };\n },\n});\n"],"names":["_sfc_main","defineComponent","NeonIcon","NeonSize","NeonFunctionalColor","props","getColor","key","colorString","colorRgb","str","NeonColorUtils","palette","computed","NeonJazziconUtils"],"mappings":";;;;;;AAUA,MAAAA,IAAeC,EAAgB;AAAA,EAC7B,MAAM;AAAA,EACN,YAAY;AAAA,IACV,UAAAC;AAAA,EAAA;AAAA,EAEF,OAAO;AAAA;AAAA;AAAA;AAAA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,CACnC;AAYD,WAAO;AAAA,MACL,KAXUS;AAAA,QAAS,MACnBR,EAAM,aACFS,EAAkB;AAAA,UAChBF,EAAQ;AAAA,UACRP,EAAM;AAAA,UACNA,EAAM,SAASF,EAAS,QAAQ,KAAKE,EAAM,SAASF,EAAS,SAAS,KAAK;AAAA,QAAA,IAE7E;AAAA,MAAA;AAAA,IAIJ;AAAA,EAEJ;AACF,CAAC;"}
1
+ {"version":3,"file":"NeonBadge.es.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.LowContrast },\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 * 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 setup(props) {\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 svg,\n };\n },\n});\n"],"names":["_sfc_main","defineComponent","NeonIcon","NeonBadgeSize","NeonFunctionalColor","props","getColor","key","colorString","colorRgb","str","NeonColorUtils","palette","computed","NeonJazziconUtils"],"mappings":";;;;;;AAUA,MAAAA,IAAeC,EAAgB;AAAA,EAC7B,MAAM;AAAA,EACN,YAAY;AAAA,IACV,UAAAC;AAAA,EAAA;AAAA,EAEF,OAAO;AAAA;AAAA;AAAA;AAAA,IAIL,OAAO,EAAE,MAAM,QAAQ,SAAS,KAAA;AAAA;AAAA;AAAA;AAAA,IAIhC,OAAO,EAAE,MAAM,QAAQ,SAAS,KAAA;AAAA;AAAA;AAAA;AAAA,IAIhC,MAAM,EAAE,MAAM,QAAQ,SAAS,KAAA;AAAA;AAAA;AAAA;AAAA,IAI/B,UAAU,EAAE,MAAM,SAAS,SAAS,GAAA;AAAA;AAAA;AAAA;AAAA,IAIpC,MAAM,EAAE,MAAM,QAA+B,SAAS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common/enums/NeonDropdownPlacement.cjs.js"),w=require("../../../common/utils/NeonDropdownPlacementUtils.cjs.js"),y=require("../../../common/utils/NeonClosableUtils.cjs.js"),S=require("../../../common/enums/NeonSize.cjs.js"),g=require("../../../common/enums/NeonFunctionalColor.cjs.js"),N=require("../../../common/enums/NeonDropdownStyle.cjs.js"),C=require("../badge/NeonBadge.vue.cjs.js"),b=require("../../user-input/button/NeonButton.vue.cjs.js"),q=require("../expansion-indicator/NeonExpansionIndicator.vue.cjs.js"),B=n.defineComponent({name:"NeonDropdown",components:{NeonBadge:C,NeonButton:b,NeonExpansionIndicator:q},props:{id:{type:String},modelValue:{type:Boolean,required:!0},label:{type:String,default:null},image:{type:String,default:null},imageAlt:{type:String,default:null},icon:{type:String,default:null},indicator:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},size:{type:String,default:S.NeonSize.Medium},color:{type:String,default:g.NeonFunctionalColor.LowContrast},alternateColor:{type:String,default:null},dropdownStyle:{type:String,default:N.NeonDropdownStyle.SolidButton},placement:{type:String,default:v.NeonDropdownPlacement.BottomLeft},placementContainer:{type:Object,default:null},openOnHover:{type:Boolean,default:!1}},emits:["update:modelValue","dropdown-placement","blur","focus","button-ref"],setup(e,{emit:o}){const r=n.ref(null),l=n.ref(null),u=n.ref(e.placement),i=n.ref(null),d=()=>{o("update:modelValue",!1)},c=()=>{e.modelValue&&d()},t=()=>{if(e.modelValue&&r.value&&l.value){const a=u.value;u.value=w.NeonDropdownPlacementUtils.calculatePlacement(r.value,l.value,e.placement,e.placementContainer),a!==u.value&&o("dropdown-placement",u.value)}},s=()=>{!e.disabled&&!e.openOnHover&&(o("update:modelValue",!e.modelValue),setTimeout(t))},f=n.computed(()=>{var a;return((a=e.dropdownStyle)==null?void 0:a.indexOf("badge"))===-1}),m=()=>{o("blur")},p=()=>{o("focus")};return n.onMounted(()=>{!e.openOnHover&&l.value&&(i.value=new y.NeonClosableUtils(l.value,c)),window.addEventListener("resize",t,{passive:!0}),window.addEventListener("scroll",t,{passive:!0}),e.placementContainer&&e.placementContainer.addEventListener("scroll",t,{passive:!0})}),n.onUnmounted(()=>{e.openOnHover||i.value&&i.value.destroy(),window.removeEventListener("resize",t),window.removeEventListener("scroll",t),e.placementContainer&&e.placementContainer.removeEventListener("scroll",t)}),n.watch(()=>r.value,a=>o("button-ref",a),{immediate:!0}),n.defineExpose({dropdownContent:l}),{dropdownButton:r,dropdownContent:l,dropdownPlacement:u,closableUtils:i,isButtonStyle:f,onClose:d,close:c,toggleOpen:s,onBlur:m,onFocus:p}}});module.exports=B;
1
+ "use strict";const n=require("vue"),w=require("../../../common/enums/NeonDropdownPlacement.cjs.js"),y=require("../../../common/utils/NeonDropdownPlacementUtils.cjs.js"),S=require("../../../common/utils/NeonClosableUtils.cjs.js"),g=require("../../../common/enums/NeonSize.cjs.js"),N=require("../../../common/enums/NeonFunctionalColor.cjs.js"),C=require("../../../common/enums/NeonDropdownStyle.cjs.js"),b=require("../badge/NeonBadge.vue.cjs.js"),q=require("../../user-input/button/NeonButton.vue.cjs.js"),B=require("../expansion-indicator/NeonExpansionIndicator.vue.cjs.js"),L=n.defineComponent({name:"NeonDropdown",components:{NeonBadge:b,NeonButton:q,NeonExpansionIndicator:B},props:{id:{type:String},modelValue:{type:Boolean,required:!0},label:{type:String,default:null},image:{type:String,default:null},imageAlt:{type:String,default:null},icon:{type:String,default:null},iconAriaLabel:{type:String},indicator:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},size:{type:String,default:g.NeonSize.Medium},color:{type:String,default:N.NeonFunctionalColor.LowContrast},alternateColor:{type:String,default:null},dropdownStyle:{type:String,default:C.NeonDropdownStyle.SolidButton},placement:{type:String,default:w.NeonDropdownPlacement.BottomLeft},placementContainer:{type:Object,default:null},openOnHover:{type:Boolean,default:!1}},emits:["update:modelValue","dropdown-placement","blur","focus","button-ref"],setup(e,{emit:o,expose:s}){const u=n.ref(null),l=n.ref(null),r=n.ref(e.placement),i=n.ref(null),d=()=>{o("update:modelValue",!1)},c=()=>{e.modelValue&&d()},t=()=>{if(e.modelValue&&u.value&&l.value){const a=r.value;r.value=y.NeonDropdownPlacementUtils.calculatePlacement(u.value,l.value,e.placement,e.placementContainer),a!==r.value&&o("dropdown-placement",r.value)}},m=()=>{!e.disabled&&!e.openOnHover&&(o("update:modelValue",!e.modelValue),setTimeout(t))},f=n.computed(()=>{var a;return((a=e.dropdownStyle)==null?void 0:a.indexOf("badge"))===-1}),p=()=>{o("blur")},v=()=>{o("focus")};return n.onMounted(()=>{!e.openOnHover&&l.value&&(i.value=new S.NeonClosableUtils(l.value,c)),window.addEventListener("resize",t,{passive:!0}),window.addEventListener("scroll",t,{passive:!0}),e.placementContainer&&e.placementContainer.addEventListener("scroll",t,{passive:!0})}),n.onUnmounted(()=>{e.openOnHover||i.value&&i.value.destroy(),window.removeEventListener("resize",t),window.removeEventListener("scroll",t),e.placementContainer&&e.placementContainer.removeEventListener("scroll",t)}),n.watch(()=>u.value,a=>o("button-ref",a),{immediate:!0}),s({dropdownContent:l}),{dropdownButton:u,dropdownContent:l,dropdownPlacement:r,closableUtils:i,isButtonStyle:f,onClose:d,close:c,toggleOpen:m,onBlur:p,onFocus:v}}});module.exports=L;
2
2
  //# sourceMappingURL=NeonDropdown.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"NeonDropdown.cjs.js","sources":["../../../../src/components/presentation/dropdown/NeonDropdown.ts?vue&type=script&src=true&lang.ts"],"sourcesContent":["import { computed, defineComponent, defineExpose, onMounted, onUnmounted, ref, watch } from 'vue';\nimport { NeonDropdownPlacement } from '@/common/enums/NeonDropdownPlacement';\nimport { NeonDropdownPlacementUtils } from '@/common/utils/NeonDropdownPlacementUtils';\nimport { NeonClosableUtils } from '@/common/utils/NeonClosableUtils';\nimport { NeonSize } from '@/common/enums/NeonSize';\nimport { NeonFunctionalColor } from '@/common/enums/NeonFunctionalColor';\nimport { NeonDropdownStyle } from '@/common/enums/NeonDropdownStyle';\nimport NeonBadge from '@/components/presentation/badge/NeonBadge.vue';\nimport NeonButton from '@/components/user-input/button/NeonButton.vue';\nimport NeonExpansionIndicator from '@/components/presentation/expansion-indicator/NeonExpansionIndicator.vue';\n\n/**\n * <p>A general purpose dropdown component. This component consists of a button, to trigger the dropdown to open, and\n * the dropdown content which is displayed above the page when the user clicks the button.</p>\n * <p>This can be useful for secondary (perhaps more complex) actions for which there is not enough space on the page or\n * the action is asynchronous allowing the user to perform the action and continue what they were doing. Examples are\n * providing links to copy and letting the user send feedback.</p>\n * <p><strong>NeonDropdown</strong> is the basis for the <strong>NeonDropdownMenu</strong> component and the\n * <strong>NeonSelect</strong> form component.</p>\n */\nexport default defineComponent({\n name: 'NeonDropdown',\n components: {\n NeonBadge,\n NeonButton,\n NeonExpansionIndicator,\n },\n props: {\n /**\n * Id for the dropdown button.\n */\n id: { type: String },\n /**\n * Whether the dropdown is currently open.\n */\n modelValue: { type: Boolean, required: true },\n /**\n * The label for the dropdown button.\n */\n label: { type: String, default: null },\n /**\n * URL of image to display if the button style is a square or circular badge.\n */\n image: { type: String, default: null },\n /**\n * Badge image ALT text.\n */\n imageAlt: { type: String, default: null },\n /**\n * An icon to display on the dropdown button. This will be to the left of any label, but can also be used on its own.\n */\n icon: { type: String, default: null },\n /**\n * Show the dropdown button's indicator (chevron).\n */\n indicator: { type: Boolean, default: true },\n /**\n * Disable the dropdown button\n */\n disabled: { type: Boolean, default: false },\n /**\n * The size of the dropdown button - Small, Medium or Large.\n */\n size: { type: String as () => NeonSize, default: NeonSize.Medium },\n /**\n * The color of the dropdown button\n */\n color: { type: String as () => NeonFunctionalColor, default: NeonFunctionalColor.LowContrast },\n /**\n * The alternate color of the dropdown button (for gradient buttons).\n */\n alternateColor: { type: String as () => NeonFunctionalColor, default: null },\n /**\n * The style of the dropdown button\n */\n dropdownStyle: { type: String as () => NeonDropdownStyle, default: NeonDropdownStyle.SolidButton },\n /**\n * Placement of the dropdown contents.\n */\n placement: { type: String as () => NeonDropdownPlacement, default: NeonDropdownPlacement.BottomLeft },\n /**\n * Restrict placement to within this container.\n */\n placementContainer: { type: Object as () => HTMLElement, default: null },\n /**\n * Instead of opening on click (default), open on hover.\n */\n openOnHover: { type: Boolean, default: false },\n },\n emits: [\n /**\n * Emitted when the dropdown button is toggled.\n * @type {boolean} the open state of the dropdown.\n */\n 'update:modelValue',\n /**\n * Emitted on initialisation.\n * @type {NeonDropdownPlacement} the placement of the dropdown.\n */\n 'dropdown-placement',\n /**\n * Emitted when the dropdown button is blurred.\n * @type {void}\n */\n 'blur',\n /**\n * Emitted when the dropdown button is focussed.\n * @type {void}\n */\n 'focus',\n /**\n * emitted on initialisation\n * @type {HTMLElement} the reference to the HTMLElement for the dropdown menu button.\n */\n 'button-ref',\n ],\n setup(props, { emit }) {\n const dropdownButton = ref<HTMLElement | null>(null);\n const dropdownContent = ref<HTMLDivElement | null>(null);\n\n const dropdownPlacement = ref<NeonDropdownPlacement>(props.placement);\n const closableUtils = ref<NeonClosableUtils | null>(null);\n\n const onClose = () => {\n emit('update:modelValue', false);\n };\n\n const close = () => {\n if (props.modelValue) {\n onClose();\n }\n };\n\n const recalculatePlacement = () => {\n if (props.modelValue && dropdownButton.value && dropdownContent.value) {\n const previousValue = dropdownPlacement.value;\n dropdownPlacement.value = NeonDropdownPlacementUtils.calculatePlacement(\n dropdownButton.value,\n dropdownContent.value,\n props.placement,\n props.placementContainer,\n );\n\n if (previousValue !== dropdownPlacement.value) {\n emit('dropdown-placement', dropdownPlacement.value);\n }\n }\n };\n\n const toggleOpen = () => {\n if (!props.disabled && !props.openOnHover) {\n emit('update:modelValue', !props.modelValue);\n setTimeout(recalculatePlacement);\n }\n };\n\n const isButtonStyle = computed<boolean>(() => props.dropdownStyle?.indexOf('badge') === -1);\n\n const onBlur = () => {\n emit('blur');\n };\n\n const onFocus = () => {\n emit('focus');\n };\n\n onMounted(() => {\n if (!props.openOnHover && dropdownContent.value) {\n closableUtils.value = new NeonClosableUtils(dropdownContent.value, close);\n }\n window.addEventListener('resize', recalculatePlacement, { passive: true });\n window.addEventListener('scroll', recalculatePlacement, { passive: true });\n if (props.placementContainer) {\n props.placementContainer.addEventListener('scroll', recalculatePlacement, { passive: true });\n }\n });\n\n onUnmounted(() => {\n if (!props.openOnHover) {\n closableUtils.value && closableUtils.value.destroy();\n }\n window.removeEventListener('resize', recalculatePlacement);\n window.removeEventListener('scroll', recalculatePlacement);\n if (props.placementContainer) {\n props.placementContainer.removeEventListener('scroll', recalculatePlacement);\n }\n });\n\n watch(\n () => dropdownButton.value,\n (value) => emit('button-ref', value),\n { immediate: true },\n );\n\n defineExpose({ dropdownContent });\n\n return {\n dropdownButton,\n dropdownContent,\n dropdownPlacement,\n closableUtils,\n isButtonStyle,\n onClose,\n close,\n toggleOpen,\n onBlur,\n onFocus,\n };\n },\n});\n"],"names":["_sfc_main","defineComponent","NeonBadge","NeonButton","NeonExpansionIndicator","NeonSize","NeonFunctionalColor","NeonDropdownStyle","NeonDropdownPlacement","props","emit","dropdownButton","ref","dropdownContent","dropdownPlacement","closableUtils","onClose","close","recalculatePlacement","previousValue","NeonDropdownPlacementUtils","toggleOpen","isButtonStyle","computed","_a","onBlur","onFocus","onMounted","NeonClosableUtils","onUnmounted","watch","value","defineExpose"],"mappings":"8jBAoBAA,EAAeC,kBAAgB,CAC7B,KAAM,eACN,WAAY,CACV,UAAAC,EACA,WAAAC,EACA,uBAAAC,CAAA,EAEF,MAAO,CAIL,GAAI,CAAE,KAAM,MAAA,EAIZ,WAAY,CAAE,KAAM,QAAS,SAAU,EAAA,EAIvC,MAAO,CAAE,KAAM,OAAQ,QAAS,IAAA,EAIhC,MAAO,CAAE,KAAM,OAAQ,QAAS,IAAA,EAIhC,SAAU,CAAE,KAAM,OAAQ,QAAS,IAAA,EAInC,KAAM,CAAE,KAAM,OAAQ,QAAS,IAAA,EAI/B,UAAW,CAAE,KAAM,QAAS,QAAS,EAAA,EAIrC,SAAU,CAAE,KAAM,QAAS,QAAS,EAAA,EAIpC,KAAM,CAAE,KAAM,OA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AAK,MAAM,CACb,EAEMgB,EAAU,IAAM,CACpBhB,EAAK,OAAO,CACd,EAEAiB,OAAAA,EAAAA,UAAU,IAAM,CACV,CAAClB,EAAM,aAAeI,EAAgB,QACxCE,EAAc,MAAQ,IAAIa,EAAAA,kBAAkBf,EAAgB,MAAOI,CAAK,GAE1E,OAAO,iBAAiB,SAAUC,EAAsB,CAAE,QAAS,GAAM,EACzE,OAAO,iBAAiB,SAAUA,EAAsB,CAAE,QAAS,GAAM,EACrET,EAAM,oBACRA,EAAM,mBAAmB,iBAAiB,SAAUS,EAAsB,CAAE,QAAS,GAAM,CAE/F,CAAC,EAEDW,EAAAA,YAAY,IAAM,CACXpB,EAAM,aACTM,EAAc,OAASA,EAAc,MAAM,QAAA,EAE7C,OAAO,oBAAoB,SAAUG,CAAoB,EACzD,OAAO,oBAAoB,SAAUA,CAAoB,EACrDT,EAAM,oBACRA,EAAM,mBAAmB,oBAAoB,SAAUS,CAAoB,CAE/E,CAAC,EAEDY,EAAAA,MACE,IAAMnB,EAAe,MACpBoB,GAAUrB,EAAK,aAAcqB,CAAK,EACnC,CAAE,UAAW,EAAA,CAAK,EAGpBC,EAAAA,aAAa,CAAE,gBAAAnB,EAAiB,EAEzB,CACL,eAAAF,EACA,gBAAAE,EACA,kBAAAC,EACA,cAAAC,EACA,cAAAO,EACA,QAAAN,EACA,MAAAC,EACA,WAAAI,EACA,OAAAI,EACA,QAAAC,CAAA,CAEJ,CACF,CAAC"}
1
+ {"version":3,"file":"NeonDropdown.cjs.js","sources":["../../../../src/components/presentation/dropdown/NeonDropdown.ts?vue&type=script&src=true&lang.ts"],"sourcesContent":["import { computed, defineComponent, onMounted, onUnmounted, ref, watch } from 'vue';\nimport { NeonDropdownPlacement } from '@/common/enums/NeonDropdownPlacement';\nimport { NeonDropdownPlacementUtils } from '@/common/utils/NeonDropdownPlacementUtils';\nimport { NeonClosableUtils } from '@/common/utils/NeonClosableUtils';\nimport { NeonSize } from '@/common/enums/NeonSize';\nimport { NeonFunctionalColor } from '@/common/enums/NeonFunctionalColor';\nimport { NeonDropdownStyle } from '@/common/enums/NeonDropdownStyle';\nimport NeonBadge from '@/components/presentation/badge/NeonBadge.vue';\nimport NeonButton from '@/components/user-input/button/NeonButton.vue';\nimport NeonExpansionIndicator from '@/components/presentation/expansion-indicator/NeonExpansionIndicator.vue';\n\n/**\n * <p>A general purpose dropdown component. This component consists of a button, to trigger the dropdown to open, and\n * the dropdown content which is displayed above the page when the user clicks the button.</p>\n * <p>This can be useful for secondary (perhaps more complex) actions for which there is not enough space on the page or\n * the action is asynchronous allowing the user to perform the action and continue what they were doing. Examples are\n * providing links to copy and letting the user send feedback.</p>\n * <p><strong>NeonDropdown</strong> is the basis for the <strong>NeonDropdownMenu</strong> component and the\n * <strong>NeonSelect</strong> form component.</p>\n */\nexport default defineComponent({\n name: 'NeonDropdown',\n components: {\n NeonBadge,\n NeonButton,\n NeonExpansionIndicator,\n },\n props: {\n /**\n * Id for the dropdown button.\n */\n id: { type: String },\n /**\n * Whether the dropdown is currently open.\n */\n modelValue: { type: Boolean, required: true },\n /**\n * The label for the dropdown button.\n */\n label: { type: String, default: null },\n /**\n * URL of image to display if the button style is a square or circular badge.\n */\n image: { type: String, default: null },\n /**\n * Badge image ALT text.\n */\n imageAlt: { type: String, default: null },\n /**\n * An icon to display on the dropdown button. This will be to the left of any label, but can also be used on its own.\n */\n icon: { type: String, default: null },\n /**\n * aria label of the button icon\n */\n iconAriaLabel: { type: String },\n /**\n * Show the dropdown button's indicator (chevron).\n */\n indicator: { type: Boolean, default: true },\n /**\n * Disable the dropdown button\n */\n disabled: { type: Boolean, default: false },\n /**\n * The size of the dropdown button - Small, Medium or Large.\n */\n size: { type: String as () => NeonSize, default: NeonSize.Medium },\n /**\n * The color of the dropdown button\n */\n color: { type: String as () => NeonFunctionalColor, default: NeonFunctionalColor.LowContrast },\n /**\n * The alternate color of the dropdown button (for gradient buttons).\n */\n alternateColor: { type: String as () => NeonFunctionalColor, default: null },\n /**\n * The style of the dropdown button\n */\n dropdownStyle: { type: String as () => NeonDropdownStyle, default: NeonDropdownStyle.SolidButton },\n /**\n * Placement of the dropdown contents.\n */\n placement: { type: String as () => NeonDropdownPlacement, default: NeonDropdownPlacement.BottomLeft },\n /**\n * Restrict placement to within this container.\n */\n placementContainer: { type: Object as () => HTMLElement, default: null },\n /**\n * Instead of opening on click (default), open on hover.\n */\n openOnHover: { type: Boolean, default: false },\n },\n emits: [\n /**\n * Emitted when the dropdown button is toggled.\n * @type {boolean} the open state of the dropdown.\n */\n 'update:modelValue',\n /**\n * Emitted on initialisation.\n * @type {NeonDropdownPlacement} the placement of the dropdown.\n */\n 'dropdown-placement',\n /**\n * Emitted when the dropdown button is blurred.\n * @type {void}\n */\n 'blur',\n /**\n * Emitted when the dropdown button is focussed.\n * @type {void}\n */\n 'focus',\n /**\n * emitted on initialisation\n * @type {HTMLElement} the reference to the HTMLElement for the dropdown menu button.\n */\n 'button-ref',\n ],\n setup(props, { emit, expose }) {\n const dropdownButton = ref<HTMLElement | null>(null);\n const dropdownContent = ref<HTMLDivElement | null>(null);\n\n const dropdownPlacement = ref<NeonDropdownPlacement>(props.placement);\n const closableUtils = ref<NeonClosableUtils | null>(null);\n\n const onClose = () => {\n emit('update:modelValue', false);\n };\n\n const close = () => {\n if (props.modelValue) {\n onClose();\n }\n };\n\n const recalculatePlacement = () => {\n if (props.modelValue && dropdownButton.value && dropdownContent.value) {\n const previousValue = dropdownPlacement.value;\n dropdownPlacement.value = NeonDropdownPlacementUtils.calculatePlacement(\n dropdownButton.value,\n dropdownContent.value,\n props.placement,\n props.placementContainer,\n );\n\n if (previousValue !== dropdownPlacement.value) {\n emit('dropdown-placement', dropdownPlacement.value);\n }\n }\n };\n\n const toggleOpen = () => {\n if (!props.disabled && !props.openOnHover) {\n emit('update:modelValue', !props.modelValue);\n setTimeout(recalculatePlacement);\n }\n };\n\n const isButtonStyle = computed<boolean>(() => props.dropdownStyle?.indexOf('badge') === -1);\n\n const onBlur = () => {\n emit('blur');\n };\n\n const onFocus = () => {\n emit('focus');\n };\n\n onMounted(() => {\n if (!props.openOnHover && dropdownContent.value) {\n closableUtils.value = new NeonClosableUtils(dropdownContent.value, close);\n }\n window.addEventListener('resize', recalculatePlacement, { passive: true });\n window.addEventListener('scroll', recalculatePlacement, { passive: true });\n if (props.placementContainer) {\n props.placementContainer.addEventListener('scroll', recalculatePlacement, { passive: true });\n }\n });\n\n onUnmounted(() => {\n if (!props.openOnHover) {\n closableUtils.value && closableUtils.value.destroy();\n }\n window.removeEventListener('resize', recalculatePlacement);\n window.removeEventListener('scroll', recalculatePlacement);\n if (props.placementContainer) {\n props.placementContainer.removeEventListener('scroll', recalculatePlacement);\n }\n });\n\n watch(\n () => dropdownButton.value,\n (value) => emit('button-ref', value),\n { immediate: true },\n );\n\n expose({ dropdownContent });\n\n return {\n dropdownButton,\n dropdownContent,\n dropdownPlacement,\n closableUtils,\n isButtonStyle,\n onClose,\n close,\n toggleOpen,\n onBlur,\n onFocus,\n };\n },\n});\n"],"names":["_sfc_main","defineComponent","NeonBadge","NeonButton","NeonExpansionIndicator","NeonSize","NeonFunctionalColor","NeonDropdownStyle","NeonDropdownPlacement","props","emit","expose","dropdownButton","ref","dropdownContent","dropdownPlacement","closableUtils","onClose","close","recalculatePlacement","previousValue","NeonDropdownPlacementUtils","toggleOpen","isButtonStyle","computed","_a","onBlur","onFocus","onMounted","NeonClosableUtils","onUnmounted","watch","value"],"mappings":"8jBAoBAA,EAAeC,kBAAgB,CAC7B,KAAM,eACN,WAAY,CACV,UAAAC,EACA,WAAAC,EACA,uBAAAC,CAAA,EAEF,MAAO,CAIL,GAAI,CAAE,KAAM,MAAA,EAIZ,WAAY,CAAE,KAAM,QAAS,SAAU,EAAA,EAIvC,MAAO,CAAE,KAAM,OAAQ,QAAS,IAAA,EAIhC,MAAO,CAAE,KAAM,OAAQ,QAAS,IAAA,EAIhC,SAAU,CAAE,KAAM,OAAQ,QAAS,IAAA,EAInC,KAAM,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