@aquera/nile-elements 0.0.1-beta.3 → 0.0.1-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/index.d.ts +4 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/index.js +4 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/index.js.map +1 -1
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/internal/tabbable.d.ts +8 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/internal/tabbable.js +65 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/internal/tabbable.js.map +1 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-auto-complete/index.d.ts +1 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-auto-complete/index.js +2 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-auto-complete/index.js.map +1 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-auto-complete/nile-auto-complete.css.d.ts +12 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-auto-complete/nile-auto-complete.css.js +23 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-auto-complete/nile-auto-complete.css.js.map +1 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-auto-complete/nile-auto-complete.d.ts +27 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-auto-complete/nile-auto-complete.js +127 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-auto-complete/nile-auto-complete.js.map +1 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-chip/index.d.ts +1 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-chip/index.js +2 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-chip/index.js.map +1 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-chip/nile-chip.css.d.ts +12 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-chip/nile-chip.css.js +146 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-chip/nile-chip.css.js.map +1 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-chip/nile-chip.d.ts +44 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-chip/nile-chip.js +180 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-chip/nile-chip.js.map +1 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-dropdown/index.d.ts +1 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-dropdown/index.js +2 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-dropdown/index.js.map +1 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-dropdown/nile-dropdown.css.d.ts +12 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-dropdown/nile-dropdown.css.js +60 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-dropdown/nile-dropdown.css.js.map +1 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-dropdown/nile-dropdown.d.ts +105 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-dropdown/nile-dropdown.js +412 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-dropdown/nile-dropdown.js.map +1 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-input/nile-input.css.js +20 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-input/nile-input.css.js.map +1 -1
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-menu/index.d.ts +1 -41
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-menu/index.js +1 -119
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-menu/index.js.map +1 -1
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-menu/nile-menu.css.d.ts +12 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-menu/nile-menu.css.js +28 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-menu/nile-menu.css.js.map +1 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-menu/nile-menu.d.ts +43 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-menu/nile-menu.js +142 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-menu/nile-menu.js.map +1 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-menu-item/index.d.ts +1 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-menu-item/index.js +2 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-menu-item/index.js.map +1 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-menu-item/nile-menu-item.css.d.ts +12 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-menu-item/nile-menu-item.css.js +121 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-menu-item/nile-menu-item.css.js.map +1 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-menu-item/nile-menu-item.d.ts +62 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-menu-item/nile-menu-item.js +173 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-menu-item/nile-menu-item.js.map +1 -0
- package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/internal/slot.cjs.js +1 -1
- package/dist/internal/slot.cjs.js.map +1 -1
- package/dist/internal/slot.esm.js +1 -1
- package/dist/internal/tabbable.cjs.js +2 -0
- package/dist/internal/tabbable.cjs.js.map +1 -0
- package/dist/internal/tabbable.esm.js +1 -0
- package/dist/nile-auto-complete/index.cjs.js +2 -0
- package/dist/nile-auto-complete/index.cjs.js.map +1 -0
- package/dist/nile-auto-complete/index.esm.js +1 -0
- package/dist/nile-auto-complete/nile-auto-complete.cjs.js +2 -0
- package/dist/nile-auto-complete/nile-auto-complete.cjs.js.map +1 -0
- package/dist/nile-auto-complete/nile-auto-complete.css.cjs.js +2 -0
- package/dist/nile-auto-complete/nile-auto-complete.css.cjs.js.map +1 -0
- package/dist/nile-auto-complete/nile-auto-complete.css.esm.js +11 -0
- package/dist/nile-auto-complete/nile-auto-complete.esm.js +21 -0
- package/dist/nile-chip/index.cjs.js +2 -0
- package/dist/nile-chip/index.cjs.js.map +1 -0
- package/dist/nile-chip/index.esm.js +1 -0
- package/dist/nile-chip/nile-chip.cjs.js +2 -0
- package/dist/nile-chip/nile-chip.cjs.js.map +1 -0
- package/dist/nile-chip/nile-chip.css.cjs.js +2 -0
- package/dist/nile-chip/nile-chip.css.cjs.js.map +1 -0
- package/dist/nile-chip/nile-chip.css.esm.js +134 -0
- package/dist/nile-chip/nile-chip.esm.js +46 -0
- package/dist/nile-dropdown/index.cjs.js +2 -0
- package/dist/nile-dropdown/index.cjs.js.map +1 -0
- package/dist/nile-dropdown/index.esm.js +1 -0
- package/dist/nile-dropdown/nile-dropdown.cjs.js +2 -0
- package/dist/nile-dropdown/nile-dropdown.cjs.js.map +1 -0
- package/dist/nile-dropdown/nile-dropdown.css.cjs.js +2 -0
- package/dist/nile-dropdown/nile-dropdown.css.cjs.js.map +1 -0
- package/dist/nile-dropdown/nile-dropdown.css.esm.js +48 -0
- package/dist/nile-dropdown/nile-dropdown.esm.js +33 -0
- package/dist/nile-input/nile-input.css.cjs.js +1 -1
- package/dist/nile-input/nile-input.css.cjs.js.map +1 -1
- package/dist/nile-input/nile-input.css.esm.js +20 -0
- package/dist/nile-menu/index.cjs.js +1 -1
- package/dist/nile-menu/index.cjs.js.map +1 -1
- package/dist/nile-menu/index.esm.js +1 -53
- package/dist/nile-menu/nile-menu.cjs.js +2 -0
- package/dist/nile-menu/nile-menu.cjs.js.map +1 -0
- package/dist/nile-menu/nile-menu.css.cjs.js +2 -0
- package/dist/nile-menu/nile-menu.css.cjs.js.map +1 -0
- package/dist/nile-menu/nile-menu.css.esm.js +16 -0
- package/dist/nile-menu/nile-menu.esm.js +8 -0
- package/dist/nile-menu-item/index.cjs.js +2 -0
- package/dist/nile-menu-item/index.cjs.js.map +1 -0
- package/dist/nile-menu-item/index.esm.js +1 -0
- package/dist/nile-menu-item/nile-menu-item.cjs.js +2 -0
- package/dist/nile-menu-item/nile-menu-item.cjs.js.map +1 -0
- package/dist/nile-menu-item/nile-menu-item.css.cjs.js +2 -0
- package/dist/nile-menu-item/nile-menu-item.css.cjs.js.map +1 -0
- package/dist/nile-menu-item/nile-menu-item.css.esm.js +109 -0
- package/dist/nile-menu-item/nile-menu-item.esm.js +20 -0
- package/dist/src/index.d.ts +4 -0
- package/dist/src/index.js +4 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/internal/tabbable.d.ts +8 -0
- package/dist/src/internal/tabbable.js +65 -0
- package/dist/src/internal/tabbable.js.map +1 -0
- package/dist/src/nile-auto-complete/index.d.ts +1 -0
- package/dist/src/nile-auto-complete/index.js +2 -0
- package/dist/src/nile-auto-complete/index.js.map +1 -0
- package/dist/src/nile-auto-complete/nile-auto-complete.css.d.ts +12 -0
- package/dist/src/nile-auto-complete/nile-auto-complete.css.js +23 -0
- package/dist/src/nile-auto-complete/nile-auto-complete.css.js.map +1 -0
- package/dist/src/nile-auto-complete/nile-auto-complete.d.ts +27 -0
- package/dist/src/nile-auto-complete/nile-auto-complete.js +127 -0
- package/dist/src/nile-auto-complete/nile-auto-complete.js.map +1 -0
- package/dist/src/nile-chip/index.d.ts +1 -0
- package/dist/src/nile-chip/index.js +2 -0
- package/dist/src/nile-chip/index.js.map +1 -0
- package/dist/src/nile-chip/nile-chip.css.d.ts +12 -0
- package/dist/src/nile-chip/nile-chip.css.js +146 -0
- package/dist/src/nile-chip/nile-chip.css.js.map +1 -0
- package/dist/src/nile-chip/nile-chip.d.ts +44 -0
- package/dist/src/nile-chip/nile-chip.js +180 -0
- package/dist/src/nile-chip/nile-chip.js.map +1 -0
- package/dist/src/nile-dropdown/index.d.ts +1 -0
- package/dist/src/nile-dropdown/index.js +2 -0
- package/dist/src/nile-dropdown/index.js.map +1 -0
- package/dist/src/nile-dropdown/nile-dropdown.css.d.ts +12 -0
- package/dist/src/nile-dropdown/nile-dropdown.css.js +60 -0
- package/dist/src/nile-dropdown/nile-dropdown.css.js.map +1 -0
- package/dist/src/nile-dropdown/nile-dropdown.d.ts +105 -0
- package/dist/src/nile-dropdown/nile-dropdown.js +412 -0
- package/dist/src/nile-dropdown/nile-dropdown.js.map +1 -0
- package/dist/src/nile-input/nile-input.css.js +20 -0
- package/dist/src/nile-input/nile-input.css.js.map +1 -1
- package/dist/src/nile-menu/index.d.ts +1 -41
- package/dist/src/nile-menu/index.js +1 -119
- package/dist/src/nile-menu/index.js.map +1 -1
- package/dist/src/nile-menu/nile-menu.css.d.ts +12 -0
- package/dist/src/nile-menu/nile-menu.css.js +28 -0
- package/dist/src/nile-menu/nile-menu.css.js.map +1 -0
- package/dist/src/nile-menu/nile-menu.d.ts +43 -0
- package/dist/src/nile-menu/nile-menu.js +142 -0
- package/dist/src/nile-menu/nile-menu.js.map +1 -0
- package/dist/src/nile-menu-item/index.d.ts +1 -0
- package/dist/src/nile-menu-item/index.js +2 -0
- package/dist/src/nile-menu-item/index.js.map +1 -0
- package/dist/src/nile-menu-item/nile-menu-item.css.d.ts +12 -0
- package/dist/src/nile-menu-item/nile-menu-item.css.js +121 -0
- package/dist/src/nile-menu-item/nile-menu-item.css.js.map +1 -0
- package/dist/src/nile-menu-item/nile-menu-item.d.ts +62 -0
- package/dist/src/nile-menu-item/nile-menu-item.js +173 -0
- package/dist/src/nile-menu-item/nile-menu-item.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/watch.cjs.js +1 -1
- package/dist/watch.cjs.js.map +1 -1
- package/dist/watch.esm.js +1 -1
- package/package.json +1 -1
- package/src/index.ts +4 -0
- package/src/internal/tabbable.ts +81 -0
- package/src/nile-auto-complete/index.ts +1 -0
- package/src/nile-auto-complete/nile-auto-complete.css.ts +25 -0
- package/src/nile-auto-complete/nile-auto-complete.ts +132 -0
- package/src/nile-chip/index.ts +1 -0
- package/src/nile-chip/nile-chip.css.ts +148 -0
- package/src/nile-chip/nile-chip.ts +189 -0
- package/src/nile-dropdown/index.ts +1 -0
- package/src/nile-dropdown/nile-dropdown.css.ts +62 -0
- package/src/nile-dropdown/nile-dropdown.ts +461 -0
- package/src/nile-input/nile-input.css.ts +20 -0
- package/src/nile-menu/index.ts +1 -116
- package/src/nile-menu/nile-menu.css.ts +30 -0
- package/src/nile-menu/nile-menu.ts +169 -0
- package/src/nile-menu-item/index.ts +1 -0
- package/src/nile-menu-item/nile-menu-item.css.ts +123 -0
- package/src/nile-menu-item/nile-menu-item.ts +171 -0
- package/src/nile-menu/nile-menu.scss +0 -0
package/dist/watch.cjs.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
System.register([],function(_export,_context){"use strict";return{setters:[],execute:function(){}};});
|
1
|
+
System.register([],function(_export,_context){"use strict";function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj;}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;},_typeof(obj);}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);enumerableOnly&&(symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable;})),keys.push.apply(keys,symbols);}return keys;}function _objectSpread(target){for(var i=1;i<arguments.length;i++){var source=null!=arguments[i]?arguments[i]:{};i%2?ownKeys(Object(source),!0).forEach(function(key){_defineProperty(target,key,source[key]);}):Object.getOwnPropertyDescriptors?Object.defineProperties(target,Object.getOwnPropertyDescriptors(source)):ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key));});}return target;}function _defineProperty(obj,key,value){key=_toPropertyKey(key);if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}function _toPropertyKey(arg){var key=_toPrimitive(arg,"string");return typeof key==="symbol"?key:String(key);}function _toPrimitive(input,hint){if(_typeof(input)!=="object"||input===null)return input;var prim=input[Symbol.toPrimitive];if(prim!==undefined){var res=prim.call(input,hint||"default");if(_typeof(res)!=="object")return res;throw new TypeError("@@toPrimitive must return a primitive value.");}return(hint==="string"?String:Number)(input);}function t(t,i){var n=_objectSpread({waitUntilFirstUpdate:!1},i);return function(i,s){var o=i.update,c=Array.isArray(t)?t:[t];i.update=function(t){var _this=this;c.forEach(function(i){var o=i;if(t.has(o)){var _i=t.get(o),_c=_this[o];_i!==_c&&(n.waitUntilFirstUpdate&&!_this.hasUpdated||_this[s](_i,_c));}}),o.call(this,t);};};}_export("w",t);return{setters:[],execute:function(){}};});
|
2
2
|
//# sourceMappingURL=watch.cjs.js.map
|
package/dist/watch.cjs.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"watch.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
1
|
+
{"version":3,"file":"watch.cjs.js","sources":["../../src/watch.ts"],"sourcesContent":["import type { LitElement } from 'lit';\n\ntype UpdateHandler = (prev?: unknown, next?: unknown) => void;\n\ntype NonUndefined<A> = A extends undefined ? never : A;\n\ntype UpdateHandlerFunctionKeys<T extends object> = {\n [K in keyof T]-?: NonUndefined<T[K]> extends UpdateHandler ? K : never;\n}[keyof T];\n\ninterface WatchOptions {\n /**\n * If true, will only start watching after the initial update/render\n */\n waitUntilFirstUpdate?: boolean;\n}\n\n/**\n * Runs when observed properties change, e.g. @property or @state, but before the component updates. To wait for an\n * update to complete after a change occurs, use `await this.updateComplete` in the handler. To start watching after the\n * initial update/render, use `{ waitUntilFirstUpdate: true }` or `this.hasUpdated` in the handler.\n *\n * Usage:\n *\n * @watch('propName')\n * handlePropChange(oldValue, newValue) {\n * ...\n * }\n */\nexport function watch(propertyName: string | string[], options?: WatchOptions) {\n const resolvedOptions: Required<WatchOptions> = {\n waitUntilFirstUpdate: false,\n ...options\n };\n return <ElemClass extends LitElement>(proto: ElemClass, decoratedFnName: UpdateHandlerFunctionKeys<ElemClass>) => {\n // @ts-expect-error - update is a protected property\n const { update } = proto;\n const watchedProperties = Array.isArray(propertyName) ? propertyName : [propertyName];\n\n // @ts-expect-error - update is a protected property\n proto.update = function (this: ElemClass, changedProps: Map<keyof ElemClass, ElemClass[keyof ElemClass]>) {\n watchedProperties.forEach(property => {\n const key = property as keyof ElemClass;\n if (changedProps.has(key)) {\n const oldValue = changedProps.get(key);\n const newValue = this[key];\n\n if (oldValue !== newValue) {\n if (!resolvedOptions.waitUntilFirstUpdate || this.hasUpdated) {\n (this[decoratedFnName] as unknown as UpdateHandler)(oldValue, newValue);\n }\n }\n }\n });\n\n update.call(this, changedProps);\n };\n };\n}\n"],"names":["watch","propertyName","options","resolvedOptions","waitUntilFirstUpdate","proto","decoratedFnName","update","watchedProperties","Array","isArray","changedProps","forEach","property","key","has","oldValue","get","newValue","this","hasUpdated","call"],"mappings":"uvDA6BgB,QAAAA,EAAMC,CAAAA,CAAAA,CAAiCC,CACrD,CAAA,CAAA,GAAMC,EAA0C,gBAC9CC,oBAAsB,CAAA,CAAA,CAAA,EACnBF,CAEL,CAAA,CAAA,MAAO,UAA+BG,CAAAA,CAAkBC,GAEhDC,GAAEA,EAAWF,CAAAA,CAAAA,CAAbE,MAAAA,CACAC,CAAoBC,CAAAA,KAAAA,CAAMC,OAAQT,CAAAA,CAAAA,CAAAA,CAAgBA,CAAe,CAAA,CAACA,CAGxEI,CAAAA,CAAAA,CAAAA,CAAME,MAAS,CAAA,SAA2BI,CACxCH,CAAAA,gBAAAA,CAAAA,CAAkBI,QAAQC,SAAAA,CACxB,CAAA,CAAA,GAAMC,EAAMD,CAAAA,CAAAA,CACZ,GAAIF,CAAAA,CAAaI,GAAID,CAAAA,CAAAA,CAAAA,CAAM,CACzB,GAAME,GAAWL,CAAAA,CAAAA,CAAaM,GAAIH,CAAAA,CAAAA,CAAAA,CAC5BI,EAAWC,CAAAA,KAAAA,CAAKL,GAElBE,EAAaE,GAAAA,EAAAA,GACVf,CAAgBC,CAAAA,oBAAAA,EAAAA,CAAwBe,KAAKC,CAAAA,UAAAA,EAC/CD,KAAKb,CAAAA,CAAAA,CAAAA,CAA8CU,EAAUE,CAAAA,EAAAA,CAAAA,CAGnE,EAGHX,CAAAA,CAAAA,CAAAA,CAAAA,CAAOc,IAAKF,CAAAA,IAAAA,CAAMR,CACpB,CAAA,EAAC,EAEL"}
|
package/dist/watch.esm.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
function t(t,i){const n={waitUntilFirstUpdate:!1,...i};return(i,s)=>{const{update:o}=i,c=Array.isArray(t)?t:[t];i.update=function(t){c.forEach((i=>{const o=i;if(t.has(o)){const i=t.get(o),c=this[o];i!==c&&(n.waitUntilFirstUpdate&&!this.hasUpdated||this[s](i,c))}})),o.call(this,t)}}}export{t as w};
|
package/package.json
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
"description": "Webcomponent nile-elements following open-wc recommendations",
|
4
4
|
"license": "MIT",
|
5
5
|
"author": "nile-elements",
|
6
|
-
"version": "0.0.1-beta.
|
6
|
+
"version": "0.0.1-beta.5",
|
7
7
|
"main": "dist/src/index.js",
|
8
8
|
"type": "module",
|
9
9
|
"module": "dist/src/index.js",
|
package/src/index.ts
CHANGED
@@ -19,3 +19,7 @@ export { NileSelect } from './nile-select';
|
|
19
19
|
export { NileOption } from './nile-option';
|
20
20
|
export { NileTag } from './nile-tag';
|
21
21
|
export { NileIconButton } from './nile-icon-button';
|
22
|
+
export { NileMenuItem } from './nile-menu-item';
|
23
|
+
export { NileDropdown } from './nile-dropdown';
|
24
|
+
export { NileAutoComplete } from './nile-auto-complete';
|
25
|
+
export { NileChip } from './nile-chip';
|
@@ -0,0 +1,81 @@
|
|
1
|
+
/** Determines if the specified element is tabbable using heuristics inspired by https://github.com/focus-trap/tabbable */
|
2
|
+
function isTabbable(el: HTMLElement) {
|
3
|
+
const tag = el.tagName.toLowerCase();
|
4
|
+
|
5
|
+
// Elements with a -1 tab index are not tabbable
|
6
|
+
if (el.getAttribute('tabindex') === '-1') {
|
7
|
+
return false;
|
8
|
+
}
|
9
|
+
|
10
|
+
// Elements with a disabled attribute are not tabbable
|
11
|
+
if (el.hasAttribute('disabled')) {
|
12
|
+
return false;
|
13
|
+
}
|
14
|
+
|
15
|
+
// Elements with aria-disabled are not tabbable
|
16
|
+
if (el.hasAttribute('aria-disabled') && el.getAttribute('aria-disabled') !== 'false') {
|
17
|
+
return false;
|
18
|
+
}
|
19
|
+
|
20
|
+
// Radios without a checked attribute are not tabbable
|
21
|
+
if (tag === 'input' && el.getAttribute('type') === 'radio' && !el.hasAttribute('checked')) {
|
22
|
+
return false;
|
23
|
+
}
|
24
|
+
|
25
|
+
// Elements that are hidden have no offsetParent and are not tabbable
|
26
|
+
if (el.offsetParent === null) {
|
27
|
+
return false;
|
28
|
+
}
|
29
|
+
|
30
|
+
// Elements without visibility are not tabbable
|
31
|
+
if (window.getComputedStyle(el).visibility === 'hidden') {
|
32
|
+
return false;
|
33
|
+
}
|
34
|
+
|
35
|
+
// Audio and video elements with the controls attribute are tabbable
|
36
|
+
if ((tag === 'audio' || tag === 'video') && el.hasAttribute('controls')) {
|
37
|
+
return true;
|
38
|
+
}
|
39
|
+
|
40
|
+
// Elements with a tabindex other than -1 are tabbable
|
41
|
+
if (el.hasAttribute('tabindex')) {
|
42
|
+
return true;
|
43
|
+
}
|
44
|
+
|
45
|
+
// Elements with a contenteditable attribute are tabbable
|
46
|
+
if (el.hasAttribute('contenteditable') && el.getAttribute('contenteditable') !== 'false') {
|
47
|
+
return true;
|
48
|
+
}
|
49
|
+
|
50
|
+
// At this point, the following elements are considered tabbable
|
51
|
+
return ['button', 'input', 'select', 'textarea', 'a', 'audio', 'video', 'summary'].includes(tag);
|
52
|
+
}
|
53
|
+
|
54
|
+
/**
|
55
|
+
* Returns the first and last bounding elements that are tabbable. This is more performant than checking every single
|
56
|
+
* element because it short-circuits after finding the first and last ones.
|
57
|
+
*/
|
58
|
+
export function getTabbableBoundary(root: HTMLElement | ShadowRoot) {
|
59
|
+
const allElements: HTMLElement[] = [];
|
60
|
+
|
61
|
+
function walk(el: HTMLElement | ShadowRoot) {
|
62
|
+
if (el instanceof HTMLElement) {
|
63
|
+
allElements.push(el);
|
64
|
+
|
65
|
+
if (el.shadowRoot !== null && el.shadowRoot.mode === 'open') {
|
66
|
+
walk(el.shadowRoot);
|
67
|
+
}
|
68
|
+
}
|
69
|
+
|
70
|
+
[...el.children].forEach((e: HTMLElement) => walk(e));
|
71
|
+
}
|
72
|
+
|
73
|
+
// Collect all elements including the root
|
74
|
+
walk(root);
|
75
|
+
|
76
|
+
// Find the first and last tabbable elements
|
77
|
+
const start = allElements.find(el => isTabbable(el)) ?? null;
|
78
|
+
const end = allElements.reverse().find(el => isTabbable(el)) ?? null;
|
79
|
+
|
80
|
+
return { start, end };
|
81
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export { NileAutoComplete } from './nile-auto-complete';
|
@@ -0,0 +1,25 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright Aquera Inc 2023
|
3
|
+
*
|
4
|
+
* This source code is licensed under the BSD-3-Clause license found in the
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
6
|
+
*/
|
7
|
+
|
8
|
+
import { css } from 'lit-element';
|
9
|
+
|
10
|
+
/**
|
11
|
+
* AutoComplete CSS
|
12
|
+
*/
|
13
|
+
export const styles = css`
|
14
|
+
:host {
|
15
|
+
.nile-dropdown--input {
|
16
|
+
width: 100%;
|
17
|
+
}
|
18
|
+
|
19
|
+
.nile-auto-complete--input {
|
20
|
+
width: 100%;
|
21
|
+
}
|
22
|
+
}
|
23
|
+
`;
|
24
|
+
|
25
|
+
export default [styles];
|
@@ -0,0 +1,132 @@
|
|
1
|
+
import {
|
2
|
+
LitElement,
|
3
|
+
html,
|
4
|
+
property,
|
5
|
+
CSSResultArray,
|
6
|
+
TemplateResult,
|
7
|
+
} from 'lit-element';
|
8
|
+
import { customElement, query, state } from 'lit/decorators.js';
|
9
|
+
import { styles } from './nile-auto-complete.css';
|
10
|
+
import NileElement from '../internal/nile-element';
|
11
|
+
import { watch } from '../watch';
|
12
|
+
|
13
|
+
// Define the custom element 'nile-auto-complete'
|
14
|
+
@customElement('nile-auto-complete')
|
15
|
+
export class NileAutoComplete extends NileElement {
|
16
|
+
// Define component properties
|
17
|
+
@property({ type: Boolean }) isDropdownOpen: boolean = false;
|
18
|
+
|
19
|
+
@property({ type: Boolean }) openOnFocus: boolean = false;
|
20
|
+
|
21
|
+
@property({ type: String }) value: string = '';
|
22
|
+
|
23
|
+
@property({ type: String }) placeholder: string = 'Type here ..';
|
24
|
+
|
25
|
+
@property({ type: Boolean }) noBorder: boolean = false;
|
26
|
+
|
27
|
+
@state() menuItems: any = [];
|
28
|
+
|
29
|
+
@property({ type: Array }) allMenuItems: any = [];
|
30
|
+
|
31
|
+
@query('nile-dropdown') dropdownElement: any;
|
32
|
+
|
33
|
+
connectedCallback() {
|
34
|
+
super.connectedCallback();
|
35
|
+
this.menuItems = [...this.allMenuItems];
|
36
|
+
}
|
37
|
+
|
38
|
+
// Watch for changes in 'allMenuItems' property
|
39
|
+
@watch('allMenuItems')
|
40
|
+
handleAllMenuItemsChange() {
|
41
|
+
this.menuItems = [...this.allMenuItems];
|
42
|
+
}
|
43
|
+
|
44
|
+
// Watch for changes in 'value' and 'isDropdownOpen' properties
|
45
|
+
@watch('value', { waitUntilFirstUpdate: true })
|
46
|
+
|
47
|
+
@watch('isDropdownOpen', { waitUntilFirstUpdate: true })
|
48
|
+
async handleValueChange() {
|
49
|
+
await this.updateComplete;
|
50
|
+
// Filter menu items based on the search value
|
51
|
+
this.menuItems = this.allMenuItems.filter((item: string) =>
|
52
|
+
item.toLowerCase().includes(this.value?.toLowerCase())
|
53
|
+
);
|
54
|
+
}
|
55
|
+
|
56
|
+
private handleSelect(event: CustomEvent) {
|
57
|
+
this.value = event.detail.value;
|
58
|
+
this.emit('nile-complete', { value: event.detail.value });
|
59
|
+
this.isDropdownOpen = false;
|
60
|
+
this.dropdownElement?.hide();
|
61
|
+
}
|
62
|
+
|
63
|
+
private handleSearch(event: CustomEvent) {
|
64
|
+
const searchValue = event.detail.value.toLowerCase();
|
65
|
+
this.value = searchValue;
|
66
|
+
|
67
|
+
// Filter menu items based on the search value
|
68
|
+
this.menuItems = this.allMenuItems.filter((item: string) =>
|
69
|
+
item?.toLowerCase().includes(searchValue)
|
70
|
+
);
|
71
|
+
|
72
|
+
this.isDropdownOpen = this.menuItems.length > 0;
|
73
|
+
if (this.isDropdownOpen) this.dropdownElement?.show();
|
74
|
+
}
|
75
|
+
|
76
|
+
public handleFocus() {
|
77
|
+
if (!this.openOnFocus) {
|
78
|
+
return;
|
79
|
+
}
|
80
|
+
|
81
|
+
// Delay opening the dropdown to allow focus to take effect
|
82
|
+
setTimeout(() => {
|
83
|
+
this.isDropdownOpen = true;
|
84
|
+
this.dropdownElement?.show();
|
85
|
+
}, 300);
|
86
|
+
}
|
87
|
+
|
88
|
+
private handleClick() {
|
89
|
+
this.isDropdownOpen = true;
|
90
|
+
this.dropdownElement?.show();
|
91
|
+
}
|
92
|
+
|
93
|
+
private handleBlur() {
|
94
|
+
this.menuItems = this.allMenuItems;
|
95
|
+
}
|
96
|
+
|
97
|
+
public render(): TemplateResult {
|
98
|
+
return html`
|
99
|
+
<nile-dropdown class="nile-dropdown--input" ?open=${this.isDropdownOpen} noOpenOnCLick>
|
100
|
+
<nile-input class="nile-auto-complete--input"
|
101
|
+
?no-border=${this.noBorder}
|
102
|
+
.value=${this.value}
|
103
|
+
@nile-input=${this.handleSearch}
|
104
|
+
@focus=${this.handleFocus}
|
105
|
+
@blur=${this.handleBlur}
|
106
|
+
@click=${this.handleClick}
|
107
|
+
slot="trigger"
|
108
|
+
placeholder=${this.placeholder}
|
109
|
+
></nile-input>
|
110
|
+
${this.menuItems.length > 0
|
111
|
+
? html`
|
112
|
+
<nile-menu @nile-select=${this.handleSelect}>
|
113
|
+
${this.menuItems.map(
|
114
|
+
(item: unknown) => html`
|
115
|
+
<nile-menu-item value=${item}>${item}</nile-menu-item>
|
116
|
+
`
|
117
|
+
)}
|
118
|
+
</nile-menu>
|
119
|
+
`
|
120
|
+
: ''}
|
121
|
+
</nile-dropdown>
|
122
|
+
`;
|
123
|
+
}
|
124
|
+
}
|
125
|
+
|
126
|
+
export default NileAutoComplete;
|
127
|
+
|
128
|
+
declare global {
|
129
|
+
interface HTMLElementTagNameMap {
|
130
|
+
'nile-auto-complete': NileAutoComplete;
|
131
|
+
}
|
132
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export { NileChip } from './nile-chip';
|
@@ -0,0 +1,148 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright Aquera Inc 2023
|
3
|
+
*
|
4
|
+
* This source code is licensed under the BSD-3-Clause license found in the
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
6
|
+
*/
|
7
|
+
|
8
|
+
import { css } from 'lit-element';
|
9
|
+
|
10
|
+
/**
|
11
|
+
* Chip CSS
|
12
|
+
*/
|
13
|
+
export const styles = css`
|
14
|
+
:host {
|
15
|
+
box-sizing: border-box;
|
16
|
+
}
|
17
|
+
|
18
|
+
:host *,
|
19
|
+
:host *::before,
|
20
|
+
:host *::after {
|
21
|
+
box-sizing: inherit;
|
22
|
+
}
|
23
|
+
|
24
|
+
[hidden] {
|
25
|
+
display: none !important;
|
26
|
+
}
|
27
|
+
|
28
|
+
.form-control .form-control__label {
|
29
|
+
display: none;
|
30
|
+
}
|
31
|
+
|
32
|
+
.form-control .form-control__help-text {
|
33
|
+
display: none;
|
34
|
+
}
|
35
|
+
|
36
|
+
/* Label */
|
37
|
+
.form-control--has-label .form-control__label {
|
38
|
+
display: inline-block;
|
39
|
+
color: inherit;
|
40
|
+
margin-bottom: 0.125rem;
|
41
|
+
}
|
42
|
+
|
43
|
+
.form-control--has-label.form-control--small .form-control__label {
|
44
|
+
font-size: 0.875rem;
|
45
|
+
}
|
46
|
+
|
47
|
+
.form-control--has-label.form-control--medium .form-control__label {
|
48
|
+
font-size: 1rem;
|
49
|
+
}
|
50
|
+
|
51
|
+
.form-control--has-label.form-control--large .form-control__label {
|
52
|
+
font-size: 1.25rem;
|
53
|
+
}
|
54
|
+
|
55
|
+
:host([required]) .form-control--has-label .form-control__label::after {
|
56
|
+
content: '*';
|
57
|
+
margin-inline-start: -2px;
|
58
|
+
color: undefined;
|
59
|
+
}
|
60
|
+
|
61
|
+
/* Help text */
|
62
|
+
.form-control--has-help-text .form-control__help-text {
|
63
|
+
display: block;
|
64
|
+
color: hsl(240 3.8% 46.1%);
|
65
|
+
margin-top: 0.125rem;
|
66
|
+
}
|
67
|
+
|
68
|
+
.form-control--has-help-text.form-control--small .form-control__help-text {
|
69
|
+
font-size: 0.75rem;
|
70
|
+
}
|
71
|
+
|
72
|
+
.form-control--has-help-text.form-control--medium .form-control__help-text {
|
73
|
+
font-size: 0.875rem;
|
74
|
+
}
|
75
|
+
|
76
|
+
.form-control--has-help-text.form-control--large .form-control__help-text {
|
77
|
+
font-size: 1rem;
|
78
|
+
}
|
79
|
+
|
80
|
+
.form-control--has-help-text.form-control--radio-group
|
81
|
+
.form-control__help-text {
|
82
|
+
margin-top: 0.25rem;
|
83
|
+
}
|
84
|
+
|
85
|
+
:host {
|
86
|
+
display: block;
|
87
|
+
font-family: inherit;
|
88
|
+
}
|
89
|
+
|
90
|
+
.nile-chip {
|
91
|
+
display: inline-block;
|
92
|
+
padding: 5px 10px;
|
93
|
+
background-color: #fff;
|
94
|
+
border-radius: 0.25rem;
|
95
|
+
border: solid 1px #c7ced4;
|
96
|
+
padding: 5px 10px;
|
97
|
+
display: inline-block;
|
98
|
+
width: 100%;
|
99
|
+
}
|
100
|
+
|
101
|
+
.nile-chip--disabled {
|
102
|
+
background-color: hsl(240 4.8% 95.9%);
|
103
|
+
border-color: hsl(240 4.9% 83.9%);
|
104
|
+
opacity: 0.5;
|
105
|
+
cursor: not-allowed;
|
106
|
+
pointer-events: none;
|
107
|
+
}
|
108
|
+
|
109
|
+
.nile-chip:hover:not(.nile-chip--disabled) {
|
110
|
+
background-color: #fff;
|
111
|
+
box-shadow: 0 0 0 1px hsl(198.6 88.7% 48.4% / 40%);
|
112
|
+
}
|
113
|
+
|
114
|
+
.nile-chip.nile-chip--focused:not(.nile-chip--disabled) {
|
115
|
+
background-color: #fff;
|
116
|
+
border-color: #005ea6;
|
117
|
+
box-shadow: 0 0 0 1px hsl(198.6 88.7% 48.4% / 40%);
|
118
|
+
}
|
119
|
+
|
120
|
+
.nile-chip.nile-chip--disabled {
|
121
|
+
background-color: hsl(240 4.8% 95.9%);
|
122
|
+
border-color: hsl(240 4.9% 83.9%);
|
123
|
+
opacity: 0.5;
|
124
|
+
cursor: not-allowed;
|
125
|
+
}
|
126
|
+
|
127
|
+
.nile-chip.nile-chip--warning {
|
128
|
+
border-color: #e5bf43;
|
129
|
+
}
|
130
|
+
|
131
|
+
.nile-chip.nile-chip--error {
|
132
|
+
border-color: #e5434d;
|
133
|
+
}
|
134
|
+
|
135
|
+
.nile-chip.nile-chip--success {
|
136
|
+
border-color: #43e5c0;
|
137
|
+
}
|
138
|
+
|
139
|
+
.nile-chip__auto-complete {
|
140
|
+
width: 100%;
|
141
|
+
}
|
142
|
+
|
143
|
+
.nile-chip__tags {
|
144
|
+
margin: 0.05rem;
|
145
|
+
}
|
146
|
+
`;
|
147
|
+
|
148
|
+
export default [styles];
|
@@ -0,0 +1,189 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright Aquera Inc 2023
|
3
|
+
*
|
4
|
+
* This source code is licensed under the BSD-3-Clause license found in the
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
6
|
+
*/
|
7
|
+
|
8
|
+
import {
|
9
|
+
LitElement,
|
10
|
+
html,
|
11
|
+
property,
|
12
|
+
CSSResultArray,
|
13
|
+
TemplateResult
|
14
|
+
} from 'lit-element';
|
15
|
+
import { customElement, query, state } from 'lit/decorators.js';
|
16
|
+
import { styles } from './nile-chip.css';
|
17
|
+
import { classMap } from 'lit/directives/class-map.js';
|
18
|
+
import { HasSlotController } from '../internal/slot';
|
19
|
+
import { watch } from '../internal/watch';
|
20
|
+
import NileElement, { NileFormControl } from '../internal/nile-element';
|
21
|
+
|
22
|
+
|
23
|
+
interface CustomEventDetail {
|
24
|
+
value: string;
|
25
|
+
}
|
26
|
+
|
27
|
+
@customElement('nile-chip')
|
28
|
+
export class NileChip extends NileElement {
|
29
|
+
|
30
|
+
public static get styles(): CSSResultArray {
|
31
|
+
return [styles];
|
32
|
+
}
|
33
|
+
|
34
|
+
private readonly hasSlotController = new HasSlotController(this, 'help-text', 'label');
|
35
|
+
|
36
|
+
@state() tags: string[] = [];
|
37
|
+
|
38
|
+
@state() inputValue: string = '';
|
39
|
+
|
40
|
+
@state() isDropdownOpen: boolean = false;
|
41
|
+
|
42
|
+
@query('nile-auto-complete') autoComplete!: any;
|
43
|
+
|
44
|
+
/** The input's label. If you need to display HTML, use the `label` slot instead. */
|
45
|
+
@property() label = '';
|
46
|
+
|
47
|
+
/** Adds a clear button when the input is not empty. */
|
48
|
+
@property({ type: Boolean }) acceptUserInput = false;
|
49
|
+
|
50
|
+
/** Adds a clear button when the input is not empty. */
|
51
|
+
@property({ type: Boolean }) clearable = false;
|
52
|
+
|
53
|
+
/** Placeholder text to show as a hint when the input is empty. */
|
54
|
+
@property() placeholder = '';
|
55
|
+
|
56
|
+
/** Makes the input readonly. */
|
57
|
+
@property({ type: Boolean, reflect: true }) readonly = false;
|
58
|
+
|
59
|
+
/** Disables the input. */
|
60
|
+
@property({ type: Boolean, reflect: true }) disabled = false;
|
61
|
+
|
62
|
+
/** The input's help text. If you need to display HTML, use the `help-text` slot instead. */
|
63
|
+
@property({ attribute: 'help-text' }) helpText = '';
|
64
|
+
|
65
|
+
// Auto-complete options
|
66
|
+
@property({ type: Array }) autoCompleteOptions : any[] = [];
|
67
|
+
|
68
|
+
private handleSelect(event: CustomEvent<CustomEventDetail>) {
|
69
|
+
|
70
|
+
// Add the selected value to the tags array
|
71
|
+
this.tags = [...this.tags, event.detail.value];
|
72
|
+
|
73
|
+
// Emit a custom event with the selected value
|
74
|
+
this.emit('nile-chip-change', { value: this.tags });
|
75
|
+
|
76
|
+
// Reset the input field
|
77
|
+
this.resetInput();
|
78
|
+
}
|
79
|
+
|
80
|
+
private handleRemove(value: string) {
|
81
|
+
// Remove the tag from the tags array
|
82
|
+
this.tags = this.tags.filter(tag => tag !== value);
|
83
|
+
this.emit('nile-chip-change', { value: this.tags });
|
84
|
+
|
85
|
+
}
|
86
|
+
|
87
|
+
private handleInputChange(event: CustomEvent<CustomEventDetail>) {
|
88
|
+
// Update the input value
|
89
|
+
this.inputValue = event.detail.value;
|
90
|
+
}
|
91
|
+
|
92
|
+
private handleInputKeydown(event: KeyboardEvent) {
|
93
|
+
if (!this.acceptUserInput) {
|
94
|
+
return;
|
95
|
+
}
|
96
|
+
|
97
|
+
if (event.key === 'Enter' && this.inputValue) {
|
98
|
+
this.tags = [...this.tags, this.inputValue];
|
99
|
+
|
100
|
+
this.resetInput();
|
101
|
+
this.emit('nile-chip-change', { value: this.tags });
|
102
|
+
}
|
103
|
+
|
104
|
+
|
105
|
+
}
|
106
|
+
|
107
|
+
private handleFocus() {
|
108
|
+
this.isDropdownOpen = true;
|
109
|
+
}
|
110
|
+
|
111
|
+
private resetInput() {
|
112
|
+
// Reset the input-related properties
|
113
|
+
this.inputValue = '';
|
114
|
+
this.isDropdownOpen = false;
|
115
|
+
this.autoComplete.value = '';
|
116
|
+
this.autoComplete.handleFocus();
|
117
|
+
}
|
118
|
+
|
119
|
+
render() {
|
120
|
+
// Check if slots are present
|
121
|
+
const hasLabelSlot = this.hasSlotController.test('label');
|
122
|
+
const hasHelpTextSlot = this.hasSlotController.test('help-text');
|
123
|
+
|
124
|
+
// Check if label and help text are present
|
125
|
+
const hasLabel = this.label ? true : !!hasLabelSlot;
|
126
|
+
const hasHelpText = this.helpText ? true : !!hasHelpTextSlot;
|
127
|
+
|
128
|
+
return html`
|
129
|
+
<div
|
130
|
+
part="form-control"
|
131
|
+
class=${classMap({
|
132
|
+
'form-control': true,
|
133
|
+
'form-control--medium': true,
|
134
|
+
'form-control--has-label': hasLabel,
|
135
|
+
'form-control--has-help-text': hasHelpText,
|
136
|
+
'nile-chip--disabled': this.disabled,
|
137
|
+
})}
|
138
|
+
>
|
139
|
+
<label
|
140
|
+
part="form-control-label"
|
141
|
+
class="form-control__label"
|
142
|
+
for="input"
|
143
|
+
aria-hidden=${hasLabel ? 'false' : 'true'}
|
144
|
+
>
|
145
|
+
<slot name="label">${this.label}</slot>
|
146
|
+
</label>
|
147
|
+
|
148
|
+
<div class="nile-chip">
|
149
|
+
${this.tags.map(tag => html`
|
150
|
+
<nile-tag class="nile-chip__tags" @nile-remove=${() => this.handleRemove(tag)} removable pill>
|
151
|
+
${tag}
|
152
|
+
</nile-tag>
|
153
|
+
`)}
|
154
|
+
<div class="nile-chip__auto-complete">
|
155
|
+
<nile-auto-complete
|
156
|
+
.allMenuItems=${this.autoCompleteOptions}
|
157
|
+
.value=${this.inputValue}
|
158
|
+
?isDropdownOpen=${this.isDropdownOpen}
|
159
|
+
.noBorder=${true}
|
160
|
+
openOnFocus
|
161
|
+
.placeholder=${this.placeholder}
|
162
|
+
@nile-input=${this.handleInputChange}
|
163
|
+
@keydown=${this.handleInputKeydown}
|
164
|
+
@nile-focus=${this.handleFocus}
|
165
|
+
@nile-complete=${this.handleSelect}
|
166
|
+
></nile-auto-complete>
|
167
|
+
</div>
|
168
|
+
<slot
|
169
|
+
name="help-text"
|
170
|
+
part="form-control-help-text"
|
171
|
+
id="help-text"
|
172
|
+
class="form-control__help-text"
|
173
|
+
aria-hidden=${hasHelpText ? 'false' : 'true'}
|
174
|
+
>
|
175
|
+
${this.helpText}
|
176
|
+
</slot>
|
177
|
+
</div>
|
178
|
+
</div>
|
179
|
+
`;
|
180
|
+
}
|
181
|
+
}
|
182
|
+
|
183
|
+
export default NileChip;
|
184
|
+
|
185
|
+
declare global {
|
186
|
+
interface HTMLElementTagNameMap {
|
187
|
+
'nile-chip': NileChip;
|
188
|
+
}
|
189
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export { NileDropdown} from './nile-dropdown';
|
@@ -0,0 +1,62 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright Aquera Inc 2023
|
3
|
+
*
|
4
|
+
* This source code is licensed under the BSD-3-Clause license found in the
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
6
|
+
*/
|
7
|
+
|
8
|
+
import {css} from 'lit-element';
|
9
|
+
|
10
|
+
/**
|
11
|
+
* Dropdown CSS
|
12
|
+
*/
|
13
|
+
export const styles = css`
|
14
|
+
:host {
|
15
|
+
display: inline-block;
|
16
|
+
}
|
17
|
+
|
18
|
+
.dropdown::part(popup) {
|
19
|
+
z-index: 900;
|
20
|
+
}
|
21
|
+
|
22
|
+
.dropdown[data-current-placement^='top']::part(popup) {
|
23
|
+
transform-origin: bottom;
|
24
|
+
}
|
25
|
+
|
26
|
+
.dropdown[data-current-placement^='bottom']::part(popup) {
|
27
|
+
transform-origin: top;
|
28
|
+
}
|
29
|
+
|
30
|
+
.dropdown[data-current-placement^='left']::part(popup) {
|
31
|
+
transform-origin: right;
|
32
|
+
}
|
33
|
+
|
34
|
+
.dropdown[data-current-placement^='right']::part(popup) {
|
35
|
+
transform-origin: left;
|
36
|
+
}
|
37
|
+
|
38
|
+
.dropdown__trigger {
|
39
|
+
display: block;
|
40
|
+
}
|
41
|
+
|
42
|
+
.dropdown__panel {
|
43
|
+
font-size: 1rem;
|
44
|
+
font-weight: 400;
|
45
|
+
box-shadow: 0 2px 8px hsl(240 3.8% 46.1% / 12%);
|
46
|
+
border-radius: 0.25rem;
|
47
|
+
pointer-events: none;
|
48
|
+
}
|
49
|
+
|
50
|
+
.dropdown--open .dropdown__panel {
|
51
|
+
display: block;
|
52
|
+
pointer-events: all;
|
53
|
+
}
|
54
|
+
|
55
|
+
/* When users slot a menu, make sure it conforms to the popup's auto-size */
|
56
|
+
::slotted(nile-menu) {
|
57
|
+
max-width: var(--auto-size-available-width) !important;
|
58
|
+
max-height: var(--auto-size-available-height) !important;
|
59
|
+
}
|
60
|
+
`;
|
61
|
+
|
62
|
+
export default [styles];
|