@aquera/nile-elements 0.1.73-beta-1.9 → 0.1.74-beta-1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/README.md +5 -0
  2. package/demo/index.html +24 -21
  3. package/dist/index.js +21 -10
  4. package/dist/nile-filter-chip/nile-filter-chip.cjs.js +1 -1
  5. package/dist/nile-filter-chip/nile-filter-chip.cjs.js.map +1 -1
  6. package/dist/nile-filter-chip/nile-filter-chip.css.cjs.js +1 -1
  7. package/dist/nile-filter-chip/nile-filter-chip.css.cjs.js.map +1 -1
  8. package/dist/nile-filter-chip/nile-filter-chip.css.esm.js +10 -0
  9. package/dist/nile-filter-chip/nile-filter-chip.esm.js +1 -1
  10. package/dist/nile-input/nile-input.cjs.js +1 -1
  11. package/dist/nile-input/nile-input.cjs.js.map +1 -1
  12. package/dist/nile-input/nile-input.esm.js +2 -2
  13. package/dist/nile-option-group/nile-option-group.cjs.js +1 -1
  14. package/dist/nile-option-group/nile-option-group.cjs.js.map +1 -1
  15. package/dist/nile-option-group/nile-option-group.esm.js +1 -1
  16. package/dist/nile-radio/nile-radio.cjs.js +1 -1
  17. package/dist/nile-radio/nile-radio.cjs.js.map +1 -1
  18. package/dist/nile-radio/nile-radio.esm.js +2 -2
  19. package/dist/nile-radio-group/nile-radio-group.cjs.js +1 -1
  20. package/dist/nile-radio-group/nile-radio-group.cjs.js.map +1 -1
  21. package/dist/nile-radio-group/nile-radio-group.esm.js +2 -2
  22. package/dist/nile-select/nile-select.cjs.js +1 -1
  23. package/dist/nile-select/nile-select.cjs.js.map +1 -1
  24. package/dist/nile-select/nile-select.esm.js +3 -2
  25. package/dist/src/nile-filter-chip/nile-filter-chip.css.js +10 -0
  26. package/dist/src/nile-filter-chip/nile-filter-chip.css.js.map +1 -1
  27. package/dist/src/nile-filter-chip/nile-filter-chip.js +1 -1
  28. package/dist/src/nile-filter-chip/nile-filter-chip.js.map +1 -1
  29. package/dist/src/nile-input/nile-input.d.ts +1 -0
  30. package/dist/src/nile-input/nile-input.js +4 -1
  31. package/dist/src/nile-input/nile-input.js.map +1 -1
  32. package/dist/src/nile-option-group/nile-option-group.js +1 -1
  33. package/dist/src/nile-option-group/nile-option-group.js.map +1 -1
  34. package/dist/src/nile-radio/nile-radio.d.ts +1 -0
  35. package/dist/src/nile-radio/nile-radio.js +8 -1
  36. package/dist/src/nile-radio/nile-radio.js.map +1 -1
  37. package/dist/src/nile-radio-group/nile-radio-group.d.ts +4 -1
  38. package/dist/src/nile-radio-group/nile-radio-group.js +25 -2
  39. package/dist/src/nile-radio-group/nile-radio-group.js.map +1 -1
  40. package/dist/src/nile-select/nile-select.d.ts +4 -1
  41. package/dist/src/nile-select/nile-select.js +13 -1
  42. package/dist/src/nile-select/nile-select.js.map +1 -1
  43. package/dist/tsconfig.tsbuildinfo +1 -1
  44. package/package.json +1 -1
  45. package/src/nile-filter-chip/nile-filter-chip.css.ts +10 -0
  46. package/src/nile-filter-chip/nile-filter-chip.ts +1 -1
  47. package/src/nile-input/nile-input.ts +5 -1
  48. package/src/nile-option-group/nile-option-group.ts +1 -1
  49. package/src/nile-radio/nile-radio.ts +7 -1
  50. package/src/nile-radio-group/nile-radio-group.ts +26 -4
  51. package/src/nile-select/nile-select.ts +13 -3
  52. package/vscode-html-custom-data.json +18 -3
