@ulu/frontend 0.1.0-beta.72 → 0.1.0-beta.74
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 +12 -2
- package/dist/ulu-frontend.min.js +9 -4
- package/docs-dev/assets/main.js +494 -7738
- package/docs-dev/assets/style.css +166 -221
- package/docs-dev/changelog/index.html +22 -3
- package/docs-dev/changelog/updates-and-changes/index.html +5109 -0
- package/docs-dev/demos/card/index.html +16 -16
- package/docs-dev/demos/card-new/index.html +5088 -0
- package/docs-dev/demos/card-old/index.html +5223 -0
- package/docs-dev/demos/card.1/index.html +5223 -0
- package/docs-dev/demos/card.TRASH/index.html +5541 -0
- package/docs-dev/demos/data-table/index.html +100 -100
- package/docs-dev/demos/list-inline.1/index.html +4727 -0
- package/docs-dev/demos/modals/index.html +21 -1
- package/docs-dev/demos/popovers/index.html +0 -5483
- package/docs-dev/guide/updates-and-changes/index.html +5033 -0
- package/docs-dev/javascript/ui-modal-builder/index.html +5 -0
- package/js/ui/modal-builder.js +14 -4
- package/package.json +1 -1
- package/types/ui/index.d.ts +1 -1
- package/types/ui/modal-builder.d.ts +6 -0
- package/types/ui/modal-builder.d.ts.map +1 -1
- package/types/utils/index.d.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,9 +1,19 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 0.1.0-beta.74
|
|
4
|
+
|
|
5
|
+
- **js/ui/modal-builder.js**
|
|
6
|
+
- Add options for `labelledby`, `describedby` (pass id's)
|
|
7
|
+
- `labelledby` will be filled in automatically if using title option
|
|
8
|
+
- `describedby` is to mark optional description element
|
|
9
|
+
|
|
10
|
+
## 0.1.0-beta.73
|
|
11
|
+
|
|
12
|
+
- **js/ui/modal-builder.js** | Fix missing end tag in options.template
|
|
13
|
+
|
|
3
14
|
## 0.1.0-beta.72
|
|
4
15
|
|
|
5
|
-
- **scss/element**
|
|
6
|
-
- Change new mixin name "focus-ring-required-only"
|
|
16
|
+
- **scss/element** | Change new mixin name "focus-ring-required-only"
|
|
7
17
|
|
|
8
18
|
## 0.1.0-beta.71
|
|
9
19
|
|
package/dist/ulu-frontend.min.js
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
var ls=Object.defineProperty;var us=(n,e,t)=>e in n?ls(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var G=(n,e,t)=>us(n,typeof e!="symbol"?e+"":e,t);const Mi={iconClassClose:"css-icon css-icon--close",iconClassDragX:"css-icon css-icon--drag-x",iconClassPrevious:"css-icon css-icon--angle-left",iconClassNext:"css-icon css-icon--angle-right",cssvarPrefix:""};let it={...Mi};function cs(){return{...Mi}}function Pi(n){Object.assign(it,n)}function fs(){return{...it}}function Ii(n){if(!it.hasOwnProperty(n)){console.warn(`Attempted to access non-existent setting: ${n}`);return}return it[n]}function ds(n,e){it[n]=e}function Se(n,e){return{toString(){const t=Ii(n);return e?e(t):t}}}const ps=Object.freeze(Object.defineProperty({__proto__:null,getDefaultSettings:cs,getSetting:Ii,getSettings:fs,updateSetting:ds,updateSettings:Pi,wrapSettingString:Se},Symbol.toStringTag,{value:"Module"}));function Li(n,e,t,r){var o;return function(){var s=this,a=arguments,l=function(){o=null,n.apply(s,a)};clearTimeout(o),o=setTimeout(l,e)}}function vs(){return typeof window<"u"&&typeof window.document<"u"}function Di(n){return new DOMParser().parseFromString(n,"text/html").body.firstElementChild}vs()&&(hs(),ms());const gi={pageModified(n){n.dispatchEvent(new CustomEvent(Q("pageModified"),{bubbles:!0}))},pageResized(n){n.dispatchEvent(new CustomEvent(Q("pageResized"),{bubbles:!0}))},beforePrint(n){n.dispatchEvent(new CustomEvent(Q("beforePrint"),{bubbles:!0}))},afterPrint(n){n.dispatchEvent(new CustomEvent(Q("afterPrint"),{bubbles:!0}))}};function bt(n,e){gi[n]?gi[n](e):console.warn(`Unable to dispatch site event: ${n} in context:`,e)}function Q(n){return"ulu:"+n}function hs(){window.addEventListener("resize",Li(()=>bt("pageResized",document),250))}function ms(){window.addEventListener("beforeprint",()=>{bt("beforePrint",document)}),window.addEventListener("afterprint",()=>{bt("afterPrint",document)})}const bs=Object.freeze(Object.defineProperty({__proto__:null,dispatch:bt,getName:Q},Symbol.toStringTag,{value:"Module"})),ki=/^[{\[][\s\S]*[}\]]$/;function Ri(n){return n.replace(/^data-/,"").replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}function Fi(n,e){const t=n.dataset[e];try{return JSON.parse(t)}catch(r){return console.error(`Error getting JSON from dataset (${e}) -- "${t}"
|
|
2
2
|
`,n,r),{}}}function $i(n,e){const t=n.dataset[e];return t&&ki.test(t.trim())?Fi(n,e):t}function Ni(n,e){const t=n.getBoundingClientRect();return e.clientY<t.top||e.clientY>t.top+t.height||e.clientX<t.left||e.clientX>t.left+t.width}function qi(n,e={columnFirst:"position-column-first",columnLast:"position-column-last",rowFirst:"position-row-first",rowLast:"position-row-last"}){const t=[...n.children],r=[];let o;t.forEach(i=>{const s=i.getBoundingClientRect().y;o!==s&&r.push([]),r[r.length-1].push(i),o=s,i.classList.remove(...Object.values(e))}),r.forEach((i,s)=>{s===0&&i.forEach(a=>a.classList.add(e.rowFirst)),s==r.length-1&&i.forEach(a=>a.classList.add(e.rowLast)),i.forEach((a,l)=>{l===0&&a.classList.add(e.columnFirst),l==i.length-1&&a.classList.add(e.columnLast)})})}function Xr(n,e=document){return typeof n=="string"?e.querySelector(n):n instanceof Element?n:(console.warn("getElement: Invalid target type (expected String/Node)",n),null)}function Yr(n,e=document){return typeof n=="string"?[...e.querySelectorAll(n)]:n instanceof Element?[n]:Array.isArray(n)||n instanceof NodeList?[...n]:(console.warn("getElement: Invalid target type (expected String/Node/Array/Node List)",n),null)}function gt(n){return typeof n=="string"?n.split(" ").filter(e=>e!==""):Array.isArray(n)?n:n?(console.warn("resolveClassArray: Invalid class input type.",n),[]):[]}function Hi(n){const t={...{scrollableChild:document.body,container:window,propertyElement:document.documentElement,propName:"--ulu-scrollbar-width"},...n},{scrollableChild:r,container:o,propertyElement:i,propName:s}=t,a=Jr(r,o);i.style.setProperty(s,`${a}px`)}function Jr(n=document.body,e=window){return e.innerWidth-n.clientWidth}const gs=Object.freeze(Object.defineProperty({__proto__:null,addScrollbarProperty:Hi,dataAttributeToDatasetKey:Ri,getDatasetJson:Fi,getDatasetOptionalJson:$i,getElement:Xr,getElements:Yr,getScrollbarWidth:Jr,regexJsonString:ki,resolveClasses:gt,setPositionClasses:qi,wasClickOutside:Ni},Symbol.toStringTag,{value:"Module"}));function xs(){Hi()}const ys=Object.freeze(Object.defineProperty({__proto__:null,init:xs},Symbol.toStringTag,{value:"Module"}));function Qt(n,e){var t=n.indexOf(e);t>-1&&n.splice(t,1)}function _s(n,e){return`--${n}-${e}`}const at={debug:!1,warningsAlways:!0,errorsAlways:!0,outputContext:!1},Es="console"in window;function Qr(n){return Es&&at.debug&&((n==null?void 0:n.debug)||n==null)}function ws(n){var e;return typeof n=="object"&&((e=n==null?void 0:n.constructor)==null?void 0:e.name)}function ei(n,e,t){const r=ws(e)||"Logger";console[n](r,...t),at.outputContext&&console.log(`Context:
|
|
3
3
|
`,e)}function Ss(n){Object.assign(at,n)}function me(n,...e){Qr(n)&&ei("log",n,e)}function en(n,...e){(at.warningsAlways||Qr(n))&&ei("warn",n,e)}function re(n,...e){(at.errorsAlways||Qr(n))&&ei("error",n,e)}const Os=Object.freeze(Object.defineProperty({__proto__:null,log:me,logError:re,logWarning:en,set:Ss},Symbol.toStringTag,{value:"Module"})),Cs=n=>_s(n,"breakpoint");window.addEventListener(Q("pageResized"),()=>{xt.instances.forEach(n=>n.update())});const We=class We{constructor(e){Object.assign(this,We.defaults,e),this.active=null,this.previous=null,this.activeIndex=null,this.resizeDirection=null,this.previousIndex=null,this.breakpoints={},this.onChangeCallbacks=[],this.order.forEach(t=>this.breakpoints[t]=new Ts(t,this)),me(this,this),this.update(),We.instances.push(this)}onChange(e){this.onChangeCallbacks.push(e)}removeOnChange(e){Qt(this.onChangeCallbacks,e)}getBreakpointInPseudo(){return window.getComputedStyle(this.element,this.pseudoSelector).content.replace(/^"|"$/g,"")}getBreakpointInProperty(){return getComputedStyle(this.element).getPropertyValue(this.customProperty).trim()}getBreakpoint(){return this.valueFromPseudo?this.getBreakpointInPseudo():this.getBreakpointInProperty()}update(){const e=this.getBreakpoint();if(!e){re(this,"Unable to get current breakpoint, maybe order is incorrect? Breakpoint check skipped!");return}if(e===this.active)return;this.previous=this.active,this.previousIndex=this.activeIndex;const t=this.order.indexOf(e);this.active=e,this.activeIndex=t;const r=this.at(this.active),o=m=>this.at(m),i=this.order.slice(t).map(o),s=this.order.slice(0,t).map(o),a=this.order.slice(0,t+1).map(o),l=this.order.slice(t+1).map(o),u=this.order.slice().map(o);u.splice(t,1),me(this,"max:",i.map(m=>m.name).join()),me(this,"min:",a.map(m=>m.name).join()),i.forEach(m=>m._setDirection("max",!0)),a.forEach(m=>m._setDirection("min",!0)),r._setDirection("only",!0),s.forEach(m=>m._setDirection("max",!1)),l.forEach(m=>m._setDirection("min",!1)),u.forEach(m=>m._setDirection("only",!1)),this.previousIndex!==null&&(this.resizeDirection=this.previousIndex<t?"up":"down"),this.onChangeCallbacks.forEach(m=>m(this))}at(e){const t=this.breakpoints[e];return e||re(this,"Unable to find breakpoint for:",t),t}};G(We,"instances",[]),G(We,"defaults",{element:document==null?void 0:document.documentElement,valueFromPseudo:!1,customProperty:"--breakpoint",customProperty:Se("cssvarPrefix",Cs),pseudoSelector:":before",order:["none","small","medium","large"],debug:!1});let xt=We;class Zt{constructor(e,t){this.direction=e,this.active=!1,this.on=[],this.off=[],this.breakpoint=t}change(e){this.active!==e&&(e?this._call(!0):this.active&&this._call(!1),this.active=e)}_call(e){(e?this.on:this.off).forEach(r=>r()),me(this.breakpoint._manager,`Handlers called (${e?"on":"off"}): ${this.direction}`)}getHandlers(e){return typeof e!="object"?{on:e}:e}add(e){const t=this.getHandlers(e);t.on&&this.on.push(t.on),t.off&&this.off.push(t.off),this.active&&t.on&&(t.on(),me(this.breakpoint._manager,`Handler called immediately: ${this.direction}`,t.on))}remove(e){const t=this.getHandlers(e);t.on&&Qt(this.on,t.on),t.off&&Qt(this.off,t.off)}}class Ts{constructor(e,t){this.directions={max:new Zt("max",this),min:new Zt("min",this),only:new Zt("only",this)},this._manager=t,this.name=e}_setDirection(e,t){this.directions[e].change(t)}max(e){this.directions.max.add(e)}min(e){this.directions.min.add(e)}only(e){this.directions.only.add(e)}remove(e,t){(t?[t]:["max","min","only"]).forEach(o=>o.remove(e))}log(...e){e.unshift(`Breakpoint (${this.name}):`),this._manager.log.apply(this._manager,e)}}const As=Object.freeze(Object.defineProperty({__proto__:null,BreakpointManager:xt},Symbol.toStringTag,{value:"Module"}));let Ms=0;function ti(){return`ulu-uid-${++Ms}`}function yt(n){n.id||(n.id=ti())}const Ps=Object.freeze(Object.defineProperty({__proto__:null,ensureId:yt,newId:ti},Symbol.toStringTag,{value:"Module"})),Dt=class Dt{constructor(e,t){const{trigger:r,content:o}=e;if(!r||!o){re(this,"missing required elements (trigger or content)");return}const i=Object.assign({},Dt.defaults,t);this.elements=e,this.options=i,this.isOpen=!1,this.handlers={},yt(r),yt(o),this.debugLog(this,this),i.selfManaged||this.attachHandlers(),this.setup()}attachHandlers(){const{trigger:e,content:t}=this.elements,{focusoutCloses:r}=this.options;this.clickHandler=o=>{this.onClick(o)},this.focusoutHandler=o=>{r&&document.addEventListener("focusin",()=>{t.contains(document.activeElement)||this.close(o)},{once:!0})},e.addEventListener("click",this.clickHandler),t.addEventListener("focusout",this.focusoutHandler)}removeHandlers(){const{trigger:e,content:t}=this.elements;e.removeEventListener("click",this.clickHandler),t.removeEventListener("focusout",this.focusoutHandler)}onClick(e){this.toggle(e)}destroy(){this.removeHandlers(),this.destroyTemporaryHandlers()}debugLog(...e){this.options.debug&&me(this,...e)}setup(){const{trigger:e,content:t}=this.elements,{startOpen:r}=this.options;e.setAttribute("role","button"),e.setAttribute("aria-controls",t.id),t.setAttribute("aria-labelledby",e.id),this.setState(r)}createEvent(e,t){return new CustomEvent(Q("collapsible:"+e),{detail:t})}setState(e,t){const r={collapsible:this,isOpen:e,event:t};this.debugLog(this,"Set state",r);const{trigger:o,content:i}=this.elements,{openClass:s}=this.options,a=l=>l.classList[e?"add":"remove"](s);o.setAttribute("aria-expanded",e?"true":"false"),a(o),a(i),this.isOpen=e,this.options.onChange(r),o.dispatchEvent(this.createEvent("change",r)),e?this.setupTemporaryHandlers():this.destroyTemporaryHandlers()}setupTemporaryHandlers(){const{content:e,trigger:t}=this.elements,{clickOutsideCloses:r,escapeCloses:o}=this.options,i=a=>{const{target:l}=a,u=t.contains(l),m=e.contains(l);r&&!u&&!m&&this.close(a)},s=a=>{o&&a.key==="Escape"&&this.close(a)};document.addEventListener("click",i),document.addEventListener("keydown",s),this.handlers.onDocumentClick=i,this.handlers.onDocumentKeydown=s}destroyTemporaryHandlers(){const{onDocumentClick:e,onDocumentKeydown:t}=this.handlers;e&&document.removeEventListener("click",e),e&&document.removeEventListener("keydown",t)}open(e){this.setState(!0,e)}close(e){this.setState(!1,e)}toggle(e){this.setState(!this.isOpen,e)}};G(Dt,"defaults",{clickOutsideCloses:!1,focusoutCloses:!1,escapeCloses:!1,selfManaged:!1,startOpen:!1,openClass:"is-active",debug:!0,onChange(e){}});let _t=Dt;const Is=Object.freeze(Object.defineProperty({__proto__:null,Collapsible:_t},Symbol.toStringTag,{value:"Module"}));function $t(n){return e=>n.every(t=>Object.prototype.hasOwnProperty.call(e,t))}const he=class he{constructor(e){if(!he.hasRequiredOptions(e))throw new Error(`Missing a required options: ${he.requiredOptions.join(", ")}`);this.options=Object.assign({},he.defaults,e),this.logTitle=`ULU: ${this.options.type}:
|
|
4
|
-
`}init(e){var t;this.setupElements(e),(t=e.events)!=null&&t.length&&e.events.forEach(r=>{document.addEventListener(Q(r),()=>this.setupElements(e))})}setupElements(e){const{setup:t,key:r,withData:o,context:i}=e;this.queryAllInitial(r,o,i).forEach(a=>t(a,this))}getAttribute(e){const{baseAttribute:t}=this.options;return e?`${t}-${e}`:`${t}`}attributeSelector(e){return`[${this.getAttribute(e)}]`}attributeSelectorInitial(e){return`${this.attributeSelector(e)}:not([${this.getAttribute("init")}])`}queryAllInitial(e,t,r=document){return[...r.querySelectorAll(this.attributeSelectorInitial(e))].map(i=>({element:i,data:t?this.getData(i,e):null,initialize:()=>this.initializeElement(i)}))}initializeElement(e){e.setAttribute(this.getAttribute("init"),"")}getData(e,t){const r=Ri(this.getAttribute(t));return $i(e,r)}log(...e){console.log(this.logTitle,...e)}warn(...e){console.warn(this.logTitle,...e)}logError(...e){console.error(this.logTitle,...e)}};G(he,"defaults",{type:null,baseAttribute:null}),G(he,"requiredOptions",["type","baseAttribute"]),G(he,"hasRequiredOptions",$t(he.requiredOptions));let Y=he;const kt=class kt{constructor(e,t,r){(!t||!e)&&re(this,"Missing required elements 'control' or 'container'"),this.options=Object.assign({},kt.defaults,r),this.container=e,this.control=t,this.handlerMousedown=this.onMousedown.bind(this),this.control.addEventListener("mousedown",this.handlerMousedown)}destroy(){this.control.removeEventListener("mousedown",this.handlerMousedown)}onMousedown(e){const{overrideMaxWidth:t,fromLeft:r}=this.options,o=document.documentElement,i=document.defaultView,s=e.clientX,a=parseInt(i.getComputedStyle(this.container).width,10);t&&(this.container.style.maxWidth="none");const l=m=>{const f=r?-1:1;this.container.style.width=`${a+(m.clientX-s)*f}px`},u=()=>{o.removeEventListener("mousemove",l,!1)};o.addEventListener("mousemove",l,!1),o.addEventListener("mouseup",u,{capture:!0,once:!0})}};G(kt,"defaults",{debug:!1,overrideMaxWidth:!1,fromLeft:!1});let Et=kt;const Ls=Object.freeze(Object.defineProperty({__proto__:null,Resizer:Et},Symbol.toStringTag,{value:"Module"})),Ds=[".youtube-embedded-video",'iframe[title*="YouTube video player"]','iframe[src*="youtube.com/embed"]'];function Bi(n=document){ji(n).forEach(t=>{try{t.contentWindow.postMessage('{"event":"command","func":"stopVideo","args":""}',"*")}catch(r){console.error(r)}})}function Wi(n=document){ji(n).forEach(t=>{const{src:r}=t;r&&(t.src=r.split("?")[0]+"?rel=0&enablejsapi=1")})}function ji(n){return n.querySelectorAll(Ds.join(", "))}const ks=Object.freeze(Object.defineProperty({__proto__:null,pauseVideos:Bi,prepVideos:Wi},Symbol.toStringTag,{value:"Module"})),ni="data-ulu-dialog",Ge=new Y({type:"dialog",baseAttribute:ni}),Vi=Ge.getAttribute("close"),ri={nonModal:!1,documentEnd:!1,clickOutsideCloses:!0,pauseVideos:!0,preventScroll:!0,preventScrollShift:!0};let wt={...ri};function Rs(n){wt=Object.assign({},wt,n)}function Fs(){Ge.init({events:["pageModified"],withData:!0,setup({element:n,initialize:e,data:t}){Ki(n,t),e()}}),Ge.init({key:"trigger",events:["pageModified"],withData:!0,setup({element:n,initialize:e,data:t}){zi(n,t),e()}})}function zi(n,e){n.addEventListener("click",t);function t(r){var a;r.target.closest("a")&&r.preventDefault();const i=document.getElementById(e);if(!i){console.error("Could not locate dialog (id)",e);return}if(((a=i==null?void 0:i.tagName)==null?void 0:a.toLowerCase())!=="dialog"){console.error("Attempted to trigger non <dialog> element. Did you mean to use modal builder?");return}const s=Gi(i);i[s.nonModal?"show":"showModal"]()}}function Ki(n,e){const t=Object.assign({},wt,e),r=document.body;if(n.addEventListener("click",o),t.documentEnd&&r.appendChild(n),t.pauseVideos&&$s(n),!t.nonModal&&t.preventScroll){let i=r.style.overflow,s=r.style.paddingRight;n.addEventListener("toggle",a=>{const l=a.newState==="open";l&&(i=r.style.overflow,s=r.style.paddingRight),t.preventScrollShift&&(r.style.paddingRight=l?`${Jr()}px`:s),r.style.overflow=l?"hidden":i})}function o(i){const{target:s}=i,a=s.closest(Ge.attributeSelector("close"));(t.clickOutsideCloses&&s===n&&Ni(n,i)||a)&&(t.pauseVideos&&Ns(n),n.close())}}function Gi(n){return Object.assign({},wt,Ge.getData(n))}function $s(n){Wi(n)}function Ns(n){Bi(n),n.querySelectorAll("video").forEach(t=>t.pause())}const qs=Object.freeze(Object.defineProperty({__proto__:null,baseAttribute:ni,closeAttribute:Vi,defaults:ri,getDialogOptions:Gi,init:Fs,initializer:Ge,setDefaults:Rs,setupDialog:Ki,setupTrigger:zi},Symbol.toStringTag,{value:"Module"})),Le=new Y({type:"modal-builder",baseAttribute:"data-ulu-modal-builder"}),Ui={title:null,titleIcon:null,titleClass:"",nonModal:!1,documentEnd:!0,allowResize:!1,position:"center",bodyFills:!1,noBackdrop:!1,size:"default",print:!1,noMinHeight:!1,class:"",baseClass:"modal",classCloseIcon:Se("iconClassClose"),classResizerIcon:Se("iconClassDragX"),debug:!1,templateCloseIcon(n){const{baseClass:e,classCloseIcon:t}=n;return`<span class="${e}__close-icon ${t}" aria-hidden="true"></span>`},templateResizerIcon(n){const{baseClass:e,classResizerIcon:t}=n;return`<span class="${e}__resizer-icon ${t}" aria-hidden="true"></span>`},template(n,e){const{baseClass:t}=e,
|
|
5
|
-
<dialog
|
|
4
|
+
`}init(e){var t;this.setupElements(e),(t=e.events)!=null&&t.length&&e.events.forEach(r=>{document.addEventListener(Q(r),()=>this.setupElements(e))})}setupElements(e){const{setup:t,key:r,withData:o,context:i}=e;this.queryAllInitial(r,o,i).forEach(a=>t(a,this))}getAttribute(e){const{baseAttribute:t}=this.options;return e?`${t}-${e}`:`${t}`}attributeSelector(e){return`[${this.getAttribute(e)}]`}attributeSelectorInitial(e){return`${this.attributeSelector(e)}:not([${this.getAttribute("init")}])`}queryAllInitial(e,t,r=document){return[...r.querySelectorAll(this.attributeSelectorInitial(e))].map(i=>({element:i,data:t?this.getData(i,e):null,initialize:()=>this.initializeElement(i)}))}initializeElement(e){e.setAttribute(this.getAttribute("init"),"")}getData(e,t){const r=Ri(this.getAttribute(t));return $i(e,r)}log(...e){console.log(this.logTitle,...e)}warn(...e){console.warn(this.logTitle,...e)}logError(...e){console.error(this.logTitle,...e)}};G(he,"defaults",{type:null,baseAttribute:null}),G(he,"requiredOptions",["type","baseAttribute"]),G(he,"hasRequiredOptions",$t(he.requiredOptions));let Y=he;const kt=class kt{constructor(e,t,r){(!t||!e)&&re(this,"Missing required elements 'control' or 'container'"),this.options=Object.assign({},kt.defaults,r),this.container=e,this.control=t,this.handlerMousedown=this.onMousedown.bind(this),this.control.addEventListener("mousedown",this.handlerMousedown)}destroy(){this.control.removeEventListener("mousedown",this.handlerMousedown)}onMousedown(e){const{overrideMaxWidth:t,fromLeft:r}=this.options,o=document.documentElement,i=document.defaultView,s=e.clientX,a=parseInt(i.getComputedStyle(this.container).width,10);t&&(this.container.style.maxWidth="none");const l=m=>{const f=r?-1:1;this.container.style.width=`${a+(m.clientX-s)*f}px`},u=()=>{o.removeEventListener("mousemove",l,!1)};o.addEventListener("mousemove",l,!1),o.addEventListener("mouseup",u,{capture:!0,once:!0})}};G(kt,"defaults",{debug:!1,overrideMaxWidth:!1,fromLeft:!1});let Et=kt;const Ls=Object.freeze(Object.defineProperty({__proto__:null,Resizer:Et},Symbol.toStringTag,{value:"Module"})),Ds=[".youtube-embedded-video",'iframe[title*="YouTube video player"]','iframe[src*="youtube.com/embed"]'];function Bi(n=document){ji(n).forEach(t=>{try{t.contentWindow.postMessage('{"event":"command","func":"stopVideo","args":""}',"*")}catch(r){console.error(r)}})}function Wi(n=document){ji(n).forEach(t=>{const{src:r}=t;r&&(t.src=r.split("?")[0]+"?rel=0&enablejsapi=1")})}function ji(n){return n.querySelectorAll(Ds.join(", "))}const ks=Object.freeze(Object.defineProperty({__proto__:null,pauseVideos:Bi,prepVideos:Wi},Symbol.toStringTag,{value:"Module"})),ni="data-ulu-dialog",Ge=new Y({type:"dialog",baseAttribute:ni}),Vi=Ge.getAttribute("close"),ri={nonModal:!1,documentEnd:!1,clickOutsideCloses:!0,pauseVideos:!0,preventScroll:!0,preventScrollShift:!0};let wt={...ri};function Rs(n){wt=Object.assign({},wt,n)}function Fs(){Ge.init({events:["pageModified"],withData:!0,setup({element:n,initialize:e,data:t}){Ki(n,t),e()}}),Ge.init({key:"trigger",events:["pageModified"],withData:!0,setup({element:n,initialize:e,data:t}){zi(n,t),e()}})}function zi(n,e){n.addEventListener("click",t);function t(r){var a;r.target.closest("a")&&r.preventDefault();const i=document.getElementById(e);if(!i){console.error("Could not locate dialog (id)",e);return}if(((a=i==null?void 0:i.tagName)==null?void 0:a.toLowerCase())!=="dialog"){console.error("Attempted to trigger non <dialog> element. Did you mean to use modal builder?");return}const s=Gi(i);i[s.nonModal?"show":"showModal"]()}}function Ki(n,e){const t=Object.assign({},wt,e),r=document.body;if(n.addEventListener("click",o),t.documentEnd&&r.appendChild(n),t.pauseVideos&&$s(n),!t.nonModal&&t.preventScroll){let i=r.style.overflow,s=r.style.paddingRight;n.addEventListener("toggle",a=>{const l=a.newState==="open";l&&(i=r.style.overflow,s=r.style.paddingRight),t.preventScrollShift&&(r.style.paddingRight=l?`${Jr()}px`:s),r.style.overflow=l?"hidden":i})}function o(i){const{target:s}=i,a=s.closest(Ge.attributeSelector("close"));(t.clickOutsideCloses&&s===n&&Ni(n,i)||a)&&(t.pauseVideos&&Ns(n),n.close())}}function Gi(n){return Object.assign({},wt,Ge.getData(n))}function $s(n){Wi(n)}function Ns(n){Bi(n),n.querySelectorAll("video").forEach(t=>t.pause())}const qs=Object.freeze(Object.defineProperty({__proto__:null,baseAttribute:ni,closeAttribute:Vi,defaults:ri,getDialogOptions:Gi,init:Fs,initializer:Ge,setDefaults:Rs,setupDialog:Ki,setupTrigger:zi},Symbol.toStringTag,{value:"Module"})),Le=new Y({type:"modal-builder",baseAttribute:"data-ulu-modal-builder"}),Ui={title:null,titleIcon:null,titleClass:"",labelledby:null,describedby:null,nonModal:!1,documentEnd:!0,allowResize:!1,position:"center",bodyFills:!1,noBackdrop:!1,size:"default",print:!1,noMinHeight:!1,class:"",baseClass:"modal",classCloseIcon:Se("iconClassClose"),classResizerIcon:Se("iconClassDragX"),debug:!1,templateCloseIcon(n){const{baseClass:e,classCloseIcon:t}=n;return`<span class="${e}__close-icon ${t}" aria-hidden="true"></span>`},templateResizerIcon(n){const{baseClass:e,classResizerIcon:t}=n;return`<span class="${e}__resizer-icon ${t}" aria-hidden="true"></span>`},template(n,e){const{baseClass:t,describedby:r}=e,o=[t,`${t}--${e.position}`,`${t}--${e.size}`,`${t}--${e.allowResize?"resize":"no-resize"}`,...e.title?[]:[`${t}--no-header`],...e.bodyFills?[`${t}--body-fills`]:[],...e.noBackdrop?[`${t}--no-backdrop`]:[],...e.noMinHeight?[`${t}--no-min-height`]:[],...e.class?[e.class]:[]],i=e.title?`${n}--title`:e.labelledby;return`
|
|
5
|
+
<dialog
|
|
6
|
+
id="${n}"
|
|
7
|
+
class="${o.join(" ")}"
|
|
8
|
+
${i?`aria-labelledby="${i}"`:""}
|
|
9
|
+
${r?`aria-describedby="${r}"`:""}
|
|
10
|
+
>
|
|
6
11
|
${e.title?`
|
|
7
12
|
<header class="${t}__header">
|
|
8
|
-
<h2 class="${t}__title ${e.titleClass}">
|
|
13
|
+
<h2 id="${i}" class="${t}__title ${e.titleClass}">
|
|
9
14
|
${e.titleIcon?`<span class="${t}__title-icon ${e.titleIcon}" aria-hidden="true"></span>`:""}
|
|
10
15
|
<span class="${t}__title-text">${e.title}</span>
|
|
11
16
|
</h2>
|
|
@@ -18,7 +23,7 @@ var ls=Object.defineProperty;var us=(n,e,t)=>e in n?ls(n,e,{enumerable:!0,config
|
|
|
18
23
|
${e.hasResizer?`<div class="${t}__resizer" ${Le.getAttribute("resizer")}>
|
|
19
24
|
${e.templateResizerIcon(e)}
|
|
20
25
|
</div>`:""}
|
|
21
|
-
</
|
|
26
|
+
</dialog>
|
|
22
27
|
`}};let tn={...Ui};function Hs(n){tn=Object.assign({},tn,n)}function Bs(){Le.init({withData:!0,events:["pageModified"],setup({element:n,data:e}){Zi(n,e)}})}function Zi(n,e){const t=Object.assign({},tn,e);if(t.position!=="center"&&t.allowResize&&(t.hasResizer=!0),t.debug&&Le.log(t,n),!n.id)throw new Error("Missing ID on modal");const r=t.template(n.id,t),o=Di(r.trim()),i=u=>o.querySelector(Le.attributeSelector(u)),s=i("body"),a=i("resizer"),l=Ws(t);if(n.removeAttribute("id"),n.removeAttribute("hidden"),n.removeAttribute(Le.getAttribute()),n.parentNode.replaceChild(o,n),s.appendChild(n),o.setAttribute(ni,JSON.stringify(l)),t.hasResizer&&new Et(o,a,{fromLeft:t.position==="right"}),t.print){let u;document.addEventListener(Q("beforePrint"),()=>{u=n.cloneNode(!0),o.after(u)}),document.addEventListener(Q("afterPrint"),()=>{u.remove()})}return{modal:o}}function Ws(n){return Object.keys(ri).reduce((e,t)=>(t in n&&(e[t]=n[t]),e),{})}const js=Object.freeze(Object.defineProperty({__proto__:null,buildModal:Zi,defaults:Ui,init:Bs,initializer:Le,setDefaults:Hs},Symbol.toStringTag,{value:"Module"})),Vs=/(\r\n|\n|\r)/gm,zs=/\s+/g;function ht(n){return n.replace(Vs,"").replace(zs," ").trim()}const mt=new Y({type:"flipcard",baseAttribute:"data-ulu-flipcard"});function Ks(){mt.init({withData:!0,events:["pageModified"],setup({element:n,data:e,initialize:t}){const r=Object.assign({},e),o=n.querySelector(mt.attributeSelector("front")),i=n.querySelector(mt.attributeSelector("back"));new St(n,o,i,r),t()}})}const Ie=class Ie{constructor(e,t,r,o){r||re(this,"Missing an element (container, front, back)"),this.options=Object.assign({},Ie.defaults,o);const{namespace:i}=this.options;Ie.instances.push(this),this.elements={container:e,front:t,back:r},this.isOpen=!1,this.uid=`${i}-id-${Ie.instances.length}`,this.stateAttr=`data-${i}-state`.toLowerCase(),this.setup(),this.setVisibility(!1),me(this,this)}toggle(){this.setVisibility(!this.isOpen)}setup(){const{uid:e}=this,{namespace:t,proxyClick:r}=this.options,{container:o,front:i,back:s}=this.elements,a=this.elements.control=document.createElement("button");a.classList.add(this.getClass("control-button")),a.setAttribute("type","button"),a.innerHTML=this.createControlContent(),a.style.gridArea=t,a.style.zIndex="-1",a.addEventListener("focusin",()=>{a.style.zIndex="20"}),a.addEventListener("focusout",()=>{a.style.zIndex="-1"}),a.addEventListener("click",this.toggle.bind(this)),s.parentNode.insertBefore(a,s),o.classList.add(this.options.namespace),o.setAttribute("style",ht(this.containerCss())),r&&o.addEventListener("click",this.onProxyClick.bind(this)),i.style.gridArea=t,s.style.gridArea=t,a.id=`${e}-control`,a.setAttribute("aria-controls",s.id),a.setAttribute("aria-expanded","false"),s.id=`${e}-back`,s.setAttribute("aria-labelledby",a.id),s.setAttribute("aria-hidden","true")}onProxyClick({target:e}){const{exclude:t,allowSelection:r,selectionMin:o}=this.options.proxyClick,i=window.getSelection();t&&!e.matches(t)&&(!r||i.toString().length<o)&&this.toggle()}getClass(e){const{namespace:t}=this.options;return e?`${t}__${e}`:t}createControlContent(){return`
|
|
23
28
|
<span class="hidden-visually">Show More Information</span>
|
|
24
29
|
`}setVisibility(e){const{back:t,container:r,control:o}=this.elements,i=e?"open":"closed";t.style.zIndex=e?"10":"1",t.style.visibility=e?"visible":"hidden",r.setAttribute(this.stateAttr,i),t.setAttribute("aria-hidden",e?"false":"true"),o.setAttribute("aria-expanded",e?"true":"false"),this.isOpen=e}containerCss(){return`
|