@evs-chris/raui
Advanced tools
Comparing version 0.8.37 to 0.8.38
@@ -6,3 +6,3 @@ import Ractive from 'ractive'; | ||
var template = {v:4,t:[{t:7,e:"span",m:[{t:13,n:"class",f:"rautocomplete field-wrapper",g:1},{n:["pop"],t:70,f:{r:["@context","$1"],s:"[(_0).set(\"rac.pop\",_1)]"}}],f:[{t:7,e:"input",m:[{t:8,r:"extra-attributes"},{n:["dblclick"],t:70,f:{r:["rac.pop","@node"],s:"[_0.show(_1)]"}},{n:["focus"],t:70,f:{r:["rac"],s:"[_0.stash()]"}},{n:["input"],t:70,f:{r:["rac","@event"],s:"[_0.input(_1)]"}},{n:["keydown"],t:70,f:{r:["rac","@event"],s:"[_0.key(_1)]"}},{t:73,v:"t",f:"false"},{n:"value",f:[{t:2,r:"rac.display"}],t:13}]}," ",{t:7,e:"rac-pop",m:[{t:13,n:"style",f:"padding: 0;",g:1},{t:13,n:"class",f:"rac-pop",g:1},{n:["init"],t:70,f:{r:["@context","$1"],s:"[(_0).raise(\"pop\",{},_1)]"}},{n:"popped",t:13,f:[{t:2,r:"rac.popped"}]},{n:"where",f:"below",t:13,g:1},{n:"align",f:"end",t:13,g:1},{n:"gap",f:[{t:2,x:{r:[],s:"2"},s:1}],t:13},{n:"offsets",t:13,f:[{t:2,r:"rac.offsets"}]},{n:"fit",t:13,f:[{t:2,r:"rac.fit"}]}],f:[{t:4,f:[{t:7,e:"input",m:[{n:"class-rac-modal",t:13},{n:["input"],t:70,f:{r:["rac","@event"],s:"[_0.input(_1)]"}},{n:["keydown"],t:70,f:{r:["rac","@event"],s:"[_0.key(_1)]"}},{t:73,v:"t",f:"false"},{n:"value",f:[{t:2,r:"rac.display"}],t:13},{n:"autocompletefocus",t:71}]}],n:50,r:"inModal"}," ",{t:7,e:"div",m:[{t:13,n:"class",f:"rac-list",g:1},{n:"tabindex",f:"-1",t:13,g:1}],f:[{t:55,f:[{f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rac-item rac-invalid",g:1}],f:["Loading..."]}],t:4},{t:62,f:[" ",{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rac-item",g:1},{n:"tabindex",f:"-1",t:13,g:1},{n:"class-rac-selected",t:13,f:[{t:2,x:{r:["rac.value","."],s:"_0===_1"}}]},{n:"class-rac-hover",t:13,f:[{t:2,x:{r:["rac.selected","@index"],s:"_0===_1"}}]},{n:["click"],t:70,f:{r:["@context","."],s:"[(_0).set(\"rac.value\",_1)]"}},{n:["mouseover"],t:70,f:{r:["@context","@index"],s:"[(_0).set(\"rac.selected\",_1)]"}}],f:[{t:2,x:{r:["rac","."],s:"_0._display(_1)"}}]}],n:52,r:"items"}," "],n:"items"},{t:63,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rac-item rac-invalid",g:1}],f:["Load failed."]}]}],r:"rac.list"}]}]}]}],e:{"2":function (){return(2);},"[(_0).set(\"rac.pop\",_1)]":function (_0,_1){return([(_0).set("rac.pop",_1)]);},"[_0.show(_1)]":function (_0,_1){return([_0.show(_1)]);},"[_0.stash()]":function (_0){return([_0.stash()]);},"[_0.input(_1)]":function (_0,_1){return([_0.input(_1)]);},"[_0.key(_1)]":function (_0,_1){return([_0.key(_1)]);},"[(_0).raise(\"pop\",{},_1)]":function (_0,_1){return([(_0).raise("pop",{},_1)]);},"_0===_1":function (_0,_1){return(_0===_1);},"[(_0).set(\"rac.value\",_1)]":function (_0,_1){return([(_0).set("rac.value",_1)]);},"[(_0).set(\"rac.selected\",_1)]":function (_0,_1){return([(_0).set("rac.selected",_1)]);},"_0._display(_1)":function (_0,_1){return(_0._display(_1));}}}; | ||
var template = {v:4,t:[{t:7,e:"span",m:[{t:13,n:"class",f:"rautocomplete field-wrapper",g:1},{n:["pop"],t:70,f:{r:["@context","$1"],s:"[(_0).set(\"rac.pop\",_1)]"}}],f:[{t:7,e:"input",m:[{t:8,r:"extra-attributes"},{n:["dblclick"],t:70,f:{r:["rac.pop","@node"],s:"[_0.show(_1)]"}},{n:["focus"],t:70,f:{r:["rac"],s:"[_0.stash()]"}},{n:["input"],t:70,f:{r:["rac","@event"],s:"[_0.input(_1)]"}},{n:["keydown"],t:70,f:{r:["rac","@event"],s:"[_0.key(_1)]"}},{t:73,v:"t",f:"false"},{n:"value",f:[{t:2,r:"rac.display"}],t:13}]}," ",{t:7,e:"div",m:[{t:13,n:"class",f:"rac-drop",g:1},{n:["click"],t:70,f:{r:["rac.pop","@context"],s:"[_0.show((_1).find(\"input\"))]"}}]}," ",{t:7,e:"rac-pop",m:[{t:13,n:"style",f:"padding: 0;",g:1},{t:13,n:"class",f:"rac-pop",g:1},{n:["init"],t:70,f:{r:["@context","$1"],s:"[(_0).raise(\"pop\",{},_1)]"}},{n:"popped",t:13,f:[{t:2,r:"rac.popped"}]},{n:"where",f:"below",t:13,g:1},{n:"align",f:"end",t:13,g:1},{n:"gap",f:[{t:2,x:{r:[],s:"2"},s:1}],t:13},{n:"offsets",t:13,f:[{t:2,r:"rac.offsets"}]},{n:"fit",t:13,f:[{t:2,r:"rac.fit"}]}],f:[{t:4,f:[{t:7,e:"input",m:[{n:"class-rac-modal",t:13},{n:["input"],t:70,f:{r:["rac","@event"],s:"[_0.input(_1)]"}},{n:["keydown"],t:70,f:{r:["rac","@event"],s:"[_0.key(_1)]"}},{t:73,v:"t",f:"false"},{n:"value",f:[{t:2,r:"rac.display"}],t:13},{n:"autocompletefocus",t:71}]}],n:50,r:"inModal"}," ",{t:7,e:"div",m:[{t:13,n:"class",f:"rac-list",g:1},{n:"tabindex",f:"-1",t:13,g:1}],f:[{t:55,f:[{f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rac-item rac-invalid",g:1}],f:["Loading..."]}],t:4},{t:62,f:[" ",{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rac-item",g:1},{n:"tabindex",f:"-1",t:13,g:1},{n:"class-rac-selected",t:13,f:[{t:2,x:{r:["rac.value","."],s:"_0===_1"}}]},{n:"class-rac-hover",t:13,f:[{t:2,x:{r:["rac.selected","@index"],s:"_0===_1"}}]},{n:["click"],t:70,f:{r:["@context","."],s:"[(_0).set(\"rac.value\",_1)]"}},{n:["mouseover"],t:70,f:{r:["@context","@index"],s:"[(_0).set(\"rac.selected\",_1)]"}}],f:[{t:2,x:{r:["rac","."],s:"_0._display(_1)"}}]}],n:52,r:"items"}," "],n:"items"},{t:63,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rac-item rac-invalid",g:1}],f:["Load failed."]}]}],r:"rac.list"}]}]}]}],e:{"2":function (){return(2);},"[(_0).set(\"rac.pop\",_1)]":function (_0,_1){return([(_0).set("rac.pop",_1)]);},"[_0.show(_1)]":function (_0,_1){return([_0.show(_1)]);},"[_0.stash()]":function (_0){return([_0.stash()]);},"[_0.input(_1)]":function (_0,_1){return([_0.input(_1)]);},"[_0.key(_1)]":function (_0,_1){return([_0.key(_1)]);},"[_0.show((_1).find(\"input\"))]":function (_0,_1){return([_0.show((_1).find("input"))]);},"[(_0).raise(\"pop\",{},_1)]":function (_0,_1){return([(_0).raise("pop",{},_1)]);},"_0===_1":function (_0,_1){return(_0===_1);},"[(_0).set(\"rac.value\",_1)]":function (_0,_1){return([(_0).set("rac.value",_1)]);},"[(_0).set(\"rac.selected\",_1)]":function (_0,_1){return([(_0).set("rac.selected",_1)]);},"_0._display(_1)":function (_0,_1){return(_0._display(_1));}}}; | ||
@@ -15,3 +15,2 @@ function safeGet(obj, path) { | ||
var tm; | ||
var root; | ||
@@ -42,3 +41,3 @@ | ||
if (Array.isArray(list)) { | ||
h.set('rac.selected', i < list.length ? i + 1 : 0); | ||
h.set('rac.selected', i < list.length - 1 ? i + 1 : 0); | ||
} else { h.set('rac.selected', 0); } | ||
@@ -61,3 +60,4 @@ } | ||
list(e.target.value); | ||
h.get('rac.pop').show(h.find('input')) | ||
var el = h.find('input'); | ||
if (el && document.activeElement === el) { h.get('rac.pop').show(el); } | ||
}, 500); | ||
@@ -164,5 +164,5 @@ h.set('rac.display', e.target.value); | ||
h.set('rac.offsets', attrs.offsets); | ||
h.set('rac.fit', true); | ||
h.set('rac.fit', 'fit' in attrs ? attrs.fit : true); | ||
} else { | ||
h.set('rac.fit', false); | ||
h.set('rac.fit', 'fit' in attrs ? attrs.fit : false); | ||
} | ||
@@ -179,2 +179,12 @@ h.set('rac.limit', attrs['limit-set']); | ||
var tmScroll; | ||
function scrollView() { | ||
if (tmScroll) { clearTimeout(tm); } | ||
tmScroll = setTimeout(function () { | ||
tmScroll = null; | ||
var el = h.find('.rac-hover'); | ||
if (el) { el.scrollIntoView({behavior: 'smooth', block: 'nearest', inline: 'nearest'}); } | ||
}, 14); | ||
} | ||
var opts = { init: false, defer: true }; | ||
@@ -190,4 +200,4 @@ var watches = [ | ||
h.observe('rac.value', function (v) { | ||
display(); | ||
value(); | ||
display(); | ||
value(); | ||
h.set('rac.popped', false); | ||
@@ -200,4 +210,4 @@ h.set('rac.tempValue', v); | ||
if (which !== h.get('rac.value')) { h.set('rac.value', which); } | ||
}) | ||
]; | ||
}), | ||
h.observe('rac.selected', scrollView) ]; | ||
@@ -215,6 +225,7 @@ function teardown() { | ||
}, { | ||
attributes: ['items', 'selected', 'display', 'value', 'member', 'limit-set', 'offsets', 'display-value'], | ||
attributes: ['items', 'selected', 'display', 'value', 'member', 'limit-set', 'fit', 'offsets', 'display-value'], | ||
css: function(data) { return [(function(data) { | ||
var primary = Object.assign({}, data("raui.primary"), data("raui.autocomplete.primary")); | ||
return (".rautocomplete {\n position: relative;\n display: inline-block;\n }\n \n .rac-pop {\n min-width: 100%;\n }\n \n .rac-pop > .rpop {\n padding: 0;\n }\n \n .rac-list {\n display: flex;\n flex-direction: column;\n max-height: 50vh;\n min-height: 2.125em;\n max-width: 100%;\n overflow: auto;\n }\n \n .rac-item {\n color: " + (primary.fg || '#222') + ";\n background-color: " + (primary.bg || '#fff') + ";\n padding: 0.25em;\n cursor: pointer;\n }\n \n .rac-selected {\n color: " + (primary.bg || '#fff') + ";\n background-color: " + (primary.fga || '#07e') + ";\n }\n \n .rac-hover {\n color: " + (primary.fg || '#222') + ";\n background-color: " + (primary.bc || '#ccc') + ";\n }\n \n .rac-invalid {\n cursor: not-allowed;\n }\n \n input.rac-modal {\n width: 100%;\n box-sizing: border-box;\n }"); | ||
var primary = Object.assign({}, data("raui.primary"), data("raui.autocomplete"), data("raui.autocomplete.primary")); | ||
var drop = Object.assign({}, data('raui.autocomplete.drop'), data('raui.autocomplete.primary.drop')); | ||
return (".rautocomplete {\n position: relative;\n display: inline-block;\n }\n \n .rac-drop {\n width: 2em;\n height: 100%;\n position: absolute;\n top: 0;\n right: 2px;\n cursor: pointer;\n }\n .rac-drop:after {\n font-family: " + (drop.font || 'sans-serif') + ";\n content: " + (drop.string || '\'\u25be\'') + ";\n position: absolute;\n top: calc(50% - 0.5em);\n height: 1em;\n line-height: 1em;\n width: 100%;\n text-align: center;\n font-weight: " + (drop.weight || 'normal') + ";\n color: " + (drop.color || primary.bc || '#ccc') + ";\n }\n \n .rac-pop {\n min-width: 100%;\n }\n \n .rac-pop > .rpop {\n padding: 0;\n }\n \n .rac-list {\n display: flex;\n flex-direction: column;\n max-height: 50vh;\n min-height: 2.125em;\n max-width: 100%;\n overflow: auto;\n }\n \n .rac-item {\n color: " + (primary.fg || '#222') + ";\n background-color: " + (primary.bg || '#fff') + ";\n padding: 0.25em;\n cursor: pointer;\n }\n \n .rac-selected {\n color: " + (primary.bg || '#fff') + ";\n background-color: " + (primary.fga || '#07e') + ";\n }\n \n .rac-hover {\n color: " + (primary.fg || '#222') + ";\n background-color: " + (primary.bc || '#ccc') + ";\n }\n \n .rac-selected.rac-hover {\n background-color: " + (primary.bc || '#ccc') + ";\n color: " + (primary.fga || '#07e') + ";\n }\n \n .rac-invalid {\n cursor: not-allowed;\n }\n \n input.rac-modal {\n width: 100%;\n box-sizing: border-box;\n }"); | ||
}).call(this, data)].join(' '); }, | ||
@@ -221,0 +232,0 @@ cssId: 'rautocomplete', |
@@ -1,1 +0,1 @@ | ||
import Ractive from"ractive";import{Popover}from"./Popover";import{autofocus}from"./form";var template={v:4,t:[{t:7,e:"span",m:[{t:13,n:"class",f:"rautocomplete field-wrapper",g:1},{n:["pop"],t:70,f:{r:["@context","$1"],s:'[(_0).set("rac.pop",_1)]'}}],f:[{t:7,e:"input",m:[{t:8,r:"extra-attributes"},{n:["dblclick"],t:70,f:{r:["rac.pop","@node"],s:"[_0.show(_1)]"}},{n:["focus"],t:70,f:{r:["rac"],s:"[_0.stash()]"}},{n:["input"],t:70,f:{r:["rac","@event"],s:"[_0.input(_1)]"}},{n:["keydown"],t:70,f:{r:["rac","@event"],s:"[_0.key(_1)]"}},{t:73,v:"t",f:"false"},{n:"value",f:[{t:2,r:"rac.display"}],t:13}]}," ",{t:7,e:"rac-pop",m:[{t:13,n:"style",f:"padding: 0;",g:1},{t:13,n:"class",f:"rac-pop",g:1},{n:["init"],t:70,f:{r:["@context","$1"],s:'[(_0).raise("pop",{},_1)]'}},{n:"popped",t:13,f:[{t:2,r:"rac.popped"}]},{n:"where",f:"below",t:13,g:1},{n:"align",f:"end",t:13,g:1},{n:"gap",f:[{t:2,x:{r:[],s:"2"},s:1}],t:13},{n:"offsets",t:13,f:[{t:2,r:"rac.offsets"}]},{n:"fit",t:13,f:[{t:2,r:"rac.fit"}]}],f:[{t:4,f:[{t:7,e:"input",m:[{n:"class-rac-modal",t:13},{n:["input"],t:70,f:{r:["rac","@event"],s:"[_0.input(_1)]"}},{n:["keydown"],t:70,f:{r:["rac","@event"],s:"[_0.key(_1)]"}},{t:73,v:"t",f:"false"},{n:"value",f:[{t:2,r:"rac.display"}],t:13},{n:"autocompletefocus",t:71}]}],n:50,r:"inModal"}," ",{t:7,e:"div",m:[{t:13,n:"class",f:"rac-list",g:1},{n:"tabindex",f:"-1",t:13,g:1}],f:[{t:55,f:[{f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rac-item rac-invalid",g:1}],f:["Loading..."]}],t:4},{t:62,f:[" ",{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rac-item",g:1},{n:"tabindex",f:"-1",t:13,g:1},{n:"class-rac-selected",t:13,f:[{t:2,x:{r:["rac.value","."],s:"_0===_1"}}]},{n:"class-rac-hover",t:13,f:[{t:2,x:{r:["rac.selected","@index"],s:"_0===_1"}}]},{n:["click"],t:70,f:{r:["@context","."],s:'[(_0).set("rac.value",_1)]'}},{n:["mouseover"],t:70,f:{r:["@context","@index"],s:'[(_0).set("rac.selected",_1)]'}}],f:[{t:2,x:{r:["rac","."],s:"_0._display(_1)"}}]}],n:52,r:"items"}," "],n:"items"},{t:63,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rac-item rac-invalid",g:1}],f:["Load failed."]}]}],r:"rac.list"}]}]}]}],e:{2:function(){return 2},'[(_0).set("rac.pop",_1)]':function(_0,_1){return[_0.set("rac.pop",_1)]},"[_0.show(_1)]":function(_0,_1){return[_0.show(_1)]},"[_0.stash()]":function(_0){return[_0.stash()]},"[_0.input(_1)]":function(_0,_1){return[_0.input(_1)]},"[_0.key(_1)]":function(_0,_1){return[_0.key(_1)]},'[(_0).raise("pop",{},_1)]':function(_0,_1){return[_0.raise("pop",{},_1)]},"_0===_1":function(_0,_1){return _0===_1},'[(_0).set("rac.value",_1)]':function(_0,_1){return[_0.set("rac.value",_1)]},'[(_0).set("rac.selected",_1)]':function(_0,_1){return[_0.set("rac.selected",_1)]},"_0._display(_1)":function(_0,_1){return _0._display(_1)}}};function safeGet(obj,path){return path.reduce(function(a,c){return a?a[c]:a},obj)}export var Autocomplete=Ractive.macro(function(h){var tm;var root;h.aliasLocal("rac");h.set("rac.list",[]);h.set("rac.popped",false);h.set("rac.stash",function(){h.set("rac.tempDisplay",h.get("rac.display"));h.set("rac.tempValue",h.get("rac.value"))});h.set("rac.key",function(e){var k=e.which;if(k===27){h.set("rac.popped",false);h.set("rac.display",h.get("rac.tempDisplay"));h.set("rac.value",h.get("rac.tempValue"))}else if(k===38||k===40){e.preventDefault();h.get("rac.pop").show(h.find("input"));var i=h.get("rac.selected");var list=h.get("rac.list");if(k===38){if(i<=0||i==null){h.set("rac.selected",Array.isArray(list)?list.length-1:0)}else{h.set("rac.selected",i-1)}}else{if(Array.isArray(list)){h.set("rac.selected",i<list.length?i+1:0)}else{h.set("rac.selected",0)}}}else if(k===10||k===13){var list$1=h.get("rac.list");if(Array.isArray(list$1)){h.set("rac.value",list$1[h.get("rac.selected")])}}else if(k===9){h.set("rac.popped",false);h.get("rac.updateDisplay")()}});h.set("rac.input",function(e){if(tm){clearTimeout(tm)}tm=setTimeout(function(){tm=null;list(e.target.value);h.get("rac.pop").show(h.find("input"))},500);h.set("rac.display",e.target.value)});h.setTemplate(template);function list(filter){if(filter==null){filter=h.get("rac.value")==null?"":h.get("rac.display")}if(filter===h.get("rac.tempDisplay")){filter=""}var items=h.get("rac._items");if(typeof items==="function"){var res=items(filter);if(typeof res==="object"&&typeof res.then==="function"){res.then(function(v){return h.set("rac.list",v)})}else{h.set("rac.list",res)}}else if(Array.isArray(items)){var member=h.get("rac._display");var re;try{re=new RegExp(filter||"","i")}catch(e){re=new RegExp((filter||"").replace(/([\{\(\[\]\)\}\?\*\^\$])/g,"\\$1"))}h.set("rac.list",items.filter(function(i){return re.test(member(i))}))}else{h.set("rac.list",[])}}function refresh(value,old,path){var v=h.get("rac.displayprop");if(h.get("rac.__display")!==v||h.get("rac._display")===undefined){var def=function(){return h.attributes["display-value"]?h.get("rac.display"):"(none)"};if(typeof v==="string"){var path$1=Ractive.splitKeypath(v);v=function(v){return v==null?def():safeGet(v,path$1)}}else if(Array.isArray(v)){v=function(v){return v==null?def():safeGet(v,v)}}else if(!v){v=function(v){return v==null?def():""+v}}h.set("rac._display",v);h.set("rac.__display",h.get("rac.displayprop"));h.set("rac.display",v(h.get("rac.value")))}v=h.get("rac.member");if(h.get("rac.__member")!==v||h.get("rac._member")===undefined){if(typeof v==="string"){var path$2=Ractive.splitKeypath(v);v=function(v){return safeGet(v,path$2)}}else if(Array.isArray(v)){v=function(v){return safeGet(v,v)}}else if(!v){v=function(v){return v}}h.set("rac._member",v);h.set("rac.__member",h.get("rac.member"))}v=h.get("rac.items");if(h.get("rac.__items")!==v||h.get("rac._items")===undefined){if(Array.isArray(v)){h.set("rac._items",v)}else if(typeof v==="function"){h.set("rac._items",v)}else if(typeof v==="object"&&typeof v.then==="function"){v.then(function(v){h.set("rac._items",v);list()})}else{h.set("rac._items",[])}h.set("rac.__items",h.get("rac.items"))}if(root&&path==="rac.display"&&h.get("rac.limit")&&!root.contains(document.activeElement)){display()}list()}function display(){var member=h.get("rac._display");if(typeof member==="function"){var disp=member(h.get("rac.value"));h.set("rac.display",disp);h.set("rac.tempDisplay",disp)}}function value(){if(h.get("rac._value")&&!h.get("rac.value")){return}var member=h.get("rac._member");if(typeof member==="function"){var v=member(h.get("rac.value"));h.set("rac._value",v)}h.ractive.getContext(h.find("input")).raise("selected",{},h.get("rac._value"),h.get("rac.display"))}h.set("rac.updateDisplay",function(ev){setTimeout(function(){if(root&&h.get("rac.limit")&&!root.contains(document.activeElement)){display()}},140)});function update(attrs){if(attrs.items){h.link(attrs.items,"rac.items")}if(attrs.value){h.link(attrs.value,"rac._value")}if(attrs.selected){h.link(attrs.selected,"rac.selected")}if(attrs["display-value"]){h.link(attrs["display-value"],"rac.display")}if("display"in attrs){h.set("rac.displayprop",attrs.display)}if("member"in attrs){h.set("rac.member",attrs.member)}if("offsets"in attrs){h.set("rac.offsets",attrs.offsets);h.set("rac.fit",true)}else{h.set("rac.fit",false)}h.set("rac.limit",attrs["limit-set"]);if(h.get("rac.limit")&&h.get("input")){var el=h.get("input");if(el!==document.activeElement){display()}}refresh()}update(h.attributes);var opts={init:false,defer:true};var watches=[h.observe("rac.displayprop",refresh,opts),h.observe("rac.memberprop",refresh,opts),h.observe("rac.items",refresh,opts),h.observe("rac.list",function(v){if(Array.isArray(v)){h.set("rac.selected",v.indexOf(h.get("rac.value")))}else{h.set("rac.selected",-1)}},opts),h.observe("rac.value",function(v){display();value();h.set("rac.popped",false);h.set("rac.tempValue",v)}),h.observe("rac._value",function(v){var member=h.get("rac._member");var which=h.get("rac.list").find(function(i){return member(i)===v});if(which!==h.get("rac.value")){h.set("rac.value",which)}})];function teardown(){h.unlink("rac.items");h.unlink("rac._value");h.unlink("rac.selected");h.unlink("rac.display");watches.forEach(function(w){return w.cancel()})}return{teardown:teardown,update:update,render:function render(){root=h.find("span")}}},{attributes:["items","selected","display","value","member","limit-set","offsets","display-value"],css:function(data){return[function(data){var primary=Object.assign({},data("raui.primary"),data("raui.autocomplete.primary"));return".rautocomplete {\n position: relative;\n display: inline-block;\n }\n \n .rac-pop {\n min-width: 100%;\n }\n \n .rac-pop > .rpop {\n padding: 0;\n }\n \n .rac-list {\n display: flex;\n flex-direction: column;\n max-height: 50vh;\n min-height: 2.125em;\n max-width: 100%;\n overflow: auto;\n }\n \n .rac-item {\n color: "+(primary.fg||"#222")+";\n background-color: "+(primary.bg||"#fff")+";\n padding: 0.25em;\n cursor: pointer;\n }\n \n .rac-selected {\n color: "+(primary.bg||"#fff")+";\n background-color: "+(primary.fga||"#07e")+";\n }\n \n .rac-hover {\n color: "+(primary.fg||"#222")+";\n background-color: "+(primary.bc||"#ccc")+";\n }\n \n .rac-invalid {\n cursor: not-allowed;\n }\n \n input.rac-modal {\n width: 100%;\n box-sizing: border-box;\n }"}.call(this,data)].join(" ")},cssId:"rautocomplete",noCssTransform:true});export function FieldType(opts){if(opts===void 0)opts={};return function(attrs,content,handle){return[{t:7,e:opts.name||"autocomplete",m:attrs,f:content}]}}export function plugin(opts){if(opts===void 0)opts={};return function(ref){var instance=ref.instance;instance.partials[opts.name||"autocomplete"]=Autocomplete;instance.components["rac-pop"]=Popover;instance.decorators["autocompletefocus"]=autofocus}}export default plugin; | ||
import Ractive from"ractive";import{Popover}from"./Popover";import{autofocus}from"./form";var template={v:4,t:[{t:7,e:"span",m:[{t:13,n:"class",f:"rautocomplete field-wrapper",g:1},{n:["pop"],t:70,f:{r:["@context","$1"],s:'[(_0).set("rac.pop",_1)]'}}],f:[{t:7,e:"input",m:[{t:8,r:"extra-attributes"},{n:["dblclick"],t:70,f:{r:["rac.pop","@node"],s:"[_0.show(_1)]"}},{n:["focus"],t:70,f:{r:["rac"],s:"[_0.stash()]"}},{n:["input"],t:70,f:{r:["rac","@event"],s:"[_0.input(_1)]"}},{n:["keydown"],t:70,f:{r:["rac","@event"],s:"[_0.key(_1)]"}},{t:73,v:"t",f:"false"},{n:"value",f:[{t:2,r:"rac.display"}],t:13}]}," ",{t:7,e:"div",m:[{t:13,n:"class",f:"rac-drop",g:1},{n:["click"],t:70,f:{r:["rac.pop","@context"],s:'[_0.show((_1).find("input"))]'}}]}," ",{t:7,e:"rac-pop",m:[{t:13,n:"style",f:"padding: 0;",g:1},{t:13,n:"class",f:"rac-pop",g:1},{n:["init"],t:70,f:{r:["@context","$1"],s:'[(_0).raise("pop",{},_1)]'}},{n:"popped",t:13,f:[{t:2,r:"rac.popped"}]},{n:"where",f:"below",t:13,g:1},{n:"align",f:"end",t:13,g:1},{n:"gap",f:[{t:2,x:{r:[],s:"2"},s:1}],t:13},{n:"offsets",t:13,f:[{t:2,r:"rac.offsets"}]},{n:"fit",t:13,f:[{t:2,r:"rac.fit"}]}],f:[{t:4,f:[{t:7,e:"input",m:[{n:"class-rac-modal",t:13},{n:["input"],t:70,f:{r:["rac","@event"],s:"[_0.input(_1)]"}},{n:["keydown"],t:70,f:{r:["rac","@event"],s:"[_0.key(_1)]"}},{t:73,v:"t",f:"false"},{n:"value",f:[{t:2,r:"rac.display"}],t:13},{n:"autocompletefocus",t:71}]}],n:50,r:"inModal"}," ",{t:7,e:"div",m:[{t:13,n:"class",f:"rac-list",g:1},{n:"tabindex",f:"-1",t:13,g:1}],f:[{t:55,f:[{f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rac-item rac-invalid",g:1}],f:["Loading..."]}],t:4},{t:62,f:[" ",{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rac-item",g:1},{n:"tabindex",f:"-1",t:13,g:1},{n:"class-rac-selected",t:13,f:[{t:2,x:{r:["rac.value","."],s:"_0===_1"}}]},{n:"class-rac-hover",t:13,f:[{t:2,x:{r:["rac.selected","@index"],s:"_0===_1"}}]},{n:["click"],t:70,f:{r:["@context","."],s:'[(_0).set("rac.value",_1)]'}},{n:["mouseover"],t:70,f:{r:["@context","@index"],s:'[(_0).set("rac.selected",_1)]'}}],f:[{t:2,x:{r:["rac","."],s:"_0._display(_1)"}}]}],n:52,r:"items"}," "],n:"items"},{t:63,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rac-item rac-invalid",g:1}],f:["Load failed."]}]}],r:"rac.list"}]}]}]}],e:{2:function(){return 2},'[(_0).set("rac.pop",_1)]':function(_0,_1){return[_0.set("rac.pop",_1)]},"[_0.show(_1)]":function(_0,_1){return[_0.show(_1)]},"[_0.stash()]":function(_0){return[_0.stash()]},"[_0.input(_1)]":function(_0,_1){return[_0.input(_1)]},"[_0.key(_1)]":function(_0,_1){return[_0.key(_1)]},'[_0.show((_1).find("input"))]':function(_0,_1){return[_0.show(_1.find("input"))]},'[(_0).raise("pop",{},_1)]':function(_0,_1){return[_0.raise("pop",{},_1)]},"_0===_1":function(_0,_1){return _0===_1},'[(_0).set("rac.value",_1)]':function(_0,_1){return[_0.set("rac.value",_1)]},'[(_0).set("rac.selected",_1)]':function(_0,_1){return[_0.set("rac.selected",_1)]},"_0._display(_1)":function(_0,_1){return _0._display(_1)}}};function safeGet(obj,path){return path.reduce(function(a,c){return a?a[c]:a},obj)}export var Autocomplete=Ractive.macro(function(h){var tm;var root;h.aliasLocal("rac");h.set("rac.list",[]);h.set("rac.popped",false);h.set("rac.stash",function(){h.set("rac.tempDisplay",h.get("rac.display"));h.set("rac.tempValue",h.get("rac.value"))});h.set("rac.key",function(e){var k=e.which;if(k===27){h.set("rac.popped",false);h.set("rac.display",h.get("rac.tempDisplay"));h.set("rac.value",h.get("rac.tempValue"))}else if(k===38||k===40){e.preventDefault();h.get("rac.pop").show(h.find("input"));var i=h.get("rac.selected");var list=h.get("rac.list");if(k===38){if(i<=0||i==null){h.set("rac.selected",Array.isArray(list)?list.length-1:0)}else{h.set("rac.selected",i-1)}}else{if(Array.isArray(list)){h.set("rac.selected",i<list.length-1?i+1:0)}else{h.set("rac.selected",0)}}}else if(k===10||k===13){var list$1=h.get("rac.list");if(Array.isArray(list$1)){h.set("rac.value",list$1[h.get("rac.selected")])}}else if(k===9){h.set("rac.popped",false);h.get("rac.updateDisplay")()}});h.set("rac.input",function(e){if(tm){clearTimeout(tm)}tm=setTimeout(function(){tm=null;list(e.target.value);var el=h.find("input");if(el&&document.activeElement===el){h.get("rac.pop").show(el)}},500);h.set("rac.display",e.target.value)});h.setTemplate(template);function list(filter){if(filter==null){filter=h.get("rac.value")==null?"":h.get("rac.display")}if(filter===h.get("rac.tempDisplay")){filter=""}var items=h.get("rac._items");if(typeof items==="function"){var res=items(filter);if(typeof res==="object"&&typeof res.then==="function"){res.then(function(v){return h.set("rac.list",v)})}else{h.set("rac.list",res)}}else if(Array.isArray(items)){var member=h.get("rac._display");var re;try{re=new RegExp(filter||"","i")}catch(e){re=new RegExp((filter||"").replace(/([\{\(\[\]\)\}\?\*\^\$])/g,"\\$1"))}h.set("rac.list",items.filter(function(i){return re.test(member(i))}))}else{h.set("rac.list",[])}}function refresh(value,old,path){var v=h.get("rac.displayprop");if(h.get("rac.__display")!==v||h.get("rac._display")===undefined){var def=function(){return h.attributes["display-value"]?h.get("rac.display"):"(none)"};if(typeof v==="string"){var path$1=Ractive.splitKeypath(v);v=function(v){return v==null?def():safeGet(v,path$1)}}else if(Array.isArray(v)){v=function(v){return v==null?def():safeGet(v,v)}}else if(!v){v=function(v){return v==null?def():""+v}}h.set("rac._display",v);h.set("rac.__display",h.get("rac.displayprop"));h.set("rac.display",v(h.get("rac.value")))}v=h.get("rac.member");if(h.get("rac.__member")!==v||h.get("rac._member")===undefined){if(typeof v==="string"){var path$2=Ractive.splitKeypath(v);v=function(v){return safeGet(v,path$2)}}else if(Array.isArray(v)){v=function(v){return safeGet(v,v)}}else if(!v){v=function(v){return v}}h.set("rac._member",v);h.set("rac.__member",h.get("rac.member"))}v=h.get("rac.items");if(h.get("rac.__items")!==v||h.get("rac._items")===undefined){if(Array.isArray(v)){h.set("rac._items",v)}else if(typeof v==="function"){h.set("rac._items",v)}else if(typeof v==="object"&&typeof v.then==="function"){v.then(function(v){h.set("rac._items",v);list()})}else{h.set("rac._items",[])}h.set("rac.__items",h.get("rac.items"))}if(root&&path==="rac.display"&&h.get("rac.limit")&&!root.contains(document.activeElement)){display()}list()}function display(){var member=h.get("rac._display");if(typeof member==="function"){var disp=member(h.get("rac.value"));h.set("rac.display",disp);h.set("rac.tempDisplay",disp)}}function value(){if(h.get("rac._value")&&!h.get("rac.value")){return}var member=h.get("rac._member");if(typeof member==="function"){var v=member(h.get("rac.value"));h.set("rac._value",v)}h.ractive.getContext(h.find("input")).raise("selected",{},h.get("rac._value"),h.get("rac.display"))}h.set("rac.updateDisplay",function(ev){setTimeout(function(){if(root&&h.get("rac.limit")&&!root.contains(document.activeElement)){display()}},140)});function update(attrs){if(attrs.items){h.link(attrs.items,"rac.items")}if(attrs.value){h.link(attrs.value,"rac._value")}if(attrs.selected){h.link(attrs.selected,"rac.selected")}if(attrs["display-value"]){h.link(attrs["display-value"],"rac.display")}if("display"in attrs){h.set("rac.displayprop",attrs.display)}if("member"in attrs){h.set("rac.member",attrs.member)}if("offsets"in attrs){h.set("rac.offsets",attrs.offsets);h.set("rac.fit","fit"in attrs?attrs.fit:true)}else{h.set("rac.fit","fit"in attrs?attrs.fit:false)}h.set("rac.limit",attrs["limit-set"]);if(h.get("rac.limit")&&h.get("input")){var el=h.get("input");if(el!==document.activeElement){display()}}refresh()}update(h.attributes);var tmScroll;function scrollView(){if(tmScroll){clearTimeout(tm)}tmScroll=setTimeout(function(){tmScroll=null;var el=h.find(".rac-hover");if(el){el.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})}},14)}var opts={init:false,defer:true};var watches=[h.observe("rac.displayprop",refresh,opts),h.observe("rac.memberprop",refresh,opts),h.observe("rac.items",refresh,opts),h.observe("rac.list",function(v){if(Array.isArray(v)){h.set("rac.selected",v.indexOf(h.get("rac.value")))}else{h.set("rac.selected",-1)}},opts),h.observe("rac.value",function(v){display();value();h.set("rac.popped",false);h.set("rac.tempValue",v)}),h.observe("rac._value",function(v){var member=h.get("rac._member");var which=h.get("rac.list").find(function(i){return member(i)===v});if(which!==h.get("rac.value")){h.set("rac.value",which)}}),h.observe("rac.selected",scrollView)];function teardown(){h.unlink("rac.items");h.unlink("rac._value");h.unlink("rac.selected");h.unlink("rac.display");watches.forEach(function(w){return w.cancel()})}return{teardown:teardown,update:update,render:function render(){root=h.find("span")}}},{attributes:["items","selected","display","value","member","limit-set","fit","offsets","display-value"],css:function(data){return[function(data){var primary=Object.assign({},data("raui.primary"),data("raui.autocomplete"),data("raui.autocomplete.primary"));var drop=Object.assign({},data("raui.autocomplete.drop"),data("raui.autocomplete.primary.drop"));return".rautocomplete {\n position: relative;\n display: inline-block;\n }\n \n .rac-drop {\n width: 2em;\n height: 100%;\n position: absolute;\n top: 0;\n right: 2px;\n cursor: pointer;\n }\n .rac-drop:after {\n font-family: "+(drop.font||"sans-serif")+";\n content: "+(drop.string||"'▾'")+";\n position: absolute;\n top: calc(50% - 0.5em);\n height: 1em;\n line-height: 1em;\n width: 100%;\n text-align: center;\n font-weight: "+(drop.weight||"normal")+";\n color: "+(drop.color||primary.bc||"#ccc")+";\n }\n \n .rac-pop {\n min-width: 100%;\n }\n \n .rac-pop > .rpop {\n padding: 0;\n }\n \n .rac-list {\n display: flex;\n flex-direction: column;\n max-height: 50vh;\n min-height: 2.125em;\n max-width: 100%;\n overflow: auto;\n }\n \n .rac-item {\n color: "+(primary.fg||"#222")+";\n background-color: "+(primary.bg||"#fff")+";\n padding: 0.25em;\n cursor: pointer;\n }\n \n .rac-selected {\n color: "+(primary.bg||"#fff")+";\n background-color: "+(primary.fga||"#07e")+";\n }\n \n .rac-hover {\n color: "+(primary.fg||"#222")+";\n background-color: "+(primary.bc||"#ccc")+";\n }\n \n .rac-selected.rac-hover {\n background-color: "+(primary.bc||"#ccc")+";\n color: "+(primary.fga||"#07e")+";\n }\n \n .rac-invalid {\n cursor: not-allowed;\n }\n \n input.rac-modal {\n width: 100%;\n box-sizing: border-box;\n }"}.call(this,data)].join(" ")},cssId:"rautocomplete",noCssTransform:true});export function FieldType(opts){if(opts===void 0)opts={};return function(attrs,content,handle){return[{t:7,e:opts.name||"autocomplete",m:attrs,f:content}]}}export function plugin(opts){if(opts===void 0)opts={};return function(ref){var instance=ref.instance;instance.partials[opts.name||"autocomplete"]=Autocomplete;instance.components["rac-pop"]=Popover;instance.decorators["autocompletefocus"]=autofocus}}export default plugin; |
{ | ||
"name": "@evs-chris/raui", | ||
"version": "0.8.37", | ||
"version": "0.8.38", | ||
"description": "Components, decorators, and helpers for Ractive apps that are generally Material-ish", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/evs-chris/raui", |
@@ -722,3 +722,3 @@ (function (global, factory) { | ||
var template$1 = {v:4,t:[{t:7,e:"span",m:[{t:13,n:"class",f:"rautocomplete field-wrapper",g:1},{n:["pop"],t:70,f:{r:["@context","$1"],s:"[(_0).set(\"rac.pop\",_1)]"}}],f:[{t:7,e:"input",m:[{t:8,r:"extra-attributes"},{n:["dblclick"],t:70,f:{r:["rac.pop","@node"],s:"[_0.show(_1)]"}},{n:["focus"],t:70,f:{r:["rac"],s:"[_0.stash()]"}},{n:["input"],t:70,f:{r:["rac","@event"],s:"[_0.input(_1)]"}},{n:["keydown"],t:70,f:{r:["rac","@event"],s:"[_0.key(_1)]"}},{t:73,v:"t",f:"false"},{n:"value",f:[{t:2,r:"rac.display"}],t:13}]}," ",{t:7,e:"rac-pop",m:[{t:13,n:"style",f:"padding: 0;",g:1},{t:13,n:"class",f:"rac-pop",g:1},{n:["init"],t:70,f:{r:["@context","$1"],s:"[(_0).raise(\"pop\",{},_1)]"}},{n:"popped",t:13,f:[{t:2,r:"rac.popped"}]},{n:"where",f:"below",t:13,g:1},{n:"align",f:"end",t:13,g:1},{n:"gap",f:[{t:2,x:{r:[],s:"2"},s:1}],t:13},{n:"offsets",t:13,f:[{t:2,r:"rac.offsets"}]},{n:"fit",t:13,f:[{t:2,r:"rac.fit"}]}],f:[{t:4,f:[{t:7,e:"input",m:[{n:"class-rac-modal",t:13},{n:["input"],t:70,f:{r:["rac","@event"],s:"[_0.input(_1)]"}},{n:["keydown"],t:70,f:{r:["rac","@event"],s:"[_0.key(_1)]"}},{t:73,v:"t",f:"false"},{n:"value",f:[{t:2,r:"rac.display"}],t:13},{n:"autocompletefocus",t:71}]}],n:50,r:"inModal"}," ",{t:7,e:"div",m:[{t:13,n:"class",f:"rac-list",g:1},{n:"tabindex",f:"-1",t:13,g:1}],f:[{t:55,f:[{f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rac-item rac-invalid",g:1}],f:["Loading..."]}],t:4},{t:62,f:[" ",{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rac-item",g:1},{n:"tabindex",f:"-1",t:13,g:1},{n:"class-rac-selected",t:13,f:[{t:2,x:{r:["rac.value","."],s:"_0===_1"}}]},{n:"class-rac-hover",t:13,f:[{t:2,x:{r:["rac.selected","@index"],s:"_0===_1"}}]},{n:["click"],t:70,f:{r:["@context","."],s:"[(_0).set(\"rac.value\",_1)]"}},{n:["mouseover"],t:70,f:{r:["@context","@index"],s:"[(_0).set(\"rac.selected\",_1)]"}}],f:[{t:2,x:{r:["rac","."],s:"_0._display(_1)"}}]}],n:52,r:"items"}," "],n:"items"},{t:63,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rac-item rac-invalid",g:1}],f:["Load failed."]}]}],r:"rac.list"}]}]}]}],e:{"2":function (){return(2);},"[(_0).set(\"rac.pop\",_1)]":function (_0,_1){return([(_0).set("rac.pop",_1)]);},"[_0.show(_1)]":function (_0,_1){return([_0.show(_1)]);},"[_0.stash()]":function (_0){return([_0.stash()]);},"[_0.input(_1)]":function (_0,_1){return([_0.input(_1)]);},"[_0.key(_1)]":function (_0,_1){return([_0.key(_1)]);},"[(_0).raise(\"pop\",{},_1)]":function (_0,_1){return([(_0).raise("pop",{},_1)]);},"_0===_1":function (_0,_1){return(_0===_1);},"[(_0).set(\"rac.value\",_1)]":function (_0,_1){return([(_0).set("rac.value",_1)]);},"[(_0).set(\"rac.selected\",_1)]":function (_0,_1){return([(_0).set("rac.selected",_1)]);},"_0._display(_1)":function (_0,_1){return(_0._display(_1));}}}; | ||
var template$1 = {v:4,t:[{t:7,e:"span",m:[{t:13,n:"class",f:"rautocomplete field-wrapper",g:1},{n:["pop"],t:70,f:{r:["@context","$1"],s:"[(_0).set(\"rac.pop\",_1)]"}}],f:[{t:7,e:"input",m:[{t:8,r:"extra-attributes"},{n:["dblclick"],t:70,f:{r:["rac.pop","@node"],s:"[_0.show(_1)]"}},{n:["focus"],t:70,f:{r:["rac"],s:"[_0.stash()]"}},{n:["input"],t:70,f:{r:["rac","@event"],s:"[_0.input(_1)]"}},{n:["keydown"],t:70,f:{r:["rac","@event"],s:"[_0.key(_1)]"}},{t:73,v:"t",f:"false"},{n:"value",f:[{t:2,r:"rac.display"}],t:13}]}," ",{t:7,e:"div",m:[{t:13,n:"class",f:"rac-drop",g:1},{n:["click"],t:70,f:{r:["rac.pop","@context"],s:"[_0.show((_1).find(\"input\"))]"}}]}," ",{t:7,e:"rac-pop",m:[{t:13,n:"style",f:"padding: 0;",g:1},{t:13,n:"class",f:"rac-pop",g:1},{n:["init"],t:70,f:{r:["@context","$1"],s:"[(_0).raise(\"pop\",{},_1)]"}},{n:"popped",t:13,f:[{t:2,r:"rac.popped"}]},{n:"where",f:"below",t:13,g:1},{n:"align",f:"end",t:13,g:1},{n:"gap",f:[{t:2,x:{r:[],s:"2"},s:1}],t:13},{n:"offsets",t:13,f:[{t:2,r:"rac.offsets"}]},{n:"fit",t:13,f:[{t:2,r:"rac.fit"}]}],f:[{t:4,f:[{t:7,e:"input",m:[{n:"class-rac-modal",t:13},{n:["input"],t:70,f:{r:["rac","@event"],s:"[_0.input(_1)]"}},{n:["keydown"],t:70,f:{r:["rac","@event"],s:"[_0.key(_1)]"}},{t:73,v:"t",f:"false"},{n:"value",f:[{t:2,r:"rac.display"}],t:13},{n:"autocompletefocus",t:71}]}],n:50,r:"inModal"}," ",{t:7,e:"div",m:[{t:13,n:"class",f:"rac-list",g:1},{n:"tabindex",f:"-1",t:13,g:1}],f:[{t:55,f:[{f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rac-item rac-invalid",g:1}],f:["Loading..."]}],t:4},{t:62,f:[" ",{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rac-item",g:1},{n:"tabindex",f:"-1",t:13,g:1},{n:"class-rac-selected",t:13,f:[{t:2,x:{r:["rac.value","."],s:"_0===_1"}}]},{n:"class-rac-hover",t:13,f:[{t:2,x:{r:["rac.selected","@index"],s:"_0===_1"}}]},{n:["click"],t:70,f:{r:["@context","."],s:"[(_0).set(\"rac.value\",_1)]"}},{n:["mouseover"],t:70,f:{r:["@context","@index"],s:"[(_0).set(\"rac.selected\",_1)]"}}],f:[{t:2,x:{r:["rac","."],s:"_0._display(_1)"}}]}],n:52,r:"items"}," "],n:"items"},{t:63,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rac-item rac-invalid",g:1}],f:["Load failed."]}]}],r:"rac.list"}]}]}]}],e:{"2":function (){return(2);},"[(_0).set(\"rac.pop\",_1)]":function (_0,_1){return([(_0).set("rac.pop",_1)]);},"[_0.show(_1)]":function (_0,_1){return([_0.show(_1)]);},"[_0.stash()]":function (_0){return([_0.stash()]);},"[_0.input(_1)]":function (_0,_1){return([_0.input(_1)]);},"[_0.key(_1)]":function (_0,_1){return([_0.key(_1)]);},"[_0.show((_1).find(\"input\"))]":function (_0,_1){return([_0.show((_1).find("input"))]);},"[(_0).raise(\"pop\",{},_1)]":function (_0,_1){return([(_0).raise("pop",{},_1)]);},"_0===_1":function (_0,_1){return(_0===_1);},"[(_0).set(\"rac.value\",_1)]":function (_0,_1){return([(_0).set("rac.value",_1)]);},"[(_0).set(\"rac.selected\",_1)]":function (_0,_1){return([(_0).set("rac.selected",_1)]);},"_0._display(_1)":function (_0,_1){return(_0._display(_1));}}}; | ||
@@ -731,3 +731,2 @@ function safeGet(obj, path) { | ||
var tm; | ||
var root; | ||
@@ -758,3 +757,3 @@ | ||
if (Array.isArray(list)) { | ||
h.set('rac.selected', i < list.length ? i + 1 : 0); | ||
h.set('rac.selected', i < list.length - 1 ? i + 1 : 0); | ||
} else { h.set('rac.selected', 0); } | ||
@@ -777,3 +776,4 @@ } | ||
list(e.target.value); | ||
h.get('rac.pop').show(h.find('input')); | ||
var el = h.find('input'); | ||
if (el && document.activeElement === el) { h.get('rac.pop').show(el); } | ||
}, 500); | ||
@@ -880,5 +880,5 @@ h.set('rac.display', e.target.value); | ||
h.set('rac.offsets', attrs.offsets); | ||
h.set('rac.fit', true); | ||
h.set('rac.fit', 'fit' in attrs ? attrs.fit : true); | ||
} else { | ||
h.set('rac.fit', false); | ||
h.set('rac.fit', 'fit' in attrs ? attrs.fit : false); | ||
} | ||
@@ -895,2 +895,12 @@ h.set('rac.limit', attrs['limit-set']); | ||
var tmScroll; | ||
function scrollView() { | ||
if (tmScroll) { clearTimeout(tm); } | ||
tmScroll = setTimeout(function () { | ||
tmScroll = null; | ||
var el = h.find('.rac-hover'); | ||
if (el) { el.scrollIntoView({behavior: 'smooth', block: 'nearest', inline: 'nearest'}); } | ||
}, 14); | ||
} | ||
var opts = { init: false, defer: true }; | ||
@@ -906,4 +916,4 @@ var watches = [ | ||
h.observe('rac.value', function (v) { | ||
display(); | ||
value(); | ||
display(); | ||
value(); | ||
h.set('rac.popped', false); | ||
@@ -916,4 +926,4 @@ h.set('rac.tempValue', v); | ||
if (which !== h.get('rac.value')) { h.set('rac.value', which); } | ||
}) | ||
]; | ||
}), | ||
h.observe('rac.selected', scrollView) ]; | ||
@@ -931,6 +941,7 @@ function teardown() { | ||
}, { | ||
attributes: ['items', 'selected', 'display', 'value', 'member', 'limit-set', 'offsets', 'display-value'], | ||
attributes: ['items', 'selected', 'display', 'value', 'member', 'limit-set', 'fit', 'offsets', 'display-value'], | ||
css: function(data) { return [(function(data) { | ||
var primary = Object.assign({}, data("raui.primary"), data("raui.autocomplete.primary")); | ||
return (".rautocomplete {\n position: relative;\n display: inline-block;\n }\n \n .rac-pop {\n min-width: 100%;\n }\n \n .rac-pop > .rpop {\n padding: 0;\n }\n \n .rac-list {\n display: flex;\n flex-direction: column;\n max-height: 50vh;\n min-height: 2.125em;\n max-width: 100%;\n overflow: auto;\n }\n \n .rac-item {\n color: " + (primary.fg || '#222') + ";\n background-color: " + (primary.bg || '#fff') + ";\n padding: 0.25em;\n cursor: pointer;\n }\n \n .rac-selected {\n color: " + (primary.bg || '#fff') + ";\n background-color: " + (primary.fga || '#07e') + ";\n }\n \n .rac-hover {\n color: " + (primary.fg || '#222') + ";\n background-color: " + (primary.bc || '#ccc') + ";\n }\n \n .rac-invalid {\n cursor: not-allowed;\n }\n \n input.rac-modal {\n width: 100%;\n box-sizing: border-box;\n }"); | ||
var primary = Object.assign({}, data("raui.primary"), data("raui.autocomplete"), data("raui.autocomplete.primary")); | ||
var drop = Object.assign({}, data('raui.autocomplete.drop'), data('raui.autocomplete.primary.drop')); | ||
return (".rautocomplete {\n position: relative;\n display: inline-block;\n }\n \n .rac-drop {\n width: 2em;\n height: 100%;\n position: absolute;\n top: 0;\n right: 2px;\n cursor: pointer;\n }\n .rac-drop:after {\n font-family: " + (drop.font || 'sans-serif') + ";\n content: " + (drop.string || '\'\u25be\'') + ";\n position: absolute;\n top: calc(50% - 0.5em);\n height: 1em;\n line-height: 1em;\n width: 100%;\n text-align: center;\n font-weight: " + (drop.weight || 'normal') + ";\n color: " + (drop.color || primary.bc || '#ccc') + ";\n }\n \n .rac-pop {\n min-width: 100%;\n }\n \n .rac-pop > .rpop {\n padding: 0;\n }\n \n .rac-list {\n display: flex;\n flex-direction: column;\n max-height: 50vh;\n min-height: 2.125em;\n max-width: 100%;\n overflow: auto;\n }\n \n .rac-item {\n color: " + (primary.fg || '#222') + ";\n background-color: " + (primary.bg || '#fff') + ";\n padding: 0.25em;\n cursor: pointer;\n }\n \n .rac-selected {\n color: " + (primary.bg || '#fff') + ";\n background-color: " + (primary.fga || '#07e') + ";\n }\n \n .rac-hover {\n color: " + (primary.fg || '#222') + ";\n background-color: " + (primary.bc || '#ccc') + ";\n }\n \n .rac-selected.rac-hover {\n background-color: " + (primary.bc || '#ccc') + ";\n color: " + (primary.fga || '#07e') + ";\n }\n \n .rac-invalid {\n cursor: not-allowed;\n }\n \n input.rac-modal {\n width: 100%;\n box-sizing: border-box;\n }"); | ||
}).call(this, data)].join(' '); }, | ||
@@ -937,0 +948,0 @@ cssId: 'rautocomplete', |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("ractive")):"function"==typeof define&&define.amd?define(["exports","ractive"],t):t(e.RMAutocomplete={},e.Ractive)}(this,function(e,t){"use strict";t=t&&t.hasOwnProperty("default")?t.default:t;var n="undefined"!=typeof window?window:null;function i(e,t,i){if(n&&n.Ractive&&"object"==typeof n.Ractive[t]){var o=document.currentScript;if(o||(o=(o=document.querySelectorAll("script"))[o.length-1]),o){var r=o.getAttribute("data-alias");r&&(r=(r=r.split("&")).reduce(function(e,t){var n=t.split("="),i=n[0],o=n[1];return e[i]=o,e},{})),Ractive[t][r&&r[e]||e]=i}}}function o(e,t){void 0===t&&(t={});var n=e.processParams(t,{duration:400,easing:"easeInOut"});t.dir=t.dir||!1;var i=t.distance||"20px",o=t.scale||"0.9",r="above"===t.dir?"translateY("+i+")":"left"===t.dir?"translateX("+i+")":"right"===t.dir?"translateX(-"+i+")":"translateY(-"+i+")";return e.isIntro||n.intro?(e.setStyle("opacity",0),e.setStyle("transform","scale("+o+") "+r),e.animateStyle({opacity:1,transform:"none"},n)):(e.setStyle("opacity",1),e.setStyle("transform","none"),e.animateStyle({opacity:0,transform:"scale("+o+") "+r},n))}function r(e){return void 0===e&&(e={}),function(t){t.instance.transitions[e.name||"pop"]=o}}function a(e,t){var n=!1,i=!1;function o(n){for(var i=n.target;i;){if(i===e)return;if(!i.parentNode&&i!==document)return;i=i.parentNode}t(n)}return setTimeout(function(){n=!0,i||(document.body.addEventListener("click",o,{capture:!0}),document.body.addEventListener("touchstop",o,{capture:!0}))}),{teardown:function(){i=!0,n&&(document.body.removeEventListener("click",o,{capture:!0}),document.body.removeEventListener("touchstop",o,{capture:!0}))}}}function l(e,t){var n=e.processParams(t,{duration:200,easing:"easeInOut"});return e.isIntro||n.intro?(e.setStyle("opacity",0),e.animateStyle("opacity",1,n)):(e.setStyle("opacity",1),e.animateStyle("opacity",0,n))}function c(e){return void 0===e&&(e={}),function(t){t.instance.transitions[e.name||"fade"]=l}}i("pop","transitions",o),i("fade","transitions",l);var s,p,f,d={v:4,t:[{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rpop-wrapper",g:1},{n:"class-rpop-with-tail",t:13,f:[{t:2,r:"position.tail"}]},{n:"class",f:["rpop-",{t:2,x:{r:["where"],s:'_0||"below"'}}," rpop-align-",{t:2,x:{r:["align"],s:'_0||"middle"'}}],t:13},{t:4,f:[{n:"style-top",f:[{t:2,r:"position.popTop"},"px"],t:13},{n:"style-left",f:[{t:2,r:"position.popLeft"},"px"],t:13}],n:50,r:"position"},{t:4,f:[{t:4,f:[{n:"style-top",f:[{t:2,r:"top"}],t:13}],n:50,r:"top"},{t:4,f:[{n:"style-left",f:[{t:2,r:"left"}],t:13}],n:50,r:"left"}],n:51,l:1},{n:"pop",t:72,f:{r:["where"],s:'[{dir:_0||"below"}]'},v:"t2"},{n:"cleanup",t:71},{t:4,f:[{n:["click"],t:70,f:{r:["@this"],s:'[_0.set("popped",false)]'}}],n:50,r:"clickClose"},{t:4,f:[{n:["clickout"],t:70,f:{r:["@this"],s:'[_0.set("popped",false)]'}}],n:51,r:"noClickout"},{t:16,r:"extra-attributes"}],f:[{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rpop-tail",g:1},{t:4,f:[{n:"style-top",f:[{t:2,x:{r:["position.tailTop","position.vert"],s:"_0+(_1?1:0)"}},"px"],t:13}],n:50,r:"position.tailTop"},{t:4,f:[{n:"style-bottom",f:[{t:2,x:{r:["position.tailBottom","position.vert"],s:"_0+(_1?1:0)"}},"px"],t:13}],n:50,r:"position.tailBottom"},{t:4,f:[{n:"style-left",f:[{t:2,x:{r:["position.tailLeft","position.vert"],s:"_0+(_1?0:1)"}},"px"],t:13}],n:50,r:"position.tailLeft"},{t:4,f:[{n:"style-right",f:[{t:2,x:{r:["position.tailRight","position.vert"],s:"_0+(_1?0:1)"}},"px"],t:13}],n:50,r:"position.tailRight"}]}," ",{t:7,e:"div",m:[{t:13,n:"class",f:"rpop-tail-outer",g:1},{t:4,f:[{n:"style-top",f:[{t:2,x:{r:["position.tailTop"],s:"_0-2"}},"px"],t:13}],n:50,r:"position.tailTop"},{t:4,f:[{n:"style-bottom",f:[{t:2,x:{r:["position.tailBottom"],s:"_0-2"}},"px"],t:13}],n:50,r:"position.tailBottom"},{t:4,f:[{n:"style-left",f:[{t:2,x:{r:["position.tailLeft"],s:"_0-2"}},"px"],t:13}],n:50,r:"position.tailLeft"},{t:4,f:[{n:"style-right",f:[{t:2,x:{r:["position.tailRight"],s:"_0-2"}},"px"],t:13}],n:50,r:"position.tailRight"}]}],n:50,r:"~/tail"}," ",{t:7,e:"div",m:[{t:13,n:"class",f:"rpop",g:1}],f:[{t:16,r:"content"}]}]}],n:50,r:"__popped"}],e:{'_0||"below"':function(e){return e||"below"},'_0||"middle"':function(e){return e||"middle"},'[{dir:_0||"below"}]':function(e){return[{dir:e||"below"}]},'[_0.set("popped",false)]':function(e){return[e.set("popped",!1)]},"_0+(_1?1:0)":function(e,t){return e+(t?1:0)},"_0+(_1?0:1)":function(e,t){return e+(t?0:1)},"_0-2":function(e){return e-2},"[{delay:200}]":function(){return[{delay:200}]},"[_0===_1&&_2.done(),true]":function(e,t,n){return[e===t&&n.done(),!0]},"[_0.done()]":function(e){return[e.done()]},true:function(){return!0}},p:{modal:[{t:4,f:[{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rpop-modal",g:1},{n:"fade",t:72,v:"t1"},{n:"fade",t:72,f:{r:[],s:"[{delay:200}]"},v:"t2"},{t:4,f:[{n:["click"],t:70,f:{r:["@node","@event.target","."],s:"[_0===_1&&_2.done(),true]"}}],n:51,r:".noClickout"}],f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rpop",g:1},{n:"pop",t:72,f:{r:[],s:"[{delay:200}]"},v:"t1"},{n:"pop",t:72,v:"t2"},{t:4,f:[{n:["click"],t:70,f:{r:["."],s:"[_0.done()]"}}],n:50,r:".clickClose"},{t:8,r:".attrs",c:{r:".context"},z:[{n:"inModal",x:{x:{r:[],s:"true"}}}]}],f:[{t:8,r:".content",c:{r:".context"},z:[{n:"inModal",x:{x:{r:[],s:"true"}}}]}]}]}],n:54,r:"contents.0"}],n:50,r:"contents.length"}]}},u=function(e){function t(t){e.call(this,t)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.position=function(e){var t=e||this.source,n=this.get("popped");if(t&&n){var i=this.find("div");if(t&&i&&i.offsetParent){var o=i.offsetParent,r=o.getBoundingClientRect(),a=i.getBoundingClientRect(),l=t.getBoundingClientRect(),c=this.get("where")||"below",s=this.get("align")||"middle",p=this.get("tail"),f="above"===c||"below"===c,d=this.get("fit"),u=this.get("gap"),b="above"===c||"below"===c?0:"left"===c?-a.width-u:l.width+u,m="left"===c||"right"===c?-l.height:"above"===c?-l.height-a.height-u:u;"middle"===s?"below"===c||"above"===c?b-=(a.width-l.width)/2:"left"!==c&&"right"!==c||(m-=(a.height-l.height)/2):"end"===s&&("below"===c||"above"===c?b+=l.width-a.width:"left"!==c&&"right"!==c||(m+=l.height-a.height));var h={popTop:l.bottom-r.top+m,popLeft:l.left-r.left+b,tail:p,vert:"above"===c||"below"===c};if(o.scrollTop&&(h.popTop+=o.scrollTop),o.scrollLeft&&(h.popLeft+=o.scrollLeft),p){"above"===c?h.tailBottom=-10:"below"===c?h.tailTop=-10:"left"===c?h.tailRight=-10:"right"===c&&(h.tailLeft=-10);var g=this.tailSource?this.tailSource.getBoundingClientRect():l;"start"===s?f?h.tailLeft=Math.floor(g.width/2)-10:h.tailTop=Math.floor(g.height/2)-10:"end"===s?f?h.tailRight=Math.floor(g.width/2)-10:h.tailBottom=Math.floor(g.height/2)-10:"middle"===s&&(f?h.tailLeft=Math.floor(g.width/2)-10:h.tailTop=Math.floor(g.height/2)-10),g!==l?f?(null!=h.tailLeft&&(h.tailLeft+=g.left-l.left),null!=h.tailRight&&(h.tailRight+=l.right-g.right)):(null!=h.tailTop&&(h.tailTop+=g.top-l.top),null!=h.tailBottom&&(h.tailBottom+=l.bottom-g.bottom)):"middle"===s&&(f?(null!=h.tailLeft&&(h.tailLeft+=g.left-(h.popLeft+r.left)),null!=h.tailRight&&(h.tailRight+=h.popLeft+r.left+a.width-g.right)):(null!=h.tailTop&&(h.tailTop+=g.top-(h.popTop+r.top)),null!=h.tailBottom&&(h.tailBottom+=h.popTop+r.top+a.height-g.bottom)))}if(d){var v=o;if(this.get("offsets"))for(var y=this.get("offsets");y--;)v=v.offsetParent;var x=o.scrollWidth,w=o.scrollHeight;if(h.popLeft+a.width>x){var _=h.popLeft-(x-a.width);h.popLeft-=_,f&&h.tailLeft&&(h.tailLeft+=_),f&&h.tailRight&&(h.tailRight-=_),p&&!f&&(h.tail=!1)}if(h.popLeft<0){var k=-1*h.popLeft;h.popLeft+=k,f&&h.tailLeft&&(h.tailLeft-=k),f&&h.tailRight&&(h.tailRight+=k),p&&!f&&(h.tail=!1)}if(h.popTop+a.height>w){var O=h.popTop-(w-a.height);h.popTop-=O,!f&&h.tailTop&&(h.tailTop+=O),!f&&h.tailBottom&&(h.tailBottom-=O),p&&f&&(h.tail=!1)}if(h.popTop<0){var T=-1*h.popTop;h.popTop+=T,!f&&h.tailTop&&(h.tailTop-=T),!f&&h.tailBottom&&(h.tailBottom+=T),p&&f&&(h.tail=!1)}}this.set("position",h)}else this.set("position",null)}},t.prototype.show=function(e){this.source=e,this.set("popped",!0)},t.prototype.hide=function(){this.set("popped",!1)},t}(t);t.extendWith(u,{attributes:["popped","tail","where","align","top","left","fit","clickClose","noClickout","gap","offsets"],use:[r(),(void 0===f&&(f={}),function(e){e.instance.events[f.name||"clickout"]=a}),c()],template:d,css:function(e){return[function(e){var t=Object.assign({},e("raui.primary"),e("raui.pop.primary")),n=(e("raui.themes")||[]).slice();return(e("raui.pop.themes")||[]).forEach(function(e){~n.indexOf(e)||n.push(e)}),"\n .rpop-wrapper {\n position: absolute;\n display: inline-block;\n z-index: 21;\n transition-property: top, left, padding;\n transition-timing-function: ease-in-out;\n transition-duration: 0.3s;\n }\n .rpop-with-tail.rpop-above {\n padding-bottom: 10px;\n }\n .rpop-with-tail.rpop-below {\n padding-top: 10px;\n }\n .rpop-with-tail.rpop-left {\n padding-right: 10px;\n }\n .rpop-with-tail.rpop-right {\n padding-left: 10px;\n }\n \n .rpop {\n position: relative;\n box-shadow: 0 1px 4px 0 rgba(0,0,0,0.24);\n border: 1px solid #ccc;\n border-radius: 0.2em;\n background-color: "+(t.bg||"#fff")+";\n color: "+(t.fg||"#222")+";\n padding: 0.5em;\n z-index: 2;\n }\n \n .rpop-modal {\n position: fixed;\n display: flex;\n z-index: 20;\n background-color: rgba(0, 0, 0, 0.2);\n align-items: center;\n justify-content: center;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n padding: 1em;\n overflow: auto;\n }\n \n .rpop-tail, .rpop-tail-outer {\n z-index: 3;\n width: 0;\n height: 0;\n position: absolute;\n border-style: solid;\n border-width: 10px;\n border-color: transparent;\n transition-property: top, left, bottom, right, border-color;\n transition-timing-function: ease-in-out;\n transition-duration: 0.3s;\n }\n .rpop-tail-outer {\n z-index: 1;\n border-width: 12px;\n border-color: transparent;\n }\n \n .rpop-below .rpop-tail {\n border-bottom-color: "+(t.bg||"#fff")+";\n }\n .rpop-below .rpop-tail-outer {\n border-bottom-color: "+(t.bc||"#ccc")+";\n }\n \n .rpop-above .rpop-tail {\n border-top-color: "+(t.bg||"#fff")+";\n }\n .rpop-above .rpop-tail-outer {\n border-top-color: "+(t.bc||"#ccc")+";\n }\n \n .rpop-left .rpop-tail {\n border-left-color: "+(t.bg||"#fff")+";\n }\n .rpop-left .rpop-tail-outer {\n border-left-color: "+(t.bc||"#ccc")+";\n }\n \n .rpop-right .rpop-tail {\n border-right-color: "+(t.bg||"#fff")+";\n }\n .rpop-right .rpop-tail-outer {\n border-right-color: "+(t.bc||"#ccc")+";\n }\n "+n.map(function(t){var n=Object.assign({},e("raui.primary"),e("raui.pop.primary"),e("raui."+t),e("raui.pop."+t));return"\n ."+t+" .rpop {\n background-color: "+(n.bg||"#fff")+";\n color: "+(n.fg||"#222")+";\n }\n \n ."+t+".rpop-below .rpop-tail {\n border-bottom-color: "+(n.bg||"#fff")+";\n }\n ."+t+".rpop-below .rpop-tail-outer {\n border-bottom-color: "+(n.bc||"#ccc")+";\n }\n \n ."+t+".rpop-above .rpop-tail {\n border-top-color: "+(n.bg||"#fff")+";\n }\n ."+t+".rpop-above .rpop-tail-outer {\n border-top-color: "+(n.bc||"#ccc")+";\n }\n \n ."+t+".rpop-left .rpop-tail {\n border-left-color: "+(n.bg||"#fff")+";\n }\n ."+t+".rpop-left .rpop-tail-outer {\n border-left-color: "+(n.bc||"#ccc")+";\n }\n \n ."+t+".rpop-right .rpop-tail {\n border-right-color: "+(n.bg||"#fff")+";\n }\n ."+t+".rpop-right .rpop-tail-outer {\n border-right-color: "+(n.bc||"#ccc")+";\n }\n "})}.call(this,e)].join(" ")},cssId:"rpop",noCssTransform:!0,observe:{popped:function(e){var t=this;setTimeout(function(){t.get("popped")===e&&t.set("_popped",e)},1)},_popped:{handler:function(e){var t=this;if(e){var n=this.get("@style.raui.pop.mobile");if(n&&window.matchMedia("(max-width: "+n+")").matches){p||(p=new b({target:document.body,append:!0}));var i=this.getContext().getParent(!0);i.isContext=1,this.set("__popped",!1),p.unshift("contents",{content:this.partials.content,context:i,attrs:this.partials["extra-attributes"]||[],clickClose:this.get("clickClose"),noClickout:this.get("noClickout"),done:function(){t.set("popped",!1)}})}else this.set("__popped",!0)}else s?p.shift("contents"):this.set("__popped",!1)},defer:!0},__popped:{handler:function(e){if(e){var t=this.find("div"),n=t,i=n.offsetHeight+n.offsetTop,o=n.offsetWidth+n.offsetLeft,r=n.offsetParent;if(!this.overflows)for(var a=this.overflows={e:[],v:[]};t&&t.style;){if(t===r){if(t.offsetWidth>=o&&t.offsetHeight>=i)break;o+=t.offsetLeft,i+=t.offsetTop,r=t.offsetParent}var l=getComputedStyle(t);if("auto"===l.overflow)break;"hidden"===l.overflow&&(a.e.push(t),a.v.push(t.style.overflow),t.style.overflow="visible"),t=t.parentNode}this.position(),this.transition("pop",n,{intro:!0,dir:this.get("where")||"below"})}else this.source=null,this.tailSource=null},defer:!0},"align where tail fit":{handler:function(){this.position()},defer:!0}},decorators:{cleanup:function(e){var t=this;return{teardown:function(){var e=t.overflows;if(e){t.overflows=null;for(var n=0;n<e.e.length;n++)e.e[n].style.overflow=e.v[n]}}}}},data:function(){return{gap:4}}});var b=function(e){function t(t){e.call(this,t)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t}(t);function m(){}function h(e){~this.className.indexOf("focus")||(this.className+=" focus")}function g(e){this.className=this.className.replace(/\bfocus\b/g,"").trim()}function v(e){var t,n,i,o,r,a,l,c,s,p,f,d,u,b=this.getContext(e);function v(){var b=y().split(/\s+/).filter(function(e){return!!e});(t=!!~b.indexOf("field"))||(b.push("field"),t=!0),(n=e.querySelector("input[type=checkbox]"))&&!~b.indexOf("check")&&b.push("check"),(i=e.querySelector("input[type=radio]"))&&!~b.indexOf("radio")&&b.push("radio");var m=n||i;m&&m.checked&&!~b.indexOf("checked")&&b.push("checked"),m&&m.disabled&&!~b.indexOf("disabled")&&b.push("disabled"),!m&&p?(p.cancel(),p=0,f&&(f.disconnect(),f=0),delete m._form_callback,u&&(delete u.checked,d=u=void 0)):m&&(m._form_callback=function(t,n){if(void 0===n&&(n=!0),n&&"radio"===m.type&&m.name){var i=[];i.push.apply(i,document.querySelectorAll("input[type=radio][name="+m.name+"]")),(i=i.filter(function(e){return e!==m})).forEach(function(e){return e._form_callback&&e._form_callback(t,!1)})}var o=m.checked;o&&!~e.className.indexOf("checked")?e.className+=" checked":!o&&~e.className.indexOf("checked")&&(e.className=e.className.replace(/\bchecked\b/g,"").replace(/ +/g," ").trim())},MutationObserver&&(f=new MutationObserver(function(){var t;(t=m.disabled)&&!~e.className.indexOf("disabled")?e.className+=" disabled":!t&&~e.className.indexOf("disabled")&&(e.className=e.className.replace(/\bdisabled\b/g,"").replace(/ +/g," ").trim())})).observe(m,{attributes:!0}),p=this.getContext(m).listen("change",m._form_callback),(d=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(m),"checked"))&&d.configurable&&(u=m,Object.defineProperty(m,"checked",{get:d.get,set:function(e){d.set.call(u,e),m._form_callback()},enumerable:!0,configurable:!0}))),(o=!!e.querySelector("textarea"))&&!~b.indexOf("textarea")&&b.push("textarea"),(r=!!e.querySelector("select"))&&!~b.indexOf("select")&&b.push("select"),(a=!!e.querySelector("input[type=file]"))&&!~b.indexOf("file")&&b.push("file"),(l=!!(l=e.querySelector("button"))&&l.parentNode===e)&&!~b.indexOf("button")&&b.push("button"),(c=!!e.querySelector("div"))&&!~b.indexOf("plain")&&b.push("plain"),(s=!(n||i||a||!e.querySelector("input")))&&!~b.indexOf("input")&&b.push("input"),e.className=b.join(" ")}function y(){var p=e.className;return t||(p=p.replace(/\bfield\b/g,"").trim()),n||(p=p.replace(/\bcheck(ed)?\b/g,"").trim()),i||(p=p.replace(/\bradio\b/g,"").trim()),o||(p=p.replace(/\btextarea\b/g,"").trim()),r||(p=p.replace(/\bselect\b/g,"").trim()),a||(p=p.replace(/\bfile\b/g,"").trim()),l||(p=p.replace(/\bbutton\b/g,"").trim()),c||(p=p.replace(/\bplain\b/g,"").trim()),s||(p=p.replace(/\binput\b/g,"").trim()),p=p.replace(/ +/g," ")}var x=b.listen("focusin",h),w=b.listen("focusout",g);return v.call(this),{update:m,invalidate:v.bind(this),teardown:function(){var t=y();t=t.replace(/\bfocus\b/g,"").trim(),x.cancel(),w.cancel(),p&&p.cancel(),f&&f.disconnect(),u&&(delete u.checked,d=u=void 0),e.className=t}}}function y(e,t){if(!e)return!1;for(var n=0;n<e.length;n++){if(e[n].e===t)return!0;if(e[n].f&&y(e[n].f,t))return!0}return!1}t.extendWith(b,{template:{v:d.v,t:d.p.modal},data:function(){return{contents:[]}},use:[r(),c()],observe:{contents:function(e){s=(e||[]).length>0}},on:{init:function(){p?console.warn("More than one PopOver mobile host created."):p=this}}}),v.style=function(e){var t=Object.assign({},e("raui.primary"),e("raui.form.primary")),n=Object.assign({},e("raui.primary.active"),e("raui.form.primary.active")),i=e("raui.form.boxy");return"\n label.field {\n display: inline-block;\n font-size: 0.9em;\n font-weight: 500;\n color: "+(t.fg||"#222")+";\n transition: 0.2s ease-in-out;\n transition-property: color;\n vertical-align: top;\n box-sizing: border-box;\n padding: 0.25em 0.5em;\n line-height: 1.5em;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n font-family: inherit;\n }\n\n label.field.textarea {\n display: block;\n border: 0.0625em solid "+(t.bc||"#ccc")+";\n padding: 0.5em 0.8em 0.8em 0.8em;\n border-radius: "+(t.radius||"0.2em")+";\n box-shadow: none;\n transition-property: color, border-color, box-shadow;\n margin: 0.8em 0.2em;\n min-height: auto;\n background-color: "+(i?t.bg||"#fff":"transparent")+";\n }\n\n label.field.focus {\n color: "+(n.fg||t.fga||"#07e")+";\n }\n\n label.field.textarea.focus {\n border-color: "+(n.fg||t.fga||"#07e")+";\n "+(i?"":"box-shadow: 0.0625em 0.0625em "+(n.fg||t.fga||"#07e")+",\n -0.0625em 0.0625em "+(n.fg||t.fga||"#07e")+",\n 0.0625em -0.0625em "+(n.fg||t.fga||"#07e")+",\n -0.0625em -0.0625em "+(n.fg||t.fga||"#07e")+";")+"\n }\n\n label.field input,\n label.field select,\n label.field textarea\n {\n display: block;\n border-width: "+(i?"0.0625em":"0 0 0.0625em 0")+";\n border-color: "+(t.bc||"#ccc")+";\n border-style: solid;\n box-sizing: border-box;\n background-color: "+(i?t.bg||"#fff":"transparent")+";\n transition: 0.2s ease-in-out;\n transition-property: box-shadow, color;\n outline: none;\n box-shadow: none;\n width: 100%;\n margin-bottom: 0.8em;\n font-size: 1.1em;"+(i?"\n border-radius: "+(t.radius||"0.2em")+";":"")+"\n font-weight: 400;\n font-family: inherit;\n }\n\n label.field input"+(i?"":":disabled")+",\n label.field select"+(i?"":":disabled")+" {\n padding: 0 0.75em;\n }\n label.field select"+(i?"":":disabled")+" {\n padding-right: 2em;\n }\n\n label.field input:disabled,\n label.field select:disabled,\n label.field textarea:disabled {\n background: #f4f4f4;\n }\n\n label.field textarea {\n line-height: 1.2em;\n }\n label.field .field-wrapper {\n display: block;\n }\n label.field > select, label.field > input,\n label.field > .field-wrapper > input, label.field > .field-wrapper > select {\n height: 2.5em;\n }\n\n "+(i?"":"label.field:hover > input,\n label.field:hover select,\n label.field.file:hover:after {\n box-shadow: 0 0.0625em 0 0 "+(t.bc||"#ccc")+";\n }\n\n label.field.textarea:hover {\n box-shadow: 0.0625em 0.0625em "+(t.bc||"#ccc")+",\n -0.0625em 0.0625em "+(t.bc||"#ccc")+",\n 0.0625em -0.0625em "+(t.bc||"#ccc")+",\n -0.0625em -0.0625em "+(t.bc||"#ccc")+";\n }\n\n label.field.textarea.focus:hover {\n box-shadow: 0.0625em 0.0625em "+(n.fg||t.fga||"#07e")+",\n -0.0625em 0.0625em "+(n.fg||t.fga||"#07e")+",\n 0.0625em -0.0625em "+(n.fg||t.fga||"#07e")+",\n -0.0625em -0.0625em "+(n.fg||t.fga||"#07e")+";\n }")+"\n\n /**** CHECK BOXES ****/\n\n label.field.check {\n position:relative;\n z-index: 0;\n overflow: visible;\n cursor: pointer;\n padding-top: 2.2em;\n white-space: normal;\n }\n label.field.check.inline {\n padding-top: 0.7em;\n }\n\n label.field.check input {\n appearance: none;\n -moz-appearance: none;\n -webkit-appearance: none;\n z-index: -1;\n position: absolute;\n left: -3px;\n top: 23px;\n display: block;\n margin: 0;\n border-radius: 50%;\n width: 40px;\n height: 40px;\n background-color: "+(t.bc||"#ccc")+";\n box-shadow: none;\n outline: none;\n opacity: 0;\n transform: scale(1);\n pointer-events: none;\n transition: opacity 0.3s, transform 0.2s;\n }\n label.field.inline.check input {\n top: 3px;\n left: -3px;\n }\n\n label.field.check input:checked {\n background-color: "+(t.fga||"#07e")+';\n }\n\n label.field.check:hover > input {\n opacity: 0.04;\n }\n\n label.field.check input:focus {\n opacity: 0.12;\n }\n\n label.field.check:hover > input:focus {\n opacity: 0.16;\n }\n\n label.field.check input:active {\n opacity: 0.6;\n transform: scale(0);\n transition: transform 0s, opacity 0s;\n }\n\n label.field.check:before {\n content: "";\n display: inline-block;\n box-sizing: border-box;\n margin: 3px 11px 3px 1px;\n border: solid 2px; /* Safari */\n border-color: '+(t.fg||"#222")+';\n border-radius: 2px;\n width: 18px;\n height: 18px;\n vertical-align: bottom;\n transition: border-color 0.2s, background-color 0.2s;\n }\n\n label.field.check:after {\n content: "";\n display: block;\n position: absolute;\n top: 0px;\n left: 0px;\n width: 10px;\n height: 5px;\n border: solid 2px transparent;\n border-right: none;\n border-top: none;\n transform: translate(0.8em, 2.65em) rotate(-45deg);\n }\n\n label.field.check.inline:after {\n transform: translate(0.8em, 1.2em) rotate(-45deg);\n }\n\n label.field.check.checked:before {\n border-color: '+(t.fga||"#07e")+";\n background-color: "+(t.fga||"#07e")+";\n }\n label.field.check.focus:before {\n border-color: "+(t.fga||"#07e")+";\n }\n\n label.field.check.checked:after {\n border-color: "+(t.bg||"#fff")+";\n }\n\n label.field.check input:disabled {\n opacity: 0;\n }\n\n label.field.check.disabled {\n color: "+(t.bc||"#ccc")+";\n cursor: initial;\n }\n\n label.field.check.disabled:before {\n border-color: "+(t.bc||"#ccc")+";\n }\n\n label.field.check.checked.disabled:before {\n border-color: transparent;\n background-color: "+(t.bc||"#ccc")+";\n }\n\n\n /**** RADIO BUTTONS ****/\n \n label.field.radio {\n z-index: 0;\n position: relative;\n display: inline-block;\n overflow: visible;\n padding-top: 2.2em;\n white-space: normal;\n }\n label.field.radio.inline {\n padding-top: 0.8em;\n }\n\n label.field.radio input {\n appearance: none;\n -moz-appearance: none;\n -webkit-appearance: none;\n z-index: -1;\n position: absolute;\n left: 0;\n top: 0;\n display: block;\n margin: 0;\n border-radius: 50%;\n width: 41px;\n height: 40px;\n background-color: "+(t.bc||"#ccc")+';\n outline: none;\n opacity: 0;\n pointer-events: none;\n transform: translate(-0.2em, 24px) scale(1);\n transition: opacity 0.3s, transform 0.3s;\n }\n label.field.inline.radio input {\n transform: translate(-0.2em, 3px) scale(1);\n }\n\n label.field.radio {\n cursor: pointer;\n position: relative;\n }\n\n label.field.radio:before {\n content: "";\n display: inline-block;\n box-sizing: border-box;\n margin: 2px 10px 2px 0;\n border: solid 2px; /* Safari */\n border-color: '+(t.fg||"#222")+';\n border-radius: 50%;\n width: 20px;\n height: 20px;\n vertical-align: middle;\n transition: border-color 0.2s;\n }\n\n label.field.radio:after {\n content: "";\n display: block;\n position: absolute;\n border-radius: 50%;\n width: 10px;\n height: 10px;\n background-color: '+(t.fga||"#07e")+";\n transform: translate(5px, -17px) scale(0);\n transition: transform 0.2s;\n }\n\n label.field.radio input:checked {\n background-color: "+(t.fga||"#07e")+";\n }\n\n label.field.radio.checked:before {\n border-color: "+(t.fga||"#07e")+";\n }\n\n label.field.radio.checked:after {\n transform: translate(5px, -17px) scale(1);\n }\n\n label.field.radio:hover input {\n opacity: 0.04;\n }\n\n label.field.radio input:focus {\n opacity: 0.12;\n transform: translate(-0.2em, 24px) scale(1);\n transition: transform 0.2s, opacity 0.2s;\n }\n label.field.inline.radio input:focus {\n transform: translate(-0.2em, 3px) scale(1);\n }\n\n label.field.radio:hover input:focus {\n opacity: 0.16;\n }\n\n label.field.radio input:active {\n opacity: 1;\n transform: translate(-0.2em, 24px) scale(0);\n transition: transform 0s, opacity 0s;\n }\n label.field.inline.radio input:active {\n transform: translate(-0.2em, 3px) scale(0);\n }\n\n label.field.radio.checked:before {\n border-color: "+(t.fga||"#07e")+";\n }\n\n label.field.radio.focus:before {\n border-color: "+(t.fga||"#07e")+";\n }\n\n label.field.radio input:disabled {\n opacity: 0;\n }\n\n label.field.radio.disabled {\n color: "+(t.bc||"#ccc")+";\n cursor: initial;\n }\n\n label.field.radio.disabled:before {\n border-color: "+(t.bc||"#ccc")+";\n }\n\n label.field.radio.disabled:after {\n background-color: "+(t.bc||"#ccc")+";\n }\n\n\n\n label.field select {\n padding-right: 2em;\n }\n\n label.field.select {\n cursor: pointer;\n position: relative;\n }\n\n label.field.select:after {\n content: ' ';\n position: absolute;\n display: block;\n width: 0.6em;\n right: 19px;\n height: 0.6em;\n top: 2.6em;\n border-bottom: 0.125em solid;\n border-right: 0.125em solid;\n transform: rotate(45deg);\n pointer-events: none;\n color: "+(t.bc||"#ccc")+";\n }\n\n label.field textarea {\n border: none;"+(i?"\n padding: 0;":"")+"\n }\n\n label.field > select {\n -moz-appearance: none;\n -webkit-appearance: none;\n }\n\n label.field input:focus,\n label.field select:focus,\n label.field.file.focus:after\n {\n border-color: "+(n.fg||t.fga||"#07e")+";\n "+(i?"":"box-shadow: 0 0.0625em 0 0 "+(n.fg||t.fga||"#07e")+";")+"\n }\n\n label.field input[type=checkbox]:focus,\n label.field input[type=radio]:focus {\n box-shadow: none;\n }\n\n label.field.file.focus:after {\n color: "+(n.fg||t.fga||"#07e")+";\n }\n label.field.file [type=file] {\n position: absolute;\n width: 0;\n height: 0;\n opacity: 0;\n z-index: -1;\n }\n label.field.file {\n position: relative;\n min-width: 9em;\n height: 5em;\n }\n label.field.file:after {\n position: absolute;\n content: 'Choose a file';\n box-sizing: border-box;\n width: calc(100% - 0.3em);\n height: 2.5em;\n font-size: 1.1em;\n line-height: 1.5em;\n color: "+(t.fg||"#222")+";\n text-align: "+(i?"center":"left")+";\n padding: 0.5em "+(i?"0.5em":"0")+";\n cursor: pointer;\n font-style: oblique;\n left: 0.25em;\n top: 1.6em;\n transition: 0.2s ease-in-out;\n transition-property: color, border-bolor, box-shadow;"+(i?"\n border-radius: "+(t.radius||"0.2em")+";\n border-color: "+(t.bc||"#ccc")+";\n border-style: solid;\n border-width: 0.0625em;":"\n border-bottom-color: "+(t.bc||"#ccc")+";\n border-bottom-width: 0.0625em;\n border-bottom-style: solid;\n ")+"\n }\n label.field.file.inline:after {\n top: 0.2em;\n }\n\n label.field.button {\n vertical-align: top;\n padding-top: "+(i?"1.7":"1.958")+"em;\n }\n label.field .with-buttons button, label.field.button button {\n font-size: 1.1em;\n margin-top: "+(i?"0.15em":"0")+";\n }\n\n label.field .field-wrapper.with-buttons {\n display: flex;\n }\n label.field .with-buttons button {\n flex-shrink: 0;\n padding-left: 0.5em;\n padding-right: 0.5em;\n margin-top: 0;\n margin-right: 0;\n "+(i?"height: 2.5em;\n box-shadow: none;\n border-radius: 0;\n border-left: 1px solid "+(t.bg||"#fff")+";\n margin-left: 0;":"height: 2.25em;")+"\n }"+(i?"\n label.field .with-buttons button:first-of-type {\n margin-left: -0.05em;\n border-left: none;\n }\n label.field .with-buttons button:last-of-type {\n border-radius: 0 "+(t.radius||"0.2em")+" "+(t.radius||"0.2em")+" 0;\n }\n label.field .with-buttons input {\n border-radius: "+(t.radius||"0.2em")+" 0 0 "+(t.radius||"0.2em")+";\n min-width: 0;\n }\n ":"")+"\n\n label.field.plain > div {\n position: absolute;\n font-size: 1.1em;\n top: 2.4em;\n font-weight: normal;\n }\n\n /* inline fields (no labels) */\n label.field.inline {\n height: 3.3em;\n }\n\n label.field.button.inline {\n margin-top: 0.2em;\n padding-top: 0.12em;\n }\n\n label.field.button.inline button {\n margin-top: 0;\n }\n\n label.field.inline.select:after {\n top: 1."+(i?"15":"1")+"em;\n }\n\n label.field .field-tip {\n display: inline-block;\n width: 1em;\n height: 1em;\n background-color: "+(t.fga||"#07e")+";\n color: "+(t.bg||"#fff;")+";\n cursor: default;\n user-select: none;\n border-radius: 1em;\n margin-left: 0.5em;\n line-height: 1.2em;\n text-align: center;\n margin-top: -0.2em;\n }\n\n label.field .field-solo-tip {\n margin-left: -0.1em;\n }\n "};var x=t.macro(function(e){var t=[],n=(e.template.m||[]).slice(),i=e.template.f||[],o=n.find(function(e){return"value"===e.n}),r=n.find(function(e){return"type"===e.n}),a=n.find(function(e){return"tip"===e.n}),l=n.find(function(e){return"disabled"===e.n});if(a&&n.splice(n.indexOf(a),1),r&&"function"==typeof x.types[r.f])t.push.apply(t,x.types[r.f](n,i,e));else if(o){var c={t:7,e:"input",m:[o]};if(l&&c.m.push(l),y(i,"option")&&(c.e="select",c.f=i),r&&(c.m.push(r),"checkbox"===r.f||"radio"===r.f)){var s=n.find(function(e){return"target"===e.n});s?c.m.push(Object.assign({},s,{n:"name"})):c.m.splice(c.m.indexOf(o),1,Object.assign({},o,{n:"checked"}))}c.m=c.m.concat(n.filter(function(e){return 73===e.t||73===e.t||"placeholder"===e.n})),t.push(c);var p=i.filter(function(e){return"button"===e.e||y(e.f,"button")});p.length&&(t.push.apply(t,p),t=[{t:7,e:"span",m:[{t:13,n:"class",f:"field-wrapper with-buttons",g:1}],f:t}])}else{var f=i.filter(function(e){return e.e});f.find(function(e){return"button"===e.e})&&f.length>1?t=[{t:7,e:"span",m:[{t:13,n:"class",f:"field-wrapper with-buttons",g:1}],f:i}]:t.push.apply(t,i)}var d=n.find(function(e){return"label"===e.n});a&&t.unshift({t:7,e:"span",m:[{t:13,n:"class",f:"field-tip"+(d?"":" field-solo-tip"),g:1},{t:13,n:"title",f:a.f},{t:70,n:["click"],f:{r:[],s:"[false]"}}],f:"?"}),d?t.unshift.apply(t,Array.isArray(d.f)?d.f:[d.f]):t.unshift(" ");var u={t:7,e:"label",m:[{t:71,n:"field"}].concat(n.filter(function(e){return 13!==e.t&&73!==e.t||"value"!==e.n&&"type"!==e.n&&"inline"!==e.n&&"label"!==e.n&&"placeholder"!==e.n&&"target"!==e.n&&"disabled"!==e.n})),f:t};n.find(function(e){return"inline"===e.n})&&u.m.push({t:13,n:"class",f:"inline"}),e.setTemplate([u])});function w(e){return"function"==typeof e.focus&&e.focus(),{teardown:m}}x.types={},i("field","decorators",v),i("field","partials",x),i("autofocus","decorators",w);var _={v:4,t:[{t:7,e:"span",m:[{t:13,n:"class",f:"rautocomplete field-wrapper",g:1},{n:["pop"],t:70,f:{r:["@context","$1"],s:'[(_0).set("rac.pop",_1)]'}}],f:[{t:7,e:"input",m:[{t:8,r:"extra-attributes"},{n:["dblclick"],t:70,f:{r:["rac.pop","@node"],s:"[_0.show(_1)]"}},{n:["focus"],t:70,f:{r:["rac"],s:"[_0.stash()]"}},{n:["input"],t:70,f:{r:["rac","@event"],s:"[_0.input(_1)]"}},{n:["keydown"],t:70,f:{r:["rac","@event"],s:"[_0.key(_1)]"}},{t:73,v:"t",f:"false"},{n:"value",f:[{t:2,r:"rac.display"}],t:13}]}," ",{t:7,e:"rac-pop",m:[{t:13,n:"style",f:"padding: 0;",g:1},{t:13,n:"class",f:"rac-pop",g:1},{n:["init"],t:70,f:{r:["@context","$1"],s:'[(_0).raise("pop",{},_1)]'}},{n:"popped",t:13,f:[{t:2,r:"rac.popped"}]},{n:"where",f:"below",t:13,g:1},{n:"align",f:"end",t:13,g:1},{n:"gap",f:[{t:2,x:{r:[],s:"2"},s:1}],t:13},{n:"offsets",t:13,f:[{t:2,r:"rac.offsets"}]},{n:"fit",t:13,f:[{t:2,r:"rac.fit"}]}],f:[{t:4,f:[{t:7,e:"input",m:[{n:"class-rac-modal",t:13},{n:["input"],t:70,f:{r:["rac","@event"],s:"[_0.input(_1)]"}},{n:["keydown"],t:70,f:{r:["rac","@event"],s:"[_0.key(_1)]"}},{t:73,v:"t",f:"false"},{n:"value",f:[{t:2,r:"rac.display"}],t:13},{n:"autocompletefocus",t:71}]}],n:50,r:"inModal"}," ",{t:7,e:"div",m:[{t:13,n:"class",f:"rac-list",g:1},{n:"tabindex",f:"-1",t:13,g:1}],f:[{t:55,f:[{f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rac-item rac-invalid",g:1}],f:["Loading..."]}],t:4},{t:62,f:[" ",{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rac-item",g:1},{n:"tabindex",f:"-1",t:13,g:1},{n:"class-rac-selected",t:13,f:[{t:2,x:{r:["rac.value","."],s:"_0===_1"}}]},{n:"class-rac-hover",t:13,f:[{t:2,x:{r:["rac.selected","@index"],s:"_0===_1"}}]},{n:["click"],t:70,f:{r:["@context","."],s:'[(_0).set("rac.value",_1)]'}},{n:["mouseover"],t:70,f:{r:["@context","@index"],s:'[(_0).set("rac.selected",_1)]'}}],f:[{t:2,x:{r:["rac","."],s:"_0._display(_1)"}}]}],n:52,r:"items"}," "],n:"items"},{t:63,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rac-item rac-invalid",g:1}],f:["Load failed."]}]}],r:"rac.list"}]}]}]}],e:{2:function(){return 2},'[(_0).set("rac.pop",_1)]':function(e,t){return[e.set("rac.pop",t)]},"[_0.show(_1)]":function(e,t){return[e.show(t)]},"[_0.stash()]":function(e){return[e.stash()]},"[_0.input(_1)]":function(e,t){return[e.input(t)]},"[_0.key(_1)]":function(e,t){return[e.key(t)]},'[(_0).raise("pop",{},_1)]':function(e,t){return[e.raise("pop",{},t)]},"_0===_1":function(e,t){return e===t},'[(_0).set("rac.value",_1)]':function(e,t){return[e.set("rac.value",t)]},'[(_0).set("rac.selected",_1)]':function(e,t){return[e.set("rac.selected",t)]},"_0._display(_1)":function(e,t){return e._display(t)}}};function k(e,t){return t.reduce(function(e,t){return e?e[t]:e},e)}var O=t.macro(function(e){var n,i;function o(t){null==t&&(t=null==e.get("rac.value")?"":e.get("rac.display")),t===e.get("rac.tempDisplay")&&(t="");var n=e.get("rac._items");if("function"==typeof n){var i=n(t);"object"==typeof i&&"function"==typeof i.then?i.then(function(t){return e.set("rac.list",t)}):e.set("rac.list",i)}else if(Array.isArray(n)){var o,r=e.get("rac._display");try{o=new RegExp(t||"","i")}catch(e){o=new RegExp((t||"").replace(/([\{\(\[\]\)\}\?\*\^\$])/g,"\\$1"))}e.set("rac.list",n.filter(function(e){return o.test(r(e))}))}else e.set("rac.list",[])}function r(n,r,l){var c=e.get("rac.displayprop");if(e.get("rac.__display")!==c||void 0===e.get("rac._display")){var s=function(){return e.attributes["display-value"]?e.get("rac.display"):"(none)"};if("string"==typeof c){var p=t.splitKeypath(c);c=function(e){return null==e?s():k(e,p)}}else Array.isArray(c)?c=function(e){return null==e?s():k(e,e)}:c||(c=function(e){return null==e?s():""+e});e.set("rac._display",c),e.set("rac.__display",e.get("rac.displayprop")),e.set("rac.display",c(e.get("rac.value")))}if(c=e.get("rac.member"),e.get("rac.__member")!==c||void 0===e.get("rac._member")){if("string"==typeof c){var f=t.splitKeypath(c);c=function(e){return k(e,f)}}else Array.isArray(c)?c=function(e){return k(e,e)}:c||(c=function(e){return e});e.set("rac._member",c),e.set("rac.__member",e.get("rac.member"))}c=e.get("rac.items"),e.get("rac.__items")===c&&void 0!==e.get("rac._items")||(Array.isArray(c)?e.set("rac._items",c):"function"==typeof c?e.set("rac._items",c):"object"==typeof c&&"function"==typeof c.then?c.then(function(t){e.set("rac._items",t),o()}):e.set("rac._items",[]),e.set("rac.__items",e.get("rac.items"))),i&&"rac.display"===l&&e.get("rac.limit")&&!i.contains(document.activeElement)&&a(),o()}function a(){var t=e.get("rac._display");if("function"==typeof t){var n=t(e.get("rac.value"));e.set("rac.display",n),e.set("rac.tempDisplay",n)}}function l(t){(t.items&&e.link(t.items,"rac.items"),t.value&&e.link(t.value,"rac._value"),t.selected&&e.link(t.selected,"rac.selected"),t["display-value"]&&e.link(t["display-value"],"rac.display"),"display"in t&&e.set("rac.displayprop",t.display),"member"in t&&e.set("rac.member",t.member),"offsets"in t?(e.set("rac.offsets",t.offsets),e.set("rac.fit",!0)):e.set("rac.fit",!1),e.set("rac.limit",t["limit-set"]),e.get("rac.limit")&&e.get("input"))&&(e.get("input")!==document.activeElement&&a());r()}e.aliasLocal("rac"),e.set("rac.list",[]),e.set("rac.popped",!1),e.set("rac.stash",function(){e.set("rac.tempDisplay",e.get("rac.display")),e.set("rac.tempValue",e.get("rac.value"))}),e.set("rac.key",function(t){var n=t.which;if(27===n)e.set("rac.popped",!1),e.set("rac.display",e.get("rac.tempDisplay")),e.set("rac.value",e.get("rac.tempValue"));else if(38===n||40===n){t.preventDefault(),e.get("rac.pop").show(e.find("input"));var i=e.get("rac.selected"),o=e.get("rac.list");38===n?i<=0||null==i?e.set("rac.selected",Array.isArray(o)?o.length-1:0):e.set("rac.selected",i-1):Array.isArray(o)?e.set("rac.selected",i<o.length?i+1:0):e.set("rac.selected",0)}else if(10===n||13===n){var r=e.get("rac.list");Array.isArray(r)&&e.set("rac.value",r[e.get("rac.selected")])}else 9===n&&(e.set("rac.popped",!1),e.get("rac.updateDisplay")())}),e.set("rac.input",function(t){n&&clearTimeout(n),n=setTimeout(function(){n=null,o(t.target.value),e.get("rac.pop").show(e.find("input"))},500),e.set("rac.display",t.target.value)}),e.setTemplate(_),e.set("rac.updateDisplay",function(t){setTimeout(function(){i&&e.get("rac.limit")&&!i.contains(document.activeElement)&&a()},140)}),l(e.attributes);var c={init:!1,defer:!0},s=[e.observe("rac.displayprop",r,c),e.observe("rac.memberprop",r,c),e.observe("rac.items",r,c),e.observe("rac.list",function(t){Array.isArray(t)?e.set("rac.selected",t.indexOf(e.get("rac.value"))):e.set("rac.selected",-1)},c),e.observe("rac.value",function(t){a(),function(){if(!e.get("rac._value")||e.get("rac.value")){var t=e.get("rac._member");if("function"==typeof t){var n=t(e.get("rac.value"));e.set("rac._value",n)}e.ractive.getContext(e.find("input")).raise("selected",{},e.get("rac._value"),e.get("rac.display"))}}(),e.set("rac.popped",!1),e.set("rac.tempValue",t)}),e.observe("rac._value",function(t){var n=e.get("rac._member"),i=e.get("rac.list").find(function(e){return n(e)===t});i!==e.get("rac.value")&&e.set("rac.value",i)})];return{teardown:function(){e.unlink("rac.items"),e.unlink("rac._value"),e.unlink("rac.selected"),e.unlink("rac.display"),s.forEach(function(e){return e.cancel()})},update:l,render:function(){i=e.find("span")}}},{attributes:["items","selected","display","value","member","limit-set","offsets","display-value"],css:function(e){return[function(e){var t=Object.assign({},e("raui.primary"),e("raui.autocomplete.primary"));return".rautocomplete {\n position: relative;\n display: inline-block;\n }\n \n .rac-pop {\n min-width: 100%;\n }\n \n .rac-pop > .rpop {\n padding: 0;\n }\n \n .rac-list {\n display: flex;\n flex-direction: column;\n max-height: 50vh;\n min-height: 2.125em;\n max-width: 100%;\n overflow: auto;\n }\n \n .rac-item {\n color: "+(t.fg||"#222")+";\n background-color: "+(t.bg||"#fff")+";\n padding: 0.25em;\n cursor: pointer;\n }\n \n .rac-selected {\n color: "+(t.bg||"#fff")+";\n background-color: "+(t.fga||"#07e")+";\n }\n \n .rac-hover {\n color: "+(t.fg||"#222")+";\n background-color: "+(t.bc||"#ccc")+";\n }\n \n .rac-invalid {\n cursor: not-allowed;\n }\n \n input.rac-modal {\n width: 100%;\n box-sizing: border-box;\n }"}.call(this,e)].join(" ")},cssId:"rautocomplete",noCssTransform:!0});function T(e){return void 0===e&&(e={}),function(t){var n=t.instance;n.partials[e.name||"autocomplete"]=O,n.components["rac-pop"]=u,n.decorators.autocompletefocus=w}}e.Autocomplete=O,e.FieldType=function(e){return void 0===e&&(e={}),function(t,n,i){return[{t:7,e:e.name||"autocomplete",m:t,f:n}]}},e.plugin=T,e.default=T,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("ractive")):"function"==typeof define&&define.amd?define(["exports","ractive"],t):t(e.RMAutocomplete={},e.Ractive)}(this,function(e,t){"use strict";t=t&&t.hasOwnProperty("default")?t.default:t;var n="undefined"!=typeof window?window:null;function i(e,t,i){if(n&&n.Ractive&&"object"==typeof n.Ractive[t]){var o=document.currentScript;if(o||(o=(o=document.querySelectorAll("script"))[o.length-1]),o){var r=o.getAttribute("data-alias");r&&(r=(r=r.split("&")).reduce(function(e,t){var n=t.split("="),i=n[0],o=n[1];return e[i]=o,e},{})),Ractive[t][r&&r[e]||e]=i}}}function o(e,t){void 0===t&&(t={});var n=e.processParams(t,{duration:400,easing:"easeInOut"});t.dir=t.dir||!1;var i=t.distance||"20px",o=t.scale||"0.9",r="above"===t.dir?"translateY("+i+")":"left"===t.dir?"translateX("+i+")":"right"===t.dir?"translateX(-"+i+")":"translateY(-"+i+")";return e.isIntro||n.intro?(e.setStyle("opacity",0),e.setStyle("transform","scale("+o+") "+r),e.animateStyle({opacity:1,transform:"none"},n)):(e.setStyle("opacity",1),e.setStyle("transform","none"),e.animateStyle({opacity:0,transform:"scale("+o+") "+r},n))}function r(e){return void 0===e&&(e={}),function(t){t.instance.transitions[e.name||"pop"]=o}}function a(e,t){var n=!1,i=!1;function o(n){for(var i=n.target;i;){if(i===e)return;if(!i.parentNode&&i!==document)return;i=i.parentNode}t(n)}return setTimeout(function(){n=!0,i||(document.body.addEventListener("click",o,{capture:!0}),document.body.addEventListener("touchstop",o,{capture:!0}))}),{teardown:function(){i=!0,n&&(document.body.removeEventListener("click",o,{capture:!0}),document.body.removeEventListener("touchstop",o,{capture:!0}))}}}function l(e,t){var n=e.processParams(t,{duration:200,easing:"easeInOut"});return e.isIntro||n.intro?(e.setStyle("opacity",0),e.animateStyle("opacity",1,n)):(e.setStyle("opacity",1),e.animateStyle("opacity",0,n))}function c(e){return void 0===e&&(e={}),function(t){t.instance.transitions[e.name||"fade"]=l}}i("pop","transitions",o),i("fade","transitions",l);var s,p,f,d={v:4,t:[{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rpop-wrapper",g:1},{n:"class-rpop-with-tail",t:13,f:[{t:2,r:"position.tail"}]},{n:"class",f:["rpop-",{t:2,x:{r:["where"],s:'_0||"below"'}}," rpop-align-",{t:2,x:{r:["align"],s:'_0||"middle"'}}],t:13},{t:4,f:[{n:"style-top",f:[{t:2,r:"position.popTop"},"px"],t:13},{n:"style-left",f:[{t:2,r:"position.popLeft"},"px"],t:13}],n:50,r:"position"},{t:4,f:[{t:4,f:[{n:"style-top",f:[{t:2,r:"top"}],t:13}],n:50,r:"top"},{t:4,f:[{n:"style-left",f:[{t:2,r:"left"}],t:13}],n:50,r:"left"}],n:51,l:1},{n:"pop",t:72,f:{r:["where"],s:'[{dir:_0||"below"}]'},v:"t2"},{n:"cleanup",t:71},{t:4,f:[{n:["click"],t:70,f:{r:["@this"],s:'[_0.set("popped",false)]'}}],n:50,r:"clickClose"},{t:4,f:[{n:["clickout"],t:70,f:{r:["@this"],s:'[_0.set("popped",false)]'}}],n:51,r:"noClickout"},{t:16,r:"extra-attributes"}],f:[{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rpop-tail",g:1},{t:4,f:[{n:"style-top",f:[{t:2,x:{r:["position.tailTop","position.vert"],s:"_0+(_1?1:0)"}},"px"],t:13}],n:50,r:"position.tailTop"},{t:4,f:[{n:"style-bottom",f:[{t:2,x:{r:["position.tailBottom","position.vert"],s:"_0+(_1?1:0)"}},"px"],t:13}],n:50,r:"position.tailBottom"},{t:4,f:[{n:"style-left",f:[{t:2,x:{r:["position.tailLeft","position.vert"],s:"_0+(_1?0:1)"}},"px"],t:13}],n:50,r:"position.tailLeft"},{t:4,f:[{n:"style-right",f:[{t:2,x:{r:["position.tailRight","position.vert"],s:"_0+(_1?0:1)"}},"px"],t:13}],n:50,r:"position.tailRight"}]}," ",{t:7,e:"div",m:[{t:13,n:"class",f:"rpop-tail-outer",g:1},{t:4,f:[{n:"style-top",f:[{t:2,x:{r:["position.tailTop"],s:"_0-2"}},"px"],t:13}],n:50,r:"position.tailTop"},{t:4,f:[{n:"style-bottom",f:[{t:2,x:{r:["position.tailBottom"],s:"_0-2"}},"px"],t:13}],n:50,r:"position.tailBottom"},{t:4,f:[{n:"style-left",f:[{t:2,x:{r:["position.tailLeft"],s:"_0-2"}},"px"],t:13}],n:50,r:"position.tailLeft"},{t:4,f:[{n:"style-right",f:[{t:2,x:{r:["position.tailRight"],s:"_0-2"}},"px"],t:13}],n:50,r:"position.tailRight"}]}],n:50,r:"~/tail"}," ",{t:7,e:"div",m:[{t:13,n:"class",f:"rpop",g:1}],f:[{t:16,r:"content"}]}]}],n:50,r:"__popped"}],e:{'_0||"below"':function(e){return e||"below"},'_0||"middle"':function(e){return e||"middle"},'[{dir:_0||"below"}]':function(e){return[{dir:e||"below"}]},'[_0.set("popped",false)]':function(e){return[e.set("popped",!1)]},"_0+(_1?1:0)":function(e,t){return e+(t?1:0)},"_0+(_1?0:1)":function(e,t){return e+(t?0:1)},"_0-2":function(e){return e-2},"[{delay:200}]":function(){return[{delay:200}]},"[_0===_1&&_2.done(),true]":function(e,t,n){return[e===t&&n.done(),!0]},"[_0.done()]":function(e){return[e.done()]},true:function(){return!0}},p:{modal:[{t:4,f:[{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rpop-modal",g:1},{n:"fade",t:72,v:"t1"},{n:"fade",t:72,f:{r:[],s:"[{delay:200}]"},v:"t2"},{t:4,f:[{n:["click"],t:70,f:{r:["@node","@event.target","."],s:"[_0===_1&&_2.done(),true]"}}],n:51,r:".noClickout"}],f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rpop",g:1},{n:"pop",t:72,f:{r:[],s:"[{delay:200}]"},v:"t1"},{n:"pop",t:72,v:"t2"},{t:4,f:[{n:["click"],t:70,f:{r:["."],s:"[_0.done()]"}}],n:50,r:".clickClose"},{t:8,r:".attrs",c:{r:".context"},z:[{n:"inModal",x:{x:{r:[],s:"true"}}}]}],f:[{t:8,r:".content",c:{r:".context"},z:[{n:"inModal",x:{x:{r:[],s:"true"}}}]}]}]}],n:54,r:"contents.0"}],n:50,r:"contents.length"}]}},u=function(e){function t(t){e.call(this,t)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.position=function(e){var t=e||this.source,n=this.get("popped");if(t&&n){var i=this.find("div");if(t&&i&&i.offsetParent){var o=i.offsetParent,r=o.getBoundingClientRect(),a=i.getBoundingClientRect(),l=t.getBoundingClientRect(),c=this.get("where")||"below",s=this.get("align")||"middle",p=this.get("tail"),f="above"===c||"below"===c,d=this.get("fit"),u=this.get("gap"),b="above"===c||"below"===c?0:"left"===c?-a.width-u:l.width+u,m="left"===c||"right"===c?-l.height:"above"===c?-l.height-a.height-u:u;"middle"===s?"below"===c||"above"===c?b-=(a.width-l.width)/2:"left"!==c&&"right"!==c||(m-=(a.height-l.height)/2):"end"===s&&("below"===c||"above"===c?b+=l.width-a.width:"left"!==c&&"right"!==c||(m+=l.height-a.height));var h={popTop:l.bottom-r.top+m,popLeft:l.left-r.left+b,tail:p,vert:"above"===c||"below"===c};if(o.scrollTop&&(h.popTop+=o.scrollTop),o.scrollLeft&&(h.popLeft+=o.scrollLeft),p){"above"===c?h.tailBottom=-10:"below"===c?h.tailTop=-10:"left"===c?h.tailRight=-10:"right"===c&&(h.tailLeft=-10);var g=this.tailSource?this.tailSource.getBoundingClientRect():l;"start"===s?f?h.tailLeft=Math.floor(g.width/2)-10:h.tailTop=Math.floor(g.height/2)-10:"end"===s?f?h.tailRight=Math.floor(g.width/2)-10:h.tailBottom=Math.floor(g.height/2)-10:"middle"===s&&(f?h.tailLeft=Math.floor(g.width/2)-10:h.tailTop=Math.floor(g.height/2)-10),g!==l?f?(null!=h.tailLeft&&(h.tailLeft+=g.left-l.left),null!=h.tailRight&&(h.tailRight+=l.right-g.right)):(null!=h.tailTop&&(h.tailTop+=g.top-l.top),null!=h.tailBottom&&(h.tailBottom+=l.bottom-g.bottom)):"middle"===s&&(f?(null!=h.tailLeft&&(h.tailLeft+=g.left-(h.popLeft+r.left)),null!=h.tailRight&&(h.tailRight+=h.popLeft+r.left+a.width-g.right)):(null!=h.tailTop&&(h.tailTop+=g.top-(h.popTop+r.top)),null!=h.tailBottom&&(h.tailBottom+=h.popTop+r.top+a.height-g.bottom)))}if(d){var v=o;if(this.get("offsets"))for(var y=this.get("offsets");y--;)v=v.offsetParent;var x=o.scrollWidth,w=o.scrollHeight;if(h.popLeft+a.width>x){var _=h.popLeft-(x-a.width);h.popLeft-=_,f&&h.tailLeft&&(h.tailLeft+=_),f&&h.tailRight&&(h.tailRight-=_),p&&!f&&(h.tail=!1)}if(h.popLeft<0){var k=-1*h.popLeft;h.popLeft+=k,f&&h.tailLeft&&(h.tailLeft-=k),f&&h.tailRight&&(h.tailRight+=k),p&&!f&&(h.tail=!1)}if(h.popTop+a.height>w){var O=h.popTop-(w-a.height);h.popTop-=O,!f&&h.tailTop&&(h.tailTop+=O),!f&&h.tailBottom&&(h.tailBottom-=O),p&&f&&(h.tail=!1)}if(h.popTop<0){var T=-1*h.popTop;h.popTop+=T,!f&&h.tailTop&&(h.tailTop-=T),!f&&h.tailBottom&&(h.tailBottom+=T),p&&f&&(h.tail=!1)}}this.set("position",h)}else this.set("position",null)}},t.prototype.show=function(e){this.source=e,this.set("popped",!0)},t.prototype.hide=function(){this.set("popped",!1)},t}(t);t.extendWith(u,{attributes:["popped","tail","where","align","top","left","fit","clickClose","noClickout","gap","offsets"],use:[r(),(void 0===f&&(f={}),function(e){e.instance.events[f.name||"clickout"]=a}),c()],template:d,css:function(e){return[function(e){var t=Object.assign({},e("raui.primary"),e("raui.pop.primary")),n=(e("raui.themes")||[]).slice();return(e("raui.pop.themes")||[]).forEach(function(e){~n.indexOf(e)||n.push(e)}),"\n .rpop-wrapper {\n position: absolute;\n display: inline-block;\n z-index: 21;\n transition-property: top, left, padding;\n transition-timing-function: ease-in-out;\n transition-duration: 0.3s;\n }\n .rpop-with-tail.rpop-above {\n padding-bottom: 10px;\n }\n .rpop-with-tail.rpop-below {\n padding-top: 10px;\n }\n .rpop-with-tail.rpop-left {\n padding-right: 10px;\n }\n .rpop-with-tail.rpop-right {\n padding-left: 10px;\n }\n \n .rpop {\n position: relative;\n box-shadow: 0 1px 4px 0 rgba(0,0,0,0.24);\n border: 1px solid #ccc;\n border-radius: 0.2em;\n background-color: "+(t.bg||"#fff")+";\n color: "+(t.fg||"#222")+";\n padding: 0.5em;\n z-index: 2;\n }\n \n .rpop-modal {\n position: fixed;\n display: flex;\n z-index: 20;\n background-color: rgba(0, 0, 0, 0.2);\n align-items: center;\n justify-content: center;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n padding: 1em;\n overflow: auto;\n }\n \n .rpop-tail, .rpop-tail-outer {\n z-index: 3;\n width: 0;\n height: 0;\n position: absolute;\n border-style: solid;\n border-width: 10px;\n border-color: transparent;\n transition-property: top, left, bottom, right, border-color;\n transition-timing-function: ease-in-out;\n transition-duration: 0.3s;\n }\n .rpop-tail-outer {\n z-index: 1;\n border-width: 12px;\n border-color: transparent;\n }\n \n .rpop-below .rpop-tail {\n border-bottom-color: "+(t.bg||"#fff")+";\n }\n .rpop-below .rpop-tail-outer {\n border-bottom-color: "+(t.bc||"#ccc")+";\n }\n \n .rpop-above .rpop-tail {\n border-top-color: "+(t.bg||"#fff")+";\n }\n .rpop-above .rpop-tail-outer {\n border-top-color: "+(t.bc||"#ccc")+";\n }\n \n .rpop-left .rpop-tail {\n border-left-color: "+(t.bg||"#fff")+";\n }\n .rpop-left .rpop-tail-outer {\n border-left-color: "+(t.bc||"#ccc")+";\n }\n \n .rpop-right .rpop-tail {\n border-right-color: "+(t.bg||"#fff")+";\n }\n .rpop-right .rpop-tail-outer {\n border-right-color: "+(t.bc||"#ccc")+";\n }\n "+n.map(function(t){var n=Object.assign({},e("raui.primary"),e("raui.pop.primary"),e("raui."+t),e("raui.pop."+t));return"\n ."+t+" .rpop {\n background-color: "+(n.bg||"#fff")+";\n color: "+(n.fg||"#222")+";\n }\n \n ."+t+".rpop-below .rpop-tail {\n border-bottom-color: "+(n.bg||"#fff")+";\n }\n ."+t+".rpop-below .rpop-tail-outer {\n border-bottom-color: "+(n.bc||"#ccc")+";\n }\n \n ."+t+".rpop-above .rpop-tail {\n border-top-color: "+(n.bg||"#fff")+";\n }\n ."+t+".rpop-above .rpop-tail-outer {\n border-top-color: "+(n.bc||"#ccc")+";\n }\n \n ."+t+".rpop-left .rpop-tail {\n border-left-color: "+(n.bg||"#fff")+";\n }\n ."+t+".rpop-left .rpop-tail-outer {\n border-left-color: "+(n.bc||"#ccc")+";\n }\n \n ."+t+".rpop-right .rpop-tail {\n border-right-color: "+(n.bg||"#fff")+";\n }\n ."+t+".rpop-right .rpop-tail-outer {\n border-right-color: "+(n.bc||"#ccc")+";\n }\n "})}.call(this,e)].join(" ")},cssId:"rpop",noCssTransform:!0,observe:{popped:function(e){var t=this;setTimeout(function(){t.get("popped")===e&&t.set("_popped",e)},1)},_popped:{handler:function(e){var t=this;if(e){var n=this.get("@style.raui.pop.mobile");if(n&&window.matchMedia("(max-width: "+n+")").matches){p||(p=new b({target:document.body,append:!0}));var i=this.getContext().getParent(!0);i.isContext=1,this.set("__popped",!1),p.unshift("contents",{content:this.partials.content,context:i,attrs:this.partials["extra-attributes"]||[],clickClose:this.get("clickClose"),noClickout:this.get("noClickout"),done:function(){t.set("popped",!1)}})}else this.set("__popped",!0)}else s?p.shift("contents"):this.set("__popped",!1)},defer:!0},__popped:{handler:function(e){if(e){var t=this.find("div"),n=t,i=n.offsetHeight+n.offsetTop,o=n.offsetWidth+n.offsetLeft,r=n.offsetParent;if(!this.overflows)for(var a=this.overflows={e:[],v:[]};t&&t.style;){if(t===r){if(t.offsetWidth>=o&&t.offsetHeight>=i)break;o+=t.offsetLeft,i+=t.offsetTop,r=t.offsetParent}var l=getComputedStyle(t);if("auto"===l.overflow)break;"hidden"===l.overflow&&(a.e.push(t),a.v.push(t.style.overflow),t.style.overflow="visible"),t=t.parentNode}this.position(),this.transition("pop",n,{intro:!0,dir:this.get("where")||"below"})}else this.source=null,this.tailSource=null},defer:!0},"align where tail fit":{handler:function(){this.position()},defer:!0}},decorators:{cleanup:function(e){var t=this;return{teardown:function(){var e=t.overflows;if(e){t.overflows=null;for(var n=0;n<e.e.length;n++)e.e[n].style.overflow=e.v[n]}}}}},data:function(){return{gap:4}}});var b=function(e){function t(t){e.call(this,t)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t}(t);function m(){}function h(e){~this.className.indexOf("focus")||(this.className+=" focus")}function g(e){this.className=this.className.replace(/\bfocus\b/g,"").trim()}function v(e){var t,n,i,o,r,a,l,c,s,p,f,d,u,b=this.getContext(e);function v(){var b=y().split(/\s+/).filter(function(e){return!!e});(t=!!~b.indexOf("field"))||(b.push("field"),t=!0),(n=e.querySelector("input[type=checkbox]"))&&!~b.indexOf("check")&&b.push("check"),(i=e.querySelector("input[type=radio]"))&&!~b.indexOf("radio")&&b.push("radio");var m=n||i;m&&m.checked&&!~b.indexOf("checked")&&b.push("checked"),m&&m.disabled&&!~b.indexOf("disabled")&&b.push("disabled"),!m&&p?(p.cancel(),p=0,f&&(f.disconnect(),f=0),delete m._form_callback,u&&(delete u.checked,d=u=void 0)):m&&(m._form_callback=function(t,n){if(void 0===n&&(n=!0),n&&"radio"===m.type&&m.name){var i=[];i.push.apply(i,document.querySelectorAll("input[type=radio][name="+m.name+"]")),(i=i.filter(function(e){return e!==m})).forEach(function(e){return e._form_callback&&e._form_callback(t,!1)})}var o=m.checked;o&&!~e.className.indexOf("checked")?e.className+=" checked":!o&&~e.className.indexOf("checked")&&(e.className=e.className.replace(/\bchecked\b/g,"").replace(/ +/g," ").trim())},MutationObserver&&(f=new MutationObserver(function(){var t;(t=m.disabled)&&!~e.className.indexOf("disabled")?e.className+=" disabled":!t&&~e.className.indexOf("disabled")&&(e.className=e.className.replace(/\bdisabled\b/g,"").replace(/ +/g," ").trim())})).observe(m,{attributes:!0}),p=this.getContext(m).listen("change",m._form_callback),(d=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(m),"checked"))&&d.configurable&&(u=m,Object.defineProperty(m,"checked",{get:d.get,set:function(e){d.set.call(u,e),m._form_callback()},enumerable:!0,configurable:!0}))),(o=!!e.querySelector("textarea"))&&!~b.indexOf("textarea")&&b.push("textarea"),(r=!!e.querySelector("select"))&&!~b.indexOf("select")&&b.push("select"),(a=!!e.querySelector("input[type=file]"))&&!~b.indexOf("file")&&b.push("file"),(l=!!(l=e.querySelector("button"))&&l.parentNode===e)&&!~b.indexOf("button")&&b.push("button"),(c=!!e.querySelector("div"))&&!~b.indexOf("plain")&&b.push("plain"),(s=!(n||i||a||!e.querySelector("input")))&&!~b.indexOf("input")&&b.push("input"),e.className=b.join(" ")}function y(){var p=e.className;return t||(p=p.replace(/\bfield\b/g,"").trim()),n||(p=p.replace(/\bcheck(ed)?\b/g,"").trim()),i||(p=p.replace(/\bradio\b/g,"").trim()),o||(p=p.replace(/\btextarea\b/g,"").trim()),r||(p=p.replace(/\bselect\b/g,"").trim()),a||(p=p.replace(/\bfile\b/g,"").trim()),l||(p=p.replace(/\bbutton\b/g,"").trim()),c||(p=p.replace(/\bplain\b/g,"").trim()),s||(p=p.replace(/\binput\b/g,"").trim()),p=p.replace(/ +/g," ")}var x=b.listen("focusin",h),w=b.listen("focusout",g);return v.call(this),{update:m,invalidate:v.bind(this),teardown:function(){var t=y();t=t.replace(/\bfocus\b/g,"").trim(),x.cancel(),w.cancel(),p&&p.cancel(),f&&f.disconnect(),u&&(delete u.checked,d=u=void 0),e.className=t}}}function y(e,t){if(!e)return!1;for(var n=0;n<e.length;n++){if(e[n].e===t)return!0;if(e[n].f&&y(e[n].f,t))return!0}return!1}t.extendWith(b,{template:{v:d.v,t:d.p.modal},data:function(){return{contents:[]}},use:[r(),c()],observe:{contents:function(e){s=(e||[]).length>0}},on:{init:function(){p?console.warn("More than one PopOver mobile host created."):p=this}}}),v.style=function(e){var t=Object.assign({},e("raui.primary"),e("raui.form.primary")),n=Object.assign({},e("raui.primary.active"),e("raui.form.primary.active")),i=e("raui.form.boxy");return"\n label.field {\n display: inline-block;\n font-size: 0.9em;\n font-weight: 500;\n color: "+(t.fg||"#222")+";\n transition: 0.2s ease-in-out;\n transition-property: color;\n vertical-align: top;\n box-sizing: border-box;\n padding: 0.25em 0.5em;\n line-height: 1.5em;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n font-family: inherit;\n }\n\n label.field.textarea {\n display: block;\n border: 0.0625em solid "+(t.bc||"#ccc")+";\n padding: 0.5em 0.8em 0.8em 0.8em;\n border-radius: "+(t.radius||"0.2em")+";\n box-shadow: none;\n transition-property: color, border-color, box-shadow;\n margin: 0.8em 0.2em;\n min-height: auto;\n background-color: "+(i?t.bg||"#fff":"transparent")+";\n }\n\n label.field.focus {\n color: "+(n.fg||t.fga||"#07e")+";\n }\n\n label.field.textarea.focus {\n border-color: "+(n.fg||t.fga||"#07e")+";\n "+(i?"":"box-shadow: 0.0625em 0.0625em "+(n.fg||t.fga||"#07e")+",\n -0.0625em 0.0625em "+(n.fg||t.fga||"#07e")+",\n 0.0625em -0.0625em "+(n.fg||t.fga||"#07e")+",\n -0.0625em -0.0625em "+(n.fg||t.fga||"#07e")+";")+"\n }\n\n label.field input,\n label.field select,\n label.field textarea\n {\n display: block;\n border-width: "+(i?"0.0625em":"0 0 0.0625em 0")+";\n border-color: "+(t.bc||"#ccc")+";\n border-style: solid;\n box-sizing: border-box;\n background-color: "+(i?t.bg||"#fff":"transparent")+";\n transition: 0.2s ease-in-out;\n transition-property: box-shadow, color;\n outline: none;\n box-shadow: none;\n width: 100%;\n margin-bottom: 0.8em;\n font-size: 1.1em;"+(i?"\n border-radius: "+(t.radius||"0.2em")+";":"")+"\n font-weight: 400;\n font-family: inherit;\n }\n\n label.field input"+(i?"":":disabled")+",\n label.field select"+(i?"":":disabled")+" {\n padding: 0 0.75em;\n }\n label.field select"+(i?"":":disabled")+" {\n padding-right: 2em;\n }\n\n label.field input:disabled,\n label.field select:disabled,\n label.field textarea:disabled {\n background: #f4f4f4;\n }\n\n label.field textarea {\n line-height: 1.2em;\n }\n label.field .field-wrapper {\n display: block;\n }\n label.field > select, label.field > input,\n label.field > .field-wrapper > input, label.field > .field-wrapper > select {\n height: 2.5em;\n }\n\n "+(i?"":"label.field:hover > input,\n label.field:hover select,\n label.field.file:hover:after {\n box-shadow: 0 0.0625em 0 0 "+(t.bc||"#ccc")+";\n }\n\n label.field.textarea:hover {\n box-shadow: 0.0625em 0.0625em "+(t.bc||"#ccc")+",\n -0.0625em 0.0625em "+(t.bc||"#ccc")+",\n 0.0625em -0.0625em "+(t.bc||"#ccc")+",\n -0.0625em -0.0625em "+(t.bc||"#ccc")+";\n }\n\n label.field.textarea.focus:hover {\n box-shadow: 0.0625em 0.0625em "+(n.fg||t.fga||"#07e")+",\n -0.0625em 0.0625em "+(n.fg||t.fga||"#07e")+",\n 0.0625em -0.0625em "+(n.fg||t.fga||"#07e")+",\n -0.0625em -0.0625em "+(n.fg||t.fga||"#07e")+";\n }")+"\n\n /**** CHECK BOXES ****/\n\n label.field.check {\n position:relative;\n z-index: 0;\n overflow: visible;\n cursor: pointer;\n padding-top: 2.2em;\n white-space: normal;\n }\n label.field.check.inline {\n padding-top: 0.7em;\n }\n\n label.field.check input {\n appearance: none;\n -moz-appearance: none;\n -webkit-appearance: none;\n z-index: -1;\n position: absolute;\n left: -3px;\n top: 23px;\n display: block;\n margin: 0;\n border-radius: 50%;\n width: 40px;\n height: 40px;\n background-color: "+(t.bc||"#ccc")+";\n box-shadow: none;\n outline: none;\n opacity: 0;\n transform: scale(1);\n pointer-events: none;\n transition: opacity 0.3s, transform 0.2s;\n }\n label.field.inline.check input {\n top: 3px;\n left: -3px;\n }\n\n label.field.check input:checked {\n background-color: "+(t.fga||"#07e")+';\n }\n\n label.field.check:hover > input {\n opacity: 0.04;\n }\n\n label.field.check input:focus {\n opacity: 0.12;\n }\n\n label.field.check:hover > input:focus {\n opacity: 0.16;\n }\n\n label.field.check input:active {\n opacity: 0.6;\n transform: scale(0);\n transition: transform 0s, opacity 0s;\n }\n\n label.field.check:before {\n content: "";\n display: inline-block;\n box-sizing: border-box;\n margin: 3px 11px 3px 1px;\n border: solid 2px; /* Safari */\n border-color: '+(t.fg||"#222")+';\n border-radius: 2px;\n width: 18px;\n height: 18px;\n vertical-align: bottom;\n transition: border-color 0.2s, background-color 0.2s;\n }\n\n label.field.check:after {\n content: "";\n display: block;\n position: absolute;\n top: 0px;\n left: 0px;\n width: 10px;\n height: 5px;\n border: solid 2px transparent;\n border-right: none;\n border-top: none;\n transform: translate(0.8em, 2.65em) rotate(-45deg);\n }\n\n label.field.check.inline:after {\n transform: translate(0.8em, 1.2em) rotate(-45deg);\n }\n\n label.field.check.checked:before {\n border-color: '+(t.fga||"#07e")+";\n background-color: "+(t.fga||"#07e")+";\n }\n label.field.check.focus:before {\n border-color: "+(t.fga||"#07e")+";\n }\n\n label.field.check.checked:after {\n border-color: "+(t.bg||"#fff")+";\n }\n\n label.field.check input:disabled {\n opacity: 0;\n }\n\n label.field.check.disabled {\n color: "+(t.bc||"#ccc")+";\n cursor: initial;\n }\n\n label.field.check.disabled:before {\n border-color: "+(t.bc||"#ccc")+";\n }\n\n label.field.check.checked.disabled:before {\n border-color: transparent;\n background-color: "+(t.bc||"#ccc")+";\n }\n\n\n /**** RADIO BUTTONS ****/\n \n label.field.radio {\n z-index: 0;\n position: relative;\n display: inline-block;\n overflow: visible;\n padding-top: 2.2em;\n white-space: normal;\n }\n label.field.radio.inline {\n padding-top: 0.8em;\n }\n\n label.field.radio input {\n appearance: none;\n -moz-appearance: none;\n -webkit-appearance: none;\n z-index: -1;\n position: absolute;\n left: 0;\n top: 0;\n display: block;\n margin: 0;\n border-radius: 50%;\n width: 41px;\n height: 40px;\n background-color: "+(t.bc||"#ccc")+';\n outline: none;\n opacity: 0;\n pointer-events: none;\n transform: translate(-0.2em, 24px) scale(1);\n transition: opacity 0.3s, transform 0.3s;\n }\n label.field.inline.radio input {\n transform: translate(-0.2em, 3px) scale(1);\n }\n\n label.field.radio {\n cursor: pointer;\n position: relative;\n }\n\n label.field.radio:before {\n content: "";\n display: inline-block;\n box-sizing: border-box;\n margin: 2px 10px 2px 0;\n border: solid 2px; /* Safari */\n border-color: '+(t.fg||"#222")+';\n border-radius: 50%;\n width: 20px;\n height: 20px;\n vertical-align: middle;\n transition: border-color 0.2s;\n }\n\n label.field.radio:after {\n content: "";\n display: block;\n position: absolute;\n border-radius: 50%;\n width: 10px;\n height: 10px;\n background-color: '+(t.fga||"#07e")+";\n transform: translate(5px, -17px) scale(0);\n transition: transform 0.2s;\n }\n\n label.field.radio input:checked {\n background-color: "+(t.fga||"#07e")+";\n }\n\n label.field.radio.checked:before {\n border-color: "+(t.fga||"#07e")+";\n }\n\n label.field.radio.checked:after {\n transform: translate(5px, -17px) scale(1);\n }\n\n label.field.radio:hover input {\n opacity: 0.04;\n }\n\n label.field.radio input:focus {\n opacity: 0.12;\n transform: translate(-0.2em, 24px) scale(1);\n transition: transform 0.2s, opacity 0.2s;\n }\n label.field.inline.radio input:focus {\n transform: translate(-0.2em, 3px) scale(1);\n }\n\n label.field.radio:hover input:focus {\n opacity: 0.16;\n }\n\n label.field.radio input:active {\n opacity: 1;\n transform: translate(-0.2em, 24px) scale(0);\n transition: transform 0s, opacity 0s;\n }\n label.field.inline.radio input:active {\n transform: translate(-0.2em, 3px) scale(0);\n }\n\n label.field.radio.checked:before {\n border-color: "+(t.fga||"#07e")+";\n }\n\n label.field.radio.focus:before {\n border-color: "+(t.fga||"#07e")+";\n }\n\n label.field.radio input:disabled {\n opacity: 0;\n }\n\n label.field.radio.disabled {\n color: "+(t.bc||"#ccc")+";\n cursor: initial;\n }\n\n label.field.radio.disabled:before {\n border-color: "+(t.bc||"#ccc")+";\n }\n\n label.field.radio.disabled:after {\n background-color: "+(t.bc||"#ccc")+";\n }\n\n\n\n label.field select {\n padding-right: 2em;\n }\n\n label.field.select {\n cursor: pointer;\n position: relative;\n }\n\n label.field.select:after {\n content: ' ';\n position: absolute;\n display: block;\n width: 0.6em;\n right: 19px;\n height: 0.6em;\n top: 2.6em;\n border-bottom: 0.125em solid;\n border-right: 0.125em solid;\n transform: rotate(45deg);\n pointer-events: none;\n color: "+(t.bc||"#ccc")+";\n }\n\n label.field textarea {\n border: none;"+(i?"\n padding: 0;":"")+"\n }\n\n label.field > select {\n -moz-appearance: none;\n -webkit-appearance: none;\n }\n\n label.field input:focus,\n label.field select:focus,\n label.field.file.focus:after\n {\n border-color: "+(n.fg||t.fga||"#07e")+";\n "+(i?"":"box-shadow: 0 0.0625em 0 0 "+(n.fg||t.fga||"#07e")+";")+"\n }\n\n label.field input[type=checkbox]:focus,\n label.field input[type=radio]:focus {\n box-shadow: none;\n }\n\n label.field.file.focus:after {\n color: "+(n.fg||t.fga||"#07e")+";\n }\n label.field.file [type=file] {\n position: absolute;\n width: 0;\n height: 0;\n opacity: 0;\n z-index: -1;\n }\n label.field.file {\n position: relative;\n min-width: 9em;\n height: 5em;\n }\n label.field.file:after {\n position: absolute;\n content: 'Choose a file';\n box-sizing: border-box;\n width: calc(100% - 0.3em);\n height: 2.5em;\n font-size: 1.1em;\n line-height: 1.5em;\n color: "+(t.fg||"#222")+";\n text-align: "+(i?"center":"left")+";\n padding: 0.5em "+(i?"0.5em":"0")+";\n cursor: pointer;\n font-style: oblique;\n left: 0.25em;\n top: 1.6em;\n transition: 0.2s ease-in-out;\n transition-property: color, border-bolor, box-shadow;"+(i?"\n border-radius: "+(t.radius||"0.2em")+";\n border-color: "+(t.bc||"#ccc")+";\n border-style: solid;\n border-width: 0.0625em;":"\n border-bottom-color: "+(t.bc||"#ccc")+";\n border-bottom-width: 0.0625em;\n border-bottom-style: solid;\n ")+"\n }\n label.field.file.inline:after {\n top: 0.2em;\n }\n\n label.field.button {\n vertical-align: top;\n padding-top: "+(i?"1.7":"1.958")+"em;\n }\n label.field .with-buttons button, label.field.button button {\n font-size: 1.1em;\n margin-top: "+(i?"0.15em":"0")+";\n }\n\n label.field .field-wrapper.with-buttons {\n display: flex;\n }\n label.field .with-buttons button {\n flex-shrink: 0;\n padding-left: 0.5em;\n padding-right: 0.5em;\n margin-top: 0;\n margin-right: 0;\n "+(i?"height: 2.5em;\n box-shadow: none;\n border-radius: 0;\n border-left: 1px solid "+(t.bg||"#fff")+";\n margin-left: 0;":"height: 2.25em;")+"\n }"+(i?"\n label.field .with-buttons button:first-of-type {\n margin-left: -0.05em;\n border-left: none;\n }\n label.field .with-buttons button:last-of-type {\n border-radius: 0 "+(t.radius||"0.2em")+" "+(t.radius||"0.2em")+" 0;\n }\n label.field .with-buttons input {\n border-radius: "+(t.radius||"0.2em")+" 0 0 "+(t.radius||"0.2em")+";\n min-width: 0;\n }\n ":"")+"\n\n label.field.plain > div {\n position: absolute;\n font-size: 1.1em;\n top: 2.4em;\n font-weight: normal;\n }\n\n /* inline fields (no labels) */\n label.field.inline {\n height: 3.3em;\n }\n\n label.field.button.inline {\n margin-top: 0.2em;\n padding-top: 0.12em;\n }\n\n label.field.button.inline button {\n margin-top: 0;\n }\n\n label.field.inline.select:after {\n top: 1."+(i?"15":"1")+"em;\n }\n\n label.field .field-tip {\n display: inline-block;\n width: 1em;\n height: 1em;\n background-color: "+(t.fga||"#07e")+";\n color: "+(t.bg||"#fff;")+";\n cursor: default;\n user-select: none;\n border-radius: 1em;\n margin-left: 0.5em;\n line-height: 1.2em;\n text-align: center;\n margin-top: -0.2em;\n }\n\n label.field .field-solo-tip {\n margin-left: -0.1em;\n }\n "};var x=t.macro(function(e){var t=[],n=(e.template.m||[]).slice(),i=e.template.f||[],o=n.find(function(e){return"value"===e.n}),r=n.find(function(e){return"type"===e.n}),a=n.find(function(e){return"tip"===e.n}),l=n.find(function(e){return"disabled"===e.n});if(a&&n.splice(n.indexOf(a),1),r&&"function"==typeof x.types[r.f])t.push.apply(t,x.types[r.f](n,i,e));else if(o){var c={t:7,e:"input",m:[o]};if(l&&c.m.push(l),y(i,"option")&&(c.e="select",c.f=i),r&&(c.m.push(r),"checkbox"===r.f||"radio"===r.f)){var s=n.find(function(e){return"target"===e.n});s?c.m.push(Object.assign({},s,{n:"name"})):c.m.splice(c.m.indexOf(o),1,Object.assign({},o,{n:"checked"}))}c.m=c.m.concat(n.filter(function(e){return 73===e.t||73===e.t||"placeholder"===e.n})),t.push(c);var p=i.filter(function(e){return"button"===e.e||y(e.f,"button")});p.length&&(t.push.apply(t,p),t=[{t:7,e:"span",m:[{t:13,n:"class",f:"field-wrapper with-buttons",g:1}],f:t}])}else{var f=i.filter(function(e){return e.e});f.find(function(e){return"button"===e.e})&&f.length>1?t=[{t:7,e:"span",m:[{t:13,n:"class",f:"field-wrapper with-buttons",g:1}],f:i}]:t.push.apply(t,i)}var d=n.find(function(e){return"label"===e.n});a&&t.unshift({t:7,e:"span",m:[{t:13,n:"class",f:"field-tip"+(d?"":" field-solo-tip"),g:1},{t:13,n:"title",f:a.f},{t:70,n:["click"],f:{r:[],s:"[false]"}}],f:"?"}),d?t.unshift.apply(t,Array.isArray(d.f)?d.f:[d.f]):t.unshift(" ");var u={t:7,e:"label",m:[{t:71,n:"field"}].concat(n.filter(function(e){return 13!==e.t&&73!==e.t||"value"!==e.n&&"type"!==e.n&&"inline"!==e.n&&"label"!==e.n&&"placeholder"!==e.n&&"target"!==e.n&&"disabled"!==e.n})),f:t};n.find(function(e){return"inline"===e.n})&&u.m.push({t:13,n:"class",f:"inline"}),e.setTemplate([u])});function w(e){return"function"==typeof e.focus&&e.focus(),{teardown:m}}x.types={},i("field","decorators",v),i("field","partials",x),i("autofocus","decorators",w);var _={v:4,t:[{t:7,e:"span",m:[{t:13,n:"class",f:"rautocomplete field-wrapper",g:1},{n:["pop"],t:70,f:{r:["@context","$1"],s:'[(_0).set("rac.pop",_1)]'}}],f:[{t:7,e:"input",m:[{t:8,r:"extra-attributes"},{n:["dblclick"],t:70,f:{r:["rac.pop","@node"],s:"[_0.show(_1)]"}},{n:["focus"],t:70,f:{r:["rac"],s:"[_0.stash()]"}},{n:["input"],t:70,f:{r:["rac","@event"],s:"[_0.input(_1)]"}},{n:["keydown"],t:70,f:{r:["rac","@event"],s:"[_0.key(_1)]"}},{t:73,v:"t",f:"false"},{n:"value",f:[{t:2,r:"rac.display"}],t:13}]}," ",{t:7,e:"div",m:[{t:13,n:"class",f:"rac-drop",g:1},{n:["click"],t:70,f:{r:["rac.pop","@context"],s:'[_0.show((_1).find("input"))]'}}]}," ",{t:7,e:"rac-pop",m:[{t:13,n:"style",f:"padding: 0;",g:1},{t:13,n:"class",f:"rac-pop",g:1},{n:["init"],t:70,f:{r:["@context","$1"],s:'[(_0).raise("pop",{},_1)]'}},{n:"popped",t:13,f:[{t:2,r:"rac.popped"}]},{n:"where",f:"below",t:13,g:1},{n:"align",f:"end",t:13,g:1},{n:"gap",f:[{t:2,x:{r:[],s:"2"},s:1}],t:13},{n:"offsets",t:13,f:[{t:2,r:"rac.offsets"}]},{n:"fit",t:13,f:[{t:2,r:"rac.fit"}]}],f:[{t:4,f:[{t:7,e:"input",m:[{n:"class-rac-modal",t:13},{n:["input"],t:70,f:{r:["rac","@event"],s:"[_0.input(_1)]"}},{n:["keydown"],t:70,f:{r:["rac","@event"],s:"[_0.key(_1)]"}},{t:73,v:"t",f:"false"},{n:"value",f:[{t:2,r:"rac.display"}],t:13},{n:"autocompletefocus",t:71}]}],n:50,r:"inModal"}," ",{t:7,e:"div",m:[{t:13,n:"class",f:"rac-list",g:1},{n:"tabindex",f:"-1",t:13,g:1}],f:[{t:55,f:[{f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rac-item rac-invalid",g:1}],f:["Loading..."]}],t:4},{t:62,f:[" ",{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rac-item",g:1},{n:"tabindex",f:"-1",t:13,g:1},{n:"class-rac-selected",t:13,f:[{t:2,x:{r:["rac.value","."],s:"_0===_1"}}]},{n:"class-rac-hover",t:13,f:[{t:2,x:{r:["rac.selected","@index"],s:"_0===_1"}}]},{n:["click"],t:70,f:{r:["@context","."],s:'[(_0).set("rac.value",_1)]'}},{n:["mouseover"],t:70,f:{r:["@context","@index"],s:'[(_0).set("rac.selected",_1)]'}}],f:[{t:2,x:{r:["rac","."],s:"_0._display(_1)"}}]}],n:52,r:"items"}," "],n:"items"},{t:63,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rac-item rac-invalid",g:1}],f:["Load failed."]}]}],r:"rac.list"}]}]}]}],e:{2:function(){return 2},'[(_0).set("rac.pop",_1)]':function(e,t){return[e.set("rac.pop",t)]},"[_0.show(_1)]":function(e,t){return[e.show(t)]},"[_0.stash()]":function(e){return[e.stash()]},"[_0.input(_1)]":function(e,t){return[e.input(t)]},"[_0.key(_1)]":function(e,t){return[e.key(t)]},'[_0.show((_1).find("input"))]':function(e,t){return[e.show(t.find("input"))]},'[(_0).raise("pop",{},_1)]':function(e,t){return[e.raise("pop",{},t)]},"_0===_1":function(e,t){return e===t},'[(_0).set("rac.value",_1)]':function(e,t){return[e.set("rac.value",t)]},'[(_0).set("rac.selected",_1)]':function(e,t){return[e.set("rac.selected",t)]},"_0._display(_1)":function(e,t){return e._display(t)}}};function k(e,t){return t.reduce(function(e,t){return e?e[t]:e},e)}var O=t.macro(function(e){var n,i,o;function r(t){null==t&&(t=null==e.get("rac.value")?"":e.get("rac.display")),t===e.get("rac.tempDisplay")&&(t="");var n=e.get("rac._items");if("function"==typeof n){var i=n(t);"object"==typeof i&&"function"==typeof i.then?i.then(function(t){return e.set("rac.list",t)}):e.set("rac.list",i)}else if(Array.isArray(n)){var o,r=e.get("rac._display");try{o=new RegExp(t||"","i")}catch(e){o=new RegExp((t||"").replace(/([\{\(\[\]\)\}\?\*\^\$])/g,"\\$1"))}e.set("rac.list",n.filter(function(e){return o.test(r(e))}))}else e.set("rac.list",[])}function a(n,o,a){var c=e.get("rac.displayprop");if(e.get("rac.__display")!==c||void 0===e.get("rac._display")){var s=function(){return e.attributes["display-value"]?e.get("rac.display"):"(none)"};if("string"==typeof c){var p=t.splitKeypath(c);c=function(e){return null==e?s():k(e,p)}}else Array.isArray(c)?c=function(e){return null==e?s():k(e,e)}:c||(c=function(e){return null==e?s():""+e});e.set("rac._display",c),e.set("rac.__display",e.get("rac.displayprop")),e.set("rac.display",c(e.get("rac.value")))}if(c=e.get("rac.member"),e.get("rac.__member")!==c||void 0===e.get("rac._member")){if("string"==typeof c){var f=t.splitKeypath(c);c=function(e){return k(e,f)}}else Array.isArray(c)?c=function(e){return k(e,e)}:c||(c=function(e){return e});e.set("rac._member",c),e.set("rac.__member",e.get("rac.member"))}c=e.get("rac.items"),e.get("rac.__items")===c&&void 0!==e.get("rac._items")||(Array.isArray(c)?e.set("rac._items",c):"function"==typeof c?e.set("rac._items",c):"object"==typeof c&&"function"==typeof c.then?c.then(function(t){e.set("rac._items",t),r()}):e.set("rac._items",[]),e.set("rac.__items",e.get("rac.items"))),i&&"rac.display"===a&&e.get("rac.limit")&&!i.contains(document.activeElement)&&l(),r()}function l(){var t=e.get("rac._display");if("function"==typeof t){var n=t(e.get("rac.value"));e.set("rac.display",n),e.set("rac.tempDisplay",n)}}function c(t){(t.items&&e.link(t.items,"rac.items"),t.value&&e.link(t.value,"rac._value"),t.selected&&e.link(t.selected,"rac.selected"),t["display-value"]&&e.link(t["display-value"],"rac.display"),"display"in t&&e.set("rac.displayprop",t.display),"member"in t&&e.set("rac.member",t.member),"offsets"in t?(e.set("rac.offsets",t.offsets),e.set("rac.fit",!("fit"in t)||t.fit)):e.set("rac.fit","fit"in t&&t.fit),e.set("rac.limit",t["limit-set"]),e.get("rac.limit")&&e.get("input"))&&(e.get("input")!==document.activeElement&&l());a()}e.aliasLocal("rac"),e.set("rac.list",[]),e.set("rac.popped",!1),e.set("rac.stash",function(){e.set("rac.tempDisplay",e.get("rac.display")),e.set("rac.tempValue",e.get("rac.value"))}),e.set("rac.key",function(t){var n=t.which;if(27===n)e.set("rac.popped",!1),e.set("rac.display",e.get("rac.tempDisplay")),e.set("rac.value",e.get("rac.tempValue"));else if(38===n||40===n){t.preventDefault(),e.get("rac.pop").show(e.find("input"));var i=e.get("rac.selected"),o=e.get("rac.list");38===n?i<=0||null==i?e.set("rac.selected",Array.isArray(o)?o.length-1:0):e.set("rac.selected",i-1):Array.isArray(o)?e.set("rac.selected",i<o.length-1?i+1:0):e.set("rac.selected",0)}else if(10===n||13===n){var r=e.get("rac.list");Array.isArray(r)&&e.set("rac.value",r[e.get("rac.selected")])}else 9===n&&(e.set("rac.popped",!1),e.get("rac.updateDisplay")())}),e.set("rac.input",function(t){n&&clearTimeout(n),n=setTimeout(function(){n=null,r(t.target.value);var i=e.find("input");i&&document.activeElement===i&&e.get("rac.pop").show(i)},500),e.set("rac.display",t.target.value)}),e.setTemplate(_),e.set("rac.updateDisplay",function(t){setTimeout(function(){i&&e.get("rac.limit")&&!i.contains(document.activeElement)&&l()},140)}),c(e.attributes);var s={init:!1,defer:!0},p=[e.observe("rac.displayprop",a,s),e.observe("rac.memberprop",a,s),e.observe("rac.items",a,s),e.observe("rac.list",function(t){Array.isArray(t)?e.set("rac.selected",t.indexOf(e.get("rac.value"))):e.set("rac.selected",-1)},s),e.observe("rac.value",function(t){l(),function(){if(!e.get("rac._value")||e.get("rac.value")){var t=e.get("rac._member");if("function"==typeof t){var n=t(e.get("rac.value"));e.set("rac._value",n)}e.ractive.getContext(e.find("input")).raise("selected",{},e.get("rac._value"),e.get("rac.display"))}}(),e.set("rac.popped",!1),e.set("rac.tempValue",t)}),e.observe("rac._value",function(t){var n=e.get("rac._member"),i=e.get("rac.list").find(function(e){return n(e)===t});i!==e.get("rac.value")&&e.set("rac.value",i)}),e.observe("rac.selected",function(){o&&clearTimeout(n),o=setTimeout(function(){o=null;var t=e.find(".rac-hover");t&&t.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})},14)})];return{teardown:function(){e.unlink("rac.items"),e.unlink("rac._value"),e.unlink("rac.selected"),e.unlink("rac.display"),p.forEach(function(e){return e.cancel()})},update:c,render:function(){i=e.find("span")}}},{attributes:["items","selected","display","value","member","limit-set","fit","offsets","display-value"],css:function(e){return[function(e){var t=Object.assign({},e("raui.primary"),e("raui.autocomplete"),e("raui.autocomplete.primary")),n=Object.assign({},e("raui.autocomplete.drop"),e("raui.autocomplete.primary.drop"));return".rautocomplete {\n position: relative;\n display: inline-block;\n }\n \n .rac-drop {\n width: 2em;\n height: 100%;\n position: absolute;\n top: 0;\n right: 2px;\n cursor: pointer;\n }\n .rac-drop:after {\n font-family: "+(n.font||"sans-serif")+";\n content: "+(n.string||"'▾'")+";\n position: absolute;\n top: calc(50% - 0.5em);\n height: 1em;\n line-height: 1em;\n width: 100%;\n text-align: center;\n font-weight: "+(n.weight||"normal")+";\n color: "+(n.color||t.bc||"#ccc")+";\n }\n \n .rac-pop {\n min-width: 100%;\n }\n \n .rac-pop > .rpop {\n padding: 0;\n }\n \n .rac-list {\n display: flex;\n flex-direction: column;\n max-height: 50vh;\n min-height: 2.125em;\n max-width: 100%;\n overflow: auto;\n }\n \n .rac-item {\n color: "+(t.fg||"#222")+";\n background-color: "+(t.bg||"#fff")+";\n padding: 0.25em;\n cursor: pointer;\n }\n \n .rac-selected {\n color: "+(t.bg||"#fff")+";\n background-color: "+(t.fga||"#07e")+";\n }\n \n .rac-hover {\n color: "+(t.fg||"#222")+";\n background-color: "+(t.bc||"#ccc")+";\n }\n \n .rac-selected.rac-hover {\n background-color: "+(t.bc||"#ccc")+";\n color: "+(t.fga||"#07e")+";\n }\n \n .rac-invalid {\n cursor: not-allowed;\n }\n \n input.rac-modal {\n width: 100%;\n box-sizing: border-box;\n }"}.call(this,e)].join(" ")},cssId:"rautocomplete",noCssTransform:!0});function T(e){return void 0===e&&(e={}),function(t){var n=t.instance;n.partials[e.name||"autocomplete"]=O,n.components["rac-pop"]=u,n.decorators.autocompletefocus=w}}e.Autocomplete=O,e.FieldType=function(e){return void 0===e&&(e={}),function(t,n,i){return[{t:7,e:e.name||"autocomplete",m:t,f:n}]}},e.plugin=T,e.default=T,Object.defineProperty(e,"__esModule",{value:!0})}); |
Sorry, the diff of this file is not supported yet
2706040
30175