semantic-forms 5.3.2 → 5.3.3
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/CHANGELOG.md +5 -0
- package/dist/semantic-forms.cjs +9 -10
- package/dist/semantic-forms.cjs.map +1 -1
- package/dist/semantic-forms.css +7 -1
- package/dist/semantic-forms.css.map +1 -1
- package/dist/semantic-forms.js +9 -10
- package/dist/semantic-forms.js.map +1 -1
- package/dist/semantic-forms.min.js +1 -1
- package/dist/semantic-forms.min.js.map +1 -1
- package/dist/semantic-forms.min.mjs +1 -1
- package/dist/semantic-forms.min.mjs.map +1 -1
- package/dist/semantic-forms.mjs +9 -10
- package/dist/semantic-forms.mjs.map +1 -1
- package/package.json +4 -4
- package/semanticForms.scss +8 -1
package/CHANGELOG.md
CHANGED
package/dist/semantic-forms.cjs
CHANGED
|
@@ -24,16 +24,15 @@ const getOS=()=>{const userAgent=window.navigator.userAgent;const platform=windo
|
|
|
24
24
|
// ignore input if it has previously been formatted
|
|
25
25
|
if(input.classList.contains("semanticform")||!input.id)return;const type=input.getAttribute("type");if(!lookups.nodeName.includes(input.nodeName)&&!lookups.inputType.includes(type))return;
|
|
26
26
|
// recursively find <dl> element
|
|
27
|
-
let dl=input.parentNode;while(dl&&dl.nodeName!=="DL")dl=dl.parentNode;if(!dl)return;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,"\\.")+"]");if(!label)console.error(`semantic-forms: Found an input (${input.id||input.getAttribute("name")}) without a properly associated label. Make sure there is a label for it and the label has a matching "for" attribute.`);input.classList.add("semanticform");
|
|
27
|
+
let dl=input.parentNode;while(dl&&dl.nodeName!=="DL")dl=dl.parentNode;if(!dl)return;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,"\\.")+"]");if(!label)console.error(`semantic-forms: Found an input (${input.id||input.getAttribute("name")}) without a properly associated label. Make sure there is a label for it and the label has a matching "for" attribute.`);input.classList.add("semanticform");const isWrapped=input.closest("dd").parentElement.nodeName==="DIV";
|
|
28
28
|
// #region create labels
|
|
29
|
-
const newLabel=document.createElement("label");newLabel.className="floatLabelFormAnimatedLabel";if(type==="checkbox"||type==="radio"){
|
|
30
|
-
//
|
|
31
|
-
|
|
32
|
-
//
|
|
33
|
-
if(
|
|
29
|
+
const newLabel=document.createElement("label");newLabel.className="floatLabelFormAnimatedLabel";if(type==="checkbox"||type==="radio"){const div=isWrapped?input.closest("dd").parentElement:document.createElement("div");const dt=label.closest("dt");const dd=input.closest("dd");if(!dt||!dd){console.error(`semantic-forms: Found an input (${input.id||input.getAttribute("name")}) that is not inside a <dd> element.`);return}if(dd.firstChild.nodeName!=="LABEL"){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)}if(type==="radio"&&input.parentNode.nodeName==="DD"){newLabel.setAttribute("for",input.id);input.parentNode.classList.add("singleRadio");newLabel.className="";label.setAttribute("hidden","hidden");insertAfter(newLabel,input)}newLabel.innerHTML=label.innerHTML;if(label.hasAttribute("title")&&label.getAttribute("data-show-help-icon")!==null&&!label.querySelector("span.help")){const text=label.getAttribute("title");label.innerHTML+=` <span title="${text}" class="help">${icons.helpIcon}</span>`;newLabel.innerHTML+=` <span title="${text}" class="help">${icons.helpIcon}</span>`}if(dd.querySelector(":required")&&label.getAttribute("data-no-asterisk")===null&&!label.querySelector("span.required")){const text=label.getAttribute("data-asterisk-text")||"This field is required.";label.innerHTML+=` <span title="${text}" class="required">*</span>`;newLabel.innerHTML+=` <span title="${text}" class="required">*</span>`}if(!dd.querySelector("label"))dd.append(newLabel)}
|
|
30
|
+
// if the user did not wrap the input in a div, do it for them
|
|
31
|
+
if(!isWrapped){div.append(dt,dd);
|
|
32
|
+
// determine visibility of newly created <div>
|
|
33
|
+
if(dt.style.display==="none"&&dd.style.display==="none")div.style.display="none"}dl.append(div)}else{newLabel.setAttribute("for",input.id);newLabel.innerHTML=label.innerHTML;if(input.hasAttribute("title")&&label.getAttribute("data-show-help-icon")!==null&&!label.querySelector("span.help")){const text=input.getAttribute("title");newLabel.innerHTML+=` <span title="${text}" class="help">${icons.helpIcon}</span>`}if(input.hasAttribute("required")&&label.getAttribute("data-no-asterisk")===null&&!label.querySelector("span.required")){const text=label.getAttribute("data-asterisk-text")||"This field is required.";newLabel.innerHTML+=` <span title="${text}" class="required">*</span>`}label.setAttribute("hidden","hidden");insertAfter(newLabel,input)}
|
|
34
34
|
// #endregion
|
|
35
35
|
// #region standard inputs
|
|
36
|
-
const isWrapped=input.closest("dd").parentElement.nodeName==="DIV";
|
|
37
36
|
// check for auto-grow attribute on textareas
|
|
38
37
|
if(input.getAttribute("data-auto-grow")!==null){
|
|
39
38
|
// progressively enhance inputs into textareas
|
|
@@ -50,9 +49,9 @@ if(/colspan-/.test(dd.className)){const match=dd.className.match(/colspan-([0-9]
|
|
|
50
49
|
// this may be removed once fully supported in Firefox and Safari: https://caniuse.com/wf-field-sizing
|
|
51
50
|
if(input.getAttribute("data-max-content")!==null)if(!("fieldSizing"in document.createElement("input").style)){const adjustWidth=()=>{const value=input.value!==""?input.value:input.placeholder;const width=value.length*8+40;input.style.width=width+"px";input.style.maxWidth="100%"};adjustWidth();input.addEventListener("input",adjustWidth)}
|
|
52
51
|
// if the user did not wrap the input in a div, do it for them
|
|
53
|
-
if(!isWrapped){div.append(dt,dd);
|
|
52
|
+
if(!isWrapped){div.append(dt,dd);
|
|
54
53
|
// determine visibility of newly created <div>
|
|
55
|
-
if(dt.style.display==="none"&&dd.style.display==="none")div.style.display="none"}}
|
|
54
|
+
if(dt.style.display==="none"&&dd.style.display==="none")div.style.display="none"}dl.append(div)}
|
|
56
55
|
// #endregion
|
|
57
56
|
// handle file input clear btn, cannot be handled with CSS
|
|
58
57
|
if(type==="file"){const clearBtn=input.parentElement.querySelector(".clear");input.addEventListener("input",event=>{clearBtn.style.display=event.target.files.length?"flex":"none"});clearBtn.addEventListener("click",()=>{clearBtn.style.display="none"})}
|
|
@@ -93,7 +92,7 @@ const shiftClearBtn=()=>{const clearBtn=input.parentElement?.querySelector("butt
|
|
|
93
92
|
// handle undo/redo
|
|
94
93
|
if((event.ctrlKey||event.metaKey)&&event.key==="z"&&!event.shiftKey){
|
|
95
94
|
// undo clearing a field
|
|
96
|
-
if(lastFocusedInput)if(lastFocusedInput?.parentNode?.querySelector("button.clear").id===`semanticFormsClearButton_${lastClearFieldPressed}`||lastFocusedInput?.parentNode?.querySelector("button.clear").name===`semanticFormsClearButton_${lastClearFieldPressed}`)if(lastFocusedInput.previousValue){
|
|
95
|
+
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")
|
|
97
96
|
// redo clearing a field
|
|
98
97
|
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}};module.exports={enhanceInput,handleUndoRedo}
|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jB,IAAIwB,yBAA2B,CAAC;;;QAGhC,SAASC,oBAAoBC;;QAE5B,IAAIC,aAAeH,yBAAyBE;QAC5C,GAAIC,oBAAiBC;QACpB,OAAOD,aAAa/L;;;QAGrB,IAAIC,OAAS2L,yBAAyBE,UAAY;;;QAGjD9L,QAAS,CAAC;;;;QAIXiM,oBAAoBH,UAAU7L,OAAQA,OAAOD,QAAS6L;;;QAGtD,OAAO5L,OAAOD;QACf;;;;;;;QCnBA,IAAIkM,oBAAsBL,oBAAoB","sources":["webpack://semanticForms/webpack/universalModuleDefinition","webpack://semanticForms/./lib/helpers.js","webpack://semanticForms/./lib/inputEnhancements.js","webpack://semanticForms/./lib/keyboardShortcuts.js","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 ","/**\n * Uses the navigator to best determine the clients operating system.\n * @returns Operating system string (`mac`, `windows`, `linux`)\n */\nconst getOS = () => {\n const userAgent = window.navigator.userAgent\n const platform = window.navigator.platform\n let os = null\n\n if (platform.includes('Win')) {\n os = 'windows'\n } else if (platform.includes('Mac') || /iPhone|iPad|iPod/.test(userAgent)) {\n os = 'mac'\n } else if (platform.includes('Linux') || /Android/.test(userAgent)) {\n os = 'linux'\n }\n return os\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 */\nconst insertAfter = (newNode, referenceNode) => {\n if (referenceNode.nextSibling) referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling)\n else referenceNode.parentNode.appendChild(newNode)\n}\n\nmodule.exports = { getOS, insertAfter }\n","const { insertAfter } = require('./helpers.js')\n\nconst icons = {\n 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 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 helpIcon: '<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" version=\"1.1\" style=\"overflow:visible;\"><rect width=\"16\" height=\"16\" fill=\"none\"/><path fill=\"currentColor\" d=\"M8,10.5c-0.552,0-1,0.448-1,1c0,0.552,0.448,1,1,1c0.552,0,1-0.448,1-1C9,10.948,8.552,10.5,8,10.5z M8,0 C3.582,0,0,3.582,0,8c0,4.418,3.582,8,8,8s8-3.582,8-8C16,3.582,12.418,0,8,0z M12.243,12.243C11.109,13.376,9.603,14,8,14 s-3.109-0.624-4.243-1.757C2.624,11.109,2,9.603,2,8s0.624-3.109,1.757-4.243C4.891,2.624,6.397,2,8,2s3.109,0.624,4.243,1.757 C13.376,4.891,14,6.397,14,8C14,9.603,13.376,11.109,12.243,12.243z M7.927,3.755c-2.248,0-2.76,1.695-2.802,2.906h1.571 c0.028-0.256,0.101-1.418,1.221-1.418c0.672,0,1.206,0.406,1.206,1.175c0,0.695-0.724,1.155-1.303,1.711 C7.241,8.685,7.168,9.325,7.168,9.824V10c0.146,0,1.615,0,1.615,0V9.824c0-1.256,1.967-1.594,1.967-3.541 C10.75,5.059,9.874,3.755,7.927,3.755z\"/></svg>'\n}\n\nconst lookups = {\n nodeName: ['TEXTAREA', 'SELECT'],\n inputType: ['checkbox', 'color', 'date', 'datetime-local', 'email', 'file', 'image', 'month', 'number', 'password', 'radio', 'range', 'search', 'tel', 'text', 'time', 'url', 'week']\n}\n\nlet lastFocusedInput\nlet lastClearFieldPressed\n\nconst enhanceInput = (input, form) => {\n // ignore input if it has previously been formatted\n if (input.classList.contains('semanticform') || !input.id) return\n\n const type = input.getAttribute('type')\n if (!lookups.nodeName.includes(input.nodeName) && !lookups.inputType.includes(type)) return\n\n // recursively find <dl> element\n let dl = input.parentNode\n while (dl && dl.nodeName !== 'DL') dl = dl.parentNode\n if (!dl) return\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 if (!label) {\n console.error(`semantic-forms: Found an input (${input.id || input.getAttribute('name')}) without a properly associated label. Make sure there is a label for it and the label has a matching \"for\" attribute.`)\n }\n\n input.classList.add('semanticform')\n\n // #region create labels\n\n const newLabel = document.createElement('label')\n newLabel.className = 'floatLabelFormAnimatedLabel'\n\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) {\n console.error(`semantic-forms: Found an input (${input.id || input.getAttribute('name')}) that is not inside a <dd> element.`)\n return\n }\n\n if (dd.firstChild.nodeName !== 'LABEL') {\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 if (type === 'radio' && input.parentNode.nodeName === 'DD') {\n newLabel.setAttribute('for', input.id)\n input.parentNode.classList.add('singleRadio')\n newLabel.className = ''\n label.setAttribute('hidden', 'hidden')\n insertAfter(newLabel, input)\n }\n\n newLabel.innerHTML = label.innerHTML\n\n if (label.hasAttribute('title') && label.getAttribute('data-show-help-icon') !== null && !label.querySelector('span.help')) {\n const text = label.getAttribute('title')\n label.innerHTML += ` <span title=\"${text}\" class=\"help\">${icons.helpIcon}</span>`\n newLabel.innerHTML += ` <span title=\"${text}\" class=\"help\">${icons.helpIcon}</span>`\n }\n\n if (dd.querySelector(':required') && label.getAttribute('data-no-asterisk') === null && !label.querySelector('span.required')) {\n const text = label.getAttribute('data-asterisk-text') || 'This field is required.'\n label.innerHTML += ` <span title=\"${text}\" class=\"required\">*</span>`\n newLabel.innerHTML += ` <span title=\"${text}\" class=\"required\">*</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 newLabel.setAttribute('for', input.id)\n newLabel.innerHTML = label.innerHTML\n\n if (input.hasAttribute('title') && label.getAttribute('data-show-help-icon') !== null && !label.querySelector('span.help')) {\n const text = input.getAttribute('title')\n newLabel.innerHTML += ` <span title=\"${text}\" class=\"help\">${icons.helpIcon}</span>`\n }\n\n if (input.hasAttribute('required') && label.getAttribute('data-no-asterisk') === null && !label.querySelector('span.required')) {\n const text = label.getAttribute('data-asterisk-text') || 'This field is required.'\n newLabel.innerHTML += ` <span title=\"${text}\" class=\"required\">*</span>`\n }\n\n label.setAttribute('hidden', 'hidden')\n\n insertAfter(newLabel, input)\n }\n // #endregion\n\n // #region standard inputs\n\n const isWrapped = input.closest('dd').parentElement.nodeName === 'DIV'\n\n // check for auto-grow attribute on textareas\n if (input.getAttribute('data-auto-grow') !== null) {\n // progressively enhance inputs into textareas\n if (input.nodeName === 'INPUT' && input.type === 'text') {\n const newInput = document.createElement('textarea')\n newInput.id = input.id\n newInput.class = input.class\n newInput.innerText = input.value\n newInput.setAttribute('data-auto-grow', '')\n input.replaceWith(newInput)\n input = newInput\n }\n\n if (input.nodeName === 'TEXTAREA') {\n // when pressing enter while this input is focused, we want to submit\n input.addEventListener('keypress', (e) => {\n if (e.key !== 'Enter' || (e.key === 'Enter' && e.shiftKey)) return\n e.preventDefault()\n form.requestSubmit()\n })\n }\n }\n\n if (type !== 'checkbox' && type !== 'radio') {\n if (!input.getAttribute('placeholder')) input.setAttribute('placeholder', ' ')\n\n const div = isWrapped ? input.closest('dd').parentElement : document.createElement('div')\n const dt = label.closest('dt')\n const dd = input.closest('dd')\n\n if (!dt || !dd) {\n console.error(`semantic-forms: Found an input (${input.id || input.getAttribute('name')}) that does not have a corresponding ${!dt ? '<dt>' : '<dd>'} element.`)\n return\n }\n\n // input 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', () => {\n input.previousValue = input.value\n input.value = ''\n input.focus()\n lastClearFieldPressed = input.id\n\n // used for any other updates required by various inputs\n input.dispatchEvent(new Event('input', { bubbles: true }))\n })\n insertAfter(clearBtn, dd.querySelector('label'))\n }\n\n input.addEventListener('focus', event => {\n if (event.target.nodeName === 'INPUT') lastFocusedInput = event.target\n })\n\n // check for colspan- utility class on dd, and move to div\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 // check for max-content attribute\n // this may be removed once fully supported in Firefox and Safari: https://caniuse.com/wf-field-sizing\n if (input.getAttribute('data-max-content') !== null) {\n if (!('fieldSizing' in document.createElement('input').style)) {\n const adjustWidth = () => {\n const value = input.value !== '' ? input.value : input.placeholder\n const width = value.length * 8 + 40\n input.style.width = width + 'px'\n input.style.maxWidth = '100%'\n }\n adjustWidth()\n input.addEventListener('input', adjustWidth)\n }\n }\n\n // if the user did not wrap the input in a div, do it for them\n if (!isWrapped) {\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 // #endregion\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', event => {\n clearBtn.style.display = event.target.files.length ? 'flex' : 'none'\n })\n clearBtn.addEventListener('click', () => {\n clearBtn.style.display = 'none'\n })\n }\n\n // handle range inputs with a class to display the value\n // TODO: should this be a data attribute instead?\n if (type === 'range' && input.classList.contains('displayValue')) {\n const label = input.parentNode.parentNode.querySelector('dd label')\n label.innerHTML += `<span class=\"seperator\">: </span><output>${input.value}</output>`\n input.addEventListener('input', event => {\n const output = event.target.parentNode.parentNode.querySelector('output')\n output.innerHTML = event.target.value\n })\n }\n\n // 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 = icons.passwordShow\n showBtn.classList.add('show')\n showBtn.id = `semanticFormsShowButton_${input.id}`\n const dd = input.closest('dd')\n if (!dd) {\n console.error(`semantic-forms: Found an input (${input.id || input.getAttribute('name')}) that is not inside a <dd> element.`)\n return\n }\n showBtn.addEventListener('click', () => {\n if (input.type === 'password') {\n showBtn.innerHTML = icons.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 = icons.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\n // add listener to shift clear button when scrollbar present\n if (input.nodeName === 'TEXTAREA') {\n if (input.getAttribute('data-disable-autosize') === null) {\n // add auto-sizing\n input.style.setProperty('resize', 'none')\n input.style.setProperty('min-height', '0')\n input.style.setProperty('max-height', 'none')\n input.style.setProperty('height', 'auto')\n\n const handleInput = () => {\n // reset rows attribute to get accurate scrollHeight\n let maxRows = input.getAttribute('data-max-rows')\n\n if (maxRows) {\n if (isNaN(maxRows) || Number(maxRows) <= 0) {\n console.warn(`An invalid value was passed to the \"data-max-rows\" attribute. This value will be ignored.\\n\\nProvided value: ${input.getAttribute('data-max-rows')}`)\n maxRows = null\n }\n }\n\n const minRows = input.getAttribute('data-max-rows') && Number(input.getAttribute('data-max-rows')) < 5 ? input.getAttribute('data-max-rows') : '5'\n input.setAttribute('rows', minRows)\n\n // get the computed values object reference\n const style = window.getComputedStyle(input)\n\n // force content-box for size accurate line-height calculation, remove scrollbars, lock width (subtract inline padding and inline border widths), and remove inline padding and borders to keep width consistent (for text wrapping accuracy)\n const inlinePadding = parseFloat(style['padding-left']) + parseFloat(style['padding-right'])\n const inlineBorderWidth = parseFloat(style['border-left-width']) + parseFloat(style['border-right-width'])\n input.style.setProperty('overflow', 'hidden', 'important')\n input.style.setProperty('width', (parseFloat(style.width) - inlinePadding - inlineBorderWidth) + 'px')\n input.style.setProperty('box-sizing', 'content-box')\n input.style.setProperty('padding-inline', '0')\n input.style.setProperty('border-width', '0')\n\n // get the base line height, and top / bottom padding\n const blockPadding = parseFloat(style['padding-top']) + parseFloat(style['padding-bottom'])\n const lineHeight = style['line-height'] === 'normal'\n ? parseFloat(style.height) // if line-height is not explicitly set, use the computed height value (ignore padding due to content-box)\n : parseFloat(style['line-height']) // otherwise (line-height is explicitly set), use the computed line-height value\n\n // get the scroll height (rounding to be safe to ensure cross browser consistency)\n const scrollHeight = Math.round(input.scrollHeight)\n\n // undo overflow, width, border-width, box-sizing & inline padding overrides\n input.style.removeProperty('width')\n input.style.removeProperty('box-sizing')\n input.style.removeProperty('padding-inline')\n input.style.removeProperty('border-width')\n input.style.removeProperty('overflow')\n\n // subtract blockPadding from scrollHeight and divide that by our lineHeight to get the row count, round to nearest integer as it will always be within ~.1 of the correct whole number\n const rows = Math.round((scrollHeight - blockPadding) / lineHeight)\n\n // set the calculated rows attribute (limited by rowLimit)\n if (maxRows) {\n input.setAttribute('rows', '' + Math.min(rows, Number(maxRows)))\n } else {\n input.setAttribute('rows', '' + rows)\n }\n }\n\n input.addEventListener('input', handleInput)\n\n // trigger the event to set the initial rows value\n input.dispatchEvent(new Event('input', { bubbles: true }))\n }\n\n // progressively enhance textarea for Firefox and Safari\n // this may be removed once fully supported in Firefox and Safari: https://caniuse.com/wf-field-sizing\n if (input.getAttribute('data-auto-grow') !== null) {\n if (!('fieldSizing' in document.createElement('input').style)) {\n const adjustHeight = () => {\n if (input.value.length) {\n const borderWidth = parseInt(window.getComputedStyle(input).getPropertyValue('border-width'))\n input.style.height = (input.scrollHeight + (borderWidth * 2)) + 'px'\n } else {\n input.style.height = window.getComputedStyle(form).getPropertyValue('--semanticFormsInputHeight')\n }\n }\n\n // set initial height to semantic-forms CSS variable\n input.style.height = window.getComputedStyle(form).getPropertyValue('--semanticFormsInputHeight')\n input.addEventListener('input', adjustHeight)\n }\n }\n\n // shifts the clear button to the right if a scrollbar is present\n const shiftClearBtn = () => {\n const clearBtn = input.parentElement?.querySelector('button.clear')\n if (clearBtn) clearBtn.style.marginRight = input.clientHeight < input.scrollHeight ? '15px' : ''\n }\n input.addEventListener('input', shiftClearBtn)\n input.addEventListener('mouseup', shiftClearBtn)\n shiftClearBtn()\n }\n}\n\nconst handleUndoRedo = (event) => {\n // handle undo/redo\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 console.log('update redo value', lastFocusedInput.value)\n lastFocusedInput.redoValue = lastFocusedInput.value\n lastFocusedInput.value = lastFocusedInput.previousValue\n }\n }\n }\n } else {\n 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\nmodule.exports = { enhanceInput, handleUndoRedo }\n","const { getOS, insertAfter } = require('./helpers.js')\n\nconst specialCharMap = {\n Minus: '-',\n Equal: '=',\n BracketLeft: '[',\n BracketRight: ']',\n Backslash: '\\\\',\n Semicolon: ';',\n Quote: '\\'',\n Comma: ',',\n Period: '.',\n Slash: '/',\n Backquote: '`'\n}\nconst shiftSpecialCharMap = {\n 1: '!',\n 2: '@',\n 3: '#',\n 4: '$',\n 5: '%',\n 6: '^',\n 7: '&',\n 8: '*',\n 9: '(',\n 0: ')',\n Minus: '_',\n Equal: '+',\n BracketLeft: '{',\n BracketRight: '}',\n Backslash: '|',\n Semicolon: ':',\n Quote: '\"',\n Comma: '<',\n Period: '>',\n Slash: '?',\n Backquote: '~'\n}\n\n// handles keyboard shortcut events\nconst shortcutListener = (e, shortcuts) => {\n // search for matching shortcut from cached shortcut configs\n const shortcut = shortcuts.find(shortcut => {\n let matchesKey = false\n if (e.altKey && !e.shiftKey) {\n // mac adjusts the key value if altKey is pressed\n matchesKey = 'Key' + shortcut.key.toUpperCase() === e.code ||\n 'Digit' + shortcut.key.toUpperCase() === e.code ||\n shortcut.key === e.key ||\n specialCharMap[e.code] === shortcut.key\n } else if (e.shiftKey) {\n // check shift special character map\n const code = e.code.replace(/Key|Digit/, '')\n matchesKey = (shiftSpecialCharMap[code] || shiftSpecialCharMap[e.key]) &&\n (shiftSpecialCharMap[code] === shortcut.key || shiftSpecialCharMap[e.key] === shortcut.key)\n } else {\n matchesKey = shortcut.key.toUpperCase() === e.key.toUpperCase()\n }\n if (!matchesKey) return false\n\n let matchesModifier\n if (shortcut.modifier) {\n if (shortcut.modifier === shortcut.defaultModifier) matchesModifier = shortcut.os === 'windows' || shortcut.os === 'linux' ? e.ctrlKey : e.metaKey\n if (shortcut.modifier === 'meta') matchesModifier = e.metaKey\n if (shortcut.modifier === 'alt') matchesModifier = e.altKey\n if (shortcut.modifier === 'ctrl') matchesModifier = e.ctrlKey\n }\n return matchesModifier\n })\n\n if (shortcut) {\n e.preventDefault()\n shortcut.input.focus()\n }\n}\n\nconst createKeyboardShortcut = (input, shortcuts) => {\n const os = getOS()\n // this is the custom keyword for meta on linux/mac, ctrl on windows\n const defaultModifier = 'metactrl'\n\n // get focus key value\n let focusKey = input.getAttribute('data-focus-key')\n if (focusKey.length > 1) {\n console.error(`Provided focus key \"${focusKey}\" is more than one character. Using first character only.`)\n focusKey = focusKey.toString()[0]\n }\n\n // get focus modifier value\n let modifierSymbol\n let modifierKey = defaultModifier\n const modifierAttr = {\n default: input.getAttribute('data-focus-modifier') || defaultModifier,\n linux: input.getAttribute('data-focus-modifier-linux'),\n mac: input.getAttribute('data-focus-modifier-mac'),\n windows: input.getAttribute('data-focus-modifier-win')\n }\n if (os && modifierAttr[os]) {\n // a specific modifier key has been set by the user\n modifierKey = modifierAttr[os]\n } else {\n modifierKey = modifierAttr.default\n }\n\n // validate passed in modifier\n const recognizedModifiers = ['ctrl', 'alt', 'opt', 'meta', 'cmd', defaultModifier]\n if (!recognizedModifiers.includes(modifierKey)) {\n console.error(`Received an unrecognized modifier, \"${modifierKey},\" defaulting to \"${defaultModifier}.\"`, input)\n modifierKey = defaultModifier\n }\n\n // retrieve modifier symbol\n if (['alt', 'opt'].includes(modifierKey)) {\n modifierSymbol = os === 'mac' ? '⌥' : '⎇'\n } else if (['meta', 'win', 'cmd'].includes(modifierKey) || (modifierKey === defaultModifier && os === 'mac')) {\n if (os === 'mac') {\n modifierSymbol = '⌘'\n } else if (os === 'linux') {\n modifierSymbol = '◆'\n } else {\n modifierSymbol = '⊞'\n }\n } else if (modifierKey === 'ctrl' || (modifierKey === defaultModifier && (os === 'windows' || os === 'linux'))) {\n if (os === 'mac') {\n modifierSymbol = '⌃'\n } else {\n modifierSymbol = 'Ctrl'\n }\n }\n\n // add the shortcut to the cached array, if not a duplicate\n if (shortcuts.some(shortcut => shortcut.key === focusKey && shortcut.modifier === modifierKey)) {\n console.error(`Duplicate keyboard shortcut \"${modifierKey} + ${focusKey}\" detected. Only the first input will be focusable using this keyboard shortcut.`, input)\n }\n\n // set the shortcut indicator/title\n if (input.nodeName === 'TEXTAREA' || input.type === 'text' || input.type === 'number') {\n // create focus indicator for valid inputs\n const indicator = document.createElement('span')\n indicator.classList.add('focus-key')\n indicator.innerHTML = `<kbd>${modifierSymbol} ${focusKey.toUpperCase()}</kbd>`\n\n const label = input.nextSibling\n insertAfter(indicator, label)\n } else {\n // update the input title\n if (input.getAttribute('title')) {\n input.setAttribute('title', input.getAttribute('title') + ` (${modifierSymbol} + ${focusKey})`)\n } else {\n input.setAttribute('title', `Focus with ${modifierSymbol} + ${focusKey}`)\n }\n }\n\n return {\n key: focusKey,\n modifier: modifierKey,\n input,\n os,\n defaultModifier\n }\n}\n\nmodule.exports = {\n shortcutListener,\n createKeyboardShortcut\n}\n","const { createKeyboardShortcut, shortcutListener } = require('./lib/keyboardShortcuts.js')\nconst { enhanceInput, handleUndoRedo } = require('./lib/inputEnhancements.js')\n\nconst semanticForms = () => {\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) {\n console.warn('semantic-forms was loaded into an unsupported browser and will not execute.')\n return\n }\n\n // custom keyboard shortcut listener\n const keyboardShortcuts = []\n document.addEventListener('keydown', (e) => shortcutListener(e, keyboardShortcuts))\n\n // progressively enhance form elements that have the semanticForms class\n const forms = document.querySelectorAll('form.semanticForms:not(.semanticFormsActive), table.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 enhanceInput(input, form)\n\n // handle keyboard shortcuts\n if (input.getAttribute('data-focus-key') !== null) {\n const shortcut = createKeyboardShortcut(input, keyboardShortcuts)\n keyboardShortcuts.push(shortcut)\n }\n }\n }\n\n // prevents multiple listeners\n document.removeEventListener('keydown', handleUndoRedo)\n document.addEventListener('keydown', handleUndoRedo)\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' || node?.querySelector?.('form')) {\n 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 semanticForms.reinitialize = form => {\n form.classList.remove('semanticFormsActive')\n semanticForms()\n }\n}\n\nmodule.exports = semanticForms\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":["root","factory","exports","module","define","amd","this","getOS","userAgent","window","navigator","platform","os","includes","test","insertAfter","newNode","referenceNode","nextSibling","parentNode","insertBefore","appendChild","icons","passwordShow","passwordHide","helpIcon","lookups","nodeName","inputType","lastFocusedInput","lastClearFieldPressed","enhanceInput","input","form","classList","contains","id","type","getAttribute","dl","add","label","document","querySelector","replace","console","error","newLabel","createElement","className","dd","firstChild","setAttribute","innerHTML","hasAttribute","text","append","parentElement","remove","div","closest","isWrapped","newInput","class","innerText","value","replaceWith","addEventListener","e","key","shiftKey","preventDefault","requestSubmit","dt","clearBtn","title","ariaLabel","tabIndex","previousValue","focus","dispatchEvent","Event","bubbles","event","target","match","style","adjustWidth","placeholder","width","length","maxWidth","display","files","output","showBtn","setProperty","handleInput","maxRows","isNaN","Number","warn","minRows","getComputedStyle","inlinePadding","parseFloat","inlineBorderWidth","blockPadding","lineHeight","height","scrollHeight","Math","round","removeProperty","rows","min","adjustHeight","borderWidth","parseInt","getPropertyValue","shiftClearBtn","marginRight","clientHeight","handleUndoRedo","ctrlKey","metaKey","name","log","redoValue","specialCharMap","Minus","Equal","BracketLeft","BracketRight","Backslash","Semicolon","Quote","Comma","Period","Slash","Backquote","shiftSpecialCharMap","shortcutListener","shortcuts","shortcut","find","matchesKey","altKey","toUpperCase","code","matchesModifier","modifier","defaultModifier","createKeyboardShortcut","focusKey","toString","modifierSymbol","modifierKey","modifierAttr","default","linux","mac","windows","recognizedModifiers","some","indicator","semanticForms","getElementsByClassName","body","MutationObserver","keyboardShortcuts","forms","querySelectorAll","inputs","Array","from","push","removeEventListener","semanticFormsObserver","mutations","stop","mutation","node","addedNodes","observe","attributes","childList","characterData","subtree","reinitialize","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","__webpack_exports__"],"sourceRoot":""}
|
|
1
|
+
{"version":3,"file":"semantic-forms.cjs","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,KAAM,Y;;;;;;;;;;;ACLT,MAAMC,MAAQ,KACZ,MAAMC,UAAYC,OAAOC,UAAUF,UACnC,MAAMG,SAAWF,OAAOC,UAAUC,SAClC,IAAIC,GAAK,KAET,GAAID,SAASE,SAAS,OACpBD,GAAK,eACA,GAAID,SAASE,SAAS,QAAU,mBAAmBC,KAAKN,WAC7DI,GAAK,WACA,GAAID,SAASE,SAAS,UAAY,UAAUC,KAAKN,WACtDI,GAAK,QAEP,OAAOA;;;;;IAQT,MAAMG,YAAc,CAACC,QAASC,iBAC5B,GA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uBAAuBxH,MAAOyI,mBAC/CA,kBAAkBM,KAAKhC,SACzB,CACF,CACF;8BAGArG;SAASsI,oBAAoB,UAAWrD,gBACxCjF,SAAS2B,iBAAiB,UAAWsD;gFAGrC;IAAKlH,OAAOwK,sBAAuB,CACjCxK,OAAOwK,sBAAwB,IAAIxK,OAAO+J,iBAAiBU,YACzD,IAAIC,KAAO,MACX,IAAK,MAAMC,YAAYF,UAAW,CAChC,IAAK,MAAMG,QAAQD,SAASE,WAC1B,GAAID,KAAK1J,WAAa,QAAU0J,MAAM1I,gBAAgB,QAAS,CAC7D0H,gBACAc,KAAO,IACT,CAEF,GAAIA,KAAM,KACZ,IAEF1K,OAAOwK,sBAAsBM,QAAQ7I,SAAS6H,KAAM,CAAEiB,WAAY,MAAOC,UAAW,KAAMC,cAAe,MAAOC,QAAS,MAC3H,CAEAtB,cAAcuB,aAAe3J,OAC3BA,KAAKC,UAAUqD,OAAO,uBACtB8E,kBAIJlK,OAAOD,QAAUmK;;;;;QC5DjB,IAAIwB,yBAA2B,CAAC;;;QAGhC,SAASC,oBAAoBC;;QAE5B,IAAIC,aAAeH,yBAAyBE;QAC5C,GAAIC,oBAAiBC;QACpB,OAAOD,aAAa9L;;;QAGrB,IAAIC,OAAS0L,yBAAyBE,UAAY;;;QAGjD7L,QAAS,CAAC;;;;QAIXgM,oBAAoBH,UAAU5L,OAAQA,OAAOD,QAAS4L;;;QAGtD,OAAO3L,OAAOD;QACf;;;;;;;QCnBA,IAAIiM,oBAAsBL,oBAAoB","sources":["webpack://semanticForms/webpack/universalModuleDefinition","webpack://semanticForms/./lib/helpers.js","webpack://semanticForms/./lib/inputEnhancements.js","webpack://semanticForms/./lib/keyboardShortcuts.js","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 ","/**\n * Uses the navigator to best determine the clients operating system.\n * @returns Operating system string (`mac`, `windows`, `linux`)\n */\nconst getOS = () => {\n const userAgent = window.navigator.userAgent\n const platform = window.navigator.platform\n let os = null\n\n if (platform.includes('Win')) {\n os = 'windows'\n } else if (platform.includes('Mac') || /iPhone|iPad|iPod/.test(userAgent)) {\n os = 'mac'\n } else if (platform.includes('Linux') || /Android/.test(userAgent)) {\n os = 'linux'\n }\n return os\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 */\nconst insertAfter = (newNode, referenceNode) => {\n if (referenceNode.nextSibling) referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling)\n else referenceNode.parentNode.appendChild(newNode)\n}\n\nmodule.exports = { getOS, insertAfter }\n","const { insertAfter } = require('./helpers.js')\n\nconst icons = {\n 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 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 helpIcon: '<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" version=\"1.1\" style=\"overflow:visible;\"><rect width=\"16\" height=\"16\" fill=\"none\"/><path fill=\"currentColor\" d=\"M8,10.5c-0.552,0-1,0.448-1,1c0,0.552,0.448,1,1,1c0.552,0,1-0.448,1-1C9,10.948,8.552,10.5,8,10.5z M8,0 C3.582,0,0,3.582,0,8c0,4.418,3.582,8,8,8s8-3.582,8-8C16,3.582,12.418,0,8,0z M12.243,12.243C11.109,13.376,9.603,14,8,14 s-3.109-0.624-4.243-1.757C2.624,11.109,2,9.603,2,8s0.624-3.109,1.757-4.243C4.891,2.624,6.397,2,8,2s3.109,0.624,4.243,1.757 C13.376,4.891,14,6.397,14,8C14,9.603,13.376,11.109,12.243,12.243z M7.927,3.755c-2.248,0-2.76,1.695-2.802,2.906h1.571 c0.028-0.256,0.101-1.418,1.221-1.418c0.672,0,1.206,0.406,1.206,1.175c0,0.695-0.724,1.155-1.303,1.711 C7.241,8.685,7.168,9.325,7.168,9.824V10c0.146,0,1.615,0,1.615,0V9.824c0-1.256,1.967-1.594,1.967-3.541 C10.75,5.059,9.874,3.755,7.927,3.755z\"/></svg>'\n}\n\nconst lookups = {\n nodeName: ['TEXTAREA', 'SELECT'],\n inputType: ['checkbox', 'color', 'date', 'datetime-local', 'email', 'file', 'image', 'month', 'number', 'password', 'radio', 'range', 'search', 'tel', 'text', 'time', 'url', 'week']\n}\n\nlet lastFocusedInput\nlet lastClearFieldPressed\n\nconst enhanceInput = (input, form) => {\n // ignore input if it has previously been formatted\n if (input.classList.contains('semanticform') || !input.id) return\n\n const type = input.getAttribute('type')\n if (!lookups.nodeName.includes(input.nodeName) && !lookups.inputType.includes(type)) return\n\n // recursively find <dl> element\n let dl = input.parentNode\n while (dl && dl.nodeName !== 'DL') dl = dl.parentNode\n if (!dl) return\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 if (!label) {\n console.error(`semantic-forms: Found an input (${input.id || input.getAttribute('name')}) without a properly associated label. Make sure there is a label for it and the label has a matching \"for\" attribute.`)\n }\n\n input.classList.add('semanticform')\n\n const isWrapped = input.closest('dd').parentElement.nodeName === 'DIV'\n\n // #region create labels\n\n const newLabel = document.createElement('label')\n newLabel.className = 'floatLabelFormAnimatedLabel'\n\n if (type === 'checkbox' || type === 'radio') {\n const div = isWrapped ? input.closest('dd').parentElement : document.createElement('div')\n const dt = label.closest('dt')\n const dd = input.closest('dd')\n\n if (!dt || !dd) {\n console.error(`semantic-forms: Found an input (${input.id || input.getAttribute('name')}) that is not inside a <dd> element.`)\n return\n }\n\n if (dd.firstChild.nodeName !== 'LABEL') {\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 if (type === 'radio' && input.parentNode.nodeName === 'DD') {\n newLabel.setAttribute('for', input.id)\n input.parentNode.classList.add('singleRadio')\n newLabel.className = ''\n label.setAttribute('hidden', 'hidden')\n insertAfter(newLabel, input)\n }\n\n newLabel.innerHTML = label.innerHTML\n\n if (label.hasAttribute('title') && label.getAttribute('data-show-help-icon') !== null && !label.querySelector('span.help')) {\n const text = label.getAttribute('title')\n label.innerHTML += ` <span title=\"${text}\" class=\"help\">${icons.helpIcon}</span>`\n newLabel.innerHTML += ` <span title=\"${text}\" class=\"help\">${icons.helpIcon}</span>`\n }\n\n if (dd.querySelector(':required') && label.getAttribute('data-no-asterisk') === null && !label.querySelector('span.required')) {\n const text = label.getAttribute('data-asterisk-text') || 'This field is required.'\n label.innerHTML += ` <span title=\"${text}\" class=\"required\">*</span>`\n newLabel.innerHTML += ` <span title=\"${text}\" class=\"required\">*</span>`\n }\n\n if (!dd.querySelector('label')) dd.append(newLabel)\n }\n\n // if the user did not wrap the input in a div, do it for them\n if (!isWrapped) {\n div.append(dt, dd)\n\n // determine visibility of newly created <div>\n if (dt.style.display === 'none' && dd.style.display === 'none') div.style.display = 'none'\n }\n dl.append(div)\n } else {\n newLabel.setAttribute('for', input.id)\n newLabel.innerHTML = label.innerHTML\n\n if (input.hasAttribute('title') && label.getAttribute('data-show-help-icon') !== null && !label.querySelector('span.help')) {\n const text = input.getAttribute('title')\n newLabel.innerHTML += ` <span title=\"${text}\" class=\"help\">${icons.helpIcon}</span>`\n }\n\n if (input.hasAttribute('required') && label.getAttribute('data-no-asterisk') === null && !label.querySelector('span.required')) {\n const text = label.getAttribute('data-asterisk-text') || 'This field is required.'\n newLabel.innerHTML += ` <span title=\"${text}\" class=\"required\">*</span>`\n }\n\n label.setAttribute('hidden', 'hidden')\n\n insertAfter(newLabel, input)\n }\n // #endregion\n\n // #region standard inputs\n\n // check for auto-grow attribute on textareas\n if (input.getAttribute('data-auto-grow') !== null) {\n // progressively enhance inputs into textareas\n if (input.nodeName === 'INPUT' && input.type === 'text') {\n const newInput = document.createElement('textarea')\n newInput.id = input.id\n newInput.class = input.class\n newInput.innerText = input.value\n newInput.setAttribute('data-auto-grow', '')\n input.replaceWith(newInput)\n input = newInput\n }\n\n if (input.nodeName === 'TEXTAREA') {\n // when pressing enter while this input is focused, we want to submit\n input.addEventListener('keypress', (e) => {\n if (e.key !== 'Enter' || (e.key === 'Enter' && e.shiftKey)) return\n e.preventDefault()\n form.requestSubmit()\n })\n }\n }\n\n if (type !== 'checkbox' && type !== 'radio') {\n if (!input.getAttribute('placeholder')) input.setAttribute('placeholder', ' ')\n\n const div = isWrapped ? input.closest('dd').parentElement : document.createElement('div')\n const dt = label.closest('dt')\n const dd = input.closest('dd')\n\n if (!dt || !dd) {\n console.error(`semantic-forms: Found an input (${input.id || input.getAttribute('name')}) that does not have a corresponding ${!dt ? '<dt>' : '<dd>'} element.`)\n return\n }\n\n // input 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', () => {\n input.previousValue = input.value\n input.value = ''\n input.focus()\n lastClearFieldPressed = input.id\n\n // used for any other updates required by various inputs\n input.dispatchEvent(new Event('input', { bubbles: true }))\n })\n insertAfter(clearBtn, dd.querySelector('label'))\n }\n\n input.addEventListener('focus', event => {\n if (event.target.nodeName === 'INPUT') lastFocusedInput = event.target\n })\n\n // check for colspan- utility class on dd, and move to div\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 // check for max-content attribute\n // this may be removed once fully supported in Firefox and Safari: https://caniuse.com/wf-field-sizing\n if (input.getAttribute('data-max-content') !== null) {\n if (!('fieldSizing' in document.createElement('input').style)) {\n const adjustWidth = () => {\n const value = input.value !== '' ? input.value : input.placeholder\n const width = value.length * 8 + 40\n input.style.width = width + 'px'\n input.style.maxWidth = '100%'\n }\n adjustWidth()\n input.addEventListener('input', adjustWidth)\n }\n }\n\n // if the user did not wrap the input in a div, do it for them\n if (!isWrapped) {\n div.append(dt, dd)\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 dl.append(div)\n }\n // #endregion\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', event => {\n clearBtn.style.display = event.target.files.length ? 'flex' : 'none'\n })\n clearBtn.addEventListener('click', () => {\n clearBtn.style.display = 'none'\n })\n }\n\n // handle range inputs with a class to display the value\n // TODO: should this be a data attribute instead?\n if (type === 'range' && input.classList.contains('displayValue')) {\n const label = input.parentNode.parentNode.querySelector('dd label')\n label.innerHTML += `<span class=\"seperator\">: </span><output>${input.value}</output>`\n input.addEventListener('input', event => {\n const output = event.target.parentNode.parentNode.querySelector('output')\n output.innerHTML = event.target.value\n })\n }\n\n // 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 = icons.passwordShow\n showBtn.classList.add('show')\n showBtn.id = `semanticFormsShowButton_${input.id}`\n const dd = input.closest('dd')\n if (!dd) {\n console.error(`semantic-forms: Found an input (${input.id || input.getAttribute('name')}) that is not inside a <dd> element.`)\n return\n }\n showBtn.addEventListener('click', () => {\n if (input.type === 'password') {\n showBtn.innerHTML = icons.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 = icons.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\n // add listener to shift clear button when scrollbar present\n if (input.nodeName === 'TEXTAREA') {\n if (input.getAttribute('data-disable-autosize') === null) {\n // add auto-sizing\n input.style.setProperty('resize', 'none')\n input.style.setProperty('min-height', '0')\n input.style.setProperty('max-height', 'none')\n input.style.setProperty('height', 'auto')\n\n const handleInput = () => {\n // reset rows attribute to get accurate scrollHeight\n let maxRows = input.getAttribute('data-max-rows')\n\n if (maxRows) {\n if (isNaN(maxRows) || Number(maxRows) <= 0) {\n console.warn(`An invalid value was passed to the \"data-max-rows\" attribute. This value will be ignored.\\n\\nProvided value: ${input.getAttribute('data-max-rows')}`)\n maxRows = null\n }\n }\n\n const minRows = input.getAttribute('data-max-rows') && Number(input.getAttribute('data-max-rows')) < 5 ? input.getAttribute('data-max-rows') : '5'\n input.setAttribute('rows', minRows)\n\n // get the computed values object reference\n const style = window.getComputedStyle(input)\n\n // force content-box for size accurate line-height calculation, remove scrollbars, lock width (subtract inline padding and inline border widths), and remove inline padding and borders to keep width consistent (for text wrapping accuracy)\n const inlinePadding = parseFloat(style['padding-left']) + parseFloat(style['padding-right'])\n const inlineBorderWidth = parseFloat(style['border-left-width']) + parseFloat(style['border-right-width'])\n input.style.setProperty('overflow', 'hidden', 'important')\n input.style.setProperty('width', (parseFloat(style.width) - inlinePadding - inlineBorderWidth) + 'px')\n input.style.setProperty('box-sizing', 'content-box')\n input.style.setProperty('padding-inline', '0')\n input.style.setProperty('border-width', '0')\n\n // get the base line height, and top / bottom padding\n const blockPadding = parseFloat(style['padding-top']) + parseFloat(style['padding-bottom'])\n const lineHeight = style['line-height'] === 'normal'\n ? parseFloat(style.height) // if line-height is not explicitly set, use the computed height value (ignore padding due to content-box)\n : parseFloat(style['line-height']) // otherwise (line-height is explicitly set), use the computed line-height value\n\n // get the scroll height (rounding to be safe to ensure cross browser consistency)\n const scrollHeight = Math.round(input.scrollHeight)\n\n // undo overflow, width, border-width, box-sizing & inline padding overrides\n input.style.removeProperty('width')\n input.style.removeProperty('box-sizing')\n input.style.removeProperty('padding-inline')\n input.style.removeProperty('border-width')\n input.style.removeProperty('overflow')\n\n // subtract blockPadding from scrollHeight and divide that by our lineHeight to get the row count, round to nearest integer as it will always be within ~.1 of the correct whole number\n const rows = Math.round((scrollHeight - blockPadding) / lineHeight)\n\n // set the calculated rows attribute (limited by rowLimit)\n if (maxRows) {\n input.setAttribute('rows', '' + Math.min(rows, Number(maxRows)))\n } else {\n input.setAttribute('rows', '' + rows)\n }\n }\n\n input.addEventListener('input', handleInput)\n\n // trigger the event to set the initial rows value\n input.dispatchEvent(new Event('input', { bubbles: true }))\n }\n\n // progressively enhance textarea for Firefox and Safari\n // this may be removed once fully supported in Firefox and Safari: https://caniuse.com/wf-field-sizing\n if (input.getAttribute('data-auto-grow') !== null) {\n if (!('fieldSizing' in document.createElement('input').style)) {\n const adjustHeight = () => {\n if (input.value.length) {\n const borderWidth = parseInt(window.getComputedStyle(input).getPropertyValue('border-width'))\n input.style.height = (input.scrollHeight + (borderWidth * 2)) + 'px'\n } else {\n input.style.height = window.getComputedStyle(form).getPropertyValue('--semanticFormsInputHeight')\n }\n }\n\n // set initial height to semantic-forms CSS variable\n input.style.height = window.getComputedStyle(form).getPropertyValue('--semanticFormsInputHeight')\n input.addEventListener('input', adjustHeight)\n }\n }\n\n // shifts the clear button to the right if a scrollbar is present\n const shiftClearBtn = () => {\n const clearBtn = input.parentElement?.querySelector('button.clear')\n if (clearBtn) clearBtn.style.marginRight = input.clientHeight < input.scrollHeight ? '15px' : ''\n }\n input.addEventListener('input', shiftClearBtn)\n input.addEventListener('mouseup', shiftClearBtn)\n shiftClearBtn()\n }\n}\n\nconst handleUndoRedo = (event) => {\n // handle undo/redo\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 {\n 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\nmodule.exports = { enhanceInput, handleUndoRedo }\n","const { getOS, insertAfter } = require('./helpers.js')\n\nconst specialCharMap = {\n Minus: '-',\n Equal: '=',\n BracketLeft: '[',\n BracketRight: ']',\n Backslash: '\\\\',\n Semicolon: ';',\n Quote: '\\'',\n Comma: ',',\n Period: '.',\n Slash: '/',\n Backquote: '`'\n}\nconst shiftSpecialCharMap = {\n 1: '!',\n 2: '@',\n 3: '#',\n 4: '$',\n 5: '%',\n 6: '^',\n 7: '&',\n 8: '*',\n 9: '(',\n 0: ')',\n Minus: '_',\n Equal: '+',\n BracketLeft: '{',\n BracketRight: '}',\n Backslash: '|',\n Semicolon: ':',\n Quote: '\"',\n Comma: '<',\n Period: '>',\n Slash: '?',\n Backquote: '~'\n}\n\n// handles keyboard shortcut events\nconst shortcutListener = (e, shortcuts) => {\n // search for matching shortcut from cached shortcut configs\n const shortcut = shortcuts.find(shortcut => {\n let matchesKey = false\n if (e.altKey && !e.shiftKey) {\n // mac adjusts the key value if altKey is pressed\n matchesKey = 'Key' + shortcut.key.toUpperCase() === e.code ||\n 'Digit' + shortcut.key.toUpperCase() === e.code ||\n shortcut.key === e.key ||\n specialCharMap[e.code] === shortcut.key\n } else if (e.shiftKey) {\n // check shift special character map\n const code = e.code.replace(/Key|Digit/, '')\n matchesKey = (shiftSpecialCharMap[code] || shiftSpecialCharMap[e.key]) &&\n (shiftSpecialCharMap[code] === shortcut.key || shiftSpecialCharMap[e.key] === shortcut.key)\n } else {\n matchesKey = shortcut.key.toUpperCase() === e.key.toUpperCase()\n }\n if (!matchesKey) return false\n\n let matchesModifier\n if (shortcut.modifier) {\n if (shortcut.modifier === shortcut.defaultModifier) matchesModifier = shortcut.os === 'windows' || shortcut.os === 'linux' ? e.ctrlKey : e.metaKey\n if (shortcut.modifier === 'meta') matchesModifier = e.metaKey\n if (shortcut.modifier === 'alt') matchesModifier = e.altKey\n if (shortcut.modifier === 'ctrl') matchesModifier = e.ctrlKey\n }\n return matchesModifier\n })\n\n if (shortcut) {\n e.preventDefault()\n shortcut.input.focus()\n }\n}\n\nconst createKeyboardShortcut = (input, shortcuts) => {\n const os = getOS()\n // this is the custom keyword for meta on linux/mac, ctrl on windows\n const defaultModifier = 'metactrl'\n\n // get focus key value\n let focusKey = input.getAttribute('data-focus-key')\n if (focusKey.length > 1) {\n console.error(`Provided focus key \"${focusKey}\" is more than one character. Using first character only.`)\n focusKey = focusKey.toString()[0]\n }\n\n // get focus modifier value\n let modifierSymbol\n let modifierKey = defaultModifier\n const modifierAttr = {\n default: input.getAttribute('data-focus-modifier') || defaultModifier,\n linux: input.getAttribute('data-focus-modifier-linux'),\n mac: input.getAttribute('data-focus-modifier-mac'),\n windows: input.getAttribute('data-focus-modifier-win')\n }\n if (os && modifierAttr[os]) {\n // a specific modifier key has been set by the user\n modifierKey = modifierAttr[os]\n } else {\n modifierKey = modifierAttr.default\n }\n\n // validate passed in modifier\n const recognizedModifiers = ['ctrl', 'alt', 'opt', 'meta', 'cmd', defaultModifier]\n if (!recognizedModifiers.includes(modifierKey)) {\n console.error(`Received an unrecognized modifier, \"${modifierKey},\" defaulting to \"${defaultModifier}.\"`, input)\n modifierKey = defaultModifier\n }\n\n // retrieve modifier symbol\n if (['alt', 'opt'].includes(modifierKey)) {\n modifierSymbol = os === 'mac' ? '⌥' : '⎇'\n } else if (['meta', 'win', 'cmd'].includes(modifierKey) || (modifierKey === defaultModifier && os === 'mac')) {\n if (os === 'mac') {\n modifierSymbol = '⌘'\n } else if (os === 'linux') {\n modifierSymbol = '◆'\n } else {\n modifierSymbol = '⊞'\n }\n } else if (modifierKey === 'ctrl' || (modifierKey === defaultModifier && (os === 'windows' || os === 'linux'))) {\n if (os === 'mac') {\n modifierSymbol = '⌃'\n } else {\n modifierSymbol = 'Ctrl'\n }\n }\n\n // add the shortcut to the cached array, if not a duplicate\n if (shortcuts.some(shortcut => shortcut.key === focusKey && shortcut.modifier === modifierKey)) {\n console.error(`Duplicate keyboard shortcut \"${modifierKey} + ${focusKey}\" detected. Only the first input will be focusable using this keyboard shortcut.`, input)\n }\n\n // set the shortcut indicator/title\n if (input.nodeName === 'TEXTAREA' || input.type === 'text' || input.type === 'number') {\n // create focus indicator for valid inputs\n const indicator = document.createElement('span')\n indicator.classList.add('focus-key')\n indicator.innerHTML = `<kbd>${modifierSymbol} ${focusKey.toUpperCase()}</kbd>`\n\n const label = input.nextSibling\n insertAfter(indicator, label)\n } else {\n // update the input title\n if (input.getAttribute('title')) {\n input.setAttribute('title', input.getAttribute('title') + ` (${modifierSymbol} + ${focusKey})`)\n } else {\n input.setAttribute('title', `Focus with ${modifierSymbol} + ${focusKey}`)\n }\n }\n\n return {\n key: focusKey,\n modifier: modifierKey,\n input,\n os,\n defaultModifier\n }\n}\n\nmodule.exports = {\n shortcutListener,\n createKeyboardShortcut\n}\n","const { createKeyboardShortcut, shortcutListener } = require('./lib/keyboardShortcuts.js')\nconst { enhanceInput, handleUndoRedo } = require('./lib/inputEnhancements.js')\n\nconst semanticForms = () => {\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) {\n console.warn('semantic-forms was loaded into an unsupported browser and will not execute.')\n return\n }\n\n // custom keyboard shortcut listener\n const keyboardShortcuts = []\n document.addEventListener('keydown', (e) => shortcutListener(e, keyboardShortcuts))\n\n // progressively enhance form elements that have the semanticForms class\n const forms = document.querySelectorAll('form.semanticForms:not(.semanticFormsActive), table.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 enhanceInput(input, form)\n\n // handle keyboard shortcuts\n if (input.getAttribute('data-focus-key') !== null) {\n const shortcut = createKeyboardShortcut(input, keyboardShortcuts)\n keyboardShortcuts.push(shortcut)\n }\n }\n }\n\n // prevents multiple listeners\n document.removeEventListener('keydown', handleUndoRedo)\n document.addEventListener('keydown', handleUndoRedo)\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' || node?.querySelector?.('form')) {\n 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 semanticForms.reinitialize = form => {\n form.classList.remove('semanticFormsActive')\n semanticForms()\n }\n}\n\nmodule.exports = semanticForms\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":["root","factory","exports","module","define","amd","this","getOS","userAgent","window","navigator","platform","os","includes","test","insertAfter","newNode","referenceNode","nextSibling","parentNode","insertBefore","appendChild","icons","passwordShow","passwordHide","helpIcon","lookups","nodeName","inputType","lastFocusedInput","lastClearFieldPressed","enhanceInput","input","form","classList","contains","id","type","getAttribute","dl","add","label","document","querySelector","replace","console","error","isWrapped","closest","parentElement","newLabel","createElement","className","div","dt","dd","firstChild","setAttribute","innerHTML","hasAttribute","text","append","style","display","newInput","class","innerText","value","replaceWith","addEventListener","e","key","shiftKey","preventDefault","requestSubmit","clearBtn","title","ariaLabel","tabIndex","previousValue","focus","dispatchEvent","Event","bubbles","event","target","match","remove","adjustWidth","placeholder","width","length","maxWidth","files","output","showBtn","setProperty","handleInput","maxRows","isNaN","Number","warn","minRows","getComputedStyle","inlinePadding","parseFloat","inlineBorderWidth","blockPadding","lineHeight","height","scrollHeight","Math","round","removeProperty","rows","min","adjustHeight","borderWidth","parseInt","getPropertyValue","shiftClearBtn","marginRight","clientHeight","handleUndoRedo","ctrlKey","metaKey","name","redoValue","specialCharMap","Minus","Equal","BracketLeft","BracketRight","Backslash","Semicolon","Quote","Comma","Period","Slash","Backquote","shiftSpecialCharMap","shortcutListener","shortcuts","shortcut","find","matchesKey","altKey","toUpperCase","code","matchesModifier","modifier","defaultModifier","createKeyboardShortcut","focusKey","toString","modifierSymbol","modifierKey","modifierAttr","default","linux","mac","windows","recognizedModifiers","some","indicator","semanticForms","getElementsByClassName","body","MutationObserver","keyboardShortcuts","forms","querySelectorAll","inputs","Array","from","push","removeEventListener","semanticFormsObserver","mutations","stop","mutation","node","addedNodes","observe","attributes","childList","characterData","subtree","reinitialize","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","__webpack_exports__"],"sourceRoot":""}
|
package/dist/semantic-forms.css
CHANGED
|
@@ -1264,7 +1264,7 @@ form.semanticForms:not(.semanticFormsActive) dd input[type=button]:not(.clear, .
|
|
|
1264
1264
|
display: flex;
|
|
1265
1265
|
flex-direction: column;
|
|
1266
1266
|
gap: 5px;
|
|
1267
|
-
padding:
|
|
1267
|
+
padding: 10px;
|
|
1268
1268
|
margin: 0;
|
|
1269
1269
|
min-height: calc(var(--semanticFormsFontSize) + 20px);
|
|
1270
1270
|
}
|
|
@@ -1309,6 +1309,9 @@ form.semanticForms:not(.semanticFormsActive) dd input[type=button]:not(.clear, .
|
|
|
1309
1309
|
transform-origin: 0.2rem 50%;
|
|
1310
1310
|
transition: 250ms transform ease;
|
|
1311
1311
|
}
|
|
1312
|
+
.semanticForms details[open] {
|
|
1313
|
+
padding-top: 30px;
|
|
1314
|
+
}
|
|
1312
1315
|
.semanticForms details[open]::details-content {
|
|
1313
1316
|
visibility: visible;
|
|
1314
1317
|
opacity: 1;
|
|
@@ -1349,6 +1352,9 @@ form.semanticForms:not(.semanticFormsActive) dd input[type=button]:not(.clear, .
|
|
|
1349
1352
|
min-width: 150px;
|
|
1350
1353
|
max-width: max-content;
|
|
1351
1354
|
}
|
|
1355
|
+
.semanticForms dl div:not(:has(ul, ol)):has(dd input[type=radio]:only-of-type, dd input[type=checkbox]:only-of-type) {
|
|
1356
|
+
padding-top: 22px;
|
|
1357
|
+
}
|
|
1352
1358
|
.semanticForms dl div:has(dd > button:only-child, dd > input[type=button]:only-child, dd > input[type=submit]:only-child, dd > input[type=reset]:only-child) dt label {
|
|
1353
1359
|
display: none;
|
|
1354
1360
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sourceRoot":"","sources":["../styles/globals.scss","../styles/inputs.scss","../styles/labels.scss","../styles/colspan.scss","../styles/lowFlow.scss","../semanticForms.scss"],"names":[],"mappings":"AAAA;AAAA;AAAA;EAGE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EAEA;EACA;EACA;EACA;;AAEA;AAAA;AAAA;EACE;EACA;EACA;;AAIF;EAnDF;AAAA;AAAA;IAoDI;;;AAIF;AAAA;AAAA;EACE;;AAIF;AAAA;AAAA;EACE;;AAIF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;EAYE;EACA;EACA;;
|
|
1
|
+
{"version":3,"sourceRoot":"","sources":["../styles/globals.scss","../styles/inputs.scss","../styles/labels.scss","../styles/colspan.scss","../styles/lowFlow.scss","../semanticForms.scss"],"names":[],"mappings":"AAAA;AAAA;AAAA;EAGE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EAEA;EACA;EACA;EACA;;AAEA;AAAA;AAAA;EACE;EACA;EACA;;AAIF;EAnDF;AAAA;AAAA;IAoDI;;;AAIF;AAAA;AAAA;EACE;;AAIF;AAAA;AAAA;EACE;;AAIF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;EAYE;EACA;EACA;;AAIF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;EACE;EACA;;;AAmCJ;EAGM;IAjCJ;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;;EAEA;IACE;;;AAgBA;EA1CF;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;;;AAsBJ;AAAA;EAhDE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;AAAA;EACE;;;ACpHF;AAAA;EAEE;;AAGF;AAAA;EAEE;EACA;EACA;EACA;;AAEA;AAAA;EACE;;AAIJ;AAAA;AAAA;EAGE;EACA;EACA;EACA;EACA;EACA;EACA;;AAGA;AAAA;AAAA;EACE;EACA;;AAGF;AAAA;AAAA;EACE;;AAIF;AAAA;AAAA;AAAA;AAAA;EACE;;AAGF;AAAA;AAAA;EACE;EACA;EACA;EACA;;AAIE;AAAA;AAAA;AAAA;AAAA;EACE;;AAKJ;AAAA;AAAA;EACE;;AAIJ;AAAA;AAAA;AAAA;AAAA;EAEE;;AAGF;AAAA;AAAA;EACE;EACA;EACA;;AAGF;AAAA;AAAA;EACE;EACA;;AAGF;AAAA;AAAA;EACE;EACA;;AAEA;AAAA;AAAA;EACE;;AAGF;AAAA;AAAA;EACE;;AAKN;EACE;;AAGA;EAEE;EACA;EACA;EACA;EACA;EACA;EACA;;AAIF;EACE;EACA;EACA;;AAEA;EACE;;AAEA;EACE;;AAGF;EACE;;AAMR;EACE;EACA;EACA;EACA;;AAEA;EACE;;AAKJ;EACE;EACA;EACA;EACA;EACA;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAGF;EACE;;AAEA;EACE;;AAKJ;EACE;;AAIF;AAAA;AAAA;AAAA;EAIE;;AAIF;AAAA;AAAA;AAAA;AAAA;EAKE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;AAAA;AAAA;AAAA;AAAA;EACE;;AAIJ;AAAA;AAAA;AAAA;AAAA;AAAA;EAME;;AAEA;AAAA;AAAA;AAAA;AAAA;AAAA;EACE;;AAIJ;EACE;;AAEA;EAEE;;AAKJ;EACE;EACA;;AAMA;AAAA;AAAA;AAAA;AAAA;EAEE;;AAEA;AAAA;AAAA;AAAA;AAAA;EACE;;AAGF;AAAA;AAAA;AAAA;AAAA;EACE;EACA;;AAIJ;AAAA;AAAA;EACE;;AAEA;AAAA;AAAA;EACE;;AAGF;AAAA;AAAA;EACE;EACA;;AAMN;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;EAYE;EACA;EACA;EACA;;AAIF;EACE;IACE;;EAEA;IACE;IACA;IACA;IACA;IACA;IACA;;EAIJ;IACE;;;;ACjTJ;AAAA;EAGE;EACA;EACA;EACA;EACA;EACA;;AAEA;AAAA;EACE;EACA;EACA;;AAGF;AAAA;EACE;EACA;EACA;EACA;;AAEA;AAAA;EACE;;AAOF;EACE;;AAEA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;EACA;;AAOF;EACE;EACA;;AAGF;EACE;EACA;EACA;EACA;;AASF;AAAA;AAAA;AAAA;AAAA;EAEE;EACA;EACA;;AAQF;AAAA;AAAA;AAAA;AAAA;EAEE;;AAIJ;EAEE;;AAGF;AAAA;EAEE;;AAIF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;EAC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AIJ;AAAA;EACE;;AAGA;AAAA;EACE;EACA;EACA;;AAKN;AAAA;EACE;EACA;;AAEA;AAAA;EACE;EACA;;AAIJ;AAAA;EACE;EACA;EACA;;AAEA;AAAA;EACE;EACA;;AAIJ;AAAA;EACE;EACA;;AAEA;AAAA;EACE;EACA;;AAIJ;AAAA;EACE;;AAEA;AAAA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;AAKA;AAAA;EACE;EACA;;AASF;AAAA;AAAA;EACE;;AAKN;AAAA;EACE;EACA;;AAGA;AAAA;AAAA;EAEE;;AAGE;AAAA;AAAA;EACE;;AAGF;AAAA;AAAA;EACE;EACA;EACA;;AAKJ;AAAA;AAAA;EACE;EACA;;AAKJ;AAAA;AAAA;AAAA;AAAA;AAAA;EAGE;;AAIF;AAAA;EACE;EACA;EACA;EACA;;AAIF;AAAA;AAAA;AAAA;AAAA;AAAA;EAGE;;;AAKN;AAAA;EAEE;;;ACnJA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAGA;EACE;EACA;EACA;;AAGA;AAAA;AAAA;EAGE;;AAKN;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;;AAGF;EAnBF;IAoBI;;EAEA;IACE;IACA;IACA;IACA;;;AAIJ;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EAEE;;AAGF;EAEE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAIJ;EACE;;AAEA;EACE;EACA;EACA;;AAGF;EACE;IACE;;;AAKF;EACE;;AAIJ;EACE;EACA;;AAKN;EACE;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;;AAEA;EACE;EACA;;AAEA;EACE;;AAEA;EAEE;EACA;EACA;;AAKN;EAEE;;AAKA;EACE;;AAIJ;EACE;EACA;EACA;EACA;EACA;;AAGA;EAEE;EACA;EACA;EACA;EACA;;AAGA;EACE;;AAIF;EACE;EACA;EACA;EACA;;AAIJ;EACE;;AAKA;EACE;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;;AAKJ;EACE;EACA;EACA;;AAKJ;EACE;;AAEA;EACE;;AAKJ;EACE;EACA;;AAEA;EACE;;AAIF;EACE;EACA;;AAIF;AAAA;AAAA;EAGE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAGF;AAAA;EAEE;EACA;;AASR;EACE;EACA;EACA;;AAIF;EACE;EACA;EACA;EACA;;AAIJ;AAAA;EAEE;EACA;EACA;EACA;EACA;;AAGF;EACE;EACA;;AAGF;EACE;EACA;;AAGF;EACE;EACA;;;AAIJ;AAAA;EAEE;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;AAAA;EACE;;AAGF;AAAA;EACE;EACA;;AAGF;AAAA;EACE;;AAGF;AAAA;EACE;;AAGF;AAAA;AAAA;EACE;EACA;EACA;;AAGF;AAAA;AAAA;EACE;;AAKE;AAAA;AAAA;EACE;;AAMN;AAAA;EACE","file":"semantic-forms.css"}
|
package/dist/semantic-forms.js
CHANGED
|
@@ -66,16 +66,15 @@ const getOS=()=>{const userAgent=window.navigator.userAgent;const platform=windo
|
|
|
66
66
|
// ignore input if it has previously been formatted
|
|
67
67
|
if(input.classList.contains("semanticform")||!input.id)return;const type=input.getAttribute("type");if(!lookups.nodeName.includes(input.nodeName)&&!lookups.inputType.includes(type))return;
|
|
68
68
|
// recursively find <dl> element
|
|
69
|
-
let dl=input.parentNode;while(dl&&dl.nodeName!=="DL")dl=dl.parentNode;if(!dl)return;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,"\\.")+"]");if(!label)console.error(`semantic-forms: Found an input (${input.id||input.getAttribute("name")}) without a properly associated label. Make sure there is a label for it and the label has a matching "for" attribute.`);input.classList.add("semanticform");
|
|
69
|
+
let dl=input.parentNode;while(dl&&dl.nodeName!=="DL")dl=dl.parentNode;if(!dl)return;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,"\\.")+"]");if(!label)console.error(`semantic-forms: Found an input (${input.id||input.getAttribute("name")}) without a properly associated label. Make sure there is a label for it and the label has a matching "for" attribute.`);input.classList.add("semanticform");const isWrapped=input.closest("dd").parentElement.nodeName==="DIV";
|
|
70
70
|
// #region create labels
|
|
71
|
-
const newLabel=document.createElement("label");newLabel.className="floatLabelFormAnimatedLabel";if(type==="checkbox"||type==="radio"){
|
|
72
|
-
//
|
|
73
|
-
|
|
74
|
-
//
|
|
75
|
-
if(
|
|
71
|
+
const newLabel=document.createElement("label");newLabel.className="floatLabelFormAnimatedLabel";if(type==="checkbox"||type==="radio"){const div=isWrapped?input.closest("dd").parentElement:document.createElement("div");const dt=label.closest("dt");const dd=input.closest("dd");if(!dt||!dd){console.error(`semantic-forms: Found an input (${input.id||input.getAttribute("name")}) that is not inside a <dd> element.`);return}if(dd.firstChild.nodeName!=="LABEL"){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)}if(type==="radio"&&input.parentNode.nodeName==="DD"){newLabel.setAttribute("for",input.id);input.parentNode.classList.add("singleRadio");newLabel.className="";label.setAttribute("hidden","hidden");insertAfter(newLabel,input)}newLabel.innerHTML=label.innerHTML;if(label.hasAttribute("title")&&label.getAttribute("data-show-help-icon")!==null&&!label.querySelector("span.help")){const text=label.getAttribute("title");label.innerHTML+=` <span title="${text}" class="help">${icons.helpIcon}</span>`;newLabel.innerHTML+=` <span title="${text}" class="help">${icons.helpIcon}</span>`}if(dd.querySelector(":required")&&label.getAttribute("data-no-asterisk")===null&&!label.querySelector("span.required")){const text=label.getAttribute("data-asterisk-text")||"This field is required.";label.innerHTML+=` <span title="${text}" class="required">*</span>`;newLabel.innerHTML+=` <span title="${text}" class="required">*</span>`}if(!dd.querySelector("label"))dd.append(newLabel)}
|
|
72
|
+
// if the user did not wrap the input in a div, do it for them
|
|
73
|
+
if(!isWrapped){div.append(dt,dd);
|
|
74
|
+
// determine visibility of newly created <div>
|
|
75
|
+
if(dt.style.display==="none"&&dd.style.display==="none")div.style.display="none"}dl.append(div)}else{newLabel.setAttribute("for",input.id);newLabel.innerHTML=label.innerHTML;if(input.hasAttribute("title")&&label.getAttribute("data-show-help-icon")!==null&&!label.querySelector("span.help")){const text=input.getAttribute("title");newLabel.innerHTML+=` <span title="${text}" class="help">${icons.helpIcon}</span>`}if(input.hasAttribute("required")&&label.getAttribute("data-no-asterisk")===null&&!label.querySelector("span.required")){const text=label.getAttribute("data-asterisk-text")||"This field is required.";newLabel.innerHTML+=` <span title="${text}" class="required">*</span>`}label.setAttribute("hidden","hidden");insertAfter(newLabel,input)}
|
|
76
76
|
// #endregion
|
|
77
77
|
// #region standard inputs
|
|
78
|
-
const isWrapped=input.closest("dd").parentElement.nodeName==="DIV";
|
|
79
78
|
// check for auto-grow attribute on textareas
|
|
80
79
|
if(input.getAttribute("data-auto-grow")!==null){
|
|
81
80
|
// progressively enhance inputs into textareas
|
|
@@ -92,9 +91,9 @@ if(/colspan-/.test(dd.className)){const match=dd.className.match(/colspan-([0-9]
|
|
|
92
91
|
// this may be removed once fully supported in Firefox and Safari: https://caniuse.com/wf-field-sizing
|
|
93
92
|
if(input.getAttribute("data-max-content")!==null)if(!("fieldSizing"in document.createElement("input").style)){const adjustWidth=()=>{const value=input.value!==""?input.value:input.placeholder;const width=value.length*8+40;input.style.width=width+"px";input.style.maxWidth="100%"};adjustWidth();input.addEventListener("input",adjustWidth)}
|
|
94
93
|
// if the user did not wrap the input in a div, do it for them
|
|
95
|
-
if(!isWrapped){div.append(dt,dd);
|
|
94
|
+
if(!isWrapped){div.append(dt,dd);
|
|
96
95
|
// determine visibility of newly created <div>
|
|
97
|
-
if(dt.style.display==="none"&&dd.style.display==="none")div.style.display="none"}}
|
|
96
|
+
if(dt.style.display==="none"&&dd.style.display==="none")div.style.display="none"}dl.append(div)}
|
|
98
97
|
// #endregion
|
|
99
98
|
// handle file input clear btn, cannot be handled with CSS
|
|
100
99
|
if(type==="file"){const clearBtn=input.parentElement.querySelector(".clear");input.addEventListener("input",event=>{clearBtn.style.display=event.target.files.length?"flex":"none"});clearBtn.addEventListener("click",()=>{clearBtn.style.display="none"})}
|
|
@@ -135,7 +134,7 @@ const shiftClearBtn=()=>{const clearBtn=input.parentElement?.querySelector("butt
|
|
|
135
134
|
// handle undo/redo
|
|
136
135
|
if((event.ctrlKey||event.metaKey)&&event.key==="z"&&!event.shiftKey){
|
|
137
136
|
// undo clearing a field
|
|
138
|
-
if(lastFocusedInput)if(lastFocusedInput?.parentNode?.querySelector("button.clear").id===`semanticFormsClearButton_${lastClearFieldPressed}`||lastFocusedInput?.parentNode?.querySelector("button.clear").name===`semanticFormsClearButton_${lastClearFieldPressed}`)if(lastFocusedInput.previousValue){
|
|
137
|
+
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")
|
|
139
138
|
// redo clearing a field
|
|
140
139
|
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}};module.exports={enhanceInput,handleUndoRedo}
|
|
141
140
|
/***/}
|