@@ -1,2 +1,2 @@
1
- function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o;}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o;},_typeof(o);}System.register(["tslib","lit","lit/decorators.js","./nile-radio.css.cjs.js","lit/directives/class-map.js","../internal/watch.cjs.js","../internal/nile-element.cjs.js"],function(_export,_context){"use strict";var i,s,t,e,a,h,l,r,o,_templateObject,_templateObject2,d;function _taggedTemplateLiteral(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}));}function _classCallCheck(a,n){if(!(a instanceof n))throw new TypeError("Cannot call a class as a function");}function _defineProperties(e,r){for(var t=0;t<r.length;t++){var o=r[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,_toPropertyKey(o.key),o);}}function _createClass(e,r,t){return r&&_defineProperties(e.prototype,r),t&&_defineProperties(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e;}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return"symbol"==_typeof(i)?i:i+"";}function _toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.");}return("string"===r?String:Number)(t);}function _callSuper(t,o,e){return o=_getPrototypeOf(o),_possibleConstructorReturn(t,_isNativeReflectConstruct()?Reflect.construct(o,e||[],_getPrototypeOf(t).constructor):o.apply(t,e));}function _possibleConstructorReturn(t,e){if(e&&("object"==_typeof(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(t);}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e;}function _isNativeReflectConstruct(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(t){}return(_isNativeReflectConstruct=function _isNativeReflectConstruct(){return!!t;})();}function _superPropGet(t,o,e,r){var p=_get(_getPrototypeOf(1&r?t.prototype:t),o,e);return 2&r&&"function"==typeof p?function(t){return p.apply(e,t);}:p;}function _get(){return _get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var p=_superPropBase(e,t);if(p){var n=Object.getOwnPropertyDescriptor(p,t);return n.get?n.get.call(arguments.length<3?e:r):n.value;}},_get.apply(null,arguments);}function _superPropBase(t,o){for(;!{}.hasOwnProperty.call(t,o)&&null!==(t=_getPrototypeOf(t)););return t;}function _getPrototypeOf(t){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t);},_getPrototypeOf(t);}function _inherits(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&_setPrototypeOf(t,e);}function _setPrototypeOf(t,e){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t;},_setPrototypeOf(t,e);}return{setters:[function(_tslib){i=_tslib.__decorate;},function(_lit){s=_lit.html;},function(_litDecoratorsJs){t=_litDecoratorsJs.property;e=_litDecoratorsJs.state;a=_litDecoratorsJs.customElement;},function(_nileRadioCssCjsJs){h=_nileRadioCssCjsJs.s;},function(_litDirectivesClassMapJs){l=_litDirectivesClassMapJs.classMap;},function(_internalWatchCjsJs){r=_internalWatchCjsJs.w;},function(_internalNileElementCjsJs){o=_internalNileElementCjsJs.N;}],execute:function execute(){_export("N",d=/*#__PURE__*/function(_o){function d(){var _this;_classCallCheck(this,d);_this=_callSuper(this,d,arguments),_this.checked=!1,_this.hasFocus=!1,_this.value="",_this.size="medium",_this.disabled=!1,_this.islabelborder=!1;return _this;}_inherits(d,_o);return _createClass(d,[{key:"connectedCallback",value:function connectedCallback(){_superPropGet(d,"connectedCallback",this,3)([]),this.handleBlur=this.handleBlur.bind(this),this.handleClick=this.handleClick.bind(this),this.handleFocus=this.handleFocus.bind(this),this.setInitialAttributes(),this.addEventListeners(),this.emit("nile-init");}},{key:"disconnectedCallback",value:function disconnectedCallback(){this.removeEventListeners(),this.emit("nile-destroy");}},{key:"addEventListeners",value:function addEventListeners(){this.addEventListener("blur",this.handleBlur),this.addEventListener("click",this.handleClick),this.addEventListener("focus",this.handleFocus);}},{key:"removeEventListeners",value:function removeEventListeners(){this.removeEventListener("blur",this.handleBlur),this.removeEventListener("click",this.handleClick),this.removeEventListener("focus",this.handleFocus);}},{key:"handleBlur",value:function handleBlur(){this.hasFocus=!1,this.emit("nile-blur");}},{key:"handleClick",value:function handleClick(){this.disabled||(this.checked=!0);}},{key:"handleFocus",value:function handleFocus(){this.hasFocus=!0,this.emit("nile-focus");}},{key:"setInitialAttributes",value:function setInitialAttributes(){this.setAttribute("role","radio"),this.setAttribute("tabindex","-1"),this.setAttribute("aria-disabled",this.disabled?"true":"false");}},{key:"handleCheckedChange",value:function handleCheckedChange(){this.setAttribute("aria-checked",this.checked?"true":"false"),this.setAttribute("tabindex",this.checked?"0":"-1");}},{key:"handleDisabledChange",value:function handleDisabledChange(){this.setAttribute("aria-disabled",this.disabled?"true":"false");}},{key:"render",value:function render(){return s(_templateObject||(_templateObject=_taggedTemplateLiteral(["\n <span\n part=\"base\"\n class=","\n >\n <span part=\"","\" class=\"radio__control\">\n ","\n </span>\n\n <slot part=\"label\" class=\"radio__label\"></slot>\n </span>\n "])),l({radio:!0,"radio--checked":this.checked,"radio--disabled":this.disabled,"radio--focused":this.hasFocus,"radio--medium":"medium"===this.size,radio__label_border:this.islabelborder}),"control"+(this.checked?" control--checked":""),this.checked?s(_templateObject2||(_templateObject2=_taggedTemplateLiteral([" <span class=\"radio__checked-icon\"></span> "]))):"");}}]);}(o));d.styles=h,i([t({type:Boolean})],d.prototype,"checked",void 0),i([e()],d.prototype,"hasFocus",void 0),i([t()],d.prototype,"value",void 0),i([t({reflect:!0})],d.prototype,"size",void 0),i([t({type:Boolean,reflect:!0})],d.prototype,"disabled",void 0),i([t({type:Boolean,reflect:!0})],d.prototype,"islabelborder",void 0),i([r("checked")],d.prototype,"handleCheckedChange",null),i([r("disabled",{waitUntilFirstUpdate:!0})],d.prototype,"handleDisabledChange",null),_export("N",d=i([a("nile-radio")],d));}};});
1
+ function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o;}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o;},_typeof(o);}System.register(["tslib","lit","lit/decorators.js","./nile-radio.css.cjs.js","lit/directives/class-map.js","../internal/watch.cjs.js","../internal/nile-element.cjs.js"],function(_export,_context){"use strict";var i,s,t,e,a,h,l,r,o,_templateObject,_templateObject2,d;function _taggedTemplateLiteral(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}));}function _classCallCheck(a,n){if(!(a instanceof n))throw new TypeError("Cannot call a class as a function");}function _defineProperties(e,r){for(var t=0;t<r.length;t++){var o=r[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,_toPropertyKey(o.key),o);}}function _createClass(e,r,t){return r&&_defineProperties(e.prototype,r),t&&_defineProperties(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e;}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return"symbol"==_typeof(i)?i:i+"";}function _toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.");}return("string"===r?String:Number)(t);}function _callSuper(t,o,e){return o=_getPrototypeOf(o),_possibleConstructorReturn(t,_isNativeReflectConstruct()?Reflect.construct(o,e||[],_getPrototypeOf(t).constructor):o.apply(t,e));}function _possibleConstructorReturn(t,e){if(e&&("object"==_typeof(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(t);}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e;}function _isNativeReflectConstruct(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(t){}return(_isNativeReflectConstruct=function _isNativeReflectConstruct(){return!!t;})();}function _superPropGet(t,o,e,r){var p=_get(_getPrototypeOf(1&r?t.prototype:t),o,e);return 2&r&&"function"==typeof p?function(t){return p.apply(e,t);}:p;}function _get(){return _get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var p=_superPropBase(e,t);if(p){var n=Object.getOwnPropertyDescriptor(p,t);return n.get?n.get.call(arguments.length<3?e:r):n.value;}},_get.apply(null,arguments);}function _superPropBase(t,o){for(;!{}.hasOwnProperty.call(t,o)&&null!==(t=_getPrototypeOf(t)););return t;}function _getPrototypeOf(t){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t);},_getPrototypeOf(t);}function _inherits(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&_setPrototypeOf(t,e);}function _setPrototypeOf(t,e){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t;},_setPrototypeOf(t,e);}return{setters:[function(_tslib){i=_tslib.__decorate;},function(_lit){s=_lit.html;},function(_litDecoratorsJs){t=_litDecoratorsJs.property;e=_litDecoratorsJs.state;a=_litDecoratorsJs.customElement;},function(_nileRadioCssCjsJs){h=_nileRadioCssCjsJs.s;},function(_litDirectivesClassMapJs){l=_litDirectivesClassMapJs.classMap;},function(_internalWatchCjsJs){r=_internalWatchCjsJs.w;},function(_internalNileElementCjsJs){o=_internalNileElementCjsJs.N;}],execute:function execute(){_export("N",d=/*#__PURE__*/function(_o){function d(){var _this;_classCallCheck(this,d);_this=_callSuper(this,d,arguments),_this.checked=!1,_this.hasFocus=!1,_this.value="",_this.size="medium",_this.disabled=!1,_this.islabelborder=!1,_this.allowUncheck=!1;return _this;}_inherits(d,_o);return _createClass(d,[{key:"connectedCallback",value:function connectedCallback(){_superPropGet(d,"connectedCallback",this,3)([]),this.handleBlur=this.handleBlur.bind(this),this.handleClick=this.handleClick.bind(this),this.handleFocus=this.handleFocus.bind(this),this.setInitialAttributes(),this.addEventListeners(),this.emit("nile-init");}},{key:"disconnectedCallback",value:function disconnectedCallback(){this.removeEventListeners(),this.emit("nile-destroy");}},{key:"addEventListeners",value:function addEventListeners(){this.addEventListener("blur",this.handleBlur),this.addEventListener("click",this.handleClick),this.addEventListener("focus",this.handleFocus);}},{key:"removeEventListeners",value:function removeEventListeners(){this.removeEventListener("blur",this.handleBlur),this.removeEventListener("click",this.handleClick),this.removeEventListener("focus",this.handleFocus);}},{key:"handleBlur",value:function handleBlur(){this.hasFocus=!1,this.emit("nile-blur");}},{key:"handleClick",value:function handleClick(){this.allowUncheck&&!this.disabled?this.checked=!this.checked:this.disabled||(this.checked=!0);}},{key:"handleFocus",value:function handleFocus(){this.hasFocus=!0,this.emit("nile-focus");}},{key:"setInitialAttributes",value:function setInitialAttributes(){this.setAttribute("role","radio"),this.setAttribute("tabindex","-1"),this.setAttribute("aria-disabled",this.disabled?"true":"false");}},{key:"handleCheckedChange",value:function handleCheckedChange(){this.setAttribute("aria-checked",this.checked?"true":"false"),this.setAttribute("tabindex",this.checked?"0":"-1");}},{key:"handleDisabledChange",value:function handleDisabledChange(){this.setAttribute("aria-disabled",this.disabled?"true":"false");}},{key:"render",value:function render(){return s(_templateObject||(_templateObject=_taggedTemplateLiteral(["\n <span\n part=\"base\"\n class=","\n >\n <span part=\"","\" class=\"radio__control\">\n ","\n </span>\n\n <slot part=\"label\" class=\"radio__label\"></slot>\n </span>\n "])),l({radio:!0,"radio--checked":this.checked,"radio--disabled":this.disabled,"radio--focused":this.hasFocus,"radio--medium":"medium"===this.size,radio__label_border:this.islabelborder}),"control"+(this.checked?" control--checked":""),this.checked?s(_templateObject2||(_templateObject2=_taggedTemplateLiteral([" <span class=\"radio__checked-icon\"></span> "]))):"");}}]);}(o));d.styles=h,i([t({type:Boolean})],d.prototype,"checked",void 0),i([e()],d.prototype,"hasFocus",void 0),i([t()],d.prototype,"value",void 0),i([t({reflect:!0})],d.prototype,"size",void 0),i([t({type:Boolean,reflect:!0})],d.prototype,"disabled",void 0),i([t({type:Boolean,reflect:!0})],d.prototype,"islabelborder",void 0),i([t({type:Boolean,reflect:!0})],d.prototype,"allowUncheck",void 0),i([r("checked")],d.prototype,"handleCheckedChange",null),i([r("disabled",{waitUntilFirstUpdate:!0})],d.prototype,"handleDisabledChange",null),_export("N",d=i([a("nile-radio")],d));}};});
2
2
  //# sourceMappingURL=nile-radio.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"nile-radio.cjs.js","sources":["../../../src/nile-radio/nile-radio.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 {LitElement, html, CSSResultArray, TemplateResult} from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport {styles} from './nile-radio.css';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { state } from 'lit/decorators.js';\nimport { watch } from '../internal/watch';\nimport NileElement from '../internal/nile-element';\nimport type { CSSResultGroup } from 'lit';\n/**\n * Nile icon component.\n *\n * @tag nile-radio\n *\n *\n* @dependency nile-icon\n *\n * @slot - The radio's label.\n *\n * @event blur - Emitted when the control loses focus.\n * @event focus - Emitted when the control gains focus.\n *\n * @csspart base - The component's base wrapper.\n * @csspart control - The circular container that wraps the radio's checked state.\n * @csspart control--checked - The radio control when the radio is checked.\n * @csspart checked-icon - The checked icon, an `<nile-icon>` element.\n * @csspart label - The container that wraps the radio's label.\n */\n@customElement('nile-radio')\nexport class NileRadio extends NileElement {\n static styles: CSSResultGroup = styles;\n\n @property({type:Boolean}) checked = false;\n @state() protected hasFocus = false;\n\n /** The radio's value. When selected, the radio group will receive this value. */\n @property() value: string = '';\n\n /** The radio's size. */\n @property({ reflect: true }) size: 'small' | 'medium' | 'large' = 'medium';\n\n /** Disables the radio. */\n @property({ type: Boolean, reflect: true }) disabled = false;\n\n /** The radio's labelborder. */\n @property({ type: Boolean, reflect: true }) islabelborder = false;\n\n connectedCallback() {\n super.connectedCallback();\n this.handleBlur = this.handleBlur.bind(this);\n this.handleClick = this.handleClick.bind(this);\n this.handleFocus = this.handleFocus.bind(this);\n\n this.setInitialAttributes();\n this.addEventListeners();\n this.emit('nile-init');\n }\n\n disconnectedCallback() {\n this.removeEventListeners();\n this.emit('nile-destroy');\n }\n\n private addEventListeners() {\n this.addEventListener('blur', this.handleBlur);\n this.addEventListener('click', this.handleClick);\n this.addEventListener('focus', this.handleFocus);\n }\n\n private removeEventListeners() {\n this.removeEventListener('blur', this.handleBlur);\n this.removeEventListener('click', this.handleClick);\n this.removeEventListener('focus', this.handleFocus);\n }\n\n private handleBlur() {\n this.hasFocus = false;\n this.emit('nile-blur')\n }\n\n private handleClick() {\n if (!this.disabled) {\n this.checked = true;\n }\n }\n\n private handleFocus() {\n this.hasFocus = true;\n this.emit('nile-focus')\n }\n\n private setInitialAttributes() {\n this.setAttribute('role', 'radio');\n this.setAttribute('tabindex', '-1');\n this.setAttribute('aria-disabled', this.disabled ? 'true' : 'false');\n }\n\n @watch('checked')\n handleCheckedChange() {\n this.setAttribute('aria-checked', this.checked ? 'true' : 'false');\n this.setAttribute('tabindex', this.checked ? '0' : '-1');\n }\n\n @watch('disabled', { waitUntilFirstUpdate: true })\n handleDisabledChange() {\n this.setAttribute('aria-disabled', this.disabled ? 'true' : 'false');\n }\n\n render() {\n return html`\n <span\n part=\"base\"\n class=${classMap({\n radio: true,\n 'radio--checked': this.checked,\n 'radio--disabled': this.disabled,\n 'radio--focused': this.hasFocus,\n 'radio--medium': this.size === 'medium',\n 'radio__label_border':this.islabelborder\n })}\n >\n <span part=\"${`control${this.checked ? ' control--checked' : ''}`}\" class=\"radio__control\">\n ${this.checked\n ? html` <span class=\"radio__checked-icon\"></span> `\n : ''}\n </span>\n\n <slot part=\"label\" class=\"radio__label\"></slot>\n </span>\n `;\n }\n}\n\nexport default NileRadio;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-radio': NileRadio;\n }\n}\n"],"names":["NileRadio","d","this","checked","hasFocus","value","size","disabled","islabelborder","_this","_inherits","_o","_createClass","key","connectedCallback","super","handleBlur","bind","handleClick","handleFocus","setInitialAttributes","addEventListeners","emit","disconnectedCallback","removeEventListeners","addEventListener","removeEventListener","setAttribute","handleCheckedChange","handleDisabledChange","render","html","_templateObject","_taggedTemplateLiteral","classMap","radio","radio__label_border","_templateObject2","NileElement","styles","__decorate","property","type","Boolean","prototype","state","reflect","watch","waitUntilFirstUpdate","customElement"],"mappings":"+2HAmCaA,4BAAN,SAAAC,EAAA,uEAGqBC,KAAAA,CAAOC,OAAAA,CAAAA,CAAG,EACjBD,KAAAA,CAAQE,QAAAA,CAAAA,CAAG,EAGlBF,KAAAA,CAAKG,KAAAA,CAAW,GAGCH,KAAAA,CAAII,IAAAA,CAAiC,SAGtBJ,KAAAA,CAAQK,QAAAA,CAAAA,CAAG,EAGXL,KAAAA,CAAaM,aAAAA,CAAAA,CAAG,CAsF7D,QAAAC,KAAA,EApFCC,SAAA,CAAAT,CAAA,CAAAU,EAAA,SAAAC,YAAA,CAAAX,CAAA,GAAAY,GAAA,qBAAAR,KAAA,UAAAS,iBAAAA,CAAAA,EACEC,aAAAA,CAAAA,CAAAA,iCACAb,KAAKc,UAAad,CAAAA,IAAAA,CAAKc,WAAWC,IAAKf,CAAAA,IAAAA,CAAAA,CACvCA,KAAKgB,WAAchB,CAAAA,IAAAA,CAAKgB,YAAYD,IAAKf,CAAAA,IAAAA,CAAAA,CACzCA,KAAKiB,WAAcjB,CAAAA,IAAAA,CAAKiB,YAAYF,IAAKf,CAAAA,IAAAA,CAAAA,CAEzCA,KAAKkB,oBACLlB,CAAAA,CAAAA,CAAAA,IAAAA,CAAKmB,oBACLnB,IAAKoB,CAAAA,IAAAA,CAAK,YACX,EAED,GAAAT,GAAA,wBAAAR,KAAA,UAAAkB,oBAAAA,CAAAA,EACEr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AAlBK,CAAmC7C,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAA4C,UAAA,UAAA,CAAA,IAAA,EAAA,CAAA,CAGxBJ,CAAA,CAAA,CAAXC,KAA8BzC,CAAA4C,CAAAA,SAAAA,CAAA,YAAA,EAGFJ,CAAAA,CAAAA,CAAAA,CAAA,CAA5BC,CAAS,CAAA,CAAEK,OAAS,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAsD9C,EAAA4C,SAAA,CAAA,MAAA,CAAA,IAAA,IAG/BJ,CAAA,CAAA,CAA3CC,EAAS,CAAEC,IAAAA,CAAMC,OAASG,CAAAA,OAAAA,CAAAA,CAAS,KAAyB9C,CAAA4C,CAAAA,SAAAA,CAAA,eAAA,EAGjBJ,CAAAA,CAAAA,CAAAA,CAAA,CAA3CC,CAAS,CAAA,CAAEC,IAAMC,CAAAA,OAAAA,CAASG,SAAS,CAA8B9C,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAA4C,UAAA,eAAA,CAAA,IAAA,EAAA,CAAA,CAqDlEJ,EAAA,CADCO,CAAAA,CAAM,SAIN/C,CAAAA,CAAAA,CAAAA,CAAAA,CAAA4C,UAAA,qBAAA,CAAA,IAAA,CAAA,CAGDJ,EAAA,CADCO,CAAAA,CAAM,WAAY,CAAEC,oBAAAA,CAAAA,CAAsB,KAG1ChD,CAAA4C,CAAAA,SAAAA,CAAA,uBAAA,IA7EU5C,CAAAA,CAAAA,OAAAA,KAAAA,CAAAA,CAASwC,EAAA,CADrBS,CAAAA,CAAc,eACFjD"}
