@aotearoan/neon 14.1.2 → 14.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/user-input/date-picker/NeonDatePicker.cjs.js +1 -1
- package/dist/components/user-input/date-picker/NeonDatePicker.cjs.js.map +1 -1
- package/dist/components/user-input/date-picker/NeonDatePicker.es.js +79 -79
- package/dist/components/user-input/date-picker/NeonDatePicker.es.js.map +1 -1
- package/package.json +1 -1
- package/src/sass/components/_button.scss +1 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const t=require("vue"),
|
|
1
|
+
"use strict";const t=require("vue"),ee=require("../../../common/enums/NeonSize.cjs.js"),ae=require("../../../common/enums/NeonFunctionalColor.cjs.js"),te=require("../../presentation/dropdown/NeonDropdown.vue.cjs.js"),ne=require("../button/NeonButton.vue.cjs.js"),le=require("../input/NeonInput.vue.cjs.js"),r=require("../../../common/utils/NeonDateUtils.cjs.js"),oe=require("../../../common/enums/NeonDropdownPlacement.cjs.js"),ue=t.defineComponent({name:"NeonDatePicker",components:{NeonButton:ne,NeonDropdown:te,NeonInput:le},props:{modelValue:{type:String,default:null},locale:{type:String,default:null},disabled:{type:Boolean,default:!1},size:{type:String,default:ee.NeonSize.Medium},color:{type:String,default:ae.NeonFunctionalColor.Primary},min:{type:String,default:null},max:{type:String,default:null},placement:{type:String,default:oe.NeonDropdownPlacement.BottomLeft},disabledDates:{type:Array,default:()=>[]},placeholder:{type:String,required:!1},openCalendarLabel:{type:String,default:"Open calendar"},doneLabel:{type:String,default:"Done"},clearLabel:{type:String,default:"Clear"},changeMonthLabel:{type:String,default:"Change month"},previousMonthLabel:{type:String,default:"Previous month"},nextMonthLabel:{type:String,default:"Next month"},changeYearLabel:{type:String,default:"Change year"},previousYearLabel:{type:String,default:"Previous year"},nextYearLabel:{type:String,default:"Next year"},previousDecadeLabel:{type:String,default:"Previous decade"},nextDecadeLabel:{type:String,default:"Next decade"}},setup(e,{emit:y}){const D=t.useAttrs(),q=!D.required,T=t.ref(null),f=t.ref(null),c=t.ref(!1),d=t.ref(!1),m=t.ref(!1),U=t.computed(()=>{if(e.modelValue){const a=r.NeonDateUtils.stringToNeonDate(e.modelValue,e.locale,!0);if(a){const{dayFormatted:n,monthShortName:u,yearFormatted:Z}=a;return`${n} ${u} ${Z}`}}return""}),V=(a,n,u)=>r.NeonDateUtils.dmyToIso(a,n,u),v=new Date,b=e.locale||navigator.language,o=t.ref(v.getMonth()),l=t.ref(v.getFullYear()),i=t.ref(Math.floor(l.value/10)*10),h=()=>{o.value=e.modelValue?+e.modelValue.substring(5,7):+v.toLocaleString(b,{month:"numeric"}),l.value=e.modelValue?+e.modelValue.substring(0,4):+v.toLocaleString(b,{year:"numeric"}),i.value=Math.floor(l.value/10)*10};h();const s=t.computed(()=>r.NeonDateUtils.toCalendarConfiguration(e.modelValue,o.value,l.value,i.value,e.locale)),I=t.computed(()=>{const{day:a,month:n,year:u}=s.value.today;return r.NeonDateUtils.dmyToIso(a,n,u)}),O=()=>{if(!e.disabled&&(h(),c.value=!0,f.value)){const a=f.value.querySelector(".neon-date-picker__calendar-date--selected");a&&setTimeout(()=>a.focus())}},p=a=>{y("update:modelValue",a)},w=()=>{o.value===1?(o.value=12,l.value=l.value-1):o.value=o.value-1},F=()=>{o.value===12?(o.value=1,l.value=l.value+1):o.value=o.value+1},$=()=>{d.value=!0},N=t.computed(()=>e.min&&e.min>=r.NeonDateUtils.dmyToIso(1,s.value.pageMonth,s.value.pageYear)),x=t.computed(()=>{const{pageYear:a,pageMonth:n,lastDayOfMonth:u}=s.value;return e.max&&e.max<=r.NeonDateUtils.dmyToIso(u,n,a)}),_=t.computed(()=>N.value&&x.value),z=()=>{l.value=l.value-1},B=()=>{l.value=l.value+1},k=()=>{m.value=!0},S=t.computed(()=>e.min&&e.min>=r.NeonDateUtils.dmyToIso(1,1,s.value.pageYear)),Y=t.computed(()=>e.max&&e.max<=r.NeonDateUtils.dmyToIso(31,12,s.value.pageYear)),A=t.computed(()=>S.value&&Y.value),R=()=>{i.value=i.value-10},j=()=>{i.value=i.value+10},E=t.computed(()=>e.min&&e.min>=r.NeonDateUtils.dmyToIso(1,1,Math.floor(s.value.pageYear/10)*10)),G=t.computed(()=>e.max&&e.max<=r.NeonDateUtils.dmyToIso(31,12,Math.floor(s.value.pageYear/10)*10+9)),g=()=>{d.value=!1,m.value=!1},H=()=>{c.value=!1,g()},J=()=>{y("update:modelValue",null),c.value=!1,g()},K=a=>{o.value=a,d.value=!1},Q=a=>{l.value=a,m.value=!1},W=a=>{var n;return((n=e.disabledDates)==null?void 0:n.indexOf(a))>=0||e.min&&e.min>a||e.max&&e.max<a},X=(a,n)=>{const u=`${a}-${n<10?"0"+n:n}`;return C.value&&C.value>u||P.value&&P.value<u},M=t.computed(()=>e.min?+e.min.substring(0,4):null),C=t.computed(()=>e.min?e.min.substring(0,7):null),L=t.computed(()=>e.max?+e.max.substring(0,4):null),P=t.computed(()=>e.max?e.max.substring(0,7):null);return{attrs:D,calendar:s,calendarOpen:c,dropdown:T,formattedValue:U,isChangeDateDisabled:_,isChangeYearDisabled:A,isNextDisabled:x,isNextDecadeDisabled:G,isNextYearDisabled:Y,isPreviousDisabled:N,isPreviousDecadeDisabled:E,isPreviousYearDisabled:S,monthSelectionOpen:d,optional:q,today:I,calendarRef:f,yearSelectionOpen:m,changeMonth:$,changeYear:k,clear:J,done:H,emitDate:p,isDisabled:W,isoDate:V,isMonthDisabled:X,isYearDisabled:a=>M.value&&M.value>a||L.value&&L.value<a,openCalendar:O,onNext:F,onNextDecade:j,onNextYear:B,onPrevious:w,onPreviousDecade:R,onPreviousYear:z,resetToCalendar:g,selectMonth:K,selectYear:Q}}});module.exports=ue;
|
|
2
2
|
//# sourceMappingURL=NeonDatePicker.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NeonDatePicker.cjs.js","sources":["../../../../src/components/user-input/date-picker/NeonDatePicker.ts?vue&type=script&src=true&lang.ts"],"sourcesContent":["import { computed, defineComponent, ref, useAttrs } from 'vue';\nimport { NeonSize } from '@/common/enums/NeonSize';\nimport { NeonFunctionalColor } from '@/common/enums/NeonFunctionalColor';\nimport NeonDropdown from '@/components/presentation/dropdown/NeonDropdown.vue';\nimport NeonButton from '@/components/user-input/button/NeonButton.vue';\nimport NeonInput from '@/components/user-input/input/NeonInput.vue';\nimport { NeonDateUtils } from '@/common/utils/NeonDateUtils';\nimport { NeonDropdownPlacement } from '@/common/enums/NeonDropdownPlacement';\n\n/**\n * <strong>NeonDatePicker</strong> is the equivalent of the native\n * <a href=\"https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/date\" target=\"_blank\">HTML Date Input</a>.\n * It accepts an <a href=\"https://en.wikipedia.org/wiki/ISO_8601\" target=\"_blank\">ISO 8601</a> date string &\n * allows the user to select a date. Dates are formatted with the provided locale, if none is provided the browser\n * locale is used as a default. On touch devices the native date picker is presented to the user.\n *\n * The input date is displayed to the user WITHOUT any adjustment for their timezone, however 'Today' on the calendar is\n * highlighted for the user's timezone.\n *\n * This component interaction was inspired by this <a href=\"https://icehaunter.github.io/vue3-datepicker\" target=\"_blank\">vue-datepicker</a>\n */\nexport default defineComponent({\n name: 'NeonDatePicker',\n components: {\n NeonButton,\n NeonDropdown,\n NeonInput,\n },\n props: {\n /**\n * The selected date. A date string in the\n * <a href=\"https://en.wikipedia.org/wiki/ISO_8601\" target=\"_blank\">ISO 8601</a> format.\n */\n modelValue: { type: String, default: null },\n /**\n * The locale used for display purposes. This defaults to the browser's locale if none is provided.\n */\n locale: { type: String, default: null },\n /**\n * Disable date picker\n */\n disabled: { type: Boolean, default: false },\n /**\n * The size of the date picker, one of NeonSize.Small | NeonSize.Medium | NeonSize.Large.\n */\n size: { type: String as () => NeonSize, default: NeonSize.Medium },\n /**\n * Color of the date picker\n */\n color: { type: String as () => NeonFunctionalColor, default: NeonFunctionalColor.Primary },\n /**\n * Minimum allowed date value in the <a href=\"https://en.wikipedia.org/wiki/ISO_8601\" target=\"_blank\">ISO 8601</a> format.\n */\n min: { type: String, default: null },\n /**\n * Maximum allowed date value in the <a href=\"https://en.wikipedia.org/wiki/ISO_8601\" target=\"_blank\">ISO 8601</a> format.\n */\n max: { type: String, default: null },\n /**\n * The placement of the dropdown calendar popup.\n */\n placement: { type: String as () => NeonDropdownPlacement, default: NeonDropdownPlacement.BottomLeft },\n /**\n * Disabled dates, a list of <a href=\"https://en.wikipedia.org/wiki/ISO_8601\" target=\"_blank\">ISO 8601</a> format\n * dates for which to disable selection.\n */\n disabledDates: { type: Array as () => Array<string>, default: () => [] },\n /**\n * This is the placeholder for the text input when no value is provided.\n */\n placeholder: { type: String, required: false },\n /**\n * This is the label of the input field which opens the calendar. This is technically a button.\n */\n openCalendarLabel: { type: String, default: 'Open calendar' },\n /**\n * This is the label of the 'Done' button in the calendar popup.\n */\n doneLabel: { type: String, default: 'Done' },\n /**\n * This is the label of the 'Clear' button in the calendar popup.\n */\n clearLabel: { type: String, default: 'Clear' },\n /**\n * This is the ARIA label of the 'Change month' button in the calendar popup.\n */\n changeMonthLabel: { type: String, default: 'Change month' },\n /**\n * This is the ARIA label of the 'Previous month' button in the calendar popup.\n */\n previousMonthLabel: { type: String, default: 'Previous month' },\n /**\n * This is the ARIA label of the 'Next month' button in the calendar popup.\n */\n nextMonthLabel: { type: String, default: 'Next month' },\n /**\n * This is the ARIA label of the 'Change year' button in the calendar popup.\n */\n changeYearLabel: { type: String, default: 'Change year' },\n /**\n * This is the ARIA label of the 'Previous year' button in the calendar popup.\n */\n previousYearLabel: { type: String, default: 'Previous year' },\n /**\n * This is the ARIA label of the 'Next year' button in the calendar popup.\n */\n nextYearLabel: { type: String, default: 'Next year' },\n /**\n * This is the ARIA label of the 'Previous decade' button in the calendar popup.\n */\n previousDecadeLabel: { type: String, default: 'Previous decade' },\n /**\n * This is the ARIA label of the 'Next decade' button in the calendar popup.\n */\n nextDecadeLabel: { type: String, default: 'Next decade' },\n },\n setup(props, { emit }) {\n const attrs = useAttrs();\n const optional = !attrs.required;\n\n const dropdown = ref<HTMLElement | null>(null);\n const calendarRef = ref<HTMLElement | null>(null);\n const calendarOpen = ref<boolean>(false);\n const monthSelectionOpen = ref<boolean>(false);\n const yearSelectionOpen = ref<boolean>(false);\n\n const formattedValue = computed(() => {\n if (props.modelValue) {\n const formattedDate = NeonDateUtils.stringToNeonDate(props.modelValue, props.locale, true);\n if (formattedDate) {\n const { dayFormatted, monthShortName, yearFormatted } = formattedDate;\n return `${dayFormatted} ${monthShortName} ${yearFormatted}`;\n }\n }\n\n return '';\n });\n\n const isoDate = (day: number, month: number, year: number) => NeonDateUtils.dmyToIso(day, month, year);\n\n const todayDate = new Date();\n const locale = props.locale || navigator.language;\n\n const pageMonth = ref(\n props.modelValue ? +props.modelValue.substring(5, 7) : +todayDate.toLocaleString(locale, { month: 'numeric' }),\n );\n const pageYear = ref(\n props.modelValue ? +props.modelValue.substring(0, 4) : +todayDate.toLocaleString(locale, { year: 'numeric' }),\n );\n const pageDecadeStart = ref(Math.floor(pageYear.value / 10) * 10);\n\n const calendar = computed(() =>\n NeonDateUtils.toCalendarConfiguration(\n props.modelValue,\n pageMonth.value,\n pageYear.value,\n pageDecadeStart.value,\n props.locale,\n ),\n );\n\n const today = computed(() => {\n const { day, month, year } = calendar.value.today;\n return NeonDateUtils.dmyToIso(day, month, year);\n });\n\n const openCalendar = () => {\n if (!props.disabled) {\n calendarOpen.value = true;\n if (calendarRef.value) {\n const selected = calendarRef.value.querySelector('.neon-date-picker__calendar-date--selected') as HTMLElement;\n if (selected) {\n setTimeout(() => selected.focus());\n }\n }\n }\n };\n\n const emitDate = (newDate: string) => {\n emit('update:modelValue', newDate);\n };\n\n const onPrevious = () => {\n if (pageMonth.value === 1) {\n pageMonth.value = 12;\n pageYear.value = pageYear.value - 1;\n } else {\n pageMonth.value = pageMonth.value - 1;\n }\n };\n\n const onNext = () => {\n if (pageMonth.value === 12) {\n pageMonth.value = 1;\n pageYear.value = pageYear.value + 1;\n } else {\n pageMonth.value = pageMonth.value + 1;\n }\n };\n\n const changeMonth = () => {\n monthSelectionOpen.value = true;\n };\n\n const isPreviousDisabled = computed(\n () => props.min && props.min >= NeonDateUtils.dmyToIso(1, calendar.value.pageMonth, calendar.value.pageYear),\n );\n const isNextDisabled = computed(() => {\n const { pageYear, pageMonth, lastDayOfMonth } = calendar.value;\n return props.max && props.max <= NeonDateUtils.dmyToIso(lastDayOfMonth, pageMonth, pageYear);\n });\n const isChangeDateDisabled = computed(() => isPreviousDisabled.value && isNextDisabled.value);\n\n const onPreviousYear = () => {\n pageYear.value = pageYear.value - 1;\n };\n\n const onNextYear = () => {\n pageYear.value = pageYear.value + 1;\n };\n\n const changeYear = () => {\n yearSelectionOpen.value = true;\n };\n\n const isPreviousYearDisabled = computed(\n () => props.min && props.min >= NeonDateUtils.dmyToIso(1, 1, calendar.value.pageYear),\n );\n const isNextYearDisabled = computed(\n () => props.max && props.max <= NeonDateUtils.dmyToIso(31, 12, calendar.value.pageYear),\n );\n const isChangeYearDisabled = computed(() => isPreviousYearDisabled.value && isNextYearDisabled.value);\n\n const onPreviousDecade = () => {\n pageDecadeStart.value = pageDecadeStart.value - 10;\n };\n\n const onNextDecade = () => {\n pageDecadeStart.value = pageDecadeStart.value + 10;\n };\n\n const isPreviousDecadeDisabled = computed(\n () => props.min && props.min >= NeonDateUtils.dmyToIso(1, 1, Math.floor(calendar.value.pageYear / 10) * 10),\n );\n const isNextDecadeDisabled = computed(\n () => props.max && props.max <= NeonDateUtils.dmyToIso(31, 12, Math.floor(calendar.value.pageYear / 10) * 10 + 9),\n );\n\n const resetToCalendar = () => {\n monthSelectionOpen.value = false;\n yearSelectionOpen.value = false;\n };\n\n const done = () => {\n calendarOpen.value = false;\n resetToCalendar();\n };\n\n const clear = () => {\n emit('update:modelValue', null);\n calendarOpen.value = false;\n resetToCalendar();\n };\n\n const selectMonth = (month: number) => {\n pageMonth.value = month;\n monthSelectionOpen.value = false;\n };\n\n const selectYear = (year: number) => {\n pageYear.value = year;\n yearSelectionOpen.value = false;\n };\n\n const isDisabled = (isoDate: string) => {\n return (\n props.disabledDates?.indexOf(isoDate) >= 0 ||\n (props.min && props.min > isoDate) ||\n (props.max && props.max < isoDate)\n );\n };\n\n const isMonthDisabled = (year: number, month: number) => {\n const dateStr = `${year}-${month < 10 ? '0' + month : month}`;\n return (\n (minYearMonth.value && minYearMonth.value > dateStr) || (maxYearMonth.value && maxYearMonth.value < dateStr)\n );\n };\n\n const minYear = computed<number | null>(() => (props.min ? +props.min.substring(0, 4) : null));\n const minYearMonth = computed<string | null>(() => (props.min ? props.min.substring(0, 7) : null));\n const maxYear = computed<number | null>(() => (props.max ? +props.max.substring(0, 4) : null));\n const maxYearMonth = computed<string | null>(() => (props.max ? props.max.substring(0, 7) : null));\n\n const isYearDisabled = (year: number) => {\n return (minYear.value && minYear.value > year) || (maxYear.value && maxYear.value < year);\n };\n\n return {\n attrs,\n calendar,\n calendarOpen,\n dropdown,\n formattedValue,\n isChangeDateDisabled,\n isChangeYearDisabled,\n isNextDisabled,\n isNextDecadeDisabled,\n isNextYearDisabled,\n isPreviousDisabled,\n isPreviousDecadeDisabled,\n isPreviousYearDisabled,\n monthSelectionOpen,\n optional,\n today,\n calendarRef,\n yearSelectionOpen,\n changeMonth,\n changeYear,\n clear,\n done,\n emitDate,\n isDisabled,\n isoDate,\n isMonthDisabled,\n isYearDisabled,\n openCalendar,\n onNext,\n onNextDecade,\n onNextYear,\n onPrevious,\n onPreviousDecade,\n onPreviousYear,\n resetToCalendar,\n selectMonth,\n selectYear,\n };\n },\n});\n"],"names":["_sfc_main","defineComponent","NeonButton","NeonDropdown","NeonInput","NeonSize","NeonFunctionalColor","NeonDropdownPlacement","props","emit","attrs","useAttrs","optional","dropdown","ref","calendarRef","calendarOpen","monthSelectionOpen","yearSelectionOpen","formattedValue","computed","formattedDate","NeonDateUtils","dayFormatted","monthShortName","yearFormatted","isoDate","day","month","year","todayDate","locale","pageMonth","pageYear","pageDecadeStart","calendar","today","openCalendar","selected","emitDate","newDate","onPrevious","onNext","changeMonth","isPreviousDisabled","isNextDisabled","lastDayOfMonth","isChangeDateDisabled","onPreviousYear","onNextYear","changeYear","isPreviousYearDisabled","isNextYearDisabled","isChangeYearDisabled","onPreviousDecade","onNextDecade","isPreviousDecadeDisabled","isNextDecadeDisabled","resetToCalendar","done","clear","selectMonth","selectYear","isDisabled","_a","isMonthDisabled","dateStr","minYearMonth","maxYearMonth","minYear","maxYear"],"mappings":"2aAqBAA,GAAeC,kBAAgB,CAC7B,KAAM,iBACN,WAAY,CACV,WAAAC,GACA,aAAAC,GACA,UAAAC,EACF,EACA,MAAO,CAKL,WAAY,CAAE,KAAM,OAAQ,QAAS,IAAK,EAI1C,OAAQ,CAAE,KAAM,OAAQ,QAAS,IAAK,EAItC,SAAU,CAAE,KAAM,QAAS,QAAS,EAAM,EAI1C,KAAM,CAAE,KAAM,OAA0B,QAASC,EAAAA,SAAS,MAAO,EAIjE,MAAO,CAAE,KAAM,OAAqC,QAASC,GAAAA,oBAAoB,OAAQ,EAIzF,IAAK,CAAE,KAAM,OAAQ,QAAS,IAAK,EAInC,IAAK,CAAE,KAAM,OAAQ,QAAS,IAAK,EAInC,UAAW,CAAE,KAAM,OAAuC,QAASC,GAAAA,sBAAsB,UAAW,EAKpG,cAAe,CAAE,KAAM,MAA8B,QAAS,IAAM,CAAA,CAAG,EAIvE,YAAa,CAAE,KAAM,OAAQ,SAAU,EAAM,EAI7C,kBAAmB,CAAE,KAAM,OAAQ,QAAS,eAAgB,EAI5D,UAAW,CAAE,KAAM,OAAQ,QAAS,MAAO,EAI3C,WAAY,CAAE,KAAM,OAAQ,QAAS,OAAQ,EAI7C,iBAAkB,CAAE,KAAM,OAAQ,QAAS,cAAe,EAI1D,mBAAoB,CAAE,KAAM,OAAQ,QAAS,gBAAiB,EAI9D,eAAgB,CAAE,KAAM,OAAQ,QAAS,YAAa,EAItD,gBAAiB,CAAE,KAAM,OAA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,EACA,aAAAa,EACA,WAAAN,EACA,WAAAR,EACA,iBAAAa,EACA,eAAAN,EACA,gBAAAU,EACA,YAAAG,EACA,WAAAC,CAAA,CAEJ,CACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"NeonDatePicker.cjs.js","sources":["../../../../src/components/user-input/date-picker/NeonDatePicker.ts?vue&type=script&src=true&lang.ts"],"sourcesContent":["import { computed, defineComponent, ref, useAttrs } from 'vue';\nimport { NeonSize } from '@/common/enums/NeonSize';\nimport { NeonFunctionalColor } from '@/common/enums/NeonFunctionalColor';\nimport NeonDropdown from '@/components/presentation/dropdown/NeonDropdown.vue';\nimport NeonButton from '@/components/user-input/button/NeonButton.vue';\nimport NeonInput from '@/components/user-input/input/NeonInput.vue';\nimport { NeonDateUtils } from '@/common/utils/NeonDateUtils';\nimport { NeonDropdownPlacement } from '@/common/enums/NeonDropdownPlacement';\n\n/**\n * <strong>NeonDatePicker</strong> is the equivalent of the native\n * <a href=\"https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/date\" target=\"_blank\">HTML Date Input</a>.\n * It accepts an <a href=\"https://en.wikipedia.org/wiki/ISO_8601\" target=\"_blank\">ISO 8601</a> date string &\n * allows the user to select a date. Dates are formatted with the provided locale, if none is provided the browser\n * locale is used as a default. On touch devices the native date picker is presented to the user.\n *\n * The input date is displayed to the user WITHOUT any adjustment for their timezone, however 'Today' on the calendar is\n * highlighted for the user's timezone.\n *\n * This component interaction was inspired by this <a href=\"https://icehaunter.github.io/vue3-datepicker\" target=\"_blank\">vue-datepicker</a>\n */\nexport default defineComponent({\n name: 'NeonDatePicker',\n components: {\n NeonButton,\n NeonDropdown,\n NeonInput,\n },\n props: {\n /**\n * The selected date. A date string in the\n * <a href=\"https://en.wikipedia.org/wiki/ISO_8601\" target=\"_blank\">ISO 8601</a> format.\n */\n modelValue: { type: String, default: null },\n /**\n * The locale used for display purposes. This defaults to the browser's locale if none is provided.\n */\n locale: { type: String, default: null },\n /**\n * Disable date picker\n */\n disabled: { type: Boolean, default: false },\n /**\n * The size of the date picker, one of NeonSize.Small | NeonSize.Medium | NeonSize.Large.\n */\n size: { type: String as () => NeonSize, default: NeonSize.Medium },\n /**\n * Color of the date picker\n */\n color: { type: String as () => NeonFunctionalColor, default: NeonFunctionalColor.Primary },\n /**\n * Minimum allowed date value in the <a href=\"https://en.wikipedia.org/wiki/ISO_8601\" target=\"_blank\">ISO 8601</a> format.\n */\n min: { type: String, default: null },\n /**\n * Maximum allowed date value in the <a href=\"https://en.wikipedia.org/wiki/ISO_8601\" target=\"_blank\">ISO 8601</a> format.\n */\n max: { type: String, default: null },\n /**\n * The placement of the dropdown calendar popup.\n */\n placement: { type: String as () => NeonDropdownPlacement, default: NeonDropdownPlacement.BottomLeft },\n /**\n * Disabled dates, a list of <a href=\"https://en.wikipedia.org/wiki/ISO_8601\" target=\"_blank\">ISO 8601</a> format\n * dates for which to disable selection.\n */\n disabledDates: { type: Array as () => Array<string>, default: () => [] },\n /**\n * This is the placeholder for the text input when no value is provided.\n */\n placeholder: { type: String, required: false },\n /**\n * This is the label of the input field which opens the calendar. This is technically a button.\n */\n openCalendarLabel: { type: String, default: 'Open calendar' },\n /**\n * This is the label of the 'Done' button in the calendar popup.\n */\n doneLabel: { type: String, default: 'Done' },\n /**\n * This is the label of the 'Clear' button in the calendar popup.\n */\n clearLabel: { type: String, default: 'Clear' },\n /**\n * This is the ARIA label of the 'Change month' button in the calendar popup.\n */\n changeMonthLabel: { type: String, default: 'Change month' },\n /**\n * This is the ARIA label of the 'Previous month' button in the calendar popup.\n */\n previousMonthLabel: { type: String, default: 'Previous month' },\n /**\n * This is the ARIA label of the 'Next month' button in the calendar popup.\n */\n nextMonthLabel: { type: String, default: 'Next month' },\n /**\n * This is the ARIA label of the 'Change year' button in the calendar popup.\n */\n changeYearLabel: { type: String, default: 'Change year' },\n /**\n * This is the ARIA label of the 'Previous year' button in the calendar popup.\n */\n previousYearLabel: { type: String, default: 'Previous year' },\n /**\n * This is the ARIA label of the 'Next year' button in the calendar popup.\n */\n nextYearLabel: { type: String, default: 'Next year' },\n /**\n * This is the ARIA label of the 'Previous decade' button in the calendar popup.\n */\n previousDecadeLabel: { type: String, default: 'Previous decade' },\n /**\n * This is the ARIA label of the 'Next decade' button in the calendar popup.\n */\n nextDecadeLabel: { type: String, default: 'Next decade' },\n },\n setup(props, { emit }) {\n const attrs = useAttrs();\n const optional = !attrs.required;\n\n const dropdown = ref<HTMLElement | null>(null);\n const calendarRef = ref<HTMLElement | null>(null);\n const calendarOpen = ref<boolean>(false);\n const monthSelectionOpen = ref<boolean>(false);\n const yearSelectionOpen = ref<boolean>(false);\n\n const formattedValue = computed(() => {\n if (props.modelValue) {\n const formattedDate = NeonDateUtils.stringToNeonDate(props.modelValue, props.locale, true);\n if (formattedDate) {\n const { dayFormatted, monthShortName, yearFormatted } = formattedDate;\n return `${dayFormatted} ${monthShortName} ${yearFormatted}`;\n }\n }\n\n return '';\n });\n\n const isoDate = (day: number, month: number, year: number) => NeonDateUtils.dmyToIso(day, month, year);\n\n const todayDate = new Date();\n const locale = props.locale || navigator.language;\n\n const pageMonth = ref<number>(todayDate.getMonth());\n const pageYear = ref<number>(todayDate.getFullYear());\n const pageDecadeStart = ref<number>(Math.floor(pageYear.value / 10) * 10);\n\n const resetCalendarPages = () => {\n pageMonth.value = props.modelValue\n ? +props.modelValue.substring(5, 7)\n : +todayDate.toLocaleString(locale, { month: 'numeric' });\n pageYear.value = props.modelValue\n ? +props.modelValue.substring(0, 4)\n : +todayDate.toLocaleString(locale, { year: 'numeric' });\n pageDecadeStart.value = Math.floor(pageYear.value / 10) * 10;\n };\n\n resetCalendarPages();\n\n const calendar = computed(() =>\n NeonDateUtils.toCalendarConfiguration(\n props.modelValue,\n pageMonth.value,\n pageYear.value,\n pageDecadeStart.value,\n props.locale,\n ),\n );\n\n const today = computed(() => {\n const { day, month, year } = calendar.value.today;\n return NeonDateUtils.dmyToIso(day, month, year);\n });\n\n const openCalendar = () => {\n if (!props.disabled) {\n resetCalendarPages();\n calendarOpen.value = true;\n if (calendarRef.value) {\n const selected = calendarRef.value.querySelector('.neon-date-picker__calendar-date--selected') as HTMLElement;\n if (selected) {\n setTimeout(() => selected.focus());\n }\n }\n }\n };\n\n const emitDate = (newDate: string) => {\n emit('update:modelValue', newDate);\n };\n\n const onPrevious = () => {\n if (pageMonth.value === 1) {\n pageMonth.value = 12;\n pageYear.value = pageYear.value - 1;\n } else {\n pageMonth.value = pageMonth.value - 1;\n }\n };\n\n const onNext = () => {\n if (pageMonth.value === 12) {\n pageMonth.value = 1;\n pageYear.value = pageYear.value + 1;\n } else {\n pageMonth.value = pageMonth.value + 1;\n }\n };\n\n const changeMonth = () => {\n monthSelectionOpen.value = true;\n };\n\n const isPreviousDisabled = computed(\n () => props.min && props.min >= NeonDateUtils.dmyToIso(1, calendar.value.pageMonth, calendar.value.pageYear),\n );\n const isNextDisabled = computed(() => {\n const { pageYear, pageMonth, lastDayOfMonth } = calendar.value;\n return props.max && props.max <= NeonDateUtils.dmyToIso(lastDayOfMonth, pageMonth, pageYear);\n });\n const isChangeDateDisabled = computed(() => isPreviousDisabled.value && isNextDisabled.value);\n\n const onPreviousYear = () => {\n pageYear.value = pageYear.value - 1;\n };\n\n const onNextYear = () => {\n pageYear.value = pageYear.value + 1;\n };\n\n const changeYear = () => {\n yearSelectionOpen.value = true;\n };\n\n const isPreviousYearDisabled = computed(\n () => props.min && props.min >= NeonDateUtils.dmyToIso(1, 1, calendar.value.pageYear),\n );\n const isNextYearDisabled = computed(\n () => props.max && props.max <= NeonDateUtils.dmyToIso(31, 12, calendar.value.pageYear),\n );\n const isChangeYearDisabled = computed(() => isPreviousYearDisabled.value && isNextYearDisabled.value);\n\n const onPreviousDecade = () => {\n pageDecadeStart.value = pageDecadeStart.value - 10;\n };\n\n const onNextDecade = () => {\n pageDecadeStart.value = pageDecadeStart.value + 10;\n };\n\n const isPreviousDecadeDisabled = computed(\n () => props.min && props.min >= NeonDateUtils.dmyToIso(1, 1, Math.floor(calendar.value.pageYear / 10) * 10),\n );\n const isNextDecadeDisabled = computed(\n () => props.max && props.max <= NeonDateUtils.dmyToIso(31, 12, Math.floor(calendar.value.pageYear / 10) * 10 + 9),\n );\n\n const resetToCalendar = () => {\n monthSelectionOpen.value = false;\n yearSelectionOpen.value = false;\n };\n\n const done = () => {\n calendarOpen.value = false;\n resetToCalendar();\n };\n\n const clear = () => {\n emit('update:modelValue', null);\n calendarOpen.value = false;\n resetToCalendar();\n };\n\n const selectMonth = (month: number) => {\n pageMonth.value = month;\n monthSelectionOpen.value = false;\n };\n\n const selectYear = (year: number) => {\n pageYear.value = year;\n yearSelectionOpen.value = false;\n };\n\n const isDisabled = (isoDate: string) => {\n return (\n props.disabledDates?.indexOf(isoDate) >= 0 ||\n (props.min && props.min > isoDate) ||\n (props.max && props.max < isoDate)\n );\n };\n\n const isMonthDisabled = (year: number, month: number) => {\n const dateStr = `${year}-${month < 10 ? '0' + month : month}`;\n return (\n (minYearMonth.value && minYearMonth.value > dateStr) || (maxYearMonth.value && maxYearMonth.value < dateStr)\n );\n };\n\n const minYear = computed<number | null>(() => (props.min ? +props.min.substring(0, 4) : null));\n const minYearMonth = computed<string | null>(() => (props.min ? props.min.substring(0, 7) : null));\n const maxYear = computed<number | null>(() => (props.max ? +props.max.substring(0, 4) : null));\n const maxYearMonth = computed<string | null>(() => (props.max ? props.max.substring(0, 7) : null));\n\n const isYearDisabled = (year: number) => {\n return (minYear.value && minYear.value > year) || (maxYear.value && maxYear.value < year);\n };\n\n return {\n attrs,\n calendar,\n calendarOpen,\n dropdown,\n formattedValue,\n isChangeDateDisabled,\n isChangeYearDisabled,\n isNextDisabled,\n isNextDecadeDisabled,\n isNextYearDisabled,\n isPreviousDisabled,\n isPreviousDecadeDisabled,\n isPreviousYearDisabled,\n monthSelectionOpen,\n optional,\n today,\n calendarRef,\n yearSelectionOpen,\n changeMonth,\n changeYear,\n clear,\n done,\n emitDate,\n isDisabled,\n isoDate,\n isMonthDisabled,\n isYearDisabled,\n openCalendar,\n onNext,\n onNextDecade,\n onNextYear,\n onPrevious,\n onPreviousDecade,\n onPreviousYear,\n resetToCalendar,\n selectMonth,\n selectYear,\n };\n },\n});\n"],"names":["_sfc_main","defineComponent","NeonButton","NeonDropdown","NeonInput","NeonSize","NeonFunctionalColor","NeonDropdownPlacement","props","emit","attrs","useAttrs","optional","dropdown","ref","calendarRef","calendarOpen","monthSelectionOpen","yearSelectionOpen","formattedValue","computed","formattedDate","NeonDateUtils","dayFormatted","monthShortName","yearFormatted","isoDate","day","month","year","todayDate","locale","pageMonth","pageYear","pageDecadeStart","resetCalendarPages","calendar","today","openCalendar","selected","emitDate","newDate","onPrevious","onNext","changeMonth","isPreviousDisabled","isNextDisabled","lastDayOfMonth","isChangeDateDisabled","onPreviousYear","onNextYear","changeYear","isPreviousYearDisabled","isNextYearDisabled","isChangeYearDisabled","onPreviousDecade","onNextDecade","isPreviousDecadeDisabled","isNextDecadeDisabled","resetToCalendar","done","clear","selectMonth","selectYear","isDisabled","_a","isMonthDisabled","dateStr","minYearMonth","maxYearMonth","minYear","maxYear"],"mappings":"4aAqBAA,GAAeC,kBAAgB,CAC7B,KAAM,iBACN,WAAY,CACV,WAAAC,GACA,aAAAC,GACA,UAAAC,EACF,EACA,MAAO,CAKL,WAAY,CAAE,KAAM,OAAQ,QAAS,IAAK,EAI1C,OAAQ,CAAE,KAAM,OAAQ,QAAS,IAAK,EAItC,SAAU,CAAE,KAAM,QAAS,QAAS,EAAM,EAI1C,KAAM,CAAE,KAAM,OAA0B,QAASC,GAAAA,SAAS,MAAO,EAIjE,MAAO,CAAE,KAAM,OAAqC,QAASC,GAAAA,oBAAoB,OAAQ,EAIzF,IAAK,CAAE,KAAM,OAAQ,QAAS,IAAK,EAInC,IAAK,CAAE,KAAM,OAAQ,QAAS,IAAK,EAInC,UAAW,CAAE,KAAM,OAAuC,QAASC,GAAAA,sBAAsB,UAAW,EAKpG,cAAe,CAAE,KAAM,MAA8B,QAAS,I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D,EAAejD,EAAAA,SAAwB,IAAOZ,EAAM,IAAMA,EAAM,IAAI,UAAU,EAAG,CAAC,EAAI,IAAK,EAM1F,MAAA,CACL,MAAAE,EACA,SAAA0B,EACA,aAAApB,EACA,SAAAH,EACA,eAAAM,EACA,qBAAA6B,EACA,qBAAAM,EACA,eAAAR,EACA,qBAAAY,EACA,mBAAAL,EACA,mBAAAR,EACA,yBAAAY,EACA,uBAAAL,EACA,mBAAAnC,EACA,SAAAL,EACA,MAAAyB,EACA,YAAAtB,EACA,kBAAAG,EACA,YAAA0B,EACA,WAAAO,EACA,MAAAU,EACA,KAAAD,EACA,SAAApB,EACA,WAAAwB,EACA,QAAAtC,EACA,gBAAAwC,EACA,eA/BsBrC,GACdyC,EAAQ,OAASA,EAAQ,MAAQzC,GAAU0C,EAAQ,OAASA,EAAQ,MAAQ1C,EA+BpF,aAAAS,EACA,OAAAK,EACA,aAAAa,EACA,WAAAN,EACA,WAAAR,EACA,iBAAAa,EACA,eAAAN,EACA,gBAAAU,EACA,YAAAG,EACA,WAAAC,CAAA,CAEJ,CACF,CAAC"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { NeonSize as
|
|
3
|
-
import { NeonFunctionalColor as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
1
|
+
import { defineComponent as ae, useAttrs as te, ref as s, computed as t } from "vue";
|
|
2
|
+
import { NeonSize as le } from "../../../common/enums/NeonSize.es.js";
|
|
3
|
+
import { NeonFunctionalColor as ne } from "../../../common/enums/NeonFunctionalColor.es.js";
|
|
4
|
+
import oe from "../../presentation/dropdown/NeonDropdown.vue.es.js";
|
|
5
|
+
import ue from "../button/NeonButton.vue.es.js";
|
|
6
|
+
import re from "../input/NeonInput.vue.es.js";
|
|
7
7
|
import { NeonDateUtils as r } from "../../../common/utils/NeonDateUtils.es.js";
|
|
8
|
-
import { NeonDropdownPlacement as
|
|
9
|
-
const
|
|
8
|
+
import { NeonDropdownPlacement as ie } from "../../../common/enums/NeonDropdownPlacement.es.js";
|
|
9
|
+
const he = ae({
|
|
10
10
|
name: "NeonDatePicker",
|
|
11
11
|
components: {
|
|
12
|
-
NeonButton:
|
|
13
|
-
NeonDropdown:
|
|
14
|
-
NeonInput:
|
|
12
|
+
NeonButton: ue,
|
|
13
|
+
NeonDropdown: oe,
|
|
14
|
+
NeonInput: re
|
|
15
15
|
},
|
|
16
16
|
props: {
|
|
17
17
|
/**
|
|
@@ -30,11 +30,11 @@ const be = ee({
|
|
|
30
30
|
/**
|
|
31
31
|
* The size of the date picker, one of NeonSize.Small | NeonSize.Medium | NeonSize.Large.
|
|
32
32
|
*/
|
|
33
|
-
size: { type: String, default:
|
|
33
|
+
size: { type: String, default: le.Medium },
|
|
34
34
|
/**
|
|
35
35
|
* Color of the date picker
|
|
36
36
|
*/
|
|
37
|
-
color: { type: String, default:
|
|
37
|
+
color: { type: String, default: ne.Primary },
|
|
38
38
|
/**
|
|
39
39
|
* Minimum allowed date value in the <a href="https://en.wikipedia.org/wiki/ISO_8601" target="_blank">ISO 8601</a> format.
|
|
40
40
|
*/
|
|
@@ -46,7 +46,7 @@ const be = ee({
|
|
|
46
46
|
/**
|
|
47
47
|
* The placement of the dropdown calendar popup.
|
|
48
48
|
*/
|
|
49
|
-
placement: { type: String, default:
|
|
49
|
+
placement: { type: String, default: ie.BottomLeft },
|
|
50
50
|
/**
|
|
51
51
|
* Disabled dates, a list of <a href="https://en.wikipedia.org/wiki/ISO_8601" target="_blank">ISO 8601</a> format
|
|
52
52
|
* dates for which to disable selection.
|
|
@@ -101,21 +101,21 @@ const be = ee({
|
|
|
101
101
|
*/
|
|
102
102
|
nextDecadeLabel: { type: String, default: "Next decade" }
|
|
103
103
|
},
|
|
104
|
-
setup(e, { emit:
|
|
105
|
-
const
|
|
104
|
+
setup(e, { emit: b }) {
|
|
105
|
+
const h = te(), V = !h.required, I = s(null), g = s(null), c = s(!1), m = s(!1), v = s(!1), O = t(() => {
|
|
106
106
|
if (e.modelValue) {
|
|
107
107
|
const a = r.stringToNeonDate(e.modelValue, e.locale, !0);
|
|
108
108
|
if (a) {
|
|
109
|
-
const { dayFormatted: l, monthShortName: u, yearFormatted:
|
|
110
|
-
return `${l} ${u} ${
|
|
109
|
+
const { dayFormatted: l, monthShortName: u, yearFormatted: ee } = a;
|
|
110
|
+
return `${l} ${u} ${ee}`;
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
return "";
|
|
114
|
-
}),
|
|
115
|
-
e.modelValue ? +e.modelValue.substring(5, 7) : +
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
114
|
+
}), $ = (a, l, u) => r.dmyToIso(a, l, u), f = /* @__PURE__ */ new Date(), D = e.locale || navigator.language, o = s(f.getMonth()), n = s(f.getFullYear()), d = s(Math.floor(n.value / 10) * 10), x = () => {
|
|
115
|
+
o.value = e.modelValue ? +e.modelValue.substring(5, 7) : +f.toLocaleString(D, { month: "numeric" }), n.value = e.modelValue ? +e.modelValue.substring(0, 4) : +f.toLocaleString(D, { year: "numeric" }), d.value = Math.floor(n.value / 10) * 10;
|
|
116
|
+
};
|
|
117
|
+
x();
|
|
118
|
+
const i = t(
|
|
119
119
|
() => r.toCalendarConfiguration(
|
|
120
120
|
e.modelValue,
|
|
121
121
|
o.value,
|
|
@@ -123,104 +123,104 @@ const be = ee({
|
|
|
123
123
|
d.value,
|
|
124
124
|
e.locale
|
|
125
125
|
)
|
|
126
|
-
),
|
|
126
|
+
), w = t(() => {
|
|
127
127
|
const { day: a, month: l, year: u } = i.value.today;
|
|
128
128
|
return r.dmyToIso(a, l, u);
|
|
129
|
-
}),
|
|
130
|
-
if (!e.disabled && (c.value = !0,
|
|
131
|
-
const a =
|
|
129
|
+
}), F = () => {
|
|
130
|
+
if (!e.disabled && (x(), c.value = !0, g.value)) {
|
|
131
|
+
const a = g.value.querySelector(".neon-date-picker__calendar-date--selected");
|
|
132
132
|
a && setTimeout(() => a.focus());
|
|
133
133
|
}
|
|
134
134
|
}, _ = (a) => {
|
|
135
|
-
|
|
135
|
+
b("update:modelValue", a);
|
|
136
136
|
}, q = () => {
|
|
137
137
|
o.value === 1 ? (o.value = 12, n.value = n.value - 1) : o.value = o.value - 1;
|
|
138
138
|
}, B = () => {
|
|
139
139
|
o.value === 12 ? (o.value = 1, n.value = n.value + 1) : o.value = o.value + 1;
|
|
140
|
-
},
|
|
140
|
+
}, k = () => {
|
|
141
141
|
m.value = !0;
|
|
142
|
-
},
|
|
142
|
+
}, S = t(
|
|
143
143
|
() => e.min && e.min >= r.dmyToIso(1, i.value.pageMonth, i.value.pageYear)
|
|
144
|
-
),
|
|
144
|
+
), Y = t(() => {
|
|
145
145
|
const { pageYear: a, pageMonth: l, lastDayOfMonth: u } = i.value;
|
|
146
146
|
return e.max && e.max <= r.dmyToIso(u, l, a);
|
|
147
|
-
}),
|
|
147
|
+
}), z = t(() => S.value && Y.value), A = () => {
|
|
148
148
|
n.value = n.value - 1;
|
|
149
|
-
}, A = () => {
|
|
150
|
-
n.value = n.value + 1;
|
|
151
149
|
}, R = () => {
|
|
150
|
+
n.value = n.value + 1;
|
|
151
|
+
}, U = () => {
|
|
152
152
|
v.value = !0;
|
|
153
|
-
},
|
|
153
|
+
}, M = t(
|
|
154
154
|
() => e.min && e.min >= r.dmyToIso(1, 1, i.value.pageYear)
|
|
155
155
|
), N = t(
|
|
156
156
|
() => e.max && e.max <= r.dmyToIso(31, 12, i.value.pageYear)
|
|
157
|
-
),
|
|
157
|
+
), j = t(() => M.value && N.value), E = () => {
|
|
158
158
|
d.value = d.value - 10;
|
|
159
|
-
},
|
|
159
|
+
}, G = () => {
|
|
160
160
|
d.value = d.value + 10;
|
|
161
|
-
},
|
|
161
|
+
}, H = t(
|
|
162
162
|
() => e.min && e.min >= r.dmyToIso(1, 1, Math.floor(i.value.pageYear / 10) * 10)
|
|
163
|
-
),
|
|
163
|
+
), J = t(
|
|
164
164
|
() => e.max && e.max <= r.dmyToIso(31, 12, Math.floor(i.value.pageYear / 10) * 10 + 9)
|
|
165
|
-
),
|
|
165
|
+
), y = () => {
|
|
166
166
|
m.value = !1, v.value = !1;
|
|
167
|
-
}, J = () => {
|
|
168
|
-
c.value = !1, g();
|
|
169
167
|
}, K = () => {
|
|
170
|
-
|
|
171
|
-
}, Q = (
|
|
172
|
-
|
|
168
|
+
c.value = !1, y();
|
|
169
|
+
}, Q = () => {
|
|
170
|
+
b("update:modelValue", null), c.value = !1, y();
|
|
173
171
|
}, W = (a) => {
|
|
174
|
-
|
|
172
|
+
o.value = a, m.value = !1;
|
|
175
173
|
}, X = (a) => {
|
|
174
|
+
n.value = a, v.value = !1;
|
|
175
|
+
}, Z = (a) => {
|
|
176
176
|
var l;
|
|
177
177
|
return ((l = e.disabledDates) == null ? void 0 : l.indexOf(a)) >= 0 || e.min && e.min > a || e.max && e.max < a;
|
|
178
|
-
},
|
|
178
|
+
}, p = (a, l) => {
|
|
179
179
|
const u = `${a}-${l < 10 ? "0" + l : l}`;
|
|
180
|
-
return
|
|
181
|
-
},
|
|
180
|
+
return C.value && C.value > u || T.value && T.value < u;
|
|
181
|
+
}, L = t(() => e.min ? +e.min.substring(0, 4) : null), C = t(() => e.min ? e.min.substring(0, 7) : null), P = t(() => e.max ? +e.max.substring(0, 4) : null), T = t(() => e.max ? e.max.substring(0, 7) : null);
|
|
182
182
|
return {
|
|
183
|
-
attrs:
|
|
183
|
+
attrs: h,
|
|
184
184
|
calendar: i,
|
|
185
185
|
calendarOpen: c,
|
|
186
|
-
dropdown:
|
|
187
|
-
formattedValue:
|
|
188
|
-
isChangeDateDisabled:
|
|
189
|
-
isChangeYearDisabled:
|
|
190
|
-
isNextDisabled:
|
|
191
|
-
isNextDecadeDisabled:
|
|
186
|
+
dropdown: I,
|
|
187
|
+
formattedValue: O,
|
|
188
|
+
isChangeDateDisabled: z,
|
|
189
|
+
isChangeYearDisabled: j,
|
|
190
|
+
isNextDisabled: Y,
|
|
191
|
+
isNextDecadeDisabled: J,
|
|
192
192
|
isNextYearDisabled: N,
|
|
193
|
-
isPreviousDisabled:
|
|
194
|
-
isPreviousDecadeDisabled:
|
|
195
|
-
isPreviousYearDisabled:
|
|
193
|
+
isPreviousDisabled: S,
|
|
194
|
+
isPreviousDecadeDisabled: H,
|
|
195
|
+
isPreviousYearDisabled: M,
|
|
196
196
|
monthSelectionOpen: m,
|
|
197
|
-
optional:
|
|
198
|
-
today:
|
|
199
|
-
calendarRef:
|
|
197
|
+
optional: V,
|
|
198
|
+
today: w,
|
|
199
|
+
calendarRef: g,
|
|
200
200
|
yearSelectionOpen: v,
|
|
201
|
-
changeMonth:
|
|
202
|
-
changeYear:
|
|
203
|
-
clear:
|
|
204
|
-
done:
|
|
201
|
+
changeMonth: k,
|
|
202
|
+
changeYear: U,
|
|
203
|
+
clear: Q,
|
|
204
|
+
done: K,
|
|
205
205
|
emitDate: _,
|
|
206
|
-
isDisabled:
|
|
207
|
-
isoDate:
|
|
208
|
-
isMonthDisabled:
|
|
209
|
-
isYearDisabled: (a) =>
|
|
210
|
-
openCalendar:
|
|
206
|
+
isDisabled: Z,
|
|
207
|
+
isoDate: $,
|
|
208
|
+
isMonthDisabled: p,
|
|
209
|
+
isYearDisabled: (a) => L.value && L.value > a || P.value && P.value < a,
|
|
210
|
+
openCalendar: F,
|
|
211
211
|
onNext: B,
|
|
212
|
-
onNextDecade:
|
|
213
|
-
onNextYear:
|
|
212
|
+
onNextDecade: G,
|
|
213
|
+
onNextYear: R,
|
|
214
214
|
onPrevious: q,
|
|
215
|
-
onPreviousDecade:
|
|
216
|
-
onPreviousYear:
|
|
217
|
-
resetToCalendar:
|
|
218
|
-
selectMonth:
|
|
219
|
-
selectYear:
|
|
215
|
+
onPreviousDecade: E,
|
|
216
|
+
onPreviousYear: A,
|
|
217
|
+
resetToCalendar: y,
|
|
218
|
+
selectMonth: W,
|
|
219
|
+
selectYear: X
|
|
220
220
|
};
|
|
221
221
|
}
|
|
222
222
|
});
|
|
223
223
|
export {
|
|
224
|
-
|
|
224
|
+
he as default
|
|
225
225
|
};
|
|
226
226
|
//# sourceMappingURL=NeonDatePicker.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NeonDatePicker.es.js","sources":["../../../../src/components/user-input/date-picker/NeonDatePicker.ts?vue&type=script&src=true&lang.ts"],"sourcesContent":["import { computed, defineComponent, ref, useAttrs } from 'vue';\nimport { NeonSize } from '@/common/enums/NeonSize';\nimport { NeonFunctionalColor } from '@/common/enums/NeonFunctionalColor';\nimport NeonDropdown from '@/components/presentation/dropdown/NeonDropdown.vue';\nimport NeonButton from '@/components/user-input/button/NeonButton.vue';\nimport NeonInput from '@/components/user-input/input/NeonInput.vue';\nimport { NeonDateUtils } from '@/common/utils/NeonDateUtils';\nimport { NeonDropdownPlacement } from '@/common/enums/NeonDropdownPlacement';\n\n/**\n * <strong>NeonDatePicker</strong> is the equivalent of the native\n * <a href=\"https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/date\" target=\"_blank\">HTML Date Input</a>.\n * It accepts an <a href=\"https://en.wikipedia.org/wiki/ISO_8601\" target=\"_blank\">ISO 8601</a> date string &\n * allows the user to select a date. Dates are formatted with the provided locale, if none is provided the browser\n * locale is used as a default. On touch devices the native date picker is presented to the user.\n *\n * The input date is displayed to the user WITHOUT any adjustment for their timezone, however 'Today' on the calendar is\n * highlighted for the user's timezone.\n *\n * This component interaction was inspired by this <a href=\"https://icehaunter.github.io/vue3-datepicker\" target=\"_blank\">vue-datepicker</a>\n */\nexport default defineComponent({\n name: 'NeonDatePicker',\n components: {\n NeonButton,\n NeonDropdown,\n NeonInput,\n },\n props: {\n /**\n * The selected date. A date string in the\n * <a href=\"https://en.wikipedia.org/wiki/ISO_8601\" target=\"_blank\">ISO 8601</a> format.\n */\n modelValue: { type: String, default: null },\n /**\n * The locale used for display purposes. This defaults to the browser's locale if none is provided.\n */\n locale: { type: String, default: null },\n /**\n * Disable date picker\n */\n disabled: { type: Boolean, default: false },\n /**\n * The size of the date picker, one of NeonSize.Small | NeonSize.Medium | NeonSize.Large.\n */\n size: { type: String as () => NeonSize, default: NeonSize.Medium },\n /**\n * Color of the date picker\n */\n color: { type: String as () => NeonFunctionalColor, default: NeonFunctionalColor.Primary },\n /**\n * Minimum allowed date value in the <a href=\"https://en.wikipedia.org/wiki/ISO_8601\" target=\"_blank\">ISO 8601</a> format.\n */\n min: { type: String, default: null },\n /**\n * Maximum allowed date value in the <a href=\"https://en.wikipedia.org/wiki/ISO_8601\" target=\"_blank\">ISO 8601</a> format.\n */\n max: { type: String, default: null },\n /**\n * The placement of the dropdown calendar popup.\n */\n placement: { type: String as () => NeonDropdownPlacement, default: NeonDropdownPlacement.BottomLeft },\n /**\n * Disabled dates, a list of <a href=\"https://en.wikipedia.org/wiki/ISO_8601\" target=\"_blank\">ISO 8601</a> format\n * dates for which to disable selection.\n */\n disabledDates: { type: Array as () => Array<string>, default: () => [] },\n /**\n * This is the placeholder for the text input when no value is provided.\n */\n placeholder: { type: String, required: false },\n /**\n * This is the label of the input field which opens the calendar. This is technically a button.\n */\n openCalendarLabel: { type: String, default: 'Open calendar' },\n /**\n * This is the label of the 'Done' button in the calendar popup.\n */\n doneLabel: { type: String, default: 'Done' },\n /**\n * This is the label of the 'Clear' button in the calendar popup.\n */\n clearLabel: { type: String, default: 'Clear' },\n /**\n * This is the ARIA label of the 'Change month' button in the calendar popup.\n */\n changeMonthLabel: { type: String, default: 'Change month' },\n /**\n * This is the ARIA label of the 'Previous month' button in the calendar popup.\n */\n previousMonthLabel: { type: String, default: 'Previous month' },\n /**\n * This is the ARIA label of the 'Next month' button in the calendar popup.\n */\n nextMonthLabel: { type: String, default: 'Next month' },\n /**\n * This is the ARIA label of the 'Change year' button in the calendar popup.\n */\n changeYearLabel: { type: String, default: 'Change year' },\n /**\n * This is the ARIA label of the 'Previous year' button in the calendar popup.\n */\n previousYearLabel: { type: String, default: 'Previous year' },\n /**\n * This is the ARIA label of the 'Next year' button in the calendar popup.\n */\n nextYearLabel: { type: String, default: 'Next year' },\n /**\n * This is the ARIA label of the 'Previous decade' button in the calendar popup.\n */\n previousDecadeLabel: { type: String, default: 'Previous decade' },\n /**\n * This is the ARIA label of the 'Next decade' button in the calendar popup.\n */\n nextDecadeLabel: { type: String, default: 'Next decade' },\n },\n setup(props, { emit }) {\n const attrs = useAttrs();\n const optional = !attrs.required;\n\n const dropdown = ref<HTMLElement | null>(null);\n const calendarRef = ref<HTMLElement | null>(null);\n const calendarOpen = ref<boolean>(false);\n const monthSelectionOpen = ref<boolean>(false);\n const yearSelectionOpen = ref<boolean>(false);\n\n const formattedValue = computed(() => {\n if (props.modelValue) {\n const formattedDate = NeonDateUtils.stringToNeonDate(props.modelValue, props.locale, true);\n if (formattedDate) {\n const { dayFormatted, monthShortName, yearFormatted } = formattedDate;\n return `${dayFormatted} ${monthShortName} ${yearFormatted}`;\n }\n }\n\n return '';\n });\n\n const isoDate = (day: number, month: number, year: number) => NeonDateUtils.dmyToIso(day, month, year);\n\n const todayDate = new Date();\n const locale = props.locale || navigator.language;\n\n const pageMonth = ref(\n props.modelValue ? +props.modelValue.substring(5, 7) : +todayDate.toLocaleString(locale, { month: 'numeric' }),\n );\n const pageYear = ref(\n props.modelValue ? +props.modelValue.substring(0, 4) : +todayDate.toLocaleString(locale, { year: 'numeric' }),\n );\n const pageDecadeStart = ref(Math.floor(pageYear.value / 10) * 10);\n\n const calendar = computed(() =>\n NeonDateUtils.toCalendarConfiguration(\n props.modelValue,\n pageMonth.value,\n pageYear.value,\n pageDecadeStart.value,\n props.locale,\n ),\n );\n\n const today = computed(() => {\n const { day, month, year } = calendar.value.today;\n return NeonDateUtils.dmyToIso(day, month, year);\n });\n\n const openCalendar = () => {\n if (!props.disabled) {\n calendarOpen.value = true;\n if (calendarRef.value) {\n const selected = calendarRef.value.querySelector('.neon-date-picker__calendar-date--selected') as HTMLElement;\n if (selected) {\n setTimeout(() => selected.focus());\n }\n }\n }\n };\n\n const emitDate = (newDate: string) => {\n emit('update:modelValue', newDate);\n };\n\n const onPrevious = () => {\n if (pageMonth.value === 1) {\n pageMonth.value = 12;\n pageYear.value = pageYear.value - 1;\n } else {\n pageMonth.value = pageMonth.value - 1;\n }\n };\n\n const onNext = () => {\n if (pageMonth.value === 12) {\n pageMonth.value = 1;\n pageYear.value = pageYear.value + 1;\n } else {\n pageMonth.value = pageMonth.value + 1;\n }\n };\n\n const changeMonth = () => {\n monthSelectionOpen.value = true;\n };\n\n const isPreviousDisabled = computed(\n () => props.min && props.min >= NeonDateUtils.dmyToIso(1, calendar.value.pageMonth, calendar.value.pageYear),\n );\n const isNextDisabled = computed(() => {\n const { pageYear, pageMonth, lastDayOfMonth } = calendar.value;\n return props.max && props.max <= NeonDateUtils.dmyToIso(lastDayOfMonth, pageMonth, pageYear);\n });\n const isChangeDateDisabled = computed(() => isPreviousDisabled.value && isNextDisabled.value);\n\n const onPreviousYear = () => {\n pageYear.value = pageYear.value - 1;\n };\n\n const onNextYear = () => {\n pageYear.value = pageYear.value + 1;\n };\n\n const changeYear = () => {\n yearSelectionOpen.value = true;\n };\n\n const isPreviousYearDisabled = computed(\n () => props.min && props.min >= NeonDateUtils.dmyToIso(1, 1, calendar.value.pageYear),\n );\n const isNextYearDisabled = computed(\n () => props.max && props.max <= NeonDateUtils.dmyToIso(31, 12, calendar.value.pageYear),\n );\n const isChangeYearDisabled = computed(() => isPreviousYearDisabled.value && isNextYearDisabled.value);\n\n const onPreviousDecade = () => {\n pageDecadeStart.value = pageDecadeStart.value - 10;\n };\n\n const onNextDecade = () => {\n pageDecadeStart.value = pageDecadeStart.value + 10;\n };\n\n const isPreviousDecadeDisabled = computed(\n () => props.min && props.min >= NeonDateUtils.dmyToIso(1, 1, Math.floor(calendar.value.pageYear / 10) * 10),\n );\n const isNextDecadeDisabled = computed(\n () => props.max && props.max <= NeonDateUtils.dmyToIso(31, 12, Math.floor(calendar.value.pageYear / 10) * 10 + 9),\n );\n\n const resetToCalendar = () => {\n monthSelectionOpen.value = false;\n yearSelectionOpen.value = false;\n };\n\n const done = () => {\n calendarOpen.value = false;\n resetToCalendar();\n };\n\n const clear = () => {\n emit('update:modelValue', null);\n calendarOpen.value = false;\n resetToCalendar();\n };\n\n const selectMonth = (month: number) => {\n pageMonth.value = month;\n monthSelectionOpen.value = false;\n };\n\n const selectYear = (year: number) => {\n pageYear.value = year;\n yearSelectionOpen.value = false;\n };\n\n const isDisabled = (isoDate: string) => {\n return (\n props.disabledDates?.indexOf(isoDate) >= 0 ||\n (props.min && props.min > isoDate) ||\n (props.max && props.max < isoDate)\n );\n };\n\n const isMonthDisabled = (year: number, month: number) => {\n const dateStr = `${year}-${month < 10 ? '0' + month : month}`;\n return (\n (minYearMonth.value && minYearMonth.value > dateStr) || (maxYearMonth.value && maxYearMonth.value < dateStr)\n );\n };\n\n const minYear = computed<number | null>(() => (props.min ? +props.min.substring(0, 4) : null));\n const minYearMonth = computed<string | null>(() => (props.min ? props.min.substring(0, 7) : null));\n const maxYear = computed<number | null>(() => (props.max ? +props.max.substring(0, 4) : null));\n const maxYearMonth = computed<string | null>(() => (props.max ? props.max.substring(0, 7) : null));\n\n const isYearDisabled = (year: number) => {\n return (minYear.value && minYear.value > year) || (maxYear.value && maxYear.value < year);\n };\n\n return {\n attrs,\n calendar,\n calendarOpen,\n dropdown,\n formattedValue,\n isChangeDateDisabled,\n isChangeYearDisabled,\n isNextDisabled,\n isNextDecadeDisabled,\n isNextYearDisabled,\n isPreviousDisabled,\n isPreviousDecadeDisabled,\n isPreviousYearDisabled,\n monthSelectionOpen,\n optional,\n today,\n calendarRef,\n yearSelectionOpen,\n changeMonth,\n changeYear,\n clear,\n done,\n emitDate,\n isDisabled,\n isoDate,\n isMonthDisabled,\n isYearDisabled,\n openCalendar,\n onNext,\n onNextDecade,\n onNextYear,\n onPrevious,\n onPreviousDecade,\n onPreviousYear,\n resetToCalendar,\n selectMonth,\n selectYear,\n };\n },\n});\n"],"names":["_sfc_main","defineComponent","NeonButton","NeonDropdown","NeonInput","NeonSize","NeonFunctionalColor","NeonDropdownPlacement","props","emit","attrs","useAttrs","optional","dropdown","ref","calendarRef","calendarOpen","monthSelectionOpen","yearSelectionOpen","formattedValue","computed","formattedDate","NeonDateUtils","dayFormatted","monthShortName","yearFormatted","isoDate","day","month","year","todayDate","locale","pageMonth","pageYear","pageDecadeStart","calendar","today","openCalendar","selected","emitDate","newDate","onPrevious","onNext","changeMonth","isPreviousDisabled","isNextDisabled","lastDayOfMonth","isChangeDateDisabled","onPreviousYear","onNextYear","changeYear","isPreviousYearDisabled","isNextYearDisabled","isChangeYearDisabled","onPreviousDecade","onNextDecade","isPreviousDecadeDisabled","isNextDecadeDisabled","resetToCalendar","done","clear","selectMonth","selectYear","isDisabled","_a","isMonthDisabled","dateStr","minYearMonth","maxYearMonth","minYear","maxYear"],"mappings":";;;;;;;;AAqBA,MAAAA,KAAeC,GAAgB;AAAA,EAC7B,MAAM;AAAA,EACN,YAAY;AAAA,IACV,YAAAC;AAAA,IACA,cAAAC;AAAA,IACA,WAAAC;AAAA,EACF;AAAA,EACA,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA,IAKL,YAAY,EAAE,MAAM,QAAQ,SAAS,KAAK;AAAA;AAAA;AAAA;AAAA,IAI1C,QAAQ,EAAE,MAAM,QAAQ,SAAS,KAAK;AAAA;AAAA;AAAA;AAAA,IAItC,UAAU,EAAE,MAAM,SAAS,SAAS,GAAM;AAAA;AAAA;AAAA;AAAA,IAI1C,MAAM,EAAE,MAAM,QAA0B,SAASC,GAAS,OAAO;AAAA;AAAA;AAAA;AAAA,IAIjE,OAAO,EAAE,MAAM,QAAqC,SAASC,GAAoB,QAAQ;AAAA;AAAA;AAAA;AAAA,IAIzF,KAAK,EAAE,MAAM,QAAQ,SAAS,KAAK;AAAA;AAAA;AAAA;AAAA,IAInC,KAAK,EAAE,MAAM,QAAQ,SAAS,KAAK;AAAA;AAAA;AAAA;AAAA,IAInC,WAAW,EAAE,MAAM,QAAuC,SAASC,GAA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ACA,gBAAAN;AAAA,MACA,iBAAAU;AAAA,MACA,aAAAG;AAAA,MACA,YAAAC;AAAA,IAAA;AAAA,EAEJ;AACF,CAAC;"}
|
|
1
|
+
{"version":3,"file":"NeonDatePicker.es.js","sources":["../../../../src/components/user-input/date-picker/NeonDatePicker.ts?vue&type=script&src=true&lang.ts"],"sourcesContent":["import { computed, defineComponent, ref, useAttrs } from 'vue';\nimport { NeonSize } from '@/common/enums/NeonSize';\nimport { NeonFunctionalColor } from '@/common/enums/NeonFunctionalColor';\nimport NeonDropdown from '@/components/presentation/dropdown/NeonDropdown.vue';\nimport NeonButton from '@/components/user-input/button/NeonButton.vue';\nimport NeonInput from '@/components/user-input/input/NeonInput.vue';\nimport { NeonDateUtils } from '@/common/utils/NeonDateUtils';\nimport { NeonDropdownPlacement } from '@/common/enums/NeonDropdownPlacement';\n\n/**\n * <strong>NeonDatePicker</strong> is the equivalent of the native\n * <a href=\"https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/date\" target=\"_blank\">HTML Date Input</a>.\n * It accepts an <a href=\"https://en.wikipedia.org/wiki/ISO_8601\" target=\"_blank\">ISO 8601</a> date string &\n * allows the user to select a date. Dates are formatted with the provided locale, if none is provided the browser\n * locale is used as a default. On touch devices the native date picker is presented to the user.\n *\n * The input date is displayed to the user WITHOUT any adjustment for their timezone, however 'Today' on the calendar is\n * highlighted for the user's timezone.\n *\n * This component interaction was inspired by this <a href=\"https://icehaunter.github.io/vue3-datepicker\" target=\"_blank\">vue-datepicker</a>\n */\nexport default defineComponent({\n name: 'NeonDatePicker',\n components: {\n NeonButton,\n NeonDropdown,\n NeonInput,\n },\n props: {\n /**\n * The selected date. A date string in the\n * <a href=\"https://en.wikipedia.org/wiki/ISO_8601\" target=\"_blank\">ISO 8601</a> format.\n */\n modelValue: { type: String, default: null },\n /**\n * The locale used for display purposes. This defaults to the browser's locale if none is provided.\n */\n locale: { type: String, default: null },\n /**\n * Disable date picker\n */\n disabled: { type: Boolean, default: false },\n /**\n * The size of the date picker, one of NeonSize.Small | NeonSize.Medium | NeonSize.Large.\n */\n size: { type: String as () => NeonSize, default: NeonSize.Medium },\n /**\n * Color of the date picker\n */\n color: { type: String as () => NeonFunctionalColor, default: NeonFunctionalColor.Primary },\n /**\n * Minimum allowed date value in the <a href=\"https://en.wikipedia.org/wiki/ISO_8601\" target=\"_blank\">ISO 8601</a> format.\n */\n min: { type: String, default: null },\n /**\n * Maximum allowed date value in the <a href=\"https://en.wikipedia.org/wiki/ISO_8601\" target=\"_blank\">ISO 8601</a> format.\n */\n max: { type: String, default: null },\n /**\n * The placement of the dropdown calendar popup.\n */\n placement: { type: String as () => NeonDropdownPlacement, default: NeonDropdownPlacement.BottomLeft },\n /**\n * Disabled dates, a list of <a href=\"https://en.wikipedia.org/wiki/ISO_8601\" target=\"_blank\">ISO 8601</a> format\n * dates for which to disable selection.\n */\n disabledDates: { type: Array as () => Array<string>, default: () => [] },\n /**\n * This is the placeholder for the text input when no value is provided.\n */\n placeholder: { type: String, required: false },\n /**\n * This is the label of the input field which opens the calendar. This is technically a button.\n */\n openCalendarLabel: { type: String, default: 'Open calendar' },\n /**\n * This is the label of the 'Done' button in the calendar popup.\n */\n doneLabel: { type: String, default: 'Done' },\n /**\n * This is the label of the 'Clear' button in the calendar popup.\n */\n clearLabel: { type: String, default: 'Clear' },\n /**\n * This is the ARIA label of the 'Change month' button in the calendar popup.\n */\n changeMonthLabel: { type: String, default: 'Change month' },\n /**\n * This is the ARIA label of the 'Previous month' button in the calendar popup.\n */\n previousMonthLabel: { type: String, default: 'Previous month' },\n /**\n * This is the ARIA label of the 'Next month' button in the calendar popup.\n */\n nextMonthLabel: { type: String, default: 'Next month' },\n /**\n * This is the ARIA label of the 'Change year' button in the calendar popup.\n */\n changeYearLabel: { type: String, default: 'Change year' },\n /**\n * This is the ARIA label of the 'Previous year' button in the calendar popup.\n */\n previousYearLabel: { type: String, default: 'Previous year' },\n /**\n * This is the ARIA label of the 'Next year' button in the calendar popup.\n */\n nextYearLabel: { type: String, default: 'Next year' },\n /**\n * This is the ARIA label of the 'Previous decade' button in the calendar popup.\n */\n previousDecadeLabel: { type: String, default: 'Previous decade' },\n /**\n * This is the ARIA label of the 'Next decade' button in the calendar popup.\n */\n nextDecadeLabel: { type: String, default: 'Next decade' },\n },\n setup(props, { emit }) {\n const attrs = useAttrs();\n const optional = !attrs.required;\n\n const dropdown = ref<HTMLElement | null>(null);\n const calendarRef = ref<HTMLElement | null>(null);\n const calendarOpen = ref<boolean>(false);\n const monthSelectionOpen = ref<boolean>(false);\n const yearSelectionOpen = ref<boolean>(false);\n\n const formattedValue = computed(() => {\n if (props.modelValue) {\n const formattedDate = NeonDateUtils.stringToNeonDate(props.modelValue, props.locale, true);\n if (formattedDate) {\n const { dayFormatted, monthShortName, yearFormatted } = formattedDate;\n return `${dayFormatted} ${monthShortName} ${yearFormatted}`;\n }\n }\n\n return '';\n });\n\n const isoDate = (day: number, month: number, year: number) => NeonDateUtils.dmyToIso(day, month, year);\n\n const todayDate = new Date();\n const locale = props.locale || navigator.language;\n\n const pageMonth = ref<number>(todayDate.getMonth());\n const pageYear = ref<number>(todayDate.getFullYear());\n const pageDecadeStart = ref<number>(Math.floor(pageYear.value / 10) * 10);\n\n const resetCalendarPages = () => {\n pageMonth.value = props.modelValue\n ? +props.modelValue.substring(5, 7)\n : +todayDate.toLocaleString(locale, { month: 'numeric' });\n pageYear.value = props.modelValue\n ? +props.modelValue.substring(0, 4)\n : +todayDate.toLocaleString(locale, { year: 'numeric' });\n pageDecadeStart.value = Math.floor(pageYear.value / 10) * 10;\n };\n\n resetCalendarPages();\n\n const calendar = computed(() =>\n NeonDateUtils.toCalendarConfiguration(\n props.modelValue,\n pageMonth.value,\n pageYear.value,\n pageDecadeStart.value,\n props.locale,\n ),\n );\n\n const today = computed(() => {\n const { day, month, year } = calendar.value.today;\n return NeonDateUtils.dmyToIso(day, month, year);\n });\n\n const openCalendar = () => {\n if (!props.disabled) {\n resetCalendarPages();\n calendarOpen.value = true;\n if (calendarRef.value) {\n const selected = calendarRef.value.querySelector('.neon-date-picker__calendar-date--selected') as HTMLElement;\n if (selected) {\n setTimeout(() => selected.focus());\n }\n }\n }\n };\n\n const emitDate = (newDate: string) => {\n emit('update:modelValue', newDate);\n };\n\n const onPrevious = () => {\n if (pageMonth.value === 1) {\n pageMonth.value = 12;\n pageYear.value = pageYear.value - 1;\n } else {\n pageMonth.value = pageMonth.value - 1;\n }\n };\n\n const onNext = () => {\n if (pageMonth.value === 12) {\n pageMonth.value = 1;\n pageYear.value = pageYear.value + 1;\n } else {\n pageMonth.value = pageMonth.value + 1;\n }\n };\n\n const changeMonth = () => {\n monthSelectionOpen.value = true;\n };\n\n const isPreviousDisabled = computed(\n () => props.min && props.min >= NeonDateUtils.dmyToIso(1, calendar.value.pageMonth, calendar.value.pageYear),\n );\n const isNextDisabled = computed(() => {\n const { pageYear, pageMonth, lastDayOfMonth } = calendar.value;\n return props.max && props.max <= NeonDateUtils.dmyToIso(lastDayOfMonth, pageMonth, pageYear);\n });\n const isChangeDateDisabled = computed(() => isPreviousDisabled.value && isNextDisabled.value);\n\n const onPreviousYear = () => {\n pageYear.value = pageYear.value - 1;\n };\n\n const onNextYear = () => {\n pageYear.value = pageYear.value + 1;\n };\n\n const changeYear = () => {\n yearSelectionOpen.value = true;\n };\n\n const isPreviousYearDisabled = computed(\n () => props.min && props.min >= NeonDateUtils.dmyToIso(1, 1, calendar.value.pageYear),\n );\n const isNextYearDisabled = computed(\n () => props.max && props.max <= NeonDateUtils.dmyToIso(31, 12, calendar.value.pageYear),\n );\n const isChangeYearDisabled = computed(() => isPreviousYearDisabled.value && isNextYearDisabled.value);\n\n const onPreviousDecade = () => {\n pageDecadeStart.value = pageDecadeStart.value - 10;\n };\n\n const onNextDecade = () => {\n pageDecadeStart.value = pageDecadeStart.value + 10;\n };\n\n const isPreviousDecadeDisabled = computed(\n () => props.min && props.min >= NeonDateUtils.dmyToIso(1, 1, Math.floor(calendar.value.pageYear / 10) * 10),\n );\n const isNextDecadeDisabled = computed(\n () => props.max && props.max <= NeonDateUtils.dmyToIso(31, 12, Math.floor(calendar.value.pageYear / 10) * 10 + 9),\n );\n\n const resetToCalendar = () => {\n monthSelectionOpen.value = false;\n yearSelectionOpen.value = false;\n };\n\n const done = () => {\n calendarOpen.value = false;\n resetToCalendar();\n };\n\n const clear = () => {\n emit('update:modelValue', null);\n calendarOpen.value = false;\n resetToCalendar();\n };\n\n const selectMonth = (month: number) => {\n pageMonth.value = month;\n monthSelectionOpen.value = false;\n };\n\n const selectYear = (year: number) => {\n pageYear.value = year;\n yearSelectionOpen.value = false;\n };\n\n const isDisabled = (isoDate: string) => {\n return (\n props.disabledDates?.indexOf(isoDate) >= 0 ||\n (props.min && props.min > isoDate) ||\n (props.max && props.max < isoDate)\n );\n };\n\n const isMonthDisabled = (year: number, month: number) => {\n const dateStr = `${year}-${month < 10 ? '0' + month : month}`;\n return (\n (minYearMonth.value && minYearMonth.value > dateStr) || (maxYearMonth.value && maxYearMonth.value < dateStr)\n );\n };\n\n const minYear = computed<number | null>(() => (props.min ? +props.min.substring(0, 4) : null));\n const minYearMonth = computed<string | null>(() => (props.min ? props.min.substring(0, 7) : null));\n const maxYear = computed<number | null>(() => (props.max ? +props.max.substring(0, 4) : null));\n const maxYearMonth = computed<string | null>(() => (props.max ? props.max.substring(0, 7) : null));\n\n const isYearDisabled = (year: number) => {\n return (minYear.value && minYear.value > year) || (maxYear.value && maxYear.value < year);\n };\n\n return {\n attrs,\n calendar,\n calendarOpen,\n dropdown,\n formattedValue,\n isChangeDateDisabled,\n isChangeYearDisabled,\n isNextDisabled,\n isNextDecadeDisabled,\n isNextYearDisabled,\n isPreviousDisabled,\n isPreviousDecadeDisabled,\n isPreviousYearDisabled,\n monthSelectionOpen,\n optional,\n today,\n calendarRef,\n yearSelectionOpen,\n changeMonth,\n changeYear,\n clear,\n done,\n emitDate,\n isDisabled,\n isoDate,\n isMonthDisabled,\n isYearDisabled,\n openCalendar,\n onNext,\n onNextDecade,\n onNextYear,\n onPrevious,\n onPreviousDecade,\n onPreviousYear,\n resetToCalendar,\n selectMonth,\n selectYear,\n };\n },\n});\n"],"names":["_sfc_main","defineComponent","NeonButton","NeonDropdown","NeonInput","NeonSize","NeonFunctionalColor","NeonDropdownPlacement","props","emit","attrs","useAttrs","optional","dropdown","ref","calendarRef","calendarOpen","monthSelectionOpen","yearSelectionOpen","formattedValue","computed","formattedDate","NeonDateUtils","dayFormatted","monthShortName","yearFormatted","isoDate","day","month","year","todayDate","locale","pageMonth","pageYear","pageDecadeStart","resetCalendarPages","calendar","today","openCalendar","selected","emitDate","newDate","onPrevious","onNext","changeMonth","isPreviousDisabled","isNextDisabled","lastDayOfMonth","isChangeDateDisabled","onPreviousYear","onNextYear","changeYear","isPreviousYearDisabled","isNextYearDisabled","isChangeYearDisabled","onPreviousDecade","onNextDecade","isPreviousDecadeDisabled","isNextDecadeDisabled","resetToCalendar","done","clear","selectMonth","selectYear","isDisabled","_a","isMonthDisabled","dateStr","minYearMonth","maxYearMonth","minYear","maxYear"],"mappings":";;;;;;;;AAqBA,MAAAA,KAAeC,GAAgB;AAAA,EAC7B,MAAM;AAAA,EACN,YAAY;AAAA,IACV,YAAAC;AAAA,IACA,cAAAC;AAAA,IACA,WAAAC;AAAA,EACF;AAAA,EACA,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA,IAKL,YAAY,EAAE,MAAM,QAAQ,SAAS,KAAK;AAAA;AAAA;AAAA;AAAA,IAI1C,QAAQ,EAAE,MAAM,QAAQ,SAAS,KAAK;AAAA;AAAA;AAAA;AAAA,IAItC,UAAU,EAAE,MAAM,SAAS,SAAS,GAAM;AAAA;AAAA;AAAA;AAAA,IAI1C,MAAM,EAAE,MAAM,QAA0B,SAASC,GAAS,OAAO;AAAA;AAAA;AAAA;AAAA,IAIjE,OAAO,EAAE,MAAM,QAAqC,SAASC,GAAoB,QAAQ;AAAA;AAAA;AAAA;AAAA,IAIzF,KAAK,EAAE,M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;AAAA,MACA,OAAAU;AAAA,MACA,MAAAD;AAAA,MACA,UAAApB;AAAA,MACA,YAAAwB;AAAA,MACA,SAAAtC;AAAA,MACA,iBAAAwC;AAAA,MACA,gBA/BqB,CAACrC,MACdyC,EAAQ,SAASA,EAAQ,QAAQzC,KAAU0C,EAAQ,SAASA,EAAQ,QAAQ1C;AAAA,MA+BpF,cAAAS;AAAA,MACA,QAAAK;AAAA,MACA,cAAAa;AAAA,MACA,YAAAN;AAAA,MACA,YAAAR;AAAA,MACA,kBAAAa;AAAA,MACA,gBAAAN;AAAA,MACA,iBAAAU;AAAA,MACA,aAAAG;AAAA,MACA,YAAAC;AAAA,IAAA;AAAA,EAEJ;AACF,CAAC;"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aotearoan/neon",
|
|
3
3
|
"description": "Neon is a lightweight design library of Vue 3 components with minimal dependencies.",
|
|
4
|
-
"version": "14.1.
|
|
4
|
+
"version": "14.1.4",
|
|
5
5
|
"main": "./dist/neon.cjs.js",
|
|
6
6
|
"module": "./dist/neon.es.js",
|
|
7
7
|
"types": "./dist/src/neon.d.ts",
|