material-inspired-component-library 1.1.1 → 1.2.2
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/README.md +4 -0
- package/components/bottomsheet/index.scss +18 -16
- package/components/button/index.scss +6 -2
- package/components/card/index.scss +5 -2
- package/components/checkbox/index.scss +5 -4
- package/components/dialog/index.scss +28 -23
- package/components/iconbutton/index.scss +6 -2
- package/components/list/README.md +51 -21
- package/components/list/index.scss +122 -57
- package/components/list/index.ts +1 -1
- package/components/menu/index.scss +17 -13
- package/components/radio/index.scss +8 -5
- package/components/select/index.scss +1 -3
- package/components/sidesheet/index.scss +21 -19
- package/components/slider/README.md +8 -0
- package/components/slider/index.scss +140 -51
- package/components/slider/index.ts +67 -31
- package/components/switch/index.scss +11 -8
- package/components/textfield/index.scss +8 -5
- package/dist/bottomsheet.css +1 -1
- package/dist/button.css +1 -1
- package/dist/card.css +1 -1
- package/dist/checkbox.css +1 -1
- package/dist/dialog.css +1 -1
- package/dist/iconbutton.css +1 -1
- package/dist/list.css +1 -1
- package/dist/menu.css +1 -1
- package/dist/micl.css +1 -1
- package/dist/micl.js +1 -1
- package/dist/radio.css +1 -1
- package/dist/select.css +1 -1
- package/dist/sidesheet.css +1 -1
- package/dist/slider.css +1 -1
- package/dist/switch.css +1 -1
- package/dist/textfield.css +1 -1
- package/docs/accordion.html +1 -1
- package/docs/bottomsheet.html +2 -2
- package/docs/button.html +1 -1
- package/docs/card.html +1 -1
- package/docs/checkbox.html +1 -1
- package/docs/dialog.html +6 -6
- package/docs/divider.html +1 -1
- package/docs/iconbutton.html +1 -1
- package/docs/index.html +2 -2
- package/docs/list.html +51 -34
- package/docs/menu.html +15 -11
- package/docs/micl.css +1 -1
- package/docs/micl.js +1 -1
- package/docs/radio.html +1 -1
- package/docs/select.html +11 -9
- package/docs/sidesheet.html +1 -1
- package/docs/slider.html +57 -21
- package/docs/switch.html +1 -1
- package/docs/textfield.html +1 -1
- package/micl.ts +5 -1
- package/package.json +1 -1
- package/styles/layout.scss +74 -0
package/docs/micl.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{"use strict";(()=>{const e="dialog.micl-bottomsheet",t=(()=>{var e=0;const t=t=>{let n=parseInt(window.getComputedStyle(t).getPropertyValue("max-height")),i=(t.dataset.snapheights||"").split(",").map(Number).filter(e=>!isNaN(e)&&e>0&&e<=n);return e||(e=t.getBoundingClientRect().height),[...new Set(i.concat([e,n]).sort())]},n=(e,n)=>{let i=e.getBoundingClientRect().height,o=t(e);return o.filter(e=>e>i+4)[0]||o[n?o.length-1:0]},i=(e,t)=>{e.style.setProperty("--md-sys-bottomsheet-height",`${t}px`)};return{initialize:e=>{if(!e.matches("dialog.micl-bottomsheet")||e.dataset.miclinitialized)return;e.dataset.miclinitialized="1";const o=e.querySelector(".micl-bottomsheet__headline");if(!o)return;const l=o.querySelector(".micl-bottomsheet__draghandle");l?.addEventListener("click",()=>{const t=n(e,!1);t>4&&i(e,t)});let r,a,c=!1,s=!1;function m(t){const n=t.clientY;c&&Math.abs(r-n)>4&&(c=!1,s=!0,e.classList.add("micl-bottomsheet--resizing")),s&&i(e,a+r-n)}function d(o){c=!1,e.classList.remove("micl-bottomsheet--resizing"),s&&(s=!1,o.clientY<r?i(e,n(e,!0)):e.getBoundingClientRect().height<48?(e.popover&&e.hidePopover(),i(e,a)):i(e,(e=>{let n=e.getBoundingClientRect().height,i=t(e),o=i.filter(e=>e<n-4);return o[o.length-1]||i[0]})(e)),document.removeEventListener("mousemove",m),document.removeEventListener("mouseup",d))}o.addEventListener("mousedown",t=>{t.eventPhase===Event.AT_TARGET&&(c=!0,t.preventDefault(),r=t.clientY,a=e.getBoundingClientRect().height,document.addEventListener("mousemove",m),document.addEventListener("mouseup",d))})},cleanup:e=>{e.matches("dialog.micl-bottomsheet")&&delete e.dataset.miclinitialized}}})(),n="button[popovertarget],button.micl-button--toggle",i=(()=>{const e=e=>{e.target&&e.target instanceof HTMLButtonElement&&(e.target.popoverTargetElement instanceof HTMLDialogElement&&(e.target.popoverTargetElement.open?e.target.popoverTargetElement.close():e.target.popoverTargetElement.showModal()),e.target.classList.contains("micl-button--toggle")&&e.target.classList.toggle("micl-button--selected"))};return{initialize:t=>{t.matches("button[popovertarget],button.micl-button--toggle")&&!t.dataset.miclinitialized&&(t.dataset.miclinitialized="1",(t.popoverTargetElement instanceof HTMLDialogElement&&!t.popoverTargetElement.hasAttribute("popover")||t.classList.contains("micl-button--toggle"))&&t.addEventListener("click",e))},cleanup:t=>{t.matches("button[popovertarget],button.micl-button--toggle")&&(document.removeEventListener("click",e),delete t.dataset.miclinitialized)}}})(),o=".micl-checkbox",l={keydown:e=>{if(e.target.matches(o)&&e instanceof KeyboardEvent&&e.target instanceof HTMLInputElement&&!e.target.disabled)switch(e.key){case"Enter":case" ":e.target.checked=!e.target.checked,e.preventDefault()}}},r=".micl-list-item-one,.micl-list-item-two,.micl-list-item-three",a=(()=>{const e=e=>!!e&&e.classList.contains("micl-list-item--disabled"),t=e=>!!e&&e.matches(":has(input[type=checkbox]:checked)");return{keydown:n=>{if(!(n instanceof KeyboardEvent&&n.target instanceof Element&&n.target.matches(".micl-list-item-one,.micl-list-item-two,.micl-list-item-three")))return;const i=n.target.parentElement;if(!i)return;let o=[];if(i instanceof HTMLDetailsElement?o=Array.from(i.parentElement?.children||[]).map(t=>{let n=t.querySelector(":scope > summary");return e(n)?null:n}).filter(e=>!!e):i instanceof HTMLUListElement&&(o=Array.from(i.children).map(t=>t instanceof HTMLLIElement&&!e(t)?t:null).filter(e=>!!e)),0===o.length)return;let l=o.findIndex(e=>t(e));-1===l&&(l=o.findIndex(e=>0===e.tabIndex)),-1===l&&(l=0);let r=l;switch(n.key){case"ArrowDown":r=(l+1)%o.length,n.preventDefault();break;case"ArrowUp":r=(l-1+o.length)%o.length,n.preventDefault();break;case"Tab":let e=o.findIndex(e=>t(e));-1===e?0!==l&&(o[l].tabIndex=-1,o[0].tabIndex=0):e!==l&&(o[l].tabIndex=-1,o[e].tabIndex=0);break;case"Enter":case" ":const i=n.target.querySelector("input[type=checkbox].micl-checkbox");i instanceof HTMLInputElement&&(i.checked=!i.checked)}r!==l&&(o[l].tabIndex=-1,o[r].tabIndex=0,o[r].focus())}}})(),c=".micl-menu[popover]",s=(()=>{const e=(e,t)=>{const n=e.getBoundingClientRect().y,i=t.getBoundingClientRect().y,o=window.getComputedStyle(t).getPropertyValue("transform-origin");return(n>i?"bottom ":"top ")+(parseInt(o)>0?"right":"left")};return{initialize:t=>{if(!t.matches(".micl-menu[popover]")||t.dataset.miclinitialized)return;t.dataset.miclinitialized="1";const n=document.querySelector(`[popovertarget="${t.id}"]`);n&&t.addEventListener("beforetoggle",i=>{"open"===i.oldState&&(t.style.transformOrigin=e(n,t))}),n&&t.addEventListener("toggle",i=>{"closed"===i.oldState&&(t.style.transformOrigin=e(n,t))})}}})(),m="input[type=range].micl-slider-xs,input[type=range].micl-slider-s,input[type=range].micl-slider-m,input[type=range].micl-slider-l,input[type=range].micl-slider-xl",d=(()=>{const e=String.fromCharCode(8226),t=String.fromCharCode(8201);return{initialize:n=>{n.style.setProperty("--md-sys-slider-max",n.max||"100"),n.style.setProperty("--md-sys-slider-min",n.min||"0"),n.style.setProperty("--md-sys-slider-value",n.value),n.style.setProperty("--md-sys-slider-tip",JSON.stringify(n.value+""));const i=n.getBoundingClientRect(),o=document.elementFromPoint(Math.max(i.x-1,0),Math.max(i.y-1,0));o&&(n.style.color=window.getComputedStyle(o).getPropertyValue("background-color"));const l=parseFloat(n.max),r=parseFloat(n.min),a=(e=>{const t=[],n=parseFloat(e.max),i=parseFloat(e.min);return e.list&&!isNaN(n)&&!isNaN(i)&&n>i&&e.list.querySelectorAll("option[value]").forEach(e=>{let o=parseFloat(e.value);!isNaN(o)&&o>=i&&o<=n&&t.push(o)}),t})(n).sort((e,t)=>e-t).map(e=>Math.round(100*(e-r)/(l-r)));if(a.length>0){const o=document.createElement("canvas"),l=o.getContext("2d");if(l){l.font=window.getComputedStyle(n).getPropertyValue("font");let o=l.measureText(t).width,r=l.measureText(e).width,c=i.width-10,s=0,m="";a.forEach(n=>{let i=c*n/100,l=Math.round((i-s)/o)-1;for(let e=0;e<l;e++)m+=t,s+=o;m+=e,s+=r}),n.dataset.miclsliderticks=m}o.remove()}else n.dataset.miclsliderticks=e},input:e=>{e.target.matches(".micl-slider-xs,.micl-slider-s,.micl-slider-m,.micl-slider-l,.micl-slider-xl")&&e.target instanceof HTMLInputElement&&!e.target.disabled&&(e.target.style.setProperty("--md-sys-slider-value",e.target.value),e.target.style.setProperty("--md-sys-slider-tip",JSON.stringify(e.target.value+"")))}}})(),u=".micl-textfield-outlined > input,.micl-textfield-filled > input",p=".micl-textfield-outlined > select,.micl-textfield-filled > select",g=".micl-textfield-outlined > textarea,.micl-textfield-filled > textarea",f=(()=>{const e=".micl-textfield__character-counter";return{initialize:t=>{if(t.dataset.miclinitialized)return;if(t.dataset.miclinitialized="1",t.value&&(t.dataset.miclvalue="1"),t instanceof HTMLSelectElement||!t.maxLength)return;const n=t.parentElement?.querySelector(e);n&&(n.textContent=`${t.value.length}/${t.maxLength}`)},input:t=>{if(!t.target.matches(`${u},${p},${g}`)||!(t.target instanceof HTMLInputElement||t.target instanceof HTMLSelectElement||t.target instanceof HTMLTextAreaElement)||!t.target.dataset.miclinitialized||t.target.disabled)return;if(t.target.value?t.target.dataset.miclvalue="1":delete t.target.dataset.miclvalue,t.target instanceof HTMLSelectElement||!t.target.maxLength)return;const n=t.target.parentElement?.querySelector(e);n&&(n.textContent=`${t.target.value.length}/${t.target.maxLength}`)}}})();(()=>{const h={[e]:{component:t,type:HTMLDialogElement},[n]:{component:i,type:HTMLButtonElement},[o]:{component:l,type:HTMLInputElement},[r]:{component:a,type:HTMLElement},[c]:{component:s,type:HTMLElement},[p]:{component:f,type:HTMLSelectElement},[m]:{component:d,type:HTMLInputElement},[g]:{component:f,type:HTMLTextAreaElement},[u]:{component:f,type:HTMLInputElement}},y=Object.keys(h).join(","),v=e=>{for(const[t,{component:n,type:i}]of Object.entries(h))if(e.matches(t)&&e instanceof i&&"function"==typeof n.initialize)return void n.initialize(e)},E=e=>{for(const[t,{component:n,type:i}]of Object.entries(h))if(e.matches(t)&&e instanceof i&&"function"==typeof n.cleanup)return void n.cleanup(e)};new MutationObserver(e=>{e.forEach(e=>{"childList"===e.type&&(e.addedNodes.forEach(e=>{e instanceof HTMLElement&&(e.matches(y)&&v(e),e.querySelectorAll(y).forEach(v))}),e.removedNodes.forEach(e=>{e instanceof HTMLElement&&(e.matches(y)&&E(e),e.querySelectorAll(y).forEach(E))}))})}).observe(document.body,{childList:!0,subtree:!0}),document.querySelectorAll(y).forEach(v),document.querySelectorAll('[class*="micl-"]').forEach(e=>{window.getComputedStyle(e).getPropertyValue("--miclripple")&&e.addEventListener("pointerdown",t=>{if(t.currentTarget.classList.contains("micl-card--nonactionable"))return;const n=t.clientX,i=t.clientY,o=e.getBoundingClientRect(),l=2*Math.sqrt(Math.pow(o.width,2)+Math.pow(o.height,2));e.style.cssText="--s:0;--o:1;",e.offsetTop,e.style.cssText=`--t:1;--o:0;--d:${l};--x:${n-o.left};--y:${i-o.top}`})}),document.addEventListener("input",e=>{for(const[t,{component:n,type:i}]of Object.entries(h))if(e.target.matches(t)&&e.target instanceof i&&"function"==typeof n.input)return void n.input(e)}),document.addEventListener("keydown",e=>{for(const[t,{component:n,type:i}]of Object.entries(h))if(e.target.matches(t)&&e.target instanceof i&&"function"==typeof n.keydown)return void n.keydown(e)})})()})()})();
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.micl=t():e.micl=t()}(self,()=>(()=>{"use strict";var e={d:(t,n)=>{for(var i in n)e.o(n,i)&&!e.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:n[i]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};return(()=>{e.r(t),e.d(t,{default:()=>v});const n="dialog.micl-bottomsheet",i=(()=>{var e=0;const t=t=>{let n=parseInt(window.getComputedStyle(t).getPropertyValue("max-height")),i=(t.dataset.snapheights||"").split(",").map(Number).filter(e=>!isNaN(e)&&e>0&&e<=n);return e||(e=t.getBoundingClientRect().height),[...new Set(i.concat([e,n]).sort())]},n=(e,n)=>{let i=e.getBoundingClientRect().height,o=t(e);return o.filter(e=>e>i+4)[0]||o[n?o.length-1:0]},i=(e,t)=>{e.style.setProperty("--md-sys-bottomsheet-height",`${t}px`)};return{initialize:e=>{if(!e.matches("dialog.micl-bottomsheet")||e.dataset.miclinitialized)return;e.dataset.miclinitialized="1";const o=e.querySelector(".micl-bottomsheet__headline");if(!o)return;const r=o.querySelector(".micl-bottomsheet__draghandle");r?.addEventListener("click",()=>{const t=n(e,!1);t>4&&i(e,t)});let l,a,s=!1,c=!1;function m(t){const n=t.clientY;s&&Math.abs(l-n)>4&&(s=!1,c=!0,e.classList.add("micl-bottomsheet--resizing")),c&&i(e,a+l-n)}function d(o){s=!1,e.classList.remove("micl-bottomsheet--resizing"),c&&(c=!1,o.clientY<l?i(e,n(e,!0)):e.getBoundingClientRect().height<48?(e.popover&&e.hidePopover(),i(e,a)):i(e,(e=>{let n=e.getBoundingClientRect().height,i=t(e),o=i.filter(e=>e<n-4);return o[o.length-1]||i[0]})(e)),document.removeEventListener("mousemove",m),document.removeEventListener("mouseup",d))}o.addEventListener("mousedown",t=>{t.eventPhase===Event.AT_TARGET&&(s=!0,t.preventDefault(),l=t.clientY,a=e.getBoundingClientRect().height,document.addEventListener("mousemove",m),document.addEventListener("mouseup",d))})},cleanup:e=>{e.matches("dialog.micl-bottomsheet")&&delete e.dataset.miclinitialized}}})(),o="button[popovertarget],button.micl-button--toggle",r=(()=>{const e=e=>{e.target&&e.target instanceof HTMLButtonElement&&(e.target.popoverTargetElement instanceof HTMLDialogElement&&(e.target.popoverTargetElement.open?e.target.popoverTargetElement.close():e.target.popoverTargetElement.showModal()),e.target.classList.contains("micl-button--toggle")&&e.target.classList.toggle("micl-button--selected"))};return{initialize:t=>{t.matches("button[popovertarget],button.micl-button--toggle")&&!t.dataset.miclinitialized&&(t.dataset.miclinitialized="1",(t.popoverTargetElement instanceof HTMLDialogElement&&!t.popoverTargetElement.hasAttribute("popover")||t.classList.contains("micl-button--toggle"))&&t.addEventListener("click",e))},cleanup:t=>{t.matches("button[popovertarget],button.micl-button--toggle")&&(document.removeEventListener("click",e),delete t.dataset.miclinitialized)}}})(),l=".micl-checkbox",a={keydown:e=>{if(e.target.matches(l)&&e instanceof KeyboardEvent&&e.target instanceof HTMLInputElement&&!e.target.disabled)switch(e.key){case"Enter":case" ":e.target.checked=!e.target.checked,e.preventDefault()}}},s=".micl-list-item-one,.micl-list-item-two,.micl-list-item-three",c=(()=>{const e=e=>!!e&&e.classList.contains("micl-list-item--disabled"),t=e=>!!e&&e.matches(":has(input[type=checkbox]:checked)");return{keydown:n=>{if(!(n instanceof KeyboardEvent&&n.target instanceof Element&&n.target.matches(".micl-list-item-one,.micl-list-item-two,.micl-list-item-three")))return;const i=n.target.parentElement;if(!i)return;let o=[];if(i instanceof HTMLDetailsElement?o=Array.from(i.parentElement?.children||[]).map(t=>{let n=t.querySelector(":scope > summary");return e(n)?null:n}).filter(e=>!!e):i instanceof HTMLUListElement&&(o=Array.from(i.children).map(t=>t instanceof HTMLLIElement&&!e(t)?t:null).filter(e=>!!e)),0===o.length)return;let r=o.findIndex(e=>t(e));-1===r&&(r=o.findIndex(e=>0===e.tabIndex)),-1===r&&(r=0);let l=r;switch(n.key){case"ArrowDown":l=(r+1)%o.length,n.preventDefault();break;case"ArrowUp":l=(r-1+o.length)%o.length,n.preventDefault();break;case"Tab":let e=o.findIndex(e=>t(e));-1===e?0!==r&&(o[r].tabIndex=-1,o[0].tabIndex=0):e!==r&&(o[r].tabIndex=-1,o[e].tabIndex=0);break;case"Enter":case" ":const i=n.target.querySelector("input[type=checkbox]");i instanceof HTMLInputElement&&(i.checked=!i.checked)}l!==r&&(o[r].tabIndex=-1,o[l].tabIndex=0,o[l].focus())}}})(),m=".micl-menu[popover]",d=(()=>{const e=(e,t)=>{const n=e.getBoundingClientRect().y,i=t.getBoundingClientRect().y,o=window.getComputedStyle(t).getPropertyValue("transform-origin");return(n>i?"bottom ":"top ")+(parseInt(o)>0?"right":"left")};return{initialize:t=>{if(!t.matches(".micl-menu[popover]")||t.dataset.miclinitialized)return;t.dataset.miclinitialized="1";const n=document.querySelector(`[popovertarget="${t.id}"]`);n&&t.addEventListener("beforetoggle",i=>{"open"===i.oldState&&(t.style.transformOrigin=e(n,t))}),n&&t.addEventListener("toggle",i=>{"closed"===i.oldState&&(t.style.transformOrigin=e(n,t))})}}})(),u="input[type=range].micl-slider-xs,input[type=range].micl-slider-s,input[type=range].micl-slider-m,input[type=range].micl-slider-l,input[type=range].micl-slider-xl",p=(()=>{const e=String.fromCharCode(8226),t=String.fromCharCode(8201),n=e=>e.parentElement?.classList.contains("micl-slider__container")?e.parentElement:null,i=(e,t)=>{e.dataset.miclsliderticks=t},o=e=>{let t=JSON.stringify(e.value+""),i=n(e);i&&(i.style.setProperty("--md-sys-slider-value",e.value),i.style.setProperty("--md-sys-slider-tip",t)),e.style.setProperty("--md-sys-slider-value",e.value),e.style.setProperty("--md-sys-slider-tip",t)};return{initialize:r=>{if(!r.matches(u))return;(e=>{let t=e.max||"100";n(e)?.style.setProperty("--md-sys-slider-max",t),e.style.setProperty("--md-sys-slider-max",t)})(r),(e=>{let t=e.min||"0";n(e)?.style.setProperty("--md-sys-slider-min",t),e.style.setProperty("--md-sys-slider-min",t)})(r),o(r),(e=>{let t=n(e);if(t){const n=window.getComputedStyle(e);["--md-sys-slider-handle-height","--md-sys-slider-track-height"].forEach(e=>{t.style.setProperty(e,n.getPropertyValue(e))})}})(r);const l=parseFloat(r.max),a=parseFloat(r.min),s=r.getBoundingClientRect(),c=((e,t,n)=>{const i=[];return e.list&&t>n&&e.list.querySelectorAll("option[value]").forEach(e=>{let o=parseFloat(e.value);!isNaN(o)&&o>=n&&o<=t&&i.push(o)}),i})(r,l,a).sort((e,t)=>e-t).map(e=>Math.round(100*(e-a)/(l-a)));if(c.length>0){const n=document.createElement("canvas"),o=n.getContext("2d");if(o){o.font=window.getComputedStyle(r).getPropertyValue("font");let n=o.measureText(t).width,l=o.measureText(e).width,a=s.width-10,m=0,d="";c.forEach(i=>{let o=a*i/100,r=Math.round((o-m)/n)-1;for(let e=0;e<r;e++)d+=t,m+=n;d+=e,m+=l}),i(r,d)}n.remove()}else i(r,e)},input:e=>{e.target.matches(u)&&e.target instanceof HTMLInputElement&&!e.target.disabled&&o(e.target)}}})(),g=".micl-textfield-outlined > input,.micl-textfield-filled > input",f=".micl-textfield-outlined > select,.micl-textfield-filled > select",y=".micl-textfield-outlined > textarea,.micl-textfield-filled > textarea",h=(()=>{const e=".micl-textfield__character-counter";return{initialize:t=>{if(t.dataset.miclinitialized)return;if(t.dataset.miclinitialized="1",t.value&&(t.dataset.miclvalue="1"),t instanceof HTMLSelectElement||!t.maxLength)return;const n=t.parentElement?.querySelector(e);n&&(n.textContent=`${t.value.length}/${t.maxLength}`)},input:t=>{if(!t.target.matches(`${g},${f},${y}`)||!(t.target instanceof HTMLInputElement||t.target instanceof HTMLSelectElement||t.target instanceof HTMLTextAreaElement)||!t.target.dataset.miclinitialized||t.target.disabled)return;if(t.target.value?t.target.dataset.miclvalue="1":delete t.target.dataset.miclvalue,t.target instanceof HTMLSelectElement||!t.target.maxLength)return;const n=t.target.parentElement?.querySelector(e);n&&(n.textContent=`${t.target.value.length}/${t.target.maxLength}`)}}})(),v=(()=>{const e={[n]:{component:i,type:HTMLDialogElement},[o]:{component:r,type:HTMLButtonElement},[l]:{component:a,type:HTMLInputElement},[s]:{component:c,type:HTMLElement},[m]:{component:d,type:HTMLElement},[f]:{component:h,type:HTMLSelectElement},[u]:{component:p,type:HTMLInputElement},[y]:{component:h,type:HTMLTextAreaElement},[g]:{component:h,type:HTMLInputElement}},t=Object.keys(e).join(","),v=t=>{for(const[n,{component:i,type:o}]of Object.entries(e))if(t.matches(n)&&t instanceof o&&"function"==typeof i.initialize)return void i.initialize(t)},E=e=>{e.querySelectorAll(t).forEach(v),e.querySelectorAll('[class*="micl-"]').forEach(e=>{e.parentElement&&!window.getComputedStyle(e.parentElement).getPropertyValue("--miclripple")&&window.getComputedStyle(e).getPropertyValue("--miclripple")&&e.addEventListener("pointerdown",t=>{if(t.currentTarget.classList.contains("micl-card--nonactionable"))return;const n=t.clientX,i=t.clientY,o=e.getBoundingClientRect(),r=2*Math.sqrt(Math.pow(o.width,2)+Math.pow(o.height,2));e.style.cssText="--s:0;--o:1;",e.offsetTop,e.style.cssText=`--t:1;--o:0;--d:${r};--x:${n-o.left};--y:${i-o.top}`})})},b=t=>{for(const[n,{component:i,type:o}]of Object.entries(e))if(t.matches(n)&&t instanceof o&&"function"==typeof i.cleanup)return void i.cleanup(t)},L=e=>{e.querySelectorAll(t).forEach(b)},x=()=>{new MutationObserver(e=>{e.forEach(e=>{"childList"===e.type&&(e.addedNodes.forEach(e=>{e instanceof HTMLElement&&(e.matches(t)&&v(e),e.querySelectorAll(t).forEach(v))}),e.removedNodes.forEach(e=>{e instanceof HTMLElement&&(e.matches(t)&&b(e),L(e))}))})}).observe(document.body,{childList:!0,subtree:!0}),E(document),document.addEventListener("input",t=>{for(const[n,{component:i,type:o}]of Object.entries(e))if(t.target.matches(n)&&t.target instanceof o&&"function"==typeof i.input)return void i.input(t)}),document.addEventListener("keydown",t=>{for(const[n,{component:i,type:o}]of Object.entries(e))if(t.target.matches(n)&&t.target instanceof o&&"function"==typeof i.keydown)return void i.keydown(t)})},T=()=>{document.removeEventListener("DOMContentLoaded",T),x()};return"loading"!==document.readyState?x():document.addEventListener("DOMContentLoaded",T),{initialize:()=>E(document),cleanup:()=>L(document)}})()})(),t})());
|
package/docs/radio.html
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
6
|
<title>MICL Radio Buttons</title>
|
|
7
7
|
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:FILL@0..1&icon_names=arrow_back,close,dark_mode&display=block">
|
|
8
|
-
<link rel="stylesheet" href="themes/
|
|
8
|
+
<link rel="stylesheet" href="themes/airblue/theme.css" id="theme-link">
|
|
9
9
|
<link rel="stylesheet" href="micl.css">
|
|
10
10
|
<link rel="stylesheet" href="docs.css">
|
|
11
11
|
<style>
|
package/docs/select.html
CHANGED
|
@@ -6,16 +6,18 @@
|
|
|
6
6
|
<title>MICL Selects</title>
|
|
7
7
|
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100..900;1,100..900&display=swap">
|
|
8
8
|
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:FILL@0..1&icon_names=check,confirmation_number,dark_mode,group,home,newspaper,person,settings&display=block">
|
|
9
|
-
<link rel="stylesheet" href="themes/
|
|
9
|
+
<link rel="stylesheet" href="themes/airblue/theme.css" id="theme-link">
|
|
10
10
|
<link rel="stylesheet" href="micl.css">
|
|
11
11
|
<link rel="stylesheet" href="docs.css">
|
|
12
12
|
<style>
|
|
13
13
|
.micl-card__content > .micl-textfield-outlined, .micl-card__content > .micl-textfield-filled {
|
|
14
14
|
margin: 32px 0;
|
|
15
15
|
}
|
|
16
|
+
#myselect3 option::checkmark {
|
|
17
|
+
display: none;
|
|
18
|
+
}
|
|
16
19
|
.micl-list-item__thumbnail {
|
|
17
|
-
height:
|
|
18
|
-
min-height: 32px;
|
|
20
|
+
height: 56px;
|
|
19
21
|
}
|
|
20
22
|
</style>
|
|
21
23
|
</head>
|
|
@@ -79,27 +81,27 @@
|
|
|
79
81
|
<label for="myselect3">Country</label>
|
|
80
82
|
<select id="myselect3">
|
|
81
83
|
<option class="micl-list-item-two" value=""></option>
|
|
82
|
-
<option class="micl-list-item-two" value="AR">
|
|
84
|
+
<option class="micl-list-item-two" style="--md-sys-list-item-thumbnail-aspect-ratio:1.594" value="AR">
|
|
83
85
|
<span class="micl-list-item__thumbnail" style="background-image:url(https://upload.wikimedia.org/wikipedia/commons/thumb/1/1a/Flag_of_Argentina.svg/330px-Flag_of_Argentina.svg.png)"></span>
|
|
84
86
|
<span class="micl-list-item__text" aria-description="Country code: AR">Argentina</span>
|
|
85
87
|
</option>
|
|
86
|
-
<option class="micl-list-item-two" value="BO">
|
|
88
|
+
<option class="micl-list-item-two" style="--md-sys-list-item-thumbnail-aspect-ratio:1.594" value="BO">
|
|
87
89
|
<span class="micl-list-item__thumbnail" style="background-image:url(https://upload.wikimedia.org/wikipedia/commons/thumb/b/b3/Bandera_de_Bolivia_%28Estado%29.svg/330px-Bandera_de_Bolivia_%28Estado%29.svg.png)"></span>
|
|
88
90
|
<span class="micl-list-item__text" aria-description="Country code: BO">Bolivia</span>
|
|
89
91
|
</option>
|
|
90
|
-
<option class="micl-list-item-two" value="BR">
|
|
92
|
+
<option class="micl-list-item-two" style="--md-sys-list-item-thumbnail-aspect-ratio:1.594" value="BR">
|
|
91
93
|
<span class="micl-list-item__thumbnail" style="background-image:url(https://upload.wikimedia.org/wikipedia/en/thumb/0/05/Flag_of_Brazil.svg/330px-Flag_of_Brazil.svg.png)"></span>
|
|
92
94
|
<span class="micl-list-item__text" aria-description="Country code: BR">Brazil</span>
|
|
93
95
|
</option>
|
|
94
|
-
<option class="micl-list-item-two" value="CL">
|
|
96
|
+
<option class="micl-list-item-two" style="--md-sys-list-item-thumbnail-aspect-ratio:1.594" value="CL">
|
|
95
97
|
<span class="micl-list-item__thumbnail" style="background-image:url(https://upload.wikimedia.org/wikipedia/commons/thumb/7/78/Flag_of_Chile.svg/330px-Flag_of_Chile.svg.png)"></span>
|
|
96
98
|
<span class="micl-list-item__text" aria-description="Country code: CL">Chile</span>
|
|
97
99
|
</option>
|
|
98
|
-
<option class="micl-list-item-two" value="CO" disabled>
|
|
100
|
+
<option class="micl-list-item-two" style="--md-sys-list-item-thumbnail-aspect-ratio:1.594" value="CO" disabled>
|
|
99
101
|
<span class="micl-list-item__thumbnail" style="background-image:url(https://upload.wikimedia.org/wikipedia/commons/thumb/2/21/Flag_of_Colombia.svg/330px-Flag_of_Colombia.svg.png)"></span>
|
|
100
102
|
<span class="micl-list-item__text" aria-description="Country code: CO">Colombia</span>
|
|
101
103
|
</option>
|
|
102
|
-
<option class="micl-list-item-two" value="EC">
|
|
104
|
+
<option class="micl-list-item-two" style="--md-sys-list-item-thumbnail-aspect-ratio:1.594" value="EC">
|
|
103
105
|
<span class="micl-list-item__thumbnail" style="background-image:url(https://upload.wikimedia.org/wikipedia/commons/thumb/e/e8/Flag_of_Ecuador.svg/330px-Flag_of_Ecuador.svg.png)"></span>
|
|
104
106
|
<span class="micl-list-item__text" aria-description="Country code: EC">Ecuador</span>
|
|
105
107
|
</option>
|
package/docs/sidesheet.html
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<title>MICL Side Sheets</title>
|
|
7
7
|
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100..900;1,100..900&display=swap">
|
|
8
8
|
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:FILL@0..1&icon_names=arrow_back,close,dark_mode&display=block">
|
|
9
|
-
<link rel="stylesheet" href="themes/
|
|
9
|
+
<link rel="stylesheet" href="themes/airblue/theme.css" id="theme-link">
|
|
10
10
|
<link rel="stylesheet" href="micl.css">
|
|
11
11
|
<link rel="stylesheet" href="docs.css">
|
|
12
12
|
<style>
|
package/docs/slider.html
CHANGED
|
@@ -8,18 +8,20 @@
|
|
|
8
8
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
9
9
|
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100..900;1,100..900&display=swap">
|
|
10
10
|
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:FILL@0..1&icon_names=dark_mode,volume_up&display=block">
|
|
11
|
-
<link rel="stylesheet" href="themes/
|
|
11
|
+
<link rel="stylesheet" href="themes/airblue/theme.css" id="theme-link">
|
|
12
12
|
<link rel="stylesheet" href="micl.css">
|
|
13
13
|
<link rel="stylesheet" href="docs.css">
|
|
14
14
|
<style>
|
|
15
|
-
.micl-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
margin: 64px 8px;
|
|
15
|
+
.micl-card__content {
|
|
16
|
+
display: flex;
|
|
17
|
+
flex-direction: column;
|
|
18
|
+
row-gap: 64px;
|
|
19
|
+
padding-block: 64px;
|
|
21
20
|
background-color: inherit;
|
|
22
21
|
}
|
|
22
|
+
.micl-card-filled .micl-card__content {
|
|
23
|
+
align-items: center;
|
|
24
|
+
}
|
|
23
25
|
.micl-card-elevated input[type=range] {
|
|
24
26
|
width: 100%;
|
|
25
27
|
}
|
|
@@ -36,35 +38,69 @@
|
|
|
36
38
|
|
|
37
39
|
<div class="cards">
|
|
38
40
|
<div class="micl-card-elevated">
|
|
39
|
-
<div class="
|
|
41
|
+
<div class="micl-card__content">
|
|
40
42
|
<input type="range" class="micl-slider-xs" min="1" max="10" value="6">
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
<input type="range" class="micl-slider-s" min="0" max="100" value="25" step="25" list="markers">
|
|
44
|
-
<datalist id="markers">
|
|
43
|
+
<input type="range" class="micl-slider-s" min="0" max="100" value="25" step="25" list="markers1">
|
|
44
|
+
<datalist id="markers1">
|
|
45
45
|
<option value="0"></option>
|
|
46
46
|
<option value="25"></option>
|
|
47
47
|
<option value="50"></option>
|
|
48
48
|
<option value="75"></option>
|
|
49
49
|
<option value="100"></option>
|
|
50
50
|
</datalist>
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
</div>
|
|
56
|
-
<div class="range">
|
|
51
|
+
<div class="range micl-slider__container">
|
|
52
|
+
<span class="micl-slider__icon material-symbols-outlined">volume_up</span>
|
|
53
|
+
<input type="range" class="micl-slider-m" min="3.5" max="12.5" value="9.5" step="0.5">
|
|
54
|
+
</div>
|
|
57
55
|
<input type="range" class="micl-slider-l" value="0">
|
|
58
|
-
</div>
|
|
59
|
-
<div class="range">
|
|
60
56
|
<input type="range" class="micl-slider-xl" disabled>
|
|
61
57
|
</div>
|
|
62
58
|
</div>
|
|
63
59
|
<div class="micl-card-filled">
|
|
64
|
-
<div class="
|
|
60
|
+
<div class="micl-card__content">
|
|
65
61
|
<input type="range" class="micl-slider-xl micl-slider--vertical">
|
|
66
62
|
</div>
|
|
67
63
|
</div>
|
|
64
|
+
<div class="micl-card-elevated">
|
|
65
|
+
<div class="micl-card__headline-s">
|
|
66
|
+
<h2>Gecko browsers</h2>
|
|
67
|
+
</div>
|
|
68
|
+
<div class="micl-card__content">
|
|
69
|
+
<div class="micl-slider__container">
|
|
70
|
+
<input type="range" class="micl-slider-xs" min="1" max="10" value="6">
|
|
71
|
+
</div>
|
|
72
|
+
<div class="micl-slider__container">
|
|
73
|
+
<input type="range" class="micl-slider-s" min="0" max="100" value="25" step="25" list="markers2">
|
|
74
|
+
</div>
|
|
75
|
+
<datalist id="markers2">
|
|
76
|
+
<option value="0"></option>
|
|
77
|
+
<option value="25"></option>
|
|
78
|
+
<option value="50"></option>
|
|
79
|
+
<option value="75"></option>
|
|
80
|
+
<option value="100"></option>
|
|
81
|
+
</datalist>
|
|
82
|
+
<div class="micl-slider__container">
|
|
83
|
+
<span class="micl-slider__icon material-symbols-outlined">volume_up</span>
|
|
84
|
+
<input type="range" class="micl-slider-m" min="3.5" max="12.5" value="9.5" step="0.5">
|
|
85
|
+
</div>
|
|
86
|
+
<div class="micl-slider__container">
|
|
87
|
+
<input type="range" class="micl-slider-l" value="0">
|
|
88
|
+
</div>
|
|
89
|
+
<div class="micl-slider__container">
|
|
90
|
+
<input type="range" class="micl-slider-xl" disabled>
|
|
91
|
+
</div>
|
|
92
|
+
</div>
|
|
93
|
+
</div>
|
|
94
|
+
<div class="micl-card-filled">
|
|
95
|
+
<div class="micl-card__headline-s">
|
|
96
|
+
<h2>Gecko browsers</h2>
|
|
97
|
+
</div>
|
|
98
|
+
<div class="micl-card__content">
|
|
99
|
+
<div class="micl-slider__container">
|
|
100
|
+
<input type="range" class="micl-slider-xl micl-slider--vertical">
|
|
101
|
+
</div>
|
|
102
|
+
</div>
|
|
103
|
+
</div>
|
|
68
104
|
</div>
|
|
69
105
|
|
|
70
106
|
<script src="micl.js"></script>
|
package/docs/switch.html
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<title>MICL Switches</title>
|
|
7
7
|
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100..900;1,100..900&display=swap">
|
|
8
8
|
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:FILL@0..1&icon_names=dark_mode&display=block">
|
|
9
|
-
<link rel="stylesheet" href="themes/
|
|
9
|
+
<link rel="stylesheet" href="themes/airblue/theme.css" id="theme-link">
|
|
10
10
|
<link rel="stylesheet" href="micl.css">
|
|
11
11
|
<link rel="stylesheet" href="docs.css">
|
|
12
12
|
<style>
|
package/docs/textfield.html
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<title>MICL Text Fields</title>
|
|
7
7
|
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100..900;1,100..900&display=swap">
|
|
8
8
|
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:FILL@0..1&icon_names=cancel,credit_card,dark_mode,error,search&display=block">
|
|
9
|
-
<link rel="stylesheet" href="themes/
|
|
9
|
+
<link rel="stylesheet" href="themes/airblue/theme.css" id="theme-link">
|
|
10
10
|
<link rel="stylesheet" href="micl.css">
|
|
11
11
|
<link rel="stylesheet" href="docs.css">
|
|
12
12
|
<style>
|
package/micl.ts
CHANGED
|
@@ -72,7 +72,11 @@ export default (() =>
|
|
|
72
72
|
parent.querySelectorAll<HTMLElement>(selector).forEach(initializeComponent);
|
|
73
73
|
|
|
74
74
|
parent.querySelectorAll<HTMLElement>('[class*="micl-"]').forEach(element => {
|
|
75
|
-
if (
|
|
75
|
+
if (
|
|
76
|
+
element.parentElement
|
|
77
|
+
&& !window.getComputedStyle(element.parentElement).getPropertyValue('--miclripple')
|
|
78
|
+
&& window.getComputedStyle(element).getPropertyValue('--miclripple')
|
|
79
|
+
) {
|
|
76
80
|
element.addEventListener('pointerdown', e => {
|
|
77
81
|
if ((e.currentTarget as Element).classList.contains('micl-card--nonactionable')) {
|
|
78
82
|
return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "material-inspired-component-library",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.2",
|
|
4
4
|
"description": "The Material-Inspired Component Library (MICL) offers a collection of beautifully crafted components leveraging native HTML markup, designed to align with the Material Design 3 guidelines.",
|
|
5
5
|
"author": "MICL Hermana <micl.hermana@proton.me> (https://github.com/henkpb/micl)",
|
|
6
6
|
"license": "MIT",
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright © 2025 Hermana AS
|
|
3
|
+
//
|
|
4
|
+
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+
// of this software and associated documentation files (the "Software"), to deal
|
|
6
|
+
// in the Software without restriction, including without limitation the rights
|
|
7
|
+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
// copies of the Software, and to permit persons to whom the Software is
|
|
9
|
+
// furnished to do so, subject to the following conditions:
|
|
10
|
+
//
|
|
11
|
+
// The above copyright notice and this permission notice shall be included in all
|
|
12
|
+
// copies or substantial portions of the Software.
|
|
13
|
+
//
|
|
14
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
+
// SOFTWARE.
|
|
21
|
+
|
|
22
|
+
$md-sys-margin-compact: 0px;
|
|
23
|
+
$md-sys-margin-medium: 0px;
|
|
24
|
+
$md-sys-margin-expanded: 0px;
|
|
25
|
+
$md-sys-margin-large: 0px;
|
|
26
|
+
$md-sys-margin-extra-large: 0px;
|
|
27
|
+
|
|
28
|
+
$md-sys-spacer: 24px;
|
|
29
|
+
|
|
30
|
+
$md-sys-padding-xxs: 4px;
|
|
31
|
+
$md-sys-padding-xs: 8px;
|
|
32
|
+
$md-sys-padding-s: 12px;
|
|
33
|
+
$md-sys-padding-m: 16px;
|
|
34
|
+
$md-sys-padding-l: 20px;
|
|
35
|
+
$md-sys-padding-xl: 24px;
|
|
36
|
+
$md-sys-padding-xxl: 28px;
|
|
37
|
+
|
|
38
|
+
$md-sys-target-size: 48px;
|
|
39
|
+
|
|
40
|
+
:root {
|
|
41
|
+
--md-sys-margin-compact: $md-sys-margin-compact;
|
|
42
|
+
--md-sys-margin-medium: $md-sys-margin-medium;
|
|
43
|
+
--md-sys-margin-expanded: $md-sys-margin-expanded;
|
|
44
|
+
--md-sys-margin-large: $md-sys-margin-large;
|
|
45
|
+
--md-sys-margin-extra-large: $md-sys-margin-extra-large;
|
|
46
|
+
|
|
47
|
+
--md-sys-spacer: $md-sys-spacer;
|
|
48
|
+
|
|
49
|
+
--md-sys-padding-xxs: $md-sys-padding-xxs;
|
|
50
|
+
--md-sys-padding-xs: $md-sys-padding-xs;
|
|
51
|
+
--md-sys-padding-s: $md-sys-padding-s;
|
|
52
|
+
--md-sys-padding-m: $md-sys-padding-m;
|
|
53
|
+
--md-sys-padding-l: $md-sys-padding-l;
|
|
54
|
+
--md-sys-padding-xl: $md-sys-padding-xl;
|
|
55
|
+
--md-sys-padding-xxl: $md-sys-padding-xxl;
|
|
56
|
+
|
|
57
|
+
--md-sys-target-size: $md-sys-target-size;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.micl-pane-fixed {
|
|
61
|
+
display: flex;
|
|
62
|
+
flex: 0 0 auto;
|
|
63
|
+
flex-direction: row;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.micl-pane-flexible {
|
|
67
|
+
display: flex;
|
|
68
|
+
flex: 1 1 auto;
|
|
69
|
+
flex-direction: row;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.micl-pane__column {
|
|
73
|
+
display: flex;
|
|
74
|
+
}
|