semantic-forms 4.0.3 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +1 -1
- package/README.md +39 -11
- package/dist/semantic-forms.cjs +92 -0
- package/dist/semantic-forms.cjs.map +1 -0
- package/{semanticForms.css → dist/semantic-forms.css} +21 -10
- package/dist/semantic-forms.css.map +1 -0
- package/dist/semantic-forms.js +91 -0
- package/dist/semantic-forms.js.map +1 -0
- package/dist/semantic-forms.min.js +2 -0
- package/dist/semantic-forms.min.js.map +1 -0
- package/dist/semantic-forms.min.mjs +2 -0
- package/dist/semantic-forms.min.mjs.map +1 -0
- package/dist/semantic-forms.mjs +89 -0
- package/dist/semantic-forms.mjs.map +1 -0
- package/package.json +21 -12
- package/semanticForms.js +73 -7
- package/semanticForms.scss +16 -7
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"semantic-forms.js","mappings":"CAAA,SAA2CA,KAAMC,SAChD,UAAUC,UAAY,iBAAmBC,SAAW,SACnDA,OAAOD,QAAUD,eACb,UAAUG,SAAW,YAAcA,OAAOC,IAC9CD,OAAO,gBAAiB,GAAIH,cACxB,UAAUC,UAAY,SAC1BA,QAAQ,iBAAmBD,eAE3BD,KAAK,iBAAmBC,SACzB,EATD,CASGK,MAAM,Y;;;;;ACMGC,cAAA,kBAAAC,cAAA,SAAAA,cAAA,CAAAD,gBAAAA,gBAAAE,EAAA,KAfZN,OAAOD,QAAU,KAAMK,gBAAAG,EAAA,KAAAH,gBAAAE,EAAA;iFAErB;IAAIF,gBAAAI,EAAA,eAAOC,SAASC,yBAA2B,cAAUN,gBAAAI,EAAA,eAAWC,SAASE,gBAAkB,cAAUP,gBAAAI,EAAA,SAAKC,SAASG,KAAKC,aAAST,gBAAAI,EAAA,SAAKM,OAAOC,kBAAkB,CAAAX,gBAAAI,EAAA,QAAAJ,gBAAAE,EAAA,WAAK,MAACF,gBAAAI,EAAA,QAEzK,M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F,gBAAAE,EAAA,OAChB,IAAK,MAAMuF,YAAYF,UAAW,CAAAvF,gBAAAE,EAAA,OAChC,IAAK,MAAMwF,QAAQD,SAASE,WAAY,CAAA3F,gBAAAE,EAAA,OACtC,GAAIwF,KAAK7D,WAAa,OAAQ,CAAA7B,gBAAAI,EAAA,SAAAJ,gBAAAE,EAAA,OAC5BQ,OAAOkF,gBAAe5F,gBAAAE,EAAA,OACtBsF,KAAO,IACT,MAACxF,gBAAAI,EAAA,QACH,CAACJ,gBAAAE,EAAA,OACD,GAAIsF,KAAM,CAAAxF,gBAAAI,EAAA,SAAAJ,gBAAAE,EAAA,YAAI,MAACF,gBAAAI,EAAA,QACjB,KACAJ,gBAAAE,EAAA,OACFQ,OAAO4E,sBAAsBO,QAAQxF,SAASG,KAAM,CAAEsF,WAAY,MAAOC,UAAW,KAAMC,cAAe,MAAOC,QAAS,MAC3H,MAACjG,gBAAAI,EAAA,SAAAJ,gBAAAE,EAAA,OAEDQ,OAAOkF,cAAcM,aAAgBhF,OAASlB,gBAAAG,EAAA,MAAAH,gBAAAE,EAAA,OAC5CgB,KAAKT,UAAUoC,OAAO,uBAAsB7C,gBAAAE,EAAA,OAC5CQ,OAAOkF,eAAe,CACvB;;;;;QC1PH,IAAIO,yBAA2B,CAAC;;;QAGhC,SAASC,oBAAoBC;;QAE5B,IAAIC,aAAeH,yBAAyBE;QAC5C,GAAIC,oBAAiBC;QACpB,OAAOD,aAAa3G;;;QAGrB,IAAIC,OAASuG,yBAAyBE,UAAY;;;QAGjD1G,QAAS,CAAC;;;;QAIX6G,oBAAoBH,UAAUzG,OAAQA,OAAOD,QAASyG;;;QAGtD,OAAOxG,OAAOD;QACf;;;;;;;QCnBA,IAAI8G,oBAAsBL,oBAAoB","sources":["webpack://semanticForms/webpack/universalModuleDefinition","webpack://semanticForms/semanticForms.js","webpack://semanticForms/webpack/bootstrap","webpack://semanticForms/webpack/startup"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"semanticForms\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"semanticForms\"] = factory();\n\telse\n\t\troot[\"semanticForms\"] = factory();\n})(this, () => {\nreturn ","module.exports = () => {\n // do some feature detection so none of the JS executes if the browser is too old\n if (typeof document.getElementsByClassName !== 'function' || typeof document.querySelector !== 'function' || !document.body.classList || !window.MutationObserver) return\n\n const passwordShow = '<svg fill=\"none\" height=\"256\" viewBox=\"0 0 24 24\" width=\"256\" xmlns=\"http://www.w3.org/2000/svg\"><g stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\"><path d=\"m1 12s4-8 11-8 11 8 11 8\"/><path d=\"m1 12s4 8 11 8 11-8 11-8\"/><circle cx=\"12\" cy=\"12\" r=\"3\"/></g></svg>'\n const passwordHide = '<svg fill=\"none\" height=\"256\" viewBox=\"0 0 24 24\" width=\"256\" xmlns=\"http://www.w3.org/2000/svg\"><g stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\"><path d=\"m2 2 20 20\"/><path d=\"m6.71277 6.7226c-3.04798 2.07267-4.71277 5.2774-4.71277 5.2774s3.63636 7 10 7c2.0503 0 3.8174-.7266 5.2711-1.7116m-6.2711-12.23018c.3254-.03809.6588-.05822 1-.05822 6.3636 0 10 7 10 7s-.6918 1.3317-2 2.8335\"/><path d=\"m14 14.2362c-.5308.475-1.2316.7639-2 .7639-1.6569 0-3-1.3431-3-3 0-.8237.33193-1.5698.86932-2.11192\"/></g></svg>'\n\n const nodeNameLookup = ['TEXTAREA', 'SELECT']\n const inputTypeLookup = ['checkbox', 'color', 'date', 'datetime-local', 'email', 'file', 'image', 'month', 'number', 'password', 'radio', 'range', 'search', 'tel', 'text', 'time', 'url', 'week']\n\n // progressively enhance form elements that have the semanticForms class\n const forms = document.querySelectorAll('form.semanticForms:not(.semanticFormsActive)')\n\n for (const form of forms) {\n form.classList.add('semanticFormsActive')\n if (form.classList.contains('lowFlow')) continue\n\n // update each input in the semantic form\n const inputs = Array.from(form.querySelectorAll('input, textarea, select'))\n for (const input of inputs) {\n // ignore input if it has previously been formatted\n if (input.classList.contains('semanticform') || !input.id) continue\n\n const type = input.getAttribute('type')\n if (nodeNameLookup.includes(input.nodeName) || inputTypeLookup.includes(type)) {\n // recursively find <dl> element\n let dl = input.parentNode\n while (dl && dl.nodeName !== 'DL') dl = dl.parentNode\n\n if (!dl) continue\n if (!dl.classList.contains('floatLabelForm')) dl.classList.add('floatLabelForm')\n\n const label = input.parentNode.parentNode.id && (type === 'checkbox' || type === 'radio')\n ? document.querySelector('label[data-for=' + input.parentNode.parentNode.id.replace(/\\./g, '\\\\.') + ']')\n : document.querySelector('label[for=' + input.id.replace(/\\./g, '\\\\.') + ']')\n\n input.classList.add('semanticform')\n\n // #region create labels\n if (type === 'checkbox' || type === 'radio') {\n // recursively find <dd> element\n let dd = input.parentNode\n while (dd && dd.nodeName !== 'DD') dd = dd.parentNode\n\n if (dd.firstChild.nodeName !== 'LABEL') {\n const newLabel = document.createElement('label')\n newLabel.className = 'floatLabelFormAnimatedLabel'\n\n if (type === 'checkbox' && input.parentNode.nodeName === 'DD') {\n newLabel.setAttribute('for', input.id)\n input.parentNode.classList.add('singleCheckbox')\n newLabel.className = ''\n label.setAttribute('hidden', 'hidden')\n insertAfter(newLabel, input)\n }\n\n newLabel.innerHTML = label.innerHTML\n\n if (dd.querySelector(':required') && label.getAttribute('data-no-asterisk') === null && !label.querySelector('span')) {\n const text = label.getAttribute('data-asterisk-text') || 'This field is required.'\n label.innerHTML += `<span title=\"${text}\">*</span>`\n }\n\n if (!dd.querySelector('label')) dd.append(newLabel)\n }\n\n // removes old div that a radio or checkbox may have been added to\n if (dd.parentElement.nodeName === 'DIV') dd.parentElement.remove()\n\n const div = document.createElement('div')\n div.append(label.closest('dt'), dd)\n dl.append(div)\n } else {\n const newLabel = document.createElement('label')\n newLabel.setAttribute('for', input.id)\n newLabel.className = 'floatLabelFormAnimatedLabel'\n\n newLabel.innerHTML = label.innerHTML\n\n if (input.hasAttribute('required') && label.getAttribute('data-no-asterisk') === null && !label.querySelector('span')) {\n const text = label.getAttribute('data-asterisk-text') || 'This field is required.'\n newLabel.innerHTML += ` <span title=\"${text}\">*</span>`\n }\n\n label.setAttribute('hidden', 'hidden')\n\n insertAfter(newLabel, input)\n }\n // #endregion\n\n // standard inputs\n if (type !== 'checkbox' && type !== 'radio') {\n if (!input.getAttribute('placeholder')) {\n input.setAttribute('placeholder', ' ')\n }\n\n const div = document.createElement('div')\n const dt = label.closest('dt')\n const dd = input.closest('dd')\n\n // #region clear button\n if (input.nodeName !== 'SELECT' && type !== 'range') {\n const clearBtn = document.createElement('button')\n clearBtn.type = 'button'\n clearBtn.title = input.getAttribute('data-clear-field-text') || 'Clear field'\n clearBtn.ariaLabel = input.getAttribute('data-clear-field-text') || 'Clear field'\n clearBtn.tabIndex = -1\n clearBtn.innerHTML = '<svg viewBox=\"0 0 16 16\" width=\"18\" height=\"18\"><path d=\"M 1 1 L 15 15 M 1 15 L 15 1\" fill=\"none\" stroke-width=\"2\" stroke=\"currentColor\" />'\n clearBtn.classList.add('clear')\n clearBtn.id = `semanticFormsClearButton_${input.id}`\n clearBtn.addEventListener('click', (event) => {\n input.previousValue = input.value\n input.value = ''\n input.focus()\n lastClearFieldPressed = input.id\n })\n insertAfter(clearBtn, dd.querySelector('label'))\n }\n input.addEventListener('focus', (event) => {\n if (event.target.nodeName === 'INPUT') lastFocusedInput = event.target\n })\n // #endregion\n\n // check for colspan- utility class\n if (/colspan-/.test(dd.className)) {\n const match = dd.className.match(/colspan-([0-9]|full)/)[0]\n dd.classList.remove(match)\n div.classList.add(match)\n }\n\n div.append(dt, dd)\n dl.append(div)\n\n // determine visibility of newly created <div>\n if (dt.style.display === 'none' && dd.style.display === 'none') div.style.display = 'none'\n }\n\n // handle file input clear btn, cannot be handled with CSS\n if (type === 'file') {\n const clearBtn = input.parentElement.querySelector('.clear')\n input.addEventListener('input', e => {\n clearBtn.style.display = e.target.files.length ? 'flex' : 'none'\n })\n clearBtn.addEventListener('click', () => {\n clearBtn.style.display = 'none'\n })\n }\n\n // #region show password button\n if (type === 'password' && input.getAttribute('data-no-reveal') === null) {\n const showBtn = document.createElement('button')\n showBtn.type = 'button'\n showBtn.title = input.getAttribute('data-show-password-text') || 'Show password'\n showBtn.ariaLabel = input.getAttribute('data-show-password-text') || 'Show password'\n showBtn.tabIndex = -1\n showBtn.innerHTML = passwordShow\n showBtn.classList.add('show')\n showBtn.id = `semanticFormsShowButton_${input.id}`\n const dd = input.closest('dd')\n showBtn.addEventListener('click', (event) => {\n if (input.type === 'password') {\n showBtn.innerHTML = passwordHide\n showBtn.title = input.getAttribute('data-hide-password-text') || 'Hide password'\n showBtn.ariaLabel = input.getAttribute('data-hide-password-text') || 'Hide password'\n input.type = 'text'\n } else {\n showBtn.innerHTML = passwordShow\n showBtn.title = input.getAttribute('data-show-password-text') || 'Show password'\n showBtn.ariaLabel = input.getAttribute('data-show-password-text') || 'Show password'\n input.type = 'password'\n }\n input.focus()\n })\n insertAfter(showBtn, dd.querySelector('label'))\n }\n // #endregion\n\n // add listener to shift clear button when scrollbar present\n for (const textarea of document.querySelectorAll('textarea')) {\n // shifts the close button to the right if a scrollbar is present\n const shiftCloseBtn = () => {\n const clearBtn = textarea.parentElement?.querySelector('button.clear')\n if (clearBtn) {\n clearBtn.style.marginRight = textarea.clientHeight < textarea.scrollHeight ? '15px' : ''\n }\n }\n\n textarea.addEventListener('input', shiftCloseBtn)\n textarea.addEventListener('mouseup', shiftCloseBtn)\n }\n }\n }\n }\n\n /**\n * Places an element immediately after another element\n * @param {Object} newNode element being placed after the reference node\n * @param {*} referenceNode element to be used as reference for new node\n */\n function insertAfter (newNode, referenceNode) {\n if (referenceNode.nextSibling) referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling)\n else referenceNode.parentNode.appendChild(newNode)\n }\n\n // handle undo/redo\n let lastFocusedInput\n let lastClearFieldPressed\n document.addEventListener('keydown', (event) => {\n if ((event.ctrlKey || event.metaKey) && event.key === 'z' && !event.shiftKey) {\n // undo clearing a field\n if (lastFocusedInput) {\n if (lastFocusedInput?.parentNode?.querySelector('button.clear').id === `semanticFormsClearButton_${lastClearFieldPressed}` || lastFocusedInput?.parentNode?.querySelector('button.clear').name === `semanticFormsClearButton_${lastClearFieldPressed}`) {\n if (lastFocusedInput.previousValue) {\n lastFocusedInput.redoValue = lastFocusedInput.value\n lastFocusedInput.value = lastFocusedInput.previousValue\n }\n }\n }\n } else if ((event.ctrlKey && event.key === 'y') || (event.metaKey && event.shiftKey && event.key === 'z')) {\n // redo clearing a field\n if (lastFocusedInput) {\n if (lastFocusedInput?.parentNode?.querySelector('button.clear').id === `semanticFormsClearButton_${lastClearFieldPressed}` || lastFocusedInput?.parentNode?.querySelector('button.clear').name === `semanticFormsClearButton_${lastClearFieldPressed}`) {\n if (lastFocusedInput.redoValue) {\n lastFocusedInput.previousValue = lastFocusedInput.value\n lastFocusedInput.value = lastFocusedInput.redoValue\n }\n }\n }\n }\n })\n\n // monitor changes to the DOM and enhance new semanticForms forms that get added\n if (!window.semanticFormsObserver) {\n window.semanticFormsObserver = new window.MutationObserver((mutations) => {\n let stop = false\n for (const mutation of mutations) {\n for (const node of mutation.addedNodes) {\n if (node.nodeName === 'FORM') {\n window.semanticForms()\n stop = true\n }\n }\n if (stop) break\n }\n })\n window.semanticFormsObserver.observe(document.body, { attributes: false, childList: true, characterData: false, subtree: true })\n }\n\n window.semanticForms.reinitialize = (form) => {\n form.classList.remove('semanticFormsActive')\n window.semanticForms()\n }\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(806);\n"],"names":["root","factory","exports","module","define","amd","this","cov_buxls47iu","actualCoverage","s","f","b","document","getElementsByClassName","querySelector","body","classList","window","MutationObserver","passwordShow","passwordHide","nodeNameLookup","inputTypeLookup","forms","querySelectorAll","form","add","contains","inputs","Array","from","input","id","type","getAttribute","includes","nodeName","dl","parentNode","label","replace","dd","firstChild","newLabel","createElement","className","setAttribute","insertAfter","innerHTML","text","append","parentElement","remove","div","closest","hasAttribute","dt","clearBtn","title","ariaLabel","tabIndex","addEventListener","event","previousValue","value","focus","lastClearFieldPressed","target","lastFocusedInput","test","match","style","display","e","files","length","showBtn","textarea","shiftCloseBtn","marginRight","clientHeight","scrollHeight","newNode","referenceNode","nextSibling","insertBefore","appendChild","ctrlKey","metaKey","key","shiftKey","name","redoValue","semanticFormsObserver","mutations","stop","mutation","node","addedNodes","semanticForms","observe","attributes","childList","characterData","subtree","reinitialize","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","__webpack_exports__"],"sourceRoot":""}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("semanticForms",[],t):"object"==typeof exports?exports.semanticForms=t():e.semanticForms=t()}(this,(()=>{return e={90:e=>{e.exports=()=>{if("function"!=typeof document.getElementsByClassName||"function"!=typeof document.querySelector||!document.body.classList||!window.MutationObserver)return;const e='<svg fill="none" height="256" viewBox="0 0 24 24" width="256" xmlns="http://www.w3.org/2000/svg"><g stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="m1 12s4-8 11-8 11 8 11 8"/><path d="m1 12s4 8 11 8 11-8 11-8"/><circle cx="12" cy="12" r="3"/></g></svg>',t=["TEXTAREA","SELECT"],o=["checkbox","color","date","datetime-local","email","file","image","month","number","password","radio","range","search","tel","text","time","url","week"],r=document.querySelectorAll("form.semanticForms:not(.semanticFormsActive)");for(const i of r){if(i.classList.add("semanticFormsActive"),i.classList.contains("lowFlow"))continue;const r=Array.from(i.querySelectorAll("input, textarea, select"));for(const i of r){if(i.classList.contains("semanticform")||!i.id)continue;const r=i.getAttribute("type");if(t.includes(i.nodeName)||o.includes(r)){let t=i.parentNode;for(;t&&"DL"!==t.nodeName;)t=t.parentNode;if(!t)continue;t.classList.contains("floatLabelForm")||t.classList.add("floatLabelForm");const o=!i.parentNode.parentNode.id||"checkbox"!==r&&"radio"!==r?document.querySelector("label[for="+i.id.replace(/\./g,"\\.")+"]"):document.querySelector("label[data-for="+i.parentNode.parentNode.id.replace(/\./g,"\\.")+"]");if(i.classList.add("semanticform"),"checkbox"===r||"radio"===r){let e=i.parentNode;for(;e&&"DD"!==e.nodeName;)e=e.parentNode;if("LABEL"!==e.firstChild.nodeName){const t=document.createElement("label");if(t.className="floatLabelFormAnimatedLabel","checkbox"===r&&"DD"===i.parentNode.nodeName&&(t.setAttribute("for",i.id),i.parentNode.classList.add("singleCheckbox"),t.className="",o.setAttribute("hidden","hidden"),a(t,i)),t.innerHTML=o.innerHTML,e.querySelector(":required")&&null===o.getAttribute("data-no-asterisk")&&!o.querySelector("span")){const e=o.getAttribute("data-asterisk-text")||"This field is required.";o.innerHTML+=`<span title="${e}">*</span>`}e.querySelector("label")||e.append(t)}"DIV"===e.parentElement.nodeName&&e.parentElement.remove();const n=document.createElement("div");n.append(o.closest("dt"),e),t.append(n)}else{const e=document.createElement("label");if(e.setAttribute("for",i.id),e.className="floatLabelFormAnimatedLabel",e.innerHTML=o.innerHTML,i.hasAttribute("required")&&null===o.getAttribute("data-no-asterisk")&&!o.querySelector("span")){const t=o.getAttribute("data-asterisk-text")||"This field is required.";e.innerHTML+=` <span title="${t}">*</span>`}o.setAttribute("hidden","hidden"),a(e,i)}if("checkbox"!==r&&"radio"!==r){i.getAttribute("placeholder")||i.setAttribute("placeholder"," ");const e=document.createElement("div"),d=o.closest("dt"),l=i.closest("dd");if("SELECT"!==i.nodeName&&"range"!==r){const e=document.createElement("button");e.type="button",e.title=i.getAttribute("data-clear-field-text")||"Clear field",e.ariaLabel=i.getAttribute("data-clear-field-text")||"Clear field",e.tabIndex=-1,e.innerHTML='<svg viewBox="0 0 16 16" width="18" height="18"><path d="M 1 1 L 15 15 M 1 15 L 15 1" fill="none" stroke-width="2" stroke="currentColor" />',e.classList.add("clear"),e.id=`semanticFormsClearButton_${i.id}`,e.addEventListener("click",(e=>{i.previousValue=i.value,i.value="",i.focus(),s=i.id})),a(e,l.querySelector("label"))}if(i.addEventListener("focus",(e=>{"INPUT"===e.target.nodeName&&(n=e.target)})),/colspan-/.test(l.className)){const t=l.className.match(/colspan-([0-9]|full)/)[0];l.classList.remove(t),e.classList.add(t)}e.append(d,l),t.append(e),"none"===d.style.display&&"none"===l.style.display&&(e.style.display="none")}if("file"===r){const e=i.parentElement.querySelector(".clear");i.addEventListener("input",(t=>{e.style.display=t.target.files.length?"flex":"none"})),e.addEventListener("click",(()=>{e.style.display="none"}))}if("password"===r&&null===i.getAttribute("data-no-reveal")){const t=document.createElement("button");t.type="button",t.title=i.getAttribute("data-show-password-text")||"Show password",t.ariaLabel=i.getAttribute("data-show-password-text")||"Show password",t.tabIndex=-1,t.innerHTML=e,t.classList.add("show"),t.id=`semanticFormsShowButton_${i.id}`;const o=i.closest("dd");t.addEventListener("click",(o=>{"password"===i.type?(t.innerHTML='<svg fill="none" height="256" viewBox="0 0 24 24" width="256" xmlns="http://www.w3.org/2000/svg"><g stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="m2 2 20 20"/><path d="m6.71277 6.7226c-3.04798 2.07267-4.71277 5.2774-4.71277 5.2774s3.63636 7 10 7c2.0503 0 3.8174-.7266 5.2711-1.7116m-6.2711-12.23018c.3254-.03809.6588-.05822 1-.05822 6.3636 0 10 7 10 7s-.6918 1.3317-2 2.8335"/><path d="m14 14.2362c-.5308.475-1.2316.7639-2 .7639-1.6569 0-3-1.3431-3-3 0-.8237.33193-1.5698.86932-2.11192"/></g></svg>',t.title=i.getAttribute("data-hide-password-text")||"Hide password",t.ariaLabel=i.getAttribute("data-hide-password-text")||"Hide password",i.type="text"):(t.innerHTML=e,t.title=i.getAttribute("data-show-password-text")||"Show password",t.ariaLabel=i.getAttribute("data-show-password-text")||"Show password",i.type="password"),i.focus()})),a(t,o.querySelector("label"))}for(const e of document.querySelectorAll("textarea")){const t=()=>{const t=e.parentElement?.querySelector("button.clear");t&&(t.style.marginRight=e.clientHeight<e.scrollHeight?"15px":"")};e.addEventListener("input",t),e.addEventListener("mouseup",t)}}}}function a(e,t){t.nextSibling?t.parentNode.insertBefore(e,t.nextSibling):t.parentNode.appendChild(e)}let n,s;document.addEventListener("keydown",(e=>{!e.ctrlKey&&!e.metaKey||"z"!==e.key||e.shiftKey?(e.ctrlKey&&"y"===e.key||e.metaKey&&e.shiftKey&&"z"===e.key)&&n&&(n?.parentNode?.querySelector("button.clear").id!==`semanticFormsClearButton_${s}`&&n?.parentNode?.querySelector("button.clear").name!==`semanticFormsClearButton_${s}`||n.redoValue&&(n.previousValue=n.value,n.value=n.redoValue)):n&&(n?.parentNode?.querySelector("button.clear").id!==`semanticFormsClearButton_${s}`&&n?.parentNode?.querySelector("button.clear").name!==`semanticFormsClearButton_${s}`||n.previousValue&&(n.redoValue=n.value,n.value=n.previousValue))})),window.semanticFormsObserver||(window.semanticFormsObserver=new window.MutationObserver((e=>{let t=!1;for(const o of e){for(const e of o.addedNodes)"FORM"===e.nodeName&&(window.semanticForms(),t=!0);if(t)break}})),window.semanticFormsObserver.observe(document.body,{attributes:!1,childList:!0,characterData:!1,subtree:!0})),window.semanticForms.reinitialize=e=>{e.classList.remove("semanticFormsActive"),window.semanticForms()}}}},t={},function o(r){var a=t[r];if(void 0!==a)return a.exports;var n=t[r]={exports:{}};return e[r](n,n.exports,o),n.exports}(90);var e,t}));
|
|
2
|
+
//# sourceMappingURL=semantic-forms.min.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"semantic-forms.min.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,gBAAiB,GAAIH,GACF,iBAAZC,QACdA,QAAuB,cAAID,IAE3BD,EAAoB,cAAIC,GACzB,CATD,CASGK,MAAM,KACT,O,UCVAH,EAAOD,QAAU,KAEf,GAA+C,mBAApCK,SAASC,wBAA2E,mBAA3BD,SAASE,gBAAiCF,SAASG,KAAKC,YAAcC,OAAOC,iBAAkB,OAEnK,MAAMC,EAAe,8SAGfC,EAAiB,CAAC,WAAY,UAC9BC,EAAkB,CAAC,WAAY,QAAS,OAAQ,iBAAkB,QAAS,OAAQ,QAAS,QAAS,SAAU,WAAY,QAAS,QAAS,SAAU,MAAO,OAAQ,OAAQ,MAAO,QAGrLC,EAAQV,SAASW,iBAAiB,gDAExC,IAAK,MAAMC,KAAQF,EAAO,CAExB,GADAE,EAAKR,UAAUS,IAAI,uBACfD,EAAKR,UAAUU,SAAS,WAAY,SAGxC,MAAMC,EAASC,MAAMC,KAAKL,EAAKD,iBAAiB,4BAChD,IAAK,MAAMO,KAASH,EAAQ,CAE1B,GAAIG,EAAMd,UAAUU,SAAS,kBAAoBI,EAAMC,GAAI,SAE3D,MAAMC,EAAOF,EAAMG,aAAa,QAChC,GAAIb,EAAec,SAASJ,EAAMK,WAAad,EAAgBa,SAASF,GAAO,CAE7E,IAAII,EAAKN,EAAMO,WACf,KAAOD,GAAsB,OAAhBA,EAAGD,UAAmBC,EAAKA,E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Y,EAAOC,WAAW,EAAMC,eAAe,EAAOC,SAAS,KAG3HtF,OAAOiF,cAAcM,aAAgBhF,IACnCA,EAAKR,UAAUmC,OAAO,uBACtBlC,OAAOiF,eAAc,CACvB,C,GC1PEO,EAA2B,CAAC,EAGhC,SAASC,EAAoBC,GAE5B,IAAIC,EAAeH,EAAyBE,GAC5C,QAAqBE,IAAjBD,EACH,OAAOA,EAAarG,QAGrB,IAAIC,EAASiG,EAAyBE,GAAY,CAGjDpG,QAAS,CAAC,GAOX,OAHAuG,EAAoBH,GAAUnG,EAAQA,EAAOD,QAASmG,GAG/ClG,EAAOD,OACf,CCnB0BmG,CAAoB,I,MDF1CD,C","sources":["webpack://semanticForms/webpack/universalModuleDefinition","webpack://semanticForms/./semanticForms.js","webpack://semanticForms/webpack/bootstrap","webpack://semanticForms/webpack/startup"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"semanticForms\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"semanticForms\"] = factory();\n\telse\n\t\troot[\"semanticForms\"] = factory();\n})(this, () => {\nreturn ","module.exports = () => {\n // do some feature detection so none of the JS executes if the browser is too old\n if (typeof document.getElementsByClassName !== 'function' || typeof document.querySelector !== 'function' || !document.body.classList || !window.MutationObserver) return\n\n const passwordShow = '<svg fill=\"none\" height=\"256\" viewBox=\"0 0 24 24\" width=\"256\" xmlns=\"http://www.w3.org/2000/svg\"><g stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\"><path d=\"m1 12s4-8 11-8 11 8 11 8\"/><path d=\"m1 12s4 8 11 8 11-8 11-8\"/><circle cx=\"12\" cy=\"12\" r=\"3\"/></g></svg>'\n const passwordHide = '<svg fill=\"none\" height=\"256\" viewBox=\"0 0 24 24\" width=\"256\" xmlns=\"http://www.w3.org/2000/svg\"><g stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\"><path d=\"m2 2 20 20\"/><path d=\"m6.71277 6.7226c-3.04798 2.07267-4.71277 5.2774-4.71277 5.2774s3.63636 7 10 7c2.0503 0 3.8174-.7266 5.2711-1.7116m-6.2711-12.23018c.3254-.03809.6588-.05822 1-.05822 6.3636 0 10 7 10 7s-.6918 1.3317-2 2.8335\"/><path d=\"m14 14.2362c-.5308.475-1.2316.7639-2 .7639-1.6569 0-3-1.3431-3-3 0-.8237.33193-1.5698.86932-2.11192\"/></g></svg>'\n\n const nodeNameLookup = ['TEXTAREA', 'SELECT']\n const inputTypeLookup = ['checkbox', 'color', 'date', 'datetime-local', 'email', 'file', 'image', 'month', 'number', 'password', 'radio', 'range', 'search', 'tel', 'text', 'time', 'url', 'week']\n\n // progressively enhance form elements that have the semanticForms class\n const forms = document.querySelectorAll('form.semanticForms:not(.semanticFormsActive)')\n\n for (const form of forms) {\n form.classList.add('semanticFormsActive')\n if (form.classList.contains('lowFlow')) continue\n\n // update each input in the semantic form\n const inputs = Array.from(form.querySelectorAll('input, textarea, select'))\n for (const input of inputs) {\n // ignore input if it has previously been formatted\n if (input.classList.contains('semanticform') || !input.id) continue\n\n const type = input.getAttribute('type')\n if (nodeNameLookup.includes(input.nodeName) || inputTypeLookup.includes(type)) {\n // recursively find <dl> element\n let dl = input.parentNode\n while (dl && dl.nodeName !== 'DL') dl = dl.parentNode\n\n if (!dl) continue\n if (!dl.classList.contains('floatLabelForm')) dl.classList.add('floatLabelForm')\n\n const label = input.parentNode.parentNode.id && (type === 'checkbox' || type === 'radio')\n ? document.querySelector('label[data-for=' + input.parentNode.parentNode.id.replace(/\\./g, '\\\\.') + ']')\n : document.querySelector('label[for=' + input.id.replace(/\\./g, '\\\\.') + ']')\n\n input.classList.add('semanticform')\n\n // #region create labels\n if (type === 'checkbox' || type === 'radio') {\n // recursively find <dd> element\n let dd = input.parentNode\n while (dd && dd.nodeName !== 'DD') dd = dd.parentNode\n\n if (dd.firstChild.nodeName !== 'LABEL') {\n const newLabel = document.createElement('label')\n newLabel.className = 'floatLabelFormAnimatedLabel'\n\n if (type === 'checkbox' && input.parentNode.nodeName === 'DD') {\n newLabel.setAttribute('for', input.id)\n input.parentNode.classList.add('singleCheckbox')\n newLabel.className = ''\n label.setAttribute('hidden', 'hidden')\n insertAfter(newLabel, input)\n }\n\n newLabel.innerHTML = label.innerHTML\n\n if (dd.querySelector(':required') && label.getAttribute('data-no-asterisk') === null && !label.querySelector('span')) {\n const text = label.getAttribute('data-asterisk-text') || 'This field is required.'\n label.innerHTML += `<span title=\"${text}\">*</span>`\n }\n\n if (!dd.querySelector('label')) dd.append(newLabel)\n }\n\n // removes old div that a radio or checkbox may have been added to\n if (dd.parentElement.nodeName === 'DIV') dd.parentElement.remove()\n\n const div = document.createElement('div')\n div.append(label.closest('dt'), dd)\n dl.append(div)\n } else {\n const newLabel = document.createElement('label')\n newLabel.setAttribute('for', input.id)\n newLabel.className = 'floatLabelFormAnimatedLabel'\n\n newLabel.innerHTML = label.innerHTML\n\n if (input.hasAttribute('required') && label.getAttribute('data-no-asterisk') === null && !label.querySelector('span')) {\n const text = label.getAttribute('data-asterisk-text') || 'This field is required.'\n newLabel.innerHTML += ` <span title=\"${text}\">*</span>`\n }\n\n label.setAttribute('hidden', 'hidden')\n\n insertAfter(newLabel, input)\n }\n // #endregion\n\n // standard inputs\n if (type !== 'checkbox' && type !== 'radio') {\n if (!input.getAttribute('placeholder')) {\n input.setAttribute('placeholder', ' ')\n }\n\n const div = document.createElement('div')\n const dt = label.closest('dt')\n const dd = input.closest('dd')\n\n // #region clear button\n if (input.nodeName !== 'SELECT' && type !== 'range') {\n const clearBtn = document.createElement('button')\n clearBtn.type = 'button'\n clearBtn.title = input.getAttribute('data-clear-field-text') || 'Clear field'\n clearBtn.ariaLabel = input.getAttribute('data-clear-field-text') || 'Clear field'\n clearBtn.tabIndex = -1\n clearBtn.innerHTML = '<svg viewBox=\"0 0 16 16\" width=\"18\" height=\"18\"><path d=\"M 1 1 L 15 15 M 1 15 L 15 1\" fill=\"none\" stroke-width=\"2\" stroke=\"currentColor\" />'\n clearBtn.classList.add('clear')\n clearBtn.id = `semanticFormsClearButton_${input.id}`\n clearBtn.addEventListener('click', (event) => {\n input.previousValue = input.value\n input.value = ''\n input.focus()\n lastClearFieldPressed = input.id\n })\n insertAfter(clearBtn, dd.querySelector('label'))\n }\n input.addEventListener('focus', (event) => {\n if (event.target.nodeName === 'INPUT') lastFocusedInput = event.target\n })\n // #endregion\n\n // check for colspan- utility class\n if (/colspan-/.test(dd.className)) {\n const match = dd.className.match(/colspan-([0-9]|full)/)[0]\n dd.classList.remove(match)\n div.classList.add(match)\n }\n\n div.append(dt, dd)\n dl.append(div)\n\n // determine visibility of newly created <div>\n if (dt.style.display === 'none' && dd.style.display === 'none') div.style.display = 'none'\n }\n\n // handle file input clear btn, cannot be handled with CSS\n if (type === 'file') {\n const clearBtn = input.parentElement.querySelector('.clear')\n input.addEventListener('input', e => {\n clearBtn.style.display = e.target.files.length ? 'flex' : 'none'\n })\n clearBtn.addEventListener('click', () => {\n clearBtn.style.display = 'none'\n })\n }\n\n // #region show password button\n if (type === 'password' && input.getAttribute('data-no-reveal') === null) {\n const showBtn = document.createElement('button')\n showBtn.type = 'button'\n showBtn.title = input.getAttribute('data-show-password-text') || 'Show password'\n showBtn.ariaLabel = input.getAttribute('data-show-password-text') || 'Show password'\n showBtn.tabIndex = -1\n showBtn.innerHTML = passwordShow\n showBtn.classList.add('show')\n showBtn.id = `semanticFormsShowButton_${input.id}`\n const dd = input.closest('dd')\n showBtn.addEventListener('click', (event) => {\n if (input.type === 'password') {\n showBtn.innerHTML = passwordHide\n showBtn.title = input.getAttribute('data-hide-password-text') || 'Hide password'\n showBtn.ariaLabel = input.getAttribute('data-hide-password-text') || 'Hide password'\n input.type = 'text'\n } else {\n showBtn.innerHTML = passwordShow\n showBtn.title = input.getAttribute('data-show-password-text') || 'Show password'\n showBtn.ariaLabel = input.getAttribute('data-show-password-text') || 'Show password'\n input.type = 'password'\n }\n input.focus()\n })\n insertAfter(showBtn, dd.querySelector('label'))\n }\n // #endregion\n\n // add listener to shift clear button when scrollbar present\n for (const textarea of document.querySelectorAll('textarea')) {\n // shifts the close button to the right if a scrollbar is present\n const shiftCloseBtn = () => {\n const clearBtn = textarea.parentElement?.querySelector('button.clear')\n if (clearBtn) {\n clearBtn.style.marginRight = textarea.clientHeight < textarea.scrollHeight ? '15px' : ''\n }\n }\n\n textarea.addEventListener('input', shiftCloseBtn)\n textarea.addEventListener('mouseup', shiftCloseBtn)\n }\n }\n }\n }\n\n /**\n * Places an element immediately after another element\n * @param {Object} newNode element being placed after the reference node\n * @param {*} referenceNode element to be used as reference for new node\n */\n function insertAfter (newNode, referenceNode) {\n if (referenceNode.nextSibling) referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling)\n else referenceNode.parentNode.appendChild(newNode)\n }\n\n // handle undo/redo\n let lastFocusedInput\n let lastClearFieldPressed\n document.addEventListener('keydown', (event) => {\n if ((event.ctrlKey || event.metaKey) && event.key === 'z' && !event.shiftKey) {\n // undo clearing a field\n if (lastFocusedInput) {\n if (lastFocusedInput?.parentNode?.querySelector('button.clear').id === `semanticFormsClearButton_${lastClearFieldPressed}` || lastFocusedInput?.parentNode?.querySelector('button.clear').name === `semanticFormsClearButton_${lastClearFieldPressed}`) {\n if (lastFocusedInput.previousValue) {\n lastFocusedInput.redoValue = lastFocusedInput.value\n lastFocusedInput.value = lastFocusedInput.previousValue\n }\n }\n }\n } else if ((event.ctrlKey && event.key === 'y') || (event.metaKey && event.shiftKey && event.key === 'z')) {\n // redo clearing a field\n if (lastFocusedInput) {\n if (lastFocusedInput?.parentNode?.querySelector('button.clear').id === `semanticFormsClearButton_${lastClearFieldPressed}` || lastFocusedInput?.parentNode?.querySelector('button.clear').name === `semanticFormsClearButton_${lastClearFieldPressed}`) {\n if (lastFocusedInput.redoValue) {\n lastFocusedInput.previousValue = lastFocusedInput.value\n lastFocusedInput.value = lastFocusedInput.redoValue\n }\n }\n }\n }\n })\n\n // monitor changes to the DOM and enhance new semanticForms forms that get added\n if (!window.semanticFormsObserver) {\n window.semanticFormsObserver = new window.MutationObserver((mutations) => {\n let stop = false\n for (const mutation of mutations) {\n for (const node of mutation.addedNodes) {\n if (node.nodeName === 'FORM') {\n window.semanticForms()\n stop = true\n }\n }\n if (stop) break\n }\n })\n window.semanticFormsObserver.observe(document.body, { attributes: false, childList: true, characterData: false, subtree: true })\n }\n\n window.semanticForms.reinitialize = (form) => {\n form.classList.remove('semanticFormsActive')\n window.semanticForms()\n }\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(90);\n"],"names":["root","factory","exports","module","define","amd","this","document","getElementsByClassName","querySelector","body","classList","window","MutationObserver","passwordShow","nodeNameLookup","inputTypeLookup","forms","querySelectorAll","form","add","contains","inputs","Array","from","input","id","type","getAttribute","includes","nodeName","dl","parentNode","label","replace","dd","firstChild","newLabel","createElement","className","setAttribute","insertAfter","innerHTML","text","append","parentElement","remove","div","closest","hasAttribute","dt","clearBtn","title","ariaLabel","tabIndex","addEventListener","event","previousValue","value","focus","lastClearFieldPressed","target","lastFocusedInput","test","match","style","display","e","files","length","showBtn","textarea","shiftCloseBtn","marginRight","clientHeight","scrollHeight","newNode","referenceNode","nextSibling","insertBefore","appendChild","ctrlKey","metaKey","key","shiftKey","name","redoValue","semanticFormsObserver","mutations","stop","mutation","node","addedNodes","semanticForms","observe","attributes","childList","characterData","subtree","reinitialize","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__"],"sourceRoot":""}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var e={90:e=>{e.exports=()=>{if("function"!=typeof document.getElementsByClassName||"function"!=typeof document.querySelector||!document.body.classList||!window.MutationObserver)return;const e='<svg fill="none" height="256" viewBox="0 0 24 24" width="256" xmlns="http://www.w3.org/2000/svg"><g stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="m1 12s4-8 11-8 11 8 11 8"/><path d="m1 12s4 8 11 8 11-8 11-8"/><circle cx="12" cy="12" r="3"/></g></svg>',t=["TEXTAREA","SELECT"],r=["checkbox","color","date","datetime-local","email","file","image","month","number","password","radio","range","search","tel","text","time","url","week"],a=document.querySelectorAll("form.semanticForms:not(.semanticFormsActive)");for(const i of a){if(i.classList.add("semanticFormsActive"),i.classList.contains("lowFlow"))continue;const a=Array.from(i.querySelectorAll("input, textarea, select"));for(const i of a){if(i.classList.contains("semanticform")||!i.id)continue;const a=i.getAttribute("type");if(t.includes(i.nodeName)||r.includes(a)){let t=i.parentNode;for(;t&&"DL"!==t.nodeName;)t=t.parentNode;if(!t)continue;t.classList.contains("floatLabelForm")||t.classList.add("floatLabelForm");const r=!i.parentNode.parentNode.id||"checkbox"!==a&&"radio"!==a?document.querySelector("label[for="+i.id.replace(/\./g,"\\.")+"]"):document.querySelector("label[data-for="+i.parentNode.parentNode.id.replace(/\./g,"\\.")+"]");if(i.classList.add("semanticform"),"checkbox"===a||"radio"===a){let e=i.parentNode;for(;e&&"DD"!==e.nodeName;)e=e.parentNode;if("LABEL"!==e.firstChild.nodeName){const t=document.createElement("label");if(t.className="floatLabelFormAnimatedLabel","checkbox"===a&&"DD"===i.parentNode.nodeName&&(t.setAttribute("for",i.id),i.parentNode.classList.add("singleCheckbox"),t.className="",r.setAttribute("hidden","hidden"),o(t,i)),t.innerHTML=r.innerHTML,e.querySelector(":required")&&null===r.getAttribute("data-no-asterisk")&&!r.querySelector("span")){const e=r.getAttribute("data-asterisk-text")||"This field is required.";r.innerHTML+=`<span title="${e}">*</span>`}e.querySelector("label")||e.append(t)}"DIV"===e.parentElement.nodeName&&e.parentElement.remove();const n=document.createElement("div");n.append(r.closest("dt"),e),t.append(n)}else{const e=document.createElement("label");if(e.setAttribute("for",i.id),e.className="floatLabelFormAnimatedLabel",e.innerHTML=r.innerHTML,i.hasAttribute("required")&&null===r.getAttribute("data-no-asterisk")&&!r.querySelector("span")){const t=r.getAttribute("data-asterisk-text")||"This field is required.";e.innerHTML+=` <span title="${t}">*</span>`}r.setAttribute("hidden","hidden"),o(e,i)}if("checkbox"!==a&&"radio"!==a){i.getAttribute("placeholder")||i.setAttribute("placeholder"," ");const e=document.createElement("div"),l=r.closest("dt"),d=i.closest("dd");if("SELECT"!==i.nodeName&&"range"!==a){const e=document.createElement("button");e.type="button",e.title=i.getAttribute("data-clear-field-text")||"Clear field",e.ariaLabel=i.getAttribute("data-clear-field-text")||"Clear field",e.tabIndex=-1,e.innerHTML='<svg viewBox="0 0 16 16" width="18" height="18"><path d="M 1 1 L 15 15 M 1 15 L 15 1" fill="none" stroke-width="2" stroke="currentColor" />',e.classList.add("clear"),e.id=`semanticFormsClearButton_${i.id}`,e.addEventListener("click",(e=>{i.previousValue=i.value,i.value="",i.focus(),s=i.id})),o(e,d.querySelector("label"))}if(i.addEventListener("focus",(e=>{"INPUT"===e.target.nodeName&&(n=e.target)})),/colspan-/.test(d.className)){const t=d.className.match(/colspan-([0-9]|full)/)[0];d.classList.remove(t),e.classList.add(t)}e.append(l,d),t.append(e),"none"===l.style.display&&"none"===d.style.display&&(e.style.display="none")}if("file"===a){const e=i.parentElement.querySelector(".clear");i.addEventListener("input",(t=>{e.style.display=t.target.files.length?"flex":"none"})),e.addEventListener("click",(()=>{e.style.display="none"}))}if("password"===a&&null===i.getAttribute("data-no-reveal")){const t=document.createElement("button");t.type="button",t.title=i.getAttribute("data-show-password-text")||"Show password",t.ariaLabel=i.getAttribute("data-show-password-text")||"Show password",t.tabIndex=-1,t.innerHTML=e,t.classList.add("show"),t.id=`semanticFormsShowButton_${i.id}`;const r=i.closest("dd");t.addEventListener("click",(r=>{"password"===i.type?(t.innerHTML='<svg fill="none" height="256" viewBox="0 0 24 24" width="256" xmlns="http://www.w3.org/2000/svg"><g stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="m2 2 20 20"/><path d="m6.71277 6.7226c-3.04798 2.07267-4.71277 5.2774-4.71277 5.2774s3.63636 7 10 7c2.0503 0 3.8174-.7266 5.2711-1.7116m-6.2711-12.23018c.3254-.03809.6588-.05822 1-.05822 6.3636 0 10 7 10 7s-.6918 1.3317-2 2.8335"/><path d="m14 14.2362c-.5308.475-1.2316.7639-2 .7639-1.6569 0-3-1.3431-3-3 0-.8237.33193-1.5698.86932-2.11192"/></g></svg>',t.title=i.getAttribute("data-hide-password-text")||"Hide password",t.ariaLabel=i.getAttribute("data-hide-password-text")||"Hide password",i.type="text"):(t.innerHTML=e,t.title=i.getAttribute("data-show-password-text")||"Show password",t.ariaLabel=i.getAttribute("data-show-password-text")||"Show password",i.type="password"),i.focus()})),o(t,r.querySelector("label"))}for(const e of document.querySelectorAll("textarea")){const t=()=>{const t=e.parentElement?.querySelector("button.clear");t&&(t.style.marginRight=e.clientHeight<e.scrollHeight?"15px":"")};e.addEventListener("input",t),e.addEventListener("mouseup",t)}}}}function o(e,t){t.nextSibling?t.parentNode.insertBefore(e,t.nextSibling):t.parentNode.appendChild(e)}let n,s;document.addEventListener("keydown",(e=>{!e.ctrlKey&&!e.metaKey||"z"!==e.key||e.shiftKey?(e.ctrlKey&&"y"===e.key||e.metaKey&&e.shiftKey&&"z"===e.key)&&n&&(n?.parentNode?.querySelector("button.clear").id!==`semanticFormsClearButton_${s}`&&n?.parentNode?.querySelector("button.clear").name!==`semanticFormsClearButton_${s}`||n.redoValue&&(n.previousValue=n.value,n.value=n.redoValue)):n&&(n?.parentNode?.querySelector("button.clear").id!==`semanticFormsClearButton_${s}`&&n?.parentNode?.querySelector("button.clear").name!==`semanticFormsClearButton_${s}`||n.previousValue&&(n.redoValue=n.value,n.value=n.previousValue))})),window.semanticFormsObserver||(window.semanticFormsObserver=new window.MutationObserver((e=>{let t=!1;for(const r of e){for(const e of r.addedNodes)"FORM"===e.nodeName&&(window.semanticForms(),t=!0);if(t)break}})),window.semanticFormsObserver.observe(document.body,{attributes:!1,childList:!0,characterData:!1,subtree:!0})),window.semanticForms.reinitialize=e=>{e.classList.remove("semanticFormsActive"),window.semanticForms()}}}},t={};(function r(a){var o=t[a];if(void 0!==o)return o.exports;var n=t[a]={exports:{}};return e[a](n,n.exports,r),n.exports})(90);
|
|
2
|
+
//# sourceMappingURL=semantic-forms.min.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"semantic-forms.min.mjs","mappings":"cAAAA,EAAOC,QAAU,KAEf,GAA+C,mBAApCC,SAASC,wBAA2E,mBAA3BD,SAASE,gBAAiCF,SAASG,KAAKC,YAAcC,OAAOC,iBAAkB,OAEnK,MAAMC,EAAe,8SAGfC,EAAiB,CAAC,WAAY,UAC9BC,EAAkB,CAAC,WAAY,QAAS,OAAQ,iBAAkB,QAAS,OAAQ,QAAS,QAAS,SAAU,WAAY,QAAS,QAAS,SAAU,MAAO,OAAQ,OAAQ,MAAO,QAGrLC,EAAQV,SAASW,iBAAiB,gDAExC,IAAK,MAAMC,KAAQF,EAAO,CAExB,GADAE,EAAKR,UAAUS,IAAI,uBACfD,EAAKR,UAAUU,SAAS,WAAY,SAGxC,MAAMC,EAASC,MAAMC,KAAKL,EAAKD,iBAAiB,4BAChD,IAAK,MAAMO,KAASH,EAAQ,CAE1B,GAAIG,EAAMd,UAAUU,SAAS,kBAAoBI,EAAMC,GA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F,EAAW,CAChC,IAAK,MAAMG,KAAQD,EAASE,WACJ,SAAlBD,EAAK7D,WACPlB,OAAOiF,gBACPJ,GAAO,GAGX,GAAIA,EAAM,KACZ,KAEF7E,OAAO2E,sBAAsBO,QAAQvF,SAASG,KAAM,CAAEqF,YAAY,EAAOC,WAAW,EAAMC,eAAe,EAAOC,SAAS,KAG3HtF,OAAOiF,cAAcM,aAAgBhF,IACnCA,EAAKR,UAAUmC,OAAO,uBACtBlC,OAAOiF,eAAc,CACvB,C,GC1PEO,EAA2B,CAAC,GAGhC,SAASC,EAAoBC,GAE5B,IAAIC,EAAeH,EAAyBE,GAC5C,QAAqBE,IAAjBD,EACH,OAAOA,EAAajG,QAGrB,IAAID,EAAS+F,EAAyBE,GAAY,CAGjDhG,QAAS,CAAC,GAOX,OAHAmG,EAAoBH,GAAUjG,EAAQA,EAAOC,QAAS+F,GAG/ChG,EAAOC,OACf,ECnB0B+F,CAAoB","sources":["webpack://semantic-forms/./semanticForms.js","webpack://semantic-forms/webpack/bootstrap","webpack://semantic-forms/webpack/startup"],"sourcesContent":["module.exports = () => {\n // do some feature detection so none of the JS executes if the browser is too old\n if (typeof document.getElementsByClassName !== 'function' || typeof document.querySelector !== 'function' || !document.body.classList || !window.MutationObserver) return\n\n const passwordShow = '<svg fill=\"none\" height=\"256\" viewBox=\"0 0 24 24\" width=\"256\" xmlns=\"http://www.w3.org/2000/svg\"><g stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\"><path d=\"m1 12s4-8 11-8 11 8 11 8\"/><path d=\"m1 12s4 8 11 8 11-8 11-8\"/><circle cx=\"12\" cy=\"12\" r=\"3\"/></g></svg>'\n const passwordHide = '<svg fill=\"none\" height=\"256\" viewBox=\"0 0 24 24\" width=\"256\" xmlns=\"http://www.w3.org/2000/svg\"><g stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\"><path d=\"m2 2 20 20\"/><path d=\"m6.71277 6.7226c-3.04798 2.07267-4.71277 5.2774-4.71277 5.2774s3.63636 7 10 7c2.0503 0 3.8174-.7266 5.2711-1.7116m-6.2711-12.23018c.3254-.03809.6588-.05822 1-.05822 6.3636 0 10 7 10 7s-.6918 1.3317-2 2.8335\"/><path d=\"m14 14.2362c-.5308.475-1.2316.7639-2 .7639-1.6569 0-3-1.3431-3-3 0-.8237.33193-1.5698.86932-2.11192\"/></g></svg>'\n\n const nodeNameLookup = ['TEXTAREA', 'SELECT']\n const inputTypeLookup = ['checkbox', 'color', 'date', 'datetime-local', 'email', 'file', 'image', 'month', 'number', 'password', 'radio', 'range', 'search', 'tel', 'text', 'time', 'url', 'week']\n\n // progressively enhance form elements that have the semanticForms class\n const forms = document.querySelectorAll('form.semanticForms:not(.semanticFormsActive)')\n\n for (const form of forms) {\n form.classList.add('semanticFormsActive')\n if (form.classList.contains('lowFlow')) continue\n\n // update each input in the semantic form\n const inputs = Array.from(form.querySelectorAll('input, textarea, select'))\n for (const input of inputs) {\n // ignore input if it has previously been formatted\n if (input.classList.contains('semanticform') || !input.id) continue\n\n const type = input.getAttribute('type')\n if (nodeNameLookup.includes(input.nodeName) || inputTypeLookup.includes(type)) {\n // recursively find <dl> element\n let dl = input.parentNode\n while (dl && dl.nodeName !== 'DL') dl = dl.parentNode\n\n if (!dl) continue\n if (!dl.classList.contains('floatLabelForm')) dl.classList.add('floatLabelForm')\n\n const label = input.parentNode.parentNode.id && (type === 'checkbox' || type === 'radio')\n ? document.querySelector('label[data-for=' + input.parentNode.parentNode.id.replace(/\\./g, '\\\\.') + ']')\n : document.querySelector('label[for=' + input.id.replace(/\\./g, '\\\\.') + ']')\n\n input.classList.add('semanticform')\n\n // #region create labels\n if (type === 'checkbox' || type === 'radio') {\n // recursively find <dd> element\n let dd = input.parentNode\n while (dd && dd.nodeName !== 'DD') dd = dd.parentNode\n\n if (dd.firstChild.nodeName !== 'LABEL') {\n const newLabel = document.createElement('label')\n newLabel.className = 'floatLabelFormAnimatedLabel'\n\n if (type === 'checkbox' && input.parentNode.nodeName === 'DD') {\n newLabel.setAttribute('for', input.id)\n input.parentNode.classList.add('singleCheckbox')\n newLabel.className = ''\n label.setAttribute('hidden', 'hidden')\n insertAfter(newLabel, input)\n }\n\n newLabel.innerHTML = label.innerHTML\n\n if (dd.querySelector(':required') && label.getAttribute('data-no-asterisk') === null && !label.querySelector('span')) {\n const text = label.getAttribute('data-asterisk-text') || 'This field is required.'\n label.innerHTML += `<span title=\"${text}\">*</span>`\n }\n\n if (!dd.querySelector('label')) dd.append(newLabel)\n }\n\n // removes old div that a radio or checkbox may have been added to\n if (dd.parentElement.nodeName === 'DIV') dd.parentElement.remove()\n\n const div = document.createElement('div')\n div.append(label.closest('dt'), dd)\n dl.append(div)\n } else {\n const newLabel = document.createElement('label')\n newLabel.setAttribute('for', input.id)\n newLabel.className = 'floatLabelFormAnimatedLabel'\n\n newLabel.innerHTML = label.innerHTML\n\n if (input.hasAttribute('required') && label.getAttribute('data-no-asterisk') === null && !label.querySelector('span')) {\n const text = label.getAttribute('data-asterisk-text') || 'This field is required.'\n newLabel.innerHTML += ` <span title=\"${text}\">*</span>`\n }\n\n label.setAttribute('hidden', 'hidden')\n\n insertAfter(newLabel, input)\n }\n // #endregion\n\n // standard inputs\n if (type !== 'checkbox' && type !== 'radio') {\n if (!input.getAttribute('placeholder')) {\n input.setAttribute('placeholder', ' ')\n }\n\n const div = document.createElement('div')\n const dt = label.closest('dt')\n const dd = input.closest('dd')\n\n // #region clear button\n if (input.nodeName !== 'SELECT' && type !== 'range') {\n const clearBtn = document.createElement('button')\n clearBtn.type = 'button'\n clearBtn.title = input.getAttribute('data-clear-field-text') || 'Clear field'\n clearBtn.ariaLabel = input.getAttribute('data-clear-field-text') || 'Clear field'\n clearBtn.tabIndex = -1\n clearBtn.innerHTML = '<svg viewBox=\"0 0 16 16\" width=\"18\" height=\"18\"><path d=\"M 1 1 L 15 15 M 1 15 L 15 1\" fill=\"none\" stroke-width=\"2\" stroke=\"currentColor\" />'\n clearBtn.classList.add('clear')\n clearBtn.id = `semanticFormsClearButton_${input.id}`\n clearBtn.addEventListener('click', (event) => {\n input.previousValue = input.value\n input.value = ''\n input.focus()\n lastClearFieldPressed = input.id\n })\n insertAfter(clearBtn, dd.querySelector('label'))\n }\n input.addEventListener('focus', (event) => {\n if (event.target.nodeName === 'INPUT') lastFocusedInput = event.target\n })\n // #endregion\n\n // check for colspan- utility class\n if (/colspan-/.test(dd.className)) {\n const match = dd.className.match(/colspan-([0-9]|full)/)[0]\n dd.classList.remove(match)\n div.classList.add(match)\n }\n\n div.append(dt, dd)\n dl.append(div)\n\n // determine visibility of newly created <div>\n if (dt.style.display === 'none' && dd.style.display === 'none') div.style.display = 'none'\n }\n\n // handle file input clear btn, cannot be handled with CSS\n if (type === 'file') {\n const clearBtn = input.parentElement.querySelector('.clear')\n input.addEventListener('input', e => {\n clearBtn.style.display = e.target.files.length ? 'flex' : 'none'\n })\n clearBtn.addEventListener('click', () => {\n clearBtn.style.display = 'none'\n })\n }\n\n // #region show password button\n if (type === 'password' && input.getAttribute('data-no-reveal') === null) {\n const showBtn = document.createElement('button')\n showBtn.type = 'button'\n showBtn.title = input.getAttribute('data-show-password-text') || 'Show password'\n showBtn.ariaLabel = input.getAttribute('data-show-password-text') || 'Show password'\n showBtn.tabIndex = -1\n showBtn.innerHTML = passwordShow\n showBtn.classList.add('show')\n showBtn.id = `semanticFormsShowButton_${input.id}`\n const dd = input.closest('dd')\n showBtn.addEventListener('click', (event) => {\n if (input.type === 'password') {\n showBtn.innerHTML = passwordHide\n showBtn.title = input.getAttribute('data-hide-password-text') || 'Hide password'\n showBtn.ariaLabel = input.getAttribute('data-hide-password-text') || 'Hide password'\n input.type = 'text'\n } else {\n showBtn.innerHTML = passwordShow\n showBtn.title = input.getAttribute('data-show-password-text') || 'Show password'\n showBtn.ariaLabel = input.getAttribute('data-show-password-text') || 'Show password'\n input.type = 'password'\n }\n input.focus()\n })\n insertAfter(showBtn, dd.querySelector('label'))\n }\n // #endregion\n\n // add listener to shift clear button when scrollbar present\n for (const textarea of document.querySelectorAll('textarea')) {\n // shifts the close button to the right if a scrollbar is present\n const shiftCloseBtn = () => {\n const clearBtn = textarea.parentElement?.querySelector('button.clear')\n if (clearBtn) {\n clearBtn.style.marginRight = textarea.clientHeight < textarea.scrollHeight ? '15px' : ''\n }\n }\n\n textarea.addEventListener('input', shiftCloseBtn)\n textarea.addEventListener('mouseup', shiftCloseBtn)\n }\n }\n }\n }\n\n /**\n * Places an element immediately after another element\n * @param {Object} newNode element being placed after the reference node\n * @param {*} referenceNode element to be used as reference for new node\n */\n function insertAfter (newNode, referenceNode) {\n if (referenceNode.nextSibling) referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling)\n else referenceNode.parentNode.appendChild(newNode)\n }\n\n // handle undo/redo\n let lastFocusedInput\n let lastClearFieldPressed\n document.addEventListener('keydown', (event) => {\n if ((event.ctrlKey || event.metaKey) && event.key === 'z' && !event.shiftKey) {\n // undo clearing a field\n if (lastFocusedInput) {\n if (lastFocusedInput?.parentNode?.querySelector('button.clear').id === `semanticFormsClearButton_${lastClearFieldPressed}` || lastFocusedInput?.parentNode?.querySelector('button.clear').name === `semanticFormsClearButton_${lastClearFieldPressed}`) {\n if (lastFocusedInput.previousValue) {\n lastFocusedInput.redoValue = lastFocusedInput.value\n lastFocusedInput.value = lastFocusedInput.previousValue\n }\n }\n }\n } else if ((event.ctrlKey && event.key === 'y') || (event.metaKey && event.shiftKey && event.key === 'z')) {\n // redo clearing a field\n if (lastFocusedInput) {\n if (lastFocusedInput?.parentNode?.querySelector('button.clear').id === `semanticFormsClearButton_${lastClearFieldPressed}` || lastFocusedInput?.parentNode?.querySelector('button.clear').name === `semanticFormsClearButton_${lastClearFieldPressed}`) {\n if (lastFocusedInput.redoValue) {\n lastFocusedInput.previousValue = lastFocusedInput.value\n lastFocusedInput.value = lastFocusedInput.redoValue\n }\n }\n }\n }\n })\n\n // monitor changes to the DOM and enhance new semanticForms forms that get added\n if (!window.semanticFormsObserver) {\n window.semanticFormsObserver = new window.MutationObserver((mutations) => {\n let stop = false\n for (const mutation of mutations) {\n for (const node of mutation.addedNodes) {\n if (node.nodeName === 'FORM') {\n window.semanticForms()\n stop = true\n }\n }\n if (stop) break\n }\n })\n window.semanticFormsObserver.observe(document.body, { attributes: false, childList: true, characterData: false, subtree: true })\n }\n\n window.semanticForms.reinitialize = (form) => {\n form.classList.remove('semanticFormsActive')\n window.semanticForms()\n }\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(90);\n"],"names":["module","exports","document","getElementsByClassName","querySelector","body","classList","window","MutationObserver","passwordShow","nodeNameLookup","inputTypeLookup","forms","querySelectorAll","form","add","contains","inputs","Array","from","input","id","type","getAttribute","includes","nodeName","dl","parentNode","label","replace","dd","firstChild","newLabel","createElement","className","setAttribute","insertAfter","innerHTML","text","append","parentElement","remove","div","closest","hasAttribute","dt","clearBtn","title","ariaLabel","tabIndex","addEventListener","event","previousValue","value","focus","lastClearFieldPressed","target","lastFocusedInput","test","match","style","display","e","files","length","showBtn","textarea","shiftCloseBtn","marginRight","clientHeight","scrollHeight","newNode","referenceNode","nextSibling","insertBefore","appendChild","ctrlKey","metaKey","key","shiftKey","name","redoValue","semanticFormsObserver","mutations","stop","mutation","node","addedNodes","semanticForms","observe","attributes","childList","characterData","subtree","reinitialize","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__"],"sourceRoot":""}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/******/var __webpack_modules__={
|
|
2
|
+
/***/"./semanticForms.js":
|
|
3
|
+
/*!**************************!*\
|
|
4
|
+
!*** ./semanticForms.js ***!
|
|
5
|
+
\**************************/
|
|
6
|
+
/***/module=>{module.exports=()=>{
|
|
7
|
+
// do some feature detection so none of the JS executes if the browser is too old
|
|
8
|
+
if(typeof document.getElementsByClassName!=="function"||typeof document.querySelector!=="function"||!document.body.classList||!window.MutationObserver)return;const passwordShow='<svg fill="none" height="256" viewBox="0 0 24 24" width="256" xmlns="http://www.w3.org/2000/svg"><g stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="m1 12s4-8 11-8 11 8 11 8"/><path d="m1 12s4 8 11 8 11-8 11-8"/><circle cx="12" cy="12" r="3"/></g></svg>';const passwordHide='<svg fill="none" height="256" viewBox="0 0 24 24" width="256" xmlns="http://www.w3.org/2000/svg"><g stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="m2 2 20 20"/><path d="m6.71277 6.7226c-3.04798 2.07267-4.71277 5.2774-4.71277 5.2774s3.63636 7 10 7c2.0503 0 3.8174-.7266 5.2711-1.7116m-6.2711-12.23018c.3254-.03809.6588-.05822 1-.05822 6.3636 0 10 7 10 7s-.6918 1.3317-2 2.8335"/><path d="m14 14.2362c-.5308.475-1.2316.7639-2 .7639-1.6569 0-3-1.3431-3-3 0-.8237.33193-1.5698.86932-2.11192"/></g></svg>';const nodeNameLookup=["TEXTAREA","SELECT"];const inputTypeLookup=["checkbox","color","date","datetime-local","email","file","image","month","number","password","radio","range","search","tel","text","time","url","week"];
|
|
9
|
+
// progressively enhance form elements that have the semanticForms class
|
|
10
|
+
const forms=document.querySelectorAll("form.semanticForms:not(.semanticFormsActive)");for(const form of forms){form.classList.add("semanticFormsActive");if(form.classList.contains("lowFlow"))continue;
|
|
11
|
+
// update each input in the semantic form
|
|
12
|
+
const inputs=Array.from(form.querySelectorAll("input, textarea, select"));for(const input of inputs){
|
|
13
|
+
// ignore input if it has previously been formatted
|
|
14
|
+
if(input.classList.contains("semanticform")||!input.id)continue;const type=input.getAttribute("type");if(nodeNameLookup.includes(input.nodeName)||inputTypeLookup.includes(type)){
|
|
15
|
+
// recursively find <dl> element
|
|
16
|
+
let dl=input.parentNode;while(dl&&dl.nodeName!=="DL")dl=dl.parentNode;if(!dl)continue;if(!dl.classList.contains("floatLabelForm"))dl.classList.add("floatLabelForm");const label=input.parentNode.parentNode.id&&(type==="checkbox"||type==="radio")?document.querySelector("label[data-for="+input.parentNode.parentNode.id.replace(/\./g,"\\.")+"]"):document.querySelector("label[for="+input.id.replace(/\./g,"\\.")+"]");input.classList.add("semanticform");
|
|
17
|
+
// #region create labels
|
|
18
|
+
if(type==="checkbox"||type==="radio"){
|
|
19
|
+
// recursively find <dd> element
|
|
20
|
+
let dd=input.parentNode;while(dd&&dd.nodeName!=="DD")dd=dd.parentNode;if(dd.firstChild.nodeName!=="LABEL"){const newLabel=document.createElement("label");newLabel.className="floatLabelFormAnimatedLabel";if(type==="checkbox"&&input.parentNode.nodeName==="DD"){newLabel.setAttribute("for",input.id);input.parentNode.classList.add("singleCheckbox");newLabel.className="";label.setAttribute("hidden","hidden");insertAfter(newLabel,input)}newLabel.innerHTML=label.innerHTML;if(dd.querySelector(":required")&&label.getAttribute("data-no-asterisk")===null&&!label.querySelector("span")){const text=label.getAttribute("data-asterisk-text")||"This field is required.";label.innerHTML+=`<span title="${text}">*</span>`}if(!dd.querySelector("label"))dd.append(newLabel)}
|
|
21
|
+
// removes old div that a radio or checkbox may have been added to
|
|
22
|
+
if(dd.parentElement.nodeName==="DIV")dd.parentElement.remove();const div=document.createElement("div");div.append(label.closest("dt"),dd);dl.append(div)}else{const newLabel=document.createElement("label");newLabel.setAttribute("for",input.id);newLabel.className="floatLabelFormAnimatedLabel";newLabel.innerHTML=label.innerHTML;if(input.hasAttribute("required")&&label.getAttribute("data-no-asterisk")===null&&!label.querySelector("span")){const text=label.getAttribute("data-asterisk-text")||"This field is required.";newLabel.innerHTML+=` <span title="${text}">*</span>`}label.setAttribute("hidden","hidden");insertAfter(newLabel,input)}
|
|
23
|
+
// #endregion
|
|
24
|
+
// standard inputs
|
|
25
|
+
if(type!=="checkbox"&&type!=="radio"){if(!input.getAttribute("placeholder"))input.setAttribute("placeholder"," ");const div=document.createElement("div");const dt=label.closest("dt");const dd=input.closest("dd");
|
|
26
|
+
// #region clear button
|
|
27
|
+
if(input.nodeName!=="SELECT"&&type!=="range"){const clearBtn=document.createElement("button");clearBtn.type="button";clearBtn.title=input.getAttribute("data-clear-field-text")||"Clear field";clearBtn.ariaLabel=input.getAttribute("data-clear-field-text")||"Clear field";clearBtn.tabIndex=-1;clearBtn.innerHTML='<svg viewBox="0 0 16 16" width="18" height="18"><path d="M 1 1 L 15 15 M 1 15 L 15 1" fill="none" stroke-width="2" stroke="currentColor" />';clearBtn.classList.add("clear");clearBtn.id=`semanticFormsClearButton_${input.id}`;clearBtn.addEventListener("click",(event=>{input.previousValue=input.value;input.value="";input.focus();lastClearFieldPressed=input.id}));insertAfter(clearBtn,dd.querySelector("label"))}input.addEventListener("focus",(event=>{if(event.target.nodeName==="INPUT")lastFocusedInput=event.target}));
|
|
28
|
+
// #endregion
|
|
29
|
+
// check for colspan- utility class
|
|
30
|
+
if(/colspan-/.test(dd.className)){const match=dd.className.match(/colspan-([0-9]|full)/)[0];dd.classList.remove(match);div.classList.add(match)}div.append(dt,dd);dl.append(div);
|
|
31
|
+
// determine visibility of newly created <div>
|
|
32
|
+
if(dt.style.display==="none"&&dd.style.display==="none")div.style.display="none"}
|
|
33
|
+
// handle file input clear btn, cannot be handled with CSS
|
|
34
|
+
if(type==="file"){const clearBtn=input.parentElement.querySelector(".clear");input.addEventListener("input",(e=>{clearBtn.style.display=e.target.files.length?"flex":"none"}));clearBtn.addEventListener("click",(()=>{clearBtn.style.display="none"}))}
|
|
35
|
+
// #region show password button
|
|
36
|
+
if(type==="password"&&input.getAttribute("data-no-reveal")===null){const showBtn=document.createElement("button");showBtn.type="button";showBtn.title=input.getAttribute("data-show-password-text")||"Show password";showBtn.ariaLabel=input.getAttribute("data-show-password-text")||"Show password";showBtn.tabIndex=-1;showBtn.innerHTML=passwordShow;showBtn.classList.add("show");showBtn.id=`semanticFormsShowButton_${input.id}`;const dd=input.closest("dd");showBtn.addEventListener("click",(event=>{if(input.type==="password"){showBtn.innerHTML=passwordHide;showBtn.title=input.getAttribute("data-hide-password-text")||"Hide password";showBtn.ariaLabel=input.getAttribute("data-hide-password-text")||"Hide password";input.type="text"}else{showBtn.innerHTML=passwordShow;showBtn.title=input.getAttribute("data-show-password-text")||"Show password";showBtn.ariaLabel=input.getAttribute("data-show-password-text")||"Show password";input.type="password"}input.focus()}));insertAfter(showBtn,dd.querySelector("label"))}
|
|
37
|
+
// #endregion
|
|
38
|
+
// add listener to shift clear button when scrollbar present
|
|
39
|
+
for(const textarea of document.querySelectorAll("textarea")){
|
|
40
|
+
// shifts the close button to the right if a scrollbar is present
|
|
41
|
+
const shiftCloseBtn=()=>{const clearBtn=textarea.parentElement?.querySelector("button.clear");if(clearBtn)clearBtn.style.marginRight=textarea.clientHeight<textarea.scrollHeight?"15px":""};textarea.addEventListener("input",shiftCloseBtn);textarea.addEventListener("mouseup",shiftCloseBtn)}}}}
|
|
42
|
+
/**
|
|
43
|
+
* Places an element immediately after another element
|
|
44
|
+
* @param {Object} newNode element being placed after the reference node
|
|
45
|
+
* @param {*} referenceNode element to be used as reference for new node
|
|
46
|
+
*/function insertAfter(newNode,referenceNode){if(referenceNode.nextSibling)referenceNode.parentNode.insertBefore(newNode,referenceNode.nextSibling);else referenceNode.parentNode.appendChild(newNode)}
|
|
47
|
+
// handle undo/redo
|
|
48
|
+
let lastFocusedInput;let lastClearFieldPressed;document.addEventListener("keydown",(event=>{if((event.ctrlKey||event.metaKey)&&event.key==="z"&&!event.shiftKey){
|
|
49
|
+
// undo clearing a field
|
|
50
|
+
if(lastFocusedInput)if(lastFocusedInput?.parentNode?.querySelector("button.clear").id===`semanticFormsClearButton_${lastClearFieldPressed}`||lastFocusedInput?.parentNode?.querySelector("button.clear").name===`semanticFormsClearButton_${lastClearFieldPressed}`)if(lastFocusedInput.previousValue){lastFocusedInput.redoValue=lastFocusedInput.value;lastFocusedInput.value=lastFocusedInput.previousValue}}else if(event.ctrlKey&&event.key==="y"||event.metaKey&&event.shiftKey&&event.key==="z")
|
|
51
|
+
// redo clearing a field
|
|
52
|
+
if(lastFocusedInput)if(lastFocusedInput?.parentNode?.querySelector("button.clear").id===`semanticFormsClearButton_${lastClearFieldPressed}`||lastFocusedInput?.parentNode?.querySelector("button.clear").name===`semanticFormsClearButton_${lastClearFieldPressed}`)if(lastFocusedInput.redoValue){lastFocusedInput.previousValue=lastFocusedInput.value;lastFocusedInput.value=lastFocusedInput.redoValue}}));
|
|
53
|
+
// monitor changes to the DOM and enhance new semanticForms forms that get added
|
|
54
|
+
if(!window.semanticFormsObserver){window.semanticFormsObserver=new window.MutationObserver((mutations=>{let stop=false;for(const mutation of mutations){for(const node of mutation.addedNodes)if(node.nodeName==="FORM"){window.semanticForms();stop=true}if(stop)break}}));window.semanticFormsObserver.observe(document.body,{attributes:false,childList:true,characterData:false,subtree:true})}window.semanticForms.reinitialize=form=>{form.classList.remove("semanticFormsActive");window.semanticForms()}}
|
|
55
|
+
/***/
|
|
56
|
+
/******/}};
|
|
57
|
+
/************************************************************************/
|
|
58
|
+
/******/ // The module cache
|
|
59
|
+
/******/var __webpack_module_cache__={};
|
|
60
|
+
/******/
|
|
61
|
+
/******/ // The require function
|
|
62
|
+
/******/function __webpack_require__(moduleId){
|
|
63
|
+
/******/ // Check if module is in cache
|
|
64
|
+
/******/var cachedModule=__webpack_module_cache__[moduleId];
|
|
65
|
+
/******/if(cachedModule!==void 0)
|
|
66
|
+
/******/return cachedModule.exports;
|
|
67
|
+
/******/
|
|
68
|
+
/******/ // Create a new module (and put it into the cache)
|
|
69
|
+
/******/var module=__webpack_module_cache__[moduleId]={
|
|
70
|
+
/******/ // no module.id needed
|
|
71
|
+
/******/ // no module.loaded needed
|
|
72
|
+
/******/exports:{}
|
|
73
|
+
/******/};
|
|
74
|
+
/******/
|
|
75
|
+
/******/ // Execute the module function
|
|
76
|
+
/******/__webpack_modules__[moduleId](module,module.exports,__webpack_require__);
|
|
77
|
+
/******/
|
|
78
|
+
/******/ // Return the exports of the module
|
|
79
|
+
/******/return module.exports;
|
|
80
|
+
/******/}
|
|
81
|
+
/******/
|
|
82
|
+
/************************************************************************/
|
|
83
|
+
/******/
|
|
84
|
+
/******/ // startup
|
|
85
|
+
/******/ // Load entry module and return exports
|
|
86
|
+
/******/ // This entry module is referenced by other modules so it can't be inlined
|
|
87
|
+
/******/__webpack_require__("./semanticForms.js");
|
|
88
|
+
/******/
|
|
89
|
+
//# sourceMappingURL=semantic-forms.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"semantic-forms.mjs","mappings":";;;;;cAAAA,OAAOC,QAAU;;AAEf,UAAWC,SAASC,yBAA2B,mBAAqBD,SAASE,gBAAkB,aAAeF,SAASG,KAAKC,YAAcC,OAAOC,iBAAkB,OAEnK,MAAMC,aAAe,8SACrB,MAAMC,aAAe,siBAErB,MAAMC,eAAiB,CAAC,WAAY,UACpC,MAAMC,gBAAkB,CAAC,WAAY,QAAS,OAAQ,iBAAkB,QAAS,OAAQ,QAAS,QAAS,SAAU,WAAY,QAAS,QAAS,SAAU,MAAO,OAAQ,OAAQ,MAAO;wEAG3L;MAAMC,MAAQX,SAASY,iBAAiB,gDAExC,IAAK,MAAMC,QAAQF,MAAO,CACxBE,KAAKT,UAAUU,IAAI,uBACnB,GAAID,KAAKT,UAAUW,SAAS,WAAY;yCAGxC;MAAMC,OAASC,MAAMC,KAAKL,KAAKD,iBAAiB,4BAChD,IAAK,M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B,YAAYxB,cAAc,gBAAgB6E,OAAS,4BAA4BzB,wBAC7N,GAAIE,iBAAiBwB,UAAW,CAC9BxB,iBAAiBL,cAAgBK,iBAAiBJ,MAClDI,iBAAiBJ,MAAQI,iBAAiBwB,SAC5C,CAGN;gFAIF;IAAK3E,OAAO4E,sBAAuB,CACjC5E,OAAO4E,sBAAwB,IAAI5E,OAAOC,kBAAkB4E,YAC1D,IAAIC,KAAO,MACX,IAAK,MAAMC,YAAYF,UAAW,CAChC,IAAK,MAAMG,QAAQD,SAASE,WAC1B,GAAID,KAAK7D,WAAa,OAAQ,CAC5BnB,OAAOkF,gBACPJ,KAAO,IACT,CAEF,GAAIA,KAAM,KACZ,KAEF9E,OAAO4E,sBAAsBO,QAAQxF,SAASG,KAAM,CAAEsF,WAAY,MAAOC,UAAW,KAAMC,cAAe,MAAOC,QAAS,MAC3H,CAEAvF,OAAOkF,cAAcM,aAAgBhF,OACnCA,KAAKT,UAAUoC,OAAO,uBACtBnC,OAAOkF,eAAc,CACvB;;;;;QC1PF,IAAIO,yBAA2B,CAAC;;;QAGhC,SAASC,oBAAoBC;;QAE5B,IAAIC,aAAeH,yBAAyBE;QAC5C,GAAIC,oBAAiBC;QACpB,OAAOD,aAAalG;;;QAGrB,IAAID,OAASgG,yBAAyBE,UAAY;;;QAGjDjG,QAAS,CAAC;;;;QAIXoG,oBAAoBH,UAAUlG,OAAQA,OAAOC,QAASgG;;;QAGtD,OAAOjG,OAAOC;QACf;;;;;;;QCnB0BgG,oBAAoB","sources":["webpack://semantic-forms/./semanticForms.js","webpack://semantic-forms/webpack/bootstrap","webpack://semantic-forms/webpack/startup"],"sourcesContent":["module.exports = () => {\n // do some feature detection so none of the JS executes if the browser is too old\n if (typeof document.getElementsByClassName !== 'function' || typeof document.querySelector !== 'function' || !document.body.classList || !window.MutationObserver) return\n\n const passwordShow = '<svg fill=\"none\" height=\"256\" viewBox=\"0 0 24 24\" width=\"256\" xmlns=\"http://www.w3.org/2000/svg\"><g stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\"><path d=\"m1 12s4-8 11-8 11 8 11 8\"/><path d=\"m1 12s4 8 11 8 11-8 11-8\"/><circle cx=\"12\" cy=\"12\" r=\"3\"/></g></svg>'\n const passwordHide = '<svg fill=\"none\" height=\"256\" viewBox=\"0 0 24 24\" width=\"256\" xmlns=\"http://www.w3.org/2000/svg\"><g stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\"><path d=\"m2 2 20 20\"/><path d=\"m6.71277 6.7226c-3.04798 2.07267-4.71277 5.2774-4.71277 5.2774s3.63636 7 10 7c2.0503 0 3.8174-.7266 5.2711-1.7116m-6.2711-12.23018c.3254-.03809.6588-.05822 1-.05822 6.3636 0 10 7 10 7s-.6918 1.3317-2 2.8335\"/><path d=\"m14 14.2362c-.5308.475-1.2316.7639-2 .7639-1.6569 0-3-1.3431-3-3 0-.8237.33193-1.5698.86932-2.11192\"/></g></svg>'\n\n const nodeNameLookup = ['TEXTAREA', 'SELECT']\n const inputTypeLookup = ['checkbox', 'color', 'date', 'datetime-local', 'email', 'file', 'image', 'month', 'number', 'password', 'radio', 'range', 'search', 'tel', 'text', 'time', 'url', 'week']\n\n // progressively enhance form elements that have the semanticForms class\n const forms = document.querySelectorAll('form.semanticForms:not(.semanticFormsActive)')\n\n for (const form of forms) {\n form.classList.add('semanticFormsActive')\n if (form.classList.contains('lowFlow')) continue\n\n // update each input in the semantic form\n const inputs = Array.from(form.querySelectorAll('input, textarea, select'))\n for (const input of inputs) {\n // ignore input if it has previously been formatted\n if (input.classList.contains('semanticform') || !input.id) continue\n\n const type = input.getAttribute('type')\n if (nodeNameLookup.includes(input.nodeName) || inputTypeLookup.includes(type)) {\n // recursively find <dl> element\n let dl = input.parentNode\n while (dl && dl.nodeName !== 'DL') dl = dl.parentNode\n\n if (!dl) continue\n if (!dl.classList.contains('floatLabelForm')) dl.classList.add('floatLabelForm')\n\n const label = input.parentNode.parentNode.id && (type === 'checkbox' || type === 'radio')\n ? document.querySelector('label[data-for=' + input.parentNode.parentNode.id.replace(/\\./g, '\\\\.') + ']')\n : document.querySelector('label[for=' + input.id.replace(/\\./g, '\\\\.') + ']')\n\n input.classList.add('semanticform')\n\n // #region create labels\n if (type === 'checkbox' || type === 'radio') {\n // recursively find <dd> element\n let dd = input.parentNode\n while (dd && dd.nodeName !== 'DD') dd = dd.parentNode\n\n if (dd.firstChild.nodeName !== 'LABEL') {\n const newLabel = document.createElement('label')\n newLabel.className = 'floatLabelFormAnimatedLabel'\n\n if (type === 'checkbox' && input.parentNode.nodeName === 'DD') {\n newLabel.setAttribute('for', input.id)\n input.parentNode.classList.add('singleCheckbox')\n newLabel.className = ''\n label.setAttribute('hidden', 'hidden')\n insertAfter(newLabel, input)\n }\n\n newLabel.innerHTML = label.innerHTML\n\n if (dd.querySelector(':required') && label.getAttribute('data-no-asterisk') === null && !label.querySelector('span')) {\n const text = label.getAttribute('data-asterisk-text') || 'This field is required.'\n label.innerHTML += `<span title=\"${text}\">*</span>`\n }\n\n if (!dd.querySelector('label')) dd.append(newLabel)\n }\n\n // removes old div that a radio or checkbox may have been added to\n if (dd.parentElement.nodeName === 'DIV') dd.parentElement.remove()\n\n const div = document.createElement('div')\n div.append(label.closest('dt'), dd)\n dl.append(div)\n } else {\n const newLabel = document.createElement('label')\n newLabel.setAttribute('for', input.id)\n newLabel.className = 'floatLabelFormAnimatedLabel'\n\n newLabel.innerHTML = label.innerHTML\n\n if (input.hasAttribute('required') && label.getAttribute('data-no-asterisk') === null && !label.querySelector('span')) {\n const text = label.getAttribute('data-asterisk-text') || 'This field is required.'\n newLabel.innerHTML += ` <span title=\"${text}\">*</span>`\n }\n\n label.setAttribute('hidden', 'hidden')\n\n insertAfter(newLabel, input)\n }\n // #endregion\n\n // standard inputs\n if (type !== 'checkbox' && type !== 'radio') {\n if (!input.getAttribute('placeholder')) {\n input.setAttribute('placeholder', ' ')\n }\n\n const div = document.createElement('div')\n const dt = label.closest('dt')\n const dd = input.closest('dd')\n\n // #region clear button\n if (input.nodeName !== 'SELECT' && type !== 'range') {\n const clearBtn = document.createElement('button')\n clearBtn.type = 'button'\n clearBtn.title = input.getAttribute('data-clear-field-text') || 'Clear field'\n clearBtn.ariaLabel = input.getAttribute('data-clear-field-text') || 'Clear field'\n clearBtn.tabIndex = -1\n clearBtn.innerHTML = '<svg viewBox=\"0 0 16 16\" width=\"18\" height=\"18\"><path d=\"M 1 1 L 15 15 M 1 15 L 15 1\" fill=\"none\" stroke-width=\"2\" stroke=\"currentColor\" />'\n clearBtn.classList.add('clear')\n clearBtn.id = `semanticFormsClearButton_${input.id}`\n clearBtn.addEventListener('click', (event) => {\n input.previousValue = input.value\n input.value = ''\n input.focus()\n lastClearFieldPressed = input.id\n })\n insertAfter(clearBtn, dd.querySelector('label'))\n }\n input.addEventListener('focus', (event) => {\n if (event.target.nodeName === 'INPUT') lastFocusedInput = event.target\n })\n // #endregion\n\n // check for colspan- utility class\n if (/colspan-/.test(dd.className)) {\n const match = dd.className.match(/colspan-([0-9]|full)/)[0]\n dd.classList.remove(match)\n div.classList.add(match)\n }\n\n div.append(dt, dd)\n dl.append(div)\n\n // determine visibility of newly created <div>\n if (dt.style.display === 'none' && dd.style.display === 'none') div.style.display = 'none'\n }\n\n // handle file input clear btn, cannot be handled with CSS\n if (type === 'file') {\n const clearBtn = input.parentElement.querySelector('.clear')\n input.addEventListener('input', e => {\n clearBtn.style.display = e.target.files.length ? 'flex' : 'none'\n })\n clearBtn.addEventListener('click', () => {\n clearBtn.style.display = 'none'\n })\n }\n\n // #region show password button\n if (type === 'password' && input.getAttribute('data-no-reveal') === null) {\n const showBtn = document.createElement('button')\n showBtn.type = 'button'\n showBtn.title = input.getAttribute('data-show-password-text') || 'Show password'\n showBtn.ariaLabel = input.getAttribute('data-show-password-text') || 'Show password'\n showBtn.tabIndex = -1\n showBtn.innerHTML = passwordShow\n showBtn.classList.add('show')\n showBtn.id = `semanticFormsShowButton_${input.id}`\n const dd = input.closest('dd')\n showBtn.addEventListener('click', (event) => {\n if (input.type === 'password') {\n showBtn.innerHTML = passwordHide\n showBtn.title = input.getAttribute('data-hide-password-text') || 'Hide password'\n showBtn.ariaLabel = input.getAttribute('data-hide-password-text') || 'Hide password'\n input.type = 'text'\n } else {\n showBtn.innerHTML = passwordShow\n showBtn.title = input.getAttribute('data-show-password-text') || 'Show password'\n showBtn.ariaLabel = input.getAttribute('data-show-password-text') || 'Show password'\n input.type = 'password'\n }\n input.focus()\n })\n insertAfter(showBtn, dd.querySelector('label'))\n }\n // #endregion\n\n // add listener to shift clear button when scrollbar present\n for (const textarea of document.querySelectorAll('textarea')) {\n // shifts the close button to the right if a scrollbar is present\n const shiftCloseBtn = () => {\n const clearBtn = textarea.parentElement?.querySelector('button.clear')\n if (clearBtn) {\n clearBtn.style.marginRight = textarea.clientHeight < textarea.scrollHeight ? '15px' : ''\n }\n }\n\n textarea.addEventListener('input', shiftCloseBtn)\n textarea.addEventListener('mouseup', shiftCloseBtn)\n }\n }\n }\n }\n\n /**\n * Places an element immediately after another element\n * @param {Object} newNode element being placed after the reference node\n * @param {*} referenceNode element to be used as reference for new node\n */\n function insertAfter (newNode, referenceNode) {\n if (referenceNode.nextSibling) referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling)\n else referenceNode.parentNode.appendChild(newNode)\n }\n\n // handle undo/redo\n let lastFocusedInput\n let lastClearFieldPressed\n document.addEventListener('keydown', (event) => {\n if ((event.ctrlKey || event.metaKey) && event.key === 'z' && !event.shiftKey) {\n // undo clearing a field\n if (lastFocusedInput) {\n if (lastFocusedInput?.parentNode?.querySelector('button.clear').id === `semanticFormsClearButton_${lastClearFieldPressed}` || lastFocusedInput?.parentNode?.querySelector('button.clear').name === `semanticFormsClearButton_${lastClearFieldPressed}`) {\n if (lastFocusedInput.previousValue) {\n lastFocusedInput.redoValue = lastFocusedInput.value\n lastFocusedInput.value = lastFocusedInput.previousValue\n }\n }\n }\n } else if ((event.ctrlKey && event.key === 'y') || (event.metaKey && event.shiftKey && event.key === 'z')) {\n // redo clearing a field\n if (lastFocusedInput) {\n if (lastFocusedInput?.parentNode?.querySelector('button.clear').id === `semanticFormsClearButton_${lastClearFieldPressed}` || lastFocusedInput?.parentNode?.querySelector('button.clear').name === `semanticFormsClearButton_${lastClearFieldPressed}`) {\n if (lastFocusedInput.redoValue) {\n lastFocusedInput.previousValue = lastFocusedInput.value\n lastFocusedInput.value = lastFocusedInput.redoValue\n }\n }\n }\n }\n })\n\n // monitor changes to the DOM and enhance new semanticForms forms that get added\n if (!window.semanticFormsObserver) {\n window.semanticFormsObserver = new window.MutationObserver((mutations) => {\n let stop = false\n for (const mutation of mutations) {\n for (const node of mutation.addedNodes) {\n if (node.nodeName === 'FORM') {\n window.semanticForms()\n stop = true\n }\n }\n if (stop) break\n }\n })\n window.semanticFormsObserver.observe(document.body, { attributes: false, childList: true, characterData: false, subtree: true })\n }\n\n window.semanticForms.reinitialize = (form) => {\n form.classList.remove('semanticFormsActive')\n window.semanticForms()\n }\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(\"./semanticForms.js\");\n"],"names":["module","exports","document","getElementsByClassName","querySelector","body","classList","window","MutationObserver","passwordShow","passwordHide","nodeNameLookup","inputTypeLookup","forms","querySelectorAll","form","add","contains","inputs","Array","from","input","id","type","getAttribute","includes","nodeName","dl","parentNode","label","replace","dd","firstChild","newLabel","createElement","className","setAttribute","insertAfter","innerHTML","text","append","parentElement","remove","div","closest","hasAttribute","dt","clearBtn","title","ariaLabel","tabIndex","addEventListener","event","previousValue","value","focus","lastClearFieldPressed","target","lastFocusedInput","test","match","style","display","e","files","length","showBtn","textarea","shiftCloseBtn","marginRight","clientHeight","scrollHeight","newNode","referenceNode","nextSibling","insertBefore","appendChild","ctrlKey","metaKey","key","shiftKey","name","redoValue","semanticFormsObserver","mutations","stop","mutation","node","addedNodes","semanticForms","observe","attributes","childList","characterData","subtree","reinitialize","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__"],"sourceRoot":""}
|
package/package.json
CHANGED
|
@@ -8,10 +8,9 @@
|
|
|
8
8
|
"url": "https://github.com/rooseveltframework/semantic-forms/graphs/contributors"
|
|
9
9
|
}
|
|
10
10
|
],
|
|
11
|
-
"version": "
|
|
11
|
+
"version": "5.0.0",
|
|
12
12
|
"files": [
|
|
13
|
-
"
|
|
14
|
-
"semanticForms.js",
|
|
13
|
+
"dist",
|
|
15
14
|
"semanticForms.scss"
|
|
16
15
|
],
|
|
17
16
|
"homepage": "https://github.com/rooseveltframework/semantic-forms",
|
|
@@ -19,23 +18,33 @@
|
|
|
19
18
|
"main": "semanticForms.js",
|
|
20
19
|
"readmeFilename": "README.md",
|
|
21
20
|
"devDependencies": {
|
|
22
|
-
"
|
|
21
|
+
"@jsdevtools/coverage-istanbul-loader": "3.0.5",
|
|
22
|
+
"@playwright/test": "1.50.1",
|
|
23
|
+
"eslint": "9.21.0",
|
|
23
24
|
"eslint-plugin-html": "8.1.2",
|
|
25
|
+
"express": "4.21.2",
|
|
24
26
|
"nodemon": "3.1.9",
|
|
25
|
-
"
|
|
27
|
+
"nyc": "17.1.0",
|
|
28
|
+
"sass": "1.85.1",
|
|
26
29
|
"serve": "14.2.4",
|
|
27
|
-
"standard": "17.1.2"
|
|
30
|
+
"standard": "17.1.2",
|
|
31
|
+
"webpack-cli": "6.0.1"
|
|
28
32
|
},
|
|
29
33
|
"scripts": {
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"lint": "standard && standard --plugin html *.html",
|
|
33
|
-
"lint-fix": "standard --fix && standard --plugin html *.html --fix",
|
|
34
|
+
"build": "webpack && sass semanticForms.scss dist/semantic-forms.css",
|
|
35
|
+
"watch": "webpack && sass --watch semanticForms.scss dist/semantic-forms.css",
|
|
34
36
|
"d": "nodemon --exec \"npm run build && serve\"",
|
|
35
37
|
"dev": "nodemon --exec \"npm run build && serve\"",
|
|
36
38
|
"development": "nodemon --exec \"npm run build && serve\"",
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
+
"lint": "standard && standard --plugin html test/*.html",
|
|
40
|
+
"lint-fix": "standard --fix && standard --plugin html test/*.html --fix",
|
|
41
|
+
"test": "npm run build && playwright test",
|
|
42
|
+
"coverage": "npm run build && nyc playwright test"
|
|
43
|
+
},
|
|
44
|
+
"standard": {
|
|
45
|
+
"ignore": [
|
|
46
|
+
"dist/"
|
|
47
|
+
]
|
|
39
48
|
},
|
|
40
49
|
"repository": {
|
|
41
50
|
"type": "git",
|
package/semanticForms.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
module.exports = () => {
|
|
2
2
|
// do some feature detection so none of the JS executes if the browser is too old
|
|
3
3
|
if (typeof document.getElementsByClassName !== 'function' || typeof document.querySelector !== 'function' || !document.body.classList || !window.MutationObserver) return
|
|
4
4
|
|
|
5
|
+
const passwordShow = '<svg fill="none" height="256" viewBox="0 0 24 24" width="256" xmlns="http://www.w3.org/2000/svg"><g stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="m1 12s4-8 11-8 11 8 11 8"/><path d="m1 12s4 8 11 8 11-8 11-8"/><circle cx="12" cy="12" r="3"/></g></svg>'
|
|
6
|
+
const passwordHide = '<svg fill="none" height="256" viewBox="0 0 24 24" width="256" xmlns="http://www.w3.org/2000/svg"><g stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="m2 2 20 20"/><path d="m6.71277 6.7226c-3.04798 2.07267-4.71277 5.2774-4.71277 5.2774s3.63636 7 10 7c2.0503 0 3.8174-.7266 5.2711-1.7116m-6.2711-12.23018c.3254-.03809.6588-.05822 1-.05822 6.3636 0 10 7 10 7s-.6918 1.3317-2 2.8335"/><path d="m14 14.2362c-.5308.475-1.2316.7639-2 .7639-1.6569 0-3-1.3431-3-3 0-.8237.33193-1.5698.86932-2.11192"/></g></svg>'
|
|
7
|
+
|
|
5
8
|
const nodeNameLookup = ['TEXTAREA', 'SELECT']
|
|
6
9
|
const inputTypeLookup = ['checkbox', 'color', 'date', 'datetime-local', 'email', 'file', 'image', 'month', 'number', 'password', 'radio', 'range', 'search', 'tel', 'text', 'time', 'url', 'week']
|
|
7
10
|
|
|
@@ -99,16 +102,23 @@ window.semanticForms = () => {
|
|
|
99
102
|
if (input.nodeName !== 'SELECT' && type !== 'range') {
|
|
100
103
|
const clearBtn = document.createElement('button')
|
|
101
104
|
clearBtn.type = 'button'
|
|
102
|
-
clearBtn.
|
|
105
|
+
clearBtn.title = input.getAttribute('data-clear-field-text') || 'Clear field'
|
|
106
|
+
clearBtn.ariaLabel = input.getAttribute('data-clear-field-text') || 'Clear field'
|
|
103
107
|
clearBtn.tabIndex = -1
|
|
104
108
|
clearBtn.innerHTML = '<svg viewBox="0 0 16 16" width="18" height="18"><path d="M 1 1 L 15 15 M 1 15 L 15 1" fill="none" stroke-width="2" stroke="currentColor" />'
|
|
105
109
|
clearBtn.classList.add('clear')
|
|
106
|
-
clearBtn.
|
|
110
|
+
clearBtn.id = `semanticFormsClearButton_${input.id}`
|
|
111
|
+
clearBtn.addEventListener('click', (event) => {
|
|
112
|
+
input.previousValue = input.value
|
|
107
113
|
input.value = ''
|
|
108
114
|
input.focus()
|
|
115
|
+
lastClearFieldPressed = input.id
|
|
109
116
|
})
|
|
110
117
|
insertAfter(clearBtn, dd.querySelector('label'))
|
|
111
118
|
}
|
|
119
|
+
input.addEventListener('focus', (event) => {
|
|
120
|
+
if (event.target.nodeName === 'INPUT') lastFocusedInput = event.target
|
|
121
|
+
})
|
|
112
122
|
// #endregion
|
|
113
123
|
|
|
114
124
|
// check for colspan- utility class
|
|
@@ -136,6 +146,35 @@ window.semanticForms = () => {
|
|
|
136
146
|
})
|
|
137
147
|
}
|
|
138
148
|
|
|
149
|
+
// #region show password button
|
|
150
|
+
if (type === 'password' && input.getAttribute('data-no-reveal') === null) {
|
|
151
|
+
const showBtn = document.createElement('button')
|
|
152
|
+
showBtn.type = 'button'
|
|
153
|
+
showBtn.title = input.getAttribute('data-show-password-text') || 'Show password'
|
|
154
|
+
showBtn.ariaLabel = input.getAttribute('data-show-password-text') || 'Show password'
|
|
155
|
+
showBtn.tabIndex = -1
|
|
156
|
+
showBtn.innerHTML = passwordShow
|
|
157
|
+
showBtn.classList.add('show')
|
|
158
|
+
showBtn.id = `semanticFormsShowButton_${input.id}`
|
|
159
|
+
const dd = input.closest('dd')
|
|
160
|
+
showBtn.addEventListener('click', (event) => {
|
|
161
|
+
if (input.type === 'password') {
|
|
162
|
+
showBtn.innerHTML = passwordHide
|
|
163
|
+
showBtn.title = input.getAttribute('data-hide-password-text') || 'Hide password'
|
|
164
|
+
showBtn.ariaLabel = input.getAttribute('data-hide-password-text') || 'Hide password'
|
|
165
|
+
input.type = 'text'
|
|
166
|
+
} else {
|
|
167
|
+
showBtn.innerHTML = passwordShow
|
|
168
|
+
showBtn.title = input.getAttribute('data-show-password-text') || 'Show password'
|
|
169
|
+
showBtn.ariaLabel = input.getAttribute('data-show-password-text') || 'Show password'
|
|
170
|
+
input.type = 'password'
|
|
171
|
+
}
|
|
172
|
+
input.focus()
|
|
173
|
+
})
|
|
174
|
+
insertAfter(showBtn, dd.querySelector('label'))
|
|
175
|
+
}
|
|
176
|
+
// #endregion
|
|
177
|
+
|
|
139
178
|
// add listener to shift clear button when scrollbar present
|
|
140
179
|
for (const textarea of document.querySelectorAll('textarea')) {
|
|
141
180
|
// shifts the close button to the right if a scrollbar is present
|
|
@@ -163,6 +202,33 @@ window.semanticForms = () => {
|
|
|
163
202
|
else referenceNode.parentNode.appendChild(newNode)
|
|
164
203
|
}
|
|
165
204
|
|
|
205
|
+
// handle undo/redo
|
|
206
|
+
let lastFocusedInput
|
|
207
|
+
let lastClearFieldPressed
|
|
208
|
+
document.addEventListener('keydown', (event) => {
|
|
209
|
+
if ((event.ctrlKey || event.metaKey) && event.key === 'z' && !event.shiftKey) {
|
|
210
|
+
// undo clearing a field
|
|
211
|
+
if (lastFocusedInput) {
|
|
212
|
+
if (lastFocusedInput?.parentNode?.querySelector('button.clear').id === `semanticFormsClearButton_${lastClearFieldPressed}` || lastFocusedInput?.parentNode?.querySelector('button.clear').name === `semanticFormsClearButton_${lastClearFieldPressed}`) {
|
|
213
|
+
if (lastFocusedInput.previousValue) {
|
|
214
|
+
lastFocusedInput.redoValue = lastFocusedInput.value
|
|
215
|
+
lastFocusedInput.value = lastFocusedInput.previousValue
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
} else if ((event.ctrlKey && event.key === 'y') || (event.metaKey && event.shiftKey && event.key === 'z')) {
|
|
220
|
+
// redo clearing a field
|
|
221
|
+
if (lastFocusedInput) {
|
|
222
|
+
if (lastFocusedInput?.parentNode?.querySelector('button.clear').id === `semanticFormsClearButton_${lastClearFieldPressed}` || lastFocusedInput?.parentNode?.querySelector('button.clear').name === `semanticFormsClearButton_${lastClearFieldPressed}`) {
|
|
223
|
+
if (lastFocusedInput.redoValue) {
|
|
224
|
+
lastFocusedInput.previousValue = lastFocusedInput.value
|
|
225
|
+
lastFocusedInput.value = lastFocusedInput.redoValue
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
})
|
|
231
|
+
|
|
166
232
|
// monitor changes to the DOM and enhance new semanticForms forms that get added
|
|
167
233
|
if (!window.semanticFormsObserver) {
|
|
168
234
|
window.semanticFormsObserver = new window.MutationObserver((mutations) => {
|
|
@@ -179,9 +245,9 @@ window.semanticForms = () => {
|
|
|
179
245
|
})
|
|
180
246
|
window.semanticFormsObserver.observe(document.body, { attributes: false, childList: true, characterData: false, subtree: true })
|
|
181
247
|
}
|
|
182
|
-
}
|
|
183
248
|
|
|
184
|
-
window.semanticForms.reinitialize = (form) => {
|
|
185
|
-
|
|
186
|
-
|
|
249
|
+
window.semanticForms.reinitialize = (form) => {
|
|
250
|
+
form.classList.remove('semanticFormsActive')
|
|
251
|
+
window.semanticForms()
|
|
252
|
+
}
|
|
187
253
|
}
|