@limetech/lime-elements 39.32.1 → 39.33.1
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/CHANGELOG.md +15 -0
- package/dist/cjs/limel-picker.cjs.entry.js +2 -1
- package/dist/cjs/limel-table.cjs.entry.js +22 -3
- package/dist/collection/components/picker/picker.js +3 -1
- package/dist/collection/components/table/table.js +22 -3
- package/dist/esm/limel-picker.entry.js +2 -1
- package/dist/esm/limel-table.entry.js +22 -3
- package/dist/lime-elements/lime-elements.esm.js +1 -1
- package/dist/lime-elements/{p-54090121.entry.js → p-16254e4a.entry.js} +1 -1
- package/dist/lime-elements/p-d0288858.entry.js +1 -0
- package/dist/types/components/chip-set/chip.types.d.ts +3 -2
- package/dist/types/components/picker/picker-item.types.d.ts +6 -0
- package/dist/types/components/picker/picker.d.ts +1 -0
- package/dist/types/components/table/table.d.ts +15 -0
- package/dist/types/components.d.ts +4 -0
- package/package.json +1 -1
- package/dist/lime-elements/p-ac5a3f55.entry.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,c as i,h as s,a as e}from"./p-DBTJNfo7.js";import{t as h}from"./p-EPnIW0K5.js";import{i as n}from"./p-B9Ofc5RB.js";import{E as r,T as o,a,A as l,b as c}from"./p-rI0IeKpx.js";import{c as d}from"./p-JbKhhoXs.js";import{a as u,g as p}from"./p-CgNJbSP4.js";import{d as m}from"./p-BviYUVSD.js";import"./p-BJQylLSL.js";import"./p-D6dCQvwl.js";import"./p-BOEi1C7r.js";import"./p-oiMYqRQ0.js";const g=class{constructor(s){t(this,s),this.change=i(this,"change"),this.interact=i(this,"interact"),this.action=i(this,"action"),this.disabled=!1,this.readonly=!1,this.language="en",this.required=!1,this.invalid=!1,this.allItems=[],this.multiple=!1,this.delimiter=null,this.actions=[],this.actionPosition="bottom",this.actionScrollBehavior="sticky",this.badgeIcons=!1,this.textValue="",this.loading=!1,this.chips=[],this.chipSetEditMode=!1,this.getValueId=t=>{const i=t.value;return i&&"object"==typeof i?i.id:i},this.createChips=t=>t?this.multiple?t.map(this.createChip):[this.createChip(t)]:[],this.createChip=t=>{const i=p(t.icon),s=u(t.icon,t.iconColor);return{id:`${this.getValueId(t)}`,text:t.text,removable:!1!==t.removable,icon:i?{name:i,color:s}:void 0,image:t.image,value:t,menuItems:t.actions,badge:t.badge}},this.search=async t=>{const i=setTimeout((()=>{this.loading=!0})),s=this.searcher||this.defaultSearcher,e=await s(this.textValue);clearTimeout(i),this.handleSearchResult(t,e)},this.defaultSearcher=async t=>""===t?this.allItems.slice(0,20):this.allItems.filter((i=>{let s=i.text.toLowerCase();return i.secondaryText&&(s=s+" "+i.secondaryText.toLowerCase()),s.includes(t.toLowerCase())})).slice(0,20),this.handleTextInput=this.handleTextInput.bind(this),this.handleInputKeyDown=this.handleInputKeyDown.bind(this),this.handleInputFieldFocus=this.handleInputFieldFocus.bind(this),this.handleChange=this.handleChange.bind(this),this.handleInteract=this.handleInteract.bind(this),this.handleListChange=this.handleListChange.bind(this),this.handleActionListChange=this.handleActionListChange.bind(this),this.handleStopEditAndBlur=this.handleStopEditAndBlur.bind(this),this.handleCloseMenu=this.handleCloseMenu.bind(this),this.onListKeyDown=this.onListKeyDown.bind(this),this.portalId=d(),this.debouncedSearch=m(this.search,300)}componentWillLoad(){this.chips=this.createChips(this.value)}componentDidLoad(){this.chipSet=this.host.shadowRoot.querySelector("limel-chip-set"),this.updateTabIndex()}disconnectedCallback(){this.debouncedSearch.cancel()}onDisabledChange(){this.updateTabIndex()}updateTabIndex(){this.host.setAttribute("tabindex",this.disabled||this.readonly?"-1":"0")}async componentWillUpdate(){this.chipSetEditMode=!1,this.chipSet&&(this.chipSetEditMode=await this.chipSet.getEditMode())}render(){const t={};return this.multiple||(t.maxItems=1),[s("limel-chip-set",Object.assign({key:"a518a610c15c72d7a45b3efbd3578f6b29c030fc",type:"input",inputType:"search",label:this.label,helperText:this.helperText,leadingIcon:this.leadingIcon,value:this.chips,disabled:this.disabled,invalid:this.invalid,delimiter:this.renderDelimiter(),readonly:this.readonly,required:this.required,searchLabel:this.searchLabel,language:this.language,onInput:this.handleTextInput,onKeyDown:this.handleInputKeyDown,onChange:this.handleChange,onInteract:this.handleInteract,onStartEdit:this.handleInputFieldFocus,onStopEdit:this.handleStopEditAndBlur,emptyInputOnBlur:!1,emptyInputOnChange:!1,clearAllButton:this.multiple&&!this.chipSetEditMode},t)),this.renderDropdown()]}onChangeValue(){this.chips=this.createChips(this.value)}renderDelimiter(){return this.multiple?this.delimiter:null}renderDropdown(){const t=this.getDropdownContent(),i=[];if(this.shouldShowDropDownContent()){const s=this.getActionContent();"top"===this.actionPosition&&i.push(s),t&&i.push(t),"bottom"===this.actionPosition&&i.push(s)}return this.renderPortal(i)}getActionContent(){var t,i;return 0===(null!==(i=null===(t=this.actions)||void 0===t?void 0:t.length)&&void 0!==i?i:0)?null:[s("limel-list",{class:{"static-actions-list":!0,"is-on-top":"top"===this.actionPosition,"is-at-bottom":"bottom"===this.actionPosition,"has-position-sticky":"sticky"===this.actionScrollBehavior},badgeIcons:!0,type:"selectable",onChange:this.handleActionListChange,items:this.actions.map(this.removeUnusedPropertiesOnAction)})]}removeUnusedPropertiesOnAction(t){return Object.assign(Object.assign({},t),{actions:[]})}shouldShowDropDownContent(){return!this.isFull()&&!!this.chipSetEditMode}getDropdownContent(){var t;if(this.shouldShowDropDownContent())return this.loading?this.renderSpinner():(null===(t=this.items)||void 0===t?void 0:t.length)?this.renderListResult():""!==this.textValue?this.renderEmptyMessage():void 0}isFull(){return!this.multiple&&!!this.value}renderSpinner(){return s("div",{style:{width:"100%",display:"flex","align-items":"center","justify-content":"center",padding:"1rem 0"}},s("limel-spinner",{limeBranded:!1}))}renderEmptyMessage(){const t=this.emptyResultMessage||h.get("picker.no-matching-results",this.language,{query:this.textValue});return s("p",{style:{color:"rgb(var(--contrast-1100))",textAlign:"center",fontSize:"var(--limel-theme-default-font-size)",margin:"0.5rem 1rem"}},t)}renderListResult(){return s("limel-list",{badgeIcons:this.badgeIcons,onChange:this.handleListChange,onKeyDown:this.onListKeyDown,type:"selectable",items:this.items})}onListKeyDown(t){if(t.key===r)return t.preventDefault(),t.stopPropagation(),this.handleEscape(),void this.chipSet.setFocus();[o,a].includes(t.key)&&this.chipSet.setFocus()}renderPortal(t=[]){const i=getComputedStyle(this.host).getPropertyValue("--dropdown-z-index");return s("limel-portal",{visible:t.length>0,containerId:this.portalId,inheritParentWidth:!0,containerStyle:{"z-index":i}},s("limel-menu-surface",{open:t.length>0,allowClicksElement:this.host,style:{"--menu-surface-width":"100%","max-height":"inherit",display:"flex"},onDismiss:this.handleCloseMenu},t))}handleStopEditAndBlur(){const t=this.host.shadowRoot.activeElement||document.activeElement,i=document.querySelector(`#${this.portalId}`);n(t,this.host)||n(t,i)||this.clearInputField()}async handleTextInput(t){t.stopPropagation();const i=t.detail;this.textValue=i,this.debouncedSearch(i),""===i&&this.debouncedSearch.flush()}handleListChange(t){var i,s,e;if(t.stopPropagation(),!this.value||this.value!==t.detail){let e=t.detail;if(this.multiple&&(e=[...null!==(i=this.value)&&void 0!==i?i:[],t.detail]),this.change.emit(e),this.multiple){const i=this.items.filter((i=>i!==t.detail));this.items=this.hasPickableItems(i)?i:[]}else this.items=[],this.textValue="",null===(s=this.chipSet)||void 0===s||s.emptyInput()}this.multiple&&(null===(e=this.chipSet)||void 0===e||e.setFocus())}handleActionListChange(t){t.stopPropagation(),t.detail&&(this.action.emit(t.detail.value),this.items=[])}handleInputFieldFocus(){this.debouncedSearch(this.textValue)}handleChange(t){t.stopPropagation(),this.textValue="";let i=null;this.multiple&&(i=t.detail.map((t=>this.value.find((i=>`${this.getValueId(i)}`===t.id))))),this.change.emit(i)}handleInteract(t){t.stopPropagation(),this.interact.emit(t.detail?t.detail.value:t.detail)}handleInputKeyDown(t){const i=t.key===o&&!t.altKey&&!t.metaKey&&!t.shiftKey,s=t.key===l,e=t.key===c;if(t.key===r)return t.preventDefault(),t.stopPropagation(),void this.handleEscape();if(!i&&!s&&!e)return;const h=document.querySelector(` #${this.portalId} limel-list`);if(h){if(i||e){const i=h.shadowRoot.querySelector(".mdc-deprecated-list-item");if(!i)return;return t.preventDefault(),void i.focus()}if(s){const i=[...h.shadowRoot.querySelectorAll(".mdc-deprecated-list-item")].at(-1);if(!i)return;t.preventDefault(),i.focus()}}}handleSearchResult(t,i){var s;if(t===this.textValue){let e=i;if(this.multiple){const t=null!==(s=this.value)&&void 0!==s?s:[];e=i.filter((i=>"separator"in i||!t.includes(i)))}this.items=this.prependSearchHeader(t,e),this.loading=!1}}hasPickableItems(t){return t.some((t=>!("separator"in t)))}prependSearchHeader(t,i){return""===t?i:this.hasPickableItems(i)?[{separator:!0,text:h.get("picker.results-matching",this.language,{query:t})},...i]:i}handleCloseMenu(){this.clearInputField()}clearTextValue(){this.chipSet.emptyInput(),this.textValue="",this.debouncedSearch.cancel()}clearInputField(){this.clearTextValue(),this.handleSearchResult("",[])}resetSearchToDefault(){this.clearTextValue(),this.search("")}handleEscape(){""===this.textValue?this.clearInputField():this.resetSearchToDefault()}static get delegatesFocus(){return!0}get host(){return e(this)}static get watchers(){return{disabled:[{onDisabledChange:0}],value:[{onChangeValue:0}]}}};g.style=":host{position:relative;display:block}:host([hidden]){display:none}";export{g as limel_picker}
|
|
@@ -87,9 +87,10 @@ export interface Chip<T = any> {
|
|
|
87
87
|
*/
|
|
88
88
|
value?: T;
|
|
89
89
|
/**
|
|
90
|
-
* The value of the badge.
|
|
90
|
+
* The value of the badge. Accepts either a number (for counter-style
|
|
91
|
+
* badges) or a short string (e.g. a status label like "Inactive").
|
|
91
92
|
*/
|
|
92
|
-
badge?: number;
|
|
93
|
+
badge?: number | string;
|
|
93
94
|
/**
|
|
94
95
|
* If supplied, the chip will render a link, using the supplied href.
|
|
95
96
|
*/
|
|
@@ -24,5 +24,11 @@ export interface PickerItem<T = PickerValue> extends ListItem<T> {
|
|
|
24
24
|
* button is hidden on all chips regardless of this flag.
|
|
25
25
|
*/
|
|
26
26
|
removable?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Optional badge to display on the chip when the item is picked.
|
|
29
|
+
* Useful for marking selected items with a status indicator
|
|
30
|
+
* (e.g. "Inactive", "Beta", or a numeric counter).
|
|
31
|
+
*/
|
|
32
|
+
badge?: number | string;
|
|
27
33
|
}
|
|
28
34
|
//# sourceMappingURL=picker-item.types.d.ts.map
|
|
@@ -9,6 +9,7 @@ import { IconName } from '../../global/shared-types/icon.types';
|
|
|
9
9
|
* @exampleComponent limel-example-picker-basic
|
|
10
10
|
* @exampleComponent limel-example-picker-multiple
|
|
11
11
|
* @exampleComponent limel-example-picker-non-removable
|
|
12
|
+
* @exampleComponent limel-example-picker-with-badges
|
|
12
13
|
* @exampleComponent limel-example-picker-icons
|
|
13
14
|
* @exampleComponent limel-example-picker-pictures
|
|
14
15
|
* @exampleComponent limel-example-picker-value-as-object
|
|
@@ -237,6 +237,21 @@ export declare class Table {
|
|
|
237
237
|
private formatRow;
|
|
238
238
|
private isActiveRow;
|
|
239
239
|
private calculatePageCount;
|
|
240
|
+
/**
|
|
241
|
+
* Whether any of `columns` shows an aggregation — either because the column
|
|
242
|
+
* carries its own `aggregator`, or because its field has a matching entry in
|
|
243
|
+
* `aggregates`.
|
|
244
|
+
*
|
|
245
|
+
* Deriving from `aggregates` (the source of truth) rather than only from the
|
|
246
|
+
* `aggregator` that `addColumnAggregator` mutates onto the column keeps this
|
|
247
|
+
* correct even when the table is re-fed equivalent columns and aggregates
|
|
248
|
+
* without that mutation being re-applied — e.g. when only the aggregate
|
|
249
|
+
* values change, `updateAggregates` recalculates without re-running
|
|
250
|
+
* `getColumnDefinitions`.
|
|
251
|
+
*
|
|
252
|
+
* @param columns - the column definitions to inspect.
|
|
253
|
+
* @returns whether at least one column shows an aggregation.
|
|
254
|
+
*/
|
|
240
255
|
private hasAggregation;
|
|
241
256
|
private readonly getColumnOptions;
|
|
242
257
|
private readonly getRowDragOptions;
|
|
@@ -2786,6 +2786,7 @@ export namespace Components {
|
|
|
2786
2786
|
* @exampleComponent limel-example-picker-basic
|
|
2787
2787
|
* @exampleComponent limel-example-picker-multiple
|
|
2788
2788
|
* @exampleComponent limel-example-picker-non-removable
|
|
2789
|
+
* @exampleComponent limel-example-picker-with-badges
|
|
2789
2790
|
* @exampleComponent limel-example-picker-icons
|
|
2790
2791
|
* @exampleComponent limel-example-picker-pictures
|
|
2791
2792
|
* @exampleComponent limel-example-picker-value-as-object
|
|
@@ -5757,6 +5758,7 @@ declare global {
|
|
|
5757
5758
|
* @exampleComponent limel-example-picker-basic
|
|
5758
5759
|
* @exampleComponent limel-example-picker-multiple
|
|
5759
5760
|
* @exampleComponent limel-example-picker-non-removable
|
|
5761
|
+
* @exampleComponent limel-example-picker-with-badges
|
|
5760
5762
|
* @exampleComponent limel-example-picker-icons
|
|
5761
5763
|
* @exampleComponent limel-example-picker-pictures
|
|
5762
5764
|
* @exampleComponent limel-example-picker-value-as-object
|
|
@@ -9407,6 +9409,7 @@ declare namespace LocalJSX {
|
|
|
9407
9409
|
* @exampleComponent limel-example-picker-basic
|
|
9408
9410
|
* @exampleComponent limel-example-picker-multiple
|
|
9409
9411
|
* @exampleComponent limel-example-picker-non-removable
|
|
9412
|
+
* @exampleComponent limel-example-picker-with-badges
|
|
9410
9413
|
* @exampleComponent limel-example-picker-icons
|
|
9411
9414
|
* @exampleComponent limel-example-picker-pictures
|
|
9412
9415
|
* @exampleComponent limel-example-picker-value-as-object
|
|
@@ -12402,6 +12405,7 @@ declare module "@stencil/core" {
|
|
|
12402
12405
|
* @exampleComponent limel-example-picker-basic
|
|
12403
12406
|
* @exampleComponent limel-example-picker-multiple
|
|
12404
12407
|
* @exampleComponent limel-example-picker-non-removable
|
|
12408
|
+
* @exampleComponent limel-example-picker-with-badges
|
|
12405
12409
|
* @exampleComponent limel-example-picker-icons
|
|
12406
12410
|
* @exampleComponent limel-example-picker-pictures
|
|
12407
12411
|
* @exampleComponent limel-example-picker-value-as-object
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,c as i,h as s,a as e}from"./p-DBTJNfo7.js";import{t as h}from"./p-EPnIW0K5.js";import{i as n}from"./p-B9Ofc5RB.js";import{E as r,T as o,a,A as l,b as d}from"./p-rI0IeKpx.js";import{c}from"./p-JbKhhoXs.js";import{a as u,g as p}from"./p-CgNJbSP4.js";import{d as m}from"./p-BviYUVSD.js";import"./p-BJQylLSL.js";import"./p-D6dCQvwl.js";import"./p-BOEi1C7r.js";import"./p-oiMYqRQ0.js";const g=class{constructor(s){t(this,s),this.change=i(this,"change"),this.interact=i(this,"interact"),this.action=i(this,"action"),this.disabled=!1,this.readonly=!1,this.language="en",this.required=!1,this.invalid=!1,this.allItems=[],this.multiple=!1,this.delimiter=null,this.actions=[],this.actionPosition="bottom",this.actionScrollBehavior="sticky",this.badgeIcons=!1,this.textValue="",this.loading=!1,this.chips=[],this.chipSetEditMode=!1,this.getValueId=t=>{const i=t.value;return i&&"object"==typeof i?i.id:i},this.createChips=t=>t?this.multiple?t.map(this.createChip):[this.createChip(t)]:[],this.createChip=t=>{const i=p(t.icon),s=u(t.icon,t.iconColor);return{id:`${this.getValueId(t)}`,text:t.text,removable:!1!==t.removable,icon:i?{name:i,color:s}:void 0,image:t.image,value:t,menuItems:t.actions}},this.search=async t=>{const i=setTimeout((()=>{this.loading=!0})),s=this.searcher||this.defaultSearcher,e=await s(this.textValue);clearTimeout(i),this.handleSearchResult(t,e)},this.defaultSearcher=async t=>""===t?this.allItems.slice(0,20):this.allItems.filter((i=>{let s=i.text.toLowerCase();return i.secondaryText&&(s=s+" "+i.secondaryText.toLowerCase()),s.includes(t.toLowerCase())})).slice(0,20),this.handleTextInput=this.handleTextInput.bind(this),this.handleInputKeyDown=this.handleInputKeyDown.bind(this),this.handleInputFieldFocus=this.handleInputFieldFocus.bind(this),this.handleChange=this.handleChange.bind(this),this.handleInteract=this.handleInteract.bind(this),this.handleListChange=this.handleListChange.bind(this),this.handleActionListChange=this.handleActionListChange.bind(this),this.handleStopEditAndBlur=this.handleStopEditAndBlur.bind(this),this.handleCloseMenu=this.handleCloseMenu.bind(this),this.onListKeyDown=this.onListKeyDown.bind(this),this.portalId=c(),this.debouncedSearch=m(this.search,300)}componentWillLoad(){this.chips=this.createChips(this.value)}componentDidLoad(){this.chipSet=this.host.shadowRoot.querySelector("limel-chip-set"),this.updateTabIndex()}disconnectedCallback(){this.debouncedSearch.cancel()}onDisabledChange(){this.updateTabIndex()}updateTabIndex(){this.host.setAttribute("tabindex",this.disabled||this.readonly?"-1":"0")}async componentWillUpdate(){this.chipSetEditMode=!1,this.chipSet&&(this.chipSetEditMode=await this.chipSet.getEditMode())}render(){const t={};return this.multiple||(t.maxItems=1),[s("limel-chip-set",Object.assign({key:"36c7521c2ee4232d08fdb86ed2e3d295fda69e01",type:"input",inputType:"search",label:this.label,helperText:this.helperText,leadingIcon:this.leadingIcon,value:this.chips,disabled:this.disabled,invalid:this.invalid,delimiter:this.renderDelimiter(),readonly:this.readonly,required:this.required,searchLabel:this.searchLabel,language:this.language,onInput:this.handleTextInput,onKeyDown:this.handleInputKeyDown,onChange:this.handleChange,onInteract:this.handleInteract,onStartEdit:this.handleInputFieldFocus,onStopEdit:this.handleStopEditAndBlur,emptyInputOnBlur:!1,emptyInputOnChange:!1,clearAllButton:this.multiple&&!this.chipSetEditMode},t)),this.renderDropdown()]}onChangeValue(){this.chips=this.createChips(this.value)}renderDelimiter(){return this.multiple?this.delimiter:null}renderDropdown(){const t=this.getDropdownContent(),i=[];if(this.shouldShowDropDownContent()){const s=this.getActionContent();"top"===this.actionPosition&&i.push(s),t&&i.push(t),"bottom"===this.actionPosition&&i.push(s)}return this.renderPortal(i)}getActionContent(){var t,i;return 0===(null!==(i=null===(t=this.actions)||void 0===t?void 0:t.length)&&void 0!==i?i:0)?null:[s("limel-list",{class:{"static-actions-list":!0,"is-on-top":"top"===this.actionPosition,"is-at-bottom":"bottom"===this.actionPosition,"has-position-sticky":"sticky"===this.actionScrollBehavior},badgeIcons:!0,type:"selectable",onChange:this.handleActionListChange,items:this.actions.map(this.removeUnusedPropertiesOnAction)})]}removeUnusedPropertiesOnAction(t){return Object.assign(Object.assign({},t),{actions:[]})}shouldShowDropDownContent(){return!this.isFull()&&!!this.chipSetEditMode}getDropdownContent(){var t;if(this.shouldShowDropDownContent())return this.loading?this.renderSpinner():(null===(t=this.items)||void 0===t?void 0:t.length)?this.renderListResult():""!==this.textValue?this.renderEmptyMessage():void 0}isFull(){return!this.multiple&&!!this.value}renderSpinner(){return s("div",{style:{width:"100%",display:"flex","align-items":"center","justify-content":"center",padding:"1rem 0"}},s("limel-spinner",{limeBranded:!1}))}renderEmptyMessage(){const t=this.emptyResultMessage||h.get("picker.no-matching-results",this.language,{query:this.textValue});return s("p",{style:{color:"rgb(var(--contrast-1100))",textAlign:"center",fontSize:"var(--limel-theme-default-font-size)",margin:"0.5rem 1rem"}},t)}renderListResult(){return s("limel-list",{badgeIcons:this.badgeIcons,onChange:this.handleListChange,onKeyDown:this.onListKeyDown,type:"selectable",items:this.items})}onListKeyDown(t){if(t.key===r)return t.preventDefault(),t.stopPropagation(),this.handleEscape(),void this.chipSet.setFocus();[o,a].includes(t.key)&&this.chipSet.setFocus()}renderPortal(t=[]){const i=getComputedStyle(this.host).getPropertyValue("--dropdown-z-index");return s("limel-portal",{visible:t.length>0,containerId:this.portalId,inheritParentWidth:!0,containerStyle:{"z-index":i}},s("limel-menu-surface",{open:t.length>0,allowClicksElement:this.host,style:{"--menu-surface-width":"100%","max-height":"inherit",display:"flex"},onDismiss:this.handleCloseMenu},t))}handleStopEditAndBlur(){const t=this.host.shadowRoot.activeElement||document.activeElement,i=document.querySelector(`#${this.portalId}`);n(t,this.host)||n(t,i)||this.clearInputField()}async handleTextInput(t){t.stopPropagation();const i=t.detail;this.textValue=i,this.debouncedSearch(i),""===i&&this.debouncedSearch.flush()}handleListChange(t){var i,s,e;if(t.stopPropagation(),!this.value||this.value!==t.detail){let e=t.detail;if(this.multiple&&(e=[...null!==(i=this.value)&&void 0!==i?i:[],t.detail]),this.change.emit(e),this.multiple){const i=this.items.filter((i=>i!==t.detail));this.items=this.hasPickableItems(i)?i:[]}else this.items=[],this.textValue="",null===(s=this.chipSet)||void 0===s||s.emptyInput()}this.multiple&&(null===(e=this.chipSet)||void 0===e||e.setFocus())}handleActionListChange(t){t.stopPropagation(),t.detail&&(this.action.emit(t.detail.value),this.items=[])}handleInputFieldFocus(){this.debouncedSearch(this.textValue)}handleChange(t){t.stopPropagation(),this.textValue="";let i=null;this.multiple&&(i=t.detail.map((t=>this.value.find((i=>`${this.getValueId(i)}`===t.id))))),this.change.emit(i)}handleInteract(t){t.stopPropagation(),this.interact.emit(t.detail?t.detail.value:t.detail)}handleInputKeyDown(t){const i=t.key===o&&!t.altKey&&!t.metaKey&&!t.shiftKey,s=t.key===l,e=t.key===d;if(t.key===r)return t.preventDefault(),t.stopPropagation(),void this.handleEscape();if(!i&&!s&&!e)return;const h=document.querySelector(` #${this.portalId} limel-list`);if(h){if(i||e){const i=h.shadowRoot.querySelector(".mdc-deprecated-list-item");if(!i)return;return t.preventDefault(),void i.focus()}if(s){const i=[...h.shadowRoot.querySelectorAll(".mdc-deprecated-list-item")].at(-1);if(!i)return;t.preventDefault(),i.focus()}}}handleSearchResult(t,i){var s;if(t===this.textValue){let e=i;if(this.multiple){const t=null!==(s=this.value)&&void 0!==s?s:[];e=i.filter((i=>"separator"in i||!t.includes(i)))}this.items=this.prependSearchHeader(t,e),this.loading=!1}}hasPickableItems(t){return t.some((t=>!("separator"in t)))}prependSearchHeader(t,i){return""===t?i:this.hasPickableItems(i)?[{separator:!0,text:h.get("picker.results-matching",this.language,{query:t})},...i]:i}handleCloseMenu(){this.clearInputField()}clearTextValue(){this.chipSet.emptyInput(),this.textValue="",this.debouncedSearch.cancel()}clearInputField(){this.clearTextValue(),this.handleSearchResult("",[])}resetSearchToDefault(){this.clearTextValue(),this.search("")}handleEscape(){""===this.textValue?this.clearInputField():this.resetSearchToDefault()}static get delegatesFocus(){return!0}get host(){return e(this)}static get watchers(){return{disabled:[{onDisabledChange:0}],value:[{onChangeValue:0}]}}};g.style=":host{position:relative;display:block}:host([hidden]){display:none}";export{g as limel_picker}
|