UNPKG

@duetds/components

Version:

This package includes Duet Core Components and related tools.

1 lines 9.39 kB
var __awaiter=this&&this.__awaiter||function(e,t,n,i){function r(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,u){function c(e){try{s(i.next(e))}catch(t){u(t)}}function o(e){try{s(i["throw"](e))}catch(t){u(t)}}function s(e){e.done?n(e.value):r(e.value).then(c,o)}s((i=i.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var n={label:0,sent:function(){if(u[0]&1)throw u[1];return u[1]},trys:[],ops:[]},i,r,u,c;return c={next:o(0),throw:o(1),return:o(2)},typeof Symbol==="function"&&(c[Symbol.iterator]=function(){return this}),c;function o(e){return function(t){return s([e,t])}}function s(c){if(i)throw new TypeError("Generator is already executing.");while(n)try{if(i=1,r&&(u=c[0]&2?r["return"]:c[0]?r["throw"]||((u=r["return"])&&u.call(r),0):r.next)&&!(u=u.call(r,c[1])).done)return u;if(r=0,u)c=[c[0]&2,u.value];switch(c[0]){case 0:case 1:u=c;break;case 4:n.label++;return{value:c[1],done:false};case 5:n.label++;r=c[1];c=[0];continue;case 7:c=n.ops.pop();n.trys.pop();continue;default:if(!(u=n.trys,u=u.length>0&&u[u.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!u||c[1]>u[0]&&c[1]<u[3])){n.label=c[1];break}if(c[0]===6&&n.label<u[1]){n.label=u[1];u=c;break}if(u&&n.label<u[2]){n.label=u[2];n.ops.push(c);break}if(u[2])n.ops.pop();n.trys.pop();continue}c=t.call(e,n)}catch(o){c=[6,o];r=0}finally{i=u=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:true}}};System.register(["./p-2c514bc6.system.js","./p-e008225b.system.js"],(function(e){"use strict";var t,n,i,r,u,c;return{setters:[function(e){t=e.r;n=e.d;i=e.h;r=e.H;u=e.c},function(e){c=e.a}],execute:function(){var o=e("duet_checkbox",function(){function e(e){var i=this;t(this,e);this.checkboxId=c("DuetCheckbox");this.margin="auto";this.required=false;this.theme="";this.disabled=false;this.label="label";this.checked=false;this.onClick=function(e){e.preventDefault();i.setFocus();i.checked=!i.checked};this.onFocus=function(){i.duetFocus.emit()};this.onBlur=function(){i.duetBlur.emit()};this.duetChange=n(this,"duetChange",3);this.duetFocus=n(this,"duetFocus",7);this.duetBlur=n(this,"duetBlur",7)}e.prototype.checkedChanged=function(e){this.duetChange.emit({checked:e,value:this.value,component:"duet-checkbox"})};e.prototype.componentWillLoad=function(){if(this.value===undefined){this.value=this.identifier}if(this.theme!=="default"&&document.documentElement.classList.contains("duet-theme-turva")){this.theme="turva"}};e.prototype.setFocus=function(){return __awaiter(this,void 0,void 0,(function(){var e;return __generator(this,(function(t){e=this.element.querySelector("input");if(e){e.focus()}return[2]}))}))};e.prototype.render=function(){var e=this.identifier||this.checkboxId;return i(r,{onClick:this.onClick,class:{"duet-m-0":this.margin==="none"}},i("div",{class:{"duet-checkbox-container":true,"duet-theme-turva":this.theme==="turva"}},i("input",{type:"checkbox",onFocus:this.onFocus,onBlur:this.onBlur,value:this.value,class:{"duet-checkbox":true,disabled:this.disabled},checked:this.checked,disabled:this.disabled,"aria-controls":this.accessibleControls,"aria-active-descendant":this.accessibleActiveDescendant,"aria-owns":this.accessibleOwns,required:this.required,role:this.role,name:this.name,id:e}),i("label",{class:"duet-label",htmlFor:e},i("span",null,this.label))))};Object.defineProperty(e.prototype,"element",{get:function(){return u(this)},enumerable:true,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{checked:["checkedChanged"]}},enumerable:true,configurable:true});Object.defineProperty(e,"style",{get:function(){return".sc-duet-checkbox-h{-webkit-appearance:none;-moz-appearance:none;appearance:none;-webkit-box-sizing:border-box;box-sizing:border-box;background:transparent;border:0;padding:0;margin:0;margin-right:8px!important;margin-bottom:12px!important;-webkit-tap-highlight-color:transparent;display:-ms-inline-flexbox;display:inline-flex;vertical-align:bottom;width:100%}.sc-duet-checkbox-h:last-child, .sc-duet-checkbox-h:last-of-type{margin-right:0!important}.duet-m-0.sc-duet-checkbox-h{margin:0!important}.duet-label.sc-duet-checkbox{-webkit-appearance:none;-moz-appearance:none;appearance:none;-webkit-box-sizing:border-box;box-sizing:border-box;border:0;padding:0;margin:0;margin-bottom:12px!important;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-family:localtapiola-sans,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol;font-size:1rem;background:transparent;color:#00294d;font-weight:400;line-height:1.25;-webkit-transition:.3s ease;transition:.3s ease;z-index:100;position:relative;cursor:pointer;display:inline;vertical-align:top}.duet-label.duet-p-0.sc-duet-checkbox{padding:0!important}.duet-label.duet-m-0.sc-duet-checkbox{margin:0!important}.duet-theme-turva.sc-duet-checkbox .duet-label.sc-duet-checkbox{color:#111;font-family:turva-sans,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol}.duet-label.sc-duet-checkbox span.sc-duet-checkbox{-webkit-appearance:none;-moz-appearance:none;appearance:none;-webkit-box-sizing:border-box;box-sizing:border-box;background:transparent;border:0;padding:0;margin:0;display:inline-block;vertical-align:top;width:calc(100% - 32px)}.duet-label-hidden.sc-duet-checkbox .duet-label.sc-duet-checkbox{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.duet-checkbox.sc-duet-checkbox{padding:0;padding:14px!important;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;position:absolute;opacity:0;z-index:2;left:0;top:0;cursor:pointer}.duet-checkbox.sc-duet-checkbox, .duet-checkbox-container.sc-duet-checkbox{-webkit-appearance:none;-moz-appearance:none;appearance:none;-webkit-box-sizing:border-box;box-sizing:border-box;background:transparent;border:0;margin:0;width:100%;height:100%}.duet-checkbox-container.sc-duet-checkbox{padding:0;margin-top:4px!important;position:relative}.duet-checkbox.sc-duet-checkbox + label.sc-duet-checkbox:before{-webkit-appearance:none;-moz-appearance:none;appearance:none;-webkit-box-sizing:border-box;box-sizing:border-box;background:transparent;border:0;padding:0;margin:0;content:\"\";display:inline-block;vertical-align:top;z-index:100;width:20px;height:20px;border-radius:4px;background:#fff;margin:0 10px 1px 1px;border:1px solid #00294d}.duet-theme-turva.sc-duet-checkbox .duet-checkbox.sc-duet-checkbox + label.sc-duet-checkbox:before{border-color:#111}.duet-checkbox.sc-duet-checkbox:checked + label.sc-duet-checkbox:before{background:#00294d;border:1px solid #00294d}.duet-theme-turva.sc-duet-checkbox .duet-checkbox.sc-duet-checkbox:checked + label.sc-duet-checkbox:before{background:#111;border-color:#111}.user-is-tabbing.sc-duet-checkbox-h .duet-checkbox.sc-duet-checkbox:focus + label.sc-duet-checkbox:before{outline:1px dotted #0077b3;outline:5px auto -webkit-focus-ring-color}.duet-checkbox.sc-duet-checkbox + label.sc-duet-checkbox{position:static}.duet-checkbox.sc-duet-checkbox:checked + label.sc-duet-checkbox:after{-webkit-appearance:none;-moz-appearance:none;appearance:none;-webkit-box-sizing:border-box;box-sizing:border-box;background:transparent;border:0;padding:0;margin:0;content:\"\";position:absolute;left:5px;top:4px;z-index:200;background:transparent url(\"data:image/svg+xml,%3Csvg%20fill%3D%27white%27%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20width%3D%2724%27%20height%3D%2724%27%20viewBox%3D%270%200%2024%2024%27%3E%3Cpath%20d%3D%27M23.374.287a1.5%2C1.5%2C0%2C0%2C0-2.093.345L7.246%2C20.2%2C2.561%2C15.511A1.5%2C1.5%2C0%2C1%2C0%2C.439%2C17.632l5.935%2C5.934a1.525%2C1.525%2C0%2C0%2C0%2C2.279-.186l15.066-21A1.5%2C1.5%2C0%2C0%2C0%2C23.374.287Z%27%20%2F%3E%3C%2Fsvg%3E\") no-repeat 0 0;background-size:100% auto;width:12px;height:12px}.duet-theme-turva.sc-duet-checkbox .duet-checkbox.sc-duet-checkbox:checked + label.sc-duet-checkbox:after{top:3px}.duet-checkbox.disabled.sc-duet-checkbox + label.sc-duet-checkbox, .duet-checkbox[disabled].sc-duet-checkbox + label.sc-duet-checkbox{cursor:not-allowed;color:#657787}.duet-theme-turva.sc-duet-checkbox .duet-checkbox.disabled.sc-duet-checkbox + label.sc-duet-checkbox, .duet-theme-turva.sc-duet-checkbox .duet-checkbox[disabled].sc-duet-checkbox + label.sc-duet-checkbox{color:#757575}.duet-checkbox.disabled.sc-duet-checkbox + label.sc-duet-checkbox:before, .duet-checkbox[disabled].sc-duet-checkbox + label.sc-duet-checkbox:before{border-color:#cfd2d4}.duet-theme-turva.sc-duet-checkbox .duet-checkbox.disabled.sc-duet-checkbox + label.sc-duet-checkbox:before, .duet-theme-turva.sc-duet-checkbox .duet-checkbox[disabled].sc-duet-checkbox + label.sc-duet-checkbox:before{border-color:#d1d1d1}.duet-checkbox.disabled.sc-duet-checkbox:checked + label.sc-duet-checkbox:before, .duet-checkbox[disabled].sc-duet-checkbox:checked + label.sc-duet-checkbox:before{background:#657787;border:1px solid #657787}.duet-theme-turva.sc-duet-checkbox .duet-checkbox.disabled.sc-duet-checkbox:checked + label.sc-duet-checkbox:before, .duet-theme-turva.sc-duet-checkbox .duet-checkbox[disabled].sc-duet-checkbox:checked + label.sc-duet-checkbox:before{border-color:#757575;background:#757575}"},enumerable:true,configurable:true});return e}())}}}));