{"version":3,"file":"material-datetime-picker.js","sources":["../lib/template/datepicker.template.js","../lib/template/scrim.template.js","../lib/js/events.js","../lib/js/index.js"],"sourcesContent":["export default () => `\n
\n`;\n","export default ({ styles }) => `\n\n`;\n","//\n// basic event triggering and listening\n//\nexport default class Events {\n constructor() {\n this._events = {\n '*': []\n };\n }\n\n trigger(eventName, evtData) {\n eventName.split(' ').forEach((evtName) => {\n // trigger a global event event\n this._events['*'].forEach(evt => evt.fn.call(evt.scope, evtName, evtData));\n // if there are any listeners to this event\n // then fire their handlers\n if (this._events[evtName]) {\n this._events[evtName].forEach((evt) => {\n evt.fn.call(evt.scope, evtData);\n });\n }\n });\n return this;\n }\n\n on(eventName, fn, scope) {\n if (!this._events[eventName]) this._events[eventName] = [];\n this._events[eventName].push({\n eventName,\n fn,\n scope: scope || this\n });\n return this;\n }\n\n off(eventName, fn) {\n if (!this._events[eventName]) return this;\n if (!fn) {\n this._events[eventName] = [];\n }\n this._events[eventName] = this._events[eventName].filter(evt => evt.fn !== fn);\n return this;\n }\n\n once(eventName, fn, scope) {\n const func = () => {\n fn.call(scope, eventName, fn, scope);\n this.off(eventName, func);\n };\n return this.on(eventName, func, scope);\n }\n}\n","import rome from 'rome';\nimport moment from 'moment';\n\nimport popupTemplate from '../template/datepicker.template';\nimport scrimTemplate from '../template/scrim.template';\nimport Events from './events';\n\nimport '../scss/material-datetime-picker.scss';\n\nconst prefix = 'c-datepicker';\nconst defaults = () => ({\n default: moment().startOf('hour'),\n // allow the user to override all the classes\n // used for styling the calendar\n styles: {\n scrim: 'c-scrim',\n back: `${prefix}__back`,\n container: `${prefix}__calendar`,\n date: `${prefix}__date`,\n dayBody: `${prefix}__days-body`,\n dayBodyElem: `${prefix}__day-body`,\n dayConcealed: `${prefix}__day--concealed`,\n dayDisabled: `${prefix}__day--disabled`,\n dayHead: `${prefix}__days-head`,\n dayHeadElem: `${prefix}__day-head`,\n dayRow: `${prefix}__days-row`,\n dayTable: `${prefix}__days`,\n month: `${prefix}__month`,\n next: `${prefix}__next`,\n positioned: `${prefix}--fixed`,\n selectedDay: `${prefix}__day--selected`,\n selectedTime: `${prefix}__time--selected`,\n time: `${prefix}__time`,\n timeList: `${prefix}__time-list`,\n timeOption: `${prefix}__time-option`,\n clockNum: `${prefix}__clock__num`\n },\n // format to display in the input, or set on the element\n format: 'DD/MM/YY',\n // the container to append the picker\n container: document.body,\n // allow any dates\n dateValidator: undefined\n});\n\nclass DateTimePicker extends Events {\n constructor(options = {}) {\n super();\n const styles = Object.assign(defaults().styles, options.styles);\n this.options = Object.assign(defaults(), options);\n this.options.styles = styles;\n\n // listen to any event\n this.on('*', (evtName, evtData) => {\n if (this.options.el) {\n // if there is a custom element, fire a real dom\n // event on that now\n const event = new CustomEvent(evtName, this, evtData);\n this.options.el.dispatchEvent(event);\n }\n });\n }\n\n // intialize the rom calendar with our default date and\n // style options\n initializeRome(container, validator) {\n const onData = this.onChangeDate.bind(this);\n\n return rome(container, {\n styles: this.options.styles,\n time: false,\n dateValidator: validator,\n initialValue: this.value\n }).on('data', onData);\n }\n\n // called to open the picker\n open() {\n const scrimEl = scrimTemplate(this.options);\n _appendTemplate(document.body, scrimEl);\n _appendTemplate(this.options.container, popupTemplate());\n this.pickerEl = this.options.container.querySelector(`.${prefix}`);\n this.scrimEl = document.body.querySelector(`.${this.options.styles.scrim}`);\n this.amToggleEl = this.$('.c-datepicker__clock--am');\n this.pmToggleEl = this.$('.c-datepicker__clock--pm');\n\n if (!this.value) {\n this.value = moment(this.options.default);\n }\n\n this.setDate(this.value);\n this.setTime(this.value);\n this.initializeRome(this.$(`.${this.options.styles.container}`), this.options.dateValidator);\n this._show();\n }\n\n close() {\n this._hide();\n }\n\n _hide() {\n this.pickerEl.classList.remove('open');\n window.setTimeout(() => {\n this.options.container.removeChild(this.pickerEl);\n document.body.removeChild(this.scrimEl);\n this.trigger('close');\n }, 200);\n return this;\n }\n\n _show() {\n this.delegateEvents();\n // add the animation classes on the next animation tick\n // so that they actually work\n window.requestAnimationFrame(() => {\n this.scrimEl.classList.add(`${this.options.styles.scrim}--shown`);\n this.pickerEl.classList.add(`${prefix}--open`);\n this.trigger('open');\n });\n return this;\n }\n\n delegateEvents() {\n this.$('.js-cancel')\n .addEventListener('click', () => this.clickCancel(), false);\n this.$('.js-ok')\n .addEventListener('click', () => this.clickSubmit(), false);\n\n this.$('.c-datepicker__clock__hours').addEventListener('mouseleave', e => this.mouseOutClock(e), false);\n this.$(`.${this.options.styles.clockNum}`).forEach((el) => {\n el.addEventListener('click', e => this.clickClock(e), false);\n el.addEventListener('mouseenter', e => this.mouseInClock(e), false);\n });\n\n this.$('.c-datepicker__clock--am')\n .addEventListener('click', e => this.clickAm(e), false);\n this.$('.c-datepicker__clock--pm')\n .addEventListener('click', e => this.clickPm(e), false);\n\n return this;\n }\n\n clickSubmit() {\n this.close();\n this.trigger('submit', this.value, this);\n return this;\n }\n\n clickCancel() {\n this.close();\n this.trigger('cancel', this.value, this);\n return this;\n }\n\n clickClock(e) {\n const newValue = moment(this.value);\n let number = parseInt(e.currentTarget.getAttribute('data-number'), 10);\n if (number === 0 && this.meridiem === 'pm') {\n number = 12;\n } else if (this.meridiem === 'pm') {\n number += 12;\n }\n\n newValue.hour(number);\n this.set(newValue);\n return this;\n }\n\n onChangeDate(dateString) {\n const newValue = moment(this.value);\n const [year, month, date] = dateString.split('-');\n newValue.set({ year, month: month - 1, date });\n\n this.set(newValue);\n return this;\n }\n\n mouseInClock() {\n const active = this.$(`.c-datepicker__clock__hours .${this.options.styles.clockNum}--active`);\n\n if (active) {\n active.classList.add('hide-hand');\n }\n }\n\n mouseOutClock() {\n const hideHand = this.$(`.c-datepicker__clock__hours .${this.options.styles.clockNum}--active.hide-hand`);\n\n if (hideHand) {\n hideHand.classList.remove('hide-hand');\n }\n }\n\n clickAm() {\n const newValue = moment(this.value);\n if (this.meridiem === 'pm') {\n this.meridiem = 'am';\n newValue.hour(newValue.hour() - 12);\n }\n this.set(newValue);\n return this;\n }\n\n clickPm() {\n const newValue = moment(this.value);\n if (this.meridiem === 'am') {\n this.meridiem = 'pm';\n newValue.hour(newValue.hour() + 12);\n }\n this.set(newValue);\n return this;\n }\n\n data(val) {\n return (val ? this.set(val) : this.value);\n }\n\n // update the picker's date/time value\n // value: moment\n // silent: if true, do not fire any events on change\n set(value, { silent = false } = {}) {\n const m = moment(value);\n\n // maintain a list of change events to fire all at once later\n const evts = [];\n if (m.date() !== this.value.date()\n || m.month() !== this.value.month()\n || m.year() !== this.value.year()\n ) {\n this.setDate(m);\n evts.push('change:date');\n } else if (m.hour() !== this.value.hour()\n || m.minutes() !== this.value.minutes()\n ) {\n this.setTime(m);\n evts.push('change:time');\n }\n\n if (this.options.el) {\n // if there is an element to fire events on\n if (this.options.el.tagName === 'INPUT') {\n // and it is an input element then set the value\n this.options.el.value = m.format(this.options.format);\n } else {\n // or any other element set a data-value attribute\n this.options.el.setAttribute('data-value', m.format(this.options.format));\n }\n }\n if (evts.length > 0 && !silent) {\n // fire all the events we've collected\n this.trigger(['change', ...evts].join(' '), this.value, this);\n }\n }\n\n // set the value and header elements to `date`\n // the calendar will be updated automatically\n // by rome when clicked\n setDate(date) {\n const m = moment(date);\n const month = m.format('MMM');\n const day = m.format('Do');\n const dayOfWeek = m.format('dddd');\n const year = m.format('YYYY');\n\n this.$('.js-day').innerText = dayOfWeek;\n this.$('.js-date-month').innerText = (`${month} ${year}`);\n this.$('.js-date-day').innerText = day;\n this.value.year(m.year());\n this.value.month(m.month());\n this.value.date(m.date());\n return this;\n }\n\n // set the value and header elements to `time`\n // also update the hands of the clock\n setTime(time) {\n const m = moment(time);\n const hour = m.format('HH');\n const hourAsInt = parseInt(hour, 10) % 12;\n const oldActiveHours = this.$(`.c-datepicker__clock__hours .${this.options.styles.clockNum}--active`);\n\n this.$('.js-date-hours').innerText = hour;\n\n if (oldActiveHours) {\n oldActiveHours.classList.remove(`${this.options.styles.clockNum}--active`);\n }\n this.$(`.c-datepicker__clock__hours .${this.options.styles.clockNum}[data-number=\"${hourAsInt}\"]`)\n .classList.add(`${this.options.styles.clockNum}--active`);\n this.value.hours(m.hours());\n this.meridiem = this.value.format('a');\n\n if (this.meridiem === 'pm') {\n this.amToggleEl.removeAttribute('checked');\n this.pmToggleEl.setAttribute('checked', 'checked');\n this.amToggleEl.parentElement.classList.remove('c-datepicker__toggle--checked');\n this.pmToggleEl.parentElement.classList.add('c-datepicker__toggle--checked');\n } else {\n this.pmToggleEl.removeAttribute('checked');\n this.amToggleEl.setAttribute('checked', 'checked');\n this.pmToggleEl.parentElement.classList.remove('c-datepicker__toggle--checked');\n this.amToggleEl.parentElement.classList.add('c-datepicker__toggle--checked');\n }\n return this;\n }\n\n $(selector) {\n const els = this.pickerEl.querySelectorAll(selector);\n return els.length > 1 ? [...els] : els[0];\n }\n}\n\nexport default DateTimePicker;\n\nfunction _appendTemplate(parent, template) {\n const tempEl = document.createElement('div');\n tempEl.innerHTML = template.trim();\n parent.appendChild(tempEl.firstChild);\n return this;\n}\n"],"names":["styles","scrim","Events","_events","eventName","evtData","split","forEach","evtName","evt","fn","call","scope","push","filter","func","off","on","prefix","defaults","moment","startOf","document","body","undefined","DateTimePicker","options","Object","assign","el","event","CustomEvent","dispatchEvent","container","validator","onData","onChangeDate","bind","rome","value","scrimEl","scrimTemplate","popupTemplate","pickerEl","querySelector","amToggleEl","$","pmToggleEl","default","setDate","setTime","initializeRome","dateValidator","_show","_hide","classList","remove","setTimeout","removeChild","trigger","delegateEvents","requestAnimationFrame","add","addEventListener","clickCancel","clickSubmit","mouseOutClock","e","clockNum","clickClock","mouseInClock","clickAm","clickPm","close","newValue","number","parseInt","currentTarget","getAttribute","meridiem","hour","set","dateString","year","month","date","active","hideHand","val","silent","m","evts","minutes","tagName","format","setAttribute","length","join","day","dayOfWeek","innerText","time","hourAsInt","oldActiveHours","hours","removeAttribute","parentElement","selector","els","querySelectorAll","_appendTemplate","parent","template","tempEl","createElement","innerHTML","trim","appendChild","firstChild"],"mappings":";;;;;;;;;AA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