@aquera/nile-elements 0.1.12 → 0.1.14
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/README.md +7 -0
- package/dist/nile-code-editor/extensionSetup.cjs.js +5 -5
- package/dist/nile-code-editor/extensionSetup.cjs.js.map +1 -1
- package/dist/nile-code-editor/extensionSetup.esm.js +1 -1
- package/dist/nile-code-editor/nile-code-editor.cjs.js +2 -2
- package/dist/nile-code-editor/nile-code-editor.cjs.js.map +1 -1
- package/dist/nile-code-editor/nile-code-editor.esm.js +3 -3
- package/dist/nile-code-editor/theme.cjs.js +1 -1
- package/dist/nile-code-editor/theme.cjs.js.map +1 -1
- package/dist/nile-code-editor/theme.esm.js +1 -1
- package/dist/nile-form-help-text/index.cjs.js +1 -1
- package/dist/nile-form-help-text/index.esm.js +1 -1
- package/dist/nile-form-help-text/nile-form-help-text.cjs.js +1 -1
- package/dist/nile-form-help-text/nile-form-help-text.cjs.js.map +1 -1
- package/dist/nile-form-help-text/nile-form-help-text.css.cjs.js +1 -1
- package/dist/nile-form-help-text/nile-form-help-text.css.cjs.js.map +1 -1
- package/dist/nile-form-help-text/nile-form-help-text.css.esm.js +22 -6
- package/dist/nile-form-help-text/nile-form-help-text.esm.js +20 -16
- package/dist/nile-form-help-text/nile-form-help-text.test.cjs.js +1 -1
- package/dist/nile-form-help-text/nile-form-help-text.test.cjs.js.map +1 -1
- package/dist/nile-form-help-text/nile-form-help-text.test.esm.js +1 -1
- package/dist/src/nile-code-editor/extensionSetup.js +1 -3
- package/dist/src/nile-code-editor/extensionSetup.js.map +1 -1
- package/dist/src/nile-code-editor/nile-code-editor.d.ts +5 -0
- package/dist/src/nile-code-editor/nile-code-editor.js +32 -2
- package/dist/src/nile-code-editor/nile-code-editor.js.map +1 -1
- package/dist/src/nile-code-editor/theme.d.ts +24 -0
- package/dist/src/nile-code-editor/theme.js +24 -0
- package/dist/src/nile-code-editor/theme.js.map +1 -1
- package/dist/src/nile-form-help-text/nile-form-help-text.css.js +22 -6
- package/dist/src/nile-form-help-text/nile-form-help-text.css.js.map +1 -1
- package/dist/src/nile-form-help-text/nile-form-help-text.d.ts +13 -10
- package/dist/src/nile-form-help-text/nile-form-help-text.js +61 -82
- package/dist/src/nile-form-help-text/nile-form-help-text.js.map +1 -1
- package/dist/src/nile-form-help-text/nile-form-help-text.test.js +73 -52
- package/dist/src/nile-form-help-text/nile-form-help-text.test.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/nile-code-editor/extensionSetup.ts +0 -6
- package/src/nile-code-editor/nile-code-editor.ts +34 -2
- package/src/nile-code-editor/theme.ts +28 -0
- package/src/nile-form-help-text/nile-form-help-text.css.ts +22 -6
- package/src/nile-form-help-text/nile-form-help-text.test.ts +83 -59
- package/src/nile-form-help-text/nile-form-help-text.ts +64 -82
- package/vscode-html-custom-data.json +2 -14
@@ -1,2 +1,2 @@
|
|
1
|
-
System.register([],function(_export,_context){"use strict";var t;return{setters:[],execute:function execute(){_export("T",t={"&":{fontSize:"14px",fontFamily:"Colfax-regular",fontWeight:"400"},".cm-content":{},".cm-scroller":{scrollbarWidth:"thin"}});}};});
|
1
|
+
System.register([],function(_export,_context){"use strict";var t,i;return{setters:[],execute:function execute(){_export("T",t={"&":{fontSize:"14px",fontFamily:"Colfax-regular",fontWeight:"400"},".cm-content":{},".cm-scroller":{scrollbarWidth:"thin"}});_export("C",i={"&":{fontSize:"inherit",fontStyle:"inherit",fontFamily:"inherit",fontWeight:"inherit",lineHeight:"inherit",letterSpacing:"inherit"},".cm-content":{fontSize:"inherit",fontStyle:"inherit",fontFamily:"inherit",fontWeight:"inherit",lineHeight:"inherit",letterSpacing:"inherit"},".cm-scroller":{fontFamily:"inherit"},".cm-gutters":{fontFamily:"inherit"}});}};});
|
2
2
|
//# sourceMappingURL=theme.cjs.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"theme.cjs.js","sources":["../../../src/nile-code-editor/theme.ts"],"sourcesContent":["export const Theme = {\n '&': {\n fontSize: '14px',\n fontFamily: 'Colfax-regular',\n fontWeight: '400',\n },\n '.cm-content': {},\n \".cm-scroller\": {\n scrollbarWidth:'thin',\n },\n};"],"names":["Theme","fontSize","fontFamily","fontWeight","scrollbarWidth"],"mappings":"
|
1
|
+
{"version":3,"file":"theme.cjs.js","sources":["../../../src/nile-code-editor/theme.ts"],"sourcesContent":["export const Theme = {\n '&': {\n fontSize: '14px',\n fontFamily: 'Colfax-regular',\n fontWeight: '400',\n },\n '.cm-content': {},\n \".cm-scroller\": {\n scrollbarWidth:'thin',\n },\n};\n\nexport const CustomTheme = {\n '&': {\n fontSize: 'inherit',\n fontStyle: 'inherit',\n fontFamily: 'inherit',\n fontWeight: 'inherit',\n lineHeight:'inherit',\n letterSpacing:'inherit'\n },\n \n '.cm-content': {\n fontSize: 'inherit',\n fontStyle: 'inherit',\n fontFamily: 'inherit',\n fontWeight: 'inherit',\n lineHeight:'inherit',\n letterSpacing:'inherit'\n },\n\n \".cm-scroller\":{\n fontFamily: 'inherit'\n },\n\n \".cm-gutters\": {\n fontFamily: 'inherit', // Ensure the gutter font matches\n },\n};"],"names":["Theme","fontSize","fontFamily","fontWeight","scrollbarWidth","_export","CustomTheme","fontStyle","lineHeight","letterSpacing"],"mappings":"4HAAaA,CAAAA,CAAQ,CACnB,GAAA,CAAK,CACHC,QAAAA,CAAU,OACVC,UAAY,CAAA,gBAAA,CACZC,UAAY,CAAA,KAAA,CAAA,CAEd,aAAe,CAAA,CAAE,EACjB,cAAgB,CAAA,CACdC,cAAe,CAAA,MAAA,CAAA,CAAA,EAAAC,OAAA,KAINC,CAAc,CAAA,CACzB,GAAK,CAAA,CACHL,QAAU,CAAA,SAAA,CACVM,SAAW,CAAA,SAAA,CACXL,UAAY,CAAA,SAAA,CACZC,WAAY,SACZK,CAAAA,UAAAA,CAAW,SACXC,CAAAA,aAAAA,CAAc,SAGhB,CAAA,CAAA,aAAA,CAAe,CACbR,QAAAA,CAAU,SACVM,CAAAA,SAAAA,CAAW,SACXL,CAAAA,UAAAA,CAAY,SACZC,CAAAA,UAAAA,CAAY,UACZK,UAAW,CAAA,SAAA,CACXC,aAAc,CAAA,SAAA,CAAA,CAGhB,cAAe,CAAA,CACbP,UAAY,CAAA,SAAA,CAAA,CAGd,aAAe,CAAA,CACbA,UAAY,CAAA,SAAA,CAAA,CAAA"}
|
@@ -1 +1 @@
|
|
1
|
-
const t={"&":{fontSize:"14px",fontFamily:"Colfax-regular",fontWeight:"400"},".cm-content":{},".cm-scroller":{scrollbarWidth:"thin"}};export{t as T};
|
1
|
+
const t={"&":{fontSize:"14px",fontFamily:"Colfax-regular",fontWeight:"400"},".cm-content":{},".cm-scroller":{scrollbarWidth:"thin"}},i={"&":{fontSize:"inherit",fontStyle:"inherit",fontFamily:"inherit",fontWeight:"inherit",lineHeight:"inherit",letterSpacing:"inherit"},".cm-content":{fontSize:"inherit",fontStyle:"inherit",fontFamily:"inherit",fontWeight:"inherit",lineHeight:"inherit",letterSpacing:"inherit"},".cm-scroller":{fontFamily:"inherit"},".cm-gutters":{fontFamily:"inherit"}};export{i as C,t as T};
|
@@ -1,2 +1,2 @@
|
|
1
|
-
System.register(["./nile-form-help-text.cjs.js","tslib","lit","lit/decorators.js","./nile-form-help-text.css.cjs.js"],function(_export,_context){"use strict";return{setters:[function(_nileFormHelpTextCjsJs){_export("NileFormHelpText",_nileFormHelpTextCjsJs.N);},function(_tslib){},function(_lit){},function(_litDecoratorsJs){},function(_nileFormHelpTextCssCjsJs){}],execute:function execute(){}};});
|
1
|
+
System.register(["./nile-form-help-text.cjs.js","tslib","lit","lit/decorators.js","./nile-form-help-text.css.cjs.js","lit/directives/class-map.js"],function(_export,_context){"use strict";return{setters:[function(_nileFormHelpTextCjsJs){_export("NileFormHelpText",_nileFormHelpTextCjsJs.N);},function(_tslib){},function(_lit){},function(_litDecoratorsJs){},function(_nileFormHelpTextCssCjsJs){},function(_litDirectivesClassMapJs){}],execute:function execute(){}};});
|
2
2
|
//# sourceMappingURL=index.cjs.js.map
|
@@ -1 +1 @@
|
|
1
|
-
export{N as NileFormHelpText}from"./nile-form-help-text.esm.js";import"tslib";import"lit";import"lit/decorators.js";import"./nile-form-help-text.css.esm.js";
|
1
|
+
export{N as NileFormHelpText}from"./nile-form-help-text.esm.js";import"tslib";import"lit";import"lit/decorators.js";import"./nile-form-help-text.css.esm.js";import"lit/directives/class-map.js";
|
@@ -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-form-help-text.css.cjs.js"],function(_export,_context){"use strict";var t,e,i,
|
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-form-help-text.css.cjs.js","lit/directives/class-map.js"],function(_export,_context){"use strict";var t,e,s,i,o,r,l,n,h,a,_templateObject,_templateObject2,p;function _createForOfIteratorHelper(o,allowArrayLike){var it=typeof Symbol!=="undefined"&&o[Symbol.iterator]||o["@@iterator"];if(!it){if(Array.isArray(o)||(it=_unsupportedIterableToArray(o))||allowArrayLike&&o&&typeof o.length==="number"){if(it)o=it;var i=0;var F=function F(){};return{s:F,n:function n(){if(i>=o.length)return{done:true};return{done:false,value:o[i++]};},e:function e(_e3){throw _e3;},f:F};}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}var normalCompletion=true,didErr=false,err;return{s:function s(){it=it.call(o);},n:function n(){var step=it.next();normalCompletion=step.done;return step;},e:function e(_e4){didErr=true;err=_e4;},f:function f(){try{if(!normalCompletion&&it["return"]!=null)it["return"]();}finally{if(didErr)throw err;}}};}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 _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 _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(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(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(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(t){}return(_isNativeReflectConstruct=function _isNativeReflectConstruct(){return!!t;})();}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}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);}return{setters:[function(_tslib){t=_tslib.__decorate;},function(_lit){e=_lit.LitElement;s=_lit.html;i=_lit.nothing;},function(_litDecoratorsJs){o=_litDecoratorsJs.property;r=_litDecoratorsJs.state;l=_litDecoratorsJs.query;n=_litDecoratorsJs.customElement;},function(_nileFormHelpTextCssCjsJs){h=_nileFormHelpTextCssCjsJs.s;},function(_litDirectivesClassMapJs){a=_litDirectivesClassMapJs.classMap;}],execute:function execute(){_export("N",p=/*#__PURE__*/function(_e){function p(){var _this;_classCallCheck(this,p);_this=_callSuper(this,p,arguments),_this.isExpanded=!1,_this.showButton=!1;return _this;}_inherits(p,_e);return _createClass(p,[{key:"firstUpdated",value:function firstUpdated(t){this.resizeObserver=this.observeWidthChange(this.textContainer);}},{key:"disconnectedCallback",value:function disconnectedCallback(){this.resizeObserver.disconnect();}},{key:"render",value:function render(){var t=this.isExpanded?"arrowup":"arrowdown";return s(_templateObject||(_templateObject=_taggedTemplateLiteral(["\n <div \n class=\"","\" \n part=\"container\"\n >\n <span\n class=\"","\"\n >\n <slot @slotchange=\"","\"></slot>\n </span>\n ","\n </div>\n "])),a({"nile-form-help-text":!0,"nile-form-help-text--expanded":this.isExpanded}),a({help__text__full:!0,"help__text__full--expanded":this.isExpanded}),this.decideToToggleShowButton,this.showButton?s(_templateObject2||(_templateObject2=_taggedTemplateLiteral(["\n <span\n class=\"nile-form-help-text__more-button\"\n part=\"toggle-button\"\n @click=","\n >","\n <nile-icon color=\"#005EA6\" part=\"icon\" size=\"14\" name=\"","\"></nile-icon>\n </span>\n "])),this.toggleExpanded,this.isExpanded?"View Less":"View More",t):i);}},{key:"toggleExpanded",value:function toggleExpanded(){this.isExpanded=!this.isExpanded;}},{key:"decideToToggleShowButton",value:function decideToToggleShowButton(){this.textContainer&&(this.showButton=this.textContainer.clientWidth<this.textContainer.scrollWidth);}},{key:"observeWidthChange",value:function observeWidthChange(t){var _this2=this;var e=new ResizeObserver(function(t){var _iterator=_createForOfIteratorHelper(t),_step;try{for(_iterator.s();!(_step=_iterator.n()).done;){var _e2=_step.value;_e2.contentRect.width&&_this2.decideToToggleShowButton();}}catch(err){_iterator.e(err);}finally{_iterator.f();}});return e.observe(t),e;}}],[{key:"styles",get:function get(){return[h];}}]);}(e));t([o({type:Boolean,reflect:!0})],p.prototype,"isExpanded",void 0),t([r()],p.prototype,"showButton",void 0),t([l(".help__text__full")],p.prototype,"textContainer",void 0),_export("N",p=t([n("nile-form-help-text")],p));}};});
|
2
2
|
//# sourceMappingURL=nile-form-help-text.cjs.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"nile-form-help-text.cjs.js","sources":["../../../src/nile-form-help-text/nile-form-help-text.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, query, property } from 'lit/decorators.js';\nimport {styles} from './nile-form-help-text.css';\n\n/**\n * Nile icon component.\n *\n * @tag nile-form-help-text\n *\n */\n@customElement('nile-form-help-text')\nexport class NileFormHelpText extends LitElement {\n /**\n * The styles for FormHelpText\n * @remarks If you are extending this class you can extend the base styles with super. Eg `return [super(), myCustomStyles]`\n */\n public static get styles(): CSSResultArray {\n return [styles];\n }\n\n @property({ type: Boolean, reflect: true }) isExpanded: boolean = false;\n\n @
|
1
|
+
{"version":3,"file":"nile-form-help-text.cjs.js","sources":["../../../src/nile-form-help-text/nile-form-help-text.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, nothing, PropertyValues} from 'lit';\nimport { customElement, query, property, state } from 'lit/decorators.js';\nimport {styles} from './nile-form-help-text.css';\nimport { classMap } from 'lit/directives/class-map.js';\n\n/**\n * Nile icon component.\n *\n * @tag nile-form-help-text\n *\n */\n@customElement('nile-form-help-text')\nexport class NileFormHelpText extends LitElement {\n /**\n * The styles for FormHelpText\n * @remarks If you are extending this class you can extend the base styles with super. Eg `return [super(), myCustomStyles]`\n */\n public static get styles(): CSSResultArray {\n return [styles];\n }\n\n @property({ type: Boolean, reflect: true }) isExpanded: boolean = false;\n\n @state() showButton: boolean = false;\n\n @query('.help__text__full') textContainer:HTMLSpanElement;\n\n private resizeObserver:ResizeObserver;\n\n /* #endregion */\n\n /* #region Methods */\n\n protected firstUpdated(_changedProperties: PropertyValues): void {\n this.resizeObserver=this.observeWidthChange(this.textContainer);\n }\n\n disconnectedCallback(): void {\n this.resizeObserver.disconnect();\n }\n\n /**\n * Render method\n * @slot This is a slot test\n */\n public render(): TemplateResult {\n const iconName = this.isExpanded ? 'arrowup' : 'arrowdown';\n\n return html`\n <div \n class=\"${classMap({\n 'nile-form-help-text':true,\n \"nile-form-help-text--expanded\":this.isExpanded\n })}\" \n part=\"container\"\n >\n <span\n class=\"${classMap({\n \"help__text__full\":true,\n \"help__text__full--expanded\":this.isExpanded\n })}\"\n >\n <slot @slotchange=\"${this.decideToToggleShowButton}\"></slot>\n </span>\n ${this.showButton?html`\n <span\n class=\"nile-form-help-text__more-button\"\n part=\"toggle-button\"\n @click=${this.toggleExpanded}\n >${this.isExpanded ? 'View Less' : 'View More'}\n <nile-icon color=\"#005EA6\" part=\"icon\" size=\"14\" name=\"${iconName}\"></nile-icon>\n </span>\n `:nothing}\n </div>\n `;\n }\n\n toggleExpanded() {\n this.isExpanded = !this.isExpanded;\n }\n \n decideToToggleShowButton(){\n if(!this.textContainer) return;\n this.showButton=this.textContainer.clientWidth<this.textContainer.scrollWidth\n }\n\n /**\n * Logs whenever the width of an element changes.\n * @param {HTMLElement} element - The element to observe for width changes.\n */\n observeWidthChange(element:HTMLElement) {\n\n const resizeObserver = new ResizeObserver(entries => {\n for (let entry of entries) {\n const newWidth = entry.contentRect.width;\n if (newWidth) this.decideToToggleShowButton();\n }\n });\n\n resizeObserver.observe(element);\n\n return resizeObserver; // Return observer to allow disconnection if needed\n }\n}\n\nexport default NileFormHelpText;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-form-help-text': NileFormHelpText;\n }\n}"],"names":["NileFormHelpText","p","constructor","this","isExpanded","showButton","_this","_inherits","_e","_createClass","key","value","firstUpdated","_changedProperties","resizeObserver","observeWidthChange","textContainer","disconnectedCallback","disconnect","render","iconName","html","_templateObject","_taggedTemplateLiteral","classMap","help__text__full","decideToToggleShowButton","_templateObject2","toggleExpanded","nothing","clientWidth","scrollWidth","element","ResizeObserver","entries","_step","_iterator","s","n","done","entry","contentRect","width","err","e","f","observe","get","styles","LitElement","__decorate","property","type","Boolean","reflect","prototype","state","query","customElement"],"mappings":"mkKAmBaA,CAAAA,uBAAAA,EAAAA,EAAN,SAAAC,EAAA,CAAAC,KAAAA,KAAAA,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CAAA,mBAAA,CAAA,CAAA,CAAmDzD,CAAAuD,CAAAA,SAAAA,CAAA,oBAAA,EAb/CvD,CAAAA,CAAAA,OAAAA,KAAAA,CAAAA,CAAgBkD,EAAA,CAD5BQ,CAAAA,CAAc,wBACF1D"}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
System.register(["lit"],function(_export,_context){"use strict";var e,_templateObject,t;function _taggedTemplateLiteral(strings,raw){if(!raw){raw=strings.slice(0);}return Object.freeze(Object.defineProperties(strings,{raw:{value:Object.freeze(raw)}}));}return{setters:[function(_lit){e=_lit.css;}],execute:function execute(){_export("s",t=e(_templateObject||(_templateObject=_taggedTemplateLiteral(["\n :host {\n
|
1
|
+
System.register(["lit"],function(_export,_context){"use strict";var e,_templateObject,t;function _taggedTemplateLiteral(strings,raw){if(!raw){raw=strings.slice(0);}return Object.freeze(Object.defineProperties(strings,{raw:{value:Object.freeze(raw)}}));}return{setters:[function(_lit){e=_lit.css;}],execute:function execute(){_export("s",t=e(_templateObject||(_templateObject=_taggedTemplateLiteral(["\n :host {\n width:100%;\n color: var(--nile-form-help-text-color);\n font-family: var(--nile-font-family-serif);\n font-size: var(--nile-form-help-text-font-size);\n font-style: normal;\n line-height: var(--nile-form-help-text-line-height);\n }\n\n .nile-form-help-text {\n display:flex;\n font-weight: 400;\n letter-spacing: 0.2px;\n margin-top: 6px;\n margin-right: 4px;\n width: auto;\n }\n\n\n .nile-form-help-text--expanded{\n display:block;\n }\n\n .nile-form-help-text__more-button {\n display: inline-flex;\n gap: 4px;\n color: var(--nile-colors-primary-600);\n cursor: pointer;\n white-space: nowrap;\n align-items: center;\n }\n\n .help__text__full{\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n display:inline;\n }\n \n .help__text__full--expanded{\n white-space: wrap;\n }\n"]))));}};});
|
2
2
|
//# sourceMappingURL=nile-form-help-text.css.cjs.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"nile-form-help-text.css.cjs.js","sources":["../../../src/nile-form-help-text/nile-form-help-text.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';\n\n/**\n * FormHelpText CSS\n */\nexport const styles = css`\n :host {\n
|
1
|
+
{"version":3,"file":"nile-form-help-text.css.cjs.js","sources":["../../../src/nile-form-help-text/nile-form-help-text.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';\n\n/**\n * FormHelpText CSS\n */\nexport const styles = css`\n :host {\n width:100%;\n color: var(--nile-form-help-text-color);\n font-family: var(--nile-font-family-serif);\n font-size: var(--nile-form-help-text-font-size);\n font-style: normal;\n line-height: var(--nile-form-help-text-line-height);\n }\n\n .nile-form-help-text {\n display:flex;\n font-weight: 400;\n letter-spacing: 0.2px;\n margin-top: 6px;\n margin-right: 4px;\n width: auto;\n }\n\n\n .nile-form-help-text--expanded{\n display:block;\n }\n\n .nile-form-help-text__more-button {\n display: inline-flex;\n gap: 4px;\n color: var(--nile-colors-primary-600);\n cursor: pointer;\n white-space: nowrap;\n align-items: center;\n }\n\n .help__text__full{\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n display:inline;\n }\n \n .help__text__full--expanded{\n white-space: wrap;\n }\n`;\n\nexport default [styles];\n"],"names":["styles","css","_templateObject","_taggedTemplateLiteral"],"mappings":"iVAYaA,CAAAA,CAASC,CAAG,CAAAC,eAAA,GAAAA,eAAA,CAAAC,sBAAA"}
|
@@ -1,22 +1,27 @@
|
|
1
1
|
import{css as e}from"lit";const t=e`
|
2
2
|
:host {
|
3
|
-
|
4
|
-
|
5
|
-
.nile-form-help-text {
|
6
|
-
display: flex;
|
7
|
-
align-items: center;
|
3
|
+
width:100%;
|
8
4
|
color: var(--nile-form-help-text-color);
|
9
5
|
font-family: var(--nile-font-family-serif);
|
10
6
|
font-size: var(--nile-form-help-text-font-size);
|
11
7
|
font-style: normal;
|
12
|
-
font-weight: 400;
|
13
8
|
line-height: var(--nile-form-help-text-line-height);
|
9
|
+
}
|
10
|
+
|
11
|
+
.nile-form-help-text {
|
12
|
+
display:flex;
|
13
|
+
font-weight: 400;
|
14
14
|
letter-spacing: 0.2px;
|
15
15
|
margin-top: 6px;
|
16
16
|
margin-right: 4px;
|
17
17
|
width: auto;
|
18
18
|
}
|
19
19
|
|
20
|
+
|
21
|
+
.nile-form-help-text--expanded{
|
22
|
+
display:block;
|
23
|
+
}
|
24
|
+
|
20
25
|
.nile-form-help-text__more-button {
|
21
26
|
display: inline-flex;
|
22
27
|
gap: 4px;
|
@@ -25,4 +30,15 @@ import{css as e}from"lit";const t=e`
|
|
25
30
|
white-space: nowrap;
|
26
31
|
align-items: center;
|
27
32
|
}
|
33
|
+
|
34
|
+
.help__text__full{
|
35
|
+
overflow: hidden;
|
36
|
+
text-overflow: ellipsis;
|
37
|
+
white-space: nowrap;
|
38
|
+
display:inline;
|
39
|
+
}
|
40
|
+
|
41
|
+
.help__text__full--expanded{
|
42
|
+
white-space: wrap;
|
43
|
+
}
|
28
44
|
`;export{t as s};
|
@@ -1,17 +1,21 @@
|
|
1
|
-
import{__decorate as t}from"tslib";import{LitElement as e,html as i}from"lit";import{property as
|
2
|
-
<div
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
1
|
+
import{__decorate as t}from"tslib";import{LitElement as e,html as s,nothing as i}from"lit";import{property as o,state as r,query as l,customElement as n}from"lit/decorators.js";import{s as h}from"./nile-form-help-text.css.esm.js";import{classMap as a}from"lit/directives/class-map.js";let p=class extends e{constructor(){super(...arguments),this.isExpanded=!1,this.showButton=!1}static get styles(){return[h]}firstUpdated(t){this.resizeObserver=this.observeWidthChange(this.textContainer)}disconnectedCallback(){this.resizeObserver.disconnect()}render(){const t=this.isExpanded?"arrowup":"arrowdown";return s`
|
2
|
+
<div
|
3
|
+
class="${a({"nile-form-help-text":!0,"nile-form-help-text--expanded":this.isExpanded})}"
|
4
|
+
part="container"
|
5
|
+
>
|
6
|
+
<span
|
7
|
+
class="${a({help__text__full:!0,"help__text__full--expanded":this.isExpanded})}"
|
8
|
+
>
|
9
|
+
<slot @slotchange="${this.decideToToggleShowButton}"></slot>
|
10
|
+
</span>
|
11
|
+
${this.showButton?s`
|
12
|
+
<span
|
13
|
+
class="nile-form-help-text__more-button"
|
14
|
+
part="toggle-button"
|
15
|
+
@click=${this.toggleExpanded}
|
16
|
+
>${this.isExpanded?"View Less":"View More"}
|
17
|
+
<nile-icon color="#005EA6" part="icon" size="14" name="${t}"></nile-icon>
|
18
|
+
</span>
|
19
|
+
`:i}
|
16
20
|
</div>
|
17
|
-
`}
|
21
|
+
`}toggleExpanded(){this.isExpanded=!this.isExpanded}decideToToggleShowButton(){this.textContainer&&(this.showButton=this.textContainer.clientWidth<this.textContainer.scrollWidth)}observeWidthChange(t){const e=new ResizeObserver((t=>{for(let e of t){e.contentRect.width&&this.decideToToggleShowButton()}}));return e.observe(t),e}};t([o({type:Boolean,reflect:!0})],p.prototype,"isExpanded",void 0),t([r()],p.prototype,"showButton",void 0),t([l(".help__text__full")],p.prototype,"textContainer",void 0),p=t([n("nile-form-help-text")],p);export{p 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(["../fixture-a0ed956d.cjs.js","lit/static-html.js","lit/html.js","lit/directive-helpers.js","lit","lit/directives/unsafe-html.js","./nile-form-help-text.cjs.js","tslib","lit/decorators.js","./nile-form-help-text.css.cjs.js"],function(_export,_context){"use strict";var t,e,i,_templateObject,_templateObject2,_templateObject3,_templateObject4,_templateObject5;function _regeneratorRuntime(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */_regeneratorRuntime=function _regeneratorRuntime(){return e;};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value;},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function define(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e];}try{define({},"");}catch(t){define=function define(t,e,r){return t[e]=r;};}function wrap(t,e,r,n){var i=e&&e.prototype instanceof Generator?e:Generator,a=Object.create(i.prototype),c=new Context(n||[]);return o(a,"_invoke",{value:makeInvokeMethod(t,r,c)}),a;}function tryCatch(t,e,r){try{return{type:"normal",arg:t.call(e,r)};}catch(t){return{type:"throw",arg:t};}}e.wrap=wrap;var h="suspendedStart",l="suspendedYield",f="executing",s="completed",y={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}var p={};define(p,a,function(){return this;});var d=Object.getPrototypeOf,v=d&&d(d(values([])));v&&v!==r&&n.call(v,a)&&(p=v);var g=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(p);function defineIteratorMethods(t){["next","throw","return"].forEach(function(e){define(t,e,function(t){return this._invoke(e,t);});});}function AsyncIterator(t,e){function invoke(r,o,i,a){var c=tryCatch(t[r],t,o);if("throw"!==c.type){var u=c.arg,h=u.value;return h&&"object"==_typeof(h)&&n.call(h,"__await")?e.resolve(h.__await).then(function(t){invoke("next",t,i,a);},function(t){invoke("throw",t,i,a);}):e.resolve(h).then(function(t){u.value=t,i(u);},function(t){return invoke("throw",t,i,a);});}a(c.arg);}var r;o(this,"_invoke",{value:function value(t,n){function callInvokeWithMethodAndArg(){return new e(function(e,r){invoke(t,n,e,r);});}return r=r?r.then(callInvokeWithMethodAndArg,callInvokeWithMethodAndArg):callInvokeWithMethodAndArg();}});}function makeInvokeMethod(e,r,n){var o=h;return function(i,a){if(o===f)throw Error("Generator is already running");if(o===s){if("throw"===i)throw a;return{value:t,done:!0};}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=maybeInvokeDelegate(c,n);if(u){if(u===y)continue;return u;}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=s,n.arg;n.dispatchException(n.arg);}else"return"===n.method&&n.abrupt("return",n.arg);o=f;var p=tryCatch(e,r,n);if("normal"===p.type){if(o=n.done?s:l,p.arg===y)continue;return{value:p.arg,done:n.done};}"throw"===p.type&&(o=s,n.method="throw",n.arg=p.arg);}};}function maybeInvokeDelegate(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator["return"]&&(r.method="return",r.arg=t,maybeInvokeDelegate(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),y;var i=tryCatch(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,y;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,y):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,y);}function pushTryEntry(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e);}function resetTryEntry(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e;}function Context(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(pushTryEntry,this),this.reset(!0);}function values(e){if(e||""===e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function next(){for(;++o<e.length;)if(n.call(e,o))return next.value=e[o],next.done=!1,next;return next.value=t,next.done=!0,next;};return i.next=i;}}throw new TypeError(_typeof(e)+" is not iterable");}return GeneratorFunction.prototype=GeneratorFunctionPrototype,o(g,"constructor",{value:GeneratorFunctionPrototype,configurable:!0}),o(GeneratorFunctionPrototype,"constructor",{value:GeneratorFunction,configurable:!0}),GeneratorFunction.displayName=define(GeneratorFunctionPrototype,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===GeneratorFunction||"GeneratorFunction"===(e.displayName||e.name));},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,GeneratorFunctionPrototype):(t.__proto__=GeneratorFunctionPrototype,define(t,u,"GeneratorFunction")),t.prototype=Object.create(g),t;},e.awrap=function(t){return{__await:t};},defineIteratorMethods(AsyncIterator.prototype),define(AsyncIterator.prototype,c,function(){return this;}),e.AsyncIterator=AsyncIterator,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new AsyncIterator(wrap(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then(function(t){return t.done?t.value:a.next();});},defineIteratorMethods(g),define(g,u,"Generator"),define(g,a,function(){return this;}),define(g,"toString",function(){return"[object Generator]";}),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function next(){for(;r.length;){var t=r.pop();if(t in e)return next.value=t,next.done=!1,next;}return next.done=!0,next;};},e.values=values,Context.prototype={constructor:Context,reset:function reset(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(resetTryEntry),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t);},stop:function stop(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval;},dispatchException:function dispatchException(e){if(this.done)throw e;var r=this;function handle(n,o){return a.type="throw",a.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o;}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return handle("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),u=n.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return handle(i.catchLoc,!0);if(this.prev<i.finallyLoc)return handle(i.finallyLoc);}else if(c){if(this.prev<i.catchLoc)return handle(i.catchLoc,!0);}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return handle(i.finallyLoc);}}}},abrupt:function abrupt(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break;}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,y):this.complete(a);},complete:function complete(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),y;},finish:function finish(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),resetTryEntry(r),y;}},"catch":function _catch(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;resetTryEntry(r);}return o;}}throw Error("illegal catch attempt");},delegateYield:function delegateYield(e,r,n){return this.delegate={iterator:values(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),y;}},e;}function _taggedTemplateLiteral(strings,raw){if(!raw){raw=strings.slice(0);}return Object.freeze(Object.defineProperties(strings,{raw:{value:Object.freeze(raw)}}));}function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}return{setters:[function(_fixture003CjsJs){t=_fixture003CjsJs.f;e=_fixture003CjsJs.a;},function(_litStaticHtmlJs){i=_litStaticHtmlJs.html;},function(_litHtmlJs){},function(_litDirectiveHelpersJs){},function(_lit){},function(_litDirectivesUnsafeHtmlJs){},function(_nileFormHelpTextCjsJs){},function(_tslib){},function(_litDecoratorsJs){},function(_nileFormHelpTextCssCjsJs){}],execute:function execute(){describe("NileFormHelpText",function(){it("should render with default properties",/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(){var _o$shadowRoot$querySe;var o,s;return _regeneratorRuntime().wrap(function _callee$(_context2){while(1)switch(_context2.prev=_context2.next){case 0:_context2.next=2;return t(i(_templateObject||(_templateObject=_taggedTemplateLiteral(["<nile-form-help-text>This is a very short text</nile-form-help-text>"]))));case 2:o=_context2.sent;s=(_o$shadowRoot$querySe=o.shadowRoot.querySelector("div>span:first-child"))===null||_o$shadowRoot$querySe===void 0||(_o$shadowRoot$querySe=_o$shadowRoot$querySe.textContent)===null||_o$shadowRoot$querySe===void 0?void 0:_o$shadowRoot$querySe.trim();e(s).to.equal("This is a very short text");case 5:case"end":return _context2.stop();}},_callee);}))),it('should truncate the text if it exceeds textLimit and show "View More" button',/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(){var _o$shadowRoot$querySe2;var o,s,l;return _regeneratorRuntime().wrap(function _callee2$(_context3){while(1)switch(_context3.prev=_context3.next){case 0:_context3.next=2;return t(i(_templateObject2||(_templateObject2=_taggedTemplateLiteral(["<nile-form-help-text><span>","</span></nile-form-help-text>"])),"This is a very long help text that should be truncated and should show a 'View More' button."));case 2:o=_context3.sent;s=(_o$shadowRoot$querySe2=o.shadowRoot.querySelector("div>span:first-child"))===null||_o$shadowRoot$querySe2===void 0||(_o$shadowRoot$querySe2=_o$shadowRoot$querySe2.textContent)===null||_o$shadowRoot$querySe2===void 0?void 0:_o$shadowRoot$querySe2.trim();e(s===null||s===void 0?void 0:s.endsWith("...")).to.be["true"];l=o.shadowRoot.querySelector(".nile-form-help-text__more-button");e(l).to.exist,e(l===null||l===void 0?void 0:l.textContent).to.include("View More");case 7:case"end":return _context3.stop();}},_callee2);}))),it('should expand to show full text when "View More" is clicked',/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(){var _s$shadowRoot$querySe;var o,s,l,n,r;return _regeneratorRuntime().wrap(function _callee3$(_context4){while(1)switch(_context4.prev=_context4.next){case 0:o="This is a very long help text that should be truncated and should show a 'View More' button.";_context4.next=3;return t(i(_templateObject3||(_templateObject3=_taggedTemplateLiteral(["<nile-form-help-text><span>","</span></nile-form-help-text>"])),o));case 3:s=_context4.sent;l=s.shadowRoot.querySelector(".nile-form-help-text__more-button");l!==null&&l!==void 0&&l.click();_context4.next=8;return s.updateComplete;case 8:n=(_s$shadowRoot$querySe=s.shadowRoot.querySelector("div>span:first-child"))===null||_s$shadowRoot$querySe===void 0||(_s$shadowRoot$querySe=_s$shadowRoot$querySe.textContent)===null||_s$shadowRoot$querySe===void 0?void 0:_s$shadowRoot$querySe.trim();e(n).to.equal(o);r=s.shadowRoot.querySelector(".nile-form-help-text__more-button");e(r).to.exist,e(r===null||r===void 0?void 0:r.textContent).to.include("View Less");case 12:case"end":return _context4.stop();}},_callee3);}))),it('should collapse back to truncated text when "View Less" is clicked',/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(){var _o$shadowRoot$querySe3;var o,s,l,n,r;return _regeneratorRuntime().wrap(function _callee4$(_context5){while(1)switch(_context5.prev=_context5.next){case 0:_context5.next=2;return t(i(_templateObject4||(_templateObject4=_taggedTemplateLiteral(["<nile-form-help-text><span>","</span></nile-form-help-text>"])),"This is a very long help text that should be truncated and should show a 'View More' button."));case 2:o=_context5.sent;s=o.shadowRoot.querySelector(".nile-form-help-text__more-button");s!==null&&s!==void 0&&s.click();_context5.next=7;return o.updateComplete;case 7:l=o.shadowRoot.querySelector(".nile-form-help-text__more-button");l!==null&&l!==void 0&&l.click();_context5.next=11;return o.updateComplete;case 11:n=(_o$shadowRoot$querySe3=o.shadowRoot.querySelector("div>span:first-child"))===null||_o$shadowRoot$querySe3===void 0||(_o$shadowRoot$querySe3=_o$shadowRoot$querySe3.textContent)===null||_o$shadowRoot$querySe3===void 0?void 0:_o$shadowRoot$querySe3.trim();e(n===null||n===void 0?void 0:n.endsWith("...")).to.be["true"];r=o.shadowRoot.querySelector(".nile-form-help-text__more-button");e(r).to.exist,e(r===null||r===void 0?void 0:r.textContent).to.include("View More");case 15:case"end":return _context5.stop();}},_callee4);}))),it('should not show "View More" button when text is within limit',/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(){var _s$shadowRoot$querySe2;var o,s,l,n;return _regeneratorRuntime().wrap(function _callee5$(_context6){while(1)switch(_context6.prev=_context6.next){case 0:o="Short help text.";_context6.next=3;return t(i(_templateObject5||(_templateObject5=_taggedTemplateLiteral(["<nile-form-help-text><span>","</span></nile-form-help-text>"])),o));case 3:s=_context6.sent;l=(_s$shadowRoot$querySe2=s.shadowRoot.querySelector("div>span:first-child"))===null||_s$shadowRoot$querySe2===void 0||(_s$shadowRoot$querySe2=_s$shadowRoot$querySe2.textContent)===null||_s$shadowRoot$querySe2===void 0?void 0:_s$shadowRoot$querySe2.trim();e(l).to.equal(o);n=s.shadowRoot.querySelector(".nile-form-help-text__more-button");e(n).to.be["null"];case 8:case"end":return _context6.stop();}},_callee5);})));});}};});
|
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(["../fixture-a0ed956d.cjs.js","lit/static-html.js","lit/html.js","lit/directive-helpers.js","lit","lit/directives/unsafe-html.js","./nile-form-help-text.cjs.js","tslib","lit/decorators.js","./nile-form-help-text.css.cjs.js","lit/directives/class-map.js"],function(_export,_context){"use strict";var t,e,i,l,o,_templateObject,_templateObject2,_templateObject3,_templateObject4,_templateObject5;function _regeneratorRuntime(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */_regeneratorRuntime=function _regeneratorRuntime(){return e;};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value;},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function define(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e];}try{define({},"");}catch(t){define=function define(t,e,r){return t[e]=r;};}function wrap(t,e,r,n){var i=e&&e.prototype instanceof Generator?e:Generator,a=Object.create(i.prototype),c=new Context(n||[]);return o(a,"_invoke",{value:makeInvokeMethod(t,r,c)}),a;}function tryCatch(t,e,r){try{return{type:"normal",arg:t.call(e,r)};}catch(t){return{type:"throw",arg:t};}}e.wrap=wrap;var h="suspendedStart",l="suspendedYield",f="executing",s="completed",y={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}var p={};define(p,a,function(){return this;});var d=Object.getPrototypeOf,v=d&&d(d(values([])));v&&v!==r&&n.call(v,a)&&(p=v);var g=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(p);function defineIteratorMethods(t){["next","throw","return"].forEach(function(e){define(t,e,function(t){return this._invoke(e,t);});});}function AsyncIterator(t,e){function invoke(r,o,i,a){var c=tryCatch(t[r],t,o);if("throw"!==c.type){var u=c.arg,h=u.value;return h&&"object"==_typeof(h)&&n.call(h,"__await")?e.resolve(h.__await).then(function(t){invoke("next",t,i,a);},function(t){invoke("throw",t,i,a);}):e.resolve(h).then(function(t){u.value=t,i(u);},function(t){return invoke("throw",t,i,a);});}a(c.arg);}var r;o(this,"_invoke",{value:function value(t,n){function callInvokeWithMethodAndArg(){return new e(function(e,r){invoke(t,n,e,r);});}return r=r?r.then(callInvokeWithMethodAndArg,callInvokeWithMethodAndArg):callInvokeWithMethodAndArg();}});}function makeInvokeMethod(e,r,n){var o=h;return function(i,a){if(o===f)throw Error("Generator is already running");if(o===s){if("throw"===i)throw a;return{value:t,done:!0};}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=maybeInvokeDelegate(c,n);if(u){if(u===y)continue;return u;}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=s,n.arg;n.dispatchException(n.arg);}else"return"===n.method&&n.abrupt("return",n.arg);o=f;var p=tryCatch(e,r,n);if("normal"===p.type){if(o=n.done?s:l,p.arg===y)continue;return{value:p.arg,done:n.done};}"throw"===p.type&&(o=s,n.method="throw",n.arg=p.arg);}};}function maybeInvokeDelegate(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator["return"]&&(r.method="return",r.arg=t,maybeInvokeDelegate(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),y;var i=tryCatch(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,y;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,y):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,y);}function pushTryEntry(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e);}function resetTryEntry(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e;}function Context(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(pushTryEntry,this),this.reset(!0);}function values(e){if(e||""===e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function next(){for(;++o<e.length;)if(n.call(e,o))return next.value=e[o],next.done=!1,next;return next.value=t,next.done=!0,next;};return i.next=i;}}throw new TypeError(_typeof(e)+" is not iterable");}return GeneratorFunction.prototype=GeneratorFunctionPrototype,o(g,"constructor",{value:GeneratorFunctionPrototype,configurable:!0}),o(GeneratorFunctionPrototype,"constructor",{value:GeneratorFunction,configurable:!0}),GeneratorFunction.displayName=define(GeneratorFunctionPrototype,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===GeneratorFunction||"GeneratorFunction"===(e.displayName||e.name));},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,GeneratorFunctionPrototype):(t.__proto__=GeneratorFunctionPrototype,define(t,u,"GeneratorFunction")),t.prototype=Object.create(g),t;},e.awrap=function(t){return{__await:t};},defineIteratorMethods(AsyncIterator.prototype),define(AsyncIterator.prototype,c,function(){return this;}),e.AsyncIterator=AsyncIterator,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new AsyncIterator(wrap(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then(function(t){return t.done?t.value:a.next();});},defineIteratorMethods(g),define(g,u,"Generator"),define(g,a,function(){return this;}),define(g,"toString",function(){return"[object Generator]";}),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function next(){for(;r.length;){var t=r.pop();if(t in e)return next.value=t,next.done=!1,next;}return next.done=!0,next;};},e.values=values,Context.prototype={constructor:Context,reset:function reset(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(resetTryEntry),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t);},stop:function stop(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval;},dispatchException:function dispatchException(e){if(this.done)throw e;var r=this;function handle(n,o){return a.type="throw",a.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o;}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return handle("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),u=n.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return handle(i.catchLoc,!0);if(this.prev<i.finallyLoc)return handle(i.finallyLoc);}else if(c){if(this.prev<i.catchLoc)return handle(i.catchLoc,!0);}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return handle(i.finallyLoc);}}}},abrupt:function abrupt(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break;}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,y):this.complete(a);},complete:function complete(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),y;},finish:function finish(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),resetTryEntry(r),y;}},"catch":function _catch(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;resetTryEntry(r);}return o;}}throw Error("illegal catch attempt");},delegateYield:function delegateYield(e,r,n){return this.delegate={iterator:values(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),y;}},e;}function _taggedTemplateLiteral(strings,raw){if(!raw){raw=strings.slice(0);}return Object.freeze(Object.defineProperties(strings,{raw:{value:Object.freeze(raw)}}));}function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}return{setters:[function(_fixture003CjsJs){t=_fixture003CjsJs.f;e=_fixture003CjsJs.a;i=_fixture003CjsJs.e;},function(_litStaticHtmlJs){l=_litStaticHtmlJs.html;},function(_litHtmlJs){},function(_litDirectiveHelpersJs){},function(_lit){},function(_litDirectivesUnsafeHtmlJs){},function(_nileFormHelpTextCjsJs){o=_nileFormHelpTextCjsJs.N;},function(_tslib){},function(_litDecoratorsJs){},function(_nileFormHelpTextCssCjsJs){},function(_litDirectivesClassMapJs){}],execute:function execute(){describe("NileFormHelpText",function(){it("should render with default properties",/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(){var _i$textContent;var i,s;return _regeneratorRuntime().wrap(function _callee$(_context2){while(1)switch(_context2.prev=_context2.next){case 0:_context2.next=2;return t(l(_templateObject||(_templateObject=_taggedTemplateLiteral(["<nile-form-help-text>This is a short text</nile-form-help-text>"]))));case 2:i=_context2.sent;e(i).to.be.instanceOf(o),e(i.isExpanded).to.be["false"];s=i===null||i===void 0||(_i$textContent=i.textContent)===null||_i$textContent===void 0?void 0:_i$textContent.trim();e(s).to.equal("This is a short text");case 6:case"end":return _context2.stop();}},_callee);}))),it('should not show "View More" button if the text fits within the container',/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(){var _o$shadowRoot;var o,s;return _regeneratorRuntime().wrap(function _callee2$(_context3){while(1)switch(_context3.prev=_context3.next){case 0:_context3.next=2;return t(l(_templateObject2||(_templateObject2=_taggedTemplateLiteral(["<nile-form-help-text>This is a short text</nile-form-help-text>"]))));case 2:o=_context3.sent;_context3.next=5;return i(o);case 5:s=(_o$shadowRoot=o.shadowRoot)===null||_o$shadowRoot===void 0?void 0:_o$shadowRoot.querySelector(".nile-form-help-text__more-button");e(s).to.be["null"],e(o.showButton).to.be["false"];case 7:case"end":return _context3.stop();}},_callee2);}))),it('should show "View More" button if the text overflows the container',/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(){var _o$shadowRoot2,_o$shadowRoot3;var o,s,h;return _regeneratorRuntime().wrap(function _callee3$(_context4){while(1)switch(_context4.prev=_context4.next){case 0:_context4.next=2;return t(l(_templateObject3||(_templateObject3=_taggedTemplateLiteral(["<nile-form-help-text>","</nile-form-help-text>"])),'This is a very long help text that exceeds the container width and should show a "View More" button.'));case 2:o=_context4.sent;s=(_o$shadowRoot2=o.shadowRoot)===null||_o$shadowRoot2===void 0?void 0:_o$shadowRoot2.querySelector(".help__text__full");Object.defineProperty(s,"scrollWidth",{value:300});Object.defineProperty(s,"clientWidth",{value:200});o.decideToToggleShowButton();_context4.next=9;return i(o);case 9:h=(_o$shadowRoot3=o.shadowRoot)===null||_o$shadowRoot3===void 0?void 0:_o$shadowRoot3.querySelector(".nile-form-help-text__more-button");e(h).to.exist,e(o.showButton).to.be["true"];case 11:case"end":return _context4.stop();}},_callee3);}))),it('should expand to show full text when "View More" is clicked',/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(){var _o$shadowRoot4,_o$shadowRoot5;var o,s,h;return _regeneratorRuntime().wrap(function _callee4$(_context5){while(1)switch(_context5.prev=_context5.next){case 0:_context5.next=2;return t(l(_templateObject4||(_templateObject4=_taggedTemplateLiteral(["<nile-form-help-text>","</nile-form-help-text>"])),'This is a very long help text that exceeds the container width and should show a "View More" button.'));case 2:o=_context5.sent;s=(_o$shadowRoot4=o.shadowRoot)===null||_o$shadowRoot4===void 0?void 0:_o$shadowRoot4.querySelector(".help__text__full");Object.defineProperty(s,"scrollWidth",{value:300});Object.defineProperty(s,"clientWidth",{value:200});o.decideToToggleShowButton();_context5.next=9;return i(o);case 9:h=(_o$shadowRoot5=o.shadowRoot)===null||_o$shadowRoot5===void 0?void 0:_o$shadowRoot5.querySelector(".nile-form-help-text__more-button");h!==null&&h!==void 0&&h.click();_context5.next=13;return i(o);case 13:e(o.isExpanded).to.be["true"];e(s).to.have["class"]("help__text__full--expanded");e(h===null||h===void 0?void 0:h.textContent).to.include("View Less");case 16:case"end":return _context5.stop();}},_callee4);}))),it('should collapse back to truncated text when "View Less" is clicked',/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(){var _o$shadowRoot6,_o$shadowRoot7;var o,s,h;return _regeneratorRuntime().wrap(function _callee5$(_context6){while(1)switch(_context6.prev=_context6.next){case 0:_context6.next=2;return t(l(_templateObject5||(_templateObject5=_taggedTemplateLiteral(["<nile-form-help-text>","</nile-form-help-text>"])),'This is a very long help text that exceeds the container width and should show a "View More" button.'));case 2:o=_context6.sent;s=(_o$shadowRoot6=o.shadowRoot)===null||_o$shadowRoot6===void 0?void 0:_o$shadowRoot6.querySelector(".help__text__full");Object.defineProperty(s,"scrollWidth",{value:300});Object.defineProperty(s,"clientWidth",{value:200});o.decideToToggleShowButton();_context6.next=9;return i(o);case 9:h=(_o$shadowRoot7=o.shadowRoot)===null||_o$shadowRoot7===void 0?void 0:_o$shadowRoot7.querySelector(".nile-form-help-text__more-button");h!==null&&h!==void 0&&h.click();_context6.next=13;return i(o);case 13:h!==null&&h!==void 0&&h.click();_context6.next=16;return i(o);case 16:e(o.isExpanded).to.be["false"];e(s).not.to.have["class"]("help__text__full--expanded");e(h===null||h===void 0?void 0:h.textContent).to.include("View More");case 19:case"end":return _context6.stop();}},_callee5);})));});}};});
|
2
2
|
//# sourceMappingURL=nile-form-help-text.test.cjs.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"nile-form-help-text.test.cjs.js","sources":["../../../src/nile-form-help-text/nile-form-help-text.test.ts"],"sourcesContent":["import { fixture, expect, html } from '@open-wc/testing';\nimport './nile-form-help-text';\nimport { NileFormHelpText } from './nile-form-help-text';\n\nconst wait = (ms: number = 50000) => new Promise(resolve => setTimeout(resolve, ms))\n\ndescribe('NileFormHelpText', () => {\n it('should render with default properties', async () => {\n const el: NileFormHelpText = await fixture(html`<nile-form-help-text>This is a very short text</nile-form-help-text>`);\n \n // Check if the displayed text is empty initially (no content in slot)\n const textContent = el.shadowRoot!.querySelector('div>span:first-child')?.textContent?.trim()\n expect(textContent).to.equal('This is a very short text');\n });\n\n it('should truncate the text if it exceeds textLimit and show \"View More\" button', async () => {\n const longText = \"This is a very long help text that should be truncated and should show a 'View More' button.\";\n const el: NileFormHelpText = await fixture(html`<nile-form-help-text><span>${longText}</span></nile-form-help-text>`);\n \n // Check if the displayed text is truncated\n const textContent = el.shadowRoot!.querySelector('div>span:first-child')?.textContent?.trim()\n expect(textContent?.endsWith('...')).to.be.true;\n \n // Check if the \"View More\" button is visible\n const moreButton = el.shadowRoot!.querySelector('.nile-form-help-text__more-button');\n expect(moreButton).to.exist;\n expect(moreButton?.textContent).to.include('View More');\n });\n\n it('should expand to show full text when \"View More\" is clicked', async () => {\n const longText = \"This is a very long help text that should be truncated and should show a 'View More' button.\";\n const el: NileFormHelpText = await fixture(html`<nile-form-help-text><span>${longText}</span></nile-form-help-text>`);\n \n // Simulate clicking the \"View More\" button\n const moreButton = el.shadowRoot!.querySelector<HTMLElement>('.nile-form-help-text__more-button');\n moreButton?.click();\n await el.updateComplete;\n\n // Verify that the full text is displayed\n const textContent = el.shadowRoot!.querySelector('div>span:first-child')?.textContent?.trim()\n expect(textContent).to.equal(longText);\n \n // Check if the \"View Less\" button is now visible\n const lessButton = el.shadowRoot!.querySelector('.nile-form-help-text__more-button');\n expect(lessButton).to.exist;\n expect(lessButton?.textContent).to.include('View Less');\n });\n\n it('should collapse back to truncated text when \"View Less\" is clicked', async () => {\n const longText = \"This is a very long help text that should be truncated and should show a 'View More' button.\";\n const el: NileFormHelpText = await fixture(html`<nile-form-help-text><span>${longText}</span></nile-form-help-text>`);\n \n // Expand the text\n const moreButton = el.shadowRoot!.querySelector<HTMLElement>('.nile-form-help-text__more-button');\n moreButton?.click();\n await el.updateComplete;\n\n // Collapse the text by clicking \"View Less\"\n const lessButton = el.shadowRoot!.querySelector<HTMLElement>('.nile-form-help-text__more-button');\n lessButton?.click();\n await el.updateComplete;\n\n // Verify that the text is truncated again\n const textContent = el.shadowRoot!.querySelector('div>span:first-child')?.textContent?.trim()\n expect(textContent?.endsWith('...')).to.be.true;\n \n // Check if the \"View More\" button is visible again\n const viewMoreButton = el.shadowRoot!.querySelector('.nile-form-help-text__more-button');\n expect(viewMoreButton).to.exist;\n expect(viewMoreButton?.textContent).to.include('View More');\n });\n\n it('should not show \"View More\" button when text is within limit', async () => {\n const shortText = \"Short help text.\";\n const el: NileFormHelpText = await fixture(html`<nile-form-help-text><span>${shortText}</span></nile-form-help-text>`);\n \n // Check if the displayed text is not truncated\n const textContent = el.shadowRoot!.querySelector('div>span:first-child')?.textContent?.trim()\n expect(textContent).to.equal(shortText);\n\n // Verify that \"View More\" button is not rendered\n const moreButton = el.shadowRoot!.querySelector('.nile-form-help-text__more-button');\n expect(moreButton).to.be.null;\n });\n\n});\n"],"names":["describe","it","_asyncToGenerator","_regeneratorRuntime","mark","async","fixture","html","_templateObject","_taggedTemplateLiteral","textContent","el","shadowRoot","querySelector","trim","expect","to","equal","_context2","stop","_callee","_templateObject2","_o$shadowRoot$querySe2","endsWith","be","true","moreButton","exist","include","_context3","_callee2","longText","_context4","next","_templateObject3","click","updateComplete","lessButton","_callee3","_templateObject4","viewMoreButton","_context5","_callee4","shortText","_context6","_templateObject5","null","_callee5"],"mappings":"+1SAMAA,SAAS,kBAAoB,CAAA,UAAA,CAC3BC,EAAG,CAAA,uCAAA,cAAAC,iBAAA,cAAAC,mBAAA,GAAAC,IAAA,CAAyCC,SAAAA,QAAAA,MAAAA,qBAAAA,KAAAA,CAAAA,CAAAA,CAAAA,QAAAA,mBAAAA,GAAAA,IAAAA,UAAAA,SAAAA,SAAAA,iBAAAA,SAAAA,CAAAA,IAAAA,CAAAA,SAAAA,CAAAA,IAAAA,SAAAA,SAAAA,CAAAA,IAAAA,SACPC,CAAAA,CAAQC,CAAAA,CAAI,CAAAC,eAAA,GAAAA,eAAA,CAAAC,sBAAA,4EAGzCC,CAAAA,QAHAC,iBAGAD,CAAAA,EAAAA,qBAAAA,CAAcC,CAAGC,CAAAA,UAAAA,CAAYC,cAAc,sBAAyBH,CAAAA,UAAAA,qBAAAA,YAAAA,qBAAAA,CAAtDC,qBAAAA,CAAsDD,WAAAA,UAAAA,qBAAAA,iBAAtDC,qBAAAA,CAAmEG,IACvFC,CAAAA,CAAAA,CAAAA,CAAAA,CAAOL,CAAaM,CAAAA,CAAAA,EAAAA,CAAGC,MAAM,2BAA4B,CAAA,yBAAAC,SAAA,CAAAC,IAAA,MAAAC,OAAA,GAAA,EAAA,CAAA,CAG3DnB,EAAG,CAAA,8EAAA,cAAAC,iBAAA,cAAAC,mBAAA,GAAAC,IAAA,CAAgFC,SAAAA,SAAAA,MAAAA,sBAAAA,KAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,QAAAA,mBAAAA,GAAAA,IAAAA,UAAAA,UAAAA,SAAAA,iBAAAA,SAAAA,CAAAA,IAAAA,CAAAA,SAAAA,CAAAA,IAAAA,SAAAA,SAAAA,CAAAA,IAAAA,SAE9CC,CAAAA,CAAQC,CAAAA,CAAI,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UAAAA,SAAAA,iBAAAA,SAAAA,CAAAA,IAAAA,CAAAA,SAAAA,CAAAA,IAAAA,SAC3DsC,CAAY,CAAA,kBAAA,CAAAC,SAAA,CAAAX,IAAA,SACiB3B,CAAAA,CAAAA,CAAQC,CAAI,CAAAsC,gBAAA,GAAAA,gBAAA,CAAApC,sBAAA,mEAA8BkC,CAAAA,CAAAA,CAAAA,QAAvEhC,CAA6BL,CAAAA,SAAAA,CAAAA,IAAAA,CAG7BI,CAAcC,EAAAA,sBAAAA,CAAAA,CAAAA,CAAGC,UAAYC,CAAAA,aAAAA,CAAc,0FAA7BF,sBAAAA,CAAsDD,WAAaI,UAAAA,sBAAAA,iBAAnEH,sBAAAA,CAAmEG,IAAAA,CAAAA,CAAAA,CACvFC,CAAOL,CAAAA,CAAAA,CAAAA,CAAaM,EAAGC,CAAAA,KAAAA,CAAM0B,GAGvBjB,CAAAA,CAAaf,CAAGC,CAAAA,UAAAA,CAAYC,aAAc,CAAA,mCAAA,CAAA,CAChDE,EAAOW,CAAYV,CAAAA,CAAAA,EAAAA,CAAGQ,EAAGsB,QAAI,yBAAAF,SAAA,CAAAzB,IAAA,MAAA4B,QAAA,GAC7B,EAAA,CAAA,EAAA,CAAA,CAAA"}
|
1
|
+
{"version":3,"file":"nile-form-help-text.test.cjs.js","sources":["../../../src/nile-form-help-text/nile-form-help-text.test.ts"],"sourcesContent":["import { fixture, expect, html, elementUpdated } from '@open-wc/testing';\nimport './nile-form-help-text';\nimport { NileFormHelpText } from './nile-form-help-text';\n\nconst wait = (ms: number = 50000) => new Promise(resolve => setTimeout(resolve, ms))\n\n\ndescribe('NileFormHelpText', () => {\n it('should render with default properties', async () => {\n const el = await fixture<NileFormHelpText>(html`<nile-form-help-text>This is a short text</nile-form-help-text>`);\n expect(el).to.be.instanceOf(NileFormHelpText);\n expect(el.isExpanded).to.be.false;\n\n // Check if text content matches\n const textContent = el?.textContent?.trim();\n expect(textContent).to.equal('This is a short text');\n });\n\n it('should not show \"View More\" button if the text fits within the container', async () => {\n const el = await fixture<NileFormHelpText>(html`<nile-form-help-text>This is a short text</nile-form-help-text>`);\n await elementUpdated(el);\n\n const moreButton = el.shadowRoot?.querySelector('.nile-form-help-text__more-button');\n expect(moreButton).to.be.null;\n expect(el.showButton).to.be.false;\n });\n\n it('should show \"View More\" button if the text overflows the container', async () => {\n const longText = 'This is a very long help text that exceeds the container width and should show a \"View More\" button.';\n const el = await fixture<NileFormHelpText>(html`<nile-form-help-text>${longText}</nile-form-help-text>`);\n \n // Simulate overflow\n const textContainer = el.shadowRoot?.querySelector('.help__text__full') as HTMLSpanElement;\n Object.defineProperty(textContainer, 'scrollWidth', { value: 300 });\n Object.defineProperty(textContainer, 'clientWidth', { value: 200 });\n el.decideToToggleShowButton();\n await elementUpdated(el);\n\n const moreButton = el.shadowRoot?.querySelector('.nile-form-help-text__more-button');\n expect(moreButton).to.exist;\n expect(el.showButton).to.be.true;\n });\n\n it('should expand to show full text when \"View More\" is clicked', async () => {\n const longText = 'This is a very long help text that exceeds the container width and should show a \"View More\" button.';\n const el = await fixture<NileFormHelpText>(html`<nile-form-help-text>${longText}</nile-form-help-text>`);\n\n // Simulate overflow\n const textContainer = el.shadowRoot?.querySelector('.help__text__full') as HTMLSpanElement;\n Object.defineProperty(textContainer, 'scrollWidth', { value: 300 });\n Object.defineProperty(textContainer, 'clientWidth', { value: 200 });\n el.decideToToggleShowButton();\n await elementUpdated(el);\n\n // Click \"View More\"\n const moreButton = el.shadowRoot?.querySelector<HTMLElement>('.nile-form-help-text__more-button');\n moreButton?.click();\n await elementUpdated(el);\n\n expect(el.isExpanded).to.be.true;\n expect(textContainer).to.have.class('help__text__full--expanded');\n expect(moreButton?.textContent).to.include('View Less');\n });\n\n it('should collapse back to truncated text when \"View Less\" is clicked', async () => {\n const longText = 'This is a very long help text that exceeds the container width and should show a \"View More\" button.';\n const el = await fixture<NileFormHelpText>(html`<nile-form-help-text>${longText}</nile-form-help-text>`);\n\n // Simulate overflow\n const textContainer = el.shadowRoot?.querySelector('.help__text__full') as HTMLSpanElement;\n Object.defineProperty(textContainer, 'scrollWidth', { value: 300 });\n Object.defineProperty(textContainer, 'clientWidth', { value: 200 });\n el.decideToToggleShowButton();\n await elementUpdated(el);\n\n // Expand and then collapse\n const moreButton = el.shadowRoot?.querySelector<HTMLElement>('.nile-form-help-text__more-button');\n moreButton?.click();\n await elementUpdated(el);\n\n moreButton?.click(); // Collapse\n await elementUpdated(el);\n\n expect(el.isExpanded).to.be.false;\n expect(textContainer).not.to.have.class('help__text__full--expanded');\n expect(moreButton?.textContent).to.include('View More');\n });\n\n // it('should dynamically adjust \"View More\" visibility on text change', async () => {\n // const el = await fixture<NileFormHelpText>(html`<nile-form-help-text>Initial text</nile-form-help-text>`);\n // await elementUpdated(el);\n\n // const textContainer = el.shadowRoot?.querySelector('.help__text__full') as HTMLSpanElement;\n // Object.defineProperty(textContainer, 'scrollWidth', { value: 300 });\n // Object.defineProperty(textContainer, 'clientWidth', { value: 200 });\n // el.decideToToggleShowButton();\n // await elementUpdated(el);\n\n // expect(el.showButton).to.be.true;\n\n // // Change slot content to short text\n // textContainer.textContent = 'Short text';\n // Object.defineProperty(textContainer, 'scrollWidth', { value: 100 });\n // Object.defineProperty(textContainer, 'clientWidth', { value: 200 });\n // el.decideToToggleShowButton();\n // await elementUpdated(el);\n\n // expect(el.showButton).to.be.false;\n // });\n});\n"],"names":["describe","it","_asyncToGenerator","_regeneratorRuntime","mark","async","fixture","html","_templateObject","_taggedTemplateLiteral","el","expect","to","be","instanceOf","NileFormHelpText","isExpanded","false","textContent","trim","equal","_context2","stop","_callee","_templateObject2","elementUpdated","moreButton","shadowRoot","querySelector","null","showButton","_context3","_callee2","_templateObject3","textContainer","Object","defineProperty","value","decideToToggleShowButton","exist","_context4","_callee3","_templateObject4","click","true","have","include","_context5","_callee4","_templateObject5","not","_context6","_callee5"],"mappings":"s9SAOAA,QAAAA,CAAS,kBAAoB,CAAA,UAAA,CAC3BC,EAAG,CAAA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A,EAAAA,CAAGkC,OAAQ,CAAA,WAAA,CAAY,0BAAAK,SAAA,CAAA7B,IAAA,MAAA8B,QAAA,GACvD,EAAA,CAAA,EAAA,CAAA,CAAA"}
|
@@ -1 +1 @@
|
|
1
|
-
import{f as t,a as e}from"../fixture-8aa86bc9.esm.js";import{html as
|
1
|
+
import{f as t,a as e,e as i}from"../fixture-8aa86bc9.esm.js";import{html as l}from"lit/static-html.js";import"lit/html.js";import"lit/directive-helpers.js";import"lit";import"lit/directives/unsafe-html.js";import{N as o}from"./nile-form-help-text.esm.js";import"tslib";import"lit/decorators.js";import"./nile-form-help-text.css.esm.js";import"lit/directives/class-map.js";describe("NileFormHelpText",(()=>{it("should render with default properties",(async()=>{const i=await t(l`<nile-form-help-text>This is a short text</nile-form-help-text>`);e(i).to.be.instanceOf(o),e(i.isExpanded).to.be.false;const s=i?.textContent?.trim();e(s).to.equal("This is a short text")})),it('should not show "View More" button if the text fits within the container',(async()=>{const o=await t(l`<nile-form-help-text>This is a short text</nile-form-help-text>`);await i(o);const s=o.shadowRoot?.querySelector(".nile-form-help-text__more-button");e(s).to.be.null,e(o.showButton).to.be.false})),it('should show "View More" button if the text overflows the container',(async()=>{const o=await t(l`<nile-form-help-text>${'This is a very long help text that exceeds the container width and should show a "View More" button.'}</nile-form-help-text>`),s=o.shadowRoot?.querySelector(".help__text__full");Object.defineProperty(s,"scrollWidth",{value:300}),Object.defineProperty(s,"clientWidth",{value:200}),o.decideToToggleShowButton(),await i(o);const h=o.shadowRoot?.querySelector(".nile-form-help-text__more-button");e(h).to.exist,e(o.showButton).to.be.true})),it('should expand to show full text when "View More" is clicked',(async()=>{const o=await t(l`<nile-form-help-text>${'This is a very long help text that exceeds the container width and should show a "View More" button.'}</nile-form-help-text>`),s=o.shadowRoot?.querySelector(".help__text__full");Object.defineProperty(s,"scrollWidth",{value:300}),Object.defineProperty(s,"clientWidth",{value:200}),o.decideToToggleShowButton(),await i(o);const h=o.shadowRoot?.querySelector(".nile-form-help-text__more-button");h?.click(),await i(o),e(o.isExpanded).to.be.true,e(s).to.have.class("help__text__full--expanded"),e(h?.textContent).to.include("View Less")})),it('should collapse back to truncated text when "View Less" is clicked',(async()=>{const o=await t(l`<nile-form-help-text>${'This is a very long help text that exceeds the container width and should show a "View More" button.'}</nile-form-help-text>`),s=o.shadowRoot?.querySelector(".help__text__full");Object.defineProperty(s,"scrollWidth",{value:300}),Object.defineProperty(s,"clientWidth",{value:200}),o.decideToToggleShowButton(),await i(o);const h=o.shadowRoot?.querySelector(".nile-form-help-text__more-button");h?.click(),await i(o),h?.click(),await i(o),e(o.isExpanded).to.be.false,e(s).not.to.have.class("help__text__full--expanded"),e(h?.textContent).to.include("View More")}))}));
|
@@ -3,7 +3,7 @@ import { EditorState } from '@codemirror/state';
|
|
3
3
|
import { history, defaultKeymap, historyKeymap } from '@codemirror/commands';
|
4
4
|
import { highlightSelectionMatches, searchKeymap } from '@codemirror/search';
|
5
5
|
import { closeBrackets, autocompletion, closeBracketsKeymap, } from '@codemirror/autocomplete';
|
6
|
-
import { foldGutter, indentOnInput,
|
6
|
+
import { foldGutter, indentOnInput, bracketMatching, indentUnit, foldKeymap, } from '@codemirror/language';
|
7
7
|
import { lintKeymap } from '@codemirror/lint';
|
8
8
|
export const isValidSetup = (item) => {
|
9
9
|
return typeof item === 'undefined' || item;
|
@@ -26,8 +26,6 @@ export const basicSetup = (options = {}) => {
|
|
26
26
|
isValidSetup(options.dropCursor) && extensions.push(dropCursor());
|
27
27
|
isValidSetup(options.allowMultipleSelections) && extensions.push(EditorState.allowMultipleSelections.of(true));
|
28
28
|
isValidSetup(options.indentOnInput) && extensions.push(indentOnInput());
|
29
|
-
isValidSetup(options.syntaxHighlighting) &&
|
30
|
-
extensions.push(syntaxHighlighting(defaultHighlightStyle, { fallback: true }));
|
31
29
|
isValidSetup(options.bracketMatching) && extensions.push(bracketMatching());
|
32
30
|
isValidSetup(options.closeBrackets) && extensions.push(closeBrackets());
|
33
31
|
isValidSetup(options.autocompletion) && extensions.push(autocompletion());
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"extensionSetup.js","sourceRoot":"","sources":["../../../src/nile-code-editor/extensionSetup.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,yBAAyB,EACzB,qBAAqB,EACrB,aAAa,EACb,UAAU,EACV,oBAAoB,EACpB,eAAe,EACf,mBAAmB,EACnB,MAAM,GACP,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAa,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC7E,OAAO,EAAE,yBAAyB,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAC7E,OAAO,EACL,aAAa,EACb,cAAc,EACd,mBAAmB,GAEpB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,UAAU,EACV,aAAa,EACb,
|
1
|
+
{"version":3,"file":"extensionSetup.js","sourceRoot":"","sources":["../../../src/nile-code-editor/extensionSetup.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,yBAAyB,EACzB,qBAAqB,EACrB,aAAa,EACb,UAAU,EACV,oBAAoB,EACpB,eAAe,EACf,mBAAmB,EACnB,MAAM,GACP,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAa,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC7E,OAAO,EAAE,yBAAyB,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAC7E,OAAO,EACL,aAAa,EACb,cAAc,EACd,mBAAmB,GAEpB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,UAAU,EACV,aAAa,EACb,eAAe,EACf,UAAU,EACV,UAAU,GACX,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAiC9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AAC,OAAO,IAAI,OAAO,OAAO,CAAC,OAAO,KAAK,QAAQ;QACxD,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAC9D,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AACxE,CAAC,CAAC","sourcesContent":["import {\n KeyBinding,\n highlightActiveLineGutter,\n highlightSpecialChars,\n drawSelection,\n dropCursor,\n rectangularSelection,\n crosshairCursor,\n highlightActiveLine,\n keymap,\n} from '@codemirror/view';\nimport { EditorState, Extension } from '@codemirror/state';\nimport { history, defaultKeymap, historyKeymap } from '@codemirror/commands';\nimport { highlightSelectionMatches, searchKeymap } from '@codemirror/search';\nimport {\n closeBrackets,\n autocompletion,\n closeBracketsKeymap,\n completionKeymap,\n} from '@codemirror/autocomplete';\nimport {\n foldGutter,\n indentOnInput,\n bracketMatching,\n indentUnit,\n foldKeymap,\n} from '@codemirror/language';\n\nimport { lintKeymap } from '@codemirror/lint';\n\nexport interface MinimalSetupOptions {\n highlightSpecialChars?: boolean;\n history?: boolean;\n drawSelection?: boolean;\n syntaxHighlighting?: boolean;\n defaultKeymap?: boolean;\n historyKeymap?: boolean;\n}\nexport interface BasicSetupOptions extends MinimalSetupOptions {\n lineNumbers?: boolean;\n highlightActiveLineGutter?: boolean;\n foldGutter?: boolean;\n dropCursor?: boolean;\n allowMultipleSelections?: boolean;\n indentOnInput?: boolean;\n bracketMatching?: boolean;\n closeBrackets?: boolean;\n autocompletion?: boolean;\n rectangularSelection?: boolean;\n crosshairCursor?: boolean;\n highlightActiveLine?: boolean;\n highlightSelectionMatches?: boolean;\n closeBracketsKeymap?: boolean;\n searchKeymap?: boolean;\n foldKeymap?: boolean;\n completionKeymap?: boolean;\n lintKeymap?: boolean;\n tabSize?: number;\n readonly?: false;\n}\n\nexport const isValidSetup = (item: any) => {\n return typeof item === 'undefined' || item;\n};\n\nexport const basicSetup = (options: BasicSetupOptions = {}): Extension[] => {\n const { crosshairCursor: initCrosshairCursor = false } = options;\n let keymaps: KeyBinding[] = [];\n isValidSetup(options.defaultKeymap) && keymaps.push(...defaultKeymap);\n isValidSetup(options.closeBracketsKeymap) && keymaps.push(...closeBracketsKeymap);\n isValidSetup(options.searchKeymap) && keymaps.push(...searchKeymap);\n isValidSetup(options.historyKeymap) && keymaps.push(...historyKeymap);\n isValidSetup(options.foldKeymap) && keymaps.push(...foldKeymap);\n isValidSetup(options.lintKeymap) && keymaps.push(...lintKeymap);\n const extensions: Extension[] = [];\n isValidSetup(options.highlightActiveLineGutter) && extensions.push(highlightActiveLineGutter());\n isValidSetup(options.highlightSpecialChars) && extensions.push(highlightSpecialChars());\n isValidSetup(options.history) && extensions.push(history());\n isValidSetup(options.foldGutter) && extensions.push(foldGutter());\n isValidSetup(options.drawSelection) && extensions.push(drawSelection());\n isValidSetup(options.dropCursor) && extensions.push(dropCursor());\n isValidSetup(options.allowMultipleSelections) && extensions.push(EditorState.allowMultipleSelections.of(true));\n isValidSetup(options.indentOnInput) && extensions.push(indentOnInput());\n isValidSetup(options.bracketMatching) && extensions.push(bracketMatching());\n isValidSetup(options.closeBrackets) && extensions.push(closeBrackets());\n isValidSetup(options.autocompletion) && extensions.push(autocompletion());\n isValidSetup(options.rectangularSelection) && extensions.push(rectangularSelection());\n isValidSetup(options.crosshairCursor) && extensions.push(crosshairCursor());\n isValidSetup(options.highlightActiveLine) && extensions.push(highlightActiveLine());\n isValidSetup(options.highlightSelectionMatches) && extensions.push(highlightSelectionMatches());\n if (options.tabSize && typeof options.tabSize === 'number')\n extensions.push(indentUnit.of(' '.repeat(options.tabSize)));\n return extensions.concat([keymap.of(keymaps.flat())]).filter(Boolean);\n};\n\n\n"]}
|
@@ -29,6 +29,8 @@ export declare class NileCodeEditor extends NileElement {
|
|
29
29
|
multiline: boolean;
|
30
30
|
allowVariableInCustomSuggestion: boolean;
|
31
31
|
lineNumbers: boolean;
|
32
|
+
disableSyntaxHighlighting: boolean;
|
33
|
+
useCustomTextFormatting: boolean;
|
32
34
|
lineNumbersMultiline: boolean;
|
33
35
|
hasScroller: boolean;
|
34
36
|
expandable: boolean;
|
@@ -43,6 +45,7 @@ export declare class NileCodeEditor extends NileElement {
|
|
43
45
|
private readOnlyComp;
|
44
46
|
private customCompletionComp;
|
45
47
|
private placeholderComp;
|
48
|
+
private defaultSyntaxHighlightingComp;
|
46
49
|
/**
|
47
50
|
* The styles for CodeEditor
|
48
51
|
* @remarks If you are extending this class you can extend the base styles with super. Eg `return [super(), myCustomStyles]`
|
@@ -94,6 +97,7 @@ export declare class NileCodeEditor extends NileElement {
|
|
94
97
|
}[];
|
95
98
|
} | null;
|
96
99
|
emitAfterTimeout(value: any): void;
|
100
|
+
focusAtPosition(pos?: number): void;
|
97
101
|
insertBetweenCode: (text: string) => void;
|
98
102
|
singleLineMultiLineToggle(): void;
|
99
103
|
getLineNumbersExension(): Extension;
|
@@ -101,6 +105,7 @@ export declare class NileCodeEditor extends NileElement {
|
|
101
105
|
getReadOnlyExtension(): Extension;
|
102
106
|
getSingleLineExtension(): Extension;
|
103
107
|
getPlaceholderExtension(): Extension;
|
108
|
+
getDefaultSyntaxHighlightingExtension(): Extension;
|
104
109
|
restrictSingleLine(): Extension;
|
105
110
|
}
|
106
111
|
export default NileCodeEditor;
|