1
+ {"version":3,"file":"nile-radio.cjs.js","sources":["../../../src/nile-radio/nile-radio.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 {LitElement, html, CSSResultArray, TemplateResult} from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport {styles} from './nile-radio.css';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { state } from 'lit/decorators.js';\nimport { watch } from '../internal/watch';\nimport NileElement from '../internal/nile-element';\nimport type { CSSResultGroup } from 'lit';\n/**\n * Nile icon component.\n *\n * @tag nile-radio\n *\n *\n* @dependency nile-icon\n *\n * @slot - The radio's label.\n *\n * @event blur - Emitted when the control loses focus.\n * @event focus - Emitted when the control gains focus.\n *\n * @csspart base - The component's base wrapper.\n * @csspart control - The circular container that wraps the radio's checked state.\n * @csspart control--checked - The radio control when the radio is checked.\n * @csspart checked-icon - The checked icon, an `<nile-icon>` element.\n * @csspart label - The container that wraps the radio's label.\n */\n@customElement('nile-radio')\nexport class NileRadio extends NileElement {\n static styles: CSSResultGroup = styles;\n\n @property({type:Boolean}) checked = false;\n @state() protected hasFocus = false;\n\n /** The radio's value. When selected, the radio group will receive this value. */\n @property() value: string = '';\n\n /** The radio's size. */\n @property({ reflect: true }) size: 'small' | 'medium' | 'large' = 'medium';\n\n /** Disables the radio. */\n @property({ type: Boolean, reflect: true }) disabled = false;\n\n /** The radio's labelborder. */\n @property({ type: Boolean, reflect: true }) islabelborder = false;\n\n \n @property({ type: Boolean, reflect: true }) allowUncheck = false;\n\n connectedCallback() {\n super.connectedCallback();\n this.handleBlur = this.handleBlur.bind(this);\n this.handleClick = this.handleClick.bind(this);\n this.handleFocus = this.handleFocus.bind(this);\n\n this.setInitialAttributes();\n this.addEventListeners();\n this.emit('nile-init');\n }\n\n disconnectedCallback() {\n this.removeEventListeners();\n this.emit('nile-destroy');\n }\n\n private addEventListeners() {\n this.addEventListener('blur', this.handleBlur);\n this.addEventListener('click', this.handleClick);\n this.addEventListener('focus', this.handleFocus);\n }\n\n private removeEventListeners() {\n this.removeEventListener('blur', this.handleBlur);\n this.removeEventListener('click', this.handleClick);\n this.removeEventListener('focus', this.handleFocus);\n }\n\n private handleBlur() {\n this.hasFocus = false;\n this.emit('nile-blur')\n }\n\n private handleClick() {\n\n if(this.allowUncheck && !this.disabled) {\n this.checked = !this.checked;\n } else if (!this.disabled) {\n this.checked = true;\n }\n }\n\n private handleFocus() {\n this.hasFocus = true;\n this.emit('nile-focus')\n }\n\n private setInitialAttributes() {\n this.setAttribute('role', 'radio');\n this.setAttribute('tabindex', '-1');\n this.setAttribute('aria-disabled', this.disabled ? 'true' : 'false');\n }\n\n @watch('checked')\n handleCheckedChange() {\n this.setAttribute('aria-checked', this.checked ? 'true' : 'false');\n this.setAttribute('tabindex', this.checked ? '0' : '-1');\n }\n\n @watch('disabled', { waitUntilFirstUpdate: true })\n handleDisabledChange() {\n this.setAttribute('aria-disabled', this.disabled ? 'true' : 'false');\n }\n\n render() {\n return html`\n <span\n part=\"base\"\n class=${classMap({\n radio: true,\n 'radio--checked': this.checked,\n 'radio--disabled': this.disabled,\n 'radio--focused': this.hasFocus,\n 'radio--medium': this.size === 'medium',\n 'radio__label_border':this.islabelborder\n })}\n >\n <span part=\"${`control${this.checked ? ' control--checked' : ''}`}\" class=\"radio__control\">\n ${this.checked\n ? html` <span class=\"radio__checked-icon\"></span> `\n : ''}\n </span>\n\n <slot part=\"label\" class=\"radio__label\"></slot>\n </span>\n `;\n }\n}\n\nexport default NileRadio;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-radio': NileRadio;\n }\n}\n"],"names":["NileRadio","d","constructor","this","checked","hasFocus","value","size","disabled","islabelborder","allowUncheck","_this","_inherits","_o","_createClass","key","connectedCallback","super","handleBlur","bind","handleClick","handleFocus","setInitialAttributes","addEventListeners","emit","disconnectedCallback","removeEventListeners","addEventListener","removeEventListener","setAttribute","handleCheckedChange","handleDisabledChange","render","html","_templateObject","_taggedTemplateLiteral","classMap","radio","radio__label_border","_templateObject2","NileElement","styles","__decorate","property","type","Boolean","prototype","state","reflect","watch","waitUntilFirstUpdate","_export","customElement"],"mappings":"+2HAmCaA,4BAAN,SAAAC,EAAA,CAAAC,KAAAA,KAAAA,CAAAA,eAAAA,MAAAA,CAAAA,qCAGqBC,KAAAA,CAAOC,OAAG,CAAA,CAAA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GFJ,CAAA,CAAA,CAA5BC,EAAS,CAAEK,OAAAA,CAAAA,CAAS,KAAsDhD,CAAA8C,CAAAA,SAAAA,CAAA,WAAA,EAG/BJ,CAAAA,CAAAA,CAAAA,CAAA,CAA3CC,CAAS,CAAA,CAAEC,KAAMC,OAASG,CAAAA,OAAAA,CAAAA,CAAS,CAAyBhD,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAA8C,SAAA,CAAA,UAAA,CAAA,IAAA,IAGjBJ,CAAA,CAAA,CAA3CC,EAAS,CAAEC,IAAAA,CAAMC,QAASG,OAAS,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA8BhD,EAAA8C,SAAA,CAAA,eAAA,CAAA,IAAA,IAGtBJ,CAAA,CAAA,CAA3CC,EAAS,CAAEC,IAAAA,CAAMC,QAASG,OAAS,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA6BhD,CAAA8C,CAAAA,SAAAA,CAAA,cAAA,CAAA,IAAA,EAAA,CAAA,CAwDjEJ,EAAA,CADCO,CAAAA,CAAM,YAINjD,CAAA8C,CAAAA,SAAAA,CAAA,sBAAA,IAGDJ,CAAAA,CAAAA,CAAAA,CAAA,CADCO,CAAAA,CAAM,UAAY,CAAA,CAAEC,sBAAsB,CAG1ClD,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAA8C,UAAA,sBAAA,CAAA,IAAA,CAAA,CAAAK,OAAA,KAnFUnD,EAAS0C,CAAA,CAAA,CADrBU,CAAc,CAAA,YAAA,CAAA,CAAA,CACFpD"}
@@ -1,4 +1,4 @@
1
- import{__decorate as i}from"tslib";import{html as s}from"lit";import{property as t,state as e,customElement as a}from"lit/decorators.js";import{s as h}from"./nile-radio.css.esm.js";import{classMap as l}from"lit/directives/class-map.js";import{w as r}from"../internal/watch.esm.js";import{N as o}from"../internal/nile-element.esm.js";let d=class extends o{constructor(){super(...arguments),this.checked=!1,this.hasFocus=!1,this.value="",this.size="medium",this.disabled=!1,this.islabelborder=!1}connectedCallback(){super.connectedCallback(),this.handleBlur=this.handleBlur.bind(this),this.handleClick=this.handleClick.bind(this),this.handleFocus=this.handleFocus.bind(this),this.setInitialAttributes(),this.addEventListeners(),this.emit("nile-init")}disconnectedCallback(){this.removeEventListeners(),this.emit("nile-destroy")}addEventListeners(){this.addEventListener("blur",this.handleBlur),this.addEventListener("click",this.handleClick),this.addEventListener("focus",this.handleFocus)}removeEventListeners(){this.removeEventListener("blur",this.handleBlur),this.removeEventListener("click",this.handleClick),this.removeEventListener("focus",this.handleFocus)}handleBlur(){this.hasFocus=!1,this.emit("nile-blur")}handleClick(){this.disabled||(this.checked=!0)}handleFocus(){this.hasFocus=!0,this.emit("nile-focus")}setInitialAttributes(){this.setAttribute("role","radio"),this.setAttribute("tabindex","-1"),this.setAttribute("aria-disabled",this.disabled?"true":"false")}handleCheckedChange(){this.setAttribute("aria-checked",this.checked?"true":"false"),this.setAttribute("tabindex",this.checked?"0":"-1")}handleDisabledChange(){this.setAttribute("aria-disabled",this.disabled?"true":"false")}render(){return s`
1
+ import{__decorate as i}from"tslib";import{html as s}from"lit";import{property as t,state as e,customElement as a}from"lit/decorators.js";import{s as h}from"./nile-radio.css.esm.js";import{classMap as l}from"lit/directives/class-map.js";import{w as r}from"../internal/watch.esm.js";import{N as o}from"../internal/nile-element.esm.js";let d=class extends o{constructor(){super(...arguments),this.checked=!1,this.hasFocus=!1,this.value="",this.size="medium",this.disabled=!1,this.islabelborder=!1,this.allowUncheck=!1}connectedCallback(){super.connectedCallback(),this.handleBlur=this.handleBlur.bind(this),this.handleClick=this.handleClick.bind(this),this.handleFocus=this.handleFocus.bind(this),this.setInitialAttributes(),this.addEventListeners(),this.emit("nile-init")}disconnectedCallback(){this.removeEventListeners(),this.emit("nile-destroy")}addEventListeners(){this.addEventListener("blur",this.handleBlur),this.addEventListener("click",this.handleClick),this.addEventListener("focus",this.handleFocus)}removeEventListeners(){this.removeEventListener("blur",this.handleBlur),this.removeEventListener("click",this.handleClick),this.removeEventListener("focus",this.handleFocus)}handleBlur(){this.hasFocus=!1,this.emit("nile-blur")}handleClick(){this.allowUncheck&&!this.disabled?this.checked=!this.checked:this.disabled||(this.checked=!0)}handleFocus(){this.hasFocus=!0,this.emit("nile-focus")}setInitialAttributes(){this.setAttribute("role","radio"),this.setAttribute("tabindex","-1"),this.setAttribute("aria-disabled",this.disabled?"true":"false")}handleCheckedChange(){this.setAttribute("aria-checked",this.checked?"true":"false"),this.setAttribute("tabindex",this.checked?"0":"-1")}handleDisabledChange(){this.setAttribute("aria-disabled",this.disabled?"true":"false")}render(){return s`
2
2
  <span
3
3
  part="base"
4
4
  class=${l({radio:!0,"radio--checked":this.checked,"radio--disabled":this.disabled,"radio--focused":this.hasFocus,"radio--medium":"medium"===this.size,radio__label_border:this.islabelborder})}
@@ -9,4 +9,4 @@ import{__decorate as i}from"tslib";import{html as s}from"lit";import{property as
9
9
 
10
10
  <slot part="label" class="radio__label"></slot>
11
11
  </span>
12
- `}};d.styles=h,i([t({type:Boolean})],d.prototype,"checked",void 0),i([e()],d.prototype,"hasFocus",void 0),i([t()],d.prototype,"value",void 0),i([t({reflect:!0})],d.prototype,"size",void 0),i([t({type:Boolean,reflect:!0})],d.prototype,"disabled",void 0),i([t({type:Boolean,reflect:!0})],d.prototype,"islabelborder",void 0),i([r("checked")],d.prototype,"handleCheckedChange",null),i([r("disabled",{waitUntilFirstUpdate:!0})],d.prototype,"handleDisabledChange",null),d=i([a("nile-radio")],d);export{d as N};
12
+ `}};d.styles=h,i([t({type:Boolean})],d.prototype,"checked",void 0),i([e()],d.prototype,"hasFocus",void 0),i([t()],d.prototype,"value",void 0),i([t({reflect:!0})],d.prototype,"size",void 0),i([t({type:Boolean,reflect:!0})],d.prototype,"disabled",void 0),i([t({type:Boolean,reflect:!0})],d.prototype,"islabelborder",void 0),i([t({type:Boolean,reflect:!0})],d.prototype,"allowUncheck",void 0),i([r("checked")],d.prototype,"handleCheckedChange",null),i([r("disabled",{waitUntilFirstUpdate:!0})],d.prototype,"handleDisabledChange",null),d=i([a("nile-radio")],d);export{d as N};
@@ -1,2 +1,2 @@
1
- function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o;}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o;},_typeof(o);}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,e,i,s,l,o,r,a,n,h,d,_templateObject,_templateObject2,_templateObject3,_templateObject4,_templateObject5,_templateObject6,_templateObject7,c;function _taggedTemplateLiteral(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}));}function _toConsumableArray(r){return _arrayWithoutHoles(r)||_iterableToArray(r)||_unsupportedIterableToArray(r)||_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(r,a){if(r){if("string"==typeof r)return _arrayLikeToArray(r,a);var t={}.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(r,a):void 0;}}function _iterableToArray(r){if("undefined"!=typeof Symbol&&null!=r[Symbol.iterator]||null!=r["@@iterator"])return Array.from(r);}function _arrayWithoutHoles(r){if(Array.isArray(r))return _arrayLikeToArray(r);}function _arrayLikeToArray(r,a){(null==a||a>r.length)&&(a=r.length);for(var e=0,n=Array(a);e<a;e++)n[e]=r[e];return n;}function _classCallCheck(a,n){if(!(a instanceof n))throw new TypeError("Cannot call a class as a function");}function _defineProperties(e,r){for(var t=0;t<r.length;t++){var o=r[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,_toPropertyKey(o.key),o);}}function _createClass(e,r,t){return r&&_defineProperties(e.prototype,r),t&&_defineProperties(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e;}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return"symbol"==_typeof(i)?i:i+"";}function _toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.");}return("string"===r?String:Number)(t);}function _callSuper(t,o,e){return o=_getPrototypeOf(o),_possibleConstructorReturn(t,_isNativeReflectConstruct()?Reflect.construct(o,e||[],_getPrototypeOf(t).constructor):o.apply(t,e));}function _possibleConstructorReturn(t,e){if(e&&("object"==_typeof(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(t);}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e;}function _isNativeReflectConstruct(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(t){}return(_isNativeReflectConstruct=function _isNativeReflectConstruct(){return!!t;})();}function _superPropGet(t,o,e,r){var p=_get(_getPrototypeOf(1&r?t.prototype:t),o,e);return 2&r&&"function"==typeof p?function(t){return p.apply(e,t);}:p;}function _get(){return _get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var p=_superPropBase(e,t);if(p){var n=Object.getOwnPropertyDescriptor(p,t);return n.get?n.get.call(arguments.length<3?e:r):n.value;}},_get.apply(null,arguments);}function _superPropBase(t,o){for(;!{}.hasOwnProperty.call(t,o)&&null!==(t=_getPrototypeOf(t)););return t;}function _getPrototypeOf(t){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t);},_getPrototypeOf(t);}function _inherits(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&_setPrototypeOf(t,e);}function _setPrototypeOf(t,e){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t;},_setPrototypeOf(t,e);}return{setters:[function(_tslib){t=_tslib.__decorate;},function(_litDirectivesClassMapJs){e=_litDirectivesClassMapJs.classMap;},function(_litDecoratorsJs){i=_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 execute(){_export("N",c=/*#__PURE__*/function(_h){function c(){var _this;_classCallCheck(this,c);_this=_callSuper(this,c,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="",_this.islabelborder=!1;return _this;}_inherits(c,_h);return _createClass(c,[{key:"connectedCallback",value:function connectedCallback(){_superPropGet(c,"connectedCallback",this,3)([]),this.defaultValue=this.value,this.handleInitialDisabledState(),this.emit("nile-init");}},{key:"disconnectedCallback",value:function disconnectedCallback(){_superPropGet(c,"disconnectedCallback",this,3)([]),this.emit("nile-destroy");}},{key:"getAllRadios",value:function getAllRadios(){return _toConsumableArray(this.querySelectorAll("nile-radio"));}},{key:"handleRadioClick",value:function handleRadioClick(t){var e=t.target.closest("nile-radio"),i=this.getAllRadios(),s=this.value;e.disabled||this.disabled||(this.value=e.value,i.forEach(function(t){return t.checked=t===e;}),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 _e$find,_this4=this;if(!["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"," "].includes(t.key))return;var e=this.getAllRadios().filter(function(t){return!t.disabled;}),i=(_e$find=e.find(function(t){return t.checked;}))!==null&&_e$find!==void 0?_e$find:e[0],s=" "===t.key?0:["ArrowUp","ArrowLeft"].includes(t.key)?-1:1,l=this.value;var o=e.indexOf(i)+s;o<0&&(o=e.length-1),o>e.length-1&&(o=0),this.getAllRadios().forEach(function(t){t.checked=!1,_this4.hasButtonGroup||(t.tabIndex=-1);}),this.value=e[o].value,e[o].checked=!0,this.hasButtonGroup?e[o].shadowRoot.querySelector("button").focus():(e[o].tabIndex=0,e[o].focus()),this.value!==l&&(this.emit("change"),this.emit("input")),t.preventDefault();}},{key:"handleLabelClick",value:function handleLabelClick(){var t=this.getAllRadios(),e=t.find(function(t){return t.checked;})||t[0];e&&e.focus();}},{key:"handleSlotChange",value:function handleSlotChange(){var _this5=this,_this$shadowRoot;var t=this.getAllRadios();t.forEach(function(t){t.checked=t.value===_this5.value,_this5.islabelborder&&(t.islabelborder=!0);});if(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 i=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 "])),e({"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,i?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):"");}}]);}(h));c.styles=d,t([i("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",reflect:!0})],c.prototype,"helpText",void 0),t([l({attribute:"error-message",reflect:!0})],c.prototype,"errorMessage",void 0),t([l({type:Boolean,reflect:!0})],c.prototype,"islabelborder",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
+ function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o;}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o;},_typeof(o);}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,e,i,s,l,o,r,a,h,n,d,_templateObject,_templateObject2,_templateObject3,_templateObject4,_templateObject5,_templateObject6,_templateObject7,c;function _taggedTemplateLiteral(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}));}function _toConsumableArray(r){return _arrayWithoutHoles(r)||_iterableToArray(r)||_unsupportedIterableToArray(r)||_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(r,a){if(r){if("string"==typeof r)return _arrayLikeToArray(r,a);var t={}.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(r,a):void 0;}}function _iterableToArray(r){if("undefined"!=typeof Symbol&&null!=r[Symbol.iterator]||null!=r["@@iterator"])return Array.from(r);}function _arrayWithoutHoles(r){if(Array.isArray(r))return _arrayLikeToArray(r);}function _arrayLikeToArray(r,a){(null==a||a>r.length)&&(a=r.length);for(var e=0,n=Array(a);e<a;e++)n[e]=r[e];return n;}function _classCallCheck(a,n){if(!(a instanceof n))throw new TypeError("Cannot call a class as a function");}function _defineProperties(e,r){for(var t=0;t<r.length;t++){var o=r[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,_toPropertyKey(o.key),o);}}function _createClass(e,r,t){return r&&_defineProperties(e.prototype,r),t&&_defineProperties(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e;}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return"symbol"==_typeof(i)?i:i+"";}function _toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.");}return("string"===r?String:Number)(t);}function _callSuper(t,o,e){return o=_getPrototypeOf(o),_possibleConstructorReturn(t,_isNativeReflectConstruct()?Reflect.construct(o,e||[],_getPrototypeOf(t).constructor):o.apply(t,e));}function _possibleConstructorReturn(t,e){if(e&&("object"==_typeof(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(t);}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e;}function _isNativeReflectConstruct(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(t){}return(_isNativeReflectConstruct=function _isNativeReflectConstruct(){return!!t;})();}function _superPropGet(t,o,e,r){var p=_get(_getPrototypeOf(1&r?t.prototype:t),o,e);return 2&r&&"function"==typeof p?function(t){return p.apply(e,t);}:p;}function _get(){return _get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var p=_superPropBase(e,t);if(p){var n=Object.getOwnPropertyDescriptor(p,t);return n.get?n.get.call(arguments.length<3?e:r):n.value;}},_get.apply(null,arguments);}function _superPropBase(t,o){for(;!{}.hasOwnProperty.call(t,o)&&null!==(t=_getPrototypeOf(t)););return t;}function _getPrototypeOf(t){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t);},_getPrototypeOf(t);}function _inherits(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&_setPrototypeOf(t,e);}function _setPrototypeOf(t,e){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t;},_setPrototypeOf(t,e);}return{setters:[function(_tslib){t=_tslib.__decorate;},function(_litDirectivesClassMapJs){e=_litDirectivesClassMapJs.classMap;},function(_litDecoratorsJs){i=_litDecoratorsJs.query;s=_litDecoratorsJs.state;l=_litDecoratorsJs.property;o=_litDecoratorsJs.customElement;},function(_internalSlotCjsJs){r=_internalSlotCjsJs.H;},function(_lit){a=_lit.html;},function(_internalWatchCjsJs){h=_internalWatchCjsJs.w;},function(_internalNileElementCjsJs){n=_internalNileElementCjsJs.N;},function(_nileRadioGroupCssCjsJs){d=_nileRadioGroupCssCjsJs.s;}],execute:function execute(){_export("N",c=/*#__PURE__*/function(_n){function c(){var _this;_classCallCheck(this,c);_this=_callSuper(this,c,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="",_this.islabelborder=!1,_this.allowUncheckGroup=!1;return _this;}_inherits(c,_n);return _createClass(c,[{key:"connectedCallback",value:function connectedCallback(){_superPropGet(c,"connectedCallback",this,3)([]),this.defaultValue=this.value,this.handleInitialDisabledState(),this.emit("nile-init");}},{key:"disconnectedCallback",value:function disconnectedCallback(){_superPropGet(c,"disconnectedCallback",this,3)([]),this.emit("nile-destroy");}},{key:"getAllRadios",value:function getAllRadios(){return _toConsumableArray(this.querySelectorAll("nile-radio"));}},{key:"handleRadioClick",value:function handleRadioClick(t){var e=t.target.closest("nile-radio"),i=this.getAllRadios(),s=this.value;e.disabled||this.disabled||(this.value=e.value,this.allowUncheckGroup||i.forEach(function(t){t.checked=t===e;}),this.allowUncheckGroup||this.value===s?this.allowUncheckGroup&&(this.emit("change",{value:this.value,checked:e.checked}),this.emit("input")):(this.emit("change",{value:this.value}),this.emit("input")));}},{key:"updated",value:function updated(t){_superPropGet(c,"updated",this,3)([t]),t.has("allowUncheckGroup")&&this.allowUncheckGroup&&this.getAllRadios().forEach(function(t){t.allowUncheck=!0;});}},{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 _e$find,_this4=this;if(!["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"," "].includes(t.key))return;var e=this.getAllRadios().filter(function(t){return!t.disabled;}),i=(_e$find=e.find(function(t){return t.checked;}))!==null&&_e$find!==void 0?_e$find:e[0],s=" "===t.key?0:["ArrowUp","ArrowLeft"].includes(t.key)?-1:1,l=this.value;var o=e.indexOf(i)+s;o<0&&(o=e.length-1),o>e.length-1&&(o=0),this.getAllRadios().forEach(function(t){t.checked=!1,_this4.hasButtonGroup||(t.tabIndex=-1);}),this.value=e[o].value,e[o].checked=!0,this.hasButtonGroup?e[o].shadowRoot.querySelector("button").focus():(e[o].tabIndex=0,e[o].focus()),this.value!==l&&(this.emit("change"),this.emit("input")),t.preventDefault();}},{key:"handleLabelClick",value:function handleLabelClick(){var t=this.getAllRadios(),e=t.find(function(t){return t.checked;})||t[0];e&&e.focus();}},{key:"handleSlotChange",value:function handleSlotChange(){var _this5=this,_this$shadowRoot;var t=this.getAllRadios();t.forEach(function(t){t.checked=t.value===_this5.value,_this5.islabelborder&&(t.islabelborder=!0);});if(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 i=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 "])),e({"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,i?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):"");}}]);}(n));c.styles=d,t([i("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",reflect:!0})],c.prototype,"helpText",void 0),t([l({attribute:"error-message",reflect:!0})],c.prototype,"errorMessage",void 0),t([l({type:Boolean,reflect:!0})],c.prototype,"islabelborder",void 0),t([l({type:Boolean,reflect:!0,attribute:!0})],c.prototype,"allowUncheckGroup",void 0),t([h("disabled",{waitUntilFirstUpdate:!0})],c.prototype,"handleDisabledChange",null),t([h("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', reflect: true }) helpText = '';\n\n @property({ attribute: 'error-message', reflect: true }) errorMessage = '';\n\n /** The radio's labelborder for whole gp. */\n @property({ type: Boolean, reflect: true }) islabelborder = false;\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 => {\n radio.checked = radio.value === this.value;\n if (this.islabelborder) {\n radio.islabelborder=true;\n }\n });\n const nile_radio_check='nile-radio-button';\n this.hasButtonGroup = radios.some(radio => radio.tagName.toLowerCase() === nile_radio_check);\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","c","constructor","this","hasSlotController","HasSlotController","customValidityMessage","hasButtonGroup","defaultValue","label","name","value","form","required","labelInline","disabled","helpText","errorMessage","islabelborder","_this","_inherits","_h","_createClass","key","connectedCallback","super","handleInitialDisabledState","emit","disconnectedCallback","getAllRadios","_toConsumableArray","querySelectorAll","handleRadioClick","event","target","closest","radios","oldValue","forEach","radio","checked","handleDisabledChange","hasAttribute","handleKeyDown","_e$find","_this4","includes","filter","checkedRadio","find","incr","index","indexOf","length","tabIndex","shadowRoot","querySelector","focus","preventDefault","handleLabelClick","radioToFocus","handleSlotChange","_this5","_this$shadowRoot","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","customElement"],"mappings":"whKA2BaA,CAAAA,uBAAAA,EAAAA,EAAN,SAAAC,EAAA,CAAAC,KAAAA,KAAAA,CAAAA,eAAAA,MAAAA,CAAAA,mCAGYC,EAAAA,KAAAA,CAAiBC,kBAAG,GAAIC,CAAAA,CAAAA,CAAAA,sBAAAA,CAAAA,KAAAA,EAAwB,WAAa,CAAA,OAAA,CAAA,CACtEF,KAAAA,CAAqBG,qBAAAA,CAAG,EAIfH,CAAAA,KAAAA,CAAcI,gBAAG,CAEzBJ,CAAAA,KAAAA,CAAYK,aAAG,EAMZL,CAAAA,KAAAA,CAAKM,MAAG,EAGRN,CAAAA,KAAAA,CAAIO,IAAG,CAAA,QAAA,CAGUP,KAAAA,CAAKQ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AAA,CAAA,CAAxDI,EAAS,CAAEI,SAAAA,CAAW,eAAiBH,CAAAA,OAAAA,CAAAA,CAAS,KAA0B/F,CAAA4F,CAAAA,SAAAA,CAAA,cAAA,CAAA,IAAA,EAAA,CAAA,CAG/BF,EAAA,CAA3CI,CAAAA,CAAS,CAAEE,IAAAA,CAAMC,QAASF,OAAS,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA8B/F,CAAA4F,CAAAA,SAAAA,CAAA,oBAAA,EAqClEF,CAAAA,CAAAA,CAAAA,CAAA,CADCS,CAAAA,CAAM,WAAY,CAAEC,oBAAAA,CAAAA,CAAsB,CAK1CpG,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAA4F,UAAA,sBAAA,CAAA,IAAA,CAAA,CAgGDF,CAAA,CAAA,CADCS,EAAM,OAKNnG,CAAAA,CAAAA,CAAAA,CAAAA,CAAA4F,SAAA,CAAA,mBAAA,CAAA,kBA3LU5F,CAAc0F,CAAAA,CAAAA,CAAA,CAD1BW,CAAAA,CAAc,qBACFrG"}
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, PropertyValues } 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', reflect: true }) helpText = '';\n\n @property({ attribute: 'error-message', reflect: true }) errorMessage = '';\n\n /** The radio's labelborder for whole gp. */\n @property({ type: Boolean, reflect: true }) islabelborder = false;\n\n /** Allow the radio to be unchecked. */\n @property({ type: Boolean, reflect: true, attribute: true }) allowUncheckGroup = false;\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 if (!this.allowUncheckGroup) {\n radios.forEach(radio => {\n radio.checked = radio === target;\n });\n }\n\n if (!this.allowUncheckGroup && this.value !== oldValue) {\n this.emit('change', { value: this.value});\n this.emit('input');\n } else if (this.allowUncheckGroup) { \n this.emit('change', { value: this.value , checked: target.checked});\n this.emit('input');\n }\n }\n\n protected updated(changedProperties: PropertyValues): void {\n super.updated(changedProperties);\n\n if (changedProperties.has('allowUncheckGroup')) {\n if (this.allowUncheckGroup) {\n this.getAllRadios().forEach(radio => {\n radio.allowUncheck = true;\n });\n }\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 => {\n radio.checked = radio.value === this.value;\n if (this.islabelborder) {\n radio.islabelborder=true;\n }\n });\n const nile_radio_check='nile-radio-button';\n this.hasButtonGroup = radios.some(radio => radio.tagName.toLowerCase() === nile_radio_check);\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","c","constructor","this","hasSlotController","HasSlotController","customValidityMessage","hasButtonGroup","defaultValue","label","name","value","form","required","labelInline","disabled","helpText","errorMessage","islabelborder","allowUncheckGroup","_this","_inherits","_n","_createClass","key","connectedCallback","super","handleInitialDisabledState","emit","disconnectedCallback","getAllRadios","_toConsumableArray","querySelectorAll","handleRadioClick","event","target","closest","radios","oldValue","forEach","radio","checked","updated","changedProperties","has","allowUncheck","handleDisabledChange","hasAttribute","handleKeyDown","_e$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","customElement"],"mappings":"whKA2BaA,4BAAN,SAAAC,EAAA,CAAAC,KAAAA,KAAAA,CAAAA,eAAAA,MAAAA,CAAAA,qCAGYC,KAAAA,CAAiBC,iBAAG,CAAA,GAAIC,CAAAA,CAAkBF,CAAAA,sBAAAA,CAAAA,KAAAA,EAAM,WAAa,CAAA,OAAA,CAAA,CACtEA,KAAAA,CAAqBG,qBAAG,CAAA,EAAA,CAIfH,KAAAA,CAAcI,cAAAA,CAAAA,CAAG,CAEzBJ,CAAAA,KAAAA,CAAYK,aAAG,EAMZL,CAAAA,KAAAA,CAAKM,KAAG,CAAA,EAAA,CAGRN,KAAAA,CAAIO,IAAAA,CAAG,QAGUP,CAAAA,KAAAA,CAAKQ,KAAG,CAAA,EAAA,CAORR,KAAAA,CAAIS,IAAAA,CAAG,EAGQT,CAAAA,KAAAA,CAAQU,UAAG,CAIXV,CAAAA,KAAAA,CAAWW,WAAG,CAAA,CAAA,CAAA,CAGdX,KAAAA,CAAQY,QAAAA,CAAAA,CAAG,EAEFZ,KAAAA,CAAQa,QAAAA,CAAG,EAEPb,CAAAA,KAAAA,CAAYc,YAAG,CAAA,EAAA,CAG5Bd,KAAAA,CAAae,aAAG,CAAA,CAAA,CAAA,CAGCf,KAAAA,CAAiBgB,iBAAAA,CAAAA,CAAG,CAwPlF,QAAAC,KAAA,EAtPCC,SAAA,CAAApB,CAAA,CAAAqB,EAAA,SAAAC,YAAA,CAAAtB,CAAA,GAAAuB,GAAA,qBAAAb,KAAA,UAAAc,iBAAAA,CAAAA,CAAAA,CACEC,aAAAA,CAAAA,CAAAA,iCACAvB,IAAKK,CAAAA,YAAAA,CAAeL,IAAKQ,CAAAA,KAAAA,CACzBR,KAAKwB,0BAC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,CAASF,OAAS,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAyBlG,EAAA+F,SAAA,CAAA,UAAA,CAAA,IAAA,EAERF,CAAAA,CAAAA,CAAAA,CAAA,CAApDI,CAAS,CAAA,CAAEI,UAAW,WAAaH,CAAAA,OAAAA,CAAAA,CAAS,KAAsBlG,CAAA+F,CAAAA,SAAAA,CAAA,UAAA,CAAA,IAAA,EAAA,CAAA,CAEVF,EAAA,CAAxDI,CAAAA,CAAS,CAAEI,SAAW,CAAA,eAAA,CAAiBH,SAAS,CAA0BlG,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAA+F,SAAA,CAAA,cAAA,CAAA,IAAA,IAG/BF,CAAA,CAAA,CAA3CI,EAAS,CAAEE,IAAAA,CAAMC,QAASF,OAAS,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA8BlG,CAAA+F,CAAAA,SAAAA,CAAA,oBAAA,EAGLF,CAAAA,CAAAA,CAAAA,CAAA,CAA5DI,CAAS,CAAA,CAAEE,KAAMC,OAASF,CAAAA,OAAAA,CAAAA,CAAS,CAAMG,CAAAA,SAAAA,CAAAA,CAAW,KAAkCrG,CAAA+F,CAAAA,SAAAA,CAAA,wBAAA,EAwDvFF,CAAAA,CAAAA,CAAAA,CAAA,CADCS,CAAM,CAAA,UAAA,CAAY,CAAEC,oBAAAA,CAAAA,CAAsB,KAK1CvG,CAAA+F,CAAAA,SAAAA,CAAA,uBAAA,IAgGDF,CAAAA,CAAAA,CAAAA,CAAA,CADCS,CAAM,CAAA,OAAA,CAAA,CAAA,CAKNtG,CAAA+F,CAAAA,SAAAA,CAAA,oBAAA,IAjNU/F,CAAAA,CAAAA,OAAAA,KAAAA,CAAAA,CAAc6F,EAAA,CAD1BW,CAAAA,CAAc,qBACFxG"}
@@ -1,4 +1,4 @@
1
- import{__decorate as t}from"tslib";import{classMap as e}from"lit/directives/class-map.js";import{query as i,state as s,property as l,customElement as o}from"lit/decorators.js";import{H as r}from"../internal/slot.esm.js";import{html as a}from"lit";import{w as n}from"../internal/watch.esm.js";import{N as h}from"../internal/nile-element.esm.js";import{s as d}from"./nile-radio-group.css.esm.js";let c=class extends h{constructor(){super(...arguments),this.hasSlotController=new r(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="",this.islabelborder=!1}connectedCallback(){super.connectedCallback(),this.defaultValue=this.value,this.handleInitialDisabledState(),this.emit("nile-init")}disconnectedCallback(){super.disconnectedCallback(),this.emit("nile-destroy")}getAllRadios(){return[...this.querySelectorAll("nile-radio")]}handleRadioClick(t){const e=t.target.closest("nile-radio"),i=this.getAllRadios(),s=this.value;e.disabled||this.disabled||(this.value=e.value,i.forEach((t=>t.checked=t===e)),this.value!==s&&(this.emit("change",{value:this.value}),this.emit("input")))}handleDisabledChange(){this.getAllRadios().forEach((t=>{t.disabled=this.disabled}))}handleInitialDisabledState(){this.getAllRadios().forEach((t=>{t.disabled=t.hasAttribute("disabled")?t.disabled:this.disabled}))}handleKeyDown(t){if(!["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"," "].includes(t.key))return;const e=this.getAllRadios().filter((t=>!t.disabled)),i=e.find((t=>t.checked))??e[0],s=" "===t.key?0:["ArrowUp","ArrowLeft"].includes(t.key)?-1:1,l=this.value;let o=e.indexOf(i)+s;o<0&&(o=e.length-1),o>e.length-1&&(o=0),this.getAllRadios().forEach((t=>{t.checked=!1,this.hasButtonGroup||(t.tabIndex=-1)})),this.value=e[o].value,e[o].checked=!0,this.hasButtonGroup?e[o].shadowRoot.querySelector("button").focus():(e[o].tabIndex=0,e[o].focus()),this.value!==l&&(this.emit("change"),this.emit("input")),t.preventDefault()}handleLabelClick(){const t=this.getAllRadios(),e=t.find((t=>t.checked))||t[0];e&&e.focus()}handleSlotChange(){const t=this.getAllRadios();t.forEach((t=>{t.checked=t.value===this.value,this.islabelborder&&(t.islabelborder=!0)}));if(this.hasButtonGroup=t.some((t=>"nile-radio-button"===t.tagName.toLowerCase())),!t.some((t=>t.checked)))if(this.hasButtonGroup){t[0].shadowRoot.querySelector("button").tabIndex=0}else t[0].tabIndex=0;this.hasButtonGroup&&this.shadowRoot?.querySelector("nile-button-group")}updateCheckedRadio(){this.getAllRadios().forEach((t=>t.checked=t.value===this.value))}handleValueChange(){this.hasUpdated&&this.updateCheckedRadio()}render(){const t=this.hasSlotController.test("label");this.hasSlotController.test("help-text");const i=this.hasSlotController.test("label-suffix"),s=!!this.label||!!t,l=!!this.helpText,o=!!this.errorMessage,r=a`
1
+ import{__decorate as t}from"tslib";import{classMap as e}from"lit/directives/class-map.js";import{query as i,state as s,property as l,customElement as o}from"lit/decorators.js";import{H as r}from"../internal/slot.esm.js";import{html as a}from"lit";import{w as h}from"../internal/watch.esm.js";import{N as n}from"../internal/nile-element.esm.js";import{s as d}from"./nile-radio-group.css.esm.js";let c=class extends n{constructor(){super(...arguments),this.hasSlotController=new r(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="",this.islabelborder=!1,this.allowUncheckGroup=!1}connectedCallback(){super.connectedCallback(),this.defaultValue=this.value,this.handleInitialDisabledState(),this.emit("nile-init")}disconnectedCallback(){super.disconnectedCallback(),this.emit("nile-destroy")}getAllRadios(){return[...this.querySelectorAll("nile-radio")]}handleRadioClick(t){const e=t.target.closest("nile-radio"),i=this.getAllRadios(),s=this.value;e.disabled||this.disabled||(this.value=e.value,this.allowUncheckGroup||i.forEach((t=>{t.checked=t===e})),this.allowUncheckGroup||this.value===s?this.allowUncheckGroup&&(this.emit("change",{value:this.value,checked:e.checked}),this.emit("input")):(this.emit("change",{value:this.value}),this.emit("input")))}updated(t){super.updated(t),t.has("allowUncheckGroup")&&this.allowUncheckGroup&&this.getAllRadios().forEach((t=>{t.allowUncheck=!0}))}handleDisabledChange(){this.getAllRadios().forEach((t=>{t.disabled=this.disabled}))}handleInitialDisabledState(){this.getAllRadios().forEach((t=>{t.disabled=t.hasAttribute("disabled")?t.disabled:this.disabled}))}handleKeyDown(t){if(!["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"," "].includes(t.key))return;const e=this.getAllRadios().filter((t=>!t.disabled)),i=e.find((t=>t.checked))??e[0],s=" "===t.key?0:["ArrowUp","ArrowLeft"].includes(t.key)?-1:1,l=this.value;let o=e.indexOf(i)+s;o<0&&(o=e.length-1),o>e.length-1&&(o=0),this.getAllRadios().forEach((t=>{t.checked=!1,this.hasButtonGroup||(t.tabIndex=-1)})),this.value=e[o].value,e[o].checked=!0,this.hasButtonGroup?e[o].shadowRoot.querySelector("button").focus():(e[o].tabIndex=0,e[o].focus()),this.value!==l&&(this.emit("change"),this.emit("input")),t.preventDefault()}handleLabelClick(){const t=this.getAllRadios(),e=t.find((t=>t.checked))||t[0];e&&e.focus()}handleSlotChange(){const t=this.getAllRadios();t.forEach((t=>{t.checked=t.value===this.value,this.islabelborder&&(t.islabelborder=!0)}));if(this.hasButtonGroup=t.some((t=>"nile-radio-button"===t.tagName.toLowerCase())),!t.some((t=>t.checked)))if(this.hasButtonGroup){t[0].shadowRoot.querySelector("button").tabIndex=0}else t[0].tabIndex=0;this.hasButtonGroup&&this.shadowRoot?.querySelector("nile-button-group")}updateCheckedRadio(){this.getAllRadios().forEach((t=>t.checked=t.value===this.value))}handleValueChange(){this.hasUpdated&&this.updateCheckedRadio()}render(){const t=this.hasSlotController.test("label");this.hasSlotController.test("help-text");const i=this.hasSlotController.test("label-suffix"),s=!!this.label||!!t,l=!!this.helpText,o=!!this.errorMessage,r=a`
2
2
  <slot
3
3
  @click=${this.handleRadioClick}
4
4
  @keydown=${this.handleKeyDown}
@@ -56,4 +56,4 @@ import{__decorate as t}from"tslib";import{classMap as e}from"lit/directives/clas
56
56
  `:""}
57
57
 
58
58
  </fieldset>
59
- `}};c.styles=d,t([i("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",reflect:!0})],c.prototype,"helpText",void 0),t([l({attribute:"error-message",reflect:!0})],c.prototype,"errorMessage",void 0),t([l({type:Boolean,reflect:!0})],c.prototype,"islabelborder",void 0),t([n("disabled",{waitUntilFirstUpdate:!0})],c.prototype,"handleDisabledChange",null),t([n("value")],c.prototype,"handleValueChange",null),c=t([o("nile-radio-group")],c);export{c as N};
59
+ `}};c.styles=d,t([i("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",reflect:!0})],c.prototype,"helpText",void 0),t([l({attribute:"error-message",reflect:!0})],c.prototype,"errorMessage",void 0),t([l({type:Boolean,reflect:!0})],c.prototype,"islabelborder",void 0),t([l({type:Boolean,reflect:!0,attribute:!0})],c.prototype,"allowUncheckGroup",void 0),t([h("disabled",{waitUntilFirstUpdate:!0})],c.prototype,"handleDisabledChange",null),t([h("value")],c.prototype,"handleValueChange",null),c=t([o("nile-radio-group")],c);export{c as N};