@chefuicore/core 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/chef-button.d.ts.map +1 -0
- package/dist/components/chef-icon.d.ts.map +1 -0
- package/dist/components/chef-ui-select.d.ts +43 -0
- package/dist/components/chef-ui-select.d.ts.map +1 -0
- package/dist/icons/alert.d.ts.map +1 -0
- package/dist/icons/arrow-left.d.ts.map +1 -0
- package/dist/icons/arrow-right.d.ts.map +1 -0
- package/dist/icons/check.d.ts.map +1 -0
- package/dist/icons/edit.d.ts.map +1 -0
- package/dist/icons/info.d.ts.map +1 -0
- package/dist/icons/lock.d.ts.map +1 -0
- package/dist/icons/plus.d.ts.map +1 -0
- package/dist/icons/save.d.ts.map +1 -0
- package/dist/icons/search.d.ts.map +1 -0
- package/dist/icons/trash.d.ts.map +1 -0
- package/dist/icons/x.d.ts.map +1 -0
- package/dist/index.cjs +307 -10
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +309 -12
- package/dist/index.js.map +1 -0
- package/dist/utils/icon-resolver.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chef-button.d.ts","sourceRoot":"","sources":["../../src/components/chef-button.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAE5C,OAAO,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAEvD,qBACa,UAAW,SAAQ,UAAU;IACtC,MAAM,CAAC,MAAM,0BAgFX;IAE0C,QAAQ,UAAS;IAClB,OAAO,EAAE,OAAO,GAAG,SAAS,CAAW;IAEvC,IAAI,EAAE,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAY;IAC9D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACA,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,QAAQ,CAAC;IAC3D,OAAO,CAAC,kBAAkB;IAQ1B,OAAO,CAAC,WAAW;IA0BnB,MAAM;CAiBT;AAED,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,qBAAqB;QAC3B,aAAa,EAAE,UAAU,CAAC;KAC7B;CACJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chef-icon.d.ts","sourceRoot":"","sources":["../../src/components/chef-icon.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAkB,MAAM,KAAK,CAAC;AAEjD,OAAO,EAAgB,KAAK,QAAQ,EAAE,KAAK,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAErF,qBACa,QAAS,SAAQ,UAAU;IACtC,MAAM,CAAC,MAAM,0BAQX;IAEyC,IAAI,EAAE,QAAQ,CAAU;IACxB,YAAY,EAAE,SAAS,CAAa;IACpC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACL,SAAS,EAAE,MAAM,GAAG,IAAI,CAAQ;IACrF,OAAO;IAKP,OAAO,CAAC,UAAU;IAQlB,MAAM;CAqBP;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,WAAW,EAAE,QAAQ,CAAC;KACvB;CACF"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
import './chef-icon';
|
|
3
|
+
import type { IconName } from '../utils/icon-resolver';
|
|
4
|
+
export interface SelectOption {
|
|
5
|
+
value: string;
|
|
6
|
+
label: string;
|
|
7
|
+
icon?: IconName;
|
|
8
|
+
}
|
|
9
|
+
export declare class ChefUiSelect extends LitElement {
|
|
10
|
+
static styles: import("lit").CSSResult;
|
|
11
|
+
label?: string;
|
|
12
|
+
placeholder: string;
|
|
13
|
+
value: string;
|
|
14
|
+
disabled: boolean;
|
|
15
|
+
invalid: boolean;
|
|
16
|
+
name?: string;
|
|
17
|
+
options: SelectOption[];
|
|
18
|
+
required: boolean;
|
|
19
|
+
searchable: boolean;
|
|
20
|
+
prefixIcon?: IconName;
|
|
21
|
+
searchPlaceholder: string;
|
|
22
|
+
private isOpen;
|
|
23
|
+
private searchQuery;
|
|
24
|
+
private dropdownEl?;
|
|
25
|
+
private searchInputEl?;
|
|
26
|
+
connectedCallback(): void;
|
|
27
|
+
disconnectedCallback(): void;
|
|
28
|
+
private handleOutsideClick;
|
|
29
|
+
private closeDropdown;
|
|
30
|
+
private toggleDropdown;
|
|
31
|
+
private selectOption;
|
|
32
|
+
private handleKeyDown;
|
|
33
|
+
private handleSearchInput;
|
|
34
|
+
private getFilteredOptions;
|
|
35
|
+
private getSelectedOption;
|
|
36
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
37
|
+
}
|
|
38
|
+
declare global {
|
|
39
|
+
interface HTMLElementTagNameMap {
|
|
40
|
+
'chef-ui-select': ChefUiSelect;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=chef-ui-select.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chef-ui-select.d.ts","sourceRoot":"","sources":["../../src/components/chef-ui-select.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAE5C,OAAO,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAEvD,MAAM,WAAW,YAAY;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,QAAQ,CAAC;CACnB;AAED,qBACa,YAAa,SAAQ,UAAU;IACxC,MAAM,CAAC,MAAM,0BAqNX;IAE0B,KAAK,CAAC,EAAE,MAAM,CAAC;IACA,WAAW,SAAyB;IACpC,KAAK,SAAM;IACV,QAAQ,UAAS;IACjB,OAAO,UAAS;IAChC,IAAI,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,YAAY,EAAE,CAAM;IACZ,QAAQ,UAAS;IACjB,UAAU,UAAS;IACnC,UAAU,CAAC,EAAE,QAAQ,CAAC;IACtB,iBAAiB,SAAe;IAEnD,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,WAAW,CAAM;IACd,OAAO,CAAC,UAAU,CAAC,CAAc;IAC7B,OAAO,CAAC,aAAa,CAAC,CAAmB;IAEjE,iBAAiB;IAKjB,oBAAoB;IAKpB,OAAO,CAAC,kBAAkB,CAIxB;IAEF,OAAO,CAAC,aAAa;IAKrB,OAAO,CAAC,cAAc;IAatB,OAAO,CAAC,YAAY;IAiBpB,OAAO,CAAC,aAAa;IA6CrB,OAAO,CAAC,iBAAiB;IAKzB,OAAO,CAAC,kBAAkB;IAS1B,OAAO,CAAC,iBAAiB;IAIzB,MAAM;CA4ET;AAED,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,qBAAqB;QAC3B,gBAAgB,EAAE,YAAY,CAAC;KAClC;CACJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alert.d.ts","sourceRoot":"","sources":["../../src/icons/alert.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACtD,QAAA,MAAM,GAAG,EAAE,OAGV,CAAC;AACF,eAAe,GAAG,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"arrow-left.d.ts","sourceRoot":"","sources":["../../src/icons/arrow-left.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACtD,QAAA,MAAM,GAAG,EAAE,OAGV,CAAC;AACF,eAAe,GAAG,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"arrow-right.d.ts","sourceRoot":"","sources":["../../src/icons/arrow-right.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACtD,QAAA,MAAM,GAAG,EAAE,OAGV,CAAC;AACF,eAAe,GAAG,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check.d.ts","sourceRoot":"","sources":["../../src/icons/check.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACtD,QAAA,MAAM,GAAG,EAAE,OAGV,CAAC;AACF,eAAe,GAAG,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edit.d.ts","sourceRoot":"","sources":["../../src/icons/edit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACtD,QAAA,MAAM,GAAG,EAAE,OAGV,CAAC;AACF,eAAe,GAAG,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"info.d.ts","sourceRoot":"","sources":["../../src/icons/info.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACtD,QAAA,MAAM,GAAG,EAAE,OAGV,CAAC;AACF,eAAe,GAAG,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lock.d.ts","sourceRoot":"","sources":["../../src/icons/lock.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACtD,QAAA,MAAM,GAAG,EAAE,OAGV,CAAC;AACF,eAAe,GAAG,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plus.d.ts","sourceRoot":"","sources":["../../src/icons/plus.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACtD,QAAA,MAAM,GAAG,EAAE,OAGV,CAAC;AACF,eAAe,GAAG,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"save.d.ts","sourceRoot":"","sources":["../../src/icons/save.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACtD,QAAA,MAAM,GAAG,EAAE,OAGV,CAAC;AACF,eAAe,GAAG,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/icons/search.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACtD,QAAA,MAAM,GAAG,EAAE,OAGV,CAAC;AACF,eAAe,GAAG,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trash.d.ts","sourceRoot":"","sources":["../../src/icons/trash.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACtD,QAAA,MAAM,GAAG,EAAE,OAGV,CAAC;AACF,eAAe,GAAG,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"x.d.ts","sourceRoot":"","sources":["../../src/icons/x.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACtD,QAAA,MAAM,GAAG,EAAE,OAGV,CAAC;AACF,eAAe,GAAG,CAAC"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,37 +1,53 @@
|
|
|
1
|
-
"use strict";function t(t,e,s
|
|
1
|
+
"use strict";function t(t,e,i,s){var o,r=arguments.length,n=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,i,s);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(n=(r<3?o(n):r>3?o(e,i,n):o(e,i))||n);return r>3&&n&&Object.defineProperty(e,i,n),n}"function"==typeof SuppressedError&&SuppressedError;
|
|
2
2
|
/**
|
|
3
3
|
* @license
|
|
4
4
|
* Copyright 2019 Google LLC
|
|
5
5
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
6
6
|
*/
|
|
7
|
-
const e=globalThis,
|
|
7
|
+
const e=globalThis,i=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s=Symbol(),o=new WeakMap;let r=class{constructor(t,e,i){if(this._$cssResult$=!0,i!==s)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(i&&void 0===t){const i=void 0!==e&&1===e.length;i&&(t=o.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&o.set(e,t))}return t}toString(){return this.cssText}};const n=(t,...e)=>{const i=1===t.length?t[0]:e.reduce((e,i,s)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+t[s+1],t[0]);return new r(i,t,s)},a=i?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return(t=>new r("string"==typeof t?t:t+"",void 0,s))(e)})(t):t,{is:l,defineProperty:h,getOwnPropertyDescriptor:c,getOwnPropertyNames:p,getOwnPropertySymbols:d,getPrototypeOf:u}=Object,f=globalThis,v=f.trustedTypes,g=v?v.emptyScript:"",b=f.reactiveElementPolyfillSupport,y=(t,e)=>t,$={toAttribute(t,e){switch(e){case Boolean:t=t?g:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch(t){i=null}}return i}},m=(t,e)=>!l(t,e),x={attribute:!0,type:String,converter:$,reflect:!1,useDefault:!1,hasChanged:m};
|
|
8
8
|
/**
|
|
9
9
|
* @license
|
|
10
10
|
* Copyright 2017 Google LLC
|
|
11
11
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
12
|
-
*/Symbol.metadata??=Symbol("metadata"),f.litPropertyMetadata??=new WeakMap;let
|
|
12
|
+
*/Symbol.metadata??=Symbol("metadata"),f.litPropertyMetadata??=new WeakMap;let _=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=x){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){const i=Symbol(),s=this.getPropertyDescriptor(t,i,e);void 0!==s&&h(this.prototype,t,s)}}static getPropertyDescriptor(t,e,i){const{get:s,set:o}=c(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get:s,set(e){const r=s?.call(this);o?.call(this,e),this.requestUpdate(t,r,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??x}static _$Ei(){if(this.hasOwnProperty(y("elementProperties")))return;const t=u(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(y("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(y("properties"))){const t=this.properties,e=[...p(t),...d(t)];for(const i of e)this.createProperty(i,t[i])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,i]of e)this.elementProperties.set(t,i)}this._$Eh=new Map;for(const[t,e]of this.elementProperties){const i=this._$Eu(t,e);void 0!==i&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const t of i)e.unshift(a(t))}else void 0!==t&&e.push(a(t));return e}static _$Eu(t,e){const i=e.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const i of e.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((t,s)=>{if(i)t.adoptedStyleSheets=s.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const i of s){const s=document.createElement("style"),o=e.litNonce;void 0!==o&&s.setAttribute("nonce",o),s.textContent=i.cssText,t.appendChild(s)}})(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$ET(t,e){const i=this.constructor.elementProperties.get(t),s=this.constructor._$Eu(t,i);if(void 0!==s&&!0===i.reflect){const o=(void 0!==i.converter?.toAttribute?i.converter:$).toAttribute(e,i.type);this._$Em=t,null==o?this.removeAttribute(s):this.setAttribute(s,o),this._$Em=null}}_$AK(t,e){const i=this.constructor,s=i._$Eh.get(t);if(void 0!==s&&this._$Em!==s){const t=i.getPropertyOptions(s),o="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:$;this._$Em=s;const r=o.fromAttribute(e,t.type);this[s]=r??this._$Ej?.get(s)??r,this._$Em=null}}requestUpdate(t,e,i){if(void 0!==t){const s=this.constructor,o=this[t];if(i??=s.getPropertyOptions(t),!((i.hasChanged??m)(o,e)||i.useDefault&&i.reflect&&o===this._$Ej?.get(t)&&!this.hasAttribute(s._$Eu(t,i))))return;this.C(t,e,i)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(t,e,{useDefault:i,reflect:s,wrapped:o},r){i&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,r??e??this[t]),!0!==o||void 0!==r)||(this._$AL.has(t)||(this.hasUpdated||i||(e=void 0),this._$AL.set(t,e)),!0===s&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,e]of this._$Ep)this[t]=e;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[e,i]of t){const{wrapped:t}=i,s=this[e];!0!==t||this._$AL.has(e)||void 0===s||this.C(e,void 0,i,s)}}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(t=>t.hostUpdate?.()),this.update(e)):this._$EM()}catch(e){throw t=!1,this._$EM(),e}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach(t=>this._$ET(t,this[t])),this._$EM()}updated(t){}firstUpdated(t){}};_.elementStyles=[],_.shadowRootOptions={mode:"open"},_[y("elementProperties")]=new Map,_[y("finalized")]=new Map,b?.({ReactiveElement:_}),(f.reactiveElementVersions??=[]).push("2.1.1");
|
|
13
13
|
/**
|
|
14
14
|
* @license
|
|
15
15
|
* Copyright 2017 Google LLC
|
|
16
16
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
17
17
|
*/
|
|
18
|
-
const
|
|
18
|
+
const A=globalThis,w=A.trustedTypes,S=w?w.createPolicy("lit-html",{createHTML:t=>t}):void 0,C="$lit$",E=`lit$${Math.random().toFixed(9).slice(2)}$`,k="?"+E,M=`<${k}>`,O=document,P=()=>O.createComment(""),U=t=>null===t||"object"!=typeof t&&"function"!=typeof t,H=Array.isArray,z="[ \t\n\f\r]",R=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,T=/-->/g,D=/>/g,I=RegExp(`>|${z}(?:([^\\s"'>=/]+)(${z}*=${z}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),L=/'/g,N=/"/g,B=/^(?:script|style|textarea|title)$/i,j=t=>(e,...i)=>({_$litType$:t,strings:e,values:i}),V=j(1),Z=j(2),q=Symbol.for("lit-noChange"),F=Symbol.for("lit-nothing"),W=new WeakMap,Q=O.createTreeWalker(O,129);function K(t,e){if(!H(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==S?S.createHTML(e):e}const Y=(t,e)=>{const i=t.length-1,s=[];let o,r=2===e?"<svg>":3===e?"<math>":"",n=R;for(let e=0;e<i;e++){const i=t[e];let a,l,h=-1,c=0;for(;c<i.length&&(n.lastIndex=c,l=n.exec(i),null!==l);)c=n.lastIndex,n===R?"!--"===l[1]?n=T:void 0!==l[1]?n=D:void 0!==l[2]?(B.test(l[2])&&(o=RegExp("</"+l[2],"g")),n=I):void 0!==l[3]&&(n=I):n===I?">"===l[0]?(n=o??R,h=-1):void 0===l[1]?h=-2:(h=n.lastIndex-l[2].length,a=l[1],n=void 0===l[3]?I:'"'===l[3]?N:L):n===N||n===L?n=I:n===T||n===D?n=R:(n=I,o=void 0);const p=n===I&&t[e+1].startsWith("/>")?" ":"";r+=n===R?i+M:h>=0?(s.push(a),i.slice(0,h)+C+i.slice(h)+E+p):i+E+(-2===h?e:p)}return[K(t,r+(t[i]||"<?>")+(2===e?"</svg>":3===e?"</math>":"")),s]};class J{constructor({strings:t,_$litType$:e},i){let s;this.parts=[];let o=0,r=0;const n=t.length-1,a=this.parts,[l,h]=Y(t,e);if(this.el=J.createElement(l,i),Q.currentNode=this.el.content,2===e||3===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(s=Q.nextNode())&&a.length<n;){if(1===s.nodeType){if(s.hasAttributes())for(const t of s.getAttributeNames())if(t.endsWith(C)){const e=h[r++],i=s.getAttribute(t).split(E),n=/([.?@])?(.*)/.exec(e);a.push({type:1,index:o,name:n[2],strings:i,ctor:"."===n[1]?it:"?"===n[1]?st:"@"===n[1]?ot:et}),s.removeAttribute(t)}else t.startsWith(E)&&(a.push({type:6,index:o}),s.removeAttribute(t));if(B.test(s.tagName)){const t=s.textContent.split(E),e=t.length-1;if(e>0){s.textContent=w?w.emptyScript:"";for(let i=0;i<e;i++)s.append(t[i],P()),Q.nextNode(),a.push({type:2,index:++o});s.append(t[e],P())}}}else if(8===s.nodeType)if(s.data===k)a.push({type:2,index:o});else{let t=-1;for(;-1!==(t=s.data.indexOf(E,t+1));)a.push({type:7,index:o}),t+=E.length-1}o++}}static createElement(t,e){const i=O.createElement("template");return i.innerHTML=t,i}}function G(t,e,i=t,s){if(e===q)return e;let o=void 0!==s?i._$Co?.[s]:i._$Cl;const r=U(e)?void 0:e._$litDirective$;return o?.constructor!==r&&(o?._$AO?.(!1),void 0===r?o=void 0:(o=new r(t),o._$AT(t,i,s)),void 0!==s?(i._$Co??=[])[s]=o:i._$Cl=o),void 0!==o&&(e=G(t,o._$AS(t,e.values),o,s)),e}class X{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:i}=this._$AD,s=(t?.creationScope??O).importNode(e,!0);Q.currentNode=s;let o=Q.nextNode(),r=0,n=0,a=i[0];for(;void 0!==a;){if(r===a.index){let e;2===a.type?e=new tt(o,o.nextSibling,this,t):1===a.type?e=new a.ctor(o,a.name,a.strings,this,t):6===a.type&&(e=new rt(o,this,t)),this._$AV.push(e),a=i[++n]}r!==a?.index&&(o=Q.nextNode(),r++)}return Q.currentNode=O,s}p(t){let e=0;for(const i of this._$AV)void 0!==i&&(void 0!==i.strings?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}}class tt{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,i,s){this.type=2,this._$AH=F,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=s,this._$Cv=s?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===t?.nodeType&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=G(this,t,e),U(t)?t===F||null==t||""===t?(this._$AH!==F&&this._$AR(),this._$AH=F):t!==this._$AH&&t!==q&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):(t=>H(t)||"function"==typeof t?.[Symbol.iterator])(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==F&&U(this._$AH)?this._$AA.nextSibling.data=t:this.T(O.createTextNode(t)),this._$AH=t}$(t){const{values:e,_$litType$:i}=t,s="number"==typeof i?this._$AC(t):(void 0===i.el&&(i.el=J.createElement(K(i.h,i.h[0]),this.options)),i);if(this._$AH?._$AD===s)this._$AH.p(e);else{const t=new X(s,this),i=t.u(this.options);t.p(e),this.T(i),this._$AH=t}}_$AC(t){let e=W.get(t.strings);return void 0===e&&W.set(t.strings,e=new J(t)),e}k(t){H(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,s=0;for(const o of t)s===e.length?e.push(i=new tt(this.O(P()),this.O(P()),this,this.options)):i=e[s],i._$AI(o),s++;s<e.length&&(this._$AR(i&&i._$AB.nextSibling,s),e.length=s)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t))}}class et{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,i,s,o){this.type=1,this._$AH=F,this._$AN=void 0,this.element=t,this.name=e,this._$AM=s,this.options=o,i.length>2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=F}_$AI(t,e=this,i,s){const o=this.strings;let r=!1;if(void 0===o)t=G(this,t,e,0),r=!U(t)||t!==this._$AH&&t!==q,r&&(this._$AH=t);else{const s=t;let n,a;for(t=o[0],n=0;n<o.length-1;n++)a=G(this,s[i+n],e,n),a===q&&(a=this._$AH[n]),r||=!U(a)||a!==this._$AH[n],a===F?t=F:t!==F&&(t+=(a??"")+o[n+1]),this._$AH[n]=a}r&&!s&&this.j(t)}j(t){t===F?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class it extends et{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===F?void 0:t}}class st extends et{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==F)}}class ot extends et{constructor(t,e,i,s,o){super(t,e,i,s,o),this.type=5}_$AI(t,e=this){if((t=G(this,t,e,0)??F)===q)return;const i=this._$AH,s=t===F&&i!==F||t.capture!==i.capture||t.once!==i.once||t.passive!==i.passive,o=t!==F&&(i===F||s);s&&this.element.removeEventListener(this.name,this,i),o&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}}class rt{constructor(t,e,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){G(this,t)}}const nt=A.litHtmlPolyfillSupport;nt?.(J,tt),(A.litHtmlVersions??=[]).push("3.3.1");const at=globalThis;
|
|
19
19
|
/**
|
|
20
20
|
* @license
|
|
21
21
|
* Copyright 2017 Google LLC
|
|
22
22
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
23
|
-
*/class
|
|
23
|
+
*/class lt extends _{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=((t,e,i)=>{const s=i?.renderBefore??e;let o=s._$litPart$;if(void 0===o){const t=i?.renderBefore??null;s._$litPart$=o=new tt(e.insertBefore(P(),t),t,void 0,i??{})}return o._$AI(t),o})(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return q}}lt._$litElement$=!0,lt.finalized=!0,at.litElementHydrateSupport?.({LitElement:lt});const ht=at.litElementPolyfillSupport;ht?.({LitElement:lt}),(at.litElementVersions??=[]).push("4.2.1");
|
|
24
24
|
/**
|
|
25
25
|
* @license
|
|
26
26
|
* Copyright 2017 Google LLC
|
|
27
27
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
28
28
|
*/
|
|
29
|
-
const ct=t=>(e,
|
|
29
|
+
const ct=t=>(e,i)=>{void 0!==i?i.addInitializer(()=>{customElements.define(t,e)}):customElements.define(t,e)},pt={attribute:!0,type:String,converter:$,reflect:!1,hasChanged:m},dt=(t=pt,e,i)=>{const{kind:s,metadata:o}=i;let r=globalThis.litPropertyMetadata.get(o);if(void 0===r&&globalThis.litPropertyMetadata.set(o,r=new Map),"setter"===s&&((t=Object.create(t)).wrapped=!0),r.set(i.name,t),"accessor"===s){const{name:s}=i;return{set(i){const o=e.get.call(this);e.set.call(this,i),this.requestUpdate(s,o,t)},init(e){return void 0!==e&&this.C(s,void 0,t,e),e}}}if("setter"===s){const{name:s}=i;return function(i){const o=this[s];e.call(this,i),this.requestUpdate(s,o,t)}}throw Error("Unsupported decorator location: "+s)};
|
|
30
30
|
/**
|
|
31
31
|
* @license
|
|
32
32
|
* Copyright 2017 Google LLC
|
|
33
33
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
34
|
-
*/function ut(t){return(e,
|
|
34
|
+
*/function ut(t){return(e,i)=>"object"==typeof i?dt(t,e,i):((t,e,i)=>{const s=e.hasOwnProperty(i);return e.constructor.createProperty(i,t),s?Object.getOwnPropertyDescriptor(e,i):void 0})(t,e,i)}
|
|
35
|
+
/**
|
|
36
|
+
* @license
|
|
37
|
+
* Copyright 2017 Google LLC
|
|
38
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
39
|
+
*/function ft(t){return ut({...t,state:!0,attribute:!1})}
|
|
40
|
+
/**
|
|
41
|
+
* @license
|
|
42
|
+
* Copyright 2017 Google LLC
|
|
43
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
44
|
+
*/
|
|
45
|
+
/**
|
|
46
|
+
* @license
|
|
47
|
+
* Copyright 2017 Google LLC
|
|
48
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
49
|
+
*/
|
|
50
|
+
function vt(t,e){return(e,i,s)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Reflect.decorate&&"object"!=typeof e&&Object.defineProperty(t,e,i),i))(e,i,{get(){return(e=>e.renderRoot?.querySelector(t)??null)(this)}})}class gt{constructor(){this.registry=new Map}register(t,e){this.registry.set(t,e)}resolve(t){return this.registry.get(t)}has(t){return this.registry.has(t)}list(){return Array.from(this.registry.keys()).sort()}}const bt=new gt;bt.register("plus",{outline:"M12 4v16M4 12h16",solid:"M11 4h2v7h7v2h-7v7h-2v-7H4v-2h7z"}),bt.register("check",{outline:"m5 13 4 4L19 7",solid:"M10 15.172 5.414 10.586 4 12l6 6L20 8l-1.414-1.414z"}),bt.register("x",{outline:"M6 6l12 12M6 18L18 6",solid:"M6 6l12 12M6 18L18 6"}),bt.register("trash",{outline:"M3 6h18M8 6V4h8v2m-1 0v12a2 2 0 0 1-2 2H9a2 2 0 0 1-2-2V6h10Z",solid:"M7 6h10v11a3 3 0 0 1-3 3H10a3 3 0 0 1-3-3V6Zm2-4h6v2H9z"}),bt.register("lock",{outline:"M7 10V7a5 5 0 0 1 10 0v3m-9 0h8a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2v-6a2 2 0 0 1 2-2Z",solid:"M12 1a6 6 0 0 1 6 6v3h1a2 2 0 0 1 2 2v7a3 3 0 0 1-3 3H6a3 3 0 0 1-3-3v-7a2 2 0 0 1 2-2h1V7a6 6 0 0 1 6-6Z"}),bt.register("alert",{outline:"M12 9v4m0 4h.01M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0Z",solid:"M11 7h2v6h-2zm0 8h2v2h-2z"}),bt.register("info",{outline:"M12 8h.01M11 12h2v6h-2zm9 0a8 8 0 1 1-16 0 8 8 0 0 1 16 0Z",solid:"M12 2a10 10 0 1 1 0 20 10 10 0 0 1 0-20Zm-1 8h2V7h-2v3Zm0 7h2v-6h-2v6Z"}),bt.register("edit",{outline:"M4 21h4l11-11a2.828 2.828 0 1 0-4-4L4 17v4Z",solid:"M3 17.25 16.06 4.19l3.75 3.75L6.75 21H3v-3.75Z"}),bt.register("search",{outline:"m21 21-4.35-4.35M10 18a8 8 0 1 1 0-16 8 8 0 0 1 0 16Z",solid:"M15.5 14h-.79l-.28-.27A6.471 6.471 0 0 0 16 9.5 6.5 6.5 0 1 0 9.5 16a6.471 6.471 0 0 0 4.23-1.57l.27.28v.79L20 21.5 21.5 20 15.5 14z"}),bt.register("save",{outline:"M5 5h10l4 4v10a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V5zm8 0v6H7V5",solid:"M17 3H5a2 2 0 0 0-2 2v16l4-4h10a2 2 0 0 0 2-2V7l-4-4z"}),bt.register("arrow-right",{outline:"M5 12h14M13 5l7 7-7 7",solid:"M10 5l7 7-7 7V5z"}),bt.register("arrow-left",{outline:"M19 12H5m6 7-7-7 7-7",solid:"M14 19l-7-7 7-7v14z"}),exports.ChefIcon=class extends lt{constructor(){super(...arguments),this.name="info",this.styleVariant="outline",this.ariaLabel=null}updated(){this.size&&this.style.setProperty("--chefui-icon-size",this.size),this.color&&this.style.setProperty("--chefui-icon-color",this.color)}renderPath(){const t=bt.resolve(this.name);if(!t)return null;const e="solid"===this.styleVariant&&!!t.solid?t.solid:t.outline;return Z`<path d="${e}" />`}render(){const t=bt.resolve(this.name),e="solid"===this.styleVariant&&!!t?.solid;return V`
|
|
35
51
|
<svg
|
|
36
52
|
part="icon"
|
|
37
53
|
xmlns="http://www.w3.org/2000/svg"
|
|
@@ -52,7 +68,7 @@ const ct=t=>(e,s)=>{void 0!==s?s.addInitializer(()=>{customElements.define(t,e)}
|
|
|
52
68
|
line-height: 0;
|
|
53
69
|
}
|
|
54
70
|
svg { width: var(--chefui-icon-size); height: var(--chefui-icon-size); stroke-linecap: round; stroke-linejoin: round; }
|
|
55
|
-
`,t([ut({type:String,reflect:!0})],exports.ChefIcon.prototype,"name",void 0),t([ut({type:String,reflect:!0})],exports.ChefIcon.prototype,"styleVariant",void 0),t([ut({type:String,reflect:!0})],exports.ChefIcon.prototype,"size",void 0),t([ut({type:String,reflect:!0})],exports.ChefIcon.prototype,"color",void 0),t([ut({type:String,attribute:"aria-label"})],exports.ChefIcon.prototype,"ariaLabel",void 0),exports.ChefIcon=t([ct("chef-icon")],exports.ChefIcon),exports.ChefButton=class extends
|
|
71
|
+
`,t([ut({type:String,reflect:!0})],exports.ChefIcon.prototype,"name",void 0),t([ut({type:String,reflect:!0})],exports.ChefIcon.prototype,"styleVariant",void 0),t([ut({type:String,reflect:!0})],exports.ChefIcon.prototype,"size",void 0),t([ut({type:String,reflect:!0})],exports.ChefIcon.prototype,"color",void 0),t([ut({type:String,attribute:"aria-label"})],exports.ChefIcon.prototype,"ariaLabel",void 0),exports.ChefIcon=t([ct("chef-icon")],exports.ChefIcon),exports.ChefButton=class extends lt{constructor(){super(...arguments),this.disabled=!1,this.variant="solid",this.type="button"}findAssociatedForm(){if(this.form){const t=this.ownerDocument.getElementById(this.form);if(t&&t instanceof HTMLFormElement)return t}return this.closest("form")}handleClick(t){if(this.disabled)return t.stopImmediatePropagation(),void t.preventDefault();this.dispatchEvent(new CustomEvent("chef-click",{bubbles:!0,composed:!0}));const e=this.findAssociatedForm();if(e)if("submit"===this.type){const t=document.createElement("button");t.type="submit",this.name&&(t.name=this.name),null!=this.value&&(t.value=this.value),t.hidden=!0,e.appendChild(t),t.click(),e.removeChild(t)}else"reset"===this.type&&e.reset()}render(){return V`
|
|
56
72
|
<button
|
|
57
73
|
type="button"
|
|
58
74
|
?disabled=${this.disabled}
|
|
@@ -62,7 +78,7 @@ const ct=t=>(e,s)=>{void 0!==s?s.addInitializer(()=>{customElements.define(t,e)}
|
|
|
62
78
|
part="button"
|
|
63
79
|
>
|
|
64
80
|
<slot name="icon">
|
|
65
|
-
${this.icon?
|
|
81
|
+
${this.icon?V`<chef-icon class="icon-fallback" name=${this.icon}></chef-icon>`:null}
|
|
66
82
|
</slot>
|
|
67
83
|
<slot></slot>
|
|
68
84
|
</button>
|
|
@@ -146,5 +162,286 @@ const ct=t=>(e,s)=>{void 0!==s?s.addInitializer(()=>{customElements.define(t,e)}
|
|
|
146
162
|
height: 1.1em;
|
|
147
163
|
display: inline-flex;
|
|
148
164
|
}
|
|
149
|
-
`,t([ut({type:Boolean,reflect:!0})],exports.ChefButton.prototype,"disabled",void 0),t([ut({type:String,reflect:!0})],exports.ChefButton.prototype,"variant",void 0),t([ut({type:String,reflect:!0})],exports.ChefButton.prototype,"type",void 0),t([ut({type:String})],exports.ChefButton.prototype,"name",void 0),t([ut({type:String})],exports.ChefButton.prototype,"value",void 0),t([ut({type:String,reflect:!0})],exports.ChefButton.prototype,"form",void 0),t([ut({type:String,reflect:!0})],exports.ChefButton.prototype,"icon",void 0),exports.ChefButton=t([ct("chef-button")],exports.ChefButton),exports.
|
|
165
|
+
`,t([ut({type:Boolean,reflect:!0})],exports.ChefButton.prototype,"disabled",void 0),t([ut({type:String,reflect:!0})],exports.ChefButton.prototype,"variant",void 0),t([ut({type:String,reflect:!0})],exports.ChefButton.prototype,"type",void 0),t([ut({type:String})],exports.ChefButton.prototype,"name",void 0),t([ut({type:String})],exports.ChefButton.prototype,"value",void 0),t([ut({type:String,reflect:!0})],exports.ChefButton.prototype,"form",void 0),t([ut({type:String,reflect:!0})],exports.ChefButton.prototype,"icon",void 0),exports.ChefButton=t([ct("chef-button")],exports.ChefButton),exports.ChefUiSelect=class extends lt{constructor(){super(...arguments),this.placeholder="Select an option...",this.value="",this.disabled=!1,this.invalid=!1,this.options=[],this.required=!1,this.searchable=!1,this.searchPlaceholder="Search...",this.isOpen=!1,this.searchQuery="",this.handleOutsideClick=t=>{this.contains(t.target)||this.closeDropdown()}}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this.handleOutsideClick)}disconnectedCallback(){document.removeEventListener("click",this.handleOutsideClick),super.disconnectedCallback()}closeDropdown(){this.isOpen=!1,this.searchQuery=""}toggleDropdown(t){t.stopPropagation(),this.disabled||(this.isOpen=!this.isOpen,this.isOpen&&this.searchable&&setTimeout(()=>{this.searchInputEl?.focus()},100))}selectOption(t,e){if(e.stopPropagation(),this.disabled)return;const i=this.value;this.value=t,this.closeDropdown(),this.dispatchEvent(new CustomEvent("chef-change",{detail:{value:this.value,oldValue:i},bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}handleKeyDown(t){if(!this.disabled)switch(t.key){case"Enter":case" ":if(t.target.classList.contains("search-input"))return;t.preventDefault(),this.toggleDropdown(t);break;case"Escape":t.preventDefault(),this.closeDropdown();break;case"ArrowDown":if(t.preventDefault(),this.isOpen){const t=this.getFilteredOptions(),e=t.findIndex(t=>t.value===this.value),i=Math.min(e+1,t.length-1);i>=0&&t[i]&&(this.value=t[i].value)}else this.isOpen=!0;break;case"ArrowUp":if(t.preventDefault(),this.isOpen){const t=this.getFilteredOptions(),e=t.findIndex(t=>t.value===this.value),i=Math.max(e-1,0);i>=0&&t[i]&&(this.value=t[i].value)}else this.isOpen=!0}}handleSearchInput(t){const e=t.target;this.searchQuery=e.value.toLowerCase()}getFilteredOptions(){return this.searchQuery?this.options.filter(t=>t.label.toLowerCase().includes(this.searchQuery)||t.value.toLowerCase().includes(this.searchQuery)):this.options}getSelectedOption(){return this.options.find(t=>t.value===this.value)}render(){const t=this.getSelectedOption(),e=this.getFilteredOptions();return V`
|
|
166
|
+
<div class="wrapper">
|
|
167
|
+
${this.label?V`<label class="label">${this.label}</label>`:null}
|
|
168
|
+
|
|
169
|
+
<button
|
|
170
|
+
class="select-button"
|
|
171
|
+
type="button"
|
|
172
|
+
role="combobox"
|
|
173
|
+
aria-expanded=${this.isOpen}
|
|
174
|
+
aria-haspopup="listbox"
|
|
175
|
+
aria-disabled=${this.disabled}
|
|
176
|
+
?disabled=${this.disabled}
|
|
177
|
+
@click=${this.toggleDropdown}
|
|
178
|
+
@keydown=${this.handleKeyDown}
|
|
179
|
+
part="button"
|
|
180
|
+
>
|
|
181
|
+
<div class="selected-value ${t?"":"placeholder"}">
|
|
182
|
+
${this.prefixIcon?V`
|
|
183
|
+
<chef-icon class="prefix-icon" name=${this.prefixIcon}></chef-icon>
|
|
184
|
+
`:null}
|
|
185
|
+
${t?.icon?V`
|
|
186
|
+
<chef-icon class="option-icon" name=${t.icon}></chef-icon>
|
|
187
|
+
`:null}
|
|
188
|
+
<span>${t?.label||this.placeholder}</span>
|
|
189
|
+
</div>
|
|
190
|
+
<chef-icon class="chevron-icon ${this.isOpen?"open":""}" name="chevron-down"></chef-icon>
|
|
191
|
+
</button>
|
|
192
|
+
|
|
193
|
+
<div class="dropdown ${this.isOpen?"open":""}" role="listbox" part="dropdown">
|
|
194
|
+
${this.searchable?V`
|
|
195
|
+
<div class="search-wrapper">
|
|
196
|
+
<div class="search-icon-wrapper">
|
|
197
|
+
<chef-icon class="search-icon" name="search"></chef-icon>
|
|
198
|
+
<input
|
|
199
|
+
class="search-input"
|
|
200
|
+
type="text"
|
|
201
|
+
placeholder=${this.searchPlaceholder}
|
|
202
|
+
@input=${this.handleSearchInput}
|
|
203
|
+
@keydown=${t=>{"Enter"===t.key&&t.preventDefault()}}
|
|
204
|
+
/>
|
|
205
|
+
</div>
|
|
206
|
+
</div>
|
|
207
|
+
`:null}
|
|
208
|
+
|
|
209
|
+
${e.length>0?V`
|
|
210
|
+
${e.map(t=>V`
|
|
211
|
+
<div
|
|
212
|
+
class="option"
|
|
213
|
+
role="option"
|
|
214
|
+
aria-selected=${t.value===this.value}
|
|
215
|
+
@click=${e=>this.selectOption(t.value,e)}
|
|
216
|
+
part="option"
|
|
217
|
+
>
|
|
218
|
+
${t.icon?V`
|
|
219
|
+
<chef-icon class="option-icon" name=${t.icon}></chef-icon>
|
|
220
|
+
`:null}
|
|
221
|
+
<span>${t.label}</span>
|
|
222
|
+
</div>
|
|
223
|
+
`)}
|
|
224
|
+
`:V`
|
|
225
|
+
<div class="no-results">No results found</div>
|
|
226
|
+
`}
|
|
227
|
+
</div>
|
|
228
|
+
|
|
229
|
+
<div class="validation-message">
|
|
230
|
+
<slot name="validation-message"></slot>
|
|
231
|
+
</div>
|
|
232
|
+
</div>
|
|
233
|
+
`}},exports.ChefUiSelect.styles=n`
|
|
234
|
+
:host {
|
|
235
|
+
display: block;
|
|
236
|
+
--chefui-color: #7c3aed;
|
|
237
|
+
--chefui-color-hover: #6d28d9;
|
|
238
|
+
--chefui-color-active: #5b21b6;
|
|
239
|
+
--chefui-border: #334155;
|
|
240
|
+
--chefui-bg: #1e293b;
|
|
241
|
+
--chefui-text: #e2e8f0;
|
|
242
|
+
--chefui-text-muted: #94a3b8;
|
|
243
|
+
--chefui-focus-ring: 0 0 0 3px color-mix(in srgb, var(--chefui-color) 35%, transparent);
|
|
244
|
+
--chefui-radius: 8px;
|
|
245
|
+
--chefui-transition: 140ms ease;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
.wrapper {
|
|
249
|
+
position: relative;
|
|
250
|
+
width: 100%;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
.label {
|
|
254
|
+
display: block;
|
|
255
|
+
margin-bottom: 6px;
|
|
256
|
+
color: var(--chefui-text);
|
|
257
|
+
font-weight: 500;
|
|
258
|
+
font-size: 14px;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
.select-button {
|
|
262
|
+
all: unset;
|
|
263
|
+
display: flex;
|
|
264
|
+
align-items: center;
|
|
265
|
+
justify-content: space-between;
|
|
266
|
+
width: 100%;
|
|
267
|
+
padding: 10px 12px;
|
|
268
|
+
background: var(--chefui-bg);
|
|
269
|
+
border: 1.5px solid var(--chefui-border);
|
|
270
|
+
border-radius: var(--chefui-radius);
|
|
271
|
+
color: var(--chefui-text);
|
|
272
|
+
cursor: pointer;
|
|
273
|
+
user-select: none;
|
|
274
|
+
transition: border-color var(--chefui-transition), box-shadow var(--chefui-transition);
|
|
275
|
+
box-sizing: border-box;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
.select-button:hover {
|
|
279
|
+
border-color: color-mix(in srgb, var(--chefui-color) 40%, var(--chefui-border));
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
.select-button:focus-visible {
|
|
283
|
+
outline: none;
|
|
284
|
+
box-shadow: var(--chefui-focus-ring);
|
|
285
|
+
border-color: var(--chefui-color);
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
.select-button[aria-expanded="true"] {
|
|
289
|
+
border-color: var(--chefui-color);
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
:host([disabled]) .select-button {
|
|
293
|
+
opacity: 0.55;
|
|
294
|
+
cursor: not-allowed;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
:host([invalid]) .select-button {
|
|
298
|
+
border-color: #ef4444;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
.placeholder {
|
|
302
|
+
color: var(--chefui-text-muted);
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
.selected-value {
|
|
306
|
+
flex: 1;
|
|
307
|
+
display: flex;
|
|
308
|
+
align-items: center;
|
|
309
|
+
gap: 8px;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
.chevron-icon {
|
|
313
|
+
margin-left: 8px;
|
|
314
|
+
transition: transform var(--chefui-transition);
|
|
315
|
+
width: 16px;
|
|
316
|
+
height: 16px;
|
|
317
|
+
display: flex;
|
|
318
|
+
align-items: center;
|
|
319
|
+
justify-content: center;
|
|
320
|
+
flex-shrink: 0;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
.chevron-icon.open {
|
|
324
|
+
transform: rotate(180deg);
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
.prefix-icon {
|
|
328
|
+
width: 16px;
|
|
329
|
+
height: 16px;
|
|
330
|
+
display: flex;
|
|
331
|
+
align-items: center;
|
|
332
|
+
justify-content: center;
|
|
333
|
+
flex-shrink: 0;
|
|
334
|
+
color: var(--chefui-text-muted);
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
.dropdown {
|
|
338
|
+
position: absolute;
|
|
339
|
+
top: calc(100% + 4px);
|
|
340
|
+
left: 0;
|
|
341
|
+
right: 0;
|
|
342
|
+
background: var(--chefui-bg);
|
|
343
|
+
border: 1.5px solid var(--chefui-border);
|
|
344
|
+
border-radius: var(--chefui-radius);
|
|
345
|
+
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3), 0 20px 48px rgba(0, 0, 0, 0.2);
|
|
346
|
+
max-height: 250px;
|
|
347
|
+
overflow-y: auto;
|
|
348
|
+
z-index: 1000;
|
|
349
|
+
display: none;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
.dropdown.open {
|
|
353
|
+
display: block;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
.search-wrapper {
|
|
357
|
+
padding: 8px;
|
|
358
|
+
border-bottom: 1px solid var(--chefui-border);
|
|
359
|
+
position: sticky;
|
|
360
|
+
top: 0;
|
|
361
|
+
background: var(--chefui-bg);
|
|
362
|
+
z-index: 1;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
.search-input {
|
|
366
|
+
width: 100%;
|
|
367
|
+
padding: 8px 10px 8px 32px;
|
|
368
|
+
background: rgba(0, 0, 0, 0.2);
|
|
369
|
+
border: 1px solid var(--chefui-border);
|
|
370
|
+
border-radius: 6px;
|
|
371
|
+
color: var(--chefui-text);
|
|
372
|
+
font-size: 14px;
|
|
373
|
+
outline: none;
|
|
374
|
+
transition: border-color var(--chefui-transition);
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
.search-input:focus {
|
|
378
|
+
border-color: var(--chefui-color);
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
.search-icon-wrapper {
|
|
382
|
+
position: relative;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
.search-icon {
|
|
386
|
+
position: absolute;
|
|
387
|
+
left: 16px;
|
|
388
|
+
top: 50%;
|
|
389
|
+
transform: translateY(-50%);
|
|
390
|
+
width: 14px;
|
|
391
|
+
height: 14px;
|
|
392
|
+
color: var(--chefui-text-muted);
|
|
393
|
+
pointer-events: none;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
.option {
|
|
397
|
+
padding: 10px 12px;
|
|
398
|
+
cursor: pointer;
|
|
399
|
+
color: var(--chefui-text);
|
|
400
|
+
transition: background-color var(--chefui-transition);
|
|
401
|
+
user-select: none;
|
|
402
|
+
display: flex;
|
|
403
|
+
align-items: center;
|
|
404
|
+
gap: 8px;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
.option:hover {
|
|
408
|
+
background: color-mix(in srgb, var(--chefui-color) 15%, transparent);
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
.option[aria-selected="true"] {
|
|
412
|
+
background: color-mix(in srgb, var(--chefui-color) 25%, transparent);
|
|
413
|
+
font-weight: 500;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
.option:active {
|
|
417
|
+
background: color-mix(in srgb, var(--chefui-color) 35%, transparent);
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
.option-icon {
|
|
421
|
+
width: 16px;
|
|
422
|
+
height: 16px;
|
|
423
|
+
display: flex;
|
|
424
|
+
align-items: center;
|
|
425
|
+
justify-content: center;
|
|
426
|
+
flex-shrink: 0;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
.no-results {
|
|
430
|
+
padding: 20px;
|
|
431
|
+
text-align: center;
|
|
432
|
+
color: var(--chefui-text-muted);
|
|
433
|
+
font-size: 14px;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
.validation-message {
|
|
437
|
+
margin-top: 6px;
|
|
438
|
+
font-size: 13px;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
::slotted([slot="validation-message"]) {
|
|
442
|
+
display: block;
|
|
443
|
+
margin-top: 6px;
|
|
444
|
+
font-size: 13px;
|
|
445
|
+
}
|
|
446
|
+
`,t([ut({type:String})],exports.ChefUiSelect.prototype,"label",void 0),t([ut({type:String,reflect:!0})],exports.ChefUiSelect.prototype,"placeholder",void 0),t([ut({type:String,reflect:!0})],exports.ChefUiSelect.prototype,"value",void 0),t([ut({type:Boolean,reflect:!0})],exports.ChefUiSelect.prototype,"disabled",void 0),t([ut({type:Boolean,reflect:!0})],exports.ChefUiSelect.prototype,"invalid",void 0),t([ut({type:String})],exports.ChefUiSelect.prototype,"name",void 0),t([ut({type:Array})],exports.ChefUiSelect.prototype,"options",void 0),t([ut({type:Boolean,reflect:!0})],exports.ChefUiSelect.prototype,"required",void 0),t([ut({type:Boolean,reflect:!0})],exports.ChefUiSelect.prototype,"searchable",void 0),t([ut({type:String})],exports.ChefUiSelect.prototype,"prefixIcon",void 0),t([ut({type:String})],exports.ChefUiSelect.prototype,"searchPlaceholder",void 0),t([ft()],exports.ChefUiSelect.prototype,"isOpen",void 0),t([ft()],exports.ChefUiSelect.prototype,"searchQuery",void 0),t([vt(".dropdown")],exports.ChefUiSelect.prototype,"dropdownEl",void 0),t([vt(".search-input")],exports.ChefUiSelect.prototype,"searchInputEl",void 0),exports.ChefUiSelect=t([ct("chef-ui-select")],exports.ChefUiSelect),exports.IconResolver=gt,exports.iconResolver=bt;
|
|
150
447
|
//# sourceMappingURL=index.cjs.map
|