@aquera/nile-elements 0.0.18 → 0.0.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-content-editor/nile-content-editor.css.js +4 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-content-editor/nile-content-editor.css.js.map +1 -1
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-content-editor/nile-content-editor.d.ts +1 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-content-editor/nile-content-editor.js +25 -10
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-content-editor/nile-content-editor.js.map +1 -1
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-radio-group/nile-radio-group.js +1 -1
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-radio-group/nile-radio-group.js.map +1 -1
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-switcher/nile-switcher.css.js +9 -6
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-switcher/nile-switcher.css.js.map +1 -1
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-switcher/nile-switcher.d.ts +1 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-switcher/nile-switcher.js +9 -3
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-switcher/nile-switcher.js.map +1 -1
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/index.iife.js +26 -14
- package/dist/nile-content-editor/nile-content-editor.cjs.js +1 -1
- package/dist/nile-content-editor/nile-content-editor.cjs.js.map +1 -1
- package/dist/nile-content-editor/nile-content-editor.css.cjs.js +1 -1
- package/dist/nile-content-editor/nile-content-editor.css.cjs.js.map +1 -1
- package/dist/nile-content-editor/nile-content-editor.css.esm.js +4 -0
- package/dist/nile-content-editor/nile-content-editor.esm.js +7 -7
- package/dist/nile-radio-group/nile-radio-group.cjs.js +1 -1
- package/dist/nile-radio-group/nile-radio-group.cjs.js.map +1 -1
- package/dist/nile-radio-group/nile-radio-group.esm.js +1 -1
- package/dist/nile-switcher/nile-switcher.cjs.js +1 -1
- package/dist/nile-switcher/nile-switcher.cjs.js.map +1 -1
- package/dist/nile-switcher/nile-switcher.css.cjs.js +1 -1
- package/dist/nile-switcher/nile-switcher.css.cjs.js.map +1 -1
- package/dist/nile-switcher/nile-switcher.css.esm.js +11 -8
- package/dist/nile-switcher/nile-switcher.esm.js +26 -21
- package/dist/src/nile-content-editor/nile-content-editor.css.js +4 -0
- package/dist/src/nile-content-editor/nile-content-editor.css.js.map +1 -1
- package/dist/src/nile-content-editor/nile-content-editor.d.ts +1 -0
- package/dist/src/nile-content-editor/nile-content-editor.js +25 -10
- package/dist/src/nile-content-editor/nile-content-editor.js.map +1 -1
- package/dist/src/nile-radio-group/nile-radio-group.js +1 -1
- package/dist/src/nile-radio-group/nile-radio-group.js.map +1 -1
- package/dist/src/nile-switcher/nile-switcher.css.js +9 -6
- package/dist/src/nile-switcher/nile-switcher.css.js.map +1 -1
- package/dist/src/nile-switcher/nile-switcher.d.ts +1 -0
- package/dist/src/nile-switcher/nile-switcher.js +9 -3
- package/dist/src/nile-switcher/nile-switcher.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/nile-content-editor/nile-content-editor.css.ts +4 -0
- package/src/nile-content-editor/nile-content-editor.ts +24 -10
- package/src/nile-radio-group/nile-radio-group.ts +1 -1
- package/src/nile-switcher/nile-switcher.css.ts +9 -6
- package/src/nile-switcher/nile-switcher.ts +10 -2
@@ -1,2 +1,2 @@
|
|
1
|
-
System.register(["tslib","lit/directives/class-map.js","lit/decorators.js","../internal/slot.cjs.js","lit","../internal/watch.cjs.js","../internal/nile-element.cjs.js","./nile-radio-group.css.cjs.js"],function(_export,_context){"use strict";var t,i,e,s,l,o,r,a,n,h,d,_templateObject,_templateObject2,_templateObject3,_templateObject4,_templateObject5,_templateObject6,_templateObject7,c;function _taggedTemplateLiteral(strings,raw){if(!raw){raw=strings.slice(0);}return Object.freeze(Object.defineProperties(strings,{raw:{value:Object.freeze(raw)}}));}function _toConsumableArray(arr){return _arrayWithoutHoles(arr)||_iterableToArray(arr)||_unsupportedIterableToArray(arr)||_nonIterableSpread();}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(o,minLen){if(!o)return;if(typeof o==="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(o);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen);}function _iterableToArray(iter){if(typeof Symbol!=="undefined"&&iter[Symbol.iterator]!=null||iter["@@iterator"]!=null)return Array.from(iter);}function _arrayWithoutHoles(arr){if(Array.isArray(arr))return _arrayLikeToArray(arr);}function _arrayLikeToArray(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2;}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,_toPropertyKey(descriptor.key),descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);Object.defineProperty(Constructor,"prototype",{writable:false});return Constructor;}function _toPropertyKey(arg){var key=_toPrimitive(arg,"string");return typeof key==="symbol"?key:String(key);}function _toPrimitive(input,hint){if(typeof input!=="object"||input===null)return input;var prim=input[Symbol.toPrimitive];if(prim!==undefined){var res=prim.call(input,hint||"default");if(typeof res!=="object")return res;throw new TypeError("@@toPrimitive must return a primitive value.");}return(hint==="string"?String:Number)(input);}function _get(){if(typeof Reflect!=="undefined"&&Reflect.get){_get=Reflect.get.bind();}else{_get=function _get(target,property,receiver){var base=_superPropBase(target,property);if(!base)return;var desc=Object.getOwnPropertyDescriptor(base,property);if(desc.get){return desc.get.call(arguments.length<3?target:receiver);}return desc.value;};}return _get.apply(this,arguments);}function _superPropBase(object,property){while(!Object.prototype.hasOwnProperty.call(object,property)){object=_getPrototypeOf(object);if(object===null)break;}return object;}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});Object.defineProperty(subClass,"prototype",{writable:false});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function _createSuperInternal(){var Super=_getPrototypeOf(Derived),result;if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget);}else{result=Super.apply(this,arguments);}return _possibleConstructorReturn(this,result);};}function _possibleConstructorReturn(self,call){if(call&&(typeof call==="object"||typeof call==="function")){return call;}else if(call!==void 0){throw new TypeError("Derived constructors may only return object or undefined");}return _assertThisInitialized(self);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true;}catch(e){return false;}}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}return{setters:[function(_tslib){t=_tslib.__decorate;},function(_litDirectivesClassMapJs){i=_litDirectivesClassMapJs.classMap;},function(_litDecoratorsJs){e=_litDecoratorsJs.query;s=_litDecoratorsJs.state;l=_litDecoratorsJs.property;o=_litDecoratorsJs.customElement;},function(_internalSlotCjsJs){r=_internalSlotCjsJs.H;},function(_lit){a=_lit.html;},function(_internalWatchCjsJs){n=_internalWatchCjsJs.w;},function(_internalNileElementCjsJs){h=_internalNileElementCjsJs.N;},function(_nileRadioGroupCssCjsJs){d=_nileRadioGroupCssCjsJs.s;}],execute:function(){_export("N",c=/*#__PURE__*/function(_h){_inherits(c,_h);var _super=_createSuper(c);function c(){var _this;_classCallCheck(this,c);_this=_super.apply(this,arguments),_this.hasSlotController=new r(_assertThisInitialized(_this),"help-text","label"),_this.customValidityMessage="",_this.hasButtonGroup=!1,_this.defaultValue="",_this.label="",_this.name="option",_this.value="",_this.form="",_this.required=!1,_this.labelInline=!1,_this.disabled=!1,_this.helpText="",_this.errorMessage="";return _this;}_createClass(c,[{key:"connectedCallback",value:function connectedCallback(){_get(_getPrototypeOf(c.prototype),"connectedCallback",this).call(this),this.defaultValue=this.value,this.handleInitialDisabledState(),this.emit("nile-init");}},{key:"disconnectedCallback",value:function disconnectedCallback(){_get(_getPrototypeOf(c.prototype),"disconnectedCallback",this).call(this),this.emit("nile-destroy");}},{key:"getAllRadios",value:function getAllRadios(){return _toConsumableArray(this.querySelectorAll("nile-radio"));}},{key:"handleRadioClick",value:function handleRadioClick(t){var i=t.target.closest("nile-radio"),e=this.getAllRadios(),s=this.value;i.disabled||this.disabled||(this.value=i.value,e.forEach(function(t){return t.checked=t===i;}),this.value!==s&&(this.emit("change",{value:this.value}),this.emit("input")));}},{key:"handleDisabledChange",value:function handleDisabledChange(){var _this2=this;this.getAllRadios().forEach(function(t){t.disabled=_this2.disabled;});}},{key:"handleInitialDisabledState",value:function handleInitialDisabledState(){var _this3=this;this.getAllRadios().forEach(function(t){t.disabled=t.hasAttribute("disabled")?t.disabled:_this3.disabled;});}},{key:"handleKeyDown",value:function handleKeyDown(t){var _i$find,_this4=this;if(!["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"," "].includes(t.key))return;var i=this.getAllRadios().filter(function(t){return!t.disabled;}),e=(_i$find=i.find(function(t){return t.checked;}))!==null&&_i$find!==void 0?_i$find:i[0],s=" "===t.key?0:["ArrowUp","ArrowLeft"].includes(t.key)?-1:1,l=this.value;var o=i.indexOf(e)+s;o<0&&(o=i.length-1),o>i.length-1&&(o=0),this.getAllRadios().forEach(function(t){t.checked=!1,_this4.hasButtonGroup||(t.tabIndex=-1);}),this.value=i[o].value,i[o].checked=!0,this.hasButtonGroup?i[o].shadowRoot.querySelector("button").focus():(i[o].tabIndex=0,i[o].focus()),this.value!==l&&(this.emit("change"),this.emit("input")),t.preventDefault();}},{key:"handleLabelClick",value:function handleLabelClick(){var t=this.getAllRadios(),i=t.find(function(t){return t.checked;})||t[0];i&&i.focus();}},{key:"handleSlotChange",value:function handleSlotChange(){var _this5=this,_this$shadowRoot;var t=this.getAllRadios();if(t.forEach(function(t){return t.checked=t.value===_this5.value;}),this.hasButtonGroup=t.some(function(t){return"nile-radio-button"===t.tagName.toLowerCase();}),!t.some(function(t){return t.checked;}))if(this.hasButtonGroup){t[0].shadowRoot.querySelector("button").tabIndex=0;}else t[0].tabIndex=0;this.hasButtonGroup&&((_this$shadowRoot=this.shadowRoot)===null||_this$shadowRoot===void 0?void 0:_this$shadowRoot.querySelector("nile-button-group"));}},{key:"updateCheckedRadio",value:function updateCheckedRadio(){var _this6=this;this.getAllRadios().forEach(function(t){return t.checked=t.value===_this6.value;});}},{key:"handleValueChange",value:function handleValueChange(){this.hasUpdated&&this.updateCheckedRadio();}},{key:"render",value:function render(){var t=this.hasSlotController.test("label");this.hasSlotController.test("help-text");var e=this.hasSlotController.test("label-suffix"),s=!!this.label||!!t,l=!!this.helpText,o=!!this.errorMessage,r=a(_templateObject||(_templateObject=_taggedTemplateLiteral(["\n <slot\n @click=","\n @keydown=","\n @slotchange=","\n role=\"presentation\"\n ></slot>\n "])),this.handleRadioClick,this.handleKeyDown,this.handleSlotChange);return a(_templateObject2||(_templateObject2=_taggedTemplateLiteral(["\n <fieldset\n part=\"form-control\"\n class=","\n role=\"radiogroup\"\n aria-labelledby=\"label\"\n aria-describedby=\"help-text\"\n aria-errormessage=\"error-message\"\n >\n <label\n part=\"form-control-label\"\n id=\"label\"\n class=\"form-control__label\"\n aria-hidden=","\n @click=","\n >\n <slot name=\"label\">","</slot>\n </label>\n\n ","\n\n <div part=\"form-control-input\" class=\"form-control-input\">\n <div class=\"visually-hidden\">\n <label class=\"radio-group__validation\">\n <input\n type=\"text\"\n class=\"radio-group__validation-input\"\n ?required=","\n tabindex=\"-1\"\n hidden\n />\n </label>\n </div>\n\n ","\n </div>\n\n ","\n\n ","\n\n </fieldset>\n "])),i({"form-control":!0,"form-control--medium":!0,"form-control--radio-group":!0,"form-control--has-label":s,"form-control--has-help-text":l}),s?"false":"true",this.handleLabelClick,this.label,e?a(_templateObject3||(_templateObject3=_taggedTemplateLiteral([" <slot name=\"label-suffix\"></slot> "]))):"",this.required,this.hasButtonGroup?a(_templateObject4||(_templateObject4=_taggedTemplateLiteral(["\n ","\n "])),r):a(_templateObject5||(_templateObject5=_taggedTemplateLiteral(["\n <div class=\"","\"> ","</div> "])),this.labelInline?"form-control--inline-radio":"",r),l?a(_templateObject6||(_templateObject6=_taggedTemplateLiteral(["\n <nile-form-help-text>","</nile-form-help-text>\n "])),this.helpText):"",o?a(_templateObject7||(_templateObject7=_taggedTemplateLiteral(["\n <nile-form-error-message\n >","</nile-form-error-message\n >\n "])),this.errorMessage):"");}}]);return c;}(h));c.styles=d,t([e("slot:not([name])")],c.prototype,"defaultSlot",void 0),t([s()],c.prototype,"hasButtonGroup",void 0),t([s()],c.prototype,"defaultValue",void 0),t([l()],c.prototype,"label",void 0),t([l()],c.prototype,"name",void 0),t([l({reflect:!0})],c.prototype,"value",void 0),t([l({reflect:!0})],c.prototype,"form",void 0),t([l({type:Boolean,reflect:!0})],c.prototype,"required",void 0),t([l({type:Boolean,reflect:!0})],c.prototype,"labelInline",void 0),t([l({type:Boolean,reflect:!0})],c.prototype,"disabled",void 0),t([l({attribute:"help-text"})],c.prototype,"helpText",void 0),t([l({attribute:"error-message"})],c.prototype,"errorMessage",void 0),t([n("disabled",{waitUntilFirstUpdate:!0})],c.prototype,"handleDisabledChange",null),t([n("value")],c.prototype,"handleValueChange",null),_export("N",c=t([o("nile-radio-group")],c));}};});
|
1
|
+
System.register(["tslib","lit/directives/class-map.js","lit/decorators.js","../internal/slot.cjs.js","lit","../internal/watch.cjs.js","../internal/nile-element.cjs.js","./nile-radio-group.css.cjs.js"],function(_export,_context){"use strict";var t,i,e,s,l,o,r,a,n,h,d,_templateObject,_templateObject2,_templateObject3,_templateObject4,_templateObject5,_templateObject6,_templateObject7,c;function _taggedTemplateLiteral(strings,raw){if(!raw){raw=strings.slice(0);}return Object.freeze(Object.defineProperties(strings,{raw:{value:Object.freeze(raw)}}));}function _toConsumableArray(arr){return _arrayWithoutHoles(arr)||_iterableToArray(arr)||_unsupportedIterableToArray(arr)||_nonIterableSpread();}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(o,minLen){if(!o)return;if(typeof o==="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(o);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen);}function _iterableToArray(iter){if(typeof Symbol!=="undefined"&&iter[Symbol.iterator]!=null||iter["@@iterator"]!=null)return Array.from(iter);}function _arrayWithoutHoles(arr){if(Array.isArray(arr))return _arrayLikeToArray(arr);}function _arrayLikeToArray(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2;}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,_toPropertyKey(descriptor.key),descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);Object.defineProperty(Constructor,"prototype",{writable:false});return Constructor;}function _toPropertyKey(arg){var key=_toPrimitive(arg,"string");return typeof key==="symbol"?key:String(key);}function _toPrimitive(input,hint){if(typeof input!=="object"||input===null)return input;var prim=input[Symbol.toPrimitive];if(prim!==undefined){var res=prim.call(input,hint||"default");if(typeof res!=="object")return res;throw new TypeError("@@toPrimitive must return a primitive value.");}return(hint==="string"?String:Number)(input);}function _get(){if(typeof Reflect!=="undefined"&&Reflect.get){_get=Reflect.get.bind();}else{_get=function _get(target,property,receiver){var base=_superPropBase(target,property);if(!base)return;var desc=Object.getOwnPropertyDescriptor(base,property);if(desc.get){return desc.get.call(arguments.length<3?target:receiver);}return desc.value;};}return _get.apply(this,arguments);}function _superPropBase(object,property){while(!Object.prototype.hasOwnProperty.call(object,property)){object=_getPrototypeOf(object);if(object===null)break;}return object;}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});Object.defineProperty(subClass,"prototype",{writable:false});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function _createSuperInternal(){var Super=_getPrototypeOf(Derived),result;if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget);}else{result=Super.apply(this,arguments);}return _possibleConstructorReturn(this,result);};}function _possibleConstructorReturn(self,call){if(call&&(typeof call==="object"||typeof call==="function")){return call;}else if(call!==void 0){throw new TypeError("Derived constructors may only return object or undefined");}return _assertThisInitialized(self);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true;}catch(e){return false;}}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}return{setters:[function(_tslib){t=_tslib.__decorate;},function(_litDirectivesClassMapJs){i=_litDirectivesClassMapJs.classMap;},function(_litDecoratorsJs){e=_litDecoratorsJs.query;s=_litDecoratorsJs.state;l=_litDecoratorsJs.property;o=_litDecoratorsJs.customElement;},function(_internalSlotCjsJs){r=_internalSlotCjsJs.H;},function(_lit){a=_lit.html;},function(_internalWatchCjsJs){n=_internalWatchCjsJs.w;},function(_internalNileElementCjsJs){h=_internalNileElementCjsJs.N;},function(_nileRadioGroupCssCjsJs){d=_nileRadioGroupCssCjsJs.s;}],execute:function(){_export("N",c=/*#__PURE__*/function(_h){_inherits(c,_h);var _super=_createSuper(c);function c(){var _this;_classCallCheck(this,c);_this=_super.apply(this,arguments),_this.hasSlotController=new r(_assertThisInitialized(_this),"help-text","label"),_this.customValidityMessage="",_this.hasButtonGroup=!1,_this.defaultValue="",_this.label="",_this.name="option",_this.value="",_this.form="",_this.required=!1,_this.labelInline=!1,_this.disabled=!1,_this.helpText="",_this.errorMessage="";return _this;}_createClass(c,[{key:"connectedCallback",value:function connectedCallback(){_get(_getPrototypeOf(c.prototype),"connectedCallback",this).call(this),this.defaultValue=this.value,this.handleInitialDisabledState(),this.emit("nile-init");}},{key:"disconnectedCallback",value:function disconnectedCallback(){_get(_getPrototypeOf(c.prototype),"disconnectedCallback",this).call(this),this.emit("nile-destroy");}},{key:"getAllRadios",value:function getAllRadios(){return _toConsumableArray(this.querySelectorAll("nile-radio"));}},{key:"handleRadioClick",value:function handleRadioClick(t){var i=t.target.closest("nile-radio"),e=this.getAllRadios(),s=this.value;i.disabled||this.disabled||(this.value=i.value,e.forEach(function(t){return t.checked=t===i;}),this.value!==s&&(this.emit("change",{value:this.value}),this.emit("input")));}},{key:"handleDisabledChange",value:function handleDisabledChange(){var _this2=this;this.getAllRadios().forEach(function(t){t.disabled=_this2.disabled;});}},{key:"handleInitialDisabledState",value:function handleInitialDisabledState(){var _this3=this;this.getAllRadios().forEach(function(t){t.disabled=t.hasAttribute("disabled")?t.disabled:_this3.disabled;});}},{key:"handleKeyDown",value:function handleKeyDown(t){var _i$find,_this4=this;if(!["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"," "].includes(t.key))return;var i=this.getAllRadios().filter(function(t){return!t.disabled;}),e=(_i$find=i.find(function(t){return t.checked;}))!==null&&_i$find!==void 0?_i$find:i[0],s=" "===t.key?0:["ArrowUp","ArrowLeft"].includes(t.key)?-1:1,l=this.value;var o=i.indexOf(e)+s;o<0&&(o=i.length-1),o>i.length-1&&(o=0),this.getAllRadios().forEach(function(t){t.checked=!1,_this4.hasButtonGroup||(t.tabIndex=-1);}),this.value=i[o].value,i[o].checked=!0,this.hasButtonGroup?i[o].shadowRoot.querySelector("button").focus():(i[o].tabIndex=0,i[o].focus()),this.value!==l&&(this.emit("change"),this.emit("input")),t.preventDefault();}},{key:"handleLabelClick",value:function handleLabelClick(){var t=this.getAllRadios(),i=t.find(function(t){return t.checked;})||t[0];i&&i.focus();}},{key:"handleSlotChange",value:function handleSlotChange(){var _this5=this,_this$shadowRoot;var t=this.getAllRadios();if(t.forEach(function(t){return t.checked=t.value===_this5.value;}),this.hasButtonGroup=t.some(function(t){return"nile-radio-button"===t.tagName.toLowerCase();}),!t.some(function(t){return t.checked;}))if(this.hasButtonGroup){t[0].shadowRoot.querySelector("button").tabIndex=0;}else t[0].tabIndex=0;this.hasButtonGroup&&((_this$shadowRoot=this.shadowRoot)===null||_this$shadowRoot===void 0?void 0:_this$shadowRoot.querySelector("nile-button-group"));}},{key:"updateCheckedRadio",value:function updateCheckedRadio(){var _this6=this;this.getAllRadios().forEach(function(t){return t.checked=t.value===_this6.value;});}},{key:"handleValueChange",value:function handleValueChange(){this.hasUpdated&&this.updateCheckedRadio();}},{key:"render",value:function render(){var t=this.hasSlotController.test("label");this.hasSlotController.test("help-text");var e=this.hasSlotController.test("label-suffix"),s=!!this.label||!!t,l=!!this.helpText,o=!!this.errorMessage,r=a(_templateObject||(_templateObject=_taggedTemplateLiteral(["\n <slot\n @click=","\n @keydown=","\n @slotchange=","\n role=\"presentation\"\n ></slot>\n "])),this.handleRadioClick,this.handleKeyDown,this.handleSlotChange);return a(_templateObject2||(_templateObject2=_taggedTemplateLiteral(["\n <fieldset\n part=\"form-control\"\n class=","\n role=\"radiogroup\"\n aria-labelledby=\"label\"\n aria-describedby=\"help-text\"\n aria-errormessage=\"error-message\"\n >\n <label\n part=\"form-control-label\"\n id=\"label\"\n class=\"form-control__label\"\n aria-hidden=","\n @click=","\n >\n <slot name=\"label\">","</slot>\n </label>\n\n ","\n\n <div part=\"form-control-input\" class=\"form-control-input\">\n <div class=\"visually-hidden\">\n <label class=\"radio-group__validation\">\n <input\n type=\"text\"\n class=\"radio-group__validation-input\"\n ?required=","\n tabindex=\"-1\"\n hidden\n />\n </label>\n </div>\n\n ","\n </div>\n\n ","\n\n ","\n\n </fieldset>\n "])),i({"form-control":!0,"form-control--medium":!0,"form-control--radio-group":!0,"form-control--has-label":s,"form-control--has-help-text":l}),s?"false":"true",this.handleLabelClick,this.label,e?a(_templateObject3||(_templateObject3=_taggedTemplateLiteral([" <slot name=\"label-suffix\"></slot> "]))):"",this.required,this.hasButtonGroup?a(_templateObject4||(_templateObject4=_taggedTemplateLiteral(["\n ","\n "])),r):a(_templateObject5||(_templateObject5=_taggedTemplateLiteral(["\n <div part=\"options-base\" class=\"","\"> ","</div> "])),this.labelInline?"form-control--inline-radio":"",r),l?a(_templateObject6||(_templateObject6=_taggedTemplateLiteral(["\n <nile-form-help-text>","</nile-form-help-text>\n "])),this.helpText):"",o?a(_templateObject7||(_templateObject7=_taggedTemplateLiteral(["\n <nile-form-error-message\n >","</nile-form-error-message\n >\n "])),this.errorMessage):"");}}]);return c;}(h));c.styles=d,t([e("slot:not([name])")],c.prototype,"defaultSlot",void 0),t([s()],c.prototype,"hasButtonGroup",void 0),t([s()],c.prototype,"defaultValue",void 0),t([l()],c.prototype,"label",void 0),t([l()],c.prototype,"name",void 0),t([l({reflect:!0})],c.prototype,"value",void 0),t([l({reflect:!0})],c.prototype,"form",void 0),t([l({type:Boolean,reflect:!0})],c.prototype,"required",void 0),t([l({type:Boolean,reflect:!0})],c.prototype,"labelInline",void 0),t([l({type:Boolean,reflect:!0})],c.prototype,"disabled",void 0),t([l({attribute:"help-text"})],c.prototype,"helpText",void 0),t([l({attribute:"error-message"})],c.prototype,"errorMessage",void 0),t([n("disabled",{waitUntilFirstUpdate:!0})],c.prototype,"handleDisabledChange",null),t([n("value")],c.prototype,"handleValueChange",null),_export("N",c=t([o("nile-radio-group")],c));}};});
|
2
2
|
//# sourceMappingURL=nile-radio-group.cjs.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"nile-radio-group.cjs.js","sources":["../../../src/nile-radio-group/nile-radio-group.ts"],"sourcesContent":["\nimport { classMap } from 'lit/directives/class-map.js';\nimport { customElement, property, query, state } from 'lit/decorators.js';\nimport { HasSlotController } from '../internal/slot';\nimport { html } from 'lit';\nimport { watch } from '../internal/watch';\nimport NileElement from '../internal/nile-element';\nimport styles from './nile-radio-group.css';\nimport type { CSSResultGroup } from 'lit';\nimport type NileRadio from '../nile-radio/nile-radio';\n\n/**\n * @summary Radio groups are used to group multiple [radios](/components/radio) or [radio buttons](/components/radio-button) so they function as a single form control.\n *\n * @dependency nile-button-group\n *\n * @slot - The default slot where `<nile-radio>` or `<nile-radio-button>` elements are placed.\n * @slot label - The radio group's label. Required for proper accessibility. Alternatively, you can use the `label`\n * attribute.\n *\n * @event change - Emitted when the radio group's selected value changes.\n * @event input - Emitted when the radio group receives user input.\n * @event invalid - Emitted when the form control has been checked for validity and its constraints aren't satisfied.\n * @csspart button-group - The button group that wraps radio buttons.\n * @csspart button-group__base - The button group's `base` part.\n */\n@customElement('nile-radio-group')\nexport class NileRadioGroup extends NileElement {\n static styles: CSSResultGroup = styles;\n\n private readonly hasSlotController = new HasSlotController(this, 'help-text', 'label');\n private customValidityMessage = '';\n\n @query('slot:not([name])') defaultSlot: HTMLSlotElement;\n\n @state() private hasButtonGroup = false;\n\n @state() defaultValue = '';\n\n /**\n * The radio group's label. Required for proper accessibility. If you need to display HTML, use the `label` slot\n * instead.\n */\n @property() label = '';\n\n /** The name of the radio group, submitted as a name/value pair with form data. */\n @property() name = 'option';\n\n /** The current value of the radio group, submitted as a name/value pair with form data. */\n @property({ reflect: true }) value = '';\n\n /**\n * By default, form controls are associated with the nearest containing `<form>` element. This attribute allows you\n * to place the form control outside of a form and associate it with the form that has this `id`. The form must be in\n * the same document or shadow root for this to work.\n */\n @property({ reflect: true }) form = '';\n\n /** Ensures a child radio is checked before allowing the containing form to submit. */\n @property({ type: Boolean, reflect: true }) required = false;\n\n\n /** Used to show radio in inline or not */\n @property({ type: Boolean, reflect: true }) labelInline = false;\n\n /** Used to disabled or not */\n @property({ type: Boolean, reflect: true }) disabled = false;\n\n @property({ attribute: 'help-text' }) helpText = '';\n\n @property({ attribute: 'error-message' }) errorMessage = '';\n\n connectedCallback() {\n super.connectedCallback();\n this.defaultValue = this.value;\n this.handleInitialDisabledState();\n this.emit('nile-init');\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n this.emit('nile-destroy');\n }\n\n private getAllRadios() {\n return [...this.querySelectorAll<NileRadio>('nile-radio')];\n }\n\n private handleRadioClick(event: MouseEvent) {\n const target = (event.target as HTMLElement).closest<NileRadio>('nile-radio')!;\n const radios = this.getAllRadios();\n const oldValue = this.value;\n\n if (target.disabled || this.disabled) {\n return;\n }\n\n this.value = target.value;\n radios.forEach(radio => (radio.checked = radio === target));\n\n if (this.value !== oldValue) {\n this.emit('change',{value: this.value });\n this.emit('input');\n }\n }\n\n @watch('disabled', { waitUntilFirstUpdate: true })\n handleDisabledChange() {\n this.getAllRadios().forEach(radio => {\n radio.disabled = this.disabled;\n });\n }\n\n private handleInitialDisabledState() {\n this.getAllRadios().forEach(radio => {\n radio.disabled = radio.hasAttribute('disabled') ? radio.disabled : this.disabled;\n });\n }\n\n private handleKeyDown(event: KeyboardEvent) {\n if (!['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight', ' '].includes(event.key)) {\n return;\n }\n\n const radios = this.getAllRadios().filter(radio => !radio.disabled);\n const checkedRadio = radios.find(radio => radio.checked) ?? radios[0];\n const incr = event.key === ' ' ? 0 : ['ArrowUp', 'ArrowLeft'].includes(event.key) ? -1 : 1;\n const oldValue = this.value;\n let index = radios.indexOf(checkedRadio) + incr;\n\n if (index < 0) {\n index = radios.length - 1;\n }\n\n if (index > radios.length - 1) {\n index = 0;\n }\n\n this.getAllRadios().forEach(radio => {\n radio.checked = false;\n\n if (!this.hasButtonGroup) {\n radio.tabIndex = -1;\n }\n });\n\n this.value = radios[index].value;\n radios[index].checked = true;\n\n if (!this.hasButtonGroup) {\n radios[index].tabIndex = 0;\n radios[index].focus();\n } else {\n radios[index].shadowRoot!.querySelector('button')!.focus();\n }\n\n if (this.value !== oldValue) {\n this.emit('change');\n this.emit('input');\n }\n\n event.preventDefault();\n }\n\n private handleLabelClick() {\n const radios = this.getAllRadios();\n const checked = radios.find(radio => radio.checked);\n const radioToFocus = checked || radios[0];\n\n // Move focus to the checked radio (or the first one if none are checked) when clicking the label\n if (radioToFocus) {\n radioToFocus.focus();\n }\n }\n\n private handleSlotChange() {\n const radios = this.getAllRadios();\n\n radios.forEach(radio => (radio.checked = radio.value === this.value));\n\n this.hasButtonGroup = radios.some(radio => radio.tagName.toLowerCase() === 'nile-radio-button');\n\n if (!radios.some(radio => radio.checked)) {\n if (this.hasButtonGroup) {\n const buttonRadio = radios[0].shadowRoot!.querySelector('button')!;\n buttonRadio.tabIndex = 0;\n } else {\n radios[0].tabIndex = 0;\n }\n }\n\n if (this.hasButtonGroup) {\n const buttonGroup = this.shadowRoot?.querySelector('nile-button-group');\n }\n }\n\n private updateCheckedRadio() {\n const radios = this.getAllRadios();\n radios.forEach(radio => (radio.checked = radio.value === this.value));\n }\n\n @watch('value')\n handleValueChange() {\n if (this.hasUpdated) {\n this.updateCheckedRadio();\n }\n }\n\n render() {\n const hasLabelSlot = this.hasSlotController.test('label');\n const hasHelpTextSlot = this.hasSlotController.test('help-text');\n const hasLabelSuffixSlot = this.hasSlotController.test('label-suffix');\n const hasLabel = this.label ? true : !!hasLabelSlot;\n const hasHelpText = this.helpText ? true : false;\n const hasErrorMessage = this.errorMessage ? true : false;\n\n const defaultSlot = html`\n <slot\n @click=${this.handleRadioClick}\n @keydown=${this.handleKeyDown}\n @slotchange=${this.handleSlotChange}\n role=\"presentation\"\n ></slot>\n `;\n\n return html`\n <fieldset\n part=\"form-control\"\n class=${classMap({\n 'form-control': true,\n 'form-control--medium': true,\n 'form-control--radio-group': true,\n 'form-control--has-label': hasLabel,\n 'form-control--has-help-text': hasHelpText\n })}\n role=\"radiogroup\"\n aria-labelledby=\"label\"\n aria-describedby=\"help-text\"\n aria-errormessage=\"error-message\"\n >\n <label\n part=\"form-control-label\"\n id=\"label\"\n class=\"form-control__label\"\n aria-hidden=${hasLabel ? 'false' : 'true'}\n @click=${this.handleLabelClick}\n >\n <slot name=\"label\">${this.label}</slot>\n </label>\n\n ${hasLabelSuffixSlot ? html` <slot name=\"label-suffix\"></slot> ` : ``}\n\n <div part=\"form-control-input\" class=\"form-control-input\">\n <div class=\"visually-hidden\">\n <label class=\"radio-group__validation\">\n <input\n type=\"text\"\n class=\"radio-group__validation-input\"\n ?required=${this.required}\n tabindex=\"-1\"\n hidden\n />\n </label>\n </div>\n\n ${this.hasButtonGroup\n ? html`\n ${defaultSlot}\n `\n : html`\n <div class=\"${this.labelInline ? `form-control--inline-radio`:``}\"> ${defaultSlot}</div> `}\n </div>\n\n ${\n hasHelpText\n ? html`\n <nile-form-help-text>${this.helpText}</nile-form-help-text>\n `\n : ``\n }\n\n ${\n hasErrorMessage\n ? html`\n <nile-form-error-message\n >${this.errorMessage}</nile-form-error-message\n >\n `\n : ``\n }\n\n </fieldset>\n `;\n }\n}\n\nexport default NileRadioGroup;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-radio-group': NileRadioGroup;\n }\n}\n"],"names":["NileRadioGroup","_h","_inherits","c","_super","_createSuper","this","hasSlotController","HasSlotController","customValidityMessage","hasButtonGroup","defaultValue","label","name","value","form","required","labelInline","disabled","helpText","errorMessage","_this","_createClass","key","connectedCallback","super","handleInitialDisabledState","emit","disconnectedCallback","getAllRadios","_toConsumableArray","querySelectorAll","handleRadioClick","event","target","closest","radios","oldValue","forEach","radio","checked","handleDisabledChange","hasAttribute","handleKeyDown","_i$find","_this4","includes","filter","checkedRadio","find","incr","index","indexOf","length","tabIndex","shadowRoot","querySelector","focus","preventDefault","handleLabelClick","radioToFocus","handleSlotChange","some","tagName","toLowerCase","updateCheckedRadio","handleValueChange","hasUpdated","render","hasLabelSlot","test","hasLabelSuffixSlot","hasLabel","hasHelpText","hasErrorMessage","defaultSlot","html","_templateObject","_taggedTemplateLiteral","_templateObject2","classMap","_templateObject3","_templateObject4","_templateObject5","_templateObject6","_templateObject7","NileElement","styles","__decorate","query","prototype","state","property","reflect","type","Boolean","attribute","watch","waitUntilFirstUpdate","_export","customElement"],"mappings":"orLA2BaA,CAAN,uBAAAC,EAAA,EAAAC,SAAA,CAAAC,CAAA,CAAAF,EAAA,MAAAG,MAAA,CAAAC,YAAA,CAAAF,CAAA,EAAA,SAAAA,EAAA,uEAGYG,KAAAA,CAAiBC,iBAAG,CAAA,GAAIC,CAAAA,gCAAwB,WAAA,CAAa,OACtEF,CAAAA,CAAAA,KAAAA,CAAqBG,qBAAG,CAAA,EAAA,CAIfH,KAAAA,CAAcI,cAAG,CAAA,CAAA,CAAA,CAEzBJ,KAAAA,CAAYK,YAAG,CAAA,EAAA,CAMZL,KAAAA,CAAKM,KAAG,CAAA,EAAA,CAGRN,KAAAA,CAAIO,IAAAA,CAAG,QAGUP,CAAAA,KAAAA,CAAKQ,MAAG,EAORR,CAAAA,KAAAA,CAAIS,KAAG,EAGQT,CAAAA,KAAAA,CAAQU,UAAG,CAIXV,CAAAA,KAAAA,CAAWW,aAAG,CAGdX,CAAAA,KAAAA,CAAQY,UAAG,CAEjBZ,CAAAA,KAAAA,CAAQa,SAAG,EAEPb,CAAAA,KAAAA,CAAYc,aAAG,EAgO1D,QAAAC,KAAA,EA9NCC,YAAA,CAAAnB,CAAA,GAAAoB,GAAA,qBAAAT,KAAA,UAAAU,kBAAA,CAAAA,CACEC,IAAAA,CAAAA,eAAAA,CAAAA,CAAAA,CAAAA,SAAAA,4BAAAA,IAAAA,OACAnB,KAAKK,YAAeL,CAAAA,IAAAA,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CAAMC,OAASF,CAAAA,OAAAA,CAAAA,CAAS,KAAyB7F,CAAA0F,CAAAA,SAAAA,CAAA,UAAA,CAAA,IAAA,EAAA,CAAA,CAIjBF,CAAA,CAAA,CAA3CI,CAAS,CAAA,CAAEE,KAAMC,OAASF,CAAAA,OAAAA,CAAAA,CAAS,CAA4B7F,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAA0F,SAAA,CAAA,aAAA,CAAA,IAAA,EAGpBF,CAAAA,CAAAA,CAAAA,CAAA,CAA3CI,CAAS,CAAA,CAAEE,IAAMC,CAAAA,OAAAA,CAASF,OAAS,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAyB7F,CAAA0F,CAAAA,SAAAA,CAAA,eAAA,EAEvBF,CAAAA,CAAAA,CAAAA,CAAA,CAArCI,CAAAA,CAAS,CAAEI,SAAAA,CAAW,WAA6BhG,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAA0F,UAAA,UAAA,CAAA,IAAA,EAAA,CAAA,CAEVF,CAAA,CAAA,CAAzCI,CAAS,CAAA,CAAEI,SAAW,CAAA,eAAA,CAAA,CAAA,CAAA,CAAqChG,EAAA0F,SAAA,CAAA,cAAA,CAAA,IAAA,EAqC5DF,CAAAA,CAAAA,CAAAA,CAAA,CADCS,CAAAA,CAAM,UAAY,CAAA,CAAEC,sBAAsB,CAK1ClG,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAA0F,SAAA,CAAA,sBAAA,CAAA,IA2FDF,CAAAA,CAAAA,CAAAA,CAAA,CADCS,CAAAA,CAAM,UAKNjG,CAAA0F,CAAAA,SAAAA,CAAA,mBAAA,CAAA,IAAA,CAAA,CAAAS,OAAA,KAnLUnG,CAAcwF,CAAAA,CAAAA,CAAA,CAD1BY,CAAAA,CAAc,qBACFpG"}
|
1
|
+
{"version":3,"file":"nile-radio-group.cjs.js","sources":["../../../src/nile-radio-group/nile-radio-group.ts"],"sourcesContent":["\nimport { classMap } from 'lit/directives/class-map.js';\nimport { customElement, property, query, state } from 'lit/decorators.js';\nimport { HasSlotController } from '../internal/slot';\nimport { html } from 'lit';\nimport { watch } from '../internal/watch';\nimport NileElement from '../internal/nile-element';\nimport styles from './nile-radio-group.css';\nimport type { CSSResultGroup } from 'lit';\nimport type NileRadio from '../nile-radio/nile-radio';\n\n/**\n * @summary Radio groups are used to group multiple [radios](/components/radio) or [radio buttons](/components/radio-button) so they function as a single form control.\n *\n * @dependency nile-button-group\n *\n * @slot - The default slot where `<nile-radio>` or `<nile-radio-button>` elements are placed.\n * @slot label - The radio group's label. Required for proper accessibility. Alternatively, you can use the `label`\n * attribute.\n *\n * @event change - Emitted when the radio group's selected value changes.\n * @event input - Emitted when the radio group receives user input.\n * @event invalid - Emitted when the form control has been checked for validity and its constraints aren't satisfied.\n * @csspart button-group - The button group that wraps radio buttons.\n * @csspart button-group__base - The button group's `base` part.\n */\n@customElement('nile-radio-group')\nexport class NileRadioGroup extends NileElement {\n static styles: CSSResultGroup = styles;\n\n private readonly hasSlotController = new HasSlotController(this, 'help-text', 'label');\n private customValidityMessage = '';\n\n @query('slot:not([name])') defaultSlot: HTMLSlotElement;\n\n @state() private hasButtonGroup = false;\n\n @state() defaultValue = '';\n\n /**\n * The radio group's label. Required for proper accessibility. If you need to display HTML, use the `label` slot\n * instead.\n */\n @property() label = '';\n\n /** The name of the radio group, submitted as a name/value pair with form data. */\n @property() name = 'option';\n\n /** The current value of the radio group, submitted as a name/value pair with form data. */\n @property({ reflect: true }) value = '';\n\n /**\n * By default, form controls are associated with the nearest containing `<form>` element. This attribute allows you\n * to place the form control outside of a form and associate it with the form that has this `id`. The form must be in\n * the same document or shadow root for this to work.\n */\n @property({ reflect: true }) form = '';\n\n /** Ensures a child radio is checked before allowing the containing form to submit. */\n @property({ type: Boolean, reflect: true }) required = false;\n\n\n /** Used to show radio in inline or not */\n @property({ type: Boolean, reflect: true }) labelInline = false;\n\n /** Used to disabled or not */\n @property({ type: Boolean, reflect: true }) disabled = false;\n\n @property({ attribute: 'help-text' }) helpText = '';\n\n @property({ attribute: 'error-message' }) errorMessage = '';\n\n connectedCallback() {\n super.connectedCallback();\n this.defaultValue = this.value;\n this.handleInitialDisabledState();\n this.emit('nile-init');\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n this.emit('nile-destroy');\n }\n\n private getAllRadios() {\n return [...this.querySelectorAll<NileRadio>('nile-radio')];\n }\n\n private handleRadioClick(event: MouseEvent) {\n const target = (event.target as HTMLElement).closest<NileRadio>('nile-radio')!;\n const radios = this.getAllRadios();\n const oldValue = this.value;\n\n if (target.disabled || this.disabled) {\n return;\n }\n\n this.value = target.value;\n radios.forEach(radio => (radio.checked = radio === target));\n\n if (this.value !== oldValue) {\n this.emit('change',{value: this.value });\n this.emit('input');\n }\n }\n\n @watch('disabled', { waitUntilFirstUpdate: true })\n handleDisabledChange() {\n this.getAllRadios().forEach(radio => {\n radio.disabled = this.disabled;\n });\n }\n\n private handleInitialDisabledState() {\n this.getAllRadios().forEach(radio => {\n radio.disabled = radio.hasAttribute('disabled') ? radio.disabled : this.disabled;\n });\n }\n\n private handleKeyDown(event: KeyboardEvent) {\n if (!['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight', ' '].includes(event.key)) {\n return;\n }\n\n const radios = this.getAllRadios().filter(radio => !radio.disabled);\n const checkedRadio = radios.find(radio => radio.checked) ?? radios[0];\n const incr = event.key === ' ' ? 0 : ['ArrowUp', 'ArrowLeft'].includes(event.key) ? -1 : 1;\n const oldValue = this.value;\n let index = radios.indexOf(checkedRadio) + incr;\n\n if (index < 0) {\n index = radios.length - 1;\n }\n\n if (index > radios.length - 1) {\n index = 0;\n }\n\n this.getAllRadios().forEach(radio => {\n radio.checked = false;\n\n if (!this.hasButtonGroup) {\n radio.tabIndex = -1;\n }\n });\n\n this.value = radios[index].value;\n radios[index].checked = true;\n\n if (!this.hasButtonGroup) {\n radios[index].tabIndex = 0;\n radios[index].focus();\n } else {\n radios[index].shadowRoot!.querySelector('button')!.focus();\n }\n\n if (this.value !== oldValue) {\n this.emit('change');\n this.emit('input');\n }\n\n event.preventDefault();\n }\n\n private handleLabelClick() {\n const radios = this.getAllRadios();\n const checked = radios.find(radio => radio.checked);\n const radioToFocus = checked || radios[0];\n\n // Move focus to the checked radio (or the first one if none are checked) when clicking the label\n if (radioToFocus) {\n radioToFocus.focus();\n }\n }\n\n private handleSlotChange() {\n const radios = this.getAllRadios();\n\n radios.forEach(radio => (radio.checked = radio.value === this.value));\n\n this.hasButtonGroup = radios.some(radio => radio.tagName.toLowerCase() === 'nile-radio-button');\n\n if (!radios.some(radio => radio.checked)) {\n if (this.hasButtonGroup) {\n const buttonRadio = radios[0].shadowRoot!.querySelector('button')!;\n buttonRadio.tabIndex = 0;\n } else {\n radios[0].tabIndex = 0;\n }\n }\n\n if (this.hasButtonGroup) {\n const buttonGroup = this.shadowRoot?.querySelector('nile-button-group');\n }\n }\n\n private updateCheckedRadio() {\n const radios = this.getAllRadios();\n radios.forEach(radio => (radio.checked = radio.value === this.value));\n }\n\n @watch('value')\n handleValueChange() {\n if (this.hasUpdated) {\n this.updateCheckedRadio();\n }\n }\n\n render() {\n const hasLabelSlot = this.hasSlotController.test('label');\n const hasHelpTextSlot = this.hasSlotController.test('help-text');\n const hasLabelSuffixSlot = this.hasSlotController.test('label-suffix');\n const hasLabel = this.label ? true : !!hasLabelSlot;\n const hasHelpText = this.helpText ? true : false;\n const hasErrorMessage = this.errorMessage ? true : false;\n\n const defaultSlot = html`\n <slot\n @click=${this.handleRadioClick}\n @keydown=${this.handleKeyDown}\n @slotchange=${this.handleSlotChange}\n role=\"presentation\"\n ></slot>\n `;\n\n return html`\n <fieldset\n part=\"form-control\"\n class=${classMap({\n 'form-control': true,\n 'form-control--medium': true,\n 'form-control--radio-group': true,\n 'form-control--has-label': hasLabel,\n 'form-control--has-help-text': hasHelpText\n })}\n role=\"radiogroup\"\n aria-labelledby=\"label\"\n aria-describedby=\"help-text\"\n aria-errormessage=\"error-message\"\n >\n <label\n part=\"form-control-label\"\n id=\"label\"\n class=\"form-control__label\"\n aria-hidden=${hasLabel ? 'false' : 'true'}\n @click=${this.handleLabelClick}\n >\n <slot name=\"label\">${this.label}</slot>\n </label>\n\n ${hasLabelSuffixSlot ? html` <slot name=\"label-suffix\"></slot> ` : ``}\n\n <div part=\"form-control-input\" class=\"form-control-input\">\n <div class=\"visually-hidden\">\n <label class=\"radio-group__validation\">\n <input\n type=\"text\"\n class=\"radio-group__validation-input\"\n ?required=${this.required}\n tabindex=\"-1\"\n hidden\n />\n </label>\n </div>\n\n ${this.hasButtonGroup\n ? html`\n ${defaultSlot}\n `\n : html`\n <div part=\"options-base\" class=\"${this.labelInline ? `form-control--inline-radio`:``}\"> ${defaultSlot}</div> `}\n </div>\n\n ${\n hasHelpText\n ? html`\n <nile-form-help-text>${this.helpText}</nile-form-help-text>\n `\n : ``\n }\n\n ${\n hasErrorMessage\n ? html`\n <nile-form-error-message\n >${this.errorMessage}</nile-form-error-message\n >\n `\n : ``\n }\n\n </fieldset>\n `;\n }\n}\n\nexport default NileRadioGroup;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-radio-group': NileRadioGroup;\n }\n}\n"],"names":["NileRadioGroup","_h","_inherits","c","_super","_createSuper","this","hasSlotController","HasSlotController","customValidityMessage","hasButtonGroup","defaultValue","label","name","value","form","required","labelInline","disabled","helpText","errorMessage","_this","_createClass","key","connectedCallback","super","handleInitialDisabledState","emit","disconnectedCallback","getAllRadios","_toConsumableArray","querySelectorAll","handleRadioClick","event","target","closest","radios","oldValue","forEach","radio","checked","handleDisabledChange","hasAttribute","handleKeyDown","_i$find","_this4","includes","filter","checkedRadio","find","incr","index","indexOf","length","tabIndex","shadowRoot","querySelector","focus","preventDefault","handleLabelClick","radioToFocus","handleSlotChange","some","tagName","toLowerCase","updateCheckedRadio","handleValueChange","hasUpdated","render","hasLabelSlot","test","hasLabelSuffixSlot","hasLabel","hasHelpText","hasErrorMessage","defaultSlot","html","_templateObject","_taggedTemplateLiteral","_templateObject2","classMap","_templateObject3","_templateObject4","_templateObject5","_templateObject6","_templateObject7","NileElement","styles","__decorate","query","prototype","state","property","reflect","type","Boolean","attribute","watch","waitUntilFirstUpdate","_export","customElement"],"mappings":"orLA2BaA,CAAN,uBAAAC,EAAA,EAAAC,SAAA,CAAAC,CAAA,CAAAF,EAAA,MAAAG,MAAA,CAAAC,YAAA,CAAAF,CAAA,EAAA,SAAAA,EAAA,uEAGYG,KAAAA,CAAiBC,iBAAG,CAAA,GAAIC,CAAAA,gCAAwB,WAAA,CAAa,OACtEF,CAAAA,CAAAA,KAAAA,CAAqBG,qBAAG,CAAA,EAAA,CAIfH,KAAAA,CAAcI,cAAG,CAAA,CAAA,CAAA,CAEzBJ,KAAAA,CAAYK,YAAG,CAAA,EAAA,CAMZL,KAAAA,CAAKM,KAAG,CAAA,EAAA,CAGRN,KAAAA,CAAIO,IAAAA,CAAG,QAGUP,CAAAA,KAAAA,CAAKQ,MAAG,EAORR,CAAAA,KAAAA,CAAIS,KAAG,EAGQT,CAAAA,KAAAA,CAAQU,UAAG,CAIXV,CAAAA,KAAAA,CAAWW,aAAG,CAGdX,CAAAA,KAAAA,CAAQY,UAAG,CAEjBZ,CAAAA,KAAAA,CAAQa,SAAG,EAEPb,CAAAA,KAAAA,CAAYc,aAAG,EAgO1D,QAAAC,KAAA,EA9NCC,YAAA,CAAAnB,CAAA,GAAAoB,GAAA,qBAAAT,KAAA,UAAAU,kBAAA,CAAAA,CACEC,IAAAA,CAAAA,eAAAA,CAAAA,CAAAA,CAAAA,SAAAA,4BAAAA,IAAAA,OACAnB,KAAKK,YAAeL,CAAAA,IAAAA,CAAKQ,MACzBR,IAAKoB,CAAAA,0BAAAA,CAAAA,CAAAA,CACLpB,KAAKqB,IAAK,CAAA,WAAA,CACX,EAED,GAAAJ,GAAA,wBAAAT,KAAA,UAAAc,qBAAA,CACEH,CAAAA,IAAAA,CAAAA,eAAAA,CAAAA,CAAAA,CAAAA,S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S,CAA4B7F,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAA0F,SAAA,CAAA,aAAA,CAAA,IAAA,EAGpBF,CAAAA,CAAAA,CAAAA,CAAA,CAA3CI,CAAS,CAAA,CAAEE,IAAMC,CAAAA,OAAAA,CAASF,OAAS,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAyB7F,CAAA0F,CAAAA,SAAAA,CAAA,eAAA,EAEvBF,CAAAA,CAAAA,CAAAA,CAAA,CAArCI,CAAAA,CAAS,CAAEI,SAAAA,CAAW,WAA6BhG,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAA0F,UAAA,UAAA,CAAA,IAAA,EAAA,CAAA,CAEVF,CAAA,CAAA,CAAzCI,CAAS,CAAA,CAAEI,SAAW,CAAA,eAAA,CAAA,CAAA,CAAA,CAAqChG,EAAA0F,SAAA,CAAA,cAAA,CAAA,IAAA,EAqC5DF,CAAAA,CAAAA,CAAAA,CAAA,CADCS,CAAAA,CAAM,UAAY,CAAA,CAAEC,sBAAsB,CAK1ClG,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAA0F,SAAA,CAAA,sBAAA,CAAA,IA2FDF,CAAAA,CAAAA,CAAAA,CAAA,CADCS,CAAAA,CAAM,UAKNjG,CAAA0F,CAAAA,SAAAA,CAAA,mBAAA,CAAA,IAAA,CAAA,CAAAS,OAAA,KAnLUnG,CAAcwF,CAAAA,CAAAA,CAAA,CAD1BY,CAAAA,CAAc,qBACFpG"}
|
@@ -42,7 +42,7 @@ import{__decorate as t}from"tslib";import{classMap as e}from"lit/directives/clas
|
|
42
42
|
${this.hasButtonGroup?a`
|
43
43
|
${r}
|
44
44
|
`:a`
|
45
|
-
<div class="${this.labelInline?"form-control--inline-radio":""}"> ${r}</div> `}
|
45
|
+
<div part="options-base" class="${this.labelInline?"form-control--inline-radio":""}"> ${r}</div> `}
|
46
46
|
</div>
|
47
47
|
|
48
48
|
${l?a`
|
@@ -1,2 +1,2 @@
|
|
1
|
-
System.register(["tslib","../index-cd83c5c8.cjs.js","lit/decorators.js","./nile-switcher.css.cjs.js","../internal/nile-element.cjs.js","lit/directives/choose.js","lit/directives/class-map.js","../property-0f6a51ec.cjs.js","lit"],function(_export,_context){"use strict";var e,i,t,r,n,s,l,o,_templateObject,_templateObject2,_templateObject3,_templateObject4,_templateObject5,_templateObject6,_templateObject7,_templateObject8,_templateObject9,_templateObject10,_templateObject11,a,c,d;function ownKeys(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable;})),t.push.apply(t,o);}return t;}function _objectSpread(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?ownKeys(Object(t),!0).forEach(function(r){_defineProperty(e,r,t[r]);}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r));});}return e;}function _defineProperty(obj,key,value){key=_toPropertyKey(key);if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}function _taggedTemplateLiteral(strings,raw){if(!raw){raw=strings.slice(0);}return Object.freeze(Object.defineProperties(strings,{raw:{value:Object.freeze(raw)}}));}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,_toPropertyKey(descriptor.key),descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);Object.defineProperty(Constructor,"prototype",{writable:false});return Constructor;}function _toPropertyKey(arg){var key=_toPrimitive(arg,"string");return typeof key==="symbol"?key:String(key);}function _toPrimitive(input,hint){if(typeof input!=="object"||input===null)return input;var prim=input[Symbol.toPrimitive];if(prim!==undefined){var res=prim.call(input,hint||"default");if(typeof res!=="object")return res;throw new TypeError("@@toPrimitive must return a primitive value.");}return(hint==="string"?String:Number)(input);}function _get(){if(typeof Reflect!=="undefined"&&Reflect.get){_get=Reflect.get.bind();}else{_get=function _get(target,property,receiver){var base=_superPropBase(target,property);if(!base)return;var desc=Object.getOwnPropertyDescriptor(base,property);if(desc.get){return desc.get.call(arguments.length<3?target:receiver);}return desc.value;};}return _get.apply(this,arguments);}function _superPropBase(object,property){while(!Object.prototype.hasOwnProperty.call(object,property)){object=_getPrototypeOf(object);if(object===null)break;}return object;}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});Object.defineProperty(subClass,"prototype",{writable:false});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function _createSuperInternal(){var Super=_getPrototypeOf(Derived),result;if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget);}else{result=Super.apply(this,arguments);}return _possibleConstructorReturn(this,result);};}function _possibleConstructorReturn(self,call){if(call&&(typeof call==="object"||typeof call==="function")){return call;}else if(call!==void 0){throw new TypeError("Derived constructors may only return object or undefined");}return _assertThisInitialized(self);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true;}catch(e){return false;}}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}return{setters:[function(_tslib){e=_tslib.__decorate;},function(_index001CjsJs){i=_index001CjsJs.x;},function(_litDecoratorsJs){t=_litDecoratorsJs.customElement;},function(_nileSwitcherCssCjsJs){r=_nileSwitcherCssCjsJs.s;},function(_internalNileElementCjsJs){n=_internalNileElementCjsJs.N;},function(_litDirectivesChooseJs){s=_litDirectivesChooseJs.choose;},function(_litDirectivesClassMapJs){l=_litDirectivesClassMapJs.classMap;},function(_property002CjsJs){o=_property002CjsJs.n;},function(_lit){}],execute:function(){!function(e){e.DEFAULT="defaultInput",e.SWITCH="switchInput";}(a||(a={})),function(e){e.DROPDOWN="dropdown",e.TEXT="text",e.CHECKBOX="checkbox",e.TEXTAREA="text-area",e.RADIO="radio",e.CONTENTEDITOR="content-editor";}(c||(c={}));_export("N",d=/*#__PURE__*/function(_n){_inherits(d,_n);var _super=_createSuper(d);function d(){_classCallCheck(this,d);return _super.apply(this,arguments);}_createClass(d,[{key:"connectedCallback",value:function connectedCallback(){_get(_getPrototypeOf(d.prototype),"connectedCallback",this).call(this),this.emit("nile-init");}},{key:"disconnectedCallback",value:function disconnectedCallback(){_get(_getPrototypeOf(d.prototype),"disconnectedCallback",this).call(this),this.emit("nile-destroy");}},{key:"renderNileText",value:function renderNileText(e,t){var _this=this;var r=e.value,n=e.label,s=e.placeholder,l=e.disabled,o=e.required,a=e.error,c=e.errorMessage,_d=e.inputType;return i(_templateObject||(_templateObject=_taggedTemplateLiteral(["<nile-input\n .value=","\n .label=","\n .disabled=","\n .required=","\n .errorMessage=","\n .placeholder=","\n .error=","\n @nile-input=","\n ></nile-input>"])),r,n,l,o,c,s,a,function(e){_this.handleChange(e,t,_d);});}},{key:"renderDropdown",value:function renderDropdown(e,t){var _this2=this;var r=e.options,n=e.multiple,s=e.placeholder,l=e.disabled,o=e.inputType;return i(_templateObject2||(_templateObject2=_taggedTemplateLiteral(["<nile-select\n .placeholder=","\n .disabled=\"","\"\n .multiple=\"","\"\n @nile-change=","\n >\n ","\n </nile-select>"])),s,l,n,function(e){_this2.handleChange(e,t,o);},r===null||r===void 0?void 0:r.map(function(e){return i(_templateObject3||(_templateObject3=_taggedTemplateLiteral(["<nile-option .value=\"","\">"," </nile-option>"])),e,e);}));}},{key:"renderNileTextArea",value:function renderNileTextArea(e,t){var _this3=this;var r=e.value,n=e.disabled,s=e.readonly,l=e.errorMessage,o=e.error,a=e.inputType;return i(_templateObject4||(_templateObject4=_taggedTemplateLiteral(["<nile-textarea\n .value=","\n .disabled=","\n ?readonly=","\n .error=","\n .errorMessage=","\n @nile-input=","\n ></nile-textarea>"])),r,n,s,o,l,function(e){_this3.handleChange(e,t,a);});}},{key:"renderNileCheckBox",value:function renderNileCheckBox(e,t){var _this4=this;var r=e.value,n=e.label,s=e.disabled,l=e.inputType;return i(_templateObject5||(_templateObject5=_taggedTemplateLiteral(["<nile-checkbox\n .checked=","\n .label=","\n .disabled=","\n @valueChange=","\n ></nile-checkbox>"])),r,n,s,function(e){_this4.handleChange(e,t,l);});}},{key:"renderNileRadio",value:function renderNileRadio(e,t){var _this5=this;var r=e.options,n=e.value,s=e.disabled,l=e.inputType;return i(_templateObject6||(_templateObject6=_taggedTemplateLiteral(["<nile-radio-group\n .value=","\n .disabled=","\n @change=","\n >\n ","\n </nile-radio-group>"])),n,s,function(e){_this5.handleChange(e,t,l);},r&&r.map(function(e){return i(_templateObject7||(_templateObject7=_taggedTemplateLiteral(["<nile-radio .value=\"","\">"," </nile-radio>"])),e,e);}));}},{key:"renderContentEditor",value:function renderContentEditor(e,t){var _this6=this;var r=e.value,n=e.options,s=e.inputType,l=e.errorMessage,o=e.type,a=e.readonly;return i(_templateObject8||(_templateObject8=_taggedTemplateLiteral(["<nile-content-editor\n .value=","\n .options=","\n .type=","\n .readonly=","\n .errorMessage=","\n @nile-change=","\n >\n </nile-content-editor>"])),r,n,o,a,l,function(e){_this6.handleChange(e,t,s);});}},{key:"handleChange",value:function handleChange(e,i,t){t===c.CHECKBOX?this.nileSwitchConfig[i].value=e.detail.checked:this.nileSwitchConfig[i].value=e.detail.value,e.stopPropagation(),this.emit("nile-change",{config:this.nileSwitchConfig});}},{key:"renderIcon",value:function renderIcon(e,t){var r=e.helperText,n=t.helperText,s=this.nileSwitchConfig.toggleSwitch?"stringinput":"header-functions",o=this.nileSwitchConfig.toggleSwitch?r||"switch to ".concat(e.inputType):n||"switch to ".concat(t.inputType);return i(_templateObject9||(_templateObject9=_taggedTemplateLiteral([" <nile-tooltip content="," placement=\"bottom\">\n <nile-icon\n size=\"14\"\n class=","\n .name=","\n color=\"#005EA6\"\n @click=","\n ></nile-icon>\n </nile-tooltip>"])),o,l({"pointer-cursor":!0,"flex-start":!0}),s,this.toggleField);}},{key:"toggleField",value:function toggleField(){this.nileSwitchConfig.confirmation||(this.nileSwitchConfig=_objectSpread(_objectSpread({},this.nileSwitchConfig),{},{toggleSwitch:!this.nileSwitchConfig.toggleSwitch})),this.emit("nile-switch",{config:this.nileSwitchConfig});}},{key:"singleFieldSwitcher",value:function singleFieldSwitcher(e,t,r,n){var _this7=this;var l=e.inputType,o=t.inputType;return i(_templateObject10||(_templateObject10=_taggedTemplateLiteral(["\n ","\n ","\n "])),r?s(o,[[c.TEXTAREA,function(){return _this7.renderNileTextArea(t,a.SWITCH);}],[c.TEXT,function(){return _this7.renderNileText(t,a.SWITCH);}],[c.CONTENTEDITOR,function(){return _this7.renderContentEditor(t,a.SWITCH);}]],function(){return _this7.renderNileTextArea(t,a.SWITCH);}):s(l,[[c.TEXT,function(){return _this7.renderNileText(e,a.DEFAULT);}],[c.CHECKBOX,function(){return _this7.renderNileCheckBox(e,a.DEFAULT);}],[c.TEXTAREA,function(){return _this7.renderNileTextArea(e,a.DEFAULT);}],[c.RADIO,function(){return _this7.renderNileRadio(e,a.DEFAULT);}],[c.DROPDOWN,function(){return _this7.renderDropdown(_this7.nileSwitchConfig.defaultInput,a.DEFAULT);}],[c.CONTENTEDITOR,function(){return _this7.renderContentEditor(_this7.nileSwitchConfig.defaultInput,a.DEFAULT);}]],function(){return _this7.renderNileText(e,a.DEFAULT);}),n?"":this.renderIcon(e,t));}},{key:"render",value:function render(){var _this$nileSwitchConfi=this.nileSwitchConfig,e=_this$nileSwitchConfi.toggleSwitch,t=_this$nileSwitchConfi.defaultInput,r=_this$nileSwitchConfi.switchInput,n=_this$nileSwitchConfi.disable;return i(_templateObject11||(_templateObject11=_taggedTemplateLiteral(["<div class=\"input-container\">\n ","\n </div>"])),this.singleFieldSwitcher(t,r,e,!!n));}}]);return d;}(n));d.styles=r,e([o({type:Object})],d.prototype,"nileSwitchConfig",void 0),_export("N",d=e([t("nile-switcher")],d));}};});
|
1
|
+
System.register(["tslib","../index-cd83c5c8.cjs.js","lit/decorators.js","./nile-switcher.css.cjs.js","../internal/nile-element.cjs.js","lit/directives/choose.js","lit/directives/class-map.js","../property-0f6a51ec.cjs.js","lit"],function(_export,_context){"use strict";var e,i,t,r,n,s,o,l,_templateObject,_templateObject2,_templateObject3,_templateObject4,_templateObject5,_templateObject6,_templateObject7,_templateObject8,_templateObject9,_templateObject10,_templateObject11,a,c,d;function ownKeys(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable;})),t.push.apply(t,o);}return t;}function _objectSpread(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?ownKeys(Object(t),!0).forEach(function(r){_defineProperty(e,r,t[r]);}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r));});}return e;}function _defineProperty(obj,key,value){key=_toPropertyKey(key);if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}function _taggedTemplateLiteral(strings,raw){if(!raw){raw=strings.slice(0);}return Object.freeze(Object.defineProperties(strings,{raw:{value:Object.freeze(raw)}}));}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,_toPropertyKey(descriptor.key),descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);Object.defineProperty(Constructor,"prototype",{writable:false});return Constructor;}function _toPropertyKey(arg){var key=_toPrimitive(arg,"string");return typeof key==="symbol"?key:String(key);}function _toPrimitive(input,hint){if(typeof input!=="object"||input===null)return input;var prim=input[Symbol.toPrimitive];if(prim!==undefined){var res=prim.call(input,hint||"default");if(typeof res!=="object")return res;throw new TypeError("@@toPrimitive must return a primitive value.");}return(hint==="string"?String:Number)(input);}function _get(){if(typeof Reflect!=="undefined"&&Reflect.get){_get=Reflect.get.bind();}else{_get=function _get(target,property,receiver){var base=_superPropBase(target,property);if(!base)return;var desc=Object.getOwnPropertyDescriptor(base,property);if(desc.get){return desc.get.call(arguments.length<3?target:receiver);}return desc.value;};}return _get.apply(this,arguments);}function _superPropBase(object,property){while(!Object.prototype.hasOwnProperty.call(object,property)){object=_getPrototypeOf(object);if(object===null)break;}return object;}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});Object.defineProperty(subClass,"prototype",{writable:false});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function _createSuperInternal(){var Super=_getPrototypeOf(Derived),result;if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget);}else{result=Super.apply(this,arguments);}return _possibleConstructorReturn(this,result);};}function _possibleConstructorReturn(self,call){if(call&&(typeof call==="object"||typeof call==="function")){return call;}else if(call!==void 0){throw new TypeError("Derived constructors may only return object or undefined");}return _assertThisInitialized(self);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true;}catch(e){return false;}}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}return{setters:[function(_tslib){e=_tslib.__decorate;},function(_index001CjsJs){i=_index001CjsJs.x;},function(_litDecoratorsJs){t=_litDecoratorsJs.customElement;},function(_nileSwitcherCssCjsJs){r=_nileSwitcherCssCjsJs.s;},function(_internalNileElementCjsJs){n=_internalNileElementCjsJs.N;},function(_litDirectivesChooseJs){s=_litDirectivesChooseJs.choose;},function(_litDirectivesClassMapJs){o=_litDirectivesClassMapJs.classMap;},function(_property002CjsJs){l=_property002CjsJs.n;},function(_lit){}],execute:function(){!function(e){e.DEFAULT="defaultInput",e.SWITCH="switchInput";}(a||(a={})),function(e){e.DROPDOWN="dropdown",e.TEXT="text",e.CHECKBOX="checkbox",e.TEXTAREA="text-area",e.RADIO="radio",e.CONTENTEDITOR="content-editor";}(c||(c={}));_export("N",d=/*#__PURE__*/function(_n){_inherits(d,_n);var _super=_createSuper(d);function d(){_classCallCheck(this,d);return _super.apply(this,arguments);}_createClass(d,[{key:"connectedCallback",value:function connectedCallback(){_get(_getPrototypeOf(d.prototype),"connectedCallback",this).call(this),this.emit("nile-init");}},{key:"disconnectedCallback",value:function disconnectedCallback(){_get(_getPrototypeOf(d.prototype),"disconnectedCallback",this).call(this),this.emit("nile-destroy");}},{key:"renderNileText",value:function renderNileText(e,t){var _this=this;var r=e.value,n=e.label,s=e.placeholder,o=e.disabled,l=e.required,a=e.error,c=e.errorMessage,_d=e.inputType;return i(_templateObject||(_templateObject=_taggedTemplateLiteral(["<nile-input\n .value=","\n .label=","\n .disabled=","\n .required=","\n .errorMessage=","\n .placeholder=","\n .error=","\n @nile-input=","\n ></nile-input>"])),r,n,o,l,c,s,a,function(e){_this.handleChange(e,t,_d);});}},{key:"renderDropdown",value:function renderDropdown(e,t){var _this2=this;var r=e.options,n=e.multiple,s=e.placeholder,o=e.disabled,l=e.inputType;return i(_templateObject2||(_templateObject2=_taggedTemplateLiteral(["<nile-select\n .placeholder=","\n .disabled=\"","\"\n .multiple=\"","\"\n @nile-change=","\n >\n ","\n </nile-select>"])),s,o,n,function(e){_this2.handleChange(e,t,l);},r===null||r===void 0?void 0:r.map(function(e){return i(_templateObject3||(_templateObject3=_taggedTemplateLiteral(["<nile-option .value=\"","\">"," </nile-option>"])),e,e);}));}},{key:"renderNileTextArea",value:function renderNileTextArea(e,t){var _this3=this;var r=e.value,n=e.disabled,s=e.readonly,o=e.errorMessage,l=e.error,a=e.inputType;return i(_templateObject4||(_templateObject4=_taggedTemplateLiteral(["<nile-textarea\n .value=","\n .disabled=","\n ?readonly=","\n .error=","\n .errorMessage=","\n @nile-input=","\n ></nile-textarea>"])),r,n,s,l,o,function(e){_this3.handleChange(e,t,a);});}},{key:"renderNileCheckBox",value:function renderNileCheckBox(e,t){var _this4=this;var r=e.value,n=e.label,s=e.disabled,o=e.inputType;return i(_templateObject5||(_templateObject5=_taggedTemplateLiteral(["<nile-checkbox\n .checked=","\n .label=","\n .disabled=","\n @valueChange=","\n ></nile-checkbox>"])),r,n,s,function(e){_this4.handleChange(e,t,o);});}},{key:"renderNileRadio",value:function renderNileRadio(e,t){var _this5=this;var r=e.options,n=e.value,s=e.disabled,o=e.inputType;return i(_templateObject6||(_templateObject6=_taggedTemplateLiteral(["<nile-radio-group\n .value=","\n .disabled=","\n @change=","\n >\n ","\n </nile-radio-group>"])),n,s,function(e){_this5.handleChange(e,t,o);},r&&r.map(function(e){return i(_templateObject7||(_templateObject7=_taggedTemplateLiteral(["<nile-radio .value=\"","\">"," </nile-radio>"])),e,e);}));}},{key:"renderContentEditor",value:function renderContentEditor(e,t){var _this6=this;var r=e.value,n=e.options,s=e.inputType,o=e.errorMessage,l=e.type,a=e.readonly,c=e.noborder;return i(_templateObject8||(_templateObject8=_taggedTemplateLiteral(["<nile-content-editor\n .value=","\n .options=","\n .type=","\n .readonly=","\n .noborder=","\n .errorMessage=","\n @nile-change=","\n >\n </nile-content-editor>"])),r,n,l,a,c,o,function(e){_this6.handleChange(e,t,s);});}},{key:"handleChange",value:function handleChange(e,i,t){t===c.CHECKBOX?this.nileSwitchConfig[i].value=e.detail.checked:this.nileSwitchConfig[i].value=e.detail.value,e.stopPropagation(),this.emit("nile-change",{config:this.nileSwitchConfig});}},{key:"renderIcon",value:function renderIcon(e,t){var r=e.helperText,n=t.helperText,s=this.nileSwitchConfig.toggleSwitch?"stringinput":"header-functions",l=this.nileSwitchConfig.toggleSwitch?r||"switch to ".concat(e.inputType):n||"switch to ".concat(t.inputType);return i(_templateObject9||(_templateObject9=_taggedTemplateLiteral([" <nile-tooltip\n class=","\n content=","\n placement=\"bottom\"\n >\n <nile-icon\n size=\"14\"\n class=","\n .name=","\n color=\"#005EA6\"\n @click=","\n ></nile-icon>\n </nile-tooltip>"])),o({"tooltip-container":!0}),l,o({"pointer-cursor":!0}),s,this.toggleField);}},{key:"toggleField",value:function toggleField(){this.nileSwitchConfig.confirmation||(this.nileSwitchConfig=_objectSpread(_objectSpread({},this.nileSwitchConfig),{},{toggleSwitch:!this.nileSwitchConfig.toggleSwitch})),this.emit("nile-switch",{config:this.nileSwitchConfig});}},{key:"singleFieldSwitcher",value:function singleFieldSwitcher(e,t,r,n){var _this7=this;var o=e.inputType,l=t.inputType;return i(_templateObject10||(_templateObject10=_taggedTemplateLiteral(["\n ","\n ","\n "])),r?s(l,[[c.TEXTAREA,function(){return _this7.renderNileTextArea(t,a.SWITCH);}],[c.TEXT,function(){return _this7.renderNileText(t,a.SWITCH);}],[c.CONTENTEDITOR,function(){return _this7.renderContentEditor(t,a.SWITCH);}]],function(){return _this7.renderNileTextArea(t,a.SWITCH);}):s(o,[[c.TEXT,function(){return _this7.renderNileText(e,a.DEFAULT);}],[c.CHECKBOX,function(){return _this7.renderNileCheckBox(e,a.DEFAULT);}],[c.TEXTAREA,function(){return _this7.renderNileTextArea(e,a.DEFAULT);}],[c.RADIO,function(){return _this7.renderNileRadio(e,a.DEFAULT);}],[c.DROPDOWN,function(){return _this7.renderDropdown(_this7.nileSwitchConfig.defaultInput,a.DEFAULT);}],[c.CONTENTEDITOR,function(){return _this7.renderContentEditor(_this7.nileSwitchConfig.defaultInput,a.DEFAULT);}]],function(){return _this7.renderNileText(e,a.DEFAULT);}),n?"":this.renderIcon(e,t));}},{key:"render",value:function render(){var _this$nileSwitchConfi=this.nileSwitchConfig,e=_this$nileSwitchConfi.toggleSwitch,t=_this$nileSwitchConfi.defaultInput,r=_this$nileSwitchConfi.switchInput,n=_this$nileSwitchConfi.disable;return i(_templateObject11||(_templateObject11=_taggedTemplateLiteral(["<div class=\"input-container\">\n ","\n </div>"])),this.singleFieldSwitcher(t,r,e,!!n));}}]);return d;}(n));d.styles=r,e([l({type:Object})],d.prototype,"nileSwitchConfig",void 0),_export("N",d=e([t("nile-switcher")],d));}};});
|
2
2
|
//# sourceMappingURL=nile-switcher.cjs.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"nile-switcher.cjs.js","sources":["../../../src/nile-switcher/nile-switcher.ts"],"sourcesContent":["/**\n * Copyright Aquera Inc 2023\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { html, property, TemplateResult } from 'lit-element';\nimport { customElement } from 'lit/decorators.js';\nimport { styles } from './nile-switcher.css';\nimport NileElement from '../internal/nile-element';\nimport { CSSResultGroup } from 'lit';\nimport { choose } from 'lit/directives/choose.js';\nimport { classMap } from 'lit/directives/class-map.js';\n\n/**\n * @summary Allows you to switch between nile elements\n\n * @dependency nile-icon\n * @dependency nile-input\n * @dependency nile-checkbox\n * @dependency nile-dropdown\n * @dependency nile-textarea\n *\n \n * @event nile-change - Emitted when the control's value changes.\n * @event nile-switch - Emitted when the nile component is being switched.\n \n */\n\nexport interface switchconfig {\n [key: string]: any;\n toggleSwitch: boolean;\n disable?: boolean;\n confirmation?: boolean;\n defaultInput: switchInputType;\n switchInput: switchInputType;\n}\n\nexport interface switchInputType {\n inputType:\n | INPUT_TYPE_NAMES.DROPDOWN\n | INPUT_TYPE_NAMES.TEXT\n | INPUT_TYPE_NAMES.CHECKBOX\n | INPUT_TYPE_NAMES.TEXTAREA\n | INPUT_TYPE_NAMES.RADIO\n | INPUT_TYPE_NAMES.CONTENTEDITOR;\n value?: String | boolean;\n label?: String;\n readonly?: boolean;\n type?: string;\n placeholder?: string;\n disabled?: boolean;\n required?: boolean;\n error?: boolean;\n errorMessage?: string;\n options?: Array<any>;\n helperText?: string;\n multiple?: boolean;\n}\n\nexport enum INPUT_TYPE {\n DEFAULT = 'defaultInput',\n SWITCH = 'switchInput',\n}\n\nexport enum INPUT_TYPE_NAMES {\n DROPDOWN = 'dropdown',\n TEXT = 'text',\n CHECKBOX = 'checkbox',\n TEXTAREA = 'text-area',\n RADIO = 'radio',\n CONTENTEDITOR = 'content-editor',\n}\n\n@customElement('nile-switcher')\nexport class NileSwitcher extends NileElement {\n /**\n * The styles for nile switcher\n * @remarks If you are extending this class you can extend the base styles with super. Eg `return [super(), myCustomStyles]`\n */\n static styles: CSSResultGroup = styles;\n @property({ type: Object }) nileSwitchConfig: switchconfig;\n\n connectedCallback() {\n super.connectedCallback();\n this.emit('nile-init');\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n this.emit('nile-destroy');\n }\n\n renderNileText(Input: switchInputType, inputType: string) {\n const {\n value,\n label,\n placeholder,\n disabled,\n required,\n error,\n errorMessage,\n inputType: inputTypeName,\n } = Input;\n return html`<nile-input\n .value=${value}\n .label=${label}\n .disabled=${disabled}\n .required=${required}\n .errorMessage=${errorMessage}\n .placeholder=${placeholder}\n .error=${error}\n @nile-input=${(e: CustomEvent) => {\n this.handleChange(e, inputType, inputTypeName);\n }}\n ></nile-input>`;\n }\n\n renderDropdown(Input: switchInputType, inputType: string) {\n const {\n options,\n multiple,\n placeholder,\n disabled,\n inputType: inputTypeName,\n } = Input;\n return html`<nile-select\n .placeholder=${placeholder}\n .disabled=\"${disabled}\"\n .multiple=\"${multiple}\"\n @nile-change=${(e: CustomEvent) => {\n this.handleChange(e, inputType, inputTypeName);\n }}\n >\n ${options?.map((option: any) => {\n return html`<nile-option .value=\"${option}\">${option} </nile-option>`;\n })}\n </nile-select>`;\n }\n\n renderNileTextArea(Input: switchInputType, inputType: string) {\n const {\n value,\n disabled,\n readonly,\n errorMessage,\n error,\n inputType: inputTypeName,\n } = Input;\n\n return html`<nile-textarea\n .value=${value}\n .disabled=${disabled}\n ?readonly=${readonly}\n .error=${error}\n .errorMessage=${errorMessage}\n @nile-input=${(e: CustomEvent) => {\n this.handleChange(e, inputType, inputTypeName);\n }}\n ></nile-textarea>`;\n }\n\n renderNileCheckBox(Input: switchInputType, inputType: string) {\n const { value, label, disabled, inputType: inputTypeName } = Input;\n\n return html`<nile-checkbox\n .checked=${value}\n .label=${label}\n .disabled=${disabled}\n @valueChange=${(e: CustomEvent) => {\n this.handleChange(e, inputType, inputTypeName);\n }}\n ></nile-checkbox>`;\n }\n\n renderNileRadio(Input: switchInputType, inputType: string) {\n const { options, value, disabled, inputType: inputTypeName } = Input;\n\n return html`<nile-radio-group\n .value=${value}\n .disabled=${disabled}\n @change=${(e: CustomEvent) => {\n this.handleChange(e, inputType, inputTypeName);\n }}\n >\n ${options &&\n options.map((option: any) => {\n return html`<nile-radio .value=\"${option}\">${option} </nile-radio>`;\n })}\n </nile-radio-group>`;\n }\n\n renderContentEditor(Input: switchInputType, inputType: string) {\n const {\n value,\n options,\n inputType: inputTypeName,\n errorMessage,\n type,\n readonly,\n } = Input;\n return html`<nile-content-editor\n .value=${value}\n .options=${options}\n .type=${type}\n .readonly=${readonly}\n .errorMessage=${errorMessage}\n @nile-change=${(e: CustomEvent) => {\n this.handleChange(e, inputType, inputTypeName);\n }}\n >\n </nile-content-editor>`;\n }\n\n handleChange(event: CustomEvent, inputType: string, inputTypeName: string) {\n if (inputTypeName === INPUT_TYPE_NAMES.CHECKBOX) {\n this.nileSwitchConfig[inputType as keyof switchconfig].value =\n event.detail.checked;\n } else {\n this.nileSwitchConfig[inputType as keyof switchconfig].value =\n event.detail.value;\n }\n event.stopPropagation();\n this.emit('nile-change', { config: this.nileSwitchConfig });\n }\n\n renderIcon(defaultInput: switchInputType, switchInput: switchInputType) {\n const defaultHelperText = defaultInput.helperText;\n const switchHelperText = switchInput.helperText;\n\n const icon = !this.nileSwitchConfig.toggleSwitch\n ? 'header-functions'\n : 'stringinput';\n\n const helperText = !this.nileSwitchConfig.toggleSwitch\n ? !!switchHelperText\n ? switchHelperText\n : `switch to ${switchInput.inputType}`\n : !!defaultHelperText\n ? defaultHelperText\n : `switch to ${defaultInput.inputType}`;\n\n return html` <nile-tooltip content=${helperText} placement=\"bottom\">\n <nile-icon\n size=\"14\"\n class=${classMap({\n 'pointer-cursor': true,\n 'flex-start': true,\n })}\n .name=${icon}\n color=\"#005EA6\"\n @click=${this.toggleField}\n ></nile-icon>\n </nile-tooltip>`;\n }\n\n toggleField() {\n if (!this.nileSwitchConfig.confirmation) {\n this.nileSwitchConfig = {\n ...this.nileSwitchConfig,\n toggleSwitch: !this.nileSwitchConfig.toggleSwitch,\n };\n }\n this.emit('nile-switch', { config: this.nileSwitchConfig });\n }\n\n singleFieldSwitcher(\n defaultInput: switchInputType,\n switchInput: switchInputType,\n toggleField: boolean,\n disable: boolean\n ) {\n const defaultInputType = defaultInput.inputType;\n const switchInputType = switchInput.inputType;\n return html`\n ${!toggleField\n ? choose(\n defaultInputType,\n [\n [\n INPUT_TYPE_NAMES.TEXT,\n () => this.renderNileText(defaultInput, INPUT_TYPE.DEFAULT),\n ],\n [\n INPUT_TYPE_NAMES.CHECKBOX,\n () => this.renderNileCheckBox(defaultInput, INPUT_TYPE.DEFAULT),\n ],\n [\n INPUT_TYPE_NAMES.TEXTAREA,\n () => this.renderNileTextArea(defaultInput, INPUT_TYPE.DEFAULT),\n ],\n [\n INPUT_TYPE_NAMES.RADIO,\n () => this.renderNileRadio(defaultInput, INPUT_TYPE.DEFAULT),\n ],\n [\n INPUT_TYPE_NAMES.DROPDOWN,\n () =>\n this.renderDropdown(\n this.nileSwitchConfig.defaultInput,\n INPUT_TYPE.DEFAULT\n ),\n ],\n [\n INPUT_TYPE_NAMES.CONTENTEDITOR,\n () =>\n this.renderContentEditor(\n this.nileSwitchConfig.defaultInput,\n INPUT_TYPE.DEFAULT\n ),\n ],\n ],\n () => this.renderNileText(defaultInput, INPUT_TYPE.DEFAULT)\n )\n : choose(\n switchInputType,\n [\n [\n INPUT_TYPE_NAMES.TEXTAREA,\n () => this.renderNileTextArea(switchInput, INPUT_TYPE.SWITCH),\n ],\n [\n INPUT_TYPE_NAMES.TEXT,\n () => this.renderNileText(switchInput, INPUT_TYPE.SWITCH),\n ],\n [\n INPUT_TYPE_NAMES.CONTENTEDITOR,\n () => this.renderContentEditor(switchInput, INPUT_TYPE.SWITCH),\n ],\n ],\n\n () => this.renderNileTextArea(switchInput, INPUT_TYPE.SWITCH)\n )}\n ${!disable ? this.renderIcon(defaultInput, switchInput) : ''}\n `;\n }\n public render(): TemplateResult {\n const {\n toggleSwitch: toggleField,\n defaultInput,\n switchInput,\n disable,\n } = this.nileSwitchConfig;\n\n return html`<div class=\"input-container\">\n ${this.singleFieldSwitcher(\n defaultInput,\n switchInput,\n toggleField,\n !!disable\n )}\n </div>`;\n }\n}\n\nexport default NileSwitcher;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-switcher': NileSwitcher;\n }\n}\n"],"names":["INPUT_TYPE","DEFAULT","SWITCH","INPUT_TYPE_NAMES","DROPDOWN","TEXT","CHECKBOX","TEXTAREA","RADIO","CONTENTEDITOR","_export","NileSwitcher","_n","_inherits","d","_super","_createSuper","_classCallCheck","apply","arguments","_createClass","key","value","connectedCallback","super","this","emit","disconnectedCallback","renderNileText","Input","inputType","label","placeholder","disabled","required","error","errorMessage","inputTypeName","html","_templateObject","_taggedTemplateLiteral","e","handleChange","renderDropdown","_this2","options","multiple","_templateObject2","map","option","_templateObject3","renderNileTextArea","readonly","_templateObject4","renderNileCheckBox","_templateObject5","renderNileRadio","_templateObject6","_templateObject7","renderContentEditor","type","_templateObject8","event","nileSwitchConfig","detail","checked","stopPropagation","config","renderIcon","defaultInput","switchInput","defaultHelperText","helperText","switchHelperText","icon","toggleSwitch","_templateObject9","classMap","toggleField","confirmation","_objectSpread","singleFieldSwitcher","disable","defaultInputType","switchInputType","_templateObject10","choose","render","_this$nileSwitchConfi","_templateObject11","NileElement","styles","__decorate","property","Object","prototype","customElement"],"mappings":"+9KA6DA,CAAA,SAAYA,CACVA,CAAAA,CAAAA,CAAAA,CAAAC,OAAA,CAAA,cAAA,CACAD,EAAAE,MAAA,CAAA,aACD,EAHD,CAAYF,CAAAA,GAAAA,EAGX,CAAA,CAAA,CAAA,CAAA,CAED,SAAYG,CAAAA,CAAAA,CACVA,CAAA,CAAAC,QAAA,CAAA,WACAD,CAAA,CAAAE,IAAA,CAAA,MACAF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AAAA,CAAYiF,EAAA,CADxBI,CAAAA,CAAc,kBACFrF"}
|
1
|
+
{"version":3,"file":"nile-switcher.cjs.js","sources":["../../../src/nile-switcher/nile-switcher.ts"],"sourcesContent":["/**\n * Copyright Aquera Inc 2023\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { html, property, TemplateResult } from 'lit-element';\nimport { customElement } from 'lit/decorators.js';\nimport { styles } from './nile-switcher.css';\nimport NileElement from '../internal/nile-element';\nimport { CSSResultGroup } from 'lit';\nimport { choose } from 'lit/directives/choose.js';\nimport { classMap } from 'lit/directives/class-map.js';\n\n/**\n * @summary Allows you to switch between nile elements\n\n * @dependency nile-icon\n * @dependency nile-input\n * @dependency nile-checkbox\n * @dependency nile-dropdown\n * @dependency nile-textarea\n *\n \n * @event nile-change - Emitted when the control's value changes.\n * @event nile-switch - Emitted when the nile component is being switched.\n \n */\n\nexport interface switchconfig {\n [key: string]: any;\n toggleSwitch: boolean;\n disable?: boolean;\n confirmation?: boolean;\n defaultInput: switchInputType;\n switchInput: switchInputType;\n}\n\nexport interface switchInputType {\n inputType:\n | INPUT_TYPE_NAMES.DROPDOWN\n | INPUT_TYPE_NAMES.TEXT\n | INPUT_TYPE_NAMES.CHECKBOX\n | INPUT_TYPE_NAMES.TEXTAREA\n | INPUT_TYPE_NAMES.RADIO\n | INPUT_TYPE_NAMES.CONTENTEDITOR;\n value?: String | boolean;\n label?: String;\n readonly?: boolean;\n type?: string;\n placeholder?: string;\n disabled?: boolean;\n required?: boolean;\n error?: boolean;\n errorMessage?: string;\n options?: Array<any>;\n helperText?: string;\n multiple?: boolean;\n noborder?: boolean;\n}\n\nexport enum INPUT_TYPE {\n DEFAULT = 'defaultInput',\n SWITCH = 'switchInput',\n}\n\nexport enum INPUT_TYPE_NAMES {\n DROPDOWN = 'dropdown',\n TEXT = 'text',\n CHECKBOX = 'checkbox',\n TEXTAREA = 'text-area',\n RADIO = 'radio',\n CONTENTEDITOR = 'content-editor',\n}\n\n@customElement('nile-switcher')\nexport class NileSwitcher extends NileElement {\n /**\n * The styles for nile switcher\n * @remarks If you are extending this class you can extend the base styles with super. Eg `return [super(), myCustomStyles]`\n */\n static styles: CSSResultGroup = styles;\n @property({ type: Object }) nileSwitchConfig: switchconfig;\n\n connectedCallback() {\n super.connectedCallback();\n this.emit('nile-init');\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n this.emit('nile-destroy');\n }\n\n renderNileText(Input: switchInputType, inputType: string) {\n const {\n value,\n label,\n placeholder,\n disabled,\n required,\n error,\n errorMessage,\n inputType: inputTypeName,\n } = Input;\n return html`<nile-input\n .value=${value}\n .label=${label}\n .disabled=${disabled}\n .required=${required}\n .errorMessage=${errorMessage}\n .placeholder=${placeholder}\n .error=${error}\n @nile-input=${(e: CustomEvent) => {\n this.handleChange(e, inputType, inputTypeName);\n }}\n ></nile-input>`;\n }\n\n renderDropdown(Input: switchInputType, inputType: string) {\n const {\n options,\n multiple,\n placeholder,\n disabled,\n inputType: inputTypeName,\n } = Input;\n return html`<nile-select\n .placeholder=${placeholder}\n .disabled=\"${disabled}\"\n .multiple=\"${multiple}\"\n @nile-change=${(e: CustomEvent) => {\n this.handleChange(e, inputType, inputTypeName);\n }}\n >\n ${options?.map((option: any) => {\n return html`<nile-option .value=\"${option}\">${option} </nile-option>`;\n })}\n </nile-select>`;\n }\n\n renderNileTextArea(Input: switchInputType, inputType: string) {\n const {\n value,\n disabled,\n readonly,\n errorMessage,\n error,\n inputType: inputTypeName,\n } = Input;\n\n return html`<nile-textarea\n .value=${value}\n .disabled=${disabled}\n ?readonly=${readonly}\n .error=${error}\n .errorMessage=${errorMessage}\n @nile-input=${(e: CustomEvent) => {\n this.handleChange(e, inputType, inputTypeName);\n }}\n ></nile-textarea>`;\n }\n\n renderNileCheckBox(Input: switchInputType, inputType: string) {\n const { value, label, disabled, inputType: inputTypeName } = Input;\n\n return html`<nile-checkbox\n .checked=${value}\n .label=${label}\n .disabled=${disabled}\n @valueChange=${(e: CustomEvent) => {\n this.handleChange(e, inputType, inputTypeName);\n }}\n ></nile-checkbox>`;\n }\n\n renderNileRadio(Input: switchInputType, inputType: string) {\n const { options, value, disabled, inputType: inputTypeName } = Input;\n\n return html`<nile-radio-group\n .value=${value}\n .disabled=${disabled}\n @change=${(e: CustomEvent) => {\n this.handleChange(e, inputType, inputTypeName);\n }}\n >\n ${options &&\n options.map((option: any) => {\n return html`<nile-radio .value=\"${option}\">${option} </nile-radio>`;\n })}\n </nile-radio-group>`;\n }\n\n renderContentEditor(Input: switchInputType, inputType: string) {\n const {\n value,\n options,\n inputType: inputTypeName,\n errorMessage,\n type,\n readonly,\n noborder,\n } = Input;\n return html`<nile-content-editor\n .value=${value}\n .options=${options}\n .type=${type}\n .readonly=${readonly}\n .noborder=${noborder}\n .errorMessage=${errorMessage}\n @nile-change=${(e: CustomEvent) => {\n this.handleChange(e, inputType, inputTypeName);\n }}\n >\n </nile-content-editor>`;\n }\n\n handleChange(event: CustomEvent, inputType: string, inputTypeName: string) {\n if (inputTypeName === INPUT_TYPE_NAMES.CHECKBOX) {\n this.nileSwitchConfig[inputType as keyof switchconfig].value =\n event.detail.checked;\n } else {\n this.nileSwitchConfig[inputType as keyof switchconfig].value =\n event.detail.value;\n }\n event.stopPropagation();\n this.emit('nile-change', { config: this.nileSwitchConfig });\n }\n\n renderIcon(defaultInput: switchInputType, switchInput: switchInputType) {\n const defaultHelperText = defaultInput.helperText;\n const switchHelperText = switchInput.helperText;\n\n const icon = !this.nileSwitchConfig.toggleSwitch\n ? 'header-functions'\n : 'stringinput';\n\n const helperText = !this.nileSwitchConfig.toggleSwitch\n ? !!switchHelperText\n ? switchHelperText\n : `switch to ${switchInput.inputType}`\n : !!defaultHelperText\n ? defaultHelperText\n : `switch to ${defaultInput.inputType}`;\n\n return html` <nile-tooltip\n class=${classMap({\n 'tooltip-container': true,\n })}\n content=${helperText}\n placement=\"bottom\"\n >\n <nile-icon\n size=\"14\"\n class=${classMap({\n 'pointer-cursor': true,\n })}\n .name=${icon}\n color=\"#005EA6\"\n @click=${this.toggleField}\n ></nile-icon>\n </nile-tooltip>`;\n }\n\n toggleField() {\n if (!this.nileSwitchConfig.confirmation) {\n this.nileSwitchConfig = {\n ...this.nileSwitchConfig,\n toggleSwitch: !this.nileSwitchConfig.toggleSwitch,\n };\n }\n this.emit('nile-switch', { config: this.nileSwitchConfig });\n }\n\n singleFieldSwitcher(\n defaultInput: switchInputType,\n switchInput: switchInputType,\n toggleField: boolean,\n disable: boolean\n ) {\n const defaultInputType = defaultInput.inputType;\n const switchInputType = switchInput.inputType;\n return html`\n ${!toggleField\n ? choose(\n defaultInputType,\n [\n [\n INPUT_TYPE_NAMES.TEXT,\n () => this.renderNileText(defaultInput, INPUT_TYPE.DEFAULT),\n ],\n [\n INPUT_TYPE_NAMES.CHECKBOX,\n () => this.renderNileCheckBox(defaultInput, INPUT_TYPE.DEFAULT),\n ],\n [\n INPUT_TYPE_NAMES.TEXTAREA,\n () => this.renderNileTextArea(defaultInput, INPUT_TYPE.DEFAULT),\n ],\n [\n INPUT_TYPE_NAMES.RADIO,\n () => this.renderNileRadio(defaultInput, INPUT_TYPE.DEFAULT),\n ],\n [\n INPUT_TYPE_NAMES.DROPDOWN,\n () =>\n this.renderDropdown(\n this.nileSwitchConfig.defaultInput,\n INPUT_TYPE.DEFAULT\n ),\n ],\n [\n INPUT_TYPE_NAMES.CONTENTEDITOR,\n () =>\n this.renderContentEditor(\n this.nileSwitchConfig.defaultInput,\n INPUT_TYPE.DEFAULT\n ),\n ],\n ],\n () => this.renderNileText(defaultInput, INPUT_TYPE.DEFAULT)\n )\n : choose(\n switchInputType,\n [\n [\n INPUT_TYPE_NAMES.TEXTAREA,\n () => this.renderNileTextArea(switchInput, INPUT_TYPE.SWITCH),\n ],\n [\n INPUT_TYPE_NAMES.TEXT,\n () => this.renderNileText(switchInput, INPUT_TYPE.SWITCH),\n ],\n [\n INPUT_TYPE_NAMES.CONTENTEDITOR,\n () => this.renderContentEditor(switchInput, INPUT_TYPE.SWITCH),\n ],\n ],\n\n () => this.renderNileTextArea(switchInput, INPUT_TYPE.SWITCH)\n )}\n ${!disable ? this.renderIcon(defaultInput, switchInput) : ''}\n `;\n }\n public render(): TemplateResult {\n const {\n toggleSwitch: toggleField,\n defaultInput,\n switchInput,\n disable,\n } = this.nileSwitchConfig;\n\n return html`<div class=\"input-container\">\n ${this.singleFieldSwitcher(\n defaultInput,\n switchInput,\n toggleField,\n !!disable\n )}\n </div>`;\n }\n}\n\nexport default NileSwitcher;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-switcher': NileSwitcher;\n }\n}\n"],"names":["INPUT_TYPE","DEFAULT","SWITCH","INPUT_TYPE_NAMES","DROPDOWN","TEXT","CHECKBOX","TEXTAREA","RADIO","CONTENTEDITOR","_export","NileSwitcher","_n","_inherits","d","_super","_createSuper","_classCallCheck","apply","arguments","_createClass","key","value","connectedCallback","super","this","emit","disconnectedCallback","renderNileText","Input","inputType","label","placeholder","disabled","required","error","errorMessage","inputTypeName","html","_templateObject","_taggedTemplateLiteral","e","handleChange","renderDropdown","_this2","options","multiple","_templateObject2","map","option","_templateObject3","renderNileTextArea","readonly","_templateObject4","renderNileCheckBox","_templateObject5","renderNileRadio","_templateObject6","_templateObject7","renderContentEditor","type","noborder","_templateObject8","event","nileSwitchConfig","detail","checked","stopPropagation","config","renderIcon","defaultInput","switchInput","defaultHelperText","helperText","switchHelperText","icon","toggleSwitch","concat","_templateObject9","classMap","toggleField","confirmation","_objectSpread","singleFieldSwitcher","disable","defaultInputType","switchInputType","_templateObject10","choose","render","_this$nileSwitchConfi","_templateObject11","NileElement","styles","__decorate","property","Object","prototype","customElement"],"mappings":"+9KA8DA,CAAA,SAAYA,CACVA,CAAAA,CAAAA,CAAAA,CAAAC,OAAA,CAAA,cAAA,CACAD,EAAAE,MAAA,CAAA,aACD,EAHD,CAAYF,CAAAA,GAAAA,EAGX,CAAA,CAAA,CAAA,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EAAMkF,MAAmBA,CAAAA,CAAAA,CACJC,EAAA,CAA3BC,CAAAA,CAAS,CAAEnC,IAAMoC,CAAAA,MAAAA,CAAAA,CAAAA,CAAAA,CAAyCrF,CAAAsF,CAAAA,SAAAA,CAAA,uBAAA,EANhDtF,CAAAA,CAAAA,OAAAA,KAAAA,CAAAA,CAAYmF,EAAA,CADxBI,CAAAA,CAAc,kBACFvF"}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
System.register(["../index-cd83c5c8.cjs.js"],function(_export,_context){"use strict";var i,_templateObject,
|
1
|
+
System.register(["../index-cd83c5c8.cjs.js"],function(_export,_context){"use strict";var i,_templateObject,o;function _taggedTemplateLiteral(strings,raw){if(!raw){raw=strings.slice(0);}return Object.freeze(Object.defineProperties(strings,{raw:{value:Object.freeze(raw)}}));}return{setters:[function(_index001CjsJs){i=_index001CjsJs.i;}],execute:function(){_export("s",o=i(_templateObject||(_templateObject=_taggedTemplateLiteral(["\n :host {\n display: inline-block;\n width: 100%;\n box-sizing: border-box;\n }\n\n .pointer-cursor {\n cursor: pointer;\n }\n .input-container {\n display: flex;\n gap: 0.5rem;\n }\n\n .tooltip-container {\n display: flex;\n flex-grow: 1;\n flex-shrink: 0;\n }\n\n .input-container > :first-child {\n flex-grow: 1;\n flex-shrink: 0;\n }\n\n nile-radio {\n display: inline-block;\n padding-right: 10px;\n }\n"]))));}};});
|
2
2
|
//# sourceMappingURL=nile-switcher.css.cjs.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"nile-switcher.css.cjs.js","sources":["../../../src/nile-switcher/nile-switcher.css.ts"],"sourcesContent":["/**\n * Copyright Aquera Inc 2023\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { css } from 'lit-element';\n\n/**\n * FieldGenerator CSS\n */\nexport const styles = css`\n :host {\n display: inline-block;\n width: 100%;\n box-sizing: border-box;\n }\n\n .pointer-cursor {\n cursor: pointer;\n }\n .input-container {\n display: flex;\n }\n\n .
|
1
|
+
{"version":3,"file":"nile-switcher.css.cjs.js","sources":["../../../src/nile-switcher/nile-switcher.css.ts"],"sourcesContent":["/**\n * Copyright Aquera Inc 2023\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { css } from 'lit-element';\n\n/**\n * FieldGenerator CSS\n */\nexport const styles = css`\n :host {\n display: inline-block;\n width: 100%;\n box-sizing: border-box;\n }\n\n .pointer-cursor {\n cursor: pointer;\n }\n .input-container {\n display: flex;\n gap: 0.5rem;\n }\n\n .tooltip-container {\n display: flex;\n flex-grow: 1;\n flex-shrink: 0;\n }\n\n .input-container > :first-child {\n flex-grow: 1;\n flex-shrink: 0;\n }\n\n nile-radio {\n display: inline-block;\n padding-right: 10px;\n }\n`;\n\nexport default [styles];\n"],"names":["styles","css","_templateObject","_taggedTemplateLiteral"],"mappings":"gXAYaA,CAAAA,CAASC,CAAG,CAAAC,eAAA,GAAAA,eAAA,CAAAC,sBAAA"}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import{i}from"../index-cd2f9c12.esm.js";const
|
1
|
+
import{i}from"../index-cd2f9c12.esm.js";const o=i`
|
2
2
|
:host {
|
3
3
|
display: inline-block;
|
4
4
|
width: 100%;
|
@@ -10,19 +10,22 @@ import{i}from"../index-cd2f9c12.esm.js";const t=i`
|
|
10
10
|
}
|
11
11
|
.input-container {
|
12
12
|
display: flex;
|
13
|
+
gap: 0.5rem;
|
13
14
|
}
|
14
15
|
|
15
|
-
.
|
16
|
-
|
17
|
-
|
16
|
+
.tooltip-container {
|
17
|
+
display: flex;
|
18
|
+
flex-grow: 1;
|
19
|
+
flex-shrink: 0;
|
18
20
|
}
|
19
|
-
|
20
|
-
|
21
|
-
|
21
|
+
|
22
|
+
.input-container > :first-child {
|
23
|
+
flex-grow: 1;
|
24
|
+
flex-shrink: 0;
|
22
25
|
}
|
23
26
|
|
24
27
|
nile-radio {
|
25
28
|
display: inline-block;
|
26
29
|
padding-right: 10px;
|
27
30
|
}
|
28
|
-
`;export{
|
31
|
+
`;export{o as s};
|
@@ -1,56 +1,61 @@
|
|
1
|
-
import{__decorate as e}from"tslib";import{x as i}from"../index-cd2f9c12.esm.js";import{customElement as t}from"lit/decorators.js";import{s as r}from"./nile-switcher.css.esm.js";import{N as n}from"../internal/nile-element.esm.js";import{choose as s}from"lit/directives/choose.js";import{classMap as
|
1
|
+
import{__decorate as e}from"tslib";import{x as i}from"../index-cd2f9c12.esm.js";import{customElement as t}from"lit/decorators.js";import{s as r}from"./nile-switcher.css.esm.js";import{N as n}from"../internal/nile-element.esm.js";import{choose as s}from"lit/directives/choose.js";import{classMap as o}from"lit/directives/class-map.js";import{n as l}from"../property-09139d3c.esm.js";import"lit";var a,c;!function(e){e.DEFAULT="defaultInput",e.SWITCH="switchInput"}(a||(a={})),function(e){e.DROPDOWN="dropdown",e.TEXT="text",e.CHECKBOX="checkbox",e.TEXTAREA="text-area",e.RADIO="radio",e.CONTENTEDITOR="content-editor"}(c||(c={}));let d=class extends n{connectedCallback(){super.connectedCallback(),this.emit("nile-init")}disconnectedCallback(){super.disconnectedCallback(),this.emit("nile-destroy")}renderNileText(e,t){const{value:r,label:n,placeholder:s,disabled:o,required:l,error:a,errorMessage:c,inputType:d}=e;return i`<nile-input
|
2
2
|
.value=${r}
|
3
3
|
.label=${n}
|
4
|
-
.disabled=${
|
5
|
-
.required=${
|
4
|
+
.disabled=${o}
|
5
|
+
.required=${l}
|
6
6
|
.errorMessage=${c}
|
7
7
|
.placeholder=${s}
|
8
8
|
.error=${a}
|
9
9
|
@nile-input=${e=>{this.handleChange(e,t,d)}}
|
10
|
-
></nile-input>`}renderDropdown(e,t){const{options:r,multiple:n,placeholder:s,disabled:
|
10
|
+
></nile-input>`}renderDropdown(e,t){const{options:r,multiple:n,placeholder:s,disabled:o,inputType:l}=e;return i`<nile-select
|
11
11
|
.placeholder=${s}
|
12
|
-
.disabled="${
|
12
|
+
.disabled="${o}"
|
13
13
|
.multiple="${n}"
|
14
|
-
@nile-change=${e=>{this.handleChange(e,t,
|
14
|
+
@nile-change=${e=>{this.handleChange(e,t,l)}}
|
15
15
|
>
|
16
16
|
${r?.map((e=>i`<nile-option .value="${e}">${e} </nile-option>`))}
|
17
|
-
</nile-select>`}renderNileTextArea(e,t){const{value:r,disabled:n,readonly:s,errorMessage:
|
17
|
+
</nile-select>`}renderNileTextArea(e,t){const{value:r,disabled:n,readonly:s,errorMessage:o,error:l,inputType:a}=e;return i`<nile-textarea
|
18
18
|
.value=${r}
|
19
19
|
.disabled=${n}
|
20
20
|
?readonly=${s}
|
21
|
-
.error=${
|
22
|
-
.errorMessage=${
|
21
|
+
.error=${l}
|
22
|
+
.errorMessage=${o}
|
23
23
|
@nile-input=${e=>{this.handleChange(e,t,a)}}
|
24
|
-
></nile-textarea>`}renderNileCheckBox(e,t){const{value:r,label:n,disabled:s,inputType:
|
24
|
+
></nile-textarea>`}renderNileCheckBox(e,t){const{value:r,label:n,disabled:s,inputType:o}=e;return i`<nile-checkbox
|
25
25
|
.checked=${r}
|
26
26
|
.label=${n}
|
27
27
|
.disabled=${s}
|
28
|
-
@valueChange=${e=>{this.handleChange(e,t,
|
29
|
-
></nile-checkbox>`}renderNileRadio(e,t){const{options:r,value:n,disabled:s,inputType:
|
28
|
+
@valueChange=${e=>{this.handleChange(e,t,o)}}
|
29
|
+
></nile-checkbox>`}renderNileRadio(e,t){const{options:r,value:n,disabled:s,inputType:o}=e;return i`<nile-radio-group
|
30
30
|
.value=${n}
|
31
31
|
.disabled=${s}
|
32
|
-
@change=${e=>{this.handleChange(e,t,
|
32
|
+
@change=${e=>{this.handleChange(e,t,o)}}
|
33
33
|
>
|
34
34
|
${r&&r.map((e=>i`<nile-radio .value="${e}">${e} </nile-radio>`))}
|
35
|
-
</nile-radio-group>`}renderContentEditor(e,t){const{value:r,options:n,inputType:s,errorMessage:
|
35
|
+
</nile-radio-group>`}renderContentEditor(e,t){const{value:r,options:n,inputType:s,errorMessage:o,type:l,readonly:a,noborder:c}=e;return i`<nile-content-editor
|
36
36
|
.value=${r}
|
37
37
|
.options=${n}
|
38
|
-
.type=${
|
38
|
+
.type=${l}
|
39
39
|
.readonly=${a}
|
40
|
-
.
|
40
|
+
.noborder=${c}
|
41
|
+
.errorMessage=${o}
|
41
42
|
@nile-change=${e=>{this.handleChange(e,t,s)}}
|
42
43
|
>
|
43
|
-
</nile-content-editor>`}handleChange(e,i,t){t===c.CHECKBOX?this.nileSwitchConfig[i].value=e.detail.checked:this.nileSwitchConfig[i].value=e.detail.value,e.stopPropagation(),this.emit("nile-change",{config:this.nileSwitchConfig})}renderIcon(e,t){const r=e.helperText,n=t.helperText,s=this.nileSwitchConfig.toggleSwitch?"stringinput":"header-functions",
|
44
|
+
</nile-content-editor>`}handleChange(e,i,t){t===c.CHECKBOX?this.nileSwitchConfig[i].value=e.detail.checked:this.nileSwitchConfig[i].value=e.detail.value,e.stopPropagation(),this.emit("nile-change",{config:this.nileSwitchConfig})}renderIcon(e,t){const r=e.helperText,n=t.helperText,s=this.nileSwitchConfig.toggleSwitch?"stringinput":"header-functions",l=this.nileSwitchConfig.toggleSwitch?r||`switch to ${e.inputType}`:n||`switch to ${t.inputType}`;return i` <nile-tooltip
|
45
|
+
class=${o({"tooltip-container":!0})}
|
46
|
+
content=${l}
|
47
|
+
placement="bottom"
|
48
|
+
>
|
44
49
|
<nile-icon
|
45
50
|
size="14"
|
46
|
-
class=${
|
51
|
+
class=${o({"pointer-cursor":!0})}
|
47
52
|
.name=${s}
|
48
53
|
color="#005EA6"
|
49
54
|
@click=${this.toggleField}
|
50
55
|
></nile-icon>
|
51
|
-
</nile-tooltip>`}toggleField(){this.nileSwitchConfig.confirmation||(this.nileSwitchConfig={...this.nileSwitchConfig,toggleSwitch:!this.nileSwitchConfig.toggleSwitch}),this.emit("nile-switch",{config:this.nileSwitchConfig})}singleFieldSwitcher(e,t,r,n){const
|
52
|
-
${r?s(
|
56
|
+
</nile-tooltip>`}toggleField(){this.nileSwitchConfig.confirmation||(this.nileSwitchConfig={...this.nileSwitchConfig,toggleSwitch:!this.nileSwitchConfig.toggleSwitch}),this.emit("nile-switch",{config:this.nileSwitchConfig})}singleFieldSwitcher(e,t,r,n){const o=e.inputType,l=t.inputType;return i`
|
57
|
+
${r?s(l,[[c.TEXTAREA,()=>this.renderNileTextArea(t,a.SWITCH)],[c.TEXT,()=>this.renderNileText(t,a.SWITCH)],[c.CONTENTEDITOR,()=>this.renderContentEditor(t,a.SWITCH)]],(()=>this.renderNileTextArea(t,a.SWITCH))):s(o,[[c.TEXT,()=>this.renderNileText(e,a.DEFAULT)],[c.CHECKBOX,()=>this.renderNileCheckBox(e,a.DEFAULT)],[c.TEXTAREA,()=>this.renderNileTextArea(e,a.DEFAULT)],[c.RADIO,()=>this.renderNileRadio(e,a.DEFAULT)],[c.DROPDOWN,()=>this.renderDropdown(this.nileSwitchConfig.defaultInput,a.DEFAULT)],[c.CONTENTEDITOR,()=>this.renderContentEditor(this.nileSwitchConfig.defaultInput,a.DEFAULT)]],(()=>this.renderNileText(e,a.DEFAULT)))}
|
53
58
|
${n?"":this.renderIcon(e,t)}
|
54
59
|
`}render(){const{toggleSwitch:e,defaultInput:t,switchInput:r,disable:n}=this.nileSwitchConfig;return i`<div class="input-container">
|
55
60
|
${this.singleFieldSwitcher(t,r,e,!!n)}
|
56
|
-
</div>`}};d.styles=r,e([
|
61
|
+
</div>`}};d.styles=r,e([l({type:Object})],d.prototype,"nileSwitchConfig",void 0),d=e([t("nile-switcher")],d);export{d as N};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"nile-content-editor.css.js","sourceRoot":"","sources":["../../../src/nile-content-editor/nile-content-editor.css.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAElC;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA
|
1
|
+
{"version":3,"file":"nile-content-editor.css.js","sourceRoot":"","sources":["../../../src/nile-content-editor/nile-content-editor.css.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAElC;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0FxB,CAAC;AAEF,eAAe,CAAC,MAAM,CAAC,CAAC","sourcesContent":["/**\n * Copyright Aquera Inc 2023\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { css } from 'lit-element';\n\n/**\n * AttributeExpression CSS\n */\nexport const styles = css`\n :host {\n width: 100%;\n box-sizing: border-box;\n font-size: 14px;\n }\n\n .content-editable-wrapper {\n position: relative;\n width: 100%;\n box-sizing: border-box;\n }\n\n .dropdown-position {\n position: relative;\n bottom: 20px;\n }\n .content-editable-input {\n box-sizing: border-box;\n width: 100%;\n padding: 9px;\n border: 1px solid #c7ced4;\n border-radius: 4px;\n overflow-x: auto;\n overflow-anchor: none;\n scrollbar-width: none;\n -ms-overflow-style: none;\n cursor: text;\n white-space: nowrap;\n background-color: #ffffff;\n height: 38px;\n }\n .content-editable-input:focus {\n outline: none;\n }\n\n .error {\n border-color: #e5434d;\n }\n\n .read-only {\n cursor: not-allowed;\n }\n\n .chips {\n display: inline;\n background: #e5e9eb;\n color: #000;\n border-radius: 4px;\n padding: 6px;\n height: 24px;\n line-height: 10px;\n margin-left: 3px;\n letter-spacing: 0.2px;\n }\n\n .text-area {\n height: 120px;\n overflow: scroll;\n line-height: 26px;\n }\n\n .text-area .chips {\n padding: 4px 8px;\n }\n\n .chip-error {\n background: #f3a5aa;\n }\n .nile-options-container {\n box-sizing: border-box;\n background-color: #ffffff;\n border: 1px solid #c7ced4;\n overflow: auto;\n max-height: 150px;\n }\n\n label {\n display: inline-block;\n margin-bottom: 6px;\n font-family: 'colfax-medium';\n }\n\n .asterik {\n color: #e5434d;\n }\n\n .no-border {\n border: none;\n }\n`;\n\nexport default [styles];\n"]}
|