From dbea61a850e79454f335920738459b89c9dd85ec Mon Sep 17 00:00:00 2001 From: Brent McSharry <2456704+mcshaz@users.noreply.github.com> Date: Thu, 16 Apr 2020 16:23:26 +1200 Subject: [PATCH] add title=placeholder if no title --- .npmignore | 2 ++ README.md | 2 +- dist/{add-pickers-dd4f5f85.mjs => add-pickers-d77e4620.mjs} | 4 ++-- ...pickers-dd4f5f85.mjs.map => add-pickers-d77e4620.mjs.map} | 2 +- ...pickers-ba507d00.cjs.mjs => add-pickers-59466f4f.cjs.mjs} | 2 +- ...dfd5f3d.cjs.mjs => polyfill-if-required-d8ecbf95.cjs.mjs} | 2 +- dist/cjs/polyfill-if-required.cjs.js | 2 +- dist/iife/esm-date-input-polyfill.js | 2 +- dist/iife/esm-date-input-polyfill.js.map | 2 +- ...quired-d890f842.mjs => polyfill-if-required-00d9150b.mjs} | 4 ++-- ...890f842.mjs.map => polyfill-if-required-00d9150b.mjs.map} | 2 +- dist/polyfill-if-required.mjs | 2 +- examples/dist/add-pickers-d77e4620-116076a8.js | 3 +++ ...-dfbf435a.js.map => add-pickers-d77e4620-116076a8.js.map} | 2 +- examples/dist/add-pickers-d77e4620-a5ce75a2.js | 3 +++ ...-f659d4be.js.map => add-pickers-d77e4620-a5ce75a2.js.map} | 2 +- examples/dist/add-pickers-dd4f5f85-dfbf435a.js | 3 --- examples/dist/add-pickers-dd4f5f85-f659d4be.js | 3 --- .../dist/{esm.module-3ffa9b56.js => esm.module-42da03d1.js} | 4 ++-- ...esm.module-3ffa9b56.js.map => esm.module-42da03d1.js.map} | 2 +- examples/dist/esm.module.js | 2 +- examples/dist/esm.nomodule.js | 2 +- examples/dist/esm.nomodule.js.map | 2 +- ...st-age.module-e92bafcd.js => gest-age.module-590e7296.js} | 4 ++-- ...odule-e92bafcd.js.map => gest-age.module-590e7296.js.map} | 2 +- examples/dist/gest-age.module.js | 2 +- examples/dist/gest-age.nomodule.js | 2 +- examples/dist/gest-age.nomodule.js.map | 2 +- index.mjs | 1 + package.json | 5 +---- rollup.config.js | 2 +- src/Input.js | 3 +++ 32 files changed, 41 insertions(+), 38 deletions(-) rename dist/{add-pickers-dd4f5f85.mjs => add-pickers-d77e4620.mjs} (91%) rename dist/{add-pickers-dd4f5f85.mjs.map => add-pickers-d77e4620.mjs.map} (72%) rename dist/cjs/{add-pickers-ba507d00.cjs.mjs => add-pickers-59466f4f.cjs.mjs} (91%) rename dist/cjs/{polyfill-if-required-6dfd5f3d.cjs.mjs => polyfill-if-required-d8ecbf95.cjs.mjs} (80%) rename dist/{polyfill-if-required-d890f842.mjs => polyfill-if-required-00d9150b.mjs} (90%) rename dist/{polyfill-if-required-d890f842.mjs.map => polyfill-if-required-00d9150b.mjs.map} (98%) create mode 100644 examples/dist/add-pickers-d77e4620-116076a8.js rename examples/dist/{add-pickers-dd4f5f85-dfbf435a.js.map => add-pickers-d77e4620-116076a8.js.map} (79%) create mode 100644 examples/dist/add-pickers-d77e4620-a5ce75a2.js rename examples/dist/{add-pickers-dd4f5f85-f659d4be.js.map => add-pickers-d77e4620-a5ce75a2.js.map} (79%) delete mode 100644 examples/dist/add-pickers-dd4f5f85-dfbf435a.js delete mode 100644 examples/dist/add-pickers-dd4f5f85-f659d4be.js rename examples/dist/{esm.module-3ffa9b56.js => esm.module-42da03d1.js} (99%) rename examples/dist/{esm.module-3ffa9b56.js.map => esm.module-42da03d1.js.map} (99%) rename examples/dist/{gest-age.module-e92bafcd.js => gest-age.module-590e7296.js} (99%) rename examples/dist/{gest-age.module-e92bafcd.js.map => gest-age.module-590e7296.js.map} (99%) create mode 100644 index.mjs diff --git a/.npmignore b/.npmignore index 6796423..a10dc22 100644 --- a/.npmignore +++ b/.npmignore @@ -2,3 +2,5 @@ node_modules src examples +index.html +rollup.config.js diff --git a/README.md b/README.md index b5e60e2..fc5c01a 100644 --- a/README.md +++ b/README.md @@ -70,7 +70,7 @@ Execute `dateInputPolyfill.polyfillIfRequired()` with any options described abov ## Features -* **Easily Stylable:** [These are the default styles](https://github.com/brianblakely/esm-date-input-polyfill/blob/master/esm-date-input-polyfill.scss), which you may override with your own. +* **Easily Stylable:** [These are the default styles](https://github.com/mcshaz/esm-date-input-polyfill/blob/master/esm-date-input-polyfill.scss), which you may override with your own. * **Polyfills `valueAsDate` and `valueAsNumber`:** [Learn more about these properties.](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement#property-valueasdate). They behave as getters and setters. diff --git a/dist/add-pickers-dd4f5f85.mjs b/dist/add-pickers-d77e4620.mjs similarity index 91% rename from dist/add-pickers-dd4f5f85.mjs rename to dist/add-pickers-d77e4620.mjs index 9229d17..6291e4d 100644 --- a/dist/add-pickers-dd4f5f85.mjs +++ b/dist/add-pickers-d77e4620.mjs @@ -1,3 +1,3 @@ // @license MIT - https://github.com/brianblakely/esm-date-input-polyfill -import{a as e,d as t,F as a}from"./polyfill-if-required-d890f842.mjs";!function(e,t){void 0===t&&(t={});var a=t.insertAt;if(e&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css","top"===a&&n.firstChild?n.insertBefore(s,n.firstChild):n.appendChild(s),s.styleSheet?s.styleSheet.cssText=e:s.appendChild(document.createTextNode(e))}}('date-input-polyfill {\n background: #fff;\n color: #000;\n text-shadow: none;\n border: 0;\n padding: 0;\n height: auto;\n width: auto;\n line-height: normal;\n border-radius: 0;\n font-family: sans-serif;\n font-size: 14px;\n position: absolute !important;\n text-align: center;\n box-shadow: 0 7px 8px -4px rgba(0, 0, 0, 0.2), 0 12px 17px 2px rgba(0, 0, 0, 0.14), 0 5px 22px 4px rgba(0, 0, 0, 0.12);\n cursor: default;\n z-index: 1; }\n date-input-polyfill[data-open="false"] {\n display: none; }\n date-input-polyfill[data-open="true"] {\n display: block; }\n date-input-polyfill select, date-input-polyfill table, date-input-polyfill th, date-input-polyfill td {\n background: #fff;\n color: #000;\n text-shadow: none;\n border: 0;\n padding: 0;\n height: auto;\n width: auto;\n line-height: normal;\n border-radius: 0;\n font-family: sans-serif;\n font-size: 14px;\n box-shadow: none; }\n date-input-polyfill select, date-input-polyfill button {\n border: 0;\n border-bottom: 1px solid #E0E0E0;\n height: 24px;\n vertical-align: top; }\n date-input-polyfill select {\n width: 50%; }\n date-input-polyfill select:first-of-type {\n border-right: 1px solid #E0E0E0;\n width: 30%; }\n date-input-polyfill button {\n padding: 0;\n width: 20%;\n background: #E0E0E0; }\n date-input-polyfill table {\n border-collapse: collapse; }\n date-input-polyfill th, date-input-polyfill td {\n width: 32px;\n padding: 4px;\n text-align: center; }\n date-input-polyfill td {\n cursor: pointer; }\n date-input-polyfill td:hover {\n background: #E0E0FF; }\n date-input-polyfill .esm-polyfill-invalid-day {\n background: #eee;\n color: #422;\n cursor: not-allowed; }\n date-input-polyfill .esm-polyfill-day-selected {\n font-weight: bold;\n background: #d8eaf6; }\n date-input-polyfill .esm-polyfill-current-day {\n border: 1px #777 solid; }\n\ninput[data-has-picker]::-ms-clear {\n display: none; }\n');class n{constructor({yrsBack:e=80,yrsFwd:t=20}={yrsBack:80,yrsFwd:20}){if(n.instance)return n.instance;const a={passive:!0};this.date=new Date,this.input=null,this.isOpen=!1,this._onBeforeOpen=[],this.container=document.createElement("date-input-polyfill"),this.year=document.createElement("select"),n.createRangeSelect(this.year,this.date.getFullYear()-e,this.date.getFullYear()+t),this.year.className="yearSelect",this.year.addEventListener("change",()=>{this.date.setYear(this.year.value),this.refreshDaysMatrix()},a),this.container.appendChild(this.year),this.month=document.createElement("select"),this.month.className="monthSelect",this.month.addEventListener("change",()=>{this.date.setMonth(this.month.value),this.refreshDaysMatrix()},a),this.container.appendChild(this.month),this.today=document.createElement("button"),this.today.textContent="Today",this.today.addEventListener("click",()=>{this.date=new Date,this.setInput()},a),this.container.appendChild(this.today);const s=document.createElement("table");this.daysHead=document.createElement("thead"),this.days=document.createElement("tbody"),this.days.addEventListener("click",e=>{const t=e.target;if(!t.classList.contains("esm-polyfill-day")||t.classList.contains("esm-polyfill-invalid-day"))return!1;const a=this.days.querySelector(".esm-polyfill-day-selected");a&&a.classList.remove("esm-polyfill-day-selected"),t.classList.add("esm-polyfill-day-selected"),this.date.setDate(parseInt(t.textContent,10)),this.setInput()},a),s.appendChild(this.daysHead),s.appendChild(this.days),this.container.appendChild(s),this.hide(),document.body.appendChild(this.container),document.addEventListener("click",e=>{let t=e.target,a=t===this.container;for(;!a&&(t=t.parentNode);)a=t===this.container;const n=e.target.getAttribute("type");"date"===n||"date-polyfill"===n||a||this.hide()},a)}hide(){this.container.setAttribute("data-open",this.isOpen=!1)}show(){this._onBeforeOpen.forEach(e=>e()),this.container.setAttribute("data-open",this.isOpen=!0)}onBeforeOpen(e){this._onBeforeOpen.push(e)}goto(e){const t=e.getBoundingClientRect();this.container.style.top=`${t.top+t.height+(document.documentElement.scrollTop||document.body.scrollTop)}px`,this.container.style.left=`${t.left+(document.documentElement.scrollLeft||document.body.scrollLeft)}px`,this.show()}attachTo(e){if(e===this.input&&this.isOpen)return!1;this.input=e,this.sync(),this.goto(this.input.element)}sync(){this.input.element.valueAsDate?this.date=n.utcDateToLocal(this.input.element.valueAsDate):this.date=new Date,this.year.value=this.date.getFullYear(),this.month.value=this.date.getMonth(),this.refreshDaysMatrix()}setInput(){this.input.element.value=`${this.date.getFullYear()}-${String(this.date.getMonth()+1).padStart(2,"0")}-${String(this.date.getDate()).padStart(2,"0")}`,this.input.element.focus(),setTimeout(()=>{this.hide()},100),this.pingInput()}refreshLocale(){if(this.locale===this.input.locale)return!1;this.locale=this.input.locale;const e=["