lightning_ui_kit 0.1.3 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/assets/builds/lightning_ui_kit.css +1079 -1484
- data/app/assets/builds/lightning_ui_kit.js +2 -2
- data/app/assets/builds/lightning_ui_kit.js.map +3 -3
- data/app/assets/stylesheets/lightning_ui_kit/application.css +1 -1
- data/app/assets/vendor/lightning_ui_kit.css +2627 -0
- data/app/assets/vendor/lightning_ui_kit.js +5 -0
- data/app/components/lightning_ui_kit/alert_component.html.erb +1 -1
- data/app/components/lightning_ui_kit/alert_component.rb +1 -1
- data/app/components/lightning_ui_kit/avatar_component.html.erb +5 -5
- data/app/components/lightning_ui_kit/avatar_component.rb +3 -3
- data/app/components/lightning_ui_kit/badge_component.html.erb +1 -1
- data/app/components/lightning_ui_kit/badge_component.rb +19 -19
- data/app/components/lightning_ui_kit/banner_component.html.erb +6 -6
- data/app/components/lightning_ui_kit/banner_component.rb +3 -3
- data/app/components/lightning_ui_kit/button_component.rb +29 -28
- data/app/components/lightning_ui_kit/checkbox_component.html.erb +29 -8
- data/app/components/lightning_ui_kit/description_list/item_component.html.erb +3 -3
- data/app/components/lightning_ui_kit/description_list_component.html.erb +1 -1
- data/app/components/lightning_ui_kit/dropdown_component.html.erb +5 -5
- data/app/components/lightning_ui_kit/dropdown_component.rb +3 -3
- data/app/components/lightning_ui_kit/dropzone_component.html.erb +22 -22
- data/app/components/lightning_ui_kit/dropzone_component.rb +1 -1
- data/app/components/lightning_ui_kit/file_input_component.html.erb +6 -6
- data/app/components/lightning_ui_kit/file_input_component.rb +1 -1
- data/app/components/lightning_ui_kit/input_component.html.erb +30 -20
- data/app/components/lightning_ui_kit/input_component.rb +1 -1
- data/app/components/lightning_ui_kit/link_component.html.erb +1 -1
- data/app/components/lightning_ui_kit/modal_component.html.erb +7 -7
- data/app/components/lightning_ui_kit/pagination_component.html.erb +2 -2
- data/app/components/lightning_ui_kit/pagination_component.rb +5 -4
- data/app/components/lightning_ui_kit/select_component.html.erb +14 -9
- data/app/components/lightning_ui_kit/skeleton_component.html.erb +4 -4
- data/app/components/lightning_ui_kit/spinner_component.html.erb +1 -1
- data/app/components/lightning_ui_kit/switch_component.html.erb +27 -12
- data/app/components/lightning_ui_kit/table_component.html.erb +10 -10
- data/app/components/lightning_ui_kit/text_component.rb +1 -1
- data/app/components/lightning_ui_kit/textarea_component.html.erb +10 -8
- data/app/javascript/lightning_ui_kit/controllers/accordion_controller.js +22 -17
- data/app/javascript/lightning_ui_kit/controllers/banner_controller.js +3 -3
- data/app/javascript/lightning_ui_kit/controllers/dropdown_controller.js +2 -1
- data/app/javascript/lightning_ui_kit/controllers/dropzone_controller.js +5 -2
- data/lib/lightning_ui_kit/version.rb +1 -1
- metadata +4 -2
@@ -0,0 +1,5 @@
|
|
1
|
+
(()=>{var ht=Object.defineProperty;var ut=(r,e,t)=>e in r?ht(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var E=(r,e,t)=>(ut(r,typeof e!="symbol"?e+"":e,t),t);var M=(r,e,t)=>new Promise((s,o)=>{var h=g=>{try{f(t.next(g))}catch(v){o(v)}},d=g=>{try{f(t.throw(g))}catch(v){o(v)}},f=g=>g.done?s(g.value):Promise.resolve(g.value).then(h,d);f((t=t.apply(r,e)).next())});var ae=class{constructor(e,t,s){this.eventTarget=e,this.eventName=t,this.eventOptions=s,this.unorderedBindings=new Set}connect(){this.eventTarget.addEventListener(this.eventName,this,this.eventOptions)}disconnect(){this.eventTarget.removeEventListener(this.eventName,this,this.eventOptions)}bindingConnected(e){this.unorderedBindings.add(e)}bindingDisconnected(e){this.unorderedBindings.delete(e)}handleEvent(e){let t=dt(e);for(let s of this.bindings){if(t.immediatePropagationStopped)break;s.handleEvent(t)}}hasBindings(){return this.unorderedBindings.size>0}get bindings(){return Array.from(this.unorderedBindings).sort((e,t)=>{let s=e.index,o=t.index;return s<o?-1:s>o?1:0})}};function dt(r){if("immediatePropagationStopped"in r)return r;{let{stopImmediatePropagation:e}=r;return Object.assign(r,{immediatePropagationStopped:!1,stopImmediatePropagation(){this.immediatePropagationStopped=!0,e.call(this)}})}}var ce=class{constructor(e){this.application=e,this.eventListenerMaps=new Map,this.started=!1}start(){this.started||(this.started=!0,this.eventListeners.forEach(e=>e.connect()))}stop(){this.started&&(this.started=!1,this.eventListeners.forEach(e=>e.disconnect()))}get eventListeners(){return Array.from(this.eventListenerMaps.values()).reduce((e,t)=>e.concat(Array.from(t.values())),[])}bindingConnected(e){this.fetchEventListenerForBinding(e).bindingConnected(e)}bindingDisconnected(e,t=!1){this.fetchEventListenerForBinding(e).bindingDisconnected(e),t&&this.clearEventListenersForBinding(e)}handleError(e,t,s={}){this.application.handleError(e,`Error ${t}`,s)}clearEventListenersForBinding(e){let t=this.fetchEventListenerForBinding(e);t.hasBindings()||(t.disconnect(),this.removeMappedEventListenerFor(e))}removeMappedEventListenerFor(e){let{eventTarget:t,eventName:s,eventOptions:o}=e,h=this.fetchEventListenerMapForEventTarget(t),d=this.cacheKey(s,o);h.delete(d),h.size==0&&this.eventListenerMaps.delete(t)}fetchEventListenerForBinding(e){let{eventTarget:t,eventName:s,eventOptions:o}=e;return this.fetchEventListener(t,s,o)}fetchEventListener(e,t,s){let o=this.fetchEventListenerMapForEventTarget(e),h=this.cacheKey(t,s),d=o.get(h);return d||(d=this.createEventListener(e,t,s),o.set(h,d)),d}createEventListener(e,t,s){let o=new ae(e,t,s);return this.started&&o.connect(),o}fetchEventListenerMapForEventTarget(e){let t=this.eventListenerMaps.get(e);return t||(t=new Map,this.eventListenerMaps.set(e,t)),t}cacheKey(e,t){let s=[e];return Object.keys(t).sort().forEach(o=>{s.push(`${t[o]?"":"!"}${o}`)}),s.join(":")}},ft={stop({event:r,value:e}){return e&&r.stopPropagation(),!0},prevent({event:r,value:e}){return e&&r.preventDefault(),!0},self({event:r,value:e,element:t}){return e?t===r.target:!0}},gt=/^(?:(?:([^.]+?)\+)?(.+?)(?:\.(.+?))?(?:@(window|document))?->)?(.+?)(?:#([^:]+?))(?::(.+))?$/;function pt(r){let t=r.trim().match(gt)||[],s=t[2],o=t[3];return o&&!["keydown","keyup","keypress"].includes(s)&&(s+=`.${o}`,o=""),{eventTarget:mt(t[4]),eventName:s,eventOptions:t[7]?bt(t[7]):{},identifier:t[5],methodName:t[6],keyFilter:t[1]||o}}function mt(r){if(r=="window")return window;if(r=="document")return document}function bt(r){return r.split(":").reduce((e,t)=>Object.assign(e,{[t.replace(/^!/,"")]:!/^!/.test(t)}),{})}function vt(r){if(r==window)return"window";if(r==document)return"document"}function Se(r){return r.replace(/(?:[_-])([a-z0-9])/g,(e,t)=>t.toUpperCase())}function le(r){return Se(r.replace(/--/g,"-").replace(/__/g,"_"))}function R(r){return r.charAt(0).toUpperCase()+r.slice(1)}function Xe(r){return r.replace(/([A-Z])/g,(e,t)=>`-${t.toLowerCase()}`)}function yt(r){return r.match(/[^\s]+/g)||[]}function Pe(r){return r!=null}function he(r,e){return Object.prototype.hasOwnProperty.call(r,e)}var Ue=["meta","ctrl","alt","shift"],ue=class{constructor(e,t,s,o){this.element=e,this.index=t,this.eventTarget=s.eventTarget||e,this.eventName=s.eventName||Et(e)||Y("missing event name"),this.eventOptions=s.eventOptions||{},this.identifier=s.identifier||Y("missing identifier"),this.methodName=s.methodName||Y("missing method name"),this.keyFilter=s.keyFilter||"",this.schema=o}static forToken(e,t){return new this(e.element,e.index,pt(e.content),t)}toString(){let e=this.keyFilter?`.${this.keyFilter}`:"",t=this.eventTargetName?`@${this.eventTargetName}`:"";return`${this.eventName}${e}${t}->${this.identifier}#${this.methodName}`}shouldIgnoreKeyboardEvent(e){if(!this.keyFilter)return!1;let t=this.keyFilter.split("+");if(this.keyFilterDissatisfied(e,t))return!0;let s=t.filter(o=>!Ue.includes(o))[0];return s?(he(this.keyMappings,s)||Y(`contains unknown key filter: ${this.keyFilter}`),this.keyMappings[s].toLowerCase()!==e.key.toLowerCase()):!1}shouldIgnoreMouseEvent(e){if(!this.keyFilter)return!1;let t=[this.keyFilter];return!!this.keyFilterDissatisfied(e,t)}get params(){let e={},t=new RegExp(`^data-${this.identifier}-(.+)-param$`,"i");for(let{name:s,value:o}of Array.from(this.element.attributes)){let h=s.match(t),d=h&&h[1];d&&(e[Se(d)]=At(o))}return e}get eventTargetName(){return vt(this.eventTarget)}get keyMappings(){return this.schema.keyMappings}keyFilterDissatisfied(e,t){let[s,o,h,d]=Ue.map(f=>t.includes(f));return e.metaKey!==s||e.ctrlKey!==o||e.altKey!==h||e.shiftKey!==d}},qe={a:()=>"click",button:()=>"click",form:()=>"submit",details:()=>"toggle",input:r=>r.getAttribute("type")=="submit"?"click":"input",select:()=>"change",textarea:()=>"input"};function Et(r){let e=r.tagName.toLowerCase();if(e in qe)return qe[e](r)}function Y(r){throw new Error(r)}function At(r){try{return JSON.parse(r)}catch(e){return r}}var de=class{constructor(e,t){this.context=e,this.action=t}get index(){return this.action.index}get eventTarget(){return this.action.eventTarget}get eventOptions(){return this.action.eventOptions}get identifier(){return this.context.identifier}handleEvent(e){let t=this.prepareActionEvent(e);this.willBeInvokedByEvent(e)&&this.applyEventModifiers(t)&&this.invokeWithEvent(t)}get eventName(){return this.action.eventName}get method(){let e=this.controller[this.methodName];if(typeof e=="function")return e;throw new Error(`Action "${this.action}" references undefined method "${this.methodName}"`)}applyEventModifiers(e){let{element:t}=this.action,{actionDescriptorFilters:s}=this.context.application,{controller:o}=this.context,h=!0;for(let[d,f]of Object.entries(this.eventOptions))if(d in s){let g=s[d];h=h&&g({name:d,value:f,event:e,element:t,controller:o})}else continue;return h}prepareActionEvent(e){return Object.assign(e,{params:this.action.params})}invokeWithEvent(e){let{target:t,currentTarget:s}=e;try{this.method.call(this.controller,e),this.context.logDebugActivity(this.methodName,{event:e,target:t,currentTarget:s,action:this.methodName})}catch(o){let{identifier:h,controller:d,element:f,index:g}=this,v={identifier:h,controller:d,element:f,index:g,event:e};this.context.handleError(o,`invoking action "${this.action}"`,v)}}willBeInvokedByEvent(e){let t=e.target;return e instanceof KeyboardEvent&&this.action.shouldIgnoreKeyboardEvent(e)||e instanceof MouseEvent&&this.action.shouldIgnoreMouseEvent(e)?!1:this.element===t?!0:t instanceof Element&&this.element.contains(t)?this.scope.containsElement(t):this.scope.containsElement(this.action.element)}get controller(){return this.context.controller}get methodName(){return this.action.methodName}get element(){return this.scope.element}get scope(){return this.context.scope}},Z=class{constructor(e,t){this.mutationObserverInit={attributes:!0,childList:!0,subtree:!0},this.element=e,this.started=!1,this.delegate=t,this.elements=new Set,this.mutationObserver=new MutationObserver(s=>this.processMutations(s))}start(){this.started||(this.started=!0,this.mutationObserver.observe(this.element,this.mutationObserverInit),this.refresh())}pause(e){this.started&&(this.mutationObserver.disconnect(),this.started=!1),e(),this.started||(this.mutationObserver.observe(this.element,this.mutationObserverInit),this.started=!0)}stop(){this.started&&(this.mutationObserver.takeRecords(),this.mutationObserver.disconnect(),this.started=!1)}refresh(){if(this.started){let e=new Set(this.matchElementsInTree());for(let t of Array.from(this.elements))e.has(t)||this.removeElement(t);for(let t of Array.from(e))this.addElement(t)}}processMutations(e){if(this.started)for(let t of e)this.processMutation(t)}processMutation(e){e.type=="attributes"?this.processAttributeChange(e.target,e.attributeName):e.type=="childList"&&(this.processRemovedNodes(e.removedNodes),this.processAddedNodes(e.addedNodes))}processAttributeChange(e,t){this.elements.has(e)?this.delegate.elementAttributeChanged&&this.matchElement(e)?this.delegate.elementAttributeChanged(e,t):this.removeElement(e):this.matchElement(e)&&this.addElement(e)}processRemovedNodes(e){for(let t of Array.from(e)){let s=this.elementFromNode(t);s&&this.processTree(s,this.removeElement)}}processAddedNodes(e){for(let t of Array.from(e)){let s=this.elementFromNode(t);s&&this.elementIsActive(s)&&this.processTree(s,this.addElement)}}matchElement(e){return this.delegate.matchElement(e)}matchElementsInTree(e=this.element){return this.delegate.matchElementsInTree(e)}processTree(e,t){for(let s of this.matchElementsInTree(e))t.call(this,s)}elementFromNode(e){if(e.nodeType==Node.ELEMENT_NODE)return e}elementIsActive(e){return e.isConnected!=this.element.isConnected?!1:this.element.contains(e)}addElement(e){this.elements.has(e)||this.elementIsActive(e)&&(this.elements.add(e),this.delegate.elementMatched&&this.delegate.elementMatched(e))}removeElement(e){this.elements.has(e)&&(this.elements.delete(e),this.delegate.elementUnmatched&&this.delegate.elementUnmatched(e))}},ee=class{constructor(e,t,s){this.attributeName=t,this.delegate=s,this.elementObserver=new Z(e,this)}get element(){return this.elementObserver.element}get selector(){return`[${this.attributeName}]`}start(){this.elementObserver.start()}pause(e){this.elementObserver.pause(e)}stop(){this.elementObserver.stop()}refresh(){this.elementObserver.refresh()}get started(){return this.elementObserver.started}matchElement(e){return e.hasAttribute(this.attributeName)}matchElementsInTree(e){let t=this.matchElement(e)?[e]:[],s=Array.from(e.querySelectorAll(this.selector));return t.concat(s)}elementMatched(e){this.delegate.elementMatchedAttribute&&this.delegate.elementMatchedAttribute(e,this.attributeName)}elementUnmatched(e){this.delegate.elementUnmatchedAttribute&&this.delegate.elementUnmatchedAttribute(e,this.attributeName)}elementAttributeChanged(e,t){this.delegate.elementAttributeValueChanged&&this.attributeName==t&&this.delegate.elementAttributeValueChanged(e,t)}};function Ot(r,e,t){Qe(r,e).add(t)}function wt(r,e,t){Qe(r,e).delete(t),xt(r,e)}function Qe(r,e){let t=r.get(e);return t||(t=new Set,r.set(e,t)),t}function xt(r,e){let t=r.get(e);t!=null&&t.size==0&&r.delete(e)}var C=class{constructor(){this.valuesByKey=new Map}get keys(){return Array.from(this.valuesByKey.keys())}get values(){return Array.from(this.valuesByKey.values()).reduce((t,s)=>t.concat(Array.from(s)),[])}get size(){return Array.from(this.valuesByKey.values()).reduce((t,s)=>t+s.size,0)}add(e,t){Ot(this.valuesByKey,e,t)}delete(e,t){wt(this.valuesByKey,e,t)}has(e,t){let s=this.valuesByKey.get(e);return s!=null&&s.has(t)}hasKey(e){return this.valuesByKey.has(e)}hasValue(e){return Array.from(this.valuesByKey.values()).some(s=>s.has(e))}getValuesForKey(e){let t=this.valuesByKey.get(e);return t?Array.from(t):[]}getKeysForValue(e){return Array.from(this.valuesByKey).filter(([t,s])=>s.has(e)).map(([t,s])=>t)}};var fe=class{constructor(e,t,s,o){this._selector=t,this.details=o,this.elementObserver=new Z(e,this),this.delegate=s,this.matchesByElement=new C}get started(){return this.elementObserver.started}get selector(){return this._selector}set selector(e){this._selector=e,this.refresh()}start(){this.elementObserver.start()}pause(e){this.elementObserver.pause(e)}stop(){this.elementObserver.stop()}refresh(){this.elementObserver.refresh()}get element(){return this.elementObserver.element}matchElement(e){let{selector:t}=this;if(t){let s=e.matches(t);return this.delegate.selectorMatchElement?s&&this.delegate.selectorMatchElement(e,this.details):s}else return!1}matchElementsInTree(e){let{selector:t}=this;if(t){let s=this.matchElement(e)?[e]:[],o=Array.from(e.querySelectorAll(t)).filter(h=>this.matchElement(h));return s.concat(o)}else return[]}elementMatched(e){let{selector:t}=this;t&&this.selectorMatched(e,t)}elementUnmatched(e){let t=this.matchesByElement.getKeysForValue(e);for(let s of t)this.selectorUnmatched(e,s)}elementAttributeChanged(e,t){let{selector:s}=this;if(s){let o=this.matchElement(e),h=this.matchesByElement.has(s,e);o&&!h?this.selectorMatched(e,s):!o&&h&&this.selectorUnmatched(e,s)}}selectorMatched(e,t){this.delegate.selectorMatched(e,t,this.details),this.matchesByElement.add(t,e)}selectorUnmatched(e,t){this.delegate.selectorUnmatched(e,t,this.details),this.matchesByElement.delete(t,e)}},ge=class{constructor(e,t){this.element=e,this.delegate=t,this.started=!1,this.stringMap=new Map,this.mutationObserver=new MutationObserver(s=>this.processMutations(s))}start(){this.started||(this.started=!0,this.mutationObserver.observe(this.element,{attributes:!0,attributeOldValue:!0}),this.refresh())}stop(){this.started&&(this.mutationObserver.takeRecords(),this.mutationObserver.disconnect(),this.started=!1)}refresh(){if(this.started)for(let e of this.knownAttributeNames)this.refreshAttribute(e,null)}processMutations(e){if(this.started)for(let t of e)this.processMutation(t)}processMutation(e){let t=e.attributeName;t&&this.refreshAttribute(t,e.oldValue)}refreshAttribute(e,t){let s=this.delegate.getStringMapKeyForAttribute(e);if(s!=null){this.stringMap.has(e)||this.stringMapKeyAdded(s,e);let o=this.element.getAttribute(e);if(this.stringMap.get(e)!=o&&this.stringMapValueChanged(o,s,t),o==null){let h=this.stringMap.get(e);this.stringMap.delete(e),h&&this.stringMapKeyRemoved(s,e,h)}else this.stringMap.set(e,o)}}stringMapKeyAdded(e,t){this.delegate.stringMapKeyAdded&&this.delegate.stringMapKeyAdded(e,t)}stringMapValueChanged(e,t,s){this.delegate.stringMapValueChanged&&this.delegate.stringMapValueChanged(e,t,s)}stringMapKeyRemoved(e,t,s){this.delegate.stringMapKeyRemoved&&this.delegate.stringMapKeyRemoved(e,t,s)}get knownAttributeNames(){return Array.from(new Set(this.currentAttributeNames.concat(this.recordedAttributeNames)))}get currentAttributeNames(){return Array.from(this.element.attributes).map(e=>e.name)}get recordedAttributeNames(){return Array.from(this.stringMap.keys())}},te=class{constructor(e,t,s){this.attributeObserver=new ee(e,t,this),this.delegate=s,this.tokensByElement=new C}get started(){return this.attributeObserver.started}start(){this.attributeObserver.start()}pause(e){this.attributeObserver.pause(e)}stop(){this.attributeObserver.stop()}refresh(){this.attributeObserver.refresh()}get element(){return this.attributeObserver.element}get attributeName(){return this.attributeObserver.attributeName}elementMatchedAttribute(e){this.tokensMatched(this.readTokensForElement(e))}elementAttributeValueChanged(e){let[t,s]=this.refreshTokensForElement(e);this.tokensUnmatched(t),this.tokensMatched(s)}elementUnmatchedAttribute(e){this.tokensUnmatched(this.tokensByElement.getValuesForKey(e))}tokensMatched(e){e.forEach(t=>this.tokenMatched(t))}tokensUnmatched(e){e.forEach(t=>this.tokenUnmatched(t))}tokenMatched(e){this.delegate.tokenMatched(e),this.tokensByElement.add(e.element,e)}tokenUnmatched(e){this.delegate.tokenUnmatched(e),this.tokensByElement.delete(e.element,e)}refreshTokensForElement(e){let t=this.tokensByElement.getValuesForKey(e),s=this.readTokensForElement(e),o=Ft(t,s).findIndex(([h,d])=>!Ct(h,d));return o==-1?[[],[]]:[t.slice(o),s.slice(o)]}readTokensForElement(e){let t=this.attributeName,s=e.getAttribute(t)||"";return Tt(s,e,t)}};function Tt(r,e,t){return r.trim().split(/\s+/).filter(s=>s.length).map((s,o)=>({element:e,attributeName:t,content:s,index:o}))}function Ft(r,e){let t=Math.max(r.length,e.length);return Array.from({length:t},(s,o)=>[r[o],e[o]])}function Ct(r,e){return r&&e&&r.index==e.index&&r.content==e.content}var se=class{constructor(e,t,s){this.tokenListObserver=new te(e,t,this),this.delegate=s,this.parseResultsByToken=new WeakMap,this.valuesByTokenByElement=new WeakMap}get started(){return this.tokenListObserver.started}start(){this.tokenListObserver.start()}stop(){this.tokenListObserver.stop()}refresh(){this.tokenListObserver.refresh()}get element(){return this.tokenListObserver.element}get attributeName(){return this.tokenListObserver.attributeName}tokenMatched(e){let{element:t}=e,{value:s}=this.fetchParseResultForToken(e);s&&(this.fetchValuesByTokenForElement(t).set(e,s),this.delegate.elementMatchedValue(t,s))}tokenUnmatched(e){let{element:t}=e,{value:s}=this.fetchParseResultForToken(e);s&&(this.fetchValuesByTokenForElement(t).delete(e),this.delegate.elementUnmatchedValue(t,s))}fetchParseResultForToken(e){let t=this.parseResultsByToken.get(e);return t||(t=this.parseToken(e),this.parseResultsByToken.set(e,t)),t}fetchValuesByTokenForElement(e){let t=this.valuesByTokenByElement.get(e);return t||(t=new Map,this.valuesByTokenByElement.set(e,t)),t}parseToken(e){try{return{value:this.delegate.parseValueForToken(e)}}catch(t){return{error:t}}}},pe=class{constructor(e,t){this.context=e,this.delegate=t,this.bindingsByAction=new Map}start(){this.valueListObserver||(this.valueListObserver=new se(this.element,this.actionAttribute,this),this.valueListObserver.start())}stop(){this.valueListObserver&&(this.valueListObserver.stop(),delete this.valueListObserver,this.disconnectAllActions())}get element(){return this.context.element}get identifier(){return this.context.identifier}get actionAttribute(){return this.schema.actionAttribute}get schema(){return this.context.schema}get bindings(){return Array.from(this.bindingsByAction.values())}connectAction(e){let t=new de(this.context,e);this.bindingsByAction.set(e,t),this.delegate.bindingConnected(t)}disconnectAction(e){let t=this.bindingsByAction.get(e);t&&(this.bindingsByAction.delete(e),this.delegate.bindingDisconnected(t))}disconnectAllActions(){this.bindings.forEach(e=>this.delegate.bindingDisconnected(e,!0)),this.bindingsByAction.clear()}parseValueForToken(e){let t=ue.forToken(e,this.schema);if(t.identifier==this.identifier)return t}elementMatchedValue(e,t){this.connectAction(t)}elementUnmatchedValue(e,t){this.disconnectAction(t)}},me=class{constructor(e,t){this.context=e,this.receiver=t,this.stringMapObserver=new ge(this.element,this),this.valueDescriptorMap=this.controller.valueDescriptorMap}start(){this.stringMapObserver.start(),this.invokeChangedCallbacksForDefaultValues()}stop(){this.stringMapObserver.stop()}get element(){return this.context.element}get controller(){return this.context.controller}getStringMapKeyForAttribute(e){if(e in this.valueDescriptorMap)return this.valueDescriptorMap[e].name}stringMapKeyAdded(e,t){let s=this.valueDescriptorMap[t];this.hasValue(e)||this.invokeChangedCallback(e,s.writer(this.receiver[e]),s.writer(s.defaultValue))}stringMapValueChanged(e,t,s){let o=this.valueDescriptorNameMap[t];e!==null&&(s===null&&(s=o.writer(o.defaultValue)),this.invokeChangedCallback(t,e,s))}stringMapKeyRemoved(e,t,s){let o=this.valueDescriptorNameMap[e];this.hasValue(e)?this.invokeChangedCallback(e,o.writer(this.receiver[e]),s):this.invokeChangedCallback(e,o.writer(o.defaultValue),s)}invokeChangedCallbacksForDefaultValues(){for(let{key:e,name:t,defaultValue:s,writer:o}of this.valueDescriptors)s!=null&&!this.controller.data.has(e)&&this.invokeChangedCallback(t,o(s),void 0)}invokeChangedCallback(e,t,s){let o=`${e}Changed`,h=this.receiver[o];if(typeof h=="function"){let d=this.valueDescriptorNameMap[e];try{let f=d.reader(t),g=s;s&&(g=d.reader(s)),h.call(this.receiver,f,g)}catch(f){throw f instanceof TypeError&&(f.message=`Stimulus Value "${this.context.identifier}.${d.name}" - ${f.message}`),f}}}get valueDescriptors(){let{valueDescriptorMap:e}=this;return Object.keys(e).map(t=>e[t])}get valueDescriptorNameMap(){let e={};return Object.keys(this.valueDescriptorMap).forEach(t=>{let s=this.valueDescriptorMap[t];e[s.name]=s}),e}hasValue(e){let t=this.valueDescriptorNameMap[e],s=`has${R(t.name)}`;return this.receiver[s]}},be=class{constructor(e,t){this.context=e,this.delegate=t,this.targetsByName=new C}start(){this.tokenListObserver||(this.tokenListObserver=new te(this.element,this.attributeName,this),this.tokenListObserver.start())}stop(){this.tokenListObserver&&(this.disconnectAllTargets(),this.tokenListObserver.stop(),delete this.tokenListObserver)}tokenMatched({element:e,content:t}){this.scope.containsElement(e)&&this.connectTarget(e,t)}tokenUnmatched({element:e,content:t}){this.disconnectTarget(e,t)}connectTarget(e,t){var s;this.targetsByName.has(t,e)||(this.targetsByName.add(t,e),(s=this.tokenListObserver)===null||s===void 0||s.pause(()=>this.delegate.targetConnected(e,t)))}disconnectTarget(e,t){var s;this.targetsByName.has(t,e)&&(this.targetsByName.delete(t,e),(s=this.tokenListObserver)===null||s===void 0||s.pause(()=>this.delegate.targetDisconnected(e,t)))}disconnectAllTargets(){for(let e of this.targetsByName.keys)for(let t of this.targetsByName.getValuesForKey(e))this.disconnectTarget(t,e)}get attributeName(){return`data-${this.context.identifier}-target`}get element(){return this.context.element}get scope(){return this.context.scope}};function K(r,e){let t=Ge(r);return Array.from(t.reduce((s,o)=>(St(o,e).forEach(h=>s.add(h)),s),new Set))}function Mt(r,e){return Ge(r).reduce((s,o)=>(s.push(...Bt(o,e)),s),[])}function Ge(r){let e=[];for(;r;)e.push(r),r=Object.getPrototypeOf(r);return e.reverse()}function St(r,e){let t=r[e];return Array.isArray(t)?t:[]}function Bt(r,e){let t=r[e];return t?Object.keys(t).map(s=>[s,t[s]]):[]}var ve=class{constructor(e,t){this.started=!1,this.context=e,this.delegate=t,this.outletsByName=new C,this.outletElementsByName=new C,this.selectorObserverMap=new Map,this.attributeObserverMap=new Map}start(){this.started||(this.outletDefinitions.forEach(e=>{this.setupSelectorObserverForOutlet(e),this.setupAttributeObserverForOutlet(e)}),this.started=!0,this.dependentContexts.forEach(e=>e.refresh()))}refresh(){this.selectorObserverMap.forEach(e=>e.refresh()),this.attributeObserverMap.forEach(e=>e.refresh())}stop(){this.started&&(this.started=!1,this.disconnectAllOutlets(),this.stopSelectorObservers(),this.stopAttributeObservers())}stopSelectorObservers(){this.selectorObserverMap.size>0&&(this.selectorObserverMap.forEach(e=>e.stop()),this.selectorObserverMap.clear())}stopAttributeObservers(){this.attributeObserverMap.size>0&&(this.attributeObserverMap.forEach(e=>e.stop()),this.attributeObserverMap.clear())}selectorMatched(e,t,{outletName:s}){let o=this.getOutlet(e,s);o&&this.connectOutlet(o,e,s)}selectorUnmatched(e,t,{outletName:s}){let o=this.getOutletFromMap(e,s);o&&this.disconnectOutlet(o,e,s)}selectorMatchElement(e,{outletName:t}){let s=this.selector(t),o=this.hasOutlet(e,t),h=e.matches(`[${this.schema.controllerAttribute}~=${t}]`);return s?o&&h&&e.matches(s):!1}elementMatchedAttribute(e,t){let s=this.getOutletNameFromOutletAttributeName(t);s&&this.updateSelectorObserverForOutlet(s)}elementAttributeValueChanged(e,t){let s=this.getOutletNameFromOutletAttributeName(t);s&&this.updateSelectorObserverForOutlet(s)}elementUnmatchedAttribute(e,t){let s=this.getOutletNameFromOutletAttributeName(t);s&&this.updateSelectorObserverForOutlet(s)}connectOutlet(e,t,s){var o;this.outletElementsByName.has(s,t)||(this.outletsByName.add(s,e),this.outletElementsByName.add(s,t),(o=this.selectorObserverMap.get(s))===null||o===void 0||o.pause(()=>this.delegate.outletConnected(e,t,s)))}disconnectOutlet(e,t,s){var o;this.outletElementsByName.has(s,t)&&(this.outletsByName.delete(s,e),this.outletElementsByName.delete(s,t),(o=this.selectorObserverMap.get(s))===null||o===void 0||o.pause(()=>this.delegate.outletDisconnected(e,t,s)))}disconnectAllOutlets(){for(let e of this.outletElementsByName.keys)for(let t of this.outletElementsByName.getValuesForKey(e))for(let s of this.outletsByName.getValuesForKey(e))this.disconnectOutlet(s,t,e)}updateSelectorObserverForOutlet(e){let t=this.selectorObserverMap.get(e);t&&(t.selector=this.selector(e))}setupSelectorObserverForOutlet(e){let t=this.selector(e),s=new fe(document.body,t,this,{outletName:e});this.selectorObserverMap.set(e,s),s.start()}setupAttributeObserverForOutlet(e){let t=this.attributeNameForOutletName(e),s=new ee(this.scope.element,t,this);this.attributeObserverMap.set(e,s),s.start()}selector(e){return this.scope.outlets.getSelectorForOutletName(e)}attributeNameForOutletName(e){return this.scope.schema.outletAttributeForScope(this.identifier,e)}getOutletNameFromOutletAttributeName(e){return this.outletDefinitions.find(t=>this.attributeNameForOutletName(t)===e)}get outletDependencies(){let e=new C;return this.router.modules.forEach(t=>{let s=t.definition.controllerConstructor;K(s,"outlets").forEach(h=>e.add(h,t.identifier))}),e}get outletDefinitions(){return this.outletDependencies.getKeysForValue(this.identifier)}get dependentControllerIdentifiers(){return this.outletDependencies.getValuesForKey(this.identifier)}get dependentContexts(){let e=this.dependentControllerIdentifiers;return this.router.contexts.filter(t=>e.includes(t.identifier))}hasOutlet(e,t){return!!this.getOutlet(e,t)||!!this.getOutletFromMap(e,t)}getOutlet(e,t){return this.application.getControllerForElementAndIdentifier(e,t)}getOutletFromMap(e,t){return this.outletsByName.getValuesForKey(t).find(s=>s.element===e)}get scope(){return this.context.scope}get schema(){return this.context.schema}get identifier(){return this.context.identifier}get application(){return this.context.application}get router(){return this.application.router}},ye=class{constructor(e,t){this.logDebugActivity=(s,o={})=>{let{identifier:h,controller:d,element:f}=this;o=Object.assign({identifier:h,controller:d,element:f},o),this.application.logDebugActivity(this.identifier,s,o)},this.module=e,this.scope=t,this.controller=new e.controllerConstructor(this),this.bindingObserver=new pe(this,this.dispatcher),this.valueObserver=new me(this,this.controller),this.targetObserver=new be(this,this),this.outletObserver=new ve(this,this);try{this.controller.initialize(),this.logDebugActivity("initialize")}catch(s){this.handleError(s,"initializing controller")}}connect(){this.bindingObserver.start(),this.valueObserver.start(),this.targetObserver.start(),this.outletObserver.start();try{this.controller.connect(),this.logDebugActivity("connect")}catch(e){this.handleError(e,"connecting controller")}}refresh(){this.outletObserver.refresh()}disconnect(){try{this.controller.disconnect(),this.logDebugActivity("disconnect")}catch(e){this.handleError(e,"disconnecting controller")}this.outletObserver.stop(),this.targetObserver.stop(),this.valueObserver.stop(),this.bindingObserver.stop()}get application(){return this.module.application}get identifier(){return this.module.identifier}get schema(){return this.application.schema}get dispatcher(){return this.application.dispatcher}get element(){return this.scope.element}get parentElement(){return this.element.parentElement}handleError(e,t,s={}){let{identifier:o,controller:h,element:d}=this;s=Object.assign({identifier:o,controller:h,element:d},s),this.application.handleError(e,`Error ${t}`,s)}targetConnected(e,t){this.invokeControllerMethod(`${t}TargetConnected`,e)}targetDisconnected(e,t){this.invokeControllerMethod(`${t}TargetDisconnected`,e)}outletConnected(e,t,s){this.invokeControllerMethod(`${le(s)}OutletConnected`,e,t)}outletDisconnected(e,t,s){this.invokeControllerMethod(`${le(s)}OutletDisconnected`,e,t)}invokeControllerMethod(e,...t){let s=this.controller;typeof s[e]=="function"&&s[e](...t)}};function Nt(r){return Lt(r,$t(r))}function Lt(r,e){let t=It(r),s=Dt(r.prototype,e);return Object.defineProperties(t.prototype,s),t}function $t(r){return K(r,"blessings").reduce((t,s)=>{let o=s(r);for(let h in o){let d=t[h]||{};t[h]=Object.assign(d,o[h])}return t},{})}function Dt(r,e){return jt(e).reduce((t,s)=>{let o=kt(r,e,s);return o&&Object.assign(t,{[s]:o}),t},{})}function kt(r,e,t){let s=Object.getOwnPropertyDescriptor(r,t);if(!(s&&"value"in s)){let h=Object.getOwnPropertyDescriptor(e,t).value;return s&&(h.get=s.get||h.get,h.set=s.set||h.set),h}}var jt=(()=>typeof Object.getOwnPropertySymbols=="function"?r=>[...Object.getOwnPropertyNames(r),...Object.getOwnPropertySymbols(r)]:Object.getOwnPropertyNames)(),It=(()=>{function r(t){function s(){return Reflect.construct(t,arguments,new.target)}return s.prototype=Object.create(t.prototype,{constructor:{value:s}}),Reflect.setPrototypeOf(s,t),s}function e(){let s=r(function(){this.a.call(this)});return s.prototype.a=function(){},new s}try{return e(),r}catch(t){return s=>class extends s{}}})();function Vt(r){return{identifier:r.identifier,controllerConstructor:Nt(r.controllerConstructor)}}var Ee=class{constructor(e,t){this.application=e,this.definition=Vt(t),this.contextsByScope=new WeakMap,this.connectedContexts=new Set}get identifier(){return this.definition.identifier}get controllerConstructor(){return this.definition.controllerConstructor}get contexts(){return Array.from(this.connectedContexts)}connectContextForScope(e){let t=this.fetchContextForScope(e);this.connectedContexts.add(t),t.connect()}disconnectContextForScope(e){let t=this.contextsByScope.get(e);t&&(this.connectedContexts.delete(t),t.disconnect())}fetchContextForScope(e){let t=this.contextsByScope.get(e);return t||(t=new ye(this,e),this.contextsByScope.set(e,t)),t}},Ae=class{constructor(e){this.scope=e}has(e){return this.data.has(this.getDataKey(e))}get(e){return this.getAll(e)[0]}getAll(e){let t=this.data.get(this.getDataKey(e))||"";return yt(t)}getAttributeName(e){return this.data.getAttributeNameForKey(this.getDataKey(e))}getDataKey(e){return`${e}-class`}get data(){return this.scope.data}},Oe=class{constructor(e){this.scope=e}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get(e){let t=this.getAttributeNameForKey(e);return this.element.getAttribute(t)}set(e,t){let s=this.getAttributeNameForKey(e);return this.element.setAttribute(s,t),this.get(e)}has(e){let t=this.getAttributeNameForKey(e);return this.element.hasAttribute(t)}delete(e){if(this.has(e)){let t=this.getAttributeNameForKey(e);return this.element.removeAttribute(t),!0}else return!1}getAttributeNameForKey(e){return`data-${this.identifier}-${Xe(e)}`}},we=class{constructor(e){this.warnedKeysByObject=new WeakMap,this.logger=e}warn(e,t,s){let o=this.warnedKeysByObject.get(e);o||(o=new Set,this.warnedKeysByObject.set(e,o)),o.has(t)||(o.add(t),this.logger.warn(s,e))}};function xe(r,e){return`[${r}~="${e}"]`}var Te=class{constructor(e){this.scope=e}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get schema(){return this.scope.schema}has(e){return this.find(e)!=null}find(...e){return e.reduce((t,s)=>t||this.findTarget(s)||this.findLegacyTarget(s),void 0)}findAll(...e){return e.reduce((t,s)=>[...t,...this.findAllTargets(s),...this.findAllLegacyTargets(s)],[])}findTarget(e){let t=this.getSelectorForTargetName(e);return this.scope.findElement(t)}findAllTargets(e){let t=this.getSelectorForTargetName(e);return this.scope.findAllElements(t)}getSelectorForTargetName(e){let t=this.schema.targetAttributeForScope(this.identifier);return xe(t,e)}findLegacyTarget(e){let t=this.getLegacySelectorForTargetName(e);return this.deprecate(this.scope.findElement(t),e)}findAllLegacyTargets(e){let t=this.getLegacySelectorForTargetName(e);return this.scope.findAllElements(t).map(s=>this.deprecate(s,e))}getLegacySelectorForTargetName(e){let t=`${this.identifier}.${e}`;return xe(this.schema.targetAttribute,t)}deprecate(e,t){if(e){let{identifier:s}=this,o=this.schema.targetAttribute,h=this.schema.targetAttributeForScope(s);this.guide.warn(e,`target:${t}`,`Please replace ${o}="${s}.${t}" with ${h}="${t}". The ${o} attribute is deprecated and will be removed in a future version of Stimulus.`)}return e}get guide(){return this.scope.guide}},Fe=class{constructor(e,t){this.scope=e,this.controllerElement=t}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get schema(){return this.scope.schema}has(e){return this.find(e)!=null}find(...e){return e.reduce((t,s)=>t||this.findOutlet(s),void 0)}findAll(...e){return e.reduce((t,s)=>[...t,...this.findAllOutlets(s)],[])}getSelectorForOutletName(e){let t=this.schema.outletAttributeForScope(this.identifier,e);return this.controllerElement.getAttribute(t)}findOutlet(e){let t=this.getSelectorForOutletName(e);if(t)return this.findElement(t,e)}findAllOutlets(e){let t=this.getSelectorForOutletName(e);return t?this.findAllElements(t,e):[]}findElement(e,t){return this.scope.queryElements(e).filter(o=>this.matchesElement(o,e,t))[0]}findAllElements(e,t){return this.scope.queryElements(e).filter(o=>this.matchesElement(o,e,t))}matchesElement(e,t,s){let o=e.getAttribute(this.scope.schema.controllerAttribute)||"";return e.matches(t)&&o.split(" ").includes(s)}},U=class{constructor(e,t,s,o){this.targets=new Te(this),this.classes=new Ae(this),this.data=new Oe(this),this.containsElement=h=>h.closest(this.controllerSelector)===this.element,this.schema=e,this.element=t,this.identifier=s,this.guide=new we(o),this.outlets=new Fe(this.documentScope,t)}findElement(e){return this.element.matches(e)?this.element:this.queryElements(e).find(this.containsElement)}findAllElements(e){return[...this.element.matches(e)?[this.element]:[],...this.queryElements(e).filter(this.containsElement)]}queryElements(e){return Array.from(this.element.querySelectorAll(e))}get controllerSelector(){return xe(this.schema.controllerAttribute,this.identifier)}get isDocumentScope(){return this.element===document.documentElement}get documentScope(){return this.isDocumentScope?this:new U(this.schema,document.documentElement,this.identifier,this.guide.logger)}},Ce=class{constructor(e,t,s){this.element=e,this.schema=t,this.delegate=s,this.valueListObserver=new se(this.element,this.controllerAttribute,this),this.scopesByIdentifierByElement=new WeakMap,this.scopeReferenceCounts=new WeakMap}start(){this.valueListObserver.start()}stop(){this.valueListObserver.stop()}get controllerAttribute(){return this.schema.controllerAttribute}parseValueForToken(e){let{element:t,content:s}=e;return this.parseValueForElementAndIdentifier(t,s)}parseValueForElementAndIdentifier(e,t){let s=this.fetchScopesByIdentifierForElement(e),o=s.get(t);return o||(o=this.delegate.createScopeForElementAndIdentifier(e,t),s.set(t,o)),o}elementMatchedValue(e,t){let s=(this.scopeReferenceCounts.get(t)||0)+1;this.scopeReferenceCounts.set(t,s),s==1&&this.delegate.scopeConnected(t)}elementUnmatchedValue(e,t){let s=this.scopeReferenceCounts.get(t);s&&(this.scopeReferenceCounts.set(t,s-1),s==1&&this.delegate.scopeDisconnected(t))}fetchScopesByIdentifierForElement(e){let t=this.scopesByIdentifierByElement.get(e);return t||(t=new Map,this.scopesByIdentifierByElement.set(e,t)),t}},Me=class{constructor(e){this.application=e,this.scopeObserver=new Ce(this.element,this.schema,this),this.scopesByIdentifier=new C,this.modulesByIdentifier=new Map}get element(){return this.application.element}get schema(){return this.application.schema}get logger(){return this.application.logger}get controllerAttribute(){return this.schema.controllerAttribute}get modules(){return Array.from(this.modulesByIdentifier.values())}get contexts(){return this.modules.reduce((e,t)=>e.concat(t.contexts),[])}start(){this.scopeObserver.start()}stop(){this.scopeObserver.stop()}loadDefinition(e){this.unloadIdentifier(e.identifier);let t=new Ee(this.application,e);this.connectModule(t);let s=e.controllerConstructor.afterLoad;s&&s.call(e.controllerConstructor,e.identifier,this.application)}unloadIdentifier(e){let t=this.modulesByIdentifier.get(e);t&&this.disconnectModule(t)}getContextForElementAndIdentifier(e,t){let s=this.modulesByIdentifier.get(t);if(s)return s.contexts.find(o=>o.element==e)}proposeToConnectScopeForElementAndIdentifier(e,t){let s=this.scopeObserver.parseValueForElementAndIdentifier(e,t);s?this.scopeObserver.elementMatchedValue(s.element,s):console.error(`Couldn't find or create scope for identifier: "${t}" and element:`,e)}handleError(e,t,s){this.application.handleError(e,t,s)}createScopeForElementAndIdentifier(e,t){return new U(this.schema,e,t,this.logger)}scopeConnected(e){this.scopesByIdentifier.add(e.identifier,e);let t=this.modulesByIdentifier.get(e.identifier);t&&t.connectContextForScope(e)}scopeDisconnected(e){this.scopesByIdentifier.delete(e.identifier,e);let t=this.modulesByIdentifier.get(e.identifier);t&&t.disconnectContextForScope(e)}connectModule(e){this.modulesByIdentifier.set(e.identifier,e),this.scopesByIdentifier.getValuesForKey(e.identifier).forEach(s=>e.connectContextForScope(s))}disconnectModule(e){this.modulesByIdentifier.delete(e.identifier),this.scopesByIdentifier.getValuesForKey(e.identifier).forEach(s=>e.disconnectContextForScope(s))}},_t={controllerAttribute:"data-controller",actionAttribute:"data-action",targetAttribute:"data-target",targetAttributeForScope:r=>`data-${r}-target`,outletAttributeForScope:(r,e)=>`data-${r}-${e}-outlet`,keyMappings:Object.assign(Object.assign({enter:"Enter",tab:"Tab",esc:"Escape",space:" ",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",home:"Home",end:"End",page_up:"PageUp",page_down:"PageDown"},Re("abcdefghijklmnopqrstuvwxyz".split("").map(r=>[r,r]))),Re("0123456789".split("").map(r=>[r,r])))};function Re(r){return r.reduce((e,[t,s])=>Object.assign(Object.assign({},e),{[t]:s}),{})}var re=class{constructor(e=document.documentElement,t=_t){this.logger=console,this.debug=!1,this.logDebugActivity=(s,o,h={})=>{this.debug&&this.logFormattedMessage(s,o,h)},this.element=e,this.schema=t,this.dispatcher=new ce(this),this.router=new Me(this),this.actionDescriptorFilters=Object.assign({},ft)}static start(e,t){let s=new this(e,t);return s.start(),s}start(){return M(this,null,function*(){yield Pt(),this.logDebugActivity("application","starting"),this.dispatcher.start(),this.router.start(),this.logDebugActivity("application","start")})}stop(){this.logDebugActivity("application","stopping"),this.dispatcher.stop(),this.router.stop(),this.logDebugActivity("application","stop")}register(e,t){this.load({identifier:e,controllerConstructor:t})}registerActionOption(e,t){this.actionDescriptorFilters[e]=t}load(e,...t){(Array.isArray(e)?e:[e,...t]).forEach(o=>{o.controllerConstructor.shouldLoad&&this.router.loadDefinition(o)})}unload(e,...t){(Array.isArray(e)?e:[e,...t]).forEach(o=>this.router.unloadIdentifier(o))}get controllers(){return this.router.contexts.map(e=>e.controller)}getControllerForElementAndIdentifier(e,t){let s=this.router.getContextForElementAndIdentifier(e,t);return s?s.controller:null}handleError(e,t,s){var o;this.logger.error(`%s
|
2
|
+
|
3
|
+
%o
|
4
|
+
|
5
|
+
%o`,t,e,s),(o=window.onerror)===null||o===void 0||o.call(window,t,"",0,0,e)}logFormattedMessage(e,t,s={}){s=Object.assign({application:this},s),this.logger.groupCollapsed(`${e} #${t}`),this.logger.log("details:",Object.assign({},s)),this.logger.groupEnd()}};function Pt(){return new Promise(r=>{document.readyState=="loading"?document.addEventListener("DOMContentLoaded",()=>r()):r()})}function Ut(r){return K(r,"classes").reduce((t,s)=>Object.assign(t,qt(s)),{})}function qt(r){return{[`${r}Class`]:{get(){let{classes:e}=this;if(e.has(r))return e.get(r);{let t=e.getAttributeName(r);throw new Error(`Missing attribute "${t}"`)}}},[`${r}Classes`]:{get(){return this.classes.getAll(r)}},[`has${R(r)}Class`]:{get(){return this.classes.has(r)}}}}function Rt(r){return K(r,"outlets").reduce((t,s)=>Object.assign(t,Kt(s)),{})}function Ke(r,e,t){return r.application.getControllerForElementAndIdentifier(e,t)}function ze(r,e,t){let s=Ke(r,e,t);if(s||(r.application.router.proposeToConnectScopeForElementAndIdentifier(e,t),s=Ke(r,e,t),s))return s}function Kt(r){let e=le(r);return{[`${e}Outlet`]:{get(){let t=this.outlets.find(r),s=this.outlets.getSelectorForOutletName(r);if(t){let o=ze(this,t,r);if(o)return o;throw new Error(`The provided outlet element is missing an outlet controller "${r}" instance for host controller "${this.identifier}"`)}throw new Error(`Missing outlet element "${r}" for host controller "${this.identifier}". Stimulus couldn't find a matching outlet element using selector "${s}".`)}},[`${e}Outlets`]:{get(){let t=this.outlets.findAll(r);return t.length>0?t.map(s=>{let o=ze(this,s,r);if(o)return o;console.warn(`The provided outlet element is missing an outlet controller "${r}" instance for host controller "${this.identifier}"`,s)}).filter(s=>s):[]}},[`${e}OutletElement`]:{get(){let t=this.outlets.find(r),s=this.outlets.getSelectorForOutletName(r);if(t)return t;throw new Error(`Missing outlet element "${r}" for host controller "${this.identifier}". Stimulus couldn't find a matching outlet element using selector "${s}".`)}},[`${e}OutletElements`]:{get(){return this.outlets.findAll(r)}},[`has${R(e)}Outlet`]:{get(){return this.outlets.has(r)}}}}function zt(r){return K(r,"targets").reduce((t,s)=>Object.assign(t,Wt(s)),{})}function Wt(r){return{[`${r}Target`]:{get(){let e=this.targets.find(r);if(e)return e;throw new Error(`Missing target element "${r}" for "${this.identifier}" controller`)}},[`${r}Targets`]:{get(){return this.targets.findAll(r)}},[`has${R(r)}Target`]:{get(){return this.targets.has(r)}}}}function Ht(r){let e=Mt(r,"values"),t={valueDescriptorMap:{get(){return e.reduce((s,o)=>{let h=Ye(o,this.identifier),d=this.data.getAttributeNameForKey(h.key);return Object.assign(s,{[d]:h})},{})}}};return e.reduce((s,o)=>Object.assign(s,Jt(o)),t)}function Jt(r,e){let t=Ye(r,e),{key:s,name:o,reader:h,writer:d}=t;return{[o]:{get(){let f=this.data.get(s);return f!==null?h(f):t.defaultValue},set(f){f===void 0?this.data.delete(s):this.data.set(s,d(f))}},[`has${R(o)}`]:{get(){return this.data.has(s)||t.hasCustomDefaultValue}}}}function Ye([r,e],t){return Yt({controller:t,token:r,typeDefinition:e})}function ie(r){switch(r){case Array:return"array";case Boolean:return"boolean";case Number:return"number";case Object:return"object";case String:return"string"}}function q(r){switch(typeof r){case"boolean":return"boolean";case"number":return"number";case"string":return"string"}if(Array.isArray(r))return"array";if(Object.prototype.toString.call(r)==="[object Object]")return"object"}function Xt(r){let{controller:e,token:t,typeObject:s}=r,o=Pe(s.type),h=Pe(s.default),d=o&&h,f=o&&!h,g=!o&&h,v=ie(s.type),w=q(r.typeObject.default);if(f)return v;if(g)return w;if(v!==w){let B=e?`${e}.${t}`:t;throw new Error(`The specified default value for the Stimulus Value "${B}" must match the defined type "${v}". The provided default value of "${s.default}" is of type "${w}".`)}if(d)return v}function Qt(r){let{controller:e,token:t,typeDefinition:s}=r,h=Xt({controller:e,token:t,typeObject:s}),d=q(s),f=ie(s),g=h||d||f;if(g)return g;let v=e?`${e}.${s}`:t;throw new Error(`Unknown value type "${v}" for "${t}" value`)}function Gt(r){let e=ie(r);if(e)return We[e];let t=he(r,"default"),s=he(r,"type"),o=r;if(t)return o.default;if(s){let{type:h}=o,d=ie(h);if(d)return We[d]}return r}function Yt(r){let{token:e,typeDefinition:t}=r,s=`${Xe(e)}-value`,o=Qt(r);return{type:o,key:s,name:Se(s),get defaultValue(){return Gt(t)},get hasCustomDefaultValue(){return q(t)!==void 0},reader:Zt[o],writer:He[o]||He.default}}var We={get array(){return[]},boolean:!1,number:0,get object(){return{}},string:""},Zt={array(r){let e=JSON.parse(r);if(!Array.isArray(e))throw new TypeError(`expected value of type "array" but instead got value "${r}" of type "${q(e)}"`);return e},boolean(r){return!(r=="0"||String(r).toLowerCase()=="false")},number(r){return Number(r.replace(/_/g,""))},object(r){let e=JSON.parse(r);if(e===null||typeof e!="object"||Array.isArray(e))throw new TypeError(`expected value of type "object" but instead got value "${r}" of type "${q(e)}"`);return e},string(r){return r}},He={default:es,array:Je,object:Je};function Je(r){return JSON.stringify(r)}function es(r){return`${r}`}var m=class{constructor(e){this.context=e}static get shouldLoad(){return!0}static afterLoad(e,t){}get application(){return this.context.application}get scope(){return this.context.scope}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get targets(){return this.scope.targets}get outlets(){return this.scope.outlets}get classes(){return this.scope.classes}get data(){return this.scope.data}initialize(){}connect(){}disconnect(){}dispatch(e,{target:t=this.element,detail:s={},prefix:o=this.identifier,bubbles:h=!0,cancelable:d=!0}={}){let f=o?`${o}:${e}`:e,g=new CustomEvent(f,{detail:s,bubbles:h,cancelable:d});return t.dispatchEvent(g),g}};m.blessings=[Ut,zt,Ht,Rt];m.targets=[];m.outlets=[];m.values={};var tt={exports:{}};(function(r,e){(function(t){r.exports=t()})(function(t){var s=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function o(u,l){var n=u[0],i=u[1],c=u[2],a=u[3];n+=(i&c|~i&a)+l[0]-680876936|0,n=(n<<7|n>>>25)+i|0,a+=(n&i|~n&c)+l[1]-389564586|0,a=(a<<12|a>>>20)+n|0,c+=(a&n|~a&i)+l[2]+606105819|0,c=(c<<17|c>>>15)+a|0,i+=(c&a|~c&n)+l[3]-1044525330|0,i=(i<<22|i>>>10)+c|0,n+=(i&c|~i&a)+l[4]-176418897|0,n=(n<<7|n>>>25)+i|0,a+=(n&i|~n&c)+l[5]+1200080426|0,a=(a<<12|a>>>20)+n|0,c+=(a&n|~a&i)+l[6]-1473231341|0,c=(c<<17|c>>>15)+a|0,i+=(c&a|~c&n)+l[7]-45705983|0,i=(i<<22|i>>>10)+c|0,n+=(i&c|~i&a)+l[8]+1770035416|0,n=(n<<7|n>>>25)+i|0,a+=(n&i|~n&c)+l[9]-1958414417|0,a=(a<<12|a>>>20)+n|0,c+=(a&n|~a&i)+l[10]-42063|0,c=(c<<17|c>>>15)+a|0,i+=(c&a|~c&n)+l[11]-1990404162|0,i=(i<<22|i>>>10)+c|0,n+=(i&c|~i&a)+l[12]+1804603682|0,n=(n<<7|n>>>25)+i|0,a+=(n&i|~n&c)+l[13]-40341101|0,a=(a<<12|a>>>20)+n|0,c+=(a&n|~a&i)+l[14]-1502002290|0,c=(c<<17|c>>>15)+a|0,i+=(c&a|~c&n)+l[15]+1236535329|0,i=(i<<22|i>>>10)+c|0,n+=(i&a|c&~a)+l[1]-165796510|0,n=(n<<5|n>>>27)+i|0,a+=(n&c|i&~c)+l[6]-1069501632|0,a=(a<<9|a>>>23)+n|0,c+=(a&i|n&~i)+l[11]+643717713|0,c=(c<<14|c>>>18)+a|0,i+=(c&n|a&~n)+l[0]-373897302|0,i=(i<<20|i>>>12)+c|0,n+=(i&a|c&~a)+l[5]-701558691|0,n=(n<<5|n>>>27)+i|0,a+=(n&c|i&~c)+l[10]+38016083|0,a=(a<<9|a>>>23)+n|0,c+=(a&i|n&~i)+l[15]-660478335|0,c=(c<<14|c>>>18)+a|0,i+=(c&n|a&~n)+l[4]-405537848|0,i=(i<<20|i>>>12)+c|0,n+=(i&a|c&~a)+l[9]+568446438|0,n=(n<<5|n>>>27)+i|0,a+=(n&c|i&~c)+l[14]-1019803690|0,a=(a<<9|a>>>23)+n|0,c+=(a&i|n&~i)+l[3]-187363961|0,c=(c<<14|c>>>18)+a|0,i+=(c&n|a&~n)+l[8]+1163531501|0,i=(i<<20|i>>>12)+c|0,n+=(i&a|c&~a)+l[13]-1444681467|0,n=(n<<5|n>>>27)+i|0,a+=(n&c|i&~c)+l[2]-51403784|0,a=(a<<9|a>>>23)+n|0,c+=(a&i|n&~i)+l[7]+1735328473|0,c=(c<<14|c>>>18)+a|0,i+=(c&n|a&~n)+l[12]-1926607734|0,i=(i<<20|i>>>12)+c|0,n+=(i^c^a)+l[5]-378558|0,n=(n<<4|n>>>28)+i|0,a+=(n^i^c)+l[8]-2022574463|0,a=(a<<11|a>>>21)+n|0,c+=(a^n^i)+l[11]+1839030562|0,c=(c<<16|c>>>16)+a|0,i+=(c^a^n)+l[14]-35309556|0,i=(i<<23|i>>>9)+c|0,n+=(i^c^a)+l[1]-1530992060|0,n=(n<<4|n>>>28)+i|0,a+=(n^i^c)+l[4]+1272893353|0,a=(a<<11|a>>>21)+n|0,c+=(a^n^i)+l[7]-155497632|0,c=(c<<16|c>>>16)+a|0,i+=(c^a^n)+l[10]-1094730640|0,i=(i<<23|i>>>9)+c|0,n+=(i^c^a)+l[13]+681279174|0,n=(n<<4|n>>>28)+i|0,a+=(n^i^c)+l[0]-358537222|0,a=(a<<11|a>>>21)+n|0,c+=(a^n^i)+l[3]-722521979|0,c=(c<<16|c>>>16)+a|0,i+=(c^a^n)+l[6]+76029189|0,i=(i<<23|i>>>9)+c|0,n+=(i^c^a)+l[9]-640364487|0,n=(n<<4|n>>>28)+i|0,a+=(n^i^c)+l[12]-421815835|0,a=(a<<11|a>>>21)+n|0,c+=(a^n^i)+l[15]+530742520|0,c=(c<<16|c>>>16)+a|0,i+=(c^a^n)+l[2]-995338651|0,i=(i<<23|i>>>9)+c|0,n+=(c^(i|~a))+l[0]-198630844|0,n=(n<<6|n>>>26)+i|0,a+=(i^(n|~c))+l[7]+1126891415|0,a=(a<<10|a>>>22)+n|0,c+=(n^(a|~i))+l[14]-1416354905|0,c=(c<<15|c>>>17)+a|0,i+=(a^(c|~n))+l[5]-57434055|0,i=(i<<21|i>>>11)+c|0,n+=(c^(i|~a))+l[12]+1700485571|0,n=(n<<6|n>>>26)+i|0,a+=(i^(n|~c))+l[3]-1894986606|0,a=(a<<10|a>>>22)+n|0,c+=(n^(a|~i))+l[10]-1051523|0,c=(c<<15|c>>>17)+a|0,i+=(a^(c|~n))+l[1]-2054922799|0,i=(i<<21|i>>>11)+c|0,n+=(c^(i|~a))+l[8]+1873313359|0,n=(n<<6|n>>>26)+i|0,a+=(i^(n|~c))+l[15]-30611744|0,a=(a<<10|a>>>22)+n|0,c+=(n^(a|~i))+l[6]-1560198380|0,c=(c<<15|c>>>17)+a|0,i+=(a^(c|~n))+l[13]+1309151649|0,i=(i<<21|i>>>11)+c|0,n+=(c^(i|~a))+l[4]-145523070|0,n=(n<<6|n>>>26)+i|0,a+=(i^(n|~c))+l[11]-1120210379|0,a=(a<<10|a>>>22)+n|0,c+=(n^(a|~i))+l[2]+718787259|0,c=(c<<15|c>>>17)+a|0,i+=(a^(c|~n))+l[9]-343485551|0,i=(i<<21|i>>>11)+c|0,u[0]=n+u[0]|0,u[1]=i+u[1]|0,u[2]=c+u[2]|0,u[3]=a+u[3]|0}function h(u){var l=[],n;for(n=0;n<64;n+=4)l[n>>2]=u.charCodeAt(n)+(u.charCodeAt(n+1)<<8)+(u.charCodeAt(n+2)<<16)+(u.charCodeAt(n+3)<<24);return l}function d(u){var l=[],n;for(n=0;n<64;n+=4)l[n>>2]=u[n]+(u[n+1]<<8)+(u[n+2]<<16)+(u[n+3]<<24);return l}function f(u){var l=u.length,n=[1732584193,-271733879,-1732584194,271733878],i,c,a,y,A,p;for(i=64;i<=l;i+=64)o(n,h(u.substring(i-64,i)));for(u=u.substring(i-64),c=u.length,a=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],i=0;i<c;i+=1)a[i>>2]|=u.charCodeAt(i)<<(i%4<<3);if(a[i>>2]|=128<<(i%4<<3),i>55)for(o(n,a),i=0;i<16;i+=1)a[i]=0;return y=l*8,y=y.toString(16).match(/(.*?)(.{0,8})$/),A=parseInt(y[2],16),p=parseInt(y[1],16)||0,a[14]=A,a[15]=p,o(n,a),n}function g(u){var l=u.length,n=[1732584193,-271733879,-1732584194,271733878],i,c,a,y,A,p;for(i=64;i<=l;i+=64)o(n,d(u.subarray(i-64,i)));for(u=i-64<l?u.subarray(i-64):new Uint8Array(0),c=u.length,a=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],i=0;i<c;i+=1)a[i>>2]|=u[i]<<(i%4<<3);if(a[i>>2]|=128<<(i%4<<3),i>55)for(o(n,a),i=0;i<16;i+=1)a[i]=0;return y=l*8,y=y.toString(16).match(/(.*?)(.{0,8})$/),A=parseInt(y[2],16),p=parseInt(y[1],16)||0,a[14]=A,a[15]=p,o(n,a),n}function v(u){var l="",n;for(n=0;n<4;n+=1)l+=s[u>>n*8+4&15]+s[u>>n*8&15];return l}function w(u){var l;for(l=0;l<u.length;l+=1)u[l]=v(u[l]);return u.join("")}w(f("hello")),typeof ArrayBuffer!="undefined"&&!ArrayBuffer.prototype.slice&&function(){function u(l,n){return l=l|0||0,l<0?Math.max(l+n,0):Math.min(l,n)}ArrayBuffer.prototype.slice=function(l,n){var i=this.byteLength,c=u(l,i),a=i,y,A,p,O;return n!==t&&(a=u(n,i)),c>a?new ArrayBuffer(0):(y=a-c,A=new ArrayBuffer(y),p=new Uint8Array(A),O=new Uint8Array(this,c,y),p.set(O),A)}}();function B(u){return/[\u0080-\uFFFF]/.test(u)&&(u=unescape(encodeURIComponent(u))),u}function x(u,l){var n=u.length,i=new ArrayBuffer(n),c=new Uint8Array(i),a;for(a=0;a<n;a+=1)c[a]=u.charCodeAt(a);return l?c:i}function G(u){return String.fromCharCode.apply(null,new Uint8Array(u))}function k(u,l,n){var i=new Uint8Array(u.byteLength+l.byteLength);return i.set(new Uint8Array(u)),i.set(new Uint8Array(l),u.byteLength),n?i:i.buffer}function N(u){var l=[],n=u.length,i;for(i=0;i<n-1;i+=2)l.push(parseInt(u.substr(i,2),16));return String.fromCharCode.apply(String,l)}function b(){this.reset()}return b.prototype.append=function(u){return this.appendBinary(B(u)),this},b.prototype.appendBinary=function(u){this._buff+=u,this._length+=u.length;var l=this._buff.length,n;for(n=64;n<=l;n+=64)o(this._hash,h(this._buff.substring(n-64,n)));return this._buff=this._buff.substring(n-64),this},b.prototype.end=function(u){var l=this._buff,n=l.length,i,c=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],a;for(i=0;i<n;i+=1)c[i>>2]|=l.charCodeAt(i)<<(i%4<<3);return this._finish(c,n),a=w(this._hash),u&&(a=N(a)),this.reset(),a},b.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},b.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash.slice()}},b.prototype.setState=function(u){return this._buff=u.buff,this._length=u.length,this._hash=u.hash,this},b.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},b.prototype._finish=function(u,l){var n=l,i,c,a;if(u[n>>2]|=128<<(n%4<<3),n>55)for(o(this._hash,u),n=0;n<16;n+=1)u[n]=0;i=this._length*8,i=i.toString(16).match(/(.*?)(.{0,8})$/),c=parseInt(i[2],16),a=parseInt(i[1],16)||0,u[14]=c,u[15]=a,o(this._hash,u)},b.hash=function(u,l){return b.hashBinary(B(u),l)},b.hashBinary=function(u,l){var n=f(u),i=w(n);return l?N(i):i},b.ArrayBuffer=function(){this.reset()},b.ArrayBuffer.prototype.append=function(u){var l=k(this._buff.buffer,u,!0),n=l.length,i;for(this._length+=u.byteLength,i=64;i<=n;i+=64)o(this._hash,d(l.subarray(i-64,i)));return this._buff=i-64<n?new Uint8Array(l.buffer.slice(i-64)):new Uint8Array(0),this},b.ArrayBuffer.prototype.end=function(u){var l=this._buff,n=l.length,i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],c,a;for(c=0;c<n;c+=1)i[c>>2]|=l[c]<<(c%4<<3);return this._finish(i,n),a=w(this._hash),u&&(a=N(a)),this.reset(),a},b.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},b.ArrayBuffer.prototype.getState=function(){var u=b.prototype.getState.call(this);return u.buff=G(u.buff),u},b.ArrayBuffer.prototype.setState=function(u){return u.buff=x(u.buff,!0),b.prototype.setState.call(this,u)},b.ArrayBuffer.prototype.destroy=b.prototype.destroy,b.ArrayBuffer.prototype._finish=b.prototype._finish,b.ArrayBuffer.hash=function(u,l){var n=g(new Uint8Array(u)),i=w(n);return l?N(i):i},b})})(tt);var ts=tt.exports,ss=File.prototype.slice||File.prototype.mozSlice||File.prototype.webkitSlice,z=class{static create(e,t){new z(e).create(t)}constructor(e){this.file=e,this.chunkSize=2097152,this.chunkCount=Math.ceil(this.file.size/this.chunkSize),this.chunkIndex=0}create(e){this.callback=e,this.md5Buffer=new ts.ArrayBuffer,this.fileReader=new FileReader,this.fileReader.addEventListener("load",t=>this.fileReaderDidLoad(t)),this.fileReader.addEventListener("error",t=>this.fileReaderDidError(t)),this.readNextChunk()}fileReaderDidLoad(e){if(this.md5Buffer.append(e.target.result),!this.readNextChunk()){let t=this.md5Buffer.end(!0),s=btoa(t);this.callback(null,s)}}fileReaderDidError(e){this.callback(`Error reading ${this.file.name}`)}readNextChunk(){if(this.chunkIndex<this.chunkCount||this.chunkIndex==0&&this.chunkCount==0){let e=this.chunkIndex*this.chunkSize,t=Math.min(e+this.chunkSize,this.file.size),s=ss.call(this.file,e,t);return this.fileReader.readAsArrayBuffer(s),this.chunkIndex++,!0}else return!1}};function rs(r){let e=st(document.head,`meta[name="${r}"]`);if(e)return e.getAttribute("content")}function is(r,e){typeof r=="string"&&(e=r,r=document);let t=r.querySelectorAll(e);return it(t)}function st(r,e){return typeof r=="string"&&(e=r,r=document),r.querySelector(e)}function rt(r,e,t={}){let{disabled:s}=r,{bubbles:o,cancelable:h,detail:d}=t,f=document.createEvent("Event");f.initEvent(e,o||!0,h||!0),f.detail=d||{};try{r.disabled=!1,r.dispatchEvent(f)}finally{r.disabled=s}return f}function it(r){return Array.isArray(r)?r:Array.from?Array.from(r):[].slice.call(r)}var Ne=class{constructor(e,t,s,o={}){this.file=e,this.attributes={filename:e.name,content_type:e.type||"application/octet-stream",byte_size:e.size,checksum:t},this.xhr=new XMLHttpRequest,this.xhr.open("POST",s,!0),this.xhr.responseType="json",this.xhr.setRequestHeader("Content-Type","application/json"),this.xhr.setRequestHeader("Accept","application/json"),this.xhr.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys(o).forEach(d=>{this.xhr.setRequestHeader(d,o[d])});let h=rs("csrf-token");h!=null&&this.xhr.setRequestHeader("X-CSRF-Token",h),this.xhr.addEventListener("load",d=>this.requestDidLoad(d)),this.xhr.addEventListener("error",d=>this.requestDidError(d))}get status(){return this.xhr.status}get response(){let{responseType:e,response:t}=this.xhr;return e=="json"?t:JSON.parse(t)}create(e){this.callback=e,this.xhr.send(JSON.stringify({blob:this.attributes}))}requestDidLoad(e){if(this.status>=200&&this.status<300){let{response:t}=this,{direct_upload:s}=t;delete t.direct_upload,this.attributes=t,this.directUploadData=s,this.callback(null,this.toJSON())}else this.requestDidError(e)}requestDidError(e){this.callback(`Error creating Blob for "${this.file.name}". Status: ${this.status}`)}toJSON(){let e={};for(let t in this.attributes)e[t]=this.attributes[t];return e}},Le=class{constructor(e){this.blob=e,this.file=e.file;let{url:t,headers:s}=e.directUploadData;this.xhr=new XMLHttpRequest,this.xhr.open("PUT",t,!0),this.xhr.responseType="text";for(let o in s)this.xhr.setRequestHeader(o,s[o]);this.xhr.addEventListener("load",o=>this.requestDidLoad(o)),this.xhr.addEventListener("error",o=>this.requestDidError(o))}create(e){this.callback=e,this.xhr.send(this.file.slice())}requestDidLoad(e){let{status:t,response:s}=this.xhr;t>=200&&t<300?this.callback(null,s):this.requestDidError(e)}requestDidError(e){this.callback(`Error storing "${this.file.name}". Status: ${this.xhr.status}`)}},ns=0,W=class{constructor(e,t,s,o={}){this.id=++ns,this.file=e,this.url=t,this.delegate=s,this.customHeaders=o}create(e){z.create(this.file,(t,s)=>{if(t){e(t);return}let o=new Ne(this.file,s,this.url,this.customHeaders);Ze(this.delegate,"directUploadWillCreateBlobWithXHR",o.xhr),o.create(h=>{if(h)e(h);else{let d=new Le(o);Ze(this.delegate,"directUploadWillStoreFileWithXHR",d.xhr),d.create(f=>{f?e(f):e(null,o.toJSON())})}})})}};function Ze(r,e,...t){if(r&&typeof r[e]=="function")return r[e](...t)}var $e=class{constructor(e,t){this.input=e,this.file=t,this.directUpload=new W(this.file,this.url,this),this.dispatch("initialize")}start(e){let t=document.createElement("input");t.type="hidden",t.name=this.input.name,this.input.insertAdjacentElement("beforebegin",t),this.dispatch("start"),this.directUpload.create((s,o)=>{s?(t.parentNode.removeChild(t),this.dispatchError(s)):t.value=o.signed_id,this.dispatch("end"),e(s)})}uploadRequestDidProgress(e){let t=e.loaded/e.total*100;t&&this.dispatch("progress",{progress:t})}get url(){return this.input.getAttribute("data-direct-upload-url")}dispatch(e,t={}){return t.file=this.file,t.id=this.directUpload.id,rt(this.input,`direct-upload:${e}`,{detail:t})}dispatchError(e){this.dispatch("error",{error:e}).defaultPrevented||alert(e)}directUploadWillCreateBlobWithXHR(e){this.dispatch("before-blob-request",{xhr:e})}directUploadWillStoreFileWithXHR(e){this.dispatch("before-storage-request",{xhr:e}),e.upload.addEventListener("progress",t=>this.uploadRequestDidProgress(t))}},os="input[type=file][data-direct-upload-url]:not([disabled])",De=class{constructor(e){this.form=e,this.inputs=is(e,os).filter(t=>t.files.length)}start(e){let t=this.createDirectUploadControllers(),s=()=>{let o=t.shift();o?o.start(h=>{h?(e(h),this.dispatch("end")):s()}):(e(),this.dispatch("end"))};this.dispatch("start"),s()}createDirectUploadControllers(){let e=[];return this.inputs.forEach(t=>{it(t.files).forEach(s=>{let o=new $e(t,s);e.push(o)})}),e}dispatch(e,t={}){return rt(this.form,`direct-uploads:${e}`,{detail:t})}},Be="data-direct-uploads-processing",ke=new WeakMap,et=!1;function je(){et||(et=!0,document.addEventListener("click",as,!0),document.addEventListener("submit",cs,!0),document.addEventListener("ajax:before",ls))}function as(r){let e=r.target.closest("button, input");e&&e.type==="submit"&&e.form&&ke.set(e.form,e)}function cs(r){nt(r)}function ls(r){r.target.tagName=="FORM"&&nt(r)}function nt(r){let e=r.target;if(e.hasAttribute(Be)){r.preventDefault();return}let t=new De(e),{inputs:s}=t;s.length&&(r.preventDefault(),e.setAttribute(Be,""),s.forEach(us),t.start(o=>{e.removeAttribute(Be),o?s.forEach(ds):hs(e)}))}function hs(r){let e=ke.get(r)||st(r,"input[type=submit], button[type=submit]");if(e){let{disabled:t}=e;e.disabled=!1,e.focus(),e.click(),e.disabled=t}else e=document.createElement("input"),e.type="submit",e.style.display="none",r.appendChild(e),e.click(),r.removeChild(e);ke.delete(r)}function us(r){r.disabled=!0}function ds(r){r.disabled=!1}function fs(){window.ActiveStorage&&je()}setTimeout(fs,1);var H=class extends m{connect(){this.hasInputTarget&&(this.inputTarget.disabled=!0)}copy(r){if(r.preventDefault(),!this.hasInputTarget)return;let e=this.inputTarget.innerHTML||this.inputTarget.value;navigator.clipboard.writeText(e)}};E(H,"targets",["input"]);var J=class extends m{toggle(r){r.preventDefault();let e=this.controlTarget;e.dataset.checked?(this.fieldTarget.value=!1,delete e.dataset.checked):(this.fieldTarget.value=!0,e.dataset.checked=!0)}};E(J,"targets",["field","control"]);var ne=class extends m{close(){this.element.classList.remove("lui:opacity-100"),this.element.classList.add("lui:opacity-0"),setTimeout(()=>{this.element.classList.add("lui:hidden")},300)}};var oe=class extends m{openModal(){this.findElement("lui-modal").open()}closeModal(){this.findElement("lui-modal").close()}findElement(r){let e=this.element.dataset.target.replace("#",""),t=document.getElementById(e);return this.application.getControllerForElementAndIdentifier(t,r)}};var j=class extends m{connect(){this.openFirstValue&&this.openItem(this.itemTargets[0])}toggle(r){r.preventDefault(),this.itemTargets.forEach(e=>{e.contains(r.target)?this.isOpen(e)?this.closeItem(e):this.openItem(e):this.closeItem(e)})}openItem(r){let e=r.querySelector("[data-lui-accordion-target=content]");e.classList.remove("lui:grid-rows-[0fr]"),e.classList.add("lui:grid-rows-[1fr]"),e.classList.remove("lui:opacity-0"),e.classList.add("lui:opacity-100"),r.querySelector("[data-lui-accordion-target=arrow]").classList.add("lui:rotate-180")}closeItem(r){let e=r.querySelector("[data-lui-accordion-target=content]");e.classList.remove("lui:grid-rows-[1fr]"),e.classList.add("lui:grid-rows-[0fr]"),e.classList.remove("lui:opacity-100"),e.classList.add("lui:opacity-0"),r.querySelector("[data-lui-accordion-target=arrow]").classList.remove("lui:rotate-180")}isOpen(r){return r.querySelector("[data-lui-accordion-target=content]").classList.contains("lui:grid-rows-[1fr]")}};E(j,"targets",["content","item"]),E(j,"values",{openFirst:{type:Boolean,default:!0}});var I=class extends m{connect(){this.dialogTarget.addEventListener("click",this.onClick.bind(this)),this.openValue&&this.open()}disconnect(){this.dialogTarget.removeEventListener("click",this.onClick.bind(this))}open(){this.dialogTarget.showModal()}close(){this.dialogTarget.setAttribute("closing",""),Promise.all(this.dialogTarget.getAnimations().map(r=>r.finished)).then(()=>{this.dialogTarget.removeAttribute("closing"),this.dialogTarget.close()})}onClick(r){r.target===this.dialogTarget&&this.dialogTarget.close()}submitForm(){this.dialogTarget.querySelector("form").requestSubmit()}};E(I,"targets",["dialog"]),E(I,"values",{open:Boolean});var V=class extends m{connect(){this.initialShowValue||this.itemTargets.forEach(r=>{r.classList.add("hidden")})}toggle(r){r.preventDefault(),this.itemTargets.forEach(e=>{e.classList.toggle("hidden")})}};E(V,"targets",["item"]),E(V,"values",{initialShow:Boolean});var X=class extends m{toggle(r){r.preventDefault();let e=r.target;e.dataset.checked?(this.fieldTarget.value=!1,delete e.dataset.checked):(this.fieldTarget.value=!0,e.dataset.checked=!0)}};E(X,"targets",["field"]);var Ie=class extends m{};Ie.debounces=[];var Ve=class extends m{};Ve.throttles=[];var ps={enterFromClass:"enter",enterActiveClass:"enterStart",enterToClass:"enterEnd",leaveFromClass:"leave",leaveActiveClass:"leaveStart",leaveToClass:"leaveEnd"},ms={transitioned:!1,hiddenClass:"hidden",preserveOriginalClass:!0,removeToClasses:!0},ot=(r,e={})=>{var t,s,o;let h=r,d=h.element.dataset.transitionTarget,f;d&&(f=h[`${d}Target`]);let g=(e==null?void 0:e.element)||f||h.element;if(!(g instanceof HTMLElement||g instanceof SVGElement))return;let v=g.dataset,w=parseInt(v.leaveAfter||"")||e.leaveAfter||0,{transitioned:B,hiddenClass:x,preserveOriginalClass:G,removeToClasses:k}=Object.assign({},ms,e),N=(t=h.enter)===null||t===void 0?void 0:t.bind(h),b=(s=h.leave)===null||s===void 0?void 0:s.bind(h),u=(o=h.toggleTransition)===null||o===void 0?void 0:o.bind(h);function l(p){return M(this,null,function*(){if(h.transitioned)return;h.transitioned=!0,N&&N(p);let O=S("enterFrom",e,v),L=S("enterActive",e,v),$=S("enterTo",e,v),D=S("leaveTo",e,v);x&&g.classList.remove(x),k||A(g,D),yield c(g,O,L,$,x,G,k),w>0&&setTimeout(()=>{n(p)},w)})}function n(p){return M(this,null,function*(){if(!h.transitioned)return;h.transitioned=!1,b&&b(p);let O=S("leaveFrom",e,v),L=S("leaveActive",e,v),$=S("leaveTo",e,v),D=S("enterTo",e,v);k||A(g,D),yield c(g,O,L,$,x,G,k),x&&g.classList.add(x)})}function i(p){u&&u(p),h.transitioned?n():l()}function c(p,O,L,$,D,ct,lt){return M(this,null,function*(){let P=[];ct&&(O.forEach(T=>p.classList.contains(T)&&T!==D&&P.push(T)),L.forEach(T=>p.classList.contains(T)&&T!==D&&P.push(T)),$.forEach(T=>p.classList.contains(T)&&T!==D&&P.push(T))),y(p,O),A(p,P),y(p,L),yield vs(),A(p,O),y(p,$),yield bs(p),A(p,L),lt&&A(p,$),y(p,P)})}function a(){h.transitioned=B,B?(x&&g.classList.remove(x),l()):(x&&g.classList.add(x),n())}function y(p,O){O.length>0&&p.classList.add(...O)}function A(p,O){O.length>0&&p.classList.remove(...O)}return a(),Object.assign(h,{enter:l,leave:n,toggleTransition:i}),[l,n,i]};function S(r,e,t){let s=`transition${r[0].toUpperCase()}${r.substr(1)}`,o=ps[r],h=e[r]||t[s]||t[o]||" ";return ys(h)?[]:h.split(" ")}function bs(r){return M(this,null,function*(){return new Promise(e=>{let t=Number(getComputedStyle(r).transitionDuration.split(",")[0].replace("s",""))*1e3;setTimeout(()=>{e(t)},t)})})}function vs(){return M(this,null,function*(){return new Promise(r=>{requestAnimationFrame(()=>{requestAnimationFrame(r)})})})}function ys(r){return r.length===0||!r.trim()}var _=class extends m{connect(){ot(this,{element:this.menuTarget,hiddenClass:"lui:hidden"})}toggle(){this.toggleTransition()}hide(e){!this.element.contains(e.target)&&!this.menuTarget.classList.contains("lui:hidden")&&this.leave()}};E(_,"targets",["menu"]);var _e=class{constructor(e,t){this.controller=t,this.file=e,this.directUpload=new W(e,this.controller.inputTarget.dataset.directUploadUrl,this)}process(){this.insertUpload(),this.directUpload.create((e,t)=>{if(e){let o=this.controller.filesTarget.querySelector(`#upload_${this.directUpload.id}`).querySelector("[data-lui-dropzone-target='status']");o.textContent="Failed. "+e,o.classList.add("text-red-500")}else{let s=document.createElement("input");s.setAttribute("type","hidden"),s.setAttribute("value",t.signed_id),s.name=this.controller.inputTarget.name,this.controller.filesTarget.querySelector(`#upload_${this.directUpload.id}`).appendChild(s),this.controller.inputTarget.value=""}})}insertUpload(){let e=this.controller.templateTarget.content.cloneNode(!0);e.querySelector("#\\#NEW_FILE").id=`upload_${this.directUpload.id}`,e.querySelector("[data-lui-dropzone-target='filename']").textContent=this.file.name,e.querySelector("[data-lui-dropzone-target='status']").textContent="Uploading...",this.controller.filesTarget.appendChild(e)}directUploadWillStoreFileWithXHR(e){e.upload.addEventListener("progress",t=>this.updateProgress(t))}updateProgress(e){let t=(e.loaded/e.total*100).toFixed(0),s=t==100?"Uploaded":"Uploading...",o=this.controller.filesTarget.querySelector(`#upload_${this.directUpload.id}`);o.querySelector("[data-lui-dropzone-target='status']").textContent=s,o.querySelector("[data-lui-dropzone-target='progressbar']").style.width=`${t}%`,o.querySelector("[data-lui-dropzone-target='percentage-progress']").textContent=`${t}%`}},Q=class extends m{selectFiles(r){this.inputTarget.click()}uploadFiles(r){r.preventDefault(),[...r.dataTransfer?r.dataTransfer.files:r.target.files].forEach(t=>new _e(t,this).process())}activate(r){r.preventDefault()}removeFile(r){r.preventDefault(),r.target.closest("[data-lui-dropzone-target='file']").remove()}};E(Q,"targets",["input","template","files"]);var F="lui";je();var at=re.start();window.Stimulus=at;function Es(r){r.register(`${F}-clipboard`,H),r.register(`${F}-checkbox`,J),r.register(`${F}-banner`,ne),r.register(`${F}-main`,oe),r.register(`${F}-accordion`,j),r.register(`${F}-modal`,I),r.register(`${F}-reveal`,V),r.register(`${F}-switch`,X),r.register(`${F}-dropdown`,_),r.register(`${F}-dropzone`,Q)}Es(at);})();
|
@@ -7,7 +7,7 @@ class LightningUiKit::AlertComponent < LightningUiKit::BaseComponent
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def default_classes
|
10
|
-
"flex items-center p-4 text-sm text-gray-800 rounded-lg bg-gray-50"
|
10
|
+
"lui:flex lui:items-center lui:p-4 lui:text-sm lui:text-gray-800 lui:rounded-lg lui:bg-gray-50"
|
11
11
|
end
|
12
12
|
|
13
13
|
def classes
|
@@ -1,20 +1,20 @@
|
|
1
1
|
<%= tag.span(
|
2
2
|
class: class_names(
|
3
|
-
"inline-grid shrink-0 align-middle [--avatar-radius:20%] [--ring-opacity:20%] *:col-start-1 *:row-start-1 outline
|
3
|
+
"lui:inline-grid lui:shrink-0 lui:align-middle lui:[--avatar-radius:20%] lui:[--ring-opacity:20%] *:lui:col-start-1 *:lui:row-start-1 lui:outline lui:-outline-offset-1 lui:outline-black/(--ring-opacity)",
|
4
4
|
SIZE_CLASSES.fetch(@size, SIZE_CLASSES[:md]),
|
5
|
-
@initials ? "text-white bg-zinc-900" : "text-zinc-500 bg-zinc-200",
|
6
|
-
@square ? "rounded-(--avatar-radius)
|
5
|
+
@initials ? "lui:text-white lui:bg-zinc-900" : "lui:text-zinc-500 lui:bg-zinc-200",
|
6
|
+
@square ? "lui:rounded-(--avatar-radius) lui:*:rounded-(--avatar-radius)" : "lui:rounded-full lui:*:rounded-full",
|
7
7
|
@options[:class]
|
8
8
|
),
|
9
9
|
data: { slot: "avatar" }
|
10
10
|
) do %>
|
11
11
|
<% if @initials %>
|
12
|
-
<svg class="size-full fill-current p-[5%] text-[48px] font-medium uppercase select-none" viewBox="0 0 100 100" aria-hidden="true">
|
12
|
+
<svg class="lui:size-full lui:fill-current lui:p-[5%] lui:text-[48px] lui:font-medium lui:uppercase lui:select-none" viewBox="0 0 100 100" aria-hidden="true">
|
13
13
|
<text x="50%" y="50%" alignment-baseline="middle" dominant-baseline="middle" text-anchor="middle" dy=".125em">
|
14
14
|
<%= @initials %>
|
15
15
|
</text>
|
16
16
|
</svg>
|
17
17
|
<% else %>
|
18
|
-
<%= image_tag(@url, class: "size-full", alt: @alt) %>
|
18
|
+
<%= image_tag(@url, class: "lui:size-full", alt: @alt) %>
|
19
19
|
<% end %>
|
20
20
|
<% end %>
|
@@ -2,9 +2,9 @@
|
|
2
2
|
|
3
3
|
class LightningUiKit::AvatarComponent < LightningUiKit::BaseComponent
|
4
4
|
SIZE_CLASSES = {
|
5
|
-
sm: "size-6",
|
6
|
-
md: "size-8",
|
7
|
-
lg: "size-10"
|
5
|
+
sm: "lui:size-6",
|
6
|
+
md: "lui:size-8",
|
7
|
+
lg: "lui:size-10"
|
8
8
|
}
|
9
9
|
|
10
10
|
def initialize(url: nil, size: :md, initials: nil, square: false, alt: nil, **options)
|
@@ -9,13 +9,13 @@ class LightningUiKit::BadgeComponent < LightningUiKit::BaseComponent
|
|
9
9
|
def classes
|
10
10
|
status_classes = case @status
|
11
11
|
when :success
|
12
|
-
"bg-green-200 text-zinc-500"
|
12
|
+
"lui:bg-green-200 lui:text-zinc-500"
|
13
13
|
when :warning
|
14
|
-
"bg-yellow-200 text-zinc-500"
|
14
|
+
"lui:bg-yellow-200 lui:text-zinc-500"
|
15
15
|
when :error
|
16
|
-
"bg-red-600/80 text-white"
|
16
|
+
"lui:bg-red-600/80 lui:text-white"
|
17
17
|
else
|
18
|
-
"bg-zinc-400/20 text-zinc-500"
|
18
|
+
"lui:bg-zinc-400/20 lui:text-zinc-500"
|
19
19
|
end
|
20
20
|
[defalt_classes, status_classes].join(" ")
|
21
21
|
end
|
@@ -25,44 +25,44 @@ class LightningUiKit::BadgeComponent < LightningUiKit::BaseComponent
|
|
25
25
|
when :complete
|
26
26
|
case @status
|
27
27
|
when :success
|
28
|
-
"bg-green-600 border-green-600"
|
28
|
+
"lui:bg-green-600 lui:border-green-600"
|
29
29
|
when :warning
|
30
|
-
"bg-yellow-400 border-yellow-400"
|
30
|
+
"lui:bg-yellow-400 lui:border-yellow-400"
|
31
31
|
when :error
|
32
|
-
"bg-red-700 border-red-700"
|
32
|
+
"lui:bg-red-700 lui:border-red-700"
|
33
33
|
else
|
34
|
-
"bg-zinc-400 border-zinc-400"
|
34
|
+
"lui:bg-zinc-400 lui:border-zinc-400"
|
35
35
|
end
|
36
36
|
when :incomplete
|
37
37
|
case @status
|
38
38
|
when :error
|
39
|
-
"bg-transparent border-white"
|
39
|
+
"lui:bg-transparent lui:border-white"
|
40
40
|
else
|
41
|
-
"bg-transparent border-zinc-400"
|
41
|
+
"lui:bg-transparent lui:border-zinc-400"
|
42
42
|
end
|
43
43
|
when :partialy_complete
|
44
|
-
partialy_complete_classes = "relative after:w-[3.75px] after:h-[8.2px]\
|
45
|
-
after:border-transparent after:border-[1px] after:-rotate-45 after:absolute after:-top-[1px]\
|
46
|
-
after:left-[1px] after:margin-0 after-margin-y-[1px]"
|
44
|
+
partialy_complete_classes = "lui:relative lui:after:w-[3.75px] lui:after:h-[8.2px]\
|
45
|
+
lui:after:border-transparent lui:after:border-[1px] lui:after:-rotate-45 lui:after:absolute lui:after:-top-[1px]\
|
46
|
+
lui:after:left-[1px] lui:after:margin-0 lui:after-margin-y-[1px]"
|
47
47
|
case @status
|
48
48
|
when :success
|
49
|
-
"#{partialy_complete_classes} border-green-600 after:border-l-green-600 after:border-r-green-600"
|
49
|
+
"#{partialy_complete_classes} lui:border-green-600 lui:after:border-l-green-600 lui:after:border-r-green-600"
|
50
50
|
when :warning
|
51
|
-
"#{partialy_complete_classes} border-yellow-400 after:border-l-yellow-400 after:border-r-yellow-400"
|
51
|
+
"#{partialy_complete_classes} lui:border-yellow-400 lui:after:border-l-yellow-400 lui:after:border-r-yellow-400"
|
52
52
|
when :error
|
53
|
-
"#{partialy_complete_classes} border-white after:border-l-white after:border-r-white"
|
53
|
+
"#{partialy_complete_classes} lui:border-white lui:after:border-l-white lui:after:border-r-white"
|
54
54
|
else
|
55
|
-
"#{partialy_complete_classes} border-zinc-400 after:border-l-zinc-400 after:border-r-zinc-400"
|
55
|
+
"#{partialy_complete_classes} lui:border-zinc-400 lui:after:border-l-zinc-400 lui:after:border-r-zinc-400"
|
56
56
|
end
|
57
57
|
end
|
58
58
|
[default_progress_classes, progress_classes].join(" ")
|
59
59
|
end
|
60
60
|
|
61
61
|
def default_progress_classes
|
62
|
-
"h-2 w-2 rounded-[3px] border-[1px]"
|
62
|
+
"lui:h-2 lui:w-2 lui:rounded-[3px] lui:border-[1px]"
|
63
63
|
end
|
64
64
|
|
65
65
|
def defalt_classes
|
66
|
-
"relative inline-flex items-center relative gap-x-1.5 rounded-[10px] px-2.5 py-1 text-sm font-medium sm:text-xs forced-colors:outline"
|
66
|
+
"lui:relative lui:inline-flex lui:items-center lui:relative lui:gap-x-1.5 lui:rounded-[10px] lui:px-2.5 lui:py-1 lui:text-sm lui:font-medium lui:sm:text-xs lui:forced-colors:outline"
|
67
67
|
end
|
68
68
|
end
|
@@ -1,16 +1,16 @@
|
|
1
1
|
<%= tag.div(class: classes, data: { type: @type, controller: "lui-banner" }) do %>
|
2
|
-
<div data-slot="header" class="flex items-center px-4 py-3">
|
3
|
-
<%= heroicon(icon, variant: :outline, options: { class: "shrink-0 w-5 h-5 me-2" }) %>
|
4
|
-
<span class="sr-only"><%= @type.to_s.humanize %></span>
|
5
|
-
<h3 class="text-md font-medium"><%= @title %></h3>
|
2
|
+
<div data-slot="header" class="lui:flex lui:items-center lui:px-4 lui:py-3">
|
3
|
+
<%= heroicon(icon, variant: :outline, options: { class: "lui:shrink-0 lui:w-5 lui:h-5 lui:me-2" }) %>
|
4
|
+
<span class="lui:sr-only"><%= @type.to_s.humanize %></span>
|
5
|
+
<h3 class="lui:text-md lui:font-medium"><%= @title %></h3>
|
6
6
|
</div>
|
7
7
|
|
8
|
-
<div class="text-sm text-gray-800 p-4">
|
8
|
+
<div class="lui:text-sm lui:text-gray-800 lui:p-4">
|
9
9
|
<%= content %>
|
10
10
|
</div>
|
11
11
|
|
12
12
|
<% if footer.present? %>
|
13
|
-
<div class="p-4 pt-0">
|
13
|
+
<div class="lui:p-4 lui:pt-0">
|
14
14
|
<%= footer %>
|
15
15
|
</div>
|
16
16
|
<% end %>
|
@@ -12,9 +12,9 @@ class LightningUiKit::BannerComponent < LightningUiKit::BaseComponent
|
|
12
12
|
def classes
|
13
13
|
type_classes = case @type
|
14
14
|
when :error
|
15
|
-
"
|
15
|
+
"lui:*:data-[slot=header]:bg-red-600/80 lui:*:data-[slot=header]:text-white"
|
16
16
|
else
|
17
|
-
"
|
17
|
+
"lui:*:data-[slot=header]:bg-gray-50"
|
18
18
|
end
|
19
19
|
|
20
20
|
merge_classes([default_classes, type_classes, @options[:class]].compact.join(" "))
|
@@ -30,6 +30,6 @@ class LightningUiKit::BannerComponent < LightningUiKit::BaseComponent
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def default_classes
|
33
|
-
"border border-zinc-950/10 rounded-lg overflow-hidden transition-opacity duration-300 ease-out opacity-100"
|
33
|
+
"lui:border lui:border-zinc-950/10 lui:rounded-lg lui:overflow-hidden lui:transition-opacity lui:duration-300 lui:ease-out lui:opacity-100"
|
34
34
|
end
|
35
35
|
end
|
@@ -30,46 +30,47 @@ class LightningUiKit::ButtonComponent < LightningUiKit::BaseComponent
|
|
30
30
|
|
31
31
|
case @size
|
32
32
|
when :small
|
33
|
-
class_list << "text-xs"
|
33
|
+
class_list << "lui:text-xs"
|
34
34
|
when :default
|
35
|
-
class_list << "text-base/6 font-semibold sm:text-sm/6"
|
35
|
+
class_list << "lui:text-base/6 lui:font-semibold lui:sm:text-sm/6"
|
36
36
|
end
|
37
37
|
|
38
38
|
merge_classes(class_list.compact.join(" "))
|
39
39
|
end
|
40
40
|
|
41
41
|
def destructive_classes
|
42
|
-
"text-white border-red-500 hover:bg-red-600 active:bg-red-700\
|
43
|
-
[--btn-bg:var(--color-red-600)]\
|
44
|
-
[--btn-border:var(--color-red-950)]/90
|
45
|
-
[--btn-hover-overlay:var(--color-white)]/10\
|
46
|
-
[--btn-icon:var(--color-red-400)]\
|
47
|
-
active:[--btn-icon:var(--color-zinc-300)] hover:[--btn-icon:var(--color-zinc-300)] cursor-pointer"
|
42
|
+
"lui:text-white lui:border-red-500 lui:hover:bg-red-600 lui:active:bg-red-700\
|
43
|
+
lui:[--btn-bg:var(--lui-color-red-600)]\
|
44
|
+
lui:[--btn-border:var(--lui-color-red-950)]/90
|
45
|
+
lui:[--btn-hover-overlay:var(--lui-color-white)]/10\
|
46
|
+
lui:[--btn-icon:var(--lui-color-red-400)]\
|
47
|
+
lui:active:[--btn-icon:var(--lui-color-zinc-300)] lui:hover:[--btn-icon:var(--lui-color-zinc-300)] lui:cursor-pointer"
|
48
48
|
end
|
49
49
|
|
50
|
-
# TODO:
|
51
50
|
def default_classes
|
52
|
-
"relative isolate rounded-lg border inline-flex items-baseline justify-center gap-x-2 px-4 py-2 sm:px-[calc(--spacing(3)-1px)]\
|
53
|
-
sm:py-[calc(--spacing(1.5)-1px)] focus:outline-hidden
|
54
|
-
|
55
|
-
sm:*:data-[slot=icon]:my-1 sm:*:data-[slot=icon]:size-4 border-transparent bg-(--btn-border) before:absolute before:inset-0\
|
56
|
-
before:-z-10 before:rounded-[calc(var(--radius-lg)-1px)] before:bg-(--btn-bg) before:shadow-sm after:absolute after:inset-0
|
57
|
-
after:-z-10 after:rounded-[calc(var(--radius-lg)-1px)] after:shadow-[shadow:inset_0_1px_--theme(--color-white/15%)]\
|
58
|
-
active:after:bg-(--btn-hover-overlay) hover:after:bg-(--btn-hover-overlay)
|
59
|
-
|
60
|
-
|
61
|
-
[--btn-
|
62
|
-
[--btn-
|
63
|
-
[--btn-
|
64
|
-
|
51
|
+
"lui:relative lui:isolate lui:rounded-lg lui:border lui:inline-flex lui:items-baseline lui:justify-center lui:gap-x-2 lui:px-4 lui:py-2 lui:sm:px-[calc(--spacing(3)-1px)]\
|
52
|
+
lui:sm:py-[calc(--spacing(1.5)-1px)] lui:focus:outline-hidden lui:*:data-[slot=icon]:-mx-0.5 lui:*:data-[slot=icon]:my-0.5\
|
53
|
+
lui:*:data-[slot=icon]:size-5 lui:*:data-[slot=icon]:shrink-0 lui:*:data-[slot=icon]:self-center lui:*:data-[slot=icon]:text-(--btn-icon)\
|
54
|
+
lui:sm:*:data-[slot=icon]:my-1 lui:sm:*:data-[slot=icon]:size-4 lui:border-transparent lui:bg-(--btn-border) lui:before:absolute lui:before:inset-0\
|
55
|
+
lui:before:-z-10 lui:before:rounded-[calc(var(--lui-radius-lg)-1px)] lui:before:bg-(--btn-bg) lui:before:shadow-sm lui:after:absolute lui:after:inset-0
|
56
|
+
lui:after:-z-10 lui:after:rounded-[calc(var(--lui-radius-lg)-1px)] lui:after:shadow-[shadow:inset_0_1px_--theme(--color-white/15%)]\
|
57
|
+
lui:active:after:bg-(--btn-hover-overlay) lui:hover:after:bg-(--btn-hover-overlay)\
|
58
|
+
lui:disabled:opacity-50 lui:disabled:before:shadow-none lui:disabled:after:shadow-none lui:disabled:hover:after:bg-transparent\
|
59
|
+
lui:text-white lui:cursor-pointer\
|
60
|
+
lui:[--btn-bg:var(--lui-color-zinc-900)]\
|
61
|
+
lui:[--btn-border:var(--lui-color-zinc-950)]/90
|
62
|
+
lui:[--btn-hover-overlay:var(--lui-color-white)]/10\
|
63
|
+
lui:[--btn-icon:var(--lui-color-zinc-400)]\
|
64
|
+
lui:active:[--btn-icon:var(--lui-color-zinc-300)]\
|
65
|
+
lui:hover:[--btn-icon:var(--lui-color-zinc-300)]"
|
65
66
|
end
|
66
67
|
|
67
68
|
def outline_classes
|
68
|
-
"relative isolate inline-flex items-baseline justify-center gap-x-2 rounded-lg border px-[calc(--spacing(3.5)-1px)] py-[calc(--spacing(2.5)-1px)] sm:px-[calc(--spacing(3)-1px)]\
|
69
|
-
sm:py-[calc(--spacing(1.5)-1px)] focus:outline-hidden focus:outline focus:outline-2 focus:outline-offset-2\
|
70
|
-
focus:outline-blue-500 disabled:opacity-50
|
71
|
-
|
72
|
-
sm:*:data-[slot=icon]:size-4 border-zinc-950/10 text-zinc-950 active:bg-zinc-950/[2.5%] hover:bg-zinc-950/[2.5%]\
|
73
|
-
[--btn-icon:var(--color-zinc-500)] active:[--btn-icon:var(--color-zinc-700)] hover:[--btn-icon:var(--color-zinc-700)] cursor-pointer"
|
69
|
+
"lui:relative lui:isolate lui:inline-flex lui:items-baseline lui:justify-center lui:gap-x-2 lui:rounded-lg lui:border lui:px-[calc(--spacing(3.5)-1px)] lui:py-[calc(--spacing(2.5)-1px)] sm:lui:px-[calc(--spacing(3)-1px)]\
|
70
|
+
lui:sm:py-[calc(--spacing(1.5)-1px)] lui:focus:outline-hidden lui:focus:outline lui:focus:outline-2 lui:focus:outline-offset-2\
|
71
|
+
lui:focus:outline-blue-500 lui:disabled:opacity-50 lui:*:data-[slot=icon]:-mx-0.5 lui:*:data-[slot=icon]:my-0.5 lui:*:data-[slot=icon]:size-5\
|
72
|
+
lui:*:data-[slot=icon]:shrink-0 lui:*:data-[slot=icon]:self-center lui:*:data-[slot=icon]:text-(--btn-icon) lui:sm:*:data-[slot=icon]:my-1\
|
73
|
+
lui:sm:*:data-[slot=icon]:size-4 lui:border-zinc-950/10 lui:text-zinc-950 lui:active:bg-zinc-950/[2.5%] lui:hover:bg-zinc-950/[2.5%]\
|
74
|
+
lui:[--btn-icon:var(--lui-color-zinc-500)] lui:active:[--btn-icon:var(--lui-color-zinc-700)] lui:hover:[--btn-icon:var(--lui-color-zinc-700)] lui:cursor-pointer"
|
74
75
|
end
|
75
76
|
end
|
@@ -1,26 +1,47 @@
|
|
1
|
-
<div
|
1
|
+
<div
|
2
|
+
data-controller="lui-checkbox"
|
3
|
+
data-slot="field"
|
4
|
+
class="lui:grid lui:grid-cols-[1.125rem_1fr] lui:items-center lui:gap-x-4 lui:gap-y-1 lui:sm:grid-cols-[1rem_1fr] lui:*:data-[slot=control]:col-start-1 lui:*:data-[slot=control]:row-start-1 lui:*:data-[slot=control]:justify-self-center lui:*:data-[slot=label]:col-start-2 lui:*:data-[slot=label]:row-start-1 lui:*:data-[slot=label]:justify-self-start lui:*:data-[slot=description]:col-start-2 lui:*:data-[slot=description]:row-start-2 lui:has-data-[slot=description]:**:data-[slot=label]:font-medium"
|
5
|
+
>
|
2
6
|
<span
|
3
7
|
data-lui-checkbox-target="control"
|
4
8
|
data-slot="control"
|
5
|
-
class="group inline-flex focus:outline-hidden"
|
9
|
+
class="lui:group lui:inline-flex lui:focus:outline-hidden" role="checkbox" aria-checked="false" tabindex="0"
|
6
10
|
data-action="click->lui-checkbox#toggle"
|
7
11
|
>
|
8
|
-
<span class="relative isolate flex size-[1.125rem] items-center justify-center
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
+
<span class="lui:relative lui:isolate lui:flex lui:size-[1.125rem] lui:items-center lui:justify-center
|
13
|
+
lui:rounded-[0.3125rem] lui:sm:size-4 lui:before:absolute lui:before:inset-0 lui:before:-z-10
|
14
|
+
lui:before:rounded-[calc(0.3125rem-1px)] lui:before:bg-white lui:before:shadow-sm
|
15
|
+
lui:group-data-checked:before:bg-(--checkbox-checked-bg) lui:border lui:border-zinc-950/15
|
16
|
+
lui:group-data-checked:border-transparent lui:group-hover:group-data-checked:border-transparent
|
17
|
+
lui:group-hover:border-zinc-950/30 lui:group-data-checked:bg-(--checkbox-checked-border)
|
18
|
+
lui:after:absolute lui:after:inset-0 lui:after:rounded-[calc(0.3125rem-1px)] lui:after:shadow-[inset_0_1px_--theme(--color-white/15%)]
|
19
|
+
lui:group-data-focus:outline lui:group-data-focus:outline-2 lui:group-data-focus:outline-offset-2
|
20
|
+
lui:group-data-focus:outline-blue-500 lui:group-data-disabled:opacity-50 lui:group-data-disabled:border-zinc-950/25
|
21
|
+
lui:group-data-disabled:bg-zinc-950/5 lui:group-data-disabled:[--checkbox-check:var(--lui-color-zinc-950)]/50
|
22
|
+
lui:group-data-disabled:before:bg-transparent lui:forced-colors:[--checkbox-check:HighlightText] lui:forced-colors:[--checkbox-checked-bg:Highlight]
|
23
|
+
lui:forced-colors:group-data-disabled:[--checkbox-check:Highlight]
|
24
|
+
lui:[--checkbox-check:var(--lui-color-white)]
|
25
|
+
lui:[--checkbox-checked-bg:var(--lui-color-zinc-900)]
|
26
|
+
lui:[--checkbox-checked-border:var(--color-zinc-950)]/90"
|
27
|
+
>
|
28
|
+
<svg class="lui:size-4 lui:stroke-(--checkbox-check) lui:opacity-0 lui:group-data-checked:opacity-100 lui:sm:h-3.5 lui:sm:w-3.5" viewBox="0 0 14 14" fill="none">
|
29
|
+
<path class="lui:opacity-100 lui:group-data-indeterminate:opacity-0" d="M3 8L6 11L11 3.5" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path>
|
30
|
+
<path class="lui:opacity-0 lui:group-data-indeterminate:opacity-100" d="M3 7H11" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path>
|
12
31
|
</svg>
|
13
32
|
</span>
|
14
33
|
</span>
|
15
34
|
<% if @label %>
|
16
|
-
<label
|
35
|
+
<label
|
36
|
+
data-slot="label"
|
37
|
+
class="lui:text-base/6 lui:text-zinc-950 lui:select-none lui:data-disabled:opacity-50 lui:sm:text-sm/6"
|
17
38
|
data-action="click->lui-checkbox#toggle"
|
18
39
|
>
|
19
40
|
<%= @label %>
|
20
41
|
</label>
|
21
42
|
<% end %>
|
22
43
|
<% if @description %>
|
23
|
-
<p data-slot="description" class="text-base/6 text-zinc-500 data-disabled:opacity-50 sm:text-sm/6"
|
44
|
+
<p data-slot="description" class="lui:text-base/6 lui:text-zinc-500 lui:data-disabled:opacity-50 lui:sm:text-sm/6">
|
24
45
|
<%= @description %>
|
25
46
|
</p>
|
26
47
|
<% end %>
|
@@ -1,9 +1,9 @@
|
|
1
|
-
<dt class="col-start-1 border-t border-zinc-950/5 pt-3 text-zinc-500 first:border-none sm:border-t sm:border-zinc-950/5 sm:py-3 flex items-center">
|
1
|
+
<dt class="lui:col-start-1 lui:border-t lui:border-zinc-950/5 lui:pt-3 lui:text-zinc-500 lui:first:border-none lui:sm:border-t lui:sm:border-zinc-950/5 lui:sm:py-3 lui:flex lui:items-center">
|
2
2
|
<%= @label %>
|
3
3
|
</dt>
|
4
4
|
|
5
|
-
<dd class="pt-1 pb-3 text-zinc-950 sm:border-t sm:border-zinc-950/5 sm:py-3 sm:nth-2:border-none flex items-center">
|
6
|
-
<div class="w-full">
|
5
|
+
<dd class="lui:pt-1 lui:pb-3 lui:text-zinc-950 lui:sm:border-t lui:sm:border-zinc-950/5 lui:sm:py-3 lui:sm:nth-2:border-none lui:flex lui:items-center">
|
6
|
+
<div class="lui:w-full">
|
7
7
|
<% if @value %>
|
8
8
|
<%= @value %>
|
9
9
|
<% else %>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<dl class="grid grid-cols-1 text-base/6 sm:grid-cols-[min(50%,--spacing(80))_auto] sm:text-sm/6">
|
1
|
+
<dl class="lui:grid lui:grid-cols-1 lui:text-base/6 lui:sm:grid-cols-[min(50%,--spacing(80))_auto] lui:sm:text-sm/6">
|
2
2
|
<% items.each do |item| %>
|
3
3
|
<%= item %>
|
4
4
|
<% end %>
|
@@ -1,5 +1,5 @@
|
|
1
|
-
<div data-controller="lui-dropdown" class="relative">
|
2
|
-
<button type="button" data-action="lui-dropdown#toggle click@window->lui-dropdown#hide" class="flex items-center justify-between cursor-pointer w-full text-sm/6 font-medium text-zinc-700 hover:text-zinc-950">
|
1
|
+
<div data-controller="lui-dropdown" class="lui:relative">
|
2
|
+
<button type="button" data-action="lui-dropdown#toggle click@window->lui-dropdown#hide" class="lui:flex lui:items-center lui:justify-between lui:cursor-pointer lui:w-full lui:text-sm/6 lui:font-medium lui:text-zinc-700 lui:hover:text-zinc-950">
|
3
3
|
<% if trigger? %>
|
4
4
|
<%= trigger %>
|
5
5
|
<% else %>
|
@@ -8,11 +8,11 @@
|
|
8
8
|
|
9
9
|
<% case @anchor.to_s %>
|
10
10
|
<% when "bottom_right" %>
|
11
|
-
<svg class="w-2.5 h-2.5 ms-2.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 10 6">
|
11
|
+
<svg class="lui:w-2.5 lui:h-2.5 lui:ms-2.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 10 6">
|
12
12
|
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m1 1 4 4 4-4"/>
|
13
13
|
</svg>
|
14
14
|
<% when "top_right" %>
|
15
|
-
<svg class="w-2.5 h-2.5 ms-2.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 10 6">
|
15
|
+
<svg class="lui:w-2.5 lui:h-2.5 lui:ms-2.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 10 6">
|
16
16
|
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m1 5 4-4 4 4"/>
|
17
17
|
</svg>
|
18
18
|
<% end %>
|
@@ -27,7 +27,7 @@
|
|
27
27
|
data-transition-leave-to="opacity-0 scale-95"
|
28
28
|
>
|
29
29
|
<% items.each do |item| %>
|
30
|
-
<div class="px-4 py-2 text-sm/5 font-medium text-zinc-950 hover:bg-zinc-950/5">
|
30
|
+
<div class="lui:px-4 lui:py-2 lui:text-sm/5 lui:font-medium lui:text-zinc-950 lui:hover:bg-zinc-950/5">
|
31
31
|
<%= item %>
|
32
32
|
</div>
|
33
33
|
<% end %>
|
@@ -11,12 +11,12 @@ class LightningUiKit::DropdownComponent < LightningUiKit::BaseComponent
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def menu_classes
|
14
|
-
classes = %w[hidden transition transform p-1 origin-top-left absolute left-0 w-56 rounded-md shadow-lg bg-white ring-1 ring-zinc-950/10 focus:outline-none]
|
14
|
+
classes = %w[lui:hidden lui:transition lui:transform lui:p-1 lui:origin-top-left lui:absolute lui:left-0 lui:w-56 lui:rounded-md lui:shadow-lg lui:bg-white lui:ring-1 lui:ring-zinc-950/10 lui:focus:outline-none]
|
15
15
|
case @position.to_s
|
16
16
|
when "top"
|
17
|
-
classes << "mb-2 top-auto bottom-full"
|
17
|
+
classes << "lui:mb-2 lui:top-auto lui:bottom-full"
|
18
18
|
when "bottom"
|
19
|
-
classes << "mt-2"
|
19
|
+
classes << "lui:mt-2"
|
20
20
|
end
|
21
21
|
classes.join(" ")
|
22
22
|
end
|